LCOV - code coverage report
Current view: top level - include/svtools - grfmgr.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 48 61 78.7 %
Date: 2014-04-11 Functions: 41 54 75.9 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_SVTOOLS_GRFMGR_HXX
      21             : #define INCLUDED_SVTOOLS_GRFMGR_HXX
      22             : 
      23             : #include <vcl/graph.hxx>
      24             : #include <svtools/svtdllapi.h>
      25             : 
      26             : #define GRFMGR_DRAW_NOTCACHED               0x00000000UL
      27             : #define GRFMGR_DRAW_CACHED                  0x00000001UL
      28             : #define GRFMGR_DRAW_SMOOTHSCALE             0x00000002UL
      29             : #define GRFMGR_DRAW_USE_DRAWMODE_SETTINGS   0x00000004UL
      30             : #define GRFMGR_DRAW_SUBSTITUTE              0x00000008UL
      31             : #define GRFMGR_DRAW_NO_SUBSTITUTE           0x00000010UL
      32             : #define GRFMGR_DRAW_STANDARD                (GRFMGR_DRAW_CACHED|GRFMGR_DRAW_SMOOTHSCALE)
      33             : 
      34             : // AutoSwap defines
      35             : 
      36             : #define GRFMGR_AUTOSWAPSTREAM_LINK      ((SvStream*)0x00000000UL)
      37             : #define GRFMGR_AUTOSWAPSTREAM_LOADED    ((SvStream*)0xfffffffdUL)
      38             : #define GRFMGR_AUTOSWAPSTREAM_TEMP      ((SvStream*)0xfffffffeUL)
      39             : #define GRFMGR_AUTOSWAPSTREAM_NONE      ((SvStream*)0xffffffffUL)
      40             : 
      41             : // Adjustment defines
      42             : 
      43             : #define ADJUSTMENT_NONE                 0x00000000UL
      44             : #define ADJUSTMENT_DRAWMODE             0x00000001UL
      45             : #define ADJUSTMENT_COLORS               0x00000002UL
      46             : #define ADJUSTMENT_MIRROR               0x00000004UL
      47             : #define ADJUSTMENT_ROTATE               0x00000008UL
      48             : #define ADJUSTMENT_TRANSPARENCY         0x00000010UL
      49             : #define ADJUSTMENT_ALL                  0xFFFFFFFFUL
      50             : 
      51             : enum GraphicDrawMode
      52             : {
      53             :     GRAPHICDRAWMODE_STANDARD = 0,
      54             :     GRAPHICDRAWMODE_GREYS = 1,
      55             :     GRAPHICDRAWMODE_MONO = 2,
      56             :     GRAPHICDRAWMODE_WATERMARK = 3
      57             : };
      58             : 
      59             : class GraphicManager;
      60             : class SvStream;
      61             : class BitmapWriteAccess;
      62             : class GraphicCache;
      63             : class VirtualDevice;
      64             : struct GrfSimpleCacheObj;
      65             : struct ImplTileInfo;
      66             : 
      67             : class SVT_DLLPUBLIC GraphicAttr
      68             : {
      69             : private:
      70             : 
      71             :     double          mfGamma;
      72             :     sal_uInt32      mnMirrFlags;
      73             :     long            mnLeftCrop;
      74             :     long            mnTopCrop;
      75             :     long            mnRightCrop;
      76             :     long            mnBottomCrop;
      77             :     sal_uInt16      mnRotate10;
      78             :     short           mnContPercent;
      79             :     short           mnLumPercent;
      80             :     short           mnRPercent;
      81             :     short           mnGPercent;
      82             :     short           mnBPercent;
      83             :     bool            mbInvert;
      84             :     sal_uInt8       mcTransparency;
      85             :     GraphicDrawMode meDrawMode;
      86             : 
      87             : public:
      88             : 
      89             :                     GraphicAttr();
      90             :                     ~GraphicAttr();
      91             : 
      92             :     bool            operator==( const GraphicAttr& rAttr ) const;
      93           0 :     bool            operator!=( const GraphicAttr& rAttr ) const { return !( *this == rAttr ); }
      94             : 
      95        2178 :     void            SetDrawMode( GraphicDrawMode eDrawMode ) { meDrawMode = eDrawMode; }
      96         128 :     GraphicDrawMode GetDrawMode() const { return meDrawMode; }
      97             : 
      98         204 :     void            SetMirrorFlags( sal_uLong nMirrFlags ) { mnMirrFlags = nMirrFlags; }
      99           0 :     sal_uLong       GetMirrorFlags() const { return mnMirrFlags; }
     100             : 
     101        2306 :     void            SetCrop( long nLeft_100TH_MM, long nTop_100TH_MM, long nRight_100TH_MM, long nBottom_100TH_MM )
     102             :                     {
     103        2306 :                         mnLeftCrop = nLeft_100TH_MM; mnTopCrop = nTop_100TH_MM;
     104        2306 :                         mnRightCrop = nRight_100TH_MM; mnBottomCrop = nBottom_100TH_MM;
     105        2306 :                     }
     106           2 :     long            GetLeftCrop() const { return mnLeftCrop; }
     107           2 :     long            GetTopCrop() const { return mnTopCrop; }
     108           2 :     long            GetRightCrop() const { return mnRightCrop; }
     109           2 :     long            GetBottomCrop() const { return mnBottomCrop; }
     110             : 
     111         814 :     void            SetRotation( sal_uInt16 nRotate10 ) { mnRotate10 = nRotate10; }
     112           2 :     sal_uInt16      GetRotation() const { return mnRotate10; }
     113             : 
     114        2178 :     void            SetLuminance( short nLuminancePercent ) { mnLumPercent = nLuminancePercent; }
     115           0 :     short           GetLuminance() const { return mnLumPercent; }
     116             : 
     117        2178 :     void            SetContrast( short nContrastPercent ) { mnContPercent = nContrastPercent; }
     118           0 :     short           GetContrast() const { return mnContPercent; }
     119             : 
     120        2178 :     void            SetChannelR( short nChannelRPercent ) { mnRPercent = nChannelRPercent; }
     121           0 :     short           GetChannelR() const { return mnRPercent; }
     122             : 
     123        2178 :     void            SetChannelG( short nChannelGPercent ) { mnGPercent = nChannelGPercent; }
     124           0 :     short           GetChannelG() const { return mnGPercent; }
     125             : 
     126        2178 :     void            SetChannelB( short nChannelBPercent ) { mnBPercent = nChannelBPercent; }
     127           0 :     short           GetChannelB() const { return mnBPercent; }
     128             : 
     129        2178 :     void            SetGamma( double fGamma ) { mfGamma = fGamma; }
     130           0 :     double          GetGamma() const { return mfGamma; }
     131             : 
     132        2178 :     void            SetInvert( bool bInvert ) { mbInvert = bInvert; }
     133           0 :     bool            IsInvert() const { return mbInvert; }
     134             : 
     135        2345 :     void            SetTransparency( sal_uInt8 cTransparency ) { mcTransparency = cTransparency; }
     136        1051 :     sal_uInt8       GetTransparency() const { return mcTransparency; }
     137             : 
     138         104 :     bool            IsSpecialDrawMode() const { return( meDrawMode != GRAPHICDRAWMODE_STANDARD ); }
     139         232 :     bool            IsMirrored() const { return( mnMirrFlags != 0UL ); }
     140         128 :     bool            IsCropped() const
     141             :                     {
     142         380 :                         return( mnLeftCrop != 0 || mnTopCrop != 0 ||
     143         380 :                                 mnRightCrop != 0 || mnBottomCrop != 0 );
     144             :                     }
     145         104 :     bool            IsRotated() const { return( ( mnRotate10 % 3600 ) != 0 ); }
     146         230 :     bool            IsTransparent() const { return( mcTransparency > 0 ); }
     147         232 :     bool            IsAdjusted() const
     148             :                     {
     149         696 :                         return( mnLumPercent != 0 || mnContPercent != 0 || mnRPercent != 0 ||
     150         696 :                                 mnGPercent != 0 || mnBPercent != 0 || mfGamma != 1.0 || mbInvert );
     151             :                     }
     152             : 
     153             :     friend SvStream& WriteGraphicAttr( SvStream& rOStm, const GraphicAttr& rAttr );
     154             :     friend SvStream& ReadGraphicAttr( SvStream& rIStm, GraphicAttr& rAttr );
     155             : };
     156             : 
     157             : class SVT_DLLPUBLIC GraphicObject : public SvDataCopyStream
     158             : {
     159             :     friend class GraphicManager;
     160             : 
     161             : private:
     162             : 
     163             :     static GraphicManager*  mpGlobalMgr;
     164             : 
     165             :     Graphic                 maGraphic;
     166             :     GraphicAttr             maAttr;
     167             :     Size                    maPrefSize;
     168             :     MapMode                 maPrefMapMode;
     169             :     sal_uLong               mnSizeBytes;
     170             :     GraphicType             meType;
     171             :     GraphicManager*         mpMgr;
     172             :     OUString                maLink;
     173             :     Link*                   mpSwapStreamHdl;
     174             :     OUString                maUserData;
     175             :     Timer*                  mpSwapOutTimer;
     176             :     GrfSimpleCacheObj*      mpSimpleCache;
     177             :     sal_uLong               mnAnimationLoopCount;
     178             :     bool                    mbAutoSwapped   : 1;
     179             :     bool                    mbTransparent   : 1;
     180             :     bool                    mbAnimated      : 1;
     181             :     bool                    mbEPS           : 1;
     182             :     bool                    mbIsInSwapIn    : 1;
     183             :     bool                    mbIsInSwapOut   : 1;
     184             :     bool                    mbAlpha         : 1;
     185             : 
     186             :     void                    SVT_DLLPRIVATE ImplConstruct();
     187             :     void                    SVT_DLLPRIVATE ImplAssignGraphicData();
     188             :     void                    SVT_DLLPRIVATE ImplSetGraphicManager(
     189             :                                 const GraphicManager* pMgr,
     190             :                                 const OString* pID = NULL,
     191             :                                 const GraphicObject* pCopyObj = NULL
     192             :                             );
     193             :     void                    SVT_DLLPRIVATE ImplAutoSwapIn();
     194             :     bool                    SVT_DLLPRIVATE ImplIsAutoSwapped() const { return mbAutoSwapped; }
     195             :     bool                    SVT_DLLPRIVATE ImplGetCropParams(
     196             :                                 OutputDevice* pOut,
     197             :                                 Point& rPt,
     198             :                                 Size& rSz,
     199             :                                 const GraphicAttr* pAttr,
     200             :                                 PolyPolygon& rClipPolyPoly,
     201             :                                 bool& bRectClipRegion
     202             :                             ) const;
     203             : 
     204             :     /** Render a given number of tiles in an optimized way
     205             : 
     206             :         This method recursively subdivides the tile rendering problem
     207             :         in smaller parts, i.e. rendering output size x with few tiles
     208             :         of size y, which in turn are generated from the original
     209             :         bitmap in a recursive fashion. The subdivision size can be
     210             :         controlled by the exponent argument, which specifies the
     211             :         minimal number of smaller tiles used in one recursion
     212             :         step. The resulting tile size is given as the integer number
     213             :         of repetitions of the original bitmap along x and y. As the
     214             :         exponent need not necessarily divide these numbers without
     215             :         remainder, the repetition counts are effectively converted to
     216             :         base-exponent numbers, where each place denotes the number of
     217             :         times the corresponding tile size is rendered.
     218             : 
     219             :         @param rVDev
     220             :         Virtual device to render everything into
     221             : 
     222             :         @param nExponent
     223             :         Number of repetitions per subdivision step, _must_ be greater than 1
     224             : 
     225             :         @param nNumTilesX
     226             :         Number of original tiles to generate in x direction
     227             : 
     228             :         @param nNumTilesY
     229             :         Number of original tiles to generate in y direction
     230             : 
     231             :         @param rTileSizePixel
     232             :         Size in pixel of the original tile bitmap to render it in
     233             : 
     234             :         @param pAttr
     235             :         Graphic attributes to be used for rendering
     236             : 
     237             :         @param nFlags
     238             :         Graphic flags to be used for rendering
     239             : 
     240             :         @param rCurrPos
     241             :         Current output point for this recursion level (should start with (0,0))
     242             : 
     243             :         @return true, if everything was successfully rendered.
     244             :     */
     245             :     bool SVT_DLLPRIVATE     ImplRenderTempTile(
     246             :                                 VirtualDevice& rVDev,
     247             :                                 int nExponent,
     248             :                                 int nNumTilesX,
     249             :                                 int nNumTilesY,
     250             :                                 const Size& rTileSizePixel,
     251             :                                 const GraphicAttr* pAttr,
     252             :                                 sal_uLong nFlags
     253             :                             );
     254             : 
     255             :     /// internally called by ImplRenderTempTile()
     256             :     bool SVT_DLLPRIVATE     ImplRenderTileRecursive(
     257             :                                 VirtualDevice& rVDev,
     258             :                                 int nExponent,
     259             :                                 int nMSBFactor,
     260             :                                 int nNumOrigTilesX,
     261             :                                 int nNumOrigTilesY,
     262             :                                 int nRemainderTilesX,
     263             :                                 int nRemainderTilesY,
     264             :                                 const Size& rTileSizePixel,
     265             :                                 const GraphicAttr* pAttr,
     266             :                                 sal_uLong nFlags,
     267             :                                 ImplTileInfo& rTileInfo
     268             :                             );
     269             : 
     270             :     bool SVT_DLLPRIVATE     ImplDrawTiled(
     271             :                                 OutputDevice* pOut,
     272             :                                 const Rectangle& rArea,
     273             :                                 const Size& rSizePixel,
     274             :                                 const Size& rOffset,
     275             :                                 const GraphicAttr* pAttr,
     276             :                                 sal_uLong nFlags,
     277             :                                 int nTileCacheSize1D
     278             :                             );
     279             : 
     280             :     bool SVT_DLLPRIVATE     ImplDrawTiled(
     281             :                                 OutputDevice& rOut,
     282             :                                 const Point& rPos,
     283             :                                 int nNumTilesX,
     284             :                                 int nNumTilesY,
     285             :                                 const Size& rTileSize,
     286             :                                 const GraphicAttr* pAttr,
     287             :                                 sal_uLong nFlags
     288             :                             );
     289             : 
     290             :     void SVT_DLLPRIVATE     ImplTransformBitmap(
     291             :                                 BitmapEx&           rBmpEx,
     292             :                                 const GraphicAttr&  rAttr,
     293             :                                 const Size&         rCropLeftTop,
     294             :                                 const Size&         rCropRightBottom,
     295             :                                 const Rectangle&    rCropRect,
     296             :                                 const Size&         rDstSize,
     297             :                                 bool                bEnlarge
     298             :                             ) const;
     299             : 
     300             :                             DECL_LINK( ImplAutoSwapOutHdl, void* );
     301             : 
     302             : protected:
     303             : 
     304             :     virtual void            GraphicManagerDestroyed();
     305             :     virtual SvStream*       GetSwapStream() const;
     306             : 
     307             :     virtual void            Load( SvStream& ) SAL_OVERRIDE;
     308             :     virtual void            Save( SvStream& ) SAL_OVERRIDE;
     309             :     virtual void            Assign( const SvDataCopyStream& ) SAL_OVERRIDE;
     310             : 
     311             : public:
     312             : 
     313             :                             TYPEINFO_OVERRIDE();
     314             : 
     315             :                             GraphicObject( const GraphicManager* pMgr = NULL );
     316             :                             GraphicObject( const Graphic& rGraphic, const GraphicManager* pMgr = NULL );
     317             :                             GraphicObject( const GraphicObject& rCacheObj, const GraphicManager* pMgr = NULL );
     318             :                             explicit GraphicObject( const OString& rUniqueID, const GraphicManager* pMgr = NULL );
     319             :                             virtual ~GraphicObject();
     320             : 
     321             :     GraphicObject&          operator=( const GraphicObject& rCacheObj );
     322             :     bool                    operator==( const GraphicObject& rCacheObj ) const;
     323           0 :     bool                    operator!=( const GraphicObject& rCacheObj ) const { return !( *this == rCacheObj ); }
     324             : 
     325          78 :     bool                    HasSwapStreamHdl() const { return( mpSwapStreamHdl != NULL && mpSwapStreamHdl->IsSet() ); }
     326             :     void                    SetSwapStreamHdl();
     327             :     void                    SetSwapStreamHdl(const Link& rHdl);
     328             :     sal_uLong               GetSwapOutTimeout() const { return( mpSwapOutTimer ? mpSwapOutTimer->GetTimeout() : 0 ); }
     329             : 
     330             :     void                    FireSwapInRequest();
     331             :     void                    FireSwapOutRequest();
     332             : 
     333           0 :     GraphicManager&         GetGraphicManager() const { return *mpMgr; }
     334             : 
     335             :     bool                    IsCached(
     336             :                                 OutputDevice* pOut,
     337             :                                 const Point& rPt,
     338             :                                 const Size& rSz,
     339             :                                 const GraphicAttr* pAttr = NULL,
     340             :                                 sal_uLong nFlags = GRFMGR_DRAW_STANDARD
     341             :                             ) const;
     342             :     void                    ReleaseFromCache();
     343             : 
     344             :     const Graphic&          GetGraphic() const;
     345             :     void                    SetGraphic( const Graphic& rGraphic, const GraphicObject* pCopyObj = 0);
     346             :     void                    SetGraphic( const Graphic& rGraphic, const OUString& rLink );
     347             : 
     348             :     /** Get graphic transformed according to given attributes
     349             : 
     350             :         This method returns a Graphic transformed, cropped and scaled
     351             :         to the given parameters, ready to be rendered to printer or
     352             :         display. The returned graphic has the same visual appearance
     353             :         as if it had been drawn via GraphicObject::Draw() to a
     354             :         specific output device.
     355             : 
     356             :         @param rDestSize
     357             :         Desired output size in logical coordinates. The mapmode to
     358             :         interpret these logical coordinates in is given by the second
     359             :         parameter, rDestMap.
     360             : 
     361             :         @param rDestMap
     362             :         Mapmode the output should be interpreted in. This is used to
     363             :         interpret rDestSize, to set the appropriate PrefMapMode on the
     364             :         returned Graphic, and to deal correctly with metafile graphics.
     365             : 
     366             :         @param rAttr
     367             :         Graphic attributes used to transform the graphic. This
     368             :         includes cropping, rotation, mirroring, and various color
     369             :         adjustment parameters.
     370             : 
     371             :         @return the readily transformed Graphic
     372             :      */
     373             :     Graphic                 GetTransformedGraphic(
     374             :                                 const Size& rDestSize,
     375             :                                 const MapMode& rDestMap,
     376             :                                 const GraphicAttr& rAttr
     377             :                             ) const;
     378             :     Graphic                 GetTransformedGraphic( const GraphicAttr* pAttr = NULL ) const; // TODO: Change to Impl
     379             : 
     380             :     void                    SetAttr( const GraphicAttr& rAttr );
     381         143 :     const GraphicAttr&      GetAttr() const { return maAttr; }
     382             : 
     383           0 :     bool                    HasLink() const { return !maLink.isEmpty(); }
     384             :     void                    SetLink();
     385             :     void                    SetLink( const OUString& rLink );
     386        4244 :     OUString                GetLink() const { return maLink; }
     387             : 
     388         842 :     bool                    HasUserData() const { return !maUserData.isEmpty(); }
     389             :     void                    SetUserData();
     390             :     void                    SetUserData( const OUString& rUserData );
     391          18 :     OUString                GetUserData() const { return maUserData; }
     392             : 
     393             :     OString                 GetUniqueID() const;
     394             : 
     395       17437 :     GraphicType             GetType() const { return meType; }
     396         141 :     const Size&             GetPrefSize() const { return maPrefSize; }
     397         106 :     const MapMode&          GetPrefMapMode() const { return maPrefMapMode; }
     398          62 :     sal_uLong               GetSizeBytes() const { return mnSizeBytes; }
     399         193 :     bool                    IsTransparent() const { return mbTransparent; }
     400             :     bool                    IsAlpha() const { return mbAlpha; }
     401        1387 :     bool                    IsAnimated() const { return mbAnimated; }
     402        1275 :     bool                    IsEPS() const { return mbEPS; }
     403             : 
     404           0 :     Link                    GetAnimationNotifyHdl() const { return maGraphic.GetAnimationNotifyHdl(); }
     405             : 
     406             :     bool                    SwapOut();
     407             :     bool                    SwapOut( SvStream* pOStm );
     408             :     bool                    SwapIn();
     409             : 
     410        1275 :     bool                    IsInSwapIn() const { return mbIsInSwapIn; }
     411          70 :     bool                    IsInSwapOut() const { return mbIsInSwapOut; }
     412             :     bool                    IsInSwap() const { return( mbIsInSwapOut || mbIsInSwapOut ); }
     413       24326 :     bool                    IsSwappedOut() const { return( mbAutoSwapped || maGraphic.IsSwapOut() ); }
     414             :     void                    SetSwapState();
     415             : 
     416             :     bool                    Draw(
     417             :                                 OutputDevice* pOut,
     418             :                                 const Point& rPt,
     419             :                                 const Size& rSz,
     420             :                                 const GraphicAttr* pAttr = NULL,
     421             :                                 sal_uLong nFlags = GRFMGR_DRAW_STANDARD
     422             :                             );
     423             : 
     424             :     bool                    DrawWithPDFHandling(
     425             :                                 OutputDevice& rOutDev,
     426             :                                 const Point& rPt,
     427             :                                 const Size& rSz,
     428             :                                 const GraphicAttr* pGrfAttr = NULL,
     429             :                                 const sal_uLong nFlags = GRFMGR_DRAW_STANDARD
     430             :                             );
     431             : 
     432             :     /** Draw the graphic repeatedly into the given output rectangle
     433             : 
     434             :         @param pOut
     435             :         OutputDevice where the rendering should take place
     436             : 
     437             :         @param rArea
     438             :         The output area that is filled with tiled instances of this graphic
     439             : 
     440             :         @param rSize
     441             :         The actual size of a single tile
     442             : 
     443             :         @param rOffset
     444             :         Offset from the left, top position of rArea, where to start
     445             :         the tiling. The upper left corner of the graphic tilings will
     446             :         virtually start at this position. Concretely, only that many
     447             :         tiles are drawn to completely fill the given output area.
     448             : 
     449             :         @param pAttr
     450             :         Optional GraphicAttr
     451             : 
     452             :         @param nFlags
     453             :         Optional rendering flags
     454             : 
     455             :         @param nTileCacheSize1D
     456             :         Optional dimension of the generated cache tiles. The pOut sees
     457             :         a number of tile draws, which have approximately
     458             :         nTileCacheSize1D times nTileCacheSize1D bitmap sizes if the
     459             :         tile bitmap is smaller. Otherwise, the tile is drawn as
     460             :         is. This is useful if e.g. you want only a few, very large
     461             :         bitmap drawings appear on the outdev.
     462             : 
     463             :         @return sal_True, if drawing completed successfully
     464             :      */
     465             :     bool                    DrawTiled(
     466             :                                 OutputDevice* pOut,
     467             :                                 const Rectangle& rArea,
     468             :                                 const Size& rSize,
     469             :                                 const Size& rOffset,
     470             :                                 const GraphicAttr* pAttr = NULL,
     471             :                                 sal_uLong nFlags = GRFMGR_DRAW_STANDARD,
     472             :                                 int nTileCacheSize1D=128
     473             :                             );
     474             : 
     475             :     bool                    StartAnimation(
     476             :                                 OutputDevice* pOut,
     477             :                                 const Point& rPt,
     478             :                                 const Size& rSz,
     479             :                                 long nExtraData = 0L,
     480             :                                 const GraphicAttr* pAttr = NULL,
     481             :                                 sal_uLong nFlags = GRFMGR_DRAW_STANDARD,
     482             :                                 OutputDevice* pFirstFrameOutDev = NULL
     483             :                             );
     484             : 
     485             :     void                    StopAnimation( OutputDevice* pOut = NULL, long nExtraData = 0L );
     486             : 
     487             :     friend SvStream&        WriteGraphicObject( SvStream& rOStm, const GraphicObject& rGraphicObj );
     488             :     friend SvStream&        ReadGraphicObject( SvStream& rIStm, GraphicObject& rGraphicObj );
     489             : 
     490             :     static GraphicObject    CreateGraphicObjectFromURL( const OUString &rURL );
     491             :     // will inspect an object ( e.g. a control ) for any 'ImageURL'
     492             :     // properties and return these in a vector. Note: this implementation
     493             :     // will cater for XNameContainer objects and deepinspect any containees
     494             :     // if they exist
     495             :     static void InspectForGraphicObjectImageURL( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIf, std::vector< OUString >& rvEmbedImgUrls );
     496             : 
     497             :     // create CropScaling information
     498             :     // fWidth, fHeight: object size
     499             :     // f*Crop: crop values relative to original bitmap size
     500             :     basegfx::B2DVector calculateCropScaling(
     501             :         double fWidth,
     502             :         double fHeight,
     503             :         double fLeftCrop,
     504             :         double fTopCrop,
     505             :         double fRightCrop,
     506             :         double fBottomCrop) const;
     507             : };
     508             : 
     509             : typedef ::std::vector< GraphicObject* > GraphicObjectList_impl;
     510             : 
     511             : class SVT_DLLPUBLIC GraphicManager
     512             : {
     513             :     friend class GraphicObject;
     514             :     friend class GraphicDisplayCacheEntry;
     515             : 
     516             : private:
     517             : 
     518             :     GraphicObjectList_impl  maObjList;
     519             :     GraphicCache*           mpCache;
     520             : 
     521             :                         GraphicManager( const GraphicManager& ) {}
     522             :     GraphicManager&     operator=( const GraphicManager& ) { return *this; }
     523             : 
     524             :     bool SVT_DLLPRIVATE ImplDraw(
     525             :                             OutputDevice* pOut,
     526             :                             const Point& rPt,
     527             :                             const Size& rSz,
     528             :                             GraphicObject& rObj,
     529             :                             const GraphicAttr& rAttr,
     530             :                             const sal_uLong nFlags,
     531             :                             bool& rCached
     532             :                         );
     533             : 
     534             :     bool SVT_DLLPRIVATE ImplCreateOutput(
     535             :                             OutputDevice* pOut,
     536             :                             const Point& rPt,
     537             :                             const Size& rSz,
     538             :                             const BitmapEx& rBmpEx,
     539             :                             const GraphicAttr& rAttr,
     540             :                             const sal_uLong nFlags,
     541             :                             BitmapEx* pBmpEx = NULL
     542             :                         );
     543             :     bool SVT_DLLPRIVATE ImplCreateOutput(
     544             :                             OutputDevice* pOut,
     545             :                             const Point& rPt,
     546             :                             const Size& rSz,
     547             :                             const GDIMetaFile& rMtf,
     548             :                             const GraphicAttr& rAttr,
     549             :                             const sal_uLong nFlags,
     550             :                             GDIMetaFile& rOutMtf,
     551             :                             BitmapEx& rOutBmpEx
     552             :                         );
     553             : 
     554             :     static void SVT_DLLPRIVATE ImplAdjust(
     555             :                             BitmapEx& rBmpEx,
     556             :                             const GraphicAttr& rAttr,
     557             :                             sal_uLong nAdjustmentFlags
     558             :                         );
     559             :     static void SVT_DLLPRIVATE ImplAdjust(
     560             :                             GDIMetaFile& rMtf,
     561             :                             const GraphicAttr& rAttr,
     562             :                             sal_uLong nAdjustmentFlags
     563             :                         );
     564             :     static void SVT_DLLPRIVATE ImplAdjust(
     565             :                             Animation& rAnimation,
     566             :                             const GraphicAttr& rAttr,
     567             :                             sal_uLong nAdjustmentFlags
     568             :                         );
     569             : 
     570             :     static void SVT_DLLPRIVATE ImplDraw(
     571             :                             OutputDevice* pOut,
     572             :                             const Point& rPt,
     573             :                             const Size& rSz,
     574             :                             const GDIMetaFile& rMtf,
     575             :                             const GraphicAttr& rAttr
     576             :                         );
     577             : 
     578             :                     // Only used by GraphicObject's Ctor's and Dtor's
     579             :     void SVT_DLLPRIVATE ImplRegisterObj(
     580             :                             const GraphicObject& rObj,
     581             :                             Graphic& rSubstitute,
     582             :                             const OString* pID = NULL,
     583             :                             const GraphicObject* pCopyObj = NULL
     584             :                         );
     585             :     void SVT_DLLPRIVATE ImplUnregisterObj( const GraphicObject& rObj );
     586       10593 :     inline bool SVT_DLLPRIVATE ImplHasObjects() const { return !maObjList.empty(); }
     587             : 
     588             :                     // Only used in swap case by GraphicObject
     589             :     void SVT_DLLPRIVATE ImplGraphicObjectWasSwappedOut( const GraphicObject& rObj );
     590             :     bool SVT_DLLPRIVATE ImplFillSwappedGraphicObject(
     591             :                             const GraphicObject& rObj,
     592             :                             Graphic& rSubstitute
     593             :                         );
     594             :     void SVT_DLLPRIVATE ImplGraphicObjectWasSwappedIn( const GraphicObject& rObj );
     595             : 
     596             :     OString SVT_DLLPRIVATE ImplGetUniqueID( const GraphicObject& rObj ) const;
     597             : 
     598             : public:
     599             : 
     600             :                         GraphicManager( sal_uLong nCacheSize = 10000000UL, sal_uLong nMaxObjCacheSize = 2400000UL );
     601             :                         ~GraphicManager();
     602             : 
     603             :     void                SetMaxCacheSize( sal_uLong nNewCacheSize );
     604             : 
     605             :     void                SetMaxObjCacheSize(
     606             :                             sal_uLong nNewMaxObjSize,
     607             :                             bool bDestroyGreaterCached = false
     608             :                         );
     609             : 
     610             :     void                SetCacheTimeout( sal_uLong nTimeoutSeconds );
     611             : 
     612             :     void                ReleaseFromCache( const GraphicObject& rObj );
     613             : 
     614             :     bool                IsInCache(
     615             :                             OutputDevice* pOut,
     616             :                             const Point& rPt,
     617             :                             const Size& rSz,
     618             :                             const GraphicObject& rObj,
     619             :                             const GraphicAttr& rAttr
     620             :                         ) const;
     621             : 
     622             :     bool                DrawObj(
     623             :                             OutputDevice* pOut,
     624             :                             const Point& rPt,
     625             :                             const Size& rSz,
     626             :                             GraphicObject& rObj,
     627             :                             const GraphicAttr& rAttr,
     628             :                             const sal_uLong nFlags,
     629             :                             bool& rCached
     630             :                         );
     631             : };
     632             : 
     633             : #endif // INCLUDED_SVTOOLS_GRFMGR_HXX
     634             : 
     635             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10