Branch libreoffice-5-0-4
[LibreOffice.git] / include / filter / msfilter / escherex.hxx
blobca3465a35d5c007f1eb31a93a423364e77d32819
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>
25 #include <tools/solar.h>
26 #include <tools/gen.hxx>
27 #include <tools/stream.hxx>
28 #include <com/sun/star/uno/Reference.h>
29 #include <svtools/grfmgr.hxx>
30 #include <com/sun/star/awt/Size.hpp>
31 #include <com/sun/star/awt/Point.hpp>
32 #include <com/sun/star/awt/Rectangle.hpp>
33 #include <com/sun/star/beans/XPropertySet.hpp>
34 #include <com/sun/star/beans/PropertyState.hpp>
35 #include <com/sun/star/beans/PropertyValue.hpp>
36 #include <com/sun/star/drawing/BitmapMode.hpp>
37 #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
38 #include <com/sun/star/drawing/Hatch.hpp>
39 #include <svx/msdffdef.hxx>
40 #include <filter/msfilter/msfilterdllapi.h>
42 /*Record Name FBT-Value Instance Contents Wrd Exl PPt Ver*/
43 // In the Microsoft documentation the naming scheme is msofbt... instead of ESCHER_...
44 #define ESCHER_DggContainer 0xF000u /* per-document data X X X */
45 #define ESCHER_Dgg 0xF006u /* an FDGG and several FIDCLs X X X 0 */
46 #define ESCHER_OPT 0xF00Bu /* count of properties the document-wide default shape properties X X X 3 */
47 #define ESCHER_SplitMenuColors 0xF11Eu /* count of colors the colors in the top-level split menus X X X 0 */
48 #define ESCHER_BstoreContainer 0xF001u /* count of BLIPs all images in the document (JPEGs, metafiles, etc.) X X X */
49 #define ESCHER_BSE 0xF007u /* BLIP type an FBSE (one per BLIP) X X X 2 */
50 #define ESCHER_BlipFirst 0xF018u /* range of fbts reserved for various kinds of BLIPs X X X */
52 #define ESCHER_DgContainer 0xF002u /* per-sheet/page/slide data X X X */
53 #define ESCHER_Dg 0xF008u /* drawing ID an FDG X X X 0 */
54 #define ESCHER_SpgrContainer 0xF003u /* several SpContainers, the first of which is the group shape itself X X X */
55 #define ESCHER_SpContainer 0xF004u /* a shape X X X */
56 #define ESCHER_Spgr 0xF009u /* an FSPGR; only present if the shape is a group shape X X X 1 */
57 #define ESCHER_Sp 0xF00Au /* shape type an FSP X X X 2 */
58 //#define ESCHER_OPT 0xF00Bu /* count of properties a shape property table X X X 3 */
59 #define ESCHER_ClientTextbox 0xF00Du /* host-defined the text in the textbox, in host-defined format X X X */
60 #define ESCHER_ChildAnchor 0xF00Fu /* a RECT, in units relative to the parent group X X X 0 */
61 #define ESCHER_ClientAnchor 0xF010u /* host-defined the location of the shape, in a host-defined format X X X */
62 #define ESCHER_ClientData 0xF011u /* host-defined host-specific data X X X */
63 #define ESCHER_SolverContainer 0xF005u /* count of rules the rules governing shapes X X X */
64 #define ESCHER_ConnectorRule 0xF012u /* an FConnectorRule X X 1 */
65 #define ESCHER_UDefProp 0xF122u
67 #define SHAPEFLAG_OLESHAPE 0x010 /* The shape is an OLE object */
68 #define SHAPEFLAG_FLIPH 0x040 /* Shape is flipped horizontally */
69 #define SHAPEFLAG_FLIPV 0x080 /* Shape is flipped vertically */
70 #define SHAPEFLAG_CONNECTOR 0x100 /* Connector type of shape */
71 #define SHAPEFLAG_HAVEANCHOR 0x200 /* Shape has an anchor of some kind */
72 #define SHAPEFLAG_HAVESPT 0x800 /* Shape has a shape type property */
74 #define ESCHER_ShpInst_Min 0
75 #define ESCHER_ShpInst_NotPrimitive ESCHER_ShpInst_Min
76 #define ESCHER_ShpInst_Rectangle 1
77 #define ESCHER_ShpInst_RoundRectangle 2
78 #define ESCHER_ShpInst_Ellipse 3
79 #define ESCHER_ShpInst_Arc 19
80 #define ESCHER_ShpInst_Line 20
81 #define ESCHER_ShpInst_StraightConnector1 32
82 #define ESCHER_ShpInst_BentConnector2 33
83 #define ESCHER_ShpInst_BentConnector3 34
84 #define ESCHER_ShpInst_CurvedConnector3 38
85 #define ESCHER_ShpInst_PictureFrame 75
86 #define ESCHER_ShpInst_TextPlainText 136
87 #define ESCHER_ShpInst_TextDeflateInflateDeflate 167
88 #define ESCHER_ShpInst_TextSlantUp 172
89 #define ESCHER_ShpInst_HostControl 201
90 #define ESCHER_ShpInst_TextBox 202
91 #define ESCHER_ShpInst_COUNT 203
92 #define ESCHER_ShpInst_Max 0x0FFF
93 #define ESCHER_ShpInst_Nil ESCHER_ShpInst_Max
95 enum ESCHER_BlibType
96 { // GEL provided types...
97 ERROR = 0, // An error occurred during loading
98 UNKNOWN, // An unknown blip type
99 EMF, // Windows Enhanced Metafile
100 WMF, // Windows Metafile
101 PICT, // Macintosh PICT
102 PEG, // JFIF
103 PNG, // PNG
104 DIB, // Windows DIB
105 FirstClient = 32, // First client defined blip type
106 LastClient = 255 // Last client defined blip type
109 enum ESCHER_FillStyle
111 ESCHER_FillSolid, // Fill with a solid color
112 ESCHER_FillPattern, // Fill with a pattern (bitmap)
113 ESCHER_FillTexture, // A texture (pattern with its own color map)
114 ESCHER_FillPicture, // Center a picture in the shape
115 ESCHER_FillShade, // Shade from start to end points
116 ESCHER_FillShadeCenter, // Shade from bounding rectangle to end point
117 ESCHER_FillShadeShape, // Shade from shape outline to end point
118 ESCHER_FillShadeScale,
119 ESCHER_FillShadeTitle,
120 ESCHER_FillBackground
123 enum ESCHER_wMode
125 ESCHER_wColor, // only used for predefined shades
126 ESCHER_wAutomatic, // depends on object type
127 ESCHER_wGrayScale, // shades of gray only
128 ESCHER_wLightGrayScale, // shades of light gray only
129 ESCHER_wInverseGray, // dark gray mapped to light gray, etc.
130 ESCHER_wGrayOutline, // pure gray and white
131 ESCHER_wBlackTextLine, // black text and lines, all else grayscale
132 ESCHER_wHighContrast, // pure black and white mode (no grays)
133 ESCHER_wBlack, // solid black msobwWhite, // solid white
134 ESCHER_wDontShow, // object not drawn
135 ESCHER_wNumModes // number of Black and white modes
140 enum ESCHER_ShapePath
142 ESCHER_ShapeLines, // A line of straight segments
143 ESCHER_ShapeLinesClosed, // A closed polygonal object
144 ESCHER_ShapeCurves, // A line of Bezier curve segments
145 ESCHER_ShapeCurvesClosed, // A closed shape with curved edges
146 ESCHER_ShapeComplex // pSegmentInfo must be non-empty
150 enum ESCHER_WrapMode
152 ESCHER_WrapSquare,
153 ESCHER_WrapByPoints,
154 ESCHER_WrapNone,
155 ESCHER_WrapTopBottom,
156 ESCHER_WrapThrough
160 enum ESCHER_bwMode
162 ESCHER_bwColor, // only used for predefined shades
163 ESCHER_bwAutomatic, // depends on object type
164 ESCHER_bwGrayScale, // shades of gray only
165 ESCHER_bwLightGrayScale, // shades of light gray only
166 ESCHER_bwInverseGray, // dark gray mapped to light gray, etc.
167 ESCHER_bwGrayOutline, // pure gray and white
168 ESCHER_bwBlackTextLine, // black text and lines, all else grayscale
169 ESCHER_bwHighContrast, // pure black and white mode (no grays)
170 ESCHER_bwBlack, // solid black
171 ESCHER_bwWhite, // solid white
172 ESCHER_bwDontShow, // object not drawn
173 ESCHER_bwNumModes // number of Black and white modes
177 enum ESCHER_AnchorText
179 ESCHER_AnchorTop,
180 ESCHER_AnchorMiddle,
181 ESCHER_AnchorBottom,
182 ESCHER_AnchorTopCentered,
183 ESCHER_AnchorMiddleCentered,
184 ESCHER_AnchorBottomCentered,
185 ESCHER_AnchorTopBaseline,
186 ESCHER_AnchorBottomBaseline,
187 ESCHER_AnchorTopCenteredBaseline,
188 ESCHER_AnchorBottomCenteredBaseline
191 enum ESCHER_cDir
193 ESCHER_cDir0, // Right
194 ESCHER_cDir90, // Down
195 ESCHER_cDir180, // Left
196 ESCHER_cDir270 // Up
199 // connector style
200 enum ESCHER_cxSTYLE
202 ESCHER_cxstyleStraight = 0,
203 ESCHER_cxstyleBent,
204 ESCHER_cxstyleCurved,
205 ESCHER_cxstyleNone
208 // text flow
209 enum ESCHER_txfl
211 ESCHER_txflHorzN, // Horizontal non-@
212 ESCHER_txflTtoBA, // Top to Bottom @-font
213 ESCHER_txflBtoT, // Bottom to Top non-@
214 ESCHER_txflTtoBN, // Top to Bottom non-@
215 ESCHER_txflHorzA, // Horizontal @-font
216 ESCHER_txflVertN // Vertical, non-@
219 // text direction (needed for Bi-Di support)
220 enum ESCHER_txDir
222 ESCHER_txdirLTR, // left-to-right text direction
223 ESCHER_txdirRTL, // right-to-left text direction
224 ESCHER_txdirContext // context text direction
227 // Callout Type
228 enum ESCHER_spcot
230 ESCHER_spcotRightAngle = 1,
231 ESCHER_spcotOneSegment = 2,
232 ESCHER_spcotTwoSegment = 3,
233 ESCHER_spcotThreeSegment= 4
236 // Callout Angle
237 enum ESCHER_spcoa
239 ESCHER_spcoaAny,
240 ESCHER_spcoa30,
241 ESCHER_spcoa45,
242 ESCHER_spcoa60,
243 ESCHER_spcoa90,
244 ESCHER_spcoa0
247 // Callout Drop
248 enum ESCHER_spcod
250 ESCHER_spcodTop,
251 ESCHER_spcodCenter,
252 ESCHER_spcodBottom,
253 ESCHER_spcodSpecified
256 // FontWork alignment
257 enum ESCHER_GeoTextAlign
259 ESCHER_AlignTextStretch, // Stretch each line of text to fit width.
260 ESCHER_AlignTextCenter, // Center text on width.
261 ESCHER_AlignTextLeft, // Left justify.
262 ESCHER_AlignTextRight, // Right justify.
263 ESCHER_AlignTextLetterJust, // Spread letters out to fit width.
264 ESCHER_AlignTextWordJust, // Spread words out to fit width.
265 ESCHER_AlignTextInvalid // Invalid
268 // flags for pictures
269 enum ESCHER_BlipFlags
271 ESCHER_BlipFlagDefault = 0,
272 ESCHER_BlipFlagComment = 0, // Blip name is a comment
273 ESCHER_BlipFlagFile, // Blip name is a file name
274 ESCHER_BlipFlagURL, // Blip name is a full URL
275 ESCHER_BlipFlagType = 3, // Mask to extract type
276 /* Or the following flags with any of the above. */
277 ESCHER_BlipFlagDoNotSave = 4,
278 ESCHER_BlipFlagLinkToFile = 8
282 enum ESCHER_3DRenderMode
284 ESCHER_FullRender, // Generate a full rendering
285 ESCHER_Wireframe, // Generate a wireframe
286 ESCHER_BoundingCube // Generate a bounding cube
290 enum ESCHER_xFormType
292 ESCHER_xFormAbsolute, // Apply transform in absolute space centered on shape
293 ESCHER_xFormShape, // Apply transform to shape geometry
294 ESCHER_xFormDrawing // Apply transform in drawing space
298 enum ESCHER_ShadowType
300 ESCHER_ShadowOffset, // N pixel offset shadow
301 ESCHER_ShadowDouble, // Use second offset too
302 ESCHER_ShadowRich, // Rich perspective shadow (cast relative to shape)
303 ESCHER_ShadowShape, // Rich perspective shadow (cast in shape space)
304 ESCHER_ShadowDrawing, // Perspective shadow cast in drawing space
305 ESCHER_ShadowEmbossOrEngrave
308 // - the type of a (length) measurement
309 enum ESCHER_dzType
311 ESCHER_dzTypeMin = 0,
312 ESCHER_dzTypeDefault = 0, // Default size, ignore the values
313 ESCHER_dzTypeA = 1, // Values are in EMUs
314 ESCHER_dzTypeV = 2, // Values are in pixels
315 ESCHER_dzTypeShape = 3, // Values are 16.16 fractions of shape size
316 ESCHER_dzTypeFixedAspect = 4, // Aspect ratio is fixed
317 ESCHER_dzTypeAFixed = 5, // EMUs, fixed aspect ratio
318 ESCHER_dzTypeVFixed = 6, // Pixels, fixed aspect ratio
319 ESCHER_dzTypeShapeFixed = 7, // Proportion of shape, fixed aspect ratio
320 ESCHER_dzTypeFixedAspectEnlarge= 8, // Aspect ratio is fixed, favor larger size
321 ESCHER_dzTypeAFixedBig = 9, // EMUs, fixed aspect ratio
322 ESCHER_dzTypeVFixedBig = 10, // Pixels, fixed aspect ratio
323 ESCHER_dzTypeShapeFixedBig= 11, // Proportion of shape, fixed aspect ratio
324 ESCHER_dzTypeMax = 11
327 // how to interpret the colors in a shaded fill.
328 enum ESCHER_ShadeType
330 ESCHER_ShadeNone = 0, // Interpolate without correction between RGBs
331 ESCHER_ShadeGamma = 1, // Apply gamma correction to colors
332 ESCHER_ShadeSigma = 2, // Apply a sigma transfer function to position
333 ESCHER_ShadeBand = 4, // Add a flat band at the start of the shade
334 ESCHER_ShadeOneColor = 8, // This is a one color shade
336 /* A parameter for the band or sigma function can be stored in the top
337 16 bits of the value - this is a proportion of *each* band of the
338 shade to make flat (or the approximate equal value for a sigma
339 function). NOTE: the parameter is not used for the sigma function,
340 instead a built in value is used. This value should not be changed
341 from the default! */
342 ESCHER_ShadeParameterShift = 16,
343 ESCHER_ShadeParameterMask = 0xffff0000,
345 ESCHER_ShadeDefault = (ESCHER_ShadeGamma|ESCHER_ShadeSigma|
346 (16384<<ESCHER_ShadeParameterShift))
349 // compound line style
350 enum ESCHER_LineStyle
352 ESCHER_LineSimple, // Single line (of width lineWidth)
353 ESCHER_LineDouble, // Double lines of equal width
354 ESCHER_LineThickThin, // Double lines, one thick, one thin
355 ESCHER_LineThinThick, // Double lines, reverse order
356 ESCHER_LineTriple // Three lines, thin, thick, thin
359 // how to "fill" the line contour
360 enum ESCHER_LineType
362 ESCHER_lineSolidType, // Fill with a solid color
363 ESCHER_linePattern, // Fill with a pattern (bitmap)
364 ESCHER_lineTexture, // A texture (pattern with its own color map)
365 ESCHER_linePicture // Center a picture in the shape
368 // dashed line style
369 enum ESCHER_LineDashing
371 ESCHER_LineSolid, // Solid (continuous) pen
372 ESCHER_LineDashSys, // PS_DASH system dash style
373 ESCHER_LineDotSys, // PS_DOT system dash style
374 ESCHER_LineDashDotSys, // PS_DASHDOT system dash style
375 ESCHER_LineDashDotDotSys, // PS_DASHDOTDOT system dash style
376 ESCHER_LineDotGEL, // square dot style
377 ESCHER_LineDashGEL, // dash style
378 ESCHER_LineLongDashGEL, // long dash style
379 ESCHER_LineDashDotGEL, // dash short dash
380 ESCHER_LineLongDashDotGEL, // long dash short dash
381 ESCHER_LineLongDashDotDotGEL // long dash short dash short dash
384 // line end effect
385 enum ESCHER_LineEnd
387 ESCHER_LineNoEnd,
388 ESCHER_LineArrowEnd,
389 ESCHER_LineArrowStealthEnd,
390 ESCHER_LineArrowDiamondEnd,
391 ESCHER_LineArrowOvalEnd,
392 ESCHER_LineArrowOpenEnd
395 // size of arrowhead
396 enum ESCHER_LineWidth
398 ESCHER_LineNarrowArrow,
399 ESCHER_LineMediumWidthArrow,
400 ESCHER_LineWideArrow
403 // size of arrowhead
404 enum ESCHER_LineEndLength
406 ESCHER_LineShortArrow,
407 ESCHER_LineMediumLenArrow,
408 ESCHER_LineLongArrow
411 // line join style.
412 enum ESCHER_LineJoin
414 ESCHER_LineJoinBevel, // Join edges by a straight line
415 ESCHER_LineJoinMiter, // Extend edges until they join
416 ESCHER_LineJoinRound // Draw an arc between the two edges
419 // line cap style (applies to ends of dash segments too).
420 enum ESCHER_LineCap
422 ESCHER_LineEndCapRound, // Rounded ends - the default
423 ESCHER_LineEndCapSquare, // Square protrudes by half line width
424 ESCHER_LineEndCapFlat // Line ends at end point
427 enum MSOPATHTYPE
429 msopathLineTo, // Draw a straight line (one point)
430 msopathCurveTo, // Draw a cubic Bezier curve (three points)
431 msopathMoveTo, // Move to a new point (one point)
432 msopathClose, // Close a sub - path (no points)
433 msopathEnd, // End a path (no points)
434 msopathEscape, // Escape code
435 msopathClientEscape, // Escape code interpreted by the client
436 msopathInvalid // Invalid - should never be found
439 // Shape Properties
440 // 1pt = 12700 EMU (English Metric Units)
441 // 1pt = 20 Twip = 20/1440" = 1/72"
442 // 1twip=635 EMU
443 // 1" = 12700*72 = 914400 EMU
444 // 1" = 25.4mm
445 // 1mm = 36000 EMU
446 // Transform
447 #define ESCHER_Prop_Rotation 4 /* Fixed Point 16.16 degrees */
448 // Protection
449 #define ESCHER_Prop_LockAgainstGrouping 127 /* bool Do not group this shape */
450 // Text
451 #define ESCHER_Prop_lTxid 128 /* LONG id for the text, value determined by the host */
452 #define ESCHER_Prop_dxTextLeft 129 /* LONG margins relative to shape's inscribed */
453 #define ESCHER_Prop_dyTextTop 130 /* LONG text rectangle (in EMUs) */
454 #define ESCHER_Prop_dxTextRight 131 /* LONG */
455 #define ESCHER_Prop_dyTextBottom 132 /* LONG */
456 #define ESCHER_Prop_WrapText 133 /* MSOWRAPMODE Wrap text at shape margins */
457 #define ESCHER_Prop_AnchorText 135 /* ESCHER_AnchorText How to anchor the text */
458 #define ESCHER_Prop_txflTextFlow 136 /* MSOTXFL Text flow */
459 #define ESCHER_Prop_hspNext 138 /* MSOHSP ID of the next shape (used by Word for linked textboxes) */
460 #define ESCHER_Prop_FitTextToShape 191 /* bool Size text to fit shape size */
461 // GeoText
462 #define ESCHER_Prop_gtextUNICODE 192 /* WCHAR* UNICODE text string */
463 #define ESCHER_Prop_gtextSize 195 /* LONG default point size */
464 #define ESCHER_Prop_gtextFont 197 /* WCHAR* font family name */
465 // Blip
466 #define ESCHER_Prop_cropFromTop 256 /* LONG 16.16 fraction times total */
467 #define ESCHER_Prop_cropFromBottom 257 /* LONG image width or height, */
468 #define ESCHER_Prop_cropFromLeft 258 /* LONG as appropriate. */
469 #define ESCHER_Prop_cropFromRight 259 /* LONG */
470 #define ESCHER_Prop_pib 260 /* IMsoBlip* Blip to display */
471 #define ESCHER_Prop_pibName 261 /* WCHAR* Blip file name */
472 #define ESCHER_Prop_pibFlags 262 /* MSOBLIPFLAGS Blip flags */
473 #define ESCHER_Prop_pictureContrast 264 /* LONG contrast setting */
474 #define ESCHER_Prop_pictureBrightness 265 /* LONG brightness setting */
475 #define ESCHER_Prop_pictureId 267 /* LONG Host-defined ID for OLE objects (usually a pointer) */
476 #define ESCHER_Prop_pictureActive 319 /* bool Server is active (OLE objects only) */
477 // Geometry
478 #define ESCHER_Prop_geoLeft 320 /* LONG Defines the G (geometry) coordinate space. */
479 #define ESCHER_Prop_geoTop 321 /* LONG */
480 #define ESCHER_Prop_geoRight 322 /* LONG */
481 #define ESCHER_Prop_geoBottom 323 /* LONG */
482 #define ESCHER_Prop_shapePath 324 /* MSOSHAPEPATH */
483 #define ESCHER_Prop_pVertices 325 /* IMsoArray An array of points, in G units. */
484 #define ESCHER_Prop_pSegmentInfo 326 /* IMsoArray */
485 #define ESCHER_Prop_adjustValue 327 /* LONG Adjustment values corresponding to */
486 #define ESCHER_Prop_adjust2Value 328 /* LONG the positions of the adjust handles */
487 #define ESCHER_Prop_fFillOK 383 /* bool OK to fill the shape through the UI or VBA? */
488 // FillStyle
489 #define ESCHER_Prop_fillType 384 /* ESCHER_FillStyle Type of fill */
490 #define ESCHER_Prop_fillColor 385 /* MSOCLR Foreground color */
491 #define ESCHER_Prop_fillOpacity 386 /* LONG Fixed 16.16 */
492 #define ESCHER_Prop_fillBackColor 387 /* MSOCLR Background color */
493 #define ESCHER_Prop_fillBackOpacity 388 /* LONG Shades only */
494 #define ESCHER_Prop_fillBlip 390 /* IMsoBlip* Pattern/texture */
495 #define ESCHER_Prop_fillAngle 395 /* LONG Fade angle - degrees in 16.16 */
496 #define ESCHER_Prop_fillFocus 396 /* LONG Linear shaded fill focus percent */
497 #define ESCHER_Prop_fillToLeft 397 /* LONG Fraction 16.16 */
498 #define ESCHER_Prop_fillToTop 398 /* LONG Fraction 16.16 */
499 #define ESCHER_Prop_fillToRight 399 /* LONG Fraction 16.16 */
500 #define ESCHER_Prop_fillToBottom 400 /* LONG Fraction 16.16 */
501 #define ESCHER_Prop_fillRectRight 403 /* LONG define how large the fade is going to be. */
502 #define ESCHER_Prop_fillRectBottom 404 /* LONG */
503 #define ESCHER_Prop_fNoFillHitTest 447 /* bool Hit test a shape as though filled */
504 // LineStyle
505 #define ESCHER_Prop_lineColor 448 /* MSOCLR Color of line */
506 #define ESCHER_Prop_lineOpacity 449 /* LONG Not implemented */
507 #define ESCHER_Prop_lineBackColor 450 /* MSOCLR Background color */
508 #define ESCHER_Prop_lineWidth 459 /* LONG A units; 1pt == 12700 EMUs */
509 #define ESCHER_Prop_lineStyle 461 /* MSOLINESTYLE Draw parallel lines? */
510 #define ESCHER_Prop_lineDashing 462 /* MSOLINEDASHING Can be overridden by: */
511 #define ESCHER_Prop_lineStartArrowhead 464 /* MSOLINEEND Arrow at start */
512 #define ESCHER_Prop_lineEndArrowhead 465 /* MSOLINEEND Arrow at end */
513 #define ESCHER_Prop_lineStartArrowWidth 466 /* MSOLINEENDWIDTH Arrow at start */
514 #define ESCHER_Prop_lineStartArrowLength 467 /* MSOLINEENDLENGTH Arrow at end */
515 #define ESCHER_Prop_lineEndArrowWidth 468 /* MSOLINEENDWIDTH Arrow at start */
516 #define ESCHER_Prop_lineEndArrowLength 469 /* MSOLINEENDLENGTH Arrow at end */
517 #define ESCHER_Prop_lineJoinStyle 470 /* MSOLINEJOIN How to join lines */
518 #define ESCHER_Prop_lineEndCapStyle 471 /* MSOLINECAP How to end lines */
519 #define ESCHER_Prop_fNoLineDrawDash 511 /* bool Draw a dashed line if no line */
520 // ShadowStyle
521 #define ESCHER_Prop_shadowColor 513 /* MSOCLR Foreground color */
522 #define ESCHER_Prop_shadowOpacity 516 /* LONG Fixed 16.16 */
523 #define ESCHER_Prop_shadowOffsetX 517 /* LONG Offset shadow */
524 #define ESCHER_Prop_shadowOffsetY 518 /* LONG Offset shadow */
525 #define ESCHER_Prop_fshadowObscured 575 /* bool Excel5-style shadow */
526 // PerspectiveStyle
527 // 3D Object
528 #define ESCHER_Prop_fc3DLightFace 703 /* bool */
529 // 3D Style
530 // Shape
531 #define ESCHER_Prop_hspMaster 769 /* MSOHSP master shape */
532 #define ESCHER_Prop_cxstyle 771 /* MSOCXSTYLE Type of connector */
533 #define ESCHER_Prop_bWMode 772 /* ESCHERwMode Settings for modifications to */
534 #define ESCHER_Prop_fBackground 831 /* bool If sal_True, this is the background shape. */
535 // Callout
536 // GroupShape
537 #define ESCHER_Prop_wzName 896 /* WCHAR* Shape Name (present only if explicitly set) */
538 #define ESCHER_Prop_wzDescription 897 /* WCHAR* alternate text */
539 #define ESCHER_Prop_pihlShape 898 /* IHlink* The hyperlink in the shape. */
540 #define ESCHER_Prop_dxWrapDistLeft 900 /* LONG Left wrapping distance from text (Word) */
541 #define ESCHER_Prop_dyWrapDistTop 901 /* LONG Top wrapping distance from text (Word) */
542 #define ESCHER_Prop_dxWrapDistRight 902 /* LONG Right wrapping distance from text (Word) */
543 #define ESCHER_Prop_dyWrapDistBottom 903 /* LONG Bottom wrapping distance from text (Word) */
544 #define ESCHER_Prop_tableProperties 927
545 #define ESCHER_Prop_tableRowProperties 928
546 #define ESCHER_Prop_fHidden 958 /* bool Do not display */
547 #define ESCHER_Prop_fPrint 959 /* bool Print this shape */
550 #define ESCHER_Persist_PrivateEntry 0x80000000
551 #define ESCHER_Persist_Dgg 0x00010000
552 #define ESCHER_Persist_Dg 0x00020000
553 #define ESCHER_Persist_CurrentPosition 0x00040000
554 #define ESCHER_Persist_Grouping_Snap 0x00050000
555 #define ESCHER_Persist_Grouping_Logic 0x00060000
557 const sal_uInt32 DFF_DGG_CLUSTER_SIZE = 0x00000400; /// Shape IDs per cluster in DGG atom.
561 namespace com { namespace sun { namespace star {
562 namespace awt {
563 struct Gradient;
565 namespace drawing {
566 struct EnhancedCustomShapeAdjustmentValue;
567 class XShape;
568 class XShapes;
572 struct MSFILTER_DLLPUBLIC EscherConnectorListEntry
574 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mXConnector;
575 ::com::sun::star::awt::Point maPointA;
576 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mXConnectToA;
577 ::com::sun::star::awt::Point maPointB;
578 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mXConnectToB;
580 sal_uInt32 GetConnectorRule( bool bFirst );
582 EscherConnectorListEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rC,
583 const ::com::sun::star::awt::Point& rPA,
584 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rSA ,
585 const ::com::sun::star::awt::Point& rPB,
586 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rSB ) :
587 mXConnector ( rC ),
588 maPointA ( rPA ),
589 mXConnectToA( rSA ),
590 maPointB ( rPB ),
591 mXConnectToB( rSB ) {}
593 static sal_uInt32 GetClosestPoint( const Polygon& rPoly, const ::com::sun::star::awt::Point& rP );
596 struct MSFILTER_DLLPUBLIC EscherExContainer
598 sal_uInt32 nContPos;
599 SvStream& rStrm;
601 EscherExContainer( SvStream& rSt, const sal_uInt16 nRecType, const sal_uInt16 nInstance = 0 );
602 ~EscherExContainer();
605 struct MSFILTER_DLLPUBLIC EscherExAtom
607 sal_uInt32 nContPos;
608 SvStream& rStrm;
610 EscherExAtom( SvStream& rSt, const sal_uInt16 nRecType, const sal_uInt16 nInstance = 0, const sal_uInt8 nVersion = 0 );
611 ~EscherExAtom();
614 struct EscherPropertyValueHelper
616 static bool GetPropertyValue(
617 ::com::sun::star::uno::Any& rAny,
618 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
619 const OUString& rPropertyName,
620 bool bTestPropertyAvailability = false
623 static ::com::sun::star::beans::PropertyState GetPropertyState(
624 const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > &,
625 const OUString& rPropertyName
631 struct EscherPersistEntry
633 sal_uInt32 mnID;
634 sal_uInt32 mnOffset;
636 EscherPersistEntry( sal_uInt32 nId, sal_uInt32 nOffset ) { mnID = nId; mnOffset = nOffset; };
642 class EscherBlibEntry
645 friend class EscherGraphicProvider;
646 friend class EscherEx;
648 protected:
650 sal_uInt32 mnIdentifier[ 4 ];
651 sal_uInt32 mnPictureOffset; // offset to the graphic im PictureStreams
652 sal_uInt32 mnSize; // size of real graphic
654 sal_uInt32 mnRefCount; // !! reference count
655 sal_uInt32 mnSizeExtra; // !! size of preceding header
657 ESCHER_BlibType meBlibType;
659 Size maPrefSize;
660 MapMode maPrefMapMode;
662 bool mbIsEmpty;
663 bool mbIsNativeGraphicPossible;
665 public:
667 EscherBlibEntry(
668 sal_uInt32 nPictureOffset,
669 const GraphicObject& rObj,
670 const OString& rId,
671 const GraphicAttr* pAttr = NULL
674 ~EscherBlibEntry();
676 void WriteBlibEntry( SvStream& rSt, bool bWritePictureOffset, sal_uInt32 nResize = 0 );
677 bool IsEmpty() const { return mbIsEmpty; };
679 bool operator==( const EscherBlibEntry& ) const;
684 #define _E_GRAPH_PROV_USE_INSTANCES 1
685 #define _E_GRAPH_PROV_DO_NOT_ROTATE_METAFILES 2
687 class MSFILTER_DLLPUBLIC EscherGraphicProvider
689 sal_uInt32 mnFlags;
691 EscherBlibEntry** mpBlibEntrys;
692 sal_uInt32 mnBlibBufSize;
693 sal_uInt32 mnBlibEntrys;
695 OUString maBaseURI;
697 protected:
699 sal_uInt32 ImplInsertBlib( EscherBlibEntry* p_EscherBlibEntry );
701 public:
703 sal_uInt32 GetBlibStoreContainerSize( SvStream* pMergePicStreamBSE = NULL ) const;
704 void WriteBlibStoreContainer( SvStream& rStrm, SvStream* pMergePicStreamBSE = NULL );
705 bool WriteBlibStoreEntry(SvStream& rStrm, sal_uInt32 nBlipId,
706 bool bWritePictureOffset, sal_uInt32 nResize = 0);
707 sal_uInt32 GetBlibID(
708 SvStream& rPicOutStream,
709 const OString& rGraphicId,
710 const Rectangle& rBoundRect,
711 const com::sun::star::awt::Rectangle* pVisArea = NULL,
712 const GraphicAttr* pGrafikAttr = NULL,
713 const bool ooxmlExport = false
715 bool HasGraphics() const { return mnBlibEntrys != 0; };
717 void SetNewBlipStreamOffset( sal_Int32 nOffset );
719 bool GetPrefSize( const sal_uInt32 nBlibId, Size& rSize, MapMode& rMapMode );
721 void SetBaseURI( const OUString& rBaseURI ) { maBaseURI = rBaseURI; };
722 const OUString& GetBaseURI() { return maBaseURI; };
724 EscherGraphicProvider( sal_uInt32 nFlags = _E_GRAPH_PROV_DO_NOT_ROTATE_METAFILES );
725 virtual ~EscherGraphicProvider();
728 struct EscherShapeListEntry;
729 typedef ::std::vector< EscherShapeListEntry* > EscherShapeList_impl;
730 typedef ::std::vector< EscherConnectorListEntry* > EscherConnectorList_impl;
732 class MSFILTER_DLLPUBLIC EscherSolverContainer
734 EscherShapeList_impl maShapeList;
735 EscherConnectorList_impl maConnectorList;
737 public:
739 sal_uInt32 GetShapeId(
740 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rShape
741 ) const;
743 void AddShape(
744 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &,
745 sal_uInt32 nId
748 void AddConnector(
749 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &,
750 const ::com::sun::star::awt::Point& rA,
751 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &,
752 const ::com::sun::star::awt::Point& rB,
753 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rConB
756 void WriteSolver( SvStream& );
758 EscherSolverContainer(){};
759 ~EscherSolverContainer();
764 #define ESCHER_CREATEPOLYGON_LINE 1
765 #define ESCHER_CREATEPOLYGON_POLYLINE 2
766 #define ESCHER_CREATEPOLYGON_POLYPOLYGON 4
768 class GraphicAttr;
769 class SdrObjCustomShape;
771 struct EscherPropSortStruct
773 sal_uInt8* pBuf;
774 sal_uInt32 nPropSize;
775 sal_uInt32 nPropValue;
776 sal_uInt16 nPropId;
779 typedef std::vector< EscherPropSortStruct > EscherProperties;
781 class MSFILTER_DLLPUBLIC EscherPropertyContainer
783 EscherGraphicProvider* pGraphicProvider;
784 SvStream* pPicOutStrm;
785 Rectangle* pShapeBoundRect;
787 EscherPropSortStruct* pSortStruct;
789 sal_uInt32 nSortCount;
790 sal_uInt32 nSortBufSize;
791 sal_uInt32 nCountCount;
792 sal_uInt32 nCountSize;
794 bool bHasComplexData;
797 static sal_uInt32 ImplGetColor( const sal_uInt32 rColor, bool bSwap = true );
798 void ImplCreateGraphicAttributes(
799 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
800 sal_uInt32 nBlibId,
801 bool bCreateCroppingAttributes
803 bool ImplCreateEmbeddedBmp( const OString& rUniqueId );
804 void ImplInit();
806 public:
808 EscherPropertyContainer();
809 EscherPropertyContainer(
810 EscherGraphicProvider& rGraphicProvider, // the PropertyContainer needs to know
811 SvStream* pPicOutStrm, // the GraphicProvider to be able to write
812 Rectangle& rShapeBoundRect // FillBitmaps or GraphicObjects.
813 ); // under some circumstances the ShapeBoundRect
814 // is adjusted this will happen when rotated
815 // GraphicObjects are saved to PowerPoint
816 ~EscherPropertyContainer();
818 void AddOpt( sal_uInt16 nPropertyID, const OUString& rString );
820 void AddOpt(
821 sal_uInt16 nPropertyID,
822 sal_uInt32 nPropValue,
823 bool bBlib = false
826 void AddOpt(
827 sal_uInt16 nPropertyID,
828 bool bBlib,
829 sal_uInt32 nPropValue,
830 sal_uInt8* pProp,
831 sal_uInt32 nPropSize
834 bool GetOpt( sal_uInt16 nPropertyID, sal_uInt32& rPropValue ) const;
836 bool GetOpt( sal_uInt16 nPropertyID, EscherPropSortStruct& rPropValue ) const;
838 EscherProperties GetOpts() const;
840 void Commit( SvStream& rSt, sal_uInt16 nVersion = 3, sal_uInt16 nRecType = ESCHER_OPT );
842 bool CreateShapeProperties(
843 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape
845 bool CreateOLEGraphicProperties(
846 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXOleObject
848 bool CreateGraphicProperties(
849 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape,
850 const GraphicObject& rGraphicObj
852 bool CreateMediaGraphicProperties(
853 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXMediaObject
856 /** Creates a complex ESCHER_Prop_fillBlip containing the BLIP directly (for Excel charts). */
857 bool CreateEmbeddedBitmapProperties(
858 const OUString& rBitmapUrl,
859 ::com::sun::star::drawing::BitmapMode eBitmapMode
861 /** Creates a complex ESCHER_Prop_fillBlip containing a hatch style (for Excel charts). */
862 bool CreateEmbeddedHatchProperties(
863 const ::com::sun::star::drawing::Hatch& rHatch,
864 const Color& rBackColor,
865 bool bFillBackground
868 // the GraphicProperties will only be created if a GraphicProvider and PicOutStrm is known
869 // DR: #99897# if no GraphicProvider is present, a complex ESCHER_Prop_fillBlip
870 // will be created, containing the BLIP directly (e.g. for Excel charts).
871 bool CreateGraphicProperties(
872 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
873 const OUString& rSource,
874 const bool bCreateFillBitmap,
875 const bool bCreateCroppingAttributes = false,
876 const bool bFillBitmapModeAllowed = true,
877 const bool bOOxmlExport = false
880 bool CreateBlipPropertiesforOLEControl( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape);
882 bool CreatePolygonProperties(
883 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
884 sal_uInt32 nFlags,
885 bool bBezier,
886 ::com::sun::star::awt::Rectangle& rGeoRect,
887 Polygon* pPolygon = NULL
890 static sal_uInt32 GetGradientColor(
891 const ::com::sun::star::awt::Gradient* pGradient,
892 sal_uInt32 nStartColor
895 void CreateGradientProperties( const ::com::sun::star::awt::Gradient & rGradient );
896 void CreateGradientProperties(
897 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
898 bool bTransparentGradient = false
901 void CreateLineProperties(
902 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
903 bool bEdge
905 void CreateFillProperties(
906 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
907 bool bEdge,
908 bool bTransparentGradient = false );
909 void CreateFillProperties(
910 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
911 bool bEdge,
912 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape );
913 void CreateTextProperties(
914 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
915 sal_uInt32 nText,
916 const bool bIsCustomShape = false,
917 const bool bIsTextFrame = true
920 bool CreateConnectorProperties(
921 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape,
922 EscherSolverContainer& rSolver,
923 ::com::sun::star::awt::Rectangle& rGeoRect,
924 sal_uInt16& rShapeType,
925 sal_uInt16& rShapeFlags
928 // Because shadow properties depends to the line and fillstyle, the CreateShadowProperties method should be called at last.
929 // It activ only when at least a FillStyle or LineStyle is set.
930 bool CreateShadowProperties(
931 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &
934 sal_Int32 GetValueForEnhancedCustomShapeParameter( const ::com::sun::star::drawing::EnhancedCustomShapeParameter& rParameter,
935 const std::vector< sal_Int32 >& rEquationOrder, bool bAdjustTrans = false );
936 // creates all necessary CustomShape properties, this includes also Text-, Shadow-, Fill-, and LineProperties
937 void CreateCustomShapeProperties(
938 const MSO_SPT eShapeType,
939 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &
941 bool IsFontWork() const;
943 // helper functions which are also used by the escher import
944 static tools::PolyPolygon GetPolyPolygon(
945 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape
947 static tools::PolyPolygon GetPolyPolygon( const ::com::sun::star::uno::Any& rSource );
948 static MSO_SPT GetCustomShapeType(
949 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape,
950 sal_uInt32& nMirrorFlags
952 static MSO_SPT GetCustomShapeType(
953 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape,
954 sal_uInt32& nMirrorFlags,
955 OUString& rShapeType,
956 bool bOOXML = false
959 // helper functions which are also used in ooxml export
960 static bool GetLineArrow(
961 const bool bLineStart,
962 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
963 ESCHER_LineEnd& reLineEnd,
964 sal_Int32& rnArrowLength,
965 sal_Int32& rnArrowWidth
967 static bool IsDefaultObject( SdrObjCustomShape* pCustoShape, const MSO_SPT eShapeType );
968 static void LookForPolarHandles(
969 const MSO_SPT eShapeType,
970 sal_Int32& nAdjustmentsWhichNeedsToBeConverted
972 static bool GetAdjustmentValue( const com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue & rkProp, sal_Int32 nIndex, sal_Int32 nAdjustmentsWhichNeedsToBeConverted, sal_Int32& nValue );
977 typedef ::std::vector< EscherPersistEntry* > EscherPersistTable_impl;
979 class MSFILTER_DLLPUBLIC EscherPersistTable
982 public:
983 EscherPersistTable_impl maPersistTable;
985 bool PtIsID( sal_uInt32 nID );
986 void PtInsert( sal_uInt32 nID, sal_uInt32 nOfs );
987 sal_uInt32 PtDelete( sal_uInt32 nID );
988 sal_uInt32 PtGetOffsetByID( sal_uInt32 nID );
989 sal_uInt32 PtReplace( sal_uInt32 nID, sal_uInt32 nOfs );
990 sal_uInt32 PtReplaceOrInsert( sal_uInt32 nID, sal_uInt32 nOfs );
991 sal_uInt32 PtGetCount() const { return maPersistTable.size(); };
993 EscherPersistTable();
994 virtual ~EscherPersistTable();
999 class EscherEx;
1001 /// abstract base class for ESCHER_ClientTextbox, ESCHER_ClientData
1002 class MSFILTER_DLLPUBLIC EscherExClientRecord_Base
1004 public:
1005 EscherExClientRecord_Base() {}
1006 virtual ~EscherExClientRecord_Base();
1008 /// Application writes the record header
1009 /// using rEx.AddAtom(...) followed by
1010 /// record data written to rEx.GetStream()
1011 virtual void WriteData( EscherEx& rEx ) const = 0;
1015 /// abstract base class for ESCHER_ClientAnchor
1016 class MSFILTER_DLLPUBLIC EscherExClientAnchor_Base
1018 public:
1019 EscherExClientAnchor_Base() {}
1020 virtual ~EscherExClientAnchor_Base();
1022 /// Application writes the record header
1023 /// using rEx.AddAtom(...) followed by
1024 /// record data written to rEx.GetStream()
1025 virtual void WriteData( EscherEx& rEx,
1026 const Rectangle& rRect ) = 0;
1029 class InteractionInfo
1031 bool mbHasInteraction;
1032 std::unique_ptr<SvMemoryStream> mpHyperlinkRecord;
1033 InteractionInfo();
1035 public:
1036 InteractionInfo( SvMemoryStream* pStream, bool bInteraction ) : mbHasInteraction( bInteraction )
1038 mpHyperlinkRecord.reset( pStream );
1040 bool hasInteraction() { return mbHasInteraction; }
1041 const std::unique_ptr< SvMemoryStream >& getHyperlinkRecord() { return mpHyperlinkRecord; }
1044 class EscherExHostAppData
1046 private:
1047 EscherExClientAnchor_Base* pClientAnchor;
1048 EscherExClientRecord_Base* pClientData;
1049 EscherExClientRecord_Base* pClientTextbox;
1050 InteractionInfo* pInteractionInfo;
1051 // ignore single shape if entire pages are written
1052 bool bDontWriteShape;
1054 public:
1055 EscherExHostAppData() : pClientAnchor(0), pClientData(0),
1056 pClientTextbox(0), pInteractionInfo(0), bDontWriteShape(false)
1059 void SetInteractionInfo( InteractionInfo* p )
1060 { pInteractionInfo = p; }
1061 void SetClientAnchor( EscherExClientAnchor_Base* p )
1062 { pClientAnchor = p; }
1063 void SetClientData( EscherExClientRecord_Base* p )
1064 { pClientData = p; }
1065 void SetClientTextbox( EscherExClientRecord_Base* p )
1066 { pClientTextbox = p; }
1067 void SetDontWriteShape( bool b )
1068 { bDontWriteShape = b; }
1069 InteractionInfo* GetInteractionInfo() const
1070 { return pInteractionInfo; }
1071 EscherExClientAnchor_Base* GetClientAnchor() const
1072 { return pClientAnchor; }
1073 EscherExClientRecord_Base* GetClientData() const
1074 { return pClientData; }
1075 EscherExClientRecord_Base* GetClientTextbox() const
1076 { return pClientTextbox; }
1078 void WriteClientAnchor( EscherEx& rEx, const Rectangle& rRect )
1079 { if( pClientAnchor ) pClientAnchor->WriteData( rEx, rRect ); }
1080 void WriteClientData( EscherEx& rEx )
1081 { if( pClientData ) pClientData->WriteData( rEx ); }
1082 void WriteClientTextbox( EscherEx& rEx )
1083 { if( pClientTextbox ) pClientTextbox->WriteData( rEx ); }
1085 bool DontWriteShape() const { return bDontWriteShape; }
1091 /** Instance for global DFF data, shared through various instances of EscherEx. */
1092 class MSFILTER_DLLPUBLIC EscherExGlobal : public EscherGraphicProvider
1094 public:
1095 explicit EscherExGlobal( sal_uInt32 nGraphicProvFlags = _E_GRAPH_PROV_DO_NOT_ROTATE_METAFILES );
1096 virtual ~EscherExGlobal();
1098 /** Returns a new drawing ID for a new drawing container (DGCONTAINER). */
1099 sal_uInt32 GenerateDrawingId();
1100 /** Creates and returns a new shape identifier, updates the internal shape
1101 counters and registers the identifier in the DGG cluster table.
1102 @param nDrawingId Drawing identifier has to be passed to be able to
1103 generate shape identifiers for multiple drawings simultaniously. */
1104 sal_uInt32 GenerateShapeId( sal_uInt32 nDrawingId, bool bIsInSpgr );
1105 /** Returns the number of shapes in the current drawing, based on number of
1106 calls to the GenerateShapeId() function. */
1107 sal_uInt32 GetDrawingShapeCount( sal_uInt32 nDrawingId ) const;
1108 /** Returns the last shape identifier generated by the GenerateShapeId()
1109 function. */
1110 sal_uInt32 GetLastShapeId( sal_uInt32 nDrawingId ) const;
1112 /** Sets the flag indicating that the DGGCONTAINER exists. */
1113 inline void SetDggContainer() { mbHasDggCont = true; }
1114 /** Sets the flag indicating that the DGGCONTAINER exists. */
1115 inline bool HasDggContainer() const { return mbHasDggCont; }
1116 /** Returns the total size of the DGG atom (including header). */
1117 sal_uInt32 GetDggAtomSize() const;
1118 /** Writes the complete DGG atom to the passed stream (overwrites existing data!). */
1119 void WriteDggAtom( SvStream& rStrm ) const;
1121 /** Called if a picture shall be written and no picture stream is set at
1122 class ImplEscherExSdr.
1124 On first invokation, this function calls the virtual member function
1125 ImplQueryPictureStream(). The return value will be cached internally
1126 for subsequent calls and for the GetPictureStream() function.
1128 SvStream* QueryPictureStream();
1130 /** Returns the picture stream if existing (queried), otherwise null. */
1131 inline SvStream* GetPictureStream() { return mpPicStrm; }
1133 private:
1134 /** Derived classes may implement to create a new stream used to store the
1135 picture data.
1137 The implementation has to take care about lifetime of the returned
1138 stream (it will not be destructed automatically). This function is
1139 called exactly once. The return value will be cached internally for
1140 repeated calls of the public QueryPictureStream() function.
1142 virtual SvStream* ImplQueryPictureStream();
1144 private:
1145 struct ClusterEntry
1147 sal_uInt32 mnDrawingId; /// Identifier of drawing this cluster belongs to (one-based index into maDrawingInfos).
1148 sal_uInt32 mnNextShapeId; /// Next free shape identifier in this cluster.
1149 inline explicit ClusterEntry( sal_uInt32 nDrawingId ) : mnDrawingId( nDrawingId ), mnNextShapeId( 0 ) {}
1151 typedef ::std::vector< ClusterEntry > ClusterTable;
1153 struct DrawingInfo
1155 sal_uInt32 mnClusterId; /// Currently used cluster (one-based index into maClusterTable).
1156 sal_uInt32 mnShapeCount; /// Current number of shapes in this drawing.
1157 sal_uInt32 mnLastShapeId; /// Last shape identifier generated for this drawing.
1158 inline explicit DrawingInfo( sal_uInt32 nClusterId ) : mnClusterId( nClusterId ), mnShapeCount( 0 ), mnLastShapeId( 0 ) {}
1160 typedef ::std::vector< DrawingInfo > DrawingInfoVector;
1162 ClusterTable maClusterTable; /// List with cluster IDs (used object IDs in drawings).
1163 DrawingInfoVector maDrawingInfos; /// Data about all used drawings.
1164 SvStream* mpPicStrm; /// Cached result of ImplQueryPictureStream().
1165 bool mbHasDggCont; /// True = the DGGCONTAINER has been initialized.
1166 bool mbPicStrmQueried; /// True = ImplQueryPictureStream() has been called.
1169 typedef std::shared_ptr< EscherExGlobal > EscherExGlobalRef;
1171 class SdrObject;
1172 class SdrPage;
1173 class ImplEscherExSdr;
1175 class MSFILTER_DLLPUBLIC EscherEx : public EscherPersistTable
1177 protected:
1178 typedef ::std::unique_ptr< ImplEscherExSdr > ImplEscherExSdrPtr;
1180 EscherExGlobalRef mxGlobal;
1181 ImplEscherExSdrPtr mpImplEscherExSdr;
1182 SvStream* mpOutStrm;
1183 bool mbOwnsStrm;
1184 sal_uInt32 mnStrmStartOfs;
1185 std::vector< sal_uInt32 > mOffsets;
1186 std::vector< sal_uInt16 > mRecTypes;
1188 sal_uInt32 mnCurrentDg;
1189 sal_uInt32 mnCountOfs;
1191 sal_uInt32 mnGroupLevel;
1192 sal_uInt16 mnHellLayerId;
1194 bool mbEscherSpgr;
1195 bool mbEscherDg;
1196 bool mbOleEmf; // OLE is EMF instead of WMF
1197 bool mbOOXML;
1198 OUString mEditAs;
1201 bool DoSeek( sal_uInt32 nKey );
1203 public:
1204 explicit EscherEx( const EscherExGlobalRef& rxGlobal, SvStream* pOutStrm, bool bOOXML = false );
1205 virtual ~EscherEx();
1207 /** Creates and returns a new shape identifier, updates the internal shape
1208 counters and registers the identifier in the DGG cluster table. */
1209 inline sal_uInt32 GenerateShapeId() { return mxGlobal->GenerateShapeId( mnCurrentDg, mbEscherSpgr ); }
1211 /** Returns the graphic provider from the global object that has been
1212 passed to the constructor.
1214 EscherGraphicProvider& GetGraphicProvider() { return *mxGlobal; }
1216 /** Called if a picture shall be written and no picture stream is set at
1217 class ImplEscherExSdr.
1219 inline SvStream* QueryPictureStream() { return mxGlobal->QueryPictureStream(); }
1221 /// Inserts internal data into the EscherStream, this process
1222 /// may and has to be executed only once
1223 /// If pPicStreamMergeBSE is known, the BLIPs from this stream are being
1224 /// merged into the MsofbtBSE Records of the EscherStream like it's
1225 /// required for Excel (and maybe Word?)
1226 void Flush( SvStream* pPicStreamMergeBSE = NULL );
1228 /** Inserts the passed number of bytes at the current position of the
1229 output stream.
1231 Inserts dummy bytes and moves all following stream data, and updates
1232 all internal stream offsets stored in the PersistTable and the affected
1233 container sizes, which makes this operation very expensive. (!)
1235 @param nBytes The number of bytes to be inserted into the stream.
1237 @param bExpandEndOfAtom If set to true, an atom that currently ends
1238 exactly at the current stream position will be expanded to include
1239 the inserted data. If set to false, an atom that currently ends
1240 exactly at the current stream position will not be expanded to
1241 include the inserted data (used to insert e.g. a new atom after an
1242 existing atom). Note that containers that end exactly at the
1243 current stream position are always expanded to include the inserted
1244 data.
1246 void InsertAtCurrentPos( sal_uInt32 nBytes, bool bExpandEndOfAtom );
1248 void InsertPersistOffset( sal_uInt32 nKey, sal_uInt32 nOffset ); // It is not being checked if this key is already in the PersistantTable
1249 void ReplacePersistOffset( sal_uInt32 nKey, sal_uInt32 nOffset );
1250 sal_uInt32 GetPersistOffset( sal_uInt32 nKey );
1251 bool SeekToPersistOffset( sal_uInt32 nKey );
1252 bool InsertAtPersistOffset( sal_uInt32 nKey, sal_uInt32 nValue ); // nValue is being inserted into the Stream where it's appropriate (overwrite modus), without that the
1253 // current StreamPosition changes
1254 void SetEditAs( const OUString& rEditAs );
1255 rtl::OUString GetEditAs() { return mEditAs; }
1256 SvStream& GetStream() const { return *mpOutStrm; }
1257 sal_uLong GetStreamPos() const { return mpOutStrm->Tell(); }
1259 // features during the creation of the following Containers:
1261 // ESCHER_DggContainer: a EscherDgg Atom is automatically being created and managed
1262 // ESCHER_DgContainer: a EscherDg Atom is automatically being created and managed
1263 // ESCHER_SpgrContainer:
1264 // ESCHER_SpContainer:
1266 virtual void OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance = 0 );
1267 virtual void CloseContainer();
1269 void BeginAtom();
1270 void EndAtom( sal_uInt16 nRecType, int nRecVersion = 0, int nRecInstance = 0 );
1271 void AddAtom( sal_uInt32 nAtomSitze, sal_uInt16 nRecType, int nRecVersion = 0, int nRecInstance = 0 );
1272 void AddChildAnchor( const Rectangle& rRectangle );
1273 void AddClientAnchor( const Rectangle& rRectangle );
1275 virtual sal_uInt32 EnterGroup( const OUString& rShapeName, const Rectangle* pBoundRect = 0 );
1276 sal_uInt32 EnterGroup( const Rectangle* pBoundRect = NULL );
1277 sal_uInt32 GetGroupLevel() const { return mnGroupLevel; };
1278 bool SetGroupSnapRect( sal_uInt32 nGroupLevel, const Rectangle& rRect );
1279 bool SetGroupLogicRect( sal_uInt32 nGroupLevel, const Rectangle& rRect );
1280 virtual void LeaveGroup();
1282 // a ESCHER_Sp is being written ( a ESCHER_DgContainer has to be opened for this purpose!)
1283 virtual void AddShape( sal_uInt32 nShpInstance, sal_uInt32 nFlagIds, sal_uInt32 nShapeID = 0 );
1285 virtual void Commit( EscherPropertyContainer& rProps, const Rectangle& rRect);
1287 static sal_uInt32 GetColor( const sal_uInt32 nColor, bool bSwap = true );
1288 static sal_uInt32 GetColor( const Color& rColor, bool bSwap = true );
1290 // ...Sdr... implemented in eschesdo.cxx
1292 void AddSdrPage( const SdrPage& rPage );
1293 void AddUnoShapes( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes );
1295 /// returns the ShapeID
1296 sal_uInt32 AddSdrObject( const SdrObject& rObj, bool ooxmlExport = false );
1297 virtual void AddSdrObjectVMLObject( const SdrObject& /*rObj*/)
1299 // Required for Exporting VML shape
1302 /// If objects are written through AddSdrObject the
1303 /// SolverContainer has to be written, and maybe some
1304 /// maintenance to be done.
1305 void EndSdrObjectPage();
1307 /// Called before a shape is written, application supplies
1308 /// ClientRecords. May set AppData::bDontWriteShape so the
1309 /// shape is ignored.
1310 virtual EscherExHostAppData* StartShape(
1311 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rShape,
1312 const Rectangle* pChildAnchor );
1314 /// Called after a shape is written to inform the application
1315 /// of the resulted shape type and ID.
1316 virtual void EndShape( sal_uInt16 nShapeType, sal_uInt32 nShapeID );
1318 /// Called before an AdditionalText EnterGroup occurs.
1319 /// The current shape will be written in three parts:
1320 /// a group shape, the shape itself, and an extra textbox shape.
1321 /// The complete flow is:
1322 /// StartShape sets HostData1.
1323 /// EnterAdditionalTextGroup sets HostData2, App may modify
1324 /// HostData1 and keep track of the change.
1325 /// The group shape is written with HostData2.
1326 /// Another StartShape with the same (!) object sets HostData3.
1327 /// The current shape is written with HostData3.
1328 /// EndShape is called for the current shape.
1329 /// Another StartShape with the same (!) object sets HostData4.
1330 /// The textbox shape is written with HostData4.
1331 /// EndShape is called for the textbox shape.
1332 /// EndShape is called for the group shape, this provides
1333 /// the same functionality as an ordinary recursive group.
1334 virtual EscherExHostAppData* EnterAdditionalTextGroup();
1336 /// Called if an ESCHER_Prop_lTxid shall be written
1337 virtual sal_uInt32 QueryTextID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >&, sal_uInt32 nShapeId );
1338 // add an dummy rectangle shape into the escher stream
1339 sal_uInt32 AddDummyShape();
1341 static const SdrObject* GetSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rXShape );
1343 void SetHellLayerId( sal_uInt16 nId ) { mnHellLayerId = nId; }
1344 sal_uInt16 GetHellLayerId() const { return mnHellLayerId; }
1346 private:
1347 EscherEx( const EscherEx& ) SAL_DELETED_FUNCTION;
1348 EscherEx& operator=( const EscherEx& ) SAL_DELETED_FUNCTION;
1350 // prevent C-style cast to former base class EscherGraphicProvider
1351 operator EscherGraphicProvider&();
1352 operator EscherGraphicProvider const&();
1356 #endif
1358 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */