offapi/UnoApi_offapi.mk | 1 offapi/com/sun/star/drawing/XSlidePreviewCache.idl | 96 --------------------- sd/IwyuFilter_sd.yaml | 1 sd/inc/PresenterPreviewCache.hxx | 60 +++++-------- sd/source/console/PresenterSlideSorter.cxx | 14 --- sd/source/console/PresenterSlideSorter.hxx | 4 sd/source/ui/presenter/PresenterPreviewCache.cxx | 49 +--------- sd/util/sd.component | 4 solenv/bin/native-code.py | 1 solenv/clang-format/excludelist | 2 vcl/workben/cgmfuzzer.cxx | 2 11 files changed, 39 insertions(+), 195 deletions(-)
New commits: commit 009ab456009c003c687b1bdacd3dfd13419207d4 Author: Noel Grandin <[email protected]> AuthorDate: Sun Jun 15 14:09:40 2025 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Mon Jun 16 19:50:36 2025 +0200 no need for PresenterPreviewCache to be an UNO service anymore now that the slide console is not a separate component anymore. Change-Id: I21641e4157b8af4d44be91b15bc0b5740311472c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186568 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 836d02e19442..e0fa38a4815e 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -2389,7 +2389,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/drawing,\ XShapes \ XShapes2 \ XShapes3 \ - XSlidePreviewCache \ XSlidePreviewCacheListener \ XSlideRenderer \ XSlideSorterBase \ diff --git a/offapi/com/sun/star/drawing/XSlidePreviewCache.idl b/offapi/com/sun/star/drawing/XSlidePreviewCache.idl deleted file mode 100644 index e263155826bd..000000000000 --- a/offapi/com/sun/star/drawing/XSlidePreviewCache.idl +++ /dev/null @@ -1,96 +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 . - */ - -module com { module sun { module star { module drawing { - -/** A cache of preview bitmaps for the slides of one Impress or Draw - document in one size. There may be more than one cache for one - document. These are internally connected and for missing previews one - cache may take it from another cache and scale it to the desired size. - When a preview is not present then it is created asynchronously. On - creation all registered listeners are notified. - - Slides are referenced via their index in an XIndexAccess container in - order to allow multiple references to a single slide (custom - presentations). -*/ -interface XSlidePreviewCache -{ - /** Set the set of slides for which the cache will provide the - previews. All slides in the given XIndexAccess are required to come - from the given model. - @param xSlides - The set of slides for which the called cache will provide the - previews. This container defines the indices that are used to - look up slides. - @param xDocument - The model that contains the slides reference by the xSlides argument. - */ - void setDocumentSlides ( - [in] ::com::sun::star::container::XIndexAccess xSlides, - [in] ::com::sun::star::uno::XInterface xDocument); - - /** Define which slides are currently visible on the screen and which - are not. This information is used for give preview creation for - visible slides a higher priority than for those slides that are not - visible. - */ - void setVisibleRange ([in] long nFirstVisibleSlideIndex, [in] long nLastVisibleSlideIndex); - - /** Define the size of the previews that are managed by the called - cache. - */ - void setPreviewSize ([in] ::com::sun::star::geometry::IntegerSize2D aSize); - - /** Return a preview for the given slide index. - The returned bitmap may be the requested preview, a preview of the - preview, i.e. a scaled up or down version, or an empty reference - when the preview is not yet present. - - This call may lead to the asynchronous creation of the requested - preview. In that case all registered listeners are notified when - the preview has been created. - */ - ::com::sun::star::rendering::XBitmap getSlidePreview ( - [in] long nSlideIndex, - [in] ::com::sun::star::rendering::XCanvas xCanvas) - raises(::com::sun::star::lang::IllegalArgumentException); - - /** Register a listener that is called when a preview has been created - asynchronously. - */ - void addPreviewCreationNotifyListener ([in] XSlidePreviewCacheListener xListener); - - /** Remove a previously registered listener for preview creations. - */ - void removePreviewCreationNotifyListener ([in] XSlidePreviewCacheListener xListener); - - /** Stop the asynchronous creation of previews temporarily. - Call resume() to restart it. - */ - void pause (); - - /** Resume the asynchronous creation of slide previews. - */ - void resume (); -}; - -}; }; }; }; // ::com::sun::star::drawing - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/IwyuFilter_sd.yaml b/sd/IwyuFilter_sd.yaml index 6b0c52bd7a02..ea48da25860f 100644 --- a/sd/IwyuFilter_sd.yaml +++ b/sd/IwyuFilter_sd.yaml @@ -267,7 +267,6 @@ excludelist: - com/sun/star/lang/XInitialization.hpp sd/source/ui/presenter/PresenterPreviewCache.hxx: # base class has to be a complete type - - com/sun/star/drawing/XSlidePreviewCache.hpp - com/sun/star/lang/XInitialization.hpp sd/source/ui/presenter/PresenterCanvas.hxx: # base class has to be a complete type diff --git a/sd/source/ui/presenter/PresenterPreviewCache.hxx b/sd/inc/PresenterPreviewCache.hxx similarity index 58% rename from sd/source/ui/presenter/PresenterPreviewCache.hxx rename to sd/inc/PresenterPreviewCache.hxx index 9c4e5be7145a..dc336c6847fe 100644 --- a/sd/source/ui/presenter/PresenterPreviewCache.hxx +++ b/sd/inc/PresenterPreviewCache.hxx @@ -19,26 +19,25 @@ #pragma once -#include <com/sun/star/drawing/XSlidePreviewCache.hpp> -#include <com/sun/star/lang/XInitialization.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> +#include "sddllapi.h" #include <tools/gen.hxx> #include <comphelper/compbase.hxx> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/drawing/XSlidePreviewCacheListener.hpp> +#include <com/sun/star/geometry/IntegerSize2D.hpp> +#include <com/sun/star/rendering/XBitmap.hpp> +#include <com/sun/star/rendering/XCanvas.hpp> #include <memory> namespace sd::slidesorter::cache { class PageCache; } namespace sd::presenter { -typedef comphelper::WeakComponentImplHelper< - css::lang::XInitialization, - css::lang::XServiceInfo, - css::drawing::XSlidePreviewCache -> PresenterPreviewCacheInterfaceBase; +typedef comphelper::WeakComponentImplHelper<> PresenterPreviewCacheInterfaceBase; -/** Uno API wrapper around the slide preview cache. +/** wrapper around the slide preview cache. */ -class PresenterPreviewCache final +class SD_DLLPUBLIC PresenterPreviewCache final : public PresenterPreviewCacheInterfaceBase { public: @@ -47,44 +46,31 @@ public: PresenterPreviewCache(const PresenterPreviewCache&) = delete; PresenterPreviewCache& operator=(const PresenterPreviewCache&) = delete; - // XInitialize - - /** Accepts no arguments. All values that are necessary to set up a - preview cache can be provided via methods. - */ - virtual void SAL_CALL initialize (const css::uno::Sequence<css::uno::Any>& rArguments) override; - - OUString SAL_CALL getImplementationName() override; - sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override; - css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; - - // XSlidePreviewCache - - virtual void SAL_CALL setDocumentSlides ( + void setDocumentSlides ( const css::uno::Reference<css::container::XIndexAccess>& rxSlides, - const css::uno::Reference<css::uno::XInterface>& rxDocument) override; + const css::uno::Reference<css::uno::XInterface>& rxDocument); - virtual void SAL_CALL setVisibleRange ( + void setVisibleRange ( sal_Int32 nFirstVisibleSlideIndex, - sal_Int32 nLastVisibleSlideIndex) override; + sal_Int32 nLastVisibleSlideIndex); - virtual void SAL_CALL setPreviewSize ( - const css::geometry::IntegerSize2D& rSize) override; + void setPreviewSize ( + const css::geometry::IntegerSize2D& rSize); - virtual css::uno::Reference<css::rendering::XBitmap> SAL_CALL + css::uno::Reference<css::rendering::XBitmap> getSlidePreview ( sal_Int32 nSlideIndex, - const css::uno::Reference<css::rendering::XCanvas>& rxCanvas) override; + const css::uno::Reference<css::rendering::XCanvas>& rxCanvas); - virtual void SAL_CALL addPreviewCreationNotifyListener ( - const css::uno::Reference<css::drawing::XSlidePreviewCacheListener>& rxListener) override; + void addPreviewCreationNotifyListener ( + const css::uno::Reference<css::drawing::XSlidePreviewCacheListener>& rxListener); - virtual void SAL_CALL removePreviewCreationNotifyListener ( - const css::uno::Reference<css::drawing::XSlidePreviewCacheListener>& rxListener) override; + void removePreviewCreationNotifyListener ( + const css::uno::Reference<css::drawing::XSlidePreviewCacheListener>& rxListener) ; - virtual void SAL_CALL pause() override; + void pause(); - virtual void SAL_CALL resume() override; + void resume(); private: class PresenterCacheContext; diff --git a/sd/source/console/PresenterSlideSorter.cxx b/sd/source/console/PresenterSlideSorter.cxx index 077a2d3f3b52..8d4b9a8dd83c 100644 --- a/sd/source/console/PresenterSlideSorter.cxx +++ b/sd/source/console/PresenterSlideSorter.cxx @@ -301,11 +301,7 @@ PresenterSlideSorter::PresenterSlideSorter ( mpLayout = std::make_shared<Layout>(mpVerticalScrollBar); // Create the preview cache. - mxPreviewCache.set( - xFactory->createInstanceWithContext( - u"com.sun.star.drawing.PresenterPreviewCache"_ustr, - mxComponentContext), - UNO_QUERY_THROW); + mxPreviewCache = new sd::presenter::PresenterPreviewCache(); Reference<container::XIndexAccess> xSlides (mxSlideShowController, UNO_QUERY); mxPreviewCache->setDocumentSlides(xSlides, rxController->getModel()); mxPreviewCache->addPreviewCreationNotifyListener(this); @@ -376,11 +372,9 @@ void SAL_CALL PresenterSlideSorter::disposing() if (mxPreviewCache.is()) { mxPreviewCache->removePreviewCreationNotifyListener(this); - - Reference<XComponent> xComponent (mxPreviewCache, UNO_QUERY); + if (mxPreviewCache.is()) + mxPreviewCache->dispose(); mxPreviewCache = nullptr; - if (xComponent.is()) - xComponent->dispose(); } if (mxWindow.is()) @@ -401,7 +395,7 @@ void SAL_CALL PresenterSlideSorter::disposing (const lang::EventObject& rEventOb mxWindow = nullptr; dispose(); } - else if (rEventObject.Source == mxPreviewCache) + else if (rEventObject.Source == cppu::getXWeak(mxPreviewCache.get())) { mxPreviewCache = nullptr; dispose(); diff --git a/sd/source/console/PresenterSlideSorter.hxx b/sd/source/console/PresenterSlideSorter.hxx index ef047a41bdc8..9fe404d819bf 100644 --- a/sd/source/console/PresenterSlideSorter.hxx +++ b/sd/source/console/PresenterSlideSorter.hxx @@ -24,13 +24,13 @@ #include "PresenterController.hxx" #include "PresenterPaneContainer.hxx" #include "PresenterViewFactory.hxx" +#include <PresenterPreviewCache.hxx> #include <cppuhelper/basemutex.hxx> #include <cppuhelper/compbase.hxx> #include <com/sun/star/awt/XPaintListener.hpp> #include <com/sun/star/awt/XWindowListener.hpp> #include <com/sun/star/beans/XPropertyChangeListener.hpp> #include <com/sun/star/drawing/XDrawView.hpp> -#include <com/sun/star/drawing/XSlidePreviewCache.hpp> #include <com/sun/star/drawing/framework/XView.hpp> #include <com/sun/star/drawing/framework/XResourceId.hpp> #include <com/sun/star/frame/XController.hpp> @@ -137,7 +137,7 @@ private: css::uno::Reference<css::awt::XWindow> mxWindow; ::rtl::Reference<PresenterController> mpPresenterController; css::uno::Reference<css::presentation::XSlideShowController> mxSlideShowController; - css::uno::Reference<css::drawing::XSlidePreviewCache> mxPreviewCache; + rtl::Reference<sd::presenter::PresenterPreviewCache> mxPreviewCache; bool mbIsLayoutPending; class Layout; std::shared_ptr<Layout> mpLayout; diff --git a/sd/source/ui/presenter/PresenterPreviewCache.cxx b/sd/source/ui/presenter/PresenterPreviewCache.cxx index 052ed7e08538..e07b64dafa06 100644 --- a/sd/source/ui/presenter/PresenterPreviewCache.cxx +++ b/sd/source/ui/presenter/PresenterPreviewCache.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "PresenterPreviewCache.hxx" +#include <PresenterPreviewCache.hxx> #include <cache/SlsPageCache.hxx> #include <cache/SlsCacheContext.hxx> @@ -85,29 +85,7 @@ PresenterPreviewCache::~PresenterPreviewCache() { } -//----- XInitialize ----------------------------------------------------------- - -void SAL_CALL PresenterPreviewCache::initialize (const Sequence<Any>& rArguments) -{ - if (rArguments.hasElements()) - throw RuntimeException(); -} - -OUString PresenterPreviewCache::getImplementationName() { - return u"com.sun.star.comp.Draw.PresenterPreviewCache"_ustr; -} - -sal_Bool PresenterPreviewCache::supportsService(OUString const & ServiceName) { - return cppu::supportsService(this, ServiceName); -} - -css::uno::Sequence<OUString> PresenterPreviewCache::getSupportedServiceNames() { - return {u"com.sun.star.drawing.PresenterPreviewCache"_ustr}; -} - -//----- XSlidePreviewCache ---------------------------------------------------- - -void SAL_CALL PresenterPreviewCache::setDocumentSlides ( +void PresenterPreviewCache::setDocumentSlides ( const Reference<container::XIndexAccess>& rxSlides, const Reference<XInterface>& rxDocument) { @@ -119,7 +97,7 @@ void SAL_CALL PresenterPreviewCache::setDocumentSlides ( mpCacheContext->SetDocumentSlides(rxSlides, pImpressDoc); } -void SAL_CALL PresenterPreviewCache::setVisibleRange ( +void PresenterPreviewCache::setVisibleRange ( sal_Int32 nFirstVisibleSlideIndex, sal_Int32 nLastVisibleSlideIndex) { @@ -129,7 +107,7 @@ void SAL_CALL PresenterPreviewCache::setVisibleRange ( mpCacheContext->SetVisibleSlideRange (nFirstVisibleSlideIndex, nLastVisibleSlideIndex); } -void SAL_CALL PresenterPreviewCache::setPreviewSize ( +void PresenterPreviewCache::setPreviewSize ( const css::geometry::IntegerSize2D& rSize) { ThrowIfDisposed(); @@ -139,7 +117,7 @@ void SAL_CALL PresenterPreviewCache::setPreviewSize ( mpCache->ChangeSize(maPreviewSize, Bitmap::HasFastScale()); } -Reference<rendering::XBitmap> SAL_CALL PresenterPreviewCache::getSlidePreview ( +Reference<rendering::XBitmap> PresenterPreviewCache::getSlidePreview ( sal_Int32 nSlideIndex, const Reference<rendering::XCanvas>& rxCanvas) { @@ -162,7 +140,7 @@ Reference<rendering::XBitmap> SAL_CALL PresenterPreviewCache::getSlidePreview ( aPreview)->getUNOBitmap(); } -void SAL_CALL PresenterPreviewCache::addPreviewCreationNotifyListener ( +void PresenterPreviewCache::addPreviewCreationNotifyListener ( const Reference<drawing::XSlidePreviewCacheListener>& rxListener) { if (m_bDisposed) @@ -171,21 +149,21 @@ void SAL_CALL PresenterPreviewCache::addPreviewCreationNotifyListener ( mpCacheContext->AddPreviewCreationNotifyListener(rxListener); } -void SAL_CALL PresenterPreviewCache::removePreviewCreationNotifyListener ( +void PresenterPreviewCache::removePreviewCreationNotifyListener ( const css::uno::Reference<css::drawing::XSlidePreviewCacheListener>& rxListener) { ThrowIfDisposed(); mpCacheContext->RemovePreviewCreationNotifyListener(rxListener); } -void SAL_CALL PresenterPreviewCache::pause() +void PresenterPreviewCache::pause() { ThrowIfDisposed(); OSL_ASSERT(mpCache != nullptr); mpCache->Pause(); } -void SAL_CALL PresenterPreviewCache::resume() +void PresenterPreviewCache::resume() { ThrowIfDisposed(); OSL_ASSERT(mpCache != nullptr); @@ -364,13 +342,4 @@ void PresenterPreviewCache::PresenterCacheContext::CallListeners ( } // end of namespace ::sd::presenter - -extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* -com_sun_star_comp_Draw_PresenterPreviewCache_get_implementation(css::uno::XComponentContext*, - css::uno::Sequence<css::uno::Any> const &) -{ - return cppu::acquire(new sd::presenter::PresenterPreviewCache); -} - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/util/sd.component b/sd/util/sd.component index 9bf50c31a992..cc1b2c9e0d2e 100644 --- a/sd/util/sd.component +++ b/sd/util/sd.component @@ -33,10 +33,6 @@ <service name="com.sun.star.drawing.DrawingDocumentFactory"/> <service name="com.sun.star.presentation.PresentationDocument"/> </implementation> - <implementation name="com.sun.star.comp.Draw.PresenterPreviewCache" - constructor="com_sun_star_comp_Draw_PresenterPreviewCache_get_implementation"> - <service name="com.sun.star.drawing.PresenterPreviewCache"/> - </implementation> <implementation name="com.sun.star.comp.Draw.framework.ResourceId" constructor="com_sun_star_comp_Draw_framework_ResourceID_get_implementation"> <service name="com.sun.star.drawing.framework.ResourceId"/> diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py index 79401d0e3ea6..3e917bb37c80 100755 --- a/solenv/bin/native-code.py +++ b/solenv/bin/native-code.py @@ -693,7 +693,6 @@ draw_constructor_list = [ "sd_DrawingDocument_get_implementation", "com_sun_star_comp_Draw_DrawingModule_get_implementation", "sd_PresentationDocument_get_implementation", - "com_sun_star_comp_Draw_PresenterPreviewCache_get_implementation", "com_sun_star_comp_sd_InsertSlideController_get_implementation", "com_sun_star_comp_sd_SlideLayoutController_get_implementation", "com_sun_star_comp_sd_DisplayModeController_get_implementation", diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 252944c0701f..80f85379e0a8 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -9211,6 +9211,7 @@ sd/inc/EffectMigration.hxx sd/inc/FactoryIds.hxx sd/inc/OutlinerIterator.hxx sd/inc/PresenterHelper.hxx +sd/inc/PresenterPreviewCache.hxx sd/inc/SlideRenderer.hxx sd/inc/TransitionPreset.hxx sd/inc/animations.hxx @@ -9711,7 +9712,6 @@ sd/source/ui/presenter/PresenterCanvas.cxx sd/source/ui/presenter/PresenterCanvas.hxx sd/source/ui/presenter/PresenterHelper.cxx sd/source/ui/presenter/PresenterPreviewCache.cxx -sd/source/ui/presenter/PresenterPreviewCache.hxx sd/source/ui/presenter/PresenterTextView.cxx sd/source/ui/presenter/PresenterTextView.hxx sd/source/ui/presenter/SlideRenderer.cxx diff --git a/vcl/workben/cgmfuzzer.cxx b/vcl/workben/cgmfuzzer.cxx index 6a9c819ae1f2..7d2509d55de2 100644 --- a/vcl/workben/cgmfuzzer.cxx +++ b/vcl/workben/cgmfuzzer.cxx @@ -58,7 +58,6 @@ void linguistic_GrammarCheckingIterator_get_implementation( void ); void sd_DrawingDocument_get_implementation( void ); void com_sun_star_comp_Draw_DrawingModule_get_implementation( void ); void sd_PresentationDocument_get_implementation( void ); -void com_sun_star_comp_Draw_PresenterPreviewCache_get_implementation( void ); void com_sun_star_comp_sd_InsertSlideController_get_implementation( void ); void com_sun_star_comp_sd_SlideLayoutController_get_implementation( void ); void com_sun_star_comp_sd_DisplayModeController_get_implementation( void ); @@ -126,7 +125,6 @@ lo_get_constructor_map(void) { "sd_DrawingDocument_get_implementation", sd_DrawingDocument_get_implementation }, { "com_sun_star_comp_Draw_DrawingModule_get_implementation", com_sun_star_comp_Draw_DrawingModule_get_implementation }, { "sd_PresentationDocument_get_implementation", sd_PresentationDocument_get_implementation }, - { "com_sun_star_comp_Draw_PresenterPreviewCache_get_implementation", com_sun_star_comp_Draw_PresenterPreviewCache_get_implementation }, { "com_sun_star_comp_sd_InsertSlideController_get_implementation", com_sun_star_comp_sd_InsertSlideController_get_implementation }, { "com_sun_star_comp_sd_SlideLayoutController_get_implementation", com_sun_star_comp_sd_SlideLayoutController_get_implementation }, { "com_sun_star_comp_sd_DisplayModeController_get_implementation", com_sun_star_comp_sd_DisplayModeController_get_implementation },
