Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_FILTER_MSFILTER_ESCHEREX_HXX
21 : #define INCLUDED_FILTER_MSFILTER_ESCHEREX_HXX
22 :
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>
41 :
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 */
51 :
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
66 :
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 */
73 :
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
94 :
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
107 : };
108 :
109 : enum ESCHER_FillStyle
110 : {
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
121 : };
122 :
123 : enum ESCHER_wMode
124 : {
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
136 : };
137 :
138 :
139 :
140 : enum ESCHER_ShapePath
141 : {
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
147 : };
148 :
149 :
150 : enum ESCHER_WrapMode
151 : {
152 : ESCHER_WrapSquare,
153 : ESCHER_WrapByPoints,
154 : ESCHER_WrapNone,
155 : ESCHER_WrapTopBottom,
156 : ESCHER_WrapThrough
157 : };
158 :
159 :
160 : enum ESCHER_bwMode
161 : {
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
174 : };
175 :
176 :
177 : enum ESCHER_AnchorText
178 : {
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
189 : };
190 :
191 : enum ESCHER_cDir
192 : {
193 : ESCHER_cDir0, // Right
194 : ESCHER_cDir90, // Down
195 : ESCHER_cDir180, // Left
196 : ESCHER_cDir270 // Up
197 : };
198 :
199 : // connector style
200 : enum ESCHER_cxSTYLE
201 : {
202 : ESCHER_cxstyleStraight = 0,
203 : ESCHER_cxstyleBent,
204 : ESCHER_cxstyleCurved,
205 : ESCHER_cxstyleNone
206 : };
207 :
208 : // text flow
209 : enum ESCHER_txfl
210 : {
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-@
217 : };
218 :
219 : // text direction (needed for Bi-Di support)
220 : enum ESCHER_txDir
221 : {
222 : ESCHER_txdirLTR, // left-to-right text direction
223 : ESCHER_txdirRTL, // right-to-left text direction
224 : ESCHER_txdirContext // context text direction
225 : };
226 :
227 : // Callout Type
228 : enum ESCHER_spcot
229 : {
230 : ESCHER_spcotRightAngle = 1,
231 : ESCHER_spcotOneSegment = 2,
232 : ESCHER_spcotTwoSegment = 3,
233 : ESCHER_spcotThreeSegment= 4
234 : };
235 :
236 : // Callout Angle
237 : enum ESCHER_spcoa
238 : {
239 : ESCHER_spcoaAny,
240 : ESCHER_spcoa30,
241 : ESCHER_spcoa45,
242 : ESCHER_spcoa60,
243 : ESCHER_spcoa90,
244 : ESCHER_spcoa0
245 : };
246 :
247 : // Callout Drop
248 : enum ESCHER_spcod
249 : {
250 : ESCHER_spcodTop,
251 : ESCHER_spcodCenter,
252 : ESCHER_spcodBottom,
253 : ESCHER_spcodSpecified
254 : };
255 :
256 : // FontWork alignment
257 : enum ESCHER_GeoTextAlign
258 : {
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
266 : };
267 :
268 : // flags for pictures
269 : enum ESCHER_BlipFlags
270 : {
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
279 : };
280 :
281 :
282 : enum ESCHER_3DRenderMode
283 : {
284 : ESCHER_FullRender, // Generate a full rendering
285 : ESCHER_Wireframe, // Generate a wireframe
286 : ESCHER_BoundingCube // Generate a bounding cube
287 : };
288 :
289 :
290 : enum ESCHER_xFormType
291 : {
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
295 : };
296 :
297 :
298 : enum ESCHER_ShadowType
299 : {
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
306 : };
307 :
308 : // - the type of a (length) measurement
309 : enum ESCHER_dzType
310 : {
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
325 : };
326 :
327 : // how to interpret the colors in a shaded fill.
328 : enum ESCHER_ShadeType
329 : {
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
335 :
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,
344 :
345 : ESCHER_ShadeDefault = (ESCHER_ShadeGamma|ESCHER_ShadeSigma|
346 : (16384<<ESCHER_ShadeParameterShift))
347 : };
348 :
349 : // compound line style
350 : enum ESCHER_LineStyle
351 : {
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
357 : };
358 :
359 : // how to "fill" the line contour
360 : enum ESCHER_LineType
361 : {
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
366 : };
367 :
368 : // dashed line style
369 : enum ESCHER_LineDashing
370 : {
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
382 : };
383 :
384 : // line end effect
385 : enum ESCHER_LineEnd
386 : {
387 : ESCHER_LineNoEnd,
388 : ESCHER_LineArrowEnd,
389 : ESCHER_LineArrowStealthEnd,
390 : ESCHER_LineArrowDiamondEnd,
391 : ESCHER_LineArrowOvalEnd,
392 : ESCHER_LineArrowOpenEnd
393 : };
394 :
395 : // size of arrowhead
396 : enum ESCHER_LineWidth
397 : {
398 : ESCHER_LineNarrowArrow,
399 : ESCHER_LineMediumWidthArrow,
400 : ESCHER_LineWideArrow
401 : };
402 :
403 : // size of arrowhead
404 : enum ESCHER_LineEndLength
405 : {
406 : ESCHER_LineShortArrow,
407 : ESCHER_LineMediumLenArrow,
408 : ESCHER_LineLongArrow
409 : };
410 :
411 : // line join style.
412 : enum ESCHER_LineJoin
413 : {
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
417 : };
418 :
419 : // line cap style (applies to ends of dash segments too).
420 : enum ESCHER_LineCap
421 : {
422 : ESCHER_LineEndCapRound, // Rounded ends - the default
423 : ESCHER_LineEndCapSquare, // Square protrudes by half line width
424 : ESCHER_LineEndCapFlat // Line ends at end point
425 : };
426 :
427 : enum MSOPATHTYPE
428 : {
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
437 : };
438 :
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 */
548 :
549 :
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
556 :
557 : const sal_uInt32 DFF_DGG_CLUSTER_SIZE = 0x00000400; /// Shape IDs per cluster in DGG atom.
558 :
559 :
560 :
561 : namespace com { namespace sun { namespace star {
562 : namespace awt {
563 : struct Gradient;
564 : }
565 : namespace drawing {
566 : struct EnhancedCustomShapeAdjustmentValue;
567 : class XShape;
568 : class XShapes;
569 : }
570 : }}}
571 :
572 27 : struct MSFILTER_DLLPUBLIC EscherConnectorListEntry
573 : {
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;
579 :
580 : sal_uInt32 GetConnectorRule( bool bFirst );
581 :
582 27 : 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 27 : mXConnectToB( rSB ) {}
592 :
593 : static sal_uInt32 GetClosestPoint( const Polygon& rPoly, const ::com::sun::star::awt::Point& rP );
594 : };
595 :
596 : struct MSFILTER_DLLPUBLIC EscherExContainer
597 : {
598 : sal_uInt32 nContPos;
599 : SvStream& rStrm;
600 :
601 : EscherExContainer( SvStream& rSt, const sal_uInt16 nRecType, const sal_uInt16 nInstance = 0 );
602 : ~EscherExContainer();
603 : };
604 :
605 : struct MSFILTER_DLLPUBLIC EscherExAtom
606 : {
607 : sal_uInt32 nContPos;
608 : SvStream& rStrm;
609 :
610 : EscherExAtom( SvStream& rSt, const sal_uInt16 nRecType, const sal_uInt16 nInstance = 0, const sal_uInt8 nVersion = 0 );
611 : ~EscherExAtom();
612 : };
613 :
614 : struct EscherPropertyValueHelper
615 : {
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
621 : );
622 :
623 : static ::com::sun::star::beans::PropertyState GetPropertyState(
624 : const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > &,
625 : const OUString& rPropertyName
626 : );
627 : };
628 :
629 :
630 :
631 : struct EscherPersistEntry
632 : {
633 : sal_uInt32 mnID;
634 : sal_uInt32 mnOffset;
635 :
636 796 : EscherPersistEntry( sal_uInt32 nId, sal_uInt32 nOffset ) { mnID = nId; mnOffset = nOffset; };
637 :
638 : };
639 :
640 :
641 :
642 : class EscherBlibEntry
643 : {
644 :
645 : friend class EscherGraphicProvider;
646 : friend class EscherEx;
647 :
648 : protected:
649 :
650 : sal_uInt32 mnIdentifier[ 4 ];
651 : sal_uInt32 mnPictureOffset; // offset to the graphic im PictureStreams
652 : sal_uInt32 mnSize; // size of real graphic
653 :
654 : sal_uInt32 mnRefCount; // !! reference count
655 : sal_uInt32 mnSizeExtra; // !! size of preceding header
656 :
657 : ESCHER_BlibType meBlibType;
658 :
659 : Size maPrefSize;
660 : MapMode maPrefMapMode;
661 :
662 : bool mbIsEmpty;
663 : bool mbIsNativeGraphicPossible;
664 :
665 : public:
666 :
667 : EscherBlibEntry(
668 : sal_uInt32 nPictureOffset,
669 : const GraphicObject& rObj,
670 : const OString& rId,
671 : const GraphicAttr* pAttr = NULL
672 : );
673 :
674 : ~EscherBlibEntry();
675 :
676 : void WriteBlibEntry( SvStream& rSt, bool bWritePictureOffset, sal_uInt32 nResize = 0 );
677 108 : bool IsEmpty() const { return mbIsEmpty; };
678 :
679 : bool operator==( const EscherBlibEntry& ) const;
680 : };
681 :
682 :
683 :
684 : #define _E_GRAPH_PROV_USE_INSTANCES 1
685 : #define _E_GRAPH_PROV_DO_NOT_ROTATE_METAFILES 2
686 :
687 : class MSFILTER_DLLPUBLIC EscherGraphicProvider
688 : {
689 : sal_uInt32 mnFlags;
690 :
691 : EscherBlibEntry** mpBlibEntrys;
692 : sal_uInt32 mnBlibBufSize;
693 : sal_uInt32 mnBlibEntrys;
694 :
695 : OUString maBaseURI;
696 :
697 : protected:
698 :
699 : sal_uInt32 ImplInsertBlib( EscherBlibEntry* p_EscherBlibEntry );
700 :
701 : public:
702 :
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
714 : );
715 79 : bool HasGraphics() const { return mnBlibEntrys != 0; };
716 :
717 : void SetNewBlipStreamOffset( sal_Int32 nOffset );
718 :
719 : bool GetPrefSize( const sal_uInt32 nBlibId, Size& rSize, MapMode& rMapMode );
720 :
721 75 : void SetBaseURI( const OUString& rBaseURI ) { maBaseURI = rBaseURI; };
722 5 : const OUString& GetBaseURI() { return maBaseURI; };
723 :
724 : EscherGraphicProvider( sal_uInt32 nFlags = _E_GRAPH_PROV_DO_NOT_ROTATE_METAFILES );
725 : virtual ~EscherGraphicProvider();
726 : };
727 :
728 : struct EscherShapeListEntry;
729 : typedef ::std::vector< EscherShapeListEntry* > EscherShapeList_impl;
730 : typedef ::std::vector< EscherConnectorListEntry* > EscherConnectorList_impl;
731 :
732 : class MSFILTER_DLLPUBLIC EscherSolverContainer
733 : {
734 : EscherShapeList_impl maShapeList;
735 : EscherConnectorList_impl maConnectorList;
736 :
737 : public:
738 :
739 : sal_uInt32 GetShapeId(
740 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rShape
741 : ) const;
742 :
743 : void AddShape(
744 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &,
745 : sal_uInt32 nId
746 : );
747 :
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
754 : );
755 :
756 : void WriteSolver( SvStream& );
757 :
758 286 : EscherSolverContainer(){};
759 : ~EscherSolverContainer();
760 : };
761 :
762 :
763 :
764 : #define ESCHER_CREATEPOLYGON_LINE 1
765 : #define ESCHER_CREATEPOLYGON_POLYLINE 2
766 : #define ESCHER_CREATEPOLYGON_POLYPOLYGON 4
767 :
768 : class GraphicAttr;
769 : class SdrObjCustomShape;
770 :
771 : struct EscherPropSortStruct
772 : {
773 : sal_uInt8* pBuf;
774 : sal_uInt32 nPropSize;
775 : sal_uInt32 nPropValue;
776 : sal_uInt16 nPropId;
777 : };
778 :
779 : typedef std::vector< EscherPropSortStruct > EscherProperties;
780 :
781 : class MSFILTER_DLLPUBLIC EscherPropertyContainer
782 : {
783 : EscherGraphicProvider* pGraphicProvider;
784 : SvStream* pPicOutStrm;
785 : Rectangle* pShapeBoundRect;
786 :
787 : sal_uInt32 nSortCount;
788 : sal_uInt32 nSortBufSize;
789 : sal_uInt32 nCountCount;
790 : sal_uInt32 nCountSize;
791 :
792 : EscherPropSortStruct* pSortStruct;
793 :
794 : bool bHasComplexData;
795 :
796 :
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
802 : );
803 : bool ImplCreateEmbeddedBmp( const OString& rUniqueId );
804 :
805 : SAL_DLLPRIVATE explicit EscherPropertyContainer(
806 : EscherGraphicProvider * pGraphProv, SvStream * pPiOutStrm,
807 : Rectangle * pBoundRect);
808 :
809 : public:
810 :
811 : EscherPropertyContainer();
812 : EscherPropertyContainer(
813 : EscherGraphicProvider& rGraphicProvider, // the PropertyContainer needs to know
814 : SvStream* pPicOutStrm, // the GraphicProvider to be able to write
815 : Rectangle& rShapeBoundRect // FillBitmaps or GraphicObjects.
816 : ); // under some circumstances the ShapeBoundRect
817 : // is adjusted this will happen when rotated
818 : // GraphicObjects are saved to PowerPoint
819 : ~EscherPropertyContainer();
820 :
821 : void AddOpt( sal_uInt16 nPropertyID, const OUString& rString );
822 :
823 : void AddOpt(
824 : sal_uInt16 nPropertyID,
825 : sal_uInt32 nPropValue,
826 : bool bBlib = false
827 : );
828 :
829 : void AddOpt(
830 : sal_uInt16 nPropertyID,
831 : bool bBlib,
832 : sal_uInt32 nPropValue,
833 : sal_uInt8* pProp,
834 : sal_uInt32 nPropSize
835 : );
836 :
837 : bool GetOpt( sal_uInt16 nPropertyID, sal_uInt32& rPropValue ) const;
838 :
839 : bool GetOpt( sal_uInt16 nPropertyID, EscherPropSortStruct& rPropValue ) const;
840 :
841 : EscherProperties GetOpts() const;
842 :
843 : void Commit( SvStream& rSt, sal_uInt16 nVersion = 3, sal_uInt16 nRecType = ESCHER_OPT );
844 :
845 : bool CreateShapeProperties(
846 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape
847 : );
848 : bool CreateOLEGraphicProperties(
849 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXOleObject
850 : );
851 : bool CreateGraphicProperties(
852 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape,
853 : const GraphicObject& rGraphicObj
854 : );
855 : bool CreateMediaGraphicProperties(
856 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXMediaObject
857 : );
858 :
859 : /** Creates a complex ESCHER_Prop_fillBlip containing the BLIP directly (for Excel charts). */
860 : bool CreateEmbeddedBitmapProperties(
861 : const OUString& rBitmapUrl,
862 : ::com::sun::star::drawing::BitmapMode eBitmapMode
863 : );
864 : /** Creates a complex ESCHER_Prop_fillBlip containing a hatch style (for Excel charts). */
865 : bool CreateEmbeddedHatchProperties(
866 : const ::com::sun::star::drawing::Hatch& rHatch,
867 : const Color& rBackColor,
868 : bool bFillBackground
869 : );
870 :
871 : // the GraphicProperties will only be created if a GraphicProvider and PicOutStrm is known
872 : // DR: #99897# if no GraphicProvider is present, a complex ESCHER_Prop_fillBlip
873 : // will be created, containing the BLIP directly (e.g. for Excel charts).
874 : bool CreateGraphicProperties(
875 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
876 : const OUString& rSource,
877 : const bool bCreateFillBitmap,
878 : const bool bCreateCroppingAttributes = false,
879 : const bool bFillBitmapModeAllowed = true,
880 : const bool bOOxmlExport = false
881 : );
882 :
883 : 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);
884 :
885 : bool CreatePolygonProperties(
886 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
887 : sal_uInt32 nFlags,
888 : bool bBezier,
889 : ::com::sun::star::awt::Rectangle& rGeoRect,
890 : Polygon* pPolygon = NULL
891 : );
892 :
893 : static sal_uInt32 GetGradientColor(
894 : const ::com::sun::star::awt::Gradient* pGradient,
895 : sal_uInt32 nStartColor
896 : );
897 :
898 : void CreateGradientProperties( const ::com::sun::star::awt::Gradient & rGradient );
899 : void CreateGradientProperties(
900 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
901 : bool bTransparentGradient = false
902 : );
903 :
904 : void CreateLineProperties(
905 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
906 : bool bEdge
907 : );
908 : void CreateFillProperties(
909 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
910 : bool bEdge,
911 : bool bTransparentGradient = false );
912 : void CreateFillProperties(
913 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
914 : bool bEdge,
915 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape );
916 : void CreateTextProperties(
917 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
918 : sal_uInt32 nText,
919 : const bool bIsCustomShape = false,
920 : const bool bIsTextFrame = true
921 : );
922 :
923 : bool CreateConnectorProperties(
924 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape,
925 : EscherSolverContainer& rSolver,
926 : ::com::sun::star::awt::Rectangle& rGeoRect,
927 : sal_uInt16& rShapeType,
928 : sal_uInt16& rShapeFlags
929 : );
930 :
931 : // Because shadow properties depends to the line and fillstyle, the CreateShadowProperties method should be called at last.
932 : // It activ only when at least a FillStyle or LineStyle is set.
933 : bool CreateShadowProperties(
934 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &
935 : );
936 :
937 : sal_Int32 GetValueForEnhancedCustomShapeParameter( const ::com::sun::star::drawing::EnhancedCustomShapeParameter& rParameter,
938 : const std::vector< sal_Int32 >& rEquationOrder, bool bAdjustTrans = false );
939 : // creates all necessary CustomShape properties, this includes also Text-, Shadow-, Fill-, and LineProperties
940 : void CreateCustomShapeProperties(
941 : const MSO_SPT eShapeType,
942 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &
943 : );
944 : bool IsFontWork() const;
945 :
946 : // helper functions which are also used by the escher import
947 : static tools::PolyPolygon GetPolyPolygon(
948 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape
949 : );
950 : static tools::PolyPolygon GetPolyPolygon( const ::com::sun::star::uno::Any& rSource );
951 : static MSO_SPT GetCustomShapeType(
952 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape,
953 : sal_uInt32& nMirrorFlags
954 : );
955 : static MSO_SPT GetCustomShapeType(
956 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape,
957 : sal_uInt32& nMirrorFlags,
958 : OUString& rShapeType,
959 : bool bOOXML = false
960 : );
961 :
962 : // helper functions which are also used in ooxml export
963 : static bool GetLineArrow(
964 : const bool bLineStart,
965 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
966 : ESCHER_LineEnd& reLineEnd,
967 : sal_Int32& rnArrowLength,
968 : sal_Int32& rnArrowWidth
969 : );
970 : static bool IsDefaultObject( SdrObjCustomShape* pCustoShape, const MSO_SPT eShapeType );
971 : static void LookForPolarHandles(
972 : const MSO_SPT eShapeType,
973 : sal_Int32& nAdjustmentsWhichNeedsToBeConverted
974 : );
975 : static bool GetAdjustmentValue( const com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue & rkProp, sal_Int32 nIndex, sal_Int32 nAdjustmentsWhichNeedsToBeConverted, sal_Int32& nValue );
976 : };
977 :
978 :
979 :
980 : typedef ::std::vector< EscherPersistEntry* > EscherPersistTable_impl;
981 :
982 : class MSFILTER_DLLPUBLIC EscherPersistTable
983 : {
984 :
985 : public:
986 : EscherPersistTable_impl maPersistTable;
987 :
988 : bool PtIsID( sal_uInt32 nID );
989 : void PtInsert( sal_uInt32 nID, sal_uInt32 nOfs );
990 : sal_uInt32 PtDelete( sal_uInt32 nID );
991 : sal_uInt32 PtGetOffsetByID( sal_uInt32 nID );
992 : sal_uInt32 PtReplace( sal_uInt32 nID, sal_uInt32 nOfs );
993 : sal_uInt32 PtReplaceOrInsert( sal_uInt32 nID, sal_uInt32 nOfs );
994 : sal_uInt32 PtGetCount() const { return maPersistTable.size(); };
995 :
996 : EscherPersistTable();
997 : virtual ~EscherPersistTable();
998 : };
999 :
1000 :
1001 :
1002 : class EscherEx;
1003 :
1004 : /// abstract base class for ESCHER_ClientTextbox, ESCHER_ClientData
1005 : class MSFILTER_DLLPUBLIC EscherExClientRecord_Base
1006 : {
1007 : public:
1008 88 : EscherExClientRecord_Base() {}
1009 : virtual ~EscherExClientRecord_Base();
1010 :
1011 : /// Application writes the record header
1012 : /// using rEx.AddAtom(...) followed by
1013 : /// record data written to rEx.GetStream()
1014 : virtual void WriteData( EscherEx& rEx ) const = 0;
1015 : };
1016 :
1017 :
1018 : /// abstract base class for ESCHER_ClientAnchor
1019 : class MSFILTER_DLLPUBLIC EscherExClientAnchor_Base
1020 : {
1021 : public:
1022 58 : EscherExClientAnchor_Base() {}
1023 : virtual ~EscherExClientAnchor_Base();
1024 :
1025 : /// Application writes the record header
1026 : /// using rEx.AddAtom(...) followed by
1027 : /// record data written to rEx.GetStream()
1028 : virtual void WriteData( EscherEx& rEx,
1029 : const Rectangle& rRect ) = 0;
1030 : };
1031 :
1032 3 : class InteractionInfo
1033 : {
1034 : bool mbHasInteraction;
1035 : std::unique_ptr<SvMemoryStream> mpHyperlinkRecord;
1036 : InteractionInfo();
1037 :
1038 : public:
1039 3 : InteractionInfo( SvMemoryStream* pStream, bool bInteraction ) : mbHasInteraction( bInteraction )
1040 : {
1041 3 : mpHyperlinkRecord.reset( pStream );
1042 3 : }
1043 3 : bool hasInteraction() { return mbHasInteraction; }
1044 3 : const std::unique_ptr< SvMemoryStream >& getHyperlinkRecord() { return mpHyperlinkRecord; }
1045 : };
1046 :
1047 : class EscherExHostAppData
1048 : {
1049 : private:
1050 : EscherExClientAnchor_Base* pClientAnchor;
1051 : EscherExClientRecord_Base* pClientData;
1052 : EscherExClientRecord_Base* pClientTextbox;
1053 : InteractionInfo* pInteractionInfo;
1054 : // ignore single shape if entire pages are written
1055 : bool bDontWriteShape;
1056 :
1057 : public:
1058 65 : EscherExHostAppData() : pClientAnchor(0), pClientData(0),
1059 65 : pClientTextbox(0), pInteractionInfo(0), bDontWriteShape(false)
1060 65 : {}
1061 :
1062 3 : void SetInteractionInfo( InteractionInfo* p )
1063 3 : { pInteractionInfo = p; }
1064 29 : void SetClientAnchor( EscherExClientAnchor_Base* p )
1065 29 : { pClientAnchor = p; }
1066 36 : void SetClientData( EscherExClientRecord_Base* p )
1067 36 : { pClientData = p; }
1068 9 : void SetClientTextbox( EscherExClientRecord_Base* p )
1069 9 : { pClientTextbox = p; }
1070 29 : void SetDontWriteShape( bool b )
1071 29 : { bDontWriteShape = b; }
1072 93 : InteractionInfo* GetInteractionInfo() const
1073 93 : { return pInteractionInfo; }
1074 58 : EscherExClientAnchor_Base* GetClientAnchor() const
1075 58 : { return pClientAnchor; }
1076 : EscherExClientRecord_Base* GetClientData() const
1077 : { return pClientData; }
1078 58 : EscherExClientRecord_Base* GetClientTextbox() const
1079 58 : { return pClientTextbox; }
1080 :
1081 35 : void WriteClientAnchor( EscherEx& rEx, const Rectangle& rRect )
1082 35 : { if( pClientAnchor ) pClientAnchor->WriteData( rEx, rRect ); }
1083 35 : void WriteClientData( EscherEx& rEx )
1084 35 : { if( pClientData ) pClientData->WriteData( rEx ); }
1085 35 : void WriteClientTextbox( EscherEx& rEx )
1086 35 : { if( pClientTextbox ) pClientTextbox->WriteData( rEx ); }
1087 :
1088 64 : bool DontWriteShape() const { return bDontWriteShape; }
1089 : };
1090 :
1091 :
1092 :
1093 :
1094 : /** Instance for global DFF data, shared through various instances of EscherEx. */
1095 : class MSFILTER_DLLPUBLIC EscherExGlobal : public EscherGraphicProvider
1096 : {
1097 : public:
1098 : explicit EscherExGlobal( sal_uInt32 nGraphicProvFlags = _E_GRAPH_PROV_DO_NOT_ROTATE_METAFILES );
1099 : virtual ~EscherExGlobal();
1100 :
1101 : /** Returns a new drawing ID for a new drawing container (DGCONTAINER). */
1102 : sal_uInt32 GenerateDrawingId();
1103 : /** Creates and returns a new shape identifier, updates the internal shape
1104 : counters and registers the identifier in the DGG cluster table.
1105 : @param nDrawingId Drawing identifier has to be passed to be able to
1106 : generate shape identifiers for multiple drawings simultaniously. */
1107 : sal_uInt32 GenerateShapeId( sal_uInt32 nDrawingId, bool bIsInSpgr );
1108 : /** Returns the number of shapes in the current drawing, based on number of
1109 : calls to the GenerateShapeId() function. */
1110 : sal_uInt32 GetDrawingShapeCount( sal_uInt32 nDrawingId ) const;
1111 : /** Returns the last shape identifier generated by the GenerateShapeId()
1112 : function. */
1113 : sal_uInt32 GetLastShapeId( sal_uInt32 nDrawingId ) const;
1114 :
1115 : /** Sets the flag indicating that the DGGCONTAINER exists. */
1116 82 : inline void SetDggContainer() { mbHasDggCont = true; }
1117 : /** Sets the flag indicating that the DGGCONTAINER exists. */
1118 216 : inline bool HasDggContainer() const { return mbHasDggCont; }
1119 : /** Returns the total size of the DGG atom (including header). */
1120 : sal_uInt32 GetDggAtomSize() const;
1121 : /** Writes the complete DGG atom to the passed stream (overwrites existing data!). */
1122 : void WriteDggAtom( SvStream& rStrm ) const;
1123 :
1124 : /** Called if a picture shall be written and no picture stream is set at
1125 : class ImplEscherExSdr.
1126 :
1127 : On first invokation, this function calls the virtual member function
1128 : ImplQueryPictureStream(). The return value will be cached internally
1129 : for subsequent calls and for the GetPictureStream() function.
1130 : */
1131 : SvStream* QueryPictureStream();
1132 :
1133 : /** Returns the picture stream if existing (queried), otherwise null. */
1134 80 : inline SvStream* GetPictureStream() { return mpPicStrm; }
1135 :
1136 : private:
1137 : /** Derived classes may implement to create a new stream used to store the
1138 : picture data.
1139 :
1140 : The implementation has to take care about lifetime of the returned
1141 : stream (it will not be destructed automatically). This function is
1142 : called exactly once. The return value will be cached internally for
1143 : repeated calls of the public QueryPictureStream() function.
1144 : */
1145 : virtual SvStream* ImplQueryPictureStream();
1146 :
1147 : private:
1148 : struct ClusterEntry
1149 : {
1150 : sal_uInt32 mnDrawingId; /// Identifier of drawing this cluster belongs to (one-based index into maDrawingInfos).
1151 : sal_uInt32 mnNextShapeId; /// Next free shape identifier in this cluster.
1152 153 : inline explicit ClusterEntry( sal_uInt32 nDrawingId ) : mnDrawingId( nDrawingId ), mnNextShapeId( 0 ) {}
1153 : };
1154 : typedef ::std::vector< ClusterEntry > ClusterTable;
1155 :
1156 : struct DrawingInfo
1157 : {
1158 : sal_uInt32 mnClusterId; /// Currently used cluster (one-based index into maClusterTable).
1159 : sal_uInt32 mnShapeCount; /// Current number of shapes in this drawing.
1160 : sal_uInt32 mnLastShapeId; /// Last shape identifier generated for this drawing.
1161 153 : inline explicit DrawingInfo( sal_uInt32 nClusterId ) : mnClusterId( nClusterId ), mnShapeCount( 0 ), mnLastShapeId( 0 ) {}
1162 : };
1163 : typedef ::std::vector< DrawingInfo > DrawingInfoVector;
1164 :
1165 : ClusterTable maClusterTable; /// List with cluster IDs (used object IDs in drawings).
1166 : DrawingInfoVector maDrawingInfos; /// Data about all used drawings.
1167 : SvStream* mpPicStrm; /// Cached result of ImplQueryPictureStream().
1168 : bool mbHasDggCont; /// True = the DGGCONTAINER has been initialized.
1169 : bool mbPicStrmQueried; /// True = ImplQueryPictureStream() has been called.
1170 : };
1171 :
1172 : typedef std::shared_ptr< EscherExGlobal > EscherExGlobalRef;
1173 :
1174 : class SdrObject;
1175 : class SdrPage;
1176 : class ImplEscherExSdr;
1177 :
1178 : class MSFILTER_DLLPUBLIC EscherEx : public EscherPersistTable
1179 : {
1180 : protected:
1181 : typedef ::std::unique_ptr< ImplEscherExSdr > ImplEscherExSdrPtr;
1182 :
1183 : EscherExGlobalRef mxGlobal;
1184 : ImplEscherExSdrPtr mpImplEscherExSdr;
1185 : SvStream* mpOutStrm;
1186 : bool mbOwnsStrm;
1187 : sal_uInt32 mnStrmStartOfs;
1188 : std::vector< sal_uInt32 > mOffsets;
1189 : std::vector< sal_uInt16 > mRecTypes;
1190 :
1191 : sal_uInt32 mnCurrentDg;
1192 : sal_uInt32 mnCountOfs;
1193 :
1194 : sal_uInt32 mnGroupLevel;
1195 : sal_uInt16 mnHellLayerId;
1196 :
1197 : bool mbEscherSpgr;
1198 : bool mbEscherDg;
1199 : bool mbOleEmf; // OLE is EMF instead of WMF
1200 : bool mbOOXML;
1201 : OUString mEditAs;
1202 :
1203 :
1204 : bool DoSeek( sal_uInt32 nKey );
1205 :
1206 : public:
1207 : explicit EscherEx( const EscherExGlobalRef& rxGlobal, SvStream* pOutStrm, bool bOOXML = false );
1208 : virtual ~EscherEx();
1209 :
1210 : /** Creates and returns a new shape identifier, updates the internal shape
1211 : counters and registers the identifier in the DGG cluster table. */
1212 1266 : inline sal_uInt32 GenerateShapeId() { return mxGlobal->GenerateShapeId( mnCurrentDg, mbEscherSpgr ); }
1213 :
1214 : /** Returns the graphic provider from the global object that has been
1215 : passed to the constructor.
1216 : */
1217 1001 : EscherGraphicProvider& GetGraphicProvider() { return *mxGlobal; }
1218 :
1219 : /** Called if a picture shall be written and no picture stream is set at
1220 : class ImplEscherExSdr.
1221 : */
1222 938 : inline SvStream* QueryPictureStream() { return mxGlobal->QueryPictureStream(); }
1223 :
1224 : /// Inserts internal data into the EscherStream, this process
1225 : /// may and has to be executed only once
1226 : /// If pPicStreamMergeBSE is known, the BLIPs from this stream are being
1227 : /// merged into the MsofbtBSE Records of the EscherStream like it's
1228 : /// required for Excel (and maybe Word?)
1229 : void Flush( SvStream* pPicStreamMergeBSE = NULL );
1230 :
1231 : /** Inserts the passed number of bytes at the current position of the
1232 : output stream.
1233 :
1234 : Inserts dummy bytes and moves all following stream data, and updates
1235 : all internal stream offsets stored in the PersistTable and the affected
1236 : container sizes, which makes this operation very expensive. (!)
1237 :
1238 : @param nBytes The number of bytes to be inserted into the stream.
1239 :
1240 : @param bExpandEndOfAtom If set to true, an atom that currently ends
1241 : exactly at the current stream position will be expanded to include
1242 : the inserted data. If set to false, an atom that currently ends
1243 : exactly at the current stream position will not be expanded to
1244 : include the inserted data (used to insert e.g. a new atom after an
1245 : existing atom). Note that containers that end exactly at the
1246 : current stream position are always expanded to include the inserted
1247 : data.
1248 : */
1249 : void InsertAtCurrentPos( sal_uInt32 nBytes, bool bExpandEndOfAtom );
1250 :
1251 : void InsertPersistOffset( sal_uInt32 nKey, sal_uInt32 nOffset ); // It is not being checked if this key is already in the PersistantTable
1252 : void ReplacePersistOffset( sal_uInt32 nKey, sal_uInt32 nOffset );
1253 : sal_uInt32 GetPersistOffset( sal_uInt32 nKey );
1254 : bool SeekToPersistOffset( sal_uInt32 nKey );
1255 : bool InsertAtPersistOffset( sal_uInt32 nKey, sal_uInt32 nValue ); // nValue is being inserted into the Stream where it's appropriate (overwrite modus), without that the
1256 : // current StreamPosition changes
1257 : void SetEditAs( const OUString& rEditAs );
1258 45 : rtl::OUString GetEditAs() { return mEditAs; }
1259 495 : SvStream& GetStream() const { return *mpOutStrm; }
1260 129 : sal_uLong GetStreamPos() const { return mpOutStrm->Tell(); }
1261 :
1262 : // features during the creation of the following Containers:
1263 :
1264 : // ESCHER_DggContainer: a EscherDgg Atom is automatically being created and managed
1265 : // ESCHER_DgContainer: a EscherDg Atom is automatically being created and managed
1266 : // ESCHER_SpgrContainer:
1267 : // ESCHER_SpContainer:
1268 :
1269 : virtual void OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance = 0 );
1270 : virtual void CloseContainer();
1271 :
1272 : void BeginAtom();
1273 : void EndAtom( sal_uInt16 nRecType, int nRecVersion = 0, int nRecInstance = 0 );
1274 : void AddAtom( sal_uInt32 nAtomSitze, sal_uInt16 nRecType, int nRecVersion = 0, int nRecInstance = 0 );
1275 : void AddChildAnchor( const Rectangle& rRectangle );
1276 : void AddClientAnchor( const Rectangle& rRectangle );
1277 :
1278 : virtual sal_uInt32 EnterGroup( const OUString& rShapeName, const Rectangle* pBoundRect = 0 );
1279 : sal_uInt32 EnterGroup( const Rectangle* pBoundRect = NULL );
1280 2383 : sal_uInt32 GetGroupLevel() const { return mnGroupLevel; };
1281 : bool SetGroupSnapRect( sal_uInt32 nGroupLevel, const Rectangle& rRect );
1282 : bool SetGroupLogicRect( sal_uInt32 nGroupLevel, const Rectangle& rRect );
1283 : virtual void LeaveGroup();
1284 :
1285 : // a ESCHER_Sp is being written ( a ESCHER_DgContainer has to be opened for this purpose!)
1286 : virtual void AddShape( sal_uInt32 nShpInstance, sal_uInt32 nFlagIds, sal_uInt32 nShapeID = 0 );
1287 :
1288 : virtual void Commit( EscherPropertyContainer& rProps, const Rectangle& rRect);
1289 :
1290 : static sal_uInt32 GetColor( const sal_uInt32 nColor, bool bSwap = true );
1291 : static sal_uInt32 GetColor( const Color& rColor, bool bSwap = true );
1292 :
1293 : // ...Sdr... implemented in eschesdo.cxx
1294 :
1295 : void AddSdrPage( const SdrPage& rPage );
1296 : void AddUnoShapes( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes );
1297 :
1298 : /// returns the ShapeID
1299 : sal_uInt32 AddSdrObject( const SdrObject& rObj, bool ooxmlExport = false );
1300 152 : virtual void AddSdrObjectVMLObject( const SdrObject& /*rObj*/)
1301 : {
1302 : // Required for Exporting VML shape
1303 152 : }
1304 :
1305 : /// If objects are written through AddSdrObject the
1306 : /// SolverContainer has to be written, and maybe some
1307 : /// maintenance to be done.
1308 : void EndSdrObjectPage();
1309 :
1310 : /// Called before a shape is written, application supplies
1311 : /// ClientRecords. May set AppData::bDontWriteShape so the
1312 : /// shape is ignored.
1313 : virtual EscherExHostAppData* StartShape(
1314 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rShape,
1315 : const Rectangle* pChildAnchor );
1316 :
1317 : /// Called after a shape is written to inform the application
1318 : /// of the resulted shape type and ID.
1319 : virtual void EndShape( sal_uInt16 nShapeType, sal_uInt32 nShapeID );
1320 :
1321 : /// Called before an AdditionalText EnterGroup occurs.
1322 : /// The current shape will be written in three parts:
1323 : /// a group shape, the shape itself, and an extra textbox shape.
1324 : /// The complete flow is:
1325 : /// StartShape sets HostData1.
1326 : /// EnterAdditionalTextGroup sets HostData2, App may modify
1327 : /// HostData1 and keep track of the change.
1328 : /// The group shape is written with HostData2.
1329 : /// Another StartShape with the same (!) object sets HostData3.
1330 : /// The current shape is written with HostData3.
1331 : /// EndShape is called for the current shape.
1332 : /// Another StartShape with the same (!) object sets HostData4.
1333 : /// The textbox shape is written with HostData4.
1334 : /// EndShape is called for the textbox shape.
1335 : /// EndShape is called for the group shape, this provides
1336 : /// the same functionality as an ordinary recursive group.
1337 : virtual EscherExHostAppData* EnterAdditionalTextGroup();
1338 :
1339 : /// Called if an ESCHER_Prop_lTxid shall be written
1340 : virtual sal_uInt32 QueryTextID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >&, sal_uInt32 nShapeId );
1341 : // add an dummy rectangle shape into the escher stream
1342 : sal_uInt32 AddDummyShape();
1343 :
1344 : static const SdrObject* GetSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rXShape );
1345 :
1346 8 : void SetHellLayerId( sal_uInt16 nId ) { mnHellLayerId = nId; }
1347 959 : sal_uInt16 GetHellLayerId() const { return mnHellLayerId; }
1348 :
1349 : private:
1350 : EscherEx( const EscherEx& ) SAL_DELETED_FUNCTION;
1351 : EscherEx& operator=( const EscherEx& ) SAL_DELETED_FUNCTION;
1352 :
1353 : // prevent C-style cast to former base class EscherGraphicProvider
1354 : operator EscherGraphicProvider&();
1355 : operator EscherGraphicProvider const&();
1356 : };
1357 :
1358 :
1359 : #endif
1360 :
1361 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|