summaryrefslogtreecommitdiff
path: root/docmodel/source
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2022-12-28 09:43:46 +0900
committerTomaž Vajngerl <quikee@gmail.com>2023-01-12 23:15:58 +0000
commitbd0f526f2d3e1ffe43a74672485815768eee6e9e (patch)
treefcb675aa06dcc3251f2c23961520ee317483a225 /docmodel/source
parentc945eafc99856f0bcd0a99195e2c5164c2a6d24a (diff)
introduce docmodel comp., model::ThemeColor, use it in SvxColorItem
Added a new component docmodel, that has the document model types, which only depend on other basic components. This is needed so the types can be used in every relevant component - xmloff, oox, svx, editeng,... Introduces model::ThemeColor, which is a class used to store the theme color data, including transformations (svx::Transformation). For UNO use XThemeColor is added, and the implementation UnoThemeColor which wraps svx::ThemeColor, so it can be tranported around. Reactor all the code and tests to accomodate for this change. Change-Id: I7ce6752cdfaf5e4d3b8e4d90314afa469dd65cfc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144847 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'docmodel/source')
-rw-r--r--docmodel/source/uno/UnoThemeColor.cxx40
1 files changed, 40 insertions, 0 deletions
diff --git a/docmodel/source/uno/UnoThemeColor.cxx b/docmodel/source/uno/UnoThemeColor.cxx
new file mode 100644
index 000000000000..f6374b54933b
--- /dev/null
+++ b/docmodel/source/uno/UnoThemeColor.cxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#include <docmodel/uno/UnoThemeColor.hxx>
+#include <cppuhelper/queryinterface.hxx>
+
+using namespace css;
+
+// css::lang::XUnoTunnel
+UNO3_GETIMPLEMENTATION_IMPL(UnoThemeColor);
+
+sal_Int16 UnoThemeColor::getType() { return sal_uInt16(maThemeColor.getType()); }
+
+namespace model::theme
+{
+uno::Reference<util::XThemeColor> createXThemeColor(model::ThemeColor const& rThemeColor)
+{
+ return new UnoThemeColor(rThemeColor);
+}
+
+void setFromXThemeColor(model::ThemeColor& rThemeColor,
+ uno::Reference<util::XThemeColor> const& rxColorTheme)
+{
+ UnoThemeColor* pUnoThemeColor = comphelper::getFromUnoTunnel<UnoThemeColor>(rxColorTheme);
+ if (pUnoThemeColor)
+ {
+ rThemeColor = pUnoThemeColor->getThemeColor();
+ }
+}
+
+} // end model::theme
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */