[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source test/source
include/oox/export/drawingml.hxx | 14 ++- oox/source/export/drawingml.cxx| 103 +++-- oox/source/token/namespaces-strict.txt |1 oox/source/token/namespaces.txt|1 oox/source/token/tokens.txt|2 sw/qa/extras/ooxmlexport/data/SvgImageTest.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport20.cxx | 27 ++ sw/source/filter/ww8/docxattributeoutput.cxx | 16 +++ test/source/xmltesttools.cxx |2 9 files changed, 157 insertions(+), 9 deletions(-) New commits: commit bfbbf06bcea4d58117c14fd3f3b8743a3714f97e Author: Tomaž Vajngerl AuthorDate: Sun Dec 3 13:21:35 2023 +0900 Commit: Tomaž Vajngerl CommitDate: Mon Dec 4 10:33:34 2023 +0100 tdf#126084 support writing SVG images into OOXML using the MS OOXML extension SVG files aren't supported in OOXML, but we can write it using the MS OOXML extension, which is supported in the latest MSO versions. For now this only implements the support in the exporter. Change-Id: I688180fb5772f3999c2ee3020bc234f90d57cc2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157237 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index 9028cfdc0f9f..dcbb1b544390 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -259,16 +259,25 @@ private: DocumentType meDocumentType; OUString writeNewEntryToStorage(const Graphic& rGraphic, bool bRelPathToMedia); +OUString writeNewSvgEntryToStorage(const Graphic& rGraphic, bool bRelPathToMedia); public: +enum class TypeHint +{ +Detect, +SVG +}; + GraphicExport(sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFilterBase, DocumentType eDocumentType) : mpFS(pFS) , mpFilterBase(pFilterBase) , meDocumentType(eDocumentType) {} -OUString writeToStorage(Graphic const& rGraphic, bool bRelPathToMedia = false); +OUString writeToStorage(Graphic const& rGraphic, bool bRelPathToMedia = false, TypeHint eHint = TypeHint::Detect); + void writeBlip(Graphic const& rGraphic, std::vector const& rEffects, bool bRelPathToMedia = false); +void writeSvgExtension(OUString const& rSvgRelId); }; class OOX_DLLPUBLIC DrawingML @@ -353,7 +362,7 @@ public: void SetBackgroundDark(bool bIsDark) { mbIsBackgroundDark = bIsDark; } /// If bRelPathToMedia is true add "../" to image folder path while adding the image relationship -OUString writeGraphicToStorage(const Graphic , bool bRelPathToMedia = false); +OUString writeGraphicToStorage(const Graphic , bool bRelPathToMedia = false, GraphicExport::TypeHint eHint = GraphicExport::TypeHint::Detect); void WriteColor( ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT ); void WriteColor( const OUString& sColorSchemeName, const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT ); @@ -516,6 +525,7 @@ public: const OUString& sRelationshipType, OUString* pRelationshipId ); +std::shared_ptr createGraphicExport(); }; } diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 228aa2326cc0..05c96c9ad798 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1283,12 +1283,34 @@ OUString DrawingML::GetRelationCompPrefix() const return OUString(getRelationCompPrefix(meDocumentType)); } +void GraphicExport::writeSvgExtension(OUString const& rSvgRelId) +{ +if (rSvgRelId.isEmpty()) +return; + +mpFS->startElementNS(XML_a, XML_extLst); +mpFS->startElementNS(XML_a, XML_ext, XML_uri, "{96DAC541-7B7A-43D3-8B79-37D633B846F1}"); +mpFS->singleElementNS(XML_asvg, XML_svgBlip, +FSNS(XML_xmlns, XML_asvg), mpFilterBase->getNamespaceURL(OOX_NS(asvg)), +FSNS(XML_r, XML_embed), rSvgRelId); +mpFS->endElementNS(XML_a, XML_ext); +mpFS->endElementNS( XML_a, XML_extLst); +} + void GraphicExport::writeBlip(Graphic const& rGraphic, std::vector const& rEffects, bool bRelPathToMedia) { OUString sRelId = writeToStorage(rGraphic, bRelPathToMedia); mpFS->startElementNS(XML_a, XML_blip, FSNS(XML_r, XML_embed), sRelId); +auto const& rVectorGraphicDataPtr = rGraphic.getVectorGraphicData(); + +if (rVectorGraphicDataPtr && rVectorGraphicDataPtr->getType() == VectorGraphicDataType::Svg) +{ +OUString sSvgRelId = writeToStorage(rGraphic, bRelPathToMedia, TypeHint::SVG); +writeSvgExtension(sSvgRelId); +} + for (auto const& rEffect : rEffects) { switch (rEffect.meType) @@ -1514,19 +1536,72 @@ OUString GraphicExport::writeNewEntryToStorage(const Graphic& rGraphic, bool bRe return
[Libreoffice-commits] core.git: include/oox oox/source
include/oox/export/drawingml.hxx | 29 ++-- oox/source/export/drawingml.cxx | 253 +++ oox/source/export/shapes.cxx | 10 - 3 files changed, 145 insertions(+), 147 deletions(-) New commits: commit 1be8b2752d30d3c024e46526e9d31c1e7066799c Author: Tomaž Vajngerl AuthorDate: Sun Dec 3 12:53:58 2023 +0900 Commit: Tomaž Vajngerl CommitDate: Sun Dec 3 11:09:25 2023 +0100 oox: Refactor and simplify writing to storage with GraphicExport Change-Id: I743dc99e0228b59050fb4926c8ef56bed8e82060 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160252 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index d50023be1c17..9028cfdc0f9f 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -140,28 +140,28 @@ protected: virtual ~DMLTextExport() {} }; -constexpr const char* getComponentDir(DocumentType eDocumentType) +constexpr std::u16string_view getComponentDir(DocumentType eDocumentType) { switch (eDocumentType) { -case DOCUMENT_DOCX: return "word"; -case DOCUMENT_PPTX: return "ppt"; -case DOCUMENT_XLSX: return "xl"; +case DOCUMENT_DOCX: return u"word"; +case DOCUMENT_PPTX: return u"ppt"; +case DOCUMENT_XLSX: return u"xl"; } -return ""; +return u""; } -constexpr const char* getRelationCompPrefix(DocumentType eDocumentType) +constexpr std::u16string_view getRelationCompPrefix(DocumentType eDocumentType) { switch (eDocumentType) { -case DOCUMENT_DOCX: return ""; +case DOCUMENT_DOCX: return u""; case DOCUMENT_PPTX: -case DOCUMENT_XLSX: return "../"; +case DOCUMENT_XLSX: return u"../"; } -return ""; +return u""; } class OOX_DLLPUBLIC GraphicExportCache @@ -251,12 +251,15 @@ public: } }; -class GraphicExport +class OOX_DLLPUBLIC GraphicExport { +private: sax_fastparser::FSHelperPtr mpFS; oox::core::XmlFilterBase* mpFilterBase; DocumentType meDocumentType; +OUString writeNewEntryToStorage(const Graphic& rGraphic, bool bRelPathToMedia); + public: GraphicExport(sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFilterBase, DocumentType eDocumentType) : mpFS(pFS) @@ -320,8 +323,8 @@ protected: void WriteStyleProperties( sal_Int32 nTokenId, const css::uno::Sequence< css::beans::PropertyValue >& aProperties ); -const char* GetComponentDir() const; -const char* GetRelationCompPrefix() const; +OUString GetComponentDir() const; +OUString GetRelationCompPrefix() const; static bool EqualGradients( const css::awt::Gradient2& rGradient1, const css::awt::Gradient2& rGradient2 ); bool IsFontworkShape(const css::uno::Reference< css::beans::XPropertySet >& rXShapePropSet); @@ -350,7 +353,7 @@ public: void SetBackgroundDark(bool bIsDark) { mbIsBackgroundDark = bIsDark; } /// If bRelPathToMedia is true add "../" to image folder path while adding the image relationship -OUString writeGraphicToStorage( const Graphic , bool bRelPathToMedia = false ); +OUString writeGraphicToStorage(const Graphic , bool bRelPathToMedia = false); void WriteColor( ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT ); void WriteColor( const OUString& sColorSchemeName, const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT ); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 8c2abb6b07cc..87c693a9cd75 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1273,14 +1273,14 @@ void DrawingML::WriteOutline( const Reference& rXPropSet, Referenc mpFS->endElementNS( XML_a, XML_ln ); } -const char* DrawingML::GetComponentDir() const +OUString DrawingML::GetComponentDir() const { -return getComponentDir(meDocumentType); +return OUString(getComponentDir(meDocumentType)); } -const char* DrawingML::GetRelationCompPrefix() const +OUString DrawingML::GetRelationCompPrefix() const { -return getRelationCompPrefix(meDocumentType); +return OUString(getRelationCompPrefix(meDocumentType)); } void GraphicExport::writeBlip(Graphic const& rGraphic, std::vector const& rEffects, bool bRelPathToMedia) @@ -1401,134 +1401,135 @@ void GraphicExport::writeBlip(Graphic const& rGraphic, std::vectorendElementNS(XML_a, XML_blip); } -OUString GraphicExport::writeToStorage(const Graphic& rGraphic , bool bRelPathToMedia) +OUString GraphicExport::writeNewEntryToStorage(const Graphic& rGraphic, bool bRelPathToMedia) { -GfxLink aLink = rGraphic.GetGfxLink (); -BitmapChecksum aChecksum = rGraphic.GetChecksum(); +GfxLink const& rLink = rGraphic.GetGfxLink(); + OUString sMediaType; -const char* pExtension = ""; -OUString sRelId; -OUString sPath; +
[Libreoffice-commits] core.git: include/oox oox/inc oox/qa oox/source
include/oox/token/tokenmap.hxx | 11 +++ oox/inc/drawingml/connectorhelper.hxx |8 oox/inc/drawingml/customshapeproperties.hxx|2 +- oox/qa/token/tokenmap-test.cxx | 13 + oox/source/drawingml/connectorhelper.cxx | 13 ++--- oox/source/drawingml/customshapeproperties.cxx |4 ++-- oox/source/drawingml/shape.cxx | 13 ++--- oox/source/drawingml/table/tablecell.cxx |5 + 8 files changed, 32 insertions(+), 37 deletions(-) New commits: commit 270b7efe92751a46c3d85e856b932a365c5f5b73 Author: Regina Henschel AuthorDate: Thu Nov 16 15:19:08 2023 +0100 Commit: Regina Henschel CommitDate: Fri Nov 17 15:33:41 2023 +0100 Add getUnicodeTokenName() to StaticTokenMap and use... it in several places. Currently these places get a Sequence by call of StaticTokenMap().getUtf8TokenName() and immediately after that generate an OUString from it using reinterpret_cast and the OUString ctor with 8-Bit character buffer array. The patch moves this conversion to StaticTokenMap. Change-Id: Ia2af110e2a0f1708e0685115d325c1c12cab3857 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159514 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/include/oox/token/tokenmap.hxx b/include/oox/token/tokenmap.hxx index db71c24c2371..4358822c360f 100644 --- a/include/oox/token/tokenmap.hxx +++ b/include/oox/token/tokenmap.hxx @@ -76,6 +76,17 @@ public: return getTokenPerfectHash( pToken, nLength ); } +/** Returns the name of the passed token identifier as OUString. */ +OUString getUnicodeTokenName(sal_Int32 nToken) const +{ +SAL_WARN_IF(nToken < 0 || nToken >= XML_TOKEN_COUNT, "oox", "Wrong nToken parameter"); +OUString const ret((0 <= nToken && nToken < XML_TOKEN_COUNT) +? rtl::OUString(reinterpret_cast(maTokenNames[nToken].getConstArray()), +maTokenNames[nToken].getLength(), RTL_TEXTENCODING_UTF8) +: OUString()); +return ret; +} + private: static sal_Int32 getTokenPerfectHash( const char *pToken, sal_Int32 nLength ); static const css::uno::Sequence< sal_Int8 > EMPTY_BYTE_SEQ; diff --git a/oox/inc/drawingml/connectorhelper.hxx b/oox/inc/drawingml/connectorhelper.hxx index 1e875ab8ee95..f5409d635270 100644 --- a/oox/inc/drawingml/connectorhelper.hxx +++ b/oox/inc/drawingml/connectorhelper.hxx @@ -24,14 +24,6 @@ namespace ConnectorHelper { -/* ToDo: Other place? It uses getShapePresetTypeName() and that is only used in shape.cxx in - Shape::createAndInsert() for "mso-orig-shape-type" property in GrabBag and for msConnectorName. - In both cases it is immediately converted to OUString. So perhaps let - getShapePresetTypeName() return an OUString directly? -*/ -rtl::OUString getShapePresetTypeNameOUString( -const oox::drawingml::CustomShapePropertiesPtr& pCustomShapePropertiesPtr); - /** * Some preset shapes use the default connector site but in order right, bottom, left, top. * The function detects this. diff --git a/oox/inc/drawingml/customshapeproperties.hxx b/oox/inc/drawingml/customshapeproperties.hxx index 61a151d9aa09..c699ffddcce7 100644 --- a/oox/inc/drawingml/customshapeproperties.hxx +++ b/oox/inc/drawingml/customshapeproperties.hxx @@ -101,7 +101,7 @@ public: const css::awt::Size ); sal_Int32 getShapePresetType() const { return mnShapePresetType; } -css::uno::Sequence< sal_Int8 > const & getShapePresetTypeName() const; +OUString getShapePresetTypeName() const; void setShapePresetType( sal_Int32 nShapePresetType ){ mnShapePresetType = nShapePresetType; }; boolgetShapeTypeOverride() const { return mbShapeTypeOverride; }; voidsetShapeTypeOverride( bool bShapeTypeOverride ) { mbShapeTypeOverride = bShapeTypeOverride; }; diff --git a/oox/qa/token/tokenmap-test.cxx b/oox/qa/token/tokenmap-test.cxx index 058f7c16ebbf..e30b6aef806b 100644 --- a/oox/qa/token/tokenmap-test.cxx +++ b/oox/qa/token/tokenmap-test.cxx @@ -23,10 +23,12 @@ class TokenmapTest: public CppUnit::TestFixture { public: void test_roundTrip(); +void test_roundTripUnicode(); CPPUNIT_TEST_SUITE(TokenmapTest); CPPUNIT_TEST(test_roundTrip); +CPPUNIT_TEST(test_roundTripUnicode); CPPUNIT_TEST_SUITE_END(); private: @@ -46,6 +48,17 @@ void TokenmapTest::test_roundTrip() } } +void TokenmapTest::test_roundTripUnicode() +{ +for (sal_Int32 nToken = 0; nToken < XML_TOKEN_COUNT; ++nToken) +{ +// check that the getIdentifier <-> getToken roundtrip works for OUString +OUString sName = tokenMap.getUnicodeTokenName(nToken); +sal_Int32 ret = oox::TokenMap::getTokenFromUnicode(sName); +CPPUNIT_ASSERT_EQUAL(ret, nToken); +} +} +
[Libreoffice-commits] core.git: include/oox oox/source
include/oox/drawingml/connectorshapecontext.hxx |1 + oox/source/shape/WordprocessingCanvasContext.hxx |1 + 2 files changed, 2 insertions(+) New commits: commit 6550c248521b65a367b33ba8db95d17a9a350800 Author: Regina Henschel AuthorDate: Wed Nov 15 19:24:59 2023 +0100 Commit: Regina Henschel CommitDate: Wed Nov 15 22:38:39 2023 +0100 Add comments to import of Wordprocessing Canvas Change-Id: I09af78b08fed886e36beca1770db6fc54a72b707 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159473 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/include/oox/drawingml/connectorshapecontext.hxx b/include/oox/drawingml/connectorshapecontext.hxx index 9911ce84de53..2b95ff4f3d4c 100644 --- a/include/oox/drawingml/connectorshapecontext.hxx +++ b/include/oox/drawingml/connectorshapecontext.hxx @@ -39,6 +39,7 @@ namespace oox::drawingml { sal_Int32 mnDestGlueId; }; +/// Handles CT_NonVisualConnectorProperties, used for cNvCnPr (Word) and cNvCxnSpPr (PP) elements. class ConnectorShapePropertiesContext : public ::oox::core::ContextHandler2 { std::vector& mrConnectorShapePropertiesList; diff --git a/oox/source/shape/WordprocessingCanvasContext.hxx b/oox/source/shape/WordprocessingCanvasContext.hxx index dbb2148967e8..d4cc67f6a9ba 100644 --- a/oox/source/shape/WordprocessingCanvasContext.hxx +++ b/oox/source/shape/WordprocessingCanvasContext.hxx @@ -14,6 +14,7 @@ namespace oox::shape { +/// Handles CT_WordprocessingCanvas, used for wpc element, which is a drawing canvas for Word. class WordprocessingCanvasContext final : public oox::core::FragmentHandler2 { public:
[Libreoffice-commits] core.git: include/oox oox/CppunitTest_oox_wpc_drawing_canvas.mk oox/inc oox/Library_oox.mk oox/Module_oox.mk oox/qa oox/source sw/qa writerfilter/source
include/oox/drawingml/connectorshapecontext.hxx | 14 include/oox/drawingml/shape.hxx |3 include/oox/shape/ShapeContextHandler.hxx|4 oox/CppunitTest_oox_wpc_drawing_canvas.mk| 54 + oox/Library_oox.mk |2 oox/Module_oox.mk|1 oox/inc/drawingml/connectorhelper.hxx| 108 +++ oox/qa/unit/data/WPC_BentConnector.docx |binary oox/qa/unit/data/WPC_CanvasBackground.docx |binary oox/qa/unit/data/WPC_Glow.docx |binary oox/qa/unit/data/WPC_MulticolorGradient.docx |binary oox/qa/unit/data/WPC_Shadow.docx |binary oox/qa/unit/data/WPC_Textwrap_in_ellipse.docx|binary oox/qa/unit/data/WPC_ThemeColor.docx |binary oox/qa/unit/data/WPC_tdf104671_Cloud.docx|binary oox/qa/unit/data/WPC_tdf48610_Textbox_with_table_inside.docx |binary oox/qa/unit/wpc_drawing_canvas.cxx | 259 +++ oox/source/drawingml/connectorhelper.cxx | 368 +++ oox/source/drawingml/connectorshapecontext.cxx | 17 oox/source/drawingml/shape.cxx | 44 + oox/source/drawingml/shapegroupcontext.cxx |1 oox/source/shape/ShapeContextHandler.cxx | 88 ++ oox/source/shape/WordprocessingCanvasContext.cxx | 106 +++ oox/source/shape/WordprocessingCanvasContext.hxx | 38 + oox/source/shape/WpsContext.cxx | 32 oox/source/token/namespaces-strict.txt |1 oox/source/token/namespaces.hxx.tail |2 oox/source/token/namespaces.txt |1 oox/source/token/tokens.txt |1 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx |4 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx|5 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx| 20 writerfilter/source/dmapper/GraphicImport.cxx| 20 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx|8 writerfilter/source/ooxml/model.xml | 47 + 35 files changed, 1209 insertions(+), 39 deletions(-) New commits: commit 0430adb42bc38f037b907984e71c144d863796cb Author: Regina Henschel AuthorDate: Wed Sep 6 23:03:39 2023 +0200 Commit: Miklos Vajna CommitDate: Wed Nov 15 11:13:31 2023 +0100 Import Wordprocessing Canvas, wpc:wpc element Currently LibreOffice uses the VML fallback, when a docx document has a wpc:wpc element. This patch implements to use the choice part with the wpc:wpc element. That is often called 'drawing canvas'. The patch uses a similar approach as for SmartArt. The drawing canvas is imported as group shape and for the background an additional rectangular shape is inserted as first in the children vector. Not using VML has the advantage, that the custom shape import is used for preset shapes. VML import produces problems because some properties are not available in VML or the current VML import has deficits. The test suite shows examples, what is better without using the VML fallback. Affected bug reports are e.g. tdf#104671 or tdf#154828. A drawing canvas must be used in Word for connector shapes. A connector in Word on the drawing canvas is not written as cxnSp element, but as ordinary wsp element with additional wps:cNvCnPr child element. The patch generates a connector in such case. Unsolved problems: The path of a curved connector in OOXML is basically incompatible to the path which LibreOffice generates. This patch uses the default path for a curved connector. Same is done in import in Impress. Using the VML fallback had generated a custom shape with the current path and handles, but the connections to the target shapes were lost. Export to docx is missing. The drawing canvas is not recreated, instead a group with the additional background shape is exported. That is no regression, using VML has produced a group too on export. I don't know whether XML_graphicFrame can occur in WordprocessingCanvasContext. At least charts and math equations are not possible on the drawing canvas in Word. Import of WordArt shapes does not work. That is not regression. It works neither in the VML import. Change-Id: I04bf8407efd1939cdf3137775f8afad420b74014 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156629 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/include/oox/drawingml/connectorshapecontext.hxx
[Libreoffice-commits] core.git: include/oox oox/source
include/oox/ppt/presentationfragmenthandler.hxx |8 ++-- oox/source/ppt/presentationfragmenthandler.cxx | 42 2 files changed, 26 insertions(+), 24 deletions(-) New commits: commit f2ae8b934aaac7c444e8493ed5e8189c6ce63328 Author: Henry Castro AuthorDate: Mon Oct 9 07:34:02 2023 -0400 Commit: Henry Castro CommitDate: Tue Oct 31 21:09:19 2023 +0100 tdf#155512: oox: ppt: fix import master slides, follow up Import all master slides. Signed-off-by: Henry Castro Change-Id: Ieac68bacf15c75e4c23ec692aadcb16033cdd092 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157701 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158716 Tested-by: Jenkins diff --git a/include/oox/ppt/presentationfragmenthandler.hxx b/include/oox/ppt/presentationfragmenthandler.hxx index 29204b282bdb..20fc521ae8c5 100644 --- a/include/oox/ppt/presentationfragmenthandler.hxx +++ b/include/oox/ppt/presentationfragmenthandler.hxx @@ -52,10 +52,10 @@ private: void importSlide( const ::oox::core::FragmentHandlerRef& rSlideFragmentHandler, const oox::ppt::SlidePersistPtr& rPersist ); void importSlide(sal_uInt32 nSlide, bool bFirstSlide, bool bImportNotes); -oox::ppt::SlidePersistPtr importMasterSlide(const ::com::sun::star::uno::Reference<::com::sun::star::frame::XModel>& xModel, -::oox::ppt::PowerPointImport& rFilter, -std::u16string_view rLayoutFragmentPath, -std::u16string_view rMasterFragmentPath); +void importMasterSlides(); +void importMasterSlide(const ::com::sun::star::uno::Reference<::com::sun::star::frame::XModel>& xModel, + ::oox::ppt::PowerPointImport& rFilter, + const OUString& rMasterFragmentPath); void saveThemeToGrabBag(const oox::drawingml::ThemePtr& pThemePtr, sal_Int32 nThemeIdx); void importCustomSlideShow(std::vector& rCustomShowList); static void importSlideNames(::oox::core::XmlFilterBase& rFilter, const std::vector& rSlidePersist); diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx index edb523161c9e..2e0f48bbae98 100644 --- a/oox/source/ppt/presentationfragmenthandler.cxx +++ b/oox/source/ppt/presentationfragmenthandler.cxx @@ -215,18 +215,16 @@ void PresentationFragmentHandler::importCustomSlideShow(std::vector& } } -SlidePersistPtr PresentationFragmentHandler::importMasterSlide(const Reference& xModel, - PowerPointImport& rFilter, - std::u16string_view rLayoutFragmentPath, - std::u16string_view rMasterFragmentPath) +void PresentationFragmentHandler::importMasterSlide(const Reference& xModel, +PowerPointImport& rFilter, +const OUString& rMasterFragmentPath) { OUString aLayoutFragmentPath; -OUString aMasterFragmentPath(rMasterFragmentPath); -SlidePersistPtr pMasterPersistPtr, pMasterPtr; +SlidePersistPtr pMasterPersistPtr; Reference< drawing::XDrawPage > xMasterPage; Reference< drawing::XMasterPagesSupplier > xMPS( xModel, uno::UNO_QUERY_THROW ); Reference< drawing::XDrawPages > xMasterPages( xMPS->getMasterPages(), uno::UNO_SET_THROW ); -RelationsRef xMasterRelations = rFilter.importRelations( aMasterFragmentPath ); +RelationsRef xMasterRelations = rFilter.importRelations( rMasterFragmentPath ); for (const auto& rEntry : *xMasterRelations) { @@ -252,7 +250,7 @@ SlidePersistPtr PresentationFragmentHandler::importMasterSlide(const ReferencesetLayoutPath( aLayoutFragmentPath ); rFilter.getMasterPages().push_back( pMasterPersistPtr ); rFilter.setActualSlidePersist( pMasterPersistPtr ); -FragmentHandlerRef xMasterFragmentHandler( new SlideFragmentHandler( rFilter, aMasterFragmentPath, pMasterPersistPtr, Master ) ); +FragmentHandlerRef xMasterFragmentHandler( new SlideFragmentHandler( rFilter, rMasterFragmentPath, pMasterPersistPtr, Master ) ); // set the correct theme OUString aThemeFragmentPath = xMasterFragmentHandler->getFragmentPathFromFirstTypeFromOfficeDoc( u"theme" ); @@ -297,14 +295,7 @@ SlidePersistPtr PresentationFragmentHandler::importMasterSlide(const ReferenceaddTheme(pMasterPersistPtr->getPage()); } - -if (pMasterPersistPtr->getLayoutPath() == rLayoutFragmentPath) -{ -pMasterPtr = pMasterPersistPtr; -} } - -return pMasterPtr; } void
[Libreoffice-commits] core.git: include/oox oox/source sd/qa
dev/null |binary include/oox/drawingml/shape.hxx |3 --- oox/source/drawingml/shape.cxx|2 -- oox/source/drawingml/shapecontext.cxx |2 -- oox/source/ppt/pptshape.cxx |4 sd/qa/unit/import-tests2.cxx | 11 --- 6 files changed, 22 deletions(-) New commits: commit 4e2c70024c2370b2fc3514ee52ec433be998ec57 Author: Xisco Fauli AuthorDate: Mon Oct 23 15:34:58 2023 +0200 Commit: Xisco Fauli CommitDate: Mon Oct 30 13:59:34 2023 +0100 tdf#157679: Revert "pptx: import shape text from master page" This reverts commit ae3b97a69688553e6c40ef4b64655db09d5a0f5e. Change-Id: I39fd84b5efbff0a2cafe090f4f866c801cef19b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158357 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx index 204e8a890a7c..aa1b1dbf2289 100644 --- a/include/oox/drawingml/shape.hxx +++ b/include/oox/drawingml/shape.hxx @@ -236,8 +236,6 @@ public: voidsetTxbxHasLinkedTxtBox( const bool rhs){ mbHasLinkedTxbx = rhs; }; const LinkedTxbxAttr& getLinkedTxbxAttributes() const { return maLinkedTxbxAttr; }; boolisLinkedTxbx() const { return mbHasLinkedTxbx; }; -voidsetHasCustomPrompt(bool bValue) { mbHasCustomPrompt = bValue; } -boolhasCustomPrompt() { return mbHasCustomPrompt; } void setZOrder(sal_Int32 nZOrder) { mnZOrder = nZOrder; } @@ -394,7 +392,6 @@ private: bool mbTextBox; ///< This shape has a textbox. LinkedTxbxAttr maLinkedTxbxAttr; boolmbHasLinkedTxbx; // this text box has linked text box ? -boolmbHasCustomPrompt; // indicates that it's not a generic placeholder css::uno::Sequence maDiagramDoms; diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index c8149a087773..ff3d203f96ea 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -150,7 +150,6 @@ Shape::Shape( const char* pServiceName, bool bDefaultHeight ) , mbWps( false ) , mbTextBox( false ) , mbHasLinkedTxbx( false ) -, mbHasCustomPrompt( false ) , maDiagramDoms( 0 ) , mpDiagramHelper( nullptr ) { @@ -195,7 +194,6 @@ Shape::Shape( const ShapePtr& pSourceShape ) , mbWps( pSourceShape->mbWps ) , mbTextBox( pSourceShape->mbTextBox ) , mbHasLinkedTxbx(false) -, mbHasCustomPrompt( pSourceShape->mbHasCustomPrompt ) , maDiagramDoms( pSourceShape->maDiagramDoms ) , mnZOrder(pSourceShape->mnZOrder) , mnZOrderOff(pSourceShape->mnZOrderOff) diff --git a/oox/source/drawingml/shapecontext.cxx b/oox/source/drawingml/shapecontext.cxx index 6407fb58a1f3..73fdab79508e 100644 --- a/oox/source/drawingml/shapecontext.cxx +++ b/oox/source/drawingml/shapecontext.cxx @@ -89,8 +89,6 @@ ContextHandlerRef ShapeContext::onCreateContext( sal_Int32 aElementToken, const mpShapePtr->setSubType( rAttribs.getToken( XML_type, XML_obj ) ); if( rAttribs.hasAttribute( XML_idx ) ) mpShapePtr->setSubTypeIndex( rAttribs.getInteger( XML_idx, 0 ) ); -if( rAttribs.hasAttribute( XML_hasCustomPrompt ) ) -mpShapePtr->setHasCustomPrompt( rAttribs.getBool( XML_hasCustomPrompt, false ) ); break; // nvSpPr CT_ShapeNonVisual end diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx index dc8d16ae6d37..733aa2a73aed 100644 --- a/oox/source/ppt/pptshape.cxx +++ b/oox/source/ppt/pptshape.cxx @@ -457,10 +457,6 @@ void PPTShape::addShape( Reference < XText > xText(mxShape, UNO_QUERY); if (xText.is()) { -if (mpPlaceholder && mpPlaceholder->getTextBody() && !mpPlaceholder->getTextBody()->isEmpty() -&& mpPlaceholder->hasCustomPrompt()) - xText->setString(mpPlaceholder->getTextBody()->toString()); - TextCharacterProperties aCharStyleProperties; getTextBody()->ApplyStyleEmpty(rFilterBase, xText, aCharStyleProperties, mpMasterTextListStyle); } diff --git a/sd/qa/unit/data/pptx/shape-master-text.pptx b/sd/qa/unit/data/pptx/shape-master-text.pptx deleted file mode 100644 index ca056b852d3a.. Binary files a/sd/qa/unit/data/pptx/shape-master-text.pptx and /dev/null differ diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx index 0ca3513ae00c..44eacbf1da05 100644 --- a/sd/qa/unit/import-tests2.cxx +++ b/sd/qa/unit/import-tests2.cxx @@ -1904,17 +1904,6 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, testOverflowBehaviorClip) } } -CPPUNIT_TEST_FIXTURE(SdImportTest2, testShapeMasterText) -{ -createSdImpressDoc("pptx/shape-master-text.pptx"); -uno::Reference xShape(getShapeFromPage(0, 0)); - -uno::Reference const
[Libreoffice-commits] core.git: include/oox oox/source
include/oox/helper/graphichelper.hxx |3 ++- oox/source/helper/graphichelper.cxx |9 ++--- 2 files changed, 8 insertions(+), 4 deletions(-) New commits: commit c3ce373227433f40d686847a22e78651bedbab24 Author: Balazs Varga AuthorDate: Thu Oct 26 18:11:40 2023 +0200 Commit: Balazs Varga CommitDate: Fri Oct 27 12:28:56 2023 +0200 tdf#156593 FILEOPEN OOXML: image shown in full instead of cropped Revert "Revert "tdf#118133 DOCX import: disable lazy-loading of tiff images"" This reverts commit c6bf16909db054ec5467ebdc0ea0c9dc07307048. Lazy-loading doesn't work with cropped TIFF images, because in case of Lazy-load TIFF images we are using MapUnit::MapPixel, but in case of cropped images we are using MapUnit::Map100thMM and the crop values are relative to original bitmap size. Change-Id: I2dbf6caf08d7899ec2eae683996d997809d62b89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158509 Tested-by: Jenkins Reviewed-by: Balazs Varga diff --git a/include/oox/helper/graphichelper.hxx b/include/oox/helper/graphichelper.hxx index 32e699ed3468..0d0b69216617 100644 --- a/include/oox/helper/graphichelper.hxx +++ b/include/oox/helper/graphichelper.hxx @@ -121,7 +121,8 @@ public: css::uno::Reference< css::graphic::XGraphic > importGraphic( const css::uno::Reference< css::io::XInputStream >& rxInStrm, -const WmfExternal* pExtHeader = nullptr ) const; +const WmfExternal* pExtHeader = nullptr, +const bool bLazyLoad = true ) const; /** Imports a graphic from the passed binary memory block. */ css::uno::Reference< css::graphic::XGraphic > diff --git a/oox/source/helper/graphichelper.cxx b/oox/source/helper/graphichelper.cxx index d197b341da70..830f0131284b 100644 --- a/oox/source/helper/graphichelper.cxx +++ b/oox/source/helper/graphichelper.cxx @@ -229,13 +229,13 @@ awt::Size GraphicHelper::convertHmmToAppFont( const awt::Size& rHmm ) const // Graphics and graphic objects -- Reference< XGraphic > GraphicHelper::importGraphic( const Reference< XInputStream >& rxInStrm, -const WmfExternal* pExtHeader ) const +const WmfExternal* pExtHeader, const bool bLazyLoad ) const { Reference< XGraphic > xGraphic; if( rxInStrm.is() && mxGraphicProvider.is() ) try { Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("InputStream", rxInStrm), - comphelper::makePropertyValue("LazyRead", true) }; + comphelper::makePropertyValue("LazyRead", bLazyLoad) }; if ( pExtHeader && pExtHeader->mapMode > 0 ) { @@ -283,8 +283,11 @@ Reference< XGraphic > GraphicHelper::importEmbeddedGraphic( const OUString& rStr xGraphic = mxGraphicMapper->findGraphic(rStreamName); if (!xGraphic.is()) { +// Lazy-loading doesn't work with cropped TIFF images, because in case of Lazy-load TIFF images +// we are using MapUnit::MapPixel, but in case of cropped images we are using MapUnit::Map100thMM +// and the crop values are relative to original bitmap size. auto xStream = mxStorage->openInputStream(rStreamName); -xGraphic = importGraphic(xStream, pExtHeader); +xGraphic = importGraphic(xStream, pExtHeader, !rStreamName.endsWith(".tiff")); if (xGraphic.is()) mxGraphicMapper->putGraphic(rStreamName, xGraphic); }
[Libreoffice-commits] core.git: include/oox oox/source sd/qa
include/oox/ppt/presentationfragmenthandler.hxx |4 oox/source/ppt/presentationfragmenthandler.cxx | 121 +--- sd/qa/unit/export-tests-ooxml2.cxx |4 3 files changed, 71 insertions(+), 58 deletions(-) New commits: commit adcde78935fb8ca2b93322aa3a558d0b3ccdbfad Author: Henry Castro AuthorDate: Thu Sep 28 15:01:43 2023 -0400 Commit: Henry Castro CommitDate: Wed Oct 4 21:07:14 2023 +0200 tdf#155512: oox: ppt: fix import master slides Import all master slides according to the relationship with slide layouts. Adjust unit test values: SdOOXMLExportTest2::testTdf106867 I do not know why those values change since importing embedded video source code was not touched SdOOXMLExportTest2::testAccentColor The accent6 is a constant value. Signed-off-by: Henry Castro Change-Id: Ic7c70d2c4ce30a7f2d2d1cf22604f1119a66f5f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157387 Tested-by: Jenkins CollaboraOffice Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara (cherry picked from commit 08ed103d734ebf65202dc097c7bb0990573f8fd1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157532 Tested-by: Jenkins diff --git a/include/oox/ppt/presentationfragmenthandler.hxx b/include/oox/ppt/presentationfragmenthandler.hxx index 4685ea2d8316..29204b282bdb 100644 --- a/include/oox/ppt/presentationfragmenthandler.hxx +++ b/include/oox/ppt/presentationfragmenthandler.hxx @@ -54,8 +54,8 @@ private: void importSlide(sal_uInt32 nSlide, bool bFirstSlide, bool bImportNotes); oox::ppt::SlidePersistPtr importMasterSlide(const ::com::sun::star::uno::Reference<::com::sun::star::frame::XModel>& xModel, ::oox::ppt::PowerPointImport& rFilter, -const OUString& rLayoutFragmentPath, -const OUString& rMasterFragmentPath); +std::u16string_view rLayoutFragmentPath, +std::u16string_view rMasterFragmentPath); void saveThemeToGrabBag(const oox::drawingml::ThemePtr& pThemePtr, sal_Int32 nThemeIdx); void importCustomSlideShow(std::vector& rCustomShowList); static void importSlideNames(::oox::core::XmlFilterBase& rFilter, const std::vector& rSlidePersist); diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx index 538d79df7f50..5dd00957b8b8 100644 --- a/oox/source/ppt/presentationfragmenthandler.cxx +++ b/oox/source/ppt/presentationfragmenthandler.cxx @@ -217,75 +217,88 @@ void PresentationFragmentHandler::importCustomSlideShow(std::vector& SlidePersistPtr PresentationFragmentHandler::importMasterSlide(const Reference& xModel, PowerPointImport& rFilter, - const OUString& rLayoutFragmentPath, - const OUString& rMasterFragmentPath) + std::u16string_view rLayoutFragmentPath, + std::u16string_view rMasterFragmentPath) { -SlidePersistPtr pMasterPersistPtr; +OUString aLayoutFragmentPath; +OUString aMasterFragmentPath(rMasterFragmentPath); +SlidePersistPtr pMasterPersistPtr, pMasterPtr; Reference< drawing::XDrawPage > xMasterPage; Reference< drawing::XMasterPagesSupplier > xMPS( xModel, uno::UNO_QUERY_THROW ); Reference< drawing::XDrawPages > xMasterPages( xMPS->getMasterPages(), uno::UNO_SET_THROW ); +RelationsRef xMasterRelations = rFilter.importRelations( aMasterFragmentPath ); -sal_Int32 nIndex; -if( rFilter.getMasterPages().empty() ) +for (const auto& rEntry : *xMasterRelations) { -nIndex = 0; -xMasterPages->getByIndex( nIndex ) >>= xMasterPage; -} -else -{ -nIndex = xMasterPages->getCount(); -xMasterPage = xMasterPages->insertNewByIndex( nIndex ); -} +aLayoutFragmentPath = xMasterRelations->getFragmentPathFromRelation(rEntry.second); -pMasterPersistPtr = std::make_shared( rFilter, true, false, xMasterPage, - std::make_shared( Master, "com.sun.star.drawing.GroupShape" ), mpTextListStyle ); -pMasterPersistPtr->setLayoutPath( rLayoutFragmentPath ); -rFilter.getMasterPages().push_back( pMasterPersistPtr ); -rFilter.setActualSlidePersist( pMasterPersistPtr ); -FragmentHandlerRef xMasterFragmentHandler( new SlideFragmentHandler( rFilter, rMasterFragmentPath, pMasterPersistPtr, Master ) ); - -// set the correct theme -OUString aThemeFragmentPath =
[Libreoffice-commits] core.git: include/oox oox/source
include/oox/ppt/presentationfragmenthandler.hxx |6 + oox/source/ppt/presentationfragmenthandler.cxx | 137 2 files changed, 80 insertions(+), 63 deletions(-) New commits: commit 9fabd7c11989c2a89c5bb238e6cb52b0a6678851 Author: Henry Castro AuthorDate: Thu Sep 28 14:23:55 2023 -0400 Commit: Henry Castro CommitDate: Tue Oct 3 21:48:00 2023 +0200 tdf#155512: oox: ppt: abstraction "importMasterSlide" Signed-off-by: Henry Castro Change-Id: Icfe8e3abbada7f728b2ad1f8e300a688f51d8f75 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157386 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara (cherry picked from commit 84ac58c37fffa0c8b6d55c70009515d013ad65b4) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157468 Tested-by: Jenkins diff --git a/include/oox/ppt/presentationfragmenthandler.hxx b/include/oox/ppt/presentationfragmenthandler.hxx index 7ac929ec555b..4685ea2d8316 100644 --- a/include/oox/ppt/presentationfragmenthandler.hxx +++ b/include/oox/ppt/presentationfragmenthandler.hxx @@ -38,6 +38,8 @@ namespace oox::core { class XmlFilterBase; } namespace oox::ppt { +class PowerPointImport; + class PresentationFragmentHandler final : public ::oox::core::FragmentHandler2 { public: @@ -50,6 +52,10 @@ private: void importSlide( const ::oox::core::FragmentHandlerRef& rSlideFragmentHandler, const oox::ppt::SlidePersistPtr& rPersist ); void importSlide(sal_uInt32 nSlide, bool bFirstSlide, bool bImportNotes); +oox::ppt::SlidePersistPtr importMasterSlide(const ::com::sun::star::uno::Reference<::com::sun::star::frame::XModel>& xModel, +::oox::ppt::PowerPointImport& rFilter, +const OUString& rLayoutFragmentPath, +const OUString& rMasterFragmentPath); void saveThemeToGrabBag(const oox::drawingml::ThemePtr& pThemePtr, sal_Int32 nThemeIdx); void importCustomSlideShow(std::vector& rCustomShowList); static void importSlideNames(::oox::core::XmlFilterBase& rFilter, const std::vector& rSlidePersist); diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx index 9b52b92d97d0..538d79df7f50 100644 --- a/oox/source/ppt/presentationfragmenthandler.cxx +++ b/oox/source/ppt/presentationfragmenthandler.cxx @@ -215,6 +215,79 @@ void PresentationFragmentHandler::importCustomSlideShow(std::vector& } } +SlidePersistPtr PresentationFragmentHandler::importMasterSlide(const Reference& xModel, + PowerPointImport& rFilter, + const OUString& rLayoutFragmentPath, + const OUString& rMasterFragmentPath) +{ +SlidePersistPtr pMasterPersistPtr; +Reference< drawing::XDrawPage > xMasterPage; +Reference< drawing::XMasterPagesSupplier > xMPS( xModel, uno::UNO_QUERY_THROW ); +Reference< drawing::XDrawPages > xMasterPages( xMPS->getMasterPages(), uno::UNO_SET_THROW ); + +sal_Int32 nIndex; +if( rFilter.getMasterPages().empty() ) +{ +nIndex = 0; +xMasterPages->getByIndex( nIndex ) >>= xMasterPage; +} +else +{ +nIndex = xMasterPages->getCount(); +xMasterPage = xMasterPages->insertNewByIndex( nIndex ); +} + +pMasterPersistPtr = std::make_shared( rFilter, true, false, xMasterPage, + std::make_shared( Master, "com.sun.star.drawing.GroupShape" ), mpTextListStyle ); +pMasterPersistPtr->setLayoutPath( rLayoutFragmentPath ); +rFilter.getMasterPages().push_back( pMasterPersistPtr ); +rFilter.setActualSlidePersist( pMasterPersistPtr ); +FragmentHandlerRef xMasterFragmentHandler( new SlideFragmentHandler( rFilter, rMasterFragmentPath, pMasterPersistPtr, Master ) ); + +// set the correct theme +OUString aThemeFragmentPath = xMasterFragmentHandler->getFragmentPathFromFirstTypeFromOfficeDoc( u"theme" ); +if( !aThemeFragmentPath.isEmpty() ) +{ +std::map< OUString, oox::drawingml::ThemePtr >& rThemes( rFilter.getThemes() ); +std::map< OUString, oox::drawingml::ThemePtr >::iterator aIter2( rThemes.find( aThemeFragmentPath ) ); +if( aIter2 == rThemes.end() ) +{ +oox::drawingml::ThemePtr pThemePtr = std::make_shared(); +pMasterPersistPtr->setTheme( pThemePtr ); +Reference xDoc= +rFilter.importFragment(aThemeFragmentPath); + +auto pTheme = std::make_shared(); +pThemePtr->setTheme(pTheme); + +rFilter.importFragment( +new ThemeFragmentHandler(rFilter, aThemeFragmentPath, *pThemePtr, *pTheme), +
[Libreoffice-commits] core.git: include/oox
include/oox/core/xmlfilterbase.hxx|1 - include/oox/drawingml/diagram/diagram.hxx |4 include/oox/drawingml/shape.hxx |1 - include/oox/export/vmlexport.hxx |1 - include/oox/helper/attributelist.hxx |1 - include/oox/helper/helper.hxx |1 - include/oox/helper/refmap.hxx |1 - include/oox/helper/refvector.hxx |1 - include/oox/ppt/slidetransition.hxx |1 - include/oox/vml/vmlshape.hxx |1 - include/oox/vml/vmlshapecontext.hxx |3 ++- include/oox/vml/vmltextbox.hxx|2 +- 12 files changed, 3 insertions(+), 15 deletions(-) New commits: commit a2b389d3a94e93cbddf5f1bbb1396ccc9031cdd1 Author: Gabor Kelemen AuthorDate: Fri Sep 15 19:39:13 2023 +0200 Commit: Gabor Kelemen CommitDate: Sat Sep 30 10:35:44 2023 +0200 tdf#146619 Recheck include/oox with IWYU Change-Id: I91b63fa67ca9552a4725b9b7dcb8f7217195b3ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156988 Tested-by: Jenkins Reviewed-by: Gabor Kelemen diff --git a/include/oox/core/xmlfilterbase.hxx b/include/oox/core/xmlfilterbase.hxx index 317c2a2cb789..0c6226452d5d 100644 --- a/include/oox/core/xmlfilterbase.hxx +++ b/include/oox/core/xmlfilterbase.hxx @@ -22,7 +22,6 @@ #include #include -#include #include #include diff --git a/include/oox/drawingml/diagram/diagram.hxx b/include/oox/drawingml/diagram/diagram.hxx index b3e79d46197c..a5963c5015ba 100644 --- a/include/oox/drawingml/diagram/diagram.hxx +++ b/include/oox/drawingml/diagram/diagram.hxx @@ -23,10 +23,6 @@ #include #include #include -#include - -#include -#include namespace oox::drawingml { diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx index 4c8be792e7f6..204e8a890a7c 100644 --- a/include/oox/drawingml/shape.hxx +++ b/include/oox/drawingml/shape.hxx @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx index f6b9869dae7a..97084b827559 100644 --- a/include/oox/export/vmlexport.hxx +++ b/include/oox/export/vmlexport.hxx @@ -33,7 +33,6 @@ #include #include #include -#include #include namespace com::sun::star { diff --git a/include/oox/helper/attributelist.hxx b/include/oox/helper/attributelist.hxx index 65e7f4ee2cf3..25f2ebe4f823 100644 --- a/include/oox/helper/attributelist.hxx +++ b/include/oox/helper/attributelist.hxx @@ -27,7 +27,6 @@ #include #include -#include #include #include #include diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx index 09441d11dbe1..f9bdd1cec9c2 100644 --- a/include/oox/helper/helper.hxx +++ b/include/oox/helper/helper.hxx @@ -32,7 +32,6 @@ #include #include #include -#include namespace oox { diff --git a/include/oox/helper/refmap.hxx b/include/oox/helper/refmap.hxx index d9d51ad30545..db7cbffe2e02 100644 --- a/include/oox/helper/refmap.hxx +++ b/include/oox/helper/refmap.hxx @@ -24,7 +24,6 @@ #include #include #include -#include namespace oox { diff --git a/include/oox/helper/refvector.hxx b/include/oox/helper/refvector.hxx index 208d34be1efb..8e60c20798b8 100644 --- a/include/oox/helper/refvector.hxx +++ b/include/oox/helper/refvector.hxx @@ -23,7 +23,6 @@ #include #include #include -#include #include #include diff --git a/include/oox/ppt/slidetransition.hxx b/include/oox/ppt/slidetransition.hxx index 01603b9fa649..bb7cf8805807 100644 --- a/include/oox/ppt/slidetransition.hxx +++ b/include/oox/ppt/slidetransition.hxx @@ -23,7 +23,6 @@ #include #include -#include #include namespace com::sun::star { diff --git a/include/oox/vml/vmlshape.hxx b/include/oox/vml/vmlshape.hxx index e95e44053330..64259c554caf 100644 --- a/include/oox/vml/vmlshape.hxx +++ b/include/oox/vml/vmlshape.hxx @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include diff --git a/include/oox/vml/vmlshapecontext.hxx b/include/oox/vml/vmlshapecontext.hxx index 61e189fc009f..8252e0e6ebe6 100644 --- a/include/oox/vml/vmlshapecontext.hxx +++ b/include/oox/vml/vmlshapecontext.hxx @@ -22,10 +22,11 @@ #include #include -#include #include #include +#include + namespace oox { class AttributeList; } namespace oox::vml { diff --git a/include/oox/vml/vmltextbox.hxx b/include/oox/vml/vmltextbox.hxx index 779b368e660e..66e1e7273769 100644 --- a/include/oox/vml/vmltextbox.hxx +++ b/include/oox/vml/vmltextbox.hxx @@ -21,11 +21,11 @@ #define INCLUDED_OOX_VML_VMLTEXTBOX_HXX #include +#include #include #include #include -#include #include #include
[Libreoffice-commits] core.git: include/oox oox/source sc/source
include/oox/vml/vmlshape.hxx|4 ++-- oox/source/vml/vmlshape.cxx | 10 -- sc/source/filter/oox/commentsbuffer.cxx |7 ++- 3 files changed, 12 insertions(+), 9 deletions(-) New commits: commit 5aeb15e95d26ce6de28eb5f5933324828d553f41 Author: Caolán McNamara AuthorDate: Fri Aug 11 10:46:53 2023 +0100 Commit: Caolán McNamara CommitDate: Fri Aug 11 18:12:47 2023 +0200 refactor to return the position to be set by the caller instead no change in behavior intended Change-Id: I32043bdf1d29521d8503df315fa786236e272f7d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155580 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/include/oox/vml/vmlshape.hxx b/include/oox/vml/vmlshape.hxx index d46c23282324..8c63d8cbd26c 100644 --- a/include/oox/vml/vmlshape.hxx +++ b/include/oox/vml/vmlshape.hxx @@ -267,8 +267,8 @@ public: const css::uno::Reference< css::drawing::XShapes >& rxShapes, const ShapeParentAnchor* pParentAnchor = nullptr ) const; -/** Converts position and formatting into the passed existing XShape. */ -voidconvertFormatting( +/** Converts formatting into the passed existing XShape and returns position. */ +css::awt::Rectangle convertFormatting( const css::uno::Reference< css::drawing::XShape >& rxShape ) const; void setContainer(ShapeContainer* pContainer); diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 607ddf5354b4..328abeba7875 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -484,10 +484,10 @@ Reference< XShape > ShapeBase::convertAndInsert( const Reference< XShapes >& rxS return xShape; } -void ShapeBase::convertFormatting( const Reference< XShape >& rxShape ) const +awt::Rectangle ShapeBase::convertFormatting( const Reference< XShape >& rxShape ) const { if( !rxShape.is() ) -return; +return awt::Rectangle(); /* Calculate shape rectangle. Applications may do something special according to some imported shape client data (e.g. Excel cell anchor). */ @@ -495,11 +495,9 @@ void ShapeBase::convertFormatting( const Reference< XShape >& rxShape ) const // convert the shape, if the calculated rectangle is not empty if( (aShapeRect.Width > 0) || (aShapeRect.Height > 0) ) -{ -rxShape->setPosition( awt::Point( aShapeRect.X, aShapeRect.Y ) ); -rxShape->setSize( awt::Size( aShapeRect.Width, aShapeRect.Height ) ); convertShapeProperties( rxShape ); -} + +return aShapeRect; } void ShapeBase::setContainer(ShapeContainer* pContainer) { mpContainer = pContainer; } diff --git a/sc/source/filter/oox/commentsbuffer.cxx b/sc/source/filter/oox/commentsbuffer.cxx index 05deae3ee876..555ddad3a924 100644 --- a/sc/source/filter/oox/commentsbuffer.cxx +++ b/sc/source/filter/oox/commentsbuffer.cxx @@ -183,7 +183,12 @@ void Comment::finalizeImport() if( const ::oox::vml::ShapeBase* pVmlNoteShape = getVmlDrawing().getNoteShape( maModel.maRange.aStart ) ) { // position and formatting -pVmlNoteShape->convertFormatting( xAnnoShape ); +css::awt::Rectangle aShapeRect = pVmlNoteShape->convertFormatting(xAnnoShape); +if (aShapeRect.Width > 0 || aShapeRect.Height > 0) +{ +xAnnoShape->setPosition(css::awt::Point(aShapeRect.X, aShapeRect.Y)); +xAnnoShape->setSize(css::awt::Size(aShapeRect.Width, aShapeRect.Height)); +} // visibility bVisible = pVmlNoteShape->getTypeModel().mbVisible;
[Libreoffice-commits] core.git: include/oox oox/source sd/qa sw/qa sw/source
include/oox/drawingml/shape.hxx|2 oox/source/core/xmlfilterbase.cxx |1 oox/source/drawingml/connectorshapecontext.cxx |8 ++ oox/source/drawingml/shape.cxx |4 + oox/source/drawingml/shapecontext.cxx |8 ++ oox/source/drawingml/shapegroupcontext.cxx |8 ++ oox/source/export/shapes.cxx | 73 + oox/source/ppt/pptshapegroupcontext.cxx|8 ++ sd/qa/unit/data/pptx/tdf141058-1.pptx |binary sd/qa/unit/export-tests.cxx| 86 + sw/qa/extras/globalfilter/globalfilter.cxx | 17 sw/source/filter/ww8/docxattributeoutput.cxx | 15 sw/source/filter/ww8/docxsdrexport.cxx | 23 ++ sw/source/filter/ww8/docxsdrexport.hxx |5 + 14 files changed, 229 insertions(+), 29 deletions(-) New commits: commit e751d59264c369cfc342dab5f0759be12341d306 Author: Michael Stahl AuthorDate: Thu Jul 6 16:57:08 2023 +0200 Commit: Michael Stahl CommitDate: Thu Jul 6 20:28:40 2023 +0200 tdf#141058 oox,sw: OOXML import/export of decorative on shapes Also add a test for PPTX (using the oox filters), and add a SdrObject to the testTdf143311 for DOCX (using the writerfilter/docxsdrexport). Change-Id: Iccee46c0d30316c33c0947b117e2604c96fa0182 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154137 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx index 72ce51ef6476..ccf477bef805 100644 --- a/include/oox/drawingml/shape.hxx +++ b/include/oox/drawingml/shape.hxx @@ -174,6 +174,7 @@ public: voidsetId( const OUString& rId ) { msId = rId; } const OUString& getId() const { return msId; } voidsetDescription( const OUString& rDescr ) { msDescription = rDescr; } +voidsetDecorative(bool const isDecorative) { m_isDecorative = isDecorative; } voidsetHidden( bool bHidden ) { mbHidden = bHidden; } voidsetHiddenMasterShape( bool bHiddenMasterShape ) { mbHiddenMasterShape = bHiddenMasterShape; } voidsetLocked( bool bLocked ) { mbLocked = bLocked; } @@ -356,6 +357,7 @@ protected: OUStringmsInternalName; // used by diagram; not displayed in UI OUStringmsId; OUStringmsDescription; +boolm_isDecorative = false; sal_Int32 mnSubType; // if this type is not zero, then the shape is a placeholder std::optional< sal_Int32 > moSubTypeIndex; diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index c2911a756047..0c95980accd4 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -148,6 +148,7 @@ const Sequence< beans::Pair< OUString, sal_Int32 > >& NamespaceIds() NMSP_c15}, {"http://schemas.microsoft.com/office/spreadsheetml/2015/revision2;, NMSP_xr2}, +{"http://schemas.microsoft.com/office/drawing/2017/decorative;, NMSP_adec}, }; return SINGLETON; }; diff --git a/oox/source/drawingml/connectorshapecontext.cxx b/oox/source/drawingml/connectorshapecontext.cxx index 8ea0bcca6965..018ca95c648d 100644 --- a/oox/source/drawingml/connectorshapecontext.cxx +++ b/oox/source/drawingml/connectorshapecontext.cxx @@ -69,6 +69,14 @@ ConnectorShapePropertiesContext::onCreateContext(sal_Int32 aElementToken, { switch (getBaseToken(aElementToken)) { +case XML_extLst: +case XML_ext: +break; +case XML_decorative: +{ +mpConnectorShapePtr->setDecorative(rAttribs.getBool(XML_val, false)); +break; +} case XML_cNvPr: mpConnectorShapePtr->setId(rAttribs.getStringDefaulted(XML_id)); mpConnectorShapePtr->setName(rAttribs.getStringDefaulted(XML_name)); diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 040a632563cc..0fca9c0e1ac3 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1144,6 +1144,10 @@ Reference< XShape > const & Shape::createAndInsert( { xSet->setPropertyValue( "Description", Any( msDescription ) ); } +if (m_isDecorative) +{ +xSet->setPropertyValue("Decorative", Any(m_isDecorative)); +} if (aServiceName != "com.sun.star.text.TextFrame") rxShapes->add( mxShape ); diff --git a/oox/source/drawingml/shapecontext.cxx b/oox/source/drawingml/shapecontext.cxx index d14864ede331..73fdab79508e 100644 --- a/oox/source/drawingml/shapecontext.cxx +++
[Libreoffice-commits] core.git: include/oox oox/source
include/oox/drawingml/color.hxx |3 ++ oox/source/drawingml/color.cxx | 24 +++ oox/source/drawingml/fillproperties.cxx | 16 +-- oox/source/drawingml/textcharacterproperties.cxx | 15 -- 4 files changed, 30 insertions(+), 28 deletions(-) New commits: commit c1470e15bd0643be8d91aaf6a0d25c78867d0b3e Author: Tomaž Vajngerl AuthorDate: Fri Jun 9 23:34:24 2023 +0900 Commit: Tomaž Vajngerl CommitDate: Fri Jun 9 17:59:48 2023 +0200 oox: remove code duplication and add getComplexColor to oox::Color Change-Id: I9cfbc851d4f303a5a8c92183f01cb5b6545b7984 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152800 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/oox/drawingml/color.hxx b/include/oox/drawingml/color.hxx index 75812c200c28..245e655d7c78 100644 --- a/include/oox/drawingml/color.hxx +++ b/include/oox/drawingml/color.hxx @@ -30,6 +30,7 @@ #include #include #include +#include namespace oox { class GraphicHelper; } @@ -117,6 +118,8 @@ public: /// Compares this color with rOther. bool equals(const Color& rOther, const GraphicHelper& rGraphicHelper, ::Color nPhClr) const; +model::ComplexColor getComplexColor() const; + private: /** Internal helper for getColor(). */ voidsetResolvedRgb( ::Color nRgb ) const; diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx index 805ca6c4faed..ad0b5ca7835e 100644 --- a/oox/source/drawingml/color.cxx +++ b/oox/source/drawingml/color.cxx @@ -571,6 +571,30 @@ sal_Int16 Color::getLumOff() const return 0; } +model::ComplexColor Color::getComplexColor() const +{ +model::ComplexColor aComplexColor; + aComplexColor.setSchemeColor(model::convertToThemeColorType(getSchemeColorIndex())); + +if (getTintOrShade() > 0) +{ +aComplexColor.addTransformation({model::TransformationType::Tint, getTintOrShade()}); +} +else if (getTintOrShade() < 0) +{ +sal_Int16 nShade = o3tl::narrowing(-getTintOrShade()); +aComplexColor.addTransformation({model::TransformationType::Shade, nShade}); +} + +if (getLumMod() != 1) +aComplexColor.addTransformation({model::TransformationType::LumMod, getLumMod()}); + +if (getLumOff() != 0) +aComplexColor.addTransformation({model::TransformationType::LumOff, getLumOff()}); + +return aComplexColor; +} + ::Color Color::getColor( const GraphicHelper& rGraphicHelper, ::Color nPhClr ) const { const sal_Int32 nTempC1 = mnC1; diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index 705f2dc3b55a..7e2f5185b7f6 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -431,24 +431,12 @@ void FillProperties::pushToPropMap(ShapePropertyMap& rPropMap, const GraphicHelp if (aFillColor == nPhClr) { aComplexColor.setSchemeColor(model::convertToThemeColorType(nPhClrTheme)); -rPropMap.setProperty(PROP_FillComplexColor, model::color::createXComplexColor(aComplexColor)); } else { - aComplexColor.setSchemeColor(model::convertToThemeColorType(maFillColor.getSchemeColorIndex())); -if (maFillColor.getLumMod() != 1) - aComplexColor.addTransformation({model::TransformationType::LumMod, maFillColor.getLumMod()}); -if (maFillColor.getLumOff() != 0) - aComplexColor.addTransformation({model::TransformationType::LumOff, maFillColor.getLumOff()}); -if (maFillColor.getTintOrShade() > 0) - aComplexColor.addTransformation({model::TransformationType::Tint, maFillColor.getTintOrShade()}); -if (maFillColor.getTintOrShade() < 0) -{ -sal_Int16 nShade = o3tl::narrowing(-maFillColor.getTintOrShade()); - aComplexColor.addTransformation({model::TransformationType::Shade, nShade}); -} -rPropMap.setProperty(PROP_FillComplexColor, model::color::createXComplexColor(aComplexColor)); +aComplexColor = maFillColor.getComplexColor(); } +rPropMap.setProperty(PROP_FillComplexColor, model::color::createXComplexColor(aComplexColor)); eFillStyle = FillStyle_SOLID; } diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx index 7d3dda284680..0e1e2830a67f 100644 --- a/oox/source/drawingml/textcharacterproperties.cxx +++ b/oox/source/drawingml/textcharacterproperties.cxx @@ -136,20 +136,7 @@ void TextCharacterProperties::pushToPropMap( PropertyMap&
[Libreoffice-commits] core.git: include/oox oox/source
include/oox/export/drawingml.hxx | 40 +++ oox/source/export/drawingml.cxx | 34 - 2 files changed, 53 insertions(+), 21 deletions(-) New commits: commit 33c2443134cfd2110258d5424645ace9e1db127f Author: Tomaž Vajngerl AuthorDate: Tue Apr 11 07:52:38 2023 +0900 Commit: Tomaž Vajngerl CommitDate: Tue Apr 25 06:58:07 2023 +0200 oox: extract image / graphic export into GraphicExport class Change-Id: Ib37aee6c5f664e80d45530dae0de9c172e0773a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150259 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index 8fb8d6ba2e52..82deea172ef7 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -139,6 +139,30 @@ protected: virtual ~DMLTextExport() {} }; +constexpr const char* getComponentDir(DocumentType eDocumentType) +{ +switch (eDocumentType) +{ +case DOCUMENT_DOCX: return "word"; +case DOCUMENT_PPTX: return "ppt"; +case DOCUMENT_XLSX: return "xl"; +} + +return ""; +} + +constexpr const char* getRelationCompPrefix(DocumentType eDocumentType) +{ +switch (eDocumentType) +{ +case DOCUMENT_DOCX: return ""; +case DOCUMENT_PPTX: +case DOCUMENT_XLSX: return "../"; +} + +return ""; +} + class OOX_DLLPUBLIC GraphicExportCache { private: @@ -226,6 +250,22 @@ public: } }; +class GraphicExport +{ +sax_fastparser::FSHelperPtr mpFS; +oox::core::XmlFilterBase* mpFilterBase; +DocumentType meDocumentType; + +public: +GraphicExport(sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFilterBase, DocumentType eDocumentType) +: mpFS(pFS) +, mpFilterBase(pFilterBase) +, meDocumentType(eDocumentType) +{} + +OUString write(const Graphic& rGraphic, bool bRelPathToMedia); +}; + class OOX_DLLPUBLIC DrawingML { diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 773aa6c4ae0c..97c5210d95f6 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1467,29 +1467,15 @@ void DrawingML::WriteOutline( const Reference& rXPropSet, Referenc const char* DrawingML::GetComponentDir() const { -switch ( meDocumentType ) -{ -case DOCUMENT_DOCX: return "word"; -case DOCUMENT_PPTX: return "ppt"; -case DOCUMENT_XLSX: return "xl"; -} - -return "unknown"; +return getComponentDir(meDocumentType); } const char* DrawingML::GetRelationCompPrefix() const { -switch ( meDocumentType ) -{ -case DOCUMENT_DOCX: return ""; -case DOCUMENT_PPTX: -case DOCUMENT_XLSX: return "../"; -} - -return "unknown"; +return getRelationCompPrefix(meDocumentType); } -OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia ) +OUString GraphicExport::write(const Graphic& rGraphic , bool bRelPathToMedia) { GfxLink aLink = rGraphic.GetGfxLink (); BitmapChecksum aChecksum = rGraphic.GetChecksum(); @@ -1586,9 +1572,9 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia ) } sal_Int32 nImageCount = rGraphicExportCache.nextImageCount(); -Reference xOutStream = mpFB->openFragmentStream( +Reference xOutStream = mpFilterBase->openFragmentStream( OUStringBuffer() -.appendAscii(GetComponentDir()) +.appendAscii(getComponentDir(meDocumentType)) .append("/media/image" + OUString::number(nImageCount)) .appendAscii(pExtension) .makeStringAndClear(), @@ -1601,7 +1587,7 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia ) if (bRelPathToMedia) sRelationCompPrefix = "../"; else -sRelationCompPrefix = GetRelationCompPrefix(); +sRelationCompPrefix = getRelationCompPrefix(meDocumentType); sPath = OUStringBuffer() .appendAscii(sRelationCompPrefix.getStr()) .appendAscii(sRelPathToMedia.getStr()) @@ -1612,13 +1598,19 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia ) rGraphicExportCache.addExportGraphics(aChecksum, sPath); } -sRelId = mpFB->addRelation( mpFS->getOutputStream(), +sRelId = mpFilterBase->addRelation( mpFS->getOutputStream(), oox::getRelationship(Relationship::IMAGE), sPath ); return sRelId; } +OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia ) +{ +GraphicExport exporter(mpFS, mpFB, meDocumentType); +return exporter.write(rGraphic, bRelPathToMedia); +} + void DrawingML::WriteMediaNonVisualProperties(const
[Libreoffice-commits] core.git: include/oox oox/source
include/oox/drawingml/drawingmltypes.hxx |3 +++ oox/source/drawingml/drawingmltypes.cxx | 14 ++ oox/source/export/shapes.cxx |6 ++ 3 files changed, 23 insertions(+) New commits: commit 77655fc3dca05d4bb2366e67ccea228e3886bfe2 Author: Sarper Akdemir AuthorDate: Fri Mar 24 17:35:51 2023 +0300 Commit: Sarper Akdemir CommitDate: Mon Apr 17 16:20:18 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 diff --git a/include/oox/drawingml/drawingmltypes.hxx b/include/oox/drawingml/drawingmltypes.hxx index 239d3283e55c..fda24edb0f92 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 @@ -149,6 +150,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 469029f48071..ff8c46050c15 100644 --- a/oox/source/drawingml/drawingmltypes.cxx +++ b/oox/source/drawingml/drawingmltypes.cxx @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -376,6 +377,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 {}; +} +} + namespace { // ISO/IEC-29500 Part 1 ST_Percentage, and [MS-OI29500] 2.1.1324 diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 83d308ca793f..eecd1b38512c 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -2312,7 +2312,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: include/oox oox/source
include/oox/export/drawingml.hxx |1 oox/source/export/drawingml.cxx | 115 +++ 2 files changed, 93 insertions(+), 23 deletions(-) New commits: commit dbbe5d0cd721a815df5e4cbf3215f291a423f2b1 Author: Armin Le Grand (allotropia) AuthorDate: Fri Apr 14 16:29:18 2023 +0200 Commit: Armin Le Grand CommitDate: Mon Apr 17 16:10:48 2023 +0200 MCGR: 1st corrections to gradient export, transparency Changed Alpha export from using Red component of used BColor too use luminance, that will be more safe if we evtl use same gradients for this in the future. Added evtl. needed inversion for gradient exports, also emulation of our 'axial' type. Change-Id: I245959bf1602174f978848e1a02444b4b105f896 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150416 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index bfab16f12aff..4bd3802a7820 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -237,6 +237,7 @@ public: void WriteColor( const ::Color nColor, const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT ); void WriteColorTransformations( const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT ); void WriteGradientStop(sal_uInt16 nStop, ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT); +void WriteGradientStop2(double fOffset, const basegfx::BColor& rColor, const basegfx::BColor& rAlpha); void WriteLineArrow( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, bool bLineStart ); void WriteConnectorConnections( sal_Int32 nStartGlueId, sal_Int32 nEndGlueId, sal_Int32 nStartID, sal_Int32 nEndID ); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index d02890375514..58b2b1fbb2a7 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -657,6 +657,15 @@ bool DrawingML::WriteSchemeColor(OUString const& rPropertyName, const uno::Refer return true; } +void DrawingML::WriteGradientStop2(double fOffset, const basegfx::BColor& rColor, const basegfx::BColor& rAlpha) +{ +mpFS->startElementNS(XML_a, XML_gs, XML_pos, OString::number(static_cast(fOffset * 10))); +WriteColor( +::Color(rColor), +static_cast((1.0 - rAlpha.luminance()) * oox::drawingml::MAX_PERCENT)); +mpFS->endElementNS( XML_a, XML_gs ); +} + void DrawingML::WriteGradientStop(sal_uInt16 nStop, ::Color nColor, sal_Int32 nAlpha) { mpFS->startElementNS(XML_a, XML_gs, XML_pos, OString::number(nStop * 1000)); @@ -874,35 +883,98 @@ void DrawingML::WriteGradientFill2( // method (at import time) will be exported again basegfx::utils::synchronizeColorStops(aColorStops, aAlphaStops, aSingleColor, aSingleAlpha); -if (aColorStops.size() == aAlphaStops.size()) +if (aColorStops.size() != aAlphaStops.size()) { -// export GradientStops (with alpha) -mpFS->startElementNS(XML_a, XML_gsLst); +// this is an error - synchronizeColorStops above *has* to create that +// state, see description there (!) +assert(false && "oox::WriteGradientFill: non-synchronized gradients (!)"); +return; +} -basegfx::ColorStops::const_iterator aCurrColor(aColorStops.begin()); -basegfx::ColorStops::const_iterator aCurrAlpha(aAlphaStops.begin()); +bool bRadialOrEllipticalOrRectOrSquare(false); +bool bLinear(false); +bool bAxial(false); -while (aCurrColor != aColorStops.end() && aCurrAlpha != aAlphaStops.end()) +switch (aGradient.Style) +{ +case awt::GradientStyle_LINEAR: +{ +// remember being linear, nothing else to be done +bLinear = true; +break; +} +case awt::GradientStyle_AXIAL: { -WriteGradientStop( -static_cast(aCurrColor->getStopOffset() * 100.0), -::Color(aCurrColor->getStopColor()), -sal_Int32(::Color(aCurrAlpha->getStopColor(; -aCurrColor++; -aCurrAlpha++; +// we need to 'double' the gradient to make it appear as what we call +// 'axial', but also scale and mirror in doing so +basegfx::ColorStops aNewColorStops; +basegfx::ColorStops aNewAlphaStops; + +// add mirrored gadients, scaled to [0.0 .. 0.5] +basegfx::ColorStops::const_reverse_iterator aRevCurrColor(aColorStops.rbegin()); +basegfx::ColorStops::const_reverse_iterator aRevCurrAlpha(aAlphaStops.rbegin()); + +while (aRevCurrColor != aColorStops.rend() && aRevCurrAlpha != aAlphaStops.rend()) +{ +aNewColorStops.emplace_back((1.0 - aRevCurrColor->getStopOffset())
[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source
include/oox/core/xmlfilterbase.hxx |4 oox/source/export/shapes.cxx | 23 +++ sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 11 +++ sw/qa/extras/ooxmlimport/ooxmlimport2.cxx| 10 -- sw/source/filter/ww8/docxattributeoutput.cxx |6 ++ 5 files changed, 44 insertions(+), 10 deletions(-) New commits: commit 7460e4f4a7b15cc7984adf65bc17e3d580413224 Author: Tünde Tóth AuthorDate: Wed Mar 29 15:09:11 2023 +0200 Commit: László Németh CommitDate: Tue Apr 11 19:35:57 2023 +0200 tdf#154469 DOCX export: fix hyperlink in group shape Hyperlink inserted to shape lost after export, if the shape was inside a group shape. Follow-up to commit 7f4f88b883f81fbce975f72aea0f66a54e269ead "tdf#145147 DOCX import: fix hyperlink in group shape". Change-Id: I48b582c04b6f779cb5393179f65a32d7a7eca5ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149716 Tested-by: László Németh Reviewed-by: László Németh diff --git a/include/oox/core/xmlfilterbase.hxx b/include/oox/core/xmlfilterbase.hxx index 89a7994a904b..317c2a2cb789 100644 --- a/include/oox/core/xmlfilterbase.hxx +++ b/include/oox/core/xmlfilterbase.hxx @@ -221,6 +221,10 @@ public: */ sal_Int32 GetUniqueId() { return mnMaxDocId++; } +sal_Int32 GetMaxDocId() { return mnMaxDocId; } + +void SetMaxDocId(sal_Int32 maxDocId) { mnMaxDocId = maxDocId; } + /** Write the document properties into into the current OPC package. @param xProperties The document properties to export. diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index eab82a86336d..83d308ca793f 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -902,6 +902,29 @@ ShapeExport& ShapeExport::WriteCustomShape( const Reference< XShape >& xShape ) else { pFS->startElementNS(mnXmlNamespace, XML_wsp); +if (m_xParent.is()) +{ +pFS->startElementNS(mnXmlNamespace, XML_cNvPr, XML_id, +OString::number(GetShapeID(xShape) == -1 ? GetNewShapeID(xShape) + : GetShapeID(xShape)), +XML_name, GetShapeName(xShape)); + +if (GetProperty(rXPropSet, "Hyperlink")) +{ +OUString sURL; +mAny >>= sURL; +if (!sURL.isEmpty()) +{ +OUString sRelId = mpFB->addRelation( +mpFS->getOutputStream(), oox::getRelationship(Relationship::HYPERLINK), +mpURLTransformer->getTransformedString(sURL), +mpURLTransformer->isExternalURL(sURL)); + +mpFS->singleElementNS(XML_a, XML_hlinkClick, FSNS(XML_r, XML_id), sRelId); +} +} +pFS->endElementNS(mnXmlNamespace, XML_cNvPr); +} pFS->singleElementNS(mnXmlNamespace, XML_cNvSpPr); } diff --git a/sw/qa/extras/ooxmlimport/data/grouped_link.docx b/sw/qa/extras/ooxmlexport/data/grouped_link.docx similarity index 100% rename from sw/qa/extras/ooxmlimport/data/grouped_link.docx rename to sw/qa/extras/ooxmlexport/data/grouped_link.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index 04ce5b8d452c..908d8db90e3e 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -878,6 +878,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf149996, "lorem_hyperlink.fodt") // because the exported file was corrupted. } +DECLARE_OOXMLEXPORT_TEST(testGroupedShapeLink, "grouped_link.docx") +{ +// tdf#145147 Hyperlink in grouped shape not imported +// tdf#154469 Hyperlink in grouped shape not exported +uno::Reference xGroupShape(getShape(1), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(OUString("https://www.libreoffice.org;), + getProperty(xGroupShape->getByIndex(0), "Hyperlink")); +CPPUNIT_ASSERT_EQUAL(OUString("https://www.documentfoundation.org;), + getProperty(xGroupShape->getByIndex(1), "Hyperlink")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index bcd75b78ecf5..caaa4b6842de 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -1144,16 +1144,6 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf154695) } } -CPPUNIT_TEST_FIXTURE(Test, testTdf145147) -{ -createSwDoc("grouped_link.docx"); -uno::Reference xGroupShape(getShape(1), uno::UNO_QUERY); -CPPUNIT_ASSERT_EQUAL(OUString("https://www.libreoffice.org;), - getProperty(xGroupShape->getByIndex(0), "Hyperlink")); -
[Libreoffice-commits] core.git: include/oox oox/source
include/oox/export/drawingml.hxx |4 ++-- oox/source/export/chartexport.cxx |4 ++-- oox/source/export/drawingml.cxx | 10 +- 3 files changed, 9 insertions(+), 9 deletions(-) New commits: commit f1ad6834e1c08ea59e85bfa8a1e47d81e2a92533 Author: Noel Grandin AuthorDate: Tue Apr 11 11:39:21 2023 +0200 Commit: Noel Grandin CommitDate: Tue Apr 11 17:19:01 2023 +0200 avoid some OString<->OUString back and forth conversion Change-Id: I20d2611ca88df7daca7c56e7475fb85f98fbf888 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150226 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index 2a72225680fb..9179625bd6b7 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -380,8 +380,8 @@ public: const OUString& sFullStream, std::u16string_view sRelativeStream, const css::uno::Reference< css::io::XOutputStream >& xParentRelation, -const char* sContentType, -const char* sRelationshipType, +const OUString& sContentType, +const OUString& sRelationshipType, OUString* pRelationshipId ); }; diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index b60e84590ae9..e4031e6b2b0a 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -859,7 +859,7 @@ void ChartExport::WriteChartObj( const Reference< XShape >& xShape, sal_Int32 nI sRelativeStream, pFS->getOutputStream(), "application/vnd.openxmlformats-officedocument.drawingml.chart+xml", -OUStringToOString(oox::getRelationship(Relationship::CHART), RTL_TEXTENCODING_UTF8).getStr(), +oox::getRelationship(Relationship::CHART), ); XmlFilterBase* pFB = GetFB(); @@ -1081,7 +1081,7 @@ void ChartExport::exportAdditionalShapes( const Reference< css::chart::XChartDoc sRelativeStream, GetFS()->getOutputStream(), "application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml", - OUStringToOString(oox::getRelationship(Relationship::CHARTUSERSHAPES), RTL_TEXTENCODING_UTF8).getStr(), +oox::getRelationship(Relationship::CHARTUSERSHAPES), ); GetFS()->singleElementNS(XML_c, XML_userShapes, FSNS(XML_r, XML_id), sId); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 3700d93f78fc..5560a41bf86a 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -5129,20 +5129,20 @@ sax_fastparser::FSHelperPtr DrawingML::CreateOutputStream ( const OUString& sFullStream, std::u16string_view sRelativeStream, const Reference< XOutputStream >& xParentRelation, -const char* sContentType, -const char* sRelationshipType, +const OUString& sContentType, +const OUString& sRelationshipType, OUString* pRelationshipId ) { OUString sRelationshipId; if (xParentRelation.is()) -sRelationshipId = GetFB()->addRelation( xParentRelation, OUString::createFromAscii( sRelationshipType), sRelativeStream ); +sRelationshipId = GetFB()->addRelation( xParentRelation, sRelationshipType, sRelativeStream ); else -sRelationshipId = GetFB()->addRelation( OUString::createFromAscii( sRelationshipType ), sRelativeStream ); +sRelationshipId = GetFB()->addRelation( sRelationshipType, sRelativeStream ); if( pRelationshipId ) *pRelationshipId = sRelationshipId; -sax_fastparser::FSHelperPtr p = GetFB()->openFragmentStreamWithSerializer( sFullStream, OUString::createFromAscii( sContentType ) ); +sax_fastparser::FSHelperPtr p = GetFB()->openFragmentStreamWithSerializer( sFullStream, sContentType ); return p; }
[Libreoffice-commits] core.git: include/oox include/sax oox/source sax/qa sax/source sw/source
include/oox/export/vmlexport.hxx |2 include/sax/fastattribs.hxx | 21 - include/sax/fshelper.hxx |4 oox/source/export/vmlexport.cxx |6 sax/qa/cppunit/attributes.cxx| 14 sax/source/fastparser/fastparser.cxx | 57 +-- sax/source/tools/fastattribs.cxx | 41 -- sax/source/tools/fastserializer.cxx |4 sax/source/tools/fastserializer.hxx |2 sw/source/filter/ww8/docxattributeoutput.cxx | 505 ++- sw/source/filter/ww8/docxattributeoutput.hxx | 27 - sw/source/filter/ww8/docxsdrexport.cxx | 45 +- sw/source/filter/ww8/docxtableexport.cxx | 45 +- 13 files changed, 319 insertions(+), 454 deletions(-) New commits: commit d856be879e0b94b36c8f87817de74189a8a04121 Author: Mike Kaganski AuthorDate: Thu Apr 6 07:29:56 2023 +0300 Commit: Mike Kaganski CommitDate: Thu Apr 6 23:02:16 2023 +0200 Use more *string_view Change-Id: Ic82bbb1b8d6b03066e66f5eb93e9a94b16b1a9f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150072 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx index fb53ec099f7a..f6b9869dae7a 100644 --- a/include/oox/export/vmlexport.hxx +++ b/include/oox/export/vmlexport.hxx @@ -158,7 +158,7 @@ protected: /// /// This should be called from within StartShape() to ensure that the /// added attribute is preserved. -voidAddShapeAttribute( sal_Int32 nAttribute, const OString& sValue ); +void AddShapeAttribute(sal_Int32 nAttribute, std::string_view sValue); using EscherEx::StartShape; using EscherEx::EndShape; diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx index 2dc7c3d72420..61eb048e881a 100644 --- a/include/sax/fastattribs.hxx +++ b/include/sax/fastattribs.hxx @@ -62,14 +62,13 @@ class SAX_DLLPUBLIC FastTokenHandlerBase : /** * Client method to attempt the use of this interface if possible. * @xTokenHandler - the token lookup interface - * @pStr - string buffer to lookup - * @nLength - optional length of chars in that buffer + * @str - string buffer to lookup * - * @return Tokenized form of pStr + * @return Tokenized form of str */ static sal_Int32 getTokenFromChars( const FastTokenHandlerBase *pTokenHandler, - const char *pStr, size_t nLength ); + std::string_view str ); }; @@ -88,11 +87,17 @@ public: } void add( const FastAttributeList& ); void add( const css::uno::Reference& ); -void add( sal_Int32 nToken, const char* pValue ); -void add( sal_Int32 nToken, const char* pValue, size_t nValueLength ); -void add( sal_Int32 nToken, const OString& rValue ); +void add( sal_Int32 nToken, std::string_view value ); void add( sal_Int32 nToken, std::u16string_view sValue ); // Converts to UTF-8 -void addNS( sal_Int32 nNamespaceToken, sal_Int32 nToken, const OString& rValue ); +template +void add( sal_Int32 nToken, rtl::StringConcat&& value) { add(nToken, Concat2View(value)); } +template 0), int> = 0> +void add( sal_Int32 nToken, Val&& val, Rest&&... rest ) +{ +add(nToken, std::forward(val)); +add(std::forward(rest)...); +} +void addNS( sal_Int32 nNamespaceToken, sal_Int32 nToken, std::string_view sValue ); void addNS( sal_Int32 nNamespaceToken, sal_Int32 nToken, std::u16string_view sValue ); // note: rQName is *namespace-prefixed* void addUnknown( const OUString& rNamespaceURL, const OString& rQName, const OString& value ); diff --git a/include/sax/fshelper.hxx b/include/sax/fshelper.hxx index 338260861132..74e2ed4e3254 100644 --- a/include/sax/fshelper.hxx +++ b/include/sax/fshelper.hxx @@ -126,12 +126,8 @@ public: { endElement( FSNS( namespaceTokenId, elementTokenId ) ); } void singleElement(sal_Int32 elementTokenId, const rtl::Reference& xAttrList); -void singleElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, rtl::Reference const & xAttrList) -{ singleElement(FSNS( namespaceTokenId, elementTokenId), xAttrList); } void startElement(sal_Int32 elementTokenId, const rtl::Reference& xAttrList); -void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, rtl::Reference const & xAttrList) -{ startElement( FSNS( namespaceTokenId, elementTokenId ), xAttrList ); } FastSerializerHelper* write(const char* value); FastSerializerHelper* write(const OString& value); diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index 7cbfe1f14bfa..38d3b9feacd1 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -158,7 +158,7 @@ sal_uInt32 VMLExport::EnterGroup( const
[Libreoffice-commits] core.git: include/oox sc/source
include/oox/export/drawingml.hxx|1 + sc/source/filter/excel/xeescher.cxx |3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) New commits: commit b27b250f70f4651d387ef0646a9668950371e779 Author: Miklos Vajna AuthorDate: Wed Mar 8 09:07:24 2023 +0100 Commit: Miklos Vajna CommitDate: Wed Mar 8 09:04:54 2023 + sc: fix ever-increasing chart IDs when exporting to XLSX Similar to what PPTX already did. Change-Id: I17d8ccf3fb7111e1cbf9dc019d1032ed7ed530fd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148460 Tested-by: Xisco Fauli Reviewed-by: Xisco Fauli Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index 5dc243e8536c..59c9ace37113 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -365,6 +365,7 @@ public: static sal_Int32 getNewDrawingUniqueId() { return ++mnDrawingMLCount; } static sal_Int32 getNewVMLUniqueId() { return ++mnVmlCount; } +static sal_Int32 getNewChartUniqueId() { return ++mnChartCount; } // A Helper to decide the script type for given text in order to call WriteRunProperties. static sal_Int16 GetScriptType(const OUString& rStr); diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index 4e9491cc94c3..44e1225cf17c 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -1604,8 +1604,7 @@ void XclExpChartObj::SaveXml( XclExpXmlStream& rStrm ) ChartExport aChartExport(XML_xdr, pDrawing, GetChartDoc(), , drawingml::DOCUMENT_XLSX); auto pURLTransformer = std::make_shared(*mpDoc); aChartExport.SetURLTranslator(pURLTransformer); -static sal_Int32 nChartCount = 0; -nChartCount++; +sal_Int32 nChartCount = oox::drawingml::DrawingML::getNewChartUniqueId(); sal_Int32 nID = rStrm.GetUniqueId(); aChartExport.WriteChartObj( mxShape, nID, nChartCount ); // TODO: get the correcto chart number
[Libreoffice-commits] core.git: include/oox oox/source sd/source
include/oox/export/drawingml.hxx |1 + oox/source/export/drawingml.cxx |2 ++ oox/source/export/shapes.cxx |3 +-- sd/source/filter/eppt/pptx-epptooxml.cxx |1 + 4 files changed, 5 insertions(+), 2 deletions(-) New commits: commit 269585d6b461b565fe75f77b6dbf219749edc5ab Author: Miklos Vajna AuthorDate: Wed Mar 8 08:04:09 2023 +0100 Commit: Miklos Vajna CommitDate: Wed Mar 8 08:06:59 2023 + oox, sd: fix ever-increasing chart IDs when exporting to PPTX Bring the static counter under the control of DrawingML::ResetMlCounters(), so the first chart is always chart1.xml, even if the same process already exported a chart previously. XLSX is a separate codepath, this fix doesn't help with that yet. Change-Id: Idf6e576ba94e254ae9782ef86e85542efd80127f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148457 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index 21914fbf57d1..5dc243e8536c 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -163,6 +163,7 @@ protected: /// If set, this is the parent of the currently handled shape. css::uno::Reference m_xParent; bool mbIsBackgroundDark; +static sal_Int32 mnChartCount; /// True when exporting presentation placeholder shape. bool mbPlaceholder; diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 26858cac40cf..5f2e1a7b4558 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -243,6 +243,7 @@ std::stack DrawingML::mnWdpImageCounter; std::stack> DrawingML::maWdpCache; sal_Int32 DrawingML::mnDrawingMLCount = 0; sal_Int32 DrawingML::mnVmlCount = 0; +sal_Int32 DrawingML::mnChartCount = 0; std::stack> DrawingML::maExportGraphics; sal_Int16 DrawingML::GetScriptType(const OUString& rStr) @@ -273,6 +274,7 @@ void DrawingML::ResetMlCounters() { mnDrawingMLCount = 0; mnVmlCount = 0; +mnChartCount = 0; } void DrawingML::PushExportGraphics() diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 676d3f75c201..6993a7c9c304 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -2520,8 +2520,7 @@ ShapeExport& ShapeExport::WriteOLE2Shape( const Reference< XShape >& xShape ) // TODO: With Chart extracted this cannot really happen since // no Chart could've been added at all ChartExport aChartExport( mnXmlNamespace, GetFS(), xChartDoc, GetFB(), GetDocumentType() ); -static sal_Int32 nChartCount = 0; -aChartExport.WriteChartObj( xShape, GetNewShapeID( xShape ), ++nChartCount ); +aChartExport.WriteChartObj( xShape, GetNewShapeID( xShape ), ++mnChartCount ); #endif return *this; } diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx index 1ae7da9cc786..f857f10bec7f 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -428,6 +428,7 @@ bool PowerPointExport::importDocument() noexcept bool PowerPointExport::exportDocument() { +drawingml::DrawingML::ResetMlCounters(); DrawingML::PushExportGraphics(); maShapeMap.clear();
[Libreoffice-commits] core.git: include/oox oox/source sd/qa
include/oox/export/drawingml.hxx |4 + oox/source/export/drawingml.cxx| 78 + sd/qa/unit/data/odp/tdf153105.odp |binary sd/qa/unit/export-tests-ooxml3.cxx | 16 +++ 4 files changed, 98 insertions(+) New commits: commit 11451781d4c562f506a3aae3732e35b92387b4db Author: Tibor Nagy AuthorDate: Mon Feb 20 16:13:17 2023 +0100 Commit: László Németh CommitDate: Tue Feb 28 11:21:12 2023 + tdf#153105 PPTX export: fix "Custom position/size" background image Map size and the 9 preset positions of the ODF background image style "Custom position/size" to the OOXML a:stretch/a:fillRect with the appropriate left/top/right/bottom arguments. Note: it seems, applying a:stretch or a:tile was not mandatory, but missing a:stretch resulted non-editable document in Office 365. Note: the import of the PPTX mapping hasn't been implemented, yet. Follow-up to commit e8335bac5690b6beccb5ca9b36281c89fb2f28f5 "tdf#153107 OOXML export: fix scale of tile of shape background". Change-Id: Ie940ebc2610c5b75126da05678a04ed1552cacb3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147337 Tested-by: László Németh Reviewed-by: László Németh diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index 3613eb49cdd0..21914fbf57d1 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -281,6 +281,10 @@ public: css::uno::Reference const& rxGraphic, css::awt::Size const& rSize); +void WriteXGraphicCustomPosition(css::uno::Reference const& rXPropSet, + css::uno::Reference const& rxGraphic, + css::awt::Size const& rSize); + void WriteLinespacing(const css::style::LineSpacing& rLineSpacing, float fFirstCharHeight); OUString WriteXGraphicBlip(css::uno::Reference const & rXPropSet, diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 24463a2abf9d..d3fb8a3daf97 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1584,6 +1584,9 @@ void DrawingML::WriteXGraphicBlipMode(uno::Reference const case BitmapMode_STRETCH: WriteXGraphicStretch(rXPropSet, rxGraphic); break; +case BitmapMode_NO_REPEAT: +WriteXGraphicCustomPosition(rXPropSet, rxGraphic, rSize); +break; default: break; } @@ -1923,6 +1926,81 @@ void DrawingML::WriteXGraphicTile(uno::Reference const& rXP OUString::number(nSizeY), XML_algn, sRectanglePoint); } +void DrawingML::WriteXGraphicCustomPosition(uno::Reference const& rXPropSet, +uno::Reference const& rxGraphic, +css::awt::Size const& rSize) +{ +Graphic aGraphic(rxGraphic); +Size aOriginalSize(aGraphic.GetPrefSize()); +const MapMode& rMapMode = aGraphic.GetPrefMapMode(); +// if the original size is in pixel, convert it to mm100 +if (rMapMode.GetMapUnit() == MapUnit::MapPixel) +aOriginalSize = Application::GetDefaultDevice()->PixelToLogic(aOriginalSize, + MapMode(MapUnit::Map100thMM)); +double nSizeX = 0; +if (GetProperty(rXPropSet, "FillBitmapSizeX")) +{ +mAny >>= nSizeX; +if (nSizeX <= 0) +{ +if (nSizeX == 0) +nSizeX = aOriginalSize.Width(); +else +nSizeX /= 100; // percentage +} +} + +double nSizeY = 0; +if (GetProperty(rXPropSet, "FillBitmapSizeY")) +{ +mAny >>= nSizeY; +if (nSizeY <= 0) +{ +if (nSizeY == 0) +nSizeY = aOriginalSize.Height(); +else +nSizeY /= 100; // percentage +} +} + +if (nSizeX < 0 && nSizeY < 0 && rSize.Width != 0 && rSize.Height != 0) +{ +nSizeX = rSize.Width * std::abs(nSizeX); +nSizeY = rSize.Height * std::abs(nSizeY); +} + +sal_Int32 nL = 0, nT = 0, nR = 0, nB = 0; +if (GetProperty(rXPropSet, "FillBitmapRectanglePoint")) +{ +sal_Int32 nWidth = (1 - (nSizeX / rSize.Width)) * 10; +sal_Int32 nHeight = (1 - (nSizeY / rSize.Height)) * 10; + +switch (*o3tl::doAccess(mAny)) +{ +case RectanglePoint_LEFT_TOP: nR = nWidth; nB = nHeight; break; +case RectanglePoint_RIGHT_TOP: nL = nWidth; nB = nHeight; break; +case RectanglePoint_LEFT_BOTTOM: nR = nWidth; nT = nHeight; break; +case RectanglePoint_RIGHT_BOTTOM: nL = nWidth; nT = nHeight; break; +case RectanglePoint_LEFT_MIDDLE: nR = nWidth;
[Libreoffice-commits] core.git: include/oox
include/oox/core/filterbase.hxx |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) New commits: commit a9c147e20a90ab91376ea8f2d086d89197b38a75 Author: Noel Grandin AuthorDate: Mon Feb 20 15:45:49 2023 +0200 Commit: Noel Grandin CommitDate: Mon Feb 20 17:53:07 2023 + BaseMutex in oox::core::FilterBase is unused Change-Id: Ie101a45c435ce10136761dd210d927a4b271507c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147339 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/oox/core/filterbase.hxx b/include/oox/core/filterbase.hxx index 4ef7018d5fda..eec0d6a19cef 100644 --- a/include/oox/core/filterbase.hxx +++ b/include/oox/core/filterbase.hxx @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include @@ -94,7 +93,7 @@ typedef ::cppu::WeakImplHelper< css::document::XFilter > FilterBase_BASE; -class OOX_DLLPUBLIC FilterBase : public FilterBase_BASE, public ::cppu::BaseMutex +class OOX_DLLPUBLIC FilterBase : public FilterBase_BASE { public: /// @throws css::uno::RuntimeException
[Libreoffice-commits] core.git: include/oox include/svx oox/source sd/qa sd/source svx/source
include/oox/drawingml/shape.hxx |3 include/svx/svdmodel.hxx |4 oox/source/drawingml/shape.cxx |4 oox/source/ppt/slidepersist.cxx | 232 +-- sd/qa/unit/data/pptx/standardConnectors.pptx |binary sd/qa/unit/import-tests.cxx | 34 +++ sd/source/ui/docshell/docshel4.cxx |8 svx/source/svdraw/svdmodel.cxx | 21 ++ svx/source/svdraw/svdoedge.cxx | 10 - 9 files changed, 265 insertions(+), 51 deletions(-) New commits: commit a2c32afcae257e797ad69ab2346bbe3b6a2fa8ae Author: Tibor Nagy AuthorDate: Thu Jan 26 09:17:56 2023 +0100 Commit: László Németh CommitDate: Fri Feb 17 20:01:46 2023 + tdf#149756 tdf#152545 PPTX import: position of standard connector - part2 and add new compatibility option "ConnectorUseSnapRect". Standard connectors (bentConnector3, bentConnector4, bentConnector5) are improved. MSO calculates the edge track differently, so have to add "ConnectorUseSnapRect" compatibility option: - For PPTX file format, it is set to true and use the snap rectangle - For ODP format, it is set to false by default and use the bounding rectangle. Follow-up to commit eec48130271188cab63665acedbabf1ff5e850a2 "tdf#148926 tdf#151678 PPTX import: position of standard connector - part1" (bentConnector2) Change-Id: Icca84708d6e10d44ebf7262415d055ce9cfc157d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146162 Tested-by: László Németh Reviewed-by: László Németh diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx index 36017132e83d..72ce51ef6476 100644 --- a/include/oox/drawingml/shape.hxx +++ b/include/oox/drawingml/shape.hxx @@ -137,6 +137,7 @@ public: CustomShapePropertiesPtr& getCustomShapeProperties(){ return mpCustomShapePropertiesPtr; } OUString& getConnectorName() { return msConnectorName; } +std::vector& getConnectorAdjustments() { return maConnectorAdjustmentList; }; ConnectorShapePropertiesList& getConnectorShapeProperties() { return maConnectorShapePropertiesList; } voidsetConnectorShape(bool bConnector) { mbConnector = bConnector; } boolisConnectorShape() const { return mbConnector; } @@ -330,6 +331,8 @@ protected: css::awt::Size maChSize; // only used for group shapes css::awt::Point maChPosition; // only used for group shapes +std::vector maConnectorAdjustmentList; // only used for connector shapes + TextBodyPtr mpTextBody; LinePropertiesPtr mpLinePropertiesPtr; LinePropertiesPtr mpShapeRefLinePropPtr; diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx index 76c63a40d351..6d130dfe0599 100644 --- a/include/svx/svdmodel.hxx +++ b/include/svx/svdmodel.hxx @@ -574,6 +574,10 @@ public: void SetLegacySingleLineFontwork(bool bEnabled); bool IsLegacySingleLineFontwork() const; +// tdf#149756 compatibility flag +void SetConnectorUseSnapRect(bool bEnabled); +bool IsConnectorUseSnapRect() const; + void ReformatAllTextObjects(); std::unique_ptr createOutliner( OutlinerMode nOutlinerMode ); diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index b3162381534a..fac027376784 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1692,6 +1692,10 @@ Reference< XShape > const & Shape::createAndInsert( RTL_TEXTENCODING_UTF8); msConnectorName = sConnectorShapePresetTypeName; +auto aAdjustmentList = mpCustomShapePropertiesPtr->getAdjustmentGuideList(); +for (size_t i = 0; i < aAdjustmentList.size(); i++) + maConnectorAdjustmentList.push_back(aAdjustmentList[i].maFormula); + sal_Int32 nType = mpCustomShapePropertiesPtr->getShapePresetType(); switch (nType) { diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx index ca296561a52f..7298eea1247c 100644 --- a/oox/source/ppt/slidepersist.cxx +++ b/oox/source/ppt/slidepersist.cxx @@ -386,7 +386,7 @@ static void lcl_SetEdgeLineValue(uno::Reference& rXConnector, { sal_Int32 nEdge = 0; awt::Point aStartPt, aEndPt; -tools::Rectangle aStartRect, aEndRect; +tools::Rectangle aS, aE; // Start, End rectangle uno::Reference xStartSp, xEndSp; uno::Reference xPropSet(rXConnector, uno::UNO_QUERY); xPropSet->getPropertyValue("EdgeStartPoint") >>= aStartPt; @@ -401,80 +401,218 @@ static void lcl_SetEdgeLineValue(uno::Reference& rXConnector, SdrObject* pStartObj = xStartSp.is() ? SdrObject::getSdrObjectFromXShape(xStartSp) : nullptr; SdrObject* pEndObj = xEndSp.is() ?
[Libreoffice-commits] core.git: include/oox oox/source starmath/source sw/source
include/oox/core/filterbase.hxx |9 - oox/source/core/filterbase.cxx |2 +- oox/source/export/shapes.cxx |2 +- starmath/source/ooxmlexport.cxx |2 +- sw/source/filter/ww8/docxattributeoutput.cxx | 18 ++ 5 files changed, 21 insertions(+), 12 deletions(-) New commits: commit 2c0c95af13662f37e7f217e0bd0fc87ebde36f1b Author: Michael Stahl AuthorDate: Wed Feb 1 11:12:19 2023 +0100 Commit: Michael Stahl CommitDate: Wed Feb 1 11:34:49 2023 + tdf#107841 oox: rename ambiguous and confusing ECMA_DIALECT Change-Id: I731b3808896347332f938811715597ac814ae1d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146433 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/include/oox/core/filterbase.hxx b/include/oox/core/filterbase.hxx index 73b8e2d8e7f2..4ef7018d5fda 100644 --- a/include/oox/core/filterbase.hxx +++ b/include/oox/core/filterbase.hxx @@ -73,7 +73,14 @@ namespace oox::core { enum OoxmlVersion { -ECMA_DIALECT, +/** There are currently 5 editions of ECMA-376, latest is from 2021. + * 1st edition allegedly corresponds to Word 2007 + * 2nd edition allegedly corresponds to ISO 29500:2008 + * it's unclear what changed in later editions; there is: +Annex M. Differences Between ECMA-376:2016 and ECMA-376:2006 +but that's relative to 1st edition. +*/ +ECMA_376_1ST_EDITION, ISOIEC_29500_2008 }; diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx index 5357dae3f86b..cc00953685a0 100644 --- a/oox/source/core/filterbase.cxx +++ b/oox/source/core/filterbase.cxx @@ -168,7 +168,7 @@ struct FilterBaseImpl FilterBaseImpl::FilterBaseImpl( const Reference< XComponentContext >& rxContext ) : meDirection( FILTERDIRECTION_UNKNOWN ), -meVersion( ECMA_DIALECT ), +meVersion(ECMA_376_1ST_EDITION), mxComponentContext( rxContext, UNO_SET_THROW ), mbExportVBA(false), mbExportTemplate(false) diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 1c828d438653..676d3f75c201 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -2701,7 +2701,7 @@ ShapeExport& ShapeExport::WriteOLE2Shape( const Reference< XShape >& xShape ) // pic element SdrObject* pSdrOLE2(SdrObject::getSdrObjectFromXShape(xShape)); // The spec doesn't allow here, but PowerPoint requires it. -bool bEcma = mpFB->getVersion() == oox::core::ECMA_DIALECT; +bool const bEcma = mpFB->getVersion() == oox::core::ECMA_376_1ST_EDITION; if (bEcma) if (auto pOle2Obj = dynamic_cast(pSdrOLE2)) { diff --git a/starmath/source/ooxmlexport.cxx b/starmath/source/ooxmlexport.cxx index d90f56cc488a..fd3a9498a681 100644 --- a/starmath/source/ooxmlexport.cxx +++ b/starmath/source/ooxmlexport.cxx @@ -107,7 +107,7 @@ void SmOoxmlExport::HandleText( const SmNode* pNode, int /*nLevel*/) m_pSerializer->singleElementNS(XML_m, XML_nor); m_pSerializer->endElementNS( XML_m, XML_rPr ); } -if (drawingml::DOCUMENT_DOCX == m_DocumentType && ECMA_DIALECT == version) +if (drawingml::DOCUMENT_DOCX == m_DocumentType && ECMA_376_1ST_EDITION == version) { // HACK: MSOffice2007 does not import characters properly unless this font is explicitly given m_pSerializer->startElementNS(XML_w, XML_rPr); m_pSerializer->singleElementNS( XML_w, XML_rFonts, FSNS( XML_w, XML_ascii ), "Cambria Math", diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 3a0bfaf5baf7..05e0ea5f0479 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -4307,7 +4307,7 @@ void DocxAttributeOutput::TableCellProperties( ww8::WW8TableNodeInfoInner::Point const SwTableBox *pTableBox = pTableTextNodeInfoInner->getTableBox( ); -bool bEcma = GetExport().GetFilter().getVersion( ) == oox::core::ECMA_DIALECT; +bool const bEcma = GetExport().GetFilter().getVersion() == oox::core::ECMA_376_1ST_EDITION; // Output any table cell redlines if there are any attached to this specific cell TableCellRedline( pTableTextNodeInfoInner ); @@ -4561,7 +4561,7 @@ sal_Int32 lcl_getWordCompatibilityMode(const DocxExport& rDocExport) void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ) { -bool bEcma = GetExport().GetFilter().getVersion( ) == oox::core::ECMA_DIALECT; +bool const bEcma = GetExport().GetFilter().getVersion() == oox::core::ECMA_376_1ST_EDITION; // Write the table properties m_pSerializer->startElementNS(XML_w, XML_tblPr); @@ -4955,7 +4955,7 @@ void DocxAttributeOutput::TableDefaultCellMargins( ww8::WW8TableNodeInfoInner::P const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox(); const SwFrameFormat *
[Libreoffice-commits] core.git: include/oox oox/source sd/qa sd/source
include/oox/export/drawingml.hxx | 27 - oox/source/export/drawingml.cxx | 55 oox/source/export/shapes.cxx |6 +-- sd/qa/unit/data/odp/tdf153107.odp|binary sd/qa/unit/export-tests-ooxml2.cxx | 60 +++ sd/source/filter/eppt/pptx-epptooxml.cxx |4 +- 6 files changed, 112 insertions(+), 40 deletions(-) New commits: commit e8335bac5690b6beccb5ca9b36281c89fb2f28f5 Author: Tibor Nagy AuthorDate: Mon Jan 23 09:33:13 2023 +0100 Commit: László Németh CommitDate: Thu Jan 26 19:49:09 2023 + tdf#153107 OOXML export: fix scale of tile of shape background Relative scale values were exported as absolute values, resulting broken shape background. Change-Id: Ia38e125862e7f8ceff5d41754340723c3a9eb028 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145996 Tested-by: László Németh Reviewed-by: László Németh diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index c131632aea8d..3613eb49cdd0 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -248,16 +248,18 @@ public: void WriteGrabBagGradientFill( const css::uno::Sequence< css::beans::PropertyValue >& aGradientStops, css::awt::Gradient rGradient); -void WriteBlipOrNormalFill( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, -const OUString& rURLPropName ); -void WriteBlipFill( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, -const OUString& sURLPropName ); -void WriteBlipFill( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, - const OUString& sURLPropName, sal_Int32 nXmlNamespace ); +void WriteBlipOrNormalFill(const css::uno::Reference& rXPropSet, + const OUString& rURLPropName, const css::awt::Size& rSize = {}); +void WriteBlipFill(const css::uno::Reference& rXPropSet, + const OUString& sURLPropName, const css::awt::Size& rSize = {}); +void WriteBlipFill(const css::uno::Reference& rXPropSet, + const css::awt::Size& rSize, const OUString& sURLPropName, + sal_Int32 nXmlNamespace); void WriteXGraphicBlipFill(css::uno::Reference const & rXPropSet, css::uno::Reference const & rxGraphic, - sal_Int32 nXmlNamespace, bool bWriteMode, bool bRelPathToMedia = false); + sal_Int32 nXmlNamespace, bool bWriteMode, + bool bRelPathToMedia = false, css::awt::Size const& rSize = {}); void WritePattFill( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet ); void WritePattFill(const css::uno::Reference& rXPropSet, @@ -276,7 +278,8 @@ public: css::uno::Reference const & rxGraphic); void WriteXGraphicTile(css::uno::Reference const& rXPropSet, - css::uno::Reference const& rxGraphic); + css::uno::Reference const& rxGraphic, + css::awt::Size const& rSize); void WriteLinespacing(const css::style::LineSpacing& rLineSpacing, float fFirstCharHeight); @@ -286,8 +289,9 @@ public: void WriteImageBrightnessContrastTransparence(css::uno::Reference const & rXPropSet); -void WriteXGraphicBlipMode(css::uno::Reference const & rXPropSet, - css::uno::Reference const & rxGraphic); +void WriteXGraphicBlipMode(css::uno::Reference const& rXPropSet, + css::uno::Reference const& rxGraphic, + css::awt::Size const& rSize); void WriteShapeTransformation(const css::uno::Reference< css::drawing::XShape >& rXShape, sal_Int32 nXmlNamespace, bool bFlipH = false, bool bFlipV = false, bool bSuppressRotation = false, bool bSuppressFlipping = false, bool bFlippedBeforeRotation = false); @@ -327,7 +331,8 @@ public: void WriteEmptyCustomGeometry(); void WritePolyPolygon(const css::uno::Reference& rXShape, const bool bClosed); -void WriteFill( const css::uno::Reference< css::beans::XPropertySet >& xPropSet ); +void WriteFill(const css::uno::Reference& xPropSet, + const css::awt::Size& rSize = {}); void WriteShapeStyle( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet ); void WriteShapeEffects( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet ); void WriteShapeEffect( std::u16string_view sName, const css::uno::Sequence< css::beans::PropertyValue >& aEffectProps ); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 751aabc859eb..8e57e9cecb36 100644 ---
[Libreoffice-commits] core.git: include/oox oox/Library_oox.mk oox/source
include/oox/export/ThemeExport.hxx | 38 + oox/Library_oox.mk |1 oox/source/export/ThemeExport.cxx | 263 + 3 files changed, 302 insertions(+) New commits: commit 958d4667e361a1d8461889117ca830a5da85d0ee Author: Tomaž Vajngerl AuthorDate: Mon Dec 12 22:18:43 2022 +0900 Commit: Tomaž Vajngerl CommitDate: Mon Jan 2 12:44:45 2023 + oox: add ThemeExport that exports a svx::Theme into theme.xml file Adds ThemeExport that takes a svx::Theme as input and exports that into a theme.xml file in the OOXML document. Currently supports exporting of color schemes and font schemes. Format schemes are hard-coded for now. The ThemeExport isn't yet used in any actual export functionality. Change-Id: I5ca9c256da65be77e7192be7d66c73d26d78ebd8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143996 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/oox/export/ThemeExport.hxx b/include/oox/export/ThemeExport.hxx new file mode 100644 index ..02f222cadafe --- /dev/null +++ b/include/oox/export/ThemeExport.hxx @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include +#include +#include +#include + +namespace oox +{ +class OOX_DLLPUBLIC ThemeExport +{ +private: +oox::core::XmlFilterBase* mpFilterBase; + +public: +ThemeExport(oox::core::XmlFilterBase* pFilterBase); + +void write(OUString const& rPath, svx::Theme const& rTheme); + +private: +static bool writeColorSet(sax_fastparser::FSHelperPtr pFS, svx::Theme const& rTheme); +static bool writeFontScheme(sax_fastparser::FSHelperPtr pFS, +svx::FontScheme const& rFontScheme); +static bool writeFormatScheme(sax_fastparser::FSHelperPtr pFS); +}; + +} // end namespace oox + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/Library_oox.mk b/oox/Library_oox.mk index aba27c786f8d..67f4f6e1ec0f 100644 --- a/oox/Library_oox.mk +++ b/oox/Library_oox.mk @@ -231,6 +231,7 @@ $(eval $(call gb_Library_add_exception_objects,oox,\ oox/source/export/DMLPresetShapeExport \ oox/source/export/shapes \ oox/source/export/vmlexport \ +oox/source/export/ThemeExport \ oox/source/helper/attributelist \ oox/source/helper/binaryinputstream \ oox/source/helper/binaryoutputstream \ diff --git a/oox/source/export/ThemeExport.cxx b/oox/source/export/ThemeExport.cxx new file mode 100644 index ..f11b894f924a --- /dev/null +++ b/oox/source/export/ThemeExport.cxx @@ -0,0 +1,263 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace oox +{ +ThemeExport::ThemeExport(oox::core::XmlFilterBase* pFilterBase) +: mpFilterBase(pFilterBase) + +{ +} + +void ThemeExport::write(OUString const& rPath, svx::Theme const& rTheme) +{ +sax_fastparser::FSHelperPtr pFS = mpFilterBase->openFragmentStreamWithSerializer( +rPath, "application/vnd.openxmlformats-officedocument.theme+xml"); + +OUString aThemeName = rTheme.GetName(); + +pFS->startElementNS(XML_a, XML_theme, FSNS(XML_xmlns, XML_a), +mpFilterBase->getNamespaceURL(OOX_NS(dml)), XML_name, aThemeName); + +pFS->startElementNS(XML_a, XML_themeElements); + +const svx::ColorSet* pColorSet = rTheme.GetColorSet(); + +pFS->startElementNS(XML_a, XML_clrScheme, XML_name, pColorSet->getName()); +writeColorSet(pFS, rTheme); +pFS->endElementNS(XML_a, XML_clrScheme); + +svx::FontScheme const& rFontScheme = rTheme.getFontScheme(); +pFS->startElementNS(XML_a, XML_fontScheme, XML_name, rFontScheme.getName()); +writeFontScheme(pFS, rFontScheme); +pFS->endElementNS(XML_a, XML_fontScheme); + +pFS->startElementNS(XML_a, XML_fmtScheme); +writeFormatScheme(pFS); +pFS->endElementNS(XML_a, XML_fmtScheme); + +pFS->endElementNS(XML_a, XML_themeElements); +pFS->endElementNS(XML_a, XML_theme); + +pFS->endDocument(); +} + +namespace +{ +void fillAttrList(rtl::Reference const& pAttrList, + svx::ThemeFont const& rThemeFont) +{ +pAttrList->add(XML_typeface, rThemeFont.maTypeface); +pAttrList->add(XML_panose, rThemeFont.maPanose); +pAttrList->add(XML_pitchFamily,
[Libreoffice-commits] core.git: include/oox oox/Library_oox.mk oox/source solenv/clang-format sw/qa writerfilter/inc writerfilter/Library_writerfilter.mk writerfilter/source
include/oox/drawingml/ThemeFilterBase.hxx | 58 + include/oox/drawingml/themefragmenthandler.hxx |1 oox/Library_oox.mk |1 oox/source/drawingml/ThemeFilterBase.cxx | 50 + oox/source/drawingml/themefragmenthandler.cxx | 56 - oox/source/shape/ShapeContextHandler.cxx |4 solenv/clang-format/excludelist|1 sw/qa/core/theme/ThemeTest.cxx | 46 + writerfilter/Library_writerfilter.mk |3 writerfilter/inc/ooxml/OOXMLDocument.hxx |3 writerfilter/source/dmapper/DomainMapper.cxx | 27 writerfilter/source/dmapper/DomainMapper_Impl.cxx |8 writerfilter/source/dmapper/DomainMapper_Impl.hxx | 19 writerfilter/source/dmapper/ThemeHandler.cxx | 422 + writerfilter/source/dmapper/ThemeHandler.hxx | 35 writerfilter/source/dmapper/ThemeTable.cxx | 563 - writerfilter/source/dmapper/ThemeTable.hxx | 58 - writerfilter/source/ooxml/OOXMLDocumentImpl.cxx| 14 writerfilter/source/ooxml/OOXMLDocumentImpl.hxx|9 writerfilter/source/ooxml/OOXMLFactory.hxx |2 writerfilter/source/ooxml/OOXMLFastContextHandlerTheme.cxx | 69 + writerfilter/source/ooxml/OOXMLFastContextHandlerTheme.hxx | 46 + writerfilter/source/ooxml/model.xml|2 23 files changed, 821 insertions(+), 676 deletions(-) New commits: commit 31213fc7cae358038aaec853584782c698f8 Author: Tomaž Vajngerl AuthorDate: Tue Dec 6 17:33:44 2022 +0900 Commit: Tomaž Vajngerl CommitDate: Sun Jan 1 23:35:17 2023 + sw: read theme from OOXML file and set it to the draw page This change extends writerfilter to use oox::ThemeFragmentHandler to read the theme properties, and sets that to the one and only draw page of a Writer document. This change also removes ThemeTable and replaces it with the ThemeHandler, which takes theme font data from svx::Theme instead. In addition, a test has been writen, which loads a document with a theme, and asserts the draw page has the theme and the theme properties currently supported. Change-Id: Iff0048cd21ea030ac55287707852acc463ec3cb0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143699 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/oox/drawingml/ThemeFilterBase.hxx b/include/oox/drawingml/ThemeFilterBase.hxx new file mode 100644 index ..7f311e206a90 --- /dev/null +++ b/include/oox/drawingml/ThemeFilterBase.hxx @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include +#include +#include +#include +#include + +namespace oox::drawingml +{ +class OOX_DLLPUBLIC ThemeFilterBase final : public core::XmlFilterBase +{ +public: +typedef rtl::Reference Pointer_t; + +explicit ThemeFilterBase(css::uno::Reference const& rxContext); + +virtual ~ThemeFilterBase() override; + +/** Has to be implemented by each filter, returns the current theme. */ +virtual const oox::drawingml::Theme* getCurrentTheme() const override; + +/** May be implemented by filters which handle Diagrams, default returns empty ptr */ +virtual std::shared_ptr getCurrentThemePtr() const override; + +void setCurrentTheme(const oox::drawingml::ThemePtr& pTheme); + +/** Has to be implemented by each filter to return the collection of VML shapes. */ +virtual oox::vml::Drawing* getVmlDrawing() override; + +/** Has to be implemented by each filter to return TableStyles. */ +virtual oox::drawingml::table::TableStyleListPtr getTableStyles() override; + +virtual oox::drawingml::chart::ChartConverter* getChartConverter() override; + +virtual oox::ole::VbaProject* implCreateVbaProject() const override; + +virtual bool importDocument() override { return true; } +virtual bool exportDocument() override { return false; } + +private: +virtual OUString SAL_CALL getImplementationName() override; + +oox::drawingml::ThemePtr mpTheme; +}; + +} // namespace oox::drawingml + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/drawingml/themefragmenthandler.hxx b/include/oox/drawingml/themefragmenthandler.hxx index e433c350de80..918a3eb861b9 100644 --- a/include/oox/drawingml/themefragmenthandler.hxx +++ b/include/oox/drawingml/themefragmenthandler.hxx @@ -44,6 +44,7 @@ public:
[Libreoffice-commits] core.git: include/oox include/svx oox/inc oox/source svx/CppunitTest_svx_unit.mk svx/qa
include/oox/drawingml/theme.hxx | 12 +- include/svx/ColorSets.hxx | 149 ++ oox/inc/drawingml/textfont.hxx|3 oox/source/drawingml/textfont.cxx |9 + oox/source/drawingml/theme.cxx| 69 +++- oox/source/drawingml/themeelementscontext.cxx | 23 ++-- svx/CppunitTest_svx_unit.mk |1 svx/qa/unit/ThemeTest.cxx | 40 ++ 8 files changed, 295 insertions(+), 11 deletions(-) New commits: commit d5a71bc6a28f8a3d726b2ac4688c7cef9d77ddf0 Author: Tomaž Vajngerl AuthorDate: Mon Dec 12 22:12:58 2022 +0900 Commit: Tomaž Vajngerl CommitDate: Sun Jan 1 23:34:32 2023 + oox: add support for importing font scheme into a svx::Theme Change-Id: I862256a17ce84c85174678f3fd03c8ef6661f2c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143995 Tested-by: Tomaž Vajngerl Reviewed-by: Tomaž Vajngerl diff --git a/include/oox/drawingml/theme.hxx b/include/oox/drawingml/theme.hxx index f7b4a262ffb8..ebd05957bf3b 100644 --- a/include/oox/drawingml/theme.hxx +++ b/include/oox/drawingml/theme.hxx @@ -35,8 +35,12 @@ namespace com::sun::star { namespace drawing { class XDrawPage; } namespace xml::dom { class XDocument; } } +namespace svx { +class Theme; +} -namespace oox::drawingml { +namespace oox::drawingml +{ struct EffectProperties; struct FillProperties; @@ -82,6 +86,10 @@ public: FontScheme& getFontScheme() { return maFontScheme; } const FontScheme&getFontScheme() const { return maFontScheme; } + +std::map>>& getSupplementalFontMap() { return maSupplementalFontMap; } +std::map>> const& getSupplementalFontMap() const { return maSupplementalFontMap; } + /** Returns theme font properties by scheme type (major/minor). */ const TextCharacterProperties* getFontStyle( sal_Int32 nSchemeType ) const; /** Returns theme font by placeholder name, e.g. the major latin theme font for the font name '+mj-lt'. */ @@ -99,6 +107,7 @@ public: const css::uno::Reference& getFragment() const { return mxFragment; } void setFragment( const css::uno::Reference< css::xml::dom::XDocument>& xRef ) { mxFragment=xRef; } +std::unique_ptr createSvxTheme() const; void addTheme(const css::uno::Reference& xDrawPage) const; private: @@ -111,6 +120,7 @@ private: LineStyleList maLineStyleList; EffectStyleList maEffectStyleList; FontScheme maFontScheme; +std::map>> maSupplementalFontMap; Shape maSpDef; Shape maLnDef; Shape maTxDef; diff --git a/include/svx/ColorSets.hxx b/include/svx/ColorSets.hxx index 47e1d8866e5d..718b79b3e66c 100644 --- a/include/svx/ColorSets.hxx +++ b/include/svx/ColorSets.hxx @@ -101,6 +101,146 @@ public: const ColorSet& getColorSet(std::u16string_view rName); }; +struct SVXCORE_DLLPUBLIC ThemeSupplementalFont +{ +OUString maScript; +OUString maTypeface; +}; + +struct SVXCORE_DLLPUBLIC ThemeFont +{ +OUString maTypeface; +OUString maPanose; +sal_Int16 maPitch; +sal_Int16 maFamily; +sal_Int32 maCharset; + +sal_Int16 getPitchFamily() const +{ +return (maPitch & 0x0F) | (maFamily & 0x0F) << 4; +} +}; + +class SVXCORE_DLLPUBLIC FontScheme +{ +private: +OUString maName; + +ThemeFont maMinorLatin; +ThemeFont maMinorAsian; +ThemeFont maMinorComplex; + +ThemeFont maMajorLatin; +ThemeFont maMajorAsian; +ThemeFont maMajorComplex; + +std::vector maMinorSupplementalFontList; +std::vector maMajorSupplementalFontList; + +public: +FontScheme() = default; +FontScheme(OUString const& rName) +: maName(rName) +{} + +const OUString& getName() const +{ +return maName; +} + +ThemeFont const& getMinorLatin() const +{ +return maMinorLatin; +} +void setMinorLatin(ThemeFont const& aMinor) +{ +maMinorLatin = aMinor; +} + +ThemeFont const& getMinorAsian() const +{ +return maMinorAsian; +} +void setMinorAsian(ThemeFont const& aMinor) +{ +maMinorAsian = aMinor; +} + +ThemeFont const& getMinorComplex() const +{ +return maMinorComplex; +} +void setMinorComplex(ThemeFont const& aMinor) +{ +maMinorComplex = aMinor; +} + +ThemeFont const& getMajorLatin() const +{ +return maMajorLatin; +} +void setMajorLatin(ThemeFont const& aMajor) +{ +maMajorLatin = aMajor; +} + +ThemeFont const& getMajorAsian() const +{ +return maMajorAsian; +} +void setMajorAsian(ThemeFont const& aMajor) +{ +maMajorAsian = aMajor; +} + +ThemeFont const& getMajorComplex() const +{ +return maMajorComplex; +} +void
[Libreoffice-commits] core.git: include/oox include/svx oox/source
include/oox/drawingml/clrscheme.hxx |3 +++ include/svx/ColorSets.hxx |2 +- oox/source/drawingml/clrscheme.cxx | 27 +++ oox/source/drawingml/theme.cxx | 30 -- 4 files changed, 51 insertions(+), 11 deletions(-) New commits: commit a6253e13e0f3f866ab47e4271db9a80d8cbce708 Author: Tomaž Vajngerl AuthorDate: Mon Dec 12 21:13:07 2022 +0900 Commit: Tomaž Vajngerl CommitDate: Mon Dec 26 08:55:14 2022 + oox: set svx::Theme directly to a SdrPage when importing Bypass the need to set the theme data (svx::Theme) throught UNO as multiple nested properties. Much more properties will be added to the svx::Theme and this will simplify handling a lot. Change-Id: I0b54628ff22c7c823a999de257fd5bb45e736bdb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143992 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/oox/drawingml/clrscheme.hxx b/include/oox/drawingml/clrscheme.hxx index a4f0b653441a..fd7662511a88 100644 --- a/include/oox/drawingml/clrscheme.hxx +++ b/include/oox/drawingml/clrscheme.hxx @@ -30,6 +30,7 @@ #include #include #include +#include namespace oox::drawingml { @@ -94,6 +95,8 @@ public: const OUString& GetName() const { return maName; } void ToAny(css::uno::Any& rVal) const; +void fill(svx::ColorSet& rColorSet) const; + }; } diff --git a/include/svx/ColorSets.hxx b/include/svx/ColorSets.hxx index 71f12c2dbe71..692e683218e8 100644 --- a/include/svx/ColorSets.hxx +++ b/include/svx/ColorSets.hxx @@ -50,7 +50,7 @@ constexpr ThemeColorType convertToThemeColorType(sal_Int32 nIndex) return static_cast(nIndex); } -class ColorSet +class SVXCORE_DLLPUBLIC ColorSet { OUString maColorSetName; std::vector maColors; diff --git a/oox/source/drawingml/clrscheme.cxx b/oox/source/drawingml/clrscheme.cxx index 19c0afd44900..225faf81eecf 100644 --- a/oox/source/drawingml/clrscheme.cxx +++ b/oox/source/drawingml/clrscheme.cxx @@ -120,6 +120,33 @@ void ClrScheme::ToAny(css::uno::Any& rVal) const rVal <<= comphelper::containerToSequence(aRet); } +void ClrScheme::fill(svx::ColorSet& rColorSet) const +{ +for (const auto& [nToken, rColor] : maClrScheme) +{ +switch (nToken) +{ +case XML_tx1: +case XML_dk1: rColorSet.add(0, rColor); break; +case XML_bg1: +case XML_lt1: rColorSet.add(1, rColor); break; +case XML_tx2: +case XML_dk2: rColorSet.add(2, rColor); break; +case XML_bg2: +case XML_lt2: rColorSet.add(3, rColor); break; +case XML_accent1: rColorSet.add(4, rColor); break; +case XML_accent2: rColorSet.add(5, rColor); break; +case XML_accent3: rColorSet.add(6, rColor); break; +case XML_accent4: rColorSet.add(7, rColor); break; +case XML_accent5: rColorSet.add(8, rColor); break; +case XML_accent6: rColorSet.add(9, rColor); break; +case XML_hlink: rColorSet.add(10, rColor); break; +case XML_folHlink: rColorSet.add(11, rColor); break; +default: break; +} +} +} + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/theme.cxx b/oox/source/drawingml/theme.cxx index f406f829ea91..885d87b1bb0f 100644 --- a/oox/source/drawingml/theme.cxx +++ b/oox/source/drawingml/theme.cxx @@ -24,6 +24,11 @@ #include #include #include +#include +#include +#include +#include +#include using namespace com::sun::star; @@ -105,16 +110,21 @@ const TextFont* Theme::resolveFont( std::u16string_view rName ) const void Theme::addTheme(const css::uno::Reference& xDrawPage) const { -beans::PropertyValue aColorScheme; -aColorScheme.Name = "ColorScheme"; -maClrScheme.ToAny(aColorScheme.Value); -beans::PropertyValues aValues = { -comphelper::makePropertyValue("Name", maThemeName), -comphelper::makePropertyValue("ColorSchemeName", maClrScheme.GetName()), -aColorScheme, -}; -uno::Reference xPropertySet(xDrawPage, uno::UNO_QUERY); -xPropertySet->setPropertyValue("Theme", uno::Any(aValues)); +SAL_WARN_IF(!xDrawPage.is(), "oox", "DrawPage is not set"); + +SdrPage* pPage = GetSdrPageFromXDrawPage(xDrawPage); + +SAL_WARN_IF(!pPage, "oox", "Can't get SdrPage from XDrawPage"); + +if (!pPage) +return; + +auto pTheme = std::make_unique(maThemeName); +auto pColorSet = std::make_unique(maClrScheme.GetName()); +maClrScheme.fill(*pColorSet); +pTheme->SetColorSet(std::move(pColorSet)); + +pPage->getSdrPageProperties().SetTheme(std::move(pTheme)); } } // namespace oox::drawingml
[Libreoffice-commits] core.git: include/oox oox/Library_oox.mk oox/source solenv/clang-format starmath/inc starmath/source sw/source writerfilter/source
include/oox/mathml/export.hxx | 45 -- include/oox/mathml/imexport.hxx | 25 +++--- oox/Library_oox.mk|3 - oox/source/drawingml/shape.cxx|6 +- oox/source/drawingml/textbodycontext.cxx |2 oox/source/export/shapes.cxx |7 +- oox/source/mathml/export.cxx | 18 --- oox/source/mathml/imexport.cxx|4 - solenv/clang-format/excludelist |5 -- starmath/inc/unomodel.hxx |9 +-- starmath/source/document.cxx |4 - starmath/source/ooxmlexport.cxx | 12 ++-- sw/source/filter/ww8/docxattributeoutput.cxx | 12 ++-- sw/source/filter/ww8/rtfattributeoutput.cxx |4 - writerfilter/source/dmapper/DomainMapper_Impl.cxx |4 - writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |5 +- writerfilter/source/rtftok/rtfdocumentimpl.cxx|6 +- 17 files changed, 58 insertions(+), 113 deletions(-) New commits: commit c3497353cabdef735dcebd66a8818ea117623dac Author: Stephan Bergmann AuthorDate: Fri Dec 16 17:22:54 2022 +0100 Commit: Stephan Bergmann CommitDate: Sun Dec 18 16:04:18 2022 + Combine oox::FormulaIm-/ExportBase The original classes were both only used as base classes of SmModel, and combining them will make it easier to replace the existing dynamic_casts to those classes with XUnoTunnel. (And see the upcoming commit introducing loplugin:unocast on why those dynamic_casts are dangerous.) Change-Id: I4b1e0594fb202e3423d57db6457aa0e1b1b0b612 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144353 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/include/oox/mathml/export.hxx b/include/oox/mathml/export.hxx deleted file mode 100644 index a9f3862867ed.. --- a/include/oox/mathml/export.hxx +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -#ifndef INCLUDED_OOX_MATHML_EXPORT_HXX -#define INCLUDED_OOX_MATHML_EXPORT_HXX - -#include -#include -#include -#include -#include -#include - -namespace oox -{ - -/** - Interface class, StarMath will implement writeFormula*() to write out markup - representing the formula. - */ -class OOX_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") FormulaExportBase -{ -public: -virtual void writeFormulaOoxml(::sax_fastparser::FSHelperPtr pSerializer, -oox::core::OoxmlVersion version, -oox::drawingml::DocumentType documentType, sal_Int8 nAlign) = 0; -virtual void writeFormulaRtf( OStringBuffer& rBuffer, rtl_TextEncoding nEncoding ) = 0; -enum eFormulaAlign { INLINE, CENTER, GROUPEDCENTER, LEFT, RIGHT }; - -protected: -FormulaExportBase(); - -~FormulaExportBase() {} -}; - -} // namespace - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/mathml/import.hxx b/include/oox/mathml/imexport.hxx similarity index 57% rename from include/oox/mathml/import.hxx rename to include/oox/mathml/imexport.hxx index eefb609178e5..a93216fb1199 100644 --- a/include/oox/mathml/import.hxx +++ b/include/oox/mathml/imexport.hxx @@ -6,11 +6,16 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef INCLUDED_OOX_MATHML_IMPORT_HXX -#define INCLUDED_OOX_MATHML_IMPORT_HXX +#ifndef INCLUDED_OOX_MATHML_IMEXPORT_HXX +#define INCLUDED_OOX_MATHML_IMEXPORT_HXX +#include #include +#include #include +#include +#include +#include #include namespace oox @@ -23,19 +28,25 @@ class XmlStream; /** Interface class, StarMath will implement readFormulaOoxml() to read OOXML - representing the formula and getFormulaSize() to provide the size of the resulting - formula. + representing the formula, getFormulaSize() to provide the size of the resulting + formula, and writeFormula*() to write out markup representing the formula. */ -class OOX_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") FormulaImportBase +class OOX_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") FormulaImExportBase { public: virtual void readFormulaOoxml( oox::formulaimport::XmlStream& stream ) = 0; virtual Size getFormulaSize() const = 0; +virtual void writeFormulaOoxml(::sax_fastparser::FSHelperPtr pSerializer, +oox::core::OoxmlVersion version, +oox::drawingml::DocumentType documentType, sal_Int8 nAlign) = 0; +virtual void
[Libreoffice-commits] core.git: include/oox oox/source sd/source sw/qa sw/source
include/oox/export/drawingml.hxx|5 +-- oox/source/export/drawingml.cxx | 31 +++- sd/source/filter/eppt/pptx-epptooxml.cxx|1 sw/qa/extras/ooxmlexport/data/artistic_effects.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport16.cxx | 20 sw/source/filter/ww8/docxexport.cxx |1 6 files changed, 40 insertions(+), 18 deletions(-) New commits: commit 01246f06cfeeb6a1070e82351e2559def4f5d820 Author: Tünde Tóth AuthorDate: Thu Nov 24 15:30:37 2022 +0100 Commit: László Németh CommitDate: Tue Nov 29 17:37:28 2022 +0100 tdf#152152 DOCX export: fix lost WDP images in artistic effects Handling of WDP image counter was incorrect if the document contains embedded documents, overwriting WDP images with the other ones. See also commit 55b1d635350cb76ee3e19e90c938eedd38ac3342 "tdf#152153 DOCX export: fix lost images at embedded documents" and commit cf2dc247ff5f726238856e9b46a4926a30430e14 "DOCX export: image deduplication and clean up" and commit b5f6a5cfc517ecd8aa6ba96471d854b07b92ebaa "ooxml: Do not repeat wdp files in artistic effects". Change-Id: Ia26784519f6d514ee8c90c7a91a367feeba140b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143235 Tested-by: László Németh Reviewed-by: László Németh diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index 543fb072921f..eb0fea23b95c 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -144,8 +144,8 @@ class OOX_DLLPUBLIC DrawingML private: static std::stack mnImageCounter; -static int mnWdpImageCounter; -static std::map maWdpCache; +static std::stack mnWdpImageCounter; +static std::stack> maWdpCache; static sal_Int32 mnDrawingMLCount; static sal_Int32 mnVmlCount; static std::stack> maExportGraphics; @@ -348,7 +348,6 @@ public: static bool IsGroupShape( const css::uno::Reference< css::drawing::XShape >& rXShape ); 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(); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 1da6391412fc..3418a125fac5 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -237,8 +237,8 @@ void WriteGradientPath(const awt::Gradient& rGradient, const FSHelperPtr& pFS, c // not thread safe std::stack DrawingML::mnImageCounter; -int DrawingML::mnWdpImageCounter = 1; -std::map DrawingML::maWdpCache; +std::stack DrawingML::mnWdpImageCounter; +std::stack> DrawingML::maWdpCache; sal_Int32 DrawingML::mnDrawingMLCount = 0; sal_Int32 DrawingML::mnVmlCount = 0; std::stack> DrawingML::maExportGraphics; @@ -267,12 +267,6 @@ sal_Int16 DrawingML::GetScriptType(const OUString& rStr) return css::i18n::ScriptType::LATIN; } -void DrawingML::ResetCounters() -{ -mnWdpImageCounter = 1; -maWdpCache.clear(); -} - void DrawingML::ResetMlCounters() { mnDrawingMLCount = 0; @@ -283,12 +277,18 @@ void DrawingML::PushExportGraphics() { mnImageCounter.push(1); maExportGraphics.emplace(); + +mnWdpImageCounter.push(1); +maWdpCache.emplace(); } void DrawingML::PopExportGraphics() { mnImageCounter.pop(); maExportGraphics.pop(); + +mnWdpImageCounter.pop(); +maWdpCache.pop(); } bool DrawingML::GetProperty( const Reference< XPropertySet >& rXPropertySet, const OUString& aName ) @@ -5864,11 +5864,14 @@ void DrawingML::WriteArtisticEffect( const Reference< XPropertySet >& rXPropSet OString DrawingML::WriteWdpPicture( const OUString& rFileId, const Sequence< sal_Int8 >& rPictureData ) { -std::map::iterator aCachedItem = maWdpCache.find( rFileId ); -if( aCachedItem != maWdpCache.end() ) -return OUStringToOString( aCachedItem->second, RTL_TEXTENCODING_UTF8 ); +if (!maWdpCache.empty()) +{ +std::map::iterator aCachedItem = maWdpCache.top().find(rFileId); +if (aCachedItem != maWdpCache.top().end()) +return OUStringToOString(aCachedItem->second, RTL_TEXTENCODING_UTF8); +} -OUString sFileName = "media/hdphoto" + OUString::number( mnWdpImageCounter++ ) + ".wdp"; +OUString sFileName = "media/hdphoto" + OUString::number( mnWdpImageCounter.top()++ ) + ".wdp"; Reference< XOutputStream > xOutStream = mpFB->openFragmentStream( OUStringBuffer() .appendAscii( GetComponentDir() ) .append( "/" + sFileName ) @@ -5884,7 +5887,9 @@ OString DrawingML::WriteWdpPicture( const OUString& rFileId, const Sequence< sal
[Libreoffice-commits] core.git: include/oox oox/source sd/qa
include/oox/export/drawingml.hxx |3 oox/source/drawingml/fillproperties.cxx |4 - oox/source/export/drawingml.cxx | 109 ++- sd/qa/unit/data/odp/repeatBitmapMode.odp |binary sd/qa/unit/export-tests-ooxml2.cxx | 23 ++ 5 files changed, 136 insertions(+), 3 deletions(-) New commits: commit 3f70375cf160841b6140f5f1b2b79af3652897f8 Author: Tibor Nagy AuthorDate: Fri Nov 18 12:06:59 2022 +0100 Commit: László Németh CommitDate: Thu Nov 24 16:56:38 2022 +0100 tdf#152069 tdf#108356 PPTX export: fix missing tile properties of background image patterns defined by a:tile. Note: factor "3.6" comes from EMU. Change-Id: I5da532ff9ad63fd6c236a58933a31dcd96cf5156 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142913 Tested-by: László Németh Reviewed-by: László Németh diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index bf2ed44bca70..543fb072921f 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -275,6 +275,9 @@ public: void WriteXGraphicStretch(css::uno::Reference const & rXPropSet, css::uno::Reference const & rxGraphic); +void WriteXGraphicTile(css::uno::Reference const& rXPropSet, + css::uno::Reference const& rxGraphic); + void WriteLinespacing(const css::style::LineSpacing& rLineSpacing, float fFirstCharHeight); OUString WriteXGraphicBlip(css::uno::Reference const & rXPropSet, diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index 7933a79f5dba..75da3836b6f5 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -832,9 +832,9 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap, rPropMap.setProperty( ShapeProperty::FillBitmapSizeY, nFillBmpSizeY ); // offset of the first bitmap tile (given as EMUs), convert to percent -sal_Int16 nTileOffsetX = getDoubleIntervalValue< sal_Int16 >( maBlipProps.moTileOffsetX.value_or( 0 ) / 3.6 / aOriginalSize.Width, 0, 100 ); +sal_Int16 nTileOffsetX = getDoubleIntervalValue< sal_Int16 >(std::round(maBlipProps.moTileOffsetX.value_or( 0 ) / 3.6 / aOriginalSize.Width), 0, 100 ); rPropMap.setProperty( ShapeProperty::FillBitmapOffsetX, nTileOffsetX ); -sal_Int16 nTileOffsetY = getDoubleIntervalValue< sal_Int16 >( maBlipProps.moTileOffsetY.value_or( 0 ) / 3.6 / aOriginalSize.Height, 0, 100 ); +sal_Int16 nTileOffsetY = getDoubleIntervalValue< sal_Int16 >(std::round(maBlipProps.moTileOffsetY.value_or( 0 ) / 3.6 / aOriginalSize.Height), 0, 100 ); rPropMap.setProperty( ShapeProperty::FillBitmapOffsetY, nTileOffsetY ); } } diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 16affd23295b..3dc68b2f3d3b 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -100,6 +100,7 @@ #include #include #include +#include #include #include @@ -1615,7 +1616,7 @@ void DrawingML::WriteXGraphicBlipMode(uno::Reference const switch (eBitmapMode) { case BitmapMode_REPEAT: -mpFS->singleElementNS(XML_a, XML_tile); +WriteXGraphicTile(rXPropSet, rxGraphic); break; case BitmapMode_STRETCH: WriteXGraphicStretch(rXPropSet, rxGraphic); @@ -1838,6 +1839,112 @@ void DrawingML::WriteXGraphicStretch(uno::Reference const & mpFS->endElementNS(XML_a, XML_stretch); } +static OUString lclConvertRectanglePointToToken(RectanglePoint eRectanglePoint) +{ +OUString sAlignment; +switch (eRectanglePoint) +{ +case RectanglePoint_LEFT_TOP: +sAlignment = "tl"; +break; +case RectanglePoint_MIDDLE_TOP: +sAlignment = "t"; +break; +case RectanglePoint_RIGHT_TOP: +sAlignment = "tr"; +break; +case RectanglePoint_LEFT_MIDDLE: +sAlignment = "l"; +break; +case RectanglePoint_MIDDLE_MIDDLE: +sAlignment = "ctr"; +break; +case RectanglePoint_RIGHT_MIDDLE: +sAlignment = "r"; +break; +case RectanglePoint_LEFT_BOTTOM: +sAlignment = "bl"; +break; +case RectanglePoint_MIDDLE_BOTTOM: +sAlignment = "b"; +break; +case RectanglePoint_RIGHT_BOTTOM: +sAlignment = "br"; +break; +default: +break; +} +return sAlignment; +} + +void DrawingML::WriteXGraphicTile(uno::Reference const& rXPropSet, +
[Libreoffice-commits] core.git: include/oox oox/source sw/qa
include/oox/export/drawingml.hxx |2 +- oox/source/export/drawingml.cxx | 13 +++-- sw/qa/extras/ooxmlexport/data/embedded_images.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport16.cxx| 20 4 files changed, 28 insertions(+), 7 deletions(-) New commits: commit 55b1d635350cb76ee3e19e90c938eedd38ac3342 Author: Tünde Tóth AuthorDate: Mon Nov 21 11:30:16 2022 +0100 Commit: László Németh CommitDate: Wed Nov 23 17:48:37 2022 +0100 tdf#152153 DOCX export: fix lost images at embedded documents Handling of image counter was incorrect if the document contains embedded documents, overwriting images with the other ones. See also commit cf2dc247ff5f726238856e9b46a4926a30430e14 "DOCX export: image deduplication and clean up" and commit 3f6df3835fec71ea61894f9a3bbfe5e4a06a5495 "DOCX export: fix image counters for multiple documents". Change-Id: I3ce3e370f96fa8b9feca3bc73f06ddca933215d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143036 Tested-by: László Németh Reviewed-by: László Németh diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index 3f74f124d767..bf2ed44bca70 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -143,7 +143,7 @@ class OOX_DLLPUBLIC DrawingML { private: -static int mnImageCounter; +static std::stack mnImageCounter; static int mnWdpImageCounter; static std::map maWdpCache; static sal_Int32 mnDrawingMLCount; diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index f7bf0ffdb6fe..16affd23295b 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -235,7 +235,7 @@ void WriteGradientPath(const awt::Gradient& rGradient, const FSHelperPtr& pFS, c } // not thread safe -int DrawingML::mnImageCounter = 1; +std::stack DrawingML::mnImageCounter; int DrawingML::mnWdpImageCounter = 1; std::map DrawingML::maWdpCache; sal_Int32 DrawingML::mnDrawingMLCount = 0; @@ -268,7 +268,6 @@ sal_Int16 DrawingML::GetScriptType(const OUString& rStr) void DrawingML::ResetCounters() { -mnImageCounter = 1; mnWdpImageCounter = 1; maWdpCache.clear(); } @@ -281,11 +280,13 @@ void DrawingML::ResetMlCounters() void DrawingML::PushExportGraphics() { +mnImageCounter.push(1); maExportGraphics.emplace(); } void DrawingML::PopExportGraphics() { +mnImageCounter.pop(); maExportGraphics.pop(); } @@ -1394,7 +1395,7 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia ) Reference xOutStream = mpFB->openFragmentStream( OUStringBuffer() .appendAscii(GetComponentDir()) -.append("/media/image" + OUString::number(mnImageCounter)) +.append("/media/image" + OUString::number(mnImageCounter.top())) .appendAscii(pExtension) .makeStringAndClear(), sMediaType); @@ -1410,7 +1411,7 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia ) sPath = OUStringBuffer() .appendAscii(sRelationCompPrefix.getStr()) .appendAscii(sRelPathToMedia.getStr()) -.append(static_cast(mnImageCounter++)) +.append(static_cast(mnImageCounter.top()++)) .appendAscii(pExtension) .makeStringAndClear(); @@ -1489,7 +1490,7 @@ void DrawingML::WriteMediaNonVisualProperties(const css::uno::Reference xOutStream = mpFB->openFragmentStream(OUStringBuffer() .appendAscii(GetComponentDir()) .append("/media/media" + - OUString::number(mnImageCounter) + + OUString::number(mnImageCounter.top()) + aExtension) .makeStringAndClear(), aMimeType); @@ -1501,7 +1502,7 @@ void DrawingML::WriteMediaNonVisualProperties(const css::uno::ReferenceaddRelation(mpFS->getOutputStream(), oox::getRelationship(eMediaType), aPath); aMediaRelId = mpFB->addRelation(mpFS->getOutputStream(), oox::getRelationship(Relationship::MEDIA), aPath); diff --git a/sw/qa/extras/ooxmlexport/data/embedded_images.odt b/sw/qa/extras/ooxmlexport/data/embedded_images.odt new file mode 100644 index ..26166fac349b Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/embedded_images.odt differ diff --git
[Libreoffice-commits] core.git: include/oox oox/qa oox/source
include/oox/shape/ShapeContextHandler.hxx |5 + oox/qa/unit/data/tdf54095_SmartArtThemeTextColor.docx |binary oox/qa/unit/shape.cxx | 54 ++ oox/source/shape/ShapeContextHandler.cxx | 13 4 files changed, 71 insertions(+), 1 deletion(-) New commits: commit 2406ba67c8c03b0d6a4adb81f1efc1609c8dfe8c Author: Regina Henschel AuthorDate: Fri Oct 28 15:39:38 2022 +0200 Commit: Regina Henschel CommitDate: Fri Oct 28 19:49:00 2022 +0200 tdf#54095 docx SmartArt import, apply theme text color PPTShapeGroupContext uses method applyFontRefColor in importExtDrawings to bring the theme text color to the shape text. The patch copies this way to ShapeContextHandler, which is used for SmartArt in docx. Change-Id: Ie0c0453d6a1fd73fbd4b65246aed9570646dc6f0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141992 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/include/oox/shape/ShapeContextHandler.hxx b/include/oox/shape/ShapeContextHandler.hxx index 239ff8ec63b8..42e884f27daa 100644 --- a/include/oox/shape/ShapeContextHandler.hxx +++ b/include/oox/shape/ShapeContextHandler.hxx @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -151,8 +152,10 @@ private: css::uno::Reference const & getWpsContext(sal_Int32 nStartElement, sal_Int32 nElement); css::uno::Reference const & getWpgContext(sal_Int32 nElement); css::uno::Reference getContextHandler(sal_Int32 nElement = 0); -}; +void applyFontRefColor(const oox::drawingml::ShapePtr& pShape, + const oox::drawingml::Color& rFontRefColor); +}; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/qa/unit/data/tdf54095_SmartArtThemeTextColor.docx b/oox/qa/unit/data/tdf54095_SmartArtThemeTextColor.docx new file mode 100644 index ..8aff8469bb41 Binary files /dev/null and b/oox/qa/unit/data/tdf54095_SmartArtThemeTextColor.docx differ diff --git a/oox/qa/unit/shape.cxx b/oox/qa/unit/shape.cxx index 06d7eba9dffd..9a85db9f3894 100644 --- a/oox/qa/unit/shape.cxx +++ b/oox/qa/unit/shape.cxx @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -260,6 +261,59 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testTdf151518VertAnchor) } } +CPPUNIT_TEST_FIXTURE(OoxShapeTest, testTdf54095_SmartArtThemeTextColor) +{ +// The document contains a SmartArt where the color for the texts in the shapes is given by +// the theme. +// Error was, that the theme was not considered and therefore the text was white. + +// Make sure it is not loaded as metafile but with single shapes. +bool bUseGroup = officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes::get(); +if (!bUseGroup) +{ +std::shared_ptr pChange( +comphelper::ConfigurationChanges::create()); + officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes::set(true, pChange); +pChange->commit(); +} + +// get SmartArt +loadFromURL(u"tdf54095_SmartArtThemeTextColor.docx"); +uno::Reference xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); +uno::Reference xSmartArt(xDrawPage->getByIndex(0), uno::UNO_QUERY); +// shape 0 is the background shape without text +uno::Reference xShape(xSmartArt->getByIndex(1), uno::UNO_QUERY); + +// text color +uno::Reference xText(xShape->getText(), uno::UNO_QUERY); +uno::Reference xPara(xText->createEnumeration()->nextElement(), +uno::UNO_QUERY); +uno::Reference xPortion(xPara->createEnumeration()->nextElement(), + uno::UNO_QUERY); +sal_Int32 nActualColor{ 0 }; +xPortion->getPropertyValue("CharColor") >>= nActualColor; +// Without fix the test would have failed with: +// - Expected: 2050429 (0x1F497D) +// - Actual : 16777215 (0xFF), that is text was white +CPPUNIT_ASSERT_EQUAL(sal_Int32(0x1F497D), nActualColor); + +// clrScheme. For map between name in docx and index from CharColorTheme see +// oox::drawingml::Color::getSchemeColorIndex() +// Without fix the color scheme was "lt1" (1) but should be "dk2" (2). +CPPUNIT_ASSERT_EQUAL(sal_Int16(2), + xPortion->getPropertyValue("CharColorTheme").get()); + +if (!bUseGroup) +{ +std::shared_ptr pChange( +comphelper::ConfigurationChanges::create()); + officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes::set(false, pChange); +pChange->commit(); +} +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git
[Libreoffice-commits] core.git: include/oox oox/source sd/qa
include/oox/drawingml/shape.hxx |4 ++ oox/source/drawingml/shape.cxx |7 +++ oox/source/ppt/slidepersist.cxx | 69 +++ sd/qa/unit/data/pptx/connectors.pptx |binary sd/qa/unit/import-tests.cxx | 18 + 5 files changed, 98 insertions(+) New commits: commit eec48130271188cab63665acedbabf1ff5e850a2 Author: Tibor Nagy AuthorDate: Mon Oct 24 09:36:54 2022 +0200 Commit: László Németh CommitDate: Thu Oct 27 20:23:18 2022 +0200 tdf#148926 tdf#151678 PPTX import: position of standard connector - part1 Connectors are typically connected to connection dots, which exist on shapes. If both or one of the two shapes are missing, it will be drawn the default type of a standard connector in LO. In this case, there is an adjustment point which is used to modify positions and shapes of the connectors. This patch fixes the position of the connector by calculating and setting the adjustment value. Change-Id: Iee384d2a92a22ff95d7b17ba0b4f09698176bc84 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141723 Tested-by: László Németh Reviewed-by: László Németh diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx index e481b98c3f6e..36017132e83d 100644 --- a/include/oox/drawingml/shape.hxx +++ b/include/oox/drawingml/shape.hxx @@ -136,6 +136,7 @@ public: CustomShapePropertiesPtr& getCustomShapeProperties(){ return mpCustomShapePropertiesPtr; } +OUString& getConnectorName() { return msConnectorName; } ConnectorShapePropertiesList& getConnectorShapeProperties() { return maConnectorShapePropertiesList; } voidsetConnectorShape(bool bConnector) { mbConnector = bConnector; } boolisConnectorShape() const { return mbConnector; } @@ -160,6 +161,8 @@ public: sal_Int32 getRotation() const { return mnRotation; } voidsetDiagramRotation( sal_Int32 nRotation ) { mnDiagramRotation = nRotation; } voidsetFlip( bool bFlipH, bool bFlipV ) { mbFlipH = bFlipH; mbFlipV = bFlipV; } +boolgetFlipH() const { return mbFlipH; } +boolgetFlipV() const { return mbFlipV; } voidaddChild( const ShapePtr& rChildPtr ) { maChildren.push_back( rChildPtr ); } std::vector< ShapePtr >&getChildren() { return maChildren; } @@ -344,6 +347,7 @@ protected: css::uno::Reference< css::drawing::XShape > mxShape; ConnectorShapePropertiesList maConnectorShapePropertiesList; +OUStringmsConnectorName; OUStringmsServiceName; OUStringmsName; OUStringmsInternalName; // used by diagram; not displayed in UI diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 7357e36f0481..99c1c5a979a5 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1682,6 +1682,13 @@ Reference< XShape > const & Shape::createAndInsert( if (bIsConnectorShape) { +OUString sConnectorShapePresetTypeName( +reinterpret_cast( + mpCustomShapePropertiesPtr->getShapePresetTypeName().getConstArray()), + mpCustomShapePropertiesPtr->getShapePresetTypeName().getLength(), +RTL_TEXTENCODING_UTF8); +msConnectorName = sConnectorShapePresetTypeName; + sal_Int32 nType = mpCustomShapePropertiesPtr->getShapePresetType(); switch (nType) { diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx index 1e7461fa5f49..126fc664bd3a 100644 --- a/oox/source/ppt/slidepersist.cxx +++ b/oox/source/ppt/slidepersist.cxx @@ -44,6 +44,7 @@ #include #include #include +#include #include using namespace ::com::sun::star; @@ -349,6 +350,70 @@ Reference SlidePersist::getAnimationNode(const OUString& sId) co return aResult; } +static void lcl_SetEdgeLineValue(uno::Reference& rXConnector, + oox::drawingml::ShapePtr& rShapePtr) +{ +sal_Int32 nEdge = 0; +awt::Point aStartPt, aEndPt; +uno::Reference xStartSp, xEndSp; +uno::Reference xPropSet(rXConnector, uno::UNO_QUERY); +xPropSet->getPropertyValue("EdgeStartPoint") >>= aStartPt; +xPropSet->getPropertyValue("EdgeEndPoint") >>= aEndPt; +xPropSet->getPropertyValue("StartShape") >>= xStartSp; +xPropSet->getPropertyValue("EndShape") >>= xEndSp; +xPropSet->setPropertyValue("EdgeNode1HorzDist", Any(sal_Int32(0))); +xPropSet->setPropertyValue("EdgeNode1VertDist", Any(sal_Int32(0))); +xPropSet->setPropertyValue("EdgeNode2HorzDist", Any(sal_Int32(0))); +
[Libreoffice-commits] core.git: include/oox oox/source sd/qa
include/oox/export/drawingml.hxx |2 - oox/source/export/drawingml.cxx | 26 ++ sd/qa/unit/data/odp/autofitted-textbox-indent.odp |binary sd/qa/unit/export-tests-ooxml3.cxx| 22 ++ 4 files changed, 45 insertions(+), 5 deletions(-) New commits: commit e6a1586ff90125245cf0f898af37bf568abdcddf Author: Sarper Akdemir AuthorDate: Mon Oct 24 14:16:16 2022 +0300 Commit: Miklos Vajna CommitDate: Thu Oct 27 15:15:26 2022 +0200 related tdf#149961 pptx export: scale indents for autofitted textboxes For autofitted textboxes, Impress scales the indents with the text size while PowerPoint doesn't. Try to compensate for this by scaling exported indents proportionally to the font scale on autofitted textboxes. Change-Id: Ib0f967e923d23553b4cdbd1bbe2e137d97b1b2e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141758 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index aeda7fa3a222..3f74f124d767 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -303,7 +303,7 @@ public: @returns true if any paragraph properties were written */ -bool WriteParagraphProperties(const css::uno::Reference< css::text::XTextContent >& rParagraph, float fFirstCharHeight, sal_Int32 nElement); +bool WriteParagraphProperties(const css::uno::Reference< css::text::XTextContent >& rParagraph, const css::uno::Reference& rXShapePropSet, float fFirstCharHeight, sal_Int32 nElement); void WriteParagraphNumbering(const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, float fFirstCharHeight, sal_Int16 nLevel ); void WriteParagraphTabStops(const css::uno::Reference& rXPropSet); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index e0766d0e7a7a..e8d5bef246c4 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -3021,7 +3021,7 @@ void DrawingML::WriteLinespacing(const LineSpacing& rSpacing, float fFirstCharHe } } -bool DrawingML::WriteParagraphProperties( const Reference< XTextContent >& rParagraph, float fFirstCharHeight, sal_Int32 nElement) +bool DrawingML::WriteParagraphProperties(const Reference& rParagraph, const Reference& rXShapePropSet, float fFirstCharHeight, sal_Int32 nElement) { Reference< XPropertySet > rXPropSet( rParagraph, UNO_QUERY ); Reference< XPropertyState > rXPropState( rParagraph, UNO_QUERY ); @@ -3111,6 +3111,24 @@ bool DrawingML::WriteParagraphProperties( const Reference< XTextContent >& rPara return false; } +// for autofitted textboxes, scale the indents +if (GetProperty(rXShapePropSet, "TextFitToSize") && mAny.get() == TextFitToSizeType_AUTOFIT) +{ +SvxShapeText* pTextShape = dynamic_cast(rXShapePropSet.get()); +if (pTextShape) +{ +SdrTextObj* pTextObject = dynamic_cast(pTextShape->GetSdrObject()); +if (pTextObject) +{ +const auto nFontScaleY = pTextObject->GetFontScaleY(); +nLeftMargin = nLeftMargin * nFontScaleY / 100; +nLineIndentation = nLineIndentation * nFontScaleY / 100; +nParaLeftMargin = nParaLeftMargin * nFontScaleY / 100; +nParaFirstLineIndent = nParaFirstLineIndent * nFontScaleY / 100; +} +} +} + if (nParaLeftMargin) // For Paragraph mpFS->startElementNS( XML_a, nElement, XML_lvl, sax_fastparser::UseIf(OString::number(nLevel), nLevel > 0), @@ -3198,7 +3216,7 @@ void DrawingML::WriteLstStyles(const css::uno::ReferencegetPropertyValue("CharHeight").get(); mpFS->startElementNS(XML_a, XML_lstStyle); -if( !WriteParagraphProperties(rParagraph, fFirstCharHeight, XML_lvl1pPr) ) +if( !WriteParagraphProperties(rParagraph, rXShapePropSet, fFirstCharHeight, XML_lvl1pPr) ) mpFS->startElementNS(XML_a, XML_lvl1pPr); WriteRunProperties(xFirstRunPropSet, false, XML_defRPr, true, rbOverridingCharHeight, rnCharHeight, GetScriptType(rRun->getString()), rXShapePropSet); @@ -3240,7 +3258,7 @@ void DrawingML::WriteParagraph( const Reference< XTextContent >& rParagraph, rnCharHeight = 100 * fFirstCharHeight; rbOverridingCharHeight = true; } -WriteParagraphProperties(rParagraph, fFirstCharHeight, XML_pPr); +WriteParagraphProperties(rParagraph, rXShapePropSet, fFirstCharHeight, XML_pPr); bPropertiesWritten = true; } WriteRun( run, rbOverridingCharHeight, rnCharHeight, rXShapePropSet); @@ -3848,7 +3866,7 @@ void DrawingML::WriteText(const
[Libreoffice-commits] core.git: include/oox oox/source sc/qa sc/source solenv/clang-format
include/oox/shape/ShapeDrawingFragmentHandler.hxx |2 oox/source/shape/ShapeContextHandler.cxx |2 oox/source/shape/ShapeDrawingFragmentHandler.cxx |2 sc/qa/unit/data/xlsx/tdf83671_SmartArt_import.xlsx |binary sc/qa/unit/subsequent_filters_test2.cxx| 47 + sc/source/filter/oox/drawingfragment.cxx | 22 + solenv/clang-format/excludelist|2 7 files changed, 73 insertions(+), 4 deletions(-) New commits: commit 9ad7df41572d67687221cb43d53cde27a45fff0f Author: Regina Henschel AuthorDate: Thu Oct 20 14:28:07 2022 +0200 Commit: Miklos Vajna CommitDate: Mon Oct 24 15:09:37 2022 +0200 tdf#83671 make SmartArt visible in import of xlsx Problem is, that Excel writes a zero size in xdr:xfrm for the SmartArt. With that the import generates a background size with zero width and height and no shapes at all in the SmartArt group. The diagram DOM is imported correctly. The actual size is not known until the row and column values of the anchor are evaluated. The idea of this patch is to correct the background size directly and to repeat the import of drawing.xml when the actual size is known. I noticed that in import of SmartArt in docx there is a similar problem that the SmartArt shapes are missing at some point, as can be seen in ShapeContextHandler::getShape(), about line 428. It uses ShapeDrawingFragmentHandler to import the shapes. To be able to use that handler too, I have moved its header file to include. The solution for docx uses a loop over the vector getExtDrawings(). But I have not seen a SmartArt case, where more then one element exists in it. Whether the shape is a diagram, is indirectly tested currently. The shape has yet no direct method for it. Change-Id: I9d705ed5bfb2894e9ce740ebf8589e06b4870bed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141571 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/oox/source/shape/ShapeDrawingFragmentHandler.hxx b/include/oox/shape/ShapeDrawingFragmentHandler.hxx similarity index 93% rename from oox/source/shape/ShapeDrawingFragmentHandler.hxx rename to include/oox/shape/ShapeDrawingFragmentHandler.hxx index 15b424b6fd8f..340edca5e1d1 100644 --- a/oox/source/shape/ShapeDrawingFragmentHandler.hxx +++ b/include/oox/shape/ShapeDrawingFragmentHandler.hxx @@ -16,7 +16,7 @@ namespace oox::shape { /// Generic (i.e. not specific to PPTX) handler for the prerendered diagram parsing. -class ShapeDrawingFragmentHandler : public oox::core::FragmentHandler2 +class OOX_DLLPUBLIC ShapeDrawingFragmentHandler : public oox::core::FragmentHandler2 { public: ShapeDrawingFragmentHandler(oox::core::XmlFilterBase& rFilter, const OUString& rFragmentPath, oox::drawingml::ShapePtr pGroupShapePtr); diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx index 54a455452365..4e8329c1417d 100644 --- a/oox/source/shape/ShapeContextHandler.cxx +++ b/oox/source/shape/ShapeContextHandler.cxx @@ -22,7 +22,7 @@ #include #include -#include "ShapeDrawingFragmentHandler.hxx" +#include #include "LockedCanvasContext.hxx" #include "WpsContext.hxx" #include "WpgContext.hxx" diff --git a/oox/source/shape/ShapeDrawingFragmentHandler.cxx b/oox/source/shape/ShapeDrawingFragmentHandler.cxx index 0e915058fcb4..456f7df6c80d 100644 --- a/oox/source/shape/ShapeDrawingFragmentHandler.cxx +++ b/oox/source/shape/ShapeDrawingFragmentHandler.cxx @@ -7,7 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "ShapeDrawingFragmentHandler.hxx" +#include #include #include diff --git a/sc/qa/unit/data/xlsx/tdf83671_SmartArt_import.xlsx b/sc/qa/unit/data/xlsx/tdf83671_SmartArt_import.xlsx new file mode 100644 index ..9ec0a0e7906c Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf83671_SmartArt_import.xlsx differ diff --git a/sc/qa/unit/subsequent_filters_test2.cxx b/sc/qa/unit/subsequent_filters_test2.cxx index e4bf84b2fade..1ce547a23373 100644 --- a/sc/qa/unit/subsequent_filters_test2.cxx +++ b/sc/qa/unit/subsequent_filters_test2.cxx @@ -60,6 +60,7 @@ #include #include #include "helper/qahelper.hxx" +#include using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -185,6 +186,7 @@ public: void testAutofilterNamedRangesXLSX(); void testInvalidBareBiff5(); void testTooManyColsRows(); +void testTdf83671_SmartArt_import(); CPPUNIT_TEST_SUITE(ScFiltersTest2); @@ -301,6 +303,7 @@ public: CPPUNIT_TEST(testAutofilterNamedRangesXLSX); CPPUNIT_TEST(testInvalidBareBiff5); CPPUNIT_TEST(testTooManyColsRows); +CPPUNIT_TEST(testTdf83671_SmartArt_import); CPPUNIT_TEST_SUITE_END(); }; @@ -3042,6 +3045,50 @@ void ScFiltersTest2::testTooManyColsRows() xDocSh->DoClose(); } +void
[Libreoffice-commits] core.git: include/oox oox/source writerfilter/qa writerfilter/source
include/oox/shape/ShapeContextHandler.hxx | 2 oox/source/shape/ShapeContextHandler.cxx| 6 + writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx | 52 ++ writerfilter/qa/cppunittests/dmapper/data/tdf149840_SmartArtBackground.docx |binary writerfilter/source/dmapper/GraphicHelpers.cxx | 47 + writerfilter/source/dmapper/GraphicHelpers.hxx | 14 ++ writerfilter/source/ooxml/OOXMLFastContextHandler.cxx | 38 +++ 7 files changed, 158 insertions(+), 1 deletion(-) New commits: commit e4515c1305e4b7bf6e7f105636e9cf6eb50b382d Author: Regina Henschel AuthorDate: Tue Oct 11 14:46:37 2022 +0200 Commit: Miklos Vajna CommitDate: Thu Oct 13 08:56:22 2022 +0200 tdf#149840 Use actual outer size for SmartArt in Writer SmartArt import needs the outer size of the diagram for to define a background shape in the correct size and calculate the size of the diagram shapes relative to the outer size. The patch passes the values read from wp:extent in writerfilter to DiagramGraphicDataContext in oox. Change-Id: Ib39227bc645ac353336bab2c558d041974188f6f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141223 Tested-by: Jenkins Reviewed-by: Regina Henschel Reviewed-by: Miklos Vajna diff --git a/include/oox/shape/ShapeContextHandler.hxx b/include/oox/shape/ShapeContextHandler.hxx index 1b024c6013e1..239ff8ec63b8 100644 --- a/include/oox/shape/ShapeContextHandler.hxx +++ b/include/oox/shape/ShapeContextHandler.hxx @@ -95,6 +95,7 @@ public: void pushStartToken( sal_Int32 _starttoken ); void setPosition(const css::awt::Point& rPosition); +void setSize(const css::awt::Size& rSize); const bool& getFullWPGSupport() { return m_bFullWPGSUpport; } void setFullWPGSupport(bool bUse) { m_bFullWPGSUpport = bUse; } @@ -118,6 +119,7 @@ private: std::stack mnStartTokenStack; css::awt::Point maPosition; +css::awt::Size maSize; // from cx and cy, in EMU bool m_bFullWPGSUpport; // Is this DrawingML shape supposed to be processed as WPG? drawingml::ShapePtr mpShape; diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx index 2e4018e4703c..54a455452365 100644 --- a/oox/source/shape/ShapeContextHandler.cxx +++ b/oox/source/shape/ShapeContextHandler.cxx @@ -215,6 +215,7 @@ ShapeContextHandler::getDiagramShapeContext() { auto pFragmentHandler = std::make_shared(*mxShapeFilterBase, msRelationFragmentPath); mpShape = std::make_shared(); +mpShape->setSize(maSize); mxDiagramShapeContext.set(new DiagramGraphicDataContext(*pFragmentHandler, mpShape)); } @@ -564,6 +565,11 @@ void ShapeContextHandler::setPosition(const awt::Point& rPosition) maPosition = rPosition; } +void ShapeContextHandler::setSize(const awt::Size& rSize) +{ +maSize = rSize; +} + void ShapeContextHandler::setDocumentProperties(const uno::Reference& xDocProps) { mxDocumentProperties = xDocProps; diff --git a/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx b/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx index a20c8490501b..6d77ece16d9d 100644 --- a/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx +++ b/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx @@ -23,6 +23,7 @@ #include #include +#include using namespace ::com::sun::star; @@ -406,6 +407,57 @@ CPPUNIT_TEST_FIXTURE(Test, testLayoutInCellOfHraphics) CPPUNIT_ASSERT(xShape->getPropertyValue("IsFollowingTextFlow") >>= bFollowingTextFlow); CPPUNIT_ASSERT(bFollowingTextFlow); } + +CPPUNIT_TEST_FIXTURE(Test, testTdf149840SmartArtBackground) +{ +// Make sure SmartArt is loaded as group shape +bool bUseGroup = officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes::get(); +if (!bUseGroup) +{ +std::shared_ptr pChange( +comphelper::ConfigurationChanges::create()); + officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes::set(true, pChange); +pChange->commit(); +} + +OUString aURL += m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf149840_SmartArtBackground.docx"; +getComponent() = loadFromDesktop(aURL); +uno::Reference xDrawPageSupplier(getComponent(), uno::UNO_QUERY); +uno::Reference xDrawPage = xDrawPageSupplier->getDrawPage(); +uno::Reference xGroup(xDrawPage->getByIndex(0), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(static_cast(3), xGroup->getCount()); + +// The first shape in the group, which represents the SmartArt, corresponds to the background of +// the diagram. Without fix in place it has widht and height zero, which does not only result in +// not visible background but in wrong sizes of the diagram
[Libreoffice-commits] core.git: include/oox oox/inc oox/source
include/oox/crypto/Standard2007Engine.hxx|2 include/oox/drawingml/theme.hxx |2 include/oox/dump/dumperbase.hxx | 26 +- include/oox/dump/oledumper.hxx |2 include/oox/ole/axcontrol.hxx|2 include/oox/vml/vmldrawing.hxx |2 include/oox/vml/vmlformatting.hxx|2 oox/inc/drawingml/presetgeometrynames.hxx|4 - oox/source/core/filterbase.cxx |4 - oox/source/crypto/Standard2007Engine.cxx |6 +- oox/source/docprop/docprophandler.cxx| 24 - oox/source/docprop/docprophandler.hxx|2 oox/source/drawingml/presetgeometrynames.cxx |8 +-- oox/source/drawingml/theme.cxx | 14 ++--- oox/source/dump/dumperbase.cxx | 66 +-- oox/source/dump/oledumper.cxx|6 +- oox/source/ole/axcontrol.cxx |4 - oox/source/ole/vbacontrol.cxx| 12 ++-- oox/source/ole/vbaexport.cxx | 20 oox/source/vml/vmldrawing.cxx|6 +- oox/source/vml/vmlformatting.cxx |8 +-- oox/source/vml/vmlshape.cxx |6 +- 22 files changed, 114 insertions(+), 114 deletions(-) New commits: commit ceaff89c973953e283aa881292206c593e5f9c7c Author: Noel Grandin AuthorDate: Tue Sep 27 15:15:18 2022 +0200 Commit: Noel Grandin CommitDate: Wed Sep 28 08:42:01 2022 +0200 use more string_view in oox Change-Id: Ib0d7015a898073d51ac2638d62a19eadcba37685 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140653 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/oox/crypto/Standard2007Engine.hxx b/include/oox/crypto/Standard2007Engine.hxx index 8a7aec3e66af..17ebbccd2556 100644 --- a/include/oox/crypto/Standard2007Engine.hxx +++ b/include/oox/crypto/Standard2007Engine.hxx @@ -29,7 +29,7 @@ class OOX_DLLPUBLIC Standard2007Engine final : public CryptoEngine msfilter::StandardEncryptionInfo mInfo; bool generateVerifier(); -bool calculateEncryptionKey(const OUString& rPassword); +bool calculateEncryptionKey(std::u16string_view rPassword); public: Standard2007Engine() = default; diff --git a/include/oox/drawingml/theme.hxx b/include/oox/drawingml/theme.hxx index 6222a4264451..34347923b669 100644 --- a/include/oox/drawingml/theme.hxx +++ b/include/oox/drawingml/theme.hxx @@ -84,7 +84,7 @@ public: /** Returns theme font properties by scheme type (major/minor). */ const TextCharacterProperties* getFontStyle( sal_Int32 nSchemeType ) const; /** Returns theme font by placeholder name, e.g. the major latin theme font for the font name '+mj-lt'. */ -const TextFont* resolveFont( const OUString& rName ) const; +const TextFont* resolveFont( std::u16string_view rName ) const; Shape& getSpDef() { return maSpDef; } const Shape& getSpDef() const { return maSpDef; } diff --git a/include/oox/dump/dumperbase.hxx b/include/oox/dump/dumperbase.hxx index dffca1540c3c..04a41e92a964 100644 --- a/include/oox/dump/dumperbase.hxx +++ b/include/oox/dump/dumperbase.hxx @@ -236,7 +236,7 @@ struct ItemFormat @return List containing remaining unhandled format strings. */ -OUStringVector parse( const OUString& rFormatStr ); +OUStringVector parse( std::u16string_view rFormatStr ); }; @@ -247,7 +247,7 @@ public: // append string to string static void appendChar( OUStringBuffer& rStr, sal_Unicode cChar, sal_Int32 nCount ); -static void appendString( OUStringBuffer& rStr, const OUString& rData, sal_Int32 nWidth, sal_Unicode cFill = ' ' ); +static void appendString( OUStringBuffer& rStr, std::u16string_view rData, sal_Int32 nWidth, sal_Unicode cFill = ' ' ); // append decimal - @@ -312,7 +312,7 @@ public: static void appendCChar( OUStringBuffer& rStr, sal_Unicode cChar, bool bPrefix = true ); static void appendEncChar( OUStringBuffer& rStr, sal_Unicode cChar, sal_Int32 nCount, bool bPrefix = true ); -static void appendEncString( OUStringBuffer& rStr, const OUString& rData, bool bPrefix = true ); +static void appendEncString( OUStringBuffer& rStr, std::u16string_view rData, bool bPrefix = true ); // token list - @@ -345,8 +345,8 @@ public: // string to list conversion -- -static void convertStringToStringList( OUStringVector& orVec, const OUString& rData, bool bIgnoreEmpty ); -static void convertStringToIntList( Int64Vector& orVec, const OUString& rData,
[Libreoffice-commits] core.git: include/oox oox/source sd/qa
include/oox/core/xmlfilterbase.hxx | 10 - include/oox/drawingml/shape.hxx |6 - include/oox/ppt/presentationfragmenthandler.hxx |1 include/oox/ppt/slidepersist.hxx|4 oox/source/core/xmlfilterbase.cxx |6 - oox/source/drawingml/hyperlinkcontext.cxx |4 oox/source/drawingml/textrun.cxx|6 - oox/source/ppt/pptshape.cxx | 49 oox/source/ppt/presentationfragmenthandler.cxx | 138 ++-- oox/source/ppt/slidepersist.cxx |2 sd/qa/unit/data/pptx/tdf150719.pptx |binary sd/qa/unit/import-tests.cxx | 18 +++ 12 files changed, 63 insertions(+), 181 deletions(-) New commits: commit fabfa4bd23e89a2d5b6e232cd2eab61996534659 Author: Tibor Nagy AuthorDate: Mon Aug 22 10:54:53 2022 +0200 Commit: Nagy Tibor CommitDate: Fri Sep 9 14:05:26 2022 +0200 tdf#150719 PPTX import: fix hyperlink format (lost underline) Hypertext lost its formatting partially: e.g. underline character setting lost, except on the last word. Follow-up to commit commit a761a51d9db3a2771ca9fd6ab233c513aa5d8ecf "tdf#149311 PPTX export: fix internal hyperlink on texts". Clean-up of commit 855a56fea4561135a63cb729d7a625a950b210e7 "tdf#148965 PPTX import: fix internal hyperlinks on shapes" and commit cec1f712c87e557e1b7313e0dbef4a635f69d953 "tdf#144918 PPTX import: fix internal hyperlink on shapes" and commit 7eb0e52527e729a21973e70d5be8e0a6779ec748 "tdf#142648 PPTX: import long slide names to avoid broken link export". Change-Id: I1de8b06361c7b9529a70a039e194db88460cc27b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138669 Tested-by: László Németh Reviewed-by: László Németh diff --git a/include/oox/core/xmlfilterbase.hxx b/include/oox/core/xmlfilterbase.hxx index 35312fda53ab..89a7994a904b 100644 --- a/include/oox/core/xmlfilterbase.hxx +++ b/include/oox/core/xmlfilterbase.hxx @@ -75,13 +75,6 @@ namespace oox::core { class FragmentHandler; class FastParser; -struct TextField { -css::uno::Reference< css::text::XText > xText; -css::uno::Reference< css::text::XTextCursor > xTextCursor; -css::uno::Reference< css::text::XTextField > xTextField; -}; -typedef std::vector< TextField > TextFieldStack; - struct XmlFilterBaseImpl; using ShapePairs @@ -183,9 +176,6 @@ public: */ OUString addRelation( const css::uno::Reference< css::io::XOutputStream >& rOutputStream, const OUString& rType, std::u16string_view rTarget, bool bExternal = false ); -/** Returns a stack of used textfields, used by the pptx importer to replace links to slidepages with the real page name */ -TextFieldStack& getTextFieldStack() const; - /** Opens and returns the specified output stream from the base storage with specified media type. @param rStreamName diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx index 246a964fc2a6..e481b98c3f6e 100644 --- a/include/oox/drawingml/shape.hxx +++ b/include/oox/drawingml/shape.hxx @@ -140,9 +140,6 @@ public: voidsetConnectorShape(bool bConnector) { mbConnector = bConnector; } boolisConnectorShape() const { return mbConnector; } -voidsetBookmark(bool bBookmark) { mbHasBookmark = bBookmark; } -boolhasBookmark() const { return mbHasBookmark; } - Shape3DProperties& get3DProperties() { return *mp3DPropertiesPtr; } const Shape3DProperties&get3DProperties() const { return *mp3DPropertiesPtr; } @@ -408,9 +405,6 @@ private: // Is this a connector shape? bool mbConnector = false; -// Is shape has bookmark? -bool mbHasBookmark = false; - // temporary space for DiagramHelper in preparation for collecting data // Note: I tried to use a unique_ptr here, but existing constructor func does not allow that svx::diagram::IDiagramHelper* mpDiagramHelper; diff --git a/include/oox/ppt/presentationfragmenthandler.hxx b/include/oox/ppt/presentationfragmenthandler.hxx index a9bb5bb67a77..7ac929ec555b 100644 --- a/include/oox/ppt/presentationfragmenthandler.hxx +++ b/include/oox/ppt/presentationfragmenthandler.hxx @@ -52,6 +52,7 @@ private: void importSlide(sal_uInt32 nSlide, bool bFirstSlide, bool bImportNotes); void saveThemeToGrabBag(const oox::drawingml::ThemePtr& pThemePtr, sal_Int32 nThemeIdx); void importCustomSlideShow(std::vector& rCustomShowList); +static void importSlideNames(::oox::core::XmlFilterBase& rFilter, const std::vector& rSlidePersist); std::vector< OUString > maSlideMasterVector; std::vector< OUString > maSlidesVector; diff --git a/include/oox/ppt/slidepersist.hxx b/include/oox/ppt/slidepersist.hxx index
[Libreoffice-commits] core.git: include/oox oox/inc oox/source writerfilter/source
include/oox/core/contexthandler.hxx |2 +- include/oox/core/filterdetect.hxx |2 +- include/oox/core/fragmenthandler.hxx |4 ++-- include/oox/core/relations.hxx|2 +- include/oox/crypto/DocumentDecryption.hxx |2 +- include/oox/drawingml/shapecontext.hxx|2 +- include/oox/drawingml/shapegroupcontext.hxx |2 +- include/oox/dump/dumperbase.hxx | 12 ++-- include/oox/dump/oledumper.hxx|9 + include/oox/export/drawingml.hxx |3 ++- include/oox/export/vmlexport.hxx |2 +- include/oox/helper/graphichelper.hxx |2 +- include/oox/helper/helper.hxx |1 + include/oox/helper/modelobjecthelper.hxx |2 +- include/oox/helper/refmap.hxx |5 +++-- include/oox/helper/refvector.hxx |5 +++-- include/oox/helper/storagebase.hxx|2 +- include/oox/mathml/importutils.hxx|2 +- include/oox/ole/axcontrol.hxx |2 +- include/oox/ole/olehelper.hxx |2 +- include/oox/ole/oleobjecthelper.hxx |2 +- include/oox/ole/vbaexport.hxx |2 +- include/oox/ole/vbamodule.hxx |2 +- include/oox/ole/vbaproject.hxx|2 +- include/oox/ppt/pptgraphicshapecontext.hxx|2 +- include/oox/ppt/pptshapecontext.hxx |2 +- include/oox/ppt/pptshapegroupcontext.hxx |2 +- include/oox/ppt/slidemastertextstylescontext.hxx |2 +- include/oox/ppt/slidepersist.hxx |2 +- include/oox/ppt/timenodelistcontext.hxx |2 +- include/oox/shape/ShapeContextHandler.hxx |2 +- include/oox/vml/vmlshape.hxx |2 +- include/oox/vml/vmltextbox.hxx|2 +- include/oox/vml/vmltextboxcontext.hxx |4 ++-- oox/inc/drawingml/textbodycontext.hxx |2 +- oox/source/core/contexthandler.cxx|5 +++-- oox/source/core/filterdetect.cxx |5 +++-- oox/source/core/fragmenthandler.cxx |7 --- oox/source/core/recordparser.cxx |7 --- oox/source/core/relations.cxx |5 +++-- oox/source/crypto/DocumentDecryption.cxx |8 oox/source/drawingml/diagram/diagramdefinitioncontext.cxx |5 +++-- oox/source/drawingml/diagram/diagramdefinitioncontext.hxx |2 +- oox/source/drawingml/diagram/diagramfragmenthandler.cxx |9 + oox/source/drawingml/diagram/diagramfragmenthandler.hxx |4 ++-- oox/source/drawingml/diagram/diagramhelper.cxx|9 + oox/source/drawingml/diagram/diagramhelper.hxx|4 ++-- oox/source/drawingml/diagram/diagramlayoutatoms.hxx |3 ++- oox/source/drawingml/diagram/layoutatomvisitors.hxx |5 +++-- oox/source/drawingml/diagram/layoutnodecontext.cxx|5 +++-- oox/source/drawingml/shapecontext.cxx |7 --- oox/source/drawingml/shapegroupcontext.cxx|5 +++-- oox/source/drawingml/textbodycontext.cxx |5 +++-- oox/source/dump/dffdumper.cxx |5 +++-- oox/source/dump/dumperbase.cxx| 13 +++-- oox/source/export/chartexport.cxx |4 ++-- oox/source/export/vmlexport.cxx |5 +++-- oox/source/helper/graphichelper.cxx |5 +++-- oox/source/helper/modelobjecthelper.cxx |5 +++-- oox/source/helper/storagebase.cxx |5 +++-- oox/source/mathml/importutils.cxx |5 +++-- oox/source/ole/axcontrol.cxx |5 +++-- oox/source/ole/olehelper.cxx |5 +++-- oox/source/ole/oleobjecthelper.cxx|5 +++-- oox/source/ole/olestorage.cxx |7 --- oox/source/ole/vbaexport.cxx |5 +++-- oox/source/ole/vbamodule.cxx |5 +++-- oox/source/ole/vbaproject.cxx |5 +++-- oox/source/ppt/extdrawingfragmenthandler.cxx | 13 +++-- oox/source/ppt/extdrawingfragmenthandler.hxx |6 +++---
[Libreoffice-commits] core.git: include/oox include/sax oox/source sax/source sc/source sw/source writerfilter/source
include/oox/helper/attributelist.hxx |2 - include/sax/fastattribs.hxx|3 - oox/source/helper/attributelist.cxx| 17 -- sax/source/tools/fastattribs.cxx | 11 +- sc/source/filter/inc/addressconverter.hxx |6 +-- sc/source/filter/oox/addressconverter.cxx |9 +++-- sc/source/filter/oox/sheetdatacontext.cxx |4 +- sw/source/filter/ww8/docxattributeoutput.cxx | 14 writerfilter/source/ooxml/OOXMLFactory.cxx | 12 +++ writerfilter/source/ooxml/OOXMLPropertySet.cxx | 41 - writerfilter/source/ooxml/OOXMLPropertySet.hxx | 12 +++ 11 files changed, 62 insertions(+), 69 deletions(-) New commits: commit 75a862b887fb0b7ff633a396ee7f7f34c2c82964 Author: Noel Grandin AuthorDate: Mon Aug 1 18:58:55 2022 +0200 Commit: Noel Grandin CommitDate: Mon Aug 1 20:53:28 2022 +0200 use more string_view when dealing with attributes which means we don't need to call strlen on them, since we already know how long they are. Change-Id: Iefc76f38a23250e87a65c27df3634d562464a760 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137679 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/oox/helper/attributelist.hxx b/include/oox/helper/attributelist.hxx index d58305bffa54..65e7f4ee2cf3 100644 --- a/include/oox/helper/attributelist.hxx +++ b/include/oox/helper/attributelist.hxx @@ -145,7 +145,7 @@ public: passed default string if the attribute is missing. */ OUString getXString( sal_Int32 nAttrToken, const OUString& rDefault ) const; -const char* getChar( sal_Int32 nAttrToken ) const; +std::string_view getView( sal_Int32 nAttrToken ) const; /** Returns the double value of the specified attribute, or the passed diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx index 24133a4f82ca..ef7e97884735 100644 --- a/include/sax/fastattribs.hxx +++ b/include/sax/fastattribs.hxx @@ -103,9 +103,8 @@ public: // performance sensitive shortcuts to avoid allocation ... bool getAsInteger( sal_Int32 nToken, sal_Int32 ) const; bool getAsDouble( sal_Int32 nToken, double ) const; -bool getAsChar( sal_Int32 nToken, const char*& rPos ) const; +bool getAsView( sal_Int32 nToken, std::string_view& rPos ) const; sal_Int32 getAsIntegerByIndex( sal_Int32 nTokenIndex ) const; -const char* getAsCharByIndex( sal_Int32 nTokenIndex ) const; std::string_view getAsViewByIndex( sal_Int32 nTokenIndex ) const; OUString getValueByIndex( sal_Int32 nTokenIndex ) const; diff --git a/oox/source/helper/attributelist.cxx b/oox/source/helper/attributelist.cxx index 043f0689fd40..0215588b2b97 100644 --- a/oox/source/helper/attributelist.cxx +++ b/oox/source/helper/attributelist.cxx @@ -227,15 +227,15 @@ std::optional< sal_Int32 > AttributeList::getIntegerHex( sal_Int32 nAttrToken ) std::optional< bool > AttributeList::getBool( sal_Int32 nAttrToken ) const { -const char *pAttr; +std::string_view pAttr; // catch the common cases as quickly as possible first -bool bHasAttr = getAttribList()->getAsChar( nAttrToken, pAttr ); +bool bHasAttr = getAttribList()->getAsView( nAttrToken, pAttr ); if( !bHasAttr ) return std::optional< bool >(); -if( !strcmp( pAttr, "false" ) ) +if( pAttr == "false" ) return std::optional< bool >( false ); -if( !strcmp( pAttr, "true" ) ) +if( pAttr == "true" ) return std::optional< bool >( true ); // now for all the crazy stuff @@ -299,13 +299,10 @@ OUString AttributeList::getXString( sal_Int32 nAttrToken, const OUString& rDefau return getXString( nAttrToken ).value_or( rDefault ); } -const char* AttributeList::getChar( sal_Int32 nAttrToken ) const +std::string_view AttributeList::getView( sal_Int32 nAttrToken ) const { -const char* p = nullptr; -bool bValid = getAttribList()->getAsChar(nAttrToken, p); -if (!bValid) -p = nullptr; - +std::string_view p; +getAttribList()->getAsView(nAttrToken, p); return p; } diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx index 3522f38f3ef5..d020e18de18c 100644 --- a/sax/source/tools/fastattribs.cxx +++ b/sax/source/tools/fastattribs.cxx @@ -242,7 +242,7 @@ bool FastAttributeList::getAsDouble( sal_Int32 nToken, double ) const return false; } -bool FastAttributeList::getAsChar( sal_Int32 nToken, const char*& rPos ) const +bool FastAttributeList::getAsView( sal_Int32 nToken, std::string_view& rPos ) const { for (size_t i = 0, n = maAttributeTokens.size(); i < n; ++i) { @@ -250,19 +250,14 @@ bool FastAttributeList::getAsChar( sal_Int32 nToken, const char*& rPos ) const continue; sal_Int32 nOffset = maAttributeValues[i]; -rPos = mpChunk + nOffset; +size_t nValueLen = maAttributeValues[i +
[Libreoffice-commits] core.git: include/oox oox/source
include/oox/export/drawingml.hxx |2 +- oox/source/export/drawingml.cxx |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) New commits: commit 3777a1e769913460ecc818988df8fc57829d7113 Author: Caolán McNamara AuthorDate: Fri Jul 29 09:48:03 2022 +0100 Commit: Caolán McNamara CommitDate: Fri Jul 29 18:05:08 2022 +0200 cid#1507492 Improper use of negative value Change-Id: I7c44307917df3397cfc9c99a982c54f51693e660 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137589 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index c80024ea1fdd..2e418b18b933 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -231,7 +231,7 @@ public: void WriteColorTransformations( const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT ); void WriteGradientStop(sal_uInt16 nStop, ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT); void WriteLineArrow( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, bool bLineStart ); -void WriteConnectorConnections( sal_uInt32 nStartGlueId, sal_Int32 nEndGlueId, sal_Int32 nStartID, sal_Int32 nEndID ); +void WriteConnectorConnections( sal_Int32 nStartGlueId, sal_Int32 nEndGlueId, sal_Int32 nStartID, sal_Int32 nEndID ); bool WriteCharColor(const css::uno::Reference& xPropertySet); bool WriteFillColor(const css::uno::Reference& xPropertySet); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index e4d0ed7ddc4e..63a5d22dd222 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -4759,7 +4759,7 @@ void DrawingML::WritePolyPolygon(const css::uno::Reference mpFS->endElementNS(XML_a, XML_custGeom); } -void DrawingML::WriteConnectorConnections( sal_uInt32 nStartGlueId, sal_Int32 nEndGlueId, sal_Int32 nStartID, sal_Int32 nEndID ) +void DrawingML::WriteConnectorConnections( sal_Int32 nStartGlueId, sal_Int32 nEndGlueId, sal_Int32 nStartID, sal_Int32 nEndID ) { if( nStartID != -1 ) {
[Libreoffice-commits] core.git: include/oox oox/source sd/qa
include/oox/export/drawingml.hxx|2 +- oox/source/export/drawingml.cxx |6 +++--- oox/source/export/shapes.cxx| 33 - sd/qa/unit/data/pptx/tdf149697.pptx |binary sd/qa/unit/export-tests-ooxml2.cxx | 25 + 5 files changed, 61 insertions(+), 5 deletions(-) New commits: commit 4d153517183193f468dee9148c94fe9d874bacb3 Author: Tibor Nagy AuthorDate: Mon Jun 27 09:45:04 2022 +0200 Commit: László Németh CommitDate: Fri Jul 22 13:40:25 2022 +0200 tdf#149697 PPTX export: fix changing place of connection points Place of the connection point of a polygon changed during a PPTX round-trip, connecting other vertices of e.g. a square or a hexagon, as before. See also commit c3f73f75772d076dfb2ed0538e7d515503edc038 "tdf#149128 PPTX export: fix and connector properties". Change-Id: I64fc6377417a99d32e84ea71fbed13cf36760118 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136474 Tested-by: László Németh Reviewed-by: László Németh diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index 455676e9c262..c80024ea1fdd 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -231,7 +231,7 @@ public: void WriteColorTransformations( const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT ); void WriteGradientStop(sal_uInt16 nStop, ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT); void WriteLineArrow( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, bool bLineStart ); -void WriteConnectorConnections( EscherConnectorListEntry& rConnectorEntry, sal_Int32 nStartID, sal_Int32 nEndID ); +void WriteConnectorConnections( sal_uInt32 nStartGlueId, sal_Int32 nEndGlueId, sal_Int32 nStartID, sal_Int32 nEndID ); bool WriteCharColor(const css::uno::Reference& xPropertySet); bool WriteFillColor(const css::uno::Reference& xPropertySet); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index d889f475c556..392ce6f4d6aa 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -4747,19 +4747,19 @@ void DrawingML::WritePolyPolygon(const css::uno::Reference mpFS->endElementNS(XML_a, XML_custGeom); } -void DrawingML::WriteConnectorConnections( EscherConnectorListEntry& rConnectorEntry, sal_Int32 nStartID, sal_Int32 nEndID ) +void DrawingML::WriteConnectorConnections( sal_uInt32 nStartGlueId, sal_Int32 nEndGlueId, sal_Int32 nStartID, sal_Int32 nEndID ) { if( nStartID != -1 ) { mpFS->singleElementNS( XML_a, XML_stCxn, XML_id, OString::number(nStartID), - XML_idx, OString::number(rConnectorEntry.GetConnectorRule(true)) ); + XML_idx, OString::number(nStartGlueId) ); } if( nEndID != -1 ) { mpFS->singleElementNS( XML_a, XML_endCxn, XML_id, OString::number(nEndID), - XML_idx, OString::number(rConnectorEntry.GetConnectorRule(false)) ); + XML_idx, OString::number(nEndGlueId) ); } } diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index f0b446a7eb33..19ef8156f3e3 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -63,6 +63,8 @@ #include #include #include +#include +#include #include #include #include @@ -1636,11 +1638,33 @@ static void lcl_GetConnectorAdjustValue(const Reference& xShape, tools:: } } +static sal_Int32 lcl_GetGluePointId(const Reference& xShape, sal_Int32& nGluePointId) +{ +uno::Reference xSupplier(xShape, uno::UNO_QUERY); +uno::Reference xGluePoints(xSupplier->getGluePoints(), + uno::UNO_QUERY); +sal_uInt32 nCount = xGluePoints->getIdentifiers().size(); +if (nCount > 4) +nGluePointId -= 4; +else +{ +// change id of the bounding box (1 <-> 3) +if (nGluePointId == 1) +nGluePointId = 3; // Right +else if (nGluePointId == 3) +nGluePointId = 1; // Left +} + +return nGluePointId; +} + ShapeExport& ShapeExport::WriteConnectorShape( const Reference< XShape >& xShape ) { bool bFlipH = false; bool bFlipV = false; sal_Int32 nAngle = 0; +sal_Int32 nStartGlueId = 0; +sal_Int32 nEndGlueId = 0; SAL_INFO("oox.shape", "write connector shape"); @@ -1680,6 +1704,13 @@ ShapeExport& ShapeExport::WriteConnectorShape( const Reference< XShape >& xShape GET( rXShapeA, EdgeStartConnection ); GET( rXShapeB, EdgeEndConnection ); +GET(nStartGlueId, StartGluePointIndex); +if (nStartGlueId != -1) +lcl_GetGluePointId(rXShapeA, nStartGlueId); +GET(nEndGlueId,
[Libreoffice-commits] core.git: include/oox svtools/source
include/oox/ole/axcontrol.hxx |2 +- svtools/source/control/tabbar.cxx |1 - 2 files changed, 1 insertion(+), 2 deletions(-) New commits: commit 6d5399965a44ebe48cc1aa038cee7308636b5527 Author: Andrea Gelmini AuthorDate: Thu Jul 14 13:54:06 2022 +0200 Commit: Julien Nabet CommitDate: Thu Jul 21 16:12:53 2022 +0200 Removed duplicated include and typo Change-Id: Idd50b3533e8b32e66cb4975e1257048f9233089b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137078 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/include/oox/ole/axcontrol.hxx b/include/oox/ole/axcontrol.hxx index f4fd7b6a7deb..ddcc5b80a3c1 100644 --- a/include/oox/ole/axcontrol.hxx +++ b/include/oox/ole/axcontrol.hxx @@ -671,7 +671,7 @@ class OOX_DLLPUBLIC AxOptionButtonModel final : public AxMorphDataModelBase public: explicitAxOptionButtonModel(); -/** Returns the group name used to goup several option buttons together. */ +/** Returns the group name used to group several option buttons together. */ const OUString& getGroupName() const { return maGroupName; } virtual ApiControlType getControlType() const override; diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx index 11448292f5e0..5e5aba4af172 100644 --- a/svtools/source/control/tabbar.cxx +++ b/svtools/source/control/tabbar.cxx @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include
[Libreoffice-commits] core.git: include/oox oox/inc oox/source
include/oox/ppt/slidetransitioncontext.hxx |2 +- oox/inc/drawingml/transform2dcontext.hxx|2 +- oox/source/drawingml/transform2dcontext.cxx |2 +- oox/source/ppt/slidetransitioncontext.cxx |2 +- oox/source/ppt/timenodelistcontext.cxx |2 +- 5 files changed, 5 insertions(+), 5 deletions(-) New commits: commit 604583b177fbf8fa5044e54d0a35b9adff949e45 Author: Caolán McNamara AuthorDate: Sat Jul 16 21:38:47 2022 +0100 Commit: Caolán McNamara CommitDate: Sun Jul 17 12:22:56 2022 +0200 cid#1506711 Uncaught exception and cid#1506712 Uncaught exception cid#1506713 Uncaught exception Change-Id: I8f9753369cb3c85e5f6b910b00aaf553db62750b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137144 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/include/oox/ppt/slidetransitioncontext.hxx b/include/oox/ppt/slidetransitioncontext.hxx index f28b763c6b0d..066a671398ee 100644 --- a/include/oox/ppt/slidetransitioncontext.hxx +++ b/include/oox/ppt/slidetransitioncontext.hxx @@ -37,7 +37,7 @@ namespace oox::ppt { public: SlideTransitionContext( ::oox::core::FragmentHandler2 const & rParent, const AttributeList& rAttributes, -PropertyMap & aProperties ) noexcept; +PropertyMap & aProperties ); virtual ~SlideTransitionContext() noexcept override; virtual void onEndElement() override; diff --git a/oox/inc/drawingml/transform2dcontext.hxx b/oox/inc/drawingml/transform2dcontext.hxx index f54b0249380d..984ce0ed18cb 100644 --- a/oox/inc/drawingml/transform2dcontext.hxx +++ b/oox/inc/drawingml/transform2dcontext.hxx @@ -31,7 +31,7 @@ class Transform2DContext final : public ::oox::core::ContextHandler2 { public: Transform2DContext( ::oox::core::ContextHandler2Helper const & rParent, -const ::oox::AttributeList& rAttributes, Shape& rShape, bool btxXfrm = false ) noexcept; +const ::oox::AttributeList& rAttributes, Shape& rShape, bool btxXfrm = false ); virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override; private: diff --git a/oox/source/drawingml/transform2dcontext.cxx b/oox/source/drawingml/transform2dcontext.cxx index df54fe98b71e..b73e3d7c8a62 100644 --- a/oox/source/drawingml/transform2dcontext.cxx +++ b/oox/source/drawingml/transform2dcontext.cxx @@ -30,7 +30,7 @@ using ::oox::core::ContextHandlerRef; namespace oox::drawingml { /** context to import a CT_Transform2D */ -Transform2DContext::Transform2DContext( ContextHandler2Helper const & rParent, const AttributeList& rAttribs, Shape& rShape, bool btxXfrm ) noexcept +Transform2DContext::Transform2DContext( ContextHandler2Helper const & rParent, const AttributeList& rAttribs, Shape& rShape, bool btxXfrm ) : ContextHandler2( rParent ) , mrShape( rShape ) , mbtxXfrm ( btxXfrm ) diff --git a/oox/source/ppt/slidetransitioncontext.cxx b/oox/source/ppt/slidetransitioncontext.cxx index 8ec8e0fd82a0..77349793260c 100644 --- a/oox/source/ppt/slidetransitioncontext.cxx +++ b/oox/source/ppt/slidetransitioncontext.cxx @@ -33,7 +33,7 @@ using namespace ::com::sun::star::xml::sax; namespace oox::ppt { -SlideTransitionContext::SlideTransitionContext( FragmentHandler2 const & rParent, const AttributeList& rAttribs, PropertyMap & aProperties ) noexcept +SlideTransitionContext::SlideTransitionContext( FragmentHandler2 const & rParent, const AttributeList& rAttribs, PropertyMap & aProperties ) : FragmentHandler2( rParent ) , maSlideProperties( aProperties ) , mbHasTransition( false ) diff --git a/oox/source/ppt/timenodelistcontext.cxx b/oox/source/ppt/timenodelistcontext.cxx index a7637432acdb..3be3fea7ff9d 100644 --- a/oox/source/ppt/timenodelistcontext.cxx +++ b/oox/source/ppt/timenodelistcontext.cxx @@ -651,7 +651,7 @@ namespace oox::ppt { public: AnimScaleContext( FragmentHandler2 const & rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, -const TimeNodePtr & pNode ) noexcept +const TimeNodePtr & pNode ) : TimeNodeContext( rParent, aElement, pNode ) , mbZoomContents( false ) {
[Libreoffice-commits] core.git: include/oox oox/inc oox/source sc/source
include/oox/drawingml/shape.hxx |4 include/oox/helper/attributelist.hxx| 20 ++-- include/oox/helper/helper.hxx | 32 --- include/oox/ppt/pptshape.hxx|3 include/oox/vml/vmlformatting.hxx | 64 +++ include/oox/vml/vmlshape.hxx| 26 +++--- include/oox/vml/vmlshapecontext.hxx |2 include/oox/vml/vmltextbox.hxx | 26 +++--- oox/inc/drawingml/chart/axismodel.hxx | 14 +-- oox/inc/drawingml/chart/plotareamodel.hxx |6 - oox/inc/drawingml/chart/seriesmodel.hxx | 34 oox/inc/drawingml/customshapeproperties.hxx | 16 +-- oox/inc/drawingml/fillproperties.hxx| 48 +-- oox/inc/drawingml/lineproperties.hxx| 16 +-- oox/inc/drawingml/shape3dproperties.hxx | 34 oox/inc/drawingml/textbodyproperties.hxx|4 oox/inc/drawingml/textcharacterproperties.hxx | 26 +++--- oox/source/drawingml/chart/axisconverter.cxx|4 oox/source/drawingml/chart/seriesconverter.cxx |4 oox/source/drawingml/colorchoicecontext.cxx |2 oox/source/drawingml/diagram/datamodelcontext.cxx |2 oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 16 +-- oox/source/drawingml/effectproperties.hxx | 14 +-- oox/source/drawingml/textbodypropertiescontext.cxx |2 oox/source/drawingml/textparagraphpropertiescontext.cxx | 14 +-- oox/source/helper/attributelist.cxx | 66 oox/source/ppt/layoutfragmenthandler.cxx|2 oox/source/ppt/pptshape.cxx |4 oox/source/ppt/pptshapecontext.cxx |2 oox/source/ppt/slidefragmenthandler.cxx |2 oox/source/shape/WpsContext.cxx | 12 +- oox/source/vml/vmlformatting.cxx| 20 ++-- oox/source/vml/vmlshapecontext.cxx | 44 +- oox/source/vml/vmltextboxcontext.cxx|4 sc/source/filter/inc/autofilterbuffer.hxx |2 sc/source/filter/oox/autofilterbuffer.cxx |2 36 files changed, 282 insertions(+), 311 deletions(-) New commits: commit 04073c5fedd33654f242fecb7e39afb07cf0e273 Author: Noel Grandin AuthorDate: Tue Jun 21 13:17:09 2022 +0200 Commit: Noel Grandin CommitDate: Mon Jun 27 11:32:42 2022 +0200 replace oox::OptValue with std::optional Change-Id: I16e7179b2851640b4d73665685dcc1e84042ddaf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136270 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx index 5f4173c9de87..246a964fc2a6 100644 --- a/include/oox/drawingml/shape.hxx +++ b/include/oox/drawingml/shape.hxx @@ -179,7 +179,7 @@ public: voidsetSubType( sal_Int32 nSubType ) { mnSubType = nSubType; } sal_Int32 getSubType() const { return mnSubType; } voidsetSubTypeIndex( sal_Int32 nSubTypeIndex ) { moSubTypeIndex = nSubTypeIndex; } -const OptValue< sal_Int32 >&getSubTypeIndex() const { return moSubTypeIndex; } +const std::optional< sal_Int32 >& getSubTypeIndex() const { return moSubTypeIndex; } // setDefaults has to be called if styles are imported (OfficeXML is not storing properties having the default value) voidsetDefaults(bool bHeight); @@ -353,7 +353,7 @@ protected: OUStringmsId; OUStringmsDescription; sal_Int32 mnSubType; // if this type is not zero, then the shape is a placeholder -OptValue< sal_Int32 > moSubTypeIndex; +std::optional< sal_Int32 > moSubTypeIndex; ShapeStyleRefMapmaShapeStyleRefs; diff --git a/include/oox/helper/attributelist.hxx b/include/oox/helper/attributelist.hxx index fb4079714a5c..d58305bffa54 100644 --- a/include/oox/helper/attributelist.hxx +++ b/include/oox/helper/attributelist.hxx @@ -95,41 +95,41 @@ public: // optional return values - /** Returns the token identifier of the value of the specified attribute. */ -OptValue< sal_Int32 > getToken( sal_Int32 nAttrToken ) const; +std::optional< sal_Int32 > getToken( sal_Int32 nAttrToken ) const; /** Returns the Color object of highlight of the text. */ oox::drawingml::Color getHighlightColor(sal_Int32 nAttrToken) const; /** Returns the string value of the specified attribute. */ -OptValue< OUString >
[Libreoffice-commits] core.git: include/oox oox/source
include/oox/helper/helper.hxx |2 +- oox/source/drawingml/chart/seriesconverter.cxx |2 +- oox/source/drawingml/shape.cxx |2 +- oox/source/vml/vmlformatting.cxx |2 +- oox/source/vml/vmlshape.cxx|6 -- oox/source/vml/vmltextbox.cxx |4 ++-- 6 files changed, 10 insertions(+), 8 deletions(-) New commits: commit 79f3abc0e200ffa772bc7722b5f384eb538d7576 Author: Noel Grandin AuthorDate: Fri Jun 24 11:55:13 2022 +0200 Commit: Noel Grandin CommitDate: Fri Jun 24 20:37:10 2022 +0200 make oox::OptValue::value() assert if empty as part of replacing OptValue with std::optional, we need to mimc the behaviour of std::optional::value(), which will throw bad_optional_access Change-Id: Icf5141cefd4623a6a1bb7b3a3449d3af382e01c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136365 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx index 9d5b7c3e2549..ef066f31d338 100644 --- a/include/oox/helper/helper.hxx +++ b/include/oox/helper/helper.hxx @@ -180,7 +180,7 @@ public: bool has_value() const { return mbHasValue; } bool operator!() const { return !mbHasValue; } -const Type& value() const { return maValue; } +const Type& value() const { assert(mbHasValue); return maValue; } const Type& value_or( const Type& rDefValue ) const { return mbHasValue ? maValue : rDefValue; } Type&operator*() { assert(mbHasValue); return maValue; } diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx index 383e5bd3fa4b..03e97d3e3339 100644 --- a/oox/source/drawingml/chart/seriesconverter.cxx +++ b/oox/source/drawingml/chart/seriesconverter.cxx @@ -197,7 +197,7 @@ void importBorderProperties( PropertySet& rPropSet, Shape& rShape, const Graphic { LineProperties& rLP = rShape.getLineProperties(); // no fill has the same effect as no border so skip it -if (rLP.maLineFill.moFillType.value() == XML_noFill) +if (rLP.maLineFill.moFillType.has_value() && rLP.maLineFill.moFillType.value() == XML_noFill) return; if (rLP.moLineWidth.has_value()) diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 236e0bea3c82..20564b584f76 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1685,7 +1685,7 @@ Reference< XShape > const & Shape::createAndInsert( mpCustomShapePropertiesPtr->setMirroredY( true ); if( getTextBody() ) { -sal_Int32 nTextCameraZRotation = static_cast< sal_Int32 >( getTextBody()->get3DProperties().maCameraRotation.mnRevolution.value() ); +sal_Int32 nTextCameraZRotation = getTextBody()->get3DProperties().maCameraRotation.mnRevolution.value_or(0); mpCustomShapePropertiesPtr->setTextCameraZRotateAngle( nTextCameraZRotation / 6 ); sal_Int32 nTextRotateAngle = static_cast< sal_Int32 >( getTextBody()->getTextProperties().moRotation.value_or( 0 ) ); diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index 6d80193e7b37..00a346748531 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -981,7 +981,7 @@ void TextpathModel::pushToPropMap(ShapePropertyMap& rPropMap, const uno::Referen if (moTrim.has_value() && moTrim.value()) return; -OUString sText = moString.value(); +OUString sText = moString.value_or(""); ScopedVclPtrInstance pDevice; vcl::Font aFont = pDevice->GetFont(); aFont.SetFamilyName(sFont); diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 2cb8261f1af4..22ea45a3bdd3 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -578,7 +578,7 @@ SimpleShape::SimpleShape( Drawing& rDrawing, const OUString& rService ) : static void lcl_setSurround(PropertySet& rPropSet, const ShapeTypeModel& rTypeModel, const GraphicHelper& rGraphicHelper) { -OUString aWrapType = rTypeModel.moWrapType.value(); +OUString aWrapType = rTypeModel.moWrapType.value_or(""); // Extreme negative top margin? Then the shape will end up at the top of the page, it's pointless to perform any kind of wrapping. sal_Int32 nMarginTop = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, rTypeModel.maMarginTop, 0, false, true); @@ -590,7 +590,9 @@ static void lcl_setSurround(PropertySet& rPropSet, const ShapeTypeModel& rTypeMo aWrapType == "through" ) { nSurround = css::text::WrapTextMode_PARALLEL; -if ( rTypeModel.moWrapSide.value() == "left" ) +if ( !rTypeModel.moWrapSide.has_value() ) +; // leave as PARALLEL +else if ( rTypeModel.moWrapSide.value() == "left" ) nSurround
[Libreoffice-commits] core.git: include/oox oox/source sc/source
include/oox/helper/helper.hxx|4 - oox/source/drawingml/chart/axisconverter.cxx | 20 +++--- oox/source/drawingml/chart/chartspaceconverter.cxx |2 oox/source/drawingml/chart/objectformatter.cxx |4 - oox/source/drawingml/chart/seriesconverter.cxx | 28 - oox/source/drawingml/connectorshapecontext.cxx | 12 +-- oox/source/drawingml/customshapegeometry.cxx | 26 oox/source/drawingml/customshapeproperties.cxx | 24 +++ oox/source/drawingml/diagram/datamodelcontext.cxx| 20 +++--- oox/source/drawingml/diagram/diagramdefinitioncontext.cxx| 14 ++-- oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 12 +-- oox/source/drawingml/diagram/layoutnodecontext.cxx | 12 +-- oox/source/drawingml/embeddedwavaudiofile.cxx|4 - oox/source/drawingml/fillproperties.cxx | 18 ++--- oox/source/drawingml/graphicshapecontext.cxx | 14 ++-- oox/source/drawingml/hyperlinkcontext.cxx|8 +- oox/source/drawingml/lineproperties.cxx | 22 +++ oox/source/drawingml/shape.cxx | 22 +++ oox/source/drawingml/shapecontext.cxx|8 +- oox/source/drawingml/shapegroupcontext.cxx |6 - oox/source/drawingml/table/tablecell.cxx |6 - oox/source/drawingml/table/tablecellcontext.cxx |4 - oox/source/drawingml/table/tablecontext.cxx |2 oox/source/drawingml/table/tablerowcontext.cxx |2 oox/source/drawingml/table/tablestylecontext.cxx |4 - oox/source/drawingml/table/tablestylelistfragmenthandler.cxx |2 oox/source/drawingml/textbodypropertiescontext.cxx |4 - oox/source/drawingml/textcharacterproperties.cxx | 18 ++--- oox/source/drawingml/textcharacterpropertiescontext.cxx |8 +- oox/source/drawingml/texteffectscontext.cxx |2 oox/source/drawingml/textfield.cxx |2 oox/source/drawingml/textfieldcontext.cxx|4 - oox/source/drawingml/textparagraph.cxx |2 oox/source/drawingml/textparagraphpropertiescontext.cxx | 30 - oox/source/drawingml/textrun.cxx |2 oox/source/drawingml/textspacingcontext.cxx |4 - oox/source/drawingml/texttabstoplistcontext.cxx |2 oox/source/drawingml/themeelementscontext.cxx|4 - oox/source/drawingml/themefragmenthandler.cxx|2 oox/source/drawingml/transform2dcontext.cxx | 20 +++--- oox/source/helper/attributelist.cxx |2 oox/source/ppt/layoutfragmenthandler.cxx |2 oox/source/ppt/pptgraphicshapecontext.cxx|6 - oox/source/ppt/pptshape.cxx | 10 +-- oox/source/ppt/pptshapecontext.cxx |6 - oox/source/ppt/pptshapegroupcontext.cxx |8 +- oox/source/ppt/presPropsfragmenthandler.cxx |4 - oox/source/ppt/slidefragmenthandler.cxx |2 oox/source/shape/LockedCanvasContext.cxx |4 - oox/source/shape/WpsContext.cxx | 12 +-- oox/source/vml/vmlformatting.cxx | 34 +-- oox/source/vml/vmlshape.cxx | 16 ++--- oox/source/vml/vmlshapecontext.cxx | 26 oox/source/vml/vmltextbox.cxx| 22 +++ oox/source/vml/vmltextboxcontext.cxx |8 +- sc/source/filter/oox/SparklineFragment.cxx |4 - sc/source/filter/oox/autofilterbuffer.cxx|2 sc/source/filter/oox/drawingfragment.cxx |2 58 files changed, 287 insertions(+), 287 deletions(-) New commits: commit 0feeb94f97332a8e803e1936d66e0f234bd51973 Author: Noel Grandin AuthorDate: Tue Jun 21 13:02:53 2022 +0200 Commit: Noel Grandin CommitDate: Wed Jun 22 11:48:28 2022 +0200 rename oox::OptValue::get to value as a step in replacing OptValue with std::optional Change-Id: Ia5d05c28a88beaced11ae1d0414de66106cc9e20 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136269 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx index 0c8aa2e6c358..9d5b7c3e2549 100644 --- a/include/oox/helper/helper.hxx +++ b/include/oox/helper/helper.hxx @@ -180,7 +180,7 @@ public: bool has_value()
[Libreoffice-commits] core.git: include/oox oox/source sc/source
include/oox/helper/helper.hxx |2 - oox/source/drawingml/chart/objectformatter.cxx |4 +-- oox/source/drawingml/chart/plotareaconverter.cxx |8 +++--- oox/source/drawingml/chart/seriesconverter.cxx | 24 +- oox/source/drawingml/fillproperties.cxx| 28 ++--- oox/source/drawingml/lineproperties.cxx| 12 - oox/source/drawingml/shape.cxx |8 +++--- oox/source/drawingml/table/tablecell.cxx | 12 - oox/source/drawingml/textbodyproperties.cxx|4 +-- oox/source/drawingml/textbodypropertiescontext.cxx |4 +-- oox/source/drawingml/textcharacterproperties.cxx | 16 ++-- oox/source/helper/attributelist.cxx| 18 ++--- oox/source/vml/vmlformatting.cxx | 20 +++ oox/source/vml/vmlshape.cxx|8 +++--- oox/source/vml/vmlshapecontext.cxx |4 +-- sc/source/filter/oox/autofilterbuffer.cxx |2 - sc/source/filter/oox/drawingfragment.cxx | 16 ++-- 17 files changed, 95 insertions(+), 95 deletions(-) New commits: commit 813939f8e392feff0b6e1bae023bc9c98849 Author: Noel Grandin AuthorDate: Tue Jun 21 12:43:56 2022 +0200 Commit: Noel Grandin CommitDate: Wed Jun 22 10:28:41 2022 +0200 rename oox::OptValue::get(Type) to value_or as a step towards replacing OptValue with std::optional Change-Id: Ic4afaca87034b1b794432ee4261a6495058b26fa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136268 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx index 90890b3ceecb..0c8aa2e6c358 100644 --- a/include/oox/helper/helper.hxx +++ b/include/oox/helper/helper.hxx @@ -181,7 +181,7 @@ public: bool operator!() const { return !mbHasValue; } const Type& get() const { return maValue; } -const Type& get( const Type& rDefValue ) const { return mbHasValue ? maValue : rDefValue; } +const Type& value_or( const Type& rDefValue ) const { return mbHasValue ? maValue : rDefValue; } Type&operator*() { assert(mbHasValue); return maValue; } Type&emplace() { mbHasValue = true; maValue = Type(); return maValue; } diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx index e04bfe5f0ae6..2ef67ebc683e 100644 --- a/oox/source/drawingml/chart/objectformatter.cxx +++ b/oox/source/drawingml/chart/objectformatter.cxx @@ -1060,14 +1060,14 @@ void ObjectFormatter::convertTextRotation( PropertySet& rPropSet, const ModelRef bool bStacked = false; if( bSupportsStacked ) { -sal_Int32 nVert = rxTextProp->getTextProperties().moVert.get( XML_horz ); +sal_Int32 nVert = rxTextProp->getTextProperties().moVert.value_or( XML_horz ); bStacked = (nVert == XML_wordArtVert) || (nVert == XML_wordArtVertRtl); rPropSet.setProperty( PROP_StackCharacters, bStacked ); } /* Chart2 expects rotation angle as double value in range of [0,360). OOXML counts clockwise, Chart2 counts counterclockwise. */ -double fAngle = static_cast< double >( bStacked ? 0 : rxTextProp->getTextProperties().moRotation.get( nDefaultRotation ) ); +double fAngle = static_cast< double >( bStacked ? 0 : rxTextProp->getTextProperties().moRotation.value_or( nDefaultRotation ) ); // MS Office UI allows values only in range of [-90,90]. if ( fAngle < -540.0 || fAngle > 540.0 ) { diff --git a/oox/source/drawingml/chart/plotareaconverter.cxx b/oox/source/drawingml/chart/plotareaconverter.cxx index afbb28adee03..a30b3bdc6249 100644 --- a/oox/source/drawingml/chart/plotareaconverter.cxx +++ b/oox/source/drawingml/chart/plotareaconverter.cxx @@ -217,9 +217,9 @@ void View3DConverter::convertFromModel( const Reference< XDiagram >& rxDiagram, if( rTypeGroup.getTypeInfo().meTypeCategory == TYPECATEGORY_PIE ) { // Y rotation used as 'first pie slice angle' in 3D pie charts -rTypeGroup.convertPieRotation( aPropSet, mrModel.monRotationY.get( 0 ) ); +rTypeGroup.convertPieRotation( aPropSet, mrModel.monRotationY.value_or( 0 ) ); // X rotation a.k.a. elevation (map OOXML [0..90] to Chart2 [-90,0]) -nRotationX = getLimitedValue< sal_Int32, sal_Int32 >( mrModel.monRotationX.get( 15 ), 0, 90 ) - 90; +nRotationX = getLimitedValue< sal_Int32, sal_Int32 >( mrModel.monRotationX.value_or( 15 ), 0, 90 ) - 90; // no right-angled axes in pie charts bRightAngled = false; // ambient color (Gray 30%) @@ -230,9 +230,9 @@ void View3DConverter::convertFromModel( const Reference< XDiagram >& rxDiagram, else // 3D bar/area/line charts { // Y rotation (OOXML [0..359], Chart2 [-179,180]) -
[Libreoffice-commits] core.git: include/oox oox/source sc/source
include/oox/helper/helper.hxx|8 +++- oox/source/drawingml/effectproperties.cxx| 14 +++ oox/source/drawingml/fillproperties.cxx | 46 +++ oox/source/drawingml/lineproperties.cxx | 16 oox/source/drawingml/textcharacterproperties.cxx | 26 ++--- oox/source/vml/vmlformatting.cxx | 46 +++ oox/source/vml/vmlshape.cxx | 10 ++--- oox/source/vml/vmlshapecontext.cxx | 20 +- sc/source/filter/oox/autofilterbuffer.cxx|2 - 9 files changed, 97 insertions(+), 91 deletions(-) New commits: commit 3ff9582704a024b4a89da9a63322e117157b5857 Author: Noel Grandin AuthorDate: Tue Jun 21 12:18:52 2022 +0200 Commit: Noel Grandin CommitDate: Wed Jun 22 10:08:35 2022 +0200 make oox::OptValue::assignIfUsed a free function as a step towards making OptValue into std::optional. Change-Id: I3eae4034a846dd63a16e501abe4a6eba9d186a49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136266 Tested-by: Noel Grandin Reviewed-by: Noel Grandin diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx index 9dc43bdc9b34..90890b3ceecb 100644 --- a/include/oox/helper/helper.hxx +++ b/include/oox/helper/helper.hxx @@ -191,13 +191,19 @@ public: return ( ( !mbHasValue && rValue.mbHasValue == false ) || ( mbHasValue == rValue.mbHasValue && maValue == rValue.maValue ) ); } -void assignIfUsed( const OptValue& rValue ) { if( rValue.mbHasValue ) operator=(rValue.maValue); } private: TypemaValue; boolmbHasValue; }; +template< typename Type > +void assignIfUsed( OptValue& rDestValue, const OptValue& rSourceValue ) +{ +if( rSourceValue.has_value() ) +rDestValue = rSourceValue.get(); +} + /** Provides platform independent functions to convert from or to little-endian byte order, e.g. for reading data from or writing data to memory or a diff --git a/oox/source/drawingml/effectproperties.cxx b/oox/source/drawingml/effectproperties.cxx index 88d69a16d177..579f4e1ab0ac 100644 --- a/oox/source/drawingml/effectproperties.cxx +++ b/oox/source/drawingml/effectproperties.cxx @@ -21,23 +21,23 @@ namespace oox::drawingml { void EffectGlowProperties ::assignUsed(const EffectGlowProperties& rSourceProps) { -moGlowRad.assignIfUsed( rSourceProps.moGlowRad ); +assignIfUsed( moGlowRad, rSourceProps.moGlowRad ); moGlowColor.assignIfUsed( rSourceProps.moGlowColor ); } void EffectSoftEdgeProperties::assignUsed(const EffectSoftEdgeProperties& rSourceProps) { -moRad.assignIfUsed(rSourceProps.moRad); +assignIfUsed(moRad, rSourceProps.moRad); } void EffectShadowProperties::assignUsed(const EffectShadowProperties& rSourceProps) { -moShadowDist.assignIfUsed( rSourceProps.moShadowDist ); -moShadowDir.assignIfUsed( rSourceProps.moShadowDir ); -moShadowSx.assignIfUsed( rSourceProps.moShadowSx ); -moShadowSy.assignIfUsed( rSourceProps.moShadowSy ); +assignIfUsed( moShadowDist, rSourceProps.moShadowDist ); +assignIfUsed( moShadowDir, rSourceProps.moShadowDir ); +assignIfUsed( moShadowSx, rSourceProps.moShadowSx ); +assignIfUsed( moShadowSy, rSourceProps.moShadowSy ); moShadowColor.assignIfUsed( rSourceProps.moShadowColor ); -moShadowBlur.assignIfUsed( rSourceProps.moShadowBlur ); +assignIfUsed( moShadowBlur, rSourceProps.moShadowBlur ); } diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index b26c42b85759..f315f0182245 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -292,51 +292,51 @@ void GradientFillProperties::assignUsed( const GradientFillProperties& rSourcePr { if( !rSourceProps.maGradientStops.empty() ) maGradientStops = rSourceProps.maGradientStops; -moFillToRect.assignIfUsed( rSourceProps.moFillToRect ); -moTileRect.assignIfUsed( rSourceProps.moTileRect ); -moGradientPath.assignIfUsed( rSourceProps.moGradientPath ); -moShadeAngle.assignIfUsed( rSourceProps.moShadeAngle ); -moShadeFlip.assignIfUsed( rSourceProps.moShadeFlip ); -moShadeScaled.assignIfUsed( rSourceProps.moShadeScaled ); -moRotateWithShape.assignIfUsed( rSourceProps.moRotateWithShape ); +assignIfUsed( moFillToRect, rSourceProps.moFillToRect ); +assignIfUsed( moTileRect, rSourceProps.moTileRect ); +assignIfUsed( moGradientPath, rSourceProps.moGradientPath ); +assignIfUsed( moShadeAngle, rSourceProps.moShadeAngle ); +assignIfUsed( moShadeFlip, rSourceProps.moShadeFlip ); +assignIfUsed( moShadeScaled, rSourceProps.moShadeScaled ); +assignIfUsed( moRotateWithShape, rSourceProps.moRotateWithShape ); } void
[Libreoffice-commits] core.git: include/oox oox/source
include/oox/helper/helper.hxx |1 - oox/source/helper/attributelist.cxx | 33 - 2 files changed, 16 insertions(+), 18 deletions(-) New commits: commit e9affc204c1d330b2a7873f44b3f575bcccdf4dc Author: Noel Grandin AuthorDate: Tue Jun 21 12:27:26 2022 +0200 Commit: Noel Grandin CommitDate: Wed Jun 22 10:06:19 2022 +0200 remove OptValue(bool,Type) constructor as a step towards converting it to std::optional Change-Id: I6f377967f2a495d8c29979444607c991aaaf5d63 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136267 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx index 33ae8689b5eb..9dc43bdc9b34 100644 --- a/include/oox/helper/helper.hxx +++ b/include/oox/helper/helper.hxx @@ -176,7 +176,6 @@ class OptValue public: OptValue() : maValue(), mbHasValue( false ) {} explicit OptValue( const Type& rValue ) : maValue( rValue ), mbHasValue( true ) {} -explicit OptValue( bool bHasValue, const Type& rValue ) : maValue( rValue ), mbHasValue( bHasValue ) {} bool has_value() const { return mbHasValue; } bool operator!() const { return !mbHasValue; } diff --git a/oox/source/helper/attributelist.cxx b/oox/source/helper/attributelist.cxx index 25cb1ac5354f..c7b6b0c4cfb6 100644 --- a/oox/source/helper/attributelist.cxx +++ b/oox/source/helper/attributelist.cxx @@ -163,7 +163,7 @@ oox::drawingml::Color AttributeList::getHighlightColor(sal_Int32 nAttrToken) con OptValue< sal_Int32 > AttributeList::getToken( sal_Int32 nAttrToken ) const { sal_Int32 nToken = mxAttribs->getOptionalValueToken( nAttrToken, XML_TOKEN_INVALID ); -return OptValue< sal_Int32 >( nToken != XML_TOKEN_INVALID, nToken ); +return nToken == XML_TOKEN_INVALID ? OptValue< sal_Int32 >() : OptValue< sal_Int32 >( nToken ); } OptValue< OUString > AttributeList::getString( sal_Int32 nAttrToken ) const @@ -186,35 +186,35 @@ OptValue< double > AttributeList::getDouble( sal_Int32 nAttrToken ) const { double nValue; bool bValid = getAttribList()->getAsDouble( nAttrToken, nValue ); -return OptValue< double >( bValid, nValue ); +return bValid ? OptValue< double >( nValue ) : OptValue< double >(); } OptValue< sal_Int32 > AttributeList::getInteger( sal_Int32 nAttrToken ) const { sal_Int32 nValue; bool bValid = getAttribList()->getAsInteger( nAttrToken, nValue ); -return OptValue< sal_Int32 >( bValid, nValue ); +return bValid ? OptValue< sal_Int32 >( nValue ) : OptValue< sal_Int32 >(); } OptValue< sal_uInt32 > AttributeList::getUnsigned( sal_Int32 nAttrToken ) const { OUString aValue = mxAttribs->getOptionalValue( nAttrToken ); bool bValid = !aValue.isEmpty(); -return OptValue< sal_uInt32 >( bValid, AttributeConversion::decodeUnsigned( aValue ) ); +return bValid ? OptValue< sal_uInt32 >( AttributeConversion::decodeUnsigned( aValue ) ) : OptValue< sal_uInt32 >(); } OptValue< sal_Int64 > AttributeList::getHyper( sal_Int32 nAttrToken ) const { OUString aValue = mxAttribs->getOptionalValue( nAttrToken ); bool bValid = !aValue.isEmpty(); -return OptValue< sal_Int64 >( bValid, bValid ? AttributeConversion::decodeHyper( aValue ) : 0 ); +return bValid ? OptValue< sal_Int64 >( AttributeConversion::decodeHyper( aValue ) ) : OptValue< sal_Int64 >(); } OptValue< sal_Int32 > AttributeList::getIntegerHex( sal_Int32 nAttrToken ) const { OUString aValue = mxAttribs->getOptionalValue( nAttrToken ); bool bValid = !aValue.isEmpty(); -return OptValue< sal_Int32 >( bValid, bValid ? AttributeConversion::decodeIntegerHex( aValue ) : 0 ); +return bValid ? OptValue< sal_Int32 >( AttributeConversion::decodeIntegerHex( aValue ) ) : OptValue< sal_Int32 >(); } OptValue< bool > AttributeList::getBool( sal_Int32 nAttrToken ) const @@ -243,7 +243,7 @@ OptValue< bool > AttributeList::getBool( sal_Int32 nAttrToken ) const case XML_off: return OptValue< bool >( false ); } OptValue< sal_Int32 > onValue = getInteger( nAttrToken ); -return OptValue< bool >( onValue.has_value(), onValue.get() != 0 ); +return onValue.has_value() ? OptValue< bool >( onValue.get() != 0 ) : OptValue< bool >(); } OptValue< util::DateTime > AttributeList::getDateTime( sal_Int32 nAttrToken ) const @@ -252,16 +252,15 @@ OptValue< util::DateTime > AttributeList::getDateTime( sal_Int32 nAttrToken ) co util::DateTime aDateTime; bool bValid = (aValue.getLength() == 19) && (aValue[ 4 ] == '-') && (aValue[ 7 ] == '-') && (aValue[ 10 ] == 'T') && (aValue[ 13 ] == ':') && (aValue[ 16 ] == ':'); -if( bValid ) -{ -aDateTime.Year= static_cast< sal_uInt16 >( o3tl::toInt32(aValue.subView( 0, 4 )) ); -aDateTime.Month = static_cast< sal_uInt16 >( o3tl::toInt32(aValue.subView( 5, 2 )) ); -
[Libreoffice-commits] core.git: include/oox oox/source
include/oox/helper/helper.hxx |3 - oox/source/drawingml/chart/seriesconverter.cxx |5 +- oox/source/drawingml/colorchoicecontext.cxx |2 oox/source/drawingml/shape3dproperties.cxx | 40 oox/source/drawingml/textcharacterpropertiescontext.cxx |4 + 5 files changed, 30 insertions(+), 24 deletions(-) New commits: commit b7fce4a7d26aa559b0d86ec561348c9adee4efcc Author: Noel Grandin AuthorDate: Tue Jun 21 11:37:13 2022 +0200 Commit: Noel Grandin CommitDate: Wed Jun 22 08:55:59 2022 +0200 replace oox::OptValue::use with emplace and operator* as a step towards converting it to std::optional Change-Id: I3fca397c7dcfe200962e2b81a423322e29787f20 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136215 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx index 7299353f1298..33ae8689b5eb 100644 --- a/include/oox/helper/helper.hxx +++ b/include/oox/helper/helper.hxx @@ -184,7 +184,8 @@ public: const Type& get() const { return maValue; } const Type& get( const Type& rDefValue ) const { return mbHasValue ? maValue : rDefValue; } -Type&use() { mbHasValue = true; return maValue; } +Type&operator*() { assert(mbHasValue); return maValue; } +Type&emplace() { mbHasValue = true; maValue = Type(); return maValue; } OptValue&operator=( const Type& rValue ) { maValue = rValue; mbHasValue = true; return *this; } bool operator==( const OptValue& rValue ) const { diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx index 703d995b18bf..b4e8666ffdb9 100644 --- a/oox/source/drawingml/chart/seriesconverter.cxx +++ b/oox/source/drawingml/chart/seriesconverter.cxx @@ -330,7 +330,10 @@ void DataLabelConverter::convertFromModel( const Reference< XDataSeries >& rxDat const auto& rLabelMap = pLabelSource->mxDataSeq->maData; const auto& rKV = rLabelMap.find(mrModel.mnIndex); if (rKV != rLabelMap.end()) -rKV->second >>= oaLabelText.use(); +{ +oaLabelText.emplace(); +rKV->second >>= *oaLabelText; +} } } diff --git a/oox/source/drawingml/colorchoicecontext.cxx b/oox/source/drawingml/colorchoicecontext.cxx index 8da42f62a419..81e077d58c4c 100644 --- a/oox/source/drawingml/colorchoicecontext.cxx +++ b/oox/source/drawingml/colorchoicecontext.cxx @@ -65,7 +65,7 @@ void ColorValueContext::onStartElement( const AttributeList& rAttribs ) mrColor.setSchemeClr( rAttribs.getToken( XML_val, XML_TOKEN_INVALID ) ); oox::OptValue sSchemeName = rAttribs.getString( XML_val ); if( sSchemeName.has_value() ) -mrColor.setSchemeName( sSchemeName.use() ); +mrColor.setSchemeName( *sSchemeName ); } break; diff --git a/oox/source/drawingml/shape3dproperties.cxx b/oox/source/drawingml/shape3dproperties.cxx index 8554320acf0b..3f9ac87158c4 100644 --- a/oox/source/drawingml/shape3dproperties.cxx +++ b/oox/source/drawingml/shape3dproperties.cxx @@ -210,37 +210,37 @@ css::uno::Sequence< css::beans::PropertyValue > Generic3DProperties::getCameraAt if( mfFieldOfVision.has_value() ) { pSeq[nSize].Name = "fov"; -pSeq[nSize].Value <<= mfFieldOfVision.use(); +pSeq[nSize].Value <<= *mfFieldOfVision; nSize++; } if( mfZoom.has_value() ) { pSeq[nSize].Name = "zoom"; -pSeq[nSize].Value <<= mfZoom.use(); +pSeq[nSize].Value <<= *mfZoom; nSize++; } if( mnPreset.has_value() ) { pSeq[nSize].Name = "prst"; -pSeq[nSize].Value <<= getCameraPrstName( mnPreset.use() ); +pSeq[nSize].Value <<= getCameraPrstName( *mnPreset ); nSize++; } if( maCameraRotation.mnLatitude.has_value() ) { pSeq[nSize].Name = "rotLat"; -pSeq[nSize].Value <<= maCameraRotation.mnLatitude.use(); +pSeq[nSize].Value <<= *maCameraRotation.mnLatitude; nSize++; } if( maCameraRotation.mnLongitude.has_value() ) { pSeq[nSize].Name = "rotLon"; -pSeq[nSize].Value <<= maCameraRotation.mnLongitude.use(); +pSeq[nSize].Value <<= *maCameraRotation.mnLongitude; nSize++; } if( maCameraRotation.mnRevolution.has_value() ) { pSeq[nSize].Name = "rotRev"; -pSeq[nSize].Value <<= maCameraRotation.mnRevolution.use(); +pSeq[nSize].Value <<= *maCameraRotation.mnRevolution; nSize++; } aSeq.realloc( nSize ); @@ -255,31 +255,31 @@ css::uno::Sequence< css::beans::PropertyValue > Generic3DProperties::getLightRig
[Libreoffice-commits] core.git: include/oox oox/source writerfilter/source
include/oox/helper/helper.hxx |5 +-- oox/source/drawingml/chart/objectformatter.cxx |2 - oox/source/drawingml/scene3dcontext.cxx |8 ++--- oox/source/drawingml/shape.cxx |2 - oox/source/drawingml/table/predefined-table-styles.cxx | 22 +++--- oox/source/drawingml/table/tablecell.cxx|6 ++-- oox/source/drawingml/textcharacterpropertiescontext.cxx |2 - oox/source/drawingml/textrun.cxx|4 +- oox/source/vml/vmlshapecontext.cxx |4 +- writerfilter/source/rtftok/rtfsdrimport.cxx | 24 10 files changed, 39 insertions(+), 40 deletions(-) New commits: commit 36d3fa20a5e0ebd7d3befd789a6930c777972e8c Author: Noel Grandin AuthorDate: Tue Jun 21 11:23:47 2022 +0200 Commit: Noel Grandin CommitDate: Tue Jun 21 14:37:34 2022 +0200 remove oox::OptValue::set as a step towards converting it to std::optional Change-Id: I49db0b13338388c92108fc2c27d8e662dcd954d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136214 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx index 8f0e75839281..7299353f1298 100644 --- a/include/oox/helper/helper.hxx +++ b/include/oox/helper/helper.hxx @@ -184,15 +184,14 @@ public: const Type& get() const { return maValue; } const Type& get( const Type& rDefValue ) const { return mbHasValue ? maValue : rDefValue; } -void set( const Type& rValue ) { maValue = rValue; mbHasValue = true; } Type&use() { mbHasValue = true; return maValue; } -OptValue&operator=( const Type& rValue ) { set( rValue ); return *this; } +OptValue&operator=( const Type& rValue ) { maValue = rValue; mbHasValue = true; return *this; } bool operator==( const OptValue& rValue ) const { return ( ( !mbHasValue && rValue.mbHasValue == false ) || ( mbHasValue == rValue.mbHasValue && maValue == rValue.maValue ) ); } -void assignIfUsed( const OptValue& rValue ) { if( rValue.mbHasValue ) set( rValue.maValue ); } +void assignIfUsed( const OptValue& rValue ) { if( rValue.mbHasValue ) operator=(rValue.maValue); } private: TypemaValue; diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx index 4bd69f8c779f..e04bfe5f0ae6 100644 --- a/oox/source/drawingml/chart/objectformatter.cxx +++ b/oox/source/drawingml/chart/objectformatter.cxx @@ -906,7 +906,7 @@ TextFormatter::TextFormatter( ObjectFormatterData& rData, const AutoTextEntry* p ::Color nTextColor = getPhColor( -1 ); if( sal_Int32(nTextColor) >= 0 ) { mxAutoText->maFillProperties.maFillColor.setSrgbClr( nTextColor ); -mxAutoText->maFillProperties.moFillType.set(XML_solidFill); +mxAutoText->maFillProperties.moFillType = XML_solidFill; } mxAutoText->moHeight = pAutoTextEntry->mnDefFontSize; mxAutoText->moBold = pAutoTextEntry->mbBold; diff --git a/oox/source/drawingml/scene3dcontext.cxx b/oox/source/drawingml/scene3dcontext.cxx index e17893472bc2..10b4fbff606c 100644 --- a/oox/source/drawingml/scene3dcontext.cxx +++ b/oox/source/drawingml/scene3dcontext.cxx @@ -105,9 +105,9 @@ ContextHandlerRef SceneText3DPropertiesContext::onCreateContext( sal_Int32 aElem aProps.mnPreset = rAttribs.getToken( XML_prst, XML_none ); if( aElementToken == A_TOKEN( bevelT ) ) -mr3DProperties.maTopBevelProperties.set( aProps ); +mr3DProperties.maTopBevelProperties = aProps; else -mr3DProperties.maBottomBevelProperties.set( aProps ); +mr3DProperties.maBottomBevelProperties = aProps; break; } @@ -150,9 +150,9 @@ ContextHandlerRef Shape3DPropertiesContext::onCreateContext( sal_Int32 aElementT aProps.mnPreset = rAttribs.getToken( XML_prst, XML_none ); if( aElementToken == A_TOKEN( bevelT ) ) -mr3DProperties.maTopBevelProperties.set( aProps ); +mr3DProperties.maTopBevelProperties = aProps; else -mr3DProperties.maBottomBevelProperties.set( aProps ); +mr3DProperties.maBottomBevelProperties = aProps; break; } diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 7e61dfb7c9c5..6b6ffbeab607 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1772,7 +1772,7 @@ Reference< XShape > const & Shape::createAndInsert( if ( pFontRef->maPhClr.isUsed() ) { aCharStyleProperties.maFillProperties.maFillColor = pFontRef->maPhClr; -
[Libreoffice-commits] core.git: include/oox oox/source
include/oox/helper/helper.hxx |1 - oox/source/drawingml/chart/seriesconverter.cxx |5 +++-- oox/source/drawingml/lineproperties.cxx| 16 +--- oox/source/drawingml/table/tablecell.cxx |2 +- 4 files changed, 13 insertions(+), 11 deletions(-) New commits: commit 6471ea40f7739814264ce8540cdedef28a3cb731 Author: Noel Grandin AuthorDate: Tue Jun 21 11:09:42 2022 +0200 Commit: Noel Grandin CommitDate: Tue Jun 21 14:36:43 2022 +0200 remove oox::OptValue::differsFrom as a step towards converting it to std::optional Change-Id: I198abb4ae85b1d82f465577ebd0eec37b78c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136213 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx index 1805e0b24c81..8f0e75839281 100644 --- a/include/oox/helper/helper.hxx +++ b/include/oox/helper/helper.hxx @@ -180,7 +180,6 @@ public: bool has_value() const { return mbHasValue; } bool operator!() const { return !mbHasValue; } -bool differsFrom( const Type& rValue ) const { return mbHasValue && (maValue != rValue); } const Type& get() const { return maValue; } const Type& get( const Type& rDefValue ) const { return mbHasValue ? maValue : rDefValue; } diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx index c022c35bf536..703d995b18bf 100644 --- a/oox/source/drawingml/chart/seriesconverter.cxx +++ b/oox/source/drawingml/chart/seriesconverter.cxx @@ -722,12 +722,13 @@ void DataPointConverter::convertFromModel( const Reference< XDataSeries >& rxDat PropertySet aPropSet( rxDataSeries->getDataPointByIndex( mrModel.mnIndex ) ); // data point marker -if( mrModel.monMarkerSymbol.differsFrom( rSeries.mnMarkerSymbol ) || mrModel.monMarkerSize.differsFrom( rSeries.mnMarkerSize ) ) +if( ( mrModel.monMarkerSymbol.has_value() && mrModel.monMarkerSymbol.get() != rSeries.mnMarkerSymbol ) || +( mrModel.monMarkerSize.has_value() && mrModel.monMarkerSize.get() != rSeries.mnMarkerSize ) ) rTypeGroup.convertMarker( aPropSet, mrModel.monMarkerSymbol.get( rSeries.mnMarkerSymbol ), mrModel.monMarkerSize.get( rSeries.mnMarkerSize ), mrModel.mxMarkerProp ); // data point pie explosion -if( mrModel.monExplosion.differsFrom( rSeries.mnExplosion ) ) +if( mrModel.monExplosion.has_value() && mrModel.monExplosion.get() != rSeries.mnExplosion ) rTypeGroup.convertPieExplosion( aPropSet, mrModel.monExplosion.get() ); // point formatting diff --git a/oox/source/drawingml/lineproperties.cxx b/oox/source/drawingml/lineproperties.cxx index 8f1a0c905b92..4cd83045840a 100644 --- a/oox/source/drawingml/lineproperties.cxx +++ b/oox/source/drawingml/lineproperties.cxx @@ -449,12 +449,13 @@ void LineProperties::pushToPropMap( ShapePropertyMap& rPropMap, rPropMap.setProperty( ShapeProperty::LineCap, eLineCap ); // create line dash from preset dash token or dash stop vector (not for invisible line) -if( (eLineStyle != drawing::LineStyle_NONE) && (moPresetDash.differsFrom( XML_solid ) || !maCustomDash.empty()) ) +if( (eLineStyle != drawing::LineStyle_NONE) && +((moPresetDash.has_value() && moPresetDash.get() != XML_solid) || !maCustomDash.empty()) ) { LineDash aLineDash; aLineDash.Style = lclGetDashStyle( moLineCap.get( XML_flat ) ); -if(moPresetDash.differsFrom(XML_solid)) +if(moPresetDash.has_value() && moPresetDash.get() != XML_solid) lclConvertPresetDash(aLineDash, moPresetDash.get(XML_dash)); else // !maCustomDash.empty() { @@ -505,11 +506,12 @@ void LineProperties::pushToPropMap( ShapePropertyMap& rPropMap, drawing::LineStyle LineProperties::getLineStyle() const { // rules to calculate the line style inferred from the code in LineProperties::pushToPropMap -return (maLineFill.moFillType.get() == XML_noFill) ? -drawing::LineStyle_NONE : -(moPresetDash.differsFrom( XML_solid ) || (!moPresetDash && !maCustomDash.empty())) ? -drawing::LineStyle_DASH : -drawing::LineStyle_SOLID; +if (maLineFill.moFillType.get() == XML_noFill) +return drawing::LineStyle_NONE; +if ((moPresetDash.has_value() && moPresetDash.get() != XML_solid) || +(!moPresetDash && !maCustomDash.empty())) + return drawing::LineStyle_DASH; +return drawing::LineStyle_SOLID; } drawing::LineCap LineProperties::getLineCap() const diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx index 32ac36b92ddc..1dae5369b271 100644 --- a/oox/source/drawingml/table/tablecell.cxx +++ b/oox/source/drawingml/table/tablecell.cxx @@ -64,7 +64,7 @@
[Libreoffice-commits] core.git: include/oox oox/source sc/source writerfilter/source
include/oox/helper/helper.hxx |2 oox/source/drawingml/chart/axisconverter.cxx| 20 oox/source/drawingml/chart/chartspaceconverter.cxx |2 oox/source/drawingml/chart/objectformatter.cxx |6 +- oox/source/drawingml/chart/seriesconverter.cxx | 28 +-- oox/source/drawingml/colorchoicecontext.cxx |2 oox/source/drawingml/customshapeproperties.cxx | 22 oox/source/drawingml/diagram/datamodelcontext.cxx |2 oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 14 ++--- oox/source/drawingml/fillproperties.cxx | 16 +++--- oox/source/drawingml/lineproperties.cxx | 12 ++-- oox/source/drawingml/shape.cxx | 24 - oox/source/drawingml/shape3dproperties.cxx | 40 oox/source/drawingml/table/predefined-table-styles.cxx |2 oox/source/drawingml/table/tablecell.cxx|4 - oox/source/drawingml/textbodypropertiescontext.cxx |2 oox/source/drawingml/textcharacterproperties.cxx| 18 +++ oox/source/drawingml/textcharacterpropertiescontext.cxx |6 +- oox/source/drawingml/textfield.cxx |2 oox/source/drawingml/textparagraph.cxx |6 +- oox/source/drawingml/textparagraphpropertiescontext.cxx | 14 ++--- oox/source/drawingml/textrun.cxx|4 - oox/source/helper/attributelist.cxx |2 oox/source/ppt/layoutfragmenthandler.cxx|2 oox/source/ppt/pptshape.cxx |6 +- oox/source/ppt/pptshapecontext.cxx |2 oox/source/ppt/slidefragmenthandler.cxx |2 oox/source/shape/WpsContext.cxx |8 +-- oox/source/vml/vmlformatting.cxx| 30 ++-- oox/source/vml/vmlshape.cxx | 12 ++-- oox/source/vml/vmlshapecontext.cxx | 18 +++ oox/source/vml/vmltextbox.cxx | 18 +++ oox/source/vml/vmltextboxcontext.cxx|4 - sc/source/filter/oox/drawingfragment.cxx|2 writerfilter/source/rtftok/rtfsdrimport.cxx |2 35 files changed, 178 insertions(+), 178 deletions(-) New commits: commit d8487667e65184aa58520aa907fa747a73a08e34 Author: Noel Grandin AuthorDate: Tue Jun 21 11:00:43 2022 +0200 Commit: Noel Grandin CommitDate: Tue Jun 21 11:58:40 2022 +0200 rename oox::OptValue::has() to has_value as a step towards converting it to std::optional Change-Id: I9b2201c29827fcddae3b46480065c90b2907e6cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136210 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx index 63718ca0ebed..1805e0b24c81 100644 --- a/include/oox/helper/helper.hxx +++ b/include/oox/helper/helper.hxx @@ -178,7 +178,7 @@ public: explicit OptValue( const Type& rValue ) : maValue( rValue ), mbHasValue( true ) {} explicit OptValue( bool bHasValue, const Type& rValue ) : maValue( rValue ), mbHasValue( bHasValue ) {} -bool has() const { return mbHasValue; } +bool has_value() const { return mbHasValue; } bool operator!() const { return !mbHasValue; } bool differsFrom( const Type& rValue ) const { return mbHasValue && (maValue != rValue); } diff --git a/oox/source/drawingml/chart/axisconverter.cxx b/oox/source/drawingml/chart/axisconverter.cxx index a8ccc6cdf164..bb6b278af8ac 100644 --- a/oox/source/drawingml/chart/axisconverter.cxx +++ b/oox/source/drawingml/chart/axisconverter.cxx @@ -55,12 +55,12 @@ namespace { void lclSetValueOrClearAny( Any& orAny, const OptValue< double >& rofValue ) { -if( rofValue.has() ) orAny <<= rofValue.get(); else orAny.clear(); +if( rofValue.has_value() ) orAny <<= rofValue.get(); else orAny.clear(); } bool lclIsLogarithmicScale( const AxisModel& rAxisModel ) { -return rAxisModel.mofLogBase.has() && (2.0 <= rAxisModel.mofLogBase.get()) && (rAxisModel.mofLogBase.get() <= 1000.0); +return rAxisModel.mofLogBase.has_value() && (2.0 <= rAxisModel.mofLogBase.get()) && (rAxisModel.mofLogBase.get() <= 1000.0); } sal_Int32 lclGetApiTimeUnit( sal_Int32 nTimeUnit ) @@ -78,7 +78,7 @@ sal_Int32 lclGetApiTimeUnit( sal_Int32 nTimeUnit ) void lclConvertTimeInterval( Any& orInterval, const OptValue< double >& rofUnit, sal_Int32 nTimeUnit ) { -if( rofUnit.has() && (1.0 <= rofUnit.get()) && (rofUnit.get() <= SAL_MAX_INT32) ) +if( rofUnit.has_value() && (1.0 <= rofUnit.get()) && (rofUnit.get() <= SAL_MAX_INT32) ) orInterval <<= css::chart::TimeInterval( static_cast< sal_Int32 >( rofUnit.get() ),
[Libreoffice-commits] core.git: include/oox oox/source sd/qa
include/oox/export/drawingml.hxx |5 ++- oox/source/export/drawingml.cxx| 53 - oox/source/export/shapes.cxx | 13 sd/qa/unit/data/odp/testZeroIndent.odp |binary sd/qa/unit/export-tests-ooxml3.cxx | 38 +++ 5 files changed, 95 insertions(+), 14 deletions(-) New commits: commit 445d4ce232b8e8efaeb2605533fede1b71f52f30 Author: Attila Bakos (NISZ) AuthorDate: Thu May 26 17:04:54 2022 +0200 Commit: László Németh CommitDate: Tue May 31 13:00:38 2022 +0200 tdf#147991 PPTX export: fix bullet indent regression Instead of exporting the inherited master slide indent values of the placeholders, export 0 indent value for removed/disabled bullets to fix interoperability. Regression from commit f57cfddb51b7d7409b7b425dc200aa73406a13bd "tdf#145162 PPTX export: fix extra bullet regression". Change-Id: Icbf823adc07f19fd10d1a60da9cff17616a2aef6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135025 Tested-by: László Németh Reviewed-by: László Németh diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index 294319cf43af..455676e9c262 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -163,6 +163,9 @@ protected: css::uno::Reference m_xParent; bool mbIsBackgroundDark; +/// True when exporting presentation placeholder shape. +bool mbPlaceholder; + bool GetProperty( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, const OUString& aName ); bool GetPropertyAndState( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, const css::uno::Reference< css::beans::XPropertyState >& rXPropState, @@ -210,7 +213,7 @@ protected: public: DrawingML( ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB, DocumentType eDocumentType = DOCUMENT_PPTX, DMLTextExport* pTextExport = nullptr ) -: meDocumentType( eDocumentType ), mpTextExport(pTextExport), mpFS( pFS ), mpFB( pFB ), mbIsBackgroundDark( false ) {} +: meDocumentType( eDocumentType ), mpTextExport(pTextExport), mpFS( pFS ), mpFB( pFB ), mbIsBackgroundDark( false ), mbPlaceholder(false) {} void SetFS( ::sax_fastparser::FSHelperPtr pFS ) { mpFS = pFS; } const ::sax_fastparser::FSHelperPtr& GetFS() const { return mpFS; } ::oox::core::XmlFilterBase* GetFB() { return mpFB; } diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 18e6e2723e89..eea8394aef36 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -122,6 +122,7 @@ #include #include #include +#include #include #include #include @@ -2705,13 +2706,7 @@ static OUString GetAutoNumType(SvxNumType nNumberingType, bool bSDot, bool bPBeh void DrawingML::WriteParagraphNumbering(const Reference< XPropertySet >& rXPropSet, float fFirstCharHeight, sal_Int16 nLevel ) { if (nLevel < 0 || !GetProperty(rXPropSet, "NumberingRules")) -{ -if (GetDocumentType() == DOCUMENT_PPTX) -{ -mpFS->singleElementNS(XML_a, XML_buNone); -} return; -} Reference< XIndexAccess > rXIndexAccess; @@ -3015,6 +3010,32 @@ bool DrawingML::WriteParagraphProperties( const Reference< XTextContent >& rPara if (GetProperty(rXPropSet, "NumberingLevel")) mAny >>= nLevel; +bool bWriteNumbering = true; +bool bForceZeroIndent = false; +if (mbPlaceholder) +{ +Reference< text::XTextRange > xParaText(rParagraph, UNO_QUERY); +if (xParaText) +{ +bool bNumberingOnThisLevel = false; +if (nLevel > -1) +{ +Reference< XIndexAccess > xNumberingRules(rXPropSet->getPropertyValue("NumberingRules"), UNO_QUERY); +const PropertyValues& rNumRuleOfLevel = xNumberingRules->getByIndex(nLevel).get(); +for (const PropertyValue& rRule : rNumRuleOfLevel) +if (rRule.Name == "NumberingType" && rRule.Value.hasValue()) +bNumberingOnThisLevel = rRule.Value.get() != style::NumberingType::NUMBER_NONE; +} + +const bool bIsNumberingVisible = rXPropSet->getPropertyValue("NumberingIsNumber").get(); +const bool bIsLineEmpty = !xParaText->getString().getLength(); + +bWriteNumbering = !bIsLineEmpty && bIsNumberingVisible && (nLevel != -1); +bForceZeroIndent = (!bIsNumberingVisible || bIsLineEmpty || !bNumberingOnThisLevel); +} + +} + sal_Int16 nTmp = sal_Int16(style::ParagraphAdjust_LEFT); if (GetProperty(rXPropSet, "ParaAdjust")) mAny >>= nTmp; @@ -3058,23 +3079,26 @@ bool DrawingML::WriteParagraphProperties( const Reference< XTextContent >& rPara sal_Int32 nLeftMargin =
[Libreoffice-commits] core.git: include/oox oox/source sd/qa
include/oox/drawingml/shape.hxx|6 +++ include/oox/ppt/slidepersist.hxx |4 ++ oox/source/ppt/pptshape.cxx| 23 ++-- oox/source/ppt/presentationfragmenthandler.cxx | 46 + oox/source/ppt/slidepersist.cxx|2 + sd/qa/unit/data/pptx/tdf148965.pptx|binary sd/qa/unit/import-tests.cxx| 37 7 files changed, 100 insertions(+), 18 deletions(-) New commits: commit 855a56fea4561135a63cb729d7a625a950b210e7 Author: Tibor Nagy AuthorDate: Fri May 13 08:12:17 2022 +0200 Commit: László Németh CommitDate: Fri May 27 18:32:38 2022 +0200 tdf#148965 PPTX import: fix internal hyperlinks on shapes Locale dependent code path resulted broken hyperlinks on shapes in a non-English build. Change-Id: I045bbe4246ab5336e2b967bf252b5fbca5b17706 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134266 Tested-by: László Németh Reviewed-by: László Németh diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx index 4318c1e24d2d..e845b399f5f8 100644 --- a/include/oox/drawingml/shape.hxx +++ b/include/oox/drawingml/shape.hxx @@ -140,6 +140,9 @@ public: voidsetConnectorShape(bool bConnector) { mbConnector = bConnector; } boolisConnectorShape() const { return mbConnector; } +voidsetBookmark(bool bBookmark) { mbHasBookmark = bBookmark; } +boolhasBookmark() const { return mbHasBookmark; } + Shape3DProperties& get3DProperties() { return *mp3DPropertiesPtr; } const Shape3DProperties&get3DProperties() const { return *mp3DPropertiesPtr; } @@ -410,6 +413,9 @@ private: // Is this a connector shape? bool mbConnector = false; +// Is shape has bookmark? +bool mbHasBookmark = false; + // temporary space for DiagramHelper in preparation for collecting data // Note: I tried to use a unique_ptr here, but existing constructor func does not allow that svx::diagram::IDiagramHelper* mpDiagramHelper; diff --git a/include/oox/ppt/slidepersist.hxx b/include/oox/ppt/slidepersist.hxx index 1b0a92c70783..4ba48637c66a 100644 --- a/include/oox/ppt/slidepersist.hxx +++ b/include/oox/ppt/slidepersist.hxx @@ -127,6 +127,9 @@ public: void createConnectorShapeConnection(); +void addURLShapeId(const OUString& rShapeId) { maURLShapeId.push_back(rShapeId); } +std::vector& getURLShapeId() { return maURLShapeId; } + private: OUString maPath; OUString maLayoutPath; @@ -160,6 +163,7 @@ private: CommentAuthorList maCommentAuthors; std::vector maConnectorShapeId; +std::vector maURLShapeId; }; } diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx index d83737250550..2ec4a3fbe327 100644 --- a/oox/source/ppt/pptshape.cxx +++ b/oox/source/ppt/pptshape.cxx @@ -613,27 +613,14 @@ void PPTShape::addShape( // so check here if it's a bookmark or a document if (meClickAction == ClickAction_BOOKMARK) { +sal_Int32 nSplitPos; if (!sURL.startsWith("#")) meClickAction = ClickAction_DOCUMENT; -else +else if (-1 != (nSplitPos = sURL.indexOf( ' ' ))) { -sURL = sURL.copy(1); -sal_Int32 nPageNumber = 0; -static const OUStringLiteral sSlide = u"Slide "; -if (sURL.match(sSlide)) -nPageNumber = o3tl::toInt32(sURL.subView(sSlide.getLength())); -Reference xDPS(rFilterBase.getModel(), - uno::UNO_QUERY_THROW); -Reference xDrawPages(xDPS->getDrawPages(), - uno::UNO_SET_THROW); -sal_Int32 nMaxPages = xDrawPages->getCount(); -if (nPageNumber && nPageNumber <= nMaxPages) -{ -Reference xDrawPage; -xDrawPages->getByIndex(nPageNumber - 1) >>= xDrawPage; -Reference xNamed(xDrawPage, UNO_QUERY); -sURL = xNamed->getName(); -} +
[Libreoffice-commits] core.git: include/oox sd/CppunitTest_sd_filter_eppt.mk sd/qa sd/source
include/oox/drawingml/clrscheme.hxx | 10 +++--- sd/CppunitTest_sd_filter_eppt.mk |1 sd/qa/filter/eppt/eppt.cxx | 51 ++- sd/source/filter/eppt/pptx-epptooxml.cxx | 26 +++ 4 files changed, 69 insertions(+), 19 deletions(-) New commits: commit 4a54a24c207f3040390e2fefec41cbbf0edd5eca Author: Miklos Vajna AuthorDate: Tue May 24 20:11:47 2022 +0200 Commit: Miklos Vajna CommitDate: Wed May 25 08:11:51 2022 +0200 tdf#149205 sd theme: fix PPTX export loosing dk1 and lt1 colors Document theme of Impress documents were exported to PPTX only partially: dk1 and lt1 was hardcoded to the SYS_COLOR_SCHEMES define, while the rest was written from master-slide-specific svx::Theme. The benefit of this is that our theme is just a set of colors ( markup in OOXML), while dk1 and lt1 is more dynamic by default in PowerPoint ( in OOXML). The downside is that this way a custom dk1 and lt1 color was lost on export. Fix the problem by switching to markup even for dk1 and lt1: not using the markup doesn't seem to be a problem in practice, or at least much less problematic than rendering with bad colors. If there is a need, dedicated markup support can be still added later by extending svx::ColorSet::maColors to not only store a list of colors, but also some additional properties of those colors. Change-Id: I26df3fd8c891c217df0d36382f6599805198f4bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134883 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/include/oox/drawingml/clrscheme.hxx b/include/oox/drawingml/clrscheme.hxx index 01711fe8bfbd..a4f0b653441a 100644 --- a/include/oox/drawingml/clrscheme.hxx +++ b/include/oox/drawingml/clrscheme.hxx @@ -34,9 +34,9 @@ namespace oox::drawingml { enum PredefinedClrSchemeId { -//dk1, -//lt1, -dk2 = 0, +dk1 = 0, +lt1, +dk2, lt2, accent1, accent2, @@ -51,8 +51,8 @@ enum PredefinedClrSchemeId { static std::map PredefinedClrNames = { -//{ dk1, "dk1" }, -//{ lt1, "lt1" }, +{ dk1, "dk1" }, +{ lt1, "lt1" }, { dk2, "dk2" }, { lt2, "lt2" }, { accent1, "accent1" }, diff --git a/sd/CppunitTest_sd_filter_eppt.mk b/sd/CppunitTest_sd_filter_eppt.mk index 1a58e113643e..72b7b4d4dbb7 100644 --- a/sd/CppunitTest_sd_filter_eppt.mk +++ b/sd/CppunitTest_sd_filter_eppt.mk @@ -13,6 +13,7 @@ $(eval $(call gb_CppunitTest_CppunitTest,sd_filter_eppt)) $(eval $(call gb_CppunitTest_use_externals,sd_filter_eppt,\ boost_headers \ + libxml2 \ )) $(eval $(call gb_CppunitTest_add_exception_objects,sd_filter_eppt, \ diff --git a/sd/qa/filter/eppt/eppt.cxx b/sd/qa/filter/eppt/eppt.cxx index d27713da20b0..1e8e2c7e1491 100644 --- a/sd/qa/filter/eppt/eppt.cxx +++ b/sd/qa/filter/eppt/eppt.cxx @@ -9,20 +9,25 @@ #include #include +#include +#include #include +#include #include #include +#include #include #include +#include using namespace ::com::sun::star; namespace { /// Covers sd/source/filter/eppt/ fixes. -class Test : public test::BootstrapFixture, public unotest::MacrosTest +class Test : public test::BootstrapFixture, public unotest::MacrosTest, public XmlTestTools { private: uno::Reference mxComponent; @@ -30,6 +35,7 @@ private: public: void setUp() override; void tearDown() override; +void registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) override; uno::Reference& getComponent() { return mxComponent; } }; @@ -48,6 +54,11 @@ void Test::tearDown() test::BootstrapFixture::tearDown(); } +void Test::registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) +{ +XmlTestTools::registerOOXMLNamespaces(pXmlXpathCtx); +} + constexpr OUStringLiteral DATA_DIRECTORY = u"/sd/qa/filter/eppt/data/"; CPPUNIT_TEST_FIXTURE(Test, testOOXMLCustomShapeBitmapFill) @@ -76,6 +87,44 @@ CPPUNIT_TEST_FIXTURE(Test, testOOXMLCustomShapeBitmapFill) CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.GraphicObjectShape"), xShape->getShapeType()); } + +CPPUNIT_TEST_FIXTURE(Test, testThemeExport) +{ +// Given a document with a master slide and a theme, lt1 is set to 0x02: +uno::Reference xComponent = loadFromDesktop("private:factory/simpress"); +uno::Reference xDrawPagesSupplier(xComponent, uno::UNO_QUERY); +uno::Reference xDrawPage( +xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY); +uno::Reference xMasterPage(xDrawPage->getMasterPage(), uno::UNO_QUERY); +comphelper::SequenceAsHashMap aMap; +aMap["Name"] <<= OUString("mytheme"); +aMap["ColorSchemeName"] <<= OUString("mycolorscheme"); +uno::Sequence aColorScheme += { 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc }; +aMap["ColorScheme"] <<= aColorScheme; +uno::Any
[Libreoffice-commits] core.git: include/oox oox/qa oox/source
include/oox/drawingml/color.hxx |2 +- oox/qa/unit/data/theme-tint.pptx|binary oox/qa/unit/drawingml.cxx | 32 oox/source/drawingml/color.cxx |2 +- oox/source/drawingml/fillproperties.cxx |2 +- 5 files changed, 35 insertions(+), 3 deletions(-) New commits: commit f932b00f3a72dd802a6e50af84c3dc55072a22a0 Author: Miklos Vajna AuthorDate: Thu May 5 20:18:06 2022 +0200 Commit: Miklos Vajna CommitDate: Fri May 6 08:13:08 2022 +0200 tdf#148929 sd theme: limit PPTX import for shape fill effects to lum mod/off Regression from 30735bdb5a0a81619000fdd24b2d0fbf45687f01 (sd theme: add PPTX import for shape fill color effects, 2022-04-27), the bugdoc's A2 cell lost its tinting (its background color is no longer lighter than A1) after saving back to PPTX + import again. The code assumed that in case a fill color has effects, it can only be luminance offset or modulation, since that's what the PowerPoint UI generates when setting a fill color explicitly. This did not take the table style case into account, which uses tinting to make a color lighter. Fix the problem by not importing the theme index / effects if tinting is used -- the current doc model is limited to theme index + lum mod/off with effects. This limitation can be removed while text color / fill color effects are not limited to lum mod/off, but also support tinting/shading. Change-Id: I382cc0067518cc262e261a462999170cb7db261b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133908 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/include/oox/drawingml/color.hxx b/include/oox/drawingml/color.hxx index cc65c1346720..b28c926986ca 100644 --- a/include/oox/drawingml/color.hxx +++ b/include/oox/drawingml/color.hxx @@ -99,7 +99,7 @@ public: /** Returns the scheme name from the a:schemeClr element for interoperability purposes */ const OUString& getSchemeColorName() const { return msSchemeName; } sal_Int16 getSchemeColorIndex() const; -sal_Int16 getTintOrShade(); +sal_Int16 getTintOrShade() const; sal_Int16 getLumMod() const; sal_Int16 getLumOff() const; diff --git a/oox/qa/unit/data/theme-tint.pptx b/oox/qa/unit/data/theme-tint.pptx new file mode 100644 index ..23ab7589dea0 Binary files /dev/null and b/oox/qa/unit/data/theme-tint.pptx differ diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx index 9ae434717fb8..4dc066f98039 100644 --- a/oox/qa/unit/drawingml.cxx +++ b/oox/qa/unit/drawingml.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -509,6 +510,37 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testTdf132557_footerCustomShapes) xShapeSlideNum->getShapeType()); } +CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testThemeTint) +{ +// Given a document with a table style, using theme color with tinting in the A2 cell: +OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "theme-tint.pptx"; + +// When loading that document: +load(aURL); + +// Then make sure that we only import theming info to the doc model if the effects are limited +// to lum mod / off that we can handle (i.e. no tint/shade): +uno::Reference xDrawPagesSupplier(getComponent(), uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); +uno::Reference xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); +uno::Reference xTable; +CPPUNIT_ASSERT(xShape->getPropertyValue("Model") >>= xTable); +uno::Reference xA1(xTable->getCellByPosition(0, 0), uno::UNO_QUERY); +sal_Int16 nFillColorTheme{}; +CPPUNIT_ASSERT(xA1->getPropertyValue("FillColorTheme") >>= nFillColorTheme); +// This is OK, no problematic effects: +CPPUNIT_ASSERT_EQUAL(static_cast(4), nFillColorTheme); +uno::Reference xA2(xTable->getCellByPosition(0, 1), uno::UNO_QUERY); +CPPUNIT_ASSERT(xA2->getPropertyValue("FillColorTheme") >>= nFillColorTheme); +// Without the accompanying fix in place, this test would have failed with: +// - Expected: -1 +// - Actual : 4 +// i.e. we remembered the theme index, without being able to remember the tint effect, leading +// to a bad background color. +CPPUNIT_ASSERT_EQUAL(static_cast(-1), nFillColorTheme); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx index 982b77ff4831..f810deecf2bf 100644 --- a/oox/source/drawingml/color.cxx +++ b/oox/source/drawingml/color.cxx @@ -479,7 +479,7 @@ void Color::clearTransparence() mnAlpha = MAX_PERCENT; } -sal_Int16 Color::getTintOrShade() +sal_Int16
[Libreoffice-commits] core.git: include/oox oox/source
include/oox/vml/vmlformatting.hxx| 12 ++-- oox/source/vml/vmlformatting.cxx | 97 ++- oox/source/vml/vmlshape.cxx | 24 oox/source/vml/vmlshapecontext.cxx | 66 +++ oox/source/vml/vmltextboxcontext.cxx | 24 5 files changed, 113 insertions(+), 110 deletions(-) New commits: commit 9bb83eefc1a1dda5c48efc5d09ef4a6840bf8b58 Author: Noel Grandin AuthorDate: Tue May 3 16:30:20 2022 +0200 Commit: Noel Grandin CommitDate: Wed May 4 14:09:46 2022 +0200 use more string_view in oox::vml::ConversionHelper Change-Id: I8616f608ee4cc62114acb4fbd774796bc11d1911 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133812 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/oox/vml/vmlformatting.hxx b/include/oox/vml/vmlformatting.hxx index 29d726a2bdba..3f7bbe60a457 100644 --- a/include/oox/vml/vmlformatting.hxx +++ b/include/oox/vml/vmlformatting.hxx @@ -57,7 +57,7 @@ namespace ConversionHelper /** Returns two values contained in rValue separated by cSep. */ OOX_DLLPUBLIC bool separatePair( -OUString& orValue1, OUString& orValue2, +std::u16string_view& orValue1, std::u16string_view& orValue2, std::u16string_view rValue, sal_Unicode cSep ); /** Returns the boolean value from the passed string of a VML attribute. @@ -75,7 +75,7 @@ namespace ConversionHelper the value will be divided by 65536. */ OOX_DLLPUBLIC double decodePercent( -const OUString& rValue, +std::u16string_view rValue, double fDefValue ); /** Converts the passed VML rotation value to degrees. @@ -88,7 +88,7 @@ namespace ConversionHelper point value will be returned unmodified. If the 'fd' suffix is present, the value will be divided by 65536. */ -OOX_DLLPUBLIC Degree100 decodeRotation( const OUString& rValue ); +OOX_DLLPUBLIC Degree100 decodeRotation( std::u16string_view rValue ); /** Converts the passed VML measure string to EMU (English Metric Units). @@ -110,7 +110,7 @@ namespace ConversionHelper */ OOX_DLLPUBLIC sal_Int64decodeMeasureToEmu( const GraphicHelper& rGraphicHelper, -const OUString& rValue, +std::u16string_view rValue, sal_Int32 nRefValue, bool bPixelX, bool bDefaultAsPixel ); @@ -125,7 +125,7 @@ namespace ConversionHelper */ OOX_DLLPUBLIC sal_Int32decodeMeasureToHmm( const GraphicHelper& rGraphicHelper, -const OUString& rValue, +std::u16string_view rValue, sal_Int32 nRefValue, bool bPixelX, bool bDefaultAsPixel ); @@ -139,7 +139,7 @@ namespace ConversionHelper @param bDefaultAsPixel See above. */ OOX_DLLPUBLIC sal_Int32 decodeMeasureToTwip(const GraphicHelper& rGraphicHelper, -const OUString& rValue, sal_Int32 nRefValue, +std::u16string_view rValue, sal_Int32 nRefValue, bool bPixelX, bool bDefaultAsPixel); /** Converts VML color attributes to a DrawingML color. diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index 241991dac3c8..80e38c2b318b 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -65,17 +65,19 @@ using ::com::sun::star::drawing::PolygonFlags_CONTROL; namespace { -bool lclExtractDouble( double& orfValue, sal_Int32& ornEndPos, std::u16string_view aValue ) +bool lclExtractDouble( double& orfValue, size_t& ornEndPos, std::u16string_view aValue ) { // extract the double value and find start position of unit characters rtl_math_ConversionStatus eConvStatus = rtl_math_ConversionStatus_Ok; -orfValue = ::rtl::math::stringToDouble( aValue, '.', '\0', , ); +sal_Int32 nEndPos; +orfValue = ::rtl::math::stringToDouble( aValue, '.', '\0', , ); +ornEndPos = nEndPos; return eConvStatus == rtl_math_ConversionStatus_Ok; } } // namespace -bool ConversionHelper::separatePair( OUString& orValue1, OUString& orValue2, +bool ConversionHelper::separatePair( std::u16string_view& orValue1, std::u16string_view& orValue2, std::u16string_view rValue, sal_Unicode cSep ) { size_t nSepPos = rValue.find( cSep ); @@ -88,7 +90,7 @@ bool ConversionHelper::separatePair( OUString& orValue1, OUString& orValue2, { orValue1 = o3tl::trim(rValue); } -return
[Libreoffice-commits] core.git: include/oox oox/source
include/oox/drawingml/shapepropertymap.hxx |2 include/oox/helper/propertyset.hxx |2 oox/source/core/xmlfilterbase.cxx |2 oox/source/docprop/docprophandler.cxx | 56 oox/source/drawingml/chart/chartspaceconverter.cxx |4 oox/source/drawingml/chart/objectformatter.cxx |4 oox/source/drawingml/chart/seriesconverter.cxx | 12 - oox/source/drawingml/chart/titleconverter.cxx |2 oox/source/drawingml/diagram/diagram.cxx |2 oox/source/drawingml/shape.cxx | 96 +++ oox/source/drawingml/textcharacterproperties.cxx |2 oox/source/drawingml/textfield.cxx |8 - oox/source/drawingml/textparagraphproperties.cxx |2 oox/source/drawingml/theme.cxx |2 oox/source/export/ColorPropertySet.cxx |6 oox/source/export/chartexport.cxx |4 oox/source/export/drawingml.cxx|2 oox/source/helper/grabbagstack.cxx |6 oox/source/helper/propertymap.cxx | 20 +-- oox/source/ppt/animationspersist.cxx |2 oox/source/ppt/conditioncontext.cxx|2 oox/source/ppt/pptimport.cxx |4 oox/source/ppt/presentationfragmenthandler.cxx |4 oox/source/ppt/timenode.cxx|4 oox/source/ppt/timenodelistcontext.cxx | 12 - oox/source/shape/WpsContext.cxx| 19 +- oox/source/vml/vmldrawing.cxx | 12 - oox/source/vml/vmlformatting.cxx |6 oox/source/vml/vmlshape.cxx| 134 ++--- oox/source/vml/vmltextbox.cxx |6 30 files changed, 219 insertions(+), 220 deletions(-) New commits: commit adf7d6efed63c3b92a473553039645a37253f3ac Author: Stephan Bergmann AuthorDate: Wed May 4 07:04:48 2022 +0200 Commit: Stephan Bergmann CommitDate: Wed May 4 09:06:13 2022 +0200 Just use Any ctor instead of makeAny in oox Change-Id: Id6c8341b545c819521056926ef1b80d20d148c5f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133795 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/include/oox/drawingml/shapepropertymap.hxx b/include/oox/drawingml/shapepropertymap.hxx index a9e4ea405273..11670c02edf4 100644 --- a/include/oox/drawingml/shapepropertymap.hxx +++ b/include/oox/drawingml/shapepropertymap.hxx @@ -128,7 +128,7 @@ public: } bool setProperty(ShapeProperty ePropId, const ::Color& rValue) { -return setAnyProperty(ePropId, css::uno::makeAny(rValue)); +return setAnyProperty(ePropId, css::uno::Any(rValue)); } using PropertyMap::setAnyProperty; diff --git a/include/oox/helper/propertyset.hxx b/include/oox/helper/propertyset.hxx index f729a29fb17b..676ec4cebf82 100644 --- a/include/oox/helper/propertyset.hxx +++ b/include/oox/helper/propertyset.hxx @@ -108,7 +108,7 @@ public: bool setProperty( sal_Int32 nPropId, const Type& rValue ) { return setAnyProperty( nPropId, css::uno::Any( rValue ) ); } bool setProperty( sal_Int32 nPropId, ::Color rValue ) -{ return setAnyProperty( nPropId, css::uno::makeAny( rValue ) ); } +{ return setAnyProperty( nPropId, css::uno::Any( rValue ) ); } /** Puts the passed properties into the property set. Tries to use the XMultiPropertySet interface. @param rPropNames The property names. MUST be ordered alphabetically. diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index 73e6d90e1649..e8e1a138984b 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -1224,7 +1224,7 @@ void XmlFilterBase::exportCustomFragments() { const OUString aType = comphelper::OFOPXMLHelper::GetContentTypeByName(aContentTypes, aFilename); const OUString aContentType = (aType.getLength() ? aType : OUString("application/octet-stream")); -xProps->setPropertyValue("MediaType", uno::makeAny(aContentType)); +xProps->setPropertyValue("MediaType", uno::Any(aContentType)); } } } diff --git a/oox/source/docprop/docprophandler.cxx b/oox/source/docprop/docprophandler.cxx index c2609a8227d8..9a23991a47c9 100644 --- a/oox/source/docprop/docprophandler.cxx +++ b/oox/source/docprop/docprophandler.cxx @@ -373,7 +373,7 @@ void SAL_CALL OOXMLDocPropHandler::endFastElement( ::sal_Int32 ) // the property has string type, so it is valid // even with an empty value - characters() has // not been called in that case -
[Libreoffice-commits] core.git: include/oox oox/source
include/oox/ole/olehelper.hxx |6 +++--- oox/source/drawingml/hyperlinkcontext.cxx |4 ++-- oox/source/dump/oledumper.cxx |9 + oox/source/export/drawingml.cxx |4 ++-- oox/source/ole/olehelper.cxx |6 ++ oox/source/ole/vbamodule.cxx |4 ++-- oox/source/vml/vmlformatting.cxx | 12 ++-- 7 files changed, 22 insertions(+), 23 deletions(-) New commits: commit 38d4b6eb42246c0dbd4958a50ed8437bc93508d6 Author: Noel Grandin AuthorDate: Fri Apr 29 10:29:11 2022 +0200 Commit: Noel Grandin CommitDate: Fri Apr 29 12:35:47 2022 +0200 use more string_view in oox found by examining uses of OUString::copy() for likely places Change-Id: I23c397b0438e67e0fdbc1fb4ffa6882aa5e2bf91 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133591 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/oox/ole/olehelper.hxx b/include/oox/ole/olehelper.hxx index f15642760f3d..e01e6025723a 100644 --- a/include/oox/ole/olehelper.hxx +++ b/include/oox/ole/olehelper.hxx @@ -146,11 +146,11 @@ public: OleFormCtrlExportHelper( const css::uno::Reference< css::uno::XComponentContext >& rxCtx, const css::uno::Reference< css::frame::XModel >& xDocModel, const css::uno::Reference< css::awt::XControlModel >& xModel ); ~OleFormCtrlExportHelper(); -OUString getGUID() const +std::u16string_view getGUID() const { -OUString sResult; +std::u16string_view sResult; if ( maGUID.getLength() > 2 ) -sResult = maGUID.copy(1, maGUID.getLength() - 2 ); +sResult = maGUID.subView(1, maGUID.getLength() - 2 ); return sResult; } const OUString& getFullName() const { return maFullName; } diff --git a/oox/source/drawingml/hyperlinkcontext.cxx b/oox/source/drawingml/hyperlinkcontext.cxx index 7bb6930eca13..352eb7bf5efa 100644 --- a/oox/source/drawingml/hyperlinkcontext.cxx +++ b/oox/source/drawingml/hyperlinkcontext.cxx @@ -91,8 +91,8 @@ HyperLinkContext::HyperLinkContext( ContextHandler2Helper const & rParent, static const OUStringLiteral sJump( u"jump=" ); if ( aPPAct.match( sJump, nIndex + 1 ) ) { -OUString aDestination( aPPAct.copy( nIndex + 1 + sJump.getLength() ) ); -sURL += "#action?jump=" + aDestination; +std::u16string_view aDestination( aPPAct.subView( nIndex + 1 + sJump.getLength() ) ); +sURL += OUString::Concat("#action?jump=") + aDestination; } } else if ( aPPAction.match( "hlinksldjump" ) ) diff --git a/oox/source/dump/oledumper.cxx b/oox/source/dump/oledumper.cxx index 036c12a5670e..92e67c04590f 100644 --- a/oox/source/dump/oledumper.cxx +++ b/oox/source/dump/oledumper.cxx @@ -24,6 +24,7 @@ #include #include +#include #include #ifdef DBG_UTIL @@ -1830,10 +1831,10 @@ bool VbaContainerStorageObject::isFormStorage( const OUString& rStrgPath ) const { if( (rStrgPath.getLength() >= 3) && (rStrgPath[ 0 ] == 'i') ) { -OUString aId = rStrgPath.copy( 1 ); -if( (aId.getLength() == 2) && (aId[ 0 ] == '0') ) -aId = aId.copy( 1 ); -sal_Int32 nId = aId.toInt32(); +std::u16string_view aId = rStrgPath.subView( 1 ); +if( (aId.size() == 2) && (aId[ 0 ] == '0') ) +aId = aId.substr( 1 ); +sal_Int32 nId = o3tl::toInt32(aId); if( (nId > 0) && (std::u16string_view(OUString::number( nId )) == aId) ) for (auto const& siteInfo : maFormData.maSiteInfos) if( siteInfo.mnId == nId ) diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 609528cd33bf..bbeea30af4e5 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -2389,9 +2389,9 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool else { sal_Int32 nIndex = sURL.indexOf('='); -OUString aDestination(sURL.copy(nIndex + 1)); +std::u16string_view aDestination(sURL.subView(nIndex + 1)); mpFS->singleElementNS(XML_a, XML_hlinkClick, FSNS(XML_r, XML_id), "", XML_action, - "ppaction://hlinkshowjump?jump=" + aDestination); + OUString::Concat("ppaction://hlinkshowjump?jump=") + aDestination); } } } diff --git a/oox/source/ole/olehelper.cxx b/oox/source/ole/olehelper.cxx index 16b38919a213..41ab34febea3 100644 --- a/oox/source/ole/olehelper.cxx +++ b/oox/source/ole/olehelper.cxx @@ -525,8 +525,7 @@ bool MSConvertOCXControls::WriteOCXExcelKludgeStream( const css::uno::Reference< return false; rName = exportHelper.getTypeName(); SvGlobalName aName; -OUString sId =
[Libreoffice-commits] core.git: include/oox oox/source svx/qa
include/oox/drawingml/color.hxx |4 ++-- oox/source/drawingml/color.cxx |4 ++-- oox/source/drawingml/fillproperties.cxx |6 ++ oox/source/token/properties.txt |2 ++ svx/qa/unit/styles.cxx | 21 +++-- 5 files changed, 27 insertions(+), 10 deletions(-) New commits: commit 30735bdb5a0a81619000fdd24b2d0fbf45687f01 Author: Miklos Vajna AuthorDate: Wed Apr 27 20:12:52 2022 +0200 Commit: Miklos Vajna CommitDate: Thu Apr 28 08:15:54 2022 +0200 sd theme: add PPTX import for shape fill color effects This is always direct formatting, so FillProperties::pushToPropMap() always has the needed info at hand. Change-Id: I3317b618e0e8bb7688d0f0fbfe4546e2e8b4e947 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133525 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/include/oox/drawingml/color.hxx b/include/oox/drawingml/color.hxx index c0dd8d67a31c..cc65c1346720 100644 --- a/include/oox/drawingml/color.hxx +++ b/include/oox/drawingml/color.hxx @@ -100,8 +100,8 @@ public: const OUString& getSchemeColorName() const { return msSchemeName; } sal_Int16 getSchemeColorIndex() const; sal_Int16 getTintOrShade(); -sal_Int16 getLumMod(); -sal_Int16 getLumOff(); +sal_Int16 getLumMod() const; +sal_Int16 getLumOff() const; /** Returns the unaltered list of transformations for interoperability purposes */ const css::uno::Sequence< css::beans::PropertyValue >& getTransformations() const { return maInteropTransformations;} diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx index ee854a761fa2..982b77ff4831 100644 --- a/oox/source/drawingml/color.cxx +++ b/oox/source/drawingml/color.cxx @@ -496,7 +496,7 @@ sal_Int16 Color::getTintOrShade() return 0; } -sal_Int16 Color::getLumMod() +sal_Int16 Color::getLumMod() const { for (const auto& rTransform : maTransforms) { @@ -512,7 +512,7 @@ sal_Int16 Color::getLumMod() return 1; } -sal_Int16 Color::getLumOff() +sal_Int16 Color::getLumOff() const { for (const auto& rTransform : maTransforms) { diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index a6d5250f..2d85bf807e1a 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -397,6 +397,12 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap, { rPropMap.setProperty(PROP_FillColorTheme, nPhClrTheme); } +else +{ +rPropMap.setProperty(PROP_FillColorTheme, maFillColor.getSchemeColorIndex()); +rPropMap.setProperty(PROP_FillColorLumMod, maFillColor.getLumMod()); +rPropMap.setProperty(PROP_FillColorLumOff, maFillColor.getLumOff()); +} eFillStyle = FillStyle_SOLID; } diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index e318e0038ecb..8467d3683875 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -177,6 +177,8 @@ FillBitmapSizeY FillBitmap FillColor FillColorTheme +FillColorLumMod +FillColorLumOff FillGradient FillGradientName FillHatch diff --git a/svx/qa/unit/styles.cxx b/svx/qa/unit/styles.cxx index ce9a039ce453..dd27e24f02ae 100644 --- a/svx/qa/unit/styles.cxx +++ b/svx/qa/unit/styles.cxx @@ -94,17 +94,26 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeChange) // Blue. CPPUNIT_ASSERT_EQUAL(static_cast(0x4472c4), GetShapeFillColor(xShape4)); // The theme index of this filled shape is set by the PPTX import: -sal_Int32 nColorTheme = -1; +sal_Int16 nColorTheme = -1; xShape4->getPropertyValue("FillColorTheme") >>= nColorTheme; // 4 means accent1, this was -1 without the PPTX import bit in place. -CPPUNIT_ASSERT_EQUAL(static_cast(4), nColorTheme); +CPPUNIT_ASSERT_EQUAL(static_cast(4), nColorTheme); uno::Reference xShape5(xDrawPageShapes->getByIndex(5), uno::UNO_QUERY); // Blue, lighter. CPPUNIT_ASSERT_EQUAL(static_cast(0xb4c7e7), GetShapeFillColor(xShape5)); -// Set theme index to accent 1 & effects till PPTX import is missing. -xShape5->setPropertyValue("FillColorTheme", uno::makeAny(static_cast(4))); -xShape5->setPropertyValue("FillColorLumMod", uno::makeAny(static_cast(4000))); -xShape5->setPropertyValue("FillColorLumOff", uno::makeAny(static_cast(6000))); +// The theme index, and effects (lum mod, lum off) are set by the PPTX import: +nColorTheme = -1; +xShape5->getPropertyValue("FillColorTheme") >>= nColorTheme; +// 4 means accent1, this was -1 without the PPTX import bit in place. +CPPUNIT_ASSERT_EQUAL(static_cast(4), nColorTheme); +sal_Int16 nColorLumMod = 1; +
[Libreoffice-commits] core.git: include/oox oox/qa oox/source
include/oox/export/drawingml.hxx|6 - oox/qa/unit/data/tdf148784_StretchCommandQ.odp |binary oox/qa/unit/data/tdf148784_StretchCommandVW.odp |binary oox/qa/unit/data/tdf148784_StretchXY.odp|binary oox/qa/unit/export.cxx | 113 oox/source/export/drawingml.cxx | 108 +++--- 6 files changed, 188 insertions(+), 39 deletions(-) New commits: commit 0818a3dcaf6d7962d043829d42a3bb9d998393d4 Author: Regina Henschel AuthorDate: Tue Apr 26 23:48:21 2022 +0200 Commit: Regina Henschel CommitDate: Wed Apr 27 14:12:29 2022 +0200 tdf#148784 consider StretchX in OOXML export The export to custGeom uses currently a static version of the shape. Its vertices are calculated with EnhancedCustomShape2d::GetParameter(). That has parameters to determine whether ReplaceGeoWidth and ReplaceGeoHeight has to be used. It needs to be used, in case the shape has property StretchX or StretchY. That was missing. It is added now in cases where GetParameter() returns a coordinate. Not all cases are covered by unit tests. Further files for manual testing are attached to the bug. Change-Id: Idcdd081f855ed6c4e3a84dba08f8a2148ddfe54c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133463 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index 43aba83b6531..294319cf43af 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -199,12 +199,14 @@ protected: void WriteGlowEffect(const css::uno::Reference& rXPropSet); void WriteSoftEdgeEffect(const css::uno::Reference& rXPropSet); void WriteCustomGeometryPoint(const css::drawing::EnhancedCustomShapeParameterPair& rParamPair, - const EnhancedCustomShape2d& rCustomShape2d); + const EnhancedCustomShape2d& rCustomShape2d, + const bool bReplaceGeoWidth, const bool bReplaceGeoHeight); bool WriteCustomGeometrySegment( const sal_Int16 eCommand, const sal_Int32 nCount, const css::uno::Sequence& rPairs, sal_Int32& rnPairIndex, double& rfCurrentX, double& rfCurrentY, bool& rbCurrentValid, -const EnhancedCustomShape2d& rCustomShape2d); +const EnhancedCustomShape2d& rCustomShape2d, +const bool bReplaceGeoWidth, const bool bReplaceGeoHeight); public: DrawingML( ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB, DocumentType eDocumentType = DOCUMENT_PPTX, DMLTextExport* pTextExport = nullptr ) diff --git a/oox/qa/unit/data/tdf148784_StretchCommandQ.odp b/oox/qa/unit/data/tdf148784_StretchCommandQ.odp new file mode 100644 index ..3da092b2c598 Binary files /dev/null and b/oox/qa/unit/data/tdf148784_StretchCommandQ.odp differ diff --git a/oox/qa/unit/data/tdf148784_StretchCommandVW.odp b/oox/qa/unit/data/tdf148784_StretchCommandVW.odp new file mode 100644 index ..bf1054a20581 Binary files /dev/null and b/oox/qa/unit/data/tdf148784_StretchCommandVW.odp differ diff --git a/oox/qa/unit/data/tdf148784_StretchXY.odp b/oox/qa/unit/data/tdf148784_StretchXY.odp new file mode 100644 index ..f9df40570e89 Binary files /dev/null and b/oox/qa/unit/data/tdf148784_StretchXY.odp differ diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index 7a1bda7cb5bd..4c6c013dcb81 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -652,6 +652,119 @@ CPPUNIT_TEST_FIXTURE(Test, testFaultyPathCommandsAWT) assertXPath(pXmlDoc, "//p:spTree/p:sp[3]/p:spPr/a:custGeom/a:pathLst/a:path/a:moveTo"); assertXPath(pXmlDoc, "//p:spTree/p:sp[4]/p:spPr/a:custGeom/a:pathLst/a:path/a:moveTo"); } + +CPPUNIT_TEST_FIXTURE(Test, testTdf148784StretchXY) +{ +// The document has a custom shapes of type "non-primitive" to trigger the custGeom export. +// They use formulas with 'right' and 'bottom'. +// When saving to PPTX the attributes stretchpoint-x and stretchpoint-y were not considered. The +// line at right and bottom edge were positioned inside as if the shape had a square size. +OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf148784_StretchXY.odp"; +loadAndSave(aURL, "Impress Office Open XML"); + +// Verify the markup. +std::unique_ptr pStream = parseExportStream(getTempFile(), "ppt/slides/slide1.xml"); +xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); + +// x-position of last segment should be same as path width. It was 21600 without fix. +sal_Int32 nWidth += getXPathContent(pXmlDoc, "//p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/@w") + .toInt32(); +sal_Int32 nPosX += getXPathContent( + pXmlDoc,
[Libreoffice-commits] core.git: include/oox oox/source sw/source
include/oox/export/drawingml.hxx |8 -- include/oox/export/vmlexport.hxx |4 - oox/source/export/drawingml.cxx | 35 +- oox/source/export/vmlexport.cxx | 20 -- sw/source/filter/ww8/docxattributeoutput.cxx | 87 --- sw/source/filter/ww8/docxattributeoutput.hxx | 13 sw/source/filter/ww8/docxexport.cxx |2 7 files changed, 13 insertions(+), 156 deletions(-) New commits: commit cf2dc247ff5f726238856e9b46a4926a30430e14 Author: Tünde Tóth AuthorDate: Mon Apr 4 11:49:59 2022 +0200 Commit: László Németh CommitDate: Tue Apr 26 18:07:40 2022 +0200 DOCX export: image deduplication and clean up Follow-up to commit aea8043bc5f5187498fa450505d6de9d6986e2a6 "tdf#74670 tdf#91286 PPTX XLSX export: save image once". This reverts commit 797fef38612fb2fd62d1f6591619b9361e526bca "tdf#118535 DOCX export: save header image once" and commit 32ada80a9f47b095d7b0c4d16e3422f6ef7f2ac2 "DOCX export: make sure a graphic is only written once" and commit b484e9814c66d8d51cea974390963a6944bc9d73 "tdf#83227 oox: reuse RelId in DML/VML export for the same graphic". Change-Id: I2d90249808174290b6b3e4eb957b3ac87ad41f95 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132506 Tested-by: László Németh Reviewed-by: László Németh diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index 9a7f744520c8..43aba83b6531 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -130,12 +130,6 @@ public: virtual void WriteOutliner(const OutlinerParaObject& rParaObj) = 0; /// Write the contents of the textbox that is associated to this shape. virtual void WriteTextBox(css::uno::Reference xShape) = 0; -/// Look up the RelId of a graphic based on its checksum. -virtual OUString FindRelId(BitmapChecksum nChecksum) = 0; -/// Look up the filename of a graphic based on its checksum. -virtual OUString FindFileName(BitmapChecksum nChecksum) = 0; -/// Store the RelId and filename of a graphic based on its checksum. -virtual void CacheRelId(BitmapChecksum nChecksum, const OUString& rRelId, const OUString& rFileName) = 0; /// Get textbox which belongs to the shape. virtual css::uno::Reference GetUnoTextFrame( css::uno::Reference xShape) = 0; @@ -224,7 +218,7 @@ public: void SetBackgroundDark(bool bIsDark) { mbIsBackgroundDark = bIsDark; } /// If bRelPathToMedia is true add "../" to image folder path while adding the image relationship -OUString WriteImage( const Graphic , bool bRelPathToMedia = false, OUString* pFileName = nullptr ); +OUString WriteImage( const Graphic , bool bRelPathToMedia = false ); void WriteColor( ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT ); void WriteColor( const OUString& sColorSchemeName, const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT ); diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx index 5efdb34a90ff..fa54f27aa250 100644 --- a/include/oox/export/vmlexport.hxx +++ b/include/oox/export/vmlexport.hxx @@ -65,10 +65,6 @@ public: virtual oox::drawingml::DrawingML& GetDrawingML() = 0; /// Write the contents of the textbox that is associated to this shape in VML format. virtual void WriteVMLTextBox(css::uno::Reference xShape) = 0; -/// Look up the RelId of a graphic based on its checksum. -virtual OUString FindRelId(BitmapChecksum nChecksum) = 0; -/// Store the RelId and filename of a graphic based on its checksum. -virtual void CacheRelId(BitmapChecksum nChecksum, const OUString& rRelId, const OUString& rFileName) = 0; protected: VMLTextExport() {} virtual ~VMLTextExport() {} diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 78eac3d00f60..87ca05452513 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1271,7 +1271,7 @@ const char* DrawingML::GetRelationCompPrefix() const return "unknown"; } -OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia, OUString* pFileName ) +OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia ) { GfxLink aLink = rGraphic.GetGfxLink (); BitmapChecksum aChecksum = rGraphic.GetChecksum(); @@ -1280,8 +1280,8 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia, OUString sRelId; OUString sPath; -// tdf#74670 tdf#91286 Save image only once (this is no problem for DOCX) -if (GetDocumentType() != DOCUMENT_DOCX && !maExportGraphics.empty()) +// tdf#74670 tdf#91286 Save image only once +if (!maExportGraphics.empty()) { auto aIterator = maExportGraphics.top().find(aChecksum); if (aIterator !=
[Libreoffice-commits] core.git: include/oox include/svx oox/source svx/source
include/oox/drawingml/shape.hxx |6 include/svx/diagram/datamodel.hxx | 46 ++- include/svx/svdogrp.hxx | 30 ++ oox/source/drawingml/diagram/datamodel.cxx | 278 +++- oox/source/drawingml/diagram/datamodel.hxx | 10 oox/source/drawingml/diagram/datamodelcontext.cxx |2 oox/source/drawingml/diagram/diagram.cxx| 41 -- oox/source/drawingml/diagram/diagram.hxx|4 oox/source/drawingml/diagram/diagramhelper.cxx | 17 - oox/source/drawingml/diagram/diagramhelper.hxx |2 oox/source/drawingml/diagram/layoutatomvisitors.cxx |4 oox/source/drawingml/shape.cxx |3 svx/source/diagram/datamodel.cxx| 179 svx/source/svdraw/svdogrp.cxx |8 14 files changed, 383 insertions(+), 247 deletions(-) New commits: commit d9b3374b13108cf6b847f6eb92fb666194a68770 Author: Armin Le Grand (Allotropia) AuthorDate: Tue Apr 19 11:37:57 2022 +0200 Commit: Armin Le Grand CommitDate: Wed Apr 20 09:32:52 2022 +0200 Advanced Diagram support: Use better association Model<->XShape To have a more direct and more reliable association between the XShape/oox::Shape and the model data svx::diagram::Point I added optional usage of the Model-UUID for that at the oox::Shape. Also added a 'fake' UUID to work with the BackgroundShape's attributes. Changed all preserve/rescue code to work based on that. Also cleanups/comments and preparations of some flags in the Diagram ModelData to steer behaviour on re-ceration. Change-Id: Ie30effdff34dcdbbc79a766de09157b2a3bd97d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133168 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx index a16e65a71ef1..3d0ee6ebaec8 100644 --- a/include/oox/drawingml/shape.hxx +++ b/include/oox/drawingml/shape.hxx @@ -118,6 +118,9 @@ public: OUString& getServiceName(){ return msServiceName; } voidsetServiceName( const char* pServiceName ); +const OUString& getDiagramDataModelID() const { return msDiagramDataModelID; } +void setDiagramDataModelID( const OUString& rDiagramDataModelID ) { msDiagramDataModelID = rDiagramDataModelID; } + PropertyMap&getShapeProperties(){ return maShapeProperties; } LineProperties& getLineProperties() { return *mpLinePropertiesPtr; } @@ -408,6 +411,9 @@ private: // temporary space for DiagramHelper in preparation for collecting data // Note: I tried to use a unique_ptr here, but existing constructor func does not allow that IDiagramHelper* mpDiagramHelper; + +// association-ID to identify the Diagram ModelData +OUString msDiagramDataModelID; }; } diff --git a/include/svx/diagram/datamodel.hxx b/include/svx/diagram/datamodel.hxx index 686835ee378f..7a080f8703ee 100644 --- a/include/svx/diagram/datamodel.hxx +++ b/include/svx/diagram/datamodel.hxx @@ -28,7 +28,6 @@ #include #include -#include #include #include @@ -73,9 +72,7 @@ typedef std::vector< Connection > Connections; /** Text and properties for a point * For proof of concept to make TextData available in svx level this * is in a first run pretty simple, but may need to be extended accordingly - * up to similar data as in oox::drawingml::TextBody. Pls have a look at - * secureDataFromShapeToModelAfterDiagramImport() resp. - * restoreDataFromModelToShapeAfterReCreation() on it's usage/purpose + * up to similar data as in oox::drawingml::TextBody. */ struct SVXCORE_DLLPUBLIC TextBody { @@ -104,7 +101,13 @@ struct SVXCORE_DLLPUBLIC Point { Point(); +// The minimal text data from the imported Diagram +// in source format TextBodyPtr msTextBody; + +// The property sequence of pairs, +// interpreted & assigned by the ::addShape(s) creators in the +// import filter that created a XShape associated/based on this entry PointStylePtr msPointStylePtr; OUString msCnxId; @@ -147,9 +150,6 @@ struct SVXCORE_DLLPUBLIC Point bool mbCustomVerticalFlip; bool mbCustomText; bool mbIsPlaceholder; - -void securePropertiesFromXShape(const css::uno::Reference< css::drawing::XShape >& rXShape); -void restorePropertiesToXShape(const css::uno::Reference< css::drawing::XShape >& rXShape) const; }; typedef std::vector< Point >Points; @@ -183,6 +183,10 @@ public: // creates temporary processing data from model data virtual void buildDiagramDataModel(bool bClearOoxShapes); +// dump to readable format +virtual void dump() const = 0; + +// read accesses Connections& getConnections() { return maConnections; } Points&
[Libreoffice-commits] core.git: include/oox oox/source
include/oox/dump/dumperbase.hxx |2 - oox/source/core/relations.cxx |9 +-- oox/source/crypto/AgileEngine.cxx | 43 -- oox/source/dump/dumperbase.cxx| 12 +- oox/source/dump/pptxdumper.cxx|2 - 5 files changed, 37 insertions(+), 31 deletions(-) New commits: commit 250a70dc37a921b71049817d5e46aae2eb4cced6 Author: Noel Grandin AuthorDate: Wed Apr 13 21:04:09 2022 +0200 Commit: Noel Grandin CommitDate: Thu Apr 14 11:25:07 2022 +0200 use more string_view in oox Change-Id: I25fe1cbfae43bb533e7dfc2561d0b70976aa6a40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132985 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/oox/dump/dumperbase.hxx b/include/oox/dump/dumperbase.hxx index 9ce382ece7b9..10d3ed78ac2f 100644 --- a/include/oox/dump/dumperbase.hxx +++ b/include/oox/dump/dumperbase.hxx @@ -103,7 +103,7 @@ public: static OUString convertFileNameToUrl( const OUString& rFileName ); static sal_Int32getFileNamePos( std::u16string_view rFileUrl ); -static OUString getFileNameExtension( const OUString& rFileUrl ); +static std::u16string_view getFileNameExtension( std::u16string_view rFileUrl ); // input streams -- diff --git a/oox/source/core/relations.cxx b/oox/source/core/relations.cxx index 9b29f20a1124..f927c542c89e 100644 --- a/oox/source/core/relations.cxx +++ b/oox/source/core/relations.cxx @@ -28,9 +28,12 @@ namespace oox::core { namespace { -OUString lclRemoveFileName( const OUString& rPath ) +std::u16string_view lclRemoveFileName( std::u16string_view rPath ) { -return rPath.copy( 0, ::std::max< sal_Int32 >( rPath.lastIndexOf( '/' ), 0 ) ); +size_t idx = rPath.rfind( '/' ); +if (idx == std::u16string_view::npos) +return std::u16string_view(); +return rPath.substr( 0, idx ); } OUString lclAppendFileName( std::u16string_view rPath, const OUString& rFileName ) @@ -108,7 +111,7 @@ OUString Relations::getFragmentPathFromRelation( const Relation& rRelation ) con return rRelation.maTarget; // resolve relative target path according to base path -OUString aPath = lclRemoveFileName( maFragmentPath ); +OUString aPath( lclRemoveFileName( maFragmentPath ) ); sal_Int32 nStartPos = 0; while( nStartPos < rRelation.maTarget.getLength() ) { diff --git a/oox/source/crypto/AgileEngine.cxx b/oox/source/crypto/AgileEngine.cxx index 0fd655ced63c..09748e9dfd7b 100644 --- a/oox/source/crypto/AgileEngine.cxx +++ b/oox/source/crypto/AgileEngine.cxx @@ -44,9 +44,12 @@ namespace oox::crypto { namespace { -OUString stripNamespacePrefix(OUString const & rsInputName) +std::u16string_view stripNamespacePrefix(std::u16string_view rsInputName) { -return rsInputName.copy(rsInputName.indexOf(":") + 1); +size_t idx = rsInputName.find(':'); +if (idx == std::u16string_view::npos) +return rsInputName; +return rsInputName.substr(idx + 1); } class AgileTokenHandler : public sax_fastparser::FastTokenHandlerBase @@ -85,79 +88,79 @@ public: void SAL_CALL startUnknownElement( const OUString& /*aNamespace*/, const OUString& rName, const Reference< XFastAttributeList >& aAttributeList ) override { -const OUString& rLocalName = stripNamespacePrefix(rName); +std::u16string_view rLocalName = stripNamespacePrefix(rName); const css::uno::Sequence aUnknownAttributes = aAttributeList->getUnknownAttributes(); for (const Attribute& rAttribute : aUnknownAttributes) { -const OUString& rAttrLocalName = stripNamespacePrefix(rAttribute.Name); +std::u16string_view rAttrLocalName = stripNamespacePrefix(rAttribute.Name); -if (rAttrLocalName == "spinCount") +if (rAttrLocalName == u"spinCount") { ::sax::Converter::convertNumber(mInfo.spinCount, rAttribute.Value); } -else if (rAttrLocalName == "saltSize") +else if (rAttrLocalName == u"saltSize") { ::sax::Converter::convertNumber(mInfo.saltSize, rAttribute.Value); } -else if (rAttrLocalName == "blockSize") +else if (rAttrLocalName == u"blockSize") { ::sax::Converter::convertNumber(mInfo.blockSize, rAttribute.Value); } -else if (rAttrLocalName == "keyBits") +else if (rAttrLocalName == u"keyBits") { ::sax::Converter::convertNumber(mInfo.keyBits, rAttribute.Value); } -else if (rAttrLocalName == "hashSize") +else if (rAttrLocalName == u"hashSize") { ::sax::Converter::convertNumber(mInfo.hashSize, rAttribute.Value); } -else if (rAttrLocalName == "cipherAlgorithm")
[Libreoffice-commits] core.git: include/oox include/svx oox/source
include/oox/shape/ShapeFilterBase.hxx |2 - include/svx/diagram/datamodel.hxx | 11 +++ oox/source/drawingml/diagram/diagram.cxx |6 oox/source/drawingml/diagram/diagramhelper.cxx | 35 - oox/source/drawingml/diagram/diagramhelper.hxx |7 +++-- oox/source/shape/ShapeFilterBase.cxx | 23 6 files changed, 56 insertions(+), 28 deletions(-) New commits: commit 027db2df5371183136f87e84ec4829d59eef209b Author: Armin Le Grand (Allotropia) AuthorDate: Fri Apr 8 17:38:12 2022 +0200 Commit: Armin Le Grand CommitDate: Mon Apr 11 09:54:33 2022 +0200 Advanced Diagram support: Make Style/Theme info available The Style/Theme information is central for re-creating the Diagram shape representation. Make that data available in the ModelData classes in svx. With that information, a re- creation with all needed attributes is possible, e.g. when the model gets changed (remove/add data entries). Also some cleanups done. Change-Id: Icd925c9731891092f1ddd96c8feb165e1f846f4f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132738 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/include/oox/shape/ShapeFilterBase.hxx b/include/oox/shape/ShapeFilterBase.hxx index 200bc92ee492..477060fa6e48 100644 --- a/include/oox/shape/ShapeFilterBase.hxx +++ b/include/oox/shape/ShapeFilterBase.hxx @@ -70,8 +70,6 @@ public: ::Color getSchemeColor( sal_Int32 nToken ) const; -void importTheme(); - void setGraphicMapper(css::uno::Reference const & rxGraphicMapper) { mxGraphicMapper = rxGraphicMapper; diff --git a/include/svx/diagram/datamodel.hxx b/include/svx/diagram/datamodel.hxx index 3df7cc2e8afd..c42a3d26a115 100644 --- a/include/svx/diagram/datamodel.hxx +++ b/include/svx/diagram/datamodel.hxx @@ -30,6 +30,7 @@ #include #include +#include namespace svx::diagram { @@ -183,6 +184,9 @@ public: OUString addNode(const OUString& rText); bool removeNode(const OUString& rNodeId); +const css::uno::Reference< css::xml::dom::XDocument >& getThemeDocument() const { return mxThemeDocument; } +void setThemeDocument( const css::uno::Reference< css::xml::dom::XDocument >& xRef ) { mxThemeDocument = xRef; } + protected: void getChildrenString(OUStringBuffer& rBuf, const Point* pPoint, sal_Int32 nLevel) const; void addConnection(TypeConstant nType, const OUString& sSourceId, const OUString& sDestId); @@ -194,8 +198,15 @@ protected: // See evtl. parts in oox::drawingml::DiagramData that may need t obe accessed // - logic connections/associations // - data point entries +// - Theme definition as css::xml::dom::XDocument +//Note: I decided to use dom::XDocument which is already in use, instead of a +// temp file what is also possible (implemented that for POC) but would +// need to be created in PresentationFragmentHandler::importSlide. If +// this needs to be written to a File, please refer to +// fileDocxExport::WriteTheme(), look for "OOXTheme" Connections maConnections; Points maPoints; +css::uno::Reference< css::xml::dom::XDocument > mxThemeDocument; // temporary processing data, deleted when using build() PointNameMap maPointNameMap; diff --git a/oox/source/drawingml/diagram/diagram.cxx b/oox/source/drawingml/diagram/diagram.cxx index d12deea33d2f..484e7af9fd13 100644 --- a/oox/source/drawingml/diagram/diagram.cxx +++ b/oox/source/drawingml/diagram/diagram.cxx @@ -416,6 +416,12 @@ void loadDiagram( ShapePtr const & pShape, pDiagram->addTo(pShape); pShape->setDiagramDoms(pDiagram->getDomsAsPropertyValues()); +// Get the oox::Theme definition and - if available - move/secure the +// original ImportData directly to the Diagram ModelData +std::shared_ptr<::oox::drawingml::Theme> aTheme(rFilter.getCurrentThemePtr()); +if(aTheme) +pData->setThemeDocument(aTheme->getFragment()); //getTempFile()); + // Prepare support for the advanced DiagramHelper using Diagram & Theme data pShape->prepareDiagramHelper(pDiagram, rFilter.getCurrentThemePtr()); } diff --git a/oox/source/drawingml/diagram/diagramhelper.cxx b/oox/source/drawingml/diagram/diagramhelper.cxx index 4ed76e5bff1c..cc6efd9ba50e 100644 --- a/oox/source/drawingml/diagram/diagramhelper.cxx +++ b/oox/source/drawingml/diagram/diagramhelper.cxx @@ -26,6 +26,8 @@ #include #include #include +#include +#include using namespace ::com::sun::star; @@ -101,7 +103,7 @@ void AdvancedDiagramHelper::reLayout(SdrObjGroup& rTarget) // set oox::Theme at Filter. All LineStyle/FillStyle/Colors/Attributes // will be taken from there -xFilter->setCurrentTheme(mpThemePtr); +xFilter->setCurrentTheme(getOrCreateThemePtr(xFilter)); css::uno::Reference<
[Libreoffice-commits] core.git: include/oox include/svx oox/source svx/source
include/oox/helper/propertymap.hxx |3 include/svx/diagram/datamodel.hxx | 31 +- oox/source/drawingml/diagram/datamodel.cxx | 395 - oox/source/drawingml/diagram/datamodel.hxx | 12 oox/source/drawingml/diagram/diagram.cxx |2 oox/source/helper/propertymap.cxx | 16 + svx/source/diagram/datamodel.cxx | 322 +++ 7 files changed, 427 insertions(+), 354 deletions(-) New commits: commit c79fa460fe6220051bbda2d3c0cb67fbf765e2ac Author: Armin Le Grand (Allotropia) AuthorDate: Mon Apr 4 16:57:08 2022 +0200 Commit: Armin Le Grand CommitDate: Tue Apr 5 14:20:46 2022 +0200 Advanced Diagram support: Move Diagram Text information to svx In a next step to get the Diagram mechanism/ModelData independent from oox, I moved the Text ModelData to svx, using a TextBody struct. This is a 1st move that covers most of what the algorithms to handle Diagram re-layout and other functionality use. This will potentially have to be extended accordingly when missing data is detected. It is potentially much more simple as the oox TextBody, by purpose. Due to functionality using that data I could now massively move more of it to svx. Change-Id: I6d6e6c572f119aeefa4e91eff56f58f3ceb6a31e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132523 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/include/oox/helper/propertymap.hxx b/include/oox/helper/propertymap.hxx index 3e48c9817fd1..423bb11fcdcb 100644 --- a/include/oox/helper/propertymap.hxx +++ b/include/oox/helper/propertymap.hxx @@ -56,6 +56,9 @@ public: /** Returns the name of the passed property identifier. */ static const OUString& getPropertyName( sal_Int32 nPropId ); +/** Returns the property identifier of the passed name. */ +static sal_Int32 getPropertyId( std::u16string_view sPropName ); + /** Returns true, if the map contains a property with the passed identifier. */ boolhasProperty( sal_Int32 nPropId ) const; diff --git a/include/svx/diagram/datamodel.hxx b/include/svx/diagram/datamodel.hxx index d76b5c25b163..a07962497b13 100644 --- a/include/svx/diagram/datamodel.hxx +++ b/include/svx/diagram/datamodel.hxx @@ -28,6 +28,9 @@ #include #include +#include +#include + namespace svx::diagram { enum SVXCORE_DLLPUBLIC TypeConstant { @@ -66,12 +69,32 @@ struct SVXCORE_DLLPUBLIC Connection typedef std::vector< Connection > Connections; +/** Text and properies for a point + * For proof of concept to make TextData available in svx level this + * is in a first run pretty simple, but may need to be extended accodingly + * up to similar data as in oox::drawingml::TextBody. Pls have a look at + * secureDataFromShapeToModelAfterDiagramImport() resp. + * restoreDataFromModelToShapeAfterReCreation() on it's usage/purpose + */ +struct SVXCORE_DLLPUBLIC TextBody +{ +// text from 1st paragraph (1st run) +OUString msText; + +// attributes from TextBody::getTextProperties() +css::uno::Sequence< css::beans::PropertyValue > maTextProps; +}; + +typedef std::shared_ptr< TextBody > TextBodyPtr; + /** A point */ struct SVXCORE_DLLPUBLIC Point { Point(); +TextBodyPtr msTextBody; + OUString msCnxId; OUString msModelId; OUString msColorTransformCategoryId; @@ -143,7 +166,7 @@ public: virtual ~DiagramData(); // creates temporary processing data from model data -virtual void build(bool bClearOoxShapes) = 0; +virtual void buildDiagramDataModel(bool bClearOoxShapes); Connections& getConnections() { return maConnections; } Points& getPoints() { return maPoints; } @@ -156,12 +179,12 @@ public: virtual void dump() const = 0; OUString getString() const; -virtual std::vector> getChildren(const OUString& rParentId) const = 0; -virtual OUString addNode(const OUString& rText) = 0; +std::vector> getChildren(const OUString& rParentId) const; +OUString addNode(const OUString& rText); bool removeNode(const OUString& rNodeId); protected: -virtual void getChildrenString(OUStringBuffer& rBuf, const Point* pPoint, sal_Int32 nLevel) const = 0; +void getChildrenString(OUStringBuffer& rBuf, const Point* pPoint, sal_Int32 nLevel) const; void addConnection(TypeConstant nType, const OUString& sSourceId, const OUString& sDestId); // evtl. existing alternative imported visualization identifier diff --git a/oox/source/drawingml/diagram/datamodel.cxx b/oox/source/drawingml/diagram/datamodel.cxx index 9bd8318c8fe1..30d7e2bb5f40 100644 --- a/oox/source/drawingml/diagram/datamodel.cxx +++ b/oox/source/drawingml/diagram/datamodel.cxx @@ -18,6 +18,7 @@ */ #include "datamodel.hxx" + #include #include #include @@ -25,10 +26,8 @@ #include #include #include -#include #include -#include using namespace
[Libreoffice-commits] core.git: include/oox include/sal include/svx oox/source svx/source
include/oox/drawingml/diagram/diagram.hxx |3 include/sal/log-areas.dox |1 include/svx/diagram/datamodel.hxx | 71 +++ oox/source/drawingml/diagram/datamodel.cxx | 87 - oox/source/drawingml/diagram/datamodel.hxx | 71 ++- oox/source/drawingml/diagram/datamodelcontext.cxx | 12 - oox/source/drawingml/diagram/datamodelcontext.hxx |4 oox/source/drawingml/diagram/diagram.cxx|2 oox/source/drawingml/diagram/diagram.hxx| 18 +- oox/source/drawingml/diagram/diagramfragmenthandler.cxx |2 oox/source/drawingml/diagram/diagramfragmenthandler.hxx |4 svx/source/diagram/datamodel.cxx| 101 +++- 12 files changed, 212 insertions(+), 164 deletions(-) New commits: commit ca6d879f765dad8471d42ec736b1f4235e5b8da4 Author: Armin Le Grand (Allotropia) AuthorDate: Wed Mar 30 11:48:08 2022 +0200 Commit: Armin Le Grand CommitDate: Thu Mar 31 15:29:28 2022 +0200 Advanced Diagram support: Move class DiagramData to svx AFAP Splitted and moved parts of DiagramData class to svx as peparation to access from there. Done as pure virtual class so that no incarnations will be possible, also made the constructor protected. The derived class in oox hosts all functionality/data which involves usage/modification of oox::Shape class. That way we get closer to get the Diagram DataModel isloated/seperated. Not-yet moved is the String/Text holding data, it's still in oox. Moving that one will be next, that will allow to migrate quite some more functionalty to svx. Change-Id: I389dbf3ebf6171b8175cf30be7bbc8c20d9a38e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132303 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/include/oox/drawingml/diagram/diagram.hxx b/include/oox/drawingml/diagram/diagram.hxx index fa200dd1662a..b3e79d46197c 100644 --- a/include/oox/drawingml/diagram/diagram.hxx +++ b/include/oox/drawingml/diagram/diagram.hxx @@ -30,9 +30,6 @@ namespace oox::drawingml { -class DiagramData; -typedef std::shared_ptr DiagramDataPtr; - /** load diagram data, and put resulting graphic into shape This method loads the diagram data fragments from the given paths, diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox index b4f90e7e50d3..b00d1c1c8236 100644 --- a/include/sal/log-areas.dox +++ b/include/sal/log-areas.dox @@ -391,6 +391,7 @@ certain functionality. @li @c svx @li @c svx.chaining +@li @c svx.diagram - Diagram ModelData @li @c svx.dialog @li @c svx.fmcomp @li @c svx.form diff --git a/include/svx/diagram/datamodel.hxx b/include/svx/diagram/datamodel.hxx index 9f47e30f8ef9..d76b5c25b163 100644 --- a/include/svx/diagram/datamodel.hxx +++ b/include/svx/diagram/datamodel.hxx @@ -22,13 +22,15 @@ #include #include +#include #include #include +#include namespace svx::diagram { -enum TypeConstant { +enum SVXCORE_DLLPUBLIC TypeConstant { XML_none = 0, XML_type = 395, XML_asst = 680, @@ -114,6 +116,73 @@ struct SVXCORE_DLLPUBLIC Point typedef std::vector< Point >Points; +/** The collected Diagram ModelData + */ +class SVXCORE_DLLPUBLIC DiagramData +{ +public: +typedef std::map< OUString, Point* > PointNameMap; +typedef std::map< OUString, std::vector< Point* > > PointsNameMap; +typedef std::map< OUString, const Connection* > ConnectionNameMap; + +struct SourceIdAndDepth +{ +OUString msSourceId; +sal_Int32 mnDepth = 0; +}; + +/// Tracks connections: destination id -> {destination order, details} map. +typedef std::map< OUString, std::map > StringMap; + +protected: +// Make constructor protected to signal that this anyways pure virual class +// shall not be incarnated - target to use is oox::drawingml::DiagramData +DiagramData(); + +public: +virtual ~DiagramData(); + +// creates temporary processing data from model data +virtual void build(bool bClearOoxShapes) = 0; + +Connections& getConnections() { return maConnections; } +Points& getPoints() { return maPoints; } +StringMap& getPresOfNameMap() { return maPresOfNameMap; } +PointNameMap& getPointNameMap() { return maPointNameMap; } +PointsNameMap& getPointsPresNameMap() { return maPointsPresNameMap; } +::std::vector& getExtDrawings() { return maExtDrawings; } +const Point* getRootPoint() const; + +virtual void dump() const = 0; + +OUString getString() const; +virtual std::vector> getChildren(const OUString& rParentId) const = 0; +virtual OUString addNode(const OUString& rText) = 0; +bool removeNode(const OUString& rNodeId); + +protected: +virtual void getChildrenString(OUStringBuffer& rBuf, const Point* pPoint, sal_Int32 nLevel) const = 0; +void
[Libreoffice-commits] core.git: 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 | 26 +++ sd/source/filter/eppt/pptx-epptooxml.cxx |2 8 files changed, 182 insertions(+), 91 deletions(-) New commits: commit aea8043bc5f5187498fa450505d6de9d6986e2a6 Author: Tünde Tóth AuthorDate: Tue Mar 22 09:47:57 2022 +0100 Commit: László Németh CommitDate: Wed Mar 30 18:24:45 2022 +0200 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 diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index fb125dd647ad..9a7f744520c8 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 @@ -150,6 +153,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; @@ -342,9 +346,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 a790a643abc0..a99a0474a458 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -111,7 +111,6 @@ #include #include #include -#include #include #include #include @@ -237,6 +236,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) { @@ -275,6 +275,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 @@ -1264,113 +1274,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 = aIterator->second; +} -// #i15508# added BMP type for better exports -// export not yet active, so adding for reference (not checked) -case GfxLinkType::NativeBmp: -
[Libreoffice-commits] core.git: include/oox oox/source
include/oox/export/drawingml.hxx |5 oox/source/export/drawingml.cxx | 650 ++- 2 files changed, 309 insertions(+), 346 deletions(-) New commits: commit 365a3ed39083389f40612dec765d7b8e0dc2377b Author: Regina Henschel AuthorDate: Tue Mar 29 16:23:46 2022 +0200 Commit: Miklos Vajna CommitDate: Wed Mar 30 09:30:08 2022 +0200 Extract 'switch' block out of WriteCustomGeometry This is a follow up to commit 2029b2f6dd0109c5892e5ac5640022b31fe42fd2. That commit has increased the line count of WriteCustomGeometry to more than 500. This patch splits it to a main part of about 230 lines and a new method for the previous 'switch' block of about 300 lines. That makes the loops in the main part better readable. Change-Id: Ied4378f54e7c8dc7965a5b1db15baf0b35f63f59 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132274 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index b507a0e41b60..fb125dd647ad 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -202,6 +202,11 @@ protected: void WriteSoftEdgeEffect(const css::uno::Reference& rXPropSet); void WriteCustomGeometryPoint(const css::drawing::EnhancedCustomShapeParameterPair& rParamPair, const EnhancedCustomShape2d& rCustomShape2d); +bool WriteCustomGeometrySegment( +const sal_Int16 eCommand, const sal_Int32 nCount, +const css::uno::Sequence& rPairs, +sal_Int32& rnPairIndex, double& rfCurrentX, double& rfCurrentY, bool& rbCurrentValid, +const EnhancedCustomShape2d& rCustomShape2d); public: DrawingML( ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB, DocumentType eDocumentType = DOCUMENT_PPTX, DMLTextExport* pTextExport = nullptr ) diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index ff092b44641c..a790a643abc0 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -4038,352 +4038,9 @@ bool DrawingML::WriteCustomGeometry( } for (sal_Int32 k = 0; k < rSegment.Count && bOK; ++k) { -switch (rSegment.Command) -{ -case MOVETO: -{ -if (nPairIndex >= aPairs.getLength()) -bOK = false; -else -{ -mpFS->startElementNS(XML_a, XML_moveTo); -WriteCustomGeometryPoint(aPairs[nPairIndex], aCustomShape2d); -mpFS->endElementNS(XML_a, XML_moveTo); -aCustomShape2d.GetParameter(fCurrentX, aPairs[nPairIndex].First, false, -false); -aCustomShape2d.GetParameter(fCurrentY, aPairs[nPairIndex].Second, false, -false); -bCurrentValid = true; -nPairIndex++; -} -break; -} -case LINETO: -{ -if (nPairIndex >= aPairs.getLength()) -bOK = false; -else -{ -mpFS->startElementNS(XML_a, XML_lnTo); -WriteCustomGeometryPoint(aPairs[nPairIndex], aCustomShape2d); -mpFS->endElementNS(XML_a, XML_lnTo); -aCustomShape2d.GetParameter(fCurrentX, aPairs[nPairIndex].First, false, -false); -aCustomShape2d.GetParameter(fCurrentY, aPairs[nPairIndex].Second, false, -false); -bCurrentValid = true; -nPairIndex++; -} -break; -} -case CURVETO: -{ -if (nPairIndex + 2 >= aPairs.getLength()) -bOK = false; -else -{ -mpFS->startElementNS(XML_a, XML_cubicBezTo); -for (sal_uInt8 l = 0; l <= 2; ++l) -{ -WriteCustomGeometryPoint(aPairs[nPairIndex + l], aCustomShape2d); -} -mpFS->endElementNS(XML_a, XML_cubicBezTo); -aCustomShape2d.GetParameter(fCurrentX, aPairs[nPairIndex + 2].First, -
[Libreoffice-commits] core.git: include/oox oox/inc oox/source sc/source sd/qa
include/oox/drawingml/connectorshapecontext.hxx | 15 include/oox/drawingml/shape.hxx | 11 include/oox/ppt/slidepersist.hxx|4 oox/inc/drawingml/customshapeproperties.hxx |1 oox/source/drawingml/chart/chartdrawingfragment.cxx |3 oox/source/drawingml/connectorshapecontext.cxx | 84 - oox/source/drawingml/customshapeproperties.cxx | 36 -- oox/source/drawingml/shape.cxx | 37 ++ oox/source/drawingml/shapegroupcontext.cxx |3 oox/source/drawingml/shapepropertiescontext.cxx |8 oox/source/export/shapes.cxx|3 oox/source/ppt/pptshapegroupcontext.cxx |6 oox/source/ppt/slidepersist.cxx | 70 oox/source/shape/LockedCanvasContext.cxx|7 sc/source/filter/oox/drawingfragment.cxx|3 sd/qa/unit/data/pptx/tdf89449.pptx |binary sd/qa/unit/data/xml/fdo47434_0.xml | 188 sd/qa/unit/data/xml/tdf100491_0.xml | 304 +--- sd/qa/unit/export-tests-ooxml2.cxx |8 sd/qa/unit/import-tests.cxx | 39 ++ 20 files changed, 288 insertions(+), 542 deletions(-) New commits: commit cbf66ec3e60d07efb7c3cceed9b4f0fb4f0510c8 Author: Tibor Nagy AuthorDate: Thu Mar 10 08:42:12 2022 +0100 Commit: László Németh CommitDate: Tue Mar 29 16:12:45 2022 +0200 tdf#89449 PPTX import: fix line connectors Line connectors were imported as plain shapes, losing their functionality during editing, i.e. keeping connections of boxes and other shapes. Change-Id: I0f1562be2dbcce0e45eb209c6ca4e035731039e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131303 Tested-by: László Németh Reviewed-by: László Németh diff --git a/include/oox/drawingml/connectorshapecontext.hxx b/include/oox/drawingml/connectorshapecontext.hxx index 1efdd2e40611..c9819ae85137 100644 --- a/include/oox/drawingml/connectorshapecontext.hxx +++ b/include/oox/drawingml/connectorshapecontext.hxx @@ -25,16 +25,29 @@ #include #include #include +#include namespace oox { class AttributeList; } namespace oox::core { class ContextHandler2Helper; } namespace oox::drawingml { +struct ConnectorShapeProperties +{ +bool mbStartShape; +OUString maDestShapeId; +sal_Int32 mnDestGlueId; +}; + class OOX_DLLPUBLIC ConnectorShapeContext final : public ShapeContext { +std::vector& mrConnectorShapePropertiesList; +ShapePtr mpConnectorShapePtr; + public: -ConnectorShapeContext( ::oox::core::ContextHandler2Helper const & rParent, const ShapePtr& pMasterShapePtr, const ShapePtr& pGroupShapePtr ); +ConnectorShapeContext(::oox::core::ContextHandler2Helper const& rParent, + const ShapePtr& pMasterShapePtr, const ShapePtr& pGroupShapePtr, + std::vector& rConnectorShapePropertiesList); virtual ~ConnectorShapeContext() override; virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override; }; diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx index 734e805ccac5..a16e65a71ef1 100644 --- a/include/oox/drawingml/shape.hxx +++ b/include/oox/drawingml/shape.hxx @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -73,6 +74,8 @@ typedef std::shared_ptr< CustomShapeProperties > CustomShapePropertiesPtr; typedef ::std::map< OUString, ShapePtr > ShapeIdMap; +typedef std::vector ConnectorShapePropertiesList; + struct ShapeStyleRef { Color maPhClr; @@ -128,6 +131,10 @@ public: CustomShapePropertiesPtr& getCustomShapeProperties(){ return mpCustomShapePropertiesPtr; } +ConnectorShapePropertiesList& getConnectorShapeProperties() { return maConnectorShapePropertiesList; } +voidsetConnectorShape(bool bConnector) { mbConnector = bConnector; } +boolisConnectorShape() const { return mbConnector; } + Shape3DProperties& get3DProperties() { return *mp3DPropertiesPtr; } const Shape3DProperties&get3DProperties() const { return *mp3DPropertiesPtr; } @@ -332,6 +339,7 @@ protected: PropertyMap maDefaultShapeProperties; TextListStylePtrmpMasterTextListStyle; css::uno::Reference< css::drawing::XShape > mxShape; +ConnectorShapePropertiesList maConnectorShapePropertiesList; OUStringmsServiceName; OUStringmsName; @@ -394,6 +402,9 @@ private: /// The shape fill should be set to that of the slide background surface. bool mbUseBgFill = false; +// Is this a connector shape? +bool mbConnector =
[Libreoffice-commits] core.git: include/oox oox/qa oox/source sd/qa sw/qa sw/source
include/oox/export/drawingml.hxx | 13 oox/qa/unit/data/tdf147978_endsubpath.odp|binary oox/qa/unit/data/tdf147978_enhancedPath_commandA.odp |binary oox/qa/unit/data/tdf147978_enhancedPath_commandHIJK.odp |binary oox/qa/unit/data/tdf147978_enhancedPath_commandT.odp |binary oox/qa/unit/data/tdf147978_enhancedPath_commandXY.odp|binary oox/qa/unit/data/tdf147978_enhancedPath_subpath.pptx |binary oox/qa/unit/export.cxx | 155 + oox/source/export/drawingml.cxx | 919 ++ oox/source/export/shapes.cxx | 31 sd/qa/unit/data/odp/tdf147978_enhancedPath_viewBox.odp |binary sd/qa/unit/data/xml/tdf92001_0.xml | 42 sd/qa/unit/export-tests-ooxml2.cxx | 32 sd/qa/unit/export-tests-ooxml3.cxx | 16 sw/qa/extras/ooxmlexport/data/tdf147978_enhancedPath_commandABVW.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport17.cxx | 16 sw/qa/extras/ooxmlexport/ooxmlexport7.cxx| 24 sw/source/filter/ww8/docxsdrexport.cxx | 20 18 files changed, 861 insertions(+), 407 deletions(-) New commits: commit 2029b2f6dd0109c5892e5ac5640022b31fe42fd2 Author: Regina Henschel AuthorDate: Fri Mar 18 18:31:05 2022 +0100 Commit: Miklos Vajna CommitDate: Fri Mar 25 14:00:23 2022 +0100 tdf#147978 export subpaths individually in custGeom ...and implement export of all missing commands, use existing viewBox if suitable, use one EnhancedCustomShape2d move WriteCustomGeometryPoint to protected, make GetCustomGeometryPointValue local The fix solves tdf#100390 too. Without the fix the entire enhanced-path was exported as one element . The command F was applied to the whole drawing but should affect only the subpath. The implementation is changed so that each subpath gets its own element and command F acts only on its subpath. Support for export of handles and equations is still a long way off. Thus there is no reason to tread shapes with and without handles different. Shapes with handles had used method WritePolyPolygon, but that is not able to handle subpaths. So have desided to use method WriteCustomGeometry for all cases. To get shapes exported regardless of path commands I have added the export for the missing commands. I have removed the no longer used method WritePolyPolygon. The special treatment of shapes "moon" and "mso-spt89" (right up arrow) in export is no longer needed. Related code parts are removed. The unit test testFlipAndRotateCustomShape is adapted. In case the method WriteCustomGeometry fails, the enhanced-path is invalid. In that case an minimal custGeom is written in case of docx. Shapes whose drawing does not touch all edges of the snap rectangle were exported with wrong position and size of the drawing inside the snap rectangle. That is fixed by using an existing ViewBox for the OOXML path size. The old way of creating a path size from point coordinates is only used if the shape has no suitable ViewBox. The point values in unit test SdOOXMLExportTest2::testTdf111798 are adapted to path size 21600 x 21600 and traverse direction of the points is corrected. The resulting shape outline is still the same as before. The expected xml is updated for file tdf92001.odp in SdImportTest::testDocumentLayout. The resulting shape outline is the same, because the shape touches the edges of the snap rectangle. The case, that the shape outline does not touch a edge of the snap rectangle is tested in SdOOXMLExportTest3::testEnhancedPathViewBox. Still missing is the case, that ViewBox has other left,top than 0,0. In that case all coordinates would have to be shifted because the path size in OOXML has only width and height but not left,top. That will not be included in this patch. Change-Id: Ib1736d6a08371f4d98411d2769275f0580cd0030 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131837 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index a128a812483c..b507a0e41b60 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -44,6 +44,7 @@ #include #include #include +#include class Graphic; class SdrObjCustomShape; @@ -199,7 +200,8 @@ protected: void WriteGlowEffect(const css::uno::Reference& rXPropSet); void WriteSoftEdgeEffect(const
[Libreoffice-commits] core.git: include/oox oox/source
include/oox/drawingml/diagram/diagram.hxx |9 --- oox/source/drawingml/diagram/datamodel.cxx | 54 +++- oox/source/drawingml/diagram/datamodel.hxx | 26 +++-- oox/source/drawingml/diagram/datamodelcontext.cxx | 29 ++ oox/source/drawingml/diagram/diagram.cxx| 45 oox/source/drawingml/diagram/diagramhelper.cxx |6 -- oox/source/drawingml/diagram/diagramhelper.hxx |3 - oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 36 +++-- oox/source/drawingml/shape.cxx |5 + 9 files changed, 104 insertions(+), 109 deletions(-) New commits: commit b658fdc33546f925a2a7406f8588a4aad160e4b8 Author: Armin Le Grand (Allotropia) AuthorDate: Thu Mar 24 10:44:18 2022 +0100 Commit: Armin Le Grand CommitDate: Thu Mar 24 16:31:42 2022 +0100 Advanced Diagram support: Continue isolate oox-Shapes As preparations to use the Diagram ModelData further isolate it from the oox-library-only drawingML Shape used for import. It is necessary to completely isolate the Diagram ModelData from the Diagram import mechanism as a preparation to be able to re-create that Shapes on-demand anytime if needed for re-layout(s). Also removed one unused loadDiagram implementation and streamlined the AdvancedDiagramHelper some more. Change-Id: I7a7c55389e0d00f70c02db73ce2c3ff9ce7a5b22 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132058 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/include/oox/drawingml/diagram/diagram.hxx b/include/oox/drawingml/diagram/diagram.hxx index 51d9ae5583db..fa200dd1662a 100644 --- a/include/oox/drawingml/diagram/diagram.hxx +++ b/include/oox/drawingml/diagram/diagram.hxx @@ -47,15 +47,6 @@ void loadDiagram( ShapePtr const & pShape, const OUString& rColorStylePath, const oox::core::Relations& rRelations ); -void loadDiagram(ShapePtr const& pShape, - DiagramDataPtr pDiagramData, - const css::uno::Reference& layoutDom, - const css::uno::Reference& styleDom, - const css::uno::Reference& colorDom, - core::XmlFilterBase& rFilter); - -// OOX_DLLPUBLIC void reloadDiagram(SdrObject* pObj, core::XmlFilterBase& rFilter); - } #endif diff --git a/oox/source/drawingml/diagram/datamodel.cxx b/oox/source/drawingml/diagram/datamodel.cxx index 6185ee7acfb9..c68ee40cd71c 100644 --- a/oox/source/drawingml/diagram/datamodel.cxx +++ b/oox/source/drawingml/diagram/datamodel.cxx @@ -46,16 +46,33 @@ void Connection::dump() const << mnSourceOrder << ", dstOrd " << mnDestOrder); } -void Point::dump() const +void Point::dump(const Shape* pShape) const { SAL_INFO( "oox.drawingml", -"pt text " << mpShape.get() << ", cnxId " << msCnxId << ", modelId " +"pt text " << pShape << ", cnxId " << msCnxId << ", modelId " << msModelId << ", type " << mnType); } } // oox::drawingml::dgm namespace +Shape* DiagramData::getOrCreateAssociatedShape(const dgm::Point& rPoint, bool bCreateOnDemand) const +{ +if(maPointShapeMap.end() == maPointShapeMap.find(rPoint.msModelId)) +{ +const_cast(this)->maPointShapeMap[rPoint.msModelId] = ShapePtr(); +} + +const ShapePtr& rShapePtr = maPointShapeMap.find(rPoint.msModelId)->second; + +if(!rShapePtr && bCreateOnDemand) +{ +const_cast(rShapePtr) = std::make_shared(); +} + +return rShapePtr.get(); +} + DiagramData::DiagramData() : mpFillProperties( std::make_shared() ) { @@ -79,7 +96,7 @@ void DiagramData::dump() const SAL_INFO("oox.drawingml", "Dgm: DiagramData # of pt: " << maPoints.size() ); for (const auto& rPoint : maPoints) -rPoint.dump(); +rPoint.dump(getOrCreateAssociatedShape(rPoint)); } void DiagramData::getChildrenString(OUStringBuffer& rBuf, const dgm::Point* pPoint, sal_Int32 nLevel) const @@ -87,13 +104,18 @@ void DiagramData::getChildrenString(OUStringBuffer& rBuf, const dgm::Point* pPoi if (!pPoint) return; +Shape* pShape(getOrCreateAssociatedShape(*pPoint)); +if(!pShape) +return; + if (nLevel > 0) { for (sal_Int32 i = 0; i < nLevel-1; i++) rBuf.append('\t'); rBuf.append('+'); rBuf.append(' '); -rBuf.append(pPoint->mpShape->getTextBody()->toString()); +if(pShape->getTextBody()) +rBuf.append(pShape->getTextBody()->toString()); rBuf.append('\n'); } @@ -131,9 +153,12 @@ std::vector> DiagramData::getChildren(const OUStri aChildren.resize(rCxn.mnSourceOrder + 1); const auto pChild = maPointNameMap.find(rCxn.msDestId); if (pChild != maPointNameMap.end()) +{ +Shape*
[Libreoffice-commits] core.git: include/oox oox/qa oox/source
include/oox/export/drawingml.hxx |1 oox/qa/unit/data/refer-to-theme-shape-fill.odp |binary oox/qa/unit/export.cxx | 19 oox/source/export/drawingml.cxx| 28 - 4 files changed, 47 insertions(+), 1 deletion(-) New commits: commit 37c41f2c445ecf519f4137c23fb36f3942328b6b Author: Miklos Vajna AuthorDate: Wed Mar 23 20:06:49 2022 +0100 Commit: Miklos Vajna CommitDate: Thu Mar 24 08:36:25 2022 +0100 sd theme: add PPTX export for shape fill color Do this only in case there are no effects on the color, as that is not yet handled. Note that the theme color was already stored in the grab-bag, so this is primarily interesting in case the theme color was changed or the source format was ODP. Change-Id: Ia4995be68d5f243875632eec4aaf8afbb8f4d5cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131984 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index e1aaca0c4386..a128a812483c 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -224,6 +224,7 @@ public: void WriteConnectorConnections( EscherConnectorListEntry& rConnectorEntry, sal_Int32 nStartID, sal_Int32 nEndID ); bool WriteCharColor(const css::uno::Reference& xPropertySet); +bool WriteFillColor(const css::uno::Reference& xPropertySet); void WriteSolidFill( ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT ); void WriteSolidFill( const OUString& sSchemeName, const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT ); diff --git a/oox/qa/unit/data/refer-to-theme-shape-fill.odp b/oox/qa/unit/data/refer-to-theme-shape-fill.odp new file mode 100644 index ..b12772e111e3 Binary files /dev/null and b/oox/qa/unit/data/refer-to-theme-shape-fill.odp differ diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index 8876d507dd9c..56546384820c 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -396,6 +396,25 @@ CPPUNIT_TEST_FIXTURE(Test, testReferToTheme) assertXPath(pXmlDoc, "//p:sp[3]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr/a:lumOff", 0); } +CPPUNIT_TEST_FIXTURE(Test, testReferToThemeShapeFill) +{ +// Given an ODP file that contains references to a theme for shape fill: +OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "refer-to-theme-shape-fill.odp"; + +// When saving that document: +loadAndSave(aURL, "Impress Office Open XML"); + +// Then make sure the shape fill color is a scheme color: +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 1 +// - Actual : 0 +// i.e. the element was not written. Note that this was already working from PPTX +// files via grab-bags, so this test intentionally uses an ODP file as input. +std::unique_ptr pStream = parseExportStream(getTempFile(), "ppt/slides/slide1.xml"); +xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); +assertXPath(pXmlDoc, "//p:sp[1]/p:spPr/a:solidFill/a:schemeClr", "val", "accent1"); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf146690_endParagraphRunPropertiesNewLinesTextSize) { // Given a PPTX file that contains references to a theme: diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 4615bbd39503..85c7a34d5f5f 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -551,7 +551,10 @@ void DrawingML::WriteSolidFill( const Reference< XPropertySet >& rXPropSet ) else if ( nFillColor != nOriginalColor ) { // the user has set a different color for the shape -WriteSolidFill( ::Color(ColorTransparency, nFillColor & 0xff), nAlpha ); +if (aTransformations.hasElements() || !WriteFillColor(rXPropSet)) +{ +WriteSolidFill(::Color(ColorTransparency, nFillColor & 0xff), nAlpha); +} } else if ( !sColorFillScheme.isEmpty() ) { @@ -566,6 +569,29 @@ void DrawingML::WriteSolidFill( const Reference< XPropertySet >& rXPropSet ) } } +bool DrawingML::WriteFillColor(const uno::Reference& xPropertySet) +{ +if (!xPropertySet->getPropertySetInfo()->hasPropertyByName("FillColorTheme")) +{ +return false; +} + +sal_Int32 nFillColorTheme = -1; +xPropertySet->getPropertyValue("FillColorTheme") >>= nFillColorTheme; +if (nFillColorTheme < 0 || nFillColorTheme > 11) +{ +return false; +} + +const char* pColorName = g_aPredefinedClrNames[nFillColorTheme]; + +mpFS->startElementNS(XML_a, XML_solidFill); +mpFS->singleElementNS(XML_a, XML_schemeClr, XML_val, pColorName); +mpFS->endElementNS(XML_a, XML_solidFill); + +return true; +} + void DrawingML::WriteGradientStop(sal_uInt16 nStop, ::Color
[Libreoffice-commits] core.git: include/oox odk/examples oox/source sw/source .vscode/vs-code-template.code-workspace.in
.vscode/vs-code-template.code-workspace.in|2 +- include/oox/drawingml/shape.hxx |2 +- odk/examples/DevelopersGuide/UCB/ResourceManager.java |2 +- oox/source/drawingml/diagram/diagramhelper.cxx|2 +- oox/source/drawingml/diagram/diagramhelper.hxx|4 ++-- oox/source/drawingml/shape.cxx|2 +- sw/source/filter/ww8/ww8scan.cxx |2 +- 7 files changed, 8 insertions(+), 8 deletions(-) New commits: commit 34cd775646a7f21f0d2d40462ae716671bab67c9 Author: Andrea Gelmini AuthorDate: Sun Mar 13 12:41:36 2022 +0100 Commit: Julien Nabet CommitDate: Sun Mar 13 19:17:37 2022 +0100 Fix typos Change-Id: I9f583937da2cf49fc9013d9e36d63fff312ccb92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131495 Reviewed-by: Julien Nabet Tested-by: Jenkins diff --git a/.vscode/vs-code-template.code-workspace.in b/.vscode/vs-code-template.code-workspace.in index 479bff58035e..f6078155e8dc 100644 --- a/.vscode/vs-code-template.code-workspace.in +++ b/.vscode/vs-code-template.code-workspace.in @@ -164,7 +164,7 @@ "MIMode": "lldb", "setupCommands": [ { - "description": "load helpers for for lldb", + "description": "load helpers for lldb", "text": "command script import ${workspaceFolder:srcdir}/solenv/lldb/libreoffice/LO.py", "ignoreFailures": false } diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx index dc2a06a78b56..734e805ccac5 100644 --- a/include/oox/drawingml/shape.hxx +++ b/include/oox/drawingml/shape.hxx @@ -395,7 +395,7 @@ private: bool mbUseBgFill = false; // temporary space for DiagramHelper in preparation for collecting data -// Note: I tried to use a unique_ptr here, but existing constuctor func does not allow that +// Note: I tried to use a unique_ptr here, but existing constructor func does not allow that IDiagramHelper* mpDiagramHelper; }; diff --git a/odk/examples/DevelopersGuide/UCB/ResourceManager.java b/odk/examples/DevelopersGuide/UCB/ResourceManager.java index 6c6b8d6e2a20..61d64c8c0260 100644 --- a/odk/examples/DevelopersGuide/UCB/ResourceManager.java +++ b/odk/examples/DevelopersGuide/UCB/ResourceManager.java @@ -153,7 +153,7 @@ public class ResourceManager { /** * Get transferring Operation. * - *@return StringThat contains the trasfering Operation + *@return StringThat contains the transferring Operation */ public String getTransOperation() { return m_transOperation; diff --git a/oox/source/drawingml/diagram/diagramhelper.cxx b/oox/source/drawingml/diagram/diagramhelper.cxx index f3792b295f7e..b61c6b12994a 100644 --- a/oox/source/drawingml/diagram/diagramhelper.cxx +++ b/oox/source/drawingml/diagram/diagramhelper.cxx @@ -82,7 +82,7 @@ void AdvancedDiagramHelper::reLayout(SdrObjGroup& rTarget) // For re-creation we need to use ::addShape functionality from the // oox import filter since currently Shape import is very tightly // coupled to Shape creation. It converts a oox::Shape representation -// combined with an oox::Theme to incarrnated XShapes representing the +// combined with an oox::Theme to incarnated XShapes representing the // Diagram. // To use that functionality, we have to create a temporary filter // (based on ShapeFilterBase). Problems are that this needs to know diff --git a/oox/source/drawingml/diagram/diagramhelper.hxx b/oox/source/drawingml/diagram/diagramhelper.hxx index 76dffdb88f5a..0c1240bdd4ba 100644 --- a/oox/source/drawingml/diagram/diagramhelper.hxx +++ b/oox/source/drawingml/diagram/diagramhelper.hxx @@ -30,12 +30,12 @@ class Diagram; // Advanced DiagramHelper // -// This helper tries to hold all neccessary data to re-layout +// This helper tries to hold all necessary data to re-layout // all XShapes/SdrObjects of an already imported Diagram. The // Diagram holds the SmarArt model data before it gets layouted, // while Theme holds the oox Fill/Line/Style definitions to // apply. -// Re-Layouting (re-reating) is rather complex, for detailed +// Re-Layouting (re-creating) is rather complex, for detailed // information see ::reLayout implementation. // This helper class may/should be extended to: // - deliver representative data from the Diagram-Model diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 0192ff8aa3de..ac2ff8891add 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -205,7 +205,7 @@ void
[Libreoffice-commits] core.git: include/oox include/svx oox/source sc/source sd/source sw/source
include/oox/drawingml/shape.hxx |6 - include/svx/svdogrp.hxx |2 oox/source/drawingml/diagram/diagram.cxx| 54 +++- oox/source/drawingml/diagram/diagram.hxx| 10 +- oox/source/drawingml/diagram/diagramhelper.cxx | 87 +++- oox/source/drawingml/diagram/diagramhelper.hxx |9 +- oox/source/drawingml/diagram/diagramlayoutatoms.cxx |4 oox/source/drawingml/shape.cxx | 44 -- oox/source/ppt/pptshape.cxx | 21 ++-- sc/source/ui/drawfunc/drawsh5.cxx |2 sd/source/ui/view/drviews3.cxx |2 sw/source/uibase/shells/drwbassh.cxx|2 12 files changed, 110 insertions(+), 133 deletions(-) New commits: commit 9c526b557e264280cb0c9da704245494f5ec5af3 Author: Armin Le Grand (Allotropia) AuthorDate: Fri Mar 4 16:51:07 2022 +0100 Commit: Armin Le Grand CommitDate: Fri Mar 4 22:10:10 2022 +0100 Advanced Diagram support: Allow reLayout without keeping oox::Shape Goal is to minimize dependencies on oox classes. For that pupose I redesigned the Diagram class to work without remembering an oox::Shape at all. For reLayout, a new temporary one is created and used. That was a bit tricky, I needed to find out what data at the oox::Shape is needed to sucessfully do that with the not-originally-imported one. Another necessary change was to move the DiagramFontHeights adapting mechanism away from oox::Shape, too. It fits better to Diagram class. That way it can also be used for reLayout and the oox::Shape gets a little bit smaller, too. This opens the path to move needed Mode-Data Diagam core claasses to other libs where changing/im/exPorting them will be possible. Change-Id: I40bc4b190d2abc797f5c56f9e476d22155d21422 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131004 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx index 6bd875656632..d3fd710954a5 100644 --- a/include/oox/drawingml/shape.hxx +++ b/include/oox/drawingml/shape.hxx @@ -247,8 +247,6 @@ public: void keepDiagramDrawing(::oox::core::XmlFilterBase& rFilterBase, const OUString& rFragmentPath); -oox::core::NamedShapePairs& getDiagramFontHeights() { return maDiagramFontHeights; } - // Allows preparation of a local Diagram helper && propagate an eventually // existing one to the data holder object later void prepareDiagramHelper(const std::shared_ptr< Diagram >& rDiagramPtr, const std::shared_ptr<::oox::drawingml::Theme>& rTheme); @@ -290,7 +288,6 @@ protected: const basegfx::B2DHomMatrix& aTransformation ); voidkeepDiagramCompatibilityInfo(); -void syncDiagramFontHeights(); voidconvertSmartArtToMetafile( ::oox::core::XmlFilterBase const& rFilterBase ); css::uno::Reference< css::drawing::XShape > @@ -397,9 +394,6 @@ private: /// The shape fill should be set to that of the slide background surface. bool mbUseBgFill = false; -/// For SmartArt, this contains groups of shapes: automatic font size is the same in each group. -oox::core::NamedShapePairs maDiagramFontHeights; - // temporary space for DiagramHelper in preparation for collecting data // Note: I tried to use a unique_ptr here, but existing constuctor func does not allow that IDiagramHelper* mpDiagramHelper; diff --git a/include/svx/svdogrp.hxx b/include/svx/svdogrp.hxx index d4ea77746019..176892fdd8ac 100644 --- a/include/svx/svdogrp.hxx +++ b/include/svx/svdogrp.hxx @@ -40,7 +40,7 @@ public: virtual ~IDiagramHelper(); // re-create XShapes -virtual void reLayout() = 0; +virtual void reLayout(SdrObjGroup& rTarget) = 0; // get text representation of data tree virtual OUString getString() const = 0; diff --git a/oox/source/drawingml/diagram/diagram.cxx b/oox/source/drawingml/diagram/diagram.cxx index 6c6578ae4067..481e56adec3c 100644 --- a/oox/source/drawingml/diagram/diagram.cxx +++ b/oox/source/drawingml/diagram/diagram.cxx @@ -137,8 +137,8 @@ void Diagram::addTo( const ShapePtr & pParentShape ) aChildren.insert(aChildren.begin(), pBackground); } -Diagram::Diagram(const ShapePtr& pShape) -: mpShape(pShape) +Diagram::Diagram() +: maDiagramFontHeights() { } @@ -168,9 +168,48 @@ uno::Sequence Diagram::getDomsAsPropertyValues() const return aValue; } -void Diagram::newTargetShape(ShapePtr& pTarget) +using ShapePairs += std::map, css::uno::Reference>; + +void Diagram::syncDiagramFontHeights() { -mpShape = pTarget; +// Each name represents a group of shapes, for which the font height should have the same +// scaling. +for (const auto& rNameAndPairs :
[Libreoffice-commits] core.git: include/oox oox/source
include/oox/drawingml/drawingmltypes.hxx |1 + oox/source/drawingml/diagram/diagram.hxx |4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) New commits: commit 76e11015a877da0eee21bb97b84a0f17bce41760 Author: Caolán McNamara AuthorDate: Wed Feb 23 09:57:59 2022 + Commit: Caolán McNamara CommitDate: Thu Feb 24 10:12:59 2022 +0100 tdf#147609 and ofz#44965 Indirect-leak Change-Id: I2fb89bf68d8df2da1b97942d70c386f62f61c64f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130413 Tested-by: Jenkins Reviewed-by: Armin Le Grand Reviewed-by: Caolán McNamara diff --git a/include/oox/drawingml/drawingmltypes.hxx b/include/oox/drawingml/drawingmltypes.hxx index 7f7aab4ef7d1..5fe86d56439e 100644 --- a/include/oox/drawingml/drawingmltypes.hxx +++ b/include/oox/drawingml/drawingmltypes.hxx @@ -76,6 +76,7 @@ typedef std::shared_ptr< TextListStyle > TextListStylePtr; class Shape; typedef std::shared_ptr< Shape > ShapePtr; +typedef std::weak_ptr< Shape > WeakShapePtr; class Theme; typedef std::shared_ptr< Theme > ThemePtr; diff --git a/oox/source/drawingml/diagram/diagram.hxx b/oox/source/drawingml/diagram/diagram.hxx index 6aad2705f264..f9f2b7d8a05a 100644 --- a/oox/source/drawingml/diagram/diagram.hxx +++ b/oox/source/drawingml/diagram/diagram.hxx @@ -149,10 +149,10 @@ public: void addTo( const ShapePtr & pShape ); css::uno::Sequence getDomsAsPropertyValues() const; -const ShapePtr & getShape() const { return mpShape; } +ShapePtr getShape() const { return mpShape.lock(); } private: -ShapePtr mpShape; +WeakShapePtr mpShape; DiagramDataPtr mpData; DiagramLayoutPtr mpLayout; DiagramQStyleMap maStyles;
[Libreoffice-commits] core.git: include/oox odk/examples qadevOOo/runner sw/qa vcl/win
include/oox/shape/ShapeContextHandler.hxx |2 +- odk/examples/DevelopersGuide/UCB/ResourceManager.java |2 +- qadevOOo/runner/util/SysUtils.java|2 +- sw/qa/core/text/text.cxx |4 ++-- sw/qa/extras/ooxmlimport/ooxmlimport2.cxx |2 +- vcl/win/dtrans/DOTransferable.cxx |2 +- 6 files changed, 7 insertions(+), 7 deletions(-) New commits: commit ff1544883f5daa96a27319a229a7ba94d34e1dda Author: Andrea Gelmini AuthorDate: Wed Feb 9 12:36:49 2022 +0100 Commit: Julien Nabet CommitDate: Wed Feb 9 19:17:29 2022 +0100 Fix typos Change-Id: I82405059d900b6605075bf5756f3f0fb99e9002e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129451 Tested-by: Julien Nabet Reviewed-by: Julien Nabet diff --git a/include/oox/shape/ShapeContextHandler.hxx b/include/oox/shape/ShapeContextHandler.hxx index a245224730ed..d79ae4d17a1f 100644 --- a/include/oox/shape/ShapeContextHandler.hxx +++ b/include/oox/shape/ShapeContextHandler.hxx @@ -118,7 +118,7 @@ private: std::stack mnStartTokenStack; css::awt::Point maPosition; -bool m_bFullWPGSUpport; // Is this DrawingML shape supposed to be proccessed as WPG? +bool m_bFullWPGSUpport; // Is this DrawingML shape supposed to be processed as WPG? drawingml::ShapePtr mpShape; std::shared_ptr< vml::Drawing > mpDrawing; diff --git a/odk/examples/DevelopersGuide/UCB/ResourceManager.java b/odk/examples/DevelopersGuide/UCB/ResourceManager.java index 6eb10d87b992..6c6b8d6e2a20 100644 --- a/odk/examples/DevelopersGuide/UCB/ResourceManager.java +++ b/odk/examples/DevelopersGuide/UCB/ResourceManager.java @@ -151,7 +151,7 @@ public class ResourceManager { } /** - * Get trasfering Operation. + * Get transferring Operation. * *@return StringThat contains the trasfering Operation */ diff --git a/qadevOOo/runner/util/SysUtils.java b/qadevOOo/runner/util/SysUtils.java index e74716f6861c..2b02fd79b5d9 100644 --- a/qadevOOo/runner/util/SysUtils.java +++ b/qadevOOo/runner/util/SysUtils.java @@ -26,7 +26,7 @@ import com.sun.star.datatransfer.*; public class SysUtils { /** - * Tries to obtain text data from cliboard if such one exists. + * Tries to obtain text data from clipboard if such one exists. * The method iterates through all 'text/plain' supported data * flavors and returns the first non-null String value. * diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx index 2ca0609e7eea..caeb70e4a89d 100644 --- a/sw/qa/core/text/text.cxx +++ b/sw/qa/core/text/text.cxx @@ -185,12 +185,12 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testChineseAutoFirstLineIndent) xmlDocUniquePtr pXmlDoc = parseLayoutDump(); -// Get the line width of the first line for the 1st paragrapsh. +// Get the line width of the first line for the 1st paragraph. sal_Int32 nFirstLineWidth = getXPath(pXmlDoc, "//body/txt[1]/SwParaPortion[1]/SwLineLayout[1]/SwLinePortion[1]", "width") .toInt32(); -// Get the line width of the first line for the 2nd paragrapsh. +// Get the line width of the first line for the 2nd paragraph. sal_Int32 nSecondLineWidth = getXPath(pXmlDoc, "//body/txt[2]/SwParaPortion[1]/SwLineLayout[1]/SwLinePortion[1]", "width") diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index f3eb3d4aad34..4b32d6956fa8 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -925,7 +925,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf126426) CPPUNIT_ASSERT_EQUAL(OUString("Some text "), xRun->getString()); } { -// Link and this content was completely missong before +// Link and this content was completely missing before uno::Reference xRun(xRunEnum->nextElement(), uno::UNO_QUERY_THROW); CPPUNIT_ASSERT_EQUAL(OUString("Link"), xRun->getString()); auto aURL = getProperty(xRun, "HyperLinkURL"); diff --git a/vcl/win/dtrans/DOTransferable.cxx b/vcl/win/dtrans/DOTransferable.cxx index 363601d7a0d7..ea048f98f4f5 100644 --- a/vcl/win/dtrans/DOTransferable.cxx +++ b/vcl/win/dtrans/DOTransferable.cxx @@ -336,7 +336,7 @@ void CDOTransferable::initFlavorListFromFormatList(const std::vector for (sal_uInt32 cfFormat : rFormats) { // we use locales only to determine the -// charset if there is text on the cliboard +// charset if there is text on the clipboard // we don't offer this format if (CF_LOCALE == cfFormat) continue;
[Libreoffice-commits] core.git: include/oox wizards/source
include/oox/ole/vbamodule.hxx|2 +- wizards/source/scriptforge/SF_FileSystem.xba |4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) New commits: commit 571be264d9604c3d77036e26812f909655cc0bb2 Author: Andrea Gelmini AuthorDate: Mon Feb 7 12:55:49 2022 +0100 Commit: Andrea Gelmini CommitDate: Wed Feb 9 12:55:48 2022 +0100 Fix typos Change-Id: I50e8988c320c0068f7adf4a3429d7639df0cbcd1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129596 Tested-by: Jenkins Reviewed-by: Andrea Gelmini diff --git a/include/oox/ole/vbamodule.hxx b/include/oox/ole/vbamodule.hxx index 4cbb4a41c948..573552766159 100644 --- a/include/oox/ole/vbamodule.hxx +++ b/include/oox/ole/vbamodule.hxx @@ -43,7 +43,7 @@ namespace oox::ole { /** Stores, which key shortcut maps to which VBA macro method. */ struct VbaMacroKeyAndMethodBinding { -// This describes a key combinaton in "raw" VBA Macro form, that +// This describes a key combination in "raw" VBA Macro form, that // still needs translated to a key event that can be used in // LibreOffice. OUString msApiKey; diff --git a/wizards/source/scriptforge/SF_FileSystem.xba b/wizards/source/scriptforge/SF_FileSystem.xba index 935c559f5c8e..c0b7e8316fe8 100644 --- a/wizards/source/scriptforge/SF_FileSystem.xba +++ b/wizards/source/scriptforge/SF_FileSystem.xba @@ -687,7 +687,7 @@ Finally: Exit Function Catch: GoTo Finally -End Function ScritForge.SF_FileSystem.ExtensionFolder +End Function ScriptForge.SF_FileSystem.ExtensionFolder REM - Public Function FileExists(Optional ByVal FileName As Variant) As Boolean @@ -2125,4 +2125,4 @@ Dim sFolder As String Folder End Function ScriptForge.SF_FileSystem._SFInstallFolder REM END OF SCRIPTFORGE.SF_FileSystem - \ No newline at end of file +
[Libreoffice-commits] core.git: include/oox oox/source sc/source
include/oox/ole/vbamodule.hxx | 11 +-- oox/source/ole/vbamodule.cxx|2 +- sc/source/ui/vba/vbaapplication.cxx |7 ++- 3 files changed, 16 insertions(+), 4 deletions(-) New commits: commit 6ed0ffe9177ff6851e1b1e338dd92f81e7987f57 Author: Tomaž Vajngerl AuthorDate: Wed Feb 2 15:20:13 2022 +0900 Commit: Tomaž Vajngerl CommitDate: Sun Feb 6 06:49:15 2022 +0100 vba: small fixes for GetOpenFilename and documenting structs Check the XFileDialogSelectedItems is using the expected impl. after dynamic_casting. Rename VbaKeyBinding to VbaMacroKeyAndMethodBinding and document the struct. Change-Id: Ica4b24fed3013c5efa97a14e98bf9bdc2c74b68d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129320 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/oox/ole/vbamodule.hxx b/include/oox/ole/vbamodule.hxx index 3028136375bc..4cbb4a41c948 100644 --- a/include/oox/ole/vbamodule.hxx +++ b/include/oox/ole/vbamodule.hxx @@ -40,9 +40,14 @@ namespace oox { namespace oox::ole { -struct VbaKeyBinding +/** Stores, which key shortcut maps to which VBA macro method. */ +struct VbaMacroKeyAndMethodBinding { +// This describes a key combinaton in "raw" VBA Macro form, that +// still needs translated to a key event that can be used in +// LibreOffice. OUString msApiKey; +// The name of the macro method OUString msMethodName; }; @@ -105,7 +110,9 @@ private: boolmbReadOnly; boolmbPrivate; boolmbExecutable; -std::vector maKeyBindings; + +/** Keys and VBA macro method bindings */ +std::vector maKeyBindings; }; diff --git a/oox/source/ole/vbamodule.cxx b/oox/source/ole/vbamodule.cxx index 0fc9609653f3..d53e525989e6 100644 --- a/oox/source/ole/vbamodule.cxx +++ b/oox/source/ole/vbamodule.cxx @@ -136,7 +136,7 @@ void VbaModule::createAndImportModule( StorageBase& rVbaStrg, void VbaModule::registerShortcutKeys() { -for (VbaKeyBinding const& rKeyBinding : maKeyBindings) +for (VbaMacroKeyAndMethodBinding const& rKeyBinding : maKeyBindings) { try { diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx index f11ee6f21bbe..7b68047d0b80 100644 --- a/sc/source/ui/vba/vbaapplication.cxx +++ b/sc/source/ui/vba/vbaapplication.cxx @@ -358,7 +358,7 @@ uno::Any SAL_CALL ScVbaApplication::GetOpenFilename(const uno::Any& /*aFileFilter*/, const uno::Any& /*aFilterIndex*/, const uno::Any& aTitle, const uno::Any& /*aButtonText*/, const uno::Any& aMultiSelect) { // TODO - take all parameters into account -auto xDialog = uno::Reference (new ScVbaFileDialog( this, mxContext, office::MsoFileDialogType::msoFileDialogFilePicker)); +uno::Reference xDialog(new ScVbaFileDialog(this, mxContext, office::MsoFileDialogType::msoFileDialogFilePicker)); xDialog->setTitle(aTitle); xDialog->setAllowMultiSelect(aMultiSelect); @@ -373,6 +373,11 @@ ScVbaApplication::GetOpenFilename(const uno::Any& /*aFileFilter*/, const uno::An uno::Reference xItems = xDialog->getSelectedItems(); auto* pItems = dynamic_cast(xItems.get()); + +// Check, if the implementation of XFileDialogSelectedItems is what we expect +if (!pItems) +throw uno::RuntimeException("Unexpected XFileDialogSelectedItems implementation"); + auto const & rItemVector = pItems->getItems(); if (!bMultiSelect) // only 1 selection allowed - return path
[Libreoffice-commits] core.git: include/oox oox/source sw/qa
include/oox/drawingml/shape.hxx |3 + oox/source/drawingml/shape.cxx | 42 +++ oox/source/shape/WpgContext.hxx |2 - oox/source/shape/WpsContext.cxx | 43 +++ oox/source/shape/WpsContext.hxx |1 sw/qa/extras/ooxmlexport/data/WPGbodyPr.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport17.cxx | 49 +++ 7 files changed, 139 insertions(+), 1 deletion(-) New commits: commit 65b09ef1c5e24651579eb11900cf2ddbbb7b0971 Author: Attila Bakos (NISZ) AuthorDate: Mon Jan 24 10:57:34 2022 +0100 Commit: László Németh CommitDate: Thu Feb 3 09:28:52 2022 +0100 tdf#146803 tdf#146805 OOXML import: fix bodyPr at grouped shapes Grouped text boxes (WPG) lost their alignment and spacing, because the bodyPr tag what has the information for this, processed after the textbox content, and applied to the XShape which in case of group shape is not ready. To solve this, the mentioned properties read for the shape member after copied to the XShape when its ready, and than synced to the textbox. Regression from commit 121cbc250b36290f0f8c7265fea57256dad69553 "tdf#66039 DOCX: import textboxes (with tables, images etc.) in group shapes". Change-Id: Ifb5e8bde58613137441bec2e2b51bc67118dab40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128854 Tested-by: László Németh Reviewed-by: László Németh diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx index 57a47cbdb4e5..40c8319f67d3 100644 --- a/include/oox/drawingml/shape.hxx +++ b/include/oox/drawingml/shape.hxx @@ -205,6 +205,8 @@ public: const Color&getFontRefColorForNodes() const { return maFontRefColorForNodes; } voidsetLockedCanvas(bool bLockedCanvas); boolgetLockedCanvas() const { return mbLockedCanvas;} +voidsetWPGChild(bool bWPG); +boolisWPGChild() const { return mbWPGChild;} voidsetWps(bool bWps); boolgetWps() const { return mbWps;} voidsetTextBox(bool bTextBox); @@ -360,6 +362,7 @@ private: // we need separate flag because we don't want // to propagate it when applying reference shape boolmbLocked; +bool mbWPGChild; // Is this shape a child of a WPG shape? bool mbLockedCanvas; ///< Is this shape part of a locked canvas? bool mbWps; ///< Is this a wps shape? bool mbTextBox; ///< This shape has a textbox. diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index f7161e01291f..b1335add 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -134,6 +134,7 @@ Shape::Shape( const char* pServiceName, bool bDefaultHeight ) , mbHidden( false ) , mbHiddenMasterShape( false ) , mbLocked( false ) +, mbWPGChild(false) , mbLockedCanvas( false ) , mbWps( false ) , mbTextBox( false ) @@ -176,6 +177,7 @@ Shape::Shape( const ShapePtr& pSourceShape ) , mbHidden( pSourceShape->mbHidden ) , mbHiddenMasterShape( pSourceShape->mbHiddenMasterShape ) , mbLocked( pSourceShape->mbLocked ) +, mbWPGChild( pSourceShape->mbWPGChild ) , mbLockedCanvas( pSourceShape->mbLockedCanvas ) , mbWps( pSourceShape->mbWps ) , mbTextBox( pSourceShape->mbTextBox ) @@ -292,6 +294,41 @@ void Shape::addShape( if ( xShapes.is() ) addChildren( rFilterBase, *this, pTheme, xShapes, pShapeMap, aMatrix ); +if (isWPGChild() && xShape) +{ +// This is a wps shape and it is the child of the WPG, now copy the +// the text body properties to the xshape. +Reference xChildWPSProperties(xShape, uno::UNO_QUERY); + +if (getTextBody() && xChildWPSProperties) +{ +xChildWPSProperties->setPropertyValue( +UNO_NAME_TEXT_VERTADJUST, +uno::Any(getTextBody()->getTextProperties().meVA)); + +xChildWPSProperties->setPropertyValue( +UNO_NAME_TEXT_LEFTDIST, + uno::Any(getTextBody()->getTextProperties().moInsets[0].has_value() + ? *getTextBody()->getTextProperties().moInsets[0] + : 0)); +xChildWPSProperties->setPropertyValue( +UNO_NAME_TEXT_UPPERDIST, + uno::Any(getTextBody()->getTextProperties().moInsets[1].has_value() + ? *getTextBody()->getTextProperties().moInsets[1] + : 0)); +
[Libreoffice-commits] core.git: include/oox oox/source sw/qa writerfilter/source
include/oox/shape/ShapeContextHandler.hxx | 18 +++--- oox/source/shape/ShapeContextHandler.cxx | 31 +++--- sw/qa/extras/ooxmlexport/data/tdf146802.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport17.cxx| 13 +++ writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |5 +- 5 files changed, 48 insertions(+), 19 deletions(-) New commits: commit 4a38ca4035ac03571925e72cb47e0beb8da2003a Author: Attila Bakos (NISZ) AuthorDate: Wed Jan 19 17:43:54 2022 +0100 Commit: László Németh CommitDate: Thu Feb 3 09:12:20 2022 +0100 tdf#146802 OOXML import: fix embedded VML in grouped textbox E.g. OLE formulas inside them broke document load. Regression from 121cbc250b36290f0f8c7265fea57256dad69553 "tdf#66039 DOCX: import textboxes (with tables, images etc.) in group shapes". Note: now embedded VML OLE is loaded in WPG shapes, thanks to that the ShapeHandler in oox/ has a stack having the start token inside for each shape. Change-Id: I973d78ed88c5c83efffd9629061e2a2c6fdd25e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128627 Tested-by: László Németh Reviewed-by: László Németh diff --git a/include/oox/shape/ShapeContextHandler.hxx b/include/oox/shape/ShapeContextHandler.hxx index 27b70d2cf2c4..a245224730ed 100644 --- a/include/oox/shape/ShapeContextHandler.hxx +++ b/include/oox/shape/ShapeContextHandler.hxx @@ -19,6 +19,7 @@ #pragma once #include +#include #include #include #include @@ -90,12 +91,15 @@ public: void setRelationFragmentPath(const OUString & the_value); sal_Int32 getStartToken() const; -void setStartToken( sal_Int32 _starttoken ); +void popStartToken(); +void pushStartToken( sal_Int32 _starttoken ); void setPosition(const css::awt::Point& rPosition); -const bool& getFullWPGSupport() { return m_bFullWPGSUpport; }; -void setFullWPGSupport(const bool& rbUse) { m_bFullWPGSUpport = rbUse; }; +const bool& getFullWPGSupport() { return m_bFullWPGSUpport; } +void setFullWPGSupport(const bool& rbUse) { m_bFullWPGSUpport = rbUse; } + +bool isWordProcessingGroupShape() const { return mxWpgContext ? true : false; } void setDocumentProperties(const css::uno::Reference& xDocProps); void setMediaDescriptor(const css::uno::Sequence& rMediaDescriptor); @@ -109,9 +113,13 @@ private: ShapeContextHandler(ShapeContextHandler const &) = delete; void operator =(ShapeContextHandler const &) = delete; -::sal_uInt32 mnStartToken; +// Special stack which always has at least one element. +// In case of group shapes with embedded content it will have more element than one. +std::stack mnStartTokenStack; + css::awt::Point maPosition; -bool m_bFullWPGSUpport; +bool m_bFullWPGSUpport; // Is this DrawingML shape supposed to be proccessed as WPG? + drawingml::ShapePtr mpShape; std::shared_ptr< vml::Drawing > mpDrawing; diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx index 6eb9e5ce9083..cacd46d82d14 100644 --- a/oox/source/shape/ShapeContextHandler.cxx +++ b/oox/source/shape/ShapeContextHandler.cxx @@ -44,7 +44,6 @@ using namespace core; using namespace drawingml; ShapeContextHandler::ShapeContextHandler(const rtl::Reference& xFilterBase) : - mnStartToken(0), m_bFullWPGSUpport(false), mxShapeFilterBase(xFilterBase) @@ -225,8 +224,9 @@ uno::Reference ShapeContextHandler::getContextHandler(sal_Int32 nElement) { uno::Reference xResult; +const sal_uInt32 nStartToken = getStartToken(); -switch (getNamespace( mnStartToken )) +switch (getNamespace( nStartToken )) { case NMSP_doc: case NMSP_vml: @@ -236,19 +236,19 @@ ShapeContextHandler::getContextHandler(sal_Int32 nElement) xResult.set(getDiagramShapeContext()); break; case NMSP_dmlLockedCanvas: -xResult.set(getLockedCanvasContext(mnStartToken)); +xResult.set(getLockedCanvasContext(nStartToken)); break; case NMSP_dmlChart: -xResult.set(getChartShapeContext(mnStartToken)); +xResult.set(getChartShapeContext(nStartToken)); break; case NMSP_wps: -xResult.set(getWpsContext(mnStartToken, nElement)); +xResult.set(getWpsContext(nStartToken, nElement)); break; case NMSP_wpg: -xResult.set(getWpgContext(mnStartToken)); +xResult.set(getWpgContext(nStartToken)); break; default: -xResult.set(getGraphicShapeContext(mnStartToken)); +xResult.set(getGraphicShapeContext(nStartToken)); break; } @@ -456,7 +456,7 @@ ShapeContextHandler::getShape() //NMSP_dmlChart == getNamespace( mnStartToken ) check is introduced to make sure that
[Libreoffice-commits] core.git: include/oox oox/qa oox/source sd/source
include/oox/export/drawingml.hxx|6 ++- oox/qa/unit/data/camera-rotation-revolution-nonwps.pptx |binary oox/qa/unit/drawingml.cxx | 26 ++ oox/qa/unit/export.cxx | 27 +++ oox/source/drawingml/shape.cxx |9 ++--- oox/source/export/drawingml.cxx | 28 +++- oox/source/export/shapes.cxx|4 +- sd/source/filter/eppt/pptx-epptooxml.cxx|2 - 8 files changed, 72 insertions(+), 30 deletions(-) New commits: commit 8bdd134bef3baca2ebd878163af4e55e5f898efe Author: Sarper Akdemir AuthorDate: Mon Jan 3 05:45:17 2022 +0300 Commit: Miklos Vajna CommitDate: Wed Jan 5 09:08:10 2022 +0100 tdf#146534 pptx import: make Z rotation work with rotation transform Expands previous idea from a9c5c0d814a266096483572b84c72875ef8efd77 (tdf#133037 OOXML shape import: camera rotation along Z) and uses it also for shapes that have a true bUseRotationTransform flag Also fixes same Z rotation exporting twice from InteropGrabBag to both spPr and textBody causing text overrotating on roundtrip. Change-Id: If0f192af029ca86b932a63613f961be1f5003c5b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127880 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index eb1da4a61f8e..2a65818b15f6 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -323,7 +323,11 @@ public: void WriteShapeStyle( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet ); void WriteShapeEffects( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet ); void WriteShapeEffect( std::u16string_view sName, const css::uno::Sequence< css::beans::PropertyValue >& aEffectProps ); -void WriteShape3DEffects( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet ); +/** Populates scene3d tag +@param rXPropSet Prop set +@param bIsText True if the 3D effects are for a text body, false if it is for a shape + */ +void Write3DEffects(const css::uno::Reference& rXPropSet, bool bIsText); void WriteArtisticEffect( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet ); OString WriteWdpPicture( const OUString& rFileId, const css::uno::Sequence< sal_Int8 >& rPictureData ); void WriteDiagram(const css::uno::Reference& rXShape, int nDiagramId); diff --git a/oox/qa/unit/data/camera-rotation-revolution-nonwps.pptx b/oox/qa/unit/data/camera-rotation-revolution-nonwps.pptx new file mode 100755 index ..db26dc032caa Binary files /dev/null and b/oox/qa/unit/data/camera-rotation-revolution-nonwps.pptx differ diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx index 0d6f367f02c7..ccfa0fa80633 100644 --- a/oox/qa/unit/drawingml.cxx +++ b/oox/qa/unit/drawingml.cxx @@ -294,6 +294,32 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testCameraRotationRevolution) CPPUNIT_ASSERT_EQUAL(static_cast(27000), nRotateAngle1); } +CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testTdf146534_CameraRotationRevolutionNonWpsShapes) +{ +OUString aURL += m_directories.getURLFromSrc(DATA_DIRECTORY) + "camera-rotation-revolution-nonwps.pptx"; +load(aURL); + +uno::Reference xDrawPagesSupplier(getComponent(), uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); +uno::Reference xShape0(xDrawPage->getByIndex(0), uno::UNO_QUERY); +uno::Reference xShape1(xDrawPage->getByIndex(1), uno::UNO_QUERY); +uno::Reference xShapeProps0(xShape0, uno::UNO_QUERY); +uno::Reference xShapeProps1(xShape1, uno::UNO_QUERY); +sal_Int32 nRotateAngle0; +sal_Int32 nRotateAngle1; +xShapeProps0->getPropertyValue("RotateAngle") >>= nRotateAngle0; +xShapeProps1->getPropertyValue("RotateAngle") >>= nRotateAngle1; + +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 9000 +// - Actual : 0 +// so the camera rotation would not have been factored into how the shape is displayed +CPPUNIT_ASSERT_EQUAL(static_cast(9000), nRotateAngle0); +CPPUNIT_ASSERT_EQUAL(static_cast(30500), nRotateAngle1); +} + CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testTableShadow) { auto verify = [](const uno::Reference& xComponent) { diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index 950a1559f621..86656a0f8f68 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -327,6 +327,33 @@ CPPUNIT_TEST_FIXTURE(Test, testCustomShapeArrowExport) "fmla", "val 0"); } +CPPUNIT_TEST_FIXTURE(Test, testCameraRevolutionGrabBag) +{ +// Given a PPTX file that contains
[Libreoffice-commits] core.git: 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 2951cbdf3a6e2b62461665546b47e1d253fcb834 Author: Attila Bakos (NISZ) AuthorDate: Wed Nov 10 14:10:11 2021 +0100 Commit: László Németh CommitDate: Mon Jan 3 14:28:15 2022 +0100 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 diff --git a/include/oox/shape/ShapeContextHandler.hxx b/include/oox/shape/ShapeContextHandler.hxx index 934ea374fd7c..27b70d2cf2c4 100644 --- a/include/oox/shape/ShapeContextHandler.hxx +++ b/include/oox/shape/ShapeContextHandler.hxx @@ -94,6 +94,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); @@ -108,7 +111,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 78a27f8a0c9c..fd9eb691b2e8 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1531,7 +1531,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 5404cc82fe81..3454c0e03f87 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 WpgContext(*rFragmentHandler, oox::drawingml::ShapePtr()); +rContext->setFullWPGSupport(m_bFullWPGSUpport); +
[Libreoffice-commits] core.git: include/oox oox/qa oox/source
include/oox/vml/vmlshape.hxx |6 ++ oox/qa/unit/data/watermark.docx|binary oox/qa/unit/vml.cxx| 22 ++ oox/source/vml/vmlshape.cxx|7 +++ oox/source/vml/vmlshapecontext.cxx | 28 5 files changed, 63 insertions(+) New commits: commit 90556b6df0f6378fb60d7dee18b2f5d275ece530 Author: Miklos Vajna AuthorDate: Thu Dec 16 10:16:02 2021 +0100 Commit: Miklos Vajna CommitDate: Thu Dec 16 12:43:11 2021 +0100 VML import: handle Map it to (the UNO API of) GraphicDrawMode::Watermark, similar to what the binary import does in SvxMSDffManager::ImportGraphic() and how the drawingML import does it in oox::drawingml::GraphicProperties::pushToPropMap(). On export, the drawingML export is used, and that already maps GraphicDrawMode::Watermark to . Change-Id: I33986a03bf3d3863da5c5b1f0a2e0da0fa595c9e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126908 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/include/oox/vml/vmlshape.hxx b/include/oox/vml/vmlshape.hxx index 19c82384efcd..7a17bda51ccd 100644 --- a/include/oox/vml/vmlshape.hxx +++ b/include/oox/vml/vmlshape.hxx @@ -113,6 +113,12 @@ struct ShapeTypeModel OptValue moCropTop; ///< Specifies how much to crop the image from the top down as a fraction of picture size. OUString maLayoutFlowAlt; ///< Specifies the alternate layout flow for text in textboxes. +/// An adjustment for the intensity of all colors, i.e. contrast, on a 0..0x1 scale. +sal_Int32 mnGain = 0x1; + +/// The image brightness, on a 0..0x1 scale. +sal_Int16 mnBlacklevel = 0; + explicitShapeTypeModel(); voidassignUsed( const ShapeTypeModel& rSource ); diff --git a/oox/qa/unit/data/watermark.docx b/oox/qa/unit/data/watermark.docx new file mode 100644 index ..c9eacff9a643 Binary files /dev/null and b/oox/qa/unit/data/watermark.docx differ diff --git a/oox/qa/unit/vml.cxx b/oox/qa/unit/vml.cxx index 6d8a5cf93912..9dcaaef83cc4 100644 --- a/oox/qa/unit/vml.cxx +++ b/oox/qa/unit/vml.cxx @@ -23,6 +23,7 @@ #include #include #include +#include using namespace ::com::sun::star; @@ -214,6 +215,27 @@ CPPUNIT_TEST_FIXTURE(OoxVmlTest, testGraphicStroke) CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_SOLID, eLineStyle); } +CPPUNIT_TEST_FIXTURE(OoxVmlTest, testWatermark) +{ +// Given a document with a picture watermark, and the "washout" checkbox is ticked on the Word +// UI: +// When loading that document: +load(u"watermark.docx"); + +// Then make sure the watermark effect is not lost on import: +uno::Reference xDrawPagesSupplier(getComponent(), uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); +uno::Reference xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); +drawing::ColorMode eMode{}; +xShape->getPropertyValue("GraphicColorMode") >>= eMode; +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 3 +// - Actual : 0 +// i.e. the color mode was STANDARD, not WATERMARK. +CPPUNIT_ASSERT_EQUAL(drawing::ColorMode_WATERMARK, eMode); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 81abe64e5322..38b632be843b 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -991,6 +992,12 @@ Reference< XShape > SimpleShape::createPictureObject(const Reference< XShapes >& aPropSet.setProperty(PROP_GraphicCrop, aGraphicCrop); } + +if (maTypeModel.mnGain == -70 && maTypeModel.mnBlacklevel == 70) +{ +// Map MSO 'washout' to our watermark colormode. +aPropSet.setProperty(PROP_GraphicColorMode, uno::makeAny(drawing::ColorMode_WATERMARK)); +} } return xShape; } diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index e9284747774b..4ed3f83fd076 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -395,6 +395,34 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( sal_Int32 nElement, const A mrTypeModel.moCropLeft = rAttribs.getString(XML_cropleft); mrTypeModel.moCropRight = rAttribs.getString(XML_cropright); mrTypeModel.moCropTop = rAttribs.getString(XML_croptop); + +// Gain / contrast. +OptValue oGain = rAttribs.getString(XML_gain); +sal_Int32 nGain = 0x1; +if (oGain.has() && oGain.get().endsWith("f")) +{ +nGain = oGain.get().toInt32();
[Libreoffice-commits] core.git: include/oox oox/source sd/qa
include/oox/export/drawingml.hxx |2 +- oox/source/export/drawingml.cxx| 11 +-- sd/qa/unit/data/odp/tdf129430.odp |binary sd/qa/unit/export-tests-ooxml3.cxx | 15 +++ 4 files changed, 25 insertions(+), 3 deletions(-) New commits: commit fc1e5202cbfb36b28b0e597811f39895c19ae6ba Author: Tibor Nagy AuthorDate: Fri Nov 19 12:36:42 2021 +0100 Commit: László Németh CommitDate: Fri Dec 3 15:52:50 2021 +0100 tdf#129430 PPTX export: fix workaround for "At least" line spacing to avoid bad overlapping lines. PPTX does not have the option "At least", so line spacing with this setting is converted to fixed line spacing. Improve this workaround to use single line spacing, if the "At least" value is lower than the size of the characters, like "At least" is handled by Impress. Change-Id: I29b41225d48fd9a447e7f6ef3a8a7cc7ba9ef354 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125553 Tested-by: László Németh Reviewed-by: László Németh diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index 516287293580..b71490752708 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -262,7 +262,7 @@ public: void WriteXGraphicStretch(css::uno::Reference const & rXPropSet, css::uno::Reference const & rxGraphic); -void WriteLinespacing( const css::style::LineSpacing& rLineSpacing ); +void WriteLinespacing(const css::style::LineSpacing& rLineSpacing, float fFirstCharHeight); OUString WriteXGraphicBlip(css::uno::Reference const & rXPropSet, css::uno::Reference const & rxGraphic, diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 7217efe0e5c9..0c8235a3a1da 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -2894,13 +2894,20 @@ const char* DrawingML::GetAlignment( style::ParagraphAdjust nAlignment ) return sAlignment; } -void DrawingML::WriteLinespacing( const LineSpacing& rSpacing ) +void DrawingML::WriteLinespacing(const LineSpacing& rSpacing, float fFirstCharHeight) { if( rSpacing.Mode == LineSpacingMode::PROP ) { mpFS->singleElementNS( XML_a, XML_spcPct, XML_val, OString::number(static_cast(rSpacing.Height)*1000)); } +else if (rSpacing.Mode == LineSpacingMode::MINIMUM + && fFirstCharHeight > static_cast(rSpacing.Height) * 0.001 * 72.0 / 2.54) +{ +// 100% proportional line spacing = single line spacing +mpFS->singleElementNS(XML_a, XML_spcPct, XML_val, + OString::number(static_cast(10))); +} else { mpFS->singleElementNS( XML_a, XML_spcPts, @@ -2988,7 +2995,7 @@ bool DrawingML::WriteParagraphProperties( const Reference< XTextContent >& rPara if( bHasLinespacing ) { mpFS->startElementNS(XML_a, XML_lnSpc); -WriteLinespacing( aLineSpacing ); +WriteLinespacing(aLineSpacing, fFirstCharHeight); mpFS->endElementNS( XML_a, XML_lnSpc ); } diff --git a/sd/qa/unit/data/odp/tdf129430.odp b/sd/qa/unit/data/odp/tdf129430.odp new file mode 100644 index ..f5304f75cf26 Binary files /dev/null and b/sd/qa/unit/data/odp/tdf129430.odp differ diff --git a/sd/qa/unit/export-tests-ooxml3.cxx b/sd/qa/unit/export-tests-ooxml3.cxx index 900716e20093..375922511661 100644 --- a/sd/qa/unit/export-tests-ooxml3.cxx +++ b/sd/qa/unit/export-tests-ooxml3.cxx @@ -51,6 +51,7 @@ class SdOOXMLExportTest3 : public SdModelTestBaseXML { public: +void testTdf129430(); void testTdf114848(); void testTdf68759(); void testTdf127901(); @@ -125,6 +126,7 @@ public: CPPUNIT_TEST_SUITE(SdOOXMLExportTest3); +CPPUNIT_TEST(testTdf129430); CPPUNIT_TEST(testTdf114848); CPPUNIT_TEST(testTdf68759); CPPUNIT_TEST(testTdf127901); @@ -203,6 +205,19 @@ public: } }; +void SdOOXMLExportTest3::testTdf129430() +{ +sd::DrawDocShellRef xDocShRef += loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf129430.odp"), ODP); +utl::TempFile tempFile; +xDocShRef = saveAndReload(xDocShRef.get(), PPTX, ); +xDocShRef->DoClose(); + +xmlDocUniquePtr pXmlDoc1 = parseExport(tempFile, "ppt/slides/slide1.xml"); +assertXPath(pXmlDoc1, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p[2]/a:pPr/a:lnSpc/a:spcPct", +"val", "10"); +} + void SdOOXMLExportTest3::testTdf114848() { ::sd::DrawDocShellRef xDocShRef
[Libreoffice-commits] core.git: include/oox include/unotest oox/qa oox/source sd/qa unotest/Library_unotest.mk unotest/source
include/oox/export/drawingml.hxx |2 + include/unotest/macros_test.hxx |9 + oox/qa/unit/data/refer-to-theme.pptx |binary oox/qa/unit/export.cxx | 45 ++--- oox/source/export/drawingml.cxx | 54 ++- sd/qa/unit/sdmodeltestbase.hxx | 11 --- unotest/Library_unotest.mk |1 unotest/source/cpp/macros_test.cxx | 17 +++ 8 files changed, 105 insertions(+), 34 deletions(-) New commits: commit f36767fde87191258ea21f3faac0be6ad79328e0 Author: Miklos Vajna AuthorDate: Thu Dec 2 08:45:26 2021 +0100 Commit: Miklos Vajna CommitDate: Thu Dec 2 17:26:33 2021 +0100 PPTX export: handle theme colors from the doc model for shape text As a start, do this only in case there are no effects used. If there is no theme color or there are effects, fall back to the old code. Also move parseExportStream() from SdModelTestBaseXML up to MacrosTest, so oox/ test code can use it as well. Change-Id: Ia76581dcef110341f6c3e60f22c34818ed0dcabc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126215 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index 4af628a289f9..516287293580 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -222,6 +222,8 @@ public: void WriteLineArrow( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, bool bLineStart ); void WriteConnectorConnections( EscherConnectorListEntry& rConnectorEntry, sal_Int32 nStartID, sal_Int32 nEndID ); +bool WriteCharColor(const css::uno::Reference& xPropertySet); + void WriteSolidFill( ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT ); void WriteSolidFill( const OUString& sSchemeName, const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT ); void WriteSolidFill( const ::Color nColor, const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT ); diff --git a/include/unotest/macros_test.hxx b/include/unotest/macros_test.hxx index 14917794d38d..ed879b835a55 100644 --- a/include/unotest/macros_test.hxx +++ b/include/unotest/macros_test.hxx @@ -28,11 +28,16 @@ struct TestMacroInfo }; class BasicDLL; +class SvStream; namespace test { class Directories; } +namespace utl +{ +class TempFile; +} namespace unotest { @@ -76,6 +81,10 @@ public: const OUString& rCommand, const css::uno::Sequence& rPropertyValues); +/// Opens rStreamName from rTempFile, assuming it's a ZIP storage. +static std::unique_ptr parseExportStream(const utl::TempFile& rTempFile, + const OUString& rStreamName); + void setUpNssGpg(const test::Directories& rDirectories, const OUString& rTestName); void tearDownNssGpg(); diff --git a/oox/qa/unit/data/refer-to-theme.pptx b/oox/qa/unit/data/refer-to-theme.pptx new file mode 100644 index ..9a45799ab977 Binary files /dev/null and b/oox/qa/unit/data/refer-to-theme.pptx differ diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index b649d546ead9..fee130d77971 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -13,11 +13,9 @@ #include #include -#include #include #include -#include using namespace ::com::sun::star; @@ -86,11 +84,7 @@ CPPUNIT_TEST_FIXTURE(Test, testPolylineConnectorPosition) loadAndSave(aURL, "Office Open XML Text"); // Then make sure polyline and connector have the correct position. -uno::Reference xNameAccess -= packages::zip::ZipFileAccess::createWithURL(mxComponentContext, getTempFile().GetURL()); -uno::Reference xInputStream(xNameAccess->getByName("word/document.xml"), - uno::UNO_QUERY); -std::unique_ptr pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true)); +std::unique_ptr pStream = parseExportStream(getTempFile(), "word/document.xml"); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); // For child elements of groups in Writer the position has to be adapted to be relative @@ -117,11 +111,7 @@ CPPUNIT_TEST_FIXTURE(Test, testRotatedShapePosition) loadAndSave(aURL, "Office Open XML Text"); // Then make sure the rotated child shape has the correct position. -uno::Reference xNameAccess -= packages::zip::ZipFileAccess::createWithURL(mxComponentContext, getTempFile().GetURL()); -uno::Reference xInputStream(xNameAccess->getByName("word/document.xml"), - uno::UNO_QUERY); -std::unique_ptr pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true)); +std::unique_ptr pStream = parseExportStream(getTempFile(),
[Libreoffice-commits] core.git: include/oox include/svx oox/source sd/source svx/source
include/oox/drawingml/theme.hxx|5 include/svx/svdpage.hxx|5 oox/source/drawingml/theme.cxx | 15 + oox/source/drawingml/themefragmenthandler.cxx |6 - oox/source/ppt/presentationfragmenthandler.cxx |6 + sd/source/ui/unoidl/unopage.cxx| 27 - svx/source/svdraw/svdpage.cxx |3 ++ 7 files changed, 65 insertions(+), 2 deletions(-) New commits: commit 6ce8066af743b172d36046a8dc8b17ebe010b6cf Author: Sarper Akdemir AuthorDate: Mon Sep 13 09:47:11 2021 +0300 Commit: Miklos Vajna CommitDate: Thu Nov 18 17:17:43 2021 +0100 import pptx color schemes as color sets initial import work for color sets. Themes (which we get the color schemes from) in MSO can be different for each master - will need to support that too. [ Miklos: actually added that per-master-page support. ] (cherry picked from commit 3b21d166f585dcdf8d576d166aeff3cfd4694aab, from the feature/themesupport2 branch) Change-Id: Ia06d2645018e6bfa70817bbddba2374641ae13dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125477 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/include/oox/drawingml/theme.hxx b/include/oox/drawingml/theme.hxx index 944e58b6e79c..6222a4264451 100644 --- a/include/oox/drawingml/theme.hxx +++ b/include/oox/drawingml/theme.hxx @@ -32,6 +32,7 @@ #include namespace com::sun::star { +namespace drawing { class XDrawPage; } namespace xml::dom { class XDocument; } } @@ -57,6 +58,7 @@ class OOX_DLLPUBLIC Theme { public: void setStyleName( const OUString& rStyleName ) { maStyleName = rStyleName; } +void setThemeName(const OUString& rThemeName) { maThemeName = rThemeName; } ClrScheme& getClrScheme() { return maClrScheme; } const ClrScheme& getClrScheme() const { return maClrScheme; } @@ -96,8 +98,11 @@ public: const css::uno::Reference& getFragment() const { return mxFragment; } void setFragment( const css::uno::Reference< css::xml::dom::XDocument>& xRef ) { mxFragment=xRef; } +void addTheme(const css::uno::Reference& xDrawPage) const; + private: OUStringmaStyleName; +OUStringmaThemeName; ClrScheme maClrScheme; FillStyleList maFillStyleList; FillStyleList maBgFillStyleList; diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx index eaadcde330c0..540002eb7d14 100644 --- a/include/svx/svdpage.hxx +++ b/include/svx/svdpage.hxx @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -312,6 +313,7 @@ private: // data SdrPage*mpSdrPage; SfxStyleSheet* mpStyleSheet; +std::unique_ptr mpTheme; SfxItemSet maProperties; // internal helpers @@ -339,6 +341,9 @@ public: // StyleSheet access void SetStyleSheet(SfxStyleSheet* pStyleSheet); SfxStyleSheet* GetStyleSheet() const { return mpStyleSheet;} + +void SetTheme(std::unique_ptr pTheme); +svx::Theme* GetTheme(); }; diff --git a/oox/source/drawingml/theme.cxx b/oox/source/drawingml/theme.cxx index 036779d21711..be9f199ff8f8 100644 --- a/oox/source/drawingml/theme.cxx +++ b/oox/source/drawingml/theme.cxx @@ -20,6 +20,12 @@ #include #include #include +#include +#include +#include +#include + +using namespace com::sun::star; namespace oox::drawingml { @@ -97,6 +103,15 @@ const TextFont* Theme::resolveFont( const OUString& rName ) const return nullptr; } +void Theme::addTheme(const css::uno::Reference& xDrawPage) const +{ +beans::PropertyValues aValues = { +comphelper::makePropertyValue("Name", maThemeName), +}; +uno::Reference xPropertySet(xDrawPage, uno::UNO_QUERY); +xPropertySet->setPropertyValue("Theme", uno::makeAny(aValues)); +} + } // namespace oox::drawingml /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/themefragmenthandler.cxx b/oox/source/drawingml/themefragmenthandler.cxx index 5c5d4a6ab07a..5ab0ee1e6b21 100644 --- a/oox/source/drawingml/themefragmenthandler.cxx +++ b/oox/source/drawingml/themefragmenthandler.cxx @@ -21,6 +21,7 @@ #include #include #include +#include #include using namespace ::oox::core; @@ -37,7 +38,7 @@ ThemeFragmentHandler::~ThemeFragmentHandler() { } -ContextHandlerRef ThemeFragmentHandler::onCreateContext( sal_Int32 nElement, const AttributeList& ) +ContextHandlerRef ThemeFragmentHandler::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs) { // CT_OfficeStyleSheet switch( getCurrentElement() ) @@ -46,7 +47,10 @@ ContextHandlerRef ThemeFragmentHandler::onCreateContext( sal_Int32 nElement, con switch( nElement ) {
[Libreoffice-commits] core.git: include/oox oox/source
include/oox/drawingml/color.hxx |1 + oox/source/drawingml/color.cxx | 16 oox/source/drawingml/textcharacterproperties.cxx |1 + 3 files changed, 18 insertions(+) New commits: commit 3ed69deb04cca67e377c15956679f7bb9794e4ff Author: Sarper Akdemir AuthorDate: Wed Aug 25 02:24:42 2021 +0300 Commit: Miklos Vajna CommitDate: Thu Nov 18 08:08:14 2021 +0100 implement color tint or shade import for pptx [ Miklos: althought the PowerPoint UI doesn't seem to have a way to generate this markup. ] (cherry picked from commit de40c940c3a94588d44a3d1f6d8cd4191cca4f73) Change-Id: Ibf98ba335b10859e4d6d702263f09e6ba2033bff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125426 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/include/oox/drawingml/color.hxx b/include/oox/drawingml/color.hxx index 00473cfe6f27..bd67982c6e92 100644 --- a/include/oox/drawingml/color.hxx +++ b/include/oox/drawingml/color.hxx @@ -99,6 +99,7 @@ public: /** Returns the scheme name from the a:schemeClr element for interoperability purposes */ const OUString& getSchemeColorName() const { return msSchemeName; } sal_Int16 getSchemeColorIndex() const; +sal_Int16 getTintOrShade(); /** Returns the unaltered list of transformations for interoperability purposes */ const css::uno::Sequence< css::beans::PropertyValue >& getTransformations() const { return maInteropTransformations;} diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx index 2ced5345904e..426197102160 100644 --- a/oox/source/drawingml/color.cxx +++ b/oox/source/drawingml/color.cxx @@ -479,6 +479,22 @@ void Color::clearTransparence() mnAlpha = MAX_PERCENT; } +sal_Int16 Color::getTintOrShade() +{ +for(auto const& aTransform : maTransforms) +{ +switch(aTransform.mnToken) +{ +case XML_tint: +// from 1000th percent to 100th percent... +return aTransform.mnValue/10; +case XML_shade: +// from 1000th percent to 100th percent... +return -aTransform.mnValue/10; +} +} +return 0; +} ::Color Color::getColor( const GraphicHelper& rGraphicHelper, ::Color nPhClr ) const { const sal_Int32 nTempC1 = mnC1; diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx index 90b0e38c1d3a..bd4d051a490b 100644 --- a/oox/source/drawingml/textcharacterproperties.cxx +++ b/oox/source/drawingml/textcharacterproperties.cxx @@ -113,6 +113,7 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil rPropMap.setProperty(PROP_CharColor, aColor.getColor(rFilter.getGraphicHelper())); // set color theme index rPropMap.setProperty(PROP_CharColorTheme, aColor.getSchemeColorIndex()); +rPropMap.setProperty(PROP_CharColorTintOrShade, aColor.getTintOrShade()); if (aColor.hasTransparency()) {
[Libreoffice-commits] core.git: include/oox oox/source
include/oox/drawingml/color.hxx |4 ++-- oox/source/drawingml/color.cxx |2 +- oox/source/drawingml/shape.cxx | 14 +++--- oox/source/drawingml/shape3dproperties.cxx |2 +- oox/source/drawingml/textcharacterproperties.cxx |2 +- 5 files changed, 12 insertions(+), 12 deletions(-) New commits: commit 9acb80943da5aaaf5d515a794f8a825d88bda430 Author: Sarper Akdemir AuthorDate: Tue Aug 24 23:58:35 2021 +0300 Commit: Miklos Vajna CommitDate: Wed Nov 17 19:58:01 2021 +0100 rename getSchemeName getSchemeIndex to remove ambiguity [ Miklos: i.e. index could be a theme index or an index into a color set, this one is the later case. ] (cherry picked from commit aef22c3bbf1b4bb8ab9ba2bccb7005e0d0c75cb3, from the feature/themesupport2 branch) Conflicts: oox/source/drawingml/shape.cxx oox/source/drawingml/shape3dproperties.cxx Change-Id: I495e4b39975f1483607972ccbcc9348021710519 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125414 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/include/oox/drawingml/color.hxx b/include/oox/drawingml/color.hxx index f213dba9a973..00473cfe6f27 100644 --- a/include/oox/drawingml/color.hxx +++ b/include/oox/drawingml/color.hxx @@ -97,8 +97,8 @@ public: sal_Int16 getTransparency() const; /** Returns the scheme name from the a:schemeClr element for interoperability purposes */ -const OUString& getSchemeName() const { return msSchemeName; } -sal_Int16 getSchemeIndex() const; +const OUString& getSchemeColorName() const { return msSchemeName; } +sal_Int16 getSchemeColorIndex() const; /** Returns the unaltered list of transformations for interoperability purposes */ const css::uno::Sequence< css::beans::PropertyValue >& getTransformations() const { return maInteropTransformations;} diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx index 9f4026727b56..2ced5345904e 100644 --- a/oox/source/drawingml/color.cxx +++ b/oox/source/drawingml/color.cxx @@ -661,7 +661,7 @@ sal_Int16 Color::getTransparency() const return sal_Int16(std::round( (1.0 * (MAX_PERCENT - mnAlpha)) / PER_PERCENT) ); } -sal_Int16 Color::getSchemeIndex() const +sal_Int16 Color::getSchemeColorIndex() const { static std::map const aSchemeColorNameToIndex{ { "dk1", 0 }, { "lt1", 1 }, { "dk2", 2 }, { "lt2", 3 }, diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 69bf775ee5da..1f1d430e241d 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1064,7 +1064,7 @@ Reference< XShape > const & Shape::createAndInsert( // Store style-related properties to InteropGrabBag to be able to export them back uno::Sequence aProperties = comphelper::InitPropertySequence( { -{"SchemeClr", uno::makeAny(pLineRef->maPhClr.getSchemeName())}, +{"SchemeClr", uno::makeAny(pLineRef->maPhClr.getSchemeColorName())}, {"Idx", uno::makeAny(pLineRef->mnThemedIdx)}, {"Color", uno::makeAny(nLinePhClr)}, {"LineStyle", uno::makeAny(aLineProperties.getLineStyle())}, @@ -1082,7 +1082,7 @@ Reference< XShape > const & Shape::createAndInsert( nFillPhClr = pFillRef->maPhClr.getColor(rGraphicHelper); } -OUString sColorScheme = pFillRef->maPhClr.getSchemeName(); +OUString sColorScheme = pFillRef->maPhClr.getSchemeColorName(); if( !sColorScheme.isEmpty() ) { uno::Sequence aProperties = comphelper::InitPropertySequence( @@ -1104,7 +1104,7 @@ Reference< XShape > const & Shape::createAndInsert( // Store style-related properties to InteropGrabBag to be able to export them back uno::Sequence aProperties = comphelper::InitPropertySequence( { -{"SchemeClr", uno::makeAny(pEffectRef->maPhClr.getSchemeName())}, +{"SchemeClr", uno::makeAny(pEffectRef->maPhClr.getSchemeColorName())}, {"Idx", uno::makeAny(pEffectRef->mnThemedIdx)}, {"Transformations", uno::makeAny(pEffectRef->maPhClr.getTransformations())} }); @@ -1356,13 +1356,13 @@ Reference< XShape > const & Shape::createAndInsert( comphelper::makePropertyValue("OriginalSolidFillClr", aShapeProps.getProperty(PROP_FillColor)), comphelper::makePropertyValue("OriginalLnSolidFillClr", aShapeProps.getProperty(PROP_LineColor)) }; -OUString sColorFillScheme = aFillProperties.maFillColor.getSchemeName(); +OUString sColorFillScheme =
[Libreoffice-commits] core.git: include/oox oox/source
include/oox/drawingml/color.hxx |2 ++ oox/source/drawingml/color.cxx | 15 +++ oox/source/drawingml/textcharacterproperties.cxx |2 ++ oox/source/token/properties.txt |2 ++ 4 files changed, 21 insertions(+) New commits: commit f394e2519c99cd1514c859cda67b1c09e68e6c19 Author: Sarper Akdemir AuthorDate: Fri Aug 20 00:45:55 2021 +0300 Commit: Miklos Vajna CommitDate: Wed Nov 17 18:00:39 2021 +0100 implement initial pptx theme color import [ Miklos: this only handles colors as-is, without any effects. ] (cherry picked from commit ec68ca0b5fb6773f42600f6a5825b4794cdb0990, from the feature/themesupport2 branch) Change-Id: I89890cf7ba6ec758698011752b63d7a60872bef2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125404 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/include/oox/drawingml/color.hxx b/include/oox/drawingml/color.hxx index 59f417cfac52..f213dba9a973 100644 --- a/include/oox/drawingml/color.hxx +++ b/include/oox/drawingml/color.hxx @@ -98,6 +98,8 @@ public: /** Returns the scheme name from the a:schemeClr element for interoperability purposes */ const OUString& getSchemeName() const { return msSchemeName; } +sal_Int16 getSchemeIndex() const; + /** Returns the unaltered list of transformations for interoperability purposes */ const css::uno::Sequence< css::beans::PropertyValue >& getTransformations() const { return maInteropTransformations;} diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx index 3c9ac2f6ac44..9f4026727b56 100644 --- a/oox/source/drawingml/color.cxx +++ b/oox/source/drawingml/color.cxx @@ -661,6 +661,21 @@ sal_Int16 Color::getTransparency() const return sal_Int16(std::round( (1.0 * (MAX_PERCENT - mnAlpha)) / PER_PERCENT) ); } +sal_Int16 Color::getSchemeIndex() const +{ +static std::map const aSchemeColorNameToIndex{ +{ "dk1", 0 }, { "lt1", 1 }, { "dk2", 2 }, { "lt2", 3 }, +{ "accent1", 4 }, { "accent2", 5 }, { "accent3", 6 }, { "accent4", 7 }, +{ "accent5", 8 }, { "accent6", 9 }, { "hlink", 10 }, { "folHlink", 11 } +}; + +auto aIt = aSchemeColorNameToIndex.find(msSchemeName); +if( aIt == aSchemeColorNameToIndex.end() ) +return -1; +else +return aIt->second; +} + // private void Color::setResolvedRgb( ::Color nRgb ) const diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx index 4eb5acaffb56..9cbc331d05fa 100644 --- a/oox/source/drawingml/textcharacterproperties.cxx +++ b/oox/source/drawingml/textcharacterproperties.cxx @@ -111,6 +111,8 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil { Color aColor = maFillProperties.getBestSolidColor(); rPropMap.setProperty(PROP_CharColor, aColor.getColor(rFilter.getGraphicHelper())); +// set color theme index +rPropMap.setProperty(PROP_CharColorTheme, aColor.getSchemeIndex()); if (aColor.hasTransparency()) { diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index 2c56d0f46804..951a03e7eba0 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -54,6 +54,8 @@ CharBackColor CharCaseMap CharColor CharContoured +CharColorTheme +CharColorTintOrShade CharEscapement CharEscapementHeight CharFontCharSet
[Libreoffice-commits] core.git: include/oox oox/source
include/oox/drawingml/shape.hxx |2 ++ include/oox/drawingml/theme.hxx |3 --- oox/source/drawingml/theme.cxx |8 3 files changed, 2 insertions(+), 11 deletions(-) New commits: commit 829ea811e19fead7ad35049342136b592077674b Author: Stephan Bergmann AuthorDate: Mon Nov 15 12:22:11 2021 +0100 Commit: Stephan Bergmann CommitDate: Mon Nov 15 15:28:25 2021 +0100 Avoid some -Werror,-Wdeprecated-copy-with-user-provided-dtor ...after e6968f0485cfb2f6c941d11c438386e14a47095d "PPTX import: fix handling of theme overrides in the chart import" introduced a use of std::make_shared Change-Id: I5f6384b81e02034b6b2fdf3a3bad0148de4eb584 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125228 Tested-by: Tor Lillqvist Reviewed-by: Tor Lillqvist diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx index 96686f26f03c..57a47cbdb4e5 100644 --- a/include/oox/drawingml/shape.hxx +++ b/include/oox/drawingml/shape.hxx @@ -107,7 +107,9 @@ public: explicit Shape( const char* pServiceType = nullptr, bool bDefaultHeight = true ); explicit Shape( const ShapePtr& pSourceShape ); +Shape(Shape const &) = default; virtual ~Shape(); +Shape & operator =(Shape const &) = default; OUString& getServiceName(){ return msServiceName; } voidsetServiceName( const char* pServiceName ); diff --git a/include/oox/drawingml/theme.hxx b/include/oox/drawingml/theme.hxx index 6d64649f3a69..944e58b6e79c 100644 --- a/include/oox/drawingml/theme.hxx +++ b/include/oox/drawingml/theme.hxx @@ -56,9 +56,6 @@ class TextFont; class OOX_DLLPUBLIC Theme { public: -Theme(); -~Theme(); - void setStyleName( const OUString& rStyleName ) { maStyleName = rStyleName; } ClrScheme& getClrScheme() { return maClrScheme; } diff --git a/oox/source/drawingml/theme.cxx b/oox/source/drawingml/theme.cxx index ca26f389904e..036779d21711 100644 --- a/oox/source/drawingml/theme.cxx +++ b/oox/source/drawingml/theme.cxx @@ -23,14 +23,6 @@ namespace oox::drawingml { -Theme::Theme() -{ -} - -Theme::~Theme() -{ -} - namespace { template< typename Type >
[Libreoffice-commits] core.git: include/oox oox/source
include/oox/token/tokenmap.hxx |4 +--- oox/source/core/fasttokenhandler.cxx |2 +- oox/source/drawingml/customshapeproperties.cxx |2 +- oox/source/mathml/importutils.cxx |2 +- oox/source/token/tokenmap.cxx |6 ++ 5 files changed, 10 insertions(+), 6 deletions(-) New commits: commit 39f4fd491ca5abaa8a01b75eb500bb82248ff4aa Author: Noel Grandin AuthorDate: Fri Nov 12 19:36:06 2021 +0200 Commit: Noel Grandin CommitDate: Sat Nov 13 15:59:32 2021 +0100 rtl::Static->thread-safe static Change-Id: I3010494a750eee70ffe9c24c10417d0a3730dbd6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125120 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/oox/token/tokenmap.hxx b/include/oox/token/tokenmap.hxx index 60aeb8082001..db71c24c2371 100644 --- a/include/oox/token/tokenmap.hxx +++ b/include/oox/token/tokenmap.hxx @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -87,8 +86,7 @@ private: }; -struct StaticTokenMap : public ::rtl::Static< TokenMap, StaticTokenMap > {}; - +TokenMap& StaticTokenMap(); } // namespace oox diff --git a/oox/source/core/fasttokenhandler.cxx b/oox/source/core/fasttokenhandler.cxx index a57be30e0c2c..398772df058f 100644 --- a/oox/source/core/fasttokenhandler.cxx +++ b/oox/source/core/fasttokenhandler.cxx @@ -30,7 +30,7 @@ namespace oox::core { using namespace ::com::sun::star::uno; FastTokenHandler::FastTokenHandler() : -mrTokenMap( StaticTokenMap::get() ) +mrTokenMap( StaticTokenMap() ) { } diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx index ac11d2d7eaa6..977afab04a6a 100644 --- a/oox/source/drawingml/customshapeproperties.cxx +++ b/oox/source/drawingml/customshapeproperties.cxx @@ -55,7 +55,7 @@ CustomShapeProperties::CustomShapeProperties() uno::Sequence< sal_Int8 > const & CustomShapeProperties::getShapePresetTypeName() const { -return StaticTokenMap::get().getUtf8TokenName( mnShapePresetType ); +return StaticTokenMap().getUtf8TokenName( mnShapePresetType ); } sal_Int32 CustomShapeProperties::SetCustomShapeGuideValue( std::vector< CustomShapeGuide >& rGuideList, const CustomShapeGuide& rGuide ) diff --git a/oox/source/mathml/importutils.cxx b/oox/source/mathml/importutils.cxx index 962528acba2a..16f527389924 100644 --- a/oox/source/mathml/importutils.cxx +++ b/oox/source/mathml/importutils.cxx @@ -51,7 +51,7 @@ AttributeListBuilder::AttributeListBuilder( const uno::Reference< xml::sax::XFas OString tokenToString( int token ) { -uno::Sequence< sal_Int8 > const & aTokenNameSeq = StaticTokenMap::get().getUtf8TokenName( token & TOKEN_MASK ); +uno::Sequence< sal_Int8 > const & aTokenNameSeq = StaticTokenMap().getUtf8TokenName( token & TOKEN_MASK ); OString tokenname( reinterpret_cast< const char* >( aTokenNameSeq.getConstArray() ), aTokenNameSeq.getLength() ); if( tokenname.isEmpty()) tokenname = "???"; diff --git a/oox/source/token/tokenmap.cxx b/oox/source/token/tokenmap.cxx index 7cbba35009ae..1e51116192c6 100644 --- a/oox/source/token/tokenmap.cxx +++ b/oox/source/token/tokenmap.cxx @@ -87,6 +87,12 @@ sal_Int32 TokenMap::getTokenPerfectHash( const char *pStr, sal_Int32 nLength ) return pToken ? pToken->nToken : XML_TOKEN_INVALID; } +TokenMap& StaticTokenMap() +{ +static TokenMap SINGLETON; +return SINGLETON; +} + } // namespace oox /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
[Libreoffice-commits] core.git: include/oox oox/source
include/oox/token/namespacemap.hxx |7 ++- oox/source/core/fastparser.cxx |2 +- oox/source/core/xmlfilterbase.cxx |2 +- oox/source/token/namespacemap.cxx |7 +++ 4 files changed, 11 insertions(+), 7 deletions(-) New commits: commit bf2048b1d242c6d5b242f18903612cedf8eaef8e Author: Noel Grandin AuthorDate: Thu Nov 11 20:59:11 2021 +0200 Commit: Noel Grandin CommitDate: Sat Nov 13 13:01:06 2021 +0100 rtl::Static->thread-safe static in StaticNamespaceMap Change-Id: Iea6f7f96685e332407288af7ada36527acc83a8e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125119 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/oox/token/namespacemap.hxx b/include/oox/token/namespacemap.hxx index 26e4fdce95f7..c02a39ba7bf8 100644 --- a/include/oox/token/namespacemap.hxx +++ b/include/oox/token/namespacemap.hxx @@ -22,7 +22,6 @@ #include -#include #include #include @@ -40,10 +39,8 @@ struct NamespaceMap typedef std::map::const_iterator const_iterator; }; -/** Thread-save singleton of a map of all supported XML namespace URLs. */ -struct StaticNamespaceMap : public ::rtl::Static -{ -}; +/** Thread-safe singleton of a map of all supported XML namespace URLs. */ +NamespaceMap& StaticNamespaceMap(); } // namespace oox diff --git a/oox/source/core/fastparser.cxx b/oox/source/core/fastparser.cxx index 9524b1403a90..53e5eb78a849 100644 --- a/oox/source/core/fastparser.cxx +++ b/oox/source/core/fastparser.cxx @@ -62,7 +62,7 @@ InputStreamCloseGuard::~InputStreamCloseGuard() } // namespace FastParser::FastParser() : -mrNamespaceMap( StaticNamespaceMap::get() ) +mrNamespaceMap( StaticNamespaceMap() ) { // create a fast parser instance mxParser = new sax_fastparser::FastSaxParser; diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index 6c7aaac65476..7a9728e88f32 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -188,7 +188,7 @@ struct XmlFilterBaseImpl constexpr OUStringLiteral gaBinSuffix( u".bin" ); XmlFilterBaseImpl::XmlFilterBaseImpl() : -mrNamespaceMap(StaticNamespaceMap::get()) +mrNamespaceMap(StaticNamespaceMap()) { // register XML namespaces registerNamespaces(maFastParser); diff --git a/oox/source/token/namespacemap.cxx b/oox/source/token/namespacemap.cxx index 11e7c9f0e45f..1cfa48a1ca28 100644 --- a/oox/source/token/namespacemap.cxx +++ b/oox/source/token/namespacemap.cxx @@ -31,6 +31,13 @@ NamespaceMap::NamespaceMap() #include }; } + +/** Thread-safe singleton of a map of all supported XML namespace URLs. */ +NamespaceMap& StaticNamespaceMap() +{ +static NamespaceMap SINGLETON; +return SINGLETON; +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
[Libreoffice-commits] core.git: include/oox oox/source
include/oox/helper/propertymap.hxx |5 ++--- include/oox/token/propertynames.hxx | 18 +++--- oox/source/helper/propertymap.cxx |4 ++-- oox/source/token/propertynames.cxx |9 + 4 files changed, 12 insertions(+), 24 deletions(-) New commits: commit a75324ccabcf09c0f1bc7a1a43256aa37f0da751 Author: Noel Grandin AuthorDate: Sun Nov 7 18:45:58 2021 +0200 Commit: Noel Grandin CommitDate: Mon Nov 8 07:43:09 2021 +0100 rtl::Instance->thread-safe static in PropertyNameVector Change-Id: I3f595585b78c9e5ac32d9fc345c55a4eb14101c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124824 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/oox/helper/propertymap.hxx b/include/oox/helper/propertymap.hxx index 85635f314d5e..3e48c9817fd1 100644 --- a/include/oox/helper/propertymap.hxx +++ b/include/oox/helper/propertymap.hxx @@ -22,6 +22,7 @@ #include #include +#include #include #include @@ -37,8 +38,6 @@ namespace com::sun::star::beans { namespace oox { -struct PropertyNameVector; - typedef ::std::map< OUString, css::uno::Any > PropertyNameMap; @@ -114,7 +113,7 @@ public: static void dumpData( const css::uno::Reference& rXPropSet); #endif private: -const PropertyNameVector* mpPropNames; +const std::vector* mpPropNames; protected: std::map< sal_Int32, css::uno::Any > maProperties; diff --git a/include/oox/token/propertynames.hxx b/include/oox/token/propertynames.hxx index 84077359e1fe..91e07cbdd33b 100644 --- a/include/oox/token/propertynames.hxx +++ b/include/oox/token/propertynames.hxx @@ -16,30 +16,18 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - -#ifndef INCLUDED_OOX_TOKEN_PROPERTYNAMES_HXX -#define INCLUDED_OOX_TOKEN_PROPERTYNAMES_HXX +#pragma once #include -#include #include namespace oox { /** A vector that contains all predefined property names used in the filters. */ -struct PropertyNameVector : public ::std::vector -{ -PropertyNameVector(); -}; - -/** Thread-save singleton of a vector of all supported property names. */ -struct StaticPropertyNameVector : public ::rtl::Static -{ -}; +/** Thread-safe singleton of a vector of all supported property names. */ +const std::vector& GetPropertyNameVector(); } // namespace oox -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/helper/propertymap.cxx b/oox/source/helper/propertymap.cxx index afb6ef6ff6f6..83495dc879b1 100644 --- a/oox/source/helper/propertymap.cxx +++ b/oox/source/helper/propertymap.cxx @@ -180,7 +180,7 @@ sal_Bool SAL_CALL GenericPropertySet::hasPropertyByName( const OUString& rProper } // namespace PropertyMap::PropertyMap() : -mpPropNames( ::get() ) // pointer instead reference to get compiler generated copy c'tor and operator= +mpPropNames( () ) // pointer instead reference to get compiler generated copy c'tor and operator= { } @@ -221,7 +221,7 @@ void PropertyMap::assignUsed( const PropertyMap& rPropMap ) const OUString& PropertyMap::getPropertyName( sal_Int32 nPropId ) { OSL_ENSURE( (0 <= nPropId) && (nPropId < PROP_COUNT), "PropertyMap::getPropertyName - invalid property identifier" ); -return StaticPropertyNameVector::get()[ nPropId ]; +return GetPropertyNameVector()[ nPropId ]; } void PropertyMap::assignAll( const PropertyMap& rPropMap ) diff --git a/oox/source/token/propertynames.cxx b/oox/source/token/propertynames.cxx index b7c5e544143c..eadf0d5d4d7a 100644 --- a/oox/source/token/propertynames.cxx +++ b/oox/source/token/propertynames.cxx @@ -21,12 +21,13 @@ namespace oox { -PropertyNameVector::PropertyNameVector() -: ::std::vector{ +const std::vector& GetPropertyNameVector() +{ +static const std::vector NAMES{ // include auto-generated C array with property names as C strings #include -} -{ +}; +return NAMES; } } // namespace oox