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

Michael Stahl mstahl at redhat.com
Wed Sep 10 09:50:58 PDT 2014


 sw/source/core/doc/doccomp.cxx     |   13 -------------
 sw/source/core/docnode/section.cxx |    5 -----
 sw/source/uibase/app/docsh2.cxx    |   16 +++++++++++++++-
 3 files changed, 15 insertions(+), 19 deletions(-)

New commits:
commit f3d791f7545d7eb1c518dca80037e76586a11e86
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Sep 10 18:42:41 2014 +0200

    sw: [loplugin:externandnotdefined]
    
    It turns out that document compare / merge and master document
    insert file are all the callers of SwFindDocShell() so move the fix-up
    there...
    
    Change-Id: I912a464c3acab8d0adb7b5b659d62f629a15cb70

diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index 41ac05e..cdb45d7 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -1760,23 +1760,12 @@ void SwCompareData::SetRedlinesToDoc( bool bUseDocInfo )
     }
 }
 
-bool lcl_MergePortions(SwNode *const& pNode, void *)
-{
-    if (pNode->IsTxtNode())
-    {
-        pNode->GetTxtNode()->FileLoadedInitHints();
-    }
-    return true;
-}
-
 // Returns (the difference count?) if something is different
 long SwDoc::CompareDoc( const SwDoc& rDoc )
 {
     if( &rDoc == this )
         return 0;
 
-    const_cast<SwDoc&>(rDoc).GetNodes().ForEach(&lcl_MergePortions);
-
     long nRet = 0;
 
     // Get comparison options
@@ -2018,8 +2007,6 @@ long SwDoc::MergeDoc( const SwDoc& rDoc )
 
     long nRet = 0;
 
-    const_cast<SwDoc&>(rDoc).GetNodes().ForEach(&lcl_MergePortions);
-
     GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
 
     SwDoc& rSrcDoc = (SwDoc&)rDoc;
diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx
index 1755312..683c2d2 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -1270,11 +1270,6 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd )
                     SwDoc* pSrcDoc = ((SwDocShell*)&xDocSh)->GetDoc();
                     eOldRedlineMode = pSrcDoc->getIDocumentRedlineAccess().GetRedlineMode();
                     pSrcDoc->getIDocumentRedlineAccess().SetRedlineMode( nsRedlineMode_t::REDLINE_SHOW_INSERT );
-                    if (2 == nRet)
-                    {
-                        bool lcl_MergePortions(SwNode *const& pNode, void *);
-                        pSrcDoc->GetNodes().ForEach(&lcl_MergePortions);
-                    }
                 }
             }
 
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index 38adecf..5caaaf7 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -1488,6 +1488,15 @@ SfxInPlaceClient* SwDocShell::GetIPClient( const ::svt::EmbeddedObjectRef& xObjR
     return pResult;
 }
 
+static bool lcl_MergePortions(SwNode *const& pNode, void *)
+{
+    if (pNode->IsTxtNode())
+    {
+        pNode->GetTxtNode()->FileLoadedInitHints();
+    }
+    return true;
+}
+
 int SwFindDocShell( SfxObjectShellRef& xDocSh,
                     SfxObjectShellLock& xLockRef,
                     const OUString& rFileName,
@@ -1572,10 +1581,15 @@ int SwFindDocShell( SfxObjectShellRef& xDocSh,
             pMed->SetFilter( pSfxFlt );
 
             // If the new shell is created, SfxObjectShellLock should be used to let it be closed later for sure
-            xLockRef = new SwDocShell( SFX_CREATE_MODE_INTERNAL );
+            SwDocShell *const pNew(new SwDocShell(SFX_CREATE_MODE_INTERNAL));
+            xLockRef = pNew;
             xDocSh = (SfxObjectShell*)xLockRef;
             if( xDocSh->DoLoad( pMed ) )
+            {
+                SwDoc const& rDoc(*pNew->GetDoc());
+                const_cast<SwDoc&>(rDoc).GetNodes().ForEach(&lcl_MergePortions);
                 return 2;
+            }
         }
     }
 


More information about the Libreoffice-commits mailing list