Handle pasting disallowed clipboard contents on iOS
[LibreOffice.git] / include / sfx2 / thumbnailviewitem.hxx
blobbd72ee30c9d625b1925196a2d42f25a0526f3dda
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 <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; }
31 #define THUMBNAILVIEW_ITEM_NONEITEM 0xFFFE
33 const int THUMBNAILVIEW_ITEM_CORNER = 5;
35 class ThumbnailView;
36 class MouseEvent;
38 namespace basegfx {
39 class B2DPolygon;
42 namespace drawinglayer {
43 namespace processor2d {
44 class BaseProcessor2D;
46 namespace primitive2d {
47 class PolygonHairlinePrimitive2D;
51 struct ThumbnailItemAttributes
53 sal_uInt32 nMaxTextLength;
54 basegfx::BColor aFillColor;
55 basegfx::BColor aTextColor;
56 basegfx::BColor aHighlightColor;
57 basegfx::BColor aHighlightTextColor;
58 basegfx::BColor aSelectHighlightColor;
59 basegfx::BColor aSelectHighlightTextColor;
60 double fHighlightTransparence;
61 basegfx::B2DVector aFontSize;
62 drawinglayer::attribute::FontAttribute aFontAttr;
65 class 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 css::uno::Reference< css::accessibility::XAccessible > mxAcc;
80 ThumbnailViewItem(ThumbnailView& 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 void calculateItemsPosition (const tools::Long nThumbnailHeight,
119 const tools::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 rtl::Reference<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 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */