xref: /aoo41x/main/sw/source/core/inc/dbg_lay.hxx (revision 1d2dbeb0)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _DBG_LAY_HXX
25 #define _DBG_LAY_HXX
26 
27 #define PROT_FILE_INIT  0x00000000
28 #define PROT_INIT		0x00000001
29 #define PROT_MAKEALL	0x00000002
30 #define PROT_MOVE_FWD	0x00000004
31 #define PROT_MOVE_BWD	0x00000008
32 #define PROT_GROW		0x00000010
33 #define PROT_SHRINK		0x00000020
34 #define PROT_GROW_TST	0x00000040
35 #define PROT_SHRINK_TST	0x00000080
36 #define PROT_SIZE		0x00000100
37 #define PROT_PRTAREA	0x00000200
38 #define PROT_POS		0x00000400
39 #define PROT_ADJUSTN	0x00000800
40 #define PROT_SECTION	0x00001000
41 #define PROT_CUT		0x00002000
42 #define PROT_PASTE		0x00004000
43 #define PROT_LEAF		0x00008000
44 #define PROT_TESTFORMAT	0x00010000
45 #define PROT_FRMCHANGES	0x00020000
46 #define PROT_SNAPSHOT   0x00040000
47 
48 #define ACT_START			1
49 #define ACT_END         	2
50 #define ACT_CREATE_MASTER   3
51 #define ACT_CREATE_FOLLOW   4
52 #define ACT_DEL_MASTER   	5
53 #define ACT_DEL_FOLLOW   	6
54 #define ACT_MERGE			7
55 #define ACT_NEXT_SECT		8
56 #define ACT_PREV_SECT		9
57 
58 #define SNAP_LOWER       0x00000001
59 #define SNAP_FLYFRAMES   0x00000002
60 #define SNAP_TABLECONT   0x00000004
61 
62 #ifdef DBG_UTIL
63 
64 #include "swtypes.hxx"
65 
66 class SwImplProtocol;
67 class SwFrm;
68 class SwImplEnterLeave;
69 
70 class SwProtocol
71 {
72 	static sal_uLong nRecord;
73 	static SwImplProtocol* pImpl;
Start()74 	static sal_Bool Start() { return 0 != ( PROT_INIT & nRecord ); }
75 public:
Record()76 	static sal_uLong Record() { return nRecord; }
SetRecord(sal_uLong nNew)77 	static void SetRecord( sal_uLong nNew ) { nRecord = nNew; }
Record(sal_uLong nFunc)78 	static sal_Bool Record( sal_uLong nFunc ) { return 0 != (( nFunc | PROT_INIT ) & nRecord); }
79 	static void Record( const SwFrm* pFrm, sal_uLong nFunction, sal_uLong nAction, void* pParam );
80 	static void Init();
81 	static void Stop();
82     static void SnapShot( const SwFrm* pFrm, sal_uLong nFlags );
83     static void GetVar( const sal_uInt16 nNo, long& rVar );
84 };
85 
86 class SwEnterLeave
87 {
88 	SwImplEnterLeave* pImpl;
89 	void Ctor( const SwFrm* pFrm, sal_uLong nFunc, sal_uLong nAct, void* pPar );
90 	void Dtor();
91 public:
SwEnterLeave(const SwFrm * pFrm,sal_uLong nFunc,sal_uLong nAct,void * pPar)92 	SwEnterLeave( const SwFrm* pFrm, sal_uLong nFunc, sal_uLong nAct, void* pPar )
93 		{ if( SwProtocol::Record( nFunc ) ) Ctor( pFrm, nFunc, nAct, pPar ); else pImpl = NULL; }
~SwEnterLeave()94 	~SwEnterLeave() { if( pImpl ) Dtor(); }
95 };
96 
97 #define PROTOCOL( pFrm, nFunc, nAct, pPar ) { 	if( SwProtocol::Record( nFunc ) )\
98 													SwProtocol::Record( pFrm, nFunc, nAct, pPar ); }
99 #define PROTOCOL_INIT SwProtocol::Init();
100 #define PROTOCOL_STOP SwProtocol::Stop();
101 #define PROTOCOL_ENTER( pFrm, nFunc, nAct, pPar ) SwEnterLeave aEnter( pFrm, nFunc, nAct, pPar );
102 #define PROTOCOL_SNAPSHOT( pFrm, nFlags ) SwProtocol::SnapShot( pFrm, nFlags );
103 #define GET_VARIABLE( nNo, nVar ) SwProtocol::GetVar( nNo, nVar );
104 
105 #else
106 
107 #define PROTOCOL( pFrm, nFunc, nAct, pPar )
108 #define PROTOCOL_INIT
109 #define PROTOCOL_STOP
110 #define PROTOCOL_ENTER( pFrm, nFunc, nAct, pPar )
111 #define PROTOCOL_SNAPSHOT( pFrm, nFlags )
112 #define GET_VARIABLE( nNo, nVar )
113 
114 #endif
115 
116 #endif
117