Teach symstore more duplicated DLLs
[LibreOffice.git] / drawinglayer / source / primitive2d / backgroundcolorprimitive2d.cxx
blob3121a3fd573bbf37f76afb678aaf07bda1b3ebfc
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 #include <drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx>
21 #include <basegfx/polygon/b2dpolygon.hxx>
22 #include <basegfx/polygon/b2dpolygontools.hxx>
23 #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
24 #include <basegfx/utils/canvastools.hxx>
25 #include <drawinglayer/geometry/viewinformation2d.hxx>
26 #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
29 using namespace com::sun::star;
32 namespace drawinglayer
34 namespace primitive2d
36 void BackgroundColorPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const
38 if(!rViewInformation.getViewport().isEmpty())
40 const basegfx::B2DPolygon aOutline(basegfx::utils::createPolygonFromRect(rViewInformation.getViewport()));
41 rContainer.push_back(new PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aOutline), getBColor()));
45 BackgroundColorPrimitive2D::BackgroundColorPrimitive2D(
46 const basegfx::BColor& rBColor,
47 double fTransparency)
48 : BufferedDecompositionPrimitive2D(),
49 maBColor(rBColor),
50 mfTransparency(fTransparency),
51 maLastViewport()
55 bool BackgroundColorPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
57 if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
59 const BackgroundColorPrimitive2D& rCompare = static_cast<const BackgroundColorPrimitive2D&>(rPrimitive);
61 return (getBColor() == rCompare.getBColor() && getTransparency() == rCompare.getTransparency());
64 return false;
67 basegfx::B2DRange BackgroundColorPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
69 // always as big as the view
70 return rViewInformation.getViewport();
73 void BackgroundColorPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
75 ::osl::MutexGuard aGuard( m_aMutex );
77 if(!getBuffered2DDecomposition().empty() && (maLastViewport != rViewInformation.getViewport()))
79 // conditions of last local decomposition have changed, delete
80 const_cast< BackgroundColorPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DContainer());
83 if(getBuffered2DDecomposition().empty())
85 // remember ViewRange
86 const_cast< BackgroundColorPrimitive2D* >(this)->maLastViewport = rViewInformation.getViewport();
89 // use parent implementation
90 BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
93 // provide unique ID
94 ImplPrimitive2DIDBlock(BackgroundColorPrimitive2D, PRIMITIVE2D_ID_BACKGROUNDCOLORPRIMITIVE2D)
96 } // end of namespace primitive2d
97 } // end of namespace drawinglayer
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */