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 INCLUDED_SFX2_FCONTNR_HXX
20 #define INCLUDED_SFX2_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>
33 #include <tools/ref.hxx>
35 #include <boost/utility.hpp>
37 namespace vcl
{ class Window
; }
39 class SfxObjectFactory
;
41 class SfxFilterContainer_Impl
;
45 class SfxRefItem
: public SfxPoolItem
47 tools::SvRef
<SvRefBase
> maRef
;
49 SfxRefItem( sal_uInt16 nWhichId
, const tools::SvRef
<SvRefBase
>& rValue
) : SfxPoolItem( nWhichId
)
51 virtual SfxPoolItem
* Clone( SfxItemPool
* = 0 ) const SAL_OVERRIDE
52 { return new SfxRefItem( *this ); }
53 virtual bool operator==( const SfxPoolItem
& rL
) const SAL_OVERRIDE
54 { return static_cast<const SfxRefItem
&>(rL
).maRef
== maRef
; }
55 const tools::SvRef
<SvRefBase
>& GetValue() const { return maRef
; }
60 ScopedVclPtr
<vcl::Window
> pWindow
;
62 SfxFrameWindow( vcl::Window
*pWin
)
66 virtual ~SfxFrameWindow() {}
67 vcl::Window
* GetWindow() const
69 void SetWindow( vcl::Window
*pWin
)
73 typedef sal_uIntPtr (*SfxDetectFilter
)( SfxMedium
& rMedium
, const SfxFilter
**, SfxFilterFlags nMust
, SfxFilterFlags nDont
);
75 class SFX2_DLLPUBLIC SfxFilterContainer
77 SfxFilterContainer_Impl
*pImpl
;
80 SfxFilterContainer( const OUString
& rName
);
81 ~SfxFilterContainer();
84 const OUString
GetName() const;
86 const SfxFilter
* GetAnyFilter( SfxFilterFlags nMust
= SfxFilterFlags::IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
87 const SfxFilter
* GetFilter4EA( const OUString
& rEA
, SfxFilterFlags nMust
= SfxFilterFlags::IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
88 const SfxFilter
* GetFilter4Extension( const OUString
& rExt
, SfxFilterFlags nMust
= SfxFilterFlags::IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
89 const SfxFilter
* GetFilter4FilterName( const OUString
& rName
, SfxFilterFlags nMust
= SfxFilterFlags::NONE
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
91 SAL_DLLPRIVATE
static void ReadFilters_Impl( bool bUpdate
=false );
92 SAL_DLLPRIVATE
static void ReadSingleFilter_Impl( const OUString
& rName
,
93 const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>& xTypeCFG
,
94 const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>& xFilterCFG
,
96 SAL_DLLPRIVATE
static const SfxFilter
* GetDefaultFilter_Impl( const OUString
& );
99 class SfxFilterMatcher_Impl
;
101 class SFX2_DLLPUBLIC SfxFilterMatcher
: private boost::noncopyable
103 friend class SfxFilterMatcherIter
;
104 SfxFilterMatcher_Impl
&m_rImpl
;
106 SfxFilterMatcher( const OUString
& rFact
);
110 SAL_DLLPRIVATE
static bool IsFilterInstalled_Impl( const SfxFilter
* pFilter
);
111 DECL_DLLPRIVATE_LINK_TYPED( MaybeFileHdl_Impl
, OUString
*, bool );
113 sal_uInt32
GuessFilterIgnoringContent( SfxMedium
& rMedium
, const SfxFilter
**, SfxFilterFlags nMust
= SfxFilterFlags::IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
114 sal_uInt32
GuessFilter( SfxMedium
& rMedium
, const SfxFilter
**, SfxFilterFlags nMust
= SfxFilterFlags::IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
115 sal_uInt32
GuessFilterControlDefaultUI( SfxMedium
& rMedium
, const SfxFilter
**, SfxFilterFlags nMust
= SfxFilterFlags::IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
, bool bDefUI
= true ) const;
116 sal_uInt32
DetectFilter( SfxMedium
& rMedium
, const SfxFilter
**, bool bPlugIn
, bool bAPI
= false ) const;
118 const SfxFilter
* GetFilter4Mime( const OUString
& rMime
, SfxFilterFlags nMust
= SfxFilterFlags::IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
119 const SfxFilter
* GetFilter4ClipBoardId( SotClipboardFormatId nId
, SfxFilterFlags nMust
= SfxFilterFlags::IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
120 const SfxFilter
* GetFilter4EA( const OUString
& rEA
, SfxFilterFlags nMust
= SfxFilterFlags::IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
121 const SfxFilter
* GetFilter4Extension( const OUString
& rExt
, SfxFilterFlags nMust
= SfxFilterFlags::IMPORT
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
122 const SfxFilter
* GetFilter4FilterName( const OUString
& rName
, SfxFilterFlags nMust
= SfxFilterFlags::NONE
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
123 const SfxFilter
* GetFilter4UIName( const OUString
& rName
, SfxFilterFlags nMust
= SfxFilterFlags::NONE
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
124 const SfxFilter
* GetFilterForProps( const com::sun::star::uno::Sequence
< ::com::sun::star::beans::NamedValue
>& aSeq
, SfxFilterFlags nMust
= SfxFilterFlags::NONE
, SfxFilterFlags nDont
= SFX_FILTER_NOTINSTALLED
) const;
125 const SfxFilter
* GetAnyFilter( SfxFilterFlags nMust
=SfxFilterFlags::NONE
, SfxFilterFlags nDont
=SFX_FILTER_NOTINSTALLED
) const;
128 class SfxFilterContainer_Impl
;
129 class SFX2_DLLPUBLIC SfxFilterMatcherIter
: private boost::noncopyable
132 SfxFilterFlags nOrMask
;
133 SfxFilterFlags nAndMask
;
135 const SfxFilterMatcher_Impl
&m_rMatch
;
137 SAL_DLLPRIVATE
const SfxFilter
* Find_Impl();
140 SfxFilterMatcherIter( const SfxFilterMatcher
& rMatcher
, SfxFilterFlags nMask
= SfxFilterFlags::NONE
, SfxFilterFlags nNotMask
= SFX_FILTER_NOTINSTALLED
);
141 const SfxFilter
* First();
142 const SfxFilter
* Next();
148 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */