xref: /trunk/main/sw/source/core/inc/dbg_lay.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
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 _DBG_LAY_HXX
29 #define _DBG_LAY_HXX
30 
31 #define PROT_FILE_INIT  0x00000000
32 #define PROT_INIT       0x00000001
33 #define PROT_MAKEALL    0x00000002
34 #define PROT_MOVE_FWD   0x00000004
35 #define PROT_MOVE_BWD   0x00000008
36 #define PROT_GROW       0x00000010
37 #define PROT_SHRINK     0x00000020
38 #define PROT_GROW_TST   0x00000040
39 #define PROT_SHRINK_TST 0x00000080
40 #define PROT_SIZE       0x00000100
41 #define PROT_PRTAREA    0x00000200
42 #define PROT_POS        0x00000400
43 #define PROT_ADJUSTN    0x00000800
44 #define PROT_SECTION    0x00001000
45 #define PROT_CUT        0x00002000
46 #define PROT_PASTE      0x00004000
47 #define PROT_LEAF       0x00008000
48 #define PROT_TESTFORMAT 0x00010000
49 #define PROT_FRMCHANGES 0x00020000
50 #define PROT_SNAPSHOT   0x00040000
51 
52 #define ACT_START           1
53 #define ACT_END             2
54 #define ACT_CREATE_MASTER   3
55 #define ACT_CREATE_FOLLOW   4
56 #define ACT_DEL_MASTER      5
57 #define ACT_DEL_FOLLOW      6
58 #define ACT_MERGE           7
59 #define ACT_NEXT_SECT       8
60 #define ACT_PREV_SECT       9
61 
62 #define SNAP_LOWER       0x00000001
63 #define SNAP_FLYFRAMES   0x00000002
64 #define SNAP_TABLECONT   0x00000004
65 
66 #ifdef DBG_UTIL
67 
68 #include "swtypes.hxx"
69 
70 class SwImplProtocol;
71 class SwFrm;
72 class SwImplEnterLeave;
73 
74 class SwProtocol
75 {
76     static sal_uLong nRecord;
77     static SwImplProtocol* pImpl;
78     static sal_Bool Start() { return 0 != ( PROT_INIT & nRecord ); }
79 public:
80     static sal_uLong Record() { return nRecord; }
81     static void SetRecord( sal_uLong nNew ) { nRecord = nNew; }
82     static sal_Bool Record( sal_uLong nFunc ) { return 0 != (( nFunc | PROT_INIT ) & nRecord); }
83     static void Record( const SwFrm* pFrm, sal_uLong nFunction, sal_uLong nAction, void* pParam );
84     static void Init();
85     static void Stop();
86     static void SnapShot( const SwFrm* pFrm, sal_uLong nFlags );
87     static void GetVar( const sal_uInt16 nNo, long& rVar );
88 };
89 
90 class SwEnterLeave
91 {
92     SwImplEnterLeave* pImpl;
93     void Ctor( const SwFrm* pFrm, sal_uLong nFunc, sal_uLong nAct, void* pPar );
94     void Dtor();
95 public:
96     SwEnterLeave( const SwFrm* pFrm, sal_uLong nFunc, sal_uLong nAct, void* pPar )
97         { if( SwProtocol::Record( nFunc ) ) Ctor( pFrm, nFunc, nAct, pPar ); else pImpl = NULL; }
98     ~SwEnterLeave() { if( pImpl ) Dtor(); }
99 };
100 
101 #define PROTOCOL( pFrm, nFunc, nAct, pPar ) {   if( SwProtocol::Record( nFunc ) )\
102                                                     SwProtocol::Record( pFrm, nFunc, nAct, pPar ); }
103 #define PROTOCOL_INIT SwProtocol::Init();
104 #define PROTOCOL_STOP SwProtocol::Stop();
105 #define PROTOCOL_ENTER( pFrm, nFunc, nAct, pPar ) SwEnterLeave aEnter( pFrm, nFunc, nAct, pPar );
106 #define PROTOCOL_SNAPSHOT( pFrm, nFlags ) SwProtocol::SnapShot( pFrm, nFlags );
107 #define GET_VARIABLE( nNo, nVar ) SwProtocol::GetVar( nNo, nVar );
108 
109 #else
110 
111 #define PROTOCOL( pFrm, nFunc, nAct, pPar )
112 #define PROTOCOL_INIT
113 #define PROTOCOL_STOP
114 #define PROTOCOL_ENTER( pFrm, nFunc, nAct, pPar )
115 #define PROTOCOL_SNAPSHOT( pFrm, nFlags )
116 #define GET_VARIABLE( nNo, nVar )
117 
118 #endif
119 
120 #endif
121