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 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef THUMBNAILVIEWITEM_HXX
21 : #define THUMBNAILVIEWITEM_HXX
22 :
23 : #include <basegfx/vector/b2dvector.hxx>
24 : #include <drawinglayer/attribute/fontattribute.hxx>
25 : #include <osl/mutex.hxx>
26 : #include <vcl/bitmapex.hxx>
27 : #include "sfx2/dllapi.h"
28 :
29 : #include <com/sun/star/accessibility/XAccessible.hpp>
30 :
31 : #define THUMBNAILVIEW_ITEM_NONEITEM 0xFFFE
32 :
33 : class CheckBox;
34 : class Font;
35 : class Window;
36 : class ThumbnailView;
37 :
38 : namespace basegfx {
39 : class B2DPolygon;
40 : }
41 :
42 : namespace drawinglayer {
43 : namespace processor2d {
44 : class BaseProcessor2D;
45 : }
46 :
47 : namespace primitive2d {
48 : class PolygonHairlinePrimitive2D;
49 : }
50 : }
51 :
52 0 : struct ThumbnailItemAttributes
53 : {
54 : sal_uInt32 nMaxTextLenght;
55 : basegfx::BColor aFillColor;
56 : basegfx::BColor aHighlightColor;
57 : basegfx::B2DVector aFontSize;
58 : drawinglayer::attribute::FontAttribute aFontAttr;
59 : };
60 :
61 : class SFX2_DLLPUBLIC ThumbnailViewItem
62 : {
63 : public:
64 :
65 : ThumbnailView &mrParent;
66 : sal_uInt16 mnId;
67 : bool mbVisible;
68 : bool mbSelected;
69 : bool mbHover;
70 : BitmapEx maPreview1;
71 : rtl::OUString maTitle;
72 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >* mpxAcc;
73 :
74 : ThumbnailViewItem (ThumbnailView &rView);
75 :
76 : virtual ~ThumbnailViewItem ();
77 :
78 0 : bool isVisible () const { return mbVisible; }
79 :
80 : void show (bool bVisible);
81 :
82 0 : bool isSelected () const { return mbSelected; }
83 :
84 : void setSelection (bool state);
85 :
86 0 : bool isHighlighted () const { return mbHover; }
87 :
88 : void setHighlight (bool state);
89 :
90 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
91 : GetAccessible( bool bIsTransientChildrenDisabled );
92 :
93 : void setDrawArea (const Rectangle &area);
94 :
95 0 : const Rectangle& getDrawArea () const { return maDrawArea; }
96 :
97 : virtual void calculateItemsPosition (const long nThumbnailHeight, const long nDisplayHeight,
98 : const long nPadding, sal_uInt32 nMaxTextLenght,
99 : const ThumbnailItemAttributes *pAttrs);
100 :
101 : const Point& getTextPos () const { return maTextPos; }
102 :
103 : const Point& getPrev1Pos () const { return maPrev1Pos; }
104 :
105 : void setSelectClickHdl (const Link &link);
106 :
107 : virtual void Paint (drawinglayer::processor2d::BaseProcessor2D *pProcessor,
108 : const ThumbnailItemAttributes *pAttrs);
109 :
110 : static drawinglayer::primitive2d::PolygonHairlinePrimitive2D*
111 : createBorderLine (const basegfx::B2DPolygon &rPolygon);
112 :
113 : protected:
114 :
115 : Point maTextPos;
116 : Point maPrev1Pos;
117 : Rectangle maDrawArea;
118 : Link maClickHdl;
119 : };
120 :
121 : #endif // THUMBNAILVIEWITEM_HXX
122 :
123 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|