xref: /AOO41X/main/sfx2/source/dialog/filtergrouping.hxx (revision 353d8f4d17010cd2d0ea815067cad67e477f2bee)
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 
24 #ifndef SFX2_FILTERGROUPING_HXX
25 #define SFX2_FILTERGROUPING_HXX
26 
27 #include <com/sun/star/ui/dialogs/XFilterManager.hpp>
28 #include <com/sun/star/container/XEnumeration.hpp>
29 #include "filedlgimpl.hxx"
30 
31 class SfxFilterMatcherIter;
32 
33 //........................................................................
34 namespace sfx2
35 {
36 //........................................................................
37 
38     class TSortedFilterList
39     {
40         private:
41 
42             ::std::vector< ::rtl::OUString > m_lFilters;
43             sal_Int32 m_nIterator;
44 
45         public:
46 
47             TSortedFilterList(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration >& xFilterList);
48             const SfxFilter* First();
49             const SfxFilter* Next();
50 
51         private:
52             const SfxFilter* impl_getFilter(sal_Int32 nIndex);
53     };
54 
55     //--------------------------------------------------------------------
56     /** adds the given filters to the filter manager.
57         <p>To be used when saving generic files.</p>
58     */
59     void appendFiltersForSave(
60         TSortedFilterList& _rFilterMatcher,
61         const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilterManager >& _rFilterManager,
62         ::rtl::OUString& /* [out] */ _rFirstNonEmpty,
63         FileDialogHelper_Impl& _rFileDlgImpl,
64         const ::rtl::OUString& _rFactory
65     );
66 
67     void appendExportFilters(
68         TSortedFilterList& _rFilterMatcher,
69         const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilterManager >& _rFilterManager,
70         ::rtl::OUString& /* [out] */ _rFirstNonEmpty,
71         FileDialogHelper_Impl& _rFileDlgImpl
72         );
73 
74     //--------------------------------------------------------------------
75     /** adds the given filters to the filter manager.
76         <p>To be used when opening generic files.</p>
77     */
78     void appendFiltersForOpen(
79         TSortedFilterList& _rFilterMatcher,
80         const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilterManager >& _rFilterManager,
81         ::rtl::OUString& /* [out] */ _rFirstNonEmpty,
82         FileDialogHelper_Impl& _rFileDlgImpl
83     );
84 
85     //--------------------------------------------------------------------
86     /** adds the given extension to the display text.
87         <p>To be used when opening or save generic files.</p>
88     */
89     ::rtl::OUString addExtension(
90         const ::rtl::OUString& _rDisplayText,
91         const ::rtl::OUString& _rExtension,
92         sal_Bool _bForOpen,
93         FileDialogHelper_Impl& _rFileDlgImpl
94     );
95 
96 //........................................................................
97 }   // namespace sfx2
98 //........................................................................
99 
100 #endif // SFX2_FILTERGROUPING_HXX
101 
102 
103