diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-04-02 14:15:15 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-04-03 10:20:05 -0400 |
commit | 79bd9550d368ab8c9d636476b6df6521218e40ef (patch) | |
tree | 899efd4eb577cc0ce0b0340019df95ea3fe7891b /editeng | |
parent | Tuck these typedefs under their respective classes. (diff) | |
download | core-79bd9550d368ab8c9d636476b6df6521218e40ef.tar.gz core-79bd9550d368ab8c9d636476b6df6521218e40ef.zip |
Merged ContentList into EditDoc.
There is no reason for this separation to exist.
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/editdoc.cxx | 6 | ||||
-rw-r--r-- | editeng/source/editeng/editdoc.hxx | 41 | ||||
-rw-r--r-- | editeng/source/editeng/editdoc2.cxx | 25 | ||||
-rw-r--r-- | editeng/source/editeng/edtspell.cxx | 2 |
4 files changed, 30 insertions, 44 deletions
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 54e2016e48ac..8798540e0fd7 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -644,7 +644,7 @@ sal_Bool EditSelection::IsInvalid() const return sal_False; } -sal_Bool EditSelection::Adjust( const ContentList& rNodes ) +sal_Bool EditSelection::Adjust( const EditDoc& rNodes ) { DBG_ASSERT( aStartPaM.GetIndex() <= aStartPaM.GetNode()->Len(), "Index out of range in Adjust(1)" ); DBG_ASSERT( aEndPaM.GetIndex() <= aEndPaM.GetNode()->Len(), "Index out of range in Adjust(2)" ); @@ -1201,7 +1201,7 @@ void ItemList::Insert( const SfxPoolItem* pItem ) } -EditDoc::EditDoc( SfxItemPool* pPool ) +EditDoc::EditDoc( SfxItemPool* pPool ) : nLastCache(0) { if ( pPool ) { @@ -1235,7 +1235,7 @@ void EditDoc::ImplDestroyContents() for ( sal_uInt16 nNode = Count(); nNode; ) RemoveItemsFromPool( GetObject( --nNode ) ); - ContentList::Clear(); + maContents.clear(); } void EditDoc::RemoveItemsFromPool( ContentNode* pNode ) diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx index 147fc90bef46..bd967ca476e0 100644 --- a/editeng/source/editeng/editdoc.hxx +++ b/editeng/source/editeng/editdoc.hxx @@ -301,27 +301,6 @@ public: sal_Bool IsFeature( sal_uInt16 nPos ) const { return ( GetChar( nPos ) == CH_FEATURE ); } }; -class ContentList -{ - mutable size_t nLastCache; - boost::ptr_vector<ContentNode> maContents; -public: - ContentList(); - size_t GetPos(const ContentNode* p) const; - const ContentNode* GetObject(size_t nPos) const; - ContentNode* GetObject(size_t nPos); - const ContentNode* operator[](size_t nPos) const; - ContentNode* operator[](size_t nPos); - - void Insert(size_t nPos, ContentNode* p); - /// deletes - void Remove(size_t nPos); - /// does not delete - void Release(size_t nPos); - size_t Count() const; - void Clear(); -}; - // ------------------------------------------------------------------------- // class EditPaM // ------------------------------------------------------------------------- @@ -703,7 +682,7 @@ public: sal_Bool IsInvalid() const; sal_Bool DbgIsBuggy( EditDoc& rDoc ); - sal_Bool Adjust( const ContentList& rNodes ); + sal_Bool Adjust( const EditDoc& rNodes ); EditSelection& operator = ( const EditPaM& r ); sal_Bool operator == ( const EditSelection& r ) const @@ -736,9 +715,12 @@ SV_DECL_PTRARR( DeletedNodesList, DeletedNodeInfoPtr, 0 ) // ------------------------------------------------------------------------- // class EditDoc // ------------------------------------------------------------------------- -class EditDoc : public ContentList +class EditDoc { private: + mutable size_t nLastCache; + boost::ptr_vector<ContentNode> maContents; + SfxItemPool* pItemPool; Link aModifyHdl; @@ -804,10 +786,21 @@ public: sal_Bool RemoveAttribs( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, EditCharAttrib*& rpStarting, EditCharAttrib*& rpEnding, sal_uInt16 nWhich = 0 ); void FindAttribs( ContentNode* pNode, sal_uInt16 nStartPos, sal_uInt16 nEndPos, SfxItemSet& rCurSet ); - sal_uInt16 GetPos( const ContentNode* pNode ) const { return ContentList::GetPos(pNode); } const ContentNode* SafeGetObject(size_t nPos) const; ContentNode* SafeGetObject(size_t nPos); + size_t GetPos(const ContentNode* pNode) const; + const ContentNode* GetObject(size_t nPos) const; + ContentNode* GetObject(size_t nPos); + size_t Count() const; + const ContentNode* operator[](size_t nPos) const; + ContentNode* operator[](size_t nPos); + void Insert(size_t nPos, ContentNode* p); + /// deletes + void Remove(size_t nPos); + /// does not delete + void Release(size_t nPos); + static XubString GetSepStr( LineEnd eEnd ); }; diff --git a/editeng/source/editeng/editdoc2.cxx b/editeng/source/editeng/editdoc2.cxx index fc65c9c81dd4..f40f216f9e40 100644 --- a/editeng/source/editeng/editdoc2.cxx +++ b/editeng/source/editeng/editdoc2.cxx @@ -379,39 +379,37 @@ size_t ParaPortionList::Count() const return maPortions.size(); } -ContentList::ContentList() : nLastCache(0) {} - -size_t ContentList::GetPos(const ContentNode* p) const +size_t EditDoc::GetPos(const ContentNode* p) const { return FastGetPos(maContents, p, nLastCache); } -const ContentNode* ContentList::GetObject(size_t nPos) const +const ContentNode* EditDoc::GetObject(size_t nPos) const { return nPos < maContents.size() ? &maContents[nPos] : NULL; } -ContentNode* ContentList::GetObject(size_t nPos) +ContentNode* EditDoc::GetObject(size_t nPos) { return nPos < maContents.size() ? &maContents[nPos] : NULL; } -const ContentNode* ContentList::operator[](size_t nPos) const +const ContentNode* EditDoc::operator[](size_t nPos) const { return GetObject(nPos); } -ContentNode* ContentList::operator[](size_t nPos) +ContentNode* EditDoc::operator[](size_t nPos) { return GetObject(nPos); } -void ContentList::Insert(size_t nPos, ContentNode* p) +void EditDoc::Insert(size_t nPos, ContentNode* p) { maContents.insert(maContents.begin()+nPos, p); } -void ContentList::Remove(size_t nPos) +void EditDoc::Remove(size_t nPos) { if (nPos >= maContents.size()) return; @@ -419,7 +417,7 @@ void ContentList::Remove(size_t nPos) maContents.erase(maContents.begin() + nPos); } -void ContentList::Release(size_t nPos) +void EditDoc::Release(size_t nPos) { if (nPos >= maContents.size()) return; @@ -427,16 +425,11 @@ void ContentList::Release(size_t nPos) maContents.release(maContents.begin() + nPos).release(); } -size_t ContentList::Count() const +size_t EditDoc::Count() const { return maContents.size(); } -void ContentList::Clear() -{ - maContents.clear(); -} - void ParaPortionList::Reset() { maPortions.clear(); diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx index 0dcea4f9ae78..cd73f0d48851 100644 --- a/editeng/source/editeng/edtspell.cxx +++ b/editeng/source/editeng/edtspell.cxx @@ -720,7 +720,7 @@ const String* EdtAutoCorrDoc::GetPrevPara( sal_Bool ) bAllowUndoAction = sal_False; // Not anymore ... - ContentList& rNodes = pImpEE->GetEditDoc(); + EditDoc& rNodes = pImpEE->GetEditDoc(); sal_uInt16 nPos = rNodes.GetPos( pCurNode ); // Special case: Bullet => Paragraph start => simply return NULL... |