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 INCLUDED_SFX2_THUMBNAILVIEWITEM_HXX
21 : #define INCLUDED_SFX2_THUMBNAILVIEWITEM_HXX
22 :
23 : #include <basegfx/vector/b2dvector.hxx>
24 : #include <drawinglayer/attribute/fontattribute.hxx>
25 : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
26 : #include <osl/mutex.hxx>
27 : #include <vcl/bitmapex.hxx>
28 : #include <vcl/vclmedit.hxx>
29 : #include <sfx2/dllapi.h>
30 :
31 : #include <com/sun/star/accessibility/XAccessible.hpp>
32 :
33 : #define THUMBNAILVIEW_ITEM_NONEITEM 0xFFFE
34 :
35 : class CheckBox;
36 : class Font;
37 : class Window;
38 : class ThumbnailView;
39 :
40 : namespace basegfx {
41 : class B2DPolygon;
42 : }
43 :
44 : namespace drawinglayer {
45 : namespace processor2d {
46 : class BaseProcessor2D;
47 : }
48 :
49 : namespace primitive2d {
50 : class PolygonHairlinePrimitive2D;
51 : }
52 : }
53 :
54 0 : struct ThumbnailItemAttributes
55 : {
56 : sal_uInt32 nMaxTextLength;
57 : basegfx::BColor aFillColor;
58 : basegfx::BColor aHighlightColor;
59 : basegfx::B2DVector aFontSize;
60 : drawinglayer::attribute::FontAttribute aFontAttr;
61 : };
62 :
63 : class SFX2_DLLPUBLIC ThumbnailViewItem
64 : {
65 : public:
66 :
67 : ThumbnailView &mrParent;
68 : sal_uInt16 mnId;
69 : bool mbVisible;
70 : bool mbSelected;
71 : bool mbHover;
72 : BitmapEx maPreview1;
73 : OUString maTitle;
74 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >* mpxAcc;
75 :
76 : ThumbnailViewItem (ThumbnailView &rView, sal_uInt16 nId);
77 :
78 : virtual ~ThumbnailViewItem ();
79 :
80 0 : bool isVisible () const { return mbVisible; }
81 :
82 : void show (bool bVisible);
83 :
84 0 : bool isSelected () const { return mbSelected; }
85 :
86 : void setSelection (bool state);
87 :
88 0 : bool isHighlighted () const { return mbHover; }
89 :
90 : void setHighlight (bool state);
91 :
92 : /// Text to be used for the tooltip.
93 : virtual OUString getHelpText() const;
94 :
95 : virtual void setEditTitle (bool edit, bool bChangeFocus = true);
96 : void updateTitleEditSize ();
97 : virtual void setTitle (const OUString& rTitle);
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 : Rectangle getTextArea () const;
106 :
107 : virtual void calculateItemsPosition (const long nThumbnailHeight, const long nDisplayHeight,
108 : const long nPadding, sal_uInt32 nMaxTextLength,
109 : const ThumbnailItemAttributes *pAttrs);
110 :
111 : const Point& getTextPos () const { return maTextPos; }
112 :
113 : const Point& getPrev1Pos () const { return maPrev1Pos; }
114 :
115 : void setSelectClickHdl (const Link &link);
116 :
117 : virtual void Paint (drawinglayer::processor2d::BaseProcessor2D *pProcessor,
118 : const ThumbnailItemAttributes *pAttrs);
119 : void addTextPrimitives (const OUString& rText, const ThumbnailItemAttributes *pAttrs, Point aPos, drawinglayer::primitive2d::Primitive2DSequence& rSeq);
120 :
121 : static drawinglayer::primitive2d::PolygonHairlinePrimitive2D*
122 : createBorderLine (const basegfx::B2DPolygon &rPolygon);
123 :
124 : protected:
125 :
126 : Point maTextPos;
127 : Point maPrev1Pos;
128 : Rectangle maDrawArea;
129 : Link maClickHdl;
130 : bool mbEditTitle;
131 : VclMultiLineEdit* mpTitleED;
132 : Rectangle maTextEditMaxArea;
133 : };
134 :
135 : #endif // INCLUDED_SFX2_THUMBNAILVIEWITEM_HXX
136 :
137 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|