/src/libreoffice/include/oox/export/drawingml.hxx
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 | | * 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 | | #pragma once |
21 | | |
22 | | #include <map> |
23 | | #include <stack> |
24 | | #include <string_view> |
25 | | #include <unordered_map> |
26 | | #include <utility> |
27 | | #include <vector> |
28 | | |
29 | | #include <com/sun/star/beans/PropertyState.hpp> |
30 | | #include <com/sun/star/uno/Any.hxx> |
31 | | #include <com/sun/star/uno/Reference.hxx> |
32 | | #include <com/sun/star/uno/Sequence.hxx> |
33 | | #include <com/sun/star/style/ParagraphAdjust.hpp> |
34 | | #include <com/sun/star/drawing/Hatch.hpp> |
35 | | #include <com/sun/star/i18n/ScriptType.hpp> |
36 | | #include <oox/dllapi.h> |
37 | | #include <oox/drawingml/drawingmltypes.hxx> |
38 | | #include <oox/export/utils.hxx> |
39 | | #include <rtl/string.hxx> |
40 | | #include <rtl/ustring.hxx> |
41 | | #include <sal/types.h> |
42 | | #include <sax/fshelper.hxx> |
43 | | #include <svx/msdffdef.hxx> |
44 | | #include <vcl/checksum.hxx> |
45 | | #include <vcl/graph.hxx> |
46 | | #include <tools/gen.hxx> |
47 | | #include <tools/color.hxx> |
48 | | #include <vcl/mapmod.hxx> |
49 | | #include <svx/EnhancedCustomShape2d.hxx> |
50 | | #include <basegfx/utils/bgradient.hxx> |
51 | | |
52 | | class Graphic; |
53 | | class SdrObjCustomShape; |
54 | | enum class SvxDateFormat; |
55 | | enum class SvxTimeFormat; |
56 | | |
57 | | namespace com::sun::star { |
58 | | namespace awt { |
59 | | struct FontDescriptor; |
60 | | struct Gradient2; |
61 | | } |
62 | | namespace beans { |
63 | | struct PropertyValue; |
64 | | class XPropertySet; |
65 | | class XPropertyState; |
66 | | } |
67 | | namespace drawing { |
68 | | class XShape; |
69 | | struct EnhancedCustomShapeParameterPair; |
70 | | struct EnhancedCustomShapeParameter; |
71 | | } |
72 | | namespace graphic { |
73 | | class XGraphic; |
74 | | } |
75 | | namespace style { |
76 | | struct LineSpacing; |
77 | | } |
78 | | namespace text { |
79 | | class XTextContent; |
80 | | class XTextRange; |
81 | | class XTextFrame; |
82 | | } |
83 | | namespace io { |
84 | | class XOutputStream; |
85 | | } |
86 | | namespace uno { |
87 | | class XInterface; |
88 | | } |
89 | | namespace frame { |
90 | | class XModel; |
91 | | } |
92 | | } |
93 | | |
94 | | struct EscherConnectorListEntry; |
95 | | class OutlinerParaObject; |
96 | | namespace tools { class Rectangle; } |
97 | | |
98 | | namespace tools { |
99 | | class PolyPolygon; |
100 | | } |
101 | | |
102 | | namespace oox { |
103 | | namespace core { |
104 | | class XmlFilterBase; |
105 | | } |
106 | | |
107 | | namespace drawingml { |
108 | | |
109 | | class OOX_DLLPUBLIC URLTransformer |
110 | | { |
111 | | public: |
112 | | virtual ~URLTransformer(); |
113 | | |
114 | | virtual OUString getTransformedString(const OUString& rURL) const; |
115 | | |
116 | | virtual bool isExternalURL(const OUString& rURL) const; |
117 | | }; |
118 | | |
119 | | // Our rotation is counter-clockwise and is in 100ths of a degree. |
120 | | // drawingML rotation is clockwise and is in 60000ths of a degree. |
121 | | inline sal_Int32 ExportRotateClockwisify(Degree100 input) |
122 | 0 | { |
123 | 0 | return ((21600000 - input.get() * 600) % 21600000); |
124 | 0 | } |
125 | | |
126 | | /// Interface to be implemented by the parent exporter that knows how to handle shape text. |
127 | | class OOX_DLLPUBLIC DMLTextExport |
128 | | { |
129 | | public: |
130 | | virtual void WriteOutliner(const OutlinerParaObject& rParaObj) = 0; |
131 | | /// Write the contents of the textbox that is associated to this shape. |
132 | | virtual void WriteTextBox(css::uno::Reference<css::drawing::XShape> xShape) = 0; |
133 | | /// Get textbox which belongs to the shape. |
134 | | virtual css::uno::Reference<css::text::XTextFrame> GetUnoTextFrame( |
135 | | css::uno::Reference<css::drawing::XShape> xShape) = 0; |
136 | | protected: |
137 | 0 | DMLTextExport() {} |
138 | 0 | virtual ~DMLTextExport() {} |
139 | | }; |
140 | | |
141 | | constexpr std::u16string_view getComponentDir(DocumentType eDocumentType) |
142 | 0 | { |
143 | 0 | switch (eDocumentType) |
144 | 0 | { |
145 | 0 | case DOCUMENT_DOCX: return u"word"; |
146 | 0 | case DOCUMENT_PPTX: return u"ppt"; |
147 | 0 | case DOCUMENT_XLSX: return u"xl"; |
148 | 0 | } |
149 | | |
150 | 0 | return u""; |
151 | 0 | } |
152 | | |
153 | | constexpr std::u16string_view getRelationCompPrefix(DocumentType eDocumentType) |
154 | 0 | { |
155 | 0 | switch (eDocumentType) |
156 | 0 | { |
157 | 0 | case DOCUMENT_DOCX: return u""; |
158 | 0 | case DOCUMENT_PPTX: |
159 | 0 | case DOCUMENT_XLSX: return u"../"; |
160 | 0 | } |
161 | | |
162 | 0 | return u""; |
163 | 0 | } |
164 | | |
165 | | class OOX_DLLPUBLIC GraphicExportCache |
166 | | { |
167 | | private: |
168 | | std::stack<sal_Int32> mnImageCounter; |
169 | | std::stack<std::unordered_map<BitmapChecksum, OUString>> maExportGraphics; |
170 | | std::stack<sal_Int32> mnWdpImageCounter; |
171 | | std::stack<std::map<OUString, OUString>> maWdpCache; |
172 | | |
173 | 0 | GraphicExportCache() = default; |
174 | | public: |
175 | | static GraphicExportCache& get(); |
176 | | |
177 | | void push() |
178 | 0 | { |
179 | 0 | mnImageCounter.push(1); |
180 | 0 | maExportGraphics.emplace(); |
181 | 0 | mnWdpImageCounter.push(1); |
182 | 0 | maWdpCache.emplace(); |
183 | 0 | } |
184 | | |
185 | | void pop() |
186 | 0 | { |
187 | 0 | mnImageCounter.pop(); |
188 | 0 | maExportGraphics.pop(); |
189 | 0 | mnWdpImageCounter.pop(); |
190 | 0 | maWdpCache.pop(); |
191 | 0 | } |
192 | | |
193 | | bool hasExportGraphics() |
194 | 0 | { |
195 | 0 | return !maExportGraphics.empty(); |
196 | 0 | } |
197 | | |
198 | | void addExportGraphics(BitmapChecksum aChecksum, OUString const& sPath) |
199 | 0 | { |
200 | 0 | maExportGraphics.top()[aChecksum] = sPath; |
201 | 0 | } |
202 | | |
203 | | OUString findExportGraphics(BitmapChecksum aChecksum) |
204 | 0 | { |
205 | 0 | OUString sPath; |
206 | 0 | if (!hasExportGraphics()) |
207 | 0 | return sPath; |
208 | | |
209 | 0 | auto aIterator = maExportGraphics.top().find(aChecksum); |
210 | 0 | if (aIterator != maExportGraphics.top().end()) |
211 | 0 | sPath = aIterator->second; |
212 | 0 | return sPath; |
213 | 0 | } |
214 | | |
215 | | sal_Int32 nextImageCount() |
216 | 0 | { |
217 | 0 | sal_Int32 nCount = mnImageCounter.top(); |
218 | 0 | mnImageCounter.top()++; |
219 | 0 | return nCount; |
220 | 0 | } |
221 | | |
222 | | bool hasWdpCache() |
223 | 0 | { |
224 | 0 | return !maWdpCache.empty(); |
225 | 0 | } |
226 | | |
227 | | OUString findWdpID(OUString const& rFileId) |
228 | 0 | { |
229 | 0 | OUString aPath; |
230 | 0 | if (!hasWdpCache()) |
231 | 0 | return aPath; |
232 | 0 | auto aCachedItem = maWdpCache.top().find(rFileId); |
233 | 0 | if (aCachedItem != maWdpCache.top().end()) |
234 | 0 | aPath = aCachedItem->second; |
235 | 0 | return aPath; |
236 | 0 | } |
237 | | |
238 | | void addToWdpCache(OUString const& rFileId, OUString const& rId) |
239 | 0 | { |
240 | 0 | if (hasWdpCache()) |
241 | 0 | maWdpCache.top()[rFileId] = rId; |
242 | 0 | } |
243 | | |
244 | | sal_Int32 nextWdpImageCount() |
245 | 0 | { |
246 | 0 | sal_Int32 nCount = mnWdpImageCounter.top(); |
247 | 0 | mnWdpImageCounter.top()++; |
248 | 0 | return nCount; |
249 | 0 | } |
250 | | }; |
251 | | |
252 | | class OOX_DLLPUBLIC GraphicExport |
253 | | { |
254 | | private: |
255 | | sax_fastparser::FSHelperPtr mpFS; |
256 | | oox::core::XmlFilterBase* mpFilterBase; |
257 | | DocumentType meDocumentType; |
258 | | |
259 | | OUString writeNewEntryToStorage(const Graphic& rGraphic, bool bRelPathToMedia); |
260 | | OUString writeNewSvgEntryToStorage(const Graphic& rGraphic, bool bRelPathToMedia); |
261 | | |
262 | | public: |
263 | | enum class TypeHint |
264 | | { |
265 | | Detect, |
266 | | SVG |
267 | | }; |
268 | | |
269 | | GraphicExport(sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFilterBase, DocumentType eDocumentType) |
270 | 0 | : mpFS(std::move(pFS)) |
271 | 0 | , mpFilterBase(pFilterBase) |
272 | 0 | , meDocumentType(eDocumentType) |
273 | 0 | {} |
274 | | |
275 | | OUString writeToStorage(Graphic const& rGraphic, bool bRelPathToMedia = false, TypeHint eHint = TypeHint::Detect); |
276 | | |
277 | | void writeBlip(Graphic const& rGraphic, std::vector<model::BlipEffect> const& rEffects); |
278 | | void writeSvgExtension(OUString const& rSvgRelId); |
279 | | }; |
280 | | |
281 | | struct WriteRunInput |
282 | | { |
283 | | bool bIsField = false; |
284 | | bool bCheckDirect = false; |
285 | | bool bOverridingCharHeight = false; |
286 | | sal_Int32 nCharHeight = -1; |
287 | | sal_Int16 nScriptType = css::i18n::ScriptType::LATIN; |
288 | | bool bUseTextSchemeColors = false; |
289 | | css::uno::Reference<css::beans::XPropertySet> xShapePropSet; |
290 | | }; |
291 | | |
292 | | class DrawingML |
293 | | { |
294 | | |
295 | | private: |
296 | | OOX_DLLPUBLIC static sal_Int32 mnDrawingMLCount; |
297 | | OOX_DLLPUBLIC static sal_Int32 mnVmlCount; |
298 | | |
299 | | /// To specify where write eg. the images to (like 'ppt', or 'word' - according to the OPC). |
300 | | DocumentType meDocumentType; |
301 | | /// Parent exporter, used for text callback. |
302 | | DMLTextExport* mpTextExport; |
303 | | |
304 | | static constexpr const sal_Int32 mconstDefaultLeftRightInset = 254; |
305 | | static constexpr const sal_Int32 mconstDefaultTopBottomInset = 127; |
306 | | |
307 | | protected: |
308 | | css::uno::Any mAny; |
309 | | ::sax_fastparser::FSHelperPtr mpFS; |
310 | | ::oox::core::XmlFilterBase* mpFB; |
311 | | /// If set, this is the parent of the currently handled shape. |
312 | | css::uno::Reference<css::drawing::XShape> m_xParent; |
313 | | bool mbIsBackgroundDark; |
314 | | OOX_DLLPUBLIC static sal_Int32 mnChartCount; |
315 | | |
316 | | /// True when exporting presentation placeholder shape. |
317 | | bool mbPlaceholder; |
318 | | |
319 | | bool mbEmbedFonts = false; |
320 | | |
321 | | bool GetProperty( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, const OUString& aName ); |
322 | | bool GetPropertyAndState( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, |
323 | | const css::uno::Reference< css::beans::XPropertyState >& rXPropState, |
324 | | const OUString& aName, css::beans::PropertyState& eState ); |
325 | | bool GetDirectProperty(const css::uno::Reference<css::beans::XPropertySet>& rXPropSet, |
326 | | const css::uno::Reference<css::beans::XPropertyState>& rXPropState, |
327 | | const OUString& aName); |
328 | | OUString GetFieldValue( const css::uno::Reference< css::text::XTextRange >& rRun, bool& bIsURLField ); |
329 | | /** Gets OOXML datetime field type from LO Date format |
330 | | |
331 | | @param eDate LO Date format |
332 | | */ |
333 | | static OUString GetDatetimeTypeFromDate(SvxDateFormat eDate); |
334 | | /** Gets OOXML datetime field type from LO Time format |
335 | | |
336 | | @param eTime LO Time format |
337 | | */ |
338 | | static OUString GetDatetimeTypeFromTime(SvxTimeFormat eTime); |
339 | | /** Gets OOXML datetime field type from combination of LO Time and Date formats |
340 | | |
341 | | @param eDate LO Date format |
342 | | @param eTime LO Time format |
343 | | */ |
344 | | OOX_DLLPUBLIC static OUString GetDatetimeTypeFromDateTime(SvxDateFormat eDate, SvxTimeFormat eTime); |
345 | | |
346 | | /// Output the media (including copying a video from vnd.sun.star.Package: to the output if necessary). |
347 | | void WriteMediaNonVisualProperties(const css::uno::Reference<css::drawing::XShape>& xShape); |
348 | | |
349 | | void WriteStyleProperties( sal_Int32 nTokenId, const css::uno::Sequence< css::beans::PropertyValue >& aProperties ); |
350 | | |
351 | | OUString GetComponentDir() const; |
352 | | OUString GetRelationCompPrefix() const; |
353 | | |
354 | | static bool EqualGradients( const css::awt::Gradient2& rGradient1, const css::awt::Gradient2& rGradient2 ); |
355 | | bool IsFontworkShape(const css::uno::Reference< css::beans::XPropertySet >& rXShapePropSet); |
356 | | |
357 | | void WriteGlowEffect(const css::uno::Reference<css::beans::XPropertySet>& rXPropSet); |
358 | | void WriteTextGlowEffect(const css::uno::Reference<css::beans::XPropertySet>& rXPropSet); |
359 | | void WriteSoftEdgeEffect(const css::uno::Reference<css::beans::XPropertySet>& rXPropSet); |
360 | | void WriteCustomGeometryPoint(const css::drawing::EnhancedCustomShapeParameterPair& rParamPair, |
361 | | const EnhancedCustomShape2d& rCustomShape2d, |
362 | | const bool bReplaceGeoWidth, const bool bReplaceGeoHeight); |
363 | | bool WriteCustomGeometrySegment( |
364 | | const sal_Int16 eCommand, const sal_Int32 nCount, |
365 | | const css::uno::Sequence<css::drawing::EnhancedCustomShapeParameterPair>& rPairs, |
366 | | sal_Int32& rnPairIndex, double& rfCurrentX, double& rfCurrentY, bool& rbCurrentValid, |
367 | | const EnhancedCustomShape2d& rCustomShape2d, |
368 | | const bool bReplaceGeoWidth, const bool bReplaceGeoHeight); |
369 | | |
370 | | public: |
371 | | OOX_DLLPUBLIC DrawingML(::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB, DocumentType eDocumentType = DOCUMENT_PPTX, DMLTextExport* pTextExport = nullptr); |
372 | 0 | void SetFS(const ::sax_fastparser::FSHelperPtr& pFS) { mpFS = pFS; } |
373 | 0 | const ::sax_fastparser::FSHelperPtr& GetFS() const { return mpFS; } |
374 | 0 | ::oox::core::XmlFilterBase* GetFB() { return mpFB; } |
375 | 0 | DocumentType GetDocumentType() const { return meDocumentType; } |
376 | | /// The application-specific text exporter callback, if there is one. |
377 | 0 | DMLTextExport* GetTextExport() { return mpTextExport; } |
378 | | |
379 | 0 | void SetBackgroundDark(bool bIsDark) { mbIsBackgroundDark = bIsDark; } |
380 | | /// If bRelPathToMedia is true add "../" to image folder path while adding the image relationship |
381 | | OOX_DLLPUBLIC OUString writeGraphicToStorage(const Graphic &rGraphic , bool bRelPathToMedia = false, GraphicExport::TypeHint eHint = GraphicExport::TypeHint::Detect); |
382 | | |
383 | | void WriteColor( ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT ); |
384 | | void WriteColor( const OUString& sColorSchemeName, const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT ); |
385 | | void WriteColor( const ::Color nColor, const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT ); |
386 | | void WriteColorTransformations( const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT ); |
387 | | void WriteGradientStop(double fOffset, const basegfx::BColor& rColor, const basegfx::BColor& rAlpha); |
388 | | void WriteLineArrow( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, bool bLineStart ); |
389 | | void WriteConnectorConnections( sal_Int32 nStartGlueId, sal_Int32 nEndGlueId, sal_Int32 nStartID, sal_Int32 nEndID ); |
390 | | |
391 | | bool WriteCharColor(const css::uno::Reference<css::beans::XPropertySet>& xPropertySet); |
392 | | bool WriteSchemeColor(OUString const& rPropertyName, const css::uno::Reference<css::beans::XPropertySet>& xPropertySet, bool bUseTextSchemeColors = false); |
393 | | |
394 | | void WriteSolidFill( ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT ); |
395 | | void WriteSolidFill( const OUString& sSchemeName, const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT ); |
396 | | void WriteSolidFill( const ::Color nColor, const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT ); |
397 | | void WriteSolidFill( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet ); |
398 | | OOX_DLLPUBLIC void WriteGradientFill( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet ); |
399 | | |
400 | | /* New API for WriteGradientFill: |
401 | | If a BGradient is given, it will be used. Else, the 'Fix' entry will be used for |
402 | | Color or Transparency. That way, less Pseudo(Color|Transparency)Gradients have to be |
403 | | created at caller side. |
404 | | NOTE: Giving no Gradient at all (both nullptr) is an error. |
405 | | */ |
406 | | void WriteGradientFill( |
407 | | const basegfx::BGradient* pColorGradient, sal_Int32 nFixColor, |
408 | | const basegfx::BGradient* pTransparenceGradient, double fFixTransparence = 0.0); |
409 | | |
410 | | void WriteGrabBagGradientFill( const css::uno::Sequence< css::beans::PropertyValue >& aGradientStops, const basegfx::BGradient& rGradient); |
411 | | |
412 | | void WriteBlipOrNormalFill(const css::uno::Reference<css::beans::XPropertySet>& rXPropSet, |
413 | | const OUString& rURLPropName, const css::awt::Size& rSize = {}); |
414 | | OOX_DLLPUBLIC void WriteBlipFill(const css::uno::Reference<css::beans::XPropertySet>& rXPropSet, |
415 | | const OUString& sURLPropName, const css::awt::Size& rSize = {}); |
416 | | void WriteBlipFill(const css::uno::Reference<css::beans::XPropertySet>& rXPropSet, |
417 | | const css::awt::Size& rSize, const OUString& sURLPropName, |
418 | | sal_Int32 nXmlNamespace); |
419 | | |
420 | | void WriteXGraphicBlipFill(css::uno::Reference<css::beans::XPropertySet> const & rXPropSet, |
421 | | css::uno::Reference<css::graphic::XGraphic> const & rxGraphic, |
422 | | sal_Int32 nXmlNamespace, bool bWriteMode, |
423 | | bool bRelPathToMedia = false, css::awt::Size const& rSize = {}); |
424 | | |
425 | | void WritePattFill( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet ); |
426 | | void WritePattFill(const css::uno::Reference<css::beans::XPropertySet>& rXPropSet, |
427 | | const css::drawing::Hatch& rHatch); |
428 | | |
429 | | void WriteGraphicCropProperties(css::uno::Reference<css::beans::XPropertySet> const & rxPropertySet, |
430 | | Size const & rOriginalSize, MapMode const & rMapMode); |
431 | | |
432 | | void WriteSrcRectXGraphic(css::uno::Reference<css::beans::XPropertySet> const & rxPropertySet, |
433 | | css::uno::Reference<css::graphic::XGraphic> const & rxGraphic); |
434 | | |
435 | | OOX_DLLPUBLIC void WriteOutline( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, |
436 | | css::uno::Reference< css::frame::XModel> const & xModel = nullptr ); |
437 | | |
438 | | void WriteXGraphicStretch(css::uno::Reference<css::beans::XPropertySet> const & rXPropSet, |
439 | | css::uno::Reference<css::graphic::XGraphic> const & rxGraphic); |
440 | | |
441 | | void WriteXGraphicTile(css::uno::Reference<css::beans::XPropertySet> const& rXPropSet, |
442 | | css::uno::Reference<css::graphic::XGraphic> const& rxGraphic, |
443 | | css::awt::Size const& rSize); |
444 | | |
445 | | void WriteXGraphicCustomPosition(css::uno::Reference<css::beans::XPropertySet> const& rXPropSet, |
446 | | css::uno::Reference<css::graphic::XGraphic> const& rxGraphic, |
447 | | css::awt::Size const& rSize); |
448 | | |
449 | | void WriteLinespacing(const css::style::LineSpacing& rLineSpacing, float fFirstCharHeight); |
450 | | |
451 | | void WriteXGraphicBlip(css::uno::Reference<css::beans::XPropertySet> const & rXPropSet, |
452 | | css::uno::Reference<css::graphic::XGraphic> const & rxGraphic, |
453 | | bool bRelPathToMedia); |
454 | | |
455 | | void WriteImageBrightnessContrastTransparence(css::uno::Reference<css::beans::XPropertySet> const & rXPropSet); |
456 | | |
457 | | void WriteXGraphicBlipMode(css::uno::Reference<css::beans::XPropertySet> const& rXPropSet, |
458 | | css::uno::Reference<css::graphic::XGraphic> const& rxGraphic, |
459 | | css::awt::Size const& rSize); |
460 | | |
461 | | OOX_DLLPUBLIC void WriteShapeTransformation(const css::uno::Reference< css::drawing::XShape >& rXShape, |
462 | | sal_Int32 nXmlNamespace, bool bFlipH = false, bool bFlipV = false, bool bSuppressRotation = false, bool bSuppressFlipping = false, bool bFlippedBeforeRotation = false); |
463 | | void WriteTransformation(const css::uno::Reference< css::drawing::XShape >& xShape, const tools::Rectangle& rRectangle, |
464 | | sal_Int32 nXmlNamespace, bool bFlipH = false, bool bFlipV = false, sal_Int32 nRotation = 0, bool bIsGroupShape = false); |
465 | | |
466 | | void WriteText( const css::uno::Reference< css::uno::XInterface >& rXIface, bool bBodyPr, bool bText = true, sal_Int32 nXmlNamespace = 0, bool bWritePropertiesAsLstStyles = false); |
467 | | |
468 | | void WriteBodyProps( |
469 | | const css::uno::Reference< css::uno::XInterface >& rXIface, |
470 | | sal_Int32 nXmlNamespace, bool bIsFontworkShape, |
471 | | sal_Int32 nTop, sal_Int32 nBottom, sal_Int32 nLeft, sal_Int32 nRight); |
472 | | |
473 | | /// Writes one list level inside the list styles container. |
474 | | void WriteLstStyle(const css::uno::Reference<css::text::XTextContent>& rParagraph, |
475 | | bool& rbOverridingCharHeight, sal_Int32& rnCharHeight, |
476 | | const css::uno::Reference<css::beans::XPropertySet>& rXShapePropSet, |
477 | | sal_Int32 nElement); |
478 | | /** Populates the lstStyle with the shape's text run and paragraph properties */ |
479 | | void WriteLstStyles(const css::uno::Reference<css::text::XTextContent>& rParagraph, |
480 | | bool& rbOverridingCharHeight, sal_Int32& rnCharHeight, |
481 | | const css::uno::Reference<css::beans::XPropertySet>& rXShapePropSet); |
482 | | void WriteParagraph( const css::uno::Reference< css::text::XTextContent >& rParagraph, |
483 | | bool& rbOverridingCharHeight, sal_Int32& rnCharHeight, const css::uno::Reference< css::beans::XPropertySet >& rXShapePropSet); |
484 | | /** Writes paragraph properties |
485 | | |
486 | | @returns true if any paragraph properties were written |
487 | | */ |
488 | | bool WriteParagraphProperties(const css::uno::Reference< css::text::XTextContent >& rParagraph, float fFirstCharHeight, sal_Int32 nElement); |
489 | | void WriteParagraphNumbering(const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, float fFirstCharHeight, |
490 | | sal_Int16 nLevel ); |
491 | | void WriteParagraphTabStops(const css::uno::Reference<css::beans::XPropertySet>& rXPropSet); |
492 | | void WriteRun( const css::uno::Reference< css::text::XTextRange >& rRun, |
493 | | bool& rbOverridingCharHeight, sal_Int32& rnCharHeight, |
494 | | const css::uno::Reference< css::beans::XPropertySet >& rXShapePropSet); |
495 | | |
496 | | void WriteRunProperties(const css::uno::Reference< css::beans::XPropertySet >& rRun, sal_Int32 nElement, WriteRunInput& rRunInput); |
497 | | |
498 | | void WritePresetShape( const OString& pShape , std::vector< std::pair<sal_Int32,sal_Int32>> & rAvList ); |
499 | | OOX_DLLPUBLIC void WritePresetShape( const OString& pShape ); |
500 | | void WritePresetShape( const OString& pShape, MSO_SPT eShapeType, bool bPredefinedHandlesUsed, const css::beans::PropertyValue& rProp ); |
501 | | bool WriteCustomGeometry( |
502 | | const css::uno::Reference<css::drawing::XShape>& rXShape, |
503 | | const SdrObjCustomShape& rSdrObjCustomShape); |
504 | | void WriteEmptyCustomGeometry(); |
505 | | void WritePolyPolygon(const css::uno::Reference<css::drawing::XShape>& rXShape, |
506 | | const bool bClosed); |
507 | | OOX_DLLPUBLIC void WriteFill(const css::uno::Reference<css::beans::XPropertySet>& xPropSet, |
508 | | const css::awt::Size& rSize = {}); |
509 | | void WriteShapeStyle( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet ); |
510 | | OOX_DLLPUBLIC void WriteShapeEffects( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet ); |
511 | | void WriteShapeEffect( std::u16string_view sName, const css::uno::Sequence< css::beans::PropertyValue >& aEffectProps ); |
512 | | /** Populates scene3d tag |
513 | | @param rXPropSet Prop set |
514 | | @param bIsText True if the 3D effects are for a text body, false if it is for a shape |
515 | | */ |
516 | | OOX_DLLPUBLIC void Write3DEffects(const css::uno::Reference<css::beans::XPropertySet>& rXPropSet, bool bIsText); |
517 | | void WriteArtisticEffect( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet ); |
518 | | OString WriteWdpPicture( const OUString& rFileId, const css::uno::Sequence< sal_Int8 >& rPictureData ); |
519 | | OOX_DLLPUBLIC void WriteDiagram(const css::uno::Reference<css::drawing::XShape>& rXShape, |
520 | | sal_Int32 nDiagramId, sal_Int32 nShapeId = -1); |
521 | | void writeDiagramRels(const css::uno::Sequence<css::uno::Sequence<css::uno::Any>>& xRelSeq, |
522 | | const css::uno::Reference<css::io::XOutputStream>& xOutStream, |
523 | | std::u16string_view sGrabBagProperyName, int nDiagramId); |
524 | | static void WriteFromTo(const css::uno::Reference<css::drawing::XShape>& rXShape, const css::awt::Size& aPageSize, |
525 | | const sax_fastparser::FSHelperPtr& pDrawing); |
526 | | |
527 | | static bool IsGroupShape( const css::uno::Reference< css::drawing::XShape >& rXShape ); |
528 | | sal_Int32 getBulletMarginIndentation (const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,sal_Int16 nLevel, std::u16string_view propName); |
529 | | |
530 | | OOX_DLLPUBLIC static void ResetMlCounters(); |
531 | | |
532 | 0 | static sal_Int32 getNewDrawingUniqueId() { return ++mnDrawingMLCount; } |
533 | 0 | static sal_Int32 getNewVMLUniqueId() { return ++mnVmlCount; } |
534 | 0 | static sal_Int32 getNewChartUniqueId() { return ++mnChartCount; } |
535 | | |
536 | | // A Helper to decide the script type for given text in order to call WriteRunProperties. |
537 | | static sal_Int16 GetScriptType(const OUString& rStr); |
538 | | |
539 | | static sal_Unicode SubstituteBullet( sal_Unicode cBulletId, css::awt::FontDescriptor& rFontDesc ); |
540 | | |
541 | | static ::Color ColorWithIntensity( sal_uInt32 nColor, sal_uInt32 nIntensity ); |
542 | | |
543 | | static const char* GetAlignment( css::style::ParagraphAdjust nAlignment, bool bPlaceHolder = false ); |
544 | | |
545 | | sax_fastparser::FSHelperPtr CreateOutputStream ( |
546 | | const OUString& sFullStream, |
547 | | std::u16string_view sRelativeStream, |
548 | | const css::uno::Reference< css::io::XOutputStream >& xParentRelation, |
549 | | const OUString& sContentType, |
550 | | const OUString& sRelationshipType, |
551 | | OUString* pRelationshipId, |
552 | | bool bNoHeader = false); // Don't write a <?xml... header line |
553 | | |
554 | | OOX_DLLPUBLIC std::shared_ptr<GraphicExport> createGraphicExport(); |
555 | | }; |
556 | | |
557 | | } |
558 | | } |
559 | | |
560 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |