How to change the given text attribute's value without using ITextAttributeSuite?


hi,

 

i want enable , disable adornments on range of text(bu setting custom created attribute's value ktrue/kfalse), should not based on active selection. instead want navigate range of text , set value custom created boolean attribute ktrue.

 

below the code in .fr file

 /** custom attribute on text adornemnts added     */   class   {   kcustomtextplaceholderattrboss,   kattrbossreferencingboss,   {   /** hooks text composer telling   text adornment needs added.  provides   description of added text adornment.    */   iid_iattrreport, kcustomtextplaceholderattrreportimpl,   /** holds current state of text attribute    (adornment).  default, off. (api-provided implementation)    */   iid_itextattrboolean, ktextattrbooleanoffimpl,   }   }, 

 

please note default value of text attribute has been set off, need change value ktrue.

 

i can achieve using itextattributesuite follows, problem here don't have active selection on range of text planning change attribute's value

 // itextattributesuite on current text selection, if available.   interfaceptr<itextattributesuite> textattributesuite(ac->getcontextselection(), usedefaultiid());   if (textattributesuite == nil) {   break;   }   // change given text attribute's value, using text attribute suite.   if (textattributesuite->canapplyattributes()) {   status = textattributesuite->setbooleanattribute(attrclassid, value);   } 

 

can 1 suggest alternative method achieve this?

indesign sdk dirkbecker

finally able achieve using itextattrutils::buildapplytextattrcmd().

below code snippet applying custom created attribute range of text.

 

 interfaceptr<mycustomtextattrreportimpl> mycustomattr(::createobject2<mycustomtextattrreportimpl>(kcustomtextplaceholderattrboss));   if (mycustomattr== nil){   return false;   }   interfaceptr<itextattrboolean> itextattrboolean(mycustomattr, usedefaultiid());   if(itextattrboolean == nil){   return false;   }      itextattrboolean->set(ktrue);      interfaceptr<icommand> cmd(utils<itextattrutils>()->buildapplytextattrcmd(itextmodel, startpos, endpos - startpos, itextattrboolean, kcharattrstrandboss));   if(cmd == nil){   return false;   }     errorcode status = cmdutils::processcommand(cmd); 


More discussions in InDesign SDK


adobe

Comments

Popular posts from this blog

after effects warning: unable to create drawing surface

Maximum number of authorizations reached!