openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h..@apache.org
Subject svn commit: r1555112 [14/18] - in /openoffice/branches/rejuvenate01: ./ main/ main/autodoc/source/parser_i/idoc/ main/dbaccess/source/shared/ main/helpcontent2/source/text/shared/01/ main/offapi/com/sun/star/accessibility/ main/offapi/com/sun/star/anim...
Date Fri, 03 Jan 2014 14:45:04 GMT
Modified: openoffice/branches/rejuvenate01/main/sw/source/core/undo/undel.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/sw/source/core/undo/undel.cxx?rev=1555112&r1=1555111&r2=1555112&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/sw/source/core/undo/undel.cxx (original)
+++ openoffice/branches/rejuvenate01/main/sw/source/core/undo/undel.cxx Fri Jan  3 14:44:44 2014
@@ -106,13 +106,30 @@ section and the end paragraph not. Then 
 record this in nSectDiff.
 */
 
-SwUndoDelete::SwUndoDelete( SwPaM& rPam, sal_Bool bFullPara, sal_Bool bCalledByTblCpy )
-	: SwUndo(UNDO_DELETE), SwUndRng( rPam ),
-	pMvStt( 0 ), pSttStr(0), pEndStr(0), pRedlData(0), pRedlSaveData(0),
-    nNode(0), nNdDiff(0), nSectDiff(0), nReplaceDummy(0), nSetPos(0),
-	bGroup( sal_False ), bBackSp( sal_False ), bJoinNext( sal_False ), bTblDelLastNd( sal_False ),
-    bDelFullPara( bFullPara ), bResetPgDesc( sal_False ), bResetPgBrk( sal_False ),
-    bFromTableCopy( bCalledByTblCpy )
+SwUndoDelete::SwUndoDelete(
+    SwPaM& rPam,
+    sal_Bool bFullPara,
+    sal_Bool bCalledByTblCpy )
+    : SwUndo(UNDO_DELETE)
+    , SwUndRng( rPam )
+    , pMvStt( 0 )
+    , pSttStr(0)
+    , pEndStr(0)
+    , pRedlData(0)
+    , pRedlSaveData(0)
+    , nNode(0)
+    , nNdDiff(0)
+    , nSectDiff(0)
+    , nReplaceDummy(0)
+    , nSetPos(0)
+    , bGroup( sal_False )
+    , bBackSp( sal_False )
+    , bJoinNext( sal_False )
+    , bTblDelLastNd( sal_False )
+    , bDelFullPara( bFullPara )
+    , bResetPgDesc( sal_False )
+    , bResetPgBrk( sal_False )
+    , bFromTableCopy( bCalledByTblCpy )
 {
 	bDelFullPara = bFullPara; // This is set e.g. if an empty paragraph before a table is deleted
 

Modified: openoffice/branches/rejuvenate01/main/sw/source/core/undo/undobj.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/sw/source/core/undo/undobj.cxx?rev=1555112&r1=1555111&r2=1555112&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/sw/source/core/undo/undobj.cxx (original)
+++ openoffice/branches/rejuvenate01/main/sw/source/core/undo/undobj.cxx Fri Jan  3 14:44:44 2014
@@ -762,112 +762,121 @@ void SwUndoSaveCntnt::DelCntntIndex( con
 		}
 	}
 
-	// 3. Bookmarks
+    // 3. Bookmarks
     if( nsDelCntntType::DELCNT_BKM & nDelCntntType )
-	{
+    {
         IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
-		if( pMarkAccess->getMarksCount() )
-		{
+        if( pMarkAccess->getAllMarksCount() )
+        {
 
-			for( sal_uInt16 n = 0; n < pMarkAccess->getMarksCount(); ++n )
-			{
-                // --> OD 2007-10-17 #i81002#
+            for( sal_uInt16 n = 0; n < pMarkAccess->getAllMarksCount(); ++n )
+            {
                 bool bSavePos = false;
                 bool bSaveOtherPos = false;
-                const ::sw::mark::IMark* pBkmk = (pMarkAccess->getMarksBegin() + n)->get();
+                const ::sw::mark::IMark* pBkmk = (pMarkAccess->getAllMarksBegin() + n)->get();
+
                 if( nsDelCntntType::DELCNT_CHKNOCNTNT & nDelCntntType )
                 {
-                    if( pStt->nNode <= pBkmk->GetMarkPos().nNode &&
-                        pBkmk->GetMarkPos().nNode < pEnd->nNode )
+                    if ( pStt->nNode <= pBkmk->GetMarkPos().nNode
+                         && pBkmk->GetMarkPos().nNode < pEnd->nNode )
+                    {
                         bSavePos = true;
-                    if( pBkmk->IsExpanded() &&
-                        pStt->nNode <= pBkmk->GetOtherMarkPos().nNode &&
-                        pBkmk->GetOtherMarkPos().nNode < pEnd->nNode )
+                    }
+                    if ( pBkmk->IsExpanded()
+                         && pStt->nNode <= pBkmk->GetOtherMarkPos().nNode
+                         && pBkmk->GetOtherMarkPos().nNode < pEnd->nNode )
+                    {
                         bSaveOtherPos = true;
+                    }
                 }
                 else
                 {
-                    // --> OD 2009-08-06 #i92125#
-                    bool bKeepCrossRefBkmk( false );
+                    // keep cross-reference bookmarks, if content inside one paragraph is deleted.
+                    if ( rMark.nNode == rPoint.nNode
+                         && ( IDocumentMarkAccess::GetType(*pBkmk) == IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK
+                              || IDocumentMarkAccess::GetType(*pBkmk) == IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK ) )
                     {
-                        if ( rMark.nNode == rPoint.nNode &&
-                             ( IDocumentMarkAccess::GetType(*pBkmk) ==
-                                IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK ||
-                               IDocumentMarkAccess::GetType(*pBkmk) ==
-                                IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK ) )
-                        {
-                            bKeepCrossRefBkmk = true;
-                        }
+                        continue;
+                    }
+
+                    bool bMaybe = false;
+                    if ( *pStt <= pBkmk->GetMarkPos() && pBkmk->GetMarkPos() <= *pEnd )
+                    {
+                        if ( pBkmk->GetMarkPos() == *pEnd
+                             || ( *pStt == pBkmk->GetMarkPos() && pBkmk->IsExpanded() ) )
+                            bMaybe = true;
+                        else
+                            bSavePos = true;
                     }
-                    if ( !bKeepCrossRefBkmk )
+                    if( pBkmk->IsExpanded() &&
+                        *pStt <= pBkmk->GetOtherMarkPos() && pBkmk->GetOtherMarkPos() <= *pEnd )
                     {
-                        bool bMaybe = false;
-                        if ( *pStt <= pBkmk->GetMarkPos() && pBkmk->GetMarkPos() <= *pEnd )
+                        if ( bSavePos || bSaveOtherPos
+                             || ( pBkmk->GetOtherMarkPos() < *pEnd && pBkmk->GetOtherMarkPos() > *pStt ) )
                         {
-                            if( pBkmk->GetMarkPos() == *pEnd ||
-                                ( *pStt == pBkmk->GetMarkPos() && pBkmk->IsExpanded() ) )
-                                bMaybe = true;
-                            else
+                            if( bMaybe )
                                 bSavePos = true;
+                            bSaveOtherPos = true;
                         }
-                        if( pBkmk->IsExpanded() &&
-                            *pStt <= pBkmk->GetOtherMarkPos() && pBkmk->GetOtherMarkPos() <= *pEnd )
+                    }
+
+                    if ( !bSavePos && !bSaveOtherPos
+                         && dynamic_cast< const ::sw::mark::CrossRefBookmark* >(pBkmk) )
+                    {
+                        // certain special handling for cross-reference bookmarks
+                        const bool bDifferentTxtNodesAtMarkAndPoint =
+                            rMark.nNode != rPoint.nNode
+                            && rMark.nNode.GetNode().GetTxtNode()
+                            && rPoint.nNode.GetNode().GetTxtNode();
+                        if ( bDifferentTxtNodesAtMarkAndPoint )
                         {
-                            if( bSavePos || bSaveOtherPos ||
-                                ( pBkmk->GetOtherMarkPos() < *pEnd && pBkmk->GetOtherMarkPos() > *pStt ) )
+                            // delete cross-reference bookmark at <pStt>, if only part of
+                            // <pEnd> text node content is deleted.
+                            if( pStt->nNode == pBkmk->GetMarkPos().nNode
+                                && pEnd->nContent.GetIndex() != pEnd->nNode.GetNode().GetTxtNode()->Len() )
+                            {
+                                bSavePos = true;
+                                bSaveOtherPos = false; // cross-reference bookmarks are not expanded
+                            }
+                            // delete cross-reference bookmark at <pEnd>, if only part of
+                            // <pStt> text node content is deleted.
+                            else if( pEnd->nNode == pBkmk->GetMarkPos().nNode &&
+                                pStt->nContent.GetIndex() != 0 )
                             {
-                                if( bMaybe )
-                                    bSavePos = true;
-                                bSaveOtherPos = true;
+                                bSavePos = true;
+                                bSaveOtherPos = false; // cross-reference bookmarks are not expanded
                             }
                         }
                     }
-                    // <--
-
-                    // --> OD 2007-10-17 #i81002#
-                    const bool bDifferentTxtNodesAtMarkAndPoint(
-                                        rMark.nNode != rPoint.nNode &&
-                                        rMark.nNode.GetNode().GetTxtNode() &&
-                                        rPoint.nNode.GetNode().GetTxtNode() );
-                    // <--
-                    if( !bSavePos && !bSaveOtherPos && bDifferentTxtNodesAtMarkAndPoint &&
-                        dynamic_cast< const ::sw::mark::CrossRefBookmark* >(pBkmk))
+                    else if ( IDocumentMarkAccess::GetType(*pBkmk) == IDocumentMarkAccess::ANNOTATIONMARK )
                     {
-                        // delete cross-reference bookmark at <pStt>, if only part of
-                        // <pEnd> text node content is deleted.
-                        if( pStt->nNode == pBkmk->GetMarkPos().nNode &&
-                            pEnd->nContent.GetIndex() !=
-                                pEnd->nNode.GetNode().GetTxtNode()->Len() )
-                        {
-                            bSavePos = true;
-                            bSaveOtherPos = false;
-                        }
-                        // delete cross-reference bookmark at <pEnd>, if only part of
-                        // <pStt> text node content is deleted.
-                        else if( pEnd->nNode == pBkmk->GetMarkPos().nNode &&
-                            pStt->nContent.GetIndex() != 0 )
+                        // delete annotation marks, if its end position is covered by the deletion
+                        const SwPosition& rAnnotationEndPos = pBkmk->GetMarkEnd();
+                        if ( *pStt < rAnnotationEndPos && rAnnotationEndPos <= *pEnd )
                         {
                             bSavePos = true;
-                            bSaveOtherPos = false;
+                            bSaveOtherPos = true;
                         }
                     }
                 }
-				if( bSavePos || bSaveOtherPos )
-				{
-					if( !pHistory )
-						pHistory = new SwHistory;
-
-					pHistory->Add( *pBkmk, bSavePos, bSaveOtherPos );
-                    if(bSavePos &&
-                        (bSaveOtherPos || !pBkmk->IsExpanded()))
+
+                if ( bSavePos || bSaveOtherPos )
+                {
+                    if( !pHistory )
+                        pHistory = new SwHistory;
+
+                    pHistory->Add( *pBkmk, bSavePos, bSaveOtherPos );
+                    if ( bSavePos
+                         && ( bSaveOtherPos
+                              || !pBkmk->IsExpanded() ) )
                     {
-                        pMarkAccess->deleteMark(pMarkAccess->getMarksBegin()+n);
+                        pMarkAccess->deleteMark(pMarkAccess->getAllMarksBegin()+n);
                         n--;
                     }
-				}
-			}
-		}
-	}
+                }
+            }
+        }
+    }
 }
 
 

Modified: openoffice/branches/rejuvenate01/main/sw/source/core/unocore/unobkm.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/sw/source/core/unocore/unobkm.cxx?rev=1555112&r1=1555111&r2=1555112&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/sw/source/core/unocore/unobkm.cxx (original)
+++ openoffice/branches/rejuvenate01/main/sw/source/core/unocore/unobkm.cxx Fri Jan  3 14:44:44 2014
@@ -103,14 +103,14 @@ void SwXBookmark::Impl::Modify(const Sfx
     }
 }
 
