workaround segfault in compiler on macos-clang-intel
[LibreOffice.git] / include / sfx2 / thumbnailviewitem.hxx
blob2aced41486c02465dfa617e8e0b6efefd65a4b6d
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 #pragma once
22 #include <config_options.h>
23 #include <basegfx/vector/b2dvector.hxx>
24 #include <drawinglayer/attribute/fontattribute.hxx>
25 #include <vcl/bitmapex.hxx>
26 #include <sfx2/dllapi.h>
27 #include <rtl/ref.hxx>
29 namespace com::sun::star::accessibility { class XAccessible; }
30 namespace drawinglayer::primitive2d { class Primitive2DContainer; }
31 class ThumbnailViewItemAcc;
33 #define THUMBNAILVIEW_ITEM_NONEITEM 0xFFFE
35 const int THUMBNAILVIEW_ITEM_CORNER = 5;
37 class ThumbnailView;
38 class MouseEvent;
40 namespace basegfx {
41 class B2DPolygon;
44 namespace drawinglayer {
45 namespace processor2d {
46 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 double fHighlightTransparence;
61 basegfx::B2DVector aFontSize;
62 drawinglayer::attribute::FontAttribute aFontAttr;
65 class UNLESS_MERGELIBS_MORE(SFX2_DLLPUBLIC) ThumbnailViewItem
67 public:
69 ThumbnailView& mrParent;
70 sal_uInt16 mnId;
71 bool mbVisible;
72 bool mbBorder;
73 bool mbSelected;
74 bool mbHover;
75 BitmapEx maPreview1;
76 OUString maTitle;
77 OUString maHelpText;
78 rtl::Reference< ThumbnailViewItemAcc > mxAcc;
80 ThumbnailViewItem(ThumbnailView& rView, sal_uInt16 nId);
82 virtual ~ThumbnailViewItem ();
84 ThumbnailViewItem& operator=( ThumbnailViewItem const & ) = delete; // MSVC workaround
85 ThumbnailViewItem( ThumbnailViewItem const & ) = delete; // MSVC workaround
87 bool isVisible () const { return mbVisible; }
89 void show (bool bVisible);
91 bool isSelected () const { return mbSelected; }
93 void setSelection (bool state);
95 bool isHighlighted () const { return mbHover; }
97 void setHighlight (bool state);
99 /** Updates own highlight status based on the aPoint position.
101 Returns rectangle that needs to be invalidated.
103 virtual tools::Rectangle updateHighlight(bool bVisible, const Point& rPoint);
105 /// Text to be used for the tooltip.
107 void setHelpText (const OUString &sText) { maHelpText = sText; }
109 virtual OUString getHelpText() const { return maHelpText; };
110 OUString const & getTitle() const { return maTitle; };
112 void setTitle (const OUString& rTitle);
114 rtl::Reference< ThumbnailViewItemAcc > const &
115 GetAccessible( bool bIsTransientChildrenDisabled );
117 void setDrawArea (const tools::Rectangle &area);
119 const tools::Rectangle& getDrawArea () const { return maDrawArea; }
121 void calculateItemsPosition (const tools::Long nThumbnailHeight,
122 const tools::Long nPadding, sal_uInt32 nMaxTextLength,
123 const ThumbnailItemAttributes *pAttrs);
125 virtual void Paint (drawinglayer::processor2d::BaseProcessor2D *pProcessor,
126 const ThumbnailItemAttributes *pAttrs);
127 void addTextPrimitives (const OUString& rText, const ThumbnailItemAttributes *pAttrs, Point aPos, drawinglayer::primitive2d::Primitive2DContainer& rSeq);
129 static rtl::Reference<drawinglayer::primitive2d::PolygonHairlinePrimitive2D>
130 createBorderLine (const basegfx::B2DPolygon &rPolygon);
132 virtual void MouseButtonUp(const MouseEvent&) {}
134 protected:
136 Point maTextPos;
137 Point maPrev1Pos;
138 Point maPinPos;
139 tools::Rectangle maDrawArea;
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */