include/vcl/ITiledRenderable.hxx | 3 - sc/source/ui/unoobj/docuno.cxx | 6 +- sd/source/ui/inc/DrawViewShell.hxx | 6 ++ sd/source/ui/inc/unomodel.hxx | 3 - sd/source/ui/slidesorter/controller/SlsPageSelector.cxx | 11 +++- sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx | 13 +++- sd/source/ui/unoidl/unomodel.cxx | 18 ++++++ sd/source/ui/view/drviews1.cxx | 32 +++++++++--- 8 files changed, 77 insertions(+), 15 deletions(-)
New commits: commit f7243a966521b6b9fb87e48088c388678dd17e9e Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Sun Sep 16 17:25:01 2018 -0400 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Tue Jul 16 09:59:50 2019 +0200 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 e8d09599ace9..90af3403ce28 100644 --- a/include/vcl/ITiledRenderable.hxx +++ b/include/vcl/ITiledRenderable.hxx @@ -267,7 +267,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 c16b992cd03b..953c977454da 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -546,10 +546,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 373e543eda01..15f952bf6892 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/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx index 4d712f69a503..0ce303c09330 100644 --- a/sd/source/ui/inc/unomodel.hxx +++ b/sd/source/ui/inc/unomodel.hxx @@ -265,7 +265,8 @@ public: virtual OUString getPostIts() override; /// @see vcl::ITiledRenderable::selectPart(). virtual void selectPart(int nPart, int nSelect) override; - + /// @see vcl::ITiledRenderable::getPartInfo(). + virtual OUString getPartInfo(int nPart) override; // XComponent diff --git a/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx b/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx index 327acbb0e16e..47c40e800328 100644 --- a/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx +++ b/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx @@ -217,7 +217,7 @@ void PageSelector::CheckConsistency() const } } -bool PageSelector::IsPageSelected (int nPageIndex) +bool PageSelector::IsPageSelected(int nPageIndex) { SharedPageDescriptor pDescriptor (mrModel.GetPageDescriptor(nPageIndex)); if (pDescriptor.get() != nullptr) @@ -226,6 +226,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/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 6329f2a4bf97..5592535d1648 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2282,6 +2282,24 @@ void SdXImpressDocument::selectPart(int nPart, int nSelect) pViewSh->SelectPage(nPart, nSelect); } +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(); diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx index b725833c7b3c..768bf33ef473 100644 --- a/sd/source/ui/view/drviews1.cxx +++ b/sd/source/ui/view/drviews1.cxx @@ -774,10 +774,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) @@ -788,13 +784,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 { @@ -803,11 +798,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; } /** _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits