Bump version to 4.1-6
[LibreOffice.git] / sfx2 / source / inc / sfxtypes.hxx
blobaa573a002687f00f1c10a6641d8d9dc540338e61
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 .
19 #ifndef _SFX_SFXTYPES_HXX
20 #define _SFX_SFXTYPES_HXX
22 #include <tools/debug.hxx>
23 #include <tools/rc.hxx>
24 #include <tools/rcid.h>
25 #include <tools/resid.hxx>
26 #include <vcl/svapp.hxx>
27 #include <vcl/wrkwin.hxx>
29 #include <osl/mutex.hxx>
31 #ifndef DELETEZ
32 #define DELETEZ(pPtr) ( delete pPtr, pPtr = 0 )
33 #endif
35 #ifndef DELETEX
36 #ifdef DBG_UTIL
37 #define DELETEX(pPtr) ( delete pPtr, (void*&) pPtr = (void*) 0xFFFFFFFF )
38 #else
39 #define DELETEX(pPtr) delete pPtr
40 #endif
41 #endif
43 //------------------------------------------------------------------------
45 // Macro for the Call-Profiler under WinNT
46 // with S_CAP a measurement can be started, and stopped with E_CAP
47 #if defined( WNT ) && defined( PROFILE )
49 extern "C" {
50 void StartCAP();
51 void StopCAP();
52 void DumpCAP();
55 #define S_CAP() StartCAP();
56 #define E_CAP() StopCAP(); DumpCAP();
58 struct _Capper
60 _Capper() { S_CAP(); }
61 ~_Capper() { E_CAP(); }
64 #define CAP _Capper _aCap_
66 #else
68 #define S_CAP()
69 #define E_CAP()
70 #define CAP
72 #endif
74 #ifdef DBG_UTIL
75 #ifndef DBG
76 #define DBG(statement) statement
77 #endif
78 #define DBG_OUTF(x) DbgOutf x
79 #else
80 #ifndef DBG
81 #define DBG(statement)
82 #endif
83 #define DBG_OUTF(x)
84 #endif
86 //------------------------------------------------------------------------
88 #if defined(DBG_UTIL) && defined(WNT)
90 class SfxStack
92 static unsigned nLevel;
94 public:
95 SfxStack( const char *pName )
97 ++nLevel;
98 DbgOutf( "STACK: enter %3d %s", nLevel, pName );
100 ~SfxStack()
102 DbgOutf( "STACK: leave %3d", nLevel );
103 --nLevel;
107 #define SFX_STACK(s) SfxStack aSfxStack_( #s )
108 #else
109 #define SFX_STACK(s)
110 #endif
112 //------------------------------------------------------------------------
114 struct StringList_Impl : private Resource
117 ResId aResId;
119 StringList_Impl( const ResId& rErrIdP, sal_uInt16 nId)
120 : Resource( rErrIdP ),aResId(nId, *rErrIdP.GetResMgr()){}
121 ~StringList_Impl() { FreeResource(); }
123 String GetString(){ return aResId.toString(); }
124 operator sal_Bool(){return IsAvailableRes(aResId.SetRT(RSC_STRING));}
128 #endif // #ifndef _SFX_SFXTYPES_HXX
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */