tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sfx2 / inc / recentdocsview.hxx
blob38199818a34eb8b62b9e8abb3c5e6ecb3e642baf
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/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>
20 class INetURLObject;
21 struct ImplSVEvent;
22 namespace com::sun::star::frame { class XDispatch; }
24 namespace sfx2
27 class RecentDocsView;
29 struct LoadRecentFile
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
39 TYPE_NONE = 0,
40 TYPE_WRITER = 1 << 0,
41 TYPE_CALC = 1 << 1,
42 TYPE_IMPRESS = 1 << 2,
43 TYPE_DRAW = 1 << 3,
44 TYPE_DATABASE = 1 << 4,
45 TYPE_MATH = 1 << 5,
46 TYPE_OTHER = 1 << 6
49 } // namespace sfx2
51 namespace o3tl {
53 template<> struct typed_flags<sfx2::ApplicationType> : is_typed_flags<sfx2::ApplicationType, 0x7f> {};
55 } // namespace o3tl
57 namespace sfx2
60 class RecentDocsView final : public ThumbnailView
62 public:
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);
88 private:
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;
115 } // namespace sfx2
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */