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

Generated by: LCOV version 1.10