convert Link<> to typed

Change-Id: I184d836e944d6dcfd17233a7a83680f1c1bff9bf
This commit is contained in:
Noel Grandin 2015-09-08 09:54:16 +02:00
parent 7a39ae0422
commit 5906a2a638
20 changed files with 47 additions and 68 deletions

View file

@ -43,7 +43,7 @@ DlgEdFactory::~DlgEdFactory()
}
IMPL_LINK( DlgEdFactory, MakeObject, SdrObjFactory *, pObjFactory )
IMPL_LINK_TYPED( DlgEdFactory, MakeObject, SdrObjFactory *, pObjFactory, void )
{
static bool bNeedsInit = true;
static uno::Reference< lang::XMultiServiceFactory > xDialogSFact;
@ -235,8 +235,6 @@ IMPL_LINK( DlgEdFactory, MakeObject, SdrObjFactory *, pObjFactory )
break;
}
}
return 0;
}
} // namespace basctl

View file

@ -38,7 +38,7 @@ public:
DlgEdFactory( const css::uno::Reference< css::frame::XModel >& xModel );
~DlgEdFactory();
DECL_LINK( MakeObject, SdrObjFactory * );
DECL_LINK_TYPED( MakeObject, SdrObjFactory *, void );
};
} // namespace basctl

View file

@ -31,7 +31,7 @@ public:
FmFormObjFactory();
~FmFormObjFactory();
DECL_STATIC_LINK(FmFormObjFactory, MakeObject, SdrObjFactory*);
DECL_STATIC_LINK_TYPED(FmFormObjFactory, MakeObject, SdrObjFactory*, void);
};
#endif // _FM_FMOBJFAC_HXX

View file

@ -64,8 +64,6 @@ enum SgaObjKind
#define IV_IMAPINFO (sal_uInt32('S')*0x00000001+sal_uInt32('D')*0x00000100+sal_uInt32('U')*0x00010000+sal_uInt32('D')*0x01000000)
#define ID_IMAPINFO 2
#define USERDATA_HDL() (LINK(this,SgaUserDataFactory,MakeUserData))
#define GAL_RES(nId) ResId(nId, *GetGalleryResMgr())
#define GAL_RESSTR(nId) GAL_RES(nId).toString()
#define STREAMBUF_SIZE 16384L
@ -129,10 +127,10 @@ public:
class SgaUserDataFactory
{
public:
SgaUserDataFactory() { SdrObjFactory::InsertMakeUserDataHdl( USERDATA_HDL() ); }
~SgaUserDataFactory() { SdrObjFactory::RemoveMakeUserDataHdl( USERDATA_HDL() ); }
SgaUserDataFactory() { SdrObjFactory::InsertMakeUserDataHdl( LINK(this,SgaUserDataFactory,MakeUserData) ); }
~SgaUserDataFactory() { SdrObjFactory::RemoveMakeUserDataHdl( LINK(this,SgaUserDataFactory,MakeUserData) ); }
DECL_STATIC_LINK( SgaUserDataFactory, MakeUserData, SdrObjFactory* );
DECL_STATIC_LINK_TYPED( SgaUserDataFactory, MakeUserData, SdrObjFactory*, void );
};
class GraphicFilter;

View file

@ -40,7 +40,7 @@ public:
E3dObjFactory();
~E3dObjFactory();
DECL_STATIC_LINK(E3dObjFactory, MakeObject, SdrObjFactory*);
DECL_STATIC_LINK_TYPED(E3dObjFactory, MakeObject, SdrObjFactory*, void);
};

View file

