summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-04-02 20:54:42 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-04-03 10:20:08 -0400
commit352f10a2e7ee32bee3553bc657e88f319f8dadc7 (patch)
tree754c2459821851ac2081d9216b8892b8bccfa6f6 /editeng
parent33bf6e04590fe373fd2a9887f5636c2e831cc846 (diff)
Another SV_DECL_PTRARR to kill.
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/editdoc.hxx7
-rw-r--r--editeng/source/editeng/editundo.cxx2
-rw-r--r--editeng/source/editeng/impedit.hxx2
-rw-r--r--editeng/source/editeng/impedit2.cxx26
-rw-r--r--editeng/source/editeng/impedit3.cxx2
5 files changed, 14 insertions, 25 deletions
diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx
index 0c995c90e8df..7cc78ca663b3 100644
--- a/editeng/source/editeng/editdoc.hxx
+++ b/editeng/source/editeng/editdoc.hxx
@@ -707,13 +707,10 @@ public:
{ nInvalidAdressPtr = nInvAdr;
nInvalidParagraph = nPos; }
- sal_uIntPtr GetInvalidAdress() { return nInvalidAdressPtr; }
- sal_uInt16 GetPosition() { return nInvalidParagraph; }
+ sal_uIntPtr GetInvalidAdress() const { return nInvalidAdressPtr; }
+ sal_uInt16 GetPosition() const { return nInvalidParagraph; }
};
-typedef DeletedNodeInfo* DeletedNodeInfoPtr;
-SV_DECL_PTRARR( DeletedNodesList, DeletedNodeInfoPtr, 0 )
-
// -------------------------------------------------------------------------
// class EditDoc
// -------------------------------------------------------------------------
diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx
index 62443be2541f..d1f65b91dcbf 100644
--- a/editeng/source/editeng/editundo.cxx
+++ b/editeng/source/editeng/editundo.cxx
@@ -216,7 +216,7 @@ void EditUndoDelContent::Redo()
_pImpEE->GetEditEnginePtr()->ParagraphDeleted( nNode );
DeletedNodeInfo* pInf = new DeletedNodeInfo( (sal_uLong)pContentNode, nNode );
- _pImpEE->aDeletedNodes.Insert( pInf, _pImpEE->aDeletedNodes.Count() );
+ _pImpEE->aDeletedNodes.push_back(pInf);
_pImpEE->UpdateSelections();
ContentNode* pN = ( nNode < _pImpEE->GetEditDoc().Count() )
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index ef6e12851e8b..e98ec496846a 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -490,7 +490,7 @@ private:
sal_Bool bFirstWordCapitalization; // specifies if auto-correction should capitalize the first word or not
// For Formatting / Update ....
- DeletedNodesList aDeletedNodes;
+ boost::ptr_vector<DeletedNodeInfo> aDeletedNodes;
Rectangle aInvalidRec;
sal_uInt32 nCurTextHeight;
sal_uInt32 nCurTextHeightNTP; // without trailing empty paragraphs
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 5d5cdf24e346..406f2eba0b47 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -2255,7 +2255,7 @@ EditPaM ImpEditEngine::ImpConnectParagraphs( ContentNode* pLeft, ContentNode* pR
sal_uInt16 nParagraphTobeDeleted = aEditDoc.GetPos( pRight );
DeletedNodeInfo* pInf = new DeletedNodeInfo( (sal_uLong)pRight, nParagraphTobeDeleted );
- aDeletedNodes.Insert( pInf, aDeletedNodes.Count() );
+ aDeletedNodes.push_back(pInf);
GetEditEnginePtr()->ParagraphConnected( aEditDoc.GetPos( pLeft ), aEditDoc.GetPos( pRight ) );
@@ -2482,7 +2482,7 @@ void ImpEditEngine::ImpRemoveParagraph( sal_uInt16 nPara )
OSL_ENSURE( pNode, "Blind Node in ImpRemoveParagraph" );
DeletedNodeInfo* pInf = new DeletedNodeInfo( (sal_uLong)pNode, nPara );
- aDeletedNodes.Insert( pInf, aDeletedNodes.Count() );
+ aDeletedNodes.push_back(pInf);
// The node is managed by the undo and possibly destroyed!
aEditDoc.Release( nPara );
@@ -3332,8 +3332,6 @@ sal_uInt32 ImpEditEngine::GetParaHeight( sal_uInt16 nParagraph )
void ImpEditEngine::UpdateSelections()
{
- sal_uInt16 nInvNodes = aDeletedNodes.Count();
-
// Check whether one of the selections is at a deleted node...
// If the node is valid, the index has yet to be examined!
for ( sal_uInt16 nView = 0; nView < aEditViews.Count(); nView++ )
@@ -3341,16 +3339,16 @@ void ImpEditEngine::UpdateSelections()
EditView* pView = aEditViews.GetObject(nView);
DBG_CHKOBJ( pView, EditView, 0 );
EditSelection aCurSel( pView->pImpEditView->GetEditSelection() );
- sal_Bool bChanged = sal_False;
- for ( sal_uInt16 n = 0; n < nInvNodes; n++ )
+ bool bChanged = false;
+ for (size_t i = 0, n = aDeletedNodes.size(); i < n; ++i)
{
- DeletedNodeInfo* pInf = aDeletedNodes.GetObject( n );
- if ( ( ( sal_uLong )(aCurSel.Min().GetNode()) == pInf->GetInvalidAdress() ) ||
- ( ( sal_uLong )(aCurSel.Max().GetNode()) == pInf->GetInvalidAdress() ) )
+ const DeletedNodeInfo& rInf = aDeletedNodes[i];
+ if ( ( ( sal_uLong )(aCurSel.Min().GetNode()) == rInf.GetInvalidAdress() ) ||
+ ( ( sal_uLong )(aCurSel.Max().GetNode()) == rInf.GetInvalidAdress() ) )
{
// Use ParaPortions, as now also hidden paragraphs have to be
// taken into account!
- sal_uInt16 nPara = pInf->GetPosition();
+ sal_uInt16 nPara = rInf.GetPosition();
ParaPortion* pPPortion = GetParaPortions().SafeGetObject( nPara );
if ( !pPPortion ) // Last paragraph
{
@@ -3394,13 +3392,7 @@ void ImpEditEngine::UpdateSelections()
}
}
- // Delete ...
- for ( sal_uInt16 n = 0; n < nInvNodes; n++ )
- {
- DeletedNodeInfo* pInf = aDeletedNodes.GetObject( n );
- delete pInf;
- }
- aDeletedNodes.Remove( 0, aDeletedNodes.Count() );
+ aDeletedNodes.clear();
}
EditSelection ImpEditEngine::ConvertSelection(
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index f7038f5be77b..7806bce635f6 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -3785,7 +3785,7 @@ void ImpEditEngine::ShowParagraph( sal_uInt16 nParagraph, sal_Bool bShow )
// Mark as deleted, so that no selection will end or begin at
// this paragraph...
DeletedNodeInfo* pDelInfo = new DeletedNodeInfo( (sal_uIntPtr)pPPortion->GetNode(), nParagraph );
- aDeletedNodes.Insert( pDelInfo, aDeletedNodes.Count() );
+ aDeletedNodes.push_back(pDelInfo);
UpdateSelections();
// The region below will not be invalidated if UpdateMode = sal_False!
// If anyway, then save as sal_False before SetVisible !