Kaydet (Commit) dac1be92 authored tarafından Michael Stahl's avatar Michael Stahl

sfx2: remove pointless GenLink class

Change-Id: I82df7b89c598c3c7903dee865f899862902a0d86
üst 8fdf12f7
......@@ -42,7 +42,6 @@ class WorkWindow;
class ISfxTemplateCommon;
class BasicManager;
class DdeService;
class GenLink;
class PrinterDialog;
class Point;
class Rectangle;
......
/* -*- 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: */
......@@ -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;
......
......@@ -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"
......
......@@ -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);
......
......@@ -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: */
......@@ -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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment