diff options
Diffstat (limited to 'framework/inc/macros')
-rw-r--r-- | framework/inc/macros/debug.hxx | 140 | ||||
-rw-r--r-- | framework/inc/macros/debug/assertion.hxx | 238 | ||||
-rw-r--r-- | framework/inc/macros/debug/event.hxx | 135 | ||||
-rw-r--r-- | framework/inc/macros/debug/filterdbg.hxx | 133 | ||||
-rw-r--r-- | framework/inc/macros/debug/logmechanism.hxx | 105 | ||||
-rw-r--r-- | framework/inc/macros/debug/memorymeasure.hxx | 226 | ||||
-rw-r--r-- | framework/inc/macros/debug/mutex.hxx | 120 | ||||
-rw-r--r-- | framework/inc/macros/debug/plugin.hxx | 205 | ||||
-rw-r--r-- | framework/inc/macros/debug/registration.hxx | 103 | ||||
-rw-r--r-- | framework/inc/macros/debug/targeting.hxx | 255 | ||||
-rw-r--r-- | framework/inc/macros/debug/timemeasure.hxx | 143 | ||||
-rw-r--r-- | framework/inc/macros/generic.hxx | 81 | ||||
-rw-r--r-- | framework/inc/macros/registration.hxx | 227 | ||||
-rw-r--r-- | framework/inc/macros/xinterface.hxx | 711 | ||||
-rw-r--r-- | framework/inc/macros/xserviceinfo.hxx | 275 | ||||
-rw-r--r-- | framework/inc/macros/xtypeprovider.hxx | 717 |
16 files changed, 3814 insertions, 0 deletions
diff --git a/framework/inc/macros/debug.hxx b/framework/inc/macros/debug.hxx new file mode 100644 index 000000000000..d87acba2e22f --- /dev/null +++ b/framework/inc/macros/debug.hxx @@ -0,0 +1,140 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_MACROS_DEBUG_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_HXX_ + +//***************************************************************************************************************** +// Disable all feature of this file in produkt version! +// But enable normal assertion handling (as messagebox) in normal debug version. +// User can overwrite these adjustment with his own values! We will do it only if nothing is set. +//***************************************************************************************************************** + +//----------------------------------------------------------------------------------------------------------------- +// => "personal debug code" +#if OSL_DEBUG_LEVEL > 1 + + // Enable log mechanism for normal assertion and error handling. + // Look for user decisions before! + #ifndef ENABLE_LOGMECHANISM + #define ENABLE_LOGMECHANISM + #endif + // Enable assertion handling himself AND additional warnings. + // The default logtype is MESSAGEBOX. + // see "assertion.hxx" for further informations + #ifndef ENABLE_ASSERTIONS + #define ENABLE_ASSERTIONS + #endif + #ifndef ENABLE_WARNINGS + #define ENABLE_WARNINGS + #endif + +//----------------------------------------------------------------------------------------------------------------- +// => "non product" +#elif OSL_DEBUG_LEVEL > 0 + + // Enable log mechanism for normal assertion and error handling. + // Look for user decisions before! + #ifndef ENABLE_LOGMECHANISM + #define ENABLE_LOGMECHANISM + #endif + // Enable assertion handling himself. + // The default logtype is MESSAGEBOX. + // see "assertion.hxx" for further informations + #ifndef ENABLE_ASSERTIONS + #define ENABLE_ASSERTIONS + #endif + +//----------------------------------------------------------------------------------------------------------------- +// => "product" (OSL_DEBUG_LEVEL == 0) +#else + + #undef ENABLE_LOGMECHANISM + #undef ENABLE_ASSERTIONS + #undef ENABLE_WARNINGS + #undef ENABLE_EVENTDEBUG + #undef ENABLE_REGISTRATIONDEBUG + #undef ENABLE_TARGETINGDEBUG + #undef ENABLE_MUTEXDEBUG +// #undef ENABLE_TIMEMEASURE + #undef ENABLE_MEMORYMEASURE + #undef ENABLE_FILTERDBG + +#endif + +//***************************************************************************************************************** +// generic macros for logging +//***************************************************************************************************************** + +#include <macros/debug/logmechanism.hxx> + +//***************************************************************************************************************** +// special macros for assertion handling +//***************************************************************************************************************** +#include <macros/debug/assertion.hxx> + +//***************************************************************************************************************** +// special macros for event handling +//***************************************************************************************************************** +#include <macros/debug/event.hxx> + +//***************************************************************************************************************** +// special macros to debug service registration +//***************************************************************************************************************** +#include <macros/debug/registration.hxx> + +//***************************************************************************************************************** +// special macros to debug targeting of frames +//***************************************************************************************************************** +#include <macros/debug/targeting.hxx> + +//***************************************************************************************************************** +// special macros to debug threading mechanism +//***************************************************************************************************************** +#include <macros/debug/mutex.hxx> + +//***************************************************************************************************************** +// special macros to measure times of some operations +//***************************************************************************************************************** + +/*OBSOLETE +#include <macros/debug/timemeasure.hxx> +*/ + +//***************************************************************************************************************** +// special macros to debug our filter cache! +//***************************************************************************************************************** +#include <macros/debug/filterdbg.hxx> + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/macros/debug/assertion.hxx b/framework/inc/macros/debug/assertion.hxx new file mode 100644 index 000000000000..f956af1b67e7 --- /dev/null +++ b/framework/inc/macros/debug/assertion.hxx @@ -0,0 +1,238 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_MACROS_DEBUG_ASSERTION_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_ASSERTION_HXX_ + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#if defined( ENABLE_ASSERTIONS ) || defined( ENABLE_WARNINGS ) + + #ifndef _OSL_DIAGNOSE_H_ + #include <osl/diagnose.h> + #endif + + #ifndef _RTL_STRBUF_HXX_ + #include <rtl/strbuf.hxx> + #endif + +#endif + +//***************************************************************************************************************** +// special macros for assertion handling +// 1) LOGTYPE use it to define the output of all assertions, errors, exception infos +// 2) LOGFILE_ASSERTIONS use it to define the file name to log assertions if LOGTYPE=LOGTYPE_FILE... +// 3) LOGFILE_WARNINGS use it to define the file name to log warnings if LOGTYPE=LOGTYPE_FILE... +// +// active for "non product": +// +// 4) LOG_ASSERT( BCONDITION, STEXT ) assert some critical errors wich depend from given condition +// 4a) LOG_ASSERT2( BCONDITION, SMETHOD, STEXT ) same like 4) + additional location of error +// 5) LOG_ERROR( SMETHOD, STEXT ) show errors without any condition +// +// active for debug only! +// +// 6) LOG_EXCEPTION( SMETHOD, SOWNMESSAGE, SEXCEPTIONMESSAGE ) show/log an exception for easier debug +// 7) LOG_WARNING( SMETHOD, STEXT ) should be used to detect leaks in algorithm, mechanism or operation handling +//***************************************************************************************************************** + +//_________________________________________________________________________________________________________________ +#if defined( ENABLE_ASSERTIONS ) || defined( ENABLE_WARNINGS ) + + /*_____________________________________________________________________________________________________________ + LOGFILE_ASSERTIONS + + For follow macros we need a special log file. If user forget to specify anyone, we must do it for him! + _____________________________________________________________________________________________________________*/ + + #ifndef LOGFILE_ASSERTIONS + #define LOGFILE_ASSERTIONS "_framework_assertions.log" + #endif + + /*_____________________________________________________________________________________________________________ + LOG_ASSERT ( BCONDITION, STEXT ) + LOG_ASSERT2( BCONDITION, SMETHOD, STEXT ) + + Forward assertion to logfile (if condition is FALSE - like a DBG_ASSERT!) and continue with program. + Set LOGTYPE to LOGTYPE_FILECONTINUE to do this. + BCONDITION is inserted in "(...)" because user can call this macro with an complex expression! + _____________________________________________________________________________________________________________*/ + #if LOGTYPE==LOGTYPE_FILECONTINUE + + #define LOG_ASSERT( BCONDITION, STEXT ) \ + if ( ( BCONDITION ) == sal_False ) \ + { \ + WRITE_LOGFILE( LOGFILE_ASSERTIONS, STEXT ) \ + } + + #define LOG_ASSERT2( BCONDITION, SMETHOD, STEXT ) \ + if ( ( BCONDITION ) == sal_True ) \ + { \ + ::rtl::OStringBuffer _sAssertBuffer( 256 ); \ + _sAssertBuffer.append( "ASSERT:\n\t" ); \ + _sAssertBuffer.append( SMETHOD ); \ + _sAssertBuffer.append( "\n\t\"" ); \ + _sAssertBuffer.append( STEXT ); \ + _sAssertBuffer.append( "\"\n" ); \ + WRITE_LOGFILE( LOGFILE_ASSERTIONS, _sAssertBuffer.makeStringAndClear() ) \ + } + + #endif + + /*_____________________________________________________________________________________________________________ + LOG_ASSERT ( BCONDITION, STEXT ) + LOG_ASSERT2( BCONDITION, SMETHOD, STEXT ) + + Forward assertion to file and exit the program. + Set LOGTYPE to LOGTYPE_FILEEXIT to do this. + BCONDITION is inserted in "(...)" because user can call this macro with an complex expression! + _____________________________________________________________________________________________________________*/ + #if LOGTYPE==LOGTYPE_FILEEXIT + + #define LOG_ASSERT( BCONDITION, STEXT ) \ + if ( ( BCONDITION ) == sal_False ) \ + { \ + WRITE_LOGFILE( LOGFILE_ASSERTIONS, STEXT ) \ + exit(-1); \ + } + + #define LOG_ASSERT2( BCONDITION, SMETHODE, STEXT ) \ + if ( ( BCONDITION ) == sal_True ) \ + { \ + ::rtl::OStringBuffer _sAssertBuffer( 256 ); \ + _sAssertBuffer.append( "ASSERT:\n\t" ); \ + _sAssertBuffer.append( SMETHOD ); \ + _sAssertBuffer.append( "\n\t\"" ); \ + _sAssertBuffer.append( STEXT ); \ + _sAssertBuffer.append( "\"\n" ); \ + WRITE_LOGFILE( LOGFILE_ASSERTIONS, _sAssertBuffer.makeStringAndClear() ) \ + exit(-1); \ + } + + #endif + + /*_____________________________________________________________________________________________________________ + LOG_ASSERT ( BCONDITION, STEXT ) + LOG_ASSERT2( BCONDITION, SMETHOD, STEXT ) + + Forward assertions to messagebox. (We use OSL_ENSURE to do this.) + Set LOGTYPE to LOGTYPE_MESSAGEBOX to do this. + BCONDITION is inserted in "(...)" because user can call this macro with an complex expression! + _____________________________________________________________________________________________________________*/ + #if LOGTYPE==LOGTYPE_MESSAGEBOX + + #define LOG_ASSERT( BCONDITION, STEXT ) \ + OSL_ENSURE( ( BCONDITION ), STEXT ); + + #define LOG_ASSERT2( BCONDITION, SMETHOD, STEXT ) \ + { \ + ::rtl::OStringBuffer _sAssertBuffer( 256 ); \ + _sAssertBuffer.append( "ASSERT:\n\t" ); \ + _sAssertBuffer.append( SMETHOD ); \ + _sAssertBuffer.append( "\n\t\"" ); \ + _sAssertBuffer.append( STEXT ); \ + _sAssertBuffer.append( "\"\n" ); \ + OSL_ENSURE( !( BCONDITION ), _sAssertBuffer.makeStringAndClear() ); \ + } + + #endif + + /*_____________________________________________________________________________________________________________ + LOG_ERROR( SMETHOD, STEXT ) + + Show an error by using current set output mode by define LOGTYPE! + _____________________________________________________________________________________________________________*/ + + #define LOG_ERROR( SMETHOD, STEXT ) \ + LOG_ASSERT2( sal_True, SMETHOD, STEXT ) + +#else + + // If right testmode is'nt set - implements these macros empty! + #undef LOGFILE_ASSERTIONS + #define LOG_ASSERT( BCONDITION, STEXT ) + #define LOG_ASSERT2( BCONDITION, SMETHOD, STEXT ) + #define LOG_ERROR( SMETHOD, STEXT ) + +#endif // ENABLE_ASSERTIONS + +//_________________________________________________________________________________________________________________ +#if defined( ENABLE_WARNINGS ) + + /*_____________________________________________________________________________________________________________ + LOGFILE_WARNINGS + + For follow macros we need a special log file. If user forget to specify anyone, we must do it for him! + _____________________________________________________________________________________________________________*/ + + #ifndef LOGFILE_WARNINGS + #define LOGFILE_WARNINGS "_framework_warnings.log" + #endif + + /*_____________________________________________________________________________________________________________ + LOG_EXCEPTION( SMETHOD, SOWNMESSAGE, SEXCEPTIONMESSAGE ) + + Show some exception info by using current set output mode by define LOGTYPE! + We use a seperated scope {} do protect us against multiple variable definitions. + _____________________________________________________________________________________________________________*/ + + #define LOG_EXCEPTION( SMETHOD, SOWNMESSAGE, SEXCEPTIONMESSAGE ) \ + { \ + ::rtl::OStringBuffer _sAssertBuffer2( 256 ); \ + _sAssertBuffer2.append( SOWNMESSAGE ); \ + _sAssertBuffer2.append( "\n" ); \ + _sAssertBuffer2.append( U2B(SEXCEPTIONMESSAGE) ); \ + LOG_ERROR( SMETHOD, _sAssertBuffer2.makeStringAndClear() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_WARNING( SMETHOD, STEXT ) + + Use it to show/log warnings for programmer for follow reasons: + - algorithm errors + - undefined states + - unknown errors from other modules ... + _____________________________________________________________________________________________________________*/ + + #define LOG_WARNING( SMETHOD, STEXT ) \ + LOG_ERROR( SMETHOD, STEXT ) + +#else + + // If right testmode is'nt set - implements these macros empty! + #undef LOGFILE_WARNINGS + #define LOG_EXCEPTION( SMETHOD, SOWNMESSAGE, SEXCEPTIONMESSAGE ) + #define LOG_WARNING( SMETHOD, STEXT ) + +#endif // ENABLE_WARNINGS + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_ASSERTION_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/macros/debug/event.hxx b/framework/inc/macros/debug/event.hxx new file mode 100644 index 000000000000..bb472a504e50 --- /dev/null +++ b/framework/inc/macros/debug/event.hxx @@ -0,0 +1,135 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_MACROS_DEBUG_EVENT_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_EVENT_HXX_ + +//************************************************************************************************************* +// special macros for event handling +//************************************************************************************************************* + +#ifdef ENABLE_EVENTDEBUG + + //_________________________________________________________________________________________________________________ + // includes + //_________________________________________________________________________________________________________________ + + #ifndef _RTL_STRBUF_HXX_ + #include <rtl/strbuf.hxx> + #endif + + /*_____________________________________________________________________________________________________________ + LOGFILE_EVENTDEBUG + + For follow macros we need a special log file. If user forget to specify anyone, we must do it for him! + _____________________________________________________________________________________________________________*/ + + #ifndef LOGFILE_EVENTDEBUG + #define LOGFILE_EVENTDEBUG \ + "events.log" + #endif + + /*_____________________________________________________________________________________________________________ + LOG_FRAMEACTIONEVENT( SFRAMETYPE, SFRAMENAME, AFRAMEACTION ) + + Use this macro to print debug informations about sending of events to listener for controling right order. + ( Use new scope in macro to declare sBuffer more then on time in same "parentscope"! ) + _____________________________________________________________________________________________________________*/ + + #define LOG_FRAMEACTIONEVENT( SFRAMETYPE, SFRAMENAME, AFRAMEACTION ) \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "[ " ); \ + sBuffer.append( SFRAMETYPE ); \ + sBuffer.append( " ] \"" ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "\" send event \"" ); \ + switch( AFRAMEACTION ) \ + { \ + case ::com::sun::star::frame::FrameAction_COMPONENT_ATTACHED : sBuffer.append("COMPONENT ATTACHED" ); \ + break; \ + case ::com::sun::star::frame::FrameAction_COMPONENT_DETACHING : sBuffer.append("COMPONENT DETACHING" ); \ + break; \ + case ::com::sun::star::frame::FrameAction_COMPONENT_REATTACHED : sBuffer.append("COMPONENT REATTACHED" ); \ + break; \ + case ::com::sun::star::frame::FrameAction_FRAME_ACTIVATED : sBuffer.append("FRAME ACTIVATED" ); \ + break; \ + case ::com::sun::star::frame::FrameAction_FRAME_DEACTIVATING : sBuffer.append("FRAME DEACTIVATING" ); \ + break; \ + case ::com::sun::star::frame::FrameAction_CONTEXT_CHANGED : sBuffer.append("CONTEXT CHANGED" ); \ + break; \ + case ::com::sun::star::frame::FrameAction_FRAME_UI_ACTIVATED : sBuffer.append("FRAME UI ACTIVATED" ); \ + break; \ + case ::com::sun::star::frame::FrameAction_FRAME_UI_DEACTIVATING : sBuffer.append("FRAME UI DEACTIVATING" ); \ + break; \ + case ::com::sun::star::frame::FrameAction_MAKE_FIXED_SIZE : sBuffer.append("MAKE_FIXED_SIZE" ); \ + break; \ + default: sBuffer.append("... ERROR: invalid FrameAction detected!" ); \ + break; \ + } \ + sBuffer.append( " ... event to listener.\n\n" ); \ + WRITE_LOGFILE( LOGFILE_EVENTDEBUG, sBuffer.makeStringAndClear() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_FRAMEACTIONEVENT( SFRAMETYPE, SFRAMENAME ) + + These macro log information about sending of dispose events to listener. + ( Use new scope in macro to declare sBuffer more then on time in same "parentscope"! ) + _____________________________________________________________________________________________________________*/ + + #define LOG_DISPOSEEVENT( SFRAMETYPE, SFRAMENAME ) \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "[ " ); \ + sBuffer.append( SFRAMETYPE ); \ + sBuffer.append( " ] \"" ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "\" send dispose event to listener.\n\n"); \ + WRITE_LOGFILE( LOGFILE_EVENTDEBUG, sBuffer.makeStringAndClear() ) \ + } + +#else // #ifdef ENABLE_EVENTDEBUG + + /*_____________________________________________________________________________________________________________ + If right testmode is'nt set - implements these macros empty! + _____________________________________________________________________________________________________________*/ + + #undef LOGFILE_EVENTDEBUG + #define LOG_FRAMEACTIONEVENT( SFRAMETYPE, SFRAMENAME, AFRAMEACTION ) + #define LOG_DISPOSEEVENT( SFRAMETYPE, SFRAMENAME ) + +#endif // #ifdef ENABLE_EVENTDEBUG + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_EVENT_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/macros/debug/filterdbg.hxx b/framework/inc/macros/debug/filterdbg.hxx new file mode 100644 index 000000000000..198fcbfc2362 --- /dev/null +++ b/framework/inc/macros/debug/filterdbg.hxx @@ -0,0 +1,133 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_MACROS_DEBUG_FILTERDBG_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_FILTERDBG_HXX_ + +//************************************************************************************************************* +// special macros for time measures +// 1) LOGFILE_FILTERDBG used it to define log file for this operations (default will be set automaticly) +// 4) LOG_FILTERDBG write debug info to log file +//************************************************************************************************************* + +#ifdef ENABLE_FILTERDBG + + //_________________________________________________________________________________________________________________ + // includes + //_________________________________________________________________________________________________________________ + + #ifndef _RTL_STRBUF_HXX_ + #include <rtl/strbuf.hxx> + #endif + + /*_____________________________________________________________________________________________________________ + LOGFILE_FILTERDBG + + For follow macros we need a special log file. If user forget to specify anyone, we must do it for him! + _____________________________________________________________________________________________________________*/ + + #ifndef LOGFILE_FILTERDBG + #define LOGFILE_FILTERDBG "filterdbg.log" + #endif + + /*_____________________________________________________________________________________________________________ + LOG_FILTERDBG( SOPERATION, SMESSAGE ) + + Write special debug info to the log file. + _____________________________________________________________________________________________________________*/ + + #define LOG_FILTERDBG( SOPERATION, SMESSAGE ) \ + { \ + ::rtl::OStringBuffer _sBuffer( 256 ); \ + _sBuffer.append( SOPERATION ); \ + _sBuffer.append( "\t" ); \ + _sBuffer.append( SMESSAGE ); \ + _sBuffer.append( "\n" ); \ + WRITE_LOGFILE( LOGFILE_FILTERDBG, _sBuffer.makeStringAndClear().getStr() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_FILTERDBG_1_PARAM( SOPERATION, SPARAM, SMESSAGE ) + + Write special debug info into the log file and mark SNAME as special parameter before SMESSAGE is printed. + _____________________________________________________________________________________________________________*/ + + #define LOG_FILTERDBG_1_PARAM( SOPERATION, SPARAM, SMESSAGE ) \ + { \ + ::rtl::OStringBuffer _sBuffer( 256 ); \ + _sBuffer.append( SOPERATION ); \ + _sBuffer.append( "\t\"" ); \ + _sBuffer.append( SPARAM ); \ + _sBuffer.append( "\" " ); \ + _sBuffer.append( SMESSAGE ); \ + _sBuffer.append( "\n" ); \ + WRITE_LOGFILE( LOGFILE_FILTERDBG, _sBuffer.makeStringAndClear().getStr() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_COND_FILTERDBG( CONDITION, SOPERATION, SMESSAGE ) + + Write special debug info to the log file, if given condition returns true. + _____________________________________________________________________________________________________________*/ + + #define LOG_COND_FILTERDBG( CONDITION, SOPERATION, SMESSAGE ) \ + if (CONDITION) \ + LOG_FILTERDBG( SOPERATION, SMESSAGE ) + + /*_____________________________________________________________________________________________________________ + LOG_COND_FILTERDBG_1_PARAM( CONDITION, SOPERATION, SPARAM, SMESSAGE ) + + Write special debug info into the log file and mark SNAME as special parameter before SMESSAGE is printed. + But it will be done only, if CONDITION returns true. + _____________________________________________________________________________________________________________*/ + + #define LOG_COND_FILTERDBG_1_PARAM( CONDITION, SOPERATION, SPARAM, SMESSAGE ) \ + if (CONDITION) \ + LOG_FILTERDBG_1_PARAM( SOPERATION, SPARAM, SMESSAGE ) + +#else // #ifdef ENABLE_FILTERDBG + + /*_____________________________________________________________________________________________________________ + If right testmode is'nt set - implements these macros empty! + _____________________________________________________________________________________________________________*/ + + #undef LOGFILE_FILTERDBG + #define LOG_FILTERDBG( SOPERATION, SMESSAGE ) + #define LOG_COND_FILTERDBG( CONDITION, SOPERATION, SMESSAGE ) + #define LOG_FILTERDBG_1_PARAM( SOPERATION, SPARAM, SMESSAGE ) + #define LOG_COND_FILTERDBG_1_PARAM( CONDITION, SOPERATION, SPARAM, SMESSAGE ) + +#endif // #ifdef ENABLE_FILTERDBG + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_FILTERDBG_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/macros/debug/logmechanism.hxx b/framework/inc/macros/debug/logmechanism.hxx new file mode 100644 index 000000000000..4537d813cd87 --- /dev/null +++ b/framework/inc/macros/debug/logmechanism.hxx @@ -0,0 +1,105 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_MACROS_DEBUG_LOGMECHANISM_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_LOGMECHANISM_HXX_ + +//***************************************************************************************************************** +// generic macros for logging +//***************************************************************************************************************** + +#ifdef ENABLE_LOGMECHANISM + + //_____________________________________________________________________________________________________________ + // includes + //_____________________________________________________________________________________________________________ + + #ifndef _RTL_STRING_HXX_ + #include <rtl/string.hxx> + #endif + + #include <stdio.h> + + /*_____________________________________________________________________________________________________________ + WRITE_LOGFILE( SFILENAME, STEXT ) + + Log any information in file. We append any information at file and don't clear it anymore. + ( Use new scope in macro to declare pFile more then on time in same "parentscope"! + Don't control pFile before access! What will you doing if its not valid? Log an error ... + An error and an error is an error ... ) + + Attention: You must use "%s" and STEXT as parameter ... because otherwise encoded strings (they include e.g. %...) + are handled wrong. + _____________________________________________________________________________________________________________*/ + + #define WRITE_LOGFILE( SFILENAME, STEXT ) \ + { \ + ::rtl::OString _swriteLogfileFileName ( SFILENAME ); \ + ::rtl::OString _swriteLogfileText ( STEXT ); \ + FILE* pFile = fopen( _swriteLogfileFileName.getStr(), "a" ); \ + fprintf( pFile, "%s", _swriteLogfileText.getStr() ); \ + fclose ( pFile ); \ + } + + /*_____________________________________________________________________________________________________________ + LOGTYPE + + For other debug macros we need information about the output mode. If user forget to set this information we + do it for him. Valid values are: LOGTYPE_FILECONTINUE + LOGTYPE_FILEEXIT + LOGTYPE_MESSAGEBOX + The normal case is LOGTYPE_MESSAGEBOX to show assertions in normal manner! + _____________________________________________________________________________________________________________*/ + + #define LOGTYPE_MESSAGEBOX 1 + #define LOGTYPE_FILECONTINUE 2 + #define LOGTYPE_FILEEXIT 3 + + #ifndef LOGTYPE + #define LOGTYPE \ + LOGTYPE_MESSAGEBOX + #endif + +#else // #ifdef ENABLE_LOGMECHANISM + + /*_____________________________________________________________________________________________________________ + If right testmode is'nt set - implements these macro empty! + _____________________________________________________________________________________________________________*/ + + #define WRITE_LOGFILE( SFILENAME, STEXT ) + #undef LOGTYPE + +#endif // #ifdef ENABLE_LOGMECHANISM + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_LOGMECHANISM_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/macros/debug/memorymeasure.hxx b/framework/inc/macros/debug/memorymeasure.hxx new file mode 100644 index 000000000000..4a4a17861aed --- /dev/null +++ b/framework/inc/macros/debug/memorymeasure.hxx @@ -0,0 +1,226 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_MACROS_DEBUG_MEMORYMEASURE_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_MEMORYMEASURE_HXX_ + +//************************************************************************************************************* +// special macros for time measures +// 1) LOGFILE_MEMORYMEASURE used it to define log file for this operations (default will be set automaticly) +// 2) MAKE_MEMORY_SNAPSHOT make snapshot of currently set memory informations of OS +// 3) LOG_MEMORYMEASURE write measured time to logfile +//************************************************************************************************************* + +#ifdef ENABLE_MEMORYMEASURE + + #if !defined( WIN ) && !defined( WNT ) + #error "Macros to measure memory access not available under platforms different from windows!" + #endif + + //_________________________________________________________________________________________________________________ + // includes + //_________________________________________________________________________________________________________________ + + #ifndef _RTL_STRBUF_HXX_ + #include <rtl/strbuf.hxx> + #endif + + #ifndef __SGI_STL_VECTOR + #include <vector> + #endif + + /*_____________________________________________________________________________________________________________ + LOGFILE_MEMORYMEASURE + + For follow macros we need a special log file. If user forget to specify anyone, we must do it for him! + _____________________________________________________________________________________________________________*/ + + #ifndef LOGFILE_MEMORYMEASURE + #define LOGFILE_MEMORYMEASURE "memorymeasure.log" + #endif + + /*_____________________________________________________________________________________________________________ + class MemoryMeasure + + We use this baseclass to collect all snapshots in one object and analyze this information at one point. + Macros of this file are used to enable using of this class by special compile-parameter only! + _____________________________________________________________________________________________________________*/ + + class _DBGMemoryMeasure + { + //--------------------------------------------------------------------------------------------------------- + private: + struct _MemoryInfo + { + MEMORYSTATUS aStatus ; + ::rtl::OString sComment ; + }; + + //--------------------------------------------------------------------------------------------------------- + public: + //_____________________________________________________________________________________________________ + inline _DBGMemoryMeasure() + { + } + + //_____________________________________________________________________________________________________ + // clear used container! + inline ~_DBGMemoryMeasure() + { + ::std::vector< _MemoryInfo >().swap( m_lSnapshots ); + } + + //_____________________________________________________________________________________________________ + inline void makeSnapshot( const ::rtl::OString& sComment ) + { + _MemoryInfo aInfo; + aInfo.sComment = sComment; + GlobalMemoryStatus ( &(aInfo.aStatus) ); + m_lSnapshots.push_back( aInfo ); + } + + //_____________________________________________________________________________________________________ + inline ::rtl::OString getLog() + { + ::rtl::OStringBuffer sBuffer( 10000 ); + + if( !m_lSnapshots.empty() ) + { + // Write informations to return buffer + ::std::vector< _MemoryInfo >::const_iterator pItem1; + ::std::vector< _MemoryInfo >::const_iterator pItem2; + + pItem1 = m_lSnapshots.begin(); + pItem2 = pItem1; + ++pItem2; + + while( pItem1!=m_lSnapshots.end() ) + { + sBuffer.append( "snap [ " ); + sBuffer.append( pItem1->sComment ); + sBuffer.append( " ]\n\tavail phys\t=\t" ); + sBuffer.append( (sal_Int32)pItem1->aStatus.dwAvailPhys ); + sBuffer.append( "\n\tavail page\t=\t" ); + sBuffer.append( (sal_Int32)pItem1->aStatus.dwAvailPageFile ); + sBuffer.append( "\n\tavail virt\t=\t" ); + sBuffer.append( (sal_Int32)pItem1->aStatus.dwAvailVirtual ); + sBuffer.append( "\n\tdifference\t=\t[ " ); + + if( pItem1 == m_lSnapshots.begin() ) + { + sBuffer.append( (sal_Int32)pItem1->aStatus.dwAvailPhys ); + sBuffer.append( ", " ); + sBuffer.append( (sal_Int32)pItem1->aStatus.dwAvailPageFile ); + sBuffer.append( ", " ); + sBuffer.append( (sal_Int32)pItem1->aStatus.dwAvailVirtual ); + sBuffer.append( " ]\n\n" ); + } + else if( pItem2 != m_lSnapshots.end() ) + { + sBuffer.append( (sal_Int32)(pItem2->aStatus.dwAvailPhys - pItem1->aStatus.dwAvailPhys ) ); + sBuffer.append( ", " ); + sBuffer.append( (sal_Int32)(pItem2->aStatus.dwAvailPageFile - pItem1->aStatus.dwAvailPageFile ) ); + sBuffer.append( ", " ); + sBuffer.append( (sal_Int32)(pItem2->aStatus.dwAvailVirtual - pItem1->aStatus.dwAvailVirtual ) ); + sBuffer.append( " ]\n\n" ); + } + else + { + sBuffer.append( "0, 0, 0 ]\n\n" ); + } + if( pItem1!=m_lSnapshots.end() ) ++pItem1; + if( pItem2!=m_lSnapshots.end() ) ++pItem2; + } + // clear current list ... make it empty for further snapshots! + ::std::vector< _MemoryInfo >().swap( m_lSnapshots ); + } + + return sBuffer.makeStringAndClear(); + } + + //--------------------------------------------------------------------------------------------------------- + private: + ::std::vector< _MemoryInfo > m_lSnapshots; + }; + + /*_____________________________________________________________________________________________________________ + START_MEMORY_MEASURE + + Create new object to measure memory access. + _____________________________________________________________________________________________________________*/ + + #define START_MEMORYMEASURE( AOBJECT ) \ + _DBGMemoryMeasure AOBJECT; + + /*_____________________________________________________________________________________________________________ + MAKE_MEMORY_SNAPSHOT + + Make snapshot of currently set memory informations of OS. + see _DBGMemoryMeasure for further informations + _____________________________________________________________________________________________________________*/ + + #define MAKE_MEMORY_SNAPSHOT( AOBJECT, SCOMMENT ) \ + AOBJECT.makeSnapshot( SCOMMENT ); + + /*_____________________________________________________________________________________________________________ + LOG_MEMORYMEASURE( SOPERATION, SCOMMENT, AOBJECT ) + + Write measured values to logfile. + _____________________________________________________________________________________________________________*/ + + #define LOG_MEMORYMEASURE( SOPERATION, SCOMMENT, AOBJECT ) \ + { \ + ::rtl::OStringBuffer _sBuffer( 256 ); \ + _sBuffer.append( SOPERATION ); \ + _sBuffer.append( "\n" ); \ + _sBuffer.append( SCOMMENT ); \ + _sBuffer.append( "\n\n" ); \ + _sBuffer.append( AOBJECT.getLog() ); \ + WRITE_LOGFILE( LOGFILE_MEMORYMEASURE, _sBuffer.makeStringAndClear() ) \ + } + +#else // #ifdef ENABLE_MEMORYMEASURE + + /*_____________________________________________________________________________________________________________ + If right testmode is'nt set - implements these macros empty! + _____________________________________________________________________________________________________________*/ + + #undef LOGFILE_MEMORYMEASURE + #define START_MEMORYMEASURE( AOBJECT ) + #define MAKE_MEMORY_SNAPSHOT( AOBJECT, SCOMMENT ) + #define LOG_MEMORYMEASURE( SOPERATION, SCOMMENT, AOBJECT ) + +#endif // #ifdef ENABLE_MEMORYMEASURE + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_MEMORYMEASURE_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/macros/debug/mutex.hxx b/framework/inc/macros/debug/mutex.hxx new file mode 100644 index 000000000000..7d91c57ed1e7 --- /dev/null +++ b/framework/inc/macros/debug/mutex.hxx @@ -0,0 +1,120 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_MACROS_DEBUG_MUTEX_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_MUTEX_HXX_ + +//***************************************************************************************************************** +// special macros for mutex handling +//***************************************************************************************************************** + +#ifdef ENABLE_MUTEXDEBUG + + //_____________________________________________________________________________________________________________ + // includes + //_____________________________________________________________________________________________________________ + + #ifndef _RTL_STRBUF_HXX_ + #include <rtl/strbuf.hxx> + #endif + + /*_____________________________________________________________________________________________________________ + LOGFILE_MUTEX + + For follow macros we need a special log file. If user forget to specify anyone, we must do it for him! + _____________________________________________________________________________________________________________*/ + + #ifndef LOGFILE_MUTEX + #define LOGFILE_MUTEX "mutex.log" + #endif + + /*_____________________________________________________________________________________________________________ + LOG_LOCKTYPE( _EFALLBACK, _ECURRENT ) + + Write informations about current set lock type for whole framework project to special file. + _____________________________________________________________________________________________________________*/ + + #define LOG_LOCKTYPE( _EFALLBACK, _ECURRENT ) \ + /* new scope to prevent us against multiple definitions of variables ... */ \ + { \ + ::rtl::OStringBuffer _sBuffer( 256 ); \ + _sBuffer.append( "Set framework lock type to fallback: \"" ); \ + switch( _EFALLBACK ) \ + { \ + case E_NOTHING : _sBuffer.append( "E_NOTHING" ); \ + break; \ + case E_OWNMUTEX : _sBuffer.append( "E_OWNMUTEX" ); \ + break; \ + case E_SOLARMUTEX : _sBuffer.append( "E_SOLARMUTEX" ); \ + break; \ + case E_FAIRRWLOCK : _sBuffer.append( "E_FAIRRWLOCK" ); \ + break; \ + } \ + _sBuffer.append( "\"\n" ); \ + if( _EFALLBACK != _ECURRENT ) \ + { \ + _sBuffer.append( "... environment overwrite framework lock type with: \"" ); \ + switch( _ECURRENT ) \ + { \ + case E_NOTHING : _sBuffer.append( "E_NOTHING" ); \ + break; \ + case E_OWNMUTEX : _sBuffer.append( "E_OWNMUTEX" ); \ + break; \ + case E_SOLARMUTEX : _sBuffer.append( "E_SOLARMUTEX" ); \ + break; \ + case E_FAIRRWLOCK : _sBuffer.append( "E_FAIRRWLOCK" ); \ + break; \ + } \ + _sBuffer.append( "\"\n" ); \ + } \ + else \ + { \ + _sBuffer.append( "... use fallback, because user don't set another value!\n" ); \ + } \ + WRITE_LOGFILE( LOGFILE_MUTEX, _sBuffer.makeStringAndClear() ) \ + } + +#else // #ifdef ENABLE_MUTEXDEBUG + + /*_____________________________________________________________________________________________________________ + If right testmode is'nt set - implements these macro with normal functionality! + We need the guard but not the log mechanism. + _____________________________________________________________________________________________________________*/ + + #undef LOGFILE_MUTEX + #define LOG_LOCKTYPE( _EFALLBACK, _ECURRENT ) + +#endif // #ifdef ENABLE_MUTEXDEBUG + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_MUTEX_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/macros/debug/plugin.hxx b/framework/inc/macros/debug/plugin.hxx new file mode 100644 index 000000000000..b81edab26de7 --- /dev/null +++ b/framework/inc/macros/debug/plugin.hxx @@ -0,0 +1,205 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_MACROS_DEBUG_PLUGIN_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_PLUGIN_HXX_ + +//***************************************************************************************************************** +// special macros to debug asynchronous methods of plugin frame +//***************************************************************************************************************** + +#ifdef ENABLE_PLUGINDEBUG + + //_____________________________________________________________________________________________________________ + // includes + //_____________________________________________________________________________________________________________ + + #ifndef _RTL_STRBUF_HXX_ + #include <rtl/strbuf.hxx> + #endif + + #ifndef _RTL_STRING_HXX_ + #include <rtl/string.hxx> + #endif + + /*_____________________________________________________________________________________________________________ + LOGFILE_PLUGIN + + For follow macros we need a special log file. If user forget to specify anyone, we must do it for him! + _____________________________________________________________________________________________________________*/ + + #ifndef LOGFILE_PLUGIN + #define LOGFILE_PLUGIN \ + "plugin.log" + #endif + + /*_____________________________________________________________________________________________________________ + LOG_URLSEND( SFRAMENAME, SSENDMODE, SINTERNALURL, SEXTERNALURL ) + + Our plugin forward special url's to plugin dll, browser and webserver. + We convert internal url's to an external notation. + With this macro you can log some parameter of this operation. + _____________________________________________________________________________________________________________*/ + + #define LOG_URLSEND( SFRAMENAME, SSENDMODE, SINTERNALURL, SEXTERNALURL ) \ + /* Use new scope to declare local private variables! */ \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "PlugInFrame [ \"" ); \ + sBuffer.append( SFRAMENAME ); \ + sBuffer.append( "\" ] send " ); \ + sBuffer.append( SSENDMODE ); \ + sBuffer.append( "( internalURL=\"" ); \ + sBuffer.append( U2B( SINTERNALURL ) ); \ + sBuffer.append( "\", externalURL=\""); \ + sBuffer.append( U2B( SEXTERNALURL ) ); \ + sBuffer.append( "\" ) to browser.\n"); \ + WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_URLRECEIVE( SFRAMENAME, SRECEIVEMODE, SEXTERNALURL, SINTERNALURL ) + + A plugin frame can get a url request in two different modes. + 1) newURL() + 2) newStream() + We convert external url's to an internal notation. + With this macro you can log some parameter of this operations. + _____________________________________________________________________________________________________________*/ + + #define LOG_URLRECEIVE( SFRAMENAME, SRECEIVEMODE, SEXTERNALURL, SINTERNALURL ) \ + /* Use new scope to declare local private variables! */ \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "PlugInFrame [ \"" ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "\" ] receive " ); \ + sBuffer.append( SRECEIVEMODE ); \ + sBuffer.append( "( externalURL=\"" ); \ + sBuffer.append( U2B( SEXTERNALURL ) ); \ + sBuffer.append( "\", internalURL=\"" ); \ + sBuffer.append( U2B( SINTERNALURL ) ); \ + sBuffer.append( "\" ) from browser.\n" ); \ + WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_PARAMETER_NEWURL( SFRAMENAME, SMIMETYPE, SURL, AANY ) + + Log information about parameter of a newURL() at a plugin frame. + _____________________________________________________________________________________________________________*/ + + #define LOG_PARAMETER_NEWURL( SFRAMENAME, SMIMETYPE, SURL, sFILTER, AANY ) \ + /* Use new scope to declare local private variables! */ \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "PlugInFrame [ \"" ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "\" ] called with newURL( \"" ); \ + sBuffer.append( U2B( SMIMETYPE ) ); \ + sBuffer.append( "\", \"" ); \ + sBuffer.append( U2B( SURL ) ); \ + sBuffer.append( "\", \"" ); \ + sBuffer.append( U2B( SFILTER ) ); \ + sBuffer.append( "\", " ); \ + if( AANY.hasValue() == sal_True ) \ + { \ + sBuffer.append( "filled Any )" ); \ + } \ + else \ + { \ + sBuffer.append( "empty Any )" ); \ + } \ + sBuffer.append( "\n" ); \ + WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_PARAMETER_NEWSTREAM( SFRAMENAME, SMIMETYPE, SURL, ASTREAM, AANY ) + + Log information about parameter of a newStream() at a plugin frame. + _____________________________________________________________________________________________________________*/ + + #define LOG_PARAMETER_NEWSTREAM( SFRAMENAME, SMIMETYPE, SURL, SFILTER, XSTREAM, AANY ) \ + /* Use new scope to declare local private variables! */ \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "PlugInFrame [ \"" ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "\" ] called with newStream( \""); \ + sBuffer.append( U2B( SMIMETYPE ) ); \ + sBuffer.append( "\", \"" ); \ + sBuffer.append( U2B( SURL ) ); \ + sBuffer.append( "\", \"" ); \ + sBuffer.append( U2B( SFILTER ) ); \ + sBuffer.append( "\", " ); \ + if( XSTREAM.is() == sal_True ) \ + { \ + sal_Int32 nBytes = XSTREAM->available(); \ + OString sInfo("Stream with "); \ + sInfo += OString::valueOf( (sal_Int32)nBytes ); \ + sInfo += " Bytes, "; \ + sBuffer.append( sInfo ); \ + } \ + else \ + { \ + sBuffer.append( "empty Stream, " ); \ + } \ + if( AANY.hasValue() == sal_True ) \ + { \ + sBuffer.append( "filled Any )" ); \ + } \ + else \ + { \ + sBuffer.append( "empty Any )" ); \ + } \ + sBuffer.append( "\n" ); \ + WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear() ) \ + } + +#else // #ifdef ENABLE_PLUGINDEBUG + + /*_____________________________________________________________________________________________________________ + If right testmode is'nt set - implements these macro empty! + _____________________________________________________________________________________________________________*/ + + #undef LOGFILE_PLUGIN + #define LOG_URLSEND( SFRAMENAME, SSENDMODE, SINTERNALURL, SEXTERNALURL ) + #define LOG_URLRECEIVE( SFRAMENAME, SRECEIVEMODE, SEXTERNALURL, SINTERNALURL ) + #define LOG_PARAMETER_NEWURL( SFRAMENAME, SMIMETYPE, SURL, SFILTER, AANY ) + #define LOG_PARAMETER_NEWSTREAM( SFRAMENAME, SMIMETYPE, SURL, SFILTER, XSTREAM, AANY ) + +#endif // #ifdef ENABLE_PLUGINDEBUG + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_PLUGIN_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/macros/debug/registration.hxx b/framework/inc/macros/debug/registration.hxx new file mode 100644 index 000000000000..912dc790f6ab --- /dev/null +++ b/framework/inc/macros/debug/registration.hxx @@ -0,0 +1,103 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_MACROS_DEBUG_REGISTRATION_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_REGISTRATION_HXX_ + +//***************************************************************************************************************** +// special macros for assertion handling +//***************************************************************************************************************** + +#ifdef ENABLE_REGISTRATIONDEBUG + + //_____________________________________________________________________________________________________________ + // includes + //_____________________________________________________________________________________________________________ + + #ifndef _RTL_STRBUF_HXX_ + #include <rtl/strbuf.hxx> + #endif + + /*_____________________________________________________________________________________________________________ + LOGFILE_ASSERTIONS + + For follow macros we need a special log file. If user forget to specify anyone, we must do it for him! + _____________________________________________________________________________________________________________*/ + + #ifndef LOGFILE_REGISTRATION + #define LOGFILE_REGISTRATION \ + "registration.log" + #endif + + /*_____________________________________________________________________________________________________________ + LOG_REGISTRATION_WRITEINFO( SINFOTEXT ) + + Write informations for component_writeInfo() in log file. + _____________________________________________________________________________________________________________*/ + + #define LOG_REGISTRATION_WRITEINFO( SINFOTEXT ) \ + { \ + ::rtl::OStringBuffer sOut( 1024 ); \ + sOut.append( "component_writeInfo():" ); \ + sOut.append( SINFOTEXT ); \ + WRITE_LOGFILE( LOGFILE_REGISTRATION, sOut.makeStringAndClear() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_REGISTRATION_WRITEINFO( SINFOTEXT ) + + Write informations for component_getFactory() in log file. + _____________________________________________________________________________________________________________*/ + + #define LOG_REGISTRATION_GETFACTORY( SINFOTEXT ) \ + { \ + ::rtl::OStringBuffer sOut( 1024 ); \ + sOut.append( "component_getFactory():" ); \ + sOut.append( SINFOTEXT ); \ + WRITE_LOGFILE( LOGFILE_REGISTRATION, sOut.makeStringAndClear() ) \ + } + +#else // #ifdef ENABLE_REGISTRATIONDEBUG + + /*_____________________________________________________________________________________________________________ + If right testmode is'nt set - implements these macro empty! + _____________________________________________________________________________________________________________*/ + + #undef LOGFILE_REGISTRATION + #define LOG_REGISTRATION_WRITEINFO( SINFOTEXT ) + #define LOG_REGISTRATION_GETFACTORY( SINFOTEXT ) + +#endif // #ifdef ENABLE_REGISTRATIONDEBUG + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_REGISTRATION_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/macros/debug/targeting.hxx b/framework/inc/macros/debug/targeting.hxx new file mode 100644 index 000000000000..1e6bed51a407 --- /dev/null +++ b/framework/inc/macros/debug/targeting.hxx @@ -0,0 +1,255 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_MACROS_DEBUG_TARGETING_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_TARGETING_HXX_ + +//***************************************************************************************************************** +// special macros for targeting of frames +//***************************************************************************************************************** + +#ifdef ENABLE_TARGETINGDEBUG + + //_____________________________________________________________________________________________________________ + // includes + //_____________________________________________________________________________________________________________ + + #ifndef _RTL_STRBUF_HXX_ + #include <rtl/strbuf.hxx> + #endif + + /*_____________________________________________________________________________________________________________ + LOGFILE_TARGETING + + For follow macros we need a special log file. If user forget to specify anyone, we must do it for him! + _____________________________________________________________________________________________________________*/ + + #ifndef LOGFILE_TARGETING + #define LOGFILE_TARGETSTEPS "targetsteps.log" + #define LOGFILE_TARGETPARAM "targetparam.log" + #endif + + /*_____________________________________________________________________________________________________________ + LOG_PARAMETER_FINDFRAME( SSERVICE, SFRAMENAME, STARGETNAME, NSEARCHFLAGS ) + + Log format for parameter e.g.: Desktop::findFrame( "frame1", 23 ) my name is "desktop" + Log format for steps e.g.: desktop-- + + With this macro you can log informations about search parameter of method "findFrame()" of an service. + Use it at beginning of search only! + _____________________________________________________________________________________________________________*/ + + #define LOG_PARAMETER_FINDFRAME( SSERVICE, SFRAMENAME, STARGETNAME, NSEARCHFLAGS ) \ + /* Use new scope to prevent code against multiple variable defines! */ \ + { \ + ::rtl::OStringBuffer sBufferParam(256); \ + ::rtl::OStringBuffer sBufferSteps(256); \ + sBufferParam.append( SSERVICE ); \ + sBufferParam.append( "::findFrame( \"" ); \ + sBufferParam.append( U2B( STARGETNAME ) ); \ + sBufferParam.append( "\", " ); \ + sBufferParam.append( ::rtl::OString::valueOf( sal_Int32( NSEARCHFLAGS ) ) ); \ + sBufferParam.append( " ) my name is \"" ); \ + sBufferParam.append( U2B( SFRAMENAME ) ); \ + sBufferParam.append( "\"\n" ); \ + sBufferSteps.append( U2B( SFRAMENAME ) ); \ + sBufferSteps.append( "--" ); \ + WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBufferParam.makeStringAndClear() ) \ + WRITE_LOGFILE( LOGFILE_TARGETSTEPS, sBufferSteps.makeStringAndClear() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_PARAMETER_QUERYDISPATCH( SSERVICE, SFRAMENAME, AURL, STARGETNAME, NSEARCHFLAGS ) + + With this macro you can log informations about search parameter of method "queryDispatch()" of an service. + Use it at beginning of search only! + _____________________________________________________________________________________________________________*/ + + #define LOG_PARAMETER_QUERYDISPATCH( SSERVICE, SFRAMENAME, AURL, STARGETNAME, NSEARCHFLAGS ) \ + /* Use new scope to prevent code against multiple variable defines! */ \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "[ " ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "] " ); \ + sBuffer.append( SSERVICE ); \ + sBuffer.append( "::queryDispatch( \"" ); \ + sBuffer.append( U2B( AURL.Complete ) ); \ + sBuffer.append( "\", \"" ); \ + sBuffer.append( U2B( STARGETNAME ) ); \ + sBuffer.append( "\", " ); \ + sBuffer.append( ::rtl::OString::valueOf( sal_Int32( NSEARCHFLAGS ) ) ); \ + sBuffer.append( " )\n" ); \ + WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBuffer.makeStringAndClear() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_PARAMETER_LOADCOMPONENTFROMURL( SSERVICE, SFRAMENAME, SURL, STARGETNAME, NSEARCHFLAGS, SEQPARAMETER ) + + With this macro you can log informations about search parameter of method "loadComponentFromURL()" of an service. + Use it at beginning of search only! + _____________________________________________________________________________________________________________*/ + + #define LOG_PARAMETER_LOADCOMPONENTFROMURL( SSERVICE, SFRAMENAME, SURL, STARGETNAME, NSEARCHFLAGS, SEQPARAMETER ) \ + /* Use new scope to prevent code against multiple variable defines! */ \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "[ " ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "] " ); \ + sBuffer.append( SSERVICE ); \ + sBuffer.append( "::loadComponentFromURL( \"" ); \ + sBuffer.append( U2B( SURL ) ); \ + sBuffer.append( "\", \"" ); \ + sBuffer.append( U2B( STARGETNAME ) ); \ + sBuffer.append( "\", " ); \ + sBuffer.append( ::rtl::OString::valueOf( sal_Int32( NSEARCHFLAGS ) ) ); \ + sBuffer.append( ", " ); \ + sal_Int32 nCount = SEQPARAMETER.getLength(); \ + for( sal_Int32 nParameter=0; nParameter<nCount; ++nParameter ) \ + { \ + sBuffer.append( U2B( SEQPARAMETER[nParameter].Name )); \ + if( nParameter<(nCount-1) ) \ + { \ + sBuffer.append( " | " ); \ + } \ + } \ + sBuffer.append( " )\n" ); \ + WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBuffer.makeStringAndClear() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_RESULT_FINDFRAME( SSERVICE, SFRAMENAME, XFRAME ) + + With this macro you can log informations about search result of "findFrame()". + Use it at the end of this method only! + _____________________________________________________________________________________________________________*/ + + #define LOG_RESULT_FINDFRAME( SSERVICE, SFRAMENAME, XFRAME ) \ + /* Use new scope to prevent code against multiple variable defines! */ \ + { \ + ::rtl::OStringBuffer sBufferParam(256); \ + ::rtl::OStringBuffer sBufferSteps(256); \ + sBufferParam.append( SSERVICE ); \ + sBufferParam.append( "::findFrame() at \"" ); \ + sBufferParam.append( U2B( SFRAMENAME ) ); \ + sBufferParam.append( "\" " ); \ + if( XFRAME.is() == sal_True ) \ + { \ + sBufferParam.append( "return with valid frame.\n" ); \ + sBufferSteps.append( "OK [" ); \ + sBufferSteps.append( U2B( XFRAME->getName() ) ); \ + sBufferSteps.append( "]\n" ); \ + } \ + else \ + { \ + sBufferParam.append( "return with NULL frame!\n"); \ + sBufferSteps.append( "??\n" ); \ + } \ + WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBufferParam.makeStringAndClear() ) \ + WRITE_LOGFILE( LOGFILE_TARGETSTEPS, sBufferSteps.makeStringAndClear() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_RESULT_QUERYDISPATCH( SSERVICE, SFRAMENAME, XDISPATCHER ) + + With this macro you can log informations about search result of "queryDispatch()". + Use it at the end of this method only! + _____________________________________________________________________________________________________________*/ + + #define LOG_RESULT_QUERYDISPATCH( SSERVICE, SFRAMENAME, XDISPATCHER ) \ + /* Use new scope to prevent code against multiple variable defines! */ \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "[ " ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "] " ); \ + sBuffer.append( SSERVICE ); \ + if( XDISPATCHER.is() == sal_True ) \ + { \ + sBuffer.append( "::queryDispatch() return with valid dispatcher." ); \ + } \ + else \ + { \ + sBuffer.append( "::queryDispatch() return with NULL dispatcher!" ); \ + } \ + sBuffer.append( "\n" ); \ + WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBuffer.makeStringAndClear() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_RESULT_LOADCOMPONENTFROMURL( SSERVICE, SFRAMENAME, XCOMPONENT ) + + With this macro you can log informations about search result of "loadComponentFromURL()". + Use it at the end of this method only! + _____________________________________________________________________________________________________________*/ + + #define LOG_RESULT_LOADCOMPONENTFROMURL( SSERVICE, SFRAMENAME, XCOMPONENT ) \ + /* Use new scope to prevent code against multiple variable defines! */ \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "[ " ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "] " ); \ + sBuffer.append( SSERVICE ); \ + if( XCOMPONENT.is() == sal_True ) \ + { \ + sBuffer.append( "::loadComponentFromURL() return with valid component." ); \ + } \ + else \ + { \ + sBuffer.append( "::loadComponentFromURL() return with NULL component!" ); \ + } \ + sBuffer.append( "\n" ); \ + WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBuffer.makeStringAndClear() ) \ + } + +#else // #ifdef ENABLE_TARGETINGDEBUG + + /*_____________________________________________________________________________________________________________ + If right testmode is'nt set - implements these macro empty! + _____________________________________________________________________________________________________________*/ + + #undef LOGFILE_TARGETPARAM + #undef LOGFILE_TARGETSTEPS + #define LOG_PARAMETER_FINDFRAME( SSERVICE, SFRAMENAME, STARGETNAME, NSEARCHFLAGS ) + #define LOG_PARAMETER_QUERYDISPATCH( SSERVICE, SFRAMENAME, AURL, STARGETNAME, NSEARCHFLAGS ) + #define LOG_PARAMETER_LOADCOMPONENTFROMURL( SSERVICE, SFRAMENAME, SURL, STARGETNAME, NSEARCHFLAGS, SEQPARAMETER ) + #define LOG_RESULT_FINDFRAME( SSERVICE, SFRAMENAME, XFRAME ) + #define LOG_RESULT_QUERYDISPATCH( SSERVICE, SFRAMENAME, XDISPATCHER ) + #define LOG_RESULT_LOADCOMPONENTFROMURL( SSERVICE, SFRAMENAME, XCOMPONENT ) + +#endif // #ifdef ENABLE_TARGETINGDEBUG + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_TARGETING_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/macros/debug/timemeasure.hxx b/framework/inc/macros/debug/timemeasure.hxx new file mode 100644 index 000000000000..e01191cd8f6d --- /dev/null +++ b/framework/inc/macros/debug/timemeasure.hxx @@ -0,0 +1,143 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_MACROS_DEBUG_TIMEMEASURE_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_TIMEMEASURE_HXX_ + +//************************************************************************************************************* +// special macros for time measures +// 1) LOGFILE_TIMEMEASURE used it to define log file for this operations (default will be set automaticly) +// 2) START_TIMEMEASURE start new measure by using given variable names +// 3) START_TIMEMEASURE stop current measure by using given variable names and return time +// 4) LOG_TIMEMEASURE write measured time to logfile +//************************************************************************************************************* + +#ifdef ENABLE_TIMEMEASURE + + //_________________________________________________________________________________________________________________ + // includes + //_________________________________________________________________________________________________________________ + + #ifndef _RTL_STRBUF_HXX_ + #include <rtl/strbuf.hxx> + #endif + + #ifndef _OSL_TIME_H_ + #include <osl/time.h> + #endif + + /*_____________________________________________________________________________________________________________ + LOGFILE_TIMEMEASURE + + For follow macros we need a special log file. If user forget to specify anyone, we must do it for him! + _____________________________________________________________________________________________________________*/ + + #ifndef LOGFILE_TIMEMEASURE + #define LOGFILE_TIMEMEASURE "timemeasure.log" + #endif + + /*_____________________________________________________________________________________________________________ + class TimeMeasure + + We need this inline class as global timer to make it possible measure times over different objects! + zB. Use it as baseclass to start timer at ctor (must be first called baseclass!!!) and stop it by calling stop method. + _____________________________________________________________________________________________________________*/ + + class DBGTimeMeasureBase + { + public: + inline DBGTimeMeasureBase() + { + m_nEnd = 0 ; + m_nStart = osl_getGlobalTimer(); + } + + inline sal_Int32 stopAndGet() + { + m_nEnd = osl_getGlobalTimer(); + return( m_nEnd-m_nStart ); + } + + private: + sal_Int32 m_nStart ; + sal_Int32 m_nEnd ; + }; + + /*_____________________________________________________________________________________________________________ + START_TIMEMEASURE( NSTART, NEND ) + STOP_TIMEMEASURE( NSTART, NEND, NTIME ) + + If you doesn't need a time measure above different classes ... you can try this macros! + They initialize your given members with start end end time ... You can calculate differenz by himself. + _____________________________________________________________________________________________________________*/ + + #define START_TIMEMEASURE( NSTART, NEND ) \ + sal_Int32 NSTART = 0; \ + sal_Int32 NEND = 0; \ + NSTART = osl_getGlobalTimer(); + + #define STOP_TIMEMEASURE( NSTART, NEND, NTIME ) \ + NEND = osl_getGlobalTimer(); \ + sal_Int32 NTIME = NEND-NSTART; + + /*_____________________________________________________________________________________________________________ + LOG_TIMEMEASURE( SOPERATION, NSTART ) + + Write measured time to logfile. + _____________________________________________________________________________________________________________*/ + + #define LOG_TIMEMEASURE( SOPERATION, NTIME ) \ + { \ + ::rtl::OStringBuffer _sBuffer( 256 ); \ + _sBuffer.append( SOPERATION ); \ + _sBuffer.append( "\t=\t" ); \ + _sBuffer.append( (sal_Int32)(NTIME) ); \ + _sBuffer.append( " ms\n" ); \ + WRITE_LOGFILE( LOGFILE_TIMEMEASURE, _sBuffer.makeStringAndClear().getStr() ) \ + } + +#else // #ifdef ENABLE_TIMEMEASURE + + /*_____________________________________________________________________________________________________________ + If right testmode is'nt set - implements these macros empty! + _____________________________________________________________________________________________________________*/ + + #undef LOGFILE_TIMEMEASURE + #define START_TIMEMEASURE( NSTART, NEND ) + #define STOP_TIMEMEASURE( NSTART, NEND, NTIME ) + #define LOG_TIMEMEASURE( SOPERATION, NTIME ) + +#endif // #ifdef ENABLE_TIMEMEASURE + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_TIMEMEASURE_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/macros/generic.hxx b/framework/inc/macros/generic.hxx new file mode 100644 index 000000000000..86a504805584 --- /dev/null +++ b/framework/inc/macros/generic.hxx @@ -0,0 +1,81 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_MACROS_GENERIC_HXX_ +#define __FRAMEWORK_MACROS_GENERIC_HXX_ + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include <rtl/ustring.hxx> +#include <rtl/textenc.h> + +//***************************************************************************************************************** +// generic macros +//***************************************************************************************************************** + +/*_________________________________________________________________________________________________________________ + DECLARE_ASCII( SASCIIVALUE ) + + Use it to declare a constant ascii value at compile time in code. + zB. OUSting sTest = DECLARE_ASCII( "Test" ) +_________________________________________________________________________________________________________________*/ + +#define DECLARE_ASCII( SASCIIVALUE ) \ + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SASCIIVALUE ) ) + +/*_________________________________________________________________________________________________________________ + U2B( SUNICODEVALUE ) + B2U( SASCIIVALUE ) + U2B_ENC( SUNICODEVALUE, AENCODING ) + B2U_ENC( SASCIIVALUE, AENCODING ) + + Use it to convert unicode strings to ascii values and reverse ... + We use UTF8 as default textencoding. If you will change this use U2B_ENC and B2U_ENC! +_________________________________________________________________________________________________________________*/ + +#define U2B( SUNICODEVALUE ) \ + ::rtl::OUStringToOString( SUNICODEVALUE, RTL_TEXTENCODING_UTF8 ) + +#define B2U( SASCIIVALUE ) \ + ::rtl::OStringToOUString( SASCIIVALUE, RTL_TEXTENCODING_UTF8 ) + +#define U2B_ENC( SUNICODEVALUE, AENCODING ) \ + ::rtl::OUStringToOString( SUNICODEVALUE, AENCODING ) + +#define B2U_ENC( SASCIIVALUE, AENCODING ) \ + ::rtl::OStringToOUString( SASCIIVALUE, AENCODING ) + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_GENERIC_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/macros/registration.hxx b/framework/inc/macros/registration.hxx new file mode 100644 index 000000000000..feda6bde8ce9 --- /dev/null +++ b/framework/inc/macros/registration.hxx @@ -0,0 +1,227 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_MACROS_REGISTRATION_HXX_ +#define __FRAMEWORK_MACROS_REGISTRATION_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/debug.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/registry/XRegistryKey.hpp> +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/registry/InvalidRegistryException.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +//namespace framework{ + +/*_________________________________________________________________________________________________________________ + + macros for registration of services + Please use follow public macros only! + + 1) COMPONENTINFO( CLASS ) => use it as parameter for COMPONENT_WRITEINFO( INFOS ) + 2) IFFACTORY( CLASS ) => use it as parameter for COMPONENT_GETFACTORY( IFFACTORIES ) + 3) COMPONENTGETIMPLEMENTATIONENVIRONMENT => use it to define exported function component_getImplementationEnvironment() + 4) COMPONENTWRITEINFO( INFOS ) => use it to define exported function component_writeInfo() + 5) COMPONENTGETFACTORY( IFFACTORIES ) => use it to define exported function component_getFactory() + +_________________________________________________________________________________________________________________*/ + +//***************************************************************************************************************** +// public +// use it as parameter for COMPONENT_WRITEINFO( INFOS ) +//***************************************************************************************************************** + +#define COMPONENTINFO( CLASS ) \ + try \ + { \ + /* Set default result of follow operations !!! */ \ + bReturn = sal_False; \ + /* Do the follow only, if given key is valid ! */ \ + if ( xKey.is() == sal_True ) \ + { \ + LOG_REGISTRATION_WRITEINFO( "\t\t\txKey is valid ...\n" ) \ + /* Build new keyname */ \ + sKeyName = DECLARE_ASCII( "/" ); \ + sKeyName += CLASS::impl_getStaticImplementationName(); \ + sKeyName += DECLARE_ASCII( "/UNO/SERVICES" ); \ + LOG_REGISTRATION_WRITEINFO( "\t\t\tcreate key \"" ) \ + LOG_REGISTRATION_WRITEINFO( U2B( sKeyName ) ) \ + LOG_REGISTRATION_WRITEINFO( "\" ...\n" ) \ + /* Create new key with new name. */ \ + xNewKey = xKey->createKey( sKeyName ); \ + /* If this new key valid ... */ \ + if ( xNewKey.is() == sal_True ) \ + { \ + LOG_REGISTRATION_WRITEINFO( "\t\t\t\ttsuccessful ...\n" ) \ + /* Get information about supported services. */ \ + seqServiceNames = CLASS::impl_getStaticSupportedServiceNames() ; \ + pArray = seqServiceNames.getArray() ; \ + nLength = seqServiceNames.getLength() ; \ + nCounter = 0 ; \ + /* Then set this information on this key. */ \ + for ( nCounter = 0; nCounter < nLength; ++nCounter ) \ + { \ + LOG_REGISTRATION_WRITEINFO( "\t\t\t\twrite key \"" ) \ + LOG_REGISTRATION_WRITEINFO( U2B( pArray[nCounter] ) ) \ + LOG_REGISTRATION_WRITEINFO( "\" to registry ...\n" ) \ + xNewKey->createKey( pArray[nCounter] ); \ + } \ + /* Result of this operations = OK. */ \ + bReturn = sal_True ; \ + } \ + } \ + } \ + catch( ::com::sun::star::registry::InvalidRegistryException& ) \ + { \ + LOG_REGISTRATION_WRITEINFO( "\n\nERROR:\nInvalidRegistryException detected\n\n" ) \ + bReturn = sal_False ; \ + } + +//***************************************************************************************************************** +// public +// use it as parameter for COMPONENT_GETFACTORY( IFFACTORIES ) +//***************************************************************************************************************** +#define IFFACTORY( CLASS ) \ + /* If searched name found ... */ \ + /* You can't add some statements before follow line ... Here can be an ELSE-statement! */ \ + if ( CLASS::impl_getStaticImplementationName().equals( ::rtl::OUString::createFromAscii( pImplementationName ) ) ) \ + { \ + LOG_REGISTRATION_GETFACTORY( "\t\tImplementationname found - try to create factory! ...\n" ) \ + /* ... then create right factory for this service. */ \ + /* xFactory and xServiceManager are local variables of method which use this macro. */ \ + xFactory = CLASS::impl_createFactory( xServiceManager ); \ + } + +//***************************************************************************************************************** +// public +// define helper to get information about service environment +//***************************************************************************************************************** +#define COMPONENTGETIMPLEMENTATIONENVIRONMENT \ + extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvironmentTypeName , \ + uno_Environment** ) \ + { \ + *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ; \ + } + +//***************************************************************************************************************** +// public +// define registration of service +//***************************************************************************************************************** +#define COMPONENTWRITEINFO( INFOS ) \ + extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/ , \ + void* pRegistryKey ) \ + { \ + LOG_REGISTRATION_WRITEINFO( "\t[start]\n" ) \ + /* Set default return value for this operation - if it failed. */ \ + sal_Bool bReturn = sal_False ; \ + if ( pRegistryKey != NULL ) \ + { \ + LOG_REGISTRATION_WRITEINFO( "\t\tpRegistryKey is valid ...\n" ) \ + /* Define variables for following helper macros! */ \ + /* bReturn will set automaticly. */ \ + ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > xKey ; \ + ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > xNewKey ; \ + ::com::sun::star::uno::Sequence< ::rtl::OUString > seqServiceNames ; \ + const ::rtl::OUString* pArray ; \ + sal_Int32 nLength ; \ + sal_Int32 nCounter ; \ + ::rtl::OUString sKeyName ; \ + xKey = reinterpret_cast< ::com::sun::star::registry::XRegistryKey* >( pRegistryKey ); \ + /* This parameter will expand to */ \ + /* "COMPONENT_INFO(a) */ \ + /* ... */ \ + /* COMPONENT_INFO(z)" */ \ + INFOS \ + } \ + LOG_REGISTRATION_WRITEINFO( "\t[end]\n" ) \ + /* Return with result of this operation. */ \ + return bReturn ; \ + } + +//***************************************************************************************************************** +// public +// define method to instanciate new services +//***************************************************************************************************************** +#define COMPONENTGETFACTORY( IFFACTORIES ) \ + extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplementationName , \ + void* pServiceManager , \ + void* /*pRegistryKey*/ ) \ + { \ + LOG_REGISTRATION_GETFACTORY( "\t[start]\n" ) \ + /* Set default return value for this operation - if it failed. */ \ + void* pReturn = NULL ; \ + if ( \ + ( pImplementationName != NULL ) && \ + ( pServiceManager != NULL ) \ + ) \ + { \ + LOG_REGISTRATION_GETFACTORY( "\t\tpImplementationName and pServiceManager are valid ...\n" ) \ + /* Define variables which are used in following macros. */ \ + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > xFactory ; \ + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager ; \ + xServiceManager = reinterpret_cast< ::com::sun::star::lang::XMultiServiceFactory* >( pServiceManager ) ; \ + /* These parameter will expand to */ \ + /* "IF_NAME_CREATECOMPONENTFACTORY(a) */ \ + /* else */ \ + /* ... */ \ + /* else */ \ + /* IF_NAME_CREATECOMPONENTFACTORY(z)" */ \ + IFFACTORIES \ + /* Factory is valid, if service was found. */ \ + if ( xFactory.is() == sal_True ) \ + { \ + LOG_REGISTRATION_GETFACTORY( "\t\t\txFactory valid - service was found ...\n" ) \ + xFactory->acquire(); \ + pReturn = xFactory.get(); \ + } \ + } \ + LOG_REGISTRATION_GETFACTORY( "\t[end]\n" ) \ + /* Return with result of this operation. */ \ + return pReturn ; \ + } + +//} // namespace framework + +#endif // #ifndef __FRAMEWORK_MACROS_REGISTRATION_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/macros/xinterface.hxx b/framework/inc/macros/xinterface.hxx new file mode 100644 index 000000000000..faf81d0e63a3 --- /dev/null +++ b/framework/inc/macros/xinterface.hxx @@ -0,0 +1,711 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_MACROS_XINTERFACE_HXX_ +#define __FRAMEWORK_MACROS_XINTERFACE_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#include <com/sun/star/uno/RuntimeException.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Type.hxx> +#include <cppuhelper/queryinterface.hxx> +#include <rtl/ustring.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +/*_________________________________________________________________________________________________________________ + + macros for declaration and definition of XInterface + Please use follow public macros only! + + 1) DEFINE_XINTERFACE => use it in header to declare XInterface and his methods + 2) DIRECT_INTERFACE( INTERFACE ) => use it as parameter INTERFACEx at 4) if interface not ambigous + 3) DERIVED_INTERFACE( BASEINTERFACE, DERIVEDINTERFACE ) => use it as parameter INTERFACEx at 4) if interface can be ambigous + 4) DECLARE_XINTERFACE_0( CLASS, BASECLASS ) => use it to define implementation of XInterface for 0 additional interface to baseclass + DECLARE_XINTERFACE_1( CLASS, BASECLASS, INTERFACE1 ) => use it to define implementation of XInterface for 1 additional interface to baseclass + ... + DECLARE_XINTERFACE_16( CLASS, BASECLASS, INTERFACE1, ... , INTERFACE16 ) + +_________________________________________________________________________________________________________________*/ + +//***************************************************************************************************************** +// private +// implementation of XInterface::aquire() +// XInterface::release() +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XINTERFACE_AQUIRE_RELEASE( CLASS, BASECLASS ) \ + void SAL_CALL CLASS::acquire() throw() \ + { \ + /* Don't use mutex in methods of XInterface! */ \ + BASECLASS::acquire(); \ + } \ + \ + void SAL_CALL CLASS::release() throw() \ + { \ + /* Don't use mutex in methods of XInterface! */ \ + BASECLASS::release(); \ + } + +//***************************************************************************************************************** +// private +// implementation of XInterface::queryInterface() without any other interfaces! +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XINTERFACE_QUERYINTERFACE_PURE( CLASS, BASECLASS ) \ + ::com::sun::star::uno::Any SAL_CALL CLASS::queryInterface( const ::com::sun::star::uno::Type& aType ) throw( ::com::sun::star::uno::RuntimeException ) \ + { \ + /* Attention: Don't use mutex or guard in this method!!! Is a method of XInterface. */ \ + /* I have no own supported interfaces ... */ \ + /* ... ask baseclass for interfaces! */ \ + return BASECLASS::queryInterface( aType ); \ + } + +//***************************************************************************************************************** +// private +// implementation of XInterface::queryInterface() with max. 12 other interfaces! +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XINTERFACE_QUERYINTERFACE( CLASS, BASECLASS, INTERFACES ) \ + ::com::sun::star::uno::Any SAL_CALL CLASS::queryInterface( const ::com::sun::star::uno::Type& aType ) throw( ::com::sun::star::uno::RuntimeException ) \ + { \ + /* Attention: Don't use mutex or guard in this method!!! Is a method of XInterface. */ \ + /* Ask for my own supported interfaces ... */ \ + ::com::sun::star::uno::Any aReturn ( ::cppu::queryInterface INTERFACES \ + ); \ + /* If searched interface not supported by this class ... */ \ + if ( aReturn.hasValue() == sal_False ) \ + { \ + /* ... ask baseclass for interfaces! */ \ + aReturn = BASECLASS::queryInterface( aType ); \ + } \ + /* Return result of this search. */ \ + return aReturn; \ + } + +//***************************************************************************************************************** +// private +// implementation of XInterface::queryInterface() with more then 12 other interfaces! +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XINTERFACE_QUERYINTERFACE_LARGE( CLASS, BASECLASS, INTERFACES_FIRST, INTERFACES_SECOND ) \ + ::com::sun::star::uno::Any SAL_CALL CLASS::queryInterface( const ::com::sun::star::uno::Type& aType ) throw( ::com::sun::star::uno::RuntimeException ) \ + { \ + /* Attention: Don't use mutex or guard in this method!!! Is a method of XInterface. */ \ + /* Ask for my own supported interfaces ... */ \ + ::com::sun::star::uno::Any aReturn ( ::cppu::queryInterface INTERFACES_FIRST \ + ); \ + /* If searched interface not supported by first group ... */ \ + if ( aReturn.hasValue() == sal_False ) \ + { \ + /* ... search in second group. (cppuhelper support 12 items only!) */ \ + aReturn = ::cppu::queryInterface INTERFACES_SECOND ; \ + /* If searched interface not supported by this class ... */ \ + if ( aReturn.hasValue() == sal_False ) \ + { \ + /* ... ask baseclass for interfaces! */ \ + aReturn = BASECLASS::queryInterface( aType ); \ + } \ + } \ + /* Return result of this search. */ \ + return aReturn; \ + } + +//***************************************************************************************************************** +// private +// complete implementation of XInterface for different use cases +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XINTERFACE_PURE( CLASS, BASECLASS ) \ + PRIVATE_DEFINE_XINTERFACE_AQUIRE_RELEASE( CLASS, BASECLASS ) \ + PRIVATE_DEFINE_XINTERFACE_QUERYINTERFACE_PURE( CLASS, BASECLASS ) + +#define PRIVATE_DEFINE_XINTERFACE( CLASS, BASECLASS, INTERFACES ) \ + PRIVATE_DEFINE_XINTERFACE_AQUIRE_RELEASE( CLASS, BASECLASS ) \ + PRIVATE_DEFINE_XINTERFACE_QUERYINTERFACE( CLASS, BASECLASS, INTERFACES ) + +#define PRIVATE_DEFINE_XINTERFACE_LARGE( CLASS, BASECLASS, INTERFACES_FIRST, INTERFACES_SECOND ) \ + PRIVATE_DEFINE_XINTERFACE_AQUIRE_RELEASE( CLASS, BASECLASS ) \ + PRIVATE_DEFINE_XINTERFACE_QUERYINTERFACE_LARGE( CLASS, BASECLASS, INTERFACES_FIRST, INTERFACES_SECOND ) + +//***************************************************************************************************************** +// private +// help macros to replace INTERFACES in queryInterface() [see before] +//***************************************************************************************************************** +/* +#ifdef ENABLE_SERVICEDEBUG + #define PRIVATE_DEFINE_INTERFACE_1( INTERFACE1 ) \ + static_cast< XSPECIALDEBUGINTERFACE##* >( this ), \ + INTERFACE1 +#else +*/ + #define PRIVATE_DEFINE_INTERFACE_1( INTERFACE1 ) \ + INTERFACE1 +//#endif // #ifdef ENABLE_SERVICEDEBUG + +#define PRIVATE_DEFINE_INTERFACE_2( INTERFACE1, INTERFACE2 ) \ + PRIVATE_DEFINE_INTERFACE_1( INTERFACE1 ), \ + INTERFACE2 + +#define PRIVATE_DEFINE_INTERFACE_3( INTERFACE1, INTERFACE2, INTERFACE3 ) \ + PRIVATE_DEFINE_INTERFACE_2( INTERFACE1, INTERFACE2 ), \ + INTERFACE3 + +#define PRIVATE_DEFINE_INTERFACE_4( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4 ) \ + PRIVATE_DEFINE_INTERFACE_3( INTERFACE1, INTERFACE2, INTERFACE3 ), \ + INTERFACE4 + +#define PRIVATE_DEFINE_INTERFACE_5( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5 ) \ + PRIVATE_DEFINE_INTERFACE_4( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4 ), \ + INTERFACE5 + +#define PRIVATE_DEFINE_INTERFACE_6( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6 ) \ + PRIVATE_DEFINE_INTERFACE_5( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5 ), \ + INTERFACE6 + +#define PRIVATE_DEFINE_INTERFACE_7( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7 ) \ + PRIVATE_DEFINE_INTERFACE_6( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6 ), \ + INTERFACE7 + +#define PRIVATE_DEFINE_INTERFACE_8( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8 ) \ + PRIVATE_DEFINE_INTERFACE_7( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7 ), \ + INTERFACE8 + +#define PRIVATE_DEFINE_INTERFACE_9( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9 ) \ + PRIVATE_DEFINE_INTERFACE_8( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8 ), \ + INTERFACE9 + +#define PRIVATE_DEFINE_INTERFACE_10( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10 ) \ + PRIVATE_DEFINE_INTERFACE_9( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9 ), \ + INTERFACE10 + +#define PRIVATE_DEFINE_INTERFACE_11( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11 ) \ + PRIVATE_DEFINE_INTERFACE_10( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10 ), \ + INTERFACE11 + +//***************************************************************************************************************** +// public +// help macros for follow XInterface definitions +//***************************************************************************************************************** + +// Use it as parameter for DEFINE_XINTERFACE_X(), if you CAN use an interface directly in queryInterface()! +#define DIRECT_INTERFACE( INTERFACE ) \ + static_cast< INTERFACE* >( this ) + +// Use it as parameter for DEFINE_XINTERFACE_X(), if you CAN'T use an interface directly in queryInterface()! +// (zB at ambigous errors!) +#define DERIVED_INTERFACE( BASEINTERFACE, DERIVEDINTERFACE ) \ + static_cast< BASEINTERFACE* >( static_cast< DERIVEDINTERFACE* >( this ) ) + +//***************************************************************************************************************** +// public +// declaration of XInterface +//***************************************************************************************************************** +#define FWK_DECLARE_XINTERFACE \ + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw( ::com::sun::star::uno::RuntimeException ); \ + virtual void SAL_CALL acquire ( ) throw(); \ + virtual void SAL_CALL release ( ) throw(); + +//***************************************************************************************************************** +// public +// implementation of XInterface +//***************************************************************************************************************** + +// implementation of XInterface with 0 additional interface for queryInterface() +#define DEFINE_XINTERFACE_0( CLASS, BASECLASS ) \ + PRIVATE_DEFINE_XINTERFACE_PURE ( CLASS, \ + BASECLASS \ + ) + +// implementation of XInterface with 1 additional interface for queryInterface() +#define DEFINE_XINTERFACE_1( CLASS, BASECLASS, INTERFACE1 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_1 ( INTERFACE1 \ + ) \ + ) \ + ) + +// implementation of XInterface with 2 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_2( CLASS, BASECLASS, INTERFACE1, INTERFACE2 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_2 ( INTERFACE1 , \ + INTERFACE2 \ + ) \ + ) \ + ) + +// implementation of XInterface with 3 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_3( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_3 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 \ + ) \ + ) \ + ) + +// implementation of XInterface with 4 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_4( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_4 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 \ + ) \ + ) \ + ) + +// implementation of XInterface with 5 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_5( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_5 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 \ + ) \ + ) \ + ) + +// implementation of XInterface with 6 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_6( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_6 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 \ + ) \ + ) \ + ) + +// implementation of XInterface with 7 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_7( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_7 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 \ + ) \ + ) \ + ) + +// implementation of XInterface with 8 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_8( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_8 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 \ + ) \ + ) \ + ) + +// implementation of XInterface with 9 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_9( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_9 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 \ + ) \ + ) \ + ) + +// implementation of XInterface with 10 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_10( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_10 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 \ + ) \ + ) \ + ) + +// implementation of XInterface with 11 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_11( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ) \ + ) + +// implementation of XInterface with 12 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_12( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12 ) \ + PRIVATE_DEFINE_XINTERFACE_LARGE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ), \ + ( aType, PRIVATE_DEFINE_INTERFACE_1 ( INTERFACE12 \ + ) \ + ) \ + ) + +// implementation of XInterface with 13 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_13( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13 ) \ + PRIVATE_DEFINE_XINTERFACE_LARGE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ), \ + ( aType, PRIVATE_DEFINE_INTERFACE_2 ( INTERFACE12 , \ + INTERFACE13 \ + ) \ + ) \ + ) + +// implementation of XInterface with 14 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_14( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13, INTERFACE14 ) \ + PRIVATE_DEFINE_XINTERFACE_LARGE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ), \ + ( aType, PRIVATE_DEFINE_INTERFACE_3 ( INTERFACE12 , \ + INTERFACE13 , \ + INTERFACE14 \ + ) \ + ) \ + ) + +// implementation of XInterface with 15 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_15( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13, INTERFACE14, INTERFACE15 ) \ + PRIVATE_DEFINE_XINTERFACE_LARGE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ), \ + ( aType, PRIVATE_DEFINE_INTERFACE_4 ( INTERFACE12 , \ + INTERFACE13 , \ + INTERFACE14 , \ + INTERFACE15 \ + ) \ + ) \ + ) + +// implementation of XInterface with 16 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_16( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13, INTERFACE14, INTERFACE15, INTERFACE16 ) \ + PRIVATE_DEFINE_XINTERFACE_LARGE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ), \ + ( aType, PRIVATE_DEFINE_INTERFACE_5 ( INTERFACE12 , \ + INTERFACE13 , \ + INTERFACE14 , \ + INTERFACE15 , \ + INTERFACE16 \ + ) \ + ) \ + ) + +// implementation of XInterface with 17 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_17( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13, INTERFACE14, INTERFACE15, INTERFACE16, INTERFACE17 ) \ + PRIVATE_DEFINE_XINTERFACE_LARGE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ), \ + ( aType, PRIVATE_DEFINE_INTERFACE_6 ( INTERFACE12 , \ + INTERFACE13 , \ + INTERFACE14 , \ + INTERFACE15 , \ + INTERFACE16 , \ + INTERFACE17 \ + ) \ + ) \ + ) + +// implementation of XInterface with 18 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_18( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13, INTERFACE14, INTERFACE15, INTERFACE16, INTERFACE17, INTERFACE18 ) \ + PRIVATE_DEFINE_XINTERFACE_LARGE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ), \ + ( aType, PRIVATE_DEFINE_INTERFACE_7 ( INTERFACE12 , \ + INTERFACE13 , \ + INTERFACE14 , \ + INTERFACE15 , \ + INTERFACE16 , \ + INTERFACE17 , \ + INTERFACE18 \ + ) \ + ) \ + ) + +// implementation of XInterface with 19 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_19( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13, INTERFACE14, INTERFACE15, INTERFACE16, INTERFACE17, INTERFACE18, INTERFACE19 ) \ + PRIVATE_DEFINE_XINTERFACE_LARGE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ), \ + ( aType, PRIVATE_DEFINE_INTERFACE_8 ( INTERFACE12 , \ + INTERFACE13 , \ + INTERFACE14 , \ + INTERFACE15 , \ + INTERFACE16 , \ + INTERFACE17 , \ + INTERFACE18 , \ + INTERFACE19 \ + ) \ + ) \ + ) + +// implementation of XInterface with 20 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_20( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13, INTERFACE14, INTERFACE15, INTERFACE16, INTERFACE17, INTERFACE18, INTERFACE19, INTERFACE20 ) \ + PRIVATE_DEFINE_XINTERFACE_LARGE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ), \ + ( aType, PRIVATE_DEFINE_INTERFACE_9 ( INTERFACE12 , \ + INTERFACE13 , \ + INTERFACE14 , \ + INTERFACE15 , \ + INTERFACE16 , \ + INTERFACE17 , \ + INTERFACE18 , \ + INTERFACE19 , \ + INTERFACE20 \ + ) \ + ) \ + ) + +// implementation of XInterface with 21 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_21( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13, INTERFACE14, INTERFACE15, INTERFACE16, INTERFACE17, INTERFACE18, INTERFACE19, INTERFACE20, INTERFACE21 ) \ + PRIVATE_DEFINE_XINTERFACE_LARGE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ), \ + ( aType, PRIVATE_DEFINE_INTERFACE_10 ( INTERFACE12 , \ + INTERFACE13 , \ + INTERFACE14 , \ + INTERFACE15 , \ + INTERFACE16 , \ + INTERFACE17 , \ + INTERFACE18 , \ + INTERFACE19 , \ + INTERFACE20 , \ + INTERFACE21 \ + ) \ + ) \ + ) + +// implementation of XInterface with 22 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_22( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13, INTERFACE14, INTERFACE15, INTERFACE16, INTERFACE17, INTERFACE18, INTERFACE19, INTERFACE20, INTERFACE21, INTERFACE22 ) \ + PRIVATE_DEFINE_XINTERFACE_LARGE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ), \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE12 , \ + INTERFACE13 , \ + INTERFACE14 , \ + INTERFACE15 , \ + INTERFACE16 , \ + INTERFACE17 , \ + INTERFACE18 , \ + INTERFACE19 , \ + INTERFACE20 , \ + INTERFACE22 , \ + INTERFACE21 \ + ) \ + ) \ + ) + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_MACROS_XINTERFACE_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/macros/xserviceinfo.hxx b/framework/inc/macros/xserviceinfo.hxx new file mode 100644 index 000000000000..c35815f31d9b --- /dev/null +++ b/framework/inc/macros/xserviceinfo.hxx @@ -0,0 +1,275 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_MACROS_XSERVICEINFO_HXX_ +#define __FRAMEWORK_MACROS_XSERVICEINFO_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/uno/Exception.hpp> +#include <com/sun/star/uno/RuntimeException.hpp> +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Type.hxx> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <cppuhelper/factory.hxx> +#include <comphelper/sequence.hxx> +#include <rtl/ustring.hxx> +#include <rtl/logfile.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +/*_________________________________________________________________________________________________________________ + + macros for declaration and definition of XServiceInfo + Please use follow public macros only! + + 1) DECLARE_XSERVICEINFO => use it to declare XServiceInfo in your header + 2) DEFINE_XSERVICEINFO_MULTISERVICE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) => use it to define XServiceInfo for multi service mode + 3) DEFINE_XSERVICEINFO_ONEINSTANCESERVICE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) => use it to define XServiceInfo for one instance service mode + 4) DEFINE_INIT_SERVICE( CLASS ) => use it to implement your own impl_initService() method, which is neccessary for initializeing object by using his own reference! + +_________________________________________________________________________________________________________________*/ + +//***************************************************************************************************************** +// private +// implementation of XServiceInfo and helper functions +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XSERVICEINFO_BASE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \ + /*===========================================================================================================*/ \ + /* XServiceInfo */ \ + /*===========================================================================================================*/ \ + ::rtl::OUString SAL_CALL CLASS::getImplementationName() throw( css::uno::RuntimeException ) \ + { \ + return impl_getStaticImplementationName(); \ + } \ + \ + /*===========================================================================================================*/ \ + /* XServiceInfo */ \ + /*===========================================================================================================*/ \ + sal_Bool SAL_CALL CLASS::supportsService( const ::rtl::OUString& sServiceName ) throw( css::uno::RuntimeException ) \ + { \ + return ::comphelper::findValue(getSupportedServiceNames(), sServiceName, sal_True).getLength() != 0; \ + } \ + \ + /*===========================================================================================================*/ \ + /* XServiceInfo */ \ + /*===========================================================================================================*/ \ + css::uno::Sequence< ::rtl::OUString > SAL_CALL CLASS::getSupportedServiceNames() throw( css::uno::RuntimeException ) \ + { \ + return impl_getStaticSupportedServiceNames(); \ + } \ + \ + /*===========================================================================================================*/ \ + /* Helper for XServiceInfo */ \ + /*===========================================================================================================*/ \ + css::uno::Sequence< ::rtl::OUString > CLASS::impl_getStaticSupportedServiceNames() \ + { \ + css::uno::Sequence< ::rtl::OUString > seqServiceNames( 1 ); \ + seqServiceNames.getArray() [0] = SERVICENAME ; \ + return seqServiceNames; \ + } \ + \ + /*===========================================================================================================*/ \ + /* Helper for XServiceInfo */ \ + /*===========================================================================================================*/ \ + ::rtl::OUString CLASS::impl_getStaticImplementationName() \ + { \ + return IMPLEMENTATIONNAME ; \ + } + +#define PRIVATE_DEFINE_XSERVICEINFO_OLDSTYLE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \ + PRIVATE_DEFINE_XSERVICEINFO_BASE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \ + /*===========================================================================================================*/ \ + /* Helper for registry */ \ + /* Attention: To avoid against wrong ref counts during our own initialize procedure, we must */ \ + /* use right EXTERNAL handling of them. That's why you should do nothing in your ctor, which could*/ \ + /* work on your ref count! All other things are allowed. Do work with your own reference - please */ \ + /* use "impl_initService()" method. */ \ + /*===========================================================================================================*/ \ + css::uno::Reference< css::uno::XInterface > SAL_CALL CLASS::impl_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) throw( css::uno::Exception ) \ + { \ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework","Ocke.Janssen@sun.com",U2B(IMPLEMENTATIONNAME).getStr()); \ + /* create new instance of service */ \ + CLASS* pClass = new CLASS( xServiceManager ); \ + /* hold it alive by increasing his ref count!!! */ \ + css::uno::Reference< css::uno::XInterface > xService( static_cast< XINTERFACECAST* >(pClass), css::uno::UNO_QUERY ); \ + /* initialize new service instance ... he can use his own refcount ... we hold it! */ \ + pClass->impl_initService(); \ + /* return new created service as reference */ \ + return xService; \ + } + +#define PRIVATE_DEFINE_XSERVICEINFO_NEWSTYLE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \ + PRIVATE_DEFINE_XSERVICEINFO_BASE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \ + /*===========================================================================================================*/ \ + /* Helper for registry */ \ + /* Attention: To avoid against wrong ref counts during our own initialize procedure, we must */ \ + /* use right EXTERNAL handling of them. That's why you should do nothing in your ctor, which could*/ \ + /* work on your ref count! All other things are allowed. Do work with your own reference - please */ \ + /* use "impl_initService()" method. */ \ + /*===========================================================================================================*/ \ + css::uno::Reference< css::uno::XInterface > SAL_CALL CLASS::impl_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager )\ + throw( css::uno::Exception ) \ + { \ + /* retrieve component context from the given service manager */ \ + static const ::rtl::OUString PROP_DEFAULTCONTEXT = ::rtl::OUString::createFromAscii("DefaultContext"); \ + css::uno::Reference< css::beans::XPropertySet > xSMGRProps(xServiceManager, css::uno::UNO_QUERY_THROW); \ + css::uno::Reference< css::uno::XComponentContext > xComponentContext; \ + xSMGRProps->getPropertyValue( PROP_DEFAULTCONTEXT ) >>= xComponentContext; \ + /* create new instance of service */ \ + CLASS* pClass = new CLASS( xComponentContext ); \ + /* hold it alive by increasing his ref count!!! */ \ + css::uno::Reference< css::uno::XInterface > xService( static_cast< XINTERFACECAST* >(pClass), css::uno::UNO_QUERY ); \ + /* initialize new service instance ... he can use his own refcount ... we hold it! */ \ + pClass->impl_initService(); \ + /* return new created service as reference */ \ + return xService; \ + } + +//***************************************************************************************************************** +// private +// definition of helper function createFactory() for multiple services +//***************************************************************************************************************** +#define PRIVATE_DEFINE_SINGLEFACTORY( CLASS ) \ + css::uno::Reference< css::lang::XSingleServiceFactory > CLASS::impl_createFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) \ + { \ + css::uno::Reference< css::lang::XSingleServiceFactory > xReturn ( cppu::createSingleFactory ( xServiceManager , \ + CLASS::impl_getStaticImplementationName() , \ + CLASS::impl_createInstance , \ + CLASS::impl_getStaticSupportedServiceNames() \ + ) \ + ); \ + return xReturn; \ + } + +//***************************************************************************************************************** +// private +// definition of helper function createFactory() for one instance services +//***************************************************************************************************************** +#define PRIVATE_DEFINE_ONEINSTANCEFACTORY( CLASS ) \ + css::uno::Reference< css::lang::XSingleServiceFactory > CLASS::impl_createFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) \ + { \ + css::uno::Reference< css::lang::XSingleServiceFactory > xReturn ( cppu::createOneInstanceFactory ( xServiceManager , \ + CLASS::impl_getStaticImplementationName() , \ + CLASS::impl_createInstance , \ + CLASS::impl_getStaticSupportedServiceNames() \ + ) \ + ); \ + return xReturn; \ + } + +//***************************************************************************************************************** +// public +// declaration of XServiceInfo and helper functions +//***************************************************************************************************************** +#define DECLARE_XSERVICEINFO \ + /* interface XServiceInfo */ \ + virtual ::rtl::OUString SAL_CALL getImplementationName ( ) throw( css::uno::RuntimeException ); \ + virtual sal_Bool SAL_CALL supportsService ( const ::rtl::OUString& sServiceName ) throw( css::uno::RuntimeException ); \ + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames ( ) throw( css::uno::RuntimeException ); \ + /* Helper for XServiceInfo */ \ + static css::uno::Sequence< ::rtl::OUString > SAL_CALL impl_getStaticSupportedServiceNames( ); \ + static ::rtl::OUString SAL_CALL impl_getStaticImplementationName ( ); \ + /* Helper for registry */ \ + static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) throw( css::uno::Exception ); \ + static css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); \ + /* Helper for initialization of service by using own reference! */ \ + virtual void SAL_CALL impl_initService ( ); \ + +//***************************************************************************************************************** +// public +// implementation of XServiceInfo +//***************************************************************************************************************** +#define DEFINE_XSERVICEINFO_MULTISERVICE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \ + PRIVATE_DEFINE_XSERVICEINFO_OLDSTYLE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \ + PRIVATE_DEFINE_SINGLEFACTORY( CLASS ) + +#define DEFINE_XSERVICEINFO_ONEINSTANCESERVICE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \ + PRIVATE_DEFINE_XSERVICEINFO_OLDSTYLE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \ + PRIVATE_DEFINE_ONEINSTANCEFACTORY( CLASS ) + +#define DEFINE_XSERVICEINFO_MULTISERVICE_2( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \ + PRIVATE_DEFINE_XSERVICEINFO_NEWSTYLE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \ + PRIVATE_DEFINE_SINGLEFACTORY( CLASS ) + +#define DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \ + PRIVATE_DEFINE_XSERVICEINFO_NEWSTYLE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \ + PRIVATE_DEFINE_ONEINSTANCEFACTORY( CLASS ) + +//***************************************************************************************************************** +// public +// implementation of service initialize! +// example of using: DEFINE_INIT_SERVICE( MyClassName, +// { +// ... +// Reference< XInterface > xThis( this, UNO_QUERY ); +// myMember* pMember = new myMember( xThis ); +// ... +// } +// ) +//***************************************************************************************************************** +#define DEFINE_INIT_SERVICE( CLASS, FUNCTIONBODY ) \ + void SAL_CALL CLASS::impl_initService() \ + { \ + FUNCTIONBODY \ + } + +#define DEFINE_INIT_SERVICE_WITH_BASECLASS( CLASS, BASECLASS, FUNCTIONBODY ) \ + void SAL_CALL CLASS::impl_initService() \ + { \ + BASECLASS::impl_initService(); \ + { \ + FUNCTIONBODY \ + } \ + } + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_MACROS_XSERVICEINFO_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/macros/xtypeprovider.hxx b/framework/inc/macros/xtypeprovider.hxx new file mode 100644 index 000000000000..00ab9819a9b9 --- /dev/null +++ b/framework/inc/macros/xtypeprovider.hxx @@ -0,0 +1,717 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_MACROS_XTYPEPROVIDER_HXX_ +#define __FRAMEWORK_MACROS_XTYPEPROVIDER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/uno/RuntimeException.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Type.hxx> +#include <cppuhelper/typeprovider.hxx> +#include <osl/mutex.hxx> +#include <rtl/ustring.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +/*_________________________________________________________________________________________________________________ + + macros for declaration and definition of XTypeProvider + Please use follow public macros only! + + 1) DEFINE_XTYPEPROVIDER => use it in header to declare XTypeProvider and his methods + 2) DECLARE_TYPEPROVIDER_0( CLASS ) => use it to define implementation of XTypeProvider for 0 supported type + DECLARE_TYPEPROVIDER_1( CLASS, TYPE1 ) => use it to define implementation of XTypeProvider for 1 supported type + ... + DECLARE_TYPEPROVIDER_16( CLASS, TYPE1, ... , TYPE16 ) + 3) DEFINE_XTYPEPROVIDER_1_WITH_BASECLASS( CLASS, BASECLASS, TYPE1 ) => use it to define implementation of XTypeProvider for 1 additional supported type to baseclass + ... + DEFINE_XTYPEPROVIDER_5_WITH_BASECLASS( CLASS, BASECLASS, TYPE1, ..., TYPE5 ) + +_________________________________________________________________________________________________________________*/ + +//***************************************************************************************************************** +// private +// implementation of XTypeProvider::getImplementationId() +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XTYPEPROVIDER_GETIMPLEMENTATIONID( CLASS ) \ + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL CLASS::getImplementationId() throw( ::com::sun::star::uno::RuntimeException ) \ + { \ + /* Create one Id for all instances of this class. */ \ + /* Use ethernet address to do this! (sal_True) */ \ + /* Optimize this method */ \ + /* We initialize a static variable only one time. And we don't must use a mutex at every call! */ \ + /* For the first call; pID is NULL - for the second call pID is different from NULL! */ \ + static ::cppu::OImplementationId* pID = NULL ; \ + if ( pID == NULL ) \ + { \ + /* Ready for multithreading; get global mutex for first call of this method only! see before */ \ + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); \ + /* Control these pointer again ... it can be, that another instance will be faster then these! */ \ + if ( pID == NULL ) \ + { \ + /* Create a new static ID ... */ \ + static ::cppu::OImplementationId aID( sal_False ); \ + /* ... and set his address to static pointer! */ \ + pID = &aID ; \ + } \ + } \ + return pID->getImplementationId(); \ + } + +//***************************************************************************************************************** +// private +// implementation of XTypeProvider::getTypes() with max. 12 interfaces! +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XTYPEPROVIDER_GETTYPES( CLASS, TYPES ) \ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL CLASS::getTypes() throw( ::com::sun::star::uno::RuntimeException ) \ + { \ + /* Optimize this method ! */ \ + /* We initialize a static variable only one time. */ \ + /* And we don't must use a mutex at every call! */ \ + /* For the first call; pTypeCollection is NULL - */ \ + /* for the second call pTypeCollection is different from NULL! */ \ + static ::cppu::OTypeCollection* pTypeCollection = NULL ; \ + if ( pTypeCollection == NULL ) \ + { \ + /* Ready for multithreading; get global mutex for first call of this method only! see before */ \ + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); \ + /* Control these pointer again ... it can be, that another instance will be faster then these! */ \ + if ( pTypeCollection == NULL ) \ + { \ + /* Create a static typecollection ... */ \ + /* Attention: "TYPES" will expand to "(...)"! */ \ + static ::cppu::OTypeCollection aTypeCollection TYPES ; \ + /* ... and set his address to static pointer! */ \ + pTypeCollection = &aTypeCollection ; \ + } \ + } \ + return pTypeCollection->getTypes(); \ + } + +//***************************************************************************************************************** +// private +// implementation of XTypeProvider::getTypes() with more then 12 interfaces! +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XTYPEPROVIDER_GETTYPES_LARGE( CLASS, TYPES_FIRST, TYPES_SECOND ) \ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL CLASS::getTypes() throw( ::com::sun::star::uno::RuntimeException ) \ + { \ + /* Optimize this method ! */ \ + /* We initialize a static variable only one time. */ \ + /* And we don't must use a mutex at every call! */ \ + /* For the first call; pTypeCollection is NULL - */ \ + /* for the second call pTypeCollection is different from NULL! */ \ + static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >* pTypeCollection = NULL ; \ + if ( pTypeCollection == NULL ) \ + { \ + /* Ready for multithreading; get global mutex for first call of this method only! see before */ \ + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); \ + /* Control these pointer again ... it can be, that another instance will be faster then these! */ \ + if ( pTypeCollection == NULL ) \ + { \ + /* Create two typecollections */ \ + /* (cppuhelper support 12 items per collection only!) */ \ + ::cppu::OTypeCollection aTypeCollection1 TYPES_FIRST ; \ + ::cppu::OTypeCollection aTypeCollection2 TYPES_SECOND ; \ + /* Copy all items from both sequences to one result list! */ \ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > seqTypes1 = aTypeCollection1.getTypes(); \ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > seqTypes2 = aTypeCollection2.getTypes(); \ + sal_Int32 nCount1 = seqTypes1.getLength(); \ + sal_Int32 nCount2 = seqTypes2.getLength(); \ + static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > seqResult ( nCount1+nCount2 ); \ + sal_Int32 nSource = 0; \ + sal_Int32 nDestination= 0; \ + while( nSource<nCount1 ) \ + { \ + seqResult[nDestination] = seqTypes1[nSource]; \ + ++nSource; \ + ++nDestination; \ + } \ + nSource = 0; \ + while( nSource<nCount2 ) \ + { \ + seqResult[nDestination] = seqTypes2[nSource]; \ + ++nSource; \ + ++nDestination; \ + } \ + /* ... and set his address to static pointer! */ \ + pTypeCollection = &seqResult; \ + } \ + } \ + return *pTypeCollection; \ + } + +//***************************************************************************************************************** +// private +// implementation of XTypeProvider::getTypes() with using max. 12 interfaces + baseclass! +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XTYPEPROVIDER_GETTYPES_BASECLASS( CLASS, BASECLASS, TYPES ) \ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL CLASS::getTypes() throw( ::com::sun::star::uno::RuntimeException ) \ + { \ + /* Optimize this method ! */ \ + /* We initialize a static variable only one time. */ \ + /* And we don't must use a mutex at every call! */ \ + /* For the first call; pTypeCollection is NULL - */ \ + /* for the second call pTypeCollection is different from NULL! */ \ + static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >* pTypeCollection = NULL ; \ + if ( pTypeCollection == NULL ) \ + { \ + /* Ready for multithreading; get global mutex for first call of this method only! see before */ \ + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); \ + /* Control these pointer again ... it can be, that another instance will be faster then these! */ \ + if ( pTypeCollection == NULL ) \ + { \ + /* Create static typecollection for my own interfaces! */ \ + static ::cppu::OTypeCollection aTypeCollection TYPES ; \ + /* Copy all items from my list sequences and from my baseclass */ \ + /* to one result list! */ \ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > seqTypes1 = aTypeCollection.getTypes(); \ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > seqTypes2 = BASECLASS::getTypes(); \ + sal_Int32 nCount1 = seqTypes1.getLength(); \ + sal_Int32 nCount2 = seqTypes2.getLength(); \ + static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > seqResult ( nCount1+nCount2 ); \ + sal_Int32 nSource = 0; \ + sal_Int32 nDestination= 0; \ + while( nSource<nCount1 ) \ + { \ + seqResult[nDestination] = seqTypes1[nSource]; \ + ++nSource; \ + ++nDestination; \ + } \ + nSource = 0; \ + while( nSource<nCount2 ) \ + { \ + seqResult[nDestination] = seqTypes2[nSource]; \ + ++nSource; \ + ++nDestination; \ + } \ + /* ... and set his address to static pointer! */ \ + pTypeCollection = &seqResult; \ + } \ + } \ + return *pTypeCollection; \ + } + +//***************************************************************************************************************** +// private +// help macros to replace TYPES in getTypes() [see before] +//***************************************************************************************************************** +#define PRIVATE_DEFINE_TYPE_1( TYPE1 ) \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE1 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_2( TYPE1, TYPE2 ) \ + PRIVATE_DEFINE_TYPE_1( TYPE1 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE2 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_3( TYPE1, TYPE2, TYPE3 ) \ + PRIVATE_DEFINE_TYPE_2( TYPE1, TYPE2 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE3 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_4( TYPE1, TYPE2, TYPE3, TYPE4 ) \ + PRIVATE_DEFINE_TYPE_3( TYPE1, TYPE2, TYPE3 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE4 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_5( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5 ) \ + PRIVATE_DEFINE_TYPE_4( TYPE1, TYPE2, TYPE3, TYPE4 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE5 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_6( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6 ) \ + PRIVATE_DEFINE_TYPE_5( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE6 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_7( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7 ) \ + PRIVATE_DEFINE_TYPE_6( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE7 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_8( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8 ) \ + PRIVATE_DEFINE_TYPE_7( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE8 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_9( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9 ) \ + PRIVATE_DEFINE_TYPE_8( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE9 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_10( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10 ) \ + PRIVATE_DEFINE_TYPE_9( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE10 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_11( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11 ) \ + PRIVATE_DEFINE_TYPE_10( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE11 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_12( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12 ) \ + PRIVATE_DEFINE_TYPE_11( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE12 >*)NULL ) + +//***************************************************************************************************************** +// private +// complete implementation of XTypeProvider +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XTYPEPROVIDER_PURE( CLASS ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_GETIMPLEMENTATIONID( CLASS ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_GETTYPES( CLASS, ::getCppuType(( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider >*)NULL ) ) + +#define PRIVATE_DEFINE_XTYPEPROVIDER( CLASS, TYPES ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_GETIMPLEMENTATIONID( CLASS ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_GETTYPES( CLASS, TYPES ) + +#define PRIVATE_DEFINE_XTYPEPROVIDER_LARGE( CLASS, TYPES_FIRST, TYPES_SECOND ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_GETIMPLEMENTATIONID( CLASS ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_GETTYPES_LARGE( CLASS, TYPES_FIRST, TYPES_SECOND ) + +#define PRIVATE_DEFINE_XTYPEPROVIDER_BASECLASS( CLASS, BASECLASS, TYPES ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_GETIMPLEMENTATIONID( CLASS ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_GETTYPES_BASECLASS( CLASS, BASECLASS, TYPES ) + +//***************************************************************************************************************** +// public +// declaration of XTypeProvider +//***************************************************************************************************************** +#define FWK_DECLARE_XTYPEPROVIDER \ + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes () throw( ::com::sun::star::uno::RuntimeException );\ + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw( ::com::sun::star::uno::RuntimeException ); + +//***************************************************************************************************************** +// public +// implementation of XTypeProvider +//***************************************************************************************************************** +// implementation of XTypeProvider without additional interface for getTypes() +// XTypeProvider is used as the only one interface automaticly. +// Following defines don't use XTypeProvider automaticly!!!! +#define DEFINE_XTYPEPROVIDER_0( CLASS ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_PURE( CLASS ) + +// implementation of XTypeProvider with 1 additional interface for getTypes() +#define DEFINE_XTYPEPROVIDER_1( CLASS, TYPE1 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_1 ( TYPE1 \ + )) \ + ) + +// implementation of XTypeProvider with 2 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_2( CLASS, TYPE1, TYPE2 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_2 ( TYPE1 , \ + TYPE2 \ + )) \ + ) + +// implementation of XTypeProvider with 3 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_3( CLASS, TYPE1, TYPE2, TYPE3 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_3 ( TYPE1 , \ + TYPE2 , \ + TYPE3 \ + )) \ + ) + +// implementation of XTypeProvider with 4 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_4( CLASS, TYPE1, TYPE2, TYPE3, TYPE4 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_4 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 \ + )) \ + ) + +// implementation of XTypeProvider with 5 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_5( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_5 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 \ + )) \ + ) + +// implementation of XTypeProvider with 6 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_6( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_6 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 \ + )) \ + ) + +// implementation of XTypeProvider with 7 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_7( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_7 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 \ + )) \ + ) + +// implementation of XTypeProvider with 8 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_8( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_8 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 \ + )) \ + ) + +// implementation of XTypeProvider with 9 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_9( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_9 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 \ + )) \ + ) + +// implementation of XTypeProvider with 10 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_10( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_10 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 \ + )) \ + ) + +// implementation of XTypeProvider with 11 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_11( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_11 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 , \ + TYPE11 \ + )) \ + ) + +// implementation of XTypeProvider with 12 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_12( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_12 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 , \ + TYPE11 , \ + TYPE12 \ + )) \ + ) + +// implementation of XTypeProvider with 13 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_13( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ + (PRIVATE_DEFINE_TYPE_12 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 , \ + TYPE11 , \ + TYPE12 \ + )), \ + (PRIVATE_DEFINE_TYPE_1 ( TYPE13 \ + )) \ + ) + +// implementation of XTypeProvider with 14 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_14( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13, TYPE14 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ + (PRIVATE_DEFINE_TYPE_12 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 , \ + TYPE11 , \ + TYPE12 \ + )), \ + (PRIVATE_DEFINE_TYPE_2 ( TYPE13 , \ + TYPE14 \ + )) \ + ) + +// implementation of XTypeProvider with 15 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_15( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13, TYPE14, TYPE15 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ + (PRIVATE_DEFINE_TYPE_12 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 , \ + TYPE11 , \ + TYPE12 \ + )), \ + (PRIVATE_DEFINE_TYPE_3 ( TYPE13 , \ + TYPE14 , \ + TYPE15 \ + )) \ + ) + +// implementation of XTypeProvider with 16 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_16( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13, TYPE14, TYPE15, TYPE16 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ + (PRIVATE_DEFINE_TYPE_12 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 , \ + TYPE11 , \ + TYPE12 \ + )), \ + (PRIVATE_DEFINE_TYPE_4 ( TYPE13 , \ + TYPE14 , \ + TYPE15 , \ + TYPE16 \ + )) \ + ) + +// implementation of XTypeProvider with 17 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_17( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13, TYPE14, TYPE15, TYPE16, TYPE17 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ + (PRIVATE_DEFINE_TYPE_12 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 , \ + TYPE11 , \ + TYPE12 \ + )), \ + (PRIVATE_DEFINE_TYPE_5 ( TYPE13 , \ + TYPE14 , \ + TYPE15 , \ + TYPE16 , \ + TYPE17 \ + )) \ + ) + +// implementation of XTypeProvider with 18 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_18( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13, TYPE14, TYPE15, TYPE16, TYPE17, TYPE18 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ + (PRIVATE_DEFINE_TYPE_12 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 , \ + TYPE11 , \ + TYPE12 \ + )), \ + (PRIVATE_DEFINE_TYPE_6 ( TYPE13 , \ + TYPE14 , \ + TYPE15 , \ + TYPE16 , \ + TYPE17 , \ + TYPE18 \ + )) \ + ) + +// implementation of XTypeProvider with 19 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_19( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13, TYPE14, TYPE15, TYPE16, TYPE17, TYPE18, TYPE19 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ + (PRIVATE_DEFINE_TYPE_12 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 , \ + TYPE11 , \ + TYPE12 \ + )), \ + (PRIVATE_DEFINE_TYPE_7 ( TYPE13 , \ + TYPE14 , \ + TYPE15 , \ + TYPE16 , \ + TYPE17 , \ + TYPE18 , \ + TYPE19 \ + )) \ + ) + +// implementation of XTypeProvider with 20 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_20( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13, TYPE14, TYPE15, TYPE16, TYPE17, TYPE18, TYPE19, TYPE20 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ + (PRIVATE_DEFINE_TYPE_12 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 , \ + TYPE11 , \ + TYPE12 \ + )), \ + (PRIVATE_DEFINE_TYPE_8 ( TYPE13 , \ + TYPE14 , \ + TYPE15 , \ + TYPE16 , \ + TYPE17 , \ + TYPE18 , \ + TYPE19 , \ + TYPE20 \ + )) \ + ) + +// implementation of XTypeProvider with 1 additional interface for getTypes() AND using 1 baseclass +#define DEFINE_XTYPEPROVIDER_1_WITH_BASECLASS( CLASS, BASECLASS, TYPE1 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_BASECLASS ( CLASS, \ + BASECLASS, \ + (PRIVATE_DEFINE_TYPE_1 ( TYPE1 \ + )) \ + ) + +// implementation of XTypeProvider with 2 additional interface for getTypes() AND using 1 baseclass +#define DEFINE_XTYPEPROVIDER_2_WITH_BASECLASS( CLASS, BASECLASS, TYPE1, TYPE2 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_BASECLASS ( CLASS, \ + BASECLASS, \ + (PRIVATE_DEFINE_TYPE_2 ( TYPE1 , \ + TYPE2 \ + )) \ + ) + +// implementation of XTypeProvider with 3 additional interface for getTypes() AND using 1 baseclass +#define DEFINE_XTYPEPROVIDER_3_WITH_BASECLASS( CLASS, BASECLASS, TYPE1, TYPE2, TYPE3 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_BASECLASS ( CLASS, \ + BASECLASS, \ + (PRIVATE_DEFINE_TYPE_3 ( TYPE1 , \ + TYPE2 , \ + TYPE3 \ + )) \ + ) +// implementation of XTypeProvider with 4 additional interface for getTypes() AND using 1 baseclass +#define DEFINE_XTYPEPROVIDER_4_WITH_BASECLASS( CLASS, BASECLASS, TYPE1, TYPE2, TYPE3, TYPE4 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_BASECLASS ( CLASS, \ + BASECLASS, \ + (PRIVATE_DEFINE_TYPE_4 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 \ + )) \ + ) +// implementation of XTypeProvider with 5 additional interface for getTypes() AND using 1 baseclass +#define DEFINE_XTYPEPROVIDER_5_WITH_BASECLASS( CLASS, BASECLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_BASECLASS ( CLASS, \ + BASECLASS, \ + (PRIVATE_DEFINE_TYPE_5 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 \ + )) \ + ) + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_MACROS_XTYPEPROVIDER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |