[Libreoffice-commits] core.git: 2 commits - include/tools sw/inc sw/source tools/source

Noel Grandin noel at peralex.com
Tue Nov 17 03:22:22 PST 2015


 include/tools/errinf.hxx                  |    7 
 include/tools/fract.hxx                   |    3 
 include/tools/resary.hxx                  |    3 
 sw/inc/acmplwrd.hxx                       |    3 
 sw/inc/dbmgr.hxx                          |    2 
 sw/source/core/doc/acmplwrd.cxx           |    1 
 sw/source/core/docnode/node2lay.cxx       |    5 
 sw/source/core/inc/node2lay.hxx           |    3 
 sw/source/filter/inc/msfilter.hxx         |    3 
 sw/source/filter/ww8/writerwordglue.cxx   |    1 
 sw/source/filter/xml/xmlitmap.hxx         |    3 
 sw/source/filter/xml/xmlitmpr.cxx         |    3 
 sw/source/uibase/dbui/dbmgr.cxx           |    1 
 sw/source/uibase/dbui/mmconfigitem.cxx    |  451 ++++++++++++++----------------
 sw/source/uibase/inc/mmconfigitem.hxx     |    2 
 sw/source/uibase/inc/viewlayoutctrl.hxx   |    3 
 sw/source/uibase/utlui/viewlayoutctrl.cxx |    1 
 tools/source/generic/fract.cxx            |    1 
 tools/source/rc/resary.cxx                |    1 
 tools/source/ref/errinf.cxx               |   11 
 20 files changed, 251 insertions(+), 257 deletions(-)

New commits:
commit b5eaa0f9f00cd62f4769c3e8860d788844ccf557
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Nov 17 13:21:24 2015 +0200

    use unique_ptr for pImpl in sw/
    
    Change-Id: I8508894d70e1ff16cfb9d7a9d716f11a923f453d

diff --git a/sw/inc/acmplwrd.hxx b/sw/inc/acmplwrd.hxx
index 1f78fea..01d7ee1 100644
--- a/sw/inc/acmplwrd.hxx
+++ b/sw/inc/acmplwrd.hxx
@@ -21,6 +21,7 @@
 #define INCLUDED_SW_INC_ACMPLWRD_HXX
 
 #include <deque>
+#include <memory>
 
 #include <editeng/swafopt.hxx>
 #include <editeng/Trie.hxx>
@@ -42,7 +43,7 @@ class SwAutoCompleteWord
     editeng::Trie m_LookupTree;
     SwAutoCompleteStringPtrDeque aLRULst;
 
-    SwAutoCompleteWord_Impl* pImpl;
+    std::unique_ptr<SwAutoCompleteWord_Impl> pImpl;
     sal_uInt16 nMaxCount, nMinWrdLen;
     bool bLockWordLst;
 
diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx
index 07b9840..f5b752f 100644
--- a/sw/inc/dbmgr.hxx
+++ b/sw/inc/dbmgr.hxx
@@ -201,7 +201,7 @@ friend class SwConnectionDisposedListener_Impl;
     bool            bMergeLock : 1;     /**< prevent update of database fields while document is
                                              actually printed at the SwViewShell */
     SwDSParams_t    m_DataSourceParams;
-    SwDBManager_Impl*    pImpl;
+    std::unique_ptr<SwDBManager_Impl>  pImpl;
     const SwXMailMerge* pMergeEvtSrc;   ///< != 0 if mail merge events are to be send
     /// Name of the embedded database that's included in the current document.
     OUString     m_sEmbeddedName;
