diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx index 2edbfac23f47..ef3725868aba 100644 --- a/include/xmloff/xmltoken.hxx +++ b/include/xmloff/xmltoken.hxx @@ -3489,21 +3489,21 @@ namespace xmloff::token { XML_LINKED_STYLE_NAME, XML_THEME, + XML_THEME_COLORS, XML_THEME_TYPE, XML_CHAR_COMPLEX_COLOR, XML_FILL_COMPLEX_COLOR, - XML_DK1, - XML_LT1, - XML_DK2, - XML_LT2, + XML_DARK1, + XML_LIGHT1, + XML_DARK2, + XML_LIGHT2, XML_ACCENT1, XML_ACCENT2, XML_ACCENT3, XML_ACCENT4, XML_ACCENT5, XML_ACCENT6, - XML_HLINK, - XML_FOLHLINK, + XML_FOLLOWED_HYPERLINK, XML_CONTENT_CONTROL, XML_SHOWING_PLACE_HOLDER, diff --git a/oox/qa/unit/data/ReferenceShapeFill.fodp b/oox/qa/unit/data/ReferenceShapeFill.fodp index 09a231c0344d..d3db08712ac9 100644 --- a/oox/qa/unit/data/ReferenceShapeFill.fodp +++ b/oox/qa/unit/data/ReferenceShapeFill.fodp @@ -350,28 +350,28 @@ - + - + - + - + @@ -489,7 +489,7 @@ - + @@ -585,7 +585,7 @@ - + @@ -753,20 +753,20 @@ - - - - - + + + + + - - - + + + diff --git a/oox/qa/unit/data/tdf51195_Fontwork_ThemeColor.fodt b/oox/qa/unit/data/tdf51195_Fontwork_ThemeColor.fodt index 6f0da7b5c49b..8d2f8726d53b 100644 --- a/oox/qa/unit/data/tdf51195_Fontwork_ThemeColor.fodt +++ b/oox/qa/unit/data/tdf51195_Fontwork_ThemeColor.fodt @@ -312,20 +312,20 @@ - - - - - + + + + + - - - + + + @@ -358,7 +358,7 @@ - + @@ -367,7 +367,7 @@ - + diff --git a/oox/qa/unit/data/tdf51195_Fontwork_axialGradient.fodt b/oox/qa/unit/data/tdf51195_Fontwork_axialGradient.fodt index 3d8a5ff30ff8..fb792bd34e00 100644 --- a/oox/qa/unit/data/tdf51195_Fontwork_axialGradient.fodt +++ b/oox/qa/unit/data/tdf51195_Fontwork_axialGradient.fodt @@ -315,20 +315,20 @@ - - - - - + + + + + - - - + + + diff --git a/oox/qa/unit/data/tdf51195_Fontwork_ellipticalGradient.fodt b/oox/qa/unit/data/tdf51195_Fontwork_ellipticalGradient.fodt index 59493782dea4..01eeed1fd923 100644 --- a/oox/qa/unit/data/tdf51195_Fontwork_ellipticalGradient.fodt +++ b/oox/qa/unit/data/tdf51195_Fontwork_ellipticalGradient.fodt @@ -260,20 +260,20 @@ - - - - - + + + + + - - - + + + @@ -725,4 +725,4 @@ - \ No newline at end of file + diff --git a/oox/qa/unit/data/tdf51195_Fontwork_linearGradient.fodt b/oox/qa/unit/data/tdf51195_Fontwork_linearGradient.fodt index 49c43ff4b185..26673c2c9b96 100644 --- a/oox/qa/unit/data/tdf51195_Fontwork_linearGradient.fodt +++ b/oox/qa/unit/data/tdf51195_Fontwork_linearGradient.fodt @@ -256,20 +256,20 @@ - - - - - + + + + + - - - + + + @@ -413,4 +413,4 @@ Dummy - \ No newline at end of file + diff --git a/oox/qa/unit/data/tdf51195_Fontwork_radialGradient.fodt b/oox/qa/unit/data/tdf51195_Fontwork_radialGradient.fodt index 30ccfbfa5a53..2979e9a89582 100644 --- a/oox/qa/unit/data/tdf51195_Fontwork_radialGradient.fodt +++ b/oox/qa/unit/data/tdf51195_Fontwork_radialGradient.fodt @@ -260,20 +260,20 @@ - - - - - + + + + + - - - + + + @@ -392,4 +392,4 @@ - \ No newline at end of file + diff --git a/oox/qa/unit/data/tdf51195_Fontwork_rectGradient.fodt b/oox/qa/unit/data/tdf51195_Fontwork_rectGradient.fodt index 26c32e0cafce..85f1f6f9de89 100644 --- a/oox/qa/unit/data/tdf51195_Fontwork_rectGradient.fodt +++ b/oox/qa/unit/data/tdf51195_Fontwork_rectGradient.fodt @@ -319,20 +319,20 @@ - - - - - + + + + + - - - + + + diff --git a/oox/qa/unit/data/tdf51195_Fontwork_squareGradient.fodt b/oox/qa/unit/data/tdf51195_Fontwork_squareGradient.fodt index e1bd186e773d..ea343737ff6a 100644 --- a/oox/qa/unit/data/tdf51195_Fontwork_squareGradient.fodt +++ b/oox/qa/unit/data/tdf51195_Fontwork_squareGradient.fodt @@ -319,20 +319,20 @@ - - - - - + + + + + - - - + + + diff --git a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng index 3de7acbb8cae..d56acc1668ca 100644 --- a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng +++ b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng @@ -3322,7 +3322,7 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1. - + @@ -3331,9 +3331,9 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1. - - - + + + @@ -3352,7 +3352,7 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1. - + @@ -3465,24 +3465,18 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1. - - dk1 - - lt1 - - dk2 - - lt2 + dark1 + light1 + dark2 + light2 accent1 accent2 accent3 accent4 accent5 accent6 - - hlink - - folHlink + hyperlink + followed-hyperlink diff --git a/sw/qa/core/theme/ThemeTest.cxx b/sw/qa/core/theme/ThemeTest.cxx index 832dc11dc267..a7c937d9c923 100644 --- a/sw/qa/core/theme/ThemeTest.cxx +++ b/sw/qa/core/theme/ThemeTest.cxx @@ -368,7 +368,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testDrawPageThemeExistsDOCX) CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testDrawPageThemeExistsODT) { - createSwDoc("ThemeColorInHeading.odt"); + createSwDoc("ThemeColorInHeading.fodt"); SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT(pDoc); diff --git a/sw/qa/core/theme/data/ThemeColorInHeading.fodt b/sw/qa/core/theme/data/ThemeColorInHeading.fodt new file mode 100644 index 000000000000..943a654623a0 --- /dev/null +++ b/sw/qa/core/theme/data/ThemeColorInHeading.fodt @@ -0,0 +1,391 @@ + + + + Jan HolesovskyJan Holesovsky32021-04-01T13:52:002021-04-01T14:06:00PT3MLibreOfficeDev/7.6.0.0.alpha1$Linux_X86_64 LibreOffice_project/b1e712ba064530512e77a40bc354d8de9eb483e616.0000 + + + 0 + 0 + 23255 + 12584 + true + false + + + view2 + 3667 + 3464 + 0 + 0 + 23253 + 12582 + 0 + 1 + false + 180 + false + false + false + false + false + false + + + + + true + false + true + false + true + false + false + true + false + 0 + true + true + true + false + false + true + true + false + true + + true + true + true + true + false + true + true + false + false + true + true + true + true + true + false + false + false + 1826887 + false + + true + false + false + 1826887 + true + false + false + false + 1 + true + true + false + false + true + false + false + true + false + true + false + true + 0 + + false + true + true + true + + 0 + false + false + false + false + high-resolution + true + true + true + true + true + false + false + false + false + true + + true + true + true + true + + false + false + true + true + true + true + true + true + true + false + false + false + false + false + 0 + true + false + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Heading 1 + Heading 2 + This is a test document in the “Orange” theme. + + + \ No newline at end of file diff --git a/sw/qa/core/theme/data/ThemeColorInHeading.odt b/sw/qa/core/theme/data/ThemeColorInHeading.odt deleted file mode 100644 index 9931ac4e2dc1..000000000000 Binary files a/sw/qa/core/theme/data/ThemeColorInHeading.odt and /dev/null differ diff --git a/sw/source/filter/xml/xmlfmte.cxx b/sw/source/filter/xml/xmlfmte.cxx index e341c135d3e1..8769362430be 100644 --- a/sw/source/filter/xml/xmlfmte.cxx +++ b/sw/source/filter/xml/xmlfmte.cxx @@ -216,22 +216,22 @@ void SwXMLExport::ExportThemeElement(const uno::Reference& x auto pColorSet = pTheme->getColorSet(); if (!pColorSet->getName().isEmpty()) AddAttribute(XML_NAMESPACE_LO_EXT, XML_NAME, pColorSet->getName()); - SvXMLElementExport aColorTable(*this, XML_NAMESPACE_LO_EXT, XML_COLOR_TABLE, true, true); + SvXMLElementExport aColorTable(*this, XML_NAMESPACE_LO_EXT, XML_THEME_COLORS, true, true); static const XMLTokenEnum aColorTokens[] = { - XML_DK1, // Text 1 - XML_LT1, // Background 1 - XML_DK2, // Text 2 - XML_LT2, // Background 2 + XML_DARK1, // Text 1 + XML_LIGHT1, // Background 1 + XML_DARK2, // Text 2 + XML_LIGHT2, // Background 2 XML_ACCENT1, XML_ACCENT2, XML_ACCENT3, XML_ACCENT4, XML_ACCENT5, XML_ACCENT6, - XML_HLINK, // Hyperlink - XML_FOLHLINK, // Followed hyperlink + XML_HYPERLINK, // Hyperlink + XML_FOLLOWED_HYPERLINK, // Followed hyperlink }; for (auto eThemeColorType : o3tl::enumrange()) diff --git a/xmloff/inc/XMLThemeContext.hxx b/xmloff/inc/XMLThemeContext.hxx index a270d58bec99..ce6f5ec9bbb6 100644 --- a/xmloff/inc/XMLThemeContext.hxx +++ b/xmloff/inc/XMLThemeContext.hxx @@ -38,18 +38,18 @@ public: const css::uno::Reference& xAttribs) override; }; -/// Imports the color table of a theme -class XMLColorTableContext : public SvXMLImportContext +/// Imports the theme colors of a theme +class XMLThemeColorsContext : public SvXMLImportContext { model::Theme& mrTheme; std::shared_ptr m_pColorSet; std::vector m_aColorScheme; public: - XMLColorTableContext(SvXMLImport& rImport, - css::uno::Reference const& xAttrList, - model::Theme& mrTheme); - ~XMLColorTableContext(); + XMLThemeColorsContext(SvXMLImport& rImport, + css::uno::Reference const& xAttrList, + model::Theme& mrTheme); + ~XMLThemeColorsContext(); css::uno::Reference SAL_CALL createFastChildContext( sal_Int32 nElement, diff --git a/xmloff/qa/unit/data/theme.fodp b/xmloff/qa/unit/data/theme.fodp new file mode 100644 index 000000000000..b1e719d77959 --- /dev/null +++ b/xmloff/qa/unit/data/theme.fodp @@ -0,0 +1,997 @@ + + + + PowerPoint Presentationvmiklosvmiklos12021-11-22T13:38:232021-11-22T13:38:35P0DLibreOfficeDev/7.6.0.0.alpha1$Linux_X86_64 LibreOffice_project/e2dcf766684ce986dd5a68ddabc34d75374e13ba16.0000Widescreen1 + + + 0 + 0 + 14099 + 9999 + + + view1 + false + false + true + true + true + true + false + false + true + 1500 + false + Hw== + Hw== + + false + true + true + 0 + 0 + false + true + true + 4 + 0 + -1710 + -508 + 34958 + 22504 + 2000 + 2000 + 500 + 500 + 2000 + 4 + 2000 + 4 + false + 1500 + true + false + false + true + true + + + + + 6 + false + false + false + false + false + 0 + false + false + true + true + true + true + false + true + $(brandbaseurl)/share/palette%3B$(userpath)/config/standard.soe + true + true + + $(brandbaseurl)/share/palette%3B$(userpath)/config/standard.sog + $(brandbaseurl)/share/palette%3B$(userpath)/config/standard.sob + 2540 + + $(brandbaseurl)/share/palette%3B$(userpath)/config/standard.soc + 4 + true + 0 + false + 0 + false + false + low-resolution + true + false + false + true + $(brandbaseurl)/share/palette%3B$(userpath)/config/standard.sod + false + false + true + $(brandbaseurl)/share/palette%3B$(userpath)/config/standard.soh + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <number> + + + + + + + + + + + + + + + + + + + + + + + Click to edit Master title style + + + + + + + + + + + + + + + <number> + + + + + + + + + + + + + + + + + + + + + + + + + <number> + + + + + + + + + + Blue, Accent 1, Lighter 40% + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/xmloff/qa/unit/data/theme.odp b/xmloff/qa/unit/data/theme.odp deleted file mode 100644 index da8d189753f0..000000000000 Binary files a/xmloff/qa/unit/data/theme.odp and /dev/null differ diff --git a/xmloff/qa/unit/draw.cxx b/xmloff/qa/unit/draw.cxx index f3dae4d4c1df..7a379579b2e8 100644 --- a/xmloff/qa/unit/draw.cxx +++ b/xmloff/qa/unit/draw.cxx @@ -155,7 +155,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeExport) // - Actual : 0 // - XPath '//style:master-page/loext:theme/loext:color-table/loext:color' number of nodes is incorrect // i.e. the theme was lost on exporting to ODF. - assertXPath(pXmlDoc, "//style:master-page/loext:theme/loext:color-table/loext:color", 12); + assertXPath(pXmlDoc, "//style:master-page/loext:theme/loext:theme-colors/loext:color", 12); } CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testVideoSnapshot) @@ -204,7 +204,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testVideoSnapshot) CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeImport) { // Given a document that has a master page with a theme associated: - loadFromURL(u"theme.odp"); + loadFromURL(u"theme.fodp"); // Then make sure the doc model has a master page with a theme: uno::Reference xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); @@ -223,10 +223,12 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeImport) CPPUNIT_ASSERT(pTheme); CPPUNIT_ASSERT_EQUAL(OUString("Office Theme"), pTheme->GetName()); - CPPUNIT_ASSERT_EQUAL(OUString("Office"), pTheme->getColorSet()->getName()); + auto pColorSet = pTheme->getColorSet(); + CPPUNIT_ASSERT(pColorSet); + CPPUNIT_ASSERT_EQUAL(OUString("Office"), pColorSet->getName()); CPPUNIT_ASSERT_EQUAL(Color(0x954F72), - pTheme->getColorSet()->getColor(model::ThemeColorType::FollowedHyperlink)); + pColorSet->getColor(model::ThemeColorType::FollowedHyperlink)); } CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeColorExportImport) diff --git a/xmloff/qa/unit/text.cxx b/xmloff/qa/unit/text.cxx index 68a314289151..20147161d52f 100644 --- a/xmloff/qa/unit/text.cxx +++ b/xmloff/qa/unit/text.cxx @@ -984,19 +984,14 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testThemeExport) // Check if the 12 colors are written in the XML: xmlDocUniquePtr pXmlDoc = parseExport("styles.xml"); - assertXPath(pXmlDoc, "//office:styles/loext:theme/loext:color-table/loext:color", 12); - assertXPath(pXmlDoc, "//office:styles/loext:theme/loext:color-table/loext:color[1]", "name", - "dk1"); - assertXPath(pXmlDoc, "//office:styles/loext:theme/loext:color-table/loext:color[1]", "color", - "#101010"); - assertXPath(pXmlDoc, "//office:styles/loext:theme/loext:color-table/loext:color[2]", "name", - "lt1"); - assertXPath(pXmlDoc, "//office:styles/loext:theme/loext:color-table/loext:color[2]", "color", - "#202020"); - assertXPath(pXmlDoc, "//office:styles/loext:theme/loext:color-table/loext:color[12]", "name", - "folHlink"); - assertXPath(pXmlDoc, "//office:styles/loext:theme/loext:color-table/loext:color[12]", "color", - "#c0c0c0"); + OString aThemePath = "//office:styles/loext:theme/loext:theme-colors/loext:color"; + assertXPath(pXmlDoc, aThemePath, 12); + assertXPath(pXmlDoc, aThemePath + "[1]", "name", "dark1"); + assertXPath(pXmlDoc, aThemePath + "[1]", "color", "#101010"); + assertXPath(pXmlDoc, aThemePath + "[2]", "name", "light1"); + assertXPath(pXmlDoc, aThemePath + "[2]", "color", "#202020"); + assertXPath(pXmlDoc, aThemePath + "[12]", "name", "followed-hyperlink"); + assertXPath(pXmlDoc, aThemePath + "[12]", "color", "#c0c0c0"); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testFloatingTableExport) diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 56a1eaaef601..1e3d0b86faa0 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -3491,23 +3491,22 @@ namespace xmloff::token { TOKEN("linked-style-name", XML_LINKED_STYLE_NAME ), - TOKEN("theme", XML_THEME ), - TOKEN("theme-type", XML_THEME_TYPE ), + TOKEN("theme", XML_THEME), + TOKEN("theme-colors", XML_THEME_COLORS), + TOKEN("theme-type", XML_THEME_TYPE), TOKEN("char-complex-color", XML_CHAR_COMPLEX_COLOR), TOKEN("fill-complex-color", XML_FILL_COMPLEX_COLOR), - TOKEN("dk1", XML_DK1 ), - TOKEN("lt1", XML_LT1 ), - TOKEN("dk2", XML_DK2 ), - TOKEN("lt2", XML_LT2 ), - TOKEN("accent1", XML_ACCENT1 ), - TOKEN("accent2", XML_ACCENT2 ), - TOKEN("accent3", XML_ACCENT3 ), - TOKEN("accent4", XML_ACCENT4 ), - TOKEN("accent5", XML_ACCENT5 ), - TOKEN("accent6", XML_ACCENT6 ), - TOKEN("hlink", XML_HLINK ), - TOKEN("folHlink", XML_FOLHLINK ), - + TOKEN("dark1", XML_DARK1), + TOKEN("light1", XML_LIGHT1), + TOKEN("dark2", XML_DARK2), + TOKEN("light2", XML_LIGHT2), + TOKEN("accent1", XML_ACCENT1), + TOKEN("accent2", XML_ACCENT2), + TOKEN("accent3", XML_ACCENT3), + TOKEN("accent4", XML_ACCENT4), + TOKEN("accent5", XML_ACCENT5), + TOKEN("accent6", XML_ACCENT6), + TOKEN("followed-hyperlink", XML_FOLLOWED_HYPERLINK), TOKEN("content-control", XML_CONTENT_CONTROL ), TOKEN("showing-place-holder", XML_SHOWING_PLACE_HOLDER ), TOKEN("checked-state", XML_CHECKED_STATE), diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx index 5a07d78ce249..915c3e9360c0 100644 --- a/xmloff/source/draw/sdxmlexp.cxx +++ b/xmloff/source/draw/sdxmlexp.cxx @@ -2383,30 +2383,34 @@ void SdXMLExport::ExportThemeElement(const uno::Reference& x return; auto pTheme = pUnoTheme->getTheme(); + if (!pTheme) + return; + auto pColorSet = pTheme->getColorSet(); + if (!pColorSet) + return; if (!pTheme->GetName().isEmpty()) AddAttribute(XML_NAMESPACE_LO_EXT, XML_NAME, pTheme->GetName()); SvXMLElementExport aTheme(*this, XML_NAMESPACE_LO_EXT, XML_THEME, true, true); - auto pColorSet = pTheme->getColorSet(); if (!pColorSet->getName().isEmpty()) AddAttribute(XML_NAMESPACE_LO_EXT, XML_NAME, pColorSet->getName()); - SvXMLElementExport aColorTable(*this, XML_NAMESPACE_LO_EXT, XML_COLOR_TABLE, true, true); + SvXMLElementExport aColorTable(*this, XML_NAMESPACE_LO_EXT, XML_THEME_COLORS, true, true); static const XMLTokenEnum aColorTokens[] = { - XML_DK1, // Text 1 - XML_LT1, // Background 1 - XML_DK2, // Text 2 - XML_LT2, // Background 2 + XML_DARK1, // Text 1 + XML_LIGHT1, // Background 1 + XML_DARK2, // Text 2 + XML_LIGHT2, // Background 2 XML_ACCENT1, XML_ACCENT2, XML_ACCENT3, XML_ACCENT4, XML_ACCENT5, XML_ACCENT6, - XML_HLINK, // Hyperlink - XML_FOLHLINK, // Followed hyperlink + XML_HYPERLINK, // Hyperlink + XML_FOLLOWED_HYPERLINK, // Followed hyperlink }; for (auto eThemeColorType : o3tl::enumrange()) diff --git a/xmloff/source/style/XMLThemeContext.cxx b/xmloff/source/style/XMLThemeContext.cxx index b123cae89561..1579af468003 100644 --- a/xmloff/source/style/XMLThemeContext.cxx +++ b/xmloff/source/style/XMLThemeContext.cxx @@ -54,23 +54,26 @@ XMLThemeContext::XMLThemeContext(SvXMLImport& rImport, XMLThemeContext::~XMLThemeContext() { - uno::Reference xPropertySet(m_xPage, uno::UNO_QUERY); - auto xTheme = model::theme::createXTheme(mpTheme); - xPropertySet->setPropertyValue("Theme", uno::Any(xTheme)); + if (mpTheme && mpTheme->getColorSet()) + { + uno::Reference xPropertySet(m_xPage, uno::UNO_QUERY); + auto xTheme = model::theme::createXTheme(mpTheme); + xPropertySet->setPropertyValue("Theme", uno::Any(xTheme)); + } } uno::Reference SAL_CALL XMLThemeContext::createFastChildContext( sal_Int32 nElement, const uno::Reference& xAttribs) { - if (nElement == XML_ELEMENT(LO_EXT, XML_COLOR_TABLE)) + if (nElement == XML_ELEMENT(LO_EXT, XML_THEME_COLORS)) { - return new XMLColorTableContext(GetImport(), xAttribs, *mpTheme); + return new XMLThemeColorsContext(GetImport(), xAttribs, *mpTheme); } return nullptr; } -XMLColorTableContext::XMLColorTableContext( +XMLThemeColorsContext::XMLThemeColorsContext( SvXMLImport& rImport, const uno::Reference& xAttrList, model::Theme& rTheme) : SvXMLImportContext(rImport) @@ -90,14 +93,15 @@ XMLColorTableContext::XMLColorTableContext( } } -XMLColorTableContext::~XMLColorTableContext() +XMLThemeColorsContext::~XMLThemeColorsContext() { if (m_pColorSet) mrTheme.setColorSet(m_pColorSet); } -uno::Reference SAL_CALL XMLColorTableContext::createFastChildContext( - sal_Int32 nElement, const uno::Reference& xAttribs) +uno::Reference + SAL_CALL XMLThemeColorsContext::createFastChildContext( + sal_Int32 nElement, const uno::Reference& xAttribs) { if (nElement == XML_ELEMENT(LO_EXT, XML_COLOR)) { @@ -136,13 +140,13 @@ XMLColorContext::XMLColorContext(SvXMLImport& rImport, if (!aName.isEmpty()) { auto eType = model::ThemeColorType::Unknown; - if (aName == u"dk1") + if (aName == u"dark1") eType = model::ThemeColorType::Dark1; - else if (aName == u"lt1") + else if (aName == u"light1") eType = model::ThemeColorType::Light1; - else if (aName == u"dk2") + else if (aName == u"dark2") eType = model::ThemeColorType::Dark2; - else if (aName == u"lt2") + else if (aName == u"light2") eType = model::ThemeColorType::Light2; else if (aName == u"accent1") eType = model::ThemeColorType::Accent1; @@ -156,9 +160,9 @@ XMLColorContext::XMLColorContext(SvXMLImport& rImport, eType = model::ThemeColorType::Accent5; else if (aName == u"accent6") eType = model::ThemeColorType::Accent6; - else if (aName == u"hlink") + else if (aName == u"hyperlink") eType = model::ThemeColorType::Hyperlink; - else if (aName == u"folHlink") + else if (aName == u"followed-hyperlink") eType = model::ThemeColorType::FollowedHyperlink; if (eType != model::ThemeColorType::Unknown) diff --git a/xmloff/source/text/XMLComplexColorContext.cxx b/xmloff/source/text/XMLComplexColorContext.cxx index 88d1eca12bfa..a01d6ae195af 100644 --- a/xmloff/source/text/XMLComplexColorContext.cxx +++ b/xmloff/source/text/XMLComplexColorContext.cxx @@ -23,11 +23,20 @@ using namespace css; using namespace xmloff::token; -SvXMLEnumMapEntry const pXML_ThemeColor_Enum[] - = { { XML_NONE, -1 }, { XML_DK1, 0 }, { XML_LT1, 1 }, { XML_DK2, 2 }, - { XML_LT2, 3 }, { XML_ACCENT1, 4 }, { XML_ACCENT2, 5 }, { XML_ACCENT3, 6 }, - { XML_ACCENT4, 7 }, { XML_ACCENT5, 8 }, { XML_ACCENT6, 9 }, { XML_HLINK, 10 }, - { XML_FOLHLINK, 11 }, { XML_TOKEN_INVALID, 0 } }; +SvXMLEnumMapEntry const pXML_ThemeColor_Enum[] = { { XML_NONE, -1 }, + { XML_DARK1, 0 }, + { XML_LIGHT1, 1 }, + { XML_DARK2, 2 }, + { XML_LIGHT2, 3 }, + { XML_ACCENT1, 4 }, + { XML_ACCENT2, 5 }, + { XML_ACCENT3, 6 }, + { XML_ACCENT4, 7 }, + { XML_ACCENT5, 8 }, + { XML_ACCENT6, 9 }, + { XML_HYPERLINK, 10 }, + { XML_FOLLOWED_HYPERLINK, 11 }, + { XML_TOKEN_INVALID, 0 } }; XMLComplexColorContext::XMLComplexColorContext( SvXMLImport& rImport, sal_Int32 nElement, diff --git a/xmloff/source/text/XMLComplexColorExport.cxx b/xmloff/source/text/XMLComplexColorExport.cxx index ba2ead3a958d..57457e19c656 100644 --- a/xmloff/source/text/XMLComplexColorExport.cxx +++ b/xmloff/source/text/XMLComplexColorExport.cxx @@ -29,8 +29,8 @@ XMLComplexColorExport::XMLComplexColorExport(SvXMLExport& rExport) namespace { constexpr const std::array constThemeColorTypeToToken{ - XML_DK1, XML_LT1, XML_DK2, XML_LT2, XML_ACCENT1, XML_ACCENT2, - XML_ACCENT3, XML_ACCENT4, XML_ACCENT5, XML_ACCENT6, XML_HLINK, XML_FOLHLINK + XML_DARK1, XML_LIGHT1, XML_DARK2, XML_LIGHT2, XML_ACCENT1, XML_ACCENT2, + XML_ACCENT3, XML_ACCENT4, XML_ACCENT5, XML_ACCENT6, XML_HYPERLINK, XML_FOLLOWED_HYPERLINK }; } diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt index 98487c15a103..d4fd4c7971c1 100644 --- a/xmloff/source/token/tokens.txt +++ b/xmloff/source/token/tokens.txt @@ -3236,21 +3236,21 @@ rtl symmetric linked-style-name theme +theme-colors theme-type char-complex-color fill-complex-color -dk1 -lt1 -dk2 -lt2 +dark1 +light1 +dark2 +light2 accent1 accent2 accent3 accent4 accent5 accent6 -hlink -folHlink +followed-hyperlink content-control showing-place-holder checked-state