Bump version to 6.4-15
[LibreOffice.git] / include / sfx2 / thumbnailviewitem.hxx
blobe5be46e9bb2b42b26c14f2c545282d49fc9caa85
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <vcl/bitmapex.hxx>
26 #include <sfx2/dllapi.h>
28 namespace com::sun::star::accessibility { class XAccessible; }
29 namespace drawinglayer::primitive2d { class Primitive2DContainer; }
31 #define THUMBNAILVIEW_ITEM_NONEITEM 0xFFFE
33 const int THUMBNAILVIEW_ITEM_CORNER = 5;
35 class ThumbnailViewBase;
36 class MouseEvent;
38 namespace basegfx {
39 class B2DPolygon;
42 namespace drawinglayer {
43 namespace processor2d {
44 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 basegfx::BColor aSelectHighlightColor;
60 basegfx::BColor aSelectHighlightTextColor;
61 double fHighlightTransparence;
62 basegfx::B2DVector aFontSize;
63 drawinglayer::attribute::FontAttribute aFontAttr;
66 class ThumbnailViewItem
68 public:
70 ThumbnailViewBase &mrParent;
71 sal_uInt16 const mnId;
72 bool mbVisible;
73 bool mbSelected;
74 bool mbHover;
75 BitmapEx maPreview1;
76 OUString maTitle;
77 OUString maHelpText;
78 css::uno::Reference< css::accessibility::XAccessible > mxAcc;
80 ThumbnailViewItem (ThumbnailViewBase &rView, sal_uInt16 nId);
82 virtual ~ThumbnailViewItem ();
84 bool isVisible () const { return mbVisible; }
86 void show (bool bVisible);
88 bool isSelected () const { return mbSelected; }
90 void setSelection (bool state);
92 bool isHighlighted () const { return mbHover; }
94 void setHighlight (bool state);
96 /** Updates own highlight status based on the aPoint position.
98 Returns rectangle that needs to be invalidated.
100 virtual tools::Rectangle updateHighlight(bool bVisible, const Point& rPoint);
102 /// Text to be used for the tooltip.
104 void setHelpText (const OUString &sText) { maHelpText = sText; }
106 virtual OUString getHelpText() const { return maHelpText; };
107 OUString const & getTitle() const { return maTitle; };
109 void setTitle (const OUString& rTitle);
111 css::uno::Reference< css::accessibility::XAccessible > const &
112 GetAccessible( bool bIsTransientChildrenDisabled );
114 void setDrawArea (const tools::Rectangle &area);
116 const tools::Rectangle& getDrawArea () const { return maDrawArea; }
118 virtual void calculateItemsPosition (const long nThumbnailHeight,
119 const long nPadding, sal_uInt32 nMaxTextLength,
120 const ThumbnailItemAttributes *pAttrs);
122 virtual void Paint (drawinglayer::processor2d::BaseProcessor2D *pProcessor,
123 const ThumbnailItemAttributes *pAttrs);
124 void addTextPrimitives (const OUString& rText, const ThumbnailItemAttributes *pAttrs, Point aPos, drawinglayer::primitive2d::Primitive2DContainer& rSeq);
126 static drawinglayer::primitive2d::PolygonHairlinePrimitive2D*
127 createBorderLine (const basegfx::B2DPolygon &rPolygon);
129 virtual void MouseButtonUp(const MouseEvent&) {}
131 protected:
133 Point maTextPos;
134 Point maPrev1Pos;
135 tools::Rectangle maDrawArea;
138 #endif // INCLUDED_SFX2_THUMBNAILVIEWITEM_HXX
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */