nss: upgrade to release 3.73
[LibreOffice.git] / sfx2 / inc / recentdocsview.hxx
bloba6e2f86a155a9c51332cb8c963e18903cfd02dc0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
10 #pragma once
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>
20 struct ImplSVEvent;
21 namespace com::sun::star::frame { class XDispatch; }
23 namespace sfx2
26 class RecentDocsView;
28 struct LoadRecentFile
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
38 TYPE_NONE = 0,
39 TYPE_WRITER = 1 << 0,
40 TYPE_CALC = 1 << 1,
41 TYPE_IMPRESS = 1 << 2,
42 TYPE_DRAW = 1 << 3,
43 TYPE_DATABASE = 1 << 4,
44 TYPE_MATH = 1 << 5,
45 TYPE_OTHER = 1 << 6
48 } // namespace sfx2
50 namespace o3tl {
52 template<> struct typed_flags<sfx2::ApplicationType> : is_typed_flags<sfx2::ApplicationType, 0x7f> {};
54 } // namespace o3tl
56 namespace sfx2
59 class RecentDocsView final : public ThumbnailView
61 public:
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();
83 private:
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;
110 } // namespace sfx2
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */