summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2018-08-22 12:39:54 +0200
committerMichael Stahl <Michael.Stahl@cib.de>2018-09-19 10:18:28 +0200
commit69d2d24b3579ad21fb1ba2746f81a02f8bbfb984 (patch)
tree246d55ac6299a44a0424e40b0b90f77a5059c98d
parentc1c3c5cd24345e0ef909f152693f1db95d74193b (diff)
sw: add a real create-no-frames flag to MakeCopy/MakeTextNode
SwNodes::CopyNodes calling MakeCopy() and then immediately DelFrames() considered silly. Apparently SwOLENode/SwGrfNode don't actually create frames anyway since that is done via their SwFrameFormats, so they just ignore the parameter. Change-Id: I8a8f52da1d25bb5689345e956a33aebd727e8fc7
-rw-r--r--sw/inc/ndarr.hxx3
-rw-r--r--sw/inc/ndgrf.hxx2
-rw-r--r--sw/inc/ndole.hxx2
-rw-r--r--sw/inc/ndtxt.hxx2
-rw-r--r--sw/inc/node.hxx2
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx2
-rw-r--r--sw/source/core/docnode/ndcopy.cxx4
-rw-r--r--sw/source/core/docnode/nodes.cxx7
-rw-r--r--sw/source/core/graphic/ndgrf.cxx2
-rw-r--r--sw/source/core/ole/ndole.cxx2
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx5
11 files changed, 16 insertions, 17 deletions
diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx
index e9a3a7f11788..598397c43cf6 100644
--- a/sw/inc/ndarr.hxx
+++ b/sw/inc/ndarr.hxx
@@ -204,7 +204,8 @@ public:
/// Implementations of "Make...Node" are in the given .cxx-files.
SwTextNode *MakeTextNode( const SwNodeIndex & rWhere,
- SwTextFormatColl *pColl ); ///< in ndtxt.cxx
+ SwTextFormatColl *pColl,
+ bool bNewFrames = true); ///< in ndtxt.cxx
SwStartNode* MakeTextSection( const SwNodeIndex & rWhere,
SwStartNodeType eSttNdTyp,
SwTextFormatColl *pColl );
diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx
index 0a6c67a65481..998c414a879f 100644
--- a/sw/inc/ndgrf.hxx
+++ b/sw/inc/ndgrf.hxx
@@ -109,7 +109,7 @@ public:
void SetScaleImageMap( bool b ) { bScaleImageMap = b; }
/// in ndcopy.cxx
- virtual SwContentNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const override;
+ virtual SwContentNode* MakeCopy(SwDoc*, const SwNodeIndex&, bool bNewFrames) const override;
/** Re-read in case graphic was not OK. The current one
gets replaced by the new one. */
diff --git a/sw/inc/ndole.hxx b/sw/inc/ndole.hxx
index 93139c986526..21896f6f99c0 100644
--- a/sw/inc/ndole.hxx
+++ b/sw/inc/ndole.hxx
@@ -112,7 +112,7 @@ public:
virtual ~SwOLENode() override;
/// Is in ndcopy.cxx.
- virtual SwContentNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const override;
+ virtual SwContentNode* MakeCopy(SwDoc*, const SwNodeIndex&, bool bNewFrames) const override;
virtual Size GetTwipSize() const override;
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 41c088a91f9e..68a8a499b119 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -669,7 +669,7 @@ public:
/// in ndcopy.cxx
bool IsSymbolAt(sal_Int32 nBegin) const; // In itratr.cxx.
- virtual SwContentNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const override;
+ virtual SwContentNode* MakeCopy(SwDoc*, const SwNodeIndex&, bool bNewFrames) const override;
/// Interactive hyphenation: we find TextFrame and call its CalcHyph.
bool Hyphenate( SwInterHyphInfo &rHyphInf );
diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index 60149f2fc24a..05b69c9acb21 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -418,7 +418,7 @@ public:
There are differences between text node and formula node. */
virtual sal_Int32 Len() const;
- virtual SwContentNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const = 0;
+ virtual SwContentNode* MakeCopy(SwDoc*, const SwNodeIndex&, bool bNewFrames) const = 0;
/// Get information from Client.
virtual bool GetInfo( SfxPoolItem& ) const override;
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 3fe909c61dfb..84e2f9109b72 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -4320,7 +4320,7 @@ bool DocumentContentOperationsManager::CopyImpl( SwPaM& rPam, SwPosition& rPos,
pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD));
else
{
- pDestTextNd = pSttTextNd->MakeCopy( pDoc, aInsPos )->GetTextNode();
+ pDestTextNd = pSttTextNd->MakeCopy(pDoc, aInsPos, true)->GetTextNode();
bCopyOk = true;
}
aDestIdx.Assign( pDestTextNd, 0 );
diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx
index 431a91e35055..5ec923298e7e 100644
--- a/sw/source/core/docnode/ndcopy.cxx
+++ b/sw/source/core/docnode/ndcopy.cxx
@@ -52,7 +52,7 @@ struct MapTableFrameFormat
typedef std::vector<MapTableFrameFormat> MapTableFrameFormats;
-SwContentNode* SwTextNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
+SwContentNode* SwTextNode::MakeCopy(SwDoc* pDoc, const SwNodeIndex& rIdx, bool const bNewFrames) const
{
// the Copy-Textnode is the Node with the Text, the Copy-Attrnode is the
// node with the collection and hard attributes. Normally is the same
@@ -75,7 +75,7 @@ SwContentNode* SwTextNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) cons
if( !pColl )
pColl = pDoc->CopyTextColl( *GetTextColl() );
- SwTextNode* pTextNd = pDoc->GetNodes().MakeTextNode( rIdx, pColl );
+ SwTextNode* pTextNd = pDoc->GetNodes().MakeTextNode(rIdx, pColl, bNewFrames);
// METADATA: register copy
pTextNd->RegisterAsCopyOf(*pCpyTextNd);
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 5d887ed10e84..8319df67ed10 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -1858,11 +1858,8 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange,
case SwNodeType::Grf:
case SwNodeType::Ole:
{
- SwContentNode* pNew = static_cast<SwContentNode*>(pCurrentNode)->MakeCopy(
- pDoc, aInsPos );
- // frames are always created as default, so delete if needed
- if( !bNewFrames )
- pNew->DelFrames(nullptr);
+ static_cast<SwContentNode*>(pCurrentNode)->MakeCopy(
+ pDoc, aInsPos, bNewFrames);
}
break;
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index f7a489bba3bb..8a36ededbe31 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -697,7 +697,7 @@ void SwGrfNode::ScaleImageMap()
}
}
-SwContentNode* SwGrfNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
+SwContentNode* SwGrfNode::MakeCopy(SwDoc* pDoc, const SwNodeIndex& rIdx, bool) const
{
// copy formats into the other document
SwGrfFormatColl* pColl = pDoc->CopyGrfColl( *GetGrfColl() );
diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx
index c4906f8be6cb..ca9decce9af3 100644
--- a/sw/source/core/ole/ndole.cxx
+++ b/sw/source/core/ole/ndole.cxx
@@ -407,7 +407,7 @@ Size SwOLENode::GetTwipSize() const
return const_cast<SwOLENode*>(this)->maOLEObj.GetObject().GetSize( &aMapMode );
}
-SwContentNode* SwOLENode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
+SwContentNode* SwOLENode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx, bool) const
{
// If there's already a SvPersist instance, we use it
SfxObjectShell* pPersistShell = pDoc->GetPersist();
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 9f444b9fc307..7240ebf76709 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -112,7 +112,7 @@ typedef std::vector<SwTextAttr*> SwpHts;
#endif
SwTextNode *SwNodes::MakeTextNode( const SwNodeIndex & rWhere,
- SwTextFormatColl *pColl )
+ SwTextFormatColl *pColl, bool const bNewFrames)
{
OSL_ENSURE( pColl, "Collection pointer is 0." );
@@ -126,7 +126,8 @@ SwTextNode *SwNodes::MakeTextNode( const SwNodeIndex & rWhere,
// if there is no layout or it is in a hidden section, MakeFrames is not needed
const SwSectionNode* pSectNd;
- if( !GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() ||
+ if (!bNewFrames ||
+ !GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() ||
( nullptr != (pSectNd = pNode->FindSectionNode()) &&
pSectNd->GetSection().IsHiddenFlag() ))
return pNode;