summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorPranam Lashkari <lpranam@collabora.com>2022-02-03 23:32:40 +0530
committerAndras Timar <andras.timar@collabora.com>2022-02-14 12:09:33 +0100
commit68dc37c50180e62f55337faf1a121db6822daf74 (patch)
treeb47dc8d0dea0add7c7b3c28950a81273189cb001 /sd
parent0653220aefe111f68530adeef419491423981d4d (diff)
Added master slide handling in getPart* functions of SdXImpressDocument
There was no option to get the master slide info from SdXImpressDocument Change-Id: Ic42a4c541c406a50ec26ec2113174ab25675a074 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129423 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Pranam Lashkari <lpranam@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129480 Tested-by: Jenkins
Diffstat (limited to 'sd')
-rw-r--r--sd/sdi/sdraw.sdi2
-rw-r--r--sd/source/ui/inc/unomodel.hxx1
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx43
3 files changed, 39 insertions, 7 deletions
diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi
index 7557aa1a247a..4db38965efe0 100644
--- a/sd/sdi/sdraw.sdi
+++ b/sd/sdi/sdraw.sdi
@@ -3612,7 +3612,7 @@ SfxBoolItem MasterSlidesPanel SID_MASTER_SLIDES_PANEL
GroupId = SfxGroupId::Modify;
]
-SfxVoidItem SlideMasterPage SID_SLIDE_MASTER_MODE
+SfxBoolItem SlideMasterPage SID_SLIDE_MASTER_MODE
()
[
AutoUpdate = FALSE,
diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index 62545ec2f0c4..cf88666f69bc 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -236,6 +236,7 @@ public:
virtual OUString getPartName( int nPart ) override;
virtual OUString getPartHash( int nPart ) override;
virtual VclPtr<vcl::Window> getDocWindow() override;
+ bool isMasterViewMode();
virtual void setPartMode( int nPartMode ) override;
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 5e6e374c3f80..a3ef3367534c 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -46,6 +46,7 @@
#include <unomodel.hxx>
#include "unopool.hxx"
#include <sfx2/lokhelper.hxx>
+#include <sfx2/dispatch.hxx>
#include <vcl/svapp.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
@@ -127,6 +128,8 @@
#include <tools/UnitConversion.hxx>
#include <svx/ColorSets.hxx>
+#include <app.hrc>
+
using namespace ::cppu;
using namespace ::com::sun::star;
using namespace ::sd;
@@ -2323,11 +2326,12 @@ void SdXImpressDocument::setPart( int nPart, bool bAllowChangeFocus )
int SdXImpressDocument::getParts()
{
- // TODO: master pages?
- // Read: drviews1.cxx
if (!mpDoc)
return 0;
+ if (isMasterViewMode())
+ return mpDoc->GetMasterSdPageCount(PageKind::Standard);
+
return mpDoc->GetSdPageCount(PageKind::Standard);
}
@@ -2340,9 +2344,14 @@ int SdXImpressDocument::getPart()
return pViewSh->GetViewShellBase().getPart();
}
-OUString SdXImpressDocument::getPartName( int nPart )
+OUString SdXImpressDocument::getPartName(int nPart)
{
- SdPage* pPage = mpDoc->GetSdPage( nPart, PageKind::Standard );
+ SdPage* pPage;
+ if (isMasterViewMode())
+ pPage = mpDoc->GetMasterSdPage(nPart, PageKind::Standard);
+ else
+ pPage = mpDoc->GetSdPage(nPart, PageKind::Standard);
+
if (!pPage)
{
SAL_WARN("sd", "DrawViewShell not available!");
@@ -2352,9 +2361,14 @@ OUString SdXImpressDocument::getPartName( int nPart )
return pPage->GetName();
}
-OUString SdXImpressDocument::getPartHash( int nPart )
+OUString SdXImpressDocument::getPartHash(int nPart)
{
- SdPage* pPage = mpDoc->GetSdPage( nPart, PageKind::Standard );
+ SdPage* pPage;
+ if (isMasterViewMode())
+ pPage = mpDoc->GetMasterSdPage(nPart, PageKind::Standard);
+ else
+ pPage = mpDoc->GetSdPage(nPart, PageKind::Standard);
+
if (!pPage)
{
SAL_WARN("sd", "DrawViewShell not available!");
@@ -2364,6 +2378,23 @@ OUString SdXImpressDocument::getPartHash( int nPart )
return OUString::number(pPage->GetHashCode());
}
+bool SdXImpressDocument::isMasterViewMode()
+{
+ DrawViewShell* pViewSh = GetViewShell();
+ if (!pViewSh)
+ return false;
+
+ if (pViewSh->GetDispatcher())
+ {
+ const SfxPoolItem* xItem = nullptr;
+ pViewSh->GetDispatcher()->QueryState(SID_SLIDE_MASTER_MODE, xItem);
+ const SfxBoolItem* isMasterViewMode = dynamic_cast<const SfxBoolItem*>(xItem);
+ if (isMasterViewMode && isMasterViewMode->GetValue())
+ return true;
+ }
+ return false;
+}
+
VclPtr<vcl::Window> SdXImpressDocument::getDocWindow()
{
SolarMutexGuard aGuard;