summaryrefslogtreecommitdiff
path: root/sot
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-07-03 10:29:31 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-07-03 10:46:06 +0000
commit9136f2344af88d524b6c10b6b2dfd6017bba60ec (patch)
treed9813b742356b6b0e36bd11e8a495317a5b4d5df /sot
parent465489d97ab9ffa0bfee02d80eb99aad771aee3f (diff)
expand out some sot macros
Change-Id: Ic583fe767e5f85628f8270ec740ce3e72fe56ded Reviewed-on: https://gerrit.libreoffice.org/16722 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sot')
-rw-r--r--sot/source/base/object.cxx37
-rw-r--r--sot/source/sdstor/storage.cxx80
2 files changed, 107 insertions, 10 deletions
diff --git a/sot/source/base/object.cxx b/sot/source/base/object.cxx
index b8096429363f..013853df13b9 100644
--- a/sot/source/base/object.cxx
+++ b/sot/source/base/object.cxx
@@ -32,9 +32,38 @@ public:
};
-SO2_IMPL_BASIC_CLASS_DLL(SotObject,SotObjectFactory,
- SvGlobalName( 0xf44b7830, 0xf83c, 0x11d0,
- 0xaa, 0xa1, 0x0, 0xa0, 0x24, 0x9d, 0x55, 0x90 ) )
+SotFactory * SotObject::ClassFactory()
+{
+ SotFactory **ppFactory = GetFactoryAdress();
+ if( !*ppFactory )
+ {
+ *ppFactory = new SotObjectFactory( SvGlobalName( 0xf44b7830, 0xf83c, 0x11d0,
+ 0xaa, 0xa1, 0x0, 0xa0, 0x24, 0x9d, 0x55, 0x90 ),
+ OUString( "SotObject" ), SotObject::CreateInstance );
+ }
+ return *ppFactory;
+}
+
+void * SotObject::CreateInstance( SotObject ** ppObj )
+{
+ SotObject * p = new SotObject();
+ if( ppObj )
+ *ppObj = p;
+ return p;
+}
+
+const SotFactory * SotObject::GetSvFactory() const
+{
+ return ClassFactory();
+}
+
+void * SotObject::Cast( const SotFactory * pFact )
+{
+ void * pRet = NULL;
+ if( !pFact || pFact == ClassFactory() )
+ pRet = this;
+ return pRet;
+}
/*************************************************************************
|* SotObject::SotObject()
@@ -91,7 +120,7 @@ bool SotObject::DoClose()
bool bRet = false;
if( !bInClose )
{
- SotObjectRef xHoldAlive( this );
+ tools::SvRef<SotObject> xHoldAlive( this );
bInClose = true;
bRet = Close();
bInClose = false;
diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx
index 1a01a04b10a2..30c80b79b7b0 100644
--- a/sot/source/sdstor/storage.cxx
+++ b/sot/source/sdstor/storage.cxx
@@ -53,9 +53,43 @@ public:
};
-SO2_IMPL_BASIC_CLASS1_DLL(SotStorageStream,SotStorageStreamFactory,SotObject,
- SvGlobalName( 0xd7deb420, 0xf902, 0x11d0,
- 0xaa, 0xa1, 0x0, 0xa0, 0x24, 0x9d, 0x55, 0x90 ) )
+SotFactory * SotStorageStream::ClassFactory()
+{
+ SotFactory **ppFactory = GetFactoryAdress();
+ if( !*ppFactory )
+ {
+ *ppFactory = new SotStorageStreamFactory( SvGlobalName( 0xd7deb420, 0xf902, 0x11d0,
+ 0xaa, 0xa1, 0x0, 0xa0, 0x24, 0x9d, 0x55, 0x90 ),
+ OUString( "SotStorageStream" ), SotStorageStream::CreateInstance );
+ (*ppFactory)->PutSuperClass( SotObject::ClassFactory() );
+ }
+ return *ppFactory;
+}
+
+void * SotStorageStream::CreateInstance( SotObject ** ppObj )
+{
+ SotStorageStream * p = new SotStorageStream();
+ SotObject* pSuper1 = p;
+ SotObject* pBasicObj = pSuper1;
+ if( ppObj )
+ *ppObj = pBasicObj;
+ return p;
+}
+
+const SotFactory * SotStorageStream::GetSvFactory() const
+{
+ return ClassFactory();
+}
+
+void * SotStorageStream::Cast( const SotFactory * pFact )
+{
+ void * pRet = NULL;
+ if( !pFact || pFact == ClassFactory() )
+ pRet = this;
+ if( !pRet )
+ pRet = SotObject::Cast( pFact );
+ return pRet;
+}
SvLockBytesRef MakeLockBytes_Impl( const OUString & rName, StreamMode nMode )
{
@@ -285,9 +319,43 @@ public:
};
-SO2_IMPL_BASIC_CLASS1_DLL(SotStorage,SotStorageFactory,SotObject,
- SvGlobalName( 0x980ce7e0, 0xf905, 0x11d0,
- 0xaa, 0xa1, 0x0, 0xa0, 0x24, 0x9d, 0x55, 0x90 ) )
+SotFactory * SotStorage::ClassFactory()
+{
+ SotFactory **ppFactory = GetFactoryAdress();
+ if( !*ppFactory )
+ {
+ *ppFactory = new SotStorageFactory( SvGlobalName( 0x980ce7e0, 0xf905, 0x11d0,
+ 0xaa, 0xa1, 0x0, 0xa0, 0x24, 0x9d, 0x55, 0x90 ),
+ OUString( "SotStorage" ), SotStorage::CreateInstance );
+ (*ppFactory)->PutSuperClass( SotObject::ClassFactory() );
+ }
+ return *ppFactory;
+}
+
+void * SotStorage::CreateInstance( SotObject ** ppObj )
+{
+ SotStorage * p = new SotStorage();
+ SotObject* pSuper1 = p;
+ SotObject* pBasicObj = pSuper1;
+ if( ppObj )
+ *ppObj = pBasicObj;
+ return p;
+}
+
+const SotFactory * SotStorage::GetSvFactory() const
+{
+ return ClassFactory();
+}
+
+void * SotStorage::Cast( const SotFactory * pFact )
+{
+ void * pRet = NULL;
+ if( !pFact || pFact == ClassFactory() )
+ pRet = this;
+ if( !pRet )
+ pRet = SotObject::Cast( pFact );
+ return pRet;
+}
/************************************************************************
|*