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 <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 nMaxTextLenght;
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);
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 : void setEditTitle (bool edit, bool bChangeFocus = true);
93 : void updateTitleEditSize ();
94 : virtual void setTitle (const OUString& rTitle);
95 :
96 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
97 : GetAccessible( bool bIsTransientChildrenDisabled );
98 :
99 : void setDrawArea (const Rectangle &area);
100 :
101 0 : const Rectangle& getDrawArea () const { return maDrawArea; }
102 : Rectangle getTextArea () const;
103 :
104 : virtual void calculateItemsPosition (const long nThumbnailHeight, const long nDisplayHeight,
105 : const long nPadding, sal_uInt32 nMaxTextLenght,
106 : const ThumbnailItemAttributes *pAttrs);
107 :
108 : const Point& getTextPos () const { return maTextPos; }
109 :
110 : const Point& getPrev1Pos () const { return maPrev1Pos; }
111 :
112 : void setSelectClickHdl (const Link &link);
113 :
114 : virtual void Paint (drawinglayer::processor2d::BaseProcessor2D *pProcessor,
115 : const ThumbnailItemAttributes *pAttrs);
116 : void addTextPrimitives (const OUString& rText, const ThumbnailItemAttributes *pAttrs, Point aPos, drawinglayer::primitive2d::Primitive2DSequence& rSeq);
117 :
118 : static drawinglayer::primitive2d::PolygonHairlinePrimitive2D*
119 : createBorderLine (const basegfx::B2DPolygon &rPolygon);
120 :
121 : protected:
122 :
123 : Point maTextPos;
124 : Point maPrev1Pos;
125 : Rectangle maDrawArea;
126 : Link maClickHdl;
127 : bool mbEditTitle;
128 : VclMultiLineEdit* mpTitleED;
129 : Rectangle maTextEditMaxArea;
130 : };
131 :
132 : #endif // THUMBNAILVIEWITEM_HXX
133 :
134 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|