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/.
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 .
22 #include <com/sun/star/uno/Sequence.h>
24 #include <vcl/weld.hxx>
25 #include <rtl/ustring.hxx>
27 namespace com :: sun :: star :: ucb
{ class XContent
; }
29 // class SvtFileView -----------------------------------------------------
31 class SvtFileView_Impl
;
32 struct SvtContentEntry
;
34 /// the result of an action in the FileView
49 /// describes parameters for doing an action on the FileView asynchronously
50 struct FileViewAsyncAction
52 sal_uInt32 nMinTimeout
; /// minimum time to wait for a result, in milliseconds
53 sal_uInt32 nMaxTimeout
; /// maximum time to wait for a result, in milliseconds, until eTimeout is returned
54 Link
<void*,void> aFinishHandler
; /// the handler to be called when the action is finished. Called in every case, no matter of the result
56 FileViewAsyncAction() : nMinTimeout(0), nMaxTimeout (0)
64 std::unique_ptr
<SvtFileView_Impl
> mpImpl
;
65 css::uno::Sequence
<OUString
> maDenyList
;
67 DECL_LINK(HeaderSelect_Impl
, int, void);
70 SvtFileView(weld::Window
* pTopLevel
,
71 std::unique_ptr
<weld::TreeView
> xTreeView
,
72 std::unique_ptr
<weld::IconView
> xIconView
,
73 bool bOnlyFolder
, bool bMultiSelection
, bool bShowType
= true);
76 void SetViewMode( FileViewMode eMode
);
78 const OUString
& GetViewURL() const;
79 OUString
GetURL(const weld::TreeIter
& rEntry
) const;
80 OUString
GetCurrentURL() const;
82 bool GetParentURL( OUString
& _rParentURL
) const;
83 void CreatedFolder( const OUString
& rUrl
, const OUString
& rNewFolder
);
85 void set_help_id(const OUString
& rHelpId
);
86 OUString
get_help_id() const;
89 bool has_focus() const;
91 OUString
get_selected_text() const;
93 weld::Widget
* identifier() const; // just to uniquely identify this widget
95 /** initialize the view with the content of a folder given by URL, and apply an immediate filter
98 the URL of the folder whose content is to be read
100 the initial filter to be applied
101 @param pAsyncDescriptor
102 If not <NULL/>, this struct describes the parameters for doing the
103 action asynchronously.
105 FileViewResult
Initialize(
106 const OUString
& rFolderURL
,
107 const OUString
& rFilter
,
108 const FileViewAsyncAction
* pAsyncDescriptor
,
109 const css::uno::Sequence
< OUString
>& rDenyList
112 /** reads the current content of the current folder again, and applies the given filter to it
114 Note 1: The folder is really read a second time. This implies that any new elements (which were
115 not present when you called Initialize the last time) are now displayed.
117 Note 2: This method must not be called when you previously initialized the view from a sequence
118 of strings, or a UNO content object.
121 the filter to be applied
122 @param pAsyncDescriptor
123 If not <NULL/>, this struct describes the parameters for doing the
124 action asynchronously.
126 FileViewResult
ExecuteFilter(
127 const OUString
& rFilter
,
128 const FileViewAsyncAction
* pAsyncDescriptor
131 /** cancels a running async action (if any)
134 @seealso ExecuteFilter
135 @seealso FileViewAsyncAction
137 void CancelRunningAsyncAction();
139 /** initializes the view with the parent folder of the current folder
142 the URL of the folder which we just navigated to
143 @param pAsyncDescriptor
144 If not <NULL/>, this struct describes the parameters for doing the
145 action asynchronously.
147 FileViewResult
PreviousLevel(
148 const FileViewAsyncAction
* pAsyncDescriptor
151 void SetNoSelection();
153 void SetSelectHdl( const Link
<SvtFileView
*,void>& rHdl
);
154 void SetDoubleClickHdl( const Link
<SvtFileView
*,bool>& rHdl
);
155 void SetOpenDoneHdl( const Link
<SvtFileView
*,void>& rHdl
);
157 sal_uInt32
GetSelectionCount() const;
158 SvtContentEntry
* FirstSelected() const;
160 void selected_foreach(const std::function
<bool(weld::TreeIter
&)>& func
);
162 void EnableDelete( bool bEnable
);
164 // save and load column size and sort order
165 OUString
GetConfigString() const;
166 void SetConfigString( std::u16string_view rCfgStr
);
168 void EndInplaceEditing();
170 ::std::vector
< SvtContentEntry
> GetContent();
173 // struct SvtContentEntry ------------------------------------------------
175 struct SvtContentEntry
180 SvtContentEntry( OUString aURL
, bool bIsFolder
) :
181 mbIsFolder( bIsFolder
), maURL(std::move( aURL
)) {}
184 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */