summaryrefslogtreecommitdiff
path: root/sot
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@gmail.com>2016-01-04 22:27:23 +0100
committerMatúš Kukan <matus.kukan@gmail.com>2016-01-05 20:41:12 +0100
commit3b7150c0ab5ca40f88ab8c3b914d601501cbf4e7 (patch)
tree3ecd1d8081ce7cf4600038ad35d68c47493a66a0 /sot
parent5b22663e373f2137c93adcdd2c31c54da2fba663 (diff)
SotFactory is in fact not used: remove + cleanup
Also SotData_Impl is used only in exchange.cxx now. Move there. Change-Id: I548095c2226d92aea4193bb1a3671e2381996435
Diffstat (limited to 'sot')
-rw-r--r--sot/Library_sot.mk1
-rw-r--r--sot/inc/factory.hxx57
-rw-r--r--sot/inc/sotdata.hxx53
-rw-r--r--sot/source/base/exchange.cxx30
-rw-r--r--sot/source/base/factory.cxx203
-rw-r--r--sot/source/base/object.cxx44
-rw-r--r--sot/source/sdstor/storage.cxx70
7 files changed, 28 insertions, 430 deletions
diff --git a/sot/Library_sot.mk b/sot/Library_sot.mk
index a17ce3868b64..3c443e50a598 100644
--- a/sot/Library_sot.mk
+++ b/sot/Library_sot.mk
@@ -56,7 +56,6 @@ $(eval $(call gb_Library_add_exception_objects,sot,\
sot/source/base/object \
sot/source/base/exchange \
sot/source/base/filelist \
- sot/source/base/factory \
sot/source/sdstor/stg \
sot/source/sdstor/stgavl \
sot/source/sdstor/stgcache \
diff --git a/sot/inc/factory.hxx b/sot/inc/factory.hxx
deleted file mode 100644
index ab22cc08cadb..000000000000
--- a/sot/inc/factory.hxx
+++ /dev/null
@@ -1,57 +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_SOT_FACTORY_HXX
-#define INCLUDED_SOT_FACTORY_HXX
-
-#include <sal/config.h>
-
-#include <tools/globname.hxx>
-
-class SotObject;
-
-class SotFactory : public SvGlobalName
-{
- sal_uInt16 nSuperCount; // Anzahl der Superklassen
- const SotFactory ** pSuperClasses; // Superklassen
-
-protected:
- virtual ~SotFactory();
-public:
- static void IncSvObjectCount( SotObject * = nullptr );
- static void DecSvObjectCount( SotObject * = nullptr );
-
-#ifdef DBG_UTIL
- static const SotFactory * Find( const SvGlobalName & );
-#endif
-
- SotFactory( const SvGlobalName & );
-
- void PutSuperClass( const SotFactory * );
-
- bool Is( const SotFactory * pSuperClass ) const;
-
-private:
- SotFactory( const SotFactory & ) = delete;
- SotFactory & operator = ( const SotFactory & ) = delete;
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sot/inc/sotdata.hxx b/sot/inc/sotdata.hxx
deleted file mode 100644
index f2d3c260bf84..000000000000
--- a/sot/inc/sotdata.hxx
+++ /dev/null
@@ -1,53 +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_SOT_SOTDATA_HXX
-#define INCLUDED_SOT_SOTDATA_HXX
-
-#include <sal/config.h>
-
-#include <com/sun/star/datatransfer/DataFlavor.hpp>
-#include <vector>
-#include <list>
-
-
-class SotFactory;
-class SotObject;
-
-typedef ::std::vector< SotFactory* > SotFactoryList;
-typedef ::std::vector< css::datatransfer::DataFlavor* > tDataFlavorList;
-
-struct SotData_Impl
-{
- sal_uInt32 nSvObjCount;
- std::list<SotObject*> aObjectList;
- SotFactoryList * pFactoryList;
- SotFactory * pSotObjectFactory;
- SotFactory * pSotStorageStreamFactory;
- SotFactory * pSotStorageFactory;
- tDataFlavorList* pDataFlavorList;
- SotData_Impl();
- ~SotData_Impl();
-};
-
-SotData_Impl* SOTDATA();
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx
index c50a6b77e46c..88de2a64ec4e 100644
--- a/sot/source/base/exchange.cxx
+++ b/sot/source/base/exchange.cxx
@@ -22,15 +22,17 @@
#include <tools/debug.hxx>
#include <tools/solar.h>
#include <tools/globname.hxx>
-#include <sotdata.hxx>
#include <sot/exchange.hxx>
#include <sot/formats.hxx>
#include <sysformats.hxx>
#include <comphelper/classids.hxx>
#include <rtl/instance.hxx>
+#include <com/sun/star/datatransfer/DataFlavor.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <comphelper/documentconstants.hxx>
+#include <vector>
+
using namespace::com::sun::star::uno;
using namespace::com::sun::star::datatransfer;
@@ -208,11 +210,35 @@ namespace
struct FormatArray_Impl
: public rtl::StaticAggregate<
const DataFlavorRepresentation, ImplFormatArray_Impl > {};
+
+
+ typedef std::vector<css::datatransfer::DataFlavor*> tDataFlavorList;
+
+ struct SotData_Impl
+ {
+ tDataFlavorList* pDataFlavorList;
+
+ SotData_Impl(): pDataFlavorList(nullptr) {}
+ ~SotData_Impl()
+ {
+ if (pDataFlavorList)
+ {
+ for( tDataFlavorList::iterator aI = pDataFlavorList->begin(),
+ aEnd = pDataFlavorList->end(); aI != aEnd; ++aI)
+ {
+ delete *aI;
+ }
+ delete pDataFlavorList;
+ }
+ }
+ };
+
+ struct ImplData : public rtl::Static<SotData_Impl, ImplData> {};
}
static tDataFlavorList& InitFormats_Impl()
{
- SotData_Impl * pSotData = SOTDATA();
+ SotData_Impl *pSotData = &ImplData::get();
if( !pSotData->pDataFlavorList )
pSotData->pDataFlavorList = new tDataFlavorList();
return *pSotData->pDataFlavorList;
diff --git a/sot/source/base/factory.cxx b/sot/source/base/factory.cxx
deleted file mode 100644
index 74946ad68821..000000000000
--- a/sot/source/base/factory.cxx
+++ /dev/null
@@ -1,203 +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 .
- */
-
-#include <factory.hxx>
-
-#include <tools/debug.hxx>
-#include <sot/object.hxx>
-#include <sotdata.hxx>
-#include <comphelper/classids.hxx>
-#include <osl/diagnose.h>
-#include <rtl/instance.hxx>
-#include <rtl/strbuf.hxx>
-
-/************** class SotData_Impl *********************************************/
-/*************************************************************************
-|* SotData_Impl::SotData_Impl
-|*
-|* Beschreibung
-*************************************************************************/
-SotData_Impl::SotData_Impl()
- : nSvObjCount( 0 )
- , pFactoryList( nullptr )
- , pSotObjectFactory( nullptr )
- , pSotStorageStreamFactory( nullptr )
- , pSotStorageFactory( nullptr )
- , pDataFlavorList( nullptr )
-{
-}
-
-SotData_Impl::~SotData_Impl()
-{
- if (pDataFlavorList)
- {
- for( tDataFlavorList::iterator aI = pDataFlavorList->begin(),
- aEnd = pDataFlavorList->end(); aI != aEnd; ++aI)
- {
- delete *aI;
- }
- delete pDataFlavorList;
- }
- delete pFactoryList;
-}
-
-/*************************************************************************
-|* SOTDATA()
-|*
-|* Beschreibung
-*************************************************************************/
-namespace { struct ImplData : public rtl::Static<SotData_Impl, ImplData> {}; }
-SotData_Impl * SOTDATA()
-{
- return &ImplData::get();
-}
-
-/************** class SotFactory *****************************************/
-/*************************************************************************
-|* SotFactory::SotFactory()
-|*
-|* Beschreibung
-*************************************************************************/
-
-SotFactory::SotFactory( const SvGlobalName & rName )
- : SvGlobalName ( rName )
- , nSuperCount ( 0 )
- , pSuperClasses ( nullptr )
-{
-#ifdef DBG_UTIL
- SvGlobalName aEmptyName;
- if( aEmptyName != *this )
- { // wegen Sfx-BasicFactories
- DBG_ASSERT( aEmptyName != *this, "create factory without SvGlobalName" );
- if( Find( *this ) )
- {
- OSL_FAIL( "create factories with the same unique name" );
- }
- }
-#endif
- SotData_Impl * pSotData = SOTDATA();
- if( !pSotData->pFactoryList )
- pSotData->pFactoryList = new SotFactoryList();
- // muss nach hinten, wegen Reihenfolge beim zerstoeren
- pSotData->pFactoryList->push_back( this );
-}
-
-
-
-SotFactory::~SotFactory()
-{
- delete [] pSuperClasses;
-}
-
-/*************************************************************************
-|* SotFactory::Find()
-|*
-|* Beschreibung
-*************************************************************************/
-#ifdef DBG_UTIL
-const SotFactory* SotFactory::Find( const SvGlobalName & rFactName )
-{
- SvGlobalName aEmpty;
- SotData_Impl * pSotData = SOTDATA();
- if( rFactName != aEmpty && pSotData->pFactoryList )
- {
- for ( size_t i = 0, n = pSotData->pFactoryList->size(); i < n; ++i ) {
- SotFactory* pFact = (*pSotData->pFactoryList)[ i ];
- if( *pFact == rFactName )
- return pFact;
- }
- }
-
- return nullptr;
-}
-#endif
-
-/*************************************************************************
-|* SotFactory::PutSuperClass()
-|*
-|* Beschreibung
-*************************************************************************/
-void SotFactory::PutSuperClass( const SotFactory * pFact )
-{
- nSuperCount++;
- if( !pSuperClasses )
- pSuperClasses = new const SotFactory * [ nSuperCount ];
- else
- {
- const SotFactory ** pTmp = new const SotFactory * [ nSuperCount ];
- memcpy( static_cast<void *>(pTmp), static_cast<void *>(pSuperClasses),
- sizeof( void * ) * (nSuperCount -1) );
- delete [] pSuperClasses;
- pSuperClasses = pTmp;
- }
- pSuperClasses[ nSuperCount -1 ] = pFact;
-}
-
-
-/*************************************************************************
-|* SotFactory::IncSvObjectCount()
-|*
-|* Beschreibung
-*************************************************************************/
-void SotFactory::IncSvObjectCount( SotObject * pObj )
-{
- SotData_Impl * pSotData = SOTDATA();
- pSotData->nSvObjCount++;
-
- if( pObj )
- pSotData->aObjectList.push_back( pObj );
-}
-
-
-/*************************************************************************
-|* SotFactory::DecSvObjectCount()
-|*
-|* Beschreibung
-*************************************************************************/
-void SotFactory::DecSvObjectCount( SotObject * pObj )
-{
- SotData_Impl * pSotData = SOTDATA();
- pSotData->nSvObjCount--;
- if( pObj )
- pSotData->aObjectList.remove( pObj );
- if( !pSotData->nSvObjCount )
- {
- //keine internen und externen Referenzen mehr
- }
-}
-
-/*************************************************************************
-|* SotFactory::Is()
-|*
-|* Beschreibung
-*************************************************************************/
-bool SotFactory::Is( const SotFactory * pSuperCl ) const
-{
- if( this == pSuperCl )
- return true;
-
- for( sal_uInt16 i = 0; i < nSuperCount; i++ )
- {
- if( pSuperClasses[ i ]->Is( pSuperCl ) )
- return true;
- }
- return false;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sot/source/base/object.cxx b/sot/source/base/object.cxx
index 25b198d0a2c4..79a139aa04c2 100644
--- a/sot/source/base/object.cxx
+++ b/sot/source/base/object.cxx
@@ -18,60 +18,16 @@
*/
#include <sot/object.hxx>
-#include <factory.hxx>
-#include <sotdata.hxx>
-/************** class SotObject ******************************************/
-class SotObjectFactory : public SotFactory
-{
-public:
- explicit SotObjectFactory(const SvGlobalName& rName)
- : SotFactory( rName )
- {
- }
-};
-
-SotFactory * SotObject::ClassFactory()
-{
- SotFactory **ppFactory = &(SOTDATA()->pSotObjectFactory);
- if( !*ppFactory )
- {
- *ppFactory = new SotObjectFactory(
- SvGlobalName( 0xf44b7830, 0xf83c, 0x11d0,
- 0xaa, 0xa1, 0x0, 0xa0, 0x24, 0x9d, 0x55, 0x90 ) );
- }
- return *ppFactory;
-}
-
-void * SotObject::Cast( const SotFactory * pFact )
-{
- void * pRet = nullptr;
- if( !pFact || pFact == ClassFactory() )
- pRet = this;
- return pRet;
-}
-
-/*************************************************************************
-|* SotObject::SotObject()
-|*
-|* Beschreibung
-*************************************************************************/
SotObject::SotObject()
: nOwnerLockCount( 0 )
, bOwner ( true )
, bInClose ( false )
{
- SotFactory::IncSvObjectCount( this );
}
-/*************************************************************************
-|*
-|* SotObject::~SotObject()
-|*
-*************************************************************************/
SotObject::~SotObject()
{
- SotFactory::DecSvObjectCount( this );
}
void SotObject::OwnerLock
diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx
index 63c8cbdb5463..9cdc66ea5e14 100644
--- a/sot/source/sdstor/storage.cxx
+++ b/sot/source/sdstor/storage.cxx
@@ -36,46 +36,10 @@
#include <unotools/ucbhelper.hxx>
#include <comphelper/processfactory.hxx>
-#include <factory.hxx>
-#include <sotdata.hxx>
-
#include <memory>
using namespace ::com::sun::star;
-/************** class SotStorageStream ***********************************/
-class SotStorageStreamFactory : public SotFactory
-{
-public:
- explicit SotStorageStreamFactory(const SvGlobalName& rName)
- : SotFactory(rName)
- {
- }
-};
-
-SotFactory * SotStorageStream::ClassFactory()
-{
- SotFactory **ppFactory = &(SOTDATA()->pSotStorageStreamFactory);
- if( !*ppFactory )
- {
- *ppFactory = new SotStorageStreamFactory(
- SvGlobalName( 0xd7deb420, 0xf902, 0x11d0,
- 0xaa, 0xa1, 0x0, 0xa0, 0x24, 0x9d, 0x55, 0x90 ) );
- (*ppFactory)->PutSuperClass( SotObject::ClassFactory() );
- }
- return *ppFactory;
-}
-
-void * SotStorageStream::Cast( const SotFactory * pFact )
-{
- void * pRet = nullptr;
- if( !pFact || pFact == ClassFactory() )
- pRet = this;
- if( !pRet )
- pRet = SotObject::Cast( pFact );
- return pRet;
-}
-
SvLockBytesRef MakeLockBytes_Impl( const OUString & rName, StreamMode nMode )
{
SvLockBytesRef xLB;
@@ -291,40 +255,6 @@ bool SotStorageStream::SetProperty( const OUString& rName, const css::uno::Any&
}
}
-/************** class SotStorage ******************************************
-*************************************************************************/
-class SotStorageFactory : public SotFactory
-{
-public:
- explicit SotStorageFactory(const SvGlobalName & rName)
- : SotFactory(rName)
- {
- }
-};
-
-SotFactory * SotStorage::ClassFactory()
-{
- SotFactory **ppFactory = &(SOTDATA()->pSotStorageFactory);
- if( !*ppFactory )
- {
- *ppFactory = new SotStorageFactory(
- SvGlobalName( 0x980ce7e0, 0xf905, 0x11d0,
- 0xaa, 0xa1, 0x0, 0xa0, 0x24, 0x9d, 0x55, 0x90 ) );
- (*ppFactory)->PutSuperClass( SotObject::ClassFactory() );
- }
- return *ppFactory;
-}
-
-void * SotStorage::Cast( const SotFactory * pFact )
-{
- void * pRet = nullptr;
- if( !pFact || pFact == ClassFactory() )
- pRet = this;
- if( !pRet )
- pRet = SotObject::Cast( pFact );
- return pRet;
-}
-
/************************************************************************
|*
|* SotStorage::SotStorage()