xref: /trunk/main/sfx2/inc/sfx2/fcontnr.hxx (revision 353d8f4d)
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 #ifndef _SFX_FCONTNR_HXX
24 #define _SFX_FCONTNR_HXX
25 
26 #include "sal/config.h"
27 #include "sfx2/dllapi.h"
28 #include "sal/types.h"
29 #include <com/sun/star/uno/Sequence.hxx>
30 #include <com/sun/star/beans/NamedValue.hpp>
31 #include <com/sun/star/container/XNameAccess.hpp>
32 #include <svl/poolitem.hxx>
33 #include <vcl/window.hxx>
34 
35 #include <sfx2/docfilt.hxx>
36 #include <sfx2/sfxdefs.hxx>
37 
38 class Window;
39 class SfxFilter;
40 class SfxFilterArr_Impl;
41 class SfxObjectFacArr_Impl;
42 class SfxObjectFactory;
43 class SfxMedium;
44 class SfxFilterContainer_Impl;
45 class SfxFrame;
46 
47 //#define SFX_FILTER_CONTAINER_FACTORY 1
48 typedef sal_uInt16 SfxFilterContainerFlags;
49 
50 class SfxRefItem : public SfxPoolItem
51 {
52 	SvRefBaseRef aRef;
53 public:
Clone(SfxItemPool * =0) const54 	virtual SfxPoolItem*	 Clone( SfxItemPool* = 0 ) const
55 	{ 	return new SfxRefItem( *this ); }
operator ==(const SfxPoolItem & rL) const56 	virtual int 			 operator==( const SfxPoolItem& rL) const
57 	{   return ((SfxRefItem&)rL).aRef == aRef; }
SfxRefItem(sal_uInt16 nWhichId,const SvRefBaseRef & rValue)58 	SfxRefItem( sal_uInt16 nWhichId, const SvRefBaseRef& rValue ) : SfxPoolItem( nWhichId )
59 	{   aRef = rValue; }
GetValue() const60 	const SvRefBaseRef&      GetValue() const { return aRef; }
61 
62 };
63 
64 class SfxFrameWindow
65 {
66 	Window*		pWindow;
67 public:
SfxFrameWindow(Window * pWin)68 				SfxFrameWindow( Window *pWin )
69 				 : pWindow( pWin )
70 				{}
71 
~SfxFrameWindow()72 	virtual		~SfxFrameWindow()
73 				{ delete pWindow; }
GetWindow() const74 	Window*		GetWindow() const
75 				{ return pWindow; }
SetWindow(Window * pWin)76 	void		SetWindow( Window *pWin )
77 				{ pWindow = pWin; }
78 };
79 
80 class SfxFrameWindowFactory
81 {
82 	typedef SfxFrameWindow* (*FactoryFunc)( SfxFrame* pParent, const String& rName );
83 	FactoryFunc pFunc;
84 	String aName;
85 public:
86 	SfxFrameWindowFactory( FactoryFunc pFuncP, String aNameP );
GetURLWildCard()87 	String GetURLWildCard() { return aName; }
GetFactory()88 	FactoryFunc GetFactory() { return pFunc; }
89 };
90 
91 typedef sal_uIntPtr (*SfxDetectFilter)( SfxMedium& rMedium, const SfxFilter **, SfxFilterFlags nMust, SfxFilterFlags nDont );
92 
93 class SFX2_DLLPUBLIC SfxFilterContainer
94 {
95 	SfxFilterContainer_Impl *pImpl;
96 
97 public:
98 						SfxFilterContainer( const String& rName );
99 						~SfxFilterContainer();
100 
101 //						SfxFilterContainerFlags GetFlags() const;
102 //	void 				SetFlags( SfxFilterContainerFlags eFlags );
103 
104 	const String   		GetName() const;
105 
106     const SfxFilter* 	GetAnyFilter( SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
107 	const SfxFilter* 	GetFilter4Mime( const String& rMime, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
108 	const SfxFilter* 	GetFilter4ClipBoardId( sal_uInt32 nId, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
109 	const SfxFilter* 	GetFilter4EA( const String& rEA, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
110 	const SfxFilter* 	GetFilter4Extension( const String& rExt, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
111 	const SfxFilter* 	GetFilter4FilterName( const String& rName, SfxFilterFlags nMust = 0, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
112 	const SfxFilter* 	GetFilter4UIName( const String& rName, SfxFilterFlags nMust = 0, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
113 
114 //#if 0 // _SOLAR__PRIVATE
115 	SAL_DLLPRIVATE static void ReadFilters_Impl( sal_Bool bUpdate=sal_False );
116 	SAL_DLLPRIVATE static void ReadSingleFilter_Impl( const ::rtl::OUString& rName,
117     						const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& xTypeCFG,
118 							const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& xFilterCFG,
119 							sal_Bool bUpdate );
120 	SAL_DLLPRIVATE static const SfxFilter* GetDefaultFilter_Impl( const String& );
121 //#endif
122 };
123 
124 class SfxFilterMatcher_Impl;
125 
126 class SFX2_DLLPUBLIC SfxFilterMatcher
127 {
128 	friend class SfxFilterMatcherIter;
129 	SfxFilterMatcher_Impl *pImpl;
130 public:
131 						SfxFilterMatcher( const String& rFact );
132 						SfxFilterMatcher();
133 						~SfxFilterMatcher();
134 
135 //#if 0 // _SOLAR__PRIVATE
136 	SAL_DLLPRIVATE static sal_Bool IsFilterInstalled_Impl( const SfxFilter* pFilter );
137 	DECL_DLLPRIVATE_STATIC_LINK( SfxFilterMatcher, MaybeFileHdl_Impl, String* );
138 //#endif
139 
140 	sal_uInt32               GuessFilterIgnoringContent( SfxMedium& rMedium, const SfxFilter **, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
141 	sal_uInt32               GuessFilter( SfxMedium& rMedium, const SfxFilter **, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
142 	sal_uInt32               GuessFilterControlDefaultUI( SfxMedium& rMedium, const SfxFilter **, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED, sal_Bool bDefUI = sal_True ) const;
143 	sal_uInt32               DetectFilter( SfxMedium& rMedium, const SfxFilter **, sal_Bool bPlugIn, sal_Bool bAPI = sal_False ) const;
144 
145 	const SfxFilter*	GetFilter4Mime( const String& rMime, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED) const;
146 	const SfxFilter*    GetFilter4ClipBoardId( sal_uInt32 nId, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
147 	const SfxFilter*    GetFilter4EA( const String& rEA, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
148 	const SfxFilter*    GetFilter4Extension( const String& rExt, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
149 	const SfxFilter*    GetFilter4FilterName( const String& rName, SfxFilterFlags nMust = 0, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
150 	const SfxFilter*    GetFilter4UIName( const String& rName, SfxFilterFlags nMust = 0, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
151 	const SfxFilter* 	GetFilterForProps( const com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue >& aSeq, SfxFilterFlags nMust = 0, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
152     const SfxFilter* 	GetAnyFilter( SfxFilterFlags nMust=0, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED ) const;
153 };
154 
155 class SfxFilterContainer_Impl;
156 class SFX2_DLLPUBLIC SfxFilterMatcherIter
157 {
158 	SfxFilterFlags nOrMask;
159 	SfxFilterFlags nAndMask;
160 	sal_uInt16 nCurrent;
161 	const SfxFilterMatcher_Impl *pMatch;
162 
163 //#if 0 // _SOLAR__PRIVATE
164 	SAL_DLLPRIVATE const SfxFilter* Find_Impl();
165 //#endif
166 
167 public:
168 	SfxFilterMatcherIter( const SfxFilterMatcher* pMatchP, SfxFilterFlags nMask = 0, SfxFilterFlags nNotMask = SFX_FILTER_NOTINSTALLED );
169 	const SfxFilter* First();
170 	const SfxFilter* Next();
171 };
172 
173 
174 #endif
175