offapi/com/sun/star/text/textfield/Annotation.idl | 5 +++++ sw/inc/docufld.hxx | 4 +++- sw/inc/unoprnms.hxx | 4 +++- sw/source/core/fields/docufld.cxx | 17 ++++++++++++++--- sw/source/core/unocore/unofield.cxx | 2 +- sw/source/core/unocore/unomap.cxx | 1 + sw/source/core/unocore/unoprnms.cxx | 1 + sw/source/filter/html/htmlfld.cxx | 2 +- sw/source/filter/html/swhtml.cxx | 2 +- sw/source/filter/ww8/docxattributeoutput.cxx | 3 ++- sw/source/filter/ww8/ww8par.cxx | 2 +- sw/source/ui/fldui/fldmgr.cxx | 2 +- sw/source/ui/shells/textfld.cxx | 1 + writerfilter/source/dmapper/DomainMapper.cxx | 3 +++ writerfilter/source/dmapper/DomainMapper_Impl.cxx | 6 ++++++ writerfilter/source/dmapper/DomainMapper_Impl.hxx | 1 + xmloff/inc/txtflde.hxx | 1 + xmloff/inc/txtfldi.hxx | 2 ++ xmloff/source/text/txtflde.cxx | 11 +++++++++++ xmloff/source/text/txtfldi.cxx | 12 ++++++++++++ 20 files changed, 71 insertions(+), 11 deletions(-)
New commits: commit c2a73a4780dbab2abdfb4654ddc2bf1356127eb0 Author: Miklos Vajna <[email protected]> Date: Fri Jul 13 22:01:00 2012 +0200 xmloff: implement import/export of SwPostItField::aInitials Change-Id: Ie28e8e4c2e80d9234cf1ec2ca43dd200cf1d56cb diff --git a/xmloff/inc/txtflde.hxx b/xmloff/inc/txtflde.hxx index 6f85f9e..771ca6c 100644 --- a/xmloff/inc/txtflde.hxx +++ b/xmloff/inc/txtflde.hxx @@ -479,6 +479,7 @@ private: 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; diff --git a/xmloff/inc/txtfldi.hxx b/xmloff/inc/txtfldi.hxx index 02ac73d..7c0e6e6 100644 --- a/xmloff/inc/txtfldi.hxx +++ b/xmloff/inc/txtfldi.hxx @@ -1341,11 +1341,13 @@ protected: class XMLAnnotationImportContext : public XMLTextFieldImportContext { const ::rtl::OUString sPropertyAuthor; + const ::rtl::OUString sPropertyInitials; const ::rtl::OUString sPropertyContent; const ::rtl::OUString sPropertyDate; const ::rtl::OUString sPropertyTextRange; ::rtl::OUStringBuffer aAuthorBuffer; + ::rtl::OUStringBuffer aInitialsBuffer; ::rtl::OUStringBuffer aTextBuffer; ::rtl::OUStringBuffer aDateBuffer; diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx index 410bb05..bc78c34 100644 --- a/xmloff/source/text/txtflde.cxx +++ b/xmloff/source/text/txtflde.cxx @@ -316,6 +316,7 @@ XMLTextFieldExport::XMLTextFieldExport( SvXMLExport& rExp, sPropertyFileFormat(RTL_CONSTASCII_USTRINGPARAM("FileFormat")), sPropertyFullName(RTL_CONSTASCII_USTRINGPARAM("FullName")), sPropertyHint(RTL_CONSTASCII_USTRINGPARAM("Hint")), + sPropertyInitials("Initials"), sPropertyInstanceName(RTL_CONSTASCII_USTRINGPARAM("InstanceName")), sPropertyIsAutomaticUpdate(RTL_CONSTASCII_USTRINGPARAM("IsAutomaticUpdate")), sPropertyIsConditionTrue(RTL_CONSTASCII_USTRINGPARAM("IsConditionTrue")), @@ -1760,6 +1761,16 @@ void XMLTextFieldExport::ExportFieldHelper( GetExport().Characters(aBuffer.makeStringAndClear()); } + // initials + OUString aInitials( GetStringProperty(sPropertyInitials, rPropSet) ); + if( !aInitials.isEmpty() ) + { + 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 { diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx index e162406..9425b79 100644 --- a/xmloff/source/text/txtfldi.cxx +++ b/xmloff/source/text/txtfldi.cxx @@ -158,6 +158,7 @@ const sal_Char sAPI_is_fixed[] = "IsFixed"; 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"; @@ -3633,6 +3634,7 @@ XMLAnnotationImportContext::XMLAnnotationImportContext( XMLTextFieldImportContext(rImport, rHlp, sAPI_annotation, nPrfx, sLocalName), sPropertyAuthor(sAPI_author), + sPropertyInitials(sAPI_initials), sPropertyContent(sAPI_content), // why is there no UNO_NAME_DATE_TIME, but only UNO_NAME_DATE_TIME_VALUE? sPropertyDate(sAPI_date_time_value), @@ -3668,6 +3670,12 @@ SvXMLImportContext* XMLAnnotationImportContext::CreateChildContext( 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 ) { @@ -3758,6 +3766,10 @@ void XMLAnnotationImportContext::PrepareField( 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 (::sax::Converter::convertDateTime(aDateTime, aDateBuffer.makeStringAndClear())) commit 6b919e03880195000716efdf8ce6a47a04664a25 Author: Miklos Vajna <[email protected]> Date: Fri Jul 13 21:42:28 2012 +0200 implement docx import/export of SwPostItField::aInitials Change-Id: I919f5f0c4f6a1f6b1ea6261d9703da7a6c1046d3 diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx index 31a7ec2..a16aabe 100644 --- a/sw/inc/docufld.hxx +++ b/sw/inc/docufld.hxx @@ -545,6 +545,7 @@ public: virtual rtl::OUString GetPar2() const; virtual void SetPar2(const rtl::OUString& rStr); const rtl::OUString& GetTxt() const { return sTxt; } + const rtl::OUString& GetInitials() const; const OutlinerParaObject* GetTextObject() const; void SetTextObject( OutlinerParaObject* pText ); diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index 6bc2774..b13e3c7 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -1799,6 +1799,11 @@ rtl::OUString SwPostItField::GetPar2() const return sTxt; } +const rtl::OUString& SwPostItField::GetInitials() const +{ + return sInitials; +} + const OutlinerParaObject* SwPostItField::GetTextObject() const { return mpText; diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 773078c..06ac408 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3360,7 +3360,8 @@ void DocxAttributeOutput::WritePostitFields() const SwPostItField* f = m_postitFields[ i ]; m_pSerializer->startElementNS( XML_w, XML_comment, FSNS( XML_w, XML_id ), idstr.getStr(), FSNS( XML_w, XML_author ), rtl::OUStringToOString( f->GetPar1(), RTL_TEXTENCODING_UTF8 ).getStr(), - FSNS( XML_w, XML_date ), msfilter::util::DateTimeToOString(f->GetDateTime()).getStr(), FSEND ); + FSNS( XML_w, XML_date ), msfilter::util::DateTimeToOString(f->GetDateTime()).getStr(), + FSNS( XML_w, XML_initials ), rtl::OUStringToOString( f->GetInitials(), RTL_TEXTENCODING_UTF8 ).getStr(), FSEND ); // Check for the text object existing, it seems that it can be NULL when saving a newly created // comment without giving focus back to the main document. As GetTxt() is empty in that case as well, // that is probably a bug in the Writer core. diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 26cec36..e491d7b 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1361,6 +1361,9 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) case NS_ooxml::LN_EG_RangeMarkupElements_commentRangeEnd: m_pImpl->AddAnnotationPosition(false); break; + case NS_ooxml::LN_CT_Comment_initials: + m_pImpl->SetCurrentRedlineInitials(sStringValue); + break; case NS_ooxml::LN_token: m_pImpl->SetCurrentRedlineToken( nIntValue ); break; diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index ca19d9b..472a850 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -3538,6 +3538,12 @@ void DomainMapper_Impl::SetCurrentRedlineAuthor( rtl::OUString sAuthor ) m_xAnnotationField->setPropertyValue("Author", uno::makeAny(sAuthor)); } +void DomainMapper_Impl::SetCurrentRedlineInitials( rtl::OUString sInitials ) +{ + if (m_xAnnotationField.is()) + m_xAnnotationField->setPropertyValue("Initials", uno::makeAny(sInitials)); +} + void DomainMapper_Impl::SetCurrentRedlineDate( rtl::OUString sDate ) { if (!m_xAnnotationField.is()) diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index 2a49c69..ac8fe3c 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -621,6 +621,7 @@ public: void SetCurrentRedlineToken( sal_Int32 nToken ); void RemoveCurrentRedline( ); void ResetParaRedline( ); + void SetCurrentRedlineInitials( rtl::OUString sInitials ); void ApplySettingsTable(); SectionPropertyMap * GetSectionContext(); commit 36270776a68c0cd0f472ebd7124c93d7936caf04 Author: Miklos Vajna <[email protected]> Date: Fri Jul 13 17:52:04 2012 +0200 SwPostItField: added aInitials member Change-Id: I9cc8dcd2c8e1d9074b58195d37289a9b4cfe43cf diff --git a/offapi/com/sun/star/text/textfield/Annotation.idl b/offapi/com/sun/star/text/textfield/Annotation.idl index 399b998..db9d7e2 100644 --- a/offapi/com/sun/star/text/textfield/Annotation.idl +++ b/offapi/com/sun/star/text/textfield/Annotation.idl @@ -38,6 +38,11 @@ published service Annotation /** contains the name of the author of the annotation. */ [property]string Author; + /** contains the initials of the author of the annotation. + + @since LibreOffice 3.7 + */ + [optional, property]string Initials; /** contains the annotation's content */ [property]string Content; diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx index 03f5e52..31a7ec2 100644 --- a/sw/inc/docufld.hxx +++ b/sw/inc/docufld.hxx @@ -520,13 +520,14 @@ class SW_DLLPUBLIC SwPostItField : public SwField { rtl::OUString sTxt; rtl::OUString sAuthor; + rtl::OUString sInitials; DateTime aDateTime; OutlinerParaObject* mpText; SwTextAPIObject* m_pTextObject; public: SwPostItField( SwPostItFieldType*, - const String& rAuthor, const String& rTxt, const DateTime& rDate); + const String& rAuthor, const String& rTxt, const String& rInitials, const DateTime& rDate); ~SwPostItField(); virtual String Expand() const; diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx index 06e1c27..b277f00 100644 --- a/sw/inc/unoprnms.hxx +++ b/sw/inc/unoprnms.hxx @@ -820,7 +820,9 @@ enum SwPropNameIds /* 0751 */ UNO_NAME_HEADER_TEXT_FIRST, /* 0752 */ UNO_NAME_FOOTER_TEXT_FIRST, -/* 0753 */ SW_PROPNAME_END +/* 0753 */ UNO_NAME_INITIALS, + +/* 0754 */ SW_PROPNAME_END // new items in this array must match SwPropNameTab aPropNameTab }; diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index 9310e47..6bc2774 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -1735,8 +1735,8 @@ SwFieldType* SwPostItFieldType::Copy() const --------------------------------------------------------------------*/ SwPostItField::SwPostItField( SwPostItFieldType* pT, - const String& rAuthor, const String& rTxt, const DateTime& rDateTime ) - : SwField( pT ), sTxt( rTxt ), sAuthor( rAuthor ), aDateTime( rDateTime ), mpText(0), m_pTextObject(0) + const String& rAuthor, const String& rTxt, const String& rInitials, const DateTime& rDateTime ) + : SwField( pT ), sTxt( rTxt ), sAuthor( rAuthor ), sInitials( rInitials ), aDateTime( rDateTime ), mpText(0), m_pTextObject(0) { } @@ -1765,7 +1765,7 @@ String SwPostItField::GetDescription() const SwField* SwPostItField::Copy() const { - SwPostItField* pRet = new SwPostItField( (SwPostItFieldType*)GetTyp(), sAuthor, + SwPostItField* pRet = new SwPostItField( (SwPostItFieldType*)GetTyp(), sAuthor, sInitials, sTxt, aDateTime); if (mpText) pRet->SetTextObject( new OutlinerParaObject(*mpText) ); @@ -1827,6 +1827,9 @@ bool SwPostItField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const rAny <<= OUString(sTxt); break; } + case FIELD_PROP_PAR3: + rAny <<= OUString(sInitials); + break; case FIELD_PROP_TEXT: { if ( !m_pTextObject ) @@ -1891,6 +1894,9 @@ bool SwPostItField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) mpText = 0; } break; + case FIELD_PROP_PAR3: + rAny >>= sInitials; + break; case FIELD_PROP_TEXT: OSL_FAIL("Not implemented!"); break; diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index 1940bbe..7793e09 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -1246,7 +1246,7 @@ void SwXTextField::attachToRange( aDateTime.SetSec(m_pProps->pDateTime->Seconds); } pFld = new SwPostItField((SwPostItFieldType*)pFldType, - m_pProps->sPar1, m_pProps->sPar2,aDateTime); + m_pProps->sPar1, m_pProps->sPar2, m_pProps->sPar3, aDateTime); if ( m_pTextObject ) { ((SwPostItField*)pFld)->SetTextObject( m_pTextObject->CreateText() ); diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx index 4d6fd06..25e5dd3 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -1862,6 +1862,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { {SW_PROP_NMID(UNO_NAME_AUTHOR), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, + {SW_PROP_NMID(UNO_NAME_INITIALS), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_DATE_TIME_VALUE), FIELD_PROP_DATE_TIME, CPPU_E2T(CPPUTYPE_DATETIME), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_DATE), FIELD_PROP_DATE, CPPU_E2T(CPPUTYPE_DATE), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_TEXT_RANGE), FIELD_PROP_TEXT, CPPU_E2T(CPPUTYPE_REFINTERFACE), PropertyAttribute::READONLY, 0}, diff --git a/sw/source/core/unocore/unoprnms.cxx b/sw/source/core/unocore/unoprnms.cxx index 11956d1..e6bf6e0 100644 --- a/sw/source/core/unocore/unoprnms.cxx +++ b/sw/source/core/unocore/unoprnms.cxx @@ -792,6 +792,7 @@ const SwPropNameTab aPropNameTab = { /* 0751 FIRST_IS_SHARED */ {MAP_CHAR_LEN("FirstIsShared")}, /* 0752 HEADER_TEXT_FIRST */ {MAP_CHAR_LEN("HeaderTextFirst")}, /* 0753 FOOTER_TEXT_FIRST */ {MAP_CHAR_LEN("FooterTextFirst")}, +/* 0754 UNO_NAME_INITIALS */ {MAP_CHAR_LEN("Initials")}, // new items in this array must match enum SwPropNameIds }; diff --git a/sw/source/filter/html/htmlfld.cxx b/sw/source/filter/html/htmlfld.cxx index 90e16d6..46f1bc9 100644 --- a/sw/source/filter/html/htmlfld.cxx +++ b/sw/source/filter/html/htmlfld.cxx @@ -656,7 +656,7 @@ void SwHTMLParser::InsertComment( const String& rComment, const sal_Char *pTag ) SwPostItField aPostItFld( (SwPostItFieldType*)pDoc->GetSysFldType( RES_POSTITFLD ), - aEmptyStr, aComment, DateTime( DateTime::SYSTEM ) ); + aEmptyStr, aComment, aEmptyStr, DateTime( DateTime::SYSTEM ) ); InsertAttr( SwFmtFld( aPostItFld ) ); if( bMoveFwd ) diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 05d5adb..5f10021 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -5388,7 +5388,7 @@ void SwHTMLParser::ParseMoreMetaOptions() SwPostItField aPostItFld( (SwPostItFieldType*)pDoc->GetSysFldType( RES_POSTITFLD ), - aEmptyStr, sText.makeStringAndClear(), DateTime( DateTime::SYSTEM ) ); + aEmptyStr, sText.makeStringAndClear(), aEmptyStr, DateTime( DateTime::SYSTEM ) ); SwFmtFld aFmtFld( aPostItFld ); InsertAttr( aFmtFld ); } diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 3788906..a710f7a 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1792,7 +1792,7 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes) this->pFmtOfJustInsertedApo = 0; SwPostItField aPostIt( (SwPostItFieldType*)rDoc.GetSysFldType(RES_POSTITFLD), sAuthor, - sTxt, aDate ); + sTxt, aEmptyStr, aDate ); aPostIt.SetTextObject(pOutliner); pCtrlStck->NewAttr(*pPaM->GetPoint(), SvxCharHiddenItem(false, RES_CHRATR_HIDDEN)); diff --git a/sw/source/ui/fldui/fldmgr.cxx b/sw/source/ui/fldui/fldmgr.cxx index 2d30341..e33c78e 100644 --- a/sw/source/ui/fldui/fldmgr.cxx +++ b/sw/source/ui/fldui/fldmgr.cxx @@ -870,7 +870,7 @@ sal_Bool SwFldMgr::InsertFld( const SwInsertFld_Data& rData ) case TYP_POSTITFLD: { SwPostItFieldType* pType = (SwPostItFieldType*)pCurShell->GetFldType(0, RES_POSTITFLD); - pFld = new SwPostItField(pType, rData.sPar1, rData.sPar2, DateTime( DateTime::SYSTEM )); + pFld = new SwPostItField(pType, rData.sPar1, rData.sPar2, aEmptyStr, DateTime( DateTime::SYSTEM )); break; } case TYP_SCRIPTFLD: diff --git a/sw/source/ui/shells/textfld.cxx b/sw/source/ui/shells/textfld.cxx index 21b8149..1292818 100644 --- a/sw/source/ui/shells/textfld.cxx +++ b/sw/source/ui/shells/textfld.cxx @@ -208,6 +208,7 @@ void SwTextShell::ExecField(SfxRequest &rReq) sal_uInt16 nType = 0; String aPar1 = ((SfxStringItem *)pItem)->GetValue(); String aPar2; + String aPar3; sal_Int32 nCommand = 0; if( SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_FIELD_TYPE, _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
