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_FPICKER_SOURCE_OFFICE_IODLGIMP_HXX
20 #define INCLUDED_FPICKER_SOURCE_OFFICE_IODLGIMP_HXX
22 #include "PlacesListBox.hxx"
24 #include <vcl/idle.hxx>
33 #define FILEDIALOG_DEF_EXTSEP ';'
34 #define FILEDIALOG_DEF_WILDCARD '*'
37 // SvtFileDialogFilter_Impl
42 Instances of this class represent a filter.
45 class SvtFileDialogFilter_Impl
48 OUString m_aName
; // name of the entry
49 OUString m_aType
; // filter wildcard - if empty, the entry marks a group
52 SvtFileDialogFilter_Impl( const OUString
& rName
, const OUString
& rType
);
53 ~SvtFileDialogFilter_Impl();
55 const OUString
& GetName() const { return m_aName
; }
56 const OUString
& GetType() const { return m_aType
; }
57 OUString
GetExtension() const { return m_aType
.getLength() > 2 ? m_aType
.copy( 2 ) : OUString(); }
59 bool isGroupSeparator() const { return m_aType
.isEmpty(); }
62 typedef std::deque
<std::unique_ptr
<SvtFileDialogFilter_Impl
>> SvtFileDialogFilterList_Impl
;
66 FILEDLG_MODE_OPEN
= 0,
72 FILEDLG_TYPE_FILEDLG
= 0,
76 class SvtUpButton_Impl
79 std::unique_ptr
<weld::Toolbar
> m_xToolbar
;
80 std::unique_ptr
<weld::Menu
> m_xMenu
;
81 SvtFileDialog
* m_pDlg
;
83 std::vector
<OUString
> aURLs
;
86 SvtUpButton_Impl(std::unique_ptr
<weld::Toolbar
> xToolbar
,
87 std::unique_ptr
<weld::Menu
> xMenu
,
90 void set_help_id(const OString
& rHelpId
) { m_xToolbar
->set_help_id(rHelpId
); }
91 void show() { m_xToolbar
->show(); }
95 weld::Widget
* getWidget() { return m_xToolbar
.get(); }
99 DECL_LINK(SelectHdl
, const OString
&, void);
100 DECL_LINK(ClickHdl
, const OString
&, void);
104 class SvtExpFileDlg_Impl
107 const SvtFileDialogFilter_Impl
* m_pCurFilter
;
108 OUString m_sCurrentFilterDisplayName
; // may differ from m_pCurFilter->GetName in case it is a cached entry
110 css::uno::Sequence
< OUString
> m_aBlackList
;
113 SvtFileDialogFilterList_Impl m_aFilter
;
114 std::unique_ptr
<SvtFileDialogFilter_Impl
> m_xUserFilter
;
116 std::unique_ptr
<weld::Label
> m_xFtFileName
;
117 std::unique_ptr
<URLBox
> m_xEdFileName
;
119 std::unique_ptr
<weld::Label
> m_xFtFileVersion
;
120 std::unique_ptr
<weld::ComboBox
> m_xLbFileVersion
;
122 std::unique_ptr
<weld::Label
> m_xFtTemplates
;
123 std::unique_ptr
<weld::ComboBox
> m_xLbTemplates
;
125 std::unique_ptr
<weld::Label
> m_xFtImageTemplates
;
126 std::unique_ptr
<weld::ComboBox
> m_xLbImageTemplates
;
128 std::unique_ptr
<weld::Label
> m_xFtImageAnchor
;
129 std::unique_ptr
<weld::ComboBox
> m_xLbImageAnchor
;
131 std::unique_ptr
<weld::Label
> m_xFtFileType
;
132 std::unique_ptr
<weld::ComboBox
> m_xLbFilter
;
133 std::unique_ptr
<weld::Button
> m_xBtnFileOpen
;
134 std::unique_ptr
<weld::Button
> m_xBtnCancel
;
135 std::unique_ptr
<weld::Button
> m_xBtnHelp
;
136 std::unique_ptr
<SvtUpButton_Impl
> m_xBtnUp
;
137 std::unique_ptr
<weld::Button
> m_xBtnNewFolder
;
138 std::unique_ptr
<weld::CheckButton
> m_xCbPassword
;
139 std::unique_ptr
<weld::CheckButton
> m_xCbGPGEncrypt
;
140 std::unique_ptr
<URLBox
> m_xEdCurrentPath
;
141 std::unique_ptr
<weld::CheckButton
> m_xCbAutoExtension
;
142 std::unique_ptr
<weld::CheckButton
> m_xCbOptions
;
144 std::unique_ptr
<PlacesListBox
> m_xPlaces
;
145 std::unique_ptr
<weld::Button
> m_xBtnConnectToServer
;
147 SvtFileDlgMode m_eMode
;
148 SvtFileDlgType m_eDlgType
;
149 PickerFlags m_nStyle
;
153 // delay filter when traveling the filterbox
156 // shows OpenHdl_Imp() if the open was triggered by a double click
158 bool m_bNeedDelayedFilterExecute
;
161 bool m_bMultiSelection
;
166 explicit SvtExpFileDlg_Impl();
167 ~SvtExpFileDlg_Impl();
169 void SetBlackList( const css::uno::Sequence
< OUString
>& rBlackList
) { m_aBlackList
= rBlackList
; }
170 const css::uno::Sequence
< OUString
>& GetBlackList() const { return m_aBlackList
; }
171 void SetStandardDir( const OUString
& rDir
);
172 const OUString
& GetStandardDir() const { return m_aStdDir
; }
174 // access to the filter listbox only as weld::Widget* - we want to maintain the entries/userdata ourself
175 weld::Widget
* GetFilterListControl() { return m_xLbFilter
.get(); }
176 const weld::Widget
* GetFilterListControl() const { return m_xLbFilter
.get(); }
177 void SetFilterListSelectHdl(const Link
<weld::ComboBox
&, void>& rHandler
)
179 m_xLbFilter
->connect_changed(rHandler
);
182 // inits the listbox for the filters from the filter list (_pFilter)
183 void InitFilterList( );
184 bool HasFilterListEntry( const OUString
& rFilterName
)
186 return m_xLbFilter
->find_text(rFilterName
) != -1;
189 void SelectFilterListEntry( const OUString
& rFilterName
)
191 m_xLbFilter
->set_active_text(rFilterName
);
194 void InsertFilterListEntry( const SvtFileDialogFilter_Impl
* _pFilterDesc
);
195 // _pFilterDesc must already have been added to _pFilter
196 SvtFileDialogFilter_Impl
* GetSelectedFilterEntry( OUString
& rDisplayName
) const
198 rDisplayName
= m_xLbFilter
->get_active_text();
199 return reinterpret_cast<SvtFileDialogFilter_Impl
*>(m_xLbFilter
->get_active_id().toInt64());
202 // access to the current filter via methods only - need to care for consistency between m_pCurFilter and m_sCurrentFilterDisplayName
203 const SvtFileDialogFilter_Impl
* GetCurFilter( ) const
208 const OUString
& GetCurFilterDisplayName() const
210 return m_sCurrentFilterDisplayName
;
213 void SetCurFilter( SvtFileDialogFilter_Impl
const * _pFilter
, const OUString
& rDisplayName
);
216 #endif // INCLUDED_FPICKER_SOURCE_OFFICE_IODLGIMP_HXX
218 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */