[Libreoffice-commits] core.git: sd/source

Boris Egorov egorov at linux.com
Thu Oct 30 09:53:37 PDT 2014


 sd/source/ui/docshell/docshel4.cxx |   57 ++++++++++++-------------------------
 sd/source/ui/inc/DrawDocShell.hxx  |    3 +
 2 files changed, 23 insertions(+), 37 deletions(-)

New commits:
commit 10db2f72465e002c882afd97edd76bd0cfc8322e
Author: Boris Egorov <egorov at linux.com>
Date:   Fri Oct 17 23:45:59 2014 +0700

    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 at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx
index 628b66f..57be822 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 5cfbda9..47f6d16 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


More information about the Libreoffice-commits mailing list