summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-11-19 13:44:40 +0100
committerMiklos Vajna <vmiklos@collabora.com>2021-11-19 15:28:42 +0100
commit32ae1ed7504d58f9216593cb87f25c480a0e623b (patch)
treec5f5907e1dd6a072e7be3473d4c0cb7cd114cc5a /svx
parent13aa5081793f133077610cd01b7f01ee765b4add (diff)
PPTX import: handle <a:clrScheme name="...">
We had doc model for this, but the UNO API and the PPTX import was missing. Change-Id: I199e9cc235a783d91700ce74f17d442f41d3c3f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125532 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'svx')
-rw-r--r--svx/source/styles/ColorSets.cxx21
-rw-r--r--svx/source/svdraw/svdmodel.cxx19
-rw-r--r--svx/source/svdraw/svdpage.cxx26
3 files changed, 59 insertions, 7 deletions
diff --git a/svx/source/styles/ColorSets.cxx b/svx/source/styles/ColorSets.cxx
index 8ab3d939ef5a..fbcf4bd4a889 100644
--- a/svx/source/styles/ColorSets.cxx
+++ b/svx/source/styles/ColorSets.cxx
@@ -164,11 +164,15 @@ void Theme::dumpAsXml(xmlTextWriterPtr pWriter) const
void Theme::ToAny(css::uno::Any& rVal) const
{
- beans::PropertyValues aValues = {
- comphelper::makePropertyValue("Name", maName)
- };
+ comphelper::SequenceAsHashMap aMap;
+ aMap["Name"] <<= maName;
- rVal <<= aValues;
+ if (mpColorSet)
+ {
+ aMap["ColorSchemeName"] <<= mpColorSet->getName();
+ }
+
+ rVal <<= aMap.getAsConstPropertyValueList();
}
std::unique_ptr<Theme> Theme::FromAny(const css::uno::Any& rVal)
@@ -184,6 +188,15 @@ std::unique_ptr<Theme> Theme::FromAny(const css::uno::Any& rVal)
pTheme = std::make_unique<Theme>(aName);
}
+ it = aMap.find("ColorSchemeName");
+ if (it != aMap.end() && pTheme)
+ {
+ OUString aName;
+ it->second >>= aName;
+ auto pColorSet = std::make_unique<ColorSet>(aName);
+ pTheme->SetColorSet(std::move(pColorSet));
+ }
+
return pTheme;
}
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index 6dcebf3ef541..8a19ce2b27a7 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -1874,12 +1874,25 @@ void SdrModel::dumpAsXml(xmlTextWriterPtr pWriter) const
(void)xmlTextWriterStartElement(pWriter, BAD_CAST("SdrModel"));
(void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
- sal_uInt16 nPageCount = GetPageCount();
- for (sal_uInt16 i = 0; i < nPageCount; ++i)
+ (void)xmlTextWriterStartElement(pWriter, BAD_CAST("maMasterPages"));
+ for (size_t i = 0; i < maMasterPages.size(); ++i)
{
- if (const SdrPage* pPage = GetPage(i))
+ if (const SdrPage* pPage = maMasterPages[i].get())
+ {
+ pPage->dumpAsXml(pWriter);
+ }
+ }
+ (void)xmlTextWriterEndElement(pWriter);
+
+ (void)xmlTextWriterStartElement(pWriter, BAD_CAST("maPages"));
+ for (size_t i = 0; i < maPages.size(); ++i)
+ {
+ if (const SdrPage* pPage = maPages[i].get())
+ {
pPage->dumpAsXml(pWriter);
+ }
}
+ (void)xmlTextWriterEndElement(pWriter);
if (mpImpl->mpTheme)
{
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index a0acaba2ee5f..1ebfe6cad4ac 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -1291,6 +1291,19 @@ void SdrPageProperties::SetTheme(std::unique_ptr<svx::Theme> pTheme) { mpTheme =
svx::Theme* SdrPageProperties::GetTheme() { return mpTheme.get(); }
+void SdrPageProperties::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+ (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SdrPageProperties"));
+ (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
+
+ if (mpTheme)
+ {
+ mpTheme->dumpAsXml(pWriter);
+ }
+
+ (void)xmlTextWriterEndElement(pWriter);
+}
+
SdrPage::SdrPage(SdrModel& rModel, bool bMasterPage)
: mrSdrModelFromSdrPage(rModel),
mnWidth(10),
@@ -1817,6 +1830,19 @@ bool SdrPage::checkVisibility(
return true;
}
+void SdrPage::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+ (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SdrPage"));
+ SdrObjList::dumpAsXml(pWriter);
+
+ if (mpSdrPageProperties)
+ {
+ mpSdrPageProperties->dumpAsXml(pWriter);
+ }
+
+ (void)xmlTextWriterEndElement(pWriter);
+}
+
// DrawContact support: Methods for handling Page changes
void SdrPage::ActionChanged()
{