1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef _SFX_FCONTNR_HXX
20 #define _SFX_FCONTNR_HXX
22 #include "sal/config.h"
23 #include "sfx2/dllapi.h"
24 #include "sal/types.h"
25 #include <com/sun/star/uno/Sequence.hxx>
26 #include <com/sun/star/beans/NamedValue.hpp>
27 #include <com/sun/star/container/XNameAccess.hpp>
28 #include <svl/poolitem.hxx>
29 #include <vcl/window.hxx>
31 #include <sfx2/docfilt.hxx>
32 #include <sfx2/sfxdefs.hxx>
34 #include <tools/ref.hxx>
36 #include <boost/utility.hpp>
40 class SfxObjectFactory
;
42 class SfxFilterContainer_Impl
;
45 //#define SFX_FILTER_CONTAINER_FACTORY 1
46 typedef sal_uInt16 SfxFilterContainerFlags
;
48 class SfxRefItem
: public SfxPoolItem
52 virtual SfxPoolItem
* Clone( SfxItemPool
* = 0 ) const
53 { return new SfxRefItem( *this ); }
54 virtual int operator==( const SfxPoolItem
& rL
) const
55 { return ((SfxRefItem
&)rL
).aRef
== aRef
; }
56 SfxRefItem( sal_uInt16 nWhichId
, const SvRefBaseRef
& rValue
) : SfxPoolItem( nWhichId
)
58 const SvRefBaseRef
& GetValue() const { return aRef
; }
66 SfxFrameWindow( Window
*pWin
)
70 virtual ~SfxFrameWindow()
72 Window
* GetWindow() const
74 void SetWindow( Window
*pWin
)
78 typedef sal_uIntPtr (*SfxDetectFilter
)( SfxMedium
& rMedium
, const SfxFilter
**, SfxFilterFlags nMust
, SfxFilterFlags nDont
);
80 class SFX2_DLLPUBLIC SfxFilterContainer
82 SfxFilterContainer_Impl
*pImpl
;
85 SfxFilterContainer( const String
& rName
);
86 ~SfxFilterContainer();
89 const String
GetName() const;
91 const SfxFilter
* GetAnyFilter( SfxFilterFlags nMust
= SFX_FILTER_IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
92 const SfxFilter
* GetFilter4EA( const String
& rEA
, SfxFilterFlags nMust
= SFX_FILTER_IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
93 const SfxFilter
* GetFilter4Extension( const String
& rExt
, SfxFilterFlags nMust
= SFX_FILTER_IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
94 const SfxFilter
* GetFilter4FilterName( const String
& rName
, SfxFilterFlags nMust
= 0, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
96 SAL_DLLPRIVATE
static void ReadFilters_Impl( sal_Bool bUpdate
=sal_False
);
97 SAL_DLLPRIVATE
static void ReadSingleFilter_Impl( const OUString
& rName
,
98 const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>& xTypeCFG
,
99 const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>& xFilterCFG
,
101 SAL_DLLPRIVATE
static const SfxFilter
* GetDefaultFilter_Impl( const String
& );
104 class SfxFilterMatcher_Impl
;
106 class SFX2_DLLPUBLIC SfxFilterMatcher
: private boost::noncopyable
108 friend class SfxFilterMatcherIter
;
109 SfxFilterMatcher_Impl
&m_rImpl
;
111 SfxFilterMatcher( const OUString
& rFact
);
115 SAL_DLLPRIVATE
static sal_Bool
IsFilterInstalled_Impl( const SfxFilter
* pFilter
);
116 DECL_DLLPRIVATE_STATIC_LINK( SfxFilterMatcher
, MaybeFileHdl_Impl
, String
* );
118 sal_uInt32
GuessFilterIgnoringContent( SfxMedium
& rMedium
, const SfxFilter
**, SfxFilterFlags nMust
= SFX_FILTER_IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
119 sal_uInt32
GuessFilter( SfxMedium
& rMedium
, const SfxFilter
**, SfxFilterFlags nMust
= SFX_FILTER_IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
120 sal_uInt32
GuessFilterControlDefaultUI( SfxMedium
& rMedium
, const SfxFilter
**, SfxFilterFlags nMust
= SFX_FILTER_IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
, sal_Bool bDefUI
= sal_True
) const;
121 sal_uInt32
DetectFilter( SfxMedium
& rMedium
, const SfxFilter
**, sal_Bool bPlugIn
, sal_Bool bAPI
= sal_False
) const;
123 const SfxFilter
* GetFilter4Mime( const OUString
& rMime
, SfxFilterFlags nMust
= SFX_FILTER_IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
124 const SfxFilter
* GetFilter4ClipBoardId( sal_uInt32 nId
, SfxFilterFlags nMust
= SFX_FILTER_IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
125 const SfxFilter
* GetFilter4EA( const String
& rEA
, SfxFilterFlags nMust
= SFX_FILTER_IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
126 const SfxFilter
* GetFilter4Extension( const String
& rExt
, SfxFilterFlags nMust
= SFX_FILTER_IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
127 const SfxFilter
* GetFilter4FilterName( const String
& rName
, SfxFilterFlags nMust
= 0, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
128 const SfxFilter
* GetFilter4UIName( const String
& rName
, SfxFilterFlags nMust
= 0, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
129 const SfxFilter
* GetFilterForProps( const com::sun::star::uno::Sequence
< ::com::sun::star::beans::NamedValue
>& aSeq
, SfxFilterFlags nMust
= 0, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
130 const SfxFilter
* GetAnyFilter( SfxFilterFlags nMust
=0, SfxFilterFlags nDont
=SFX_FILTER_NOTINSTALLED
) const;
133 class SfxFilterContainer_Impl
;
134 class SFX2_DLLPUBLIC SfxFilterMatcherIter
: private boost::noncopyable
137 SfxFilterFlags nOrMask
;
138 SfxFilterFlags nAndMask
;
140 const SfxFilterMatcher_Impl
&m_rMatch
;
142 SAL_DLLPRIVATE
const SfxFilter
* Find_Impl();
145 SfxFilterMatcherIter( const SfxFilterMatcher
& rMatcher
, SfxFilterFlags nMask
= 0, SfxFilterFlags nNotMask
= SFX_FILTER_NOTINSTALLED
);
146 const SfxFilter
* First();
147 const SfxFilter
* Next();
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */