Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / fpicker / source / office / iodlgimp.hxx
blobe816f56ebd6bb741b45147eb2fecc91fd894cd21
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
26 #include <deque>
27 #include <memory>
28 #include <vector>
30 class CheckBox;
31 class SvtFileDialog;
33 #define FILEDIALOG_DEF_EXTSEP ';'
34 #define FILEDIALOG_DEF_WILDCARD '*'
37 // SvtFileDialogFilter_Impl
40 /* [Description]
42 Instances of this class represent a filter.
45 class SvtFileDialogFilter_Impl
47 private:
48 OUString m_aName; // name of the entry
49 OUString m_aType; // filter wildcard - if empty, the entry marks a group
51 public:
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;
64 enum SvtFileDlgMode
66 FILEDLG_MODE_OPEN = 0,
67 FILEDLG_MODE_SAVE = 1
70 enum SvtFileDlgType
72 FILEDLG_TYPE_FILEDLG = 0,
73 FILEDLG_TYPE_PATHDLG
76 class SvtUpButton_Impl
78 private:
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;
85 public:
86 SvtUpButton_Impl(std::unique_ptr<weld::Toolbar> xToolbar,
87 std::unique_ptr<weld::Menu> xMenu,
88 SvtFileDialog* pDlg);
90 void set_help_id(const OString& rHelpId) { m_xToolbar->set_help_id(rHelpId); }
91 void show() { m_xToolbar->show(); }
93 void FillURLMenu();
95 weld::Widget* getWidget() { return m_xToolbar.get(); }
97 private:
99 DECL_LINK(SelectHdl, const OString&, void);
100 DECL_LINK(ClickHdl, const OString&, void);
103 class URLBox;
104 class SvtExpFileDlg_Impl
106 private:
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;
112 public:
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;
151 OUString m_aStdDir;
153 // delay filter when traveling the filterbox
154 Idle m_aFilterIdle;
156 // shows OpenHdl_Imp() if the open was triggered by a double click
157 bool m_bDoubleClick;
158 bool m_bNeedDelayedFilterExecute;
160 // MultiSelection?
161 bool m_bMultiSelection;
163 // remember sizes
164 OUString m_aIniKey;
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
205 return m_pCurFilter;
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: */