Return-Path: X-Original-To: apmail-openoffice-commits-archive@www.apache.org Delivered-To: apmail-openoffice-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B24A6101E1 for ; Thu, 19 Dec 2013 12:35:30 +0000 (UTC) Received: (qmail 63564 invoked by uid 500); 19 Dec 2013 12:35:30 -0000 Delivered-To: apmail-openoffice-commits-archive@openoffice.apache.org Received: (qmail 63473 invoked by uid 500); 19 Dec 2013 12:35:30 -0000 Mailing-List: contact commits-help@openoffice.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openoffice.apache.org Delivered-To: mailing list commits@openoffice.apache.org Received: (qmail 63466 invoked by uid 99); 19 Dec 2013 12:35:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Dec 2013 12:35:30 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Dec 2013 12:35:21 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id E46942388980; Thu, 19 Dec 2013 12:33:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@openoffice.apache.org From: orw@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131219123339.E46942388980@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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(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 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(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 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 +#include #include #include @@ -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 xText = m_aAnnotationPosition.m_xStart->getText(); + uno::Reference xCursor = xText->createTextCursorByRange(m_aAnnotationPosition.m_xStart); + xCursor->gotoRange(m_aAnnotationPosition.m_xEnd, true); + uno::Reference xTextRange(xCursor, uno::UNO_QUERY_THROW); + + // Attach the annotation to the range. + uno::Reference xTextAppend = m_aTextAppendStack.top().xTextAppend; + xTextAppend->insertTextContent(xTextRange, uno::Reference(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 xTextAppend = m_aTextAppendStack.top().xTextAppend; + uno::Reference xCurrent; + if (xTextAppend.is()) + { + uno::Reference 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 @@ + + + + + + @@ -14608,10 +14614,10 @@ - + - + @@ -21829,6 +21835,12 @@ + + + + + + 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 () */ +/** Import an annotation field () */ 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& xAttrList ) + sal_uInt16 nPrefix, + const OUString& rLocalName, + const Reference& 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 xText = GetImportHelper().GetText(); + uno::Reference xCursor = xText->createTextCursorByRange(m_xStart->getAnchor()); + xCursor->gotoRange(GetImportHelper().GetCursorAsRange(), true); + uno::Reference xTextRange(xCursor, uno::UNO_QUERY); + xText->insertTextContent( xTextRange, xTextContent, !xCursor->isCollapsed() ); + + // Now we can delete the annotation at the start position. + uno::Reference(m_xStart, uno::UNO_QUERY)->dispose(); + } + else + { + GetImportHelper().InsertTextContent( xTextContent ); + } + } + catch (lang::IllegalArgumentException) + { + // ignore + } + } + } + else + GetImportHelper().InsertString(GetContent()); } -void XMLAnnotationImportContext::PrepareField( - const Reference & xPropertySet) +void XMLAnnotationImportContext::PrepareField( + const Reference & 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(GetImport().GetModel(), UNO_QUERY); + uno::Reference xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference xFields(xFieldsAccess->createEnumeration()); + uno::Reference xPrevField; + while (xFields->hasMoreElements()) + { + uno::Reference 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 #include "XMLNumberStylesImport.hxx" -// --> OD 2006-10-12 #i69629# #include -// <-- -// --> OD 2008-04-25 #refactorlists# #include -// <-- #include #include @@ -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 #include #include +#include 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 xPropSet(rTextEnum->nextElement(), UNO_QUERY); + sal_Bool bPrevCharIsSpace = bPrvChrIsSpc; + bool bAnnotationStarted = false; + + while( rTextEnum->hasMoreElements() ) + { + Reference xPropSet(rTextEnum->nextElement(), UNO_QUERY); Reference < XTextRange > xTxtRange(xPropSet, uno::UNO_QUERY); - Reference xPropInfo(xPropSet->getPropertySetInfo()); + Reference 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 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 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 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 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 xBookmark(xPropSet->getPropertyValue(sBookmark), UNO_QUERY); - if (xBookmark.is()) + Reference 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 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( 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( 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!" );