Bump version to 24.04.3.4
[LibreOffice.git] / fpicker / source / office / iodlgimp.hxx
blob3a02dbbee6412402ec599f20c6bdaa660265459e
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 #pragma once
21 #include "PlacesListBox.hxx"
23 #include <vcl/idle.hxx>
25 #include <deque>
26 #include <memory>
27 #include <vector>
29 class CheckBox;
30 class SvtFileDialog;
32 #define FILEDIALOG_DEF_EXTSEP ';'
33 #define FILEDIALOG_DEF_WILDCARD '*'
36 // SvtFileDialogFilter_Impl
39 /* [Description]
41 Instances of this class represent a filter.
44 class SvtFileDialogFilter_Impl
46 private:
47 OUString m_aName; // name of the entry
48 OUString m_aType; // filter wildcard - if empty, the entry marks a group
50 public:
51 SvtFileDialogFilter_Impl( OUString aName, OUString aType );
52 ~SvtFileDialogFilter_Impl();
54 const OUString& GetName() const { return m_aName; }
55 const OUString& GetType() const { return m_aType; }
56 OUString GetExtension() const { return m_aType.getLength() > 2 ? m_aType.copy( 2 ) : OUString(); }
58 bool isGroupSeparator() const { return m_aType.isEmpty(); }
61 typedef std::deque<std::unique_ptr<SvtFileDialogFilter_Impl>> SvtFileDialogFilterList_Impl;
63 enum SvtFileDlgMode
65 FILEDLG_MODE_OPEN = 0,
66 FILEDLG_MODE_SAVE = 1
69 enum SvtFileDlgType
71 FILEDLG_TYPE_FILEDLG = 0,
72 FILEDLG_TYPE_PATHDLG
75 class SvtUpButton_Impl
77 private:
78 std::unique_ptr<weld::Toolbar> m_xToolbar;
79 std::unique_ptr<weld::Menu> m_xMenu;
80 SvtFileDialog* m_pDlg;
82 std::vector<OUString> aURLs;
84 public:
85 SvtUpButton_Impl(std::unique_ptr<weld::Toolbar> xToolbar,
86 std::unique_ptr<weld::Menu> xMenu,
87 SvtFileDialog* pDlg);
89 void set_help_id(const OUString& rHelpId) { m_xToolbar->set_help_id(rHelpId); }
90 void show() { m_xToolbar->show(); }
92 void FillURLMenu();
94 weld::Widget* getWidget() { return m_xToolbar.get(); }
96 private:
98 DECL_LINK(SelectHdl, const OUString&, void);
99 DECL_LINK(ClickHdl, const OUString&, void);
102 class SvtURLBox;
103 class SvtExpFileDlg_Impl
105 private:
106 const SvtFileDialogFilter_Impl* m_pCurFilter;
107 OUString m_sCurrentFilterDisplayName; // may differ from m_pCurFilter->GetName in case it is a cached entry
109 css::uno::Sequence< OUString > m_aDenyList;
111 public:
112 SvtFileDialogFilterList_Impl m_aFilter;
113 std::unique_ptr<SvtFileDialogFilter_Impl> m_xUserFilter;
115 std::unique_ptr<weld::Label> m_xFtFileName;
116 std::unique_ptr<SvtURLBox> m_xEdFileName;
118 std::unique_ptr<weld::Label> m_xSharedLabel;
119 std::unique_ptr<weld::ComboBox> m_xSharedListBox;
121 std::unique_ptr<weld::Label> m_xFtFileType;
122 std::unique_ptr<weld::ComboBox> m_xLbFilter;
123 std::unique_ptr<weld::Button> m_xBtnFileOpen;
124 std::unique_ptr<weld::Button> m_xBtnCancel;
125 std::unique_ptr<weld::Button> m_xBtnHelp;
126 std::unique_ptr<SvtUpButton_Impl> m_xBtnUp;
127 std::unique_ptr<weld::Button> m_xBtnNewFolder;
128 std::unique_ptr<weld::CheckButton> m_xCbPassword;
129 std::unique_ptr<weld::CheckButton> m_xCbGPGEncrypt;
130 std::unique_ptr<SvtURLBox> m_xEdCurrentPath;
131 std::unique_ptr<weld::CheckButton> m_xCbAutoExtension;
132 std::unique_ptr<weld::CheckButton> m_xCbOptions;
134 std::unique_ptr<PlacesListBox> m_xPlaces;
135 std::unique_ptr<weld::Button> m_xBtnConnectToServer;
137 SvtFileDlgMode m_eMode;
138 SvtFileDlgType m_eDlgType;
139 PickerFlags m_nStyle;
141 OUString m_aStdDir;
143 // delay filter when traveling the filterbox
144 Idle m_aFilterIdle;
146 // shows OpenHdl_Imp() if the open was triggered by a double click
147 bool m_bDoubleClick;
149 // MultiSelection?
150 bool m_bMultiSelection;
152 // remember sizes
153 OUString m_aIniKey;
155 explicit SvtExpFileDlg_Impl();
156 ~SvtExpFileDlg_Impl();
158 void SetDenyList( const css::uno::Sequence< OUString >& rDenyList ) { m_aDenyList = rDenyList; }
159 const css::uno::Sequence< OUString >& GetDenyList() const { return m_aDenyList; }
160 void SetStandardDir( const OUString& rDir );
161 const OUString& GetStandardDir() const { return m_aStdDir; }
163 // access to the filter listbox only as weld::Widget* - we want to maintain the entries/userdata ourself
164 weld::Widget* GetFilterListControl() { return m_xLbFilter.get(); }
165 const weld::Widget* GetFilterListControl() const { return m_xLbFilter.get(); }
166 void SetFilterListSelectHdl(const Link<weld::ComboBox&, void>& rHandler)
168 m_xLbFilter->connect_changed(rHandler);
171 // inits the listbox for the filters from the filter list (_pFilter)
172 void InitFilterList( );
173 bool HasFilterListEntry( const OUString& rFilterName )
175 return m_xLbFilter->find_text(rFilterName) != -1;
178 void SelectFilterListEntry( const OUString& rFilterName )
180 m_xLbFilter->set_active_text(rFilterName);
183 void InsertFilterListEntry( const SvtFileDialogFilter_Impl* _pFilterDesc );
184 // _pFilterDesc must already have been added to _pFilter
185 SvtFileDialogFilter_Impl* GetSelectedFilterEntry( OUString& rDisplayName ) const
187 rDisplayName = m_xLbFilter->get_active_text();
188 return weld::fromId<SvtFileDialogFilter_Impl*>(m_xLbFilter->get_active_id());
191 // access to the current filter via methods only - need to care for consistency between m_pCurFilter and m_sCurrentFilterDisplayName
192 const SvtFileDialogFilter_Impl* GetCurFilter( ) const
194 return m_pCurFilter;
197 const OUString& GetCurFilterDisplayName() const
199 return m_sCurrentFilterDisplayName;
202 void SetCurFilter( SvtFileDialogFilter_Impl const * _pFilter, const OUString& rDisplayName );
205 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */