1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_svx.hxx"
30 #include <svx/sdr/properties/e3dcompoundproperties.hxx>
31 #include <svl/itemset.hxx>
32 #include <svx/obj3d.hxx>
33 #include <svx/scene3d.hxx>
34 
35 //////////////////////////////////////////////////////////////////////////////
36 
37 namespace sdr
38 {
39 	namespace properties
40 	{
41 		E3dCompoundProperties::E3dCompoundProperties(SdrObject& rObj)
42 		:	E3dProperties(rObj)
43 		{
44 		}
45 
46 		E3dCompoundProperties::E3dCompoundProperties(const E3dCompoundProperties& rProps, SdrObject& rObj)
47 		:	E3dProperties(rProps, rObj)
48 		{
49 		}
50 
51 		E3dCompoundProperties::~E3dCompoundProperties()
52 		{
53 		}
54 
55 		BaseProperties& E3dCompoundProperties::Clone(SdrObject& rObj) const
56 		{
57 			return *(new E3dCompoundProperties(*this, rObj));
58 		}
59 
60 		const SfxItemSet& E3dCompoundProperties::GetObjectItemSet() const
61 		{
62 			//DBG_ASSERT(sal_False, "E3dCompoundProperties::GetObjectItemSet() maybe the wrong call (!)");
63 			return E3dProperties::GetObjectItemSet();
64 		}
65 
66 		const SfxItemSet& E3dCompoundProperties::GetMergedItemSet() const
67 		{
68 			// include Items of scene this object belongs to
69 			E3dCompoundObject& rObj = (E3dCompoundObject&)GetSdrObject();
70 			E3dScene* pScene = rObj.GetScene();
71 
72 			if(pScene)
73 			{
74 				// force ItemSet
75 				GetObjectItemSet();
76 
77 				// add filtered scene properties (SDRATTR_3DSCENE_) to local itemset
78 				SfxItemSet aSet(*mpItemSet->GetPool(), SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST);
79 				aSet.Put(pScene->GetProperties().GetObjectItemSet());
80 				mpItemSet->Put(aSet);
81 			}
82 
83 			// call parent
84 			return E3dProperties::GetMergedItemSet();
85 		}
86 
87 		void E3dCompoundProperties::SetMergedItemSet(const SfxItemSet& rSet, sal_Bool bClearAllItems)
88 		{
89 			// Set scene specific items at scene
90 			E3dCompoundObject& rObj = (E3dCompoundObject&)GetSdrObject();
91 			E3dScene* pScene = rObj.GetScene();
92 
93 			if(pScene)
94 			{
95 				// force ItemSet
96 				GetObjectItemSet();
97 
98 				// Generate filtered scene properties (SDRATTR_3DSCENE_) itemset
99 				SfxItemSet aSet(*mpItemSet->GetPool(), SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST);
100 				aSet.Put(rSet);
101 
102 				if(bClearAllItems)
103 				{
104 					pScene->GetProperties().ClearObjectItem();
105 				}
106 
107 				if(aSet.Count())
108 				{
109 					pScene->GetProperties().SetObjectItemSet(aSet);
110 				}
111 			}
112 
113 			// call parent. This will set items on local object, too.
114 			E3dProperties::SetMergedItemSet(rSet, bClearAllItems);
115 		}
116 
117 		void E3dCompoundProperties::PostItemChange(const sal_uInt16 nWhich)
118 		{
119 			// call parent
120 			E3dProperties::PostItemChange(nWhich);
121 
122 			// handle value change
123 			E3dCompoundObject& rObj = (E3dCompoundObject&)GetSdrObject();
124 
125 			switch(nWhich)
126 			{
127 				// #i28528#
128 				// Added extra Item (Bool) for chart2 to be able to show reduced line geometry
129 				case SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY:
130 				{
131 					rObj.ActionChanged();
132 					break;
133 				}
134 				case SDRATTR_3DOBJ_DOUBLE_SIDED:
135 				{
136 					rObj.ActionChanged();
137 					break;
138 				}
139 				case SDRATTR_3DOBJ_NORMALS_KIND:
140 				{
141 					rObj.ActionChanged();
142 					break;
143 				}
144 				case SDRATTR_3DOBJ_NORMALS_INVERT:
145 				{
146 					rObj.ActionChanged();
147 					break;
148 				}
149 				case SDRATTR_3DOBJ_TEXTURE_PROJ_X:
150 				{
151 					rObj.ActionChanged();
152 					break;
153 				}
154 				case SDRATTR_3DOBJ_TEXTURE_PROJ_Y:
155 				{
156 					rObj.ActionChanged();
157 					break;
158 				}
159 			}
160 		}
161 	} // end of namespace properties
162 } // end of namespace sdr
163 
164 //////////////////////////////////////////////////////////////////////////////
165 // eof
166