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