summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2023-01-27 15:03:09 +0900
committerTomaž Vajngerl <quikee@gmail.com>2023-01-31 08:59:09 +0000
commit75c0d7827625c683d52a9e2f3a7c514df890107b (patch)
tree8ac5856ae7ae10a1aa558dfe2eca3fbe918d842d /oox
parented9d987e2ad8f6af554a5fc1f858ca48c6970446 (diff)
sd: use XTheme to transport the theme to xmloff import/export
Refactor the existing places and tests in Impress code (sd) to use it instead. Also keep the old property of construction and view of the theme with a sequence of property values, but under the new property named "ThemeUnoRepresentation". This is needed by the UI tests currently. Change-Id: I484567f4a603f1a5e2e03955fdd2b63132dcc66e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146225 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/qa/unit/drawingml.cxx28
1 files changed, 16 insertions, 12 deletions
diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx
index 5c09ca3de463..3355b66e79f6 100644
--- a/oox/qa/unit/drawingml.cxx
+++ b/oox/qa/unit/drawingml.cxx
@@ -28,8 +28,10 @@
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/text/XTextRange.hpp>
#include <com/sun/star/table/XCellRange.hpp>
+#include <com/sun/star/util/XTheme.hpp>
#include <docmodel/uno/UnoThemeColor.hxx>
+#include <docmodel/uno/UnoTheme.hxx>
#include <comphelper/sequenceashashmap.hxx>
@@ -373,19 +375,21 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testPptxTheme)
uno::Reference<drawing::XMasterPageTarget> xDrawPage(
xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
uno::Reference<beans::XPropertySet> xMasterpage(xDrawPage->getMasterPage(), uno::UNO_QUERY);
- comphelper::SequenceAsHashMap aMap(xMasterpage->getPropertyValue("Theme"));
- CPPUNIT_ASSERT_EQUAL(OUString("Office Theme"), aMap["Name"].get<OUString>());
- // Without the accompanying fix in place, this test would have failed with:
- // - Cannot extract an Any(void) to string!
- // i.e. the name of the color scheme was lost on import.
- CPPUNIT_ASSERT_EQUAL(OUString("Office"), aMap["ColorSchemeName"].get<OUString>());
- // Check the last color in the color set, value is from ppt/theme/theme1.xml.
- // Without the accompanying fix in place, this test would have failed with:
- // - Cannot extract an Any(void) to []long!
- auto aColorScheme = aMap["ColorScheme"].get<uno::Sequence<util::Color>>();
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(12), aColorScheme.getLength());
- CPPUNIT_ASSERT_EQUAL(static_cast<util::Color>(0x954F72), aColorScheme[11]);
+ uno::Reference<util::XTheme> xTheme;
+ xMasterpage->getPropertyValue("Theme") >>= xTheme;
+
+ // We expect the theme to be set on the master page
+ CPPUNIT_ASSERT(xTheme.is());
+ auto* pUnoTheme = dynamic_cast<UnoTheme*>(xTheme.get());
+ CPPUNIT_ASSERT(pUnoTheme);
+ auto const& rTheme = pUnoTheme->getTheme();
+
+ CPPUNIT_ASSERT_EQUAL(OUString("Office Theme"), rTheme.GetName());
+ CPPUNIT_ASSERT_EQUAL(OUString("Office"), rTheme.GetColorSet()->getName());
+
+ CPPUNIT_ASSERT_EQUAL(Color(0x954F72),
+ rTheme.GetColorSet()->getColor(model::ThemeColorType::FollowedHyperlink));
// Check the reference to that theme:
uno::Reference<drawing::XShapes> xDrawPageShapes(xDrawPage, uno::UNO_QUERY);