fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / include / svtools / fileview.hxx
blob917cfabab462a4f29d32e5f94f9d54748774ba90
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 _SVT_FILEVIEW_HXX
20 #define _SVT_FILEVIEW_HXX
22 #include "svtools/svtdllapi.h"
23 #include <com/sun/star/uno/Sequence.h>
24 #include <com/sun/star/ucb/XContent.hpp>
25 #include <vcl/ctrl.hxx>
26 #include <vcl/image.hxx>
27 #include <vcl/fixed.hxx>
28 #include <vcl/button.hxx>
29 #include <vcl/dialog.hxx>
30 #include <rtl/ustring.hxx>
32 // class SvtFileView -----------------------------------------------------
34 #define FILEVIEW_ONLYFOLDER 0x0001
35 #define FILEVIEW_MULTISELECTION 0x0002
37 #define FILEVIEW_SHOW_ONLYTITLE 0x0010
38 #define FILEVIEW_SHOW_NONE 0x0020
40 class ViewTabListBox_Impl;
41 class SvtFileView_Impl;
42 class SvTreeListEntry;
43 class HeaderBar;
45 /// the result of an action in the FileView
46 enum FileViewResult
48 eSuccess,
49 eFailure,
50 eTimeout,
51 eStillRunning
54 /// describes parameters for doing an action on the FileView asynchronously
55 struct FileViewAsyncAction
57 sal_uInt32 nMinTimeout; /// minimum time to wait for a result, in milliseconds
58 sal_uInt32 nMaxTimeout; /// maximum time to wait for a result, in milliseconds, until eTimeout is returned
59 Link aFinishHandler; /// the handler to be called when the action is finished. Called in every case, no matter of the result
61 FileViewAsyncAction()
63 nMinTimeout = nMaxTimeout = 0;
67 class SVT_DLLPUBLIC SvtFileView : public Control
69 private:
70 SvtFileView_Impl* mpImp;
71 sal_Bool bSortColumn;
73 ::com::sun::star::uno::Sequence< OUString > mpBlackList;
75 DECL_DLLPRIVATE_LINK( HeaderSelect_Impl, HeaderBar * );
76 DECL_DLLPRIVATE_LINK( HeaderEndDrag_Impl, HeaderBar * );
78 protected:
79 virtual void GetFocus();
81 public:
82 SvtFileView( Window* pParent, const ResId& rResId, sal_Bool bOnlyFolder, sal_Bool bMultiSelection );
83 SvtFileView( Window* pParent, const ResId& rResId, sal_uInt8 nFlags );
84 ~SvtFileView();
86 const String& GetViewURL() const;
87 String GetURL( SvTreeListEntry* pEntry ) const;
88 String GetCurrentURL() const;
90 sal_Bool GetParentURL( String& _rParentURL ) const;
91 void CreatedFolder( const String& rUrl, const String& rNewFolder );
93 void SetHelpId( const OString& rHelpId );
94 const OString& GetHelpId( ) const;
95 void SetSizePixel( const Size& rNewSize );
96 virtual void SetPosSizePixel( const Point& rNewPos, const Size& rNewSize );
97 void SetSortColumn( sal_Bool bValue ) { bSortColumn = bValue; }
98 sal_Bool GetSortColumn() { return bSortColumn; }
100 /** initialize the view with the content of a folder given by URL, and aply an immediate filter
102 @param rFolderURL
103 the URL of the folder whose content is to be read
104 @param rFilter
105 the initial filter to be applied
106 @param pAsyncDescriptor
107 If not <NULL/>, this struct describes the parameters for doing the
108 action asynchronously.
110 FileViewResult Initialize(
111 const String& rFolderURL,
112 const String& rFilter,
113 const FileViewAsyncAction* pAsyncDescriptor,
114 const ::com::sun::star::uno::Sequence< OUString >& rBlackList
117 FileViewResult Initialize(
118 const String& rFolderURL,
119 const String& rFilter,
120 const FileViewAsyncAction* pAsyncDescriptor );
121 /** initialze the view with a sequence of contents, which have already been obtained elsewhere
123 This method will never return <member>eStillRunning</member>, since it will fill the
124 view synchronously
126 sal_Bool Initialize( const ::com::sun::star::uno::Sequence< OUString >& aContents );
128 /** initializes the view with the content of a folder given by an UCB content
130 sal_Bool Initialize( const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent>& _xContent,
131 const String& rFilter );
133 /** reads the current content of the current folder again, and applies the given filter to it
135 Note 1: The folder is really read a second time. This implies that any new elements (which were
136 not present when you called Initialize the last time) are now displayed.
138 Note 2: This method must not be called when you previously initialized the view from a sequence
139 of strings, or a UNO content object.
141 @param rFilter
142 the filter to be applied
143 @param pAsyncDescriptor
144 If not <NULL/>, this struct describes the parameters for doing the
145 action asynchronously.
147 FileViewResult ExecuteFilter(
148 const String& rFilter,
149 const FileViewAsyncAction* pAsyncDescriptor
152 /** cancels a running async action (if any)
154 @seealso Initialize
155 @seealso ExecuteFilter
156 @seealso FileViewAsyncAction
158 void CancelRunningAsyncAction();
160 /** initializes the view with the parent folder of the current folder
162 @param rNewURL
163 the URL of the folder which we just navigated to
164 @param pAsyncDescriptor
165 If not <NULL/>, this struct describes the parameters for doing the
166 action asynchronously.
168 FileViewResult PreviousLevel(
169 const FileViewAsyncAction* pAsyncDescriptor
172 void SetNoSelection();
174 void SetSelectHdl( const Link& rHdl );
175 void SetDoubleClickHdl( const Link& rHdl );
176 void SetOpenDoneHdl( const Link& rHdl );
178 sal_uLong GetSelectionCount() const;
179 SvTreeListEntry* FirstSelected() const;
180 SvTreeListEntry* NextSelected( SvTreeListEntry* pEntry ) const;
181 void EnableAutoResize();
182 void SetFocus();
184 void EnableContextMenu( sal_Bool bEnable );
185 void EnableDelete( sal_Bool bEnable );
186 void EnableNameReplacing( sal_Bool bEnable = sal_True );
187 // translate folder names or display doc-title instead of file name
188 // EnableContextMenu( sal_True )/EnableDelete(sal_True) disable name replacing!
190 // save and load column size and sort order
191 String GetConfigString() const;
192 void SetConfigString( const String& rCfgStr );
194 void EndInplaceEditing( bool _bCancel );
196 protected:
197 virtual void StateChanged( StateChangedType nStateChange );
200 // struct SvtContentEntry ------------------------------------------------
202 struct SvtContentEntry
204 sal_Bool mbIsFolder;
205 OUString maURL;
207 SvtContentEntry( const OUString& rURL, sal_Bool bIsFolder ) :
208 mbIsFolder( bIsFolder ), maURL( rURL ) {}
211 namespace svtools {
213 // -----------------------------------------------------------------------
214 // QueryDeleteDlg_Impl
215 // -----------------------------------------------------------------------
217 enum QueryDeleteResult_Impl
219 QUERYDELETE_YES = 0,
220 QUERYDELETE_NO,
221 QUERYDELETE_ALL,
222 QUERYDELETE_CANCEL
225 class SVT_DLLPUBLIC QueryDeleteDlg_Impl : public ModalDialog
227 FixedText _aEntryLabel;
228 FixedText _aEntry;
229 FixedText _aQueryMsg;
231 PushButton _aYesButton;
232 PushButton _aAllButton;
233 PushButton _aNoButton;
234 CancelButton _aCancelButton;
236 QueryDeleteResult_Impl _eResult;
238 private:
240 DECL_DLLPRIVATE_STATIC_LINK( QueryDeleteDlg_Impl, ClickLink, PushButton* );
242 public:
244 QueryDeleteDlg_Impl( Window* pParent,
245 const String& rName );
247 void EnableAllButton() { _aAllButton.Enable( sal_True ); }
248 QueryDeleteResult_Impl GetResult() const { return _eResult; }
253 #endif // _SVT_FILEVIEW_HXX
255 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */