1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: sfxtypes.hxx,v $
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 ************************************************************************/
30 #ifndef _SFX_SFXTYPES_HXX
31 #define _SFX_SFXTYPES_HXX
33 #include <tools/debug.hxx>
34 #ifndef _RC_HXX //autogen
35 #include <tools/rc.hxx>
37 #ifndef _RCID_H //autogen
38 #include <tools/rcid.h>
40 #ifndef _RESID_HXX //autogen
41 #include <tools/resid.hxx>
43 #include <tools/link.hxx>
44 #ifndef _APP_HXX //autogen
45 #include <vcl/svapp.hxx>
47 #include <vcl/wrkwin.hxx>
49 #ifndef _VOS_MUTEX_HXX //autogen
50 #include <vos/mutex.hxx>
54 #define DELETEZ(pPtr) ( delete pPtr, pPtr = 0 )
59 #define DELETEX(pPtr) ( delete pPtr, (void*&) pPtr = (void*) 0xFFFFFFFF )
61 #define DELETEX(pPtr) delete pPtr
68 #if !defined(_SFX_APPCTOR_CXX) && defined(WNT)
70 #error _DLL_ mal wieder nicht defined => GetpApp() == 0
74 //------------------------------------------------------------------------
76 // Macro fuer den Call-Profiler unter WinNT
77 // mit S_CAP kann eine Messung gestarted, mit E_CAP wieder gestoppt werden
78 #if defined( WNT ) && defined( PROFILE )
86 #define S_CAP() StartCAP();
87 #define E_CAP() StopCAP(); DumpCAP();
91 _Capper() { S_CAP(); }
92 ~_Capper() { E_CAP(); }
95 #define CAP _Capper _aCap_
107 #define DBG(statement) statement
109 #define DBG_OUTF(x) DbgOutf x
112 #define DBG(statement)
117 #define TRIM(s) s.EraseLeadingChars().EraseTrailingChars()
119 //------------------------------------------------------------------------
121 String
SfxShellIdent_Impl( const SfxShell
*pSh
);
123 //------------------------------------------------------------------------
125 #if defined(DBG_UTIL) && ( defined(WNT) || defined(OS2) )
129 static unsigned nLevel
;
132 SfxStack( const char *pName
)
135 DbgOutf( "STACK: enter %3d %s", nLevel
, pName
);
139 DbgOutf( "STACK: leave %3d", nLevel
);
144 #define SFX_STACK(s) SfxStack aSfxStack_( #s )
149 //------------------------------------------------------------------------
151 String
SearchAndReplace( const String
&rSource
,
152 const String
&rToReplace
,
153 const String
&rReplacement
);
155 #define SFX_PASSWORD_CODE "_:;*\x9A?()/&[&"
156 String
SfxStringEncode( const String
&rSource
,
157 const char *pKey
= SFX_PASSWORD_CODE
);
158 String
SfxStringDecode( const String
&rSource
,
159 const char *pKey
= SFX_PASSWORD_CODE
);
162 struct StringList_Impl
: private Resource
167 StringList_Impl( const ResId
& rErrIdP
, USHORT nId
)
168 : Resource( rErrIdP
),aResId(nId
, *rErrIdP
.GetResMgr()){}
169 ~StringList_Impl() { FreeResource(); }
171 String
GetString(){ return String( aResId
); }
172 operator BOOL(){return IsAvailableRes(aResId
.SetRT(RSC_STRING
));}
176 #define SFX_DEL_PTRARR(pArr) \
178 for ( USHORT n = (pArr)->Count(); n--; ) \
179 delete (pArr)->GetObject(n); \
183 class SfxBoolResetter
189 SfxBoolResetter( BOOL
&rVar
)
198 #define GPF() *(int*)0 = 0
200 #endif // #ifndef _SFX_SFXTYPES_HXX