tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / include / filter / msfilter / escherex.hxx
blob91606bca13a2de0e67bbfa398f679874935a2f7c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_FILTER_MSFILTER_ESCHEREX_HXX
21 #define INCLUDED_FILTER_MSFILTER_ESCHEREX_HXX
23 #include <memory>
24 #include <utility>
25 #include <vector>
27 #include <com/sun/star/awt/Point.hpp>
28 #include <com/sun/star/beans/PropertyState.hpp>
29 #include <com/sun/star/drawing/BitmapMode.hpp>
30 #include <com/sun/star/awt/XBitmap.hpp>
31 #include <com/sun/star/uno/Any.hxx>
32 #include <com/sun/star/uno/Reference.hxx>
33 #include <filter/msfilter/msfilterdllapi.h>
34 #include <rtl/string.hxx>
35 #include <rtl/ustring.hxx>
36 #include <sal/types.h>
37 #include <vcl/GraphicObject.hxx>
38 #include <svx/svdtypes.hxx>
39 #include <svx/msdffdef.hxx>
40 #include <tools/gen.hxx>
41 #include <tools/stream.hxx>
42 #include <vcl/mapmod.hxx>
43 #include <o3tl/typed_flags_set.hxx>
45 class Color;
47 namespace com::sun::star {
48 namespace awt { struct Rectangle; }
49 namespace beans { class XPropertySet; }
50 namespace drawing { struct EnhancedCustomShapeParameter; }
51 namespace drawing { struct Hatch; }
54 namespace tools {
55 class Polygon;
56 class PolyPolygon;
59 /*Record Name FBT-Value Instance Contents Wrd Exl PPT Ver*/
60 // In the Microsoft documentation the naming scheme is msofbt... instead of ESCHER_...
61 #define ESCHER_DggContainer 0xF000u /* per-document data X X X */
62 #define ESCHER_Dgg 0xF006u /* an FDGG and several FIDCLs X X X 0 */
63 #define ESCHER_OPT 0xF00Bu /* count of properties the document-wide default shape properties X X X 3 */
64 #define ESCHER_SplitMenuColors 0xF11Eu /* count of colors the colors in the top-level split menus X X X 0 */
65 #define ESCHER_BstoreContainer 0xF001u /* count of BLIPs all images in the document (JPEGs, metafiles, etc.) X X X */
66 #define ESCHER_BSE 0xF007u /* BLIP type an FBSE (one per BLIP) X X X 2 */
67 #define ESCHER_BlipFirst 0xF018u /* range of fbts reserved for various kinds of BLIPs X X X */
69 #define ESCHER_DgContainer 0xF002u /* per-sheet/page/slide data X X X */
70 #define ESCHER_Dg 0xF008u /* drawing ID an FDG X X X 0 */
71 #define ESCHER_SpgrContainer 0xF003u /* several SpContainers, the first of which is the group shape itself X X X */
72 #define ESCHER_SpContainer 0xF004u /* a shape X X X */
73 #define ESCHER_Spgr 0xF009u /* an FSPGR; only present if the shape is a group shape X X X 1 */
74 #define ESCHER_Sp 0xF00Au /* shape type an FSP X X X 2 */
75 //#define ESCHER_OPT 0xF00Bu /* count of properties a shape property table X X X 3 */
76 #define ESCHER_ClientTextbox 0xF00Du /* host-defined the text in the textbox, in host-defined format X X X */
77 #define ESCHER_ChildAnchor 0xF00Fu /* a RECT, in units relative to the parent group X X X 0 */
78 #define ESCHER_ClientAnchor 0xF010u /* host-defined the location of the shape, in a host-defined format X X X */
79 #define ESCHER_ClientData 0xF011u /* host-defined host-specific data X X X */
80 #define ESCHER_SolverContainer 0xF005u /* count of rules the rules governing shapes X X X */
81 #define ESCHER_ConnectorRule 0xF012u /* an FConnectorRule X X 1 */
82 #define ESCHER_UDefProp 0xF122u
84 enum class ShapeFlag : sal_uInt32
86 NONE = 0x000,
87 Group = 0x001, /* shape is a group shape */
88 Child = 0x002, /* shape is a child shape */
89 Patriarch = 0x004, /* shape is the topmost group shape.
90 Exactly one of these per drawing. */
91 Deleted = 0x008, /* shape has been deleted */
92 OLEShape = 0x010, /* shape is an OLE object */
93 HaveMaster = 0x020, /* shape has a valid master in hspMaster property */
94 FlipH = 0x040, /* shape is flipped horizontally */
95 FlipV = 0x080, /* shape is flipped vertically */
96 Connector = 0x100, /* shape is a connector shape */
97 HaveAnchor = 0x200, /* shape has an anchor of some kind */
98 Background = 0x400, /* shape is a background shape */
99 HaveShapeProperty = 0x800 /* shape has a shape type property */
100 }; /* 20 bits unused */
101 namespace o3tl {
102 template<> struct typed_flags<ShapeFlag> : is_typed_flags<ShapeFlag, 0x00000FFF> {};
105 #define ESCHER_ShpInst_Min 0
106 #define ESCHER_ShpInst_NotPrimitive ESCHER_ShpInst_Min
107 #define ESCHER_ShpInst_Rectangle 1
108 #define ESCHER_ShpInst_RoundRectangle 2
109 #define ESCHER_ShpInst_Ellipse 3
110 #define ESCHER_ShpInst_Arc 19
111 #define ESCHER_ShpInst_Line 20
112 #define ESCHER_ShpInst_StraightConnector1 32
113 #define ESCHER_ShpInst_BentConnector2 33
114 #define ESCHER_ShpInst_BentConnector3 34
115 #define ESCHER_ShpInst_CurvedConnector3 38
116 #define ESCHER_ShpInst_PictureFrame 75
117 #define ESCHER_ShpInst_TextPlainText 136
118 #define ESCHER_ShpInst_TextDeflateInflateDeflate 167
119 #define ESCHER_ShpInst_TextSlantUp 172
120 #define ESCHER_ShpInst_HostControl 201
121 #define ESCHER_ShpInst_TextBox 202
122 #define ESCHER_ShpInst_COUNT 203
123 #define ESCHER_ShpInst_Max 0x0FFF
124 #define ESCHER_ShpInst_Nil ESCHER_ShpInst_Max
126 enum ESCHER_BlibType
127 { // GEL provided types...
128 ERROR = 0, // An error occurred during loading
129 UNKNOWN, // An unknown blip type
130 EMF, // Windows Enhanced Metafile
131 WMF, // Windows Metafile
132 PICT, // Macintosh PICT
133 PEG, // JFIF
134 PNG, // PNG
135 DIB, // Windows DIB
136 FirstClient = 32, // First client defined blip type
137 LastClient = 255 // Last client defined blip type
141 enum ESCHER_FillStyle
143 ESCHER_FillSolid, // Fill with a solid color
144 ESCHER_FillPattern, // Fill with a pattern (bitmap)
145 ESCHER_FillTexture, // A texture (pattern with its own color map)
146 ESCHER_FillPicture, // Center a picture in the shape
147 ESCHER_FillShade, // Shade from start to end points
148 ESCHER_FillShadeCenter, // Shade from bounding rectangle to end point
149 ESCHER_FillShadeShape, // Shade from shape outline to end point
150 ESCHER_FillShadeScale,
151 ESCHER_FillShadeTitle,
152 ESCHER_FillBackground
155 enum ESCHER_wMode
157 ESCHER_wColor, // only used for predefined shades
158 ESCHER_wAutomatic, // depends on object type
159 ESCHER_wGrayScale, // shades of gray only
160 ESCHER_wLightGrayScale, // shades of light gray only
161 ESCHER_wInverseGray, // dark gray mapped to light gray, etc.
162 ESCHER_wGrayOutline, // pure gray and white
163 ESCHER_wBlackTextLine, // black text and lines, all else grayscale
164 ESCHER_wHighContrast, // pure black and white mode (no grays)
165 ESCHER_wBlack, // solid black msobwWhite, // solid white
166 ESCHER_wDontShow, // object not drawn
167 ESCHER_wNumModes // number of Black and white modes
171 enum ESCHER_ShapePath
173 ESCHER_ShapeLines, // A line of straight segments
174 ESCHER_ShapeLinesClosed, // A closed polygonal object
175 ESCHER_ShapeCurves, // A line of Bezier curve segments
176 ESCHER_ShapeCurvesClosed, // A closed shape with curved edges
177 ESCHER_ShapeComplex // pSegmentInfo must be non-empty
181 enum ESCHER_WrapMode
183 ESCHER_WrapSquare,
184 ESCHER_WrapByPoints,
185 ESCHER_WrapNone,
186 ESCHER_WrapTopBottom,
187 ESCHER_WrapThrough
191 enum ESCHER_bwMode
193 ESCHER_bwColor, // only used for predefined shades
194 ESCHER_bwAutomatic, // depends on object type
195 ESCHER_bwGrayScale, // shades of gray only
196 ESCHER_bwLightGrayScale, // shades of light gray only
197 ESCHER_bwInverseGray, // dark gray mapped to light gray, etc.
198 ESCHER_bwGrayOutline, // pure gray and white
199 ESCHER_bwBlackTextLine, // black text and lines, all else grayscale
200 ESCHER_bwHighContrast, // pure black and white mode (no grays)
201 ESCHER_bwBlack, // solid black
202 ESCHER_bwWhite, // solid white
203 ESCHER_bwDontShow, // object not drawn
204 ESCHER_bwNumModes // number of Black and white modes
208 enum ESCHER_AnchorText
210 ESCHER_AnchorTop,
211 ESCHER_AnchorMiddle,
212 ESCHER_AnchorBottom,
213 ESCHER_AnchorTopCentered,
214 ESCHER_AnchorMiddleCentered,
215 ESCHER_AnchorBottomCentered,
216 ESCHER_AnchorTopBaseline,
217 ESCHER_AnchorBottomBaseline,
218 ESCHER_AnchorTopCenteredBaseline,
219 ESCHER_AnchorBottomCenteredBaseline
222 // connector style
223 enum ESCHER_cxSTYLE
225 ESCHER_cxstyleStraight = 0,
226 ESCHER_cxstyleBent,
227 ESCHER_cxstyleCurved,
228 ESCHER_cxstyleNone
231 // text flow
232 enum ESCHER_txfl
234 ESCHER_txflHorzN, // Horizontal non-@
235 ESCHER_txflTtoBA, // Top to Bottom @-font
236 ESCHER_txflBtoT, // Bottom to Top non-@
237 ESCHER_txflTtoBN, // Top to Bottom non-@
238 ESCHER_txflHorzA, // Horizontal @-font
239 ESCHER_txflVertN // Vertical, non-@
243 // flags for pictures
244 enum ESCHER_BlipFlags
246 ESCHER_BlipFlagDefault = 0,
247 ESCHER_BlipFlagComment = 0, // Blip name is a comment
248 ESCHER_BlipFlagFile, // Blip name is a file name
249 ESCHER_BlipFlagURL, // Blip name is a full URL
250 ESCHER_BlipFlagType = 3, // Mask to extract type
251 /* Or the following flags with any of the above. */
252 ESCHER_BlipFlagDoNotSave = 4,
253 ESCHER_BlipFlagLinkToFile = 8
256 // dashed line style
257 enum ESCHER_LineDashing
259 ESCHER_LineSolid, // Solid (continuous) pen
260 ESCHER_LineDashSys, // PS_DASH system dash style
261 ESCHER_LineDotSys, // PS_DOT system dash style
262 ESCHER_LineDashDotSys, // PS_DASHDOT system dash style
263 ESCHER_LineDashDotDotSys, // PS_DASHDOTDOT system dash style
264 ESCHER_LineDotGEL, // square dot style
265 ESCHER_LineDashGEL, // dash style
266 ESCHER_LineLongDashGEL, // long dash style
267 ESCHER_LineDashDotGEL, // dash short dash
268 ESCHER_LineLongDashDotGEL, // long dash short dash
269 ESCHER_LineLongDashDotDotGEL // long dash short dash short dash
272 // line end effect
273 enum ESCHER_LineEnd
275 ESCHER_LineNoEnd,
276 ESCHER_LineArrowEnd,
277 ESCHER_LineArrowStealthEnd,
278 ESCHER_LineArrowDiamondEnd,
279 ESCHER_LineArrowOvalEnd,
280 ESCHER_LineArrowOpenEnd
283 // size of arrowhead
284 enum ESCHER_LineWidth
286 ESCHER_LineNarrowArrow,
287 ESCHER_LineMediumWidthArrow,
288 ESCHER_LineWideArrow
291 // size of arrowhead
292 enum ESCHER_LineEndLength
294 ESCHER_LineShortArrow,
295 ESCHER_LineMediumLenArrow,
296 ESCHER_LineLongArrow
299 // line join style.
300 enum ESCHER_LineJoin
302 ESCHER_LineJoinBevel, // Join edges by a straight line
303 ESCHER_LineJoinMiter, // Extend edges until they join
304 ESCHER_LineJoinRound // Draw an arc between the two edges
307 // line cap style (applies to ends of dash segments too).
308 enum ESCHER_LineCap
310 ESCHER_LineEndCapRound, // Rounded ends - the default
311 ESCHER_LineEndCapSquare, // Square protrudes by half line width
312 ESCHER_LineEndCapFlat // Line ends at end point
315 enum MSOPATHTYPE
317 msopathLineTo, // Draw a straight line (one point)
318 msopathCurveTo, // Draw a cubic Bezier curve (three points)
319 msopathMoveTo, // Move to a new point (one point)
320 msopathClose, // Close a sub - path (no points)
321 msopathEnd, // End a path (no points)
322 msopathEscape, // Escape code
323 msopathClientEscape, // Escape code interpreted by the client
324 msopathInvalid // Invalid - should never be found
327 // Shape Properties
328 // 1pt = 12700 EMU (English Metric Units)
329 // 1pt = 20 Twip = 20/1440" = 1/72"
330 // 1twip=635 EMU
331 // 1" = 12700*72 = 914400 EMU
332 // 1" = 25.4mm
333 // 1mm = 36000 EMU
334 // Transform
335 #define ESCHER_Prop_Rotation 4 /* Fixed Point 16.16 degrees */
336 // Protection
337 #define ESCHER_Prop_LockAgainstGrouping 127 /* bool Do not group this shape */
338 // Text
339 #define ESCHER_Prop_lTxid 128 /* LONG id for the text, value determined by the host */
340 #define ESCHER_Prop_dxTextLeft 129 /* LONG margins relative to shape's inscribed */
341 #define ESCHER_Prop_dyTextTop 130 /* LONG text rectangle (in EMUs) */
342 #define ESCHER_Prop_dxTextRight 131 /* LONG */
343 #define ESCHER_Prop_dyTextBottom 132 /* LONG */
344 #define ESCHER_Prop_WrapText 133 /* MSOWRAPMODE Wrap text at shape margins */
345 #define ESCHER_Prop_AnchorText 135 /* ESCHER_AnchorText How to anchor the text */
346 #define ESCHER_Prop_txflTextFlow 136 /* MSOTXFL Text flow */
347 #define ESCHER_Prop_hspNext 138 /* MSOHSP ID of the next shape (used by Word for linked textboxes) */
348 #define ESCHER_Prop_FitTextToShape 191 /* bool Size text to fit shape size */
349 // GeoText
350 #define ESCHER_Prop_gtextUNICODE 192 /* WCHAR* UNICODE text string */
351 #define ESCHER_Prop_gtextSize 195 /* LONG default point size */
352 #define ESCHER_Prop_gtextFont 197 /* WCHAR* font family name */
353 // Blip
354 #define ESCHER_Prop_cropFromTop 256 /* LONG 16.16 fraction times total */
355 #define ESCHER_Prop_cropFromBottom 257 /* LONG image width or height, */
356 #define ESCHER_Prop_cropFromLeft 258 /* LONG as appropriate. */
357 #define ESCHER_Prop_cropFromRight 259 /* LONG */
358 #define ESCHER_Prop_pib 260 /* IMsoBlip* Blip to display */
359 #define ESCHER_Prop_pibName 261 /* WCHAR* Blip file name */
360 #define ESCHER_Prop_pibFlags 262 /* MSOBLIPFLAGS Blip flags */
361 #define ESCHER_Prop_pictureContrast 264 /* LONG contrast setting */
362 #define ESCHER_Prop_pictureBrightness 265 /* LONG brightness setting */
363 #define ESCHER_Prop_pictureId 267 /* LONG Host-defined ID for OLE objects (usually a pointer) */
364 #define ESCHER_Prop_pictureActive 319 /* bool Server is active (OLE objects only) */
365 // Geometry
366 #define ESCHER_Prop_geoLeft 320 /* LONG Defines the G (geometry) coordinate space. */
367 #define ESCHER_Prop_geoTop 321 /* LONG */
368 #define ESCHER_Prop_geoRight 322 /* LONG */
369 #define ESCHER_Prop_geoBottom 323 /* LONG */
370 #define ESCHER_Prop_shapePath 324 /* MSOSHAPEPATH */
371 #define ESCHER_Prop_pVertices 325 /* IMsoArray An array of points, in G units. */
372 #define ESCHER_Prop_pSegmentInfo 326 /* IMsoArray */
373 #define ESCHER_Prop_adjustValue 327 /* LONG Adjustment values corresponding to */
374 #define ESCHER_Prop_adjust2Value 328 /* LONG the positions of the adjust handles */
375 #define ESCHER_Prop_fFillOK 383 /* bool OK to fill the shape through the UI or VBA? */
376 // FillStyle
377 #define ESCHER_Prop_fillType 384 /* ESCHER_FillStyle Type of fill */
378 #define ESCHER_Prop_fillColor 385 /* MSOCLR Foreground color */
379 #define ESCHER_Prop_fillOpacity 386 /* LONG Fixed 16.16 */
380 #define ESCHER_Prop_fillBackColor 387 /* MSOCLR Background color */
381 #define ESCHER_Prop_fillBackOpacity 388 /* LONG Shades only */
382 #define ESCHER_Prop_fillBlip 390 /* IMsoBlip* Pattern/texture */
383 #define ESCHER_Prop_fillAngle 395 /* LONG Fade angle - degrees in 16.16 */
384 #define ESCHER_Prop_fillFocus 396 /* LONG Linear shaded fill focus percent */
385 #define ESCHER_Prop_fillToLeft 397 /* LONG Fraction 16.16 */
386 #define ESCHER_Prop_fillToTop 398 /* LONG Fraction 16.16 */
387 #define ESCHER_Prop_fillToRight 399 /* LONG Fraction 16.16 */
388 #define ESCHER_Prop_fillToBottom 400 /* LONG Fraction 16.16 */
389 #define ESCHER_Prop_fillRectRight 403 /* LONG define how large the fade is going to be. */
390 #define ESCHER_Prop_fillRectBottom 404 /* LONG */
391 #define ESCHER_Prop_fNoFillHitTest 447 /* bool Hit test a shape as though filled */
392 // LineStyle
393 #define ESCHER_Prop_lineColor 448 /* MSOCLR Color of line */
394 #define ESCHER_Prop_lineOpacity 449 /* LONG Not implemented */
395 #define ESCHER_Prop_lineBackColor 450 /* MSOCLR Background color */
396 #define ESCHER_Prop_lineWidth 459 /* LONG A units; 1pt == 12700 EMUs */
397 #define ESCHER_Prop_lineStyle 461 /* MSOLINESTYLE Draw parallel lines? */
398 #define ESCHER_Prop_lineDashing 462 /* MSOLINEDASHING Can be overridden by: */
399 #define ESCHER_Prop_lineStartArrowhead 464 /* MSOLINEEND Arrow at start */
400 #define ESCHER_Prop_lineEndArrowhead 465 /* MSOLINEEND Arrow at end */
401 #define ESCHER_Prop_lineStartArrowWidth 466 /* MSOLINEENDWIDTH Arrow at start */
402 #define ESCHER_Prop_lineStartArrowLength 467 /* MSOLINEENDLENGTH Arrow at end */
403 #define ESCHER_Prop_lineEndArrowWidth 468 /* MSOLINEENDWIDTH Arrow at start */
404 #define ESCHER_Prop_lineEndArrowLength 469 /* MSOLINEENDLENGTH Arrow at end */
405 #define ESCHER_Prop_lineJoinStyle 470 /* MSOLINEJOIN How to join lines */
406 #define ESCHER_Prop_lineEndCapStyle 471 /* MSOLINECAP How to end lines */
407 #define ESCHER_Prop_fNoLineDrawDash 511 /* bool Draw a dashed line if no line */
408 // ShadowStyle
409 #define ESCHER_Prop_shadowColor 513 /* MSOCLR Foreground color */
410 #define ESCHER_Prop_shadowOpacity 516 /* LONG Fixed 16.16 */
411 #define ESCHER_Prop_shadowOffsetX 517 /* LONG Offset shadow */
412 #define ESCHER_Prop_shadowOffsetY 518 /* LONG Offset shadow */
413 #define ESCHER_Prop_fshadowObscured 575 /* bool Excel5-style shadow */
414 // 3D Object
415 #define ESCHER_Prop_fc3DLightFace 703 /* bool */
416 // Shape
417 #define ESCHER_Prop_hspMaster 769 /* MSOHSP master shape */
418 #define ESCHER_Prop_cxstyle 771 /* MSOCXSTYLE Type of connector */
419 #define ESCHER_Prop_bWMode 772 /* ESCHERwMode Settings for modifications to */
420 #define ESCHER_Prop_fBackground 831 /* bool If sal_True, this is the background shape. */
421 // GroupShape
422 #define ESCHER_Prop_wzName 896 /* WCHAR* Shape Name (present only if explicitly set) */
423 #define ESCHER_Prop_wzDescription 897 /* WCHAR* alternate text */
424 #define ESCHER_Prop_pihlShape 898 /* IHlink* The hyperlink in the shape. */
425 #define ESCHER_Prop_dxWrapDistLeft 900 /* LONG Left wrapping distance from text (Word) */
426 #define ESCHER_Prop_dyWrapDistTop 901 /* LONG Top wrapping distance from text (Word) */
427 #define ESCHER_Prop_dxWrapDistRight 902 /* LONG Right wrapping distance from text (Word) */
428 #define ESCHER_Prop_dyWrapDistBottom 903 /* LONG Bottom wrapping distance from text (Word) */
429 #define ESCHER_Prop_tableProperties 927
430 #define ESCHER_Prop_tableRowProperties 928
431 #define ESCHER_Prop_fHidden 958 /* bool Do not display */
432 #define ESCHER_Prop_fPrint 959 /* bool Print this shape */
435 #define ESCHER_Persist_PrivateEntry 0x80000000
436 #define ESCHER_Persist_Dgg 0x00010000
437 #define ESCHER_Persist_Dg 0x00020000
438 #define ESCHER_Persist_CurrentPosition 0x00040000
439 #define ESCHER_Persist_Grouping_Snap 0x00050000
440 #define ESCHER_Persist_Grouping_Logic 0x00060000
442 const sal_uInt32 DFF_DGG_CLUSTER_SIZE = 0x00000400; /// Shape IDs per cluster in DGG atom.
444 namespace com::sun::star {
445 namespace awt {
446 struct Gradient;
448 namespace drawing {
449 struct EnhancedCustomShapeAdjustmentValue;
450 class XShape;
451 class XShapes;
455 struct UNLESS_MERGELIBS(MSFILTER_DLLPUBLIC) EscherConnectorListEntry
457 css::uno::Reference< css::drawing::XShape > mXConnector;
458 css::awt::Point maPointA;
459 css::uno::Reference< css::drawing::XShape > mXConnectToA;
460 css::awt::Point maPointB;
461 css::uno::Reference< css::drawing::XShape > mXConnectToB;
463 sal_uInt32 GetConnectorRule( bool bFirst );
465 EscherConnectorListEntry( css::uno::Reference< css::drawing::XShape > xC,
466 const css::awt::Point& rPA,
467 css::uno::Reference< css::drawing::XShape > xSA ,
468 const css::awt::Point& rPB,
469 css::uno::Reference< css::drawing::XShape > xSB ) :
470 mXConnector (std::move( xC )),
471 maPointA ( rPA ),
472 mXConnectToA(std::move( xSA )),
473 maPointB ( rPB ),
474 mXConnectToB(std::move( xSB )) {}
476 static sal_uInt32 GetClosestPoint( const tools::Polygon& rPoly, const css::awt::Point& rP );
479 struct MSFILTER_DLLPUBLIC EscherExContainer
481 private:
482 sal_uInt32 nContPos;
483 SvStream& rStrm;
484 public:
485 EscherExContainer( SvStream& rSt, const sal_uInt16 nRecType, const sal_uInt16 nInstance = 0 );
486 ~EscherExContainer();
489 struct MSFILTER_DLLPUBLIC EscherExAtom
491 private:
492 sal_uInt32 nContPos;
493 SvStream& rStrm;
494 public:
495 EscherExAtom( SvStream& rSt, const sal_uInt16 nRecType, const sal_uInt16 nInstance = 0, const sal_uInt8 nVersion = 0 );
496 ~EscherExAtom();
499 struct EscherPropertyValueHelper
501 static bool GetPropertyValue(
502 css::uno::Any& rAny,
503 const css::uno::Reference< css::beans::XPropertySet > &,
504 const OUString& rPropertyName,
505 bool bTestPropertyAvailability = false
508 static css::beans::PropertyState GetPropertyState(
509 const css::uno::Reference < css::beans::XPropertySet > &,
510 const OUString& rPropertyName
515 struct EscherPersistEntry
517 sal_uInt32 mnID;
518 sal_uInt32 mnOffset;
520 EscherPersistEntry( sal_uInt32 nId, sal_uInt32 nOffset ) { mnID = nId; mnOffset = nOffset; };
525 class EscherBlibEntry
527 friend class EscherGraphicProvider;
528 friend class EscherEx;
530 MapMode maPrefMapMode;
531 Size maPrefSize;
533 sal_uInt32 mnIdentifier[ 4 ];
534 sal_uInt32 mnPictureOffset; // offset to the graphic in PictureStreams
535 sal_uInt32 mnSize; // size of real graphic
537 sal_uInt32 mnRefCount; // !! reference count
538 sal_uInt32 mnSizeExtra; // !! size of preceding header
540 ESCHER_BlibType meBlibType;
542 bool mbIsEmpty;
543 bool mbIsNativeGraphicPossible;
545 public:
547 EscherBlibEntry(
548 sal_uInt32 nPictureOffset,
549 const GraphicObject& rObj,
550 const OString& rId,
551 const GraphicAttr* pAttr
554 ~EscherBlibEntry();
556 void WriteBlibEntry( SvStream& rSt, bool bWritePictureOffset, sal_uInt32 nResize = 0 );
557 bool IsEmpty() const { return mbIsEmpty; };
559 bool operator==( const EscherBlibEntry& ) const;
563 enum class EscherGraphicProviderFlags {
564 NONE = 0,
565 UseInstances = 1,
567 namespace o3tl {
568 template<> struct typed_flags<EscherGraphicProviderFlags> : is_typed_flags<EscherGraphicProviderFlags, 0x01> {};
571 class MSFILTER_DLLPUBLIC EscherGraphicProvider
573 EscherGraphicProviderFlags
574 mnFlags;
575 std::vector<std::unique_ptr<EscherBlibEntry>>
576 mvBlibEntrys;
577 OUString maBaseURI;
579 protected:
581 sal_uInt32 ImplInsertBlib( EscherBlibEntry* p_EscherBlibEntry );
583 public:
585 sal_uInt32 GetBlibStoreContainerSize( SvStream const * pMergePicStreamBSE = nullptr ) const;
586 void WriteBlibStoreContainer( SvStream& rStrm, SvStream* pMergePicStreamBSE = nullptr );
587 void WriteBlibStoreEntry(SvStream& rStrm, sal_uInt32 nBlipId, sal_uInt32 nResize);
588 sal_uInt32 GetBlibID(
589 SvStream& rPicOutStream,
590 GraphicObject const & pGraphicObject,
591 const css::awt::Rectangle* pVisArea = nullptr,
592 const GraphicAttr* pGrafikAttr = nullptr,
593 const bool ooxmlExport = false
595 bool HasGraphics() const { return !mvBlibEntrys.empty(); };
597 void SetNewBlipStreamOffset( sal_Int32 nOffset );
599 bool GetPrefSize( const sal_uInt32 nBlibId, Size& rSize, MapMode& rMapMode );
601 void SetBaseURI( const OUString& rBaseURI ) { maBaseURI = rBaseURI; };
602 const OUString& GetBaseURI() const { return maBaseURI; };
604 EscherGraphicProvider( EscherGraphicProviderFlags nFlags = EscherGraphicProviderFlags::NONE );
605 virtual ~EscherGraphicProvider();
607 EscherGraphicProvider& operator=( EscherGraphicProvider const & ) = delete; // MSVC2015 workaround
608 EscherGraphicProvider( EscherGraphicProvider const & ) = delete; // MSVC2015 workaround
611 struct EscherShapeListEntry;
613 class MSFILTER_DLLPUBLIC EscherSolverContainer
615 ::std::vector< std::unique_ptr<EscherShapeListEntry> > maShapeList;
616 ::std::vector< std::unique_ptr<EscherConnectorListEntry> > maConnectorList;
618 public:
620 sal_uInt32 GetShapeId(
621 const css::uno::Reference< css::drawing::XShape > & rShape
622 ) const;
624 void AddShape(
625 const css::uno::Reference< css::drawing::XShape > &,
626 sal_uInt32 nId
629 void AddConnector(
630 const css::uno::Reference< css::drawing::XShape > &,
631 const css::awt::Point& rA,
632 css::uno::Reference< css::drawing::XShape > const &,
633 const css::awt::Point& rB,
634 css::uno::Reference< css::drawing::XShape > const & rConB
637 void WriteSolver( SvStream& );
639 EscherSolverContainer();
640 ~EscherSolverContainer();
642 EscherSolverContainer& operator=( EscherSolverContainer const & ) = delete; // MSVC2015 workaround
643 EscherSolverContainer( EscherSolverContainer const & ) = delete; // MSVC2015 workaround
647 #define ESCHER_CREATEPOLYGON_LINE 1
648 #define ESCHER_CREATEPOLYGON_POLYLINE 2
649 #define ESCHER_CREATEPOLYGON_POLYPOLYGON 4
651 class SdrObjCustomShape;
653 struct EscherPropSortStruct
655 std::vector<sal_uInt8> nProp;
656 sal_uInt32 nPropValue;
657 sal_uInt16 nPropId;
660 typedef std::vector< EscherPropSortStruct > EscherProperties;
662 class MSFILTER_DLLPUBLIC EscherPropertyContainer
664 EscherGraphicProvider* pGraphicProvider;
665 SvStream* pPicOutStrm;
666 tools::Rectangle* pShapeBoundRect;
668 sal_uInt32 nCountCount;
669 sal_uInt32 nCountSize;
671 std::vector<EscherPropSortStruct>
672 pSortStruct;
674 bool bHasComplexData;
677 static sal_uInt32 ImplGetColor( const sal_uInt32 rColor, bool bSwap = true );
678 void ImplCreateGraphicAttributes(
679 const css::uno::Reference< css::beans::XPropertySet > & rXPropSet,
680 sal_uInt32 nBlibId,
681 bool bCreateCroppingAttributes
683 bool ImplCreateEmbeddedBmp(GraphicObject const & rGraphicObject);
685 SAL_DLLPRIVATE explicit EscherPropertyContainer(
686 EscherGraphicProvider * pGraphProv, SvStream * pPiOutStrm,
687 tools::Rectangle * pBoundRect);
689 public:
691 EscherPropertyContainer();
692 EscherPropertyContainer(
693 EscherGraphicProvider& rGraphicProvider, // the PropertyContainer needs to know
694 SvStream* pPicOutStrm, // the GraphicProvider to be able to write
695 tools::Rectangle& rShapeBoundRect // FillBitmaps or GraphicObjects.
696 ); // under some circumstances the ShapeBoundRect
697 // is adjusted this will happen when rotated
698 // GraphicObjects are saved to PowerPoint
699 ~EscherPropertyContainer();
701 void AddOpt(
702 sal_uInt16 nPropID,
703 bool bBlib,
704 sal_uInt32 nSizeReduction,
705 SvMemoryStream& rStream);
707 void AddOpt(
708 sal_uInt16 nPropertyID,
709 std::u16string_view rString);
711 void AddOpt(
712 sal_uInt16 nPropertyID,
713 sal_uInt32 nPropValue,
714 bool bBlib = false);
716 void AddOpt(
717 sal_uInt16 nPropertyID,
718 bool bBlib,
719 sal_uInt32 nPropValue,
720 const std::vector<sal_uInt8>& rProp);
722 bool GetOpt( sal_uInt16 nPropertyID, sal_uInt32& rPropValue ) const;
724 bool GetOpt( sal_uInt16 nPropertyID, EscherPropSortStruct& rPropValue ) const;
726 const EscherProperties & GetOpts() const;
728 void Commit( SvStream& rSt, sal_uInt16 nVersion = 3, sal_uInt16 nRecType = ESCHER_OPT );
730 void CreateShapeProperties(
731 const css::uno::Reference< css::drawing::XShape > & rXShape
733 bool CreateOLEGraphicProperties(
734 const css::uno::Reference< css::drawing::XShape > & rXOleObject
736 bool CreateGraphicProperties(
737 const css::uno::Reference< css::drawing::XShape > & rXShape,
738 const GraphicObject& rGraphicObj
740 bool CreateMediaGraphicProperties(
741 const css::uno::Reference< css::drawing::XShape > & rXMediaObject
744 /** Creates a complex ESCHER_Prop_fillBlip containing the BLIP directly (for Excel charts). */
745 void CreateEmbeddedBitmapProperties(
746 css::uno::Reference<css::awt::XBitmap> const & rxBitmap,
747 css::drawing::BitmapMode eBitmapMode
749 /** Creates a complex ESCHER_Prop_fillBlip containing a hatch style (for Excel charts). */
750 void CreateEmbeddedHatchProperties(
751 const css::drawing::Hatch& rHatch,
752 const Color& rBackColor,
753 bool bFillBackground
756 // the GraphicProperties will only be created if a GraphicProvider and PicOutStrm is known
757 // DR: #99897# if no GraphicProvider is present, a complex ESCHER_Prop_fillBlip
758 // will be created, containing the BLIP directly (e.g. for Excel charts).
759 bool CreateGraphicProperties(
760 const css::uno::Reference< css::beans::XPropertySet > & rXPropSet,
761 const OUString& rSource,
762 const bool bCreateFillBitmap,
763 const bool bCreateCroppingAttributes = false,
764 const bool bFillBitmapModeAllowed = true,
765 const bool bOOxmlExport = false
768 bool CreateBlipPropertiesforOLEControl( const css::uno::Reference< css::beans::XPropertySet > & rXPropSet, const css::uno::Reference< css::drawing::XShape > & rXShape);
770 bool CreatePolygonProperties(
771 const css::uno::Reference< css::beans::XPropertySet > & rXPropSet,
772 sal_uInt32 nFlags,
773 bool bBezier,
774 css::awt::Rectangle& rGeoRect,
775 tools::Polygon const * pPolygon = nullptr
778 static sal_uInt32 GetGradientColor(
779 const css::awt::Gradient* pGradient,
780 sal_uInt32 nStartColor
783 void CreateGradientProperties( const css::awt::Gradient & rGradient );
784 void CreateGradientProperties(
785 const css::uno::Reference< css::beans::XPropertySet > &,
786 bool bTransparentGradient = false
789 void CreateLineProperties(
790 const css::uno::Reference< css::beans::XPropertySet > &,
791 bool bEdge
793 void CreateFillProperties(
794 const css::uno::Reference< css::beans::XPropertySet > &,
795 bool bEdge,
796 bool bTransparentGradient = false );
797 void CreateFillProperties(
798 const css::uno::Reference< css::beans::XPropertySet > &,
799 bool bEdge,
800 const css::uno::Reference< css::drawing::XShape > & rXShape );
801 void CreateTextProperties(
802 const css::uno::Reference< css::beans::XPropertySet > &,
803 sal_uInt32 nText,
804 const bool bIsCustomShape = false,
805 const bool bIsTextFrame = true
808 bool CreateConnectorProperties(
809 const css::uno::Reference< css::drawing::XShape > & rXShape,
810 EscherSolverContainer& rSolver,
811 css::awt::Rectangle& rGeoRect,
812 sal_uInt16& rShapeType,
813 ShapeFlag& rShapeFlags
816 // Because shadow properties depends to the line and fillstyle, the CreateShadowProperties method should be called at last.
817 // It's active only when at least a FillStyle or LineStyle is set.
818 void CreateShadowProperties(
819 const css::uno::Reference< css::beans::XPropertySet > &
822 sal_Int32 GetValueForEnhancedCustomShapeParameter( const css::drawing::EnhancedCustomShapeParameter& rParameter,
823 const std::vector< sal_Int32 >& rEquationOrder, bool bAdjustTrans = false );
824 // creates all necessary CustomShape properties, this includes also Text-, Shadow-, Fill-, and LineProperties
825 void CreateCustomShapeProperties(
826 const MSO_SPT eShapeType,
827 const css::uno::Reference< css::drawing::XShape > &,
828 bool bOOXML = false
830 bool IsFontWork() const;
832 // helper functions which are also used by the escher import
833 static tools::PolyPolygon GetPolyPolygon(
834 const css::uno::Reference< css::drawing::XShape > & rXShape
836 static tools::PolyPolygon GetPolyPolygon( const css::uno::Any& rSource );
837 static MSO_SPT GetCustomShapeType(
838 const css::uno::Reference< css::drawing::XShape > & rXShape,
839 ShapeFlag& nMirrorFlags,
840 OUString& rShapeType,
841 bool bOOXML = false
844 // helper functions which are also used in ooxml export
845 static bool GetLineArrow(
846 const bool bLineStart,
847 const css::uno::Reference< css::beans::XPropertySet > & rXPropSet,
848 ESCHER_LineEnd& reLineEnd,
849 sal_Int32& rnArrowLength,
850 sal_Int32& rnArrowWidth
853 static bool IsDefaultObject(
854 const SdrObjCustomShape& rSdrObjCustomShape,
855 const MSO_SPT eShapeType);
857 static void LookForPolarHandles(
858 const MSO_SPT eShapeType,
859 sal_Int32& nAdjustmentsWhichNeedsToBeConverted
861 static bool GetAdjustmentValue( const css::drawing::EnhancedCustomShapeAdjustmentValue & rkProp, sal_Int32 nIndex, sal_Int32 nAdjustmentsWhichNeedsToBeConverted, sal_Int32& nValue );
865 class MSFILTER_DLLPUBLIC EscherPersistTable
868 public:
869 ::std::vector< std::unique_ptr<EscherPersistEntry> > maPersistTable;
871 bool PtIsID( sal_uInt32 nID );
872 void PtInsert( sal_uInt32 nID, sal_uInt32 nOfs );
873 void PtDelete( sal_uInt32 nID );
874 sal_uInt32 PtGetOffsetByID( sal_uInt32 nID );
875 void PtReplace( sal_uInt32 nID, sal_uInt32 nOfs );
876 void PtReplaceOrInsert( sal_uInt32 nID, sal_uInt32 nOfs );
878 EscherPersistTable();
879 virtual ~EscherPersistTable();
881 EscherPersistTable& operator=( EscherPersistTable const & ) = delete; // MSVC2015 workaround
882 EscherPersistTable( EscherPersistTable const & ) = delete; // MSVC2015 workaround
886 class EscherEx;
888 /// abstract base class for ESCHER_ClientTextbox, ESCHER_ClientData
889 class MSFILTER_DLLPUBLIC EscherExClientRecord_Base
891 public:
892 virtual ~EscherExClientRecord_Base();
894 /// Application writes the record header
895 /// using rEx.AddAtom(...) followed by
896 /// record data written to rEx.GetStream()
897 virtual void WriteData( EscherEx& rEx ) const = 0;
901 /// abstract base class for ESCHER_ClientAnchor
902 class MSFILTER_DLLPUBLIC EscherExClientAnchor_Base
904 public:
905 virtual ~EscherExClientAnchor_Base();
907 /// Application writes the record header
908 /// using rEx.AddAtom(...) followed by
909 /// record data written to rEx.GetStream()
910 virtual void WriteData( EscherEx& rEx,
911 const tools::Rectangle& rRect ) = 0;
914 class InteractionInfo
916 std::unique_ptr<SvMemoryStream> mpHyperlinkRecord;
918 public:
919 InteractionInfo( SvMemoryStream* pStream )
921 mpHyperlinkRecord.reset( pStream );
923 const std::unique_ptr< SvMemoryStream >& getHyperlinkRecord() const { return mpHyperlinkRecord; }
926 class EscherExHostAppData
928 private:
929 EscherExClientAnchor_Base* pClientAnchor;
930 EscherExClientRecord_Base* pClientData;
931 EscherExClientRecord_Base* pClientTextbox;
932 InteractionInfo* pInteractionInfo;
933 // ignore single shape if entire pages are written
934 bool bDontWriteShape;
936 public:
937 EscherExHostAppData() : pClientAnchor(nullptr), pClientData(nullptr),
938 pClientTextbox(nullptr), pInteractionInfo(nullptr), bDontWriteShape(false)
941 void SetInteractionInfo( InteractionInfo* p )
942 { pInteractionInfo = p; }
943 void SetClientAnchor( EscherExClientAnchor_Base* p )
944 { pClientAnchor = p; }
945 void SetClientData( EscherExClientRecord_Base* p )
946 { pClientData = p; }
947 void SetClientTextbox( EscherExClientRecord_Base* p )
948 { pClientTextbox = p; }
949 void SetDontWriteShape( bool b )
950 { bDontWriteShape = b; }
951 InteractionInfo* GetInteractionInfo() const
952 { return pInteractionInfo; }
953 EscherExClientAnchor_Base* GetClientAnchor() const
954 { return pClientAnchor; }
955 EscherExClientRecord_Base* GetClientTextbox() const
956 { return pClientTextbox; }
958 void WriteClientAnchor( EscherEx& rEx, const tools::Rectangle& rRect )
959 { if( pClientAnchor ) pClientAnchor->WriteData( rEx, rRect ); }
960 void WriteClientData( EscherEx& rEx )
961 { if( pClientData ) pClientData->WriteData( rEx ); }
962 void WriteClientTextbox( EscherEx& rEx )
963 { if( pClientTextbox ) pClientTextbox->WriteData( rEx ); }
965 bool DontWriteShape() const { return bDontWriteShape; }
969 /** Instance for global DFF data, shared through various instances of EscherEx. */
970 class MSFILTER_DLLPUBLIC EscherExGlobal : public EscherGraphicProvider
972 public:
973 explicit EscherExGlobal();
974 virtual ~EscherExGlobal() override;
976 /** Returns a new drawing ID for a new drawing container (DGCONTAINER). */
977 sal_uInt32 GenerateDrawingId();
978 /** Creates and returns a new shape identifier, updates the internal shape
979 counters and registers the identifier in the DGG cluster table.
980 @param nDrawingId Drawing identifier has to be passed to be able to
981 generate shape identifiers for multiple drawings simultaneously. */
982 sal_uInt32 GenerateShapeId( sal_uInt32 nDrawingId, bool bIsInSpgr );
983 /** Returns the number of shapes in the current drawing, based on number of
984 calls to the GenerateShapeId() function. */
985 sal_uInt32 GetDrawingShapeCount( sal_uInt32 nDrawingId ) const;
986 /** Returns the last shape identifier generated by the GenerateShapeId()
987 function. */
988 sal_uInt32 GetLastShapeId( sal_uInt32 nDrawingId ) const;
990 /** Sets the flag indicating that the DGGCONTAINER exists. */
991 void SetDggContainer() { mbHasDggCont = true; }
992 /** Sets the flag indicating that the DGGCONTAINER exists. */
993 bool HasDggContainer() const { return mbHasDggCont; }
994 /** Returns the total size of the DGG atom (including header). */
995 sal_uInt32 GetDggAtomSize() const;
996 /** Writes the complete DGG atom to the passed stream (overwrites existing data!). */
997 void WriteDggAtom( SvStream& rStrm ) const;
999 /** Called if a picture shall be written and no picture stream is set at
1000 class ImplEESdrWriter.
1002 On first invocation, this function calls the virtual member function
1003 ImplQueryPictureStream(). The return value will be cached internally
1004 for subsequent calls and for the GetPictureStream() function.
1006 SvStream* QueryPictureStream();
1008 /** Returns the picture stream if existing (queried), otherwise null. */
1009 SvStream* GetPictureStream() { return mpPicStrm; }
1011 private:
1012 /** Derived classes may implement to create a new stream used to store the
1013 picture data.
1015 The implementation has to take care about lifetime of the returned
1016 stream (it will not be destructed automatically). This function is
1017 called exactly once. The return value will be cached internally for
1018 repeated calls of the public QueryPictureStream() function.
1020 virtual SvStream* ImplQueryPictureStream();
1022 private:
1023 struct ClusterEntry
1025 sal_uInt32 mnDrawingId; /// Identifier of drawing this cluster belongs to (one-based index into maDrawingInfos).
1026 sal_uInt32 mnNextShapeId; /// Next free shape identifier in this cluster.
1027 explicit ClusterEntry( sal_uInt32 nDrawingId ) : mnDrawingId( nDrawingId ), mnNextShapeId( 0 ) {}
1030 struct DrawingInfo
1032 sal_uInt32 mnClusterId; /// Currently used cluster (one-based index into maClusterTable).
1033 sal_uInt32 mnShapeCount; /// Current number of shapes in this drawing.
1034 sal_uInt32 mnLastShapeId; /// Last shape identifier generated for this drawing.
1035 explicit DrawingInfo( sal_uInt32 nClusterId ) : mnClusterId( nClusterId ), mnShapeCount( 0 ), mnLastShapeId( 0 ) {}
1037 typedef ::std::vector< DrawingInfo > DrawingInfoVector;
1039 std::vector< ClusterEntry > maClusterTable; /// List with cluster IDs (used object IDs in drawings).
1040 DrawingInfoVector maDrawingInfos; /// Data about all used drawings.
1041 SvStream* mpPicStrm; /// Cached result of ImplQueryPictureStream().
1042 bool mbHasDggCont; /// True = the DGGCONTAINER has been initialized.
1043 bool mbPicStrmQueried; /// True = ImplQueryPictureStream() has been called.
1046 class SdrObject;
1047 class SdrPage;
1048 class ImplEESdrWriter;
1050 class MSFILTER_DLLPUBLIC EscherEx : public EscherPersistTable
1052 protected:
1053 std::shared_ptr<EscherExGlobal> mxGlobal;
1054 std::unique_ptr<ImplEESdrWriter> mpImplEESdrWriter;
1055 std::unique_ptr<SvStream> mxOwnStrm;
1056 SvStream* mpOutStrm;
1057 sal_uInt32 mnStrmStartOfs;
1058 std::vector< sal_uInt64 > mOffsets;
1059 std::vector< sal_uInt16 > mRecTypes;
1061 sal_uInt32 mnCurrentDg;
1062 sal_uInt64 mnCountOfs;
1064 sal_uInt32 mnGroupLevel;
1065 SdrLayerID mnHellLayerId;
1066 SdrLayerID mnHeaderFooterHellLayerId;
1068 bool mbEscherSpgr;
1069 bool mbEscherDg;
1070 bool mbOOXML;
1071 OUString mEditAs;
1074 bool DoSeek( sal_uInt32 nKey );
1076 public:
1077 explicit EscherEx( std::shared_ptr<EscherExGlobal> xGlobal, SvStream* pOutStrm, bool bOOXML = false );
1078 virtual ~EscherEx() override;
1080 /** Creates and returns a new shape identifier, updates the internal shape
1081 counters and registers the identifier in the DGG cluster table. */
1082 virtual sal_uInt32 GenerateShapeId() { return mxGlobal->GenerateShapeId( mnCurrentDg, mbEscherSpgr ); }
1084 /** Returns the graphic provider from the global object that has been
1085 passed to the constructor.
1087 EscherGraphicProvider& GetGraphicProvider() { return *mxGlobal; }
1089 /** Called if a picture shall be written and no picture stream is set at
1090 class ImplEESdrWriter.
1092 SvStream* QueryPictureStream() { return mxGlobal->QueryPictureStream(); }
1094 /// Inserts internal data into the EscherStream, this process
1095 /// may and has to be executed only once
1096 /// If pPicStreamMergeBSE is known, the BLIPs from this stream are being
1097 /// merged into the MsofbtBSE Records of the EscherStream like it's
1098 /// required for Excel (and maybe Word?)
1099 void Flush( SvStream* pPicStreamMergeBSE = nullptr );
1101 /** Inserts the passed number of bytes at the current position of the
1102 output stream.
1104 Inserts dummy bytes and moves all following stream data, and updates
1105 all internal stream offsets stored in the PersistTable and the affected
1106 container sizes, which makes this operation very expensive. (!)
1108 @param nBytes The number of bytes to be inserted into the stream.
1110 An atom that currently ends
1111 exactly at the current stream position will not be expanded to
1112 include the inserted data (used to insert e.g. a new atom after an
1113 existing atom). Note that containers that end exactly at the
1114 current stream position are always expanded to include the inserted
1115 data.
1117 void InsertAtCurrentPos( sal_uInt32 nBytes );
1119 void InsertPersistOffset( sal_uInt32 nKey, sal_uInt32 nOffset ); // It is not being checked if this key is already in the PersistantTable
1120 void ReplacePersistOffset( sal_uInt32 nKey, sal_uInt32 nOffset );
1121 sal_uInt32 GetPersistOffset( sal_uInt32 nKey );
1122 bool SeekToPersistOffset( sal_uInt32 nKey );
1123 void InsertAtPersistOffset( sal_uInt32 nKey, sal_uInt32 nValue ); // nValue is being inserted into the Stream where it's appropriate (overwrite mode), without that the
1124 // current StreamPosition changes
1125 void SetEditAs( const OUString& rEditAs );
1126 const OUString& GetEditAs() const { return mEditAs; }
1127 SvStream& GetStream() const { return *mpOutStrm; }
1128 sal_uInt64 GetStreamPos() const { return mpOutStrm->Tell(); }
1130 // features during the creation of the following Containers:
1132 // ESCHER_DggContainer: an EscherDgg Atom is automatically being created and managed
1133 // ESCHER_DgContainer: an EscherDg Atom is automatically being created and managed
1134 // ESCHER_SpgrContainer:
1135 // ESCHER_SpContainer:
1137 virtual void OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance = 0 );
1138 virtual void CloseContainer();
1140 void BeginAtom();
1141 void EndAtom( sal_uInt16 nRecType, int nRecVersion = 0, int nRecInstance = 0 );
1142 void AddAtom( sal_uInt32 nAtomSitze, sal_uInt16 nRecType, int nRecVersion = 0, int nRecInstance = 0 );
1143 void AddChildAnchor( const tools::Rectangle& rRectangle );
1144 void AddClientAnchor( const tools::Rectangle& rRectangle );
1146 virtual sal_uInt32 EnterGroup( const OUString& rShapeName, const tools::Rectangle* pBoundRect );
1147 sal_uInt32 EnterGroup( const tools::Rectangle* pBoundRect = nullptr );
1148 sal_uInt32 GetGroupLevel() const { return mnGroupLevel; };
1149 void SetGroupSnapRect( sal_uInt32 nGroupLevel, const tools::Rectangle& rRect );
1150 void SetGroupLogicRect( sal_uInt32 nGroupLevel, const tools::Rectangle& rRect );
1151 virtual void LeaveGroup();
1153 // a ESCHER_Sp is being written ( a ESCHER_DgContainer has to be opened for this purpose!)
1154 virtual void AddShape( sal_uInt32 nShpInstance, ShapeFlag nFlagIds, sal_uInt32 nShapeID = 0 );
1156 virtual void Commit( EscherPropertyContainer& rProps, const tools::Rectangle& rRect);
1158 static sal_uInt32 GetColor( const sal_uInt32 nColor );
1159 static sal_uInt32 GetColor( const Color& rColor );
1161 // ...Sdr... implemented in eschesdo.cxx
1163 void AddSdrPage( const SdrPage& rPage, bool ooxmlExport = false );
1164 void AddUnoShapes( const css::uno::Reference< css::drawing::XShapes >& rxShapes, bool ooxmlExport = false );
1166 /// returns the ShapeID
1167 sal_uInt32 AddSdrObject(const SdrObject& rObj, bool ooxmlExport = false, sal_uInt32 nId = 0);
1168 virtual void AddSdrObjectVMLObject( const SdrObject& /*rObj*/)
1170 // Required for Exporting VML shape
1173 /// If objects are written through AddSdrObject the
1174 /// SolverContainer has to be written, and maybe some
1175 /// maintenance to be done.
1176 void EndSdrObjectPage();
1178 /// Called before a shape is written, application supplies
1179 /// ClientRecords. May set AppData::bDontWriteShape so the
1180 /// shape is ignored.
1181 virtual EscherExHostAppData* StartShape(
1182 const css::uno::Reference< css::drawing::XShape >& rShape,
1183 const tools::Rectangle* pChildAnchor );
1185 /// Called after a shape is written to inform the application
1186 /// of the resulted shape type and ID.
1187 virtual void EndShape( sal_uInt16 nShapeType, sal_uInt32 nShapeID );
1189 /// Called before an AdditionalText EnterGroup occurs.
1190 /// The current shape will be written in three parts:
1191 /// a group shape, the shape itself, and an extra textbox shape.
1192 /// The complete flow is:
1193 /// StartShape sets HostData1.
1194 /// EnterAdditionalTextGroup sets HostData2, App may modify
1195 /// HostData1 and keep track of the change.
1196 /// The group shape is written with HostData2.
1197 /// Another StartShape with the same (!) object sets HostData3.
1198 /// The current shape is written with HostData3.
1199 /// EndShape is called for the current shape.
1200 /// Another StartShape with the same (!) object sets HostData4.
1201 /// The textbox shape is written with HostData4.
1202 /// EndShape is called for the textbox shape.
1203 /// EndShape is called for the group shape, this provides
1204 /// the same functionality as an ordinary recursive group.
1205 virtual EscherExHostAppData* EnterAdditionalTextGroup();
1207 /// Called if an ESCHER_Prop_lTxid shall be written
1208 virtual sal_uInt32 QueryTextID( const css::uno::Reference< css::drawing::XShape >&, sal_uInt32 nShapeId );
1209 // add a dummy rectangle shape into the escher stream
1210 sal_uInt32 AddDummyShape();
1212 static const SdrObject* GetSdrObject( const css::uno::Reference< css::drawing::XShape >& rXShape );
1214 void SetHellLayerId( SdrLayerID nId ) { mnHellLayerId = nId; }
1215 SdrLayerID GetHellLayerId() const { return mnHellLayerId; }
1216 void SetHeaderFooterHellLayerId( SdrLayerID nId ) { mnHeaderFooterHellLayerId = nId; }
1217 SdrLayerID GetHeaderFooterHellLayerId() const { return mnHeaderFooterHellLayerId; }
1219 private:
1220 EscherEx( const EscherEx& ) = delete;
1221 EscherEx& operator=( const EscherEx& ) = delete;
1225 #endif
1227 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */