LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/filter/msfilter - msdffimp.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 56 65 86.2 %
Date: 2012-08-25 Functions: 32 37 86.5 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 4 50.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef FLT_MSDFFIMP_HXX
      30                 :            : #define FLT_MSDFFIMP_HXX
      31                 :            : 
      32                 :            : #include <string.h>
      33                 :            : 
      34                 :            : #include <map>
      35                 :            : #include <vector>
      36                 :            : #include <set>
      37                 :            : 
      38                 :            : #include <boost/shared_ptr.hpp>
      39                 :            : #include <boost/scoped_ptr.hpp>
      40                 :            : #include <boost/ptr_container/ptr_vector.hpp>
      41                 :            : #include <boost/ptr_container/ptr_set.hpp>
      42                 :            : 
      43                 :            : #include <com/sun/star/uno/Reference.h>
      44                 :            : #include <com/sun/star/embed/XEmbeddedObject.hpp>
      45                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      46                 :            : 
      47                 :            : #include <tools/solar.h>
      48                 :            : #include <tools/color.hxx>
      49                 :            : #include <tools/gen.hxx>
      50                 :            : 
      51                 :            : #include <sot/storage.hxx>
      52                 :            : 
      53                 :            : #include <vcl/graph.hxx>
      54                 :            : 
      55                 :            : #include <svx/msdffdef.hxx>
      56                 :            : 
      57                 :            : #include <filter/msfilter/msfilterdllapi.h>
      58                 :            : 
      59                 :            : 
      60                 :            : class Graphic;
      61                 :            : class SvStream;
      62                 :            : class SdrObject;
      63                 :            : class SdrOle2Obj;
      64                 :            : class SotStorageRef;
      65                 :            : class Polygon;
      66                 :            : class PolyPolygon;
      67                 :            : class FmFormModel;
      68                 :            : class SdrModel;
      69                 :            : class DffRecordHeader;
      70                 :            : class SwFlyFrmFmt;
      71                 :            : 
      72                 :            : struct SvxMSDffBLIPInfo;
      73                 :            : struct SvxMSDffShapeInfo;
      74                 :            : struct SvxMSDffShapeOrder;
      75                 :            : 
      76                 :            : class MSFILTER_DLLPUBLIC DffRecordHeader
      77                 :            : {
      78                 :            : public:
      79                 :            :     sal_uInt8   nRecVer; // may be DFF_PSFLAG_CONTAINER
      80                 :            :     sal_uInt16  nRecInstance;
      81                 :            :     sal_uInt16  nImpVerInst;
      82                 :            :     sal_uInt16  nRecType;
      83                 :            :     sal_uInt32  nRecLen;
      84                 :            :     sal_uLong   nFilePos;
      85                 :            : 
      86                 :      18265 :     DffRecordHeader() : nRecVer(0), nRecInstance(0), nImpVerInst(0),
      87                 :      18265 :                         nRecType(0), nRecLen(0), nFilePos(0) {}
      88                 :          0 :     bool        IsContainer() const { return nRecVer == DFF_PSFLAG_CONTAINER; }
      89                 :        663 :     sal_uLong   GetRecBegFilePos() const { return nFilePos; }
      90                 :       8880 :     sal_uLong   GetRecEndFilePos() const
      91                 :       8880 :         { return nFilePos + DFF_COMMON_RECORD_HEADER_SIZE + nRecLen; }
      92                 :      13686 :     bool SeekToEndOfRecord(SvStream& rIn) const
      93                 :            :     {
      94                 :      13686 :         sal_Size nPos = nFilePos + DFF_COMMON_RECORD_HEADER_SIZE + nRecLen;
      95                 :      13686 :         return nPos == rIn.Seek(nPos);
      96                 :            :     }
      97                 :       4873 :     bool SeekToContent(SvStream& rIn) const
      98                 :            :     {
      99                 :       4873 :         sal_Size nPos = nFilePos + DFF_COMMON_RECORD_HEADER_SIZE;
     100                 :       4873 :         return nPos == rIn.Seek(nPos);
     101                 :            :     }
     102                 :       3493 :     bool SeekToBegOfRecord(SvStream& rIn) const
     103                 :            :     {
     104                 :       3493 :         return nFilePos == rIn.Seek(nFilePos);
     105                 :            :     }
     106                 :            : 
     107                 :            :     MSFILTER_DLLPUBLIC friend SvStream& operator>>(SvStream& rIn, DffRecordHeader& rRec);
     108                 :            : };
     109                 :            : 
     110                 :            : struct DffPropFlags
     111                 :            : {
     112                 :            :     sal_uInt8   bSet        : 1;
     113                 :            :     sal_uInt8   bComplex    : 1;
     114                 :            :     sal_uInt8   bBlip       : 1;
     115                 :            :     sal_uInt8   bSoftAttr   : 1;
     116                 :            : };
     117                 :            : 
     118                 :            : class SvxMSDffManager;
     119                 :            : 
     120                 :        121 : class MSFILTER_DLLPUBLIC DffPropSet
     121                 :            : {
     122                 :            : private:
     123                 :            :     void InitializeProp(sal_uInt32 nKey, sal_uInt32 nContent,
     124                 :            :             DffPropFlags& rFlags, sal_uInt32 nRecordType) const;
     125                 :            : 
     126                 :            : protected:
     127                 :            :     typedef std::map<sal_uInt32, sal_uInt32> RecordTypesMap;
     128                 :            : 
     129                 :            :     RecordTypesMap  maRecordTypes;
     130                 :            :     sal_uInt32      mpContents[ 1024 ];
     131                 :            :     DffPropFlags    mpFlags[ 1024 ];
     132                 :            : 
     133                 :            : public:
     134                 :        121 :     explicit DffPropSet( sal_Bool bInitialize = sal_False )
     135                 :        121 :     {
     136         [ -  + ]:        121 :         if ( bInitialize )
     137                 :          0 :             memset( mpFlags, 0, 0x400 * sizeof( DffPropFlags ) );
     138                 :        121 :     };
     139                 :            : 
     140                 :      33063 :     inline sal_Bool IsProperty( sal_uInt32 nRecType ) const
     141                 :      33063 :         { return ( mpFlags[ nRecType & 0x3ff ].bSet ); };
     142                 :            :     sal_Bool        IsHardAttribute( sal_uInt32 nId ) const;
     143                 :            :     sal_uInt32      GetPropertyValue( sal_uInt32 nId, sal_uInt32 nDefault = 0 ) const;
     144                 :            :     /** Returns a boolean property by its real identifier. */
     145                 :            :     bool            GetPropertyBool( sal_uInt32 nId, bool bDefault = false ) const;
     146                 :            :     /** Returns a string property. */
     147                 :            :     ::rtl::OUString GetPropertyString( sal_uInt32 nId, SvStream& rStrm ) const;
     148                 :            :     sal_Bool        SeekToContent( sal_uInt32 nRecType, SvStream& rSt ) const;
     149                 :            :     void            Merge( DffPropSet& rMasterPropSet ) const;
     150                 :            :     void            InitializePropSet() const;
     151                 :            :     friend SvStream& operator>>( SvStream& rIn, DffPropSet& rPropSet );
     152                 :            : };
     153                 :            : 
     154                 :            : class SfxItemSet;
     155                 :            : class SdrObject;
     156                 :            : struct DffObjData;
     157                 :            : 
     158                 :            : class MSFILTER_DLLPUBLIC DffPropertyReader : public DffPropSet
     159                 :            : {
     160                 :            :     const SvxMSDffManager&  rManager;
     161                 :            :     DffPropSet*             pDefaultPropSet;
     162                 :            : 
     163                 :            :     void ApplyCustomShapeTextAttributes( SfxItemSet& rSet ) const;
     164                 :            :     void ApplyCustomShapeAdjustmentAttributes( SfxItemSet& rSet ) const;
     165                 :            :     void ApplyCustomShapeGeometryAttributes( SvStream& rIn,
     166                 :            :                                              SfxItemSet& rSet,
     167                 :            :                                              const DffObjData& rObjData ) const;
     168                 :            :     void ApplyLineAttributes( SfxItemSet& rSet, const MSO_SPT eShapeType ) const; // #i28269#
     169                 :            :     void ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, const DffObjData& rObjData ) const;
     170                 :            : 
     171                 :            : public:
     172                 :            :     sal_Int32 mnFix16Angle;
     173                 :            :     explicit DffPropertyReader( const SvxMSDffManager& rManager );
     174                 :            :     ~DffPropertyReader();
     175                 :            :     sal_Int32 Fix16ToAngle( sal_Int32 nAngle ) const;
     176                 :            : 
     177                 :            : #ifdef DBG_CUSTOMSHAPE
     178                 :            :     void ReadPropSet( SvStream& rIn, void* pClientData, sal_uInt32 nShapeType = 0 ) const;
     179                 :            : #else
     180                 :            :     void ReadPropSet( SvStream& rIn, void* pClientData ) const;
     181                 :            : #endif
     182                 :            : 
     183                 :            :     void SetDefaultPropSet( SvStream& rIn, sal_uInt32 nOffDgg ) const;
     184                 :            :     void ApplyAttributes( SvStream& rIn, SfxItemSet& rSet ) const;
     185                 :            :     void ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, const DffObjData& rObjData ) const;
     186                 :            : };
     187                 :            : 
     188                 :            : #define COL_DEFAULT RGB_COLORDATA( 0xFA, 0xFB, 0xFC )
     189                 :            : 
     190                 :            : typedef ::std::map< sal_Int32, SdrObject* > SvxMSDffShapeIdContainer;
     191                 :            : 
     192                 :            : #define SVEXT_PERSIST_STREAM "\002OlePres000"
     193                 :            : 
     194                 :            : // the following two will be sorted by the order of their appearance:
     195                 :            : typedef boost::ptr_vector<SvxMSDffBLIPInfo> SvxMSDffBLIPInfos;
     196                 :         74 : class SvxMSDffShapeOrders : public std::vector<SvxMSDffShapeOrder*>
     197                 :            : {
     198                 :            : public:
     199                 :            :     ~SvxMSDffShapeOrders();
     200                 :            : };
     201                 :            : 
     202                 :            : struct MSFILTER_DLLPUBLIC CompareSvxMSDffShapeInfoById
     203                 :            : {
     204                 :            :     bool operator()(::boost::shared_ptr<SvxMSDffShapeInfo> const& lhs,
     205                 :            :                     ::boost::shared_ptr<SvxMSDffShapeInfo> const& rhs) const;
     206                 :            : };
     207                 :            : struct MSFILTER_DLLPUBLIC CompareSvxMSDffShapeInfoByTxBxComp
     208                 :            : {
     209                 :            :     bool operator()(::boost::shared_ptr<SvxMSDffShapeInfo> const& lhs,
     210                 :            :                     ::boost::shared_ptr<SvxMSDffShapeInfo> const& rhs) const;
     211                 :            : };
     212                 :            : 
     213                 :            : // the following will be sorted explicitly:
     214                 :            : typedef ::std::set< ::boost::shared_ptr<SvxMSDffShapeInfo>,
     215                 :            :             CompareSvxMSDffShapeInfoById > SvxMSDffShapeInfos_ById;
     216                 :            : typedef ::std::multiset< ::boost::shared_ptr<SvxMSDffShapeInfo>,
     217                 :            :             CompareSvxMSDffShapeInfoByTxBxComp> SvxMSDffShapeInfos_ByTxBxComp;
     218                 :            : 
     219                 :            : #define SVXMSDFF_SETTINGS_CROP_BITMAPS      1
     220                 :            : #define SVXMSDFF_SETTINGS_IMPORT_PPT        2
     221                 :            : #define SVXMSDFF_SETTINGS_IMPORT_EXCEL      4
     222                 :            : 
     223                 :            : #define SP_FGROUP       0x001   ///< This shape is a group shape
     224                 :            : #define SP_FCHILD       0x002   ///< Not a top-level shape
     225                 :            : #define SP_FPATRIARCH   0x004   ///< This is the topmost group shape.
     226                 :            :                                 ///< Exactly one of these per drawing.
     227                 :            : #define SP_FDELETED     0x008   ///< The shape has been deleted
     228                 :            : #define SP_FOLESHAPE    0x010   ///< The shape is an OLE object
     229                 :            : #define SP_FHAVEMASTER  0x020   ///< Shape has a hspMaster property
     230                 :            : #define SP_FFLIPH       0x040   ///< Shape is flipped horizontally
     231                 :            : #define SP_FFLIPV       0x080   ///< Shape is flipped vertically
     232                 :            : #define SP_FCONNECTOR   0x100   ///< Connector type of shape
     233                 :            : #define SP_FHAVEANCHOR  0x200   ///< Shape has an anchor of some kind
     234                 :            : #define SP_FBACKGROUND  0x400   ///< Background shape
     235                 :            : #define SP_FHAVESPT     0x800   ///< Shape has a shape type property
     236                 :            : 
     237                 :            : // for the CreateSdrOLEFromStorage we need the information, how we handle
     238                 :            : // convert able OLE-Objects - this ist stored in
     239                 :            : #define OLE_MATHTYPE_2_STARMATH             0x0001
     240                 :            : #define OLE_WINWORD_2_STARWRITER            0x0002
     241                 :            : #define OLE_EXCEL_2_STARCALC                0x0004
     242                 :            : #define OLE_POWERPOINT_2_STARIMPRESS        0x0008
     243                 :            : 
     244                 :            : struct SvxMSDffConnectorRule
     245                 :            : {
     246                 :            :     sal_uInt32  nRuleId;
     247                 :            :     sal_uInt32  nShapeA;   ///< SPID of shape A
     248                 :            :     sal_uInt32  nShapeB;   ///< SPID of shape B
     249                 :            :     sal_uInt32  nShapeC;   ///< SPID of connector shape
     250                 :            :     sal_uInt32  ncptiA;    ///< Connection site Index of shape A
     251                 :            :     sal_uInt32  ncptiB;    ///< Connection site Index of shape B
     252                 :            :     sal_uInt32  nSpFlagsA; ///< SpFlags of shape A (the original mirror flags
     253                 :            :                            ///< must be known when solving the Solver Container)
     254                 :            :     sal_uInt32  nSpFlagsB; ///< SpFlags of shape B
     255                 :            : 
     256                 :            :     SdrObject*  pAObj;     ///< pPtr of object (corresponding to shape A)
     257                 :            :     SdrObject*  pBObj;     ///< pPtr of object (corresponding to shape B)
     258                 :            :     SdrObject*  pCObj;     ///< pPtr of connector object
     259                 :            : 
     260                 :          0 :     SvxMSDffConnectorRule() : nSpFlagsA( 0 ), nSpFlagsB( 0 ), pAObj( NULL ),
     261                 :          0 :                               pBObj( NULL ), pCObj( NULL ) {};
     262                 :            : 
     263                 :            :     friend SvStream& operator>>( SvStream& rIn, SvxMSDffConnectorRule& rAtom );
     264                 :            : };
     265                 :            : 
     266                 :            : typedef ::std::vector< SvxMSDffConnectorRule* > SvxMSDffConnectorRuleList;
     267                 :            : 
     268                 :            : struct MSFILTER_DLLPUBLIC SvxMSDffSolverContainer
     269                 :            : {
     270                 :            :     SvxMSDffConnectorRuleList   aCList;
     271                 :            : 
     272                 :            :     SvxMSDffSolverContainer();
     273                 :            :     ~SvxMSDffSolverContainer();
     274                 :            : 
     275                 :            :     MSFILTER_DLLPUBLIC friend SvStream& operator>>( SvStream& rIn, SvxMSDffSolverContainer& rAtom );
     276                 :            : };
     277                 :            : 
     278                 :            : struct FIDCL
     279                 :            : {
     280                 :            :     sal_uInt32  dgid;       ///< DG owning the SPIDs in this cluster
     281                 :            :     sal_uInt32  cspidCur;   ///< number of SPIDs used so far
     282                 :            : };
     283                 :            : 
     284                 :            : /// provided by SvxMSDffManager for each shape in a group
     285                 :            : struct MSDffTxId
     286                 :            : {
     287                 :            :     sal_uInt16 nTxBxS;
     288                 :            :     sal_uInt16 nSequence;
     289                 :        681 :     MSDffTxId( sal_uInt16 nTxBxS_, sal_uInt16 nSequence_ )
     290                 :        681 :         : nTxBxS( nTxBxS_ ), nSequence( nSequence_ ){}
     291                 :          0 :     MSDffTxId( const MSDffTxId& rCopy )
     292                 :          0 :         : nTxBxS( rCopy.nTxBxS ), nSequence( rCopy.nSequence ){}
     293                 :            : };
     294                 :            : 
     295                 :            : struct MSFILTER_DLLPUBLIC SvxMSDffImportRec
     296                 :            : {
     297                 :            :     static const int RELTO_DEFAULT = 2;
     298                 :            : 
     299                 :            :     SdrObject*      pObj;
     300                 :            :     Polygon*        pWrapPolygon;
     301                 :            :     char*           pClientAnchorBuffer;
     302                 :            :     sal_uInt32      nClientAnchorLen;
     303                 :            :     char*           pClientDataBuffer;
     304                 :            :     sal_uInt32      nClientDataLen;
     305                 :            :     sal_uInt32      nXAlign;
     306                 :            :     sal_uInt32      *pXRelTo;
     307                 :            :     sal_uInt32      nYAlign;
     308                 :            :     sal_uInt32      *pYRelTo;
     309                 :            :     sal_uInt32      nLayoutInTableCell;
     310                 :            :     sal_uInt32      nFlags;
     311                 :            :     long            nTextRotationAngle;
     312                 :            :     long            nDxTextLeft;    ///< distance of text box from surrounding shape
     313                 :            :     long            nDyTextTop;
     314                 :            :     long            nDxTextRight;
     315                 :            :     long            nDyTextBottom;
     316                 :            :     long            nDxWrapDistLeft;
     317                 :            :     long            nDyWrapDistTop;
     318                 :            :     long            nDxWrapDistRight;
     319                 :            :     long            nDyWrapDistBottom;
     320                 :            :     long            nCropFromTop;
     321                 :            :     long            nCropFromBottom;
     322                 :            :     long            nCropFromLeft;
     323                 :            :     long            nCropFromRight;
     324                 :            :     MSDffTxId       aTextId;        ///< identifier for text boxes
     325                 :            :     sal_uLong       nNextShapeId;   ///< for linked text boxes
     326                 :            :     sal_uLong       nShapeId;
     327                 :            :     MSO_SPT         eShapeType;
     328                 :            :     MSO_LineStyle   eLineStyle;     ///< border types
     329                 :            :     MSO_LineDashing eLineDashing;
     330                 :            :     sal_Bool        bDrawHell       :1;
     331                 :            :     sal_Bool        bHidden         :1;
     332                 :            :     sal_Bool        bReplaceByFly   :1;
     333                 :            :     sal_Bool        bLastBoxInChain :1;
     334                 :            :     sal_Bool        bHasUDefProp    :1;
     335                 :            :     sal_Bool        bVFlip          :1;
     336                 :            :     sal_Bool        bHFlip          :1;
     337                 :            :     sal_Bool        bAutoWidth      :1;
     338                 :            :     int             relativeHorizontalWidth; ///< in 0.1% or -1 for none
     339                 :            :     bool            isHorizontalRule;
     340                 :            : 
     341                 :            :     SvxMSDffImportRec();
     342                 :            :     SvxMSDffImportRec(const SvxMSDffImportRec& rCopy);
     343                 :            :     ~SvxMSDffImportRec();
     344                 :            : 
     345                 :            :     bool operator==( const SvxMSDffImportRec& rEntry ) const
     346                 :            :     {   return nShapeId == rEntry.nShapeId; }
     347                 :       1872 :     bool operator<( const SvxMSDffImportRec& rEntry ) const
     348                 :       1872 :     {   return nShapeId < rEntry.nShapeId;  }
     349                 :            : 
     350                 :            : private:
     351                 :            :     SvxMSDffImportRec &operator=(const SvxMSDffImportRec&);
     352                 :            : };
     353                 :            : 
     354                 :            : /** list of all SvxMSDffImportRec instances of/for a group */
     355                 :        354 : class MSDffImportRecords
     356                 :            :     : public ::boost::ptr_set<SvxMSDffImportRec>
     357                 :            : {};
     358                 :            : 
     359                 :            : /** block of parameters for import/export for a single call of
     360                 :            :     ImportObjAtCurrentStreamPos() */
     361                 :        177 : struct SvxMSDffImportData
     362                 :            : {
     363                 :            :     MSDffImportRecords  aRecords;   ///< Shape pointer, Shape ids and private data
     364                 :            :     Rectangle           aParentRect;///< Rectangle of the surrounding groups,
     365                 :            :                                     ///< which might have been provided externally
     366                 :            :     Rectangle           aNewRect;   ///< Rectangle that is defined by this shape
     367                 :            : 
     368                 :            :     SvxMSDffImportData()
     369                 :            :         {}
     370         [ +  - ]:        177 :     explicit SvxMSDffImportData( const Rectangle& rParentRect ) : aParentRect( rParentRect ) {}
     371                 :            :     void SetNewRect(sal_Int32 left, sal_Int32 top, sal_Int32 right, sal_Int32 bottom )
     372                 :            :         { aNewRect = Rectangle(left, top, right, bottom); }
     373                 :            :     sal_Bool HasParRect() const { return aParentRect.IsEmpty(); }
     374                 :            :     sal_Bool HasNewRect() const { return aNewRect.IsEmpty()   ; }
     375                 :        102 :     bool empty() const { return aRecords.empty(); }
     376                 :        162 :     size_t size() const { return aRecords.size(); }
     377                 :        279 :     MSDffImportRecords::const_iterator begin() const { return aRecords.begin();  }
     378                 :        708 :     MSDffImportRecords::const_iterator end() const { return aRecords.end();  }
     379                 :            : };
     380                 :            : 
     381                 :            : struct DffObjData
     382                 :            : {
     383                 :            :     const DffRecordHeader&  rSpHd;
     384                 :            : 
     385                 :            :     Rectangle   aBoundRect;
     386                 :            :     Rectangle   aChildAnchor;
     387                 :            : 
     388                 :            :     sal_uInt32  nShapeId;
     389                 :            :     sal_uInt32  nSpFlags;
     390                 :            :     MSO_SPT     eShapeType;
     391                 :            : 
     392                 :            :     sal_Bool bShapeType     : 1;
     393                 :            :     sal_Bool bClientAnchor  : 1;
     394                 :            :     sal_Bool bClientData    : 1;
     395                 :            :     sal_Bool bChildAnchor   : 1;
     396                 :            :     sal_Bool bOpt           : 1;
     397                 :            :     sal_Bool bIsAutoText    : 1;
     398                 :            : 
     399                 :            :     int nCalledByGroup;
     400                 :            : 
     401                 :        922 :     DffObjData( const DffRecordHeader& rObjHd,
     402                 :            :                 const Rectangle& rBoundRect,
     403                 :            :                 int   nClByGroup ) :
     404                 :            :         rSpHd( rObjHd ),
     405                 :            :         aBoundRect( rBoundRect ),
     406                 :            :         nShapeId( 0 ),
     407                 :            :         nSpFlags( 0 ),
     408                 :            :         eShapeType( mso_sptNil ),
     409                 :            :         bShapeType( sal_False ),
     410                 :            :         bClientAnchor( sal_False ),
     411                 :            :         bClientData( sal_False ),
     412                 :            :         bChildAnchor( sal_False ),
     413                 :            :         bOpt( sal_False ),
     414                 :            :         bIsAutoText( sal_False ),
     415                 :        922 :         nCalledByGroup( nClByGroup ){}
     416                 :            : };
     417                 :            : 
     418                 :            : #define DFF_RECORD_MANAGER_BUF_SIZE         64
     419                 :            : 
     420                 :            : struct DffRecordList
     421                 :            : {
     422                 :            :     sal_uInt32          nCount;
     423                 :            :     sal_uInt32          nCurrent;
     424                 :            :     DffRecordList*      pPrev;
     425                 :            :     DffRecordList*      pNext;
     426                 :            : 
     427                 :            :     DffRecordHeader     mHd[ DFF_RECORD_MANAGER_BUF_SIZE ];
     428                 :            : 
     429                 :            :     explicit DffRecordList( DffRecordList* pList );
     430                 :            :     ~DffRecordList();
     431                 :            : };
     432                 :            : 
     433                 :            : enum DffSeekToContentMode
     434                 :            : {
     435                 :            :     SEEK_FROM_BEGINNING,
     436                 :            :     SEEK_FROM_CURRENT,
     437                 :            :     SEEK_FROM_CURRENT_AND_RESTART
     438                 :            : };
     439                 :            : 
     440                 :            : class MSFILTER_DLLPUBLIC DffRecordManager : public DffRecordList
     441                 :            : {
     442                 :            : public :
     443                 :            :         DffRecordList*   pCList;
     444                 :            : 
     445                 :            :         void             Clear();
     446                 :            :         void             Consume( SvStream& rIn,
     447                 :            :                                   sal_Bool bAppend = sal_False,
     448                 :            :                                   sal_uInt32 nStOfs = 0 );
     449                 :            : 
     450                 :            :         sal_Bool         SeekToContent( SvStream& rIn,
     451                 :            :                                         sal_uInt16 nRecType,
     452                 :            :                                         DffSeekToContentMode eMode = SEEK_FROM_BEGINNING );
     453                 :            :         DffRecordHeader* GetRecordHeader( sal_uInt16 nRecType,
     454                 :            :                                           DffSeekToContentMode eMode = SEEK_FROM_BEGINNING );
     455                 :            : 
     456                 :            :         DffRecordManager();
     457                 :            :         explicit DffRecordManager( SvStream& rIn );
     458                 :            :         ~DffRecordManager();
     459                 :            : 
     460                 :            :         DffRecordHeader* Current();
     461                 :            :         DffRecordHeader* First();
     462                 :            :         DffRecordHeader* Next();
     463                 :            :         DffRecordHeader* Prev();
     464                 :            :         DffRecordHeader* Last();
     465                 :            : };
     466                 :            : 
     467                 :            : /** abstract base class for Escher imports
     468                 :            : 
     469                 :            :     Purpose: access to objects in Drawing File Format
     470                 :            : 
     471                 :            :     Note: The method ProcessUserDefinedRecord() _has_ to be implemented in the
     472                 :            :           inheriting class(es) that is/are eventually used for PowerPoint, Word,
     473                 :            :           or Excel importing.
     474                 :            : 
     475                 :            :     Status: Currently only access to BLIPs (will be extended later)
     476                 :            : */
     477                 :            : class MSFILTER_DLLPUBLIC SvxMSDffManager : public DffPropertyReader
     478                 :            : {
     479                 :            :     FmFormModel*            pFormModel;
     480                 :            :     SvxMSDffBLIPInfos*      pBLIPInfos;
     481                 :            :     ::boost::scoped_ptr<SvxMSDffShapeInfos_ByTxBxComp> m_pShapeInfosByTxBxComp;
     482                 :            :     ::boost::scoped_ptr<SvxMSDffShapeInfos_ById> m_pShapeInfosById;
     483                 :            :     SvxMSDffShapeOrders*    pShapeOrders;
     484                 :            :     sal_uLong               nDefaultFontHeight;
     485                 :            :     sal_uInt32              nOffsDgg;
     486                 :            :     sal_uInt16              nBLIPCount;
     487                 :            :     sal_uInt16              nShapeCount;
     488                 :            :     sal_uInt32              nGroupShapeFlags;
     489                 :            : 
     490                 :            :     void CheckTxBxStoryChain();
     491                 :            :     void GetFidclData(sal_uInt32 nOffsDgg);
     492                 :            : 
     493                 :            : protected :
     494                 :            :     typedef std::map<sal_uInt32, sal_uInt32> OffsetMap;
     495                 :            : 
     496                 :            :     String          maBaseURL;
     497                 :            :     sal_uInt32      mnCurMaxShapeId;    // we need this information to
     498                 :            :     sal_uInt32      mnDrawingsSaved;    // access the right drawing
     499                 :            :     sal_uInt32      mnIdClusters;       // while only knowing the shapeid
     500                 :            :     std::vector<FIDCL> maFidcls;
     501                 :            :     OffsetMap       maDgOffsetTable;    ///< array of fileoffsets
     502                 :            : 
     503                 :            :     friend class DffPropertyReader;
     504                 :            : 
     505                 :            :     SvStream&       rStCtrl;
     506                 :            :     SvStream*       pStData;
     507                 :            :     SvStream*       pStData2;
     508                 :            :     SdrModel*       pSdrModel;
     509                 :            : 
     510                 :            :     long            nMapMul;
     511                 :            :     long            nMapDiv;
     512                 :            :     long            nMapXOfs;
     513                 :            :     long            nMapYOfs;
     514                 :            :     long            nEmuMul;
     515                 :            :     long            nEmuDiv;
     516                 :            :     long            nPntMul;
     517                 :            :     long            nPntDiv;
     518                 :            :     bool            bNeedMap;
     519                 :            :     sal_uInt32      nSvxMSDffSettings;
     520                 :            :     sal_uInt32      nSvxMSDffOLEConvFlags;
     521                 :            : 
     522                 :            :     /** stores a reference to an imported SdrObject
     523                 :            :         with its shape id if it has one */
     524                 :            :     SvxMSDffShapeIdContainer    maShapeIdContainer;
     525                 :            : 
     526                 :            :     void GetCtrlData(sal_uInt32 nOffsDgg);
     527                 :            :     void GetDrawingGroupContainerData( SvStream& rSt,
     528                 :            :                                        sal_uLong nLenDgg );
     529                 :            :     // #156763#
     530                 :            :     // Add internal drawing container id as parameter to the sub methods of
     531                 :            :     // reading the control information about the drawing objects.
     532                 :            :     // The drawing container id is used to distinguish the text ids of drawing
     533                 :            :     // objects in different drawing containers.
     534                 :            :     void GetDrawingContainerData( SvStream& rSt,
     535                 :            :                                   sal_uLong nLenDg,
     536                 :            :                                   const unsigned long nDrawingContainerId );
     537                 :            :     sal_Bool GetShapeGroupContainerData( SvStream& rSt,
     538                 :            :                                      sal_uLong nLenShapeGroupCont,
     539                 :            :                                      sal_Bool bPatriarch,
     540                 :            :                                      const unsigned long nDrawingContainerId );
     541                 :            :     sal_Bool GetShapeContainerData( SvStream& rSt,
     542                 :            :                                 sal_uLong nLenShapeCont,
     543                 :            :                                 sal_uLong nPosGroup,
     544                 :            :                                 const unsigned long nDrawingContainerId );
     545                 :            : 
     546                 :            :     bool ReadGraphic( SvStream& rSt, sal_uLong nIndex, Graphic& rGraphic ) const;
     547                 :            :     SdrObject* ImportGraphic( SvStream&, SfxItemSet&, const DffObjData& );
     548                 :            :     // #i32596# - pass <nCalledByGroup> to method
     549                 :            :     // Needed in Writer's Microsoft Word import to avoid import of OLE objects
     550                 :            :     // inside groups. Instead a graphic object is created.
     551                 :            :     virtual SdrObject* ImportOLE( long nOLEId,
     552                 :            :                                   const Graphic& rGraf,
     553                 :            :                                   const Rectangle& rBoundRect,
     554                 :            :                                   const Rectangle& rVisArea,
     555                 :            :                                   const int _nCalledByGroup,
     556                 :            :                                   sal_Int64 nAspect ) const;
     557                 :            :     static com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > CheckForConvertToSOObj(
     558                 :            :                 sal_uInt32 nConvertFlags, SotStorage& rSrcStg,
     559                 :            :                 const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xDestStg,
     560                 :            :                 const Graphic& rGrf,
     561                 :            :                 const Rectangle& rVisArea );
     562                 :            : 
     563                 :            : // the following methods need to be overriden for Excel imports
     564                 :            :     virtual sal_Bool ProcessClientAnchor( SvStream& rStData,
     565                 :            :                                           sal_uInt32 nDatLen,
     566                 :            :                                           char*& rpBuff,
     567                 :            :                                           sal_uInt32& rBuffLen ) const;
     568                 :            :     virtual void ProcessClientAnchor2( SvStream& rStData,
     569                 :            :                                        DffRecordHeader& rHd,
     570                 :            :                                        void* pData, DffObjData& );
     571                 :            :     virtual sal_Bool ProcessClientData( SvStream& rStData,
     572                 :            :                                         sal_uInt32 nDatLen,
     573                 :            :                                         char*& rpBuff,
     574                 :            :                                         sal_uInt32& rBuffLen ) const;
     575                 :            :     virtual SdrObject* ProcessObj( SvStream& rSt,
     576                 :            :                                    DffObjData& rData,
     577                 :            :                                    void* pData,
     578                 :            :                                    Rectangle& rTextRect,
     579                 :            :                                    SdrObject* pObj = NULL);
     580                 :            :     virtual sal_uLong Calc_nBLIPPos( sal_uLong nOrgVal,
     581                 :            :                                      sal_uLong nStreamPos ) const;
     582                 :            :     virtual bool GetColorFromPalette(sal_uInt16 nNum, Color& rColor) const;
     583                 :            : 
     584                 :            :     // Fontwork objects use a new implementation of ReadObjText because the old
     585                 :            :     // one does not properly import multiple paragraphs.
     586                 :            :     void ReadObjText( const String& rText, SdrObject* pObj ) const;
     587                 :            : 
     588                 :            : // the following method needs to be overridden for the import of OLE objects
     589                 :            :     virtual sal_Bool GetOLEStorageName( long nOLEId,
     590                 :            :                                         String& rStorageName,
     591                 :            :                                         SotStorageRef& rSrcStorage,
     592                 :            :                       com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xDestStg
     593                 :            :                                     ) const;
     594                 :            : 
     595                 :            :     /** Prevent that (rounded) rectangles with wrapped text will always be
     596                 :            :         converted into SdrRectObj( OBJ_TEXT ).
     597                 :            : 
     598                 :            :         @return sal_True means "conversion".
     599                 :            :     */
     600                 :            :     virtual sal_Bool ShapeHasText(sal_uLong nShapeId, sal_uLong nFilePos) const;
     601                 :            : 
     602                 :            : public:
     603                 :            :     void*               pSvxMSDffDummy1;
     604                 :            :     void*               pSvxMSDffDummy2;
     605                 :            :     void*               pSvxMSDffDummy3;
     606                 :            :     std::map<sal_uInt32,rtl::OString> aEscherBlipCache;
     607                 :            : 
     608                 :            :     DffRecordManager    maShapeRecords;
     609                 :            :     ColorData           mnDefaultColor;
     610                 :            : 
     611                 :            :     sal_Bool            mbTracing;
     612                 :            : 
     613                 :            :     Color MSO_TEXT_CLR_ToColor( sal_uInt32 nColorCode ) const;
     614                 :            :     Color MSO_CLR_ToColor( sal_uInt32 nColorCode,
     615                 :            :                            sal_uInt16 nContextProperty = DFF_Prop_lineColor ) const;
     616                 :            :     virtual sal_Bool SeekToShape( SvStream& rSt,
     617                 :            :                                   void* pClientData,
     618                 :            :                                   sal_uInt32 nId ) const;
     619                 :            :     bool SeekToRec( SvStream& rSt,
     620                 :            :                     sal_uInt16 nRecId,
     621                 :            :                     sal_uLong nMaxFilePos,
     622                 :            :                     DffRecordHeader* pRecHd = NULL,
     623                 :            :                     sal_uLong nSkipCount = 0 ) const;
     624                 :            :     bool SeekToRec2( sal_uInt16 nRecId1,
     625                 :            :                      sal_uInt16 nRecId2,
     626                 :            :                      sal_uLong nMaxFilePos,
     627                 :            :                      DffRecordHeader* pRecHd = NULL,
     628                 :            :                      sal_uLong nSkipCount = 0 ) const;
     629                 :            : 
     630                 :            :     static rtl::OUString MSDFFReadZString( SvStream& rIn,
     631                 :            :                                            sal_uInt32 nMaxLen,
     632                 :            :                                            bool bUniCode = sal_False);
     633                 :            : 
     634                 :            :     static bool ReadCommonRecordHeader( DffRecordHeader& rRec,
     635                 :            :                                         SvStream& rIn) SAL_WARN_UNUSED_RESULT;
     636                 :            :     static bool ReadCommonRecordHeader( SvStream& rSt,
     637                 :            :                                         sal_uInt8& rVer,
     638                 :            :                                         sal_uInt16& rInst,
     639                 :            :                                         sal_uInt16& rFbt,
     640                 :            :                                         sal_uInt32& rLength) SAL_WARN_UNUSED_RESULT;
     641                 :            : 
     642                 :            : // TODO: provide proper documentation here
     643                 :            :     /** constructor
     644                 :            : 
     645                 :            :         sets nBLIPCount
     646                 :            : 
     647                 :            :         @param rStCtrl             Management stream with containers, FBSE
     648                 :            :                                    objects and shapes (mandatory; stream needs
     649                 :            :                                    to be open already)
     650                 :            :         @param rBaseURL            ???
     651                 :            :         @param nOffsDgg            offset in rStrCtrl; beginning of the drawing
     652                 :            :                                    group container
     653                 :            :         @param pStData             data stream in that the BLIPs are stored (if
     654                 :            :                                    NULL it is assumed that all BLIPs are also in
     655                 :            :                                    the rStCtrl; stream needs to be open already)
     656                 :            :         @param pSdrModel_          ??? (can be empty during Ctor call but needs
     657                 :            :                                    to be set via SetModel() later in that case!)
     658                 :            :         @param nApplicationScale   ???
     659                 :            :         @param mnDefaultColor_     ???
     660                 :            :         @param nDefaultFontHeight_ ???
     661                 :            :         @param pStData2_           ???
     662                 :            :     */
     663                 :            :     SvxMSDffManager( SvStream& rStCtrl,
     664                 :            :                      const String& rBaseURL,
     665                 :            :                      sal_uInt32 nOffsDgg,
     666                 :            :                      SvStream* pStData,
     667                 :            :                      SdrModel* pSdrModel_           =  0,
     668                 :            :                      long      nApplicationScale    =  0,
     669                 :            :                      ColorData mnDefaultColor_      =  COL_DEFAULT,
     670                 :            :                      sal_uLong nDefaultFontHeight_  = 24,
     671                 :            :                      SvStream* pStData2_            =  0 );
     672                 :            : 
     673                 :            :     // in PPT the parameters DGGContainerOffset and PicStream are provided by an
     674                 :            :     // init method
     675                 :            :     SvxMSDffManager( SvStream& rStCtrl, const String& rBaseURL );
     676                 :            :     void InitSvxMSDffManager( sal_uInt32 nOffsDgg_,
     677                 :            :                               SvStream* pStData_,
     678                 :            :                               sal_uInt32 nSvxMSDffOLEConvFlags);
     679                 :            :     void SetDgContainer( SvStream& rSt );
     680                 :            : 
     681                 :            :     virtual ~SvxMSDffManager();
     682                 :            : 
     683                 :        116 :     sal_uInt32  GetSvxMSDffSettings() const { return nSvxMSDffSettings; };
     684                 :         71 :     void    SetSvxMSDffSettings( sal_uInt32 nSettings ) { nSvxMSDffSettings = nSettings; };
     685                 :            : 
     686                 :            :     static sal_Bool     MakeContentStream( SotStorage * pStor, const GDIMetaFile & );
     687                 :            :     static sal_Bool     ConvertToOle2( SvStream& rStm,
     688                 :            :                                        sal_uInt32 nLen,
     689                 :            :                                        const GDIMetaFile*,
     690                 :            :                                        const SotStorageRef & rDest );
     691                 :            :     static rtl::OUString ReadDffString( SvStream& rSt,
     692                 :            :                                         DffRecordHeader aStrHd = DffRecordHeader());
     693                 :            :     static bool ReadObjText(SvStream& rSt, SdrObject* pObj);
     694                 :            : 
     695                 :            :     void SetModel(SdrModel* pModel, long nApplicationScale);
     696                 :        194 :     SdrModel*  GetModel() const { return pSdrModel; }
     697                 :            :     void Scale(sal_Int32& rVal) const;
     698                 :            :     void Scale(Point& rPos) const;
     699                 :            :     void Scale(Size& rSiz) const;
     700                 :            :     void ScaleEmu(sal_Int32& rVal) const;
     701                 :            :     sal_uInt32 ScalePt( sal_uInt32 nPt ) const;
     702                 :            :     sal_Int32 ScalePoint( sal_Int32 nVal ) const;
     703                 :            : 
     704                 :            : // TODO: provide proper documentation here
     705                 :            :     /** Request for a specific BLIP.
     706                 :            : 
     707                 :            :         @param[in] nIdx   number of the requested BLIP (mandatory)
     708                 :            :         @param[out] rData already converted data (insert directly as graphics
     709                 :            :                           into our documents)
     710                 :            :         @param pVisArea   ???
     711                 :            : 
     712                 :            :         @return sal_True if successful, sal_False otherwise
     713                 :            :     */
     714                 :            :     sal_Bool GetBLIP( sal_uLong nIdx, Graphic& rData, Rectangle* pVisArea = NULL );
     715                 :            : 
     716                 :            : // TODO: provide proper documentation here
     717                 :            :     /** read a BLIP out of a already positioned stream
     718                 :            : 
     719                 :            :         @param[in] rBLIPStream alread positioned stream (mandatory)
     720                 :            :         @param[out] rData      already converted data (insert directly as
     721                 :            :                                graphics into our documents)
     722                 :            :         @param pVisArea        ???
     723                 :            : 
     724                 :            :         @return sal_True if successful, sal_False otherwise
     725                 :            :     */
     726                 :            :     sal_Bool GetBLIPDirect(SvStream& rBLIPStream, Graphic& rData, Rectangle* pVisArea = NULL ) const;
     727                 :            : 
     728                 :            :     sal_Bool GetShape(sal_uLong nId, SdrObject*& rpData, SvxMSDffImportData& rData);
     729                 :            : 
     730                 :            :     /** Get count of managed BLIPs
     731                 :            : 
     732                 :            :         @return Number of BLIPs in pStData (or rStCtrl), thus number of FBSEs in
     733                 :            :                 the drawing group container. If 0 is returned this means that
     734                 :            :                 the structure is ok but there are no BLIPs; if USHRT_MAX is
     735                 :            :                 returned than there was an error: no correct Drawing File Format
     736                 :            :     */
     737                 :            :     sal_uInt16 GetBLIPCount() const{ return nBLIPCount; }
     738                 :            : 
     739                 :            :     SdrObject* ImportObj( SvStream& rSt,
     740                 :            :                           void* pData,
     741                 :            :                           Rectangle& rClientRect,
     742                 :            :                           const Rectangle& rGlobalChildRect,
     743                 :            :                           int nCalledByGroup = 0,
     744                 :            :                           sal_Int32* pShapeId = NULL);
     745                 :            :     SdrObject* ImportGroup( const DffRecordHeader& rHd,
     746                 :            :                             SvStream& rSt,
     747                 :            :                             void* pData,
     748                 :            :                             Rectangle& rClientRect,
     749                 :            :                             const Rectangle& rGlobalChildRect,
     750                 :            :                             int nCalledByGroup = 0,
     751                 :            :                             sal_Int32* pShapeId = NULL );
     752                 :            :     SdrObject* ImportShape( const DffRecordHeader& rHd,
     753                 :            :                             SvStream& rSt,
     754                 :            :                             void* pData,
     755                 :            :                             Rectangle& rClientRect,
     756                 :            :                             const Rectangle& rGlobalChildRect,
     757                 :            :                             int nCalledByGroup = 0,
     758                 :            :                             sal_Int32* pShapeId = NULL);
     759                 :            : 
     760                 :            :     Rectangle GetGlobalChildAnchor( const DffRecordHeader& rHd,
     761                 :            :                                     SvStream& rSt,
     762                 :            :                                     Rectangle& aClientRect );
     763                 :            :     void GetGroupAnchors( const DffRecordHeader& rHd,
     764                 :            :                           SvStream& rSt,
     765                 :            :                           Rectangle& rGroupClientAnchor,
     766                 :            :                           Rectangle& rGroupChildAnchor,
     767                 :            :                           const Rectangle& rClientRect,
     768                 :            :                           const Rectangle& rGlobalChildRect );
     769                 :            : 
     770                 :        294 :     inline const SvxMSDffShapeInfos_ById* GetShapeInfos( void ) const
     771                 :        294 :         { return m_pShapeInfosById.get(); }
     772                 :            : 
     773                 :        651 :     inline const SvxMSDffShapeOrders* GetShapeOrders( void ) const
     774                 :        651 :         { return pShapeOrders; }
     775                 :            : 
     776                 :            :     void StoreShapeOrder(sal_uLong      nId,
     777                 :            :                          sal_uLong      nTxBx,
     778                 :            :                          SdrObject*     pObject,
     779                 :            :                          SwFlyFrmFmt*   pFly = 0,
     780                 :            :                          short          nHdFtSection = 0) const;
     781                 :            : 
     782                 :            :     void ExchangeInShapeOrder(SdrObject*    pOldObject,
     783                 :            :                               sal_uLong     nTxBx,
     784                 :            :                               SwFlyFrmFmt*  pFly,
     785                 :            :                               SdrObject*    pObject) const;
     786                 :            : 
     787                 :            :     void RemoveFromShapeOrder( SdrObject* pObject ) const;
     788                 :            : 
     789                 :            :     sal_uInt32  GetConvertFlags() const { return nSvxMSDffOLEConvFlags; }
     790                 :            : 
     791                 :            :     static SdrOle2Obj* CreateSdrOLEFromStorage( const String& rStorageName,
     792                 :            :                                                 SotStorageRef& rSrcStorage,
     793                 :            :                                                 const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xDestStg,
     794                 :            :                                                 const Graphic& rGraf,
     795                 :            :                                                 const Rectangle& rBoundRect,
     796                 :            :                                                 const Rectangle& rVisArea,
     797                 :            :                                                 SvStream* pDataStrrm,
     798                 :            :                                                 ErrCode& rError,
     799                 :            :                                                 sal_uInt32 nConvertFlags,
     800                 :            :                                                 sal_Int64 nAspect );
     801                 :            : 
     802                 :            :     /** Create connections between shapes.
     803                 :            :         This method should be called after a page is imported.
     804                 :            : 
     805                 :            :         @param rSolver contains necessary data that is collected during the
     806                 :            :                        import of each shape
     807                 :            :     */
     808                 :            :     void SolveSolver( const SvxMSDffSolverContainer& rSolver );
     809                 :            : 
     810                 :            :     static sal_Bool SetPropValue(
     811                 :            :         const ::com::sun::star::uno::Any& rAny,
     812                 :            :         const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
     813                 :            :         const String& rPropertyName,
     814                 :            :         sal_Bool bTestPropertyAvailability = sal_False
     815                 :            :     );
     816                 :            : 
     817                 :            :     void insertShapeId( sal_Int32 nShapeId, SdrObject* pShape );
     818                 :            :     void removeShapeId( SdrObject* pShape );
     819                 :            :     SdrObject* getShapeForId( sal_Int32 nShapeId );
     820                 :            : };
     821                 :            : 
     822                 :            : struct SvxMSDffBLIPInfo
     823                 :            : {
     824                 :            :     sal_uInt16 nBLIPType;   ///< type of BLIP: e.g. 6 for PNG
     825                 :            :     sal_uLong  nFilePos;    ///< offset of the BLIP in data strem
     826                 :            :     sal_uLong  nBLIPSize;   ///< number of bytes that the BLIP needs in stream
     827                 :         79 :     SvxMSDffBLIPInfo(sal_uInt16 nBType, sal_uLong nFPos, sal_uLong nBSize):
     828                 :         79 :         nBLIPType( nBType ), nFilePos( nFPos ), nBLIPSize( nBSize ){}
     829                 :            : };
     830                 :            : 
     831                 :            : struct SvxMSDffShapeInfo
     832                 :            : {
     833                 :            :     sal_uInt32 nShapeId; ///< shape id, used in PLCF SPA and in mso_fbtSp (FSP)
     834                 :            :     sal_uLong nFilePos;  ///< offset of the shape in control stream for
     835                 :            :                          ///< potential later access to it
     836                 :            :     sal_uInt32 nTxBxComp;
     837                 :            : 
     838                 :            :     sal_Bool bReplaceByFly  :1; ///< shape can be replaced by a frame in Writer
     839                 :            :     sal_Bool bLastBoxInChain:1;
     840                 :            : 
     841                 :        885 :     explicit SvxMSDffShapeInfo(sal_uLong nFPos, sal_uInt32 nId=0, // sal_uLong nBIdx=0,
     842                 :            :                       sal_uInt16 nSeqId=0, sal_uInt16 nBoxId=0):
     843                 :            :         nShapeId( nId ),
     844                 :            :         nFilePos( nFPos ),
     845                 :        885 :         nTxBxComp( (nSeqId << 16) + nBoxId )
     846                 :            :         {
     847                 :        885 :             bReplaceByFly   = sal_False;
     848                 :        885 :             bLastBoxInChain = sal_True;
     849                 :        885 :         }
     850                 :        579 :     SvxMSDffShapeInfo(SvxMSDffShapeInfo& rInfo):
     851                 :            :         nShapeId( rInfo.nShapeId ),
     852                 :            :         nFilePos( rInfo.nFilePos ),
     853                 :        579 :         nTxBxComp( rInfo.nTxBxComp )
     854                 :            :         {
     855                 :        579 :             bReplaceByFly   = rInfo.bReplaceByFly;
     856                 :        579 :             bLastBoxInChain = rInfo.bLastBoxInChain;
     857                 :        579 :         }
     858                 :            : };
     859                 :            : 
     860                 :            : 
     861                 :            : struct SvxMSDffShapeOrder
     862                 :            : {
     863                 :            :     sal_uLong nShapeId;  ///< shape id used in PLCF SPA and in mso_fbtSp (FSP)
     864                 :            :     sal_uLong nTxBxComp; ///< chain or box number in the Text-Box-Story (or NULL)
     865                 :            :     SwFlyFrmFmt* pFly;   ///< format of frame that was inserted as a replacement
     866                 :            :                          ///< for a Sdr-Text object in Writer - needed for
     867                 :            :                          ///< chaining!
     868                 :            :     short nHdFtSection;  ///< used by Writer to find out if linked frames are in
     869                 :            :                          ///< the same header or footer of the same section
     870                 :            :     SdrObject*  pObj;    ///< pointer to the draw object (or NULL if not used)
     871                 :            : 
     872                 :            :     // Approach: In the Ctor of SvxMSDffManager only the shape ids are stored in
     873                 :            :     //           the shape order array. The Text-Box number and the object
     874                 :            :     //           pointer are only stored if the shape is really imported.
     875                 :        579 :     explicit SvxMSDffShapeOrder( sal_uLong nId ):
     876                 :        579 :         nShapeId( nId ), nTxBxComp( 0 ), pFly( 0 ), nHdFtSection( 0 ), pObj( 0 ){}
     877                 :            : 
     878                 :            :     bool operator==( const SvxMSDffShapeOrder& rEntry ) const
     879                 :            :     { return (nTxBxComp == rEntry.nTxBxComp); }
     880                 :          0 :     bool operator<( const SvxMSDffShapeOrder& rEntry ) const
     881                 :          0 :     { return (nTxBxComp < rEntry.nTxBxComp); }
     882                 :            : };
     883                 :            : 
     884                 :            : // the following will be sorted explicitly:
     885                 :            : struct CompareSvxMSDffShapeTxBxSort
     886                 :            : {
     887                 :          0 :   bool operator()( SvxMSDffShapeOrder* const& lhs, SvxMSDffShapeOrder* const& rhs ) const { return (*lhs)<(*rhs); }
     888                 :            : };
     889                 :         54 : class MSFILTER_DLLPUBLIC SvxMSDffShapeTxBxSort : public std::set<SvxMSDffShapeOrder*,CompareSvxMSDffShapeTxBxSort> {};
     890                 :            : 
     891                 :            : 
     892                 :            : #endif
     893                 :            : 
     894                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10