[Libreoffice-commits] core.git: Branch 'feature/themesupport2' - include/sfx2 offapi/com offapi/UnoApi_offapi.mk sfx2/source

Sarper Akdemir (via logerrit) logerrit at kemper.freedesktop.org
Tue Sep 7 07:16:32 UTC 2021


 include/sfx2/sfxbasemodel.hxx                      |    6 +++++
 offapi/UnoApi_offapi.mk                            |    1 
 offapi/com/sun/star/document/XColorSetsManager.idl |   24 +++++++++++++++++++++
 sfx2/source/doc/sfxbasemodel.cxx                   |   22 +++++++++++++++++++
 4 files changed, 53 insertions(+)

New commits:
commit 3f1bca8b4f451fa30bf341116390738c456d651f
Author:     Sarper Akdemir <sarper.akdemir at collabora.com>
AuthorDate: Tue Sep 7 10:14:52 2021 +0300
Commit:     Sarper Akdemir <sarper.akdemir at collabora.com>
CommitDate: Tue Sep 7 10:14:52 2021 +0300

    WIP: introduce XColorSetsManager interface
    
    Change-Id: I3878749b5183ad2e39eafcbac8856e7bff16719c

diff --git a/include/sfx2/sfxbasemodel.hxx b/include/sfx2/sfxbasemodel.hxx
index b55705b57e1d..b96e8e25c786 100644
--- a/include/sfx2/sfxbasemodel.hxx
+++ b/include/sfx2/sfxbasemodel.hxx
@@ -28,6 +28,7 @@
 #include <com/sun/star/frame/XUntitledNumbers.hpp>
 #include <com/sun/star/container/XChild.hpp>
 #include <com/sun/star/document/XCmisDocument.hpp>
+#include <com/sun/star/document/XColorSetsManager.hpp>
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
 #include <com/sun/star/document/XDocumentRecovery.hpp>
 #include <com/sun/star/document/XUndoManagerSupplier.hpp>
@@ -42,6 +43,7 @@
 #include <com/sun/star/document/XScriptInvocationContext.hpp>
 #include <com/sun/star/lang/XEventListener.hpp>
 #include <com/sun/star/frame/XModel3.hpp>
+#include <com/sun/star/util/Color.hpp>
 #include <com/sun/star/util/XModifiable2.hpp>
 #include <com/sun/star/util/XCloseable.hpp>
 #include <com/sun/star/view/XPrintable.hpp>
@@ -115,6 +117,7 @@ namespace com::sun::star::util { class XModifyListener; }
 typedef ::cppu::WeakImplHelper  <   css::container::XChild
                                         ,   css::document::XDocumentPropertiesSupplier
                                         ,   css::document::XCmisDocument
+                                        ,   css::document::XColorSetsManager
                                         ,   css::rdf::XDocumentMetadataAccess
                                         ,   css::document::XDocumentRecovery
                                         ,   css::document::XUndoManagerSupplier
@@ -665,6 +668,9 @@ public:
     virtual sal_Bool SAL_CALL canCancelCheckOut( ) override;
     virtual sal_Bool SAL_CALL canCheckIn( ) override;
 
+    // XColorSetsManager
+    virtual void SAL_CALL addNewColorSet(const OUString& rColorSetName, const css::uno::Sequence<css::util::Color>& rColorSetColors) override;
+
     /// @throws css::uno::RuntimeException
     bool getBoolPropertyValue( const OUString& rName );
 
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 0de6196f54b4..fbb453a8ee1a 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -2221,6 +2221,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/document,\
 	XBinaryStreamResolver \
 	XCmisDocument \
 	XCodeNameQuery \
+	XColorSetsManager \
 	XCompatWriterDocProperties \
 	XDocumentEventBroadcaster \
 	XDocumentEventListener \
diff --git a/offapi/com/sun/star/document/XColorSetsManager.idl b/offapi/com/sun/star/document/XColorSetsManager.idl
new file mode 100644
index 000000000000..5e16df71e06b
--- /dev/null
+++ b/offapi/com/sun/star/document/XColorSetsManager.idl
@@ -0,0 +1,24 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+#pragma once
+
+#include <com/sun/star/uno/XInterface.idl>
+#include <com/sun/star/util/Color.idl>
+
+module com { module sun { module star { module document {
+
+interface XColorSetsManager: com::sun::star::uno::XInterface
+{
+  /* definitions of colorset functions here*/
+  void addNewColorSet( [in] string ColorSetName, [in] sequence < com::sun::star::util::Color > ColorSetColors );
+};
+
+}; }; }; };
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index c95c068463cd..d3d6479e47e4 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -99,6 +99,7 @@
 #include <objshimp.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/viewsh.hxx>
+#include <sfx2/ColorSets.hxx>
 #include <sfx2/docfile.hxx>
 #include <sfx2/docfilt.hxx>
 #include <sfx2/dispatch.hxx>
@@ -2735,6 +2736,27 @@ void SfxBaseModel::loadCmisProperties( )
     }
 }
 
+void SAL_CALL SfxBaseModel::addNewColorSet(const OUString& rColorSetName,
+               const css::uno::Sequence<css::util::Color>& rColorSetColors)
+{
+    if(SfxObjectShell* pObjShell = SfxObjectShell::Current())
+    {
+        if(const SfxColorSetListItem* pColorSetItem = pObjShell->GetItem(SID_COLOR_SETS))
+        {
+            pColorSetItem->GetSfxColorSetListPtr();//->AddNewColorSet( NAME, COLORS );
+            //SAL/_DEBUG("Got the ColorSet without a problem!");
+        }
+        else
+        {
+            //SAL/_DEBUG("Couldn't get pColorSetItem (in addNewColorSet)");
+        }
+    }
+    else
+    {
+        //SAL/_DEBUG("Couldn't get the object shell (in addNewColorSet)");
+    }
+}
+
 SfxMedium* SfxBaseModel::handleLoadError( ErrCode nError, SfxMedium* pMedium )
 {
     if (!nError)


More information about the Libreoffice-commits mailing list