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