[Libreoffice-commits] core.git: 2 commits - include/svl svl/source

Michael Stahl mstahl at redhat.com
Fri Oct 7 15:54:11 UTC 2016


 include/svl/svdde.hxx       |   15 -----------
 svl/source/svdde/ddeimp.hxx |    3 ++
 svl/source/svdde/ddesvr.cxx |   56 +++++++++++++++++++++++++-------------------
 3 files changed, 35 insertions(+), 39 deletions(-)

New commits:
commit d211dafa9e35d9af26acc274b18a32b8ca0b937a
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Oct 7 17:44:02 2016 +0200

    svl: remove #include windows.h from svdde.hxx
    
    Move Win32 stuff over to DdeInternal class where it can be better
    encapsulated.
    
    Change-Id: Ia3d4c72cf7ad1b7d54bef5d175c579cd426407e7

diff --git a/include/svl/svdde.hxx b/include/svl/svdde.hxx
index 0e8b960..766430f 100644
--- a/include/svl/svdde.hxx
+++ b/include/svl/svdde.hxx
@@ -28,13 +28,6 @@
 #include <tools/link.hxx>
 #include <vector>
 
-#if defined _WIN32
-#include <prewin.h>
-#include <windows.h>
-#include <postwin.h>
-#include <ddeml.h>
-#endif
-
 class DdeString;
 class DdeData;
 class DdeConnection;
@@ -213,11 +206,6 @@ class SVL_DLLPUBLIC DdeItem
     DdeTopic*       pMyTopic;
     DdeItemImp*     pImpData;
 
-#if defined _WIN32
-    void            IncMonitor( HCONV );
-    void            DecMonitor( HCONV );
-#endif
-
 protected:
     sal_uInt8            nType;
 
@@ -248,9 +236,6 @@ public:
 
 class SVL_DLLPUBLIC DdeTopic
 {
-#if defined _WIN32
-    SVL_DLLPRIVATE void Disconnect( HCONV );
-#endif
 
 public:
     virtual DdeData* Get(SotClipboardFormatId);
diff --git a/svl/source/svdde/ddeimp.hxx b/svl/source/svdde/ddeimp.hxx
index 492f1dc..28f611b 100644
--- a/svl/source/svdde/ddeimp.hxx
+++ b/svl/source/svdde/ddeimp.hxx
@@ -49,6 +49,9 @@ public:
     static DdeService*      FindService( HSZ );
     static DdeTopic*        FindTopic( DdeService&, HSZ );
     static DdeItem*         FindItem( DdeTopic&, HSZ );
+    static void DisconnectTopic(DdeTopic &, HCONV);
+    static void IncMonitor(DdeItem *pItem, HCONV);
+    static void DecMonitor(DdeItem *pItem, HCONV);
 };
 
 
diff --git a/svl/source/svdde/ddesvr.cxx b/svl/source/svdde/ddesvr.cxx
index 3607036..213990e 100644
--- a/svl/source/svdde/ddesvr.cxx
+++ b/svl/source/svdde/ddesvr.cxx
@@ -194,7 +194,7 @@ HDDEDATA CALLBACK DdeInternal::SvrCallback(
 found:
     if ( nCode == XTYP_DISCONNECT)
     {
-        pC->pTopic->Disconnect( hConv );
+        DisconnectTopic(*pC->pTopic, hConv);
         for ( ConvList::iterator it = pService->pConv->begin();
               it != pService->pConv->end();
               ++it
@@ -326,13 +326,13 @@ found:
 
             if (pItem)
             {
-                pItem->IncMonitor( hConv );
+                IncMonitor(pItem, hConv);
             }
         }
         return (HDDEDATA)sal_True;
 
     case XTYP_ADVSTOP:
-        pItem->DecMonitor( hConv );
+        DecMonitor(pItem, hConv);
         return (HDDEDATA)sal_True;
 
     case XTYP_EXECUTE:
@@ -669,11 +669,13 @@ void DdeTopic::NotifyClient( const OUString& rItem )
     }
 }
 
-void DdeTopic::Disconnect( HCONV nId )
+void DdeInternal::DisconnectTopic(DdeTopic & rTopic, HCONV nId)
 {
     std::vector<DdeItem*>::iterator iter;
-    for (iter = aItems.begin(); iter != aItems.end(); ++iter)
-        (*iter)->DecMonitor( nId );
+    for (iter = rTopic.aItems.begin(); iter != rTopic.aItems.end(); ++iter)
+    {
+        DecMonitor(*iter, nId);
+    }
 }
 
 DdeData* DdeTopic::Get(SotClipboardFormatId /*nFmt*/)
@@ -750,47 +752,53 @@ void DdeItem::NotifyClient()
     }
 }
 
-void DdeItem::IncMonitor( HCONV nHCnv )
+void DdeInternal::IncMonitor(DdeItem *const pItem, HCONV nHCnv)
 {
-    if( !pImpData )
+    if (!pItem->pImpData)
     {
-        pImpData = new DdeItemImp;
-        if( DDEGETPUTITEM == nType )
-            ((DdeGetPutItem*)this)->AdviseLoop( true );
+        pItem->pImpData = new DdeItemImp;
+        if (DDEGETPUTITEM == pItem->nType)
+        {
+            static_cast<DdeGetPutItem*>(pItem)->AdviseLoop( true );
+        }
     }
     else
     {
-        for( sal_uInt16 n = pImpData->size(); n; )
-            if( (*pImpData)[ --n ].nHCnv == nHCnv )
+        for (size_t n = pItem->pImpData->size(); n; )
+        {
+            if ((*pItem->pImpData)[ --n ].nHCnv == nHCnv)
             {
-                ++(*pImpData)[ n ].nHCnv;
+                ++(*pItem->pImpData)[ n ].nHCnv;
                 return ;
             }
+        }
     }
 
-    pImpData->push_back( DdeItemImpData( nHCnv ) );
+    pItem->pImpData->push_back( DdeItemImpData( nHCnv ) );
 }
 
-void DdeItem::DecMonitor( HCONV nHCnv )
+void DdeInternal::DecMonitor(DdeItem *const pItem, HCONV nHCnv)
 {
-    if( pImpData )
+    if (pItem->pImpData)
     {
-        for( sal_uInt16 n = 0; n < pImpData->size(); ++n )
+        for( sal_uInt16 n = 0; n < pItem->pImpData->size(); ++n )
         {
-            DdeItemImpData* pData = &(*pImpData)[n];
+            DdeItemImpData* pData = &(*pItem->pImpData)[n];
             if( pData->nHCnv == nHCnv )
             {
                 if( !pData->nCnt || !--pData->nCnt )
                 {
-                    if( 1 < pImpData->size() )
+                    if (1 < pItem->pImpData->size())
                     {
-                        pImpData->erase(pImpData->begin() + n);
+                        pItem->pImpData->erase(pItem->pImpData->begin() + n);
                     }
                     else
                     {
-                        delete pImpData, pImpData = 0;
-                        if( DDEGETPUTITEM == nType )
-                            ((DdeGetPutItem*)this)->AdviseLoop( false );
+                        delete pItem->pImpData, pItem->pImpData = 0;
+                        if (DDEGETPUTITEM == pItem->nType)
+                        {
+                            static_cast<DdeGetPutItem*>(pItem)->AdviseLoop(false);
+                        }
                     }
                 }
                 return ;
commit ce650fc1cd83ff94183b783c95b9f20aaa14f942
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Oct 7 17:47:35 2016 +0200

    Revert "More blind fix for --enable-pch Windows builds"
    
    This reverts commit 1b613450f85d052b7343eacefd79abbfe4f35e2f.

diff --git a/include/svl/svdde.hxx b/include/svl/svdde.hxx
index 3ea9f68..0e8b960 100644
--- a/include/svl/svdde.hxx
+++ b/include/svl/svdde.hxx
@@ -28,6 +28,13 @@
 #include <tools/link.hxx>
 #include <vector>
 
+#if defined _WIN32
+#include <prewin.h>
+#include <windows.h>
+#include <postwin.h>
+#include <ddeml.h>
+#endif
+
 class DdeString;
 class DdeData;
 class DdeConnection;
@@ -49,13 +56,6 @@ typedef ::std::vector< DdeService* > DdeServices;
 typedef ::std::vector< long > DdeFormats;
 typedef ::std::vector< Conversation* > ConvList;
 
-#if defined _WIN32
-namespace svl_dde {
-
-using HCONV = void *; // avoid including windows.h/ddeml.h
-
-}
-#endif
 
 class SVL_DLLPUBLIC DdeData
 {
@@ -214,8 +214,8 @@ class SVL_DLLPUBLIC DdeItem
     DdeItemImp*     pImpData;
 
 #if defined _WIN32
-    void            IncMonitor( svl_dde::HCONV );
-    void            DecMonitor( svl_dde::HCONV );
+    void            IncMonitor( HCONV );
+    void            DecMonitor( HCONV );
 #endif
 
 protected:
@@ -249,7 +249,7 @@ public:
 class SVL_DLLPUBLIC DdeTopic
 {
 #if defined _WIN32
-    SVL_DLLPRIVATE void Disconnect( svl_dde::HCONV );
+    SVL_DLLPRIVATE void Disconnect( HCONV );
 #endif
 
 public:
diff --git a/svl/source/svdde/ddesvr.cxx b/svl/source/svdde/ddesvr.cxx
index 3cf115f..3607036 100644
--- a/svl/source/svdde/ddesvr.cxx
+++ b/svl/source/svdde/ddesvr.cxx
@@ -669,7 +669,7 @@ void DdeTopic::NotifyClient( const OUString& rItem )
     }
 }
 
-void DdeTopic::Disconnect( svl_dde::HCONV nId )
+void DdeTopic::Disconnect( HCONV nId )
 {
     std::vector<DdeItem*>::iterator iter;
     for (iter = aItems.begin(); iter != aItems.end(); ++iter)
@@ -750,7 +750,7 @@ void DdeItem::NotifyClient()
     }
 }
 
-void DdeItem::IncMonitor( svl_dde::HCONV nHCnv )
+void DdeItem::IncMonitor( HCONV nHCnv )
 {
     if( !pImpData )
     {
@@ -768,10 +768,10 @@ void DdeItem::IncMonitor( svl_dde::HCONV nHCnv )
             }
     }
 
-    pImpData->push_back( DdeItemImpData( static_cast<HCONV>(nHCnv) ) );
+    pImpData->push_back( DdeItemImpData( nHCnv ) );
 }
 
-void DdeItem::DecMonitor( svl_dde::HCONV nHCnv )
+void DdeItem::DecMonitor( HCONV nHCnv )
 {
     if( pImpData )
     {


More information about the Libreoffice-commits mailing list