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 : protected ::comphelper::OBaseMutex,
42 : public ThumbnailView
43 : {
44 : public:
45 : RecentDocsView( Window* pParent );
46 : virtual ~RecentDocsView();
47 :
48 : void insertItem(const OUString &rURL, const OUString &rTitle, const BitmapEx &rThumbnail, sal_uInt16 nId);
49 : void loadRecentDocs();
50 :
51 : long GetThumbnailSize() const;
52 :
53 : static bool typeMatchesExtension(ApplicationType type, const OUString &rExt);
54 : static BitmapEx getDefaultThumbnail(const OUString &rURL);
55 :
56 : int mnFileTypes;
57 :
58 : virtual void Clear() SAL_OVERRIDE;
59 :
60 : DECL_STATIC_LINK( RecentDocsView, ExecuteHdl_Impl, LoadRecentFile* );
61 :
62 : protected:
63 : virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
64 : virtual void OnItemDblClicked(ThumbnailViewItem *pItem) SAL_OVERRIDE;
65 : void OpenItem( const ThumbnailViewItem *pItem );
66 : virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
67 :
68 : virtual void LoseFocus() SAL_OVERRIDE;
69 :
70 : bool isAcceptedFile(const OUString &rURL) const;
71 :
72 : long mnItemMaxSize;
73 : long mnTextHeight;
74 : long mnItemPadding;
75 : long mnItemMaxTextLength;
76 :
77 : Image maWelcomeImage;
78 : OUString maWelcomeLine1;
79 : OUString maWelcomeLine2;
80 : };
81 :
82 : #endif // INCLUDED_SFX2_RECENTDOCSVIEW_HXX
83 :
84 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|