-void SwXBookmark::Impl::registerInMark(SwXBookmark & rThis,
-        ::sw::mark::IMark *const pBkmk)
+void SwXBookmark::Impl::registerInMark(
+    SwXBookmark & rThis,
+    ::sw::mark::IMark *const pBkmk)
 {
     if (pBkmk)
     {
         pBkmk->Add(this);
-        ::sw::mark::MarkBase *const pMarkBase(
-            dynamic_cast< ::sw::mark::MarkBase * >(pBkmk));
+        ::sw::mark::MarkBase *const pMarkBase(dynamic_cast< ::sw::mark::MarkBase * >(pBkmk));
         OSL_ENSURE(pMarkBase, "registerInMark: no MarkBase?");
         if (pMarkBase)
         {
@@ -132,7 +132,9 @@ const ::sw::mark::IMark* SwXBookmark::Ge
     return m_pImpl->m_pRegisteredBookmark;
 }
 
-SwXBookmark::SwXBookmark(::sw::mark::IMark *const pBkmk, SwDoc *const pDoc)
+SwXBookmark::SwXBookmark(
+    ::sw::mark::IMark *const pBkmk,
+    SwDoc *const pDoc)
     : m_pImpl( new SwXBookmark::Impl(*this, pDoc, pBkmk) )
 {
 }
@@ -146,34 +148,34 @@ SwXBookmark::~SwXBookmark()
 {
 }
 
-uno::Reference<text::XTextContent>
-SwXBookmark::CreateXBookmark(SwDoc & rDoc, ::sw::mark::IMark & rBookmark)
+uno::Reference<text::XTextContent> SwXBookmark::CreateXBookmark(
+    SwDoc & rDoc,
+    ::sw::mark::IMark & rBookmark)
 {
     // #i105557#: do not iterate over the registered clients: race condition
-    ::sw::mark::MarkBase *const pMarkBase(
-        dynamic_cast< ::sw::mark::MarkBase * >(&rBookmark));
+    ::sw::mark::MarkBase *const pMarkBase(dynamic_cast< ::sw::mark::MarkBase * >(&rBookmark));
     OSL_ENSURE(pMarkBase, "CreateXBookmark: no MarkBase?");
     if (!pMarkBase) { return 0; }
     uno::Reference<text::XTextContent> xBookmark(pMarkBase->GetXBookmark());
     if (!xBookmark.is())
     {
-        // FIXME: These belong in XTextFieldsSupplier
-        //if (dynamic_cast< ::sw::mark::TextFieldmark* >(&rBkmk))
-        //    pXBkmk = new SwXFieldmark(false, &rBkmk, pDoc);
-        //else if (dynamic_cast< ::sw::mark::CheckboxFieldmark* >(&rBkmk))
-        //    pXBkmk = new SwXFieldmark(true, &rBkmk, pDoc);
-        //else
         OSL_ENSURE(
-            dynamic_cast< ::sw::mark::IBookmark* >(&rBookmark),
+            dynamic_cast< ::sw::mark::IBookmark* >(&rBookmark) || IDocumentMarkAccess::GetType(rBookmark) == IDocumentMarkAccess::ANNOTATIONMARK,
             "<SwXBookmark::GetObject(..)>"
-            "SwXBookmark requested for non-bookmark mark.");
+            "SwXBookmark requested for non-bookmark mark and non-annotation mark.");
         SwXBookmark *const pXBookmark = new SwXBookmark(&rBookmark, &rDoc);
         xBookmark.set(pXBookmark);
-        pXBookmark->m_pImpl->registerInMark(*pXBookmark, pMarkBase);
+        pXBookmark->registerInMark( pMarkBase);
     }
     return xBookmark;
 }
 
+
+void SwXBookmark::registerInMark( ::sw::mark::IMark *const pBkmk )
+{
+    m_pImpl->registerInMark( *this, pBkmk );
+}
+
 ::sw::mark::IMark const* SwXBookmark::GetBookmarkInDoc(SwDoc const*const pDoc,
         const uno::Reference< lang::XUnoTunnel> & xUT)
 {
@@ -192,8 +194,7 @@ const uno::Sequence< sal_Int8 > & SwXBoo
     return aSeq;
 }
 
-sal_Int64 SAL_CALL
-SwXBookmark::getSomething(const uno::Sequence< sal_Int8 >& rId)
+sal_Int64 SAL_CALL SwXBookmark::getSomething( const uno::Sequence< sal_Int8 >& rId )
 throw (uno::RuntimeException)
 {
     return ::sw::UnoTunnelImpl<SwXBookmark>(rId, this);
@@ -246,10 +247,7 @@ throw (lang::IllegalArgumentException, u
     {
         eType = IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK;
     }
-    m_pImpl->registerInMark(*this,
-        m_pImpl->m_pDoc->getIDocumentMarkAccess()->makeMark(
-            aPam, m_pImpl->m_sMarkName, eType));
-    // --> OD 2007-10-23 #i81002#
+    registerInMark( m_pImpl->m_pDoc->getIDocumentMarkAccess()->makeMark( aPam, m_pImpl->m_sMarkName, eType ) );
     // Check, if bookmark has been created.
     // E.g., the creation of a cross-reference bookmark is suppress,
     // if the PaM isn't a valid one for cross-reference bookmarks.
@@ -260,26 +258,23 @@ throw (lang::IllegalArgumentException, u
             " - could not create Mark.");
         throw lang::IllegalArgumentException();
     }
-    // <--
 }
 
-void SwXBookmark::attachToRange(
-        const uno::Reference< text::XTextRange > & xTextRange)
+void SwXBookmark::attachToRange( const uno::Reference< text::XTextRange > & xTextRange )
 throw (lang::IllegalArgumentException, uno::RuntimeException)
 {
     attachToRangeEx(xTextRange, IDocumentMarkAccess::BOOKMARK);
 }
 
-void SAL_CALL
-SwXBookmark::attach(const uno::Reference< text::XTextRange > & xTextRange)
+void SAL_CALL SwXBookmark::attach( const uno::Reference< text::XTextRange > & xTextRange )
 throw (lang::IllegalArgumentException, uno::RuntimeException)
 {
     vos::OGuard aGuard(Application::GetSolarMutex());
     attachToRange( xTextRange );
 }
 
-uno::Reference< text::XTextRange > SAL_CALL
-SwXBookmark::getAnchor() throw (uno::RuntimeException)
+uno::Reference< text::XTextRange > SAL_CALL SwXBookmark::getAnchor()
+throw (uno::RuntimeException)
 {
     vos::OGuard aGuard(Application::GetSolarMutex());
 
@@ -294,13 +289,13 @@ SwXBookmark::getAnchor() throw (uno::Run
                 ? &m_pImpl->m_pRegisteredBookmark->GetOtherMarkPos() : NULL);
 }
 
-void SAL_CALL SwXBookmark::dispose() throw (uno::RuntimeException)
+void SAL_CALL SwXBookmark::dispose()
+throw (uno::RuntimeException)
 {
     vos::OGuard aGuard(Application::GetSolarMutex());
     if (m_pImpl->m_pRegisteredBookmark)
     {
-        m_pImpl->m_pDoc->getIDocumentMarkAccess()->deleteMark(
-                m_pImpl->m_pRegisteredBookmark);
+        m_pImpl->m_pDoc->getIDocumentMarkAccess()->deleteMark( m_pImpl->m_pRegisteredBookmark );
     }
 }
 
@@ -355,7 +350,7 @@ throw (uno::RuntimeException)
     }
     IDocumentMarkAccess *const pMarkAccess =
         m_pImpl->m_pDoc->getIDocumentMarkAccess();
-    if(pMarkAccess->findMark(rName) != pMarkAccess->getMarksEnd())
+    if(pMarkAccess->findMark(rName) != pMarkAccess->getAllMarksEnd())
     {
         throw uno::RuntimeException();
     }
@@ -514,10 +509,53 @@ throw (beans::UnknownPropertyException, 
  * SwXFieldmark
  ******************************************************************/
 
-SwXFieldmark::SwXFieldmark(bool _isReplacementObject, ::sw::mark::IMark* pBkm, SwDoc* pDc)
-    : SwXFieldmark_Base(pBkm, pDc)
+SwXFieldmark::SwXFieldmark( bool _isReplacementObject )
+    : SwXFieldmark_Base()
     , isReplacementObject(_isReplacementObject)
-{ }
+{
+}
+
+
+SwXFieldmark::SwXFieldmark(
+    bool _isReplacementObject,
+    ::sw::mark::IMark *const pMark,
+    SwDoc *const pDoc )
+    : SwXFieldmark_Base( pMark, pDoc )
+    , isReplacementObject( _isReplacementObject )
+{
+}
+
+
+uno::Reference<text::XTextContent> SwXFieldmark::CreateXFieldmark(
+    SwDoc & rDoc,
+    ::sw::mark::IMark & rBookmark )
+{
+    // do not iterate over the registered clients: race condition
+    ::sw::mark::MarkBase *const pMarkBase( dynamic_cast< ::sw::mark::MarkBase * >(&rBookmark));
+    OSL_ENSURE(pMarkBase, "CreateXFieldmark: no MarkBase?");
+    if (!pMarkBase) { return 0; }
+
+    uno::Reference<text::XTextContent> xBookmark(pMarkBase->GetXBookmark());
+    if (!xBookmark.is())
+    {
+        SwXFieldmark* pXFieldmark = NULL;
+        if ( dynamic_cast< ::sw::mark::TextFieldmark* >(&rBookmark) )
+        {
+            pXFieldmark = new SwXFieldmark( false, &rBookmark, &rDoc );
+        }
+        else if ( dynamic_cast< ::sw::mark::CheckboxFieldmark* >(&rBookmark) )
+        {
+            pXFieldmark = new SwXFieldmark( true, &rBookmark, &rDoc );
+        }
+        if ( pXFieldmark != NULL )
+        {
+            xBookmark.set( pXFieldmark );
+            pXFieldmark->registerInMark( pMarkBase );
+        }
+    }
+    return xBookmark;
+}
+
 
 void SwXFieldmarkParameters::insertByName(const OUString& aName, const uno::Any& aElement)
     throw (lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException)

Modified: openoffice/branches/rejuvenate01/main/sw/source/core/unocore/unofield.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/sw/source/core/unocore/unofield.cxx?rev=1555112&r1=1555111&r2=1555112&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/sw/source/core/unocore/unofield.cxx (original)
+++ openoffice/branches/rejuvenate01/main/sw/source/core/unocore/unofield.cxx Fri Jan  3 14:44:44 2014
@@ -91,6 +91,7 @@
 #include <fmtmeta.hxx> // MetaFieldManager
 #include <switerator.hxx>
 
+
 using ::rtl::OUString;
 using namespace ::com::sun::star;
 using namespace nsSwDocInfoSubType;
@@ -1086,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()
@@ -1168,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 );
@@ -1211,125 +1222,136 @@ void SwXTextField::attachToRange(
 				sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
 	}
 
-	SwDoc* pDoc = pRange ? (SwDoc*)pRange->GetDoc() : pCursor ? (SwDoc*)pCursor->GetDoc() : 0;
-	//wurde ein FieldMaster attached, dann ist das Dokument schon festgelegt!
-	if(pDoc && (!m_pDoc || m_pDoc == pDoc))
-	{
-		SwUnoInternalPaM aPam(*pDoc);
-		//das muss jetzt sal_True liefern
+    SwDoc* pDoc = pRange ? (SwDoc*)pRange->GetDoc() : pCursor ? (SwDoc*)pCursor->GetDoc() : 0;
+    //wurde ein FieldMaster attached, dann ist das Dokument schon festgelegt!
+    if(pDoc && (!m_pDoc || m_pDoc == pDoc))
+    {
+        SwUnoInternalPaM aPam(*pDoc);
         ::sw::XTextRangeToSwPaM(aPam, xTextRange);
-		SwField* pFld = 0;
-		switch(m_nServiceId)
-		{
-			case SW_SERVICE_FIELDTYPE_ANNOTATION:
-			{
-				SwFieldType* pFldType = pDoc->GetSysFldType(RES_POSTITFLD);
-				
-				DateTime aDateTime;
-				if (m_pProps->pDateTime)
-				{
-					aDateTime.SetYear(m_pProps->pDateTime->Year);
-					aDateTime.SetMonth(m_pProps->pDateTime->Month);
-					aDateTime.SetDay(m_pProps->pDateTime->Day);
-					aDateTime.SetHour(m_pProps->pDateTime->Hours);
-					aDateTime.SetMin(m_pProps->pDateTime->Minutes);
-					aDateTime.SetSec(m_pProps->pDateTime->Seconds);
-				}
-				pFld = new SwPostItField((SwPostItFieldType*)pFldType,
-						m_pProps->sPar1, m_pProps->sPar2,aDateTime);
-				if ( m_pTextObject )
-				{
-					((SwPostItField*)pFld)->SetTextObject( m_pTextObject->CreateText() );
-				  	((SwPostItField*)pFld)->SetPar2(m_pTextObject->GetText());
-				}
-			}
-			break;
-			case SW_SERVICE_FIELDTYPE_SCRIPT:
-			{
-				SwFieldType* pFldType = pDoc->GetSysFldType(RES_SCRIPTFLD);
-				pFld = new SwScriptField((SwScriptFieldType*)pFldType,
-						m_pProps->sPar1, m_pProps->sPar2,
-						m_pProps->bBool1);
-			}
-			break;
-			case SW_SERVICE_FIELDTYPE_DATETIME:
-			{
-				sal_uInt16 nSub = 0;
-				if(m_pProps->bBool1)
-					nSub |= FIXEDFLD;
-				if(m_pProps->bBool2)
-					nSub |= DATEFLD;
-				else
-					nSub |= TIMEFLD;
-				SwFieldType* pFldType = pDoc->GetSysFldType(RES_DATETIMEFLD);
-				pFld = new SwDateTimeField((SwDateTimeFieldType*)pFldType,
-				nSub, m_pProps->nFormat);
+        SwField* pFld = 0;
+        switch(m_nServiceId)
+        {
+        case SW_SERVICE_FIELDTYPE_ANNOTATION:
+            {
+                SwFieldType* pFldType = pDoc->GetSysFldType(RES_POSTITFLD);
+
+                DateTime aDateTime;
+                if (m_pProps->pDateTime)
+                {
+                    aDateTime.SetYear(m_pProps->pDateTime->Year);
+                    aDateTime.SetMonth(m_pProps->pDateTime->Month);
+                    aDateTime.SetDay(m_pProps->pDateTime->Day);
+                    aDateTime.SetHour(m_pProps->pDateTime->Hours);
+                    aDateTime.SetMin(m_pProps->pDateTime->Minutes);
+                    aDateTime.SetSec(m_pProps->pDateTime->Seconds);
+                }
+                SwPostItField* pPostItField = new SwPostItField(
+                    (SwPostItFieldType*)pFldType,
+                    m_pProps->sPar2, // content
+                    m_pProps->sPar1, // author
+                    m_pProps->sPar3, // author's initials
+                    m_pProps->sPar4, // name
+                    aDateTime );
+                if ( m_pTextObject )
+                {
+                    pPostItField->SetTextObject( m_pTextObject->CreateText() );
+                    pPostItField->SetPar2(m_pTextObject->GetText());
+                }
+                pFld = pPostItField;
+            }
+            break;
+
+        case SW_SERVICE_FIELDTYPE_SCRIPT:
+            {
+                SwFieldType* pFldType = pDoc->GetSysFldType(RES_SCRIPTFLD);
+                pFld = new SwScriptField((SwScriptFieldType*)pFldType,
+                    m_pProps->sPar1, m_pProps->sPar2,
+                    m_pProps->bBool1);
+            }
+            break;
+
+        case SW_SERVICE_FIELDTYPE_DATETIME:
+            {
+                sal_uInt16 nSub = 0;
+                if(m_pProps->bBool1)
+                    nSub |= FIXEDFLD;
+                if(m_pProps->bBool2)
+                    nSub |= DATEFLD;
+                else
+                    nSub |= TIMEFLD;
+                SwFieldType* pFldType = pDoc->GetSysFldType(RES_DATETIMEFLD);
+                pFld = new SwDateTimeField((SwDateTimeFieldType*)pFldType,
+                    nSub, m_pProps->nFormat);
                 if(m_pProps->fDouble > 0.)
-					((SwDateTimeField*)pFld)->SetValue( m_pProps->fDouble );
-				if(m_pProps->pDateTime)
-				{
-					uno::Any aVal; aVal <<= *m_pProps->pDateTime;
-					pFld->PutValue( aVal, FIELD_PROP_DATE_TIME );
-				}
-				((SwDateTimeField*)pFld)->SetOffset(m_pProps->nSubType);
-			}
-			break;
-			case SW_SERVICE_FIELDTYPE_FILE_NAME:
-			{
-				SwFieldType* pFldType = pDoc->GetSysFldType(RES_FILENAMEFLD);
-				sal_Int32 nFormat = m_pProps->nFormat;
-				if(m_pProps->bBool2)
-					nFormat |= FF_FIXED;
-				pFld = new SwFileNameField((SwFileNameFieldType*)pFldType, nFormat);
-				if(m_pProps->sPar3.Len())
-					((SwFileNameField*)pFld)->SetExpansion(m_pProps->sPar3);
+                    ((SwDateTimeField*)pFld)->SetValue( m_pProps->fDouble );
+                if(m_pProps->pDateTime)
+                {
+                    uno::Any aVal; aVal <<= *m_pProps->pDateTime;
+                    pFld->PutValue( aVal, FIELD_PROP_DATE_TIME );
+                }
+                ((SwDateTimeField*)pFld)->SetOffset(m_pProps->nSubType);
+            }
+            break;
+
+        case SW_SERVICE_FIELDTYPE_FILE_NAME:
+            {
+                SwFieldType* pFldType = pDoc->GetSysFldType(RES_FILENAMEFLD);
+                sal_Int32 nFormat = m_pProps->nFormat;
+                if(m_pProps->bBool2)
+                    nFormat |= FF_FIXED;
+                pFld = new SwFileNameField((SwFileNameFieldType*)pFldType, nFormat);
+                if(m_pProps->sPar3.Len())
+                    ((SwFileNameField*)pFld)->SetExpansion(m_pProps->sPar3);
                 uno::Any aFormat(&m_pProps->nFormat, ::getCppuType(&m_pProps->nFormat));
                 pFld->PutValue( aFormat, FIELD_PROP_FORMAT );
-			}
-			break;
-			case SW_SERVICE_FIELDTYPE_TEMPLATE_NAME:
-			{
-				SwFieldType* pFldType = pDoc->GetSysFldType(RES_TEMPLNAMEFLD);
-				pFld = new SwTemplNameField((SwTemplNameFieldType*)pFldType,
-													m_pProps->nFormat);
+            }
+            break;
+
+        case SW_SERVICE_FIELDTYPE_TEMPLATE_NAME:
+            {
+                SwFieldType* pFldType = pDoc->GetSysFldType(RES_TEMPLNAMEFLD);
+                pFld = new SwTemplNameField((SwTemplNameFieldType*)pFldType,
+                    m_pProps->nFormat);
                 uno::Any aFormat(&m_pProps->nFormat, ::getCppuType(&m_pProps->nFormat));
                 pFld->PutValue(aFormat, FIELD_PROP_FORMAT);
             }
-			break;
-			case SW_SERVICE_FIELDTYPE_CHAPTER:
-			{
-				SwFieldType* pFldType = pDoc->GetSysFldType(RES_CHAPTERFLD);
-				pFld = new SwChapterField((SwChapterFieldType*)pFldType, m_pProps->nUSHORT1);
-				((SwChapterField*)pFld)->SetLevel(m_pProps->nByte1);
+            break;
+
+        case SW_SERVICE_FIELDTYPE_CHAPTER:
+            {
+                SwFieldType* pFldType = pDoc->GetSysFldType(RES_CHAPTERFLD);
+                pFld = new SwChapterField((SwChapterFieldType*)pFldType, m_pProps->nUSHORT1);
+                ((SwChapterField*)pFld)->SetLevel(m_pProps->nByte1);
                 uno::Any aVal; aVal <<= (sal_Int16)m_pProps->nUSHORT1;
                 pFld->PutValue(aVal, FIELD_PROP_USHORT1 );
-			}
-			break;
-			case SW_SERVICE_FIELDTYPE_AUTHOR:
-			{
-				long nFormat = m_pProps->bBool1 ? AF_NAME : AF_SHORTCUT;
-				if(m_pProps->bBool2)
-					nFormat |= AF_FIXED;
+            }
+            break;
+        case SW_SERVICE_FIELDTYPE_AUTHOR:
+            {
+                long nFormat = m_pProps->bBool1 ? AF_NAME : AF_SHORTCUT;
+                if(m_pProps->bBool2)
+                    nFormat |= AF_FIXED;
+
+                SwFieldType* pFldType = pDoc->GetSysFldType(RES_AUTHORFLD);
+                pFld = new SwAuthorField((SwAuthorFieldType*)pFldType, nFormat);
+                ((SwAuthorField*)pFld)->SetExpansion(m_pProps->sPar1);
+            }
+            break;
 
-				SwFieldType* pFldType = pDoc->GetSysFldType(RES_AUTHORFLD);
-				pFld = new SwAuthorField((SwAuthorFieldType*)pFldType, nFormat);
-				((SwAuthorField*)pFld)->SetExpansion(m_pProps->sPar1);
-			}
-			break;
-			case SW_SERVICE_FIELDTYPE_CONDITIONED_TEXT:
-			case SW_SERVICE_FIELDTYPE_HIDDEN_TEXT:
-			{
-				SwFieldType* pFldType = pDoc->GetSysFldType(RES_HIDDENTXTFLD);
-				pFld = new SwHiddenTxtField(((SwHiddenTxtFieldType*)pFldType),
-						m_pProps->sPar1,
-						m_pProps->sPar2, m_pProps->sPar3,
-                        static_cast< sal_uInt16 >(SW_SERVICE_FIELDTYPE_HIDDEN_TEXT == m_nServiceId ?
-                             TYP_HIDDENTXTFLD : TYP_CONDTXTFLD));
+        case SW_SERVICE_FIELDTYPE_CONDITIONED_TEXT:
+        case SW_SERVICE_FIELDTYPE_HIDDEN_TEXT:
+            {
+                SwFieldType* pFldType = pDoc->GetSysFldType(RES_HIDDENTXTFLD);
+                pFld = new SwHiddenTxtField(((SwHiddenTxtFieldType*)pFldType),
+                    m_pProps->sPar1,
+                    m_pProps->sPar2, m_pProps->sPar3,
+                    static_cast< sal_uInt16 >(SW_SERVICE_FIELDTYPE_HIDDEN_TEXT == m_nServiceId ? TYP_HIDDENTXTFLD : TYP_CONDTXTFLD));
                 ((SwHiddenTxtField*)pFld)->SetValue(m_pProps->bBool1);
-				uno::Any aVal; aVal <<= (OUString)m_pProps->sPar4;
-				pFld->PutValue(aVal, FIELD_PROP_PAR4 );
-			}
-			break;
+                uno::Any aVal; aVal <<= (OUString)m_pProps->sPar4;
+                pFld->PutValue(aVal, FIELD_PROP_PAR4 );
+            }
+            break;
+
 			case SW_SERVICE_FIELDTYPE_HIDDEN_PARA:
 			{
 				SwFieldType* pFldType = pDoc->GetSysFldType(RES_HIDDENPARAFLD);
@@ -1721,17 +1743,19 @@ void SwXTextField::attachToRange(
                ((SwTblField*)pFld)->ChgExpStr(m_pProps->sPar1);
             }
             break;
-			default: DBG_ERROR("was ist das fuer ein Typ?");
-		}
-		if(pFld)
-		{
+            default: DBG_ERROR("was ist das fuer ein Typ?");
+        }
+        if ( pFld )
+        {
             pFld->SetAutomaticLanguage(!m_pProps->bBool4);
             SwFmtFld aFmt( *pFld );
 
-			UnoActionContext aCont(pDoc);
-			SwTxtAttr* pTxtAttr = 0;
-			if(aPam.HasMark())
-				pDoc->DeleteAndJoin(aPam);
+            UnoActionContext aCont(pDoc);
+            if ( aPam.HasMark()
+                 && m_nServiceId != SW_SERVICE_FIELDTYPE_ANNOTATION )
+            {
+                pDoc->DeleteAndJoin(aPam);
+            }
 
             SwXTextCursor const*const pTextCursor( dynamic_cast<SwXTextCursor*>(pCursor) );
             const bool bForceExpandHints(
@@ -1743,14 +1767,35 @@ void SwXTextField::attachToRange(
                 ? nsSetAttrMode::SETATTR_FORCEHINTEXPAND
                 : nsSetAttrMode::SETATTR_DEFAULT;
 
-            pDoc->InsertPoolItem(aPam, aFmt, nInsertFlags);
+            if ( *aPam.GetPoint() != *aPam.GetMark()
+                 && m_nServiceId == SW_SERVICE_FIELDTYPE_ANNOTATION )
+            {
+                // 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;
@@ -1768,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 )
@@ -1782,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();
@@ -1803,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();
@@ -1823,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();
 }
 
@@ -1890,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() );
@@ -1902,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
@@ -2073,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();
@@ -2127,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;
 				}
@@ -2271,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
@@ -2330,13 +2433,20 @@ uno::Sequence< OUString > SwXTextField::
 	return aRet;
 }
 
-void SwXTextField::Invalidate()
+
+sal_uInt16 SwXTextField::GetServiceId()
+{
+    return m_nServiceId;
+}
+
+
+    void SwXTextField::Invalidate()
 {
 	if (GetRegisteredIn())
 	{
 		((SwModify*)GetRegisteredIn())->Remove(this);
-		aLstnrCntnr.Disposing();
-		pFmtFld = 0;
+		m_aLstnrCntnr.Disposing();
+		m_pFmtFld = 0;
 		m_pDoc = 0;
 	}
 }
@@ -2359,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;
 	}
@@ -2367,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/branches/rejuvenate01/main/sw/source/core/unocore/unoidx.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/sw/source/core/unocore/unoidx.cxx?rev=1555112&r1=1555111&r2=1555112&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/sw/source/core/unocore/unoidx.cxx (original)
+++ openoffice/branches/rejuvenate01/main/sw/source/core/unocore/unoidx.cxx Fri Jan  3 14:44:44 2014
@@ -67,6 +67,7 @@
 #include <chpfld.hxx>
 #include <SwStyleNameMapper.hxx>
 #include <unoevtlstnr.hxx>
+#include <editsh.hxx>
 
 
 using namespace ::com::sun::star;
@@ -583,6 +584,21 @@ throw (uno::RuntimeException)
 /*-- 14.12.98 09:35:05---------------------------------------------------
 
   -----------------------------------------------------------------------*/
+void lcl_CalcLayout(SwDoc *pDoc)
+{
+    ViewShell *pViewShell = 0;
+    SwEditShell* pEditShell = pDoc ? pDoc->GetEditShell(&pViewShell) : 0;
+    if (pEditShell)
+    {
+        pEditShell->CalcLayout();
+    }
+    else if (pViewShell)
+    {
+        pViewShell->CalcLayout();
+    }
+
+}
+
 void SAL_CALL SwXDocumentIndex::update() throw (uno::RuntimeException)
 {
 	vos::OGuard aGuard(Application::GetSolarMutex());
@@ -595,6 +611,10 @@ void SAL_CALL SwXDocumentIndex::update()
 		throw uno::RuntimeException();
     }
     pTOXBase->Update();
+
+    // the insertion of TOC will affect the document layout
+    lcl_CalcLayout(m_pImpl->m_pDoc);
+
     // page numbers
     pTOXBase->UpdatePageNum();
 }

Modified: openoffice/branches/rejuvenate01/main/sw/source/core/unocore/unomap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/sw/source/core/unocore/unomap.cxx?rev=1555112&r1=1555111&r2=1555112&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/sw/source/core/unocore/unomap.cxx (original)
+++ openoffice/branches/rejuvenate01/main/sw/source/core/unocore/unomap.cxx Fri Jan  3 14:44:44 2014
@@ -1934,21 +1934,25 @@ const SfxItemPropertyMapEntry* SwUnoProp
                 aMapEntriesArr[nPropertyId] = aHiddenTxtFieldPropMap;
 			}
 			break;
-			case PROPERTY_MAP_FLDTYP_ANNOTATION            :
-			{
-                static SfxItemPropertyMapEntry aAnnotationFieldPropMap [] =
-				{
-					{SW_PROP_NMID(UNO_NAME_AUTHOR),	FIELD_PROP_PAR1, 	CPPU_E2T(CPPUTYPE_OUSTRING),   PROPERTY_NONE, 0},
-					{SW_PROP_NMID(UNO_NAME_CONTENT),	FIELD_PROP_PAR2, 	CPPU_E2T(CPPUTYPE_OUSTRING),   PROPERTY_NONE, 0},
-					{SW_PROP_NMID(UNO_NAME_DATE_TIME_VALUE), 	FIELD_PROP_DATE_TIME, 	CPPU_E2T(CPPUTYPE_DATETIME), 	PROPERTY_NONE, 0},
-                    {SW_PROP_NMID(UNO_NAME_DATE),    FIELD_PROP_DATE,   CPPU_E2T(CPPUTYPE_DATE),    PROPERTY_NONE, 0},
-                    {SW_PROP_NMID(UNO_NAME_TEXT_RANGE), FIELD_PROP_TEXT, CPPU_E2T(CPPUTYPE_REFINTERFACE),  PropertyAttribute::READONLY,    0},
-                    COMMON_FLDTYP_PROPERTIES
-                    {0,0,0,0,0,0}
-				};
-                aMapEntriesArr[nPropertyId] = aAnnotationFieldPropMap;
-			}
-			break;
+
+            case PROPERTY_MAP_FLDTYP_ANNOTATION            :
+                {
+                    static SfxItemPropertyMapEntry aAnnotationFieldPropMap [] =
+                    {
+                        {SW_PROP_NMID(UNO_NAME_AUTHOR),	FIELD_PROP_PAR1, 	CPPU_E2T(CPPUTYPE_OUSTRING),   PROPERTY_NONE, 0},
+                        {SW_PROP_NMID(UNO_NAME_CONTENT),	FIELD_PROP_PAR2, 	CPPU_E2T(CPPUTYPE_OUSTRING),   PROPERTY_NONE, 0},
+                        {SW_PROP_NMID(UNO_NAME_INITIALS),   FIELD_PROP_PAR3,    CPPU_E2T(CPPUTYPE_OUSTRING),   PROPERTY_NONE, 0},
+                        {SW_PROP_NMID(UNO_NAME_NAME),       FIELD_PROP_PAR4,    CPPU_E2T(CPPUTYPE_OUSTRING),   PROPERTY_NONE, 0},
+                        {SW_PROP_NMID(UNO_NAME_DATE_TIME_VALUE), 	FIELD_PROP_DATE_TIME, 	CPPU_E2T(CPPUTYPE_DATETIME), 	PROPERTY_NONE, 0},
+                        {SW_PROP_NMID(UNO_NAME_DATE),    FIELD_PROP_DATE,   CPPU_E2T(CPPUTYPE_DATE),    PROPERTY_NONE, 0},
+                        {SW_PROP_NMID(UNO_NAME_TEXT_RANGE), FIELD_PROP_TEXT, CPPU_E2T(CPPUTYPE_REFINTERFACE),  PropertyAttribute::READONLY,    0},
+                        COMMON_FLDTYP_PROPERTIES
+                        {0,0,0,0,0,0}
+                    };
+                    aMapEntriesArr[nPropertyId] = aAnnotationFieldPropMap;
+                }
+                break;
+
 			case PROPERTY_MAP_FLDTYP_INPUT:
 			{
                 static SfxItemPropertyMapEntry aInputFieldPropMap      [] =

Modified: openoffice/branches/rejuvenate01/main/sw/source/core/unocore/unoport.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/sw/source/core/unocore/unoport.cxx?rev=1555112&r1=1555111&r2=1555112&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/sw/source/core/unocore/unoport.cxx (original)
+++ openoffice/branches/rejuvenate01/main/sw/source/core/unocore/unoport.cxx Fri Jan  3 14:44:44 2014
@@ -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/branches/rejuvenate01/main/sw/source/core/unocore/unoportenum.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/sw/source/core/unocore/unoportenum.cxx?rev=1555112&r1=1555111&r2=1555112&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/sw/source/core/unocore/unoportenum.cxx (original)
+++ openoffice/branches/rejuvenate01/main/sw/source/core/unocore/unoportenum.cxx Fri Jan  3 14:44:44 2014
@@ -27,9 +27,8 @@
 
 #include <unoport.hxx>
 #include <IMark.hxx>
-// --> OD 2007-10-23 #i81002#
 #include <crossrefbookmark.hxx>
-// <--
+#include <annotationmark.hxx>
 #include <doc.hxx>
 #include <txatbase.hxx>
 #include <txtatr.hxx>
@@ -55,6 +54,11 @@
 #include <unoidx.hxx>
 #include <redline.hxx>
 #include <crsskip.hxx>
+#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>
@@ -101,7 +105,7 @@ namespace
         , aPosition ( rPosition )
         {
         }
-        sal_uLong getIndex ()
+        xub_StrLen getIndex ()
         {
             return aPosition.nContent.GetIndex();
         }
@@ -195,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
@@ -329,9 +413,10 @@ throw( container::NoSuchElementException
 
 typedef ::std::deque< xub_StrLen > FieldMarks_t;
 
-static void
-lcl_FillFieldMarkArray(FieldMarks_t & rFieldMarks, SwUnoCrsr const & rUnoCrsr,
-        const sal_Int32 i_nStartPos)
+static void lcl_FillFieldMarkArray(
+    FieldMarks_t & rFieldMarks,
+    SwUnoCrsr const & rUnoCrsr,
+    const sal_Int32 i_nStartPos)
 {
     const SwTxtNode * const pTxtNode =
         rUnoCrsr.GetPoint()->nNode.GetNode().GetTxtNode();
@@ -371,44 +456,55 @@ lcl_ExportFieldMark(
     if (CH_TXT_ATR_FIELDSTART == Char)
     {
         ::sw::mark::IFieldmark* pFieldmark = NULL;
-        if (pDoc)
+        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);
+        SwXTextPortion* pPortion =
+            new SwXTextPortion( pUnoCrsr, i_xParentText, PORTION_FIELD_START );
         xRef = pPortion;
-        if (pPortion && pFieldmark && pDoc)
-            pPortion->SetBookmark(new SwXFieldmark(false, pFieldmark, pDoc));
+        if ( pPortion != NULL
+             && pFieldmark != NULL
+             && pDoc != NULL )
+        {
+            pPortion->SetBookmark( SwXFieldmark::CreateXFieldmark( *pDoc, *pFieldmark ) );
+        }
     }
     else if (CH_TXT_ATR_FIELDEND == Char)
     {
         ::sw::mark::IFieldmark* pFieldmark = NULL;
-        if (pDoc)
+        if ( pDoc != NULL )
         {
-            pFieldmark = pDoc->getIDocumentMarkAccess()->
-                getFieldmarkFor(*pUnoCrsr->GetMark());
+            pFieldmark =
+                pDoc->getIDocumentMarkAccess()->getFieldmarkFor(*pUnoCrsr->GetMark());
         }
-        SwXTextPortion* pPortion = new SwXTextPortion(
-            pUnoCrsr, i_xParentText, PORTION_FIELD_END);
+        SwXTextPortion* pPortion =
+            new SwXTextPortion( pUnoCrsr, i_xParentText, PORTION_FIELD_END );
         xRef = pPortion;
-        if (pPortion && pFieldmark && pDoc)
-            pPortion->SetBookmark(new SwXFieldmark(false, pFieldmark, pDoc));
+        if ( pPortion != NULL
+             && pFieldmark != NULL
+             && pDoc != NULL )
+        {
+            pPortion->SetBookmark( SwXFieldmark::CreateXFieldmark( *pDoc, *pFieldmark ) );
+        }
     }
     else if (CH_TXT_ATR_FORMELEMENT == Char)
     {
         ::sw::mark::IFieldmark* pFieldmark = NULL;
-        if (pDoc)
+        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);
+        SwXTextPortion* pPortion =
+            new SwXTextPortion( pUnoCrsr, i_xParentText, PORTION_FIELD_START_END );
         xRef = pPortion;
-        if (pPortion && pFieldmark && pDoc)
-            pPortion->SetBookmark(new SwXFieldmark(true, pFieldmark, pDoc));
+        if ( pPortion != NULL
+             && pFieldmark != NULL
+             && pDoc != NULL )
+        {
+            pPortion->SetBookmark( SwXFieldmark::CreateXFieldmark( *pDoc, *pFieldmark ) );
+        }
     }
     else
     {
@@ -522,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) ||
@@ -560,8 +655,8 @@ lcl_ExportBookmark(
             rPortions.push_back(pPortion);
             pPortion->SetBookmark(pPtr->xBookmark);
         }
-		rBkmArr.erase( aIter++ );
-	}
+        rBkmArr.erase( aIter++ );
+    }
 }
 
 static void
@@ -569,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();
@@ -611,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();
@@ -744,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());
@@ -764,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)
                     {
@@ -914,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();
@@ -940,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();
@@ -981,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();
@@ -994,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
@@ -1028,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);
@@ -1048,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,
@@ -1076,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 )
@@ -1104,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;
@@ -1129,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) );
 
@@ -1175,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
@@ -1215,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/branches/rejuvenate01/main/sw/source/core/unocore/unoprnms.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/sw/source/core/unocore/unoprnms.cxx?rev=1555112&r1=1555111&r2=1555112&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/sw/source/core/unocore/unoprnms.cxx (original)
+++ openoffice/branches/rejuvenate01/main/sw/source/core/unocore/unoprnms.cxx Fri Jan  3 14:44:44 2014
@@ -777,7 +777,8 @@ const SwPropNameTab aPropNameTab = {
 /* 0739 UNO_NAME_NESTED_TEXT_CONTENT */ {MAP_CHAR_LEN("NestedTextContent")},
 /* 0740 UNO_NAME_EMBEDDED_OBJECT */ {MAP_CHAR_LEN("EmbeddedObject")},
 /* 0741 UNO_NAME_REPLACEMENT_GRAPHIC_URL */ {MAP_CHAR_LEN("ReplacementGraphicURL")},
-/* 0742 UNO_NAME_DEFAULT_PAGE_MODE */	 {MAP_CHAR_LEN("DefaultPageMode")}
+/* 0742 UNO_NAME_DEFAULT_PAGE_MODE */	 {MAP_CHAR_LEN("DefaultPageMode")},
+/* 0743 UNO_NAME_INITIALS */            {MAP_CHAR_LEN("Initials")}
 };
 
 const SwPropNameLen& SwGetPropName( sal_uInt16 nId )

Modified: openoffice/branches/rejuvenate01/main/sw/source/core/unocore/unotext.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/sw/source/core/unocore/unotext.cxx?rev=1555112&r1=1555111&r2=1555112&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/sw/source/core/unocore/unotext.cxx (original)
+++ openoffice/branches/rejuvenate01/main/sw/source/core/unocore/unotext.cxx Fri Jan  3 14:44:44 2014
@@ -622,9 +622,16 @@ throw (lang::IllegalArgumentException, u
         ::sw::UnoTunnelGetImplementation<SwXReferenceMark>(xContentTunnel);
     SwXMeta *const pMeta =
         ::sw::UnoTunnelGetImplementation<SwXMeta>(xContentTunnel);
+    SwXTextField* pTextField =
+        ::sw::UnoTunnelGetImplementation<SwXTextField>(xContentTunnel);
+    if ( pTextField
+         && pTextField->GetServiceId() != SW_SERVICE_FIELDTYPE_ANNOTATION )
+    {
+        pTextField = 0;
+    }
 
-    const bool bAttribute = pBookmark || pDocumentIndexMark
-        || pSection || pReferenceMark || pMeta;
+    const bool bAttribute =
+        pBookmark || pDocumentIndexMark || pSection || pReferenceMark || pMeta || pTextField;
 
     if (bAbsorb && !bAttribute)
     {

Modified: openoffice/branches/rejuvenate01/main/sw/source/core/view/vprint.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/sw/source/core/view/vprint.cxx?rev=1555112&r1=1555111&r2=1555112&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/sw/source/core/view/vprint.cxx (original)
+++ openoffice/branches/rejuvenate01/main/sw/source/core/view/vprint.cxx Fri Jan  3 14:44:44 2014
@@ -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/branches/rejuvenate01/main/sw/source/filter/ascii/ascatr.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/sw/source/filter/ascii/ascatr.cxx?rev=1555112&r1=1555111&r2=1555112&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/sw/source/filter/ascii/ascatr.cxx (original)
+++ openoffice/branches/rejuvenate01/main/sw/source/filter/ascii/ascatr.cxx Fri Jan  3 14:44:44 2014
@@ -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/branches/rejuvenate01/main/sw/source/filter/html/css1atr.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/sw/source/filter/html/css1atr.cxx?rev=1555112&r1=1555111&r2=1555112&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/sw/source/filter/html/css1atr.cxx (original)
+++ openoffice/branches/rejuvenate01/main/sw/source/filter/html/css1atr.cxx Fri Jan  3 14:44:44 2014
@@ -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/branches/rejuvenate01/main/sw/source/filter/html/htmlatr.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/sw/source/filter/html/htmlatr.cxx?rev=1555112&r1=1555111&r2=1555112&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/sw/source/filter/html/htmlatr.cxx (original)
+++ openoffice/branches/rejuvenate01/main/sw/source/filter/html/htmlatr.cxx Fri Jan  3 14:44:44 2014
@@ -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/branches/rejuvenate01/main/sw/source/filter/html/htmlfld.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/sw/source/filter/html/htmlfld.cxx?rev=1555112&r1=1555111&r2=1555112&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/sw/source/filter/html/htmlfld.cxx (original)
+++ openoffice/branches/rejuvenate01/main/sw/source/filter/html/htmlfld.cxx Fri Jan  3 14:44:44 2014
@@ -615,51 +615,55 @@ void SwHTMLParser::InsertCommentText( co
 
 void SwHTMLParser::InsertComment( const String& rComment, const sal_Char *pTag )
 {
-	String aComment( rComment );
-	if( pTag )
-	{
-		aComment.AppendAscii( "</" );
-		aComment.AppendAscii( pTag );
-		aComment.Append( '>' );
-	}
-
-	// MIB 24.06.97: Wenn ein PostIt nach einen Space eingefuegt
-	// werden soll, fuegen wir es vor dem Space ein. Dann gibt es
-	// weniger Probleme beim Formatieren (bug #40483#)
-	xub_StrLen nPos = pPam->GetPoint()->nContent.GetIndex();
-	SwTxtNode *pTxtNd = pPam->GetNode()->GetTxtNode();
-	sal_Bool bMoveFwd = sal_False;
-	if( nPos>0 && pTxtNd && ' '==pTxtNd->GetTxt().GetChar(nPos-1) )
-	{
-		bMoveFwd = sal_True;
-
-		sal_uLong nNodeIdx = pPam->GetPoint()->nNode.GetIndex();
-		xub_StrLen nIdx = pPam->GetPoint()->nContent.GetIndex();
-		for( sal_uInt16 i = aSetAttrTab.Count(); i > 0; )
-		{
-			_HTMLAttr *pAttr = aSetAttrTab[--i];
-			if( pAttr->GetSttParaIdx() != nNodeIdx ||
-				pAttr->GetSttCnt() != nIdx )
-				break;
-
-			if( RES_TXTATR_FIELD == pAttr->pItem->Which() &&
-				RES_SCRIPTFLD == ((const SwFmtFld *)pAttr->pItem)->GetField()->GetTyp()->Which() )
-			{
-				bMoveFwd = sal_False;
-				break;
-			}
-		}
-
-		if( bMoveFwd )
-			pPam->Move( fnMoveBackward );
-	}
-
-	SwPostItField aPostItFld(
-					(SwPostItFieldType*)pDoc->GetSysFldType( RES_POSTITFLD ),
-					aEmptyStr, aComment, DateTime() );
-	InsertAttr( SwFmtFld( aPostItFld ) );
+    String aComment( rComment );
+    if( pTag )
+    {
+        aComment.AppendAscii( "</" );
+        aComment.AppendAscii( pTag );
+        aComment.Append( '>' );
+    }
+
+    // MIB 24.06.97: Wenn ein PostIt nach einen Space eingefuegt
+    // werden soll, fuegen wir es vor dem Space ein. Dann gibt es
+    // weniger Probleme beim Formatieren (bug #40483#)
+    xub_StrLen nPos = pPam->GetPoint()->nContent.GetIndex();
+    SwTxtNode *pTxtNd = pPam->GetNode()->GetTxtNode();
+    sal_Bool bMoveFwd = sal_False;
+    if( nPos>0 && pTxtNd && ' '==pTxtNd->GetTxt().GetChar(nPos-1) )
+    {
+        bMoveFwd = sal_True;
+
+        sal_uLong nNodeIdx = pPam->GetPoint()->nNode.GetIndex();
+        xub_StrLen nIdx = pPam->GetPoint()->nContent.GetIndex();
+        for( sal_uInt16 i = aSetAttrTab.Count(); i > 0; )
+        {
+            _HTMLAttr *pAttr = aSetAttrTab[--i];
+            if( pAttr->GetSttParaIdx() != nNodeIdx ||
+                pAttr->GetSttCnt() != nIdx )
+                break;
+
+            if( RES_TXTATR_FIELD == pAttr->pItem->Which() &&
+                RES_SCRIPTFLD == ((const SwFmtFld *)pAttr->pItem)->GetField()->GetTyp()->Which() )
+            {
+                bMoveFwd = sal_False;
+                break;
+            }
+        }
+
+        if( bMoveFwd )
+            pPam->Move( fnMoveBackward );
+    }
+
+    SwPostItField aPostItFld(
+        (SwPostItFieldType*)pDoc->GetSysFldType( RES_POSTITFLD ),
+        aComment,
+        aEmptyStr,
+        aEmptyStr,
+        aEmptyStr,
+        DateTime() );
+    InsertAttr( SwFmtFld( aPostItFld ) );
 
-	if( bMoveFwd )
-		pPam->Move( fnMoveForward );
+    if( bMoveFwd )
+        pPam->Move( fnMoveForward );
 }
 

Modified: openoffice/branches/rejuvenate01/main/sw/source/filter/html/htmlgrin.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/sw/source/filter/html/htmlgrin.cxx?rev=1555112&r1=1555111&r2=1555112&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/sw/source/filter/html/htmlgrin.cxx (original)
+++ openoffice/branches/rejuvenate01/main/sw/source/filter/html/htmlgrin.cxx Fri Jan  3 14:44:44 2014
@@ -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;



Mime
View raw message