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