122e87013SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 322e87013SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 422e87013SAndrew Rist * or more contributor license agreements. See the NOTICE file 522e87013SAndrew Rist * distributed with this work for additional information 622e87013SAndrew Rist * regarding copyright ownership. The ASF licenses this file 722e87013SAndrew Rist * to you under the Apache License, Version 2.0 (the 822e87013SAndrew Rist * "License"); you may not use this file except in compliance 922e87013SAndrew Rist * with the License. You may obtain a copy of the License at 1022e87013SAndrew Rist * 1122e87013SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 1222e87013SAndrew Rist * 1322e87013SAndrew Rist * Unless required by applicable law or agreed to in writing, 1422e87013SAndrew Rist * software distributed under the License is distributed on an 1522e87013SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1622e87013SAndrew Rist * KIND, either express or implied. See the License for the 1722e87013SAndrew Rist * specific language governing permissions and limitations 1822e87013SAndrew Rist * under the License. 1922e87013SAndrew Rist * 2022e87013SAndrew Rist *************************************************************/ 2122e87013SAndrew Rist 2222e87013SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _MSDFFIMP_HXX 25cdf0e10cSrcweir #define _MSDFFIMP_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/uno/Reference.h> 28cdf0e10cSrcweir #include <com/sun/star/embed/XEmbeddedObject.hpp> 29cdf0e10cSrcweir #include <tools/solar.h> // UINTXX 30cdf0e10cSrcweir #include <svl/svarray.hxx> 31cdf0e10cSrcweir #include <tools/color.hxx> 32cdf0e10cSrcweir #include <tools/gen.hxx> 33cdf0e10cSrcweir #include <tools/table.hxx> 34cdf0e10cSrcweir #include <svx/msdffdef.hxx> 352e8e6dd8SEike Rathke #include <filter/msfilter/dffpropset.hxx> 362e8e6dd8SEike Rathke #include <filter/msfilter/dffrecordheader.hxx> 37cdf0e10cSrcweir #include <filter/msfilter/msfiltertracer.hxx> 38cdf0e10cSrcweir #include <vcl/graph.hxx> 39cdf0e10cSrcweir #include <string.h> 40cdf0e10cSrcweir #include <map> 41cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 42cdf0e10cSrcweir #include <filter/msfilter/msfilterdllapi.h> 43cdf0e10cSrcweir #include <sot/storage.hxx> 44cdf0e10cSrcweir 45cdf0e10cSrcweir class Graphic; 46cdf0e10cSrcweir class SvStream; 47cdf0e10cSrcweir class SdrObject; 48cdf0e10cSrcweir class SdrOle2Obj; 49cdf0e10cSrcweir class SotStorageRef; 50cdf0e10cSrcweir class Polygon; 51cdf0e10cSrcweir class PolyPolygon; 52cdf0e10cSrcweir class FmFormModel; 53cdf0e10cSrcweir class SdrModel; 54cdf0e10cSrcweir class DffRecordHeader; 55cdf0e10cSrcweir 56cdf0e10cSrcweir class SwFlyFrmFmt; 57cdf0e10cSrcweir 58cdf0e10cSrcweir struct SvxMSDffBLIPInfo; 59cdf0e10cSrcweir struct SvxMSDffShapeInfo; 60cdf0e10cSrcweir struct SvxMSDffShapeOrder; 61cdf0e10cSrcweir 62cdf0e10cSrcweir class SvxMSDffManager; 63cdf0e10cSrcweir 64cdf0e10cSrcweir class SfxItemSet; 65cdf0e10cSrcweir class SdrObject; 66cdf0e10cSrcweir struct DffObjData; 67cdf0e10cSrcweir 68cdf0e10cSrcweir class MSFILTER_DLLPUBLIC DffPropertyReader : public DffPropSet 69cdf0e10cSrcweir { 70cdf0e10cSrcweir const SvxMSDffManager& rManager; 71cdf0e10cSrcweir DffPropSet* pDefaultPropSet; 72cdf0e10cSrcweir 73cdf0e10cSrcweir void ApplyCustomShapeTextAttributes( SfxItemSet& rSet ) const; 74ef660199SEike Rathke void CheckAndCorrectExcelTextRotation( SvStream& rIn, SfxItemSet& rSet, DffObjData& rObjData ) const; 75cdf0e10cSrcweir void ApplyCustomShapeAdjustmentAttributes( SfxItemSet& rSet ) const; 76cdf0e10cSrcweir void ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxItemSet& rSet, const DffObjData& rObjData ) const; 77cdf0e10cSrcweir void ApplyLineAttributes( SfxItemSet& rSet, const MSO_SPT eShapeType ) const; // #i28269# 78cdf0e10cSrcweir void ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, const DffObjData& rObjData ) const; 79cdf0e10cSrcweir 80cdf0e10cSrcweir public: 81cdf0e10cSrcweir 82cdf0e10cSrcweir sal_Int32 mnFix16Angle; 83c73c4b92SJianyuan Li sal_Bool mbRotateGranientFillWithAngle; 84cdf0e10cSrcweir 85cdf0e10cSrcweir DffPropertyReader( const SvxMSDffManager& rManager ); 86cdf0e10cSrcweir ~DffPropertyReader(); 87cdf0e10cSrcweir sal_Int32 Fix16ToAngle( sal_Int32 nAngle ) const; 88cdf0e10cSrcweir 89cdf0e10cSrcweir #ifdef DBG_CUSTOMSHAPE 90cdf0e10cSrcweir void ReadPropSet( SvStream& rIn, void* pClientData, sal_uInt32 nShapeType = 0 ) const; 91cdf0e10cSrcweir #else 92cdf0e10cSrcweir void ReadPropSet( SvStream& rIn, void* pClientData ) const; 93cdf0e10cSrcweir #endif 94cdf0e10cSrcweir 95cdf0e10cSrcweir void SetDefaultPropSet( SvStream& rIn, sal_uInt32 nOffDgg ) const; 96cdf0e10cSrcweir void ApplyAttributes( SvStream& rIn, SfxItemSet& rSet ) const; 97ef660199SEike Rathke void ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, DffObjData& rObjData ) const; 98c73c4b92SJianyuan Li void ImportGradientColor( SfxItemSet& aSet, MSO_FillType eMSO_FillType, double dTrans = 1.0 , double dBackTrans = 1.0 ) const; 99cdf0e10cSrcweir }; 100cdf0e10cSrcweir 101cdf0e10cSrcweir 102cdf0e10cSrcweir #define COL_DEFAULT RGB_COLORDATA( 0xFA, 0xFB, 0xFC ) 103cdf0e10cSrcweir 104cdf0e10cSrcweir typedef SvxMSDffBLIPInfo* SvxMSDffBLIPInfo_Ptr; 105cdf0e10cSrcweir 106cdf0e10cSrcweir typedef SvxMSDffShapeInfo* SvxMSDffShapeInfo_Ptr; 107cdf0e10cSrcweir 108cdf0e10cSrcweir typedef SvxMSDffShapeOrder* SvxMSDffShapeOrder_Ptr; 109cdf0e10cSrcweir 110cdf0e10cSrcweir typedef ::std::map< sal_Int32, SdrObject* > SvxMSDffShapeIdContainer; 111cdf0e10cSrcweir 112cdf0e10cSrcweir #define SVEXT_PERSIST_STREAM "\002OlePres000" 113cdf0e10cSrcweir 114cdf0e10cSrcweir // nach der Reihenfolge des Auftretens sortiert werden: 115cdf0e10cSrcweir // 116cdf0e10cSrcweir SV_DECL_PTRARR_DEL(SvxMSDffBLIPInfos, SvxMSDffBLIPInfo_Ptr, 16,16) 117cdf0e10cSrcweir 118cdf0e10cSrcweir SV_DECL_PTRARR_DEL(SvxMSDffShapeOrders, SvxMSDffShapeOrder_Ptr, 16,16) 119cdf0e10cSrcweir 120cdf0e10cSrcweir // explizit sortiert werden: 121cdf0e10cSrcweir // 122cdf0e10cSrcweir SV_DECL_PTRARR_SORT_DEL_VISIBILITY(SvxMSDffShapeInfos, SvxMSDffShapeInfo_Ptr, 16,16, MSFILTER_DLLPUBLIC) 123cdf0e10cSrcweir 124cdf0e10cSrcweir SV_DECL_PTRARR_SORT_VISIBILITY(SvxMSDffShapeTxBxSort, SvxMSDffShapeOrder_Ptr, 16,16, MSFILTER_DLLPUBLIC) 125cdf0e10cSrcweir 126cdf0e10cSrcweir #define SVXMSDFF_SETTINGS_CROP_BITMAPS 1 127cdf0e10cSrcweir #define SVXMSDFF_SETTINGS_IMPORT_PPT 2 128cdf0e10cSrcweir #define SVXMSDFF_SETTINGS_IMPORT_EXCEL 4 129cdf0e10cSrcweir 130cdf0e10cSrcweir #define SP_FGROUP 0x001 // This shape is a group shape 131cdf0e10cSrcweir #define SP_FCHILD 0x002 // Not a top-level shape 132cdf0e10cSrcweir #define SP_FPATRIARCH 0x004 // This is the topmost group shape. 133cdf0e10cSrcweir // Exactly one of these per drawing. 134cdf0e10cSrcweir #define SP_FDELETED 0x008 // The shape has been deleted 135cdf0e10cSrcweir #define SP_FOLESHAPE 0x010 // The shape is an OLE object 136cdf0e10cSrcweir #define SP_FHAVEMASTER 0x020 // Shape has a hspMaster property 137cdf0e10cSrcweir #define SP_FFLIPH 0x040 // Shape is flipped horizontally 138cdf0e10cSrcweir #define SP_FFLIPV 0x080 // Shape is flipped vertically 139cdf0e10cSrcweir #define SP_FCONNECTOR 0x100 // Connector type of shape 140cdf0e10cSrcweir #define SP_FHAVEANCHOR 0x200 // Shape has an anchor of some kind 141cdf0e10cSrcweir #define SP_FBACKGROUND 0x400 // Background shape 142cdf0e10cSrcweir #define SP_FHAVESPT 0x800 // Shape has a shape type property 143cdf0e10cSrcweir 144cdf0e10cSrcweir // for the CreateSdrOLEFromStorage we need the information, how we handle 145cdf0e10cSrcweir // convert able OLE-Objects - this ist stored in 146cdf0e10cSrcweir #define OLE_MATHTYPE_2_STARMATH 0x0001 147cdf0e10cSrcweir #define OLE_WINWORD_2_STARWRITER 0x0002 148cdf0e10cSrcweir #define OLE_EXCEL_2_STARCALC 0x0004 149cdf0e10cSrcweir #define OLE_POWERPOINT_2_STARIMPRESS 0x0008 150cdf0e10cSrcweir 151cdf0e10cSrcweir struct SvxMSDffConnectorRule 152cdf0e10cSrcweir { 153cdf0e10cSrcweir sal_uInt32 nRuleId; 154cdf0e10cSrcweir sal_uInt32 nShapeA; // SPID of shape A 155cdf0e10cSrcweir 156cdf0e10cSrcweir sal_uInt32 nShapeB; // SPID of shape B 157cdf0e10cSrcweir sal_uInt32 nShapeC; // SPID of connector shape 158cdf0e10cSrcweir sal_uInt32 ncptiA; // Connection site Index of shape A 159cdf0e10cSrcweir sal_uInt32 ncptiB; // Connection site Index of shape B 160cdf0e10cSrcweir sal_uInt32 nSpFlagsA; // SpFlags of shape A ( the original mirror flags must be known when solving the Solver Container ) 161cdf0e10cSrcweir sal_uInt32 nSpFlagsB; // SpFlags of shape A 162cdf0e10cSrcweir 163cdf0e10cSrcweir SdrObject* pAObj; // pPtr of object ( corresponding to shape A ) 164cdf0e10cSrcweir SdrObject* pBObj; // " 165cdf0e10cSrcweir SdrObject* pCObj; // " of connector object 166cdf0e10cSrcweir SvxMSDffConnectorRuleSvxMSDffConnectorRule167cdf0e10cSrcweir SvxMSDffConnectorRule() : nSpFlagsA( 0 ), nSpFlagsB( 0 ), pAObj( NULL ), pBObj( NULL ), pCObj( NULL ) {}; 168cdf0e10cSrcweir 169cdf0e10cSrcweir friend SvStream& operator>>( SvStream& rIn, SvxMSDffConnectorRule& rAtom ); 170cdf0e10cSrcweir }; 171cdf0e10cSrcweir struct MSFILTER_DLLPUBLIC SvxMSDffSolverContainer 172cdf0e10cSrcweir { 173cdf0e10cSrcweir List aCList; 174cdf0e10cSrcweir 175cdf0e10cSrcweir SvxMSDffSolverContainer(); 176cdf0e10cSrcweir ~SvxMSDffSolverContainer(); 177cdf0e10cSrcweir 178cdf0e10cSrcweir MSFILTER_DLLPUBLIC friend SvStream& operator>>( SvStream& rIn, SvxMSDffSolverContainer& rAtom ); 179cdf0e10cSrcweir }; 180cdf0e10cSrcweir 181cdf0e10cSrcweir struct FIDCL 182cdf0e10cSrcweir { 183cdf0e10cSrcweir sal_uInt32 dgid; // DG owning the SPIDs in this cluster 184cdf0e10cSrcweir sal_uInt32 cspidCur; // number of SPIDs used so far 185cdf0e10cSrcweir }; 186cdf0e10cSrcweir 187cdf0e10cSrcweir //--------------------------------------------------------------------------- 188cdf0e10cSrcweir // von SvxMSDffManager fuer jedes in der Gruppe enthaltene Shape geliefert 189cdf0e10cSrcweir //--------------------------------------------------------------------------- 190cdf0e10cSrcweir struct MSDffTxId 191cdf0e10cSrcweir { 192cdf0e10cSrcweir sal_uInt16 nTxBxS; 193cdf0e10cSrcweir sal_uInt16 nSequence; MSDffTxIdMSDffTxId194cdf0e10cSrcweir MSDffTxId(sal_uInt16 nTxBxS_, sal_uInt16 nSequence_ ) 195cdf0e10cSrcweir : nTxBxS( nTxBxS_ ), 196cdf0e10cSrcweir nSequence( nSequence_ ){} MSDffTxIdMSDffTxId197cdf0e10cSrcweir MSDffTxId(const MSDffTxId& rCopy) 198cdf0e10cSrcweir : nTxBxS( rCopy.nTxBxS ), 199cdf0e10cSrcweir nSequence( rCopy.nSequence ){} 200cdf0e10cSrcweir }; 201cdf0e10cSrcweir 202cdf0e10cSrcweir struct MSFILTER_DLLPUBLIC SvxMSDffImportRec 203cdf0e10cSrcweir { 204cdf0e10cSrcweir SdrObject* pObj; 205cdf0e10cSrcweir Polygon* pWrapPolygon; 206cdf0e10cSrcweir char* pClientAnchorBuffer; 207cdf0e10cSrcweir sal_uInt32 nClientAnchorLen; 208cdf0e10cSrcweir char* pClientDataBuffer; 209cdf0e10cSrcweir sal_uInt32 nClientDataLen; 210cdf0e10cSrcweir sal_uInt32 nXAlign; 211cdf0e10cSrcweir sal_uInt32 nXRelTo; 212cdf0e10cSrcweir sal_uInt32 nYAlign; 213cdf0e10cSrcweir sal_uInt32 nYRelTo; 214cdf0e10cSrcweir sal_uInt32 nLayoutInTableCell; 215cdf0e10cSrcweir sal_uInt32 nFlags; 216cdf0e10cSrcweir long nTextRotationAngle; 217cdf0e10cSrcweir long nDxTextLeft; // Abstand der Textbox vom umgebenden Shape 218cdf0e10cSrcweir long nDyTextTop; 219cdf0e10cSrcweir long nDxTextRight; 220cdf0e10cSrcweir long nDyTextBottom; 221cdf0e10cSrcweir long nDxWrapDistLeft; 222cdf0e10cSrcweir long nDyWrapDistTop; 223cdf0e10cSrcweir long nDxWrapDistRight; 224cdf0e10cSrcweir long nDyWrapDistBottom; 225cdf0e10cSrcweir long nCropFromTop; 226cdf0e10cSrcweir long nCropFromBottom; 227cdf0e10cSrcweir long nCropFromLeft; 228cdf0e10cSrcweir long nCropFromRight; 229cdf0e10cSrcweir MSDffTxId aTextId; // Kennungen fuer Textboxen 230cdf0e10cSrcweir sal_uLong nNextShapeId; // fuer verlinkte Textboxen 231cdf0e10cSrcweir sal_uLong nShapeId; 232cdf0e10cSrcweir MSO_SPT eShapeType; 233cdf0e10cSrcweir MSO_LineStyle eLineStyle; // Umrandungs-Arten 234cdf0e10cSrcweir sal_Bool bDrawHell :1; 235cdf0e10cSrcweir sal_Bool bHidden :1; 236cdf0e10cSrcweir sal_Bool bReplaceByFly :1; 237cdf0e10cSrcweir sal_Bool bLastBoxInChain :1; 238cdf0e10cSrcweir sal_Bool bHasUDefProp :1; 239cdf0e10cSrcweir sal_Bool bVFlip :1; 240cdf0e10cSrcweir sal_Bool bHFlip :1; 241cdf0e10cSrcweir sal_Bool bAutoWidth :1; 242cdf0e10cSrcweir 243cdf0e10cSrcweir SvxMSDffImportRec(); 244cdf0e10cSrcweir SvxMSDffImportRec(const SvxMSDffImportRec& rCopy); 245cdf0e10cSrcweir ~SvxMSDffImportRec(); operator ==SvxMSDffImportRec246cdf0e10cSrcweir sal_Bool operator==( const SvxMSDffImportRec& rEntry ) const 247cdf0e10cSrcweir { return nShapeId == rEntry.nShapeId; } operator <SvxMSDffImportRec248cdf0e10cSrcweir sal_Bool operator<( const SvxMSDffImportRec& rEntry ) const 249cdf0e10cSrcweir { return nShapeId < rEntry.nShapeId; } 250cdf0e10cSrcweir }; 251cdf0e10cSrcweir typedef SvxMSDffImportRec* MSDffImportRec_Ptr; 252cdf0e10cSrcweir 253cdf0e10cSrcweir // Liste aller SvxMSDffImportRec fuer eine Gruppe 254cdf0e10cSrcweir SV_DECL_PTRARR_SORT_DEL_VISIBILITY(MSDffImportRecords, MSDffImportRec_Ptr, 16,16, MSFILTER_DLLPUBLIC) 255cdf0e10cSrcweir 256cdf0e10cSrcweir //--------------------------------------------------------------------------- 257cdf0e10cSrcweir // Import-/Export-Parameterblock fuer 1 x ImportObjAtCurrentStreamPos() 258cdf0e10cSrcweir //--------------------------------------------------------------------------- 259cdf0e10cSrcweir struct SvxMSDffImportData 260cdf0e10cSrcweir { 261cdf0e10cSrcweir MSDffImportRecords aRecords; // Shape-Pointer, -Ids und private Daten 262cdf0e10cSrcweir Rectangle aParentRect;// Rectangle der umgebenden Gruppe 263cdf0e10cSrcweir // bzw. von aussen reingegebenes Rect 264cdf0e10cSrcweir Rectangle aNewRect; // mit diesem Shape definiertes Rectangle 265cdf0e10cSrcweir SvxMSDffImportDataSvxMSDffImportData266cdf0e10cSrcweir SvxMSDffImportData() 267cdf0e10cSrcweir {} SvxMSDffImportDataSvxMSDffImportData268cdf0e10cSrcweir SvxMSDffImportData(const Rectangle& rParentRect) 269cdf0e10cSrcweir :aParentRect( rParentRect ) 270cdf0e10cSrcweir {} SetNewRectSvxMSDffImportData271cdf0e10cSrcweir void SetNewRect(sal_Int32 l, sal_Int32 o, 272cdf0e10cSrcweir sal_Int32 r, sal_Int32 u ){ aNewRect = Rectangle(l,o, r,u); } HasParRectSvxMSDffImportData273cdf0e10cSrcweir sal_Bool HasParRect() const { return aParentRect.IsEmpty(); } HasNewRectSvxMSDffImportData274cdf0e10cSrcweir sal_Bool HasNewRect() const { return aNewRect.IsEmpty() ; } HasRecordsSvxMSDffImportData275cdf0e10cSrcweir sal_Bool HasRecords() const { return 0 != aRecords.Count(); } GetRecCountSvxMSDffImportData276cdf0e10cSrcweir sal_uInt16 GetRecCount() const { return aRecords.Count(); } GetRecordSvxMSDffImportData277cdf0e10cSrcweir SvxMSDffImportRec* GetRecord(sal_uInt16 iRecord) const 278cdf0e10cSrcweir { return aRecords.GetObject( iRecord ); } 279cdf0e10cSrcweir }; 280cdf0e10cSrcweir 281cdf0e10cSrcweir struct DffObjData 282cdf0e10cSrcweir { 283cdf0e10cSrcweir const DffRecordHeader& rSpHd; 284cdf0e10cSrcweir 285cdf0e10cSrcweir Rectangle aBoundRect; 286cdf0e10cSrcweir Rectangle aChildAnchor; 287cdf0e10cSrcweir 288cdf0e10cSrcweir sal_uInt32 nShapeId; 289cdf0e10cSrcweir sal_uInt32 nSpFlags; 290cdf0e10cSrcweir MSO_SPT eShapeType; 291cdf0e10cSrcweir 292ef660199SEike Rathke sal_Bool bShapeType : 1; 293ef660199SEike Rathke sal_Bool bClientAnchor : 1; 294ef660199SEike Rathke sal_Bool bClientData : 1; 295ef660199SEike Rathke sal_Bool bChildAnchor : 1; 296ef660199SEike Rathke sal_Bool bOpt : 1; 297ef660199SEike Rathke sal_Bool bOpt2 : 1; 298ef660199SEike Rathke sal_Bool bIsAutoText : 1; 299ef660199SEike Rathke sal_Bool bRotateTextWithShape : 1; 300cdf0e10cSrcweir 301cdf0e10cSrcweir int nCalledByGroup; 302cdf0e10cSrcweir DffObjDataDffObjData303cdf0e10cSrcweir DffObjData( const DffRecordHeader& rObjHd, 304cdf0e10cSrcweir const Rectangle& rBoundRect, 305cdf0e10cSrcweir int nClByGroup ) : 306cdf0e10cSrcweir rSpHd( rObjHd ), 307cdf0e10cSrcweir aBoundRect( rBoundRect ), 308cdf0e10cSrcweir nShapeId( 0 ), 309cdf0e10cSrcweir nSpFlags( 0 ), 310cdf0e10cSrcweir eShapeType( mso_sptNil ), 311cdf0e10cSrcweir bShapeType( sal_False ), 312cdf0e10cSrcweir bClientAnchor( sal_False ), 313cdf0e10cSrcweir bClientData( sal_False ), 314cdf0e10cSrcweir bChildAnchor( sal_False ), 315cdf0e10cSrcweir bOpt( sal_False ), 316ef660199SEike Rathke bOpt2( sal_False ), 317cdf0e10cSrcweir bIsAutoText( sal_False ), 318ef660199SEike Rathke bRotateTextWithShape( sal_True ), 319cdf0e10cSrcweir nCalledByGroup( nClByGroup ){} 320cdf0e10cSrcweir }; 321cdf0e10cSrcweir 322cdf0e10cSrcweir #define DFF_RECORD_MANAGER_BUF_SIZE 64 323cdf0e10cSrcweir 324cdf0e10cSrcweir struct DffRecordList 325cdf0e10cSrcweir { 326cdf0e10cSrcweir sal_uInt32 nCount; 327cdf0e10cSrcweir sal_uInt32 nCurrent; 328cdf0e10cSrcweir DffRecordList* pPrev; 329cdf0e10cSrcweir DffRecordList* pNext; 330cdf0e10cSrcweir 331cdf0e10cSrcweir DffRecordHeader mHd[ DFF_RECORD_MANAGER_BUF_SIZE ]; 332cdf0e10cSrcweir 333cdf0e10cSrcweir DffRecordList( DffRecordList* pList ); 334cdf0e10cSrcweir ~DffRecordList(); 335cdf0e10cSrcweir }; 336cdf0e10cSrcweir 337cdf0e10cSrcweir enum DffSeekToContentMode 338cdf0e10cSrcweir { 339cdf0e10cSrcweir SEEK_FROM_BEGINNING, 340cdf0e10cSrcweir SEEK_FROM_CURRENT, 341cdf0e10cSrcweir SEEK_FROM_CURRENT_AND_RESTART 342cdf0e10cSrcweir }; 343cdf0e10cSrcweir 344cdf0e10cSrcweir class MSFILTER_DLLPUBLIC DffRecordManager : public DffRecordList 345cdf0e10cSrcweir { 346cdf0e10cSrcweir public : 347cdf0e10cSrcweir 348cdf0e10cSrcweir DffRecordList* pCList; 349cdf0e10cSrcweir 350cdf0e10cSrcweir void Clear(); 351cdf0e10cSrcweir void Consume( SvStream& rIn, sal_Bool bAppend = sal_False, sal_uInt32 nStOfs = 0 ); 352cdf0e10cSrcweir 353cdf0e10cSrcweir sal_Bool SeekToContent( SvStream& rIn, sal_uInt16 nRecType, DffSeekToContentMode eMode = SEEK_FROM_BEGINNING ); 354cdf0e10cSrcweir DffRecordHeader* GetRecordHeader( sal_uInt16 nRecType, DffSeekToContentMode eMode = SEEK_FROM_BEGINNING ); 355cdf0e10cSrcweir 356cdf0e10cSrcweir DffRecordManager(); 357cdf0e10cSrcweir DffRecordManager( SvStream& rIn ); 358cdf0e10cSrcweir ~DffRecordManager(); 359cdf0e10cSrcweir 360cdf0e10cSrcweir DffRecordHeader* Current(); 361cdf0e10cSrcweir DffRecordHeader* First(); 362cdf0e10cSrcweir DffRecordHeader* Next(); 363cdf0e10cSrcweir DffRecordHeader* Prev(); 364cdf0e10cSrcweir DffRecordHeader* Last(); 365cdf0e10cSrcweir }; 366cdf0e10cSrcweir 367cdf0e10cSrcweir /* 368cdf0e10cSrcweir SvxMSDffManager - abstrakte Basis-Klasse fuer Escher-Import 369cdf0e10cSrcweir =============== 370cdf0e10cSrcweir Zweck: Zugriff auf Objekte im Drawing File Format 371cdf0e10cSrcweir Stand: Zugriff nur auf BLIPs (wird spaeter erweitert) 372cdf0e10cSrcweir 373cdf0e10cSrcweir Beachte: in der zwecks PowerPoint-, ODER Word- ODER Excel-Import 374cdf0e10cSrcweir ======== abgeleiteten Klasse 375cdf0e10cSrcweir MUSS jeweils die Methode ProcessUserDefinedRecord() 376cdf0e10cSrcweir implementiert werden! 377cdf0e10cSrcweir */ 378cdf0e10cSrcweir class MSFILTER_DLLPUBLIC SvxMSDffManager : public DffPropertyReader 379cdf0e10cSrcweir { 380cdf0e10cSrcweir FmFormModel* pFormModel; 381cdf0e10cSrcweir SvxMSDffBLIPInfos* pBLIPInfos; 382cdf0e10cSrcweir SvxMSDffShapeInfos* pShapeInfos; 383cdf0e10cSrcweir SvxMSDffShapeOrders* pShapeOrders; 384cdf0e10cSrcweir sal_uLong nDefaultFontHeight; 385cdf0e10cSrcweir long nOffsDgg; 386cdf0e10cSrcweir sal_uInt16 nBLIPCount; 387cdf0e10cSrcweir sal_uInt16 nShapeCount; 388cdf0e10cSrcweir sal_uInt32 nGroupShapeFlags; 389cdf0e10cSrcweir 390cdf0e10cSrcweir void CheckTxBxStoryChain(); 391cdf0e10cSrcweir void GetFidclData( long nOffsDgg ); 392cdf0e10cSrcweir 393cdf0e10cSrcweir protected : 394cdf0e10cSrcweir 395cdf0e10cSrcweir String maBaseURL; 396cdf0e10cSrcweir sal_uInt32 mnCurMaxShapeId; // we need this information to 397cdf0e10cSrcweir sal_uInt32 mnDrawingsSaved; // access the right drawing 398cdf0e10cSrcweir sal_uInt32 mnIdClusters; // while only knowing the shapeid 399cdf0e10cSrcweir FIDCL* mpFidcls; 400cdf0e10cSrcweir Table maDgOffsetTable; // array of fileoffsets 401cdf0e10cSrcweir 402cdf0e10cSrcweir friend class DffPropertyReader; 403cdf0e10cSrcweir 404cdf0e10cSrcweir SvStream& rStCtrl; 405cdf0e10cSrcweir SvStream* pStData; 406cdf0e10cSrcweir SvStream* pStData2; 407cdf0e10cSrcweir SdrModel* pSdrModel; 408cdf0e10cSrcweir 409cdf0e10cSrcweir long nMapMul; 410cdf0e10cSrcweir long nMapDiv; 411cdf0e10cSrcweir long nMapXOfs; 412cdf0e10cSrcweir long nMapYOfs; 413cdf0e10cSrcweir long nEmuMul; 414cdf0e10cSrcweir long nEmuDiv; 415cdf0e10cSrcweir long nPntMul; 416cdf0e10cSrcweir long nPntDiv; 417cdf0e10cSrcweir FASTBOOL bNeedMap; 418cdf0e10cSrcweir sal_uInt32 nSvxMSDffSettings; 419cdf0e10cSrcweir sal_uInt32 nSvxMSDffOLEConvFlags; 420cdf0e10cSrcweir 421cdf0e10cSrcweir /** stores a reference to an imported SdrObject with its shape id if 422cdf0e10cSrcweir it has one 423cdf0e10cSrcweir */ 424cdf0e10cSrcweir SvxMSDffShapeIdContainer maShapeIdContainer; 425cdf0e10cSrcweir 426cdf0e10cSrcweir void GetCtrlData( long nOffsDgg ); 427cdf0e10cSrcweir void GetDrawingGroupContainerData( SvStream& rSt, 428cdf0e10cSrcweir sal_uLong nLenDgg ); 429cdf0e10cSrcweir // --> OD 2008-08-01 #156763# 430cdf0e10cSrcweir // Add internal drawing container id as parameter to the sub methods of 431cdf0e10cSrcweir // reading the control information about the drawing objects. 432cdf0e10cSrcweir // The drawing container id is used to distinguish the text ids of drawing 433cdf0e10cSrcweir // objects in different drawing containers. 434cdf0e10cSrcweir void GetDrawingContainerData( SvStream& rSt, 435cdf0e10cSrcweir sal_uLong nLenDg, 436cdf0e10cSrcweir const unsigned long nDrawingContainerId ); 437cdf0e10cSrcweir sal_Bool GetShapeGroupContainerData( SvStream& rSt, 438cdf0e10cSrcweir sal_uLong nLenShapeGroupCont, 439cdf0e10cSrcweir sal_Bool bPatriarch, 440cdf0e10cSrcweir const unsigned long nDrawingContainerId ); 441cdf0e10cSrcweir sal_Bool GetShapeContainerData( SvStream& rSt, 442cdf0e10cSrcweir sal_uLong nLenShapeCont, 443cdf0e10cSrcweir sal_uLong nPosGroup, 444cdf0e10cSrcweir const unsigned long nDrawingContainerId ); 445cdf0e10cSrcweir // <-- 446cdf0e10cSrcweir 447cdf0e10cSrcweir FASTBOOL ReadGraphic( SvStream& rSt, sal_uLong nIndex, Graphic& rGraphic ) const; 448cdf0e10cSrcweir SdrObject* ImportFontWork( SvStream&, SfxItemSet&, Rectangle& rBoundRect ) const; 449cdf0e10cSrcweir SdrObject* ImportGraphic( SvStream&, SfxItemSet&, const DffObjData& ) const; 450cdf0e10cSrcweir // --> OD 2004-12-14 #i32596# - pass <nCalledByGroup> to method 451cdf0e10cSrcweir // Needed in the Writer Microsoft Word import to avoid import of OLE objects 452cdf0e10cSrcweir // inside groups. Instead a graphic object is created. 453cdf0e10cSrcweir virtual SdrObject* ImportOLE( long nOLEId, 454cdf0e10cSrcweir const Graphic& rGraf, 455cdf0e10cSrcweir const Rectangle& rBoundRect, 456cdf0e10cSrcweir const Rectangle& rVisArea, 457cdf0e10cSrcweir const int _nCalledByGroup, 458cdf0e10cSrcweir sal_Int64 nAspect ) const; 459cdf0e10cSrcweir // <-- 460cdf0e10cSrcweir SdrObject* GetAutoForm( MSO_SPT eTyp ) const; 461cdf0e10cSrcweir #ifndef SVX_LIGHT 462cdf0e10cSrcweir static com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > CheckForConvertToSOObj( 463cdf0e10cSrcweir sal_uInt32 nConvertFlags, SotStorage& rSrcStg, 464cdf0e10cSrcweir const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xDestStg, 465cdf0e10cSrcweir const Graphic& rGrf, 466cdf0e10cSrcweir const Rectangle& rVisArea ); 467cdf0e10cSrcweir #endif 468cdf0e10cSrcweir 469cdf0e10cSrcweir /* 470cdf0e10cSrcweir folgende Methoden sind zum Excel-Import zu ueberschreiben: 471cdf0e10cSrcweir */ 472cdf0e10cSrcweir virtual sal_Bool ProcessClientAnchor(SvStream& rStData, sal_uLong nDatLen, char*& rpBuff, sal_uInt32& rBuffLen ) const; 473cdf0e10cSrcweir virtual void ProcessClientAnchor2( SvStream& rStData, DffRecordHeader& rHd, void* pData, DffObjData& ); 474cdf0e10cSrcweir virtual sal_Bool ProcessClientData( SvStream& rStData, sal_uLong nDatLen, char*& rpBuff, sal_uInt32& rBuffLen ) const; 475cdf0e10cSrcweir virtual SdrObject* ProcessObj( SvStream& rSt, DffObjData& rData, void* pData, Rectangle& rTextRect, SdrObject* pObj = NULL); 476cdf0e10cSrcweir virtual sal_uLong Calc_nBLIPPos( sal_uLong nOrgVal, sal_uLong nStreamPos ) const; 477cdf0e10cSrcweir virtual FASTBOOL GetColorFromPalette(sal_uInt16 nNum, Color& rColor) const; 478cdf0e10cSrcweir 479cdf0e10cSrcweir // SJ: New implementation of ReadObjText is used by Fontwork objects, because 480cdf0e10cSrcweir // the old one does not properly import multiple paragraphs 481cdf0e10cSrcweir void ReadObjText( const String& rText, SdrObject* pObj ) const; 482cdf0e10cSrcweir // ----------------------------------------------------------------------- 483cdf0e10cSrcweir 484cdf0e10cSrcweir /* 485cdf0e10cSrcweir folgende Methode ist von allen zu ueberschreiben, die OLE-Objecte 486cdf0e10cSrcweir importieren moechten: 487cdf0e10cSrcweir */ 488cdf0e10cSrcweir virtual sal_Bool GetOLEStorageName( long nOLEId, String& rStorageName, 489cdf0e10cSrcweir SotStorageRef& rSrcStorage, 490cdf0e10cSrcweir com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xDestStg 491cdf0e10cSrcweir ) const; 492cdf0e10cSrcweir 493cdf0e10cSrcweir /* 494cdf0e10cSrcweir folgende Methode ist von allen zu ueberschreiben, die verhindern 495cdf0e10cSrcweir moechten, dass (abgerundete) Rechtecke mit umgebrochenem Text 496cdf0e10cSrcweir immer in SdrRectObj( OBJ_TEXT ) umgewandelt werden: 497cdf0e10cSrcweir sal_True bedeutet umwandeln. 498cdf0e10cSrcweir */ 499cdf0e10cSrcweir virtual sal_Bool ShapeHasText(sal_uLong nShapeId, sal_uLong nFilePos) const; 500cdf0e10cSrcweir 501cdf0e10cSrcweir public: 502cdf0e10cSrcweir 503cdf0e10cSrcweir void* pSvxMSDffDummy1; 504cdf0e10cSrcweir void* pSvxMSDffDummy2; 505ef660199SEike Rathke DffPropertyReader* pSecPropSet; 506cdf0e10cSrcweir List* pEscherBlipCache; 507cdf0e10cSrcweir 508cdf0e10cSrcweir DffRecordManager maShapeRecords; 509cdf0e10cSrcweir ColorData mnDefaultColor; 510cdf0e10cSrcweir 511cdf0e10cSrcweir MSFilterTracer* mpTracer; 512cdf0e10cSrcweir sal_Bool mbTracing; 513cdf0e10cSrcweir 514cdf0e10cSrcweir Color MSO_TEXT_CLR_ToColor( sal_uInt32 nColorCode ) const; 515cdf0e10cSrcweir Color MSO_CLR_ToColor( sal_uInt32 nColorCode, sal_uInt16 nContextProperty = DFF_Prop_lineColor ) const; 516cdf0e10cSrcweir virtual sal_Bool SeekToShape( SvStream& rSt, void* pClientData, sal_uInt32 nId ) const; 517cdf0e10cSrcweir FASTBOOL SeekToRec( SvStream& rSt, sal_uInt16 nRecId, sal_uLong nMaxFilePos, DffRecordHeader* pRecHd = NULL, sal_uLong nSkipCount = 0 ) const; 518cdf0e10cSrcweir FASTBOOL SeekToRec2( sal_uInt16 nRecId1, sal_uInt16 nRecId2, sal_uLong nMaxFilePos, DffRecordHeader* pRecHd = NULL, sal_uLong nSkipCount = 0 ) const; 519cdf0e10cSrcweir 520cdf0e10cSrcweir // ----------------------------------------------------------------------- 521cdf0e10cSrcweir static void MSDFFReadZString( SvStream& rIn, String& rStr, sal_uLong nMaxLen, FASTBOOL bUniCode = sal_False ); 522cdf0e10cSrcweir 523cdf0e10cSrcweir static sal_Bool ReadCommonRecordHeader( DffRecordHeader& rRec, SvStream& rIn ); 524cdf0e10cSrcweir static sal_Bool ReadCommonRecordHeader( SvStream& rSt, 525cdf0e10cSrcweir sal_uInt8& rVer, 526cdf0e10cSrcweir sal_uInt16& rInst, 527cdf0e10cSrcweir sal_uInt16& rFbt, 528cdf0e10cSrcweir sal_uInt32& rLength ); 529cdf0e10cSrcweir /* 530cdf0e10cSrcweir Konstruktor 531cdf0e10cSrcweir =========== 532cdf0e10cSrcweir Input: rStCtrl - Verwaltungsstream mit Containern, 533cdf0e10cSrcweir FBSE Objekten und Shapes 534cdf0e10cSrcweir ( muss immer uebergeben werden; 535cdf0e10cSrcweir Stream muss bereits offen sein ) 536cdf0e10cSrcweir 537cdf0e10cSrcweir nOffsDgg - Offset im rStCtrl: Beginn des Drawing Group Containers 538cdf0e10cSrcweir 539cdf0e10cSrcweir pStData - Datenstream, in dem die BLIPs gespeichert sind 540cdf0e10cSrcweir ( falls Null, wird angenommen, dass die 541cdf0e10cSrcweir BLIPs ebenfalls im rStCtrl gespeichert sind; 542cdf0e10cSrcweir dieser Stream muss ebenfalls bereits offen sein ) 543cdf0e10cSrcweir pSdrModel_ kann beim Ctor-Aufruf leer bleiben, muss dann aber 544cdf0e10cSrcweir spaeter ueber SetModel() gesetzt werden! 545cdf0e10cSrcweir 546cdf0e10cSrcweir setzt nBLIPCount 547cdf0e10cSrcweir */ 548cdf0e10cSrcweir SvxMSDffManager( SvStream& rStCtrl, 549cdf0e10cSrcweir const String& rBaseURL, 550cdf0e10cSrcweir long nOffsDgg, 551cdf0e10cSrcweir SvStream* pStData, 552cdf0e10cSrcweir SdrModel* pSdrModel_ = 0, 553cdf0e10cSrcweir long nApplicationScale = 0, 554cdf0e10cSrcweir ColorData mnDefaultColor_ = COL_DEFAULT, 555cdf0e10cSrcweir sal_uLong nDefaultFontHeight_ = 24, 556cdf0e10cSrcweir SvStream* pStData2_ = 0, 557cdf0e10cSrcweir MSFilterTracer* pTracer = NULL ); 558cdf0e10cSrcweir 559cdf0e10cSrcweir // in PPT werden die Parameter DGGContainerOffset und PicStream 560cdf0e10cSrcweir // mit Hilfe einer Init Routine Uebergeben. 561cdf0e10cSrcweir SvxMSDffManager( SvStream& rStCtrl, const String& rBaseURL, MSFilterTracer* pTracer ); 562cdf0e10cSrcweir void InitSvxMSDffManager( long nOffsDgg_, SvStream* pStData_, sal_uInt32 nSvxMSDffOLEConvFlags ); 563cdf0e10cSrcweir void SetDgContainer( SvStream& rSt ); 564cdf0e10cSrcweir 565cdf0e10cSrcweir virtual ~SvxMSDffManager(); 566cdf0e10cSrcweir GetSvxMSDffSettings() const567cdf0e10cSrcweir sal_uInt32 GetSvxMSDffSettings() const { return nSvxMSDffSettings; }; SetSvxMSDffSettings(sal_uInt32 nSettings)568cdf0e10cSrcweir void SetSvxMSDffSettings( sal_uInt32 nSettings ) { nSvxMSDffSettings = nSettings; }; 569cdf0e10cSrcweir 570cdf0e10cSrcweir static sal_Bool MakeContentStream( SotStorage * pStor, const GDIMetaFile & ); 571cdf0e10cSrcweir static sal_Bool ConvertToOle2( SvStream& rStm, sal_uInt32 nLen, const GDIMetaFile*, 572cdf0e10cSrcweir const SotStorageRef & rDest ); 573cdf0e10cSrcweir 574cdf0e10cSrcweir void SetModel(SdrModel* pModel, long nApplicationScale); GetModel() const575cdf0e10cSrcweir SdrModel* GetModel() const { return pSdrModel; } 576cdf0e10cSrcweir void Scale(sal_Int32& rVal) const; 577cdf0e10cSrcweir void Scale(Point& rPos) const; 578cdf0e10cSrcweir void Scale(Size& rSiz) const; 579cdf0e10cSrcweir void Scale(Rectangle& rRect) const; 580cdf0e10cSrcweir void Scale(Polygon& rPoly) const; 581cdf0e10cSrcweir void Scale(PolyPolygon& rPoly) const; 582cdf0e10cSrcweir void ScaleEmu(sal_Int32& rVal) const; 583cdf0e10cSrcweir sal_uInt32 ScalePt( sal_uInt32 nPt ) const; 584cdf0e10cSrcweir sal_Int32 ScalePoint( sal_Int32 nVal ) const; 585cdf0e10cSrcweir 586cdf0e10cSrcweir /* 587cdf0e10cSrcweir GetBLIP() - Anforderung eines bestimmten BLIP 588cdf0e10cSrcweir ========= 589cdf0e10cSrcweir Input: nIdx - Nummer des angeforderten BLIP 590cdf0e10cSrcweir ( muss immer uebergeben werden ) 591cdf0e10cSrcweir 592cdf0e10cSrcweir Output: rData - bereits fertig konvertierte Daten 593cdf0e10cSrcweir ( direkt als Grafik in unsere Dokumente einzusetzen ) 594cdf0e10cSrcweir 595cdf0e10cSrcweir Rueckgabewert: sal_True, im Erfolgsfalls, sal_False bei Fehler 596cdf0e10cSrcweir */ 597cdf0e10cSrcweir sal_Bool GetBLIP( sal_uLong nIdx, Graphic& rData, Rectangle* pVisArea = NULL ) const; 598cdf0e10cSrcweir 599cdf0e10cSrcweir /* 600cdf0e10cSrcweir GetBLIPDirect() -Einlesen eines BLIP aus schon positioniertem Stream 601cdf0e10cSrcweir =============== 602cdf0e10cSrcweir Input: rBLIPStream -bereits korrekt positionierter Stream 603cdf0e10cSrcweir ( muss immer uebergeben werden ) 604cdf0e10cSrcweir 605cdf0e10cSrcweir Output: rData -bereits fertig konvertierte Daten 606cdf0e10cSrcweir ( direkt als Grafik in unsere Dokumente einzusetzen ) 607cdf0e10cSrcweir 608cdf0e10cSrcweir Rueckgabewert: sal_True, im Erfolgsfalls, sal_False bei Fehler 609cdf0e10cSrcweir */ 610cdf0e10cSrcweir sal_Bool GetBLIPDirect(SvStream& rBLIPStream, Graphic& rData, Rectangle* pVisArea = NULL ) const; 611cdf0e10cSrcweir 612cdf0e10cSrcweir sal_Bool GetShape(sal_uLong nId, 613cdf0e10cSrcweir SdrObject*& rpData, SvxMSDffImportData& rData); 614cdf0e10cSrcweir 615cdf0e10cSrcweir /* 616cdf0e10cSrcweir GetBLIPCount() - Abfrage der verwalteten BLIP Anzahl 617cdf0e10cSrcweir ============== 618cdf0e10cSrcweir Input: ./. 619cdf0e10cSrcweir Output: ./. 620cdf0e10cSrcweir Rueckgabewert: nBLIPCount - Anzahl der im pStData (bzw. rStCtrl) enthaltenen BLIPs 621cdf0e10cSrcweir ( sprich: Anzahl der FBSEs im Drawing Group Container ) 622cdf0e10cSrcweir 623cdf0e10cSrcweir Werte: 0 - Struktur Ok, jedoch keine BLIPs vorhanden 624cdf0e10cSrcweir 1.. - Anzahl der BLIPs 625cdf0e10cSrcweir USHRT_MAX - Fehler: kein korrektes Drawing File Format 626cdf0e10cSrcweir */ GetBLIPCount() const627cdf0e10cSrcweir sal_uInt16 GetBLIPCount() const{ return nBLIPCount; } 628cdf0e10cSrcweir 629cdf0e10cSrcweir /* 630cdf0e10cSrcweir ZCodecDecompressed() - Dekomprimierung eines komp. WMF oder Enhanced WMF 631cdf0e10cSrcweir ==================== 632cdf0e10cSrcweir Input: rIn -bereits korrekt positionierter Stream, 633cdf0e10cSrcweir der das komprimierte Bild enthaelt 634cdf0e10cSrcweir rOut -bereits korrekt positionierter Ausgabe-Stream, 635cdf0e10cSrcweir 636cdf0e10cSrcweir bLookForEnd -Flag, ob das komp. Bild bis zum Stream-Ende reicht. 637cdf0e10cSrcweir Falls sal_True, wird jeweils geprueft, ob das gelesene noch 638cdf0e10cSrcweir zum Bild gehoert. 639cdf0e10cSrcweir Falls sal_False, wird bis zum Stream-Ende gelesen. 640cdf0e10cSrcweir 641cdf0e10cSrcweir Output: rIn -Der Stream steht hinter dem Ende des komp. Bildes. 642cdf0e10cSrcweir (es kann aber noch eine Ende-Kennung und CRC-Sum folgen) 643cdf0e10cSrcweir rOut -Der Stream enthaelt das dekomprimierte Bild. 644cdf0e10cSrcweir Der Stream wird auf den Anfang des Bildes positioniert. 645cdf0e10cSrcweir (also dorthin, wo der Stream vor der Verarbeitung stand) 646cdf0e10cSrcweir 647cdf0e10cSrcweir Rueckgabewert: sal_True, im Erfolgsfall 648cdf0e10cSrcweir sal_False bei Fehler oder Null Bytes geschrieben 649cdf0e10cSrcweir */ 650cdf0e10cSrcweir // static sal_Bool ZCodecDecompressed( SvStream& rIn, 651cdf0e10cSrcweir // SvStream& rOut, 652cdf0e10cSrcweir // sal_Bool bLookForEnd ); 653cdf0e10cSrcweir // 654cdf0e10cSrcweir SdrObject* ImportObj(SvStream& rSt, void* pData, 655cdf0e10cSrcweir Rectangle& rClientRect, const Rectangle& rGlobalChildRect, int nCalledByGroup = 0, sal_Int32* pShapeId = NULL); 656cdf0e10cSrcweir 657cdf0e10cSrcweir SdrObject* ImportGroup( const DffRecordHeader& rHd, SvStream& rSt, void* pData, 658cdf0e10cSrcweir Rectangle& rClientRect, const Rectangle& rGlobalChildRect, int nCalledByGroup = 0, sal_Int32* pShapeId = NULL ); 659cdf0e10cSrcweir 660cdf0e10cSrcweir SdrObject* ImportShape( const DffRecordHeader& rHd, SvStream& rSt, void* pData, 661*49ac0a79SDon Lewis Rectangle& rClientRect, const Rectangle& rGlobalChildRect, int nCalledByGroup = 0, sal_Int32* pShapeId = NULL, sal_Bool bShapeGroup = sal_False); 662cdf0e10cSrcweir 663cdf0e10cSrcweir Rectangle GetGlobalChildAnchor( const DffRecordHeader& rHd, SvStream& rSt, Rectangle& aClientRect ); 664cdf0e10cSrcweir void GetGroupAnchors( const DffRecordHeader& rHd, SvStream& rSt, 665cdf0e10cSrcweir Rectangle& rGroupClientAnchor, Rectangle& rGroupChildAnchor, 666cdf0e10cSrcweir const Rectangle& rClientRect, const Rectangle& rGlobalChildRect ); 667cdf0e10cSrcweir GetShapeInfos(void) const668cdf0e10cSrcweir inline const SvxMSDffShapeInfos* GetShapeInfos( void ) const 669cdf0e10cSrcweir { 670cdf0e10cSrcweir return pShapeInfos; 671cdf0e10cSrcweir } 672cdf0e10cSrcweir GetShapeOrders(void) const673cdf0e10cSrcweir inline const SvxMSDffShapeOrders* GetShapeOrders( void ) const 674cdf0e10cSrcweir { 675cdf0e10cSrcweir return pShapeOrders; 676cdf0e10cSrcweir } 677cdf0e10cSrcweir 678cdf0e10cSrcweir void StoreShapeOrder(sal_uLong nId, 679cdf0e10cSrcweir sal_uLong nTxBx, 680cdf0e10cSrcweir SdrObject* pObject, 681cdf0e10cSrcweir SwFlyFrmFmt* pFly = 0, 682cdf0e10cSrcweir short nHdFtSection = 0) const; 683cdf0e10cSrcweir 684cdf0e10cSrcweir void ExchangeInShapeOrder(SdrObject* pOldObject, 685cdf0e10cSrcweir sal_uLong nTxBx, 686cdf0e10cSrcweir SwFlyFrmFmt* pFly, 687cdf0e10cSrcweir SdrObject* pObject) const; 688cdf0e10cSrcweir 689cdf0e10cSrcweir void RemoveFromShapeOrder( SdrObject* pObject ) const; 690cdf0e10cSrcweir GetConvertFlags() const691cdf0e10cSrcweir sal_uInt32 GetConvertFlags() const { return nSvxMSDffOLEConvFlags; } 692cdf0e10cSrcweir 693cdf0e10cSrcweir static SdrOle2Obj* CreateSdrOLEFromStorage( const String& rStorageName, 694cdf0e10cSrcweir SotStorageRef& rSrcStorage, 695cdf0e10cSrcweir const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xDestStg, 696cdf0e10cSrcweir const Graphic& rGraf, 697cdf0e10cSrcweir const Rectangle& rBoundRect, 698cdf0e10cSrcweir const Rectangle& rVisArea, 699cdf0e10cSrcweir SvStream* pDataStrrm, 700cdf0e10cSrcweir ErrCode& rError, 701cdf0e10cSrcweir sal_uInt32 nConvertFlags, 702cdf0e10cSrcweir sal_Int64 nAspect ); 703cdf0e10cSrcweir 704cdf0e10cSrcweir /* the method SolveSolver will create connections between shapes, it should be called after a page is imported. 705cdf0e10cSrcweir The SvxMSDffSolverContainer is containing necessary data data that is collected during the import of each shape 706cdf0e10cSrcweir */ 707cdf0e10cSrcweir void SolveSolver( const SvxMSDffSolverContainer& rSolver ); 708cdf0e10cSrcweir 709cdf0e10cSrcweir static sal_Bool SetPropValue( 710cdf0e10cSrcweir const ::com::sun::star::uno::Any& rAny, 711cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, 712cdf0e10cSrcweir const String& rPropertyName, 713cdf0e10cSrcweir sal_Bool bTestPropertyAvailability = sal_False ); 714cdf0e10cSrcweir 715cdf0e10cSrcweir void insertShapeId( sal_Int32 nShapeId, SdrObject* pShape ); 716cdf0e10cSrcweir void removeShapeId( SdrObject* pShape ); 717cdf0e10cSrcweir SdrObject* getShapeForId( sal_Int32 nShapeId ); 718cdf0e10cSrcweir }; 719cdf0e10cSrcweir 720cdf0e10cSrcweir struct SvxMSDffBLIPInfo 721cdf0e10cSrcweir { 722cdf0e10cSrcweir sal_uInt16 nBLIPType; // Art des BLIP: z.B. 6 fuer PNG 723cdf0e10cSrcweir sal_uLong nFilePos; // Offset des BLIP im Daten-Stream 724cdf0e10cSrcweir sal_uLong nBLIPSize; // Anzahl Bytes, die der BLIP im Stream einnimmt SvxMSDffBLIPInfoSvxMSDffBLIPInfo725cdf0e10cSrcweir SvxMSDffBLIPInfo(sal_uInt16 nBType, sal_uLong nFPos, sal_uLong nBSize): 726cdf0e10cSrcweir nBLIPType( nBType ), nFilePos( nFPos ), nBLIPSize( nBSize ){} 727cdf0e10cSrcweir }; 728cdf0e10cSrcweir 729cdf0e10cSrcweir struct SvxMSDffShapeInfo 730cdf0e10cSrcweir { 731cdf0e10cSrcweir sal_uInt32 nShapeId; // Shape Id, verwendet im PLCF SPA und im mso_fbtSp (FSP) 732cdf0e10cSrcweir sal_uLong nFilePos; // Offset des Shape im Kontroll-Stream fuer eventuelle 733cdf0e10cSrcweir // erneute Zugriffe auf dieses Shape 734cdf0e10cSrcweir sal_uInt32 nTxBxComp; 735cdf0e10cSrcweir 736cdf0e10cSrcweir sal_Bool bReplaceByFly :1; // Shape darf im Writer durch Rahmen ersetzt werden. 737cdf0e10cSrcweir sal_Bool bSortByShapeId :1; 738cdf0e10cSrcweir sal_Bool bLastBoxInChain:1; 739cdf0e10cSrcweir SvxMSDffShapeInfoSvxMSDffShapeInfo740cdf0e10cSrcweir SvxMSDffShapeInfo(sal_uLong nFPos, sal_uInt32 nId=0, // sal_uLong nBIdx=0, 741cdf0e10cSrcweir sal_uInt16 nSeqId=0, sal_uInt16 nBoxId=0): 742cdf0e10cSrcweir nShapeId( nId ), 743cdf0e10cSrcweir nFilePos( nFPos ), 744cdf0e10cSrcweir nTxBxComp( (nSeqId << 16) + nBoxId ) 745cdf0e10cSrcweir { 746cdf0e10cSrcweir bReplaceByFly = sal_False; 747cdf0e10cSrcweir bSortByShapeId = sal_False; 748cdf0e10cSrcweir bLastBoxInChain = sal_True; 749cdf0e10cSrcweir } SvxMSDffShapeInfoSvxMSDffShapeInfo750cdf0e10cSrcweir SvxMSDffShapeInfo(SvxMSDffShapeInfo& rInfo): 751cdf0e10cSrcweir nShapeId( rInfo.nShapeId ), 752cdf0e10cSrcweir nFilePos( rInfo.nFilePos ), 753cdf0e10cSrcweir nTxBxComp( rInfo.nTxBxComp ) 754cdf0e10cSrcweir { 755cdf0e10cSrcweir bReplaceByFly = rInfo.bReplaceByFly; 756cdf0e10cSrcweir bSortByShapeId = rInfo.bSortByShapeId; 757cdf0e10cSrcweir bLastBoxInChain = rInfo.bLastBoxInChain; 758cdf0e10cSrcweir } operator ==SvxMSDffShapeInfo759cdf0e10cSrcweir sal_Bool operator==( const SvxMSDffShapeInfo& rEntry ) const 760cdf0e10cSrcweir { 761cdf0e10cSrcweir return bSortByShapeId ? (nShapeId == rEntry.nShapeId) 762cdf0e10cSrcweir : (nTxBxComp == rEntry.nTxBxComp && this == &rEntry); 763cdf0e10cSrcweir } operator <SvxMSDffShapeInfo764cdf0e10cSrcweir sal_Bool operator<( const SvxMSDffShapeInfo& rEntry ) const 765cdf0e10cSrcweir { 766cdf0e10cSrcweir return bSortByShapeId ? (nShapeId < rEntry.nShapeId) 767cdf0e10cSrcweir : (nTxBxComp < rEntry.nTxBxComp); 768cdf0e10cSrcweir } 769cdf0e10cSrcweir }; 770cdf0e10cSrcweir 771cdf0e10cSrcweir struct SvxMSDffShapeOrder 772cdf0e10cSrcweir { 773cdf0e10cSrcweir sal_uLong nShapeId; // Shape Id, verwendet im PLCF SPA und im mso_fbtSp (FSP) 774cdf0e10cSrcweir 775cdf0e10cSrcweir sal_uLong nTxBxComp; // Ketten- und Boxnummer in der Text-Box-Story (bzw. Null) 776cdf0e10cSrcweir 777cdf0e10cSrcweir SwFlyFrmFmt* pFly; // Frame-Format eines statt des Sdr-Text-Objektes im 778cdf0e10cSrcweir // Writer eingefuegten Rahmens: zur Verkettung benoetigt! 779cdf0e10cSrcweir 780cdf0e10cSrcweir short nHdFtSection; // used by Writer to find out if linked frames are in the 781cdf0e10cSrcweir // same header or footer of the same section 782cdf0e10cSrcweir 783cdf0e10cSrcweir SdrObject* pObj; // Zeiger auf das Draw-Objekt (bzw. Null, falls nicht verwendet) 784cdf0e10cSrcweir 785cdf0e10cSrcweir // Vorgehensweise: im Ctor des SvxMSDffManager werden im der Shape-Order-Array 786cdf0e10cSrcweir // nur die Shape-Ids vermerkt, 787cdf0e10cSrcweir // Text-Box-Nummer und der Objekt-Pointer werden nur dann 788cdf0e10cSrcweir // gespeichert, wenn das Shape tatsaechlich importiert wird! SvxMSDffShapeOrderSvxMSDffShapeOrder789cdf0e10cSrcweir SvxMSDffShapeOrder( sal_uLong nId ): 790cdf0e10cSrcweir nShapeId( nId ), nTxBxComp( 0 ), pFly( 0 ), nHdFtSection( 0 ), pObj( 0 ){} 791cdf0e10cSrcweir operator ==SvxMSDffShapeOrder792cdf0e10cSrcweir sal_Bool operator==( const SvxMSDffShapeOrder& rEntry ) const 793cdf0e10cSrcweir { 794cdf0e10cSrcweir return (nTxBxComp == rEntry.nTxBxComp); 795cdf0e10cSrcweir } operator <SvxMSDffShapeOrder796cdf0e10cSrcweir sal_Bool operator<( const SvxMSDffShapeOrder& rEntry ) const 797cdf0e10cSrcweir { 798cdf0e10cSrcweir return (nTxBxComp < rEntry.nTxBxComp); 799cdf0e10cSrcweir } 800cdf0e10cSrcweir }; 801cdf0e10cSrcweir 802cdf0e10cSrcweir #endif 803cdf0e10cSrcweir 804