openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From o..@apache.org
Subject svn commit: r1552394 [3/4] - in /openoffice/trunk: ./ main/sw/ main/sw/inc/ main/sw/source/core/access/ main/sw/source/core/bastyp/ main/sw/source/core/crsr/ main/sw/source/core/doc/ main/sw/source/core/docnode/ main/sw/source/core/edit/ main/sw/source...
Date Thu, 19 Dec 2013 18:51:01 GMT
Modified: openoffice/trunk/main/sw/source/core/unocore/unofield.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/unocore/unofield.cxx?rev=1552394&r1=1552393&r2=1552394&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/unocore/unofield.cxx (original)
+++ openoffice/trunk/main/sw/source/core/unocore/unofield.cxx Thu Dec 19 18:50:58 2013
@@ -90,8 +90,6 @@
 #include <docsh.hxx>
 #include <fmtmeta.hxx> // MetaFieldManager
 #include <switerator.hxx>
-#include <bookmrk.hxx>
-#include <xmloff/odffields.hxx>
 
 
 using ::rtl::OUString;
@@ -1089,40 +1087,50 @@ sal_Int64 SAL_CALL SwXTextField::getSome
 	return 0;
 }
 
-SwXTextField::SwXTextField(sal_uInt16 nServiceId, SwDoc* pDoc) :
-	aLstnrCntnr( (XTextContent*)this),
-	pFmtFld(0),
-	m_pDoc(pDoc),
-	m_pTextObject(0),
-	m_bIsDescriptor(nServiceId != USHRT_MAX),
-    m_bCallUpdate(sal_False),
-	m_nServiceId(nServiceId),
-    m_pProps(new SwFieldProperties_Impl)
-{
-	//Set visible as default!
-    if(SW_SERVICE_FIELDTYPE_SET_EXP == nServiceId ||
-            SW_SERVICE_FIELDTYPE_DATABASE_SET_NUM == nServiceId ||
-            SW_SERVICE_FIELDTYPE_DATABASE == nServiceId ||
-            SW_SERVICE_FIELDTYPE_DATABASE_NAME == nServiceId  )
-		m_pProps->bBool2 = sal_True;
-    else if(SW_SERVICE_FIELDTYPE_TABLE_FORMULA == nServiceId)
+SwXTextField::SwXTextField(
+    sal_uInt16 nServiceId,
+    SwDoc* pDoc )
+    : m_aLstnrCntnr( (XTextContent*)this)
+    , m_pFmtFld(0)
+    , m_pDoc(pDoc)
+    , m_pTextObject(0)
+    , m_bIsDescriptor(nServiceId != USHRT_MAX)
+    , m_bCallUpdate(sal_False)
+    , m_nServiceId(nServiceId)
+    , m_pProps( new SwFieldProperties_Impl() )
+{
+    //Set visible as default!
+    if ( SW_SERVICE_FIELDTYPE_SET_EXP == nServiceId
+         || SW_SERVICE_FIELDTYPE_DATABASE_SET_NUM == nServiceId
+         || SW_SERVICE_FIELDTYPE_DATABASE == nServiceId
+         || SW_SERVICE_FIELDTYPE_DATABASE_NAME == nServiceId )
+    {
+        m_pProps->bBool2 = sal_True;
+    }
+    else if( SW_SERVICE_FIELDTYPE_TABLE_FORMULA == nServiceId )
+    {
         m_pProps->bBool1 = sal_True;
-    if(SW_SERVICE_FIELDTYPE_SET_EXP == nServiceId)
+    }
+    if ( SW_SERVICE_FIELDTYPE_SET_EXP == nServiceId )
+    {
         m_pProps->nUSHORT2 = USHRT_MAX;
+    }
 
 }
 
-SwXTextField::SwXTextField(const SwFmtFld& rFmt, SwDoc* pDc) :
-	aLstnrCntnr( (XTextContent*)this),
-	pFmtFld(&rFmt),
-	m_pDoc(pDc),
-	m_pTextObject(0),
-	m_bIsDescriptor(sal_False),
-    m_bCallUpdate(sal_False),
-	m_nServiceId( lcl_GetServiceForField( *pFmtFld->GetField() ) ),
-    m_pProps(0)
+SwXTextField::SwXTextField(
+    const SwFmtFld& rFmt,
+    SwDoc* pDc )
+    : m_aLstnrCntnr( (XTextContent*)this)
+    , m_pFmtFld(&rFmt)
+    , m_pDoc(pDc)
+    , m_pTextObject(0)
+    , m_bIsDescriptor(sal_False)
+    , m_bCallUpdate(sal_False)
+    , m_nServiceId( lcl_GetServiceForField( *m_pFmtFld->GetField() ) )
+    , m_pProps(0)
 {
-	pDc->GetUnoCallBack()->Add(this);
+    pDc->GetUnoCallBack()->Add(this);
 }
 
 SwXTextField::~SwXTextField()
@@ -1171,7 +1179,7 @@ uno::Reference< beans::XPropertySet >  S
     {        
         if(!GetRegisteredIn())
             throw uno::RuntimeException();
-        pType = pFmtFld->GetField()->GetTyp();
+        pType = m_pFmtFld->GetField()->GetTyp();
     }
 
     SwXFieldMaster* pMaster = SwIterator<SwXFieldMaster,SwFieldType>::FirstElement( *pType );
@@ -1219,7 +1227,6 @@ void SwXTextField::attachToRange(
     if(pDoc && (!m_pDoc || m_pDoc == pDoc))
     {
         SwUnoInternalPaM aPam(*pDoc);
-        //das muss jetzt sal_True liefern
         ::sw::XTextRangeToSwPaM(aPam, xTextRange);
         SwField* pFld = 0;
         switch(m_nServiceId)
@@ -1238,7 +1245,7 @@ void SwXTextField::attachToRange(
                     aDateTime.SetMin(m_pProps->pDateTime->Minutes);
                     aDateTime.SetSec(m_pProps->pDateTime->Seconds);
                 }
-                pFld = new SwPostItField(
+                SwPostItField* pPostItField = new SwPostItField(
                     (SwPostItFieldType*)pFldType,
                     m_pProps->sPar2, // content
                     m_pProps->sPar1, // author
@@ -1247,9 +1254,10 @@ void SwXTextField::attachToRange(
                     aDateTime );
                 if ( m_pTextObject )
                 {
-                    ((SwPostItField*)pFld)->SetTextObject( m_pTextObject->CreateText() );
-                    ((SwPostItField*)pFld)->SetPar2(m_pTextObject->GetText());
+                    pPostItField->SetTextObject( m_pTextObject->CreateText() );
+                    pPostItField->SetPar2(m_pTextObject->GetText());
                 }
+                pFld = pPostItField;
             }
             break;
 
@@ -1743,7 +1751,6 @@ void SwXTextField::attachToRange(
             SwFmtFld aFmt( *pFld );
 
             UnoActionContext aCont(pDoc);
-            SwTxtAttr* pTxtAttr = 0;
             if ( aPam.HasMark()
                  && m_nServiceId != SW_SERVICE_FIELDTYPE_ANNOTATION )
             {
@@ -1763,45 +1770,32 @@ void SwXTextField::attachToRange(
             if ( *aPam.GetPoint() != *aPam.GetMark()
                  && m_nServiceId == SW_SERVICE_FIELDTYPE_ANNOTATION )
             {
-                IDocumentMarkAccess* pMarksAccess = pDoc->getIDocumentMarkAccess();
-                sw::mark::IFieldmark* pFieldmark =
-                    pMarksAccess->makeFieldBookmark(
-                        aPam,
-                        OUString(),
-                        ::rtl::OUString::createFromAscii( ODF_COMMENTRANGE ) );
-                ASSERT( pFieldmark != NULL, "<SwXTextField::attachToRange(..)> - <IFieldmark> instance for SW_SERVICE_FIELDTYPE_ANNOTATION not created!" );
-                if ( pFieldmark != NULL )
-                {
-                    SwPostItField* pPostItField = dynamic_cast<SwPostItField*>(aFmt.GetField());
-                    ASSERT( pPostItField != NULL, "<SwXTextField::attachToRange(..)> - missing <SwPostItField> instance for SW_SERVICE_FIELDTYPE_ANNOTATION!" );
-                    if ( pPostItField != NULL )
-                    {
-                        if ( pPostItField->GetName().Len() > 0 )
-                        {
-                            // The field has a name already, use it.
-                            pMarksAccess->renameMark(pFieldmark, pPostItField->GetName());
-                        }
-                        else
-                        {
-                            // The fieldmark always has a (generated) name.
-                            pPostItField->SetName( pFieldmark->GetName() );
-                        }
-                    }
-                }
-
-                // Make sure we always insert the field at the end
+                // Make sure we always insert the annotation at the end of the provided text range
                 SwPaM aEnd(*aPam.End(), *aPam.End());
                 pDoc->InsertPoolItem(aEnd, aFmt, nInsertFlags);
             }
             else
                 pDoc->InsertPoolItem(aPam, aFmt, nInsertFlags);
 
-            pTxtAttr = aPam.GetNode()->GetTxtNode()->GetFldTxtAttrAt( aPam.GetPoint()->nContent.GetIndex()-1, true );
+            SwTxtAttr* pTxtAttr = aPam.GetNode()->GetTxtNode()->GetFldTxtAttrAt( aPam.GetPoint()->nContent.GetIndex()-1, true );
             // was passiert mit dem Update der Felder ? (siehe fldmgr.cxx)
-            if(pTxtAttr)
+            if ( pTxtAttr != NULL )
             {
                 const SwFmtFld& rFld = pTxtAttr->GetFmtFld();
-                pFmtFld = &rFld;
+                m_pFmtFld = &rFld;
+
+                if ( pTxtAttr->Which() == RES_TXTATR_ANNOTATION
+                     && *aPam.GetPoint() != *aPam.GetMark() )
+                {
+                    // create annotation mark
+                    const SwPostItField* pPostItField = dynamic_cast< const SwPostItField* >(pTxtAttr->GetFmtFld().GetField());
+                    ASSERT( pPostItField != NULL, "<SwXTextField::attachToRange(..)> - annotation field missing!" );
+                    if ( pPostItField != NULL )
+                    {
+                        IDocumentMarkAccess* pMarksAccess = pDoc->getIDocumentMarkAccess();
+                        pMarksAccess->makeAnnotationMark( aPam, pPostItField->GetName() );
+                    }
+                }
             }
         }
         delete pFld;
@@ -1819,11 +1813,69 @@ void SwXTextField::attachToRange(
         throw lang::IllegalArgumentException();
 }
 
-void SwXTextField::attach(const uno::Reference< text::XTextRange > & xTextRange)
-	throw( lang::IllegalArgumentException, uno::RuntimeException )
+void SwXTextField::attach( const uno::Reference< text::XTextRange > & xTextRange )
+    throw( lang::IllegalArgumentException, uno::RuntimeException )
 {
-	vos::OGuard aGuard(Application::GetSolarMutex());
-    attachToRange( xTextRange );
+    vos::OGuard aGuard(Application::GetSolarMutex());
+
+    if ( m_bIsDescriptor )
+    {
+        attachToRange( xTextRange );
+    }
+    else if ( m_pFmtFld != NULL
+              && m_pDoc != NULL
+              && m_nServiceId == SW_SERVICE_FIELDTYPE_ANNOTATION )
+    {
+        SwUnoInternalPaM aIntPam( *m_pDoc );
+        if ( ::sw::XTextRangeToSwPaM( aIntPam, xTextRange ) )
+        {
+            // nothing to do, if the text range only covers the former annotation field
+            if ( aIntPam.Start()->nNode != aIntPam.End()->nNode
+                 || aIntPam.Start()->nContent.GetIndex() != aIntPam.End()->nContent.GetIndex()-1 )
+            {
+                UnoActionContext aCont( m_pDoc );
+                // insert copy of annotation at new text range
+                SwPostItField* pPostItField = dynamic_cast< SwPostItField* >(m_pFmtFld->GetField()->CopyField());
+                SwFmtFld aFmtFld( *pPostItField );
+                delete pPostItField;
+                SwPaM aEnd( *aIntPam.End(), *aIntPam.End() );
+                m_pDoc->InsertPoolItem( aEnd, aFmtFld, nsSetAttrMode::SETATTR_DEFAULT );
+                // delete former annotation
+                {
+                    const SwTxtFld* pTxtFld = m_pFmtFld->GetTxtFld();
+                    SwTxtNode& rTxtNode = (SwTxtNode&)*pTxtFld->GetpTxtNode();
+                    SwPaM aPam( rTxtNode, *pTxtFld->GetStart() );
+                    aPam.SetMark();
+                    aPam.Move();
+                    GetDoc()->DeleteAndJoin(aPam);
+                }
+                // keep inserted annotation
+                {
+                    SwTxtFld* pTxtAttr = aEnd.GetNode()->GetTxtNode()->GetFldTxtAttrAt( aEnd.End()->nContent.GetIndex()-1, true );
+                    if ( pTxtAttr != NULL )
+                    {
+                        m_pFmtFld = &pTxtAttr->GetFmtFld();
+
+                        if ( *aIntPam.GetPoint() != *aIntPam.GetMark() )
+                        {
+                            // create annotation mark
+                            const SwPostItField* pPostItField = dynamic_cast< const SwPostItField* >(pTxtAttr->GetFmtFld().GetField());
+                            ASSERT( pPostItField != NULL, "<SwXTextField::attach(..)> - annotation field missing!" );
+                            if ( pPostItField != NULL )
+                            {
+                                IDocumentMarkAccess* pMarksAccess = aIntPam.GetDoc()->getIDocumentMarkAccess();
+                                pMarksAccess->makeAnnotationMark( aIntPam, pPostItField->GetName() );
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        else
+            throw lang::IllegalArgumentException();
+    }
+    else
+        throw lang::IllegalArgumentException();
 }
 
 uno::Reference< text::XTextRange >  SwXTextField::getAnchor(void) throw( uno::RuntimeException )
@@ -1833,7 +1885,7 @@ uno::Reference< text::XTextRange >  SwXT
 	SwField* pField = (SwField*)GetField();
 	if(pField)
 	{
-		const SwTxtFld* pTxtFld = pFmtFld->GetTxtFld();
+		const SwTxtFld* pTxtFld = m_pFmtFld->GetTxtFld();
 		if(!pTxtFld)
 			throw uno::RuntimeException();
 		const SwTxtNode& rTxtNode = pTxtFld->GetTxtNode();
@@ -1854,7 +1906,7 @@ void SwXTextField::dispose(void) throw( 
 	if(pField)
 	{
 		UnoActionContext aContext(GetDoc());
-		const SwTxtFld* pTxtFld = pFmtFld->GetTxtFld();
+		const SwTxtFld* pTxtFld = m_pFmtFld->GetTxtFld();
 		SwTxtNode& rTxtNode = (SwTxtNode&)*pTxtFld->GetpTxtNode();
 		SwPaM aPam(rTxtNode, *pTxtFld->GetStart());
 		aPam.SetMark();
@@ -1874,12 +1926,12 @@ void SwXTextField::addEventListener(cons
 {
 	if(!GetRegisteredIn())
 		throw uno::RuntimeException();
-	aLstnrCntnr.AddListener(aListener);
+	m_aLstnrCntnr.AddListener(aListener);
 }
 
 void SwXTextField::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
 {
-	if(!GetRegisteredIn() || !aLstnrCntnr.RemoveListener(aListener))
+	if(!GetRegisteredIn() || !m_aLstnrCntnr.RemoveListener(aListener))
 		throw uno::RuntimeException();
 }
 
@@ -1941,7 +1993,7 @@ void SwXTextField::setPropertyValue(cons
 
             if (NULL != pDoc)
             {
-                const SwTxtFld* pTxtFld = pFmtFld->GetTxtFld();
+                const SwTxtFld* pTxtFld = m_pFmtFld->GetTxtFld();
                 if(!pTxtFld)
                     throw uno::RuntimeException();
                 SwPosition aPosition( pTxtFld->GetTxtNode() );
@@ -1953,16 +2005,16 @@ void SwXTextField::setPropertyValue(cons
         pField->PutValue( rValue, pEntry->nWID );
 
 	//#i100374# notify SwPostIt about new field content
-	if (RES_POSTITFLD== nWhich && pFmtFld)
+	if (RES_POSTITFLD== nWhich && m_pFmtFld)
 	{
-		const_cast<SwFmtFld*>(pFmtFld)->Broadcast(SwFmtFldHint( 0, SWFMTFLD_CHANGED ));
+		const_cast<SwFmtFld*>(m_pFmtFld)->Broadcast(SwFmtFldHint( 0, SWFMTFLD_CHANGED ));
 	}
 
         //#114571# changes of the expanded string have to be notified
         //#to the SwTxtFld
-        if(RES_DBFLD == nWhich && pFmtFld->GetTxtFld())
+        if(RES_DBFLD == nWhich && m_pFmtFld->GetTxtFld())
         {
-            pFmtFld->GetTxtFld()->ExpandTxtFld();
+            m_pFmtFld->GetTxtFld()->ExpandTxtFld();
         }
 	
 	//#i100374# changing a document field should set the modify flag
@@ -2124,7 +2176,7 @@ uno::Any SwXTextField::getPropertyValue(
 
                 // get text node for the text field
                 const SwFmtFld *pFldFmt = GetFldFmt();
-                const SwTxtFld* pTxtFld = pFldFmt ? pFmtFld->GetTxtFld() : 0;
+                const SwTxtFld* pTxtFld = pFldFmt ? pFldFmt->GetTxtFld() : 0;
                 if(!pTxtFld)
                     throw uno::RuntimeException();
                 const SwTxtNode& rTxtNode = pTxtFld->GetTxtNode();
@@ -2178,7 +2230,7 @@ uno::Any SwXTextField::getPropertyValue(
 						m_pTextObject->acquire();
 					}
 					
-					uno::Reference < text::XText > xText( m_pTextObject  );
+					uno::Reference < text::XText > xText( m_pTextObject );
 					aRet <<= xText;
 					break;
 				}
@@ -2322,7 +2374,7 @@ void SwXTextField::update(  ) throw (uno
         }
 		// --> FME 2004-10-06 #116480#
 		// Text formatting has to be triggered.
-		const_cast<SwFmtFld*>(pFmtFld)->ModifyNotification( 0, 0 );
+		const_cast<SwFmtFld*>(m_pFmtFld)->ModifyNotification( 0, 0 );
 		// <--
     }
     else
@@ -2393,8 +2445,8 @@ sal_uInt16 SwXTextField::GetServiceId()
 	if (GetRegisteredIn())
 	{
 		((SwModify*)GetRegisteredIn())->Remove(this);
-		aLstnrCntnr.Disposing();
-		pFmtFld = 0;
+		m_aLstnrCntnr.Disposing();
+		m_pFmtFld = 0;
 		m_pDoc = 0;
 	}
 }
@@ -2417,7 +2469,7 @@ void SwXTextField::Modify( const SfxPool
 			Invalidate();
 		break;
 	case RES_FIELD_DELETED:
-		if( (void*)pFmtFld == ((SwPtrMsgPoolItem *)pOld)->pObject )
+		if( (void*)m_pFmtFld == ((SwPtrMsgPoolItem *)pOld)->pObject )
 			Invalidate();
 		break;
 	}
@@ -2425,9 +2477,9 @@ void SwXTextField::Modify( const SfxPool
 
 const SwField*  SwXTextField::GetField() const
 {
-    if ( GetRegisteredIn() && pFmtFld )
+    if ( GetRegisteredIn() && m_pFmtFld )
     {
-        return  pFmtFld->GetField();
+        return m_pFmtFld->GetField();
     }
     return 0;
 }

Modified: openoffice/trunk/main/sw/source/core/unocore/unoport.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/unocore/unoport.cxx?rev=1552394&r1=1552393&r2=1552394&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/unocore/unoport.cxx (original)
+++ openoffice/trunk/main/sw/source/core/unocore/unoport.cxx Thu Dec 19 18:50:58 2013
@@ -74,9 +74,10 @@ void SwXTextPortion::init(const SwUnoCrs
 /*-- 11.12.98 09:56:55---------------------------------------------------
 
   -----------------------------------------------------------------------*/
-SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr,
-        uno::Reference< text::XText > const& rParent,
-        SwTextPortionType eType)
+SwXTextPortion::SwXTextPortion(
+    const SwUnoCrsr* pPortionCrsr,
+    uno::Reference< text::XText > const& rParent,
+    SwTextPortionType eType )
     : m_ListenerContainer( static_cast<text::XTextRange*>(this) )
     , m_pPropSet(aSwMapProvider.GetPropertySet(
         (PORTION_REDLINE_START == eType ||
@@ -99,9 +100,10 @@ SwXTextPortion::SwXTextPortion(const SwU
 /* -----------------24.03.99 16:30-------------------
  *
  * --------------------------------------------------*/
-SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr,
-        uno::Reference< text::XText > const& rParent,
-        SwFrmFmt& rFmt )
+SwXTextPortion::SwXTextPortion(
+    const SwUnoCrsr* pPortionCrsr,
+    uno::Reference< text::XText > const& rParent,
+    SwFrmFmt& rFmt )
     : m_ListenerContainer( static_cast<text::XTextRange*>(this) )
     , m_pPropSet(aSwMapProvider.GetPropertySet(
                     PROPERTY_MAP_TEXTPORTION_EXTENSIONS))
@@ -121,10 +123,11 @@ SwXTextPortion::SwXTextPortion(const SwU
 /* -----------------------------19.02.01 10:52--------------------------------
 
  ---------------------------------------------------------------------------*/
-SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr,
-                    SwTxtRuby const& rAttr,
-                    uno::Reference< text::XText > const& xParent,
-                    sal_Bool bIsEnd )
+SwXTextPortion::SwXTextPortion(
+    const SwUnoCrsr* pPortionCrsr,
+    SwTxtRuby const& rAttr,
+    uno::Reference< text::XText > const& xParent,
+    sal_Bool bIsEnd )
     : m_ListenerContainer( static_cast<text::XTextRange*>(this) )
     , m_pPropSet(aSwMapProvider.GetPropertySet(
                     PROPERTY_MAP_TEXTPORTION_EXTENSIONS))
@@ -310,6 +313,12 @@ void SwXTextPortion::GetPropertyValue(
                 case PORTION_FIELD_START:pRet = "TextFieldStart";break;
                 case PORTION_FIELD_END:pRet = "TextFieldEnd";break;
                 case PORTION_FIELD_START_END:pRet = "TextFieldStartEnd";break;
+                case PORTION_ANNOTATION:
+                    pRet = "Annotation";
+                    break;
+                case PORTION_ANNOTATION_END:
+                    pRet = "AnnotationEnd";
+                    break;
                 default:
                     pRet = 0;
                 }

Modified: openoffice/trunk/main/sw/source/core/unocore/unoportenum.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/unocore/unoportenum.cxx?rev=1552394&r1=1552393&r2=1552394&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/unocore/unoportenum.cxx (original)
+++ openoffice/trunk/main/sw/source/core/unocore/unoportenum.cxx Thu Dec 19 18:50:58 2013
@@ -28,6 +28,7 @@
 #include <unoport.hxx>
 #include <IMark.hxx>
 #include <crossrefbookmark.hxx>
+#include <annotationmark.hxx>
 #include <doc.hxx>
 #include <txatbase.hxx>
 #include <txtatr.hxx>
@@ -56,6 +57,8 @@
 #include <switerator.hxx>
 #include <docufld.hxx>
 #include <fmtfld.hxx>
+#include <txtfld.hxx>
+#include <txtannotationfld.hxx>
 #include <vos/mutex.hxx>
 #include <vcl/svapp.hxx>
 #include <set>
@@ -102,7 +105,7 @@ namespace
         , aPosition ( rPosition )
         {
         }
-        sal_uLong getIndex ()
+        xub_StrLen getIndex ()
         {
             return aPosition.nContent.GetIndex();
         }
@@ -196,8 +199,88 @@ namespace
             }
         }
     }
-}
 
+    struct SwAnnotationStartPortion_Impl
+    {
+
+        uno::Reference< text::XTextField > mxAnnotationField;
+        const SwPosition maPosition;
+
+        SwAnnotationStartPortion_Impl(
+            uno::Reference< text::XTextField > const& xAnnotationField,
+            SwPosition const& rPosition)
+        : mxAnnotationField ( xAnnotationField )
+        , maPosition ( rPosition )
+        {
+        }
+
+        xub_StrLen getIndex ()
+        {
+            return maPosition.nContent.GetIndex();
+        }
+    };
+    typedef boost::shared_ptr < SwAnnotationStartPortion_Impl > SwAnnotationStartPortion_ImplSharedPtr;
+    struct AnnotationStartCompareStruct
+    {
+        bool operator () ( const SwAnnotationStartPortion_ImplSharedPtr &r1,
+                           const SwAnnotationStartPortion_ImplSharedPtr &r2 )
+        {
+            return r1->maPosition < r2->maPosition;
+        }
+    };
+    typedef std::multiset < SwAnnotationStartPortion_ImplSharedPtr, AnnotationStartCompareStruct > SwAnnotationStartPortion_ImplList;
+
+    static void lcl_FillAnnotationStartArray(
+        SwDoc& rDoc,
+        SwUnoCrsr& rUnoCrsr,
+        SwAnnotationStartPortion_ImplList& rAnnotationStartArr )
+    {
+        IDocumentMarkAccess* const pMarkAccess = rDoc.getIDocumentMarkAccess();
+        if ( pMarkAccess->getAnnotationMarksCount() == 0 )
+        {
+            return;
+        }
+
+        // no need to consider annotation marks starting after aEndOfPara
+        SwPosition aEndOfPara(*rUnoCrsr.GetPoint());
+        aEndOfPara.nContent = aEndOfPara.nNode.GetNode().GetTxtNode()->Len();
+        const IDocumentMarkAccess::const_iterator_t pCandidatesEnd = upper_bound(
+            pMarkAccess->getAnnotationMarksBegin(),
+            pMarkAccess->getAnnotationMarksEnd(),
+            aEndOfPara,
+            bind(&::sw::mark::IMark::StartsAfter, _2, _1)); // finds the first that starts after
+
+        // search for all annotation marks that have its start position in this paragraph
+        const SwNodeIndex nOwnNode = rUnoCrsr.GetPoint()->nNode;
+        for( IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getAnnotationMarksBegin();
+             ppMark != pCandidatesEnd;
+             ++ppMark )
+        {
+            ::sw::mark::AnnotationMark* const pAnnotationMark =
+                dynamic_cast< ::sw::mark::AnnotationMark* >(ppMark->get());
+
+            if ( pAnnotationMark == NULL )
+            {
+                continue;
+            }
+
+            const SwPosition& rStartPos = pAnnotationMark->GetMarkStart();
+            if ( rStartPos.nNode == nOwnNode )
+            {
+                const SwFmtFld* pAnnotationFmtFld = pAnnotationMark->GetAnnotationFmtFld();
+                ASSERT( pAnnotationFmtFld != NULL, "<lcl_FillAnnotationStartArray(..)> - annotation fmt fld instance missing!" );
+                if ( pAnnotationFmtFld != NULL )
+                {
+                    rAnnotationStartArr.insert(
+                        SwAnnotationStartPortion_ImplSharedPtr(
+                            new SwAnnotationStartPortion_Impl(
+                            SwXTextField::CreateSwXTextField( rDoc, *pAnnotationFmtFld ),
+                            rStartPos ) ) );
+                }
+            }
+        }
+    }
+}
 
 /******************************************************************
  *	SwXTextPortionEnumeration
@@ -349,32 +432,6 @@ static void lcl_FillFieldMarkArray(
     }
 }
 
-static const SwFmtFld* lcl_getFieldByName(
-    SwDoc* pDoc,
-    const OUString& rName)
-{
-    const SwFldTypes* pFldTypes = pDoc->GetFldTypes();
-    const sal_uInt16 nCount = pFldTypes->Count();
-    for ( sal_uInt16 nType = 0; nType < nCount; ++nType)
-    {
-        const SwFieldType *pCurType = (*pFldTypes)[nType];
-        SwIterator<SwFmtFld, SwFieldType> aIter(*pCurType);
-        for (const SwFmtFld* pCurFldFmt = aIter.First(); pCurFldFmt; pCurFldFmt = aIter.Next())
-        {
-            if (pCurFldFmt->GetField()->GetTyp()->Which() != RES_POSTITFLD)
-                continue;
-
-            const SwPostItField* pField = dynamic_cast<const SwPostItField*>(pCurFldFmt->GetField());
-            if ( pField != NULL && pField->GetName() == String( rName ) )
-            {
-                return pCurFldFmt;
-            }
-        }
-    }
-
-    return NULL;
-}
-
 static uno::Reference<text::XTextRange>
 lcl_ExportFieldMark(
         uno::Reference< text::XText > const & i_xParentText,
@@ -412,11 +469,6 @@ lcl_ExportFieldMark(
              && pDoc != NULL )
         {
             pPortion->SetBookmark( SwXFieldmark::CreateXFieldmark( *pDoc, *pFieldmark ) );
-            Reference<XTextField> xField;
-            const SwFmtFld* pField = lcl_getFieldByName( pDoc, pFieldmark->GetName() );
-            if (pField)
-                xField = SwXTextField::CreateSwXTextField(*pDoc, *pField);
-            pPortion->SetTextField(xField);
         }
     }
     else if (CH_TXT_ATR_FIELDEND == Char)
@@ -442,8 +494,7 @@ lcl_ExportFieldMark(
         ::sw::mark::IFieldmark* pFieldmark = NULL;
         if ( pDoc != NULL )
         {
-            pFieldmark = pDoc->getIDocumentMarkAccess()->
-                getFieldmarkFor(*pUnoCrsr->GetMark());
+            pFieldmark = pDoc->getIDocumentMarkAccess()->getFieldmarkFor(*pUnoCrsr->GetMark());
         }
         SwXTextPortion* pPortion =
             new SwXTextPortion( pUnoCrsr, i_xParentText, PORTION_FIELD_START_END );
@@ -567,24 +618,23 @@ lcl_CreateMetaPortion(
 }
 
 //-----------------------------------------------------------------------------
-static void
-lcl_ExportBookmark(
+static void lcl_ExportBookmark(
     TextRangeList_t & rPortions,
     Reference<XText> const& xParent,
     const SwUnoCrsr * const pUnoCrsr,
-    SwXBookmarkPortion_ImplList& rBkmArr, const sal_uLong nIndex)
+    SwXBookmarkPortion_ImplList& rBkmArr,
+    const xub_StrLen nIndex)
 {
-	for ( SwXBookmarkPortion_ImplList::iterator aIter = rBkmArr.begin(), aEnd = rBkmArr.end();
-		  aIter != aEnd; )
-	{
-		SwXBookmarkPortion_ImplSharedPtr pPtr = (*aIter);
-		if ( nIndex > pPtr->getIndex() )
-		{
-			rBkmArr.erase( aIter++ );
-			continue;
-		}
-		if ( nIndex < pPtr->getIndex() )
-			break;
+    for ( SwXBookmarkPortion_ImplList::iterator aIter = rBkmArr.begin(), aEnd = rBkmArr.end(); aIter != aEnd; )
+    {
+        SwXBookmarkPortion_ImplSharedPtr pPtr = (*aIter);
+        if ( nIndex > pPtr->getIndex() )
+        {
+            rBkmArr.erase( aIter++ );
+            continue;
+        }
+        if ( nIndex < pPtr->getIndex() )
+            break;
 
         SwXTextPortion* pPortion = 0;
         if ((BKM_TYPE_START     == pPtr->nBkmType) ||
@@ -605,8 +655,8 @@ lcl_ExportBookmark(
             rPortions.push_back(pPortion);
             pPortion->SetBookmark(pPtr->xBookmark);
         }
-		rBkmArr.erase( aIter++ );
-	}
+        rBkmArr.erase( aIter++ );
+    }
 }
 
 static void
@@ -614,7 +664,8 @@ lcl_ExportSoftPageBreak(
     TextRangeList_t & rPortions,
     Reference<XText> const& xParent,
     const SwUnoCrsr * const pUnoCrsr,
-    SwSoftPageBreakList& rBreakArr, const sal_uLong nIndex)
+    SwSoftPageBreakList& rBreakArr,
+    const xub_StrLen nIndex)
 {
     for ( SwSoftPageBreakList::iterator aIter = rBreakArr.begin(),
           aEnd = rBreakArr.end();
@@ -656,7 +707,7 @@ struct SwXRedlinePortion_Impl
     {
     }
 
-    sal_uLong getRealIndex ()
+    xub_StrLen getRealIndex ()
     {
         return m_bStart ? m_pRedline->Start()->nContent.GetIndex()
                         : m_pRedline->End()  ->nContent.GetIndex();
@@ -789,19 +840,20 @@ lcl_ExportHints(
 		nCurrentIndex >= (nNextStart = (*pHints->GetStart(nStartIndex)->GetStart())))
     {
         SwTxtAttr * const pAttr = pHints->GetStart(nStartIndex);
-		sal_uInt16 nAttrWhich = pAttr->Which();
+        sal_uInt16 nAttrWhich = pAttr->Which();
         if (nNextStart == nCurrentIndex)
         {
             switch( nAttrWhich )
             {
                 case RES_TXTATR_FIELD:
-                    if(!bRightMoveForbidden)
+                   if(!bRightMoveForbidden)
                     {
                         pUnoCrsr->Right(1,CRSR_SKIP_CHARS,sal_False,sal_False);
                         if( *pUnoCrsr->GetMark() == *pUnoCrsr->GetPoint() )
                             break;
                         SwXTextPortion* pPortion;
-                        xRef = pPortion = new SwXTextPortion(
+                        xRef = pPortion =
+                            new SwXTextPortion(
                                 pUnoCrsr, xParent, PORTION_FIELD);
                         Reference<XTextField> xField =
                             SwXTextField::CreateSwXTextField(*pDoc, pAttr->GetFmtFld());
@@ -809,6 +861,32 @@ lcl_ExportHints(
                     }
                     break;
 
+                case RES_TXTATR_ANNOTATION:
+                    if(!bRightMoveForbidden)
+                    {
+                        pUnoCrsr->Right(1,CRSR_SKIP_CHARS,sal_False,sal_False);
+                        if( *pUnoCrsr->GetMark() == *pUnoCrsr->GetPoint() )
+                            break;
+
+                        const SwTxtAnnotationFld* pTxtAnnotationFld = dynamic_cast<const SwTxtAnnotationFld*>( pAttr );
+                        ::sw::mark::IMark* pAnnotationMark = pTxtAnnotationFld->GetAnnotationMark();
+                        if ( pAnnotationMark != NULL )
+                        {
+                            SwXTextPortion* pPortion = new SwXTextPortion( pUnoCrsr, xParent, PORTION_ANNOTATION_END );
+                            pPortion->SetBookmark( SwXBookmark::CreateXBookmark( *pDoc, *pAnnotationMark ) );
+                            xRef = pPortion;
+                        }
+                        else
+                        {
+                            SwXTextPortion* pPortion = new SwXTextPortion( pUnoCrsr, xParent, PORTION_ANNOTATION );
+                            Reference<XTextField> xField =
+                                SwXTextField::CreateSwXTextField(*pDoc, pAttr->GetFmtFld());
+                            pPortion->SetTextField(xField);
+                            xRef = pPortion;
+                        }
+                    }
+                    break;
+
                 case RES_TXTATR_INPUTFIELD:
                     if(!bRightMoveForbidden)
                     {
@@ -959,8 +1037,10 @@ lcl_ExportHints(
 //-----------------------------------------------------------------------------
 void lcl_MoveCursor( SwUnoCrsr * const pUnoCrsr,
     const xub_StrLen nCurrentIndex,
-    const sal_Int32 nNextFrameIndex, const sal_Int32 nNextPortionIndex,
-    const sal_Int32 nNextAttrIndex,  const sal_Int32 nNextFieldMarkIndex,
+    const sal_Int32 nNextFrameIndex,
+    const sal_Int32 nNextPortionIndex,
+    const sal_Int32 nNextAttrIndex,
+    const sal_Int32 nNextMarkIndex,
     const sal_Int32 nEndPos )
 {
     sal_Int32 nMovePos = pUnoCrsr->GetCntntNode()->Len();
@@ -985,22 +1065,22 @@ void lcl_MoveCursor( SwUnoCrsr * const p
         nMovePos = nNextAttrIndex;
     }
 
-    if ((nNextFieldMarkIndex >= 0) && (nNextFieldMarkIndex < nMovePos))
+    if ((nNextMarkIndex >= 0) && (nNextMarkIndex < nMovePos))
     {
-        nMovePos = nNextFieldMarkIndex;
+        nMovePos = nNextMarkIndex;
     }
 
     if (nMovePos > nCurrentIndex)
     {
-//			pUnoCrsr->Right(nMovePos - nCurrentIndex);
         pUnoCrsr->GetPoint()->nContent = static_cast<sal_uInt16>(nMovePos);
     }
 }
 
 //-----------------------------------------------------------------------------
-static void
-lcl_FillRedlineArray(SwDoc const & rDoc, SwUnoCrsr const & rUnoCrsr,
-        SwXRedlinePortion_ImplList& rRedArr )
+static void lcl_FillRedlineArray(
+    SwDoc const & rDoc,
+    SwUnoCrsr const & rUnoCrsr,
+    SwXRedlinePortion_ImplList& rRedArr )
 {
 	const SwRedlineTbl& rRedTbl = rDoc.GetRedlineTbl();
     sal_uInt16 nRedTblCount = rRedTbl.Count();
@@ -1026,9 +1106,9 @@ lcl_FillRedlineArray(SwDoc const & rDoc,
 }
 
 //-----------------------------------------------------------------------------
-static void
-lcl_FillSoftPageBreakArray(
-        SwUnoCrsr const & rUnoCrsr, SwSoftPageBreakList& rBreakArr )
+static void lcl_FillSoftPageBreakArray(
+    SwUnoCrsr const & rUnoCrsr,
+    SwSoftPageBreakList& rBreakArr )
 {
     const SwTxtNode *pTxtNode =
         rUnoCrsr.GetPoint()->nNode.GetNode().GetTxtNode();
@@ -1039,12 +1119,12 @@ lcl_FillSoftPageBreakArray(
 /* -----------------------------19.12.00 12:25--------------------------------
 
  ---------------------------------------------------------------------------*/
-static void
-lcl_ExportRedline(
+static void lcl_ExportRedline(
     TextRangeList_t & rPortions,
     Reference<XText> const& xParent,
     const SwUnoCrsr * const pUnoCrsr,
-    SwXRedlinePortion_ImplList& rRedlineArr, const sal_uLong nIndex)
+    SwXRedlinePortion_ImplList& rRedlineArr,
+    const xub_StrLen nIndex)
 {
 
 	// MTG: 23/11/05: We want this loop to iterate over all red lines in this
@@ -1073,15 +1153,14 @@ lcl_ExportRedline(
 /* -----------------------------19.12.00 13:09--------------------------------
 
  ---------------------------------------------------------------------------*/
-static void
-lcl_ExportBkmAndRedline(
+static void lcl_ExportBkmAndRedline(
     TextRangeList_t & rPortions,
     Reference<XText> const & xParent,
     const SwUnoCrsr * const pUnoCrsr,
     SwXBookmarkPortion_ImplList& rBkmArr,
     SwXRedlinePortion_ImplList& rRedlineArr,
     SwSoftPageBreakList& rBreakArr,
-    const sal_uLong nIndex)
+    const xub_StrLen nIndex )
 {
     if (rBkmArr.size())
         lcl_ExportBookmark(rPortions, xParent, pUnoCrsr, rBkmArr, nIndex);
@@ -1093,9 +1172,41 @@ lcl_ExportBkmAndRedline(
         lcl_ExportSoftPageBreak(rPortions, xParent, pUnoCrsr, rBreakArr, nIndex);
 }
 
+static void lcl_ExportAnnotationStarts(
+    TextRangeList_t & rPortions,
+    Reference<XText> const & xParent,
+    const SwUnoCrsr * const pUnoCrsr,
+    SwAnnotationStartPortion_ImplList& rAnnotationStartArr,
+    const xub_StrLen nIndex)
+{
+    if ( rAnnotationStartArr.size() > 0 )
+    {
+        for ( SwAnnotationStartPortion_ImplList::iterator aIter = rAnnotationStartArr.begin(), aEnd = rAnnotationStartArr.end();
+              aIter != aEnd; )
+        {
+            SwAnnotationStartPortion_ImplSharedPtr pPtr = (*aIter);
+            if ( nIndex > pPtr->getIndex() )
+            {
+                rAnnotationStartArr.erase( aIter++ );
+                continue;
+            }
+            if ( pPtr->getIndex() > nIndex )
+            {
+                break;
+            }
+
+            SwXTextPortion* pPortion =
+                new SwXTextPortion( pUnoCrsr, xParent, PORTION_ANNOTATION );
+            pPortion->SetTextField( pPtr->mxAnnotationField );
+            rPortions.push_back(pPortion);
+
+            rAnnotationStartArr.erase( aIter++ );
+        }
+    }
+}
+
 //-----------------------------------------------------------------------------
-static sal_Int32
-lcl_ExportFrames(
+static sal_Int32 lcl_ExportFrames(
     TextRangeList_t & rPortions,
     Reference<XText> const & i_xParent,
     SwUnoCrsr * const i_pUnoCrsr,
@@ -1121,8 +1232,7 @@ lcl_ExportFrames(
 }
 
 //-----------------------------------------------------------------------------
-static sal_Int32
-lcl_GetNextIndex(
+static sal_Int32 lcl_GetNextIndex(
     SwXBookmarkPortion_ImplList const & rBkmArr,
     SwXRedlinePortion_ImplList const & rRedlineArr,
     SwSoftPageBreakList const & rBreakArr )
@@ -1149,14 +1259,13 @@ lcl_GetNextIndex(
 };
 
 //-----------------------------------------------------------------------------
-static void
-lcl_CreatePortions(
-        TextRangeList_t & i_rPortions,
-        uno::Reference< text::XText > const & i_xParentText,
-        SwUnoCrsr * const pUnoCrsr,
-        FrameDependSortList_t & i_rFrames,
-        const sal_Int32 i_nStartPos,
-        const sal_Int32 i_nEndPos )
+static void lcl_CreatePortions(
+    TextRangeList_t & i_rPortions,
+    uno::Reference< text::XText > const & i_xParentText,
+    SwUnoCrsr * const pUnoCrsr,
+    FrameDependSortList_t & i_rFrames,
+    const sal_Int32 i_nStartPos,
+    const sal_Int32 i_nEndPos )
 {
     if (!pUnoCrsr)
         return;
@@ -1174,17 +1283,23 @@ lcl_CreatePortions(
                 CRSR_SKIP_CHARS, sal_False, sal_False);
     }
 
-    FieldMarks_t FieldMarks;
-    SwXBookmarkPortion_ImplList Bookmarks;
-    SwXRedlinePortion_ImplList Redlines;
-    SwSoftPageBreakList SoftPageBreaks;
-
     SwDoc * const pDoc = pUnoCrsr->GetDoc();
+
+    FieldMarks_t FieldMarks;
     lcl_FillFieldMarkArray(FieldMarks, *pUnoCrsr, i_nStartPos);
+
+    SwXBookmarkPortion_ImplList Bookmarks;
     lcl_FillBookmarkArray(*pDoc, *pUnoCrsr, Bookmarks);
+
+    SwXRedlinePortion_ImplList Redlines;
     lcl_FillRedlineArray(*pDoc, *pUnoCrsr, Redlines);
+
+    SwSoftPageBreakList SoftPageBreaks;
     lcl_FillSoftPageBreakArray(*pUnoCrsr, SoftPageBreaks);
 
+    SwAnnotationStartPortion_ImplList AnnotationStarts;
+    lcl_FillAnnotationStartArray( *pDoc, *pUnoCrsr, AnnotationStarts );
+
     PortionStack_t PortionStack;
     PortionStack.push( PortionList_t(&i_rPortions, 0) );
 
@@ -1220,6 +1335,13 @@ lcl_CreatePortions(
         lcl_ExportBkmAndRedline( *PortionStack.top().first, i_xParentText,
             pUnoCrsr, Bookmarks, Redlines, SoftPageBreaks, nCurrentIndex );
 
+        lcl_ExportAnnotationStarts(
+            *PortionStack.top().first,
+            i_xParentText,
+            pUnoCrsr,
+            AnnotationStarts,
+            nCurrentIndex );
+
         bool bCursorMoved( false );
         sal_Int32 nNextAttrIndex = -1;
         // #111716# the cursor must not move right at the
@@ -1260,13 +1382,23 @@ lcl_CreatePortions(
         {
             const sal_Int32 nNextPortionIndex =
                 lcl_GetNextIndex(Bookmarks, Redlines, SoftPageBreaks);
-            const sal_Int32 nNextFieldMarkIndex(
-                    FieldMarks.size() ? FieldMarks.front() : -1);
 
-            lcl_MoveCursor(pUnoCrsr, nCurrentIndex,
-                nFirstFrameIndex, nNextPortionIndex, nNextAttrIndex,
-                nNextFieldMarkIndex,
-                i_nEndPos);
+            sal_Int32 nNextMarkIndex = ( FieldMarks.size() ? FieldMarks.front() : -1 );
+            if ( AnnotationStarts.size() > 0
+                 && ( nNextMarkIndex == -1
+                      || (*AnnotationStarts.begin())->getIndex() < nNextMarkIndex ) )
+            {
+                nNextMarkIndex = (*AnnotationStarts.begin())->getIndex();
+            }
+
+            lcl_MoveCursor(
+                pUnoCrsr,
+                nCurrentIndex,
+                nFirstFrameIndex,
+                nNextPortionIndex,
+                nNextAttrIndex,
+                nNextMarkIndex,
+                i_nEndPos );
 
             xRef = new SwXTextPortion(pUnoCrsr, i_xParentText, PORTION_TEXT);
         }

Modified: openoffice/trunk/main/sw/source/core/view/vprint.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/view/vprint.cxx?rev=1552394&r1=1552393&r2=1552394&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/view/vprint.cxx (original)
+++ openoffice/trunk/main/sw/source/core/view/vprint.cxx Thu Dec 19 18:50:58 2013
@@ -667,10 +667,7 @@ sal_Bool ViewShell::IsAnyFieldInDoc() co
         {
             const SwFmtFld* pFmtFld = (SwFmtFld*)pItem;
             const SwTxtFld* pTxtFld = pFmtFld->GetTxtFld();
-            // do not include postits in field check
-            const SwField* pFld = pFmtFld->GetField();
-            if( pTxtFld && pTxtFld->GetTxtNode().GetNodes().IsDocNodes()
-                && (pFld->Which() != RES_POSTITFLD))
+            if( pTxtFld && pTxtFld->GetTxtNode().GetNodes().IsDocNodes() )
             {
                 return sal_True;
             }

Modified: openoffice/trunk/main/sw/source/filter/ascii/ascatr.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/filter/ascii/ascatr.cxx?rev=1552394&r1=1552393&r2=1552394&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/filter/ascii/ascatr.cxx (original)
+++ openoffice/trunk/main/sw/source/filter/ascii/ascatr.cxx Thu Dec 19 18:50:58 2013
@@ -144,6 +144,7 @@ sal_Bool SwASC_AttrIter::OutAttr( xub_St
                 switch( pHt->Which() )
                 {
                 case RES_TXTATR_FIELD:
+                case RES_TXTATR_ANNOTATION:
                 case RES_TXTATR_INPUTFIELD:
                     sOut = static_cast<SwTxtFld const*>(pHt)->GetFmtFld().GetField()->ExpandField(true);
                     break;

Modified: openoffice/trunk/main/sw/source/filter/html/css1atr.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/filter/html/css1atr.cxx?rev=1552394&r1=1552393&r2=1552394&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/filter/html/css1atr.cxx (original)
+++ openoffice/trunk/main/sw/source/filter/html/css1atr.cxx Thu Dec 19 18:50:58 2013
@@ -3761,7 +3761,7 @@ SwAttrFnTab aCSS1AttrFnTab = {
 /* RES_TXTATR_FIELD	*/          	0,
 /* RES_TXTATR_FLYCNT */ 			0,
 /* RES_TXTATR_FTN */				0,
-/* RES_TXTATR_DUMMY4 */             0,
+/* RES_TXTATR_ANNOTATION */         0,
 /* RES_TXTATR_DUMMY3 */             0,
 /* RES_TXTATR_DUMMY1 */        	    0, // Dummy:
 /* RES_TXTATR_DUMMY2 */        	    0, // Dummy:

Modified: openoffice/trunk/main/sw/source/filter/html/htmlatr.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/filter/html/htmlatr.cxx?rev=1552394&r1=1552393&r2=1552394&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/filter/html/htmlatr.cxx (original)
+++ openoffice/trunk/main/sw/source/filter/html/htmlatr.cxx Thu Dec 19 18:50:58 2013
@@ -2481,9 +2481,10 @@ Writer& OutHTML_SwTxtNode( Writer& rWrt,
 		do {
 			aEndPosLst.OutEndAttrs( rHTMLWrt, nStrPos + nOffset );
 
-			nAttrPos++;
-			if( RES_TXTATR_FIELD == pHt->Which() )		// Felder nicht
-				continue;                               // ausgeben
+            nAttrPos++;
+            if( pHt->Which() == RES_TXTATR_FIELD
+                || pHt->Which() == RES_TXTATR_ANNOTATION )
+                continue;
 
             if ( pHt->End() && !pHt->HasDummyChar() )
 			{
@@ -2576,24 +2577,25 @@ Writer& OutHTML_SwTxtNode( Writer& rWrt,
 					}
 					else
 					{
-						// Hints ohne-Ende werden als letztes ausgebeben
-						ASSERT( !pTxtHt,
-								"Wieso gibt es da schon ein Attribut ohne Ende?" );
-						if( rHTMLWrt.nTxtAttrsToIgnore>0 )
-						{
-							rHTMLWrt.nTxtAttrsToIgnore--;
-						}
-						else
-						{
-							pTxtHt = pHt;
-							sal_uInt16 nFldWhich;
-							if( RES_TXTATR_FIELD != pHt->Which() ||
-								( RES_POSTITFLD != (nFldWhich = ((const SwFmtFld&)pHt->GetAttr()).GetField()->Which()) &&
-								RES_SCRIPTFLD != nFldWhich ) )
-								bWriteBreak = sal_False;
-						}
-						bOutChar = sal_False;		// keine 255 ausgeben
-					}
+                        // Hints ohne-Ende werden als letztes ausgebeben
+                        ASSERT( !pTxtHt, "Wieso gibt es da schon ein Attribut ohne Ende?" );
+                        if( rHTMLWrt.nTxtAttrsToIgnore>0 )
+                        {
+                            rHTMLWrt.nTxtAttrsToIgnore--;
+                        }
+                        else
+                        {
+                            pTxtHt = pHt;
+                            sal_uInt16 nFldWhich;
+                            if( RES_TXTATR_FIELD != pHt->Which()
+                                || ( RES_POSTITFLD != (nFldWhich = ((const SwFmtFld&)pHt->GetAttr()).GetField()->Which())
+                                     && RES_SCRIPTFLD != nFldWhich ) )
+                            {
+                                bWriteBreak = sal_False;
+                            }
+                        }
+                        bOutChar = sal_False;		// keine 255 ausgeben
+                    }
 				} while( ++nAttrPos < nCntAttr && nStrPos ==
 					*( pHt = pNd->GetSwpHints()[ nAttrPos ] )->GetStart() );
 			}
@@ -3418,7 +3420,7 @@ SwAttrFnTab aHTMLAttrFnTab = {
 /* RES_TXTATR_FIELD */              OutHTML_SwFmtFld,
 /* RES_TXTATR_FLYCNT */             OutHTML_SwFlyCnt,
 /* RES_TXTATR_FTN */                OutHTML_SwFmtFtn,
-/* RES_TXTATR_DUMMY4 */             0,
+/* RES_TXTATR_ANNOTATION */         OutHTML_SwFmtFld,
 /* RES_TXTATR_DUMMY3 */             0,
 /* RES_TXTATR_DUMMY1 */             0, // Dummy:
 /* RES_TXTATR_DUMMY2 */             0, // Dummy:

Modified: openoffice/trunk/main/sw/source/filter/html/htmlgrin.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/filter/html/htmlgrin.cxx?rev=1552394&r1=1552393&r2=1552394&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/filter/html/htmlgrin.cxx (original)
+++ openoffice/trunk/main/sw/source/filter/html/htmlgrin.cxx Thu Dec 19 18:50:58 2013
@@ -1297,15 +1297,15 @@ sal_Bool SwHTMLParser::HasCurrentParaBoo
 
     if( !bHasMarks )
     {
-        // second step: when we didnt find a bookmark, check if there is one
-        // set already
+        // second step: when we didnt find a bookmark, check if there is one set already
         IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
-        for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin();
-            ppMark != pMarkAccess->getMarksEnd();
+        for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getAllMarksBegin();
+            ppMark != pMarkAccess->getAllMarksEnd();
             ppMark++)
         {
             const ::sw::mark::IMark* pBookmark = ppMark->get();
-            sal_uLong nBookNdIdx = pBookmark->GetMarkPos().nNode.GetIndex();
+
+            const sal_uLong nBookNdIdx = pBookmark->GetMarkPos().nNode.GetIndex();
             if( nBookNdIdx==nNodeIdx )
             {
                 bHasMarks = sal_True;
@@ -1365,14 +1365,14 @@ void SwHTMLParser::StripTrailingPara()
                 }
             }
 
-            // jetz muessen wir noch eventuell vorhandene Bookmarks
-            // verschieben
+            // jetz muessen wir noch eventuell vorhandene Bookmarks verschieben
             IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
-            for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin();
-                ppMark != pMarkAccess->getMarksEnd();
+            for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getAllMarksBegin();
+                ppMark != pMarkAccess->getAllMarksEnd();
                 ppMark++)
             {
                 ::sw::mark::IMark* pMark = ppMark->get();
+
                 sal_uLong nBookNdIdx = pMark->GetMarkPos().nNode.GetIndex();
                 if(nBookNdIdx==nNodeIdx)
                 {
@@ -1383,15 +1383,12 @@ void SwHTMLParser::StripTrailingPara()
                         ASSERT(!this, "Hoppla, wo ist mein Vorgaenger-Node");
                         return;
                     }
-                    // --> OD 2007-09-27 #i81002# - refactoring
-                    // Do not directly manipulate member of <SwBookmark>
                     {
                         SwPosition aNewPos(*pNd);
                         aNewPos.nContent.Assign(pNd, pNd->Len());
                         const SwPaM aPaM(aNewPos);
                         pMarkAccess->repositionMark(ppMark->get(), aPaM);
                     }
-                    // <--
                 }
                 else if( nBookNdIdx > nNodeIdx )
                     break;

Modified: openoffice/trunk/main/sw/source/filter/html/swhtml.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/filter/html/swhtml.cxx?rev=1552394&r1=1552393&r2=1552394&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/filter/html/swhtml.cxx (original)
+++ openoffice/trunk/main/sw/source/filter/html/swhtml.cxx Thu Dec 19 18:50:58 2013
@@ -2754,7 +2754,7 @@ void SwHTMLParser::_SetAttr( sal_Bool bC
                         const String sName( ((SfxStringItem*)pAttr->pItem)->GetValue() );
                         IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
                         IDocumentMarkAccess::const_iterator_t ppBkmk = pMarkAccess->findMark( sName );
-                        if( ppBkmk != pMarkAccess->getMarksEnd() &&
+                        if( ppBkmk != pMarkAccess->getAllMarksEnd() &&
                             ppBkmk->get()->GetMarkStart() == *pAttrPam->GetPoint() )
                             break; // do not generate duplicates on this position
                         pAttrPam->DeleteMark();
@@ -2772,6 +2772,7 @@ void SwHTMLParser::_SetAttr( sal_Bool bC
                     }
                     break;
                 case RES_TXTATR_FIELD:
+                case RES_TXTATR_ANNOTATION:
                 case RES_TXTATR_INPUTFIELD:
                     {
                         sal_uInt16 nFldWhich =

Modified: openoffice/trunk/main/sw/source/filter/html/wrthtml.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/filter/html/wrthtml.cxx?rev=1552394&r1=1552393&r2=1552394&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/filter/html/wrthtml.cxx (original)
+++ openoffice/trunk/main/sw/source/filter/html/wrthtml.cxx Thu Dec 19 18:50:58 2013
@@ -873,44 +873,46 @@ static void OutBodyColor( const sal_Char
 
 sal_uInt16 SwHTMLWriter::OutHeaderAttrs()
 {
-	sal_uLong nIdx = pCurPam->GetPoint()->nNode.GetIndex();
-	sal_uLong nEndIdx = pCurPam->GetMark()->nNode.GetIndex();
+    sal_uLong nIdx = pCurPam->GetPoint()->nNode.GetIndex();
+    sal_uLong nEndIdx = pCurPam->GetMark()->nNode.GetIndex();
 
-	SwTxtNode *pTxtNd = 0;
-	while( nIdx<=nEndIdx &&
-			0==(pTxtNd=pDoc->GetNodes()[nIdx]->GetTxtNode()) )
-		nIdx++;
-
-	ASSERT( pTxtNd, "Kein Text-Node gefunden" );
-	if( !pTxtNd || !pTxtNd->HasHints() )
-		return 0;
-
-	sal_uInt16 nAttrs = 0;
-	sal_uInt16 nCntAttr = pTxtNd->GetSwpHints().Count();
-	xub_StrLen nOldPos = 0;
-	for( sal_uInt16 i=0; i<nCntAttr; i++ )
-	{
-		const SwTxtAttr *pHt = pTxtNd->GetSwpHints()[i];
-		if( !pHt->End() )
-		{
-			xub_StrLen nPos = *pHt->GetStart();
-			if( nPos-nOldPos > 1 || RES_TXTATR_FIELD != pHt->Which() )
-				break;
+    SwTxtNode *pTxtNd = 0;
+    while( nIdx<=nEndIdx &&
+        0==(pTxtNd=pDoc->GetNodes()[nIdx]->GetTxtNode()) )
+        nIdx++;
+
+    ASSERT( pTxtNd, "Kein Text-Node gefunden" );
+    if( !pTxtNd || !pTxtNd->HasHints() )
+        return 0;
+
+    sal_uInt16 nAttrs = 0;
+    sal_uInt16 nCntAttr = pTxtNd->GetSwpHints().Count();
+    xub_StrLen nOldPos = 0;
+    for( sal_uInt16 i=0; i<nCntAttr; i++ )
+    {
+        const SwTxtAttr *pHt = pTxtNd->GetSwpHints()[i];
+        if( !pHt->End() )
+        {
+            xub_StrLen nPos = *pHt->GetStart();
+            if( nPos-nOldPos > 1
+                || ( pHt->Which() != RES_TXTATR_FIELD
+                     && pHt->Which() != RES_TXTATR_ANNOTATION ) )
+                break;
 
-			const sal_uInt16 nFldWhich =
+            const sal_uInt16 nFldWhich =
                 ((const SwFmtFld&)pHt->GetAttr()).GetField()->GetTyp()->Which();
-			if( RES_POSTITFLD!=nFldWhich &&
-				RES_SCRIPTFLD!=nFldWhich )
-				break;
-
-			OutNewLine();
-			OutHTML_SwFmtFld( *this, pHt->GetAttr() );
-			nOldPos = nPos;
-			nAttrs++;
-		}
-	}
+            if( RES_POSTITFLD!=nFldWhich &&
+                RES_SCRIPTFLD!=nFldWhich )
+                break;
+
+            OutNewLine();
+            OutHTML_SwFmtFld( *this, pHt->GetAttr() );
+            nOldPos = nPos;
+            nAttrs++;
+        }
+    }
 
-	return nAttrs;
+    return nAttrs;
 }
 
 const SwPageDesc *SwHTMLWriter::MakeHeader( sal_uInt16 &rHeaderAttrs )
@@ -1061,24 +1063,27 @@ void SwHTMLWriter::OutBookmarks()
     const ::sw::mark::IMark* pBookmark = NULL;
     IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
     if(nBkmkTabPos != -1)
-        pBookmark = (pMarkAccess->getMarksBegin() + nBkmkTabPos)->get();
+        pBookmark = (pMarkAccess->getAllMarksBegin() + nBkmkTabPos)->get();
     // Ausgabe aller Bookmarks in diesem Absatz. Die Content-Position
     // wird vorerst nicht beruecksichtigt!
     sal_uInt32 nNode = pCurPam->GetPoint()->nNode.GetIndex();
-    while( nBkmkTabPos != -1 &&
-        pBookmark->GetMarkPos().nNode.GetIndex() == nNode )
+    while( nBkmkTabPos != -1
+           && pBookmark->GetMarkPos().nNode.GetIndex() == nNode )
     {
         // Der Bereich derBookmark wird erstam ignoriert, da er von uns
         // auch nicht eingelesen wird.
 
         // erst die SWG spezifischen Daten:
-        if(dynamic_cast< const ::sw::mark::IBookmark* >(pBookmark) && pBookmark->GetName().getLength() )
+        if ( dynamic_cast< const ::sw::mark::IBookmark* >(pBookmark) != NULL
+             && pBookmark->GetName().getLength() )
+        {
             OutAnchor( pBookmark->GetName() );
+        }
 
-        if( ++nBkmkTabPos >= pMarkAccess->getMarksCount() )
+        if( ++nBkmkTabPos >= pMarkAccess->getAllMarksCount() )
             nBkmkTabPos = -1;
         else
-            pBookmark = (pMarkAccess->getMarksBegin() + nBkmkTabPos)->get();
+            pBookmark = (pMarkAccess->getAllMarksBegin() + nBkmkTabPos)->get();
     }
 
     sal_uInt16 nPos;

Modified: openoffice/trunk/main/sw/source/filter/writer/writer.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/filter/writer/writer.cxx?rev=1552394&r1=1552393&r2=1552394&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/filter/writer/writer.cxx (original)
+++ openoffice/trunk/main/sw/source/filter/writer/writer.cxx Thu Dec 19 18:50:58 2013
@@ -209,12 +209,12 @@ sal_Int32 Writer::FindPos_Bkmk(const SwP
 {
     const IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
     const IDocumentMarkAccess::const_iterator_t ppBkmk = ::std::lower_bound(
-        pMarkAccess->getMarksBegin(),
-        pMarkAccess->getMarksEnd(),
+        pMarkAccess->getAllMarksBegin(),
+        pMarkAccess->getAllMarksEnd(),
         rPos,
         ::boost::bind(&::sw::mark::IMark::StartsBefore, _1, _2)); // find the first Mark that does not start before
-    if(ppBkmk != pMarkAccess->getMarksEnd())
-        return ppBkmk - pMarkAccess->getMarksBegin();
+    if(ppBkmk != pMarkAccess->getAllMarksEnd())
+        return ppBkmk - pMarkAccess->getAllMarksBegin();
     return -1;
 }
 

Modified: openoffice/trunk/main/sw/source/filter/ww1/fltshell.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/filter/ww1/fltshell.cxx?rev=1552394&r1=1552393&r2=1552394&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/filter/ww1/fltshell.cxx (original)
+++ openoffice/trunk/main/sw/source/filter/ww1/fltshell.cxx Thu Dec 19 18:50:58 2013
@@ -148,11 +148,13 @@ bool SwFltStackEntry::IsAbleMakeRegion()
          && ( (0 != nPtCntnt)
               || ( pCntntNode
                    && ( 0 != pCntntNode->Len() ) ) )
-        && ( RES_TXTATR_FIELD != pAttr->Which() && RES_TXTATR_INPUTFIELD != pAttr->Which() )
-        && !( bIsParaEnd
-              && pCntntNode
-              && pCntntNode->IsTxtNode()
-              && 0 != pCntntNode->Len() ) )
+         && ( RES_TXTATR_FIELD != pAttr->Which()
+              && RES_TXTATR_ANNOTATION != pAttr->Which()
+              && RES_TXTATR_INPUTFIELD != pAttr->Which() )
+         && !( bIsParaEnd
+               && pCntntNode
+               && pCntntNode->IsTxtNode()
+               && 0 != pCntntNode->Len() ) )
     {
         return false;
     }
@@ -509,9 +511,12 @@ void SwFltControlStack::SetAttrInDoc(con
         break;
     case RES_FLTR_STYLESHEET:
         break;
+
     case RES_TXTATR_FIELD:
+    case RES_TXTATR_ANNOTATION:
     case RES_TXTATR_INPUTFIELD:
         break;
+
     case RES_TXTATR_TOXMARK:
         break;
 

Modified: openoffice/trunk/main/sw/source/filter/ww8/attributeoutputbase.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/filter/ww8/attributeoutputbase.hxx?rev=1552394&r1=1552393&r2=1552394&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/filter/ww8/attributeoutputbase.hxx (original)
+++ openoffice/trunk/main/sw/source/filter/ww8/attributeoutputbase.hxx Thu Dec 19 18:50:58 2013
@@ -443,7 +443,7 @@ protected:
     /// Sfx item RES_TXTATR_CHARFMT
     virtual void TextCharFormat( const SwFmtCharFmt& ) = 0;
 
-    /// Sfx item RES_TXTATR_FIELD and RES_TXTATR_INPUTFIELD
+    /// Sfx item RES_TXTATR_FIELD, RES_TXTATR_ANNOTATION and RES_TXTATR_INPUTFIELD
     void TextField( const SwFmtFld& );
 
     /// Sfx item RES_TXTATR_FLYCNT

Modified: openoffice/trunk/main/sw/source/filter/ww8/wrtw8nds.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/filter/ww8/wrtw8nds.cxx?rev=1552394&r1=1552393&r2=1552394&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/filter/ww8/wrtw8nds.cxx (original)
+++ openoffice/trunk/main/sw/source/filter/ww8/wrtw8nds.cxx Thu Dec 19 18:50:58 2013
@@ -1678,10 +1678,10 @@ bool MSWordExportBase::GetBookmarks(
     IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
     sal_uLong nNd = rNd.GetIndex( );
 
-    const sal_Int32 nMarks = pMarkAccess->getMarksCount();
+    const sal_Int32 nMarks = pMarkAccess->getCommonMarksCount();
     for ( sal_Int32 i = 0; i < nMarks; i++ )
     {
-        IMark* pMark = ( pMarkAccess->getMarksBegin() + i )->get();
+        IMark* pMark = ( pMarkAccess->getCommonMarksBegin() + i )->get();
 
         // Only keep the bookmarks starting or ending in this node
         if ( pMark->GetMarkStart().nNode == nNd ||
@@ -1694,12 +1694,7 @@ bool MSWordExportBase::GetBookmarks(
             const bool bIsEndOk = ( pMark->GetMarkEnd().nNode == nNd ) && ( nBEnd >= nStt ) && ( nBEnd <= nEnd );
             if ( bIsStartOk || bIsEndOk )
             {
-                IFieldmark* pFieldmark = dynamic_cast<IFieldmark*>(pMark);
-                // COMMENTRANGE fieldmarks are no bookmarks
-                if ( !( pFieldmark != NULL && pFieldmark->GetFieldname().equalsAscii( ODF_COMMENTRANGE ) ) )
-                {
-                    rArr.push_back( pMark );
-                }
+                rArr.push_back( pMark );
             }
         }
     }

Modified: openoffice/trunk/main/sw/source/filter/ww8/ww8atr.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/filter/ww8/ww8atr.cxx?rev=1552394&r1=1552393&r2=1552394&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/filter/ww8/ww8atr.cxx (original)
+++ openoffice/trunk/main/sw/source/filter/ww8/ww8atr.cxx Thu Dec 19 18:50:58 2013
@@ -5165,10 +5165,13 @@ void AttributeOutputBase::OutputItem( co
         case RES_TXTATR_CHARFMT:
             TextCharFormat( static_cast< const SwFmtCharFmt& >( rHt ) );
             break;
+
         case RES_TXTATR_FIELD:
+        case RES_TXTATR_ANNOTATION:
         case RES_TXTATR_INPUTFIELD:
             TextField( static_cast< const SwFmtFld& >( rHt ) );
             break;
+
         case RES_TXTATR_FLYCNT:
             TextFlyContent( static_cast< const SwFmtFlyCnt& >( rHt ) );
             break;

Modified: openoffice/trunk/main/sw/source/filter/ww8/ww8par.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/filter/ww8/ww8par.cxx?rev=1552394&r1=1552393&r2=1552394&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/filter/ww8/ww8par.cxx (original)
+++ openoffice/trunk/main/sw/source/filter/ww8/ww8par.cxx Thu Dec 19 18:50:58 2013
@@ -1075,6 +1075,8 @@ void SwWW8FltControlStack::NewAttr(const
 {
     ASSERT(RES_TXTATR_FIELD != rAttr.Which(), "probably don't want to put"
         "fields into the control stack");
+    ASSERT(RES_TXTATR_ANNOTATION != rAttr.Which(), "probably don't want to put"
+        "annotations into the control stack");
     ASSERT(RES_TXTATR_INPUTFIELD != rAttr.Which(), "probably don't want to put"
         "input fields into the control stack");
     ASSERT(RES_FLTR_REDLINE != rAttr.Which(), "probably don't want to put"
@@ -1314,11 +1316,17 @@ void SwWW8FltControlStack::SetAttrInDoc(
                 }
             }
             break;
+
         case RES_TXTATR_FIELD:
             ASSERT(!this, "What is a field doing in the control stack,"
                 "probably should have been in the endstack");
             break;
 
+        case RES_TXTATR_ANNOTATION:
+            ASSERT(!this, "What is a annotation doing in the control stack,"
+                "probably should have been in the endstack");
+            break;
+
         case RES_TXTATR_INPUTFIELD:
             ASSERT(!this, "What is a input field doing in the control stack,"
                 "probably should have been in the endstack");
@@ -1411,7 +1419,9 @@ const SfxPoolItem* SwWW8FltControlStack:
     return 0;
 }
 
-bool SwWW8FltRefStack::IsFtnEdnBkmField(const SwFmtFld& rFmtFld, sal_uInt16& rBkmNo)
+bool SwWW8FltRefStack::IsFtnEdnBkmField(
+    const SwFmtFld& rFmtFld,
+    sal_uInt16& rBkmNo)
 {
     const SwField* pFld = rFmtFld.GetField();
     sal_uInt16 nSubType;
@@ -1420,12 +1430,12 @@ bool SwWW8FltRefStack::IsFtnEdnBkmField(
         && ((SwGetRefField*)pFld)->GetSetRefName().Len())
     {
         const IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
-        IDocumentMarkAccess::const_iterator_t ppBkmk = pMarkAccess->findMark(
-            ((SwGetRefField*)pFld)->GetSetRefName());
-        if(ppBkmk != pMarkAccess->getMarksEnd())
+        IDocumentMarkAccess::const_iterator_t ppBkmk =
+            pMarkAccess->findMark( ((SwGetRefField*)pFld)->GetSetRefName() );
+        if(ppBkmk != pMarkAccess->getAllMarksEnd())
         {
             // find Sequence No of corresponding Foot-/Endnote
-            rBkmNo = ppBkmk - pMarkAccess->getMarksBegin();
+            rBkmNo = ppBkmk - pMarkAccess->getAllMarksBegin();
             return true;
         }
     }
@@ -1443,6 +1453,7 @@ void SwWW8FltRefStack::SetAttrInDoc(cons
         do normal (?) strange stuff
         */
         case RES_TXTATR_FIELD:
+        case RES_TXTATR_ANNOTATION:
         case RES_TXTATR_INPUTFIELD:
         {
             SwNodeIndex aIdx(pEntry->nMkNode, 1);
@@ -1456,7 +1467,7 @@ void SwWW8FltRefStack::SetAttrInDoc(cons
                 sal_uInt16 nBkmNo;
                 if( IsFtnEdnBkmField(rFmtFld, nBkmNo) )
                 {
-                    ::sw::mark::IMark const * const pMark = (pDoc->getIDocumentMarkAccess()->getMarksBegin() + nBkmNo)->get();
+                    ::sw::mark::IMark const * const pMark = (pDoc->getIDocumentMarkAccess()->getAllMarksBegin() + nBkmNo)->get();
 
                     const SwPosition& rBkMrkPos = pMark->GetMarkPos();
 

Modified: openoffice/trunk/main/sw/source/ui/dialog/uiregionsw.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/ui/dialog/uiregionsw.cxx?rev=1552394&r1=1552393&r2=1552394&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/ui/dialog/uiregionsw.cxx (original)
+++ openoffice/trunk/main/sw/source/ui/dialog/uiregionsw.cxx Thu Dec 19 18:50:58 2013
@@ -134,8 +134,8 @@ void lcl_FillSubRegionList( SwWrtShell& 
 {
     lcl_FillList( rSh, rSubRegions, pAvailNames, 0 );
     IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
-    for( IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin();
-        ppMark != pMarkAccess->getMarksEnd();
+    for( IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getBookmarksBegin();
+        ppMark != pMarkAccess->getBookmarksBegin();
         ppMark++)
     {
         const ::sw::mark::IMark* pBkmk = ppMark->get(); 

Modified: openoffice/trunk/main/sw/source/ui/dochdl/swdtflvr.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/ui/dochdl/swdtflvr.cxx?rev=1552394&r1=1552393&r2=1552394&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/ui/dochdl/swdtflvr.cxx (original)
+++ openoffice/trunk/main/sw/source/ui/dochdl/swdtflvr.cxx Thu Dec 19 18:50:58 2013
@@ -851,8 +851,8 @@ int SwTransferable::PrepareForCopy( sal_
             IDocumentMarkAccess* const pMarkAccess = pTmpDoc->getIDocumentMarkAccess();
             ::std::vector< ::sw::mark::IMark* > vDdeMarks;
             // find all DDE-Bookmarks
-            for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin();
-                ppMark != pMarkAccess->getMarksEnd();
+            for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getAllMarksBegin();
+                ppMark != pMarkAccess->getAllMarksEnd();
                 ppMark++)
             {
                 if(IDocumentMarkAccess::DDE_BOOKMARK == IDocumentMarkAccess::GetType(**ppMark))
@@ -3774,7 +3774,7 @@ sal_Bool SwTrnsfrDdeLink::WriteData( SvS
 
     IDocumentMarkAccess* const pMarkAccess = pDocShell->GetDoc()->getIDocumentMarkAccess();
     IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->findMark(sName);
-    if(ppMark != pMarkAccess->getMarksEnd()
+    if(ppMark != pMarkAccess->getAllMarksEnd()
         && IDocumentMarkAccess::GetType(**ppMark) != IDocumentMarkAccess::BOOKMARK)
     {
         // the mark is still a DdeBookmark
@@ -3835,7 +3835,7 @@ void SwTrnsfrDdeLink::Disconnect( sal_Bo
         IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
         // check, if DdeBookmark is already in its desctruction
         IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->findMark(sName);
-        if ( ppMark != pMarkAccess->getMarksEnd() )
+        if ( ppMark != pMarkAccess->getAllMarksEnd() )
         {
             ::sw::mark::DdeBookmark* const pDdeBookmark = dynamic_cast< ::sw::mark::DdeBookmark* >(ppMark->get());
             if ( pDdeBookmark && !pDdeBookmark->IsInDestruction() )

Modified: openoffice/trunk/main/sw/source/ui/docvw/AnnotationWin.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/ui/docvw/AnnotationWin.cxx?rev=1552394&r1=1552393&r2=1552394&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/ui/docvw/AnnotationWin.cxx (original)
+++ openoffice/trunk/main/sw/source/ui/docvw/AnnotationWin.cxx Thu Dec 19 18:50:58 2013
@@ -160,8 +160,10 @@ bool SwAnnotationWin::CalcFollow()
     SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
     SwPosition aPosition( pTxtFld->GetTxtNode() );
     aPosition.nContent = *pTxtFld->GetStart();
-    SwTxtAttr * const pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttrForCharAt(
-                    aPosition.nContent.GetIndex() - 1, RES_TXTATR_FIELD );
+    SwTxtAttr * const pTxtAttr =
+        pTxtFld->GetTxtNode().GetTxtAttrForCharAt(
+            aPosition.nContent.GetIndex() - 1,
+            RES_TXTATR_ANNOTATION );
     const SwField* pFld = pTxtAttr ? pTxtAttr->GetFmtFld().GetField() : 0;
     return pFld && (pFld->Which()== RES_POSTITFLD);
 }
@@ -176,7 +178,7 @@ sal_uInt32 SwAnnotationWin::CountFollowi
 
     SwTxtAttr * pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttrForCharAt(
                                         aPosition.nContent.GetIndex() + 1,
-                                        RES_TXTATR_FIELD );
+                                        RES_TXTATR_ANNOTATION );
     SwField* pFld = pTxtAttr
                     ? const_cast<SwField*>(pTxtAttr->GetFmtFld().GetField())
                     : 0;
@@ -185,7 +187,7 @@ sal_uInt32 SwAnnotationWin::CountFollowi
         aCount++;
         pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttrForCharAt(
                                         aPosition.nContent.GetIndex() + aCount,
-                                        RES_TXTATR_FIELD );
+                                        RES_TXTATR_ANNOTATION );
         pFld = pTxtAttr
                ? const_cast<SwField*>(pTxtAttr->GetFmtFld().GetField())
                : 0;

Modified: openoffice/trunk/main/sw/source/ui/docvw/PostItMgr.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/ui/docvw/PostItMgr.cxx?rev=1552394&r1=1552393&r2=1552394&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/ui/docvw/PostItMgr.cxx (original)
+++ openoffice/trunk/main/sw/source/ui/docvw/PostItMgr.cxx Thu Dec 19 18:50:58 2013
@@ -51,6 +51,7 @@
 #include <docufld.hxx>
 #include <edtwin.hxx>
 #include <txtfld.hxx>
+#include <txtannotationfld.hxx>
 #include <ndtxt.hxx>
 #include <redline.hxx>
 #include <docary.hxx>
@@ -93,34 +94,11 @@
 
 using namespace sw::sidebarwindows;
 
-/*
-bool comp_author( const SwPostItItem* a, const SwPostItItem* b)
-{
-	return a->pFmtFld->GetFld()->GetPar1() < b->pFmtFld->GetFld()->GetPar1();
-}
 
-bool comp_date( const SwPostItItem* a, const SwPostItItem* b)
-{
-	return static_cast<SwPostItField*>(a->pFmtFld->GetFld())->GetDate()  < static_cast<SwPostItField*>(b->pFmtFld->GetFld())->GetDate();
-}
-*/
-
-//
 bool comp_pos(const SwSidebarItem* a, const SwSidebarItem* b)
 {
-    // --> OD 2010-01-19 #i88070#
     // sort by anchor position
-//// if position is on the same line, sort by x (Left) position, otherwise by y(Bottom) position
-//// if two notes are at the same position, sort by logical node position
-//    return (a->maLayoutInfo.mPosition.Bottom() == b->maLayoutInfo.mPosition.Bottom())
-//            ? ( ( (a->maLayoutInfo.mPosition.Left() == b->maLayoutInfo.mPosition.Left()) &&
-//                  (a->GetBroadCaster()->ISA(SwFmtFld) && b->GetBroadCaster()->ISA(SwFmtFld)) )
-//                ? *(static_cast<SwFmtFld*>(a->GetBroadCaster())->GetTxtFld()->GetStart()) <
-//                    *(static_cast<SwFmtFld*>(b->GetBroadCaster())->GetTxtFld()->GetStart())
-//                : a->maLayoutInfo.mPosition.Left() < b->maLayoutInfo.mPosition.Left() )
-//            : a->maLayoutInfo.mPosition.Bottom() < b->maLayoutInfo.mPosition.Bottom();
     return a->GetAnchorPosition() < b->GetAnchorPosition();
-    // <--
 }
 
 SwPostItMgr::SwPostItMgr(SwView* pView)
@@ -226,7 +204,7 @@ void SwPostItMgr::InsertItem(SfxBroadcas
 	}
 	mbLayout = bFocus;
 	if (pItem->ISA(SwFmtFld))
-        mvPostItFlds.push_back(new SwAnnotationItem(static_cast<SwFmtFld*>(pItem), true, bFocus) );
+        mvPostItFlds.push_back(new SwAnnotationItem(static_cast<SwFmtFld&>(*pItem), true, bFocus) );
 	/*
 	else
 	if (pItem->ISA(SwRedline))
@@ -407,33 +385,36 @@ void SwPostItMgr::Notify( SfxBroadcaster
 				}
 				break;
 			}
-			case SWFMTFLD_LANGUAGE:
-			{
-                		SwFmtFld* pFmtFld = dynamic_cast<SwFmtFld*>(&rBC);
-                for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
-				{
-                    			if ( pFmtFld == (*i)->GetBroadCaster() )
-					{
-						if ((*i)->pPostIt)
-						{
-							sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( (*i)->GetFmtFld()->GetField()->GetLanguage() );
-							sal_uInt16 nLangWhichId = 0;
-							switch (nScriptType)
-							{
-								case SCRIPTTYPE_LATIN :    nLangWhichId = EE_CHAR_LANGUAGE ; break;
-								case SCRIPTTYPE_ASIAN :    nLangWhichId = EE_CHAR_LANGUAGE_CJK; break;
-								case SCRIPTTYPE_COMPLEX :  nLangWhichId = EE_CHAR_LANGUAGE_CTL; break;
-							}
-                            (*i)->pPostIt->SetLanguage( SvxLanguageItem((*i)->GetFmtFld()->GetField()->GetLanguage(),
-                                                        nLangWhichId) );
-						}
-						break;
-					}
-				}
-				break;
-			}
-		}
-	}
+
+            case SWFMTFLD_LANGUAGE:
+                {
+                    SwFmtFld* pFmtFld = dynamic_cast<SwFmtFld*>(&rBC);
+                    for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+                    {
+                        if ( pFmtFld == (*i)->GetBroadCaster() )
+                        {
+                            if ((*i)->pPostIt)
+                            {
+                                const sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( (*i)->GetFmtFld().GetField()->GetLanguage() );
+                                sal_uInt16 nLangWhichId = 0;
+                                switch (nScriptType)
+                                {
+                                case SCRIPTTYPE_LATIN :    nLangWhichId = EE_CHAR_LANGUAGE ; break;
+                                case SCRIPTTYPE_ASIAN :    nLangWhichId = EE_CHAR_LANGUAGE_CJK; break;
+                                case SCRIPTTYPE_COMPLEX :  nLangWhichId = EE_CHAR_LANGUAGE_CTL; break;
+                                }
+                                (*i)->pPostIt->SetLanguage(
+                                    SvxLanguageItem(
+                                    (*i)->GetFmtFld().GetField()->GetLanguage(),
+                                    nLangWhichId) );
+                            }
+                            break;
+                        }
+                    }
+                    break;
+                }
+        }
+    }
 }
 
 void SwPostItMgr::Focus(SfxBroadcaster& rBC)
@@ -465,105 +446,120 @@ void SwPostItMgr::Focus(SfxBroadcaster& 
 
 bool SwPostItMgr::CalcRects()
 {
-	if ( mnEventId )
-	{
-		// if CalcRects() was forced and an event is still pending: remove it
-		// it is superfluous and also may cause reentrance problems if triggered while layouting
-		Application::RemoveUserEvent( mnEventId );
-		mnEventId = 0;
-	}
+    if ( mnEventId )
+    {
+        // if CalcRects() was forced and an event is still pending: remove it
+        // it is superfluous and also may cause reentrance problems if triggered while layouting
+        Application::RemoveUserEvent( mnEventId );
+        mnEventId = 0;
+    }
 
-	bool bChange = false;
-	bool bRepair = false;
-	PreparePageContainer();
-	if ( !mvPostItFlds.empty() )
-	{
+    bool bChange = false;
+    bool bRepair = false;
+    PreparePageContainer();
+    if ( !mvPostItFlds.empty() )
+    {
         for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
-		{
+        {
             SwSidebarItem* pItem = (*i);
-			if ( !pItem->UseElement() )
-			{
-				DBG_ERROR("PostIt is not in doc or other wrong use");
-				bRepair = true;
-				continue;
-			}
-
-			//save old rect and visible state
-            SwRect aOldRect(pItem->maLayoutInfo.mPosition);
-			SwPostItHelper::SwLayoutStatus eOldStatus = pItem->mLayoutStatus;
-			std::vector< SwLayoutInfo > aInfo;
+            if ( !pItem->UseElement() )
             {
-                SwPosition aPosition = pItem->GetAnchorPosition();
-                pItem->mLayoutStatus = SwPostItHelper::getLayoutInfos( aInfo, aPosition );
+                DBG_ERROR("PostIt is not in doc or other wrong use");
+                bRepair = true;
+                continue;
             }
-            if( aInfo.size() )
-			{
-                pItem->maLayoutInfo = aInfo[0];
+
+            const SwRect aOldAnchorRect( pItem->maLayoutInfo.mPosition );
+            const SwPostItHelper::SwLayoutStatus eOldLayoutStatus = pItem->mLayoutStatus;
+            const sal_uLong nOldStartNodeIdx( pItem->maLayoutInfo.mnStartNodeIdx );
+            const xub_StrLen nOldStartContent( pItem->maLayoutInfo.mnStartContent );
+
+            {
+                // update layout information
+                const SwTxtAnnotationFld* pTxtAnnotationFld =
+                    dynamic_cast< const SwTxtAnnotationFld* >( pItem->GetFmtFld().GetTxtFld() );
+                const ::sw::mark::IMark* pAnnotationMark =
+                    pTxtAnnotationFld != NULL ? pTxtAnnotationFld->GetAnnotationMark() : NULL;
+                if ( pAnnotationMark != NULL )
+                {
+                    pItem->mLayoutStatus =
+                        SwPostItHelper::getLayoutInfos(
+                            pItem->maLayoutInfo,
+                            pItem->GetAnchorPosition(),
+                            &pAnnotationMark->GetMarkStart() );
+                }
+                else
+                {
+                    pItem->mLayoutStatus =
+                        SwPostItHelper::getLayoutInfos( pItem->maLayoutInfo, pItem->GetAnchorPosition() );
+                }
             }
-            bChange = bChange ||
-                      ( pItem->maLayoutInfo.mPosition != aOldRect ) ||
-                      ( eOldStatus != pItem->mLayoutStatus );
-		}
+            bChange = bChange
+                      || pItem->maLayoutInfo.mPosition != aOldAnchorRect
+                      || pItem->mLayoutStatus != eOldLayoutStatus
+                      || pItem->maLayoutInfo.mnStartNodeIdx != nOldStartNodeIdx
+                      || pItem->maLayoutInfo.mnStartContent != nOldStartContent;
+        }
 
-		// show notes in right order in navigator
+        // show notes in right order in navigator
         //prevent Anchors during layout to overlap, e.g. when moving a frame
-		Sort(SORT_POS);
+        Sort(SORT_POS);
 
-		// sort the items into the right page vector, so layout can be done by page
+        // sort the items into the right page vector, so layout can be done by page
         for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
-		{
+        {
             SwSidebarItem* pItem = (*i);
-			if( SwPostItHelper::INVISIBLE == pItem->mLayoutStatus )
-			{
-				if (pItem->pPostIt)
-					pItem->pPostIt->HideNote();
-				continue;
-			}
+            if( SwPostItHelper::INVISIBLE == pItem->mLayoutStatus )
+            {
+                if (pItem->pPostIt)
+                    pItem->pPostIt->HideNote();
+                continue;
+            }
 
-			if( SwPostItHelper::HIDDEN == pItem->mLayoutStatus )
-			{
-				if (!mpWrtShell->GetViewOptions()->IsShowHiddenChar())
-				{
-					if (pItem->pPostIt)
-						pItem->pPostIt->HideNote();
-					continue;
-				}
-			}
+            if( SwPostItHelper::HIDDEN == pItem->mLayoutStatus )
+            {
+                if (!mpWrtShell->GetViewOptions()->IsShowHiddenChar())
+                {
+                    if (pItem->pPostIt)
+                        pItem->pPostIt->HideNote();
+                    continue;
+                }
+            }
 
             const unsigned long aPageNum = pItem->maLayoutInfo.mnPageNumber;
-			if (aPageNum > mPages.size())
-			{
+            if (aPageNum > mPages.size())
+            {
                 const unsigned long nNumberOfPages = mPages.size();
-				for (unsigned int j=0; j<aPageNum - nNumberOfPages; ++j)
-					mPages.push_back( new SwPostItPageItem());
-			}
-			mPages[aPageNum-1]->mList->push_back(pItem);
+                for (unsigned int j=0; j<aPageNum - nNumberOfPages; ++j)
+                    mPages.push_back( new SwPostItPageItem());
+            }
+            mPages[aPageNum-1]->mList->push_back(pItem);
             mPages[aPageNum-1]->mPageRect = pItem->maLayoutInfo.mPageFrame;
             mPages[aPageNum-1]->eSidebarPosition = pItem->maLayoutInfo.meSidebarPosition;
-		}
+        }
 
-		if (!bChange && mpWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE))
-		{
+        if (!bChange && mpWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE))
+        {
             long nLayoutHeight = SwPostItHelper::getLayoutHeight( mpWrtShell->GetLayout() );
-			if( nLayoutHeight > mbLayoutHeight )
-			{
-				if (mPages[0]->bScrollbar || HasScrollbars())
-					bChange = true;
-			}
+            if( nLayoutHeight > mbLayoutHeight )
+            {
+                if (mPages[0]->bScrollbar || HasScrollbars())
+                    bChange = true;
+            }
             else if( nLayoutHeight < mbLayoutHeight )
-			{
-				if (mPages[0]->bScrollbar || !BorderOverPageBorder(1))
-					bChange = true;
-			}
-		}
-	}
+            {
+                if (mPages[0]->bScrollbar || !BorderOverPageBorder(1))
+                    bChange = true;
+            }
+        }
+    }
 
-	if ( bRepair )
-		CheckForRemovedPostIts();
+    if ( bRepair )
+        CheckForRemovedPostIts();
 
-	mbLayoutHeight = SwPostItHelper::getLayoutHeight( mpWrtShell->GetLayout() );
-	mbWaitingForCalcRects = false;
-	return bChange;
+    mbLayoutHeight = SwPostItHelper::getLayoutHeight( mpWrtShell->GetLayout() );
+    mbWaitingForCalcRects = false;
+    return bChange;
 }
 
 bool SwPostItMgr::HasScrollbars() const
@@ -1203,7 +1199,7 @@ void SwPostItMgr::RemoveSidebarWin()
 	{
         for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
 		{
-			EndListening( *((*i)->GetBroadCaster()) );
+			EndListening( *(const_cast<SfxBroadcaster*>((*i)->GetBroadCaster())) );
 			if ((*i)->pPostIt)
 				delete (*i)->pPostIt;
 			delete (*i);
@@ -1231,14 +1227,14 @@ void SwPostItMgr::Delete(String aAuthor)
 	aRewriter.AddRule(UNDO_ARG1, aUndoString);
 	mpWrtShell->StartUndo( UNDO_DELETE, &aRewriter );
 
-	std::vector<SwFmtFld*> aTmp;
+	std::vector<const SwFmtFld*> aTmp;
     aTmp.reserve( mvPostItFlds.size() );
     for(std::list<SwSidebarItem*>::iterator pPostIt = mvPostItFlds.begin(); pPostIt!= mvPostItFlds.end() ; pPostIt++)
 	{
-		if ((*pPostIt)->GetFmtFld() && ((*pPostIt)->pPostIt->GetAuthor() == aAuthor) )
-			aTmp.push_back( (*pPostIt)->GetFmtFld() );
+		if ( (*pPostIt)->pPostIt->GetAuthor() == aAuthor )
+			aTmp.push_back( &(*pPostIt)->GetFmtFld() );
 	}
-	for(std::vector<SwFmtFld*>::iterator i = aTmp.begin(); i!= aTmp.end() ; i++)
+	for(std::vector<const SwFmtFld*>::iterator i = aTmp.begin(); i!= aTmp.end() ; i++)
 	{
 		mpWrtShell->GotoField( *(*i) );
 		mpWrtShell->DelRight();
@@ -1259,14 +1255,13 @@ void SwPostItMgr::Delete()
 	aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_DELETE_ALL_NOTES) );
 	mpWrtShell->StartUndo( UNDO_DELETE, &aRewriter );
 
-    std::vector<SwFmtFld*> aTmp;
+    std::vector<const SwFmtFld*> aTmp;
     aTmp.reserve( mvPostItFlds.size() );
     for(std::list<SwSidebarItem*>::iterator pPostIt = mvPostItFlds.begin(); pPostIt!= mvPostItFlds.end() ; pPostIt++)
-	{
-		if ((*pPostIt)->GetFmtFld())
-			aTmp.push_back( (*pPostIt)->GetFmtFld() );
-	}
-	for(std::vector<SwFmtFld*>::iterator i = aTmp.begin(); i!= aTmp.end() ; i++)
+    {
+        aTmp.push_back( &(*pPostIt)->GetFmtFld() );
+    }
+	for(std::vector<const SwFmtFld*>::iterator i = aTmp.begin(); i!= aTmp.end() ; i++)
 	{
 		mpWrtShell->GotoField( *(*i) );
 		mpWrtShell->DelRight();
@@ -1384,7 +1379,7 @@ sw::annotation::SwAnnotationWin* SwPostI
 {
     for(const_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
     {
-        if ( (*i)->GetFmtFld() && ((*i)->GetFmtFld()->GetField() == pFld))
+        if ( (*i)->GetFmtFld().GetField() == pFld )
             return dynamic_cast<sw::annotation::SwAnnotationWin*>((*i)->pPostIt);
     }
     return NULL;
@@ -1628,14 +1623,14 @@ void SwPostItMgr::CorrectPositions()
    SwSidebarWin *pFirstPostIt = 0;
    for(SwSidebarItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
    {
-	   pFirstPostIt = (*i)->pPostIt;
-	   if (pFirstPostIt)
-			break;
+       pFirstPostIt = (*i)->pPostIt;
+       if (pFirstPostIt)
+           break;
    }
 
    //if we have not found a valid note, forget about it and leave
    if (!pFirstPostIt)
-	   return;
+       return;
 
     // yeah, I know,    if this is a left page it could be wrong, but finding the page and the note is probably not even faster than just doing it
     // --> OD 2010-06-03 #i111964# - check, if anchor overlay object exists.
@@ -1654,16 +1649,14 @@ void SwPostItMgr::CorrectPositions()
         {
             for(SwSidebarItem_iterator i = mPages[n]->mList->begin(); i!= mPages[n]->mList->end(); i++)
             {
-                // --> OD 2010-06-03 #i111964# - check, if anchor overlay object exists.
                 if ( (*i)->bShow && (*i)->pPostIt && (*i)->pPostIt->Anchor() )
-                // <--                                    
                 {
                     aAnchorPosX = mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT
                         ? mpEditWin->LogicToPixel( Point((long)((*i)->pPostIt->Anchor()->GetSeventhPosition().getX()),0)).X()
                         : mpEditWin->LogicToPixel( Point((long)((*i)->pPostIt->Anchor()->GetSixthPosition().getX()),0)).X();
                     aAnchorPosY = mpEditWin->LogicToPixel( Point(0,(long)((*i)->pPostIt->Anchor()->GetSixthPosition().getY()))).Y() + 1;
                     (*i)->pPostIt->SetPosPixel(Point(aAnchorPosX,aAnchorPosY));
-			   }
+                }
             }
         }
     }



Mime
View raw message