From 178832ef7139b9279a3ae0056eb11be9c476800e Mon Sep 17 00:00:00 2001 From: Sarper Akdemir Date: Wed, 29 Mar 2023 19:44:18 +0300 Subject: oox: tcPr vert roundtrip, introduce interopability grab bag for table cell To properly roundtrip all possible values of + Introduce grab bag for table cell + on import: Store the unsupported values in the grab bag: + (e.g. wordArtVert, mongolianVert, wordArtVertRtl) + on export: if nothing is being exported from the doc model, export the value from the grabbag Also adds a unit test covering this behavior. Change-Id: I791ed2d992b0a554ef6da37200f027cffd8c5f2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149737 Tested-by: Jenkins Reviewed-by: Sarper Akdemir --- svx/source/inc/cell.hxx | 3 +++ svx/source/svdraw/svdattr.cxx | 3 +++ svx/source/table/cell.cxx | 21 +++++++++++++++++++++ 3 files changed, 27 insertions(+) (limited to 'svx/source') diff --git a/svx/source/inc/cell.hxx b/svx/source/inc/cell.hxx index 331465f4eaa3..34ae09223ce5 100644 --- a/svx/source/inc/cell.hxx +++ b/svx/source/inc/cell.hxx @@ -27,6 +27,7 @@ #include #include +#include #include #include "tablemodel.hxx" #include @@ -209,6 +210,8 @@ private: tools::Rectangle maCellRect; css::uno::Reference< css::table::XTable > mxTable; + + std::unique_ptr mpGrabBagItem = {}; }; diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx index 5af9956fc45d..1898f13140ae 100644 --- a/svx/source/svdraw/svdattr.cxx +++ b/svx/source/svdraw/svdattr.cxx @@ -43,6 +43,8 @@ #include #include +#include + #include #include #include @@ -327,6 +329,7 @@ SdrItemPool::SdrItemPool( rPoolDefaults[ SDRATTR_TABLE_BORDER_TLBR - SDRATTR_START ] = new SvxLineItem( SDRATTR_TABLE_BORDER_TLBR ); rPoolDefaults[ SDRATTR_TABLE_BORDER_BLTR - SDRATTR_START ] = new SvxLineItem( SDRATTR_TABLE_BORDER_BLTR ); rPoolDefaults[ SDRATTR_TABLE_TEXT_ROTATION - SDRATTR_START ] = new SvxTextRotateItem(0_deg10, SDRATTR_TABLE_TEXT_ROTATION); + rPoolDefaults[ SDRATTR_TABLE_GRABBAG - SDRATTR_START ] = new SfxGrabBagItem(SDRATTR_TABLE_GRABBAG); rPoolDefaults[ SDRATTR_GLOW_RADIUS - SDRATTR_START ] = new SdrMetricItem(SDRATTR_GLOW_RADIUS, 0); rPoolDefaults[ SDRATTR_GLOW_COLOR - SDRATTR_START ] = new XColorItem(SDRATTR_GLOW_COLOR, aNullCol); diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx index 97490977a50e..d1dbd0f8088f 100644 --- a/svx/source/table/cell.cxx +++ b/svx/source/table/cell.cxx @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -96,6 +97,7 @@ static const SvxItemPropertySet* ImplGetSvxCellPropertySet() { u"LeftBorder", SDRATTR_TABLE_BORDER, cppu::UnoType::get(), 0, LEFT_BORDER }, { u"RightBorder", SDRATTR_TABLE_BORDER, cppu::UnoType::get(), 0, RIGHT_BORDER }, { u"RotateAngle", SDRATTR_TABLE_TEXT_ROTATION, cppu::UnoType::get(), 0, 0 }, + { u"CellInteropGrabBag", SDRATTR_TABLE_GRABBAG, cppu::UnoType>::get(), 0, 0}, SVX_UNOEDIT_OUTLINER_PROPERTIES, SVX_UNOEDIT_CHAR_PROPERTIES, @@ -1105,6 +1107,14 @@ void SAL_CALL Cell::setPropertyValue( const OUString& rPropertyName, const Any& mpProperties->SetObjectItem(SvxTextRotateItem(Degree10(nRotVal/10), SDRATTR_TABLE_TEXT_ROTATION)); return; } + case SDRATTR_TABLE_GRABBAG: + { + if (mpGrabBagItem == nullptr) + mpGrabBagItem.reset(new SfxGrabBagItem); + + mpGrabBagItem->PutValue(rValue, 0); + return; + } default: { SfxItemSet aSet(GetObject().getSdrModelFromSdrObject().GetItemPool(), pMap->nWID, pMap->nWID); @@ -1225,6 +1235,17 @@ Any SAL_CALL Cell::getPropertyValue( const OUString& PropertyName ) const SvxTextRotateItem& rTextRotate = mpProperties->GetItem(SDRATTR_TABLE_TEXT_ROTATION); return Any(sal_Int32(to(rTextRotate.GetValue()))); } + case SDRATTR_TABLE_GRABBAG: + { + if (mpGrabBagItem != nullptr) + { + Any aGrabBagSequence; + mpGrabBagItem->QueryValue(aGrabBagSequence); + return aGrabBagSequence; + } + else + return Any{css::uno::Sequence()}; + } default: { SfxItemSet aSet(GetObject().getSdrModelFromSdrObject().GetItemPool(), pMap->nWID, pMap->nWID); -- cgit