1*353d8f4dSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*353d8f4dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*353d8f4dSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*353d8f4dSAndrew Rist * distributed with this work for additional information 6*353d8f4dSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*353d8f4dSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*353d8f4dSAndrew Rist * "License"); you may not use this file except in compliance 9*353d8f4dSAndrew Rist * with the License. You may obtain a copy of the License at 10*353d8f4dSAndrew Rist * 11*353d8f4dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*353d8f4dSAndrew Rist * 13*353d8f4dSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*353d8f4dSAndrew Rist * software distributed under the License is distributed on an 15*353d8f4dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*353d8f4dSAndrew Rist * KIND, either express or implied. See the License for the 17*353d8f4dSAndrew Rist * specific language governing permissions and limitations 18*353d8f4dSAndrew Rist * under the License. 19*353d8f4dSAndrew Rist * 20*353d8f4dSAndrew Rist *************************************************************/ 21*353d8f4dSAndrew Rist 22*353d8f4dSAndrew Rist 23cdf0e10cSrcweir #ifndef _SFX_FCONTNR_HXX 24cdf0e10cSrcweir #define _SFX_FCONTNR_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include "sal/config.h" 27cdf0e10cSrcweir #include "sfx2/dllapi.h" 28cdf0e10cSrcweir #include "sal/types.h" 29cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx> 30cdf0e10cSrcweir #include <com/sun/star/beans/NamedValue.hpp> 31cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp> 32cdf0e10cSrcweir #include <svl/poolitem.hxx> 33cdf0e10cSrcweir #include <vcl/window.hxx> 34cdf0e10cSrcweir 35cdf0e10cSrcweir #include <sfx2/docfilt.hxx> 36cdf0e10cSrcweir #include <sfx2/sfxdefs.hxx> 37cdf0e10cSrcweir 38cdf0e10cSrcweir class Window; 39cdf0e10cSrcweir class SfxFilter; 40cdf0e10cSrcweir class SfxFilterArr_Impl; 41cdf0e10cSrcweir class SfxObjectFacArr_Impl; 42cdf0e10cSrcweir class SfxObjectFactory; 43cdf0e10cSrcweir class SfxMedium; 44cdf0e10cSrcweir class SfxFilterContainer_Impl; 45cdf0e10cSrcweir class SfxFrame; 46cdf0e10cSrcweir 47cdf0e10cSrcweir //#define SFX_FILTER_CONTAINER_FACTORY 1 48cdf0e10cSrcweir typedef sal_uInt16 SfxFilterContainerFlags; 49cdf0e10cSrcweir 50cdf0e10cSrcweir class SfxRefItem : public SfxPoolItem 51cdf0e10cSrcweir { 52cdf0e10cSrcweir SvRefBaseRef aRef; 53cdf0e10cSrcweir public: Clone(SfxItemPool * =0) const54cdf0e10cSrcweir virtual SfxPoolItem* Clone( SfxItemPool* = 0 ) const 55cdf0e10cSrcweir { return new SfxRefItem( *this ); } operator ==(const SfxPoolItem & rL) const56cdf0e10cSrcweir virtual int operator==( const SfxPoolItem& rL) const 57cdf0e10cSrcweir { return ((SfxRefItem&)rL).aRef == aRef; } SfxRefItem(sal_uInt16 nWhichId,const SvRefBaseRef & rValue)58cdf0e10cSrcweir SfxRefItem( sal_uInt16 nWhichId, const SvRefBaseRef& rValue ) : SfxPoolItem( nWhichId ) 59cdf0e10cSrcweir { aRef = rValue; } GetValue() const60cdf0e10cSrcweir const SvRefBaseRef& GetValue() const { return aRef; } 61cdf0e10cSrcweir 62cdf0e10cSrcweir }; 63cdf0e10cSrcweir 64cdf0e10cSrcweir class SfxFrameWindow 65cdf0e10cSrcweir { 66cdf0e10cSrcweir Window* pWindow; 67cdf0e10cSrcweir public: SfxFrameWindow(Window * pWin)68cdf0e10cSrcweir SfxFrameWindow( Window *pWin ) 69cdf0e10cSrcweir : pWindow( pWin ) 70cdf0e10cSrcweir {} 71cdf0e10cSrcweir ~SfxFrameWindow()72cdf0e10cSrcweir virtual ~SfxFrameWindow() 73cdf0e10cSrcweir { delete pWindow; } GetWindow() const74cdf0e10cSrcweir Window* GetWindow() const 75cdf0e10cSrcweir { return pWindow; } SetWindow(Window * pWin)76cdf0e10cSrcweir void SetWindow( Window *pWin ) 77cdf0e10cSrcweir { pWindow = pWin; } 78cdf0e10cSrcweir }; 79cdf0e10cSrcweir 80cdf0e10cSrcweir class SfxFrameWindowFactory 81cdf0e10cSrcweir { 82cdf0e10cSrcweir typedef SfxFrameWindow* (*FactoryFunc)( SfxFrame* pParent, const String& rName ); 83cdf0e10cSrcweir FactoryFunc pFunc; 84cdf0e10cSrcweir String aName; 85cdf0e10cSrcweir public: 86cdf0e10cSrcweir SfxFrameWindowFactory( FactoryFunc pFuncP, String aNameP ); GetURLWildCard()87cdf0e10cSrcweir String GetURLWildCard() { return aName; } GetFactory()88cdf0e10cSrcweir FactoryFunc GetFactory() { return pFunc; } 89cdf0e10cSrcweir }; 90cdf0e10cSrcweir 91cdf0e10cSrcweir typedef sal_uIntPtr (*SfxDetectFilter)( SfxMedium& rMedium, const SfxFilter **, SfxFilterFlags nMust, SfxFilterFlags nDont ); 92cdf0e10cSrcweir 93cdf0e10cSrcweir class SFX2_DLLPUBLIC SfxFilterContainer 94cdf0e10cSrcweir { 95cdf0e10cSrcweir SfxFilterContainer_Impl *pImpl; 96cdf0e10cSrcweir 97cdf0e10cSrcweir public: 98cdf0e10cSrcweir SfxFilterContainer( const String& rName ); 99cdf0e10cSrcweir ~SfxFilterContainer(); 100cdf0e10cSrcweir 101cdf0e10cSrcweir // SfxFilterContainerFlags GetFlags() const; 102cdf0e10cSrcweir // void SetFlags( SfxFilterContainerFlags eFlags ); 103cdf0e10cSrcweir 104cdf0e10cSrcweir const String GetName() const; 105cdf0e10cSrcweir 106cdf0e10cSrcweir const SfxFilter* GetAnyFilter( SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; 107cdf0e10cSrcweir const SfxFilter* GetFilter4Mime( const String& rMime, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; 108cdf0e10cSrcweir const SfxFilter* GetFilter4ClipBoardId( sal_uInt32 nId, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; 109cdf0e10cSrcweir const SfxFilter* GetFilter4EA( const String& rEA, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; 110cdf0e10cSrcweir const SfxFilter* GetFilter4Extension( const String& rExt, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; 111cdf0e10cSrcweir const SfxFilter* GetFilter4FilterName( const String& rName, SfxFilterFlags nMust = 0, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; 112cdf0e10cSrcweir const SfxFilter* GetFilter4UIName( const String& rName, SfxFilterFlags nMust = 0, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; 113cdf0e10cSrcweir 114cdf0e10cSrcweir //#if 0 // _SOLAR__PRIVATE 115cdf0e10cSrcweir SAL_DLLPRIVATE static void ReadFilters_Impl( sal_Bool bUpdate=sal_False ); 116cdf0e10cSrcweir SAL_DLLPRIVATE static void ReadSingleFilter_Impl( const ::rtl::OUString& rName, 117cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& xTypeCFG, 118cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& xFilterCFG, 119cdf0e10cSrcweir sal_Bool bUpdate ); 120cdf0e10cSrcweir SAL_DLLPRIVATE static const SfxFilter* GetDefaultFilter_Impl( const String& ); 121cdf0e10cSrcweir //#endif 122cdf0e10cSrcweir }; 123cdf0e10cSrcweir 124cdf0e10cSrcweir class SfxFilterMatcher_Impl; 125cdf0e10cSrcweir 126cdf0e10cSrcweir class SFX2_DLLPUBLIC SfxFilterMatcher 127cdf0e10cSrcweir { 128cdf0e10cSrcweir friend class SfxFilterMatcherIter; 129cdf0e10cSrcweir SfxFilterMatcher_Impl *pImpl; 130cdf0e10cSrcweir public: 131cdf0e10cSrcweir SfxFilterMatcher( const String& rFact ); 132cdf0e10cSrcweir SfxFilterMatcher(); 133cdf0e10cSrcweir ~SfxFilterMatcher(); 134cdf0e10cSrcweir 135cdf0e10cSrcweir //#if 0 // _SOLAR__PRIVATE 136cdf0e10cSrcweir SAL_DLLPRIVATE static sal_Bool IsFilterInstalled_Impl( const SfxFilter* pFilter ); 137cdf0e10cSrcweir DECL_DLLPRIVATE_STATIC_LINK( SfxFilterMatcher, MaybeFileHdl_Impl, String* ); 138cdf0e10cSrcweir //#endif 139cdf0e10cSrcweir 140cdf0e10cSrcweir sal_uInt32 GuessFilterIgnoringContent( SfxMedium& rMedium, const SfxFilter **, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; 141cdf0e10cSrcweir sal_uInt32 GuessFilter( SfxMedium& rMedium, const SfxFilter **, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; 142cdf0e10cSrcweir sal_uInt32 GuessFilterControlDefaultUI( SfxMedium& rMedium, const SfxFilter **, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED, sal_Bool bDefUI = sal_True ) const; 143cdf0e10cSrcweir sal_uInt32 DetectFilter( SfxMedium& rMedium, const SfxFilter **, sal_Bool bPlugIn, sal_Bool bAPI = sal_False ) const; 144cdf0e10cSrcweir 145cdf0e10cSrcweir const SfxFilter* GetFilter4Mime( const String& rMime, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED) const; 146cdf0e10cSrcweir const SfxFilter* GetFilter4ClipBoardId( sal_uInt32 nId, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; 147cdf0e10cSrcweir const SfxFilter* GetFilter4EA( const String& rEA, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; 148cdf0e10cSrcweir const SfxFilter* GetFilter4Extension( const String& rExt, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; 149cdf0e10cSrcweir const SfxFilter* GetFilter4FilterName( const String& rName, SfxFilterFlags nMust = 0, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; 150cdf0e10cSrcweir const SfxFilter* GetFilter4UIName( const String& rName, SfxFilterFlags nMust = 0, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; 151cdf0e10cSrcweir const SfxFilter* GetFilterForProps( const com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue >& aSeq, SfxFilterFlags nMust = 0, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; 152cdf0e10cSrcweir const SfxFilter* GetAnyFilter( SfxFilterFlags nMust=0, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED ) const; 153cdf0e10cSrcweir }; 154cdf0e10cSrcweir 155cdf0e10cSrcweir class SfxFilterContainer_Impl; 156cdf0e10cSrcweir class SFX2_DLLPUBLIC SfxFilterMatcherIter 157cdf0e10cSrcweir { 158cdf0e10cSrcweir SfxFilterFlags nOrMask; 159cdf0e10cSrcweir SfxFilterFlags nAndMask; 160cdf0e10cSrcweir sal_uInt16 nCurrent; 161cdf0e10cSrcweir const SfxFilterMatcher_Impl *pMatch; 162cdf0e10cSrcweir 163cdf0e10cSrcweir //#if 0 // _SOLAR__PRIVATE 164cdf0e10cSrcweir SAL_DLLPRIVATE const SfxFilter* Find_Impl(); 165cdf0e10cSrcweir //#endif 166cdf0e10cSrcweir 167cdf0e10cSrcweir public: 168cdf0e10cSrcweir SfxFilterMatcherIter( const SfxFilterMatcher* pMatchP, SfxFilterFlags nMask = 0, SfxFilterFlags nNotMask = SFX_FILTER_NOTINSTALLED ); 169cdf0e10cSrcweir const SfxFilter* First(); 170cdf0e10cSrcweir const SfxFilter* Next(); 171cdf0e10cSrcweir }; 172cdf0e10cSrcweir 173cdf0e10cSrcweir 174cdf0e10cSrcweir #endif 175