Kaydet (Commit) f3d791f7 authored tarafından Michael Stahl's avatar Michael Stahl

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
üst 71f75fca
...@@ -1760,23 +1760,12 @@ void SwCompareData::SetRedlinesToDoc( bool bUseDocInfo ) ...@@ -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 // Returns (the difference count?) if something is different
long SwDoc::CompareDoc( const SwDoc& rDoc ) long SwDoc::CompareDoc( const SwDoc& rDoc )
{ {
if( &rDoc == this ) if( &rDoc == this )
return 0; return 0;
const_cast<SwDoc&>(rDoc).GetNodes().ForEach(&lcl_MergePortions);
long nRet = 0; long nRet = 0;
// Get comparison options // Get comparison options
...@@ -2018,8 +2007,6 @@ long SwDoc::MergeDoc( const SwDoc& rDoc ) ...@@ -2018,8 +2007,6 @@ long SwDoc::MergeDoc( const SwDoc& rDoc )
long nRet = 0; long nRet = 0;
const_cast<SwDoc&>(rDoc).GetNodes().ForEach(&lcl_MergePortions);
GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
SwDoc& rSrcDoc = (SwDoc&)rDoc; SwDoc& rSrcDoc = (SwDoc&)rDoc;
......
...@@ -1270,11 +1270,6 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd ) ...@@ -1270,11 +1270,6 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd )
SwDoc* pSrcDoc = ((SwDocShell*)&xDocSh)->GetDoc(); SwDoc* pSrcDoc = ((SwDocShell*)&xDocSh)->GetDoc();
eOldRedlineMode = pSrcDoc->getIDocumentRedlineAccess().GetRedlineMode(); eOldRedlineMode = pSrcDoc->getIDocumentRedlineAccess().GetRedlineMode();
pSrcDoc->getIDocumentRedlineAccess().SetRedlineMode( nsRedlineMode_t::REDLINE_SHOW_INSERT ); pSrcDoc->getIDocumentRedlineAccess().SetRedlineMode( nsRedlineMode_t::REDLINE_SHOW_INSERT );
if (2 == nRet)
{
bool lcl_MergePortions(SwNode *const& pNode, void *);
pSrcDoc->GetNodes().ForEach(&lcl_MergePortions);
}
} }
} }
......
...@@ -1488,6 +1488,15 @@ SfxInPlaceClient* SwDocShell::GetIPClient( const ::svt::EmbeddedObjectRef& xObjR ...@@ -1488,6 +1488,15 @@ SfxInPlaceClient* SwDocShell::GetIPClient( const ::svt::EmbeddedObjectRef& xObjR
return pResult; return pResult;
} }
static bool lcl_MergePortions(SwNode *const& pNode, void *)
{
if (pNode->IsTxtNode())
{
pNode->GetTxtNode()->FileLoadedInitHints();
}
return true;
}
int SwFindDocShell( SfxObjectShellRef& xDocSh, int SwFindDocShell( SfxObjectShellRef& xDocSh,
SfxObjectShellLock& xLockRef, SfxObjectShellLock& xLockRef,
const OUString& rFileName, const OUString& rFileName,
...@@ -1572,12 +1581,17 @@ int SwFindDocShell( SfxObjectShellRef& xDocSh, ...@@ -1572,12 +1581,17 @@ int SwFindDocShell( SfxObjectShellRef& xDocSh,
pMed->SetFilter( pSfxFlt ); pMed->SetFilter( pSfxFlt );
// If the new shell is created, SfxObjectShellLock should be used to let it be closed later for sure // 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; xDocSh = (SfxObjectShell*)xLockRef;
if( xDocSh->DoLoad( pMed ) ) if( xDocSh->DoLoad( pMed ) )
{
SwDoc const& rDoc(*pNew->GetDoc());
const_cast<SwDoc&>(rDoc).GetNodes().ForEach(&lcl_MergePortions);
return 2; return 2;
} }
} }
}
if( !xDocSh.Is() ) // Medium still needs to be deleted if( !xDocSh.Is() ) // Medium still needs to be deleted
delete pMed; delete pMed;
......
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