tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / fpicker / source / office / RemoteFilesDialog.hxx
blob8c4fa0a4cbb30a5e00fc8cfdab97a2b356b1080b
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/.
8 */
10 #pragma once
12 #include "autocmpledit.hxx"
13 #include <svtools/place.hxx>
15 #include <unotools/viewoptions.hxx>
17 #include <vcl/svapp.hxx>
19 #include <com/sun/star/beans/StringPair.hpp>
20 #include <com/sun/star/uno/Sequence.hxx>
21 #include <com/sun/star/task/XPasswordContainer2.hpp>
23 #include <vector>
25 #include "asyncfilepicker.hxx"
26 #include "fpdialogbase.hxx"
27 #include "breadcrumb.hxx"
28 #include "fileview.hxx"
29 #include "foldertree.hxx"
31 using namespace ::com::sun::star::beans;
32 using namespace ::com::sun::star::task;
33 using namespace ::com::sun::star::uno;
34 using namespace ::com::sun::star::ui::dialogs;
36 enum SvtRemoteDlgMode
38 REMOTEDLG_MODE_OPEN = 0,
39 REMOTEDLG_MODE_SAVE = 1
42 enum SvtRemoteDlgType
44 REMOTEDLG_TYPE_FILEDLG = 0,
45 REMOTEDLG_TYPE_PATHDLG = 1
48 typedef std::shared_ptr< Place > ServicePtr;
50 class RemoteFilesDialog : public SvtFileDialog_Base
52 public:
53 RemoteFilesDialog( weld::Window* pParent, PickerFlags nBits );
54 virtual ~RemoteFilesDialog() override;
56 virtual short run() override;
58 // SvtFileDialog_Base
60 virtual SvtFileView* GetView() override;
62 virtual void SetHasFilename( bool ) override;
63 virtual void SetDenyList( const css::uno::Sequence< OUString >& rDenyList ) override;
64 virtual const css::uno::Sequence< OUString >& GetDenyList() const override;
65 virtual void SetStandardDir( const OUString& rStdDir ) override;
66 virtual const OUString& GetStandardDir() const override;
67 virtual void SetPath( const OUString& rNewURL ) override;
68 virtual const OUString& GetPath() override;
69 virtual std::vector<OUString> GetPathList() const override;
70 virtual bool ContentIsFolder( const OUString& rURL ) override;
71 bool ContentIsDocument(const OUString& rURL);
73 virtual OUString getCurrentFileText() const override;
74 virtual void setCurrentFileText( const OUString& rText, bool bSelectAll = false ) override;
76 virtual void AddFilter( const OUString& rFilter, const OUString& rType ) override;
77 virtual void AddFilterGroup( const OUString& _rFilter,
78 const css::uno::Sequence< css::beans::StringPair >& rFilters ) override;
79 virtual OUString GetCurFilter() const override;
80 virtual void SetCurFilter( const OUString& rFilter ) override;
81 virtual void FilterSelect() override;
83 virtual void SetFileCallback( ::svt::IFilePickerListener *pNotifier ) override;
84 virtual void onAsyncOperationStarted() override;
85 virtual void onAsyncOperationFinished() override;
86 virtual void UpdateControls( const OUString& rURL ) override;
88 virtual void EnableAutocompletion( bool = true) override;
90 virtual sal_Int32 getAvailableWidth() override;
91 virtual sal_Int32 getAvailableHeight() override;
93 virtual void setImage( const css::uno::Any& rImage ) override;
95 virtual bool getShowState() override;
97 virtual weld::Widget* getControl( sal_Int16 nControlId, bool bLabelControl = false ) const override;
98 virtual void enableControl( sal_Int16 nControlId, bool bEnable ) override;
99 virtual OUString getCurFilter( ) const override;
101 private:
102 Reference< XComponentContext > m_xContext;
103 Reference< XPasswordContainer2 > m_xMasterPasswd;
105 SvtRemoteDlgMode m_eMode;
106 SvtRemoteDlgType m_eType;
107 bool m_bIsUpdated;
108 bool m_bIsConnected;
109 bool m_bServiceChanged;
111 OUString m_sIniKey;
113 bool m_bIsInExecute;
115 OUString m_sPath;
116 OUString m_sStdDir;
117 OUString m_sRootLabel;
118 OUString m_sLastServiceUrl;
119 int m_nCurrentFilter;
121 ::rtl::Reference< ::svt::AsyncPickerAction > m_pCurrentAsyncAction;
123 css::uno::Sequence< OUString > m_aDenyList;
125 std::unique_ptr<weld::Button> m_xOk_btn;
126 std::unique_ptr<weld::Button> m_xCancel_btn;
127 std::unique_ptr<weld::MenuButton> m_xManageServices;
128 std::unique_ptr<weld::ComboBox> m_xServices_lb;
129 std::unique_ptr<weld::Container> m_xPathContainer;
130 std::unique_ptr<Breadcrumb> m_xPath;
131 std::unique_ptr<weld::Button> m_xNewFolder;
132 std::unique_ptr<weld::ToggleButton> m_xListView_btn;
133 std::unique_ptr<weld::ToggleButton> m_xIconView_btn;
134 std::unique_ptr<FolderTree> m_xTreeView;
135 std::unique_ptr<SvtFileView> m_xFileView;
136 std::unique_ptr<weld::Container> m_xContainer;
137 std::unique_ptr<weld::ComboBox> m_xFilter_lb;
138 std::unique_ptr<AutocompleteEdit> m_xName_ed;
140 std::vector< ServicePtr > m_aServices;
141 std::vector< std::pair< OUString, OUString > > m_aFilters;
143 void InitSize();
145 void FillServicesListbox();
147 /* If failure returns < 0 */
148 int GetSelectedServicePos();
150 void OpenURL( OUString const & sURL );
152 OUString AddFileExtension(const OUString& rFileName);
154 void EnableExtraMenuItems(bool bEnable);
155 void EnableControls();
156 void DisableControls();
158 void SavePassword(const OUString& rURL, const OUString& rUser,
159 const OUString& rPassword, bool bPersistent);
161 void AddService();
163 DECL_LINK ( SelectServiceHdl, weld::ComboBox&, void );
164 DECL_LINK ( EditServiceMenuHdl, const OUString&, void );
166 DECL_LINK( DoubleClickHdl, SvtFileView*, bool );
167 DECL_LINK( SelectHdl, SvtFileView*, void );
169 DECL_LINK( FileNameGetFocusHdl, weld::Widget&, void );
170 DECL_LINK( FileNameModifyHdl, weld::Entry&, void );
172 DECL_LINK( SelectFilterHdl, weld::ComboBox&, void );
174 DECL_LINK( TreeSelectHdl, weld::TreeView&, void );
176 DECL_LINK( SelectBreadcrumbHdl, Breadcrumb*, bool );
178 DECL_LINK( NewFolderHdl, weld::Button&, void );
179 DECL_LINK( IconViewHdl, weld::Button&, void );
180 DECL_LINK( ListViewHdl, weld::Button&, void );
182 DECL_LINK( OkHdl, weld::Button&, void );
183 DECL_LINK( CancelHdl, weld::Button&, void );
186 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */