/src/libreoffice/oox/source/export/DMLPresetShapeExport.cxx
Line | Count | Source |
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 | | |
10 | | #include <oox/export/DMLPresetShapeExport.hxx> |
11 | | #include <oox/token/tokens.hxx> |
12 | | |
13 | | #include <com/sun/star/beans/XPropertySet.hpp> |
14 | | #include <com/sun/star/beans/PropertyValue.hpp> |
15 | | #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp> |
16 | | #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp> |
17 | | #include <com/sun/star/drawing/XShape.hpp> |
18 | | |
19 | | #include <osl/diagnose.h> |
20 | | #include <filter/msfilter/util.hxx> |
21 | | |
22 | | #include <string_view> |
23 | | |
24 | | using namespace ::css; |
25 | | using namespace ::css::drawing; |
26 | | |
27 | | namespace oox::drawingml |
28 | | { |
29 | | // DMLPresetShapeExporter class |
30 | | |
31 | | // ctor |
32 | | DMLPresetShapeExporter::DMLPresetShapeExporter(DrawingML* pDMLExporter, |
33 | | css::uno::Reference<css::drawing::XShape> xShape) |
34 | 0 | : m_pDMLexporter(pDMLExporter) |
35 | 0 | { |
36 | | // This class only work with custom shapes! |
37 | 0 | OSL_ASSERT(xShape->getShapeType() == "com.sun.star.drawing.CustomShape"); |
38 | |
|
39 | 0 | m_xShape = std::move(xShape); |
40 | 0 | m_bHasHandleValues = false; |
41 | 0 | uno::Reference<beans::XPropertySet> xShapeProps(m_xShape, uno::UNO_QUERY); |
42 | 0 | css::uno::Sequence<css::beans::PropertyValue> aCustomShapeGeometry |
43 | 0 | = xShapeProps->getPropertyValue(u"CustomShapeGeometry"_ustr) |
44 | 0 | .get<uno::Sequence<beans::PropertyValue>>(); |
45 | |
|
46 | 0 | for (auto const& rCustomShapeGeometryItem : aCustomShapeGeometry) |
47 | 0 | { |
48 | 0 | if (rCustomShapeGeometryItem.Name == "Type") |
49 | 0 | { |
50 | 0 | m_sPresetShapeType = rCustomShapeGeometryItem.Value.get<OUString>(); |
51 | 0 | } |
52 | 0 | if (rCustomShapeGeometryItem.Name == "Handles") |
53 | 0 | { |
54 | 0 | m_bHasHandleValues = true; |
55 | 0 | m_HandleValues |
56 | 0 | = rCustomShapeGeometryItem.Value |
57 | 0 | .get<css::uno::Sequence<css::uno::Sequence<css::beans::PropertyValue>>>(); |
58 | 0 | } |
59 | 0 | if (rCustomShapeGeometryItem.Name == "AdjustmentValues") |
60 | 0 | { |
61 | 0 | m_AdjustmentValues |
62 | 0 | = rCustomShapeGeometryItem.Value |
63 | 0 | .get<css::uno::Sequence<css::drawing::EnhancedCustomShapeAdjustmentValue>>(); |
64 | 0 | } |
65 | 0 | if (rCustomShapeGeometryItem.Name == "MirroredX") |
66 | 0 | { |
67 | 0 | m_bIsFlipped.first = rCustomShapeGeometryItem.Value.get<bool>(); |
68 | 0 | } |
69 | 0 | if (rCustomShapeGeometryItem.Name == "MirroredY") |
70 | 0 | { |
71 | 0 | m_bIsFlipped.second = rCustomShapeGeometryItem.Value.get<bool>(); |
72 | 0 | } |
73 | | //if (rCustomShapeGeometryItem.Name == "Equations") |
74 | | //{ |
75 | | // m_Equations = rCustomShapeGeometryItem.Value.get<css::uno::Sequence<OUString>>(); |
76 | | //} |
77 | | //if (rCustomShapeGeometryItem.Name == "Path") |
78 | | //{ |
79 | | // m_Path = rCustomShapeGeometryItem |
80 | | // .Value.get<css::uno::Sequence<css::beans::PropertyValue>>(); |
81 | | //} |
82 | | //if (rCustomShapeGeometryItem.Name == "ViewBox") |
83 | | //{ |
84 | | // m_ViewBox = rCustomShapeGeometryItem.Value.get<css::awt::Rectangle>(); |
85 | | //} |
86 | 0 | } |
87 | 0 | }; |
88 | | |
89 | | // dtor |
90 | 0 | DMLPresetShapeExporter::~DMLPresetShapeExporter(){ |
91 | | // Do nothing |
92 | 0 | }; |
93 | | |
94 | 0 | bool DMLPresetShapeExporter::HasHandleValue() const { return m_bHasHandleValues; } |
95 | | |
96 | 0 | const OUString& DMLPresetShapeExporter::GetShapeType() const { return m_sPresetShapeType; } |
97 | | |
98 | | const css::uno::Sequence<css::uno::Sequence<css::beans::PropertyValue>>& |
99 | | DMLPresetShapeExporter::GetHandleValues() const |
100 | 0 | { |
101 | 0 | return m_HandleValues; |
102 | 0 | }; |
103 | | |
104 | | const css::uno::Sequence<css::drawing::EnhancedCustomShapeAdjustmentValue>& |
105 | | DMLPresetShapeExporter::GetAdjustmentValues() const |
106 | 0 | { |
107 | 0 | return m_AdjustmentValues; |
108 | 0 | }; |
109 | | |
110 | | css::uno::Any DMLPresetShapeExporter::GetHandleValueOfModificationPoint(sal_Int32 nPoint, |
111 | | std::u16string_view sType) |
112 | 0 | { |
113 | 0 | uno::Any aRet; |
114 | 0 | if (GetHandleValues().getLength() > nPoint) |
115 | 0 | { |
116 | 0 | for (sal_Int32 i = 0; i < GetHandleValues()[nPoint].getLength(); i++) |
117 | 0 | { |
118 | 0 | if (GetHandleValues()[nPoint][i].Name == sType) |
119 | 0 | { |
120 | 0 | aRet = GetHandleValues()[nPoint][i].Value; |
121 | 0 | break; |
122 | 0 | } |
123 | 0 | } |
124 | 0 | } |
125 | 0 | return aRet; |
126 | 0 | }; |
127 | | |
128 | | DMLPresetShapeExporter::RadiusAdjustmentValue |
129 | | DMLPresetShapeExporter::GetAdjustmentPointRadiusValue(sal_Int32 nPoint) |
130 | 0 | { |
131 | 0 | RadiusAdjustmentValue aRet; |
132 | 0 | try |
133 | 0 | { |
134 | 0 | auto aValPos = GetHandleValueOfModificationPoint(nPoint, u"Position") |
135 | 0 | .get<EnhancedCustomShapeParameterPair>(); |
136 | 0 | aRet.nMinVal = GetHandleValueOfModificationPoint(nPoint, u"RadiusRangeMinimum") |
137 | 0 | .get<EnhancedCustomShapeParameter>() |
138 | 0 | .Value.get<double>(); |
139 | 0 | aRet.nMaxVal = GetHandleValueOfModificationPoint(nPoint, u"RadiusRangeMaximum") |
140 | 0 | .get<EnhancedCustomShapeParameter>() |
141 | 0 | .Value.get<double>(); |
142 | 0 | aRet.nCurrVal = GetAdjustmentValues()[aValPos.First.Value.get<long>()].Value.get<double>(); |
143 | 0 | } |
144 | 0 | catch (...) |
145 | 0 | { |
146 | | // Do nothing. |
147 | 0 | } |
148 | 0 | return aRet; |
149 | 0 | }; |
150 | | |
151 | | DMLPresetShapeExporter::AngleAdjustmentValue |
152 | | DMLPresetShapeExporter::GetAdjustmentPointAngleValue(sal_Int32 nPoint) |
153 | 0 | { |
154 | 0 | AngleAdjustmentValue aRet; |
155 | 0 | try |
156 | 0 | { |
157 | 0 | auto aValPos = GetHandleValueOfModificationPoint(nPoint, u"Position") |
158 | 0 | .get<EnhancedCustomShapeParameterPair>(); |
159 | 0 | aRet.nMinVal = 0; |
160 | 0 | aRet.nMaxVal = 360; |
161 | 0 | aRet.nCurrVal = GetAdjustmentValues()[aValPos.Second.Value.get<long>()].Value.get<double>(); |
162 | 0 | } |
163 | 0 | catch (...) |
164 | 0 | { |
165 | | // Do nothing. |
166 | 0 | } |
167 | 0 | return aRet; |
168 | 0 | }; |
169 | | |
170 | | DMLPresetShapeExporter::XAdjustmentValue |
171 | | DMLPresetShapeExporter::GetAdjustmentPointXValue(sal_Int32 nPoint) |
172 | 0 | { |
173 | 0 | XAdjustmentValue aRet; |
174 | 0 | try |
175 | 0 | { |
176 | 0 | auto aValPos = GetHandleValueOfModificationPoint(nPoint, u"Position") |
177 | 0 | .get<EnhancedCustomShapeParameterPair>(); |
178 | 0 | aRet.nMinVal = GetHandleValueOfModificationPoint(nPoint, u"RangeXMinimum") |
179 | 0 | .get<EnhancedCustomShapeParameter>() |
180 | 0 | .Value.get<double>(); |
181 | 0 | aRet.nMaxVal = GetHandleValueOfModificationPoint(nPoint, u"RangeXMaximum") |
182 | 0 | .get<EnhancedCustomShapeParameter>() |
183 | 0 | .Value.get<double>(); |
184 | 0 | aRet.nCurrVal = GetAdjustmentValues()[aValPos.First.Value.get<long>()].Value.get<double>(); |
185 | 0 | } |
186 | 0 | catch (...) |
187 | 0 | { |
188 | | // Do nothing. |
189 | 0 | } |
190 | 0 | return aRet; |
191 | 0 | }; |
192 | | |
193 | | DMLPresetShapeExporter::YAdjustmentValue |
194 | | DMLPresetShapeExporter::GetAdjustmentPointYValue(sal_Int32 nPoint) |
195 | 0 | { |
196 | 0 | YAdjustmentValue aRet; |
197 | 0 | try |
198 | 0 | { |
199 | 0 | auto aValPos = GetHandleValueOfModificationPoint(nPoint, u"Position") |
200 | 0 | .get<EnhancedCustomShapeParameterPair>(); |
201 | 0 | aRet.nMinVal = GetHandleValueOfModificationPoint(nPoint, u"RangeYMinimum") |
202 | 0 | .get<EnhancedCustomShapeParameter>() |
203 | 0 | .Value.get<double>(); |
204 | 0 | aRet.nMaxVal = GetHandleValueOfModificationPoint(nPoint, u"RangeYMaximum") |
205 | 0 | .get<EnhancedCustomShapeParameter>() |
206 | 0 | .Value.get<double>(); |
207 | 0 | aRet.nCurrVal = GetAdjustmentValues()[aValPos.Second.Value.get<long>()].Value.get<double>(); |
208 | 0 | } |
209 | 0 | catch (...) |
210 | 0 | { |
211 | | // Do nothing. |
212 | 0 | } |
213 | 0 | return aRet; |
214 | 0 | }; |
215 | | |
216 | | bool DMLPresetShapeExporter::WriteShape() |
217 | 0 | { |
218 | 0 | if (m_pDMLexporter && m_xShape) |
219 | 0 | { |
220 | | // Case 1: We do not have adjustment points of the shape: just export it as preset |
221 | 0 | if (!m_bHasHandleValues) |
222 | 0 | { |
223 | 0 | OUString sShapeType = GetShapeType(); |
224 | 0 | const OString sPresetShape = msfilter::util::GetOOXMLPresetGeometry(sShapeType); |
225 | 0 | m_pDMLexporter->WriteShapeTransformation(m_xShape, XML_a, IsXFlipped(), IsYFlipped(), |
226 | 0 | false, false); |
227 | 0 | m_pDMLexporter->WritePresetShape(sPresetShape); |
228 | 0 | return true; |
229 | 0 | } |
230 | 0 | else // Case2: There are adjustment points what have to be converted and exported. |
231 | 0 | { |
232 | 0 | return WriteShapeWithAVlist(); |
233 | 0 | } |
234 | 0 | } |
235 | 0 | return false; |
236 | 0 | }; |
237 | | |
238 | | bool DMLPresetShapeExporter::WriteAV(const OUString& sValName, const OUString& sVal) |
239 | 0 | { |
240 | 0 | try |
241 | 0 | { |
242 | 0 | m_pDMLexporter->GetFS()->singleElementNS(XML_a, XML_gd, XML_name, sValName, XML_fmla, sVal); |
243 | 0 | return true; |
244 | 0 | } |
245 | 0 | catch (...) |
246 | 0 | { |
247 | 0 | return false; |
248 | 0 | } |
249 | 0 | }; |
250 | | |
251 | | bool DMLPresetShapeExporter::StartAVListWriting() |
252 | 0 | { |
253 | 0 | try |
254 | 0 | { |
255 | 0 | const OString aShape = msfilter::util::GetOOXMLPresetGeometry(GetShapeType()); |
256 | 0 | m_pDMLexporter->GetFS()->startElementNS(XML_a, XML_prstGeom, XML_prst, aShape); |
257 | 0 | m_pDMLexporter->GetFS()->startElementNS(XML_a, XML_avLst); |
258 | 0 | return true; |
259 | 0 | } |
260 | 0 | catch (...) |
261 | 0 | { |
262 | 0 | return false; |
263 | 0 | } |
264 | 0 | }; |
265 | | bool DMLPresetShapeExporter::EndAVListWriting() |
266 | 0 | { |
267 | 0 | try |
268 | 0 | { |
269 | 0 | m_pDMLexporter->GetFS()->endElementNS(XML_a, XML_avLst); |
270 | 0 | m_pDMLexporter->GetFS()->endElementNS(XML_a, XML_prstGeom); |
271 | 0 | return true; |
272 | 0 | } |
273 | 0 | catch (...) |
274 | 0 | { |
275 | 0 | return false; |
276 | 0 | } |
277 | 0 | }; |
278 | | |
279 | | bool DMLPresetShapeExporter::WriteShapeWithAVlist() |
280 | 0 | { |
281 | | // Remark: This method is under development. If a shape type is implemented, the corresponding, |
282 | | // return must be set to true. False means nothing done true, export done. There are many |
283 | | // types which do not have pairs in LO, they are do not have to be mapped, because import |
284 | | // filter it does with GrabBag, this method only maps the SDR ones to OOXML shapes. |
285 | |
|
286 | 0 | OString sShapeType(msfilter::util::GetOOXMLPresetGeometry(GetShapeType())); |
287 | | |
288 | | // OOXML uses 60th of degree, so 360 degree is 21 600 000 60thdeg |
289 | 0 | const tools::Long nConstOfMaxDegreeOf60th = 21600000; |
290 | 0 | try |
291 | 0 | { |
292 | 0 | if (sShapeType == "accentBorderCallout1") |
293 | 0 | { |
294 | | // LO does not have this type, so it does not necessary to be mapped. |
295 | 0 | return false; |
296 | 0 | } |
297 | 0 | if (sShapeType == "accentBorderCallout2") |
298 | 0 | { |
299 | | // LO does not have this type, so it does not necessary to be mapped. |
300 | 0 | return false; |
301 | 0 | } |
302 | 0 | if (sShapeType == "accentBorderCallout3") |
303 | 0 | { |
304 | | // LO does not have this type, so it does not necessary to be mapped. |
305 | 0 | return false; |
306 | 0 | } |
307 | 0 | if (sShapeType == "accentCallout1") |
308 | 0 | { |
309 | | // LO does not have this type, so it does not necessary to be mapped. |
310 | 0 | return false; |
311 | 0 | } |
312 | 0 | if (sShapeType == "accentCallout2") |
313 | 0 | { |
314 | | // LO does not have this type, so it does not necessary to be mapped. |
315 | 0 | return false; |
316 | 0 | } |
317 | 0 | if (sShapeType == "accentCallout3") |
318 | 0 | { |
319 | | // LO does not have this type, so it does not necessary to be mapped. |
320 | 0 | return false; |
321 | 0 | } |
322 | 0 | if (sShapeType == "actionButtonBackPrevious") |
323 | 0 | { |
324 | | // LO does not have this type, so it does not necessary to be mapped. |
325 | 0 | return false; |
326 | 0 | } |
327 | 0 | if (sShapeType == "actionButtonBeginning") |
328 | 0 | { |
329 | | // LO does not have this type, so it does not necessary to be mapped. |
330 | 0 | return false; |
331 | 0 | } |
332 | 0 | if (sShapeType == "actionButtonBlank") |
333 | 0 | { |
334 | | // LO does not have this type, so it does not necessary to be mapped. |
335 | 0 | return false; |
336 | 0 | } |
337 | 0 | if (sShapeType == "actionButtonDocument") |
338 | 0 | { |
339 | | // LO does not have this type, so it does not necessary to be mapped. |
340 | 0 | return false; |
341 | 0 | } |
342 | 0 | if (sShapeType == "actionButtonEnd") |
343 | 0 | { |
344 | | // LO does not have this type, so it does not necessary to be mapped. |
345 | 0 | return false; |
346 | 0 | } |
347 | 0 | if (sShapeType == "actionButtonForwardNext") |
348 | 0 | { |
349 | | // LO does not have this type, so it does not necessary to be mapped. |
350 | 0 | return false; |
351 | 0 | } |
352 | 0 | if (sShapeType == "actionButtonHelp") |
353 | 0 | { |
354 | | // LO does not have this type, so it does not necessary to be mapped. |
355 | 0 | return false; |
356 | 0 | } |
357 | 0 | if (sShapeType == "actionButtonHome") |
358 | 0 | { |
359 | | // LO does not have this type, so it does not necessary to be mapped. |
360 | 0 | return false; |
361 | 0 | } |
362 | 0 | if (sShapeType == "actionButtonInformation") |
363 | 0 | { |
364 | | // LO does not have this type, so it does not necessary to be mapped. |
365 | 0 | return false; |
366 | 0 | } |
367 | 0 | if (sShapeType == "actionButtonMovie") |
368 | 0 | { |
369 | | // LO does not have this type, so it does not necessary to be mapped. |
370 | 0 | return false; |
371 | 0 | } |
372 | 0 | if (sShapeType == "actionButtonReturn") |
373 | 0 | { |
374 | | // LO does not have this type, so it does not necessary to be mapped. |
375 | 0 | return false; |
376 | 0 | } |
377 | 0 | if (sShapeType == "actionButtonSound") |
378 | 0 | { |
379 | | // LO does not have this type, so it does not necessary to be mapped. |
380 | 0 | return false; |
381 | 0 | } |
382 | 0 | if (sShapeType == "arc") |
383 | 0 | { |
384 | | // LO does not have handle points for this, so CustGeom is enough. |
385 | 0 | return false; |
386 | 0 | } |
387 | 0 | if (sShapeType == "bentArrow") |
388 | 0 | { |
389 | | // LO has only one type, which have to be rotated, without handling points |
390 | | // So CustGeom enough. |
391 | 0 | return false; |
392 | 0 | } |
393 | 0 | if (sShapeType == "bentConnector2") |
394 | 0 | { |
395 | | // CustGeom Enough |
396 | 0 | return false; |
397 | 0 | } |
398 | 0 | if (sShapeType == "bentConnector3") |
399 | 0 | { |
400 | | // CustGeom Enough |
401 | 0 | return false; |
402 | 0 | } |
403 | 0 | if (sShapeType == "bentConnector4") |
404 | 0 | { |
405 | | // CustGeom Enough |
406 | 0 | return false; |
407 | 0 | } |
408 | 0 | if (sShapeType == "bentConnector5") |
409 | 0 | { |
410 | | // CustGeom Enough |
411 | 0 | return false; |
412 | 0 | } |
413 | 0 | if (sShapeType == "bentUpArrow") |
414 | 0 | { |
415 | | // CustGeom Enough, no handle points |
416 | 0 | return false; |
417 | 0 | } |
418 | 0 | if (sShapeType == "bevel") |
419 | 0 | { |
420 | 0 | auto aPoint1 = GetAdjustmentPointXValue(0); |
421 | 0 | if (!aPoint1.nCurrVal.has_value() || !aPoint1.nMaxVal.has_value() |
422 | 0 | || !aPoint1.nMinVal.has_value()) |
423 | 0 | return false; |
424 | 0 | m_pDMLexporter->WriteShapeTransformation(m_xShape, XML_a, IsXFlipped(), IsYFlipped(), |
425 | 0 | false, false); |
426 | |
|
427 | 0 | tools::Long nVal1 |
428 | 0 | = std::lround(*aPoint1.nCurrVal / (*aPoint1.nMaxVal - *aPoint1.nMinVal) * 50000); |
429 | 0 | return StartAVListWriting() |
430 | 0 | && WriteAV(u"adj"_ustr, OUString(u"val " + OUString::number(nVal1))) |
431 | 0 | && EndAVListWriting(); |
432 | 0 | } |
433 | 0 | if (sShapeType == "blockArc") |
434 | 0 | { |
435 | 0 | auto aPointR = GetAdjustmentPointRadiusValue(0); |
436 | 0 | auto aPointA = GetAdjustmentPointAngleValue(0); |
437 | 0 | if (!aPointA.nCurrVal.has_value() || !aPointA.nMaxVal.has_value() |
438 | 0 | || !aPointA.nMinVal.has_value() || !aPointR.nCurrVal.has_value() |
439 | 0 | || !aPointR.nMaxVal.has_value() || !aPointR.nMinVal.has_value()) |
440 | 0 | return false; |
441 | 0 | m_pDMLexporter->WriteShapeTransformation(m_xShape, XML_a, IsXFlipped(), IsYFlipped(), |
442 | 0 | false, false); |
443 | 0 | tools::Long nVal1 |
444 | 0 | = std::lround((*aPointA.nCurrVal < 0 ? 360 + *aPointA.nCurrVal : *aPointA.nCurrVal) |
445 | 0 | / (*aPointA.nMaxVal - *aPointA.nMinVal) * nConstOfMaxDegreeOf60th); |
446 | 0 | tools::Long nVal2 = std::lround( |
447 | 0 | (*aPointA.nCurrVal > 180 ? 360 - *aPointA.nCurrVal : 180 - *aPointA.nCurrVal) |
448 | 0 | / (*aPointA.nMaxVal - *aPointA.nMinVal) * nConstOfMaxDegreeOf60th); |
449 | 0 | tools::Long nVal3 = std::lround( |
450 | 0 | 50000 - (*aPointR.nCurrVal / (*aPointR.nMaxVal - *aPointR.nMinVal) * 50000)); |
451 | 0 | return StartAVListWriting() |
452 | 0 | && WriteAV(u"adj1"_ustr, OUString(u"val " + OUString::number(nVal1))) |
453 | 0 | && WriteAV(u"adj2"_ustr, OUString(u"val " + OUString::number(nVal2))) |
454 | 0 | && WriteAV(u"adj3"_ustr, OUString(u"val " + OUString::number(nVal3))) |
455 | 0 | && EndAVListWriting(); |
456 | 0 | } |
457 | 0 | if (sShapeType == "borderCallout1") |
458 | 0 | { |
459 | | // LO does not have this type, so it does not necessary to be mapped. |
460 | 0 | return false; |
461 | 0 | } |
462 | 0 | if (sShapeType == "borderCallout2") |
463 | 0 | { |
464 | | // LO does not have this type, so it does not necessary to be mapped. |
465 | 0 | return false; |
466 | 0 | } |
467 | 0 | if (sShapeType == "borderCallout3") |
468 | 0 | { |
469 | | // LO does not have this type, so it does not necessary to be mapped. |
470 | 0 | return false; |
471 | 0 | } |
472 | 0 | if (sShapeType == "bracePair") |
473 | 0 | { |
474 | 0 | auto aPoint1 = GetAdjustmentPointYValue(0); |
475 | 0 | if (!aPoint1.nCurrVal.has_value() || !aPoint1.nMaxVal.has_value() |
476 | 0 | || !aPoint1.nMinVal.has_value()) |
477 | 0 | return false; |
478 | | |
479 | 0 | m_pDMLexporter->WriteShapeTransformation(m_xShape, XML_a, IsXFlipped(), IsYFlipped(), |
480 | 0 | false, false); |
481 | 0 | tools::Long nVal1 |
482 | 0 | = std::lround(*aPoint1.nCurrVal / (*aPoint1.nMaxVal - *aPoint1.nMinVal) * 25000); |
483 | 0 | return StartAVListWriting() |
484 | 0 | && WriteAV(u"adj"_ustr, OUString(u"val " + OUString::number(nVal1))) |
485 | 0 | && EndAVListWriting(); |
486 | 0 | } |
487 | 0 | if (sShapeType == "bracketPair") |
488 | 0 | { |
489 | 0 | auto aPoint1 = GetAdjustmentPointYValue(0); |
490 | 0 | if (!aPoint1.nCurrVal.has_value() || !aPoint1.nMaxVal.has_value() |
491 | 0 | || !aPoint1.nMinVal.has_value()) |
492 | 0 | return false; |
493 | | |
494 | 0 | m_pDMLexporter->WriteShapeTransformation(m_xShape, XML_a, IsXFlipped(), IsYFlipped(), |
495 | 0 | false, false); |
496 | 0 | tools::Long nVal1 |
497 | 0 | = std::lround(*aPoint1.nCurrVal / (*aPoint1.nMaxVal - *aPoint1.nMinVal) * 50000); |
498 | 0 | return StartAVListWriting() |
499 | 0 | && WriteAV(u"adj"_ustr, OUString(u"val " + OUString::number(nVal1))) |
500 | 0 | && EndAVListWriting(); |
501 | 0 | } |
502 | 0 | if (sShapeType == "callout1") |
503 | 0 | { |
504 | | // LO does not have this type, so it does not necessary to be mapped. |
505 | 0 | return false; |
506 | 0 | } |
507 | 0 | if (sShapeType == "callout2") |
508 | 0 | { |
509 | | // LO does not have this type, so it does not necessary to be mapped. |
510 | 0 | return false; |
511 | 0 | } |
512 | 0 | if (sShapeType == "callout3") |
513 | 0 | { |
514 | | // LO does not have this type, so it does not necessary to be mapped. |
515 | 0 | return false; |
516 | 0 | } |
517 | 0 | if (sShapeType == "can") |
518 | 0 | { |
519 | 0 | return false; |
520 | | // Do the export as before. |
521 | 0 | } |
522 | 0 | if (sShapeType == "chartPlus") |
523 | 0 | { |
524 | | // LO does not have this type, so it does not necessary to be mapped. |
525 | 0 | return false; |
526 | 0 | } |
527 | 0 | if (sShapeType == "chartStar") |
528 | 0 | { |
529 | | // LO does not have this type, so it does not necessary to be mapped. |
530 | 0 | return false; |
531 | 0 | } |
532 | 0 | if (sShapeType == "chartX") |
533 | 0 | { |
534 | | // LO does not have this type, so it does not necessary to be mapped. |
535 | 0 | return false; |
536 | 0 | } |
537 | 0 | if (sShapeType == "chord") |
538 | 0 | { |
539 | | // CustGeom, because LO does not have handle points |
540 | 0 | return false; |
541 | 0 | } |
542 | 0 | if (sShapeType == "circularArrow") |
543 | 0 | { |
544 | | // LO does not have this type, so it does not necessary to be mapped. |
545 | 0 | return false; |
546 | 0 | } |
547 | 0 | if (sShapeType == "cloud") |
548 | 0 | { |
549 | | // CustGeom enough |
550 | 0 | return false; |
551 | 0 | } |
552 | 0 | if (sShapeType == "cloudCallout") |
553 | 0 | { |
554 | 0 | return false; |
555 | | // Works fine without this, so export it like before. |
556 | 0 | } |
557 | 0 | if (sShapeType == "cornerTabs") |
558 | 0 | { |
559 | | // LO does not have this type, so it does not necessary to be mapped. |
560 | 0 | return false; |
561 | 0 | } |
562 | 0 | if (sShapeType == "cube") |
563 | 0 | { |
564 | | // Works fine without this, so export it like before. |
565 | 0 | return false; |
566 | 0 | } |
567 | 0 | if (sShapeType == "curvedConnector2") |
568 | 0 | { |
569 | | // Not necessary to be mapped |
570 | 0 | return false; |
571 | 0 | } |
572 | 0 | if (sShapeType == "curvedConnector3") |
573 | 0 | { |
574 | | // Not necessary to be mapped |
575 | 0 | return false; |
576 | 0 | } |
577 | 0 | if (sShapeType == "curvedConnector4") |
578 | 0 | { |
579 | | // Not necessary to be mapped |
580 | 0 | return false; |
581 | 0 | } |
582 | 0 | if (sShapeType == "curvedConnector5") |
583 | 0 | { |
584 | | // Not necessary to be mapped |
585 | 0 | return false; |
586 | 0 | } |
587 | 0 | if (sShapeType == "curvedDownArrow") |
588 | 0 | { |
589 | | // LO does not have this type, so it does not necessary to be mapped. |
590 | 0 | return false; |
591 | 0 | } |
592 | 0 | if (sShapeType == "curvedLeftArrow") |
593 | 0 | { |
594 | | // LO does not have this type, so it does not necessary to be mapped. |
595 | 0 | return false; |
596 | 0 | } |
597 | 0 | if (sShapeType == "curvedRightArrow") |
598 | 0 | { |
599 | | // LO does not have this type, so it does not necessary to be mapped. |
600 | 0 | return false; |
601 | 0 | } |
602 | 0 | if (sShapeType == "curvedUpArrow") |
603 | 0 | { |
604 | | // LO does not have this type, so it does not necessary to be mapped. |
605 | 0 | return false; |
606 | 0 | } |
607 | 0 | if (sShapeType == "decagon") |
608 | 0 | { |
609 | | // LO does not have this type, so it does not necessary to be mapped. |
610 | 0 | return false; |
611 | 0 | } |
612 | 0 | if (sShapeType == "diagStripe") |
613 | 0 | { |
614 | | // LO does not have this type, so it does not necessary to be mapped. |
615 | 0 | return false; |
616 | 0 | } |
617 | 0 | if (sShapeType == "diamond") |
618 | 0 | { |
619 | | // It does not have handle points so it do not have to be mapped. |
620 | 0 | return false; |
621 | 0 | } |
622 | 0 | if (sShapeType == "dodecagon") |
623 | 0 | { |
624 | | // LO does not have this type, so it does not necessary to be mapped. |
625 | 0 | return false; |
626 | 0 | } |
627 | 0 | if (sShapeType == "donut") |
628 | 0 | { |
629 | | // TODO |
630 | 0 | return false; |
631 | 0 | } |
632 | 0 | if (sShapeType == "doubleWave") |
633 | 0 | { |
634 | | // LO does not have this type, so it does not necessary to be mapped. |
635 | 0 | return false; |
636 | 0 | } |
637 | 0 | if (sShapeType == "downArrow") |
638 | 0 | { |
639 | 0 | auto aPointX = GetAdjustmentPointXValue(0); |
640 | 0 | auto aPointY = GetAdjustmentPointYValue(0); |
641 | 0 | if (!aPointX.nCurrVal.has_value() || !aPointX.nMaxVal.has_value() |
642 | 0 | || !aPointX.nMinVal.has_value() || !aPointY.nCurrVal.has_value() |
643 | 0 | || !aPointY.nMaxVal.has_value() || !aPointY.nMinVal.has_value()) |
644 | 0 | return false; |
645 | | |
646 | 0 | m_pDMLexporter->WriteShapeTransformation(m_xShape, XML_a, IsXFlipped(), IsYFlipped(), |
647 | 0 | false, false); |
648 | 0 | tools::Long nMaxVal1 = 100000; |
649 | 0 | tools::Long nMaxVal2 |
650 | 0 | = 100000 * m_xShape->getSize().Height |
651 | 0 | / std::min(m_xShape->getSize().Width, m_xShape->getSize().Height); |
652 | 0 | tools::Long nVal1 = std::lround((*aPointX.nMaxVal - *aPointX.nCurrVal) |
653 | 0 | / (*aPointX.nMaxVal - *aPointX.nMinVal) * nMaxVal1); |
654 | 0 | tools::Long nVal2 = std::lround((*aPointY.nMaxVal - *aPointY.nCurrVal) |
655 | 0 | / (*aPointY.nMaxVal - *aPointY.nMinVal) * nMaxVal2); |
656 | 0 | return StartAVListWriting() |
657 | 0 | && WriteAV(u"adj1"_ustr, OUString(u"val " + OUString::number(nVal1))) |
658 | 0 | && WriteAV(u"adj2"_ustr, OUString(u"val " + OUString::number(nVal2))) |
659 | 0 | && EndAVListWriting(); |
660 | 0 | } |
661 | 0 | if (sShapeType == "downArrowCallout") |
662 | 0 | { |
663 | 0 | auto aNeckFromBox = GetAdjustmentPointXValue(1); |
664 | 0 | auto aHeadFromNeck = GetAdjustmentPointXValue(2); |
665 | 0 | auto aHeadHeight = GetAdjustmentPointYValue(1); |
666 | 0 | auto aBoxHeight = GetAdjustmentPointYValue(0); |
667 | 0 | if (!aNeckFromBox.nCurrVal.has_value() || !aNeckFromBox.nMaxVal.has_value() |
668 | 0 | || !aNeckFromBox.nMinVal.has_value() || !aHeadFromNeck.nCurrVal.has_value() |
669 | 0 | || !aHeadFromNeck.nMaxVal.has_value() || !aHeadFromNeck.nMinVal.has_value() |
670 | 0 | || !aHeadHeight.nCurrVal.has_value() || !aHeadHeight.nMaxVal.has_value() |
671 | 0 | || !aHeadHeight.nMinVal.has_value() || !aBoxHeight.nCurrVal.has_value() |
672 | 0 | || !aBoxHeight.nMaxVal.has_value() || !aBoxHeight.nMinVal.has_value()) |
673 | 0 | return false; |
674 | | |
675 | 0 | m_pDMLexporter->WriteShapeTransformation(m_xShape, XML_a, IsXFlipped(), IsYFlipped(), |
676 | 0 | false, false); |
677 | 0 | tools::Long nMaxVal1 |
678 | 0 | = 100000 * m_xShape->getSize().Width |
679 | 0 | / std::min(m_xShape->getSize().Width, m_xShape->getSize().Height); |
680 | 0 | tools::Long nMaxVal2 |
681 | 0 | = 50000 * m_xShape->getSize().Width |
682 | 0 | / std::min(m_xShape->getSize().Width, m_xShape->getSize().Height); |
683 | 0 | tools::Long nMaxVal3 |
684 | 0 | = 100000 * m_xShape->getSize().Height |
685 | 0 | / std::min(m_xShape->getSize().Width, m_xShape->getSize().Height); |
686 | 0 | tools::Long nVal1 |
687 | 0 | = std::lround((*aNeckFromBox.nMaxVal - *aNeckFromBox.nCurrVal) |
688 | 0 | / (*aNeckFromBox.nMaxVal - *aNeckFromBox.nMinVal) * nMaxVal1); |
689 | 0 | tools::Long nVal2 = std::lround((10800 - *aHeadFromNeck.nCurrVal) |
690 | 0 | / (10800 - *aHeadFromNeck.nMinVal) * nMaxVal2); |
691 | 0 | tools::Long nVal3 |
692 | 0 | = std::lround((*aHeadHeight.nMaxVal - *aHeadHeight.nCurrVal) |
693 | 0 | / (*aHeadHeight.nMaxVal - *aHeadHeight.nMinVal) * nMaxVal3); |
694 | 0 | tools::Long nVal4 = std::lround((*aBoxHeight.nCurrVal - *aBoxHeight.nMinVal) |
695 | 0 | / (21600 - *aBoxHeight.nMinVal) * 100000); |
696 | 0 | return StartAVListWriting() |
697 | 0 | && WriteAV(u"adj1"_ustr, OUString(u"val " + OUString::number(nVal1))) |
698 | 0 | && WriteAV(u"adj2"_ustr, OUString(u"val " + OUString::number(nVal2))) |
699 | 0 | && WriteAV(u"adj3"_ustr, OUString(u"val " + OUString::number(nVal3))) |
700 | 0 | && WriteAV(u"adj4"_ustr, OUString(u"val " + OUString::number(nVal4))) |
701 | 0 | && EndAVListWriting(); |
702 | 0 | } |
703 | 0 | if (sShapeType == "ellipse") |
704 | 0 | { |
705 | | // Does not have handle points, so preset enough. |
706 | 0 | return false; |
707 | 0 | } |
708 | 0 | if (sShapeType == "ellipseRibbon") |
709 | 0 | { |
710 | | // LO does not have this type, so it does not necessary to be mapped. |
711 | 0 | return false; |
712 | 0 | } |
713 | 0 | if (sShapeType == "ellipseRibbon2") |
714 | 0 | { |
715 | | // LO does not have this type, so it does not necessary to be mapped. |
716 | 0 | return false; |
717 | 0 | } |
718 | 0 | if (sShapeType == "flowChartAlternateProcess") |
719 | 0 | { |
720 | | // Does not have handle points, so preset enough. |
721 | 0 | return false; |
722 | 0 | } |
723 | 0 | if (sShapeType == "flowChartCollate") |
724 | 0 | { |
725 | | // Does not have handle points, so preset enough. |
726 | 0 | return false; |
727 | 0 | } |
728 | 0 | if (sShapeType == "flowChartConnector") |
729 | 0 | { |
730 | | // Does not have handle points, so preset enough. |
731 | 0 | return false; |
732 | 0 | } |
733 | 0 | if (sShapeType == "flowChartDecision") |
734 | 0 | { |
735 | | // Does not have handle points, so preset enough. |
736 | 0 | return false; |
737 | 0 | } |
738 | 0 | if (sShapeType == "flowChartDelay") |
739 | 0 | { |
740 | | // Does not have handle points, so preset enough. |
741 | 0 | return false; |
742 | 0 | } |
743 | 0 | if (sShapeType == "flowChartDisplay") |
744 | 0 | { |
745 | | // Does not have handle points, so preset enough. |
746 | 0 | return false; |
747 | 0 | } |
748 | 0 | if (sShapeType == "flowChartDocument") |
749 | 0 | { |
750 | | // Does not have handle points, so preset enough. |
751 | 0 | return false; |
752 | 0 | } |
753 | 0 | if (sShapeType == "flowChartExtract") |
754 | 0 | { |
755 | | // Does not have handle points, so preset enough. |
756 | 0 | return false; |
757 | 0 | } |
758 | 0 | if (sShapeType == "flowChartInputOutput") |
759 | 0 | { |
760 | | // Does not have handle points, so preset enough. |
761 | 0 | return false; |
762 | 0 | } |
763 | 0 | if (sShapeType == "flowChartInternalStorage") |
764 | 0 | { |
765 | | // Does not have handle points, so preset enough. |
766 | 0 | return false; |
767 | 0 | } |
768 | 0 | if (sShapeType == "flowChartMagneticDisk") |
769 | 0 | { |
770 | | // Does not have handle points, so preset enough. |
771 | 0 | return false; |
772 | 0 | } |
773 | 0 | if (sShapeType == "flowChartMagneticDrum") |
774 | 0 | { |
775 | | // Does not have handle points, so preset enough. |
776 | 0 | return false; |
777 | 0 | } |
778 | 0 | if (sShapeType == "flowChartMagneticTape") |
779 | 0 | { |
780 | | // Does not have handle points, so preset enough. |
781 | 0 | return false; |
782 | 0 | } |
783 | 0 | if (sShapeType == "flowChartManualInput") |
784 | 0 | { |
785 | | // Does not have handle points, so preset enough. |
786 | 0 | return false; |
787 | 0 | } |
788 | 0 | if (sShapeType == "flowChartManualOperation") |
789 | 0 | { |
790 | | // Does not have handle points, so preset enough. |
791 | 0 | return false; |
792 | 0 | } |
793 | 0 | if (sShapeType == "flowChartMerge") |
794 | 0 | { |
795 | | // Does not have handle points, so preset enough. |
796 | 0 | return false; |
797 | 0 | } |
798 | 0 | if (sShapeType == "flowChartMultidocument") |
799 | 0 | { |
800 | | // Does not have handle points, so preset enough. |
801 | 0 | return false; |
802 | 0 | } |
803 | 0 | if (sShapeType == "flowChartOfflineStorage") |
804 | 0 | { |
805 | | // Does not have handle points, so preset enough. |
806 | 0 | return false; |
807 | 0 | } |
808 | 0 | if (sShapeType == "flowChartOffpageConnector") |
809 | 0 | { |
810 | | // Does not have handle points, so preset enough. |
811 | 0 | return false; |
812 | 0 | } |
813 | 0 | if (sShapeType == "flowChartOnlineStorage") |
814 | 0 | { |
815 | | // Does not have handle points, so preset enough. |
816 | 0 | return false; |
817 | 0 | } |
818 | 0 | if (sShapeType == "flowChartOr") |
819 | 0 | { |
820 | | // Does not have handle points, so preset enough. |
821 | 0 | return false; |
822 | 0 | } |
823 | 0 | if (sShapeType == "flowChartPredefinedProcess") |
824 | 0 | { |
825 | | // Does not have handle points, so preset enough. |
826 | 0 | return false; |
827 | 0 | } |
828 | 0 | if (sShapeType == "flowChartPreparation") |
829 | 0 | { |
830 | | // Does not have handle points, so preset enough. |
831 | 0 | return false; |
832 | 0 | } |
833 | 0 | if (sShapeType == "flowChartPunchedCard") |
834 | 0 | { |
835 | | // Does not have handle points, so preset enough. |
836 | 0 | return false; |
837 | 0 | } |
838 | 0 | if (sShapeType == "flowChartPunchedTape") |
839 | 0 | { |
840 | | // Does not have handle points, so preset enough. |
841 | 0 | return false; |
842 | 0 | } |
843 | 0 | if (sShapeType == "flowChartSort") |
844 | 0 | { |
845 | | // Does not have handle points, so preset enough. |
846 | 0 | return false; |
847 | 0 | } |
848 | 0 | if (sShapeType == "flowChartSummingJunction") |
849 | 0 | { |
850 | | // Does not have handle points, so preset enough. |
851 | 0 | return false; |
852 | 0 | } |
853 | 0 | if (sShapeType == "flowChartTerminator") |
854 | 0 | { |
855 | | // Does not have handle points, so preset enough. |
856 | 0 | return false; |
857 | 0 | } |
858 | 0 | if (sShapeType == "foldedCorner") |
859 | 0 | { |
860 | | // TODO |
861 | 0 | return false; |
862 | 0 | } |
863 | 0 | if (sShapeType == "frame") |
864 | 0 | { |
865 | | // TODO |
866 | 0 | return false; |
867 | 0 | } |
868 | 0 | if (sShapeType == "funnel") |
869 | 0 | { |
870 | | // Not found in word |
871 | 0 | return false; |
872 | 0 | } |
873 | 0 | if (sShapeType == "gear6") |
874 | 0 | { |
875 | | // Not found in word |
876 | 0 | return false; |
877 | 0 | } |
878 | 0 | if (sShapeType == "gear9") |
879 | 0 | { |
880 | | // Not found in word |
881 | 0 | return false; |
882 | 0 | } |
883 | 0 | if (sShapeType == "halfFrame") |
884 | 0 | { |
885 | | // LO does not have this type, not necessary to map |
886 | 0 | return false; |
887 | 0 | } |
888 | 0 | if (sShapeType == "heart") |
889 | 0 | { |
890 | | // TODO |
891 | 0 | return false; |
892 | 0 | } |
893 | 0 | if (sShapeType == "heptagon") |
894 | 0 | { |
895 | | // LO does not have this type, not necessary to map |
896 | 0 | return false; |
897 | 0 | } |
898 | 0 | if (sShapeType == "hexagon") |
899 | 0 | { |
900 | 0 | auto aPoint1 = GetAdjustmentPointXValue(0); |
901 | 0 | if (!aPoint1.nCurrVal.has_value() || !aPoint1.nMaxVal.has_value() |
902 | 0 | || !aPoint1.nMinVal.has_value()) |
903 | 0 | return false; |
904 | | |
905 | 0 | m_pDMLexporter->WriteShapeTransformation(m_xShape, XML_a, IsXFlipped(), IsYFlipped(), |
906 | 0 | false, false); |
907 | 0 | tools::Long nMaxVal = 50000 * m_xShape->getSize().Width |
908 | 0 | / std::min(m_xShape->getSize().Width, m_xShape->getSize().Height); |
909 | 0 | tools::Long nVal1 |
910 | 0 | = std::lround(*aPoint1.nCurrVal / (*aPoint1.nMaxVal - *aPoint1.nMinVal) * nMaxVal); |
911 | 0 | return StartAVListWriting() |
912 | 0 | && WriteAV(u"adj"_ustr, OUString(u"val " + OUString::number(nVal1))) |
913 | 0 | && WriteAV(u"vf"_ustr, OUString(u"val " + OUString::number(115470))) |
914 | 0 | && EndAVListWriting(); |
915 | 0 | } |
916 | 0 | if (sShapeType == "homePlate") |
917 | 0 | { |
918 | | // Not found in word |
919 | 0 | return false; |
920 | 0 | } |
921 | 0 | if (sShapeType == "horizontalScroll") |
922 | 0 | { |
923 | | // TODO |
924 | 0 | return false; |
925 | 0 | } |
926 | 0 | if (sShapeType == "irregularSeal1") |
927 | 0 | { |
928 | | // Not found in word |
929 | 0 | return false; |
930 | 0 | } |
931 | 0 | if (sShapeType == "irregularSeal2") |
932 | 0 | { |
933 | | // Not found in word |
934 | 0 | return false; |
935 | 0 | } |
936 | 0 | if (sShapeType == "leftArrow") |
937 | 0 | { |
938 | 0 | auto aPointX = GetAdjustmentPointXValue(0); |
939 | 0 | auto aPointY = GetAdjustmentPointYValue(0); |
940 | 0 | if (!aPointX.nCurrVal.has_value() || !aPointX.nMaxVal.has_value() |
941 | 0 | || !aPointX.nMinVal.has_value() || !aPointY.nCurrVal.has_value() |
942 | 0 | || !aPointY.nMaxVal.has_value() || !aPointY.nMinVal.has_value()) |
943 | 0 | return false; |
944 | | |
945 | 0 | m_pDMLexporter->WriteShapeTransformation(m_xShape, XML_a, IsXFlipped(), IsYFlipped(), |
946 | 0 | false, false); |
947 | 0 | tools::Long nMaxVal1 = 100000; |
948 | 0 | tools::Long nMaxVal2 |
949 | 0 | = 100000 |
950 | 0 | * (double(m_xShape->getSize().Width) |
951 | 0 | / std::min(m_xShape->getSize().Width, m_xShape->getSize().Height)); |
952 | 0 | tools::Long nVal1 = std::lround((*aPointY.nMaxVal - *aPointY.nCurrVal) |
953 | 0 | / (*aPointY.nMaxVal - *aPointY.nMinVal) * nMaxVal1); |
954 | 0 | tools::Long nVal2 = std::lround((*aPointX.nCurrVal - *aPointX.nMinVal) |
955 | 0 | / (*aPointX.nMaxVal - *aPointX.nMinVal) * nMaxVal2); |
956 | 0 | return StartAVListWriting() |
957 | 0 | && WriteAV(u"adj1"_ustr, OUString(u"val " + OUString::number(nVal1))) |
958 | 0 | && WriteAV(u"adj2"_ustr, OUString(u"val " + OUString::number(nVal2))) |
959 | 0 | && EndAVListWriting(); |
960 | 0 | } |
961 | 0 | if (sShapeType == "leftArrowCallout") |
962 | 0 | { |
963 | 0 | auto aBoxWidth = GetAdjustmentPointXValue(0); |
964 | 0 | auto aNeckLength = GetAdjustmentPointXValue(1); |
965 | 0 | auto aNeckFromBox = GetAdjustmentPointYValue(1); |
966 | 0 | auto aHeadFromNeck = GetAdjustmentPointYValue(2); |
967 | 0 | if (!aBoxWidth.nCurrVal.has_value() || !aBoxWidth.nMaxVal.has_value() |
968 | 0 | || !aBoxWidth.nMinVal.has_value() || !aNeckLength.nCurrVal.has_value() |
969 | 0 | || !aNeckLength.nMaxVal.has_value() || !aNeckLength.nMinVal.has_value() |
970 | 0 | || !aNeckFromBox.nCurrVal.has_value() || !aNeckFromBox.nMaxVal.has_value() |
971 | 0 | || !aNeckFromBox.nMinVal.has_value() || !aHeadFromNeck.nCurrVal.has_value() |
972 | 0 | || !aHeadFromNeck.nMaxVal.has_value() || !aHeadFromNeck.nMinVal.has_value()) |
973 | 0 | return false; |
974 | | |
975 | 0 | m_pDMLexporter->WriteShapeTransformation(m_xShape, XML_a, IsXFlipped(), IsYFlipped(), |
976 | 0 | false, false); |
977 | 0 | tools::Long nMaxVal1 |
978 | 0 | = 100000 * m_xShape->getSize().Height |
979 | 0 | / std::min(m_xShape->getSize().Width, m_xShape->getSize().Height); |
980 | 0 | tools::Long nMaxVal2 |
981 | 0 | = 50000 * m_xShape->getSize().Height |
982 | 0 | / std::min(m_xShape->getSize().Width, m_xShape->getSize().Height); |
983 | 0 | tools::Long nMaxVal3 |
984 | 0 | = 100000 * m_xShape->getSize().Width |
985 | 0 | / std::min(m_xShape->getSize().Width, m_xShape->getSize().Height); |
986 | 0 | tools::Long nVal1 |
987 | 0 | = std::lround((*aNeckFromBox.nMaxVal - *aNeckFromBox.nCurrVal) |
988 | 0 | / (*aNeckFromBox.nMaxVal - *aNeckFromBox.nMinVal) * nMaxVal1); |
989 | 0 | tools::Long nVal2 = std::lround((10800 - *aHeadFromNeck.nCurrVal) |
990 | 0 | / (10800 - *aHeadFromNeck.nMinVal) * nMaxVal2); |
991 | 0 | tools::Long nVal3 = std::lround((*aNeckLength.nCurrVal - *aNeckLength.nMinVal) |
992 | 0 | / (21600 - *aNeckLength.nMinVal) * nMaxVal3); |
993 | 0 | tools::Long nVal4 = std::lround((*aBoxWidth.nMaxVal - *aBoxWidth.nCurrVal) |
994 | 0 | / (*aBoxWidth.nMaxVal - *aBoxWidth.nMinVal) * 100000); |
995 | 0 | return StartAVListWriting() |
996 | 0 | && WriteAV(u"adj1"_ustr, OUString(u"val " + OUString::number(nVal1))) |
997 | 0 | && WriteAV(u"adj2"_ustr, OUString(u"val " + OUString::number(nVal2))) |
998 | 0 | && WriteAV(u"adj3"_ustr, OUString(u"val " + OUString::number(nVal3))) |
999 | 0 | && WriteAV(u"adj4"_ustr, OUString(u"val " + OUString::number(nVal4))) |
1000 | 0 | && EndAVListWriting(); |
1001 | 0 | } |
1002 | 0 | if (sShapeType == "leftBrace") |
1003 | 0 | { |
1004 | | // TODO |
1005 | 0 | return false; |
1006 | 0 | } |
1007 | 0 | if (sShapeType == "leftBracket") |
1008 | 0 | { |
1009 | | // TODO |
1010 | 0 | return false; |
1011 | 0 | } |
1012 | 0 | if (sShapeType == "leftCircularArrow") |
1013 | 0 | { |
1014 | | // LO does not have this type, not necessary to map |
1015 | 0 | return false; |
1016 | 0 | } |
1017 | 0 | if (sShapeType == "leftRightArrow") |
1018 | 0 | { |
1019 | 0 | auto aPointX = GetAdjustmentPointXValue(0); |
1020 | 0 | auto aPointY = GetAdjustmentPointYValue(0); |
1021 | 0 | if (!aPointX.nCurrVal.has_value() || !aPointX.nMaxVal.has_value() |
1022 | 0 | || !aPointX.nMinVal.has_value() || !aPointY.nCurrVal.has_value() |
1023 | 0 | || !aPointY.nMaxVal.has_value() || !aPointY.nMinVal.has_value()) |
1024 | 0 | return false; |
1025 | | |
1026 | 0 | m_pDMLexporter->WriteShapeTransformation(m_xShape, XML_a, IsXFlipped(), IsYFlipped(), |
1027 | 0 | false, false); |
1028 | 0 | tools::Long nMaxVal1 = 100000; |
1029 | 0 | tools::Long nMaxVal2 |
1030 | 0 | = 50000 |
1031 | 0 | * (double(m_xShape->getSize().Width) |
1032 | 0 | / std::min(m_xShape->getSize().Width, m_xShape->getSize().Height)); |
1033 | 0 | tools::Long nVal1 = std::lround((*aPointY.nMaxVal - *aPointY.nCurrVal) |
1034 | 0 | / (*aPointY.nMaxVal - *aPointY.nMinVal) * nMaxVal1); |
1035 | 0 | tools::Long nVal2 = std::lround((*aPointX.nCurrVal - *aPointX.nMinVal) |
1036 | 0 | / (*aPointX.nMaxVal - *aPointX.nMinVal) * nMaxVal2); |
1037 | 0 | return StartAVListWriting() |
1038 | 0 | && WriteAV(u"adj1"_ustr, OUString(u"val " + OUString::number(nVal1))) |
1039 | 0 | && WriteAV(u"adj2"_ustr, OUString(u"val " + OUString::number(nVal2))) |
1040 | 0 | && EndAVListWriting(); |
1041 | 0 | } |
1042 | 0 | if (sShapeType == "leftRightArrowCallout") |
1043 | 0 | { |
1044 | 0 | auto aNeckFromBox = GetAdjustmentPointXValue(1); |
1045 | 0 | auto aHeadFromNeck = GetAdjustmentPointXValue(2); |
1046 | 0 | auto aHeadHeight = GetAdjustmentPointYValue(1); |
1047 | 0 | auto aBoxHeight = GetAdjustmentPointYValue(0); |
1048 | 0 | if (!aNeckFromBox.nCurrVal.has_value() || !aNeckFromBox.nMaxVal.has_value() |
1049 | 0 | || !aNeckFromBox.nMinVal.has_value() || !aHeadFromNeck.nCurrVal.has_value() |
1050 | 0 | || !aHeadFromNeck.nMaxVal.has_value() || !aHeadFromNeck.nMinVal.has_value() |
1051 | 0 | || !aHeadHeight.nCurrVal.has_value() || !aHeadHeight.nMaxVal.has_value() |
1052 | 0 | || !aHeadHeight.nMinVal.has_value() || !aBoxHeight.nCurrVal.has_value() |
1053 | 0 | || !aBoxHeight.nMaxVal.has_value() || !aBoxHeight.nMinVal.has_value()) |
1054 | 0 | return false; |
1055 | | |
1056 | 0 | m_pDMLexporter->WriteShapeTransformation(m_xShape, XML_a, IsXFlipped(), IsYFlipped(), |
1057 | 0 | false, false); |
1058 | 0 | tools::Long nMaxVal1 |
1059 | 0 | = 100000 * m_xShape->getSize().Width |
1060 | 0 | / std::min(m_xShape->getSize().Width, m_xShape->getSize().Height); |
1061 | 0 | tools::Long nMaxVal2 |
1062 | 0 | = 50000 * m_xShape->getSize().Width |
1063 | 0 | / std::min(m_xShape->getSize().Width, m_xShape->getSize().Height); |
1064 | 0 | tools::Long nMaxVal3 |
1065 | 0 | = 100000 * m_xShape->getSize().Height |
1066 | 0 | / std::min(m_xShape->getSize().Width, m_xShape->getSize().Height); |
1067 | 0 | tools::Long nVal1 |
1068 | 0 | = std::lround((*aNeckFromBox.nMaxVal - *aNeckFromBox.nCurrVal) |
1069 | 0 | / (*aNeckFromBox.nMaxVal - *aNeckFromBox.nMinVal) * nMaxVal1); |
1070 | 0 | tools::Long nVal2 = std::lround((10800 - *aHeadFromNeck.nCurrVal) |
1071 | 0 | / (10800 - *aHeadFromNeck.nMinVal) * nMaxVal2); |
1072 | 0 | tools::Long nVal3 = std::lround((*aHeadHeight.nCurrVal - *aHeadHeight.nMinVal) |
1073 | 0 | / (21600 - *aHeadHeight.nMinVal) * nMaxVal3); |
1074 | 0 | tools::Long nVal4 = std::lround((*aBoxHeight.nCurrVal - *aBoxHeight.nMinVal) |
1075 | 0 | / (10800 - *aBoxHeight.nMinVal) * 100000); |
1076 | 0 | return StartAVListWriting() |
1077 | 0 | && WriteAV(u"adj1"_ustr, OUString(u"val " + OUString::number(nVal1))) |
1078 | 0 | && WriteAV(u"adj2"_ustr, OUString(u"val " + OUString::number(nVal2))) |
1079 | 0 | && WriteAV(u"adj3"_ustr, OUString(u"val " + OUString::number(nVal3))) |
1080 | 0 | && WriteAV(u"adj4"_ustr, OUString(u"val " + OUString::number(nVal4))) |
1081 | 0 | && EndAVListWriting(); |
1082 | 0 | } |
1083 | 0 | if (sShapeType == "leftRightCircularArrow") |
1084 | 0 | { |
1085 | | // Not found in word |
1086 | 0 | return false; |
1087 | 0 | } |
1088 | 0 | if (sShapeType == "leftRightRibbon") |
1089 | 0 | { |
1090 | | // LO does not have this type so mapping not necessary |
1091 | 0 | return false; |
1092 | 0 | } |
1093 | 0 | if (sShapeType == "leftRightUpArrow") |
1094 | 0 | { |
1095 | | // TODO? |
1096 | | // MS Word stretches the arrow to fit the bounding box; LO doesn't |
1097 | 0 | return false; |
1098 | 0 | } |
1099 | 0 | if (sShapeType == "leftUpArrow") |
1100 | 0 | { |
1101 | | // MS Word's and LO's interpretations of what a leftUpArrow should look like |
1102 | | // are too different to find a compromise :( |
1103 | 0 | } |
1104 | 0 | if (sShapeType == "lightningBolt") |
1105 | 0 | { |
1106 | | // Difference between the SDR and OOXML variants, custgeom? |
1107 | 0 | return false; |
1108 | 0 | } |
1109 | 0 | if (sShapeType == "line") |
1110 | 0 | { |
1111 | | // Not necessary |
1112 | 0 | return false; |
1113 | 0 | } |
1114 | 0 | if (sShapeType == "lineInv") |
1115 | 0 | { |
1116 | | // Not necessary |
1117 | 0 | return false; |
1118 | 0 | } |
1119 | 0 | if (sShapeType == "mathDivide") |
1120 | 0 | { |
1121 | | // LO does not have this type so mapping not necessary |
1122 | 0 | return false; |
1123 | 0 | } |
1124 | 0 | if (sShapeType == "mathEqual") |
1125 | 0 | { |
1126 | | // LO does not have this type so mapping not necessary |
1127 | 0 | return false; |
1128 | 0 | } |
1129 | 0 | if (sShapeType == "mathMinus") |
1130 | 0 | { |
1131 | | // LO does not have this type so mapping not necessary |
1132 | 0 | return false; |
1133 | 0 | } |
1134 | 0 | if (sShapeType == "mathMultiply") |
1135 | 0 | { |
1136 | | // LO does not have this type so mapping not necessary |
1137 | 0 | return false; |
1138 | 0 | } |
1139 | 0 | if (sShapeType == "mathNotEqual") |
1140 | 0 | { |
1141 | | // LO does not have this type so mapping not necessary |
1142 | 0 | return false; |
1143 | 0 | } |
1144 | 0 | if (sShapeType == "mathPlus") |
1145 | 0 | { |
1146 | | // LO does not have this type so mapping not necessary |
1147 | 0 | return false; |
1148 | 0 | } |
1149 | 0 | if (sShapeType == "nonIsoscelesTrapezoid") |
1150 | 0 | { |
1151 | | // TODO |
1152 | 0 | return false; |
1153 | 0 | } |
1154 | 0 | if (sShapeType == "noSmoking") |
1155 | 0 | { |
1156 | | // TODO |
1157 | 0 | return false; |
1158 | 0 | } |
1159 | 0 | if (sShapeType == "notchedRightArrow") |
1160 | 0 | { |
1161 | | // TODO |
1162 | 0 | return false; |
1163 | 0 | } |
1164 | 0 | if (sShapeType == "octagon") |
1165 | 0 | { |
1166 | 0 | auto aPoint1 = GetAdjustmentPointXValue(0); |
1167 | 0 | if (!aPoint1.nCurrVal.has_value() || !aPoint1.nMaxVal.has_value() |
1168 | 0 | || !aPoint1.nMinVal.has_value()) |
1169 | 0 | return false; |
1170 | | |
1171 | 0 | m_pDMLexporter->WriteShapeTransformation(m_xShape, XML_a, IsXFlipped(), IsYFlipped(), |
1172 | 0 | false, false); |
1173 | 0 | tools::Long nVal1 |
1174 | 0 | = std::lround(*aPoint1.nCurrVal / (*aPoint1.nMaxVal - *aPoint1.nMinVal) * 50000); |
1175 | 0 | return StartAVListWriting() |
1176 | 0 | && WriteAV(u"adj"_ustr, OUString(u"val " + OUString::number(nVal1))) |
1177 | 0 | && EndAVListWriting(); |
1178 | 0 | } |
1179 | 0 | if (sShapeType == "parallelogram") |
1180 | 0 | { |
1181 | 0 | auto aPoint1 = GetAdjustmentPointXValue(0); |
1182 | 0 | if (!aPoint1.nCurrVal.has_value() || !aPoint1.nMaxVal.has_value() |
1183 | 0 | || !aPoint1.nMinVal.has_value()) |
1184 | 0 | return false; |
1185 | | |
1186 | 0 | m_pDMLexporter->WriteShapeTransformation(m_xShape, XML_a, IsXFlipped(), IsYFlipped(), |
1187 | 0 | false, false); |
1188 | 0 | tools::Long nMaxVal = 100000 * m_xShape->getSize().Width |
1189 | 0 | / std::min(m_xShape->getSize().Width, m_xShape->getSize().Height); |
1190 | 0 | tools::Long nVal1 |
1191 | 0 | = std::lround(*aPoint1.nCurrVal / (*aPoint1.nMaxVal - *aPoint1.nMinVal) * nMaxVal); |
1192 | 0 | return StartAVListWriting() |
1193 | 0 | && WriteAV(u"adj"_ustr, OUString(u"val " + OUString::number(nVal1))) |
1194 | 0 | && EndAVListWriting(); |
1195 | 0 | } |
1196 | 0 | if (sShapeType == "pentagon") |
1197 | 0 | { |
1198 | | // TODO |
1199 | 0 | return false; |
1200 | 0 | } |
1201 | 0 | if (sShapeType == "pie") |
1202 | 0 | { |
1203 | | // TODO |
1204 | 0 | return false; |
1205 | 0 | } |
1206 | 0 | if (sShapeType == "pieWedge") |
1207 | 0 | { |
1208 | | // Not found in word. |
1209 | 0 | return false; |
1210 | 0 | } |
1211 | 0 | if (sShapeType == "plaque") |
1212 | 0 | { |
1213 | | // TODO |
1214 | 0 | return false; |
1215 | 0 | } |
1216 | 0 | if (sShapeType == "plaqueTabs") |
1217 | 0 | { |
1218 | | // LO does not have this, so not necessary to map. |
1219 | 0 | return false; |
1220 | 0 | } |
1221 | 0 | if (sShapeType == "plus") |
1222 | 0 | { |
1223 | 0 | auto aPoint1 = GetAdjustmentPointXValue(0); |
1224 | 0 | if (!aPoint1.nCurrVal.has_value() || !aPoint1.nMaxVal.has_value() |
1225 | 0 | || !aPoint1.nMinVal.has_value()) |
1226 | 0 | return false; |
1227 | | |
1228 | 0 | m_pDMLexporter->WriteShapeTransformation(m_xShape, XML_a, IsXFlipped(), IsYFlipped(), |
1229 | 0 | false, false); |
1230 | 0 | tools::Long nVal1 |
1231 | 0 | = std::lround(*aPoint1.nCurrVal / (*aPoint1.nMaxVal - *aPoint1.nMinVal) * 50000); |
1232 | 0 | return StartAVListWriting() |
1233 | 0 | && WriteAV(u"adj"_ustr, OUString(u"val " + OUString::number(nVal1))) |
1234 | 0 | && EndAVListWriting(); |
1235 | 0 | } |
1236 | 0 | if (sShapeType == "quadArrow") |
1237 | 0 | { |
1238 | | // TODO |
1239 | 0 | return false; |
1240 | 0 | } |
1241 | 0 | if (sShapeType == "quadArrowCallout") |
1242 | 0 | { |
1243 | | // TODO |
1244 | 0 | return false; |
1245 | 0 | } |
1246 | 0 | if (sShapeType == "rect") |
1247 | 0 | { |
1248 | | // preset enough without AV points. |
1249 | 0 | return false; |
1250 | 0 | } |
1251 | 0 | if (sShapeType == "ribbon") |
1252 | 0 | { |
1253 | | // LO does not have this, so not necessary to map. |
1254 | 0 | return false; |
1255 | 0 | } |
1256 | 0 | if (sShapeType == "ribbon2") |
1257 | 0 | { |
1258 | | // LO does not have this, so not necessary to map. |
1259 | 0 | return false; |
1260 | 0 | } |
1261 | 0 | if (sShapeType == "rightArrow") |
1262 | 0 | { |
1263 | 0 | auto aPointX = GetAdjustmentPointXValue(0); |
1264 | 0 | auto aPointY = GetAdjustmentPointYValue(0); |
1265 | 0 | if (!aPointX.nCurrVal.has_value() || !aPointX.nMaxVal.has_value() |
1266 | 0 | || !aPointX.nMinVal.has_value() || !aPointY.nCurrVal.has_value() |
1267 | 0 | || !aPointY.nMaxVal.has_value() || !aPointY.nMinVal.has_value()) |
1268 | 0 | return false; |
1269 | | |
1270 | 0 | m_pDMLexporter->WriteShapeTransformation(m_xShape, XML_a, IsXFlipped(), IsYFlipped(), |
1271 | 0 | false, false); |
1272 | 0 | tools::Long nMaxVal1 = 100000; |
1273 | 0 | tools::Long nMaxVal2 |
1274 | 0 | = 100000 |
1275 | 0 | * (double(m_xShape->getSize().Width) |
1276 | 0 | / std::min(m_xShape->getSize().Width, m_xShape->getSize().Height)); |
1277 | 0 | tools::Long nVal1 = std::lround((*aPointY.nMaxVal - *aPointY.nCurrVal) |
1278 | 0 | / (*aPointY.nMaxVal - *aPointY.nMinVal) * nMaxVal1); |
1279 | 0 | tools::Long nVal2 = std::lround((*aPointX.nMaxVal - *aPointX.nCurrVal) |
1280 | 0 | / (*aPointX.nMaxVal - *aPointX.nMinVal) * nMaxVal2); |
1281 | 0 | return StartAVListWriting() |
1282 | 0 | && WriteAV(u"adj1"_ustr, OUString(u"val " + OUString::number(nVal1))) |
1283 | 0 | && WriteAV(u"adj2"_ustr, OUString(u"val " + OUString::number(nVal2))) |
1284 | 0 | && EndAVListWriting(); |
1285 | 0 | } |
1286 | 0 | if (sShapeType == "rightArrowCallout") |
1287 | 0 | { |
1288 | 0 | auto aBoxWidth = GetAdjustmentPointXValue(0); |
1289 | 0 | auto aNeckLength = GetAdjustmentPointXValue(1); |
1290 | 0 | auto aNeckFromBox = GetAdjustmentPointYValue(1); |
1291 | 0 | auto aHeadFromNeck = GetAdjustmentPointYValue(2); |
1292 | 0 | if (!aBoxWidth.nCurrVal.has_value() || !aBoxWidth.nMaxVal.has_value() |
1293 | 0 | || !aBoxWidth.nMinVal.has_value() || !aNeckLength.nCurrVal.has_value() |
1294 | 0 | || !aNeckLength.nMaxVal.has_value() || !aNeckLength.nMinVal.has_value() |
1295 | 0 | || !aNeckFromBox.nCurrVal.has_value() || !aNeckFromBox.nMaxVal.has_value() |
1296 | 0 | || !aNeckFromBox.nMinVal.has_value() || !aHeadFromNeck.nCurrVal.has_value() |
1297 | 0 | || !aHeadFromNeck.nMaxVal.has_value() || !aHeadFromNeck.nMinVal.has_value()) |
1298 | 0 | return false; |
1299 | | |
1300 | 0 | m_pDMLexporter->WriteShapeTransformation(m_xShape, XML_a, IsXFlipped(), IsYFlipped(), |
1301 | 0 | false, false); |
1302 | 0 | tools::Long nMaxVal1 |
1303 | 0 | = 100000 * m_xShape->getSize().Height |
1304 | 0 | / std::min(m_xShape->getSize().Width, m_xShape->getSize().Height); |
1305 | 0 | tools::Long nMaxVal2 |
1306 | 0 | = 50000 * m_xShape->getSize().Height |
1307 | 0 | / std::min(m_xShape->getSize().Width, m_xShape->getSize().Height); |
1308 | 0 | tools::Long nMaxVal3 |
1309 | 0 | = 100000 * m_xShape->getSize().Width |
1310 | 0 | / std::min(m_xShape->getSize().Width, m_xShape->getSize().Height); |
1311 | 0 | tools::Long nVal1 |
1312 | 0 | = std::lround((*aNeckFromBox.nMaxVal - *aNeckFromBox.nCurrVal) |
1313 | 0 | / (*aNeckFromBox.nMaxVal - *aNeckFromBox.nMinVal) * nMaxVal1); |
1314 | 0 | tools::Long nVal2 = std::lround((10800 - *aHeadFromNeck.nCurrVal) |
1315 | 0 | / (10800 - *aHeadFromNeck.nMinVal) * nMaxVal2); |
1316 | 0 | tools::Long nVal3 |
1317 | 0 | = std::lround((*aNeckLength.nMaxVal - *aNeckLength.nCurrVal) |
1318 | 0 | / (*aNeckLength.nMaxVal - *aNeckLength.nMinVal) * nMaxVal3); |
1319 | 0 | tools::Long nVal4 = std::lround((*aBoxWidth.nCurrVal - *aBoxWidth.nMinVal) |
1320 | 0 | / (21600 - *aBoxWidth.nMinVal) * 100000); |
1321 | 0 | return StartAVListWriting() |
1322 | 0 | && WriteAV(u"adj1"_ustr, OUString(u"val " + OUString::number(nVal1))) |
1323 | 0 | && WriteAV(u"adj2"_ustr, OUString(u"val " + OUString::number(nVal2))) |
1324 | 0 | && WriteAV(u"adj3"_ustr, OUString(u"val " + OUString::number(nVal3))) |
1325 | 0 | && WriteAV(u"adj4"_ustr, OUString(u"val " + OUString::number(nVal4))) |
1326 | 0 | && EndAVListWriting(); |
1327 | 0 | } |
1328 | 0 | if (sShapeType == "rightBrace") |
1329 | 0 | { |
1330 | | // TODO |
1331 | 0 | return false; |
1332 | 0 | } |
1333 | 0 | if (sShapeType == "rightBracket") |
1334 | 0 | { |
1335 | | // TODO |
1336 | 0 | return false; |
1337 | 0 | } |
1338 | 0 | if (sShapeType == "round1Rect") |
1339 | 0 | { |
1340 | | // LO does not have this, so not necessary to map. |
1341 | 0 | return false; |
1342 | 0 | } |
1343 | 0 | if (sShapeType == "round2DiagRect") |
1344 | 0 | { |
1345 | | // LO does not have this, so not necessary to map. |
1346 | 0 | return false; |
1347 | 0 | } |
1348 | 0 | if (sShapeType == "round2SameRect") |
1349 | 0 | { |
1350 | | // LO does not have this, so not necessary to map. |
1351 | 0 | return false; |
1352 | 0 | } |
1353 | 0 | if (sShapeType == "roundRect") |
1354 | 0 | { |
1355 | 0 | tools::Long nVal1 = 0; |
1356 | 0 | if (m_xShape->getSize().Width >= m_xShape->getSize().Height) |
1357 | 0 | { |
1358 | 0 | auto aPointX = GetAdjustmentPointXValue(0); |
1359 | 0 | if (!aPointX.nCurrVal.has_value() || !aPointX.nMaxVal.has_value() |
1360 | 0 | || !aPointX.nMinVal.has_value()) |
1361 | 0 | return false; |
1362 | 0 | nVal1 = std::lround(*aPointX.nCurrVal / (*aPointX.nMaxVal - *aPointX.nMinVal) |
1363 | 0 | * 50000); |
1364 | 0 | } |
1365 | 0 | else |
1366 | 0 | { |
1367 | 0 | auto aPointY = GetAdjustmentPointYValue(0); |
1368 | 0 | if (!aPointY.nCurrVal.has_value() || !aPointY.nMaxVal.has_value() |
1369 | 0 | || !aPointY.nMinVal.has_value()) |
1370 | 0 | return false; |
1371 | 0 | nVal1 = std::lround(*aPointY.nCurrVal / (*aPointY.nMaxVal - *aPointY.nMinVal) |
1372 | 0 | * 50000); |
1373 | 0 | } |
1374 | | |
1375 | 0 | m_pDMLexporter->WriteShapeTransformation(m_xShape, XML_a, IsXFlipped(), IsYFlipped(), |
1376 | 0 | false, false); |
1377 | 0 | return StartAVListWriting() |
1378 | 0 | && WriteAV(u"adj"_ustr, OUString(u"val " + OUString::number(nVal1))) |
1379 | 0 | && EndAVListWriting(); |
1380 | 0 | } |
1381 | 0 | if (sShapeType == "rtTriangle") |
1382 | 0 | { |
1383 | | // Does not have AV points not necessary to map |
1384 | 0 | return false; |
1385 | 0 | } |
1386 | 0 | if (sShapeType == "smileyFace") |
1387 | 0 | { |
1388 | | // TODO |
1389 | 0 | return false; |
1390 | 0 | } |
1391 | 0 | if (sShapeType == "snip1Rect") |
1392 | 0 | { |
1393 | | // LO does not have this, so not necessary to map. |
1394 | 0 | return false; |
1395 | 0 | } |
1396 | 0 | if (sShapeType == "snip2DiagRect") |
1397 | 0 | { |
1398 | | // LO does not have this, so not necessary to map. |
1399 | 0 | return false; |
1400 | 0 | } |
1401 | 0 | if (sShapeType == "snip2SameRect") |
1402 | 0 | { |
1403 | | // LO does not have this, so not necessary to map. |
1404 | 0 | return false; |
1405 | 0 | } |
1406 | 0 | if (sShapeType == "snipRoundRect") |
1407 | 0 | { |
1408 | | // LO does not have this, so not necessary to map. |
1409 | 0 | return false; |
1410 | 0 | } |
1411 | 0 | if (sShapeType == "squareTabs") |
1412 | 0 | { |
1413 | | // LO does not have this, so not necessary to map. |
1414 | 0 | return false; |
1415 | 0 | } |
1416 | 0 | if (sShapeType == "star10") |
1417 | 0 | { |
1418 | | // LO does not have this, so not necessary to map. |
1419 | 0 | return false; |
1420 | 0 | } |
1421 | 0 | if (sShapeType == "star12") |
1422 | 0 | { |
1423 | | // TODO |
1424 | 0 | return false; |
1425 | 0 | } |
1426 | 0 | if (sShapeType == "star16") |
1427 | 0 | { |
1428 | | // LO does not have this, so not necessary to map. |
1429 | 0 | return false; |
1430 | 0 | } |
1431 | 0 | if (sShapeType == "star24") |
1432 | 0 | { |
1433 | | // TODO |
1434 | 0 | return false; |
1435 | 0 | } |
1436 | 0 | if (sShapeType == "star32") |
1437 | 0 | { |
1438 | | // LO does not have this, so not necessary to map. |
1439 | 0 | return false; |
1440 | 0 | } |
1441 | 0 | if (sShapeType == "star4") |
1442 | 0 | { |
1443 | | // TODO |
1444 | 0 | return false; |
1445 | 0 | } |
1446 | 0 | if (sShapeType == "star5") |
1447 | 0 | { |
1448 | | // TODO |
1449 | 0 | return false; |
1450 | 0 | } |
1451 | 0 | if (sShapeType == "star6") |
1452 | 0 | { |
1453 | | // TODO |
1454 | 0 | return false; |
1455 | 0 | } |
1456 | 0 | if (sShapeType == "star7") |
1457 | 0 | { |
1458 | | // LO does not have this, so not necessary to map. |
1459 | 0 | return false; |
1460 | 0 | } |
1461 | 0 | if (sShapeType == "star8") |
1462 | 0 | { |
1463 | | // TODO |
1464 | 0 | return false; |
1465 | 0 | } |
1466 | 0 | if (sShapeType == "straightConnector1") |
1467 | 0 | { |
1468 | | // Not necessary to map. |
1469 | 0 | return false; |
1470 | 0 | } |
1471 | 0 | if (sShapeType == "stripedRightArrow") |
1472 | 0 | { |
1473 | | // TODO |
1474 | 0 | return false; |
1475 | 0 | } |
1476 | 0 | if (sShapeType == "sun") |
1477 | 0 | { |
1478 | | // TODO |
1479 | 0 | return false; |
1480 | 0 | } |
1481 | 0 | if (sShapeType == "swooshArrow") |
1482 | 0 | { |
1483 | | // Not found in word. |
1484 | 0 | return false; |
1485 | 0 | } |
1486 | 0 | if (sShapeType == "teardrop") |
1487 | 0 | { |
1488 | | // TODO |
1489 | 0 | return false; |
1490 | 0 | } |
1491 | 0 | if (sShapeType == "trapezoid") |
1492 | 0 | { |
1493 | | // Preset enough. |
1494 | 0 | return false; |
1495 | 0 | } |
1496 | 0 | if (sShapeType == "triangle") |
1497 | 0 | { |
1498 | 0 | auto aPoint1 = GetAdjustmentPointXValue(0); |
1499 | 0 | if (!aPoint1.nCurrVal.has_value() || !aPoint1.nMaxVal.has_value() |
1500 | 0 | || !aPoint1.nMinVal.has_value()) |
1501 | 0 | return false; |
1502 | | |
1503 | 0 | m_pDMLexporter->WriteShapeTransformation(m_xShape, XML_a, IsXFlipped(), IsYFlipped(), |
1504 | 0 | false, false); |
1505 | 0 | tools::Long nMaxVal = 100000; |
1506 | 0 | tools::Long nVal1 |
1507 | 0 | = std::lround(*aPoint1.nCurrVal / (*aPoint1.nMaxVal - *aPoint1.nMinVal) * nMaxVal); |
1508 | 0 | return StartAVListWriting() |
1509 | 0 | && WriteAV(u"adj"_ustr, OUString(u"val " + OUString::number(nVal1))) |
1510 | 0 | && EndAVListWriting(); |
1511 | 0 | } |
1512 | 0 | if (sShapeType == "upArrowCallout") |
1513 | 0 | { |
1514 | 0 | auto aNeckFromBox = GetAdjustmentPointXValue(1); |
1515 | 0 | auto aHeadFromNeck = GetAdjustmentPointXValue(2); |
1516 | 0 | auto aHeadHeight = GetAdjustmentPointYValue(1); |
1517 | 0 | auto aBoxHeight = GetAdjustmentPointYValue(0); |
1518 | 0 | if (!aNeckFromBox.nCurrVal.has_value() || !aNeckFromBox.nMaxVal.has_value() |
1519 | 0 | || !aNeckFromBox.nMinVal.has_value() || !aHeadFromNeck.nCurrVal.has_value() |
1520 | 0 | || !aHeadFromNeck.nMaxVal.has_value() || !aHeadFromNeck.nMinVal.has_value() |
1521 | 0 | || !aHeadHeight.nCurrVal.has_value() || !aHeadHeight.nMaxVal.has_value() |
1522 | 0 | || !aHeadHeight.nMinVal.has_value() || !aBoxHeight.nCurrVal.has_value() |
1523 | 0 | || !aBoxHeight.nMaxVal.has_value() || !aBoxHeight.nMinVal.has_value()) |
1524 | 0 | return false; |
1525 | | |
1526 | 0 | m_pDMLexporter->WriteShapeTransformation(m_xShape, XML_a, IsXFlipped(), IsYFlipped(), |
1527 | 0 | false, false); |
1528 | 0 | tools::Long nMaxVal1 |
1529 | 0 | = 100000 * m_xShape->getSize().Width |
1530 | 0 | / std::min(m_xShape->getSize().Width, m_xShape->getSize().Height); |
1531 | 0 | tools::Long nMaxVal2 |
1532 | 0 | = 50000 * m_xShape->getSize().Width |
1533 | 0 | / std::min(m_xShape->getSize().Width, m_xShape->getSize().Height); |
1534 | 0 | tools::Long nMaxVal3 |
1535 | 0 | = 100000 * m_xShape->getSize().Height |
1536 | 0 | / std::min(m_xShape->getSize().Width, m_xShape->getSize().Height); |
1537 | 0 | tools::Long nVal1 |
1538 | 0 | = std::lround((*aNeckFromBox.nMaxVal - *aNeckFromBox.nCurrVal) |
1539 | 0 | / (*aNeckFromBox.nMaxVal - *aNeckFromBox.nMinVal) * nMaxVal1); |
1540 | 0 | tools::Long nVal2 = std::lround((10800 - *aHeadFromNeck.nCurrVal) |
1541 | 0 | / (10800 - *aHeadFromNeck.nMinVal) * nMaxVal2); |
1542 | 0 | tools::Long nVal3 = std::lround((*aHeadHeight.nCurrVal - *aHeadHeight.nMinVal) |
1543 | 0 | / (21600 - *aHeadHeight.nMinVal) * nMaxVal3); |
1544 | 0 | tools::Long nVal4 = std::lround((*aBoxHeight.nCurrVal - *aBoxHeight.nMinVal) |
1545 | 0 | / (10800 - *aBoxHeight.nMinVal) * 100000); |
1546 | 0 | return StartAVListWriting() |
1547 | 0 | && WriteAV(u"adj1"_ustr, OUString(u"val " + OUString::number(nVal1))) |
1548 | 0 | && WriteAV(u"adj2"_ustr, OUString(u"val " + OUString::number(nVal2))) |
1549 | 0 | && WriteAV(u"adj3"_ustr, OUString(u"val " + OUString::number(nVal3))) |
1550 | 0 | && WriteAV(u"adj4"_ustr, OUString(u"val " + OUString::number(nVal4))) |
1551 | 0 | && EndAVListWriting(); |
1552 | 0 | } |
1553 | 0 | if (sShapeType == "upDownArrow") |
1554 | 0 | { |
1555 | 0 | auto aPointX = GetAdjustmentPointXValue(0); |
1556 | 0 | auto aPointY = GetAdjustmentPointYValue(0); |
1557 | 0 | if (!aPointX.nCurrVal.has_value() || !aPointX.nMaxVal.has_value() |
1558 | 0 | || !aPointX.nMinVal.has_value() || !aPointY.nCurrVal.has_value() |
1559 | 0 | || !aPointY.nMaxVal.has_value() || !aPointY.nMinVal.has_value()) |
1560 | 0 | return false; |
1561 | | |
1562 | 0 | m_pDMLexporter->WriteShapeTransformation(m_xShape, XML_a, IsXFlipped(), IsYFlipped(), |
1563 | 0 | false, false); |
1564 | 0 | tools::Long nMaxVal1 = 100000; |
1565 | 0 | tools::Long nMaxVal2 |
1566 | 0 | = 50000 * m_xShape->getSize().Height |
1567 | 0 | / std::min(m_xShape->getSize().Width, m_xShape->getSize().Height); |
1568 | 0 | tools::Long nVal1 = std::lround((*aPointX.nMaxVal - *aPointX.nCurrVal) |
1569 | 0 | / (*aPointX.nMaxVal - *aPointX.nMinVal) * nMaxVal1); |
1570 | 0 | tools::Long nVal2 = std::lround((*aPointY.nCurrVal - *aPointY.nMinVal) |
1571 | 0 | / (*aPointY.nMaxVal - *aPointY.nMinVal) * nMaxVal2); |
1572 | 0 | return StartAVListWriting() |
1573 | 0 | && WriteAV(u"adj1"_ustr, OUString(u"val " + OUString::number(nVal1))) |
1574 | 0 | && WriteAV(u"adj2"_ustr, OUString(u"val " + OUString::number(nVal2))) |
1575 | 0 | && EndAVListWriting(); |
1576 | 0 | } |
1577 | 0 | if (sShapeType == "upArrow") |
1578 | 0 | { |
1579 | 0 | auto aPointX = GetAdjustmentPointXValue(0); |
1580 | 0 | auto aPointY = GetAdjustmentPointYValue(0); |
1581 | 0 | if (!aPointX.nCurrVal.has_value() || !aPointX.nMaxVal.has_value() |
1582 | 0 | || !aPointX.nMinVal.has_value() || !aPointY.nCurrVal.has_value() |
1583 | 0 | || !aPointY.nMaxVal.has_value() || !aPointY.nMinVal.has_value()) |
1584 | 0 | return false; |
1585 | | |
1586 | 0 | m_pDMLexporter->WriteShapeTransformation(m_xShape, XML_a, IsXFlipped(), IsYFlipped(), |
1587 | 0 | false, false); |
1588 | 0 | tools::Long nMaxVal1 = 100000; |
1589 | 0 | tools::Long nMaxVal2 |
1590 | 0 | = 100000 * m_xShape->getSize().Height |
1591 | 0 | / std::min(m_xShape->getSize().Width, m_xShape->getSize().Height); |
1592 | 0 | tools::Long nVal1 = std::lround((*aPointX.nMaxVal - *aPointX.nCurrVal) |
1593 | 0 | / (*aPointX.nMaxVal - *aPointX.nMinVal) * nMaxVal1); |
1594 | 0 | tools::Long nVal2 = std::lround((*aPointY.nCurrVal - *aPointY.nMinVal) |
1595 | 0 | / (*aPointY.nMaxVal - *aPointY.nMinVal) * nMaxVal2); |
1596 | 0 | return StartAVListWriting() |
1597 | 0 | && WriteAV(u"adj1"_ustr, OUString(u"val " + OUString::number(nVal1))) |
1598 | 0 | && WriteAV(u"adj2"_ustr, OUString(u"val " + OUString::number(nVal2))) |
1599 | 0 | && EndAVListWriting(); |
1600 | 0 | } |
1601 | 0 | if (sShapeType == "upDownArrowCallout") |
1602 | 0 | { |
1603 | | // TODO |
1604 | 0 | return false; |
1605 | 0 | } |
1606 | 0 | if (sShapeType == "uturnArrow") |
1607 | 0 | { |
1608 | | // LO does not have like this. |
1609 | 0 | return false; |
1610 | 0 | } |
1611 | 0 | if (sShapeType == "verticalScroll") |
1612 | 0 | { |
1613 | | // TODO |
1614 | 0 | return false; |
1615 | 0 | } |
1616 | 0 | if (sShapeType == "wave") |
1617 | 0 | { |
1618 | | // LO does not have. |
1619 | 0 | return false; |
1620 | 0 | } |
1621 | 0 | if (sShapeType == "wedgeEllipseCallout") |
1622 | 0 | { |
1623 | | // TODO |
1624 | 0 | return false; |
1625 | 0 | } |
1626 | 0 | if (sShapeType == "wedgeRectCallout") |
1627 | 0 | { |
1628 | | // TODO |
1629 | 0 | return false; |
1630 | 0 | } |
1631 | 0 | if (sShapeType == "wedgeRoundRectCallout") |
1632 | 0 | { |
1633 | | // TODO |
1634 | 0 | return false; |
1635 | 0 | } |
1636 | 0 | } |
1637 | 0 | catch (...) |
1638 | 0 | { |
1639 | | // Problem detected with the writing, aborting and trying to find another way. |
1640 | 0 | return false; |
1641 | 0 | } |
1642 | | |
1643 | | // Default, nothing happened return. |
1644 | 0 | return false; |
1645 | 0 | }; |
1646 | | } |