desktop/qa/desktop_lib/test_desktop_lib.cxx | 4 desktop/source/lib/init.cxx | 38 +++++++ include/LibreOfficeKit/LibreOfficeKit.h | 6 + include/LibreOfficeKit/LibreOfficeKit.hxx | 15 ++ include/vcl/ITiledRenderable.hxx | 16 ++- sc/source/ui/unoobj/docuno.cxx | 6 - sd/source/ui/inc/DrawViewShell.hxx | 8 + sd/source/ui/inc/unomodel.hxx | 6 + sd/source/ui/slidesorter/controller/SlsPageSelector.cxx | 11 +- sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx | 13 +- sd/source/ui/unoidl/unomodel.cxx | 34 ++++++ sd/source/ui/view/drviews1.cxx | 62 ++++++++++++ 12 files changed, 212 insertions(+), 7 deletions(-)
New commits: commit 3750186a09655a9eac2d742e2aadf290c2819a8c Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Sun Sep 16 17:25:01 2018 -0400 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Fri Aug 2 16:30:29 2019 -0400 LOK: getPartInfo now returns list of selected parts For spreadsheets, selected parts are still unimplemented, so returns false for all. For presentations, visible parts seem to be always return false at load time. Change-Id: I90c79617f88deec98849bb374ca0ba177cd9c9af Reviewed-on: https://gerrit.libreoffice.org/69611 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/73494 Tested-by: Jenkins Reviewed-by: Jan Holesovsky <ke...@collabora.com> diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx index 4e9a80a5378b..2fc588b5c6ef 100644 --- a/include/vcl/ITiledRenderable.hxx +++ b/include/vcl/ITiledRenderable.hxx @@ -363,7 +363,8 @@ public: } /* - * Used for sheets in spreadsheet documents. + * Used for sheets in spreadsheet documents, + * and slides in presentation documents. */ virtual OUString getPartInfo(int /*nPart*/) { diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 5f8d326096a5..0c91c076df28 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -551,10 +551,14 @@ OUString ScModelObj::getPartInfo( int nPart ) { OUString aPartInfo; ScViewData* pViewData = ScDocShell::GetViewData(); - bool bIsVisible = pViewData->GetDocument()->IsVisible(nPart); + const bool bIsVisible = pViewData->GetDocument()->IsVisible(nPart); + //FIXME: Implement IsSelected(). + const bool bIsSelected = false; //pViewData->GetDocument()->IsSelected(nPart); aPartInfo += "{ \"visible\": \""; aPartInfo += OUString::number(static_cast<unsigned int>(bIsVisible)); + aPartInfo += "\", \"selected\": \""; + aPartInfo += OUString::number(static_cast<unsigned int>(bIsSelected)); aPartInfo += "\" }"; return aPartInfo; } diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx index 71f1ed4a397c..df118b58ef1f 100644 --- a/sd/source/ui/inc/DrawViewShell.hxx +++ b/sd/source/ui/inc/DrawViewShell.hxx @@ -247,7 +247,13 @@ public: bool SwitchPage(sal_uInt16 nPage); bool IsSwitchPageAllowed() const; + /** + * Mark the desired page as selected (1), deselected (0), toggle (2). + * nPage refers to the page in question. + */ bool SelectPage(sal_uInt16 nPage, sal_uInt16 nSelect); + bool IsSelected(sal_uInt16 nPage); + bool IsVisible(sal_uInt16 nPage); void GotoBookmark(const OUString& rBookmark); //Realize multi-selection of objects, If object is marked, the diff --git a/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx b/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx index 1115d05227a9..544068f151b6 100644 --- a/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx +++ b/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx @@ -216,7 +216,7 @@ void PageSelector::CheckConsistency() const } } -bool PageSelector::IsPageSelected (int nPageIndex) +bool PageSelector::IsPageSelected(int nPageIndex) { SharedPageDescriptor pDescriptor (mrModel.GetPageDescriptor(nPageIndex)); if (pDescriptor.get() != nullptr) @@ -225,6 +225,15 @@ bool PageSelector::IsPageSelected (int nPageIndex) return false; } +bool PageSelector::IsPageVisible(int nPageIndex) +{ + SharedPageDescriptor pDescriptor (mrModel.GetPageDescriptor(nPageIndex)); + if (pDescriptor.get() != nullptr) + return pDescriptor->HasState(PageDescriptor::ST_Visible); + else + return false; +} + int PageSelector::GetPageCount() const { return mrModel.GetPageCount(); diff --git a/sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx b/sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx index cc994ced28af..c53c53519aaf 100644 --- a/sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx +++ b/sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx @@ -87,10 +87,17 @@ public: /** Return whether the specified page is selected. This convenience method is a substitute for - SlideSorterModel::GetPageDescriptor(i)->IsSelected() is included - here to make this class more self contained. + SlideSorterModel::GetPageDescriptor(i)->HasState(ST_Selected) is + included here to make this class more self contained. */ - bool IsPageSelected (int nPageIndex); + bool IsPageSelected(int nPageIndex); + + /** Return whether the specified page is visible. This convenience + method is a substitute for + SlideSorterModel::GetPageDescriptor(i)->HasState(ST_Visible) is + included here to make this class more self contained. + */ + bool IsPageVisible(int nPageIndex); /** Deselect the descriptor that is associated with the given page. The current page is updated to the first slide diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx index d690e16121bb..5a18278f635a 100644 --- a/sd/source/ui/view/drviews1.cxx +++ b/sd/source/ui/view/drviews1.cxx @@ -771,10 +771,6 @@ bool DrawViewShell::ActivateObject(SdrOle2Obj* pObj, long nVerb) */ bool DrawViewShell::SelectPage(sal_uInt16 nPage, sal_uInt16 nSelect) { - bool bOK = false; - - // Tell the slide sorter about the name change (necessary for - // accessibility.) slidesorter::SlideSorterViewShell* pSlideSorterViewShell = slidesorter::SlideSorterViewShell::GetSlideSorter(GetViewShellBase()); if (pSlideSorterViewShell != nullptr) @@ -785,13 +781,12 @@ bool DrawViewShell::SelectPage(sal_uInt16 nPage, sal_uInt16 nSelect) { // Deselect. aPageSelector.DeselectPage(nPage); - bOK = true; + } else if (nSelect == 1) { // Select. aPageSelector.SelectPage(nPage); - bOK = true; } else { @@ -800,11 +795,32 @@ bool DrawViewShell::SelectPage(sal_uInt16 nPage, sal_uInt16 nSelect) aPageSelector.DeselectPage(nPage); else aPageSelector.SelectPage(nPage); - bOK = true; } + + return true; } - return bOK; + return false; +} + +bool DrawViewShell::IsSelected(sal_uInt16 nPage) +{ + slidesorter::SlideSorterViewShell* pVShell + = slidesorter::SlideSorterViewShell::GetSlideSorter(GetViewShellBase()); + if (pVShell != nullptr) + return pVShell->GetSlideSorter().GetController().GetPageSelector().IsPageSelected(nPage); + + return false; +} + +bool DrawViewShell::IsVisible(sal_uInt16 nPage) +{ + slidesorter::SlideSorterViewShell* pVShell + = slidesorter::SlideSorterViewShell::GetSlideSorter(GetViewShellBase()); + if (pVShell != nullptr) + return pVShell->GetSlideSorter().GetController().GetPageSelector().IsPageVisible(nPage); + + return false; } /** commit 5116ec373c0a7c65f8bf8ace182d0cb4151288c0 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Sun Sep 16 17:27:35 2018 -0400 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Fri Aug 2 16:17:50 2019 -0400 LOK: support for ordering/moving parts Currently reordering of slides is only supported for presentations, although it is provisioned for spreadsheets as well. Change-Id: I6c35066d6a5ef7586d34a8e8b89db69a20b86572 Reviewed-on: https://gerrit.libreoffice.org/69612 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/73495 Tested-by: Jenkins Reviewed-by: Jan Holesovsky <ke...@collabora.com> diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 5aff0c23d82f..2ec64b6cc37f 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2457,9 +2457,10 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(documentClassOffset(47), offsetof(struct _LibreOfficeKitDocumentClass, postWindowGestureEvent)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(48), offsetof(struct _LibreOfficeKitDocumentClass, createViewWithOptions)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(49), offsetof(struct _LibreOfficeKitDocumentClass, selectPart)); + CPPUNIT_ASSERT_EQUAL(documentClassOffset(50), offsetof(struct _LibreOfficeKitDocumentClass, moveSelectedParts)); // Extending is fine, update this, and add new assert for the offsetof the // new method - CPPUNIT_ASSERT_EQUAL(documentClassOffset(50), sizeof(struct _LibreOfficeKitDocumentClass)); + CPPUNIT_ASSERT_EQUAL(documentClassOffset(51), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index da31c2e7f294..0cc4e3bace4c 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -592,6 +592,7 @@ static char* doc_getPartPageRectangles(LibreOfficeKitDocument* pThis); static int doc_getPart(LibreOfficeKitDocument* pThis); static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart); static void doc_selectPart(LibreOfficeKitDocument* pThis, int nPart, int nSelect); +static void doc_moveSelectedParts(LibreOfficeKitDocument* pThis, int nPosition, bool bDuplicate); static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart); static void doc_setPartMode(LibreOfficeKitDocument* pThis, int nPartMode); static void doc_paintTile(LibreOfficeKitDocument* pThis, @@ -743,6 +744,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone m_pDocumentClass->getPart = doc_getPart; m_pDocumentClass->setPart = doc_setPart; m_pDocumentClass->selectPart = doc_selectPart; + m_pDocumentClass->moveSelectedParts = doc_moveSelectedParts; m_pDocumentClass->getPartName = doc_getPartName; m_pDocumentClass->setPartMode = doc_setPartMode; m_pDocumentClass->paintTile = doc_paintTile; @@ -2052,6 +2054,22 @@ static void doc_selectPart(LibreOfficeKitDocument* pThis, int nPart, int nSelect pDoc->selectPart( nPart, nSelect ); } +static void doc_moveSelectedParts(LibreOfficeKitDocument* pThis, int nPosition, bool bDuplicate) +{ + SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); + + ITiledRenderable* pDoc = getTiledRenderable(pThis); + if (!pDoc) + { + gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; + return; + } + + pDoc->moveSelectedParts(nPosition, bDuplicate); +} + static char* doc_getPartPageRectangles(LibreOfficeKitDocument* pThis) { SolarMutexGuard aGuard; diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index 307707cbf305..952f023cd26c 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -365,6 +365,9 @@ struct _LibreOfficeKitDocumentClass /// @see lok::Document::selectPart(). void (*selectPart) (LibreOfficeKitDocument* pThis, int nPart, int nSelect); + /// @see lok::Document::moveSelectedParts(). + void (*moveSelectedParts) (LibreOfficeKitDocument* pThis, int nPosition, bool bDuplicate); + #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY }; diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index a759737a35c6..863f1ac48ba0 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -656,6 +656,14 @@ public: mpDoc->pClass->selectPart(mpDoc, nPart, nSelect); } + /// Moves the selected pages/slides to a new position. + /// nPosition is the new position where the selection + /// should go. bDuplicate when true will copy instead of move. + void moveSelectedParts(int nPosition, bool bDuplicate) + { + mpDoc->pClass->moveSelectedParts(mpDoc, nPosition, bDuplicate); + } + #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY }; diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx index e8331f9560c7..4e9a80a5378b 100644 --- a/include/vcl/ITiledRenderable.hxx +++ b/include/vcl/ITiledRenderable.hxx @@ -377,6 +377,12 @@ public: */ virtual void selectPart(int /*nPart*/, int /*nSelect*/) {} + /** + * Move selected pages/slides to a new position. + * nPosition: the new position to move to. + * bDuplicate: to copy (true), or to move (false). + */ + virtual void moveSelectedParts(int /*nPosition*/, bool /*bDuplicate*/) {} }; } // namespace vcl diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx index f8a6f50be604..f271d7b37b69 100644 --- a/sd/source/ui/inc/unomodel.hxx +++ b/sd/source/ui/inc/unomodel.hxx @@ -264,7 +264,10 @@ public: virtual OUString getPostIts() override; /// @see vcl::ITiledRenderable::selectPart(). virtual void selectPart(int nPart, int nSelect) override; - + /// @see vcl::ITiledRenderable::moveSelectedParts(). + virtual void moveSelectedParts(int nPosition, bool bDuplicate) override; + /// @see vcl::ITiledRenderable::getPartInfo(). + virtual OUString getPartInfo(int nPart) override; // XComponent diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index aeaf03c9f112..fbefc1c7e0bf 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2291,6 +2291,31 @@ void SdXImpressDocument::selectPart(int nPart, int nSelect) pViewSh->SelectPage(nPart, nSelect); } +void SdXImpressDocument::moveSelectedParts(int nPosition, bool bDuplicate) +{ + // Duplicating is currently unsupported. + if (!bDuplicate) + mpDoc->MovePages(nPosition); +} + +OUString SdXImpressDocument::getPartInfo(int nPart) +{ + DrawViewShell* pViewSh = GetViewShell(); + if (!pViewSh) + return OUString(); + + OUString aPartInfo; + const bool bIsVisible = pViewSh->IsVisible(nPart); + const bool bIsSelected = pViewSh->IsSelected(nPart); + + aPartInfo += "{ \"visible\": \""; + aPartInfo += OUString::number(static_cast<unsigned int>(bIsVisible)); + aPartInfo += "\", \"selected\": \""; + aPartInfo += OUString::number(static_cast<unsigned int>(bIsSelected)); + aPartInfo += "\" }"; + return aPartInfo; +} + void SdXImpressDocument::setPart( int nPart ) { DrawViewShell* pViewSh = GetViewShell(); commit 86073d788fb1834a8e99aae0478d9ce7f63fec52 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Tue Sep 11 08:11:47 2018 -0400 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Fri Aug 2 16:14:47 2019 -0400 slide-sorter: multiple selection Change-Id: I8624de25b0bb66020002890f33758e52059a24ab Reviewed-on: https://gerrit.libreoffice.org/69610 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/73493 Tested-by: Jenkins Reviewed-by: Jan Holesovsky <ke...@collabora.com> diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 16e9a516fa9d..5aff0c23d82f 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2456,9 +2456,10 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(documentClassOffset(46), offsetof(struct _LibreOfficeKitDocumentClass, renderShapeSelection)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(47), offsetof(struct _LibreOfficeKitDocumentClass, postWindowGestureEvent)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(48), offsetof(struct _LibreOfficeKitDocumentClass, createViewWithOptions)); + CPPUNIT_ASSERT_EQUAL(documentClassOffset(49), offsetof(struct _LibreOfficeKitDocumentClass, selectPart)); // Extending is fine, update this, and add new assert for the offsetof the // new method - CPPUNIT_ASSERT_EQUAL(documentClassOffset(49), sizeof(struct _LibreOfficeKitDocumentClass)); + CPPUNIT_ASSERT_EQUAL(documentClassOffset(50), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 3f2a3e0cdf32..da31c2e7f294 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -591,6 +591,7 @@ static int doc_getParts(LibreOfficeKitDocument* pThis); static char* doc_getPartPageRectangles(LibreOfficeKitDocument* pThis); static int doc_getPart(LibreOfficeKitDocument* pThis); static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart); +static void doc_selectPart(LibreOfficeKitDocument* pThis, int nPart, int nSelect); static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart); static void doc_setPartMode(LibreOfficeKitDocument* pThis, int nPartMode); static void doc_paintTile(LibreOfficeKitDocument* pThis, @@ -741,6 +742,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone m_pDocumentClass->getPartPageRectangles = doc_getPartPageRectangles; m_pDocumentClass->getPart = doc_getPart; m_pDocumentClass->setPart = doc_setPart; + m_pDocumentClass->selectPart = doc_selectPart; m_pDocumentClass->getPartName = doc_getPartName; m_pDocumentClass->setPartMode = doc_setPartMode; m_pDocumentClass->paintTile = doc_paintTile; @@ -2034,6 +2036,22 @@ static char* doc_getPartInfo(LibreOfficeKitDocument* pThis, int nPart) return pMemory; } +static void doc_selectPart(LibreOfficeKitDocument* pThis, int nPart, int nSelect) +{ + SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); + + ITiledRenderable* pDoc = getTiledRenderable(pThis); + if (!pDoc) + { + gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; + return; + } + + pDoc->selectPart( nPart, nSelect ); +} + static char* doc_getPartPageRectangles(LibreOfficeKitDocument* pThis) { SolarMutexGuard aGuard; @@ -2378,6 +2396,8 @@ static void doc_initializeForRendering(LibreOfficeKitDocument* pThis, if (pDoc) { doc_iniUnoCommands(); + // Create the SlideSorter which is used for multiselection and reordering. + doc_postUnoCommand(pThis, ".uno:LeftPaneImpress", nullptr, false); pDoc->initializeForTiledRendering( comphelper::containerToSequence(jsonToPropertyValuesVector(pArguments))); } diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index 5ac307536f5f..307707cbf305 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -362,6 +362,9 @@ struct _LibreOfficeKitDocumentClass /// @see lok::Document::createViewWithOptions(). int (*createViewWithOptions) (LibreOfficeKitDocument* pThis, const char* pOptions); + /// @see lok::Document::selectPart(). + void (*selectPart) (LibreOfficeKitDocument* pThis, int nPart, int nSelect); + #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY }; diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index 3030f3db24b3..a759737a35c6 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -649,6 +649,13 @@ public: return mpDoc->pClass->postWindowGestureEvent(mpDoc, nWindowId, pType, nX, nY, nOffset); } + /// Set a part's selection mode. + /// nSelect is 0 to deselect, 1 to select, and 2 to toggle. + void selectPart(int nPart, int nSelect) + { + mpDoc->pClass->selectPart(mpDoc, nPart, nSelect); + } + #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY }; diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx index d50f1ff192d4..e8331f9560c7 100644 --- a/include/vcl/ITiledRenderable.hxx +++ b/include/vcl/ITiledRenderable.hxx @@ -370,6 +370,13 @@ public: return OUString(); } + /** + * Select/Unselect a document "part", i.e. slide for a slideshow, and + * tab for a spreadsheet(?). + * nSelect: 0 to deselect, 1 to select, and 2 to toggle. + */ + virtual void selectPart(int /*nPart*/, int /*nSelect*/) {} + }; } // namespace vcl diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx index 9ec9d86ff9e4..71f1ed4a397c 100644 --- a/sd/source/ui/inc/DrawViewShell.hxx +++ b/sd/source/ui/inc/DrawViewShell.hxx @@ -247,6 +247,8 @@ public: bool SwitchPage(sal_uInt16 nPage); bool IsSwitchPageAllowed() const; + bool SelectPage(sal_uInt16 nPage, sal_uInt16 nSelect); + void GotoBookmark(const OUString& rBookmark); //Realize multi-selection of objects, If object is marked, the //corresponding entry is set true, else the corresponding entry is set diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx index eda3a1511038..f8a6f50be604 100644 --- a/sd/source/ui/inc/unomodel.hxx +++ b/sd/source/ui/inc/unomodel.hxx @@ -262,6 +262,9 @@ public: virtual Pointer getPointer() override; /// @see vcl::ITiledRenderable::getPostIts(). virtual OUString getPostIts() override; + /// @see vcl::ITiledRenderable::selectPart(). + virtual void selectPart(int nPart, int nSelect) override; + // XComponent diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index c7b8b6b4950a..aeaf03c9f112 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2282,6 +2282,15 @@ void SdXImpressDocument::paintTile( VirtualDevice& rDevice, nTilePosX, nTilePosY, nTileWidth, nTileHeight); } +void SdXImpressDocument::selectPart(int nPart, int nSelect) +{ + DrawViewShell* pViewSh = GetViewShell(); + if (!pViewSh) + return; + + pViewSh->SelectPage(nPart, nSelect); +} + void SdXImpressDocument::setPart( int nPart ) { DrawViewShell* pViewSh = GetViewShell(); diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx index 365a3b57b21e..d690e16121bb 100644 --- a/sd/source/ui/view/drviews1.cxx +++ b/sd/source/ui/view/drviews1.cxx @@ -76,6 +76,10 @@ #include <LayerTabBar.hxx> #include <ViewShellManager.hxx> #include <ViewShellHint.hxx> +#include <SlideSorter.hxx> +#include <SlideSorterViewShell.hxx> +#include <controller/SlideSorterController.hxx> +#include <controller/SlsPageSelector.hxx> #include <sfx2/request.hxx> #include <comphelper/lok.hxx> @@ -762,6 +766,48 @@ bool DrawViewShell::ActivateObject(SdrOle2Obj* pObj, long nVerb) } /** + * Mark the desired page as selected (1), deselected (0), toggle (2). + * nPage refers to the page in question. + */ +bool DrawViewShell::SelectPage(sal_uInt16 nPage, sal_uInt16 nSelect) +{ + bool bOK = false; + + // Tell the slide sorter about the name change (necessary for + // accessibility.) + slidesorter::SlideSorterViewShell* pSlideSorterViewShell + = slidesorter::SlideSorterViewShell::GetSlideSorter(GetViewShellBase()); + if (pSlideSorterViewShell != nullptr) + { + slidesorter::controller::PageSelector& aPageSelector + = pSlideSorterViewShell->GetSlideSorter().GetController().GetPageSelector(); + if (nSelect == 0) + { + // Deselect. + aPageSelector.DeselectPage(nPage); + bOK = true; + } + else if (nSelect == 1) + { + // Select. + aPageSelector.SelectPage(nPage); + bOK = true; + } + else + { + // Toggle. + if (aPageSelector.IsPageSelected(nPage)) + aPageSelector.DeselectPage(nPage); + else + aPageSelector.SelectPage(nPage); + bOK = true; + } + } + + return bOK; +} + +/** * Switch to desired page. * nSelectPage refers to the current EditMode */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits