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

Michael Stahl mstahl at redhat.com
Tue Jul 14 14:48:02 PDT 2015


 include/sfx2/app.hxx             |    1 
 include/sfx2/genlink.hxx         |   50 ---------------------------------------
 include/sfx2/hintpost.hxx        |   35 ++++++++++-----------------
 sfx2/source/appl/app.cxx         |    1 
 sfx2/source/control/dispatch.cxx |    2 -
 sfx2/source/notify/hintpost.cxx  |   22 ++++-------------
 sfx2/source/toolbox/tbxitem.cxx  |    1 
 7 files changed, 21 insertions(+), 91 deletions(-)

New commits:
commit dac1be92f22197c9e144ef36963547c46d12e77d
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Jul 14 23:01:13 2015 +0200

    sfx2: remove pointless GenLink class
    
    Change-Id: I82df7b89c598c3c7903dee865f899862902a0d86

diff --git a/include/sfx2/app.hxx b/include/sfx2/app.hxx
index cf2b132..0b986c1 100644
--- a/include/sfx2/app.hxx
+++ b/include/sfx2/app.hxx
@@ -42,7 +42,6 @@ class WorkWindow;
 class ISfxTemplateCommon;
 class BasicManager;
 class DdeService;
-class GenLink;
 class PrinterDialog;
 class Point;
 class Rectangle;
diff --git a/include/sfx2/genlink.hxx b/include/sfx2/genlink.hxx
deleted file mode 100644
index 5c738e3..0000000
--- a/include/sfx2/genlink.hxx
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef INCLUDED_SFX2_GENLINK_HXX
-#define INCLUDED_SFX2_GENLINK_HXX
-
-
-#include <tools/link.hxx>
-typedef long (*CFuncPtr)(void*);
-
-class GenLink
-{
-    Link<>      aLink;
-    CFuncPtr    pFunc;
-
-public:
-    GenLink(): pFunc(0) {}
-    GenLink( CFuncPtr pCFunc ): pFunc(pCFunc) {}
-    GenLink( const Link<>& rLink ): aLink(rLink), pFunc(0) {}
-    GenLink( const GenLink& rOrig ):
-        aLink(rOrig.aLink), pFunc(rOrig.pFunc) {}
-
-    GenLink& operator = ( const GenLink& rOrig )
-        { pFunc = rOrig.pFunc; aLink = rOrig.aLink; return *this; }
-
-    bool operator!() const { return !aLink && !pFunc; }
-    bool IsSet() const { return aLink.IsSet() || pFunc; }
-
-    long Call( void* pCaller )
-         { return pFunc ? (*pFunc)(pCaller) : aLink.Call(pCaller); }
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/hintpost.hxx b/include/sfx2/hintpost.hxx
index f9950119..469b190 100644
--- a/include/sfx2/hintpost.hxx
+++ b/include/sfx2/hintpost.hxx
@@ -19,7 +19,7 @@
 #ifndef INCLUDED_SFX2_HINTPOST_HXX
 #define INCLUDED_SFX2_HINTPOST_HXX
 
-#include <sfx2/genlink.hxx>
+#include <tools/link.hxx>
 #include <tools/ref.hxx>
 
 
@@ -34,13 +34,13 @@ class SfxHint;
 
     The instances are held via Ref-Count until a possibly sent
     event has arrived.  If the target dies before delivery,
-    the connection must be severed with SetEventHdl(GenLink()).
+    the connection must be severed with SetEventHdl(Link()).
 */
 class SfxHintPoster : public SvRefBase
 {
-    GenLink         aLink;
-
 private:
+    Link<> m_Link;
+
                     DECL_LINK( DoEvent_Impl, SfxHint * );
 
 protected:
@@ -48,10 +48,10 @@ protected:
     void            Event( SfxHint* pPostedHint );
 
 public:
-                    SfxHintPoster( const GenLink& rLink );
+                    SfxHintPoster(const Link<>& rLink);
 
     void            Post( SfxHint* pHint = 0 );
-    void            SetEventHdl( const GenLink& rLink );
+    void            SetEventHdl(const Link<>& rLink);
 };
 
 typedef tools::SvRef<SfxHintPoster> SfxHintPosterRef;
diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx
index 7be02d9..a22f36d 100644
--- a/sfx2/source/appl/app.cxx
+++ b/sfx2/source/appl/app.cxx
@@ -77,7 +77,6 @@
 #include <sfx2/bindings.hxx>
 #include <sfx2/dispatch.hxx>
 #include <sfx2/viewsh.hxx>
-#include <sfx2/genlink.hxx>
 #include <sfx2/viewfrm.hxx>
 #include "appdata.hxx"
 #include "openflag.hxx"
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index 109d336..9f3de39 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -329,7 +329,7 @@ void SfxDispatcher::Construct_Impl( SfxDispatcher* pParent )
     for (sal_uInt16 n=0; n<SFX_OBJECTBAR_MAX; n++)
         xImp->aObjBars[n].nResId = 0;
 
-    GenLink aGenLink( LINK(this, SfxDispatcher, PostMsgHandler) );
+    Link<> aGenLink( LINK(this, SfxDispatcher, PostMsgHandler) );
 
     xImp->xPoster = new SfxHintPoster(aGenLink);
 
diff --git a/sfx2/source/notify/hintpost.cxx b/sfx2/source/notify/hintpost.cxx
index 2e86883..00e4290 100644
--- a/sfx2/source/notify/hintpost.cxx
+++ b/sfx2/source/notify/hintpost.cxx
@@ -17,36 +17,28 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sfx2/hintpost.hxx>
 
 #include "arrdecl.hxx"
-#include <sfx2/hintpost.hxx>
 #include <sfx2/app.hxx>
 #include "sfxtypes.hxx"
 
 
-
-SfxHintPoster::SfxHintPoster( const GenLink& rLink ):
-    aLink(rLink)
+SfxHintPoster::SfxHintPoster(const Link<>& rLink)
+    : m_Link(rLink)
 {
 }
 
-
-
-
 SfxHintPoster::~SfxHintPoster()
 {
 }
 
-
-
 void SfxHintPoster::Post( SfxHint* pHintToPost )
 {
     Application::PostUserEvent( ( LINK(this, SfxHintPoster, DoEvent_Impl) ), pHintToPost );
     AddFirstRef();
 }
 
-
-
 IMPL_LINK( SfxHintPoster, DoEvent_Impl, SfxHint *, pPostedHint )
 {
     Event( pPostedHint );
@@ -56,14 +48,12 @@ IMPL_LINK( SfxHintPoster, DoEvent_Impl, SfxHint *, pPostedHint )
 
 void SfxHintPoster::Event( SfxHint* pPostedHint )
 {
-    aLink.Call( pPostedHint );
+    m_Link.Call( pPostedHint );
 }
 
-
-
-void SfxHintPoster::SetEventHdl( const GenLink& rLink )
+void SfxHintPoster::SetEventHdl(const Link<>& rLink)
 {
-    aLink = rLink;
+    m_Link = rLink;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx
index 749b809..17a5be0 100644
--- a/sfx2/source/toolbox/tbxitem.cxx
+++ b/sfx2/source/toolbox/tbxitem.cxx
@@ -77,7 +77,6 @@
 #include "statcach.hxx"
 #include <sfx2/viewfrm.hxx>
 #include "sfxtypes.hxx"
-#include <sfx2/genlink.hxx>
 #include <sfx2/sfxresid.hxx>
 #include <sfx2/sfx.hrc>
 #include <sfx2/module.hxx>
commit 8fdf12f79ebcbb44bf58eaabdf7fe6c35ca87bf1
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Jul 14 22:56:18 2015 +0200

    sfx2: an almost unnoticable tweak to comment translation
    
    Change-Id: I7089b09c4497a2fc4cf8ca13ab098c747e565721

diff --git a/include/sfx2/hintpost.hxx b/include/sfx2/hintpost.hxx
index da75634..f9950119 100644
--- a/include/sfx2/hintpost.hxx
+++ b/include/sfx2/hintpost.hxx
@@ -23,25 +23,20 @@
 #include <tools/ref.hxx>
 
 
-
 class SfxHint;
 
+/**  [Description]
 
+    This class allows sending unique events via VCL's
+    Application::PostUserEvent().  When the User-Event is dispatched,
+    the handler <Event()> is called, which calls the Link provided with
+    SetEventHdl().
 
-class SfxHintPoster: public SvRefBase
-
-/*  [Description]
-
-    With instances of this class unique events per PostUserEvent can be sent
-    using the StarView-application. If the User-Event is triggered often,
-    the handler <Event()> is called, the base implementation with the
-    <SetEventHdl()> line is making these link calls.
-
-    The instance are held via Ref-Count at least as long as a possible sent
-    event has not arrived yet. Should be killed before the goal, before the
-    connection is SetEventHdl (GenLink ()) .
+    The instances are held via Ref-Count until a possibly sent
+    event has arrived.  If the target dies before delivery,
+    the connection must be severed with SetEventHdl(GenLink()).
 */
-
+class SfxHintPoster : public SvRefBase
 {
     GenLink         aLink;
 
@@ -59,8 +54,6 @@ public:
     void            SetEventHdl( const GenLink& rLink );
 };
 
-
-
 typedef tools::SvRef<SfxHintPoster> SfxHintPosterRef;
 
 #endif


More information about the Libreoffice-commits mailing list