Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef THUMBNAILVIEWITEM_HXX
30 : : #define THUMBNAILVIEWITEM_HXX
31 : :
32 : : #include <basegfx/vector/b2dvector.hxx>
33 : : #include <drawinglayer/attribute/fontattribute.hxx>
34 : : #include <osl/mutex.hxx>
35 : : #include <vcl/bitmapex.hxx>
36 : : #include "sfx2/dllapi.h"
37 : :
38 : : #include <com/sun/star/accessibility/XAccessible.hpp>
39 : :
40 : : #define THUMBNAILVIEW_ITEM_NONEITEM 0xFFFE
41 : :
42 : : class CheckBox;
43 : : class Font;
44 : : class Window;
45 : : class ThumbnailView;
46 : :
47 : : namespace basegfx {
48 : : class B2DPoint;
49 : : }
50 : :
51 : : namespace drawinglayer {
52 : : namespace processor2d {
53 : : class BaseProcessor2D;
54 : : }
55 : :
56 : : namespace primitive2d {
57 : : class BorderLinePrimitive2D;
58 : : }
59 : : }
60 : :
61 [ # # ][ # # ]: 0 : struct ThumbnailItemAttributes
62 : : {
63 : : sal_uInt32 nMaxTextLenght;
64 : : basegfx::BColor aFillColor;
65 : : basegfx::BColor aHighlightColor;
66 : : basegfx::B2DVector aFontSize;
67 : : drawinglayer::attribute::FontAttribute aFontAttr;
68 : : };
69 : :
70 : : class SFX2_DLLPUBLIC ThumbnailViewItem
71 : : {
72 : : public:
73 : :
74 : : ThumbnailView &mrParent;
75 : : sal_uInt16 mnId;
76 : : bool mbVisible;
77 : : bool mbSelected;
78 : : bool mbHover;
79 : : BitmapEx maPreview1;
80 : : rtl::OUString maTitle;
81 : : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >* mpxAcc;
82 : :
83 : : ThumbnailViewItem (ThumbnailView &rView, Window *pParent);
84 : :
85 : : virtual ~ThumbnailViewItem ();
86 : :
87 : 0 : bool isVisible () const { return mbVisible; }
88 : :
89 : : void show (bool bVisible);
90 : :
91 : 0 : bool isSelected () const { return mbSelected; }
92 : :
93 : : void setSelection (bool state);
94 : :
95 : 0 : bool isHighlighted () const { return mbHover; }
96 : :
97 : : void setHighlight (bool state);
98 : :
99 : : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
100 : : GetAccessible( bool bIsTransientChildrenDisabled );
101 : :
102 : : void setDrawArea (const Rectangle &area);
103 : :
104 : 0 : const Rectangle& getDrawArea () const { return maDrawArea; }
105 : :
106 : : virtual void calculateItemsPosition (const long nThumbnailHeight, const long nDisplayHeight,
107 : : const long nPadding, sal_uInt32 nMaxTextLenght,
108 : : const ThumbnailItemAttributes *pAttrs);
109 : :
110 : : const Point& getTextPos () const { return maTextPos; }
111 : :
112 : : const Point& getPrev1Pos () const { return maPrev1Pos; }
113 : :
114 : : void setSelectionMode (bool mode);
115 : :
116 : : void setSelectClickHdl (const Link &link);
117 : :
118 : : virtual void Paint (drawinglayer::processor2d::BaseProcessor2D *pProcessor,
119 : : const ThumbnailItemAttributes *pAttrs);
120 : :
121 : : static drawinglayer::primitive2d::BorderLinePrimitive2D*
122 : : createBorderLine (const basegfx::B2DPoint &rStart, const basegfx::B2DPoint &rEnd);
123 : :
124 : : private:
125 : :
126 : : DECL_LINK (OnClick, CheckBox *);
127 : :
128 : : protected:
129 : :
130 : : bool mbMode;
131 : : Point maTextPos;
132 : : Point maPrev1Pos;
133 : : Rectangle maDrawArea;
134 : : Link maClickHdl;
135 : : CheckBox *mpSelectBox;
136 : : };
137 : :
138 : : #endif // THUMBNAILVIEWITEM_HXX
139 : :
140 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|