diff options
Diffstat (limited to 'sd/source/ui/unoidl/unomodel.cxx')
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 5de97c06936f..e6b6012f79c6 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -45,6 +45,7 @@ #include <unomodel.hxx> #include "unopool.hxx" #include <sfx2/lokhelper.hxx> +#include <sfx2/dispatch.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> #include <LibreOfficeKit/LibreOfficeKitEnums.h> @@ -122,6 +123,8 @@ #include <tools/debug.hxx> #include <tools/diagnose_ex.h> +#include <app.hrc> + #define TWIPS_PER_PIXEL 15 using namespace ::cppu; @@ -2297,11 +2300,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); } @@ -2314,9 +2318,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!"); @@ -2326,9 +2335,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!"); @@ -2338,6 +2352,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; |