openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From o..@apache.org
Subject svn commit: r1546391 [1/2] - in /openoffice/branches/ooxml-osba/main: offapi/com/sun/star/text/textfield/ sw/inc/ sw/source/core/crsr/ sw/source/core/doc/ sw/source/core/fields/ sw/source/core/inc/ sw/source/core/text/ sw/source/core/unocore/ sw/source...
Date Thu, 28 Nov 2013 16:01:26 GMT
Author: orw
Date: Thu Nov 28 16:01:25 2013
New Revision: 1546391

URL: http://svn.apache.org/r1546391
Log:
123771: integration of OSBA OOXML improvement project's use case 4 patches

	changes for RTF filter, for *.docx export and for *.xslx export are not usable as they base on code which is not available

        Patch by: SUSE, Miklos Vajna <vmiklos@suse.cz>
        Review by: Oliver <orw@apache.org>


Modified:
    openoffice/branches/ooxml-osba/main/offapi/com/sun/star/text/textfield/Annotation.idl
    openoffice/branches/ooxml-osba/main/sw/inc/PostItMgr.hxx
    openoffice/branches/ooxml-osba/main/sw/inc/docufld.hxx
    openoffice/branches/ooxml-osba/main/sw/inc/unofield.hxx
    openoffice/branches/ooxml-osba/main/sw/inc/unoprnms.hxx
    openoffice/branches/ooxml-osba/main/sw/source/core/crsr/bookmrk.cxx
    openoffice/branches/ooxml-osba/main/sw/source/core/doc/docbm.cxx
    openoffice/branches/ooxml-osba/main/sw/source/core/doc/docedt.cxx
    openoffice/branches/ooxml-osba/main/sw/source/core/fields/docufld.cxx
    openoffice/branches/ooxml-osba/main/sw/source/core/inc/bookmrk.hxx
    openoffice/branches/ooxml-osba/main/sw/source/core/text/EnhancedPDFExportHelper.cxx
    openoffice/branches/ooxml-osba/main/sw/source/core/text/inftxt.cxx
    openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unofield.cxx
    openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unomap.cxx
    openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unoportenum.cxx
    openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unoprnms.cxx
    openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unotext.cxx
    openoffice/branches/ooxml-osba/main/sw/source/filter/html/htmlfld.cxx
    openoffice/branches/ooxml-osba/main/sw/source/filter/html/swhtml.cxx
    openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/attributeoutputbase.hxx
    openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/docxattributeoutput.cxx
    openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/docxattributeoutput.hxx
    openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/rtfattributeoutput.cxx
    openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/wrtw8nds.cxx
    openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/wrtw8sty.cxx
    openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/wrtww8.hxx
    openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/ww8par.cxx
    openoffice/branches/ooxml-osba/main/sw/source/ui/fldui/fldmgr.cxx
    openoffice/branches/ooxml-osba/main/sw/source/ui/inc/fldmgr.hxx
    openoffice/branches/ooxml-osba/main/sw/source/ui/inc/wrtsh.hxx
    openoffice/branches/ooxml-osba/main/sw/source/ui/shells/textfld.cxx
    openoffice/branches/ooxml-osba/main/sw/source/ui/wrtsh/wrtsh2.cxx
    openoffice/branches/ooxml-osba/main/writerfilter/source/dmapper/DomainMapper.cxx
    openoffice/branches/ooxml-osba/main/writerfilter/source/dmapper/DomainMapper_Impl.cxx
    openoffice/branches/ooxml-osba/main/writerfilter/source/dmapper/DomainMapper_Impl.hxx
    openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/model.xml
    openoffice/branches/ooxml-osba/main/xmloff/inc/txtflde.hxx
    openoffice/branches/ooxml-osba/main/xmloff/inc/txtfldi.hxx
    openoffice/branches/ooxml-osba/main/xmloff/inc/xmloff/odffields.hxx
    openoffice/branches/ooxml-osba/main/xmloff/inc/xmloff/txtimp.hxx
    openoffice/branches/ooxml-osba/main/xmloff/inc/xmloff/xmltoken.hxx
    openoffice/branches/ooxml-osba/main/xmloff/source/core/xmltoken.cxx
    openoffice/branches/ooxml-osba/main/xmloff/source/text/txtflde.cxx
    openoffice/branches/ooxml-osba/main/xmloff/source/text/txtfldi.cxx
    openoffice/branches/ooxml-osba/main/xmloff/source/text/txtimp.cxx
    openoffice/branches/ooxml-osba/main/xmloff/source/text/txtparae.cxx

Modified: openoffice/branches/ooxml-osba/main/offapi/com/sun/star/text/textfield/Annotation.idl
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/offapi/com/sun/star/text/textfield/Annotation.idl?rev=1546391&r1=1546390&r2=1546391&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/offapi/com/sun/star/text/textfield/Annotation.idl (original)
+++ openoffice/branches/ooxml-osba/main/offapi/com/sun/star/text/textfield/Annotation.idl Thu Nov 28 16:01:25 2013
@@ -42,12 +42,27 @@ published service Annotation
     /** contains the name of the author of the annotation.
      */
     [property]string Author;
+
+    /** contains the initials of the author of the annotation.
+
+        @since Apache OpenOffice 4.1
+     */
+    [optional, property]string Initials;
+
+    /** contains the name of the annotation.
+
+        @since Apache OpenOffice 4.1
+     */
+    [optional, property]string Name;
+
     /** contains the annotation's content
      */
     [property]string Content;
+
     /** contains the creation date.
      */
     [property]com::sun::star::util::Date Date;
+
     /** contains the creation date.
      */
     [optional, property]com::sun::star::util::DateTime DateTimeValue;

Modified: openoffice/branches/ooxml-osba/main/sw/inc/PostItMgr.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/inc/PostItMgr.hxx?rev=1546391&r1=1546390&r2=1546391&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/inc/PostItMgr.hxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/inc/PostItMgr.hxx Thu Nov 28 16:01:25 2013
@@ -268,9 +268,9 @@ class SwPostItMgr: public SfxListener
 
 			void SetSpellChecking();
 
-			Color			GetColorDark(sal_uInt16 aAuthorIndex);
-			Color			GetColorLight(sal_uInt16 aAuthorIndex);
-            Color           GetColorAnchor(sal_uInt16 aAuthorIndex);
+            static Color GetColorDark(sal_uInt16 aAuthorIndex);
+            static Color GetColorLight(sal_uInt16 aAuthorIndex);
+            static Color GetColorAnchor(sal_uInt16 aAuthorIndex);
 
 
 			void				RegisterAnswer(OutlinerParaObject* pAnswer) { mpAnswer = pAnswer;}

Modified: openoffice/branches/ooxml-osba/main/sw/inc/docufld.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/inc/docufld.hxx?rev=1546391&r1=1546390&r2=1546391&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/inc/docufld.hxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/inc/docufld.hxx Thu Nov 28 16:01:25 2013
@@ -508,45 +508,64 @@ public:
 	SwDoc* GetDoc()			{return mpDoc;};
 };
 
-/*--------------------------------------------------------------------
-	Beschreibung: PostIt
- --------------------------------------------------------------------*/
 
+// representation for a comment/an annotation
 class SW_DLLPUBLIC SwPostItField : public SwField
 {
-	String 		sTxt;		// die Anmerkung
-	String 		sAuthor;	// der Author
-	DateTime	aDateTime;	// Datum und Zeit der Anmerkung
-	OutlinerParaObject*	mpText;
-	SwTextAPIObject* m_pTextObject;
-
-public:
-	SwPostItField( SwPostItFieldType*,
-				   const String& rAuthor, const String& rTxt, const DateTime& rDate);
-	~SwPostItField();
-
-	virtual String			Expand() const;
-	virtual SwField*		Copy() const;
-
-	inline const Date 		GetDate() const					{ return aDateTime.GetDate(); }
-	inline const Time 		GetTime() const					{ return aDateTime.GetTime(); }
+    String      msCommentContent;   // content of the comment/annotation
+    String      msAuthor;           // author
+    String      msAuthorInitials;   // author's initials
+    String      msName;             // name (identifier) of the comment/annotation
+    DateTime    maDateTime;         // creation date and time
+
+    OutlinerParaObject*	mpText;
+    SwTextAPIObject* m_pTextObject;
+
+public:
+    SwPostItField(
+        SwPostItFieldType*,
+        const String& rCommentContent,
+        const String& rAuthor,
+        const String& rAuthorInitials,
+        const String& rName,
+        const DateTime& rDate);
+    ~SwPostItField();
+
+    virtual String Expand() const;
+    virtual SwField* Copy() const;
+
+    inline const Date GetDate() const
+    {
+        return maDateTime.GetDate();
+    }
+    inline const Time GetTime() const
+    {
+        return maDateTime.GetTime();
+    }
+
+    // Author
+    virtual const String& 	GetPar1() const;
+    virtual void			SetPar1(const String& rStr);
+
+    // Text
+    virtual String          GetPar2() const;
+    virtual void            SetPar2(const String& rStr);
+    inline const String&    GetContent() const
+    {
+        return msCommentContent;
+    }
+
+    // Name
+    void SetName(const String& rStr);
+    const String& GetName() const;
 
-	// Author
-	virtual const String& 	GetPar1() const;
-	virtual void			SetPar1(const String& rStr);
-
-	// Text
-	virtual String			GetPar2() const;
-	virtual void			SetPar2(const String& rStr);
-	const String&			GetTxt() const { return sTxt; }
-
-	const OutlinerParaObject*	GetTextObject() const;
-	void SetTextObject( OutlinerParaObject* pText );
+    const OutlinerParaObject*	GetTextObject() const;
+    void SetTextObject( OutlinerParaObject* pText );
 
     sal_uInt32 GetNumberOfParagraphs() const;
 
-    virtual sal_Bool        QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
-    virtual sal_Bool        PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+    virtual sal_Bool    QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+    virtual sal_Bool    PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
     virtual String      GetDescription() const;
 };
 

Modified: openoffice/branches/ooxml-osba/main/sw/inc/unofield.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/inc/unofield.hxx?rev=1546391&r1=1546390&r2=1546391&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/inc/unofield.hxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/inc/unofield.hxx Thu Nov 28 16:01:25 2013
@@ -203,6 +203,7 @@ public:
 
     /// @return an SwXTextField, either an already existing one or a new one
     static SwXTextField* CreateSwXTextField(SwDoc & rDoc, SwFmtFld const& rFmt);
+    sal_uInt16 GetServiceId();
 };
 
 

Modified: openoffice/branches/ooxml-osba/main/sw/inc/unoprnms.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/inc/unoprnms.hxx?rev=1546391&r1=1546390&r2=1546391&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/inc/unoprnms.hxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/inc/unoprnms.hxx Thu Nov 28 16:01:25 2013
@@ -716,11 +716,8 @@ enum SwPropNameIds
 // <--
 /* 0675 */  UNO_NAME_NUMBERING_IS_OUTLINE,
 ///* 0676 */  UNO_NAME_DEFAULT_OUTLINE_LEVEL,	//#outline level, removed by zhaojianwei
-// --> OD 2004-10-28 #i36248#
 /* 0677 */  UNO_NAME_STARTPOSITION_IN_HORI_L2R,
 /* 0678 */  UNO_NAME_ENDPOSITION_IN_HORI_L2R,
-// <--
-// --> OS 2004-12-13 #30916#
 /* 0679 */  UNO_NAME_SUBJECT,
 /* 0680 */  UNO_NAME_ADDRESS_FROM_COLUMN,
 /* 0681 */  UNO_NAME_SEND_AS_HTML,
@@ -735,71 +732,51 @@ enum SwPropNameIds
 /* 0690 */  UNO_NAME_BLIND_COPIES_TO,
 /* 0691 */  UNO_NAME_IN_SERVER_PASSWORD,
 /* 0692 */  UNO_NAME_OUT_SERVER_PASSWORD,
-// <--
 /* 0693 */  UNO_NAME_SAVE_FILTER_OPTIONS,
 /* 0694 */  UNO_NAME_SAVE_FILTER_DATA,
 /* 0695 */  UNO_NAME_LOCK_UPDATES,
-// --> TL 2005-02-14 #i37766#
 /* 0696 */  UNO_NAME_PAGE_COUNT,
 /* 0697 */  UNO_NAME_LINE_COUNT,
 /* 0698 */  UNO_NAME_IS_CONSTANT_SPELLCHECK,
 /* 0699 */  UNO_NAME_IS_HIDE_SPELL_MARKS,       // deprecated #i91949
-// <--
 /* 0700 */  UNO_NAME_IS_FIELD_USED,
 /* 0701 */  UNO_NAME_IS_FIELD_DISPLAYED,
 /* 0702 */	UNO_NAME_BUILDID,
 /* 0703 */  UNO_NAME_PARA_STYLE_CONDITIONS,
-// --> FME 2005-12-13 #b6354161# Print empty pages
 /* 0704 */  UNO_NAME_PRINT_EMPTY_PAGES,
-// <--
-// --> BM 2006 New Chart (chart2)
 /* 0705 */  UNO_NAME_ROLE,
-// <--
 /* 0706 */  UNO_NAME_FIELD_CODE,
 /* 0707 */  UNO_NAME_HAS_VALID_SIGNATURES,
-// --> AMA #i65476# automatic styles
 /* 0708 */   UNO_NAME_CHAR_AUTO_STYLE_NAME,
 /* 0709 */   UNO_NAME_PARA_AUTO_STYLE_NAME,
-// --> OD 2006-03-21 #b6375613#
 /* 0710 */  UNO_NAME_APPLY_WORKAROUND_FOR_B6375613,
 /* 0711 */  UNO_NAME_LAYOUT_SIZE,
-// --> HB #144146#
 /* 0712 */  UNO_NAME_HELP,
 /* 0713 */  UNO_NAME_TOOLTIP,
-// --> #i73329# / 2007-01-11 / frank.schoenheit@sun.com
 /* 0714 */  UNO_NAME_DIALOG_LIBRARIES,
 /* 0715 */  UNO_NAME_HEADER_ROW_COUNT,
 /* 0716 */  UNO_NAME_INPUT,
 /* 0717 */  UNO_NAME_ROW_SPAN,
-// --> OD 2008-01-15 #newlistlevelattrs#
 /* 0718 */  UNO_NAME_POSITION_AND_SPACE_MODE,
 /* 0719 */  UNO_NAME_LABEL_FOLLOWED_BY,
 /* 0720 */  UNO_NAME_LISTTAB_STOP_POSITION,
 /* 0721 */  UNO_NAME_FIRST_LINE_INDENT,
 /* 0722 */  UNO_NAME_INDENT_AT,
-// --> #i52420# / 2008-02-07 / beppec56@openoffice.org
 /* 0723 */  UNO_NAME_CHAPTER_LEVEL,
-// --> 2007-03-27 text grid enhancement for better CJK support
 /* 0724 */  UNO_NAME_GRID_BASE_WIDTH,
 /* 0725 */  UNO_NAME_GRID_SNAP_TO_CHARS,
 /* 0726 */  UNO_NAME_GRID_STANDARD_PAGE_MODE,
 /* 0727 */  UNO_NAME_TABLE_BORDER_DISTANCES,
-// --> OD 2008-04-22 #refactorlists#
 /* 0728 */  UNO_NAME_LIST_ID,
 /* 0729 */  UNO_NAME_DEFAULT_LIST_ID,
-// <--
 /* 0730 */  UNO_NAME_STREAM_NAME,
-// --> OD 2008-11-26 #158694#
 /* 0731 */  UNO_NAME_PARA_CONTINUEING_PREVIOUS_SUB_TREE,
 /* 0732 */  UNO_NAME_PARA_LIST_LABEL_STRING,
-// <--
 /* 0733 */  UNO_NAME_CHAR_OVERLINE,
 /* 0734 */  UNO_NAME_CHAR_OVERLINE_COLOR,
 /* 0735 */  UNO_NAME_CHAR_OVERLINE_HAS_COLOR,
 /* 0736 */  UNO_NAME_OUTLINE_LEVEL,  //#outline level,add<-zhaojianwei outlinelevel
-// --> OD 2009-07-13 #i73249#
 /* 0737 */  UNO_NAME_DESCRIPTION,
-// <--
 /* 0738 */  UNO_NAME_META,       // #i91565#
 /* 0739 */  UNO_NAME_NESTED_TEXT_CONTENT, // #i109601#
 /* 0740 */  UNO_NAME_EMBEDDED_OBJECT,
@@ -807,7 +784,9 @@ enum SwPropNameIds
 /* 0741 */	UNO_NAME_REPLACEMENT_GRAPHIC_URL,
 /* 0742 */	UNO_NAME_DEFAULT_PAGE_MODE,
 
-/* 0743 */  SW_PROPNAME_END
+/* 0743 */  UNO_NAME_INITIALS,
+
+/* 0744 */  SW_PROPNAME_END
 };
 
 

Modified: openoffice/branches/ooxml-osba/main/sw/source/core/crsr/bookmrk.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/crsr/bookmrk.cxx?rev=1546391&r1=1546390&r2=1546391&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/crsr/bookmrk.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/crsr/bookmrk.cxx Thu Nov 28 16:01:25 2013
@@ -94,6 +94,37 @@ namespace
         }
         io_pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_UI_REPLACE, NULL);
     };
+
+    static void lcl_RemoveFieldMarks(Fieldmark* const pField,
+        SwDoc* const io_pDoc,
+        const sal_Unicode aStartMark,
+        const sal_Unicode aEndMark)
+    {
+        SwPosition& rStart = pField->GetMarkStart();
+        SwPosition& rEnd = pField->GetMarkEnd();
+        SwTxtNode const*const pStartTxtNode = rStart.nNode.GetNode().GetTxtNode();
+        SwTxtNode const*const pEndTxtNode = rEnd.nNode.GetNode().GetTxtNode();
+        const sal_Unicode ch_start=pStartTxtNode->GetTxt().GetChar(rStart.nContent.GetIndex());
+        xub_StrLen nEndPos = ( rEnd == rStart ||  rEnd.nContent.GetIndex() == 0 ) ?
+            rEnd.nContent.GetIndex() : rEnd.nContent.GetIndex() - 1;
+        const sal_Unicode ch_end=pEndTxtNode->GetTxt().GetChar( nEndPos );
+        SwPaM aStartPaM(rStart);
+        SwPaM aEndPaM(rEnd);
+        io_pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_UI_REPLACE, NULL);
+        if( ch_start == aStartMark )
+        {
+            SwPaM aStart(rStart, rStart);
+            aStart.End()->nContent++;
+            io_pDoc->DeleteRange(aStart);
+        }
+        if ( ch_end == aEndMark )
+        {
+            SwPaM aEnd(rEnd, rEnd);
+            aEnd.Start()->nContent--;
+            io_pDoc->DeleteRange(aEnd);
+        }
+        io_pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_UI_REPLACE, NULL);
+    };
 }
 
 namespace sw { namespace mark
@@ -317,6 +348,11 @@ namespace sw { namespace mark
         lcl_AssureFieldMarksSet(this, io_pDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND);
     }
 
+    void TextFieldmark::ReleaseDoc(SwDoc* const pDoc)
+    {
+        lcl_RemoveFieldMarks(this, pDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND);
+    }
+
     CheckboxFieldmark::CheckboxFieldmark(const SwPaM& rPaM)
         : Fieldmark(rPaM)
     { }

Modified: openoffice/branches/ooxml-osba/main/sw/source/core/doc/docbm.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/doc/docbm.cxx?rev=1546391&r1=1546390&r2=1546391&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/doc/docbm.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/doc/docbm.cxx Thu Nov 28 16:01:25 2013
@@ -440,8 +440,8 @@ namespace sw { namespace mark
         const rtl::OUString& rName,
         const rtl::OUString& rType )
     {
-        sw::mark::IMark* pMark = makeMark( rPaM, rName, 
-                IDocumentMarkAccess::TEXT_FIELDMARK );
+        sw::mark::IMark* pMark =
+            makeMark( rPaM, rName, IDocumentMarkAccess::TEXT_FIELDMARK );
         sw::mark::IFieldmark* pFieldMark = dynamic_cast<sw::mark::IFieldmark*>( pMark );
         pFieldMark->SetFieldname( rType );
 
@@ -620,18 +620,17 @@ namespace sw { namespace mark
                 isPosInRange = true, isOtherPosInRange = true;
             }
 
-            if(isPosInRange && (isOtherPosInRange || !pMark->IsExpanded()))
+            if ( isPosInRange
+                 && ( isOtherPosInRange
+                      || !pMark->IsExpanded() ) )
             {
                 // completely in range
 
-                // --> OD 2009-08-07 #i92125#
                 bool bKeepCrossRefBkmk( false );
                 {
-                    if ( rStt == rEnd &&
-                         ( IDocumentMarkAccess::GetType(*pMark) ==
-                            IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK ||
-                           IDocumentMarkAccess::GetType(*pMark) ==
-                            IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK ) )
+                    if ( rStt == rEnd
+                         && ( IDocumentMarkAccess::GetType(*pMark) == IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK
+                              || IDocumentMarkAccess::GetType(*pMark) == IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK ) )
                     {
                         bKeepCrossRefBkmk = true;
                     }
@@ -642,7 +641,6 @@ namespace sw { namespace mark
                         pSaveBkmk->push_back(SaveBookmark(true, true, *pMark, rStt, pSttIdx));
                     vMarksToDelete.push_back(ppMark);
                 }
-                // <--
             }
             else if(isPosInRange ^ isOtherPosInRange)
             {
@@ -725,6 +723,12 @@ namespace sw { namespace mark
                     "<MarkManager::deleteMark(..)>"
                     " - Bookmark not found.");
                 m_vFieldmarks.erase(ppFieldmark);
+
+                sw::mark::TextFieldmark* pTextFieldmark = dynamic_cast<sw::mark::TextFieldmark*>(ppMark->get());
+                if ( pTextFieldmark )
+                {
+                    pTextFieldmark->ReleaseDoc(m_pDoc);
+                }
                 break;
             }
             case IDocumentMarkAccess::NAVIGATOR_REMINDER:

Modified: openoffice/branches/ooxml-osba/main/sw/source/core/doc/docedt.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/doc/docedt.cxx?rev=1546391&r1=1546390&r2=1546391&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/doc/docedt.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/doc/docedt.cxx Thu Nov 28 16:01:25 2013
@@ -72,6 +72,9 @@
 #include <vcl/msgbox.hxx>
 #include "comcore.hrc"
 #include "editsh.hxx"
+#include <fldbas.hxx>
+#include <fmtfld.hxx>
+#include <docufld.hxx>
 #include <unoflatpara.hxx>
 #include <SwGrammarMarkUp.hxx>
 
@@ -1687,6 +1690,30 @@ bool SwDoc::DeleteRangeImplImpl(SwPaM & 
 		}
 	}
 
+    // Delete fieldmarks before postits, but let's leave them alone during import.
+    if ( GetIDocumentUndoRedo().DoesUndo()
+         && pStt->nNode == pEnd->nNode
+         && (pEnd->nContent.GetIndex() - pStt->nContent.GetIndex()) == 1 )
+    {
+        SwTxtNode* pTxtNd = rPam.Start()->nNode.GetNode().GetTxtNode();
+        xub_StrLen nIndex = rPam.Start()->nContent.GetIndex();
+        // We may have a postit here.
+        if (pTxtNd->GetTxt().GetChar(nIndex) == CH_TXTATR_INWORD)
+        {
+            SwTxtAttr* pTxtAttr = pTxtNd->GetTxtAttrForCharAt(nIndex, RES_TXTATR_FIELD);
+            if ( pTxtAttr != NULL
+                 && pTxtAttr->GetFmtFld().GetField()->Which() == RES_POSTITFLD )
+            {
+                const SwPostItField* pField = dynamic_cast<const SwPostItField*>(pTxtAttr->GetFmtFld().GetField());
+                IDocumentMarkAccess::const_iterator_t ppMark = getIDocumentMarkAccess()->findMark(pField->GetName());
+                if (ppMark != getIDocumentMarkAccess()->getMarksEnd())
+                {
+                    getIDocumentMarkAccess()->deleteMark(ppMark);
+                }
+            }
+        }
+    }
+
 	{
 		// Bug 26675:	DataChanged vorm loeschen verschicken, dann bekommt
 		//			man noch mit, welche Objecte sich im Bereich befinden.

Modified: openoffice/branches/ooxml-osba/main/sw/source/core/fields/docufld.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/fields/docufld.cxx?rev=1546391&r1=1546390&r2=1546391&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/fields/docufld.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/fields/docufld.cxx Thu Nov 28 16:01:25 2013
@@ -1775,34 +1775,42 @@ SwFieldType* SwPostItFieldType::Copy() c
 }
 
 
-/*--------------------------------------------------------------------
-	Beschreibung: SwPostItFieldType
- --------------------------------------------------------------------*/
 
-SwPostItField::SwPostItField( SwPostItFieldType* pT,
-		const String& rAuthor, const String& rTxt, const DateTime& rDateTime )
-	: SwField( pT ), sTxt( rTxt ), sAuthor( rAuthor ), aDateTime( rDateTime ), mpText(0), m_pTextObject(0)
+
+SwPostItField::SwPostItField(
+    SwPostItFieldType* pT,
+    const String& rCommentContent,
+    const String& rAuthor,
+    const String& rAuthorInitials,
+    const String& rName,
+    const DateTime& rDateTime )
+    : SwField( pT )
+    , msCommentContent( rCommentContent )
+    , msAuthor( rAuthor )
+    , msAuthorInitials( rAuthorInitials )
+    , msName( rName )
+    , maDateTime( rDateTime )
+    , mpText(0)
+    , m_pTextObject(0)
 {
 }
 
 
 SwPostItField::~SwPostItField()
 {
-	if ( m_pTextObject )
-	{
-		m_pTextObject->DisposeEditSource();
-		m_pTextObject->release();
-	}
+    if ( m_pTextObject )
+    {
+        m_pTextObject->DisposeEditSource();
+        m_pTextObject->release();
+    }
 
-	delete mpText;
+    delete mpText;
 }
 
-/* ---------------------------------------------------------------------------
 
- ---------------------------------------------------------------------------*/
 String SwPostItField::Expand() const
 {
-	return aEmptyStr;
+    return aEmptyStr;
 }
 
 
@@ -1811,169 +1819,198 @@ String SwPostItField::GetDescription() c
     return SW_RES(STR_NOTE);
 }
 
-/* ---------------------------------------------------------------------------
 
- ---------------------------------------------------------------------------*/
 SwField* SwPostItField::Copy() const
 {
-	SwPostItField* pRet = new SwPostItField( (SwPostItFieldType*)GetTyp(), sAuthor,
-								sTxt, aDateTime);
-	if (mpText)
-		pRet->SetTextObject( new OutlinerParaObject(*mpText) );
-	return pRet;
+    SwPostItField* pRet =
+        new SwPostItField(
+            (SwPostItFieldType*)GetTyp(),
+            msCommentContent,
+            msAuthor,
+            msAuthorInitials,
+            msName,
+            maDateTime);
+    if ( mpText != NULL )
+    {
+        pRet->SetTextObject( new OutlinerParaObject(*mpText) );
+    }
+
+    return pRet;
 }
-/*--------------------------------------------------------------------
-	Beschreibung: Author setzen
- --------------------------------------------------------------------*/
+
 
 void SwPostItField::SetPar1(const String& rStr)
 {
-	sAuthor = rStr;
+    msAuthor = rStr;
 }
 
 const String& SwPostItField::GetPar1() const
 {
-	return sAuthor;
+    return msAuthor;
 }
 
-/*--------------------------------------------------------------------
-	Beschreibung: Text fuers PostIt setzen
- --------------------------------------------------------------------*/
 
 void SwPostItField::SetPar2(const String& rStr)
 {
-	sTxt = rStr;
+    msCommentContent = rStr;
 }
-/* ---------------------------------------------------------------------------
 
- ---------------------------------------------------------------------------*/
 String SwPostItField::GetPar2() const
 {
-		return sTxt;
+    return msCommentContent;
+}
+
+
+void SwPostItField::SetName(const String& rName)
+{
+    msName = rName;
 }
 
+const String& SwPostItField::GetName() const
+{
+    return msName;
+}
+
+
 const OutlinerParaObject* SwPostItField::GetTextObject() const
 {
-	return mpText;
+    return mpText;
 }
 
 void SwPostItField::SetTextObject( OutlinerParaObject* pText )
 {
-	delete mpText;
-	mpText = pText;
+    delete mpText;
+    mpText = pText;
 }
 
+
 sal_uInt32 SwPostItField::GetNumberOfParagraphs() const
 {
     return (mpText) ? mpText->Count() : 1;
 }
 
+
 sal_Bool SwPostItField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
 {
     switch( nWhichId )
-	{
-	case FIELD_PROP_PAR1:
-		rAny <<= OUString(sAuthor);
-		break;
-	case FIELD_PROP_PAR2:
-		{
-		rAny <<= OUString(sTxt);
-		break;
-		}
-	case FIELD_PROP_TEXT:
-		{
-			if ( !m_pTextObject )
-			{
-				SwPostItFieldType* pGetType = (SwPostItFieldType*)GetTyp();
-				SwDoc* pDoc = pGetType->GetDoc();
-				SwTextAPIEditSource* pObj = new SwTextAPIEditSource( pDoc );
-				const_cast <SwPostItField*> (this)->m_pTextObject = new SwTextAPIObject( pObj );
-				m_pTextObject->acquire();
-			}
+    {
+    case FIELD_PROP_PAR1:
+        rAny <<= OUString(msAuthor);
+        break;
+    case FIELD_PROP_PAR2:
+        {
+            rAny <<= OUString(msCommentContent);
+            break;
+        }
+    case FIELD_PROP_PAR3:
+        rAny <<= OUString(msAuthorInitials);
+        break;
+    case FIELD_PROP_PAR4:
+        rAny <<= OUString(msName);
+        break;
+    case FIELD_PROP_TEXT:
+        {
+            if ( !m_pTextObject )
+            {
+                SwPostItFieldType* pGetType = (SwPostItFieldType*)GetTyp();
+                SwDoc* pDoc = pGetType->GetDoc();
+                SwTextAPIEditSource* pObj = new SwTextAPIEditSource( pDoc );
+                const_cast <SwPostItField*> (this)->m_pTextObject = new SwTextAPIObject( pObj );
+                m_pTextObject->acquire();
+            }
 
-			if ( mpText )
-				m_pTextObject->SetText( *mpText );
-			else
-				m_pTextObject->SetString( sTxt );
-
-			uno::Reference < text::XText > xText( m_pTextObject );
-			rAny <<= xText;
-			break;
-		}
-	case FIELD_PROP_DATE:
-		{
-			util::Date aSetDate;
-			aSetDate.Day = aDateTime.GetDay();
-			aSetDate.Month = aDateTime.GetMonth();
-			aSetDate.Year = aDateTime.GetYear();
-			rAny.setValue(&aSetDate, ::getCppuType((util::Date*)0));
-		}
-		break;
-	case FIELD_PROP_DATE_TIME:
-		{
-				util::DateTime DateTimeValue;
-				DateTimeValue.HundredthSeconds = aDateTime.Get100Sec();
-				DateTimeValue.Seconds = aDateTime.GetSec();
-				DateTimeValue.Minutes = aDateTime.GetMin();
-				DateTimeValue.Hours = aDateTime.GetHour();
-				DateTimeValue.Day = aDateTime.GetDay();
-				DateTimeValue.Month = aDateTime.GetMonth();
-				DateTimeValue.Year = aDateTime.GetYear();
-				rAny <<= DateTimeValue;
-		}
-		break;
-	default:
-		DBG_ERROR("illegal property");
-	}
-	return sal_True;
+            if ( mpText )
+                m_pTextObject->SetText( *mpText );
+            else
+                m_pTextObject->SetString( msCommentContent );
+
+            uno::Reference < text::XText > xText( m_pTextObject );
+            rAny <<= xText;
+            break;
+        }
+    case FIELD_PROP_DATE:
+        {
+            util::Date aSetDate;
+            aSetDate.Day = maDateTime.GetDay();
+            aSetDate.Month = maDateTime.GetMonth();
+            aSetDate.Year = maDateTime.GetYear();
+            rAny.setValue(&aSetDate, ::getCppuType((util::Date*)0));
+        }
+        break;
+    case FIELD_PROP_DATE_TIME:
+        {
+            util::DateTime DateTimeValue;
+            DateTimeValue.HundredthSeconds = maDateTime.Get100Sec();
+            DateTimeValue.Seconds = maDateTime.GetSec();
+            DateTimeValue.Minutes = maDateTime.GetMin();
+            DateTimeValue.Hours = maDateTime.GetHour();
+            DateTimeValue.Day = maDateTime.GetDay();
+            DateTimeValue.Month = maDateTime.GetMonth();
+            DateTimeValue.Year = maDateTime.GetYear();
+            rAny <<= DateTimeValue;
+        }
+        break;
+    default:
+        DBG_ERROR("illegal property");
+    }
+    return sal_True;
 }
 
+
 sal_Bool SwPostItField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
 {
     switch( nWhichId )
-	{
-	case FIELD_PROP_PAR1:
-		::GetString( rAny, sAuthor );
-		break;
-	case FIELD_PROP_PAR2:
-		::GetString( rAny, sTxt );
-		//#i100374# new string via api, delete complex text object so SwPostItNote picks up the new string
-		if (mpText)
-		{
-			delete mpText;
-			mpText = 0;
-		}
-		break;
-	case FIELD_PROP_TEXT:
-		DBG_ERROR("Not implemented!");
-		// ::GetString( rAny, sTxt );
-		break;
-	case FIELD_PROP_DATE:
-		if( rAny.getValueType() == ::getCppuType((util::Date*)0) )
-		{
-			util::Date aSetDate = *(util::Date*)rAny.getValue();
-			aDateTime = Date(aSetDate.Day, aSetDate.Month, aSetDate.Year);
-		}
-		break;
-	case FIELD_PROP_DATE_TIME:
-	{
-		util::DateTime aDateTimeValue;
-		if(!(rAny >>= aDateTimeValue))
-			return sal_False;
-		aDateTime.Set100Sec(aDateTimeValue.HundredthSeconds);
-		aDateTime.SetSec(aDateTimeValue.Seconds);
-		aDateTime.SetMin(aDateTimeValue.Minutes);
-		aDateTime.SetHour(aDateTimeValue.Hours);
-		aDateTime.SetDay(aDateTimeValue.Day);
-		aDateTime.SetMonth(aDateTimeValue.Month);
-		aDateTime.SetYear(aDateTimeValue.Year);
-	}
-	break;
-	default:
-		DBG_ERROR("illegal property");
-	}
-	return sal_True;
+    {
+    case FIELD_PROP_PAR1:
+        ::GetString( rAny, msAuthor );
+        break;
+    case FIELD_PROP_PAR2:
+        ::GetString( rAny, msCommentContent );
+        //#i100374# new string via api, delete complex text object so SwPostItNote picks up the new string
+        if (mpText)
+        {
+            delete mpText;
+            mpText = 0;
+        }
+        break;
+    case FIELD_PROP_PAR3:
+        ::GetString( rAny, msAuthorInitials );
+        break;
+    case FIELD_PROP_PAR4:
+        ::GetString( rAny, msName );
+        break;
+    case FIELD_PROP_TEXT:
+        DBG_ERROR("Not implemented!");
+        // ::GetString( rAny, msCommentContent );
+        break;
+    case FIELD_PROP_DATE:
+        if( rAny.getValueType() == ::getCppuType((util::Date*)0) )
+        {
+            util::Date aSetDate = *(util::Date*)rAny.getValue();
+            maDateTime = Date(aSetDate.Day, aSetDate.Month, aSetDate.Year);
+        }
+        break;
+    case FIELD_PROP_DATE_TIME:
+        {
+            util::DateTime aDateTimeValue;
+            if(!(rAny >>= aDateTimeValue))
+                return sal_False;
+            maDateTime.Set100Sec(aDateTimeValue.HundredthSeconds);
+            maDateTime.SetSec(aDateTimeValue.Seconds);
+            maDateTime.SetMin(aDateTimeValue.Minutes);
+            maDateTime.SetHour(aDateTimeValue.Hours);
+            maDateTime.SetDay(aDateTimeValue.Day);
+            maDateTime.SetMonth(aDateTimeValue.Month);
+            maDateTime.SetYear(aDateTimeValue.Year);
+        }
+        break;
+    default:
+        DBG_ERROR("illegal property");
+    }
+    return sal_True;
 }
+
+
 /*--------------------------------------------------------------------
 	Beschreibung: DokumentinfoFields
  --------------------------------------------------------------------*/

Modified: openoffice/branches/ooxml-osba/main/sw/source/core/inc/bookmrk.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/inc/bookmrk.hxx?rev=1546391&r1=1546390&r2=1546391&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/inc/bookmrk.hxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/inc/bookmrk.hxx Thu Nov 28 16:01:25 2013
@@ -244,6 +244,7 @@ namespace sw { namespace mark
         public:
             TextFieldmark(const SwPaM& rPaM);
             virtual void InitDoc(SwDoc* const io_pDoc);
+            void ReleaseDoc(SwDoc* const pDoc);
     };
 
     class CheckboxFieldmark

Modified: openoffice/branches/ooxml-osba/main/sw/source/core/text/EnhancedPDFExportHelper.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/text/EnhancedPDFExportHelper.cxx?rev=1546391&r1=1546390&r2=1546391&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/text/EnhancedPDFExportHelper.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/text/EnhancedPDFExportHelper.cxx Thu Nov 28 16:01:25 2013
@@ -1628,7 +1628,7 @@ void SwEnhancedPDFExportHelper::Enhanced
                             sTitle += sDate;
                             aNote.Title = sTitle;
                             // Guess what the contents contains...
-                            aNote.Contents = pField->GetTxt();
+                            aNote.Contents = pField->GetContent();
 
                             // Link Export
                             pPDFExtOutDevData->CreateNote( rNoteRect.SVRect(), aNote, nNotePageNum );

Modified: openoffice/branches/ooxml-osba/main/sw/source/core/text/inftxt.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/text/inftxt.cxx?rev=1546391&r1=1546390&r2=1546391&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/text/inftxt.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/text/inftxt.cxx Thu Nov 28 16:01:25 2013
@@ -37,11 +37,8 @@
 #include <editeng/brshitem.hxx>
 #include <editeng/splwrap.hxx>
 #include <editeng/pgrditem.hxx>
-// --> OD 2008-01-17 #newlistlevelattrs#
-#ifndef _SVX_TSTPITEM_HXX
 #include <editeng/tstpitem.hxx>
-#endif
-// <--
+#include <xmloff/odffields.hxx>
 
 #include <SwSmartTagMgr.hxx>
 #include <linguistic/lngprops.hxx>
@@ -50,6 +47,9 @@
 #include <editeng/forbiddenruleitem.hxx>
 #include <txatbase.hxx>
 #include <fmtinfmt.hxx>
+#include <fmtfld.hxx>
+#include <fldbas.hxx>
+#include <PostItMgr.hxx>
 #include <swmodule.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/wrkwin.hxx>
@@ -57,9 +57,7 @@
 #include <viewopt.hxx>	// SwViewOptions
 #include <frmtool.hxx>	// DrawGraphic
 #include <IDocumentSettingAccess.hxx>
-#ifndef IDOCUMENTDEVICEACCESS_HXX_INCLUDED
 #include <IDocumentDeviceAccess.hxx>
-#endif
 #include <paratr.hxx>	// SwFmtDrop
 #include <rootfrm.hxx>  // SwRootFrm
 #include <inftxt.hxx>	// SwTxtInfo
@@ -74,9 +72,7 @@
 #include <pam.hxx>
 #include <SwGrammarMarkUp.hxx>
 #include <cstdio>
-// --> FME 2004-06-08 #i12836# enhanced pdf export
 #include <EnhancedPDFExportHelper.hxx>
-// <--
 
 #include <unomid.h>
 
@@ -1207,7 +1203,7 @@ void SwTxtPaintInfo::_DrawBackBrush( con
         if(aIntersect.HasArea())
         {
             SwTxtNode *pNd = pFrm->GetTxtNode();
-            const ::sw::mark::IMark* pFieldmark = NULL;
+            const ::sw::mark::IFieldmark* pFieldmark = NULL;
             if(pNd)
             {
                 const SwDoc *doc=pNd->GetDoc();
@@ -1233,7 +1229,26 @@ void SwTxtPaintInfo::_DrawBackBrush( con
             {
                 OutputDevice* pOutDev = (OutputDevice*)GetOut();
                 pOutDev->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
-                pOutDev->SetFillColor( SwViewOption::GetFieldShadingsColor() );
+                bool bFilled = false;
+                // If this is a comment range, need to look up the color of the comment author.
+                if ( pFieldmark->GetFieldname().equalsAscii( ODF_COMMENTRANGE ) )
+                {
+                    // Search for the position of the postit field
+                    const sal_Unicode fld[] = { CH_TXTATR_INWORD, 0 };
+                    xub_StrLen nEndIdx = GetTxt().SearchChar(fld, GetIdx());
+                    if (nEndIdx != STRING_NOTFOUND)
+                    {
+                        SwTxtAttr* pTxtAttr = pNd->GetTxtAttrForCharAt(nEndIdx, RES_TXTATR_FIELD);
+                        const SwFmtFld& rPostItField = pTxtAttr->GetFmtFld();
+                        // Look up the author name
+                        const rtl::OUString& rAuthor = rPostItField.GetField()->GetPar1();
+                        sal_uInt16 nIndex = pNd->GetDoc()->InsertRedlineAuthor(rAuthor);
+                        pOutDev->SetFillColor( SwPostItMgr::GetColorLight(nIndex) );
+                        bFilled = true;
+                    }
+                }
+                if (!bFilled)
+                    pOutDev->SetFillColor( SwViewOption::GetFieldShadingsColor() );
                 pOutDev->SetLineColor( );
                 pOutDev->DrawRect( aIntersect.SVRect() );
                 pOutDev->Pop();

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=1546391&r1=1546390&r2=1546391&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 Thu Nov 28 16:01:25 2013
@@ -90,6 +90,9 @@
 #include <docsh.hxx>
 #include <fmtmeta.hxx> // MetaFieldManager
 #include <switerator.hxx>
+#include <bookmrk.hxx>
+#include <xmloff/odffields.hxx>
+
 
 using ::rtl::OUString;
 using namespace ::com::sun::star;
@@ -1211,125 +1214,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);
+        //das muss jetzt sal_True liefern
         ::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);
+                }
+                pFld = 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 )
+                {
+                    ((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);
                 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 +1735,20 @@ 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);
+            SwTxtAttr* pTxtAttr = 0;
+            if ( aPam.HasMark()
+                 && m_nServiceId != SW_SERVICE_FIELDTYPE_ANNOTATION )
+            {
+                pDoc->DeleteAndJoin(aPam);
+            }
 
             SwXTextCursor const*const pTextCursor( dynamic_cast<SwXTextCursor*>(pCursor) );
             const bool bForceExpandHints(
@@ -1743,7 +1760,41 @@ 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 )
+            {
+                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
+                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 );
             // was passiert mit dem Update der Felder ? (siehe fldmgr.cxx)
@@ -2330,7 +2381,14 @@ uno::Sequence< OUString > SwXTextField::
 	return aRet;
 }
 
-void SwXTextField::Invalidate()
+
+sal_uInt16 SwXTextField::GetServiceId()
+{
+    return m_nServiceId;
+}
+
+
+    void SwXTextField::Invalidate()
 {
 	if (GetRegisteredIn())
 	{

Modified: openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unomap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unomap.cxx?rev=1546391&r1=1546390&r2=1546391&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unomap.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unomap.cxx Thu Nov 28 16:01:25 2013
@@ -1938,21 +1938,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/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=1546391&r1=1546390&r2=1546391&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 Thu Nov 28 16:01:25 2013
@@ -27,9 +27,7 @@
 
 #include <unoport.hxx>
 #include <IMark.hxx>
-// --> OD 2007-10-23 #i81002#
 #include <crossrefbookmark.hxx>
-// <--
 #include <doc.hxx>
 #include <txatbase.hxx>
 #include <txtatr.hxx>
@@ -55,6 +53,9 @@
 #include <unoidx.hxx>
 #include <redline.hxx>
 #include <crsskip.hxx>
+#include <switerator.hxx>
+#include <docufld.hxx>
+#include <fmtfld.hxx>
 #include <vos/mutex.hxx>
 #include <vcl/svapp.hxx>
 #include <set>
@@ -329,9 +330,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();
@@ -347,6 +349,32 @@ lcl_FillFieldMarkArray(FieldMarks_t & rF
     }
 }
 
+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,
@@ -373,14 +401,21 @@ lcl_ExportFieldMark(
         ::sw::mark::IFieldmark* pFieldmark = NULL;
         if (pDoc)
         {
-            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 && pFieldmark && pDoc )
+        {
+            pPortion->SetBookmark( new SwXFieldmark( false, pFieldmark, pDoc ) );
+            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)
     {

Modified: openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unoprnms.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unoprnms.cxx?rev=1546391&r1=1546390&r2=1546391&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unoprnms.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unoprnms.cxx Thu Nov 28 16:01:25 2013
@@ -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/ooxml-osba/main/sw/source/core/unocore/unotext.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unotext.cxx?rev=1546391&r1=1546390&r2=1546391&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unotext.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/core/unocore/unotext.cxx Thu Nov 28 16:01:25 2013
@@ -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/ooxml-osba/main/sw/source/filter/html/htmlfld.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/filter/html/htmlfld.cxx?rev=1546391&r1=1546390&r2=1546391&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/filter/html/htmlfld.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/filter/html/htmlfld.cxx Thu Nov 28 16:01:25 2013
@@ -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/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=1546391&r1=1546390&r2=1546391&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 Thu Nov 28 16:01:25 2013
@@ -5332,75 +5332,78 @@ void SwHTMLParser::InsertHorzRule()
 
 void SwHTMLParser::ParseMoreMetaOptions()
 {
-	String aName, aContent;
-	sal_Bool bHTTPEquiv = sal_False;
+    String aName, aContent;
+    sal_Bool bHTTPEquiv = sal_False;
 
-	const HTMLOptions *pHTMLOptions = GetOptions();
-	for( sal_uInt16 i = pHTMLOptions->Count(); i; )
-	{
-		const HTMLOption *pOption = (*pHTMLOptions)[ --i ];
-		switch( pOption->GetToken() )
-		{
-		case HTML_O_NAME:
-			aName = pOption->GetString();
-			bHTTPEquiv = sal_False;
-			break;
-		case HTML_O_HTTPEQUIV:
-			aName = pOption->GetString();
-			bHTTPEquiv = sal_True;
-			break;
-		case HTML_O_CONTENT:
-			aContent = pOption->GetString();
-			break;
-		}
-	}
-
-	// Hier wird es etwas tricky: Wir wissen genau, da? die Dok-Info
-	// nicht geaendert wurde. Deshalb genuegt es, auf Generator und
-	// auf refresh abzufragen, um noch nicht verarbeitete Token zu finden,
-	// denn das sind die einzigen, die die Dok-Info nicht modifizieren.
-	if( aName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_generator ) ||
-		aName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_refresh ) ||
-		aName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_content_type ) ||
-		aName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_content_script_type ) )
-		return;
-
-	aContent.EraseAllChars( _CR );
-	aContent.EraseAllChars( _LF );
-
-	if( aName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_sdendnote ) )
-	{
-		FillEndNoteInfo( aContent );
-		return;
-	}
-
-	if( aName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_sdfootnote ) )
-	{
-		FillFootNoteInfo( aContent );
-		return;
-	}
-
-	String sText(
-			String::CreateFromAscii(TOOLS_CONSTASCII_STRINGPARAM("HTML: <")) );
-	sText.AppendAscii( TOOLS_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_meta) );
-	sText.Append( ' ' );
-	if( bHTTPEquiv  )
-		sText.AppendAscii( TOOLS_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_O_httpequiv) );
-	else
-		sText.AppendAscii( TOOLS_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_O_name) );
-	sText.AppendAscii( TOOLS_CONSTASCII_STRINGPARAM("=\"") );
-	sText.Append( aName );
-	sText.AppendAscii( TOOLS_CONSTASCII_STRINGPARAM("\" ") );
-	sText.AppendAscii( TOOLS_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_O_content) );
-	sText.AppendAscii( TOOLS_CONSTASCII_STRINGPARAM("=\"") );
-	sText.Append( aContent );
-	sText.AppendAscii( TOOLS_CONSTASCII_STRINGPARAM("\">") );
-
-	SwPostItField aPostItFld(
-		(SwPostItFieldType*)pDoc->GetSysFldType( RES_POSTITFLD ),
-		aEmptyStr, sText, DateTime() );
-	SwFmtFld aFmtFld( aPostItFld );
-	InsertAttr( aFmtFld );
+    const HTMLOptions *pHTMLOptions = GetOptions();
+    for( sal_uInt16 i = pHTMLOptions->Count(); i; )
+    {
+        const HTMLOption *pOption = (*pHTMLOptions)[ --i ];
+        switch( pOption->GetToken() )
+        {
+        case HTML_O_NAME:
+            aName = pOption->GetString();
+            bHTTPEquiv = sal_False;
+            break;
+        case HTML_O_HTTPEQUIV:
+            aName = pOption->GetString();
+            bHTTPEquiv = sal_True;
+            break;
+        case HTML_O_CONTENT:
+            aContent = pOption->GetString();
+            break;
+        }
+    }
+
+    // Hier wird es etwas tricky: Wir wissen genau, da? die Dok-Info
+    // nicht geaendert wurde. Deshalb genuegt es, auf Generator und
+    // auf refresh abzufragen, um noch nicht verarbeitete Token zu finden,
+    // denn das sind die einzigen, die die Dok-Info nicht modifizieren.
+    if( aName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_generator ) ||
+        aName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_refresh ) ||
+        aName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_content_type ) ||
+        aName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_content_script_type ) )
+        return;
+
+    aContent.EraseAllChars( _CR );
+    aContent.EraseAllChars( _LF );
+
+    if( aName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_sdendnote ) )
+    {
+        FillEndNoteInfo( aContent );
+        return;
+    }
+
+    if( aName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_sdfootnote ) )
+    {
+        FillFootNoteInfo( aContent );
+        return;
+    }
+
+    String sText( String::CreateFromAscii(TOOLS_CONSTASCII_STRINGPARAM("HTML: <")) );
+    sText.AppendAscii( TOOLS_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_meta) );
+    sText.Append( ' ' );
+    if( bHTTPEquiv  )
+        sText.AppendAscii( TOOLS_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_O_httpequiv) );
+    else
+        sText.AppendAscii( TOOLS_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_O_name) );
+    sText.AppendAscii( TOOLS_CONSTASCII_STRINGPARAM("=\"") );
+    sText.Append( aName );
+    sText.AppendAscii( TOOLS_CONSTASCII_STRINGPARAM("\" ") );
+    sText.AppendAscii( TOOLS_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_O_content) );
+    sText.AppendAscii( TOOLS_CONSTASCII_STRINGPARAM("=\"") );
+    sText.Append( aContent );
+    sText.AppendAscii( TOOLS_CONSTASCII_STRINGPARAM("\">") );
+
+    SwPostItField aPostItFld(
+        (SwPostItFieldType*)pDoc->GetSysFldType( RES_POSTITFLD ),
+        sText,
+        aEmptyStr,
+        aEmptyStr,
+        aEmptyStr,
+        DateTime() );
+    SwFmtFld aFmtFld( aPostItFld );
+    InsertAttr( aFmtFld );
 }
 
 /*  */

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=1546391&r1=1546390&r2=1546391&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 Thu Nov 28 16:01:25 2013
@@ -165,6 +165,12 @@ public:
     /// Called after we end outputting the attributes.
     virtual void EndRunProperties( const SwRedlineData* pRedlineData ) = 0;
 
+    /// for docx w:commentRangeStart
+    virtual void WritePostitFieldStart() {};
+
+    /// for docx w:commentRangeEnd
+    virtual void WritePostitFieldEnd() {};
+
     /// Output text (inside a run).
     virtual void RunText( const String& rText, rtl_TextEncoding eCharSet ) = 0;
     

Modified: openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/docxattributeoutput.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/docxattributeoutput.cxx?rev=1546391&r1=1546390&r2=1546391&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/docxattributeoutput.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/docxattributeoutput.cxx Thu Nov 28 16:01:25 2013
@@ -381,6 +381,7 @@ void DocxAttributeOutput::EndRun()
     }
    
     DoWriteBookmarks( );
+    WriteCommentRanges();
 
     m_pSerializer->startElementNS( XML_w, XML_r, FSEND );
     m_pSerializer->mergeTopMarks( sax_fastparser::MERGE_MARKS_PREPEND ); // merges with "postponed run start", see above
@@ -407,6 +408,33 @@ void DocxAttributeOutput::EndRun()
     EndRedline();
 }
 
+void DocxAttributeOutput::WriteCommentRanges()
+{
+    if (m_bPostitStart)
+    {
+        m_bPostitStart = false;
+        OString idstr = OString::valueOf( sal_Int32( m_postitFieldsMaxId ));
+        m_pSerializer->singleElementNS( XML_w, XML_commentRangeStart, FSNS( XML_w, XML_id ), idstr.getStr(), FSEND );
+    }
+    if (m_bPostitEnd)
+    {
+        m_bPostitEnd = false;
+        OString idstr = OString::valueOf( sal_Int32( m_postitFieldsMaxId ));
+        m_pSerializer->singleElementNS( XML_w, XML_commentRangeEnd, FSNS( XML_w, XML_id ), idstr.getStr(), FSEND );
+    }
+}
+
+void DocxAttributeOutput::WritePostitFieldStart()
+{
+    m_bPostitStart = true;
+}
+
+void DocxAttributeOutput::WritePostitFieldEnd()
+{
+    m_bPostitEnd = true;
+}
+
+
 void DocxAttributeOutput::DoWriteBookmarks()
 {
     // Write the start bookmarks
@@ -3263,6 +3291,8 @@ DocxAttributeOutput::DocxAttributeOutput
       m_bOpenedSectPr( false ),
       m_sFieldBkm( ),
       m_nNextMarkId( 0 ),
+      m_bPostitStart(false),
+      m_bPostitEnd(false),
       m_pTableWrt( NULL ),
       m_bTableCellOpen( false ),
       m_nTableDepth( 0 ),

Modified: openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/docxattributeoutput.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/docxattributeoutput.hxx?rev=1546391&r1=1546390&r2=1546391&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/docxattributeoutput.hxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/docxattributeoutput.hxx Thu Nov 28 16:01:25 2013
@@ -91,6 +91,10 @@ public:
     /// Called after we end outputting the attributes.
     virtual void EndRunProperties( const SwRedlineData* pRedlineData );
 
+    virtual void WritePostitFieldStart();
+
+    virtual void WritePostitFieldEnd();
+
     /// Output text (inside a run).
     virtual void RunText( const String& rText, rtl_TextEncoding eCharSet = RTL_TEXTENCODING_UTF8 );
     
@@ -525,6 +529,7 @@ protected:
 private:
 
     void DoWriteBookmarks( );
+    void WriteCommentRanges();
 
     void StartField_Impl( FieldInfos& rInfos, sal_Bool bWriteRun = sal_False );
     void DoWriteCmd( String& rCmd );
@@ -559,6 +564,11 @@ private:
     std::vector<rtl::OString> m_rMarksStart;
     std::vector<rtl::OString> m_rMarksEnd;
 
+    /// Is there a postit start to output?
+    bool m_bPostitStart;
+    /// Is there a postit end to output?
+    bool m_bPostitEnd;
+
     /// Maps of the bookmarks ids
     std::map<rtl::OString, sal_uInt16> m_rOpenedMarksIds;
 

Modified: openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/rtfattributeoutput.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/rtfattributeoutput.cxx?rev=1546391&r1=1546390&r2=1546391&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/rtfattributeoutput.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/rtfattributeoutput.cxx Thu Nov 28 16:01:25 2013
@@ -3225,7 +3225,7 @@ void RtfAttributeOutput::PostitField( co
     m_aRunText.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_ATNDATE " ");
     m_aRunText.getOStringBuffer().append((sal_Int32)sw::ms::DateTime2DTTM(rPFld.GetDate()));
     m_aRunText.getOStringBuffer().append('}');
-    m_aRunText.getOStringBuffer().append(OUStringToOString(OUString(rPFld.GetTxt()), m_rExport.eCurrentEncoding));
+    m_aRunText.getOStringBuffer().append(OUStringToOString(OUString(rPFld.GetContent()), m_rExport.eCurrentEncoding));
     m_aRunText.getOStringBuffer().append('}');
 }
 

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=1546391&r1=1546390&r2=1546391&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 Thu Nov 28 16:01:25 2013
@@ -1669,8 +1669,11 @@ void MSWordExportBase::UpdatePosition( W
         aAttrIter->NextPos();
 }
 
-bool MSWordExportBase::GetBookmarks( const SwTxtNode& rNd, xub_StrLen nStt,
-                    xub_StrLen nEnd, IMarkVector& rArr )
+bool MSWordExportBase::GetBookmarks(
+    const SwTxtNode& rNd,
+    const xub_StrLen nStt,
+    const xub_StrLen nEnd,
+    IMarkVector& rArr )
 {
     IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
     sal_uLong nNd = rNd.GetIndex( );
@@ -1684,15 +1687,20 @@ bool MSWordExportBase::GetBookmarks( con
         if ( pMark->GetMarkStart().nNode == nNd ||
              pMark->GetMarkEnd().nNode == nNd )
         {
-            xub_StrLen nBStart = pMark->GetMarkStart().nContent.GetIndex();
-            xub_StrLen nBEnd = pMark->GetMarkEnd().nContent.GetIndex();
-
-            // Keep only the bookmars starting or ending in the snippet
-            bool bIsStartOk = ( pMark->GetMarkStart().nNode == nNd ) && ( nBStart >= nStt ) && ( nBStart <= nEnd );
-            bool bIsEndOk = ( pMark->GetMarkEnd().nNode == nNd ) && ( nBEnd >= nStt ) && ( nBEnd <= nEnd );
-
+            // Keep only the bookmarks starting or ending in the snippet
+            const xub_StrLen nBStart = pMark->GetMarkStart().nContent.GetIndex();
+            const bool bIsStartOk = ( pMark->GetMarkStart().nNode == nNd ) && ( nBStart >= nStt ) && ( nBStart <= nEnd );
+            const xub_StrLen nBEnd = pMark->GetMarkEnd().nContent.GetIndex();
+            const bool bIsEndOk = ( pMark->GetMarkEnd().nNode == nNd ) && ( nBEnd >= nStt ) && ( nBEnd <= nEnd );
             if ( bIsStartOk || bIsEndOk )
-                rArr.push_back( pMark );
+            {
+                IFieldmark* pFieldmark = dynamic_cast<IFieldmark*>(pMark);
+                // COMMENTRANGE fieldmarks are no bookmarks
+                if ( !( pFieldmark != NULL && pFieldmark->GetFieldname().equalsAscii( ODF_COMMENTRANGE ) ) )
+                {
+                    rArr.push_back( pMark );
+                }
+            }
         }
     }
     return ( rArr.size() > 0 );
@@ -1890,12 +1898,26 @@ void MSWordExportBase::OutputTextNode( c
 
                 if ( pFieldmark->GetFieldname().equalsAscii( ODF_FORMTEXT ) )
                     AppendBookmark( pFieldmark->GetName(), false );
-                OutputField( NULL, lcl_getFieldId( pFieldmark ), lcl_getFieldCode( pFieldmark ), WRITEFIELD_START | WRITEFIELD_CMD_START );
+
+                const bool bCommentRange = pFieldmark != NULL && pFieldmark->GetFieldname().equalsAscii( ODF_COMMENTRANGE );
+                if ( bCommentRange )
+                {
+                    AttrOutput().WritePostitFieldStart(); // Note: empty for WW8 export
+                }
+                else
+                {
+                    OutputField( NULL, lcl_getFieldId( pFieldmark ), lcl_getFieldCode( pFieldmark ), WRITEFIELD_START | WRITEFIELD_CMD_START );
+                }
+
                 if ( pFieldmark->GetFieldname( ).equalsAscii( ODF_FORMTEXT ) )
                     WriteFormData( *pFieldmark );
                 else if ( pFieldmark->GetFieldname( ).equalsAscii( ODF_HYPERLINK ) )
                     WriteHyperlinkData( *pFieldmark );
-                OutputField( NULL, lcl_getFieldId( pFieldmark ), String(), WRITEFIELD_CMD_END );
+
+                if ( !bCommentRange )
+                {
+                    OutputField( NULL, lcl_getFieldId( pFieldmark ), String(), WRITEFIELD_CMD_END );
+                }
             }
             else if ( ch == CH_TXT_ATR_FIELDEND )
             {
@@ -1903,7 +1925,15 @@ void MSWordExportBase::OutputTextNode( c
                 ::sw::mark::IFieldmark const * const pFieldmark = pMarkAccess->getFieldmarkFor( aPosition );
                 OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??" );
 
-                OutputField( NULL, lcl_getFieldId( pFieldmark ), String(), WRITEFIELD_CLOSE );
+                if ( pFieldmark && pFieldmark->GetFieldname().equalsAscii( ODF_COMMENTRANGE ) )
+                {
+                    AttrOutput().WritePostitFieldEnd(); // Note: empty for WW8 export
+                }
+                else
+                {
+                    OutputField( NULL, lcl_getFieldId( pFieldmark ), String(), WRITEFIELD_CLOSE );
+                }
+
                 if ( pFieldmark->GetFieldname().equalsAscii( ODF_FORMTEXT ) )
                     AppendBookmark( pFieldmark->GetName(), false );
             }

Modified: openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/wrtw8sty.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/wrtw8sty.cxx?rev=1546391&r1=1546390&r2=1546391&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/wrtw8sty.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/wrtw8sty.cxx Thu Nov 28 16:01:25 2013
@@ -1926,7 +1926,7 @@ WW8_Annotation::WW8_Annotation(const SwP
 {
     mpRichText = pPostIt->GetTextObject();
     if (!mpRichText)
-        msSimpleText = pPostIt->GetTxt();
+        msSimpleText = pPostIt->GetContent();
     msOwner = pPostIt->GetPar1();
     maDateTime = DateTime(pPostIt->GetDate(), pPostIt->GetTime());
 }

Modified: openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/wrtww8.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/wrtww8.hxx?rev=1546391&r1=1546390&r2=1546391&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/wrtww8.hxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/filter/ww8/wrtww8.hxx Thu Nov 28 16:01:25 2013
@@ -822,8 +822,11 @@ protected:
     void GetSortedBookmarks( const SwTxtNode& rNd, xub_StrLen nAktPos, 
                 xub_StrLen nLen );
 
-    bool GetBookmarks( const SwTxtNode& rNd, xub_StrLen nStt, xub_StrLen nEnd,
-            IMarkVector& rArr );
+    bool GetBookmarks(
+        const SwTxtNode& rNd,
+        const xub_StrLen nStt,
+        const xub_StrLen nEnd,
+        IMarkVector& rArr );
 
     const NfKeywordTable & GetNfKeywordTable();
 

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=1546391&r1=1546390&r2=1546391&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 Thu Nov 28 16:01:25 2013
@@ -2009,8 +2009,12 @@ long SwWW8ImplReader::Read_And(WW8PLCFMa
 
     this->pFmtOfJustInsertedApo = 0;
     SwPostItField aPostIt(
-        (SwPostItFieldType*)rDoc.GetSysFldType(RES_POSTITFLD), sAuthor,
-        sTxt, aDate );
+        (SwPostItFieldType*)rDoc.GetSysFldType(RES_POSTITFLD),
+        sTxt,
+        sAuthor,
+        aEmptyStr,
+        aEmptyStr,
+        aDate );
     aPostIt.SetTextObject(pOutliner);
 
     pCtrlStck->NewAttr(*pPaM->GetPoint(), SvxCharHiddenItem(false, RES_CHRATR_HIDDEN));

Modified: openoffice/branches/ooxml-osba/main/sw/source/ui/fldui/fldmgr.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/ui/fldui/fldmgr.cxx?rev=1546391&r1=1546390&r2=1546391&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/ui/fldui/fldmgr.cxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/ui/fldui/fldmgr.cxx Thu Nov 28 16:01:25 2013
@@ -854,12 +854,14 @@ sal_uInt16 SwFldMgr::GetCurTypeId() cons
  --------------------------------------------------------------------*/
 
 
-sal_Bool SwFldMgr::InsertFld(  const SwInsertFld_Data& rData )
+sal_Bool SwFldMgr::InsertFld(
+    const SwInsertFld_Data& rData,
+    const SwPaM *pPam )
 {
     SwField* pFld   = 0;
-	sal_Bool bExp = sal_False;
-	sal_Bool bTbl = sal_False;
-	sal_Bool bPageVar = sal_False;
+    sal_Bool bExp = sal_False;
+    sal_Bool bTbl = sal_False;
+    sal_Bool bPageVar = sal_False;
     sal_uLong nFormatId = rData.nFormatId;
     sal_uInt16 nSubType = rData.nSubType;
     sal_Unicode cSeparator = rData.cSeparator;
@@ -871,13 +873,20 @@ sal_Bool SwFldMgr::InsertFld(  const SwI
         return sal_False;
 
     switch(rData.nTypeId)
-	{   // ACHTUNG dieses Feld wird ueber einen gesonderten Dialog eingefuegt
-		case TYP_POSTITFLD:
-		{
-			SwPostItFieldType* pType = (SwPostItFieldType*)pCurShell->GetFldType(0, RES_POSTITFLD);
-			pFld = new SwPostItField(pType, rData.sPar1, rData.sPar2, DateTime());
-			break;
-		}
+    {
+    case TYP_POSTITFLD:
+        {
+            SwPostItFieldType* pType = (SwPostItFieldType*)pCurShell->GetFldType(0, RES_POSTITFLD);
+            pFld = new SwPostItField(
+                pType,
+                rData.sPar2, // content
+                rData.sPar1, // author
+                aEmptyStr, // author's initials
+                aEmptyStr, // name
+                DateTime() );
+            break;
+        }
+
 		case TYP_SCRIPTFLD:
 		{
 			SwScriptFieldType* pType =
@@ -1389,7 +1398,13 @@ sal_Bool SwFldMgr::InsertFld(  const SwI
 	// Einfuegen
     pCurShell->StartAllAction();
 
-    pCurShell->Insert(*pFld);
+    const SwPaM* pCommentRange = NULL;
+    if (pPam && *pPam->GetPoint() != *pPam->GetMark() && rData.nTypeId == TYP_POSTITFLD)
+    {
+        pCommentRange = pPam;
+    }
+
+    pCurShell->Insert( *pFld, pCommentRange );
 
 	if(bExp && bEvalExp)
         pCurShell->UpdateExpFlds(sal_True);

Modified: openoffice/branches/ooxml-osba/main/sw/source/ui/inc/fldmgr.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/ui/inc/fldmgr.hxx?rev=1546391&r1=1546390&r2=1546391&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/ui/inc/fldmgr.hxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/ui/inc/fldmgr.hxx Thu Nov 28 16:01:25 2013
@@ -44,6 +44,7 @@ namespace com{namespace sun{namespace st
 class SwWrtShell;
 class SwField;
 class SwFieldType;
+class SwPaM;
 class SbModule;
 class SvxMacroItem;
 class SvNumberFormatter;
@@ -136,8 +137,10 @@ public:
     void                SetWrtShell( SwWrtShell* pShell )
                         {   pWrtShell = pShell;     }                                    
     
-    // Feld einfuegen ueber TypeId (TYP_ ...)
-    sal_Bool            InsertFld(  const SwInsertFld_Data& rData );
+     // insert field using TypeID (TYP_ ...)
+    sal_Bool InsertFld(
+        const SwInsertFld_Data& rData,
+        const SwPaM* pPam = 0 );
 
 	// Direkt das aktuelle Feld aendern
 	void 			UpdateCurFld(sal_uLong nFormat,

Modified: openoffice/branches/ooxml-osba/main/sw/source/ui/inc/wrtsh.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/sw/source/ui/inc/wrtsh.hxx?rev=1546391&r1=1546390&r2=1546391&view=diff
==============================================================================
--- openoffice/branches/ooxml-osba/main/sw/source/ui/inc/wrtsh.hxx (original)
+++ openoffice/branches/ooxml-osba/main/sw/source/ui/inc/wrtsh.hxx Thu Nov 28 16:01:25 2013
@@ -297,8 +297,12 @@ typedef sal_Bool (SwWrtShell:: *FNSimple
 	int 	IntelligentCut(int nSelectionType, sal_Bool bCut = sal_True);
 
 	// Editieren
-	void	Insert(SwField &);
+    void Insert(
+        SwField &,
+        const SwPaM* pCommentRange = NULL );
+
 	void	Insert(const String &);
+
 	// Graphic
 	void	Insert( const String &rPath, const String &rFilter,
 					const Graphic &, SwFlyFrmAttrMgr * = 0,



Mime
View raw message