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 .
19 #ifndef INCLUDED_SVTOOLS_FILEVIEW_HXX
20 #define INCLUDED_SVTOOLS_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/dialog.hxx>
29 #include <vcl/button.hxx>
30 #include <vcl/layout.hxx>
31 #include <rtl/ustring.hxx>
33 // class SvtFileView -----------------------------------------------------
35 class ViewTabListBox_Impl
;
36 class SvtFileView_Impl
;
37 class SvTreeListEntry
;
40 /// 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
<> aFinishHandler
; /// the handler to be called when the action is finished. Called in every case, no matter of the result
58 nMinTimeout
= nMaxTimeout
= 0;
62 class SVT_DLLPUBLIC SvtFileView
: public Control
65 SvtFileView_Impl
* mpImp
;
68 ::com::sun::star::uno::Sequence
< OUString
> mpBlackList
;
70 DECL_DLLPRIVATE_LINK( HeaderSelect_Impl
, HeaderBar
* );
71 DECL_DLLPRIVATE_LINK( HeaderEndDrag_Impl
, HeaderBar
* );
74 virtual void GetFocus() SAL_OVERRIDE
;
77 SvtFileView( vcl::Window
* pParent
, WinBits nBits
, bool bOnlyFolder
, bool bMultiSelection
);
78 virtual ~SvtFileView();
79 virtual void dispose() SAL_OVERRIDE
;
81 virtual Size
GetOptimalSize() const SAL_OVERRIDE
;
83 const OUString
& GetViewURL() const;
84 static OUString
GetURL( SvTreeListEntry
* pEntry
);
85 OUString
GetCurrentURL() const;
87 bool GetParentURL( OUString
& _rParentURL
) const;
88 void CreatedFolder( const OUString
& rUrl
, const OUString
& rNewFolder
);
90 void SetHelpId( const OString
& rHelpId
);
91 const OString
& GetHelpId( ) const;
92 void SetSizePixel( const Size
& rNewSize
) SAL_OVERRIDE
;
93 virtual void SetPosSizePixel( const Point
& rNewPos
, const Size
& rNewSize
) SAL_OVERRIDE
;
94 void SetSortColumn( bool bValue
) { bSortColumn
= bValue
; }
95 bool GetSortColumn() { return bSortColumn
; }
97 /** initialize the view with the content of a folder given by URL, and apply an immediate filter
100 the URL of the folder whose content is to be read
102 the initial filter to be applied
103 @param pAsyncDescriptor
104 If not <NULL/>, this struct describes the parameters for doing the
105 action asynchronously.
107 FileViewResult
Initialize(
108 const OUString
& rFolderURL
,
109 const OUString
& rFilter
,
110 const FileViewAsyncAction
* pAsyncDescriptor
,
111 const ::com::sun::star::uno::Sequence
< OUString
>& rBlackList
114 /** initializes the view with the content of a folder given by an UCB content
116 bool Initialize( const ::com::sun::star::uno::Reference
< ::com::sun::star::ucb::XContent
>& _xContent
,
117 const OUString
& rFilter
);
119 /** reads the current content of the current folder again, and applies the given filter to it
121 Note 1: The folder is really read a second time. This implies that any new elements (which were
122 not present when you called Initialize the last time) are now displayed.
124 Note 2: This method must not be called when you previously initialized the view from a sequence
125 of strings, or a UNO content object.
128 the filter to be applied
129 @param pAsyncDescriptor
130 If not <NULL/>, this struct describes the parameters for doing the
131 action asynchronously.
133 FileViewResult
ExecuteFilter(
134 const OUString
& rFilter
,
135 const FileViewAsyncAction
* pAsyncDescriptor
138 /** cancels a running async action (if any)
141 @seealso ExecuteFilter
142 @seealso FileViewAsyncAction
144 void CancelRunningAsyncAction();
146 /** initializes the view with the parent folder of the current folder
149 the URL of the folder which we just navigated to
150 @param pAsyncDescriptor
151 If not <NULL/>, this struct describes the parameters for doing the
152 action asynchronously.
154 FileViewResult
PreviousLevel(
155 const FileViewAsyncAction
* pAsyncDescriptor
158 void SetNoSelection();
160 void SetSelectHdl( const Link
<>& rHdl
);
161 void SetDoubleClickHdl( const Link
<>& rHdl
);
162 void SetOpenDoneHdl( const Link
<>& rHdl
);
164 sal_uLong
GetSelectionCount() const;
165 SvTreeListEntry
* FirstSelected() const;
166 SvTreeListEntry
* NextSelected( SvTreeListEntry
* pEntry
) const;
167 void EnableAutoResize();
169 void EnableDelete( bool bEnable
);
171 // save and load column size and sort order
172 OUString
GetConfigString() const;
173 void SetConfigString( const OUString
& rCfgStr
);
175 void EndInplaceEditing( bool _bCancel
);
178 virtual void StateChanged( StateChangedType nStateChange
) SAL_OVERRIDE
;
181 // struct SvtContentEntry ------------------------------------------------
183 struct SvtContentEntry
188 SvtContentEntry( const OUString
& rURL
, bool bIsFolder
) :
189 mbIsFolder( bIsFolder
), maURL( rURL
) {}
195 // QueryDeleteDlg_Impl
198 enum QueryDeleteResult_Impl
200 QUERYDELETE_CANCEL
= RET_CANCEL
,
201 QUERYDELETE_YES
= RET_YES
,
202 QUERYDELETE_NO
= RET_NO
,
206 class SVT_DLLPUBLIC QueryDeleteDlg_Impl
: public MessageDialog
209 VclPtr
<PushButton
> m_pAllButton
;
212 QueryDeleteDlg_Impl(vcl::Window
* pParent
, const OUString
& rName
);
213 virtual ~QueryDeleteDlg_Impl();
214 virtual void dispose() SAL_OVERRIDE
;
216 void EnableAllButton() { m_pAllButton
->Enable(true); }
221 #endif // INCLUDED_SVTOOLS_FILEVIEW_HXX
223 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */