[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - oox/source sd/qa

2021-12-09 Thread Attila Bakos (NISZ) (via logerrit)
 oox/source/export/drawingml.cxx |6 ++
 sd/qa/unit/data/pptx/tdf145162.pptx |binary
 sd/qa/unit/export-tests-ooxml3.cxx  |   16 
 3 files changed, 22 insertions(+)

New commits:
commit bfef95dcb38c1d004fc907a14af4eaaf99798b7e
Author: Attila Bakos (NISZ) 
AuthorDate: Wed Dec 8 10:22:37 2021 +0100
Commit: Xisco Fauli 
CommitDate: Thu Dec 9 17:21:04 2021 +0100

tdf#145162 PPTX export: fix extra bullet regression

Placeholders have bullet by default in MSO, so
write  for paragraphs where numbering/bullet
is disabled to avoid extra bullets in Impress.

Regression from commit b6b02e0b4c9d739836e1f61a886ea45b01e6696e
(tdf#111903 tdf#137152 PPTX export: fix placeholders).

Change-Id: Ib4c563cba475d61bc475ca05623e7c7b20fded30
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126528
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit f57cfddb51b7d7409b7b425dc200aa73406a13bd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126525
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 1040f52fad1c..8ea77ad8b84c 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2479,7 +2479,13 @@ 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;
 
diff --git a/sd/qa/unit/data/pptx/tdf145162.pptx 
b/sd/qa/unit/data/pptx/tdf145162.pptx
new file mode 100644
index ..3746740f327c
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf145162.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml3.cxx 
b/sd/qa/unit/export-tests-ooxml3.cxx
index 623761f25786..92c62451549f 100644
--- a/sd/qa/unit/export-tests-ooxml3.cxx
+++ b/sd/qa/unit/export-tests-ooxml3.cxx
@@ -69,6 +69,7 @@ public:
 void testTdf118806();
 void testTdf130058();
 void testTdf111789();
+void testTdf145162();
 void testTdf100348_convert_Fontwork2TextWarp();
 void testTdf1225573_FontWorkScaleX();
 void testTdf99497_keepAppearanceOfCircleKind();
@@ -141,6 +142,7 @@ public:
 CPPUNIT_TEST(testTdf118806);
 CPPUNIT_TEST(testTdf130058);
 CPPUNIT_TEST(testTdf111789);
+CPPUNIT_TEST(testTdf145162);
 CPPUNIT_TEST(testTdf100348_convert_Fontwork2TextWarp);
 CPPUNIT_TEST(testTdf1225573_FontWorkScaleX);
 CPPUNIT_TEST(testTdf99497_keepAppearanceOfCircleKind);
@@ -609,6 +611,20 @@ void SdOOXMLExportTest3::testTdf111789()
 xDocShRef->DoClose();
 }
 
+void SdOOXMLExportTest3::testTdf145162()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf145162.pptx"), 
PPTX);
+utl::TempFile tempFile;
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, 
"ppt/slides/slide1.xml");
+
+assertXPath(pXmlDocContent, 
"/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[2]/a:pPr/a:buNone");
+// Before the fix, that tag was missing so PP put bullet to each para.
+
+xDocShRef->DoClose();
+}
+
 void SdOOXMLExportTest3::testTdf100348_convert_Fontwork2TextWarp()
 {
 ::sd::DrawDocShellRef xDocShRef = loadURL(


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - oox/source sd/qa

2021-12-03 Thread gulsahkose (via logerrit)
 oox/source/drawingml/shape.cxx  |   30 
 oox/source/token/properties.txt |1 
 sd/qa/unit/data/pptx/tdfpictureplaceholder.pptx |binary
 sd/qa/unit/export-tests-ooxml3.cxx  |   20 
 4 files changed, 51 insertions(+)

New commits:
commit 2be6b90cfa201b894cc893c51ca8e29577e33aa1
Author: gulsahkose 
AuthorDate: Wed Dec 1 10:46:41 2021 +0300
Commit: Miklos Vajna 
CommitDate: Fri Dec 3 09:30:18 2021 +0100

tdf#140912 Better handling of the picture placeholders.

To see icon and placeholder text at the center of picture
placeholder shape, we set the TextContourFrame and GraphicCrop
properties.

Change-Id: I49e3d08c9020e593232c60c97af3f45fb620075e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126165
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
(cherry picked from commit 7b3be7f6f3d800e2ad86f5a043e6e9b21ed4409f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126138

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 8ec9eb43a691..3b0c34e68e52 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -88,6 +88,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1347,6 +1348,35 @@ Reference< XShape > const & Shape::createAndInsert(
 
propertySet->setPropertyValue("InteropGrabBag",uno::makeAny(aGrabBag));
 }
 
+// If the shape is a picture placeholder.
+if (aServiceName == "com.sun.star.presentation.GraphicObjectShape" 
&& !bClearText)
+{
+// Placeholder text should be in center of the shape.
+aShapeProps.setProperty(PROP_TextContourFrame, false);
+
+/* Placeholder icon should be at the center of the parent 
shape.
+ * We use negative graphic crop property because of that we 
don't
+ * have padding support.
+ */
+uno::Reference 
xGraphic(xSet->getPropertyValue("Graphic"), uno::UNO_QUERY);
+if (xGraphic.is())
+{
+awt::Size aBitmapSize;
+xGraphic->getPropertyValue("Size100thMM") >>= aBitmapSize;
+sal_Int32 nXMargin = (aShapeRectHmm.Width - 
aBitmapSize.Width) / 2;
+sal_Int32 nYMargin = (aShapeRectHmm.Height - 
aBitmapSize.Height) / 2;
+if (nXMargin > 0 && nYMargin > 0)
+{
+text::GraphicCrop aGraphicCrop;
+aGraphicCrop.Top = nYMargin * -1;
+aGraphicCrop.Bottom = nYMargin * -1;
+aGraphicCrop.Left = nXMargin * -1;
+aGraphicCrop.Right = nXMargin * -1;
+aShapeProps.setProperty(PROP_GraphicCrop, 
aGraphicCrop);
+}
+}
+}
+
 PropertySet( xSet ).setProperties( aShapeProps );
 if (mbLockedCanvas)
 {
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 68b5e2d14af5..562f26c36f33 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -533,6 +533,7 @@ TextBreak
 TextCameraZRotateAngle
 TextColor
 TextColumns
+TextContourFrame
 TextFitToSize
 TextFrames
 TextHorizontalAdjust
diff --git a/sd/qa/unit/data/pptx/tdfpictureplaceholder.pptx 
b/sd/qa/unit/data/pptx/tdfpictureplaceholder.pptx
new file mode 100644
index ..d681c749cab0
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdfpictureplaceholder.pptx 
differ
diff --git a/sd/qa/unit/export-tests-ooxml3.cxx 
b/sd/qa/unit/export-tests-ooxml3.cxx
index f842e4b97717..623761f25786 100644
--- a/sd/qa/unit/export-tests-ooxml3.cxx
+++ b/sd/qa/unit/export-tests-ooxml3.cxx
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -118,6 +119,7 @@ public:
 void testTdf96061_textHighlight();
 void testTdf142235_TestPlaceholderTextAlignment();
 void testTdf143315();
+void testTdf140912_PicturePlaceholder();
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest3);
 
@@ -188,6 +190,7 @@ public:
 CPPUNIT_TEST(testTdf96061_textHighlight);
 CPPUNIT_TEST(testTdf142235_TestPlaceholderTextAlignment);
 CPPUNIT_TEST(testTdf143315);
+CPPUNIT_TEST(testTdf140912_PicturePlaceholder);
 CPPUNIT_TEST_SUITE_END();
 
 virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override
@@ -1770,6 +1773,23 @@ void SdOOXMLExportTest3::testTdf143315()
 assertXPath(pXml, 
"/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr/a:buChar", 0);
 }
 
+void SdOOXMLExportTest3::testTdf140912_PicturePlaceholder()
+{
+::sd::DrawDocShellRef xDocShRef = loadURL(
+
m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdfpictureplaceholder.pptx"),
 PPTX);
+
+uno::Reference 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - oox/source

2021-11-23 Thread Justin Luth (via logerrit)
 oox/source/drawingml/textcharacterproperties.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 1ed00f2ad9bbc6e920248ba3d39c227acb06e0e6
Author: Justin Luth 
AuthorDate: Mon Nov 22 19:33:48 2021 +0200
Commit: Xisco Fauli 
CommitDate: Tue Nov 23 11:50:17 2021 +0100

tdf#138223 oox: don't set highlight color if it is transparent

Probably when this was first implemented in 6.4,
it should have set a transparency threshold of when to accept
the color as the background (perhaps at 50%).
But since this has already been running for a while,
I only cancel it if it is fully transparent.

No existing unit tests matched this scenario.

I'm not making a unit test because the color really
ought to be set - it should just be transparent.
LO doesn't seem to have a character highlight
transparency capability, so this needs to be emulated.

Change-Id: I7b295894e529f8345cadc9b30bc43598a9a02e2b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125670
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit 283586c89a0542efb2d57a36ee3aad7cc5153ed5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125465
Reviewed-by: Xisco Fauli 

diff --git a/oox/source/drawingml/textcharacterproperties.cxx 
b/oox/source/drawingml/textcharacterproperties.cxx
index 4eb5acaffb56..ca1d2af1360d 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -175,7 +175,7 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& 
rPropMap, const XmlFil
 }
 // TODO If bUnderlineFillFollowText uFillTx 
(CT_TextUnderlineFillFollowText) is set, fill color of the underline should be 
the same color as the text
 
-if( maHighlightColor.isUsed() )
+if (maHighlightColor.isUsed() && maHighlightColor.getTransparency() != 100)
 rPropMap.setProperty( PROP_CharBackColor, maHighlightColor.getColor( 
rFilter.getGraphicHelper() ));
 else
 rPropMap.setProperty( PROP_CharBackColor, sal_Int32(-1));


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - oox/source sw/qa

2021-09-10 Thread Vasily Melenchuk (via logerrit)
 oox/source/drawingml/textbodycontext.cxx |   12 
 oox/source/drawingml/textrun.cxx |8 -
 sw/qa/extras/ooxmlimport/data/tdf126426.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx|   38 +++
 4 files changed, 57 insertions(+), 1 deletion(-)

New commits:
commit d51609fbe49042867fa734ef4f6c1755df8514a2
Author: Vasily Melenchuk 
AuthorDate: Fri Aug 27 18:10:15 2021 +0300
Commit: Thorsten Behrens 
CommitDate: Fri Sep 10 21:20:31 2021 +0200

tdf#126426: support for hyperlinks in TextParagraphContext

Usually hyperlinks are processed by TextBodyContext, but
for grouped shape we accidentaly gone into TextParagraphContext
It has almost all possibilities to process txbxContent,
but not hyperlinks.

Additionally some hyperlink char attributes (color and underline)
can expand to follow up ordinal text. Additional small hack applied
to avoid this.

Unfortunately this is not a final solution: such document fails
roundtrip and hyperlinks are lost after saving to DOCX.

Conflicts:
oox/source/drawingml/textbodycontext.cxx

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

diff --git a/oox/source/drawingml/textbodycontext.cxx 
b/oox/source/drawingml/textbodycontext.cxx
index 49b50309f597..e2b3de1d1ab2 100644
--- a/oox/source/drawingml/textbodycontext.cxx
+++ b/oox/source/drawingml/textbodycontext.cxx
@@ -28,6 +28,8 @@
 #include 
 #include 
 
+#include "hyperlinkcontext.hxx"
+
 #include 
 
 #include 
@@ -101,6 +103,16 @@ ContextHandlerRef TextParagraphContext::onCreateContext( 
sal_Int32 aElementToken
 return this;
 case OOX_TOKEN(a14, m):
 return CreateLazyMathBufferingContext(*this, mrParagraph);
+case W_TOKEN( hyperlink ):
+{
+TextRunPtr pRun = std::make_shared();
+mrParagraph.addRun(pRun);
+// parse hyperlink attributes: use HyperLinkContext for that
+rtl::Reference pContext(new HyperLinkContext(
+*this, rAttribs, 
pRun->getTextCharacterProperties().maHyperlinkPropertyMap));
+// but create text run context because HyperLinkContext can't 
process internal w:r, w:t, etc
+return new RegularTextRunContext(*this, pRun);
+}
 default:
 SAL_WARN("oox", "TextParagraphContext::onCreateContext: unhandled 
element: " << getBaseToken(aElementToken));
 }
diff --git a/oox/source/drawingml/textrun.cxx b/oox/source/drawingml/textrun.cxx
index ab87fb732141..e3bcecb745d5 100644
--- a/oox/source/drawingml/textrun.cxx
+++ b/oox/source/drawingml/textrun.cxx
@@ -69,7 +69,13 @@ sal_Int32 TextRun::insertAt(
 Any aOldFontFamily = xState->getPropertyDefault("CharFontFamily");
 
 TextCharacterProperties aTextCharacterProps( rTextCharacterStyle );
-aTextCharacterProps.assignUsed( maTextCharacterProperties );
+
+// If no text color specified lets anyway initialize it as default:
+// this will help to recover after hyperlink
+if (!aTextCharacterProps.maFillProperties.maFillColor.isUsed())
+aTextCharacterProps.maFillProperties.moFillType = XML_solidFill;
+
+aTextCharacterProps.assignUsed(maTextCharacterProperties);
 if ( aTextCharacterProps.moHeight.has() )
 nCharHeight = aTextCharacterProps.moHeight.get();
 else
diff --git a/sw/qa/extras/ooxmlimport/data/tdf126426.docx 
b/sw/qa/extras/ooxmlimport/data/tdf126426.docx
new file mode 100644
index ..d77051365ca2
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf126426.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index e01957f553ab..d0f3833aea7e 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -785,6 +786,43 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf129912)
 }
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf126426)
+{
+load(mpTestDocumentPath, "tdf126426.docx");
+
+uno::Reference xGroup(getShape(1), 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xGroup->getCount());
+
+// get second shape in group
+uno::Reference 
xParaEnumAccess(xGroup->getByIndex(1),
+  
uno::UNO_QUERY_THROW);
+uno::Reference xParaEnum = 
xParaEnumAccess->createEnumeration();
+
+uno::Reference xPara(xParaEnum->nextElement(), 
uno::UNO_QUERY_THROW);
+uno::Reference xRunEnumAccess(xPara, 
uno::UNO_QUERY_THROW);
+
+uno::Reference xRunEnum = 
xRunEnumAccess->createEnumeration();
+{
+// Text before: was before 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - oox/source sd/qa

2021-08-31 Thread Tibor Nagy (via logerrit)
 oox/source/ppt/pptshape.cxx |2 +-
 sd/qa/unit/data/pptx/tdf142645.pptx |binary
 sd/qa/unit/import-tests.cxx |   16 
 3 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit 9919b1c017dca81f5bf54aa27f0fda615c1bd2da
Author: Tibor Nagy 
AuthorDate: Mon Aug 30 12:26:39 2021 +0200
Commit: Xisco Fauli 
CommitDate: Tue Aug 31 17:53:23 2021 +0200

tdf#142645 PPTX import: convert "ctrTitle" text to slide name

(i.e. centered title) similar to .

See commit 7eb0e52527e729a21973e70d5be8e0a6779ec748
"tdf#142648 PPTX: import long slide names to avoid broken link export",
commit 253bee65bc24d999c3629a4d503d0fa01b355cfc
"tdf#142646 PPTX import: count repeating slide names" etc.

Change-Id: I5f25f04f23981ce2ff64dc792fe8464682d749a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121295
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit e5cfda76aefd6996813f461198816be24cd6ad43)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121289
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index b72e6d854fc6..1c78c652526e 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -335,7 +335,7 @@ void PPTShape::addShape(
 
 Reference< XShape > xShape( createAndInsert( rFilterBase, 
sServiceName, pTheme, rxShapes, bClearText, bool(mpPlaceholder), 
aTransformation, getFillProperties() ) );
 // if exists and not duplicated, try to use the title text as 
slide name to help its re-use on UI
-if (!rSlidePersist.isMasterPage() && rSlidePersist.getPage().is() 
&& mnSubType == XML_title)
+if (!rSlidePersist.isMasterPage() && rSlidePersist.getPage().is() 
&& (mnSubType == XML_title || mnSubType == XML_ctrTitle))
 {
 try
 {
diff --git a/sd/qa/unit/data/pptx/tdf142645.pptx 
b/sd/qa/unit/data/pptx/tdf142645.pptx
new file mode 100644
index ..e57bd9ee176e
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf142645.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 742fb7712750..bdd27236c74a 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 testTdf142645();
 void testTdf142915();
 void testTdf142913();
 void testTdf142590();
@@ -244,6 +245,7 @@ public:
 CPPUNIT_TEST_SUITE(SdImportTest);
 
 CPPUNIT_TEST(testDocumentLayout);
+CPPUNIT_TEST(testTdf142645);
 CPPUNIT_TEST(testTdf142915);
 CPPUNIT_TEST(testTdf142913);
 CPPUNIT_TEST(testTdf142590);
@@ -442,6 +444,20 @@ void SdImportTest::testDocumentLayout()
 }
 }
 
+void SdImportTest::testTdf142645()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf142645.pptx"), 
PPTX);
+uno::Reference 
xDoc(xDocShRef->GetDoc()->getUnoModel(),
+ uno::UNO_QUERY_THROW);
+
+uno::Reference 
xPage1(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
+uno::Reference xNamed1(xPage1, uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_EQUAL(OUString("Hello"), xNamed1->getName());
+
+xDocShRef->DoClose();
+}
+
 void SdImportTest::testTdf142915()
 {
 ::sd::DrawDocShellRef xDocShRef


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - oox/source sd/qa

2021-08-20 Thread Tibor Nagy (via logerrit)
 oox/source/ppt/pptshape.cxx |7 ---
 sd/qa/unit/data/pptx/tdf142648.pptx |binary
 sd/qa/unit/export-tests-ooxml1.cxx  |   23 +++
 3 files changed, 27 insertions(+), 3 deletions(-)

New commits:
commit 0b327b69ef78a7565625dabbe8dcf0140884fe26
Author: Tibor Nagy 
AuthorDate: Wed Jul 7 10:10:21 2021 +0200
Commit: Xisco Fauli 
CommitDate: Fri Aug 20 09:44:37 2021 +0200

tdf#142648 PPTX: import long slide names to avoid broken link export

PPTX import renames the slides using their short title text.
Apply this for the titles with 64 or more characters, too,
abbreviating the title text instead of using the default
slide name "page1", "page2" etc., because the default slide
names result broken hyperlinks during the PPTX export.

To test the fix manually, create a new hyperlink
using text selection and Insert Hyperlink (Ctrl-K),
clicking on Target in Document button on the Document pane,
and selecting a slide name.

Note: the problem still exists for the duplicated
or newly inserted slides, which get default slide names.

Change-Id: Iec1fab5a2ee862353766ed7e13b1501b3a325d0e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118548
Tested-by: László Németh 
Reviewed-by: László Németh 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120750
Tested-by: Jenkins

diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index 563454aaaf66..b72e6d854fc6 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -346,9 +346,10 @@ void PPTShape::addShape(
 Reference 
xDPS(rFilterBase.getModel(), uno::UNO_QUERY_THROW);
 Reference 
xDrawPages(xDPS->getDrawPages(), uno::UNO_SET_THROW);
 sal_uInt32 nMaxPages = xDrawPages->getCount();
-bool bUseTitleAsSlideName = !aTitleText.isEmpty() &&
-  // just a magic value, but we don't want to set 
slide names which are too long
-  aTitleText.getLength() < 64;
+// just a magic value but we don't want to drop out slide 
names which are too long
+if (aTitleText.getLength() > 63)
+aTitleText = aTitleText.copy(0, 63);
+bool bUseTitleAsSlideName = !aTitleText.isEmpty();
 // check duplicated title name
 if (bUseTitleAsSlideName)
 {
diff --git a/sd/qa/unit/data/pptx/tdf142648.pptx 
b/sd/qa/unit/data/pptx/tdf142648.pptx
new file mode 100644
index ..fc470530fc94
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf142648.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx 
b/sd/qa/unit/export-tests-ooxml1.cxx
index 34d9c9865b70..59848719adf0 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 testTdf142648();
 void testTdf47365();
 void testTdf125071();
 void testTdf54037();
@@ -122,6 +123,7 @@ public:
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest1);
 
+CPPUNIT_TEST(testTdf142648);
 CPPUNIT_TEST(testTdf47365);
 CPPUNIT_TEST(testTdf125071);
 CPPUNIT_TEST(testTdf54037);
@@ -210,6 +212,27 @@ void checkFontAttributes( const SdrTextObj* pObj, 
ItemValue nVal, sal_uInt32 nId
 
 }
 
+void SdOOXMLExportTest1::testTdf142648()
+{
+sd::DrawDocShellRef xDocShRef = loadURL( 
m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf142648.pptx"), PPTX );
+utl::TempFile tempFile;
+
+uno::Reference 
xDPS(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW);
+uno::Reference xDrawPages(xDPS->getDrawPages(), 
uno::UNO_SET_THROW);
+uno::Reference xDrawPage;
+xDrawPages->getByIndex(0) >>= xDrawPage;
+uno::Reference xNamed(xDrawPage, uno::UNO_QUERY_THROW);
+xNamed->setName("#Slide 1");
+
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+xDocShRef->DoClose();
+
+xmlDocUniquePtr pRelsDoc = parseExport(tempFile, 
"ppt/slides/_rels/slide2.xml.rels");
+
+assertXPath(pRelsDoc, "/rels:Relationships/rels:Relationship[@Id='rId1']", 
"Target",
+"slide1.xml");
+}
+
 void SdOOXMLExportTest1::testTdf47365()
 {
 sd::DrawDocShellRef xDocShRef = loadURL( 
m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/loopNoPause.pptx"), PPTX );


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - oox/source sw/qa

2021-08-17 Thread Regina Henschel (via logerrit)
 oox/source/export/shapes.cxx|3 +-
 sw/qa/extras/ooxmlexport/data/tdf143860_NonPrimitiveCustomShape.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport16.cxx  |   11 
++
 3 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 58ba1b975d75225222a27ff404281b9bff133143
Author: Regina Henschel 
AuthorDate: Sun Aug 15 18:48:32 2021 +0200
Commit: Xisco Fauli 
CommitDate: Tue Aug 17 09:38:44 2021 +0200

tdf#143860 non-primitive needs custGeom not prstGeom

Error was, that for a custom shape with type 'non-primitive' method
DMLPresetShapeExporter::WriteShape() was called. For such shapes the
method GetOOXMLPresetGeometry() returns preset type 'rect' and in case
the shape had no handles, that preset geometry was written.
In my solution I exclude shapes of type 'non-primitive' from using
DMLPresetShapeExporter, because such shapes never belong to a OOXML
preset shape.

Change-Id: I714f69c98fe15c2b7e70dc0a474a7f85ad757034
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120511
Tested-by: Jenkins
Reviewed-by: Regina Henschel 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120547

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 23ea202db76b..1bcabf38eb49 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -843,7 +843,8 @@ ShapeExport& ShapeExport::WriteCustomShape( const 
Reference< XShape >& xShape )
 bool bPresetWriteSuccessful = false;
 // Let the custom shapes what has name and preset information in OOXML, to 
be written
 // as preset ones with parameters. Try that with this converter class.
-if (!sShapeType.startsWith("ooxml") && GetDocumentType() == DOCUMENT_DOCX
+if (!sShapeType.startsWith("ooxml") && sShapeType != "non-primitive"
+&& GetDocumentType() == DOCUMENT_DOCX
 && xShape->getShapeType() == "com.sun.star.drawing.CustomShape")
 {
 DMLPresetShapeExporter aCustomShapeConverter(this, xShape);
diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf143860_NonPrimitiveCustomShape.odt 
b/sw/qa/extras/ooxmlexport/data/tdf143860_NonPrimitiveCustomShape.odt
new file mode 100644
index ..6a1222877031
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf143860_NonPrimitiveCustomShape.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
index 2b3d92b55701..bd8338315381 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
@@ -70,6 +70,17 @@ protected:
 }
 };
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf143860NonPrimitiveCustomShape,
+"tdf143860_NonPrimitiveCustomShape.odt")
+{
+// The document has a custom shape of type non-primitive without handles. 
Make sure that the shape
+// is not exported with preset but with custom geometry.
+xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml");
+CPPUNIT_ASSERT(pXmlDocument);
+assertXPath(pXmlDocument, "//a:prstGeom", 0);
+assertXPath(pXmlDocument, "//a:custGeom", 1);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf136059, "tdf136059.odt")
 {
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Contour has not been exported!", true,


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - oox/source sd/qa sd/source

2021-07-08 Thread Attila Bakos (NISZ) (via logerrit)
 oox/source/export/drawingml.cxx   |3 --
 sd/qa/unit/data/odp/placeholder-box-textalignment.odp |binary
 sd/qa/unit/export-tests-ooxml3.cxx|   20 ++
 sd/source/filter/eppt/pptx-epptooxml.cxx  |9 +++-
 4 files changed, 29 insertions(+), 3 deletions(-)

New commits:
commit 3518b4cebdddc0446cf923c38acee52bf5d6a9b1
Author: Attila Bakos (NISZ) 
AuthorDate: Tue Jun 8 12:25:41 2021 +0200
Commit: Xisco Fauli 
CommitDate: Thu Jul 8 14:11:30 2021 +0200

tdf#142235 PPTX export: fix styles with placeholders

inserting icons and alignment.

Regression from commit b6b02e0b4c9d739836e1f61a886ea45b01e6696e
(tdf#111903 tdf#137152 PPTX export: fix placeholders).

Note: in the unit test document, check fixed vertical position
of the second text boxes of Slide 2–4.

Change-Id: I3c649db69f94a2e9f49ae7aa11d9cd9d9f6d80d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116828
Tested-by: László Németh 
Reviewed-by: László Németh 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118446
Tested-by: Jenkins

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 0372ae804b13..d27b28cb7d1f 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2988,8 +2988,7 @@ void DrawingML::WriteText(const Reference& 
rXIface, bool bBodyPr, bo
 const char* sVerticalAlignment = nullptr;
 if (GetProperty(rXPropSet, "TextVerticalAdjust"))
 mAny >>= eVerticalAlignment;
-if( eVerticalAlignment != TextVerticalAdjust_TOP )
-sVerticalAlignment = GetTextVerticalAdjust(eVerticalAlignment);
+sVerticalAlignment = GetTextVerticalAdjust(eVerticalAlignment);
 
 const char* sWritingMode = nullptr;
 bool bVertical = false;
diff --git a/sd/qa/unit/data/odp/placeholder-box-textalignment.odp 
b/sd/qa/unit/data/odp/placeholder-box-textalignment.odp
new file mode 100644
index ..df33291fbd40
Binary files /dev/null and 
b/sd/qa/unit/data/odp/placeholder-box-textalignment.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml3.cxx 
b/sd/qa/unit/export-tests-ooxml3.cxx
index fb2db18e8d22..6632934e430e 100644
--- a/sd/qa/unit/export-tests-ooxml3.cxx
+++ b/sd/qa/unit/export-tests-ooxml3.cxx
@@ -116,6 +116,7 @@ public:
 void testTdf125560_textDeflate();
 void testTdf125560_textInflateTop();
 void testTdf96061_textHighlight();
+void testTdf142235_TestPlaceholderTextAlignment();
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest3);
 
@@ -184,6 +185,7 @@ public:
 CPPUNIT_TEST(testTdf125560_textDeflate);
 CPPUNIT_TEST(testTdf125560_textInflateTop);
 CPPUNIT_TEST(testTdf96061_textHighlight);
+CPPUNIT_TEST(testTdf142235_TestPlaceholderTextAlignment);
 CPPUNIT_TEST_SUITE_END();
 
 virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override
@@ -1688,6 +1690,24 @@ void SdOOXMLExportTest3::testTdf125560_textInflateTop()
 "type", "mso-spt164");
 }
 
+void SdOOXMLExportTest3::testTdf142235_TestPlaceholderTextAlignment()
+{
+auto xDocShRef = loadURL(
+
m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/placeholder-box-textalignment.odp"),
 ODP);
+
+utl::TempFile tmpfile;
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+xDocShRef->DoClose();
+
+xmlDocUniquePtr pXml1 = parseExport(tmpfile, "ppt/slides/slide2.xml");
+xmlDocUniquePtr pXml2 = parseExport(tmpfile, "ppt/slides/slide3.xml");
+
+// Without the fix in place many of these asserts failed, because 
alignment was bad.
+
+assertXPath(pXml1, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:bodyPr", 
"anchor", "t");
+assertXPath(pXml2, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:bodyPr", 
"anchor", "t");
+}
+
 void SdOOXMLExportTest3::testTdf96061_textHighlight()
 {
 ::sd::DrawDocShellRef xDocShRef
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx 
b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 6a8502361061..f30a4d040fc6 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -1555,8 +1555,15 @@ ShapeExport& 
PowerPointShapeExport::WritePlaceholderShape(const Reference< XShap
 default:
 SAL_INFO("sd.eppt", "warning: unhandled placeholder type: " << 
ePlaceholder);
 }
+
 SAL_INFO("sd.eppt", "write placeholder " << pType);
-mpFS->singleElementNS(XML_p, XML_ph, XML_type, pType);
+
+if ((mePageType == PageType::LAYOUT || mePageType == PageType::NORMAL)
+&& ePlaceholder == Outliner)
+mpFS->singleElementNS(XML_p, XML_ph);
+else
+mpFS->singleElementNS(XML_p, XML_ph, XML_type, pType);
+
 mpFS->endElementNS(XML_p, XML_nvPr);
 mpFS->endElementNS(XML_p, XML_nvSpPr);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - oox/source reportdesign/source sc/inc sc/qa sc/source

2021-06-29 Thread Daniel Arato (NISZ) (via logerrit)
 oox/source/token/properties.txt  |4 +
 reportdesign/source/core/api/ReportDefinition.cxx|4 +
 sc/inc/scitems.hxx   |   55 ++-
 sc/inc/unonames.hxx  |4 +
 sc/qa/unit/data/xlsx/tdf121715.xlsx  |binary
 sc/qa/unit/subsequent_export-test2.cxx   |   21 +++
 sc/source/core/data/docpool.cxx  |9 ++-
 sc/source/filter/excel/xepage.cxx|   47 +---
 sc/source/filter/excel/xipage.cxx|2 
 sc/source/filter/excel/xlpage.cxx|2 
 sc/source/filter/inc/pagesettings.hxx|6 +-
 sc/source/filter/inc/xlpage.hxx  |9 ++-
 sc/source/filter/oox/pagesettings.cxx|   30 ++
 sc/source/filter/xml/XMLTableHeaderFooterContext.cxx |5 +
 sc/source/filter/xml/XMLTableHeaderFooterContext.hxx |2 
 sc/source/filter/xml/XMLTableMasterPageExport.cxx|   24 
 sc/source/filter/xml/xmlfonte.cxx|3 -
 sc/source/filter/xml/xmlstyli.cxx|4 -
 sc/source/ui/inc/printfun.hxx|2 
 sc/source/ui/pagedlg/tphf.cxx|4 +
 sc/source/ui/unoobj/styleuno.cxx |6 ++
 sc/source/ui/view/printfun.cxx   |   12 +++-
 22 files changed, 200 insertions(+), 55 deletions(-)

New commits:
commit b9993369b4011cd8f367e439f5248096827f1efc
Author: Daniel Arato (NISZ) 
AuthorDate: Tue Jun 8 11:53:42 2021 +0200
Commit: László Németh 
CommitDate: Tue Jun 29 22:50:43 2021 +0200

tdf#121715 XLSX: support custom first page header/footer

Add XLSX import/export support for a different header or
footer (activated separately) on the first page.
Print preview is also extended to support this.

Note: only ODS export is supported, yet. Follow-up commits
are going to add ODS import and UI support.

Change-Id: Icd3a40131bdbcd5d5a42f98c86a71345a5745051
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116842
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 19fa853ce12136b5c14e0c5a0aa906c296b75388)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118067
Tested-by: Jenkins

diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 980c1bb8c0f2..68b5e2d14af5 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -184,6 +184,10 @@ Filter
 FilterCriteriaSource
 FilterOptions
 FirstLineOffset
+FirstPageFooterContent
+FirstPageHeaderContent
+FirstPageFooterIsShared
+FirstPageHeaderIsShared
 FirstPageNumber
 FocusOnClick
 FontCharset
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx 
b/reportdesign/source/core/api/ReportDefinition.cxx
index fd6bf1bb56c1..839ec947ca36 100644
--- a/reportdesign/source/core/api/ReportDefinition.cxx
+++ b/reportdesign/source/core/api/ReportDefinition.cxx
@@ -149,6 +149,7 @@
 #define SC_UNO_PAGE_HDRON   "HeaderIsOn"
 #define SC_UNO_PAGE_HDRDYNAMIC  "HeaderIsDynamicHeight"
 #define SC_UNO_PAGE_HDRSHARED   "HeaderIsShared"
+#define SC_UNO_PAGE_FIRSTHDRSHARED  "FirstPageHeaderIsShared"
 #define SC_UNO_PAGE_FTRBACKCOL  "FooterBackColor"
 #define SC_UNO_PAGE_FTRBACKTRAN "FooterBackTransparent"
 #define SC_UNO_PAGE_FTRGRFFILT  "FooterBackGraphicFilter"
@@ -171,6 +172,7 @@
 #define SC_UNO_PAGE_FTRON   "FooterIsOn"
 #define SC_UNO_PAGE_FTRDYNAMIC  "FooterIsDynamicHeight"
 #define SC_UNO_PAGE_FTRSHARED   "FooterIsShared"
+#define SC_UNO_PAGE_FIRSTFTRSHARED  "FirstPageFooterIsShared"
 
 namespace reportdesign
 {
@@ -309,6 +311,7 @@ OStyle::OStyle()
 registerPropertyNoMember(SC_UNO_PAGE_FTRDYNAMIC,  
++i,nBound,cppu::UnoType::get(), css::uno::Any(false));
 registerPropertyNoMember(SC_UNO_PAGE_FTRON,   
++i,nBound,cppu::UnoType::get(), css::uno::Any(false));
 registerPropertyNoMember(SC_UNO_PAGE_FTRSHARED,   
++i,nBound,cppu::UnoType::get(), css::uno::Any(false));
+registerPropertyNoMember(SC_UNO_PAGE_FIRSTFTRSHARED, 
++i,nBound,cppu::UnoType::get(), css::uno::Any(false));
 registerPropertyNoMember(SC_UNO_PAGE_FTRLEFTBOR,  ++i,nBound, 
cppu::UnoType::get(), css::uno::Any(table::BorderLine2()));
 registerPropertyNoMember(SC_UNO_PAGE_FTRLEFTBDIS, ++i,nBound, 
cppu::UnoType::get(), css::uno::makeAny(0));
 registerPropertyNoMember(SC_UNO_PAGE_FTRLEFTMAR,  ++i,nBound, 
cppu::UnoType::get(), css::uno::makeAny(0));
@@ -332,6 +335,7 @@ OStyle::OStyle()
 registerPropertyNoMember(SC_UNO_PAGE_HDRDYNAMIC,  
++i,nBound|nMayBeVoid,cppu::UnoType::get(), css::uno::Any(false));
 registerPropertyNoMember(SC_UNO_PAGE_HDRON,   
++i,nBound|nMayBeVoid,cppu::UnoType::get(), css::uno::Any(false));
 registerPropertyNoMember(SC_UNO_PAGE_HDRSHARED,   

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - oox/source sd/qa

2021-06-28 Thread Tibor Nagy (via logerrit)
 oox/source/ppt/pptshape.cxx |   25 -
 sd/qa/unit/import-tests.cxx |4 ++--
 2 files changed, 18 insertions(+), 11 deletions(-)

New commits:
commit 65070087508f176a2a65a0cfbe628ab2994e824f
Author: Tibor Nagy 
AuthorDate: Wed Jun 16 11:02:48 2021 +0200
Commit: László Németh 
CommitDate: Mon Jun 28 10:41:09 2021 +0200

tdf#142646 PPTX import: count repeating slide names

instead of using the default slide name "Slide n".

PPTX slides are named after their titles. Now repeating
titles got a number instead of using the default slide
name "Slide n". E.g. "Title", "Title", "Title" will be
slide names "Title", "Title (2)", Title (3)", and not
"Title", "Slide 2", "Slide 3".

Follow-up to commit I98511c3c9a59598ea113e7387db5202d7f8a7cd4
"tdf#103347: PTX import: fix duplicated slide name"

Change-Id: I449d6f7d7599291b3dae7df65ad6ff86a4269fb8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117317
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 253bee65bc24d999c3629a4d503d0fa01b355cfc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117972
Tested-by: Jenkins

diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index 1756ad9e32ab..563454aaaf66 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -339,6 +339,7 @@ void PPTShape::addShape(
 {
 try
 {
+sal_Int32 nCount = 1;
 OUString aTitleText;
 Reference xText(xShape, UNO_QUERY_THROW);
 aTitleText = xText->getString();
@@ -349,17 +350,23 @@ void PPTShape::addShape(
   // just a magic value, but we don't want to set 
slide names which are too long
   aTitleText.getLength() < 64;
 // check duplicated title name
-for (sal_uInt32 nPage = 0; bUseTitleAsSlideName && nPage < 
nMaxPages; ++nPage)
-{
-Reference 
xDrawPage(xDrawPages->getByIndex(nPage), uno::UNO_QUERY);
-Reference xNamed(xDrawPage, 
UNO_QUERY_THROW);
-if ( xNamed->getName() == aTitleText )
-bUseTitleAsSlideName = false;
-}
-if ( bUseTitleAsSlideName )
+if (bUseTitleAsSlideName)
 {
+for (sal_uInt32 nPage = 0; nPage < nMaxPages; ++nPage)
+{
+Reference 
xDrawPage(xDrawPages->getByIndex(nPage), uno::UNO_QUERY);
+Reference xNamed(xDrawPage, 
UNO_QUERY_THROW);
+OUString sRest;
+if (xNamed->getName().startsWith(aTitleText, 
)
+&& (sRest.isEmpty()
+|| (sRest.startsWith(" (") && 
sRest.endsWith(")")
+&& sRest.copy(2, sRest.getLength() - 
3).toInt32() > 0)))
+nCount++;
+}
 Reference 
xName(rSlidePersist.getPage(), UNO_QUERY_THROW);
-xName->setName(aTitleText);
+xName->setName(
+aTitleText
++ (nCount == 1 ? OUString("") : " (" + 
OUString::number(nCount) + ")"));
 }
 }
 catch (uno::Exception&)
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 8d7b5333f720..ad013f280180 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -3449,11 +3449,11 @@ void SdImportTest::testTdf103347()
 
 uno::Reference 
xPage2(xDoc->getDrawPages()->getByIndex(1), uno::UNO_QUERY);
 uno::Reference xNamed2(xPage2, uno::UNO_QUERY_THROW);
-CPPUNIT_ASSERT_EQUAL(OUString("page2"), xNamed2->getName());
+CPPUNIT_ASSERT_EQUAL(OUString("Hello (2)"), xNamed2->getName());
 
 uno::Reference 
xPage3(xDoc->getDrawPages()->getByIndex(2), uno::UNO_QUERY);
 uno::Reference xNamed3(xPage3, uno::UNO_QUERY_THROW);
-CPPUNIT_ASSERT_EQUAL(OUString("page3"), xNamed3->getName());
+CPPUNIT_ASSERT_EQUAL(OUString("Hello (3)"), xNamed3->getName());
 
 xDocShRef->DoClose();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - oox/source

2021-06-21 Thread Szabolcs Toth (via logerrit)
 oox/source/export/drawingml.cxx |   10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

New commits:
commit b25c9bd18cfa544578ac87020b2b41d881e73e7f
Author: Szabolcs Toth 
AuthorDate: Mon Jun 14 10:32:56 2021 +0200
Commit: László Németh 
CommitDate: Mon Jun 21 16:41:18 2021 +0200

tdf#137000: clean-up "XML shape export: fix upright"

See commit ff5ca4e5fc6a9fb24b0eb6eb629210b024473f67
"tdf#137000 XLSX shape export: fix upright".

Change-Id: Ie050da66f1eef4fc325b2acfd0a97d299c268153
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117135
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 20d2c2fe481eb66f518c554f8588ec87e0ee125a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117561
Tested-by: Jenkins

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 5f42dc18cd75..0372ae804b13 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -3127,13 +3127,7 @@ void DrawingML::WriteText(const Reference& 
rXIface, bool bBodyPr, bo
 
 std::optional sHorzOverflow;
 std::optional sVertOverflow;
-sal_Int32 nShapeRotateAngle = 0;
-if (GetProperty(rXPropSet, "RotateAngle"))
-nShapeRotateAngle = 
rXPropSet->getPropertyValue("RotateAngle").get() / 300;
-Reference< XPropertySet > xTextSet(xXText, UNO_QUERY);
-sal_Int32 nShapeTextRotateAngle = 0;
-if (GetProperty(xTextSet, "RotateAngle"))
-nShapeTextRotateAngle = 
rXPropSet->getPropertyValue("RotateAngle").get() / 300;
+sal_Int32 nShapeRotateAngle = 
rXPropSet->getPropertyValue("RotateAngle").get() / 300;
 sal_Int16 nCols = 0;
 sal_Int32 nColSpacing = -1;
 if (GetProperty(rXPropSet, "TextColumns"))
@@ -3193,7 +3187,7 @@ void DrawingML::WriteText(const Reference& 
rXIface, bool bBodyPr, bo
 // Keep upright and make the preRotateAngle 0, it is an 
attribute
 // of textBodyPr and must be 0 when upright is true, 
otherwise
 // bad rotation happens in MSO.
-if (nShapeRotateAngle == nOldShapeRotation && 
nShapeTextRotateAngle == nOldTextRotation)
+if (nShapeRotateAngle == nOldShapeRotation && 
nShapeRotateAngle == nOldTextRotation)
 nTextPreRotateAngle = 0;
 // So we rotated the shape, in this case lose upright and 
do
 // as LO normally does.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - oox/source sw/qa

2021-06-18 Thread Andreas Heinisch (via logerrit)
 oox/source/core/xmlfilterbase.cxx|3 ++-
 sw/qa/extras/ooxmlexport/data/tdf127864.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport2.cxx|   11 +++
 3 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit ac9827844564f86bc36a1f7492f3d8781ab8779c
Author: Andreas Heinisch 
AuthorDate: Fri Jun 11 21:40:35 2021 +0200
Commit: Xisco Fauli 
CommitDate: Fri Jun 18 16:26:57 2021 +0200

tdf#127864 - Export custom document properties using utf8 text encoding

Change-Id: Iaca1f9251e87ec199b55888c1ab6421a654d1f9f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117071
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch 
(cherry picked from commit d50501d1b4c015232c31c75a16b96143d43f7a3f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117416
Reviewed-by: Xisco Fauli 

diff --git a/oox/source/core/xmlfilterbase.cxx 
b/oox/source/core/xmlfilterbase.cxx
index a8532d206d31..307949ae4076 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -858,7 +858,8 @@ writeCustomProperties( XmlFilterBase& rSelf, const 
Reference< XDocumentPropertie
 {
 if ( !rProp.Name.isEmpty() )
 {
-OString aName = OUStringToOString( rProp.Name, 
RTL_TEXTENCODING_ASCII_US );
+// tdf#127864 - export custom document properties using utf8 text 
encoding
+OString aName = OUStringToOString(rProp.Name, 
RTL_TEXTENCODING_UTF8);
 // Skip storing these values in Custom Properties as it will be 
stored in Core/Extended Properties
 if (( aName == "OOXMLCorePropertyCategory" ) || // stored in 
cp:category
 ( aName == "OOXMLCorePropertyContentStatus" ) || // stored in 
cp:contentStatus
diff --git a/sw/qa/extras/ooxmlexport/data/tdf127864.docx 
b/sw/qa/extras/ooxmlexport/data/tdf127864.docx
new file mode 100644
index ..a9e59d933186
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf127864.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
index aa1378398992..aaecebc5cf94 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
@@ -155,6 +155,17 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCustomProperties, 
"custom-properties.doc
 assertXPathContent(pXmlDoc, "/cp:coreProperties/dc:identifier", 
"identifier");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testUTF8CustomProperties, "tdf127864.docx")
+{
+uno::Reference 
xDocumentPropertiesSupplier(
+mxComponent, uno::UNO_QUERY);
+uno::Reference xDocumentProperties
+= xDocumentPropertiesSupplier->getDocumentProperties();
+uno::Reference xPropertySet(
+xDocumentProperties->getUserDefinedProperties(), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString(u"первый"), 
getProperty(xPropertySet, u"первый"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testZoom, "zoom.docx")
 {
 uno::Reference xModel(mxComponent, uno::UNO_QUERY);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - oox/source sw/qa

2021-06-16 Thread Regina Henschel (via logerrit)
 oox/source/export/drawingml.cxx|4 +++-
 sw/qa/extras/ooxmlexport/data/tdf142361ShadowDirection.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport16.cxx |   13 +
 3 files changed, 16 insertions(+), 1 deletion(-)

New commits:
commit 1c0c11defaf6a83870725902825b1931f8ef50e5
Author: Regina Henschel 
AuthorDate: Tue Jun 15 01:47:44 2021 +0200
Commit: Xisco Fauli 
CommitDate: Wed Jun 16 09:29:30 2021 +0200

tdf#142361 export: prevent shadow to rotate with shape

OOXML has the feature to rotate a shadow together with the shape. The
associated attribute rotWithShape has the default value 'true'. So
if this attribute is missing, MS Office shows the shadow rotated. As
LibreOffice never rotates a shadow, we need to write this attribute
always. Because LibreOffice cannot rotate shadows, the error is only
visible in MS Office.

Here the attribute is added for the case of documents, which have no
InteropGrabBag or no effects in it.

When a shadow is generated in MS Office, MSO adds the attribute with
value 'false' (0) to the file. MS Office has no UI to set this
attribute. Problem is with cases, where the document comes from
MS Office, has effects in InteropGrabBag, but the shadow was set in
LibreOffice. To add the attribute in such cases too, bug tdf#142858
has to be fixed.

Change-Id: I5f1df416bca8ea15a305242afb140d852cfd84c0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117206
Tested-by: Jenkins
Reviewed-by: Regina Henschel 
(cherry picked from commit 58eeec036c3780188feccb0e1a752cfdee90a49b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117225
Reviewed-by: Xisco Fauli 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 385af08d590b..5f42dc18cd75 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -4241,7 +4241,7 @@ void DrawingML::WriteShapeEffects( const Reference< 
XPropertySet >& rXPropSet )
 if( bHasShadow )
 {
 Sequence< PropertyValue > aShadowGrabBag( 3 );
-Sequence< PropertyValue > aShadowAttribsGrabBag( 3 );
+Sequence< PropertyValue > aShadowAttribsGrabBag( 4 );
 
 double dX = +0.0, dY = +0.0;
 sal_Int32 nBlur =0;
@@ -4255,6 +4255,8 @@ void DrawingML::WriteShapeEffects( const Reference< 
XPropertySet >& rXPropSet )
 aShadowAttribsGrabBag[1].Value <<= lcl_CalculateDir(dX, dY);
 aShadowAttribsGrabBag[2].Name = "blurRad";
 aShadowAttribsGrabBag[2].Value <<=  
oox::drawingml::convertHmmToEmu(nBlur);
+aShadowAttribsGrabBag[3].Name = "rotWithShape";
+aShadowAttribsGrabBag[3].Value <<= false; //ooxml default is 
'true', so must write it
 
 aShadowGrabBag[0].Name = "Attribs";
 aShadowGrabBag[0].Value <<= aShadowAttribsGrabBag;
diff --git a/sw/qa/extras/ooxmlexport/data/tdf142361ShadowDirection.odt 
b/sw/qa/extras/ooxmlexport/data/tdf142361ShadowDirection.odt
new file mode 100644
index ..78372e603542
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf142361ShadowDirection.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
index a2217f3ab845..5899bd703ccc 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
@@ -492,6 +492,19 @@ DECLARE_OOXMLEXPORT_TEST(testCommentDoneModel, 
"CommentDone.docx")
 }
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_ShadowDirection, 
"tdf142361ShadowDirection.odt")
+{
+// The attribute 'rotWithShape' has the default value 'true' in OOXML, so 
Words interprets a
+// missing attribute as 'true'. That means that Word rotates the shadow if 
the shape is
+// rotated. Because in LibreOffice a shadow is never rotated, we must not 
omit this
+// attribute.
+xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+assertXPath(pXmlDoc,
+
"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent/mc:Choice/w:drawing/"
+
"wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw",
+"rotWithShape", "0");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits