sc/CppunitTest_sc_ucalc_document_themes.mk |   67 +++++++++++++++++++++++++++++
 sc/Module_sc.mk                            |    1 
 sc/qa/unit/ucalc_DocumentThemes.cxx        |   38 ++++++++++++++++
 svx/source/svdraw/svdpage.cxx              |    2 
 4 files changed, 107 insertions(+), 1 deletion(-)

New commits:
commit 60cc7b1fbe8e44f323016ce79a14c5c74c8b4cd0
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Wed Apr 12 16:04:42 2023 +0900
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Tue May 9 12:41:58 2023 +0200

    sc: enable document themes in Calc
    
    Create and check that the SdrPage, that is associated with the
    current sheet, has a model::Theme available on creation.
    
    Change-Id: I1814d4a86452b1a15ef01e0b2349d435405f4b7d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150263
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/sc/CppunitTest_sc_ucalc_document_themes.mk 
b/sc/CppunitTest_sc_ucalc_document_themes.mk
new file mode 100644
index 000000000000..b779a643ba19
--- /dev/null
+++ b/sc/CppunitTest_sc_ucalc_document_themes.mk
@@ -0,0 +1,67 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+#
+# 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/.
+#
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,sc_ucalc_document_themes))
+
+$(eval $(call 
gb_CppunitTest_use_common_precompiled_header,sc_ucalc_document_themes))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sc_ucalc_document_themes, \
+    sc/qa/unit/ucalc_DocumentThemes \
+))
+
+$(eval $(call gb_CppunitTest_use_externals,sc_ucalc_document_themes, \
+    boost_headers \
+    mdds_headers \
+    libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sc_ucalc_document_themes, \
+    basegfx \
+    comphelper \
+    cppu \
+    cppuhelper \
+    sal \
+    salhelper \
+    sax \
+    sc \
+    scqahelper \
+    sfx \
+    svxcore \
+    subsequenttest \
+    test \
+    tl \
+    unotest \
+    utl \
+    vcl \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sc_ucalc_document_themes,\
+    -I$(SRCDIR)/sc/source/ui/inc \
+    -I$(SRCDIR)/sc/inc \
+    $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,sc_ucalc_document_themes,\
+    offapi \
+    udkapi \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,sc_ucalc_document_themes))
+$(eval $(call gb_CppunitTest_use_ure,sc_ucalc_document_themes))
+$(eval $(call gb_CppunitTest_use_vcl,sc_ucalc_document_themes))
+$(eval $(call gb_CppunitTest_use_rdb,sc_ucalc_document_themes,services))
+$(eval $(call gb_CppunitTest_use_components,sc_ucalc_document_themes))
+$(eval $(call gb_CppunitTest_use_configuration,sc_ucalc_document_themes))
+$(eval $(call gb_CppunitTest_add_arguments,sc_ucalc_document_themes, \
+    
-env:arg-env=$(gb_Helper_LIBRARY_PATH_VAR)"$$$${$(gb_Helper_LIBRARY_PATH_VAR)+=$$$$$(gb_Helper_LIBRARY_PATH_VAR)}"
 \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 7531130809e8..ce76695b4e4b 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -46,6 +46,7 @@ $(eval $(call gb_Module_add_check_targets,sc,\
        CppunitTest_sc_ucalc_condformat \
        CppunitTest_sc_ucalc_copypaste \
        CppunitTest_sc_ucalc_datatransformation \
+       CppunitTest_sc_ucalc_document_themes \
        CppunitTest_sc_ucalc_formula \
        CppunitTest_sc_ucalc_formula2 \
        CppunitTest_sc_ucalc_parallelism \
diff --git a/sc/qa/unit/ucalc_DocumentThemes.cxx 
b/sc/qa/unit/ucalc_DocumentThemes.cxx
new file mode 100644
index 000000000000..5c568b9f5ca0
--- /dev/null
+++ b/sc/qa/unit/ucalc_DocumentThemes.cxx
@@ -0,0 +1,38 @@
+/* -*- 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 "helper/qahelper.hxx"
+#include <docsh.hxx>
+#include <svx/svdpage.hxx>
+
+using namespace css;
+
+class DocumentThemesTest : public ScUcalcTestBase
+{
+};
+
+namespace
+{
+CPPUNIT_TEST_FIXTURE(DocumentThemesTest, testThemes)
+{
+    m_pDoc->InitDrawLayer();
+    m_pDoc->InsertTab(0, "Test");
+    ScDrawLayer* pDrawLayer = m_pDoc->GetDrawLayer();
+    CPPUNIT_ASSERT(pDrawLayer);
+    const SdrPage* pPage(pDrawLayer->GetPage(0));
+    CPPUNIT_ASSERT(pPage);
+    auto const& pTheme = pPage->getSdrPageProperties().GetTheme();
+    CPPUNIT_ASSERT(pTheme);
+}
+
+} // end anonymous namespace
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index ac3bb93f81f3..b2a839a3c785 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -1218,7 +1218,7 @@ SdrPageProperties::SdrPageProperties(SdrPage& rSdrPage)
         maProperties.Put(XFillStyleItem(drawing::FillStyle_NONE));
     }
 
-    if (rSdrPage.getSdrModelFromSdrPage().IsWriter() || 
rSdrPage.IsMasterPage())
+    //if (rSdrPage.getSdrModelFromSdrPage().IsWriter() || 
rSdrPage.IsMasterPage())
     {
         mpTheme.reset(new model::Theme("Office Theme"));
         auto const* pColorSet = 
svx::ColorSets::get().getColorSet(u"LibreOffice");

Reply via email to