bump product version to 4.1.6.2
[LibreOffice.git] / framework / inc / macros / debug / event.hxx
blobea79afee426bc33e8363e6dc63927168cbf3d046
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef __FRAMEWORK_MACROS_DEBUG_EVENT_HXX_
21 #define __FRAMEWORK_MACROS_DEBUG_EVENT_HXX_
23 //*************************************************************************************************************
24 // special macros for event handling
25 //*************************************************************************************************************
27 #ifdef ENABLE_EVENTDEBUG
29 #include <rtl/strbuf.hxx>
31 /*_____________________________________________________________________________________________________________
32 LOGFILE_EVENTDEBUG
34 For follow macros we need a special log file. If user forget to specify anyone, we must do it for him!
35 _____________________________________________________________________________________________________________*/
37 #ifndef LOGFILE_EVENTDEBUG
38 #define LOGFILE_EVENTDEBUG \
39 "events.log"
40 #endif
42 /*_____________________________________________________________________________________________________________
43 LOG_FRAMEACTIONEVENT( SFRAMETYPE, SFRAMENAME, AFRAMEACTION )
45 Use this macro to print debug information about sending of events to listener for controling right order.
46 ( Use new scope in macro to declare sBuffer more then on time in same "parentscope"! )
47 _____________________________________________________________________________________________________________*/
49 #define LOG_FRAMEACTIONEVENT( SFRAMETYPE, SFRAMENAME, AFRAMEACTION ) \
50 { \
51 OStringBuffer sBuffer(1024); \
52 sBuffer.append( "[ " ); \
53 sBuffer.append( SFRAMETYPE ); \
54 sBuffer.append( " ] \"" ); \
55 sBuffer.append( U2B( SFRAMENAME ) ); \
56 sBuffer.append( "\" send event \"" ); \
57 switch( AFRAMEACTION ) \
58 { \
59 case ::com::sun::star::frame::FrameAction_COMPONENT_ATTACHED : sBuffer.append("COMPONENT ATTACHED" ); \
60 break; \
61 case ::com::sun::star::frame::FrameAction_COMPONENT_DETACHING : sBuffer.append("COMPONENT DETACHING" ); \
62 break; \
63 case ::com::sun::star::frame::FrameAction_COMPONENT_REATTACHED : sBuffer.append("COMPONENT REATTACHED" ); \
64 break; \
65 case ::com::sun::star::frame::FrameAction_FRAME_ACTIVATED : sBuffer.append("FRAME ACTIVATED" ); \
66 break; \
67 case ::com::sun::star::frame::FrameAction_FRAME_DEACTIVATING : sBuffer.append("FRAME DEACTIVATING" ); \
68 break; \
69 case ::com::sun::star::frame::FrameAction_CONTEXT_CHANGED : sBuffer.append("CONTEXT CHANGED" ); \
70 break; \
71 case ::com::sun::star::frame::FrameAction_FRAME_UI_ACTIVATED : sBuffer.append("FRAME UI ACTIVATED" ); \
72 break; \
73 case ::com::sun::star::frame::FrameAction_FRAME_UI_DEACTIVATING : sBuffer.append("FRAME UI DEACTIVATING" ); \
74 break; \
75 case ::com::sun::star::frame::FrameAction_MAKE_FIXED_SIZE : sBuffer.append("MAKE_FIXED_SIZE" ); \
76 break; \
77 default: sBuffer.append("... ERROR: invalid FrameAction detected!" ); \
78 break; \
79 } \
80 sBuffer.append( " ... event to listener.\n\n" ); \
81 WRITE_LOGFILE( LOGFILE_EVENTDEBUG, sBuffer.makeStringAndClear() ) \
84 /*_____________________________________________________________________________________________________________
85 LOG_FRAMEACTIONEVENT( SFRAMETYPE, SFRAMENAME )
87 These macro log information about sending of dispose events to listener.
88 ( Use new scope in macro to declare sBuffer more then on time in same "parentscope"! )
89 _____________________________________________________________________________________________________________*/
91 #define LOG_DISPOSEEVENT( SFRAMETYPE, SFRAMENAME ) \
92 { \
93 OStringBuffer sBuffer(1024); \
94 sBuffer.append( "[ " ); \
95 sBuffer.append( SFRAMETYPE ); \
96 sBuffer.append( " ] \"" ); \
97 sBuffer.append( U2B( SFRAMENAME ) ); \
98 sBuffer.append( "\" send dispose event to listener.\n\n"); \
99 WRITE_LOGFILE( LOGFILE_EVENTDEBUG, sBuffer.makeStringAndClear() ) \
102 #else // #ifdef ENABLE_EVENTDEBUG
104 /*_____________________________________________________________________________________________________________
105 If right testmode is'nt set - implements these macros empty!
106 _____________________________________________________________________________________________________________*/
108 #undef LOGFILE_EVENTDEBUG
109 #define LOG_FRAMEACTIONEVENT( SFRAMETYPE, SFRAMENAME, AFRAMEACTION )
110 #define LOG_DISPOSEEVENT( SFRAMETYPE, SFRAMENAME )
112 #endif // #ifdef ENABLE_EVENTDEBUG
114 #endif // #ifndef __FRAMEWORK_MACROS_DEBUG_EVENT_HXX_
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */