summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2018-09-16 17:25:01 -0400
committerAshod Nakashian <ashnakash@gmail.com>2019-04-15 02:31:46 +0200
commita3c8895563833a1d46850cb5cca38765d4f4bedb (patch)
treee9754ddba1a3c05b861c07cff48f28d6275ffcea /sd
parent6597c9be98b5058c028e980cfc6681a7fd09147d (diff)
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 <ashnakash@gmail.com> Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/inc/DrawViewShell.hxx6
-rw-r--r--sd/source/ui/inc/unomodel.hxx3
-rw-r--r--sd/source/ui/slidesorter/controller/SlsPageSelector.cxx11
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx13
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx18
-rw-r--r--sd/source/ui/view/drviews1.cxx32
6 files changed, 70 insertions, 13 deletions
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;
}
/**