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

Kohei Yoshida kohei at kemper.freedesktop.org
Mon Apr 9 08:05:49 PDT 2012


 editeng/inc/editeng/editobj.hxx     |   18 -
 editeng/source/editeng/editobj.cxx  |  500 +++++++++++++++++-------------------
 editeng/source/editeng/editobj2.hxx |   42 +--
 editeng/source/editeng/impedit4.cxx |    6 
 4 files changed, 281 insertions(+), 285 deletions(-)

New commits:
commit 5d2b0f25f14c33c00cbf31d16e50bc9e00d60f06
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Sun Apr 8 13:30:09 2012 -0400

    Killed Another instance of svarray.

diff --git a/editeng/inc/editeng/editobj.hxx b/editeng/inc/editeng/editobj.hxx
index e3c9340..b495efb 100644
--- a/editeng/inc/editeng/editobj.hxx
+++ b/editeng/inc/editeng/editobj.hxx
@@ -85,12 +85,12 @@ public:
     static EditTextObject*  Create( SvStream& rIStream,
                                 SfxItemPool* pGlobalTextObjectPool = 0 );
 
-    virtual sal_uInt16      GetParagraphCount() const;
+    virtual size_t GetParagraphCount() const;
 
-    virtual XubString   GetText( sal_uInt16 nParagraph ) const;
-    virtual void        Insert( const EditTextObject& rObj, sal_uInt16 nPara );
-    virtual void        RemoveParagraph( sal_uInt16 nPara );
-    virtual EditTextObject* CreateTextObject( sal_uInt16 nPara, sal_uInt16 nParas = 1 ) const;
+    virtual String GetText(size_t nParagraph) const;
+    virtual void Insert(const EditTextObject& rObj, size_t nPara);
+    virtual void RemoveParagraph(size_t nPara);
+    virtual EditTextObject* CreateTextObject(size_t nPara, size_t nParas = 1) const;
 
     virtual sal_Bool        HasPortionInfo() const;
     virtual void        ClearPortionInfo();
@@ -109,12 +109,12 @@ public:
     virtual const SvxFieldItem* GetField() const;
     virtual sal_Bool        HasField( TypeId aType = NULL ) const;
 
-    virtual SfxItemSet  GetParaAttribs( sal_uInt16 nPara ) const;
-    virtual void        SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rAttribs );
+    virtual SfxItemSet GetParaAttribs(size_t nPara) const;
+    virtual void SetParaAttribs(size_t nPara, const SfxItemSet& rAttribs);
 
     virtual sal_Bool        HasStyleSheet( const XubString& rName, SfxStyleFamily eFamily ) const;
-    virtual void        GetStyleSheet( sal_uInt16 nPara, XubString& rName, SfxStyleFamily& eFamily ) const;
-    virtual void        SetStyleSheet( sal_uInt16 nPara, const XubString& rName, const SfxStyleFamily& eFamily );
+    virtual void GetStyleSheet(size_t nPara, String& rName, SfxStyleFamily& eFamily) const;
+    virtual void SetStyleSheet(size_t nPara, const String& rName, const SfxStyleFamily& eFamily);
     virtual sal_Bool        ChangeStyleSheets(  const XubString& rOldName, SfxStyleFamily eOldFamily,
                                             const XubString& rNewName, SfxStyleFamily eNewFamily );
     virtual void        ChangeStyleSheetName( SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName );
diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx
index a404533..67099ba 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -168,6 +168,11 @@ bool ContentInfo::operator==( const ContentInfo& rCompare ) const
     return false;
 }
 
+bool ContentInfo::operator!=(const ContentInfo& rCompare) const
+{
+    return !operator==(rCompare);
+}
+
 EditTextObject::EditTextObject( sal_uInt16 n)
 {
     DBG_CTOR( EE_EditTextObject, 0 );
@@ -185,30 +190,30 @@ EditTextObject::~EditTextObject()
     DBG_DTOR( EE_EditTextObject, 0 );
 }
 
-sal_uInt16 EditTextObject::GetParagraphCount() const
+size_t EditTextObject::GetParagraphCount() const
 {
     OSL_FAIL( "Virtual method direct from EditTextObject!" );
     return 0;
 }
 
-XubString EditTextObject::GetText( sal_uInt16 /* nParagraph */ ) const
+String EditTextObject::GetText(size_t /* nParagraph */) const
 {
     OSL_FAIL( "Virtual method direct from EditTextObject!" );
-    return XubString();
+    return String();
 }
 
-void EditTextObject::Insert( const EditTextObject& /* rObj */, sal_uInt16 /* nPara */)
+void EditTextObject::Insert(const EditTextObject& /* rObj */, size_t /* nPara */)
 {
     OSL_FAIL( "Virtual method direct from EditTextObject!" );
 }
 
-EditTextObject* EditTextObject::CreateTextObject( sal_uInt16 /*nPara*/, sal_uInt16 /*nParas*/ ) const
+EditTextObject* EditTextObject::CreateTextObject(size_t /*nPara*/, size_t /*nParas*/) const
 {
     OSL_FAIL( "Virtual method direct from EditTextObject!" );
     return 0;
 }
 
-void EditTextObject::RemoveParagraph( sal_uInt16 /*nPara*/ )
+void EditTextObject::RemoveParagraph(size_t /*nPara*/)
 {
     OSL_FAIL( "Virtual method direct from EditTextObject!" );
 }
@@ -264,13 +269,13 @@ sal_Bool EditTextObject::HasField( TypeId /*aType*/ ) const
     return false;
 }
 
-SfxItemSet EditTextObject::GetParaAttribs( sal_uInt16 /*nPara*/ ) const
+SfxItemSet EditTextObject::GetParaAttribs(size_t /*nPara*/) const
 {
     OSL_FAIL( "Virtual method direct from EditTextObject!" );
     return SfxItemSet( *(SfxItemPool*)NULL );
 }
 
-void EditTextObject::SetParaAttribs( sal_uInt16 /*nPara*/, const SfxItemSet& /*rAttribs*/ )
+void EditTextObject::SetParaAttribs(size_t /*nPara*/, const SfxItemSet& /*rAttribs*/)
 {
     OSL_FAIL( "Virtual method direct from EditTextObject!" );
 }
@@ -293,12 +298,12 @@ sal_Bool EditTextObject::HasStyleSheet( const XubString& /*rName*/, SfxStyleFami
     return false;
 }
 
-void EditTextObject::GetStyleSheet( sal_uInt16 /*nPara*/, XubString& /*rName*/, SfxStyleFamily& /*eFamily*/ ) const
+void EditTextObject::GetStyleSheet(size_t /*nPara*/, String& /*rName*/, SfxStyleFamily& /*eFamily*/) const
 {
     OSL_FAIL( "Virtual method direct from EditTextObject!" );
 }
 
-void EditTextObject::SetStyleSheet( sal_uInt16 /*nPara*/, const XubString& /*rName*/, const SfxStyleFamily& /*eFamily*/ )
+void EditTextObject::SetStyleSheet(size_t /*nPara*/, const String& /*rName*/, const SfxStyleFamily& /*eFamily*/)
 {
     OSL_FAIL( "Virtual method direct from EditTextObject!" );
 }
@@ -461,16 +466,12 @@ void BinTextObject::ObjectInDestruction(const SfxItemPool& rSfxItemPool)
             pNewPool->SetDefaultMetric(pPool->GetMetric(DEF_METRIC));
         }
 
-        for(sal_uInt16 n(0); n < aContents.Count(); n++)
-        {
-            // clone ContentInfos for new pool
-            ContentInfo* pOrg = aContents.GetObject(n);
-            DBG_ASSERT(pOrg, "NULL-Pointer in ContentList!");
-
-            ContentInfo* pNew = new ContentInfo(*pOrg, *pNewPool);
-            aContents.Replace(pNew, n);
-            delete pOrg;
-        }
+        ContentInfosType aReplaced;
+        aReplaced.reserve(aContents.size());
+        ContentInfosType::const_iterator it = aContents.begin(), itEnd = aContents.end();
+        for (; it != itEnd; ++it)
+            aReplaced.push_back(new ContentInfo(*it, *pNewPool));
+        aReplaced.swap(aContents);
 
         // set local variables
         pPool = pNewPool;
@@ -571,13 +572,10 @@ BinTextObject::BinTextObject( const BinTextObject& r ) :
     if ( bOwnerOfPool && pPool && r.pPool )
         pPool->SetDefaultMetric( r.pPool->GetMetric( DEF_METRIC ) );
 
-    for ( sal_uInt16 n = 0; n < r.aContents.Count(); n++ )
-    {
-        ContentInfo* pOrg = r.aContents.GetObject( n );
-        DBG_ASSERT( pOrg, "NULL-Pointer in ContentList!" );
-        ContentInfo* pNew = new ContentInfo( *pOrg, *pPool );
-        aContents.Insert( pNew, aContents.Count() );
-    }
+    aContents.reserve(r.aContents.size());
+    ContentInfosType::const_iterator it = r.aContents.begin(), itEnd = r.aContents.end();
+    for (; it != itEnd; ++it)
+        aContents.push_back(new ContentInfo(*it, *pPool));
 }
 
 BinTextObject::~BinTextObject()
@@ -588,7 +586,10 @@ BinTextObject::~BinTextObject()
     }
 
     ClearPortionInfo();
-    DeleteContents();
+
+    // Remove contents before deleting the pool instance since each content
+    // has to access the pool instance in its destructor.
+    aContents.clear();
     if ( bOwnerOfPool )
     {
         SfxItemPool::Free(pPool);
@@ -639,18 +640,6 @@ void BinTextObject::SetScriptType( sal_uInt16 nType )
     nScriptType = nType;
 }
 
-
-void BinTextObject::DeleteContents()
-{
-    for ( sal_uInt16 n = 0; n < aContents.Count(); n++ )
-    {
-        ContentInfo* p = aContents.GetObject( n );
-        DBG_ASSERT( p, "NULL-Pointer in ContentList!" );
-        delete p;
-    }
-    aContents.Remove( 0, aContents.Count() );
-}
-
 EditTextObject* BinTextObject::Clone() const
 {
     return new BinTextObject( *this );
@@ -667,51 +656,59 @@ void BinTextObject::DestroyAttrib( XEditAttribute* pAttr )
     delete pAttr;
 }
 
+BinTextObject::ContentInfosType& BinTextObject::GetContents()
+{
+    return aContents;
+}
+
+const BinTextObject::ContentInfosType& BinTextObject::GetContents() const
+{
+    return aContents;
+}
+
 ContentInfo* BinTextObject::CreateAndInsertContent()
 {
-    ContentInfo* pC = new ContentInfo( *pPool );
-    aContents.Insert( pC, aContents.Count() );
-    return pC;
+    aContents.push_back(new ContentInfo(*pPool));
+    return &aContents.back();
 }
 
-sal_uInt16 BinTextObject::GetParagraphCount() const
+size_t BinTextObject::GetParagraphCount() const
 {
-    return aContents.Count();
+    return aContents.size();
 }
 
-XubString BinTextObject::GetText( sal_uInt16 nPara ) const
+String BinTextObject::GetText(size_t nPara) const
 {
-    DBG_ASSERT( nPara < aContents.Count(), "BinTextObject::GetText: Paragraph does not exist!" );
-    if ( nPara < aContents.Count() )
-    {
-        ContentInfo* pC = aContents[ nPara ];
-        return pC->GetText();
-    }
-    return XubString();
+    if (nPara >= aContents.size())
+        return String();
+
+    return aContents[nPara].GetText();
 }
 
-void BinTextObject::Insert( const EditTextObject& rObj, sal_uInt16 nDestPara )
+void BinTextObject::Insert(const EditTextObject& rObj, size_t nDestPara)
 {
     DBG_ASSERT( rObj.Which() == EE_FORMAT_BIN, "UTO: unknown Textobjekt" );
 
     const BinTextObject& rBinObj = (const BinTextObject&)rObj;
 
-    if ( nDestPara > aContents.Count() )
-        nDestPara = aContents.Count();
+    if (nDestPara > aContents.size())
+        nDestPara = aContents.size();
 
-    const sal_uInt16 nParas = rBinObj.GetContents().Count();
-    for ( sal_uInt16 nP = 0; nP < nParas; nP++ )
+    const ContentInfosType& rCIs = rBinObj.aContents;
+    for (size_t i = 0, n = rCIs.size(); i < n; ++i)
     {
-        ContentInfo* pC = rBinObj.GetContents()[ nP ];
-        ContentInfo* pNew = new ContentInfo( *pC, *GetPool() );
-        aContents.Insert( pNew, nDestPara+nP );
+        const ContentInfo& rC = rCIs[i];
+        size_t nPos = nDestPara + i;
+        aContents.insert(
+            aContents.begin()+nPos, new ContentInfo(rC, *GetPool()));
     }
+
     ClearPortionInfo();
 }
 
-EditTextObject* BinTextObject::CreateTextObject( sal_uInt16 nPara, sal_uInt16 nParas ) const
+EditTextObject* BinTextObject::CreateTextObject(size_t nPara, size_t nParas) const
 {
-    if ( ( nPara >= aContents.Count() ) || !nParas )
+    if (nPara >= aContents.size() || !nParas)
         return NULL;
 
     // Only split the Pool, when a the Pool is set externally.
@@ -723,26 +720,26 @@ EditTextObject* BinTextObject::CreateTextObject( sal_uInt16 nPara, sal_uInt16 nP
     // If text contains different ScriptTypes, this shouldn't be a problem...
     pObj->nScriptType = nScriptType;
 
-    const sal_uInt16 nEndPara = nPara+nParas-1;
-    for ( sal_uInt16 nP = nPara; nP <= nEndPara; nP++ )
+    const size_t nEndPara = nPara+nParas-1;
+    for (size_t i = nPara; i <= nEndPara; ++i)
     {
-        ContentInfo* pC = aContents[ nP ];
-        ContentInfo* pNew = new ContentInfo( *pC, *pObj->GetPool() );
-        pObj->GetContents().Insert( pNew, pObj->GetContents().Count() );
+        const ContentInfo& rC = aContents[i];
+        ContentInfo* pNew = new ContentInfo(rC, *pObj->GetPool());
+        pObj->aContents.push_back(pNew);
     }
     return pObj;
 }
 
-void BinTextObject::RemoveParagraph( sal_uInt16 nPara )
+void BinTextObject::RemoveParagraph(size_t nPara)
 {
-    DBG_ASSERT( nPara < aContents.Count(), "BinTextObject::GetText: Paragraph does not exist!" );
-    if ( nPara < aContents.Count() )
-    {
-        ContentInfo* pC = aContents[ nPara ];
-        aContents.Remove( nPara );
-        delete pC;
-        ClearPortionInfo();
-    }
+    DBG_ASSERT( nPara < aContents.size(), "BinTextObject::GetText: Paragraph does not exist!" );
+    if (nPara >= aContents.size())
+        return;
+
+    ContentInfosType::iterator it = aContents.begin();
+    std::advance(it, nPara);
+    aContents.erase(it);
+    ClearPortionInfo();
 }
 
 sal_Bool BinTextObject::HasPortionInfo() const
@@ -763,29 +760,28 @@ void BinTextObject::ClearPortionInfo()
 
 sal_Bool BinTextObject::HasOnlineSpellErrors() const
 {
-    for ( sal_uInt16 n = 0; n < aContents.Count(); n++ )
+    ContentInfosType::const_iterator it = aContents.begin(), itEnd = aContents.end();
+    for (; it != itEnd; ++it)
     {
-        ContentInfo* p = aContents.GetObject( n );
-        if ( p->GetWrongList() && !p->GetWrongList()->empty() )
+        if ( it->GetWrongList() && !it->GetWrongList()->empty() )
             return true;
     }
     return false;
-
 }
 
 sal_Bool BinTextObject::HasCharAttribs( sal_uInt16 _nWhich ) const
 {
-    for ( sal_uInt16 nPara = GetContents().Count(); nPara; )
+    for (size_t nPara = aContents.size(); nPara; )
     {
-        ContentInfo* pC = GetContents().GetObject( --nPara );
+        const ContentInfo& rC = aContents[--nPara];
 
-        sal_uInt16 nAttribs = pC->GetAttribs().Count();
+        sal_uInt16 nAttribs = rC.GetAttribs().Count();
         if ( nAttribs && !_nWhich )
             return true;
 
         for ( sal_uInt16 nAttr = nAttribs; nAttr; )
         {
-            XEditAttribute* pX = pC->GetAttribs().GetObject( --nAttr );
+            XEditAttribute* pX = rC.GetAttribs().GetObject( --nAttr );
             if ( pX->GetItem()->Which() == _nWhich )
                 return true;
         }
@@ -796,36 +792,33 @@ sal_Bool BinTextObject::HasCharAttribs( sal_uInt16 _nWhich ) const
 void BinTextObject::GetCharAttribs( sal_uInt16 nPara, std::vector<EECharAttrib>& rLst ) const
 {
     rLst.clear();
-    ContentInfo* pC = GetContents().GetObject( nPara );
-    if ( pC )
+    const ContentInfo& rC = aContents[nPara];
+    for ( sal_uInt16 nAttr = 0; nAttr < rC.GetAttribs().Count(); nAttr++ )
     {
-        for ( sal_uInt16 nAttr = 0; nAttr < pC->GetAttribs().Count(); nAttr++ )
-        {
-            XEditAttribute* pAttr = pC->GetAttribs().GetObject( nAttr );
-            EECharAttrib aEEAttr;
-            aEEAttr.pAttr = pAttr->GetItem();
-            aEEAttr.nPara = nPara;
-            aEEAttr.nStart = pAttr->GetStart();
-            aEEAttr.nEnd = pAttr->GetEnd();
-            rLst.push_back(aEEAttr);
-        }
+        XEditAttribute* pAttr = rC.GetAttribs().GetObject( nAttr );
+        EECharAttrib aEEAttr;
+        aEEAttr.pAttr = pAttr->GetItem();
+        aEEAttr.nPara = nPara;
+        aEEAttr.nStart = pAttr->GetStart();
+        aEEAttr.nEnd = pAttr->GetEnd();
+        rLst.push_back(aEEAttr);
     }
 }
 
 void BinTextObject::MergeParaAttribs( const SfxItemSet& rAttribs, sal_uInt16 nStart, sal_uInt16 nEnd )
 {
-    sal_Bool bChanged = false;
+    bool bChanged = false;
 
-    for ( sal_uInt16 nPara = GetContents().Count(); nPara; )
+    for (size_t nPara = aContents.size(); nPara; )
     {
-        ContentInfo* pC = GetContents().GetObject( --nPara );
+        ContentInfo& rC = aContents[--nPara];
 
         for ( sal_uInt16 nW = nStart; nW <= nEnd; nW++ )
         {
-            if ( ( pC->GetParaAttribs().GetItemState( nW, false ) != SFX_ITEM_ON )
+            if ( ( rC.GetParaAttribs().GetItemState( nW, false ) != SFX_ITEM_ON )
                     && ( rAttribs.GetItemState( nW, false ) == SFX_ITEM_ON ) )
             {
-                pC->GetParaAttribs().Put( rAttribs.Get( nW ) );
+                rC.GetParaAttribs().Put( rAttribs.Get( nW ) );
                 bChanged = true;
             }
         }
@@ -842,15 +835,15 @@ sal_Bool BinTextObject::IsFieldObject() const
 
 const SvxFieldItem* BinTextObject::GetField() const
 {
-    if ( GetContents().Count() == 1 )
+    if (aContents.size() == 1)
     {
-        ContentInfo* pC = GetContents()[0];
-        if ( pC->GetText().Len() == 1 )
+        const ContentInfo& rC = aContents[0];
+        if (rC.GetText().Len() == 1)
         {
-            sal_uInt16 nAttribs = pC->GetAttribs().Count();
+            sal_uInt16 nAttribs = rC.GetAttribs().Count();
             for ( sal_uInt16 nAttr = nAttribs; nAttr; )
             {
-                XEditAttribute* pX = pC->GetAttribs().GetObject( --nAttr );
+                XEditAttribute* pX = rC.GetAttribs().GetObject( --nAttr );
                 if ( pX->GetItem()->Which() == EE_FEATURE_FIELD )
                     return (const SvxFieldItem*)pX->GetItem();
             }
@@ -861,14 +854,14 @@ const SvxFieldItem* BinTextObject::GetField() const
 
 sal_Bool BinTextObject::HasField( TypeId aType ) const
 {
-    sal_uInt16 nParagraphs = GetContents().Count();
-    for ( sal_uInt16 nPara = 0; nPara < nParagraphs; nPara++ )
+    size_t nParagraphs = aContents.size();
+    for (size_t nPara = 0; nPara < nParagraphs; ++nPara)
     {
-        ContentInfo* pC = GetContents().GetObject( nPara );
-        sal_uInt16 nAttrs = pC->GetAttribs().Count();
+        const ContentInfo& rC = aContents[nPara];
+        sal_uInt16 nAttrs = rC.GetAttribs().Count();
         for ( sal_uInt16 nAttr = 0; nAttr < nAttrs; nAttr++ )
         {
-            XEditAttribute* pAttr = pC->GetAttribs()[nAttr];
+            XEditAttribute* pAttr = rC.GetAttribs()[nAttr];
             if ( pAttr->GetItem()->Which() == EE_FEATURE_FIELD )
             {
                 if ( !aType )
@@ -883,16 +876,16 @@ sal_Bool BinTextObject::HasField( TypeId aType ) const
     return false;
 }
 
-SfxItemSet BinTextObject::GetParaAttribs( sal_uInt16 nPara ) const
+SfxItemSet BinTextObject::GetParaAttribs(size_t nPara) const
 {
-    ContentInfo* pC = GetContents().GetObject( nPara );
-    return pC->GetParaAttribs();
+    const ContentInfo& rC = aContents[nPara];
+    return rC.GetParaAttribs();
 }
 
-void BinTextObject::SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rAttribs )
+void BinTextObject::SetParaAttribs(size_t nPara, const SfxItemSet& rAttribs)
 {
-    ContentInfo* pC = GetContents().GetObject( nPara );
-    pC->GetParaAttribs().Set( rAttribs );
+    ContentInfo& rC = aContents[nPara];
+    rC.GetParaAttribs().Set(rAttribs);
     ClearPortionInfo();
 }
 
@@ -900,16 +893,16 @@ sal_Bool BinTextObject::RemoveCharAttribs( sal_uInt16 _nWhich )
 {
     sal_Bool bChanged = false;
 
-    for ( sal_uInt16 nPara = GetContents().Count(); nPara; )
+    for ( sal_uInt16 nPara = aContents.size(); nPara; )
     {
-        ContentInfo* pC = GetContents().GetObject( --nPara );
+        ContentInfo& rC = aContents[--nPara];
 
-        for ( sal_uInt16 nAttr = pC->GetAttribs().Count(); nAttr; )
+        for ( sal_uInt16 nAttr = rC.GetAttribs().Count(); nAttr; )
         {
-            XEditAttribute* pAttr = pC->GetAttribs().GetObject( --nAttr );
+            XEditAttribute* pAttr = rC.GetAttribs().GetObject( --nAttr );
             if ( !_nWhich || ( pAttr->GetItem()->Which() == _nWhich ) )
             {
-                pC->GetAttribs().Remove( nAttr );
+                rC.GetAttribs().Remove( nAttr );
                 DestroyAttrib( pAttr );
                 bChanged = true;
             }
@@ -924,23 +917,23 @@ sal_Bool BinTextObject::RemoveCharAttribs( sal_uInt16 _nWhich )
 
 sal_Bool BinTextObject::RemoveParaAttribs( sal_uInt16 _nWhich )
 {
-    sal_Bool bChanged = false;
+    bool bChanged = false;
 
-    for ( sal_uInt16 nPara = GetContents().Count(); nPara; )
+    for (size_t nPara = aContents.size(); nPara; )
     {
-        ContentInfo* pC = GetContents().GetObject( --nPara );
+        ContentInfo& rC = aContents[--nPara];
 
         if ( !_nWhich )
         {
-            if( pC->GetParaAttribs().Count() )
+            if (rC.GetParaAttribs().Count())
                 bChanged = true;
-            pC->GetParaAttribs().ClearItem();
+            rC.GetParaAttribs().ClearItem();
         }
         else
         {
-            if ( pC->GetParaAttribs().GetItemState( _nWhich ) == SFX_ITEM_ON )
+            if (rC.GetParaAttribs().GetItemState(_nWhich) == SFX_ITEM_ON)
             {
-                pC->GetParaAttribs().ClearItem( _nWhich );
+                rC.GetParaAttribs().ClearItem(_nWhich);
                 bChanged = true;
             }
         }
@@ -954,52 +947,52 @@ sal_Bool BinTextObject::RemoveParaAttribs( sal_uInt16 _nWhich )
 
 sal_Bool BinTextObject::HasStyleSheet( const XubString& rName, SfxStyleFamily eFamily ) const
 {
-    sal_uInt16 nParagraphs = GetContents().Count();
-    for ( sal_uInt16 nPara = 0; nPara < nParagraphs; nPara++ )
+    size_t nParagraphs = aContents.size();
+    for (size_t nPara = 0; nPara < nParagraphs; ++nPara)
     {
-        ContentInfo* pC = GetContents().GetObject( nPara );
-        if ( ( pC->GetFamily() == eFamily ) && ( pC->GetStyle() == rName ) )
+        const ContentInfo& rC = aContents[nPara];
+        if (rC.GetFamily() == eFamily && rC.GetStyle() == rName)
             return true;
     }
     return false;
 }
 
-void BinTextObject::GetStyleSheet( sal_uInt16 nPara, XubString& rName, SfxStyleFamily& rFamily ) const
+void BinTextObject::GetStyleSheet(size_t nPara, String& rName, SfxStyleFamily& rFamily) const
 {
-    if ( nPara < aContents.Count() )
-    {
-        ContentInfo* pC = aContents[ nPara ];
-        rName = pC->GetStyle();
-        rFamily = pC->GetFamily();
-    }
+    if (nPara >= aContents.size())
+        return;
+
+    const ContentInfo& rC = aContents[nPara];
+    rName = rC.GetStyle();
+    rFamily = rC.GetFamily();
 }
 
-void BinTextObject::SetStyleSheet( sal_uInt16 nPara, const XubString& rName, const SfxStyleFamily& rFamily )
+void BinTextObject::SetStyleSheet(size_t nPara, const String& rName, const SfxStyleFamily& rFamily)
 {
-    if ( nPara < aContents.Count() )
-    {
-        ContentInfo* pC = aContents[ nPara ];
-        pC->GetStyle() = rName;
-        pC->GetFamily() = rFamily;
-    }
+    if (nPara >= aContents.size())
+        return;
+
+    ContentInfo& rC = aContents[nPara];
+    rC.GetStyle() = rName;
+    rC.GetFamily() = rFamily;
 }
 
 sal_Bool BinTextObject::ImpChangeStyleSheets(
                     const XubString& rOldName, SfxStyleFamily eOldFamily,
                     const XubString& rNewName, SfxStyleFamily eNewFamily )
 {
-    const sal_uInt16 nParagraphs = GetContents().Count();
-    sal_Bool bChanges = false;
+    const size_t nParagraphs = aContents.size();
+    bool bChanges = false;
 
-    for ( sal_uInt16 nPara = 0; nPara < nParagraphs; nPara++ )
+    for (size_t nPara = 0; nPara < nParagraphs; ++nPara)
     {
-        ContentInfo* pC = GetContents().GetObject( nPara );
-        if ( pC->GetFamily() == eOldFamily )
+        ContentInfo& rC = aContents[nPara];
+        if ( rC.GetFamily() == eOldFamily )
         {
-            if ( pC->GetStyle() == rOldName )
+            if ( rC.GetStyle() == rOldName )
             {
-                pC->GetStyle() = rNewName;
-                pC->GetFamily() = eNewFamily;
+                rC.GetStyle() = rNewName;
+                rC.GetFamily() = eNewFamily;
                 bChanges = true;
             }
         }
@@ -1043,34 +1036,34 @@ void BinTextObject::StoreData( SvStream& rOStream ) const
     rOStream << (sal_uInt16) eEncoding;
 
     // The number of paragraphs ...
-    sal_uInt16 nParagraphs = GetContents().Count();
-    rOStream << nParagraphs;
+    size_t nParagraphs = aContents.size();
+    rOStream << static_cast<sal_uInt16>(nParagraphs);
 
     sal_Unicode nUniChar = CH_FEATURE;
     char cFeatureConverted = rtl::OString(&nUniChar, 1, eEncoding).toChar();
 
     // The individual paragraphs ...
-    for ( sal_uInt16 nPara = 0; nPara < nParagraphs; nPara++ )
+    for (size_t nPara = 0; nPara < nParagraphs; ++nPara)
     {
-        ContentInfo* pC = GetContents().GetObject( nPara );
+        const ContentInfo& rC = aContents[nPara];
 
         // Text...
-        rtl::OStringBuffer aBuffer(rtl::OUStringToOString(pC->GetText(), eEncoding));
+        rtl::OStringBuffer aBuffer(rtl::OUStringToOString(rC.GetText(), eEncoding));
 
         // Symbols?
-        sal_Bool bSymbolPara = false;
-        if ( pC->GetParaAttribs().GetItemState( EE_CHAR_FONTINFO ) == SFX_ITEM_ON )
+        bool bSymbolPara = false;
+        if (rC.GetParaAttribs().GetItemState( EE_CHAR_FONTINFO ) == SFX_ITEM_ON)
         {
-            const SvxFontItem& rFontItem = (const SvxFontItem&)pC->GetParaAttribs().Get( EE_CHAR_FONTINFO );
+            const SvxFontItem& rFontItem = (const SvxFontItem&)rC.GetParaAttribs().Get(EE_CHAR_FONTINFO);
             if ( rFontItem.GetCharSet() == RTL_TEXTENCODING_SYMBOL )
             {
-                aBuffer = rtl::OStringBuffer(rtl::OUStringToOString(pC->GetText(), RTL_TEXTENCODING_SYMBOL));
+                aBuffer = rtl::OStringBuffer(rtl::OUStringToOString(rC.GetText(), RTL_TEXTENCODING_SYMBOL));
                 bSymbolPara = true;
             }
         }
-        for ( sal_uInt16 nA = 0; nA < pC->GetAttribs().Count(); nA++ )
+        for ( sal_uInt16 nA = 0; nA < rC.GetAttribs().Count(); nA++ )
         {
-            XEditAttribute* pAttr = pC->GetAttribs().GetObject( nA );
+            XEditAttribute* pAttr = rC.GetAttribs().GetObject( nA );
 
             if ( pAttr->GetItem()->Which() == EE_CHAR_FONTINFO )
             {
@@ -1079,7 +1072,7 @@ void BinTextObject::StoreData( SvStream& rOStream ) const
                       || ( bSymbolPara && ( rFontItem.GetCharSet() != RTL_TEXTENCODING_SYMBOL ) ) )
                 {
                     // Not correctly converted
-                    String aPart( pC->GetText(), pAttr->GetStart(), pAttr->GetEnd() - pAttr->GetStart() );
+                    String aPart( rC.GetText(), pAttr->GetStart(), pAttr->GetEnd() - pAttr->GetStart() );
                     rtl::OString aNew(rtl::OUStringToOString(aPart, rFontItem.GetCharSet()));
                     aBuffer.remove(pAttr->GetStart(), pAttr->GetEnd() - pAttr->GetStart());
                     aBuffer.insert(pAttr->GetStart(), aNew);
@@ -1093,7 +1086,7 @@ void BinTextObject::StoreData( SvStream& rOStream ) const
                     // SvxFontItem::Store() to store StarBats instead of StarSymbol!
                     for ( sal_uInt16 nChar = pAttr->GetStart(); nChar < pAttr->GetEnd(); nChar++ )
                     {
-                        sal_Unicode cOld = pC->GetText().GetChar( nChar );
+                        sal_Unicode cOld = rC.GetText().GetChar( nChar );
                         char cConv = rtl::OUStringToOString(rtl::OUString(ConvertFontToSubsFontChar(hConv, cOld)), RTL_TEXTENCODING_SYMBOL).toChar();
                         if ( cConv )
                             aBuffer[nChar] = cConv;
@@ -1108,17 +1101,17 @@ void BinTextObject::StoreData( SvStream& rOStream ) const
         // StarSymbol as paragraph attribute or in StyleSheet?
 
         FontToSubsFontConverter hConv = NULL;
-        if ( pC->GetParaAttribs().GetItemState( EE_CHAR_FONTINFO ) == SFX_ITEM_ON )
+        if (rC.GetParaAttribs().GetItemState( EE_CHAR_FONTINFO ) == SFX_ITEM_ON)
         {
-            hConv = CreateFontToSubsFontConverter( ((const SvxFontItem&)pC->GetParaAttribs().Get( EE_CHAR_FONTINFO )).GetFamilyName(), FONTTOSUBSFONT_EXPORT | FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS );
+            hConv = CreateFontToSubsFontConverter( ((const SvxFontItem&)rC.GetParaAttribs().Get( EE_CHAR_FONTINFO )).GetFamilyName(), FONTTOSUBSFONT_EXPORT | FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS );
         }
         if ( hConv )
         {
-            for ( sal_uInt16 nChar = 0; nChar < pC->GetText().Len(); nChar++ )
+            for ( sal_uInt16 nChar = 0; nChar < rC.GetText().Len(); nChar++ )
             {
-                if ( !pC->GetAttribs().FindAttrib( EE_CHAR_FONTINFO, nChar ) )
+                if ( !rC.GetAttribs().FindAttrib( EE_CHAR_FONTINFO, nChar ) )
                 {
-                    sal_Unicode cOld = pC->GetText().GetChar( nChar );
+                    sal_Unicode cOld = rC.GetText().GetChar( nChar );
                     char cConv = rtl::OUStringToOString(rtl::OUString(ConvertFontToSubsFontChar(hConv, cOld)), RTL_TEXTENCODING_SYMBOL).toChar();
                     if ( cConv )
                         aBuffer[nChar] = cConv;
@@ -1135,14 +1128,14 @@ void BinTextObject::StoreData( SvStream& rOStream ) const
         write_lenPrefixed_uInt8s_FromOString<sal_uInt16>(rOStream, aText);
 
         // StyleName and Family...
-        write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rOStream, pC->GetStyle(), eEncoding);
-        rOStream << (sal_uInt16)pC->GetFamily();
+        write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rOStream, rC.GetStyle(), eEncoding);
+        rOStream << static_cast<sal_uInt16>(rC.GetFamily());
 
         // Paragraph attributes ...
-        pC->GetParaAttribs().Store( rOStream );
+        rC.GetParaAttribs().Store( rOStream );
 
         // The number of attributes ...
-        sal_uInt16 nAttribs = pC->GetAttribs().Count();
+        sal_uInt16 nAttribs = rC.GetAttribs().Count();
         rOStream << nAttribs;
 
         // And the individual attributes
@@ -1150,7 +1143,7 @@ void BinTextObject::StoreData( SvStream& rOStream ) const
         // Which = 2; Surregat = 2; Start = 2; End = 2;
         for ( sal_uInt16 nAttr = 0; nAttr < nAttribs; nAttr++ )
         {
-            XEditAttribute* pX = pC->GetAttribs().GetObject( nAttr );
+            XEditAttribute* pX = rC.GetAttribs().GetObject( nAttr );
 
             rOStream << pX->GetItem()->Which();
             GetPool()->StoreSurrogate( rOStream, pX->GetItem() );
@@ -1172,17 +1165,17 @@ void BinTextObject::StoreData( SvStream& rOStream ) const
     {
         for ( sal_uInt16 nPara = 0; nPara < nParagraphs; nPara++ )
         {
-            ContentInfo* pC = GetContents().GetObject( nPara );
-            sal_uInt16 nL = pC->GetText().Len();
+            const ContentInfo& rC = aContents[nPara];
+            sal_uInt16 nL = rC.GetText().Len();
             rOStream << nL;
-            rOStream.Write( pC->GetText().GetBuffer(), nL*sizeof(sal_Unicode) );
+            rOStream.Write(rC.GetText().GetBuffer(), nL*sizeof(sal_Unicode));
 
             // StyleSheetName must be Unicode too!
             // Copy/Paste from EA3 to BETA or from BETA to EA3 not possible, not needed...
             // If needed, change nL back to sal_uLong and increase version...
-            nL = pC->GetStyle().Len();
+            nL = rC.GetStyle().Len();
             rOStream << nL;
-            rOStream.Write( pC->GetStyle().GetBuffer(), nL*sizeof(sal_Unicode) );
+            rOStream.Write(rC.GetStyle().GetBuffer(), nL*sizeof(sal_Unicode));
         }
     }
 }
@@ -1408,25 +1401,25 @@ void BinTextObject::CreateData( SvStream& rIStream )
         {
             for ( sal_uInt16 nPara = 0; nPara < nParagraphs; nPara++ )
             {
-                ContentInfo* pC = GetContents().GetObject( nPara );
+                ContentInfo& rC = aContents[nPara];
                 sal_uInt16 nL;
 
                 // Text
                 rIStream >> nL;
                 if ( nL )
                 {
-                    pC->GetText().AllocBuffer( nL );
-                    rIStream.Read( pC->GetText().GetBufferAccess(), nL*sizeof(sal_Unicode) );
-                    pC->GetText().ReleaseBufferAccess( (sal_uInt16)nL );
+                    rC.GetText().AllocBuffer( nL );
+                    rIStream.Read(rC.GetText().GetBufferAccess(), nL*sizeof(sal_Unicode));
+                    rC.GetText().ReleaseBufferAccess(nL);
                 }
 
                 // StyleSheetName
                 rIStream >> nL;
                 if ( nL )
                 {
-                    pC->GetStyle().AllocBuffer( nL );
-                    rIStream.Read( pC->GetStyle().GetBufferAccess(), nL*sizeof(sal_Unicode) );
-                    pC->GetStyle().ReleaseBufferAccess( (sal_uInt16)nL );
+                    rC.GetStyle().AllocBuffer(nL);
+                    rIStream.Read(rC.GetStyle().GetBufferAccess(), nL*sizeof(sal_Unicode) );
+                    rC.GetStyle().ReleaseBufferAccess(nL);
                 }
             }
         }
@@ -1437,13 +1430,13 @@ void BinTextObject::CreateData( SvStream& rIStream )
     // Works only if tab positions are set, not when DefTab.
     if ( nVersion < 500 )
     {
-        for ( sal_uInt16 n = 0; n < aContents.Count(); n++ )
+        for (size_t i = 0, n = aContents.size(); i < n; ++i)
         {
-            ContentInfo* pC = aContents.GetObject( n );
-            const SvxLRSpaceItem& rLRSpace = (const SvxLRSpaceItem&) pC->GetParaAttribs().Get( EE_PARA_LRSPACE );
-            if ( rLRSpace.GetTxtLeft() && ( pC->GetParaAttribs().GetItemState( EE_PARA_TABS ) == SFX_ITEM_ON ) )
+            ContentInfo& rC = aContents[i];
+            const SvxLRSpaceItem& rLRSpace = static_cast<const SvxLRSpaceItem&>(rC.GetParaAttribs().Get(EE_PARA_LRSPACE));
+            if ( rLRSpace.GetTxtLeft() && ( rC.GetParaAttribs().GetItemState( EE_PARA_TABS ) == SFX_ITEM_ON ) )
             {
-                const SvxTabStopItem& rTabs = (const SvxTabStopItem&) pC->GetParaAttribs().Get( EE_PARA_TABS );
+                const SvxTabStopItem& rTabs = static_cast<const SvxTabStopItem&>(rC.GetParaAttribs().Get(EE_PARA_TABS));
                 SvxTabStopItem aNewTabs( 0, 0, SVX_TAB_ADJUST_LEFT, EE_PARA_TABS );
                 for ( sal_uInt16 t = 0; t < rTabs.Count(); t++ )
                 {
@@ -1451,7 +1444,7 @@ void BinTextObject::CreateData( SvStream& rIStream )
                     aNewTabs.Insert( SvxTabStop( rT.GetTabPos() - rLRSpace.GetTxtLeft(),
                                 rT.GetAdjustment(), rT.GetDecimal(), rT.GetFill() ) );
                 }
-                pC->GetParaAttribs().Put( aNewTabs );
+                rC.GetParaAttribs().Put( aNewTabs );
             }
         }
     }
@@ -1467,7 +1460,7 @@ bool BinTextObject::operator==( const BinTextObject& rCompare ) const
     if( this == &rCompare )
         return true;
 
-    if( ( aContents.Count() != rCompare.aContents.Count() ) ||
+    if( ( aContents.size() != rCompare.aContents.size() ) ||
             ( pPool != rCompare.pPool ) ||
             ( nMetric != rCompare.nMetric ) ||
             ( nUserType!= rCompare.nUserType ) ||
@@ -1475,10 +1468,9 @@ bool BinTextObject::operator==( const BinTextObject& rCompare ) const
             ( bVertical != rCompare.bVertical ) )
         return false;
 
-    sal_uInt16 n;
-    for( n = 0; n < aContents.Count(); n++ )
+    for (size_t i = 0, n = aContents.size(); i < n; ++i)
     {
-        if( !( *aContents.GetObject( n ) == *rCompare.aContents.GetObject( n ) ) )
+        if (aContents[i] != rCompare.aContents[i])
             return false;
     }
 
@@ -1488,15 +1480,15 @@ bool BinTextObject::operator==( const BinTextObject& rCompare ) const
 // #i102062#
 bool BinTextObject::isWrongListEqual(const BinTextObject& rCompare) const
 {
-    if(GetContents().Count() != rCompare.GetContents().Count())
+    if (aContents.size() != rCompare.aContents.size())
     {
         return false;
     }
 
-    for(sal_uInt16 a(0); a < GetContents().Count(); a++)
+    for (size_t i = 0, n = aContents.size(); i < n; ++i)
     {
-        const ContentInfo& rCandA(*GetContents().GetObject(a));
-        const ContentInfo& rCandB(*rCompare.GetContents().GetObject(a));
+        const ContentInfo& rCandA = aContents[i];
+        const ContentInfo& rCandB = rCompare.aContents[i];
 
         if(!rCandA.isWrongListEqual(rCandB))
         {
diff --git a/editeng/source/editeng/editobj2.hxx b/editeng/source/editeng/editobj2.hxx
index b6ce49a..cd0eb69 100644
--- a/editeng/source/editeng/editobj2.hxx
+++ b/editeng/source/editeng/editobj2.hxx
@@ -167,22 +167,23 @@ public:
 
     WrongList*          GetWrongList() const            { return pWrongs; }
     void                SetWrongList( WrongList* p )    { pWrongs = p; }
-    bool                operator==( const ContentInfo& rCompare ) const;
+    bool operator==( const ContentInfo& rCompare ) const;
+    bool operator!=( const ContentInfo& rCompare ) const;
 
     // #i102062#
     bool isWrongListEqual(const ContentInfo& rCompare) const;
 };
 
-typedef ContentInfo* ContentInfoPtr;
-SV_DECL_PTRARR( ContentInfoList, ContentInfoPtr, 1 )
-
 class BinTextObject : public EditTextObject, public SfxItemPoolUser
 {
     using EditTextObject::operator==;
     using EditTextObject::isWrongListEqual;
 
+public:
+    typedef boost::ptr_vector<ContentInfo> ContentInfosType;
+
 private:
-    ContentInfoList         aContents;
+    ContentInfosType        aContents;
     SfxItemPool*            pPool;
     XParaPortionList*       pPortionInfo;
 
@@ -197,7 +198,6 @@ private:
     bool                    bStoreUnicodeStrings:1;
 
 protected:
-    void                    DeleteContents();
     virtual void            StoreData( SvStream& rOStream ) const;
     virtual void            CreateData( SvStream& rIStream );
     sal_Bool                    ImpChangeStyleSheets( const String& rOldName, SfxStyleFamily eOldFamily,
@@ -228,18 +228,18 @@ public:
     XEditAttribute*         CreateAttrib( const SfxPoolItem& rItem, sal_uInt16 nStart, sal_uInt16 nEnd );
     void                    DestroyAttrib( XEditAttribute* pAttr );
 
-    ContentInfoList&        GetContents()           { return aContents; }
-    const ContentInfoList&  GetContents() const     { return aContents; }
+    ContentInfosType&       GetContents();
+    const ContentInfosType& GetContents() const;
     SfxItemPool*            GetPool() const         { return pPool; }
     XParaPortionList*       GetPortionInfo() const  { return pPortionInfo; }
     void                    SetPortionInfo( XParaPortionList* pP )
                                 { pPortionInfo = pP; }
 
-    virtual sal_uInt16          GetParagraphCount() const;
-    virtual String          GetText( sal_uInt16 nParagraph ) const;
-    virtual void            Insert( const EditTextObject& rObj, sal_uInt16 nPara );
-    virtual EditTextObject* CreateTextObject( sal_uInt16 nPara, sal_uInt16 nParas = 1 ) const;
-    virtual void            RemoveParagraph( sal_uInt16 nPara );
+    virtual size_t GetParagraphCount() const;
+    virtual String GetText(size_t nParagraph) const;
+    virtual void Insert(const EditTextObject& rObj, size_t nPara);
+    virtual EditTextObject* CreateTextObject(size_t nPara, size_t nParas = 1) const;
+    virtual void RemoveParagraph(size_t nPara);
 
     virtual sal_Bool            HasPortionInfo() const;
     virtual void            ClearPortionInfo();
@@ -258,12 +258,12 @@ public:
     virtual const SvxFieldItem* GetField() const;
     virtual sal_Bool            HasField( TypeId Type = NULL ) const;
 
-    SfxItemSet              GetParaAttribs( sal_uInt16 nPara ) const;
-    void                    SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rAttribs );
+    virtual SfxItemSet GetParaAttribs(size_t nPara) const;
+    virtual void SetParaAttribs(size_t nPara, const SfxItemSet& rAttribs);
 
     virtual sal_Bool            HasStyleSheet( const XubString& rName, SfxStyleFamily eFamily ) const;
-    virtual void            GetStyleSheet( sal_uInt16 nPara, XubString& rName, SfxStyleFamily& eFamily ) const;
-    virtual void            SetStyleSheet( sal_uInt16 nPara, const XubString& rName, const SfxStyleFamily& eFamily );
+    virtual void GetStyleSheet(size_t nPara, String& rName, SfxStyleFamily& eFamily) const;
+    virtual void SetStyleSheet(size_t nPara, const String& rName, const SfxStyleFamily& eFamily);
     virtual sal_Bool            ChangeStyleSheets(  const XubString& rOldName, SfxStyleFamily eOldFamily,
                                                 const String& rNewName, SfxStyleFamily eNewFamily );
     virtual void            ChangeStyleSheetName( SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName );
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 6b17ab7..61bbc39 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -1239,12 +1239,12 @@ EditSelection ImpEditEngine::InsertBinTextObject( BinTextObject& rTextObject, Ed
             bConvertItems = sal_True;
     }
 
-    sal_uInt16 nContents = rTextObject.GetContents().Count();
+    size_t nContents = rTextObject.GetContents().size();
     sal_uInt16 nPara = aEditDoc.GetPos( aPaM.GetNode() );
 
-    for ( sal_uInt16 n = 0; n < nContents; n++, nPara++ )
+    for (size_t n = 0; n < nContents; ++n, ++nPara)
     {
-        ContentInfo* pC = rTextObject.GetContents().GetObject( n );
+        ContentInfo* pC = &rTextObject.GetContents()[n];
         sal_Bool bNewContent = aPaM.GetNode()->Len() ? sal_False: sal_True;
         sal_uInt16 nStartPos = aPaM.GetIndex();
 
commit 6cb65d8db375aaf55214417fa041a26849855fec
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Apr 5 09:25:18 2012 -0400

    Bool changes.

diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx
index af116b1..a404533 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -216,7 +216,7 @@ void EditTextObject::RemoveParagraph( sal_uInt16 /*nPara*/ )
 sal_Bool EditTextObject::HasPortionInfo() const
 {
     OSL_FAIL( "Virtual method direct from EditTextObject!" );
-    return sal_False;
+    return false;
 }
 
 void EditTextObject::ClearPortionInfo()
@@ -227,13 +227,13 @@ void EditTextObject::ClearPortionInfo()
 sal_Bool EditTextObject::HasOnlineSpellErrors() const
 {
     OSL_FAIL( "Virtual method direct from EditTextObject!" );
-    return sal_False;
+    return false;
 }
 
 sal_Bool EditTextObject::HasCharAttribs( sal_uInt16 ) const
 {
     OSL_FAIL( "Virtual method direct from EditTextObject!" );
-    return sal_False;
+    return false;
 }
 
 void EditTextObject::GetCharAttribs( sal_uInt16 /*nPara*/, std::vector<EECharAttrib>& /*rLst*/ ) const
@@ -249,7 +249,7 @@ void EditTextObject::MergeParaAttribs( const SfxItemSet& /*rAttribs*/, sal_uInt1
 sal_Bool EditTextObject::IsFieldObject() const
 {
     OSL_FAIL( "Virtual method direct from EditTextObject!" );
-    return sal_False;
+    return false;
 }
 
 const SvxFieldItem* EditTextObject::GetField() const
@@ -261,7 +261,7 @@ const SvxFieldItem* EditTextObject::GetField() const
 sal_Bool EditTextObject::HasField( TypeId /*aType*/ ) const
 {
     OSL_FAIL( "Virtual method direct from EditTextObject!" );
-    return sal_False;
+    return false;
 }
 
 SfxItemSet EditTextObject::GetParaAttribs( sal_uInt16 /*nPara*/ ) const
@@ -278,19 +278,19 @@ void EditTextObject::SetParaAttribs( sal_uInt16 /*nPara*/, const SfxItemSet& /*r
 sal_Bool EditTextObject::RemoveCharAttribs( sal_uInt16 /*nWhich*/ )
 {
     OSL_FAIL( "Virtual method direct from EditTextObject!" );
-    return sal_False;
+    return false;
 }
 
 sal_Bool EditTextObject::RemoveParaAttribs( sal_uInt16 /*nWhich*/ )
 {
     OSL_FAIL( "Virtual method direct from EditTextObject!" );
-    return sal_False;
+    return false;
 }
 
 sal_Bool EditTextObject::HasStyleSheet( const XubString& /*rName*/, SfxStyleFamily /*eFamily*/ ) const
 {
     OSL_FAIL( "Virtual method direct from EditTextObject!" );
-    return sal_False;
+    return false;
 }
 
 void EditTextObject::GetStyleSheet( sal_uInt16 /*nPara*/, XubString& /*rName*/, SfxStyleFamily& /*eFamily*/ ) const
@@ -307,7 +307,7 @@ sal_Bool EditTextObject::ChangeStyleSheets( const XubString&, SfxStyleFamily,
                                             const XubString&, SfxStyleFamily )
 {
     OSL_FAIL( "Virtual method direct from EditTextObject!" );
-    return sal_False;
+    return false;
 }
 
 void EditTextObject::ChangeStyleSheetName( SfxStyleFamily /*eFamily*/,
@@ -341,7 +341,7 @@ void EditTextObject::SetObjectSettings( sal_uLong )
 sal_Bool EditTextObject::IsVertical() const
 {
     OSL_FAIL( "Virtual method direct from EditTextObject!" );
-    return sal_False;
+    return false;
 }
 
 void EditTextObject::SetVertical( sal_Bool bVertical )
@@ -360,7 +360,7 @@ sal_uInt16 EditTextObject::GetScriptType() const
 sal_Bool EditTextObject::Store( SvStream& rOStream ) const
 {
     if ( rOStream.GetError() )
-        return sal_False;
+        return false;
 
     sal_Size nStartPos = rOStream.Tell();
 
@@ -377,7 +377,7 @@ sal_Bool EditTextObject::Store( SvStream& rOStream ) const
     rOStream << nStructSz;
     rOStream.Seek( nEndPos );
 
-    return rOStream.GetError() ? sal_False : sal_True;
+    return rOStream.GetError() ? false : true;
 }
 
 EditTextObject* EditTextObject::Create( SvStream& rIStream, SfxItemPool* pGlobalTextObjectPool )
@@ -474,7 +474,7 @@ void BinTextObject::ObjectInDestruction(const SfxItemPool& rSfxItemPool)
 
         // set local variables
         pPool = pNewPool;
-        bOwnerOfPool = sal_True;
+        bOwnerOfPool = true;
     }
 }
 
@@ -515,12 +515,12 @@ BinTextObject::BinTextObject( SfxItemPool* pP ) :
 
     if ( pPool )
     {
-        bOwnerOfPool = sal_False;
+        bOwnerOfPool = false;
     }
     else
     {
         pPool = EditEngine::CreatePool();
-        bOwnerOfPool =  sal_True;
+        bOwnerOfPool =  true;
     }
 
     if(!bOwnerOfPool && pPool)
@@ -529,8 +529,8 @@ BinTextObject::BinTextObject( SfxItemPool* pP ) :
         pPool->AddSfxItemPoolUser(*this);
     }
 
-    bVertical = sal_False;
-    bStoreUnicodeStrings = sal_False;
+    bVertical = false;
+    bStoreUnicodeStrings = false;
     nScriptType = 0;
 }
 
@@ -545,7 +545,7 @@ BinTextObject::BinTextObject( const BinTextObject& r ) :
     bVertical = r.bVertical;
     nScriptType = r.nScriptType;
     pPortionInfo = NULL;    // Do not copy PortionInfo
-    bStoreUnicodeStrings = sal_False;
+    bStoreUnicodeStrings = false;
 
     if ( !r.bOwnerOfPool )
     {
@@ -553,12 +553,12 @@ BinTextObject::BinTextObject( const BinTextObject& r ) :
         // since there is no other way to construct a BinTextObject
         // than it's regular constructor where that is ensured
         pPool = r.pPool;
-        bOwnerOfPool = sal_False;
+        bOwnerOfPool = false;
     }
     else
     {
         pPool = EditEngine::CreatePool();
-        bOwnerOfPool =  sal_True;
+        bOwnerOfPool =  true;
 
     }
 
@@ -747,7 +747,7 @@ void BinTextObject::RemoveParagraph( sal_uInt16 nPara )
 
 sal_Bool BinTextObject::HasPortionInfo() const
 {
-    return pPortionInfo ? sal_True : sal_False;
+    return pPortionInfo ? true : false;
 }
 
 void BinTextObject::ClearPortionInfo()
@@ -767,9 +767,9 @@ sal_Bool BinTextObject::HasOnlineSpellErrors() const
     {
         ContentInfo* p = aContents.GetObject( n );
         if ( p->GetWrongList() && !p->GetWrongList()->empty() )
-            return sal_True;
+            return true;
     }
-    return sal_False;
+    return false;
 
 }
 
@@ -781,16 +781,16 @@ sal_Bool BinTextObject::HasCharAttribs( sal_uInt16 _nWhich ) const
 
         sal_uInt16 nAttribs = pC->GetAttribs().Count();
         if ( nAttribs && !_nWhich )
-            return sal_True;
+            return true;
 
         for ( sal_uInt16 nAttr = nAttribs; nAttr; )
         {
             XEditAttribute* pX = pC->GetAttribs().GetObject( --nAttr );
             if ( pX->GetItem()->Which() == _nWhich )
-                return sal_True;
+                return true;
         }
     }
-    return sal_False;
+    return false;
 }
 
 void BinTextObject::GetCharAttribs( sal_uInt16 nPara, std::vector<EECharAttrib>& rLst ) const
@@ -814,7 +814,7 @@ void BinTextObject::GetCharAttribs( sal_uInt16 nPara, std::vector<EECharAttrib>&
 
 void BinTextObject::MergeParaAttribs( const SfxItemSet& rAttribs, sal_uInt16 nStart, sal_uInt16 nEnd )
 {
-    sal_Bool bChanged = sal_False;
+    sal_Bool bChanged = false;
 
     for ( sal_uInt16 nPara = GetContents().Count(); nPara; )
     {
@@ -822,11 +822,11 @@ void BinTextObject::MergeParaAttribs( const SfxItemSet& rAttribs, sal_uInt16 nSt
 
         for ( sal_uInt16 nW = nStart; nW <= nEnd; nW++ )
         {
-            if ( ( pC->GetParaAttribs().GetItemState( nW, sal_False ) != SFX_ITEM_ON )
-                    && ( rAttribs.GetItemState( nW, sal_False ) == SFX_ITEM_ON ) )
+            if ( ( pC->GetParaAttribs().GetItemState( nW, false ) != SFX_ITEM_ON )
+                    && ( rAttribs.GetItemState( nW, false ) == SFX_ITEM_ON ) )
             {
                 pC->GetParaAttribs().Put( rAttribs.Get( nW ) );
-                bChanged = sal_True;
+                bChanged = true;
             }
         }
     }
@@ -837,7 +837,7 @@ void BinTextObject::MergeParaAttribs( const SfxItemSet& rAttribs, sal_uInt16 nSt
 
 sal_Bool BinTextObject::IsFieldObject() const
 {
-    return BinTextObject::GetField() ? sal_True : sal_False;
+    return BinTextObject::GetField() ? true : false;
 }
 
 const SvxFieldItem* BinTextObject::GetField() const
@@ -872,15 +872,15 @@ sal_Bool BinTextObject::HasField( TypeId aType ) const
             if ( pAttr->GetItem()->Which() == EE_FEATURE_FIELD )
             {
                 if ( !aType )
-                    return sal_True;
+                    return true;
 
                 const SvxFieldData* pFldData = ((const SvxFieldItem*)pAttr->GetItem())->GetField();
                 if ( pFldData && pFldData->IsA( aType ) )
-                    return sal_True;
+                    return true;
             }
         }
     }
-    return sal_False;
+    return false;
 }
 
 SfxItemSet BinTextObject::GetParaAttribs( sal_uInt16 nPara ) const
@@ -898,7 +898,7 @@ void BinTextObject::SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rAttribs
 
 sal_Bool BinTextObject::RemoveCharAttribs( sal_uInt16 _nWhich )
 {
-    sal_Bool bChanged = sal_False;
+    sal_Bool bChanged = false;
 
     for ( sal_uInt16 nPara = GetContents().Count(); nPara; )
     {
@@ -911,7 +911,7 @@ sal_Bool BinTextObject::RemoveCharAttribs( sal_uInt16 _nWhich )
             {
                 pC->GetAttribs().Remove( nAttr );
                 DestroyAttrib( pAttr );
-                bChanged = sal_True;
+                bChanged = true;
             }
         }
     }
@@ -924,7 +924,7 @@ sal_Bool BinTextObject::RemoveCharAttribs( sal_uInt16 _nWhich )
 
 sal_Bool BinTextObject::RemoveParaAttribs( sal_uInt16 _nWhich )
 {
-    sal_Bool bChanged = sal_False;
+    sal_Bool bChanged = false;
 
     for ( sal_uInt16 nPara = GetContents().Count(); nPara; )
     {
@@ -933,7 +933,7 @@ sal_Bool BinTextObject::RemoveParaAttribs( sal_uInt16 _nWhich )
         if ( !_nWhich )
         {
             if( pC->GetParaAttribs().Count() )
-                bChanged = sal_True;
+                bChanged = true;
             pC->GetParaAttribs().ClearItem();
         }
         else
@@ -941,7 +941,7 @@ sal_Bool BinTextObject::RemoveParaAttribs( sal_uInt16 _nWhich )
             if ( pC->GetParaAttribs().GetItemState( _nWhich ) == SFX_ITEM_ON )
             {
                 pC->GetParaAttribs().ClearItem( _nWhich );
-                bChanged = sal_True;
+                bChanged = true;
             }
         }
     }
@@ -959,9 +959,9 @@ sal_Bool BinTextObject::HasStyleSheet( const XubString& rName, SfxStyleFamily eF
     {
         ContentInfo* pC = GetContents().GetObject( nPara );
         if ( ( pC->GetFamily() == eFamily ) && ( pC->GetStyle() == rName ) )
-            return sal_True;
+            return true;
     }
-    return sal_False;
+    return false;
 }
 
 void BinTextObject::GetStyleSheet( sal_uInt16 nPara, XubString& rName, SfxStyleFamily& rFamily ) const
@@ -989,7 +989,7 @@ sal_Bool BinTextObject::ImpChangeStyleSheets(
                     const XubString& rNewName, SfxStyleFamily eNewFamily )
 {
     const sal_uInt16 nParagraphs = GetContents().Count();
-    sal_Bool bChanges = sal_False;
+    sal_Bool bChanges = false;
 
     for ( sal_uInt16 nPara = 0; nPara < nParagraphs; nPara++ )
     {
@@ -1000,7 +1000,7 @@ sal_Bool BinTextObject::ImpChangeStyleSheets(
             {
                 pC->GetStyle() = rNewName;
                 pC->GetFamily() = eNewFamily;
-                bChanges = sal_True;
+                bChanges = true;
             }
         }
     }
@@ -1029,7 +1029,7 @@ void BinTextObject::StoreData( SvStream& rOStream ) const
     sal_uInt16 nVer = 602;
     rOStream << nVer;
 
-    rOStream << bOwnerOfPool;
+    rOStream << static_cast<sal_Bool>(bOwnerOfPool);
 
     // First store the pool, later only the Surregate
     if ( bOwnerOfPool )
@@ -1058,14 +1058,14 @@ void BinTextObject::StoreData( SvStream& rOStream ) const
         rtl::OStringBuffer aBuffer(rtl::OUStringToOString(pC->GetText(), eEncoding));
 
         // Symbols?
-        sal_Bool bSymbolPara = sal_False;
+        sal_Bool bSymbolPara = false;
         if ( pC->GetParaAttribs().GetItemState( EE_CHAR_FONTINFO ) == SFX_ITEM_ON )
         {
             const SvxFontItem& rFontItem = (const SvxFontItem&)pC->GetParaAttribs().Get( EE_CHAR_FONTINFO );
             if ( rFontItem.GetCharSet() == RTL_TEXTENCODING_SYMBOL )
             {
                 aBuffer = rtl::OStringBuffer(rtl::OUStringToOString(pC->GetText(), RTL_TEXTENCODING_SYMBOL));
-                bSymbolPara = sal_True;
+                bSymbolPara = true;
             }
         }
         for ( sal_uInt16 nA = 0; nA < pC->GetAttribs().Count(); nA++ )
@@ -1164,10 +1164,10 @@ void BinTextObject::StoreData( SvStream& rOStream ) const
     rOStream << nUserType;
     rOStream << nObjSettings;
 
-    rOStream << bVertical;
+    rOStream << static_cast<sal_Bool>(bVertical);
     rOStream << nScriptType;
 
-    rOStream << bStoreUnicodeStrings;
+    rOStream << static_cast<sal_Bool>(bStoreUnicodeStrings);
     if ( bStoreUnicodeStrings )
     {
         for ( sal_uInt16 nPara = 0; nPara < nParagraphs; nPara++ )
@@ -1194,7 +1194,9 @@ void BinTextObject::CreateData( SvStream& rIStream )
     // The text object was first created with the current setting of
     // pTextObjectPool.
     sal_Bool bOwnerOfCurrent = bOwnerOfPool;
-    rIStream >> bOwnerOfPool;
+    sal_Bool b;
+    rIStream >> b;
+    bOwnerOfPool = b;
 
     if ( bOwnerOfCurrent && !bOwnerOfPool )
     {
@@ -1285,14 +1287,14 @@ void BinTextObject::CreateData( SvStream& rIStream )
         // But check for paragraph and character symbol attribs here,
         // FinishLoad will not be called in OpenOffice Calc, no StyleSheets...
 
-        sal_Bool bSymbolPara = sal_False;
+        sal_Bool bSymbolPara = false;
         if ( pC->GetParaAttribs().GetItemState( EE_CHAR_FONTINFO ) == SFX_ITEM_ON )
         {
             const SvxFontItem& rFontItem = (const SvxFontItem&)pC->GetParaAttribs().Get( EE_CHAR_FONTINFO );
             if ( rFontItem.GetCharSet() == RTL_TEXTENCODING_SYMBOL )
             {
                 pC->GetText() = rtl::OStringToOUString(aByteString, RTL_TEXTENCODING_SYMBOL);
-                bSymbolPara = sal_True;
+                bSymbolPara = true;
             }
         }
 
@@ -1391,7 +1393,9 @@ void BinTextObject::CreateData( SvStream& rIStream )
 
     if ( nVersion >= 601 )
     {
-        rIStream >> bVertical;
+        sal_Bool bTmp;
+        rIStream >> bTmp;
+        bVertical = bTmp;
     }
 
     if ( nVersion >= 602 )
diff --git a/editeng/source/editeng/editobj2.hxx b/editeng/source/editeng/editobj2.hxx
index 426435a..b6ce49a 100644
--- a/editeng/source/editeng/editobj2.hxx
+++ b/editeng/source/editeng/editobj2.hxx
@@ -184,7 +184,6 @@ class BinTextObject : public EditTextObject, public SfxItemPoolUser
 private:
     ContentInfoList         aContents;
     SfxItemPool*            pPool;
-    sal_Bool                    bOwnerOfPool;
     XParaPortionList*       pPortionInfo;
 
     sal_uInt32              nObjSettings;
@@ -193,8 +192,9 @@ private:
     sal_uInt16                  nUserType;
     sal_uInt16                  nScriptType;
 
-    sal_Bool                    bVertical;
-    sal_Bool                    bStoreUnicodeStrings;
+    bool                    bOwnerOfPool:1;
+    bool                    bVertical:1;
+    bool                    bStoreUnicodeStrings:1;
 
 protected:
     void                    DeleteContents();
@@ -274,7 +274,7 @@ public:
     sal_uInt16                  GetMetric() const           { return nMetric; }
     void                    SetMetric( sal_uInt16 n )       { nMetric = n; }
 
-    sal_Bool                    IsOwnerOfPool() const       { return bOwnerOfPool; }
+    bool                    IsOwnerOfPool() const       { return bOwnerOfPool; }
     void                    StoreUnicodeStrings( sal_Bool b ) { bStoreUnicodeStrings = b; }
 
     bool                    operator==( const BinTextObject& rCompare ) const;


More information about the Libreoffice-commits mailing list