diff options
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/inc/ViewShellBase.hxx | 4 | ||||
-rw-r--r-- | sd/source/ui/inc/unomodel.hxx | 6 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 23 | ||||
-rw-r--r-- | sd/source/ui/view/ViewShellBase.cxx | 36 |
4 files changed, 68 insertions, 1 deletions
diff --git a/sd/source/ui/inc/ViewShellBase.hxx b/sd/source/ui/inc/ViewShellBase.hxx index eab26ec8a1ba..7fc4af2a2da0 100644 --- a/sd/source/ui/inc/ViewShellBase.hxx +++ b/sd/source/ui/inc/ViewShellBase.hxx @@ -213,6 +213,10 @@ public: OUString RetrieveLabelFromCommand( const OUString& aCmdURL ) const; /// See SfxViewShell::getPart(). int getPart() const override; + /// See SfxViewShell::getEditMode(). + int getEditMode() const override; + /// See SfxViewShell::setEditMode(). + void setEditMode(int nMode); /// See SfxViewShell::NotifyCursor(). void NotifyCursor(SfxViewShell* pViewShell) const override; diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx index 74e21ed44131..98d5c4473f9b 100644 --- a/sd/source/ui/inc/unomodel.hxx +++ b/sd/source/ui/inc/unomodel.hxx @@ -240,8 +240,12 @@ public: virtual VclPtr<vcl::Window> getDocWindow() override; bool isMasterViewMode(); + /// @see vcl::ITiledRenderable::setPartMode(). virtual void setPartMode( int nPartMode ) override; - + /// @see vcl::ITiledRenderable::getEditMode(). + virtual int getEditMode() override; + /// @see vcl::ITiledRenderable::setEditMode(). + virtual void setEditMode(int) override; /// @see vcl::ITiledRenderable::initializeForTiledRendering(). virtual void initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& rArguments) override; /// @see vcl::ITiledRenderable::postKeyEvent(). diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 990f9c84b625..2125fe109ed5 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2339,7 +2339,10 @@ OUString SdXImpressDocument::getPartInfo(int nPart) OUString::number(static_cast<unsigned int>(bIsSelected)) + "\", \"masterPageCount\": \"" + OUString::number(nMasterPageCount) + + "\", \"mode\": \"" + + OUString::number(getEditMode()) + "\" }"; + return aPartInfo; } @@ -2456,6 +2459,26 @@ void SdXImpressDocument::setPartMode( int nPartMode ) pViewSh->SetPageKind( aPageKind ); } +int SdXImpressDocument::getEditMode() +{ + DrawViewShell* pViewSh = GetViewShell(); + if (!pViewSh) + return 0; + + return pViewSh->GetViewShellBase().getEditMode(); +} + +void SdXImpressDocument::setEditMode(int nMode) +{ + SolarMutexGuard aGuard; + + DrawViewShell* pViewSh = GetViewShell(); + if (!pViewSh) + return; + + pViewSh->GetViewShellBase().setEditMode(nMode); +} + Size SdXImpressDocument::getDocumentSize() { DrawViewShell* pViewSh = GetViewShell(); diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 7eea42b1aefd..3bebad697786 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -977,6 +977,42 @@ int ViewShellBase::getPart() const return 0; } +int ViewShellBase::getEditMode() const +{ + ViewShell* pViewShell = framework::FrameworkHelper::Instance(*const_cast<ViewShellBase*>(this))->GetViewShell(FrameworkHelper::msCenterPaneURL).get(); + + if (DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(pViewShell)) + { + switch ( pDrawViewShell->GetEditMode() ) + { + case EditMode::Page: + return 0; + case EditMode::MasterPage: + return 1; + } + } + + return 0; +} + +void ViewShellBase::setEditMode(int nMode) +{ + ViewShell* pViewShell = framework::FrameworkHelper::Instance(*this)->GetViewShell(FrameworkHelper::msCenterPaneURL).get(); + + if (DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(pViewShell)) + { + switch ( nMode ) + { + case 0: + pDrawViewShell->ChangeEditMode(EditMode::Page, false); + break; + case 1: + pDrawViewShell->ChangeEditMode(EditMode::MasterPage, false); + break; + } + } +} + void ViewShellBase::NotifyCursor(SfxViewShell* pOtherShell) const { ViewShell* pThisShell = framework::FrameworkHelper::Instance(*const_cast<ViewShellBase*>(this))->GetViewShell(FrameworkHelper::msCenterPaneURL).get(); |