Bump version to 6.4-15
[LibreOffice.git] / svx / source / sdr / properties / e3dcompoundproperties.cxx
bloba7e4395665b78ae39182593d177d5ed83a323ae1
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 <sdr/properties/e3dcompoundproperties.hxx>
21 #include <svl/itemset.hxx>
22 #include <svx/obj3d.hxx>
23 #include <svx/scene3d.hxx>
26 namespace sdr
28 namespace properties
30 E3dCompoundProperties::E3dCompoundProperties(SdrObject& rObj)
31 : E3dProperties(rObj)
35 E3dCompoundProperties::E3dCompoundProperties(const E3dCompoundProperties& rProps, SdrObject& rObj)
36 : E3dProperties(rProps, rObj)
40 E3dCompoundProperties::~E3dCompoundProperties()
44 std::unique_ptr<BaseProperties> E3dCompoundProperties::Clone(SdrObject& rObj) const
46 return std::unique_ptr<BaseProperties>(new E3dCompoundProperties(*this, rObj));
49 const SfxItemSet& E3dCompoundProperties::GetMergedItemSet() const
51 // include Items of scene this object belongs to
52 const E3dCompoundObject& rObj = static_cast<const E3dCompoundObject&>(GetSdrObject());
53 E3dScene* pScene(rObj.getRootE3dSceneFromE3dObject());
55 if(nullptr != pScene)
57 // force ItemSet
58 GetObjectItemSet();
60 // add filtered scene properties (SDRATTR_3DSCENE_) to local itemset
61 SfxItemSet aSet(*mpItemSet->GetPool(), svl::Items<SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST>{});
62 aSet.Put(pScene->GetProperties().GetObjectItemSet());
63 mpItemSet->Put(aSet);
66 // call parent
67 return E3dProperties::GetMergedItemSet();
70 void E3dCompoundProperties::SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems)
72 // Set scene specific items at scene
73 E3dCompoundObject& rObj = static_cast<E3dCompoundObject&>(GetSdrObject());
74 E3dScene* pScene(rObj.getRootE3dSceneFromE3dObject());
76 if(nullptr != pScene)
78 // force ItemSet
79 GetObjectItemSet();
81 // Generate filtered scene properties (SDRATTR_3DSCENE_) itemset
82 SfxItemSet aSet(*mpItemSet->GetPool(), svl::Items<SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST>{});
83 aSet.Put(rSet);
85 if(bClearAllItems)
87 pScene->GetProperties().ClearObjectItem();
90 if(aSet.Count())
92 pScene->GetProperties().SetObjectItemSet(aSet);
96 // call parent. This will set items on local object, too.
97 E3dProperties::SetMergedItemSet(rSet, bClearAllItems);
100 void E3dCompoundProperties::PostItemChange(const sal_uInt16 nWhich)
102 // call parent
103 E3dProperties::PostItemChange(nWhich);
105 // handle value change
106 E3dCompoundObject& rObj = static_cast<E3dCompoundObject&>(GetSdrObject());
108 switch(nWhich)
110 // #i28528#
111 // Added extra Item (Bool) for chart2 to be able to show reduced line geometry
112 case SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY:
114 rObj.ActionChanged();
115 break;
117 case SDRATTR_3DOBJ_DOUBLE_SIDED:
119 rObj.ActionChanged();
120 break;
122 case SDRATTR_3DOBJ_NORMALS_KIND:
124 rObj.ActionChanged();
125 break;
127 case SDRATTR_3DOBJ_NORMALS_INVERT:
129 rObj.ActionChanged();
130 break;
132 case SDRATTR_3DOBJ_TEXTURE_PROJ_X:
134 rObj.ActionChanged();
135 break;
137 case SDRATTR_3DOBJ_TEXTURE_PROJ_Y:
139 rObj.ActionChanged();
140 break;
144 } // end of namespace properties
145 } // end of namespace sdr
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */