bump product version to 6.3.0.0.beta1
[LibreOffice.git] / include / filter / msfilter / escherex.hxx
blobfe66f986fea01060b2b18b5ae0f4c42353509334
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 <vector>
26 #include <com/sun/star/awt/Point.hpp>
27 #include <com/sun/star/beans/PropertyState.hpp>
28 #include <com/sun/star/drawing/BitmapMode.hpp>
29 #include <com/sun/star/awt/XBitmap.hpp>
30 #include <com/sun/star/uno/Any.hxx>
31 #include <com/sun/star/uno/Reference.hxx>
32 #include <filter/msfilter/msfilterdllapi.h>
33 #include <rtl/string.hxx>
34 #include <rtl/ustring.hxx>
35 #include <sal/types.h>
36 #include <vcl/GraphicObject.hxx>
37 #include <svx/svdtypes.hxx>
38 #include <svx/msdffdef.hxx>
39 #include <tools/gen.hxx>
40 #include <tools/solar.h>
41 #include <tools/stream.hxx>
42 #include <vcl/mapmod.hxx>
43 #include <o3tl/typed_flags_set.hxx>
45 class Color;
47 namespace com { namespace sun { namespace star {
48 namespace awt { struct Rectangle; }
49 namespace beans { class XPropertySet; }
50 namespace drawing { struct EnhancedCustomShapeParameter; }
51 namespace drawing { struct Hatch; }
52 } } }
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 { namespace sun { namespace star {
445 namespace awt {
446 struct Gradient;
448 namespace drawing {
449 struct EnhancedCustomShapeAdjustmentValue;
450 class XShape;
451 class XShapes;
455 struct 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( const css::uno::Reference< css::drawing::XShape > & rC,
466 const css::awt::Point& rPA,
467 css::uno::Reference< css::drawing::XShape > const & rSA ,
468 const css::awt::Point& rPB,
469 css::uno::Reference< css::drawing::XShape > const & rSB ) :
470 mXConnector ( rC ),
471 maPointA ( rPA ),
472 mXConnectToA( rSA ),
473 maPointB ( rPB ),
474 mXConnectToB( rSB ) {}
476 static sal_uInt32 GetClosestPoint( const tools::Polygon& rPoly, const css::awt::Point& rP );
479 struct MSFILTER_DLLPUBLIC EscherExContainer
481 sal_uInt32 nContPos;
482 SvStream& rStrm;
484 EscherExContainer( SvStream& rSt, const sal_uInt16 nRecType, const sal_uInt16 nInstance = 0 );
485 ~EscherExContainer();
488 struct MSFILTER_DLLPUBLIC EscherExAtom
490 sal_uInt32 nContPos;
491 SvStream& rStrm;
493 EscherExAtom( SvStream& rSt, const sal_uInt16 nRecType, const sal_uInt16 nInstance = 0, const sal_uInt8 nVersion = 0 );
494 ~EscherExAtom();
497 struct EscherPropertyValueHelper
499 static bool GetPropertyValue(
500 css::uno::Any& rAny,
501 const css::uno::Reference< css::beans::XPropertySet > &,
502 const OUString& rPropertyName,
503 bool bTestPropertyAvailability = false
506 static css::beans::PropertyState GetPropertyState(
507 const css::uno::Reference < css::beans::XPropertySet > &,
508 const OUString& rPropertyName
513 struct EscherPersistEntry
515 sal_uInt32 mnID;
516 sal_uInt32 mnOffset;
518 EscherPersistEntry( sal_uInt32 nId, sal_uInt32 nOffset ) { mnID = nId; mnOffset = nOffset; };
523 class EscherBlibEntry
526 friend class EscherGraphicProvider;
527 friend class EscherEx;
529 protected:
531 sal_uInt32 mnIdentifier[ 4 ];
532 sal_uInt32 mnPictureOffset; // offset to the graphic in PictureStreams
533 sal_uInt32 mnSize; // size of real graphic
535 sal_uInt32 mnRefCount; // !! reference count
536 sal_uInt32 mnSizeExtra; // !! size of preceding header
538 ESCHER_BlibType meBlibType;
540 Size maPrefSize;
541 MapMode maPrefMapMode;
543 bool mbIsEmpty;
544 bool mbIsNativeGraphicPossible;
546 public:
548 EscherBlibEntry(
549 sal_uInt32 nPictureOffset,
550 const GraphicObject& rObj,
551 const OString& rId,
552 const GraphicAttr* pAttr
555 ~EscherBlibEntry();
557 void WriteBlibEntry( SvStream& rSt, bool bWritePictureOffset, sal_uInt32 nResize = 0 );
558 bool IsEmpty() const { return mbIsEmpty; };
560 bool operator==( const EscherBlibEntry& ) const;
564 enum class EscherGraphicProviderFlags {
565 NONE = 0,
566 UseInstances = 1,
568 namespace o3tl {
569 template<> struct typed_flags<EscherGraphicProviderFlags> : is_typed_flags<EscherGraphicProviderFlags, 0x01> {};
572 class MSFILTER_DLLPUBLIC EscherGraphicProvider
574 EscherGraphicProviderFlags
575 mnFlags;
576 std::vector<std::unique_ptr<EscherBlibEntry>>
577 mvBlibEntrys;
578 OUString maBaseURI;
580 protected:
582 sal_uInt32 ImplInsertBlib( EscherBlibEntry* p_EscherBlibEntry );
584 public:
586 sal_uInt32 GetBlibStoreContainerSize( SvStream const * pMergePicStreamBSE = nullptr ) const;
587 void WriteBlibStoreContainer( SvStream& rStrm, SvStream* pMergePicStreamBSE = nullptr );
588 void WriteBlibStoreEntry(SvStream& rStrm, sal_uInt32 nBlipId, sal_uInt32 nResize);
589 sal_uInt32 GetBlibID(
590 SvStream& rPicOutStream,
591 GraphicObject const & pGraphicObject,
592 const css::awt::Rectangle* pVisArea = nullptr,
593 const GraphicAttr* pGrafikAttr = nullptr,
594 const bool ooxmlExport = false
596 bool HasGraphics() const { return !mvBlibEntrys.empty(); };
598 void SetNewBlipStreamOffset( sal_Int32 nOffset );
600 bool GetPrefSize( const sal_uInt32 nBlibId, Size& rSize, MapMode& rMapMode );
602 void SetBaseURI( const OUString& rBaseURI ) { maBaseURI = rBaseURI; };
603 const OUString& GetBaseURI() { return maBaseURI; };
605 EscherGraphicProvider( EscherGraphicProviderFlags nFlags = EscherGraphicProviderFlags::NONE );
606 virtual ~EscherGraphicProvider();
608 EscherGraphicProvider& operator=( EscherGraphicProvider const & ) = delete; // MSVC2015 workaround
609 EscherGraphicProvider( EscherGraphicProvider const & ) = delete; // MSVC2015 workaround
612 struct EscherShapeListEntry;
614 class MSFILTER_DLLPUBLIC EscherSolverContainer
616 ::std::vector< std::unique_ptr<EscherShapeListEntry> > maShapeList;
617 ::std::vector< std::unique_ptr<EscherConnectorListEntry> > maConnectorList;
619 public:
621 sal_uInt32 GetShapeId(
622 const css::uno::Reference< css::drawing::XShape > & rShape
623 ) const;
625 void AddShape(
626 const css::uno::Reference< css::drawing::XShape > &,
627 sal_uInt32 nId
630 void AddConnector(
631 const css::uno::Reference< css::drawing::XShape > &,
632 const css::awt::Point& rA,
633 css::uno::Reference< css::drawing::XShape > const &,
634 const css::awt::Point& rB,
635 css::uno::Reference< css::drawing::XShape > const & rConB
638 void WriteSolver( SvStream& );
640 EscherSolverContainer();
641 ~EscherSolverContainer();
643 EscherSolverContainer& operator=( EscherSolverContainer const & ) = delete; // MSVC2015 workaround
644 EscherSolverContainer( EscherSolverContainer const & ) = delete; // MSVC2015 workaround
648 #define ESCHER_CREATEPOLYGON_LINE 1
649 #define ESCHER_CREATEPOLYGON_POLYLINE 2
650 #define ESCHER_CREATEPOLYGON_POLYPOLYGON 4
652 class SdrObjCustomShape;
654 struct EscherPropSortStruct
656 std::vector<sal_uInt8> nProp;
657 sal_uInt32 nPropValue;
658 sal_uInt16 nPropId;
661 typedef std::vector< EscherPropSortStruct > EscherProperties;
663 class MSFILTER_DLLPUBLIC EscherPropertyContainer
665 EscherGraphicProvider* pGraphicProvider;
666 SvStream* pPicOutStrm;
667 tools::Rectangle* pShapeBoundRect;
669 sal_uInt32 nCountCount;
670 sal_uInt32 nCountSize;
672 std::vector<EscherPropSortStruct>
673 pSortStruct;
675 bool bHasComplexData;
678 static sal_uInt32 ImplGetColor( const sal_uInt32 rColor, bool bSwap = true );
679 void ImplCreateGraphicAttributes(
680 const css::uno::Reference< css::beans::XPropertySet > & rXPropSet,
681 sal_uInt32 nBlibId,
682 bool bCreateCroppingAttributes
684 bool ImplCreateEmbeddedBmp(GraphicObject const & rGraphicObject);
686 SAL_DLLPRIVATE explicit EscherPropertyContainer(
687 EscherGraphicProvider * pGraphProv, SvStream * pPiOutStrm,
688 tools::Rectangle * pBoundRect);
690 public:
692 EscherPropertyContainer();
693 EscherPropertyContainer(
694 EscherGraphicProvider& rGraphicProvider, // the PropertyContainer needs to know
695 SvStream* pPicOutStrm, // the GraphicProvider to be able to write
696 tools::Rectangle& rShapeBoundRect // FillBitmaps or GraphicObjects.
697 ); // under some circumstances the ShapeBoundRect
698 // is adjusted this will happen when rotated
699 // GraphicObjects are saved to PowerPoint
700 ~EscherPropertyContainer();
702 void AddOpt(
703 sal_uInt16 nPropID,
704 bool bBlib,
705 sal_uInt32 nSizeReduction,
706 SvMemoryStream& rStream);
708 void AddOpt(
709 sal_uInt16 nPropertyID,
710 const OUString& rString);
712 void AddOpt(
713 sal_uInt16 nPropertyID,
714 sal_uInt32 nPropValue,
715 bool bBlib = false);
717 void AddOpt(
718 sal_uInt16 nPropertyID,
719 bool bBlib,
720 sal_uInt32 nPropValue,
721 const std::vector<sal_uInt8>& rProp);
723 bool GetOpt( sal_uInt16 nPropertyID, sal_uInt32& rPropValue ) const;
725 bool GetOpt( sal_uInt16 nPropertyID, EscherPropSortStruct& rPropValue ) const;
727 EscherProperties GetOpts() const;
729 void Commit( SvStream& rSt, sal_uInt16 nVersion = 3, sal_uInt16 nRecType = ESCHER_OPT );
731 void CreateShapeProperties(
732 const css::uno::Reference< css::drawing::XShape > & rXShape
734 bool CreateOLEGraphicProperties(
735 const css::uno::Reference< css::drawing::XShape > & rXOleObject
737 bool CreateGraphicProperties(
738 const css::uno::Reference< css::drawing::XShape > & rXShape,
739 const GraphicObject& rGraphicObj
741 bool CreateMediaGraphicProperties(
742 const css::uno::Reference< css::drawing::XShape > & rXMediaObject
745 /** Creates a complex ESCHER_Prop_fillBlip containing the BLIP directly (for Excel charts). */
746 void CreateEmbeddedBitmapProperties(
747 css::uno::Reference<css::awt::XBitmap> const & rxBitmap,
748 css::drawing::BitmapMode eBitmapMode
750 /** Creates a complex ESCHER_Prop_fillBlip containing a hatch style (for Excel charts). */
751 void CreateEmbeddedHatchProperties(
752 const css::drawing::Hatch& rHatch,
753 const Color& rBackColor,
754 bool bFillBackground
757 // the GraphicProperties will only be created if a GraphicProvider and PicOutStrm is known
758 // DR: #99897# if no GraphicProvider is present, a complex ESCHER_Prop_fillBlip
759 // will be created, containing the BLIP directly (e.g. for Excel charts).
760 bool CreateGraphicProperties(
761 const css::uno::Reference< css::beans::XPropertySet > & rXPropSet,
762 const OUString& rSource,
763 const bool bCreateFillBitmap,
764 const bool bCreateCroppingAttributes = false,
765 const bool bFillBitmapModeAllowed = true,
766 const bool bOOxmlExport = false
769 bool CreateBlipPropertiesforOLEControl( const css::uno::Reference< css::beans::XPropertySet > & rXPropSet, const css::uno::Reference< css::drawing::XShape > & rXShape);
771 bool CreatePolygonProperties(
772 const css::uno::Reference< css::beans::XPropertySet > & rXPropSet,
773 sal_uInt32 nFlags,
774 bool bBezier,
775 css::awt::Rectangle& rGeoRect,
776 tools::Polygon const * pPolygon = nullptr
779 static sal_uInt32 GetGradientColor(
780 const css::awt::Gradient* pGradient,
781 sal_uInt32 nStartColor
784 void CreateGradientProperties( const css::awt::Gradient & rGradient );
785 void CreateGradientProperties(
786 const css::uno::Reference< css::beans::XPropertySet > &,
787 bool bTransparentGradient = false
790 void CreateLineProperties(
791 const css::uno::Reference< css::beans::XPropertySet > &,
792 bool bEdge
794 void CreateFillProperties(
795 const css::uno::Reference< css::beans::XPropertySet > &,
796 bool bEdge,
797 bool bTransparentGradient = false );
798 void CreateFillProperties(
799 const css::uno::Reference< css::beans::XPropertySet > &,
800 bool bEdge,
801 const css::uno::Reference< css::drawing::XShape > & rXShape );
802 void CreateTextProperties(
803 const css::uno::Reference< css::beans::XPropertySet > &,
804 sal_uInt32 nText,
805 const bool bIsCustomShape = false,
806 const bool bIsTextFrame = true
809 bool CreateConnectorProperties(
810 const css::uno::Reference< css::drawing::XShape > & rXShape,
811 EscherSolverContainer& rSolver,
812 css::awt::Rectangle& rGeoRect,
813 sal_uInt16& rShapeType,
814 ShapeFlag& rShapeFlags
817 // Because shadow properties depends to the line and fillstyle, the CreateShadowProperties method should be called at last.
818 // It's active only when at least a FillStyle or LineStyle is set.
819 void CreateShadowProperties(
820 const css::uno::Reference< css::beans::XPropertySet > &
823 sal_Int32 GetValueForEnhancedCustomShapeParameter( const css::drawing::EnhancedCustomShapeParameter& rParameter,
824 const std::vector< sal_Int32 >& rEquationOrder, bool bAdjustTrans = false );
825 // creates all necessary CustomShape properties, this includes also Text-, Shadow-, Fill-, and LineProperties
826 void CreateCustomShapeProperties(
827 const MSO_SPT eShapeType,
828 const css::uno::Reference< css::drawing::XShape > &
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 EscherExClientRecord_Base() {}
893 virtual ~EscherExClientRecord_Base();
895 /// Application writes the record header
896 /// using rEx.AddAtom(...) followed by
897 /// record data written to rEx.GetStream()
898 virtual void WriteData( EscherEx& rEx ) const = 0;
902 /// abstract base class for ESCHER_ClientAnchor
903 class MSFILTER_DLLPUBLIC EscherExClientAnchor_Base
905 public:
906 EscherExClientAnchor_Base() {}
907 virtual ~EscherExClientAnchor_Base();
909 /// Application writes the record header
910 /// using rEx.AddAtom(...) followed by
911 /// record data written to rEx.GetStream()
912 virtual void WriteData( EscherEx& rEx,
913 const tools::Rectangle& rRect ) = 0;
916 class InteractionInfo
918 std::unique_ptr<SvMemoryStream> mpHyperlinkRecord;
920 public:
921 InteractionInfo( SvMemoryStream* pStream )
923 mpHyperlinkRecord.reset( pStream );
925 const std::unique_ptr< SvMemoryStream >& getHyperlinkRecord() { return mpHyperlinkRecord; }
928 class EscherExHostAppData
930 private:
931 EscherExClientAnchor_Base* pClientAnchor;
932 EscherExClientRecord_Base* pClientData;
933 EscherExClientRecord_Base* pClientTextbox;
934 InteractionInfo* pInteractionInfo;
935 // ignore single shape if entire pages are written
936 bool bDontWriteShape;
938 public:
939 EscherExHostAppData() : pClientAnchor(nullptr), pClientData(nullptr),
940 pClientTextbox(nullptr), pInteractionInfo(nullptr), bDontWriteShape(false)
943 void SetInteractionInfo( InteractionInfo* p )
944 { pInteractionInfo = p; }
945 void SetClientAnchor( EscherExClientAnchor_Base* p )
946 { pClientAnchor = p; }
947 void SetClientData( EscherExClientRecord_Base* p )
948 { pClientData = p; }
949 void SetClientTextbox( EscherExClientRecord_Base* p )
950 { pClientTextbox = p; }
951 void SetDontWriteShape( bool b )
952 { bDontWriteShape = b; }
953 InteractionInfo* GetInteractionInfo() const
954 { return pInteractionInfo; }
955 EscherExClientAnchor_Base* GetClientAnchor() const
956 { return pClientAnchor; }
957 EscherExClientRecord_Base* GetClientTextbox() const
958 { return pClientTextbox; }
960 void WriteClientAnchor( EscherEx& rEx, const tools::Rectangle& rRect )
961 { if( pClientAnchor ) pClientAnchor->WriteData( rEx, rRect ); }
962 void WriteClientData( EscherEx& rEx )
963 { if( pClientData ) pClientData->WriteData( rEx ); }
964 void WriteClientTextbox( EscherEx& rEx )
965 { if( pClientTextbox ) pClientTextbox->WriteData( rEx ); }
967 bool DontWriteShape() const { return bDontWriteShape; }
971 /** Instance for global DFF data, shared through various instances of EscherEx. */
972 class MSFILTER_DLLPUBLIC EscherExGlobal : public EscherGraphicProvider
974 public:
975 explicit EscherExGlobal();
976 virtual ~EscherExGlobal() override;
978 /** Returns a new drawing ID for a new drawing container (DGCONTAINER). */
979 sal_uInt32 GenerateDrawingId();
980 /** Creates and returns a new shape identifier, updates the internal shape
981 counters and registers the identifier in the DGG cluster table.
982 @param nDrawingId Drawing identifier has to be passed to be able to
983 generate shape identifiers for multiple drawings simultaniously. */
984 sal_uInt32 GenerateShapeId( sal_uInt32 nDrawingId, bool bIsInSpgr );
985 /** Returns the number of shapes in the current drawing, based on number of
986 calls to the GenerateShapeId() function. */
987 sal_uInt32 GetDrawingShapeCount( sal_uInt32 nDrawingId ) const;
988 /** Returns the last shape identifier generated by the GenerateShapeId()
989 function. */
990 sal_uInt32 GetLastShapeId( sal_uInt32 nDrawingId ) const;
992 /** Sets the flag indicating that the DGGCONTAINER exists. */
993 void SetDggContainer() { mbHasDggCont = true; }
994 /** Sets the flag indicating that the DGGCONTAINER exists. */
995 bool HasDggContainer() const { return mbHasDggCont; }
996 /** Returns the total size of the DGG atom (including header). */
997 sal_uInt32 GetDggAtomSize() const;
998 /** Writes the complete DGG atom to the passed stream (overwrites existing data!). */
999 void WriteDggAtom( SvStream& rStrm ) const;
1001 /** Called if a picture shall be written and no picture stream is set at
1002 class ImplEESdrWriter.
1004 On first invocation, this function calls the virtual member function
1005 ImplQueryPictureStream(). The return value will be cached internally
1006 for subsequent calls and for the GetPictureStream() function.
1008 SvStream* QueryPictureStream();
1010 /** Returns the picture stream if existing (queried), otherwise null. */
1011 SvStream* GetPictureStream() { return mpPicStrm; }
1013 private:
1014 /** Derived classes may implement to create a new stream used to store the
1015 picture data.
1017 The implementation has to take care about lifetime of the returned
1018 stream (it will not be destructed automatically). This function is
1019 called exactly once. The return value will be cached internally for
1020 repeated calls of the public QueryPictureStream() function.
1022 virtual SvStream* ImplQueryPictureStream();
1024 private:
1025 struct ClusterEntry
1027 sal_uInt32 mnDrawingId; /// Identifier of drawing this cluster belongs to (one-based index into maDrawingInfos).
1028 sal_uInt32 mnNextShapeId; /// Next free shape identifier in this cluster.
1029 explicit ClusterEntry( sal_uInt32 nDrawingId ) : mnDrawingId( nDrawingId ), mnNextShapeId( 0 ) {}
1031 typedef ::std::vector< ClusterEntry > ClusterTable;
1033 struct DrawingInfo
1035 sal_uInt32 mnClusterId; /// Currently used cluster (one-based index into maClusterTable).
1036 sal_uInt32 mnShapeCount; /// Current number of shapes in this drawing.
1037 sal_uInt32 mnLastShapeId; /// Last shape identifier generated for this drawing.
1038 explicit DrawingInfo( sal_uInt32 nClusterId ) : mnClusterId( nClusterId ), mnShapeCount( 0 ), mnLastShapeId( 0 ) {}
1040 typedef ::std::vector< DrawingInfo > DrawingInfoVector;
1042 ClusterTable maClusterTable; /// List with cluster IDs (used object IDs in drawings).
1043 DrawingInfoVector maDrawingInfos; /// Data about all used drawings.
1044 SvStream* mpPicStrm; /// Cached result of ImplQueryPictureStream().
1045 bool mbHasDggCont; /// True = the DGGCONTAINER has been initialized.
1046 bool mbPicStrmQueried; /// True = ImplQueryPictureStream() has been called.
1049 class SdrObject;
1050 class SdrPage;
1051 class ImplEESdrWriter;
1053 class MSFILTER_DLLPUBLIC EscherEx : public EscherPersistTable
1055 protected:
1056 std::shared_ptr<EscherExGlobal> mxGlobal;
1057 ::std::unique_ptr< ImplEESdrWriter > mpImplEESdrWriter;
1058 SvStream* mpOutStrm;
1059 bool mbOwnsStrm;
1060 sal_uInt32 mnStrmStartOfs;
1061 std::vector< sal_uInt32 > mOffsets;
1062 std::vector< sal_uInt16 > mRecTypes;
1064 sal_uInt32 mnCurrentDg;
1065 sal_uInt32 mnCountOfs;
1067 sal_uInt32 mnGroupLevel;
1068 SdrLayerID mnHellLayerId;
1070 bool mbEscherSpgr;
1071 bool mbEscherDg;
1072 bool mbOOXML;
1073 OUString mEditAs;
1076 bool DoSeek( sal_uInt32 nKey );
1078 public:
1079 explicit EscherEx( const std::shared_ptr<EscherExGlobal>& rxGlobal, SvStream* pOutStrm, bool bOOXML = false );
1080 virtual ~EscherEx() override;
1082 /** Creates and returns a new shape identifier, updates the internal shape
1083 counters and registers the identifier in the DGG cluster table. */
1084 virtual sal_uInt32 GenerateShapeId() { return mxGlobal->GenerateShapeId( mnCurrentDg, mbEscherSpgr ); }
1086 /** Returns the graphic provider from the global object that has been
1087 passed to the constructor.
1089 EscherGraphicProvider& GetGraphicProvider() { return *mxGlobal; }
1091 /** Called if a picture shall be written and no picture stream is set at
1092 class ImplEESdrWriter.
1094 SvStream* QueryPictureStream() { return mxGlobal->QueryPictureStream(); }
1096 /// Inserts internal data into the EscherStream, this process
1097 /// may and has to be executed only once
1098 /// If pPicStreamMergeBSE is known, the BLIPs from this stream are being
1099 /// merged into the MsofbtBSE Records of the EscherStream like it's
1100 /// required for Excel (and maybe Word?)
1101 void Flush( SvStream* pPicStreamMergeBSE = nullptr );
1103 /** Inserts the passed number of bytes at the current position of the
1104 output stream.
1106 Inserts dummy bytes and moves all following stream data, and updates
1107 all internal stream offsets stored in the PersistTable and the affected
1108 container sizes, which makes this operation very expensive. (!)
1110 @param nBytes The number of bytes to be inserted into the stream.
1112 An atom that currently ends
1113 exactly at the current stream position will not be expanded to
1114 include the inserted data (used to insert e.g. a new atom after an
1115 existing atom). Note that containers that end exactly at the
1116 current stream position are always expanded to include the inserted
1117 data.
1119 void InsertAtCurrentPos( sal_uInt32 nBytes );
1121 void InsertPersistOffset( sal_uInt32 nKey, sal_uInt32 nOffset ); // It is not being checked if this key is already in the PersistantTable
1122 void ReplacePersistOffset( sal_uInt32 nKey, sal_uInt32 nOffset );
1123 sal_uInt32 GetPersistOffset( sal_uInt32 nKey );
1124 bool SeekToPersistOffset( sal_uInt32 nKey );
1125 void InsertAtPersistOffset( sal_uInt32 nKey, sal_uInt32 nValue ); // nValue is being inserted into the Stream where it's appropriate (overwrite mode), without that the
1126 // current StreamPosition changes
1127 void SetEditAs( const OUString& rEditAs );
1128 const OUString& GetEditAs() { return mEditAs; }
1129 SvStream& GetStream() const { return *mpOutStrm; }
1130 sal_uLong GetStreamPos() const { return mpOutStrm->Tell(); }
1132 // features during the creation of the following Containers:
1134 // ESCHER_DggContainer: a EscherDgg Atom is automatically being created and managed
1135 // ESCHER_DgContainer: a EscherDg Atom is automatically being created and managed
1136 // ESCHER_SpgrContainer:
1137 // ESCHER_SpContainer:
1139 virtual void OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance = 0 );
1140 virtual void CloseContainer();
1142 void BeginAtom();
1143 void EndAtom( sal_uInt16 nRecType, int nRecVersion = 0, int nRecInstance = 0 );
1144 void AddAtom( sal_uInt32 nAtomSitze, sal_uInt16 nRecType, int nRecVersion = 0, int nRecInstance = 0 );
1145 void AddChildAnchor( const tools::Rectangle& rRectangle );
1146 void AddClientAnchor( const tools::Rectangle& rRectangle );
1148 virtual sal_uInt32 EnterGroup( const OUString& rShapeName, const tools::Rectangle* pBoundRect );
1149 sal_uInt32 EnterGroup( const tools::Rectangle* pBoundRect = nullptr );
1150 sal_uInt32 GetGroupLevel() const { return mnGroupLevel; };
1151 void SetGroupSnapRect( sal_uInt32 nGroupLevel, const tools::Rectangle& rRect );
1152 void SetGroupLogicRect( sal_uInt32 nGroupLevel, const tools::Rectangle& rRect );
1153 virtual void LeaveGroup();
1155 // a ESCHER_Sp is being written ( a ESCHER_DgContainer has to be opened for this purpose!)
1156 virtual void AddShape( sal_uInt32 nShpInstance, ShapeFlag nFlagIds, sal_uInt32 nShapeID = 0 );
1158 virtual void Commit( EscherPropertyContainer& rProps, const tools::Rectangle& rRect);
1160 static sal_uInt32 GetColor( const sal_uInt32 nColor );
1161 static sal_uInt32 GetColor( const Color& rColor );
1163 // ...Sdr... implemented in eschesdo.cxx
1165 void AddSdrPage( const SdrPage& rPage );
1166 void AddUnoShapes( const css::uno::Reference< css::drawing::XShapes >& rxShapes );
1168 /// returns the ShapeID
1169 sal_uInt32 AddSdrObject( const SdrObject& rObj, bool ooxmlExport = false );
1170 virtual void AddSdrObjectVMLObject( const SdrObject& /*rObj*/)
1172 // Required for Exporting VML shape
1175 /// If objects are written through AddSdrObject the
1176 /// SolverContainer has to be written, and maybe some
1177 /// maintenance to be done.
1178 void EndSdrObjectPage();
1180 /// Called before a shape is written, application supplies
1181 /// ClientRecords. May set AppData::bDontWriteShape so the
1182 /// shape is ignored.
1183 virtual EscherExHostAppData* StartShape(
1184 const css::uno::Reference< css::drawing::XShape >& rShape,
1185 const tools::Rectangle* pChildAnchor );
1187 /// Called after a shape is written to inform the application
1188 /// of the resulted shape type and ID.
1189 virtual void EndShape( sal_uInt16 nShapeType, sal_uInt32 nShapeID );
1191 /// Called before an AdditionalText EnterGroup occurs.
1192 /// The current shape will be written in three parts:
1193 /// a group shape, the shape itself, and an extra textbox shape.
1194 /// The complete flow is:
1195 /// StartShape sets HostData1.
1196 /// EnterAdditionalTextGroup sets HostData2, App may modify
1197 /// HostData1 and keep track of the change.
1198 /// The group shape is written with HostData2.
1199 /// Another StartShape with the same (!) object sets HostData3.
1200 /// The current shape is written with HostData3.
1201 /// EndShape is called for the current shape.
1202 /// Another StartShape with the same (!) object sets HostData4.
1203 /// The textbox shape is written with HostData4.
1204 /// EndShape is called for the textbox shape.
1205 /// EndShape is called for the group shape, this provides
1206 /// the same functionality as an ordinary recursive group.
1207 virtual EscherExHostAppData* EnterAdditionalTextGroup();
1209 /// Called if an ESCHER_Prop_lTxid shall be written
1210 virtual sal_uInt32 QueryTextID( const css::uno::Reference< css::drawing::XShape >&, sal_uInt32 nShapeId );
1211 // add an dummy rectangle shape into the escher stream
1212 sal_uInt32 AddDummyShape();
1214 static const SdrObject* GetSdrObject( const css::uno::Reference< css::drawing::XShape >& rXShape );
1216 void SetHellLayerId( SdrLayerID nId ) { mnHellLayerId = nId; }
1217 SdrLayerID GetHellLayerId() const { return mnHellLayerId; }
1219 private:
1220 EscherEx( const EscherEx& ) = delete;
1221 EscherEx& operator=( const EscherEx& ) = delete;
1225 #endif
1227 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */