[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source test/source

2023-12-04 Thread Tomaž Vajngerl (via logerrit)
 include/oox/export/drawingml.hxx   |   14 ++-
 oox/source/export/drawingml.cxx|  103 +++--
 oox/source/token/namespaces-strict.txt |1 
 oox/source/token/namespaces.txt|1 
 oox/source/token/tokens.txt|2 
 sw/qa/extras/ooxmlexport/data/SvgImageTest.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport20.cxx |   27 ++
 sw/source/filter/ww8/docxattributeoutput.cxx   |   16 +++
 test/source/xmltesttools.cxx   |2 
 9 files changed, 157 insertions(+), 9 deletions(-)

New commits:
commit bfbbf06bcea4d58117c14fd3f3b8743a3714f97e
Author: Tomaž Vajngerl 
AuthorDate: Sun Dec 3 13:21:35 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Mon Dec 4 10:33:34 2023 +0100

tdf#126084 support writing SVG images into OOXML using the MS OOXML 
extension

SVG files aren't supported in OOXML, but we can write it using the
MS OOXML extension, which is supported in the latest MSO versions.

For now this only implements the support in the exporter.

Change-Id: I688180fb5772f3999c2ee3020bc234f90d57cc2f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157237
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 9028cfdc0f9f..dcbb1b544390 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -259,16 +259,25 @@ private:
 DocumentType meDocumentType;
 
 OUString writeNewEntryToStorage(const Graphic& rGraphic, bool 
bRelPathToMedia);
+OUString writeNewSvgEntryToStorage(const Graphic& rGraphic, bool 
bRelPathToMedia);
 
 public:
+enum class TypeHint
+{
+Detect,
+SVG
+};
+
 GraphicExport(sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* 
pFilterBase, DocumentType eDocumentType)
 : mpFS(pFS)
 , mpFilterBase(pFilterBase)
 , meDocumentType(eDocumentType)
 {}
 
-OUString writeToStorage(Graphic const& rGraphic, bool bRelPathToMedia = 
false);
+OUString writeToStorage(Graphic const& rGraphic, bool bRelPathToMedia = 
false, TypeHint eHint = TypeHint::Detect);
+
 void writeBlip(Graphic const& rGraphic, std::vector 
const& rEffects, bool bRelPathToMedia = false);
+void writeSvgExtension(OUString const& rSvgRelId);
 };
 
 class OOX_DLLPUBLIC DrawingML
@@ -353,7 +362,7 @@ public:
 
 void SetBackgroundDark(bool bIsDark) { mbIsBackgroundDark = bIsDark; }
 /// If bRelPathToMedia is true add "../" to image folder path while adding 
the image relationship
-OUString writeGraphicToStorage(const Graphic  , bool 
bRelPathToMedia = false);
+OUString writeGraphicToStorage(const Graphic  , bool 
bRelPathToMedia = false, GraphicExport::TypeHint eHint = 
GraphicExport::TypeHint::Detect);
 
 void WriteColor( ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT );
 void WriteColor( const OUString& sColorSchemeName, const 
css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 
nAlpha = MAX_PERCENT );
@@ -516,6 +525,7 @@ public:
 const OUString& sRelationshipType,
 OUString* pRelationshipId );
 
+std::shared_ptr createGraphicExport();
 };
 
 }
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 228aa2326cc0..05c96c9ad798 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1283,12 +1283,34 @@ OUString DrawingML::GetRelationCompPrefix() const
 return OUString(getRelationCompPrefix(meDocumentType));
 }
 
+void GraphicExport::writeSvgExtension(OUString const& rSvgRelId)
+{
+if (rSvgRelId.isEmpty())
+return;
+
+mpFS->startElementNS(XML_a, XML_extLst);
+mpFS->startElementNS(XML_a, XML_ext, XML_uri, 
"{96DAC541-7B7A-43D3-8B79-37D633B846F1}");
+mpFS->singleElementNS(XML_asvg, XML_svgBlip,
+FSNS(XML_xmlns, XML_asvg), 
mpFilterBase->getNamespaceURL(OOX_NS(asvg)),
+FSNS(XML_r, XML_embed), rSvgRelId);
+mpFS->endElementNS(XML_a, XML_ext);
+mpFS->endElementNS( XML_a, XML_extLst);
+}
+
 void GraphicExport::writeBlip(Graphic const& rGraphic, 
std::vector const& rEffects, bool bRelPathToMedia)
 {
 OUString sRelId = writeToStorage(rGraphic, bRelPathToMedia);
 
 mpFS->startElementNS(XML_a, XML_blip, FSNS(XML_r, XML_embed), sRelId);
 
+auto const& rVectorGraphicDataPtr = rGraphic.getVectorGraphicData();
+
+if (rVectorGraphicDataPtr && rVectorGraphicDataPtr->getType() == 
VectorGraphicDataType::Svg)
+{
+OUString sSvgRelId = writeToStorage(rGraphic, bRelPathToMedia, 
TypeHint::SVG);
+writeSvgExtension(sSvgRelId);
+}
+
 for (auto const& rEffect : rEffects)
 {
 switch (rEffect.meType)
@@ -1514,19 +1536,72 @@ OUString GraphicExport::writeNewEntryToStorage(const 
Graphic& rGraphic, bool bRe
 return 

[Libreoffice-commits] core.git: include/oox oox/source

2023-12-03 Thread Tomaž Vajngerl (via logerrit)
 include/oox/export/drawingml.hxx |   29 ++--
 oox/source/export/drawingml.cxx  |  253 +++
 oox/source/export/shapes.cxx |   10 -
 3 files changed, 145 insertions(+), 147 deletions(-)

New commits:
commit 1be8b2752d30d3c024e46526e9d31c1e7066799c
Author: Tomaž Vajngerl 
AuthorDate: Sun Dec 3 12:53:58 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sun Dec 3 11:09:25 2023 +0100

oox: Refactor and simplify writing to storage with GraphicExport

Change-Id: I743dc99e0228b59050fb4926c8ef56bed8e82060
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160252
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index d50023be1c17..9028cfdc0f9f 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -140,28 +140,28 @@ protected:
 virtual ~DMLTextExport() {}
 };
 
-constexpr const char* getComponentDir(DocumentType eDocumentType)
+constexpr std::u16string_view getComponentDir(DocumentType eDocumentType)
 {
 switch (eDocumentType)
 {
-case DOCUMENT_DOCX: return "word";
-case DOCUMENT_PPTX: return "ppt";
-case DOCUMENT_XLSX: return "xl";
+case DOCUMENT_DOCX: return u"word";
+case DOCUMENT_PPTX: return u"ppt";
+case DOCUMENT_XLSX: return u"xl";
 }
 
-return "";
+return u"";
 }
 
-constexpr const char* getRelationCompPrefix(DocumentType eDocumentType)
+constexpr std::u16string_view getRelationCompPrefix(DocumentType eDocumentType)
 {
 switch (eDocumentType)
 {
-case DOCUMENT_DOCX: return "";
+case DOCUMENT_DOCX: return u"";
 case DOCUMENT_PPTX:
-case DOCUMENT_XLSX: return "../";
+case DOCUMENT_XLSX: return u"../";
 }
 
-return "";
+return u"";
 }
 
 class OOX_DLLPUBLIC GraphicExportCache
@@ -251,12 +251,15 @@ public:
 }
 };
 
-class GraphicExport
+class OOX_DLLPUBLIC GraphicExport
 {
+private:
 sax_fastparser::FSHelperPtr mpFS;
 oox::core::XmlFilterBase* mpFilterBase;
 DocumentType meDocumentType;
 
+OUString writeNewEntryToStorage(const Graphic& rGraphic, bool 
bRelPathToMedia);
+
 public:
 GraphicExport(sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* 
pFilterBase, DocumentType eDocumentType)
 : mpFS(pFS)
@@ -320,8 +323,8 @@ protected:
 
 void WriteStyleProperties( sal_Int32 nTokenId, const css::uno::Sequence< 
css::beans::PropertyValue >& aProperties );
 
-const char* GetComponentDir() const;
-const char* GetRelationCompPrefix() const;
+OUString GetComponentDir() const;
+OUString GetRelationCompPrefix() const;
 
 static bool EqualGradients( const css::awt::Gradient2& rGradient1, const 
css::awt::Gradient2& rGradient2 );
 bool IsFontworkShape(const css::uno::Reference< css::beans::XPropertySet 
>& rXShapePropSet);
@@ -350,7 +353,7 @@ public:
 
 void SetBackgroundDark(bool bIsDark) { mbIsBackgroundDark = bIsDark; }
 /// If bRelPathToMedia is true add "../" to image folder path while adding 
the image relationship
-OUString writeGraphicToStorage( const Graphic  , bool 
bRelPathToMedia = false );
+OUString writeGraphicToStorage(const Graphic  , bool 
bRelPathToMedia = false);
 
 void WriteColor( ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT );
 void WriteColor( const OUString& sColorSchemeName, const 
css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 
nAlpha = MAX_PERCENT );
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 8c2abb6b07cc..87c693a9cd75 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1273,14 +1273,14 @@ void DrawingML::WriteOutline( const 
Reference& rXPropSet, Referenc
 mpFS->endElementNS( XML_a, XML_ln );
 }
 
-const char* DrawingML::GetComponentDir() const
+OUString DrawingML::GetComponentDir() const
 {
-return getComponentDir(meDocumentType);
+return OUString(getComponentDir(meDocumentType));
 }
 
-const char* DrawingML::GetRelationCompPrefix() const
+OUString DrawingML::GetRelationCompPrefix() const
 {
-return getRelationCompPrefix(meDocumentType);
+return OUString(getRelationCompPrefix(meDocumentType));
 }
 
 void GraphicExport::writeBlip(Graphic const& rGraphic, 
std::vector const& rEffects, bool bRelPathToMedia)
@@ -1401,134 +1401,135 @@ void GraphicExport::writeBlip(Graphic const& 
rGraphic, std::vectorendElementNS(XML_a, XML_blip);
 }
 
-OUString GraphicExport::writeToStorage(const Graphic& rGraphic , bool 
bRelPathToMedia)
+OUString GraphicExport::writeNewEntryToStorage(const Graphic& rGraphic, bool 
bRelPathToMedia)
 {
-GfxLink aLink = rGraphic.GetGfxLink ();
-BitmapChecksum aChecksum = rGraphic.GetChecksum();
+GfxLink const& rLink = rGraphic.GetGfxLink();
+
 OUString sMediaType;
-const char* pExtension = "";
-OUString sRelId;
-OUString sPath;
+  

[Libreoffice-commits] core.git: include/oox oox/source

2023-11-15 Thread Regina Henschel (via logerrit)
 include/oox/drawingml/connectorshapecontext.hxx  |1 +
 oox/source/shape/WordprocessingCanvasContext.hxx |1 +
 2 files changed, 2 insertions(+)

New commits:
commit 6550c248521b65a367b33ba8db95d17a9a350800
Author: Regina Henschel 
AuthorDate: Wed Nov 15 19:24:59 2023 +0100
Commit: Regina Henschel 
CommitDate: Wed Nov 15 22:38:39 2023 +0100

Add comments to import of Wordprocessing Canvas

Change-Id: I09af78b08fed886e36beca1770db6fc54a72b707
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159473
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/include/oox/drawingml/connectorshapecontext.hxx 
b/include/oox/drawingml/connectorshapecontext.hxx
index 9911ce84de53..2b95ff4f3d4c 100644
--- a/include/oox/drawingml/connectorshapecontext.hxx
+++ b/include/oox/drawingml/connectorshapecontext.hxx
@@ -39,6 +39,7 @@ namespace oox::drawingml {
 sal_Int32 mnDestGlueId;
 };
 
+/// Handles CT_NonVisualConnectorProperties, used for cNvCnPr (Word) and 
cNvCxnSpPr (PP) elements.
 class ConnectorShapePropertiesContext : public ::oox::core::ContextHandler2
 {
 std::vector& mrConnectorShapePropertiesList;
diff --git a/oox/source/shape/WordprocessingCanvasContext.hxx 
b/oox/source/shape/WordprocessingCanvasContext.hxx
index dbb2148967e8..d4cc67f6a9ba 100644
--- a/oox/source/shape/WordprocessingCanvasContext.hxx
+++ b/oox/source/shape/WordprocessingCanvasContext.hxx
@@ -14,6 +14,7 @@
 
 namespace oox::shape
 {
+/// Handles CT_WordprocessingCanvas, used for wpc element, which is a drawing 
canvas for Word.
 class WordprocessingCanvasContext final : public oox::core::FragmentHandler2
 {
 public:


[Libreoffice-commits] core.git: include/oox oox/source

2023-10-31 Thread Henry Castro (via logerrit)
 include/oox/ppt/presentationfragmenthandler.hxx |8 ++--
 oox/source/ppt/presentationfragmenthandler.cxx  |   42 
 2 files changed, 26 insertions(+), 24 deletions(-)

New commits:
commit f2ae8b934aaac7c444e8493ed5e8189c6ce63328
Author: Henry Castro 
AuthorDate: Mon Oct 9 07:34:02 2023 -0400
Commit: Henry Castro 
CommitDate: Tue Oct 31 21:09:19 2023 +0100

tdf#155512: oox: ppt: fix import master slides, follow up

Import all master slides.

Signed-off-by: Henry Castro 
Change-Id: Ieac68bacf15c75e4c23ec692aadcb16033cdd092
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157701
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158716
Tested-by: Jenkins

diff --git a/include/oox/ppt/presentationfragmenthandler.hxx 
b/include/oox/ppt/presentationfragmenthandler.hxx
index 29204b282bdb..20fc521ae8c5 100644
--- a/include/oox/ppt/presentationfragmenthandler.hxx
+++ b/include/oox/ppt/presentationfragmenthandler.hxx
@@ -52,10 +52,10 @@ private:
 void importSlide( const ::oox::core::FragmentHandlerRef& 
rSlideFragmentHandler,
 const oox::ppt::SlidePersistPtr& rPersist );
 void importSlide(sal_uInt32 nSlide, bool bFirstSlide, bool bImportNotes);
-oox::ppt::SlidePersistPtr importMasterSlide(const 
::com::sun::star::uno::Reference<::com::sun::star::frame::XModel>& xModel,
-::oox::ppt::PowerPointImport& 
rFilter,
-std::u16string_view 
rLayoutFragmentPath,
-std::u16string_view 
rMasterFragmentPath);
+void importMasterSlides();
+void importMasterSlide(const 
::com::sun::star::uno::Reference<::com::sun::star::frame::XModel>& xModel,
+   ::oox::ppt::PowerPointImport& rFilter,
+   const OUString& rMasterFragmentPath);
 void saveThemeToGrabBag(const oox::drawingml::ThemePtr& pThemePtr, 
sal_Int32 nThemeIdx);
 void importCustomSlideShow(std::vector& rCustomShowList);
 static void importSlideNames(::oox::core::XmlFilterBase& rFilter, const 
std::vector& rSlidePersist);
diff --git a/oox/source/ppt/presentationfragmenthandler.cxx 
b/oox/source/ppt/presentationfragmenthandler.cxx
index edb523161c9e..2e0f48bbae98 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -215,18 +215,16 @@ void 
PresentationFragmentHandler::importCustomSlideShow(std::vector&
 }
 }
 
-SlidePersistPtr PresentationFragmentHandler::importMasterSlide(const 
Reference& xModel,
-   
PowerPointImport& rFilter,
-   
std::u16string_view rLayoutFragmentPath,
-   
std::u16string_view rMasterFragmentPath)
+void PresentationFragmentHandler::importMasterSlide(const 
Reference& xModel,
+PowerPointImport& rFilter,
+const OUString& 
rMasterFragmentPath)
 {
 OUString aLayoutFragmentPath;
-OUString aMasterFragmentPath(rMasterFragmentPath);
-SlidePersistPtr pMasterPersistPtr, pMasterPtr;
+SlidePersistPtr pMasterPersistPtr;
 Reference< drawing::XDrawPage > xMasterPage;
 Reference< drawing::XMasterPagesSupplier > xMPS( xModel, 
uno::UNO_QUERY_THROW );
 Reference< drawing::XDrawPages > xMasterPages( xMPS->getMasterPages(), 
uno::UNO_SET_THROW );
-RelationsRef xMasterRelations = rFilter.importRelations( 
aMasterFragmentPath );
+RelationsRef xMasterRelations = rFilter.importRelations( 
rMasterFragmentPath );
 
 for (const auto& rEntry : *xMasterRelations)
 {
@@ -252,7 +250,7 @@ SlidePersistPtr 
PresentationFragmentHandler::importMasterSlide(const ReferencesetLayoutPath( aLayoutFragmentPath );
 rFilter.getMasterPages().push_back( pMasterPersistPtr );
 rFilter.setActualSlidePersist( pMasterPersistPtr );
-FragmentHandlerRef xMasterFragmentHandler( new SlideFragmentHandler( 
rFilter, aMasterFragmentPath, pMasterPersistPtr, Master ) );
+FragmentHandlerRef xMasterFragmentHandler( new SlideFragmentHandler( 
rFilter, rMasterFragmentPath, pMasterPersistPtr, Master ) );
 
 // set the correct theme
 OUString aThemeFragmentPath = 
xMasterFragmentHandler->getFragmentPathFromFirstTypeFromOfficeDoc( u"theme" );
@@ -297,14 +295,7 @@ SlidePersistPtr 
PresentationFragmentHandler::importMasterSlide(const ReferenceaddTheme(pMasterPersistPtr->getPage());
 }
-
-if (pMasterPersistPtr->getLayoutPath() == rLayoutFragmentPath)
-{
-pMasterPtr = pMasterPersistPtr;
-}
 }
-
-return pMasterPtr;
 }
 
 void 

[Libreoffice-commits] core.git: include/oox oox/source sd/qa

2023-10-30 Thread Xisco Fauli (via logerrit)
 dev/null  |binary
 include/oox/drawingml/shape.hxx   |3 ---
 oox/source/drawingml/shape.cxx|2 --
 oox/source/drawingml/shapecontext.cxx |2 --
 oox/source/ppt/pptshape.cxx   |4 
 sd/qa/unit/import-tests2.cxx  |   11 ---
 6 files changed, 22 deletions(-)

New commits:
commit 4e2c70024c2370b2fc3514ee52ec433be998ec57
Author: Xisco Fauli 
AuthorDate: Mon Oct 23 15:34:58 2023 +0200
Commit: Xisco Fauli 
CommitDate: Mon Oct 30 13:59:34 2023 +0100

tdf#157679: Revert "pptx: import shape text from master page"

This reverts commit ae3b97a69688553e6c40ef4b64655db09d5a0f5e.

Change-Id: I39fd84b5efbff0a2cafe090f4f866c801cef19b4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158357
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index 204e8a890a7c..aa1b1dbf2289 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -236,8 +236,6 @@ public:
 voidsetTxbxHasLinkedTxtBox( const bool rhs){ 
mbHasLinkedTxbx = rhs; };
 const LinkedTxbxAttr& getLinkedTxbxAttributes() const { return 
maLinkedTxbxAttr; };
 boolisLinkedTxbx() const { return mbHasLinkedTxbx; };
-voidsetHasCustomPrompt(bool bValue) { mbHasCustomPrompt = 
bValue; }
-boolhasCustomPrompt() { return mbHasCustomPrompt; }
 
 void setZOrder(sal_Int32 nZOrder) { mnZOrder = nZOrder; }
 
@@ -394,7 +392,6 @@ private:
 bool mbTextBox; ///< This shape has a textbox.
 LinkedTxbxAttr  maLinkedTxbxAttr;
 boolmbHasLinkedTxbx; // this text box has 
linked text box ?
-boolmbHasCustomPrompt; // indicates that it's 
not a generic placeholder
 
 css::uno::Sequence maDiagramDoms;
 
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index c8149a087773..ff3d203f96ea 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -150,7 +150,6 @@ Shape::Shape( const char* pServiceName, bool bDefaultHeight 
)
 , mbWps( false )
 , mbTextBox( false )
 , mbHasLinkedTxbx( false )
-, mbHasCustomPrompt( false )
 , maDiagramDoms( 0 )
 , mpDiagramHelper( nullptr )
 {
@@ -195,7 +194,6 @@ Shape::Shape( const ShapePtr& pSourceShape )
 , mbWps( pSourceShape->mbWps )
 , mbTextBox( pSourceShape->mbTextBox )
 , mbHasLinkedTxbx(false)
-, mbHasCustomPrompt( pSourceShape->mbHasCustomPrompt )
 , maDiagramDoms( pSourceShape->maDiagramDoms )
 , mnZOrder(pSourceShape->mnZOrder)
 , mnZOrderOff(pSourceShape->mnZOrderOff)
diff --git a/oox/source/drawingml/shapecontext.cxx 
b/oox/source/drawingml/shapecontext.cxx
index 6407fb58a1f3..73fdab79508e 100644
--- a/oox/source/drawingml/shapecontext.cxx
+++ b/oox/source/drawingml/shapecontext.cxx
@@ -89,8 +89,6 @@ ContextHandlerRef ShapeContext::onCreateContext( sal_Int32 
aElementToken, const
 mpShapePtr->setSubType( rAttribs.getToken( XML_type, XML_obj ) );
 if( rAttribs.hasAttribute( XML_idx ) )
 mpShapePtr->setSubTypeIndex( rAttribs.getInteger( XML_idx, 0 ) );
-if( rAttribs.hasAttribute( XML_hasCustomPrompt ) )
-mpShapePtr->setHasCustomPrompt( rAttribs.getBool( 
XML_hasCustomPrompt, false ) );
 break;
 // nvSpPr CT_ShapeNonVisual end
 
diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index dc8d16ae6d37..733aa2a73aed 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -457,10 +457,6 @@ void PPTShape::addShape(
 Reference < XText > xText(mxShape, UNO_QUERY);
 if (xText.is())
 {
-if (mpPlaceholder && mpPlaceholder->getTextBody() && 
!mpPlaceholder->getTextBody()->isEmpty()
-&& mpPlaceholder->hasCustomPrompt())
-
xText->setString(mpPlaceholder->getTextBody()->toString());
-
 TextCharacterProperties aCharStyleProperties;
 getTextBody()->ApplyStyleEmpty(rFilterBase, xText, 
aCharStyleProperties, mpMasterTextListStyle);
 }
diff --git a/sd/qa/unit/data/pptx/shape-master-text.pptx 
b/sd/qa/unit/data/pptx/shape-master-text.pptx
deleted file mode 100644
index ca056b852d3a..
Binary files a/sd/qa/unit/data/pptx/shape-master-text.pptx and /dev/null differ
diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx
index 0ca3513ae00c..44eacbf1da05 100644
--- a/sd/qa/unit/import-tests2.cxx
+++ b/sd/qa/unit/import-tests2.cxx
@@ -1904,17 +1904,6 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, 
testOverflowBehaviorClip)
 }
 }
 
-CPPUNIT_TEST_FIXTURE(SdImportTest2, testShapeMasterText)
-{
-createSdImpressDoc("pptx/shape-master-text.pptx");
-uno::Reference xShape(getShapeFromPage(0, 0));
-
-uno::Reference const 

[Libreoffice-commits] core.git: include/oox oox/source

2023-10-27 Thread Balazs Varga (via logerrit)
 include/oox/helper/graphichelper.hxx |3 ++-
 oox/source/helper/graphichelper.cxx  |9 ++---
 2 files changed, 8 insertions(+), 4 deletions(-)

New commits:
commit c3ce373227433f40d686847a22e78651bedbab24
Author: Balazs Varga 
AuthorDate: Thu Oct 26 18:11:40 2023 +0200
Commit: Balazs Varga 
CommitDate: Fri Oct 27 12:28:56 2023 +0200

tdf#156593 FILEOPEN OOXML: image shown in full instead of cropped

Revert "Revert "tdf#118133 DOCX import: disable lazy-loading of tiff 
images""

This reverts commit c6bf16909db054ec5467ebdc0ea0c9dc07307048.

Lazy-loading doesn't work with cropped TIFF images, because in case of 
Lazy-load TIFF images
we are using MapUnit::MapPixel, but in case of cropped images we are using 
MapUnit::Map100thMM
and the crop values are relative to original bitmap size.

Change-Id: I2dbf6caf08d7899ec2eae683996d997809d62b89
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158509
Tested-by: Jenkins
Reviewed-by: Balazs Varga 

diff --git a/include/oox/helper/graphichelper.hxx 
b/include/oox/helper/graphichelper.hxx
index 32e699ed3468..0d0b69216617 100644
--- a/include/oox/helper/graphichelper.hxx
+++ b/include/oox/helper/graphichelper.hxx
@@ -121,7 +121,8 @@ public:
 css::uno::Reference< css::graphic::XGraphic >
 importGraphic(
 const css::uno::Reference< css::io::XInputStream 
>& rxInStrm,
-const WmfExternal* pExtHeader = nullptr ) const;
+const WmfExternal* pExtHeader = nullptr,
+const bool bLazyLoad = true ) const;
 
 /** Imports a graphic from the passed binary memory block. */
 css::uno::Reference< css::graphic::XGraphic >
diff --git a/oox/source/helper/graphichelper.cxx 
b/oox/source/helper/graphichelper.cxx
index d197b341da70..830f0131284b 100644
--- a/oox/source/helper/graphichelper.cxx
+++ b/oox/source/helper/graphichelper.cxx
@@ -229,13 +229,13 @@ awt::Size GraphicHelper::convertHmmToAppFont( const 
awt::Size& rHmm ) const
 // Graphics and graphic objects  --
 
 Reference< XGraphic > GraphicHelper::importGraphic( const Reference< 
XInputStream >& rxInStrm,
-const WmfExternal* pExtHeader ) const
+const WmfExternal* pExtHeader, const bool bLazyLoad ) const
 {
 Reference< XGraphic > xGraphic;
 if( rxInStrm.is() && mxGraphicProvider.is() ) try
 {
 Sequence< PropertyValue > aArgs{ 
comphelper::makePropertyValue("InputStream", rxInStrm),
- 
comphelper::makePropertyValue("LazyRead", true) };
+ 
comphelper::makePropertyValue("LazyRead", bLazyLoad) };
 
 if ( pExtHeader && pExtHeader->mapMode > 0 )
 {
@@ -283,8 +283,11 @@ Reference< XGraphic > 
GraphicHelper::importEmbeddedGraphic( const OUString& rStr
 xGraphic = mxGraphicMapper->findGraphic(rStreamName);
 if (!xGraphic.is())
 {
+// Lazy-loading doesn't work with cropped TIFF images, because in 
case of Lazy-load TIFF images
+// we are using MapUnit::MapPixel, but in case of cropped images 
we are using MapUnit::Map100thMM
+// and the crop values are relative to original bitmap size.
 auto xStream = mxStorage->openInputStream(rStreamName);
-xGraphic = importGraphic(xStream, pExtHeader);
+xGraphic = importGraphic(xStream, pExtHeader, 
!rStreamName.endsWith(".tiff"));
 if (xGraphic.is())
 mxGraphicMapper->putGraphic(rStreamName, xGraphic);
 }


[Libreoffice-commits] core.git: include/oox oox/source sd/qa

2023-10-04 Thread Henry Castro (via logerrit)
 include/oox/ppt/presentationfragmenthandler.hxx |4 
 oox/source/ppt/presentationfragmenthandler.cxx  |  121 +---
 sd/qa/unit/export-tests-ooxml2.cxx  |4 
 3 files changed, 71 insertions(+), 58 deletions(-)

New commits:
commit adcde78935fb8ca2b93322aa3a558d0b3ccdbfad
Author: Henry Castro 
AuthorDate: Thu Sep 28 15:01:43 2023 -0400
Commit: Henry Castro 
CommitDate: Wed Oct 4 21:07:14 2023 +0200

tdf#155512: oox: ppt: fix import master slides

Import all master slides according to
the relationship with slide layouts.

Adjust unit test values:

SdOOXMLExportTest2::testTdf106867
I do not know why those values change since
importing embedded video source code was not touched

SdOOXMLExportTest2::testAccentColor
The accent6 is a constant value.

Signed-off-by: Henry Castro 
Change-Id: Ic7c70d2c4ce30a7f2d2d1cf22604f1119a66f5f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157387
Tested-by: Jenkins CollaboraOffice 
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 
(cherry picked from commit 08ed103d734ebf65202dc097c7bb0990573f8fd1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157532
Tested-by: Jenkins

diff --git a/include/oox/ppt/presentationfragmenthandler.hxx 
b/include/oox/ppt/presentationfragmenthandler.hxx
index 4685ea2d8316..29204b282bdb 100644
--- a/include/oox/ppt/presentationfragmenthandler.hxx
+++ b/include/oox/ppt/presentationfragmenthandler.hxx
@@ -54,8 +54,8 @@ private:
 void importSlide(sal_uInt32 nSlide, bool bFirstSlide, bool bImportNotes);
 oox::ppt::SlidePersistPtr importMasterSlide(const 
::com::sun::star::uno::Reference<::com::sun::star::frame::XModel>& xModel,
 ::oox::ppt::PowerPointImport& 
rFilter,
-const OUString& 
rLayoutFragmentPath,
-const OUString& 
rMasterFragmentPath);
+std::u16string_view 
rLayoutFragmentPath,
+std::u16string_view 
rMasterFragmentPath);
 void saveThemeToGrabBag(const oox::drawingml::ThemePtr& pThemePtr, 
sal_Int32 nThemeIdx);
 void importCustomSlideShow(std::vector& rCustomShowList);
 static void importSlideNames(::oox::core::XmlFilterBase& rFilter, const 
std::vector& rSlidePersist);
diff --git a/oox/source/ppt/presentationfragmenthandler.cxx 
b/oox/source/ppt/presentationfragmenthandler.cxx
index 538d79df7f50..5dd00957b8b8 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -217,75 +217,88 @@ void 
PresentationFragmentHandler::importCustomSlideShow(std::vector&
 
 SlidePersistPtr PresentationFragmentHandler::importMasterSlide(const 
Reference& xModel,

PowerPointImport& rFilter,
-   const OUString& 
rLayoutFragmentPath,
-   const OUString& 
rMasterFragmentPath)
+   
std::u16string_view rLayoutFragmentPath,
+   
std::u16string_view rMasterFragmentPath)
 {
-SlidePersistPtr pMasterPersistPtr;
+OUString aLayoutFragmentPath;
+OUString aMasterFragmentPath(rMasterFragmentPath);
+SlidePersistPtr pMasterPersistPtr, pMasterPtr;
 Reference< drawing::XDrawPage > xMasterPage;
 Reference< drawing::XMasterPagesSupplier > xMPS( xModel, 
uno::UNO_QUERY_THROW );
 Reference< drawing::XDrawPages > xMasterPages( xMPS->getMasterPages(), 
uno::UNO_SET_THROW );
+RelationsRef xMasterRelations = rFilter.importRelations( 
aMasterFragmentPath );
 
-sal_Int32 nIndex;
-if( rFilter.getMasterPages().empty() )
+for (const auto& rEntry : *xMasterRelations)
 {
-nIndex = 0;
-xMasterPages->getByIndex( nIndex ) >>= xMasterPage;
-}
-else
-{
-nIndex = xMasterPages->getCount();
-xMasterPage = xMasterPages->insertNewByIndex( nIndex );
-}
+aLayoutFragmentPath = 
xMasterRelations->getFragmentPathFromRelation(rEntry.second);
 
-pMasterPersistPtr = std::make_shared( rFilter, true, false, 
xMasterPage,
-
std::make_shared( Master, "com.sun.star.drawing.GroupShape" ), 
mpTextListStyle );
-pMasterPersistPtr->setLayoutPath( rLayoutFragmentPath );
-rFilter.getMasterPages().push_back( pMasterPersistPtr );
-rFilter.setActualSlidePersist( pMasterPersistPtr );
-FragmentHandlerRef xMasterFragmentHandler( new SlideFragmentHandler( 
rFilter, rMasterFragmentPath, pMasterPersistPtr, Master ) );
-
-// set the correct theme
-OUString aThemeFragmentPath = 

[Libreoffice-commits] core.git: include/oox oox/source

2023-10-03 Thread Henry Castro (via logerrit)
 include/oox/ppt/presentationfragmenthandler.hxx |6 +
 oox/source/ppt/presentationfragmenthandler.cxx  |  137 
 2 files changed, 80 insertions(+), 63 deletions(-)

New commits:
commit 9fabd7c11989c2a89c5bb238e6cb52b0a6678851
Author: Henry Castro 
AuthorDate: Thu Sep 28 14:23:55 2023 -0400
Commit: Henry Castro 
CommitDate: Tue Oct 3 21:48:00 2023 +0200

tdf#155512: oox: ppt: abstraction "importMasterSlide"

Signed-off-by: Henry Castro 
Change-Id: Icfe8e3abbada7f728b2ad1f8e300a688f51d8f75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157386
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 
(cherry picked from commit 84ac58c37fffa0c8b6d55c70009515d013ad65b4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157468
Tested-by: Jenkins

diff --git a/include/oox/ppt/presentationfragmenthandler.hxx 
b/include/oox/ppt/presentationfragmenthandler.hxx
index 7ac929ec555b..4685ea2d8316 100644
--- a/include/oox/ppt/presentationfragmenthandler.hxx
+++ b/include/oox/ppt/presentationfragmenthandler.hxx
@@ -38,6 +38,8 @@ namespace oox::core { class XmlFilterBase; }
 
 namespace oox::ppt {
 
+class PowerPointImport;
+
 class PresentationFragmentHandler final : public ::oox::core::FragmentHandler2
 {
 public:
@@ -50,6 +52,10 @@ private:
 void importSlide( const ::oox::core::FragmentHandlerRef& 
rSlideFragmentHandler,
 const oox::ppt::SlidePersistPtr& rPersist );
 void importSlide(sal_uInt32 nSlide, bool bFirstSlide, bool bImportNotes);
+oox::ppt::SlidePersistPtr importMasterSlide(const 
::com::sun::star::uno::Reference<::com::sun::star::frame::XModel>& xModel,
+::oox::ppt::PowerPointImport& 
rFilter,
+const OUString& 
rLayoutFragmentPath,
+const OUString& 
rMasterFragmentPath);
 void saveThemeToGrabBag(const oox::drawingml::ThemePtr& pThemePtr, 
sal_Int32 nThemeIdx);
 void importCustomSlideShow(std::vector& rCustomShowList);
 static void importSlideNames(::oox::core::XmlFilterBase& rFilter, const 
std::vector& rSlidePersist);
diff --git a/oox/source/ppt/presentationfragmenthandler.cxx 
b/oox/source/ppt/presentationfragmenthandler.cxx
index 9b52b92d97d0..538d79df7f50 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -215,6 +215,79 @@ void 
PresentationFragmentHandler::importCustomSlideShow(std::vector&
 }
 }
 
+SlidePersistPtr PresentationFragmentHandler::importMasterSlide(const 
Reference& xModel,
+   
PowerPointImport& rFilter,
+   const OUString& 
rLayoutFragmentPath,
+   const OUString& 
rMasterFragmentPath)
+{
+SlidePersistPtr pMasterPersistPtr;
+Reference< drawing::XDrawPage > xMasterPage;
+Reference< drawing::XMasterPagesSupplier > xMPS( xModel, 
uno::UNO_QUERY_THROW );
+Reference< drawing::XDrawPages > xMasterPages( xMPS->getMasterPages(), 
uno::UNO_SET_THROW );
+
+sal_Int32 nIndex;
+if( rFilter.getMasterPages().empty() )
+{
+nIndex = 0;
+xMasterPages->getByIndex( nIndex ) >>= xMasterPage;
+}
+else
+{
+nIndex = xMasterPages->getCount();
+xMasterPage = xMasterPages->insertNewByIndex( nIndex );
+}
+
+pMasterPersistPtr = std::make_shared( rFilter, true, false, 
xMasterPage,
+
std::make_shared( Master, "com.sun.star.drawing.GroupShape" ), 
mpTextListStyle );
+pMasterPersistPtr->setLayoutPath( rLayoutFragmentPath );
+rFilter.getMasterPages().push_back( pMasterPersistPtr );
+rFilter.setActualSlidePersist( pMasterPersistPtr );
+FragmentHandlerRef xMasterFragmentHandler( new SlideFragmentHandler( 
rFilter, rMasterFragmentPath, pMasterPersistPtr, Master ) );
+
+// set the correct theme
+OUString aThemeFragmentPath = 
xMasterFragmentHandler->getFragmentPathFromFirstTypeFromOfficeDoc( u"theme" );
+if( !aThemeFragmentPath.isEmpty() )
+{
+std::map< OUString, oox::drawingml::ThemePtr >& rThemes( 
rFilter.getThemes() );
+std::map< OUString, oox::drawingml::ThemePtr >::iterator aIter2( 
rThemes.find( aThemeFragmentPath ) );
+if( aIter2 == rThemes.end() )
+{
+oox::drawingml::ThemePtr pThemePtr = 
std::make_shared();
+pMasterPersistPtr->setTheme( pThemePtr );
+Reference xDoc=
+rFilter.importFragment(aThemeFragmentPath);
+
+auto pTheme = std::make_shared();
+pThemePtr->setTheme(pTheme);
+
+rFilter.importFragment(
+new ThemeFragmentHandler(rFilter, aThemeFragmentPath, 
*pThemePtr, *pTheme),
+   

[Libreoffice-commits] core.git: include/oox oox/source sc/source

2023-08-11 Thread Caolán McNamara (via logerrit)
 include/oox/vml/vmlshape.hxx|4 ++--
 oox/source/vml/vmlshape.cxx |   10 --
 sc/source/filter/oox/commentsbuffer.cxx |7 ++-
 3 files changed, 12 insertions(+), 9 deletions(-)

New commits:
commit 5aeb15e95d26ce6de28eb5f5933324828d553f41
Author: Caolán McNamara 
AuthorDate: Fri Aug 11 10:46:53 2023 +0100
Commit: Caolán McNamara 
CommitDate: Fri Aug 11 18:12:47 2023 +0200

refactor to return the position to be set by the caller instead

no change in behavior intended

Change-Id: I32043bdf1d29521d8503df315fa786236e272f7d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155580
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/include/oox/vml/vmlshape.hxx b/include/oox/vml/vmlshape.hxx
index d46c23282324..8c63d8cbd26c 100644
--- a/include/oox/vml/vmlshape.hxx
+++ b/include/oox/vml/vmlshape.hxx
@@ -267,8 +267,8 @@ public:
 const css::uno::Reference< css::drawing::XShapes 
>& rxShapes,
 const ShapeParentAnchor* pParentAnchor = nullptr ) 
const;
 
-/** Converts position and formatting into the passed existing XShape. */
-voidconvertFormatting(
+/** Converts formatting into the passed existing XShape and returns 
position. */
+css::awt::Rectangle convertFormatting(
 const css::uno::Reference< css::drawing::XShape >& 
rxShape ) const;
 
 void setContainer(ShapeContainer* pContainer);
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 607ddf5354b4..328abeba7875 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -484,10 +484,10 @@ Reference< XShape > ShapeBase::convertAndInsert( const 
Reference< XShapes >& rxS
 return xShape;
 }
 
-void ShapeBase::convertFormatting( const Reference< XShape >& rxShape ) const
+awt::Rectangle ShapeBase::convertFormatting( const Reference< XShape >& 
rxShape ) const
 {
 if( !rxShape.is() )
-return;
+return awt::Rectangle();
 
 /*  Calculate shape rectangle. Applications may do something special
 according to some imported shape client data (e.g. Excel cell anchor). 
*/
@@ -495,11 +495,9 @@ void ShapeBase::convertFormatting( const Reference< XShape 
>& rxShape ) const
 
 // convert the shape, if the calculated rectangle is not empty
 if( (aShapeRect.Width > 0) || (aShapeRect.Height > 0) )
-{
-rxShape->setPosition( awt::Point( aShapeRect.X, aShapeRect.Y ) );
-rxShape->setSize( awt::Size( aShapeRect.Width, aShapeRect.Height ) );
 convertShapeProperties( rxShape );
-}
+
+return aShapeRect;
 }
 
 void ShapeBase::setContainer(ShapeContainer* pContainer) { mpContainer = 
pContainer; }
diff --git a/sc/source/filter/oox/commentsbuffer.cxx 
b/sc/source/filter/oox/commentsbuffer.cxx
index 05deae3ee876..555ddad3a924 100644
--- a/sc/source/filter/oox/commentsbuffer.cxx
+++ b/sc/source/filter/oox/commentsbuffer.cxx
@@ -183,7 +183,12 @@ void Comment::finalizeImport()
 if( const ::oox::vml::ShapeBase* pVmlNoteShape = 
getVmlDrawing().getNoteShape( maModel.maRange.aStart ) )
 {
 // position and formatting
-pVmlNoteShape->convertFormatting( xAnnoShape );
+css::awt::Rectangle aShapeRect = 
pVmlNoteShape->convertFormatting(xAnnoShape);
+if (aShapeRect.Width > 0 || aShapeRect.Height > 0)
+{
+xAnnoShape->setPosition(css::awt::Point(aShapeRect.X, 
aShapeRect.Y));
+xAnnoShape->setSize(css::awt::Size(aShapeRect.Width, 
aShapeRect.Height));
+}
 // visibility
 bVisible = pVmlNoteShape->getTypeModel().mbVisible;
 


[Libreoffice-commits] core.git: include/oox oox/source sd/qa sw/qa sw/source

2023-07-06 Thread Michael Stahl (via logerrit)
 include/oox/drawingml/shape.hxx|2 
 oox/source/core/xmlfilterbase.cxx  |1 
 oox/source/drawingml/connectorshapecontext.cxx |8 ++
 oox/source/drawingml/shape.cxx |4 +
 oox/source/drawingml/shapecontext.cxx  |8 ++
 oox/source/drawingml/shapegroupcontext.cxx |8 ++
 oox/source/export/shapes.cxx   |   73 +
 oox/source/ppt/pptshapegroupcontext.cxx|8 ++
 sd/qa/unit/data/pptx/tdf141058-1.pptx  |binary
 sd/qa/unit/export-tests.cxx|   86 +
 sw/qa/extras/globalfilter/globalfilter.cxx |   17 
 sw/source/filter/ww8/docxattributeoutput.cxx   |   15 
 sw/source/filter/ww8/docxsdrexport.cxx |   23 ++
 sw/source/filter/ww8/docxsdrexport.hxx |5 +
 14 files changed, 229 insertions(+), 29 deletions(-)

New commits:
commit e751d59264c369cfc342dab5f0759be12341d306
Author: Michael Stahl 
AuthorDate: Thu Jul 6 16:57:08 2023 +0200
Commit: Michael Stahl 
CommitDate: Thu Jul 6 20:28:40 2023 +0200

tdf#141058 oox,sw: OOXML import/export of decorative on shapes

Also add a test for PPTX (using the oox filters), and add a SdrObject to
the testTdf143311 for DOCX (using the writerfilter/docxsdrexport).

Change-Id: Iccee46c0d30316c33c0947b117e2604c96fa0182
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154137
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index 72ce51ef6476..ccf477bef805 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -174,6 +174,7 @@ public:
 voidsetId( const OUString& rId ) { msId = rId; 
}
 const OUString& getId() const { return msId; }
 voidsetDescription( const OUString& rDescr ) { 
msDescription = rDescr; }
+voidsetDecorative(bool const isDecorative) { 
m_isDecorative = isDecorative; }
 voidsetHidden( bool bHidden ) { mbHidden = 
bHidden; }
 voidsetHiddenMasterShape( bool 
bHiddenMasterShape ) { mbHiddenMasterShape = bHiddenMasterShape; }
 voidsetLocked( bool bLocked ) { mbLocked = 
bLocked; }
@@ -356,6 +357,7 @@ protected:
 OUStringmsInternalName; // used by diagram; not 
displayed in UI
 OUStringmsId;
 OUStringmsDescription;
+boolm_isDecorative = false;
 sal_Int32   mnSubType;  // if this type is not zero, 
then the shape is a placeholder
 std::optional< sal_Int32 >  moSubTypeIndex;
 
diff --git a/oox/source/core/xmlfilterbase.cxx 
b/oox/source/core/xmlfilterbase.cxx
index c2911a756047..0c95980accd4 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -148,6 +148,7 @@ const Sequence< beans::Pair< OUString, sal_Int32 > >& 
NamespaceIds()
  NMSP_c15},
 
{"http://schemas.microsoft.com/office/spreadsheetml/2015/revision2;,
  NMSP_xr2},
+{"http://schemas.microsoft.com/office/drawing/2017/decorative;, 
NMSP_adec},
 };
 return SINGLETON;
 };
diff --git a/oox/source/drawingml/connectorshapecontext.cxx 
b/oox/source/drawingml/connectorshapecontext.cxx
index 8ea0bcca6965..018ca95c648d 100644
--- a/oox/source/drawingml/connectorshapecontext.cxx
+++ b/oox/source/drawingml/connectorshapecontext.cxx
@@ -69,6 +69,14 @@ ConnectorShapePropertiesContext::onCreateContext(sal_Int32 
aElementToken,
 {
 switch (getBaseToken(aElementToken))
 {
+case XML_extLst:
+case XML_ext:
+break;
+case XML_decorative:
+{
+mpConnectorShapePtr->setDecorative(rAttribs.getBool(XML_val, 
false));
+break;
+}
 case XML_cNvPr:
 mpConnectorShapePtr->setId(rAttribs.getStringDefaulted(XML_id));
 
mpConnectorShapePtr->setName(rAttribs.getStringDefaulted(XML_name));
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 040a632563cc..0fca9c0e1ac3 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1144,6 +1144,10 @@ Reference< XShape > const & Shape::createAndInsert(
 {
 xSet->setPropertyValue( "Description", Any( msDescription ) );
 }
+if (m_isDecorative)
+{
+xSet->setPropertyValue("Decorative", Any(m_isDecorative));
+}
 if (aServiceName != "com.sun.star.text.TextFrame")
 rxShapes->add( mxShape );
 
diff --git a/oox/source/drawingml/shapecontext.cxx 
b/oox/source/drawingml/shapecontext.cxx
index d14864ede331..73fdab79508e 100644
--- a/oox/source/drawingml/shapecontext.cxx
+++ 

[Libreoffice-commits] core.git: include/oox oox/source

2023-06-09 Thread Tomaž Vajngerl (via logerrit)
 include/oox/drawingml/color.hxx  |3 ++
 oox/source/drawingml/color.cxx   |   24 +++
 oox/source/drawingml/fillproperties.cxx  |   16 +--
 oox/source/drawingml/textcharacterproperties.cxx |   15 --
 4 files changed, 30 insertions(+), 28 deletions(-)

New commits:
commit c1470e15bd0643be8d91aaf6a0d25c78867d0b3e
Author: Tomaž Vajngerl 
AuthorDate: Fri Jun 9 23:34:24 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Fri Jun 9 17:59:48 2023 +0200

oox: remove code duplication and add getComplexColor to oox::Color

Change-Id: I9cfbc851d4f303a5a8c92183f01cb5b6545b7984
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152800
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/oox/drawingml/color.hxx b/include/oox/drawingml/color.hxx
index 75812c200c28..245e655d7c78 100644
--- a/include/oox/drawingml/color.hxx
+++ b/include/oox/drawingml/color.hxx
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace oox { class GraphicHelper; }
 
@@ -117,6 +118,8 @@ public:
 /// Compares this color with rOther.
 bool equals(const Color& rOther, const GraphicHelper& rGraphicHelper, 
::Color nPhClr) const;
 
+model::ComplexColor getComplexColor() const;
+
 private:
 /** Internal helper for getColor(). */
 voidsetResolvedRgb( ::Color nRgb ) const;
diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx
index 805ca6c4faed..ad0b5ca7835e 100644
--- a/oox/source/drawingml/color.cxx
+++ b/oox/source/drawingml/color.cxx
@@ -571,6 +571,30 @@ sal_Int16 Color::getLumOff() const
 return 0;
 }
 
+model::ComplexColor Color::getComplexColor() const
+{
+model::ComplexColor aComplexColor;
+
aComplexColor.setSchemeColor(model::convertToThemeColorType(getSchemeColorIndex()));
+
+if (getTintOrShade() > 0)
+{
+aComplexColor.addTransformation({model::TransformationType::Tint, 
getTintOrShade()});
+}
+else if (getTintOrShade() < 0)
+{
+sal_Int16 nShade = o3tl::narrowing(-getTintOrShade());
+aComplexColor.addTransformation({model::TransformationType::Shade, 
nShade});
+}
+
+if (getLumMod() != 1)
+aComplexColor.addTransformation({model::TransformationType::LumMod, 
getLumMod()});
+
+if (getLumOff() != 0)
+aComplexColor.addTransformation({model::TransformationType::LumOff, 
getLumOff()});
+
+return aComplexColor;
+}
+
 ::Color Color::getColor( const GraphicHelper& rGraphicHelper, ::Color nPhClr ) 
const
 {
 const sal_Int32 nTempC1 = mnC1;
diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index 705f2dc3b55a..7e2f5185b7f6 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -431,24 +431,12 @@ void FillProperties::pushToPropMap(ShapePropertyMap& 
rPropMap, const GraphicHelp
 if (aFillColor == nPhClr)
 {
 
aComplexColor.setSchemeColor(model::convertToThemeColorType(nPhClrTheme));
-rPropMap.setProperty(PROP_FillComplexColor, 
model::color::createXComplexColor(aComplexColor));
 }
 else
 {
-
aComplexColor.setSchemeColor(model::convertToThemeColorType(maFillColor.getSchemeColorIndex()));
-if (maFillColor.getLumMod() != 1)
-
aComplexColor.addTransformation({model::TransformationType::LumMod, 
maFillColor.getLumMod()});
-if (maFillColor.getLumOff() != 0)
-
aComplexColor.addTransformation({model::TransformationType::LumOff, 
maFillColor.getLumOff()});
-if (maFillColor.getTintOrShade() > 0)
-
aComplexColor.addTransformation({model::TransformationType::Tint, 
maFillColor.getTintOrShade()});
-if (maFillColor.getTintOrShade() < 0)
-{
-sal_Int16 nShade = 
o3tl::narrowing(-maFillColor.getTintOrShade());
-
aComplexColor.addTransformation({model::TransformationType::Shade, nShade});
-}
-rPropMap.setProperty(PROP_FillComplexColor, 
model::color::createXComplexColor(aComplexColor));
+aComplexColor = maFillColor.getComplexColor();
 }
+rPropMap.setProperty(PROP_FillComplexColor, 
model::color::createXComplexColor(aComplexColor));
 
 eFillStyle = FillStyle_SOLID;
 }
diff --git a/oox/source/drawingml/textcharacterproperties.cxx 
b/oox/source/drawingml/textcharacterproperties.cxx
index 7d3dda284680..0e1e2830a67f 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -136,20 +136,7 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& 

[Libreoffice-commits] core.git: include/oox oox/source

2023-04-24 Thread Tomaž Vajngerl (via logerrit)
 include/oox/export/drawingml.hxx |   40 +++
 oox/source/export/drawingml.cxx  |   34 -
 2 files changed, 53 insertions(+), 21 deletions(-)

New commits:
commit 33c2443134cfd2110258d5424645ace9e1db127f
Author: Tomaž Vajngerl 
AuthorDate: Tue Apr 11 07:52:38 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Tue Apr 25 06:58:07 2023 +0200

oox: extract image / graphic export into GraphicExport class

Change-Id: Ib37aee6c5f664e80d45530dae0de9c172e0773a9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150259
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 8fb8d6ba2e52..82deea172ef7 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -139,6 +139,30 @@ protected:
 virtual ~DMLTextExport() {}
 };
 
+constexpr const char* getComponentDir(DocumentType eDocumentType)
+{
+switch (eDocumentType)
+{
+case DOCUMENT_DOCX: return "word";
+case DOCUMENT_PPTX: return "ppt";
+case DOCUMENT_XLSX: return "xl";
+}
+
+return "";
+}
+
+constexpr const char* getRelationCompPrefix(DocumentType eDocumentType)
+{
+switch (eDocumentType)
+{
+case DOCUMENT_DOCX: return "";
+case DOCUMENT_PPTX:
+case DOCUMENT_XLSX: return "../";
+}
+
+return "";
+}
+
 class OOX_DLLPUBLIC GraphicExportCache
 {
 private:
@@ -226,6 +250,22 @@ public:
 }
 };
 
+class GraphicExport
+{
+sax_fastparser::FSHelperPtr mpFS;
+oox::core::XmlFilterBase* mpFilterBase;
+DocumentType meDocumentType;
+
+public:
+GraphicExport(sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* 
pFilterBase, DocumentType eDocumentType)
+: mpFS(pFS)
+, mpFilterBase(pFilterBase)
+, meDocumentType(eDocumentType)
+{}
+
+OUString write(const Graphic& rGraphic, bool bRelPathToMedia);
+};
+
 class OOX_DLLPUBLIC DrawingML
 {
 
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 773aa6c4ae0c..97c5210d95f6 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1467,29 +1467,15 @@ void DrawingML::WriteOutline( const 
Reference& rXPropSet, Referenc
 
 const char* DrawingML::GetComponentDir() const
 {
-switch ( meDocumentType )
-{
-case DOCUMENT_DOCX: return "word";
-case DOCUMENT_PPTX: return "ppt";
-case DOCUMENT_XLSX: return "xl";
-}
-
-return "unknown";
+return getComponentDir(meDocumentType);
 }
 
 const char* DrawingML::GetRelationCompPrefix() const
 {
-switch ( meDocumentType )
-{
-case DOCUMENT_DOCX: return "";
-case DOCUMENT_PPTX:
-case DOCUMENT_XLSX: return "../";
-}
-
-return "unknown";
+return getRelationCompPrefix(meDocumentType);
 }
 
-OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia 
)
+OUString GraphicExport::write(const Graphic& rGraphic , bool bRelPathToMedia)
 {
 GfxLink aLink = rGraphic.GetGfxLink ();
 BitmapChecksum aChecksum = rGraphic.GetChecksum();
@@ -1586,9 +1572,9 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic , 
bool bRelPathToMedia )
 }
 
 sal_Int32 nImageCount = rGraphicExportCache.nextImageCount();
-Reference xOutStream = mpFB->openFragmentStream(
+Reference xOutStream = mpFilterBase->openFragmentStream(
 OUStringBuffer()
-.appendAscii(GetComponentDir())
+.appendAscii(getComponentDir(meDocumentType))
 .append("/media/image" + OUString::number(nImageCount))
 .appendAscii(pExtension)
 .makeStringAndClear(),
@@ -1601,7 +1587,7 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic , 
bool bRelPathToMedia )
 if (bRelPathToMedia)
 sRelationCompPrefix = "../";
 else
-sRelationCompPrefix = GetRelationCompPrefix();
+sRelationCompPrefix = getRelationCompPrefix(meDocumentType);
 sPath = OUStringBuffer()
 .appendAscii(sRelationCompPrefix.getStr())
 .appendAscii(sRelPathToMedia.getStr())
@@ -1612,13 +1598,19 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic 
, bool bRelPathToMedia )
 rGraphicExportCache.addExportGraphics(aChecksum, sPath);
 }
 
-sRelId = mpFB->addRelation( mpFS->getOutputStream(),
+sRelId = mpFilterBase->addRelation( mpFS->getOutputStream(),
 oox::getRelationship(Relationship::IMAGE),
 sPath );
 
 return sRelId;
 }
 
+OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia 
)
+{
+GraphicExport exporter(mpFS, mpFB, meDocumentType);
+return exporter.write(rGraphic, bRelPathToMedia);
+}
+
 void DrawingML::WriteMediaNonVisualProperties(const 

[Libreoffice-commits] core.git: include/oox oox/source

2023-04-17 Thread Sarper Akdemir (via logerrit)
 include/oox/drawingml/drawingmltypes.hxx |3 +++
 oox/source/drawingml/drawingmltypes.cxx  |   14 ++
 oox/source/export/shapes.cxx |6 ++
 3 files changed, 23 insertions(+)

New commits:
commit 77655fc3dca05d4bb2366e67ccea228e3886bfe2
Author: Sarper Akdemir 
AuthorDate: Fri Mar 24 17:35:51 2023 +0300
Commit: Sarper Akdemir 
CommitDate: Mon Apr 17 16:20:18 2023 +0200

pptx export: consider RotateAngle for tcPr on export

It appears the RotateAngle property is imported, even though
it has no effect on how table cell is displayed right now.

Let's export the property so that we are able to roundtrip
the  & 

Change-Id: Idc23f3b0677fdc5ed12fa5494f0f1823bb89683f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149545
Tested-by: Jenkins
Reviewed-by: Sarper Akdemir 

diff --git a/include/oox/drawingml/drawingmltypes.hxx 
b/include/oox/drawingml/drawingmltypes.hxx
index 239d3283e55c..fda24edb0f92 100644
--- a/include/oox/drawingml/drawingmltypes.hxx
+++ b/include/oox/drawingml/drawingmltypes.hxx
@@ -21,6 +21,7 @@
 #define INCLUDED_OOX_DRAWINGML_DRAWINGMLTYPES_HXX
 
 #include 
+#include 
 #include 
 
 #include 
@@ -149,6 +150,8 @@ OOX_DLLPUBLIC const char* GetTextVerticalAdjust( 
css::drawing::TextVerticalAdjus
 // Converts a Hatch object to an ooxml pattern.
 const char* GetHatchPattern( const css::drawing::Hatch& rHatch );
 
+/// Converts nRotate angle to TextVerticalType string appearing in ooxml
+std::optional GetTextVerticalType(sal_Int32 nRotateAngle);
 
 // CT_IndexRange
 struct IndexRange {
diff --git a/oox/source/drawingml/drawingmltypes.cxx 
b/oox/source/drawingml/drawingmltypes.cxx
index 469029f48071..ff8c46050c15 100644
--- a/oox/source/drawingml/drawingmltypes.cxx
+++ b/oox/source/drawingml/drawingmltypes.cxx
@@ -25,6 +25,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -376,6 +377,19 @@ const char* GetHatchPattern( const drawing::Hatch& rHatch )
 return sPattern;
 }
 
+std::optional GetTextVerticalType(sal_Int32 nRotateAngle)
+{
+switch (nRotateAngle)
+{
+  case 9000:
+  return "vert";
+  case 27000:
+  return "vert270";
+  default:
+  return {};
+}
+}
+
 namespace
 {
 // ISO/IEC-29500 Part 1 ST_Percentage, and [MS-OI29500] 2.1.1324
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 83d308ca793f..eecd1b38512c 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -2312,7 +2312,13 @@ void ShapeExport::WriteTableCellProperties(const 
Reference< XPropertySet>& xCell
 aVerticalAlignment >>= eVerticalAlignment;
 sVerticalAlignment = GetTextVerticalAdjust(eVerticalAlignment);
 
+sal_Int32 nRotateAngle = 0;
+Any aRotateAngle = xCellPropSet->getPropertyValue("RotateAngle");
+aRotateAngle >>= nRotateAngle;
+std::optional aTextVerticalValue = 
GetTextVerticalType(nRotateAngle);
+
 mpFS->startElementNS(XML_a, XML_tcPr, XML_anchor, sVerticalAlignment,
+XML_vert, aTextVerticalValue,
 XML_marL, 
sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nLeftMargin)),
 nLeftMargin > 0),
 XML_marR, 
sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nRightMargin)),
 nRightMargin > 0));
 


[Libreoffice-commits] core.git: include/oox oox/source

2023-04-17 Thread Armin Le Grand (allotropia) (via logerrit)
 include/oox/export/drawingml.hxx |1 
 oox/source/export/drawingml.cxx  |  115 +++
 2 files changed, 93 insertions(+), 23 deletions(-)

New commits:
commit dbbe5d0cd721a815df5e4cbf3215f291a423f2b1
Author: Armin Le Grand (allotropia) 
AuthorDate: Fri Apr 14 16:29:18 2023 +0200
Commit: Armin Le Grand 
CommitDate: Mon Apr 17 16:10:48 2023 +0200

MCGR: 1st corrections to gradient export, transparency

Changed Alpha export from using Red component of
used BColor too use luminance, that will be more
safe if we evtl use same gradients for this in the
future.

Added evtl. needed inversion for gradient exports,
also emulation of our 'axial' type.

Change-Id: I245959bf1602174f978848e1a02444b4b105f896
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150416
Tested-by: Jenkins
Reviewed-by: Armin Le Grand 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index bfab16f12aff..4bd3802a7820 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -237,6 +237,7 @@ public:
 void WriteColor( const ::Color nColor, const css::uno::Sequence< 
css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT );
 void WriteColorTransformations( const css::uno::Sequence< 
css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT );
 void WriteGradientStop(sal_uInt16 nStop, ::Color nColor, sal_Int32 nAlpha 
= MAX_PERCENT);
+void WriteGradientStop2(double fOffset, const basegfx::BColor& rColor, 
const basegfx::BColor& rAlpha);
 void WriteLineArrow( const css::uno::Reference< css::beans::XPropertySet 
>& rXPropSet, bool bLineStart );
 void WriteConnectorConnections( sal_Int32 nStartGlueId, sal_Int32 
nEndGlueId, sal_Int32 nStartID, sal_Int32 nEndID );
 
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index d02890375514..58b2b1fbb2a7 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -657,6 +657,15 @@ bool DrawingML::WriteSchemeColor(OUString const& 
rPropertyName, const uno::Refer
 return true;
 }
 
+void DrawingML::WriteGradientStop2(double fOffset, const basegfx::BColor& 
rColor, const basegfx::BColor& rAlpha)
+{
+mpFS->startElementNS(XML_a, XML_gs, XML_pos, 
OString::number(static_cast(fOffset * 10)));
+WriteColor(
+::Color(rColor),
+static_cast((1.0 - rAlpha.luminance()) * 
oox::drawingml::MAX_PERCENT));
+mpFS->endElementNS( XML_a, XML_gs );
+}
+
 void DrawingML::WriteGradientStop(sal_uInt16 nStop, ::Color nColor, sal_Int32 
nAlpha)
 {
 mpFS->startElementNS(XML_a, XML_gs, XML_pos, OString::number(nStop * 
1000));
@@ -874,35 +883,98 @@ void DrawingML::WriteGradientFill2(
 // method (at import time) will be exported again
 basegfx::utils::synchronizeColorStops(aColorStops, aAlphaStops, 
aSingleColor, aSingleAlpha);
 
-if (aColorStops.size() == aAlphaStops.size())
+if (aColorStops.size() != aAlphaStops.size())
 {
-// export GradientStops (with alpha)
-mpFS->startElementNS(XML_a, XML_gsLst);
+// this is an error - synchronizeColorStops above *has* to create that
+// state, see description there (!)
+assert(false && "oox::WriteGradientFill: non-synchronized gradients 
(!)");
+return;
+}
 
-basegfx::ColorStops::const_iterator aCurrColor(aColorStops.begin());
-basegfx::ColorStops::const_iterator aCurrAlpha(aAlphaStops.begin());
+bool bRadialOrEllipticalOrRectOrSquare(false);
+bool bLinear(false);
+bool bAxial(false);
 
-while (aCurrColor != aColorStops.end() && aCurrAlpha != 
aAlphaStops.end())
+switch (aGradient.Style)
+{
+case awt::GradientStyle_LINEAR:
+{
+// remember being linear, nothing else to be done
+bLinear = true;
+break;
+}
+case awt::GradientStyle_AXIAL:
 {
-WriteGradientStop(
-static_cast(aCurrColor->getStopOffset() * 100.0),
-::Color(aCurrColor->getStopColor()),
-sal_Int32(::Color(aCurrAlpha->getStopColor(;
-aCurrColor++;
-aCurrAlpha++;
+// we need to 'double' the gradient to make it appear as what we 
call
+// 'axial', but also scale and mirror in doing so
+basegfx::ColorStops aNewColorStops;
+basegfx::ColorStops aNewAlphaStops;
+
+// add mirrored gadients, scaled to [0.0 .. 0.5]
+basegfx::ColorStops::const_reverse_iterator 
aRevCurrColor(aColorStops.rbegin());
+basegfx::ColorStops::const_reverse_iterator 
aRevCurrAlpha(aAlphaStops.rbegin());
+
+while (aRevCurrColor != aColorStops.rend() && aRevCurrAlpha != 
aAlphaStops.rend())
+{
+aNewColorStops.emplace_back((1.0 - 
aRevCurrColor->getStopOffset()) 

[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source

2023-04-11 Thread Tünde Tóth (via logerrit)
 include/oox/core/xmlfilterbase.hxx   |4 
 oox/source/export/shapes.cxx |   23 +++
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx   |   11 +++
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx|   10 --
 sw/source/filter/ww8/docxattributeoutput.cxx |6 ++
 5 files changed, 44 insertions(+), 10 deletions(-)

New commits:
commit 7460e4f4a7b15cc7984adf65bc17e3d580413224
Author: Tünde Tóth 
AuthorDate: Wed Mar 29 15:09:11 2023 +0200
Commit: László Németh 
CommitDate: Tue Apr 11 19:35:57 2023 +0200

tdf#154469 DOCX export: fix hyperlink in group shape

Hyperlink inserted to shape lost after export,
if the shape was inside a group shape.

Follow-up to commit 7f4f88b883f81fbce975f72aea0f66a54e269ead
"tdf#145147 DOCX import: fix hyperlink in group shape".

Change-Id: I48b582c04b6f779cb5393179f65a32d7a7eca5ce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149716
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/core/xmlfilterbase.hxx 
b/include/oox/core/xmlfilterbase.hxx
index 89a7994a904b..317c2a2cb789 100644
--- a/include/oox/core/xmlfilterbase.hxx
+++ b/include/oox/core/xmlfilterbase.hxx
@@ -221,6 +221,10 @@ public:
  */
 sal_Int32 GetUniqueId() { return mnMaxDocId++; }
 
+sal_Int32 GetMaxDocId() { return mnMaxDocId; }
+
+void SetMaxDocId(sal_Int32 maxDocId) { mnMaxDocId = maxDocId; }
+
 /** Write the document properties into into the current OPC package.
 
 @param xProperties  The document properties to export.
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index eab82a86336d..83d308ca793f 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -902,6 +902,29 @@ ShapeExport& ShapeExport::WriteCustomShape( const 
Reference< XShape >& xShape )
 else
 {
 pFS->startElementNS(mnXmlNamespace, XML_wsp);
+if (m_xParent.is())
+{
+pFS->startElementNS(mnXmlNamespace, XML_cNvPr, XML_id,
+OString::number(GetShapeID(xShape) == -1 ? 
GetNewShapeID(xShape)
+ : 
GetShapeID(xShape)),
+XML_name, GetShapeName(xShape));
+
+if (GetProperty(rXPropSet, "Hyperlink"))
+{
+OUString sURL;
+mAny >>= sURL;
+if (!sURL.isEmpty())
+{
+OUString sRelId = mpFB->addRelation(
+mpFS->getOutputStream(), 
oox::getRelationship(Relationship::HYPERLINK),
+mpURLTransformer->getTransformedString(sURL),
+mpURLTransformer->isExternalURL(sURL));
+
+mpFS->singleElementNS(XML_a, XML_hlinkClick, FSNS(XML_r, 
XML_id), sRelId);
+}
+}
+pFS->endElementNS(mnXmlNamespace, XML_cNvPr);
+}
 pFS->singleElementNS(mnXmlNamespace, XML_cNvSpPr);
 }
 
diff --git a/sw/qa/extras/ooxmlimport/data/grouped_link.docx 
b/sw/qa/extras/ooxmlexport/data/grouped_link.docx
similarity index 100%
rename from sw/qa/extras/ooxmlimport/data/grouped_link.docx
rename to sw/qa/extras/ooxmlexport/data/grouped_link.docx
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 04ce5b8d452c..908d8db90e3e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -878,6 +878,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf149996, 
"lorem_hyperlink.fodt")
 // because the exported file was corrupted.
 }
 
+DECLARE_OOXMLEXPORT_TEST(testGroupedShapeLink, "grouped_link.docx")
+{
+// tdf#145147 Hyperlink in grouped shape not imported
+// tdf#154469 Hyperlink in grouped shape not exported
+uno::Reference xGroupShape(getShape(1), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("https://www.libreoffice.org;),
+ getProperty(xGroupShape->getByIndex(0), 
"Hyperlink"));
+CPPUNIT_ASSERT_EQUAL(OUString("https://www.documentfoundation.org;),
+ getProperty(xGroupShape->getByIndex(1), 
"Hyperlink"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index bcd75b78ecf5..caaa4b6842de 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -1144,16 +1144,6 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf154695)
 }
 }
 
-CPPUNIT_TEST_FIXTURE(Test, testTdf145147)
-{
-createSwDoc("grouped_link.docx");
-uno::Reference xGroupShape(getShape(1), uno::UNO_QUERY);
-CPPUNIT_ASSERT_EQUAL(OUString("https://www.libreoffice.org;),
- getProperty(xGroupShape->getByIndex(0), 
"Hyperlink"));
-

[Libreoffice-commits] core.git: include/oox oox/source

2023-04-11 Thread Noel Grandin (via logerrit)
 include/oox/export/drawingml.hxx  |4 ++--
 oox/source/export/chartexport.cxx |4 ++--
 oox/source/export/drawingml.cxx   |   10 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit f1ad6834e1c08ea59e85bfa8a1e47d81e2a92533
Author: Noel Grandin 
AuthorDate: Tue Apr 11 11:39:21 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Apr 11 17:19:01 2023 +0200

avoid some OString<->OUString back and forth conversion

Change-Id: I20d2611ca88df7daca7c56e7475fb85f98fbf888
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150226
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 2a72225680fb..9179625bd6b7 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -380,8 +380,8 @@ public:
 const OUString& sFullStream,
 std::u16string_view sRelativeStream,
 const css::uno::Reference< 
css::io::XOutputStream >& xParentRelation,
-const char* sContentType,
-const char* sRelationshipType,
+const OUString& sContentType,
+const OUString& sRelationshipType,
 OUString* pRelationshipId );
 
 };
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index b60e84590ae9..e4031e6b2b0a 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -859,7 +859,7 @@ void ChartExport::WriteChartObj( const Reference< XShape >& 
xShape, sal_Int32 nI
 sRelativeStream,
 pFS->getOutputStream(),
 
"application/vnd.openxmlformats-officedocument.drawingml.chart+xml",
-OUStringToOString(oox::getRelationship(Relationship::CHART), 
RTL_TEXTENCODING_UTF8).getStr(),
+oox::getRelationship(Relationship::CHART),
  );
 
 XmlFilterBase* pFB = GetFB();
@@ -1081,7 +1081,7 @@ void ChartExport::exportAdditionalShapes( const 
Reference< css::chart::XChartDoc
 sRelativeStream,
 GetFS()->getOutputStream(),
 
"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml",
-
OUStringToOString(oox::getRelationship(Relationship::CHARTUSERSHAPES), 
RTL_TEXTENCODING_UTF8).getStr(),
+oox::getRelationship(Relationship::CHARTUSERSHAPES),
 );
 
 GetFS()->singleElementNS(XML_c, XML_userShapes, FSNS(XML_r, 
XML_id), sId);
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 3700d93f78fc..5560a41bf86a 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -5129,20 +5129,20 @@ sax_fastparser::FSHelperPtr 
DrawingML::CreateOutputStream (
 const OUString& sFullStream,
 std::u16string_view sRelativeStream,
 const Reference< XOutputStream >& xParentRelation,
-const char* sContentType,
-const char* sRelationshipType,
+const OUString& sContentType,
+const OUString& sRelationshipType,
 OUString* pRelationshipId )
 {
 OUString sRelationshipId;
 if (xParentRelation.is())
-sRelationshipId = GetFB()->addRelation( xParentRelation, 
OUString::createFromAscii( sRelationshipType), sRelativeStream );
+sRelationshipId = GetFB()->addRelation( xParentRelation, 
sRelationshipType, sRelativeStream );
 else
-sRelationshipId = GetFB()->addRelation( OUString::createFromAscii( 
sRelationshipType ), sRelativeStream );
+sRelationshipId = GetFB()->addRelation( sRelationshipType, 
sRelativeStream );
 
 if( pRelationshipId )
 *pRelationshipId = sRelationshipId;
 
-sax_fastparser::FSHelperPtr p = GetFB()->openFragmentStreamWithSerializer( 
sFullStream, OUString::createFromAscii( sContentType ) );
+sax_fastparser::FSHelperPtr p = GetFB()->openFragmentStreamWithSerializer( 
sFullStream, sContentType );
 
 return p;
 }


[Libreoffice-commits] core.git: include/oox oox/source sd/source

2023-03-08 Thread Miklos Vajna (via logerrit)
 include/oox/export/drawingml.hxx |1 +
 oox/source/export/drawingml.cxx  |2 ++
 oox/source/export/shapes.cxx |3 +--
 sd/source/filter/eppt/pptx-epptooxml.cxx |1 +
 4 files changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 269585d6b461b565fe75f77b6dbf219749edc5ab
Author: Miklos Vajna 
AuthorDate: Wed Mar 8 08:04:09 2023 +0100
Commit: Miklos Vajna 
CommitDate: Wed Mar 8 08:06:59 2023 +

oox, sd: fix ever-increasing chart IDs when exporting to PPTX

Bring the static counter under the control of
DrawingML::ResetMlCounters(), so the first chart is always chart1.xml,
even if the same process already exported a chart previously.

XLSX is a separate codepath, this fix doesn't help with that yet.

Change-Id: Idf6e576ba94e254ae9782ef86e85542efd80127f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148457
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 21914fbf57d1..5dc243e8536c 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -163,6 +163,7 @@ protected:
 /// If set, this is the parent of the currently handled shape.
 css::uno::Reference m_xParent;
 bool  mbIsBackgroundDark;
+static sal_Int32 mnChartCount;
 
 /// True when exporting presentation placeholder shape.
 bool mbPlaceholder;
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 26858cac40cf..5f2e1a7b4558 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -243,6 +243,7 @@ std::stack DrawingML::mnWdpImageCounter;
 std::stack> DrawingML::maWdpCache;
 sal_Int32 DrawingML::mnDrawingMLCount = 0;
 sal_Int32 DrawingML::mnVmlCount = 0;
+sal_Int32 DrawingML::mnChartCount = 0;
 std::stack> 
DrawingML::maExportGraphics;
 
 sal_Int16 DrawingML::GetScriptType(const OUString& rStr)
@@ -273,6 +274,7 @@ void DrawingML::ResetMlCounters()
 {
 mnDrawingMLCount = 0;
 mnVmlCount = 0;
+mnChartCount = 0;
 }
 
 void DrawingML::PushExportGraphics()
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 676d3f75c201..6993a7c9c304 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -2520,8 +2520,7 @@ ShapeExport& ShapeExport::WriteOLE2Shape( const 
Reference< XShape >& xShape )
 // TODO: With Chart extracted this cannot really happen since
 // no Chart could've been added at all
 ChartExport aChartExport( mnXmlNamespace, GetFS(), xChartDoc, GetFB(), 
GetDocumentType() );
-static sal_Int32 nChartCount = 0;
-aChartExport.WriteChartObj( xShape, GetNewShapeID( xShape ), 
++nChartCount );
+aChartExport.WriteChartObj( xShape, GetNewShapeID( xShape ), 
++mnChartCount );
 #endif
 return *this;
 }
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx 
b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 1ae7da9cc786..f857f10bec7f 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -428,6 +428,7 @@ bool PowerPointExport::importDocument() noexcept
 
 bool PowerPointExport::exportDocument()
 {
+drawingml::DrawingML::ResetMlCounters();
 DrawingML::PushExportGraphics();
 maShapeMap.clear();
 


[Libreoffice-commits] core.git: include/oox oox/source sd/qa

2023-02-28 Thread Tibor Nagy (via logerrit)
 include/oox/export/drawingml.hxx   |4 +
 oox/source/export/drawingml.cxx|   78 +
 sd/qa/unit/data/odp/tdf153105.odp  |binary
 sd/qa/unit/export-tests-ooxml3.cxx |   16 +++
 4 files changed, 98 insertions(+)

New commits:
commit 11451781d4c562f506a3aae3732e35b92387b4db
Author: Tibor Nagy 
AuthorDate: Mon Feb 20 16:13:17 2023 +0100
Commit: László Németh 
CommitDate: Tue Feb 28 11:21:12 2023 +

tdf#153105 PPTX export: fix "Custom position/size" background image

Map size and the 9 preset positions of the ODF background image
style "Custom position/size" to the OOXML a:stretch/a:fillRect
with the appropriate left/top/right/bottom arguments.

Note: it seems, applying a:stretch or a:tile was not mandatory,
but missing a:stretch resulted non-editable document in Office 365.

Note: the import of the PPTX mapping hasn't been implemented, yet.

Follow-up to commit e8335bac5690b6beccb5ca9b36281c89fb2f28f5
"tdf#153107 OOXML export: fix scale of tile of shape background".

Change-Id: Ie940ebc2610c5b75126da05678a04ed1552cacb3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147337
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 3613eb49cdd0..21914fbf57d1 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -281,6 +281,10 @@ public:
css::uno::Reference const& 
rxGraphic,
css::awt::Size const& rSize);
 
+void 
WriteXGraphicCustomPosition(css::uno::Reference 
const& rXPropSet,
+ 
css::uno::Reference const& rxGraphic,
+ css::awt::Size const& rSize);
+
 void WriteLinespacing(const css::style::LineSpacing& rLineSpacing, float 
fFirstCharHeight);
 
 OUString WriteXGraphicBlip(css::uno::Reference 
const & rXPropSet,
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 24463a2abf9d..d3fb8a3daf97 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1584,6 +1584,9 @@ void 
DrawingML::WriteXGraphicBlipMode(uno::Reference const
 case BitmapMode_STRETCH:
 WriteXGraphicStretch(rXPropSet, rxGraphic);
 break;
+case BitmapMode_NO_REPEAT:
+WriteXGraphicCustomPosition(rXPropSet, rxGraphic, rSize);
+break;
 default:
 break;
 }
@@ -1923,6 +1926,81 @@ void 
DrawingML::WriteXGraphicTile(uno::Reference const& rXP
   OUString::number(nSizeY), XML_algn, sRectanglePoint);
 }
 
+void 
DrawingML::WriteXGraphicCustomPosition(uno::Reference 
const& rXPropSet,
+uno::Reference 
const& rxGraphic,
+css::awt::Size const& rSize)
+{
+Graphic aGraphic(rxGraphic);
+Size aOriginalSize(aGraphic.GetPrefSize());
+const MapMode& rMapMode = aGraphic.GetPrefMapMode();
+// if the original size is in pixel, convert it to mm100
+if (rMapMode.GetMapUnit() == MapUnit::MapPixel)
+aOriginalSize = 
Application::GetDefaultDevice()->PixelToLogic(aOriginalSize,
+  
MapMode(MapUnit::Map100thMM));
+double nSizeX = 0;
+if (GetProperty(rXPropSet, "FillBitmapSizeX"))
+{
+mAny >>= nSizeX;
+if (nSizeX <= 0)
+{
+if (nSizeX == 0)
+nSizeX = aOriginalSize.Width();
+else
+nSizeX /= 100; // percentage
+}
+}
+
+double nSizeY = 0;
+if (GetProperty(rXPropSet, "FillBitmapSizeY"))
+{
+mAny >>= nSizeY;
+if (nSizeY <= 0)
+{
+if (nSizeY == 0)
+nSizeY = aOriginalSize.Height();
+else
+nSizeY /= 100; // percentage
+}
+}
+
+if (nSizeX < 0 && nSizeY < 0 && rSize.Width != 0 && rSize.Height != 0)
+{
+nSizeX = rSize.Width * std::abs(nSizeX);
+nSizeY = rSize.Height * std::abs(nSizeY);
+}
+
+sal_Int32 nL = 0, nT = 0, nR = 0, nB = 0;
+if (GetProperty(rXPropSet, "FillBitmapRectanglePoint"))
+{
+sal_Int32 nWidth = (1 - (nSizeX / rSize.Width)) * 10;
+sal_Int32 nHeight = (1 - (nSizeY / rSize.Height)) * 10;
+
+switch (*o3tl::doAccess(mAny))
+{
+case RectanglePoint_LEFT_TOP:  nR = nWidth;  nB = 
nHeight;  break;
+case RectanglePoint_RIGHT_TOP: nL = nWidth;  nB = 
nHeight;  break;
+case RectanglePoint_LEFT_BOTTOM:   nR = nWidth;  nT = 
nHeight;  break;
+case RectanglePoint_RIGHT_BOTTOM:  nL = nWidth;  nT = 
nHeight;  break;
+case RectanglePoint_LEFT_MIDDLE:   nR = nWidth;  

[Libreoffice-commits] core.git: include/oox oox/source starmath/source sw/source

2023-02-01 Thread Michael Stahl (via logerrit)
 include/oox/core/filterbase.hxx  |9 -
 oox/source/core/filterbase.cxx   |2 +-
 oox/source/export/shapes.cxx |2 +-
 starmath/source/ooxmlexport.cxx  |2 +-
 sw/source/filter/ww8/docxattributeoutput.cxx |   18 ++
 5 files changed, 21 insertions(+), 12 deletions(-)

New commits:
commit 2c0c95af13662f37e7f217e0bd0fc87ebde36f1b
Author: Michael Stahl 
AuthorDate: Wed Feb 1 11:12:19 2023 +0100
Commit: Michael Stahl 
CommitDate: Wed Feb 1 11:34:49 2023 +

tdf#107841 oox: rename ambiguous and confusing ECMA_DIALECT

Change-Id: I731b3808896347332f938811715597ac814ae1d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146433
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/include/oox/core/filterbase.hxx b/include/oox/core/filterbase.hxx
index 73b8e2d8e7f2..4ef7018d5fda 100644
--- a/include/oox/core/filterbase.hxx
+++ b/include/oox/core/filterbase.hxx
@@ -73,7 +73,14 @@ namespace oox::core {
 
 enum OoxmlVersion
 {
-ECMA_DIALECT,
+/** There are currently 5 editions of ECMA-376, latest is from 2021.
+  * 1st edition allegedly corresponds to Word 2007
+  * 2nd edition allegedly corresponds to ISO 29500:2008
+  * it's unclear what changed in later editions; there is:
+Annex M.  Differences Between ECMA-376:2016 and ECMA-376:2006
+but that's relative to 1st edition.
+*/
+ECMA_376_1ST_EDITION,
 ISOIEC_29500_2008
 };
 
diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx
index 5357dae3f86b..cc00953685a0 100644
--- a/oox/source/core/filterbase.cxx
+++ b/oox/source/core/filterbase.cxx
@@ -168,7 +168,7 @@ struct FilterBaseImpl
 
 FilterBaseImpl::FilterBaseImpl( const Reference< XComponentContext >& 
rxContext ) :
 meDirection( FILTERDIRECTION_UNKNOWN ),
-meVersion( ECMA_DIALECT ),
+meVersion(ECMA_376_1ST_EDITION),
 mxComponentContext( rxContext, UNO_SET_THROW ),
 mbExportVBA(false),
 mbExportTemplate(false)
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 1c828d438653..676d3f75c201 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -2701,7 +2701,7 @@ ShapeExport& ShapeExport::WriteOLE2Shape( const 
Reference< XShape >& xShape )
 // pic element
 SdrObject* pSdrOLE2(SdrObject::getSdrObjectFromXShape(xShape));
 // The spec doesn't allow  here, but PowerPoint requires it.
-bool bEcma = mpFB->getVersion() == oox::core::ECMA_DIALECT;
+bool const bEcma = mpFB->getVersion() == oox::core::ECMA_376_1ST_EDITION;
 if (bEcma)
 if (auto pOle2Obj = dynamic_cast(pSdrOLE2))
 {
diff --git a/starmath/source/ooxmlexport.cxx b/starmath/source/ooxmlexport.cxx
index d90f56cc488a..fd3a9498a681 100644
--- a/starmath/source/ooxmlexport.cxx
+++ b/starmath/source/ooxmlexport.cxx
@@ -107,7 +107,7 @@ void SmOoxmlExport::HandleText( const SmNode* pNode, int 
/*nLevel*/)
 m_pSerializer->singleElementNS(XML_m, XML_nor);
 m_pSerializer->endElementNS( XML_m, XML_rPr );
 }
-if (drawingml::DOCUMENT_DOCX == m_DocumentType && ECMA_DIALECT == version)
+if (drawingml::DOCUMENT_DOCX == m_DocumentType && ECMA_376_1ST_EDITION == 
version)
 { // HACK: MSOffice2007 does not import characters properly unless this 
font is explicitly given
 m_pSerializer->startElementNS(XML_w, XML_rPr);
 m_pSerializer->singleElementNS( XML_w, XML_rFonts, FSNS( XML_w, 
XML_ascii ), "Cambria Math",
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 3a0bfaf5baf7..05e0ea5f0479 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4307,7 +4307,7 @@ void DocxAttributeOutput::TableCellProperties( 
ww8::WW8TableNodeInfoInner::Point
 
 const SwTableBox *pTableBox = pTableTextNodeInfoInner->getTableBox( );
 
-bool bEcma = GetExport().GetFilter().getVersion( ) == 
oox::core::ECMA_DIALECT;
+bool const bEcma = GetExport().GetFilter().getVersion() == 
oox::core::ECMA_376_1ST_EDITION;
 
 // Output any table cell redlines if there are any attached to this 
specific cell
 TableCellRedline( pTableTextNodeInfoInner );
@@ -4561,7 +4561,7 @@ sal_Int32 lcl_getWordCompatibilityMode(const DocxExport& 
rDocExport)
 
 void DocxAttributeOutput::TableDefinition( 
ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
 {
-bool bEcma = GetExport().GetFilter().getVersion( ) == 
oox::core::ECMA_DIALECT;
+bool const bEcma = GetExport().GetFilter().getVersion() == 
oox::core::ECMA_376_1ST_EDITION;
 
 // Write the table properties
 m_pSerializer->startElementNS(XML_w, XML_tblPr);
@@ -4955,7 +4955,7 @@ void DocxAttributeOutput::TableDefaultCellMargins( 
ww8::WW8TableNodeInfoInner::P
 const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
 const SwFrameFormat * 

[Libreoffice-commits] core.git: include/oox oox/source sd/qa sd/source

2023-01-26 Thread Tibor Nagy (via logerrit)
 include/oox/export/drawingml.hxx |   27 -
 oox/source/export/drawingml.cxx  |   55 
 oox/source/export/shapes.cxx |6 +--
 sd/qa/unit/data/odp/tdf153107.odp|binary
 sd/qa/unit/export-tests-ooxml2.cxx   |   60 +++
 sd/source/filter/eppt/pptx-epptooxml.cxx |4 +-
 6 files changed, 112 insertions(+), 40 deletions(-)

New commits:
commit e8335bac5690b6beccb5ca9b36281c89fb2f28f5
Author: Tibor Nagy 
AuthorDate: Mon Jan 23 09:33:13 2023 +0100
Commit: László Németh 
CommitDate: Thu Jan 26 19:49:09 2023 +

tdf#153107 OOXML export: fix scale of tile of shape background

Relative scale values were exported as absolute values,
resulting broken shape background.

Change-Id: Ia38e125862e7f8ceff5d41754340723c3a9eb028
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145996
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index c131632aea8d..3613eb49cdd0 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -248,16 +248,18 @@ public:
 
 void WriteGrabBagGradientFill( const css::uno::Sequence< 
css::beans::PropertyValue >& aGradientStops, css::awt::Gradient rGradient);
 
-void WriteBlipOrNormalFill( const css::uno::Reference< 
css::beans::XPropertySet >& rXPropSet,
-const OUString& rURLPropName );
-void WriteBlipFill( const css::uno::Reference< css::beans::XPropertySet >& 
rXPropSet,
-const OUString& sURLPropName );
-void WriteBlipFill( const css::uno::Reference< css::beans::XPropertySet >& 
rXPropSet,
- const OUString& sURLPropName, sal_Int32 nXmlNamespace 
);
+void WriteBlipOrNormalFill(const 
css::uno::Reference& rXPropSet,
+   const OUString& rURLPropName, const 
css::awt::Size& rSize = {});
+void WriteBlipFill(const css::uno::Reference& 
rXPropSet,
+   const OUString& sURLPropName, const css::awt::Size& 
rSize = {});
+void WriteBlipFill(const css::uno::Reference& 
rXPropSet,
+   const css::awt::Size& rSize, const OUString& 
sURLPropName,
+   sal_Int32 nXmlNamespace);
 
 void WriteXGraphicBlipFill(css::uno::Reference 
const & rXPropSet,
css::uno::Reference 
const & rxGraphic,
-   sal_Int32 nXmlNamespace, bool bWriteMode, bool 
bRelPathToMedia = false);
+   sal_Int32 nXmlNamespace, bool bWriteMode,
+   bool bRelPathToMedia = false, css::awt::Size 
const& rSize = {});
 
 void WritePattFill( const css::uno::Reference< css::beans::XPropertySet >& 
rXPropSet );
 void WritePattFill(const css::uno::Reference& 
rXPropSet,
@@ -276,7 +278,8 @@ public:
   css::uno::Reference 
const & rxGraphic);
 
 void WriteXGraphicTile(css::uno::Reference 
const& rXPropSet,
-   css::uno::Reference const& 
rxGraphic);
+   css::uno::Reference const& 
rxGraphic,
+   css::awt::Size const& rSize);
 
 void WriteLinespacing(const css::style::LineSpacing& rLineSpacing, float 
fFirstCharHeight);
 
@@ -286,8 +289,9 @@ public:
 
 void 
WriteImageBrightnessContrastTransparence(css::uno::Reference
 const & rXPropSet);
 
-void WriteXGraphicBlipMode(css::uno::Reference 
const & rXPropSet,
-   css::uno::Reference 
const & rxGraphic);
+void WriteXGraphicBlipMode(css::uno::Reference 
const& rXPropSet,
+   css::uno::Reference 
const& rxGraphic,
+   css::awt::Size const& rSize);
 
 void WriteShapeTransformation(const css::uno::Reference< 
css::drawing::XShape >& rXShape,
   sal_Int32 nXmlNamespace, bool bFlipH = false, bool bFlipV = 
false, bool bSuppressRotation = false, bool bSuppressFlipping = false, bool 
bFlippedBeforeRotation = false);
@@ -327,7 +331,8 @@ public:
 void WriteEmptyCustomGeometry();
 void WritePolyPolygon(const css::uno::Reference& 
rXShape,
   const bool bClosed);
-void WriteFill( const css::uno::Reference< css::beans::XPropertySet >& 
xPropSet );
+void WriteFill(const css::uno::Reference& 
xPropSet,
+   const css::awt::Size& rSize = {});
 void WriteShapeStyle( const css::uno::Reference< css::beans::XPropertySet 
>& rXPropSet );
 void WriteShapeEffects( const css::uno::Reference< 
css::beans::XPropertySet >& rXPropSet );
 void WriteShapeEffect( std::u16string_view sName, const 
css::uno::Sequence< css::beans::PropertyValue >& aEffectProps );
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 751aabc859eb..8e57e9cecb36 100644
--- 

[Libreoffice-commits] core.git: include/oox oox/source sd/source sw/qa sw/source

2022-11-29 Thread Tünde Tóth (via logerrit)
 include/oox/export/drawingml.hxx|5 +--
 oox/source/export/drawingml.cxx |   31 +++-
 sd/source/filter/eppt/pptx-epptooxml.cxx|1 
 sw/qa/extras/ooxmlexport/data/artistic_effects.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport16.cxx  |   20 
 sw/source/filter/ww8/docxexport.cxx |1 
 6 files changed, 40 insertions(+), 18 deletions(-)

New commits:
commit 01246f06cfeeb6a1070e82351e2559def4f5d820
Author: Tünde Tóth 
AuthorDate: Thu Nov 24 15:30:37 2022 +0100
Commit: László Németh 
CommitDate: Tue Nov 29 17:37:28 2022 +0100

tdf#152152 DOCX export: fix lost WDP images in artistic effects

Handling of WDP image counter was incorrect if the
document contains embedded documents, overwriting
WDP images with the other ones.

See also commit 55b1d635350cb76ee3e19e90c938eedd38ac3342
"tdf#152153 DOCX export: fix lost images at embedded documents"
and commit cf2dc247ff5f726238856e9b46a4926a30430e14
"DOCX export: image deduplication and clean up"
and commit b5f6a5cfc517ecd8aa6ba96471d854b07b92ebaa
"ooxml: Do not repeat wdp files in artistic effects".

Change-Id: Ia26784519f6d514ee8c90c7a91a367feeba140b5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143235
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 543fb072921f..eb0fea23b95c 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -144,8 +144,8 @@ class OOX_DLLPUBLIC DrawingML
 
 private:
 static std::stack mnImageCounter;
-static int mnWdpImageCounter;
-static std::map maWdpCache;
+static std::stack mnWdpImageCounter;
+static std::stack> maWdpCache;
 static sal_Int32 mnDrawingMLCount;
 static sal_Int32 mnVmlCount;
 static std::stack> 
maExportGraphics;
@@ -348,7 +348,6 @@ public:
 static bool IsGroupShape( const css::uno::Reference< css::drawing::XShape 
>& rXShape );
 sal_Int32 getBulletMarginIndentation (const css::uno::Reference< 
css::beans::XPropertySet >& rXPropSet,sal_Int16 nLevel, std::u16string_view 
propName);
 
-static void ResetCounters();
 static void ResetMlCounters();
 
 static void PushExportGraphics();
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 1da6391412fc..3418a125fac5 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -237,8 +237,8 @@ void WriteGradientPath(const awt::Gradient& rGradient, 
const FSHelperPtr& pFS, c
 
 // not thread safe
 std::stack DrawingML::mnImageCounter;
-int DrawingML::mnWdpImageCounter = 1;
-std::map DrawingML::maWdpCache;
+std::stack DrawingML::mnWdpImageCounter;
+std::stack> DrawingML::maWdpCache;
 sal_Int32 DrawingML::mnDrawingMLCount = 0;
 sal_Int32 DrawingML::mnVmlCount = 0;
 std::stack> 
DrawingML::maExportGraphics;
@@ -267,12 +267,6 @@ sal_Int16 DrawingML::GetScriptType(const OUString& rStr)
 return css::i18n::ScriptType::LATIN;
 }
 
-void DrawingML::ResetCounters()
-{
-mnWdpImageCounter = 1;
-maWdpCache.clear();
-}
-
 void DrawingML::ResetMlCounters()
 {
 mnDrawingMLCount = 0;
@@ -283,12 +277,18 @@ void DrawingML::PushExportGraphics()
 {
 mnImageCounter.push(1);
 maExportGraphics.emplace();
+
+mnWdpImageCounter.push(1);
+maWdpCache.emplace();
 }
 
 void DrawingML::PopExportGraphics()
 {
 mnImageCounter.pop();
 maExportGraphics.pop();
+
+mnWdpImageCounter.pop();
+maWdpCache.pop();
 }
 
 bool DrawingML::GetProperty( const Reference< XPropertySet >& rXPropertySet, 
const OUString& aName )
@@ -5864,11 +5864,14 @@ void DrawingML::WriteArtisticEffect( const Reference< 
XPropertySet >& rXPropSet
 
 OString DrawingML::WriteWdpPicture( const OUString& rFileId, const Sequence< 
sal_Int8 >& rPictureData )
 {
-std::map::iterator aCachedItem = maWdpCache.find( 
rFileId );
-if( aCachedItem != maWdpCache.end() )
-return OUStringToOString( aCachedItem->second, RTL_TEXTENCODING_UTF8 );
+if (!maWdpCache.empty())
+{
+std::map::iterator aCachedItem = 
maWdpCache.top().find(rFileId);
+if (aCachedItem != maWdpCache.top().end())
+return OUStringToOString(aCachedItem->second, 
RTL_TEXTENCODING_UTF8);
+}
 
-OUString sFileName = "media/hdphoto" + OUString::number( 
mnWdpImageCounter++ ) + ".wdp";
+OUString sFileName = "media/hdphoto" + OUString::number( 
mnWdpImageCounter.top()++ ) + ".wdp";
 Reference< XOutputStream > xOutStream = mpFB->openFragmentStream( 
OUStringBuffer()
   
.appendAscii( GetComponentDir() )
   .append( 
"/" + sFileName )
@@ -5884,7 +5887,9 @@ OString DrawingML::WriteWdpPicture( const OUString& 
rFileId, const Sequence< sal
  

[Libreoffice-commits] core.git: include/oox oox/source sd/qa

2022-11-24 Thread Tibor Nagy (via logerrit)
 include/oox/export/drawingml.hxx |3 
 oox/source/drawingml/fillproperties.cxx  |4 -
 oox/source/export/drawingml.cxx  |  109 ++-
 sd/qa/unit/data/odp/repeatBitmapMode.odp |binary
 sd/qa/unit/export-tests-ooxml2.cxx   |   23 ++
 5 files changed, 136 insertions(+), 3 deletions(-)

New commits:
commit 3f70375cf160841b6140f5f1b2b79af3652897f8
Author: Tibor Nagy 
AuthorDate: Fri Nov 18 12:06:59 2022 +0100
Commit: László Németh 
CommitDate: Thu Nov 24 16:56:38 2022 +0100

tdf#152069 tdf#108356 PPTX export: fix missing tile properties

of background image patterns defined by a:tile.

Note: factor "3.6" comes from EMU.

Change-Id: I5da532ff9ad63fd6c236a58933a31dcd96cf5156
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142913
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index bf2ed44bca70..543fb072921f 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -275,6 +275,9 @@ public:
 void WriteXGraphicStretch(css::uno::Reference 
const & rXPropSet,
   css::uno::Reference 
const & rxGraphic);
 
+void WriteXGraphicTile(css::uno::Reference 
const& rXPropSet,
+   css::uno::Reference const& 
rxGraphic);
+
 void WriteLinespacing(const css::style::LineSpacing& rLineSpacing, float 
fFirstCharHeight);
 
 OUString WriteXGraphicBlip(css::uno::Reference 
const & rXPropSet,
diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index 7933a79f5dba..75da3836b6f5 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -832,9 +832,9 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 rPropMap.setProperty( 
ShapeProperty::FillBitmapSizeY, nFillBmpSizeY );
 
 // offset of the first bitmap tile (given as 
EMUs), convert to percent
-sal_Int16 nTileOffsetX = getDoubleIntervalValue< 
sal_Int16 >( maBlipProps.moTileOffsetX.value_or( 0 ) / 3.6 / 
aOriginalSize.Width, 0, 100 );
+sal_Int16 nTileOffsetX = getDoubleIntervalValue< 
sal_Int16 >(std::round(maBlipProps.moTileOffsetX.value_or( 0 ) / 3.6 / 
aOriginalSize.Width), 0, 100 );
 rPropMap.setProperty( 
ShapeProperty::FillBitmapOffsetX, nTileOffsetX );
-sal_Int16 nTileOffsetY = getDoubleIntervalValue< 
sal_Int16 >( maBlipProps.moTileOffsetY.value_or( 0 ) / 3.6 / 
aOriginalSize.Height, 0, 100 );
+sal_Int16 nTileOffsetY = getDoubleIntervalValue< 
sal_Int16 >(std::round(maBlipProps.moTileOffsetY.value_or( 0 ) / 3.6 / 
aOriginalSize.Height), 0, 100 );
 rPropMap.setProperty( 
ShapeProperty::FillBitmapOffsetY, nTileOffsetY );
 }
 }
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 16affd23295b..3dc68b2f3d3b 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -100,6 +100,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1615,7 +1616,7 @@ void 
DrawingML::WriteXGraphicBlipMode(uno::Reference const
 switch (eBitmapMode)
 {
 case BitmapMode_REPEAT:
-mpFS->singleElementNS(XML_a, XML_tile);
+WriteXGraphicTile(rXPropSet, rxGraphic);
 break;
 case BitmapMode_STRETCH:
 WriteXGraphicStretch(rXPropSet, rxGraphic);
@@ -1838,6 +1839,112 @@ void 
DrawingML::WriteXGraphicStretch(uno::Reference const &
 mpFS->endElementNS(XML_a, XML_stretch);
 }
 
+static OUString lclConvertRectanglePointToToken(RectanglePoint eRectanglePoint)
+{
+OUString sAlignment;
+switch (eRectanglePoint)
+{
+case RectanglePoint_LEFT_TOP:
+sAlignment = "tl";
+break;
+case RectanglePoint_MIDDLE_TOP:
+sAlignment = "t";
+break;
+case RectanglePoint_RIGHT_TOP:
+sAlignment = "tr";
+break;
+case RectanglePoint_LEFT_MIDDLE:
+sAlignment = "l";
+break;
+case RectanglePoint_MIDDLE_MIDDLE:
+sAlignment = "ctr";
+break;
+case RectanglePoint_RIGHT_MIDDLE:
+sAlignment = "r";
+break;
+case RectanglePoint_LEFT_BOTTOM:
+sAlignment = "bl";
+break;
+case RectanglePoint_MIDDLE_BOTTOM:
+sAlignment = "b";
+break;
+case RectanglePoint_RIGHT_BOTTOM:
+sAlignment = "br";
+break;
+default:
+break;
+}
+return sAlignment;
+}
+
+void DrawingML::WriteXGraphicTile(uno::Reference const& 
rXPropSet,
+  

[Libreoffice-commits] core.git: include/oox oox/source sw/qa

2022-11-23 Thread Tünde Tóth (via logerrit)
 include/oox/export/drawingml.hxx  |2 +-
 oox/source/export/drawingml.cxx   |   13 +++--
 sw/qa/extras/ooxmlexport/data/embedded_images.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport16.cxx|   20 
 4 files changed, 28 insertions(+), 7 deletions(-)

New commits:
commit 55b1d635350cb76ee3e19e90c938eedd38ac3342
Author: Tünde Tóth 
AuthorDate: Mon Nov 21 11:30:16 2022 +0100
Commit: László Németh 
CommitDate: Wed Nov 23 17:48:37 2022 +0100

tdf#152153 DOCX export: fix lost images at embedded documents

Handling of image counter was incorrect if the
document contains embedded documents, overwriting
images with the other ones.

See also commit cf2dc247ff5f726238856e9b46a4926a30430e14
"DOCX export: image deduplication and clean up" and
 commit 3f6df3835fec71ea61894f9a3bbfe5e4a06a5495
"DOCX export: fix image counters for multiple documents".

Change-Id: I3ce3e370f96fa8b9feca3bc73f06ddca933215d4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143036
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 3f74f124d767..bf2ed44bca70 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -143,7 +143,7 @@ class OOX_DLLPUBLIC DrawingML
 {
 
 private:
-static int mnImageCounter;
+static std::stack mnImageCounter;
 static int mnWdpImageCounter;
 static std::map maWdpCache;
 static sal_Int32 mnDrawingMLCount;
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index f7bf0ffdb6fe..16affd23295b 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -235,7 +235,7 @@ void WriteGradientPath(const awt::Gradient& rGradient, 
const FSHelperPtr& pFS, c
 }
 
 // not thread safe
-int DrawingML::mnImageCounter = 1;
+std::stack DrawingML::mnImageCounter;
 int DrawingML::mnWdpImageCounter = 1;
 std::map DrawingML::maWdpCache;
 sal_Int32 DrawingML::mnDrawingMLCount = 0;
@@ -268,7 +268,6 @@ sal_Int16 DrawingML::GetScriptType(const OUString& rStr)
 
 void DrawingML::ResetCounters()
 {
-mnImageCounter = 1;
 mnWdpImageCounter = 1;
 maWdpCache.clear();
 }
@@ -281,11 +280,13 @@ void DrawingML::ResetMlCounters()
 
 void DrawingML::PushExportGraphics()
 {
+mnImageCounter.push(1);
 maExportGraphics.emplace();
 }
 
 void DrawingML::PopExportGraphics()
 {
+mnImageCounter.pop();
 maExportGraphics.pop();
 }
 
@@ -1394,7 +1395,7 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic , 
bool bRelPathToMedia )
 Reference xOutStream = mpFB->openFragmentStream(
 OUStringBuffer()
 .appendAscii(GetComponentDir())
-.append("/media/image" + OUString::number(mnImageCounter))
+.append("/media/image" + 
OUString::number(mnImageCounter.top()))
 .appendAscii(pExtension)
 .makeStringAndClear(),
 sMediaType);
@@ -1410,7 +1411,7 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic , 
bool bRelPathToMedia )
 sPath = OUStringBuffer()
 .appendAscii(sRelationCompPrefix.getStr())
 .appendAscii(sRelPathToMedia.getStr())
-.append(static_cast(mnImageCounter++))
+.append(static_cast(mnImageCounter.top()++))
 .appendAscii(pExtension)
 .makeStringAndClear();
 
@@ -1489,7 +1490,7 @@ void DrawingML::WriteMediaNonVisualProperties(const 
css::uno::Reference xOutStream = 
mpFB->openFragmentStream(OUStringBuffer()

.appendAscii(GetComponentDir())

.append("/media/media" +
-
OUString::number(mnImageCounter) +
+
OUString::number(mnImageCounter.top()) +
 
aExtension)

.makeStringAndClear(),

aMimeType);
@@ -1501,7 +1502,7 @@ void DrawingML::WriteMediaNonVisualProperties(const 
css::uno::ReferenceaddRelation(mpFS->getOutputStream(), 
oox::getRelationship(eMediaType), aPath);
 aMediaRelId = mpFB->addRelation(mpFS->getOutputStream(), 
oox::getRelationship(Relationship::MEDIA), aPath);
diff --git a/sw/qa/extras/ooxmlexport/data/embedded_images.odt 
b/sw/qa/extras/ooxmlexport/data/embedded_images.odt
new file mode 100644
index ..26166fac349b
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/embedded_images.odt 
differ
diff --git 

[Libreoffice-commits] core.git: include/oox oox/source sd/qa

2022-10-27 Thread Tibor Nagy (via logerrit)
 include/oox/drawingml/shape.hxx  |4 ++
 oox/source/drawingml/shape.cxx   |7 +++
 oox/source/ppt/slidepersist.cxx  |   69 +++
 sd/qa/unit/data/pptx/connectors.pptx |binary
 sd/qa/unit/import-tests.cxx  |   18 +
 5 files changed, 98 insertions(+)

New commits:
commit eec48130271188cab63665acedbabf1ff5e850a2
Author: Tibor Nagy 
AuthorDate: Mon Oct 24 09:36:54 2022 +0200
Commit: László Németh 
CommitDate: Thu Oct 27 20:23:18 2022 +0200

tdf#148926 tdf#151678 PPTX import: position of standard connector - part1

Connectors are typically connected to connection dots,
which exist on shapes. If both or one of the two shapes
are missing, it will be drawn the default type of a
standard connector in LO. In this case, there is an
adjustment point which is used to modify positions and
shapes of the connectors. This patch fixes the position of
the connector by calculating and setting the adjustment
value.

Change-Id: Iee384d2a92a22ff95d7b17ba0b4f09698176bc84
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141723
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index e481b98c3f6e..36017132e83d 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -136,6 +136,7 @@ public:
 
 CustomShapePropertiesPtr&   getCustomShapeProperties(){ return 
mpCustomShapePropertiesPtr; }
 
+OUString&   getConnectorName() { return 
msConnectorName; }
 ConnectorShapePropertiesList&   getConnectorShapeProperties() { return 
maConnectorShapePropertiesList; }
 voidsetConnectorShape(bool bConnector) { 
mbConnector = bConnector; }
 boolisConnectorShape() const { return 
mbConnector; }
@@ -160,6 +161,8 @@ public:
 sal_Int32   getRotation() const { return mnRotation; }
 voidsetDiagramRotation( sal_Int32 nRotation ) 
{ mnDiagramRotation = nRotation; }
 voidsetFlip( bool bFlipH, bool bFlipV ) { 
mbFlipH = bFlipH; mbFlipV = bFlipV; }
+boolgetFlipH() const { return mbFlipH; }
+boolgetFlipV() const { return mbFlipV; }
 voidaddChild( const ShapePtr& rChildPtr ) { 
maChildren.push_back( rChildPtr ); }
 std::vector< ShapePtr >&getChildren() { return maChildren; }
 
@@ -344,6 +347,7 @@ protected:
 css::uno::Reference< css::drawing::XShape > mxShape;
 ConnectorShapePropertiesList maConnectorShapePropertiesList;
 
+OUStringmsConnectorName;
 OUStringmsServiceName;
 OUStringmsName;
 OUStringmsInternalName; // used by diagram; not 
displayed in UI
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 7357e36f0481..99c1c5a979a5 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1682,6 +1682,13 @@ Reference< XShape > const & Shape::createAndInsert(
 
 if (bIsConnectorShape)
 {
+OUString sConnectorShapePresetTypeName(
+reinterpret_cast(
+
mpCustomShapePropertiesPtr->getShapePresetTypeName().getConstArray()),
+
mpCustomShapePropertiesPtr->getShapePresetTypeName().getLength(),
+RTL_TEXTENCODING_UTF8);
+msConnectorName = sConnectorShapePresetTypeName;
+
 sal_Int32 nType = mpCustomShapePropertiesPtr->getShapePresetType();
 switch (nType)
 {
diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx
index 1e7461fa5f49..126fc664bd3a 100644
--- a/oox/source/ppt/slidepersist.cxx
+++ b/oox/source/ppt/slidepersist.cxx
@@ -44,6 +44,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 using namespace ::com::sun::star;
@@ -349,6 +350,70 @@ Reference 
SlidePersist::getAnimationNode(const OUString& sId) co
 return aResult;
 }
 
+static void lcl_SetEdgeLineValue(uno::Reference& rXConnector,
+ oox::drawingml::ShapePtr& rShapePtr)
+{
+sal_Int32 nEdge = 0;
+awt::Point aStartPt, aEndPt;
+uno::Reference xStartSp, xEndSp;
+uno::Reference xPropSet(rXConnector, uno::UNO_QUERY);
+xPropSet->getPropertyValue("EdgeStartPoint") >>= aStartPt;
+xPropSet->getPropertyValue("EdgeEndPoint") >>= aEndPt;
+xPropSet->getPropertyValue("StartShape") >>= xStartSp;
+xPropSet->getPropertyValue("EndShape") >>= xEndSp;
+xPropSet->setPropertyValue("EdgeNode1HorzDist", Any(sal_Int32(0)));
+xPropSet->setPropertyValue("EdgeNode1VertDist", Any(sal_Int32(0)));
+xPropSet->setPropertyValue("EdgeNode2HorzDist", Any(sal_Int32(0)));
+

[Libreoffice-commits] core.git: include/oox oox/source sd/qa

2022-10-27 Thread Sarper Akdemir (via logerrit)
 include/oox/export/drawingml.hxx  |2 -
 oox/source/export/drawingml.cxx   |   26 ++
 sd/qa/unit/data/odp/autofitted-textbox-indent.odp |binary
 sd/qa/unit/export-tests-ooxml3.cxx|   22 ++
 4 files changed, 45 insertions(+), 5 deletions(-)

New commits:
commit e6a1586ff90125245cf0f898af37bf568abdcddf
Author: Sarper Akdemir 
AuthorDate: Mon Oct 24 14:16:16 2022 +0300
Commit: Miklos Vajna 
CommitDate: Thu Oct 27 15:15:26 2022 +0200

related tdf#149961 pptx export: scale indents for autofitted textboxes

For autofitted textboxes, Impress scales the indents with
the text size while PowerPoint doesn't.

Try to compensate for this by scaling exported indents
proportionally to the font scale on autofitted textboxes.

Change-Id: Ib0f967e923d23553b4cdbd1bbe2e137d97b1b2e5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141758
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index aeda7fa3a222..3f74f124d767 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -303,7 +303,7 @@ public:
 
 @returns true if any paragraph properties were written
 */
-bool WriteParagraphProperties(const css::uno::Reference< 
css::text::XTextContent >& rParagraph, float fFirstCharHeight, sal_Int32 
nElement);
+bool WriteParagraphProperties(const css::uno::Reference< 
css::text::XTextContent >& rParagraph, const 
css::uno::Reference& rXShapePropSet, float 
fFirstCharHeight, sal_Int32 nElement);
 void WriteParagraphNumbering(const css::uno::Reference< 
css::beans::XPropertySet >& rXPropSet, float fFirstCharHeight,
   sal_Int16 nLevel );
 void WriteParagraphTabStops(const 
css::uno::Reference& rXPropSet);
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index e0766d0e7a7a..e8d5bef246c4 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -3021,7 +3021,7 @@ void DrawingML::WriteLinespacing(const LineSpacing& 
rSpacing, float fFirstCharHe
 }
 }
 
-bool DrawingML::WriteParagraphProperties( const Reference< XTextContent >& 
rParagraph, float fFirstCharHeight, sal_Int32 nElement)
+bool DrawingML::WriteParagraphProperties(const Reference& 
rParagraph, const Reference& rXShapePropSet, float 
fFirstCharHeight, sal_Int32 nElement)
 {
 Reference< XPropertySet > rXPropSet( rParagraph, UNO_QUERY );
 Reference< XPropertyState > rXPropState( rParagraph, UNO_QUERY );
@@ -3111,6 +3111,24 @@ bool DrawingML::WriteParagraphProperties( const 
Reference< XTextContent >& rPara
 return false;
 }
 
+// for autofitted textboxes, scale the indents
+if (GetProperty(rXShapePropSet, "TextFitToSize") && 
mAny.get() == TextFitToSizeType_AUTOFIT)
+{
+SvxShapeText* pTextShape = 
dynamic_cast(rXShapePropSet.get());
+if (pTextShape)
+{
+SdrTextObj* pTextObject = 
dynamic_cast(pTextShape->GetSdrObject());
+if (pTextObject)
+{
+const auto nFontScaleY = pTextObject->GetFontScaleY();
+nLeftMargin = nLeftMargin * nFontScaleY / 100;
+nLineIndentation = nLineIndentation * nFontScaleY / 100;
+nParaLeftMargin = nParaLeftMargin * nFontScaleY / 100;
+nParaFirstLineIndent = nParaFirstLineIndent * nFontScaleY / 
100;
+}
+}
+}
+
 if (nParaLeftMargin) // For Paragraph
 mpFS->startElementNS( XML_a, nElement,
XML_lvl, 
sax_fastparser::UseIf(OString::number(nLevel), nLevel > 0),
@@ -3198,7 +3216,7 @@ void DrawingML::WriteLstStyles(const 
css::uno::ReferencegetPropertyValue("CharHeight").get();
 
 mpFS->startElementNS(XML_a, XML_lstStyle);
-if( !WriteParagraphProperties(rParagraph, fFirstCharHeight, 
XML_lvl1pPr) )
+if( !WriteParagraphProperties(rParagraph, rXShapePropSet, 
fFirstCharHeight, XML_lvl1pPr) )
 mpFS->startElementNS(XML_a, XML_lvl1pPr);
 WriteRunProperties(xFirstRunPropSet, false, XML_defRPr, true, 
rbOverridingCharHeight,
rnCharHeight, GetScriptType(rRun->getString()), 
rXShapePropSet);
@@ -3240,7 +3258,7 @@ void DrawingML::WriteParagraph( const Reference< 
XTextContent >& rParagraph,
 rnCharHeight = 100 * fFirstCharHeight;
 rbOverridingCharHeight = true;
 }
-WriteParagraphProperties(rParagraph, fFirstCharHeight, 
XML_pPr);
+WriteParagraphProperties(rParagraph, rXShapePropSet, 
fFirstCharHeight, XML_pPr);
 bPropertiesWritten = true;
 }
 WriteRun( run, rbOverridingCharHeight, rnCharHeight, 
rXShapePropSet);
@@ -3848,7 +3866,7 @@ void DrawingML::WriteText(const 

[Libreoffice-commits] core.git: include/oox oox/source sc/qa sc/source solenv/clang-format

2022-10-24 Thread Regina Henschel (via logerrit)
 include/oox/shape/ShapeDrawingFragmentHandler.hxx  |2 
 oox/source/shape/ShapeContextHandler.cxx   |2 
 oox/source/shape/ShapeDrawingFragmentHandler.cxx   |2 
 sc/qa/unit/data/xlsx/tdf83671_SmartArt_import.xlsx |binary
 sc/qa/unit/subsequent_filters_test2.cxx|   47 +
 sc/source/filter/oox/drawingfragment.cxx   |   22 +
 solenv/clang-format/excludelist|2 
 7 files changed, 73 insertions(+), 4 deletions(-)

New commits:
commit 9ad7df41572d67687221cb43d53cde27a45fff0f
Author: Regina Henschel 
AuthorDate: Thu Oct 20 14:28:07 2022 +0200
Commit: Miklos Vajna 
CommitDate: Mon Oct 24 15:09:37 2022 +0200

tdf#83671 make SmartArt visible in import of xlsx

Problem is, that Excel writes a zero size in xdr:xfrm for the SmartArt.
With that the import generates a background size with zero width and
height and no shapes at all in the SmartArt group. The diagram DOM is
imported correctly. The actual size is not known until the row and column
values of the anchor are evaluated.
The idea of this patch is to correct the background size directly and to
repeat the import of drawing.xml when the actual size is known.

I noticed that in import of SmartArt in docx there is a similar problem
that the SmartArt shapes are missing at some point, as can be seen in
ShapeContextHandler::getShape(), about line 428. It uses
ShapeDrawingFragmentHandler to import the shapes. To be able to use that
handler too, I have moved its header file to include.
The solution for docx uses a loop over the vector getExtDrawings(). But I
have not seen a SmartArt case, where more then one element exists in it.

Whether the shape is a diagram, is indirectly tested currently. The
shape has yet no direct method for it.

Change-Id: I9d705ed5bfb2894e9ce740ebf8589e06b4870bed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141571
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/oox/source/shape/ShapeDrawingFragmentHandler.hxx 
b/include/oox/shape/ShapeDrawingFragmentHandler.hxx
similarity index 93%
rename from oox/source/shape/ShapeDrawingFragmentHandler.hxx
rename to include/oox/shape/ShapeDrawingFragmentHandler.hxx
index 15b424b6fd8f..340edca5e1d1 100644
--- a/oox/source/shape/ShapeDrawingFragmentHandler.hxx
+++ b/include/oox/shape/ShapeDrawingFragmentHandler.hxx
@@ -16,7 +16,7 @@
 namespace oox::shape {
 
 /// Generic (i.e. not specific to PPTX) handler for the prerendered diagram 
parsing.
-class ShapeDrawingFragmentHandler : public oox::core::FragmentHandler2
+class OOX_DLLPUBLIC ShapeDrawingFragmentHandler : public 
oox::core::FragmentHandler2
 {
 public:
 ShapeDrawingFragmentHandler(oox::core::XmlFilterBase& rFilter, const 
OUString& rFragmentPath, oox::drawingml::ShapePtr pGroupShapePtr);
diff --git a/oox/source/shape/ShapeContextHandler.cxx 
b/oox/source/shape/ShapeContextHandler.cxx
index 54a455452365..4e8329c1417d 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -22,7 +22,7 @@
 #include 
 
 #include 
-#include "ShapeDrawingFragmentHandler.hxx"
+#include 
 #include "LockedCanvasContext.hxx"
 #include "WpsContext.hxx"
 #include "WpgContext.hxx"
diff --git a/oox/source/shape/ShapeDrawingFragmentHandler.cxx 
b/oox/source/shape/ShapeDrawingFragmentHandler.cxx
index 0e915058fcb4..456f7df6c80d 100644
--- a/oox/source/shape/ShapeDrawingFragmentHandler.cxx
+++ b/oox/source/shape/ShapeDrawingFragmentHandler.cxx
@@ -7,7 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#include "ShapeDrawingFragmentHandler.hxx"
+#include 
 
 #include 
 #include 
diff --git a/sc/qa/unit/data/xlsx/tdf83671_SmartArt_import.xlsx 
b/sc/qa/unit/data/xlsx/tdf83671_SmartArt_import.xlsx
new file mode 100644
index ..9ec0a0e7906c
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf83671_SmartArt_import.xlsx 
differ
diff --git a/sc/qa/unit/subsequent_filters_test2.cxx 
b/sc/qa/unit/subsequent_filters_test2.cxx
index e4bf84b2fade..1ce547a23373 100644
--- a/sc/qa/unit/subsequent_filters_test2.cxx
+++ b/sc/qa/unit/subsequent_filters_test2.cxx
@@ -60,6 +60,7 @@
 #include 
 #include 
 #include "helper/qahelper.hxx"
+#include 
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -185,6 +186,7 @@ public:
 void testAutofilterNamedRangesXLSX();
 void testInvalidBareBiff5();
 void testTooManyColsRows();
+void testTdf83671_SmartArt_import();
 
 CPPUNIT_TEST_SUITE(ScFiltersTest2);
 
@@ -301,6 +303,7 @@ public:
 CPPUNIT_TEST(testAutofilterNamedRangesXLSX);
 CPPUNIT_TEST(testInvalidBareBiff5);
 CPPUNIT_TEST(testTooManyColsRows);
+CPPUNIT_TEST(testTdf83671_SmartArt_import);
 
 CPPUNIT_TEST_SUITE_END();
 };
@@ -3042,6 +3045,50 @@ void ScFiltersTest2::testTooManyColsRows()
 xDocSh->DoClose();
 }
 
+void 

[Libreoffice-commits] core.git: include/oox oox/source writerfilter/qa writerfilter/source

2022-10-13 Thread Regina Henschel (via logerrit)
 include/oox/shape/ShapeContextHandler.hxx   |  
  2 
 oox/source/shape/ShapeContextHandler.cxx|  
  6 +
 writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx  |  
 52 ++
 writerfilter/qa/cppunittests/dmapper/data/tdf149840_SmartArtBackground.docx 
|binary
 writerfilter/source/dmapper/GraphicHelpers.cxx  |  
 47 +
 writerfilter/source/dmapper/GraphicHelpers.hxx  |  
 14 ++
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx   |  
 38 +++
 7 files changed, 158 insertions(+), 1 deletion(-)

New commits:
commit e4515c1305e4b7bf6e7f105636e9cf6eb50b382d
Author: Regina Henschel 
AuthorDate: Tue Oct 11 14:46:37 2022 +0200
Commit: Miklos Vajna 
CommitDate: Thu Oct 13 08:56:22 2022 +0200

tdf#149840 Use actual outer size for SmartArt in Writer

SmartArt import needs the outer size of the diagram for to define a
background shape in the correct size and calculate the size of the
diagram shapes relative to the outer size. The patch passes the values
read from wp:extent in writerfilter to DiagramGraphicDataContext in oox.

Change-Id: Ib39227bc645ac353336bab2c558d041974188f6f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141223
Tested-by: Jenkins
Reviewed-by: Regina Henschel 
Reviewed-by: Miklos Vajna 

diff --git a/include/oox/shape/ShapeContextHandler.hxx 
b/include/oox/shape/ShapeContextHandler.hxx
index 1b024c6013e1..239ff8ec63b8 100644
--- a/include/oox/shape/ShapeContextHandler.hxx
+++ b/include/oox/shape/ShapeContextHandler.hxx
@@ -95,6 +95,7 @@ public:
 void pushStartToken( sal_Int32 _starttoken );
 
 void setPosition(const css::awt::Point& rPosition);
+void setSize(const css::awt::Size& rSize);
 
 const bool& getFullWPGSupport() { return m_bFullWPGSUpport; }
 void setFullWPGSupport(bool bUse) { m_bFullWPGSUpport = bUse; }
@@ -118,6 +119,7 @@ private:
 std::stack mnStartTokenStack;
 
 css::awt::Point maPosition;
+css::awt::Size maSize;  // from cx and cy, in EMU
 bool m_bFullWPGSUpport; // Is this DrawingML shape supposed to be 
processed as WPG?
 
 drawingml::ShapePtr mpShape;
diff --git a/oox/source/shape/ShapeContextHandler.cxx 
b/oox/source/shape/ShapeContextHandler.cxx
index 2e4018e4703c..54a455452365 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -215,6 +215,7 @@ ShapeContextHandler::getDiagramShapeContext()
 {
 auto pFragmentHandler = 
std::make_shared(*mxShapeFilterBase, 
msRelationFragmentPath);
 mpShape = std::make_shared();
+mpShape->setSize(maSize);
 mxDiagramShapeContext.set(new 
DiagramGraphicDataContext(*pFragmentHandler, mpShape));
 }
 
@@ -564,6 +565,11 @@ void ShapeContextHandler::setPosition(const awt::Point& 
rPosition)
 maPosition = rPosition;
 }
 
+void ShapeContextHandler::setSize(const awt::Size& rSize)
+{
+maSize = rSize;
+}
+
 void ShapeContextHandler::setDocumentProperties(const 
uno::Reference& xDocProps)
 {
 mxDocumentProperties = xDocProps;
diff --git a/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx 
b/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx
index a20c8490501b..6d77ece16d9d 100644
--- a/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx
+++ b/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx
@@ -23,6 +23,7 @@
 #include 
 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 
@@ -406,6 +407,57 @@ CPPUNIT_TEST_FIXTURE(Test, testLayoutInCellOfHraphics)
 CPPUNIT_ASSERT(xShape->getPropertyValue("IsFollowingTextFlow") >>= 
bFollowingTextFlow);
 CPPUNIT_ASSERT(bFollowingTextFlow);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testTdf149840SmartArtBackground)
+{
+// Make sure SmartArt is loaded as group shape
+bool bUseGroup = 
officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes::get();
+if (!bUseGroup)
+{
+std::shared_ptr pChange(
+comphelper::ConfigurationChanges::create());
+
officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes::set(true,
 pChange);
+pChange->commit();
+}
+
+OUString aURL
+= m_directories.getURLFromSrc(DATA_DIRECTORY) + 
"tdf149840_SmartArtBackground.docx";
+getComponent() = loadFromDesktop(aURL);
+uno::Reference 
xDrawPageSupplier(getComponent(), uno::UNO_QUERY);
+uno::Reference xDrawPage = 
xDrawPageSupplier->getDrawPage();
+uno::Reference xGroup(xDrawPage->getByIndex(0), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(static_cast(3), xGroup->getCount());
+
+// The first shape in the group, which represents the SmartArt, 
corresponds to the background of
+// the diagram. Without fix in place it has widht and height zero, which 
does not only result in
+// not visible background but in wrong sizes of the diagram 

[Libreoffice-commits] core.git: include/oox oox/source sd/qa

2022-09-09 Thread Tibor Nagy (via logerrit)
 include/oox/core/xmlfilterbase.hxx  |   10 -
 include/oox/drawingml/shape.hxx |6 -
 include/oox/ppt/presentationfragmenthandler.hxx |1 
 include/oox/ppt/slidepersist.hxx|4 
 oox/source/core/xmlfilterbase.cxx   |6 -
 oox/source/drawingml/hyperlinkcontext.cxx   |4 
 oox/source/drawingml/textrun.cxx|6 -
 oox/source/ppt/pptshape.cxx |   49 
 oox/source/ppt/presentationfragmenthandler.cxx  |  138 ++--
 oox/source/ppt/slidepersist.cxx |2 
 sd/qa/unit/data/pptx/tdf150719.pptx |binary
 sd/qa/unit/import-tests.cxx |   18 +++
 12 files changed, 63 insertions(+), 181 deletions(-)

New commits:
commit fabfa4bd23e89a2d5b6e232cd2eab61996534659
Author: Tibor Nagy 
AuthorDate: Mon Aug 22 10:54:53 2022 +0200
Commit: Nagy Tibor 
CommitDate: Fri Sep 9 14:05:26 2022 +0200

tdf#150719 PPTX import: fix hyperlink format (lost underline)

Hypertext lost its formatting partially: e.g. underline
character setting lost, except on the last word.

Follow-up to commit commit a761a51d9db3a2771ca9fd6ab233c513aa5d8ecf
"tdf#149311 PPTX export: fix internal hyperlink on texts".

Clean-up of commit 855a56fea4561135a63cb729d7a625a950b210e7
"tdf#148965 PPTX import: fix internal hyperlinks on shapes" and
commit cec1f712c87e557e1b7313e0dbef4a635f69d953
"tdf#144918 PPTX import: fix internal hyperlink on shapes" and
commit 7eb0e52527e729a21973e70d5be8e0a6779ec748
"tdf#142648 PPTX: import long slide names to avoid broken link export".

Change-Id: I1de8b06361c7b9529a70a039e194db88460cc27b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138669
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/core/xmlfilterbase.hxx 
b/include/oox/core/xmlfilterbase.hxx
index 35312fda53ab..89a7994a904b 100644
--- a/include/oox/core/xmlfilterbase.hxx
+++ b/include/oox/core/xmlfilterbase.hxx
@@ -75,13 +75,6 @@ namespace oox::core {
 class FragmentHandler;
 class FastParser;
 
-struct TextField {
-css::uno::Reference< css::text::XText >   xText;
-css::uno::Reference< css::text::XTextCursor > xTextCursor;
-css::uno::Reference< css::text::XTextField >  xTextField;
-};
-typedef std::vector< TextField > TextFieldStack;
-
 struct XmlFilterBaseImpl;
 
 using ShapePairs
@@ -183,9 +176,6 @@ public:
  */
 OUString addRelation( const css::uno::Reference< 
css::io::XOutputStream >& rOutputStream, const OUString& rType, 
std::u16string_view rTarget, bool bExternal = false );
 
-/** Returns a stack of used textfields, used by the pptx importer to 
replace links to slidepages with the real page name */
-TextFieldStack& getTextFieldStack() const;
-
 /** Opens and returns the specified output stream from the base storage 
with specified media type.
 
 @param rStreamName
diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index 246a964fc2a6..e481b98c3f6e 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -140,9 +140,6 @@ public:
 voidsetConnectorShape(bool bConnector) { 
mbConnector = bConnector; }
 boolisConnectorShape() const { return 
mbConnector; }
 
-voidsetBookmark(bool bBookmark) { 
mbHasBookmark = bBookmark; }
-boolhasBookmark() const { return 
mbHasBookmark; }
-
 Shape3DProperties&  get3DProperties() { return 
*mp3DPropertiesPtr; }
 const Shape3DProperties&get3DProperties() const { return 
*mp3DPropertiesPtr; }
 
@@ -408,9 +405,6 @@ private:
 // Is this a connector shape?
 bool mbConnector = false;
 
-// Is shape has bookmark?
-bool mbHasBookmark = false;
-
 // temporary space for DiagramHelper in preparation for collecting data
 // Note: I tried to use a unique_ptr here, but existing constructor func 
does not allow that
 svx::diagram::IDiagramHelper* mpDiagramHelper;
diff --git a/include/oox/ppt/presentationfragmenthandler.hxx 
b/include/oox/ppt/presentationfragmenthandler.hxx
index a9bb5bb67a77..7ac929ec555b 100644
--- a/include/oox/ppt/presentationfragmenthandler.hxx
+++ b/include/oox/ppt/presentationfragmenthandler.hxx
@@ -52,6 +52,7 @@ private:
 void importSlide(sal_uInt32 nSlide, bool bFirstSlide, bool bImportNotes);
 void saveThemeToGrabBag(const oox::drawingml::ThemePtr& pThemePtr, 
sal_Int32 nThemeIdx);
 void importCustomSlideShow(std::vector& rCustomShowList);
+static void importSlideNames(::oox::core::XmlFilterBase& rFilter, const 
std::vector& rSlidePersist);
 
 std::vector< OUString > maSlideMasterVector;
 std::vector< OUString > maSlidesVector;
diff --git a/include/oox/ppt/slidepersist.hxx b/include/oox/ppt/slidepersist.hxx
index 

[Libreoffice-commits] core.git: include/oox oox/source

2022-07-29 Thread Caolán McNamara (via logerrit)
 include/oox/export/drawingml.hxx |2 +-
 oox/source/export/drawingml.cxx  |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 3777a1e769913460ecc818988df8fc57829d7113
Author: Caolán McNamara 
AuthorDate: Fri Jul 29 09:48:03 2022 +0100
Commit: Caolán McNamara 
CommitDate: Fri Jul 29 18:05:08 2022 +0200

cid#1507492 Improper use of negative value

Change-Id: I7c44307917df3397cfc9c99a982c54f51693e660
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137589
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index c80024ea1fdd..2e418b18b933 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -231,7 +231,7 @@ public:
 void WriteColorTransformations( const css::uno::Sequence< 
css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT );
 void WriteGradientStop(sal_uInt16 nStop, ::Color nColor, sal_Int32 nAlpha 
= MAX_PERCENT);
 void WriteLineArrow( const css::uno::Reference< css::beans::XPropertySet 
>& rXPropSet, bool bLineStart );
-void WriteConnectorConnections( sal_uInt32 nStartGlueId, sal_Int32 
nEndGlueId, sal_Int32 nStartID, sal_Int32 nEndID );
+void WriteConnectorConnections( sal_Int32 nStartGlueId, sal_Int32 
nEndGlueId, sal_Int32 nStartID, sal_Int32 nEndID );
 
 bool WriteCharColor(const css::uno::Reference& 
xPropertySet);
 bool WriteFillColor(const css::uno::Reference& 
xPropertySet);
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index e4d0ed7ddc4e..63a5d22dd222 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -4759,7 +4759,7 @@ void DrawingML::WritePolyPolygon(const 
css::uno::Reference
 mpFS->endElementNS(XML_a, XML_custGeom);
 }
 
-void DrawingML::WriteConnectorConnections( sal_uInt32 nStartGlueId, sal_Int32 
nEndGlueId, sal_Int32 nStartID, sal_Int32 nEndID )
+void DrawingML::WriteConnectorConnections( sal_Int32 nStartGlueId, sal_Int32 
nEndGlueId, sal_Int32 nStartID, sal_Int32 nEndID )
 {
 if( nStartID != -1 )
 {


[Libreoffice-commits] core.git: include/oox oox/source sd/qa

2022-07-22 Thread Tibor Nagy (via logerrit)
 include/oox/export/drawingml.hxx|2 +-
 oox/source/export/drawingml.cxx |6 +++---
 oox/source/export/shapes.cxx|   33 -
 sd/qa/unit/data/pptx/tdf149697.pptx |binary
 sd/qa/unit/export-tests-ooxml2.cxx  |   25 +
 5 files changed, 61 insertions(+), 5 deletions(-)

New commits:
commit 4d153517183193f468dee9148c94fe9d874bacb3
Author: Tibor Nagy 
AuthorDate: Mon Jun 27 09:45:04 2022 +0200
Commit: László Németh 
CommitDate: Fri Jul 22 13:40:25 2022 +0200

tdf#149697 PPTX export: fix changing place of connection points

Place of the connection point of a polygon changed during
a PPTX round-trip, connecting other vertices of e.g. a square
or a hexagon, as before.

See also commit c3f73f75772d076dfb2ed0538e7d515503edc038
"tdf#149128 PPTX export: fix  and  connector properties".

Change-Id: I64fc6377417a99d32e84ea71fbed13cf36760118
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136474
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 455676e9c262..c80024ea1fdd 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -231,7 +231,7 @@ public:
 void WriteColorTransformations( const css::uno::Sequence< 
css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT );
 void WriteGradientStop(sal_uInt16 nStop, ::Color nColor, sal_Int32 nAlpha 
= MAX_PERCENT);
 void WriteLineArrow( const css::uno::Reference< css::beans::XPropertySet 
>& rXPropSet, bool bLineStart );
-void WriteConnectorConnections( EscherConnectorListEntry& rConnectorEntry, 
sal_Int32 nStartID, sal_Int32 nEndID );
+void WriteConnectorConnections( sal_uInt32 nStartGlueId, sal_Int32 
nEndGlueId, sal_Int32 nStartID, sal_Int32 nEndID );
 
 bool WriteCharColor(const css::uno::Reference& 
xPropertySet);
 bool WriteFillColor(const css::uno::Reference& 
xPropertySet);
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index d889f475c556..392ce6f4d6aa 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -4747,19 +4747,19 @@ void DrawingML::WritePolyPolygon(const 
css::uno::Reference
 mpFS->endElementNS(XML_a, XML_custGeom);
 }
 
-void DrawingML::WriteConnectorConnections( EscherConnectorListEntry& 
rConnectorEntry, sal_Int32 nStartID, sal_Int32 nEndID )
+void DrawingML::WriteConnectorConnections( sal_uInt32 nStartGlueId, sal_Int32 
nEndGlueId, sal_Int32 nStartID, sal_Int32 nEndID )
 {
 if( nStartID != -1 )
 {
 mpFS->singleElementNS( XML_a, XML_stCxn,
XML_id, OString::number(nStartID),
-   XML_idx, 
OString::number(rConnectorEntry.GetConnectorRule(true)) );
+   XML_idx, OString::number(nStartGlueId) );
 }
 if( nEndID != -1 )
 {
 mpFS->singleElementNS( XML_a, XML_endCxn,
XML_id, OString::number(nEndID),
-   XML_idx, 
OString::number(rConnectorEntry.GetConnectorRule(false)) );
+   XML_idx, OString::number(nEndGlueId) );
 }
 }
 
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index f0b446a7eb33..19ef8156f3e3 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -63,6 +63,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -1636,11 +1638,33 @@ static void lcl_GetConnectorAdjustValue(const 
Reference& xShape, tools::
 }
 }
 
+static sal_Int32 lcl_GetGluePointId(const Reference& xShape, 
sal_Int32& nGluePointId)
+{
+uno::Reference xSupplier(xShape, 
uno::UNO_QUERY);
+uno::Reference 
xGluePoints(xSupplier->getGluePoints(),
+ uno::UNO_QUERY);
+sal_uInt32 nCount = xGluePoints->getIdentifiers().size();
+if (nCount > 4)
+nGluePointId -= 4;
+else
+{
+// change id of the bounding box (1 <-> 3)
+if (nGluePointId == 1)
+nGluePointId = 3; // Right
+else if (nGluePointId == 3)
+nGluePointId = 1; // Left
+}
+
+return nGluePointId;
+}
+
 ShapeExport& ShapeExport::WriteConnectorShape( const Reference< XShape >& 
xShape )
 {
 bool bFlipH = false;
 bool bFlipV = false;
 sal_Int32 nAngle = 0;
+sal_Int32 nStartGlueId = 0;
+sal_Int32 nEndGlueId = 0;
 
 SAL_INFO("oox.shape", "write connector shape");
 
@@ -1680,6 +1704,13 @@ ShapeExport& ShapeExport::WriteConnectorShape( const 
Reference< XShape >& xShape
 GET( rXShapeA, EdgeStartConnection );
 GET( rXShapeB, EdgeEndConnection );
 
+GET(nStartGlueId, StartGluePointIndex);
+if (nStartGlueId != -1)
+lcl_GetGluePointId(rXShapeA, nStartGlueId);
+GET(nEndGlueId, 

[Libreoffice-commits] core.git: include/oox oox/source

2022-06-24 Thread Noel Grandin (via logerrit)
 include/oox/helper/helper.hxx  |2 +-
 oox/source/drawingml/chart/seriesconverter.cxx |2 +-
 oox/source/drawingml/shape.cxx |2 +-
 oox/source/vml/vmlformatting.cxx   |2 +-
 oox/source/vml/vmlshape.cxx|6 --
 oox/source/vml/vmltextbox.cxx  |4 ++--
 6 files changed, 10 insertions(+), 8 deletions(-)

New commits:
commit 79f3abc0e200ffa772bc7722b5f384eb538d7576
Author: Noel Grandin 
AuthorDate: Fri Jun 24 11:55:13 2022 +0200
Commit: Noel Grandin 
CommitDate: Fri Jun 24 20:37:10 2022 +0200

make oox::OptValue::value() assert if empty

as part of replacing OptValue with std::optional, we need to mimc the
behaviour of std::optional::value(), which will throw
bad_optional_access

Change-Id: Icf5141cefd4623a6a1bb7b3a3449d3af382e01c1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136365
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx
index 9d5b7c3e2549..ef066f31d338 100644
--- a/include/oox/helper/helper.hxx
+++ b/include/oox/helper/helper.hxx
@@ -180,7 +180,7 @@ public:
 bool has_value() const { return mbHasValue; }
 bool operator!() const { return !mbHasValue; }
 
-const Type&  value() const { return maValue; }
+const Type&  value() const { assert(mbHasValue); return maValue; }
 const Type&  value_or( const Type& rDefValue ) const { return mbHasValue ? 
maValue : rDefValue; }
 
 Type&operator*() { assert(mbHasValue); return maValue; }
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx 
b/oox/source/drawingml/chart/seriesconverter.cxx
index 383e5bd3fa4b..03e97d3e3339 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -197,7 +197,7 @@ void importBorderProperties( PropertySet& rPropSet, Shape& 
rShape, const Graphic
 {
 LineProperties& rLP = rShape.getLineProperties();
 // no fill has the same effect as no border so skip it
-if (rLP.maLineFill.moFillType.value() == XML_noFill)
+if (rLP.maLineFill.moFillType.has_value() && 
rLP.maLineFill.moFillType.value() == XML_noFill)
 return;
 
 if (rLP.moLineWidth.has_value())
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 236e0bea3c82..20564b584f76 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1685,7 +1685,7 @@ Reference< XShape > const & Shape::createAndInsert(
 mpCustomShapePropertiesPtr->setMirroredY( true );
 if( getTextBody() )
 {
-sal_Int32 nTextCameraZRotation = static_cast< sal_Int32 >( 
getTextBody()->get3DProperties().maCameraRotation.mnRevolution.value() );
+sal_Int32 nTextCameraZRotation = 
getTextBody()->get3DProperties().maCameraRotation.mnRevolution.value_or(0);
 mpCustomShapePropertiesPtr->setTextCameraZRotateAngle( 
nTextCameraZRotation / 6 );
 
 sal_Int32 nTextRotateAngle = static_cast< sal_Int32 >( 
getTextBody()->getTextProperties().moRotation.value_or( 0 ) );
diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx
index 6d80193e7b37..00a346748531 100644
--- a/oox/source/vml/vmlformatting.cxx
+++ b/oox/source/vml/vmlformatting.cxx
@@ -981,7 +981,7 @@ void TextpathModel::pushToPropMap(ShapePropertyMap& 
rPropMap, const uno::Referen
 if (moTrim.has_value() && moTrim.value())
 return;
 
-OUString sText = moString.value();
+OUString sText = moString.value_or("");
 ScopedVclPtrInstance pDevice;
 vcl::Font aFont = pDevice->GetFont();
 aFont.SetFamilyName(sFont);
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 2cb8261f1af4..22ea45a3bdd3 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -578,7 +578,7 @@ SimpleShape::SimpleShape( Drawing& rDrawing, const 
OUString& rService ) :
 
 static void lcl_setSurround(PropertySet& rPropSet, const ShapeTypeModel& 
rTypeModel, const GraphicHelper& rGraphicHelper)
 {
-OUString aWrapType = rTypeModel.moWrapType.value();
+OUString aWrapType = rTypeModel.moWrapType.value_or("");
 
 // Extreme negative top margin? Then the shape will end up at the top of 
the page, it's pointless to perform any kind of wrapping.
 sal_Int32 nMarginTop = 
ConversionHelper::decodeMeasureToHmm(rGraphicHelper, rTypeModel.maMarginTop, 0, 
false, true);
@@ -590,7 +590,9 @@ static void lcl_setSurround(PropertySet& rPropSet, const 
ShapeTypeModel& rTypeMo
  aWrapType == "through" )
 {
 nSurround = css::text::WrapTextMode_PARALLEL;
-if ( rTypeModel.moWrapSide.value() == "left" )
+if ( !rTypeModel.moWrapSide.has_value() )
+; // leave as PARALLEL
+else if ( rTypeModel.moWrapSide.value() == "left" )
 nSurround 

[Libreoffice-commits] core.git: include/oox oox/source sc/source

2022-06-22 Thread Noel Grandin (via logerrit)
 include/oox/helper/helper.hxx|4 -
 oox/source/drawingml/chart/axisconverter.cxx |   20 +++---
 oox/source/drawingml/chart/chartspaceconverter.cxx   |2 
 oox/source/drawingml/chart/objectformatter.cxx   |4 -
 oox/source/drawingml/chart/seriesconverter.cxx   |   28 -
 oox/source/drawingml/connectorshapecontext.cxx   |   12 +--
 oox/source/drawingml/customshapegeometry.cxx |   26 
 oox/source/drawingml/customshapeproperties.cxx   |   24 +++
 oox/source/drawingml/diagram/datamodelcontext.cxx|   20 +++---
 oox/source/drawingml/diagram/diagramdefinitioncontext.cxx|   14 ++--
 oox/source/drawingml/diagram/diagramlayoutatoms.cxx  |   12 +--
 oox/source/drawingml/diagram/layoutnodecontext.cxx   |   12 +--
 oox/source/drawingml/embeddedwavaudiofile.cxx|4 -
 oox/source/drawingml/fillproperties.cxx  |   18 ++---
 oox/source/drawingml/graphicshapecontext.cxx |   14 ++--
 oox/source/drawingml/hyperlinkcontext.cxx|8 +-
 oox/source/drawingml/lineproperties.cxx  |   22 +++
 oox/source/drawingml/shape.cxx   |   22 +++
 oox/source/drawingml/shapecontext.cxx|8 +-
 oox/source/drawingml/shapegroupcontext.cxx   |6 -
 oox/source/drawingml/table/tablecell.cxx |6 -
 oox/source/drawingml/table/tablecellcontext.cxx  |4 -
 oox/source/drawingml/table/tablecontext.cxx  |2 
 oox/source/drawingml/table/tablerowcontext.cxx   |2 
 oox/source/drawingml/table/tablestylecontext.cxx |4 -
 oox/source/drawingml/table/tablestylelistfragmenthandler.cxx |2 
 oox/source/drawingml/textbodypropertiescontext.cxx   |4 -
 oox/source/drawingml/textcharacterproperties.cxx |   18 ++---
 oox/source/drawingml/textcharacterpropertiescontext.cxx  |8 +-
 oox/source/drawingml/texteffectscontext.cxx  |2 
 oox/source/drawingml/textfield.cxx   |2 
 oox/source/drawingml/textfieldcontext.cxx|4 -
 oox/source/drawingml/textparagraph.cxx   |2 
 oox/source/drawingml/textparagraphpropertiescontext.cxx  |   30 -
 oox/source/drawingml/textrun.cxx |2 
 oox/source/drawingml/textspacingcontext.cxx  |4 -
 oox/source/drawingml/texttabstoplistcontext.cxx  |2 
 oox/source/drawingml/themeelementscontext.cxx|4 -
 oox/source/drawingml/themefragmenthandler.cxx|2 
 oox/source/drawingml/transform2dcontext.cxx  |   20 +++---
 oox/source/helper/attributelist.cxx  |2 
 oox/source/ppt/layoutfragmenthandler.cxx |2 
 oox/source/ppt/pptgraphicshapecontext.cxx|6 -
 oox/source/ppt/pptshape.cxx  |   10 +--
 oox/source/ppt/pptshapecontext.cxx   |6 -
 oox/source/ppt/pptshapegroupcontext.cxx  |8 +-
 oox/source/ppt/presPropsfragmenthandler.cxx  |4 -
 oox/source/ppt/slidefragmenthandler.cxx  |2 
 oox/source/shape/LockedCanvasContext.cxx |4 -
 oox/source/shape/WpsContext.cxx  |   12 +--
 oox/source/vml/vmlformatting.cxx |   34 +--
 oox/source/vml/vmlshape.cxx  |   16 ++---
 oox/source/vml/vmlshapecontext.cxx   |   26 
 oox/source/vml/vmltextbox.cxx|   22 +++
 oox/source/vml/vmltextboxcontext.cxx |8 +-
 sc/source/filter/oox/SparklineFragment.cxx   |4 -
 sc/source/filter/oox/autofilterbuffer.cxx|2 
 sc/source/filter/oox/drawingfragment.cxx |2 
 58 files changed, 287 insertions(+), 287 deletions(-)

New commits:
commit 0feeb94f97332a8e803e1936d66e0f234bd51973
Author: Noel Grandin 
AuthorDate: Tue Jun 21 13:02:53 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Jun 22 11:48:28 2022 +0200

rename oox::OptValue::get to value

as a step in replacing OptValue with std::optional

Change-Id: Ia5d05c28a88beaced11ae1d0414de66106cc9e20
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136269
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx
index 0c8aa2e6c358..9d5b7c3e2549 100644
--- a/include/oox/helper/helper.hxx
+++ b/include/oox/helper/helper.hxx
@@ -180,7 +180,7 @@ public:
 bool has_value() 

[Libreoffice-commits] core.git: include/oox oox/source sc/source

2022-06-22 Thread Noel Grandin (via logerrit)
 include/oox/helper/helper.hxx  |2 -
 oox/source/drawingml/chart/objectformatter.cxx |4 +--
 oox/source/drawingml/chart/plotareaconverter.cxx   |8 +++---
 oox/source/drawingml/chart/seriesconverter.cxx |   24 +-
 oox/source/drawingml/fillproperties.cxx|   28 ++---
 oox/source/drawingml/lineproperties.cxx|   12 -
 oox/source/drawingml/shape.cxx |8 +++---
 oox/source/drawingml/table/tablecell.cxx   |   12 -
 oox/source/drawingml/textbodyproperties.cxx|4 +--
 oox/source/drawingml/textbodypropertiescontext.cxx |4 +--
 oox/source/drawingml/textcharacterproperties.cxx   |   16 ++--
 oox/source/helper/attributelist.cxx|   18 ++---
 oox/source/vml/vmlformatting.cxx   |   20 +++
 oox/source/vml/vmlshape.cxx|8 +++---
 oox/source/vml/vmlshapecontext.cxx |4 +--
 sc/source/filter/oox/autofilterbuffer.cxx  |2 -
 sc/source/filter/oox/drawingfragment.cxx   |   16 ++--
 17 files changed, 95 insertions(+), 95 deletions(-)

New commits:
commit 813939f8e392feff0b6e1bae023bc9c98849
Author: Noel Grandin 
AuthorDate: Tue Jun 21 12:43:56 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Jun 22 10:28:41 2022 +0200

rename oox::OptValue::get(Type) to value_or

as a step towards replacing OptValue with std::optional

Change-Id: Ic4afaca87034b1b794432ee4261a6495058b26fa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136268
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx
index 90890b3ceecb..0c8aa2e6c358 100644
--- a/include/oox/helper/helper.hxx
+++ b/include/oox/helper/helper.hxx
@@ -181,7 +181,7 @@ public:
 bool operator!() const { return !mbHasValue; }
 
 const Type&  get() const { return maValue; }
-const Type&  get( const Type& rDefValue ) const { return mbHasValue ? 
maValue : rDefValue; }
+const Type&  value_or( const Type& rDefValue ) const { return mbHasValue ? 
maValue : rDefValue; }
 
 Type&operator*() { assert(mbHasValue); return maValue; }
 Type&emplace() { mbHasValue = true; maValue = Type(); return 
maValue; }
diff --git a/oox/source/drawingml/chart/objectformatter.cxx 
b/oox/source/drawingml/chart/objectformatter.cxx
index e04bfe5f0ae6..2ef67ebc683e 100644
--- a/oox/source/drawingml/chart/objectformatter.cxx
+++ b/oox/source/drawingml/chart/objectformatter.cxx
@@ -1060,14 +1060,14 @@ void ObjectFormatter::convertTextRotation( PropertySet& 
rPropSet, const ModelRef
 bool bStacked = false;
 if( bSupportsStacked )
 {
-sal_Int32 nVert = rxTextProp->getTextProperties().moVert.get( XML_horz 
);
+sal_Int32 nVert = rxTextProp->getTextProperties().moVert.value_or( 
XML_horz );
 bStacked = (nVert == XML_wordArtVert) || (nVert == XML_wordArtVertRtl);
 rPropSet.setProperty( PROP_StackCharacters, bStacked );
 }
 
 /*  Chart2 expects rotation angle as double value in range of [0,360).
 OOXML counts clockwise, Chart2 counts counterclockwise. */
-double fAngle = static_cast< double >( bStacked ? 0 : 
rxTextProp->getTextProperties().moRotation.get( nDefaultRotation ) );
+double fAngle = static_cast< double >( bStacked ? 0 : 
rxTextProp->getTextProperties().moRotation.value_or( nDefaultRotation ) );
 // MS Office UI allows values only in range of [-90,90].
 if ( fAngle < -540.0 || fAngle > 540.0 )
 {
diff --git a/oox/source/drawingml/chart/plotareaconverter.cxx 
b/oox/source/drawingml/chart/plotareaconverter.cxx
index afbb28adee03..a30b3bdc6249 100644
--- a/oox/source/drawingml/chart/plotareaconverter.cxx
+++ b/oox/source/drawingml/chart/plotareaconverter.cxx
@@ -217,9 +217,9 @@ void View3DConverter::convertFromModel( const Reference< 
XDiagram >& rxDiagram,
 if( rTypeGroup.getTypeInfo().meTypeCategory == TYPECATEGORY_PIE )
 {
 // Y rotation used as 'first pie slice angle' in 3D pie charts
-rTypeGroup.convertPieRotation( aPropSet, mrModel.monRotationY.get( 0 ) 
);
+rTypeGroup.convertPieRotation( aPropSet, 
mrModel.monRotationY.value_or( 0 ) );
 // X rotation a.k.a. elevation (map OOXML [0..90] to Chart2 [-90,0])
-nRotationX = getLimitedValue< sal_Int32, sal_Int32 >( 
mrModel.monRotationX.get( 15 ), 0, 90 ) - 90;
+nRotationX = getLimitedValue< sal_Int32, sal_Int32 >( 
mrModel.monRotationX.value_or( 15 ), 0, 90 ) - 90;
 // no right-angled axes in pie charts
 bRightAngled = false;
 // ambient color (Gray 30%)
@@ -230,9 +230,9 @@ void View3DConverter::convertFromModel( const Reference< 
XDiagram >& rxDiagram,
 else // 3D bar/area/line charts
 {
 // Y rotation (OOXML [0..359], Chart2 [-179,180])
-  

[Libreoffice-commits] core.git: include/oox oox/source sc/source

2022-06-22 Thread Noel Grandin (via logerrit)
 include/oox/helper/helper.hxx|8 +++-
 oox/source/drawingml/effectproperties.cxx|   14 +++
 oox/source/drawingml/fillproperties.cxx  |   46 +++
 oox/source/drawingml/lineproperties.cxx  |   16 
 oox/source/drawingml/textcharacterproperties.cxx |   26 ++---
 oox/source/vml/vmlformatting.cxx |   46 +++
 oox/source/vml/vmlshape.cxx  |   10 ++---
 oox/source/vml/vmlshapecontext.cxx   |   20 +-
 sc/source/filter/oox/autofilterbuffer.cxx|2 -
 9 files changed, 97 insertions(+), 91 deletions(-)

New commits:
commit 3ff9582704a024b4a89da9a63322e117157b5857
Author: Noel Grandin 
AuthorDate: Tue Jun 21 12:18:52 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Jun 22 10:08:35 2022 +0200

make oox::OptValue::assignIfUsed a free function

as a step towards making OptValue into std::optional.

Change-Id: I3eae4034a846dd63a16e501abe4a6eba9d186a49
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136266
Tested-by: Noel Grandin 
Reviewed-by: Noel Grandin 

diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx
index 9dc43bdc9b34..90890b3ceecb 100644
--- a/include/oox/helper/helper.hxx
+++ b/include/oox/helper/helper.hxx
@@ -191,13 +191,19 @@ public:
  return ( ( !mbHasValue && rValue.mbHasValue == 
false ) ||
  ( mbHasValue == rValue.mbHasValue && maValue 
== rValue.maValue ) );
  }
-void assignIfUsed( const OptValue& rValue ) { if( 
rValue.mbHasValue ) operator=(rValue.maValue); }
 
 private:
 TypemaValue;
 boolmbHasValue;
 };
 
+template< typename Type >
+void assignIfUsed( OptValue& rDestValue, const OptValue& 
rSourceValue )
+{
+if( rSourceValue.has_value() )
+rDestValue = rSourceValue.get();
+}
+
 
 /** Provides platform independent functions to convert from or to little-endian
 byte order, e.g. for reading data from or writing data to memory or a
diff --git a/oox/source/drawingml/effectproperties.cxx 
b/oox/source/drawingml/effectproperties.cxx
index 88d69a16d177..579f4e1ab0ac 100644
--- a/oox/source/drawingml/effectproperties.cxx
+++ b/oox/source/drawingml/effectproperties.cxx
@@ -21,23 +21,23 @@ namespace oox::drawingml {
 
 void EffectGlowProperties ::assignUsed(const EffectGlowProperties& 
rSourceProps)
 {
-moGlowRad.assignIfUsed( rSourceProps.moGlowRad );
+assignIfUsed( moGlowRad, rSourceProps.moGlowRad );
 moGlowColor.assignIfUsed( rSourceProps.moGlowColor );
 }
 
 void EffectSoftEdgeProperties::assignUsed(const EffectSoftEdgeProperties& 
rSourceProps)
 {
-moRad.assignIfUsed(rSourceProps.moRad);
+assignIfUsed(moRad, rSourceProps.moRad);
 }
 
 void EffectShadowProperties::assignUsed(const EffectShadowProperties& 
rSourceProps)
 {
-moShadowDist.assignIfUsed( rSourceProps.moShadowDist );
-moShadowDir.assignIfUsed( rSourceProps.moShadowDir );
-moShadowSx.assignIfUsed( rSourceProps.moShadowSx );
-moShadowSy.assignIfUsed( rSourceProps.moShadowSy );
+assignIfUsed( moShadowDist, rSourceProps.moShadowDist );
+assignIfUsed( moShadowDir, rSourceProps.moShadowDir );
+assignIfUsed( moShadowSx, rSourceProps.moShadowSx );
+assignIfUsed( moShadowSy, rSourceProps.moShadowSy );
 moShadowColor.assignIfUsed( rSourceProps.moShadowColor );
-moShadowBlur.assignIfUsed( rSourceProps.moShadowBlur );
+assignIfUsed( moShadowBlur, rSourceProps.moShadowBlur );
 
 }
 
diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index b26c42b85759..f315f0182245 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -292,51 +292,51 @@ void GradientFillProperties::assignUsed( const 
GradientFillProperties& rSourcePr
 {
 if( !rSourceProps.maGradientStops.empty() )
 maGradientStops = rSourceProps.maGradientStops;
-moFillToRect.assignIfUsed( rSourceProps.moFillToRect );
-moTileRect.assignIfUsed( rSourceProps.moTileRect );
-moGradientPath.assignIfUsed( rSourceProps.moGradientPath );
-moShadeAngle.assignIfUsed( rSourceProps.moShadeAngle );
-moShadeFlip.assignIfUsed( rSourceProps.moShadeFlip );
-moShadeScaled.assignIfUsed( rSourceProps.moShadeScaled );
-moRotateWithShape.assignIfUsed( rSourceProps.moRotateWithShape );
+assignIfUsed( moFillToRect, rSourceProps.moFillToRect );
+assignIfUsed( moTileRect, rSourceProps.moTileRect );
+assignIfUsed( moGradientPath, rSourceProps.moGradientPath );
+assignIfUsed( moShadeAngle, rSourceProps.moShadeAngle );
+assignIfUsed( moShadeFlip, rSourceProps.moShadeFlip );
+assignIfUsed( moShadeScaled, rSourceProps.moShadeScaled );
+assignIfUsed( moRotateWithShape, rSourceProps.moRotateWithShape );
 }
 
 void 

[Libreoffice-commits] core.git: include/oox oox/source

2022-06-22 Thread Noel Grandin (via logerrit)
 include/oox/helper/helper.hxx   |1 -
 oox/source/helper/attributelist.cxx |   33 -
 2 files changed, 16 insertions(+), 18 deletions(-)

New commits:
commit e9affc204c1d330b2a7873f44b3f575bcccdf4dc
Author: Noel Grandin 
AuthorDate: Tue Jun 21 12:27:26 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Jun 22 10:06:19 2022 +0200

remove OptValue(bool,Type) constructor

as a step towards converting it to std::optional

Change-Id: I6f377967f2a495d8c29979444607c991aaaf5d63
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136267
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx
index 33ae8689b5eb..9dc43bdc9b34 100644
--- a/include/oox/helper/helper.hxx
+++ b/include/oox/helper/helper.hxx
@@ -176,7 +176,6 @@ class OptValue
 public:
  OptValue() : maValue(), mbHasValue( false ) {}
 explicit OptValue( const Type& rValue ) : maValue( rValue ), 
mbHasValue( true ) {}
-explicit OptValue( bool bHasValue, const Type& rValue ) : maValue( 
rValue ), mbHasValue( bHasValue ) {}
 
 bool has_value() const { return mbHasValue; }
 bool operator!() const { return !mbHasValue; }
diff --git a/oox/source/helper/attributelist.cxx 
b/oox/source/helper/attributelist.cxx
index 25cb1ac5354f..c7b6b0c4cfb6 100644
--- a/oox/source/helper/attributelist.cxx
+++ b/oox/source/helper/attributelist.cxx
@@ -163,7 +163,7 @@ oox::drawingml::Color 
AttributeList::getHighlightColor(sal_Int32 nAttrToken) con
 OptValue< sal_Int32 > AttributeList::getToken( sal_Int32 nAttrToken ) const
 {
 sal_Int32 nToken = mxAttribs->getOptionalValueToken( nAttrToken, 
XML_TOKEN_INVALID );
-return OptValue< sal_Int32 >( nToken != XML_TOKEN_INVALID, nToken );
+return nToken == XML_TOKEN_INVALID ? OptValue< sal_Int32 >() : OptValue< 
sal_Int32 >( nToken );
 }
 
 OptValue< OUString > AttributeList::getString( sal_Int32 nAttrToken ) const
@@ -186,35 +186,35 @@ OptValue< double > AttributeList::getDouble( sal_Int32 
nAttrToken ) const
 {
 double nValue;
 bool bValid = getAttribList()->getAsDouble( nAttrToken, nValue );
-return OptValue< double >( bValid, nValue );
+return bValid ? OptValue< double >( nValue ) : OptValue< double >();
 }
 
 OptValue< sal_Int32 > AttributeList::getInteger( sal_Int32 nAttrToken ) const
 {
 sal_Int32 nValue;
 bool bValid = getAttribList()->getAsInteger( nAttrToken, nValue );
-return OptValue< sal_Int32 >( bValid, nValue );
+return bValid ? OptValue< sal_Int32 >( nValue ) : OptValue< sal_Int32 >();
 }
 
 OptValue< sal_uInt32 > AttributeList::getUnsigned( sal_Int32 nAttrToken ) const
 {
 OUString aValue = mxAttribs->getOptionalValue( nAttrToken );
 bool bValid = !aValue.isEmpty();
-return OptValue< sal_uInt32 >( bValid, 
AttributeConversion::decodeUnsigned( aValue ) );
+return bValid ? OptValue< sal_uInt32 >( 
AttributeConversion::decodeUnsigned( aValue ) ) : OptValue< sal_uInt32 >();
 }
 
 OptValue< sal_Int64 > AttributeList::getHyper( sal_Int32 nAttrToken ) const
 {
 OUString aValue = mxAttribs->getOptionalValue( nAttrToken );
 bool bValid = !aValue.isEmpty();
-return OptValue< sal_Int64 >( bValid, bValid ? 
AttributeConversion::decodeHyper( aValue ) : 0 );
+return bValid ? OptValue< sal_Int64 >( AttributeConversion::decodeHyper( 
aValue ) ) : OptValue< sal_Int64 >();
 }
 
 OptValue< sal_Int32 > AttributeList::getIntegerHex( sal_Int32 nAttrToken ) 
const
 {
 OUString aValue = mxAttribs->getOptionalValue( nAttrToken );
 bool bValid = !aValue.isEmpty();
-return OptValue< sal_Int32 >( bValid, bValid ? 
AttributeConversion::decodeIntegerHex( aValue ) : 0 );
+return bValid ? OptValue< sal_Int32 >( 
AttributeConversion::decodeIntegerHex( aValue ) ) : OptValue< sal_Int32 >();
 }
 
 OptValue< bool > AttributeList::getBool( sal_Int32 nAttrToken ) const
@@ -243,7 +243,7 @@ OptValue< bool > AttributeList::getBool( sal_Int32 
nAttrToken ) const
 case XML_off:   return OptValue< bool >( false );
 }
 OptValue< sal_Int32 > onValue = getInteger( nAttrToken );
-return OptValue< bool >( onValue.has_value(), onValue.get() != 0 );
+return onValue.has_value() ? OptValue< bool >( onValue.get() != 0 ) : 
OptValue< bool >();
 }
 
 OptValue< util::DateTime > AttributeList::getDateTime( sal_Int32 nAttrToken ) 
const
@@ -252,16 +252,15 @@ OptValue< util::DateTime > AttributeList::getDateTime( 
sal_Int32 nAttrToken ) co
 util::DateTime aDateTime;
 bool bValid = (aValue.getLength() == 19) && (aValue[ 4 ] == '-') && 
(aValue[ 7 ] == '-') &&
 (aValue[ 10 ] == 'T') && (aValue[ 13 ] == ':') && (aValue[ 16 ] == 
':');
-if( bValid )
-{
-aDateTime.Year= static_cast< sal_uInt16 >( 
o3tl::toInt32(aValue.subView( 0, 4 )) );
-aDateTime.Month   = static_cast< sal_uInt16 >( 
o3tl::toInt32(aValue.subView( 5, 2 )) );
- 

[Libreoffice-commits] core.git: include/oox oox/source

2022-06-22 Thread Noel Grandin (via logerrit)
 include/oox/helper/helper.hxx   |3 -
 oox/source/drawingml/chart/seriesconverter.cxx  |5 +-
 oox/source/drawingml/colorchoicecontext.cxx |2 
 oox/source/drawingml/shape3dproperties.cxx  |   40 
 oox/source/drawingml/textcharacterpropertiescontext.cxx |4 +
 5 files changed, 30 insertions(+), 24 deletions(-)

New commits:
commit b7fce4a7d26aa559b0d86ec561348c9adee4efcc
Author: Noel Grandin 
AuthorDate: Tue Jun 21 11:37:13 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Jun 22 08:55:59 2022 +0200

replace oox::OptValue::use

with emplace and operator*
as a step towards converting it to std::optional

Change-Id: I3fca397c7dcfe200962e2b81a423322e29787f20
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136215
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx
index 7299353f1298..33ae8689b5eb 100644
--- a/include/oox/helper/helper.hxx
+++ b/include/oox/helper/helper.hxx
@@ -184,7 +184,8 @@ public:
 const Type&  get() const { return maValue; }
 const Type&  get( const Type& rDefValue ) const { return mbHasValue ? 
maValue : rDefValue; }
 
-Type&use() { mbHasValue = true; return maValue; }
+Type&operator*() { assert(mbHasValue); return maValue; }
+Type&emplace() { mbHasValue = true; maValue = Type(); return 
maValue; }
 
 OptValue&operator=( const Type& rValue ) { maValue = rValue; 
mbHasValue = true; return *this; }
 bool operator==( const OptValue& rValue ) const {
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx 
b/oox/source/drawingml/chart/seriesconverter.cxx
index 703d995b18bf..b4e8666ffdb9 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -330,7 +330,10 @@ void DataLabelConverter::convertFromModel( const 
Reference< XDataSeries >& rxDat
 const auto& rLabelMap = pLabelSource->mxDataSeq->maData;
 const auto& rKV = rLabelMap.find(mrModel.mnIndex);
 if (rKV != rLabelMap.end())
-rKV->second >>= oaLabelText.use();
+{
+oaLabelText.emplace();
+rKV->second >>= *oaLabelText;
+}
 }
 }
 
diff --git a/oox/source/drawingml/colorchoicecontext.cxx 
b/oox/source/drawingml/colorchoicecontext.cxx
index 8da42f62a419..81e077d58c4c 100644
--- a/oox/source/drawingml/colorchoicecontext.cxx
+++ b/oox/source/drawingml/colorchoicecontext.cxx
@@ -65,7 +65,7 @@ void ColorValueContext::onStartElement( const AttributeList& 
rAttribs )
 mrColor.setSchemeClr( rAttribs.getToken( XML_val, 
XML_TOKEN_INVALID ) );
 oox::OptValue sSchemeName = rAttribs.getString( XML_val 
);
 if( sSchemeName.has_value() )
-mrColor.setSchemeName( sSchemeName.use() );
+mrColor.setSchemeName( *sSchemeName );
 }
 break;
 
diff --git a/oox/source/drawingml/shape3dproperties.cxx 
b/oox/source/drawingml/shape3dproperties.cxx
index 8554320acf0b..3f9ac87158c4 100644
--- a/oox/source/drawingml/shape3dproperties.cxx
+++ b/oox/source/drawingml/shape3dproperties.cxx
@@ -210,37 +210,37 @@ css::uno::Sequence< css::beans::PropertyValue > 
Generic3DProperties::getCameraAt
 if( mfFieldOfVision.has_value() )
 {
 pSeq[nSize].Name = "fov";
-pSeq[nSize].Value <<= mfFieldOfVision.use();
+pSeq[nSize].Value <<= *mfFieldOfVision;
 nSize++;
 }
 if( mfZoom.has_value() )
 {
 pSeq[nSize].Name = "zoom";
-pSeq[nSize].Value <<= mfZoom.use();
+pSeq[nSize].Value <<= *mfZoom;
 nSize++;
 }
 if( mnPreset.has_value() )
 {
 pSeq[nSize].Name = "prst";
-pSeq[nSize].Value <<= getCameraPrstName( mnPreset.use() );
+pSeq[nSize].Value <<= getCameraPrstName( *mnPreset );
 nSize++;
 }
 if( maCameraRotation.mnLatitude.has_value() )
 {
 pSeq[nSize].Name = "rotLat";
-pSeq[nSize].Value <<= maCameraRotation.mnLatitude.use();
+pSeq[nSize].Value <<= *maCameraRotation.mnLatitude;
 nSize++;
 }
 if( maCameraRotation.mnLongitude.has_value() )
 {
 pSeq[nSize].Name = "rotLon";
-pSeq[nSize].Value <<= maCameraRotation.mnLongitude.use();
+pSeq[nSize].Value <<= *maCameraRotation.mnLongitude;
 nSize++;
 }
 if( maCameraRotation.mnRevolution.has_value() )
 {
 pSeq[nSize].Name = "rotRev";
-pSeq[nSize].Value <<= maCameraRotation.mnRevolution.use();
+pSeq[nSize].Value <<= *maCameraRotation.mnRevolution;
 nSize++;
 }
 aSeq.realloc( nSize );
@@ -255,31 +255,31 @@ css::uno::Sequence< css::beans::PropertyValue > 
Generic3DProperties::getLightRig
 

[Libreoffice-commits] core.git: include/oox oox/source writerfilter/source

2022-06-21 Thread Noel Grandin (via logerrit)
 include/oox/helper/helper.hxx   |5 +--
 oox/source/drawingml/chart/objectformatter.cxx  |2 -
 oox/source/drawingml/scene3dcontext.cxx |8 ++---
 oox/source/drawingml/shape.cxx  |2 -
 oox/source/drawingml/table/predefined-table-styles.cxx  |   22 +++---
 oox/source/drawingml/table/tablecell.cxx|6 ++--
 oox/source/drawingml/textcharacterpropertiescontext.cxx |2 -
 oox/source/drawingml/textrun.cxx|4 +-
 oox/source/vml/vmlshapecontext.cxx  |4 +-
 writerfilter/source/rtftok/rtfsdrimport.cxx |   24 
 10 files changed, 39 insertions(+), 40 deletions(-)

New commits:
commit 36d3fa20a5e0ebd7d3befd789a6930c777972e8c
Author: Noel Grandin 
AuthorDate: Tue Jun 21 11:23:47 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue Jun 21 14:37:34 2022 +0200

remove oox::OptValue::set

as a step towards converting it to std::optional

Change-Id: I49db0b13338388c92108fc2c27d8e662dcd954d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136214
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx
index 8f0e75839281..7299353f1298 100644
--- a/include/oox/helper/helper.hxx
+++ b/include/oox/helper/helper.hxx
@@ -184,15 +184,14 @@ public:
 const Type&  get() const { return maValue; }
 const Type&  get( const Type& rDefValue ) const { return mbHasValue ? 
maValue : rDefValue; }
 
-void set( const Type& rValue ) { maValue = rValue; mbHasValue = 
true; }
 Type&use() { mbHasValue = true; return maValue; }
 
-OptValue&operator=( const Type& rValue ) { set( rValue ); return 
*this; }
+OptValue&operator=( const Type& rValue ) { maValue = rValue; 
mbHasValue = true; return *this; }
 bool operator==( const OptValue& rValue ) const {
  return ( ( !mbHasValue && rValue.mbHasValue == 
false ) ||
  ( mbHasValue == rValue.mbHasValue && maValue 
== rValue.maValue ) );
  }
-void assignIfUsed( const OptValue& rValue ) { if( 
rValue.mbHasValue ) set( rValue.maValue ); }
+void assignIfUsed( const OptValue& rValue ) { if( 
rValue.mbHasValue ) operator=(rValue.maValue); }
 
 private:
 TypemaValue;
diff --git a/oox/source/drawingml/chart/objectformatter.cxx 
b/oox/source/drawingml/chart/objectformatter.cxx
index 4bd69f8c779f..e04bfe5f0ae6 100644
--- a/oox/source/drawingml/chart/objectformatter.cxx
+++ b/oox/source/drawingml/chart/objectformatter.cxx
@@ -906,7 +906,7 @@ TextFormatter::TextFormatter( ObjectFormatterData& rData, 
const AutoTextEntry* p
 ::Color nTextColor = getPhColor( -1 );
 if( sal_Int32(nTextColor) >= 0 ) {
 mxAutoText->maFillProperties.maFillColor.setSrgbClr( nTextColor );
-mxAutoText->maFillProperties.moFillType.set(XML_solidFill);
+mxAutoText->maFillProperties.moFillType = XML_solidFill;
 }
 mxAutoText->moHeight = pAutoTextEntry->mnDefFontSize;
 mxAutoText->moBold = pAutoTextEntry->mbBold;
diff --git a/oox/source/drawingml/scene3dcontext.cxx 
b/oox/source/drawingml/scene3dcontext.cxx
index e17893472bc2..10b4fbff606c 100644
--- a/oox/source/drawingml/scene3dcontext.cxx
+++ b/oox/source/drawingml/scene3dcontext.cxx
@@ -105,9 +105,9 @@ ContextHandlerRef 
SceneText3DPropertiesContext::onCreateContext( sal_Int32 aElem
 aProps.mnPreset = rAttribs.getToken( XML_prst, XML_none );
 
 if( aElementToken == A_TOKEN( bevelT ) )
-mr3DProperties.maTopBevelProperties.set( aProps );
+mr3DProperties.maTopBevelProperties = aProps;
 else
-mr3DProperties.maBottomBevelProperties.set( aProps );
+mr3DProperties.maBottomBevelProperties = aProps;
 break;
 }
 
@@ -150,9 +150,9 @@ ContextHandlerRef 
Shape3DPropertiesContext::onCreateContext( sal_Int32 aElementT
 aProps.mnPreset = rAttribs.getToken( XML_prst, XML_none );
 
 if( aElementToken == A_TOKEN( bevelT ) )
-mr3DProperties.maTopBevelProperties.set( aProps );
+mr3DProperties.maTopBevelProperties = aProps;
 else
-mr3DProperties.maBottomBevelProperties.set( aProps );
+mr3DProperties.maBottomBevelProperties = aProps;
 
 break;
 }
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 7e61dfb7c9c5..6b6ffbeab607 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1772,7 +1772,7 @@ Reference< XShape > const & Shape::createAndInsert(
 if ( pFontRef->maPhClr.isUsed() )
 {
 aCharStyleProperties.maFillProperties.maFillColor 
= pFontRef->maPhClr;
-

[Libreoffice-commits] core.git: include/oox oox/source

2022-06-21 Thread Noel Grandin (via logerrit)
 include/oox/helper/helper.hxx  |1 -
 oox/source/drawingml/chart/seriesconverter.cxx |5 +++--
 oox/source/drawingml/lineproperties.cxx|   16 +---
 oox/source/drawingml/table/tablecell.cxx   |2 +-
 4 files changed, 13 insertions(+), 11 deletions(-)

New commits:
commit 6471ea40f7739814264ce8540cdedef28a3cb731
Author: Noel Grandin 
AuthorDate: Tue Jun 21 11:09:42 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue Jun 21 14:36:43 2022 +0200

remove oox::OptValue::differsFrom

as a step towards converting it to std::optional

Change-Id: I198abb4ae85b1d82f465577ebd0eec37b78c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136213
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx
index 1805e0b24c81..8f0e75839281 100644
--- a/include/oox/helper/helper.hxx
+++ b/include/oox/helper/helper.hxx
@@ -180,7 +180,6 @@ public:
 
 bool has_value() const { return mbHasValue; }
 bool operator!() const { return !mbHasValue; }
-bool differsFrom( const Type& rValue ) const { return mbHasValue 
&& (maValue != rValue); }
 
 const Type&  get() const { return maValue; }
 const Type&  get( const Type& rDefValue ) const { return mbHasValue ? 
maValue : rDefValue; }
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx 
b/oox/source/drawingml/chart/seriesconverter.cxx
index c022c35bf536..703d995b18bf 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -722,12 +722,13 @@ void DataPointConverter::convertFromModel( const 
Reference< XDataSeries >& rxDat
 PropertySet aPropSet( rxDataSeries->getDataPointByIndex( 
mrModel.mnIndex ) );
 
 // data point marker
-if( mrModel.monMarkerSymbol.differsFrom( rSeries.mnMarkerSymbol ) || 
mrModel.monMarkerSize.differsFrom( rSeries.mnMarkerSize ) )
+if( ( mrModel.monMarkerSymbol.has_value() && 
mrModel.monMarkerSymbol.get() != rSeries.mnMarkerSymbol ) ||
+( mrModel.monMarkerSize.has_value() && mrModel.monMarkerSize.get() 
!= rSeries.mnMarkerSize ) )
 rTypeGroup.convertMarker( aPropSet, mrModel.monMarkerSymbol.get( 
rSeries.mnMarkerSymbol ),
 mrModel.monMarkerSize.get( rSeries.mnMarkerSize ), 
mrModel.mxMarkerProp );
 
 // data point pie explosion
-if( mrModel.monExplosion.differsFrom( rSeries.mnExplosion ) )
+if( mrModel.monExplosion.has_value() && mrModel.monExplosion.get() != 
rSeries.mnExplosion )
 rTypeGroup.convertPieExplosion( aPropSet, 
mrModel.monExplosion.get() );
 
 // point formatting
diff --git a/oox/source/drawingml/lineproperties.cxx 
b/oox/source/drawingml/lineproperties.cxx
index 8f1a0c905b92..4cd83045840a 100644
--- a/oox/source/drawingml/lineproperties.cxx
+++ b/oox/source/drawingml/lineproperties.cxx
@@ -449,12 +449,13 @@ void LineProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 rPropMap.setProperty( ShapeProperty::LineCap, eLineCap );
 
 // create line dash from preset dash token or dash stop vector (not for 
invisible line)
-if( (eLineStyle != drawing::LineStyle_NONE) && (moPresetDash.differsFrom( 
XML_solid ) || !maCustomDash.empty()) )
+if( (eLineStyle != drawing::LineStyle_NONE) &&
+((moPresetDash.has_value() && moPresetDash.get() != XML_solid) || 
!maCustomDash.empty()) )
 {
 LineDash aLineDash;
 aLineDash.Style = lclGetDashStyle( moLineCap.get( XML_flat ) );
 
-if(moPresetDash.differsFrom(XML_solid))
+if(moPresetDash.has_value() && moPresetDash.get() != XML_solid)
 lclConvertPresetDash(aLineDash, moPresetDash.get(XML_dash));
 else // !maCustomDash.empty()
 {
@@ -505,11 +506,12 @@ void LineProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 drawing::LineStyle LineProperties::getLineStyle() const
 {
 // rules to calculate the line style inferred from the code in 
LineProperties::pushToPropMap
-return (maLineFill.moFillType.get() == XML_noFill) ?
-drawing::LineStyle_NONE :
-(moPresetDash.differsFrom( XML_solid ) || (!moPresetDash && 
!maCustomDash.empty())) ?
-drawing::LineStyle_DASH :
-drawing::LineStyle_SOLID;
+if (maLineFill.moFillType.get() == XML_noFill)
+return drawing::LineStyle_NONE;
+if ((moPresetDash.has_value() && moPresetDash.get() != XML_solid) ||
+(!moPresetDash && !maCustomDash.empty()))
+   return drawing::LineStyle_DASH;
+return drawing::LineStyle_SOLID;
 }
 
 drawing::LineCap LineProperties::getLineCap() const
diff --git a/oox/source/drawingml/table/tablecell.cxx 
b/oox/source/drawingml/table/tablecell.cxx
index 32ac36b92ddc..1dae5369b271 100644
--- a/oox/source/drawingml/table/tablecell.cxx
+++ b/oox/source/drawingml/table/tablecell.cxx
@@ -64,7 +64,7 @@ 

[Libreoffice-commits] core.git: include/oox oox/source sc/source writerfilter/source

2022-06-21 Thread Noel Grandin (via logerrit)
 include/oox/helper/helper.hxx   |2 
 oox/source/drawingml/chart/axisconverter.cxx|   20 
 oox/source/drawingml/chart/chartspaceconverter.cxx  |2 
 oox/source/drawingml/chart/objectformatter.cxx  |6 +-
 oox/source/drawingml/chart/seriesconverter.cxx  |   28 +--
 oox/source/drawingml/colorchoicecontext.cxx |2 
 oox/source/drawingml/customshapeproperties.cxx  |   22 
 oox/source/drawingml/diagram/datamodelcontext.cxx   |2 
 oox/source/drawingml/diagram/diagramlayoutatoms.cxx |   14 ++---
 oox/source/drawingml/fillproperties.cxx |   16 +++---
 oox/source/drawingml/lineproperties.cxx |   12 ++--
 oox/source/drawingml/shape.cxx  |   24 -
 oox/source/drawingml/shape3dproperties.cxx  |   40 
 oox/source/drawingml/table/predefined-table-styles.cxx  |2 
 oox/source/drawingml/table/tablecell.cxx|4 -
 oox/source/drawingml/textbodypropertiescontext.cxx  |2 
 oox/source/drawingml/textcharacterproperties.cxx|   18 +++
 oox/source/drawingml/textcharacterpropertiescontext.cxx |6 +-
 oox/source/drawingml/textfield.cxx  |2 
 oox/source/drawingml/textparagraph.cxx  |6 +-
 oox/source/drawingml/textparagraphpropertiescontext.cxx |   14 ++---
 oox/source/drawingml/textrun.cxx|4 -
 oox/source/helper/attributelist.cxx |2 
 oox/source/ppt/layoutfragmenthandler.cxx|2 
 oox/source/ppt/pptshape.cxx |6 +-
 oox/source/ppt/pptshapecontext.cxx  |2 
 oox/source/ppt/slidefragmenthandler.cxx |2 
 oox/source/shape/WpsContext.cxx |8 +--
 oox/source/vml/vmlformatting.cxx|   30 ++--
 oox/source/vml/vmlshape.cxx |   12 ++--
 oox/source/vml/vmlshapecontext.cxx  |   18 +++
 oox/source/vml/vmltextbox.cxx   |   18 +++
 oox/source/vml/vmltextboxcontext.cxx|4 -
 sc/source/filter/oox/drawingfragment.cxx|2 
 writerfilter/source/rtftok/rtfsdrimport.cxx |2 
 35 files changed, 178 insertions(+), 178 deletions(-)

New commits:
commit d8487667e65184aa58520aa907fa747a73a08e34
Author: Noel Grandin 
AuthorDate: Tue Jun 21 11:00:43 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue Jun 21 11:58:40 2022 +0200

rename oox::OptValue::has() to has_value

as a step towards converting it to std::optional

Change-Id: I9b2201c29827fcddae3b46480065c90b2907e6cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136210
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx
index 63718ca0ebed..1805e0b24c81 100644
--- a/include/oox/helper/helper.hxx
+++ b/include/oox/helper/helper.hxx
@@ -178,7 +178,7 @@ public:
 explicit OptValue( const Type& rValue ) : maValue( rValue ), 
mbHasValue( true ) {}
 explicit OptValue( bool bHasValue, const Type& rValue ) : maValue( 
rValue ), mbHasValue( bHasValue ) {}
 
-bool has() const { return mbHasValue; }
+bool has_value() const { return mbHasValue; }
 bool operator!() const { return !mbHasValue; }
 bool differsFrom( const Type& rValue ) const { return mbHasValue 
&& (maValue != rValue); }
 
diff --git a/oox/source/drawingml/chart/axisconverter.cxx 
b/oox/source/drawingml/chart/axisconverter.cxx
index a8ccc6cdf164..bb6b278af8ac 100644
--- a/oox/source/drawingml/chart/axisconverter.cxx
+++ b/oox/source/drawingml/chart/axisconverter.cxx
@@ -55,12 +55,12 @@ namespace {
 
 void lclSetValueOrClearAny( Any& orAny, const OptValue< double >& rofValue )
 {
-if( rofValue.has() ) orAny <<= rofValue.get(); else orAny.clear();
+if( rofValue.has_value() ) orAny <<= rofValue.get(); else orAny.clear();
 }
 
 bool lclIsLogarithmicScale( const AxisModel& rAxisModel )
 {
-return rAxisModel.mofLogBase.has() && (2.0 <= rAxisModel.mofLogBase.get()) 
&& (rAxisModel.mofLogBase.get() <= 1000.0);
+return rAxisModel.mofLogBase.has_value() && (2.0 <= 
rAxisModel.mofLogBase.get()) && (rAxisModel.mofLogBase.get() <= 1000.0);
 }
 
 sal_Int32 lclGetApiTimeUnit( sal_Int32 nTimeUnit )
@@ -78,7 +78,7 @@ sal_Int32 lclGetApiTimeUnit( sal_Int32 nTimeUnit )
 
 void lclConvertTimeInterval( Any& orInterval, const OptValue< double >& 
rofUnit, sal_Int32 nTimeUnit )
 {
-if( rofUnit.has() && (1.0 <= rofUnit.get()) && (rofUnit.get() <= 
SAL_MAX_INT32) )
+if( rofUnit.has_value() && (1.0 <= rofUnit.get()) && (rofUnit.get() <= 
SAL_MAX_INT32) )
 orInterval <<= css::chart::TimeInterval( static_cast< sal_Int32 >( 
rofUnit.get() ), 

[Libreoffice-commits] core.git: include/oox oox/source sd/qa

2022-05-31 Thread Attila Bakos (NISZ) (via logerrit)
 include/oox/export/drawingml.hxx   |5 ++-
 oox/source/export/drawingml.cxx|   53 -
 oox/source/export/shapes.cxx   |   13 
 sd/qa/unit/data/odp/testZeroIndent.odp |binary
 sd/qa/unit/export-tests-ooxml3.cxx |   38 +++
 5 files changed, 95 insertions(+), 14 deletions(-)

New commits:
commit 445d4ce232b8e8efaeb2605533fede1b71f52f30
Author: Attila Bakos (NISZ) 
AuthorDate: Thu May 26 17:04:54 2022 +0200
Commit: László Németh 
CommitDate: Tue May 31 13:00:38 2022 +0200

tdf#147991 PPTX export: fix bullet indent regression

Instead of exporting the inherited master slide indent
values of the placeholders, export 0 indent value for
removed/disabled bullets to fix interoperability.

Regression from commit f57cfddb51b7d7409b7b425dc200aa73406a13bd
"tdf#145162 PPTX export: fix extra bullet regression".

Change-Id: Icbf823adc07f19fd10d1a60da9cff17616a2aef6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135025
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 294319cf43af..455676e9c262 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -163,6 +163,9 @@ protected:
 css::uno::Reference m_xParent;
 bool  mbIsBackgroundDark;
 
+/// True when exporting presentation placeholder shape.
+bool mbPlaceholder;
+
 bool GetProperty( const css::uno::Reference< css::beans::XPropertySet >& 
rXPropSet, const OUString& aName );
 bool GetPropertyAndState( const css::uno::Reference< 
css::beans::XPropertySet >& rXPropSet,
   const css::uno::Reference< css::beans::XPropertyState >& 
rXPropState,
@@ -210,7 +213,7 @@ protected:
 
 public:
 DrawingML( ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* 
pFB, DocumentType eDocumentType = DOCUMENT_PPTX, DMLTextExport* pTextExport = 
nullptr )
-: meDocumentType( eDocumentType ), mpTextExport(pTextExport), mpFS( 
pFS ), mpFB( pFB ), mbIsBackgroundDark( false ) {}
+: meDocumentType( eDocumentType ), mpTextExport(pTextExport), mpFS( 
pFS ), mpFB( pFB ), mbIsBackgroundDark( false ), mbPlaceholder(false) {}
 void SetFS( ::sax_fastparser::FSHelperPtr pFS ) { mpFS = pFS; }
 const ::sax_fastparser::FSHelperPtr& GetFS() const { return mpFS; }
 ::oox::core::XmlFilterBase* GetFB() { return mpFB; }
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 18e6e2723e89..eea8394aef36 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -122,6 +122,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2705,13 +2706,7 @@ static OUString GetAutoNumType(SvxNumType 
nNumberingType, bool bSDot, bool bPBeh
 void DrawingML::WriteParagraphNumbering(const Reference< XPropertySet >& 
rXPropSet, float fFirstCharHeight, sal_Int16 nLevel )
 {
 if (nLevel < 0 || !GetProperty(rXPropSet, "NumberingRules"))
-{
-if (GetDocumentType() == DOCUMENT_PPTX)
-{
-mpFS->singleElementNS(XML_a, XML_buNone);
-}
 return;
-}
 
 Reference< XIndexAccess > rXIndexAccess;
 
@@ -3015,6 +3010,32 @@ bool DrawingML::WriteParagraphProperties( const 
Reference< XTextContent >& rPara
 if (GetProperty(rXPropSet, "NumberingLevel"))
 mAny >>= nLevel;
 
+bool bWriteNumbering = true;
+bool bForceZeroIndent = false;
+if (mbPlaceholder)
+{
+Reference< text::XTextRange > xParaText(rParagraph, UNO_QUERY);
+if (xParaText)
+{
+bool bNumberingOnThisLevel = false;
+if (nLevel > -1)
+{
+Reference< XIndexAccess > 
xNumberingRules(rXPropSet->getPropertyValue("NumberingRules"), UNO_QUERY);
+const PropertyValues& rNumRuleOfLevel = 
xNumberingRules->getByIndex(nLevel).get();
+for (const PropertyValue& rRule : rNumRuleOfLevel)
+if (rRule.Name == "NumberingType" && 
rRule.Value.hasValue())
+bNumberingOnThisLevel = rRule.Value.get() 
!= style::NumberingType::NUMBER_NONE;
+}
+
+const bool bIsNumberingVisible = 
rXPropSet->getPropertyValue("NumberingIsNumber").get();
+const bool bIsLineEmpty = !xParaText->getString().getLength();
+
+bWriteNumbering = !bIsLineEmpty && bIsNumberingVisible && (nLevel 
!= -1);
+bForceZeroIndent = (!bIsNumberingVisible || bIsLineEmpty || 
!bNumberingOnThisLevel);
+}
+
+}
+
 sal_Int16 nTmp = sal_Int16(style::ParagraphAdjust_LEFT);
 if (GetProperty(rXPropSet, "ParaAdjust"))
 mAny >>= nTmp;
@@ -3058,23 +3079,26 @@ bool DrawingML::WriteParagraphProperties( const 
Reference< XTextContent >& rPara
 sal_Int32 nLeftMargin =  

[Libreoffice-commits] core.git: include/oox oox/source sd/qa

2022-05-27 Thread Tibor Nagy (via logerrit)
 include/oox/drawingml/shape.hxx|6 +++
 include/oox/ppt/slidepersist.hxx   |4 ++
 oox/source/ppt/pptshape.cxx|   23 ++--
 oox/source/ppt/presentationfragmenthandler.cxx |   46 +
 oox/source/ppt/slidepersist.cxx|2 +
 sd/qa/unit/data/pptx/tdf148965.pptx|binary
 sd/qa/unit/import-tests.cxx|   37 
 7 files changed, 100 insertions(+), 18 deletions(-)

New commits:
commit 855a56fea4561135a63cb729d7a625a950b210e7
Author: Tibor Nagy 
AuthorDate: Fri May 13 08:12:17 2022 +0200
Commit: László Németh 
CommitDate: Fri May 27 18:32:38 2022 +0200

tdf#148965 PPTX import: fix internal hyperlinks on shapes

Locale dependent code path resulted broken hyperlinks
on shapes in a non-English build.

Change-Id: I045bbe4246ab5336e2b967bf252b5fbca5b17706
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134266
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index 4318c1e24d2d..e845b399f5f8 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -140,6 +140,9 @@ public:
 voidsetConnectorShape(bool bConnector) { 
mbConnector = bConnector; }
 boolisConnectorShape() const { return 
mbConnector; }
 
+voidsetBookmark(bool bBookmark) { 
mbHasBookmark = bBookmark; }
+boolhasBookmark() const { return 
mbHasBookmark; }
+
 Shape3DProperties&  get3DProperties() { return 
*mp3DPropertiesPtr; }
 const Shape3DProperties&get3DProperties() const { return 
*mp3DPropertiesPtr; }
 
@@ -410,6 +413,9 @@ private:
 // Is this a connector shape?
 bool mbConnector = false;
 
+// Is shape has bookmark?
+bool mbHasBookmark = false;
+
 // temporary space for DiagramHelper in preparation for collecting data
 // Note: I tried to use a unique_ptr here, but existing constructor func 
does not allow that
 svx::diagram::IDiagramHelper* mpDiagramHelper;
diff --git a/include/oox/ppt/slidepersist.hxx b/include/oox/ppt/slidepersist.hxx
index 1b0a92c70783..4ba48637c66a 100644
--- a/include/oox/ppt/slidepersist.hxx
+++ b/include/oox/ppt/slidepersist.hxx
@@ -127,6 +127,9 @@ public:
 
 void createConnectorShapeConnection();
 
+void  addURLShapeId(const OUString& rShapeId) { 
maURLShapeId.push_back(rShapeId); }
+std::vector& getURLShapeId() { return maURLShapeId; }
+
 private:
 OUString
maPath;
 OUString
maLayoutPath;
@@ -160,6 +163,7 @@ private:
 CommentAuthorList   
maCommentAuthors;
 
 std::vector   
maConnectorShapeId;
+std::vector   
maURLShapeId;
 };
 
 }
diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index d83737250550..2ec4a3fbe327 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -613,27 +613,14 @@ void PPTShape::addShape(
 // so check here if it's a bookmark or a document
 if (meClickAction == ClickAction_BOOKMARK)
 {
+sal_Int32 nSplitPos;
 if (!sURL.startsWith("#"))
 meClickAction = ClickAction_DOCUMENT;
-else
+else if (-1 != (nSplitPos = sURL.indexOf( ' ' )))
 {
-sURL = sURL.copy(1);
-sal_Int32 nPageNumber = 0;
-static const OUStringLiteral sSlide = u"Slide ";
-if (sURL.match(sSlide))
-nPageNumber = 
o3tl::toInt32(sURL.subView(sSlide.getLength()));
-Reference 
xDPS(rFilterBase.getModel(),
-
uno::UNO_QUERY_THROW);
-Reference 
xDrawPages(xDPS->getDrawPages(),
-  
uno::UNO_SET_THROW);
-sal_Int32 nMaxPages = xDrawPages->getCount();
-if (nPageNumber && nPageNumber <= nMaxPages)
-{
-Reference xDrawPage;
-xDrawPages->getByIndex(nPageNumber - 1) >>= 
xDrawPage;
-Reference xNamed(xDrawPage, 
UNO_QUERY);
-sURL = xNamed->getName();
-}
+ 

[Libreoffice-commits] core.git: include/oox oox/source

2022-05-04 Thread Noel Grandin (via logerrit)
 include/oox/vml/vmlformatting.hxx|   12 ++--
 oox/source/vml/vmlformatting.cxx |   97 ++-
 oox/source/vml/vmlshape.cxx  |   24 
 oox/source/vml/vmlshapecontext.cxx   |   66 +++
 oox/source/vml/vmltextboxcontext.cxx |   24 
 5 files changed, 113 insertions(+), 110 deletions(-)

New commits:
commit 9bb83eefc1a1dda5c48efc5d09ef4a6840bf8b58
Author: Noel Grandin 
AuthorDate: Tue May 3 16:30:20 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed May 4 14:09:46 2022 +0200

use more string_view in oox::vml::ConversionHelper

Change-Id: I8616f608ee4cc62114acb4fbd774796bc11d1911
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133812
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/oox/vml/vmlformatting.hxx 
b/include/oox/vml/vmlformatting.hxx
index 29d726a2bdba..3f7bbe60a457 100644
--- a/include/oox/vml/vmlformatting.hxx
+++ b/include/oox/vml/vmlformatting.hxx
@@ -57,7 +57,7 @@ namespace ConversionHelper
 /** Returns two values contained in rValue separated by cSep.
  */
 OOX_DLLPUBLIC bool separatePair(
-OUString& orValue1, OUString& orValue2,
+std::u16string_view& orValue1, 
std::u16string_view& orValue2,
 std::u16string_view rValue, sal_Unicode cSep );
 
 /** Returns the boolean value from the passed string of a VML attribute.
@@ -75,7 +75,7 @@ namespace ConversionHelper
 the value will be divided by 65536.
  */
 OOX_DLLPUBLIC double   decodePercent(
-const OUString& rValue,
+std::u16string_view rValue,
 double fDefValue );
 
 /** Converts the passed VML rotation value to degrees.
@@ -88,7 +88,7 @@ namespace ConversionHelper
 point value will be returned unmodified. If the 'fd' suffix is
 present, the value will be divided by 65536.
 */
-OOX_DLLPUBLIC Degree100 decodeRotation( const OUString& rValue );
+OOX_DLLPUBLIC Degree100 decodeRotation( std::u16string_view rValue );
 
 /** Converts the passed VML measure string to EMU (English Metric Units).
 
@@ -110,7 +110,7 @@ namespace ConversionHelper
  */
 OOX_DLLPUBLIC sal_Int64decodeMeasureToEmu(
 const GraphicHelper& rGraphicHelper,
-const OUString& rValue,
+std::u16string_view rValue,
 sal_Int32 nRefValue,
 bool bPixelX,
 bool bDefaultAsPixel );
@@ -125,7 +125,7 @@ namespace ConversionHelper
  */
 OOX_DLLPUBLIC sal_Int32decodeMeasureToHmm(
 const GraphicHelper& rGraphicHelper,
-const OUString& rValue,
+std::u16string_view rValue,
 sal_Int32 nRefValue,
 bool bPixelX,
 bool bDefaultAsPixel );
@@ -139,7 +139,7 @@ namespace ConversionHelper
 @param bDefaultAsPixel  See above.
  */
 OOX_DLLPUBLIC sal_Int32 decodeMeasureToTwip(const GraphicHelper& 
rGraphicHelper,
-const OUString& rValue, sal_Int32 
nRefValue,
+std::u16string_view rValue, 
sal_Int32 nRefValue,
 bool bPixelX, bool 
bDefaultAsPixel);
 
 /** Converts VML color attributes to a DrawingML color.
diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx
index 241991dac3c8..80e38c2b318b 100644
--- a/oox/source/vml/vmlformatting.cxx
+++ b/oox/source/vml/vmlformatting.cxx
@@ -65,17 +65,19 @@ using ::com::sun::star::drawing::PolygonFlags_CONTROL;
 
 namespace {
 
-bool lclExtractDouble( double& orfValue, sal_Int32& ornEndPos, 
std::u16string_view aValue )
+bool lclExtractDouble( double& orfValue, size_t& ornEndPos, 
std::u16string_view aValue )
 {
 // extract the double value and find start position of unit characters
 rtl_math_ConversionStatus eConvStatus = rtl_math_ConversionStatus_Ok;
-orfValue = ::rtl::math::stringToDouble( aValue, '.', '\0', , 
 );
+sal_Int32 nEndPos;
+orfValue = ::rtl::math::stringToDouble( aValue, '.', '\0', , 
 );
+ornEndPos = nEndPos;
 return eConvStatus == rtl_math_ConversionStatus_Ok;
 }
 
 } // namespace
 
-bool ConversionHelper::separatePair( OUString& orValue1, OUString& orValue2,
+bool ConversionHelper::separatePair( std::u16string_view& orValue1, 
std::u16string_view& orValue2,
 std::u16string_view rValue, sal_Unicode cSep )
 {
 size_t nSepPos = rValue.find( cSep );
@@ -88,7 +90,7 @@ bool ConversionHelper::separatePair( OUString& orValue1, 
OUString& orValue2,
 {
 orValue1 = o3tl::trim(rValue);
 }
-return 

[Libreoffice-commits] core.git: include/oox oox/source

2022-05-04 Thread Stephan Bergmann (via logerrit)
 include/oox/drawingml/shapepropertymap.hxx |2 
 include/oox/helper/propertyset.hxx |2 
 oox/source/core/xmlfilterbase.cxx  |2 
 oox/source/docprop/docprophandler.cxx  |   56 
 oox/source/drawingml/chart/chartspaceconverter.cxx |4 
 oox/source/drawingml/chart/objectformatter.cxx |4 
 oox/source/drawingml/chart/seriesconverter.cxx |   12 -
 oox/source/drawingml/chart/titleconverter.cxx  |2 
 oox/source/drawingml/diagram/diagram.cxx   |2 
 oox/source/drawingml/shape.cxx |   96 +++
 oox/source/drawingml/textcharacterproperties.cxx   |2 
 oox/source/drawingml/textfield.cxx |8 -
 oox/source/drawingml/textparagraphproperties.cxx   |2 
 oox/source/drawingml/theme.cxx |2 
 oox/source/export/ColorPropertySet.cxx |6 
 oox/source/export/chartexport.cxx  |4 
 oox/source/export/drawingml.cxx|2 
 oox/source/helper/grabbagstack.cxx |6 
 oox/source/helper/propertymap.cxx  |   20 +--
 oox/source/ppt/animationspersist.cxx   |2 
 oox/source/ppt/conditioncontext.cxx|2 
 oox/source/ppt/pptimport.cxx   |4 
 oox/source/ppt/presentationfragmenthandler.cxx |4 
 oox/source/ppt/timenode.cxx|4 
 oox/source/ppt/timenodelistcontext.cxx |   12 -
 oox/source/shape/WpsContext.cxx|   19 +-
 oox/source/vml/vmldrawing.cxx  |   12 -
 oox/source/vml/vmlformatting.cxx   |6 
 oox/source/vml/vmlshape.cxx|  134 ++---
 oox/source/vml/vmltextbox.cxx  |6 
 30 files changed, 219 insertions(+), 220 deletions(-)

New commits:
commit adf7d6efed63c3b92a473553039645a37253f3ac
Author: Stephan Bergmann 
AuthorDate: Wed May 4 07:04:48 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Wed May 4 09:06:13 2022 +0200

Just use Any ctor instead of makeAny in oox

Change-Id: Id6c8341b545c819521056926ef1b80d20d148c5f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133795
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/include/oox/drawingml/shapepropertymap.hxx 
b/include/oox/drawingml/shapepropertymap.hxx
index a9e4ea405273..11670c02edf4 100644
--- a/include/oox/drawingml/shapepropertymap.hxx
+++ b/include/oox/drawingml/shapepropertymap.hxx
@@ -128,7 +128,7 @@ public:
 }
 bool setProperty(ShapeProperty ePropId, const ::Color& rValue)
 {
-return setAnyProperty(ePropId, css::uno::makeAny(rValue));
+return setAnyProperty(ePropId, css::uno::Any(rValue));
 }
 
 using PropertyMap::setAnyProperty;
diff --git a/include/oox/helper/propertyset.hxx 
b/include/oox/helper/propertyset.hxx
index f729a29fb17b..676ec4cebf82 100644
--- a/include/oox/helper/propertyset.hxx
+++ b/include/oox/helper/propertyset.hxx
@@ -108,7 +108,7 @@ public:
 bool setProperty( sal_Int32 nPropId, const Type& rValue )
 { return setAnyProperty( nPropId, css::uno::Any( 
rValue ) ); }
 bool setProperty( sal_Int32 nPropId, ::Color rValue )
-{ return setAnyProperty( nPropId, 
css::uno::makeAny( rValue ) ); }
+{ return setAnyProperty( nPropId, css::uno::Any( 
rValue ) ); }
 
 /** Puts the passed properties into the property set. Tries to use the 
XMultiPropertySet interface.
 @param rPropNames  The property names. MUST be ordered alphabetically.
diff --git a/oox/source/core/xmlfilterbase.cxx 
b/oox/source/core/xmlfilterbase.cxx
index 73e6d90e1649..e8e1a138984b 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -1224,7 +1224,7 @@ void XmlFilterBase::exportCustomFragments()
 {
 const OUString aType = 
comphelper::OFOPXMLHelper::GetContentTypeByName(aContentTypes, aFilename);
 const OUString aContentType = (aType.getLength() ? aType : 
OUString("application/octet-stream"));
-xProps->setPropertyValue("MediaType", 
uno::makeAny(aContentType));
+xProps->setPropertyValue("MediaType", uno::Any(aContentType));
 }
 }
 }
diff --git a/oox/source/docprop/docprophandler.cxx 
b/oox/source/docprop/docprophandler.cxx
index c2609a8227d8..9a23991a47c9 100644
--- a/oox/source/docprop/docprophandler.cxx
+++ b/oox/source/docprop/docprophandler.cxx
@@ -373,7 +373,7 @@ void SAL_CALL OOXMLDocPropHandler::endFastElement( 
::sal_Int32 )
 // the property has string type, so it is valid
 // even with an empty value - characters() has
 // not been called in that case
-

[Libreoffice-commits] core.git: include/oox oox/source

2022-04-29 Thread Noel Grandin (via logerrit)
 include/oox/ole/olehelper.hxx |6 +++---
 oox/source/drawingml/hyperlinkcontext.cxx |4 ++--
 oox/source/dump/oledumper.cxx |9 +
 oox/source/export/drawingml.cxx   |4 ++--
 oox/source/ole/olehelper.cxx  |6 ++
 oox/source/ole/vbamodule.cxx  |4 ++--
 oox/source/vml/vmlformatting.cxx  |   12 ++--
 7 files changed, 22 insertions(+), 23 deletions(-)

New commits:
commit 38d4b6eb42246c0dbd4958a50ed8437bc93508d6
Author: Noel Grandin 
AuthorDate: Fri Apr 29 10:29:11 2022 +0200
Commit: Noel Grandin 
CommitDate: Fri Apr 29 12:35:47 2022 +0200

use more string_view in oox

found by examining uses of OUString::copy() for likely places

Change-Id: I23c397b0438e67e0fdbc1fb4ffa6882aa5e2bf91
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133591
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/oox/ole/olehelper.hxx b/include/oox/ole/olehelper.hxx
index f15642760f3d..e01e6025723a 100644
--- a/include/oox/ole/olehelper.hxx
+++ b/include/oox/ole/olehelper.hxx
@@ -146,11 +146,11 @@ public:
 OleFormCtrlExportHelper( const css::uno::Reference< 
css::uno::XComponentContext >& rxCtx, const css::uno::Reference< 
css::frame::XModel >& xDocModel, const css::uno::Reference< 
css::awt::XControlModel >& xModel );
 ~OleFormCtrlExportHelper();
 
-OUString getGUID() const
+std::u16string_view getGUID() const
 {
-OUString sResult;
+std::u16string_view sResult;
 if ( maGUID.getLength() > 2 )
-sResult = maGUID.copy(1, maGUID.getLength() - 2 );
+sResult = maGUID.subView(1, maGUID.getLength() - 2 );
 return sResult;
 }
 const OUString& getFullName() const { return maFullName; }
diff --git a/oox/source/drawingml/hyperlinkcontext.cxx 
b/oox/source/drawingml/hyperlinkcontext.cxx
index 7bb6930eca13..352eb7bf5efa 100644
--- a/oox/source/drawingml/hyperlinkcontext.cxx
+++ b/oox/source/drawingml/hyperlinkcontext.cxx
@@ -91,8 +91,8 @@ HyperLinkContext::HyperLinkContext( ContextHandler2Helper 
const & rParent,
 static const OUStringLiteral sJump( u"jump=" );
 if ( aPPAct.match( sJump, nIndex + 1 ) )
 {
-OUString aDestination( aPPAct.copy( nIndex + 1 + 
sJump.getLength() ) );
-sURL += "#action?jump=" + aDestination;
+std::u16string_view aDestination( aPPAct.subView( nIndex + 
1 + sJump.getLength() ) );
+sURL += OUString::Concat("#action?jump=") + aDestination;
 }
 }
 else if ( aPPAction.match( "hlinksldjump" ) )
diff --git a/oox/source/dump/oledumper.cxx b/oox/source/dump/oledumper.cxx
index 036c12a5670e..92e67c04590f 100644
--- a/oox/source/dump/oledumper.cxx
+++ b/oox/source/dump/oledumper.cxx
@@ -24,6 +24,7 @@
 #include 
 
 #include 
+#include 
 #include 
 
 #ifdef DBG_UTIL
@@ -1830,10 +1831,10 @@ bool VbaContainerStorageObject::isFormStorage( const 
OUString& rStrgPath ) const
 {
 if( (rStrgPath.getLength() >= 3) && (rStrgPath[ 0 ] == 'i') )
 {
-OUString aId = rStrgPath.copy( 1 );
-if( (aId.getLength() == 2) && (aId[ 0 ] == '0') )
-aId = aId.copy( 1 );
-sal_Int32 nId = aId.toInt32();
+std::u16string_view aId = rStrgPath.subView( 1 );
+if( (aId.size() == 2) && (aId[ 0 ] == '0') )
+aId = aId.substr( 1 );
+sal_Int32 nId = o3tl::toInt32(aId);
 if( (nId > 0) && (std::u16string_view(OUString::number( nId )) == aId) 
)
 for (auto const& siteInfo : maFormData.maSiteInfos)
 if( siteInfo.mnId == nId )
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 609528cd33bf..bbeea30af4e5 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2389,9 +2389,9 @@ void DrawingML::WriteRunProperties( const Reference< 
XPropertySet >& rRun, bool
 else
 {
 sal_Int32 nIndex = sURL.indexOf('=');
-OUString aDestination(sURL.copy(nIndex + 1));
+std::u16string_view aDestination(sURL.subView(nIndex + 1));
 mpFS->singleElementNS(XML_a, XML_hlinkClick, FSNS(XML_r, 
XML_id), "", XML_action,
-  "ppaction://hlinkshowjump?jump=" + 
aDestination);
+  
OUString::Concat("ppaction://hlinkshowjump?jump=") + aDestination);
 }
 }
 }
diff --git a/oox/source/ole/olehelper.cxx b/oox/source/ole/olehelper.cxx
index 16b38919a213..41ab34febea3 100644
--- a/oox/source/ole/olehelper.cxx
+++ b/oox/source/ole/olehelper.cxx
@@ -525,8 +525,7 @@ bool MSConvertOCXControls::WriteOCXExcelKludgeStream( const 
css::uno::Reference<
 return false;
 rName = exportHelper.getTypeName();
 SvGlobalName aName;
-OUString sId = 

[Libreoffice-commits] core.git: include/oox oox/source svx/qa

2022-04-28 Thread Miklos Vajna (via logerrit)
 include/oox/drawingml/color.hxx |4 ++--
 oox/source/drawingml/color.cxx  |4 ++--
 oox/source/drawingml/fillproperties.cxx |6 ++
 oox/source/token/properties.txt |2 ++
 svx/qa/unit/styles.cxx  |   21 +++--
 5 files changed, 27 insertions(+), 10 deletions(-)

New commits:
commit 30735bdb5a0a81619000fdd24b2d0fbf45687f01
Author: Miklos Vajna 
AuthorDate: Wed Apr 27 20:12:52 2022 +0200
Commit: Miklos Vajna 
CommitDate: Thu Apr 28 08:15:54 2022 +0200

sd theme: add PPTX import for shape fill color effects

This is always direct formatting, so FillProperties::pushToPropMap()
always has the needed info at hand.

Change-Id: I3317b618e0e8bb7688d0f0fbfe4546e2e8b4e947
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133525
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/include/oox/drawingml/color.hxx b/include/oox/drawingml/color.hxx
index c0dd8d67a31c..cc65c1346720 100644
--- a/include/oox/drawingml/color.hxx
+++ b/include/oox/drawingml/color.hxx
@@ -100,8 +100,8 @@ public:
 const OUString& getSchemeColorName() const { return msSchemeName; }
 sal_Int16   getSchemeColorIndex() const;
 sal_Int16   getTintOrShade();
-sal_Int16   getLumMod();
-sal_Int16   getLumOff();
+sal_Int16   getLumMod() const;
+sal_Int16   getLumOff() const;
 
 /** Returns the unaltered list of transformations for interoperability 
purposes */
 const css::uno::Sequence< css::beans::PropertyValue >& 
getTransformations() const { return maInteropTransformations;}
diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx
index ee854a761fa2..982b77ff4831 100644
--- a/oox/source/drawingml/color.cxx
+++ b/oox/source/drawingml/color.cxx
@@ -496,7 +496,7 @@ sal_Int16 Color::getTintOrShade()
 return 0;
 }
 
-sal_Int16 Color::getLumMod()
+sal_Int16 Color::getLumMod() const
 {
 for (const auto& rTransform : maTransforms)
 {
@@ -512,7 +512,7 @@ sal_Int16 Color::getLumMod()
 return 1;
 }
 
-sal_Int16 Color::getLumOff()
+sal_Int16 Color::getLumOff() const
 {
 for (const auto& rTransform : maTransforms)
 {
diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index a6d5250f..2d85bf807e1a 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -397,6 +397,12 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 {
 rPropMap.setProperty(PROP_FillColorTheme, nPhClrTheme);
 }
+else
+{
+rPropMap.setProperty(PROP_FillColorTheme, 
maFillColor.getSchemeColorIndex());
+rPropMap.setProperty(PROP_FillColorLumMod, 
maFillColor.getLumMod());
+rPropMap.setProperty(PROP_FillColorLumOff, 
maFillColor.getLumOff());
+}
 
 eFillStyle = FillStyle_SOLID;
 }
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index e318e0038ecb..8467d3683875 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -177,6 +177,8 @@ FillBitmapSizeY
 FillBitmap
 FillColor
 FillColorTheme
+FillColorLumMod
+FillColorLumOff
 FillGradient
 FillGradientName
 FillHatch
diff --git a/svx/qa/unit/styles.cxx b/svx/qa/unit/styles.cxx
index ce9a039ce453..dd27e24f02ae 100644
--- a/svx/qa/unit/styles.cxx
+++ b/svx/qa/unit/styles.cxx
@@ -94,17 +94,26 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeChange)
 // Blue.
 CPPUNIT_ASSERT_EQUAL(static_cast(0x4472c4), 
GetShapeFillColor(xShape4));
 // The theme index of this filled shape is set by the PPTX import:
-sal_Int32 nColorTheme = -1;
+sal_Int16 nColorTheme = -1;
 xShape4->getPropertyValue("FillColorTheme") >>= nColorTheme;
 // 4 means accent1, this was -1 without the PPTX import bit in place.
-CPPUNIT_ASSERT_EQUAL(static_cast(4), nColorTheme);
+CPPUNIT_ASSERT_EQUAL(static_cast(4), nColorTheme);
 uno::Reference 
xShape5(xDrawPageShapes->getByIndex(5), uno::UNO_QUERY);
 // Blue, lighter.
 CPPUNIT_ASSERT_EQUAL(static_cast(0xb4c7e7), 
GetShapeFillColor(xShape5));
-// Set theme index to accent 1 & effects till PPTX import is missing.
-xShape5->setPropertyValue("FillColorTheme", 
uno::makeAny(static_cast(4)));
-xShape5->setPropertyValue("FillColorLumMod", 
uno::makeAny(static_cast(4000)));
-xShape5->setPropertyValue("FillColorLumOff", 
uno::makeAny(static_cast(6000)));
+// The theme index, and effects (lum mod, lum off) are set by the PPTX 
import:
+nColorTheme = -1;
+xShape5->getPropertyValue("FillColorTheme") >>= nColorTheme;
+// 4 means accent1, this was -1 without the PPTX import bit in place.
+CPPUNIT_ASSERT_EQUAL(static_cast(4), nColorTheme);
+sal_Int16 nColorLumMod = 1;
+

[Libreoffice-commits] core.git: include/oox oox/source sw/source

2022-04-26 Thread Tünde Tóth (via logerrit)
 include/oox/export/drawingml.hxx |8 --
 include/oox/export/vmlexport.hxx |4 -
 oox/source/export/drawingml.cxx  |   35 +-
 oox/source/export/vmlexport.cxx  |   20 --
 sw/source/filter/ww8/docxattributeoutput.cxx |   87 ---
 sw/source/filter/ww8/docxattributeoutput.hxx |   13 
 sw/source/filter/ww8/docxexport.cxx  |2 
 7 files changed, 13 insertions(+), 156 deletions(-)

New commits:
commit cf2dc247ff5f726238856e9b46a4926a30430e14
Author: Tünde Tóth 
AuthorDate: Mon Apr 4 11:49:59 2022 +0200
Commit: László Németh 
CommitDate: Tue Apr 26 18:07:40 2022 +0200

DOCX export: image deduplication and clean up

Follow-up to commit aea8043bc5f5187498fa450505d6de9d6986e2a6
"tdf#74670 tdf#91286 PPTX XLSX export: save image once".

This reverts commit 797fef38612fb2fd62d1f6591619b9361e526bca
"tdf#118535 DOCX export: save header image once"

and commit 32ada80a9f47b095d7b0c4d16e3422f6ef7f2ac2
"DOCX export: make sure a graphic is only written once"

and commit b484e9814c66d8d51cea974390963a6944bc9d73
"tdf#83227 oox: reuse RelId in DML/VML export for the same graphic".

Change-Id: I2d90249808174290b6b3e4eb957b3ac87ad41f95
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132506
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 9a7f744520c8..43aba83b6531 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -130,12 +130,6 @@ public:
 virtual void WriteOutliner(const OutlinerParaObject& rParaObj) = 0;
 /// Write the contents of the textbox that is associated to this shape.
 virtual void WriteTextBox(css::uno::Reference 
xShape) = 0;
-/// Look up the RelId of a graphic based on its checksum.
-virtual OUString FindRelId(BitmapChecksum nChecksum) = 0;
-/// Look up the filename of a graphic based on its checksum.
-virtual OUString FindFileName(BitmapChecksum nChecksum) = 0;
-/// Store the RelId and filename of a graphic based on its checksum.
-virtual void CacheRelId(BitmapChecksum nChecksum, const OUString& rRelId, 
const OUString& rFileName) = 0;
 ///  Get textbox which belongs to the shape.
 virtual css::uno::Reference GetUnoTextFrame(
 css::uno::Reference xShape) = 0;
@@ -224,7 +218,7 @@ public:
 
 void SetBackgroundDark(bool bIsDark) { mbIsBackgroundDark = bIsDark; }
 /// If bRelPathToMedia is true add "../" to image folder path while adding 
the image relationship
-OUString WriteImage( const Graphic  , bool bRelPathToMedia = 
false, OUString* pFileName = nullptr );
+OUString WriteImage( const Graphic  , bool bRelPathToMedia = 
false );
 
 void WriteColor( ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT );
 void WriteColor( const OUString& sColorSchemeName, const 
css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 
nAlpha = MAX_PERCENT );
diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx
index 5efdb34a90ff..fa54f27aa250 100644
--- a/include/oox/export/vmlexport.hxx
+++ b/include/oox/export/vmlexport.hxx
@@ -65,10 +65,6 @@ public:
 virtual oox::drawingml::DrawingML& GetDrawingML() = 0;
 /// Write the contents of the textbox that is associated to this shape in 
VML format.
 virtual void WriteVMLTextBox(css::uno::Reference 
xShape) = 0;
-/// Look up the RelId of a graphic based on its checksum.
-virtual OUString FindRelId(BitmapChecksum nChecksum) = 0;
-/// Store the RelId and filename of a graphic based on its checksum.
-virtual void CacheRelId(BitmapChecksum nChecksum, const OUString& rRelId, 
const OUString& rFileName) = 0;
 protected:
 VMLTextExport() {}
 virtual ~VMLTextExport() {}
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 78eac3d00f60..87ca05452513 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1271,7 +1271,7 @@ const char* DrawingML::GetRelationCompPrefix() const
 return "unknown";
 }
 
-OUString DrawingML::WriteImage( const Graphic& rGraphic , bool 
bRelPathToMedia, OUString* pFileName )
+OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia 
)
 {
 GfxLink aLink = rGraphic.GetGfxLink ();
 BitmapChecksum aChecksum = rGraphic.GetChecksum();
@@ -1280,8 +1280,8 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic , 
bool bRelPathToMedia,
 OUString sRelId;
 OUString sPath;
 
-// tdf#74670 tdf#91286 Save image only once (this is no problem for DOCX)
-if (GetDocumentType() != DOCUMENT_DOCX && !maExportGraphics.empty())
+// tdf#74670 tdf#91286 Save image only once
+if (!maExportGraphics.empty())
 {
 auto aIterator = maExportGraphics.top().find(aChecksum);
 if (aIterator != 

[Libreoffice-commits] core.git: include/oox oox/source

2022-04-14 Thread Noel Grandin (via logerrit)
 include/oox/dump/dumperbase.hxx   |2 -
 oox/source/core/relations.cxx |9 +--
 oox/source/crypto/AgileEngine.cxx |   43 --
 oox/source/dump/dumperbase.cxx|   12 +-
 oox/source/dump/pptxdumper.cxx|2 -
 5 files changed, 37 insertions(+), 31 deletions(-)

New commits:
commit 250a70dc37a921b71049817d5e46aae2eb4cced6
Author: Noel Grandin 
AuthorDate: Wed Apr 13 21:04:09 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu Apr 14 11:25:07 2022 +0200

use more string_view in oox

Change-Id: I25fe1cbfae43bb533e7dfc2561d0b70976aa6a40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132985
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/oox/dump/dumperbase.hxx b/include/oox/dump/dumperbase.hxx
index 9ce382ece7b9..10d3ed78ac2f 100644
--- a/include/oox/dump/dumperbase.hxx
+++ b/include/oox/dump/dumperbase.hxx
@@ -103,7 +103,7 @@ public:
 
 static OUString convertFileNameToUrl( const OUString& rFileName );
 static sal_Int32getFileNamePos( std::u16string_view rFileUrl );
-static OUString getFileNameExtension( const OUString& rFileUrl );
+static std::u16string_view getFileNameExtension( std::u16string_view 
rFileUrl );
 
 // input streams --
 
diff --git a/oox/source/core/relations.cxx b/oox/source/core/relations.cxx
index 9b29f20a1124..f927c542c89e 100644
--- a/oox/source/core/relations.cxx
+++ b/oox/source/core/relations.cxx
@@ -28,9 +28,12 @@ namespace oox::core {
 
 namespace {
 
-OUString lclRemoveFileName( const OUString& rPath )
+std::u16string_view lclRemoveFileName( std::u16string_view rPath )
 {
-return rPath.copy( 0, ::std::max< sal_Int32 >( rPath.lastIndexOf( '/' ), 0 
) );
+size_t idx = rPath.rfind( '/' );
+if (idx == std::u16string_view::npos)
+return std::u16string_view();
+return rPath.substr( 0, idx );
 }
 
 OUString lclAppendFileName( std::u16string_view rPath, const OUString& 
rFileName )
@@ -108,7 +111,7 @@ OUString Relations::getFragmentPathFromRelation( const 
Relation& rRelation ) con
 return rRelation.maTarget;
 
 // resolve relative target path according to base path
-OUString aPath = lclRemoveFileName( maFragmentPath );
+OUString aPath( lclRemoveFileName( maFragmentPath ) );
 sal_Int32 nStartPos = 0;
 while( nStartPos < rRelation.maTarget.getLength() )
 {
diff --git a/oox/source/crypto/AgileEngine.cxx 
b/oox/source/crypto/AgileEngine.cxx
index 0fd655ced63c..09748e9dfd7b 100644
--- a/oox/source/crypto/AgileEngine.cxx
+++ b/oox/source/crypto/AgileEngine.cxx
@@ -44,9 +44,12 @@ namespace oox::crypto {
 
 namespace {
 
-OUString stripNamespacePrefix(OUString const & rsInputName)
+std::u16string_view stripNamespacePrefix(std::u16string_view rsInputName)
 {
-return rsInputName.copy(rsInputName.indexOf(":") + 1);
+size_t idx = rsInputName.find(':');
+if (idx == std::u16string_view::npos)
+return rsInputName;
+return rsInputName.substr(idx + 1);
 }
 
 class AgileTokenHandler : public sax_fastparser::FastTokenHandlerBase
@@ -85,79 +88,79 @@ public:
 
 void SAL_CALL startUnknownElement( const OUString& /*aNamespace*/, const 
OUString& rName, const Reference< XFastAttributeList >& aAttributeList ) 
override
 {
-const OUString& rLocalName = stripNamespacePrefix(rName);
+std::u16string_view rLocalName = stripNamespacePrefix(rName);
 
 const css::uno::Sequence aUnknownAttributes = 
aAttributeList->getUnknownAttributes();
 for (const Attribute& rAttribute : aUnknownAttributes)
 {
-const OUString& rAttrLocalName = 
stripNamespacePrefix(rAttribute.Name);
+std::u16string_view rAttrLocalName = 
stripNamespacePrefix(rAttribute.Name);
 
-if (rAttrLocalName == "spinCount")
+if (rAttrLocalName == u"spinCount")
 {
 ::sax::Converter::convertNumber(mInfo.spinCount, 
rAttribute.Value);
 }
-else if (rAttrLocalName == "saltSize")
+else if (rAttrLocalName == u"saltSize")
 {
 ::sax::Converter::convertNumber(mInfo.saltSize, 
rAttribute.Value);
 }
-else if (rAttrLocalName == "blockSize")
+else if (rAttrLocalName == u"blockSize")
 {
 ::sax::Converter::convertNumber(mInfo.blockSize, 
rAttribute.Value);
 }
-else if (rAttrLocalName == "keyBits")
+else if (rAttrLocalName == u"keyBits")
 {
 ::sax::Converter::convertNumber(mInfo.keyBits, 
rAttribute.Value);
 }
-else if (rAttrLocalName == "hashSize")
+else if (rAttrLocalName == u"hashSize")
 {
 ::sax::Converter::convertNumber(mInfo.hashSize, 
rAttribute.Value);
 }
-else if (rAttrLocalName == "cipherAlgorithm")

[Libreoffice-commits] core.git: include/oox oox/source sc/qa sc/source sd/qa sd/source

2022-03-30 Thread Tünde Tóth (via logerrit)
 include/oox/export/drawingml.hxx |8 +
 oox/source/export/drawingml.cxx  |  207 +--
 sc/qa/unit/data/ods/tdf91286.ods |binary
 sc/qa/unit/subsequent_export_test2.cxx   |   26 +++
 sc/source/filter/excel/xestream.cxx  |4 
 sd/qa/unit/data/odp/tdf74670.odp |binary
 sd/qa/unit/export-tests-ooxml3.cxx   |   26 +++
 sd/source/filter/eppt/pptx-epptooxml.cxx |2 
 8 files changed, 182 insertions(+), 91 deletions(-)

New commits:
commit aea8043bc5f5187498fa450505d6de9d6986e2a6
Author: Tünde Tóth 
AuthorDate: Tue Mar 22 09:47:57 2022 +0100
Commit: László Németh 
CommitDate: Wed Mar 30 18:24:45 2022 +0200

tdf#74670 tdf#91286 PPTX XLSX export: save image once

Impress and Calc used to dump the same image file
as many times as it was featured in the document,
resulting redundant, sometimes huge documents.

Note: using only checksum to recognize image duplication
is a regression, because checksum collision results
image loss. This is a very unlikely event, and
the following commits have got the same problem.
The solution is comparing the images with the same
checksum byte for byte.

See also commit b484e9814c66d8d51cea974390963a6944bc9d73
"tdf#83227 oox: reuse RelId in DML/VML export for the same graphic"
and commit 797fef38612fb2fd62d1f6591619b9361e526bca
"tdf#118535 DOCX export: save header image once".

Change-Id: I9f233d521941381746634cf4f9b5991da0dadda9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131928
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index fb125dd647ad..9a7f744520c8 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -21,7 +21,9 @@
 #define INCLUDED_OOX_EXPORT_DRAWINGML_HXX
 
 #include 
+#include 
 #include 
+#include 
 #include 
 
 #include 
@@ -41,6 +43,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -150,6 +153,7 @@ private:
 static std::map maWdpCache;
 static sal_Int32 mnDrawingMLCount;
 static sal_Int32 mnVmlCount;
+static std::stack> 
maExportGraphics;
 
 /// To specify where write eg. the images to (like 'ppt', or 'word' - 
according to the OPC).
 DocumentType meDocumentType;
@@ -342,9 +346,11 @@ public:
 sal_Int32 getBulletMarginIndentation (const css::uno::Reference< 
css::beans::XPropertySet >& rXPropSet,sal_Int16 nLevel, std::u16string_view 
propName);
 
 static void ResetCounters();
-
 static void ResetMlCounters();
 
+static void PushExportGraphics();
+static void PopExportGraphics();
+
 static sal_Int32 getNewDrawingUniqueId() { return ++mnDrawingMLCount; }
 static sal_Int32 getNewVMLUniqueId() { return ++mnVmlCount; }
 
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index a790a643abc0..a99a0474a458 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -111,7 +111,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -237,6 +236,7 @@ int DrawingML::mnWdpImageCounter = 1;
 std::map DrawingML::maWdpCache;
 sal_Int32 DrawingML::mnDrawingMLCount = 0;
 sal_Int32 DrawingML::mnVmlCount = 0;
+std::stack> 
DrawingML::maExportGraphics;
 
 sal_Int16 DrawingML::GetScriptType(const OUString& rStr)
 {
@@ -275,6 +275,16 @@ void DrawingML::ResetMlCounters()
 mnVmlCount = 0;
 }
 
+void DrawingML::PushExportGraphics()
+{
+maExportGraphics.emplace();
+}
+
+void DrawingML::PopExportGraphics()
+{
+maExportGraphics.pop();
+}
+
 bool DrawingML::GetProperty( const Reference< XPropertySet >& rXPropertySet, 
const OUString& aName )
 {
 try
@@ -1264,113 +1274,130 @@ const char* DrawingML::GetRelationCompPrefix() const
 OUString DrawingML::WriteImage( const Graphic& rGraphic , bool 
bRelPathToMedia, OUString* pFileName )
 {
 GfxLink aLink = rGraphic.GetGfxLink ();
+BitmapChecksum aChecksum = rGraphic.GetChecksum();
 OUString sMediaType;
 const char* pExtension = "";
 OUString sRelId;
+OUString sPath;
 
-SvMemoryStream aStream;
-const void* aData = aLink.GetData();
-std::size_t nDataSize = aLink.GetDataSize();
-
-switch ( aLink.GetType() )
+// tdf#74670 tdf#91286 Save image only once (this is no problem for DOCX)
+if (GetDocumentType() != DOCUMENT_DOCX && !maExportGraphics.empty())
 {
-case GfxLinkType::NativeGif:
-sMediaType = "image/gif";
-pExtension = ".gif";
-break;
+auto aIterator = maExportGraphics.top().find(aChecksum);
+if (aIterator != maExportGraphics.top().end())
+sPath = aIterator->second;
+}
 
-// #i15508# added BMP type for better exports
-// export not yet active, so adding for reference (not checked)
-case GfxLinkType::NativeBmp:
-

[Libreoffice-commits] core.git: include/oox oox/source

2022-03-30 Thread Regina Henschel (via logerrit)
 include/oox/export/drawingml.hxx |5 
 oox/source/export/drawingml.cxx  |  650 ++-
 2 files changed, 309 insertions(+), 346 deletions(-)

New commits:
commit 365a3ed39083389f40612dec765d7b8e0dc2377b
Author: Regina Henschel 
AuthorDate: Tue Mar 29 16:23:46 2022 +0200
Commit: Miklos Vajna 
CommitDate: Wed Mar 30 09:30:08 2022 +0200

Extract 'switch' block out of WriteCustomGeometry

This is a follow up to commit 2029b2f6dd0109c5892e5ac5640022b31fe42fd2.
That commit has increased the line count of WriteCustomGeometry to more
than 500. This patch splits it to a main part of about 230 lines and
a new method for the previous 'switch' block of about 300 lines. That
makes the loops in the main part better readable.

Change-Id: Ied4378f54e7c8dc7965a5b1db15baf0b35f63f59
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132274
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index b507a0e41b60..fb125dd647ad 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -202,6 +202,11 @@ protected:
 void WriteSoftEdgeEffect(const 
css::uno::Reference& rXPropSet);
 void WriteCustomGeometryPoint(const 
css::drawing::EnhancedCustomShapeParameterPair& rParamPair,
   const EnhancedCustomShape2d& rCustomShape2d);
+bool WriteCustomGeometrySegment(
+const sal_Int16 eCommand, const sal_Int32 nCount,
+const 
css::uno::Sequence& rPairs,
+sal_Int32& rnPairIndex, double& rfCurrentX, double& rfCurrentY, bool& 
rbCurrentValid,
+const EnhancedCustomShape2d& rCustomShape2d);
 
 public:
 DrawingML( ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* 
pFB, DocumentType eDocumentType = DOCUMENT_PPTX, DMLTextExport* pTextExport = 
nullptr )
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index ff092b44641c..a790a643abc0 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -4038,352 +4038,9 @@ bool DrawingML::WriteCustomGeometry(
 }
 for (sal_Int32 k = 0; k < rSegment.Count && bOK; ++k)
 {
-switch (rSegment.Command)
-{
-case MOVETO:
-{
-if (nPairIndex >= aPairs.getLength())
-bOK = false;
-else
-{
-mpFS->startElementNS(XML_a, XML_moveTo);
-WriteCustomGeometryPoint(aPairs[nPairIndex], 
aCustomShape2d);
-mpFS->endElementNS(XML_a, XML_moveTo);
-aCustomShape2d.GetParameter(fCurrentX, 
aPairs[nPairIndex].First, false,
-false);
-aCustomShape2d.GetParameter(fCurrentY, 
aPairs[nPairIndex].Second, false,
-false);
-bCurrentValid = true;
-nPairIndex++;
-}
-break;
-}
-case LINETO:
-{
-if (nPairIndex >= aPairs.getLength())
-bOK = false;
-else
-{
-mpFS->startElementNS(XML_a, XML_lnTo);
-WriteCustomGeometryPoint(aPairs[nPairIndex], 
aCustomShape2d);
-mpFS->endElementNS(XML_a, XML_lnTo);
-aCustomShape2d.GetParameter(fCurrentX, 
aPairs[nPairIndex].First, false,
-false);
-aCustomShape2d.GetParameter(fCurrentY, 
aPairs[nPairIndex].Second, false,
-false);
-bCurrentValid = true;
-nPairIndex++;
-}
-break;
-}
-case CURVETO:
-{
-if (nPairIndex + 2 >= aPairs.getLength())
-bOK = false;
-else
-{
-mpFS->startElementNS(XML_a, XML_cubicBezTo);
-for (sal_uInt8 l = 0; l <= 2; ++l)
-{
-WriteCustomGeometryPoint(aPairs[nPairIndex + 
l], aCustomShape2d);
-}
-mpFS->endElementNS(XML_a, XML_cubicBezTo);
-aCustomShape2d.GetParameter(fCurrentX, 
aPairs[nPairIndex + 2].First,
-  

[Libreoffice-commits] core.git: include/oox oox/source

2022-03-24 Thread Armin Le Grand (Allotropia) (via logerrit)
 include/oox/drawingml/diagram/diagram.hxx   |9 ---
 oox/source/drawingml/diagram/datamodel.cxx  |   54 +++-
 oox/source/drawingml/diagram/datamodel.hxx  |   26 +++--
 oox/source/drawingml/diagram/datamodelcontext.cxx   |   29 ++
 oox/source/drawingml/diagram/diagram.cxx|   45 
 oox/source/drawingml/diagram/diagramhelper.cxx  |6 --
 oox/source/drawingml/diagram/diagramhelper.hxx  |3 -
 oox/source/drawingml/diagram/diagramlayoutatoms.cxx |   36 +++--
 oox/source/drawingml/shape.cxx  |5 +
 9 files changed, 104 insertions(+), 109 deletions(-)

New commits:
commit b658fdc33546f925a2a7406f8588a4aad160e4b8
Author: Armin Le Grand (Allotropia) 
AuthorDate: Thu Mar 24 10:44:18 2022 +0100
Commit: Armin Le Grand 
CommitDate: Thu Mar 24 16:31:42 2022 +0100

Advanced Diagram support: Continue isolate oox-Shapes

As preparations to use the Diagram ModelData further isolate
it from the oox-library-only drawingML Shape used for import.
It is necessary to completely isolate the Diagram ModelData
from the Diagram import mechanism as a preparation to be
able to re-create that Shapes on-demand anytime if needed
for re-layout(s).

Also removed one unused loadDiagram implementation and
streamlined the AdvancedDiagramHelper some more.

Change-Id: I7a7c55389e0d00f70c02db73ce2c3ff9ce7a5b22
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132058
Tested-by: Jenkins
Reviewed-by: Armin Le Grand 

diff --git a/include/oox/drawingml/diagram/diagram.hxx 
b/include/oox/drawingml/diagram/diagram.hxx
index 51d9ae5583db..fa200dd1662a 100644
--- a/include/oox/drawingml/diagram/diagram.hxx
+++ b/include/oox/drawingml/diagram/diagram.hxx
@@ -47,15 +47,6 @@ void loadDiagram( ShapePtr const & pShape,
   const OUString& rColorStylePath,
   const oox::core::Relations& rRelations );
 
-void loadDiagram(ShapePtr const& pShape,
- DiagramDataPtr pDiagramData,
- const css::uno::Reference& 
layoutDom,
- const css::uno::Reference& styleDom,
- const css::uno::Reference& colorDom,
- core::XmlFilterBase& rFilter);
-
-// OOX_DLLPUBLIC void reloadDiagram(SdrObject* pObj, core::XmlFilterBase& 
rFilter);
-
 }
 
 #endif
diff --git a/oox/source/drawingml/diagram/datamodel.cxx 
b/oox/source/drawingml/diagram/datamodel.cxx
index 6185ee7acfb9..c68ee40cd71c 100644
--- a/oox/source/drawingml/diagram/datamodel.cxx
+++ b/oox/source/drawingml/diagram/datamodel.cxx
@@ -46,16 +46,33 @@ void Connection::dump() const
 << mnSourceOrder << ", dstOrd " << mnDestOrder);
 }
 
-void Point::dump() const
+void Point::dump(const Shape* pShape) const
 {
 SAL_INFO(
 "oox.drawingml",
-"pt text " << mpShape.get() << ", cnxId " << msCnxId << ", modelId "
+"pt text " << pShape << ", cnxId " << msCnxId << ", modelId "
 << msModelId << ", type " << mnType);
 }
 
 } // oox::drawingml::dgm namespace
 
+Shape* DiagramData::getOrCreateAssociatedShape(const dgm::Point& rPoint, bool 
bCreateOnDemand) const
+{
+if(maPointShapeMap.end() == maPointShapeMap.find(rPoint.msModelId))
+{
+const_cast(this)->maPointShapeMap[rPoint.msModelId] = 
ShapePtr();
+}
+
+const ShapePtr& rShapePtr = maPointShapeMap.find(rPoint.msModelId)->second;
+
+if(!rShapePtr && bCreateOnDemand)
+{
+const_cast(rShapePtr) = std::make_shared();
+}
+
+return rShapePtr.get();
+}
+
 DiagramData::DiagramData() :
 mpFillProperties( std::make_shared() )
 {
@@ -79,7 +96,7 @@ void DiagramData::dump() const
 
 SAL_INFO("oox.drawingml", "Dgm: DiagramData # of pt: " << maPoints.size() 
);
 for (const auto& rPoint : maPoints)
-rPoint.dump();
+rPoint.dump(getOrCreateAssociatedShape(rPoint));
 }
 
 void DiagramData::getChildrenString(OUStringBuffer& rBuf, const dgm::Point* 
pPoint, sal_Int32 nLevel) const
@@ -87,13 +104,18 @@ void DiagramData::getChildrenString(OUStringBuffer& rBuf, 
const dgm::Point* pPoi
 if (!pPoint)
 return;
 
+Shape* pShape(getOrCreateAssociatedShape(*pPoint));
+if(!pShape)
+return;
+
 if (nLevel > 0)
 {
 for (sal_Int32 i = 0; i < nLevel-1; i++)
 rBuf.append('\t');
 rBuf.append('+');
 rBuf.append(' ');
-rBuf.append(pPoint->mpShape->getTextBody()->toString());
+if(pShape->getTextBody())
+rBuf.append(pShape->getTextBody()->toString());
 rBuf.append('\n');
 }
 
@@ -131,9 +153,12 @@ std::vector> 
DiagramData::getChildren(const OUStri
 aChildren.resize(rCxn.mnSourceOrder + 1);
 const auto pChild = maPointNameMap.find(rCxn.msDestId);
 if (pChild != maPointNameMap.end())
+{
+Shape* 

[Libreoffice-commits] core.git: include/oox oox/source

2022-02-24 Thread Caolán McNamara (via logerrit)
 include/oox/drawingml/drawingmltypes.hxx |1 +
 oox/source/drawingml/diagram/diagram.hxx |4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 76e11015a877da0eee21bb97b84a0f17bce41760
Author: Caolán McNamara 
AuthorDate: Wed Feb 23 09:57:59 2022 +
Commit: Caolán McNamara 
CommitDate: Thu Feb 24 10:12:59 2022 +0100

tdf#147609 and ofz#44965 Indirect-leak

Change-Id: I2fb89bf68d8df2da1b97942d70c386f62f61c64f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130413
Tested-by: Jenkins
Reviewed-by: Armin Le Grand 
Reviewed-by: Caolán McNamara 

diff --git a/include/oox/drawingml/drawingmltypes.hxx 
b/include/oox/drawingml/drawingmltypes.hxx
index 7f7aab4ef7d1..5fe86d56439e 100644
--- a/include/oox/drawingml/drawingmltypes.hxx
+++ b/include/oox/drawingml/drawingmltypes.hxx
@@ -76,6 +76,7 @@ typedef std::shared_ptr< TextListStyle > TextListStylePtr;
 
 class Shape;
 typedef std::shared_ptr< Shape > ShapePtr;
+typedef std::weak_ptr< Shape > WeakShapePtr;
 
 class Theme;
 typedef std::shared_ptr< Theme > ThemePtr;
diff --git a/oox/source/drawingml/diagram/diagram.hxx 
b/oox/source/drawingml/diagram/diagram.hxx
index 6aad2705f264..f9f2b7d8a05a 100644
--- a/oox/source/drawingml/diagram/diagram.hxx
+++ b/oox/source/drawingml/diagram/diagram.hxx
@@ -149,10 +149,10 @@ public:
 void addTo( const ShapePtr & pShape );
 
 css::uno::Sequence getDomsAsPropertyValues() 
const;
-const ShapePtr & getShape() const { return mpShape; }
+ShapePtr getShape() const { return mpShape.lock(); }
 
 private:
-ShapePtr mpShape;
+WeakShapePtr mpShape;
 DiagramDataPtr mpData;
 DiagramLayoutPtr   mpLayout;
 DiagramQStyleMap   maStyles;


[Libreoffice-commits] core.git: include/oox oox/source sc/source

2022-02-05 Thread Tomaž Vajngerl (via logerrit)
 include/oox/ole/vbamodule.hxx   |   11 +--
 oox/source/ole/vbamodule.cxx|2 +-
 sc/source/ui/vba/vbaapplication.cxx |7 ++-
 3 files changed, 16 insertions(+), 4 deletions(-)

New commits:
commit 6ed0ffe9177ff6851e1b1e338dd92f81e7987f57
Author: Tomaž Vajngerl 
AuthorDate: Wed Feb 2 15:20:13 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sun Feb 6 06:49:15 2022 +0100

vba: small fixes for GetOpenFilename and documenting structs

Check the XFileDialogSelectedItems is using the expected impl.
after dynamic_casting.

Rename VbaKeyBinding to VbaMacroKeyAndMethodBinding and document
the struct.

Change-Id: Ica4b24fed3013c5efa97a14e98bf9bdc2c74b68d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129320
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/oox/ole/vbamodule.hxx b/include/oox/ole/vbamodule.hxx
index 3028136375bc..4cbb4a41c948 100644
--- a/include/oox/ole/vbamodule.hxx
+++ b/include/oox/ole/vbamodule.hxx
@@ -40,9 +40,14 @@ namespace oox {
 
 namespace oox::ole {
 
-struct VbaKeyBinding
+/** Stores, which key shortcut maps to which VBA macro method. */
+struct VbaMacroKeyAndMethodBinding
 {
+// This describes a key combinaton in "raw" VBA Macro form, that
+// still needs translated to a key event that can be used in
+// LibreOffice.
 OUString msApiKey;
+// The name of the macro method
 OUString msMethodName;
 };
 
@@ -105,7 +110,9 @@ private:
 boolmbReadOnly;
 boolmbPrivate;
 boolmbExecutable;
-std::vector maKeyBindings;
+
+/** Keys and VBA macro method bindings */
+std::vector maKeyBindings;
 };
 
 
diff --git a/oox/source/ole/vbamodule.cxx b/oox/source/ole/vbamodule.cxx
index 0fc9609653f3..d53e525989e6 100644
--- a/oox/source/ole/vbamodule.cxx
+++ b/oox/source/ole/vbamodule.cxx
@@ -136,7 +136,7 @@ void VbaModule::createAndImportModule( StorageBase& 
rVbaStrg,
 
 void VbaModule::registerShortcutKeys()
 {
-for (VbaKeyBinding const& rKeyBinding : maKeyBindings)
+for (VbaMacroKeyAndMethodBinding const& rKeyBinding : maKeyBindings)
 {
 try
 {
diff --git a/sc/source/ui/vba/vbaapplication.cxx 
b/sc/source/ui/vba/vbaapplication.cxx
index f11ee6f21bbe..7b68047d0b80 100644
--- a/sc/source/ui/vba/vbaapplication.cxx
+++ b/sc/source/ui/vba/vbaapplication.cxx
@@ -358,7 +358,7 @@ uno::Any SAL_CALL
 ScVbaApplication::GetOpenFilename(const uno::Any& /*aFileFilter*/, const 
uno::Any& /*aFilterIndex*/, const uno::Any& aTitle, const uno::Any& 
/*aButtonText*/, const uno::Any& aMultiSelect)
 {
 // TODO - take all parameters into account
-auto xDialog = uno::Reference (new ScVbaFileDialog( 
this, mxContext, office::MsoFileDialogType::msoFileDialogFilePicker));
+uno::Reference xDialog(new ScVbaFileDialog(this, 
mxContext, office::MsoFileDialogType::msoFileDialogFilePicker));
 xDialog->setTitle(aTitle);
 xDialog->setAllowMultiSelect(aMultiSelect);
 
@@ -373,6 +373,11 @@ ScVbaApplication::GetOpenFilename(const uno::Any& 
/*aFileFilter*/, const uno::An
 
 uno::Reference xItems = 
xDialog->getSelectedItems();
 auto* pItems = dynamic_cast(xItems.get());
+
+// Check, if the implementation of XFileDialogSelectedItems is what we 
expect
+if (!pItems)
+throw uno::RuntimeException("Unexpected XFileDialogSelectedItems 
implementation");
+
 auto const & rItemVector = pItems->getItems();
 
 if (!bMultiSelect) // only 1 selection allowed - return path


[Libreoffice-commits] core.git: include/oox oox/source sw/qa

2022-02-03 Thread Attila Bakos (NISZ) (via logerrit)
 include/oox/drawingml/shape.hxx  |3 +
 oox/source/drawingml/shape.cxx   |   42 +++
 oox/source/shape/WpgContext.hxx  |2 -
 oox/source/shape/WpsContext.cxx  |   43 +++
 oox/source/shape/WpsContext.hxx  |1 
 sw/qa/extras/ooxmlexport/data/WPGbodyPr.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx   |   49 +++
 7 files changed, 139 insertions(+), 1 deletion(-)

New commits:
commit 65b09ef1c5e24651579eb11900cf2ddbbb7b0971
Author: Attila Bakos (NISZ) 
AuthorDate: Mon Jan 24 10:57:34 2022 +0100
Commit: László Németh 
CommitDate: Thu Feb 3 09:28:52 2022 +0100

tdf#146803 tdf#146805 OOXML import: fix bodyPr at grouped shapes

Grouped text boxes (WPG) lost their alignment and spacing,
because the bodyPr tag what has the information for this,
processed after the textbox content, and applied to the XShape
which in case of group shape is not ready. To solve this, the
mentioned properties read for the shape member after copied
to the XShape when its ready, and than synced to the textbox.

Regression from commit 121cbc250b36290f0f8c7265fea57256dad69553
"tdf#66039 DOCX: import textboxes (with tables, images etc.) in
group shapes".

Change-Id: Ifb5e8bde58613137441bec2e2b51bc67118dab40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128854
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index 57a47cbdb4e5..40c8319f67d3 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -205,6 +205,8 @@ public:
 const Color&getFontRefColorForNodes() const { return 
maFontRefColorForNodes; }
 voidsetLockedCanvas(bool bLockedCanvas);
 boolgetLockedCanvas() const { return mbLockedCanvas;}
+voidsetWPGChild(bool bWPG);
+boolisWPGChild() const { return mbWPGChild;}
 voidsetWps(bool bWps);
 boolgetWps() const { return mbWps;}
 voidsetTextBox(bool bTextBox);
@@ -360,6 +362,7 @@ private:
  // we need separate 
flag because we don't want
  // to propagate it 
when applying reference shape
 boolmbLocked;
+bool mbWPGChild; // Is this shape a child of a WPG shape?
 bool mbLockedCanvas; ///< Is this shape part of a locked canvas?
 bool mbWps; ///< Is this a wps shape?
 bool mbTextBox; ///< This shape has a textbox.
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index f7161e01291f..b1335add 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -134,6 +134,7 @@ Shape::Shape( const char* pServiceName, bool bDefaultHeight 
)
 , mbHidden( false )
 , mbHiddenMasterShape( false )
 , mbLocked( false )
+, mbWPGChild(false)
 , mbLockedCanvas( false )
 , mbWps( false )
 , mbTextBox( false )
@@ -176,6 +177,7 @@ Shape::Shape( const ShapePtr& pSourceShape )
 , mbHidden( pSourceShape->mbHidden )
 , mbHiddenMasterShape( pSourceShape->mbHiddenMasterShape )
 , mbLocked( pSourceShape->mbLocked )
+, mbWPGChild( pSourceShape->mbWPGChild )
 , mbLockedCanvas( pSourceShape->mbLockedCanvas )
 , mbWps( pSourceShape->mbWps )
 , mbTextBox( pSourceShape->mbTextBox )
@@ -292,6 +294,41 @@ void Shape::addShape(
 if ( xShapes.is() )
 addChildren( rFilterBase, *this, pTheme, xShapes, pShapeMap, 
aMatrix );
 
+if (isWPGChild() && xShape)
+{
+// This is a wps shape and it is the child of the WPG, now 
copy the
+// the text body properties to the xshape.
+Reference xChildWPSProperties(xShape, 
uno::UNO_QUERY);
+
+if (getTextBody() && xChildWPSProperties)
+{
+xChildWPSProperties->setPropertyValue(
+UNO_NAME_TEXT_VERTADJUST,
+uno::Any(getTextBody()->getTextProperties().meVA));
+
+xChildWPSProperties->setPropertyValue(
+UNO_NAME_TEXT_LEFTDIST,
+
uno::Any(getTextBody()->getTextProperties().moInsets[0].has_value()
+ ? 
*getTextBody()->getTextProperties().moInsets[0]
+ : 0));
+xChildWPSProperties->setPropertyValue(
+UNO_NAME_TEXT_UPPERDIST,
+
uno::Any(getTextBody()->getTextProperties().moInsets[1].has_value()
+ ? 
*getTextBody()->getTextProperties().moInsets[1]
+ : 0));
+

[Libreoffice-commits] core.git: include/oox oox/source sw/qa writerfilter/source

2022-02-03 Thread Attila Bakos (NISZ) (via logerrit)
 include/oox/shape/ShapeContextHandler.hxx |   18 +++---
 oox/source/shape/ShapeContextHandler.cxx  |   31 +++---
 sw/qa/extras/ooxmlexport/data/tdf146802.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx|   13 +++
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |5 +-
 5 files changed, 48 insertions(+), 19 deletions(-)

New commits:
commit 4a38ca4035ac03571925e72cb47e0beb8da2003a
Author: Attila Bakos (NISZ) 
AuthorDate: Wed Jan 19 17:43:54 2022 +0100
Commit: László Németh 
CommitDate: Thu Feb 3 09:12:20 2022 +0100

tdf#146802 OOXML import: fix embedded VML in grouped textbox

E.g. OLE formulas inside them broke document load.

Regression from 121cbc250b36290f0f8c7265fea57256dad69553
"tdf#66039 DOCX: import textboxes (with tables, images etc.)
in group shapes".

Note: now embedded VML OLE is loaded in WPG shapes, thanks to
that the ShapeHandler in oox/ has a stack having the start
token inside for each shape.

Change-Id: I973d78ed88c5c83efffd9629061e2a2c6fdd25e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128627
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/shape/ShapeContextHandler.hxx 
b/include/oox/shape/ShapeContextHandler.hxx
index 27b70d2cf2c4..a245224730ed 100644
--- a/include/oox/shape/ShapeContextHandler.hxx
+++ b/include/oox/shape/ShapeContextHandler.hxx
@@ -19,6 +19,7 @@
 #pragma once
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -90,12 +91,15 @@ public:
 void setRelationFragmentPath(const OUString & the_value);
 
 sal_Int32 getStartToken() const;
-void setStartToken( sal_Int32 _starttoken );
+void popStartToken();
+void pushStartToken( sal_Int32 _starttoken );
 
 void setPosition(const css::awt::Point& rPosition);
 
-const bool& getFullWPGSupport() { return m_bFullWPGSUpport; };
-void setFullWPGSupport(const bool& rbUse) { m_bFullWPGSUpport = rbUse; };
+const bool& getFullWPGSupport() { return m_bFullWPGSUpport; }
+void setFullWPGSupport(const bool& rbUse) { m_bFullWPGSUpport = rbUse; }
+
+bool isWordProcessingGroupShape() const { return mxWpgContext ? true : 
false; }
 
 void setDocumentProperties(const 
css::uno::Reference& xDocProps);
 void setMediaDescriptor(const 
css::uno::Sequence& rMediaDescriptor);
@@ -109,9 +113,13 @@ private:
 ShapeContextHandler(ShapeContextHandler const &) = delete;
 void operator =(ShapeContextHandler const &) = delete;
 
-::sal_uInt32 mnStartToken;
+// Special stack which always has at least one element.
+// In case of group shapes with embedded content it will have more element 
than one.
+std::stack mnStartTokenStack;
+
 css::awt::Point maPosition;
-bool m_bFullWPGSUpport;
+bool m_bFullWPGSUpport; // Is this DrawingML shape supposed to be 
proccessed as WPG?
+
 drawingml::ShapePtr mpShape;
 std::shared_ptr< vml::Drawing > mpDrawing;
 
diff --git a/oox/source/shape/ShapeContextHandler.cxx 
b/oox/source/shape/ShapeContextHandler.cxx
index 6eb9e5ce9083..cacd46d82d14 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -44,7 +44,6 @@ using namespace core;
 using namespace drawingml;
 
 ShapeContextHandler::ShapeContextHandler(const 
rtl::Reference& xFilterBase) :
-  mnStartToken(0),
   m_bFullWPGSUpport(false),
   mxShapeFilterBase(xFilterBase)
 
@@ -225,8 +224,9 @@ uno::Reference
 ShapeContextHandler::getContextHandler(sal_Int32 nElement)
 {
 uno::Reference xResult;
+const sal_uInt32 nStartToken = getStartToken();
 
-switch (getNamespace( mnStartToken ))
+switch (getNamespace( nStartToken ))
 {
 case NMSP_doc:
 case NMSP_vml:
@@ -236,19 +236,19 @@ ShapeContextHandler::getContextHandler(sal_Int32 nElement)
 xResult.set(getDiagramShapeContext());
 break;
 case NMSP_dmlLockedCanvas:
-xResult.set(getLockedCanvasContext(mnStartToken));
+xResult.set(getLockedCanvasContext(nStartToken));
 break;
 case NMSP_dmlChart:
-xResult.set(getChartShapeContext(mnStartToken));
+xResult.set(getChartShapeContext(nStartToken));
 break;
 case NMSP_wps:
-xResult.set(getWpsContext(mnStartToken, nElement));
+xResult.set(getWpsContext(nStartToken, nElement));
 break;
 case NMSP_wpg:
-xResult.set(getWpgContext(mnStartToken));
+xResult.set(getWpgContext(nStartToken));
 break;
 default:
-xResult.set(getGraphicShapeContext(mnStartToken));
+xResult.set(getGraphicShapeContext(nStartToken));
 break;
 }
 
@@ -456,7 +456,7 @@ ShapeContextHandler::getShape()
 //NMSP_dmlChart == getNamespace( mnStartToken ) check is introduced to 
make sure that
 

[Libreoffice-commits] core.git: include/oox oox/source sw/qa writerfilter/source

2022-01-03 Thread Attila Bakos (NISZ) (via logerrit)
 include/oox/shape/ShapeContextHandler.hxx |5 +-
 oox/source/drawingml/shape.cxx|2 
 oox/source/shape/ShapeContextHandler.cxx  |8 ++-
 oox/source/shape/WpgContext.cxx   |   45 +-
 oox/source/shape/WpgContext.hxx   |8 ++-
 sw/qa/extras/ooxmlexport/data/testWPGtextboxes.docx   |binary
 sw/qa/extras/ooxmlexport/ooxmlexport10.cxx|   21 
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx |7 +-
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx |2 
 sw/qa/extras/ooxmlexport/ooxmlexport6.cxx |4 -
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx |7 +-
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx |7 ++
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |4 +
 13 files changed, 92 insertions(+), 28 deletions(-)

New commits:
commit 2951cbdf3a6e2b62461665546b47e1d253fcb834
Author: Attila Bakos (NISZ) 
AuthorDate: Wed Nov 10 14:10:11 2021 +0100
Commit: László Németh 
CommitDate: Mon Jan 3 14:28:15 2022 +0100

tdf#143574 OOXML export/import of textboxes in group shapes

In this part, oox module has been modified in order to prepare
for WPG handling during OOXML import. Note: Wpg is the drawingML
equivalent of v:group, supporting text boxes in the group.

1) Added new parameter for WpgContext to support nested
Wpg shapes, and WPS enabled for the WPG member shapes.

2) A bug has fixed, where group member line shape and
connector shapes have wrong positions before in the group.

3) Unit tests had to be modified, and 3 of them disabled
temporarily due to missing Writerfilter implementation (what
will be the next commit)

Now group shapes can have textboxes and the text is imported
for that, but complex content is still missing (this will be
fixed in writerfilter by the next commit).

Known issue: WPG shapes with textboxes in floating table
have issues during import at floating table conversion, so until
this is not fixed this function is disabled for shapes in tables
(will be fixed a follow-up commit later).

Follow-up to commit 19394a924fdc486202ca27e318385287eb0df26f
"tdf#143574 sw: textboxes in group shapes -- part 4".

Change-Id: I71032187697807087bd8f27f7c3a7b052e174bd7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124964
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/shape/ShapeContextHandler.hxx 
b/include/oox/shape/ShapeContextHandler.hxx
index 934ea374fd7c..27b70d2cf2c4 100644
--- a/include/oox/shape/ShapeContextHandler.hxx
+++ b/include/oox/shape/ShapeContextHandler.hxx
@@ -94,6 +94,9 @@ public:
 
 void setPosition(const css::awt::Point& rPosition);
 
+const bool& getFullWPGSupport() { return m_bFullWPGSUpport; };
+void setFullWPGSupport(const bool& rbUse) { m_bFullWPGSUpport = rbUse; };
+
 void setDocumentProperties(const 
css::uno::Reference& xDocProps);
 void setMediaDescriptor(const 
css::uno::Sequence& rMediaDescriptor);
 
@@ -108,7 +111,7 @@ private:
 
 ::sal_uInt32 mnStartToken;
 css::awt::Point maPosition;
-
+bool m_bFullWPGSUpport;
 drawingml::ShapePtr mpShape;
 std::shared_ptr< vml::Drawing > mpDrawing;
 
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 78a27f8a0c9c..fd9eb691b2e8 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1531,7 +1531,7 @@ Reference< XShape > const & Shape::createAndInsert(
 // These can have a custom geometry, so position should be set here,
 // after creation but before custom shape handling, using the position
 // we got from the caller.
-if (mbWps && aServiceName == "com.sun.star.drawing.LineShape")
+if (mbWps && aServiceName == "com.sun.star.drawing.LineShape" && 
!pParentGroupShape)
 mxShape->setPosition(maPosition);
 
 if( bIsCustomShape )
diff --git a/oox/source/shape/ShapeContextHandler.cxx 
b/oox/source/shape/ShapeContextHandler.cxx
index 5404cc82fe81..3454c0e03f87 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -47,7 +47,9 @@ using namespace drawingml;
 
 ShapeContextHandler::ShapeContextHandler(const 
rtl::Reference& xFilterBase) :
   mnStartToken(0),
+  m_bFullWPGSUpport(false),
   mxShapeFilterBase(xFilterBase)
+
 {
 }
 
@@ -139,8 +141,12 @@ uno::Reference const & 
ShapeContextHandler::getWp
 switch (getBaseToken(nElement))
 {
 case XML_wgp:
-mxWpgContext.set(static_cast(new 
WpgContext(*rFragmentHandler)));
+{
+rtl::Reference rContext = new 
WpgContext(*rFragmentHandler, oox::drawingml::ShapePtr());
+rContext->setFullWPGSupport(m_bFullWPGSUpport);
+

[Libreoffice-commits] core.git: include/oox oox/source sd/qa

2021-12-03 Thread Tibor Nagy (via logerrit)
 include/oox/export/drawingml.hxx   |2 +-
 oox/source/export/drawingml.cxx|   11 +--
 sd/qa/unit/data/odp/tdf129430.odp  |binary
 sd/qa/unit/export-tests-ooxml3.cxx |   15 +++
 4 files changed, 25 insertions(+), 3 deletions(-)

New commits:
commit fc1e5202cbfb36b28b0e597811f39895c19ae6ba
Author: Tibor Nagy 
AuthorDate: Fri Nov 19 12:36:42 2021 +0100
Commit: László Németh 
CommitDate: Fri Dec 3 15:52:50 2021 +0100

tdf#129430 PPTX export: fix workaround for "At least" line spacing

to avoid bad overlapping lines.

PPTX does not have the option "At least", so line spacing
with this setting is converted to fixed line spacing.
Improve this workaround to use single line spacing, if the
"At least" value is lower than the size of the characters,
like "At least" is handled by Impress.

Change-Id: I29b41225d48fd9a447e7f6ef3a8a7cc7ba9ef354
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125553
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 516287293580..b71490752708 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -262,7 +262,7 @@ public:
 void WriteXGraphicStretch(css::uno::Reference 
const & rXPropSet,
   css::uno::Reference 
const & rxGraphic);
 
-void WriteLinespacing( const css::style::LineSpacing& rLineSpacing );
+void WriteLinespacing(const css::style::LineSpacing& rLineSpacing, float 
fFirstCharHeight);
 
 OUString WriteXGraphicBlip(css::uno::Reference 
const & rXPropSet,
css::uno::Reference 
const & rxGraphic,
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 7217efe0e5c9..0c8235a3a1da 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2894,13 +2894,20 @@ const char* DrawingML::GetAlignment( 
style::ParagraphAdjust nAlignment )
 return sAlignment;
 }
 
-void DrawingML::WriteLinespacing( const LineSpacing& rSpacing )
+void DrawingML::WriteLinespacing(const LineSpacing& rSpacing, float 
fFirstCharHeight)
 {
 if( rSpacing.Mode == LineSpacingMode::PROP )
 {
 mpFS->singleElementNS( XML_a, XML_spcPct,
XML_val, 
OString::number(static_cast(rSpacing.Height)*1000));
 }
+else if (rSpacing.Mode == LineSpacingMode::MINIMUM
+ && fFirstCharHeight > static_cast(rSpacing.Height) * 0.001 
* 72.0 / 2.54)
+{
+// 100% proportional line spacing = single line spacing
+mpFS->singleElementNS(XML_a, XML_spcPct, XML_val,
+  OString::number(static_cast(10)));
+}
 else
 {
 mpFS->singleElementNS( XML_a, XML_spcPts,
@@ -2988,7 +2995,7 @@ bool DrawingML::WriteParagraphProperties( const 
Reference< XTextContent >& rPara
 if( bHasLinespacing )
 {
 mpFS->startElementNS(XML_a, XML_lnSpc);
-WriteLinespacing( aLineSpacing );
+WriteLinespacing(aLineSpacing, fFirstCharHeight);
 mpFS->endElementNS( XML_a, XML_lnSpc );
 }
 
diff --git a/sd/qa/unit/data/odp/tdf129430.odp 
b/sd/qa/unit/data/odp/tdf129430.odp
new file mode 100644
index ..f5304f75cf26
Binary files /dev/null and b/sd/qa/unit/data/odp/tdf129430.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml3.cxx 
b/sd/qa/unit/export-tests-ooxml3.cxx
index 900716e20093..375922511661 100644
--- a/sd/qa/unit/export-tests-ooxml3.cxx
+++ b/sd/qa/unit/export-tests-ooxml3.cxx
@@ -51,6 +51,7 @@
 class SdOOXMLExportTest3 : public SdModelTestBaseXML
 {
 public:
+void testTdf129430();
 void testTdf114848();
 void testTdf68759();
 void testTdf127901();
@@ -125,6 +126,7 @@ public:
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest3);
 
+CPPUNIT_TEST(testTdf129430);
 CPPUNIT_TEST(testTdf114848);
 CPPUNIT_TEST(testTdf68759);
 CPPUNIT_TEST(testTdf127901);
@@ -203,6 +205,19 @@ public:
 }
 };
 
+void SdOOXMLExportTest3::testTdf129430()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf129430.odp"), 
ODP);
+utl::TempFile tempFile;
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+xDocShRef->DoClose();
+
+xmlDocUniquePtr pXmlDoc1 = parseExport(tempFile, "ppt/slides/slide1.xml");
+assertXPath(pXmlDoc1, 
"/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p[2]/a:pPr/a:lnSpc/a:spcPct",
+"val", "10");
+}
+
 void SdOOXMLExportTest3::testTdf114848()
 {
 ::sd::DrawDocShellRef xDocShRef


[Libreoffice-commits] core.git: include/oox oox/source

2021-11-17 Thread Sarper Akdemir (via logerrit)
 include/oox/drawingml/color.hxx  |1 +
 oox/source/drawingml/color.cxx   |   16 
 oox/source/drawingml/textcharacterproperties.cxx |1 +
 3 files changed, 18 insertions(+)

New commits:
commit 3ed69deb04cca67e377c15956679f7bb9794e4ff
Author: Sarper Akdemir 
AuthorDate: Wed Aug 25 02:24:42 2021 +0300
Commit: Miklos Vajna 
CommitDate: Thu Nov 18 08:08:14 2021 +0100

implement color tint or shade import for pptx

[ Miklos: althought the PowerPoint UI doesn't seem to have a way to
generate this markup. ]

(cherry picked from commit de40c940c3a94588d44a3d1f6d8cd4191cca4f73)

Change-Id: Ibf98ba335b10859e4d6d702263f09e6ba2033bff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125426
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/include/oox/drawingml/color.hxx b/include/oox/drawingml/color.hxx
index 00473cfe6f27..bd67982c6e92 100644
--- a/include/oox/drawingml/color.hxx
+++ b/include/oox/drawingml/color.hxx
@@ -99,6 +99,7 @@ public:
 /** Returns the scheme name from the a:schemeClr element for 
interoperability purposes */
 const OUString& getSchemeColorName() const { return msSchemeName; }
 sal_Int16   getSchemeColorIndex() const;
+sal_Int16   getTintOrShade();
 
 /** Returns the unaltered list of transformations for interoperability 
purposes */
 const css::uno::Sequence< css::beans::PropertyValue >& 
getTransformations() const { return maInteropTransformations;}
diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx
index 2ced5345904e..426197102160 100644
--- a/oox/source/drawingml/color.cxx
+++ b/oox/source/drawingml/color.cxx
@@ -479,6 +479,22 @@ void Color::clearTransparence()
 mnAlpha = MAX_PERCENT;
 }
 
+sal_Int16 Color::getTintOrShade()
+{
+for(auto const& aTransform : maTransforms)
+{
+switch(aTransform.mnToken)
+{
+case XML_tint:
+// from 1000th percent to 100th percent...
+return aTransform.mnValue/10;
+case XML_shade:
+// from 1000th percent to 100th percent...
+return -aTransform.mnValue/10;
+}
+}
+return 0;
+}
 ::Color Color::getColor( const GraphicHelper& rGraphicHelper, ::Color nPhClr ) 
const
 {
 const sal_Int32 nTempC1 = mnC1;
diff --git a/oox/source/drawingml/textcharacterproperties.cxx 
b/oox/source/drawingml/textcharacterproperties.cxx
index 90b0e38c1d3a..bd4d051a490b 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -113,6 +113,7 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& 
rPropMap, const XmlFil
 rPropMap.setProperty(PROP_CharColor, 
aColor.getColor(rFilter.getGraphicHelper()));
 // set color theme index
 rPropMap.setProperty(PROP_CharColorTheme, 
aColor.getSchemeColorIndex());
+rPropMap.setProperty(PROP_CharColorTintOrShade, 
aColor.getTintOrShade());
 
 if (aColor.hasTransparency())
 {


[Libreoffice-commits] core.git: include/oox oox/source

2021-11-17 Thread Sarper Akdemir (via logerrit)
 include/oox/drawingml/color.hxx  |4 ++--
 oox/source/drawingml/color.cxx   |2 +-
 oox/source/drawingml/shape.cxx   |   14 +++---
 oox/source/drawingml/shape3dproperties.cxx   |2 +-
 oox/source/drawingml/textcharacterproperties.cxx |2 +-
 5 files changed, 12 insertions(+), 12 deletions(-)

New commits:
commit 9acb80943da5aaaf5d515a794f8a825d88bda430
Author: Sarper Akdemir 
AuthorDate: Tue Aug 24 23:58:35 2021 +0300
Commit: Miklos Vajna 
CommitDate: Wed Nov 17 19:58:01 2021 +0100

rename getSchemeName getSchemeIndex to remove ambiguity

[ Miklos: i.e. index could be a theme index or an index into a color
set, this one is the later case. ]

(cherry picked from commit aef22c3bbf1b4bb8ab9ba2bccb7005e0d0c75cb3,
from the feature/themesupport2 branch)

Conflicts:
oox/source/drawingml/shape.cxx
oox/source/drawingml/shape3dproperties.cxx

Change-Id: I495e4b39975f1483607972ccbcc9348021710519
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125414
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/include/oox/drawingml/color.hxx b/include/oox/drawingml/color.hxx
index f213dba9a973..00473cfe6f27 100644
--- a/include/oox/drawingml/color.hxx
+++ b/include/oox/drawingml/color.hxx
@@ -97,8 +97,8 @@ public:
 sal_Int16   getTransparency() const;
 
 /** Returns the scheme name from the a:schemeClr element for 
interoperability purposes */
-const OUString& getSchemeName() const { return msSchemeName; }
-sal_Int16   getSchemeIndex() const;
+const OUString& getSchemeColorName() const { return msSchemeName; }
+sal_Int16   getSchemeColorIndex() const;
 
 /** Returns the unaltered list of transformations for interoperability 
purposes */
 const css::uno::Sequence< css::beans::PropertyValue >& 
getTransformations() const { return maInteropTransformations;}
diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx
index 9f4026727b56..2ced5345904e 100644
--- a/oox/source/drawingml/color.cxx
+++ b/oox/source/drawingml/color.cxx
@@ -661,7 +661,7 @@ sal_Int16 Color::getTransparency() const
 return sal_Int16(std::round( (1.0 * (MAX_PERCENT - mnAlpha)) / 
PER_PERCENT) );
 }
 
-sal_Int16 Color::getSchemeIndex() const
+sal_Int16 Color::getSchemeColorIndex() const
 {
 static std::map const aSchemeColorNameToIndex{
 { "dk1", 0 }, { "lt1", 1 }, { "dk2", 2 }, { "lt2", 3 },
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 69bf775ee5da..1f1d430e241d 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1064,7 +1064,7 @@ Reference< XShape > const & Shape::createAndInsert(
 // Store style-related properties to InteropGrabBag to be able 
to export them back
 uno::Sequence aProperties = 
comphelper::InitPropertySequence(
 {
-{"SchemeClr", 
uno::makeAny(pLineRef->maPhClr.getSchemeName())},
+{"SchemeClr", 
uno::makeAny(pLineRef->maPhClr.getSchemeColorName())},
 {"Idx", uno::makeAny(pLineRef->mnThemedIdx)},
 {"Color", uno::makeAny(nLinePhClr)},
 {"LineStyle", 
uno::makeAny(aLineProperties.getLineStyle())},
@@ -1082,7 +1082,7 @@ Reference< XShape > const & Shape::createAndInsert(
 nFillPhClr = pFillRef->maPhClr.getColor(rGraphicHelper);
 }
 
-OUString sColorScheme = pFillRef->maPhClr.getSchemeName();
+OUString sColorScheme = pFillRef->maPhClr.getSchemeColorName();
 if( !sColorScheme.isEmpty() )
 {
 uno::Sequence aProperties = 
comphelper::InitPropertySequence(
@@ -1104,7 +1104,7 @@ Reference< XShape > const & Shape::createAndInsert(
 // Store style-related properties to InteropGrabBag to be able 
to export them back
 uno::Sequence aProperties = 
comphelper::InitPropertySequence(
 {
-{"SchemeClr", 
uno::makeAny(pEffectRef->maPhClr.getSchemeName())},
+{"SchemeClr", 
uno::makeAny(pEffectRef->maPhClr.getSchemeColorName())},
 {"Idx", uno::makeAny(pEffectRef->mnThemedIdx)},
 {"Transformations", 
uno::makeAny(pEffectRef->maPhClr.getTransformations())}
 });
@@ -1356,13 +1356,13 @@ Reference< XShape > const & Shape::createAndInsert(
 comphelper::makePropertyValue("OriginalSolidFillClr", 
aShapeProps.getProperty(PROP_FillColor)),
 comphelper::makePropertyValue("OriginalLnSolidFillClr", 
aShapeProps.getProperty(PROP_LineColor))
 };
-OUString sColorFillScheme = 
aFillProperties.maFillColor.getSchemeName();
+OUString sColorFillScheme = 

[Libreoffice-commits] core.git: include/oox oox/source

2021-11-17 Thread Sarper Akdemir (via logerrit)
 include/oox/drawingml/color.hxx  |2 ++
 oox/source/drawingml/color.cxx   |   15 +++
 oox/source/drawingml/textcharacterproperties.cxx |2 ++
 oox/source/token/properties.txt  |2 ++
 4 files changed, 21 insertions(+)

New commits:
commit f394e2519c99cd1514c859cda67b1c09e68e6c19
Author: Sarper Akdemir 
AuthorDate: Fri Aug 20 00:45:55 2021 +0300
Commit: Miklos Vajna 
CommitDate: Wed Nov 17 18:00:39 2021 +0100

implement initial pptx theme color import

[ Miklos: this only handles colors as-is, without any effects. ]

(cherry picked from commit ec68ca0b5fb6773f42600f6a5825b4794cdb0990,
from the feature/themesupport2 branch)
Change-Id: I89890cf7ba6ec758698011752b63d7a60872bef2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125404
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/include/oox/drawingml/color.hxx b/include/oox/drawingml/color.hxx
index 59f417cfac52..f213dba9a973 100644
--- a/include/oox/drawingml/color.hxx
+++ b/include/oox/drawingml/color.hxx
@@ -98,6 +98,8 @@ public:
 
 /** Returns the scheme name from the a:schemeClr element for 
interoperability purposes */
 const OUString& getSchemeName() const { return msSchemeName; }
+sal_Int16   getSchemeIndex() const;
+
 /** Returns the unaltered list of transformations for interoperability 
purposes */
 const css::uno::Sequence< css::beans::PropertyValue >& 
getTransformations() const { return maInteropTransformations;}
 
diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx
index 3c9ac2f6ac44..9f4026727b56 100644
--- a/oox/source/drawingml/color.cxx
+++ b/oox/source/drawingml/color.cxx
@@ -661,6 +661,21 @@ sal_Int16 Color::getTransparency() const
 return sal_Int16(std::round( (1.0 * (MAX_PERCENT - mnAlpha)) / 
PER_PERCENT) );
 }
 
+sal_Int16 Color::getSchemeIndex() const
+{
+static std::map const aSchemeColorNameToIndex{
+{ "dk1", 0 }, { "lt1", 1 }, { "dk2", 2 }, { "lt2", 3 },
+{ "accent1", 4 }, { "accent2", 5 }, { "accent3", 6 }, { "accent4", 7 },
+{ "accent5", 8 }, { "accent6", 9 }, { "hlink", 10 },  { "folHlink", 11 
}
+};
+
+auto aIt = aSchemeColorNameToIndex.find(msSchemeName);
+if( aIt == aSchemeColorNameToIndex.end() )
+return -1;
+else
+return aIt->second;
+}
+
 // private 
 
 void Color::setResolvedRgb( ::Color nRgb ) const
diff --git a/oox/source/drawingml/textcharacterproperties.cxx 
b/oox/source/drawingml/textcharacterproperties.cxx
index 4eb5acaffb56..9cbc331d05fa 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -111,6 +111,8 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& 
rPropMap, const XmlFil
 {
 Color aColor = maFillProperties.getBestSolidColor();
 rPropMap.setProperty(PROP_CharColor, 
aColor.getColor(rFilter.getGraphicHelper()));
+// set color theme index
+rPropMap.setProperty(PROP_CharColorTheme, aColor.getSchemeIndex());
 
 if (aColor.hasTransparency())
 {
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 2c56d0f46804..951a03e7eba0 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -54,6 +54,8 @@ CharBackColor
 CharCaseMap
 CharColor
 CharContoured
+CharColorTheme
+CharColorTintOrShade
 CharEscapement
 CharEscapementHeight
 CharFontCharSet


[Libreoffice-commits] core.git: include/oox oox/source

2021-11-15 Thread Stephan Bergmann (via logerrit)
 include/oox/drawingml/shape.hxx |2 ++
 include/oox/drawingml/theme.hxx |3 ---
 oox/source/drawingml/theme.cxx  |8 
 3 files changed, 2 insertions(+), 11 deletions(-)

New commits:
commit 829ea811e19fead7ad35049342136b592077674b
Author: Stephan Bergmann 
AuthorDate: Mon Nov 15 12:22:11 2021 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Nov 15 15:28:25 2021 +0100

Avoid some -Werror,-Wdeprecated-copy-with-user-provided-dtor

...after e6968f0485cfb2f6c941d11c438386e14a47095d "PPTX import: fix 
handling of
theme overrides in the chart import" introduced a use of 
std::make_shared

Change-Id: I5f6384b81e02034b6b2fdf3a3bad0148de4eb584
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125228
Tested-by: Tor Lillqvist 
Reviewed-by: Tor Lillqvist 

diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index 96686f26f03c..57a47cbdb4e5 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -107,7 +107,9 @@ public:
 
 explicit Shape( const char* pServiceType = nullptr, bool bDefaultHeight = 
true );
 explicit Shape( const ShapePtr& pSourceShape );
+Shape(Shape const &) = default;
 virtual ~Shape();
+Shape & operator =(Shape const &) = default;
 
 OUString&  getServiceName(){ return msServiceName; }
 voidsetServiceName( const char* pServiceName );
diff --git a/include/oox/drawingml/theme.hxx b/include/oox/drawingml/theme.hxx
index 6d64649f3a69..944e58b6e79c 100644
--- a/include/oox/drawingml/theme.hxx
+++ b/include/oox/drawingml/theme.hxx
@@ -56,9 +56,6 @@ class TextFont;
 class OOX_DLLPUBLIC Theme
 {
 public:
-Theme();
-~Theme();
-
 void setStyleName( const OUString& rStyleName ) { 
maStyleName = rStyleName; }
 
 ClrScheme&   getClrScheme() { return maClrScheme; }
diff --git a/oox/source/drawingml/theme.cxx b/oox/source/drawingml/theme.cxx
index ca26f389904e..036779d21711 100644
--- a/oox/source/drawingml/theme.cxx
+++ b/oox/source/drawingml/theme.cxx
@@ -23,14 +23,6 @@
 
 namespace oox::drawingml {
 
-Theme::Theme()
-{
-}
-
-Theme::~Theme()
-{
-}
-
 namespace {
 
 template< typename Type >


[Libreoffice-commits] core.git: include/oox oox/source

2021-11-13 Thread Noel Grandin (via logerrit)
 include/oox/token/tokenmap.hxx |4 +---
 oox/source/core/fasttokenhandler.cxx   |2 +-
 oox/source/drawingml/customshapeproperties.cxx |2 +-
 oox/source/mathml/importutils.cxx  |2 +-
 oox/source/token/tokenmap.cxx  |6 ++
 5 files changed, 10 insertions(+), 6 deletions(-)

New commits:
commit 39f4fd491ca5abaa8a01b75eb500bb82248ff4aa
Author: Noel Grandin 
AuthorDate: Fri Nov 12 19:36:06 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Nov 13 15:59:32 2021 +0100

rtl::Static->thread-safe static

Change-Id: I3010494a750eee70ffe9c24c10417d0a3730dbd6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125120
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/oox/token/tokenmap.hxx b/include/oox/token/tokenmap.hxx
index 60aeb8082001..db71c24c2371 100644
--- a/include/oox/token/tokenmap.hxx
+++ b/include/oox/token/tokenmap.hxx
@@ -28,7 +28,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -87,8 +86,7 @@ private:
 };
 
 
-struct StaticTokenMap : public ::rtl::Static< TokenMap, StaticTokenMap > {};
-
+TokenMap& StaticTokenMap();
 
 } // namespace oox
 
diff --git a/oox/source/core/fasttokenhandler.cxx 
b/oox/source/core/fasttokenhandler.cxx
index a57be30e0c2c..398772df058f 100644
--- a/oox/source/core/fasttokenhandler.cxx
+++ b/oox/source/core/fasttokenhandler.cxx
@@ -30,7 +30,7 @@ namespace oox::core {
 using namespace ::com::sun::star::uno;
 
 FastTokenHandler::FastTokenHandler() :
-mrTokenMap( StaticTokenMap::get() )
+mrTokenMap( StaticTokenMap() )
 {
 }
 
diff --git a/oox/source/drawingml/customshapeproperties.cxx 
b/oox/source/drawingml/customshapeproperties.cxx
index ac11d2d7eaa6..977afab04a6a 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -55,7 +55,7 @@ CustomShapeProperties::CustomShapeProperties()
 
 uno::Sequence< sal_Int8 > const & 
CustomShapeProperties::getShapePresetTypeName() const
 {
-return StaticTokenMap::get().getUtf8TokenName( mnShapePresetType );
+return StaticTokenMap().getUtf8TokenName( mnShapePresetType );
 }
 
 sal_Int32 CustomShapeProperties::SetCustomShapeGuideValue( std::vector< 
CustomShapeGuide >& rGuideList, const CustomShapeGuide& rGuide )
diff --git a/oox/source/mathml/importutils.cxx 
b/oox/source/mathml/importutils.cxx
index 962528acba2a..16f527389924 100644
--- a/oox/source/mathml/importutils.cxx
+++ b/oox/source/mathml/importutils.cxx
@@ -51,7 +51,7 @@ AttributeListBuilder::AttributeListBuilder( const 
uno::Reference< xml::sax::XFas
 
 OString tokenToString( int token )
 {
-uno::Sequence< sal_Int8 > const & aTokenNameSeq = 
StaticTokenMap::get().getUtf8TokenName( token & TOKEN_MASK );
+uno::Sequence< sal_Int8 > const & aTokenNameSeq = 
StaticTokenMap().getUtf8TokenName( token & TOKEN_MASK );
 OString tokenname( reinterpret_cast< const char* >( 
aTokenNameSeq.getConstArray() ), aTokenNameSeq.getLength() );
 if( tokenname.isEmpty())
 tokenname = "???";
diff --git a/oox/source/token/tokenmap.cxx b/oox/source/token/tokenmap.cxx
index 7cbba35009ae..1e51116192c6 100644
--- a/oox/source/token/tokenmap.cxx
+++ b/oox/source/token/tokenmap.cxx
@@ -87,6 +87,12 @@ sal_Int32 TokenMap::getTokenPerfectHash( const char *pStr, 
sal_Int32 nLength )
 return pToken ? pToken->nToken : XML_TOKEN_INVALID;
 }
 
+TokenMap& StaticTokenMap()
+{
+static TokenMap SINGLETON;
+return SINGLETON;
+}
+
 } // namespace oox
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: include/oox oox/source

2021-11-13 Thread Noel Grandin (via logerrit)
 include/oox/token/namespacemap.hxx |7 ++-
 oox/source/core/fastparser.cxx |2 +-
 oox/source/core/xmlfilterbase.cxx  |2 +-
 oox/source/token/namespacemap.cxx  |7 +++
 4 files changed, 11 insertions(+), 7 deletions(-)

New commits:
commit bf2048b1d242c6d5b242f18903612cedf8eaef8e
Author: Noel Grandin 
AuthorDate: Thu Nov 11 20:59:11 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Nov 13 13:01:06 2021 +0100

rtl::Static->thread-safe static in StaticNamespaceMap

Change-Id: Iea6f7f96685e332407288af7ada36527acc83a8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125119
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/oox/token/namespacemap.hxx 
b/include/oox/token/namespacemap.hxx
index 26e4fdce95f7..c02a39ba7bf8 100644
--- a/include/oox/token/namespacemap.hxx
+++ b/include/oox/token/namespacemap.hxx
@@ -22,7 +22,6 @@
 
 #include 
 
-#include 
 #include 
 #include 
 
@@ -40,10 +39,8 @@ struct NamespaceMap
 typedef std::map::const_iterator const_iterator;
 };
 
-/** Thread-save singleton of a map of all supported XML namespace URLs. */
-struct StaticNamespaceMap : public ::rtl::Static
-{
-};
+/** Thread-safe singleton of a map of all supported XML namespace URLs. */
+NamespaceMap& StaticNamespaceMap();
 
 } // namespace oox
 
diff --git a/oox/source/core/fastparser.cxx b/oox/source/core/fastparser.cxx
index 9524b1403a90..53e5eb78a849 100644
--- a/oox/source/core/fastparser.cxx
+++ b/oox/source/core/fastparser.cxx
@@ -62,7 +62,7 @@ InputStreamCloseGuard::~InputStreamCloseGuard()
 } // namespace
 
 FastParser::FastParser() :
-mrNamespaceMap( StaticNamespaceMap::get() )
+mrNamespaceMap( StaticNamespaceMap() )
 {
 // create a fast parser instance
 mxParser = new sax_fastparser::FastSaxParser;
diff --git a/oox/source/core/xmlfilterbase.cxx 
b/oox/source/core/xmlfilterbase.cxx
index 6c7aaac65476..7a9728e88f32 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -188,7 +188,7 @@ struct XmlFilterBaseImpl
 constexpr OUStringLiteral gaBinSuffix( u".bin" );
 
 XmlFilterBaseImpl::XmlFilterBaseImpl() :
-mrNamespaceMap(StaticNamespaceMap::get())
+mrNamespaceMap(StaticNamespaceMap())
 {
 // register XML namespaces
 registerNamespaces(maFastParser);
diff --git a/oox/source/token/namespacemap.cxx 
b/oox/source/token/namespacemap.cxx
index 11e7c9f0e45f..1cfa48a1ca28 100644
--- a/oox/source/token/namespacemap.cxx
+++ b/oox/source/token/namespacemap.cxx
@@ -31,6 +31,13 @@ NamespaceMap::NamespaceMap()
 #include 
 };
 }
+
+/** Thread-safe singleton of a map of all supported XML namespace URLs. */
+NamespaceMap& StaticNamespaceMap()
+{
+static NamespaceMap SINGLETON;
+return SINGLETON;
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: include/oox oox/source

2021-11-07 Thread Noel Grandin (via logerrit)
 include/oox/helper/propertymap.hxx  |5 ++---
 include/oox/token/propertynames.hxx |   18 +++---
 oox/source/helper/propertymap.cxx   |4 ++--
 oox/source/token/propertynames.cxx  |9 +
 4 files changed, 12 insertions(+), 24 deletions(-)

New commits:
commit a75324ccabcf09c0f1bc7a1a43256aa37f0da751
Author: Noel Grandin 
AuthorDate: Sun Nov 7 18:45:58 2021 +0200
Commit: Noel Grandin 
CommitDate: Mon Nov 8 07:43:09 2021 +0100

rtl::Instance->thread-safe static in PropertyNameVector

Change-Id: I3f595585b78c9e5ac32d9fc345c55a4eb14101c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124824
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/oox/helper/propertymap.hxx 
b/include/oox/helper/propertymap.hxx
index 85635f314d5e..3e48c9817fd1 100644
--- a/include/oox/helper/propertymap.hxx
+++ b/include/oox/helper/propertymap.hxx
@@ -22,6 +22,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -37,8 +38,6 @@ namespace com::sun::star::beans {
 
 namespace oox {
 
-struct PropertyNameVector;
-
 
 typedef ::std::map< OUString, css::uno::Any > PropertyNameMap;
 
@@ -114,7 +113,7 @@ public:
   static void dumpData( const css::uno::Reference& 
rXPropSet);
 #endif
 private:
-const PropertyNameVector* mpPropNames;
+const std::vector* mpPropNames;
 
 protected:
 std::map< sal_Int32, css::uno::Any > maProperties;
diff --git a/include/oox/token/propertynames.hxx 
b/include/oox/token/propertynames.hxx
index 84077359e1fe..91e07cbdd33b 100644
--- a/include/oox/token/propertynames.hxx
+++ b/include/oox/token/propertynames.hxx
@@ -16,30 +16,18 @@
  *   except in compliance with the License. You may obtain a copy of
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
-
-#ifndef INCLUDED_OOX_TOKEN_PROPERTYNAMES_HXX
-#define INCLUDED_OOX_TOKEN_PROPERTYNAMES_HXX
+#pragma once
 
 #include 
 
-#include 
 #include 
 
 namespace oox
 {
 /** A vector that contains all predefined property names used in the filters. 
*/
-struct PropertyNameVector : public ::std::vector
-{
-PropertyNameVector();
-};
-
-/** Thread-save singleton of a vector of all supported property names. */
-struct StaticPropertyNameVector : public ::rtl::Static
-{
-};
+/** Thread-safe singleton of a vector of all supported property names. */
+const std::vector& GetPropertyNameVector();
 
 } // namespace oox
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/helper/propertymap.cxx 
b/oox/source/helper/propertymap.cxx
index afb6ef6ff6f6..83495dc879b1 100644
--- a/oox/source/helper/propertymap.cxx
+++ b/oox/source/helper/propertymap.cxx
@@ -180,7 +180,7 @@ sal_Bool SAL_CALL GenericPropertySet::hasPropertyByName( 
const OUString& rProper
 } // namespace
 
 PropertyMap::PropertyMap() :
-mpPropNames( ::get() ) // pointer instead 
reference to get compiler generated copy c'tor and operator=
+mpPropNames( () ) // pointer instead reference to 
get compiler generated copy c'tor and operator=
 {
 }
 
@@ -221,7 +221,7 @@ void PropertyMap::assignUsed( const PropertyMap& rPropMap )
 const OUString& PropertyMap::getPropertyName( sal_Int32 nPropId )
 {
 OSL_ENSURE( (0 <= nPropId) && (nPropId < PROP_COUNT), 
"PropertyMap::getPropertyName - invalid property identifier" );
-return StaticPropertyNameVector::get()[ nPropId ];
+return GetPropertyNameVector()[ nPropId ];
 }
 
 void PropertyMap::assignAll( const PropertyMap& rPropMap )
diff --git a/oox/source/token/propertynames.cxx 
b/oox/source/token/propertynames.cxx
index b7c5e544143c..eadf0d5d4d7a 100644
--- a/oox/source/token/propertynames.cxx
+++ b/oox/source/token/propertynames.cxx
@@ -21,12 +21,13 @@
 
 namespace oox
 {
-PropertyNameVector::PropertyNameVector()
-: ::std::vector{
+const std::vector& GetPropertyNameVector()
+{
+static const std::vector NAMES{
 // include auto-generated C array with property names as C strings
 #include 
-}
-{
+};
+return NAMES;
 }
 
 } // namespace oox


[Libreoffice-commits] core.git: include/oox oox/source sc/qa sc/source

2021-10-13 Thread Attila Szűcs (via logerrit)
 include/oox/core/xmlfilterbase.hxx |2 
 oox/source/core/xmlfilterbase.cxx  |9 +++
 sc/qa/unit/data/xlsx/tdf144642_RowHeight_10mm_SavedByCalc.xlsx |binary
 sc/qa/unit/data/xlsx/tdf144642_RowHeight_28.35pt_SavedByExcel.xlsx |binary
 sc/qa/unit/subsequent_export_test.cxx  |2 
 sc/qa/unit/subsequent_export_test2.cxx |   25 
++
 sc/source/filter/oox/sheetdatacontext.cxx  |6 ++
 7 files changed, 42 insertions(+), 2 deletions(-)

New commits:
commit 537cb82be8fa021fd9382cca874645c75daaef20
Author: Attila Szűcs 
AuthorDate: Wed Sep 22 13:19:23 2021 +0200
Commit: László Németh 
CommitDate: Wed Oct 13 16:57:35 2021 +0200

tdf#144642 XLSX import: round down row height to 0.75 pt

like table layout of MSO does, e.g. 20 pt to 19.5 pt.

Changing table row height is only for interoperability.
To avoid of regressions, apply this workaround only for
documents created in MSO.

Note: likely this is an old adjustment for low-resolution
monitors, where 0.75 is the factor between 96 ppi of Windows
resolution and (originally) 72 ppi of monitor resolutions.

Co-authored-by: Tibor Nagy (NISZ)

Change-Id: Ie1e2c781d21174a877b18cd3250eb445222bd1c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122428
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 7c1cada284d2..15de6ce680c9 100644
--- a/include/oox/core/xmlfilterbase.hxx
+++ b/include/oox/core/xmlfilterbase.hxx
@@ -246,6 +246,7 @@ public:
 static FastParser* createParser();
 
 bool isMSO2007Document() const;
+bool isMSODocument() const;
 
 /// Signal that an MSO 2007-created SmartArt was found, need to warn the
 /// user about it.
@@ -281,6 +282,7 @@ private:
 sal_Int32 mnRelId;
 sal_Int32 mnMaxDocId;
 bool mbMSO2007;
+bool mbMSO;
 protected:
 bool mbMissingExtDrawing;
 };
diff --git a/oox/source/core/xmlfilterbase.cxx 
b/oox/source/core/xmlfilterbase.cxx
index 371439b022a2..7f4ff6bd0f0c 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -200,6 +200,7 @@ XmlFilterBase::XmlFilterBase( const Reference< 
XComponentContext >& rxContext )
 mnRelId( 1 ),
 mnMaxDocId( 0 ),
 mbMSO2007(false),
+mbMSO(false),
 mbMissingExtDrawing(false)
 {
 }
@@ -218,9 +219,10 @@ XmlFilterBase::~XmlFilterBase()
 
 void XmlFilterBase::checkDocumentProperties(const 
Reference& xDocProps)
 {
-mbMSO2007 = false;
+mbMSO2007 = mbMSO = false;
 if (!xDocProps->getGenerator().startsWithIgnoreAsciiCase("Microsoft"))
 return;
+mbMSO = true;
 
 uno::Reference 
xUserDefProps(xDocProps->getUserDefinedProperties(), uno::UNO_QUERY);
 if (!xUserDefProps.is())
@@ -1020,6 +1022,11 @@ bool XmlFilterBase::isMSO2007Document() const
 return mbMSO2007;
 }
 
+bool XmlFilterBase::isMSODocument() const
+{
+return mbMSO;
+}
+
 void XmlFilterBase::setMissingExtDrawing()
 {
 mbMissingExtDrawing = true;
diff --git a/sc/qa/unit/data/xlsx/tdf144642_RowHeight_10mm_SavedByCalc.xlsx 
b/sc/qa/unit/data/xlsx/tdf144642_RowHeight_10mm_SavedByCalc.xlsx
new file mode 100644
index ..d85d94c107fc
Binary files /dev/null and 
b/sc/qa/unit/data/xlsx/tdf144642_RowHeight_10mm_SavedByCalc.xlsx differ
diff --git a/sc/qa/unit/data/xlsx/tdf144642_RowHeight_28.35pt_SavedByExcel.xlsx 
b/sc/qa/unit/data/xlsx/tdf144642_RowHeight_28.35pt_SavedByExcel.xlsx
new file mode 100644
index ..367922d6581f
Binary files /dev/null and 
b/sc/qa/unit/data/xlsx/tdf144642_RowHeight_28.35pt_SavedByExcel.xlsx differ
diff --git a/sc/qa/unit/subsequent_export_test.cxx 
b/sc/qa/unit/subsequent_export_test.cxx
index aa2a12f69d33..ad27741d4ad8 100644
--- a/sc/qa/unit/subsequent_export_test.cxx
+++ b/sc/qa/unit/subsequent_export_test.cxx
@@ -1564,7 +1564,7 @@ void ScExportTest::testMiscRowHeightExport()
 static const TestParam::RowData DfltRowData[] = {
 { 0, 4, 0, 529, 0, false },
 { 5, 10, 0, 1058, 0, false },
-{ 17, 20, 0, 1767, 0, false },
+{ 17, 20, 0, 1746, 0, false },
 // check last couple of row in document to ensure
 // they are 5.29mm ( effective default row xlsx height )
 { 1048573, 1048575, 0, 529, 0, false },
diff --git a/sc/qa/unit/subsequent_export_test2.cxx 
b/sc/qa/unit/subsequent_export_test2.cxx
index cea7c5e00628..2be6a07c4af8 100644
--- a/sc/qa/unit/subsequent_export_test2.cxx
+++ b/sc/qa/unit/subsequent_export_test2.cxx
@@ -199,6 +199,7 @@ public:
 void testTdf136721_paper_size();
 void testTdf139258_rotated_image();
 void testTdf142854_GridVisibilityImportXlsxInHeadlessMode();
+void testTdf144642_RowHeightRounding();
 void testTdf140431();
 void 

[Libreoffice-commits] core.git: include/oox oox/source

2021-09-22 Thread Stephan Bergmann (via logerrit)
 include/oox/export/shapes.hxx  |3 ++-
 oox/source/drawingml/textfield.cxx |   19 ---
 oox/source/export/shapes.cxx   |   33 +
 3 files changed, 31 insertions(+), 24 deletions(-)

New commits:
commit fcdfdc21b197bb9af1a75348ce912c5d1d47dfba
Author: Stephan Bergmann 
AuthorDate: Wed Sep 22 21:16:12 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Sep 22 23:23:14 2021 +0200

Extend loplugin:stringviewparam to starts/endsWith: oox

Change-Id: I02b4352f02fe32f40c4fe0ab198d8ac094381c7a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122491
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/include/oox/export/shapes.hxx b/include/oox/export/shapes.hxx
index 0f4e264fb1b6..646d462e827b 100644
--- a/include/oox/export/shapes.hxx
+++ b/include/oox/export/shapes.hxx
@@ -22,6 +22,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -67,7 +68,7 @@ namespace oox {
 OOX_DLLPUBLIC css::uno::Reference GetOLEObjectStream(
 css::uno::Reference const& xContext,
 css::uno::Reference const& xObj,
-OUString const& i_rProgID,
+std::u16string_view i_rProgID,
 OUString & o_rMediaType,
 OUString & o_rRelationType,
 OUString & o_rSuffix,
diff --git a/oox/source/drawingml/textfield.cxx 
b/oox/source/drawingml/textfield.cxx
index 0d33da71266d..405a874d8e57 100644
--- a/oox/source/drawingml/textfield.cxx
+++ b/oox/source/drawingml/textfield.cxx
@@ -17,6 +17,10 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include 
+
+#include 
+
 #include 
 
 #include 
@@ -26,6 +30,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -56,11 +61,11 @@ namespace {
  * @param sType the OpenXML field type.
  */
 void lclCreateTextFields( std::vector< Reference< XTextField > > & aFields,
-const Reference< 
XModel > & xModel, const OUString & sType )
+const Reference< 
XModel > & xModel, std::u16string_view sType )
 {
 Reference< XInterface > xIface;
 Reference< XMultiServiceFactory > xFactory( xModel, UNO_QUERY_THROW );
-if( sType.startsWith("datetime"))
+if( o3tl::starts_with(sType, u"datetime"))
 {
 OString s = OUStringToOString( sType, RTL_TEXTENCODING_UTF8);
 OString p( s.pData->buffer + 8 );
@@ -100,22 +105,22 @@ void lclCreateTextFields( std::vector< Reference< 
XTextField > > & aFields,
 TOOLS_WARN_EXCEPTION("oox", "");
 }
 }
-else if ( sType == "slidenum" )
+else if ( sType == u"slidenum" )
 {
 xIface = xFactory->createInstance( 
"com.sun.star.text.TextField.PageNumber" );
 aFields.emplace_back( xIface, UNO_QUERY );
 }
-else if ( sType == "slidecount" )
+else if ( sType == u"slidecount" )
 {
 xIface = xFactory->createInstance( 
"com.sun.star.text.TextField.PageCount" );
 aFields.emplace_back( xIface, UNO_QUERY );
 }
-else if ( sType == "slidename" )
+else if ( sType == u"slidename" )
 {
 xIface = xFactory->createInstance( 
"com.sun.star.text.TextField.PageName" );
 aFields.emplace_back( xIface, uno::UNO_QUERY );
 }
-else if ( sType.startsWith("file") )
+else if ( o3tl::starts_with(sType, u"file") )
 {
 OString s = OUStringToOString( sType, RTL_TEXTENCODING_UTF8);
 OString p( s.pData->buffer + 4 );
@@ -139,7 +144,7 @@ void lclCreateTextFields( std::vector< Reference< 
XTextField > > & aFields,
 xProps->setPropertyValue("FileFormat", makeAny(0));
 }
 }
-else if( sType == "author" )
+else if( sType == u"author" )
 {
 xIface = xFactory->createInstance( 
"com.sun.star.text.TextField.Author" );
 aFields.emplace_back( xIface, UNO_QUERY );
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 5fc037029456..bc120abe1627 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -21,6 +21,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -95,88 +96,88 @@ using ::sax_fastparser::FSHelperPtr;
 
 namespace oox {
 
-static void lcl_ConvertProgID(OUString const& rProgID,
+static void lcl_ConvertProgID(std::u16string_view rProgID,
 OUString & o_rMediaType, OUString & o_rRelationType, OUString & 
o_rFileExtension)
 {
-if (rProgID == "Excel.Sheet.12")
+if (rProgID == u"Excel.Sheet.12")
 {
 o_rMediaType = 
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
 o_rRelationType = oox::getRelationship(Relationship::PACKAGE);
 o_rFileExtension = "xlsx";
 }
-else if (rProgID.startsWith("Excel.SheetBinaryMacroEnabled.12") )
+else if (o3tl::starts_with(rProgID, u"Excel.SheetBinaryMacroEnabled.12") )
 {
 o_rMediaType = 

[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source

2021-08-05 Thread Samuel Mehrbrodt (via logerrit)
 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 & 

[Libreoffice-commits] core.git: include/oox oox/source sd/qa

2021-07-27 Thread Tibor Nagy (via logerrit)
 include/oox/ppt/presPropsfragmenthandler.hxx |1 +
 oox/source/ppt/presPropsfragmenthandler.cxx  |2 ++
 sd/qa/unit/data/pptx/tdf142915.pptx  |binary
 sd/qa/unit/import-tests.cxx  |   19 +++
 4 files changed, 22 insertions(+)

New commits:
commit f8ddaaf0f5e1fb61e0d4404ea28757bc652ae4be
Author: Tibor Nagy 
AuthorDate: Wed Jul 21 12:48:46 2021 +0200
Commit: László Németh 
CommitDate: Tue Jul 27 11:50:25 2021 +0200

tdf#142915 PPTX import: support for presentation's timing attribute

See Slide Show->Slide Show Settings...->Change slides manually,
which is disabled by default. Now 
is imported correctly, i.e. with enabled "Change slides manually".

Note: it seems, com::sun::star::presentation::IsAutomatic
UNO attribute has got a bad name and documentation: if it's
value is TRUE, "Change slides manually" is enabled, and vice versa.
Check with the following Basic code:

' show presentation-level automatic transition (IsAutomatic = False)
print ThisComponent.getPresentation().IsAutomatic
' show slide-level automatic transition (Change = 1)
Dim oDrawPages as Object, oDrawPage as Object
oDrawPages = ThisComponent.getDrawPages()
oDrawPage = oDrawPages.getByIndex(0)
print oDrawPage.Change

Change-Id: Ie4a687a29077cad89f11e77b856c28a1fe09376b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119321
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/ppt/presPropsfragmenthandler.hxx 
b/include/oox/ppt/presPropsfragmenthandler.hxx
index 5125ee3357c7..18a2a97aa9cd 100644
--- a/include/oox/ppt/presPropsfragmenthandler.hxx
+++ b/include/oox/ppt/presPropsfragmenthandler.hxx
@@ -32,6 +32,7 @@ public:
 
 private:
 bool m_bLoop = false;
+bool m_bTiming = true;
 OUString m_sId;
 OUString m_sSt;
 };
diff --git a/oox/source/ppt/presPropsfragmenthandler.cxx 
b/oox/source/ppt/presPropsfragmenthandler.cxx
index ca466177e944..708f194853fb 100644
--- a/oox/source/ppt/presPropsfragmenthandler.cxx
+++ b/oox/source/ppt/presPropsfragmenthandler.cxx
@@ -41,6 +41,7 @@ void PresPropsFragmentHandler::finalizeImport()
 css::uno::Reference xPresentationProps(
 xPresentationSupplier->getPresentation(), css::uno::UNO_QUERY_THROW);
 xPresentationProps->setPropertyValue("IsEndless", css::uno::Any(m_bLoop));
+xPresentationProps->setPropertyValue("IsAutomatic", 
css::uno::Any(!m_bTiming));
 
 if (!m_sId.isEmpty())
 {
@@ -73,6 +74,7 @@ core::ContextHandlerRef 
PresPropsFragmentHandler::onCreateContext(sal_Int32 aEle
 return this;
 case PPT_TOKEN(showPr):
 m_bLoop = rAttribs.getBool(XML_loop, false);
+m_bTiming = rAttribs.getBool(XML_useTimings, true);
 return this;
 case PPT_TOKEN(custShow):
 m_sId = rAttribs.getString(XML_id).get();
diff --git a/sd/qa/unit/data/pptx/tdf142915.pptx 
b/sd/qa/unit/data/pptx/tdf142915.pptx
new file mode 100644
index ..889a08fd50a1
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf142915.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 708c8a375482..77f7c90b34c9 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -122,6 +122,7 @@ public:
 virtual void setUp() override;
 
 void testDocumentLayout();
+void testTdf142915();
 void testTdf142913();
 void testTdf142590();
 void testCustomSlideShow();
@@ -243,6 +244,7 @@ public:
 CPPUNIT_TEST_SUITE(SdImportTest);
 
 CPPUNIT_TEST(testDocumentLayout);
+CPPUNIT_TEST(testTdf142915);
 CPPUNIT_TEST(testTdf142913);
 CPPUNIT_TEST(testTdf142590);
 CPPUNIT_TEST(testCustomSlideShow);
@@ -440,6 +442,23 @@ void SdImportTest::testDocumentLayout()
 }
 }
 
+void SdImportTest::testTdf142915()
+{
+::sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf142915.pptx"), 
PPTX);
+
+uno::Reference xPresentationSupplier(
+xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW);
+uno::Reference 
xPresentationProps(xPresentationSupplier->getPresentation(),
+   
uno::UNO_QUERY_THROW);
+
+bool bChangeManually = 
xPresentationProps->getPropertyValue("IsAutomatic").get();
+
+CPPUNIT_ASSERT_EQUAL(true, bChangeManually);
+
+xDocShRef->DoClose();
+}
+
 void SdImportTest::testTdf142913()
 {
 ::sd::DrawDocShellRef xDocShRef
___
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

2021-07-13 Thread Mike Kaganski (via logerrit)
 include/oox/export/drawingml.hxx |2 +-
 oox/source/export/drawingml.cxx  |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 60ea95afb2e2ed299711d8244a2ffb1c960c7eb2
Author: Mike Kaganski 
AuthorDate: Tue Jul 13 10:28:32 2021 +0200
Commit: Mike Kaganski 
CommitDate: Tue Jul 13 12:57:58 2021 +0200

Avoid default argument value, and be explicit

Helps seeing which element used where

Change-Id: Ieb5f1ea4ca983211d995268210dc2d9b14061721
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118796
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index c90e1c06a844..77ff77174cc9 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -288,7 +288,7 @@ public:
 
 @returns true if any paragraph properties were written
 */
-bool WriteParagraphProperties(const css::uno::Reference< 
css::text::XTextContent >& rParagraph, float fFirstCharHeight, const sal_Int32 
nElement = XML_pPr );
+bool WriteParagraphProperties(const css::uno::Reference< 
css::text::XTextContent >& rParagraph, float fFirstCharHeight, sal_Int32 
nElement);
 void WriteParagraphNumbering(const css::uno::Reference< 
css::beans::XPropertySet >& rXPropSet, float fFirstCharHeight,
   sal_Int16 nLevel );
 void WriteParagraphTabStops(const 
css::uno::Reference& rXPropSet);
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index cc823858e337..7c6754a35f6d 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -3016,7 +3016,7 @@ void DrawingML::WriteParagraph( const Reference< 
XTextContent >& rParagraph,
 Reference< XPropertySetInfo > xFirstRunPropSetInfo = 
xFirstRunPropSet->getPropertySetInfo();
 if( xFirstRunPropSetInfo->hasPropertyByName("CharHeight") )
 fFirstCharHeight = 
xFirstRunPropSet->getPropertyValue("CharHeight").get();
-WriteParagraphProperties( rParagraph, fFirstCharHeight );
+WriteParagraphProperties(rParagraph, fFirstCharHeight, 
XML_pPr);
 bPropertiesWritten = true;
 }
 WriteRun( run, rbOverridingCharHeight, rnCharHeight, 
rXShapePropSet);
___
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 sc/source sd/qa

2021-07-08 Thread Gülşah Köse (via logerrit)
 include/oox/core/contexthandler2.hxx  |   19 +
 include/oox/core/fragmenthandler2.hxx |   11 ---
 include/oox/drawingml/graphicshapecontext.hxx |1 
 include/oox/ole/oleobjecthelper.hxx   |1 
 oox/source/core/contexthandler2.cxx   |   85 +-
 oox/source/core/fragmenthandler2.cxx  |   70 -
 oox/source/drawingml/graphicshapecontext.cxx  |   11 +++
 sc/source/filter/oox/worksheetfragment.cxx|6 -
 sd/qa/unit/data/pptx/tdf143222.pptx   |binary
 sd/qa/unit/export-tests-ooxml3.cxx|   30 +
 10 files changed, 148 insertions(+), 86 deletions(-)

New commits:
commit 92a407b7f90a98704a238c5ffa3a3491eaf3263a
Author: Gülşah Köse 
AuthorDate: Wed Jul 7 00:27:58 2021 +0300
Commit: Gülşah Köse 
CommitDate: Thu Jul 8 23:12:07 2021 +0200

tdf143222 Handle alternate content of graphicData element.

Handle alternate content and make true choice.

According to ooxml spec ole object requires exactly one pic
element. (ECMA-376 Part 1, Annex A, CT_OleObject). In the
current case first choice has not pic element and we should
allow fallback processing.

Change-Id: I30b7de703b8c2f00d6bf286e05eea505ac3627f2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118539
Tested-by: Jenkins
Reviewed-by: Gülşah Köse 

diff --git a/include/oox/core/contexthandler2.hxx 
b/include/oox/core/contexthandler2.hxx
index 4e256089ac8e..3a75aff5706a 100644
--- a/include/oox/core/contexthandler2.hxx
+++ b/include/oox/core/contexthandler2.hxx
@@ -72,7 +72,7 @@ struct ElementInfo;
 class OOX_DLLPUBLIC ContextHandler2Helper
 {
 public:
-explicitContextHandler2Helper( bool bEnableTrimSpace );
+explicitContextHandler2Helper( bool bEnableTrimSpace, 
XmlFilterBase& rFilter );
 explicitContextHandler2Helper( const ContextHandler2Helper& 
rParent );
 virtual ~ContextHandler2Helper();
 
@@ -201,6 +201,21 @@ protected:
 /** Must be called from endRecord() in derived classes. */
 voidimplEndRecord( sal_Int32 nRecId );
 
+boolprepareMceContext( sal_Int32 nElement, const 
AttributeList& rAttribs );
+XmlFilterBase&  getDocFilter() const { return mrFilter; }
+
+enum class MCE_STATE
+{
+Started,
+FoundChoice
+};
+
+MCE_STATE   getMCEState() const { return aMceState.back(); }
+voidsetMCEState( MCE_STATE aState ) { aMceState.back() = 
aState; }
+voidaddMCEState( MCE_STATE aState ) { aMceState.push_back( 
aState ); }
+voidremoveMCEState() { aMceState.pop_back(); }
+boolisMCEStateEmpty() { return aMceState.empty(); }
+
 private:
 ContextHandler2Helper& operator=( const ContextHandler2Helper& ) = delete;
 
@@ -214,9 +229,11 @@ private:
 
 ContextStackRef mxContextStack; ///< Stack of all processed 
elements.
 size_t  mnRootStackSize;///< Stack size on construction 
time.
+std::vector aMceState;
 
 protected:
 boolmbEnableTrimSpace;  ///< True = trim whitespace in 
characters().
+XmlFilterBase&  mrFilter;
 };
 
 class OOX_DLLPUBLIC ContextHandler2 : public ContextHandler, public 
ContextHandler2Helper
diff --git a/include/oox/core/fragmenthandler2.hxx 
b/include/oox/core/fragmenthandler2.hxx
index 86d1453f13a1..598426ee681e 100644
--- a/include/oox/core/fragmenthandler2.hxx
+++ b/include/oox/core/fragmenthandler2.hxx
@@ -47,17 +47,6 @@ class XmlFilterBase;
 
 class OOX_DLLPUBLIC FragmentHandler2 : public FragmentHandler, public 
ContextHandler2Helper
 {
-protected:
-enum class MCE_STATE
-{
-Started,
-FoundChoice
-};
-::std::vector   aMceState;
-
-boolprepareMceContext( sal_Int32 nElement, const 
AttributeList& rAttribs );
-
-
 public:
 explicitFragmentHandler2(
 XmlFilterBase& rFilter,
diff --git a/include/oox/drawingml/graphicshapecontext.hxx 
b/include/oox/drawingml/graphicshapecontext.hxx
index 4813d5fc9aed..ffd579f00bb1 100644
--- a/include/oox/drawingml/graphicshapecontext.hxx
+++ b/include/oox/drawingml/graphicshapecontext.hxx
@@ -62,6 +62,7 @@ public:
 OleObjectGraphicDataContext( ::oox::core::ContextHandler2Helper const & 
rParent, const ShapePtr& pShapePtr );
 virtual ~OleObjectGraphicDataContext() override;
 virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 
Element, const ::oox::AttributeList& rAttribs ) override;
+virtual void onEndElement() override;
 
 private:
 ::oox::vml::OleObjectInfo& mrOleObjectInfo;
diff --git a/include/oox/ole/oleobjecthelper.hxx 
b/include/oox/ole/oleobjecthelper.hxx
index d2506f3d4949..5b792f2048b1 100644
--- a/include/oox/ole/oleobjecthelper.hxx
+++ b/include/oox/ole/oleobjecthelper.hxx
@@ -47,6 +47,7 @@ 

[Libreoffice-commits] core.git: include/oox oox/source sw/qa

2021-07-01 Thread Attila Bakos (NISZ) (via logerrit)
 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();
+

[Libreoffice-commits] core.git: include/oox oox/source sd/inc sd/source vcl/inc vcl/source writerfilter/source

2021-07-01 Thread Noel Grandin (via logerrit)
 include/oox/shape/ShapeContextHandler.hxx |6 ---
 oox/source/shape/ShapeContextHandler.cxx  |   32 -
 sd/inc/sdabstdlg.hxx  |1 
 sd/source/ui/dlg/sddlgfact.cxx|5 --
 sd/source/ui/dlg/sddlgfact.hxx|1 
 vcl/inc/wizdlg.hxx|   14 ---
 vcl/source/control/roadmapwizard.cxx  |   30 
 vcl/source/control/wizardmachine.cxx  |   33 --
 writerfilter/source/ooxml/OOXMLFastContextHandler.hxx |2 -
 9 files changed, 124 deletions(-)

New commits:
commit 65af6fda33bc40670d41055f63e010c763f5b0b1
Author: Noel Grandin 
AuthorDate: Thu Jul 1 10:27:41 2021 +0200
Commit: Noel Grandin 
CommitDate: Thu Jul 1 11:26:04 2021 +0200

loplugin:unusedmethods

Change-Id: I3ff5333c1e73ca61b0a7339e4b7dcfce211b88e2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118207
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/oox/shape/ShapeContextHandler.hxx 
b/include/oox/shape/ShapeContextHandler.hxx
index 39549c5d33af..ba500dd48f76 100644
--- a/include/oox/shape/ShapeContextHandler.hxx
+++ b/include/oox/shape/ShapeContextHandler.hxx
@@ -85,24 +85,18 @@ public:
 
 css::uno::Reference< css::drawing::XShape > getShape();
 
-css::uno::Reference< css::drawing::XDrawPage > getDrawPage();
 void setDrawPage(const css::uno::Reference< css::drawing::XDrawPage > & 
the_value);
 
-css::uno::Reference< css::frame::XModel > getModel();
 void setModel(const css::uno::Reference< css::frame::XModel > & the_value);
 
-OUString getRelationFragmentPath();
 void setRelationFragmentPath(const OUString & the_value);
 
 sal_Int32 getStartToken();
 void setStartToken( sal_Int32 _starttoken );
 
-css::awt::Point getPosition();
 void setPosition(const css::awt::Point& rPosition);
 
 void setDocumentProperties(const 
css::uno::Reference& xDocProps);
-css::uno::Reference 
getDocumentProperties();
-css::uno::Sequence getMediaDescriptor();
 void setMediaDescriptor(const 
css::uno::Sequence& rMediaDescriptor);
 
 void setGraphicMapper(css::uno::Reference 
const & rGraphicMapper);
diff --git a/oox/source/shape/ShapeContextHandler.cxx 
b/oox/source/shape/ShapeContextHandler.cxx
index 0d03d322d011..066d49d00f60 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -513,23 +513,11 @@ ShapeContextHandler::getShape()
 return xResult;
 }
 
-css::uno::Reference< css::drawing::XDrawPage > 
ShapeContextHandler::getDrawPage()
-{
-return mxDrawPage;
-}
-
 void ShapeContextHandler::setDrawPage(const css::uno::Reference< 
css::drawing::XDrawPage > & the_value)
 {
 mxDrawPage = the_value;
 }
 
-css::uno::Reference< css::frame::XModel > ShapeContextHandler::getModel()
-{
-if( !mxShapeFilterBase.is() )
-throw uno::RuntimeException();
-return mxShapeFilterBase->getModel();
-}
-
 void ShapeContextHandler::setModel(const css::uno::Reference< 
css::frame::XModel > & the_value)
 {
 if( !mxShapeFilterBase.is() )
@@ -538,11 +526,6 @@ void ShapeContextHandler::setModel(const 
css::uno::Reference< css::frame::XModel
 mxShapeFilterBase->setTargetDocument(xComp);
 }
 
-OUString ShapeContextHandler::getRelationFragmentPath()
-{
-return msRelationFragmentPath;
-}
-
 void ShapeContextHandler::setRelationFragmentPath(const OUString & the_value)
 {
 msRelationFragmentPath = the_value;
@@ -558,11 +541,6 @@ void ShapeContextHandler::setStartToken( sal_Int32 
_starttoken )
 mnStartToken = _starttoken;
 }
 
-awt::Point ShapeContextHandler::getPosition()
-{
-return maPosition;
-}
-
 void ShapeContextHandler::setPosition(const awt::Point& rPosition)
 {
 maPosition = rPosition;
@@ -574,16 +552,6 @@ void ShapeContextHandler::setDocumentProperties(const 
uno::ReferencecheckDocumentProperties(mxDocumentProperties);
 }
 
-uno::Reference 
ShapeContextHandler::getDocumentProperties()
-{
-return mxDocumentProperties;
-}
-
-uno::Sequence ShapeContextHandler::getMediaDescriptor()
-{
-return maMediaDescriptor;
-}
-
 void ShapeContextHandler::setMediaDescriptor(const 
uno::Sequence& rMediaDescriptor)
 {
 maMediaDescriptor = rMediaDescriptor;
diff --git a/sd/inc/sdabstdlg.hxx b/sd/inc/sdabstdlg.hxx
index c5c8c3a38ad4..4c9c547f98a2 100644
--- a/sd/inc/sdabstdlg.hxx
+++ b/sd/inc/sdabstdlg.hxx
@@ -70,7 +70,6 @@ class AbstractSdCustomShowDlg : public VclAbstractDialog
 protected:
 virtual ~AbstractSdCustomShowDlg() override = default;
 public:
-virtual boolIsModified() const = 0;
 virtual boolIsCustomShow() const = 0;
 };
 
diff --git a/sd/source/ui/dlg/sddlgfact.cxx b/sd/source/ui/dlg/sddlgfact.cxx
index f5ab2524cdb9..0335c68fa8be 100644
--- a/sd/source/ui/dlg/sddlgfact.cxx
+++ b/sd/source/ui/dlg/sddlgfact.cxx
@@ -240,11 +240,6 

[Libreoffice-commits] core.git: include/oox oox/source writerfilter/source

2021-06-29 Thread Noel Grandin (via logerrit)
 include/oox/shape/ShapeContextHandler.hxx |6 --
 oox/source/shape/ShapeContextHandler.cxx  |   10 +-
 writerfilter/source/ooxml/OOXMLDocumentImpl.cxx   |8 
 writerfilter/source/ooxml/OOXMLDocumentImpl.hxx   |   12 
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |   14 +-
 5 files changed, 42 insertions(+), 8 deletions(-)

New commits:
commit 97123add76b743013fc5c222387feb4b9c13daf2
Author: Noel Grandin 
AuthorDate: Tue Jun 29 08:19:12 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Jun 29 11:29:48 2021 +0200

tdf#135316 share themePtr and ShapeFilterBase across all shapes

.. in a document.

Shavves 20% off my load time.

Change-Id: I8101b4d229485ebdef0c1f72f856e7cda43559d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118045
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/oox/shape/ShapeContextHandler.hxx 
b/include/oox/shape/ShapeContextHandler.hxx
index 5655cc25acf2..39549c5d33af 100644
--- a/include/oox/shape/ShapeContextHandler.hxx
+++ b/include/oox/shape/ShapeContextHandler.hxx
@@ -50,8 +50,7 @@ class OOX_DLLPUBLIC ShapeContextHandler:
 public ::cppu::WeakImplHelper< css::xml::sax::XFastContextHandler >
 {
 public:
-explicit ShapeContextHandler
-(css::uno::Reference< css::uno::XComponentContext > const & context);
+explicit ShapeContextHandler(const rtl::Reference& 
xFilterBase);
 
 virtual ~ShapeContextHandler() override;
 
@@ -108,6 +107,9 @@ public:
 
 void setGraphicMapper(css::uno::Reference 
const & rGraphicMapper);
 
+void setTheme(const oox::drawingml::ThemePtr& pTheme) { mpThemePtr = 
pTheme; }
+const oox::drawingml::ThemePtr& getTheme() { return mpThemePtr; }
+
 private:
 ShapeContextHandler(ShapeContextHandler const &) = delete;
 void operator =(ShapeContextHandler const &) = delete;
diff --git a/oox/source/shape/ShapeContextHandler.cxx 
b/oox/source/shape/ShapeContextHandler.cxx
index 3a0ed5a3a306..0d03d322d011 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 
@@ -44,9 +45,9 @@ namespace oox::shape {
 using namespace core;
 using namespace drawingml;
 
-ShapeContextHandler::ShapeContextHandler(uno::Reference< 
uno::XComponentContext > const & context) :
+ShapeContextHandler::ShapeContextHandler(const 
rtl::Reference& xFilterBase) :
   mnStartToken(0),
-  mxShapeFilterBase( new ShapeFilterBase(context) )
+  mxShapeFilterBase(xFilterBase)
 {
 }
 
@@ -257,14 +258,13 @@ void SAL_CALL ShapeContextHandler::startFastElement
 {
 mxShapeFilterBase->filter(maMediaDescriptor);
 
-mpThemePtr = std::make_shared();
-
 if (Element == DGM_TOKEN(relIds) || Element == LC_TOKEN(lockedCanvas) || 
Element == C_TOKEN(chart) ||
 Element == WPS_TOKEN(wsp) || Element == WPG_TOKEN(wgp) || Element == 
OOX_TOKEN(dmlPicture, pic))
 {
 // Parse the theme relation, if available; the diagram won't have 
colors without it.
-if (!msRelationFragmentPath.isEmpty())
+if (!mpThemePtr && !msRelationFragmentPath.isEmpty())
 {
+mpThemePtr = std::make_shared();
 // Get Target for Type = "officeDocument" from _rels/.rels file
 // aOfficeDocumentFragmentPath is pointing to "word/document.xml" 
for docx & to "ppt/presentation.xml" for pptx
 FragmentHandlerRef rFragmentHandlerRef(new 
ShapeFragmentHandler(*mxShapeFilterBase, "/"));
diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx 
b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
index e0eb6bc48119..be397048df0f 100644
--- a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
+++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "OOXMLStreamImpl.hxx"
 #include "OOXMLDocumentImpl.hxx"
 #include "OOXMLBinaryObjectReference.hxx"
@@ -879,6 +880,13 @@ uno::Sequence 
OOXMLDocumentImpl::getEmbeddingsList( )
 return mxEmbeddingsList;
 }
 
+const rtl::Reference& 
OOXMLDocumentImpl::getShapeFilterBase()
+{
+if (!mxShapeFilterBase)
+mxShapeFilterBase = new 
oox::shape::ShapeFilterBase(mpStream->getContext());
+return mxShapeFilterBase;
+}
+
 OOXMLDocument *
 OOXMLDocumentFactory::createDocument
 (const OOXMLStream::Pointer_t& pStream,
diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx 
b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
index c97c208534cf..5572d0c77d7b 100644
--- a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
+++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
@@ -23,6 +23,8 @@
 #include 
 #include 
 
+#include 
+
 #include "OOXMLPropertySet.hxx"
 
 #include 
@@ -66,6 +68,10 @@ class OOXMLDocumentImpl : public OOXMLDocument
 css::uno::Sequence maMediaDescriptor;
 /// Graphic mapper
 

[Libreoffice-commits] core.git: include/oox oox/source sd/qa

2021-06-29 Thread Tibor Nagy (via logerrit)
 include/oox/ppt/presPropsfragmenthandler.hxx |1 +
 oox/source/ppt/presPropsfragmenthandler.cxx  |   18 ++
 sd/qa/unit/data/pptx/tdf142913.pptx  |binary
 sd/qa/unit/import-tests.cxx  |   19 +++
 4 files changed, 38 insertions(+)

New commits:
commit 3d55149dcf19cffefcc19c16a3abbe8851453c5e
Author: Tibor Nagy 
AuthorDate: Wed Jun 23 13:15:57 2021 +0200
Commit: László Németh 
CommitDate: Tue Jun 29 09:50:25 2021 +0200

tdf#142913 PPTX: slideshow setting “Start from” not imported

Note: see Slide Show->Slide Show Settings...->Range->From:
on the UI, or press Shift-F5 after loading the unit test
document sd/qa/unit/data/pptx/tdf142913.pptx.

Change-Id: I2e10a4353c26600bf405475cb89990413c81dc1e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117705
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/ppt/presPropsfragmenthandler.hxx 
b/include/oox/ppt/presPropsfragmenthandler.hxx
index 3edf60cf3273..5125ee3357c7 100644
--- a/include/oox/ppt/presPropsfragmenthandler.hxx
+++ b/include/oox/ppt/presPropsfragmenthandler.hxx
@@ -33,6 +33,7 @@ public:
 private:
 bool m_bLoop = false;
 OUString m_sId;
+OUString m_sSt;
 };
 } // namespace ppt
 } // namespace oox
diff --git a/oox/source/ppt/presPropsfragmenthandler.cxx 
b/oox/source/ppt/presPropsfragmenthandler.cxx
index 47965050b164..ca466177e944 100644
--- a/oox/source/ppt/presPropsfragmenthandler.cxx
+++ b/oox/source/ppt/presPropsfragmenthandler.cxx
@@ -13,12 +13,17 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
 #include 
 #include 
 
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
 namespace oox::ppt
 {
 PresPropsFragmentHandler::PresPropsFragmentHandler(core::XmlFilterBase& 
rFilter,
@@ -47,6 +52,16 @@ void PresPropsFragmentHandler::finalizeImport()
 xPresentationProps->setPropertyValue("CustomShow",
  
css::uno::Any(aNameSeq[m_sId.toInt32()]));
 }
+
+if (!m_sSt.isEmpty())
+{
+Reference xDPS(getFilter().getModel(), 
uno::UNO_QUERY_THROW);
+Reference xDrawPages(xDPS->getDrawPages(), 
uno::UNO_SET_THROW);
+Reference xDrawPage;
+xDrawPages->getByIndex(m_sSt.toInt32() - 1) >>= xDrawPage;
+Reference xNamed(xDrawPage, uno::UNO_QUERY_THROW);
+xPresentationProps->setPropertyValue("FirstPage", 
uno::Any(xNamed->getName()));
+}
 }
 
 core::ContextHandlerRef PresPropsFragmentHandler::onCreateContext(sal_Int32 
aElementToken,
@@ -62,6 +77,9 @@ core::ContextHandlerRef 
PresPropsFragmentHandler::onCreateContext(sal_Int32 aEle
 case PPT_TOKEN(custShow):
 m_sId = rAttribs.getString(XML_id).get();
 return this;
+case PPT_TOKEN(sldRg):
+m_sSt = rAttribs.getString(XML_st).get();
+return this;
 }
 return this;
 }
diff --git a/sd/qa/unit/data/pptx/tdf142913.pptx 
b/sd/qa/unit/data/pptx/tdf142913.pptx
new file mode 100644
index ..4fd938de1e41
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf142913.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 8723c0ee53b8..708c8a375482 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -122,6 +122,7 @@ public:
 virtual void setUp() override;
 
 void testDocumentLayout();
+void testTdf142913();
 void testTdf142590();
 void testCustomSlideShow();
 void testInternalHyperlink();
@@ -242,6 +243,7 @@ public:
 CPPUNIT_TEST_SUITE(SdImportTest);
 
 CPPUNIT_TEST(testDocumentLayout);
+CPPUNIT_TEST(testTdf142913);
 CPPUNIT_TEST(testTdf142590);
 CPPUNIT_TEST(testCustomSlideShow);
 CPPUNIT_TEST(testInternalHyperlink);
@@ -438,6 +440,23 @@ void SdImportTest::testDocumentLayout()
 }
 }
 
+void SdImportTest::testTdf142913()
+{
+::sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf142913.pptx"), 
PPTX);
+
+uno::Reference xPresentationSupplier(
+xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW);
+uno::Reference 
xPresentationProps(xPresentationSupplier->getPresentation(),
+uno::UNO_QUERY_THROW);
+
+OUString sFirstPage = 
xPresentationProps->getPropertyValue("FirstPage").get();
+
+CPPUNIT_ASSERT_EQUAL(OUString("Second"), sFirstPage);
+
+xDocShRef->DoClose();
+}
+
 void SdImportTest::testTdf142590()
 {
 ::sd::DrawDocShellRef xDocShRef
___
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 sd/qa

2021-06-26 Thread Caolán McNamara (via logerrit)
 include/oox/ppt/pptshape.hxx  |2 +
 oox/source/ppt/pptshape.cxx   |   34 ++
 sd/qa/unit/data/pptx/pass/ofz35597-1.pptx |binary
 3 files changed, 23 insertions(+), 13 deletions(-)

New commits:
commit 00a658ff104623d4e7fc984b5fc82d1a7e2607f2
Author: Caolán McNamara 
AuthorDate: Sat Jun 26 19:26:40 2021 +0100
Commit: Caolán McNamara 
CommitDate: Sat Jun 26 21:33:45 2021 +0200

ofz#35597 Null-dereference READ

add a check for null getTextBody() return

unfold it a bit while I'm at it

Change-Id: Ib0286048536ad576b520e1adb08fa9b36da9243f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117938
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/include/oox/ppt/pptshape.hxx b/include/oox/ppt/pptshape.hxx
index d27a116e2783..ead382b52685 100644
--- a/include/oox/ppt/pptshape.hxx
+++ b/include/oox/ppt/pptshape.hxx
@@ -54,6 +54,8 @@ class PPTShape final : public oox::drawingml::Shape
 /// Set if spPr tag is non empty for the shape
 bool mbHasNoninheritedShapeProperties;
 
+bool IsPlaceHolderCandidate(const SlidePersist& rSlidePersist) const;
+
 public:
 
 PPTShape( const oox::ppt::ShapeLocation eShapeLocation,
diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index f1c4a892ac14..7f3786c41992 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -92,7 +92,7 @@ static const char* lclDebugSubType( sal_Int32 nType )
 
 namespace
 {
-bool ShapeHasNoVisualPropertiesOnImport(oox::ppt::PPTShape& rPPTShape)
+bool ShapeHasNoVisualPropertiesOnImport(const oox::ppt::PPTShape& rPPTShape)
 {
 return  !rPPTShape.hasNonInheritedShapeProperties()
 && !rPPTShape.hasShapeStyleRefs()
@@ -128,6 +128,23 @@ oox::drawingml::TextListStylePtr 
PPTShape::getSubTypeTextListStyle( const SlideP
 return pTextListStyle;
 }
 
+bool PPTShape::IsPlaceHolderCandidate(const SlidePersist& rSlidePersist) const
+{
+if (meShapeLocation != Slide)
+return false;
+if (rSlidePersist.isNotesPage())
+return false;
+auto pTextBody = getTextBody();
+if (!pTextBody)
+return false;
+auto rParagraphs = pTextBody->getParagraphs();
+if (rParagraphs.size() != 1)
+return false;
+if (rParagraphs.front()->getRuns().size() != 1)
+return false;
+return ShapeHasNoVisualPropertiesOnImport(*this);
+}
+
 void PPTShape::addShape(
 oox::core::XmlFilterBase& rFilterBase,
 const SlidePersist& rSlidePersist,
@@ -195,10 +212,7 @@ void PPTShape::addShape(
 }
 break;
 case XML_dt :
-if ( meShapeLocation == Slide && 
!rSlidePersist.isNotesPage()
- && getTextBody()->getParagraphs().size() == 1
- && 
getTextBody()->getParagraphs().front()->getRuns().size() == 1
- && ShapeHasNoVisualPropertiesOnImport(*this) )
+if (IsPlaceHolderCandidate(rSlidePersist))
 {
 TextRunPtr& pTextRun = 
getTextBody()->getParagraphs().front()->getRuns().front();
 oox::drawingml::TextField* pTextField = 
dynamic_cast(pTextRun.get());
@@ -234,10 +248,7 @@ void PPTShape::addShape(
 bClearText = true;
 break;
 case XML_ftr :
-if ( meShapeLocation == Slide && 
!rSlidePersist.isNotesPage()
- && getTextBody()->getParagraphs().size() == 1
- && 
getTextBody()->getParagraphs().front()->getRuns().size() == 1
- && ShapeHasNoVisualPropertiesOnImport(*this) )
+if (IsPlaceHolderCandidate(rSlidePersist))
 {
 const OUString& rFooterText = 
getTextBody()->toString();
 
@@ -255,10 +266,7 @@ void PPTShape::addShape(
 bClearText = true;
 break;
 case XML_sldNum :
-if (meShapeLocation == Slide && 
!rSlidePersist.isNotesPage()
-&& getTextBody()->getParagraphs().size() == 1
-&& 
getTextBody()->getParagraphs().front()->getRuns().size() == 1
-&& ShapeHasNoVisualPropertiesOnImport(*this))
+if (IsPlaceHolderCandidate(rSlidePersist))
 {
 TextRunPtr& pTextRun
 = 
getTextBody()->getParagraphs().front()->getRuns().front();
diff --git a/sd/qa/unit/data/pptx/pass/ofz35597-1.pptx 
b/sd/qa/unit/data/pptx/pass/ofz35597-1.pptx
new file mode 100644
index ..e7fcacc25482
Binary files /dev/null and b/sd/qa/unit/data/pptx/pass/ofz35597-1.pptx differ
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org

[Libreoffice-commits] core.git: include/oox oox/source sd/qa

2021-06-21 Thread Tibor Nagy (via logerrit)
 include/oox/ppt/presPropsfragmenthandler.hxx |1 +
 oox/source/ppt/presPropsfragmenthandler.cxx  |   17 +
 sd/qa/unit/data/pptx/tdf142590.pptx  |binary
 sd/qa/unit/import-tests.cxx  |   19 +++
 4 files changed, 37 insertions(+)

New commits:
commit 8bf44b9cdceb7926fe52ef0bd4a38af24e7c700a
Author: Tibor Nagy 
AuthorDate: Mon Jun 14 16:06:55 2021 +0200
Commit: László Németh 
CommitDate: Mon Jun 21 14:09:03 2021 +0200

tdf#142590 PPTX import: fix custom slide show use as default

If the PPTX file contains a custom slideshow, which set by
default and opening in Impress, this setting wasn't imported.

See also commit 312334f8488a668e9b5302959b60292ce151e4fc
"tdf#47365 PPTX export: support loop attribute" and
commit a4b66458a7b8da2f5580014813e5dabe3fa670b6
"tdf#125071 PPTX: fix missing custom slide show export".

Change-Id: I9c2b3773f6883ee795f119df5b8534fcdfa6618f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117172
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/ppt/presPropsfragmenthandler.hxx 
b/include/oox/ppt/presPropsfragmenthandler.hxx
index d760f39f4524..3edf60cf3273 100644
--- a/include/oox/ppt/presPropsfragmenthandler.hxx
+++ b/include/oox/ppt/presPropsfragmenthandler.hxx
@@ -32,6 +32,7 @@ public:
 
 private:
 bool m_bLoop = false;
+OUString m_sId;
 };
 } // namespace ppt
 } // namespace oox
diff --git a/oox/source/ppt/presPropsfragmenthandler.cxx 
b/oox/source/ppt/presPropsfragmenthandler.cxx
index 53d831b60ae9..47965050b164 100644
--- a/oox/source/ppt/presPropsfragmenthandler.cxx
+++ b/oox/source/ppt/presPropsfragmenthandler.cxx
@@ -10,6 +10,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -33,6 +36,17 @@ void PresPropsFragmentHandler::finalizeImport()
 css::uno::Reference xPresentationProps(
 xPresentationSupplier->getPresentation(), css::uno::UNO_QUERY_THROW);
 xPresentationProps->setPropertyValue("IsEndless", css::uno::Any(m_bLoop));
+
+if (!m_sId.isEmpty())
+{
+css::uno::Reference
+XCustPresentationSupplier(getFilter().getModel(), 
css::uno::UNO_QUERY_THROW);
+css::uno::Reference mxCustShows;
+mxCustShows = XCustPresentationSupplier->getCustomPresentations();
+const css::uno::Sequence 
aNameSeq(mxCustShows->getElementNames());
+xPresentationProps->setPropertyValue("CustomShow",
+ 
css::uno::Any(aNameSeq[m_sId.toInt32()]));
+}
 }
 
 core::ContextHandlerRef PresPropsFragmentHandler::onCreateContext(sal_Int32 
aElementToken,
@@ -45,6 +59,9 @@ core::ContextHandlerRef 
PresPropsFragmentHandler::onCreateContext(sal_Int32 aEle
 case PPT_TOKEN(showPr):
 m_bLoop = rAttribs.getBool(XML_loop, false);
 return this;
+case PPT_TOKEN(custShow):
+m_sId = rAttribs.getString(XML_id).get();
+return this;
 }
 return this;
 }
diff --git a/sd/qa/unit/data/pptx/tdf142590.pptx 
b/sd/qa/unit/data/pptx/tdf142590.pptx
new file mode 100644
index ..ecc131c2a0f6
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf142590.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 69399a686162..7637700eac1f 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -122,6 +122,7 @@ public:
 virtual void setUp() override;
 
 void testDocumentLayout();
+void testTdf142590();
 void testCustomSlideShow();
 void testInternalHyperlink();
 void testHyperlinkColor();
@@ -241,6 +242,7 @@ public:
 CPPUNIT_TEST_SUITE(SdImportTest);
 
 CPPUNIT_TEST(testDocumentLayout);
+CPPUNIT_TEST(testTdf142590);
 CPPUNIT_TEST(testCustomSlideShow);
 CPPUNIT_TEST(testInternalHyperlink);
 CPPUNIT_TEST(testHyperlinkColor);
@@ -436,6 +438,23 @@ void SdImportTest::testDocumentLayout()
 }
 }
 
+void SdImportTest::testTdf142590()
+{
+::sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf142590.pptx"), 
PPTX);
+
+uno::Reference xPresentationSupplier(
+xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW);
+uno::Reference 
xPresentationProps(xPresentationSupplier->getPresentation(),
+   
uno::UNO_QUERY_THROW);
+const OUString sCustomShowId
+= xPresentationProps->getPropertyValue("CustomShow").get();
+
+CPPUNIT_ASSERT(!sCustomShowId.isEmpty());
+
+xDocShRef->DoClose();
+}
+
 void SdImportTest::testCustomSlideShow()
 {
 ::sd::DrawDocShellRef xDocShRef
___
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

2021-06-19 Thread Noel Grandin (via logerrit)
 include/oox/helper/graphichelper.hxx |5 ++-
 oox/source/helper/graphichelper.cxx  |   54 ++-
 2 files changed, 26 insertions(+), 33 deletions(-)

New commits:
commit 8fa14ac550ddc43790b65858f18d23f522aff1f2
Author: Noel Grandin 
AuthorDate: Fri Jun 18 16:24:11 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Jun 19 18:08:51 2021 +0200

fix loading calc files with embedded form macros

GraphicHelper was trying to use the current frame/
window to convert values, but during initial load
there is no current window.

Change-Id: I8a79501df1d2e83a13d3cfb64ae8e66152c60561
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117470
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/oox/helper/graphichelper.hxx 
b/include/oox/helper/graphichelper.hxx
index 50c54175db93..6e6a255d9bd6 100644
--- a/include/oox/helper/graphichelper.hxx
+++ b/include/oox/helper/graphichelper.hxx
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 
 struct WmfExternal;
 
@@ -46,6 +47,7 @@ namespace com::sun::star {
 namespace graphic { class XGraphicProvider; }
 namespace uno { class XComponentContext; }
 }
+class OutputDevice;
 
 namespace oox {
 
@@ -105,6 +107,7 @@ public:
 /** Converts the passed size from 1/100 mm to AppFont units. */
 css::awt::Size convertHmmToAppFont( const css::awt::Size& rHmm ) const;
 
+
 // Graphics and graphic objects  --
 
 /** Imports a graphic from the passed input stream. */
@@ -134,7 +137,7 @@ private:
 
 css::uno::Reference< css::uno::XComponentContext > mxContext;
 css::uno::Reference< css::graphic::XGraphicProvider2 > mxGraphicProvider;
-css::uno::Reference< css::awt::XUnitConversion > mxUnitConversion;
+VclPtr mxDefaultOutputDevice;
 css::awt::DeviceInfo maDeviceInfo; ///< Current output device info.
 ::std::map< sal_Int32, ::Color >  maSystemPalette;  ///< Maps system 
colors (XML tokens) to RGB color values.
 StorageRef  mxStorage;  ///< Storage containing 
embedded graphics.
diff --git a/oox/source/helper/graphichelper.cxx 
b/oox/source/helper/graphichelper.cxx
index 52273f6f..7bc3178173e3 100644
--- a/oox/source/helper/graphichelper.cxx
+++ b/oox/source/helper/graphichelper.cxx
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -60,7 +61,7 @@ sal_Int32 lclConvertScreenPixelToHmm( double fPixel, double 
fPixelPerHmm )
 
 } // namespace
 
-GraphicHelper::GraphicHelper( const Reference< XComponentContext >& rxContext, 
const Reference< XFrame >& rxTargetFrame, const StorageRef& rxStorage ) :
+GraphicHelper::GraphicHelper( const Reference< XComponentContext >& rxContext, 
const Reference< XFrame >& /*rxTargetFrame*/, const StorageRef& rxStorage ) :
 mxContext( rxContext ),
 mxStorage( rxStorage )
 {
@@ -100,35 +101,15 @@ GraphicHelper::GraphicHelper( const Reference< 
XComponentContext >& rxContext, c
 maSystemPalette[ XML_windowFrame ]  = Color(0x00);
 maSystemPalette[ XML_windowText ]   = Color(0x00);
 
-// if no target frame has been passed (e.g. OLE objects), try to fallback 
to the active frame
-// TODO: we need some mechanism to keep and pass the parent frame
-Reference< XFrame > xFrame = rxTargetFrame;
-if( !xFrame.is() && mxContext.is() ) try
-{
-Reference< XDesktop2 > xFramesSupp = Desktop::create( mxContext );
-xFrame = xFramesSupp->getActiveFrame();
-}
-catch( Exception& )
-{
-}
-
-// get the metric of the output device
-OSL_ENSURE( xFrame.is(), "GraphicHelper::GraphicHelper - cannot get target 
frame" );
-// some default just in case, 100 000 is 1 meter in MM100
-Size aDefault = Application::GetDefaultDevice()->LogicToPixel(Size(10, 
10), MapMode(MapUnit::Map100thMM));
+// Note that we cannot try to get DeviceInfo from the current frame here,
+// because there might not be a current frame yet
+mxDefaultOutputDevice = Application::GetDefaultDevice();
+maDeviceInfo = mxDefaultOutputDevice->GetDeviceInfo();
+// 100 000 is 1 meter in MM100.
+// various unit tests rely on these values being exactly this and not the 
"true" values
+Size aDefault = mxDefaultOutputDevice->LogicToPixel(Size(10, 10), 
MapMode(MapUnit::Map100thMM));
 maDeviceInfo.PixelPerMeterX = aDefault.Width();
 maDeviceInfo.PixelPerMeterY = aDefault.Height();
-if( xFrame.is() ) try
-{
-Reference< awt::XDevice > xDevice( xFrame->getContainerWindow(), 
UNO_QUERY_THROW );
-mxUnitConversion.set( xDevice, UNO_QUERY );
-OSL_ENSURE( mxUnitConversion.is(), "GraphicHelper::GraphicHelper - 
cannot get unit converter" );
-maDeviceInfo = xDevice->getInfo();
-}
-catch( Exception& )
-{
-OSL_FAIL( "GraphicHelper::GraphicHelper - cannot get 

[Libreoffice-commits] core.git: include/oox oox/source

2021-06-16 Thread Sarper Akdemir (via logerrit)
 include/oox/export/drawingml.hxx |   18 ++
 oox/source/export/drawingml.cxx  |  108 ---
 2 files changed, 97 insertions(+), 29 deletions(-)

New commits:
commit ba66d49db89678628975b29612c0caab49457adf
Author: Sarper Akdemir 
AuthorDate: Wed Jun 9 07:34:32 2021 +0300
Commit: Miklos Vajna 
CommitDate: Wed Jun 16 14:34:14 2021 +0200

tdf#59323: pptx export: add datetime field type helpers

Creates helper functions to convert from LO time and date formats to 
datetime
fields on OOXML

Change-Id: Ibbfefa18d0422eddb6c37539294ed23e77fe5f22
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117009
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 2876d59c5367..7f6de9f99006 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -46,6 +46,8 @@
 
 class Graphic;
 class SdrObjCustomShape;
+enum class SvxDateFormat;
+enum class SvxTimeFormat;
 
 namespace com::sun::star {
 namespace awt {
@@ -166,6 +168,22 @@ protected:
   const css::uno::Reference< css::beans::XPropertyState >& 
rXPropState,
   const OUString& aName, css::beans::PropertyState& eState );
 OUString GetFieldValue( const css::uno::Reference< css::text::XTextRange 
>& rRun, bool& bIsURLField );
+/** Gets OOXML datetime field type from LO Date format
+
+@param eDate LO Date format
+*/
+static OUString GetDatetimeTypeFromDate(SvxDateFormat eDate);
+/** Gets OOXML datetime field type from LO Time format
+
+@param eTime LO Time format
+*/
+static OUString GetDatetimeTypeFromTime(SvxTimeFormat eTime);
+/** Gets OOXML datetime field type from combination of LO Time and Date 
formats
+
+@param eDate LO Date format
+@param eTime LO Time format
+*/
+static OUString GetDatetimeTypeFromDateTime(SvxDateFormat eDate, 
SvxTimeFormat eTime);
 
 /// Output the media (including copying a video from vnd.sun.star.Package: 
to the output if necessary).
 void WriteMediaNonVisualProperties(const 
css::uno::Reference& xShape);
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 5f42dc18cd75..26598636efbd 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2286,40 +2286,13 @@ OUString DrawingML::GetFieldValue( const 
css::uno::Reference< css::text::XTextRa
 {
 sal_Int32 nNumFmt = -1;
 rXPropSet->getPropertyValue(UNO_TC_PROP_NUMFORMAT) >>= 
nNumFmt;
-switch(static_cast(nNumFmt))
-{
-case SvxDateFormat::StdSmall:
-case SvxDateFormat::A: aFieldValue = "datetime"; // 
13/02/96
-  break;
-case SvxDateFormat::B: aFieldValue = "datetime1"; // 
13/02/1996
-  break;
-case SvxDateFormat::StdBig:
-case SvxDateFormat::D: aFieldValue = "datetime3"; // 
13 February 1996
-  break;
-default: break;
-}
+aFieldValue = 
GetDatetimeTypeFromDate(static_cast(nNumFmt));
 }
 else if(aFieldKind == "ExtTime")
 {
 sal_Int32 nNumFmt = -1;
 rXPropSet->getPropertyValue(UNO_TC_PROP_NUMFORMAT) >>= 
nNumFmt;
-switch(static_cast(nNumFmt))
-{
-case SvxTimeFormat::Standard:
-case SvxTimeFormat::HH24_MM_SS:
-aFieldValue = "datetime11"; // 13:49:38
-break;
-case SvxTimeFormat::HH24_MM:
-aFieldValue = "datetime10"; // 13:49
-break;
-case SvxTimeFormat::HH12_MM:
-aFieldValue = "datetime12"; // 01:49 PM
-break;
-case SvxTimeFormat::HH12_MM_SS:
-aFieldValue = "datetime13"; // 01:49:38 PM
-break;
-default: break;
-}
+aFieldValue = 
GetDatetimeTypeFromTime(static_cast(nNumFmt));
 }
 else if(aFieldKind == "ExtFile")
 {
@@ -2346,6 +2319,83 @@ OUString DrawingML::GetFieldValue( const 
css::uno::Reference< css::text::XTextRa
 return aFieldValue;
 }
 
+OUString DrawingML::GetDatetimeTypeFromDate(SvxDateFormat eDate)
+{
+return GetDatetimeTypeFromDateTime(eDate, SvxTimeFormat::AppDefault);
+}
+
+OUString DrawingML::GetDatetimeTypeFromTime(SvxTimeFormat eTime)
+{
+   

[Libreoffice-commits] core.git: include/oox oox/source

2021-06-14 Thread Sarper Akdemir (via logerrit)
 include/oox/ppt/pptshape.hxx |7 +++
 oox/source/ppt/pptshape.cxx  |1 +
 oox/source/ppt/pptshapepropertiescontext.cxx |5 +
 3 files changed, 13 insertions(+)

New commits:
commit cc7c0387506b546333d5951af98dcfb0fbf75c55
Author: Sarper Akdemir 
AuthorDate: Sun May 9 20:08:47 2021 +0300
Commit: Miklos Vajna 
CommitDate: Mon Jun 14 14:42:35 2021 +0200

tdf#59323: ooxml import: hasNonInheritedShapeProperties

Introduces hasNonInheritedShapeProperties helper to PPTShape.

If the shape has something imported from it's spPr tag
mbHasNoninheritedShapeProperties set to true.

Change-Id: I0529f1def8d2c32d5bf06172ce44facdde92893c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117003
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/include/oox/ppt/pptshape.hxx b/include/oox/ppt/pptshape.hxx
index f452e585abcf..d27a116e2783 100644
--- a/include/oox/ppt/pptshape.hxx
+++ b/include/oox/ppt/pptshape.hxx
@@ -51,6 +51,8 @@ class PPTShape final : public oox::drawingml::Shape
 boolmbReferenced;   // placeholdershapes 
on Layout are displayed only, if they are not referenced
 // placeholdershapes 
on Slide are displayed always
 oox::drawingml::ShapePtr mpPlaceholder;
+/// Set if spPr tag is non empty for the shape
+bool mbHasNoninheritedShapeProperties;
 
 public:
 
@@ -73,6 +75,11 @@ public:
 void setPlaceholder( oox::drawingml::ShapePtr pPlaceholder ) { 
mpPlaceholder = pPlaceholder; }
 void setModelId( const OUString& rId ) { msModelId = rId; }
 
+/// Flags shape as having a non-empty spPr tag
+void setHasNoninheritedShapeProperties() { 
mbHasNoninheritedShapeProperties = true; }
+/// Returns whether or not the shape had a non-empty spPr tag
+bool hasNonInheritedShapeProperties() const { return 
mbHasNoninheritedShapeProperties; }
+
 static oox::drawingml::ShapePtr findPlaceholder( const sal_Int32 
nFirstSubType,
 const sal_Int32 nSecondSubType, const OptValue< sal_Int32 >& 
oSubTypeIndex,
 std::vector< oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly 
= false );
diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index 1756ad9e32ab..4e07ae104db3 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -50,6 +50,7 @@ PPTShape::PPTShape( const oox::ppt::ShapeLocation 
eShapeLocation, const char* pS
 : Shape( pServiceName )
 , meShapeLocation( eShapeLocation )
 , mbReferenced( false )
+, mbHasNoninheritedShapeProperties( false )
 {
 }
 
diff --git a/oox/source/ppt/pptshapepropertiescontext.cxx 
b/oox/source/ppt/pptshapepropertiescontext.cxx
index 128272054b21..70ef2fcef872 100644
--- a/oox/source/ppt/pptshapepropertiescontext.cxx
+++ b/oox/source/ppt/pptshapepropertiescontext.cxx
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace oox::core;
 using namespace ::com::sun::star;
@@ -35,6 +36,10 @@ PPTShapePropertiesContext::PPTShapePropertiesContext( 
ContextHandler2Helper cons
 
 ContextHandlerRef PPTShapePropertiesContext::onCreateContext( sal_Int32 
aElementToken, const AttributeList& rAttribs )
 {
+PPTShape* pPPTShape = dynamic_cast();
+if (pPPTShape)
+pPPTShape->setHasNoninheritedShapeProperties();
+
 switch( aElementToken )
 {
 case A_TOKEN( xfrm ):
___
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 sd/qa sd/source

2021-06-08 Thread Tibor Nagy (via logerrit)
 include/oox/token/relationship.hxx   |1 
 oox/source/token/relationship.inc|1 
 sd/qa/unit/export-tests-ooxml1.cxx   |   16 +++
 sd/source/filter/eppt/epptooxml.hxx  |2 +
 sd/source/filter/eppt/pptx-epptooxml.cxx |   32 +++
 5 files changed, 52 insertions(+)

New commits:
commit 312334f8488a668e9b5302959b60292ce151e4fc
Author: Tibor Nagy 
AuthorDate: Tue Jun 1 20:09:07 2021 +0200
Commit: László Németh 
CommitDate: Tue Jun 8 16:37:40 2021 +0200

tdf#47365 PPTX export: support loop attribute

Follow-up to commit ad2809b4b6dc4837b0c1cadd89a14a234d995fb2
"tdf#47365: import support for PPTX presentation's loop attribute".

Change-Id: I7f75acc2bbd6301384883691d5ef4069b1757a05
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116560
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/token/relationship.hxx 
b/include/oox/token/relationship.hxx
index 3f798b1b2529..3c3a4336fe25 100644
--- a/include/oox/token/relationship.hxx
+++ b/include/oox/token/relationship.hxx
@@ -52,6 +52,7 @@ enum class Relationship
 OFFICEDOCUMENT,
 OLEOBJECT,
 PACKAGE,
+PRESPROPS,
 SETTINGS,
 SHAREDSTRINGS,
 SLIDE,
diff --git a/oox/source/token/relationship.inc 
b/oox/source/token/relationship.inc
index f54962715fab..4a772671a96f 100644
--- a/oox/source/token/relationship.inc
+++ b/oox/source/token/relationship.inc
@@ -32,6 +32,7 @@
 {Relationship::OFFICEDOCUMENT, 
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"},
 {Relationship::OLEOBJECT, 
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"},
 {Relationship::PACKAGE, 
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"},
+{Relationship::PRESPROPS, 
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/presProps"},
 {Relationship::SETTINGS, 
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings"},
 {Relationship::SHAREDSTRINGS, 
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings"},
 {Relationship::SLIDE, 
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide"},
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx 
b/sd/qa/unit/export-tests-ooxml1.cxx
index d5c2d8d41a31..a450e6d890eb 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -61,6 +61,7 @@ using namespace css;
 class SdOOXMLExportTest1 : public SdModelTestBaseXML
 {
 public:
+void testTdf47365();
 void testTdf125071();
 void testTdf54037();
 void testFdo90607();
@@ -119,6 +120,7 @@ public:
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest1);
 
+CPPUNIT_TEST(testTdf47365);
 CPPUNIT_TEST(testTdf125071);
 CPPUNIT_TEST(testTdf54037);
 CPPUNIT_TEST(testFdo90607);
@@ -204,6 +206,20 @@ void checkFontAttributes( const SdrTextObj* pObj, 
ItemValue nVal, sal_uInt32 nId
 
 }
 
+void SdOOXMLExportTest1::testTdf47365()
+{
+sd::DrawDocShellRef xDocShRef = loadURL( 
m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/loopNoPause.pptx"), PPTX );
+utl::TempFile tempFile;
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+xDocShRef->DoClose();
+
+xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/presProps.xml");
+
+assertXPath(pXmlDoc, "/p:presentationPr/p:showPr", "loop", "1");
+
+assertXPath(pXmlDoc, "/p:presentationPr/p:showPr", "showNarration", "1");
+}
+
 void SdOOXMLExportTest1::testTdf125071()
 {
 sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf125071.pptx"), 
PPTX);
diff --git a/sd/source/filter/eppt/epptooxml.hxx 
b/sd/source/filter/eppt/epptooxml.hxx
index 43beea7ca032..93029f073487 100644
--- a/sd/source/filter/eppt/epptooxml.hxx
+++ b/sd/source/filter/eppt/epptooxml.hxx
@@ -151,6 +151,8 @@ private:
 
 void WriteAuthors();
 
+void WritePresentationProps();
+
 /// If this is PPTM, output the VBA stream.
 void WriteVBA();
 };
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx 
b/sd/source/filter/eppt/pptx-epptooxml.cxx
index a1a6dd6cad5d..6a8502361061 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -50,6 +50,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -71,6 +72,10 @@
   FSNS(XML_xmlns, XML_p15), 
OUStringToOString(this->getNamespaceURL(OOX_NS(p15)), 
RTL_TEXTENCODING_UTF8).getStr(), \
   FSNS(XML_xmlns, XML_mc),  
OUStringToOString(this->getNamespaceURL(OOX_NS(mce)), 
RTL_TEXTENCODING_UTF8).getStr()
 
+// presentationPr namespace
+#define PPRNMSS   FSNS(XML_xmlns, XML_a),   
OUStringToOString(this->getNamespaceURL(OOX_NS(dml)), 
RTL_TEXTENCODING_UTF8).getStr(), \
+  FSNS(XML_xmlns, XML_r),   
OUStringToOString(this->getNamespaceURL(OOX_NS(officeRel)), 

[Libreoffice-commits] core.git: include/oox oox/source sd/qa

2021-05-25 Thread Tibor Nagy (via logerrit)
 include/oox/ppt/presentationfragmenthandler.hxx |1 
 oox/source/ppt/customshowlistcontext.cxx|   23 ++-
 oox/source/ppt/presentationfragmenthandler.cxx  |   49 
 sd/qa/unit/data/pptx/tdf131390.pptx |binary
 sd/qa/unit/import-tests.cxx |   19 +
 5 files changed, 82 insertions(+), 10 deletions(-)

New commits:
commit ecf48b2d4f3e54dbb2c1e295120d73e7b7a11338
Author: Tibor Nagy 
AuthorDate: Wed May 12 12:14:26 2021 +0200
Commit: László Németh 
CommitDate: Tue May 25 15:44:40 2021 +0200

tdf#131390 PPTX: fix custom slide show is not imported.

Change-Id: I62e1bfaae23d1b18e71a2c16651d01144a26907c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115475
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/ppt/presentationfragmenthandler.hxx 
b/include/oox/ppt/presentationfragmenthandler.hxx
index bc68b738b5dd..a9bb5bb67a77 100644
--- a/include/oox/ppt/presentationfragmenthandler.hxx
+++ b/include/oox/ppt/presentationfragmenthandler.hxx
@@ -51,6 +51,7 @@ private:
 const oox::ppt::SlidePersistPtr& rPersist );
 void importSlide(sal_uInt32 nSlide, bool bFirstSlide, bool bImportNotes);
 void saveThemeToGrabBag(const oox::drawingml::ThemePtr& pThemePtr, 
sal_Int32 nThemeIdx);
+void importCustomSlideShow(std::vector& rCustomShowList);
 
 std::vector< OUString > maSlideMasterVector;
 std::vector< OUString > maSlidesVector;
diff --git a/oox/source/ppt/customshowlistcontext.cxx 
b/oox/source/ppt/customshowlistcontext.cxx
index 174ca1bbe91a..1e6befd639ae 100644
--- a/oox/source/ppt/customshowlistcontext.cxx
+++ b/oox/source/ppt/customshowlistcontext.cxx
@@ -33,12 +33,12 @@ namespace {
 
 class CustomShowContext : public ::oox::core::FragmentHandler2
 {
-CustomShow mrCustomShow;
+std::vector< CustomShow >& mrCustomShowList;
 
 public:
 CustomShowContext( ::oox::core::FragmentHandler2 const & rParent,
 const css::uno::Reference< css::xml::sax::XFastAttributeList >& 
xAttribs,
-CustomShow const & rCustomShow );
+std::vector< CustomShow >& rCustomShowList );
 
 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 
aElementToken, const AttributeList& rAttribs ) override;
 };
@@ -47,12 +47,14 @@ public:
 
 CustomShowContext::CustomShowContext( FragmentHandler2 const & rParent,
 const Reference< XFastAttributeList >& rxAttribs,
-CustomShow const & rCustomShow )
+std::vector< CustomShow >& rCustomShowList )
 : FragmentHandler2( rParent )
-, mrCustomShow( rCustomShow )
+, mrCustomShowList( rCustomShowList )
 {
-mrCustomShow.maCustomShowName = rxAttribs->getOptionalValue( XML_name );
-mrCustomShow.mnId = rxAttribs->getOptionalValue( XML_id );
+CustomShow aCustomShow;
+aCustomShow.maCustomShowName = rxAttribs->getOptionalValue( XML_name );
+aCustomShow.mnId = rxAttribs->getOptionalValue( XML_id );
+mrCustomShowList.push_back(aCustomShow);
 }
 
 ::oox::core::ContextHandlerRef CustomShowContext::onCreateContext( sal_Int32 
aElementToken, const AttributeList& rAttribs )
@@ -60,7 +62,10 @@ CustomShowContext::CustomShowContext( FragmentHandler2 const 
& rParent,
 switch( aElementToken )
 {
 case PPT_TOKEN( sld ) :
-mrCustomShow.maSldLst.push_back( rAttribs.getString( R_TOKEN( id 
), OUString() ) );
+mrCustomShowList.back().maSldLst.push_back(
+getRelations()
+.getRelationFromRelId(rAttribs.getString(R_TOKEN(id), 
OUString()))
+->maTarget);
 return this;
 default:
 break;
@@ -86,9 +91,7 @@ CustomShowListContext::~CustomShowListContext( )
 {
 case PPT_TOKEN( custShow ) :
 {
-CustomShow aCustomShow;
-mrCustomShowList.push_back( aCustomShow );
-return new CustomShowContext( *this, 
rAttribs.getFastAttributeList(), mrCustomShowList.back() );
+return new CustomShowContext( *this, 
rAttribs.getFastAttributeList(), mrCustomShowList );
 }
 default:
 break;
diff --git a/oox/source/ppt/presentationfragmenthandler.cxx 
b/oox/source/ppt/presentationfragmenthandler.cxx
index a00b825d8c00..9aabd45d18af 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -35,6 +35,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -158,6 +162,49 @@ static void ResolveTextFields( XmlFilterBase const & 
rFilter )
 }
 }
 
+void 
PresentationFragmentHandler::importCustomSlideShow(std::vector& 
rCustomShowList)
+{
+PowerPointImport& rFilter = dynamic_cast(getFilter());
+Reference xModel(rFilter.getModel());
+Reference xDrawPagesSupplier(xModel, UNO_QUERY_THROW);
+Reference 

[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source

2021-03-26 Thread Daniel Arato (NISZ) (via logerrit)
 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  , bool bRelPathToMedia = 
false);
+OUString WriteImage( const Graphic  , 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 ++) )
+ .appendAscii( 

[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source

2021-02-22 Thread Michael Stahl (via logerrit)
 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/writer" 

[Libreoffice-commits] core.git: include/oox oox/source

2021-02-21 Thread Noel (via logerrit)
 include/oox/ppt/timenodelistcontext.hxx |2 +-
 oox/source/drawingml/shape.cxx  |2 +-
 oox/source/ppt/timenodelistcontext.cxx  |6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 98173f6222cec22170b53c7d9c94c6ce5b08b4d9
Author: Noel 
AuthorDate: Sun Feb 21 13:30:45 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Feb 21 16:12:44 2021 +0100

loplugin:refcounting in oox..i18npool

Change-Id: Iff904a7ac887fa9b77bea87dbb1012281848a540
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111278
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/oox/ppt/timenodelistcontext.hxx 
b/include/oox/ppt/timenodelistcontext.hxx
index 8bc76b3c185d..cd98d06b15fd 100644
--- a/include/oox/ppt/timenodelistcontext.hxx
+++ b/include/oox/ppt/timenodelistcontext.hxx
@@ -40,7 +40,7 @@ namespace oox::ppt {
 public:
 virtual ~TimeNodeContext() throw() override;
 
-static TimeNodeContext * makeContext( ::oox::core::FragmentHandler2 
const & rParent, sal_Int32  aElement, const css::uno::Reference< 
css::xml::sax::XFastAttributeList >& xAttribs, const TimeNodePtr & pNode );
+static rtl::Reference makeContext( 
::oox::core::FragmentHandler2 const & rParent, sal_Int32  aElement, const 
css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttribs, const 
TimeNodePtr & pNode );
 
 protected:
 TimeNodeContext( ::oox::core::FragmentHandler2 const & rParent, 
sal_Int32  aElement, const TimeNodePtr & pNode ) throw();
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 22cacec6eaa6..469dc7c30c17 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1840,7 +1840,7 @@ void Shape::finalizeXShape( XmlFilterBase& rFilter, const 
Reference< XShapes >&
 // load the chart data from the XML fragment
 bool bMSO2007Doc = rFilter.isMSO2007Document();
 chart::ChartSpaceModel aModel(bMSO2007Doc);
-chart::ChartSpaceFragment *pChartSpaceFragment = new 
chart::ChartSpaceFragment(
+rtl::Reference pChartSpaceFragment 
= new chart::ChartSpaceFragment(
 rFilter, mxChartShapeInfo->maFragmentPath, aModel );
 const OUString aThemeOverrideFragmentPath( 
pChartSpaceFragment->
 
getFragmentPathFromFirstTypeFromOfficeDoc(u"themeOverride") );
diff --git a/oox/source/ppt/timenodelistcontext.cxx 
b/oox/source/ppt/timenodelistcontext.cxx
index 6ecd0985cd0a..93525ae4879a 100644
--- a/oox/source/ppt/timenodelistcontext.cxx
+++ b/oox/source/ppt/timenodelistcontext.cxx
@@ -909,12 +909,12 @@ namespace oox::ppt {
 
 }
 
-TimeNodeContext * TimeNodeContext::makeContext(
+rtl::Reference TimeNodeContext::makeContext(
 FragmentHandler2 const & rParent, sal_Int32  aElement,
 const Reference< XFastAttributeList >& xAttribs,
 const TimeNodePtr & pNode )
 {
-TimeNodeContext *pCtx = nullptr;
+rtl::Reference pCtx;
 switch( aElement )
 {
 case PPT_TOKEN( animClr ):
@@ -1039,7 +1039,7 @@ namespace oox::ppt {
 
 TimeNodePtr pNode = std::make_shared(nNodeType);
 maList.push_back( pNode );
-FragmentHandler2 * pContext = TimeNodeContext::makeContext( *this, 
aElementToken, rAttribs.getFastAttributeList(), pNode );
+rtl::Reference pContext = 
TimeNodeContext::makeContext( *this, aElementToken, 
rAttribs.getFastAttributeList(), pNode );
 
 return pContext ? pContext : this;
 }
___
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

2020-12-21 Thread Luboš Luňák (via logerrit)
 include/oox/helper/graphichelper.hxx |7 ---
 oox/source/helper/graphichelper.cxx  |   67 ---
 oox/source/ppt/pptimport.cxx |   41 -
 3 files changed, 115 deletions(-)

New commits:
commit afa3dff9c7b963f1d312ef8c2efcbc8ab7271e62
Author: Luboš Luňák 
AuthorDate: Fri Dec 18 11:17:53 2020 +0100
Commit: Luboš Luňák 
CommitDate: Mon Dec 21 12:57:43 2020 +0100

do not preload all images in the pptx importer

Now with my GraphicFilter::MakeGraphicsAvailableThreaded() patches
for Impress images will be loaded in parallel as they are needed,
which should usually be more efficient than loading all of them
immediately.

This basically reverts commits:
b1319842a49cdf6512bbd9e81081e2a9edbd6089
04e27df3c162f1df02f061b94434a38d1eaa3a46
9eb8e2737d3a4d52ce1b0cc44091a3b7ecf59e3b

Change-Id: I46bb0d6d93fb69f03f464308f6fce1603aafdfd8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107945
Tested-by: Luboš Luňák 
Reviewed-by: Luboš Luňák 

diff --git a/include/oox/helper/graphichelper.hxx 
b/include/oox/helper/graphichelper.hxx
index 9a99647589b2..50c54175db93 100644
--- a/include/oox/helper/graphichelper.hxx
+++ b/include/oox/helper/graphichelper.hxx
@@ -113,10 +113,6 @@ public:
 const css::uno::Reference< css::io::XInputStream 
>& rxInStrm,
 const WmfExternal* pExtHeader = nullptr ) const;
 
-/** Imports graphics from the passed input streams. */
-std::vector< css::uno::Reference >
-importGraphics(const std::vector< 
css::uno::Reference >& rStreams) const;
-
 /** Imports a graphic from the passed binary memory block. */
 css::uno::Reference< css::graphic::XGraphic >
 importGraphic( const StreamDataSequence& rGraphicData 
) const;
@@ -127,9 +123,6 @@ public:
 const OUString& rStreamName,
 const WmfExternal* pExtHeader = nullptr ) const;
 
-/** Imports graphics from the storage with the passed stream names. */
-void importEmbeddedGraphics(const std::vector& rStreamNames) 
const;
-
 /** calculates the original size of a graphic which is necessary to be 
able to calculate cropping values
 @return The original Graphic size in 100thmm */
 css::awt::Size getOriginalSize( const css::uno::Reference< 
css::graphic::XGraphic >& rxGraphic ) const;
diff --git a/oox/source/helper/graphichelper.cxx 
b/oox/source/helper/graphichelper.cxx
index e8a1c94326a7..82978a76451e 100644
--- a/oox/source/helper/graphichelper.cxx
+++ b/oox/source/helper/graphichelper.cxx
@@ -35,7 +35,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -277,27 +276,6 @@ Reference< XGraphic > GraphicHelper::importGraphic( const 
Reference< XInputStrea
 return xGraphic;
 }
 
-std::vector< uno::Reference > 
GraphicHelper::importGraphics(const std::vector< 
uno::Reference >& rStreams) const
-{
-std::vector< uno::Sequence > aArgsVec;
-
-for (const auto& rStream : rStreams)
-{
-uno::Sequence aArgs = 
comphelper::InitPropertySequence(
-{
-{"InputStream", uno::makeAny(rStream)}
-});
-aArgsVec.push_back(aArgs);
-}
-
-std::vector< uno::Reference > aRet;
-
-if (mxGraphicProvider.is())
-aRet = comphelper::sequenceToContainer< std::vector< 
uno::Reference > 
>(mxGraphicProvider->queryGraphics(comphelper::containerToSequence(aArgsVec)));
-
-return aRet;
-}
-
 Reference< XGraphic > GraphicHelper::importGraphic( const StreamDataSequence& 
rGraphicData ) const
 {
 Reference< XGraphic > xGraphic;
@@ -309,51 +287,6 @@ Reference< XGraphic > GraphicHelper::importGraphic( const 
StreamDataSequence& rG
 return xGraphic;
 }
 
-void GraphicHelper::importEmbeddedGraphics(const std::vector& 
rStreamNames) const
-{
-// Don't actually return anything, just fill maEmbeddedGraphics.
-
-// Stream names and streams to be imported.
-std::vector aMissingStreamNames;
-std::vector< uno::Reference > aMissingStreams;
-
-initializeGraphicMapperIfNeeded();
-
-SAL_WARN_IF(!mxGraphicMapper.is(), "oox", 
"GraphicHelper::importEmbeddedGraphic - graphic mapper not available");
-
-for (const auto& rStreamName : rStreamNames)
-{
-
-if (rStreamName.isEmpty())
-{
-SAL_WARN("oox", "GraphicHelper::importEmbeddedGraphics - empty 
stream name");
-continue;
-}
-
-Reference xGraphic;
-
-xGraphic = mxGraphicMapper->findGraphic(rStreamName);
-
-if (!xGraphic.is())
-{
-aMissingStreamNames.push_back(rStreamName);
-aMissingStreams.push_back(mxStorage->openInputStream(rStreamName));
-}
-}
-
-std::vector< uno::Reference > aGraphics = 
importGraphics(aMissingStreams);
-
-
-assert(aGraphics.size() == 

[Libreoffice-commits] core.git: include/oox oox/source sw/qa

2020-10-26 Thread Regényi Balázs (via logerrit)
 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

2020-10-13 Thread Regényi Balázs (via logerrit)
 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

2020-09-23 Thread Regényi Balázs (via logerrit)
 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

2020-09-21 Thread Gülşah Köse (via logerrit)
 include/oox/export/chartexport.hxx |2 +-
 oox/source/export/chartexport.cxx  |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit de59062d95605e5c91d687e3441399ffb05ff2dc
Author: Gülşah Köse 
AuthorDate: Fri Sep 18 15:45:17 2020 +0300
Commit: Gülşah Köse 
CommitDate: Mon Sep 21 09:33:19 2020 +0200

tdf#136247 Change element order of data labels

Reference OOXML (Appendix B.5.1, line 248)

Change-Id: Idf5c2546b4ad65c8e78ca03e18ecfa575ef17fe8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103005
Tested-by: Jenkins
Reviewed-by: Gülşah Köse 

diff --git a/include/oox/export/chartexport.hxx 
b/include/oox/export/chartexport.hxx
index 5faaf42cb1d1..b900c68b51a2 100644
--- a/include/oox/export/chartexport.hxx
+++ b/include/oox/export/chartexport.hxx
@@ -179,7 +179,6 @@ private:
 void exportSeriesValues(
 const css::uno::Reference< css::chart2::data::XDataSequence >& 
xValueSeq, sal_Int32 nValueType = XML_val );
 void exportShapeProps( const css::uno::Reference< css::beans::XPropertySet 
>& xPropSet );
-void exportTextProps(const css::uno::Reference< css::beans::XPropertySet 
>& xPropSet);
 void exportDataPoints(
 const css::uno::Reference< css::beans::XPropertySet >& 
xSeriesProperties,
 sal_Int32 nSeriesLength, sal_Int32 eChartType );
@@ -224,6 +223,7 @@ public:
 const css::uno::Reference< css::frame::XModel >& getModel() const { return 
mxChartModel; }
 
 void WriteChartObj( const css::uno::Reference< css::drawing::XShape >& 
xShape, sal_Int32 nID, sal_Int32 nChartCount );
+void exportTextProps(const css::uno::Reference< css::beans::XPropertySet 
>& xPropSet);
 
 void ExportContent();
 void InitRangeSegmentationProperties(
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 4d830f37c6ba..fd33d9a38bc8 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -3450,6 +3450,8 @@ void writeLabelProperties( const FSHelperPtr& pFS, 
ChartExport* pChartExport,
 pFS->endElement(FSNS(XML_c, XML_spPr));
 }
 
+pChartExport->exportTextProps(xPropSet);
+
 if (aCustomLabelFields.hasElements())
 writeCustomLabel(pFS, pChartExport, aCustomLabelFields);
 
@@ -3616,12 +3618,10 @@ void ChartExport::exportDataLabels(
 }
 
 // Individual label property that overwrites the baseline.
-exportTextProps( xLabelPropSet );
 writeLabelProperties(pFS, this, xLabelPropSet, aParam);
 pFS->endElement(FSNS(XML_c, XML_dLbl));
 }
 
-exportTextProps( xPropSet );
 // Baseline label properties for all labels.
 writeLabelProperties(pFS, this, xPropSet, aParam);
 
___
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 sd/qa

2020-09-11 Thread Miklos Vajna (via logerrit)
 include/oox/core/xmlfilterbase.hxx  |   12 
 include/oox/drawingml/shape.hxx |8 ++
 oox/source/core/xmlfilterbase.cxx   |8 ++
 oox/source/drawingml/diagram/diagram.cxx|9 ++-
 oox/source/drawingml/diagram/diagram.hxx|   14 +++--
 oox/source/drawingml/diagram/diagramlayoutatoms.cxx |   26 +
 oox/source/drawingml/diagram/diagramlayoutatoms.hxx |   12 ++--
 oox/source/drawingml/shape.cxx  |   55 
 oox/source/ppt/pptshape.cxx |   13 
 sd/qa/unit/data/pptx/smartart-autofit-sync.pptx |binary
 sd/qa/unit/import-tests-smartart.cxx|   30 ++
 11 files changed, 176 insertions(+), 11 deletions(-)

New commits:
commit 1bd3474c7c7945e1182dfbaca89be05ea98dd3e8
Author: Miklos Vajna 
AuthorDate: Fri Sep 11 17:30:27 2020 +0200
Commit: Miklos Vajna 
CommitDate: Fri Sep 11 20:07:17 2020 +0200

oox smartart: add support for syncing font heights of multiple shapes

When 2 or more shapes have their text set to autofit and they have a
constraint like:



Then make sure that the automatic font size is the same for all shapes
and all content fits, by using the smallest scaling factor from all
relevant shapes.

Some rework is needed, because normally oox::drawingml::Shapes don't
have access to their parents, at the same time there can be multiple
SmartArts on a single slide, so storing the grouping info in the filter
is problematic, too. Solve this by storing the grouping in the toplevel
oox::drawingml::Shape and exposing them in XmlFilterBase just during the
time the children of the toplevel shape of the SmartArt are added.

This works, because we know SmartArts can't be nested.

Change-Id: I6c591eadc7166c7c42752650afdb7ee1e416cff6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102490
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/include/oox/core/xmlfilterbase.hxx 
b/include/oox/core/xmlfilterbase.hxx
index bad90cc0d132..99b73e5b18bd 100644
--- a/include/oox/core/xmlfilterbase.hxx
+++ b/include/oox/core/xmlfilterbase.hxx
@@ -64,6 +64,11 @@ namespace sax_fastparser {
 
 namespace utl { class MediaDescriptor; }
 
+namespace oox::drawingml
+{
+class Shape;
+}
+
 namespace oox::core {
 
 class FragmentHandler;
@@ -78,6 +83,10 @@ typedef std::vector< TextField > TextFieldStack;
 
 struct XmlFilterBaseImpl;
 
+using ShapePairs
+= std::map, 
css::uno::Reference>;
+using NamedShapePairs = std::map;
+
 class OOX_DLLPUBLIC XmlFilterBase : public FilterBase
 {
 public:
@@ -241,6 +250,9 @@ public:
 /// user about it.
 void setMissingExtDrawing();
 
+void setDiagramFontHeights(NamedShapePairs* pDiagramFontHeights);
+NamedShapePairs* getDiagramFontHeights();
+
 void checkDocumentProperties(
 const css::uno::Reference& 
xDocProps);
 
diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index b1f15e5b6ece..fea94105b65d 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -29,6 +29,8 @@
 #include 
 #include 
 #include 
+
+#include 
 #include 
 #include 
 #include 
@@ -239,6 +241,8 @@ public:
 
 void keepDiagramDrawing(::oox::core::XmlFilterBase& rFilterBase, const 
OUString& rFragmentPath);
 
+oox::core::NamedShapePairs& getDiagramFontHeights() { return 
maDiagramFontHeights; }
+
 protected:
 
 enum FrameType
@@ -272,6 +276,7 @@ protected:
 const basegfx::B2DHomMatrix& aTransformation );
 
 voidkeepDiagramCompatibilityInfo();
+void syncDiagramFontHeights();
 voidconvertSmartArtToMetafile( ::oox::core::XmlFilterBase 
const& rFilterBase );
 
 css::uno::Reference< css::drawing::XShape >
@@ -377,6 +382,9 @@ private:
 
 /// The shape fill should be set to that of the slide background surface.
 bool mbUseBgFill = false;
+
+/// For SmartArt, this contains groups of shapes: automatic font size is 
the same in each group.
+oox::core::NamedShapePairs maDiagramFontHeights;
 };
 
 }
diff --git a/oox/source/core/xmlfilterbase.cxx 
b/oox/source/core/xmlfilterbase.cxx
index eae0a4f615fc..adf132dded13 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -175,6 +175,7 @@ struct XmlFilterBaseImpl
 RelationsMap   maRelationsMap;
 TextFieldStack maTextFieldStack;
 const NamespaceMap&mrNamespaceMap;
+NamedShapePairs* mpDiagramFontHeights = nullptr;
 
 /// @throws RuntimeException
 explicitXmlFilterBaseImpl();
@@ -939,6 +940,13 @@ void XmlFilterBase::setMissingExtDrawing()
 mbMissingExtDrawing = true;
 }
 
+void XmlFilterBase::setDiagramFontHeights(NamedShapePairs* pDiagramFontHeights)
+{
+mxImpl->mpDiagramFontHeights = 

[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source

2020-09-11 Thread Attila Bakos (via logerrit)
 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[ 

[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source writerfilter/source

2020-09-03 Thread Daniel Arato (NISZ) (via logerrit)
 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");
+}
+
 

[Libreoffice-commits] core.git: include/oox oox/source sd/qa

2020-08-09 Thread Regina Henschel (via logerrit)
 include/oox/export/chartexport.hxx   |1 
 oox/source/drawingml/chart/objectformatter.cxx   |2 
 oox/source/export/chartexport.cxx|  103 +++-
 sd/qa/unit/data/odp/tdf128345_ChartArea_CG_TS.odp|binary
 sd/qa/unit/data/odp/tdf128345_Chart_CS_TG.odp|binary
 sd/qa/unit/data/odp/tdf128345_Legend_CS_TG_axial.odp |binary
 sd/qa/unit/export-tests-ooxml1.cxx   |  120 +++
 7 files changed, 220 insertions(+), 6 deletions(-)

New commits:
commit acfd9e9ca2dfd76536c072e21c65cb3efc6aac80
Author: Regina Henschel 
AuthorDate: Mon Jul 27 00:31:04 2020 +0200
Commit: Regina Henschel 
CommitDate: Sun Aug 9 12:15:54 2020 +0200

tdf#128345 PPTX: add transparence gradient for fill in chart

Export cases:
Add transparence gradient on solid color fill by treating the
color fill as gradient with identical start and end color.
Add solid transparence on color gradient, by treating transparence
as gradient.
Import: Add missing property PROP_FillTransparenceGradientName to
spnCommonPropIds so that it is available in spObjTypeFormatEntries.
Otherwise transparence gradients will be skipped on import.

Change-Id: I56218ec1afcc5bd1ce0324ca50c03e0b44f76c58
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99464
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/include/oox/export/chartexport.hxx 
b/include/oox/export/chartexport.hxx
index 194e15628aef..5faaf42cb1d1 100644
--- a/include/oox/export/chartexport.hxx
+++ b/include/oox/export/chartexport.hxx
@@ -141,6 +141,7 @@ private:
 void exportPlotArea( const css::uno::Reference<
  css::chart::XChartDocument >& rChartDoc );
 void exportFill( const css::uno::Reference< css::beans::XPropertySet >& 
xPropSet );
+void exportSolidFill(const css::uno::Reference& 
xPropSet);
 void exportGradientFill( const css::uno::Reference< 
css::beans::XPropertySet >& xPropSet );
 void exportBitmapFill( const css::uno::Reference< css::beans::XPropertySet 
>& xPropSet );
 void exportHatch(const css::uno::Reference& 
xPropSet);
diff --git a/oox/source/drawingml/chart/objectformatter.cxx 
b/oox/source/drawingml/chart/objectformatter.cxx
index 326f632e84b3..fd580742c97a 100644
--- a/oox/source/drawingml/chart/objectformatter.cxx
+++ b/oox/source/drawingml/chart/objectformatter.cxx
@@ -447,7 +447,7 @@ const ShapePropertyIds spnCommonPropIds =
 {
 PROP_LineStyle, PROP_LineWidth, PROP_LineColor, PROP_LineTransparence, 
PROP_LineDashName,
 PROP_LineCap, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, 
PROP_INVALID, PROP_INVALID, PROP_INVALID,
-PROP_FillStyle, PROP_FillColor, PROP_FillTransparence, PROP_INVALID, 
PROP_FillGradientName,
+PROP_FillStyle, PROP_FillColor, PROP_FillTransparence, 
PROP_FillTransparenceGradientName, PROP_FillGradientName,
 PROP_FillBitmapName, PROP_FillBitmapMode, PROP_FillBitmapSizeX, 
PROP_FillBitmapSizeY,
 PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, 
PROP_FillBitmapRectanglePoint,
 PROP_FillHatchName, PROP_FillBackground
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 5f8ea80f8c9b..db4af798c867 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -429,6 +429,14 @@ static sal_Int32 lcl_generateRandomValue()
 return comphelper::rng::uniform_int_distribution(0, 1-1);
 }
 
+static sal_Int32 lcl_getAlphaFromTransparenceGradient(const awt::Gradient& 
rGradient, bool bStart)
+{
+// Our alpha is a gray color value.
+sal_uInt8 nRed = ::Color(bStart ? rGradient.StartColor : 
rGradient.EndColor).GetRed();
+// drawingML alpha is a percentage on a 0..10 scale.
+return (255 - nRed) * oox::drawingml::MAX_PERCENT / 255;
+}
+
 ChartExport::ChartExport( sal_Int32 nXmlNamespace, FSHelperPtr pFS, Reference< 
frame::XModel > const & xModel, XmlFilterBase* pFB, DocumentType eDocumentType )
 : DrawingML( std::move(pFS), pFB, eDocumentType )
 , mnXmlNamespace( nXmlNamespace )
@@ -1560,12 +1568,38 @@ void ChartExport::exportManualLayout(const 
css::chart2::RelativePosition& rPos,
 
 void ChartExport::exportFill( const Reference< XPropertySet >& xPropSet )
 {
-if ( !GetProperty( xPropSet, "FillStyle" ) )
+// Similar to DrawingML::WriteFill, but gradient access via name
+if (!GetProperty( xPropSet, "FillStyle" ))
 return;
-FillStyle aFillStyle( FillStyle_NONE );
-xPropSet->getPropertyValue( "FillStyle" ) >>= aFillStyle;
+FillStyle aFillStyle(FillStyle_NONE);
+xPropSet->getPropertyValue("FillStyle") >>= aFillStyle;
+
+// map full transparent background to no fill
+if (aFillStyle == FillStyle_SOLID && GetProperty( xPropSet, 
"FillTransparence" ))
+{
+sal_Int16 nVal = 0;
+xPropSet->getPropertyValue( "FillTransparence" ) >>= nVal;
+if ( nVal 

[Libreoffice-commits] core.git: include/oox oox/source

2020-08-07 Thread Michael Stahl (via logerrit)
 include/oox/export/vmlexport.hxx |3 +++
 oox/source/export/vmlexport.cxx  |   36 ++--
 2 files changed, 29 insertions(+), 10 deletions(-)

New commits:
commit 2af2b9be05a4733c691db7201e76b4058516c47b
Author: Michael Stahl 
AuthorDate: Fri Aug 7 15:45:25 2020 +0200
Commit: Michael Stahl 
CommitDate: Fri Aug 7 18:26:00 2020 +0200

oox: VML export: produce bottom-to-top in a better way

Replace code added in 090c61eb93db4302d4565d5f11f7673190835fdb
with something that uses the already generated ESCHER property; this
lets a warning about the unhandled property disappear too.

Change-Id: Ieed83dd8e17e92eea9901124fce5e6da2a17196a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100332
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx
index c010436499f9..06dbbc57a21c 100644
--- a/include/oox/export/vmlexport.hxx
+++ b/include/oox/export/vmlexport.hxx
@@ -96,6 +96,9 @@ class OOX_DLLPUBLIC VMLExport : public EscherEx
 /// Remember style, the most important shape attribute ;-)
 OStringBuffer m_ShapeStyle;
 
+/// style for textbox
+OStringBuffer m_TextboxStyle;
+
 /// Remember the generated shape id.
 OString m_sShapeId;
 
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 22dcc871ab83..bb5e2b8eee50 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -430,6 +430,28 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, 
const tools::Rectangle&
 bAlreadyWritten[ ESCHER_Prop_WrapText ] = true;
 break;
 
+case ESCHER_Prop_txflTextFlow: // 136
+{
+// at least "bottom-to-top" only has an effect when it's 
on the v:textbox element, not on v:shape
+assert(m_TextboxStyle.isEmpty());
+switch (opt.nPropValue)
+{
+case ESCHER_txflHorzN:
+m_TextboxStyle.append("layout-flow:horizontal");
+break;
+case ESCHER_txflTtoBA:
+m_TextboxStyle.append("layout-flow:vertical");
+break;
+case ESCHER_txflBtoT:
+
m_TextboxStyle.append("mso-layout-flow-alt:bottom-to-top");
+break;
+default:
+assert(false); // unimplemented in escher export
+break;
+}
+}
+break;
+
 // coordorigin
 case ESCHER_Prop_geoLeft: // 320
 case ESCHER_Prop_geoTop: // 321
@@ -1345,6 +1367,8 @@ sal_Int32 VMLExport::StartShape()
 // start of the shape
 m_pSerializer->startElementNS( XML_v, nShapeElement, 
XFastAttributeListRef( m_pShapeAttrList ) );
 
+OString const textboxStyle(m_TextboxStyle.makeStringAndClear());
+
 // now check if we have some editeng text (not associated textbox) and we 
have a text exporter registered
 const SdrTextObj* pTxtObj = dynamic_cast( m_pSdrObject 
);
 if (pTxtObj && m_pTextExport && 
msfilter::util::HasTextBoxContent(m_nShapeType) && 
!IsWaterMarkShape(m_pSdrObject->GetName()) && !lcl_isTextBox(m_pSdrObject))
@@ -1369,19 +1393,11 @@ sal_Int32 VMLExport::StartShape()
 
 if( pParaObj )
 {
-uno::Reference 
xPropertySet(const_cast(m_pSdrObject)->getUnoShape(), 
uno::UNO_QUERY);
 sax_fastparser::FastAttributeList* pTextboxAttrList = 
FastSerializerHelper::createAttrList();
 sax_fastparser::XFastAttributeListRef 
xTextboxAttrList(pTextboxAttrList);
-if 
(xPropertySet->getPropertySetInfo()->hasPropertyByName("RotateAngle"))
+if (!textboxStyle.isEmpty())
 {
-sal_Int32 nTextRotateAngle = sal_Int32();
-if (xPropertySet->getPropertyValue("RotateAngle") >>= 
nTextRotateAngle)
-{
-if (nTextRotateAngle == 9000)
-{
-pTextboxAttrList->add(XML_style, 
"mso-layout-flow-alt:bottom-to-top");
-}
-}
+pTextboxAttrList->add(XML_style, textboxStyle);
 }
 
 // this is reached only in case some text is attached to the shape
___
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 sd/qa

2020-07-09 Thread Regina Henschel (via logerrit)
 include/oox/export/drawingml.hxx   |   13 -
 include/oox/export/shapes.hxx  |1 
 oox/source/drawingml/customshapeproperties.cxx |3 
 oox/source/export/drawingml.cxx|  188 -
 oox/source/export/shapes.cxx   |   53 +---
 sd/qa/unit/data/odp/tdf100348_FontworkBitmapFill.odp   |binary
 sd/qa/unit/data/odp/tdf100348_FontworkGradientGlow.odp |binary
 sd/qa/unit/export-tests-ooxml1.cxx |   37 +++
 8 files changed, 198 insertions(+), 97 deletions(-)

New commits:
commit 005f5db47b8e1bbd7ebddee92009be072e835fd5
Author: Regina Henschel 
AuthorDate: Sat Jul 4 15:11:03 2020 +0200
Commit: Thorsten Behrens 
CommitDate: Fri Jul 10 00:57:22 2020 +0200

tdf#100348 add fill to fontwork in export to pptx

This patch adds fill to the characters in a Fontwork shape in export
to pptx. It does not contain export to docx and not import.

Change-Id: Ie7c8a35380a845f513516636c4f60ee307eacd50
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98187
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 439d817d0449..2760d2fe64a0 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -143,6 +143,7 @@ private:
 /// Parent exporter, used for text callback.
 DMLTextExport* mpTextExport;
 
+
 protected:
 css::uno::Any mAny;
 ::sax_fastparser::FSHelperPtr mpFS;
@@ -166,6 +167,7 @@ protected:
 const char* GetRelationCompPrefix() const;
 
 static bool EqualGradients( css::awt::Gradient aGradient1, 
css::awt::Gradient aGradient2 );
+bool IsFontworkShape(const css::uno::Reference< css::beans::XPropertySet 
>& rXShapePropSet);
 
 void WriteGlowEffect(const css::uno::Reference& 
rXPropSet);
 void WriteSoftEdgeEffect(const 
css::uno::Reference& rXPropSet);
@@ -244,17 +246,20 @@ public:
 void WriteTransformation(const tools::Rectangle& rRectangle,
   sal_Int32 nXmlNamespace, bool bFlipH = false, bool bFlipV = 
false, sal_Int32 nRotation = 0, bool bIsGroupShape = false);
 
-void WriteText( const css::uno::Reference< css::uno::XInterface >& 
rXIface, const OUString& presetWarp, bool bBodyPr, bool bText = true, sal_Int32 
nXmlNamespace = 0);
+void WriteText( const css::uno::Reference< css::uno::XInterface >& 
rXIface, bool bBodyPr, bool bText = true, sal_Int32 nXmlNamespace = 0);
 void WriteParagraph( const css::uno::Reference< css::text::XTextContent >& 
rParagraph,
- bool& rbOverridingCharHeight, sal_Int32& rnCharHeight 
);
+ bool& rbOverridingCharHeight, sal_Int32& 
rnCharHeight, const css::uno::Reference< css::beans::XPropertySet >& 
rXShapePropSet);
 void WriteParagraphProperties(const css::uno::Reference< 
css::text::XTextContent >& rParagraph, float fFirstCharHeight);
 void WriteParagraphNumbering(const css::uno::Reference< 
css::beans::XPropertySet >& rXPropSet, float fFirstCharHeight,
   sal_Int16 nLevel );
 void WriteParagraphTabStops(const 
css::uno::Reference& rXPropSet);
 void WriteRun( const css::uno::Reference< css::text::XTextRange >& rRun,
-   bool& rbOverridingCharHeight, sal_Int32& rnCharHeight );
+   bool& rbOverridingCharHeight, sal_Int32& rnCharHeight,
+   const css::uno::Reference< css::beans::XPropertySet >& 
rXShapePropSet);
 void WriteRunProperties( const css::uno::Reference< 
css::beans::XPropertySet >& rRun, bool bIsField, sal_Int32 nElement, bool 
bCheckDirect,
- bool& rbOverridingCharHeight, sal_Int32& 
rnCharHeight, sal_Int16 nScriptType = css::i18n::ScriptType::LATIN);
+ bool& rbOverridingCharHeight, sal_Int32& 
rnCharHeight,
+ sal_Int16 nScriptType = 
css::i18n::ScriptType::LATIN,
+ const css::uno::Reference< 
css::beans::XPropertySet >& rXShapePropSet = {});
 
 void WritePresetShape( const char* pShape , std::vector< 
std::pair> & rAvList );
 void WritePresetShape( const char* pShape );
diff --git a/include/oox/export/shapes.hxx b/include/oox/export/shapes.hxx
index 53d505f168a2..e95af1eff83e 100644
--- a/include/oox/export/shapes.hxx
+++ b/include/oox/export/shapes.hxx
@@ -102,7 +102,6 @@ private:
 
 ShapeHashMap maShapeMap;
 ShapeHashMap* mpShapeMap;
-OUString m_presetWarp;
 
 public:
 
diff --git a/oox/source/drawingml/customshapeproperties.cxx 
b/oox/source/drawingml/customshapeproperties.cxx
index 00ecf33368ae..1b4d6b4a59f6 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -157,6 +157,9 @@ void CustomShapeProperties::pushToPropSet(
 uno::Any aGeoPropSet = 

[Libreoffice-commits] core.git: include/oox oox/source sd/qa

2020-07-03 Thread Mark Hung (via logerrit)
 include/oox/export/shapes.hxx  |4 ++-
 oox/source/export/shapes.cxx   |   46 -
 sd/qa/unit/data/odp/tdf119223.odp  |binary
 sd/qa/unit/data/xml/tdf90338_0.xml |2 -
 sd/qa/unit/data/xml/tdf92001_0.xml |2 -
 sd/qa/unit/export-tests-ooxml2.cxx |   36 
 6 files changed, 66 insertions(+), 24 deletions(-)

New commits:
commit 7dcc18b5ac79d9a3e7564492428a275bf9b386db
Author: Mark Hung 
AuthorDate: Sun Jun 28 10:57:09 2020 +0800
Commit: Mark Hung 
CommitDate: Sat Jul 4 06:40:55 2020 +0200

tdf#119223 export the object name for pptx documents.

Originally the name was always an object type plus
an index. That not only ignores the existing
object name, but also makes an unnamed object named
in the roundtrip. So here the object name is used
no matter it is empty or not, to keep unamed object
unamed.

Change-Id: Ib29a8fbc1fd67fa9a4a4efbfd0b2e9c4fb50de0a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96908
Tested-by: Jenkins
Reviewed-by: Mark Hung 

diff --git a/include/oox/export/shapes.hxx b/include/oox/export/shapes.hxx
index 2dbbb658c036..53d505f168a2 100644
--- a/include/oox/export/shapes.hxx
+++ b/include/oox/export/shapes.hxx
@@ -87,10 +87,12 @@ public:
 typedef std::unordered_map< css::uno::Reference< css::drawing::XShape>, 
sal_Int32> ShapeHashMap;
 
 protected:
-sal_Int32   mnShapeIdMax, mnPictureIdMax;
+sal_Int32   mnShapeIdMax;
 
 void WriteGraphicObjectShapePart( const css::uno::Reference< 
css::drawing::XShape >& xShape, const Graphic *pGraphic=nullptr );
 
+OUStringGetShapeName(const css::uno::Reference< 
css::drawing::XShape >& xShape);
+
 private:
 sal_Int32   mnXmlNamespace;
 MapMode maMapModeSrc, maMapModeDest;
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 9a6a72b08b0f..3ea0ae57ba6b 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -91,7 +91,6 @@ using ::css::frame::XModel;
 using ::oox::core::XmlFilterBase;
 using ::sax_fastparser::FSHelperPtr;
 
-#define IDS(x) OString(#x " " + OString::number(mnShapeIdMax++)).getStr()
 
 namespace oox {
 
@@ -325,7 +324,6 @@ ShapeExport::ShapeExport( sal_Int32 nXmlNamespace, 
FSHelperPtr pFS, ShapeHashMap
 : DrawingML( std::move(pFS), pFB, eDocumentType, pTextExport )
 , m_nEmbeddedObjects(0)
 , mnShapeIdMax( 1 )
-, mnPictureIdMax( 1 )
 , mnXmlNamespace( nXmlNamespace )
 , maMapModeSrc( MapUnit::Map100thMM )
 , maMapModeDest( MapUnit::MapInch, Point(), Fraction( 1, 576 ), Fraction( 
1, 576 ) )
@@ -416,7 +414,7 @@ ShapeExport& ShapeExport::WritePolyPolygonShape( const 
Reference< XShape >& xSha
 pFS->startElementNS(mnXmlNamespace, XML_nvSpPr);
 pFS->singleElementNS( mnXmlNamespace, XML_cNvPr,
   XML_id, OString::number(GetNewShapeID(xShape)),
-  XML_name, IDS( Freeform ) );
+  XML_name, GetShapeName(xShape).toUtf8());
 }
 pFS->singleElementNS(mnXmlNamespace, XML_cNvSpPr);
 if (GetDocumentType() != DOCUMENT_DOCX)
@@ -477,7 +475,7 @@ ShapeExport& ShapeExport::WriteGroupShape(const 
uno::Reference&
 pFS->startElementNS(mnXmlNamespace, XML_nvGrpSpPr);
 pFS->singleElementNS(mnXmlNamespace, XML_cNvPr,
 XML_id, OString::number(GetNewShapeID(xShape)),
-XML_name, IDS(Group));
+XML_name, GetShapeName(xShape).toUtf8());
 pFS->singleElementNS(mnXmlNamespace, XML_cNvGrpSpPr);
 WriteNonVisualProperties(xShape );
 pFS->endElementNS(mnXmlNamespace, XML_nvGrpSpPr);
@@ -803,7 +801,7 @@ ShapeExport& ShapeExport::WriteCustomShape( const 
Reference< XShape >& xShape )
 pFS->startElementNS( mnXmlNamespace, XML_nvSpPr );
 pFS->startElementNS( mnXmlNamespace, XML_cNvPr,
 XML_id, OString::number(GetNewShapeID(xShape)),
-XML_name, IDS( CustomShape ),
+XML_name, GetShapeName(xShape).toUtf8(),
 XML_hidden, isVisible ? nullptr : "1" );
 
 if( GETA( URL ) )
@@ -1051,7 +1049,7 @@ ShapeExport& ShapeExport::WriteEllipseShape( const 
Reference< XShape >& xShape )
 pFS->startElementNS(mnXmlNamespace, XML_nvSpPr);
 pFS->singleElementNS( mnXmlNamespace, XML_cNvPr,
 XML_id, OString::number(GetNewShapeID(xShape)),
-XML_name, IDS( Ellipse ) );
+XML_name, GetShapeName(xShape).toUtf8());
 pFS->singleElementNS( mnXmlNamespace, XML_cNvSpPr );
 WriteNonVisualProperties( xShape );
 pFS->endElementNS( mnXmlNamespace, XML_nvSpPr );
@@ -1185,11 +1183,9 @@ void ShapeExport::WriteGraphicObjectShapePart( const 
Reference< XShape >& xShape
 
 pFS->startElementNS(mnXmlNamespace, XML_nvPicPr);
 
-OUString sName, sDescr, sURL;
-   

[Libreoffice-commits] core.git: include/oox oox/source

2020-07-01 Thread Stephan Bergmann (via logerrit)
 include/oox/dump/dumperbase.hxx   |4 -
 oox/source/core/xmlfilterbase.cxx |2 
 oox/source/crypto/AgileEngine.cxx |   10 +--
 oox/source/crypto/Standard2007Engine.cxx  |2 
 oox/source/drawingml/chart/chartconverter.cxx |6 +-
 oox/source/drawingml/chart/objectformatter.cxx|   62 +++---
 oox/source/drawingml/chart/typegroupconverter.cxx |4 -
 oox/source/drawingml/customshapegeometry.cxx  |2 
 oox/source/drawingml/presetgeometrynames.cxx  |2 
 oox/source/drawingml/shapepropertymap.cxx |2 
 oox/source/export/vmlexport.cxx   |4 -
 oox/source/helper/modelobjecthelper.cxx   |   10 +--
 oox/source/ole/oleobjecthelper.cxx|2 
 oox/source/ole/vbacontrol.cxx |2 
 oox/source/vml/vmlinputstream.cxx |4 -
 15 files changed, 59 insertions(+), 59 deletions(-)

New commits:
commit 740d87c0cc833a8159d79100f789033750a8427c
Author: Stephan Bergmann 
AuthorDate: Wed Jul 1 13:24:37 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Jul 1 19:50:18 2020 +0200

Upcoming improved loplugin:staticanonymous -> redundantstatic: oox

Change-Id: I1c6a2852e4794529ec7d55ceae485196a8170e24
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97617
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/include/oox/dump/dumperbase.hxx b/include/oox/dump/dumperbase.hxx
index 6b9144646069..21e88b2fc2c7 100644
--- a/include/oox/dump/dumperbase.hxx
+++ b/include/oox/dump/dumperbase.hxx
@@ -384,7 +384,7 @@ public:
 OUString operator()( const char* pcDefault ) const { if( has() ) return 
*this; return String( pcDefault ); }
 };
 
-static const String EMPTY_STRING;
+const String EMPTY_STRING;
 
 
 /** Base class for all dumper classes.
@@ -733,7 +733,7 @@ private:
 mutable NameListRef mxList;
 };
 
-static const NameListWrapper NO_LIST;
+const NameListWrapper NO_LIST;
 
 
 class ItemFormatMap
diff --git a/oox/source/core/xmlfilterbase.cxx 
b/oox/source/core/xmlfilterbase.cxx
index 5c5d5e5076e5..17a12acde6e7 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -180,7 +180,7 @@ struct XmlFilterBaseImpl
 explicitXmlFilterBaseImpl();
 };
 
-static const OUStringLiteral gaBinSuffix( ".bin" );
+const OUStringLiteral gaBinSuffix( ".bin" );
 
 XmlFilterBaseImpl::XmlFilterBaseImpl() :
 mrNamespaceMap(StaticNamespaceMap::get())
diff --git a/oox/source/crypto/AgileEngine.cxx 
b/oox/source/crypto/AgileEngine.cxx
index f4eb9d21ea6f..df3bf4bb19d8 100644
--- a/oox/source/crypto/AgileEngine.cxx
+++ b/oox/source/crypto/AgileEngine.cxx
@@ -187,11 +187,11 @@ public:
 
 constexpr const sal_uInt32 constSegmentLength = 4096;
 
-static const std::vector constBlock1 { 0xfe, 0xa7, 0xd2, 0x76, 
0x3b, 0x4b, 0x9e, 0x79 };
-static const std::vector constBlock2 { 0xd7, 0xaa, 0x0f, 0x6d, 
0x30, 0x61, 0x34, 0x4e };
-static const std::vector constBlock3 { 0x14, 0x6e, 0x0b, 0xe7, 
0xab, 0xac, 0xd0, 0xd6 };
-static const std::vector constBlockHmac1 { 0x5f, 0xb2, 0xad, 0x01, 
0x0c, 0xb9, 0xe1, 0xf6 };
-static const std::vector constBlockHmac2 { 0xa0, 0x67, 0x7f, 0x02, 
0xb2, 0x2c, 0x84, 0x33 };
+const std::vector constBlock1 { 0xfe, 0xa7, 0xd2, 0x76, 0x3b, 0x4b, 
0x9e, 0x79 };
+const std::vector constBlock2 { 0xd7, 0xaa, 0x0f, 0x6d, 0x30, 0x61, 
0x34, 0x4e };
+const std::vector constBlock3 { 0x14, 0x6e, 0x0b, 0xe7, 0xab, 0xac, 
0xd0, 0xd6 };
+const std::vector constBlockHmac1 { 0x5f, 0xb2, 0xad, 0x01, 0x0c, 
0xb9, 0xe1, 0xf6 };
+const std::vector constBlockHmac2 { 0xa0, 0x67, 0x7f, 0x02, 0xb2, 
0x2c, 0x84, 0x33 };
 
 bool hashCalc(std::vector& output,
   std::vector& input,
diff --git a/oox/source/crypto/Standard2007Engine.cxx 
b/oox/source/crypto/Standard2007Engine.cxx
index 2aaf6f4ec3f3..2799ec5286f9 100644
--- a/oox/source/crypto/Standard2007Engine.cxx
+++ b/oox/source/crypto/Standard2007Engine.cxx
@@ -32,7 +32,7 @@ void lclRandomGenerateValues(sal_uInt8* aArray, sal_uInt32 
aSize)
 rtl_random_destroyPool(aRandomPool);
 }
 
-static const OUString lclCspName = "Microsoft Enhanced RSA and AES 
Cryptographic Provider";
+const OUString lclCspName = "Microsoft Enhanced RSA and AES Cryptographic 
Provider";
 constexpr const sal_uInt32 AES128Size = 16;
 
 } // end anonymous namespace
diff --git a/oox/source/drawingml/chart/chartconverter.cxx 
b/oox/source/drawingml/chart/chartconverter.cxx
index e75b1c09c866..a864aac47e47 100644
--- a/oox/source/drawingml/chart/chartconverter.cxx
+++ b/oox/source/drawingml/chart/chartconverter.cxx
@@ -40,9 +40,9 @@ using namespace ::com::sun::star::uno;
 
 using ::oox::core::XmlFilterBase;
 
-static const sal_Unicode API_TOKEN_ARRAY_OPEN  = '{';
-static const sal_Unicode API_TOKEN_ARRAY_CLOSE = '}';
-static const sal_Unicode API_TOKEN_ARRAY_COLSEP= ';';
+const sal_Unicode API_TOKEN_ARRAY_OPEN  = '{';

[Libreoffice-commits] core.git: include/oox oox/source

2020-07-01 Thread Miklos Vajna (via logerrit)
 include/oox/core/filterbase.hxx|3 +++
 oox/source/core/filterbase.cxx |   10 ++
 oox/source/drawingml/chart/seriesconverter.cxx |   11 +--
 3 files changed, 22 insertions(+), 2 deletions(-)

New commits:
commit e18bc316efbd815b047f4e19ebd033e7a842d10d
Author: Miklos Vajna 
AuthorDate: Wed Jul 1 09:39:09 2020 +0200
Commit: Miklos Vajna 
CommitDate: Wed Jul 1 10:37:05 2020 +0200

Related: tdf#131175 OOXML chart: insert hatch definition into the right 
table

Both the chart and the containing document has one, but the intention is
to insert this into the chart one.

This is needed, but not enough to render the right hatch for data
labels.

Change-Id: I485d84e2ae33728963b648c05e730d418567fc0e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97569
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/include/oox/core/filterbase.hxx b/include/oox/core/filterbase.hxx
index e341de4e0885..22a15a8eb52d 100644
--- a/include/oox/core/filterbase.hxx
+++ b/include/oox/core/filterbase.hxx
@@ -180,6 +180,9 @@ public:
 the imported document. */
 ModelObjectHelper&  getModelObjectHelper() const;
 
+ModelObjectHelper& getModelObjectHelperForModel(
+const css::uno::Reference& xFactory) 
const;
+
 /** Returns a helper for the handling of OLE objects. */
 ::oox::ole::OleObjectHelper& getOleObjectHelper() const;
 
diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx
index 2eea42a8decf..cabd522b962d 100644
--- a/oox/source/core/filterbase.cxx
+++ b/oox/source/core/filterbase.cxx
@@ -137,6 +137,8 @@ struct FilterBaseImpl
 
 GraphicHelperRefmxGraphicHelper;/// Graphic and graphic object 
handling.
 ModelObjHelperRef   mxModelObjHelper;   /// Tables to create new named 
drawing objects.
+std::map, 
ModelObjHelperRef>
+mxModelObjHelpers;
 OleObjHelperRef mxOleObjHelper; /// OLE object handling.
 VbaProjectRef   mxVbaProject;   /// VBA project manager.
 
@@ -352,6 +354,14 @@ ModelObjectHelper& FilterBase::getModelObjectHelper() const
 return *mxImpl->mxModelObjHelper;
 }
 
+ModelObjectHelper& FilterBase::getModelObjectHelperForModel(
+const css::uno::Reference& xFactory) const
+{
+if (!mxImpl->mxModelObjHelpers.count(xFactory))
+mxImpl->mxModelObjHelpers[xFactory] = 
std::make_shared(xFactory);
+return *mxImpl->mxModelObjHelpers[xFactory];
+}
+
 OleObjectHelper& FilterBase::getOleObjectHelper() const
 {
 if( !mxImpl->mxOleObjHelper )
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx 
b/oox/source/drawingml/chart/seriesconverter.cxx
index f2df3aebe536..4124d83d3d55 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -283,7 +284,10 @@ void DataLabelConverter::convertFromModel( const 
Reference< XDataSeries >& rxDat
 if (mrModel.mxShapeProp)
 {
 importBorderProperties(aPropSet, *mrModel.mxShapeProp, 
getFilter().getGraphicHelper());
-importFillProperties(aPropSet, *mrModel.mxShapeProp, 
getFilter().getGraphicHelper(), getFilter().getModelObjectHelper());
+uno::Reference 
xFactory(getChartDocument(), uno::UNO_QUERY);
+ModelObjectHelper& rHelper = 
getFilter().getModelObjectHelperForModel(xFactory);
+importFillProperties(aPropSet, *mrModel.mxShapeProp, 
getFilter().getGraphicHelper(),
+ rHelper);
 }
 if( mrModel.mxText && mrModel.mxText->mxTextBody && 
!mrModel.mxText->mxTextBody->getParagraphs().empty() )
 {
@@ -370,7 +374,10 @@ void DataLabelsConverter::convertFromModel( const 
Reference< XDataSeries >& rxDa
 {
 // Import baseline border properties for these data labels.
 importBorderProperties(aPropSet, *mrModel.mxShapeProp, 
getFilter().getGraphicHelper());
-importFillProperties(aPropSet, *mrModel.mxShapeProp, 
getFilter().getGraphicHelper(), getFilter().getModelObjectHelper());
+uno::Reference 
xFactory(getChartDocument(), uno::UNO_QUERY);
+ModelObjectHelper& rHelper = 
getFilter().getModelObjectHelperForModel(xFactory);
+importFillProperties(aPropSet, *mrModel.mxShapeProp, 
getFilter().getGraphicHelper(),
+ rHelper);
 }
 }
 // import leaderline of data labels
___
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 starmath/inc starmath/source sw/qa sw/source writerfilter/source

2020-05-26 Thread Attila Bakos (via logerrit)
 include/oox/mathml/export.hxx |3 -
 oox/source/export/shapes.cxx  |3 -
 starmath/inc/document.hxx |3 -
 starmath/inc/unomodel.hxx |2 
 starmath/source/document.cxx  |9 ++-
 starmath/source/ooxmlexport.cxx   |   53 +++--
 starmath/source/ooxmlexport.hxx   |2 
 starmath/source/unomodel.cxx  |4 -
 sw/qa/extras/ooxmlexport/data/tdf133030.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|9 +++
 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx |2 
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx |2 
 sw/source/filter/ww8/docxattributeoutput.cxx  |   55 ++
 sw/source/filter/ww8/docxattributeoutput.hxx  |   13 +++--
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |2 
 15 files changed, 133 insertions(+), 29 deletions(-)

New commits:
commit 46695f3d66cc77b38865c1817b09d95e9c4b6683
Author: Attila Bakos 
AuthorDate: Thu May 7 17:23:48 2020 +0200
Commit: László Németh 
CommitDate: Tue May 26 09:37:46 2020 +0200

tdf#133030: DOCX export: fix formula alignment - part 3

Follow-up of commit 1237acf9851f8b12d1ccd929e2aa8b184c06d552
(tdf#132811 DOCX: fix formula alignment – part 2)

Co-authored-by: Tibor Nagy (NISZ)

Change-Id: I5466649a2aa6b7ffdb0def723f79dfbecdf1495f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93665
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/mathml/export.hxx b/include/oox/mathml/export.hxx
index 571133755e4b..e9589a0d1f46 100644
--- a/include/oox/mathml/export.hxx
+++ b/include/oox/mathml/export.hxx
@@ -28,8 +28,9 @@ class OOX_DLLPUBLIC FormulaExportBase
 public:
 virtual void writeFormulaOoxml(::sax_fastparser::FSHelperPtr pSerializer,
 oox::core::OoxmlVersion version,
-oox::drawingml::DocumentType documentType) = 0;
+oox::drawingml::DocumentType documentType, sal_Int8 nAlign) = 0;
 virtual void writeFormulaRtf( OStringBuffer& rBuffer, rtl_TextEncoding 
nEncoding ) = 0;
+enum eFormulaAlign { INLINE, CENTER, GROUPEDCENTER, LEFT, RIGHT };
 
 protected:
 FormulaExportBase();
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 214c4bcfbbb3..9a6a72b08b0f 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1955,7 +1955,8 @@ void ShapeExport::WriteMathShape(Reference const& 
xShape)
 
 oox::FormulaExportBase *const 
pMagic(dynamic_cast(xMathModel.get()));
 assert(pMagic);
-pMagic->writeFormulaOoxml(GetFS(), GetFB()->getVersion(), 
GetDocumentType());
+pMagic->writeFormulaOoxml(GetFS(), GetFB()->getVersion(), 
GetDocumentType(),
+FormulaExportBase::eFormulaAlign::INLINE);
 
 mpFS->endElementNS(XML_a14, XML_m);
 mpFS->endElementNS(XML_a, XML_p);
diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx
index 3fedfb13db17..1b425c91e7d1 100644
--- a/starmath/inc/document.hxx
+++ b/starmath/inc/document.hxx
@@ -207,7 +207,8 @@ public:
 
 void writeFormulaOoxml(const ::sax_fastparser::FSHelperPtr& pSerializer,
 oox::core::OoxmlVersion version,
-oox::drawingml::DocumentType documentType);
+oox::drawingml::DocumentType documentType,
+const sal_Int8 nAlign);
 void writeFormulaRtf(OStringBuffer& rBuffer, rtl_TextEncoding nEncoding);
 void readFormulaOoxml( oox::formulaimport::XmlStream& stream );
 
diff --git a/starmath/inc/unomodel.hxx b/starmath/inc/unomodel.hxx
index b2b536dd6d62..f18b09381c38 100644
--- a/starmath/inc/unomodel.hxx
+++ b/starmath/inc/unomodel.hxx
@@ -86,7 +86,7 @@ public:
 // oox::FormulaExportBase
 virtual void writeFormulaOoxml(::sax_fastparser::FSHelperPtr pSerializer,
 oox::core::OoxmlVersion version,
-oox::drawingml::DocumentType documentType) override;
+oox::drawingml::DocumentType documentType, sal_Int8 nAlign) 
override;
 virtual void writeFormulaRtf(OStringBuffer& rBuffer, rtl_TextEncoding 
nEncoding) override;
 // oox::FormulaImportBase
 virtual void readFormulaOoxml( oox::formulaimport::XmlStream& stream ) 
override;
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
index 644942126c31..8f9925c3c024 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -83,6 +83,7 @@
 #include "cfgitem.hxx"
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::accessibility;
@@ -854,14 +855,18 @@ bool SmDocShell::ConvertTo( SfxMedium  )
 void SmDocShell::writeFormulaOoxml(
 ::sax_fastparser::FSHelperPtr const& pSerializer,
 oox::core::OoxmlVersion const version,
-oox::drawingml::DocumentType const documentType)
+oox::drawingml::DocumentType const 

[Libreoffice-commits] core.git: include/oox oox/source sd/qa

2020-05-05 Thread Samuel Mehrbrodt (via logerrit)
 include/oox/drawingml/drawingmltypes.hxx |3 +
 include/oox/export/drawingml.hxx |1 
 oox/source/drawingml/drawingmltypes.cxx  |6 +++
 oox/source/export/drawingml.cxx  |   36 +++
 sd/qa/unit/data/pptx/tdf79082.pptx   |binary
 sd/qa/unit/export-tests-ooxml2.cxx   |   57 +++
 6 files changed, 103 insertions(+)

New commits:
commit 2c14bbd5820f854be3a4b1c0f49b9d9afa05b08c
Author: Samuel Mehrbrodt 
AuthorDate: Tue May 5 12:02:47 2020 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Wed May 6 07:50:21 2020 +0200

tdf#79082 Export paragraph tab stops to ooxml

Change-Id: I7d25dc1ab3c960aafc07a3be69b54f5aceef23fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93462
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/include/oox/drawingml/drawingmltypes.hxx 
b/include/oox/drawingml/drawingmltypes.hxx
index 0aac648ad5a4..a0043d36e1b2 100644
--- a/include/oox/drawingml/drawingmltypes.hxx
+++ b/include/oox/drawingml/drawingmltypes.hxx
@@ -106,6 +106,9 @@ sal_Int32 GetCoordinate( sal_Int32 nValue );
 /** converts an emu string into 1/100th mmm */
 sal_Int32 GetCoordinate( const OUString& sValue );
 
+/** converts 1/100mm to EMU */
+sal_Int32 GetPointFromCoordinate( sal_Int32 nValue );
+
 /** converts a ST_Percentage % string into 1/1000th of % */
 sal_Int32 GetPercent( const OUString& sValue );
 
diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index aedd408abe28..27735af4cbd9 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -249,6 +249,7 @@ public:
 void WriteParagraphProperties(const css::uno::Reference< 
css::text::XTextContent >& rParagraph, float fFirstCharHeight);
 void WriteParagraphNumbering(const css::uno::Reference< 
css::beans::XPropertySet >& rXPropSet, float fFirstCharHeight,
   sal_Int16 nLevel );
+void WriteParagraphTabStops(const 
css::uno::Reference& rXPropSet);
 void WriteRun( const css::uno::Reference< css::text::XTextRange >& rRun,
bool& rbOverridingCharHeight, sal_Int32& rnCharHeight );
 void WriteRunProperties( const css::uno::Reference< 
css::beans::XPropertySet >& rRun, bool bIsField, sal_Int32 nElement, bool 
bCheckDirect,
diff --git a/oox/source/drawingml/drawingmltypes.cxx 
b/oox/source/drawingml/drawingmltypes.cxx
index a6c8b66efba2..432ce7dc416c 100644
--- a/oox/source/drawingml/drawingmltypes.cxx
+++ b/oox/source/drawingml/drawingmltypes.cxx
@@ -53,6 +53,12 @@ sal_Int32 GetCoordinate( const OUString& sValue )
 return GetCoordinate( nRet );
 }
 
+/** converts 1/100mm to EMU */
+sal_Int32 GetPointFromCoordinate( sal_Int32 nValue )
+{
+return nValue * 360;
+}
+
 /** converts a ST_Percentage % string into 1/1000th of % */
 sal_Int32 GetPercent( const OUString& sValue )
 {
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 6655a21758cf..81bbcd76be07 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2395,6 +2395,40 @@ void DrawingML::WriteParagraphNumbering(const Reference< 
XPropertySet >& rXPropS
 }
 }
 
+void DrawingML::WriteParagraphTabStops(const Reference& 
rXPropSet)
+{
+css::uno::Sequence aTabStops;
+if (GetProperty(rXPropSet, "ParaTabStops"))
+aTabStops = 
*o3tl::doAccess>(mAny);
+
+if (aTabStops.getLength() > 0)
+mpFS->startElementNS(XML_a, XML_tabLst);
+
+for (const css::style::TabStop& rTabStop : std::as_const(aTabStops))
+{
+OString sPosition = 
OString::number(GetPointFromCoordinate(rTabStop.Position));
+OString sAlignment;
+switch (rTabStop.Alignment)
+{
+case css::style::TabAlign_DECIMAL:
+sAlignment = "dec";
+break;
+case css::style::TabAlign_RIGHT:
+sAlignment = "r";
+break;
+case css::style::TabAlign_CENTER:
+sAlignment = "ctr";
+break;
+case css::style::TabAlign_LEFT:
+default:
+sAlignment = "l";
+}
+mpFS->singleElementNS(XML_a, XML_tab, XML_algn, sAlignment, XML_pos, 
sPosition);
+}
+if (aTabStops.getLength() > 0)
+mpFS->endElementNS(XML_a, XML_tabLst);
+}
+
 bool DrawingML::IsGroupShape( const Reference< XShape >& rXShape )
 {
 bool bRet = false;
@@ -2597,6 +2631,8 @@ void DrawingML::WriteParagraphProperties( const 
Reference< XTextContent >& rPara
 
 WriteParagraphNumbering( rXPropSet, fFirstCharHeight, nLevel );
 
+WriteParagraphTabStops( rXPropSet );
+
 mpFS->endElementNS( XML_a, XML_pPr );
 }
 
diff --git a/sd/qa/unit/data/pptx/tdf79082.pptx 
b/sd/qa/unit/data/pptx/tdf79082.pptx
new file mode 100644
index ..8dcf4ff0a9e0
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf79082.pptx differ
diff --git 

[Libreoffice-commits] core.git: include/oox oox/source sw/qa

2020-04-28 Thread Szabolcs (via logerrit)
 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 

  1   2   3   >