Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : : #include "oox/core/xmlfilterbase.hxx"
21 : : #include "oox/export/shapes.hxx"
22 : : #include "oox/export/utils.hxx"
23 : : #include <oox/token/tokens.hxx>
24 : :
25 : : #include <cstdio>
26 : : #include <com/sun/star/awt/CharSet.hpp>
27 : : #include <com/sun/star/awt/FontDescriptor.hpp>
28 : : #include <com/sun/star/awt/FontSlant.hpp>
29 : : #include <com/sun/star/awt/FontWeight.hpp>
30 : : #include <com/sun/star/awt/FontUnderline.hpp>
31 : : #include <com/sun/star/awt/Gradient.hpp>
32 : : #include <com/sun/star/beans/XPropertySet.hpp>
33 : : #include <com/sun/star/beans/XPropertySetInfo.hpp>
34 : : #include <com/sun/star/beans/XPropertyState.hpp>
35 : : #include <com/sun/star/container/XEnumerationAccess.hpp>
36 : : #include <com/sun/star/drawing/FillStyle.hpp>
37 : : #include <com/sun/star/drawing/BitmapMode.hpp>
38 : : #include <com/sun/star/drawing/ConnectorType.hpp>
39 : : #include <com/sun/star/drawing/LineDash.hpp>
40 : : #include <com/sun/star/drawing/LineJoint.hpp>
41 : : #include <com/sun/star/drawing/LineStyle.hpp>
42 : : #include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
43 : : #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
44 : : #include <com/sun/star/i18n/ScriptType.hpp>
45 : : #include <com/sun/star/io/XOutputStream.hpp>
46 : : #include <com/sun/star/style/ParagraphAdjust.hpp>
47 : : #include <com/sun/star/text/XSimpleText.hpp>
48 : : #include <com/sun/star/text/XText.hpp>
49 : : #include <com/sun/star/text/XTextContent.hpp>
50 : : #include <com/sun/star/text/XTextField.hpp>
51 : : #include <com/sun/star/text/XTextRange.hpp>
52 : : #include <com/sun/star/table/XTable.hpp>
53 : : #include <com/sun/star/table/XColumnRowRange.hpp>
54 : : #include <com/sun/star/table/XCellRange.hpp>
55 : : #include <com/sun/star/table/XMergeableCell.hpp>
56 : : #include <com/sun/star/chart2/XChartDocument.hpp>
57 : : #include <com/sun/star/frame/XModel.hpp>
58 : : #include <tools/stream.hxx>
59 : : #include <tools/string.hxx>
60 : : #include <vcl/cvtgrf.hxx>
61 : : #include <unotools/fontcvt.hxx>
62 : : #include <vcl/graph.hxx>
63 : : #include <vcl/outdev.hxx>
64 : : #include <svtools/grfmgr.hxx>
65 : : #include <rtl/strbuf.hxx>
66 : : #include <sfx2/app.hxx>
67 : : #include <svl/languageoptions.hxx>
68 : : #include <filter/msfilter/escherex.hxx>
69 : : #include <svx/svdoashp.hxx>
70 : : #include <editeng/svxenum.hxx>
71 : : #include <svx/unoapi.hxx>
72 : : #include <oox/export/chartexport.hxx>
73 : :
74 : : using namespace ::com::sun::star;
75 : : using namespace ::com::sun::star::beans;
76 : : using namespace ::com::sun::star::uno;
77 : : using namespace ::com::sun::star::drawing;
78 : : using namespace ::com::sun::star::i18n;
79 : : using namespace ::com::sun::star::table;
80 : : using ::com::sun::star::beans::PropertyState;
81 : : using ::com::sun::star::beans::PropertyValue;
82 : : using ::com::sun::star::beans::XPropertySet;
83 : : using ::com::sun::star::beans::XPropertyState;
84 : : using ::com::sun::star::container::XEnumeration;
85 : : using ::com::sun::star::container::XEnumerationAccess;
86 : : using ::com::sun::star::container::XIndexAccess;
87 : : using ::com::sun::star::drawing::FillStyle;
88 : : using ::com::sun::star::io::XOutputStream;
89 : : using ::com::sun::star::text::XSimpleText;
90 : : using ::com::sun::star::text::XText;
91 : : using ::com::sun::star::text::XTextContent;
92 : : using ::com::sun::star::text::XTextField;
93 : : using ::com::sun::star::text::XTextRange;
94 : : using ::oox::core::XmlFilterBase;
95 : : using ::com::sun::star::chart2::XChartDocument;
96 : : using ::com::sun::star::frame::XModel;
97 : : using ::oox::core::XmlFilterBase;
98 : : using ::rtl::OString;
99 : : using ::rtl::OStringBuffer;
100 : : using ::rtl::OUString;
101 : : using ::rtl::OUStringBuffer;
102 : : using ::sax_fastparser::FSHelperPtr;
103 : :
104 : : #define IDS(x) (OString(#x " ") + OString::valueOf( mnShapeIdMax++ )).getStr()
105 : :
106 : :
107 : : struct CustomShapeTypeTranslationTable
108 : : {
109 : : const char* sOOo;
110 : : const char* sMSO;
111 : : };
112 : :
113 : : static const CustomShapeTypeTranslationTable pCustomShapeTypeTranslationTable[] =
114 : : {
115 : : // { "non-primitive", mso_sptMin },
116 : : { "rectangle", "rect" },
117 : : { "round-rectangle", "roundRect" },
118 : : { "ellipse", "ellipse" },
119 : : { "diamond", "diamond" },
120 : : { "isosceles-triangle", "triangle" },
121 : : { "right-triangle", "rtTriangle" },
122 : : { "parallelogram", "parallelogram" },
123 : : { "trapezoid", "trapezoid" },
124 : : { "hexagon", "hexagon" },
125 : : { "octagon", "octagon" },
126 : : { "cross", "plus" },
127 : : { "star5", "star5" },
128 : : { "right-arrow", "rightArrow" },
129 : : // { "mso-spt14", mso_sptThickArrow },
130 : : { "pentagon-right", "homePlate" },
131 : : { "cube", "cube" },
132 : : // { "mso-spt17", mso_sptBalloon },
133 : : // { "mso-spt18", mso_sptSeal },
134 : : { "mso-spt19", "arc" },
135 : : { "mso-spt20", "line" },
136 : : { "mso-spt21", "plaque" },
137 : : { "can", "can" },
138 : : { "ring", "donut" },
139 : : { "mso-spt24", "textSimple" },
140 : : { "mso-spt25", "textOctagon" },
141 : : { "mso-spt26", "textHexagon" },
142 : : { "mso-spt27", "textCurve" },
143 : : { "mso-spt28", "textWave" },
144 : : { "mso-spt29", "textRing" },
145 : : { "mso-spt30", "textOnCurve" },
146 : : { "mso-spt31", "textOnRing" },
147 : : { "mso-spt32", "straightConnector1" },
148 : : { "mso-spt33", "bentConnector2" },
149 : : { "mso-spt34", "bentConnector3" },
150 : : { "mso-spt35", "bentConnector4" },
151 : : { "mso-spt36", "bentConnector5" },
152 : : { "mso-spt37", "curvedConnector2" },
153 : : { "mso-spt38", "curvedConnector3" },
154 : : { "mso-spt39", "curvedConnector4" },
155 : : { "mso-spt40", "curvedConnector5" },
156 : : { "mso-spt41", "callout1" },
157 : : { "mso-spt42", "callout2" },
158 : : { "mso-spt43", "callout3" },
159 : : { "mso-spt44", "accentCallout1" },
160 : : { "mso-spt45", "accentCallout2" },
161 : : { "mso-spt46", "accentCallout3" },
162 : : { "line-callout-1", "borderCallout1" },
163 : : { "line-callout-2", "borderCallout2" },
164 : : { "line-callout-3", "borderCallout3" },
165 : : { "mso-spt49", "accentBorderCallout90" },
166 : : { "mso-spt50", "accentBorderCallout1" },
167 : : { "mso-spt51", "accentBorderCallout2" },
168 : : { "mso-spt52", "accentBorderCallout3" },
169 : : { "mso-spt53", "ribbon" },
170 : : { "mso-spt54", "ribbon2" },
171 : : { "chevron", "chevron" },
172 : : { "pentagon", "pentagon" },
173 : : { "forbidden", "noSmoking" },
174 : : { "star8", "seal8" },
175 : : { "mso-spt59", "seal16" },
176 : : { "mso-spt60", "seal32" },
177 : : { "rectangular-callout", "wedgeRectCallout" },
178 : : { "round-rectangular-callout", "wedgeRoundRectCallout" },
179 : : { "round-callout", "wedgeEllipseCallout" },
180 : : { "mso-spt64", "wave" },
181 : : { "paper", "foldedCorner" },
182 : : { "left-arrow", "leftArrow" },
183 : : { "down-arrow", "downArrow" },
184 : : { "up-arrow", "upArrow" },
185 : : { "left-right-arrow", "leftRightArrow" },
186 : : { "up-down-arrow", "upDownArrow" },
187 : : { "mso-spt71", "irregularSeal1" },
188 : : { "bang", "irregularSeal2" },
189 : : { "lightning", "lightningBolt" },
190 : : { "heart", "heart" },
191 : : { "mso-spt75", "pictureFrame" },
192 : : { "quad-arrow", "quadArrow" },
193 : : { "left-arrow-callout", "leftArrowCallout" },
194 : : { "right-arrow-callout", "rightArrowCallout" },
195 : : { "up-arrow-callout", "upArrowCallout" },
196 : : { "down-arrow-callout", "downArrowCallout" },
197 : : { "left-right-arrow-callout", "leftRightArrowCallout" },
198 : : { "up-down-arrow-callout", "upDownArrowCallout" },
199 : : { "quad-arrow-callout", "quadArrowCallout" },
200 : : { "quad-bevel", "bevel" },
201 : : { "left-bracket", "leftBracket" },
202 : : { "right-bracket", "rightBracket" },
203 : : { "left-brace", "leftBrace" },
204 : : { "right-brace", "rightBrace" },
205 : : { "mso-spt89", "leftUpArrow" },
206 : : { "mso-spt90", "bentUpArrow" },
207 : : { "mso-spt91", "bentArrow" },
208 : : { "star24", "seal24" },
209 : : { "striped-right-arrow", "stripedRightArrow" },
210 : : { "notched-right-arrow", "notchedRightArrow" },
211 : : { "block-arc", "blockArc" },
212 : : { "smiley", "smileyFace" },
213 : : { "vertical-scroll", "verticalScroll" },
214 : : { "horizontal-scroll", "horizontalScroll" },
215 : : { "circular-arrow", "circularArrow" },
216 : : { "mso-spt100", "pie" }, // looks like MSO_SPT is wrong here
217 : : { "mso-spt101", "uturnArrow" },
218 : : { "mso-spt102", "curvedRightArrow" },
219 : : { "mso-spt103", "curvedLeftArrow" },
220 : : { "mso-spt104", "curvedUpArrow" },
221 : : { "mso-spt105", "curvedDownArrow" },
222 : : { "cloud-callout", "cloudCallout" },
223 : : { "mso-spt107", "ellipseRibbon" },
224 : : { "mso-spt108", "ellipseRibbon2" },
225 : : { "flowchart-process", "flowChartProcess" },
226 : : { "flowchart-decision", "flowChartDecision" },
227 : : { "flowchart-data", "flowChartInputOutput" },
228 : : { "flowchart-predefined-process", "flowChartPredefinedProcess" },
229 : : { "flowchart-internal-storage", "flowChartInternalStorage" },
230 : : { "flowchart-document", "flowChartDocument" },
231 : : { "flowchart-multidocument", "flowChartMultidocument" },
232 : : { "flowchart-terminator", "flowChartTerminator" },
233 : : { "flowchart-preparation", "flowChartPreparation" },
234 : : { "flowchart-manual-input", "flowChartManualInput" },
235 : : { "flowchart-manual-operation", "flowChartManualOperation" },
236 : : { "flowchart-connector", "flowChartConnector" },
237 : : { "flowchart-card", "flowChartPunchedCard" },
238 : : { "flowchart-punched-tape", "flowChartPunchedTape" },
239 : : { "flowchart-summing-junction", "flowChartSummingJunction" },
240 : : { "flowchart-or", "flowChartOr" },
241 : : { "flowchart-collate", "flowChartCollate" },
242 : : { "flowchart-sort", "flowChartSort" },
243 : : { "flowchart-extract", "flowChartExtract" },
244 : : { "flowchart-merge", "flowChartMerge" },
245 : : { "mso-spt129", "flowChartOfflineStorage" },
246 : : { "flowchart-stored-data", "flowChartOnlineStorage" },
247 : : { "flowchart-sequential-access", "flowChartMagneticTape" },
248 : : { "flowchart-magnetic-disk", "flowChartMagneticDisk" },
249 : : { "flowchart-direct-access-storage", "flowChartMagneticDrum" },
250 : : { "flowchart-display", "flowChartDisplay" },
251 : : { "flowchart-delay", "flowChartDelay" },
252 : : { "fontwork-plain-text", "textPlainText" },
253 : : { "fontwork-stop", "textStop" },
254 : : { "fontwork-triangle-up", "textTriangle" },
255 : : { "fontwork-triangle-down", "textTriangleInverted" },
256 : : { "fontwork-chevron-up", "textChevron" },
257 : : { "fontwork-chevron-down", "textChevronInverted" },
258 : : { "mso-spt142", "textRingInside" },
259 : : { "mso-spt143", "textRingOutside" },
260 : : { "fontwork-arch-up-curve", "textArchUpCurve" },
261 : : { "fontwork-arch-down-curve", "textArchDownCurve" },
262 : : { "fontwork-circle-curve", "textCircleCurve" },
263 : : { "fontwork-open-circle-curve", "textButtonCurve" },
264 : : { "fontwork-arch-up-pour", "textArchUpPour" },
265 : : { "fontwork-arch-down-pour", "textArchDownPour" },
266 : : { "fontwork-circle-pour", "textCirclePour" },
267 : : { "fontwork-open-circle-pour", "textButtonPour" },
268 : : { "fontwork-curve-up", "textCurveUp" },
269 : : { "fontwork-curve-down", "textCurveDown" },
270 : : { "fontwork-fade-up-and-right", "textCascadeUp" },
271 : : { "fontwork-fade-up-and-left", "textCascadeDown" },
272 : : { "fontwork-wave", "textWave1" },
273 : : { "mso-spt157", "textWave2" },
274 : : { "mso-spt158", "textWave3" },
275 : : { "mso-spt159", "textWave4" },
276 : : { "fontwork-inflate", "textInflate" },
277 : : { "mso-spt161", "textDeflate" },
278 : : { "mso-spt162", "textInflateBottom" },
279 : : { "mso-spt163", "textDeflateBottom" },
280 : : { "mso-spt164", "textInflateTop" },
281 : : { "mso-spt165", "textDeflateTop" },
282 : : { "mso-spt166", "textDeflateInflate" },
283 : : { "mso-spt167", "textDeflateInflateDeflate" },
284 : : { "fontwork-fade-right", "textFadeRight" },
285 : : { "fontwork-fade-left", "textFadeLeft" },
286 : : { "fontwork-fade-up", "textFadeUp" },
287 : : { "fontwork-fade-down", "textFadeDown" },
288 : : { "fontwork-slant-up", "textSlantUp" },
289 : : { "fontwork-slant-down", "textSlantDown" },
290 : : { "mso-spt174", "textCanUp" },
291 : : { "mso-spt175", "textCanDown" },
292 : : { "flowchart-alternate-process", "flowChartAlternateProcess" },
293 : : { "flowchart-off-page-connector", "flowChartOffpageConnector" },
294 : : { "mso-spt178", "callout90" },
295 : : { "mso-spt179", "accentCallout90" },
296 : : { "mso-spt180", "borderCallout90" },
297 : : { "mso-spt182", "leftRightUpArrow" },
298 : : { "sun", "sun" },
299 : : { "moon", "moon" },
300 : : { "bracket-pair", "bracketPair" },
301 : : { "brace-pair", "bracePair" },
302 : : { "star4", "seal4" },
303 : : { "mso-spt188", "doubleWave" },
304 : : { "mso-spt189", "actionButtonBlank" },
305 : : { "mso-spt190", "actionButtonHome" },
306 : : { "mso-spt191", "actionButtonHelp" },
307 : : { "mso-spt192", "actionButtonInformation" },
308 : : { "mso-spt193", "actionButtonForwardNext" },
309 : : { "mso-spt194", "actionButtonBackPrevious" },
310 : : { "mso-spt195", "actionButtonEnd" },
311 : : { "mso-spt196", "actionButtonBeginning" },
312 : : { "mso-spt197", "actionButtonReturn" },
313 : : { "mso-spt198", "actionButtonDocument" },
314 : : { "mso-spt199", "actionButtonSound" },
315 : : { "mso-spt200", "actionButtonMovie" },
316 : : { "mso-spt201", "hostControl" },
317 : : { "mso-spt202", "rect" },
318 : : { "ooxml-actionButtonSound", "actionButtonSound" },
319 : : { "ooxml-borderCallout1", "borderCallout1" },
320 : : { "ooxml-plaqueTabs", "plaqueTabs" },
321 : : { "ooxml-curvedLeftArrow", "curvedLeftArrow" },
322 : : { "ooxml-octagon", "octagon" },
323 : : { "ooxml-leftRightRibbon", "leftRightRibbon" },
324 : : { "ooxml-actionButtonInformation", "actionButtonInformation" },
325 : : { "ooxml-bentConnector5", "bentConnector5" },
326 : : { "ooxml-circularArrow", "circularArrow" },
327 : : { "ooxml-downArrowCallout", "downArrowCallout" },
328 : : { "ooxml-mathMinus", "mathMinus" },
329 : : { "ooxml-gear9", "gear9" },
330 : : { "ooxml-round1Rect", "round1Rect" },
331 : : { "ooxml-sun", "sun" },
332 : : { "ooxml-plaque", "plaque" },
333 : : { "ooxml-chevron", "chevron" },
334 : : { "ooxml-flowChartPreparation", "flowChartPreparation" },
335 : : { "ooxml-diagStripe", "diagStripe" },
336 : : { "ooxml-pentagon", "pentagon" },
337 : : { "ooxml-funnel", "funnel" },
338 : : { "ooxml-chartStar", "chartStar" },
339 : : { "ooxml-accentBorderCallout1", "accentBorderCallout1" },
340 : : { "ooxml-notchedRightArrow", "notchedRightArrow" },
341 : : { "ooxml-rightBracket", "rightBracket" },
342 : : { "ooxml-flowChartOffpageConnector", "flowChartOffpageConnector" },
343 : : { "ooxml-leftRightArrow", "leftRightArrow" },
344 : : { "ooxml-decagon", "decagon" },
345 : : { "ooxml-actionButtonHelp", "actionButtonHelp" },
346 : : { "ooxml-star24", "star24" },
347 : : { "ooxml-mathDivide", "mathDivide" },
348 : : { "ooxml-curvedConnector4", "curvedConnector4" },
349 : : { "ooxml-flowChartOr", "flowChartOr" },
350 : : { "ooxml-borderCallout3", "borderCallout3" },
351 : : { "ooxml-upDownArrowCallout", "upDownArrowCallout" },
352 : : { "ooxml-flowChartDecision", "flowChartDecision" },
353 : : { "ooxml-leftRightArrowCallout", "leftRightArrowCallout" },
354 : : { "ooxml-flowChartManualOperation", "flowChartManualOperation" },
355 : : { "ooxml-snipRoundRect", "snipRoundRect" },
356 : : { "ooxml-mathPlus", "mathPlus" },
357 : : { "ooxml-actionButtonForwardNext", "actionButtonForwardNext" },
358 : : { "ooxml-can", "can" },
359 : : { "ooxml-foldedCorner", "foldedCorner" },
360 : : { "ooxml-star32", "star32" },
361 : : { "ooxml-flowChartInternalStorage", "flowChartInternalStorage" },
362 : : { "ooxml-upDownArrow", "upDownArrow" },
363 : : { "ooxml-irregularSeal2", "irregularSeal2" },
364 : : { "ooxml-mathEqual", "mathEqual" },
365 : : { "ooxml-star12", "star12" },
366 : : { "ooxml-uturnArrow", "uturnArrow" },
367 : : { "ooxml-squareTabs", "squareTabs" },
368 : : { "ooxml-leftRightUpArrow", "leftRightUpArrow" },
369 : : { "ooxml-homePlate", "homePlate" },
370 : : { "ooxml-dodecagon", "dodecagon" },
371 : : { "ooxml-leftArrowCallout", "leftArrowCallout" },
372 : : { "ooxml-chord", "chord" },
373 : : { "ooxml-quadArrowCallout", "quadArrowCallout" },
374 : : { "ooxml-actionButtonBeginning", "actionButtonBeginning" },
375 : : { "ooxml-ellipse", "ellipse" },
376 : : { "ooxml-actionButtonEnd", "actionButtonEnd" },
377 : : { "ooxml-arc", "arc" },
378 : : { "ooxml-star16", "star16" },
379 : : { "ooxml-parallelogram", "parallelogram" },
380 : : { "ooxml-bevel", "bevel" },
381 : : { "ooxml-roundRect", "roundRect" },
382 : : { "ooxml-accentCallout1", "accentCallout1" },
383 : : { "ooxml-flowChartSort", "flowChartSort" },
384 : : { "ooxml-star8", "star8" },
385 : : { "ooxml-flowChartAlternateProcess", "flowChartAlternateProcess" },
386 : : { "ooxml-moon", "moon" },
387 : : { "ooxml-star6", "star6" },
388 : : { "ooxml-round2SameRect", "round2SameRect" },
389 : : { "ooxml-nonIsoscelesTrapezoid", "nonIsoscelesTrapezoid" },
390 : : { "ooxml-diamond", "diamond" },
391 : : { "ooxml-ellipseRibbon", "ellipseRibbon" },
392 : : { "ooxml-callout2", "callout2" },
393 : : { "ooxml-pie", "pie" },
394 : : { "ooxml-star4", "star4" },
395 : : { "ooxml-flowChartPredefinedProcess", "flowChartPredefinedProcess" },
396 : : { "ooxml-flowChartPunchedTape", "flowChartPunchedTape" },
397 : : { "ooxml-curvedConnector2", "curvedConnector2" },
398 : : { "ooxml-bentConnector3", "bentConnector3" },
399 : : { "ooxml-cornerTabs", "cornerTabs" },
400 : : { "ooxml-hexagon", "hexagon" },
401 : : { "ooxml-flowChartConnector", "flowChartConnector" },
402 : : { "ooxml-flowChartMagneticDisk", "flowChartMagneticDisk" },
403 : : { "ooxml-heart", "heart" },
404 : : { "ooxml-ribbon2", "ribbon2" },
405 : : { "ooxml-bracePair", "bracePair" },
406 : : { "ooxml-flowChartExtract", "flowChartExtract" },
407 : : { "ooxml-actionButtonHome", "actionButtonHome" },
408 : : { "ooxml-accentBorderCallout3", "accentBorderCallout3" },
409 : : { "ooxml-flowChartOfflineStorage", "flowChartOfflineStorage" },
410 : : { "ooxml-irregularSeal1", "irregularSeal1" },
411 : : { "ooxml-quadArrow", "quadArrow" },
412 : : { "ooxml-leftBrace", "leftBrace" },
413 : : { "ooxml-leftBracket", "leftBracket" },
414 : : { "ooxml-blockArc", "blockArc" },
415 : : { "ooxml-curvedConnector3", "curvedConnector3" },
416 : : { "ooxml-wedgeRoundRectCallout", "wedgeRoundRectCallout" },
417 : : { "ooxml-actionButtonMovie", "actionButtonMovie" },
418 : : { "ooxml-flowChartOnlineStorage", "flowChartOnlineStorage" },
419 : : { "ooxml-gear6", "gear6" },
420 : : { "ooxml-halfFrame", "halfFrame" },
421 : : { "ooxml-snip2SameRect", "snip2SameRect" },
422 : : { "ooxml-triangle", "triangle" },
423 : : { "ooxml-teardrop", "teardrop" },
424 : : { "ooxml-flowChartDocument", "flowChartDocument" },
425 : : { "ooxml-rightArrowCallout", "rightArrowCallout" },
426 : : { "ooxml-rightBrace", "rightBrace" },
427 : : { "ooxml-chartPlus", "chartPlus" },
428 : : { "ooxml-flowChartManualInput", "flowChartManualInput" },
429 : : { "ooxml-flowChartMerge", "flowChartMerge" },
430 : : { "ooxml-line", "line" },
431 : : { "ooxml-downArrow", "downArrow" },
432 : : { "ooxml-curvedDownArrow", "curvedDownArrow" },
433 : : { "ooxml-actionButtonReturn", "actionButtonReturn" },
434 : : { "ooxml-flowChartInputOutput", "flowChartInputOutput" },
435 : : { "ooxml-bracketPair", "bracketPair" },
436 : : { "ooxml-smileyFace", "smileyFace" },
437 : : { "ooxml-actionButtonBlank", "actionButtonBlank" },
438 : : { "ooxml-wave", "wave" },
439 : : { "ooxml-swooshArrow", "swooshArrow" },
440 : : { "ooxml-flowChartSummingJunction", "flowChartSummingJunction" },
441 : : { "ooxml-lightningBolt", "lightningBolt" },
442 : : { "ooxml-flowChartDisplay", "flowChartDisplay" },
443 : : { "ooxml-actionButtonBackPrevious", "actionButtonBackPrevious" },
444 : : { "ooxml-frame", "frame" },
445 : : { "ooxml-rtTriangle", "rtTriangle" },
446 : : { "ooxml-flowChartMagneticTape", "flowChartMagneticTape" },
447 : : { "ooxml-curvedRightArrow", "curvedRightArrow" },
448 : : { "ooxml-leftUpArrow", "leftUpArrow" },
449 : : { "ooxml-wedgeEllipseCallout", "wedgeEllipseCallout" },
450 : : { "ooxml-doubleWave", "doubleWave" },
451 : : { "ooxml-bentArrow", "bentArrow" },
452 : : { "ooxml-star10", "star10" },
453 : : { "ooxml-leftArrow", "leftArrow" },
454 : : { "ooxml-curvedUpArrow", "curvedUpArrow" },
455 : : { "ooxml-snip1Rect", "snip1Rect" },
456 : : { "ooxml-ellipseRibbon2", "ellipseRibbon2" },
457 : : { "ooxml-plus", "plus" },
458 : : { "ooxml-accentCallout3", "accentCallout3" },
459 : : { "ooxml-leftCircularArrow", "leftCircularArrow" },
460 : : { "ooxml-rightArrow", "rightArrow" },
461 : : { "ooxml-flowChartPunchedCard", "flowChartPunchedCard" },
462 : : { "ooxml-snip2DiagRect", "snip2DiagRect" },
463 : : { "ooxml-verticalScroll", "verticalScroll" },
464 : : { "ooxml-star7", "star7" },
465 : : { "ooxml-chartX", "chartX" },
466 : : { "ooxml-cloud", "cloud" },
467 : : { "ooxml-cube", "cube" },
468 : : { "ooxml-round2DiagRect", "round2DiagRect" },
469 : : { "ooxml-flowChartMultidocument", "flowChartMultidocument" },
470 : : { "ooxml-actionButtonDocument", "actionButtonDocument" },
471 : : { "ooxml-flowChartTerminator", "flowChartTerminator" },
472 : : { "ooxml-flowChartDelay", "flowChartDelay" },
473 : : { "ooxml-curvedConnector5", "curvedConnector5" },
474 : : { "ooxml-horizontalScroll", "horizontalScroll" },
475 : : { "ooxml-bentConnector4", "bentConnector4" },
476 : : { "ooxml-leftRightCircularArrow", "leftRightCircularArrow" },
477 : : { "ooxml-wedgeRectCallout", "wedgeRectCallout" },
478 : : { "ooxml-accentCallout2", "accentCallout2" },
479 : : { "ooxml-flowChartMagneticDrum", "flowChartMagneticDrum" },
480 : : { "ooxml-corner", "corner" },
481 : : { "ooxml-borderCallout2", "borderCallout2" },
482 : : { "ooxml-donut", "donut" },
483 : : { "ooxml-flowChartCollate", "flowChartCollate" },
484 : : { "ooxml-mathNotEqual", "mathNotEqual" },
485 : : { "ooxml-bentConnector2", "bentConnector2" },
486 : : { "ooxml-mathMultiply", "mathMultiply" },
487 : : { "ooxml-heptagon", "heptagon" },
488 : : { "ooxml-rect", "rect" },
489 : : { "ooxml-accentBorderCallout2", "accentBorderCallout2" },
490 : : { "ooxml-pieWedge", "pieWedge" },
491 : : { "ooxml-upArrowCallout", "upArrowCallout" },
492 : : { "ooxml-flowChartProcess", "flowChartProcess" },
493 : : { "ooxml-star5", "star5" },
494 : : { "ooxml-lineInv", "lineInv" },
495 : : { "ooxml-straightConnector1", "straightConnector1" },
496 : : { "ooxml-stripedRightArrow", "stripedRightArrow" },
497 : : { "ooxml-callout3", "callout3" },
498 : : { "ooxml-bentUpArrow", "bentUpArrow" },
499 : : { "ooxml-noSmoking", "noSmoking" },
500 : : { "ooxml-trapezoid", "trapezoid" },
501 : : { "ooxml-cloudCallout", "cloudCallout" },
502 : : { "ooxml-callout1", "callout1" },
503 : : { "ooxml-ribbon", "ribbon" },
504 : : };
505 : :
506 : : struct StringHash
507 : : {
508 : 0 : size_t operator()( const char* s ) const
509 : : {
510 : 0 : return rtl_str_hashCode(s);
511 : : }
512 : : };
513 : :
514 : : struct StringCheck
515 : : {
516 : 0 : bool operator()( const char* s1, const char* s2 ) const
517 : : {
518 : 0 : return strcmp( s1, s2 ) == 0;
519 : : }
520 : : };
521 : :
522 : : typedef boost::unordered_map< const char*, const char*, StringHash, StringCheck> CustomShapeTypeTranslationHashMap;
523 : : static CustomShapeTypeTranslationHashMap* pCustomShapeTypeTranslationHashMap = NULL;
524 : :
525 : 0 : static const char* lcl_GetPresetGeometry( const char* sShapeType )
526 : : {
527 : : const char* sPresetGeo;
528 : :
529 [ # # ]: 0 : if( pCustomShapeTypeTranslationHashMap == NULL )
530 : : {
531 [ # # ][ # # ]: 0 : pCustomShapeTypeTranslationHashMap = new CustomShapeTypeTranslationHashMap ();
532 [ # # ]: 0 : for( unsigned int i = 0; i < sizeof( pCustomShapeTypeTranslationTable )/sizeof( CustomShapeTypeTranslationTable ); i ++ )
533 : : {
534 : 0 : (*pCustomShapeTypeTranslationHashMap)[ pCustomShapeTypeTranslationTable[ i ].sOOo ] = pCustomShapeTypeTranslationTable[ i ].sMSO;
535 : : //DBG(printf("type OOo: %s MSO: %s\n", pCustomShapeTypeTranslationTable[ i ].sOOo, pCustomShapeTypeTranslationTable[ i ].sMSO));
536 : : }
537 : : }
538 : :
539 : 0 : sPresetGeo = (*pCustomShapeTypeTranslationHashMap)[ sShapeType ];
540 : :
541 [ # # ]: 0 : if( sPresetGeo == NULL )
542 : 0 : sPresetGeo = "rect";
543 : :
544 : 0 : return sPresetGeo;
545 : : }
546 : :
547 : : namespace oox { namespace drawingml {
548 : :
549 : : #define GETA(propName) \
550 : : GetProperty( rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( #propName ) ) )
551 : :
552 : : #define GETAD(propName) \
553 : : ( GetPropertyAndState( rXPropSet, rXPropState, String( RTL_CONSTASCII_USTRINGPARAM( #propName ) ), eState ) && eState == beans::PropertyState_DIRECT_VALUE )
554 : :
555 : : #define GET(variable, propName) \
556 : : if ( GETA(propName) ) \
557 : : mAny >>= variable;
558 : :
559 : 0 : ShapeExport::ShapeExport( sal_Int32 nXmlNamespace, FSHelperPtr pFS, ShapeHashMap* pShapeMap, XmlFilterBase* pFB, DocumentType eDocumentType )
560 : : : DrawingML( pFS, pFB, eDocumentType )
561 : : , mnShapeIdMax( 1 )
562 : : , mnPictureIdMax( 1 )
563 : : , mnXmlNamespace( nXmlNamespace )
564 : : , maFraction( 1, 576 )
565 : : , maMapModeSrc( MAP_100TH_MM )
566 : : , maMapModeDest( MAP_INCH, Point(), maFraction, maFraction )
567 [ # # ][ # # ]: 0 : , mpShapeMap( pShapeMap ? pShapeMap : &maShapeMap )
[ # # ][ # # ]
[ # # ][ # # ]
568 : : {
569 : 0 : }
570 : :
571 : 0 : awt::Size ShapeExport::MapSize( const awt::Size& rSize ) const
572 : : {
573 [ # # ]: 0 : Size aRetSize( OutputDevice::LogicToLogic( Size( rSize.Width, rSize.Height ), maMapModeSrc, maMapModeDest ) );
574 : :
575 [ # # ]: 0 : if ( !aRetSize.Width() )
576 : 0 : aRetSize.Width()++;
577 [ # # ]: 0 : if ( !aRetSize.Height() )
578 : 0 : aRetSize.Height()++;
579 : 0 : return awt::Size( aRetSize.Width(), aRetSize.Height() );
580 : : }
581 : :
582 : 0 : sal_Bool ShapeExport::NonEmptyText( Reference< XInterface > xIface )
583 : : {
584 [ # # ]: 0 : Reference< XPropertySet > xPropSet( xIface, UNO_QUERY );
585 : :
586 [ # # ]: 0 : if( xPropSet.is() )
587 : : {
588 [ # # ][ # # ]: 0 : Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
589 [ # # ]: 0 : if ( xPropSetInfo.is() )
590 : : {
591 [ # # ][ # # ]: 0 : if ( xPropSetInfo->hasPropertyByName( S( "IsEmptyPresentationObject" ) ) )
[ # # ][ # # ]
[ # # ][ # # ]
592 : : {
593 : 0 : sal_Bool bIsEmptyPresObj = sal_False;
594 [ # # ][ # # ]: 0 : if ( xPropSet->getPropertyValue( S( "IsEmptyPresentationObject" ) ) >>= bIsEmptyPresObj )
[ # # ][ # # ]
[ # # ][ # # ]
595 : : {
596 : : DBG(printf("empty presentation object %d, props:\n", bIsEmptyPresObj));
597 [ # # ]: 0 : if( bIsEmptyPresObj )
598 : 0 : return sal_True;
599 : : }
600 : : }
601 : :
602 [ # # ][ # # ]: 0 : if ( xPropSetInfo->hasPropertyByName( S( "IsPresentationObject" ) ) )
[ # # ][ # # ]
[ # # ][ # # ]
603 : : {
604 : 0 : sal_Bool bIsPresObj = sal_False;
605 [ # # ][ # # ]: 0 : if ( xPropSet->getPropertyValue( S( "IsPresentationObject" ) ) >>= bIsPresObj )
[ # # ][ # # ]
[ # # ][ # # ]
606 : : {
607 : : DBG(printf("presentation object %d, props:\n", bIsPresObj));
608 [ # # ]: 0 : if( bIsPresObj )
609 : 0 : return sal_True;
610 : : }
611 : : }
612 [ # # ]: 0 : }
613 : : }
614 : :
615 [ # # ]: 0 : Reference< XSimpleText > xText( xIface, UNO_QUERY );
616 : :
617 [ # # ]: 0 : if( xText.is() )
618 [ # # ][ # # ]: 0 : return xText->getString().getLength();
619 : :
620 : 0 : return sal_False;
621 : : }
622 : :
623 : 0 : ShapeExport& ShapeExport::WriteBezierShape( Reference< XShape > xShape, sal_Bool bClosed )
624 : : {
625 : : DBG(printf("write open bezier shape\n"));
626 : :
627 [ # # ]: 0 : FSHelperPtr pFS = GetFS();
628 [ # # ]: 0 : pFS->startElementNS( mnXmlNamespace, XML_sp, FSEND );
629 : :
630 [ # # ]: 0 : PolyPolygon aPolyPolygon = EscherPropertyContainer::GetPolyPolygon( xShape );
631 [ # # ]: 0 : Rectangle aRect( aPolyPolygon.GetBoundRect() );
632 : :
633 : : #if OSL_DEBUG_LEVEL > 0
634 : : awt::Size size = MapSize( awt::Size( aRect.GetWidth(), aRect.GetHeight() ) );
635 : : DBG(printf("poly count %d\nsize: %d x %d", aPolyPolygon.Count(), int( size.Width ), int( size.Height )));
636 : : #endif
637 : :
638 : : // non visual shape properties
639 [ # # ]: 0 : pFS->startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND );
640 : : pFS->singleElementNS( mnXmlNamespace, XML_cNvPr,
641 : : XML_id, I32S( GetNewShapeID( xShape ) ),
642 : : XML_name, IDS( Freeform ),
643 [ # # ][ # # ]: 0 : FSEND );
644 [ # # ]: 0 : pFS->singleElementNS( mnXmlNamespace, XML_cNvSpPr, FSEND );
645 [ # # ]: 0 : WriteNonVisualProperties( xShape );
646 [ # # ]: 0 : pFS->endElementNS( mnXmlNamespace, XML_nvSpPr );
647 : :
648 : : // visual shape properties
649 [ # # ]: 0 : pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND );
650 [ # # ]: 0 : WriteTransformation( aRect, XML_a );
651 [ # # ]: 0 : WritePolyPolygon( aPolyPolygon );
652 [ # # ]: 0 : Reference< XPropertySet > xProps( xShape, UNO_QUERY );
653 [ # # ]: 0 : if( xProps.is() ) {
654 [ # # ]: 0 : if( bClosed )
655 [ # # ]: 0 : WriteFill( xProps );
656 [ # # ]: 0 : WriteOutline( xProps );
657 : : }
658 : :
659 [ # # ]: 0 : pFS->endElementNS( mnXmlNamespace, XML_spPr );
660 : :
661 : : // write text
662 [ # # ]: 0 : WriteTextBox( xShape, mnXmlNamespace );
663 : :
664 [ # # ]: 0 : pFS->endElementNS( mnXmlNamespace, XML_sp );
665 : :
666 [ # # ][ # # ]: 0 : return *this;
667 : : }
668 : :
669 : 0 : ShapeExport& ShapeExport::WriteClosedBezierShape( Reference< XShape > xShape )
670 : : {
671 [ # # ]: 0 : return WriteBezierShape( xShape, sal_True );
672 : : }
673 : :
674 : 0 : ShapeExport& ShapeExport::WriteOpenBezierShape( Reference< XShape > xShape )
675 : : {
676 [ # # ]: 0 : return WriteBezierShape( xShape, sal_False );
677 : : }
678 : :
679 : 0 : ShapeExport& ShapeExport::WriteCustomShape( Reference< XShape > xShape )
680 : : {
681 : : DBG(printf("write custom shape\n"));
682 : :
683 [ # # ]: 0 : Reference< XPropertySet > rXPropSet( xShape, UNO_QUERY );
684 : 0 : SdrObjCustomShape* pShape = (SdrObjCustomShape*) GetSdrObjectFromXShape( xShape );
685 [ # # ]: 0 : sal_Bool bIsDefaultObject = EscherPropertyContainer::IsDefaultObject( pShape );
686 : 0 : sal_Bool bPredefinedHandlesUsed = sal_True;
687 : 0 : OUString sShapeType;
688 : 0 : sal_uInt32 nMirrorFlags = 0;
689 [ # # ]: 0 : MSO_SPT eShapeType = EscherPropertyContainer::GetCustomShapeType( xShape, nMirrorFlags, sShapeType );
690 [ # # ][ # # ]: 0 : const char* sPresetShape = lcl_GetPresetGeometry( USS( sShapeType ) );
691 : : DBG(printf("custom shape type: %s ==> %s\n", USS( sShapeType ), sPresetShape));
692 [ # # ]: 0 : Sequence< PropertyValue > aGeometrySeq;
693 : 0 : sal_Int32 nAdjustmentValuesIndex = -1;
694 : :
695 : 0 : sal_Bool bFlipH = false;
696 : 0 : sal_Bool bFlipV = false;
697 : :
698 [ # # ][ # # ]: 0 : if( GETA( CustomShapeGeometry ) ) {
[ # # ][ # # ]
699 : : DBG(printf("got custom shape geometry\n"));
700 [ # # ][ # # ]: 0 : if( mAny >>= aGeometrySeq ) {
701 : :
702 : : DBG(printf("got custom shape geometry sequence\n"));
703 [ # # ]: 0 : for( int i = 0; i < aGeometrySeq.getLength(); i++ ) {
704 [ # # ]: 0 : const PropertyValue& rProp = aGeometrySeq[ i ];
705 : : DBG(printf("geometry property: %s\n", USS( rProp.Name )));
706 : :
707 [ # # ]: 0 : if ( rProp.Name == "MirroredX" )
708 : 0 : rProp.Value >>= bFlipH;
709 : :
710 [ # # ]: 0 : if ( rProp.Name == "MirroredY" )
711 : 0 : rProp.Value >>= bFlipV;
712 [ # # ]: 0 : if ( rProp.Name == "AdjustmentValues" )
713 : 0 : nAdjustmentValuesIndex = i;
714 [ # # ]: 0 : else if ( rProp.Name == "Handles" ) {
715 [ # # ]: 0 : if( !bIsDefaultObject )
716 : 0 : bPredefinedHandlesUsed = sal_False;
717 : : // TODO: update nAdjustmentsWhichNeedsToBeConverted here
718 : : }
719 : : }
720 : : }
721 : : }
722 : :
723 [ # # ]: 0 : FSHelperPtr pFS = GetFS();
724 [ # # ]: 0 : pFS->startElementNS( mnXmlNamespace, XML_sp, FSEND );
725 : :
726 : : // non visual shape properties
727 [ # # ]: 0 : pFS->startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND );
728 : : pFS->singleElementNS( mnXmlNamespace, XML_cNvPr,
729 : : XML_id, I32S( GetNewShapeID( xShape ) ),
730 : : XML_name, IDS( CustomShape ),
731 [ # # ][ # # ]: 0 : FSEND );
732 [ # # ]: 0 : pFS->singleElementNS( mnXmlNamespace, XML_cNvSpPr, FSEND );
733 [ # # ]: 0 : WriteNonVisualProperties( xShape );
734 [ # # ]: 0 : pFS->endElementNS( mnXmlNamespace, XML_nvSpPr );
735 : :
736 : : // visual shape properties
737 [ # # ]: 0 : pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND );
738 [ # # ]: 0 : WriteShapeTransformation( xShape, XML_a, bFlipH, bFlipV );
739 [ # # ]: 0 : if( nAdjustmentValuesIndex != -1 )
740 : : {
741 : 0 : sal_Int32 nAdjustmentsWhichNeedsToBeConverted = 0;
742 : : WritePresetShape( sPresetShape, eShapeType, bPredefinedHandlesUsed,
743 [ # # ][ # # ]: 0 : nAdjustmentsWhichNeedsToBeConverted, aGeometrySeq[ nAdjustmentValuesIndex ] );
744 : : }
745 : : else
746 [ # # ]: 0 : WritePresetShape( sPresetShape );
747 [ # # ]: 0 : if( rXPropSet.is() )
748 : : {
749 [ # # ]: 0 : WriteFill( rXPropSet );
750 [ # # ]: 0 : WriteOutline( rXPropSet );
751 : : }
752 : :
753 [ # # ]: 0 : pFS->endElementNS( mnXmlNamespace, XML_spPr );
754 : :
755 : : // write text
756 [ # # ]: 0 : WriteTextBox( xShape, mnXmlNamespace );
757 : :
758 [ # # ]: 0 : pFS->endElementNS( mnXmlNamespace, XML_sp );
759 : :
760 [ # # ][ # # ]: 0 : return *this;
761 : : }
762 : :
763 : 0 : ShapeExport& ShapeExport::WriteEllipseShape( Reference< XShape > xShape )
764 : : {
765 : : DBG(printf("write ellipse shape\n"));
766 : :
767 [ # # ]: 0 : FSHelperPtr pFS = GetFS();
768 : :
769 [ # # ]: 0 : pFS->startElementNS( mnXmlNamespace, XML_sp, FSEND );
770 : :
771 : : // TODO: arc, section, cut, connector
772 : :
773 : : // non visual shape properties
774 [ # # ]: 0 : pFS->startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND );
775 : : pFS->singleElementNS( mnXmlNamespace, XML_cNvPr,
776 : : XML_id, I32S( GetNewShapeID( xShape ) ),
777 : : XML_name, IDS( Ellipse ),
778 [ # # ][ # # ]: 0 : FSEND );
779 [ # # ]: 0 : pFS->singleElementNS( mnXmlNamespace, XML_cNvSpPr, FSEND );
780 [ # # ]: 0 : WriteNonVisualProperties( xShape );
781 [ # # ]: 0 : pFS->endElementNS( mnXmlNamespace, XML_nvSpPr );
782 : :
783 : : // visual shape properties
784 [ # # ]: 0 : pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND );
785 [ # # ]: 0 : WriteShapeTransformation( xShape, XML_a );
786 [ # # ]: 0 : WritePresetShape( "ellipse" );
787 [ # # ]: 0 : Reference< XPropertySet > xProps( xShape, UNO_QUERY );
788 [ # # ]: 0 : if( xProps.is() )
789 : : {
790 [ # # ]: 0 : WriteFill( xProps );
791 [ # # ]: 0 : WriteOutline( xProps );
792 : : }
793 [ # # ]: 0 : pFS->endElementNS( mnXmlNamespace, XML_spPr );
794 : :
795 : : // write text
796 [ # # ]: 0 : WriteTextBox( xShape, mnXmlNamespace );
797 : :
798 [ # # ]: 0 : pFS->endElementNS( mnXmlNamespace, XML_sp );
799 : :
800 [ # # ]: 0 : return *this;
801 : : }
802 : :
803 : 0 : ShapeExport& ShapeExport::WriteGraphicObjectShape( Reference< XShape > xShape )
804 : : {
805 : : DBG(printf("write graphic object shape\n"));
806 : :
807 [ # # ][ # # ]: 0 : if( NonEmptyText( xShape ) )
808 : : {
809 [ # # ]: 0 : WriteTextShape( xShape );
810 : :
811 : : //DBG(dump_pset(mXPropSet));
812 : :
813 : 0 : return *this;
814 : : }
815 : :
816 : : DBG(printf("graphicObject without text\n"));
817 : :
818 : 0 : OUString sGraphicURL;
819 [ # # ]: 0 : Reference< XPropertySet > xShapeProps( xShape, UNO_QUERY );
820 [ # # ][ # # ]: 0 : if( !xShapeProps.is() || !( xShapeProps->getPropertyValue( S( "GraphicURL" ) ) >>= sGraphicURL ) )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # # #
# # # # ]
821 : : {
822 : : DBG(printf("no graphic URL found\n"));
823 : 0 : return *this;
824 : : }
825 : :
826 [ # # ]: 0 : FSHelperPtr pFS = GetFS();
827 : :
828 [ # # ]: 0 : pFS->startElementNS( mnXmlNamespace, XML_pic, FSEND );
829 : :
830 [ # # ]: 0 : pFS->startElementNS( mnXmlNamespace, XML_nvPicPr, FSEND );
831 : :
832 : 0 : OUString sName, sDescr;
833 [ # # ][ # # ]: 0 : bool bHaveName = xShapeProps->getPropertyValue( S( "Name" ) ) >>= sName;
[ # # ][ # # ]
[ # # ]
834 [ # # ][ # # ]: 0 : bool bHaveDesc = xShapeProps->getPropertyValue( S( "Description" ) ) >>= sDescr;
[ # # ][ # # ]
[ # # ]
835 : :
836 : : pFS->singleElementNS( mnXmlNamespace, XML_cNvPr,
837 : : XML_id, I32S( GetNewShapeID( xShape ) ),
838 [ # # ][ # # ]: 0 : XML_name, bHaveName ? USS( sName ) : (OString("Picture ") + OString::valueOf( mnPictureIdMax++ )).getStr(),
[ # # ][ # # ]
[ # # ][ # # ]
[ # # # #
# # # # #
# ]
839 [ # # ][ # # ]: 0 : XML_descr, bHaveDesc ? USS( sDescr ) : NULL,
[ # # ]
840 [ # # ][ # # ]: 0 : FSEND );
[ # # ][ # # ]
841 : : // OOXTODO: //cNvPr children: XML_extLst, XML_hlinkClick, XML_hlinkHover
842 : :
843 : : pFS->singleElementNS( mnXmlNamespace, XML_cNvPicPr,
844 : : // OOXTODO: XML_preferRelativeSize
845 [ # # ]: 0 : FSEND );
846 : :
847 [ # # ]: 0 : WriteNonVisualProperties( xShape );
848 : :
849 [ # # ]: 0 : pFS->endElementNS( mnXmlNamespace, XML_nvPicPr );
850 : :
851 [ # # ]: 0 : pFS->startElementNS( mnXmlNamespace, XML_blipFill, FSEND );
852 : :
853 [ # # ]: 0 : WriteBlip( xShapeProps, sGraphicURL );
854 : :
855 : 0 : bool bStretch = false;
856 [ # # ][ # # ]: 0 : if( ( xShapeProps->getPropertyValue( S( "FillBitmapStretch" ) ) >>= bStretch ) && bStretch )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # #
# # # # #
# ][ # # ]
857 : : {
858 [ # # ]: 0 : WriteStretch();
859 : : }
860 : :
861 [ # # ]: 0 : pFS->endElementNS( mnXmlNamespace, XML_blipFill );
862 : :
863 : : // visual shape properties
864 [ # # ]: 0 : pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND );
865 [ # # ]: 0 : WriteShapeTransformation( xShape, XML_a );
866 [ # # ]: 0 : WritePresetShape( "rect" );
867 : : // graphic object can come with the frame (bnc#654525)
868 [ # # ]: 0 : WriteOutline( xShapeProps );
869 [ # # ]: 0 : pFS->endElementNS( mnXmlNamespace, XML_spPr );
870 : :
871 [ # # ]: 0 : pFS->endElementNS( mnXmlNamespace, XML_pic );
872 : :
873 [ # # ]: 0 : return *this;
874 : : }
875 : :
876 : 0 : ShapeExport& ShapeExport::WriteConnectorShape( Reference< XShape > xShape )
877 : : {
878 : 0 : sal_Bool bFlipH = false;
879 : 0 : sal_Bool bFlipV = false;
880 : :
881 : : DBG(printf("write connector shape\n"));
882 : :
883 [ # # ]: 0 : FSHelperPtr pFS = GetFS();
884 : :
885 : 0 : const char* sGeometry = "line";
886 [ # # ]: 0 : Reference< XPropertySet > rXPropSet( xShape, UNO_QUERY );
887 [ # # ]: 0 : Reference< XPropertyState > rXPropState( xShape, UNO_QUERY );
888 : 0 : awt::Point aStartPoint, aEndPoint;
889 : 0 : Reference< XShape > rXShapeA;
890 : 0 : Reference< XShape > rXShapeB;
891 : : PropertyState eState;
892 : : ConnectorType eConnectorType;
893 [ # # ][ # # ]: 0 : if( GETAD( EdgeKind ) ) {
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # #
# # # # #
# ][ # # ]
894 [ # # ]: 0 : mAny >>= eConnectorType;
895 : :
896 [ # # # ]: 0 : switch( eConnectorType ) {
897 : : case ConnectorType_CURVE:
898 : 0 : sGeometry = "curvedConnector3";
899 : 0 : break;
900 : : case ConnectorType_STANDARD:
901 : 0 : sGeometry = "bentConnector3";
902 : 0 : break;
903 : : default:
904 : : case ConnectorType_LINE:
905 : : case ConnectorType_LINES:
906 : 0 : sGeometry = "straightConnector1";
907 : 0 : break;
908 : : }
909 : :
910 [ # # ][ # # ]: 0 : if( GETAD( EdgeStartPoint ) ) {
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # # #
# # # # ]
911 [ # # ]: 0 : mAny >>= aStartPoint;
912 [ # # ][ # # ]: 0 : if( GETAD( EdgeEndPoint ) ) {
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # # #
# # # # ]
913 [ # # ]: 0 : mAny >>= aEndPoint;
914 : : }
915 : : }
916 [ # # ][ # # ]: 0 : GET( rXShapeA, EdgeStartConnection );
[ # # ][ # # ]
[ # # ]
917 [ # # ][ # # ]: 0 : GET( rXShapeB, EdgeEndConnection );
[ # # ][ # # ]
[ # # ]
918 : : }
919 [ # # ]: 0 : EscherConnectorListEntry aConnectorEntry( xShape, aStartPoint, rXShapeA, aEndPoint, rXShapeB );
920 : :
921 [ # # ]: 0 : Rectangle aRect( Point( aStartPoint.X, aStartPoint.Y ), Point( aEndPoint.X, aEndPoint.Y ) );
922 [ # # ]: 0 : if( aRect.getWidth() < 0 ) {
923 : 0 : bFlipH = sal_True;
924 : 0 : aRect.setX( aEndPoint.X );
925 : 0 : aRect.setWidth( aStartPoint.X - aEndPoint.X );
926 : : }
927 : :
928 [ # # ]: 0 : if( aRect.getHeight() < 0 ) {
929 : 0 : bFlipV = sal_True;
930 : 0 : aRect.setY( aEndPoint.Y );
931 : 0 : aRect.setHeight( aStartPoint.Y - aEndPoint.Y );
932 : : }
933 : :
934 [ # # ]: 0 : pFS->startElementNS( mnXmlNamespace, XML_cxnSp, FSEND );
935 : :
936 : : // non visual shape properties
937 [ # # ]: 0 : pFS->startElementNS( mnXmlNamespace, XML_nvCxnSpPr, FSEND );
938 : : pFS->singleElementNS( mnXmlNamespace, XML_cNvPr,
939 : : XML_id, I32S( GetNewShapeID( xShape ) ),
940 : : XML_name, IDS( Line ),
941 [ # # ][ # # ]: 0 : FSEND );
942 : : // non visual connector shape drawing properties
943 [ # # ]: 0 : pFS->startElementNS( mnXmlNamespace, XML_cNvCxnSpPr, FSEND );
944 [ # # ][ # # ]: 0 : WriteConnectorConnections( aConnectorEntry, GetShapeID( rXShapeA ), GetShapeID( rXShapeB ) );
[ # # ]
945 [ # # ]: 0 : pFS->endElementNS( mnXmlNamespace, XML_cNvCxnSpPr );
946 [ # # ]: 0 : pFS->singleElementNS( mnXmlNamespace, XML_nvPr, FSEND );
947 [ # # ]: 0 : pFS->endElementNS( mnXmlNamespace, XML_nvCxnSpPr );
948 : :
949 : : // visual shape properties
950 [ # # ]: 0 : pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND );
951 [ # # ]: 0 : WriteTransformation( aRect, XML_a, bFlipH, bFlipV );
952 : : // TODO: write adjustments (ppt export doesn't work well there either)
953 [ # # ]: 0 : WritePresetShape( sGeometry );
954 [ # # ]: 0 : Reference< XPropertySet > xShapeProps( xShape, UNO_QUERY );
955 [ # # ]: 0 : if( xShapeProps.is() )
956 [ # # ]: 0 : WriteOutline( xShapeProps );
957 [ # # ]: 0 : pFS->endElementNS( mnXmlNamespace, XML_spPr );
958 : :
959 : : // write text
960 [ # # ]: 0 : WriteTextBox( xShape, mnXmlNamespace );
961 : :
962 [ # # ]: 0 : pFS->endElementNS( mnXmlNamespace, XML_cxnSp );
963 : :
964 [ # # ][ # # ]: 0 : return *this;
965 : : }
966 : :
967 : 0 : ShapeExport& ShapeExport::WriteLineShape( Reference< XShape > xShape )
968 : : {
969 : 0 : sal_Bool bFlipH = false;
970 : 0 : sal_Bool bFlipV = false;
971 : :
972 : : DBG(printf("write line shape\n"));
973 : :
974 [ # # ]: 0 : FSHelperPtr pFS = GetFS();
975 : :
976 [ # # ]: 0 : pFS->startElementNS( mnXmlNamespace, XML_sp, FSEND );
977 : :
978 [ # # ]: 0 : PolyPolygon aPolyPolygon = EscherPropertyContainer::GetPolyPolygon( xShape );
979 [ # # ][ # # ]: 0 : if( aPolyPolygon.Count() == 1 && aPolyPolygon[ 0 ].GetSize() == 2)
[ # # ][ # # ]
[ # # ][ # # ]
980 : : {
981 [ # # ]: 0 : const Polygon& rPoly = aPolyPolygon[ 0 ];
982 : :
983 [ # # ][ # # ]: 0 : bFlipH = ( rPoly[ 0 ].X() > rPoly[ 1 ].X() );
984 [ # # ][ # # ]: 0 : bFlipV = ( rPoly[ 0 ].Y() > rPoly[ 1 ].Y() );
985 : : }
986 : :
987 : : // non visual shape properties
988 [ # # ]: 0 : pFS->startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND );
989 : : pFS->singleElementNS( mnXmlNamespace, XML_cNvPr,
990 : : XML_id, I32S( GetNewShapeID( xShape ) ),
991 : : XML_name, IDS( Line ),
992 [ # # ][ # # ]: 0 : FSEND );
993 [ # # ]: 0 : pFS->singleElementNS( mnXmlNamespace, XML_cNvSpPr, FSEND );
994 [ # # ]: 0 : WriteNonVisualProperties( xShape );
995 [ # # ]: 0 : pFS->endElementNS( mnXmlNamespace, XML_nvSpPr );
996 : :
997 : : // visual shape properties
998 [ # # ]: 0 : pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND );
999 [ # # ]: 0 : WriteShapeTransformation( xShape, XML_a, bFlipH, bFlipV );
1000 [ # # ]: 0 : WritePresetShape( "line" );
1001 [ # # ]: 0 : Reference< XPropertySet > xShapeProps( xShape, UNO_QUERY );
1002 [ # # ]: 0 : if( xShapeProps.is() )
1003 [ # # ]: 0 : WriteOutline( xShapeProps );
1004 [ # # ]: 0 : pFS->endElementNS( mnXmlNamespace, XML_spPr );
1005 : :
1006 : : // write text
1007 [ # # ]: 0 : WriteTextBox( xShape, mnXmlNamespace );
1008 : :
1009 [ # # ]: 0 : pFS->endElementNS( mnXmlNamespace, XML_sp );
1010 : :
1011 [ # # ][ # # ]: 0 : return *this;
1012 : : }
1013 : :
1014 : 0 : ShapeExport& ShapeExport::WriteNonVisualDrawingProperties( Reference< XShape > xShape, const char* pName )
1015 : : {
1016 : : GetFS()->singleElementNS( mnXmlNamespace, XML_cNvPr,
1017 : : XML_id, I32S( GetNewShapeID( xShape ) ),
1018 : : XML_name, pName,
1019 [ # # ][ # # ]: 0 : FSEND );
[ # # ][ # # ]
1020 : :
1021 : 0 : return *this;
1022 : : }
1023 : :
1024 : 0 : ShapeExport& ShapeExport::WriteNonVisualProperties( Reference< XShape > )
1025 : : {
1026 : : // Override to generate //nvPr elements.
1027 : 0 : return *this;
1028 : : }
1029 : :
1030 : 0 : ShapeExport& ShapeExport::WriteRectangleShape( Reference< XShape > xShape )
1031 : : {
1032 : : DBG(printf("write rectangle shape\n"));
1033 : :
1034 [ # # ]: 0 : FSHelperPtr pFS = GetFS();
1035 : :
1036 [ # # ]: 0 : pFS->startElementNS( mnXmlNamespace, XML_sp, FSEND );
1037 : :
1038 : 0 : sal_Int32 nRadius = 0;
1039 : :
1040 [ # # ]: 0 : Reference< XPropertySet > xShapeProps( xShape, UNO_QUERY );
1041 [ # # ]: 0 : if( xShapeProps.is() )
1042 : : {
1043 [ # # ][ # # ]: 0 : xShapeProps->getPropertyValue( S( "CornerRadius" ) ) >>= nRadius;
[ # # ][ # # ]
[ # # ]
1044 : : }
1045 : :
1046 [ # # ]: 0 : if( nRadius )
1047 : : {
1048 [ # # ]: 0 : nRadius = MapSize( awt::Size( nRadius, 0 ) ).Width;
1049 : : }
1050 : :
1051 : : // non visual shape properties
1052 [ # # ]: 0 : pFS->startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND );
1053 : : pFS->singleElementNS( mnXmlNamespace, XML_cNvPr,
1054 : : XML_id, I32S( GetNewShapeID( xShape ) ),
1055 : : XML_name, IDS( Rectangle ),
1056 [ # # ][ # # ]: 0 : FSEND );
1057 [ # # ]: 0 : pFS->singleElementNS( mnXmlNamespace, XML_cNvSpPr, FSEND );
1058 [ # # ]: 0 : WriteNonVisualProperties( xShape );
1059 [ # # ]: 0 : pFS->endElementNS( mnXmlNamespace, XML_nvSpPr );
1060 : :
1061 : : // visual shape properties
1062 [ # # ]: 0 : pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND );
1063 [ # # ]: 0 : WriteShapeTransformation( xShape, XML_a );
1064 [ # # ]: 0 : WritePresetShape( "rect" );
1065 [ # # ]: 0 : Reference< XPropertySet > xProps( xShape, UNO_QUERY );
1066 [ # # ]: 0 : if( xProps.is() )
1067 : : {
1068 [ # # ]: 0 : WriteFill( xProps );
1069 [ # # ]: 0 : WriteOutline( xProps );
1070 : : }
1071 [ # # ]: 0 : pFS->endElementNS( mnXmlNamespace, XML_spPr );
1072 : :
1073 : : // write text
1074 [ # # ]: 0 : WriteTextBox( xShape, mnXmlNamespace );
1075 : :
1076 [ # # ]: 0 : pFS->endElementNS( mnXmlNamespace, XML_sp );
1077 : :
1078 [ # # ]: 0 : return *this;
1079 : : }
1080 : :
1081 : : typedef ShapeExport& (ShapeExport::*ShapeConverter)( Reference< XShape > );
1082 : : typedef boost::unordered_map< const char*, ShapeConverter, StringHash, StringCheck> NameToConvertMapType;
1083 : :
1084 : 0 : static const NameToConvertMapType& lcl_GetConverters()
1085 : : {
1086 : : static bool shape_map_inited = false;
1087 [ # # ][ # # ]: 0 : static NameToConvertMapType shape_converters;
[ # # ][ # # ]
1088 [ # # ]: 0 : if( shape_map_inited )
1089 : : {
1090 : 0 : return shape_converters;
1091 : : }
1092 : :
1093 [ # # ]: 0 : shape_converters[ "com.sun.star.drawing.ClosedBezierShape" ] = &ShapeExport::WriteClosedBezierShape;
1094 [ # # ]: 0 : shape_converters[ "com.sun.star.drawing.ConnectorShape" ] = &ShapeExport::WriteConnectorShape;
1095 [ # # ]: 0 : shape_converters[ "com.sun.star.drawing.CustomShape" ] = &ShapeExport::WriteCustomShape;
1096 [ # # ]: 0 : shape_converters[ "com.sun.star.drawing.EllipseShape" ] = &ShapeExport::WriteEllipseShape;
1097 [ # # ]: 0 : shape_converters[ "com.sun.star.drawing.GraphicObjectShape" ] = &ShapeExport::WriteGraphicObjectShape;
1098 [ # # ]: 0 : shape_converters[ "com.sun.star.drawing.LineShape" ] = &ShapeExport::WriteLineShape;
1099 [ # # ]: 0 : shape_converters[ "com.sun.star.drawing.OpenBezierShape" ] = &ShapeExport::WriteOpenBezierShape;
1100 [ # # ]: 0 : shape_converters[ "com.sun.star.drawing.RectangleShape" ] = &ShapeExport::WriteRectangleShape;
1101 [ # # ]: 0 : shape_converters[ "com.sun.star.drawing.OLE2Shape" ] = &ShapeExport::WriteOLE2Shape;
1102 [ # # ]: 0 : shape_converters[ "com.sun.star.drawing.TableShape" ] = &ShapeExport::WriteTableShape;
1103 [ # # ]: 0 : shape_converters[ "com.sun.star.drawing.TextShape" ] = &ShapeExport::WriteTextShape;
1104 [ # # ]: 0 : shape_converters[ "com.sun.star.presentation.DateTimeShape" ] = &ShapeExport::WriteTextShape;
1105 [ # # ]: 0 : shape_converters[ "com.sun.star.presentation.FooterShape" ] = &ShapeExport::WriteTextShape;
1106 [ # # ]: 0 : shape_converters[ "com.sun.star.presentation.HeaderShape" ] = &ShapeExport::WriteTextShape;
1107 [ # # ]: 0 : shape_converters[ "com.sun.star.presentation.NotesShape" ] = &ShapeExport::WriteTextShape;
1108 [ # # ]: 0 : shape_converters[ "com.sun.star.presentation.OutlinerShape" ] = &ShapeExport::WriteTextShape;
1109 [ # # ]: 0 : shape_converters[ "com.sun.star.presentation.SlideNumberShape" ] = &ShapeExport::WriteTextShape;
1110 [ # # ]: 0 : shape_converters[ "com.sun.star.presentation.TitleTextShape" ] = &ShapeExport::WriteTextShape;
1111 : 0 : shape_map_inited = true;
1112 : :
1113 : 0 : return shape_converters;
1114 : : }
1115 : :
1116 : 0 : ShapeExport& ShapeExport::WriteShape( Reference< XShape > xShape )
1117 : : {
1118 [ # # ][ # # ]: 0 : OUString sShapeType = xShape->getShapeType();
1119 : : DBG( printf( "write shape: %s\n", USS( sShapeType ) ) );
1120 [ # # ][ # # ]: 0 : NameToConvertMapType::const_iterator aConverter = lcl_GetConverters().find( USS( sShapeType ) );
[ # # ]
1121 [ # # ][ # # ]: 0 : if( aConverter == lcl_GetConverters().end() )
[ # # ]
1122 : : {
1123 : : DBG( printf( "unknown shape\n" ) );
1124 [ # # ]: 0 : return WriteUnknownShape( xShape );
1125 : : }
1126 [ # # ][ # # ]: 0 : (this->*(aConverter->second))( xShape );
[ # # ]
1127 : :
1128 : 0 : return *this;
1129 : : }
1130 : :
1131 : 0 : ShapeExport& ShapeExport::WriteTextBox( Reference< XInterface > xIface, sal_Int32 nXmlNamespace )
1132 : : {
1133 [ # # ][ # # ]: 0 : if( NonEmptyText( xIface ) )
1134 : : {
1135 [ # # ]: 0 : FSHelperPtr pFS = GetFS();
1136 : :
1137 [ # # ]: 0 : pFS->startElementNS( nXmlNamespace, XML_txBody, FSEND );
1138 [ # # ]: 0 : WriteText( xIface );
1139 [ # # ][ # # ]: 0 : pFS->endElementNS( nXmlNamespace, XML_txBody );
1140 : : }
1141 : :
1142 : 0 : return *this;
1143 : : }
1144 : :
1145 : 0 : void ShapeExport::WriteTable( Reference< XShape > rXShape )
1146 : : {
1147 : : OSL_TRACE("write table");
1148 : :
1149 : 0 : Reference< XTable > xTable;
1150 [ # # ]: 0 : Reference< XPropertySet > xPropSet( rXShape, UNO_QUERY );
1151 : :
1152 [ # # ]: 0 : mpFS->startElementNS( XML_a, XML_graphic, FSEND );
1153 [ # # ]: 0 : mpFS->startElementNS( XML_a, XML_graphicData, XML_uri, "http://schemas.openxmlformats.org/drawingml/2006/table", FSEND );
1154 : :
1155 [ # # ][ # # ]: 0 : if ( xPropSet.is() && ( xPropSet->getPropertyValue( S("Model") ) >>= xTable ) )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # #
# # # # #
# ]
1156 : : {
1157 [ # # ]: 0 : mpFS->startElementNS( XML_a, XML_tbl, FSEND );
1158 [ # # ]: 0 : mpFS->singleElementNS( XML_a, XML_tblPr, FSEND );
1159 : :
1160 [ # # ]: 0 : Reference< XColumnRowRange > xColumnRowRange( xTable, UNO_QUERY_THROW );
1161 [ # # ][ # # ]: 0 : Reference< container::XIndexAccess > xColumns( xColumnRowRange->getColumns(), UNO_QUERY_THROW );
[ # # ]
1162 [ # # ][ # # ]: 0 : Reference< container::XIndexAccess > xRows( xColumnRowRange->getRows(), UNO_QUERY_THROW );
[ # # ]
1163 [ # # ][ # # ]: 0 : sal_uInt16 nRowCount = static_cast< sal_uInt16 >( xRows->getCount() );
1164 [ # # ][ # # ]: 0 : sal_uInt16 nColumnCount = static_cast< sal_uInt16 >( xColumns->getCount() );
1165 : :
1166 [ # # ]: 0 : mpFS->startElementNS( XML_a, XML_tblGrid, FSEND );
1167 : :
1168 [ # # ]: 0 : for ( sal_Int32 x = 0; x < nColumnCount; x++ )
1169 : : {
1170 [ # # ][ # # ]: 0 : Reference< XPropertySet > xColPropSet( xColumns->getByIndex( x ), UNO_QUERY_THROW );
[ # # ]
1171 : 0 : sal_Int32 nWidth(0);
1172 [ # # ][ # # ]: 0 : xColPropSet->getPropertyValue( S("Width") ) >>= nWidth;
[ # # ][ # # ]
[ # # ]
1173 : :
1174 [ # # ]: 0 : mpFS->singleElementNS( XML_a, XML_gridCol, XML_w, I64S(MM100toEMU(nWidth)), FSEND );
1175 : 0 : }
1176 : :
1177 [ # # ]: 0 : mpFS->endElementNS( XML_a, XML_tblGrid );
1178 : :
1179 [ # # ]: 0 : Reference< XCellRange > xCellRange( xTable, UNO_QUERY_THROW );
1180 [ # # ]: 0 : for( sal_Int32 nRow = 0; nRow < nRowCount; nRow++ )
1181 : : {
1182 [ # # ][ # # ]: 0 : Reference< XPropertySet > xRowPropSet( xRows->getByIndex( nRow ), UNO_QUERY_THROW );
[ # # ]
1183 : 0 : sal_Int32 nRowHeight(0);
1184 : :
1185 [ # # ][ # # ]: 0 : xRowPropSet->getPropertyValue( S("Height") ) >>= nRowHeight;
[ # # ][ # # ]
[ # # ]
1186 : :
1187 [ # # ]: 0 : mpFS->startElementNS( XML_a, XML_tr, XML_h, I64S( MM100toEMU( nRowHeight ) ), FSEND );
1188 : :
1189 [ # # ]: 0 : for( sal_Int32 nColumn = 0; nColumn < nColumnCount; nColumn++ )
1190 : : {
1191 [ # # ][ # # ]: 0 : Reference< XMergeableCell > xCell( xCellRange->getCellByPosition( nColumn, nRow ), UNO_QUERY_THROW );
[ # # ]
1192 [ # # ][ # # ]: 0 : if ( !xCell->isMerged() )
[ # # ]
1193 : : {
1194 [ # # ]: 0 : mpFS->startElementNS( XML_a, XML_tc, FSEND );
1195 : :
1196 [ # # ]: 0 : WriteTextBox( xCell, XML_a );
1197 : :
1198 [ # # ]: 0 : mpFS->singleElementNS( XML_a, XML_tcPr, FSEND );
1199 [ # # ]: 0 : mpFS->endElementNS( XML_a, XML_tc );
1200 : : }
1201 : 0 : }
1202 : :
1203 [ # # ]: 0 : mpFS->endElementNS( XML_a, XML_tr );
1204 : 0 : }
1205 : :
1206 [ # # ]: 0 : mpFS->endElementNS( XML_a, XML_tbl );
1207 : : }
1208 : :
1209 [ # # ]: 0 : mpFS->endElementNS( XML_a, XML_graphicData );
1210 [ # # ]: 0 : mpFS->endElementNS( XML_a, XML_graphic );
1211 : 0 : }
1212 : :
1213 : 0 : ShapeExport& ShapeExport::WriteTableShape( Reference< XShape > xShape )
1214 : : {
1215 [ # # ]: 0 : FSHelperPtr pFS = GetFS();
1216 : :
1217 : : OSL_TRACE("write table shape");
1218 : :
1219 [ # # ]: 0 : pFS->startElementNS( mnXmlNamespace, XML_graphicFrame, FSEND );
1220 : :
1221 [ # # ]: 0 : pFS->startElementNS( mnXmlNamespace, XML_nvGraphicFramePr, FSEND );
1222 : :
1223 : : pFS->singleElementNS( mnXmlNamespace, XML_cNvPr,
1224 : : XML_id, I32S( GetNewShapeID( xShape ) ),
1225 : : XML_name, IDS(Table),
1226 [ # # ][ # # ]: 0 : FSEND );
1227 : :
1228 : : pFS->singleElementNS( mnXmlNamespace, XML_cNvGraphicFramePr,
1229 [ # # ]: 0 : FSEND );
1230 : :
1231 [ # # ]: 0 : if( GetDocumentType() == DOCUMENT_PPTX )
1232 : : pFS->singleElementNS( mnXmlNamespace, XML_nvPr,
1233 [ # # ]: 0 : FSEND );
1234 [ # # ]: 0 : pFS->endElementNS( mnXmlNamespace, XML_nvGraphicFramePr );
1235 : :
1236 [ # # ]: 0 : WriteShapeTransformation( xShape, mnXmlNamespace );
1237 [ # # ]: 0 : WriteTable( xShape );
1238 : :
1239 [ # # ]: 0 : pFS->endElementNS( mnXmlNamespace, XML_graphicFrame );
1240 : :
1241 [ # # ]: 0 : return *this;
1242 : : }
1243 : :
1244 : 0 : ShapeExport& ShapeExport::WriteTextShape( Reference< XShape > xShape )
1245 : : {
1246 [ # # ]: 0 : FSHelperPtr pFS = GetFS();
1247 : :
1248 [ # # ]: 0 : pFS->startElementNS( mnXmlNamespace, XML_sp, FSEND );
1249 : :
1250 : : // non visual shape properties
1251 [ # # ]: 0 : pFS->startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND );
1252 [ # # ]: 0 : WriteNonVisualDrawingProperties( xShape, IDS( TextShape ) );
1253 [ # # ]: 0 : pFS->singleElementNS( mnXmlNamespace, XML_cNvSpPr, XML_txBox, "1", FSEND );
1254 [ # # ]: 0 : WriteNonVisualProperties( xShape );
1255 [ # # ]: 0 : pFS->endElementNS( mnXmlNamespace, XML_nvSpPr );
1256 : :
1257 : : // visual shape properties
1258 [ # # ]: 0 : pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND );
1259 [ # # ]: 0 : WriteShapeTransformation( xShape, XML_a );
1260 [ # # ]: 0 : WritePresetShape( "rect" );
1261 [ # # ][ # # ]: 0 : WriteBlipFill( Reference< XPropertySet >(xShape, UNO_QUERY ), S( "GraphicURL" ) );
[ # # ][ # # ]
1262 [ # # ]: 0 : pFS->endElementNS( mnXmlNamespace, XML_spPr );
1263 : :
1264 [ # # ]: 0 : WriteTextBox( xShape, mnXmlNamespace );
1265 : :
1266 [ # # ]: 0 : pFS->endElementNS( mnXmlNamespace, XML_sp );
1267 : :
1268 [ # # ]: 0 : return *this;
1269 : : }
1270 : :
1271 : 0 : ShapeExport& ShapeExport::WriteOLE2Shape( Reference< XShape > xShape )
1272 : : {
1273 [ # # ]: 0 : Reference< XPropertySet > xPropSet( xShape, UNO_QUERY );
1274 [ # # ][ # # ]: 0 : if( xPropSet.is() && GetProperty( xPropSet, S("Model") ) )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # #
# # # # ]
1275 : : {
1276 : 0 : Reference< XChartDocument > xChartDoc;
1277 [ # # ]: 0 : mAny >>= xChartDoc;
1278 [ # # ]: 0 : if( xChartDoc.is() )
1279 : : {
1280 : : //export the chart
1281 [ # # ]: 0 : Reference< XModel > xModel( xChartDoc, UNO_QUERY );
1282 [ # # ][ # # ]: 0 : ChartExport aChartExport( mnXmlNamespace, GetFS(), xModel, GetFB(), GetDocumentType() );
[ # # ]
1283 : : static sal_Int32 nChartCount = 0;
1284 [ # # ][ # # ]: 0 : aChartExport.WriteChartObj( xShape, ++nChartCount );
1285 : 0 : }
1286 : : }
1287 : 0 : return *this;
1288 : : }
1289 : :
1290 : 0 : ShapeExport& ShapeExport::WriteUnknownShape( Reference< XShape > )
1291 : : {
1292 : : // Override this method to do something useful.
1293 : 0 : return *this;
1294 : : }
1295 : :
1296 : 0 : size_t ShapeExport::ShapeHash::operator()( const Reference < XShape > rXShape ) const
1297 : : {
1298 : 0 : return rXShape->getShapeType().hashCode();
1299 : : }
1300 : :
1301 : 0 : sal_Int32 ShapeExport::GetNewShapeID( const Reference< XShape > rXShape )
1302 : : {
1303 [ # # ]: 0 : return GetNewShapeID( rXShape, GetFB() );
1304 : : }
1305 : :
1306 : 0 : sal_Int32 ShapeExport::GetNewShapeID( const Reference< XShape > rXShape, XmlFilterBase* pFB )
1307 : : {
1308 [ # # ]: 0 : if( !rXShape.is() )
1309 : 0 : return -1;
1310 : :
1311 : 0 : sal_Int32 nID = pFB->GetUniqueId();
1312 : :
1313 : 0 : (*mpShapeMap)[ rXShape ] = nID;
1314 : :
1315 : 0 : return nID;
1316 : : }
1317 : :
1318 : 0 : sal_Int32 ShapeExport::GetShapeID( const Reference< XShape > rXShape )
1319 : : {
1320 [ # # ]: 0 : return GetShapeID( rXShape, mpShapeMap );
1321 : : }
1322 : :
1323 : 0 : sal_Int32 ShapeExport::GetShapeID( const Reference< XShape > rXShape, ShapeHashMap* pShapeMap )
1324 : : {
1325 [ # # ]: 0 : if( !rXShape.is() )
1326 : 0 : return -1;
1327 : :
1328 [ # # ]: 0 : ShapeHashMap::const_iterator aIter = pShapeMap->find( rXShape );
1329 : :
1330 [ # # ][ # # ]: 0 : if( aIter == pShapeMap->end() )
1331 : 0 : return -1;
1332 : :
1333 [ # # ]: 0 : return aIter->second;
1334 : : }
1335 : :
1336 [ + - ][ + - ]: 285 : } }
1337 : :
1338 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|