summaryrefslogtreecommitdiffstats
path: root/editeng
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-04-02 18:48:16 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-04-03 10:20:07 -0400
commit037908f9ee16156cc251a444a0d82142e27a7d34 (patch)
tree5ce733990baa27f9636131747288031ee3129dd2 /editeng
parentMake them non inline. (diff)
downloadcore-037908f9ee16156cc251a444a0d82142e27a7d34.tar.gz
core-037908f9ee16156cc251a444a0d82142e27a7d34.zip
We can now access the nodes directly from EditDoc.
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/editdoc.cxx27
-rw-r--r--editeng/source/editeng/editdoc.hxx2
-rw-r--r--editeng/source/editeng/impedit2.cxx2
3 files changed, 22 insertions, 9 deletions
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 15d3cd5799ff..f593893947f2 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -1704,19 +1704,32 @@ EditDoc::~EditDoc()
SfxItemPool::Free(pItemPool);
}
-void EditDoc::ImplDestroyContents()
+namespace {
+
+class RemoveEachItemFromPool : std::unary_function<ContentNode, void>
{
- for ( sal_uInt16 nNode = Count(); nNode; )
- RemoveItemsFromPool( GetObject( --nNode ) );
+ EditDoc& mrDoc;
+public:
+ RemoveEachItemFromPool(EditDoc& rDoc) : mrDoc(rDoc) {}
+ void operator() (const ContentNode& rNode)
+ {
+ mrDoc.RemoveItemsFromPool(rNode);
+ }
+};
+
+}
+void EditDoc::ImplDestroyContents()
+{
+ std::for_each(maContents.begin(), maContents.end(), RemoveEachItemFromPool(*this));
maContents.clear();
}
-void EditDoc::RemoveItemsFromPool( ContentNode* pNode )
+void EditDoc::RemoveItemsFromPool(const ContentNode& rNode)
{
- for ( sal_uInt16 nAttr = 0; nAttr < pNode->GetCharAttribs().Count(); nAttr++ )
+ for (size_t nAttr = 0; nAttr < rNode.GetCharAttribs().Count(); ++nAttr)
{
- const EditCharAttrib& rAttr = pNode->GetCharAttribs().GetAttribs()[nAttr];
+ const EditCharAttrib& rAttr = rNode.GetCharAttribs().GetAttribs()[nAttr];
GetItemPool().Remove(*rAttr.GetItem());
}
}
@@ -2143,7 +2156,7 @@ EditPaM EditDoc::ConnectParagraphs( ContentNode* pLeft, ContentNode* pRight )
*pLeft += *pRight;
// the one to the right disappears.
- RemoveItemsFromPool( pRight );
+ RemoveItemsFromPool(*pRight);
sal_uInt16 nRight = GetPos( pRight );
Remove( nRight );
diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx
index 3dc13cc63d41..b1e7f561df0c 100644
--- a/editeng/source/editeng/editdoc.hxx
+++ b/editeng/source/editeng/editdoc.hxx
@@ -777,7 +777,7 @@ public:
SfxItemPool& GetItemPool() { return *pItemPool; }
const SfxItemPool& GetItemPool() const { return *pItemPool; }
- void RemoveItemsFromPool( ContentNode* pNode );
+ void RemoveItemsFromPool(const ContentNode& rNode);
void InsertAttrib( const SfxPoolItem& rItem, ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd );
void InsertAttrib( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, const SfxPoolItem& rPoolItem );
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 9bab5db9673a..3a6613c3bc36 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -2503,7 +2503,7 @@ void ImpEditEngine::ImpRemoveParagraph( sal_uInt16 nPara )
InsertUndo( new EditUndoDelContent( this, pNode, nPara ) );
else
{
- aEditDoc.RemoveItemsFromPool( pNode );
+ aEditDoc.RemoveItemsFromPool(*pNode);
if ( pNode->GetStyleSheet() )
EndListening( *pNode->GetStyleSheet(), sal_False );
delete pNode;