You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by or...@apache.org on 2013/12/18 13:36:26 UTC

svn commit: r1551920 [3/5] - in /openoffice/branches/ooxml-osba/main: sw/ sw/inc/ sw/source/core/access/ sw/source/core/bastyp/ sw/source/core/crsr/ sw/source/core/doc/ sw/source/core/docnode/ sw/source/core/edit/ sw/source/core/fields/ sw/source/core/...

Modified: openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unofield.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unofield.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unofield.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unofield.cxx Wed Dec 18 12:36:23 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/branches/ooxml-osba/main/sw/source/core/unocore/unoport.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unoport.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unoport.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unoport.cxx Wed Dec 18 12:36:23 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/branches/ooxml-osba/main/sw/source/core/unocore/unoportenum.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unoportenum.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unoportenum.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unoportenum.cxx Wed Dec 18 12:36:23 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/branches/ooxml-osba/main/sw/source/core/view/vprint.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/view/vprint.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/view/vprint.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/view/vprint.cxx Wed Dec 18 12:36:23 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/branches/ooxml-osba/main/sw/source/filter/ascii/ascatr.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/filter/ascii/ascatr.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/filter/ascii/ascatr.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/filter/ascii/ascatr.cxx Wed Dec 18 12:36:23 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/branches/ooxml-osba/main/sw/source/filter/html/css1atr.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/filter/html/css1atr.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/filter/html/css1atr.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/filter/html/css1atr.cxx Wed Dec 18 12:36:23 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/branches/ooxml-osba/main/sw/source/filter/html/htmlatr.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/filter/html/htmlatr.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/filter/html/htmlatr.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/filter/html/htmlatr.cxx Wed Dec 18 12:36:23 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/branches/ooxml-osba/main/sw/source/filter/html/htmlgrin.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/filter/html/htmlgrin.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/filter/html/htmlgrin.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/filter/html/htmlgrin.cxx Wed Dec 18 12:36:23 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/branches/ooxml-osba/main/sw/source/filter/html/swhtml.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/filter/html/swhtml.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/filter/html/swhtml.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/filter/html/swhtml.cxx Wed Dec 18 12:36:23 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/branches/ooxml-osba/main/sw/source/filter/html/wrthtml.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/filter/html/wrthtml.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/filter/html/wrthtml.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/filter/html/wrthtml.cxx Wed Dec 18 12:36:23 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/branches/ooxml-osba/main/sw/source/filter/writer/writer.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/filter/writer/writer.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/filter/writer/writer.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/filter/writer/writer.cxx Wed Dec 18 12:36:23 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/branches/ooxml-osba/main/sw/source/filter/ww1/fltshell.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/filter/ww1/fltshell.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/filter/ww1/fltshell.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/filter/ww1/fltshell.cxx Wed Dec 18 12:36:23 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/branches/ooxml-osba/main/sw/source/filter/ww8/attributeoutputbase.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/attributeoutputbase.hxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/attributeoutputbase.hxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/attributeoutputbase.hxx Wed Dec 18 12:36:23 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/branches/ooxml-osba/main/sw/source/filter/ww8/wrtw8nds.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/wrtw8nds.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/wrtw8nds.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/wrtw8nds.cxx Wed Dec 18 12:36:23 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/branches/ooxml-osba/main/sw/source/filter/ww8/ww8atr.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/ww8atr.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/ww8atr.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/ww8atr.cxx Wed Dec 18 12:36:23 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/branches/ooxml-osba/main/sw/source/filter/ww8/ww8par.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/ww8par.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/ww8par.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/ww8par.cxx Wed Dec 18 12:36:23 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/branches/ooxml-osba/main/sw/source/ui/dialog/uiregionsw.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/ui/dialog/uiregionsw.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/ui/dialog/uiregionsw.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/ui/dialog/uiregionsw.cxx Wed Dec 18 12:36:23 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/branches/ooxml-osba/main/sw/source/ui/dochdl/swdtflvr.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/ui/dochdl/swdtflvr.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/ui/dochdl/swdtflvr.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/ui/dochdl/swdtflvr.cxx Wed Dec 18 12:36:23 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/branches/ooxml-osba/main/sw/source/ui/docvw/AnnotationWin.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/ui/docvw/AnnotationWin.cxx?rev=1551920&r1=1551919&r2=1551920&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/ui/docvw/AnnotationWin.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/ui/docvw/AnnotationWin.cxx Wed Dec 18 12:36:23 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;

