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/.
12 #include <sfx2/thumbnailview.hxx>
13 #include <vcl/bitmapex.hxx>
15 #include <o3tl/typed_flags_set.hxx>
17 #include <com/sun/star/util/URL.hpp>
18 #include <com/sun/star/beans/PropertyValue.hpp>
22 namespace com::sun::star::frame
{ class XDispatch
; }
31 css::util::URL aTargetURL
;
32 css::uno::Sequence
< css::beans::PropertyValue
> aArgSeq
;
33 css::uno::Reference
< css::frame::XDispatch
> xDispatch
;
34 RecentDocsView
* pView
;
37 enum class ApplicationType
42 TYPE_IMPRESS
= 1 << 2,
44 TYPE_DATABASE
= 1 << 4,
53 template<> struct typed_flags
<sfx2::ApplicationType
> : is_typed_flags
<sfx2::ApplicationType
, 0x7f> {};
60 class RecentDocsView final
: public ThumbnailView
63 RecentDocsView(std::unique_ptr
<weld::ScrolledWindow
> xWindow
, std::unique_ptr
<weld::Menu
> xMenu
);
64 virtual ~RecentDocsView() override
;
66 void insertItem(const OUString
& rURL
, const OUString
& rTitle
, const OUString
& rThumbnail
,
67 bool isReadOnly
, bool isPinned
, sal_uInt16 nId
);
69 static bool typeMatchesExtension(ApplicationType type
, std::u16string_view rExt
);
71 ApplicationType mnFileTypes
;
73 virtual void Clear() override
;
75 /// Update the information in the view.
76 virtual void Reload() override
;
78 // launch load of recently used file
79 void PostLoadRecentUsedFile(LoadRecentFile
* pLoadRecentFile
);
81 // received on load of recently used file
82 void DispatchedLoadRecentUsedFile();
84 void clearUnavailableFiles();
86 void setFilter(ApplicationType aFilter
);
89 virtual bool MouseButtonDown( const MouseEvent
& rMEvt
) override
;
91 virtual bool MouseButtonUp( const MouseEvent
& rMEvt
) override
;
93 virtual void OnItemDblClicked(ThumbnailViewItem
*pItem
) override
;
95 virtual void Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
97 virtual void LoseFocus() override
;
99 bool isAcceptedFile(const INetURLObject
& rURL
) const;
101 DECL_LINK( ExecuteHdl_Impl
, void*, void );
103 tools::Long mnItemMaxSize
;
104 size_t mnLastMouseDownItem
;
106 /// Image that appears when there is no recent document.
107 BitmapEx maWelcomeImage
;
108 OUString maWelcomeLine1
;
109 OUString maWelcomeLine2
;
111 sfx2::LoadRecentFile
* mpLoadRecentFile
;
112 ImplSVEvent
* m_nExecuteHdlId
;
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */