[Libreoffice-commits] .: editeng/inc editeng/source

Kohei Yoshida kohei at kemper.freedesktop.org
Wed Mar 28 22:53:00 PDT 2012


 editeng/inc/editeng/editeng.hxx     |    3 
 editeng/inc/editeng/editview.hxx    |    2 
 editeng/inc/editeng/outliner.hxx    |    2 
 editeng/source/editeng/editdbg.cxx  |    2 
 editeng/source/editeng/editdoc.cxx  |  116 +++++++++++++++++++++++++++---------
 editeng/source/editeng/editdoc.hxx  |   63 +++++++++++++------
 editeng/source/editeng/editdoc2.cxx |   80 ++++++++++++++----------
 editeng/source/editeng/editeng.cxx  |    8 ++
 editeng/source/editeng/editview.cxx |    6 -
 editeng/source/editeng/impedit.cxx  |    4 -
 editeng/source/editeng/impedit.hxx  |   31 ++++-----
 editeng/source/editeng/impedit2.cxx |   39 ++++++------
 editeng/source/editeng/impedit3.cxx |    2 
 editeng/source/editeng/impedit4.cxx |    8 +-
 editeng/source/editeng/impedit5.cxx |   22 ++++--
 editeng/source/outliner/outlvw.cxx  |    2 
 16 files changed, 249 insertions(+), 141 deletions(-)

New commits:
commit c802cbad7f25d3070f2ae5fd8a7e1a7ce17f99a9
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Mar 29 01:43:30 2012 -0400

    ContentList no longer a child class of DummyContentList (take 2).
    
    The previous commit was bad as it would cause segfalut on startup.
    
    This one is good as far as I can tell.

diff --git a/editeng/inc/editeng/editeng.hxx b/editeng/inc/editeng/editeng.hxx
index 4c0d5e0..c17b15b 100644
--- a/editeng/inc/editeng/editeng.hxx
+++ b/editeng/inc/editeng/editeng.hxx
@@ -328,7 +328,8 @@ public:
     SfxStyleSheetPool*  GetStyleSheetPool();
 
     void                SetStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pStyle );
-    SfxStyleSheet*      GetStyleSheet( sal_uInt16 nPara ) const;
+    const SfxStyleSheet* GetStyleSheet( sal_uInt16 nPara ) const;
+    SfxStyleSheet* GetStyleSheet( sal_uInt16 nPara );
 
     void            SetWordDelimiters( const String& rDelimiters );
     String          GetWordDelimiters() const;
diff --git a/editeng/inc/editeng/editview.hxx b/editeng/inc/editeng/editview.hxx
index 7f3dd4c..aa9864f 100644
--- a/editeng/inc/editeng/editview.hxx
+++ b/editeng/inc/editeng/editview.hxx
@@ -183,7 +183,7 @@ public:
     void            SetEditEngineUpdateMode( sal_Bool bUpdate );
     void            ForceUpdate();
 
-    SfxStyleSheet*  GetStyleSheet() const;
+    const SfxStyleSheet* GetStyleSheet() const;
 
     void            SetAnchorMode( EVAnchorMode eMode );
     EVAnchorMode    GetAnchorMode() const;
diff --git a/editeng/inc/editeng/outliner.hxx b/editeng/inc/editeng/outliner.hxx
index faceb8a..ee7edec 100644
--- a/editeng/inc/editeng/outliner.hxx
+++ b/editeng/inc/editeng/outliner.hxx
@@ -308,7 +308,7 @@ public:
     void        Paste();
     void        PasteSpecial();
 
-    SfxStyleSheet*  GetStyleSheet() const;
+    const SfxStyleSheet*  GetStyleSheet() const;
 
     void        SetControlWord( sal_uLong nWord );
     sal_uLong       GetControlWord() const;
diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx
index 4070002..48f6e00 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().GetObject(nPortion );
+        ParaPortion* pPPortion = pEE->pImpEditEngine->GetParaPortions()[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 f83d054..010f40f 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -256,8 +256,6 @@ 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
@@ -567,6 +565,25 @@ 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 )
@@ -633,8 +650,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)" );
 
-    ContentNode* pStartNode = aStartPaM.GetNode();
-    ContentNode* pEndNode = aEndPaM.GetNode();
+    const ContentNode* pStartNode = aStartPaM.GetNode();
+    const ContentNode* pEndNode = aEndPaM.GetNode();
 
     sal_uInt16 nStartNode = rNodes.GetPos( pStartNode );
     sal_uInt16 nEndNode = rNodes.GetPos( pEndNode );
@@ -1136,23 +1153,23 @@ void ContentAttribs::SetStyleSheet( SfxStyleSheet* pS )
     }
 }
 
-const SfxPoolItem& ContentAttribs::GetItem( sal_uInt16 nWhich )
+const SfxPoolItem& ContentAttribs::GetItem( sal_uInt16 nWhich ) const
 {
     // Hard paragraph attributes take precedence!
-    SfxItemSet* pTakeFrom = &aAttribSet;
+    const SfxItemSet* pTakeFrom = &aAttribSet;
     if ( pStyle && ( aAttribSet.GetItemState( nWhich, sal_False ) != SFX_ITEM_ON  ) )
         pTakeFrom = &pStyle->GetItemSet();
 
     return pTakeFrom->Get( nWhich );
 }
 
-sal_Bool ContentAttribs::HasItem( sal_uInt16 nWhich )
+bool ContentAttribs::HasItem( sal_uInt16 nWhich ) const
 {
-    sal_Bool bHasItem = sal_False;
+    bool bHasItem = false;
     if ( aAttribSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_ON  )
-        bHasItem = sal_True;
+        bHasItem = true;
     else if ( pStyle && pStyle->GetItemSet().GetItemState( nWhich ) == SFX_ITEM_ON )
-        bHasItem = sal_True;
+        bHasItem = true;
 
     return bHasItem;
 }
@@ -1218,7 +1235,8 @@ void EditDoc::ImplDestroyContents()
 {
     for ( sal_uInt16 nNode = Count(); nNode; )
         RemoveItemsFromPool( GetObject( --nNode ) );
-    DeleteAndDestroy( 0, Count() );
+
+    ContentList::Clear();
 }
 
 void EditDoc::RemoveItemsFromPool( ContentNode* pNode )
@@ -1323,6 +1341,16 @@ 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;
@@ -1375,7 +1403,8 @@ XubString EditDoc::GetParaAsString( sal_uInt16 nNode ) const
     return GetParaAsString( SaveGetObject( nNode ) );
 }
 
-XubString EditDoc::GetParaAsString( ContentNode* pNode, sal_uInt16 nStartPos, sal_uInt16 nEndPos, sal_Bool bResolveFields ) const
+XubString EditDoc::GetParaAsString(
+    const ContentNode* pNode, sal_uInt16 nStartPos, sal_uInt16 nEndPos, bool bResolveFields) const
 {
     if ( nEndPos > pNode->Len() )
         nEndPos = pNode->Len();
@@ -1425,7 +1454,7 @@ sal_uLong EditDoc::GetTextLen() const
     sal_uLong nLen = 0;
     for ( sal_uInt16 nNode = 0; nNode < Count(); nNode++ )
     {
-        ContentNode* pNode = GetObject( nNode );
+        const ContentNode* pNode = GetObject( nNode );
         nLen += pNode->Len();
         // Fields can be longer than the placeholder in the Node
         const CharAttribList::AttribsType& rAttrs = pNode->GetCharAttribs().GetAttribs();
@@ -1450,11 +1479,11 @@ EditPaM EditDoc::Clear()
     ImplDestroyContents();
 
     ContentNode* pNode = new ContentNode( GetItemPool() );
-    Insert( pNode, 0 );
+    Insert(0, pNode);
 
-    CreateDefFont( sal_False );
+    CreateDefFont(false);
 
-    SetModified( sal_False );
+    SetModified(false);
 
     EditPaM aPaM( pNode, 0 );
     return aPaM;
@@ -1480,19 +1509,19 @@ EditPaM EditDoc::RemoveText()
     ImplDestroyContents();
 
     ContentNode* pNode = new ContentNode( GetItemPool() );
-    Insert( pNode, 0 );
+    Insert(0, pNode);
 
-    pNode->SetStyleSheet( pPrevStyle, sal_False );
+    pNode->SetStyleSheet(pPrevStyle, false);
     pNode->GetContentAttribs().GetItems().Set( aPrevSet );
     pNode->GetCharAttribs().GetDefFont() = aPrevFont;
 
-    SetModified( sal_True );
+    SetModified(true);
 
     EditPaM aPaM( pNode, 0 );
     return aPaM;
 }
 
-void EditDoc::InsertText( const EditPaM& rPaM, xub_Unicode c )
+void EditDoc::InsertText( 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!" );
@@ -1553,9 +1582,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( pNode, nPos+1 );
+    Insert(nPos+1, pNode);
 
-    SetModified( sal_True );
+    SetModified(true);
 
     aPaM.SetNode( pNode );
     aPaM.SetIndex( 0 );
@@ -1593,9 +1622,8 @@ EditPaM EditDoc::ConnectParagraphs( ContentNode* pLeft, ContentNode* pRight )
     RemoveItemsFromPool( pRight );
     sal_uInt16 nRight = GetPos( pRight );
     Remove( nRight );
-    delete pRight;
 
-    SetModified( sal_True );
+    SetModified(true);
 
     return aPaM;
 }
@@ -1784,15 +1812,16 @@ void EditDoc::InsertAttrib( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nE
     else
     {
         // Check whether already a new attribute with WhichId exists at this place:
-        EditCharAttrib* pAttr = pNode->GetCharAttribs().FindEmptyAttrib( rPoolItem.Which(), nStart );
+        CharAttribList& rAttrList = pNode->GetCharAttribs();
+        EditCharAttrib* pAttr = rAttrList.FindEmptyAttrib( rPoolItem.Which(), nStart );
         if ( pAttr )
         {
             // Remove attribute....
-            pNode->GetCharAttribs().Remove(pAttr);
+            rAttrList.Remove(pAttr);
         }
 
         // check whether 'the same' attribute exist at this place.
-        pAttr = pNode->GetCharAttribs().FindAttrib( rPoolItem.Which(), nStart );
+        pAttr = rAttrList.FindAttrib( rPoolItem.Which(), nStart );
         if ( pAttr )
         {
             if ( pAttr->IsInside( nStart ) )    // split
@@ -1800,8 +1829,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;
-                pAttr = MakeCharAttrib( GetItemPool(), *(pAttr->GetItem()), nStart, nOldEnd );
-                pNode->GetCharAttribs().InsertAttrib( pAttr );
+                EditCharAttrib* pNew = MakeCharAttrib( GetItemPool(), *(pAttr->GetItem()), nStart, nOldEnd );
+                rAttrList.InsertAttrib(pNew);
             }
             else if ( pAttr->GetEnd() == nStart )
             {
@@ -2016,6 +2045,20 @@ 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.
@@ -2117,6 +2160,21 @@ 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 7b7a9e5..0114c09 100644
--- a/editeng/source/editeng/editdoc.hxx
+++ b/editeng/source/editeng/editdoc.hxx
@@ -38,10 +38,12 @@
 #include <svl/style.hxx>
 #include <svl/itempool.hxx>
 #include <tools/table.hxx>
-#include <vector>
 
+#include <vector>
 #include <deque>
 
+#include <boost/ptr_container/ptr_vector.hpp>
+
 class ImpEditEngine;
 class SvxTabStop;
 class SvtCTLOptions;
@@ -193,11 +195,13 @@ public:
 
     SvxTabStop      FindTabStop( long nCurPos, sal_uInt16 nDefTab );
     SfxItemSet&     GetItems()                          { return aAttribSet; }
-    SfxStyleSheet*  GetStyleSheet() const               { return pStyle; }
+    const SfxItemSet& GetItems() const { return aAttribSet; }
+    const SfxStyleSheet*  GetStyleSheet() const { return pStyle; }
+    SfxStyleSheet*  GetStyleSheet() { return pStyle; }
     void            SetStyleSheet( SfxStyleSheet* pS );
 
-    const SfxPoolItem&  GetItem( sal_uInt16 nWhich );
-    sal_Bool                HasItem( sal_uInt16 nWhich );
+    const SfxPoolItem& GetItem( sal_uInt16 nWhich ) const;
+    bool HasItem( sal_uInt16 nWhich ) const;
 };
 
 // -------------------------------------------------------------------------
@@ -222,8 +226,10 @@ 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;
 
@@ -271,7 +277,9 @@ 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 );
@@ -281,10 +289,12 @@ 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();
@@ -293,15 +303,22 @@ public:
     sal_Bool            IsFeature( sal_uInt16 nPos ) const { return ( GetChar( nPos ) == CH_FEATURE ); }
 };
 
-typedef ContentNode* ContentNodePtr;
-SV_DECL_PTRARR( DummyContentList, ContentNodePtr, 0 )
-
-class ContentList : public DummyContentList
+class ContentList
 {
-    mutable sal_uInt16 nLastCache;
+    mutable size_t nLastCache;
+    boost::ptr_vector<ContentNode> maContents;
 public:
     ContentList();
-    sal_uInt16 GetPos(ContentNode* p) const;
+    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();
 };
 
 // -------------------------------------------------------------------------
@@ -310,15 +327,17 @@ public:
 class EditPaM
 {
 private:
-    ContentNode*    pNode;
+    ContentNode* pNode;
     sal_uInt16          nIndex;
 
 public:
-                    EditPaM()                           { pNode = NULL; nIndex = 0; }
-                    EditPaM( ContentNode* p, sal_uInt16 n ) { pNode = p; nIndex = n; }
+    EditPaM();
+    EditPaM(const EditPaM& r);
+    EditPaM(ContentNode* p, sal_uInt16 n);
 
-    ContentNode*    GetNode() const                 { return pNode; }
-    void            SetNode( ContentNode* p)        { pNode = p; }
+    const ContentNode* GetNode() const;
+    ContentNode* GetNode();
+    void SetNode(ContentNode* p);
 
     sal_uInt16          GetIndex() const                { return nIndex; }
     sal_uInt16&         GetIndex()                      { return nIndex; }
@@ -758,7 +777,7 @@ public:
     EditPaM         Clear();
     EditPaM         RemoveText();
     EditPaM         RemoveChars( EditPaM aPaM, sal_uInt16 nChars );
-    void            InsertText( const EditPaM& rPaM, xub_Unicode c );
+    void            InsertText( 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 );
@@ -768,7 +787,7 @@ public:
     sal_uLong           GetTextLen() const;
 
     XubString       GetParaAsString( sal_uInt16 nNode ) const;
-    XubString       GetParaAsString( ContentNode* pNode, sal_uInt16 nStartPos = 0, sal_uInt16 nEndPos = 0xFFFF, sal_Bool bResolveFields = sal_True ) const;
+    XubString       GetParaAsString(const ContentNode* pNode, sal_uInt16 nStartPos = 0, sal_uInt16 nEndPos = 0xFFFF, bool bResolveFields = true) const;
 
     inline EditPaM  GetStartPaM() const;
     inline EditPaM  GetEndPaM() const;
@@ -785,20 +804,22 @@ 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( ContentNode* pNode ) const { return ContentList::GetPos(pNode); }
-    ContentNode*    SaveGetObject( sal_uInt16 nPos ) const { return ( nPos < Count() ) ? GetObject( nPos ) : 0; }
+    sal_uInt16 GetPos( const ContentNode* pNode ) const { return ContentList::GetPos(pNode); }
+    const ContentNode* SaveGetObject(size_t nPos) const;
+    ContentNode* SaveGetObject(size_t nPos);
 
     static XubString    GetSepStr( LineEnd eEnd );
 };
 
 inline EditPaM EditDoc::GetStartPaM() const
 {
-    return EditPaM( GetObject( 0 ), 0 );
+    ContentNode* p = const_cast<ContentNode*>(GetObject(0));
+    return EditPaM(p, 0);
 }
 
 inline EditPaM EditDoc::GetEndPaM() const
 {
-    ContentNode* pLastNode = GetObject( Count()-1 );
+    ContentNode* pLastNode = const_cast<ContentNode*>(GetObject(Count()-1));
     return EditPaM( pLastNode, pLastNode->Len() );
 }
 
diff --git a/editeng/source/editeng/editdoc2.cxx b/editeng/source/editeng/editdoc2.cxx
index cb3cafd..474e3fa 100644
--- a/editeng/source/editeng/editdoc2.cxx
+++ b/editeng/source/editeng/editdoc2.cxx
@@ -295,37 +295,6 @@ 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)
 {
@@ -410,11 +379,54 @@ size_t ParaPortionList::Count() const
     return maPortions.size();
 }
 
-ContentList::ContentList() : DummyContentList( 0 ), nLastCache(0) {}
+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();
+}
 
-sal_uInt16 ContentList::GetPos(ContentNode* p) const
+void ContentList::Clear()
 {
-    return FastGetPos(GetData(), Count(), p, nLastCache);
+    maContents.clear();
 }
 
 void ParaPortionList::Reset()
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 8a68f08..275a992 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -1881,7 +1881,13 @@ void EditEngine::SetStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pStyle )
     pImpEditEngine->SetStyleSheet( nPara, pStyle );
 }
 
-SfxStyleSheet* EditEngine::GetStyleSheet( sal_uInt16 nPara ) const
+const SfxStyleSheet* EditEngine::GetStyleSheet( sal_uInt16 nPara ) const
+{
+    DBG_CHKTHIS( EditEngine, 0 );
+    return pImpEditEngine->GetStyleSheet( nPara );
+}
+
+SfxStyleSheet* EditEngine::GetStyleSheet( sal_uInt16 nPara )
 {
     DBG_CHKTHIS( EditEngine, 0 );
     return pImpEditEngine->GetStyleSheet( nPara );
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index e066f73..6d78cf5 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 );
 }
 
-SfxStyleSheet* EditView::GetStyleSheet() const
+const SfxStyleSheet* EditView::GetStyleSheet() const
 {
     DBG_CHKTHIS( EditView, 0 );
     DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
@@ -741,10 +741,10 @@ SfxStyleSheet* EditView::GetStyleSheet() const
     sal_uInt16 nStartPara = PIMPEE->GetEditDoc().GetPos( aSel.Min().GetNode() );
     sal_uInt16 nEndPara = PIMPEE->GetEditDoc().GetPos( aSel.Max().GetNode() );
 
-    SfxStyleSheet* pStyle = NULL;
+    const SfxStyleSheet* pStyle = NULL;
     for ( sal_uInt16 n = nStartPara; n <= nEndPara; n++ )
     {
-        SfxStyleSheet* pTmpStyle = PIMPEE->GetStyleSheet( n );
+        const 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 811e96e..273f3f1 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 )
 {
-    sal_Bool bIsWrong = sal_False;
+    bool bIsWrong = 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() );
             }
-            const EditDoc& rDoc = pEditEngine->pImpEditEngine->GetEditDoc();
+            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 3d4aaa0..ec15742 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( ParaPortion* pParaPortion, EditLine* pLine, sal_uInt16 nIndex, sal_Bool bPreferPortionStart = sal_False );
-    long GetPortionXOffset(const ParaPortion* pParaPortion, EditLine* pLine, sal_uInt16 nTextPortion);
+    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;
     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 ) const;
+    EditTextObject*     CreateBinTextObject( EditSelection aSelection, SfxItemPool*, sal_Bool bAllowBigObjects = sal_False, sal_uInt16 nBigObjStart = 0 );
     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( const EditPaM& rPaM, sal_Bool bKeepEndingAttribs = sal_True );
-    EditPaM             ImpInsertParaBreak( const EditSelection& rEditSelection, sal_Bool bKeepEndingAttribs = sal_True );
+    EditPaM             ImpInsertParaBreak( EditPaM& rPaM, bool bKeepEndingAttribs = true );
+    EditPaM             ImpInsertParaBreak( const EditSelection& rEditSelection, bool bKeepEndingAttribs = 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 ) const;
+    sal_uInt32          WriteBin( SvStream& rOutput, EditSelection aSel, sal_Bool bStoreUnicode = sal_False );
 
     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( ContentNode* pNode ) const;
+    inline const ParaPortion* FindParaPortion( const ContentNode* pNode ) const;
     inline ParaPortion* FindParaPortion( ContentNode* pNode );
 
-    ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > CreateTransferable( const EditSelection& rSelection ) const;
+    ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > CreateTransferable( const EditSelection& rSelection );
 
     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;
 
-    sal_Bool            HasParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich ) const;
+    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 ) const;
+    EditSelection ConvertSelection( sal_uInt16 nStartPara, sal_uInt16 nStartPos, sal_uInt16 nEndPara, sal_uInt16 nEndPos );
     inline EPaM             CreateEPaM( const EditPaM& rPaM );
     inline EditPaM          CreateEditPaM( const EPaM& rEPaM );
     inline ESelection       CreateESel( const EditSelection& rSel );
@@ -862,7 +862,8 @@ public:
 
     void                SetStyleSheet( EditSelection aSel, SfxStyleSheet* pStyle );
     void                SetStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pStyle );
-    SfxStyleSheet*      GetStyleSheet( sal_uInt16 nPara ) const;
+    const SfxStyleSheet* GetStyleSheet( sal_uInt16 nPara ) const;
+    SfxStyleSheet* GetStyleSheet( sal_uInt16 nPara );
 
     void                UpdateParagraphsWithStyleSheet( SfxStyleSheet* pStyle );
     void                RemoveStyleFromParagraphs( SfxStyleSheet* pStyle );
@@ -1019,7 +1020,7 @@ public:
 
 inline EPaM ImpEditEngine::CreateEPaM( const EditPaM& rPaM )
 {
-    ContentNode* pNode = rPaM.GetNode();
+    const ContentNode* pNode = rPaM.GetNode();
     return EPaM( aEditDoc.GetPos( pNode ), rPaM.GetIndex() );
 }
 
@@ -1032,8 +1033,8 @@ inline EditPaM ImpEditEngine::CreateEditPaM( const EPaM& rEPaM )
 
 inline ESelection ImpEditEngine::CreateESel( const EditSelection& rSel )
 {
-    ContentNode* pStartNode = rSel.Min().GetNode();
-    ContentNode* pEndNode = rSel.Max().GetNode();
+    const ContentNode* pStartNode = rSel.Min().GetNode();
+    const ContentNode* pEndNode = rSel.Max().GetNode();
     ESelection aESel;
     aESel.nStartPara = aEditDoc.GetPos( pStartNode );
     aESel.nStartPos = rSel.Min().GetIndex();
@@ -1092,7 +1093,7 @@ inline EditUndoManager& ImpEditEngine::GetUndoManager()
     return *pUndoManager;
 }
 
-inline const ParaPortion* ImpEditEngine::FindParaPortion( ContentNode* pNode ) const
+inline const ParaPortion* ImpEditEngine::FindParaPortion( const 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 661d2c1..04cebce 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" );
-        ContentNode* pNode = aEditDoc.GetObject( nNode );
+        const 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!" );
 
-    ParaPortion* pPPortion = FindParaPortion( rPaM.GetNode() );
+    const 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!" );
 
-    ParaPortion* pPPortion = FindParaPortion( rPaM.GetNode() );
+    const 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 )
 {
-    ParaPortion* pCurPortion = FindParaPortion( rPaM.GetNode() );
+    const 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 )
 {
-    ParaPortion* pCurPortion = FindParaPortion( rPaM.GetNode() );
+    const 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,13 +1423,15 @@ EditPaM ImpEditEngine::CursorEndOfLine( const EditPaM& rPaM )
 
 EditPaM ImpEditEngine::CursorStartOfParagraph( const EditPaM& rPaM )
 {
-    EditPaM aPaM( rPaM.GetNode(), 0 );
+    EditPaM aPaM(rPaM);
+    aPaM.SetIndex(0);
     return aPaM;
 }
 
 EditPaM ImpEditEngine::CursorEndOfParagraph( const EditPaM& rPaM )
 {
-    EditPaM aPaM( rPaM.GetNode(), rPaM.GetNode()->Len() );
+    EditPaM aPaM(rPaM);
+    aPaM.SetIndex(rPaM.GetNode()->Len());
     return aPaM;
 }
 
@@ -2207,7 +2209,7 @@ EditSelection ImpEditEngine::ImpMoveParagraphs( Range aOldPositions, sal_uInt16
         aSelection.Max().SetIndex( pTmpPortion->GetNode()->Len() );
 
         ContentNode* pN = pTmpPortion->GetNode();
-        aEditDoc.Insert( pN, nRealNewPos+i );
+        aEditDoc.Insert(nRealNewPos+i, pN);
 
         GetParaPortions().Insert(nRealNewPos+i, pTmpPortion);
     }
@@ -2330,7 +2332,7 @@ EditPaM ImpEditEngine::DeleteLeftOrRight( const EditSelection& rSel, sal_uInt8 n
     if ( rSel.HasRange() )  // only then Delete Selection
         return ImpDeleteSelection( rSel );
 
-    const EditPaM aCurPos( rSel.Max() );
+    EditPaM aCurPos( rSel.Max() );
     EditPaM aDelStart( aCurPos );
     EditPaM aDelEnd( aCurPos );
     if ( nMode == DEL_LEFT )
@@ -2820,7 +2822,7 @@ EditPaM ImpEditEngine::ImpInsertFeature( EditSelection aCurSel, const SfxPoolIte
     return aPaM;
 }
 
-EditPaM ImpEditEngine::ImpInsertParaBreak( const EditSelection& rCurSel, sal_Bool bKeepEndingAttribs )
+EditPaM ImpEditEngine::ImpInsertParaBreak( const EditSelection& rCurSel, bool bKeepEndingAttribs )
 {
     EditPaM aPaM;
     if ( rCurSel.HasRange() )
@@ -2831,7 +2833,7 @@ EditPaM ImpEditEngine::ImpInsertParaBreak( const EditSelection& rCurSel, sal_Boo
     return ImpInsertParaBreak( aPaM, bKeepEndingAttribs );
 }
 
-EditPaM ImpEditEngine::ImpInsertParaBreak( const EditPaM& rPaM, sal_Bool bKeepEndingAttribs )
+EditPaM ImpEditEngine::ImpInsertParaBreak( EditPaM& rPaM, bool bKeepEndingAttribs )
 {
     if ( aEditDoc.Count() >= 0xFFFE )
     {
@@ -2912,7 +2914,7 @@ EditPaM ImpEditEngine::ImpFastInsertParagraph( sal_uInt16 nPara )
     if ( GetStatus().DoOnlineSpelling() )
         pNode->CreateWrongList();
 
-    aEditDoc.Insert( pNode, nPara );
+    aEditDoc.Insert(nPara, pNode);
 
     ParaPortion* pNewPortion = new ParaPortion( pNode );
     GetParaPortions().Insert(nPara, pNewPortion);
@@ -3278,7 +3280,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;
-    ContentNode* pNode = GetEditDoc().SaveGetObject( nPara );
+    const ContentNode* pNode = GetEditDoc().SaveGetObject( nPara );
     OSL_ENSURE( pNode, "GetLineNumberAtIndex: invalid paragraph index" );
     if (pNode)
     {
@@ -3403,8 +3405,8 @@ void ImpEditEngine::UpdateSelections()
     aDeletedNodes.Remove( 0, aDeletedNodes.Count() );
 }
 
-EditSelection ImpEditEngine::ConvertSelection( sal_uInt16 nStartPara, sal_uInt16 nStartPos,
-                             sal_uInt16 nEndPara, sal_uInt16 nEndPos ) const
+EditSelection ImpEditEngine::ConvertSelection(
+    sal_uInt16 nStartPara, sal_uInt16 nStartPos, sal_uInt16 nEndPara, sal_uInt16 nEndPos )
 {
     EditSelection aNewSelection;
 
@@ -3470,7 +3472,7 @@ void ImpEditEngine::SetActiveView( EditView* pView )
     }
 }
 
-uno::Reference< datatransfer::XTransferable > ImpEditEngine::CreateTransferable( const EditSelection& rSelection ) const
+uno::Reference< datatransfer::XTransferable > ImpEditEngine::CreateTransferable( const EditSelection& rSelection )
 {
     EditSelection aSelection( rSelection );
     aSelection.Adjust( GetEditDoc() );
@@ -3851,7 +3853,7 @@ Range ImpEditEngine::GetLineXPosStartEnd( const ParaPortion* pParaPortion, EditL
 }
 
 long ImpEditEngine::GetPortionXOffset(
-    const ParaPortion* pParaPortion, EditLine* pLine, sal_uInt16 nTextPortion)
+    const ParaPortion* pParaPortion, const EditLine* pLine, sal_uInt16 nTextPortion) const
 {
     long nX = pLine->GetStartPosX();
 
@@ -3940,7 +3942,8 @@ long ImpEditEngine::GetPortionXOffset(
     return nX;
 }
 
-long ImpEditEngine::GetXPos( ParaPortion* pParaPortion, EditLine* pLine, sal_uInt16 nIndex, sal_Bool bPreferPortionStart )
+long ImpEditEngine::GetXPos(
+    const ParaPortion* pParaPortion, EditLine* pLine, sal_uInt16 nIndex, bool bPreferPortionStart) const
 {
     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 507c700..14cf4e4 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( pNode, nPos );
+    aEditDoc.Insert(nPos, pNode);
     if ( IsCallParaInsertedOrDeleted() )
         GetEditEnginePtr()->ParagraphInserted( nPos );
 }
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 4bce12f..c5b89fd 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 ) const
+sal_uInt32 ImpEditEngine::WriteBin( SvStream& rOutput, EditSelection aSel, sal_Bool bStoreUnicodeStrings )
 {
     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 ) const
+EditTextObject* ImpEditEngine::CreateBinTextObject( EditSelection aSel, SfxItemPool* pPool, sal_Bool bAllowBigObjects, sal_uInt16 nBigObjectStart )
 {
     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 );
-    EditCharAttrib* pAttr = rPaM.GetNode()->GetCharAttribs().FindAttrib( nLangId, rPaM.GetIndex() );
+    const 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)
             {
-                const TransliterationChgData &rData = aChanges[ aChanges.size() - 1 - i ];
+                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 2401d2c..1310064 100644
--- a/editeng/source/editeng/impedit5.cxx
+++ b/editeng/source/editeng/impedit5.cxx
@@ -46,7 +46,13 @@ void ImpEditEngine::SetStyleSheetPool( SfxStyleSheetPool* pSPool )
     }
 }
 
-SfxStyleSheet* ImpEditEngine::GetStyleSheet( sal_uInt16 nPara ) const
+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 )
 {
     ContentNode* pNode = aEditDoc.SaveGetObject( nPara );
     return pNode ? pNode->GetContentAttribs().GetStyleSheet() : NULL;
@@ -409,7 +415,7 @@ SfxItemSet ImpEditEngine::GetAttribs( sal_uInt16 nPara, sal_uInt16 nStart, sal_u
 
     DBG_CHKOBJ( GetEditEnginePtr(), EditEngine, 0 );
 
-    ContentNode* pNode = aEditDoc.SaveGetObject( nPara );
+    ContentNode* pNode = const_cast<ContentNode*>(aEditDoc.SaveGetObject(nPara));
     DBG_ASSERT( pNode, "GetAttribs - unknown paragraph!" );
     DBG_ASSERT( nStart <= nEnd, "getAttribs: Start > End not supported!" );
 
@@ -426,7 +432,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(), sal_True );
+            aAttribs.Set(pNode->GetStyleSheet()->GetItemSet(), true);
 
         if ( nFlags & GETATTRIBS_PARAATTRIBS )
             aAttribs.Put( pNode->GetContentAttribs().GetItems() );
@@ -720,14 +726,14 @@ void ImpEditEngine::SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet )
 
 const SfxItemSet& ImpEditEngine::GetParaAttribs( sal_uInt16 nPara ) const
 {
-    ContentNode* pNode = aEditDoc.GetObject( nPara );
+    const ContentNode* pNode = aEditDoc.GetObject( nPara );
     DBG_ASSERT( pNode, "Node not found: GetParaAttribs" );
     return pNode->GetContentAttribs().GetItems();
 }
 
-sal_Bool ImpEditEngine::HasParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich ) const
+bool ImpEditEngine::HasParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich ) const
 {
-    ContentNode* pNode = aEditDoc.GetObject( nPara );
+    const ContentNode* pNode = aEditDoc.GetObject( nPara );
     DBG_ASSERT( pNode, "Node not found: HasParaAttrib" );
 
     return pNode->GetContentAttribs().HasItem( nWhich );
@@ -735,7 +741,7 @@ sal_Bool ImpEditEngine::HasParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich ) con
 
 const SfxPoolItem& ImpEditEngine::GetParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich ) const
 {
-    ContentNode* pNode = aEditDoc.GetObject( nPara );
+    const ContentNode* pNode = aEditDoc.GetObject( nPara );
     DBG_ASSERT( pNode, "Node not found: GetParaAttrib" );
 
     return pNode->GetContentAttribs().GetItem( nWhich );
@@ -744,7 +750,7 @@ const SfxPoolItem& ImpEditEngine::GetParaAttrib( sal_uInt16 nPara, sal_uInt16 nW
 void ImpEditEngine::GetCharAttribs( sal_uInt16 nPara, std::vector<EECharAttrib>& rLst ) const
 {
     rLst.clear();
-    ContentNode* pNode = aEditDoc.GetObject( nPara );
+    const 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 e1edd39..26f0494 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -780,7 +780,7 @@ void OutlinerView::CreateSelectionList (std::vector<Paragraph*> &aSelList)
     }
 }
 
-SfxStyleSheet* OutlinerView::GetStyleSheet() const
+const SfxStyleSheet* OutlinerView::GetStyleSheet() const
 {
     DBG_CHKTHIS(OutlinerView,0);
     return pEditView->GetStyleSheet();


More information about the Libreoffice-commits mailing list