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 a3c8895563833a1d46850cb5cca38765d4f4bedb Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Sun Sep 16 17:25:01 2018 -0400 Commit: Ashod Nakashian <ashnak...@gmail.com> CommitDate: Mon Apr 15 02:31:46 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> diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx index ff89f6dd26b9..42d823e734f2 100644 --- a/include/vcl/ITiledRenderable.hxx +++ b/include/vcl/ITiledRenderable.hxx @@ -312,7 +312,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 d23c3f081636..3a651dd9b6c0 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -538,10 +538,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 bda391f71858..7a21340e128f 100644 --- a/sd/source/ui/inc/DrawViewShell.hxx +++ b/sd/source/ui/inc/DrawViewShell.hxx @@ -245,7 +245,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 054f7ffa8b9a..993749bbcb3d 100644 --- a/sd/source/ui/inc/unomodel.hxx +++ b/sd/source/ui/inc/unomodel.hxx @@ -267,7 +267,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 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 2a5e57e74e29..19e973046d9b 100644 --- a/sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx +++ b/sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx @@ -88,10 +88,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 44c84af76fee..2aa5dc247208 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2298,6 +2298,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 369ab276bbe2..4002e032a58a 100644 --- a/sd/source/ui/view/drviews1.cxx +++ b/sd/source/ui/view/drviews1.cxx @@ -753,10 +753,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) @@ -767,13 +763,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 { @@ -782,11 +777,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