Article View: adobe.indesign.sdk
Article #117Error for ReplaceCmd while calling it in loop
From: pallavik
Date: Tue, 03 Mar 2009 07:32
Date: Tue, 03 Mar 2009 07:32
42 lines
1916 bytes
1916 bytes
Hello All,
I am calling ReplaceCmd in for loop , where I am replacing one character on textmodel at a time
and applying it's coreesponding attributes.
But after processing some characters ReplaceCmd command failed and indesign get hanged.
int firstbyte = 0;
char * splitstr1 = NULL;
char * fontname1 = NULL;
for(int k =0 ;k < ushortstrlen(pszString);k++)
{
splitstr1 = (char *)calloc(sizeof(char),10);
fontname1 = (char *)calloc(sizeof(char),10);
firstbyte = (int)(pszString[k] & 0x0F00);
* splitstr1 = (char)(pszString[k] & 0xFF);
size_t origsize = strlen(splitstr1) + 1;
const size_t newsize = 100;
wchar_t wcstring[newsize];
wcstring[0] = 0;
mbstowcs(wcstring,splitstr1,origsize);
K2::shared_ptr<WideString>wide(new WideString(wcstring));
RangeData rangeforconv(iConvStartat,iConvStartat + wcslen(wcstring));
InterfacePtr<ICommand>replaceCmd(textModelCmds->ReplaceCmd (iConvStartat,iConvStartat + wcslen(wcstring), wide,kFalse));
ASSERT(replaceCmd);
if (!replaceCmd)
{
return;
}
CmdUtils::ProcessCommand(replaceCmd);
.
.
.
.
iConvStartat = iConvStartat + wcslen(wcstring);
.
.
}//end of for loop
I trace the values of iConvStartat I am getting it properly in sequence.
For first 3-4 characters it is working properly but after that indesign gets hanged.
Technical Details
Message-ID:
<59b818fb.-1@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!newshub.sdsu.edu!webcrossingShow Full Headers
Complete Article Headers
X-Google-Thread: f63e9,28d8ffdd598cb922,start X-Google-Attributes: gidf63e9,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: pallavik@adobeforums.com Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.indesign.sdk Subject: Error for ReplaceCmd while calling it in loop Message-ID: <59b818fb.-1@webcrossing.la2eafNXanI> Date: Mon, 2 Mar 2009 23:32:53 -0800 Lines: 48 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit