diff options
22 files changed, 80 insertions, 53 deletions
diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx index 6491cd56f62a..50f88cc93a3d 100644 --- a/sd/inc/drawdoc.hxx +++ b/sd/inc/drawdoc.hxx @@ -62,6 +62,7 @@ class SdrPage; class SdrTextObj; class SfxItemPool; class Size; +class SdXImpressDocument; namespace sd { @@ -231,6 +232,9 @@ public: SAL_DLLPRIVATE rtl::Reference<SdPage> AllocSdPage(bool bMasterPage); SAL_DLLPRIVATE virtual rtl::Reference<SdrPage> AllocPage(bool bMasterPage) override; //forwards to AllocSdPage + // Override SfxBaseModel::getUnoModel and return a more concrete type + SdXImpressDocument* getUnoModel(); + SAL_DLLPRIVATE virtual bool IsReadOnly() const override; SAL_DLLPRIVATE virtual void SetChanged(bool bFlag = true) override; diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx index 69e274afc906..c790ac1130a9 100644 --- a/sd/source/core/drawdoc2.cxx +++ b/sd/source/core/drawdoc2.cxx @@ -411,11 +411,17 @@ void SdDrawDocument::InsertPage(SdrPage* pPage, sal_uInt16 nPos) if (comphelper::LibreOfficeKit::isActive() && static_cast<SdPage*>(pPage)->GetPageKind() == PageKind::Standard) { - SdXImpressDocument* pDoc = comphelper::getFromUnoTunnel<SdXImpressDocument>(this->getUnoModel()); + SdXImpressDocument* pDoc = getUnoModel(); SfxLokHelper::notifyDocumentSizeChangedAllViews(pDoc); } } +// Override SfxBaseModel::getUnoModel and return a more concrete type +SdXImpressDocument* SdDrawDocument::getUnoModel() +{ + return comphelper::getFromUnoTunnel<SdXImpressDocument>(FmFormModel::getUnoModel()); +} + // Delete page void SdDrawDocument::DeletePage(sal_uInt16 nPgNum) { @@ -441,7 +447,7 @@ rtl::Reference<SdrPage> SdDrawDocument::RemovePage(sal_uInt16 nPgNum) if (comphelper::LibreOfficeKit::isActive() && pSdPage->GetPageKind() == PageKind::Standard) { - SdXImpressDocument* pDoc = comphelper::getFromUnoTunnel<SdXImpressDocument>(this->getUnoModel()); + SdXImpressDocument* pDoc = getUnoModel(); SfxLokHelper::notifyDocumentSizeChangedAllViews(pDoc); } diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx index 151de6445764..30c92016e305 100644 --- a/sd/source/ui/animations/SlideTransitionPane.cxx +++ b/sd/source/ui/animations/SlideTransitionPane.cxx @@ -25,6 +25,7 @@ #include <ViewShellBase.hxx> #include <DrawDocShell.hxx> #include <SlideSorterViewShell.hxx> +#include <unomodel.hxx> #include <drawdoc.hxx> #include <sdmod.hxx> #include <sdpage.hxx> diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.cxx b/sd/source/ui/dlg/PhotoAlbumDialog.cxx index 4a6cc71cb0e0..51f1b6fa5895 100644 --- a/sd/source/ui/dlg/PhotoAlbumDialog.cxx +++ b/sd/source/ui/dlg/PhotoAlbumDialog.cxx @@ -33,6 +33,7 @@ #include <sdresid.hxx> #include <drawdoc.hxx> #include <sdpage.hxx> +#include <unomodel.hxx> namespace sd { @@ -92,9 +93,9 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl, weld::Button&, void) } else { - Reference< drawing::XDrawPagesSupplier > xDPS( m_pDoc->getUnoModel(), uno::UNO_QUERY ); + rtl::Reference< SdXImpressDocument > xDPS( m_pDoc->getUnoModel() ); Reference< drawing::XDrawPages > xDrawPages = xDPS->getDrawPages(); - Reference< lang::XMultiServiceFactory > xShapeFactory( m_pDoc->getUnoModel(), uno::UNO_QUERY ); + rtl::Reference< SdXImpressDocument > xShapeFactory( m_pDoc->getUnoModel() ); Reference< XComponentContext > xContext(::comphelper::getProcessComponentContext()); Reference< graphic::XGraphicProvider> xProvider(graphic::GraphicProvider::create(xContext)); diff --git a/sd/source/ui/inc/SlideTransitionPane.hxx b/sd/source/ui/inc/SlideTransitionPane.hxx index ed5c84486486..5f8437c859aa 100644 --- a/sd/source/ui/inc/SlideTransitionPane.hxx +++ b/sd/source/ui/inc/SlideTransitionPane.hxx @@ -29,7 +29,7 @@ #include <map> class SdDrawDocument; - +class SdXImpressDocument; namespace com::sun::star::drawing { class XDrawView; } namespace com::sun::star::frame { class XModel; } namespace sd::tools { class EventMultiplexerEvent; } @@ -121,7 +121,7 @@ private: std::unique_ptr<weld::CheckButton> mxCB_AUTO_PREVIEW; css::uno::Reference< css::drawing::XDrawView > mxView; - css::uno::Reference< css::frame::XModel > mxModel; + rtl::Reference< SdXImpressDocument > mxModel; std::unordered_map<OUString, std::unique_ptr<TransitionEntry>> maTranstionMap; diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx index 2945a308005d..da857eebaef3 100644 --- a/sd/source/ui/inc/unomodel.hxx +++ b/sd/source/ui/inc/unomodel.hxx @@ -152,8 +152,8 @@ public: // XInterface virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; + SD_DLLPUBLIC virtual void SAL_CALL acquire() noexcept override; + SD_DLLPUBLIC virtual void SAL_CALL release() noexcept override; // XModel virtual void SAL_CALL lockControllers( ) override; @@ -188,7 +188,7 @@ public: virtual css::uno::Reference< css::presentation::XPresentation > SAL_CALL getPresentation( ) override; // XMultiServiceFactory ( SvxFmMSFactory ) - virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( const OUString& aServiceSpecifier ) override; + SD_DLLPUBLIC virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( const OUString& aServiceSpecifier ) override; virtual css::uno::Reference<css::uno::XInterface> SAL_CALL createInstanceWithArguments( OUString const & ServiceSpecifier, diff --git a/sd/source/ui/presenter/PresenterPreviewCache.cxx b/sd/source/ui/presenter/PresenterPreviewCache.cxx index c42dc8faa9a9..052ed7e08538 100644 --- a/sd/source/ui/presenter/PresenterPreviewCache.cxx +++ b/sd/source/ui/presenter/PresenterPreviewCache.cxx @@ -27,6 +27,7 @@ #include <cppuhelper/supportsservice.hxx> #include <com/sun/star/drawing/XDrawPage.hpp> #include <osl/diagnose.h> +#include <unomodel.hxx> namespace com::sun::star::uno { class XComponentContext; } @@ -43,7 +44,7 @@ public: void SetDocumentSlides ( const Reference<container::XIndexAccess>& rxSlides, - const Reference<XInterface>& rxDocument); + const rtl::Reference<SdXImpressDocument>& rxDocument); void SetVisibleSlideRange ( const sal_Int32 nFirstVisibleSlideIndex, const sal_Int32 nLastVisibleSlideIndex); @@ -58,11 +59,11 @@ public: virtual const SdrPage* GetPage (CacheKey aKey) override; virtual std::shared_ptr<std::vector<CacheKey> > GetEntryList (bool bVisible) override; virtual sal_Int32 GetPriority (CacheKey aKey) override; - virtual css::uno::Reference<css::uno::XInterface> GetModel() override; + virtual SdXImpressDocument* GetModel() override; private: Reference<container::XIndexAccess> mxSlides; - Reference<XInterface> mxDocument; + rtl::Reference<SdXImpressDocument> mxDocument; sal_Int32 mnFirstVisibleSlideIndex; sal_Int32 mnLastVisibleSlideIndex; typedef ::std::vector<css::uno::Reference<css::drawing::XSlidePreviewCacheListener> > ListenerContainer; @@ -113,7 +114,9 @@ void SAL_CALL PresenterPreviewCache::setDocumentSlides ( ThrowIfDisposed(); OSL_ASSERT(mpCacheContext != nullptr); - mpCacheContext->SetDocumentSlides(rxSlides, rxDocument); + SdXImpressDocument* pImpressDoc = dynamic_cast<SdXImpressDocument*>(rxDocument.get()); + assert(pImpressDoc); + mpCacheContext->SetDocumentSlides(rxSlides, pImpressDoc); } void SAL_CALL PresenterPreviewCache::setVisibleRange ( @@ -208,7 +211,7 @@ PresenterPreviewCache::PresenterCacheContext::PresenterCacheContext() void PresenterPreviewCache::PresenterCacheContext::SetDocumentSlides ( const Reference<container::XIndexAccess>& rxSlides, - const Reference<XInterface>& rxDocument) + const rtl::Reference<SdXImpressDocument>& rxDocument) { mxSlides = rxSlides; mxDocument = rxDocument; @@ -324,9 +327,9 @@ sal_Int32 PresenterPreviewCache::PresenterCacheContext::GetPriority (CacheKey aK return 0; } -Reference<XInterface> PresenterPreviewCache::PresenterCacheContext::GetModel() +SdXImpressDocument* PresenterPreviewCache::PresenterCacheContext::GetModel() { - return mxDocument; + return mxDocument.get(); } const SdrPage* PresenterPreviewCache::PresenterCacheContext::GetPage ( diff --git a/sd/source/ui/sidebar/DocumentHelper.cxx b/sd/source/ui/sidebar/DocumentHelper.cxx index 20a2511c79b0..c72c8d5a7cb7 100644 --- a/sd/source/ui/sidebar/DocumentHelper.cxx +++ b/sd/source/ui/sidebar/DocumentHelper.cxx @@ -21,6 +21,7 @@ #include <drawdoc.hxx> #include <DrawDocShell.hxx> +#include <unomodel.hxx> #include <sdpage.hxx> #include <glob.hxx> #include <unmovss.hxx> @@ -105,8 +106,7 @@ SdPage* DocumentHelper::CopyMasterPageToLocalDocument ( break; // Create a new slide (and its notes page.) - uno::Reference<drawing::XDrawPagesSupplier> xSlideSupplier ( - rTargetDocument.getUnoModel(), uno::UNO_QUERY); + rtl::Reference<SdXImpressDocument> xSlideSupplier(rTargetDocument.getUnoModel()); if ( ! xSlideSupplier.is()) break; uno::Reference<drawing::XDrawPages> xSlides = diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index c8ae78fa7380..b18e0e804ed1 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -97,6 +97,7 @@ #include <app.hrc> #include <cusshow.hxx> #include <optsitem.hxx> +#include <unomodel.hxx> #define CM_SLIDES 21 @@ -959,7 +960,7 @@ bool SlideshowImpl::startPreview( maPresSettings.mnPauseTimeout = 0; maPresSettings.mbShowPauseLogo = false; - Reference< XDrawPagesSupplier > xDrawPages( mpDoc->getUnoModel(), UNO_QUERY_THROW ); + rtl::Reference< SdXImpressDocument > xDrawPages( mpDoc->getUnoModel() ); Reference< XIndexAccess > xSlides( xDrawPages->getDrawPages(), UNO_QUERY_THROW ); mpSlideController = std::make_shared<AnimationSlideController>( xSlides, AnimationSlideController::PREVIEW ); @@ -1482,8 +1483,7 @@ void SlideshowImpl::registerShapeEvents(sal_Int32 nSlideNumber) try { - Reference< XDrawPagesSupplier > xDrawPages( mxModel, UNO_QUERY_THROW ); - Reference< XIndexAccess > xPages( xDrawPages->getDrawPages(), UNO_QUERY_THROW ); + Reference< XIndexAccess > xPages( mxModel->getDrawPages(), UNO_QUERY_THROW ); Reference< XShapes > xDrawPage; xPages->getByIndex(nSlideNumber) >>= xDrawPage; @@ -1584,8 +1584,7 @@ void SlideshowImpl::displayCurrentSlide (const bool bSkipAllMainSequenceEffects) if( mpSlideController && mxShow.is() ) { - Reference< XDrawPagesSupplier > xDrawPages( mpDoc->getUnoModel(), - UNO_QUERY_THROW ); + rtl::Reference< SdXImpressDocument > xDrawPages( mpDoc->getUnoModel() ); mpSlideController->displayCurrentSlide( mxShow, xDrawPages, bSkipAllMainSequenceEffects ); registerShapeEvents(mpSlideController->getCurrentSlideNumber()); update(); @@ -1604,7 +1603,7 @@ void SlideshowImpl::endPresentation() { if( maPresSettings.mbMouseAsPen) { - Reference< XMultiServiceFactory > xDocFactory(mpDoc->getUnoModel(), UNO_QUERY ); + rtl::Reference< SdXImpressDocument > xDocFactory(mpDoc->getUnoModel() ); if( xDocFactory.is() ) mxShow->registerUserPaintPolygons(xDocFactory); } @@ -2512,7 +2511,7 @@ void SlideshowImpl::createSlideList( bool bAll, std::u16string_view rPresSlide ) ( pCustomShow && !pCustomShow->PagesVector().empty() ) ? AnimationSlideController::CUSTOM : (bAll ? AnimationSlideController::ALL : AnimationSlideController::FROM); - Reference< XDrawPagesSupplier > xDrawPages( mpDoc->getUnoModel(), UNO_QUERY_THROW ); + rtl::Reference< SdXImpressDocument > xDrawPages( mpDoc->getUnoModel() ); Reference< XIndexAccess > xSlides( xDrawPages->getDrawPages(), UNO_QUERY_THROW ); mpSlideController = std::make_shared<AnimationSlideController>( xSlides, eMode ); @@ -3355,7 +3354,7 @@ void SlideshowImpl::AsyncNotifyEvent( // order of pages (object pages or master pages) changed (Insert/Remove/ChangePos) // rXCurrentSlide is the current slide before the change. - Reference< XDrawPagesSupplier > xDrawPages( mpDoc->getUnoModel(), UNO_QUERY_THROW ); + rtl::Reference< SdXImpressDocument > xDrawPages( mpDoc->getUnoModel() ); Reference< XIndexAccess > xSlides( xDrawPages->getDrawPages(), UNO_QUERY_THROW ); const sal_Int32 nNewSlideCount(xSlides.is() ? xSlides->getCount() : 0); diff --git a/sd/source/ui/slideshow/slideshowimpl.hxx b/sd/source/ui/slideshow/slideshowimpl.hxx index 4aff8cb3a23e..00f9c80003b7 100644 --- a/sd/source/ui/slideshow/slideshowimpl.hxx +++ b/sd/source/ui/slideshow/slideshowimpl.hxx @@ -308,7 +308,7 @@ private: css::uno::Reference< css::presentation::XSlideShow > mxShow; rtl::Reference<sd::SlideShowView> mxView; - css::uno::Reference< css::frame::XModel > mxModel; + rtl::Reference< SdXImpressDocument > mxModel; Timer maUpdateTimer; Timer maInputFreezeTimer; diff --git a/sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx b/sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx index 6275754fa65e..367683b9388a 100644 --- a/sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx +++ b/sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx @@ -25,6 +25,7 @@ #include "SlsBitmapCache.hxx" #include <cache/SlsPageCacheManager.hxx> #include <tools/debug.hxx> +#include <unomodel.hxx> namespace sd::slidesorter::cache { diff --git a/sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx b/sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx index 76fc3753fc53..6a22b437642f 100644 --- a/sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx +++ b/sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx @@ -20,7 +20,7 @@ #include <cache/SlsPageCacheManager.hxx> #include "SlsBitmapCache.hxx" - +#include <unomodel.hxx> #include <deque> #include <map> #include <memory> diff --git a/sd/source/ui/slidesorter/controller/SlsListener.cxx b/sd/source/ui/slidesorter/controller/SlsListener.cxx index 22e6dda70200..34381b2b702e 100644 --- a/sd/source/ui/slidesorter/controller/SlsListener.cxx +++ b/sd/source/ui/slidesorter/controller/SlsListener.cxx @@ -22,6 +22,7 @@ #include <SlideSorter.hxx> #include <ViewShell.hxx> #include <ViewShellHint.hxx> +#include <unomodel.hxx> #include <controller/SlideSorterController.hxx> #include <controller/SlsPageSelector.hxx> #include <controller/SlsCurrentSlideManager.hxx> @@ -68,18 +69,17 @@ Listener::Listener ( mbListeningToDocument = true; // Connect to the UNO document. - Reference<document::XEventBroadcaster> xBroadcaster ( - mrSlideSorter.GetModel().GetDocument()->getUnoModel(), uno::UNO_QUERY); + rtl::Reference<SdXImpressDocument> xBroadcaster( + mrSlideSorter.GetModel().GetDocument()->getUnoModel()); if (xBroadcaster.is()) { - xBroadcaster->addEventListener (this); + xBroadcaster->addEventListener(css::uno::Reference< css::document::XEventListener >(this)); mbListeningToUNODocument = true; } // Listen for disposing events from the document. - Reference<XComponent> xComponent (xBroadcaster, UNO_QUERY); - if (xComponent.is()) - xComponent->addEventListener ( + if (xBroadcaster.is()) + xBroadcaster->addEventListener ( Reference<lang::XEventListener>( static_cast<XWeak*>(this), UNO_QUERY)); @@ -139,15 +139,14 @@ void Listener::ReleaseListeners() if (mbListeningToUNODocument) { - Reference<document::XEventBroadcaster> xBroadcaster ( - mrSlideSorter.GetModel().GetDocument()->getUnoModel(), UNO_QUERY); + rtl::Reference<SdXImpressDocument> xBroadcaster( + mrSlideSorter.GetModel().GetDocument()->getUnoModel()); if (xBroadcaster.is()) - xBroadcaster->removeEventListener (this); + xBroadcaster->removeEventListener(css::uno::Reference< css::document::XEventListener >(this)); // Remove the dispose listener. - Reference<XComponent> xComponent (xBroadcaster, UNO_QUERY); - if (xComponent.is()) - xComponent->removeEventListener ( + if (xBroadcaster.is()) + xBroadcaster->removeEventListener ( Reference<lang::XEventListener>( static_cast<XWeak*>(this), UNO_QUERY)); @@ -388,7 +387,7 @@ void SAL_CALL Listener::disposing ( if ((mbListeningToDocument || mbListeningToUNODocument) && mrSlideSorter.GetModel().GetDocument()!=nullptr && rEventObject.Source - == mrSlideSorter.GetModel().GetDocument()->getUnoModel()) + == uno::Reference<XInterface>(cppu::getXWeak(mrSlideSorter.GetModel().GetDocument()->getUnoModel()))) { mbListeningToDocument = false; mbListeningToUNODocument = false; diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx index 0d40b7b89805..71865af5727f 100644 --- a/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx @@ -32,6 +32,7 @@ #include <comphelper/diagnose_ex.hxx> #include <drawdoc.hxx> #include <sdpage.hxx> +#include <unomodel.hxx> #include <drawview.hxx> #include <DrawViewShell.hxx> #include <ViewShellBase.hxx> @@ -153,7 +154,9 @@ void SelectionManager::DeleteSelectedNormalPages (const ::std::vector<SdPage*>& try { - Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier( mrSlideSorter.GetModel().GetDocument()->getUnoModel(), UNO_QUERY_THROW ); + rtl::Reference<SdXImpressDocument> xDrawPagesSupplier( mrSlideSorter.GetModel().GetDocument()->getUnoModel() ); + if (!xDrawPagesSupplier) + return; Reference<drawing::XDrawPages> xPages( xDrawPagesSupplier->getDrawPages(), UNO_SET_THROW ); // Iterate over all pages that were selected when this method was called @@ -186,7 +189,9 @@ void SelectionManager::DeleteSelectedMasterPages (const ::std::vector<SdPage*>& try { - Reference<drawing::XMasterPagesSupplier> xDrawPagesSupplier( mrSlideSorter.GetModel().GetDocument()->getUnoModel(), UNO_QUERY_THROW ); + rtl::Reference<SdXImpressDocument> xDrawPagesSupplier( mrSlideSorter.GetModel().GetDocument()->getUnoModel() ); + if (!xDrawPagesSupplier) + return; Reference<drawing::XDrawPages> xPages( xDrawPagesSupplier->getMasterPages(), UNO_SET_THROW ); // Iterate over all pages that were selected when this method was called diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx index de8f18c8aac2..7eeb776af914 100644 --- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx @@ -55,6 +55,7 @@ #include <DrawViewShell.hxx> #include <sdabstdlg.hxx> #include <sdmod.hxx> +#include <unomodel.hxx> #include <vcl/uitest/logger.hxx> #include <vcl/uitest/eventdescription.hxx> @@ -1084,8 +1085,8 @@ void SlotManager::InsertSlide (SfxRequest& rRequest) { // Use the API to create a new page. SdDrawDocument* pDocument = mrSlideSorter.GetModel().GetDocument(); - Reference<drawing::XMasterPagesSupplier> xMasterPagesSupplier ( - pDocument->getUnoModel(), UNO_QUERY); + rtl::Reference<SdXImpressDocument> xMasterPagesSupplier ( + pDocument->getUnoModel()); if (xMasterPagesSupplier.is()) { Reference<drawing::XDrawPages> xMasterPages ( diff --git a/sd/source/ui/slidesorter/inc/cache/SlsCacheContext.hxx b/sd/source/ui/slidesorter/inc/cache/SlsCacheContext.hxx index 12993fdbb084..3f77ca2befc8 100644 --- a/sd/source/ui/slidesorter/inc/cache/SlsCacheContext.hxx +++ b/sd/source/ui/slidesorter/inc/cache/SlsCacheContext.hxx @@ -30,6 +30,7 @@ class XInterface; } class SdrPage; +class SdXImpressDocument; namespace sd::slidesorter::cache { @@ -88,7 +89,7 @@ public: same model but have different preview sizes may access previews of each other in order to create fast previews of the previews. */ - virtual css::uno::Reference<css::uno::XInterface> GetModel() = 0; + virtual SdXImpressDocument* GetModel() = 0; }; typedef std::shared_ptr<CacheContext> SharedCacheContext; diff --git a/sd/source/ui/slidesorter/inc/cache/SlsPageCacheManager.hxx b/sd/source/ui/slidesorter/inc/cache/SlsPageCacheManager.hxx index eaddea5b2827..b9d470257984 100644 --- a/sd/source/ui/slidesorter/inc/cache/SlsPageCacheManager.hxx +++ b/sd/source/ui/slidesorter/inc/cache/SlsPageCacheManager.hxx @@ -21,11 +21,13 @@ #include <sal/types.h> #include <com/sun/star/uno/XInterface.hpp> +#include <rtl/ref.hxx> #include <memory> #include <vector> class Size; class SdrPage; +class SdXImpressDocument; namespace sd::slidesorter::cache { @@ -40,7 +42,7 @@ class PageCacheManager { public: typedef std::vector< std::pair<Size, std::shared_ptr<BitmapCache> > > BestFittingPageCaches; - typedef css::uno::Reference<css::uno::XInterface> DocumentKey; + typedef rtl::Reference<SdXImpressDocument> DocumentKey; /** Return the one instance of the PageCacheManager class. */ diff --git a/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx b/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx index ce27cec28dc3..b02f0b5b23e6 100644 --- a/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx +++ b/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx @@ -104,7 +104,7 @@ model::SharedPageDescriptor ViewCacheContext::GetDescriptor (cache::CacheKey aKe return mrModel.GetPageDescriptor(nPageIndex); } -css::uno::Reference<css::uno::XInterface> ViewCacheContext::GetModel() +SdXImpressDocument* ViewCacheContext::GetModel() { if (mrModel.GetDocument() == nullptr) return nullptr; diff --git a/sd/source/ui/slidesorter/view/SlsViewCacheContext.hxx b/sd/source/ui/slidesorter/view/SlsViewCacheContext.hxx index 501517cb8337..333fb10734fd 100644 --- a/sd/source/ui/slidesorter/view/SlsViewCacheContext.hxx +++ b/sd/source/ui/slidesorter/view/SlsViewCacheContext.hxx @@ -47,7 +47,7 @@ public: virtual const SdrPage* GetPage(cache::CacheKey aKey) override; virtual std::shared_ptr<std::vector<cache::CacheKey>> GetEntryList(bool bVisible) override; virtual sal_Int32 GetPriority(cache::CacheKey aKey) override; - virtual css::uno::Reference<css::uno::XInterface> GetModel() override; + virtual SdXImpressDocument* GetModel() override; private: model::SlideSorterModel& mrModel; diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 1aa5d744c85d..24efb1537110 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -3214,7 +3214,7 @@ bool SdXImpressDocument::createSlideRenderer( bool bSuccess = false; try { - uno::Reference<drawing::XDrawPagesSupplier> xDrawPages(mpDoc->getUnoModel(), uno::UNO_QUERY_THROW); + rtl::Reference<SdXImpressDocument> xDrawPages(mpDoc->getUnoModel()); uno::Reference<container::XIndexAccess> xSlides(xDrawPages->getDrawPages(), uno::UNO_QUERY_THROW); uno::Reference<drawing::XDrawPage> xSlide(xSlides->getByIndex(nSlideNumber), uno::UNO_QUERY_THROW); uno::Reference<animations::XAnimationNodeSupplier> xAnimNodeSupplier(xSlide, uno::UNO_QUERY_THROW); diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 9a8e86639865..cd60935b9c06 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -195,6 +195,7 @@ #include <sfx2/newstyle.hxx> #include <SelectLayerDlg.hxx> +#include <unomodel.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -767,8 +768,8 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) case SID_INSERT_MASTER_PAGE: { // Use the API to create a new page. - Reference<drawing::XMasterPagesSupplier> xMasterPagesSupplier ( - GetDoc()->getUnoModel(), UNO_QUERY); + rtl::Reference<SdXImpressDocument> xMasterPagesSupplier ( + GetDoc()->getUnoModel()); if (xMasterPagesSupplier.is()) { Reference<drawing::XDrawPages> xMasterPages ( diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx index 7bd35adfb4c9..b0ce3a71e0ca 100644 --- a/sd/source/ui/view/drviews4.cxx +++ b/sd/source/ui/view/drviews4.cxx @@ -59,6 +59,7 @@ #include <svx/bmpmask.hxx> #include <LayerTabBar.hxx> #include <ViewShellBase.hxx> +#include <unomodel.hxx> #include <SlideSorterViewShell.hxx> #include <svx/svditer.hxx> @@ -99,7 +100,9 @@ void DrawViewShell::DeleteActualPage() try { - Reference<XDrawPagesSupplier> xDrawPagesSupplier( GetDoc()->getUnoModel(), UNO_QUERY_THROW ); + rtl::Reference<SdXImpressDocument> xDrawPagesSupplier( GetDoc()->getUnoModel() ); + if (!xDrawPagesSupplier) + return; Reference<XDrawPages> xPages( xDrawPagesSupplier->getDrawPages(), UNO_SET_THROW ); sal_uInt16 nPageCount = GetDoc()->GetSdPageCount(mePageKind); SdPage* pPage = nullptr; |