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/image.hxx>
15 #include <o3tl/typed_flags_set.hxx>
17 #include <com/sun/star/util/URL.hpp>
18 #include <com/sun/star/beans/PropertyValue.hpp>
21 namespace com::sun::star::frame
{ class XDispatch
; }
30 css::util::URL aTargetURL
;
31 css::uno::Sequence
< css::beans::PropertyValue
> aArgSeq
;
32 css::uno::Reference
< css::frame::XDispatch
> xDispatch
;
33 RecentDocsView
* pView
;
36 enum class ApplicationType
41 TYPE_IMPRESS
= 1 << 2,
43 TYPE_DATABASE
= 1 << 4,
52 template<> struct typed_flags
<sfx2::ApplicationType
> : is_typed_flags
<sfx2::ApplicationType
, 0x7f> {};
59 class RecentDocsView final
: public ThumbnailView
62 RecentDocsView(std::unique_ptr
<weld::ScrolledWindow
> xWindow
, std::unique_ptr
<weld::Menu
> xMenu
);
63 virtual ~RecentDocsView() override
;
65 void insertItem(const OUString
&rURL
, const OUString
&rTitle
, const BitmapEx
&rThumbnail
, sal_uInt16 nId
);
67 static bool typeMatchesExtension(ApplicationType type
, const OUString
&rExt
);
68 static BitmapEx
getDefaultThumbnail(const OUString
&rURL
);
70 ApplicationType mnFileTypes
;
72 virtual void Clear() override
;
74 /// Update the information in the view.
75 virtual void Reload() override
;
77 // launch load of recently used file
78 void PostLoadRecentUsedFile(LoadRecentFile
* pLoadRecentFile
);
80 // received on load of recently used file
81 void DispatchedLoadRecentUsedFile();
84 virtual bool MouseButtonDown( const MouseEvent
& rMEvt
) override
;
86 virtual bool MouseButtonUp( const MouseEvent
& rMEvt
) override
;
88 virtual void OnItemDblClicked(ThumbnailViewItem
*pItem
) override
;
90 virtual void Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
92 virtual void LoseFocus() override
;
94 bool isAcceptedFile(const OUString
&rURL
) const;
96 DECL_LINK( ExecuteHdl_Impl
, void*, void );
98 tools::Long mnItemMaxSize
;
99 size_t mnLastMouseDownItem
;
101 /// Image that appears when there is no recent document.
102 BitmapEx maWelcomeImage
;
103 OUString maWelcomeLine1
;
104 OUString maWelcomeLine2
;
106 sfx2::LoadRecentFile
* mpLoadRecentFile
;
107 ImplSVEvent
* m_nExecuteHdlId
;
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */