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: fcontnr.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_FCONTNR_HXX
31 #define _SFX_FCONTNR_HXX
33 #ifndef _SFXPOOLITEM_HXX //autogen
34 #include <bf_svtools/poolitem.hxx>
36 #ifndef _WINDOW_HXX //autogen
37 #include <vcl/window.hxx>
40 #include <bf_sfx2/docfilt.hxx>
41 #include <bf_sfx2/sfxdefs.hxx>
46 class SfxFilterArr_Impl
;
47 class SfxObjectFacArr_Impl
;
48 class SfxObjectFactory
;
50 class SfxFilterContainer_Impl
;
53 #define SFX_FCONTNR_REDIRECTS "Redirects"
54 #define SFX_FCONTNR_EXTAPP "External"
56 #define SFX_FILTER_DOWNLOAD "StarDownload (*.dnl)"
58 #define SFX_FILTER_CONTAINER_FACTORY 1
59 typedef USHORT SfxFilterContainerFlags
;
61 class SfxRefItem
: public SfxPoolItem
65 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const
66 { (void)pPool
; return new SfxRefItem( *this ); }
67 virtual int operator==( const SfxPoolItem
& rL
) const
68 { return ((SfxRefItem
&)rL
).aRef
== aRef
; }
69 SfxRefItem( USHORT nWhich
, const SvRefBaseRef
& rValue
) : SfxPoolItem( nWhich
)
71 const SvRefBaseRef
& GetValue() const { return aRef
; }
79 SfxFrameWindow( Window
*pWin
)
83 virtual ~SfxFrameWindow()
85 Window
* GetWindow() const
87 void SetWindow( Window
*pWin
)
91 class SfxFrameWindowFactory
93 typedef SfxFrameWindow
* (*FactoryFunc
)( SfxFrame
* pParent
, const String
& rName
);
97 SfxFrameWindowFactory( FactoryFunc pFuncP
, String aNameP
);
98 String
GetURLWildCard() { return aName
; }
99 FactoryFunc
GetFactory() { return pFunc
; }
102 typedef ULONG (*SfxDetectFilter
)(
103 SfxMedium
& rMedium
, const SfxFilter
**, SfxFilterFlags nMust
, SfxFilterFlags nDont
);
105 class SfxFilterContainer
108 SfxFilterContainer_Impl
*pImpl
;
111 DECL_STATIC_LINK( SfxFilterContainer
, LoadHdl_Impl
, void* );
113 void ForceFilterLoad_Impl() const;
114 void RealLoad_Impl();
118 SfxFilterContainer( const String
& rName
);
119 virtual ~SfxFilterContainer();
121 SfxFilterContainerFlags
GetFlags() const;
122 void SetFlags( SfxFilterContainerFlags eFlags
);
124 virtual const SfxFilter
* GetFilter4Mime(
125 const String
& rMime
, SfxFilterFlags nMust
= SFX_FILTER_IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
126 virtual const SfxFilter
* GetFilter4ClipBoardId(
127 ULONG nId
, SfxFilterFlags nMust
= SFX_FILTER_IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
128 virtual const SfxFilter
* GetFilter4EA(
129 const String
& rEA
, SfxFilterFlags nMust
= SFX_FILTER_IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
130 virtual const SfxFilter
* GetFilter4Extension(
131 const String
& rExt
, SfxFilterFlags nMust
= SFX_FILTER_IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
132 virtual const SfxFilter
* GetFilter4FilterName(
133 const String
& rName
, SfxFilterFlags nMust
= 0, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
134 SfxFilter
* GetFilter4FilterName(
135 const String
& rName
, SfxFilterFlags nMust
= 0, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
)
137 return (SfxFilter
*)(const SfxFilter
*)
138 ((const SfxFilterContainer
* const)this)->GetFilter4FilterName(
139 rName
, nMust
, nDont
);
141 const SfxFilter
* GetFilter4Protocol(
142 const String
& rURL
, SfxFilterFlags nMust
= 0, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
143 virtual ULONG
GetFilter4Content(
144 SfxMedium
& rMedium
, const SfxFilter
**, SfxFilterFlags nMust
= SFX_FILTER_IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const ;
145 virtual const SfxFilter
* GetFilter4Protocol(
146 SfxMedium
& rMed
, SfxFilterFlags nMust
= 0, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
147 virtual const SfxFilter
* GetFilter(
148 const String
& rName
, SfxFilterFlags nMust
= 0, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
150 virtual USHORT
GetFilterCount() const;
151 virtual const SfxFilter
* GetFilter( USHORT
) const;
152 virtual ULONG
Execute( SfxMedium
& rMedium
, SfxFrame
*& rpFrame
) const ;
155 const String
GetName() const;
157 void AddFilter( SfxFilter
* pFilter
, USHORT nPos
);
159 const String
& rGroup
, BOOL bInstallIni
= TRUE
, SfxFilterFlags nAddMask
= 0, SfxFilterFlags nDelMask
= 0);
160 /*AS static String ConvertToOldFilterName( const String& rNew );
161 static String ConvertToNewFilterName( const String& rNew ); */
162 void ReadExternalFilters( const String
& rDocServiceName
);
168 enum SfxExecutableFilterType_Impl
170 SFX_EXE_FILTER_BOOKMARK
,
171 SFX_EXE_FILTER_OS2BOOKMARK
,
172 SFX_EXE_FILTER_MAILTO
,
173 SFX_EXE_FILTER_MACRO
,
175 SFX_EXE_FILTER_JAVASCRIPT
,
176 SFX_EXE_FILTER_FACTORY
,
177 SFX_EXE_FILTER_EXPLORER
,
178 SFX_EXE_FILTER_BUGID
,
180 SFX_EXE_FILTER_BUGDOC
,
181 SFX_EXE_FILTER_CHOOSER
,
182 SFX_EXE_FILTER_DOWNLOAD
,
183 SFX_EXE_FILTER_SUBSCRIBENEWAGENT
,
184 SFX_EXE_FILTER_HELPID
,
185 SFX_EXE_FILTER_EXECUTE
,
186 SFX_EXE_FILTER_CDFCHANNEL
,
187 SFX_EXE_FILTER_COMPONENT
,
188 SFX_EXE_FILTER_CHAOSCHANNEL
,
190 SFX_EXE_FILTER_COMMAND
,
191 SFX_EXE_FILTER_HELPENTRY
,
192 SFX_EXE_FILTER_SOUND
,
193 SFX_EXE_FILTER_EXTERNBROWSER
198 class SfxExecutableFilterTypes_Impl
;
199 class SfxExecutableFilterContainer
: public SfxFilterContainer
201 SfxExecutableFilterTypes_Impl
* pTypes
;
205 ULONG
Download_Impl( SfxMedium
& rMedium
) const;
206 ULONG
Choose_Impl( SfxMedium
& rMedium
) const;
207 ULONG
Unzip_Impl( SfxMedium
& rMedium
) const;
208 String
GetBugdocName_Impl( const String
& rName
) const;
209 void AddExeFilter( SfxFilter
* pFilter
, SfxExecutableFilterType_Impl eType
, const String
& rPattern
);
213 SfxExecutableFilterContainer();
214 ~SfxExecutableFilterContainer();
216 virtual const SfxFilter
* GetFilter4Protocol( SfxMedium
& rMed
, SfxFilterFlags nMust
= 0, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
217 virtual ULONG
Execute( SfxMedium
& rMedium
, SfxFrame
*& ) const ;
219 static const SfxFilter
* CheckForFolder( SfxMedium
& rMed
, SfxFilterFlags nMust
= 0, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
);
220 static const SfxFilter
* GetComponentFilter();
221 static const SfxFilter
* GetExplorerFilter();
224 class SfxExternalAppFilterContainer
: public SfxFilterContainer
227 SfxExternalAppFilterContainer();
228 virtual ULONG
Execute( SfxMedium
& rMedium
, SfxFrame
*& ) const;
229 virtual const SfxFilter
* GetFilter4FilterName(
230 const String
& rName
, SfxFilterFlags nMust
= 0, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
231 virtual USHORT
GetFilterCount() const;
232 virtual const SfxFilter
* GetFilter4Protocol(
233 SfxMedium
& rName
, SfxFilterFlags nMust
= 0, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
236 class SfxPluginFilterContainer
: public SfxFilterContainer
239 DECL_LINK( LoadHdl_Impl
, void* );
241 SfxPluginFilterContainer();
242 virtual ULONG
Execute( SfxMedium
& rMedium
, SfxFrame
*& ) const;
243 virtual USHORT
GetFilterCount() const;
244 virtual const SfxFilter
* GetFilter4Protocol( SfxMedium
& rMed
, SfxFilterFlags nMust
= 0, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
247 class SfxFactoryFilterContainer
: public SfxFilterContainer
250 const SfxObjectFactory
& rFact
;
251 SfxDetectFilter pFunc
;
255 SfxFactoryFilterContainer(
256 const String
& rName
, const SfxObjectFactory
& rFactP
);
257 void SetDetectFilter( SfxDetectFilter pFuncP
) { pFunc
= pFuncP
; }
258 virtual ULONG
GetFilter4Content(
259 SfxMedium
& rMedium
, const SfxFilter
**,
260 SfxFilterFlags nMust
= SFX_FILTER_IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const ;
261 const SfxObjectFactory
& GetFactory() const { return rFact
; }
264 class SfxFilterMatcher_Impl
;
266 class SfxFilterMatcher
268 SfxFilterMatcher_Impl
*pImpl
;
270 SfxFilterMatcher( SfxFilterContainer
* pCont
);
271 SfxFilterMatcher(BOOL bDeleteContainers
);
274 SfxFilterContainer
* GetContainer( const String
& rName
) const;
275 void AddContainer( SfxFilterContainer
* );
276 ULONG
GuessFilterIgnoringContent(
277 SfxMedium
& rMedium
, const SfxFilter
**,
278 SfxFilterFlags nMust
= SFX_FILTER_IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
280 SfxMedium
& rMedium
, const SfxFilter
**,
281 SfxFilterFlags nMust
= SFX_FILTER_IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
282 const SfxFilter
* GetFilter4ClipBoardId(
283 ULONG nId
, SfxFilterFlags nMust
= SFX_FILTER_IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
284 const SfxFilter
* GetFilter4Extension(
285 const String
& rExt
, SfxFilterFlags nMust
= SFX_FILTER_IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
287 /*STRIP003*/ ULONG
GetFilter4Content(
288 /*STRIP003*/ SfxMedium
& rMedium
, const SfxFilter
**, SfxFilterFlags nMust
= SFX_FILTER_IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
, BOOL bOnlyGoodOnes
=FALSE
) const ;
289 const SfxFilter
* GetFilter4Protocol(
290 SfxMedium
& rMed
, SfxFilterFlags nMust
= SFX_FILTER_IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
291 const SfxFilter
* GetFilter4FilterName(
292 const String
& rName
, SfxFilterFlags nMust
= 0, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
295 const SfxFilter
* ResolveRedirection( const SfxFilter
*, SfxMedium
& rMedium
) const;
296 const SfxFilter
* ResolveRedirection( const SfxFilter
*, const String
& rURLPath
) const;
297 const SfxFilter
* ResolveAppPlug( const SfxFilter
* ) const;
300 friend class SfxFilterMatcherIter
;
301 DECL_STATIC_LINK( SfxFilterMatcher
, MaybeFileHdl_Impl
, String
* );
304 class SfxFilterMatcherIter
306 SfxFilterFlags nOrMask
;
307 SfxFilterFlags nAndMask
;
311 SfxFilterContainer
* pCont
;
312 const SfxFilterMatcher_Impl
*pMatch
;
315 }//end of namespace binfilter