xref: /trunk/main/svx/source/sdr/properties/e3dcompoundproperties.cxx (revision cf6516809c57e1bb0a940545cca99cdad54d4ce2)
1*f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*f6e50924SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f6e50924SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f6e50924SAndrew Rist  * distributed with this work for additional information
6*f6e50924SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f6e50924SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f6e50924SAndrew Rist  * "License"); you may not use this file except in compliance
9*f6e50924SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*f6e50924SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f6e50924SAndrew Rist  * software distributed under the License is distributed on an
15*f6e50924SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f6e50924SAndrew Rist  * KIND, either express or implied.  See the License for the
17*f6e50924SAndrew Rist  * specific language governing permissions and limitations
18*f6e50924SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*f6e50924SAndrew Rist  *************************************************************/
21*f6e50924SAndrew Rist 
22*f6e50924SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir #include <svx/sdr/properties/e3dcompoundproperties.hxx>
27cdf0e10cSrcweir #include <svl/itemset.hxx>
28cdf0e10cSrcweir #include <svx/obj3d.hxx>
29cdf0e10cSrcweir #include <svx/scene3d.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
32cdf0e10cSrcweir 
33cdf0e10cSrcweir namespace sdr
34cdf0e10cSrcweir {
35cdf0e10cSrcweir     namespace properties
36cdf0e10cSrcweir     {
E3dCompoundProperties(SdrObject & rObj)37cdf0e10cSrcweir         E3dCompoundProperties::E3dCompoundProperties(SdrObject& rObj)
38cdf0e10cSrcweir         :   E3dProperties(rObj)
39cdf0e10cSrcweir         {
40cdf0e10cSrcweir         }
41cdf0e10cSrcweir 
E3dCompoundProperties(const E3dCompoundProperties & rProps,SdrObject & rObj)42cdf0e10cSrcweir         E3dCompoundProperties::E3dCompoundProperties(const E3dCompoundProperties& rProps, SdrObject& rObj)
43cdf0e10cSrcweir         :   E3dProperties(rProps, rObj)
44cdf0e10cSrcweir         {
45cdf0e10cSrcweir         }
46cdf0e10cSrcweir 
~E3dCompoundProperties()47cdf0e10cSrcweir         E3dCompoundProperties::~E3dCompoundProperties()
48cdf0e10cSrcweir         {
49cdf0e10cSrcweir         }
50cdf0e10cSrcweir 
Clone(SdrObject & rObj) const51cdf0e10cSrcweir         BaseProperties& E3dCompoundProperties::Clone(SdrObject& rObj) const
52cdf0e10cSrcweir         {
53cdf0e10cSrcweir             return *(new E3dCompoundProperties(*this, rObj));
54cdf0e10cSrcweir         }
55cdf0e10cSrcweir 
GetObjectItemSet() const56cdf0e10cSrcweir         const SfxItemSet& E3dCompoundProperties::GetObjectItemSet() const
57cdf0e10cSrcweir         {
58cdf0e10cSrcweir             //DBG_ASSERT(sal_False, "E3dCompoundProperties::GetObjectItemSet() maybe the wrong call (!)");
59cdf0e10cSrcweir             return E3dProperties::GetObjectItemSet();
60cdf0e10cSrcweir         }
61cdf0e10cSrcweir 
GetMergedItemSet() const62cdf0e10cSrcweir         const SfxItemSet& E3dCompoundProperties::GetMergedItemSet() const
63cdf0e10cSrcweir         {
64cdf0e10cSrcweir             // include Items of scene this object belongs to
65cdf0e10cSrcweir             E3dCompoundObject& rObj = (E3dCompoundObject&)GetSdrObject();
66cdf0e10cSrcweir             E3dScene* pScene = rObj.GetScene();
67cdf0e10cSrcweir 
68cdf0e10cSrcweir             if(pScene)
69cdf0e10cSrcweir             {
70cdf0e10cSrcweir                 // force ItemSet
71cdf0e10cSrcweir                 GetObjectItemSet();
72cdf0e10cSrcweir 
73cdf0e10cSrcweir                 // add filtered scene properties (SDRATTR_3DSCENE_) to local itemset
74cdf0e10cSrcweir                 SfxItemSet aSet(*mpItemSet->GetPool(), SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST);
75cdf0e10cSrcweir                 aSet.Put(pScene->GetProperties().GetObjectItemSet());
76cdf0e10cSrcweir                 mpItemSet->Put(aSet);
77cdf0e10cSrcweir             }
78cdf0e10cSrcweir 
79cdf0e10cSrcweir             // call parent
80cdf0e10cSrcweir             return E3dProperties::GetMergedItemSet();
81cdf0e10cSrcweir         }
82cdf0e10cSrcweir 
SetMergedItemSet(const SfxItemSet & rSet,sal_Bool bClearAllItems)83cdf0e10cSrcweir         void E3dCompoundProperties::SetMergedItemSet(const SfxItemSet& rSet, sal_Bool bClearAllItems)
84cdf0e10cSrcweir         {
85cdf0e10cSrcweir             // Set scene specific items at scene
86cdf0e10cSrcweir             E3dCompoundObject& rObj = (E3dCompoundObject&)GetSdrObject();
87cdf0e10cSrcweir             E3dScene* pScene = rObj.GetScene();
88cdf0e10cSrcweir 
89cdf0e10cSrcweir             if(pScene)
90cdf0e10cSrcweir             {
91cdf0e10cSrcweir                 // force ItemSet
92cdf0e10cSrcweir                 GetObjectItemSet();
93cdf0e10cSrcweir 
94cdf0e10cSrcweir                 // Generate filtered scene properties (SDRATTR_3DSCENE_) itemset
95cdf0e10cSrcweir                 SfxItemSet aSet(*mpItemSet->GetPool(), SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST);
96cdf0e10cSrcweir                 aSet.Put(rSet);
97cdf0e10cSrcweir 
98cdf0e10cSrcweir                 if(bClearAllItems)
99cdf0e10cSrcweir                 {
100cdf0e10cSrcweir                     pScene->GetProperties().ClearObjectItem();
101cdf0e10cSrcweir                 }
102cdf0e10cSrcweir 
103cdf0e10cSrcweir                 if(aSet.Count())
104cdf0e10cSrcweir                 {
105cdf0e10cSrcweir                     pScene->GetProperties().SetObjectItemSet(aSet);
106cdf0e10cSrcweir                 }
107cdf0e10cSrcweir             }
108cdf0e10cSrcweir 
109cdf0e10cSrcweir             // call parent. This will set items on local object, too.
110cdf0e10cSrcweir             E3dProperties::SetMergedItemSet(rSet, bClearAllItems);
111cdf0e10cSrcweir         }
112cdf0e10cSrcweir 
PostItemChange(const sal_uInt16 nWhich)113cdf0e10cSrcweir         void E3dCompoundProperties::PostItemChange(const sal_uInt16 nWhich)
114cdf0e10cSrcweir         {
115cdf0e10cSrcweir             // call parent
116cdf0e10cSrcweir             E3dProperties::PostItemChange(nWhich);
117cdf0e10cSrcweir 
118cdf0e10cSrcweir             // handle value change
119cdf0e10cSrcweir             E3dCompoundObject& rObj = (E3dCompoundObject&)GetSdrObject();
120cdf0e10cSrcweir 
121cdf0e10cSrcweir             switch(nWhich)
122cdf0e10cSrcweir             {
123cdf0e10cSrcweir                 // #i28528#
124cdf0e10cSrcweir                 // Added extra Item (Bool) for chart2 to be able to show reduced line geometry
125cdf0e10cSrcweir                 case SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY:
126cdf0e10cSrcweir                 {
127cdf0e10cSrcweir                     rObj.ActionChanged();
128cdf0e10cSrcweir                     break;
129cdf0e10cSrcweir                 }
130cdf0e10cSrcweir                 case SDRATTR_3DOBJ_DOUBLE_SIDED:
131cdf0e10cSrcweir                 {
132cdf0e10cSrcweir                     rObj.ActionChanged();
133cdf0e10cSrcweir                     break;
134cdf0e10cSrcweir                 }
135cdf0e10cSrcweir                 case SDRATTR_3DOBJ_NORMALS_KIND:
136cdf0e10cSrcweir                 {
137cdf0e10cSrcweir                     rObj.ActionChanged();
138cdf0e10cSrcweir                     break;
139cdf0e10cSrcweir                 }
140cdf0e10cSrcweir                 case SDRATTR_3DOBJ_NORMALS_INVERT:
141cdf0e10cSrcweir                 {
142cdf0e10cSrcweir                     rObj.ActionChanged();
143cdf0e10cSrcweir                     break;
144cdf0e10cSrcweir                 }
145cdf0e10cSrcweir                 case SDRATTR_3DOBJ_TEXTURE_PROJ_X:
146cdf0e10cSrcweir                 {
147cdf0e10cSrcweir                     rObj.ActionChanged();
148cdf0e10cSrcweir                     break;
149cdf0e10cSrcweir                 }
150cdf0e10cSrcweir                 case SDRATTR_3DOBJ_TEXTURE_PROJ_Y:
151cdf0e10cSrcweir                 {
152cdf0e10cSrcweir                     rObj.ActionChanged();
153cdf0e10cSrcweir                     break;
154cdf0e10cSrcweir                 }
155cdf0e10cSrcweir             }
156cdf0e10cSrcweir         }
157cdf0e10cSrcweir     } // end of namespace properties
158cdf0e10cSrcweir } // end of namespace sdr
159cdf0e10cSrcweir 
160cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
161cdf0e10cSrcweir // eof
162