LibreOffice Module sfx2 (master) 1
templateviewitem.cxx
Go to the documentation of this file.
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
10#include <templateviewitem.hxx>
11
21#include <tools/poly.hxx>
22#include <vcl/graph.hxx>
23
24#include <bitmaps.hlst>
25
26using namespace basegfx;
27using namespace basegfx::utils;
28using namespace drawinglayer::attribute;
29using namespace drawinglayer::primitive2d;
30
32 : ThumbnailViewItem(rView, nId),
33 mnRegionId(USHRT_MAX),
34 mnDocId(USHRT_MAX),
35 maDefaultBitmap(BMP_DEFAULT),
36 mbIsDefaultTemplate(false)
37{
38}
39
41{
42}
43
45{
48
49 return ::tools::Rectangle(
51 aSize);
52}
53
55 const ThumbnailItemAttributes *pAttrs)
56{
57 BColor aFillColor = pAttrs->aFillColor;
58
60 double fTransparence = 0.0;
61
62 // Draw background
63 if( mbSelected && mbHover)
64 aFillColor = pAttrs->aSelectHighlightColor;
65 else if (mbSelected || mbHover)
66 {
67 aFillColor = pAttrs->aHighlightColor;
68 if (mbHover)
69 fTransparence = pAttrs->fHighlightTransparence;
70 }
71
74 aFillColor,
75 fTransparence,
76 0.0,
77 true));
78
79 // Draw thumbnail
80 Size aImageSize = maPreview1.GetSizePixel();
81
82 float fWidth = aImageSize.Width();
83 float fHeight = aImageSize.Height();
84 float fPosX = maPrev1Pos.getX();
85 float fPosY = maPrev1Pos.getY();
86
87 B2DPolygon aBounds;
88 aBounds.append(B2DPoint(fPosX,fPosY));
89 aBounds.append(B2DPoint(fPosX+fWidth,fPosY));
90 aBounds.append(B2DPoint(fPosX+fWidth,fPosY+fHeight));
91 aBounds.append(B2DPoint(fPosX,fPosY+fHeight));
92 aBounds.setClosed(true);
93
96
100 B2DRange(
101 B2DPoint(0,0),
102 B2DPoint(aImageSize.Width(),aImageSize.Height())),
103 false)
104 ));
105
106 // draw thumbnail borders
108
110 {
111 Point aIconPos(getDefaultIconArea().TopLeft());
112
114 B2DPoint(aIconPos.X(), aIconPos.Y())));
115 }
116
118
119 pProcessor->process(aSeq);
120}
121
122/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
123
124
const Size & GetSizePixel() const
basegfx::BColor getBColor() const
constexpr tools::Long Y() const
constexpr tools::Long X() const
constexpr tools::Long getX() const
constexpr tools::Long getY() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
tools::Rectangle getDefaultIconArea() const
virtual void Paint(drawinglayer::processor2d::BaseProcessor2D *pProcessor, const ThumbnailItemAttributes *pAttrs) override
TemplateViewItem(ThumbnailView &rView, sal_uInt16 nId)
virtual ~TemplateViewItem() override
static rtl::Reference< drawinglayer::primitive2d::PolygonHairlinePrimitive2D > createBorderLine(const basegfx::B2DPolygon &rPolygon)
tools::Rectangle maDrawArea
void addTextPrimitives(const OUString &rText, const ThumbnailItemAttributes *pAttrs, Point aPos, drawinglayer::primitive2d::Primitive2DContainer &rSeq)
const tools::Rectangle & getDrawArea() const
Class to display thumbnails with their names below their respective icons.
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
void setClosed(bool bNew)
void process(const primitive2d::Primitive2DContainer &rSource)
constexpr tools::Long Top() const
constexpr tools::Long Left() const
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
Sequence< sal_Int8 > aSeq
Definition: lnkbase2.cxx:83
B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY)
rtl::Reference< BasePrimitive2D > Primitive2DReference
sal_Int16 nId
basegfx::BColor aSelectHighlightColor
basegfx::BColor aHighlightColor
const int THUMBNAILVIEW_ITEM_CORNER