@ -173,21 +173,22 @@ public:
};
class SdrObjFactory;
class SdrLinkList
{
std::vector<Link<>*> aList;
std::vector<Link<SdrObjFactory*,void> > aList;
protected:
unsigned FindEntry(const Link<>& rLink) const;
unsigned FindEntry(const Link<SdrObjFactory*,void>& rLink) const;
public:
SdrLinkList(): aList() {}
~SdrLinkList() { Clear(); }
SVX_DLLPUBLIC void Clear();
unsigned GetLinkCount() const { return (unsigned)aList.size(); }
Link<>& GetLink(unsigned nNum) { return *aList[nNum]; }
const Link<>& GetLink(unsigned nNum) const { return *aList[nNum]; }
void InsertLink(const Link<>& rLink, unsigned nPos=0xFFFF);
void RemoveLink(const Link<>& rLink);
Link<SdrObjFactory*,void>& GetLink(unsigned nNum) { return aList[nNum]; }
const Link<SdrObjFactory*,void>& GetLink(unsigned nNum) const { return aList[nNum]; }
void InsertLink(const Link<SdrObjFactory*,void>& rLink, unsigned nPos=0xFFFF);
void RemoveLink(const Link<SdrObjFactory*,void>& rLink);
};
SdrLinkList& ImpGetUserMakeObjHdl();

View file

@ -992,8 +992,8 @@ private:
class SVX_DLLPUBLIC SdrObjFactory
{
public:
sal_uInt32 nInventor;
sal_uInt16 nIdentifier;
sal_uInt32 nInventor;
sal_uInt16 nIdentifier;
// for MakeNewObj():
SdrPage* pPage;
@ -1014,10 +1014,10 @@ private:
public:
static SdrObject* MakeNewObject(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrPage* pPage, SdrModel* pModel=NULL);
static SdrObject* MakeNewObject( sal_uInt32 nInventor, sal_uInt16 nIdentifier, const Rectangle& rSnapRect, SdrPage* pPage );
static void InsertMakeObjectHdl(const Link<>& rLink);
static void RemoveMakeObjectHdl(const Link<>& rLink);
static void InsertMakeUserDataHdl(const Link<>& rLink);
static void RemoveMakeUserDataHdl(const Link<>& rLink);
static void InsertMakeObjectHdl(const Link<SdrObjFactory*,void>& rLink);
static void RemoveMakeObjectHdl(const Link<SdrObjFactory*,void>& rLink);
static void InsertMakeUserDataHdl(const Link<SdrObjFactory*,void>& rLink);
static void RemoveMakeUserDataHdl(const Link<SdrObjFactory*,void>& rLink);
};
typedef tools::WeakReference< SdrObject > SdrObjectWeakRef;

View file

@ -35,7 +35,7 @@ public:
DlgEdFactory();
~DlgEdFactory();
DECL_STATIC_LINK( DlgEdFactory, MakeObject, SdrObjFactory * );
DECL_STATIC_LINK_TYPED( DlgEdFactory, MakeObject, SdrObjFactory *, void );
};
}
#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_DLGEDFAC_HXX

View file

@ -46,8 +46,8 @@ DlgEdFactory::~DlgEdFactory()
IMPL_STATIC_LINK(
DlgEdFactory, MakeObject, SdrObjFactory *, pObjFactory )
IMPL_STATIC_LINK_TYPED(
DlgEdFactory, MakeObject, SdrObjFactory *, pObjFactory, void )
{
if ( pObjFactory->nInventor == ReportInventor )
{
@ -96,8 +96,6 @@ IMPL_STATIC_LINK(
break;
}
}
return 0;
}
}

View file

@ -35,7 +35,7 @@
class ScDrawObjFactory
{
DECL_STATIC_LINK( ScDrawObjFactory, MakeUserData, SdrObjFactory * );
DECL_STATIC_LINK_TYPED( ScDrawObjFactory, MakeUserData, SdrObjFactory *, void );
public:
ScDrawObjFactory();
~ScDrawObjFactory();

View file

@ -31,8 +31,8 @@ ScDrawObjFactory::~ScDrawObjFactory()
SdrObjFactory::RemoveMakeUserDataHdl( LINK ( this, ScDrawObjFactory, MakeUserData ) );
}
IMPL_STATIC_LINK(
ScDrawObjFactory, MakeUserData, SdrObjFactory *, pObjFactory )
IMPL_STATIC_LINK_TYPED(
ScDrawObjFactory, MakeUserData, SdrObjFactory *, pObjFactory, void )
{
if ( pObjFactory->nInventor == SC_DRAWLAYER )
{
@ -47,7 +47,6 @@ IMPL_STATIC_LINK(
OSL_FAIL("MakeUserData: wrong ID");
}
}
return 0;
}
ScDrawObjData::ScDrawObjData() :

View file

@ -34,7 +34,7 @@ protected:
public:
SdObjectFactory() {}
DECL_LINK( MakeUserData, SdrObjFactory * );
DECL_LINK_TYPED( MakeUserData, SdrObjFactory *, void );
};
extern SdObjectFactory aSdObjectFactory;

View file

@ -35,7 +35,7 @@ SdObjectFactory aSdObjectFactory;
|*
\************************************************************************/
IMPL_LINK( SdObjectFactory, MakeUserData, SdrObjFactory *, pObjFactory )
IMPL_LINK_TYPED( SdObjectFactory, MakeUserData, SdrObjFactory *, pObjFactory, void )
{
if ( pObjFactory->nInventor == SdUDInventor )
{
@ -55,12 +55,10 @@ IMPL_LINK( SdObjectFactory, MakeUserData, SdrObjFactory *, pObjFactory )
}
if ( pObjFactory->pNewData )
return 0;
return;
if( aOldMakeUserDataLink.IsSet() )
aOldMakeUserDataLink.Call( this );
return 0;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -45,8 +45,7 @@ E3dObjFactory::~E3dObjFactory()
// Generate chart internal objects
IMPL_STATIC_LINK(
E3dObjFactory, MakeObject, SdrObjFactory*, pObjFactory)
IMPL_STATIC_LINK_TYPED( E3dObjFactory, MakeObject, SdrObjFactory*, pObjFactory, void )
{
if ( pObjFactory->nInventor == E3dInventor )
{
@ -80,7 +79,6 @@ IMPL_STATIC_LINK(
break;
}
}
return 0;
}

View file

@ -109,8 +109,8 @@ namespace
}
}
IMPL_STATIC_LINK(
FmFormObjFactory, MakeObject, SdrObjFactory*, pObjFactory)
IMPL_STATIC_LINK_TYPED(
FmFormObjFactory, MakeObject, SdrObjFactory*, pObjFactory, void)
{
if (pObjFactory->nInventor == FmFormInventor)
{
@ -232,8 +232,6 @@ IMPL_STATIC_LINK(
);
}
}
return 0;
}

View file

@ -76,13 +76,11 @@ BitmapEx GalleryResGetBitmapEx( sal_uInt32 nId )
return aBmpEx;
}
IMPL_STATIC_LINK(
SgaUserDataFactory, MakeUserData, SdrObjFactory*, pObjFactory )
IMPL_STATIC_LINK_TYPED(
SgaUserDataFactory, MakeUserData, SdrObjFactory*, pObjFactory, void )
{
if ( pObjFactory->nInventor == IV_IMAPINFO && pObjFactory->nIdentifier == ID_IMAPINFO )
pObjFactory->pNewData = new SgaIMapInfo;
return 0L;
}
GalleryGraphicImportRet GalleryGraphicImport( const INetURLObject& rURL, Graphic& rGraphic,

View file

@ -260,14 +260,10 @@ IMPL_LINK_NOARG_TYPED(OLEObjCache, UnloadCheckHdl, Timer*, void)
void SdrLinkList::Clear()
{
unsigned nAnz=GetLinkCount();
for (unsigned i=0; i<nAnz; i++) {
delete aList[i];
}
aList.clear();
}
unsigned SdrLinkList::FindEntry(const Link<>& rLink) const
unsigned SdrLinkList::FindEntry(const Link<SdrObjFactory*,void>& rLink) const
{
unsigned nAnz=GetLinkCount();
for (unsigned i=0; i<nAnz; i++) {
@ -276,15 +272,15 @@ unsigned SdrLinkList::FindEntry(const Link<>& rLink) const
return 0xFFFF;
}
void SdrLinkList::InsertLink(const Link<>& rLink, unsigned nPos)
void SdrLinkList::InsertLink(const Link<SdrObjFactory*,void>& rLink, unsigned nPos)
{
unsigned nFnd=FindEntry(rLink);
if (nFnd==0xFFFF) {
if (rLink.IsSet()) {
if(nPos==0xFFFF)
aList.push_back(new Link<>(rLink));
aList.push_back(rLink);
else
aList.insert(aList.begin() + nPos, new Link<>(rLink));
aList.insert(aList.begin() + nPos, rLink);
} else {
OSL_FAIL("SdrLinkList::InsertLink(): Tried to insert a link that was not set already.");
}
@ -293,13 +289,11 @@ void SdrLinkList::InsertLink(const Link<>& rLink, unsigned nPos)
}
}
void SdrLinkList::RemoveLink(const Link<>& rLink)
void SdrLinkList::RemoveLink(const Link<SdrObjFactory*,void>& rLink)
{
unsigned nFnd=FindEntry(rLink);
if (nFnd!=0xFFFF) {
Link<>* pLink = aList[nFnd];
aList.erase( aList.begin() + nFnd );
delete pLink;
} else {
OSL_FAIL("SdrLinkList::RemoveLink(): Link not found.");
}

View file

@ -3171,7 +3171,7 @@ SdrObject* SdrObjFactory::CreateObjectFromFactory( sal_uInt32 nInventor, sal_uIn
SdrObject* pObj = NULL;
while (i < n && !pObj)
{
rLL.GetLink(i).Call(static_cast<void*>(pFact.get()));
rLL.GetLink(i).Call(pFact.get());
pObj = pFact->pNewObj;
i++;
}
@ -3331,25 +3331,25 @@ SdrObject* SdrObjFactory::MakeNewObject(
return pObj;
}
void SdrObjFactory::InsertMakeObjectHdl(const Link<>& rLink)
void SdrObjFactory::InsertMakeObjectHdl(const Link<SdrObjFactory*,void>& rLink)
{
SdrLinkList& rLL=ImpGetUserMakeObjHdl();
rLL.InsertLink(rLink);
}
void SdrObjFactory::RemoveMakeObjectHdl(const Link<>& rLink)
void SdrObjFactory::RemoveMakeObjectHdl(const Link<SdrObjFactory*,void>& rLink)
{
SdrLinkList& rLL=ImpGetUserMakeObjHdl();
rLL.RemoveLink(rLink);
}
void SdrObjFactory::InsertMakeUserDataHdl(const Link<>& rLink)
void SdrObjFactory::InsertMakeUserDataHdl(const Link<SdrObjFactory*,void>& rLink)
{
SdrLinkList& rLL=ImpGetUserMakeObjUserDataHdl();
rLL.InsertLink(rLink);
}
void SdrObjFactory::RemoveMakeUserDataHdl(const Link<>& rLink)
void SdrObjFactory::RemoveMakeUserDataHdl(const Link<SdrObjFactory*,void>& rLink)
{
SdrLinkList& rLL=ImpGetUserMakeObjUserDataHdl();
rLL.RemoveLink(rLink);

View file

@ -26,7 +26,7 @@ class SdrObjFactory;
class SwObjectFactory
{
public:
DECL_STATIC_LINK( SwObjectFactory, MakeObject, SdrObjFactory * );
DECL_STATIC_LINK_TYPED( SwObjectFactory, MakeObject, SdrObjFactory *, void );
};
extern SwObjectFactory aSwObjectFactory;

View file

@ -23,8 +23,8 @@
SwObjectFactory aSwObjectFactory;
IMPL_STATIC_LINK(
SwObjectFactory, MakeObject, SdrObjFactory*, pObjFactory )
IMPL_STATIC_LINK_TYPED(
SwObjectFactory, MakeObject, SdrObjFactory*, pObjFactory, void )
{
if ( pObjFactory->nInventor == SWGInventor )
{
@ -33,7 +33,6 @@ IMPL_STATIC_LINK(
"Wrong inventor or identifier" );
pObjFactory->pNewObj = new SwFlyDrawObj();
}
return 0;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */