Small part of one of tasks in "easy tasks" list.
This is my first patch to LibreOffice so I'd be grateful for feedback on any
issues.
Released under LGPLv3+/MPL
---
sw/inc/undobj.hxx | 4 ++--
sw/source/core/undo/unnum.cxx | 16 ++++++----------
2 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx
index 2252de9..e6ea274 100644
--- a/sw/inc/undobj.hxx
+++ b/sw/inc/undobj.hxx
@@ -1371,8 +1371,8 @@ public:
class SwUndoDelNum : public SwUndo, private SwUndRng
{
- SvULongs aNodeIdx;
- SvBytes aLevels;
+ typedef std::vector< std::pair< ULONG, int > > SvNode;
+ SvNode aNodes;
SvBools aRstLRSpaces;
SwHistory* pHistory;
public:
diff --git a/sw/source/core/undo/unnum.cxx b/sw/source/core/undo/unnum.cxx
index bc2be15..d5afd1f 100644
--- a/sw/source/core/undo/unnum.cxx
+++ b/sw/source/core/undo/unnum.cxx
@@ -190,10 +190,9 @@ void SwUndoInsNum::SaveOldNumRule( const SwNumRule& rOld )
SwUndoDelNum::SwUndoDelNum( const SwPaM& rPam )
- : SwUndo( UNDO_DELNUM ), SwUndRng( rPam ),
- aNodeIdx( BYTE( nEndNode - nSttNode > 255 ? 255 : nEndNode - nSttNode )),
- aLevels( BYTE( nEndNode - nSttNode > 255 ? 255 : nEndNode - nSttNode ))
+ : SwUndo( UNDO_DELNUM ), SwUndRng( rPam )
{
+ aNodes.reserve( nEndNode - nSttNode > 255 ? 255 : nEndNode - nSttNode );
pHistory = new SwHistory;
}
@@ -215,11 +214,11 @@ void SwUndoDelNum::Undo( SwUndoIter& rUndoIter )
pHistory->TmpRollback( &rDoc, 0 );
pHistory->SetTmpEnd( pHistory->Count() );
- for( USHORT n = 0; n < aNodeIdx.Count(); ++n )
+ for( SvNode::const_iterator i = aNodes.begin(); i != aNodes.end(); ++i )
{
- SwTxtNode* pNd = rDoc.GetNodes()[ aNodeIdx[ n ] ]->GetTxtNode();
+ SwTxtNode* pNd = rDoc.GetNodes()[ i->first ]->GetTxtNode();
OSL_ENSURE( pNd, "wo ist der TextNode geblieben?" );
- pNd->SetAttrListLevel(aLevels[ n ] );
+ pNd->SetAttrListLevel( i->second );
if( pNd->GetCondFmtColl() )
pNd->ChkCondColl();
@@ -247,10 +246,7 @@ void SwUndoDelNum::AddNode( const SwTxtNode& rNd, BOOL )
{
if( rNd.GetNumRule() )
{
- USHORT nIns = aNodeIdx.Count();
- aNodeIdx.Insert( rNd.GetIndex(), nIns );
-
- aLevels.Insert( static_cast<BYTE>(rNd.GetActualListLevel()), nIns );
+ aNodes.push_back( SvNode::value_type( rNd.GetIndex(), rNd.GetActualListLevel() ) );
}
}
Context
- [Libreoffice] [PATCH] Get rid of SvBytes/SvSvULongs in SwUndoDelNum · Andrey Turkin
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.