1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 FLT_MSDFFIMP_HXX
21 #define FLT_MSDFFIMP_HXX
29 #include <boost/shared_ptr.hpp>
30 #include <boost/scoped_ptr.hpp>
31 #include <boost/ptr_container/ptr_vector.hpp>
32 #include <boost/ptr_container/ptr_set.hpp>
34 #include <com/sun/star/uno/Reference.h>
35 #include <com/sun/star/embed/XEmbeddedObject.hpp>
36 #include <com/sun/star/beans/XPropertySet.hpp>
38 #include <tools/solar.h>
39 #include <tools/color.hxx>
40 #include <tools/gen.hxx>
42 #include <sot/storage.hxx>
44 #include <vcl/graph.hxx>
46 #include <svx/msdffdef.hxx>
47 #include <filter/msfilter/dffpropset.hxx>
48 #include <filter/msfilter/dffrecordheader.hxx>
50 #include <filter/msfilter/msfilterdllapi.h>
63 struct SvxMSDffBLIPInfo
;
64 struct SvxMSDffShapeInfo
;
65 struct SvxMSDffShapeOrder
;
67 class SvxMSDffManager
;
73 class MSFILTER_DLLPUBLIC DffPropertyReader
: public DffPropSet
75 const SvxMSDffManager
& rManager
;
76 DffPropSet
* pDefaultPropSet
;
78 void ApplyCustomShapeTextAttributes( SfxItemSet
& rSet
) const;
79 void CheckAndCorrectExcelTextRotation( SvStream
& rIn
, SfxItemSet
& rSet
, DffObjData
& rObjData
) const;
80 void ApplyCustomShapeAdjustmentAttributes( SfxItemSet
& rSet
) const;
81 void ApplyCustomShapeGeometryAttributes( SvStream
& rIn
,
83 const DffObjData
& rObjData
) const;
84 void ApplyLineAttributes( SfxItemSet
& rSet
, const MSO_SPT eShapeType
) const; // #i28269#
85 void ApplyFillAttributes( SvStream
& rIn
, SfxItemSet
& rSet
, const DffObjData
& rObjData
) const;
88 sal_Int32 mnFix16Angle
;
89 sal_Bool mbRotateGranientFillWithAngle
;
91 explicit DffPropertyReader( const SvxMSDffManager
& rManager
);
93 sal_Int32
Fix16ToAngle( sal_Int32 nAngle
) const;
95 #ifdef DBG_CUSTOMSHAPE
96 void ReadPropSet( SvStream
& rIn
, void* pClientData
, sal_uInt32 nShapeType
= 0 ) const;
98 void ReadPropSet( SvStream
& rIn
, void* pClientData
) const;
101 void SetDefaultPropSet( SvStream
& rIn
, sal_uInt32 nOffDgg
) const;
102 void ApplyAttributes( SvStream
& rIn
, SfxItemSet
& rSet
) const;
103 void ApplyAttributes( SvStream
& rIn
, SfxItemSet
& rSet
, DffObjData
& rObjData
) const;
104 void ImportGradientColor( SfxItemSet
& aSet
, MSO_FillType eMSO_FillType
, double dTrans
= 1.0 , double dBackTrans
= 1.0 ) const;
107 #define COL_DEFAULT RGB_COLORDATA( 0xFA, 0xFB, 0xFC )
109 typedef ::std::map
< sal_Int32
, SdrObject
* > SvxMSDffShapeIdContainer
;
111 #define SVEXT_PERSIST_STREAM "\002OlePres000"
113 // the following two will be sorted by the order of their appearance:
114 typedef boost::ptr_vector
<SvxMSDffBLIPInfo
> SvxMSDffBLIPInfos
;
115 class SvxMSDffShapeOrders
: public std::vector
<SvxMSDffShapeOrder
*>
118 ~SvxMSDffShapeOrders();
121 struct MSFILTER_DLLPUBLIC CompareSvxMSDffShapeInfoById
123 bool operator()(::boost::shared_ptr
<SvxMSDffShapeInfo
> const& lhs
,
124 ::boost::shared_ptr
<SvxMSDffShapeInfo
> const& rhs
) const;
126 struct MSFILTER_DLLPUBLIC CompareSvxMSDffShapeInfoByTxBxComp
128 bool operator()(::boost::shared_ptr
<SvxMSDffShapeInfo
> const& lhs
,
129 ::boost::shared_ptr
<SvxMSDffShapeInfo
> const& rhs
) const;
132 // the following will be sorted explicitly:
133 typedef ::std::set
< ::boost::shared_ptr
<SvxMSDffShapeInfo
>,
134 CompareSvxMSDffShapeInfoById
> SvxMSDffShapeInfos_ById
;
135 typedef ::std::multiset
< ::boost::shared_ptr
<SvxMSDffShapeInfo
>,
136 CompareSvxMSDffShapeInfoByTxBxComp
> SvxMSDffShapeInfos_ByTxBxComp
;
138 #define SVXMSDFF_SETTINGS_CROP_BITMAPS 1
139 #define SVXMSDFF_SETTINGS_IMPORT_PPT 2
140 #define SVXMSDFF_SETTINGS_IMPORT_EXCEL 4
142 #define SP_FGROUP 0x001 ///< This shape is a group shape
143 #define SP_FCHILD 0x002 ///< Not a top-level shape
144 #define SP_FPATRIARCH 0x004 ///< This is the topmost group shape.
145 ///< Exactly one of these per drawing.
146 #define SP_FDELETED 0x008 ///< The shape has been deleted
147 #define SP_FOLESHAPE 0x010 ///< The shape is an OLE object
148 #define SP_FHAVEMASTER 0x020 ///< Shape has a hspMaster property
149 #define SP_FFLIPH 0x040 ///< Shape is flipped horizontally
150 #define SP_FFLIPV 0x080 ///< Shape is flipped vertically
151 #define SP_FCONNECTOR 0x100 ///< Connector type of shape
152 #define SP_FHAVEANCHOR 0x200 ///< Shape has an anchor of some kind
153 #define SP_FBACKGROUND 0x400 ///< Background shape
154 #define SP_FHAVESPT 0x800 ///< Shape has a shape type property
156 // for the CreateSdrOLEFromStorage we need the information, how we handle
157 // convert able OLE-Objects - this ist stored in
158 #define OLE_MATHTYPE_2_STARMATH 0x0001
159 #define OLE_WINWORD_2_STARWRITER 0x0002
160 #define OLE_EXCEL_2_STARCALC 0x0004
161 #define OLE_POWERPOINT_2_STARIMPRESS 0x0008
163 struct SvxMSDffConnectorRule
166 sal_uInt32 nShapeA
; ///< SPID of shape A
167 sal_uInt32 nShapeB
; ///< SPID of shape B
168 sal_uInt32 nShapeC
; ///< SPID of connector shape
169 sal_uInt32 ncptiA
; ///< Connection site Index of shape A
170 sal_uInt32 ncptiB
; ///< Connection site Index of shape B
171 sal_uInt32 nSpFlagsA
; ///< SpFlags of shape A (the original mirror flags
172 ///< must be known when solving the Solver Container)
173 sal_uInt32 nSpFlagsB
; ///< SpFlags of shape B
175 SdrObject
* pAObj
; ///< pPtr of object (corresponding to shape A)
176 SdrObject
* pBObj
; ///< pPtr of object (corresponding to shape B)
177 SdrObject
* pCObj
; ///< pPtr of connector object
179 SvxMSDffConnectorRule() : nSpFlagsA( 0 ), nSpFlagsB( 0 ), pAObj( NULL
),
180 pBObj( NULL
), pCObj( NULL
) {};
182 friend SvStream
& operator>>( SvStream
& rIn
, SvxMSDffConnectorRule
& rAtom
);
185 typedef ::std::vector
< SvxMSDffConnectorRule
* > SvxMSDffConnectorRuleList
;
187 struct MSFILTER_DLLPUBLIC SvxMSDffSolverContainer
189 SvxMSDffConnectorRuleList aCList
;
191 SvxMSDffSolverContainer();
192 ~SvxMSDffSolverContainer();
194 MSFILTER_DLLPUBLIC
friend SvStream
& operator>>( SvStream
& rIn
, SvxMSDffSolverContainer
& rAtom
);
199 sal_uInt32 dgid
; ///< DG owning the SPIDs in this cluster
200 sal_uInt32 cspidCur
; ///< number of SPIDs used so far
203 /// provided by SvxMSDffManager for each shape in a group
207 sal_uInt16 nSequence
;
208 MSDffTxId( sal_uInt16 nTxBxS_
, sal_uInt16 nSequence_
)
209 : nTxBxS( nTxBxS_
), nSequence( nSequence_
){}
210 MSDffTxId( const MSDffTxId
& rCopy
)
211 : nTxBxS( rCopy
.nTxBxS
), nSequence( rCopy
.nSequence
){}
214 struct MSFILTER_DLLPUBLIC SvxMSDffImportRec
216 static const int RELTO_DEFAULT
= 2;
219 Polygon
* pWrapPolygon
;
220 char* pClientAnchorBuffer
;
221 sal_uInt32 nClientAnchorLen
;
222 char* pClientDataBuffer
;
223 sal_uInt32 nClientDataLen
;
228 sal_uInt32 nLayoutInTableCell
;
230 long nTextRotationAngle
;
231 long nDxTextLeft
; ///< distance of text box from surrounding shape
235 long nDxWrapDistLeft
;
237 long nDxWrapDistRight
;
238 long nDyWrapDistBottom
;
240 long nCropFromBottom
;
243 MSDffTxId aTextId
; ///< identifier for text boxes
244 sal_uLong nNextShapeId
; ///< for linked text boxes
247 MSO_LineStyle eLineStyle
; ///< border types
248 MSO_LineDashing eLineDashing
;
249 sal_Bool bDrawHell
:1;
251 sal_Bool bReplaceByFly
:1;
252 sal_Bool bLastBoxInChain
:1;
253 sal_Bool bHasUDefProp
:1;
256 sal_Bool bAutoWidth
:1;
257 int relativeHorizontalWidth
; ///< in 0.1% or -1 for none
258 bool isHorizontalRule
;
261 SvxMSDffImportRec(const SvxMSDffImportRec
& rCopy
);
262 ~SvxMSDffImportRec();
264 bool operator==( const SvxMSDffImportRec
& rEntry
) const
265 { return nShapeId
== rEntry
.nShapeId
; }
266 bool operator<( const SvxMSDffImportRec
& rEntry
) const
267 { return nShapeId
< rEntry
.nShapeId
; }
270 SvxMSDffImportRec
&operator=(const SvxMSDffImportRec
&);
273 /** list of all SvxMSDffImportRec instances of/for a group */
274 class MSDffImportRecords
275 : public ::boost::ptr_set
<SvxMSDffImportRec
>
278 /** block of parameters for import/export for a single call of
279 ImportObjAtCurrentStreamPos() */
280 struct SvxMSDffImportData
282 MSDffImportRecords aRecords
; ///< Shape pointer, Shape ids and private data
283 Rectangle aParentRect
;///< Rectangle of the surrounding groups,
284 ///< which might have been provided externally
285 Rectangle aNewRect
; ///< Rectangle that is defined by this shape
289 explicit SvxMSDffImportData( const Rectangle
& rParentRect
) : aParentRect( rParentRect
) {}
290 void SetNewRect(sal_Int32 left
, sal_Int32 top
, sal_Int32 right
, sal_Int32 bottom
)
291 { aNewRect
= Rectangle(left
, top
, right
, bottom
); }
292 sal_Bool
HasParRect() const { return aParentRect
.IsEmpty(); }
293 sal_Bool
HasNewRect() const { return aNewRect
.IsEmpty() ; }
294 bool empty() const { return aRecords
.empty(); }
295 size_t size() const { return aRecords
.size(); }
296 MSDffImportRecords::const_iterator
begin() const { return aRecords
.begin(); }
297 MSDffImportRecords::const_iterator
end() const { return aRecords
.end(); }
302 const DffRecordHeader
& rSpHd
;
304 Rectangle aBoundRect
;
305 Rectangle aChildAnchor
;
311 sal_Bool bShapeType
: 1;
312 sal_Bool bClientAnchor
: 1;
313 sal_Bool bClientData
: 1;
314 sal_Bool bChildAnchor
: 1;
317 sal_Bool bIsAutoText
: 1;
318 sal_Bool bRotateTextWithShape
: 1;
322 DffObjData( const DffRecordHeader
& rObjHd
,
323 const Rectangle
& rBoundRect
,
326 aBoundRect( rBoundRect
),
329 eShapeType( mso_sptNil
),
330 bShapeType( sal_False
),
331 bClientAnchor( sal_False
),
332 bClientData( sal_False
),
333 bChildAnchor( sal_False
),
336 bIsAutoText( sal_False
),
337 bRotateTextWithShape( sal_True
),
339 nCalledByGroup( nClByGroup
){}
342 #define DFF_RECORD_MANAGER_BUF_SIZE 64
348 DffRecordList
* pPrev
;
349 DffRecordList
* pNext
;
351 DffRecordHeader mHd
[ DFF_RECORD_MANAGER_BUF_SIZE
];
353 explicit DffRecordList( DffRecordList
* pList
);
357 enum DffSeekToContentMode
361 SEEK_FROM_CURRENT_AND_RESTART
364 class MSFILTER_DLLPUBLIC DffRecordManager
: public DffRecordList
367 DffRecordList
* pCList
;
370 void Consume( SvStream
& rIn
,
371 sal_Bool bAppend
= sal_False
,
372 sal_uInt32 nStOfs
= 0 );
374 sal_Bool
SeekToContent( SvStream
& rIn
,
376 DffSeekToContentMode eMode
= SEEK_FROM_BEGINNING
);
377 DffRecordHeader
* GetRecordHeader( sal_uInt16 nRecType
,
378 DffSeekToContentMode eMode
= SEEK_FROM_BEGINNING
);
381 explicit DffRecordManager( SvStream
& rIn
);
384 DffRecordHeader
* Current();
385 DffRecordHeader
* First();
386 DffRecordHeader
* Next();
387 DffRecordHeader
* Prev();
388 DffRecordHeader
* Last();
391 /** abstract base class for Escher imports
393 Purpose: access to objects in Drawing File Format
395 Note: The method ProcessUserDefinedRecord() _has_ to be implemented in the
396 inheriting class(es) that is/are eventually used for PowerPoint, Word,
399 Status: Currently only access to BLIPs (will be extended later)
401 class MSFILTER_DLLPUBLIC SvxMSDffManager
: public DffPropertyReader
403 FmFormModel
* pFormModel
;
404 SvxMSDffBLIPInfos
* pBLIPInfos
;
405 ::boost::scoped_ptr
<SvxMSDffShapeInfos_ByTxBxComp
> m_pShapeInfosByTxBxComp
;
406 ::boost::scoped_ptr
<SvxMSDffShapeInfos_ById
> m_pShapeInfosById
;
407 SvxMSDffShapeOrders
* pShapeOrders
;
408 sal_uLong nDefaultFontHeight
;
410 sal_uInt16 nBLIPCount
;
411 sal_uInt16 nShapeCount
;
412 sal_uInt32 nGroupShapeFlags
;
414 void CheckTxBxStoryChain();
415 void GetFidclData(sal_uInt32 nOffsDgg
);
418 typedef std::map
<sal_uInt32
, sal_uInt32
> OffsetMap
;
421 sal_uInt32 mnCurMaxShapeId
; // we need this information to
422 sal_uInt32 mnDrawingsSaved
; // access the right drawing
423 sal_uInt32 mnIdClusters
; // while only knowing the shapeid
424 std::vector
<FIDCL
> maFidcls
;
425 OffsetMap maDgOffsetTable
; ///< array of fileoffsets
427 friend class DffPropertyReader
;
443 sal_uInt32 nSvxMSDffSettings
;
444 sal_uInt32 nSvxMSDffOLEConvFlags
;
446 /** stores a reference to an imported SdrObject
447 with its shape id if it has one */
448 SvxMSDffShapeIdContainer maShapeIdContainer
;
450 void GetCtrlData(sal_uInt32 nOffsDgg
);
451 void GetDrawingGroupContainerData( SvStream
& rSt
,
454 // Add internal drawing container id as parameter to the sub methods of
455 // reading the control information about the drawing objects.
456 // The drawing container id is used to distinguish the text ids of drawing
457 // objects in different drawing containers.
458 void GetDrawingContainerData( SvStream
& rSt
,
460 const unsigned long nDrawingContainerId
);
461 sal_Bool
GetShapeGroupContainerData( SvStream
& rSt
,
462 sal_uLong nLenShapeGroupCont
,
464 const unsigned long nDrawingContainerId
);
465 sal_Bool
GetShapeContainerData( SvStream
& rSt
,
466 sal_uLong nLenShapeCont
,
468 const unsigned long nDrawingContainerId
);
470 bool ReadGraphic( SvStream
& rSt
, sal_uLong nIndex
, Graphic
& rGraphic
) const;
471 SdrObject
* ImportGraphic( SvStream
&, SfxItemSet
&, const DffObjData
& );
472 // #i32596# - pass <nCalledByGroup> to method
473 // Needed in Writer's Microsoft Word import to avoid import of OLE objects
474 // inside groups. Instead a graphic object is created.
475 virtual SdrObject
* ImportOLE( long nOLEId
,
476 const Graphic
& rGraf
,
477 const Rectangle
& rBoundRect
,
478 const Rectangle
& rVisArea
,
479 const int _nCalledByGroup
,
480 sal_Int64 nAspect
) const;
481 static com::sun::star::uno::Reference
< com::sun::star::embed::XEmbeddedObject
> CheckForConvertToSOObj(
482 sal_uInt32 nConvertFlags
, SotStorage
& rSrcStg
,
483 const com::sun::star::uno::Reference
< com::sun::star::embed::XStorage
>& xDestStg
,
485 const Rectangle
& rVisArea
);
487 // the following methods need to be overriden for Excel imports
488 virtual sal_Bool
ProcessClientAnchor( SvStream
& rStData
,
491 sal_uInt32
& rBuffLen
) const;
492 virtual void ProcessClientAnchor2( SvStream
& rStData
,
493 DffRecordHeader
& rHd
,
494 void* pData
, DffObjData
& );
495 virtual sal_Bool
ProcessClientData( SvStream
& rStData
,
498 sal_uInt32
& rBuffLen
) const;
499 virtual SdrObject
* ProcessObj( SvStream
& rSt
,
502 Rectangle
& rTextRect
,
503 SdrObject
* pObj
= NULL
);
504 virtual sal_uLong
Calc_nBLIPPos( sal_uLong nOrgVal
,
505 sal_uLong nStreamPos
) const;
506 virtual bool GetColorFromPalette(sal_uInt16 nNum
, Color
& rColor
) const;
508 // Fontwork objects use a new implementation of ReadObjText because the old
509 // one does not properly import multiple paragraphs.
510 static void ReadObjText( const OUString
& rText
, SdrObject
* pObj
);
512 // the following method needs to be overridden for the import of OLE objects
513 virtual sal_Bool
GetOLEStorageName( long nOLEId
,
514 OUString
& rStorageName
,
515 SotStorageRef
& rSrcStorage
,
516 com::sun::star::uno::Reference
< com::sun::star::embed::XStorage
>& xDestStg
519 /** Prevent that (rounded) rectangles with wrapped text will always be
520 converted into SdrRectObj( OBJ_TEXT ).
522 @return sal_True means "conversion".
524 virtual sal_Bool
ShapeHasText(sal_uLong nShapeId
, sal_uLong nFilePos
) const;
527 DffPropertyReader
* pSecPropSet
;
528 std::map
<sal_uInt32
,OString
> aEscherBlipCache
;
530 DffRecordManager maShapeRecords
;
531 ColorData mnDefaultColor
;
535 Color
MSO_TEXT_CLR_ToColor( sal_uInt32 nColorCode
) const;
536 Color
MSO_CLR_ToColor( sal_uInt32 nColorCode
,
537 sal_uInt16 nContextProperty
= DFF_Prop_lineColor
) const;
538 virtual sal_Bool
SeekToShape( SvStream
& rSt
,
540 sal_uInt32 nId
) const;
541 bool SeekToRec( SvStream
& rSt
,
543 sal_uLong nMaxFilePos
,
544 DffRecordHeader
* pRecHd
= NULL
,
545 sal_uLong nSkipCount
= 0 ) const;
546 bool SeekToRec2( sal_uInt16 nRecId1
,
548 sal_uLong nMaxFilePos
,
549 DffRecordHeader
* pRecHd
= NULL
,
550 sal_uLong nSkipCount
= 0 ) const;
552 static OUString
MSDFFReadZString( SvStream
& rIn
,
554 bool bUniCode
= sal_False
);
556 static bool ReadCommonRecordHeader( SvStream
& rSt
,
560 sal_uInt32
& rLength
) SAL_WARN_UNUSED_RESULT
;
562 // TODO: provide proper documentation here
567 @param rStCtrl Management stream with containers, FBSE
568 objects and shapes (mandatory; stream needs
571 @param nOffsDgg offset in rStrCtrl; beginning of the drawing
573 @param pStData data stream in that the BLIPs are stored (if
574 NULL it is assumed that all BLIPs are also in
575 the rStCtrl; stream needs to be open already)
576 @param pSdrModel_ ??? (can be empty during Ctor call but needs
577 to be set via SetModel() later in that case!)
578 @param nApplicationScale ???
579 @param mnDefaultColor_ ???
580 @param nDefaultFontHeight_ ???
583 SvxMSDffManager( SvStream
& rStCtrl
,
584 const OUString
& rBaseURL
,
587 SdrModel
* pSdrModel_
= 0,
588 long nApplicationScale
= 0,
589 ColorData mnDefaultColor_
= COL_DEFAULT
,
590 sal_uLong nDefaultFontHeight_
= 24,
591 SvStream
* pStData2_
= 0 );
593 // in PPT the parameters DGGContainerOffset and PicStream are provided by an
595 SvxMSDffManager( SvStream
& rStCtrl
, const OUString
& rBaseURL
);
596 void InitSvxMSDffManager( sal_uInt32 nOffsDgg_
,
598 sal_uInt32 nSvxMSDffOLEConvFlags
);
599 void SetDgContainer( SvStream
& rSt
);
601 virtual ~SvxMSDffManager();
603 sal_uInt32
GetSvxMSDffSettings() const { return nSvxMSDffSettings
; };
604 void SetSvxMSDffSettings( sal_uInt32 nSettings
) { nSvxMSDffSettings
= nSettings
; };
606 static sal_Bool
MakeContentStream( SotStorage
* pStor
, const GDIMetaFile
& );
607 static void ReadObjText( SvStream
& rStream
, SdrObject
* pObj
);
608 static sal_Bool
ConvertToOle2( SvStream
& rStm
,
611 const SotStorageRef
& rDest
);
613 void SetModel(SdrModel
* pModel
, long nApplicationScale
);
614 SdrModel
* GetModel() const { return pSdrModel
; }
615 void Scale(sal_Int32
& rVal
) const;
616 void Scale(Point
& rPos
) const;
617 void Scale(Size
& rSiz
) const;
618 void ScaleEmu(sal_Int32
& rVal
) const;
619 sal_uInt32
ScalePt( sal_uInt32 nPt
) const;
620 sal_Int32
ScalePoint( sal_Int32 nVal
) const;
622 // TODO: provide proper documentation here
623 /** Request for a specific BLIP.
625 @param[in] nIdx number of the requested BLIP (mandatory)
626 @param[out] rData already converted data (insert directly as graphics
630 @return sal_True if successful, sal_False otherwise
632 sal_Bool
GetBLIP( sal_uLong nIdx
, Graphic
& rData
, Rectangle
* pVisArea
= NULL
);
634 // TODO: provide proper documentation here
635 /** read a BLIP out of a already positioned stream
637 @param[in] rBLIPStream alread positioned stream (mandatory)
638 @param[out] rData already converted data (insert directly as
639 graphics into our documents)
642 @return sal_True if successful, sal_False otherwise
644 sal_Bool
GetBLIPDirect(SvStream
& rBLIPStream
, Graphic
& rData
, Rectangle
* pVisArea
= NULL
) const;
646 sal_Bool
GetShape(sal_uLong nId
, SdrObject
*& rpData
, SvxMSDffImportData
& rData
);
648 /** Get count of managed BLIPs
650 @return Number of BLIPs in pStData (or rStCtrl), thus number of FBSEs in
651 the drawing group container. If 0 is returned this means that
652 the structure is ok but there are no BLIPs; if USHRT_MAX is
653 returned than there was an error: no correct Drawing File Format
655 sal_uInt16
GetBLIPCount() const{ return nBLIPCount
; }
657 SdrObject
* ImportObj( SvStream
& rSt
,
659 Rectangle
& rClientRect
,
660 const Rectangle
& rGlobalChildRect
,
661 int nCalledByGroup
= 0,
662 sal_Int32
* pShapeId
= NULL
);
663 SdrObject
* ImportGroup( const DffRecordHeader
& rHd
,
666 Rectangle
& rClientRect
,
667 const Rectangle
& rGlobalChildRect
,
668 int nCalledByGroup
= 0,
669 sal_Int32
* pShapeId
= NULL
);
670 SdrObject
* ImportShape( const DffRecordHeader
& rHd
,
673 Rectangle
& rClientRect
,
674 const Rectangle
& rGlobalChildRect
,
675 int nCalledByGroup
= 0,
676 sal_Int32
* pShapeId
= NULL
);
678 Rectangle
GetGlobalChildAnchor( const DffRecordHeader
& rHd
,
680 Rectangle
& aClientRect
);
681 void GetGroupAnchors( const DffRecordHeader
& rHd
,
683 Rectangle
& rGroupClientAnchor
,
684 Rectangle
& rGroupChildAnchor
,
685 const Rectangle
& rClientRect
,
686 const Rectangle
& rGlobalChildRect
);
688 inline const SvxMSDffShapeInfos_ById
* GetShapeInfos( void ) const
689 { return m_pShapeInfosById
.get(); }
691 inline const SvxMSDffShapeOrders
* GetShapeOrders( void ) const
692 { return pShapeOrders
; }
694 void StoreShapeOrder(sal_uLong nId
,
697 SwFlyFrmFmt
* pFly
= 0,
698 short nHdFtSection
= 0) const;
700 void ExchangeInShapeOrder(SdrObject
* pOldObject
,
703 SdrObject
* pObject
) const;
705 void RemoveFromShapeOrder( SdrObject
* pObject
) const;
707 sal_uInt32
GetConvertFlags() const { return nSvxMSDffOLEConvFlags
; }
709 static SdrOle2Obj
* CreateSdrOLEFromStorage( const OUString
& rStorageName
,
710 SotStorageRef
& rSrcStorage
,
711 const com::sun::star::uno::Reference
< com::sun::star::embed::XStorage
>& xDestStg
,
712 const Graphic
& rGraf
,
713 const Rectangle
& rBoundRect
,
714 const Rectangle
& rVisArea
,
715 SvStream
* pDataStrrm
,
717 sal_uInt32 nConvertFlags
,
720 /** Create connections between shapes.
721 This method should be called after a page is imported.
723 @param rSolver contains necessary data that is collected during the
726 void SolveSolver( const SvxMSDffSolverContainer
& rSolver
);
728 static sal_Bool
SetPropValue(
729 const ::com::sun::star::uno::Any
& rAny
,
730 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> & rXPropSet
,
731 const OUString
& rPropertyName
,
732 sal_Bool bTestPropertyAvailability
= sal_False
735 void insertShapeId( sal_Int32 nShapeId
, SdrObject
* pShape
);
736 void removeShapeId( SdrObject
* pShape
);
737 SdrObject
* getShapeForId( sal_Int32 nShapeId
);
740 struct SvxMSDffBLIPInfo
742 sal_uInt16 nBLIPType
; ///< type of BLIP: e.g. 6 for PNG
743 sal_uLong nFilePos
; ///< offset of the BLIP in data strem
744 sal_uLong nBLIPSize
; ///< number of bytes that the BLIP needs in stream
745 SvxMSDffBLIPInfo(sal_uInt16 nBType
, sal_uLong nFPos
, sal_uLong nBSize
):
746 nBLIPType( nBType
), nFilePos( nFPos
), nBLIPSize( nBSize
){}
749 struct SvxMSDffShapeInfo
751 sal_uInt32 nShapeId
; ///< shape id, used in PLCF SPA and in mso_fbtSp (FSP)
752 sal_uLong nFilePos
; ///< offset of the shape in control stream for
753 ///< potential later access to it
754 sal_uInt32 nTxBxComp
;
756 sal_Bool bReplaceByFly
:1; ///< shape can be replaced by a frame in Writer
757 sal_Bool bLastBoxInChain
:1;
759 explicit SvxMSDffShapeInfo(sal_uLong nFPos
, sal_uInt32 nId
=0, // sal_uLong nBIdx=0,
760 sal_uInt16 nSeqId
=0, sal_uInt16 nBoxId
=0):
763 nTxBxComp( (nSeqId
<< 16) + nBoxId
)
765 bReplaceByFly
= sal_False
;
766 bLastBoxInChain
= sal_True
;
768 SvxMSDffShapeInfo(SvxMSDffShapeInfo
& rInfo
):
769 nShapeId( rInfo
.nShapeId
),
770 nFilePos( rInfo
.nFilePos
),
771 nTxBxComp( rInfo
.nTxBxComp
)
773 bReplaceByFly
= rInfo
.bReplaceByFly
;
774 bLastBoxInChain
= rInfo
.bLastBoxInChain
;
779 struct SvxMSDffShapeOrder
781 sal_uLong nShapeId
; ///< shape id used in PLCF SPA and in mso_fbtSp (FSP)
782 sal_uLong nTxBxComp
; ///< chain or box number in the Text-Box-Story (or NULL)
783 SwFlyFrmFmt
* pFly
; ///< format of frame that was inserted as a replacement
784 ///< for a Sdr-Text object in Writer - needed for
786 short nHdFtSection
; ///< used by Writer to find out if linked frames are in
787 ///< the same header or footer of the same section
788 SdrObject
* pObj
; ///< pointer to the draw object (or NULL if not used)
790 // Approach: In the Ctor of SvxMSDffManager only the shape ids are stored in
791 // the shape order array. The Text-Box number and the object
792 // pointer are only stored if the shape is really imported.
793 explicit SvxMSDffShapeOrder( sal_uLong nId
):
794 nShapeId( nId
), nTxBxComp( 0 ), pFly( 0 ), nHdFtSection( 0 ), pObj( 0 ){}
796 bool operator==( const SvxMSDffShapeOrder
& rEntry
) const
797 { return (nTxBxComp
== rEntry
.nTxBxComp
); }
798 bool operator<( const SvxMSDffShapeOrder
& rEntry
) const
799 { return (nTxBxComp
< rEntry
.nTxBxComp
); }
802 // the following will be sorted explicitly:
803 struct CompareSvxMSDffShapeTxBxSort
805 bool operator()( SvxMSDffShapeOrder
* const& lhs
, SvxMSDffShapeOrder
* const& rhs
) const { return (*lhs
)<(*rhs
); }
807 class MSFILTER_DLLPUBLIC SvxMSDffShapeTxBxSort
: public std::set
<SvxMSDffShapeOrder
*,CompareSvxMSDffShapeTxBxSort
> {};
812 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */