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: filterflags.h,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 ************************************************************************/
31 #ifndef __FRAMEWORK_FILTERFLAGS_H_
32 #define __FRAMEWORK_FILTERFLAGS_H_
36 /*-************************************************************************************************************//**
37 @short These values describe our supported filter flags.
38 @attention Don't change flag values without reason - we must support old functionality and position
39 in flag combined values!
40 *//*-*************************************************************************************************************/
42 #define FILTERFLAGNAME_IMPORT DECLARE_ASCII("Import" ) // x
43 #define FILTERFLAGNAME_EXPORT DECLARE_ASCII("Export" ) // x
44 #define FILTERFLAGNAME_TEMPLATE DECLARE_ASCII("Template" ) // x
45 #define FILTERFLAGNAME_INTERNAL DECLARE_ASCII("Internal" ) // x
46 #define FILTERFLAGNAME_TEMPLATEPATH DECLARE_ASCII("TemplatePath" ) // x
47 #define FILTERFLAGNAME_OWN DECLARE_ASCII("Own" ) // x
48 #define FILTERFLAGNAME_ALIEN DECLARE_ASCII("Alien" ) // x
49 #define FILTERFLAGNAME_USESOPTIONS DECLARE_ASCII("UsesOptions" ) // x
50 #define FILTERFLAGNAME_DEFAULT DECLARE_ASCII("Default" ) // x
51 #define FILTERFLAGNAME_EXECUTABLE DECLARE_ASCII("Executable" ) // deprecated
52 #define FILTERFLAGNAME_SUPPORTSSELECTION DECLARE_ASCII("SupportsSelection") // x
53 #define FILTERFLAGNAME_MAPTOAPPPLUG DECLARE_ASCII("MapToAppPlug" ) // deprecated
54 #define FILTERFLAGNAME_NOTINFILEDIALOG DECLARE_ASCII("NotInFileDialog" ) // x
55 #define FILTERFLAGNAME_NOTINCHOOSER DECLARE_ASCII("NotInChooser" ) // x
56 #define FILTERFLAGNAME_ASYNCHRON DECLARE_ASCII("Asynchron" ) // x
57 #define FILTERFLAGNAME_CREATOR DECLARE_ASCII("Creator" ) // deprecated
58 #define FILTERFLAGNAME_READONLY DECLARE_ASCII("Readonly" ) // x
59 #define FILTERFLAGNAME_NOTINSTALLED DECLARE_ASCII("NotInstalled" ) // deprecated
60 #define FILTERFLAGNAME_CONSULTSERVICE DECLARE_ASCII("ConsultService" ) // deprecated
61 #define FILTERFLAGNAME_3RDPARTYFILTER DECLARE_ASCII("3rdPartyFilter" ) // x
62 #define FILTERFLAGNAME_PACKED DECLARE_ASCII("Packed" ) // x
63 #define FILTERFLAGNAME_SILENTEXPORT DECLARE_ASCII("SilentExport" ) // x
64 #define FILTERFLAGNAME_BROWSERPREFERED DECLARE_ASCII("BrowserPrefered" ) // deprecated
65 #define FILTERFLAGNAME_PREFERED DECLARE_ASCII("Prefered" ) // x
66 #define FILTERFLAGNAME_STARTPRESENTATION DECLARE_ASCII("StartPresentation") // x
68 #define FILTERFLAG_IMPORT 0x00000001L // 1
69 #define FILTERFLAG_EXPORT 0x00000002L // 2
70 #define FILTERFLAG_TEMPLATE 0x00000004L // 4
71 #define FILTERFLAG_INTERNAL 0x00000008L // 8
72 #define FILTERFLAG_TEMPLATEPATH 0x00000010L // 16
73 #define FILTERFLAG_OWN 0x00000020L // 32
74 #define FILTERFLAG_ALIEN 0x00000040L // 64
75 #define FILTERFLAG_USESOPTIONS 0x00000080L // 128
76 #define FILTERFLAG_DEFAULT 0x00000100L // 256
77 #define FILTERFLAG_EXECUTABLE 0x00000200L // 512
78 #define FILTERFLAG_SUPPORTSSELECTION 0x00000400L // 1024
79 #define FILTERFLAG_MAPTOAPPPLUG 0x00000800L // 2048
80 #define FILTERFLAG_NOTINFILEDIALOG 0x00001000L // 4096
81 #define FILTERFLAG_NOTINCHOOSER 0x00002000L // 8192
82 #define FILTERFLAG_ASYNCHRON 0x00004000L // 16384
83 #define FILTERFLAG_CREATOR 0x00008000L // 32768
84 #define FILTERFLAG_READONLY 0x00010000L // 65536
85 #define FILTERFLAG_NOTINSTALLED 0x00020000L // 131072
86 #define FILTERFLAG_CONSULTSERVICE 0x00040000L // 262144
87 #define FILTERFLAG_3RDPARTYFILTER 0x00080000L // 524288
88 #define FILTERFLAG_PACKED 0x00100000L // 1048576
89 #define FILTERFLAG_SILENTEXPORT 0x00200000L // 2097152
90 #define FILTERFLAG_BROWSERPREFERED 0x00400000L // 4194304
91 //FREE! ... 0x00800000L
92 #define FILTERFLAG_PREFERED 0x10000000L // 268435456
93 #define FILTERFLAG_STARTPRESENTATION 0x20000000L
99 //___________________________________________
101 /** @short checks if the given flag mask is set.
103 @param nFlags the flag field, which should be checked.
104 @param nMask this mask field is searched inside parameter nFlags.
106 @return TRUE if mask match to the given flag field.
108 static sal_Bool
isMaskSet( sal_Int32 nFlags
, sal_Int32 nMask
)
110 return((nFlags
& nMask
) == nMask
);
113 //___________________________________________
115 /** @short checks if the given flag field contains unknown flags.
117 @descr Of course it can work only, if not the whole range of an int32
120 @param nFlags the flag field, which should be checked.
122 @return TRUE if only well known flags are set.
124 static sal_Bool
isValid( sal_Int32 nFlags
)
126 sal_Int32 nCheck
= nFlags
;
127 nCheck
&= ~FILTERFLAG_IMPORT
;
128 nCheck
&= ~FILTERFLAG_EXPORT
;
129 nCheck
&= ~FILTERFLAG_TEMPLATE
;
130 nCheck
&= ~FILTERFLAG_INTERNAL
;
131 nCheck
&= ~FILTERFLAG_TEMPLATEPATH
;
132 nCheck
&= ~FILTERFLAG_OWN
;
133 nCheck
&= ~FILTERFLAG_ALIEN
;
134 nCheck
&= ~FILTERFLAG_USESOPTIONS
;
135 nCheck
&= ~FILTERFLAG_DEFAULT
;
136 nCheck
&= ~FILTERFLAG_EXECUTABLE
;
137 nCheck
&= ~FILTERFLAG_SUPPORTSSELECTION
;
138 nCheck
&= ~FILTERFLAG_MAPTOAPPPLUG
;
139 nCheck
&= ~FILTERFLAG_NOTINFILEDIALOG
;
140 nCheck
&= ~FILTERFLAG_NOTINCHOOSER
;
141 nCheck
&= ~FILTERFLAG_ASYNCHRON
;
142 nCheck
&= ~FILTERFLAG_CREATOR
;
143 nCheck
&= ~FILTERFLAG_READONLY
;
144 nCheck
&= ~FILTERFLAG_NOTINSTALLED
;
145 nCheck
&= ~FILTERFLAG_CONSULTSERVICE
;
146 nCheck
&= ~FILTERFLAG_3RDPARTYFILTER
;
147 nCheck
&= ~FILTERFLAG_PACKED
;
148 nCheck
&= ~FILTERFLAG_SILENTEXPORT
;
149 nCheck
&= ~FILTERFLAG_BROWSERPREFERED
;
150 nCheck
&= ~FILTERFLAG_PREFERED
;
151 nCheck
&= ~FILTERFLAG_STARTPRESENTATION
;
155 //___________________________________________
157 /** @short checks if the given flag field uses deprecated flag values.
159 @param nFlags the flag field, which should be checked.
161 @return TRUE if one deprecated flag item could be found.
163 static sal_Bool
useDeprecated( sal_Int32 nFlags
)
166 isMaskSet(nFlags
, FILTERFLAG_EXECUTABLE
) ||
167 isMaskSet(nFlags
, FILTERFLAG_MAPTOAPPPLUG
) ||
168 isMaskSet(nFlags
, FILTERFLAG_CREATOR
) ||
169 isMaskSet(nFlags
, FILTERFLAG_NOTINSTALLED
) ||
170 isMaskSet(nFlags
, FILTERFLAG_CONSULTSERVICE
) ||
171 isMaskSet(nFlags
, FILTERFLAG_BROWSERPREFERED
)
176 } // namespace framework
178 #endif // #ifndef __FRAMEWORK_FILTERFLAGS_H_