Hi Max, On 08/26/08 20:33, Maximilian Odendahl wrote:
I have the following function, which seems to do what I want: //returns true, if there is another note right before this note bool SwPostIt::IsFollow() { SwPosition * pPos = mpFmtFld->GetTxtFld()->GetPosition(); const SwTxtNode* pTxtNd = pPos->nNode.GetNode().GetTxtNode();SwTxtAttr* pTxtAttr = pTxtNd ? pTxtNd->GetTxtAttr( pPos->nContent.GetIndex()-1,RES_TXTATR_FIELD ) : 0;const SwField* pFld = pTxtAttr ? pTxtAttr->GetFld().GetFld() : 0; delete pPos; return pFld && (pFld->Which()== RES_POSTITFLD) ; }
looks fine for me. But I think you should add a check for pPos->nContent.GetIndex() == 0. I guess that mpFmtFld and mpFmtFld->GetTxtFld() are always != 0, right?
As I am not really familiar with Node-stuff, could someone review and let me know if this is the right way to do and this does not have any bad sideeffects/possible crashers?
Well, we'll find out sooner or later ;-) Just kidding: No side effects, no possible crashes.
This does not yet work if there is hidden text in between, do I have to go step-by-step backwards and check for the hidden attribute or is there an easier way?
So I guess you just want to skip the hidden characters, right? Have a look at scriptinfo.hxx, there are some helper methods for hidden text stuff (seach for // HIDDEN TEXT STUFF ;-)
Hope this helps, Frank -- Frank Meies (fme) - OpenOffice.org Writer OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
