diff options
Diffstat (limited to 'editeng/source/items/flditem.cxx')
-rw-r--r-- | editeng/source/items/flditem.cxx | 59 |
1 files changed, 43 insertions, 16 deletions
diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx index 72a411a56e29..6f51528519d0 100644 --- a/editeng/source/items/flditem.cxx +++ b/editeng/source/items/flditem.cxx @@ -17,7 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <osl/diagnose.h> #include <osl/file.hxx> +#include <utility> #include <vcl/metaact.hxx> #include <svl/numformat.hxx> #include <svl/zforlist.hxx> @@ -29,6 +31,7 @@ #include <editeng/unonames.hxx> #include <tools/debug.hxx> +#include <libxml/xmlwriter.h> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/text/XTextContent.hpp> @@ -265,12 +268,19 @@ bool SvxFieldData::operator==( const SvxFieldData& rFld ) const MetaAction* SvxFieldData::createBeginComment() const { - return new MetaCommentAction( "FIELD_SEQ_BEGIN" ); + return new MetaCommentAction( "FIELD_SEQ_BEGIN"_ostr ); } MetaAction* SvxFieldData::createEndComment() { - return new MetaCommentAction( "FIELD_SEQ_END" ); + return new MetaCommentAction( "FIELD_SEQ_END"_ostr ); +} + +void SvxFieldData::dumpAsXml(xmlTextWriterPtr pWriter) const +{ + (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxFieldData")); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("classId"), BAD_CAST(OString::number(GetClassId()).getStr())); + (void)xmlTextWriterEndElement(pWriter); } @@ -315,6 +325,14 @@ bool SvxFieldItem::operator==( const SfxPoolItem& rItem ) const && ( *mpField == *pOtherFld ); } +void SvxFieldItem::dumpAsXml(xmlTextWriterPtr pWriter) const +{ + (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxFieldItem")); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr())); + if (mpField) + mpField->dumpAsXml(pWriter); + (void)xmlTextWriterEndElement(pWriter); +} // The following are the derivatives of SvxFieldData ... @@ -427,7 +445,7 @@ OUString SvxDateField::GetFormatted( Date const & aDate, SvxDateFormat eFormat, MetaAction* SvxDateField::createBeginComment() const { - return new MetaCommentAction( "FIELD_SEQ_BEGIN" ); + return new MetaCommentAction( "FIELD_SEQ_BEGIN"_ostr ); } SvxURLField::SvxURLField() @@ -436,8 +454,8 @@ SvxURLField::SvxURLField() } -SvxURLField::SvxURLField( const OUString& rURL, const OUString& rRepres, SvxURLFormat eFmt ) - : aURL( rURL ), aRepresentation( rRepres ) +SvxURLField::SvxURLField( OUString _aURL, OUString aRepres, SvxURLFormat eFmt ) + : aURL(std::move( _aURL )), aRepresentation(std::move( aRepres )) { eFormat = eFmt; } @@ -465,12 +483,24 @@ bool SvxURLField::operator==( const SvxFieldData& rOther ) const MetaAction* SvxURLField::createBeginComment() const { // #i46618# Adding target URL to metafile comment - return new MetaCommentAction( "FIELD_SEQ_BEGIN", + return new MetaCommentAction( "FIELD_SEQ_BEGIN"_ostr, 0, reinterpret_cast<const sal_uInt8*>(aURL.getStr()), 2*aURL.getLength() ); } +void SvxURLField::dumpAsXml(xmlTextWriterPtr pWriter) const +{ + (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxURLField")); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("classId"), BAD_CAST(OString::number(GetClassId()).getStr())); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("format"), BAD_CAST(OString::number(static_cast<int>(eFormat)).getStr())); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("url"), BAD_CAST(aURL.toUtf8().getStr())); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("representation"), BAD_CAST(aRepresentation.toUtf8().getStr())); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("targetFrame"), BAD_CAST(aTargetFrame.toUtf8().getStr())); + (void)xmlTextWriterEndElement(pWriter); +} + + // // SvxPageTitleField methods // @@ -489,7 +519,7 @@ bool SvxPageTitleField::operator==( const SvxFieldData& rCmp ) const MetaAction* SvxPageTitleField::createBeginComment() const { - return new MetaCommentAction( "FIELD_SEQ_BEGIN;PageTitleField" ); + return new MetaCommentAction( "FIELD_SEQ_BEGIN;PageTitleField"_ostr ); } // @@ -512,7 +542,7 @@ bool SvxPageField::operator==( const SvxFieldData& rCmp ) const MetaAction* SvxPageField::createBeginComment() const { - return new MetaCommentAction( "FIELD_SEQ_BEGIN;PageField" ); + return new MetaCommentAction( "FIELD_SEQ_BEGIN;PageField"_ostr ); } @@ -542,7 +572,7 @@ bool SvxTimeField::operator==( const SvxFieldData& rCmp ) const MetaAction* SvxTimeField::createBeginComment() const { - return new MetaCommentAction( "FIELD_SEQ_BEGIN" ); + return new MetaCommentAction( "FIELD_SEQ_BEGIN"_ostr ); } SvxFileField::SvxFileField() {} @@ -619,11 +649,8 @@ bool SvxExtTimeField::operator==( const SvxFieldData& rOther ) const OUString SvxExtTimeField::GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLang ) const { - tools::Time aTime( tools::Time::EMPTY ); - if ( eType == SvxTimeType::Fix ) - aTime.SetTime(m_nFixTime); - else - aTime = tools::Time( tools::Time::SYSTEM ); // current time + tools::Time aTime(eType == SvxTimeType::Fix ? tools::Time::fromEncodedTime(m_nFixTime) + : tools::Time(tools::Time::SYSTEM)); // current time return GetFormatted( aTime, eFormat, rFormatter, eLang ); } @@ -652,7 +679,7 @@ OUString SvxExtTimeField::GetFormatted( tools::Time const & aTime, SvxTimeFormat case SvxTimeFormat::HH12_MM_SS_00: { // no builtin format available, try to insert or reuse - OUString aFormatCode( "HH:MM:SS.00 AM/PM" ); + OUString aFormatCode( u"HH:MM:SS.00 AM/PM"_ustr ); sal_Int32 nCheckPos; SvNumFormatType nType; rFormatter.PutandConvertEntry( aFormatCode, nCheckPos, nType, @@ -690,7 +717,7 @@ OUString SvxExtTimeField::GetFormatted( tools::Time const & aTime, SvxTimeFormat MetaAction* SvxExtTimeField::createBeginComment() const { - return new MetaCommentAction( "FIELD_SEQ_BEGIN" ); + return new MetaCommentAction( "FIELD_SEQ_BEGIN"_ostr ); } |