Kaydet (Commit) 10db2f72 authored tarafından Boris Egorov's avatar Boris Egorov Kaydeden (comit) Caolán McNamara

Related: fdo#84846 move code setting edit mode to a new method

First change in series to fix fdo#84846.

Change-Id: I52dc333c2caa30ee3c75d9cc80862cf24a204f93
Reviewed-on: https://gerrit.libreoffice.org/12148Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst bff6b297
...@@ -790,19 +790,7 @@ bool DrawDocShell::GotoBookmark(const OUString& rBookmark) ...@@ -790,19 +790,7 @@ bool DrawDocShell::GotoBookmark(const OUString& rBookmark)
if (pDrawViewShell != NULL) if (pDrawViewShell != NULL)
{ {
// Set the edit mode to either the normal edit mode or the setEditMode(pDrawViewShell, bIsMasterPage);
// master page mode.
EditMode eNewEditMode = EM_PAGE;
if (bIsMasterPage)
{
eNewEditMode = EM_MASTERPAGE;
}
if (eNewEditMode != pDrawViewShell->GetEditMode())
{
// EditMode setzen
pDrawViewShell->ChangeEditMode(eNewEditMode, false);
}
// Make the bookmarked page the current page. This is done // Make the bookmarked page the current page. This is done
// by using the API because this takes care of all the // by using the API because this takes care of all the
...@@ -916,18 +904,7 @@ bool DrawDocShell::GetObjectIsmarked(const OUString& rBookmark) ...@@ -916,18 +904,7 @@ bool DrawDocShell::GetObjectIsmarked(const OUString& rBookmark)
pDrViewSh = (DrawViewShell*) mpViewShell; pDrViewSh = (DrawViewShell*) mpViewShell;
} }
EditMode eNewEditMode = EM_PAGE; setEditMode(pDrViewSh, bIsMasterPage);
if( bIsMasterPage )
{
eNewEditMode = EM_MASTERPAGE;
}
if (eNewEditMode != pDrViewSh->GetEditMode())
{
// set EditMode
pDrViewSh->ChangeEditMode(eNewEditMode, false);
}
// Jump to the page. This is done by using the API because this // Jump to the page. This is done by using the API because this
// takes care of all the little things to be done. Especially // takes care of all the little things to be done. Especially
...@@ -1020,18 +997,7 @@ bool DrawDocShell::GotoTreeBookmark(const OUString& rBookmark) ...@@ -1020,18 +997,7 @@ bool DrawDocShell::GotoTreeBookmark(const OUString& rBookmark)
pDrViewSh = (DrawViewShell*) mpViewShell; pDrViewSh = (DrawViewShell*) mpViewShell;
} }
EditMode eNewEditMode = EM_PAGE; setEditMode(pDrViewSh, bIsMasterPage);
if( bIsMasterPage )
{
eNewEditMode = EM_MASTERPAGE;
}
if (eNewEditMode != pDrViewSh->GetEditMode())
{
// set EditMode
pDrViewSh->ChangeEditMode(eNewEditMode, false);
}
// Jump to the page. This is done by using the API because this // Jump to the page. This is done by using the API because this
// takes care of all the little things to be done. Especially // takes care of all the little things to be done. Especially
...@@ -1237,6 +1203,23 @@ bool DrawDocShell::getDocReadOnly() const ...@@ -1237,6 +1203,23 @@ bool DrawDocShell::getDocReadOnly() const
return false; return false;
} }
void DrawDocShell::setEditMode(DrawViewShell* pDrawViewShell, bool isMasterPage)
{
// Set the edit mode to either the normal edit mode or the
// master page mode.
EditMode eNewEditMode = EM_PAGE;
if (isMasterPage)
{
eNewEditMode = EM_MASTERPAGE;
}
if (eNewEditMode != pDrawViewShell->GetEditMode())
{
// Set EditMode
pDrawViewShell->ChangeEditMode(eNewEditMode, false);
}
}
} // end of namespace sd } // end of namespace sd
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -43,6 +43,7 @@ namespace sd { ...@@ -43,6 +43,7 @@ namespace sd {
class FrameView; class FrameView;
class ViewShell; class ViewShell;
class DrawViewShell;
// DrawDocShell // DrawDocShell
class SD_DLLPUBLIC DrawDocShell : public SfxObjectShell class SD_DLLPUBLIC DrawDocShell : public SfxObjectShell
...@@ -230,6 +231,8 @@ public: ...@@ -230,6 +231,8 @@ public:
virtual const OUString getDocAccTitle() const; virtual const OUString getDocAccTitle() const;
virtual void setDocReadOnly( bool bReadOnly); virtual void setDocReadOnly( bool bReadOnly);
virtual bool getDocReadOnly() const; virtual bool getDocReadOnly() const;
private:
void setEditMode(DrawViewShell* pDrawViewShell, bool isMasterPage);
}; };
#ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED #ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment