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/.
10 #ifndef INCLUDED_SVTOOLS_REMOTEFILESDIALOG_HXX
11 #define INCLUDED_SVTOOLS_REMOTEFILESDIALOG_HXX
13 #include "autocmpledit.hxx"
14 #include <svtools/place.hxx>
16 #include <unotools/viewoptions.hxx>
18 #include <vcl/svapp.hxx>
20 #include <com/sun/star/beans/StringPair.hpp>
21 #include <com/sun/star/uno/Sequence.hxx>
22 #include <com/sun/star/task/XPasswordContainer2.hpp>
26 #include "asyncfilepicker.hxx"
27 #include "fpdialogbase.hxx"
28 #include "breadcrumb.hxx"
29 #include "fileview.hxx"
30 #include "foldertree.hxx"
32 using namespace ::com::sun::star::beans
;
33 using namespace ::com::sun::star::task
;
34 using namespace ::com::sun::star::uno
;
35 using namespace ::com::sun::star::ui::dialogs
;
39 REMOTEDLG_MODE_OPEN
= 0,
40 REMOTEDLG_MODE_SAVE
= 1
45 REMOTEDLG_TYPE_FILEDLG
= 0,
46 REMOTEDLG_TYPE_PATHDLG
= 1
49 typedef std::shared_ptr
< Place
> ServicePtr
;
51 class RemoteFilesDialog
: public SvtFileDialog_Base
54 RemoteFilesDialog( weld::Window
* pParent
, PickerFlags nBits
);
55 virtual ~RemoteFilesDialog() override
;
57 virtual short run() override
;
61 virtual SvtFileView
* GetView() override
;
63 virtual void SetHasFilename( bool ) override
;
64 virtual void SetBlackList( const css::uno::Sequence
< OUString
>& rBlackList
) override
;
65 virtual const css::uno::Sequence
< OUString
>& GetBlackList() const override
;
66 virtual void SetStandardDir( const OUString
& rStdDir
) override
;
67 virtual const OUString
& GetStandardDir() const override
;
68 virtual void SetPath( const OUString
& rNewURL
) override
;
69 virtual const OUString
& GetPath() override
;
70 virtual std::vector
<OUString
> GetPathList() const override
;
71 virtual bool ContentIsFolder( const OUString
& rURL
) override
;
72 bool ContentIsDocument( const OUString
& rURL
);
74 virtual OUString
getCurrentFileText() const override
;
75 virtual void setCurrentFileText( const OUString
& rText
, bool bSelectAll
= false ) override
;
77 virtual void AddFilter( const OUString
& rFilter
, const OUString
& rType
) override
;
78 virtual void AddFilterGroup( const OUString
& _rFilter
,
79 const css::uno::Sequence
< css::beans::StringPair
>& rFilters
) override
;
80 virtual OUString
GetCurFilter() const override
;
81 virtual void SetCurFilter( const OUString
& rFilter
) override
;
82 virtual void FilterSelect() override
;
84 virtual void SetFileCallback( ::svt::IFilePickerListener
*pNotifier
) override
;
85 virtual void onAsyncOperationStarted() override
;
86 virtual void onAsyncOperationFinished() override
;
87 virtual void UpdateControls( const OUString
& rURL
) override
;
89 virtual void EnableAutocompletion( bool = true) override
;
91 virtual sal_Int32
getAvailableWidth() override
;
92 virtual sal_Int32
getAvailableHeight() override
;
94 virtual void setImage( const css::uno::Any
& rImage
) override
;
96 virtual bool getShowState() override
;
98 virtual weld::Widget
* getControl( sal_Int16 nControlId
, bool bLabelControl
= false ) const override
;
99 virtual void enableControl( sal_Int16 nControlId
, bool bEnable
) override
;
100 virtual OUString
getCurFilter( ) const override
;
103 Reference
< XComponentContext
> m_xContext
;
104 Reference
< XPasswordContainer2
> m_xMasterPasswd
;
106 SvtRemoteDlgMode m_eMode
;
107 SvtRemoteDlgType m_eType
;
110 bool m_bServiceChanged
;
118 OUString m_sRootLabel
;
119 OUString m_sLastServiceUrl
;
120 int m_nCurrentFilter
;
122 ::rtl::Reference
< ::svt::AsyncPickerAction
> m_pCurrentAsyncAction
;
124 css::uno::Sequence
< OUString
> m_aBlackList
;
126 std::unique_ptr
<weld::Button
> m_xOk_btn
;
127 std::unique_ptr
<weld::Button
> m_xCancel_btn
;
128 std::unique_ptr
<weld::Toolbar
> m_xAddService_bar
;
129 std::unique_ptr
<weld::Menu
> m_xAddService_menu
;
130 std::unique_ptr
<weld::ComboBox
> m_xServices_lb
;
131 std::unique_ptr
<weld::Container
> m_xPathContainer
;
132 std::unique_ptr
<Breadcrumb
> m_xPath
;
133 std::unique_ptr
<weld::Button
> m_xNewFolder
;
134 std::unique_ptr
<weld::ToggleButton
> m_xListView_btn
;
135 std::unique_ptr
<weld::ToggleButton
> m_xIconView_btn
;
136 std::unique_ptr
<FolderTree
> m_xTreeView
;
137 std::unique_ptr
<SvtFileView
> m_xFileView
;
138 std::unique_ptr
<weld::Container
> m_xContainer
;
139 std::unique_ptr
<weld::ComboBox
> m_xFilter_lb
;
140 std::unique_ptr
<AutocompleteEdit
> m_xName_ed
;
142 std::vector
< ServicePtr
> m_aServices
;
143 std::vector
< std::pair
< OUString
, OUString
> > m_aFilters
;
147 void FillServicesListbox();
149 /* If failure returns < 0 */
150 int GetSelectedServicePos();
152 void OpenURL( OUString
const & sURL
);
154 void AddFileExtension();
156 void EnableControls();
157 void DisableControls();
159 void SavePassword(const OUString
& rURL
, const OUString
& rUser
,
160 const OUString
& rPassword
, bool bPersistent
);
162 DECL_LINK ( AddServiceHdl
, const OString
&, void );
163 DECL_LINK ( SelectServiceHdl
, weld::ComboBox
&, void );
164 DECL_LINK ( EditServiceMenuHdl
, const OString
&, 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 #endif // INCLUDED_SVTOOLS_REMOTEFILESDIALOG_HXX
187 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */