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

2022-12-05 Thread Tibor Nagy (via logerrit)
 sd/qa/unit/data/pptx/tdf152186.pptx  |binary
 sd/qa/unit/import-tests2.cxx |   21 +
 sd/source/filter/eppt/pptx-epptooxml.cxx |   16 ++--
 3 files changed, 23 insertions(+), 14 deletions(-)

New commits:
commit 21044e1469e95d30422c498ad0119d0ce76a6acd
Author: Tibor Nagy 
AuthorDate: Thu Nov 24 14:51:55 2022 +0100
Commit: Xisco Fauli 
CommitDate: Mon Dec 5 13:24:10 2022 +

tdf#152186 PPTX export: fix shadow of the shape in theme

Placeholder line styles defined extra effectStyle, resulting
bad export with shadows.

Follow-up to commit 25e9766e9b87342b6f1b29dc146d5f33e12157a7
(tdf#9 PPTX export: fix line width of the shape in theme)

Change-Id: I02f1edea84b50dbb9b0e0a59b6062a29894afde4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143233
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/+/143479
Tested-by: Jenkins

diff --git a/sd/qa/unit/data/pptx/tdf152186.pptx 
b/sd/qa/unit/data/pptx/tdf152186.pptx
new file mode 100644
index ..c4160f2091a4
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf152186.pptx differ
diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx
index 1f73fc022a41..969eb250fb80 100644
--- a/sd/qa/unit/import-tests2.cxx
+++ b/sd/qa/unit/import-tests2.cxx
@@ -66,6 +66,7 @@ class SdImportTest2 : public SdModelTestBase
 public:
 virtual void setUp() override;
 
+void testTdf152186();
 void testTdf93868();
 void testTdf95932();
 void testTdf99030();
@@ -143,6 +144,7 @@ public:
 
 CPPUNIT_TEST_SUITE(SdImportTest2);
 
+CPPUNIT_TEST(testTdf152186);
 CPPUNIT_TEST(testTdf93868);
 CPPUNIT_TEST(testTdf95932);
 CPPUNIT_TEST(testTdf99030);
@@ -224,6 +226,25 @@ void SdImportTest2::setUp()
 mxDesktop.set(frame::Desktop::create(getComponentContext()));
 }
 
+void SdImportTest2::testTdf152186()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf152186.pptx"), 
PPTX);
+
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX);
+
+bool bHasShadow;
+const SdrPage* pPage = GetPage(1, xDocShRef);
+for (size_t i = 0; i < pPage->GetObjCount(); ++i)
+{
+uno::Reference xShape(getShapeFromPage(i, 0, 
xDocShRef));
+xShape->getPropertyValue("Shadow") >>= bHasShadow;
+CPPUNIT_ASSERT(!bHasShadow);
+}
+
+xDocShRef->DoClose();
+}
+
 void SdImportTest2::testTdf93868()
 {
 sd::DrawDocShellRef xDocShRef
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx 
b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 81b00cafea10..6a338a6a6fab 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -2016,22 +2016,10 @@ ShapeExport& 
PowerPointShapeExport::WritePlaceholderReferenceTextBody(
   \
   \
 \
-  \
-\
-  \
-\
-  \
-\
-  \
+  \
 \
 \
-  \
-\
-  \
-\
-  \
-\
-  \
+  \
 \
 \
   \


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

2022-11-25 Thread Tibor Nagy (via logerrit)
 sd/qa/unit/data/pptx/tdf9.pptx   |binary
 sd/qa/unit/export-tests-ooxml3.cxx   |   19 +++
 sd/source/filter/eppt/pptx-epptooxml.cxx |6 +++---
 3 files changed, 22 insertions(+), 3 deletions(-)

New commits:
commit 3c58ab7f075a0c8528f00a9f22919e598c18e092
Author: Tibor Nagy 
AuthorDate: Tue Nov 8 11:57:28 2022 +0100
Commit: Xisco Fauli 
CommitDate: Fri Nov 25 12:27:24 2022 +0100

tdf#9 PPTX export: fix line width of the shape in theme

Change shape line width values of minimal office theme
to the correct 0.5, 1, 1.5 pt (from  0.7, 2, 3 pt).

Change-Id: Ied7ad2e29daed9130df8b8c8d8baf5342f1c75da
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142427
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/+/143285
Tested-by: Jenkins

diff --git a/sd/qa/unit/data/pptx/tdf9.pptx 
b/sd/qa/unit/data/pptx/tdf9.pptx
new file mode 100644
index ..60ec3b886fe9
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf9.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml3.cxx 
b/sd/qa/unit/export-tests-ooxml3.cxx
index 499491d084f9..b1d66cdbed94 100644
--- a/sd/qa/unit/export-tests-ooxml3.cxx
+++ b/sd/qa/unit/export-tests-ooxml3.cxx
@@ -35,6 +35,7 @@
 class SdOOXMLExportTest3 : public SdModelTestBaseXML
 {
 public:
+void testTdf9();
 void testTdf129430();
 void testTdf114848();
 void testTdf147586();
@@ -124,6 +125,7 @@ public:
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest3);
 
+CPPUNIT_TEST(testTdf9);
 CPPUNIT_TEST(testTdf129430);
 CPPUNIT_TEST(testTdf114848);
 CPPUNIT_TEST(testTdf147586);
@@ -217,6 +219,23 @@ public:
 }
 };
 
+void SdOOXMLExportTest3::testTdf9()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf9.pptx"), 
PPTX);
+utl::TempFile tempFile;
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+xDocShRef->DoClose();
+
+xmlDocUniquePtr pXmlDocTheme = parseExport(tempFile, 
"ppt/theme/theme1.xml");
+assertXPath(pXmlDocTheme, 
"/a:theme/a:themeElements/a:fmtScheme/a:lnStyleLst/a:ln[1]", "w",
+"6350");
+assertXPath(pXmlDocTheme, 
"/a:theme/a:themeElements/a:fmtScheme/a:lnStyleLst/a:ln[2]", "w",
+"12700");
+assertXPath(pXmlDocTheme, 
"/a:theme/a:themeElements/a:fmtScheme/a:lnStyleLst/a:ln[3]", "w",
+"19050");
+}
+
 void SdOOXMLExportTest3::testTdf129430()
 {
 sd::DrawDocShellRef xDocShRef
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx 
b/sd/source/filter/eppt/pptx-epptooxml.cxx
index b3c56b6585e5..00e6de81885a 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -1990,7 +1990,7 @@ ShapeExport& 
PowerPointShapeExport::WritePlaceholderReferenceTextBody(
 \
   \
   \
-\
+\
   \
 \
   \
@@ -2000,14 +2000,14 @@ ShapeExport& 
PowerPointShapeExport::WritePlaceholderReferenceTextBody(
   \
   \
 \
-\
+\
   \
 \
   \
   \
   \
 \
-\
+\
   \
 \
   \


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

2022-09-05 Thread Miklos Vajna (via logerrit)
 sd/qa/filter/eppt/data/video-loop.pptx|binary
 sd/qa/filter/eppt/eppt.cxx|   26 
 sd/source/filter/eppt/pptx-animations.cxx |   47 --
 3 files changed, 65 insertions(+), 8 deletions(-)

New commits:
commit 8e70b8e64a1a5bdd231b0c41c93aaac18f5d0e66
Author: Miklos Vajna 
AuthorDate: Fri Sep 2 14:19:41 2022 +0200
Commit: Sarper Akdemir 
CommitDate: Mon Sep 5 12:53:57 2022 +0200

Related: tdf#149969 PPTX export: add loop from the animation of a media 
shape

The PPTX import maps media nodes to XAudio nodes, but the export side in
PPTXAnimationExport::WriteAnimationNodeAudio() only handled audio, not
video.

This is fine, that code was added for audio narration purposes, but the
same animation handles looping for videos, so this needs extending.

Fix the problem by exporting  conditionally and write video
markup (especially info about repeat count) when the content of the
media shape is video, not audio.

(cherry picked from commit 38671e21d7dbcd5019912b9468305018de0c922e)

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

diff --git a/sd/qa/filter/eppt/data/video-loop.pptx 
b/sd/qa/filter/eppt/data/video-loop.pptx
new file mode 100644
index ..4cb7e20b7428
Binary files /dev/null and b/sd/qa/filter/eppt/data/video-loop.pptx differ
diff --git a/sd/qa/filter/eppt/eppt.cxx b/sd/qa/filter/eppt/eppt.cxx
index 1e8e2c7e1491..151b9cfce27a 100644
--- a/sd/qa/filter/eppt/eppt.cxx
+++ b/sd/qa/filter/eppt/eppt.cxx
@@ -125,6 +125,32 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeExport)
 // i.e. the RGB color was lost on export.
 xComponent->dispose();
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testLoopingFromAnimation)
+{
+// Given a media shape that has an animation that specifies looping for 
the video:
+OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + 
"video-loop.pptx";
+getComponent() = loadFromDesktop(aURL);
+
+// When exporting that to PPTX:
+utl::TempFile aTempFile;
+uno::Reference xStorable(getComponent(), uno::UNO_QUERY);
+utl::MediaDescriptor aMediaDescriptor;
+aMediaDescriptor["FilterName"] <<= OUString("Impress Office Open XML");
+aTempFile.EnableKillingFile();
+xStorable->storeToURL(aTempFile.GetURL(), 
aMediaDescriptor.getAsConstPropertyValueList());
+validate(aTempFile.GetFileName(), test::OOXML);
+
+// Then make sure that the "infinite" repeat count is written:
+std::unique_ptr pStream = parseExportStream(aTempFile, 
"ppt/slides/slide1.xml");
+xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+// Without the fix in place, this test would have failed with:
+// - Expected: 1
+// - Actual  : 0
+// - In <>, XPath '//p:cMediaNode/p:cTn' number of nodes is incorrect
+// i.e. the media node was lost on export, the video no longer looped.
+assertXPath(pXmlDoc, "//p:cMediaNode/p:cTn", "repeatCount", "indefinite");
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sd/source/filter/eppt/pptx-animations.cxx 
b/sd/source/filter/eppt/pptx-animations.cxx
index 54dab17d1972..1c901573c00a 100644
--- a/sd/source/filter/eppt/pptx-animations.cxx
+++ b/sd/source/filter/eppt/pptx-animations.cxx
@@ -659,6 +659,9 @@ bool IsAudioURL(const OUString& rURL)
 {
 return rURL.endsWithIgnoreAsciiCase(".wav") || 
rURL.endsWithIgnoreAsciiCase(".m4a");
 }
+
+/// Returns if rURL has an extension which is a video format.
+bool IsVideoURL(const OUString& rURL) { return 
rURL.endsWithIgnoreAsciiCase(".mp4"); }
 }
 
 namespace oox::core
@@ -1235,6 +1238,7 @@ void PPTXAnimationExport::WriteAnimationNodeAudio()
 bValid = true;
 }
 
+bool bVideo = false;
 if (!bValid)
 {
 if (xAudio->getSource() >>= xShape)
@@ -1243,7 +1247,8 @@ void PPTXAnimationExport::WriteAnimationNodeAudio()
 bool bHasMediaURL = 
xShapeProps->getPropertySetInfo()->hasPropertyByName("MediaURL");
 if (bHasMediaURL && (xShapeProps->getPropertyValue("MediaURL") >>= 
sUrl))
 {
-bValid = IsAudioURL(sUrl);
+bVideo = IsVideoURL(sUrl);
+bValid = IsAudioURL(sUrl) || bVideo;
 }
 }
 }
@@ -1256,12 +1261,31 @@ void PPTXAnimationExport::WriteAnimationNodeAudio()
 mrPowerPointExport.embedEffectAudio(mpFS, sUrl, sRelId, sName);
 }
 
-bool bNarration = xAudio->getNarration();
-mpFS->startElementNS(XML_p, XML_audio, XML_isNarration, bNarration ? "1" : 
"0");
-bool bHideDuringShow = xAudio->getHideDuringShow();
-mpFS->startElementNS(XML_p, XML_cMediaNode, XML_showWhenStopped, 
bHideDuringShow ? "0" : "1");
+if (bVideo)
+{
+mpFS->startElementNS(XML_p, XML_video);
+mpFS->startElementNS(XML_p, XML_cMediaNode);
+}
+else
+{
+bool 

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

2022-06-29 Thread Miklos Vajna (via logerrit)
 sd/qa/unit/uiimpress.cxx   |   15 +++
 sd/source/ui/view/drviews2.cxx |   34 ++
 2 files changed, 33 insertions(+), 16 deletions(-)

New commits:
commit 08daa6801ca48007fc4f676b3b90098b35f8f70e
Author: Miklos Vajna 
AuthorDate: Wed Jun 29 08:55:17 2022 +0200
Commit: Miklos Vajna 
CommitDate: Wed Jun 29 14:54:23 2022 +0200

tdf#149748 sd theme: fix crash on selecting none from color bar

Opening Impress, going to view -> color bar to enable it and then
clicking on "none" resulted in a crash.

This went wrong in commit f5db3b12ae1cd3bfe6ee5d260aec9532cc65f2dc (sd
theme: add UI (sidebar) for shape fill color, 2022-04-06), where I
assumed that in case the slot is a SID_ATTR_FILL_COLOR, then its item
set also has a SID_ATTR_FILL_COLOR key. This is usually true, but not in
case of "no color" (i.e. transparent).

Fix the problem by just skipping theming metadata for such a color.

It seems to me that the color set of a theme is not allowed to contain
such "no color" colors, so this should be safe.

(cherry picked from commit c09eb0f74c0a110e4a4cfc4783b59883aad30475)

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

diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx
index 2433d7c4cb73..b309b4e4754f 100644
--- a/sd/qa/unit/uiimpress.cxx
+++ b/sd/qa/unit/uiimpress.cxx
@@ -1008,6 +1008,21 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testFillColorTheme)
 CPPUNIT_ASSERT_EQUAL(static_cast(6000), nFillColorLumOff);
 }
 
+CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testFillColorNoColor)
+{
+// Given an empty Impress document:
+mxComponent = loadFromDesktop("private:factory/simpress",
+  
"com.sun.star.presentation.PresentationDocument");
+auto pImpressDocument = 
dynamic_cast(mxComponent.get());
+sd::ViewShell* pViewShell = 
pImpressDocument->GetDocShell()->GetViewShell();
+SfxDispatcher* pDispatcher = pViewShell->GetViewFrame()->GetDispatcher();
+
+// When dispatching a fill color that only has a fill style (no color), 
then make sure we don't
+// crash:
+XFillStyleItem aXFillStyleItem(drawing::FillStyle_NONE);
+pDispatcher->ExecuteList(SID_ATTR_FILL_COLOR, SfxCallMode::RECORD, { 
 });
+}
+
 CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf127696)
 {
 mxComponent = loadFromDesktop("private:factory/simpress",
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index a8906acfc40c..3d4e6b604aca 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -599,24 +599,26 @@ public:
 {
 // Merge the color parameters to the color itself.
 const XFillColorItem* pColorItem = static_cast(pArgs->GetItem(SID_ATTR_FILL_COLOR));
-assert(pColorItem);
-XFillColorItem aColorItem(*pColorItem);
-if (pArgs->GetItemState(SID_ATTR_COLOR_THEME_INDEX, false, ) 
== SfxItemState::SET)
+if (pColorItem)
 {
-auto pIntItem = static_cast(pItem);
-aColorItem.GetThemeColor().SetThemeIndex(pIntItem->GetValue());
-}
-if (pArgs->GetItemState(SID_ATTR_COLOR_LUM_MOD, false, ) == 
SfxItemState::SET)
-{
-auto pIntItem = static_cast(pItem);
-aColorItem.GetThemeColor().SetLumMod(pIntItem->GetValue());
-}
-if (pArgs->GetItemState(SID_ATTR_COLOR_LUM_OFF, false, ) == 
SfxItemState::SET)
-{
-auto pIntItem = static_cast(pItem);
-aColorItem.GetThemeColor().SetLumOff(pIntItem->GetValue());
+XFillColorItem aColorItem(*pColorItem);
+if (pArgs->GetItemState(SID_ATTR_COLOR_THEME_INDEX, false, 
) == SfxItemState::SET)
+{
+auto pIntItem = static_cast(pItem);
+
aColorItem.GetThemeColor().SetThemeIndex(pIntItem->GetValue());
+}
+if (pArgs->GetItemState(SID_ATTR_COLOR_LUM_MOD, false, ) 
== SfxItemState::SET)
+{
+auto pIntItem = static_cast(pItem);
+aColorItem.GetThemeColor().SetLumMod(pIntItem->GetValue());
+}
+if (pArgs->GetItemState(SID_ATTR_COLOR_LUM_OFF, false, ) 
== SfxItemState::SET)
+{
+auto pIntItem = static_cast(pItem);
+aColorItem.GetThemeColor().SetLumOff(pIntItem->GetValue());
+}
+pArgs->Put(aColorItem);
 }
-pArgs->Put(aColorItem);
 }
 }
 }