bump product version to 6.3.0.0.beta1
[LibreOffice.git] / include / svtools / fileview.hxx
blobc53edb0c017a38f843b01cc506c8d7068528dec9
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_VCL_FILEVIEW_HXX
20 #define INCLUDED_VCL_FILEVIEW_HXX
22 #include <memory>
23 #include <svtools/svtdllapi.h>
24 #include <com/sun/star/uno/Sequence.h>
25 #include <vcl/ctrl.hxx>
26 #include <vcl/weld.hxx>
27 #include <rtl/ustring.hxx>
29 namespace com :: sun :: star :: ucb { class XContent; }
31 // class SvtFileView -----------------------------------------------------
33 class SvtFileView_Impl;
34 class SvTreeListEntry;
35 class HeaderBar;
36 struct SvtContentEntry;
37 class SvTreeListBox;
39 /// the result of an action in the FileView
40 enum FileViewResult
42 eSuccess,
43 eFailure,
44 eTimeout,
45 eStillRunning
48 enum FileViewMode
50 eDetailedList,
51 eIcon
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<void*,void> 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 std::unique_ptr<SvtFileView_Impl> mpImpl;
71 css::uno::Sequence< OUString > mpBlackList;
73 DECL_DLLPRIVATE_LINK( HeaderSelect_Impl, HeaderBar*, void );
74 DECL_DLLPRIVATE_LINK( HeaderEndDrag_Impl, HeaderBar*, void );
76 protected:
77 virtual void GetFocus() override;
79 public:
80 SvtFileView( vcl::Window* pParent, WinBits nBits, bool bOnlyFolder, bool bMultiSelection, bool bShowType = true );
81 virtual ~SvtFileView() override;
82 virtual void dispose() override;
84 virtual Size GetOptimalSize() const override;
86 void SetViewMode( FileViewMode eMode );
88 const OUString& GetViewURL() const;
89 static OUString GetURL( SvTreeListEntry const * pEntry );
90 OUString GetCurrentURL() const;
92 bool GetParentURL( OUString& _rParentURL ) const;
93 void CreatedFolder( const OUString& rUrl, const OUString& rNewFolder );
95 void SetHelpId( const OString& rHelpId );
96 const OString& GetHelpId( ) const;
97 void SetSizePixel( const Size& rNewSize ) override;
98 virtual void SetPosSizePixel( const Point& rNewPos, const Size& rNewSize ) override;
100 /** initialize the view with the content of a folder given by URL, and apply 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 OUString& rFolderURL,
112 const OUString& rFilter,
113 const FileViewAsyncAction* pAsyncDescriptor,
114 const css::uno::Sequence< OUString >& rBlackList
117 /** initializes the view with the content of a folder given by an UCB content
119 bool Initialize( const css::uno::Reference< css::ucb::XContent>& _xContent );
121 /** reads the current content of the current folder again, and applies the given filter to it
123 Note 1: The folder is really read a second time. This implies that any new elements (which were
124 not present when you called Initialize the last time) are now displayed.
126 Note 2: This method must not be called when you previously initialized the view from a sequence
127 of strings, or a UNO content object.
129 @param rFilter
130 the filter to be applied
131 @param pAsyncDescriptor
132 If not <NULL/>, this struct describes the parameters for doing the
133 action asynchronously.
135 FileViewResult ExecuteFilter(
136 const OUString& rFilter,
137 const FileViewAsyncAction* pAsyncDescriptor
140 /** cancels a running async action (if any)
142 @seealso Initialize
143 @seealso ExecuteFilter
144 @seealso FileViewAsyncAction
146 void CancelRunningAsyncAction();
148 /** initializes the view with the parent folder of the current folder
150 @param rNewURL
151 the URL of the folder which we just navigated to
152 @param pAsyncDescriptor
153 If not <NULL/>, this struct describes the parameters for doing the
154 action asynchronously.
156 FileViewResult PreviousLevel(
157 const FileViewAsyncAction* pAsyncDescriptor
160 void SetNoSelection();
162 void SetSelectHdl( const Link<SvTreeListBox*,void>& rHdl );
163 void SetDoubleClickHdl( const Link<SvTreeListBox*,bool>& rHdl );
164 void SetOpenDoneHdl( const Link<SvtFileView*,void>& rHdl );
166 sal_uLong GetSelectionCount() const;
167 SvTreeListEntry* FirstSelected() const;
168 SvTreeListEntry* NextSelected( SvTreeListEntry* pEntry ) const;
169 void EnableAutoResize();
171 void EnableDelete( bool bEnable );
173 // save and load column size and sort order
174 OUString GetConfigString() const;
175 void SetConfigString( const OUString& rCfgStr );
177 void EndInplaceEditing();
179 ::std::vector< SvtContentEntry > GetContent();
181 protected:
182 virtual void StateChanged( StateChangedType nStateChange ) override;
185 // struct SvtContentEntry ------------------------------------------------
187 struct SvtContentEntry
189 bool const mbIsFolder;
190 OUString maURL;
192 SvtContentEntry( const OUString& rURL, bool bIsFolder ) :
193 mbIsFolder( bIsFolder ), maURL( rURL ) {}
196 namespace svtools {
199 // QueryDeleteDlg_Impl
202 enum QueryDeleteResult_Impl
204 QUERYDELETE_YES = RET_YES,
205 QUERYDELETE_ALL = 101
208 class SVT_DLLPUBLIC QueryDeleteDlg_Impl : public weld::MessageDialogController
210 private:
211 std::unique_ptr<weld::Button> m_xAllButton;
212 public:
214 QueryDeleteDlg_Impl(weld::Widget* pParent, const OUString& rName);
215 virtual ~QueryDeleteDlg_Impl() override;
217 void EnableAllButton() { m_xAllButton->set_sensitive(true); }
222 #endif // INCLUDED_VCL_FILEVIEW_HXX
224 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */