summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
Diffstat (limited to 'svx')
-rw-r--r--svx/qa/unit/ThemeTest.cxx4
-rw-r--r--svx/source/dialog/ThemeDialog.cxx3
-rw-r--r--svx/source/styles/ColorSets.cxx136
-rw-r--r--svx/source/svdraw/svdmodel.cxx8
-rw-r--r--svx/source/svdraw/svdpage.cxx4
5 files changed, 10 insertions, 145 deletions
diff --git a/svx/qa/unit/ThemeTest.cxx b/svx/qa/unit/ThemeTest.cxx
index 757561b1bd17..c3aeb93b0217 100644
--- a/svx/qa/unit/ThemeTest.cxx
+++ b/svx/qa/unit/ThemeTest.cxx
@@ -14,7 +14,7 @@
#include <config_features.h>
-#include <svx/ColorSets.hxx>
+#include <docmodel/theme/Theme.hxx>
namespace
{
@@ -24,7 +24,7 @@ class ThemeTest : public CppUnit::TestFixture
CPPUNIT_TEST_FIXTURE(ThemeTest, testPitchFamilyConversion)
{
- svx::ThemeFont aFont;
+ model::ThemeFont aFont;
aFont.maPitch = 2;
aFont.maFamily = 1;
diff --git a/svx/source/dialog/ThemeDialog.cxx b/svx/source/dialog/ThemeDialog.cxx
index ff078650d8e4..842a40203efa 100644
--- a/svx/source/dialog/ThemeDialog.cxx
+++ b/svx/source/dialog/ThemeDialog.cxx
@@ -10,11 +10,12 @@
#include <svx/dialog/ThemeDialog.hxx>
#include <docmodel/theme/ThemeColor.hxx>
#include <docmodel/theme/ColorSet.hxx>
+#include <docmodel/theme/Theme.hxx>
#include <vcl/svapp.hxx>
namespace svx
{
-ThemeDialog::ThemeDialog(weld::Window* pParent, svx::Theme* pTheme,
+ThemeDialog::ThemeDialog(weld::Window* pParent, model::Theme* pTheme,
std::shared_ptr<IThemeColorChanger> const& pChanger)
: GenericDialogController(pParent, "svx/ui/themedialog.ui", "ThemeDialog")
, mpTheme(pTheme)
diff --git a/svx/source/styles/ColorSets.cxx b/svx/source/styles/ColorSets.cxx
index 23adaf3281a1..145babb7d98d 100644
--- a/svx/source/styles/ColorSets.cxx
+++ b/svx/source/styles/ColorSets.cxx
@@ -11,18 +11,7 @@
#include <svx/ColorSets.hxx>
#include <utility>
-
-#include <libxml/xmlwriter.h>
-#include <comphelper/sequenceashashmap.hxx>
-#include <comphelper/sequence.hxx>
-#include <sal/log.hxx>
-#include <svx/svdpage.hxx>
-#include <svx/svditer.hxx>
-#include <editeng/unoprnms.hxx>
-#include <docmodel/uno/UnoThemeColor.hxx>
#include <docmodel/theme/ColorSet.hxx>
-#include <o3tl/enumrange.hxx>
-#include <com/sun/star/util/Color.hpp>
using namespace com::sun::star;
@@ -166,131 +155,6 @@ void ColorSets::insert(model::ColorSet const& rColorSet)
maColorSets.push_back(rColorSet);
}
-Theme::Theme(OUString const& rName)
- : maName(rName)
-{
-}
-
-void Theme::SetColorSet(std::unique_ptr<model::ColorSet> pColorSet) { mpColorSet = std::move(pColorSet); }
-
-const model::ColorSet* Theme::GetColorSet() const { return mpColorSet.get(); }
-
-model::ColorSet* Theme::GetColorSet() { return mpColorSet.get(); }
-
-void Theme::SetName(const OUString& rName) { maName = rName; }
-
-const OUString& Theme::GetName() const { return maName; }
-
-void Theme::dumpAsXml(xmlTextWriterPtr pWriter) const
-{
- (void)xmlTextWriterStartElement(pWriter, BAD_CAST("Theme"));
- (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
- (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("maName"),
- BAD_CAST(maName.toUtf8().getStr()));
-
- if (mpColorSet)
- {
- mpColorSet->dumpAsXml(pWriter);
- }
-
- (void)xmlTextWriterEndElement(pWriter);
-}
-
-void Theme::ToAny(css::uno::Any& rVal) const
-{
- comphelper::SequenceAsHashMap aMap;
- aMap["Name"] <<= maName;
-
- if (mpColorSet)
- {
- std::vector<util::Color> aColorScheme;
- for (auto eThemeColorType : o3tl::enumrange<model::ThemeColorType>())
- {
- if (eThemeColorType != model::ThemeColorType::Unknown)
- {
- Color aColor = mpColorSet->getColor(eThemeColorType);
- aColorScheme.push_back(sal_Int32(aColor));
- }
- }
-
- aMap["ColorSchemeName"] <<= mpColorSet->getName();
- aMap["ColorScheme"] <<= comphelper::containerToSequence(aColorScheme);
- }
-
- rVal <<= aMap.getAsConstPropertyValueList();
-}
-
-std::unique_ptr<Theme> Theme::FromAny(const css::uno::Any& rVal)
-{
- comphelper::SequenceAsHashMap aMap(rVal);
- std::unique_ptr<Theme> pTheme;
- model::ColorSet* pColorSet = nullptr;
-
- auto it = aMap.find("Name");
- if (it != aMap.end())
- {
- OUString aName;
- it->second >>= aName;
- pTheme = std::make_unique<Theme>(aName);
- }
-
- it = aMap.find("ColorSchemeName");
- if (it != aMap.end() && pTheme)
- {
- OUString aName;
- it->second >>= aName;
- auto pSet = std::make_unique<model::ColorSet>(aName);
- pTheme->SetColorSet(std::move(pSet));
- pColorSet = pTheme->GetColorSet();
- }
-
- it = aMap.find("ColorScheme");
- if (it != aMap.end() && pColorSet)
- {
- uno::Sequence<util::Color> aColors;
- it->second >>= aColors;
-
- SAL_WARN_IF(aColors.size() > 12, "svx", "Theme::FromAny: number of colors greater than max theme colors supported");
-
- for (auto eThemeColorType : o3tl::enumrange<model::ThemeColorType>())
- {
- if (eThemeColorType != model::ThemeColorType::Unknown)
- {
- size_t nIndex(static_cast<sal_Int16>(eThemeColorType));
- if (nIndex < aColors.size())
- {
- Color aColor(ColorTransparency, aColors[nIndex]);
- pColorSet->add(eThemeColorType, aColor);
- }
- }
- }
- }
-
- return pTheme;
-}
-
-std::vector<Color> Theme::GetColors() const
-{
- if (!mpColorSet)
- return {};
-
- std::vector<Color> aColors;
- for (auto eThemeColorType : o3tl::enumrange<model::ThemeColorType>())
- {
- if (eThemeColorType != model::ThemeColorType::Unknown)
- aColors.push_back(mpColorSet->getColor(eThemeColorType));
- }
- return aColors;
-}
-
-Color Theme::GetColor(model::ThemeColorType eType) const
-{
- if (!mpColorSet)
- return {};
-
- return mpColorSet->getColor(eType);
-}
-
} // end of namespace svx
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index bc86671c9437..28ec1e556f23 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -71,7 +71,7 @@
#include <o3tl/enumrange.hxx>
#include <comphelper/diagnose_ex.hxx>
#include <tools/UnitConversion.hxx>
-#include <svx/ColorSets.hxx>
+#include <docmodel/theme/Theme.hxx>
#include <svx/svditer.hxx>
#include <svx/svdoashp.hxx>
@@ -84,7 +84,7 @@ struct SdrModelImpl
SdrUndoFactory* mpUndoFactory;
bool mbAnchoredTextOverflowLegacy; // tdf#99729 compatibility flag
bool mbLegacySingleLineFontwork; // tdf#148000 compatibility flag
- std::unique_ptr<svx::Theme> mpTheme;
+ std::unique_ptr<model::Theme> mpTheme;
SdrModelImpl()
: mpUndoManager(nullptr)
@@ -1570,9 +1570,9 @@ void SdrModel::SetStarDrawPreviewMode(bool bPreview)
}
}
-void SdrModel::SetTheme(std::unique_ptr<svx::Theme> pTheme) { mpImpl->mpTheme = std::move(pTheme); }
+void SdrModel::SetTheme(std::unique_ptr<model::Theme> pTheme) { mpImpl->mpTheme = std::move(pTheme); }
-svx::Theme* SdrModel::GetTheme() { return mpImpl->mpTheme.get(); }
+model::Theme* SdrModel::GetTheme() { return mpImpl->mpTheme.get(); }
uno::Reference< uno::XInterface > const & SdrModel::getUnoModel()
{
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index 7ec883e397c5..cb2fb64e7e80 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -1288,7 +1288,7 @@ void SdrPageProperties::SetStyleSheet(SfxStyleSheet* pStyleSheet)
ImpPageChange(*mpSdrPage);
}
-void SdrPageProperties::SetTheme(std::unique_ptr<svx::Theme> pTheme)
+void SdrPageProperties::SetTheme(std::unique_ptr<model::Theme> pTheme)
{
mpTheme = std::move(pTheme);
@@ -1310,7 +1310,7 @@ void SdrPageProperties::SetTheme(std::unique_ptr<svx::Theme> pTheme)
}
}
-svx::Theme* SdrPageProperties::GetTheme() { return mpTheme.get(); }
+model::Theme* SdrPageProperties::GetTheme() { return mpTheme.get(); }
void SdrPageProperties::dumpAsXml(xmlTextWriterPtr pWriter) const
{