diff options
author | László Németh <nemeth@numbertext.org> | 2021-05-26 16:31:15 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2021-05-27 15:25:06 +0200 |
commit | 48898a72066ff9982feafebb26708c4e779fd460 (patch) | |
tree | 638f750030a78be80f84f00c2772b861fd09808d /sw/source/filter | |
parent | f3e4c05ce6feaebebb269f1c984a92c1175061a4 (diff) |
tdf#60382 sw xmloff: import/export tracked table/row deletion
to OpenDocument format using
<style:table-row-properties loext:text-changes-only="false"/>
Rename also com::sun::star::text::TextTableRow::IsNotTracked
to com::sun::star::text::TextTableRow::HasTextChangesOnly.
Follow-up to commit 05366b8e6683363688de8708a3d88cf144c7a2bf
"tdf#60382 sw offapi: add change tracking of table/row deletion".
Change-Id: Iefb0d4095af0983fdd15697d5b80073d18d21bd7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116212
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/source/filter')
-rw-r--r-- | sw/source/filter/xml/xmlexpit.cxx | 12 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlimpit.cxx | 17 | ||||
-rw-r--r-- | sw/source/filter/xml/xmliteme.cxx | 29 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlitemm.cxx | 3 | ||||
-rw-r--r-- | sw/source/filter/xml/xmltble.cxx | 25 |
5 files changed, 84 insertions, 2 deletions
diff --git a/sw/source/filter/xml/xmlexpit.cxx b/sw/source/filter/xml/xmlexpit.cxx index 4ab794cc8a9c..b0fdfe589635 100644 --- a/sw/source/filter/xml/xmlexpit.cxx +++ b/sw/source/filter/xml/xmlexpit.cxx @@ -46,6 +46,7 @@ #include <editeng/keepitem.hxx> #include <editeng/brushitem.hxx> #include <editeng/frmdiritem.hxx> +#include <editeng/prntitem.hxx> #include <fmtpdsc.hxx> #include <fmtornt.hxx> #include <fmtfsize.hxx> @@ -871,6 +872,17 @@ bool SvXMLExportItemMapper::QueryXMLValue( } break; + case RES_PRINT: + { + const SvxPrintItem* pHasTextChangesOnly = dynamic_cast<const SvxPrintItem*>( &rItem ); + if (pHasTextChangesOnly && !pHasTextChangesOnly->GetValue()) + { + aOut.append( "false" ); + bOk = true; + } + } + break; + case RES_BACKGROUND: { const SvxBrushItem& rBrush = dynamic_cast<const SvxBrushItem&>(rItem); diff --git a/sw/source/filter/xml/xmlimpit.cxx b/sw/source/filter/xml/xmlimpit.cxx index 4d849810afb1..d09221ba2eb6 100644 --- a/sw/source/filter/xml/xmlimpit.cxx +++ b/sw/source/filter/xml/xmlimpit.cxx @@ -856,6 +856,23 @@ bool SvXMLImportItemMapper::PutXMLValue( } break; + case RES_PRINT: + { + SfxBoolItem& rHasTextChangesOnly = dynamic_cast<SfxBoolItem&>(rItem); + + if( IsXMLToken( rValue, XML_TRUE ) ) + { + rHasTextChangesOnly.SetValue( true ); + bOk = true; + } + else if( IsXMLToken( rValue, XML_FALSE ) ) + { + rHasTextChangesOnly.SetValue( false ); + bOk = true; + } + } + break; + case RES_HORI_ORIENT: { SwFormatHoriOrient& rHoriOrient = dynamic_cast<SwFormatHoriOrient&>(rItem); diff --git a/sw/source/filter/xml/xmliteme.cxx b/sw/source/filter/xml/xmliteme.cxx index 8594c75bf4df..61a8205064ff 100644 --- a/sw/source/filter/xml/xmliteme.cxx +++ b/sw/source/filter/xml/xmliteme.cxx @@ -33,6 +33,8 @@ #include <frmfmt.hxx> #include "xmlexp.hxx" #include <editeng/memberids.h> +#include <editeng/prntitem.hxx> +#include <xmloff/xmlnamespace.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -105,6 +107,33 @@ void SwXMLTableItemMapper_Impl::handleSpecialItem( { switch( rEntry.nWhichId ) { + + case RES_PRINT: + { + const SfxPoolItem *pItem; + if( pSet && + SfxItemState::SET == pSet->GetItemState( RES_PRINT, true, + &pItem ) ) + { + bool bHasTextChangesOnly = + static_cast<const SvxPrintItem *>(pItem)->GetValue(); + if ( !bHasTextChangesOnly ) + { + OUString sValue; + sal_uInt16 nMemberId = + static_cast<sal_uInt16>( rEntry.nMemberId & MID_SW_FLAG_MASK ); + + if( SvXMLExportItemMapper::QueryXMLValue( + rItem, sValue, nMemberId, rUnitConverter ) ) + { + AddAttribute( rEntry.nNameSpace, rEntry.eLocalName, + sValue, rNamespaceMap, rAttrList ); + } + } + } + } + break; + case RES_LR_SPACE: { const SfxPoolItem *pItem; diff --git a/sw/source/filter/xml/xmlitemm.cxx b/sw/source/filter/xml/xmlitemm.cxx index 66001b1de5fb..6464149d766e 100644 --- a/sw/source/filter/xml/xmlitemm.cxx +++ b/sw/source/filter/xml/xmlitemm.cxx @@ -151,7 +151,8 @@ SvXMLItemMapEntry const aXMLTableRowItemMap[] = // RES_FOOTER // not required // RES_PRINT - // not required + // M_E_SE( STYLE, TEXT_CHANGES_ONLY, RES_PRINT, 0 ), + M_E_SE( LO_EXT, TEXT_CHANGES_ONLY, RES_PRINT, 0 ), // RES_OPAQUE // not required // RES_PROTECT diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx index b4ba4c9a8c85..492eb5f7520a 100644 --- a/sw/source/filter/xml/xmltble.cxx +++ b/sw/source/filter/xml/xmltble.cxx @@ -32,6 +32,7 @@ #include <xmloff/numehelp.hxx> #include <editeng/brushitem.hxx> #include <editeng/boxitem.hxx> +#include <editeng/prntitem.hxx> #include <editeng/xmlcnitm.hxx> #include <fmtrowsplt.hxx> #include <editeng/frmdiritem.hxx> @@ -197,6 +198,7 @@ bool SwXMLTableFrameFormatsSort_Impl::AddRow( SwFrameFormat& rFrameFormat, const SwFormatFrameSize *pFrameSize = nullptr; const SwFormatRowSplit* pRowSplit = nullptr; const SvxBrushItem *pBrush = nullptr; + const SvxPrintItem *pHasTextChangesOnly = nullptr; const SfxItemSet& rItemSet = rFrameFormat.GetAttrSet(); const SfxPoolItem *pItem; @@ -209,8 +211,11 @@ bool SwXMLTableFrameFormatsSort_Impl::AddRow( SwFrameFormat& rFrameFormat, if( SfxItemState::SET == rItemSet.GetItemState( RES_BACKGROUND, false, &pItem ) ) pBrush = static_cast<const SvxBrushItem *>(pItem); + if( SfxItemState::SET == rItemSet.GetItemState( RES_PRINT, false, &pItem ) ) + pHasTextChangesOnly = static_cast<const SvxPrintItem *>(pItem); + // empty styles have not to be exported - if( !pFrameSize && !pBrush && !pRowSplit ) + if( !pFrameSize && !pBrush && !pRowSplit && !pHasTextChangesOnly ) return false; // order is: -/brush, size/-, size/brush @@ -221,6 +226,7 @@ bool SwXMLTableFrameFormatsSort_Impl::AddRow( SwFrameFormat& rFrameFormat, const SwFormatFrameSize *pTestFrameSize = nullptr; const SwFormatRowSplit* pTestRowSplit = nullptr; const SvxBrushItem *pTestBrush = nullptr; + const SvxPrintItem *pTestHasTextChangesOnly = nullptr; const SwFrameFormat *pTestFormat = *i; const SfxItemSet& rTestSet = pTestFormat->GetAttrSet(); if( SfxItemState::SET == rTestSet.GetItemState( RES_FRM_SIZE, false, @@ -265,6 +271,20 @@ bool SwXMLTableFrameFormatsSort_Impl::AddRow( SwFrameFormat& rFrameFormat, continue; } + if( SfxItemState::SET == rTestSet.GetItemState( RES_PRINT, false, + &pItem ) ) + { + if( !pHasTextChangesOnly ) + break; + + pTestHasTextChangesOnly = static_cast<const SvxPrintItem *>(pItem); + } + else + { + if( pHasTextChangesOnly ) + continue; + } + if( pFrameSize && ( pFrameSize->GetHeightSizeType() != pTestFrameSize->GetHeightSizeType() || pFrameSize->GetHeight() != pTestFrameSize->GetHeight() ) ) @@ -276,6 +296,9 @@ bool SwXMLTableFrameFormatsSort_Impl::AddRow( SwFrameFormat& rFrameFormat, if( pRowSplit && (!pRowSplit->GetValue() != !pTestRowSplit->GetValue()) ) continue; + if( pHasTextChangesOnly && (!pHasTextChangesOnly->GetValue() != !pTestHasTextChangesOnly->GetValue()) ) + continue; + // found! rFrameFormat.SetName( pTestFormat->GetName() ); bInsert = false; |