reduce static_initialization_and_destruction chain

Change-Id: Ic709bb128a82016b1bbc2c43cf4fe7ad091e7b1a
This commit is contained in:
Caolán McNamara
2012-05-25 15:41:59 +01:00
parent 2899b1ade4
commit 6e12f367d5
2 changed files with 19 additions and 75 deletions

View File

@@ -30,15 +30,6 @@
#include "macros.hxx"
namespace filter { namespace config {
extern rtl::OUString pFilterStrings[];
} }
#ifndef PROPNAME_IMPL_DECL
# define PROPNAME_DECL(index, str) (pFilterStrings[(index)])
#else
# define PROPNAME_DECL(index, str) pFilterStrings[(index)] = _FILTER_CONFIG_FROM_ASCII_(str)
#endif
/* disable impl_loadOnDemand function of BaseContainer for certain
functions, where it the feature "impl_loadItemOnDemand() of class FilterCache
can be used instead of loadAll()!*/
@@ -50,40 +41,40 @@ extern rtl::OUString pFilterStrings[];
configuration API and can be used at all name containers
(based on this filtercache) too.
*/
#define PROPNAME_NAME PROPNAME_DECL(0, "Name")
#define PROPNAME_NAME "Name"
/** @short used to identify a type item property against the
configuration API and can be used at all name containers
(based on this filtercache) too.
*/
#define PROPNAME_UINAME PROPNAME_DECL(1, "UIName" )
#define PROPNAME_UINAMES PROPNAME_DECL(2, "UINames" )
#define PROPNAME_PREFERRED PROPNAME_DECL(3, "Preferred" )
#define PROPNAME_PREFERREDFILTER PROPNAME_DECL(4, "PreferredFilter" )
#define PROPNAME_DETECTSERVICE PROPNAME_DECL(5, "DetectService" )
#define PROPNAME_MEDIATYPE PROPNAME_DECL(6, "MediaType" )
#define PROPNAME_CLIPBOARDFORMAT PROPNAME_DECL(7, "ClipboardFormat" )
#define PROPNAME_URLPATTERN PROPNAME_DECL(8, "URLPattern" )
#define PROPNAME_EXTENSIONS PROPNAME_DECL(9, "Extensions" )
#define PROPNAME_UINAME "UIName"
#define PROPNAME_UINAMES "UINames"
#define PROPNAME_PREFERRED "Preferred"
#define PROPNAME_PREFERREDFILTER "PreferredFilter"
#define PROPNAME_DETECTSERVICE "DetectService"
#define PROPNAME_MEDIATYPE "MediaType"
#define PROPNAME_CLIPBOARDFORMAT "ClipboardFormat"
#define PROPNAME_URLPATTERN "URLPattern"
#define PROPNAME_EXTENSIONS "Extensions"
/** @short used to identify a filter item property against the
configuration API and can be used at all name containers
(based on this filtercache) too.
*/
#define PROPNAME_TYPE PROPNAME_DECL(10, "Type" )
#define PROPNAME_DOCUMENTSERVICE PROPNAME_DECL(11, "DocumentService" )
#define PROPNAME_FILTERSERVICE PROPNAME_DECL(12, "FilterService" )
#define PROPNAME_UICOMPONENT PROPNAME_DECL(13, "UIComponent" )
#define PROPNAME_FLAGS PROPNAME_DECL(14, "Flags" )
#define PROPNAME_USERDATA PROPNAME_DECL(15, "UserData" )
#define PROPNAME_TEMPLATENAME PROPNAME_DECL(16, "TemplateName" )
#define PROPNAME_FILEFORMATVERSION PROPNAME_DECL(17, "FileFormatVersion")
#define PROPNAME_TYPE "Type"
#define PROPNAME_DOCUMENTSERVICE "DocumentService"
#define PROPNAME_FILTERSERVICE "FilterService"
#define PROPNAME_UICOMPONENT "UIComponent"
#define PROPNAME_FLAGS "Flags"
#define PROPNAME_USERDATA "UserData"
#define PROPNAME_TEMPLATENAME "TemplateName"
#define PROPNAME_FILEFORMATVERSION "FileFormatVersion"
/** @short used to identify a frame loader or detect service item
property against the configuration API and can be used
at all name containers (based on this filtercache) too.
*/
#define PROPNAME_TYPES PROPNAME_DECL(18, "Types")
#define PROPNAME_TYPES "Types"
/** @short used to identify the list of sorted filters for a specific
office module

View File

@@ -30,12 +30,6 @@
#include <cppuhelper/factory.hxx>
#include <rtl/instance.hxx>
#ifdef _FILTER_CONFIG_CONSTANT_HXX_
# error "Already included constant.hxx"
#else
# define PROPNAME_IMPL_DECL
# include "constant.hxx"
#endif
#include "typedetection.hxx"
#include "filterfactory.hxx"
#include "contenthandlerfactory.hxx"
@@ -53,45 +47,6 @@ namespace css = ::com::sun::star;
//_______________________________________________
// definitions
rtl::OUString pFilterStrings[19];
namespace
{
class doInitConstants
{
public:
doInitConstants()
{
PROPNAME_NAME;
PROPNAME_UINAME;
PROPNAME_UINAMES;
PROPNAME_PREFERRED;
PROPNAME_PREFERREDFILTER;
PROPNAME_DETECTSERVICE;
PROPNAME_MEDIATYPE;
PROPNAME_CLIPBOARDFORMAT;
PROPNAME_URLPATTERN;
PROPNAME_EXTENSIONS;
PROPNAME_TYPE;
PROPNAME_DOCUMENTSERVICE;
PROPNAME_FILTERSERVICE;
PROPNAME_UICOMPONENT;
PROPNAME_FLAGS;
PROPNAME_USERDATA;
PROPNAME_TEMPLATENAME;
PROPNAME_FILEFORMATVERSION;
PROPNAME_TYPES;
}
};
struct theConstantsInitializer : public rtl::Static< doInitConstants, theConstantsInitializer > {};
}
static void InitConstants()
{
theConstantsInitializer::get();
}
extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL
filterconfig1_component_getFactory( const sal_Char* pImplementationName,
void* pServiceManager,
@@ -100,8 +55,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL
if ((!pImplementationName) || (!pServiceManager ))
return NULL;
InitConstants();
com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
xSMGR = reinterpret_cast< com::sun::star::lang::XMultiServiceFactory* >(pServiceManager);
com::sun::star::uno::Reference< com::sun::star::lang::XSingleServiceFactory > xFactory;