sw/inc/ndtyp.hxx | 8 +++----- sw/inc/node.hxx | 17 +++++++++-------- sw/source/core/doc/docnew.cxx | 2 +- sw/source/core/docnode/nodes.cxx | 18 +++++++++--------- 4 files changed, 22 insertions(+), 23 deletions(-)
New commits: commit befe83a707e8faf37094523550dfa5bcf87be279 Author: Jan Holesovsky <ke...@collabora.com> Date: Thu Apr 30 12:59:15 2015 +0200 sw: Decouple ND_SECTIONDUMMY from ND_SECTIONNODE, and rename it. Change-Id: Ic88a133d20336ce0548154847edd9900cb5b7691 diff --git a/sw/inc/ndtyp.hxx b/sw/inc/ndtyp.hxx index c62f706..cbf71ab 100644 --- a/sw/inc/ndtyp.hxx +++ b/sw/inc/ndtyp.hxx @@ -26,13 +26,12 @@ // in base class. const sal_uInt8 ND_ENDNODE = 0x01; const sal_uInt8 ND_STARTNODE = 0x02; -const sal_uInt8 ND_TABLENODE = 0x04 | ND_STARTNODE; // SwTableNode is derived from SwStartNode +const sal_uInt8 ND_TABLENODE = 0x04 | ND_STARTNODE; ///< SwTableNode is derived from SwStartNode. const sal_uInt8 ND_TEXTNODE = 0x08; const sal_uInt8 ND_GRFNODE = 0x10; const sal_uInt8 ND_OLENODE = 0x20; -const sal_uInt8 ND_SECTIONDUMMY = 0x40; //(ND_SECTIONNODE & ~ND_STARTNODE); - -const sal_uInt8 ND_SECTIONNODE = ND_SECTIONDUMMY | ND_STARTNODE; +const sal_uInt8 ND_SECTIONNODE = 0x40 | ND_STARTNODE; ///< SwSectionNode is derived from SwStartNode. +const sal_uInt8 ND_PLACEHOLDER = 0x80; // NoTxtNode (if any of the 2 bits are set). const sal_uInt8 ND_NOTXTNODE = ND_GRFNODE | ND_OLENODE; diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx index 51bfb2e..d7621be 100644 --- a/sw/inc/node.hxx +++ b/sw/inc/node.hxx @@ -567,15 +567,16 @@ public: }; -/** This class is internal. And quite frankly I don't know what ND_SECTIONDUMMY is for, - the class has been merely created to replace "SwNode( ND_SECTIONDUMMY )", the only case - of instantiating SwNode directly. Now SwNode can be an abstract base class. */ -class SwDummySectionNode - : private SwNode +/** This class is internal, used only during DocumentContentOperationsManager::CopyWithFlyInFly(), and for undo. + +Some of the nodes are then replaced with SwPlaceholderNode, and at the end of the operation, removed again. +FIXME find out if this is really necessary, and if we can avoid creation of the SwPlaceholderNodes in the first place. +*/ +class SwPlaceholderNode : private SwNode { private: friend class SwNodes; - SwDummySectionNode( const SwNodeIndex &rWhere ); + SwPlaceholderNode(const SwNodeIndex &rWhere); }; inline SwEndNode *SwNode::GetEndNode() @@ -731,8 +732,8 @@ inline const SfxPoolItem& SwCntntNode::GetAttr( sal_uInt16 nWhich, return GetSwAttrSet().Get( nWhich, bInParents ); } -inline SwDummySectionNode::SwDummySectionNode( const SwNodeIndex &rWhere ) - : SwNode( rWhere, ND_SECTIONDUMMY ) +inline SwPlaceholderNode::SwPlaceholderNode(const SwNodeIndex &rWhere) + : SwNode(rWhere, ND_PLACEHOLDER) { } diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 05ec76d..0e945b3 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -942,7 +942,7 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu #endif pTargetShell->StartAllAction(); - // Otherwise we have to handle SwDummySectionNodes as first node + // Otherwise we have to handle SwPlaceholderNodes as first node if ( pTargetPageDesc ) { OUString name = pTargetPageDesc->GetName(); pTargetShell->InsertPageBreak( &name, nStartPageNumber ); diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index 9a54ec9..0806894 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -622,7 +622,7 @@ bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, rNodes)) { // use placeholder in UndoNodes array - new SwDummySectionNode( aIdx ); + new SwPlaceholderNode(aIdx); } else { @@ -694,7 +694,7 @@ bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, aIdx -= nInsPos; nInsPos = 0; } - new SwDummySectionNode( aIdx ); + new SwPlaceholderNode(aIdx); --aRg.aEnd; --aIdx; break; @@ -814,7 +814,7 @@ bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, } break; - case ND_SECTIONDUMMY: + case ND_PLACEHOLDER: if (GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(*this)) { if( &rNodes == this ) // inside UndoNodesArray @@ -1753,7 +1753,7 @@ void SwNodes::_CopyNodes( const SwNodeRange& rRange, // insert a DummyNode for a TableNode if( bTblInsDummyNode ) - new SwDummySectionNode( aInsPos ); + new SwPlaceholderNode(aInsPos); // copy all of the table's nodes into the current cell for( ++aRg.aStart; aRg.aStart.GetIndex() < @@ -1762,7 +1762,7 @@ void SwNodes::_CopyNodes( const SwNodeRange& rRange, { // insert a DummyNode for the box-StartNode? if( bTblInsDummyNode ) - new SwDummySectionNode( aInsPos ); + new SwPlaceholderNode(aInsPos); SwStartNode* pSttNd = aRg.aStart.GetNode().GetStartNode(); _CopyNodes( SwNodeRange( *pSttNd, + 1, @@ -1771,12 +1771,12 @@ void SwNodes::_CopyNodes( const SwNodeRange& rRange, // insert a DummyNode for the box-EndNode? if( bTblInsDummyNode ) - new SwDummySectionNode( aInsPos ); + new SwPlaceholderNode(aInsPos); aRg.aStart = *pSttNd->EndOfSectionNode(); } // insert a DummyNode for the table-EndNode if( bTblInsDummyNode ) - new SwDummySectionNode( aInsPos ); + new SwPlaceholderNode(aInsPos); aRg.aStart = *pAktNode->EndOfSectionNode(); } else @@ -1862,7 +1862,7 @@ void SwNodes::_CopyNodes( const SwNodeRange& rRange, } break; - case ND_SECTIONDUMMY: + case ND_PLACEHOLDER: if (GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(*this)) { // than a SectionNode (start/end) is needed at the current @@ -1889,7 +1889,7 @@ void SwNodes::_DelDummyNodes( const SwNodeRange& rRg ) SwNodeIndex aIdx( rRg.aStart ); while( aIdx.GetIndex() < rRg.aEnd.GetIndex() ) { - if( ND_SECTIONDUMMY == aIdx.GetNode().GetNodeType() ) + if (ND_PLACEHOLDER == aIdx.GetNode().GetNodeType()) RemoveNode( aIdx.GetIndex(), 1, true ); else ++aIdx; commit 1475ee32d24eb1023d5b9b10fcccc61f2a36ec1b Author: Jan Holesovsky <ke...@collabora.com> Date: Thu Apr 30 11:46:55 2015 +0200 sw: Kill ND_TABLEDUMMY, it's unused. Change-Id: Iec6a0eac97a3ceb55461359605717a86d6bdc543 diff --git a/sw/inc/ndtyp.hxx b/sw/inc/ndtyp.hxx index 0604a49..c62f706 100644 --- a/sw/inc/ndtyp.hxx +++ b/sw/inc/ndtyp.hxx @@ -26,13 +26,12 @@ // in base class. const sal_uInt8 ND_ENDNODE = 0x01; const sal_uInt8 ND_STARTNODE = 0x02; -const sal_uInt8 ND_TABLEDUMMY = 0x04; //(ND_TABLENODE & ~ND_STARTNODE); +const sal_uInt8 ND_TABLENODE = 0x04 | ND_STARTNODE; // SwTableNode is derived from SwStartNode const sal_uInt8 ND_TEXTNODE = 0x08; const sal_uInt8 ND_GRFNODE = 0x10; const sal_uInt8 ND_OLENODE = 0x20; const sal_uInt8 ND_SECTIONDUMMY = 0x40; //(ND_SECTIONNODE & ~ND_STARTNODE); -const sal_uInt8 ND_TABLENODE = ND_TABLEDUMMY | ND_STARTNODE; const sal_uInt8 ND_SECTIONNODE = ND_SECTIONDUMMY | ND_STARTNODE; // NoTxtNode (if any of the 2 bits are set). _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits