1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef __FRAMEWORK_MACROS_DEBUG_EVENT_HXX_ 29 #define __FRAMEWORK_MACROS_DEBUG_EVENT_HXX_ 30 31 //************************************************************************************************************* 32 // special macros for event handling 33 //************************************************************************************************************* 34 35 #ifdef ENABLE_EVENTDEBUG 36 37 //_________________________________________________________________________________________________________________ 38 // includes 39 //_________________________________________________________________________________________________________________ 40 41 #ifndef _RTL_STRBUF_HXX_ 42 #include <rtl/strbuf.hxx> 43 #endif 44 45 /*_____________________________________________________________________________________________________________ 46 LOGFILE_EVENTDEBUG 47 48 For follow macros we need a special log file. If user forget to specify anyone, we must do it for him! 49 _____________________________________________________________________________________________________________*/ 50 51 #ifndef LOGFILE_EVENTDEBUG 52 #define LOGFILE_EVENTDEBUG \ 53 "events.log" 54 #endif 55 56 /*_____________________________________________________________________________________________________________ 57 LOG_FRAMEACTIONEVENT( SFRAMETYPE, SFRAMENAME, AFRAMEACTION ) 58 59 Use this macro to print debug informations about sending of events to listener for controling right order. 60 ( Use new scope in macro to declare sBuffer more then on time in same "parentscope"! ) 61 _____________________________________________________________________________________________________________*/ 62 63 #define LOG_FRAMEACTIONEVENT( SFRAMETYPE, SFRAMENAME, AFRAMEACTION ) \ 64 { \ 65 ::rtl::OStringBuffer sBuffer(1024); \ 66 sBuffer.append( "[ " ); \ 67 sBuffer.append( SFRAMETYPE ); \ 68 sBuffer.append( " ] \"" ); \ 69 sBuffer.append( U2B( SFRAMENAME ) ); \ 70 sBuffer.append( "\" send event \"" ); \ 71 switch( AFRAMEACTION ) \ 72 { \ 73 case ::com::sun::star::frame::FrameAction_COMPONENT_ATTACHED : sBuffer.append("COMPONENT ATTACHED" ); \ 74 break; \ 75 case ::com::sun::star::frame::FrameAction_COMPONENT_DETACHING : sBuffer.append("COMPONENT DETACHING" ); \ 76 break; \ 77 case ::com::sun::star::frame::FrameAction_COMPONENT_REATTACHED : sBuffer.append("COMPONENT REATTACHED" ); \ 78 break; \ 79 case ::com::sun::star::frame::FrameAction_FRAME_ACTIVATED : sBuffer.append("FRAME ACTIVATED" ); \ 80 break; \ 81 case ::com::sun::star::frame::FrameAction_FRAME_DEACTIVATING : sBuffer.append("FRAME DEACTIVATING" ); \ 82 break; \ 83 case ::com::sun::star::frame::FrameAction_CONTEXT_CHANGED : sBuffer.append("CONTEXT CHANGED" ); \ 84 break; \ 85 case ::com::sun::star::frame::FrameAction_FRAME_UI_ACTIVATED : sBuffer.append("FRAME UI ACTIVATED" ); \ 86 break; \ 87 case ::com::sun::star::frame::FrameAction_FRAME_UI_DEACTIVATING : sBuffer.append("FRAME UI DEACTIVATING" ); \ 88 break; \ 89 case ::com::sun::star::frame::FrameAction_MAKE_FIXED_SIZE : sBuffer.append("MAKE_FIXED_SIZE" ); \ 90 break; \ 91 default: sBuffer.append("... ERROR: invalid FrameAction detected!" ); \ 92 break; \ 93 } \ 94 sBuffer.append( " ... event to listener.\n\n" ); \ 95 WRITE_LOGFILE( LOGFILE_EVENTDEBUG, sBuffer.makeStringAndClear() ) \ 96 } 97 98 /*_____________________________________________________________________________________________________________ 99 LOG_FRAMEACTIONEVENT( SFRAMETYPE, SFRAMENAME ) 100 101 These macro log information about sending of dispose events to listener. 102 ( Use new scope in macro to declare sBuffer more then on time in same "parentscope"! ) 103 _____________________________________________________________________________________________________________*/ 104 105 #define LOG_DISPOSEEVENT( SFRAMETYPE, SFRAMENAME ) \ 106 { \ 107 ::rtl::OStringBuffer sBuffer(1024); \ 108 sBuffer.append( "[ " ); \ 109 sBuffer.append( SFRAMETYPE ); \ 110 sBuffer.append( " ] \"" ); \ 111 sBuffer.append( U2B( SFRAMENAME ) ); \ 112 sBuffer.append( "\" send dispose event to listener.\n\n"); \ 113 WRITE_LOGFILE( LOGFILE_EVENTDEBUG, sBuffer.makeStringAndClear() ) \ 114 } 115 116 #else // #ifdef ENABLE_EVENTDEBUG 117 118 /*_____________________________________________________________________________________________________________ 119 If right testmode is'nt set - implements these macros empty! 120 _____________________________________________________________________________________________________________*/ 121 122 #undef LOGFILE_EVENTDEBUG 123 #define LOG_FRAMEACTIONEVENT( SFRAMETYPE, SFRAMENAME, AFRAMEACTION ) 124 #define LOG_DISPOSEEVENT( SFRAMETYPE, SFRAMENAME ) 125 126 #endif // #ifdef ENABLE_EVENTDEBUG 127 128 //***************************************************************************************************************** 129 // end of file 130 //***************************************************************************************************************** 131 132 #endif // #ifndef __FRAMEWORK_MACROS_DEBUG_EVENT_HXX_ 133