LibreOffice Module fpicker (master) 1
fileview.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <sal/config.h>
21#include <sal/log.hxx>
22#include <osl/diagnose.h>
23#include <svtools/svtresid.hxx>
24#include <svtools/imagemgr.hxx>
26#include <svtools/strings.hrc>
27#include <bitmaps.hlst>
29#include <com/sun/star/task/InteractionHandler.hpp>
30#include <com/sun/star/ucb/XProgressHandler.hpp>
31#include <com/sun/star/ucb/XContent.hpp>
32#include <com/sun/star/container/XChild.hpp>
33#include <com/sun/star/ucb/CommandAbortedException.hpp>
34#include <com/sun/star/ucb/XCommandInfo.hpp>
35#include <com/sun/star/beans/XPropertySetInfo.hpp>
36#include <com/sun/star/beans/PropertyAttribute.hpp>
37
38#include <algorithm>
39#include <string_view>
40#include <vector>
41#include <tools/debug.hxx>
42#include <tools/urlobj.hxx>
44#include <comphelper/string.hxx>
45#include <ucbhelper/content.hxx>
47#include <rtl/math.hxx>
48#include <o3tl/safeint.hxx>
50#include <o3tl/string_view.hxx>
51#include <osl/mutex.hxx>
52#include <osl/conditn.hxx>
53#include <salhelper/timer.hxx>
54#include <svtools/urlfilter.hxx>
59#include <vcl/svapp.hxx>
60#include <vcl/commandevent.hxx>
61#include <vcl/event.hxx>
62#include <vcl/settings.hxx>
63#include <vcl/timer.hxx>
64#include <memory>
65#include "fileview.hxx"
66
67using namespace ::com::sun::star::lang;
68using namespace ::com::sun::star::sdbc;
69using namespace ::com::sun::star::task;
70using namespace ::com::sun::star::ucb;
71using namespace ::com::sun::star::uno;
72using namespace ::com::sun::star::io;
73using namespace ::com::sun::star::beans;
74using namespace ::comphelper;
75using ::svt::SortingData_Impl;
76using ::svt::FolderDescriptor;
77
78constexpr OUStringLiteral ALL_FILES_FILTER = u"*.*";
79
80#define COLUMN_TITLE 1
81#define COLUMN_TYPE 2
82#define COLUMN_SIZE 3
83#define COLUMN_DATE 4
84
85#define QUICK_SEARCH_TIMEOUT 1500 // time in mSec before the quicksearch string will be reset
86
87namespace {
88
89enum class FileViewFlags
90{
91 NONE = 0x00,
92 MULTISELECTION = 0x02,
93 SHOW_TYPE = 0x04,
94 SHOW_NONE = 0x20,
95};
96
97}
98
99namespace o3tl
100{
101 template<> struct typed_flags<FileViewFlags> : is_typed_flags<FileViewFlags, 0x26> {};
102}
103
104namespace
105{
106
107 //= CallbackTimer
108
109 class CallbackTimer : public ::salhelper::Timer
110 {
111 protected:
112 SvtFileView_Impl* const m_pTimeoutHandler;
113
114 public:
115 explicit CallbackTimer( SvtFileView_Impl* _pHandler ) : m_pTimeoutHandler( _pHandler ) { }
116
117 protected:
118 virtual void SAL_CALL onShot() override;
119 };
120
121class ViewTabListBox_Impl
122{
123private:
124 Reference< XCommandEnvironment > mxCmdEnv;
125 std::unique_ptr<weld::TreeView> mxTreeView;
126 std::unique_ptr<weld::TreeIter> mxScratchIter;
127
128 ::osl::Mutex maMutex;
130 Timer maResetQuickSearch { "fpicker SvtFileView_Impl maResetQuickSearch" };
131 OUString maQuickSearchText;
132 sal_uInt32 mnSearchIndex;
133 bool mbEnableDelete;
134 bool mbEditing;
135 bool const mbShowType;
136
137 void DeleteEntries();
138 void DoQuickSearch( sal_Unicode rChar );
139 bool Kill( const OUString& rURL );
140
141public:
142 ViewTabListBox_Impl(std::unique_ptr<weld::TreeView> xTreeView, weld::Window* pTopLevel, SvtFileView_Impl* pParent, FileViewFlags nFlags);
143
144 std::unique_ptr<weld::TreeIter> make_iterator() const { return mxTreeView->make_iterator(); }
145 void insert(const OUString &rEntry, const OUString& rId, const OUString& rImage, weld::TreeIter& rIter)
146 {
147 mxTreeView->insert(nullptr, -1, &rEntry, &rId, nullptr, nullptr, false, &rIter);
148 mxTreeView->set_image(rIter, rImage);
149 }
150 void append(const OUString& rId, const OUString& rStr, const OUString& rType, const OUString& rSize, const OUString& rDate, const OUString& rImage)
151 {
152 mxTreeView->insert(nullptr, -1, &rStr, &rId, nullptr, nullptr, false, mxScratchIter.get());
153 mxTreeView->set_image(*mxScratchIter, rImage);
154 int nCol = 1;
155 if (mbShowType)
156 mxTreeView->set_text(*mxScratchIter, rType, nCol++);
157 mxTreeView->set_text(*mxScratchIter, rSize, nCol++);
158 mxTreeView->set_text(*mxScratchIter, rDate, nCol++);
159 }
160
161 void scroll_to_row(const weld::TreeIter& rIter) { mxTreeView->scroll_to_row(rIter); }
162 void set_cursor(int nPos) { mxTreeView->set_cursor(nPos); }
163 void set_cursor(const weld::TreeIter& rIter) { mxTreeView->set_cursor(rIter); }
164 bool get_cursor(weld::TreeIter* pIter) const { return mxTreeView->get_cursor(pIter); }
165 bool get_iter_first(weld::TreeIter& rIter) const { return mxTreeView->get_iter_first(rIter); }
166 bool get_selected(weld::TreeIter* pIter) const { return mxTreeView->get_selected(pIter); }
167
168 OUString get_selected_text() const
169 {
170 // tdf#131898 only care about column 0
171 int nIndex = mxTreeView->get_selected_index();
172 return nIndex != -1 ? mxTreeView->get_text(nIndex, 0) : OUString();
173 }
174
175 void unselect_all() { mxTreeView->unselect_all(); }
176
177 OUString get_id(const weld::TreeIter& rIter) { return mxTreeView->get_id(rIter); }
178
179 void connect_row_activated(const Link<weld::TreeView&, bool>& rLink) { mxTreeView->connect_row_activated(rLink); }
180 void connect_changed(const Link<weld::TreeView&, void>& rLink) { mxTreeView->connect_changed(rLink); }
181
182 int n_children() const { return mxTreeView->n_children(); }
183
184 void freeze() { mxTreeView->freeze(); }
185 void thaw() { mxTreeView->thaw(); }
186
187 void show() { mxTreeView->show(); }
188 void hide() { mxTreeView->hide(); }
189 bool get_visible() const { return mxTreeView->get_visible(); }
190
191 int count_selected_rows() const { return mxTreeView->count_selected_rows(); }
192
193 void grab_focus() { mxTreeView->grab_focus(); }
194 bool has_focus() const { return mxTreeView->has_focus(); }
195
196 void set_help_id(const OUString& rHelpId) { mxTreeView->set_help_id(rHelpId); }
197 OUString get_help_id() const { return mxTreeView->get_help_id(); }
198
199 bool IsEditingActive() const { return mbEditing; }
200
201 void end_editing()
202 {
203 mxTreeView->end_editing();
205 mbEditing = false;
206 }
207
208 void selected_foreach(const std::function<bool(weld::TreeIter&)>& func)
209 {
210 mxTreeView->selected_foreach(func);
211 }
212
213 weld::TreeView* getWidget() const
214 {
215 return mxTreeView.get();
216 }
217
218 void clear() { mxTreeView->clear(); }
219
220 void EnableDelete( bool bEnable ) { mbEnableDelete = bEnable; }
221 bool TypeColumnVisible() const { return mbShowType; }
222
223 const Reference< XCommandEnvironment >& GetCommandEnvironment() const { return mxCmdEnv; }
224
225 DECL_LINK(ResetQuickSearch_Impl, Timer *, void);
226 DECL_LINK(CommandHdl, const CommandEvent&, bool);
227 DECL_LINK(EditingEntryHdl, const weld::TreeIter&, bool);
228 typedef std::pair<const weld::TreeIter&, OUString> IterString;
229 DECL_LINK(EditedEntryHdl, const IterString&, bool);
230 DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
231
232 void ExecuteContextMenuAction(std::u16string_view rSelectedPopentry);
233};
234
235}
236
237//= SvtFileView_Impl
239{
240protected:
243
247 ::osl::Condition m_aAsyncActionFinished;
252
253public:
254
255 ::std::vector<std::unique_ptr<SortingData_Impl>> maContent;
256 ::std::vector<std::unique_ptr<SvtContentEntry>> maEntries;
257 ::osl::Mutex maMutex;
258
260 std::unique_ptr<ViewTabListBox_Impl> mxView;
261 std::unique_ptr<weld::IconView> mxIconView;
262 sal_uInt16 mnSortColumn;
263 bool mbAscending : 1;
264 bool const mbOnlyFolder : 1;
267
269
270 OUString maViewURL;
275
276 Reference< XCommandEnvironment > mxCmdEnv;
277
278 SvtFileView_Impl(SvtFileView* pAntiImpl, weld::Window* pTopLevel,
279 std::unique_ptr<weld::TreeView> xTreeView,
280 std::unique_ptr<weld::IconView> xIconView,
281 Reference < XCommandEnvironment > const & xEnv,
282 FileViewFlags nFlags,
283 bool bOnlyFolder);
284
285 virtual ~SvtFileView_Impl();
286
287 void Clear();
288
290 std::u16string_view rFolder,
291 const FileViewAsyncAction* pAsyncDescriptor,
292 const css::uno::Sequence< OUString >& rDenyList );
293
295 const FolderDescriptor& _rFolder,
296 const FileViewAsyncAction* pAsyncDescriptor,
297 const css::uno::Sequence< OUString >& rDenyList );
298 void FilterFolderContent_Impl( std::u16string_view rFilter );
300
301 void OpenFolder_Impl();
302 static OUString ReplaceTabWithString(const OUString& rValue);
305
306 void EntryRemoved( std::u16string_view rURL );
307 void EntryRenamed( OUString& rURL,
308 const OUString& rName );
309 const SortingData_Impl& FolderInserted( const OUString& rURL,
310 const OUString& rTitle );
311
312 int GetEntryPos( std::u16string_view rURL );
313
314 void SetViewMode( FileViewMode eMode );
315
316 inline void EnableDelete( bool bEnable );
317
318 void Resort_Impl( sal_Int16 nColumn, bool bAscending );
319 bool SearchNextEntry( sal_uInt32 &nIndex,
320 std::u16string_view rTitle,
321 bool bWrapAround );
322
323 void SetSelectHandler( const Link<SvtFileView*,void>& rHdl );
325
326 void ResetCursor();
327
329 {
330 if (mxView->IsEditingActive())
331 mxView->end_editing();
332 }
333
334 void onTimeout();
335
337 {
338 if (mxView->get_visible())
339 mxView->grab_focus();
340 else
341 mxIconView->grab_focus();
342 }
343
344 bool has_focus() const
345 {
346 return mxView->has_focus() || mxIconView->has_focus();
347 }
348
349 int GetSortColumn() const
350 {
351 sal_uInt16 nOldSortID = mnSortColumn;
352 // skip "TYPE"
353 if (!mxView->TypeColumnVisible() && nOldSortID != COLUMN_TITLE)
354 --nOldSortID;
355 return nOldSortID - 1;
356 }
357
358protected:
359 DECL_LINK(ChangedHdl, weld::TreeView&, void);
360 DECL_LINK(SelectionChangedHdl, weld::IconView&, void);
361 DECL_LINK(RowActivatedHdl, weld::TreeView&, bool);
362 DECL_LINK(ItemActivatedHdl, weld::IconView&, bool);
363
364 // IEnumerationResultHandler overridables
365 virtual void enumerationDone( ::svt::EnumerationResult eResult ) override;
367};
368
369inline void SvtFileView_Impl::EnableDelete( bool bEnable )
370{
371 mxView->EnableDelete( bEnable );
372}
373
374namespace
375{
376 // functions -------------------------------------------------------------
377
378 OUString CreateExactSizeText( sal_Int64 nSize )
379 {
380 double fSize( static_cast<double>(nSize) );
381 int nDec;
382
383 tools::Long nMega = 1024 * 1024;
384 tools::Long nGiga = nMega * 1024;
385
386 OUString aUnitStr(' ');
387
388 if ( nSize < 10000 )
389 {
390 aUnitStr += SvtResId(STR_SVT_BYTES );
391 nDec = 0;
392 }
393 else if ( nSize < nMega )
394 {
395 fSize /= 1024;
396 aUnitStr += SvtResId(STR_SVT_KB);
397 nDec = 1;
398 }
399 else if ( nSize < nGiga )
400 {
401 fSize /= nMega;
402 aUnitStr += SvtResId(STR_SVT_MB);
403 nDec = 2;
404 }
405 else
406 {
407 fSize /= nGiga;
408 aUnitStr += SvtResId(STR_SVT_GB);
409 nDec = 3;
410 }
411
412 OUString aSizeStr =
413 ::rtl::math::doubleToUString( fSize,
414 rtl_math_StringFormat_F, nDec,
415 SvtSysLocale().GetLocaleData().getNumDecimalSep()[0]) +
416 aUnitStr;
417
418 return aSizeStr;
419 }
420}
421
422ViewTabListBox_Impl::ViewTabListBox_Impl(std::unique_ptr<weld::TreeView> xTreeView,
423 weld::Window* pTopLevel,
424 SvtFileView_Impl* pParent,
425 FileViewFlags nFlags)
426 : mxTreeView(std::move(xTreeView))
427 , mxScratchIter(mxTreeView->make_iterator())
428 , mpParent( pParent )
429 , mnSearchIndex( 0 )
430 , mbEnableDelete( false )
431 , mbEditing( false )
432 , mbShowType(nFlags & FileViewFlags::SHOW_TYPE)
433{
434 std::vector<int> aWidths { 180 };
435 if (nFlags & FileViewFlags::SHOW_TYPE)
436 aWidths.push_back(140);
437 aWidths.push_back(80);
438 mxTreeView->set_column_fixed_widths(aWidths);
439
440 if (nFlags & FileViewFlags::MULTISELECTION)
441 mxTreeView->set_selection_mode(SelectionMode::Multiple);
442
443 maResetQuickSearch.SetTimeout( QUICK_SEARCH_TIMEOUT );
444 maResetQuickSearch.SetInvokeHandler( LINK( this, ViewTabListBox_Impl, ResetQuickSearch_Impl ) );
445
446 Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
447 Reference< XInteractionHandler > xInteractionHandler(
448 InteractionHandler::createWithParent(xContext, pTopLevel->GetXWindow()), UNO_QUERY_THROW);
449
450 mxCmdEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() );
451
452 mxTreeView->connect_popup_menu(LINK(this, ViewTabListBox_Impl, CommandHdl));
453 mxTreeView->connect_key_press(LINK(this, ViewTabListBox_Impl, KeyInputHdl));
454}
455
456IMPL_LINK_NOARG(ViewTabListBox_Impl, EditingEntryHdl, const weld::TreeIter&, bool)
457{
458 return mbEditing;
459}
460
461IMPL_LINK_NOARG(ViewTabListBox_Impl, ResetQuickSearch_Impl, Timer *, void)
462{
463 ::osl::MutexGuard aGuard( maMutex );
464
465 maQuickSearchText.clear();
466 mnSearchIndex = 0;
467}
468
469IMPL_LINK(ViewTabListBox_Impl, KeyInputHdl, const KeyEvent&, rKEvt, bool)
470{
471 if (mbEditing)
472 return false;
473
474 bool bHandled = false;
475
476 const vcl::KeyCode& rKeyCode = rKEvt.GetKeyCode();
477 if ( 0 == rKeyCode.GetModifier() )
478 {
479 if ( ( rKeyCode.GetCode() == KEY_DELETE ) &&
480 mbEnableDelete )
481 {
482 ResetQuickSearch_Impl( nullptr );
483 DeleteEntries();
484 bHandled = true;
485 }
486 else if ( ( rKEvt.GetKeyCode().GetGroup() == KEYGROUP_NUM ) ||
487 ( rKEvt.GetKeyCode().GetGroup() == KEYGROUP_ALPHA ) )
488 {
489 DoQuickSearch( rKEvt.GetCharCode() );
490 bHandled = true;
491 }
492 }
493
494 if (!bHandled)
495 ResetQuickSearch_Impl( nullptr );
496 return bHandled;
497}
498
499IMPL_LINK(ViewTabListBox_Impl, CommandHdl, const CommandEvent&, rCEvt, bool)
500{
501 if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
502 return false;
503
504 bool bEnableDelete = mbEnableDelete;
505 bool bEnableRename = true;
506
507 int nCount = 0;
508 mxTreeView->selected_foreach([this, &nCount, &bEnableDelete, &bEnableRename](weld::TreeIter& rEntry){
509 ++nCount;
510
512 try
513 {
514 OUString aURL(weld::fromId<SvtContentEntry*>(
515 mxTreeView->get_id(rEntry))->maURL);
517 }
518 catch( Exception const & )
519 {
520 bEnableDelete = bEnableRename = false;
521 }
522
523 if ( bEnableDelete )
524 {
525 try
526 {
527 Reference< XCommandInfo > aCommands = aCnt.getCommands();
528 if ( aCommands.is() )
529 bEnableDelete = aCommands->hasCommandByName( "delete" );
530 else
531 bEnableDelete = false;
532 }
533 catch( Exception const & )
534 {
535 bEnableDelete = false;
536 }
537 }
538
539 if ( bEnableRename )
540 {
541 try
542 {
543 Reference< XPropertySetInfo > aProps = aCnt.getProperties();
544 if ( aProps.is() )
545 {
546 Property aProp = aProps->getPropertyByName("Title");
547 bEnableRename
548 = !( aProp.Attributes & PropertyAttribute::READONLY );
549 }
550 else
551 bEnableRename = false;
552 }
553 catch( Exception const & )
554 {
555 bEnableRename = false;
556 }
557 }
558
559 bool bStop = !bEnableDelete && !bEnableRename;
560 return bStop;
561 });
562
563 if (nCount == 0)
564 bEnableDelete = false;
565 if (nCount != 1)
566 bEnableRename = false;
567
568 if (bEnableDelete || bEnableRename)
569 {
570 std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(mxTreeView.get(), "svt/ui/fileviewmenu.ui"));
571 auto xContextMenu = xBuilder->weld_menu("menu");
572 xContextMenu->set_visible("delete", bEnableDelete);
573 xContextMenu->set_visible("rename", bEnableRename);
574 OUString sCommand(xContextMenu->popup_at_rect(mxTreeView.get(), tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1))));
575 ExecuteContextMenuAction(sCommand);
576 }
577
578 return true;
579}
580
581void ViewTabListBox_Impl::ExecuteContextMenuAction(std::u16string_view rSelectedPopupEntry)
582{
583 if (rSelectedPopupEntry == u"delete")
584 DeleteEntries();
585 else if (rSelectedPopupEntry == u"rename")
586 {
587 std::unique_ptr<weld::TreeIter> xEntry = mxTreeView->make_iterator();
588 if (mxTreeView->get_selected(xEntry.get()))
589 {
590 mbEditing = true;
591
592 mxTreeView->connect_editing(LINK(this, ViewTabListBox_Impl, EditingEntryHdl),
593 LINK(this, ViewTabListBox_Impl, EditedEntryHdl));
594
595 mxTreeView->start_editing(*xEntry);
596 }
597 }
598}
599
600void ViewTabListBox_Impl::DeleteEntries()
601{
602 short eResult = svtools::QUERYDELETE_YES;
603
604 mxTreeView->selected_foreach([this, &eResult](weld::TreeIter& rCurEntry){
605 OUString aURL;
606 if (!mxTreeView->get_id(rCurEntry).isEmpty())
607 aURL = weld::fromId<SvtContentEntry*>(mxTreeView->get_id(rCurEntry))->maURL;
608 if (aURL.isEmpty())
609 {
610 mxTreeView->unselect(rCurEntry);
611 return false;
612 }
613
614 bool canDelete = true;
615 try
616 {
617 ::ucbhelper::Content aCnt( aURL, mxCmdEnv, comphelper::getProcessComponentContext() );
618 Reference< XCommandInfo > aCommands = aCnt.getCommands();
619 if ( aCommands.is() )
620 canDelete = aCommands->hasCommandByName( "delete" );
621 else
622 canDelete = false;
623 }
624 catch( Exception const & )
625 {
626 canDelete = false;
627 }
628
629 if (!canDelete)
630 {
631 mxTreeView->unselect(rCurEntry);
632 return false; // process next entry
633 }
634
635 if ( eResult != svtools::QUERYDELETE_ALL )
636 {
637 INetURLObject aObj( aURL );
639 mxTreeView.get(), aObj.GetLastName(INetURLObject::DecodeMechanism::WithCharset));
640
641 if (mxTreeView->count_selected_rows() > 1)
642 aDlg.EnableAllButton();
643
644 eResult = aDlg.run();
645 }
646
647 bool bDeleted = false;
648
649 if (eResult == svtools::QUERYDELETE_ALL || eResult == svtools::QUERYDELETE_YES)
650 {
651 if ( Kill( aURL ) )
652 {
653 mpParent->EntryRemoved( aURL );
654 bDeleted = true;
655 }
656 }
657
658 if (!bDeleted)
659 mxTreeView->unselect(rCurEntry);
660
661 return false;
662 });
663
664 mxTreeView->remove_selection();
665}
666
667IMPL_LINK(ViewTabListBox_Impl, EditedEntryHdl, const IterString&, rIterString, bool)
668{
669 mbEditing = false;
670
672
673 const weld::TreeIter& rEntry = rIterString.first;
674 OUString sNewText = rIterString.second;
675
676 if (sNewText.isEmpty())
677 return false;
678
679 bool bRet = false;
680
681 OUString aURL;
682 SvtContentEntry* pData = weld::fromId<SvtContentEntry*>(mxTreeView->get_id(rEntry));
683
684 if ( pData )
685 aURL = pData->maURL;
686
687 if ( aURL.isEmpty() )
688 return bRet;
689
690 try
691 {
692 OUString aPropName( "Title" );
693 bool canRename = true;
695
696 try
697 {
698 Reference< XPropertySetInfo > aProps = aContent.getProperties();
699 if ( aProps.is() )
700 {
701 Property aProp = aProps->getPropertyByName( aPropName );
702 canRename = !( aProp.Attributes & PropertyAttribute::READONLY );
703 }
704 else
705 {
706 canRename = false;
707 }
708 }
709 catch ( Exception const & )
710 {
711 canRename = false;
712 }
713
714 if ( canRename )
715 {
716 Any aValue;
717 aValue <<= sNewText;
718 aContent.setPropertyValue( aPropName, aValue );
719 mpParent->EntryRenamed(aURL, sNewText);
720
721 if (pData)
722 pData->maURL = aURL;
723
724 mxTreeView->set_id(rEntry, weld::toId(pData));
725
726 bRet = true;
727 }
728 }
729 catch( Exception const & )
730 {
731 }
732
733 return bRet;
734}
735
736void ViewTabListBox_Impl::DoQuickSearch( sal_Unicode rChar )
737{
738 ::osl::MutexGuard aGuard( maMutex );
739
740 maResetQuickSearch.Stop();
741
742 OUString aLastText = maQuickSearchText;
743 sal_uInt32 aLastPos = mnSearchIndex;
744
745 maQuickSearchText += OUString(rChar).toAsciiLowerCase();
746
747 bool bFound = mpParent->SearchNextEntry( mnSearchIndex, maQuickSearchText, false );
748
749 if ( !bFound && ( aLastText.getLength() == 1 ) &&
750 ( aLastText == OUStringChar(rChar) ) )
751 {
752 mnSearchIndex = aLastPos + 1;
753 maQuickSearchText = aLastText;
754 bFound = mpParent->SearchNextEntry( mnSearchIndex, maQuickSearchText, true );
755 }
756
757 if (bFound)
758 {
759 mxTreeView->unselect_all();
760 mxTreeView->select(mnSearchIndex);
761 mxTreeView->set_cursor(mnSearchIndex);
762 mxTreeView->scroll_to_row(mnSearchIndex);
763 }
764
765 maResetQuickSearch.Start();
766}
767
768bool ViewTabListBox_Impl::Kill( const OUString& rContent )
769{
770 bool bRet = true;
771
772 try
773 {
775 aCnt.executeCommand( "delete", Any( true ) );
776 }
777 catch( css::ucb::CommandAbortedException const & )
778 {
779 SAL_INFO( "svtools.contnr", "CommandAbortedException" );
780 bRet = false;
781 }
782 catch( Exception const & )
783 {
784 SAL_INFO( "svtools.contnr", "Any other exception" );
785 bRet = false;
786 }
787
788 return bRet;
789}
790
792 std::unique_ptr<weld::TreeView> xTreeView,
793 std::unique_ptr<weld::IconView> xIconView,
794 bool bOnlyFolder, bool bMultiSelection, bool bShowType )
795{
796 FileViewFlags nFlags = FileViewFlags::NONE;
797 if ( bMultiSelection )
798 nFlags |= FileViewFlags::MULTISELECTION;
799 if ( bShowType )
800 nFlags |= FileViewFlags::SHOW_TYPE;
801
802 Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
803 Reference< XInteractionHandler > xInteractionHandler(
804 InteractionHandler::createWithParent(xContext, pTopLevel->GetXWindow()), UNO_QUERY_THROW);
805 Reference < XCommandEnvironment > xCmdEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() );
806
807 mpImpl.reset(new SvtFileView_Impl(this, pTopLevel, std::move(xTreeView), std::move(xIconView), xCmdEnv, nFlags, bOnlyFolder));
808
809 weld::TreeView* pView = mpImpl->mxView->getWidget();
810 pView->connect_column_clicked(LINK(this, SvtFileView, HeaderSelect_Impl));
811}
812
814{
815 mpImpl->grab_focus();
816}
817
819{
820 return mpImpl->has_focus();
821}
822
824{
825}
826
828{
829 mpImpl->SetViewMode( eMode );
830}
831
832OUString SvtFileView::GetURL(const weld::TreeIter& rEntry) const
833{
834 SvtContentEntry* pEntry;
835 if (mpImpl->mxView->get_visible())
836 pEntry = weld::fromId<SvtContentEntry*>(mpImpl->mxView->get_id(rEntry));
837 else
838 pEntry = weld::fromId<SvtContentEntry*>(mpImpl->mxIconView->get_id(rEntry));
839 if (pEntry)
840 return pEntry->maURL;
841 return OUString();
842}
843
845{
846 SvtContentEntry* pEntry = nullptr;
847 OUString aURL;
848 if (mpImpl->mxView->get_visible())
849 {
850 std::unique_ptr<weld::TreeIter> xEntry = mpImpl->mxView->make_iterator();
851 if (mpImpl->mxView->get_selected(xEntry.get()))
852 pEntry = weld::fromId<SvtContentEntry*>(mpImpl->mxView->get_id(*xEntry));
853 }
854 else
855 {
856 std::unique_ptr<weld::TreeIter> xEntry = mpImpl->mxIconView->make_iterator();
857 if (mpImpl->mxIconView->get_selected(xEntry.get()))
858 pEntry = weld::fromId<SvtContentEntry*>(mpImpl->mxIconView->get_id(*xEntry));
859 }
860 if (pEntry)
861 aURL = pEntry->maURL;
862 return aURL;
863}
864
865void SvtFileView::CreatedFolder( const OUString& rUrl, const OUString& rNewFolder )
866{
867 const SortingData_Impl& rEntry = mpImpl->FolderInserted( rUrl, rNewFolder );
868
869 mpImpl->maEntries.emplace_back(std::make_unique<SvtContentEntry>(rUrl, true));
870 OUString sId(weld::toId(mpImpl->maEntries.back().get()));
871
872 std::unique_ptr<weld::TreeIter> xEntry = mpImpl->mxView->make_iterator();
873 mpImpl->mxView->insert(rEntry.maDisplayName, sId, mpImpl->maFolderImage, *xEntry);
874 mpImpl->mxView->scroll_to_row(*xEntry);
875
876 std::unique_ptr<weld::TreeIter> xIconEntry = mpImpl->mxIconView->make_iterator();
877 mpImpl->mxIconView->insert(-1, &rEntry.maDisplayName, &sId, &mpImpl->maFolderImage, xIconEntry.get());
878 mpImpl->mxIconView->scroll_to_item(*xIconEntry);
879}
880
882{
883 FileViewResult eResult = eFailure;
884
885 OUString sParentURL;
886 if ( GetParentURL( sParentURL ) )
887 eResult = Initialize( sParentURL, mpImpl->maCurrentFilter, pAsyncDescriptor, maDenyList );
888
889 return eResult;
890}
891
892bool SvtFileView::GetParentURL( OUString& rParentURL ) const
893{
894 bool bRet = false;
895 try
896 {
898 Reference< XContent > xContent( aCnt.get() );
899 Reference< css::container::XChild > xChild( xContent, UNO_QUERY );
900 if ( xChild.is() )
901 {
902 Reference< XContent > xParent( xChild->getParent(), UNO_QUERY );
903 if ( xParent.is() )
904 {
905 rParentURL = xParent->getIdentifier()->getContentIdentifier();
906 bRet = !rParentURL.isEmpty() && rParentURL != mpImpl->maViewURL;
907 }
908 }
909 }
910 catch( Exception const & )
911 {
912 // perhaps an unknown url protocol (e.g. "private:newdoc")
913 }
914
915 return bRet;
916}
917
919{
920 return mpImpl->mxView->get_help_id();
921}
922
923void SvtFileView::set_help_id(const OUString& rHelpId)
924{
925 mpImpl->mxView->set_help_id(rHelpId);
926}
927
929{
930 if (mpImpl->mxView->get_visible())
931 return mpImpl->mxView->get_selected_text();
932 return mpImpl->mxIconView->get_selected_text();
933}
934
936 const OUString& rURL,
937 const OUString& rFilter,
938 const FileViewAsyncAction* pAsyncDescriptor,
939 const css::uno::Sequence< OUString >& rDenyList )
940{
941 weld::WaitObject aWaitCursor(mpImpl->m_pTopLevel);
942 maDenyList = rDenyList;
943
944 OUString sPushURL( mpImpl->maViewURL );
945
946 mpImpl->maViewURL = rURL;
947 FileViewResult eResult = ExecuteFilter( rFilter, pAsyncDescriptor );
948 switch ( eResult )
949 {
950 case eFailure:
951 case eTimeout:
952 mpImpl->maViewURL = sPushURL;
953 return eResult;
954
955 case eStillRunning:
956 OSL_ENSURE( pAsyncDescriptor, "SvtFileView::Initialize: we told it to read synchronously!" );
957 [[fallthrough]];
958 case eSuccess:
959 return eResult;
960 }
961
962 OSL_FAIL( "SvtFileView::Initialize: unreachable!" );
963 return eFailure;
964}
965
966FileViewResult SvtFileView::ExecuteFilter( const OUString& rFilter, const FileViewAsyncAction* pAsyncDescriptor )
967{
968 mpImpl->maCurrentFilter = rFilter.toAsciiLowerCase();
969
970 mpImpl->Clear();
971 FileViewResult eResult = mpImpl->GetFolderContent_Impl(mpImpl->maViewURL, pAsyncDescriptor, maDenyList);
972 OSL_ENSURE( ( eResult != eStillRunning ) || pAsyncDescriptor, "SvtFileView::ExecuteFilter: we told it to read synchronously!" );
973 return eResult;
974}
975
977{
978 mpImpl->CancelRunningAsyncAction();
979}
980
982{
983 mpImpl->mxView->unselect_all();
984 mpImpl->mxIconView->unselect_all();
985}
986
988{
989 mpImpl->SetSelectHandler(rHdl);
990}
991
993{
994 mpImpl->SetDoubleClickHandler(rHdl);
995}
996
998{
999 if (mpImpl->mxView->get_visible())
1000 return mpImpl->mxView->count_selected_rows();
1001 return mpImpl->mxIconView->count_selected_items();
1002}
1003
1005{
1006 if (mpImpl->mxView->get_visible())
1007 {
1008 SvtContentEntry* pRet = nullptr;
1009 std::unique_ptr<weld::TreeIter> xEntry = mpImpl->mxView->make_iterator();
1010 if (mpImpl->mxView->get_selected(xEntry.get()))
1011 pRet = weld::fromId<SvtContentEntry*>(mpImpl->mxView->get_id(*xEntry));
1012 return pRet;
1013 }
1014
1015 SvtContentEntry* pRet = nullptr;
1016 std::unique_ptr<weld::TreeIter> xEntry = mpImpl->mxIconView->make_iterator();
1017 if (mpImpl->mxIconView->get_selected(xEntry.get()))
1018 pRet = weld::fromId<SvtContentEntry*>(mpImpl->mxIconView->get_id(*xEntry));
1019 return pRet;
1020}
1021
1022const OUString& SvtFileView::GetViewURL() const
1023{
1024 return mpImpl->maViewURL;
1025}
1026
1028{
1029 mpImpl->maOpenDoneLink = rHdl;
1030}
1031
1032void SvtFileView::EnableDelete( bool bEnable )
1033{
1034 mpImpl->EnableDelete( bEnable );
1035}
1036
1038{
1039 return mpImpl->EndEditing();
1040}
1041
1042IMPL_LINK(SvtFileView, HeaderSelect_Impl, int, nColumn, void)
1043{
1044 sal_uInt16 nItemID = nColumn + 1;
1045 // skip "TYPE"
1046 if (!mpImpl->mxView->TypeColumnVisible() && nItemID != COLUMN_TITLE)
1047 ++nItemID;
1048
1049 weld::TreeView* pView = mpImpl->mxView->getWidget();
1050 bool bSortAtoZ = mpImpl->mbAscending;
1051
1052 //set new arrow positions in headerbar
1053 if (nItemID != mpImpl->mnSortColumn)
1054 {
1055 // remove old indicator, new will be created in OpenFolder_Impl
1056 pView->set_sort_indicator(TRISTATE_INDET, mpImpl->GetSortColumn());
1057 }
1058 else
1059 bSortAtoZ = !bSortAtoZ;
1060
1061 mpImpl->Resort_Impl(nItemID, bSortAtoZ);
1062}
1063
1065{
1066 // sort order
1067 OUString sRet = OUString::number( mpImpl->mnSortColumn ) + ";";
1068
1069 bool bUp = mpImpl->mbAscending;
1070 sRet += OUString::Concat(bUp ? std::u16string_view(u"1") : std::u16string_view(u"0")) + ";";
1071
1072 weld::TreeView* pView = mpImpl->mxView->getWidget();
1073 sal_uInt16 nCount = mpImpl->mxView->TypeColumnVisible() ? 4 : 3;
1074 for (sal_uInt16 i = 0; i < nCount; ++i)
1075 {
1076 sal_uInt16 nId = i + 1;
1077 // skip "TYPE"
1078 if (!mpImpl->mxView->TypeColumnVisible() && nId != COLUMN_TITLE)
1079 ++nId;
1080
1081 sRet += OUString::number( nId )
1082 + ";"
1083 + OUString::number(pView->get_column_width(i))
1084 + ";";
1085 }
1086
1087 return comphelper::string::stripEnd(sRet, ';');
1088}
1089
1090::std::vector< SvtContentEntry > SvtFileView::GetContent()
1091{
1092 ::std::vector< SvtContentEntry > aContent;
1093
1094 for(auto const& elem : mpImpl->maContent)
1095 {
1096 SvtContentEntry aEntry( elem->maTargetURL, elem->mbIsFolder );
1097 aContent.push_back( aEntry );
1098 }
1099
1100 return aContent;
1101}
1102
1103void SvtFileView::SetConfigString(std::u16string_view rCfgStr)
1104{
1105 sal_Int32 nIdx = 0;
1106 sal_uInt16 nSortColumn = static_cast<sal_uInt16>(o3tl::toInt32(o3tl::getToken(rCfgStr, 0, ';', nIdx )));
1107 bool bAscending = static_cast<bool>(static_cast<sal_uInt16>(o3tl::toInt32(o3tl::getToken(rCfgStr, 0, ';', nIdx ))));
1108
1109 std::vector<int> aWidths(mpImpl->mxView->TypeColumnVisible() ? 4 : 3, -1);
1110
1111 while ( nIdx != -1 )
1112 {
1113 sal_uInt16 nItemId = static_cast<sal_uInt16>(o3tl::toInt32(o3tl::getToken(rCfgStr, 0, ';', nIdx )));
1114
1115 int nWidth = o3tl::toInt32(o3tl::getToken(rCfgStr, 0, ';', nIdx ));
1116
1117 // skip "TYPE"
1118 if (!mpImpl->mxView->TypeColumnVisible() && nItemId != COLUMN_TITLE)
1119 --nItemId;
1120 int nColumn = nItemId - 1;
1121
1122 if (nColumn >= 0 && o3tl::make_unsigned(nColumn) < aWidths.size())
1123 aWidths[nColumn] = nWidth;
1124 }
1125
1126 weld::TreeView* pView = mpImpl->mxView->getWidget();
1127 pView->set_column_fixed_widths(aWidths);
1128 if (mpImpl->mnSortColumn != nSortColumn)
1129 pView->set_sort_indicator(TRISTATE_INDET, mpImpl->GetSortColumn());
1130 mpImpl->Resort_Impl(nSortColumn, bAscending);
1131}
1132
1134 std::unique_ptr<weld::TreeView> xTreeView,
1135 std::unique_ptr<weld::IconView> xIconView,
1136 Reference < XCommandEnvironment > const & xEnv,
1137 FileViewFlags nFlags, bool bOnlyFolder)
1138 : m_pAntiImpl ( pAntiImpl )
1139 , m_eAsyncActionResult ( ::svt::EnumerationResult::ERROR )
1140 , m_bRunningAsyncAction ( false )
1141 , m_bAsyncActionCancelled ( false )
1142 , m_pTopLevel ( pTopLevel )
1143 , mxView(new ViewTabListBox_Impl(std::move(xTreeView), pTopLevel, this, nFlags))
1144 , mxIconView(std::move(xIconView))
1145 , mnSortColumn ( COLUMN_TITLE )
1146 , mbAscending ( true )
1147 , mbOnlyFolder ( bOnlyFolder )
1148 , mnSuspendSelectCallback ( 0 )
1149 , mbIsFirstResort ( true )
1150 , aIntlWrapper ( Application::GetSettings().GetLanguageTag() )
1151 , maFolderImage (RID_BMP_FOLDER)
1152 , mxCmdEnv ( xEnv )
1153{
1154 weld::TreeView* pWidget = mxView->getWidget();
1155
1156 // set the width to something small so it's the parent that decides the final
1157 // width
1158 Size aSize(42, pWidget->get_height_rows(7));
1159 pWidget->set_size_request(aSize.Width(), aSize.Height());
1160 mxIconView->set_size_request(aSize.Width(), aSize.Height());
1161}
1162
1164{
1165 Clear();
1166}
1167
1169{
1170 ::osl::MutexGuard aGuard( maMutex );
1171
1172 maContent.clear();
1173}
1174
1176 std::u16string_view rFolder,
1177 const FileViewAsyncAction* pAsyncDescriptor,
1178 const css::uno::Sequence< OUString >& rDenyList )
1179{
1180 ::osl::ClearableMutexGuard aGuard( maMutex );
1181 INetURLObject aFolderObj( rFolder );
1182 DBG_ASSERT( aFolderObj.GetProtocol() != INetProtocol::NotValid, "Invalid URL!" );
1183
1184 FolderDescriptor aFolder( aFolderObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
1185
1186 aGuard.clear();
1187 return GetFolderContent_Impl( aFolder, pAsyncDescriptor, rDenyList );
1188}
1189
1191 const FolderDescriptor& _rFolder,
1192 const FileViewAsyncAction* pAsyncDescriptor,
1193 const css::uno::Sequence< OUString >& rDenyList )
1194{
1196 ::osl::ClearableMutexGuard aGuard( maMutex );
1197
1198 OSL_ENSURE( !m_xContentEnumerator.is(), "SvtFileView_Impl::GetFolderContent_Impl: still running another enumeration!" );
1199 m_xContentEnumerator.set(new ::svt::FileViewContentEnumerator(
1200 mxView->GetCommandEnvironment(), maContent, maMutex));
1201 // TODO: should we cache and re-use this thread?
1202
1203 if ( !pAsyncDescriptor )
1204 {
1205 ::svt::EnumerationResult eResult = m_xContentEnumerator->enumerateFolderContentSync( _rFolder, rDenyList );
1206 if ( ::svt::EnumerationResult::SUCCESS == eResult )
1207 {
1209 m_xContentEnumerator.clear();
1210 return eSuccess;
1211 }
1212 m_xContentEnumerator.clear();
1213 return eFailure;
1214 }
1215
1216 m_bRunningAsyncAction = true;
1219 m_aAsyncActionFinished.reset();
1220
1221 // don't (yet) set m_aCurrentAsyncActionHandler to pTimeout->aFinishHandler.
1222 // By definition, this handler *only* gets called when the result cannot be obtained
1223 // during the minimum wait time, so it is only set below, when needed.
1225
1226 // minimum time to wait
1227 TimeValue aTimeout;
1228 sal_Int32 nMinTimeout = pAsyncDescriptor->nMinTimeout;
1229 OSL_ENSURE( nMinTimeout > 0, "SvtFileView_Impl::GetFolderContent_Impl: invalid minimum timeout!" );
1230 if ( nMinTimeout <= 0 )
1231 nMinTimeout = sal_Int32( 1000 );
1232 aTimeout.Seconds = nMinTimeout / 1000;
1233 aTimeout.Nanosec = ( nMinTimeout % 1000 ) * 1000000;
1234
1235 m_xContentEnumerator->enumerateFolderContent( _rFolder, this );
1236
1237 // wait until the enumeration is finished
1238 // for this, release our own mutex (which is used by the enumerator thread)
1239 aGuard.clear();
1240
1241 ::osl::Condition::Result eResult = ::osl::Condition::result_ok;
1242 {
1243 // also release the SolarMutex. Not all code which is needed during the enumeration
1244 // is Solar-Thread-Safe, in particular there is some code which needs to access
1245 // string resources (and our resource system relies on the SolarMutex :()
1246 SolarMutexReleaser aSolarRelease;
1247
1248 // now wait. Note that if we didn't get a pAsyncDescriptor, then this is an infinite wait.
1249 eResult = m_aAsyncActionFinished.wait( &aTimeout );
1250 }
1251
1252 ::osl::MutexGuard aGuard2( maMutex );
1253 if ( ::osl::Condition::result_timeout == eResult )
1254 {
1255 // maximum time to wait
1256 OSL_ENSURE(!m_xCancelAsyncTimer,
1257 "SvtFileView_Impl::GetFolderContent_Impl: there's still a previous timer!");
1258 m_xCancelAsyncTimer.set(new CallbackTimer(this));
1259 sal_Int32 nMaxTimeout = pAsyncDescriptor->nMaxTimeout;
1260 OSL_ENSURE( nMaxTimeout > nMinTimeout,
1261 "SvtFileView_Impl::GetFolderContent_Impl: invalid maximum timeout!" );
1262 if ( nMaxTimeout <= nMinTimeout )
1263 nMaxTimeout = nMinTimeout + 5000;
1264 m_xCancelAsyncTimer->setRemainingTime( salhelper::TTimeValue( nMaxTimeout - nMinTimeout ) );
1265 // we already waited for nMinTimeout milliseconds, so take this into account
1266 m_xCancelAsyncTimer->start();
1267
1268 m_aCurrentAsyncActionHandler = pAsyncDescriptor->aFinishHandler;
1269 DBG_ASSERT( m_aCurrentAsyncActionHandler.IsSet(), "SvtFileView_Impl::GetFolderContent_Impl: nobody interested when it's finished?" );
1270 maEntries.clear();
1271 mxView->clear();
1272 mxIconView->clear();
1273 return eStillRunning;
1274 }
1275
1276 m_bRunningAsyncAction = false;
1277 switch ( m_eAsyncActionResult )
1278 {
1279 case ::svt::EnumerationResult::SUCCESS:
1280 return eSuccess;
1281
1282 case ::svt::EnumerationResult::ERROR:
1283 return eFailure;
1284 }
1285
1286 SAL_WARN( "svtools.contnr", "SvtFileView_Impl::GetFolderContent_Impl: unreachable!" );
1287 return eFailure;
1288}
1289
1290void SvtFileView_Impl::FilterFolderContent_Impl( std::u16string_view rFilter )
1291{
1292 if ( rFilter.empty() || ( rFilter == ALL_FILES_FILTER ) )
1293 // when replacing names, there is always something to filter (no view of ".nametranslation.table")
1294 return;
1295
1296 ::osl::MutexGuard aGuard( maMutex );
1297
1298 if ( maContent.empty() )
1299 return;
1300
1301 // collect the filter tokens
1302 ::std::vector< WildCard > aFilters;
1303 FilterMatch::createWildCardFilterList(rFilter,aFilters);
1304
1305
1306 // do the filtering
1307 maContent.erase(std::remove_if(maContent.begin(), maContent.end(),
1308 [&aFilters](const std::unique_ptr<SortingData_Impl>& rxContent) {
1309 if (rxContent->mbIsFolder)
1310 return false;
1311 // normalize the content title (we always match case-insensitive)
1312 // 91872 - 11.09.2001 - frank.schoenheit@sun.com
1313 OUString sCompareString = rxContent->GetFileName(); // filter works on file name, not on title!
1314 return std::none_of(aFilters.begin(), aFilters.end(), FilterMatch(sCompareString));
1315 }),
1316 maContent.end());
1317}
1318
1320{
1321 if (!mnSuspendSelectCallback)
1322 m_aSelectHandler.Call(m_pAntiImpl);
1323}
1324
1326{
1327 if (!mnSuspendSelectCallback)
1328 m_aSelectHandler.Call(m_pAntiImpl);
1329}
1330
1332{
1333 m_aSelectHandler = rHdl;
1334
1335 mxView->connect_changed(LINK(this, SvtFileView_Impl, ChangedHdl));
1336 mxIconView->connect_selection_changed(LINK(this, SvtFileView_Impl, SelectionChangedHdl));
1337}
1338
1340{
1341 return maDoubleClickHandler.Call(m_pAntiImpl);
1342}
1343
1345{
1346 return maDoubleClickHandler.Call(m_pAntiImpl);
1347}
1348
1350{
1351 maDoubleClickHandler = rHdl;
1352
1353 mxView->connect_row_activated(LINK(this, SvtFileView_Impl, RowActivatedHdl));
1354 mxIconView->connect_item_activated(LINK(this, SvtFileView_Impl, ItemActivatedHdl));
1355}
1356
1358{
1359 ::osl::MutexGuard aGuard( maMutex );
1360
1361 mxView->freeze();
1362 mxIconView->freeze();
1363 maEntries.clear();
1364 mxView->clear();
1365 mxIconView->clear();
1366
1367 for (auto const& elem : maContent)
1368 {
1369 if (mbOnlyFolder && !elem->mbIsFolder)
1370 continue;
1371
1372 // insert entry and set user data
1373 maEntries.emplace_back(std::make_unique<SvtContentEntry>(elem->maTargetURL, elem->mbIsFolder));
1374 OUString sId(weld::toId(maEntries.back().get()));
1375 mxView->append(sId, elem->maDisplayName, elem->maType, elem->maDisplaySize, elem->maDisplayDate, elem->maImage);
1376 mxIconView->append(sId, elem->maDisplayName, elem->maImage);
1377 }
1378
1380 mxView->thaw();
1381
1382 //set sort indicator
1383 weld::TreeView* pView = mxView->getWidget();
1385
1386 mxIconView->thaw();
1388
1389 ResetCursor();
1390}
1391
1393{
1394 if (mxView->get_visible())
1395 {
1396 std::unique_ptr<weld::TreeIter> xFirst = mxView->make_iterator();
1397 if (mxView->get_iter_first(*xFirst))
1398 {
1399 // set cursor to the first entry
1400 mxView->set_cursor(*xFirst);
1401 }
1402 // deselect
1403 mxView->unselect_all();
1404 }
1405 else
1406 {
1407 std::unique_ptr<weld::TreeIter> xFirst = mxIconView->make_iterator();
1408 if (mxIconView->get_iter_first(*xFirst))
1409 {
1410 // set cursor to the first entry
1411 mxIconView->set_cursor(*xFirst);
1412 }
1413 // deselect
1414 mxIconView->unselect_all();
1415 }
1416}
1417
1419{
1421 ::osl::MutexGuard aGuard( maMutex );
1422 if ( !m_xContentEnumerator.is() )
1423 return;
1424
1426 m_xContentEnumerator->cancel();
1427 m_bRunningAsyncAction = false;
1428
1429 m_xContentEnumerator.clear();
1430 if ( m_xCancelAsyncTimer.is() && m_xCancelAsyncTimer->isTicking() )
1431 m_xCancelAsyncTimer->stop();
1432 m_xCancelAsyncTimer.clear();
1433}
1434
1435
1437{
1438 SolarMutexGuard aSolarGuard;
1439 ::osl::MutexGuard aGuard( maMutex );
1440 if ( !m_bRunningAsyncAction )
1441 // there might have been a race condition while we waited for the mutex
1442 return;
1443
1445
1447 {
1448 Application::PostUserEvent( m_aCurrentAsyncActionHandler, reinterpret_cast< void* >( eTimeout ) );
1450 }
1451}
1452
1453
1455{
1456 SolarMutexGuard aSolarGuard;
1457 ::osl::MutexGuard aGuard( maMutex );
1458
1459 m_xContentEnumerator.clear();
1460 if ( m_xCancelAsyncTimer.is() && m_xCancelAsyncTimer->isTicking() )
1461 m_xCancelAsyncTimer->stop();
1462 m_xCancelAsyncTimer.clear();
1463
1465 // this is to prevent race conditions
1466 return;
1467
1468 m_eAsyncActionResult = eResult;
1469 m_bRunningAsyncAction = false;
1470
1472
1473 if ( svt::EnumerationResult::SUCCESS == eResult )
1475
1477 {
1480 }
1481}
1482
1483
1485{
1491}
1492
1493OUString SvtFileView_Impl::ReplaceTabWithString(const OUString& rValue)
1494{
1495 return rValue.replaceAll(u"\t", u"%09");
1496}
1497
1499{
1500 ::osl::MutexGuard aGuard( maMutex );
1501
1502 for (auto const& elem : maContent)
1503 {
1504 // title, type, size, date
1505 elem->maDisplayName = ReplaceTabWithString(elem->GetTitle());
1506 // folders don't have a size
1507 if ( ! elem->mbIsFolder )
1508 elem->maDisplaySize = CreateExactSizeText( elem->maSize );
1509 // set the date, but volumes have no date
1510 if ( ! elem->mbIsFolder || ! elem->mbIsVolume )
1511 {
1512 SvtSysLocale aSysLocale;
1513 const LocaleDataWrapper& rLocaleData = aSysLocale.GetLocaleData();
1514 elem->maDisplayDate = rLocaleData.getDate( elem->maModDate )
1515 + ", "
1516 + rLocaleData.getTime( elem->maModDate, false );
1517 }
1518
1519 // detect image
1520 if ( elem->mbIsFolder )
1521 {
1522 ::svtools::VolumeInfo aVolInfo( elem->mbIsVolume, elem->mbIsRemote,
1523 elem->mbIsRemoveable, elem->mbIsFloppy,
1524 elem->mbIsCompactDisc );
1525 elem->maImage = SvFileInformationManager::GetFolderImageId(aVolInfo);
1526 }
1527 else
1528 elem->maImage = SvFileInformationManager::GetFileImageId(INetURLObject(elem->maTargetURL));
1529 }
1530}
1531
1532void SvtFileView_Impl::Resort_Impl( sal_Int16 nColumn, bool bAscending )
1533{
1534 // TODO: IconView ()
1535 ::osl::MutexGuard aGuard( maMutex );
1536
1537 if ( ( nColumn == mnSortColumn ) &&
1538 ( bAscending == mbAscending ) )
1539 return;
1540
1541 // reset the quick search index
1542 mxView->ResetQuickSearch_Impl( nullptr );
1543
1544 std::unique_ptr<weld::TreeIter> xEntry(mxView->make_iterator());
1545 bool bEntry = mxView->get_cursor(xEntry.get());
1546
1547 OUString aEntryURL;
1548 if (bEntry && !mxView->get_id(*xEntry).isEmpty())
1549 aEntryURL = weld::fromId<SvtContentEntry*>(mxView->get_id(*xEntry))->maURL;
1550
1551 mnSortColumn = nColumn;
1552 mbAscending = bAscending;
1553
1556
1557 if ( !mbIsFirstResort )
1558 {
1559 int nPos = GetEntryPos( aEntryURL );
1560 if (nPos != -1 && nPos < mxView->n_children())
1561 {
1562 ++mnSuspendSelectCallback; // #i15668#
1563 mxView->set_cursor(nPos);
1565 }
1566 }
1567 else
1568 mbIsFirstResort = false;
1569}
1570
1571static bool gbAscending = true;
1572static sal_Int16 gnColumn = COLUMN_TITLE;
1573static const CollatorWrapper* pCollatorWrapper = nullptr;
1574
1575/* this function returns true, if aOne is less than aTwo
1576*/
1577static bool CompareSortingData_Impl( std::unique_ptr<SortingData_Impl> const & aOne, std::unique_ptr<SortingData_Impl> const & aTwo )
1578{
1579 DBG_ASSERT( pCollatorWrapper, "*CompareSortingData_Impl(): Can't work this way!" );
1580
1581 sal_Int32 nComp;
1582 bool bRet = false;
1583 bool bEqual = false;
1584
1585 if ( aOne->mbIsFolder != aTwo->mbIsFolder )
1586 {
1587 bRet = aOne->mbIsFolder;
1588
1589 // !!! pb: #100376# folder always on top
1590 if ( !gbAscending )
1591 bRet = !bRet;
1592 }
1593 else
1594 {
1595 switch ( gnColumn )
1596 {
1597 case COLUMN_TITLE:
1598 // compare case insensitive first
1599 nComp = pCollatorWrapper->compareString( aOne->GetLowerTitle(), aTwo->GetLowerTitle() );
1600
1601 if ( nComp == 0 )
1602 nComp = pCollatorWrapper->compareString( aOne->GetTitle(), aTwo->GetTitle() );
1603
1604 if ( nComp < 0 )
1605 bRet = true;
1606 else if ( nComp > 0 )
1607 bRet = false;
1608 else
1609 bEqual = true;
1610 break;
1611 case COLUMN_TYPE:
1612 nComp = pCollatorWrapper->compareString( aOne->maType, aTwo->maType );
1613 if ( nComp < 0 )
1614 bRet = true;
1615 else if ( nComp > 0 )
1616 bRet = false;
1617 else
1618 bEqual = true;
1619 break;
1620 case COLUMN_SIZE:
1621 if ( aOne->maSize < aTwo->maSize )
1622 bRet = true;
1623 else if ( aOne->maSize > aTwo->maSize )
1624 bRet = false;
1625 else
1626 bEqual = true;
1627 break;
1628 case COLUMN_DATE:
1629 if ( aOne->maModDate < aTwo->maModDate )
1630 bRet = true;
1631 else if ( aOne->maModDate > aTwo->maModDate )
1632 bRet = false;
1633 else
1634 bEqual = true;
1635 break;
1636 default:
1637 SAL_INFO( "svtools.contnr", "CompareSortingData_Impl: Compare unknown type!" );
1638 bRet = false;
1639 }
1640 }
1641
1642 // when the two elements are equal, we must not return sal_True (which would
1643 // happen if we just return ! ( a < b ) when not sorting ascending )
1644 if ( bEqual )
1645 return false;
1646
1647 return gbAscending ? bRet : !bRet;
1648}
1649
1650
1652{
1653 ::osl::MutexGuard aGuard( maMutex );
1654
1655 if ( maContent.size() > 1 )
1656 {
1660
1661 std::stable_sort( maContent.begin(), maContent.end(), CompareSortingData_Impl );
1662
1663 pCollatorWrapper = nullptr;
1664 }
1665}
1666
1667
1668void SvtFileView_Impl::EntryRemoved( std::u16string_view rURL )
1669{
1670 ::osl::MutexGuard aGuard( maMutex );
1671
1672 maContent.erase(std::find_if(maContent.begin(), maContent.end(),
1673 [&](const std::unique_ptr<SortingData_Impl> & data) { return data->maTargetURL == rURL; }));
1674}
1675
1676
1678 const OUString& rTitle )
1679{
1680 ::osl::MutexGuard aGuard( maMutex );
1681
1682 auto aFoundElem = std::find_if(maContent.begin(), maContent.end(),
1683 [&](const std::unique_ptr<SortingData_Impl> & data) { return data->maTargetURL == rURL; });
1684 if (aFoundElem != maContent.end())
1685 {
1686 (*aFoundElem)->SetNewTitle( rTitle );
1687 (*aFoundElem)->maDisplayName = ReplaceTabWithString(rTitle);
1688
1689 INetURLObject aURLObj( rURL );
1691
1693
1694 (*aFoundElem)->maTargetURL = rURL;
1695 }
1696}
1697
1698const SortingData_Impl& SvtFileView_Impl::FolderInserted( const OUString& rURL, const OUString& rTitle )
1699{
1700 ::osl::MutexGuard aGuard( maMutex );
1701
1702 std::unique_ptr<SortingData_Impl> pData(new SortingData_Impl);
1703
1704 pData->SetNewTitle( rTitle );
1705 pData->maSize = 0;
1706 pData->mbIsFolder = true;
1707 pData->maTargetURL = rURL;
1708
1709 ::svtools::VolumeInfo aVolInfo;
1712
1713 // title, type, size, date
1714 pData->maDisplayName = ReplaceTabWithString(pData->GetTitle());
1715 // set the date
1716 SvtSysLocale aSysLocale;
1717 const LocaleDataWrapper& rLocaleData = aSysLocale.GetLocaleData();
1718 pData->maDisplayDate = rLocaleData.getDate( pData->maModDate )
1719 + ", "
1720 + rLocaleData.getTime( pData->maModDate );
1721
1722 maContent.push_back( std::move(pData) );
1723
1724 return *maContent.back();
1725}
1726
1727int SvtFileView_Impl::GetEntryPos(std::u16string_view rURL)
1728{
1729 ::osl::MutexGuard aGuard( maMutex );
1730
1731 auto aFoundElem = std::find_if(maContent.begin(), maContent.end(),
1732 [&](const std::unique_ptr<SortingData_Impl> & data) { return data->maTargetURL == rURL; });
1733 return aFoundElem != maContent.end() ? std::distance(maContent.begin(), aFoundElem) : -1;
1734}
1735
1737{
1738 switch ( eMode )
1739 {
1740 case eDetailedList:
1741 mxView->show();
1742 mxIconView->hide();
1743 break;
1744
1745 case eIcon:
1746 mxView->hide();
1747 mxIconView->show();
1748 break;
1749
1750 default:
1751 mxView->show();
1752 mxIconView->hide();
1753 };
1754}
1755
1756bool SvtFileView_Impl::SearchNextEntry( sal_uInt32& nIndex, std::u16string_view rTitle, bool bWrapAround )
1757{
1758 ::osl::MutexGuard aGuard( maMutex );
1759
1760 sal_uInt32 nEnd = maContent.size();
1761 sal_uInt32 nStart = nIndex;
1762 while ( nIndex < nEnd )
1763 {
1764 SortingData_Impl* pData = maContent[ nIndex ].get();
1765 if ( pData->GetLowerTitle().startsWith( rTitle ) )
1766 return true;
1767 ++nIndex;
1768 }
1769
1770 if ( bWrapAround )
1771 {
1772 nIndex = 0;
1773 while ( nIndex < nEnd && nIndex <= nStart )
1774 {
1775 SortingData_Impl* pData = maContent[ nIndex ].get();
1776 if ( pData->GetLowerTitle().startsWith( rTitle ) )
1777 return true;
1778 ++nIndex;
1779 }
1780 }
1781
1782 return false;
1783}
1784
1785namespace {
1786 void SAL_CALL CallbackTimer::onShot()
1787 {
1788 OSL_ENSURE( m_pTimeoutHandler, "CallbackTimer::onShot: nobody interested in?" );
1789 SvtFileView_Impl* pHandler( m_pTimeoutHandler );
1790 if ( pHandler )
1791 pHandler->onTimeout();
1792 }
1793}
1794
1795void SvtFileView::selected_foreach(const std::function<bool(weld::TreeIter&)>& func)
1796{
1797 if (mpImpl->mxView->get_visible())
1798 mpImpl->mxView->selected_foreach(func);
1799 else
1800 mpImpl->mxIconView->selected_foreach(func);
1801}
1802
1804{
1805 return mpImpl->mxView->getWidget();
1806}
1807
1808/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::mutex maMutex
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
static std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
sal_Int32 compareString(const OUString &s1, const OUString &s2) const
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
bool setName(std::u16string_view rTheName, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
INetProtocol GetProtocol() const
const CollatorWrapper * getCaseCollator() const
OUString getDate(const Date &rDate) const
OUString getTime(const tools::Time &rTime, bool bSec=true, bool b100Sec=false) const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
static SVT_DLLPUBLIC OUString GetFolderDescription(const svtools::VolumeInfo &rInfo)
static SVT_DLLPUBLIC OUString GetFolderImageId(const svtools::VolumeInfo &rInfo)
static SVT_DLLPUBLIC OUString GetFileImageId(const INetURLObject &rURL)
OUString maCurrentFilter
Definition: fileview.cxx:271
Link< SvtFileView *, bool > maDoubleClickHandler
Definition: fileview.cxx:274
::rtl::Reference< ::svt::FileViewContentEnumerator > m_xContentEnumerator
Definition: fileview.cxx:245
::std::vector< std::unique_ptr< SortingData_Impl > > maContent
Definition: fileview.cxx:255
bool m_bRunningAsyncAction
Definition: fileview.cxx:250
DECL_LINK(ChangedHdl, weld::TreeView &, void)
void EntryRenamed(OUString &rURL, const OUString &rName)
Definition: fileview.cxx:1677
virtual void enumerationDone(::svt::EnumerationResult eResult) override
Definition: fileview.cxx:1454
SvtFileView * m_pAntiImpl
Definition: fileview.cxx:241
::svt::EnumerationResult m_eAsyncActionResult
Definition: fileview.cxx:249
DECL_LINK(RowActivatedHdl, weld::TreeView &, bool)
bool const mbOnlyFolder
Definition: fileview.cxx:264
sal_uInt16 mnSortColumn
Definition: fileview.cxx:262
Link< void *, void > m_aCurrentAsyncActionHandler
Definition: fileview.cxx:246
Link< SvtFileView *, void > maOpenDoneLink
Definition: fileview.cxx:273
std::unique_ptr< ViewTabListBox_Impl > mxView
Definition: fileview.cxx:260
const SortingData_Impl & FolderInserted(const OUString &rURL, const OUString &rTitle)
Definition: fileview.cxx:1698
bool SearchNextEntry(sal_uInt32 &nIndex, std::u16string_view rTitle, bool bWrapAround)
Definition: fileview.cxx:1756
void SetViewMode(FileViewMode eMode)
Definition: fileview.cxx:1736
::osl::Condition m_aAsyncActionFinished
Definition: fileview.cxx:247
void FilterFolderContent_Impl(std::u16string_view rFilter)
Definition: fileview.cxx:1290
void implEnumerationSuccess()
Definition: fileview.cxx:1484
void OpenFolder_Impl()
Definition: fileview.cxx:1357
weld::Window * m_pTopLevel
Definition: fileview.cxx:259
sal_Int16 mnSuspendSelectCallback
Definition: fileview.cxx:265
FileViewResult GetFolderContent_Impl(std::u16string_view rFolder, const FileViewAsyncAction *pAsyncDescriptor, const css::uno::Sequence< OUString > &rDenyList)
Definition: fileview.cxx:1175
OUString maFolderImage
Definition: fileview.cxx:272
std::unique_ptr< weld::IconView > mxIconView
Definition: fileview.cxx:261
::rtl::Reference< ::salhelper::Timer > m_xCancelAsyncTimer
Definition: fileview.cxx:248
virtual ~SvtFileView_Impl()
Definition: fileview.cxx:1163
int GetEntryPos(std::u16string_view rURL)
Definition: fileview.cxx:1727
void Resort_Impl(sal_Int16 nColumn, bool bAscending)
Definition: fileview.cxx:1532
void SetSelectHandler(const Link< SvtFileView *, void > &rHdl)
Definition: fileview.cxx:1331
Reference< XCommandEnvironment > mxCmdEnv
Definition: fileview.cxx:276
SvtFileView_Impl(SvtFileView *pAntiImpl, weld::Window *pTopLevel, std::unique_ptr< weld::TreeView > xTreeView, std::unique_ptr< weld::IconView > xIconView, Reference< XCommandEnvironment > const &xEnv, FileViewFlags nFlags, bool bOnlyFolder)
Definition: fileview.cxx:1133
void CancelRunningAsyncAction()
Definition: fileview.cxx:1418
::std::vector< std::unique_ptr< SvtContentEntry > > maEntries
Definition: fileview.cxx:256
void SortFolderContent_Impl()
Definition: fileview.cxx:1651
Link< SvtFileView *, void > m_aSelectHandler
Definition: fileview.cxx:242
bool has_focus() const
Definition: fileview.cxx:344
bool m_bAsyncActionCancelled
Definition: fileview.cxx:251
void CreateDisplayText_Impl()
Definition: fileview.cxx:1498
static OUString ReplaceTabWithString(const OUString &rValue)
Definition: fileview.cxx:1493
::osl::Mutex maMutex
Definition: fileview.cxx:257
void EnableDelete(bool bEnable)
Definition: fileview.cxx:369
IntlWrapper const aIntlWrapper
Definition: fileview.cxx:268
DECL_LINK(ItemActivatedHdl, weld::IconView &, bool)
void SetDoubleClickHandler(const Link< SvtFileView *, bool > &rHdl)
Definition: fileview.cxx:1349
OUString maViewURL
Definition: fileview.cxx:270
DECL_LINK(SelectionChangedHdl, weld::IconView &, void)
void EntryRemoved(std::u16string_view rURL)
Definition: fileview.cxx:1668
int GetSortColumn() const
Definition: fileview.cxx:349
css::uno::Sequence< OUString > maDenyList
Definition: fileview.hxx:65
void set_help_id(const OUString &rHelpId)
Definition: fileview.cxx:923
SvtContentEntry * FirstSelected() const
Definition: fileview.cxx:1004
const OUString & GetViewURL() const
Definition: fileview.cxx:1022
bool has_focus() const
Definition: fileview.cxx:818
FileViewResult PreviousLevel(const FileViewAsyncAction *pAsyncDescriptor)
initializes the view with the parent folder of the current folder
Definition: fileview.cxx:881
OUString get_help_id() const
Definition: fileview.cxx:918
void SetConfigString(std::u16string_view rCfgStr)
Definition: fileview.cxx:1103
sal_uInt32 GetSelectionCount() const
Definition: fileview.cxx:997
void SetViewMode(FileViewMode eMode)
Definition: fileview.cxx:827
::std::vector< SvtContentEntry > GetContent()
Definition: fileview.cxx:1090
bool GetParentURL(OUString &_rParentURL) const
Definition: fileview.cxx:892
void CancelRunningAsyncAction()
cancels a running async action (if any)
Definition: fileview.cxx:976
weld::Widget * identifier() const
Definition: fileview.cxx:1803
void CreatedFolder(const OUString &rUrl, const OUString &rNewFolder)
Definition: fileview.cxx:865
std::unique_ptr< SvtFileView_Impl > mpImpl
Definition: fileview.hxx:64
void SetNoSelection()
Definition: fileview.cxx:981
void SetOpenDoneHdl(const Link< SvtFileView *, void > &rHdl)
Definition: fileview.cxx:1027
SvtFileView(weld::Window *pTopLevel, std::unique_ptr< weld::TreeView > xTreeView, std::unique_ptr< weld::IconView > xIconView, bool bOnlyFolder, bool bMultiSelection, bool bShowType=true)
Definition: fileview.cxx:791
OUString GetURL(const weld::TreeIter &rEntry) const
Definition: fileview.cxx:832
void EndInplaceEditing()
Definition: fileview.cxx:1037
void selected_foreach(const std::function< bool(weld::TreeIter &)> &func)
Definition: fileview.cxx:1795
FileViewResult Initialize(const OUString &rFolderURL, const OUString &rFilter, const FileViewAsyncAction *pAsyncDescriptor, const css::uno::Sequence< OUString > &rDenyList)
initialize the view with the content of a folder given by URL, and apply an immediate filter
Definition: fileview.cxx:935
FileViewResult ExecuteFilter(const OUString &rFilter, const FileViewAsyncAction *pAsyncDescriptor)
reads the current content of the current folder again, and applies the given filter to it
Definition: fileview.cxx:966
void SetDoubleClickHdl(const Link< SvtFileView *, bool > &rHdl)
Definition: fileview.cxx:992
OUString get_selected_text() const
Definition: fileview.cxx:928
void grab_focus()
Definition: fileview.cxx:813
void SetSelectHdl(const Link< SvtFileView *, void > &rHdl)
Definition: fileview.cxx:987
OUString GetCurrentURL() const
Definition: fileview.cxx:844
void EnableDelete(bool bEnable)
Definition: fileview.cxx:1032
OUString GetConfigString() const
Definition: fileview.cxx:1064
const LocaleDataWrapper & GetLocaleData() const
virtual void SAL_CALL onShot()=0
css::uno::Any setPropertyValue(const OUString &rPropertyName, const css::uno::Any &rValue)
css::uno::Reference< css::beans::XPropertySetInfo > getProperties()
css::uno::Reference< css::ucb::XCommandInfo > getCommands()
css::uno::Reference< css::ucb::XContent > get() const
sal_uInt16 GetCode() const
sal_uInt16 GetModifier() const
virtual void set_sort_indicator(TriState eState, int nColumn)=0
virtual void clear()=0
virtual int get_height_rows(int nRows) const=0
virtual void set_column_fixed_widths(const std::vector< int > &rWidths)=0
virtual int get_column_width(int nCol) const=0
void connect_column_clicked(const Link< int, void > &rLink)
virtual void set_size_request(int nWidth, int nHeight)=0
virtual css::uno::Reference< css::awt::XWindow > GetXWindow()=0
int nCount
#define DBG_ASSERT(sCon, aError)
#define DBG_TESTSOLARMUTEX()
URL aURL
DECL_LINK(CheckNameHdl, SvxNameDialog &, bool)
RegionData_Impl * mpParent
ItemID nItemID
float u
ERROR
#define COLUMN_SIZE
Definition: fileview.cxx:82
#define QUICK_SEARCH_TIMEOUT
Definition: fileview.cxx:85
#define COLUMN_TITLE
Definition: fileview.cxx:80
static bool CompareSortingData_Impl(std::unique_ptr< SortingData_Impl > const &aOne, std::unique_ptr< SortingData_Impl > const &aTwo)
Definition: fileview.cxx:1577
static bool gbAscending
Definition: fileview.cxx:1571
IMPL_LINK(ViewTabListBox_Impl, KeyInputHdl, const KeyEvent &, rKEvt, bool)
Definition: fileview.cxx:469
IMPL_LINK_NOARG(ViewTabListBox_Impl, EditingEntryHdl, const weld::TreeIter &, bool)
Definition: fileview.cxx:456
#define COLUMN_TYPE
Definition: fileview.cxx:81
static sal_Int16 gnColumn
Definition: fileview.cxx:1572
static const CollatorWrapper * pCollatorWrapper
Definition: fileview.cxx:1573
constexpr OUStringLiteral ALL_FILES_FILTER
Definition: fileview.cxx:78
#define COLUMN_DATE
Definition: fileview.cxx:83
FileViewMode
Definition: fileview.hxx:44
@ eIcon
Definition: fileview.hxx:46
@ eDetailedList
Definition: fileview.hxx:45
FileViewResult
the result of an action in the FileView
Definition: fileview.hxx:36
@ eSuccess
Definition: fileview.hxx:37
@ eTimeout
Definition: fileview.hxx:39
@ eFailure
Definition: fileview.hxx:38
@ eStillRunning
Definition: fileview.hxx:40
TRISTATE_FALSE
TRISTATE_INDET
TRISTATE_TRUE
sal_Int32 nIndex
Mode eMode
constexpr sal_uInt16 KEYGROUP_ALPHA
constexpr sal_uInt16 KEY_DELETE
constexpr sal_uInt16 KEYGROUP_NUM
sal_uInt16 nPos
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
if(aStr !=aBuf) UpdateName_Impl(m_xFollowLb.get()
std::unique_ptr< sal_Int32[]> pData
NONE
@ Exception
OString stripEnd(const OString &rIn, char c)
Reference< XComponentContext > getProcessComponentContext()
int i
OUString aPropName
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
@ ERROR
the enumeration was successful
long Long
UNOTOOLS_DLLPUBLIC bool Kill(OUString const &url)
Definition: fileview.cxx:768
const LocaleDataWrapper & GetLocaleData()
OUString toId(const void *pValue)
sal_Int16 nId
uno::Reference< presentation::XSlideShowView > mxView
describes parameters for doing an action on the FileView asynchronously
Definition: fileview.hxx:51
sal_uInt32 nMaxTimeout
minimum time to wait for a result, in milliseconds
Definition: fileview.hxx:53
sal_uInt32 nMinTimeout
Definition: fileview.hxx:52
Link< void *, void > aFinishHandler
maximum time to wait for a result, in milliseconds, until eTimeout is returned
Definition: fileview.hxx:54
OUString maURL
Definition: fileview.hxx:178
SVT_DLLPUBLIC OUString SvtResId(TranslateId aId)
sal_uInt16 sal_Unicode
OUString sId