diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-03-29 01:44:32 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-03-29 01:44:32 -0400 |
commit | 8bf6eb4519b4b92390570341a10872e65fd95dc1 (patch) | |
tree | 0b418d679dfdfe0b9cc50b7b235e7900c120f570 /editeng/source | |
parent | ea8f2cbee079932e7f5d9ab646996b472a120c76 (diff) |
Revert "ContentList no longer a child class of DummyContentList."
This reverts commit ea8f2cbee079932e7f5d9ab646996b472a120c76.
Diffstat (limited to 'editeng/source')
-rw-r--r-- | editeng/source/editeng/editdbg.cxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/editdoc.cxx | 112 | ||||
-rw-r--r-- | editeng/source/editeng/editdoc.hxx | 63 | ||||
-rw-r--r-- | editeng/source/editeng/editdoc2.cxx | 80 | ||||
-rw-r--r-- | editeng/source/editeng/editeng.cxx | 8 | ||||
-rw-r--r-- | editeng/source/editeng/editview.cxx | 6 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.cxx | 4 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.hxx | 31 | ||||
-rw-r--r-- | editeng/source/editeng/impedit2.cxx | 39 | ||||
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/impedit4.cxx | 8 | ||||
-rw-r--r-- | editeng/source/editeng/impedit5.cxx | 22 | ||||
-rw-r--r-- | editeng/source/outliner/outlvw.cxx | 2 |
13 files changed, 136 insertions, 243 deletions
diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx index 48f6e0005b1d..4070002d7219 100644 --- a/editeng/source/editeng/editdbg.cxx +++ b/editeng/source/editeng/editdbg.cxx @@ -335,7 +335,7 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, sal_Bool bInfoBox ) for ( sal_uInt16 nPortion = 0; nPortion < pEE->pImpEditEngine->GetParaPortions(). Count(); nPortion++) { - ParaPortion* pPPortion = pEE->pImpEditEngine->GetParaPortions()[nPortion]; + ParaPortion* pPPortion = pEE->pImpEditEngine->GetParaPortions().GetObject(nPortion ); fprintf( fp, "\nParagraph %i: Length = %i, Invalid = %i\nText = '%s'", nPortion, pPPortion->GetNode()->Len(), pPPortion->IsInvalid(), rtl::OUStringToOString( *pPPortion->GetNode(), RTL_TEXTENCODING_ASCII_US ).getStr() ); fprintf( fp, "\nVorlage:" ); SfxStyleSheet* pStyle = pPPortion->GetNode()->GetStyleSheet(); diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 5df6635c5f2d..f83d05420aa7 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -256,6 +256,8 @@ sal_uInt16 aV5Map[] = { 4035, 4036, 4037, 4038 }; +SV_IMPL_PTRARR( DummyContentList, ContentNode* ); + EditCharAttrib* MakeCharAttrib( SfxItemPool& rPool, const SfxPoolItem& rAttr, sal_uInt16 nS, sal_uInt16 nE ) { // Create a new attribute in the pool @@ -565,25 +567,6 @@ sal_uInt16 EditLineList::FindLine( sal_uInt16 nChar, sal_Bool bInclEnd ) return ( Count() - 1 ); } -EditPaM::EditPaM() : pNode(NULL), nIndex(0) {} -EditPaM::EditPaM(const EditPaM& r) : pNode(r.pNode), nIndex(r.nIndex) {} -EditPaM::EditPaM(ContentNode* p, sal_uInt16 n) : pNode(p), nIndex(n) {} - -const ContentNode* EditPaM::GetNode() const -{ - return pNode; -} - -ContentNode* EditPaM::GetNode() -{ - return pNode; -} - -void EditPaM::SetNode(ContentNode* p) -{ - pNode = p; -} - sal_Bool EditPaM::DbgIsBuggy( EditDoc& rDoc ) { if ( !pNode ) @@ -650,8 +633,8 @@ sal_Bool EditSelection::Adjust( const ContentList& 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)" ); - const ContentNode* pStartNode = aStartPaM.GetNode(); - const ContentNode* pEndNode = aEndPaM.GetNode(); + ContentNode* pStartNode = aStartPaM.GetNode(); + ContentNode* pEndNode = aEndPaM.GetNode(); sal_uInt16 nStartNode = rNodes.GetPos( pStartNode ); sal_uInt16 nEndNode = rNodes.GetPos( pEndNode ); @@ -1153,23 +1136,23 @@ void ContentAttribs::SetStyleSheet( SfxStyleSheet* pS ) } } -const SfxPoolItem& ContentAttribs::GetItem( sal_uInt16 nWhich ) const +const SfxPoolItem& ContentAttribs::GetItem( sal_uInt16 nWhich ) { // Hard paragraph attributes take precedence! - const SfxItemSet* pTakeFrom = &aAttribSet; + SfxItemSet* pTakeFrom = &aAttribSet; if ( pStyle && ( aAttribSet.GetItemState( nWhich, sal_False ) != SFX_ITEM_ON ) ) pTakeFrom = &pStyle->GetItemSet(); return pTakeFrom->Get( nWhich ); } -bool ContentAttribs::HasItem( sal_uInt16 nWhich ) const +sal_Bool ContentAttribs::HasItem( sal_uInt16 nWhich ) { - bool bHasItem = false; + sal_Bool bHasItem = sal_False; if ( aAttribSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_ON ) - bHasItem = true; + bHasItem = sal_True; else if ( pStyle && pStyle->GetItemSet().GetItemState( nWhich ) == SFX_ITEM_ON ) - bHasItem = true; + bHasItem = sal_True; return bHasItem; } @@ -1235,7 +1218,7 @@ void EditDoc::ImplDestroyContents() { for ( sal_uInt16 nNode = Count(); nNode; ) RemoveItemsFromPool( GetObject( --nNode ) ); - Clear(); + DeleteAndDestroy( 0, Count() ); } void EditDoc::RemoveItemsFromPool( ContentNode* pNode ) @@ -1340,16 +1323,6 @@ static const sal_Unicode aCR[] = { 0x0d, 0x00 }; static const sal_Unicode aLF[] = { 0x0a, 0x00 }; static const sal_Unicode aCRLF[] = { 0x0d, 0x0a, 0x00 }; -const ContentNode* EditDoc::SaveGetObject(size_t nPos) const -{ - return ( nPos < Count() ) ? GetObject( nPos ) : 0; -} - -ContentNode* EditDoc::SaveGetObject(size_t nPos) -{ - return ( nPos < Count() ) ? GetObject( nPos ) : 0; -} - XubString EditDoc::GetSepStr( LineEnd eEnd ) { XubString aSep; @@ -1402,8 +1375,7 @@ XubString EditDoc::GetParaAsString( sal_uInt16 nNode ) const return GetParaAsString( SaveGetObject( nNode ) ); } -XubString EditDoc::GetParaAsString( - const ContentNode* pNode, sal_uInt16 nStartPos, sal_uInt16 nEndPos, bool bResolveFields) const +XubString EditDoc::GetParaAsString( ContentNode* pNode, sal_uInt16 nStartPos, sal_uInt16 nEndPos, sal_Bool bResolveFields ) const { if ( nEndPos > pNode->Len() ) nEndPos = pNode->Len(); @@ -1453,7 +1425,7 @@ sal_uLong EditDoc::GetTextLen() const sal_uLong nLen = 0; for ( sal_uInt16 nNode = 0; nNode < Count(); nNode++ ) { - const ContentNode* pNode = GetObject( nNode ); + ContentNode* pNode = GetObject( nNode ); nLen += pNode->Len(); // Fields can be longer than the placeholder in the Node const CharAttribList::AttribsType& rAttrs = pNode->GetCharAttribs().GetAttribs(); @@ -1478,11 +1450,11 @@ EditPaM EditDoc::Clear() ImplDestroyContents(); ContentNode* pNode = new ContentNode( GetItemPool() ); - Insert(0, pNode); + Insert( pNode, 0 ); - CreateDefFont(false); + CreateDefFont( sal_False ); - SetModified(false); + SetModified( sal_False ); EditPaM aPaM( pNode, 0 ); return aPaM; @@ -1508,19 +1480,19 @@ EditPaM EditDoc::RemoveText() ImplDestroyContents(); ContentNode* pNode = new ContentNode( GetItemPool() ); - Insert(0, pNode); + Insert( pNode, 0 ); - pNode->SetStyleSheet(pPrevStyle, false); + pNode->SetStyleSheet( pPrevStyle, sal_False ); pNode->GetContentAttribs().GetItems().Set( aPrevSet ); pNode->GetCharAttribs().GetDefFont() = aPrevFont; - SetModified(true); + SetModified( sal_True ); EditPaM aPaM( pNode, 0 ); return aPaM; } -void EditDoc::InsertText( EditPaM& rPaM, xub_Unicode c ) +void EditDoc::InsertText( const EditPaM& rPaM, xub_Unicode c ) { DBG_ASSERT( c != 0x0A, "EditDoc::InsertText: Newlines prohibited in paragraph!" ); DBG_ASSERT( c != 0x0D, "EditDoc::InsertText: Newlines prohibited in paragraph!" ); @@ -1581,9 +1553,9 @@ EditPaM EditDoc::InsertParaBreak( EditPaM aPaM, sal_Bool bKeepEndingAttribs ) // Character attributes may need to be copied or trimmed: pNode->CopyAndCutAttribs( aPaM.GetNode(), GetItemPool(), bKeepEndingAttribs ); - Insert(nPos+1, pNode); + Insert( pNode, nPos+1 ); - SetModified(true); + SetModified( sal_True ); aPaM.SetNode( pNode ); aPaM.SetIndex( 0 ); @@ -1812,16 +1784,15 @@ void EditDoc::InsertAttrib( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nE else { // Check whether already a new attribute with WhichId exists at this place: - CharAttribList& rAttrList = pNode->GetCharAttribs(); - EditCharAttrib* pAttr = rAttrList.FindEmptyAttrib( rPoolItem.Which(), nStart ); + EditCharAttrib* pAttr = pNode->GetCharAttribs().FindEmptyAttrib( rPoolItem.Which(), nStart ); if ( pAttr ) { // Remove attribute.... - rAttrList.Remove(pAttr); + pNode->GetCharAttribs().Remove(pAttr); } // check whether 'the same' attribute exist at this place. - pAttr = rAttrList.FindAttrib( rPoolItem.Which(), nStart ); + pAttr = pNode->GetCharAttribs().FindAttrib( rPoolItem.Which(), nStart ); if ( pAttr ) { if ( pAttr->IsInside( nStart ) ) // split @@ -1829,8 +1800,8 @@ void EditDoc::InsertAttrib( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nE // check again if really splitting, or return ! sal_uInt16 nOldEnd = pAttr->GetEnd(); pAttr->GetEnd() = nStart; - EditCharAttrib* pNew = MakeCharAttrib( GetItemPool(), *(pAttr->GetItem()), nStart, nOldEnd ); - rAttrList.InsertAttrib(pNew); + pAttr = MakeCharAttrib( GetItemPool(), *(pAttr->GetItem()), nStart, nOldEnd ); + pNode->GetCharAttribs().InsertAttrib( pAttr ); } else if ( pAttr->GetEnd() == nStart ) { @@ -2045,20 +2016,6 @@ void CharAttribList::Clear() aAttribs.clear(); } -const EditCharAttrib* CharAttribList::FindAttrib( sal_uInt16 nWhich, sal_uInt16 nPos ) const -{ - // Backwards, if one ends where the next starts. - // => The starting one is the valid one ... - AttribsType::const_reverse_iterator it = aAttribs.rbegin(), itEnd = aAttribs.rend(); - for (; it != itEnd; ++it) - { - const EditCharAttrib& rAttr = *it; - if (rAttr.Which() == nWhich && rAttr.IsIn(nPos)) - return &rAttr; - } - return NULL; -} - EditCharAttrib* CharAttribList::FindAttrib( sal_uInt16 nWhich, sal_uInt16 nPos ) { // Backwards, if one ends where the next starts. @@ -2160,21 +2117,6 @@ bool CharAttribList::HasBoundingAttrib( sal_uInt16 nBound ) const return false; } -const EditCharAttrib* CharAttribList::FindEmptyAttrib( sal_uInt16 nWhich, sal_uInt16 nPos ) const -{ - if ( !bHasEmptyAttribs ) - return NULL; - - AttribsType::const_iterator it = aAttribs.begin(), itEnd = aAttribs.end(); - for (; it != itEnd; ++it) - { - const EditCharAttrib& rAttr = *it; - if (rAttr.GetStart() == nPos && rAttr.GetEnd() == nPos && rAttr.Which() == nWhich) - return &rAttr; - } - return NULL; -} - EditCharAttrib* CharAttribList::FindEmptyAttrib( sal_uInt16 nWhich, sal_uInt16 nPos ) { if ( !bHasEmptyAttribs ) diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx index 0114c099e681..7b7a9e555fda 100644 --- a/editeng/source/editeng/editdoc.hxx +++ b/editeng/source/editeng/editdoc.hxx @@ -38,11 +38,9 @@ #include <svl/style.hxx> #include <svl/itempool.hxx> #include <tools/table.hxx> - #include <vector> -#include <deque> -#include <boost/ptr_container/ptr_vector.hpp> +#include <deque> class ImpEditEngine; class SvxTabStop; @@ -195,13 +193,11 @@ public: SvxTabStop FindTabStop( long nCurPos, sal_uInt16 nDefTab ); SfxItemSet& GetItems() { return aAttribSet; } - const SfxItemSet& GetItems() const { return aAttribSet; } - const SfxStyleSheet* GetStyleSheet() const { return pStyle; } - SfxStyleSheet* GetStyleSheet() { return pStyle; } + SfxStyleSheet* GetStyleSheet() const { return pStyle; } void SetStyleSheet( SfxStyleSheet* pS ); - const SfxPoolItem& GetItem( sal_uInt16 nWhich ) const; - bool HasItem( sal_uInt16 nWhich ) const; + const SfxPoolItem& GetItem( sal_uInt16 nWhich ); + sal_Bool HasItem( sal_uInt16 nWhich ); }; // ------------------------------------------------------------------------- @@ -226,10 +222,8 @@ public: void DeleteEmptyAttribs( SfxItemPool& rItemPool ); void RemoveItemsFromPool( SfxItemPool* pItemPool ); - const EditCharAttrib* FindAttrib( sal_uInt16 nWhich, sal_uInt16 nPos ) const; EditCharAttrib* FindAttrib( sal_uInt16 nWhich, sal_uInt16 nPos ); const EditCharAttrib* FindNextAttrib( sal_uInt16 nWhich, sal_uInt16 nFromPos ) const; - const EditCharAttrib* FindEmptyAttrib( sal_uInt16 nWhich, sal_uInt16 nPos ) const; EditCharAttrib* FindEmptyAttrib( sal_uInt16 nWhich, sal_uInt16 nPos ); const EditCharAttrib* FindFeature( sal_uInt16 nPos ) const; @@ -277,9 +271,7 @@ public: ~ContentNode(); ContentAttribs& GetContentAttribs() { return aContentAttribs; } - const ContentAttribs& GetContentAttribs() const { return aContentAttribs; } CharAttribList& GetCharAttribs() { return aCharAttribList; } - const CharAttribList& GetCharAttribs() const { return aCharAttribList; } void ExpandAttribs( sal_uInt16 nIndex, sal_uInt16 nNewChars, SfxItemPool& rItemPool ); void CollapsAttribs( sal_uInt16 nIndex, sal_uInt16 nDelChars, SfxItemPool& rItemPool ); @@ -289,12 +281,10 @@ public: void SetStyleSheet( SfxStyleSheet* pS, sal_Bool bRecalcFont = sal_True ); void SetStyleSheet( SfxStyleSheet* pS, const SvxFont& rFontFromStyle ); SfxStyleSheet* GetStyleSheet() { return aContentAttribs.GetStyleSheet(); } - const SfxStyleSheet* GetStyleSheet() const { return aContentAttribs.GetStyleSheet(); } void CreateDefFont(); WrongList* GetWrongList() { return pWrongList; } - const WrongList* GetWrongList() const { return pWrongList; } void SetWrongList( WrongList* p ); void CreateWrongList(); @@ -303,22 +293,15 @@ public: sal_Bool IsFeature( sal_uInt16 nPos ) const { return ( GetChar( nPos ) == CH_FEATURE ); } }; -class ContentList +typedef ContentNode* ContentNodePtr; +SV_DECL_PTRARR( DummyContentList, ContentNodePtr, 0 ) + +class ContentList : public DummyContentList { - mutable size_t nLastCache; - boost::ptr_vector<ContentNode> maContents; + mutable sal_uInt16 nLastCache; 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); - void Remove(size_t nPos); - size_t Count() const; - void Clear(); + sal_uInt16 GetPos(ContentNode* p) const; }; // ------------------------------------------------------------------------- @@ -327,17 +310,15 @@ public: class EditPaM { private: - ContentNode* pNode; + ContentNode* pNode; sal_uInt16 nIndex; public: - EditPaM(); - EditPaM(const EditPaM& r); - EditPaM(ContentNode* p, sal_uInt16 n); + EditPaM() { pNode = NULL; nIndex = 0; } + EditPaM( ContentNode* p, sal_uInt16 n ) { pNode = p; nIndex = n; } - const ContentNode* GetNode() const; - ContentNode* GetNode(); - void SetNode(ContentNode* p); + ContentNode* GetNode() const { return pNode; } + void SetNode( ContentNode* p) { pNode = p; } sal_uInt16 GetIndex() const { return nIndex; } sal_uInt16& GetIndex() { return nIndex; } @@ -777,7 +758,7 @@ public: EditPaM Clear(); EditPaM RemoveText(); EditPaM RemoveChars( EditPaM aPaM, sal_uInt16 nChars ); - void InsertText( EditPaM& rPaM, xub_Unicode c ); + void InsertText( const EditPaM& rPaM, xub_Unicode c ); EditPaM InsertText( EditPaM aPaM, const XubString& rStr ); EditPaM InsertParaBreak( EditPaM aPaM, sal_Bool bKeepEndingAttribs ); EditPaM InsertFeature( EditPaM aPaM, const SfxPoolItem& rItem ); @@ -787,7 +768,7 @@ public: sal_uLong GetTextLen() const; XubString GetParaAsString( sal_uInt16 nNode ) const; - XubString GetParaAsString(const ContentNode* pNode, sal_uInt16 nStartPos = 0, sal_uInt16 nEndPos = 0xFFFF, bool bResolveFields = true) const; + XubString GetParaAsString( ContentNode* pNode, sal_uInt16 nStartPos = 0, sal_uInt16 nEndPos = 0xFFFF, sal_Bool bResolveFields = sal_True ) const; inline EditPaM GetStartPaM() const; inline EditPaM GetEndPaM() const; @@ -804,22 +785,20 @@ 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* SaveGetObject(size_t nPos) const; - ContentNode* SaveGetObject(size_t nPos); + sal_uInt16 GetPos( ContentNode* pNode ) const { return ContentList::GetPos(pNode); } + ContentNode* SaveGetObject( sal_uInt16 nPos ) const { return ( nPos < Count() ) ? GetObject( nPos ) : 0; } static XubString GetSepStr( LineEnd eEnd ); }; inline EditPaM EditDoc::GetStartPaM() const { - ContentNode* p = const_cast<ContentNode*>(GetObject(0)); - return EditPaM(p, 0); + return EditPaM( GetObject( 0 ), 0 ); } inline EditPaM EditDoc::GetEndPaM() const { - ContentNode* pLastNode = const_cast<ContentNode*>(GetObject(Count()-1)); + ContentNode* pLastNode = GetObject( Count()-1 ); return EditPaM( pLastNode, pLastNode->Len() ); } diff --git a/editeng/source/editeng/editdoc2.cxx b/editeng/source/editeng/editdoc2.cxx index 474e3fa782cf..cb3cafddf986 100644 --- a/editeng/source/editeng/editdoc2.cxx +++ b/editeng/source/editeng/editdoc2.cxx @@ -295,6 +295,37 @@ void ParaPortion::CorrectValuesBehindLastFormattedLine( sal_uInt16 nLastFormatte namespace { +template<typename T> +sal_uInt16 FastGetPos( + T const* pPtrArray, sal_uInt16 nPtrArrayLen, T pPtr, sal_uInt16 &rLastPos) +{ + // Through certain filter code-paths we do a lot of appends, which in + // turn call GetPos - creating some N^2 nightmares. If we have a + // non-trivially large list, do a few checks from the end first. + if( rLastPos > 16 ) + { + sal_uInt16 nEnd; + if (rLastPos > nPtrArrayLen - 2) + nEnd = nPtrArrayLen; + else + nEnd = rLastPos + 2; + + for( sal_uInt16 nIdx = rLastPos - 2; nIdx < nEnd; nIdx++ ) + { + if( pPtrArray[ nIdx ] == pPtr ) + { + rLastPos = nIdx; + return nIdx; + } + } + } + // The world's lamest linear search from svarray ... + for( sal_uInt16 nIdx = 0; nIdx < nPtrArrayLen; nIdx++ ) + if (pPtrArray[ nIdx ] == pPtr ) + return rLastPos = nIdx; + return USHRT_MAX; +} + template<typename _Array, typename _Val> size_t FastGetPos(const _Array& rArray, const _Val* p, size_t& rLastPos) { @@ -379,54 +410,11 @@ size_t ParaPortionList::Count() const return maPortions.size(); } -ContentList::ContentList() : nLastCache(0) {} - -size_t ContentList::GetPos(const ContentNode* p) const -{ - return FastGetPos(maContents, p, nLastCache); -} - -const ContentNode* ContentList::GetObject(size_t nPos) const -{ - return nPos < maContents.size() ? &maContents[nPos] : NULL; -} - -ContentNode* ContentList::GetObject(size_t nPos) -{ - return nPos < maContents.size() ? &maContents[nPos] : NULL; -} - -const ContentNode* ContentList::operator[](size_t nPos) const -{ - return GetObject(nPos); -} - -ContentNode* ContentList::operator[](size_t nPos) -{ - return GetObject(nPos); -} - -void ContentList::Insert(size_t nPos, ContentNode* p) -{ - maContents.insert(maContents.begin()+nPos, p); -} - -void ContentList::Remove(size_t nPos) -{ - if (nPos >= maContents.size()) - return; - - maContents.erase(maContents.begin() + nPos); -} - -size_t ContentList::Count() const -{ - return maContents.size(); -} +ContentList::ContentList() : DummyContentList( 0 ), nLastCache(0) {} -void ContentList::Clear() +sal_uInt16 ContentList::GetPos(ContentNode* p) const { - maContents.clear(); + return FastGetPos(GetData(), Count(), p, nLastCache); } void ParaPortionList::Reset() diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 275a992a0f95..8a68f089ac37 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -1881,13 +1881,7 @@ void EditEngine::SetStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pStyle ) pImpEditEngine->SetStyleSheet( nPara, pStyle ); } -const SfxStyleSheet* EditEngine::GetStyleSheet( sal_uInt16 nPara ) const -{ - DBG_CHKTHIS( EditEngine, 0 ); - return pImpEditEngine->GetStyleSheet( nPara ); -} - -SfxStyleSheet* EditEngine::GetStyleSheet( sal_uInt16 nPara ) +SfxStyleSheet* EditEngine::GetStyleSheet( sal_uInt16 nPara ) const { DBG_CHKTHIS( EditEngine, 0 ); return pImpEditEngine->GetStyleSheet( nPara ); diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index 6d78cf53b116..e066f73269ff 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -730,7 +730,7 @@ void EditView::ForceUpdate() PIMPEE->SetUpdateMode( sal_True, this, sal_True ); } -const SfxStyleSheet* EditView::GetStyleSheet() const +SfxStyleSheet* EditView::GetStyleSheet() const { DBG_CHKTHIS( EditView, 0 ); DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); @@ -741,10 +741,10 @@ const SfxStyleSheet* EditView::GetStyleSheet() const sal_uInt16 nStartPara = PIMPEE->GetEditDoc().GetPos( aSel.Min().GetNode() ); sal_uInt16 nEndPara = PIMPEE->GetEditDoc().GetPos( aSel.Max().GetNode() ); - const SfxStyleSheet* pStyle = NULL; + SfxStyleSheet* pStyle = NULL; for ( sal_uInt16 n = nStartPara; n <= nEndPara; n++ ) { - const SfxStyleSheet* pTmpStyle = PIMPEE->GetStyleSheet( n ); + SfxStyleSheet* pTmpStyle = PIMPEE->GetStyleSheet( n ); if ( ( n != nStartPara ) && ( pStyle != pTmpStyle ) ) return NULL; // Not unique. pStyle = pTmpStyle; diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 273f3f14dc04..811e96e50b7f 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -1092,7 +1092,7 @@ void ImpEditView::SetInsertMode( sal_Bool bInsert ) sal_Bool ImpEditView::IsWrongSpelledWord( const EditPaM& rPaM, sal_Bool bMarkIfWrong ) { - bool bIsWrong = false; + sal_Bool bIsWrong = sal_False; if ( rPaM.GetNode()->GetWrongList() ) { EditSelection aSel = pEditEngine->pImpEditEngine->SelectWord( rPaM, ::com::sun::star::i18n::WordType::DICTIONARY_WORD ); @@ -1139,7 +1139,7 @@ String ImpEditView::SpellIgnoreOrAddWord( sal_Bool bAdd ) if (xDic.is()) xDic->add( aWord, sal_False, String() ); } - EditDoc& rDoc = pEditEngine->pImpEditEngine->GetEditDoc(); + const EditDoc& rDoc = pEditEngine->pImpEditEngine->GetEditDoc(); sal_uInt16 nNodes = rDoc.Count(); for ( sal_uInt16 n = 0; n < nNodes; n++ ) { diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index ec15742ac7c1..3d4aaa0f6504 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -535,8 +535,8 @@ private: EditPaM GetPaM( Point aDocPos, sal_Bool bSmart = sal_True ); EditPaM GetPaM( ParaPortion* pPortion, Point aPos, sal_Bool bSmart = sal_True ); - long GetXPos(const ParaPortion* pParaPortion, EditLine* pLine, sal_uInt16 nIndex, bool bPreferPortionStart = false) const; - long GetPortionXOffset(const ParaPortion* pParaPortion, const EditLine* pLine, sal_uInt16 nTextPortion) const; + long GetXPos( ParaPortion* pParaPortion, EditLine* pLine, sal_uInt16 nIndex, sal_Bool bPreferPortionStart = sal_False ); + long GetPortionXOffset(const ParaPortion* pParaPortion, EditLine* pLine, sal_uInt16 nTextPortion); sal_uInt16 GetChar(const ParaPortion* pParaPortion, EditLine* pLine, long nX, bool bSmart = true); Range GetInvalidYOffsets( ParaPortion* pPortion ); Range GetLineXPosStartEnd( const ParaPortion* pParaPortion, EditLine* pLine ) const; @@ -547,7 +547,7 @@ private: void ParaAttribsToCharAttribs( ContentNode* pNode ); void GetCharAttribs( sal_uInt16 nPara, std::vector<EECharAttrib>& rLst ) const; - EditTextObject* CreateBinTextObject( EditSelection aSelection, SfxItemPool*, sal_Bool bAllowBigObjects = sal_False, sal_uInt16 nBigObjStart = 0 ); + EditTextObject* CreateBinTextObject( EditSelection aSelection, SfxItemPool*, sal_Bool bAllowBigObjects = sal_False, sal_uInt16 nBigObjStart = 0 ) const; void StoreBinTextObject( SvStream& rOStream, BinTextObject& rTextObject ); EditSelection InsertBinTextObject( BinTextObject&, EditPaM aPaM ); EditSelection InsertText( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rxDataObj, const String& rBaseURL, const EditPaM& rPaM, sal_Bool bUseSpecial ); @@ -570,8 +570,8 @@ private: void ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* pLine, long nRemainingSpace ); EditPaM ImpConnectParagraphs( ContentNode* pLeft, ContentNode* pRight, sal_Bool bBackward = sal_False ); EditPaM ImpDeleteSelection( EditSelection aEditSelection); - EditPaM ImpInsertParaBreak( EditPaM& rPaM, bool bKeepEndingAttribs = true ); - EditPaM ImpInsertParaBreak( const EditSelection& rEditSelection, bool bKeepEndingAttribs = true ); + EditPaM ImpInsertParaBreak( const EditPaM& rPaM, sal_Bool bKeepEndingAttribs = sal_True ); + EditPaM ImpInsertParaBreak( const EditSelection& rEditSelection, sal_Bool bKeepEndingAttribs = sal_True ); EditPaM ImpInsertText( EditSelection aCurEditSelection, const String& rStr ); EditPaM ImpInsertFeature( EditSelection aEditSelection, const SfxPoolItem& rItem ); void ImpRemoveChars( const EditPaM& rPaM, sal_uInt16 nChars, EditUndoRemoveChars* pCurUndo = 0 ); @@ -636,7 +636,7 @@ private: sal_uInt32 WriteRTF( SvStream& rOutput, EditSelection aSel ); sal_uInt32 WriteXML( SvStream& rOutput, EditSelection aSel ); sal_uInt32 WriteHTML( SvStream& rOutput, EditSelection aSel ); - sal_uInt32 WriteBin( SvStream& rOutput, EditSelection aSel, sal_Bool bStoreUnicode = sal_False ); + sal_uInt32 WriteBin( SvStream& rOutput, EditSelection aSel, sal_Bool bStoreUnicode = sal_False ) const; void WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, sal_uInt16 nPara, sal_uInt16 nPos, std::vector<SvxFontItem*>& rFontTable, SvxColorList& rColorList ); @@ -678,10 +678,10 @@ private: void CheckIdleFormatter(); - inline const ParaPortion* FindParaPortion( const ContentNode* pNode ) const; + inline const ParaPortion* FindParaPortion( ContentNode* pNode ) const; inline ParaPortion* FindParaPortion( ContentNode* pNode ); - ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > CreateTransferable( const EditSelection& rSelection ); + ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > CreateTransferable( const EditSelection& rSelection ) const; void SetValidPaperSize( const Size& rSz ); @@ -812,7 +812,7 @@ public: void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ); const SfxItemSet& GetParaAttribs( sal_uInt16 nPara ) const; - bool HasParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich ) const; + sal_Bool HasParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich ) const; const SfxPoolItem& GetParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich ) const; Rectangle PaMtoEditCursor( EditPaM aPaM, sal_uInt16 nFlags = 0 ); @@ -850,7 +850,7 @@ public: sal_Bool IsVisualCursorTravelingEnabled(); sal_Bool DoVisualCursorTraveling( const ContentNode* pNode ); - EditSelection ConvertSelection( sal_uInt16 nStartPara, sal_uInt16 nStartPos, sal_uInt16 nEndPara, sal_uInt16 nEndPos ); + EditSelection ConvertSelection( sal_uInt16 nStartPara, sal_uInt16 nStartPos, sal_uInt16 nEndPara, sal_uInt16 nEndPos ) const; inline EPaM CreateEPaM( const EditPaM& rPaM ); inline EditPaM CreateEditPaM( const EPaM& rEPaM ); inline ESelection CreateESel( const EditSelection& rSel ); @@ -862,8 +862,7 @@ public: void SetStyleSheet( EditSelection aSel, SfxStyleSheet* pStyle ); void SetStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pStyle ); - const SfxStyleSheet* GetStyleSheet( sal_uInt16 nPara ) const; - SfxStyleSheet* GetStyleSheet( sal_uInt16 nPara ); + SfxStyleSheet* GetStyleSheet( sal_uInt16 nPara ) const; void UpdateParagraphsWithStyleSheet( SfxStyleSheet* pStyle ); void RemoveStyleFromParagraphs( SfxStyleSheet* pStyle ); @@ -1020,7 +1019,7 @@ public: inline EPaM ImpEditEngine::CreateEPaM( const EditPaM& rPaM ) { - const ContentNode* pNode = rPaM.GetNode(); + ContentNode* pNode = rPaM.GetNode(); return EPaM( aEditDoc.GetPos( pNode ), rPaM.GetIndex() ); } @@ -1033,8 +1032,8 @@ inline EditPaM ImpEditEngine::CreateEditPaM( const EPaM& rEPaM ) inline ESelection ImpEditEngine::CreateESel( const EditSelection& rSel ) { - const ContentNode* pStartNode = rSel.Min().GetNode(); - const ContentNode* pEndNode = rSel.Max().GetNode(); + ContentNode* pStartNode = rSel.Min().GetNode(); + ContentNode* pEndNode = rSel.Max().GetNode(); ESelection aESel; aESel.nStartPara = aEditDoc.GetPos( pStartNode ); aESel.nStartPos = rSel.Min().GetIndex(); @@ -1093,7 +1092,7 @@ inline EditUndoManager& ImpEditEngine::GetUndoManager() return *pUndoManager; } -inline const ParaPortion* ImpEditEngine::FindParaPortion( const ContentNode* pNode ) const +inline const ParaPortion* ImpEditEngine::FindParaPortion( ContentNode* pNode ) const { sal_uInt16 nPos = aEditDoc.GetPos( pNode ); DBG_ASSERT( nPos < GetParaPortions().Count(), "Portionloser Node?" ); diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 04cebce327f2..661d2c15d72e 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -298,7 +298,7 @@ XubString ImpEditEngine::GetSelected( const EditSelection& rSel, const LineEnd e for ( sal_uInt16 nNode = nStartNode; nNode <= nEndNode; nNode++ ) { OSL_ENSURE( aEditDoc.SaveGetObject( nNode ), "Node not found: GetSelected" ); - const ContentNode* pNode = aEditDoc.GetObject( nNode ); + ContentNode* pNode = aEditDoc.GetObject( nNode ); xub_StrLen nStartPos = 0; xub_StrLen nEndPos = pNode->Len(); @@ -1291,7 +1291,7 @@ EditPaM ImpEditEngine::CursorUp( const EditPaM& rPaM, EditView* pView ) { OSL_ENSURE( pView, "No View - No Cursor Movement!" ); - const ParaPortion* pPPortion = FindParaPortion( rPaM.GetNode() ); + ParaPortion* pPPortion = FindParaPortion( rPaM.GetNode() ); OSL_ENSURE( pPPortion, "No matching portion found: CursorUp "); sal_uInt16 nLine = pPPortion->GetLineNumber( rPaM.GetIndex() ); EditLine* pLine = pPPortion->GetLines().GetObject( nLine ); @@ -1336,7 +1336,7 @@ EditPaM ImpEditEngine::CursorDown( const EditPaM& rPaM, EditView* pView ) { OSL_ENSURE( pView, "No View - No Cursor Movement!" ); - const ParaPortion* pPPortion = FindParaPortion( rPaM.GetNode() ); + ParaPortion* pPPortion = FindParaPortion( rPaM.GetNode() ); OSL_ENSURE( pPPortion, "No matching portion found: CursorDown" ); sal_uInt16 nLine = pPPortion->GetLineNumber( rPaM.GetIndex() ); @@ -1380,7 +1380,7 @@ EditPaM ImpEditEngine::CursorDown( const EditPaM& rPaM, EditView* pView ) EditPaM ImpEditEngine::CursorStartOfLine( const EditPaM& rPaM ) { - const ParaPortion* pCurPortion = FindParaPortion( rPaM.GetNode() ); + ParaPortion* pCurPortion = FindParaPortion( rPaM.GetNode() ); OSL_ENSURE( pCurPortion, "No Portion for the PaM ?" ); sal_uInt16 nLine = pCurPortion->GetLineNumber( rPaM.GetIndex() ); EditLine* pLine = pCurPortion->GetLines().GetObject(nLine); @@ -1393,7 +1393,7 @@ EditPaM ImpEditEngine::CursorStartOfLine( const EditPaM& rPaM ) EditPaM ImpEditEngine::CursorEndOfLine( const EditPaM& rPaM ) { - const ParaPortion* pCurPortion = FindParaPortion( rPaM.GetNode() ); + ParaPortion* pCurPortion = FindParaPortion( rPaM.GetNode() ); OSL_ENSURE( pCurPortion, "No Portion for the PaM ?" ); sal_uInt16 nLine = pCurPortion->GetLineNumber( rPaM.GetIndex() ); EditLine* pLine = pCurPortion->GetLines().GetObject(nLine); @@ -1423,15 +1423,13 @@ EditPaM ImpEditEngine::CursorEndOfLine( const EditPaM& rPaM ) EditPaM ImpEditEngine::CursorStartOfParagraph( const EditPaM& rPaM ) { - EditPaM aPaM(rPaM); - aPaM.SetIndex(0); + EditPaM aPaM( rPaM.GetNode(), 0 ); return aPaM; } EditPaM ImpEditEngine::CursorEndOfParagraph( const EditPaM& rPaM ) { - EditPaM aPaM(rPaM); - aPaM.SetIndex(rPaM.GetNode()->Len()); + EditPaM aPaM( rPaM.GetNode(), rPaM.GetNode()->Len() ); return aPaM; } @@ -2209,7 +2207,7 @@ EditSelection ImpEditEngine::ImpMoveParagraphs( Range aOldPositions, sal_uInt16 aSelection.Max().SetIndex( pTmpPortion->GetNode()->Len() ); ContentNode* pN = pTmpPortion->GetNode(); - aEditDoc.Insert(nRealNewPos+i, pN); + aEditDoc.Insert( pN, nRealNewPos+i ); GetParaPortions().Insert(nRealNewPos+i, pTmpPortion); } @@ -2332,7 +2330,7 @@ EditPaM ImpEditEngine::DeleteLeftOrRight( const EditSelection& rSel, sal_uInt8 n if ( rSel.HasRange() ) // only then Delete Selection return ImpDeleteSelection( rSel ); - EditPaM aCurPos( rSel.Max() ); + const EditPaM aCurPos( rSel.Max() ); EditPaM aDelStart( aCurPos ); EditPaM aDelEnd( aCurPos ); if ( nMode == DEL_LEFT ) @@ -2822,7 +2820,7 @@ EditPaM ImpEditEngine::ImpInsertFeature( EditSelection aCurSel, const SfxPoolIte return aPaM; } -EditPaM ImpEditEngine::ImpInsertParaBreak( const EditSelection& rCurSel, bool bKeepEndingAttribs ) +EditPaM ImpEditEngine::ImpInsertParaBreak( const EditSelection& rCurSel, sal_Bool bKeepEndingAttribs ) { EditPaM aPaM; if ( rCurSel.HasRange() ) @@ -2833,7 +2831,7 @@ EditPaM ImpEditEngine::ImpInsertParaBreak( const EditSelection& rCurSel, bool bK return ImpInsertParaBreak( aPaM, bKeepEndingAttribs ); } -EditPaM ImpEditEngine::ImpInsertParaBreak( EditPaM& rPaM, bool bKeepEndingAttribs ) +EditPaM ImpEditEngine::ImpInsertParaBreak( const EditPaM& rPaM, sal_Bool bKeepEndingAttribs ) { if ( aEditDoc.Count() >= 0xFFFE ) { @@ -2914,7 +2912,7 @@ EditPaM ImpEditEngine::ImpFastInsertParagraph( sal_uInt16 nPara ) if ( GetStatus().DoOnlineSpelling() ) pNode->CreateWrongList(); - aEditDoc.Insert(nPara, pNode); + aEditDoc.Insert( pNode, nPara ); ParaPortion* pNewPortion = new ParaPortion( pNode ); GetParaPortions().Insert(nPara, pNewPortion); @@ -3280,7 +3278,7 @@ void ImpEditEngine::GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uIn sal_uInt16 ImpEditEngine::GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const { sal_uInt16 nLineNo = 0xFFFF; - const ContentNode* pNode = GetEditDoc().SaveGetObject( nPara ); + ContentNode* pNode = GetEditDoc().SaveGetObject( nPara ); OSL_ENSURE( pNode, "GetLineNumberAtIndex: invalid paragraph index" ); if (pNode) { @@ -3405,8 +3403,8 @@ void ImpEditEngine::UpdateSelections() aDeletedNodes.Remove( 0, aDeletedNodes.Count() ); } -EditSelection ImpEditEngine::ConvertSelection( - sal_uInt16 nStartPara, sal_uInt16 nStartPos, sal_uInt16 nEndPara, sal_uInt16 nEndPos ) +EditSelection ImpEditEngine::ConvertSelection( sal_uInt16 nStartPara, sal_uInt16 nStartPos, + sal_uInt16 nEndPara, sal_uInt16 nEndPos ) const { EditSelection aNewSelection; @@ -3472,7 +3470,7 @@ void ImpEditEngine::SetActiveView( EditView* pView ) } } -uno::Reference< datatransfer::XTransferable > ImpEditEngine::CreateTransferable( const EditSelection& rSelection ) +uno::Reference< datatransfer::XTransferable > ImpEditEngine::CreateTransferable( const EditSelection& rSelection ) const { EditSelection aSelection( rSelection ); aSelection.Adjust( GetEditDoc() ); @@ -3853,7 +3851,7 @@ Range ImpEditEngine::GetLineXPosStartEnd( const ParaPortion* pParaPortion, EditL } long ImpEditEngine::GetPortionXOffset( - const ParaPortion* pParaPortion, const EditLine* pLine, sal_uInt16 nTextPortion) const + const ParaPortion* pParaPortion, EditLine* pLine, sal_uInt16 nTextPortion) { long nX = pLine->GetStartPosX(); @@ -3942,8 +3940,7 @@ long ImpEditEngine::GetPortionXOffset( return nX; } -long ImpEditEngine::GetXPos( - const ParaPortion* pParaPortion, EditLine* pLine, sal_uInt16 nIndex, bool bPreferPortionStart) const +long ImpEditEngine::GetXPos( ParaPortion* pParaPortion, EditLine* pLine, sal_uInt16 nIndex, sal_Bool bPreferPortionStart ) { OSL_ENSURE( pLine, "No line received: GetXPos" ); OSL_ENSURE( ( nIndex >= pLine->GetStart() ) && ( nIndex <= pLine->GetEnd() ) , "GetXPos has to be called properly!" ); diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 14cf4e468892..507c70025895 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -3720,7 +3720,7 @@ void ImpEditEngine::InsertContent( ContentNode* pNode, sal_uInt16 nPos ) DBG_ASSERT( IsInUndo(), "InsertContent only for Undo()!" ); ParaPortion* pNew = new ParaPortion( pNode ); GetParaPortions().Insert(nPos, pNew); - aEditDoc.Insert(nPos, pNode); + aEditDoc.Insert( pNode, nPos ); if ( IsCallParaInsertedOrDeleted() ) GetEditEnginePtr()->ParagraphInserted( nPos ); } diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index c5b89fd8e366..4bce12fe3203 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -307,7 +307,7 @@ void lcl_FindValidAttribs( ItemList& rLst, ContentNode* pNode, sal_uInt16 nIndex } } -sal_uInt32 ImpEditEngine::WriteBin( SvStream& rOutput, EditSelection aSel, sal_Bool bStoreUnicodeStrings ) +sal_uInt32 ImpEditEngine::WriteBin( SvStream& rOutput, EditSelection aSel, sal_Bool bStoreUnicodeStrings ) const { BinTextObject* pObj = (BinTextObject*)CreateBinTextObject( aSel, NULL ); pObj->StoreUnicodeStrings( bStoreUnicodeStrings ); @@ -1029,7 +1029,7 @@ EditTextObject* ImpEditEngine::CreateTextObject( EditSelection aSel ) return CreateBinTextObject( aSel, GetEditTextObjectPool(), aStatus.AllowBigObjects(), nBigTextObjectStart ); } -EditTextObject* ImpEditEngine::CreateBinTextObject( EditSelection aSel, SfxItemPool* pPool, sal_Bool bAllowBigObjects, sal_uInt16 nBigObjectStart ) +EditTextObject* ImpEditEngine::CreateBinTextObject( EditSelection aSel, SfxItemPool* pPool, sal_Bool bAllowBigObjects, sal_uInt16 nBigObjectStart ) const { BinTextObject* pTxtObj = new BinTextObject( pPool ); pTxtObj->SetVertical( IsVertical() ); @@ -1403,7 +1403,7 @@ LanguageType ImpEditEngine::GetLanguage( const EditPaM& rPaM, sal_uInt16* pEndPo short nScriptType = GetScriptType( rPaM, pEndPos ); // pEndPos will be valid now, pointing to ScriptChange or NodeLen sal_uInt16 nLangId = GetScriptItemId( EE_CHAR_LANGUAGE, nScriptType ); const SvxLanguageItem* pLangItem = &(const SvxLanguageItem&)rPaM.GetNode()->GetContentAttribs().GetItem( nLangId ); - const EditCharAttrib* pAttr = rPaM.GetNode()->GetCharAttribs().FindAttrib( nLangId, rPaM.GetIndex() ); + EditCharAttrib* pAttr = rPaM.GetNode()->GetCharAttribs().FindAttrib( nLangId, rPaM.GetIndex() ); if ( pAttr ) pLangItem = (const SvxLanguageItem*)pAttr->GetItem(); @@ -2960,7 +2960,7 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, // yet unchanged text parts remain the same. for (size_t i = 0; i < aChanges.size(); ++i) { - TransliterationChgData& rData = aChanges[ aChanges.size() - 1 - i ]; + const TransliterationChgData &rData = aChanges[ aChanges.size() - 1 - i ]; bChanges = sal_True; if (rData.nLen != rData.aNewText.Len()) diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx index 1310064d26cc..2401d2c8bb69 100644 --- a/editeng/source/editeng/impedit5.cxx +++ b/editeng/source/editeng/impedit5.cxx @@ -46,13 +46,7 @@ void ImpEditEngine::SetStyleSheetPool( SfxStyleSheetPool* pSPool ) } } -const SfxStyleSheet* ImpEditEngine::GetStyleSheet( sal_uInt16 nPara ) const -{ - const ContentNode* pNode = aEditDoc.SaveGetObject( nPara ); - return pNode ? pNode->GetContentAttribs().GetStyleSheet() : NULL; -} - -SfxStyleSheet* ImpEditEngine::GetStyleSheet( sal_uInt16 nPara ) +SfxStyleSheet* ImpEditEngine::GetStyleSheet( sal_uInt16 nPara ) const { ContentNode* pNode = aEditDoc.SaveGetObject( nPara ); return pNode ? pNode->GetContentAttribs().GetStyleSheet() : NULL; @@ -415,7 +409,7 @@ SfxItemSet ImpEditEngine::GetAttribs( sal_uInt16 nPara, sal_uInt16 nStart, sal_u DBG_CHKOBJ( GetEditEnginePtr(), EditEngine, 0 ); - ContentNode* pNode = const_cast<ContentNode*>(aEditDoc.SaveGetObject(nPara)); + ContentNode* pNode = aEditDoc.SaveGetObject( nPara ); DBG_ASSERT( pNode, "GetAttribs - unknown paragraph!" ); DBG_ASSERT( nStart <= nEnd, "getAttribs: Start > End not supported!" ); @@ -432,7 +426,7 @@ SfxItemSet ImpEditEngine::GetAttribs( sal_uInt16 nPara, sal_uInt16 nStart, sal_u // StyleSheet / Parattribs... if ( pNode->GetStyleSheet() && ( nFlags & GETATTRIBS_STYLESHEET ) ) - aAttribs.Set(pNode->GetStyleSheet()->GetItemSet(), true); + aAttribs.Set( pNode->GetStyleSheet()->GetItemSet(), sal_True ); if ( nFlags & GETATTRIBS_PARAATTRIBS ) aAttribs.Put( pNode->GetContentAttribs().GetItems() ); @@ -726,14 +720,14 @@ void ImpEditEngine::SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ) const SfxItemSet& ImpEditEngine::GetParaAttribs( sal_uInt16 nPara ) const { - const ContentNode* pNode = aEditDoc.GetObject( nPara ); + ContentNode* pNode = aEditDoc.GetObject( nPara ); DBG_ASSERT( pNode, "Node not found: GetParaAttribs" ); return pNode->GetContentAttribs().GetItems(); } -bool ImpEditEngine::HasParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich ) const +sal_Bool ImpEditEngine::HasParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich ) const { - const ContentNode* pNode = aEditDoc.GetObject( nPara ); + ContentNode* pNode = aEditDoc.GetObject( nPara ); DBG_ASSERT( pNode, "Node not found: HasParaAttrib" ); return pNode->GetContentAttribs().HasItem( nWhich ); @@ -741,7 +735,7 @@ bool ImpEditEngine::HasParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich ) const const SfxPoolItem& ImpEditEngine::GetParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich ) const { - const ContentNode* pNode = aEditDoc.GetObject( nPara ); + ContentNode* pNode = aEditDoc.GetObject( nPara ); DBG_ASSERT( pNode, "Node not found: GetParaAttrib" ); return pNode->GetContentAttribs().GetItem( nWhich ); @@ -750,7 +744,7 @@ const SfxPoolItem& ImpEditEngine::GetParaAttrib( sal_uInt16 nPara, sal_uInt16 nW void ImpEditEngine::GetCharAttribs( sal_uInt16 nPara, std::vector<EECharAttrib>& rLst ) const { rLst.clear(); - const ContentNode* pNode = aEditDoc.GetObject( nPara ); + ContentNode* pNode = aEditDoc.GetObject( nPara ); if ( pNode ) { rLst.reserve(pNode->GetCharAttribs().Count()); diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index 26f0494361a9..e1edd397bb35 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -780,7 +780,7 @@ void OutlinerView::CreateSelectionList (std::vector<Paragraph*> &aSelList) } } -const SfxStyleSheet* OutlinerView::GetStyleSheet() const +SfxStyleSheet* OutlinerView::GetStyleSheet() const { DBG_CHKTHIS(OutlinerView,0); return pEditView->GetStyleSheet(); |