[Libreoffice-commits] core.git: framework/inc framework/Library_fwk.mk framework/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Mon Jul 19 08:55:45 UTC 2021


 framework/Library_fwk.mk                                          |    1 
 framework/inc/uiconfiguration/imagemanager.hxx                    |    2 
 framework/inc/uiconfiguration/moduleimagemanager.hxx              |   73 ----
 framework/source/uiconfiguration/imagemanager.cxx                 |    6 
 framework/source/uiconfiguration/moduleimagemanager.cxx           |  155 ----------
 framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx |   12 
 framework/source/uiconfiguration/uiconfigurationmanager.cxx       |   18 -
 7 files changed, 15 insertions(+), 252 deletions(-)

New commits:
commit ef19c82f6ade323e2708b93d77cf50ffe8b9fcfd
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jul 19 09:14:21 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Jul 19 10:55:10 2021 +0200

    merge ModuleImageManager into ImageManager
    
    they share an underlying impl, so no need to have separate classes
    
    Change-Id: I1093f72265f67c7ccf3c2a064c86441d792512d2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119156
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/framework/Library_fwk.mk b/framework/Library_fwk.mk
index 2d4fdda1c1ef..c8ffb1f1b36b 100644
--- a/framework/Library_fwk.mk
+++ b/framework/Library_fwk.mk
@@ -168,7 +168,6 @@ $(eval $(call gb_Library_add_exception_objects,fwk,\
     framework/source/uiconfiguration/graphicnameaccess \
     framework/source/uiconfiguration/imagemanager \
     framework/source/uiconfiguration/imagemanagerimpl \
-    framework/source/uiconfiguration/moduleimagemanager \
     framework/source/uiconfiguration/moduleuicfgsupplier \
     framework/source/uiconfiguration/moduleuiconfigurationmanager \
     framework/source/uiconfiguration/uicategorydescription \
diff --git a/framework/inc/uiconfiguration/imagemanager.hxx b/framework/inc/uiconfiguration/imagemanager.hxx
index 1688ba44c10c..aacc8bbd3c72 100644
--- a/framework/inc/uiconfiguration/imagemanager.hxx
+++ b/framework/inc/uiconfiguration/imagemanager.hxx
@@ -35,7 +35,7 @@ namespace framework
     class ImageManager final : public ::cppu::WeakImplHelper< css::ui::XImageManager, css::lang::XServiceInfo>
     {
         public:
-            ImageManager( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+            ImageManager( const css::uno::Reference< css::uno::XComponentContext >& rxContext, bool bForModule );
             virtual ~ImageManager() override;
 
             virtual OUString SAL_CALL getImplementationName() override
diff --git a/framework/inc/uiconfiguration/moduleimagemanager.hxx b/framework/inc/uiconfiguration/moduleimagemanager.hxx
deleted file mode 100644
index d9fc98971b9d..000000000000
--- a/framework/inc/uiconfiguration/moduleimagemanager.hxx
+++ /dev/null
@@ -1,73 +0,0 @@
-/* -*- 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/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#pragma once
-
-#include <com/sun/star/ui/XImageManager.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-
-#include <cppuhelper/implbase.hxx>
-#include <rtl/ustring.hxx>
-
-#include <memory>
-
-namespace framework
-{
-    class ImageManagerImpl;
-
-    class ModuleImageManager final : public ::cppu::WeakImplHelper< css::ui::XImageManager>
-    {
-        public:
-            ModuleImageManager( const css::uno::Reference< css::uno::XComponentContext >& xContext );
-            virtual ~ModuleImageManager() override;
-
-            // XComponent
-            virtual void SAL_CALL dispose() override;
-            virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
-            virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
-
-            // XInitialization
-            virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
-
-            // XImageManager
-            virtual void SAL_CALL reset() override;
-            virtual css::uno::Sequence< OUString > SAL_CALL getAllImageNames( ::sal_Int16 nImageType ) override;
-            virtual sal_Bool SAL_CALL hasImage( ::sal_Int16 nImageType, const OUString& aCommandURL ) override;
-            virtual css::uno::Sequence< css::uno::Reference< css::graphic::XGraphic > > SAL_CALL getImages( ::sal_Int16 nImageType, const css::uno::Sequence< OUString >& aCommandURLSequence ) override;
-            virtual void SAL_CALL replaceImages( ::sal_Int16 nImageType, const css::uno::Sequence< OUString >& aCommandURLSequence, const css::uno::Sequence< css::uno::Reference< css::graphic::XGraphic > >& aGraphicsSequence ) override;
-            virtual void SAL_CALL removeImages( ::sal_Int16 nImageType, const css::uno::Sequence< OUString >& aResourceURLSequence ) override;
-            virtual void SAL_CALL insertImages( ::sal_Int16 nImageType, const css::uno::Sequence< OUString >& aCommandURLSequence, const css::uno::Sequence< css::uno::Reference< css::graphic::XGraphic > >& aGraphicSequence ) override;
-
-            // XUIConfiguration
-            virtual void SAL_CALL addConfigurationListener( const css::uno::Reference< css::ui::XUIConfigurationListener >& Listener ) override;
-            virtual void SAL_CALL removeConfigurationListener( const css::uno::Reference< css::ui::XUIConfigurationListener >& Listener ) override;
-
-            // XUIConfigurationPersistence
-            virtual void SAL_CALL reload() override;
-            virtual void SAL_CALL store() override;
-            virtual void SAL_CALL storeToStorage( const css::uno::Reference< css::embed::XStorage >& Storage ) override;
-            virtual sal_Bool SAL_CALL isModified() override;
-            virtual sal_Bool SAL_CALL isReadOnly() override;
-
-        private:
-            ::std::unique_ptr<ImageManagerImpl>                                               m_pImpl;
-   };
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/uiconfiguration/imagemanager.cxx b/framework/source/uiconfiguration/imagemanager.cxx
index b39c77b69a37..1e104b6df6a1 100644
--- a/framework/source/uiconfiguration/imagemanager.cxx
+++ b/framework/source/uiconfiguration/imagemanager.cxx
@@ -38,8 +38,8 @@ using namespace ::com::sun::star::beans;
 namespace framework
 {
 
-ImageManager::ImageManager( const uno::Reference< uno::XComponentContext >& rxContext ) :
-    m_pImpl( new ImageManagerImpl(rxContext, this, false) )
+ImageManager::ImageManager( const uno::Reference< uno::XComponentContext >& rxContext, bool bForModule ) :
+    m_pImpl( new ImageManagerImpl(rxContext, this, bForModule) )
 {
 }
 
@@ -167,7 +167,7 @@ com_sun_star_comp_framework_ImageManager_get_implementation(
     css::uno::XComponentContext *context,
     css::uno::Sequence<css::uno::Any> const &)
 {
-    return cppu::acquire(new framework::ImageManager(context));
+    return cppu::acquire(new framework::ImageManager(context, /*bForModule*/false));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/uiconfiguration/moduleimagemanager.cxx b/framework/source/uiconfiguration/moduleimagemanager.cxx
deleted file mode 100644
index 05041fe0f198..000000000000
--- a/framework/source/uiconfiguration/moduleimagemanager.cxx
+++ /dev/null
@@ -1,155 +0,0 @@
-/* -*- 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/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <uiconfiguration/moduleimagemanager.hxx>
-#include "imagemanagerimpl.hxx"
-
-#include <com/sun/star/beans/XPropertySet.hpp>
-
-#include <sal/log.hxx>
-
-//  namespaces
-
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::graphic::XGraphic;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::io;
-using namespace ::com::sun::star::embed;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::ui;
-
-namespace framework
-{
-ModuleImageManager::ModuleImageManager( const uno::Reference< uno::XComponentContext >& xContext ) :
-    m_pImpl( new ImageManagerImpl(xContext,static_cast< OWeakObject* >(this),true) )
-{
-}
-
-ModuleImageManager::~ModuleImageManager()
-{
-}
-
-// XComponent
-void SAL_CALL ModuleImageManager::dispose()
-{
-    m_pImpl->dispose();
-}
-
-void SAL_CALL ModuleImageManager::addEventListener( const uno::Reference< XEventListener >& xListener )
-{
-    m_pImpl->addEventListener(xListener);
-}
-
-void SAL_CALL ModuleImageManager::removeEventListener( const uno::Reference< XEventListener >& xListener )
-{
-    /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    m_pImpl->removeEventListener(xListener);
-}
-
-// XInitialization
-void SAL_CALL ModuleImageManager::initialize( const Sequence< Any >& aArguments )
-{
-    m_pImpl->initialize(aArguments);
-}
-
-// XImageManager
-void SAL_CALL ModuleImageManager::reset()
-{
-    m_pImpl->reset();
-}
-
-Sequence< OUString > SAL_CALL ModuleImageManager::getAllImageNames( ::sal_Int16 nImageType )
-{
-    return m_pImpl->getAllImageNames( nImageType );
-}
-
-sal_Bool SAL_CALL ModuleImageManager::hasImage( ::sal_Int16 nImageType, const OUString& aCommandURL )
-{
-    return m_pImpl->hasImage(nImageType,aCommandURL);
-}
-
-Sequence< uno::Reference< XGraphic > > SAL_CALL ModuleImageManager::getImages(
-    ::sal_Int16 nImageType,
-    const Sequence< OUString >& aCommandURLSequence )
-{
-    SAL_INFO( "fwk", "framework: ModuleImageManager::getImages" );
-    return m_pImpl->getImages(nImageType,aCommandURLSequence);
-}
-
-void SAL_CALL ModuleImageManager::replaceImages(
-    ::sal_Int16 nImageType,
-    const Sequence< OUString >& aCommandURLSequence,
-    const Sequence< uno::Reference< XGraphic > >& aGraphicsSequence )
-{
-    m_pImpl->replaceImages(nImageType,aCommandURLSequence,aGraphicsSequence);
-}
-
-void SAL_CALL ModuleImageManager::removeImages( ::sal_Int16 nImageType, const Sequence< OUString >& aCommandURLSequence )
-{
-    m_pImpl->removeImages(nImageType,aCommandURLSequence);
-}
-
-void SAL_CALL ModuleImageManager::insertImages( ::sal_Int16 nImageType, const Sequence< OUString >& aCommandURLSequence, const Sequence< uno::Reference< XGraphic > >& aGraphicSequence )
-{
-    m_pImpl->insertImages(nImageType,aCommandURLSequence,aGraphicSequence);
-}
-
-// XUIConfiguration
-void SAL_CALL ModuleImageManager::addConfigurationListener( const uno::Reference< css::ui::XUIConfigurationListener >& xListener )
-{
-    m_pImpl->addConfigurationListener(xListener);
-}
-
-void SAL_CALL ModuleImageManager::removeConfigurationListener( const uno::Reference< css::ui::XUIConfigurationListener >& xListener )
-{
-    m_pImpl->removeConfigurationListener(xListener);
-}
-
-// XUIConfigurationPersistence
-void SAL_CALL ModuleImageManager::reload()
-{
-    m_pImpl->reload();
-}
-
-void SAL_CALL ModuleImageManager::store()
-{
-    m_pImpl->store();
-}
-
-void SAL_CALL ModuleImageManager::storeToStorage( const uno::Reference< XStorage >& Storage )
-{
-    m_pImpl->storeToStorage(Storage);
-}
-
-sal_Bool SAL_CALL ModuleImageManager::isModified()
-{
-    return m_pImpl->isModified();
-}
-
-sal_Bool SAL_CALL ModuleImageManager::isReadOnly()
-{
-    return m_pImpl->isReadOnly();
-}
-
-} // namespace framework
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
index 27cb2974cf8d..d59c0158afac 100644
--- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
@@ -18,7 +18,7 @@
  */
 
 #include <accelerators/presethandler.hxx>
-#include <uiconfiguration/moduleimagemanager.hxx>
+#include <uiconfiguration/imagemanager.hxx>
 #include <uielement/constitemcontainer.hxx>
 #include <uielement/rootitemcontainer.hxx>
 #include <uielement/uielementtypenames.hxx>
@@ -212,7 +212,7 @@ private:
     css::uno::Reference< css::uno::XComponentContext >        m_xContext;
     osl::Mutex                                                m_mutex;
     ::cppu::OMultiTypeInterfaceContainerHelper                m_aListenerContainer;   /// container for ALL Listener
-    css::uno::Reference< css::lang::XComponent >              m_xModuleImageManager;
+    rtl::Reference< ImageManager >                            m_xModuleImageManager;
     css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xModuleAcceleratorManager;
 };
 
@@ -1394,9 +1394,7 @@ Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getImageManager()
 
     if ( !m_xModuleImageManager.is() )
     {
-        m_xModuleImageManager.set( static_cast< cppu::OWeakObject *>( new ModuleImageManager( m_xContext )),
-                                   UNO_QUERY );
-        Reference< XInitialization > xInit( m_xModuleImageManager, UNO_QUERY );
+        m_xModuleImageManager = new ImageManager( m_xContext, /*bForModule*/true );
 
         uno::Sequence<uno::Any> aPropSeq(comphelper::InitAnyPropertySequence(
         {
@@ -1404,10 +1402,10 @@ Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getImageManager()
             {"ModuleIdentifier", uno::Any(m_aModuleIdentifier)},
             {"UserRootCommit", uno::Any(m_xUserRootCommit)},
         }));
-        xInit->initialize( aPropSeq );
+        m_xModuleImageManager->initialize( aPropSeq );
     }
 
-    return Reference< XInterface >( m_xModuleImageManager, UNO_QUERY );
+    return Reference< XInterface >( static_cast<cppu::OWeakObject*>(m_xModuleImageManager.get()), UNO_QUERY );
 }
 
 Reference< ui::XAcceleratorConfiguration > SAL_CALL ModuleUIConfigurationManager::getShortCutManager()
diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
index e97cd33bb6c9..e210eb9d2ab5 100644
--- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
@@ -190,7 +190,7 @@ private:
     css::uno::Reference< css::uno::XComponentContext >        m_xContext;
     osl::Mutex                                                m_mutex;
     cppu::OMultiTypeInterfaceContainerHelper                  m_aListenerContainer;   /// container for ALL Listener
-    css::uno::Reference< css::lang::XComponent >              m_xImageManager;
+    rtl::Reference< ImageManager >                            m_xImageManager;
     css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xAccConfig;
 };
 
@@ -1111,9 +1111,7 @@ Reference< XInterface > SAL_CALL UIConfigurationManager::getImageManager()
 
     if ( !m_xImageManager.is() )
     {
-        m_xImageManager.set( static_cast< cppu::OWeakObject *>( new ImageManager( m_xContext )),
-                             UNO_QUERY );
-        Reference< XInitialization > xInit( m_xImageManager, UNO_QUERY );
+        m_xImageManager = new ImageManager( m_xContext, /*bForModule*/false );
 
         Sequence<Any> aPropSeq(comphelper::InitAnyPropertySequence(
         {
@@ -1121,10 +1119,10 @@ Reference< XInterface > SAL_CALL UIConfigurationManager::getImageManager()
             {"ModuleIdentifier", Any(OUString())},
         }));
 
-        xInit->initialize( aPropSeq );
+        m_xImageManager->initialize( aPropSeq );
     }
 
-    return Reference< XInterface >( m_xImageManager, UNO_QUERY );
+    return Reference< XInterface >( static_cast<cppu::OWeakObject*>(m_xImageManager.get()), UNO_QUERY );
 }
 
 Reference< XAcceleratorConfiguration > SAL_CALL UIConfigurationManager::getShortCutManager()
@@ -1178,12 +1176,8 @@ void SAL_CALL UIConfigurationManager::setStorage( const Reference< XStorage >& S
     if ( m_xAccConfig.is() )
         m_xAccConfig->setStorage( m_xDocConfigStorage );
 
-    if ( m_xImageManager.is() )
-    {
-        ImageManager* pImageManager = static_cast<ImageManager*>(m_xImageManager.get());
-        if ( pImageManager )
-            pImageManager->setStorage( m_xDocConfigStorage );
-    }
+    if ( m_xImageManager )
+        m_xImageManager->setStorage( m_xDocConfigStorage );
 
     if ( m_xDocConfigStorage.is() )
     {


More information about the Libreoffice-commits mailing list