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 : class SFX2_DLLPUBLIC RecentDocsView : public ThumbnailView
42 : {
43 : public:
44 : RecentDocsView( vcl::Window* pParent );
45 : virtual ~RecentDocsView();
46 :
47 : void insertItem(const OUString &rURL, const OUString &rTitle, const BitmapEx &rThumbnail, sal_uInt16 nId);
48 :
49 0 : long GetThumbnailSize() const { return mnItemMaxSize;}
50 :
51 : static bool typeMatchesExtension(ApplicationType type, const OUString &rExt);
52 : static BitmapEx getDefaultThumbnail(const OUString &rURL);
53 :
54 : int mnFileTypes;
55 :
56 : virtual void Clear() SAL_OVERRIDE;
57 :
58 : /// Update the information in the view.
59 : virtual void Reload() SAL_OVERRIDE;
60 :
61 : DECL_STATIC_LINK( RecentDocsView, ExecuteHdl_Impl, LoadRecentFile* );
62 :
63 : protected:
64 : virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
65 :
66 : virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
67 :
68 : virtual void OnItemDblClicked(ThumbnailViewItem *pItem) SAL_OVERRIDE;
69 :
70 : virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
71 :
72 : virtual void LoseFocus() SAL_OVERRIDE;
73 :
74 : bool isAcceptedFile(const OUString &rURL) const;
75 :
76 : /// Set (larger) font for the Welcome message.
77 : void SetMessageFont();
78 :
79 : long mnItemMaxSize;
80 : long mnTextHeight;
81 : long mnItemPadding;
82 : long mnItemMaxTextLength;
83 : size_t mnLastMouseDownItem;
84 :
85 : /// Image that appears when there is no recent document.
86 : Image maWelcomeImage;
87 : OUString maWelcomeLine1;
88 : OUString maWelcomeLine2;
89 : };
90 :
91 : #endif // INCLUDED_SFX2_RECENTDOCSVIEW_HXX
92 :
93 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|