diff --git a/sw/source/core/doc/acmplwrd.cxx b/sw/source/core/doc/acmplwrd.cxx
index 485c753..694370b 100644
--- a/sw/source/core/doc/acmplwrd.cxx
+++ b/sw/source/core/doc/acmplwrd.cxx
@@ -225,7 +225,6 @@ SwAutoCompleteWord::SwAutoCompleteWord( sal_uInt16 nWords, sal_uInt16 nMWrdLen )
 SwAutoCompleteWord::~SwAutoCompleteWord()
 {
     m_WordList.DeleteAndDestroyAll(); // so the assertion below works
-    delete pImpl;
 #if OSL_DEBUG_LEVEL > 0
     sal_uLong nStrings = SwAutoCompleteString::GetElementCount();
     sal_uLong nClients = SwAutoCompleteClient::GetElementCount();
diff --git a/sw/source/core/docnode/node2lay.cxx b/sw/source/core/docnode/node2lay.cxx
index 969a950..b000d24 100644
--- a/sw/source/core/docnode/node2lay.cxx
+++ b/sw/source/core/docnode/node2lay.cxx
@@ -421,13 +421,13 @@ SwFrm* SwNode2LayImpl::GetFrm( const Point* pDocPos,
 }
 
 SwNode2Layout::SwNode2Layout( const SwNode& rNd, sal_uLong nIdx )
+    : pImpl( new SwNode2LayImpl( rNd, nIdx, false ) )
 {
-    pImpl = new SwNode2LayImpl( rNd, nIdx, false );
 }
 
 SwNode2Layout::SwNode2Layout( const SwNode& rNd )
+    : pImpl( new SwNode2LayImpl( rNd, rNd.GetIndex(), true ) )
 {
-    pImpl = new SwNode2LayImpl( rNd, rNd.GetIndex(), true );
     pImpl->SaveUpperFrms();
 }
 
@@ -449,7 +449,6 @@ SwLayoutFrm* SwNode2Layout::UpperFrm( SwFrm* &rpFrm, const SwNode &rNode )
 
 SwNode2Layout::~SwNode2Layout()
 {
-    delete pImpl;
 }
 
 SwFrm* SwNode2Layout::GetFrm( const Point* pDocPos,
diff --git a/sw/source/core/inc/node2lay.hxx b/sw/source/core/inc/node2lay.hxx
index 2c861d3..e424c4f 100644
--- a/sw/source/core/inc/node2lay.hxx
+++ b/sw/source/core/inc/node2lay.hxx
@@ -20,6 +20,7 @@
 #define INCLUDED_SW_SOURCE_CORE_INC_NODE2LAY_HXX
 
 #include <tools/solar.h>
+#include <memory>
 
 /**
  * This class connects the Nodes with the Layouts.
@@ -53,7 +54,7 @@ struct SwPosition;
 
 class SwNode2Layout
 {
-    SwNode2LayImpl *pImpl;
+    std::unique_ptr<SwNode2LayImpl> pImpl;
 public:
     /// Use this ctor for collecting the UpperFrms
     SwNode2Layout( const SwNode& rNd );
diff --git a/sw/source/filter/inc/msfilter.hxx b/sw/source/filter/inc/msfilter.hxx
index 5855235..0e213ed 100644
--- a/sw/source/filter/inc/msfilter.hxx
+++ b/sw/source/filter/inc/msfilter.hxx
@@ -23,6 +23,7 @@
 #include <set>
 #include <map>
 #include <vector>
+#include <memory>
 #include <swtypes.hxx>
 #include "wwstyles.hxx"
 #include <rtl/textenc.h>
@@ -180,7 +181,7 @@ namespace sw
         {
         private:
             //I hate these things stupid pImpl things, but its warranted here
-             ::myImplHelpers::StyleMapperImpl<SwTextFormatColl> *mpImpl;
+             std::unique_ptr<::myImplHelpers::StyleMapperImpl<SwTextFormatColl> > mpImpl;
         public:
             explicit ParaStyleMapper(SwDoc &rDoc);
             ~ParaStyleMapper();
diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx
index 229a757..a070676 100644
--- a/sw/source/filter/ww8/writerwordglue.cxx
+++ b/sw/source/filter/ww8/writerwordglue.cxx
@@ -460,7 +460,6 @@ namespace sw
 
         ParaStyleMapper::~ParaStyleMapper()
         {
-            delete mpImpl;
         }
 
         ParaStyleMapper::StyleResult ParaStyleMapper::GetStyle(
diff --git a/sw/source/filter/xml/xmlitmap.hxx b/sw/source/filter/xml/xmlitmap.hxx
index 00c7fca..3fffd77 100644
--- a/sw/source/filter/xml/xmlitmap.hxx
+++ b/sw/source/filter/xml/xmlitmap.hxx
@@ -23,6 +23,7 @@
 #include <sal/types.h>
 #include <tools/ref.hxx>
 #include <xmloff/xmltoken.hxx>
+#include <memory>
 
 #define MID_SW_FLAG_MASK                    0x0000ffff
 
@@ -58,7 +59,7 @@ class SvXMLItemMapEntries_impl;
 class SvXMLItemMapEntries : public SvRefBase
 {
 protected:
-    SvXMLItemMapEntries_impl* mpImpl;
+    std::unique_ptr<SvXMLItemMapEntries_impl> mpImpl;
 
 public:
     explicit SvXMLItemMapEntries(SvXMLItemMapEntry* pEntrys);
diff --git a/sw/source/filter/xml/xmlitmpr.cxx b/sw/source/filter/xml/xmlitmpr.cxx
index cec6e64..87f3b4d 100644
--- a/sw/source/filter/xml/xmlitmpr.cxx
+++ b/sw/source/filter/xml/xmlitmpr.cxx
@@ -32,8 +32,8 @@ public:
 };
 
 SvXMLItemMapEntries::SvXMLItemMapEntries( SvXMLItemMapEntry* pEntries )
+   : mpImpl( new SvXMLItemMapEntries_impl )
 {
-    mpImpl = new SvXMLItemMapEntries_impl;
     mpImpl->mpEntries = pEntries;
 
     mpImpl->mnCount = 0;
@@ -46,7 +46,6 @@ SvXMLItemMapEntries::SvXMLItemMapEntries( SvXMLItemMapEntry* pEntries )
 
 SvXMLItemMapEntries::~SvXMLItemMapEntries()
 {
-    delete mpImpl;
 }
 
 SvXMLItemMapEntry* SvXMLItemMapEntries::getByName(  sal_uInt16 nNameSpace,
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 66dd87c..3c441d2 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -804,7 +804,6 @@ SwDBManager::~SwDBManager()
             }
         }
     }
-    delete pImpl;
 }
 
 // save bulk letters as single documents
diff --git a/sw/source/uibase/dbui/mmconfigitem.cxx b/sw/source/uibase/dbui/mmconfigitem.cxx
index 5e43965..204b651 100644
--- a/sw/source/uibase/dbui/mmconfigitem.cxx
+++ b/sw/source/uibase/dbui/mmconfigitem.cxx
@@ -723,7 +723,7 @@ void SwMailMergeConfigItem_Impl::SetCurrentGreeting(
 
 namespace
 {
-    static SwMailMergeConfigItem_Impl* pOptions = nullptr;
+    static SwMailMergeConfigItem_Impl* g_pOptions = nullptr;
     static sal_Int32            nRefCount = 0;
 
     class theMailMergeConfigMutex : public rtl::Static<osl::Mutex, theMailMergeConfigMutex> {};
@@ -741,10 +741,9 @@ SwMailMergeConfigItem::SwMailMergeConfigItem() :
 {
     // Global access, must be guarded (multithreading)
     ::osl::MutexGuard aGuard( theMailMergeConfigMutex::get() );
-    if ( !pOptions )
-        pOptions = new SwMailMergeConfigItem_Impl;
+    if ( !g_pOptions )
+        g_pOptions = new SwMailMergeConfigItem_Impl;
     ++nRefCount;
-    m_pImpl = pOptions;
 }
 
 SwMailMergeConfigItem::~SwMailMergeConfigItem()
@@ -753,79 +752,79 @@ SwMailMergeConfigItem::~SwMailMergeConfigItem()
     ::osl::MutexGuard aGuard( theMailMergeConfigMutex::get() );
     if ( !--nRefCount )
     {
-        DELETEZ( pOptions );
+        DELETEZ( g_pOptions );
     }
 }
 
 void  SwMailMergeConfigItem::Commit()
 {
-    if(m_pImpl->IsModified())
-        m_pImpl->Commit();
+    if(g_pOptions->IsModified())
+        g_pOptions->Commit();
 }
 
 const ResStringArray&   SwMailMergeConfigItem::GetDefaultAddressHeaders() const
 {
-    return m_pImpl->m_AddressHeaderSA;
+    return g_pOptions->m_AddressHeaderSA;
 }
 
 void SwMailMergeConfigItem::SetAddressBlocks(
         const Sequence< OUString>& rBlocks)
 {
-    m_pImpl->SetAddressBlocks(rBlocks);
+    g_pOptions->SetAddressBlocks(rBlocks);
 }
 
 const Sequence< OUString> SwMailMergeConfigItem::GetAddressBlocks() const
 {
-    return m_pImpl->GetAddressBlocks();
+    return g_pOptions->GetAddressBlocks();
 }
 
 bool SwMailMergeConfigItem::IsAddressBlock()const
 {
-    return m_pImpl->m_bIsAddressBlock && IsOutputToLetter();
+    return g_pOptions->m_bIsAddressBlock && IsOutputToLetter();
 }
 
 void     SwMailMergeConfigItem::SetAddressBlock(bool bSet)
 {
-    m_pImpl->m_bUserSettingWereOverwritten = false;
-    if(m_pImpl->m_bIsAddressBlock != bSet)
+    g_pOptions->m_bUserSettingWereOverwritten = false;
+    if(g_pOptions->m_bIsAddressBlock != bSet)
     {
-        m_pImpl->m_bIsAddressBlock = bSet;
-        m_pImpl->SetModified();
+        g_pOptions->m_bIsAddressBlock = bSet;
+        g_pOptions->SetModified();
     }
 }
 
 bool SwMailMergeConfigItem::IsHideEmptyParagraphs() const
 {
-    return m_pImpl->m_bIsHideEmptyParagraphs;
+    return g_pOptions->m_bIsHideEmptyParagraphs;
 }
 
 void SwMailMergeConfigItem::SetHideEmptyParagraphs(bool bSet)
 {
-    if(m_pImpl->m_bIsHideEmptyParagraphs != bSet)
+    if(g_pOptions->m_bIsHideEmptyParagraphs != bSet)
     {
-        m_pImpl->m_bIsHideEmptyParagraphs = bSet;
-        m_pImpl->SetModified();
+        g_pOptions->m_bIsHideEmptyParagraphs = bSet;
+        g_pOptions->SetModified();
     }
 }
 
 bool SwMailMergeConfigItem::IsIncludeCountry() const
 {
-    return m_pImpl->m_bIncludeCountry;
+    return g_pOptions->m_bIncludeCountry;
 }
 
 OUString& SwMailMergeConfigItem::GetExcludeCountry() const
 {
-    return m_pImpl->m_sExcludeCountry;
+    return g_pOptions->m_sExcludeCountry;
 }
 
 void SwMailMergeConfigItem::SetCountrySettings(bool bSet, const OUString& rCountry)
 {
-    if(m_pImpl->m_sExcludeCountry != rCountry ||
-        m_pImpl->m_bIncludeCountry != bSet)
+    if(g_pOptions->m_sExcludeCountry != rCountry ||
+        g_pOptions->m_bIncludeCountry != bSet)
     {
-        m_pImpl->m_bIncludeCountry = bSet;
-        m_pImpl->m_sExcludeCountry = bSet ? rCountry : OUString();
-        m_pImpl->SetModified();
+        g_pOptions->m_bIncludeCountry = bSet;
+        g_pOptions->m_sExcludeCountry = bSet ? rCountry : OUString();
+        g_pOptions->SetModified();
     }
 }
 
@@ -835,64 +834,64 @@ void SwMailMergeConfigItem::SetCurrentConnection(
         Reference< XColumnsSupplier>  xColumnsSupplier,
         const SwDBData& rDBData)
 {
-        m_pImpl->m_xSource            = xSource         ;
-        m_pImpl->m_xConnection        = rConnection     ;
-        m_pImpl->m_xColumnsSupplier   = xColumnsSupplier;
-        m_pImpl->m_aDBData = rDBData;
-        m_pImpl->m_xResultSet         = nullptr;
-        m_pImpl->m_nResultSetCursorPos = 0;
-        m_pImpl->SetModified();
+        g_pOptions->m_xSource            = xSource         ;
+        g_pOptions->m_xConnection        = rConnection     ;
+        g_pOptions->m_xColumnsSupplier   = xColumnsSupplier;
+        g_pOptions->m_aDBData = rDBData;
+        g_pOptions->m_xResultSet         = nullptr;
+        g_pOptions->m_nResultSetCursorPos = 0;
+        g_pOptions->SetModified();
 }
 
 Reference< XDataSource>  SwMailMergeConfigItem::GetSource()
 {
-    return m_pImpl->m_xSource;
+    return g_pOptions->m_xSource;
 }
 
 SharedConnection SwMailMergeConfigItem::GetConnection()
 {
-    return m_pImpl->m_xConnection;
+    return g_pOptions->m_xConnection;
 }
 
 Reference< XColumnsSupplier> SwMailMergeConfigItem::GetColumnsSupplier()
 {
-    if(!m_pImpl->m_xColumnsSupplier.is() && m_pImpl->m_xConnection.is())
+    if(!g_pOptions->m_xColumnsSupplier.is() && g_pOptions->m_xConnection.is())
     {
-        m_pImpl->m_xColumnsSupplier = SwDBManager::GetColumnSupplier(m_pImpl->m_xConnection,
-                                m_pImpl->m_aDBData.sCommand,
-                                m_pImpl->m_aDBData.nCommandType == CommandType::TABLE ?
+        g_pOptions->m_xColumnsSupplier = SwDBManager::GetColumnSupplier(g_pOptions->m_xConnection,
+                                g_pOptions->m_aDBData.sCommand,
+                                g_pOptions->m_aDBData.nCommandType == CommandType::TABLE ?
                                         SwDBSelect::TABLE : SwDBSelect::QUERY );
     }
-    return m_pImpl->m_xColumnsSupplier;
+    return g_pOptions->m_xColumnsSupplier;
 }
 
 const SwDBData&    SwMailMergeConfigItem::GetCurrentDBData() const
 {
-    return m_pImpl->m_aDBData;
+    return g_pOptions->m_aDBData;
 }
 
 void SwMailMergeConfigItem::SetCurrentDBData( const SwDBData& rDBData)
 {
-    if(m_pImpl->m_aDBData != rDBData)
+    if(g_pOptions->m_aDBData != rDBData)
     {
-        m_pImpl->m_aDBData = rDBData;
-        m_pImpl->m_xConnection.clear();
-        m_pImpl->m_xSource = nullptr;
-        m_pImpl->m_xColumnsSupplier = nullptr;
-        m_pImpl->SetModified();
+        g_pOptions->m_aDBData = rDBData;
+        g_pOptions->m_xConnection.clear();
+        g_pOptions->m_xSource = nullptr;
+        g_pOptions->m_xColumnsSupplier = nullptr;
+        g_pOptions->SetModified();
     }
 }
 
 Reference< XResultSet>   SwMailMergeConfigItem::GetResultSet() const
 {
-    if(!m_pImpl->m_xConnection.is() && !m_pImpl->m_aDBData.sDataSource.isEmpty())
+    if(!g_pOptions->m_xConnection.is() && !g_pOptions->m_aDBData.sDataSource.isEmpty())
     {
-        m_pImpl->m_xConnection.reset(
-            SwDBManager::GetConnection( m_pImpl->m_aDBData.sDataSource, m_pImpl->m_xSource ),
+        g_pOptions->m_xConnection.reset(
+            SwDBManager::GetConnection( g_pOptions->m_aDBData.sDataSource, g_pOptions->m_xSource ),
             SharedConnection::TakeOwnership
         );
     }
-    if(!m_pImpl->m_xResultSet.is() && m_pImpl->m_xConnection.is())
+    if(!g_pOptions->m_xResultSet.is() && g_pOptions->m_xConnection.is())
     {
         try
         {
@@ -900,61 +899,61 @@ Reference< XResultSet>   SwMailMergeConfigItem::GetResultSet() const
 
             Reference<XRowSet> xRowSet( xMgr->createInstance("com.sun.star.sdb.RowSet"), UNO_QUERY );
             Reference<XPropertySet> xRowProperties(xRowSet, UNO_QUERY);
-            xRowProperties->setPropertyValue("DataSourceName", makeAny(m_pImpl->m_aDBData.sDataSource));
-            xRowProperties->setPropertyValue("Command", makeAny(m_pImpl->m_aDBData.sCommand));
-            xRowProperties->setPropertyValue("CommandType", makeAny(m_pImpl->m_aDBData.nCommandType));
+            xRowProperties->setPropertyValue("DataSourceName", makeAny(g_pOptions->m_aDBData.sDataSource));
+            xRowProperties->setPropertyValue("Command", makeAny(g_pOptions->m_aDBData.sCommand));
+            xRowProperties->setPropertyValue("CommandType", makeAny(g_pOptions->m_aDBData.nCommandType));
             xRowProperties->setPropertyValue("FetchSize", makeAny((sal_Int32)10));
-            xRowProperties->setPropertyValue("ActiveConnection", makeAny(m_pImpl->m_xConnection.getTyped()));
+            xRowProperties->setPropertyValue("ActiveConnection", makeAny(g_pOptions->m_xConnection.getTyped()));
             try
             {
-                xRowProperties->setPropertyValue("ApplyFilter", makeAny(!m_pImpl->m_sFilter.isEmpty()));
-                xRowProperties->setPropertyValue("Filter", makeAny(m_pImpl->m_sFilter));
+                xRowProperties->setPropertyValue("ApplyFilter", makeAny(!g_pOptions->m_sFilter.isEmpty()));
+                xRowProperties->setPropertyValue("Filter", makeAny(g_pOptions->m_sFilter));
             }
             catch (const Exception& e)
             {
                 SAL_WARN("sw.ui", "exception caught: " << e.Message);
             }
             xRowSet->execute();
-            m_pImpl->m_xResultSet = xRowSet.get();
-            m_pImpl->m_xResultSet->first();
-            m_pImpl->m_nResultSetCursorPos = 1;
+            g_pOptions->m_xResultSet = xRowSet.get();
+            g_pOptions->m_xResultSet->first();
+            g_pOptions->m_nResultSetCursorPos = 1;
         }
         catch (const Exception& e)
         {
             SAL_WARN("sw.ui", "exception caught in: SwMailMergeConfigItem::GetResultSet() " << e.Message);
         }
     }
-    return m_pImpl->m_xResultSet;
+    return g_pOptions->m_xResultSet;
 }
 
 void SwMailMergeConfigItem::DisposeResultSet()
 {
-    m_pImpl->m_xConnection.clear();
-    if(m_pImpl->m_xResultSet.is())
+    g_pOptions->m_xConnection.clear();
+    if(g_pOptions->m_xResultSet.is())
     {
-        ::comphelper::disposeComponent( m_pImpl->m_xResultSet );
+        ::comphelper::disposeComponent( g_pOptions->m_xResultSet );
     }
 }
 
 OUString&    SwMailMergeConfigItem::GetFilter() const
 {
-    return m_pImpl->m_sFilter;
+    return g_pOptions->m_sFilter;
 }
 
 void  SwMailMergeConfigItem::SetFilter(OUString& rFilter)
 {
-    if(m_pImpl->m_sFilter != rFilter)
+    if(g_pOptions->m_sFilter != rFilter)
     {
-        m_pImpl->m_sFilter = rFilter;
-        m_pImpl->SetModified();
-        Reference<XPropertySet> xRowProperties(m_pImpl->m_xResultSet, UNO_QUERY);
+        g_pOptions->m_sFilter = rFilter;
+        g_pOptions->SetModified();
+        Reference<XPropertySet> xRowProperties(g_pOptions->m_xResultSet, UNO_QUERY);
         if(xRowProperties.is())
         {
             try
             {
-                xRowProperties->setPropertyValue("ApplyFilter", makeAny(!m_pImpl->m_sFilter.isEmpty()));
-                xRowProperties->setPropertyValue("Filter", makeAny(m_pImpl->m_sFilter));
-                uno::Reference<XRowSet> xRowSet( m_pImpl->m_xResultSet, UNO_QUERY_THROW );
+                xRowProperties->setPropertyValue("ApplyFilter", makeAny(!g_pOptions->m_sFilter.isEmpty()));
+                xRowProperties->setPropertyValue("Filter", makeAny(g_pOptions->m_sFilter));
+                uno::Reference<XRowSet> xRowSet( g_pOptions->m_xResultSet, UNO_QUERY_THROW );
                 xRowSet->execute();
             }
             catch (const Exception& e)
@@ -967,49 +966,49 @@ void  SwMailMergeConfigItem::SetFilter(OUString& rFilter)
 
 sal_Int32 SwMailMergeConfigItem::MoveResultSet(sal_Int32 nTarget)
 {
-    if(!m_pImpl->m_xResultSet.is())
+    if(!g_pOptions->m_xResultSet.is())
         GetResultSet();
-    if(m_pImpl->m_xResultSet.is())
+    if(g_pOptions->m_xResultSet.is())
     {
         try
         {
             //no action if the resultset is already at the right position
-            if(m_pImpl->m_xResultSet->getRow() != nTarget)
+            if(g_pOptions->m_xResultSet->getRow() != nTarget)
             {
                 if(nTarget > 0)
                 {
-                    bool bMoved = m_pImpl->m_xResultSet->absolute(nTarget);
+                    bool bMoved = g_pOptions->m_xResultSet->absolute(nTarget);
                     if(!bMoved)
                     {
                         if(nTarget > 1)
-                            m_pImpl->m_xResultSet->last();
+                            g_pOptions->m_xResultSet->last();
                         else if(nTarget == 1)
-                            m_pImpl->m_xResultSet->first();
+                            g_pOptions->m_xResultSet->first();
                     }
                 }
                 else if(nTarget == -1)
-                    m_pImpl->m_xResultSet->last();
-                m_pImpl->m_nResultSetCursorPos = m_pImpl->m_xResultSet->getRow();
+                    g_pOptions->m_xResultSet->last();
+                g_pOptions->m_nResultSetCursorPos = g_pOptions->m_xResultSet->getRow();
             }
         }
         catch (const Exception&)
         {
         }
     }
-    return m_pImpl->m_nResultSetCursorPos;
+    return g_pOptions->m_nResultSetCursorPos;
 }
 
 bool SwMailMergeConfigItem::IsResultSetFirstLast(bool& bIsFirst, bool& bIsLast)
 {
     bool bRet = false;
-    if(!m_pImpl->m_xResultSet.is())
+    if(!g_pOptions->m_xResultSet.is())
         GetResultSet();
-    if(m_pImpl->m_xResultSet.is())
+    if(g_pOptions->m_xResultSet.is())
     {
         try
         {
-            bIsFirst = m_pImpl->m_xResultSet->isFirst();
-            bIsLast = m_pImpl->m_xResultSet->isLast();
+            bIsFirst = g_pOptions->m_xResultSet->isFirst();
+            bIsLast = g_pOptions->m_xResultSet->isLast();
             bRet = true;
         }
         catch (const Exception&)
@@ -1021,7 +1020,7 @@ bool SwMailMergeConfigItem::IsResultSetFirstLast(bool& bIsFirst, bool& bIsLast)
 
 sal_Int32 SwMailMergeConfigItem::GetResultSetPosition() const
 {
-    return m_pImpl->m_nResultSetCursorPos;
+    return g_pOptions->m_nResultSetCursorPos;
 }
 
 bool SwMailMergeConfigItem::IsRecordExcluded(sal_Int32 nRecord) const
@@ -1037,12 +1036,12 @@ void SwMailMergeConfigItem::ExcludeRecord(sal_Int32 nRecord, bool bExclude)
 
 uno::Sequence<uno::Any> SwMailMergeConfigItem::GetSelection() const
 {
-    if(!m_pImpl->m_xResultSet.is())
+    if(!g_pOptions->m_xResultSet.is())
         GetResultSet();
-    if(!m_pImpl->m_xResultSet.is())
+    if(!g_pOptions->m_xResultSet.is())
         return {};
-    m_pImpl->m_xResultSet->last();
-    sal_Int32 nResultSetSize = m_pImpl->m_xResultSet->getRow()+1;
+    g_pOptions->m_xResultSet->last();
+    sal_Int32 nResultSetSize = g_pOptions->m_xResultSet->getRow()+1;
     std::vector<uno::Any> vResult;
     vResult.reserve(nResultSetSize);
     for(sal_Int32 nIdx=1; nIdx<nResultSetSize;++nIdx)
@@ -1055,14 +1054,14 @@ uno::Sequence<uno::Any> SwMailMergeConfigItem::GetSelection() const
 const uno::Sequence< OUString>&
                     SwMailMergeConfigItem::GetSavedDocuments() const
 {
-    return m_pImpl->m_aSavedDocuments;
+    return g_pOptions->m_aSavedDocuments;
 }
 
 void SwMailMergeConfigItem::AddSavedDocument(const OUString& rName)
 {
-    const OUString* pDocs = m_pImpl->m_aSavedDocuments.getConstArray();
+    const OUString* pDocs = g_pOptions->m_aSavedDocuments.getConstArray();
     bool bFound = false;
-    for(sal_Int32 nDoc = 0; nDoc < m_pImpl->m_aSavedDocuments.getLength(); ++nDoc)
+    for(sal_Int32 nDoc = 0; nDoc < g_pOptions->m_aSavedDocuments.getLength(); ++nDoc)
     {
         if(pDocs[nDoc] == rName)
         {
@@ -1072,30 +1071,30 @@ void SwMailMergeConfigItem::AddSavedDocument(const OUString& rName)
     }
     if(!bFound)
     {
-        m_pImpl->m_aSavedDocuments.realloc(m_pImpl->m_aSavedDocuments.getLength() + 1);
-        m_pImpl->m_aSavedDocuments[m_pImpl->m_aSavedDocuments.getLength() - 1] = rName;
+        g_pOptions->m_aSavedDocuments.realloc(g_pOptions->m_aSavedDocuments.getLength() + 1);
+        g_pOptions->m_aSavedDocuments[g_pOptions->m_aSavedDocuments.getLength() - 1] = rName;
     }
 }
 
 bool SwMailMergeConfigItem::IsOutputToLetter()const
 {
-    return m_pImpl->m_bIsOutputToLetter || !IsMailAvailable();
+    return g_pOptions->m_bIsOutputToLetter || !IsMailAvailable();
 }
 
 void SwMailMergeConfigItem::SetOutputToLetter(bool bSet)
 {
-    if(m_pImpl->m_bIsOutputToLetter != bSet)
+    if(g_pOptions->m_bIsOutputToLetter != bSet)
     {
-        m_pImpl->m_bIsOutputToLetter = bSet;
-        m_pImpl->SetModified();
+        g_pOptions->m_bIsOutputToLetter = bSet;
+        g_pOptions->SetModified();
     }
 }
 
 bool SwMailMergeConfigItem::IsIndividualGreeting(bool bInEMail) const
 {
     return bInEMail ?
-            m_pImpl->m_bIsIndividualGreetingLineInMail :
-            m_pImpl->m_bIsIndividualGreetingLine;
+            g_pOptions->m_bIsIndividualGreetingLineInMail :
+            g_pOptions->m_bIsIndividualGreetingLine;
 }
 
 void     SwMailMergeConfigItem::SetIndividualGreeting(
@@ -1103,44 +1102,44 @@ void     SwMailMergeConfigItem::SetIndividualGreeting(
 {
     if(bInEMail)
     {
-        if(m_pImpl->m_bIsIndividualGreetingLineInMail != bSet)
+        if(g_pOptions->m_bIsIndividualGreetingLineInMail != bSet)
         {
-            m_pImpl->m_bIsIndividualGreetingLineInMail = bSet;
-            m_pImpl->SetModified();
+            g_pOptions->m_bIsIndividualGreetingLineInMail = bSet;
+            g_pOptions->SetModified();
         }
     }
     else
     {
-        if(m_pImpl->m_bIsIndividualGreetingLine != bSet)
+        if(g_pOptions->m_bIsIndividualGreetingLine != bSet)
         {
-            m_pImpl->m_bIsIndividualGreetingLine = bSet;
-            m_pImpl->SetModified();
+            g_pOptions->m_bIsIndividualGreetingLine = bSet;
+            g_pOptions->SetModified();
         }
     }
 }
 
 bool SwMailMergeConfigItem::IsGreetingLine(bool bInEMail) const
 {
-    return bInEMail ? m_pImpl->m_bIsGreetingLineInMail : m_pImpl->m_bIsGreetingLine;
+    return bInEMail ? g_pOptions->m_bIsGreetingLineInMail : g_pOptions->m_bIsGreetingLine;
 }
 
 void     SwMailMergeConfigItem::SetGreetingLine(bool bSet, bool bInEMail)
 {
-    m_pImpl->m_bUserSettingWereOverwritten = false;
+    g_pOptions->m_bUserSettingWereOverwritten = false;
     if(bInEMail)
     {
-        if(m_pImpl->m_bIsGreetingLineInMail != bSet)
+        if(g_pOptions->m_bIsGreetingLineInMail != bSet)
         {
-            m_pImpl->m_bIsGreetingLineInMail = bSet;
-            m_pImpl->SetModified();
+            g_pOptions->m_bIsGreetingLineInMail = bSet;
+            g_pOptions->SetModified();
         }
     }
     else
     {
-        if(m_pImpl->m_bIsGreetingLine != bSet)
+        if(g_pOptions->m_bIsGreetingLine != bSet)
         {
-            m_pImpl->m_bIsGreetingLine = bSet;
-            m_pImpl->SetModified();
+            g_pOptions->m_bIsGreetingLine = bSet;
+            g_pOptions->SetModified();
         }
     }
 }
@@ -1148,37 +1147,37 @@ void     SwMailMergeConfigItem::SetGreetingLine(bool bSet, bool bInEMail)
 const Sequence< OUString>   SwMailMergeConfigItem::GetGreetings(
         Gender eType ) const
 {
-    return m_pImpl->GetGreetings(eType);
+    return g_pOptions->GetGreetings(eType);
 }
 
 void  SwMailMergeConfigItem::SetGreetings(
         Gender eType, const Sequence< OUString>& rSetGreetings)
 {
-    m_pImpl->SetGreetings( eType, rSetGreetings);
+    g_pOptions->SetGreetings( eType, rSetGreetings);
 }
 
 sal_Int32 SwMailMergeConfigItem::GetCurrentGreeting(
                         SwMailMergeConfigItem::Gender eType) const
 {
-    return m_pImpl->GetCurrentGreeting(eType);
+    return g_pOptions->GetCurrentGreeting(eType);
 }
 
 void SwMailMergeConfigItem::SetCurrentGreeting(Gender eType, sal_Int32 nIndex)
 {
-    m_pImpl->SetCurrentGreeting(eType, nIndex);
+    g_pOptions->SetCurrentGreeting(eType, nIndex);
 }
 
 const OUString& SwMailMergeConfigItem::GetFemaleGenderValue() const
 {
-    return m_pImpl->m_sFemaleGenderValue;
+    return g_pOptions->m_sFemaleGenderValue;
 }
 
 void SwMailMergeConfigItem::SetFemaleGenderValue(const OUString& rValue)
 {
-    if( m_pImpl->m_sFemaleGenderValue != rValue )
+    if( g_pOptions->m_sFemaleGenderValue != rValue )
     {
-        m_pImpl->m_sFemaleGenderValue = rValue;
-        m_pImpl->SetModified();
+        g_pOptions->m_sFemaleGenderValue = rValue;
+        g_pOptions->SetModified();
     }
 }
 
@@ -1187,8 +1186,8 @@ Sequence< OUString> SwMailMergeConfigItem::GetColumnAssignment(
 {
     Sequence< OUString> aRet;
     ::std::vector<DBAddressDataAssignment>::iterator aAssignIter;
-    for(aAssignIter = m_pImpl->m_aAddressDataAssignments.begin();
-                aAssignIter != m_pImpl->m_aAddressDataAssignments.end(); ++aAssignIter)
+    for(aAssignIter = g_pOptions->m_aAddressDataAssignments.begin();
+                aAssignIter != g_pOptions->m_aAddressDataAssignments.end(); ++aAssignIter)
     {
         if(aAssignIter->aDBData == rDBData)
         {
@@ -1203,11 +1202,11 @@ Sequence< OUString> SwMailMergeConfigItem::GetColumnAssignment(
 OUString     SwMailMergeConfigItem::GetAssignedColumn(sal_uInt32 nColumn) const
 {
     OUString sRet;
-    Sequence< OUString> aAssignment = GetColumnAssignment( m_pImpl->m_aDBData );
+    Sequence< OUString> aAssignment = GetColumnAssignment( g_pOptions->m_aDBData );
     if(aAssignment.getLength() > sal::static_int_cast< sal_Int32, sal_uInt32>(nColumn) && !aAssignment[nColumn].isEmpty())
         sRet = aAssignment[nColumn];
-    else if(nColumn < m_pImpl->m_AddressHeaderSA.Count())
-        sRet = m_pImpl->m_AddressHeaderSA.GetString(nColumn);
+    else if(nColumn < g_pOptions->m_AddressHeaderSA.Count())
+        sRet = g_pOptions->m_AddressHeaderSA.GetString(nColumn);
     return sRet;
 }
 
@@ -1216,8 +1215,8 @@ void SwMailMergeConfigItem::SetColumnAssignment( const SwDBData& rDBData,
 {
     ::std::vector<DBAddressDataAssignment>::iterator aAssignIter;
     bool bFound = false;
-    for(aAssignIter = m_pImpl->m_aAddressDataAssignments.begin();
-                aAssignIter != m_pImpl->m_aAddressDataAssignments.end(); ++aAssignIter)
+    for(aAssignIter = g_pOptions->m_aAddressDataAssignments.begin();
+                aAssignIter != g_pOptions->m_aAddressDataAssignments.end(); ++aAssignIter)
     {
         if(aAssignIter->aDBData == rDBData)
         {
@@ -1236,9 +1235,9 @@ void SwMailMergeConfigItem::SetColumnAssignment( const SwDBData& rDBData,
         aAssignment.aDBData = rDBData;
         aAssignment.aDBColumnAssignments = rList;
         aAssignment.bColumnAssignmentsChanged = true;
-        m_pImpl->m_aAddressDataAssignments.push_back(aAssignment);
+        g_pOptions->m_aAddressDataAssignments.push_back(aAssignment);
     }
-    m_pImpl->SetModified();
+    g_pOptions->SetModified();
 }
 
 bool SwMailMergeConfigItem::IsAddressFieldsAssigned() const
@@ -1256,9 +1255,9 @@ bool SwMailMergeConfigItem::IsAddressFieldsAssigned() const
     const OUString* pAssignment = aAssignment.getConstArray();
     const Sequence< OUString> aBlocks = GetAddressBlocks();
 
-    if(aBlocks.getLength() <= m_pImpl->GetCurrentAddressBlockIndex())
+    if(aBlocks.getLength() <= g_pOptions->GetCurrentAddressBlockIndex())
         return false;
-    SwAddressIterator aIter(aBlocks[m_pImpl->GetCurrentAddressBlockIndex()]);
+    SwAddressIterator aIter(aBlocks[g_pOptions->GetCurrentAddressBlockIndex()]);
     while(aIter.HasMore())
     {
         SwMergeAddressItem aItem = aIter.Next();
@@ -1348,228 +1347,228 @@ bool SwMailMergeConfigItem::IsGreetingFieldsAssigned() const
 
 OUString     SwMailMergeConfigItem::GetMailDisplayName() const
 {
-    return m_pImpl->m_sMailDisplayName;
+    return g_pOptions->m_sMailDisplayName;
 }
 
 void SwMailMergeConfigItem::SetMailDisplayName(const OUString& rName)
 {
-    if(m_pImpl->m_sMailDisplayName != rName)
+    if(g_pOptions->m_sMailDisplayName != rName)
     {
-        m_pImpl->m_sMailDisplayName = rName;
-        m_pImpl->SetModified();
+        g_pOptions->m_sMailDisplayName = rName;
+        g_pOptions->SetModified();
     }
 }
 
 OUString     SwMailMergeConfigItem::GetMailAddress() const
 {
-    return m_pImpl->m_sMailAddress;
+    return g_pOptions->m_sMailAddress;
 }
 
 void SwMailMergeConfigItem::SetMailAddress(const OUString& rAddress)
 {
-    if(m_pImpl->m_sMailAddress != rAddress )
+    if(g_pOptions->m_sMailAddress != rAddress )
     {
-        m_pImpl->m_sMailAddress = rAddress;
-        m_pImpl->SetModified();
+        g_pOptions->m_sMailAddress = rAddress;
+        g_pOptions->SetModified();
     }
 }
 
 bool SwMailMergeConfigItem::IsMailReplyTo() const
 {
-    return m_pImpl->m_bIsMailReplyTo;
+    return g_pOptions->m_bIsMailReplyTo;
 }
 
 void  SwMailMergeConfigItem::SetMailReplyTo(bool bSet)
 {
-    if(m_pImpl->m_bIsMailReplyTo != bSet)
+    if(g_pOptions->m_bIsMailReplyTo != bSet)
     {
-        m_pImpl->m_bIsMailReplyTo = bSet;
-        m_pImpl->SetModified();
+        g_pOptions->m_bIsMailReplyTo = bSet;
+        g_pOptions->SetModified();
     }
 }
 
 OUString     SwMailMergeConfigItem::GetMailReplyTo() const
 {
-    return m_pImpl->m_sMailReplyTo;
+    return g_pOptions->m_sMailReplyTo;
 }
 
 void SwMailMergeConfigItem::SetMailReplyTo(const OUString& rReplyTo)
 {
-    if(m_pImpl->m_sMailReplyTo != rReplyTo)
+    if(g_pOptions->m_sMailReplyTo != rReplyTo)
     {
-        m_pImpl->m_sMailReplyTo = rReplyTo;
-        m_pImpl->SetModified();
+        g_pOptions->m_sMailReplyTo = rReplyTo;
+        g_pOptions->SetModified();
     }
 }
 
 OUString  SwMailMergeConfigItem::GetMailServer() const
 {
-    return m_pImpl->m_sMailServer;
+    return g_pOptions->m_sMailServer;
 }
 
 void SwMailMergeConfigItem::SetMailServer(const OUString& rAddress)
 {
-    if(m_pImpl->m_sMailServer != rAddress)
+    if(g_pOptions->m_sMailServer != rAddress)
     {
-        m_pImpl->m_sMailServer = rAddress;
-        m_pImpl->SetModified();
+        g_pOptions->m_sMailServer = rAddress;
+        g_pOptions->SetModified();
     }
 }
 
 sal_Int16 SwMailMergeConfigItem::GetMailPort() const
 {
-    return m_pImpl->m_bIsDefaultPort ?
-             (m_pImpl->m_bIsSecureConnection ? SECURE_PORT : DEFAULT_PORT) :
-             m_pImpl->m_nMailPort;
+    return g_pOptions->m_bIsDefaultPort ?
+             (g_pOptions->m_bIsSecureConnection ? SECURE_PORT : DEFAULT_PORT) :
+             g_pOptions->m_nMailPort;
 }
 
 void     SwMailMergeConfigItem::SetMailPort(sal_Int16 nSet)
 {
-    if(m_pImpl->m_nMailPort != nSet || m_pImpl->m_bIsDefaultPort)
+    if(g_pOptions->m_nMailPort != nSet || g_pOptions->m_bIsDefaultPort)
     {
-        m_pImpl->m_nMailPort = nSet;
-        m_pImpl->m_bIsDefaultPort = false;
-        m_pImpl->SetModified();
+        g_pOptions->m_nMailPort = nSet;
+        g_pOptions->m_bIsDefaultPort = false;
+        g_pOptions->SetModified();
     }
 }
 
 bool SwMailMergeConfigItem::IsSecureConnection() const
 {
-    return m_pImpl->m_bIsSecureConnection;
+    return g_pOptions->m_bIsSecureConnection;
 }
 
 void     SwMailMergeConfigItem::SetSecureConnection(bool bSet)
 {
-    if(m_pImpl->m_bIsSecureConnection != bSet)
+    if(g_pOptions->m_bIsSecureConnection != bSet)
     {
-        m_pImpl->m_bIsSecureConnection = bSet;
-        m_pImpl->SetModified();
+        g_pOptions->m_bIsSecureConnection = bSet;
+        g_pOptions->SetModified();
     }
 }
 
 bool SwMailMergeConfigItem::IsAuthentication() const
 {
-    return m_pImpl->m_bIsAuthentication;
+    return g_pOptions->m_bIsAuthentication;
 }
 
 void SwMailMergeConfigItem::SetAuthentication(bool bSet)
 {
-    if(m_pImpl->m_bIsAuthentication != bSet)
+    if(g_pOptions->m_bIsAuthentication != bSet)
     {
-        m_pImpl->m_bIsAuthentication = bSet;
-        m_pImpl->SetModified();
+        g_pOptions->m_bIsAuthentication = bSet;
+        g_pOptions->SetModified();
     }
 }
 
 OUString     SwMailMergeConfigItem::GetMailUserName() const
 {
-    return m_pImpl->m_sMailUserName;
+    return g_pOptions->m_sMailUserName;
 }
 
 void SwMailMergeConfigItem::SetMailUserName(const OUString& rName)
 {
-    if(m_pImpl->m_sMailUserName != rName)
+    if(g_pOptions->m_sMailUserName != rName)
     {
-        m_pImpl->m_sMailUserName = rName;
-        m_pImpl->SetModified();
+        g_pOptions->m_sMailUserName = rName;
+        g_pOptions->SetModified();
     }
 }
 
 OUString     SwMailMergeConfigItem::GetMailPassword() const
 {
-    return m_pImpl->m_sMailPassword;
+    return g_pOptions->m_sMailPassword;
 }
 
 void SwMailMergeConfigItem::SetMailPassword(const OUString& rPassword)
 {
-    if(m_pImpl->m_sMailPassword != rPassword)
+    if(g_pOptions->m_sMailPassword != rPassword)
     {
-        m_pImpl->m_sMailPassword = rPassword;
-        m_pImpl->SetModified();
+        g_pOptions->m_sMailPassword = rPassword;
+        g_pOptions->SetModified();
     }
 }
 
 bool SwMailMergeConfigItem::IsSMTPAfterPOP() const
 {
-    return m_pImpl->m_bIsSMPTAfterPOP;
+    return g_pOptions->m_bIsSMPTAfterPOP;
 }
 
 void SwMailMergeConfigItem::SetSMTPAfterPOP(bool bSet)
 {
-    if( m_pImpl->m_bIsSMPTAfterPOP != bSet)
+    if( g_pOptions->m_bIsSMPTAfterPOP != bSet)
     {
-        m_pImpl->m_bIsSMPTAfterPOP = bSet;
-        m_pImpl->SetModified();
+        g_pOptions->m_bIsSMPTAfterPOP = bSet;
+        g_pOptions->SetModified();
     }
 }
 
 OUString     SwMailMergeConfigItem::GetInServerName() const
 {
-    return m_pImpl->m_sInServerName;
+    return g_pOptions->m_sInServerName;
 }
 
 void SwMailMergeConfigItem::SetInServerName(const OUString& rServer)
 {
-    if(m_pImpl->m_sInServerName != rServer)
+    if(g_pOptions->m_sInServerName != rServer)
     {
-        m_pImpl->m_sInServerName = rServer;
-        m_pImpl->SetModified();
+        g_pOptions->m_sInServerName = rServer;
+        g_pOptions->SetModified();
     }
 }
 
 sal_Int16           SwMailMergeConfigItem::GetInServerPort() const
 {
-    return m_pImpl->m_nInServerPort;
+    return g_pOptions->m_nInServerPort;
 }
 
 void SwMailMergeConfigItem::SetInServerPort(sal_Int16 nSet)
 {
-    if( m_pImpl->m_nInServerPort != nSet)
+    if( g_pOptions->m_nInServerPort != nSet)
     {
-        m_pImpl->m_nInServerPort = nSet;
-        m_pImpl->SetModified();
+        g_pOptions->m_nInServerPort = nSet;
+        g_pOptions->SetModified();
     }
 }
 
 bool SwMailMergeConfigItem::IsInServerPOP() const
 {
-    return m_pImpl->m_bInServerPOP;
+    return g_pOptions->m_bInServerPOP;
 }
 
 void SwMailMergeConfigItem::SetInServerPOP(bool bSet)
 {
-    if( m_pImpl->m_bInServerPOP != bSet)
+    if( g_pOptions->m_bInServerPOP != bSet)
     {
-        m_pImpl->m_bInServerPOP = bSet;
-        m_pImpl->SetModified();
+        g_pOptions->m_bInServerPOP = bSet;
+        g_pOptions->SetModified();
     }
 }
 
 OUString     SwMailMergeConfigItem::GetInServerUserName() const
 {
-    return m_pImpl->m_sInServerUserName;
+    return g_pOptions->m_sInServerUserName;
 }
 
 void SwMailMergeConfigItem::SetInServerUserName(const OUString& rName)
 {
-    if( m_pImpl->m_sInServerUserName != rName)
+    if( g_pOptions->m_sInServerUserName != rName)
     {
-        m_pImpl->m_sInServerUserName = rName;
-        m_pImpl->SetModified();
+        g_pOptions->m_sInServerUserName = rName;
+        g_pOptions->SetModified();
     }
 }
 
 OUString     SwMailMergeConfigItem::GetInServerPassword() const
 {
-    return m_pImpl->m_sInServerPassword;
+    return g_pOptions->m_sInServerPassword;
 }
 
 void SwMailMergeConfigItem::SetInServerPassword(const OUString& rPassword)
 {
-    if(m_pImpl->m_sInServerPassword != rPassword)
+    if(g_pOptions->m_sInServerPassword != rPassword)
     {
-        m_pImpl->m_sInServerPassword = rPassword;
-        m_pImpl->SetModified();
+        g_pOptions->m_sInServerPassword = rPassword;
+        g_pOptions->SetModified();
     }
 }
 
@@ -1583,23 +1582,23 @@ void SwMailMergeConfigItem::DocumentReloaded()
 
 bool SwMailMergeConfigItem::IsMailAvailable() const
 {
-    return m_pImpl->m_bIsEMailSupported;
+    return g_pOptions->m_bIsEMailSupported;
 }
 
 void SwMailMergeConfigItem::AddMergedDocument(SwDocMergeInfo& rInfo)
 {
-    m_pImpl->m_aMergeInfos.push_back(rInfo);
+    g_pOptions->m_aMergeInfos.push_back(rInfo);
 }
 
 SwDocMergeInfo& SwMailMergeConfigItem::GetDocumentMergeInfo(sal_uInt32 nDocument)
 {
-    assert(nDocument < m_pImpl->m_aMergeInfos.size());
-    return m_pImpl->m_aMergeInfos[nDocument];
+    assert(nDocument < g_pOptions->m_aMergeInfos.size());
+    return g_pOptions->m_aMergeInfos[nDocument];
 }
 
 sal_uInt32 SwMailMergeConfigItem::GetMergedDocumentCount() const
 {
-    return m_pImpl->m_aMergeInfos.size();
+    return g_pOptions->m_aMergeInfos.size();
 }
 
 static SwView* lcl_ExistsView(SwView* pView)
@@ -1631,7 +1630,7 @@ void  SwMailMergeConfigItem::SetTargetView(SwView* pView)
     //reset the document merge counter
     if(!m_pTargetView)
     {
-        m_pImpl->m_aMergeInfos.clear();
+        g_pOptions->m_aMergeInfos.clear();
     }
 }
 
@@ -1653,47 +1652,47 @@ void SwMailMergeConfigItem::SetSourceView(SwView* pView)
         if(!aDBNameList.empty())
         {
             // if fields are available there is usually no need of an addressblock and greeting
-            if(!m_pImpl->m_bUserSettingWereOverwritten)
+            if(!g_pOptions->m_bUserSettingWereOverwritten)
             {
-                if( m_pImpl->m_bIsAddressBlock
-                    || m_pImpl->m_bIsGreetingLineInMail
-                    || m_pImpl->m_bIsGreetingLine )
+                if( g_pOptions->m_bIsAddressBlock
+                    || g_pOptions->m_bIsGreetingLineInMail
+                    || g_pOptions->m_bIsGreetingLine )
                 {
                     //store user settings
-                    m_pImpl->m_bUserSettingWereOverwritten = true;
-                    m_pImpl->m_bIsAddressBlock_LastUserSetting = m_pImpl->m_bIsAddressBlock;
-                    m_pImpl->m_bIsGreetingLineInMail_LastUserSetting = m_pImpl->m_bIsGreetingLineInMail;
-                    m_pImpl->m_bIsGreetingLine_LastUserSetting = m_pImpl->m_bIsGreetingLine;
+                    g_pOptions->m_bUserSettingWereOverwritten = true;
+                    g_pOptions->m_bIsAddressBlock_LastUserSetting = g_pOptions->m_bIsAddressBlock;
+                    g_pOptions->m_bIsGreetingLineInMail_LastUserSetting = g_pOptions->m_bIsGreetingLineInMail;
+                    g_pOptions->m_bIsGreetingLine_LastUserSetting = g_pOptions->m_bIsGreetingLine;
 
                     //set all to false
-                    m_pImpl->m_bIsAddressBlock = false;
-                    m_pImpl->m_bIsGreetingLineInMail = false;
-                    m_pImpl->m_bIsGreetingLine = false;
+                    g_pOptions->m_bIsAddressBlock = false;
+                    g_pOptions->m_bIsGreetingLineInMail = false;
+                    g_pOptions->m_bIsGreetingLine = false;
 
-                    m_pImpl->SetModified();
+                    g_pOptions->SetModified();
                 }
             }
         }
-        else if( m_pImpl->m_bUserSettingWereOverwritten )
+        else if( g_pOptions->m_bUserSettingWereOverwritten )
         {
             //restore last user settings:
-            m_pImpl->m_bIsAddressBlock = m_pImpl->m_bIsAddressBlock_LastUserSetting;
-            m_pImpl->m_bIsGreetingLineInMail = m_pImpl->m_bIsGreetingLineInMail_LastUserSetting;
-            m_pImpl->m_bIsGreetingLine = m_pImpl->m_bIsGreetingLine_LastUserSetting;
+            g_pOptions->m_bIsAddressBlock = g_pOptions->m_bIsAddressBlock_LastUserSetting;
+            g_pOptions->m_bIsGreetingLineInMail = g_pOptions->m_bIsGreetingLineInMail_LastUserSetting;
+            g_pOptions->m_bIsGreetingLine = g_pOptions->m_bIsGreetingLine_LastUserSetting;
 
-            m_pImpl->m_bUserSettingWereOverwritten = false;
+            g_pOptions->m_bUserSettingWereOverwritten = false;
         }
     }
 }
 
 void SwMailMergeConfigItem::SetCurrentAddressBlockIndex( sal_Int32 nSet )
 {
-    m_pImpl->SetCurrentAddressBlockIndex( nSet );
+    g_pOptions->SetCurrentAddressBlockIndex( nSet );
 }
 
 sal_Int32 SwMailMergeConfigItem::GetCurrentAddressBlockIndex() const
 {
-    return m_pImpl->GetCurrentAddressBlockIndex();
+    return g_pOptions->GetCurrentAddressBlockIndex();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/inc/mmconfigitem.hxx b/sw/source/uibase/inc/mmconfigitem.hxx
index 7637bfb..4ce4d4b 100644
--- a/sw/source/uibase/inc/mmconfigitem.hxx
+++ b/sw/source/uibase/inc/mmconfigitem.hxx
@@ -37,7 +37,6 @@ namespace com{namespace sun{namespace star{
     }
 }}}
 
-class SwMailMergeConfigItem_Impl;
 class SwView;
 namespace sw { namespace mark { class IMark; }}
 
@@ -49,7 +48,6 @@ struct SwDocMergeInfo
 
 class SW_DLLPUBLIC SwMailMergeConfigItem
 {
-    SwMailMergeConfigItem_Impl* m_pImpl;
     //session information - not stored in configuration
     bool m_bAddressInserted;
     bool m_bMergeDone;
diff --git a/sw/source/uibase/inc/viewlayoutctrl.hxx b/sw/source/uibase/inc/viewlayoutctrl.hxx
index 240dbb0..f03da37 100644
--- a/sw/source/uibase/inc/viewlayoutctrl.hxx
+++ b/sw/source/uibase/inc/viewlayoutctrl.hxx
@@ -20,13 +20,14 @@
 #define INCLUDED_SW_SOURCE_UIBASE_INC_VIEWLAYOUTCTRL_HXX
 
 #include <sfx2/stbitem.hxx>
+#include <memory>
 
 class SwViewLayoutControl : public SfxStatusBarControl
 {
 private:
 
     struct SwViewLayoutControl_Impl;
-    SwViewLayoutControl_Impl* mpImpl;
+    std::unique_ptr<SwViewLayoutControl_Impl> mpImpl;
 
 public:
 
diff --git a/sw/source/uibase/utlui/viewlayoutctrl.cxx b/sw/source/uibase/utlui/viewlayoutctrl.cxx
index 7bbcc69..3721c97 100644
--- a/sw/source/uibase/utlui/viewlayoutctrl.cxx
+++ b/sw/source/uibase/utlui/viewlayoutctrl.cxx
@@ -79,7 +79,6 @@ SwViewLayoutControl::SwViewLayoutControl( sal_uInt16 _nSlotId, sal_uInt16 _nId,
 
 SwViewLayoutControl::~SwViewLayoutControl()
 {
-    delete mpImpl;
 }
 
 void SwViewLayoutControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState )
commit 048a32d903c8cc81a8836c7c7209b92e0bfd6cd7
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Nov 17 11:05:49 2015 +0200

    use unique_ptr for pImpl in tools/
    
    Change-Id: I7ac7eca32a67524f6c87696c16b16128e6d8518b

diff --git a/include/tools/errinf.hxx b/include/tools/errinf.hxx
index 950a65e..28c1c26 100644
--- a/include/tools/errinf.hxx
+++ b/include/tools/errinf.hxx
@@ -26,6 +26,7 @@
 #include <rtl/ustring.hxx>
 #include <tools/errcode.hxx>
 #include <tools/toolsdllapi.h>
+#include <memory>
 
 // FIXME: horrible legacy dependency on VCL from tools.
 namespace vcl { class Window; }
@@ -54,7 +55,7 @@ class TOOLS_DLLPUBLIC DynamicErrorInfo : public ErrorInfo
     friend class EDcr_Impl;
 
 private:
-    EDcr_Impl*              pImpl;
+    std::unique_ptr<EDcr_Impl>   pImpl;
 
 public:
 
@@ -117,7 +118,7 @@ class TOOLS_DLLPUBLIC ErrorContext
     friend class ErrorHandler;
 
 private:
-    ErrorContextImpl *pImpl;
+    std::unique_ptr<ErrorContextImpl> pImpl;
 
 public:
                             ErrorContext(vcl::Window *pWin=nullptr);
@@ -140,7 +141,7 @@ class TOOLS_DLLPUBLIC ErrorHandler
     friend class ErrHdl_Impl;
 
 private:
-    ErrHdl_Impl*        pImpl;
+    std::unique_ptr<ErrHdl_Impl>  pImpl;
 
     static sal_uInt16   HandleError_Impl( sal_uIntPtr lId,
                               sal_uInt16 nFlags,
diff --git a/include/tools/fract.hxx b/include/tools/fract.hxx
index 93663ac..efa7a17 100644
--- a/include/tools/fract.hxx
+++ b/include/tools/fract.hxx
@@ -21,6 +21,7 @@
 
 #include <sal/types.h>
 #include <tools/toolsdllapi.h>
+#include <memory>
 
 class SvStream;
 
@@ -30,7 +31,7 @@ class TOOLS_DLLPUBLIC SAL_WARN_UNUSED Fraction
 {
     struct Impl;
 
-    Impl* mpImpl;
+    std::unique_ptr<Impl> mpImpl;
 
     bool            HasOverflowValue();
 
diff --git a/include/tools/resary.hxx b/include/tools/resary.hxx
index 4e15feb..0cec8eb 100644
--- a/include/tools/resary.hxx
+++ b/include/tools/resary.hxx
@@ -21,6 +21,7 @@
 
 #include <tools/toolsdllapi.h>
 #include <rtl/ustring.hxx>
+#include <memory>
 
 #define RESARRAY_INDEX_NOTFOUND (0xffffffff)
 
@@ -29,7 +30,7 @@ class ResId;
 class TOOLS_DLLPUBLIC ResStringArray
 {
     struct Impl;
-    Impl* mpImpl;
+    std::unique_ptr<Impl> mpImpl;
 
     ResStringArray( const ResStringArray& ) = delete;
     ResStringArray& operator=( const ResStringArray& ) = delete;
diff --git a/tools/source/generic/fract.cxx b/tools/source/generic/fract.cxx
index 72ce43d..d2c60b8 100644
--- a/tools/source/generic/fract.cxx
+++ b/tools/source/generic/fract.cxx
@@ -90,7 +90,6 @@ Fraction::Fraction( double dVal ) : mpImpl(new Impl)
 
 Fraction::~Fraction()
 {
-    delete mpImpl;
 }
 
 bool Fraction::HasOverflowValue()
diff --git a/tools/source/rc/resary.cxx b/tools/source/rc/resary.cxx
index 03854d3..078b5a6 100644
--- a/tools/source/rc/resary.cxx
+++ b/tools/source/rc/resary.cxx
@@ -70,7 +70,6 @@ ResStringArray::ResStringArray( const ResId& rResId ) :
 
 ResStringArray::~ResStringArray()
 {
-    delete mpImpl;
 }
 
 OUString ResStringArray::GetString( sal_uInt32 nIndex ) const
diff --git a/tools/source/ref/errinf.cxx b/tools/source/ref/errinf.cxx
index 61efff4..5e589ba 100644
--- a/tools/source/ref/errinf.cxx
+++ b/tools/source/ref/errinf.cxx
@@ -116,9 +116,9 @@ DynamicErrorInfo::operator sal_uIntPtr() const
 }
 
 DynamicErrorInfo::DynamicErrorInfo(sal_uIntPtr lArgUserId, sal_uInt16 nMask)
-: ErrorInfo(lArgUserId)
+: ErrorInfo(lArgUserId),
+  pImpl(new EDcr_Impl)
 {
-    pImpl=new EDcr_Impl;
     pImpl->RegisterEDcr(this);
     pImpl->nMask=nMask;
 }
@@ -126,7 +126,6 @@ DynamicErrorInfo::DynamicErrorInfo(sal_uIntPtr lArgUserId, sal_uInt16 nMask)
 DynamicErrorInfo::~DynamicErrorInfo()
 {
     EDcr_Impl::UnRegisterEDcr(this);
-    delete pImpl;
 }
 
 ErrorInfo* EDcr_Impl::GetDynamicErrorInfo(sal_uIntPtr lId)
@@ -175,8 +174,8 @@ struct ErrorContextImpl
 };
 
 ErrorContext::ErrorContext(vcl::Window *pWinP)
+    : pImpl( new ErrorContextImpl )
 {
-    pImpl = new ErrorContextImpl();
     ErrorContext *&pHdl = TheEDcrData::get().pFirstCtx;
     pImpl->pWin = pWinP;
     pImpl->pNext = pHdl;
@@ -190,7 +189,6 @@ ErrorContext::~ErrorContext()
         ppCtx=&((*ppCtx)->pImpl->pNext);
     if(*ppCtx)
         *ppCtx=(*ppCtx)->pImpl->pNext;
-    delete pImpl;
 }
 
 ErrorContext *ErrorContext::GetContext()
@@ -199,8 +197,8 @@ ErrorContext *ErrorContext::GetContext()
 }
 
 ErrorHandler::ErrorHandler()
+    : pImpl(new ErrHdl_Impl)
 {
-    pImpl=new ErrHdl_Impl;
     EDcrData &pData=TheEDcrData::get();
     ErrorHandler *&pHdl=pData.pFirstHdl;
     pImpl->pNext=pHdl;
@@ -216,7 +214,6 @@ ErrorHandler::~ErrorHandler()
         ppHdl=&((*ppHdl)->pImpl->pNext);
     if(*ppHdl)
         *ppHdl=(*ppHdl)->pImpl->pNext;
-    delete pImpl;
 }
 
 vcl::Window* ErrorContext::GetParent()


More information about the Libreoffice-commits mailing list