Line data Source code
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 :
10 : #ifndef INCLUDED_SFX2_RECENTDOCSVIEW_HXX
11 : #define INCLUDED_SFX2_RECENTDOCSVIEW_HXX
12 :
13 : #include <sfx2/thumbnailview.hxx>
14 : #include <sfx2/recentdocsviewitem.hxx>
15 : #include <vcl/image.hxx>
16 :
17 : #include <com/sun/star/frame/XFrame.hpp>
18 : #include <com/sun/star/frame/XDispatchProvider.hpp>
19 : #include <com/sun/star/frame/XDispatch.hpp>
20 :
21 0 : struct LoadRecentFile
22 : {
23 : ::com::sun::star::util::URL aTargetURL;
24 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgSeq;
25 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch;
26 : };
27 :
28 : enum ApplicationType
29 : {
30 : TYPE_NONE = 0,
31 : TYPE_WRITER = 1 << 0,
32 : TYPE_CALC = 1 << 1,
33 : TYPE_IMPRESS = 1 << 2,
34 : TYPE_DRAW = 1 << 3,
35 : TYPE_DATABASE = 1 << 4,
36 : TYPE_MATH = 1 << 5,
37 : TYPE_OTHER = 1 << 6
38 : };
39 :
40 :
41 0 : class SFX2_DLLPUBLIC RecentDocsView : public ThumbnailView
42 : {
43 : public:
44 : RecentDocsView( vcl::Window* pParent );
45 :
46 : void insertItem(const OUString &rURL, const OUString &rTitle, const BitmapEx &rThumbnail, sal_uInt16 nId);
47 :
48 0 : long GetThumbnailSize() const { return mnItemMaxSize;}
49 :
50 : static bool typeMatchesExtension(ApplicationType type, const OUString &rExt);
51 : static BitmapEx getDefaultThumbnail(const OUString &rURL);
52 :
53 : int mnFileTypes;
54 :
55 : virtual void Clear() SAL_OVERRIDE;
56 :
57 : /// Update the information in the view.
58 : virtual void Reload() SAL_OVERRIDE;
59 :
60 : DECL_STATIC_LINK( RecentDocsView, ExecuteHdl_Impl, LoadRecentFile* );
61 :
62 : protected:
63 : virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
64 :
65 : virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
66 :
67 : virtual void OnItemDblClicked(ThumbnailViewItem *pItem) SAL_OVERRIDE;
68 :
69 : virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
70 :
71 : virtual void LoseFocus() SAL_OVERRIDE;
72 :
73 : bool isAcceptedFile(const OUString &rURL) const;
74 :
75 : long mnItemMaxSize;
76 : long mnTextHeight;
77 : long mnItemPadding;
78 : long mnItemMaxTextLength;
79 : size_t mnLastMouseDownItem;
80 :
81 : /// Image that appears when there is no recent document.
82 : Image maWelcomeImage;
83 : OUString maWelcomeLine1;
84 : OUString maWelcomeLine2;
85 : };
86 :
87 : #endif // INCLUDED_SFX2_RECENTDOCSVIEW_HXX
88 :
89 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|