diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-15 10:08:20 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-17 15:08:07 +0200 |
commit | 470752f50c146b449b1c9bdccc36ed031535663c (patch) | |
tree | 92e5af3b31e63e6cffdcc51717d1bd6584c59729 /sd | |
parent | 561a02ec72cf963d7cd59cfb9a183c1032f0861b (diff) |
create o3tl::array_view
A very basic implementation of the proposed std::array_view, similar to
clang's llvm::ArrayRef.
Mostly cribbed from the string_view implementation :-)
Use it for the SfxDispatcher::setSlotFilter function
Change-Id: Ife7e4971741b41827e145787899872c9b2bea82b
Reviewed-on: https://gerrit.libreoffice.org/38817
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/docshell/docshell.cxx | 7 | ||||
-rw-r--r-- | sd/source/ui/inc/DrawDocShell.hxx | 7 | ||||
-rw-r--r-- | sd/source/ui/slideshow/slideshowimpl.cxx | 4 |
3 files changed, 8 insertions, 10 deletions
diff --git a/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx index 799c2cfaa907..77d7cf641c8b 100644 --- a/sd/source/ui/docshell/docshell.cxx +++ b/sd/source/ui/docshell/docshell.cxx @@ -124,7 +124,6 @@ DrawDocShell::DrawDocShell(SfxObjectCreateMode eMode, mpViewShell(nullptr), mpFontList(nullptr), meDocType(eDocumentType), - mpFilterSIDs(nullptr), mbSdDataObj(bDataObject), mbOwnPrinter(false), mbNewDocument( true ) @@ -140,7 +139,6 @@ DrawDocShell::DrawDocShell( SfxModelFlags nModelCreationFlags, bool bDataObject, mpViewShell(nullptr), mpFontList(nullptr), meDocType(eDocumentType), - mpFilterSIDs(nullptr), mbSdDataObj(bDataObject), mbOwnPrinter(false), mbNewDocument( true ) @@ -158,7 +156,6 @@ DrawDocShell::DrawDocShell(SdDrawDocument* pDoc, SfxObjectCreateMode eMode, mpViewShell(nullptr), mpFontList(nullptr), meDocType(eDocumentType), - mpFilterSIDs(nullptr), mbSdDataObj(bDataObject), mbOwnPrinter(false), mbNewDocument( true ) @@ -405,8 +402,8 @@ void DrawDocShell::ApplySlotFilter() const { SfxDispatcher* pDispatcher = pTestViewShell->GetViewFrame()->GetDispatcher(); - if( mpFilterSIDs ) - pDispatcher->SetSlotFilter( mbFilterEnable ? SfxSlotFilterState::ENABLED : SfxSlotFilterState::DISABLED, mnFilterCount, mpFilterSIDs ); + if( !mpFilterSIDs.empty() ) + pDispatcher->SetSlotFilter( mbFilterEnable ? SfxSlotFilterState::ENABLED : SfxSlotFilterState::DISABLED, mpFilterSIDs ); else pDispatcher->SetSlotFilter(); diff --git a/sd/source/ui/inc/DrawDocShell.hxx b/sd/source/ui/inc/DrawDocShell.hxx index a4e3deeb5901..3dad521b119f 100644 --- a/sd/source/ui/inc/DrawDocShell.hxx +++ b/sd/source/ui/inc/DrawDocShell.hxx @@ -20,6 +20,7 @@ #ifndef INCLUDED_SD_SOURCE_UI_INC_DRAWDOCSHELL_HXX #define INCLUDED_SD_SOURCE_UI_INC_DRAWDOCSHELL_HXX +#include <o3tl/array_view.hxx> #include <sfx2/docfac.hxx> #include <sfx2/objsh.hxx> @@ -152,7 +153,7 @@ public: */ bool CheckPageName(vcl::Window* pWin, OUString& rName ); - void SetSlotFilter(bool bEnable = false, sal_uInt16 nCount = 0, const sal_uInt16* pSIDs = nullptr) { mbFilterEnable = bEnable; mnFilterCount = nCount; mpFilterSIDs = pSIDs; } + void SetSlotFilter(bool bEnable = false, o3tl::array_view<sal_uInt16> pSIDs = o3tl::array_view<sal_uInt16>()) { mbFilterEnable = bEnable; mpFilterSIDs = pSIDs; } void ApplySlotFilter() const; SfxStyleFamily GetStyleFamily() const { return mnStyleFamily; } @@ -218,8 +219,8 @@ protected: rtl::Reference<FuPoor> mxDocShellFunction; DocumentType meDocType; SfxStyleFamily mnStyleFamily; - const sal_uInt16* mpFilterSIDs; - sal_uInt16 mnFilterCount; + o3tl::array_view<sal_uInt16> + mpFilterSIDs; bool mbFilterEnable; bool mbSdDataObj; bool mbInDestruction; diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 6174640dc8f5..327ecb633bb4 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -925,7 +925,7 @@ bool SlideshowImpl::startShow( PresentationSettingsEx* pPresSettings ) // these Slots are forbidden in other views for this document if( mpDocSh ) { - mpDocSh->SetSlotFilter( true, SAL_N_ELEMENTS( pAllowed ), pAllowed ); + mpDocSh->SetSlotFilter( true, pAllowed ); mpDocSh->ApplySlotFilter(); } @@ -2453,7 +2453,7 @@ void SAL_CALL SlideshowImpl::activate() if( pDispatcher ) { // filter all forbidden slots - pDispatcher->SetSlotFilter( SfxSlotFilterState::ENABLED, SAL_N_ELEMENTS(pAllowed), pAllowed ); + pDispatcher->SetSlotFilter( SfxSlotFilterState::ENABLED, pAllowed ); } if( getBindings() ) |