Added: openoffice/branches/ooxml-osba/main/sw/source/ui/docvw/OverlayRanges.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/ui/docvw/OverlayRanges.cxx?rev=1551920&view=auto
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/ui/docvw/OverlayRanges.cxx (added)
+++ openoffice/branches/ooxml-osba/main/sw/source/ui/docvw/OverlayRanges.cxx Wed Dec 18 12:36:23 2013
@@ -0,0 +1,190 @@
+/**************************************************************
+* 
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+* 
+*   http://www.apache.org/licenses/LICENSE-2.0
+* 
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+* 
+*************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <OverlayRanges.hxx>
+#include <view.hxx>
+#include <svx/sdrpaintwindow.hxx>
+#include <svx/svdview.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace
+{
+    // combine ranges geometrically to a single, ORed polygon
+    basegfx::B2DPolyPolygon impCombineRangesToPolyPolygon(const std::vector< basegfx::B2DRange >& rRanges)
+    {
+        const sal_uInt32 nCount(rRanges.size());
+        basegfx::B2DPolyPolygon aRetval;
+
+        for(sal_uInt32 a(0); a < nCount; a++)
+        {
+            const basegfx::B2DPolygon aDiscretePolygon(basegfx::tools::createPolygonFromRect(rRanges[a]));
+
+            if(0 == a)
+            {
+                aRetval.append(aDiscretePolygon);
+            }
+            else
+            {
+                aRetval = basegfx::tools::solvePolygonOperationOr(aRetval, basegfx::B2DPolyPolygon(aDiscretePolygon));
+            }
+        }
+
+        return aRetval;
+    }
+}
+
+namespace sw
+{
+    namespace overlay
+    {
+        drawinglayer::primitive2d::Primitive2DSequence OverlayRanges::createOverlayObjectPrimitive2DSequence()
+        {
+            const sal_uInt32 nCount(getRanges().size());
+            drawinglayer::primitive2d::Primitive2DSequence aRetval;
+            aRetval.realloc(nCount);
+            for ( sal_uInt32 a = 0; a < nCount; ++a )
+            {
+                const basegfx::BColor aRGBColor(getBaseColor().getBColor());
+                const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(maRanges[a]));
+                aRetval[a] = drawinglayer::primitive2d::Primitive2DReference(
+                    new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
+                    basegfx::B2DPolyPolygon(aPolygon),
+                    aRGBColor));
+            }
+            // embed all rectangles in transparent paint
+            const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
+            const sal_uInt16 nTransparence( aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() );
+            const double fTransparence( nTransparence / 100.0 );
+            const drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparence(
+                new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(
+                aRetval,
+                fTransparence));
+
+            if ( mbShowSolidBorder )
+            {
+                const basegfx::BColor aRGBColor(getBaseColor().getBColor());
+                const basegfx::B2DPolyPolygon aPolyPolygon(impCombineRangesToPolyPolygon(getRanges()));
+                const drawinglayer::primitive2d::Primitive2DReference aOutline(
+                    new drawinglayer::primitive2d::PolyPolygonHairlinePrimitive2D(
+                    aPolyPolygon,
+                    aRGBColor));
+
+                aRetval.realloc(2);
+                aRetval[0] = aUnifiedTransparence;
+                aRetval[1] = aOutline;
+            }
+            else
+            {
+                aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedTransparence, 1);
+            }
+
+            return aRetval;
+        }
+
+        /*static*/ OverlayRanges* OverlayRanges::CreateOverlayRange(
+            SwView& rDocView,
+            const Color& rColor,
+            const std::vector< basegfx::B2DRange >& rRanges,
+            const bool bShowSolidBorder )
+        {
+            OverlayRanges* pOverlayRanges = NULL;
+
+            SdrView* pView = rDocView.GetDrawView();
+            if ( pView != NULL )
+            {
+                SdrPaintWindow* pCandidate = pView->GetPaintWindow(0);
+                sdr::overlay::OverlayManager* pTargetOverlay = pCandidate->GetOverlayManager();
+
+                if ( pTargetOverlay != NULL )
+                {
+                    pOverlayRanges = new sw::overlay::OverlayRanges( rColor, rRanges, bShowSolidBorder );
+                    pTargetOverlay->add( *pOverlayRanges );
+                }
+            }
+
+            return pOverlayRanges;
+        }
+
+        OverlayRanges::OverlayRanges(
+            const Color& rColor,
+            const std::vector< basegfx::B2DRange >& rRanges,
+            const bool bShowSolidBorder )
+            : sdr::overlay::OverlayObject( rColor )
+            , maRanges( rRanges )
+            , mbShowSolidBorder( bShowSolidBorder )
+        {
+            // no AA for highlight overlays
+            allowAntiAliase(false);
+        }
+
+        OverlayRanges::~OverlayRanges()
+        {
+            if( getOverlayManager() )
+            {
+                getOverlayManager()->remove(*this);
+            }
+        }
+
+        void OverlayRanges::setRanges(const std::vector< basegfx::B2DRange >& rNew)
+        {
+            if(rNew != maRanges)
+            {
+                maRanges = rNew;
+                objectChange();
+            }
+        }
+
+
+        void OverlayRanges::ShowSolidBorder()
+        {
+            if ( !mbShowSolidBorder )
+            {
+                mbShowSolidBorder = true;
+                objectChange();
+            }
+        }
+
+        void OverlayRanges::HideSolidBorder()
+        {
+            if ( mbShowSolidBorder )
+            {
+                mbShowSolidBorder = false;
+                objectChange();
+            }
+        }
+
+    } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof

Propchange: openoffice/branches/ooxml-osba/main/sw/source/ui/docvw/OverlayRanges.cxx
------------------------------------------------------------------------------
    svn:executable = *

Added: openoffice/branches/ooxml-osba/main/sw/source/ui/docvw/OverlayRanges.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/ui/docvw/OverlayRanges.hxx?rev=1551920&view=auto
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/ui/docvw/OverlayRanges.hxx (added)
+++ openoffice/branches/ooxml-osba/main/sw/source/ui/docvw/OverlayRanges.hxx Wed Dec 18 12:36:23 2013
@@ -0,0 +1,86 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+
+
+#ifndef _SW_OVERLAY_OVERLAYRANGES_HXX
+#define _SW_OVERLAY_OVERLAYRANGES_HXX
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+#include <basegfx/range/b2drange.hxx>
+
+#include <vector>
+
+class SwView;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sw
+{
+    namespace overlay
+    {
+        class OverlayRanges : public sdr::overlay::OverlayObject
+        {
+        protected:
+            // geometry of overlay
+            std::vector< basegfx::B2DRange > maRanges;
+
+            bool mbShowSolidBorder;
+
+            // geometry creation for OverlayObject
+            virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
+
+        public:
+            static OverlayRanges* CreateOverlayRange( 
+                SwView& rDocView,
+                const Color& rColor,
+                const std::vector< basegfx::B2DRange >& rRanges,
+                const bool bShowSolidBorder );
+
+            virtual ~OverlayRanges();
+
+            // data read access
+            inline const std::vector< basegfx::B2DRange >& getRanges() const
+            {
+                return maRanges;
+            }
+
+            // data write access
+            void setRanges(const std::vector< basegfx::B2DRange >& rNew);
+
+            void ShowSolidBorder();
+            void HideSolidBorder();
+
+        private:
+            OverlayRanges(
+                const Color& rColor,
+                const std::vector< basegfx::B2DRange >& rRanges,
+                const bool bShowSolidBorder );
+
+        };
+    } // end of namespace overlay
+} // end of namespace sw
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SW_OVERLAY_OVERLAYRANGES_HXX
+
+// eof

Propchange: openoffice/branches/ooxml-osba/main/sw/source/ui/docvw/OverlayRanges.hxx
------------------------------------------------------------------------------
    svn:executable = *