[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - include/oox oox/source
include/oox/drawingml/drawingmltypes.hxx |3 +++ oox/source/drawingml/drawingmltypes.cxx | 13 + oox/source/export/shapes.cxx |6 ++ 3 files changed, 22 insertions(+) New commits: commit 05ca303a3587a27edeb1602331ba01a9635ef6c5 Author: Sarper Akdemir AuthorDate: Fri Mar 24 17:35:51 2023 +0300 Commit: Miklos Vajna CommitDate: Wed Apr 19 12:48:34 2023 +0200 pptx export: consider RotateAngle for tcPr on export It appears the RotateAngle property is imported, even though it has no effect on how table cell is displayed right now. Let's export the property so that we are able to roundtrip the & Change-Id: Idc23f3b0677fdc5ed12fa5494f0f1823bb89683f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149545 Tested-by: Jenkins Reviewed-by: Sarper Akdemir Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150520 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/include/oox/drawingml/drawingmltypes.hxx b/include/oox/drawingml/drawingmltypes.hxx index 4350b8d033a7..48b3aaa3d045 100644 --- a/include/oox/drawingml/drawingmltypes.hxx +++ b/include/oox/drawingml/drawingmltypes.hxx @@ -21,6 +21,7 @@ #define INCLUDED_OOX_DRAWINGML_DRAWINGMLTYPES_HXX #include +#include #include #include @@ -145,6 +146,8 @@ OOX_DLLPUBLIC const char* GetTextVerticalAdjust( css::drawing::TextVerticalAdjus // Converts a Hatch object to an ooxml pattern. const char* GetHatchPattern( const css::drawing::Hatch& rHatch ); +/// Converts nRotate angle to TextVerticalType string appearing in ooxml +std::optional GetTextVerticalType(sal_Int32 nRotateAngle); // CT_IndexRange struct IndexRange { diff --git a/oox/source/drawingml/drawingmltypes.cxx b/oox/source/drawingml/drawingmltypes.cxx index 3a94a449f317..94d50587942a 100644 --- a/oox/source/drawingml/drawingmltypes.cxx +++ b/oox/source/drawingml/drawingmltypes.cxx @@ -375,6 +375,19 @@ const char* GetHatchPattern( const drawing::Hatch& rHatch ) return sPattern; } +std::optional GetTextVerticalType(sal_Int32 nRotateAngle) +{ +switch (nRotateAngle) +{ + case 9000: + return "vert"; + case 27000: + return "vert270"; + default: + return {}; +} +} + /** converts the attributes from a CT_RelativeRect to an IntegerRectangle2D */ IntegerRectangle2D GetRelativeRect( const Reference< XFastAttributeList >& xAttribs ) { diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index eeb307c1471c..d82ac51a36b8 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -1951,7 +1951,13 @@ void ShapeExport::WriteTableCellProperties(const Reference< XPropertySet>& xCell aVerticalAlignment >>= eVerticalAlignment; sVerticalAlignment = GetTextVerticalAdjust(eVerticalAlignment); +sal_Int32 nRotateAngle = 0; +Any aRotateAngle = xCellPropSet->getPropertyValue("RotateAngle"); +aRotateAngle >>= nRotateAngle; +std::optional aTextVerticalValue = GetTextVerticalType(nRotateAngle); + mpFS->startElementNS(XML_a, XML_tcPr, XML_anchor, sVerticalAlignment, +XML_vert, aTextVerticalValue, XML_marL, sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nLeftMargin)), nLeftMargin > 0), XML_marR, sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nRightMargin)), nRightMargin > 0));
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - include/oox oox/source sc/qa sc/source sd/qa sd/source
include/oox/export/drawingml.hxx |8 + oox/source/export/drawingml.cxx | 207 +-- sc/qa/unit/data/ods/tdf91286.ods |binary sc/qa/unit/subsequent_export_test2.cxx | 26 +++ sc/source/filter/excel/xestream.cxx |4 sd/qa/unit/data/odp/tdf74670.odp |binary sd/qa/unit/export-tests-ooxml3.cxx | 27 sd/source/filter/eppt/pptx-epptooxml.cxx |2 8 files changed, 183 insertions(+), 91 deletions(-) New commits: commit cd4b20cd84018b7984826f42b878500cfd2d34c6 Author: Tünde Tóth AuthorDate: Tue Mar 22 09:47:57 2022 +0100 Commit: Noel Grandin CommitDate: Wed Mar 8 12:38:28 2023 + tdf#74670 tdf#91286 PPTX XLSX export: save image once Impress and Calc used to dump the same image file as many times as it was featured in the document, resulting redundant, sometimes huge documents. Note: using only checksum to recognize image duplication is a regression, because checksum collision results image loss. This is a very unlikely event, and the following commits have got the same problem. The solution is comparing the images with the same checksum byte for byte. See also commit b484e9814c66d8d51cea974390963a6944bc9d73 "tdf#83227 oox: reuse RelId in DML/VML export for the same graphic" and commit 797fef38612fb2fd62d1f6591619b9361e526bca "tdf#118535 DOCX export: save header image once". Change-Id: I9f233d521941381746634cf4f9b5991da0dadda9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131928 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit aea8043bc5f5187498fa450505d6de9d6986e2a6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148270 Tested-by: Jenkins CollaboraOffice Reviewed-by: Noel Grandin diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index 8e4fe156c0cd..7c79896a29b8 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -21,7 +21,9 @@ #define INCLUDED_OOX_EXPORT_DRAWINGML_HXX #include +#include #include +#include #include #include @@ -41,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -149,6 +152,7 @@ private: static std::map maWdpCache; static sal_Int32 mnDrawingMLCount; static sal_Int32 mnVmlCount; +static std::stack> maExportGraphics; /// To specify where write eg. the images to (like 'ppt', or 'word' - according to the OPC). DocumentType meDocumentType; @@ -344,9 +348,11 @@ public: sal_Int32 getBulletMarginIndentation (const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,sal_Int16 nLevel, std::u16string_view propName); static void ResetCounters(); - static void ResetMlCounters(); +static void PushExportGraphics(); +static void PopExportGraphics(); + static sal_Int32 getNewDrawingUniqueId() { return ++mnDrawingMLCount; } static sal_Int32 getNewVMLUniqueId() { return ++mnVmlCount; } diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 55a9f07e90fe..e843d51606b7 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -112,7 +112,6 @@ #include #include #include -#include #include #include #include @@ -240,6 +239,7 @@ int DrawingML::mnWdpImageCounter = 1; std::map DrawingML::maWdpCache; sal_Int32 DrawingML::mnDrawingMLCount = 0; sal_Int32 DrawingML::mnVmlCount = 0; +std::stack> DrawingML::maExportGraphics; sal_Int16 DrawingML::GetScriptType(const OUString& rStr) { @@ -278,6 +278,16 @@ void DrawingML::ResetMlCounters() mnVmlCount = 0; } +void DrawingML::PushExportGraphics() +{ +maExportGraphics.emplace(); +} + +void DrawingML::PopExportGraphics() +{ +maExportGraphics.pop(); +} + bool DrawingML::GetProperty( const Reference< XPropertySet >& rXPropertySet, const OUString& aName ) { try @@ -1243,113 +1253,130 @@ const char* DrawingML::GetRelationCompPrefix() const OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia, OUString* pFileName ) { GfxLink aLink = rGraphic.GetGfxLink (); +BitmapChecksum aChecksum = rGraphic.GetChecksum(); OUString sMediaType; const char* pExtension = ""; OUString sRelId; +OUString sPath; -SvMemoryStream aStream; -const void* aData = aLink.GetData(); -std::size_t nDataSize = aLink.GetDataSize(); - -switch ( aLink.GetType() ) +// tdf#74670 tdf#91286 Save image only once (this is no problem for DOCX) +if (GetDocumentType() != DOCUMENT_DOCX && !maExportGraphics.empty()) { -case GfxLinkType::NativeGif: -sMediaType = "image/gif"; -pExtension = ".gif"; -break; +auto aIterator = maExportGraphics.top().find(aChecksum); +if (aIterator != maExportGraphics.top().end()) +sPath =
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - include/oox oox/source sw/qa writerfilter/source
include/oox/shape/ShapeContextHandler.hxx |5 +- oox/source/drawingml/shape.cxx|2 oox/source/shape/ShapeContextHandler.cxx |8 ++- oox/source/shape/WpgContext.cxx | 45 +- oox/source/shape/WpgContext.hxx |8 ++- sw/qa/extras/ooxmlexport/data/testWPGtextboxes.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport10.cxx| 21 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx |7 +- sw/qa/extras/ooxmlexport/ooxmlexport5.cxx |2 sw/qa/extras/ooxmlexport/ooxmlexport6.cxx |4 - sw/qa/extras/ooxmlexport/ooxmlexport8.cxx |7 +- sw/qa/extras/ooxmlimport/ooxmlimport2.cxx |7 ++ writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |4 + 13 files changed, 92 insertions(+), 28 deletions(-) New commits: commit b5034017e566cd4e5a236bf59555196598fd01cf Author: Attila Bakos (NISZ) AuthorDate: Wed Nov 10 14:10:11 2021 +0100 Commit: Miklos Vajna CommitDate: Tue Jan 17 09:24:12 2023 + tdf#143574 OOXML export/import of textboxes in group shapes In this part, oox module has been modified in order to prepare for WPG handling during OOXML import. Note: Wpg is the drawingML equivalent of v:group, supporting text boxes in the group. 1) Added new parameter for WpgContext to support nested Wpg shapes, and WPS enabled for the WPG member shapes. 2) A bug has fixed, where group member line shape and connector shapes have wrong positions before in the group. 3) Unit tests had to be modified, and 3 of them disabled temporarily due to missing Writerfilter implementation (what will be the next commit) Now group shapes can have textboxes and the text is imported for that, but complex content is still missing (this will be fixed in writerfilter by the next commit). Known issue: WPG shapes with textboxes in floating table have issues during import at floating table conversion, so until this is not fixed this function is disabled for shapes in tables (will be fixed a follow-up commit later). Follow-up to commit 19394a924fdc486202ca27e318385287eb0df26f "tdf#143574 sw: textboxes in group shapes -- part 4". Change-Id: I71032187697807087bd8f27f7c3a7b052e174bd7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124964 Tested-by: László Németh Reviewed-by: László Németh Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143367 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/include/oox/shape/ShapeContextHandler.hxx b/include/oox/shape/ShapeContextHandler.hxx index dadaf7f64cb3..fcd713e4c5a6 100644 --- a/include/oox/shape/ShapeContextHandler.hxx +++ b/include/oox/shape/ShapeContextHandler.hxx @@ -96,6 +96,9 @@ public: void setPosition(const css::awt::Point& rPosition); +const bool& getFullWPGSupport() { return m_bFullWPGSUpport; }; +void setFullWPGSupport(const bool& rbUse) { m_bFullWPGSUpport = rbUse; }; + void setDocumentProperties(const css::uno::Reference& xDocProps); void setMediaDescriptor(const css::uno::Sequence& rMediaDescriptor); @@ -110,7 +113,7 @@ private: ::sal_uInt32 mnStartToken; css::awt::Point maPosition; - +bool m_bFullWPGSUpport; drawingml::ShapePtr mpShape; std::shared_ptr< vml::Drawing > mpDrawing; diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 7740c2e153be..2343f8b3b027 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1567,7 +1567,7 @@ Reference< XShape > const & Shape::createAndInsert( // These can have a custom geometry, so position should be set here, // after creation but before custom shape handling, using the position // we got from the caller. -if (mbWps && aServiceName == "com.sun.star.drawing.LineShape") +if (mbWps && aServiceName == "com.sun.star.drawing.LineShape" && !pParentGroupShape) mxShape->setPosition(maPosition); if( bIsCustomShape ) diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx index 09b7d8613ce9..8aa5aad6d869 100644 --- a/oox/source/shape/ShapeContextHandler.cxx +++ b/oox/source/shape/ShapeContextHandler.cxx @@ -47,7 +47,9 @@ using namespace drawingml; ShapeContextHandler::ShapeContextHandler(const rtl::Reference& xFilterBase) : mnStartToken(0), + m_bFullWPGSUpport(false), mxShapeFilterBase(xFilterBase) + { } @@ -139,8 +141,12 @@ uno::Reference const & ShapeContextHandler::getWp switch (getBaseToken(nElement)) { case XML_wgp: -mxWpgContext.set(static_cast(new WpgContext(*rFragmentHandler))); +{ +rtl::Reference rContext = new
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - include/oox oox/source
include/oox/drawingml/theme.hxx |8 +--- oox/source/drawingml/themeelementscontext.cxx | 17 - 2 files changed, 17 insertions(+), 8 deletions(-) New commits: commit 0f107b93ef4f0542de4effa0a5e1149fb2e5c6f1 Author: Tomaž Vajngerl AuthorDate: Mon Dec 12 21:41:50 2022 +0900 Commit: Tomaž Vajngerl CommitDate: Sun Jan 15 09:31:19 2023 + oox: rename name variables that are imported into oox::Theme Rename names for font scheme and format scheme in oox::Theme so it is easier to know for what they are used for. Change-Id: I83e2978c407ab7f264de4a161575b086bc5efc03 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143993 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl (cherry picked from commit cffe7884342f249e82780a46f9aba4213e9dd378) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145385 Tested-by: Jenkins CollaboraOffice diff --git a/include/oox/drawingml/theme.hxx b/include/oox/drawingml/theme.hxx index 6222a4264451..a554fc618657 100644 --- a/include/oox/drawingml/theme.hxx +++ b/include/oox/drawingml/theme.hxx @@ -57,8 +57,9 @@ class TextFont; class OOX_DLLPUBLIC Theme { public: -void setStyleName( const OUString& rStyleName ) { maStyleName = rStyleName; } -void setThemeName(const OUString& rThemeName) { maThemeName = rThemeName; } +void setThemeName(OUString const& rName) { maThemeName = rName; } +void setFormatSchemeName(OUString const& rName) { maFormatSchemeName = rName; } +void setFontSchemeName(OUString const& rName) { maFontSchemeName = rName; } ClrScheme& getClrScheme() { return maClrScheme; } const ClrScheme& getClrScheme() const { return maClrScheme; } @@ -101,8 +102,9 @@ public: void addTheme(const css::uno::Reference& xDrawPage) const; private: -OUStringmaStyleName; OUStringmaThemeName; +OUStringmaFontSchemeName; +OUStringmaFormatSchemeName; ClrScheme maClrScheme; FillStyleList maFillStyleList; FillStyleList maBgFillStyleList; diff --git a/oox/source/drawingml/themeelementscontext.cxx b/oox/source/drawingml/themeelementscontext.cxx index 0922c4b61939..2be1e7702f27 100644 --- a/oox/source/drawingml/themeelementscontext.cxx +++ b/oox/source/drawingml/themeelementscontext.cxx @@ -214,17 +214,24 @@ ContextHandlerRef ThemeElementsContext::onCreateContext( sal_Int32 nElement, con switch( nElement ) { case A_TOKEN( clrScheme ): // CT_ColorScheme +{ if (rAttribs.hasAttribute(XML_name)) -{ mrTheme.getClrScheme().SetName(rAttribs.getString(XML_name).get()); -} -return new clrSchemeContext( *this, mrTheme.getClrScheme() ); +return new clrSchemeContext(*this, mrTheme.getClrScheme()); +} case A_TOKEN( fontScheme ): // CT_FontScheme -return new FontSchemeContext( *this, mrTheme.getFontScheme() ); +{ +if (rAttribs.hasAttribute(XML_name)) +mrTheme.setFontSchemeName(rAttribs.getString(XML_name).get()); +return new FontSchemeContext(*this, mrTheme.getFontScheme()); +} case A_TOKEN( fmtScheme ): // CT_StyleMatrix -mrTheme.setStyleName( rAttribs.getString( XML_name ).get() ); +{ +if (rAttribs.hasAttribute(XML_name)) + mrTheme.setFormatSchemeName(rAttribs.getString(XML_name).get()); return this; +} case A_TOKEN( fillStyleLst ): // CT_FillStyleList return new FillStyleListContext( *this, mrTheme.getFillStyleList() );
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - include/oox oox/source sc/inc sc/source
include/oox/helper/attributelist.hxx|3 +++ oox/source/helper/attributelist.cxx |8 sc/inc/dbdata.hxx | 10 +- sc/source/core/tool/dbdata.cxx | 17 ++--- sc/source/filter/excel/xedbdata.cxx |5 +++-- sc/source/filter/inc/tablecolumnsbuffer.hxx |4 sc/source/filter/oox/tablecolumnsbuffer.cxx | 11 ++- 7 files changed, 51 insertions(+), 7 deletions(-) New commits: commit 68c9499edfd6f8a101db2c9a721f20bf7652812f Author: offtkp AuthorDate: Thu Nov 17 16:41:42 2022 +0200 Commit: Tomaž Vajngerl CommitDate: Tue Dec 13 09:10:52 2022 + xlsx: Import table column attribute XML_totalsRowFunction Import table column attribute totalsRowFunction and also export it, which fixes a warning when roundtripped on a different office suite. Change-Id: Icc76fc310aef3bd51bcefebece57f962a56b7cca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142843 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl (cherry picked from commit e54b39c82e88a296af1d2c7ddbf6f20513ffacf5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143444 Tested-by: Jenkins CollaboraOffice diff --git a/include/oox/helper/attributelist.hxx b/include/oox/helper/attributelist.hxx index efb3de7779cf..8d00f614728d 100644 --- a/include/oox/helper/attributelist.hxx +++ b/include/oox/helper/attributelist.hxx @@ -103,6 +103,9 @@ public: /** Returns the string value of the specified attribute. */ OptValue< OUString > getString( sal_Int32 nAttrToken ) const; +/** Returns the string value of the specified attribute, returns an empty string if attribute not present. */ +OUString getStringDefaulted( sal_Int32 nAttrToken ) const; + /** Returns the string value of the specified attribute. All characters in the format '_x_' (H being a hexadecimal digit), will be decoded. */ OptValue< OUString > getXString( sal_Int32 nAttrToken ) const; diff --git a/oox/source/helper/attributelist.cxx b/oox/source/helper/attributelist.cxx index 6ac3ea872eb4..b2090ee1473b 100644 --- a/oox/source/helper/attributelist.cxx +++ b/oox/source/helper/attributelist.cxx @@ -286,6 +286,14 @@ OUString AttributeList::getString( sal_Int32 nAttrToken, const OUString& rDefaul return rDefault; } +OUString AttributeList::getStringDefaulted( sal_Int32 nAttrToken ) const +{ +// check if the attribute exists (empty string may be different to missing attribute) +if( mxAttribs->hasAttribute( nAttrToken ) ) +return mxAttribs->getOptionalValue( nAttrToken ); +return OUString(); +} + OUString AttributeList::getXString( sal_Int32 nAttrToken, const OUString& rDefault ) const { return getXString( nAttrToken ).get( rDefault ); diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx index f12ba3fb976d..5f2f23335544 100644 --- a/sc/inc/dbdata.hxx +++ b/sc/inc/dbdata.hxx @@ -43,6 +43,11 @@ enum class ScDBDataPortion AREA///< entire area }; +struct TableColumnAttributes +{ +std::optional maTotalsFunction = std::nullopt; +}; + /** Container base class to provide selected access for ScDBData. */ class ScDBDataContainerBase { @@ -93,6 +98,7 @@ private: boolbModified; ///< is set/cleared for/by(?) UpdateReference ::std::vector< OUString > maTableColumnNames; ///< names of table columns +::std::vector< TableColumnAttributes > maTableColumnAttributes; ///< attributes of table columns boolmbTableColumnNamesDirty; SCSIZE nFilteredRowCount; @@ -147,6 +153,8 @@ public: voidEndTableColumnNamesListener(); SC_DLLPUBLIC void SetTableColumnNames( ::std::vector< OUString >&& rNames ); SC_DLLPUBLIC const ::std::vector< OUString >& GetTableColumnNames() const { return maTableColumnNames; } +SC_DLLPUBLIC void SetTableColumnAttributes( ::std::vector< TableColumnAttributes >&& rAttributes ); +SC_DLLPUBLIC const ::std::vector< TableColumnAttributes >& GetTableColumnAttributes() const { return maTableColumnAttributes; } boolAreTableColumnNamesDirty() const { return mbTableColumnNamesDirty; } /** Refresh/update the column names with the header row's cell contents. */ @@ -218,7 +226,7 @@ public: private: -void AdjustTableColumnNames( UpdateRefMode eUpdateRefMode, SCCOL nDx, SCCOL nCol1, +void AdjustTableColumnAttributes( UpdateRefMode eUpdateRefMode, SCCOL nDx, SCCOL nCol1, SCCOL nOldCol1, SCCOL nOldCol2, SCCOL nNewCol1, SCCOL nNewCol2 ); void InvalidateTableColumnNames( bool bSwapToEmptyNames ); }; diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx index e441c7418796..b9febe2e5e24 100644 --- a/sc/source/core/tool/dbdata.cxx +++ b/sc/source/core/tool/dbdata.cxx @@ -610,7 +610,7 @@ bool ScDBData::UpdateReference(const ScDocument* pDoc, UpdateRefMode eUpdateRefM if