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