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 .
22 #include <basegfx/vector/b2dvector.hxx>
23 #include <drawinglayer/attribute/fontattribute.hxx>
24 #include <vcl/bitmapex.hxx>
25 #include <sfx2/dllapi.h>
26 #include <rtl/ref.hxx>
28 namespace com::sun::star::accessibility
{ class XAccessible
; }
29 namespace drawinglayer::primitive2d
{ class Primitive2DContainer
; }
30 class ThumbnailViewItemAcc
;
32 #define THUMBNAILVIEW_ITEM_NONEITEM 0xFFFE
34 const int THUMBNAILVIEW_ITEM_CORNER
= 5;
43 namespace drawinglayer
{
44 namespace processor2d
{
45 class BaseProcessor2D
;
47 namespace primitive2d
{
48 class PolygonHairlinePrimitive2D
;
52 struct ThumbnailItemAttributes
54 sal_uInt32 nMaxTextLength
;
55 basegfx::BColor aFillColor
;
56 basegfx::BColor aTextColor
;
57 basegfx::BColor aHighlightColor
;
58 basegfx::BColor aHighlightTextColor
;
59 double fHighlightTransparence
;
60 basegfx::B2DVector aFontSize
;
61 drawinglayer::attribute::FontAttribute aFontAttr
;
64 class SFX2_DLLPUBLIC ThumbnailViewItem
68 ThumbnailView
& mrParent
;
77 rtl::Reference
< ThumbnailViewItemAcc
> mxAcc
;
79 ThumbnailViewItem(ThumbnailView
& rView
, sal_uInt16 nId
);
81 virtual ~ThumbnailViewItem ();
83 ThumbnailViewItem
& operator=( ThumbnailViewItem
const & ) = delete; // MSVC workaround
84 ThumbnailViewItem( ThumbnailViewItem
const & ) = delete; // MSVC workaround
86 bool isVisible () const { return mbVisible
; }
88 void show (bool bVisible
);
90 bool isSelected () const { return mbSelected
; }
92 void setSelection (bool state
);
94 bool isHighlighted () const { return mbHover
; }
96 void setHighlight (bool state
);
98 /** Updates own highlight status based on the aPoint position.
100 Returns rectangle that needs to be invalidated.
102 virtual tools::Rectangle
updateHighlight(bool bVisible
, const Point
& rPoint
);
104 /// Text to be used for the tooltip.
106 void setHelpText (const OUString
&sText
) { maHelpText
= sText
; }
108 virtual OUString
getHelpText() const { return maHelpText
; };
109 OUString
const & getTitle() const { return maTitle
; };
111 void setTitle (const OUString
& rTitle
);
113 rtl::Reference
< ThumbnailViewItemAcc
> const &
114 GetAccessible( bool bIsTransientChildrenDisabled
);
116 void setDrawArea (const tools::Rectangle
&area
);
118 const tools::Rectangle
& getDrawArea () const { return maDrawArea
; }
120 void calculateItemsPosition (const tools::Long nThumbnailHeight
,
121 const tools::Long nPadding
, sal_uInt32 nMaxTextLength
,
122 const ThumbnailItemAttributes
*pAttrs
);
124 virtual void Paint (drawinglayer::processor2d::BaseProcessor2D
*pProcessor
,
125 const ThumbnailItemAttributes
*pAttrs
);
126 void addTextPrimitives (const OUString
& rText
, const ThumbnailItemAttributes
*pAttrs
, Point aPos
, drawinglayer::primitive2d::Primitive2DContainer
& rSeq
);
128 static rtl::Reference
<drawinglayer::primitive2d::PolygonHairlinePrimitive2D
>
129 createBorderLine (const basegfx::B2DPolygon
&rPolygon
);
131 virtual void MouseButtonUp(const MouseEvent
&) {}
138 tools::Rectangle maDrawArea
;
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */