/src/libreoffice/include/sfx2/thumbnailviewitem.hxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
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/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
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 . |
18 | | */ |
19 | | |
20 | | #pragma once |
21 | | |
22 | | #include <config_options.h> |
23 | | #include <basegfx/color/bcolor.hxx> |
24 | | #include <basegfx/vector/b2dvector.hxx> |
25 | | #include <drawinglayer/attribute/fontattribute.hxx> |
26 | | #include <vcl/bitmap.hxx> |
27 | | #include <sfx2/dllapi.h> |
28 | | #include <rtl/ref.hxx> |
29 | | |
30 | | namespace drawinglayer::primitive2d { class Primitive2DContainer; } |
31 | | class ThumbnailViewItemAcc; |
32 | | |
33 | 0 | #define THUMBNAILVIEW_ITEM_NONEITEM 0xFFFE |
34 | | |
35 | | const int THUMBNAILVIEW_ITEM_CORNER = 5; |
36 | | |
37 | | class ThumbnailView; |
38 | | class MouseEvent; |
39 | | |
40 | | namespace basegfx { |
41 | | class B2DPolygon; |
42 | | } |
43 | | |
44 | | namespace drawinglayer { |
45 | | namespace processor2d { |
46 | | class BaseProcessor2D; |
47 | | } |
48 | | namespace primitive2d { |
49 | | class PolygonHairlinePrimitive2D; |
50 | | } |
51 | | } |
52 | | |
53 | | struct ThumbnailItemAttributes |
54 | | { |
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; |
63 | | }; |
64 | | |
65 | | class UNLESS_MERGELIBS_MORE(SFX2_DLLPUBLIC) ThumbnailViewItem |
66 | | { |
67 | | public: |
68 | | |
69 | | ThumbnailView& mrParent; |
70 | | sal_uInt16 mnId; |
71 | | bool mbVisible; |
72 | | bool mbBorder; |
73 | | bool mbSelected; |
74 | | bool mbHover; |
75 | | Bitmap maPreview; |
76 | | OUString maTitle; |
77 | | OUString maHelpText; |
78 | | rtl::Reference< ThumbnailViewItemAcc > mxAcc; |
79 | | |
80 | | ThumbnailViewItem(ThumbnailView& rView, sal_uInt16 nId); |
81 | | |
82 | | virtual ~ThumbnailViewItem (); |
83 | | |
84 | | ThumbnailViewItem& operator=( ThumbnailViewItem const & ) = delete; // MSVC workaround |
85 | | ThumbnailViewItem( ThumbnailViewItem const & ) = delete; // MSVC workaround |
86 | | |
87 | 0 | bool isVisible () const { return mbVisible; } |
88 | | |
89 | | void show (bool bVisible); |
90 | | |
91 | 0 | bool isSelected () const { return mbSelected; } |
92 | | |
93 | | void setSelection (bool state); |
94 | | |
95 | 0 | bool isHighlighted () const { return mbHover; } |
96 | | |
97 | | void setHighlight (bool state); |
98 | | |
99 | | /** Updates own highlight status based on the aPoint position. |
100 | | |
101 | | Returns rectangle that needs to be invalidated. |
102 | | */ |
103 | | virtual tools::Rectangle updateHighlight(bool bVisible, const Point& rPoint); |
104 | | |
105 | | /// Text to be used for the tooltip. |
106 | | |
107 | 0 | void setHelpText (const OUString &sText) { maHelpText = sText; } |
108 | | |
109 | 0 | virtual OUString getHelpText() const { return maHelpText; }; |
110 | 0 | OUString const & getTitle() const { return maTitle; }; |
111 | | |
112 | | void setTitle (const OUString& rTitle); |
113 | | |
114 | | rtl::Reference<ThumbnailViewItemAcc> const & GetAccessible(bool bCreate = true); |
115 | | |
116 | | void setDrawArea (const tools::Rectangle &area); |
117 | | |
118 | 0 | const tools::Rectangle& getDrawArea () const { return maDrawArea; } |
119 | | |
120 | | void calculateItemsPosition (const tools::Long nThumbnailHeight, |
121 | | const tools::Long nPadding, sal_uInt32 nMaxTextLength, |
122 | | const ThumbnailItemAttributes *pAttrs); |
123 | | |
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); |
127 | | |
128 | | static rtl::Reference<drawinglayer::primitive2d::PolygonHairlinePrimitive2D> |
129 | | createBorderLine (const basegfx::B2DPolygon &rPolygon); |
130 | | |
131 | 0 | virtual void MouseButtonUp(const MouseEvent&) {} |
132 | | |
133 | | protected: |
134 | | |
135 | | Point maTextPos; |
136 | | Point maPrev1Pos; |
137 | | Point maPinPos; |
138 | | tools::Rectangle maDrawArea; |
139 | | }; |
140 | | |
141 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |