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

Michael Stahl mst at kemper.freedesktop.org
Mon May 14 15:29:53 PDT 2012


 sw/inc/swabstdlg.hxx              |    2 -
 sw/inc/tblafmt.hxx                |   23 +++++++++++----
 sw/source/core/doc/tblafmt.cxx    |   56 +++++++++++++++++++++++++++++++++-----
 sw/source/core/unocore/unotbl.cxx |    2 -
 sw/source/ui/dialog/swdlgfact.cxx |    2 -
 sw/source/ui/dialog/swdlgfact.hxx |    2 -
 sw/source/ui/inc/convert.hxx      |    2 -
 sw/source/ui/shells/basesh.cxx    |    4 +-
 sw/source/ui/table/convert.cxx    |    2 -
 sw/source/ui/table/tautofmt.cxx   |   16 +++++-----
 10 files changed, 82 insertions(+), 29 deletions(-)

New commits:
commit 007f16ef7ad40ae932df884ba04f0de71928b852
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue May 15 00:25:35 2012 +0200

    SwTableAutoFmtTbl: try to fix MSVC tinderbox:
    
    C:/lo/core/sw/inc\tblafmt.hxx(311) : error C2487:
    'boost::ptr_container_detail::reversible_ptr_container<Config,CloneAllocator>::insert'
    : member of dll interface class may not be declared with dll interface
    
    Not really understanding what the problem is here, attempting to fix it
    by not deriving SwTableAutoFmtTbl from the container, and trying to get
    that to build somehow resulted in this commit.

diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index ab6e8a5..2962991 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -240,7 +240,7 @@ class AbstractSwConvertTableDlg :  public VclAbstractDialog // add for SwConvert
 public:
     virtual void GetValues( sal_Unicode& rDelim,
                     SwInsertTableOptions& rInsTblFlags,
-                    SwTableAutoFmt *& prTAFmt ) = 0;
+                    SwTableAutoFmt const*& prTAFmt ) = 0;
 };
 
 class AbstractSwInsertDBColAutoPilot :  public VclAbstractDialog // add for SwInsertDBColAutoPilot
diff --git a/sw/inc/tblafmt.hxx b/sw/inc/tblafmt.hxx
index a185c0f..ae8399e 100644
--- a/sw/inc/tblafmt.hxx
+++ b/sw/inc/tblafmt.hxx
@@ -25,8 +25,8 @@
  * for a copy of the LGPLv3 License.
  *
  ************************************************************************/
-#ifndef _TBLAFMT_HXX
-#define _TBLAFMT_HXX
+#ifndef SW_TBLAFMT_HXX
+#define SW_TBLAFMT_HXX
 /*************************************************************************
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
@@ -37,6 +37,8 @@
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 **************************************************************************/
 
+#include <boost/scoped_ptr.hpp>
+
 #include <svl/svarray.hxx>
 #include "hintids.hxx"          // _Always_ before the solar-items!
 #include <svx/algitem.hxx>
@@ -305,15 +307,24 @@ public:
     sal_Bool Save( SvStream& rStream, sal_uInt16 fileVersion ) const;
 };
 
-typedef boost::ptr_vector<SwTableAutoFmt> _SwTableAutoFmtTbl;
-
-class SW_DLLPUBLIC SwTableAutoFmtTbl : public _SwTableAutoFmtTbl
+class SW_DLLPUBLIC SwTableAutoFmtTbl
 {
+    class Impl;
+    ::boost::scoped_ptr<Impl> m_pImpl;
+
     SW_DLLPRIVATE sal_Bool Load( SvStream& rStream );
     SW_DLLPRIVATE sal_Bool Save( SvStream& rStream ) const;
 
 public:
-    SwTableAutoFmtTbl();
+    explicit SwTableAutoFmtTbl();
+    ~SwTableAutoFmtTbl();
+
+    size_t size() const;
+    SwTableAutoFmt const& operator[](size_t i) const;
+    SwTableAutoFmt      & operator[](size_t i);
+    void InsertAutoFmt(size_t i, SwTableAutoFmt * pFmt);
+    void EraseAutoFmt(size_t i);
+    void MoveAutoFmt(size_t target, size_t source);
 
     sal_Bool Load();
     sal_Bool Save() const;
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index 747863d..893f7b4 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -1026,7 +1026,48 @@ sal_Bool SwTableAutoFmt::Save( SvStream& rStream, sal_uInt16 fileVersion ) const
 }
 
 
+struct SwTableAutoFmtTbl::Impl
+{
+    boost::ptr_vector<SwTableAutoFmt> m_AutoFormats;
+};
+
+size_t SwTableAutoFmtTbl::size() const
+{
+    return m_pImpl->m_AutoFormats.size();
+}
+
+SwTableAutoFmt const& SwTableAutoFmtTbl::operator[](size_t const i) const
+{
+    return m_pImpl->m_AutoFormats[i];
+}
+SwTableAutoFmt      & SwTableAutoFmtTbl::operator[](size_t const i)
+{
+    return m_pImpl->m_AutoFormats[i];
+}
+
+void
+SwTableAutoFmtTbl::InsertAutoFmt(size_t const i, SwTableAutoFmt *const pFmt)
+{
+    m_pImpl->m_AutoFormats.insert(m_pImpl->m_AutoFormats.begin() + i, pFmt);
+}
+
+void SwTableAutoFmtTbl::EraseAutoFmt(size_t const i)
+{
+    m_pImpl->m_AutoFormats.erase(m_pImpl->m_AutoFormats.begin() + i);
+}
+
+void SwTableAutoFmtTbl::MoveAutoFmt(size_t const target, size_t source)
+{
+    m_pImpl->m_AutoFormats.transfer(m_pImpl->m_AutoFormats.begin() + target,
+            m_pImpl->m_AutoFormats.begin() + source, m_pImpl->m_AutoFormats);
+}
+
+SwTableAutoFmtTbl::~SwTableAutoFmtTbl()
+{
+}
+
 SwTableAutoFmtTbl::SwTableAutoFmtTbl()
+    : m_pImpl(new Impl)
 {
     String sNm;
     SwTableAutoFmt* pNew = new SwTableAutoFmt(
@@ -1081,7 +1122,7 @@ SwTableAutoFmtTbl::SwTableAutoFmtTbl()
         ((SwBoxAutoFmt&)pNew->GetBoxFmt( i )).SetBox( aBox );
     }
 
-    push_back( pNew );
+    m_pImpl->m_AutoFormats.push_back(pNew);
 }
 
 sal_Bool SwTableAutoFmtTbl::Load()
@@ -1161,7 +1202,7 @@ sal_Bool SwTableAutoFmtTbl::Load( SvStream& rStream )
                     bRet = pNew->Load( rStream, aVersions );
                     if( bRet )
                     {
-                        push_back( pNew );
+                        m_pImpl->m_AutoFormats.push_back(pNew);
                     }
                     else
                     {
@@ -1196,15 +1237,16 @@ sal_Bool SwTableAutoFmtTbl::Save( SvStream& rStream ) const
         bRet = 0 == rStream.GetError();
 
         // Write this version number for all attributes
-        (*this)[ 0 ].GetBoxFmt( 0 ).SaveVersionNo( rStream, AUTOFORMAT_FILE_VERSION );
+        m_pImpl->m_AutoFormats[0].GetBoxFmt(0).SaveVersionNo(
+                rStream, AUTOFORMAT_FILE_VERSION);
 
-        rStream << (sal_uInt16)(size() - 1);
+        rStream << static_cast<sal_uInt16>(m_pImpl->m_AutoFormats.size() - 1);
         bRet = 0 == rStream.GetError();
 
-        for( sal_uInt16 i = 1; bRet && i < size(); ++i )
+        for (sal_uInt16 i = 1; bRet && i < m_pImpl->m_AutoFormats.size(); ++i)
         {
-            const SwTableAutoFmt* pFmt = &(*this)[ i ];
-            bRet = pFmt->Save( rStream, AUTOFORMAT_FILE_VERSION );
+            SwTableAutoFmt const& rFmt = m_pImpl->m_AutoFormats[i];
+            bRet = rFmt.Save(rStream, AUTOFORMAT_FILE_VERSION);
         }
     }
     rStream.Flush();
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index e05143e..ac17fd4 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -2966,7 +2966,7 @@ void SwXTextTable::autoFormat(const OUString& aName) throw( lang::IllegalArgumen
             String sAutoFmtName(aName);
             SwTableAutoFmtTbl aAutoFmtTbl;
             aAutoFmtTbl.Load();
-            for( sal_uInt16 i = aAutoFmtTbl.size(); i; )
+            for (sal_uInt16 i = aAutoFmtTbl.size(); i;)
                 if( sAutoFmtName == aAutoFmtTbl[ --i ].GetName() )
                 {
                     SwSelBoxes aBoxes;
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index ca2698b..dd291aa 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -224,7 +224,7 @@ sal_uInt16 AbstractSwBreakDlg_Impl:: GetPageNumber()
 }
 
 void AbstractSwConvertTableDlg_Impl::GetValues( sal_Unicode& rDelim,SwInsertTableOptions& rInsTblFlags,
-                                                SwTableAutoFmt *& prTAFmt )
+                                                SwTableAutoFmt const*& prTAFmt)
 {
     pDlg->GetValues(rDelim,rInsTblFlags, prTAFmt);
 }
diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx
index 75100f1..92bce03 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -157,7 +157,7 @@ class AbstractSwConvertTableDlg_Impl :  public AbstractSwConvertTableDlg // add
 {
     DECL_ABSTDLG_BASE( AbstractSwConvertTableDlg_Impl,SwConvertTableDlg)
     virtual void GetValues( sal_Unicode& rDelim,SwInsertTableOptions& rInsTblFlags,
-                    SwTableAutoFmt *& prTAFmt );
+                    SwTableAutoFmt const*& prTAFmt);
 };
 //add for SwConvertTableDlg end
 
diff --git a/sw/source/ui/inc/convert.hxx b/sw/source/ui/inc/convert.hxx
index 8452660..500afe0 100644
--- a/sw/source/ui/inc/convert.hxx
+++ b/sw/source/ui/inc/convert.hxx
@@ -83,7 +83,7 @@ public:
 
     void GetValues( sal_Unicode& rDelim,
                     SwInsertTableOptions& rInsTblOpts,
-                    SwTableAutoFmt *& prTAFmt );
+                    SwTableAutoFmt const*& prTAFmt );
 };
 
 
diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx
index c0c2c4f..f74f99e 100644
--- a/sw/source/ui/shells/basesh.cxx
+++ b/sw/source/ui/shells/basesh.cxx
@@ -786,7 +786,7 @@ void SwBaseShell::Execute(SfxRequest &rReq)
                 ( nSlot == FN_CONVERT_TEXT_TABLE && 0 == rSh.GetTableFmt() ))
                 bToTable = true;
             SwInsertTableOptions aInsTblOpts( tabopts::ALL_TBL_INS_ATTR, 1 );
-            SwTableAutoFmt* pTAFmt = 0;
+            SwTableAutoFmt const* pTAFmt = 0;
             SwTableAutoFmtTbl* pAutoFmtTbl = 0;
             bool bDeleteFormat = true;
             if(pArgs && SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_1, sal_True, &pItem))
@@ -806,7 +806,7 @@ void SwBaseShell::Execute(SfxRequest &rReq)
 
                     for( sal_uInt16 i = 0, nCount = pAutoFmtTbl->size(); i < nCount; i++ )
                     {
-                        SwTableAutoFmt* pFmt = &(*pAutoFmtTbl)[ i ];
+                        SwTableAutoFmt const*const pFmt = &(*pAutoFmtTbl)[ i ];
                         if( pFmt->GetName() == sAutoFmt )
                         {
                             pTAFmt = pFmt;
diff --git a/sw/source/ui/table/convert.cxx b/sw/source/ui/table/convert.cxx
index 20d232b..332591f 100644
--- a/sw/source/ui/table/convert.cxx
+++ b/sw/source/ui/table/convert.cxx
@@ -63,7 +63,7 @@ static sal_Unicode uOther = ',';
 
 void SwConvertTableDlg::GetValues(  sal_Unicode& rDelim,
                                     SwInsertTableOptions& rInsTblOpts,
-                                    SwTableAutoFmt *& prTAFmt )
+                                    SwTableAutoFmt const*& prTAFmt )
 {
     if( aTabBtn.IsChecked() )
     {
diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx
index 3001d20..984d09e 100644
--- a/sw/source/ui/table/tautofmt.cxx
+++ b/sw/source/ui/table/tautofmt.cxx
@@ -259,11 +259,12 @@ void SwAutoFormatDlg::Init( const SwTableAutoFmt* pSelFmt )
         nIndex = 255;
     }
 
-    for( sal_uInt8 i = 0, nCount = (sal_uInt8)pTableTbl->size(); i < nCount; i++ )
+    for (sal_uInt8 i = 0, nCount = static_cast<sal_uInt8>(pTableTbl->size());
+            i < nCount; i++)
     {
-        SwTableAutoFmt* pFmt = &(*pTableTbl)[ i ];
-        aLbFormat.InsertEntry( pFmt->GetName() );
-        if( pSelFmt && pFmt->GetName() == pSelFmt->GetName() )
+        SwTableAutoFmt const& rFmt = (*pTableTbl)[ i ];
+        aLbFormat.InsertEntry(rFmt.GetName());
+        if (pSelFmt && rFmt.GetName() == pSelFmt->GetName())
             nIndex = i;
     }
 
@@ -379,7 +380,7 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, AddHdl)
                         if( (*pTableTbl)[ n ].GetName() > aFormatName )
                             break;
 
-                    pTableTbl->insert( pTableTbl->begin() + n, pNewData );
+                    pTableTbl->InsertAutoFmt(n, pNewData);
                     aLbFormat.InsertEntry( aFormatName, nDfltStylePos + n );
                     aLbFormat.SelectEntryPos( nDfltStylePos + n );
                     bFmtInserted = sal_True;
@@ -427,7 +428,7 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RemoveHdl)
         aLbFormat.RemoveEntry( nDfltStylePos + nIndex );
         aLbFormat.SelectEntryPos( nDfltStylePos + nIndex-1 );
 
-        pTableTbl->erase( pTableTbl->begin() + nIndex );
+        pTableTbl->EraseAutoFmt(nIndex);
         nIndex--;
 
         if( !nIndex )
@@ -486,8 +487,7 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RenameHdl)
                             break;
                         }
 
-                    pTableTbl->transfer(pTableTbl->begin() + n,
-                            pTableTbl->begin() + nIndex, *pTableTbl);
+                    pTableTbl->MoveAutoFmt(n, nIndex);
                     aLbFormat.InsertEntry( aFormatName, nDfltStylePos + n );
                     aLbFormat.SelectEntryPos( nDfltStylePos + n );
 


More information about the Libreoffice-commits mailing list