LibreOffice Module sc (master)  1
overlayobject.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  * 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 #include <overlayobject.hxx>
27 #include <officecfg/Office/Common.hxx>
28 
31 
32 #define DASH_UPDATE_INTERVAL 500 // in msec
33 
34 ScOverlayDashedBorder::ScOverlayDashedBorder(const ::basegfx::B2DRange& rRange, const Color& rColor) :
35  OverlayObject(rColor),
36  mbToggle(true)
37 {
38  mbAllowsAnimation = officecfg::Office::Common::VCL::AnimationsEnabled::get();
39  maRange = rRange;
40 }
41 
43 {
44 }
45 
46 void ScOverlayDashedBorder::Trigger(sal_uInt32 nTime)
47 {
49  if (pMgr)
50  {
52  mbToggle = !mbToggle;
53  pMgr->InsertEvent(*this);
54  objectChange();
55  }
56 }
57 
59 {
60  objectChange();
61 }
62 
64 {
65  using ::basegfx::B2DPolygon;
66  using ::basegfx::B2DPolyPolygon;
67 
69  if (!pMgr)
71 
72  basegfx::BColor aColorA = pMgr->getStripeColorA().getBColor();
73  basegfx::BColor aColorB = pMgr->getStripeColorB().getBColor();
74  if (!mbToggle)
75  ::std::swap(aColorA, aColorB);
76 
78  B2DPolyPolygon aPolygon(aPoly);
81  aPolygon, aColorA, aColorB, pMgr->getStripeLengthPixel()));
82 
84 }
85 
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
::basegfx::B2DRange maRange
virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence() override
#define DASH_UPDATE_INTERVAL
OverlayManager * getOverlayManager() const
ScOverlayDashedBorder(const ::basegfx::B2DRange &rRange, const Color &rColor)
void SetTime(sal_uInt32 nNew)
virtual void Trigger(sal_uInt32 nTime) override
const Color & getStripeColorB() const
B2DPolygon createPolygonFromRect(const B2DRectangle &rRect, double fRadiusX, double fRadiusY)
const Color & getStripeColorA() const
void InsertEvent(sdr::animation::Event &rNew)
css::uno::Reference< css::graphic::XPrimitive2D > Primitive2DReference
virtual ~ScOverlayDashedBorder() override
virtual void stripeDefinitionHasChanged() override
basegfx::BColor getBColor() const
sal_uInt32 getStripeLengthPixel() const