xref: /AOO41X/main/drawinglayer/source/primitive3d/modifiedcolorprimitive3d.cxx (revision 5be78d22e6c042fbf34ae49f26275dc40c5231d1)
1464702f4SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3464702f4SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4464702f4SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5464702f4SAndrew Rist  * distributed with this work for additional information
6464702f4SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7464702f4SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8464702f4SAndrew Rist  * "License"); you may not use this file except in compliance
9464702f4SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11464702f4SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13464702f4SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14464702f4SAndrew Rist  * software distributed under the License is distributed on an
15464702f4SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16464702f4SAndrew Rist  * KIND, either express or implied.  See the License for the
17464702f4SAndrew Rist  * specific language governing permissions and limitations
18464702f4SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20464702f4SAndrew Rist  *************************************************************/
21464702f4SAndrew Rist 
22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
23cdf0e10cSrcweir #include "precompiled_drawinglayer.hxx"
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #include <drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx>
26cdf0e10cSrcweir #include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
27cdf0e10cSrcweir 
28cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
29cdf0e10cSrcweir 
30cdf0e10cSrcweir using namespace com::sun::star;
31cdf0e10cSrcweir 
32cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
33cdf0e10cSrcweir 
34cdf0e10cSrcweir namespace drawinglayer
35cdf0e10cSrcweir {
36cdf0e10cSrcweir     namespace primitive3d
37cdf0e10cSrcweir     {
ModifiedColorPrimitive3D(const Primitive3DSequence & rChildren,const basegfx::BColorModifierSharedPtr & rColorModifier)38cdf0e10cSrcweir         ModifiedColorPrimitive3D::ModifiedColorPrimitive3D(
39cdf0e10cSrcweir             const Primitive3DSequence& rChildren,
40*49c58f9bSArmin Le Grand             const basegfx::BColorModifierSharedPtr& rColorModifier)
41cdf0e10cSrcweir         :   GroupPrimitive3D(rChildren),
42cdf0e10cSrcweir             maColorModifier(rColorModifier)
43cdf0e10cSrcweir         {
44cdf0e10cSrcweir         }
45cdf0e10cSrcweir 
operator ==(const BasePrimitive3D & rPrimitive) const46cdf0e10cSrcweir         bool ModifiedColorPrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
47cdf0e10cSrcweir         {
48cdf0e10cSrcweir             if(GroupPrimitive3D::operator==(rPrimitive))
49cdf0e10cSrcweir             {
50cdf0e10cSrcweir                 const ModifiedColorPrimitive3D& rCompare = (ModifiedColorPrimitive3D&)rPrimitive;
51cdf0e10cSrcweir 
52*49c58f9bSArmin Le Grand                 if(getColorModifier().get() == rCompare.getColorModifier().get())
53*49c58f9bSArmin Le Grand                 {
54*49c58f9bSArmin Le Grand                     return true;
55*49c58f9bSArmin Le Grand                 }
56*49c58f9bSArmin Le Grand 
57*49c58f9bSArmin Le Grand                 if(!getColorModifier().get() || !rCompare.getColorModifier().get())
58*49c58f9bSArmin Le Grand                 {
59*49c58f9bSArmin Le Grand                     return false;
60*49c58f9bSArmin Le Grand                 }
61*49c58f9bSArmin Le Grand 
62*49c58f9bSArmin Le Grand                 return *getColorModifier().get() == *rCompare.getColorModifier().get();
63cdf0e10cSrcweir             }
64cdf0e10cSrcweir 
65cdf0e10cSrcweir             return false;
66cdf0e10cSrcweir         }
67cdf0e10cSrcweir 
68cdf0e10cSrcweir         // provide unique ID
69cdf0e10cSrcweir         ImplPrimitrive3DIDBlock(ModifiedColorPrimitive3D, PRIMITIVE3D_ID_MODIFIEDCOLORPRIMITIVE3D)
70cdf0e10cSrcweir 
71cdf0e10cSrcweir     } // end of namespace primitive3d
72cdf0e10cSrcweir } // end of namespace drawinglayer
73cdf0e10cSrcweir 
74cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
75cdf0e10cSrcweir // eof
76