summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Egorov <egorov@linux.com>2014-10-17 23:45:59 +0700
committerCaolán McNamara <caolanm@redhat.com>2014-10-30 16:53:11 +0000
commit10db2f72465e002c882afd97edd76bd0cfc8322e (patch)
tree7ff604ca8cfc50a1ad3aada20cc166a4bfd779a9
parentbff6b297fcb2ee88f663d20c9f03c6b998602256 (diff)
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/12148 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sd/source/ui/docshell/docshel4.cxx57
-rw-r--r--sd/source/ui/inc/DrawDocShell.hxx3
2 files changed, 23 insertions, 37 deletions
diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx
index 628b66f303af..57be8225948f 100644
--- a/sd/source/ui/docshell/docshel4.cxx
+++ b/sd/source/ui/docshell/docshel4.cxx
@@ -790,19 +790,7 @@ bool DrawDocShell::GotoBookmark(const OUString& rBookmark)
if (pDrawViewShell != NULL)
{
- // Set the edit mode to either the normal edit mode or the
- // master page mode.
- EditMode eNewEditMode = EM_PAGE;
- if (bIsMasterPage)
- {
- eNewEditMode = EM_MASTERPAGE;
- }
-
- if (eNewEditMode != pDrawViewShell->GetEditMode())
- {
- // EditMode setzen
- pDrawViewShell->ChangeEditMode(eNewEditMode, false);
- }
+ setEditMode(pDrawViewShell, bIsMasterPage);
// Make the bookmarked page the current page. This is done
// by using the API because this takes care of all the
@@ -916,18 +904,7 @@ bool DrawDocShell::GetObjectIsmarked(const OUString& rBookmark)
pDrViewSh = (DrawViewShell*) mpViewShell;
}
- EditMode eNewEditMode = EM_PAGE;
-
- if( bIsMasterPage )
- {
- eNewEditMode = EM_MASTERPAGE;
- }
-
- if (eNewEditMode != pDrViewSh->GetEditMode())
- {
- // set EditMode
- pDrViewSh->ChangeEditMode(eNewEditMode, false);
- }
+ setEditMode(pDrViewSh, bIsMasterPage);
// Jump to the page. This is done by using the API because this
// takes care of all the little things to be done. Especially
@@ -1020,18 +997,7 @@ bool DrawDocShell::GotoTreeBookmark(const OUString& rBookmark)
pDrViewSh = (DrawViewShell*) mpViewShell;
}
- EditMode eNewEditMode = EM_PAGE;
-
- if( bIsMasterPage )
- {
- eNewEditMode = EM_MASTERPAGE;
- }
-
- if (eNewEditMode != pDrViewSh->GetEditMode())
- {
- // set EditMode
- pDrViewSh->ChangeEditMode(eNewEditMode, false);
- }
+ setEditMode(pDrViewSh, bIsMasterPage);
// Jump to the page. This is done by using the API because this
// takes care of all the little things to be done. Especially
@@ -1237,6 +1203,23 @@ bool DrawDocShell::getDocReadOnly() const
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
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/DrawDocShell.hxx b/sd/source/ui/inc/DrawDocShell.hxx
index 5cfbda93dec8..47f6d16be761 100644
--- a/sd/source/ui/inc/DrawDocShell.hxx
+++ b/sd/source/ui/inc/DrawDocShell.hxx
@@ -43,6 +43,7 @@ namespace sd {
class FrameView;
class ViewShell;
+class DrawViewShell;
// DrawDocShell
class SD_DLLPUBLIC DrawDocShell : public SfxObjectShell
@@ -230,6 +231,8 @@ public:
virtual const OUString getDocAccTitle() const;
virtual void setDocReadOnly( bool bReadOnly);
virtual bool getDocReadOnly() const;
+private:
+ void setEditMode(DrawViewShell* pDrawViewShell, bool isMasterPage);
};
#ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED