openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From o..@apache.org
Subject svn commit: r1552294 [2/2] - in /openoffice/trunk: ./ main/offapi/com/sun/star/text/textfield/ main/sw/inc/ main/sw/source/core/crsr/ main/sw/source/core/doc/ main/sw/source/core/fields/ main/sw/source/core/inc/ main/sw/source/core/text/ main/sw/source...
Date Thu, 19 Dec 2013 12:31:37 GMT
Modified: openoffice/trunk/main/sw/source/ui/shells/textfld.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/ui/shells/textfld.cxx?rev=1552294&r1=1552293&r2=1552294&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/ui/shells/textfld.cxx (original)
+++ openoffice/trunk/main/sw/source/ui/shells/textfld.cxx Thu Dec 19 12:31:35 2013
@@ -354,53 +354,61 @@ void SwTextShell::ExecField(SfxRequest &
                     GetView().GetPostItMgr()->Hide( pNoteItem->GetValue() );
 			}
 			break;
-			case FN_POSTIT:
-			{
-	            SwPostItField* pPostIt = dynamic_cast<SwPostItField*>(aFldMgr.GetCurFld());
-      	        sal_Bool bNew = !(pPostIt && pPostIt->GetTyp()->Which() == RES_POSTITFLD);
-				if (bNew || GetView().GetPostItMgr()->IsAnswer())
-				{
-					SvtUserOptions aUserOpt;
-					String sAuthor;
-					if( !(sAuthor = aUserOpt.GetFullName()).Len())
-						if( !(sAuthor = aUserOpt.GetID()).Len() )
-							sAuthor = String( SW_RES( STR_REDLINE_UNKNOWN_AUTHOR ));
-					if( rSh.HasSelection() )
-					{
-						rSh.NormalizePam(true);
-						rSh.KillPams();
-						rSh.ClearMark();
-					}
-					
-					// #120513# Inserting a comment into an autocompletion crashes
-					// --> suggestion has to be removed before
-					GetView().GetEditWin().StopQuickHelp();
-					
-					SwInsertFld_Data aData(TYP_POSTITFLD, 0, sAuthor, aEmptyStr, 0);
-					aFldMgr.InsertFld(aData);
-					rSh.Push();
-					rSh.SwCrsrShell::Left(1, CRSR_SKIP_CHARS, sal_False);
-		            pPostIt = (SwPostItField*)aFldMgr.GetCurFld();
-					rSh.Pop(sal_False);	// Cursorpos restaurieren
- 				}
 
-				if (pPostIt)
-				{
-					SwFieldType* pType = rSh.GetDoc()->GetFldType(RES_POSTITFLD, aEmptyStr,false);
-					SwIterator<SwFmtFld,SwFieldType> aIter( *pType );
-					SwFmtFld* pSwFmtFld = aIter.First();
-					while( pSwFmtFld )
-					{
-						if ( pSwFmtFld->GetField() == pPostIt )
-						{
-							pSwFmtFld->Broadcast( SwFmtFldHint( 0, SWFMTFLD_FOCUS, &GetView() ) );
-							break;
-						}
-						pSwFmtFld = aIter.Next();
-					}
-				}
-			}
-			break;
+            case FN_POSTIT:
+                {
+                    SwPostItField* pPostIt = dynamic_cast<SwPostItField*>(aFldMgr.GetCurFld());
+                    sal_Bool bNew = !(pPostIt && pPostIt->GetTyp()->Which() == RES_POSTITFLD);
+                    if (bNew || GetView().GetPostItMgr()->IsAnswer())
+                    {
+                        SvtUserOptions aUserOpt;
+                        String sAuthor;
+                        if( !(sAuthor = aUserOpt.GetFullName()).Len())
+                            if( !(sAuthor = aUserOpt.GetID()).Len() )
+                                sAuthor = String( SW_RES( STR_REDLINE_UNKNOWN_AUTHOR ));
+
+                        // Save the current selection, it will be required later for fieldmark insertion.
+                        const SwPaM& rCurrPaM = rSh.GetCurrentShellCursor();
+                        const SwPaM aSavedPaM( *rCurrPaM.GetPoint(), *rCurrPaM.GetMark() );
+
+                        if( rSh.HasSelection() )
+                        {
+                            rSh.NormalizePam( sal_False );
+                            rSh.KillPams();
+                            rSh.ClearMark();
+                        }
+
+                        // #120513# Inserting a comment into an autocompletion crashes
+                        // --> suggestion has to be removed before
+                        GetView().GetEditWin().StopQuickHelp();
+
+                        SwInsertFld_Data aData(TYP_POSTITFLD, 0, sAuthor, aEmptyStr, 0);
+                        aFldMgr.InsertFld( aData, &aSavedPaM );
+
+                        rSh.Push();
+                        rSh.SwCrsrShell::Left(1, CRSR_SKIP_CHARS, sal_False);
+                        pPostIt = (SwPostItField*)aFldMgr.GetCurFld();
+                        rSh.Pop(sal_False);	// Cursorpos restaurieren
+                    }
+
+                    if (pPostIt)
+                    {
+                        SwFieldType* pType = rSh.GetDoc()->GetFldType(RES_POSTITFLD, aEmptyStr,false);
+                        SwIterator<SwFmtFld,SwFieldType> aIter( *pType );
+                        SwFmtFld* pSwFmtFld = aIter.First();
+                        while( pSwFmtFld )
+                        {
+                            if ( pSwFmtFld->GetField() == pPostIt )
+                            {
+                                pSwFmtFld->Broadcast( SwFmtFldHint( 0, SWFMTFLD_FOCUS, &GetView() ) );
+                                break;
+                            }
+                            pSwFmtFld = aIter.Next();
+                        }
+                    }
+                }
+                break;
+
 			case FN_REDLINE_COMMENT:
 			{
 				/*	this code can be used once we want redline comments in the margin, all other stuff can

Modified: openoffice/trunk/main/sw/source/ui/wrtsh/wrtsh2.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/ui/wrtsh/wrtsh2.cxx?rev=1552294&r1=1552293&r2=1552294&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/ui/wrtsh/wrtsh2.cxx (original)
+++ openoffice/trunk/main/sw/source/ui/wrtsh/wrtsh2.cxx Thu Dec 19 12:31:35 2013
@@ -65,6 +65,7 @@
 #include "swabstdlg.hxx"
 #include "fldui.hrc"
 #include <SwRewriter.hxx>
+#include <xmloff/odffields.hxx>
 
 #include <com/sun/star/document/XDocumentProperties.hpp>
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
@@ -74,27 +75,41 @@
 		Beschreibung:
 ------------------------------------------------------------------------*/
 
-void SwWrtShell::Insert(SwField &rFld)
-{
-	ResetCursorStack();
-	if(!_CanInsert())
-		return;
-	StartAllAction();
+void SwWrtShell::Insert(
+    SwField& rFld,
+    const SwPaM* pCommentRange )
+{
+    ResetCursorStack();
+    if(!_CanInsert())
+        return;
+    StartAllAction();
 
     SwRewriter aRewriter;
     aRewriter.AddRule(UNDO_ARG1, rFld.GetDescription());
 
-	StartUndo(UNDO_INSERT, &aRewriter);
+    StartUndo(UNDO_INSERT, &aRewriter);
+
+    if ( pCommentRange && GetDoc() )
+    {
+        // If an annotation field is inserted, take care of the relevant fieldmark.
+        IDocumentMarkAccess* pMarksAccess = GetDoc()->getIDocumentMarkAccess();
+        sw::mark::IFieldmark* pFieldmark =
+            pMarksAccess->makeFieldBookmark(
+                *pCommentRange,
+                ::rtl::OUString(),
+                ::rtl::OUString::createFromAscii( ODF_COMMENTRANGE ) );
+        ((SwPostItField&)rFld).SetName(pFieldmark->GetName());
+    }
 
     bool bDeleted = false;
-	if( HasSelection() )
+    if( HasSelection() )
     {
         bDeleted = DelRight() != 0;
     }
 
     SwEditShell::Insert2(rFld, bDeleted);
     EndUndo();
-	EndAllAction();
+    EndAllAction();
 }
 
 /*--------------------------------------------------------------------

Modified: openoffice/trunk/main/writerfilter/source/dmapper/DomainMapper.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/writerfilter/source/dmapper/DomainMapper.cxx?rev=1552294&r1=1552293&r2=1552294&view=diff
==============================================================================
--- openoffice/trunk/main/writerfilter/source/dmapper/DomainMapper.cxx (original)
+++ openoffice/trunk/main/writerfilter/source/dmapper/DomainMapper.cxx Thu Dec 19 12:31:35 2013
@@ -2074,6 +2074,15 @@ void DomainMapper::lcl_attribute(Id nNam
             /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
             m_pImpl->SetCurrentRedlineId( nIntValue );
         break;
+        case NS_ooxml::LN_CT_Comment_initials:
+            m_pImpl->SetCurrentRedlineInitials(sStringValue);
+        break;
+        case NS_ooxml::LN_EG_RangeMarkupElements_commentRangeStart:
+            m_pImpl->AddAnnotationPosition(true);
+        break;
+        case NS_ooxml::LN_EG_RangeMarkupElements_commentRangeEnd:
+            m_pImpl->AddAnnotationPosition(false);
+        break;
         case NS_ooxml::LN_token:
             /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
             m_pImpl->SetCurrentRedlineToken( nIntValue );

Modified: openoffice/trunk/main/writerfilter/source/dmapper/DomainMapper_Impl.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/writerfilter/source/dmapper/DomainMapper_Impl.cxx?rev=1552294&r1=1552293&r2=1552294&view=diff
==============================================================================
--- openoffice/trunk/main/writerfilter/source/dmapper/DomainMapper_Impl.cxx (original)
+++ openoffice/trunk/main/writerfilter/source/dmapper/DomainMapper_Impl.cxx Thu Dec 19 12:31:35 2013
@@ -1276,9 +1276,32 @@ void DomainMapper_Impl::PopFootOrEndnote
 void DomainMapper_Impl::PopAnnotation()
 {
     m_bIsInComments = false;
+
+    RemoveLastParagraph();
     m_aTextAppendStack.pop();
-    uno::Sequence< beans::PropertyValue > aEmptyProperties;
-    appendTextContent( uno::Reference< text::XTextContent >( m_xAnnotationField, uno::UNO_QUERY_THROW ), aEmptyProperties );
+
+    // See if the annotation will be a single position or a range.
+    if ( !m_aAnnotationPosition.m_xStart.is()
+         || !m_aAnnotationPosition.m_xEnd.is() )
+    {
+        uno::Sequence< beans::PropertyValue > aEmptyProperties;
+        appendTextContent( uno::Reference< text::XTextContent >( m_xAnnotationField, uno::UNO_QUERY_THROW ), aEmptyProperties );
+    }
+    else
+    {
+        // Create a range that points to the annotation start/end.
+        uno::Reference<text::XText> xText = m_aAnnotationPosition.m_xStart->getText();
+        uno::Reference<text::XTextCursor> xCursor = xText->createTextCursorByRange(m_aAnnotationPosition.m_xStart);
+        xCursor->gotoRange(m_aAnnotationPosition.m_xEnd, true);
+        uno::Reference<text::XTextRange> xTextRange(xCursor, uno::UNO_QUERY_THROW);
+
+        // Attach the annotation to the range.
+        uno::Reference<text::XTextAppend> xTextAppend = m_aTextAppendStack.top().xTextAppend;
+        xTextAppend->insertTextContent(xTextRange, uno::Reference<text::XTextContent>(m_xAnnotationField, uno::UNO_QUERY_THROW), !xCursor->isCollapsed());
+    }
+
+    m_aAnnotationPosition.m_xStart.clear();
+    m_aAnnotationPosition.m_xEnd.clear();
     m_xAnnotationField.clear();
 
 }
@@ -2890,6 +2913,30 @@ void DomainMapper_Impl::handleToc
     pContext->SetTOC( xTOC );
 }
 
+void DomainMapper_Impl::AddAnnotationPosition(const bool bStart)
+{
+    if (m_aTextAppendStack.empty())
+        return;
+
+    // Create a cursor, pointing to the current position.
+    uno::Reference<text::XTextAppend>  xTextAppend = m_aTextAppendStack.top().xTextAppend;
+    uno::Reference<text::XTextRange> xCurrent;
+    if (xTextAppend.is())
+    {
+        uno::Reference<text::XTextCursor> xCursor = xTextAppend->createTextCursorByRange(xTextAppend->getEnd());
+        xCurrent = xCursor->getStart();
+    }
+
+    // And save it, to be used by PopAnnotation() later.
+    if (bStart)
+    {
+        m_aAnnotationPosition.m_xStart = xCurrent;
+    }
+    else
+    {
+        m_aAnnotationPosition.m_xEnd = xCurrent;
+    }
+}
 
 /*-- 29.01.2007 11:33:16---------------------------------------------------
 //the field command has to be closed (0x14 appeared)
@@ -3727,6 +3774,16 @@ void DomainMapper_Impl::SetCurrentRedlin
         pCurrent->m_sAuthor = sAuthor;
 }
 
+void DomainMapper_Impl::SetCurrentRedlineInitials( rtl::OUString sInitials )
+{
+    if (m_xAnnotationField.is())
+    {
+        m_xAnnotationField->setPropertyValue(
+            ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Initials")),
+            uno::makeAny(sInitials) );
+    }
+}
+
 void DomainMapper_Impl::SetCurrentRedlineDate( rtl::OUString sDate )
 {
     RedlineParamsPtr pCurrent( GetTopRedline(  ) );

Modified: openoffice/trunk/main/writerfilter/source/dmapper/DomainMapper_Impl.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/writerfilter/source/dmapper/DomainMapper_Impl.hxx?rev=1552294&r1=1552293&r2=1552294&view=diff
==============================================================================
--- openoffice/trunk/main/writerfilter/source/dmapper/DomainMapper_Impl.hxx (original)
+++ openoffice/trunk/main/writerfilter/source/dmapper/DomainMapper_Impl.hxx Thu Dec 19 12:31:35 2013
@@ -232,6 +232,13 @@ struct BookmarkInsertPosition
      {}
 };
 
+/// Stores the start/end positions of an annotation before its insertion.
+struct AnnotationPosition
+{
+    ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >  m_xStart;
+    ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >  m_xEnd;
+};
+
 struct RedlineParams
 {
     ::rtl::OUString m_sAuthor;
@@ -346,6 +353,7 @@ private:
 
     //annotation import
     uno::Reference< beans::XPropertySet >                                      m_xAnnotationField;
+    AnnotationPosition                                                         m_aAnnotationPosition;
 
     void                            GetCurrentLocale(::com::sun::star::lang::Locale& rLocale);
     void                            SetNumberFormat( const ::rtl::OUString& rCommand,
@@ -534,6 +542,8 @@ public:
 
     void AddBookmark( const ::rtl::OUString& rBookmarkName, const ::rtl::OUString& rId );
 
+    void AddAnnotationPosition(const bool bStart);
+
     DomainMapperTableManager& getTableManager()
     {
         boost::shared_ptr< DomainMapperTableManager > pMngr = m_aTableManagers.top();
@@ -585,7 +595,7 @@ public:
     void AddNewRedline( );
 
     RedlineParamsPtr GetTopRedline( );
-    
+
     sal_Int32 GetCurrentRedlineToken( ); 
     void SetCurrentRedlineAuthor( rtl::OUString sAuthor );
     void SetCurrentRedlineDate( rtl::OUString sDate );
@@ -593,7 +603,8 @@ public:
     void SetCurrentRedlineToken( sal_Int32 nToken );
     void RemoveCurrentRedline( );
     void ResetParaRedline( );
-    
+    void SetCurrentRedlineInitials( rtl::OUString sInitials );
+
     void ApplySettingsTable();
     SectionPropertyMap * GetSectionContext();
 };

Modified: openoffice/trunk/main/writerfilter/source/ooxml/model.xml
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/writerfilter/source/ooxml/model.xml?rev=1552294&r1=1552293&r2=1552294&view=diff
==============================================================================
--- openoffice/trunk/main/writerfilter/source/ooxml/model.xml (original)
+++ openoffice/trunk/main/writerfilter/source/ooxml/model.xml Thu Dec 19 12:31:35 2013
@@ -14445,6 +14445,12 @@
         </attribute>
         <ref name="CT_MarkupRange"/>
       </define>
+      <define name="CT_MarkupRangeCommentStart">
+        <ref name="CT_Markup"/>
+      </define>
+      <define name="CT_MarkupRangeCommentEnd">
+        <ref name="CT_Markup"/>
+      </define>
       <define name="CT_BookmarkRange">
         <ref name="CT_MarkupRangeBookmark"/>
         <optional>
@@ -14608,10 +14614,10 @@
             <ref name="CT_MarkupRange"/>
           </element>
           <element name="commentRangeStart">
-            <ref name="CT_MarkupRange"/>
+            <ref name="CT_MarkupRangeCommentStart"/>
           </element>
           <element name="commentRangeEnd">
-            <ref name="CT_MarkupRange"/>
+            <ref name="CT_MarkupRangeCommentEnd"/>
           </element>
           <element name="customXmlInsRangeStart">
             <ref name="CT_TrackChange"/>
@@ -21829,6 +21835,12 @@
     <resource name="CT_MarkupRangeBookmark" resource="Properties" tag="redline">
       <attribute name="id" tokenid="rtf:IBKL"/>
     </resource>
+    <resource name="CT_MarkupRangeCommentStart" resource="Properties" tag="content">
+      <attribute name="id" tokenid="ooxml:EG_RangeMarkupElements_commentRangeStart"/>
+    </resource>
+    <resource name="CT_MarkupRangeCommentEnd" resource="Properties" tag="content">
+      <attribute name="id" tokenid="ooxml:EG_RangeMarkupElements_commentRangeEnd"/>
+    </resource>
     <resource name="CT_BookmarkRange" resource="Properties" tag="reference">
       <type name="Bookmark"/>
       <attribute name="colFirst" tokenid="ooxml:CT_BookmarkRange_colFirst"/>

Modified: openoffice/trunk/main/xmloff/inc/txtflde.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/xmloff/inc/txtflde.hxx?rev=1552294&r1=1552293&r2=1552294&view=diff
==============================================================================
--- openoffice/trunk/main/xmloff/inc/txtflde.hxx (original)
+++ openoffice/trunk/main/xmloff/inc/txtflde.hxx Thu Dec 19 12:31:35 2013
@@ -434,109 +434,104 @@ protected:
 						   ::com::sun::star::beans::XPropertySet > & xPropSet);
 
 
-	/// explode a field master name into field type and field name
-	sal_Bool ExplodeFieldMasterName(
-		const ::rtl::OUString& sMasterName,	/// name as returned by SO API
-		::rtl::OUString& sFieldType,		/// out: field type
-		::rtl::OUString& sVarName);			/// out: variable name
-
-	/// make reference name for a foot- or endnote
-	static ::rtl::OUString MakeFootnoteRefName(sal_Int16 nSeqNo);
-
-	/// make reference name for a sequence field
-	static ::rtl::OUString MakeSequenceRefName(sal_Int16 nSeqNo, 
-											  const ::rtl::OUString& rSeqName);
-
-private:	
-	// constants
-
-	// service names
-	const ::rtl::OUString sServicePrefix;
-	const ::rtl::OUString sFieldMasterPrefix;
-	const ::rtl::OUString sPresentationServicePrefix;
-
-	// property names
-	const ::rtl::OUString sPropertyAdjust;
-	const ::rtl::OUString sPropertyAuthor;
-	const ::rtl::OUString sPropertyChapterFormat;
-	const ::rtl::OUString sPropertyChapterNumberingLevel;
-	const ::rtl::OUString sPropertyCharStyleNames;
-	const ::rtl::OUString sPropertyCondition;
-	const ::rtl::OUString sPropertyContent;
-	const ::rtl::OUString sPropertyDataBaseName;
-	const ::rtl::OUString sPropertyDataBaseURL;
-	const ::rtl::OUString sPropertyDataColumnName;
-	const ::rtl::OUString sPropertyDataCommandType;
-	const ::rtl::OUString sPropertyDataTableName;
-	const ::rtl::OUString sPropertyDate;
-	const ::rtl::OUString sPropertyDateTime;
-	const ::rtl::OUString sPropertyDateTimeValue;
-	const ::rtl::OUString sPropertyDDECommandElement;
-	const ::rtl::OUString sPropertyDDECommandFile;
-	const ::rtl::OUString sPropertyDDECommandType;
-	const ::rtl::OUString sPropertyDependentTextFields;
-	const ::rtl::OUString sPropertyFalseContent;
-	const ::rtl::OUString sPropertyFields;
-	const ::rtl::OUString sPropertyFieldSubType;
-	const ::rtl::OUString sPropertyFileFormat;
-	const ::rtl::OUString sPropertyFullName;
-	const ::rtl::OUString sPropertyHint;
-	const ::rtl::OUString sPropertyInstanceName;
-	const ::rtl::OUString sPropertyIsAutomaticUpdate;
-	const ::rtl::OUString sPropertyIsConditionTrue;
-	const ::rtl::OUString sPropertyIsDataBaseFormat;
-	const ::rtl::OUString sPropertyIsDate;
-	const ::rtl::OUString sPropertyIsExpression;
-	const ::rtl::OUString sPropertyIsFixed;
-	const ::rtl::OUString sPropertyIsFixedLanguage;
-	const ::rtl::OUString sPropertyIsHidden;
-	const ::rtl::OUString sPropertyIsInput;
-	const ::rtl::OUString sPropertyIsShowFormula;
-	const ::rtl::OUString sPropertyIsVisible;
-	const ::rtl::OUString sPropertyItems;
-	const ::rtl::OUString sPropertyLevel;
-	const ::rtl::OUString sPropertyMacro;
-	const ::rtl::OUString sPropertyMeasureKind;
-	const ::rtl::OUString sPropertyName;
-	const ::rtl::OUString sPropertyNumberFormat;
-	const ::rtl::OUString sPropertyNumberingSeparator;
-	const ::rtl::OUString sPropertyNumberingType;
-	const ::rtl::OUString sPropertyOffset;
-	const ::rtl::OUString sPropertyOn;
-	const ::rtl::OUString sPropertyPlaceholder;
-	const ::rtl::OUString sPropertyPlaceholderType;
-	const ::rtl::OUString sPropertyReferenceFieldPart;
-	const ::rtl::OUString sPropertyReferenceFieldSource;
-	const ::rtl::OUString sPropertyReferenceFieldType;
-	const ::rtl::OUString sPropertyRevision;
-	const ::rtl::OUString sPropertyScriptType;
-	const ::rtl::OUString sPropertySelectedItem;
-	const ::rtl::OUString sPropertySequenceNumber;
-	const ::rtl::OUString sPropertySequenceValue;
-	const ::rtl::OUString sPropertySetNumber;
-	const ::rtl::OUString sPropertySourceName;
-	const ::rtl::OUString sPropertySubType;
-	const ::rtl::OUString sPropertyTargetFrame;
-	const ::rtl::OUString sPropertyTrueContent;
-	const ::rtl::OUString sPropertyURL;
-	const ::rtl::OUString sPropertyURLContent;
-	const ::rtl::OUString sPropertyUserText;
-	const ::rtl::OUString sPropertyValue;
-	const ::rtl::OUString sPropertyVariableName;
-	const ::rtl::OUString sPropertyVariableSubType;
+    /// explode a field master name into field type and field name
+    sal_Bool ExplodeFieldMasterName(
+        const ::rtl::OUString& sMasterName,	/// name as returned by SO API
+        ::rtl::OUString& sFieldType,		/// out: field type
+        ::rtl::OUString& sVarName);			/// out: variable name
+
+    /// make reference name for a foot- or endnote
+    static ::rtl::OUString MakeFootnoteRefName(sal_Int16 nSeqNo);
+
+    /// make reference name for a sequence field
+    static ::rtl::OUString MakeSequenceRefName(
+        sal_Int16 nSeqNo,
+        const ::rtl::OUString& rSeqName );
+
+private:
+    // service names
+    const ::rtl::OUString sServicePrefix;
+    const ::rtl::OUString sFieldMasterPrefix;
+    const ::rtl::OUString sPresentationServicePrefix;
+
+    // property names
+    const ::rtl::OUString sPropertyAdjust;
+    const ::rtl::OUString sPropertyAuthor;
+    const ::rtl::OUString sPropertyChapterFormat;
+    const ::rtl::OUString sPropertyChapterNumberingLevel;
+    const ::rtl::OUString sPropertyCharStyleNames;
+    const ::rtl::OUString sPropertyCondition;
+    const ::rtl::OUString sPropertyContent;
+    const ::rtl::OUString sPropertyDataBaseName;
+    const ::rtl::OUString sPropertyDataBaseURL;
+    const ::rtl::OUString sPropertyDataColumnName;
+    const ::rtl::OUString sPropertyDataCommandType;
+    const ::rtl::OUString sPropertyDataTableName;
+    const ::rtl::OUString sPropertyDate;
+    const ::rtl::OUString sPropertyDateTime;
+    const ::rtl::OUString sPropertyDateTimeValue;
+    const ::rtl::OUString sPropertyDDECommandElement;
+    const ::rtl::OUString sPropertyDDECommandFile;
+    const ::rtl::OUString sPropertyDDECommandType;
+    const ::rtl::OUString sPropertyDependentTextFields;
+    const ::rtl::OUString sPropertyFalseContent;
+    const ::rtl::OUString sPropertyFields;
+    const ::rtl::OUString sPropertyFieldSubType;
+    const ::rtl::OUString sPropertyFileFormat;
+    const ::rtl::OUString sPropertyFullName;
+    const ::rtl::OUString sPropertyHint;
+    const ::rtl::OUString sPropertyInitials;
+    const ::rtl::OUString sPropertyInstanceName;
+    const ::rtl::OUString sPropertyIsAutomaticUpdate;
+    const ::rtl::OUString sPropertyIsConditionTrue;
+    const ::rtl::OUString sPropertyIsDataBaseFormat;
+    const ::rtl::OUString sPropertyIsDate;
+    const ::rtl::OUString sPropertyIsExpression;
+    const ::rtl::OUString sPropertyIsFixed;
+    const ::rtl::OUString sPropertyIsFixedLanguage;
+    const ::rtl::OUString sPropertyIsHidden;
+    const ::rtl::OUString sPropertyIsInput;
+    const ::rtl::OUString sPropertyIsShowFormula;
+    const ::rtl::OUString sPropertyIsVisible;
+    const ::rtl::OUString sPropertyItems;
+    const ::rtl::OUString sPropertyLevel;
+    const ::rtl::OUString sPropertyMacro;
+    const ::rtl::OUString sPropertyMeasureKind;
+    const ::rtl::OUString sPropertyName;
+    const ::rtl::OUString sPropertyNumberFormat;
+    const ::rtl::OUString sPropertyNumberingSeparator;
+    const ::rtl::OUString sPropertyNumberingType;
+    const ::rtl::OUString sPropertyOffset;
+    const ::rtl::OUString sPropertyOn;
+    const ::rtl::OUString sPropertyPlaceholder;
+    const ::rtl::OUString sPropertyPlaceholderType;
+    const ::rtl::OUString sPropertyReferenceFieldPart;
+    const ::rtl::OUString sPropertyReferenceFieldSource;
+    const ::rtl::OUString sPropertyReferenceFieldType;
+    const ::rtl::OUString sPropertyRevision;
+    const ::rtl::OUString sPropertyScriptType;
+    const ::rtl::OUString sPropertySelectedItem;
+    const ::rtl::OUString sPropertySequenceNumber;
+    const ::rtl::OUString sPropertySequenceValue;
+    const ::rtl::OUString sPropertySetNumber;
+    const ::rtl::OUString sPropertySourceName;
+    const ::rtl::OUString sPropertySubType;
+    const ::rtl::OUString sPropertyTargetFrame;
+    const ::rtl::OUString sPropertyTrueContent;
+    const ::rtl::OUString sPropertyURL;
+    const ::rtl::OUString sPropertyURLContent;
+    const ::rtl::OUString sPropertyUserText;
+    const ::rtl::OUString sPropertyValue;
+    const ::rtl::OUString sPropertyVariableName;
+    const ::rtl::OUString sPropertyVariableSubType;
     const ::rtl::OUString sPropertyHelp;
     const ::rtl::OUString sPropertyTooltip;
     const ::rtl::OUString sPropertyTextRange;
 
-	const ::rtl::OUString sEmpty;
+    const ::rtl::OUString sEmpty;
 
-	XMLPropertyState* pCombinedCharactersPropertyState;
+    XMLPropertyState* pCombinedCharactersPropertyState;
 
 };
 
-
-
-
-
-
 #endif

Modified: openoffice/trunk/main/xmloff/inc/txtfldi.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/xmloff/inc/txtfldi.hxx?rev=1552294&r1=1552293&r2=1552294&view=diff
==============================================================================
--- openoffice/trunk/main/xmloff/inc/txtfldi.hxx (original)
+++ openoffice/trunk/main/xmloff/inc/txtfldi.hxx Thu Dec 19 12:31:35 2013
@@ -1342,30 +1342,40 @@ protected:
 };
 
 
-/** Import an annotation field (<text:annotation>) */
+/** Import an annotation field (<office:annotation>) */
 class XMLAnnotationImportContext : public XMLTextFieldImportContext
 {
-	const ::rtl::OUString sPropertyAuthor;
-	const ::rtl::OUString sPropertyContent;
-	const ::rtl::OUString sPropertyDate;
-	const ::rtl::OUString sPropertyTextRange;
-
-	::rtl::OUStringBuffer aAuthorBuffer;
-	::rtl::OUStringBuffer aTextBuffer;
-	::rtl::OUStringBuffer aDateBuffer;
-
-	com::sun::star::uno::Reference < com::sun::star::beans::XPropertySet > mxField;
-	com::sun::star::uno::Reference < com::sun::star::text::XTextCursor >  mxCursor;
-	com::sun::star::uno::Reference < com::sun::star::text::XTextCursor >  mxOldCursor;
+    const ::rtl::OUString sPropertyName;
+    const ::rtl::OUString sPropertyAuthor;
+    const ::rtl::OUString sPropertyInitials;
+    const ::rtl::OUString sPropertyContent;
+    const ::rtl::OUString sPropertyDate;
+    const ::rtl::OUString sPropertyTextRange;
+
+    ::rtl::OUString aName;
+
+    ::rtl::OUStringBuffer aAuthorBuffer;
+    ::rtl::OUStringBuffer aInitialsBuffer;
+    ::rtl::OUStringBuffer aTextBuffer;
+    ::rtl::OUStringBuffer aDateBuffer;
+
+    com::sun::star::uno::Reference < com::sun::star::beans::XPropertySet > mxField;
+    com::sun::star::uno::Reference < com::sun::star::text::XTextCursor >  mxCursor;
+    com::sun::star::uno::Reference < com::sun::star::text::XTextCursor >  mxOldCursor;
+    /// If this is an annotation end, then position of the start.
+    com::sun::star::uno::Reference < com::sun::star::text::XTextContent >  m_xStart;
+    const sal_uInt16 m_nToken;
 
 public:
 
-	TYPEINFO();
+    TYPEINFO();
 
-	XMLAnnotationImportContext(SvXMLImport& rImport,
-							   XMLTextImportHelper& rHlp,
-							   sal_uInt16 nPrfx,
-							   const ::rtl::OUString& sLocalName);
+    XMLAnnotationImportContext(
+        SvXMLImport& rImport,
+        XMLTextImportHelper& rHlp,
+        sal_uInt16 nToken,
+        sal_uInt16 nPrfx,
+        const ::rtl::OUString& sLocalName);
 
 protected:
 

Modified: openoffice/trunk/main/xmloff/inc/xmloff/odffields.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/xmloff/inc/xmloff/odffields.hxx?rev=1552294&r1=1552293&r2=1552294&view=diff
==============================================================================
--- openoffice/trunk/main/xmloff/inc/xmloff/odffields.hxx (original)
+++ openoffice/trunk/main/xmloff/inc/xmloff/odffields.hxx Thu Dec 19 12:31:35 2013
@@ -46,4 +46,6 @@
 
 #define ODF_PAGEREF "vnd.oasis.opendocument.field.PAGEREF"
 
+#define ODF_COMMENTRANGE "vnd.oasis.opendocument.field.COMMENTRANGE"
+
 #endif /*  _ODFFIELDS_HXX */

Modified: openoffice/trunk/main/xmloff/inc/xmloff/txtimp.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/xmloff/inc/xmloff/txtimp.hxx?rev=1552294&r1=1552293&r2=1552294&view=diff
==============================================================================
--- openoffice/trunk/main/xmloff/inc/xmloff/txtimp.hxx (original)
+++ openoffice/trunk/main/xmloff/inc/xmloff/txtimp.hxx Thu Dec 19 12:31:35 2013
@@ -224,7 +224,9 @@ enum XMLTextPElemTokens
 	XML_TOK_TEXT_SHEET_NAME,
 	XML_TOK_TEXT_BIBLIOGRAPHY_MARK,
 	XML_TOK_TEXT_ANNOTATION,
-	XML_TOK_TEXT_SCRIPT,
+    XML_TOK_TEXT_ANNOTATION_END,
+    XML_TOK_TEXT_NAME,
+    XML_TOK_TEXT_SCRIPT,
     XML_TOK_TEXT_TABLE_FORMULA,
     XML_TOK_TEXT_DROPDOWN,
 

Modified: openoffice/trunk/main/xmloff/inc/xmloff/xmltoken.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/xmloff/inc/xmloff/xmltoken.hxx?rev=1552294&r1=1552293&r2=1552294&view=diff
==============================================================================
--- openoffice/trunk/main/xmloff/inc/xmloff/xmltoken.hxx (original)
+++ openoffice/trunk/main/xmloff/inc/xmloff/xmltoken.hxx Thu Dec 19 12:31:35 2013
@@ -227,6 +227,7 @@ namespace xmloff { namespace token {
         XML_ANIMATION_STOP_INSIDE,
         XML_ANIMATIONS,
         XML_ANNOTATION,
+        XML_ANNOTATION_END,
         XML_ANNOTATIONS,
         XML_ANNOTE,
         XML_APPEAR,

Modified: openoffice/trunk/main/xmloff/source/core/xmltoken.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/xmloff/source/core/xmltoken.cxx?rev=1552294&r1=1552293&r2=1552294&view=diff
==============================================================================
--- openoffice/trunk/main/xmloff/source/core/xmltoken.cxx (original)
+++ openoffice/trunk/main/xmloff/source/core/xmltoken.cxx Thu Dec 19 12:31:35 2013
@@ -235,6 +235,7 @@ namespace xmloff { namespace token {
         TOKEN( "animation-stop-inside",           XML_ANIMATION_STOP_INSIDE ),
         TOKEN( "animations",                      XML_ANIMATIONS ),
         TOKEN( "annotation",                      XML_ANNOTATION ),
+        TOKEN( "annotation-end",                  XML_ANNOTATION_END ),
         TOKEN( "annotations",                     XML_ANNOTATIONS ),
         TOKEN( "annote",                          XML_ANNOTE ),
         TOKEN( "appear",                          XML_APPEAR ),

Modified: openoffice/trunk/main/xmloff/source/text/txtflde.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/xmloff/source/text/txtflde.cxx?rev=1552294&r1=1552293&r2=1552294&view=diff
==============================================================================
--- openoffice/trunk/main/xmloff/source/text/txtflde.cxx (original)
+++ openoffice/trunk/main/xmloff/source/text/txtflde.cxx Thu Dec 19 12:31:35 2013
@@ -311,6 +311,7 @@ XMLTextFieldExport::XMLTextFieldExport( 
 	sPropertyFileFormat(RTL_CONSTASCII_USTRINGPARAM("FileFormat")),
 	sPropertyFullName(RTL_CONSTASCII_USTRINGPARAM("FullName")),
 	sPropertyHint(RTL_CONSTASCII_USTRINGPARAM("Hint")),
+    sPropertyInitials(RTL_CONSTASCII_USTRINGPARAM("Initials")),
 	sPropertyInstanceName(RTL_CONSTASCII_USTRINGPARAM("InstanceName")),
 	sPropertyIsAutomaticUpdate(RTL_CONSTASCII_USTRINGPARAM("IsAutomaticUpdate")),
 	sPropertyIsConditionTrue(RTL_CONSTASCII_USTRINGPARAM("IsConditionTrue")),
@@ -1730,13 +1731,18 @@ void XMLTextFieldExport::ExportFieldHelp
 		DBG_ASSERT(sPresentation.equals(sEmpty),
 				   "Unexpected presentation for annotation field");
 
-		// annotation element + content
-		SvXMLElementExport aElem(GetExport(), XML_NAMESPACE_OFFICE,
-								 XML_ANNOTATION, sal_False, sal_True);
+        // annotation element + content
+        OUString aAnnotationName;
+        rPropSet->getPropertyValue(sPropertyName) >>= aAnnotationName;
+        if ( aAnnotationName.getLength() > 0 )
+        {
+            GetExport().AddAttribute( XML_NAMESPACE_OFFICE, XML_NAME, aAnnotationName );
+        }
+        SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_OFFICE, XML_ANNOTATION, sal_False, sal_True );
 
 		// author
 		OUString aAuthor( GetStringProperty(sPropertyAuthor, rPropSet) );
-		if( aAuthor.getLength() )
+		if ( aAuthor.getLength() > 0 )
 		{
 			SvXMLElementExport aCreatorElem( GetExport(), XML_NAMESPACE_DC,
 											  XML_CREATOR, sal_True,
@@ -1757,6 +1763,21 @@ void XMLTextFieldExport::ExportFieldHelp
 			GetExport().Characters(aBuffer.makeStringAndClear());
 		}
 
+        // initials
+        {
+            OUString aInitials( GetStringProperty(sPropertyInitials, rPropSet) );
+            if ( aInitials.getLength() > 0 )
+            {
+                SvXMLElementExport aCreatorElem(
+                    GetExport(),
+                    XML_NAMESPACE_TEXT,
+                    XML_SENDER_INITIALS,
+                    sal_True,
+                    sal_False );
+                GetExport().Characters(aInitials);
+            }
+        }
+
 		com::sun::star::uno::Reference < com::sun::star::text::XText > xText;
 		try
 		{

Modified: openoffice/trunk/main/xmloff/source/text/txtfldi.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/xmloff/source/text/txtfldi.cxx?rev=1552294&r1=1552293&r2=1552294&view=diff
==============================================================================
--- openoffice/trunk/main/xmloff/source/text/txtfldi.cxx (original)
+++ openoffice/trunk/main/xmloff/source/text/txtfldi.cxx Thu Dec 19 12:31:35 2013
@@ -153,6 +153,7 @@ const sal_Char sAPI_is_fixed[]			= "IsFi
 const sal_Char sAPI_content[]			= "Content";
 const sal_Char sAPI_value[]				= "Value";
 const sal_Char sAPI_author[]			= "Author";
+const sal_Char sAPI_initials[]          = "Initials";
 const sal_Char sAPI_full_name[]			= "FullName";
 const sal_Char sAPI_place_holder_type[] = "PlaceHolderType";
 const sal_Char sAPI_place_holder[]		= "PlaceHolder";
@@ -560,10 +561,11 @@ XMLTextFieldImportContext::CreateTextFie
 															  nPrefix, rName );
 			break;
 
-		case XML_TOK_TEXT_ANNOTATION:
-			pContext = new XMLAnnotationImportContext( rImport, rHlp,
-													   nPrefix, rName);
-			break;
+        case XML_TOK_TEXT_ANNOTATION:
+        case XML_TOK_TEXT_ANNOTATION_END:
+            pContext =
+                new XMLAnnotationImportContext( rImport, rHlp, nToken, nPrefix, rName);
+            break;
 
 		case XML_TOK_TEXT_SCRIPT:
 			pContext = new XMLScriptImportContext( rImport, rHlp,
@@ -3629,19 +3631,21 @@ const sal_Char* XMLBibliographyFieldImpo
 TYPEINIT1(XMLAnnotationImportContext, XMLTextFieldImportContext);
 
 XMLAnnotationImportContext::XMLAnnotationImportContext(
-	SvXMLImport& rImport,
-	XMLTextImportHelper& rHlp,
-	sal_uInt16 nPrfx,
-	const OUString& sLocalName) :
-		XMLTextFieldImportContext(rImport, rHlp, sAPI_annotation, 
-								  nPrfx, sLocalName), 
-		sPropertyAuthor(RTL_CONSTASCII_USTRINGPARAM(sAPI_author)),
-		sPropertyContent(RTL_CONSTASCII_USTRINGPARAM(sAPI_content)),
-		// why is there no UNO_NAME_DATE_TIME, but only UNO_NAME_DATE_TIME_VALUE?
-		sPropertyDate(RTL_CONSTASCII_USTRINGPARAM(sAPI_date_time_value)),
-		sPropertyTextRange(RTL_CONSTASCII_USTRINGPARAM(sAPI_TextRange))
+    SvXMLImport& rImport,
+    XMLTextImportHelper& rHlp,
+    sal_uInt16 nToken,
+    sal_uInt16 nPrfx,
+    const OUString& sLocalName)
+    : XMLTextFieldImportContext(rImport, rHlp, sAPI_annotation, nPrfx, sLocalName)
+    , sPropertyName(RTL_CONSTASCII_USTRINGPARAM(sAPI_name))
+    , sPropertyAuthor(RTL_CONSTASCII_USTRINGPARAM(sAPI_author))
+    , sPropertyInitials(RTL_CONSTASCII_USTRINGPARAM(sAPI_initials))
+    , sPropertyContent(RTL_CONSTASCII_USTRINGPARAM(sAPI_content))
+    , sPropertyDate(RTL_CONSTASCII_USTRINGPARAM(sAPI_date_time_value))
+    , sPropertyTextRange(RTL_CONSTASCII_USTRINGPARAM(sAPI_TextRange))
+    , m_nToken( nToken )
 {
-	bValid = sal_True;
+    bValid = sal_True;
 
     // remember old list item and block (#91964#) and reset them
     // for the text frame
@@ -3649,139 +3653,214 @@ XMLAnnotationImportContext::XMLAnnotatio
     GetImport().GetTextImport()->PushListContext();
 }
 
-void XMLAnnotationImportContext::ProcessAttribute( 
-	sal_uInt16,
-	const OUString& )
-{
-	// ignore
+void XMLAnnotationImportContext::ProcessAttribute(
+    sal_uInt16 nToken,
+    const OUString& rValue )
+ {
+    if ( nToken == XML_TOK_TEXT_NAME )
+    {
+        aName = rValue;
+    }
 }
 
 SvXMLImportContext* XMLAnnotationImportContext::CreateChildContext(
-	sal_uInt16 nPrefix,
-	const OUString& rLocalName,
-	const Reference<XAttributeList >& xAttrList )
+    sal_uInt16 nPrefix,
+    const OUString& rLocalName,
+    const Reference<XAttributeList >& xAttrList )
 {
-	SvXMLImportContext *pContext = 0;
-	if( XML_NAMESPACE_DC == nPrefix )
-	{
-		if( IsXMLToken( rLocalName, XML_CREATOR ) )
-			pContext = new XMLStringBufferImportContext(GetImport(), nPrefix, 
-											rLocalName, aAuthorBuffer);
-		else if( IsXMLToken( rLocalName, XML_DATE ) )
-			pContext = new XMLStringBufferImportContext(GetImport(), nPrefix, 
-											rLocalName, aDateBuffer);
-	}
+    SvXMLImportContext *pContext = 0;
+    if( XML_NAMESPACE_DC == nPrefix )
+    {
+        if( IsXMLToken( rLocalName, XML_CREATOR ) )
+        {
+            pContext =
+                new XMLStringBufferImportContext( GetImport(), nPrefix, rLocalName, aAuthorBuffer);
+        }
+        else if( IsXMLToken( rLocalName, XML_DATE ) )
+        {
+            pContext =
+                new XMLStringBufferImportContext( GetImport(), nPrefix, rLocalName, aDateBuffer);
+        }
+    }
+    else if ( XML_NAMESPACE_TEXT == nPrefix )
+    {
+        if( IsXMLToken( rLocalName, XML_SENDER_INITIALS ) )
+        {
+            pContext =
+                new XMLStringBufferImportContext( GetImport(), nPrefix, rLocalName, aInitialsBuffer);
+        }
+    }
 
-	if( !pContext )
-	{
-		try
-		{
-			if ( !mxField.is() )
-				CreateField( mxField, sServicePrefix + GetServiceName() );
-			Any aAny = mxField->getPropertyValue( sPropertyTextRange );
-			Reference< XText > xText;
-			aAny >>= xText;
-			if( xText.is() )
-			{
-				UniReference < XMLTextImportHelper > xTxtImport = GetImport().GetTextImport();
-				if( !mxCursor.is() )
-				{
-					mxOldCursor = xTxtImport->GetCursor();
-					mxCursor = xText->createTextCursor();
-				}
+    if( !pContext )
+    {
+        try
+        {
+            if ( !mxField.is() )
+                CreateField( mxField, sServicePrefix + GetServiceName() );
+            Any aAny = mxField->getPropertyValue( sPropertyTextRange );
+            Reference< XText > xText;
+            aAny >>= xText;
+            if( xText.is() )
+            {
+                UniReference < XMLTextImportHelper > xTxtImport = GetImport().GetTextImport();
+                if( !mxCursor.is() )
+                {
+                    mxOldCursor = xTxtImport->GetCursor();
+                    mxCursor = xText->createTextCursor();
+                }
 
-				if( mxCursor.is() )
-				{
-					xTxtImport->SetCursor( mxCursor );
-					pContext = xTxtImport->CreateTextChildContext( GetImport(), nPrefix, rLocalName, xAttrList );
-				}
-			}
-		}
-		catch ( Exception& ) 
-		{}
+                if( mxCursor.is() )
+                {
+                    xTxtImport->SetCursor( mxCursor );
+                    pContext = xTxtImport->CreateTextChildContext( GetImport(), nPrefix, rLocalName, xAttrList );
+                }
+            }
+        }
+        catch ( Exception& ) 
+        {}
 
-		if( !pContext )
-			pContext = new XMLStringBufferImportContext(GetImport(), nPrefix,  rLocalName, aTextBuffer);
-	}
+        if( !pContext )
+            pContext = new XMLStringBufferImportContext(GetImport(), nPrefix,  rLocalName, aTextBuffer);
+    }
 
-	return pContext;
+    return pContext;
 }
 
 void XMLAnnotationImportContext::EndElement()
 {
-	DBG_ASSERT(GetServiceName().getLength()>0, "no service name for element!");
-	if( mxCursor.is() )
-	{
-		// delete addition newline
-		const OUString aEmpty;
-		mxCursor->gotoEnd( sal_False );
-		mxCursor->goLeft( 1, sal_True );
-		mxCursor->setString( aEmpty );
+    DBG_ASSERT(GetServiceName().getLength()>0, "no service name for element!");
+    if( mxCursor.is() )
+    {
+        // delete addition newline
+        const OUString aEmpty;
+        mxCursor->gotoEnd( sal_False );
+        mxCursor->goLeft( 1, sal_True );
+        mxCursor->setString( aEmpty );
 
-		// reset cursor
-		GetImport().GetTextImport()->ResetCursor();
-	}
+        // reset cursor
+        GetImport().GetTextImport()->ResetCursor();
+    }
 
-	if( mxOldCursor.is() )
-		GetImport().GetTextImport()->SetCursor( mxOldCursor );
+    if( mxOldCursor.is() )
+        GetImport().GetTextImport()->SetCursor( mxOldCursor );
 
     // reinstall old list item #91964#
     GetImport().GetTextImport()->PopListContext();
 
-	if ( bValid )
-	{
-		if ( mxField.is() || CreateField( mxField, sServicePrefix + GetServiceName() ) )
-		{
-			// set field properties
-			PrepareField( mxField );
+    if ( bValid )
+    {
+        if ( mxField.is() || CreateField( mxField, sServicePrefix + GetServiceName() ) )
+        {
+            // set field properties
+            PrepareField( mxField );
 
-			// attach field to document
-			Reference < XTextContent > xTextContent( mxField, UNO_QUERY );
+            // attach field to document
+            Reference < XTextContent > xTextContent( mxField, UNO_QUERY );
 
-			// workaround for #80606#
-			try
-			{
-				GetImportHelper().InsertTextContent( xTextContent );
-			}
-			catch (lang::IllegalArgumentException)
-			{
-				// ignore
-			}
-		}
-	}
-	else
-		GetImportHelper().InsertString(GetContent());
+            // workaround for #80606#
+            try
+            {
+                if ( m_nToken == XML_TOK_TEXT_ANNOTATION_END
+                     && m_xStart.is() )
+                {
+                    // So we are ending a previous annotation,
+                    // let's create a text range covering the start and the current position.
+                    uno::Reference<text::XText> xText = GetImportHelper().GetText();
+                    uno::Reference<text::XTextCursor> xCursor = xText->createTextCursorByRange(m_xStart->getAnchor());
+                    xCursor->gotoRange(GetImportHelper().GetCursorAsRange(), true);
+                    uno::Reference<text::XTextRange> xTextRange(xCursor, uno::UNO_QUERY);
+                    xText->insertTextContent( xTextRange, xTextContent, !xCursor->isCollapsed() );
+
+                    // Now we can delete the annotation at the start position.
+                    uno::Reference<lang::XComponent>(m_xStart, uno::UNO_QUERY)->dispose();
+                }
+                else
+                {
+                    GetImportHelper().InsertTextContent( xTextContent );
+                }
+            }
+            catch (lang::IllegalArgumentException)
+            {
+                // ignore
+            }
+        }
+    }
+    else
+        GetImportHelper().InsertString(GetContent());
 }
 
-void XMLAnnotationImportContext::PrepareField( 
-	const Reference<XPropertySet> & xPropertySet)
+void XMLAnnotationImportContext::PrepareField(
+    const Reference<XPropertySet> & xPropertySet)
 {
-	// import (possibly empty) author
-	OUString sAuthor( aAuthorBuffer.makeStringAndClear() );
-	xPropertySet->setPropertyValue(sPropertyAuthor, makeAny(sAuthor));
-
-	DateTime aDateTime;
-	if (SvXMLUnitConverter::convertDateTime(aDateTime, 
-											aDateBuffer.makeStringAndClear()))
-	{
-		/*
-		Date aDate;
-		aDate.Year = aDateTime.Year;
-		aDate.Month = aDateTime.Month;
-		aDate.Day = aDateTime.Day;
-		xPropertySet->setPropertyValue(sPropertyDate, makeAny(aDate));
-		*/
-		xPropertySet->setPropertyValue(sPropertyDate, makeAny(aDateTime));
-	}
-
-	OUString sBuffer = aTextBuffer.makeStringAndClear();
-	if ( sBuffer.getLength() )
-	{
-		// delete last paragraph mark (if necessary)
-		if (sal_Char(0x0a) == sBuffer.getStr()[sBuffer.getLength()-1])
-			sBuffer = sBuffer.copy(0, sBuffer.getLength()-1);
-		xPropertySet->setPropertyValue(sPropertyContent, makeAny(sBuffer));
-	}
+    if ( m_nToken == XML_TOK_TEXT_ANNOTATION_END
+         && aName.getLength() > 0 )
+    {
+        // Search for a previous annotation with the same name.
+        Reference<XTextFieldsSupplier> xTextFieldsSupplier(GetImport().GetModel(), UNO_QUERY);
+        uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
+        uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
+        uno::Reference<beans::XPropertySet> xPrevField;
+        while (xFields->hasMoreElements())
+        {
+            uno::Reference<beans::XPropertySet> xCurrField(xFields->nextElement(), uno::UNO_QUERY);
+            OUString aFieldName;
+            xCurrField->getPropertyValue(sPropertyName) >>= aFieldName;
+            if ( aFieldName == aName )
+            {
+                xPrevField = xCurrField;
+                break;
+            }
+        }
+        if (xPrevField.is())
+        {
+            // copy over the properties.
+            xPropertySet->setPropertyValue(sPropertyAuthor, xPrevField->getPropertyValue(sPropertyAuthor));
+            xPropertySet->setPropertyValue(sPropertyInitials, xPrevField->getPropertyValue(sPropertyInitials));
+            xPropertySet->setPropertyValue(sPropertyDate, xPrevField->getPropertyValue(sPropertyDate));
+            xPropertySet->setPropertyValue(sPropertyName, xPrevField->getPropertyValue(sPropertyName));
+            xPropertySet->setPropertyValue(sPropertyContent, xPrevField->getPropertyValue(sPropertyContent));
+
+            // And save a reference to it, so we can delete it later.
+            m_xStart.set(xPrevField, uno::UNO_QUERY);
+            return;
+        }
+    }
+
+    // import (possibly empty) author
+    OUString sAuthor( aAuthorBuffer.makeStringAndClear() );
+    xPropertySet->setPropertyValue(sPropertyAuthor, makeAny(sAuthor));
+
+    // import (possibly empty) initials
+    OUString sInitials( aInitialsBuffer.makeStringAndClear() );
+    xPropertySet->setPropertyValue(sPropertyInitials, makeAny(sInitials));
+
+    DateTime aDateTime;
+    if (SvXMLUnitConverter::convertDateTime(aDateTime, 
+        aDateBuffer.makeStringAndClear()))
+    {
+        /*
+        Date aDate;
+        aDate.Year = aDateTime.Year;
+        aDate.Month = aDateTime.Month;
+        aDate.Day = aDateTime.Day;
+        xPropertySet->setPropertyValue(sPropertyDate, makeAny(aDate));
+        */
+        xPropertySet->setPropertyValue(sPropertyDate, makeAny(aDateTime));
+    }
+
+    OUString sBuffer = aTextBuffer.makeStringAndClear();
+    if ( sBuffer.getLength() > 0 )
+    {
+        // delete last paragraph mark (if necessary)
+        if (sal_Char(0x0a) == sBuffer.getStr()[sBuffer.getLength()-1])
+            sBuffer = sBuffer.copy(0, sBuffer.getLength()-1);
+        xPropertySet->setPropertyValue(sPropertyContent, makeAny(sBuffer));
+    }
+
+    if ( aName.getLength() > 0 )
+    {
+        xPropertySet->setPropertyValue(sPropertyName, makeAny(aName));
+    }
 }
 
 

Modified: openoffice/trunk/main/xmloff/source/text/txtimp.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/xmloff/source/text/txtimp.cxx?rev=1552294&r1=1552293&r2=1552294&view=diff
==============================================================================
--- openoffice/trunk/main/xmloff/source/text/txtimp.cxx (original)
+++ openoffice/trunk/main/xmloff/source/text/txtimp.cxx Thu Dec 19 12:31:35 2013
@@ -87,13 +87,9 @@
 #include "XMLCalculationSettingsContext.hxx"
 #include <xmloff/formsimp.hxx>
 #include "XMLNumberStylesImport.hxx"
-// --> OD 2006-10-12 #i69629#
 #include <com/sun/star/beans/XPropertyState.hpp>
-// <--
 
-// --> OD 2008-04-25 #refactorlists#
 #include <txtlists.hxx>
-// <--
 #include <xmloff/odffields.hxx>
 #include <comphelper/stlunosequence.hxx>
 
@@ -202,16 +198,13 @@ static __FAR_DATA SvXMLTokenMapEntry aTe
 	{ XML_NAMESPACE_TEXT, XML_SENDER_TITLE, XML_TOK_TEXT_SENDER_TITLE },
 	{ XML_NAMESPACE_TEXT, XML_SENDER_POSITION, XML_TOK_TEXT_SENDER_POSITION },
 	{ XML_NAMESPACE_TEXT, XML_SENDER_EMAIL, XML_TOK_TEXT_SENDER_EMAIL },
-	{ XML_NAMESPACE_TEXT, XML_SENDER_PHONE_PRIVATE,
-	  XML_TOK_TEXT_SENDER_PHONE_PRIVATE },
+	{ XML_NAMESPACE_TEXT, XML_SENDER_PHONE_PRIVATE, XML_TOK_TEXT_SENDER_PHONE_PRIVATE },
 	{ XML_NAMESPACE_TEXT, XML_SENDER_FAX, XML_TOK_TEXT_SENDER_FAX },
 	{ XML_NAMESPACE_TEXT, XML_SENDER_COMPANY, XML_TOK_TEXT_SENDER_COMPANY },
-	{ XML_NAMESPACE_TEXT, XML_SENDER_PHONE_WORK,
-	  XML_TOK_TEXT_SENDER_PHONE_WORK },
+	{ XML_NAMESPACE_TEXT, XML_SENDER_PHONE_WORK, XML_TOK_TEXT_SENDER_PHONE_WORK },
 	{ XML_NAMESPACE_TEXT, XML_SENDER_STREET, XML_TOK_TEXT_SENDER_STREET },
 	{ XML_NAMESPACE_TEXT, XML_SENDER_CITY, XML_TOK_TEXT_SENDER_CITY },
-	{ XML_NAMESPACE_TEXT, XML_SENDER_POSTAL_CODE,
-	  XML_TOK_TEXT_SENDER_POSTAL_CODE },
+	{ XML_NAMESPACE_TEXT, XML_SENDER_POSTAL_CODE, XML_TOK_TEXT_SENDER_POSTAL_CODE },
 	{ XML_NAMESPACE_TEXT, XML_SENDER_COUNTRY, XML_TOK_TEXT_SENDER_COUNTRY },
 	{ XML_NAMESPACE_TEXT, XML_SENDER_STATE_OR_PROVINCE,
 	  XML_TOK_TEXT_SENDER_STATE_OR_PROVINCE },
@@ -275,10 +268,8 @@ static __FAR_DATA SvXMLTokenMapEntry aTe
 	// misc fields
 	{ XML_NAMESPACE_TEXT, XML_PLACEHOLDER, XML_TOK_TEXT_PLACEHOLDER },
 	{ XML_NAMESPACE_TEXT, XML_HIDDEN_TEXT, XML_TOK_TEXT_HIDDEN_TEXT },
-	{ XML_NAMESPACE_TEXT, XML_HIDDEN_PARAGRAPH,
-	  XML_TOK_TEXT_HIDDEN_PARAGRAPH },
-	{ XML_NAMESPACE_TEXT, XML_CONDITIONAL_TEXT,
-	  XML_TOK_TEXT_CONDITIONAL_TEXT },
+	{ XML_NAMESPACE_TEXT, XML_HIDDEN_PARAGRAPH, XML_TOK_TEXT_HIDDEN_PARAGRAPH },
+	{ XML_NAMESPACE_TEXT, XML_CONDITIONAL_TEXT, XML_TOK_TEXT_CONDITIONAL_TEXT },
 	{ XML_NAMESPACE_TEXT, XML_FILE_NAME, XML_TOK_TEXT_FILENAME },
 	{ XML_NAMESPACE_TEXT, XML_CHAPTER,	XML_TOK_TEXT_CHAPTER },
 	{ XML_NAMESPACE_TEXT, XML_TEMPLATE_NAME, XML_TOK_TEXT_TEMPLATENAME },
@@ -297,10 +288,10 @@ static __FAR_DATA SvXMLTokenMapEntry aTe
 	{ XML_NAMESPACE_TEXT, XML_BOOKMARK_REF, XML_TOK_TEXT_BOOKMARK_REF },
 	{ XML_NAMESPACE_TEXT, XML_SEQUENCE_REF, XML_TOK_TEXT_SEQUENCE_REF },
 	{ XML_NAMESPACE_TEXT, XML_NOTE_REF, XML_TOK_TEXT_NOTE_REF },
-	{ XML_NAMESPACE_TEXT, XML_BIBLIOGRAPHY_MARK,
-	  XML_TOK_TEXT_BIBLIOGRAPHY_MARK },
+	{ XML_NAMESPACE_TEXT, XML_BIBLIOGRAPHY_MARK, XML_TOK_TEXT_BIBLIOGRAPHY_MARK },
 	{ XML_NAMESPACE_OFFICE, XML_ANNOTATION, XML_TOK_TEXT_ANNOTATION },
-	{ XML_NAMESPACE_TEXT, XML_SCRIPT, XML_TOK_TEXT_SCRIPT },
+    { XML_NAMESPACE_OFFICE, XML_ANNOTATION_END, XML_TOK_TEXT_ANNOTATION_END },
+    { XML_NAMESPACE_TEXT, XML_SCRIPT, XML_TOK_TEXT_SCRIPT },
     { XML_NAMESPACE_TEXT, XML_TABLE_FORMULA, XML_TOK_TEXT_TABLE_FORMULA },
     { XML_NAMESPACE_TEXT, XML_DROPDOWN, XML_TOK_TEXT_DROPDOWN },
 
@@ -516,6 +507,7 @@ static __FAR_DATA SvXMLTokenMapEntry aTe
     { XML_NAMESPACE_TEXT, XML_CURRENT_VALUE,
                 XML_TOK_TEXTFIELD_CURRENT_VALUE },
     { XML_NAMESPACE_TEXT, XML_TABLE_TYPE, XML_TOK_TEXTFIELD_TABLE_TYPE },
+    { XML_NAMESPACE_OFFICE, XML_NAME, XML_TOK_TEXT_NAME },
 
     XML_TOKEN_MAP_END
 };

Modified: openoffice/trunk/main/xmloff/source/text/txtparae.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/xmloff/source/text/txtparae.cxx?rev=1552294&r1=1552293&r2=1552294&view=diff
==============================================================================
--- openoffice/trunk/main/xmloff/source/text/txtparae.cxx (original)
+++ openoffice/trunk/main/xmloff/source/text/txtparae.cxx Thu Dec 19 12:31:35 2013
@@ -110,6 +110,7 @@
 #include <basegfx/polygon/b2dpolypolygon.hxx>
 #include <basegfx/polygon/b2dpolypolygontools.hxx>
 #include <basegfx/polygon/b2dpolygontools.hxx>
+#include <xmloff/odffields.hxx>
 
 using ::rtl::OUString;
 using ::rtl::OUStringBuffer;
@@ -2215,156 +2216,182 @@ void XMLTextParagraphExport::exportParag
 }
 
 void XMLTextParagraphExport::exportTextRangeEnumeration(
-		const Reference < XEnumeration > & rTextEnum,
-		sal_Bool bAutoStyles, sal_Bool bIsProgress,
-		sal_Bool bPrvChrIsSpc )
+    const Reference < XEnumeration > & rTextEnum,
+    sal_Bool bAutoStyles,
+    sal_Bool bIsProgress,
+    sal_Bool bPrvChrIsSpc )
 {
     static OUString sMeta(RTL_CONSTASCII_USTRINGPARAM("InContentMetadata"));
-	sal_Bool bPrevCharIsSpace = bPrvChrIsSpc;
-
-	while( rTextEnum->hasMoreElements() )
-	{
-		Reference<XPropertySet> xPropSet(rTextEnum->nextElement(), UNO_QUERY);
+    sal_Bool bPrevCharIsSpace = bPrvChrIsSpc;
+    bool bAnnotationStarted = false;
+    
+    while( rTextEnum->hasMoreElements() )
+    {
+        Reference<XPropertySet> xPropSet(rTextEnum->nextElement(), UNO_QUERY);
         Reference < XTextRange > xTxtRange(xPropSet, uno::UNO_QUERY);
-		Reference<XPropertySetInfo> xPropInfo(xPropSet->getPropertySetInfo());
+        Reference<XPropertySetInfo> xPropInfo(xPropSet->getPropertySetInfo());
 
-		if (xPropInfo->hasPropertyByName(sTextPortionType))
-		{
+        if (xPropInfo->hasPropertyByName(sTextPortionType))
+        {
             rtl::OUString sType;
-			xPropSet->getPropertyValue(sTextPortionType) >>= sType;
+            xPropSet->getPropertyValue(sTextPortionType) >>= sType;
 
-			if( sType.equals(sText))
-			{
-				exportTextRange( xTxtRange, bAutoStyles,
-								 bPrevCharIsSpace );
-			}
-			else if( sType.equals(sTextField))
-			{
-                exportTextField( xTxtRange, bAutoStyles, bIsProgress );
-				bPrevCharIsSpace = sal_False;
-			}
-			else if( sType.equals( sFrame ) )
-			{
-				Reference < XEnumeration> xContentEnum;
-				Reference < XContentEnumerationAccess > xCEA( xTxtRange,
-															  UNO_QUERY );
-				if( xCEA.is() )
-					xContentEnum.set(xCEA->createContentEnumeration(
-													sTextContentService ));
-				// frames are never in sections
-				Reference<XTextSection> xSection;
-				if( xContentEnum.is() )
-					exportTextContentEnumeration( xContentEnum,
-											  	  bAutoStyles,
-											  	  xSection, bIsProgress, sal_True,
-											   	  &xPropSet	);
+            if( sType.equals(sText))
+            {
+                exportTextRange( xTxtRange, bAutoStyles, bPrevCharIsSpace );
+            }
+            else if( sType.equals(sTextField))
+            {
+                if ( bAnnotationStarted )
+                {
+                    bAnnotationStarted = false;
+                }
+                else
+                {
+                    exportTextField( xTxtRange, bAutoStyles, bIsProgress );
+                    bPrevCharIsSpace = false;
+                }
+            }
+            else if( sType.equals( sFrame ) )
+            {
+                Reference < XEnumeration> xContentEnum;
+                Reference < XContentEnumerationAccess > xCEA( xTxtRange, UNO_QUERY );
+                if( xCEA.is() )
+                    xContentEnum.set(xCEA->createContentEnumeration( sTextContentService ));
+                // frames are never in sections
+                Reference<XTextSection> xSection;
+                if( xContentEnum.is() )
+                    exportTextContentEnumeration(
+                    xContentEnum,
+                    bAutoStyles,
+                    xSection,
+                    bIsProgress,
+                    sal_True,
+                    &xPropSet );
 
-				bPrevCharIsSpace = sal_False;
-			}
-			else if (sType.equals(sFootnote))
-			{
-				exportTextFootnote(xPropSet,
-								   xTxtRange->getString(),
-								   bAutoStyles, bIsProgress );
-				bPrevCharIsSpace = sal_False;
-			}
-			else if (sType.equals(sBookmark))
-			{
-				exportTextMark(xPropSet,
-							   sBookmark,
-							   lcl_XmlBookmarkElements,
-							   bAutoStyles);
-			}
-			else if (sType.equals(sReferenceMark))
-			{
-				exportTextMark(xPropSet,
-							   sReferenceMark,
-							   lcl_XmlReferenceElements,
-							   bAutoStyles);
-			}
-			else if (sType.equals(sDocumentIndexMark))
-			{
-				pIndexMarkExport->ExportIndexMark(xPropSet,	bAutoStyles);
-			}
-			else if (sType.equals(sRedline))
-			{
-				if (NULL != pRedlineExport)
-					pRedlineExport->ExportChange(xPropSet, bAutoStyles);
-			}
-			else if (sType.equals(sRuby))
-			{
-				exportRuby(xPropSet, bAutoStyles);
-			}
+                bPrevCharIsSpace = sal_False;
+            }
+            else if (sType.equals(sFootnote))
+            {
+                exportTextFootnote( xPropSet, xTxtRange->getString(), bAutoStyles, bIsProgress );
+                bPrevCharIsSpace = sal_False;
+            }
+            else if (sType.equals(sBookmark))
+            {
+                exportTextMark( xPropSet, sBookmark, lcl_XmlBookmarkElements, bAutoStyles );
+            }
+            else if (sType.equals(sReferenceMark))
+            {
+                exportTextMark( xPropSet, sReferenceMark, lcl_XmlReferenceElements, bAutoStyles);
+            }
+            else if (sType.equals(sDocumentIndexMark))
+            {
+                pIndexMarkExport->ExportIndexMark( xPropSet, bAutoStyles);
+            }
+            else if (sType.equals(sRedline))
+            {
+                if (NULL != pRedlineExport)
+                    pRedlineExport->ExportChange( xPropSet, bAutoStyles );
+            }
+            else if (sType.equals(sRuby))
+            {
+                exportRuby( xPropSet, bAutoStyles );
+            }
             else if (sType.equals(sMeta))
             {
-                exportMeta(xPropSet, bAutoStyles, bIsProgress);
+                exportMeta( xPropSet, bAutoStyles, bIsProgress );
             }
-			else if (sType.equals(sTextFieldStart))
-			{
-				Reference<XNamed> xBookmark(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
-				if (xBookmark.is())
+            else if (sType.equals(sTextFieldStart))
+            {
+                Reference< ::com::sun::star::text::XFormField > xFormField(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
+                if ( xFormField.is()
+                     && xFormField->getFieldType().equalsAscii( ODF_COMMENTRANGE ) )
                 {
-					GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NAME, xBookmark->getName());
-				}
-				Reference< ::com::sun::star::text::XFormField > xFormField(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
-				if (xFormField.is())
+                    exportTextField( xTxtRange, bAutoStyles, bIsProgress );
+                    bPrevCharIsSpace = false;
+                    bAnnotationStarted = true;
+                }
+                else
                 {
-					GetExport().AddAttribute(XML_NAMESPACE_FIELD, XML_TYPE, xFormField->getFieldType());
-				}
-				GetExport().StartElement(XML_NAMESPACE_FIELD, XML_FIELDMARK_START, sal_False);
-				if (xFormField.is())
+                    Reference<XNamed> xBookmark(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
+                    if (xBookmark.is())
+                    {
+                        GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NAME, xBookmark->getName());
+                    }
+
+                    if (xFormField.is())
+                    {
+                        GetExport().AddAttribute(XML_NAMESPACE_FIELD, XML_TYPE, xFormField->getFieldType());
+                    }
+
+                    GetExport().StartElement(XML_NAMESPACE_FIELD, XML_FIELDMARK_START, sal_False);
+                    if (xFormField.is())
+                    {
+                        FieldParamExporter(&GetExport(), xFormField->getParameters()).Export();
+                    }
+                    GetExport().EndElement(XML_NAMESPACE_FIELD, XML_FIELDMARK_START, sal_False);
+                }
+            }
+            else if (sType.equals(sTextFieldEnd))
+            {
+                if (bAnnotationStarted)
                 {
-                    FieldParamExporter(&GetExport(), xFormField->getParameters()).Export();
-				}
-				GetExport().EndElement(XML_NAMESPACE_FIELD, XML_FIELDMARK_START, sal_False);
-			}
-			else if (sType.equals(sTextFieldEnd))
-			{
-				GetExport().StartElement(XML_NAMESPACE_FIELD, XML_FIELDMARK_END, sal_False);
-				GetExport().EndElement(XML_NAMESPACE_FIELD, XML_FIELDMARK_END, sal_False);
-			}
-			else if (sType.equals(sTextFieldStartEnd))
-			{
-				Reference<XNamed> xBookmark(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
-				if (xBookmark.is())
+                    Reference<XNamed> xBookmark(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
+                    const OUString& rName = xBookmark->getName();
+                    if ( rName.getLength() > 0 )
+                    {
+                        GetExport().AddAttribute(XML_NAMESPACE_OFFICE, XML_NAME, rName);
+                    }
+                    SvXMLElementExport aElem( GetExport(), !bAutoStyles, XML_NAMESPACE_OFFICE, XML_ANNOTATION_END, sal_False, sal_False );
+                }
+                else
                 {
-					GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NAME, xBookmark->getName());
-				}
-				Reference< ::com::sun::star::text::XFormField > xFormField(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
-				if (xFormField.is())
+                    GetExport().StartElement(XML_NAMESPACE_FIELD, XML_FIELDMARK_END, sal_False);
+                    GetExport().EndElement(XML_NAMESPACE_FIELD, XML_FIELDMARK_END, sal_False);
+                }
+            }
+            else if (sType.equals(sTextFieldStartEnd))
+            {
+                Reference<XNamed> xBookmark(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
+                if (xBookmark.is())
                 {
-				    GetExport().AddAttribute(XML_NAMESPACE_FIELD, XML_TYPE, xFormField->getFieldType());
-				}
-				GetExport().StartElement(XML_NAMESPACE_FIELD, XML_FIELDMARK, sal_False);
-				if (xFormField.is())
+                    GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NAME, xBookmark->getName());
+                }
+                Reference< ::com::sun::star::text::XFormField > xFormField(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
+                if (xFormField.is())
+                {
+                    GetExport().AddAttribute(XML_NAMESPACE_FIELD, XML_TYPE, xFormField->getFieldType());
+                }
+                GetExport().StartElement(XML_NAMESPACE_FIELD, XML_FIELDMARK, sal_False);
+                if (xFormField.is())
                 {
                     FieldParamExporter(&GetExport(), xFormField->getParameters()).Export();
-				}
-				GetExport().EndElement(XML_NAMESPACE_FIELD, XML_FIELDMARK, sal_False);
-			}
-			else if (sType.equals(sSoftPageBreak))
-			{
-				exportSoftPageBreak(xPropSet,	bAutoStyles);
-			}
-			else {
-				DBG_ERROR("unknown text portion type");
+                }
+                GetExport().EndElement(XML_NAMESPACE_FIELD, XML_FIELDMARK, sal_False);
             }
-		}
-		else
-		{
-			Reference<XServiceInfo> xServiceInfo( xTxtRange, UNO_QUERY );
-			if( xServiceInfo->supportsService( sTextFieldService ) )
-			{
+            else if (sType.equals(sSoftPageBreak))
+            {
+                exportSoftPageBreak(xPropSet,	bAutoStyles);
+            }
+            else {
+                DBG_ERROR("unknown text portion type");
+            }
+        }
+        else
+        {
+            Reference<XServiceInfo> xServiceInfo( xTxtRange, UNO_QUERY );
+            if( xServiceInfo->supportsService( sTextFieldService ) )
+            {
                 exportTextField( xTxtRange, bAutoStyles, bIsProgress );
-				bPrevCharIsSpace = sal_False;
-			}
-			else
-			{
-				// no TextPortionType property -> non-Writer app -> text
-				exportTextRange( xTxtRange, bAutoStyles, bPrevCharIsSpace );
-			}
-		}
-	}
+                bPrevCharIsSpace = sal_False;
+            }
+            else
+            {
+                // no TextPortionType property -> non-Writer app -> text
+                exportTextRange( xTxtRange, bAutoStyles, bPrevCharIsSpace );
+            }
+        }
+    }
 
 // now that there are nested enumerations for meta(-field), this may be valid!
 //	DBG_ASSERT( !bOpenRuby, "Red Alert: Ruby still open!" );



Mime
View raw message