[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 &rGraphic , bool bRelPathToMedia = false); +OUString writeGraphicToStorage(const Graphic &rGraphic , 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, boo
[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")); -CP
[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 a/sw/qa/extras/ooxm
[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)); +xChildWPSProperties->setPro
[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 //mnStart
[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); + mxWpgContext.set(stat
[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source
include/oox/vml/vmlshape.hxx|2 - include/oox/vml/vmlshapecontext.hxx |4 +- oox/source/token/properties.txt |1 oox/source/vml/vmlshape.cxx |7 ++- oox/source/vml/vmlshapecontext.cxx | 13 +++ sw/qa/extras/ooxmlexport/data/docxopenhyperlinkbox.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport16.cxx | 22 sw/source/filter/ww8/docxsdrexport.cxx | 29 +++- 8 files changed, 66 insertions(+), 12 deletions(-) New commits: commit e12d4c7e361f449fcf143a61caed92129aca3468 Author: Samuel Mehrbrodt AuthorDate: Wed Aug 4 21:57:39 2021 +0200 Commit: Samuel Mehrbrodt CommitDate: Thu Aug 5 09:00:45 2021 +0200 tdf#123643 Import/Export for hyperlinks on text boxes Change-Id: Ied436c4a619985f27e5854369d319d76c05890d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120028 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt diff --git a/include/oox/vml/vmlshape.hxx b/include/oox/vml/vmlshape.hxx index d90ecc2865bf..19c82384efcd 100644 --- a/include/oox/vml/vmlshape.hxx +++ b/include/oox/vml/vmlshape.hxx @@ -112,7 +112,6 @@ struct ShapeTypeModel OptValue moCropRight; ///< Specifies how much to crop the image from the right in as a fraction of picture size. 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. -OUString maHyperlink; ///< The hyperlink assigned to the shape explicitShapeTypeModel(); @@ -218,6 +217,7 @@ struct ShapeModel bool mbSignatureLineShowSignDate; bool mbSignatureLineCanAddComment; bool mbInGroup; +OUString maHyperlink; ///< The hyperlink assigned to the shape explicitShapeModel(); ~ShapeModel(); diff --git a/include/oox/vml/vmlshapecontext.hxx b/include/oox/vml/vmlshapecontext.hxx index 0d4b3ddd9e7e..49fc6826ae5a 100644 --- a/include/oox/vml/vmlshapecontext.hxx +++ b/include/oox/vml/vmlshapecontext.hxx @@ -107,8 +107,6 @@ public: private: /** Processes the 'style' attribute. */ voidsetStyle( const OUString& rStyle ); -/** Processes the 'href' attribute. */ -voidsetHyperlink( const OUString& rHyperlink ); /** Resolve a relation identifier to a fragment path. */ OptValue< OUString > decodeFragmentPath( const AttributeList& rAttribs, sal_Int32 nToken ) const; @@ -141,6 +139,8 @@ private: voidsetControl2( const OUString& rPoints ); /** Processes the 'path' attribute. */ voidsetVmlPath( const OUString& rPath ); +/** Processes the 'href' attribute. */ +voidsetHyperlink( const OUString& rHyperlink ); private: ShapeBase& mrShape; diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index 04b550e669ea..b35a5bc3cd4a 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -255,6 +255,7 @@ HoriOrientRelation HorizontalSplitMode HorizontalSplitPositionTwips Hyperlink +HyperLinkURL IgnoreBlankCells IgnoreCase IgnoreLeadingSpaces diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index d1029173a1db..4e4b848db941 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -770,6 +770,9 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes { PropertySet(xShape).setAnyProperty(PROP_WritingMode, uno::makeAny(nWritingMode)); } +// tdf#123626 +if (!maShapeModel.maHyperlink.isEmpty()) +PropertySet(xShape).setAnyProperty(PROP_HyperLinkURL, makeAny(maShapeModel.maHyperlink)); } else { @@ -814,8 +817,8 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes PropertySet(xShape).setAnyProperty(PROP_TextWordWrap, makeAny(maTypeModel.maWrapStyle == "square")); // tdf#123626 -if (!maTypeModel.maHyperlink.isEmpty()) -PropertySet(xShape).setAnyProperty(PROP_Hyperlink, makeAny(maTypeModel.maHyperlink)); +if (!maShapeModel.maHyperlink.isEmpty()) +PropertySet(xShape).setAnyProperty(PROP_Hyperlink, makeAny(maShapeModel.maHyperlink)); PropertySet(xShape).setAnyProperty(PROP_TextAutoGrowHeight, makeAny(maTypeModel.mbAutoHeight)); diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index d53a924c278a..82ca210e7588 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -312,7 +312,6 @@ ShapeTypeContext::ShapeTypeContext(ContextHandler2Helper const & rParent
[Libreoffice-commits] core.git: include/oox oox/source sw/qa
include/oox/export/DMLPresetShapeExport.hxx |6 oox/source/export/DMLPresetShapeExport.cxx | 191 +++ sw/qa/extras/ooxmlexport/data/fail_bracePair.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 10 + 4 files changed, 145 insertions(+), 62 deletions(-) New commits: commit 99a459dfdfd9f82ed3506708e131dd52a1a62384 Author: Attila Bakos (NISZ) AuthorDate: Thu Jun 24 10:03:28 2021 +0200 Commit: László Németh CommitDate: Thu Jul 1 13:50:59 2021 +0200 tdf#143028 DOCX: fix corrupt export of shape "bracePair" etc. Regression from commit 63cd67e5e18f01aca303131e148c80398a181a41 (tdf#92525 tdf#142398: fix export of simple custom shapes) Missing property in the shape export property list caused an exception. The return value false led to writing the shape transformation again, resulting a corrupt DOCX file. Optional values have been introduced and if one of the required value is unset, writing of the transformation happens only once. Thanks to Regina Henschel for reporting the problem. Change-Id: Ieae69bb1d2629fdbb91a84325cb100f0ad9d3e12 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117763 Tested-by: László Németh Reviewed-by: László Németh diff --git a/include/oox/export/DMLPresetShapeExport.hxx b/include/oox/export/DMLPresetShapeExport.hxx index 1ab460d26845..1baf1d44cabc 100644 --- a/include/oox/export/DMLPresetShapeExport.hxx +++ b/include/oox/export/DMLPresetShapeExport.hxx @@ -86,9 +86,9 @@ public: private: struct AdjustmentPointValueBase { -double nMaxVal; -double nMinVal; -double nCurrVal; +std::optional nMaxVal; +std::optional nMinVal; +std::optional nCurrVal; }; typedef AdjustmentPointValueBase RadiusAdjustmentValue; diff --git a/oox/source/export/DMLPresetShapeExport.cxx b/oox/source/export/DMLPresetShapeExport.cxx index 8e4ebafcce98..e8d2f26e2e5b 100644 --- a/oox/source/export/DMLPresetShapeExport.cxx +++ b/oox/source/export/DMLPresetShapeExport.cxx @@ -131,15 +131,22 @@ DMLPresetShapeExporter::RadiusAdjustmentValue DMLPresetShapeExporter::GetAdjustmentPointRadiusValue(sal_Int32 nPoint) { RadiusAdjustmentValue aRet; -auto aValPos = GetHandleValueOfModificationPoint(nPoint, u"Position") - .get(); -aRet.nMinVal = GetHandleValueOfModificationPoint(nPoint, u"RadiusRangeMinimum") - .get() - .Value.get(); -aRet.nMaxVal = GetHandleValueOfModificationPoint(nPoint, u"RadiusRangeMaximum") - .get() - .Value.get(); -aRet.nCurrVal = GetAdjustmentValues()[aValPos.First.Value.get()].Value.get(); +try +{ +auto aValPos = GetHandleValueOfModificationPoint(nPoint, u"Position") + .get(); +aRet.nMinVal = GetHandleValueOfModificationPoint(nPoint, u"RadiusRangeMinimum") + .get() + .Value.get(); +aRet.nMaxVal = GetHandleValueOfModificationPoint(nPoint, u"RadiusRangeMaximum") + .get() + .Value.get(); +aRet.nCurrVal = GetAdjustmentValues()[aValPos.First.Value.get()].Value.get(); +} +catch (...) +{ +// Do nothing. +} return aRet; }; @@ -147,11 +154,18 @@ DMLPresetShapeExporter::AngleAdjustmentValue DMLPresetShapeExporter::GetAdjustmentPointAngleValue(sal_Int32 nPoint) { AngleAdjustmentValue aRet; -auto aValPos = GetHandleValueOfModificationPoint(nPoint, u"Position") - .get(); -aRet.nMinVal = 0; -aRet.nMaxVal = 360; -aRet.nCurrVal = GetAdjustmentValues()[aValPos.Second.Value.get()].Value.get(); +try +{ +auto aValPos = GetHandleValueOfModificationPoint(nPoint, u"Position") + .get(); +aRet.nMinVal = 0; +aRet.nMaxVal = 360; +aRet.nCurrVal = GetAdjustmentValues()[aValPos.Second.Value.get()].Value.get(); +} +catch (...) +{ +// Do nothing. +} return aRet; }; @@ -159,15 +173,22 @@ DMLPresetShapeExporter::XAdjustmentValue DMLPresetShapeExporter::GetAdjustmentPointXValue(sal_Int32 nPoint) { XAdjustmentValue aRet; -auto aValPos = GetHandleValueOfModificationPoint(nPoint, u"Position") - .get(); -aRet.nMinVal = GetHandleValueOfModificationPoint(nPoint, u"RangeXMinimum") - .get() - .Value.get(); -aRet.nMaxVal = GetHandleValueOfModificationPoint(nPoint, u"RangeXMaximum") - .get() - .Value.get(); -aRet.nCurrVal = GetAdjustmentValues()[aValPos.First.Value.get()].Value.get(); +try +{ +auto aValPos = GetHandleValueOfModificationPoint(nPoint, u"Position") + .get(); +aRet.n
[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source
include/oox/export/drawingml.hxx |8 +++-- include/oox/export/vmlexport.hxx |6 ++- oox/source/export/drawingml.cxx | 31 ++- oox/source/export/vmlexport.cxx | 10 +++--- sw/qa/extras/ooxmlexport/data/tdf118535.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport16.cxx | 13 sw/source/filter/ww8/docxattributeoutput.cxx | 42 --- sw/source/filter/ww8/docxattributeoutput.hxx | 11 +++ sw/source/filter/ww8/docxexport.cxx |4 -- 9 files changed, 88 insertions(+), 37 deletions(-) New commits: commit 797fef38612fb2fd62d1f6591619b9361e526bca Author: Daniel Arato (NISZ) AuthorDate: Tue Mar 9 14:11:11 2021 +0100 Commit: László Németh CommitDate: Fri Mar 26 13:07:57 2021 +0100 tdf#118535 DOCX export: save header image once Writer used to dump the same image file as many times as it was featured in different headers or footers in the document, bloating the .docx file size. This is countered by making all "relationships" in the header*.xml.rels files point to the same image. Change-Id: I44d72630289c721d58d8f7e208517df2f1fe621c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112656 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 2cd17e6defb0..cfcad30fa257 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -125,8 +125,10 @@ public: 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; -/// Store the RelId of a graphic based on its checksum. -virtual void CacheRelId(BitmapChecksum nChecksum, const OUString& rRelId) = 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; @@ -192,7 +194,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 &rGraphic , bool bRelPathToMedia = false); +OUString WriteImage( const Graphic &rGraphic , bool bRelPathToMedia = false, OUString* pFileName = nullptr ); 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 dd5edc57c208..9a53a07652c8 100644 --- a/include/oox/export/vmlexport.hxx +++ b/include/oox/export/vmlexport.hxx @@ -67,8 +67,10 @@ public: 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 of a graphic based on its checksum. -virtual void CacheRelId(BitmapChecksum nChecksum, const OUString& rRelId) = 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; protected: VMLTextExport() {} virtual ~VMLTextExport() {} diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 67f26e71daea..32780296ce89 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1162,7 +1162,7 @@ const char* DrawingML::GetRelationCompPrefix() const return "unknown"; } -OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia ) +OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia, OUString* pFileName ) { GfxLink aLink = rGraphic.GetGfxLink (); OUString sMediaType; @@ -1266,15 +1266,18 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia ) sRelationCompPrefix = "../"; else sRelationCompPrefix = GetRelationCompPrefix(); +OUString sPath = OUStringBuffer() + .appendAscii( sRelationCompPrefix.getStr() ) + .appendAscii( sRelPathToMedia.getStr() ) + .append( static_cast(mnImageCounter ++) ) +
[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source
include/oox/export/vmlexport.hxx |6 oox/source/export/vmlexport.cxx |8 sw/qa/extras/ooxmlexport/data/shape-atpage-in-table.fodt | 185 +++ sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 11 sw/source/filter/ww8/docxattributeoutput.cxx |3 sw/source/filter/ww8/docxsdrexport.cxx |6 6 files changed, 214 insertions(+), 5 deletions(-) New commits: commit 60b61fdaf85cecea0f972fc435530ee5d7492c98 Author: Michael Stahl AuthorDate: Mon Feb 22 14:11:05 2021 +0100 Commit: Michael Stahl CommitDate: Mon Feb 22 19:09:36 2021 +0100 oox: VML export: write o:allowincell attribute on shapes Apparently the default is "t", which causes a fly that is anchored at-page with the first content on the page being a table to be wrongly positioned. Change-Id: Iba1b961c6e884b2a55928952937187732ef73a5a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111336 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx index 4ee885fba6bd..dd5edc57c208 100644 --- a/include/oox/export/vmlexport.hxx +++ b/include/oox/export/vmlexport.hxx @@ -86,6 +86,7 @@ class OOX_DLLPUBLIC VMLExport : public EscherEx sal_Int16 m_eHOri, m_eVOri, m_eHRel, m_eVRel; rtl::Reference m_pWrapAttrList; bool m_bInline; // css::text::TextContentAnchorType_AS_CHARACTER +bool m_IsFollowingTextFlow = false; /// The object we're exporting. const SdrObject* m_pSdrObject; @@ -140,8 +141,9 @@ public: /// Export the sdr object as VML. /// /// Call this when you need to export the object as VML. -OString const & AddSdrObject( const SdrObject& rObj, sal_Int16 eHOri = -1, -sal_Int16 eVOri = -1, sal_Int16 eHRel = -1, +OString const & AddSdrObject( const SdrObject& rObj, +bool const bIsFollowingTextFlow = false, +sal_Int16 eHOri = -1, sal_Int16 eVOri = -1, sal_Int16 eHRel = -1, sal_Int16 eVRel = -1, sax_fastparser::FastAttributeList* pWrapAttrList = nullptr, const bool bOOxmlExport = false ); diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index 07157edc3f85..9c6b89ef7dd7 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -1400,6 +1400,8 @@ sal_Int32 VMLExport::StartShape() break; } +m_pShapeAttrList->addNS(XML_o, XML_allowincell, m_IsFollowingTextFlow ? "t" : "f"); + // add style m_pShapeAttrList->add( XML_style, m_ShapeStyle.makeStringAndClear() ); @@ -1530,7 +1532,9 @@ void VMLExport::EndShape( sal_Int32 nShapeElement ) m_pSerializer->endElementNS( XML_v, nShapeElement ); } -OString const & VMLExport::AddSdrObject( const SdrObject& rObj, sal_Int16 eHOri, sal_Int16 eVOri, sal_Int16 eHRel, sal_Int16 eVRel, +OString const & VMLExport::AddSdrObject( const SdrObject& rObj, +bool const bIsFollowingTextFlow, +sal_Int16 eHOri, sal_Int16 eVOri, sal_Int16 eHRel, sal_Int16 eVRel, FastAttributeList* pWrapAttrList, const bool bOOxmlExport ) { @@ -1541,6 +1545,7 @@ OString const & VMLExport::AddSdrObject( const SdrObject& rObj, sal_Int16 eHOri, m_eVRel = eVRel; m_pWrapAttrList = pWrapAttrList; m_bInline = false; +m_IsFollowingTextFlow = bIsFollowingTextFlow; EscherEx::AddSdrObject(rObj, bOOxmlExport); return m_sShapeId; } @@ -1554,6 +1559,7 @@ OString const & VMLExport::AddInlineSdrObject( const SdrObject& rObj, const bool m_eVRel = -1; m_pWrapAttrList.clear(); m_bInline = true; +m_IsFollowingTextFlow = true; EscherEx::AddSdrObject(rObj, bOOxmlExport); return m_sShapeId; } diff --git a/sw/qa/extras/ooxmlexport/data/shape-atpage-in-table.fodt b/sw/qa/extras/ooxmlexport/data/shape-atpage-in-table.fodt new file mode 100644 index ..42c9c7790509 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/shape-atpage-in-table.fodt @@ -0,0 +1,185 @@ + + +http://openoffice.org/2004/office"; xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/"; xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:rpt="http://openoffice.org/2005/report"; xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http://openoffice.org/200 4/write
[Libreoffice-commits] core.git: include/oox oox/source sw/qa
include/oox/vml/vmlshape.hxx |5 + oox/source/vml/vmlshape.cxx | 35 -- sw/qa/extras/ooxmlexport/data/tdf97517_testVmlLineShapeMirroredX.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport14.cxx| 15 4 files changed, 49 insertions(+), 6 deletions(-) New commits: commit ed943c6afeb33b9fee0ef530df7db592aa152a73 Author: Regényi Balázs AuthorDate: Thu Oct 22 13:36:25 2020 +0200 Commit: László Németh CommitDate: Mon Oct 26 18:22:18 2020 +0100 tdf#97517 DOCX VML shape import: fix missing vertical mirroring The MirroredX property is set (in the CustomShapeGeometry property), but it is not supported for the LineShape by UNO, so we have to make the mirroring during importing. Change-Id: I65a1f9a115a003c056ae31f4bc217206a0e6dcd8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104656 Tested-by: Jenkins Reviewed-by: László Németh diff --git a/include/oox/vml/vmlshape.hxx b/include/oox/vml/vmlshape.hxx index 119f711a4538..7703b311c757 100644 --- a/include/oox/vml/vmlshape.hxx +++ b/include/oox/vml/vmlshape.hxx @@ -360,6 +360,11 @@ class LineShape final : public SimpleShape { public: explicitLineShape( Drawing& rDrawing ); +virtual css::uno::Reference< css::drawing::XShape > +implConvertAndInsert( +const css::uno::Reference< css::drawing::XShapes >& rxShapes, +const css::awt::Rectangle& rShapeRect ) const override; + private: /** Returns the absolute shape rectangle. */ diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index d70a9563e106..54f1fcec5ae6 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -1004,11 +1004,39 @@ Reference< XShape > PolyLineShape::implConvertAndInsert( const Reference< XShape return xShape; } +namespace +{ +void doMirrorX(SdrObject* pShape) +{ +Point aCenter(pShape->GetSnapRect().Center()); +Point aPoint2(aCenter); +aPoint2.setY(aPoint2.getY() + 1); +pShape->NbcMirror(aCenter, aPoint2); +} +} + LineShape::LineShape(Drawing& rDrawing) : SimpleShape(rDrawing, "com.sun.star.drawing.LineShape") { } +Reference LineShape::implConvertAndInsert(const Reference& rxShapes, const awt::Rectangle& rShapeRect) const +{ +Reference xShape = SimpleShape::implConvertAndInsert(rxShapes, rShapeRect); +// Handle vertical flip. +// tdf#97517 The MirroredX property (in the CustomShapeGeometry property) is not supported for +// the LineShape by UNO, so we have to make the mirroring here +if (!maTypeModel.maFlip.isEmpty()) +{ +if (SdrObject* pShape = GetSdrObjectFromXShape(xShape)) +{ +if (maTypeModel.maFlip.startsWith("x")) +doMirrorX(pShape); +} +} +return xShape; +} + awt::Rectangle LineShape::getAbsRectangle() const { const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper(); @@ -1150,12 +1178,7 @@ Reference< XShape > BezierShape::implConvertAndInsert( const Reference< XShapes if (SdrObject* pShape = GetSdrObjectFromXShape(xShape)) { if (maTypeModel.maFlip.startsWith("x")) -{ -Point aCenter(pShape->GetSnapRect().Center()); -Point aPoint2(aCenter); -aPoint2.setY(aPoint2.getY() + 1); -pShape->NbcMirror(aCenter, aPoint2); -} +doMirrorX(pShape); if (maTypeModel.maFlip.endsWith("y")) { Point aCenter(pShape->GetSnapRect().Center()); diff --git a/sw/qa/extras/ooxmlexport/data/tdf97517_testVmlLineShapeMirroredX.docx b/sw/qa/extras/ooxmlexport/data/tdf97517_testVmlLineShapeMirroredX.docx new file mode 100644 index ..75e9d8573bb3 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf97517_testVmlLineShapeMirroredX.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index 3ac228db6cca..8fa7391abcc7 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -40,6 +41,8 @@ #include #include +using namespace com::sun::star; + char const DATA_DIRECTORY[] = "/sw/qa/extras/ooxmlexport/data/"; class Test : public SwModelTestBase @@ -1284,6 +1287,18 @@ DECLARE_OOXMLEXPORT_TEST(testVmlShapeTextWordWrap, "tdf97618_testVmlShapeTextWor assertXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "width", "2500"); } +DECLARE_OOXMLEXPORT_TEST(testVmlLineShapeMirroredX, "tdf97517_testVmlLineShapeMirroredX.docx") +{ +// tdf#97517 The "flip:x" was not handled for VML line shapes. +xmlDocUniquePtr pXmlDoc =
[Libreoffice-commits] core.git: include/oox oox/source sw/qa
include/oox/export/drawingml.hxx |4 oox/source/export/drawingml.cxx | 47 +- oox/source/export/shapes.cxx |4 sw/qa/extras/ooxmlexport/data/tdf101122_noFillForCustomShape.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 16 +++ 5 files changed, 67 insertions(+), 4 deletions(-) New commits: commit 9310e47e2ce71348a16e5412131946348833f4b2 Author: Regényi Balázs AuthorDate: Mon Oct 12 09:58:35 2020 +0200 Commit: László Németh CommitDate: Tue Oct 13 15:19:57 2020 +0200 tdf#101122 DOCX custom shape export: remove bad fill of (simplified export) of not filled custom shapes by adding missing fill="none" to a:path. Note: in OpenDocument, unfilled shape path is defined by draw:enhanced-path command "F", see section 19.145 in ODF v1.2. Co-authored-by: Szabolcs Tóth Change-Id: I0be2aada3deb06828216e0441c91c389a673f87c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104205 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 11bf303e92ff..a4ef6af0530f 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -171,6 +171,7 @@ protected: void WriteGlowEffect(const css::uno::Reference& rXPropSet); void WriteSoftEdgeEffect(const css::uno::Reference& rXPropSet); +bool HasEnhancedCustomShapeSegmentCommand(const css::uno::Reference& rXShape, const sal_Int16 nCommand); public: DrawingML( ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB, DocumentType eDocumentType = DOCUMENT_PPTX, DMLTextExport* pTextExport = nullptr ) @@ -275,7 +276,8 @@ public: static sal_Int32 GetCustomGeometryPointValue( const css::drawing::EnhancedCustomShapeParameter& rParam, const SdrObjCustomShape& rSdrObjCustomShape); -void WritePolyPolygon( const tools::PolyPolygon& rPolyPolygon, const bool bClosed ); +void WritePolyPolygon(const css::uno::Reference& rXShape, + const tools::PolyPolygon& rPolyPolygon, const bool bClosed); void WriteFill( const css::uno::Reference< css::beans::XPropertySet >& xPropSet ); void WriteShapeStyle( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet ); void WriteShapeEffects( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet ); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index c19b030ad642..8b7c4add1f78 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -3582,7 +3582,8 @@ sal_Int32 DrawingML::GetCustomGeometryPointValue( return nValue; } -void DrawingML::WritePolyPolygon( const tools::PolyPolygon& rPolyPolygon, const bool bClosed ) +void DrawingML::WritePolyPolygon(const css::uno::Reference& rXShape, + const tools::PolyPolygon& rPolyPolygon, const bool bClosed) { // In case of Writer, the parent element is , and there the // element is not optional. @@ -3599,9 +3600,15 @@ void DrawingML::WritePolyPolygon( const tools::PolyPolygon& rPolyPolygon, const const tools::Rectangle aRect( rPolyPolygon.GetBoundRect() ); +// tdf#101122 +std::optional sFill; +if (HasEnhancedCustomShapeSegmentCommand(rXShape, css::drawing::EnhancedCustomShapeSegmentCommand::NOFILL)) +sFill = "none"; // for possible values see ST_PathFillMode in OOXML standard + // Put all polygons of rPolyPolygon in the same path element // to subtract the overlapped areas. mpFS->startElementNS( XML_a, XML_path, +XML_fill, sFill, XML_w, OString::number(aRect.GetWidth()), XML_h, OString::number(aRect.GetHeight()) ); @@ -4191,6 +4198,44 @@ void DrawingML::WriteSoftEdgeEffect(const css::uno::Reference& rXShape, const sal_Int16 nCommand) +{ +try +{ +uno::Reference xPropSet(rXShape, uno::UNO_QUERY_THROW); +if (!GetProperty(xPropSet, "CustomShapeGeometry")) +return false; +Sequence aCustomShapeGeometryProps; +mAny >>= aCustomShapeGeometryProps; +for (const beans::PropertyValue& rGeomProp : std::as_const(aCustomShapeGeometryProps)) +{ +if (rGeomProp.Name == "Path") +{ +uno::Sequence aPathProps; +rGeomProp.Value >>= aPathProps; +for (const beans::PropertyValue& rPathProp : std::as_const(aPathProps)) +{ +if (rPathProp.Name == "Segments") +{ +uno::Sequence aSegments; +rPathProp.Value >>= aSegments; +for (const auto& rSegment : std::as_const(aSegments)) +{ +
[Libreoffice-commits] core.git: include/oox oox/source sw/qa
include/oox/export/drawingml.hxx |2 + oox/source/drawingml/shape.cxx|3 + oox/source/export/drawingml.cxx | 57 +- sw/qa/extras/ooxmlexport/ooxmlexport6.cxx |7 ++- 4 files changed, 58 insertions(+), 11 deletions(-) New commits: commit ce405819f36496398e5ca389f12eafb3cfdc64ae Author: Regényi Balázs AuthorDate: Tue Sep 15 11:38:18 2020 +0200 Commit: László Németh CommitDate: Wed Sep 23 12:06:16 2020 +0200 tdf#136566 XLSX export: fix lost scheme based line colors by converting scheme color identifiers to colors temporarily. Because we haven't exported theme XML yet, we could not import shapes of these exported documents correctly, resulting missing lines. Co-authored-by: Szabolcs Toth Change-Id: I4f3d19cb8a9a851fb07a97f798195011e420d441 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102722 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 2760d2fe64a0..11bf303e92ff 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -188,6 +188,7 @@ public: 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 ); +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 WriteLineArrow( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, bool bLineStart ); @@ -195,6 +196,7 @@ public: 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 ); void WriteSolidFill( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet ); void WriteGradientFill( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet ); diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 90d9e5379dde..02b89312d200 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1279,6 +1279,9 @@ Reference< XShape > const & Shape::createAndInsert( if( !aLineProperties.maLineFill.maFillColor.isPlaceHolder() && !sLnColorFillScheme.isEmpty() ) { aProperties.push_back(comphelper::makePropertyValue("SpPrLnSolidFillSchemeClr", sLnColorFillScheme)); +auto aResolvedSchemeClr = aLineProperties.maLineFill.maFillColor; +aResolvedSchemeClr.clearTransformations(); + aProperties.push_back(comphelper::makePropertyValue("SpPrLnSolidFillResolvedSchemeClr", aResolvedSchemeClr.getColor(rGraphicHelper, nFillPhClr))); aProperties.push_back(comphelper::makePropertyValue("SpPrLnSolidFillSchemeClrTransformations", aLineProperties.maLineFill.maFillColor.getTransformations())); } putPropertiesToGrabBag(comphelper::containerToSequence(aProperties)); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 87e80e4ce12a..8d3cbd23a6a7 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -273,25 +273,35 @@ bool DrawingML::GetPropertyAndState( const Reference< XPropertySet >& rXProperty return false; } -void DrawingML::WriteColor( ::Color nColor, sal_Int32 nAlpha ) +namespace +{ +/// Gets hexa value of color on string format. +OString getColorStr(const ::Color nColor) { // Transparency is a separate element. -OString sColor = OString::number( sal_uInt32(nColor) & 0x00FF, 16 ); -if( sColor.getLength() < 6 ) +OString sColor = OString::number(sal_uInt32(nColor) & 0x00FF, 16); +if (sColor.getLength() < 6) { -OStringBuffer sBuf( "0" ); +OStringBuffer sBuf("0"); int remains = 5 - sColor.getLength(); -while( remains > 0 ) +while (remains > 0) { -sBuf.append( "0" ); +sBuf.append("0"); remains--; } -sBuf.append( sColor ); +sBuf.append(sColor); sColor = sBuf.getStr(); } +return sColor; +} +} + +void DrawingML::WriteColor( ::Color nColor, sal_Int32 nAlpha ) +{ +const auto sColor = getColorStr(nColor);
[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source
include/oox/export/vmlexport.hxx |1 oox/source/export/vmlexport.cxx | 78 +++ sw/qa/extras/ooxmlexport/data/tdf135667.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 17 + sw/source/filter/ww8/docxattributeoutput.cxx | 291 --- sw/source/filter/ww8/docxattributeoutput.hxx |4 6 files changed, 288 insertions(+), 103 deletions(-) New commits: commit 65bc6e12ef8a681ec4597635d0b3d86e9ac355d3 Author: Attila Bakos AuthorDate: Fri Sep 4 11:48:16 2020 +0200 Commit: László Németh CommitDate: Fri Sep 11 17:27:24 2020 +0200 tdf#135667 DOCX export: fix border line of OLE objects which wasn't exported. Note: the enlarged monolithic export function was split in the following new functions: - WriteOLEShape() exports the replacement shape of the OLE object. - GetOLEStyle() returns the string value of the style attribute. - ExportOLESurround() handles the surround settings. Also add GetVMLShapeTypeDefinition() to reuse picture frame VML formula string used by VMLExport. Co-authored-by: Arató Dániel (NISZ) Change-Id: I29800a50c60a824a14849ac286a18e5e2f97c689 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102034 Tested-by: László Németh Reviewed-by: László Németh diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx index 06dbbc57a21c..94aeb8601f1a 100644 --- a/include/oox/export/vmlexport.hxx +++ b/include/oox/export/vmlexport.hxx @@ -145,6 +145,7 @@ public: voidSetHashMarkForType(bool bUseHashMarkForType) { m_bUseHashMarkForType = bUseHashMarkForType; } voidOverrideShapeIDGen(bool bOverrideShapeIdGeneration, const OString& sShapeIDPrefix = OString()); +static OString GetVMLShapeTypeDefinition(const OString& sShapeID, const bool bIsPictureFrame); protected: /// Add an attribute to the generated element. diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index 0a0a634708bf..dea03c552cee 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -1219,6 +1219,46 @@ sal_uInt32 VMLExport::GenerateShapeId() return m_nShapeIDCounter++; } +OString VMLExport::GetVMLShapeTypeDefinition( const OString& sShapeID, const bool bIsPictureFrame ) +{ +OString sShapeType; +if ( !bIsPictureFrame ) +// We don't have a shape definition for host control in presetShapeDefinitions.xml +// So use a definition copied from DOCX file created with MSO +sShapeType = "\n" +"\n" +"\n" +"\n" +""; +else +// We don't have a shape definition for picture frame in presetShapeDefinitions.xml +// So use a definition copied from DOCX file created with MSO +sShapeType = "\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +"\n" +""; +return sShapeType; +} + sal_Int32 VMLExport::StartShape() { if ( m_nShapeType == ESCHER_ShpInst_Nil ) @@ -1237,56 +1277,22 @@ sal_Int32 VMLExport::StartShape() case ESCHER_ShpInst_Line: nShapeElement = XML_line; break; case ESCHER_ShpInst_HostControl: { -// We don't have a shape definition for host control in presetShapeDefinitions.xml -// So use a definition copied from DOCX file created with MSO bReferToShapeType = true; nShapeElement = XML_shape; if ( !m_aShapeTypeWritten[ m_nShapeType ] ) { -OString sShapeType = -"\n" -"\n" -"\n" -"\n" -""; -m_pSerializer->write(sShapeType); + m_pSerializer->write(GetVMLShapeTypeDefinition(OString::number(m_nShapeType), false)); m_aShapeTypeWritten[ m_nShapeType ] = true; } break; } case ESCHER_ShpInst_PictureFrame: { -// We don't have a shape definition for picture frame in presetShapeDefinitions.xml -// So use a definition copied from DOCX file created with MSO bReferToShapeType = true; nShapeElement = XML_shape; if ( !m_aShapeTypeWritten[ m_nShapeType
[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source writerfilter/source
include/oox/ole/oleobjecthelper.hxx |2 +- oox/source/ole/oleobjecthelper.cxx | 10 +++--- sw/qa/extras/ooxmlexport/data/tdf131537.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport5.cxx|7 +++ sw/source/filter/ww8/docxattributeoutput.cxx | 16 +++- writerfilter/source/dmapper/OLEHandler.cxx |4 ++-- 6 files changed, 24 insertions(+), 15 deletions(-) New commits: commit 07dcb0dab759d4ab535d99c0e6d326959906b87e Author: Daniel Arato (NISZ) AuthorDate: Mon Aug 31 12:48:07 2020 +0200 Commit: László Németh CommitDate: Thu Sep 3 18:34:55 2020 +0200 tdf#131537 DOCX export: fix OLE "Display as icon" for example to avoid converting OLE icons of an ODF document to an icon-size embedded spreadsheet. When creating a new OLE object in Writer the user has an option called "Display as icon" which causes the actual contents of the OLE to be hidden when rendered in the document. This setting, referred to internally as the DrawAspect of the object, was imported fine, but when exported to a .docx it always had the value "Content" (corresponding to "Display as icon" being unchecked). Now OLE objects with "Display as icon" checked are saved with DrawAspect="Icon". A grab bag entry was previously used to let the DrawAspect setting flow through Writer from OOXML import to export. Now this workaround is no longer needed and is removed by the present commit. Change-Id: I46ea4fc95a26bcd1f85e19a506c0965f73d4257a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101711 Tested-by: László Németh Reviewed-by: László Németh diff --git a/include/oox/ole/oleobjecthelper.hxx b/include/oox/ole/oleobjecthelper.hxx index a9d6bfec54bd..d2506f3d4949 100644 --- a/include/oox/ole/oleobjecthelper.hxx +++ b/include/oox/ole/oleobjecthelper.hxx @@ -76,7 +76,7 @@ private: OOX_DLLPUBLIC void SaveInteropProperties( css::uno::Reference const& xModel, OUString const& rObjectName, OUString const* pOldObjectName, - OUString const& rProgId, OUString const& rDrawAspect); + OUString const& rProgId); } // namespace oox::ole diff --git a/oox/source/ole/oleobjecthelper.cxx b/oox/source/ole/oleobjecthelper.cxx index b6c4edb4314e..6716ac1ebb29 100644 --- a/oox/source/ole/oleobjecthelper.cxx +++ b/oox/source/ole/oleobjecthelper.cxx @@ -87,7 +87,7 @@ OleObjectHelper::~OleObjectHelper() // just "application/vnd.sun.star.oleobject" void SaveInteropProperties(uno::Reference const& xModel, OUString const& rObjectName, OUString const*const pOldObjectName, - OUString const& rProgId, OUString const& rDrawAspect) + OUString const& rProgId) { static const char sEmbeddingsPropName[] = "EmbeddedObjects"; @@ -100,11 +100,9 @@ void SaveInteropProperties(uno::Reference const& xModel, if (aGrabBag.find(sEmbeddingsPropName) != aGrabBag.end()) objectsList << aGrabBag[sEmbeddingsPropName]; -uno::Sequence< beans::PropertyValue > aGrabBagAttribute(2); +uno::Sequence< beans::PropertyValue > aGrabBagAttribute(1); aGrabBagAttribute[0].Name = "ProgID"; aGrabBagAttribute[0].Value <<= rProgId; -aGrabBagAttribute[1].Name = "DrawAspect"; -aGrabBagAttribute[1].Value <<= rDrawAspect; // If we got an "old name", erase that first. if (pOldObjectName) @@ -148,9 +146,7 @@ bool OleObjectHelper::importOleObject( PropertyMap& rPropMap, const OleObjectInf xOutStrm->writeBytes( rOleObject.maEmbeddedData ); xOutStrm->closeOutput(); -SaveInteropProperties(m_xModel, aObjectId, nullptr, -rOleObject.maProgId, -rOleObject.mbShowAsIcon ? OUString("Icon") : OUString("Content")); +SaveInteropProperties(m_xModel, aObjectId, nullptr, rOleObject.maProgId); OUString aUrl = mxResolver->resolveEmbeddedObjectURL( aObjectId ); OSL_ENSURE( aUrl.match( g_aEmbeddedObjScheme ), "OleObjectHelper::importOleObject - unexpected URL scheme" ); diff --git a/sw/qa/extras/ooxmlexport/data/tdf131537.odt b/sw/qa/extras/ooxmlexport/data/tdf131537.odt new file mode 100644 index ..21f396368917 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf131537.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index 6c07f4534ed4..af9cd5c86a56 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -909,6 +909,13 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo80898, "fdo80898.docx") "Word.Document.8"); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testOleIconDrawAspect, "tdf131537.odt") +{ +xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); +assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/w:object/o:OLEObject", +"DrawAspect", "Icon"); +} + DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTableCel
[Libreoffice-commits] core.git: include/oox oox/source sw/qa
include/oox/drawingml/color.hxx |4 + include/oox/helper/attributelist.hxx|6 + oox/source/drawingml/color.cxx | 37 + oox/source/drawingml/textcharacterpropertiescontext.cxx |7 + oox/source/helper/attributelist.cxx | 32 sw/qa/extras/ooxmlimport/data/tdf131841_HighlightColorGroupedShape.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx| 39 ++ 7 files changed, 121 insertions(+), 4 deletions(-) New commits: commit c431661ac716178305f64d98ce81aa8276bdbe8f Author: Szabolcs AuthorDate: Fri Apr 3 11:34:07 2020 +0200 Commit: László Németh CommitDate: Tue Apr 28 10:08:33 2020 +0200 tdf#131841 DOCX DrawingML shape import: Fixed missing HighlightColor Implemented highlight color in grouped shapes. It was missing completely. Co-Author: Balázs Regényi Change-Id: I51207d01a205fbb24abc51c0d69042d6747570a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91619 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh diff --git a/include/oox/drawingml/color.hxx b/include/oox/drawingml/color.hxx index 2d33eb6e3136..23144a8fd5d5 100644 --- a/include/oox/drawingml/color.hxx +++ b/include/oox/drawingml/color.hxx @@ -45,6 +45,8 @@ public: static ::Color getDmlPresetColor( sal_Int32 nToken, ::Color nDefaultRgb ); /** Returns the RGB value for the passed VML color token, or nDefaultRgb on error. */ static ::Color getVmlPresetColor( sal_Int32 nToken, ::Color nDefaultRgb ); +/** Returns the RGB value for the passed VML color token, or nDefaultRgb on error. */ +static ::Color getHighlightColor(sal_Int32 nToken, ::Color nDefaultRgb); /** Sets the color to unused state. */ voidsetUnused(); @@ -57,6 +59,8 @@ public: voidsetHslClr( sal_Int32 nHue, sal_Int32 nSat, sal_Int32 nLum ); /** Sets a predefined color from the a:prstClr element. */ voidsetPrstClr( sal_Int32 nToken ); +/** Sets a predefined color from the w:highlight element. */ +voidsetHighlight(sal_Int32 nToken); /** Sets a scheme color from the a:schemeClr element. */ voidsetSchemeClr( sal_Int32 nToken ); /** Sets the scheme name from the a:schemeClr element for interoperability purposes */ diff --git a/include/oox/helper/attributelist.hxx b/include/oox/helper/attributelist.hxx index 2d65ad889699..0bf70a0f98ce 100644 --- a/include/oox/helper/attributelist.hxx +++ b/include/oox/helper/attributelist.hxx @@ -28,6 +28,7 @@ #include #include #include +#include namespace com { namespace sun { namespace star { namespace xml { namespace sax { class XFastAttributeList; } } @@ -39,6 +40,8 @@ namespace sax_fastparser { namespace oox { +/* Get the color tokens from their string representatives. */ +sal_Int32 getHighlightColorTokenFromString(const OUString& sColorName); /** Static helpers for conversion of strings to attribute values of various different data types. @@ -91,6 +94,9 @@ public: /** Returns the token identifier of the value of the specified attribute. */ OptValue< 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 > getString( sal_Int32 nAttrToken ) const; diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx index 5410d5fc7498..33e3c3dcd053 100644 --- a/oox/source/drawingml/color.cxx +++ b/oox/source/drawingml/color.cxx @@ -39,13 +39,15 @@ struct PresetColorsPool ColorVector maDmlColors;/// Predefined colors in DrawingML, indexed by XML token. ColorVector maVmlColors;/// Predefined colors in VML, indexed by XML token. +ColorVector maHighlightColors; /// Predefined colors in DrawingML for highlight, indexed by XML token. explicitPresetColorsPool(); }; PresetColorsPool::PresetColorsPool() : maDmlColors( static_cast< size_t >( XML_TOKEN_COUNT ), API_RGB_TRANSPARENT ), -maVmlColors( static_cast< size_t >( XML_TOKEN_COUNT ), API_RGB_TRANSPARENT ) +maVmlColors( static_cast< size_t >( XML_TOKEN_COUNT ), API_RGB_TRANSPARENT ), +maHighlightColors( static_cast(XML_TOKEN_COUNT), API_RGB_TRANSPARENT ) { // predefined colors in DrawingML (map XML token identifiers to RGB values) static const std::pair spnDmlColors[] = @@ -138,6 +140,22 @@ PresetColorsPool::PresetColorsPool() : }; for(auto const& nEntry : spnVmlColors) maVmlColors[ static_cast< size_t >(nEn
[Libreoffice-commits] core.git: include/oox oox/source sw/qa
include/oox/core/filterdetect.hxx |9 ++- oox/source/core/filterdetect.cxx | 32 +++-- oox/source/core/xmlfilterbase.cxx |4 +++ sw/qa/uitest/writer_tests7/data/tdf131936.docx |binary sw/qa/uitest/writer_tests7/tdf131936.py| 32 + 5 files changed, 74 insertions(+), 3 deletions(-) New commits: commit ff93e4977cb1e23f355d248a77e8d0e56bb0f4b9 Author: Samuel Mehrbrodt AuthorDate: Wed Apr 15 14:59:15 2020 +0200 Commit: Samuel Mehrbrodt CommitDate: Thu Apr 23 12:00:28 2020 +0200 tdf#131936 Correctly detect OOXML variant on import Change-Id: I29a6b0454bf741ce8ad49078597b3412a83dedb9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92278 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt diff --git a/include/oox/core/filterdetect.hxx b/include/oox/core/filterdetect.hxx index 47de23055c60..9b34de75b09c 100644 --- a/include/oox/core/filterdetect.hxx +++ b/include/oox/core/filterdetect.hxx @@ -49,6 +49,12 @@ namespace oox { class AttributeList; } namespace oox { namespace core { +enum class OOXMLVariant { +ECMA_Transitional, +ISO_Transitional, +ISO_Strict +}; + /** Document handler specifically designed for detecting OOXML file formats. @@ -79,7 +85,7 @@ public: private: voidparseRelationship( const AttributeList& rAttribs ); -static OUString getFilterNameFromContentType( const OUString& rContentType, const OUString& rFileName ); +OUStringgetFilterNameFromContentType( const OUString& rContentType, const OUString& rFileName ); voidparseContentTypesDefault( const AttributeList& rAttribs ); voidparseContentTypesOverride( const AttributeList& rAttribs ); @@ -90,6 +96,7 @@ private: OUStringmaFileName; ContextVector maContextStack; OUStringmaTargetPath; +OOXMLVariantmaOOXMLVariant; css::uno::Reference< css::uno::XComponentContext > mxContext; }; diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx index c8ce03acb75c..4a6edbdd7658 100644 --- a/oox/source/core/filterdetect.cxx +++ b/oox/source/core/filterdetect.cxx @@ -54,6 +54,7 @@ using comphelper::DocPasswordVerifierResult; FilterDetectDocHandler::FilterDetectDocHandler( const Reference< XComponentContext >& rxContext, OUString& rFilterName, const OUString& rFileName ) : mrFilterName( rFilterName ), maFileName(rFileName), +maOOXMLVariant( OOXMLVariant::ECMA_Transitional ), mxContext( rxContext ) { maContextStack.reserve( 2 ); @@ -142,6 +143,15 @@ void SAL_CALL FilterDetectDocHandler::characters( const OUString& /*aChars*/ ) void FilterDetectDocHandler::parseRelationship( const AttributeList& rAttribs ) { OUString aType = rAttribs.getString( XML_Type, OUString() ); + +// tdf#131936 Remember filter when opening file as 'Office Open XML Text' +if (aType.startsWithIgnoreAsciiCase("http://schemas.openxmlformats.org/officedocument/2006/relationships/metadata/core-properties";)) +maOOXMLVariant = OOXMLVariant::ISO_Transitional; +else if (aType.startsWithIgnoreAsciiCase("http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";)) +maOOXMLVariant = OOXMLVariant::ECMA_Transitional; +else if (aType.startsWithIgnoreAsciiCase("http://purl.oclc.org/ooxml/officeDocument";)) +maOOXMLVariant = OOXMLVariant::ISO_Strict; + if ( !(aType == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; // OOXML Transitional || aType == "http://purl.oclc.org/ooxml/officeDocument/relationships/officeDocument";) ) //OOXML strict return; @@ -169,14 +179,32 @@ OUString FilterDetectDocHandler::getFilterNameFromContentType( const OUString& r bool bDocm = rFileName.endsWithIgnoreAsciiCase(".docm"); if( rContentType == "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml" && !bDocm ) -return "writer_MS_Word_2007"; +{ +switch (maOOXMLVariant) +{ +case OOXMLVariant::ISO_Transitional: +case OOXMLVariant::ISO_Strict: // Not supported, map to ISO transitional +return "writer_OOXML"; +case OOXMLVariant::ECMA_Transitional: +return "writer_MS_Word_2007"; +} +} if( rContentType == "application/vnd.ms-word.document.macroEnabled.main+xml" || bDocm ) return "writer_MS_Word_2007_VBA"; if( rContentType == "application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml" || rContentType == "application/vnd.ms-word.template.macroEnabledTemplate.main+xml" ) -return "writer_MS_Word_2007_Template"; +{ +switch (maOOXMLVariant) +{ +case OOXMLVariant::ISO_Transition
[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source writerfilter/source
include/oox/vml/vmltextbox.hxx|1 oox/source/vml/vmltextbox.cxx | 34 oox/source/vml/vmltextboxcontext.cxx |3 + sw/qa/extras/ooxmlexport/ooxmlexport10.cxx|8 ++ sw/qa/extras/ooxmlexport/ooxmlexport8.cxx | 13 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |5 + sw/source/filter/ww8/docxattributeoutput.cxx | 22 writerfilter/source/dmapper/DomainMapper_Impl.cxx | 59 ++ writerfilter/source/dmapper/StyleSheetTable.cxx | 14 - 9 files changed, 121 insertions(+), 38 deletions(-) New commits: commit 334409fbde555a957cd34e295cc27f2c2bf6e194 Author: Justin Luth AuthorDate: Tue Oct 22 15:50:19 2019 +0300 Commit: Miklos Vajna CommitDate: Fri Nov 22 10:47:44 2019 +0100 tdf#128153 docx/VML: apply style properties to shape text This replaces LO 4.3 commit 8766011bccfd0f12f8dd77d2f94eb16e2e8c3471 DOCX import: set document-level font size default based on default para style ...and is needed for tdf#118947, since bogus DEFAULT_VALUEs really hinder determining what a table style should override. Shape text should inherit the font size from the style that is specified. In many cases, it will not be specified, and therefore the default style was appropriate, but in cases where a style IS specified, then of course use that fontsize ... and every other character and paragraph property. HOWEVER, I only added the properties used in vml import for now, and I skipped asian/complex fontnames since VML only handles CharHeight, and not CharHeightAsian/Complex. -note: this does not affect direct formatting - it just sets default value at the shape level, not at the paragraph level. So far I have only looked at DOCX:VML - which satisfies the unit tests. There are other codepaths that lead to PushShapeContext though, and this should be easy to expand to other import situations. I've tried lots of asserts to find unit tests that should be modified, and so far they all seemed to point to VML - although round-tripping doesn't use VML and still requires at minimum the CharHeight property to be overridden, so limiting non-VML to that to maintain backward compatibility, and reduce regression footprint. Since we have to emulate here (since paragraph styles are not supported on Draw text), a perfect solution cannot possibly be found - specifically in cases where multiple paragraphs exist in one shape with different styles applied, or where some pararaphs apply a paragraph property and others do not. Compromise 1: For ambiguous paragraph styles, fallback to the default paragraph style. Rationale: Normally, most styles inherit from default and only change a couple of properties. So MOST of the properties will match the normal style. The chances that the default style will be correct are more likely than that some other random default would be. -note: no existing unit tests were ambiguous Compromise 2: Ideally, each paragraph could report whether it had DIRECT formatting, and the paragraphs could be walked through instead of the shapes. But I don't think that is reasonably possible in this SyncProperties situation. At first I had a grabbag framework setup that monitored when a paragraph property was set, and then skipped applying that property. But I later noticed that the PropertyState for paragraph properties actually did seem to reflect that - which is a better solution if it works properly. Regression potential: -for VML: should be limited to non-charheight properties where the default style sets some weird default, and an ambiguous style sets it back to the program default. Prior to this patch, the default style value wouldn't apply. On the flip side (and more likely scenario), non-ambiguous cases will use the correct value and look more like MSWord, as seen in many existing unit tests that now use corrected fonts. -for non-VML: should be none since I limit it to only CharHeight which was previously emulated by changing the program default. Change-Id: I8f1fb7ed01f990dbf998ebe04064c2645a68e1aa Reviewed-on: https://gerrit.libreoffice.org/81365 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/include/oox/vml/vmltextbox.hxx b/include/oox/vml/vmltextbox.hxx index e361d1b7040c..7a37577c71ad 100644 --- a/include/oox/vml/vmltextbox.hxx +++ b/include/oox/vml/vmltextbox.hxx @@ -43,6 +43,7 @@ struct ShapeTypeModel; struct TextParagraphModel { OptValue moParaAdjust; ///< Paragraph adjust (left, center, right, etc.) +OptValue moParaStyleName; }; /** Font settings for a text portion in a textbox. */ diff --git a/oox/source/vml/vmltextbox.cxx b/o
[Libreoffice-commits] core.git: include/oox oox/source sw/qa
include/oox/export/drawingml.hxx |6 ++ oox/source/export/chartexport.cxx |2 oox/source/export/drawingml.cxx | 32 +- sw/qa/extras/ooxmlexport/data/Chart_BorderLine_Style.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport11.cxx| 15 ++ 5 files changed, 52 insertions(+), 3 deletions(-) New commits: commit 761308edb65a6cf44ef84cebc387e77af8b70f83 Author: Adam Kovacs AuthorDate: Thu Sep 13 04:04:41 2018 -0400 Commit: László Németh CommitDate: Fri Sep 14 08:06:39 2018 +0200 tdf#108064 OOXML export: fixing linestyle export in charts getLineDash function copy paste from ChartLinePanel.cxx. We query the actual linedash value associated to the LineDashName of the chart line via DashTable service. Thanks for the guidance of László Németh! Change-Id: I565fc968ce009803f9872da1f01dd56cfe07ddb3 Reviewed-on: https://gerrit.libreoffice.org/60424 Reviewed-by: László Németh Tested-by: László Németh diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index 449e77da78e1..393752f78df6 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -81,6 +81,9 @@ namespace io { namespace uno { class XInterface; } +namespace frame { +class XModel; +} }}} struct EscherConnectorListEntry; @@ -200,7 +203,8 @@ public: void WriteSrcRectXGraphic(css::uno::Reference const & rxPropertySet, css::uno::Reference const & rxGraphic); -void WriteOutline( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet ); +void WriteOutline( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, + css::uno::Reference< css::frame::XModel> const & xModel = nullptr ); void WriteXGraphicStretch(css::uno::Reference const & rXPropSet, css::uno::Reference const & rxGraphic); diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index 97adab7f5b00..584774d9bbbc 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -2323,7 +2323,7 @@ void ChartExport::exportShapeProps( const Reference< XPropertySet >& xPropSet ) FSEND ); exportFill( xPropSet ); -WriteOutline( xPropSet ); +WriteOutline( xPropSet, getModel() ); pFS->endElement( FSNS( XML_c, XML_spPr ) ); } diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 8e554ad671bd..ee6a43b58df5 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -134,6 +134,25 @@ namespace drawingml { #define CGETAD(propName) \ (( bCheckDirect && GetPropertyAndState( rXPropSet, rXPropState, #propName, eState ) && eState == beans::PropertyState_DIRECT_VALUE )||GetProperty( rXPropSet, #propName )) +css::uno::Any getLineDash( const css::uno::Reference& xModel, const OUString& rDashName ) +{ +css::uno::Reference xFact(xModel, css::uno::UNO_QUERY); +css::uno::Reference xNameAccess( +xFact->createInstance("com.sun.star.drawing.DashTable"), +css::uno::UNO_QUERY ); +if(xNameAccess.is()) +{ +if (!xNameAccess->hasByName(rDashName)) +return css::uno::Any(); + +return xNameAccess->getByName(rDashName); +} + +return css::uno::Any(); +} + + + // not thread safe int DrawingML::mnImageCounter = 1; int DrawingML::mnWdpImageCounter = 1; @@ -571,7 +590,7 @@ void DrawingML::WriteLineArrow( const Reference< XPropertySet >& rXPropSet, bool } } -void DrawingML::WriteOutline( const Reference& rXPropSet ) +void DrawingML::WriteOutline( const Reference& rXPropSet, Reference< frame::XModel > const & xModel ) { drawing::LineStyle aLineStyle( drawing::LineStyle_NONE ); @@ -642,6 +661,17 @@ void DrawingML::WriteOutline( const Reference& rXPropSet ) if (GetProperty(rXPropSet, "LineDash")) { aLineDash = mAny.get(); +if (aLineDash.Dots == 0 && aLineDash.DotLen == 0 && aLineDash.Dashes == 0 && aLineDash.DashLen == 0 && aLineDash.Distance == 0) { +OUString aLineDashName; +GET(aLineDashName, LineDashName); +if (!aLineDashName.isEmpty()) { +if (xModel) { +css::uno::Any aAny; +aAny = getLineDash(xModel, aLineDashName); +aLineDash = aAny.get(); +} +} +} bDashSet = true; if (aLineDash.Style == DashStyle_ROUND || aLineDash.Style == DashStyle_ROUNDRELATIVE) { diff --git a/sw/qa/extras/ooxmlexport/data/Chart_BorderLine_Style.docx b/sw/qa/extras/o
[Libreoffice-commits] core.git: include/oox oox/source sw/qa
include/oox/ole/axcontrol.hxx |1 oox/source/ole/axcontrol.cxx | 11 +- oox/source/token/properties.txt|1 sw/qa/extras/ooxmlexport/data/activex_option_button_group.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 17 ++ 5 files changed, 29 insertions(+), 1 deletion(-) New commits: commit e463c96092e108a8fad3b9a91b693457f3c26545 Author: Tamás Zolnai Date: Sat Aug 26 16:10:51 2017 +0200 tdf#111980: DOCX: Handle ActiveX radio button group Change-Id: I3372b3b69623bda5c6e8587215e8fb7056fdf0a7 Reviewed-on: https://gerrit.libreoffice.org/41586 Tested-by: Jenkins Reviewed-by: Tamás Zolnai diff --git a/include/oox/ole/axcontrol.hxx b/include/oox/ole/axcontrol.hxx index 6da2e8039ffc..a932a7bcfcd2 100644 --- a/include/oox/ole/axcontrol.hxx +++ b/include/oox/ole/axcontrol.hxx @@ -616,6 +616,7 @@ public: virtual boolimportBinaryModel( BinaryInputStream& rInStrm ) override; virtual voidexportBinaryModel( BinaryOutputStream& rOutStrm ) override; virtual voidconvertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override; +virtual voidconvertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) override; public: // direct access needed for legacy VML drawing controls StreamDataSequence maPictureData; ///< Binary picture stream. diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx index a59beb631475..8e2b87634ce4 100644 --- a/oox/source/ole/axcontrol.cxx +++ b/oox/source/ole/axcontrol.cxx @@ -1540,7 +1540,7 @@ void AxMorphDataModelBase::exportBinaryModel( BinaryOutputStream& rOutStrm ) aWriter.skipProperty(); // accelerator aWriter.skipProperty(); // undefined aWriter.writeBoolProperty(true); // must be 1 for morph -if ( ( mnDisplayStyle == AX_DISPLAYSTYLE_CHECKBOX ) || ( mnDisplayStyle == AX_DISPLAYSTYLE_OPTBUTTON ) ) +if ( mnDisplayStyle == AX_DISPLAYSTYLE_OPTBUTTON ) aWriter.writeStringProperty( maGroupName ); else aWriter.skipProperty(); //maGroupName @@ -1552,9 +1552,18 @@ void AxMorphDataModelBase::convertProperties( PropertyMap& rPropMap, const Contr { rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, AX_FLAGS_ENABLED ) ); rConv.convertColor( rPropMap, PROP_TextColor, mnTextColor ); +if ( mnDisplayStyle == AX_DISPLAYSTYLE_OPTBUTTON ) +rPropMap.setProperty( PROP_GroupName, maGroupName ); AxFontDataModel::convertProperties( rPropMap, rConv ); } +void AxMorphDataModelBase::convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) +{ +if ( mnDisplayStyle == AX_DISPLAYSTYLE_OPTBUTTON ) +rPropSet.getProperty( maGroupName, PROP_GroupName ); +AxFontDataModel::convertFromProperties( rPropSet, rConv ); +} + AxToggleButtonModel::AxToggleButtonModel() { mnDisplayStyle = AX_DISPLAYSTYLE_TOGGLE; diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index b32924c2be9b..e6bc79ff3d08 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -208,6 +208,7 @@ GraphicSize GraphicURL GridColor GroupInfo +GroupName HScroll Handles HasAutoShowInfo diff --git a/sw/qa/extras/ooxmlexport/data/activex_option_button_group.docx b/sw/qa/extras/ooxmlexport/data/activex_option_button_group.docx new file mode 100755 index ..9da266a9278d Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/activex_option_button_group.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index 515f40e4803b..f381de9c9032 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -1007,6 +1007,23 @@ DECLARE_OOXMLEXPORT_TEST(testWatermarkLayer, "watermark-layer.docx") CPPUNIT_ASSERT_EQUAL(static_cast(1), pObject->GetLayer().get()); } +DECLARE_OOXMLEXPORT_TEST(testActiveXOptionButtonGroup, "activex_option_button_group.docx") +{ +// Optionbutton groups were not handled +// The two optionbutton should have the same group name +const OUString sGroupName = "GroupX"; + +uno::Reference xControlShape(getShape(1), uno::UNO_QUERY); +CPPUNIT_ASSERT(xControlShape.is()); +uno::Reference xPropertySet(xControlShape->getControl(), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(sGroupName, getProperty(xPropertySet, "GroupName")); + +xControlShape.set(getShape(2), uno::UNO_QUERY); +CPPUNIT_ASSERT(xControlShape.is()); +xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(sGroupName, getProperty(xPropertySet, "GroupName")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ___ Libreoffice-commits mailing
[Libreoffice-commits] core.git: include/oox oox/source sw/qa
include/oox/vml/vmltextbox.hxx |2 ++ oox/source/vml/vmltextbox.cxx | 14 ++ oox/source/vml/vmltextboxcontext.cxx |6 ++ sw/qa/extras/ooxmlimport/data/groupshape-fontname.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 11 +++ 5 files changed, 33 insertions(+) New commits: commit 178b361c6379bc963c8a48925f1807c583f2d09f Author: Samuel Mehrbrodt Date: Wed Jul 26 10:50:05 2017 +0200 tdf#107723 Import font name from text portions in shapes Change-Id: Ib9b73b5c05ec2e6846ea3adc950ccab5d1c0a9b0 Reviewed-on: https://gerrit.libreoffice.org/40439 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/include/oox/vml/vmltextbox.hxx b/include/oox/vml/vmltextbox.hxx index 0f0828c88797..8b32713c1dae 100644 --- a/include/oox/vml/vmltextbox.hxx +++ b/include/oox/vml/vmltextbox.hxx @@ -49,6 +49,8 @@ struct TextParagraphModel struct OOX_DLLPUBLIC TextFontModel { OptValue< OUString > moName; ///< Font name. +OptValue< OUString > moNameAsian; ///< Asian font name. +OptValue< OUString > moNameComplex; ///< Complex font name. OptValue< OUString > moColor;///< Font color, HTML encoded, sort of. OptValue< sal_Int32 > monSize; ///< Font size in twips. OptValue< sal_Int32 > monUnderline; ///< Single or double underline. diff --git a/oox/source/vml/vmltextbox.cxx b/oox/source/vml/vmltextbox.cxx index ac8c51273d77..cfa07b0546db 100644 --- a/oox/source/vml/vmltextbox.cxx +++ b/oox/source/vml/vmltextbox.cxx @@ -82,6 +82,20 @@ void TextBox::convert(const uno::Reference& xShape) const std::vector aPropVec; const TextParagraphModel& rParagraph = aIt->maParagraph; const TextFontModel& rFont = aIt->maFont; +if (rFont.moName.has()) +{ +aPropertyValue.Name = "CharFontName"; +aPropertyValue.Value <<= rFont.moName.get(); +aPropVec.push_back(aPropertyValue); + +aPropertyValue.Name = "CharFontNameAsian"; +aPropertyValue.Value <<= rFont.moNameAsian.get(); +aPropVec.push_back(aPropertyValue); + +aPropertyValue.Name = "CharFontNameComplex"; +aPropertyValue.Value <<= rFont.moNameComplex.get(); +aPropVec.push_back(aPropertyValue); +} if (rFont.mobBold.has()) { aPropertyValue.Name = "CharWeight"; diff --git a/oox/source/vml/vmltextboxcontext.cxx b/oox/source/vml/vmltextboxcontext.cxx index 239e53c3a655..c46ff71b98a5 100644 --- a/oox/source/vml/vmltextboxcontext.cxx +++ b/oox/source/vml/vmltextboxcontext.cxx @@ -139,6 +139,12 @@ void TextPortionContext::onStartElement(const AttributeList& rAttribs) case W_TOKEN(rPr): case W_TOKEN(t): break; +case W_TOKEN(rFonts): +// See https://msdn.microsoft.com/en-us/library/documentformat.openxml.wordprocessing.runfonts(v=office.14).aspx +maFont.moName = rAttribs.getString(W_TOKEN(ascii)); +maFont.moNameAsian = rAttribs.getString(W_TOKEN(eastAsia)); +maFont.moNameComplex = rAttribs.getString(W_TOKEN(cs)); +break; default: SAL_INFO("oox", "unhandled: 0x" << std::hex<< getCurrentElement()); break; diff --git a/sw/qa/extras/ooxmlimport/data/groupshape-fontname.docx b/sw/qa/extras/ooxmlimport/data/groupshape-fontname.docx new file mode 100644 index ..025f737e0556 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/groupshape-fontname.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index fef6d06d0038..bbbf1e65e740 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1430,6 +1430,17 @@ DECLARE_OOXMLIMPORT_TEST(testTdf109524, "tdf109524.docx") CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getProperty(xTables->getByIndex(0), "RelativeWidth")); } +DECLARE_OOXMLIMPORT_TEST(testGroupShapeFontName, "groupshape-fontname.docx") +{ +// Font names inside a group shape were not imported +uno::Reference xGroup(getShape(1), uno::UNO_QUERY); +uno::Reference xText = uno::Reference(xGroup->getByIndex(1), uno::UNO_QUERY)->getText(); + +CPPUNIT_ASSERT_EQUAL(OUString("Calibri"), getProperty(getRun(getParagraphOfText(1, xText), 1), "CharFontName")); +CPPUNIT_ASSERT_EQUAL(OUString("Calibri"), getProperty(getRun(getParagraphOfText(1, xText), 1), "CharFontNameComplex")); +CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty(getRun(getParagraphOfText(1, xText), 1), "CharFontNameAsian")); +} + // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT CPPUNIT_PLUGIN_IMPLEMENT(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mai
[Libreoffice-commits] core.git: include/oox oox/source sw/qa
include/oox/vml/vmlshape.hxx |1 oox/source/export/drawingml.cxx|9 ++--- oox/source/vml/vmlshape.cxx| 37 +++-- oox/source/vml/vmlshapecontext.cxx |4 +- sw/qa/extras/ooxmlimport/data/vml-adjustments.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 11 ++ 6 files changed, 48 insertions(+), 14 deletions(-) New commits: commit c8e3fea4996436d1fd608cf5ef0fdc18f5a8fd7f Author: Grzegorz Araminowicz Date: Tue Jun 6 08:53:39 2017 +0200 GSoC: import VML shape adjustments Change-Id: Ifcd49f34b889b34eba2464de6e083f9021633bc6 Reviewed-on: https://gerrit.libreoffice.org/38427 Reviewed-by: Jan Holesovsky Tested-by: Jan Holesovsky diff --git a/include/oox/vml/vmlshape.hxx b/include/oox/vml/vmlshape.hxx index abb4161ec5cd..44f973b57169 100644 --- a/include/oox/vml/vmlshape.hxx +++ b/include/oox/vml/vmlshape.hxx @@ -89,6 +89,7 @@ struct OOX_DLLPUBLIC ShapeTypeModel OUString maWrapStyle;///< Wrapping mode for text. OUString maArcsize; ///< round rectangles arc size OUString maEditAs; ///< Edit As type (e.g. "canvas" etc) +OUString maAdjustments; ///< Shape adjustment values StrokeModel maStrokeModel; ///< Border line formatting. FillModel maFillModel;///< Shape fill formatting. diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index f1995e90b3a7..6270b30b8b2d 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -2351,16 +2351,17 @@ void DrawingML::WritePresetShape( const char* pShape, MSO_SPT eShapeType, bool b EscherPropertyContainer::LookForPolarHandles( eShapeType, nAdjustmentsWhichNeedsToBeConverted ); sal_Int32 nValue, nLength = aAdjustmentSeq.getLength(); -//aAdjustments will give info about the number of adj values for a particular geometry. For example for hexagon aAdjustments.size() will be 2 and for circular arrow it will be 5 as per lcl_getAdjNames. -if(aAdjustments.size() == static_cast(nLength))// In case there is a mismatch do not write the XML_gd tag. +// aAdjustments will give info about the number of adj values for a particular geometry. For example for hexagon aAdjustments.size() will be 2 and for circular arrow it will be 5 as per lcl_getAdjNames. +// Sometimes there are more values than needed, so we ignore the excessive ones. +if (aAdjustments.size() <= static_cast(nLength)) { -for( sal_Int32 i=0; i < nLength; i++ ) +for (sal_Int32 i = 0; i < static_cast(aAdjustments.size()); i++) { if( EscherPropertyContainer::GetAdjustmentValue( aAdjustmentSeq[ i ], i, nAdjustmentsWhichNeedsToBeConverted, nValue ) ) { // If the document model doesn't have an adjustment name (e.g. shape was created from VML), then take it from the predefined list. OString aAdjName; -if (static_cast(i) < aAdjustments.size() && aAdjustmentSeq[i].Name.isEmpty()) +if (aAdjustmentSeq[i].Name.isEmpty()) aAdjName = aAdjustments[i]; mpFS->singleElementNS( XML_a, XML_gd, diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 8d85b14701fb..b90bddafb7ef 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -789,25 +789,44 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes } } +// custom shape geometry attributes +std::vector aPropVec; + // When flip has 'x' or 'y', the associated ShapeRect will be changed but direction change doesn't occur. // It might occur internally in SdrObject of "sw" module, not here. // The associated properties "PROP_MirroredX" and "PROP_MirroredY" have to be set here so that direction change will occur internally. if (bFlipX || bFlipY) { assert(!(bFlipX && bFlipY)); -css::uno::Sequence< css::beans::PropertyValue > aPropSequence (1); +css::beans::PropertyValue aProp; if (bFlipX) -{ -aPropSequence [0].Name = "MirroredX"; -aPropSequence [0].Value <<= bFlipX; -} +aProp.Name = "MirroredX"; else +aProp.Name = "MirroredY"; +aProp.Value <<= true; +aPropVec.push_back(aProp); +} + +if (!maTypeModel.maAdjustments.isEmpty()) +{ +std::vector aAdjustmentValues; +sal_Int32 nIndex = 0; +do { -aPropSequence [0].Name = "MirroredY"; -aPropSequence [0].Value <
[Libreoffice-commits] core.git: include/oox oox/source sw/qa
include/oox/vml/vmlformatting.hxx |3 ++- oox/source/export/vmlexport.cxx |7 +++ oox/source/vml/vmlformatting.cxx | 12 +++- oox/source/vml/vmlshape.cxx |2 +- sw/qa/extras/ooxmlexport/data/watermark-font.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport2.cxx |5 + 6 files changed, 26 insertions(+), 3 deletions(-) New commits: commit f6f52c526cda640dd7595abd45727cb615c2b167 Author: Szymon KÅos Date: Wed May 31 00:03:06 2017 +0200 Watermark: VML export/import font size Change-Id: I11409dfc621018a761c70a640938e18ae679d3f5 Reviewed-on: https://gerrit.libreoffice.org/38254 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/include/oox/vml/vmlformatting.hxx b/include/oox/vml/vmlformatting.hxx index b07d8b01899a..5bfb0c09e0fb 100644 --- a/include/oox/vml/vmlformatting.hxx +++ b/include/oox/vml/vmlformatting.hxx @@ -258,7 +258,8 @@ struct OOX_DLLPUBLIC TextpathModel TextpathModel(); /** Writes the properties to the passed property map. */ -void pushToPropMap(oox::drawingml::ShapePropertyMap& rPropMap, const css::uno::Reference& xShape) const; +void pushToPropMap(oox::drawingml::ShapePropertyMap& rPropMap, const css::uno::Reference& xShape, + const GraphicHelper& rGraphicHelper) const; }; } // namespace vml diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index ff121025acd3..d5b829d41c3f 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -812,6 +812,13 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& OUString aTextPathFont = SvxMSDffManager::MSDFFReadZString(aStream, aFont.nPropSize, true); aStyle += "font-family:\"" + aTextPathFont + "\""; } +sal_uInt32 nSize; +if (rProps.GetOpt(ESCHER_Prop_gtextSize, nSize)) +{ +float nSizeF = (sal_Int32)nSize / 65536; +OUString aSize = OUString::number(nSizeF); +aStyle += ";font-size:" + aSize + "pt"; +} if (!aStyle.isEmpty()) pAttrList->add(XML_style, OUStringToOString(aStyle, RTL_TEXTENCODING_UTF8)); m_pSerializer->singleElementNS(XML_v, XML_textpath, XFastAttributeListRef(pAttrList)); diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index 6b9d1a9c654d..c52b48e6e674 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -880,7 +880,7 @@ beans::PropertyValue lcl_createTextpathProps() return aRet; } -void TextpathModel::pushToPropMap(ShapePropertyMap& rPropMap, const uno::Reference& xShape) const +void TextpathModel::pushToPropMap(ShapePropertyMap& rPropMap, const uno::Reference& xShape, const GraphicHelper& rGraphicHelper) const { if (moString.has()) { @@ -926,6 +926,16 @@ void TextpathModel::pushToPropMap(ShapePropertyMap& rPropMap, const uno::Referen uno::Reference xPropertySet(xShape, uno::UNO_QUERY); xPropertySet->setPropertyValue("CharFontName", uno::makeAny(aValue)); } +else if (aName == "font-size") +{ +oox::OptValue aOptString(aValue); +sal_Int64 nEmu = lclGetEmu( rGraphicHelper, aOptString, 1 ); +// 1 point = 1/72 inch = 12,700 EMU +float nSize = nEmu / 12700; + +uno::Reference xPropertySet(xShape, uno::UNO_QUERY); +xPropertySet->setPropertyValue("CharHeight", uno::makeAny(nSize)); +} } } } diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 17f52ff609b6..8d85b14701fb 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -518,7 +518,7 @@ void ShapeBase::convertShapeProperties( const Reference< XShape >& rxShape ) con } } else if (xSInfo->supportsService("com.sun.star.drawing.CustomShape")) -maTypeModel.maTextpathModel.pushToPropMap(aPropMap, rxShape); +maTypeModel.maTextpathModel.pushToPropMap(aPropMap, rxShape, rGraphicHelper); PropertySet( rxShape ).setProperties( aPropMap ); } diff --git a/sw/qa/extras/ooxmlexport/data/watermark-font.docx b/sw/qa/extras/ooxmlexport/data/watermark-font.docx index 82d7ec8a83fc..5a09dc9f788d 100644 Binary files a/sw/qa/extras/ooxmlexport/data/watermark-font.docx and b/sw/qa/extras/ooxmlexport/data/watermark-font.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx index d4fa7a410701..3b5e7a11d996 1006
[Libreoffice-commits] core.git: include/oox oox/source sw/qa
include/oox/core/filterdetect.hxx |5 +++-- oox/source/core/filterdetect.cxx | 19 --- sw/qa/extras/ooxmlexport/data/bad.docm|binary sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 11 +++ 4 files changed, 26 insertions(+), 9 deletions(-) New commits: commit 97fa7024ce608b7908aca369e8c643a5de9ebf78 Author: Miklos Vajna Date: Fri Jun 2 10:57:23 2017 +0200 Related: tdf#108269 oox: allow recovering broken DOCM files The content type inside an OOXML file differs for DOCX and DOCM. These must be in sync with the file extension, otherwise MSO refuses to open the file. We used to always write the DOCX content-type even for files which had the DOCM extension. Allow users to recover those broken files by detecting a "has docm extension but docx content-type" file as docm, so re-saving it will produce output that's accepted by MSO as well. Change-Id: I7d60c6f6c1d0421e95b3dc9e8fff617f101919f5 Reviewed-on: https://gerrit.libreoffice.org/38342 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/include/oox/core/filterdetect.hxx b/include/oox/core/filterdetect.hxx index ca717418be99..f5932eab8af6 100644 --- a/include/oox/core/filterdetect.hxx +++ b/include/oox/core/filterdetect.hxx @@ -61,7 +61,7 @@ namespace core { class FilterDetectDocHandler : public ::cppu::WeakImplHelper< css::xml::sax::XFastDocumentHandler > { public: -explicitFilterDetectDocHandler( const css::uno::Reference< css::uno::XComponentContext >& rxContext, OUString& rFilter ); +explicitFilterDetectDocHandler( const css::uno::Reference< css::uno::XComponentContext >& rxContext, OUString& rFilter, const OUString& rFileName ); virtual ~FilterDetectDocHandler() override; // XFastDocumentHandler @@ -81,7 +81,7 @@ public: private: voidparseRelationship( const AttributeList& rAttribs ); -static OUString getFilterNameFromContentType( const OUString& rContentType ); +static OUString getFilterNameFromContentType( const OUString& rContentType, const OUString& rFileName ); voidparseContentTypesDefault( const AttributeList& rAttribs ); voidparseContentTypesOverride( const AttributeList& rAttribs ); @@ -89,6 +89,7 @@ private: typedef ::std::vector< sal_Int32 > ContextVector; OUString& mrFilterName; +OUStringmaFileName; ContextVector maContextStack; OUStringmaTargetPath; css::uno::Reference< css::uno::XComponentContext > mxContext; diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx index 1882572f12d5..226668dfc767 100644 --- a/oox/source/core/filterdetect.cxx +++ b/oox/source/core/filterdetect.cxx @@ -52,8 +52,9 @@ using utl::MediaDescriptor; using comphelper::IDocPasswordVerifier; using comphelper::DocPasswordVerifierResult; -FilterDetectDocHandler::FilterDetectDocHandler( const Reference< XComponentContext >& rxContext, OUString& rFilterName ) : +FilterDetectDocHandler::FilterDetectDocHandler( const Reference< XComponentContext >& rxContext, OUString& rFilterName, const OUString& rFileName ) : mrFilterName( rFilterName ), +maFileName(rFileName), mxContext( rxContext ) { maContextStack.reserve( 2 ); @@ -160,12 +161,12 @@ void FilterDetectDocHandler::parseRelationship( const AttributeList& rAttribs ) } } -OUString FilterDetectDocHandler::getFilterNameFromContentType( const OUString& rContentType ) +OUString FilterDetectDocHandler::getFilterNameFromContentType( const OUString& rContentType, const OUString& rFileName ) { -if( rContentType == "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml" ) +if( rContentType == "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml" && !rFileName.endsWith("docm") ) return OUString( "writer_MS_Word_2007" ); -if( rContentType == "application/vnd.ms-word.document.macroEnabled.main+xml" ) +if( rContentType == "application/vnd.ms-word.document.macroEnabled.main+xml" || rFileName.endsWith("docm") ) return OUString( "writer_MS_Word_2007_VBA" ); if( rContentType == "application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml" || @@ -209,14 +210,14 @@ void FilterDetectDocHandler::parseContentTypesDefault( const AttributeList& rAtt OUString aExtension = rAttribs.getString( XML_Extension, OUString() ); sal_Int32 nExtPos = maTargetPath.getLength() - aExtension.getLength(); if( (nExtPos > 0) && (maTargetPath[ nExtPos - 1 ] == '.') && maTargetPath.match( aExtension, nExtPos ) ) -mrFilterName = getFilterNameFromContentType( rAttribs.getString( XML_ContentType, OUString() ) ); +mrFilterName = getFilterNameFromContentType( rAttribs.getString( XML_Conte
[Libreoffice-commits] core.git: include/oox oox/source sw/qa
include/oox/vml/vmlformatting.hxx | 12 oox/source/vml/vmlformatting.cxx| 25 + oox/source/vml/vmlshape.cxx | 17 + sw/qa/extras/ooxmlimport/data/tdf76446.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx|7 +++ 5 files changed, 49 insertions(+), 12 deletions(-) New commits: commit 087537dc45bbab3db41fe6d92974cdfde59904cb Author: Grzegorz Araminowicz Date: Tue May 30 11:45:47 2017 +0200 tdf#76446 GSoC: incorrect rotation of VML shapes * support poorly documented 'fd' suffix in rotation attribute * allow non-integer rotation Change-Id: I3d72f2a708e6585597db09366c00c50038abc9c1 Reviewed-on: https://gerrit.libreoffice.org/38207 Tested-by: Jenkins Reviewed-by: Jan Holesovsky diff --git a/include/oox/vml/vmlformatting.hxx b/include/oox/vml/vmlformatting.hxx index efb0e6606887..b07d8b01899a 100644 --- a/include/oox/vml/vmlformatting.hxx +++ b/include/oox/vml/vmlformatting.hxx @@ -75,6 +75,18 @@ namespace ConversionHelper const OUString& rValue, double fDefValue ); +/** Converts the passed VML rotation value to degrees. +See DffPropertyReader::Fix16ToAngle(): in VML, positive rotation +angles are clockwise, we have them as counter-clockwise. +Additionally, VML type is 0..360, our is 0..36000. + +@param rValue The VML rotation value. This is a floating-point value +with optional 'fd' suffix. If the suffix is missing, the floating +point value will be returned unmodified. If the 'fd' suffix is +present, the value will be divided by 65536. +*/ +OOX_DLLPUBLIC sal_Int32decodeRotation( const OUString& rValue ); + /** Converts the passed VML measure string to EMU (English Metric Units). @param rGraphicHelper The graphic helper needed to perform pixel diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index c2e2d139c0d6..6b9d1a9c654d 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -34,6 +34,7 @@ #include "oox/helper/graphichelper.hxx" #include #include +#include namespace oox { namespace vml { @@ -109,6 +110,30 @@ double ConversionHelper::decodePercent( const OUString& rValue, double fDefValue return fDefValue; } +sal_Int32 ConversionHelper::decodeRotation( const OUString& rValue ) +{ +if( rValue.isEmpty() ) +return 0; + +double fValue = 0.0; +double fRotation = 0.0; +sal_Int32 nEndPos = 0; +if( !lclExtractDouble(fValue, nEndPos, rValue) ) +return 0; + +if( nEndPos == rValue.getLength() ) +fRotation = fValue; +else if( (nEndPos + 2 == rValue.getLength()) && (rValue[nEndPos] == 'f') && (rValue[nEndPos+1] == 'd') ) +fRotation = fValue / 65536.0; +else +{ +OSL_FAIL("ConversionHelper::decodeRotation - unknown measure unit"); +return 0; +} + +return NormAngle360(fRotation * -100); +} + sal_Int64 ConversionHelper::decodeMeasureToEmu( const GraphicHelper& rGraphicHelper, const OUString& rValue, sal_Int32 nRefValue, bool bPixelX, bool bDefaultAsPixel ) { diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 7c78234e511f..f7d6c6908b8f 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -372,7 +372,7 @@ Reference< XShape > ShapeBase::convertAndInsert( const Reference< XShapes >& rxS } if(!(maTypeModel.maRotation).isEmpty()) - aGrabBag.push_back(comphelper::makePropertyValue("mso-rotation-angle", sal_Int32(NormAngle360((maTypeModel.maRotation.toInt32()) * -100; + aGrabBag.push_back(comphelper::makePropertyValue("mso-rotation-angle", ConversionHelper::decodeRotation(maTypeModel.maRotation))); propertySet->setPropertyValue("FrameInteropGrabBag", uno::makeAny(comphelper::containerToSequence(aGrabBag))); sal_Int32 backColorTransparency = 0; propertySet->getPropertyValue("BackColorTransparency") @@ -620,20 +620,13 @@ void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& rTypeModel, lcl_setSurround( rPropSet, rTypeModel, rGraphicHelper ); } -void lcl_SetRotation(PropertySet& rPropSet, const sal_Int32 nRotation) -{ -// See DffPropertyReader::Fix16ToAngle(): in VML, positive rotation angles are clockwise, we have them as counter-clockwise. -// Additionally, VML type is 0..360, our is 0..36000. -rPropSet.setAnyProperty(PROP_RotateAngle, makeAny(sal_Int32(NormAngle360(nRotation * -100; -} - Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect ) const { awt::Rectangle aShapeRect(rShapeRect); boost::op
[Libreoffice-commits] core.git: include/oox oox/source sw/qa
include/oox/vml/vmlformatting.hxx |1 + oox/source/vml/vmlformatting.cxx | 22 ++ oox/source/vml/vmlshapecontext.cxx|1 + sw/qa/extras/ooxmlexport/data/watermark-font.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport2.cxx | 13 + sw/qa/extras/uiwriter/uiwriter.cxx|3 +-- 6 files changed, 38 insertions(+), 2 deletions(-) New commits: commit 46edac18b76d8e9cc74aed8a9712ca3bdadd0972 Author: Szymon KÅos Date: Thu May 25 18:54:37 2017 +0200 Watermark: VML font-family import for textpath Handle style attribute to get font-family: Change-Id: I5fe530ae57e103b413ef494502f666f1005a Reviewed-on: https://gerrit.libreoffice.org/38039 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/include/oox/vml/vmlformatting.hxx b/include/oox/vml/vmlformatting.hxx index d7c3e92f0b9c..efb0e6606887 100644 --- a/include/oox/vml/vmlformatting.hxx +++ b/include/oox/vml/vmlformatting.hxx @@ -241,6 +241,7 @@ struct OOX_DLLPUBLIC ShadowModel struct OOX_DLLPUBLIC TextpathModel { OptValue moString; ///< Specifies the string of the textpath. +OptValue moStyle; ///< Specifies the style of the textpath. TextpathModel(); diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index f8c8de8dae8d..c2e2d139c0d6 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -882,6 +882,28 @@ void TextpathModel::pushToPropMap(ShapePropertyMap& rPropMap, const uno::Referen } rPropMap.setAnyProperty(PROP_CustomShapeGeometry, uno::makeAny(aGeomPropSeq)); } +if (moStyle.has()) +{ +OUString aStyle = moStyle.get(OUString()); + +sal_Int32 nIndex = 0; +while( nIndex >= 0 ) +{ +OUString aName, aValue; +if (ConversionHelper::separatePair(aName, aValue, aStyle.getToken(0, ';', nIndex), ':')) +{ +if (aName == "font-family") +{ +// remove " (first, and last character) +if (aValue.getLength() > 2) +aValue = aValue.copy(1, aValue.getLength() - 2); + +uno::Reference xPropertySet(xShape, uno::UNO_QUERY); +xPropertySet->setPropertyValue("CharFontName", uno::makeAny(aValue)); +} +} +} +} } } // namespace vml diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index ed369ae1c7d9..02cf06e51429 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -383,6 +383,7 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( sal_Int32 nElement, const A break; case VML_TOKEN( textpath ): mrTypeModel.maTextpathModel.moString.assignIfUsed(rAttribs.getString(XML_string)); + mrTypeModel.maTextpathModel.moStyle.assignIfUsed(rAttribs.getString(XML_style)); break; } return nullptr; diff --git a/sw/qa/extras/ooxmlexport/data/watermark-font.docx b/sw/qa/extras/ooxmlexport/data/watermark-font.docx new file mode 100644 index ..82d7ec8a83fc Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/watermark-font.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx index 3b4445f8585e..9a13c5aaef21 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx @@ -691,6 +691,19 @@ DECLARE_OOXMLEXPORT_TEST(testWatermark, "watermark.docx") CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_NONE, getProperty(xShape, "LineStyle")); } +DECLARE_OOXMLEXPORT_TEST(testWatermarkFont, "watermark-font.docx") +{ +uno::Reference xShape(getShape(1), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(OUString("TestFont"), xShape->getString()); + +uno::Reference xPropertySet(xShape, uno::UNO_QUERY); +OUString aFont; + +// Check font family +CPPUNIT_ASSERT(xPropertySet->getPropertyValue("CharFontName") >>= aFont); +CPPUNIT_ASSERT_EQUAL(OUString("DejaVu Serif"), aFont); +} + DECLARE_OOXMLEXPORT_TEST(testFdo43093, "fdo43093.docx") { // The problem was that the alignment are not exchange when the paragraph are RTL. diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 60ad0c17719b..88be24d04a53 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -874,8 +874,7 @@ void SwUiWriterTest::testWatermarkDOCX() const SfxWatermarkItem* pWatermark = static_cast(pItem); CPPUNIT_ASSERT_EQUAL(OUString("CustomWatermark"), pWatermark->GetText()); -//TODO: VML import textpath style -//CPPUNIT_ASSERT_EQUAL(OUString("DejaVu Sans Light"), pWatermark->GetFont()); +CPPUNIT_ASSERT_EQUAL(OUString("DejaVu San
[Libreoffice-commits] core.git: include/oox oox/source sw/qa
include/oox/export/drawingml.hxx |2 +- oox/source/export/drawingml.cxx | 15 --- oox/source/export/shapes.cxx |4 +++- sw/qa/extras/ooxmlexport/data/tdf103389.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport9.cxx| 11 +++ 5 files changed, 23 insertions(+), 9 deletions(-) New commits: commit f7c61b08d526c79ecd1522dff79386059b6125e0 Author: Tamás Zolnai Date: Tue Oct 25 01:51:25 2016 + tdf#103389: Resaving a DOCX document with two canvases leads to a broken file. Make custom shape export more robust. In case of the test document, WriteCustomGeometry is called, but this call does not export anything, and so we get a shape without any geometry in the DOCX file, which causes problem to MS Word. Change-Id: Ie7a4e2b8a18bfddaeeb81425ae5f1de04140d43f Reviewed-on: https://gerrit.libreoffice.org/30241 Reviewed-by: Tamás Zolnai Tested-by: Tamás Zolnai diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index a880cd2..e9dc0a3 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -204,7 +204,7 @@ public: void WritePresetShape( const char* pShape , std::vector< std::pair> & rAvList ); void WritePresetShape( const char* pShape ); void WritePresetShape( const char* pShape, MSO_SPT eShapeType, bool bPredefinedHandlesUsed, sal_Int32 nAdjustmentsWhichNeedsToBeConverted, const css::beans::PropertyValue& rProp ); -void WriteCustomGeometry( const css::uno::Reference& rXShape ); +bool WriteCustomGeometry( const css::uno::Reference& rXShape ); void WritePolyPolygon( const tools::PolyPolygon& rPolyPolygon ); void WriteFill( const css::uno::Reference< css::beans::XPropertySet >& xPropSet ); void WriteShapeStyle( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet ); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index a70b8d6..2925646 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -2298,23 +2298,23 @@ void DrawingML::WritePresetShape( const char* pShape, MSO_SPT eShapeType, bool b mpFS->endElementNS( XML_a, XML_prstGeom ); } -void DrawingML::WriteCustomGeometry( const Reference< XShape >& rXShape ) +bool DrawingML::WriteCustomGeometry( const Reference< XShape >& rXShape ) { uno::Reference< beans::XPropertySet > aXPropSet; uno::Any aAny( rXShape->queryInterface(cppu::UnoType::get())); if ( ! (aAny >>= aXPropSet) ) -return; +return false; try { aAny = aXPropSet->getPropertyValue( "CustomShapeGeometry" ); if ( !aAny.hasValue() ) -return; +return false; } catch( const ::uno::Exception& ) { -return; +return false; } @@ -2345,7 +2345,7 @@ void DrawingML::WriteCustomGeometry( const Reference< XShape >& rXShape ) } if ( !aPairs.hasElements() ) -return; +return false; if ( !aSegments.hasElements() ) { @@ -2369,7 +2369,7 @@ void DrawingML::WriteCustomGeometry( const Reference< XShape >& rXShape ) if ( nExpectedPairCount > aPairs.getLength() ) { SAL_WARN("oox", "Segments need " << nExpectedPairCount << " coordinates, but Coordinates have only " << aPairs.getLength() << " pairs."); -return; +return false; } mpFS->startElementNS( XML_a, XML_custGeom, FSEND ); @@ -2531,10 +2531,11 @@ void DrawingML::WriteCustomGeometry( const Reference< XShape >& rXShape ) mpFS->endElementNS( XML_a, XML_path ); mpFS->endElementNS( XML_a, XML_pathLst ); mpFS->endElementNS( XML_a, XML_custGeom ); +return true; } } } - +return false; } void DrawingML::WritePolyPolygon( const tools::PolyPolygon& rPolyPolygon ) diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 62b8b34..a44f2ee 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -834,7 +834,9 @@ ShapeExport& ShapeExport::WriteCustomShape( const Reference< XShape >& xShape ) else if (bCustGeom) { WriteShapeTransformation( xShape, XML_a, bFlipH, bFlipV ); -WriteCustomGeometry( xShape ); +bool bSuccess = WriteCustomGeometry( xShape ); +if (!bSuccess) +WritePresetShape( sPresetShape ); } else if (bOnBlacklist && bHasHandles && nAdjustmentValuesIndex !=-1 && !sShapeType.startsWith("mso-spt")) { diff --git a/sw/qa/extras/ooxmlexport/data/tdf103389.docx b/sw/qa/extras/ooxmlexport/data/tdf103389.docx new file mode 100644 index 000..0ef80e6 Binary files /dev/null and b/sw/qa/extras/ooxmlex
[Libreoffice-commits] core.git: include/oox oox/source sw/qa
include/oox/drawingml/fillproperties.hxx|1 + oox/source/drawingml/fillproperties.cxx |4 oox/source/drawingml/fillpropertiesgroupcontext.cxx |3 +++ sw/qa/extras/ooxmlimport/data/tdf100830.docx|binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx|6 ++ 5 files changed, 14 insertions(+) New commits: commit ecfcee8b05e45ec82dec6ed417e9ac53d4d7b4ff Author: Miklos Vajna Date: Tue Oct 4 09:24:42 2016 +0200 tdf#100830 drawingML import: handle Fill transparency on the UI. Regression from commit 57450afb768c085df0ba2344aa94b5f843060178 (DOCX import: declare wps as a supported feature, 2013-12-03), as the VML import handled this. Change-Id: I654b51d51448d25d400979a4a62189b86126ac01 Reviewed-on: https://gerrit.libreoffice.org/29517 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/include/oox/drawingml/fillproperties.hxx b/include/oox/drawingml/fillproperties.hxx index 3015424..bed67d6 100644 --- a/include/oox/drawingml/fillproperties.hxx +++ b/include/oox/drawingml/fillproperties.hxx @@ -121,6 +121,7 @@ struct BlipFillProperties Color maDuotoneColors[2]; /// Duotone Colors ArtisticEffectProperties maEffect; /// Artistic effect, not supported by core. +OptValue moAlphaModFix; ///< Alpha Modulate Fixed Effect. /** Overwrites all members that are explicitly set in rSourceProps. */ voidassignUsed( const BlipFillProperties& rSourceProps ); diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index 370be68..2acf94f 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -205,6 +205,7 @@ void BlipFillProperties::assignUsed( const BlipFillProperties& rSourceProps ) maDuotoneColors[0].assignIfUsed( rSourceProps.maDuotoneColors[0] ); maDuotoneColors[1].assignIfUsed( rSourceProps.maDuotoneColors[1] ); maEffect.assignUsed( rSourceProps.maEffect ); +moAlphaModFix.assignIfUsed(rSourceProps.moAlphaModFix); } void FillProperties::assignUsed( const FillProperties& rSourceProps ) @@ -652,6 +653,9 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap, } } } + +if (maBlipProps.moAlphaModFix.has()) +rPropMap.setProperty(ShapeProperty::FillTransparency, static_cast(maBlipProps.moAlphaModFix.get() / PER_PERCENT)); } break; diff --git a/oox/source/drawingml/fillpropertiesgroupcontext.cxx b/oox/source/drawingml/fillpropertiesgroupcontext.cxx index c8009f8..22d68fa 100644 --- a/oox/source/drawingml/fillpropertiesgroupcontext.cxx +++ b/oox/source/drawingml/fillpropertiesgroupcontext.cxx @@ -190,6 +190,9 @@ ContextHandlerRef BlipContext::onCreateContext( mrBlipProps.moBrightness = rAttribs.getInteger( XML_bright ); mrBlipProps.moContrast = rAttribs.getInteger( XML_contrast ); break; +case A_TOKEN( alphaModFix ): +mrBlipProps.moAlphaModFix = rAttribs.getInteger(XML_amt); +break; } return nullptr; } diff --git a/sw/qa/extras/ooxmlimport/data/tdf100830.docx b/sw/qa/extras/ooxmlimport/data/tdf100830.docx new file mode 100644 index 000..a51b890 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf100830.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 4c099e1..8752ee0 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -3294,6 +3294,12 @@ DECLARE_OOXMLIMPORT_TEST(testTdf99140, "tdf99140.docx") CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::LEFT_AND_WIDTH, getProperty(xTableProperties, "HoriOrient")); } +DECLARE_OOXMLIMPORT_TEST(testTdf100830, "tdf100830.docx") +{ +// FillTransparence wasn't imported, this was 0. +CPPUNIT_ASSERT_EQUAL(static_cast(50), getProperty(getShape(1), "FillTransparence")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: include/oox oox/source sw/qa
include/oox/vml/vmlshape.hxx|4 +++ oox/source/vml/vmlshape.cxx | 33 oox/source/vml/vmlshapecontext.cxx |6 + sw/qa/extras/ooxmlimport/data/tdf99135.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx|6 + 5 files changed, 49 insertions(+) New commits: commit bb646c1472d3b77066b01128baf1c9cafdb40233 Author: Miklos Vajna Date: Tue Apr 12 09:18:47 2016 +0200 tdf#99135 VML import: handle image crop The spec says in theory a % suffix could be also supported, but let's wait till that is seen in a real-world document. Change-Id: Ie026915e38dcb03c99085a1740075364b00e1c8d diff --git a/include/oox/vml/vmlshape.hxx b/include/oox/vml/vmlshape.hxx index 2d3cf21..93f0943 100644 --- a/include/oox/vml/vmlshape.hxx +++ b/include/oox/vml/vmlshape.hxx @@ -102,6 +102,10 @@ struct OOX_DLLPUBLIC ShapeTypeModel OUString maWrapDistanceRight;///< Distance from the right side of the shape to the text that wraps around it. OUString maWrapDistanceTop; ///< Distance from the top of the shape to the text that wraps around it. OUString maWrapDistanceBottom; ///< Distance from the bottom of the shape to the text that wraps around it. +OptValue moCropBottom; ///< Specifies the how much to crop the image from the bottom up as a fraction of picture size. +OptValue moCropLeft; ///< Specifies how much to crop the image from the left in as a fraction of picture size. +OptValue moCropRight; ///< Specifies how much to crop the image from the right in as a fraction of picture size. +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. explicitShapeTypeModel(); diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index c8d5476..279aca6 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -108,6 +109,19 @@ awt::Rectangle lclGetAbsRect( const awt::Rectangle& rRelRect, const awt::Rectang return aAbsRect; } +/// Count the crop value based on a crop fraction and a reference size. +sal_Int32 lclConvertCrop(const OUString& rCrop, sal_uInt32 nSize) +{ +if (rCrop.endsWith("f")) +{ +// Numeric value is specified in 1/65536-ths. +sal_uInt32 nCrop = rCrop.copy(0, rCrop.getLength() - 1).toUInt32(); +return (nCrop * nSize) / 65536; +} + +return 0; +} + } // namespace ShapeTypeModel::ShapeTypeModel(): @@ -833,6 +847,25 @@ Reference< XShape > SimpleShape::createPictureObject( const Reference< XShapes > const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper(); lcl_SetAnchorType(aPropSet, maTypeModel, rGraphicHelper); + +if (maTypeModel.moCropBottom.has() || maTypeModel.moCropLeft.has() || maTypeModel.moCropRight.has() || maTypeModel.moCropTop.has()) +{ +text::GraphicCrop aGraphicCrop; +uno::Reference xGraphic; +aPropSet.getProperty(xGraphic, PROP_Graphic); +awt::Size aOriginalSize = rGraphicHelper.getOriginalSize(xGraphic); + +if (maTypeModel.moCropBottom.has()) +aGraphicCrop.Bottom = lclConvertCrop(maTypeModel.moCropBottom.get(), aOriginalSize.Height); +if (maTypeModel.moCropLeft.has()) +aGraphicCrop.Left = lclConvertCrop(maTypeModel.moCropLeft.get(), aOriginalSize.Width); +if (maTypeModel.moCropRight.has()) +aGraphicCrop.Right = lclConvertCrop(maTypeModel.moCropRight.get(), aOriginalSize.Width); +if (maTypeModel.moCropTop.has()) +aGraphicCrop.Top = lclConvertCrop(maTypeModel.moCropTop.get(), aOriginalSize.Height); + +aPropSet.setProperty(PROP_GraphicCrop, aGraphicCrop); +} } return xShape; } diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index de0423c..f193227 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -347,6 +347,12 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( sal_Int32 nElement, const A bool bHasORelId = rAttribs.hasAttribute( O_TOKEN( relid ) ); mrTypeModel.moGraphicPath = decodeFragmentPath( rAttribs, bHasORelId ? O_TOKEN( relid ) : R_TOKEN( id ) ); mrTypeModel.moGraphicTitle = rAttribs.getString( O_TOKEN( title ) ); + +// Get crop attributes. +mrTypeModel.moCropBottom = rAttribs.getString(XML_cropbottom); +mrTypeModel.moCropLeft = rAttribs.getString(XML_cropleft); +mrTypeModel.moCropRight = rAttribs.getString(XML_cropright); +mrTypeModel.moCropTop = rAttribs.g
[Libreoffice-commits] core.git: include/oox oox/source sw/qa
include/oox/export/drawingml.hxx |2 - include/oox/export/shapes.hxx |1 oox/source/drawingml/customshapeproperties.cxx | 27 + oox/source/export/drawingml.cxx|7 +- oox/source/export/shapes.cxx | 10 ++--- oox/source/shape/WpsContext.cxx| 11 ++ oox/source/token/properties.txt|1 sw/qa/extras/ooxmlexport/data/fdo80897.docx|binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 10 + 9 files changed, 60 insertions(+), 9 deletions(-) New commits: commit acd2c90978052723475a41144dd5d92090fbf6b4 Author: Rohit Deshmukh Date: Fri Jul 18 12:27:25 2014 +0530 fdo#80897: Preservation of text warp properties. - Generic fix for all warp properties Change-Id: I77c37759aa49706fc3cd1a80770a85face53f0a2 diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index bf46326..db685b1 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -166,7 +166,7 @@ public: void WriteTransformation( const Rectangle& rRectangle, sal_Int32 nXmlNamespace, bool bFlipH = false, bool bFlipV = false, sal_Int32 nRotation = 0 ); -void WriteText( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > rXIface, bool bBodyPr = true, bool bText = true, sal_Int32 nXmlNamespace = 0); +void WriteText( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > rXIface, OUString presetWarp, bool bBodyPr = true, bool bText = true, sal_Int32 nXmlNamespace = 0); void WriteParagraph( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > rParagraph ); void WriteParagraphProperties( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > rParagraph ); void WriteParagraphNumbering( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, diff --git a/include/oox/export/shapes.hxx b/include/oox/export/shapes.hxx index c7f8d15..925ba72 100644 --- a/include/oox/export/shapes.hxx +++ b/include/oox/export/shapes.hxx @@ -73,6 +73,7 @@ private: ShapeHashMap maShapeMap; ShapeHashMap* mpShapeMap; +OUString m_presetWarp; public: diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx index 5dcc122..efaddba 100644 --- a/oox/source/drawingml/customshapeproperties.cxx +++ b/oox/source/drawingml/customshapeproperties.cxx @@ -151,15 +151,34 @@ void CustomShapeProperties::pushToPropSet( const ::oox::core::FilterBase& /* rFi Sequence< PropertyValue > aSeq = aPropertyMap.makePropertyValueSequence(); aPropSet.setProperty( PROP_CustomShapeGeometry, aSeq ); +const OUString sCustomShapeGeometry("CustomShapeGeometry"); +uno::Any aGeoPropSet = xPropSet->getPropertyValue( sCustomShapeGeometry ); +uno::Sequence< beans::PropertyValue > aGeoPropSeq; + +sal_Int32 i, nCount = 0; +if (aGeoPropSet >>= aGeoPropSeq) +{ +nCount = aGeoPropSeq.getLength(); +for ( i = 0; i < nCount; i++ ) +{ +const OUString sAdjustmentValues("AdjustmentValues"); +if ( aGeoPropSeq[ i ].Name.equals( sAdjustmentValues ) ) +{ +OUString presetTextWarp; +if ( aGeoPropSeq[ i ].Value >>= presetTextWarp ) +{ +aPropertyMap.setProperty( PROP_PresetTextWarp, Any( presetTextWarp ) ); +} +} +} +} + if ( maAdjustmentGuideList.size() ) { const OUString sType = "Type"; -const OUString sCustomShapeGeometry("CustomShapeGeometry"); -uno::Any aGeoPropSet = xPropSet->getPropertyValue( sCustomShapeGeometry ); -uno::Sequence< beans::PropertyValue > aGeoPropSeq; if ( aGeoPropSet >>= aGeoPropSeq ) { -sal_Int32 i, nCount = aGeoPropSeq.getLength(); +nCount = aGeoPropSeq.getLength(); for ( i = 0; i < nCount; i++ ) { const OUString sAdjustmentValues("AdjustmentValues"); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 75b6cfe..a303365 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1690,7 +1690,7 @@ void DrawingML::WriteParagraph( Reference< XTextContent > rParagraph ) mpFS->endElementNS( XML_a, XML_p ); } -void DrawingML::WriteText( Reference< XInterface > rXIface, bool bBodyPr, bool bText, sal_Int32 nXmlNamespace ) +void DrawingML::WriteText( Reference< XInterface > rXIface, OUString presetWarp, bool bBodyPr, bool bText, sal_Int32 nXmlNamespace ) { Reference< XText > xXText( rXIface, UNO_QUERY ); R
[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source
include/oox/export/drawingml.hxx |4 ++-- oox/source/export/drawingml.cxx |2 +- oox/source/vml/vmlshape.cxx |6 ++ sw/qa/extras/ooxmlexport/data/TextFrameRotation.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 11 +++ sw/source/filter/ww8/docxsdrexport.cxx | 17 +++-- sw/source/filter/ww8/docxsdrexport.hxx |2 ++ 7 files changed, 33 insertions(+), 9 deletions(-) New commits: commit 1bdd6d2129eecda564478d494fd46d14a54b6ac5 Author: sushil_shinde Date: Thu Jul 10 11:46:22 2014 +0530 fdo#80894 : Rotation value for textframe was missing after RT. - Rotation property is not available for TextFrame in LO. - Hence grabbaged this value. - Roundtripped rotation value by converting it properly for both dml and vml textbox. - Added UT for it. Change-Id: Ia040d55dc2ea79500df76877ba44a02971c872a8 Reviewed-on: https://gerrit.libreoffice.org/10190 Reviewed-by: Miklos Vajna Tested-by: Miklos Vajna diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index 6f64fcf..bf46326 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -29,10 +29,10 @@ #include #include #include "oox/drawingml/drawingmltypes.hxx" -#ifndef PPTX_EXPORT_ROTATE_CLOCKWISIFY +#ifndef OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY // Our rotation is counter-clockwise and is in 100ths of a degree. // drawingML rotation is clockwise and is in 6ths of a degree. -#define PPTX_EXPORT_ROTATE_CLOCKWISIFY(input) ((2160-input*600)%2160) +#define OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(input) ((2160-input*600)%2160) #endif class Graphic; diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 274453e..75b6cfe 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1102,7 +1102,7 @@ void DrawingML::WriteShapeTransformation( Reference< XShape > rXShape, sal_Int32 { if (bFlipV) {nRotation=(nRotation+18000)%36000;} } -WriteTransformation( Rectangle( Point( aPos.X, aPos.Y ), Size( aSize.Width, aSize.Height ) ), nXmlNamespace, bFlipH, bFlipV, PPTX_EXPORT_ROTATE_CLOCKWISIFY(nRotation) ); +WriteTransformation( Rectangle( Point( aPos.X, aPos.Y ), Size( aSize.Width, aSize.Height ) ), nXmlNamespace, bFlipH, bFlipV, OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(nRotation) ); } void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, bool bIsField ) diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 879b462..f98c717 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -319,6 +319,12 @@ Reference< XShape > ShapeBase::convertAndInsert( const Reference< XShapes >& rxS aGrabBag.realloc( length+1 ); aGrabBag[length].Name = "VML-Z-ORDER"; aGrabBag[length].Value = uno::makeAny( maTypeModel.maZIndex.toInt32() ); +if(!(maTypeModel.maRotation).isEmpty()) +{ +aGrabBag.realloc( length+2 ); +aGrabBag[length+1].Name = "mso-rotation-angle"; +aGrabBag[length+1].Value = uno::makeAny(sal_Int32(NormAngle360((maTypeModel.maRotation.toInt32()) * -100))); +} propertySet->setPropertyValue( "FrameInteropGrabBag", uno::makeAny(aGrabBag) ); } else diff --git a/sw/qa/extras/ooxmlexport/data/TextFrameRotation.docx b/sw/qa/extras/ooxmlexport/data/TextFrameRotation.docx new file mode 100644 index 000..fde69c5 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/TextFrameRotation.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index a5aa50d..afc8242 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -3741,6 +3741,17 @@ DECLARE_OOXMLEXPORT_TEST(testfdo80898, "fdo80898.docx") "/word/embeddings/oleObject1.doc"); } +DECLARE_OOXMLEXPORT_TEST(testFdo80894, "TextFrameRotation.docx") +{ +xmlDocPtr pXmlDoc = parseExport("word/document.xml"); +if (!pXmlDoc) + return; + +// Rotation value was not roundtripped for textframe. +assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[2]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:xfrm", +"rot","1620"); +} + DECLARE_OOXMLEXPORT_TEST(test2colHeader, "2col-header.docx") { // Header was lost on export when the document had multiple columns. diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index bb923aa..363b5b9 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexp
[Libreoffice-commits] core.git: include/oox oox/source sw/qa
include/oox/export/utils.hxx | 4 oox/source/drawingml/lineproperties.cxx | 15 +- oox/source/drawingml/linepropertiescontext.cxx| 46 +++ oox/source/export/drawingml.cxx | 51 +--- sw/qa/extras/ooxmlexport/data/dashed_line_custdash_1000th_of_percent.docx |binary sw/qa/extras/ooxmlexport/data/dashed_line_custdash_percentage.docx |binary sw/qa/extras/ooxmlexport/data/dashed_line_preset.docx |binary sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx | 62 ++ 8 files changed, 155 insertions(+), 23 deletions(-) New commits: commit 2211a67cc5e577f8abdcc96c9c63865be5fb988d Author: Adam Co Date: Sun Jun 8 16:35:32 2014 +0300 Rewrite import and export of custom dashes in ooxml filter (fix) The import mechanism of custom-dash (a:custDash) was wrong, and imported wrong values, which causes that if you would import-export-import-export - you would get inflated values, which might cause a corruption. The attributes for custom-dash nodes (a:ds) are of type 'PositivePercentage'. Office will read percentages formatted with a trailing percent sign or formatted as 1000th of a percent without a trailing percent sign, but only write percentages as 1000th's of a percent without a trailing percent sign. During import - LO did not check if it was in '%' format or in '1000th of a percent' format. So that was fixed. Also - when exporting - it always exports now in '1000th of a percent' format. Change-Id: I6bd74df26951974f85173227c832386c70034afb Reviewed-on: https://gerrit.libreoffice.org/9681 Reviewed-by: Miklos Vajna Tested-by: Miklos Vajna diff --git a/include/oox/export/utils.hxx b/include/oox/export/utils.hxx index 06ddfe3..b6bafdd 100644 --- a/include/oox/export/utils.hxx +++ b/include/oox/export/utils.hxx @@ -49,9 +49,9 @@ static inline sal_Int64 TwipsToEMU( sal_Int32 nTwips ) } template -OString writePercentage(T number) +OString write1000thOfAPercent(T number) { -return OString::number(number) + "%"; +return OString::number( number * 1000 ); } #endif diff --git a/oox/source/drawingml/lineproperties.cxx b/oox/source/drawingml/lineproperties.cxx index 2044095..372740b 100644 --- a/oox/source/drawingml/lineproperties.cxx +++ b/oox/source/drawingml/lineproperties.cxx @@ -107,19 +107,26 @@ void lclConvertCustomDash( LineDash& orLineDash, const LineProperties::DashStopV sal_Int16 nDashes = 0; sal_Int32 nDashLen = 0; sal_Int32 nDistance = 0; +sal_Int32 nConvertedLen = 0; +sal_Int32 nConvertedDistance = 0; for( LineProperties::DashStopVector::const_iterator aIt = rCustomDash.begin(), aEnd = rCustomDash.end(); aIt != aEnd; ++aIt ) { -if( aIt->first <= 2 ) +// Get from "1000th of percent" ==> percent ==> multiplier +nConvertedLen = aIt->first / 1000 / 100; +nConvertedDistance = aIt->second / 1000 / 100; + +// Check if it is a dot (100% = dot) +if( nConvertedLen == 1 ) { ++nDots; -nDotLen += aIt->first; +nDotLen += nConvertedLen; } else { ++nDashes; -nDashLen += aIt->first; +nDashLen += nConvertedLen; } -nDistance += aIt->second; +nDistance += nConvertedDistance; } orLineDash.DotLen = (nDots > 0) ? ::std::max< sal_Int32 >( nDotLen / nDots, 1 ) : 0; orLineDash.Dots = nDots; diff --git a/oox/source/drawingml/linepropertiescontext.cxx b/oox/source/drawingml/linepropertiescontext.cxx index 3195e56..ee49fba 100644 --- a/oox/source/drawingml/linepropertiescontext.cxx +++ b/oox/source/drawingml/linepropertiescontext.cxx @@ -66,8 +66,50 @@ ContextHandlerRef LinePropertiesContext::onCreateContext( sal_Int32 nElement, co return this; break; case A_TOKEN( ds ): -mrLineProperties.maCustomDash.push_back( LineProperties::DashStop( -rAttribs.getInteger( XML_d, 0 ), rAttribs.getInteger( XML_sp, 0 ) ) ); +{ +// 'a:ds' has 2 attributes : 'd' and 'sp' +// both are of type 'a:ST_PositivePercentage' +// according to the specs Office will read percentages formatted with a trailing percent sign +// or formatted as 1000th of a percent without a trailing percent sign, but only write percentages +// as 1000th's of a percent without a trailing percent sign. +// The code below takes care of both scenarios by converting to '1000th of a percent' always +OUString aStr; +sal_Int32 nDash = 0; +aStr = rAttribs.getString( XML_d, "" ); +if ( aStr.endsWith("%") ) +{ +// Ends
[Libreoffice-commits] core.git: include/oox oox/source sw/qa
include/oox/drawingml/effectpropertiescontext.hxx|3 oox/source/drawingml/effectpropertiescontext.cxx | 65 ++- oox/source/export/drawingml.cxx |8 + sw/qa/extras/ooxmlexport/data/shape-effect-preservation.docx |binary sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx | 17 ++ 5 files changed, 64 insertions(+), 29 deletions(-) New commits: commit 211637d575d717de8b9e9ed9bf6c4c29f8e8f772 Author: Jacobo Aragunde Pérez Date: Wed Apr 23 17:26:38 2014 +0200 ooxml: Preserve inner shadow effect on shapes. Reused most of the code of outerShdw effect. Modified an existing unit test to add a check for innerShdw. Change-Id: Ifdd77850bfd3b5fa250594469455b1b66c338611 diff --git a/include/oox/drawingml/effectpropertiescontext.hxx b/include/oox/drawingml/effectpropertiescontext.hxx index 060604b..f81396d 100644 --- a/include/oox/drawingml/effectpropertiescontext.hxx +++ b/include/oox/drawingml/effectpropertiescontext.hxx @@ -31,6 +31,9 @@ public: protected: EffectProperties& mrEffectProperties; + +private: +void saveUnsupportedAttribs( const AttributeList& rAttribs ); }; } } diff --git a/oox/source/drawingml/effectpropertiescontext.cxx b/oox/source/drawingml/effectpropertiescontext.cxx index 705adb0..458ee59 100644 --- a/oox/source/drawingml/effectpropertiescontext.cxx +++ b/oox/source/drawingml/effectpropertiescontext.cxx @@ -33,6 +33,37 @@ EffectPropertiesContext::~EffectPropertiesContext() { } +void EffectPropertiesContext::saveUnsupportedAttribs( const AttributeList& rAttribs ) +{ +if( rAttribs.hasAttribute( XML_algn ) ) +mrEffectProperties.appendUnsupportedEffectAttrib( "algn", + makeAny( rAttribs.getString( XML_algn, "" ) ) ); +if( rAttribs.hasAttribute( XML_blurRad ) ) +mrEffectProperties.appendUnsupportedEffectAttrib( "blurRad", + makeAny( rAttribs.getInteger( XML_blurRad, 0 ) ) ); +if( rAttribs.hasAttribute( XML_dir ) ) +mrEffectProperties.appendUnsupportedEffectAttrib( "dir", + makeAny( rAttribs.getInteger( XML_dir, 0 ) ) ); +if( rAttribs.hasAttribute( XML_dist ) ) +mrEffectProperties.appendUnsupportedEffectAttrib( "dist", + makeAny( rAttribs.getInteger( XML_dist, 0 ) ) ); +if( rAttribs.hasAttribute( XML_kx ) ) +mrEffectProperties.appendUnsupportedEffectAttrib( "kx", + makeAny( rAttribs.getInteger( XML_kx, 0 ) ) ); +if( rAttribs.hasAttribute( XML_ky ) ) +mrEffectProperties.appendUnsupportedEffectAttrib( "ky", + makeAny( rAttribs.getInteger( XML_ky, 0 ) ) ); +if( rAttribs.hasAttribute( XML_rotWithShape ) ) +mrEffectProperties.appendUnsupportedEffectAttrib( "rotWithShape", + makeAny( rAttribs.getInteger( XML_rotWithShape, 0 ) ) ); +if( rAttribs.hasAttribute( XML_sx ) ) +mrEffectProperties.appendUnsupportedEffectAttrib( "sx", + makeAny( rAttribs.getInteger( XML_sx, 0 ) ) ); +if( rAttribs.hasAttribute( XML_sy ) ) +mrEffectProperties.appendUnsupportedEffectAttrib( "sy", + makeAny( rAttribs.getInteger( XML_sy, 0 ) ) ); +} + ContextHandlerRef EffectPropertiesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) { switch( nElement ) @@ -40,39 +71,19 @@ ContextHandlerRef EffectPropertiesContext::onCreateContext( sal_Int32 nElement, case A_TOKEN( outerShdw ): { mrEffectProperties.msUnsupportedEffectName = "outerShdw"; -if( rAttribs.hasAttribute( XML_algn ) ) -mrEffectProperties.appendUnsupportedEffectAttrib( "algn", - makeAny( rAttribs.getString( XML_algn, "" ) ) ); -if( rAttribs.hasAttribute( XML_blurRad ) ) -mrEffectProperties.appendUnsupportedEffectAttrib( "blurRad", - makeAny( rAttribs.getInteger( XML_blurRad, 0 ) ) ); -if( rAttribs.hasAttribute( XML_dir ) ) -mrEffectProperties.appendUnsupportedEffectAttrib( "dir", - makeAny( rAttribs.getInteger( XML_dir, 0 ) ) ); -if( rAttribs.hasAttribute( XML_dist ) ) -mrEffectProperties.appendUnsupportedEffectAttrib( "dist", - makeAny( rAttribs.getInteger( XML_dist, 0 ) ) ); -if
[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source writerfilter/source
include/oox/drawingml/shape.hxx | 16 ++ oox/source/drawingml/shape.cxx| 19 +++ oox/source/shape/WpsContext.cxx | 35 +- oox/source/token/tokens.txt |1 sw/qa/extras/ooxmlexport/data/LinkedTextBoxes.docx|binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 10 + sw/source/filter/ww8/docxsdrexport.cxx| 75 +++-- writerfilter/source/dmapper/DomainMapper_Impl.cxx | 103 +- writerfilter/source/dmapper/DomainMapper_Impl.hxx |2 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |3 10 files changed, 250 insertions(+), 14 deletions(-) New commits: commit 255194801e9eb8e3aaede56837450af35f8313e0 Author: umeshkadam Date: Fri Apr 18 13:12:53 2014 +0530 fod#77122 DOCX filter: link between textboxes is not being preserved Added support for linked textboxes for docx interoperability. Reviewed on: https://gerrit.libreoffice.org/9092 Change-Id: I7db4f5a1783afff53c64908d182788b262f5e863 diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx index a7232fa..926f223 100644 --- a/include/oox/drawingml/shape.hxx +++ b/include/oox/drawingml/shape.hxx @@ -63,6 +63,15 @@ struct ChartShapeInfo explicit ChartShapeInfo( bool bEmbedShapes ) : mbEmbedShapes( bEmbedShapes ) {} }; +/// Attributes for a linked textbox. +struct LinkedTxbxAttr +{ +sal_Int32 id; +sal_Int32 seq; +LinkedTxbxAttr(): id(0),seq(0){}; +~LinkedTxbxAttr(){}; +}; + class OOX_DLLPUBLIC Shape : public boost::enable_shared_from_this< Shape > { @@ -176,6 +185,11 @@ public: voidsetDiagramDoms(const com::sun::star::uno::Sequence& rDiagramDoms) { maDiagramDoms = rDiagramDoms; } com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< com::sun::star::uno::Any > >resolveRelationshipsOfTypeFromOfficeDoc( core::XmlFilterBase& rFilter, const OUString& sFragment, const OUString& sType ); +voidsetLinkedTxbxAttributes(const LinkedTxbxAttr& rhs){ maLinkedTxbxAttr = rhs; }; +voidsetTxbxHasLinkedTxtBox( const bool rhs){ mbHasLinkedTxbx = rhs; }; +const LinkedTxbxAttr& getLinkedTxbxAttributes() { return maLinkedTxbxAttr; }; +boolisLinkedTxbx() { return mbHasLinkedTxbx; }; + protected: ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > @@ -279,6 +293,8 @@ private: // to propagate it when applying reference shape bool mbLockedCanvas; ///< Is this shape part of a locked canvas? bool mbWps; ///< Is this a wps shape? +LinkedTxbxAttr maLinkedTxbxAttr; +boolmbHasLinkedTxbx; // this text box has linked text box ? com::sun::star::uno::Sequence maDiagramDoms; }; diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index f7150db..1d0d452 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -139,6 +139,8 @@ Shape::Shape( const ShapePtr& pSourceShape ) , mbHiddenMasterShape( pSourceShape->mbHiddenMasterShape ) , mbLockedCanvas( pSourceShape->mbLockedCanvas ) , mbWps( pSourceShape->mbWps ) +, maLinkedTxbxAttr() +, mbHasLinkedTxbx(false) , maDiagramDoms( pSourceShape->maDiagramDoms ) {} @@ -677,6 +679,23 @@ Reference< XShape > Shape::createAndInsert( aGrabBag[length].Value = uno::makeAny(mpCustomShapePropertiesPtr->getShapePresetTypeName()); propertySet->setPropertyValue("FrameInteropGrabBag",uno::makeAny(aGrabBag)); } +//If the text box has links then save the link information so that +//it can be accessed in DomainMapper_Impl.cxx while chaining the text frames. +if (this->isLinkedTxbx()) +{ +uno::Reference propertySet (mxShape, uno::UNO_QUERY); +uno::Sequence aGrabBag; +propertySet->getPropertyValue("FrameInteropGrabBag") >>= aGrabBag; +sal_Int32 length = aGrabBag.getLength(); +aGrabBag.realloc( length + 3 ); +aGrabBag[length].Name = "TxbxHasLink"; +aGrabBag[length].Value = uno::makeAny(this->isLinkedTxbx()); +aGrabBag[length + 1 ].Name = "Txbx-Id"; +aGrabBag[length + 1 ].Value = uno::makeAny(this->getLinkedTxbxAttributes().id); +aGrabBag[length + 2 ].Name = "Txbx-Seq"; +aGrabBag[length + 2 ].Value = uno::makeAny(this->getLinkedTxbxAttributes().seq); + propertySet->setPropertyValue("FrameInteropGrabBag",uno::makeAny(aGrabBag)); +
[Libreoffice-commits] core.git: include/oox oox/source sw/qa writerfilter/source
include/oox/vml/vmlshape.hxx |1 + oox/source/vml/vmlshape.cxx | 14 ++ oox/source/vml/vmlshapecontext.cxx|1 + sw/qa/extras/ooxmlexport/data/fdo76591.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx |8 writerfilter/source/dmapper/DomainMapper_Impl.cxx | 17 - 6 files changed, 40 insertions(+), 1 deletion(-) New commits: commit 69eebf8735973a05c931182d2ebfe35ce25f4b1a Author: Sourav Date: Fri Apr 4 18:06:44 2014 +0530 fdo76591:-Textbox property (order-> send behind text) is not preserved. Z-Index was not handledin LO for vml. I have made the changes to handle that using aGrabBag. Change-Id: I2af3b2974c8eb699bc6a7b743dc438584d6517ac Reviewed-on: https://gerrit.libreoffice.org/8833 Reviewed-by: Miklos Vajna Tested-by: Miklos Vajna diff --git a/include/oox/vml/vmlshape.hxx b/include/oox/vml/vmlshape.hxx index d38c58f..832d3be 100644 --- a/include/oox/vml/vmlshape.hxx +++ b/include/oox/vml/vmlshape.hxx @@ -64,6 +64,7 @@ struct OOX_DLLPUBLIC ShapeTypeModel OptValue< Int32Pair > moCoordPos; ///< Top-left position of coordinate system for children scaling. OptValue< Int32Pair > moCoordSize; ///< Size of coordinate system for children scaling. OUString maPosition; ///< Position type of the shape. +OUString maZIndex;///< ZIndex of the shape OUString maLeft; ///< X position of the shape bounding box (number with unit). OUString maTop; ///< Y position of the shape bounding box (number with unit). OUString maWidth;///< Width of the shape bounding box (number with unit). diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index e79c9b8..d4bdbcf 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -41,6 +41,7 @@ #include #include #include + #include #include #include #include @@ -322,6 +323,19 @@ Reference< XShape > ShapeBase::convertAndInsert( const Reference< XShapes >& rxS PropertySet aShapeProp( xShape ); if( aShapeProp.hasProperty( PROP_Name ) ) aShapeProp.setProperty( PROP_Name, getShapeName() ); +uno::Reference< lang::XServiceInfo > xSInfo( xShape, uno::UNO_QUERY_THROW ); +if (xSInfo->supportsService("com.sun.star.text.TextFrame")) +{ +uno::Sequence aGrabBag; +uno::Reference propertySet (xShape, uno::UNO_QUERY); +propertySet->getPropertyValue("FrameInteropGrabBag") >>= aGrabBag; +sal_Int32 length = aGrabBag.getLength(); + +aGrabBag.realloc( length+1 ); +aGrabBag[length].Name = "VML-Z-ORDER"; +aGrabBag[length].Value = uno::makeAny( maTypeModel.maZIndex.toInt32() ); +propertySet->setPropertyValue( "FrameInteropGrabBag", uno::makeAny(aGrabBag) ); +} Reference< XControlShape > xControlShape( xShape, uno::UNO_QUERY ); if ( xControlShape.is() && !getTypeModel().mbVisible ) { diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index fdeca32..146940e 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -399,6 +399,7 @@ void ShapeTypeContext::setStyle( const OUString& rStyle ) if( ConversionHelper::separatePair( aName, aValue, rStyle.getToken( 0, ';', nIndex ), ':' ) ) { if( aName == "position" ) mrTypeModel.maPosition = aValue; +else if( aName == "z-index" )mrTypeModel.maZIndex = aValue; else if( aName == "left" ) mrTypeModel.maLeft = aValue; else if( aName == "top" )mrTypeModel.maTop = aValue; else if( aName == "width" ) mrTypeModel.maWidth = aValue; diff --git a/sw/qa/extras/ooxmlexport/data/fdo76591.docx b/sw/qa/extras/ooxmlexport/data/fdo76591.docx new file mode 100644 index 000..8ca4387 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo76591.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 68ef7ebb..aa48fda 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -2989,6 +2989,14 @@ DECLARE_OOXMLEXPORT_TEST(testFDO76163 , "fdo76163.docx") assertXPath ( pXmlDoc, "/w:document/w:body/w:p[2]/w:hyperlink/w:r[11]/w:fldChar", "fldCharType", "end" ); } +DECLARE_OOXMLEXPORT_TEST(fdo76591, "fdo76591.docx") +{ +xmlDocPtr pXmlDoc = parseExport("word/document.xml"); +if (!pXmlDoc) +return; +assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[3]/m
[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source
include/oox/export/vmlexport.hxx|2 oox/source/export/vmlexport.cxx | 27 - sw/qa/extras/ooxmlexport/data/pictureWatermark.docx |binary sw/qa/extras/ooxmlexport/data/textWatermark.docx|binary sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx | 26 sw/source/filter/ww8/wrtw8nds.cxx | 58 +++- sw/source/filter/ww8/wrtww8.hxx |2 7 files changed, 111 insertions(+), 4 deletions(-) New commits: commit ff2f55d6f0a515c8c6e4186e124db28cc4056f5b Author: Ravindra Vidhate Date: Wed Mar 5 11:38:22 2014 +0530 fdo#35324: Text and picture water are not imported and not preserved in RT. Problem : Open docx file which has Text/Picture as water mark. 1. The text is not imported properly also picture water mark is also considered as shape. 2. It writes the watermarks in Document.xml, while it should write in only Header.xml. Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport.cxx Reviewed on: https://gerrit.libreoffice.org/8457 Change-Id: Ic988858da25a4cba3ae16e614d920e2e16053a5f diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx index 2b414c0..744dbbd 100644 --- a/include/oox/export/vmlexport.hxx +++ b/include/oox/export/vmlexport.hxx @@ -90,7 +90,7 @@ public: sal_Int16 eVOri = -1, sal_Int16 eHRel = -1, sal_Int16 eVRel = -1, const Point* pNdTopLeft = 0, const sal_Bool bOOxmlExport = false ); virtual void AddSdrObjectVMLObject( const SdrObject& rObj); - +static bool IsWaterMarkShape(const OUString& rStr); protected: /// Add an attribute to the generated element. /// diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index 35eeae7..fe82ea0 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -175,7 +175,28 @@ void VMLExport::AddShape( sal_uInt32 nShapeType, sal_uInt32 nShapeFlags, sal_uIn { m_nShapeType = nShapeType; m_nShapeFlags = nShapeFlags; -m_pShapeAttrList->add( XML_id, ShapeIdString( nShapeId ) ); +// If shape is a watermark object - should keep the original shape's name +// because Microsoft detects if it is a watermark by the actual name +if (!IsWaterMarkShape(m_pSdrObject->GetName())) +{ +// Not a watermark object +m_pShapeAttrList->add( XML_id, ShapeIdString( nShapeId ) ); +} +else +{ +// A watermark object - store the optional shape ID also ('o:spid') +m_pShapeAttrList->add( XML_id, OUStringToOString(m_pSdrObject->GetName(), RTL_TEXTENCODING_UTF8) ); +} +} + +bool VMLExport::IsWaterMarkShape(const OUString& rStr) +{ + if (rStr.isEmpty() ) return false; + + if (rStr.match(OUString("PowerPlusWaterMarkObject")) || rStr.match(OUString("WordPictureWatermark"))) +return true; + else +return false; } static void impl_AddArrowHead( sax_fastparser::FastAttributeList *pAttrList, sal_Int32 nElement, sal_uInt32 nValue ) @@ -787,7 +808,9 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect aStream.Seek(0); OUString idStr = SvxMSDffManager::MSDFFReadZString(aStream, it->nPropSize, true); aStream.Seek(0); -m_pShapeAttrList->add(XML_ID, OUStringToOString(idStr, RTL_TEXTENCODING_UTF8)); +if (!IsWaterMarkShape(m_pSdrObject->GetName())) + m_pShapeAttrList->add(XML_ID, OUStringToOString(idStr, RTL_TEXTENCODING_UTF8)); + bAlreadyWritten[ESCHER_Prop_wzName] = true; } break; diff --git a/sw/qa/extras/ooxmlexport/data/pictureWatermark.docx b/sw/qa/extras/ooxmlexport/data/pictureWatermark.docx new file mode 100644 index 000..b526ecf Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/pictureWatermark.docx differ diff --git a/sw/qa/extras/ooxmlexport/data/textWatermark.docx b/sw/qa/extras/ooxmlexport/data/textWatermark.docx new file mode 100644 index 000..c8bff75 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/textWatermark.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx index 8842cdd..d46f583 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx @@ -911,6 +911,32 @@ DECLARE_OOXMLEXPORT_TEST(testDkVert, "dkvert.docx") CPPUNIT_ASSERT_EQUAL(sal_Int32(25), getProperty(xShape, "FillHatch").Distance); } +DECLARE_OOXMLEXPORT_TEST(testTextWatermark, "textWatermark.docx") +{ +//The problem was that the watermark ID was not preserved, +//and Word uses the object ID to identify if it is a watermark. +//It has to have the 'PowerPlusWaterMarkObject' string in it +xmlDocPtr pXmlHeader1 = parseExport("word/header1.x
[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source
include/oox/drawingml/shape.hxx |3 oox/source/drawingml/diagram/diagram.cxx| 15 oox/source/drawingml/diagram/diagram.hxx|4 - oox/source/drawingml/shape.cxx | 40 +++ oox/source/shape/ShapeContextHandler.cxx| 11 ++- sw/qa/extras/ooxmlexport/data/fdo74792.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx| 24 ++ sw/source/filter/ww8/docxsdrexport.cxx | 101 ++-- sw/source/filter/ww8/docxsdrexport.hxx |5 + 9 files changed, 193 insertions(+), 10 deletions(-) New commits: commit 6536826f2f4c747582d60ed40b0418c6a67a9829 Author: Vinaya Mandke Date: Tue Feb 25 13:13:11 2014 +0530 fdo#74792 [DOCX] Grab-bag rels and images for SmartArt Added support to grab-bag rels and associated Images for data[i].xml, and drawing[i].xml. Added UT for the same Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport.cxx Reviewed on: https://gerrit.libreoffice.org/8362 Change-Id: I545825f67214f14037ab72b77764a07d575b8b5b diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx index fa3f58c..7f3ba65 100644 --- a/include/oox/drawingml/shape.hxx +++ b/include/oox/drawingml/shape.hxx @@ -178,7 +178,8 @@ public: const com::sun::star::uno::Sequence & getDiagramDoms() { return maDiagramDoms; } voidsetDiagramDoms(const com::sun::star::uno::Sequence& rDiagramDoms) { maDiagramDoms = rDiagramDoms; } - +com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< com::sun::star::uno::Any > >resolveRelationshipsOfType( + core::XmlFilterBase& rFilter, OUString sFragment, OUString sType ); protected: ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > diff --git a/oox/source/drawingml/diagram/diagram.cxx b/oox/source/drawingml/diagram/diagram.cxx index da439ea..4672a28 100644 --- a/oox/source/drawingml/diagram/diagram.cxx +++ b/oox/source/drawingml/diagram/diagram.cxx @@ -338,6 +338,9 @@ uno::Sequence Diagram::getDomsAsPropertyValues() const { sal_Int32 length = maMainDomMap.size(); +if ( 0 < maDataRelsMap.getLength() ) +++length; + uno::Sequence aValue(length); beans::PropertyValue* pValue = aValue.getArray(); for (DiagramDomMap::const_iterator i = maMainDomMap.begin(); @@ -349,6 +352,13 @@ uno::Sequence Diagram::getDomsAsPropertyValues() const ++pValue; } +if ( 0 < maDataRelsMap.getLength() ) +{ +pValue[0].Name = OUString("OOXDiagramDataRels"); +pValue[0].Value = uno::makeAny ( maDataRelsMap ); +++pValue; +} + return aValue; } @@ -410,6 +420,11 @@ void loadDiagram( ShapePtr& pShape, "OOXData", pDiagram, xRefDataModel); + +pDiagram->getDataRelsMap() = pShape->resolveRelationshipsOfType( rFilter, xRefDataModel->getFragmentPath(), + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"; ); + + // Pass the info to pShape for( ::std::vector::const_iterator aIt = pData->getExtDrawings().begin(), aEnd = pData->getExtDrawings().end(); aIt != aEnd; ++aIt ) diff --git a/oox/source/drawingml/diagram/diagram.hxx b/oox/source/drawingml/diagram/diagram.hxx index 031c66b..ae611c9 100644 --- a/oox/source/drawingml/diagram/diagram.hxx +++ b/oox/source/drawingml/diagram/diagram.hxx @@ -157,6 +157,7 @@ typedef boost::shared_ptr< LayoutNode > LayoutNodePtr; typedef std::map< OUString, uno::Reference > DiagramDomMap; +typedef uno::Sequence< uno::Sequence< uno::Any > > DiagramRelsMap; @@ -296,7 +297,7 @@ public: DiagramColorMap& getColors() { return maColors; } const DiagramColorMap& getColors() const { return maColors; } DiagramDomMap & getDomMap() { return maMainDomMap; } - +DiagramRelsMap & getDataRelsMap() { return maDataRelsMap; } void addTo( const ShapePtr & pShape ); uno::Sequence getDomsAsPropertyValues() const; @@ -308,6 +309,7 @@ private: DiagramColorMapmaColors; std::map< OUString, ShapePtr > maShapeMap; DiagramDomMap maMainDomMap; +DiagramRelsMap maDataRelsMap; }; diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index ce1d3b6..3a2ebae 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1200,6 +1200,46 @@ void Shape::putPropertiesToGrabBag( const Sequence< PropertyValue >& aProperties } } +uno::Sequence< uno::Sequence< uno::Any > > Shape::resolveRelationshipsOfType(core::XmlFilterBase& rFilter, OUString sFragment, OUString sType ) +{ +uno::Sequence< uno::Sequence< uno::Any > > xRelListTemp; +sal_Int32 counter = 0;
[Libreoffice-commits] core.git: include/oox oox/source sw/qa
include/oox/drawingml/textcharacterproperties.hxx|3 ++ oox/source/drawingml/textcharacterproperties.cxx | 19 --- oox/source/drawingml/textcharacterpropertiescontext.cxx | 12 + oox/source/drawingml/theme.cxx | 17 - sw/qa/extras/ooxmlexport/data/groupshape-theme-font.docx |binary sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx | 10 +++ 6 files changed, 57 insertions(+), 4 deletions(-) New commits: commit 440fbd609054d78e37f4953dfdde8c79c10b4981 Author: Miklos Vajna Date: Fri Feb 28 12:17:51 2014 +0100 DOCX import: handle font theme references in group shape text Change-Id: I1d5b86ad17b2c4a0945f483c94ac6abf410cf1d6 diff --git a/include/oox/drawingml/textcharacterproperties.hxx b/include/oox/drawingml/textcharacterproperties.hxx index c079015..bddd25c 100644 --- a/include/oox/drawingml/textcharacterproperties.hxx +++ b/include/oox/drawingml/textcharacterproperties.hxx @@ -36,8 +36,11 @@ struct TextCharacterProperties { PropertyMap maHyperlinkPropertyMap; TextFontmaLatinFont; +TextFontmaLatinThemeFont; TextFontmaAsianFont; +TextFontmaAsianThemeFont; TextFontmaComplexFont; +TextFontmaComplexThemeFont; TextFontmaSymbolFont; Color maCharColor; Color maUnderlineColor; diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx index 1ad0bae..b782761 100644 --- a/oox/source/drawingml/textcharacterproperties.cxx +++ b/oox/source/drawingml/textcharacterproperties.cxx @@ -44,8 +44,11 @@ void TextCharacterProperties::assignUsed( const TextCharacterProperties& rSource // overwrite all properties exisiting in rSourceProps maHyperlinkPropertyMap.insert( rSourceProps.maHyperlinkPropertyMap.begin(), rSourceProps.maHyperlinkPropertyMap.end() ); maLatinFont.assignIfUsed( rSourceProps.maLatinFont ); +maLatinThemeFont.assignIfUsed( rSourceProps.maLatinThemeFont ); maAsianFont.assignIfUsed( rSourceProps.maAsianFont ); +maAsianThemeFont.assignIfUsed( rSourceProps.maAsianThemeFont ); maComplexFont.assignIfUsed( rSourceProps.maComplexFont ); +maComplexThemeFont.assignIfUsed( rSourceProps.maComplexThemeFont ); maSymbolFont.assignIfUsed( rSourceProps.maSymbolFont ); maCharColor.assignIfUsed( rSourceProps.maCharColor ); maHighlightColor.assignIfUsed( rSourceProps.maHighlightColor ); @@ -68,21 +71,31 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil sal_Int16 nFontPitch = 0; sal_Int16 nFontFamily = 0; -if( maLatinFont.getFontData( aFontName, nFontPitch, nFontFamily, rFilter ) ) +bool bRet = maLatinFont.getFontData( aFontName, nFontPitch, nFontFamily, rFilter ); +if (!bRet) +// In case there is no direct font, try to look it up as a theme reference. +bRet = maLatinThemeFont.getFontData( aFontName, nFontPitch, nFontFamily, rFilter ); +if (bRet) { rPropMap[ PROP_CharFontName ] <<= aFontName; rPropMap[ PROP_CharFontPitch ] <<= nFontPitch; rPropMap[ PROP_CharFontFamily ] <<= nFontFamily; } -if( maAsianFont.getFontData( aFontName, nFontPitch, nFontFamily, rFilter ) ) +bRet = maAsianFont.getFontData( aFontName, nFontPitch, nFontFamily, rFilter ); +if (!bRet) +bRet = maAsianThemeFont.getFontData( aFontName, nFontPitch, nFontFamily, rFilter ); +if (bRet) { rPropMap[ PROP_CharFontNameAsian ] <<= aFontName; rPropMap[ PROP_CharFontPitchAsian ] <<= nFontFamily; rPropMap[ PROP_CharFontFamilyAsian ] <<= nFontPitch; } -if( maComplexFont.getFontData( aFontName, nFontPitch, nFontFamily, rFilter ) ) +bRet = maComplexFont.getFontData( aFontName, nFontPitch, nFontFamily, rFilter ); +if (!bRet) +bRet = maComplexThemeFont.getFontData( aFontName, nFontPitch, nFontFamily, rFilter ); +if (bRet) { rPropMap[ PROP_CharFontNameComplex ] <<= aFontName; rPropMap[ PROP_CharFontPitchComplex ] <<= nFontPitch; diff --git a/oox/source/drawingml/textcharacterpropertiescontext.cxx b/oox/source/drawingml/textcharacterpropertiescontext.cxx index 8b6156e..cde4a63 100644 --- a/oox/source/drawingml/textcharacterpropertiescontext.cxx +++ b/oox/source/drawingml/textcharacterpropertiescontext.cxx @@ -136,14 +136,26 @@ ContextHandlerRef TextCharacterPropertiesContext::onCreateContext( sal_Int32 aEl { mrTextCharacterProperties.maLatinFont.setAttributes(rAttribs.getString(OOX_TOKEN(doc, ascii), OUString())); } +if (rAttribs.hasAttribute(OOX_TOKEN(doc, asciiTheme))) +{ + mrTextCharacterProperties.maLatinThemeFont.setAttributes(rAttribs.getString(OOX_TOKEN(doc, asciiTheme
[Libreoffice-commits] core.git: include/oox oox/source sw/qa
include/oox/drawingml/textfield.hxx |3 ++- include/oox/drawingml/textparagraph.hxx |3 ++- include/oox/drawingml/textrun.hxx |3 ++- oox/source/drawingml/textbody.cxx |5 - oox/source/drawingml/textfield.cxx|3 ++- oox/source/drawingml/textparagraph.cxx|4 ++-- oox/source/drawingml/textrun.cxx |6 +- sw/qa/extras/ooxmlimport/data/dml-charheight-default.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx |8 9 files changed, 27 insertions(+), 8 deletions(-) New commits: commit a6278bc3a9a7de6de5802fc4cbceb739bc0720d6 Author: Miklos Vajna Date: Fri Feb 14 16:19:50 2014 +0100 drawingML import: fix inheritance of character height The problem was that in case a shape had multiple (e.g. two) paragraphs, and in case the first paragraph had an explicit character height, but not the second, then the cursor carried over the explicit character height to the second paragraph, but it shouldn't, as that leads to incorrect character height in the second paragraph. Fix this by remembering the default character height and using that in case nothing is set explicitly. Change-Id: I66e06d5cf192739fb254f7280c74617171d9ee6a diff --git a/include/oox/drawingml/textfield.hxx b/include/oox/drawingml/textfield.hxx index e191c7d..4a27918 100644 --- a/include/oox/drawingml/textfield.hxx +++ b/include/oox/drawingml/textfield.hxx @@ -45,7 +45,8 @@ public: const ::oox::core::XmlFilterBase& rFilterBase, const ::com::sun::star::uno::Reference < ::com::sun::star::text::XText > & xText, const ::com::sun::star::uno::Reference < ::com::sun::star::text::XTextCursor > &xAt, -const TextCharacterProperties& rTextCharacterStyle ) const; +const TextCharacterProperties& rTextCharacterStyle, +float nDefaultCharHeight) const; private: TextParagraphProperties maTextParagraphProperties; diff --git a/include/oox/drawingml/textparagraph.hxx b/include/oox/drawingml/textparagraph.hxx index add0cef..f100458 100644 --- a/include/oox/drawingml/textparagraph.hxx +++ b/include/oox/drawingml/textparagraph.hxx @@ -54,7 +54,8 @@ public: const ::com::sun::star::uno::Reference < ::com::sun::star::text::XTextCursor > &xAt, const TextCharacterProperties& rTextStyleProperties, const TextListStyle& rTextListStyle, -bool bFirst = false ) const; +bool bFirst = false, +float nDefaultCharHeight = 0) const; private: TextParagraphProperties maProperties; diff --git a/include/oox/drawingml/textrun.hxx b/include/oox/drawingml/textrun.hxx index 9c925f0..5fec1a3 100644 --- a/include/oox/drawingml/textrun.hxx +++ b/include/oox/drawingml/textrun.hxx @@ -45,7 +45,8 @@ public: const ::oox::core::XmlFilterBase& rFilterBase, const ::com::sun::star::uno::Reference < ::com::sun::star::text::XText >& xText, const ::com::sun::star::uno::Reference < ::com::sun::star::text::XTextCursor >& xAt, -const TextCharacterProperties& rTextCharacterStyle ) const; +const TextCharacterProperties& rTextCharacterStyle, +float nDefaultCharHeight) const; private: OUString msText; diff --git a/oox/source/drawingml/textbody.cxx b/oox/source/drawingml/textbody.cxx index 3df7643..c90e482 100644 --- a/oox/source/drawingml/textbody.cxx +++ b/oox/source/drawingml/textbody.cxx @@ -20,6 +20,7 @@ #include "oox/drawingml/textbody.hxx" #include #include +#include #include "oox/drawingml/textparagraph.hxx" using namespace ::com::sun::star::uno; @@ -63,8 +64,10 @@ void TextBody::insertAt( aCombinedTextStyle.apply( *pMasterTextListStylePtr ); aCombinedTextStyle.apply( maTextListStyle ); +Reference xPropertySet(xAt, UNO_QUERY); +float nCharHeight = xPropertySet->getPropertyValue("CharHeight").get(); for( TextParagraphVector::const_iterator aBeg = maParagraphs.begin(), aIt = aBeg, aEnd = maParagraphs.end(); aIt != aEnd; ++aIt ) -(*aIt)->insertAt( rFilterBase, xText, xAt, rTextStyleProperties, aCombinedTextStyle, aIt == aBeg ); +(*aIt)->insertAt( rFilterBase, xText, xAt, rTextStyleProperties, aCombinedTextStyle, aIt == aBeg, nCharHeight ); } bool TextBody::isEmpty() diff --git a/oox/source/drawingml/textfield.cxx b/oox/source/drawingml/textfield.cxx index 76d90
[Libreoffice-commits] core.git: include/oox oox/source sw/qa
include/oox/export/drawingml.hxx|2 oox/source/drawingml/shape.cxx | 17 +-- oox/source/export/drawingml.cxx | 27 sw/qa/extras/ooxmlexport/data/shape-theme-preservation.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx| 15 +- 5 files changed, 36 insertions(+), 25 deletions(-) New commits: commit 42e4d237692a10aaecabbc3499d14d3860d93478 Author: Jacobo Aragunde Pérez Date: Tue Feb 11 19:07:00 2014 +0100 ooxml: Preserve color transformations for shape theme colors Colors can have modifiers like in the following example: In the case of RGB colors, the transformations are merged within the RGB color itself on import, so there's no need to preserve the original transformations, but that's necessary in the case of scheme colors. Slightly modified an existing unit test to check this feature too. Change-Id: I3a03a56f2b633f283c392e54842b326bd4df316b diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index 7a07f5e..84ac606 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -127,7 +127,7 @@ public: void WriteConnectorConnections( EscherConnectorListEntry& rConnectorEntry, sal_Int32 nStartID, sal_Int32 nEndID ); void WriteSolidFill( sal_uInt32 nColor, sal_Int32 nAlpha = MAX_PERCENT ); -void WriteSolidFill( OUString sSchemeName, sal_Int32 nAlpha = MAX_PERCENT ); +void WriteSolidFill( OUString sSchemeName, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aTransformations ); void WriteSolidFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet ); void WriteGradientFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet ); void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, OUString sURLPropName, sal_Int32 nXmlNamespace ); diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 99940ab..fb17f5d 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -782,22 +782,29 @@ Reference< XShape > Shape::createAndInsert( } // Store original fill and line colors of the shape and the theme color name to InteropGrabBag +Sequence< PropertyValue > aProperties( 6 ); //allocate the maximum possible number of slots sal_Int32 nSize = 2; -Sequence< PropertyValue > aProperties( nSize ); PUT_PROP( aProperties, 0, "OriginalSolidFillClr", aShapeProps[PROP_FillColor] ); PUT_PROP( aProperties, 1, "OriginalLnSolidFillClr", aShapeProps[PROP_LineColor] ); OUString sColorFillScheme = aFillProperties.maFillColor.getSchemeName(); if( !aFillProperties.maFillColor.isPlaceHolder() && !sColorFillScheme.isEmpty() ) { -aProperties.realloc( ++nSize ); -PUT_PROP( aProperties, nSize - 1, "SpPrSolidFillSchemeClr", sColorFillScheme ); +PUT_PROP( aProperties, nSize, "SpPrSolidFillSchemeClr", sColorFillScheme ); +nSize++; +PUT_PROP( aProperties, nSize, "SpPrSolidFillSchemeClrTransformations", + aFillProperties.maFillColor.getTransformations() ); +nSize++; } OUString sLnColorFillScheme = aLineProperties.maLineFill.maFillColor.getSchemeName(); if( !aLineProperties.maLineFill.maFillColor.isPlaceHolder() && !sLnColorFillScheme.isEmpty() ) { -aProperties.realloc( ++nSize ); -PUT_PROP( aProperties, nSize - 1, "SpPrLnSolidFillSchemeClr", sLnColorFillScheme ); +PUT_PROP( aProperties, nSize, "SpPrLnSolidFillSchemeClr", sLnColorFillScheme ); +nSize++; +PUT_PROP( aProperties, nSize, "SpPrLnSolidFillSchemeClrTransformations", + aLineProperties.maLineFill.maFillColor.getTransformations() ); +nSize++; } +aProperties.realloc( nSize ); //shrink the Sequence if we didn't use all the slots putPropertiesToGrabBag( aProperties ); // Store original gradient fill of the shape to InteropGrabBag diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 0058aa7..0f95e70 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -219,21 +219,10 @@ void DrawingML::WriteSolidFill( sal_uInt32 nColor, sal_Int32 nAlpha ) mpFS->endElementNS( XML_a, XML_solidFill ); } -void DrawingML::WriteSolidFill( OUString sSchemeName, sal_Int32 nAlpha ) +void DrawingML::WriteSolidFill( OUString sSchemeName, Sequence< Proper
[Libreoffice-commits] core.git: include/oox oox/source sw/qa
include/oox/export/drawingml.hxx |2 ++ oox/source/export/drawingml.cxx |2 +- sw/qa/extras/ooxmlexport/data/dml-textshape.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx |4 4 files changed, 7 insertions(+), 1 deletion(-) New commits: commit 6063555744ed89d8a757b667cddcdd4357839466 Author: Miklos Vajna Date: Thu Jan 23 13:34:34 2014 +0100 drawingML export: fix position of shape in case rotation is 180 degrees This is the other case when position shouldn't be adjusted. Change-Id: I9265bf1c762fd519e3a12e97d767b5d213644e6d diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index 65ae6f3..31c6f20 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -28,6 +28,8 @@ #include #include #ifndef PPTX_EXPORT_ROTATE_CLOCKWISIFY +// Our rotation is counter-clockwise and is in 100ths of a degree. +// drawingML rotation is clockwise and is in 6ths of a degree. #define PPTX_EXPORT_ROTATE_CLOCKWISIFY(input) ((2160-input*600)%2160) #endif diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 2fde292..db05030 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -751,7 +751,7 @@ void DrawingML::WriteShapeTransformation( Reference< XShape > rXShape, sal_Int32 { SdrObject* pShape = (SdrObject*) GetSdrObjectFromXShape( rXShape ); nRotation=pShape->GetRotateAngle(); -if (nRotation) +if (nRotation != 0 && nRotation != 18000) { int faccos=bFlipV ? -1 : 1; int facsin=bFlipH ? -1 : 1; diff --git a/sw/qa/extras/ooxmlexport/data/dml-textshape.docx b/sw/qa/extras/ooxmlexport/data/dml-textshape.docx index b98eea7..28e39c2 100644 Binary files a/sw/qa/extras/ooxmlexport/data/dml-textshape.docx and b/sw/qa/extras/ooxmlexport/data/dml-textshape.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index c18277c..9ce53cb 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -2492,6 +2492,10 @@ DECLARE_OOXMLEXPORT_TEST(testDmlTextshape, "dml-textshape.docx") // Connector was incorrectly shifted towards the top left corner, X was 552, Y was 0. CPPUNIT_ASSERT_EQUAL(sal_Int32(4018), xShape->getPosition().X); CPPUNIT_ASSERT_EQUAL(sal_Int32(1256), xShape->getPosition().Y); + +xShape.set(xGroup->getByIndex(5), uno::UNO_QUERY); +// This was incorrectly shifted towards the top of the page, Y was 106. +CPPUNIT_ASSERT_EQUAL(sal_Int32(1016), xShape->getPosition().Y); } DECLARE_OOXMLEXPORT_TEST(testDrawinglayerPicPos, "drawinglayer-pic-pos.docx") ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source
include/oox/drawingml/customshapeproperties.hxx |3 +++ oox/source/drawingml/customshapeproperties.cxx |1 + oox/source/drawingml/shape.cxx | 12 oox/source/shape/WpsContext.cxx |1 + sw/qa/extras/ooxmlexport/data/fdo70942.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx|9 + sw/source/filter/ww8/docxattributeoutput.cxx| 23 +++ 7 files changed, 45 insertions(+), 4 deletions(-) New commits: commit 3cf58da99ef152db31fa8378045d4bff041f7ff4 Author: Nikhil Walvekar Date: Fri Jan 10 20:21:45 2014 +0530 fdo#70942 Preserve original shape type, if shape contains text. Currently we change shape type to textframe if a shape contains text. Due to this shape information is not preserved when file is saved. Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport.cxx Reviewed on: https://gerrit.libreoffice.org/7372 Change-Id: I7af3ce29f857d6fa2ceab0350937d91638361e7c diff --git a/include/oox/drawingml/customshapeproperties.hxx b/include/oox/drawingml/customshapeproperties.hxx index e6df846..fdf8d49 100644 --- a/include/oox/drawingml/customshapeproperties.hxx +++ b/include/oox/drawingml/customshapeproperties.hxx @@ -135,6 +135,8 @@ public: sal_Int32 getShapePresetType() const { return mnShapePresetType; } OUString getShapePresetTypeName() const; void setShapePresetType( sal_Int32 nShapePresetType ){ mnShapePresetType = nShapePresetType; }; +sal_BoolgetShapeTypeOverride(){ return mbShapeTypeOverride; }; +voidsetShapeTypeOverride( sal_Bool bShapeTypeOverride ) { mbShapeTypeOverride = bShapeTypeOverride; }; std::vector< CustomShapeGuide >&getAdjustmentGuideList(){ return maAdjustmentGuideList; }; std::vector< CustomShapeGuide >&getGuideList(){ return maGuideList; }; @@ -155,6 +157,7 @@ public: private: sal_Int32 mnShapePresetType; +sal_BoolmbShapeTypeOverride; std::vector< CustomShapeGuide > maAdjustmentGuideList; std::vector< CustomShapeGuide > maGuideList; std::vector< AdjustHandle > maAdjustHandleList; diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx index 247e8cf..cdc6974 100644 --- a/oox/source/drawingml/customshapeproperties.cxx +++ b/oox/source/drawingml/customshapeproperties.cxx @@ -44,6 +44,7 @@ namespace oox { namespace drawingml { CustomShapeProperties::CustomShapeProperties() : mnShapePresetType ( -1 ) +, mbShapeTypeOverride(sal_False) , mbMirroredX ( sal_False ) , mbMirroredY ( sal_False ) , mnTextRotateAngle ( 0 ) diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 9437f02..eff9ad4 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -621,6 +621,18 @@ Reference< XShape > Shape::createAndInsert( { if (aServiceName == "com.sun.star.text.TextFrame") { +if (mpCustomShapePropertiesPtr != NULL && mpCustomShapePropertiesPtr->getShapeTypeOverride()) +{ +uno::Reference propertySet (mxShape, uno::UNO_QUERY); +uno::Sequence aGrabBag; +propertySet->getPropertyValue("FrameInteropGrabBag") >>= aGrabBag; +sal_Int32 length = aGrabBag.getLength(); +aGrabBag.realloc( length+1); +aGrabBag[length].Name = "mso-orig-shape-type"; +aGrabBag[length].Value = uno::makeAny(mpCustomShapePropertiesPtr->getShapePresetTypeName()); + propertySet->setPropertyValue("FrameInteropGrabBag",uno::makeAny(aGrabBag)); +} + // TextFrames have BackColor, not FillColor if (aShapeProps.hasProperty(PROP_FillColor)) { diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx index e2bbb0e..04e8a23 100644 --- a/oox/source/shape/WpsContext.cxx +++ b/oox/source/shape/WpsContext.cxx @@ -101,6 +101,7 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken } break; case XML_txbx: +mpShape->getCustomShapeProperties()->setShapeTypeOverride(true); mpShape->setServiceName("com.sun.star.text.TextFrame"); break; default: diff --git a/sw/qa/extras/ooxmlexport/data/fdo70942.docx b/sw/qa/extras/ooxmlexport/data/fdo70942.docx new file mode 100644 index 000..a04a784 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo70942.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index d4f5e3f..95b2cb2 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -2413,6 +2413,15 @@ DECLARE_OOXML
[Libreoffice-commits] core.git: include/oox oox/source sw/qa
include/oox/drawingml/shape.hxx |4 ++-- oox/source/drawingml/shape.cxx|9 + oox/source/shape/WpgContext.cxx |5 - sw/qa/extras/ooxmlexport/data/groupshape-textbox.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 11 +++ 5 files changed, 22 insertions(+), 7 deletions(-) New commits: commit 92518d513fe021be58a0bbeb04fd9306eb23ebda Author: Miklos Vajna Date: Fri Jan 3 12:07:30 2014 +0100 drawingML import: fix default character height of WPG rectangles The problem was that due to setting it to 18 in oox, the rectangle didn't inherit the default 11 from the document. Change-Id: I05c3b9c1d64eec58695e2039651a5f015df1f9e4 diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx index 5fcb91c..f39f75d0 100644 --- a/include/oox/drawingml/shape.hxx +++ b/include/oox/drawingml/shape.hxx @@ -72,7 +72,7 @@ class OOX_DLLPUBLIC Shape { public: -explicit Shape( const sal_Char* pServiceType = 0 ); +explicit Shape( const sal_Char* pServiceType = 0, bool bDefaultHeight = true ); explicit Shape( const ShapePtr& pSourceShape ); virtual ~Shape(); @@ -126,7 +126,7 @@ public: const OptValue< 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(); +voidsetDefaults(bool bHeight); ::oox::vml::OleObjectInfo& setOleObjectType(); ChartShapeInfo& setChartType( bool bEmbedShapes ); diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index a6e61a7..46dedec 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -82,7 +82,7 @@ namespace oox { namespace drawingml { // -Shape::Shape( const sal_Char* pServiceName ) +Shape::Shape( const sal_Char* pServiceName, bool bDefaultHeight ) : mbIsChild( false ) , mpLinePropertiesPtr( new LineProperties ) , mpFillPropertiesPtr( new FillProperties ) @@ -103,7 +103,7 @@ Shape::Shape( const sal_Char* pServiceName ) { if ( pServiceName ) msServiceName = OUString::createFromAscii( pServiceName ); -setDefaults(); +setDefaults(bDefaultHeight); } Shape::Shape( const ShapePtr& pSourceShape ) @@ -151,7 +151,7 @@ table::TablePropertiesPtr Shape::getTableProperties() return mpTablePropertiesPtr; } -void Shape::setDefaults() +void Shape::setDefaults(bool bHeight) { maDefaultShapeProperties[ PROP_TextAutoGrowHeight ] <<= false; maDefaultShapeProperties[ PROP_TextWordWrap ] <<= true; @@ -159,7 +159,8 @@ void Shape::setDefaults() maDefaultShapeProperties[ PROP_TextUpperDistance ] <<= static_cast< sal_Int32 >( 125 ); maDefaultShapeProperties[ PROP_TextRightDistance ] <<= static_cast< sal_Int32 >( 250 ); maDefaultShapeProperties[ PROP_TextLowerDistance ] <<= static_cast< sal_Int32 >( 125 ); -maDefaultShapeProperties[ PROP_CharHeight ] <<= static_cast< float >( 18.0 ); +if (bHeight) +maDefaultShapeProperties[ PROP_CharHeight ] <<= static_cast< float >( 18.0 ); maDefaultShapeProperties[ PROP_TextVerticalAdjust ] <<= TextVerticalAdjust_TOP; maDefaultShapeProperties[ PROP_ParaAdjust ] <<= static_cast< sal_Int16 >( ParagraphAdjust_LEFT ); // check for RTL? } diff --git a/oox/source/shape/WpgContext.cxx b/oox/source/shape/WpgContext.cxx index 39bb470..d66b518 100644 --- a/oox/source/shape/WpgContext.cxx +++ b/oox/source/shape/WpgContext.cxx @@ -46,7 +46,10 @@ oox::core::ContextHandlerRef WpgContext::onCreateContext(sal_Int32 nElementToken break; case XML_wsp: { -oox::drawingml::ShapePtr pShape(new oox::drawingml::Shape("com.sun.star.drawing.CustomShape")); +// Don't set default character height, Writer has its own way to set +// the default, and if we don't set it here, editeng properly inherits +// it. +oox::drawingml::ShapePtr pShape(new oox::drawingml::Shape("com.sun.star.drawing.CustomShape", /*bDefaultHeight=*/false)); return new oox::drawingml::ShapeContext(*this, mpShape, pShape); } break; diff --git a/sw/qa/extras/ooxmlexport/data/groupshape-textbox.docx b/sw/qa/extras/ooxmlexport/data/groupshape-textbox.docx new file mode 100644 index 000..fca71bf Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/groupshape-textbox.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index fa90304..23a8e6f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -2198,6 +2198,17 @@ DECLARE_OOXMLEXPORT_TEST(testFdo73215, "fdo73215.docx") "
[Libreoffice-commits] core.git: include/oox oox/source sw/qa
include/oox/drawingml/shape.hxx |5 + oox/source/drawingml/diagram/diagram.cxx | 106 +-- oox/source/drawingml/diagram/diagram.hxx | 20 - oox/source/drawingml/shape.cxx | 27 +++ oox/source/shape/ShapeContextHandler.cxx |9 ++ sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 47 + 6 files changed, 175 insertions(+), 39 deletions(-) New commits: commit ab0998c77cc5b1f15c4d584185e7c401ef6fe62b Author: Andres Gomez Date: Tue Sep 3 11:13:22 2013 +0300 oox: Smart-Art DOMs stored in the InteropGrabBag The XDocuments representing the DOM documents of a DrawingML diagram (Smart-Art) are now stored as the PropertyValues "OOXData", "OOXLayout", "OOXStyle", "OOXColor" and "OOXDrawing" into the "InteropGraBag" property of the parent SvxGroupShape created from such diagram. Modified the oox::drawingml::dgm::Diagram class to be able to hold the map storing the XDocuments and its names. Added the getDomMap() method to obtain the map directly and the getDomsAsPropertyValues method to get the map as a sequence of Property Values. Modified the methods for importing and loading the Smart-Art into the Diagram so they add automatically the DOM documents to it. Modified the oox::drawingml::Shape class to be able to hold the sequence of PropertyValues storing the XDocuments and its names coming from the oox::drawingml::dgm::Diagram class. Added the getDiagramDoms() and setDiagramDoms() methods. Enhanced the oox::shape::ShapeContextHandler::getShape() method to add the extended drawing document to the oox::drawingml::Shape class. Modified the oox::drawingml::Shape::createAndInsert() method to store the sequence of XDocuments in the "InteropGrabBag" property of the GroupShape service SvxGroupShape implementation representing a Smart-Art. Change-Id: I7d0b9dfbfc9d5299ddd25fab394e5e9a422d1dd1 Reviewed-on: https://gerrit.libreoffice.org/5849 Reviewed-by: Miklos Vajna Tested-by: Miklos Vajna diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx index 94c8342..8573968 100644 --- a/include/oox/drawingml/shape.hxx +++ b/include/oox/drawingml/shape.hxx @@ -174,6 +174,9 @@ public: voidaddExtDrawingRelId( const OUString &rRelId ) { maExtDrawings.push_back( rRelId ); } voidsetLockedCanvas(bool bLockedCanvas); boolgetLockedCanvas(); +const com::sun::star::uno::Sequence & +getDiagramDoms() { return maDiagramDoms; } +voidsetDiagramDoms(const com::sun::star::uno::Sequence& rDiagramDoms) { maDiagramDoms = rDiagramDoms; } protected: @@ -265,6 +268,8 @@ private: // we need separate flag because we don't want // to propagate it when applying reference shape bool mbLockedCanvas; ///< Is this shape part of a locked canvas? + +com::sun::star::uno::Sequence maDiagramDoms; }; // diff --git a/oox/source/drawingml/diagram/diagram.cxx b/oox/source/drawingml/diagram/diagram.cxx index a7bc286..93f5850 100644 --- a/oox/source/drawingml/diagram/diagram.cxx +++ b/oox/source/drawingml/diagram/diagram.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include "oox/drawingml/textbody.hxx" #include "oox/drawingml/textparagraph.hxx" #include "oox/drawingml/textrun.hxx" @@ -329,23 +330,53 @@ void Diagram::addTo( const ShapePtr & pParentShape ) ShapeCreationVisitor aCreationVisitor(pParentShape, *this); if( mpLayout->getNode() ) mpLayout->getNode()->accept( aCreationVisitor ); + +pParentShape->setDiagramDoms( getDomsAsPropertyValues() ); +} + +uno::Sequence Diagram::getDomsAsPropertyValues() const +{ +sal_Int32 length = maMainDomMap.size(); + +uno::Sequence aValue(length); +beans::PropertyValue* pValue = aValue.getArray(); +for (DiagramDomMap::const_iterator i = maMainDomMap.begin(); + i != maMainDomMap.end(); + ++i) +{ +pValue[0].Name = i->first; +pValue[0].Value = uno::makeAny(i->second); +++pValue; +} + +return aValue; } uno::Reference loadFragment( core::XmlFilterBase& rFilter, -const rtl::Reference< core::FragmentHandler >& rxHandler ) +const OUString& rFragmentPath ) { // load diagramming fragments into DOM representation, that later // gets serialized back to SAX events and parsed -return rFilter.importFragment( rxHandler->getFragmentPath() ); +return rFilter.importFragment( rFragmentPath ); +} + +uno::Reference loadFragment( +core::XmlFilterBase& rFilter, +const rtl::Reference< core::FragmentHandler >& rxHa
[Libreoffice-commits] core.git: include/oox oox/source sw/qa
include/oox/export/vmlexport.hxx|3 + oox/source/export/vmlexport.cxx | 21 + oox/source/vml/vmlshape.cxx | 44 +--- sw/qa/extras/ooxmlexport/data/fdo67737.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx| 24 +++ sw/qa/extras/ooxmlimport/ooxmlimport.cxx|5 +-- 6 files changed, 78 insertions(+), 19 deletions(-) New commits: commit d3ffe3ed3fa1b80c7e54439673029e105940db80 Author: Ri GangHu Date: Sun Aug 4 14:39:18 2013 +0300 fdo#67737 : fix for flip not being imported & rendered correctly Signed-off-by: Adam Co Reviewed-on: https://gerrit.libreoffice.org/5272 Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport.cxx Change-Id: I5c8440edad0381e33b64f64bb54aa8f1bc304007 diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx index f6fcbb2..7a5f7ec 100644 --- a/include/oox/export/vmlexport.hxx +++ b/include/oox/export/vmlexport.hxx @@ -126,6 +126,9 @@ private: /// Create an OString representing the id from a numerical id. static OString ShapeIdString( sal_uInt32 nId ); +/// Add flip X and\or flip Y +void AddFlipXY( ); + /// Add starting and ending point of a line to the m_pShapeAttrList. void AddLineDimensions( const Rectangle& rRectangle ); diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index 0c24040..6274e19 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -795,6 +796,17 @@ OString VMLExport::ShapeIdString( sal_uInt32 nId ) return OStringBuffer( 20 ).append( "shape_" ).append( sal_Int64( nId ) ).makeStringAndClear(); } +void VMLExport::AddFlipXY( ) +{ +const sal_uInt32 nFlipHandV = SHAPEFLAG_FLIPH + SHAPEFLAG_FLIPV; +switch ( m_nShapeFlags & nFlipHandV ) +{ +case SHAPEFLAG_FLIPH: m_pShapeStyle->append( ";flip:x" ); break; +case SHAPEFLAG_FLIPV: m_pShapeStyle->append( ";flip:y" ); break; +case (nFlipHandV): m_pShapeStyle->append( ";flip:xy" ); break; +} +} + void VMLExport::AddLineDimensions( const Rectangle& rRectangle ) { // style @@ -803,12 +815,7 @@ void VMLExport::AddLineDimensions( const Rectangle& rRectangle ) m_pShapeStyle->append( "position:absolute" ); -switch ( m_nShapeFlags & 0xC0 ) -{ -case 0x40: m_pShapeStyle->append( ";flip:y" ); break; -case 0x80: m_pShapeStyle->append( ";flip:x" ); break; -case 0xC0: m_pShapeStyle->append( ";flip:xy" ); break; -} +AddFlipXY(); // the actual dimensions OString aLeft, aTop, aRight, aBottom; @@ -862,6 +869,8 @@ void VMLExport::AddRectangleDimensions( OStringBuffer& rBuffer, const Rectangle& .append( ";width:" ).append( rRectangle.Right() - rRectangle.Left() ) .append( ";height:" ).append( rRectangle.Bottom() - rRectangle.Top() ); } + +AddFlipXY(); } void VMLExport::AddShapeAttribute( sal_Int32 nAttribute, const OString& rValue ) diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 40281cf..e5eb017 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -501,21 +501,18 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes { awt::Rectangle aShapeRect(rShapeRect); boost::optional oRotation; +bool bFlipX = false, bFlipY = false; if (!maTypeModel.maRotation.isEmpty()) oRotation.reset(maTypeModel.maRotation.toInt32()); if (!maTypeModel.maFlip.isEmpty()) { if (maTypeModel.maFlip.equalsAscii("x")) { -aShapeRect.X += aShapeRect.Width; -aShapeRect.Width *= -1; -if (oRotation) -oRotation.reset(360 - *oRotation); +bFlipX = true; } else if (maTypeModel.maFlip.equalsAscii("y")) { -aShapeRect.Y += aShapeRect.Height; -aShapeRect.Height *= -1; +bFlipY = true; } } @@ -604,12 +601,37 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes } PropertySet aPropertySet(xShape); -if (xShape.is() && oRotation) +if (xShape.is()) { -lcl_SetRotation(aPropertySet, *oRotation); -// If rotation is used, simple setPosition() is not enough. -aPropertySet.setAnyProperty(PROP_HoriOrientPosition, makeAny( aShapeRect.X ) ); -aPropertySet.setAnyProperty(PROP_VertOrientPosition, makeAny( aShapeRect.Y ) ); +if (oRotation) +{ +lcl_SetRotation(aPropertySet, *oRotation); +// If rotation is used, simple setPosition() is not enough. +aPropertySet.setAnyProperty(PROP_HoriOrientPosition, makeAny( aShapeRect.X ) ); +aPropertySet.setAnyProperty(PROP_VertOr
[Libreoffice-commits] core.git: include/oox oox/source sw/qa writerfilter/source
include/oox/vml/vmlshape.hxx |2 + oox/source/token/properties.txt |1 oox/source/vml/vmlshape.cxx | 20 +++ oox/source/vml/vmlshapecontext.cxx|2 + sw/qa/extras/ooxmlimport/data/n592908-frame.docx |binary sw/qa/extras/ooxmlimport/data/n592908-picture.docx|binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 24 ++ writerfilter/source/dmapper/OLEHandler.cxx| 12 - writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |8 +++--- writerfilter/source/ooxml/OOXMLFastContextHandler.hxx |2 + 10 files changed, 56 insertions(+), 15 deletions(-) New commits: commit b399c1a38cf7217bf530af3a78e8472d97890ac8 Author: Cédric Bosdonnat Date: Mon Apr 29 15:41:37 2013 +0200 n#592908: docx import, fixed handling of w10:wrap commit f837c4288cdae4921b3fb6747ba2e2cd5ce2dcd2 moved the handling of w10:wrap tag in oox, but thus no wrapping was imported any more. The fix consists in letting the w10:wrap element be handled by writerfilter's dmapper if the shape has already been retrieved from oox (which is the case for textboxes). In other cases, make sure that we don't set the Surround property once again in writerfilter as that would override what has been done in oox. (cherry picked from commit 51d5e90b7c09cb980bc72a2c6b1a65303ef15ea2) Conflicts: oox/inc/oox/vml/vmlshape.hxx sw/qa/extras/ooxmlimport/ooxmlimport.cxx Change-Id: I8ab158641afcf6b9945c52238e7f5adb9e8b3adf diff --git a/include/oox/vml/vmlshape.hxx b/include/oox/vml/vmlshape.hxx index 7b6a4a9..e16fe90 100644 --- a/include/oox/vml/vmlshape.hxx +++ b/include/oox/vml/vmlshape.hxx @@ -93,6 +93,8 @@ struct OOX_DLLPUBLIC ShapeTypeModel OptValue< OUString > moGraphicTitle; ///< Title of the graphic. OptValue< OUString > moWrapAnchorX; ///< The base object from which our horizontal positioning should be calculated. OptValue< OUString > moWrapAnchorY; ///< The base object from which our vertical positioning should be calculated. +OptValue< ::rtl::OUString > moWrapType; ///< How to wrap the text around the object +OptValue< ::rtl::OUString > moWrapSide; ///< On which side to wrap the text around the object explicitShapeTypeModel(); diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index 2430580..fb3e5a5 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -465,6 +465,7 @@ StringItemList Subtotals SubViewSize Suffix +Surround SwapXAndYAxis Symbol SymbolColor diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 3239151..0af325d 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -405,6 +406,24 @@ SimpleShape::SimpleShape( Drawing& rDrawing, const OUString& rService ) : { } +void lcl_setSurround(PropertySet& rPropSet, const ShapeTypeModel& rTypeModel) +{ +sal_Int32 nSurround = com::sun::star::text::WrapTextMode_THROUGHT; +if ( rTypeModel.moWrapType.get() == "square" || rTypeModel.moWrapType .get()== "tight" || + rTypeModel.moWrapType.get() == "through" ) +{ +nSurround = com::sun::star::text::WrapTextMode_PARALLEL; +if ( rTypeModel.moWrapSide.get() == "left" ) +nSurround = com::sun::star::text::WrapTextMode_LEFT; +else if ( rTypeModel.moWrapSide.get() == "right" ) +nSurround = com::sun::star::text::WrapTextMode_RIGHT; +} +else if ( rTypeModel.moWrapType.get() == "topAndBottom" ) +nSurround = com::sun::star::text::WrapTextMode_NONE; + +rPropSet.setProperty(PROP_Surround, nSurround); +} + void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& rTypeModel) { if ( rTypeModel.maPositionHorizontal == "center" ) @@ -449,6 +468,7 @@ void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& rTypeModel) { rPropSet.setProperty(PROP_AnchorType, text::TextContentAnchorType_AS_CHARACTER); } +lcl_setSurround( rPropSet, rTypeModel ); } Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect ) const diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index c5edd00..e0f8cfb 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -360,6 +360,8 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( sal_Int32 nElement, const A case NMSP_vmlWord | XML_wrap: mrTypeModel.moWrapAnchorX = rAttribs.getString(XML_anchorx); mrTypeModel.moWrapAnchorY = rAttribs.getString(XML_anchory); +mrTypeModel.moWrapType = rAttribs.getString(XML