1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SFX2_THUMBNAILVIEWITEM_HXX
21 #define INCLUDED_SFX2_THUMBNAILVIEWITEM_HXX
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>
31 #include <com/sun/star/accessibility/XAccessible.hpp>
33 #define THUMBNAILVIEW_ITEM_NONEITEM 0xFFFE
44 namespace drawinglayer
{
45 namespace processor2d
{
46 class BaseProcessor2D
;
49 namespace primitive2d
{
50 class PolygonHairlinePrimitive2D
;
54 struct ThumbnailItemAttributes
56 sal_uInt32 nMaxTextLenght
;
57 basegfx::BColor aFillColor
;
58 basegfx::BColor aHighlightColor
;
59 basegfx::B2DVector aFontSize
;
60 drawinglayer::attribute::FontAttribute aFontAttr
;
63 class SFX2_DLLPUBLIC ThumbnailViewItem
67 ThumbnailView
&mrParent
;
74 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
>* mpxAcc
;
76 ThumbnailViewItem (ThumbnailView
&rView
, sal_uInt16 nId
);
78 virtual ~ThumbnailViewItem ();
80 bool isVisible () const { return mbVisible
; }
82 void show (bool bVisible
);
84 bool isSelected () const { return mbSelected
; }
86 void setSelection (bool state
);
88 bool isHighlighted () const { return mbHover
; }
90 void setHighlight (bool state
);
92 /// Text to be used for the tooltip.
93 virtual OUString
getHelpText() const;
95 virtual void setEditTitle (bool edit
, bool bChangeFocus
= true);
96 void updateTitleEditSize ();
97 virtual void setTitle (const OUString
& rTitle
);
99 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
>
100 GetAccessible( bool bIsTransientChildrenDisabled
);
102 void setDrawArea (const Rectangle
&area
);
104 const Rectangle
& getDrawArea () const { return maDrawArea
; }
105 Rectangle
getTextArea () const;
107 virtual void calculateItemsPosition (const long nThumbnailHeight
, const long nDisplayHeight
,
108 const long nPadding
, sal_uInt32 nMaxTextLenght
,
109 const ThumbnailItemAttributes
*pAttrs
);
111 const Point
& getTextPos () const { return maTextPos
; }
113 const Point
& getPrev1Pos () const { return maPrev1Pos
; }
115 void setSelectClickHdl (const Link
&link
);
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
);
121 static drawinglayer::primitive2d::PolygonHairlinePrimitive2D
*
122 createBorderLine (const basegfx::B2DPolygon
&rPolygon
);
128 Rectangle maDrawArea
;
131 VclMultiLineEdit
* mpTitleED
;
132 Rectangle maTextEditMaxArea
;
135 #endif // INCLUDED_SFX2_THUMBNAILVIEWITEM_HXX
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */