diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-04-18 15:41:03 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-04-20 07:15:31 +0200 |
commit | 323ac4c2338dde36c10b9889e4b656dc685ba1ed (patch) | |
tree | 00fcc44384f8bbe77ced54db69946e404ddf0f32 /sc/source/filter/oox | |
parent | 28177fce03cb9b5ed317bbe8242413ce3310113e (diff) |
tdf#124810: Roundtrip pivot table style info from XLSX.
Also provide a default pivot table style for those tables that don't
have a style info. Let's use the style settings that Excel uses.
Change-Id: I8006a33a0aa0e92629f7db0a9c24a6ff52d17945
Reviewed-on: https://gerrit.libreoffice.org/70933
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sc/source/filter/oox')
-rw-r--r-- | sc/source/filter/oox/pivottablebuffer.cxx | 16 | ||||
-rw-r--r-- | sc/source/filter/oox/pivottablefragment.cxx | 3 |
2 files changed, 19 insertions, 0 deletions
diff --git a/sc/source/filter/oox/pivottablebuffer.cxx b/sc/source/filter/oox/pivottablebuffer.cxx index b52ca269f0c9..772637feb674 100644 --- a/sc/source/filter/oox/pivottablebuffer.cxx +++ b/sc/source/filter/oox/pivottablebuffer.cxx @@ -37,6 +37,7 @@ #include <com/sun/star/sheet/XDataPilotDataLayoutFieldSupplier.hpp> #include <com/sun/star/sheet/XDataPilotTablesSupplier.hpp> #include <com/sun/star/sheet/XSheetOperation.hpp> +#include <com/sun/star/xml/sax/XFastAttributeList.hpp> #include <osl/diagnose.h> #include <sal/log.hxx> #include <oox/helper/binaryinputstream.hxx> @@ -1038,6 +1039,18 @@ void PivotTable::importDataField( const AttributeList& rAttribs ) maDataFields.push_back( aModel ); } +void PivotTable::putToInteropGrabBag(const OUString& sName, const AttributeList& rAttribs) +{ + if (auto xFastAttributeList = rAttribs.getFastAttributeList()) + { + // Store both known and unknown attribute sequences to the grab bag as is + css::uno::Sequence<css::xml::FastAttribute> aFast = xFastAttributeList->getFastAttributes(); + css::uno::Sequence<css::xml::Attribute> aUnk = xFastAttributeList->getUnknownAttributes(); + css::uno::Sequence<css::uno::Any> aVal{ css::uno::Any(aFast), css::uno::Any(aUnk) }; + maInteropGrabBag[sName] <<= aVal; + } +} + void PivotTable::importPTDefinition( SequenceInputStream& rStrm ) { sal_uInt32 nFlags1, nFlags2, nFlags3; @@ -1283,6 +1296,9 @@ void PivotTable::finalizeImport() if( !maPageFields.empty() ) aPos.Row = ::std::max< sal_Int32 >( static_cast< sal_Int32 >( aPos.Row - maPageFields.size() - 1 ), 0 ); + // save interop grab bag + mpDPObject->PutInteropGrabBag(std::move(maInteropGrabBag)); + // insert the DataPilot table into the sheet xDPTables->insertNewByName( maDefModel.maName, aPos, mxDPDescriptor ); } diff --git a/sc/source/filter/oox/pivottablefragment.cxx b/sc/source/filter/oox/pivottablefragment.cxx index 59800b026bb4..9ce2bb7eb790 100644 --- a/sc/source/filter/oox/pivottablefragment.cxx +++ b/sc/source/filter/oox/pivottablefragment.cxx @@ -181,6 +181,9 @@ ContextHandlerRef PivotTableFragment::onCreateContext( sal_Int32 nElement, const case XLS_TOKEN( pageFields ): return this; case XLS_TOKEN( dataFields ): return this; case XLS_TOKEN( filters ): return this; + case XLS_TOKEN(pivotTableStyleInfo): + mrPivotTable.putToInteropGrabBag("pivotTableStyleInfo", rAttribs); + break; } break; |