Article View: adobe.indesign.sdk
Article #4358Re: TxtImpFilter - formatting
From: Pszczolka
Date: Wed, 16 Jun 2004 21:21
Date: Wed, 16 Jun 2004 21:21
62 lines
3003 bytes
3003 bytes
by the way, that's the rest of the code of the function that I am using in this case...
(lines following "Import this")
// Get the text models for the source and the destination stories
InterfacePtr<ITextModel> pi_srcModel(co_importedItem,UseDefaultIID());
InterfacePtr<ITextModel> pi_dstModel(pi_GetTextModel(p_textbox));
// Replace the existing model
InterfacePtr<ICommand> pi_copyStoryRangeCmd( CmdUtils::CreateCommand(
kCopyStoryRangeCmdBoss));
// Set the story we are copying from
InterfacePtr<IUIDData> source(pi_copyStoryRangeCmd,UseDefaultIID());
source->Set(pi_srcModel);
// Set the story we are copying to
UIDList dest(pi_dstModel);
pi_copyStoryRangeCmd->SetItemList(dest);
// The range here specifies all the source
InterfacePtr<IRangeData> pi_sourceRange(pi_copyStoryRangeCmd,IID_IRANGEDATA);
// The range here specifies all the destination
InterfacePtr<IRangeData> pi_destRange(pi_copyStoryRangeCmd,IID_IRANGEDATA2);
// Set up the data interface for the source story by selecting the all
// story
pi_sourceRange->Set(0, pi_srcModel->GetPrimaryStoryThreadSpan() - 1);
// Set up the data interface for the destination story. If the story
// contains no inline box, then all the text is selected to be replaced. If
// the story contains inline box, then nothing is selected in the story
// (n_startIndex = n_destinationLength - 1) because we don't want to erase
// the inline text boxes
N n_destinationLength = pi_dstModel->GetPrimaryStoryThreadSpan();
N n_startIndex = 0;
if (b_DoesStoryOwnInlineBoxes(p_textbox))
{
n_startIndex = n_destinationLength - 1;
}
pi_destRange->Set(n_startIndex, n_destinationLength - 1);
// Process the command
// ***********************************************************************
// * Bug from ???: this function never returns when the imported story
// * contains a table
// ***********************************************************************
ErrorCode errorCode = CmdUtils::ProcessCommand(pi_copyStoryRangeCmd);
// Close the stream
//pco_stream->Flush();
StreamState ss = pco_stream->GetStreamState();
pco_stream->Close();
//delete pco_stream;
if (errorCode == kFailure)
{
CT_Errors::v_ThrowError(ec_Error_UnknowDtp,"ImportTextBox");
}
return (errorCode == kCancel);
Technical Details
Message-ID:
<3bb49c77.4@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news.agarik.com!news.agarik.com!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!webxReferences:
<3bb49c77.-1@webx.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f63e9,3ddc3a0042dd0ddc X-Google-Attributes: gidf63e9,public From: Pszczolka@adobeforums.com Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news.agarik.com!news.agarik.com!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.indesign.sdk Subject: Re: TxtImpFilter - formatting Message-ID: <3bb49c77.4@webx.la2eafNXanI> Date: Wed, 16 Jun 2004 14:21:42 -0700 References: <3bb49c77.-1@webx.la2eafNXanI> Lines: 73 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit