/src/libreoffice/svx/source/sdr/properties/e3dcompoundproperties.cxx
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
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/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
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 . |
18 | | */ |
19 | | |
20 | | #include <sdr/properties/e3dcompoundproperties.hxx> |
21 | | #include <svl/itemset.hxx> |
22 | | #include <svx/obj3d.hxx> |
23 | | #include <svx/scene3d.hxx> |
24 | | |
25 | | |
26 | | namespace sdr::properties |
27 | | { |
28 | | E3dCompoundProperties::E3dCompoundProperties(SdrObject& rObj) |
29 | 10.4k | : E3dProperties(rObj) |
30 | 10.4k | { |
31 | 10.4k | } |
32 | | |
33 | | E3dCompoundProperties::E3dCompoundProperties(const E3dCompoundProperties& rProps, SdrObject& rObj) |
34 | 0 | : E3dProperties(rProps, rObj) |
35 | 0 | { |
36 | 0 | } |
37 | | |
38 | | E3dCompoundProperties::~E3dCompoundProperties() |
39 | 10.4k | { |
40 | 10.4k | } |
41 | | |
42 | | std::unique_ptr<BaseProperties> E3dCompoundProperties::Clone(SdrObject& rObj) const |
43 | 0 | { |
44 | 0 | return std::unique_ptr<BaseProperties>(new E3dCompoundProperties(*this, rObj)); |
45 | 0 | } |
46 | | |
47 | | const SfxItemSet& E3dCompoundProperties::GetMergedItemSet() const |
48 | 4.38k | { |
49 | | // include Items of scene this object belongs to |
50 | 4.38k | const E3dCompoundObject& rObj = static_cast<const E3dCompoundObject&>(GetSdrObject()); |
51 | 4.38k | E3dScene* pScene(rObj.getRootE3dSceneFromE3dObject()); |
52 | | |
53 | 4.38k | if(nullptr != pScene) |
54 | 0 | { |
55 | | // force ItemSet |
56 | 0 | GetObjectItemSet(); |
57 | | |
58 | | // add filtered scene properties (SDRATTR_3DSCENE_) to local itemset |
59 | 0 | SfxItemSet aSet(SfxItemSet::makeFixedSfxItemSet<SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST>(*moItemSet->GetPool())); |
60 | 0 | aSet.Put(pScene->GetProperties().GetObjectItemSet()); |
61 | 0 | moItemSet->Put(aSet); |
62 | 0 | } |
63 | | |
64 | | // call parent |
65 | 4.38k | return E3dProperties::GetMergedItemSet(); |
66 | 4.38k | } |
67 | | |
68 | | void E3dCompoundProperties::SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems, bool bAdjustTextFrameWidthAndHeight) |
69 | 10.4k | { |
70 | | // Set scene specific items at scene |
71 | 10.4k | E3dCompoundObject& rObj = static_cast<E3dCompoundObject&>(GetSdrObject()); |
72 | 10.4k | E3dScene* pScene(rObj.getRootE3dSceneFromE3dObject()); |
73 | | |
74 | 10.4k | if(nullptr != pScene) |
75 | 0 | { |
76 | | // force ItemSet |
77 | 0 | GetObjectItemSet(); |
78 | | |
79 | | // Generate filtered scene properties (SDRATTR_3DSCENE_) itemset |
80 | 0 | SfxItemSet aSet(SfxItemSet::makeFixedSfxItemSet<SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST>(*moItemSet->GetPool())); |
81 | 0 | aSet.Put(rSet); |
82 | |
|
83 | 0 | if(bClearAllItems) |
84 | 0 | { |
85 | 0 | pScene->GetProperties().ClearObjectItem(); |
86 | 0 | } |
87 | |
|
88 | 0 | if(aSet.Count()) |
89 | 0 | { |
90 | 0 | pScene->GetProperties().SetObjectItemSet(aSet); |
91 | 0 | } |
92 | 0 | } |
93 | | |
94 | | // call parent. This will set items on local object, too. |
95 | 10.4k | E3dProperties::SetMergedItemSet(rSet, bClearAllItems, bAdjustTextFrameWidthAndHeight); |
96 | 10.4k | } |
97 | | |
98 | | void E3dCompoundProperties::PostItemChange(const sal_uInt16 nWhich) |
99 | 304k | { |
100 | | // call parent |
101 | 304k | E3dProperties::PostItemChange(nWhich); |
102 | | |
103 | | // handle value change |
104 | 304k | E3dCompoundObject& rObj = static_cast<E3dCompoundObject&>(GetSdrObject()); |
105 | | |
106 | 304k | switch(nWhich) |
107 | 304k | { |
108 | | // #i28528# |
109 | | // Added extra Item (Bool) for chart2 to be able to show reduced line geometry |
110 | 0 | case SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY: |
111 | 0 | { |
112 | 0 | rObj.ActionChanged(); |
113 | 0 | break; |
114 | 0 | } |
115 | 8.70k | case SDRATTR_3DOBJ_DOUBLE_SIDED: |
116 | 8.70k | { |
117 | 8.70k | rObj.ActionChanged(); |
118 | 8.70k | break; |
119 | 0 | } |
120 | 10.4k | case SDRATTR_3DOBJ_NORMALS_KIND: |
121 | 10.4k | { |
122 | 10.4k | rObj.ActionChanged(); |
123 | 10.4k | break; |
124 | 0 | } |
125 | 0 | case SDRATTR_3DOBJ_NORMALS_INVERT: |
126 | 0 | { |
127 | 0 | rObj.ActionChanged(); |
128 | 0 | break; |
129 | 0 | } |
130 | 0 | case SDRATTR_3DOBJ_TEXTURE_PROJ_X: |
131 | 0 | { |
132 | 0 | rObj.ActionChanged(); |
133 | 0 | break; |
134 | 0 | } |
135 | 0 | case SDRATTR_3DOBJ_TEXTURE_PROJ_Y: |
136 | 0 | { |
137 | 0 | rObj.ActionChanged(); |
138 | 0 | break; |
139 | 0 | } |
140 | 304k | } |
141 | 304k | } |
142 | | } // end of namespace |
143 | | |
144 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |