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 <sfx2/dllapi.h>
30 #include <com/sun/star/accessibility/XAccessible.hpp>
32 #define THUMBNAILVIEW_ITEM_NONEITEM 0xFFFE
34 const int THUMBNAILVIEW_ITEM_CORNER
= 5;
43 namespace drawinglayer
{
44 namespace processor2d
{
45 class BaseProcessor2D
;
48 namespace primitive2d
{
49 class PolygonHairlinePrimitive2D
;
53 struct ThumbnailItemAttributes
55 sal_uInt32 nMaxTextLength
;
56 basegfx::BColor aFillColor
;
57 basegfx::BColor aTextColor
;
58 basegfx::BColor aHighlightColor
;
59 basegfx::BColor aHighlightTextColor
;
60 basegfx::BColor aSelectHighlightColor
;
61 basegfx::BColor aSelectHighlightTextColor
;
62 double fHighlightTransparence
;
63 basegfx::B2DVector aFontSize
;
64 drawinglayer::attribute::FontAttribute aFontAttr
;
67 class SFX2_DLLPUBLIC ThumbnailViewItem
71 ThumbnailView
&mrParent
;
79 css::uno::Reference
< css::accessibility::XAccessible
> mxAcc
;
81 ThumbnailViewItem (ThumbnailView
&rView
, sal_uInt16 nId
);
83 virtual ~ThumbnailViewItem ();
85 bool isVisible () const { return mbVisible
; }
87 void show (bool bVisible
);
89 bool isSelected () const { return mbSelected
; }
91 void setSelection (bool state
);
93 bool isHighlighted () const { return mbHover
; }
95 void setHighlight (bool state
);
97 /** Updates own highlight status based on the aPoint position.
99 Returns rectangle that needs to be invalidated.
101 virtual Rectangle
updateHighlight(bool bVisible
, const Point
& rPoint
);
103 /// Text to be used for the tooltip.
105 void setHelpText (const OUString
&sText
) { maHelpText
= sText
; }
107 virtual OUString
getHelpText() const { return maHelpText
; };
108 virtual OUString
getTitle() const { return maTitle
; };
110 void setTitle (const OUString
& rTitle
);
112 css::uno::Reference
< css::accessibility::XAccessible
>
113 GetAccessible( bool bIsTransientChildrenDisabled
);
115 void setDrawArea (const Rectangle
&area
);
117 const Rectangle
& getDrawArea () const { return maDrawArea
; }
119 virtual void calculateItemsPosition (const long nThumbnailHeight
, const long nDisplayHeight
,
120 const long nPadding
, sal_uInt32 nMaxTextLength
,
121 const ThumbnailItemAttributes
*pAttrs
);
123 virtual void Paint (drawinglayer::processor2d::BaseProcessor2D
*pProcessor
,
124 const ThumbnailItemAttributes
*pAttrs
);
125 void addTextPrimitives (const OUString
& rText
, const ThumbnailItemAttributes
*pAttrs
, Point aPos
, drawinglayer::primitive2d::Primitive2DContainer
& rSeq
);
127 static drawinglayer::primitive2d::PolygonHairlinePrimitive2D
*
128 createBorderLine (const basegfx::B2DPolygon
&rPolygon
);
130 virtual void MouseButtonUp(const MouseEvent
&) {}
136 Rectangle maDrawArea
;
139 #endif // INCLUDED_SFX2_THUMBNAILVIEWITEM_HXX
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */