LCOV - code coverage report
Current view: top level - include/svtools - grfmgr.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 48 62 77.4 %
Date: 2014-11-03 Functions: 41 55 74.5 %
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      (reinterpret_cast<SvStream*>(0x00000000UL))
      37             : #define GRFMGR_AUTOSWAPSTREAM_LOADED    (reinterpret_cast<SvStream*>(0xfffffffdUL))
      38             : #define GRFMGR_AUTOSWAPSTREAM_TEMP      (reinterpret_cast<SvStream*>(0xfffffffeUL))
      39             : #define GRFMGR_AUTOSWAPSTREAM_NONE      (reinterpret_cast<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        7050 :     void            SetDrawMode( GraphicDrawMode eDrawMode ) { meDrawMode = eDrawMode; }
      96         430 :     GraphicDrawMode GetDrawMode() const { return meDrawMode; }
      97             : 
      98         620 :     void            SetMirrorFlags( sal_uLong nMirrFlags ) { mnMirrFlags = nMirrFlags; }
      99           0 :     sal_uLong       GetMirrorFlags() const { return mnMirrFlags; }
     100             : 
     101        7480 :     void            SetCrop( long nLeft_100TH_MM, long nTop_100TH_MM, long nRight_100TH_MM, long nBottom_100TH_MM )
     102             :                     {
     103        7480 :                         mnLeftCrop = nLeft_100TH_MM; mnTopCrop = nTop_100TH_MM;
     104        7480 :                         mnRightCrop = nRight_100TH_MM; mnBottomCrop = nBottom_100TH_MM;
     105        7480 :                     }
     106          12 :     long            GetLeftCrop() const { return mnLeftCrop; }
     107          12 :     long            GetTopCrop() const { return mnTopCrop; }
     108          12 :     long            GetRightCrop() const { return mnRightCrop; }
     109          12 :     long            GetBottomCrop() const { return mnBottomCrop; }
     110             : 
     111        2688 :     void            SetRotation( sal_uInt16 nRotate10 ) { mnRotate10 = nRotate10; }
     112           4 :     sal_uInt16      GetRotation() const { return mnRotate10; }
     113             : 
     114        7050 :     void            SetLuminance( short nLuminancePercent ) { mnLumPercent = nLuminancePercent; }
     115           0 :     short           GetLuminance() const { return mnLumPercent; }
     116             : 
     117        7050 :     void            SetContrast( short nContrastPercent ) { mnContPercent = nContrastPercent; }
     118           0 :     short           GetContrast() const { return mnContPercent; }
     119             : 
     120        7050 :     void            SetChannelR( short nChannelRPercent ) { mnRPercent = nChannelRPercent; }
     121           0 :     short           GetChannelR() const { return mnRPercent; }
     122             : 
     123        7050 :     void            SetChannelG( short nChannelGPercent ) { mnGPercent = nChannelGPercent; }
     124           0 :     short           GetChannelG() const { return mnGPercent; }
     125             : 
     126        7050 :     void            SetChannelB( short nChannelBPercent ) { mnBPercent = nChannelBPercent; }
     127           0 :     short           GetChannelB() const { return mnBPercent; }
     128             : 
     129        7050 :     void            SetGamma( double fGamma ) { mfGamma = fGamma; }
     130           0 :     double          GetGamma() const { return mfGamma; }
     131             : 
     132        7050 :     void            SetInvert( bool bInvert ) { mbInvert = bInvert; }
     133           0 :     bool            IsInvert() const { return mbInvert; }
     134             : 
     135        7602 :     void            SetTransparency( sal_uInt8 cTransparency ) { mcTransparency = cTransparency; }
     136        3638 :     sal_uInt8       GetTransparency() const { return mcTransparency; }
     137             : 
     138         300 :     bool            IsSpecialDrawMode() const { return( meDrawMode != GRAPHICDRAWMODE_STANDARD ); }
     139         730 :     bool            IsMirrored() const { return( mnMirrFlags != 0UL ); }
     140         432 :     bool            IsCropped() const
     141             :                     {
     142        1280 :                         return( mnLeftCrop != 0 || mnTopCrop != 0 ||
     143        1280 :                                 mnRightCrop != 0 || mnBottomCrop != 0 );
     144             :                     }
     145         300 :     bool            IsRotated() const { return( ( mnRotate10 % 3600 ) != 0 ); }
     146         728 :     bool            IsTransparent() const { return( mcTransparency > 0 ); }
     147         730 :     bool            IsAdjusted() const
     148             :                     {
     149        2190 :                         return( mnLumPercent != 0 || mnContPercent != 0 || mnRPercent != 0 ||
     150        2190 :                                 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             : 
     179             :     // a unique increasing ID to be able to say which data change is older
     180             :     sal_uLong               mnDataChangeTimeStamp;
     181             : 
     182             :     bool                    mbAutoSwapped   : 1;
     183             :     bool                    mbTransparent   : 1;
     184             :     bool                    mbAnimated      : 1;
     185             :     bool                    mbEPS           : 1;
     186             :     bool                    mbIsInSwapIn    : 1;
     187             :     bool                    mbIsInSwapOut   : 1;
     188             :     bool                    mbAlpha         : 1;
     189             : 
     190             :     void                    SVT_DLLPRIVATE ImplConstruct();
     191             :     void                    SVT_DLLPRIVATE ImplAssignGraphicData();
     192             :     void                    SVT_DLLPRIVATE ImplSetGraphicManager(
     193             :                                 const GraphicManager* pMgr,
     194             :                                 const OString* pID = NULL,
     195             :                                 const GraphicObject* pCopyObj = NULL
     196             :                             );
     197             :     void                    SVT_DLLPRIVATE ImplAutoSwapIn();
     198             :     bool                    SVT_DLLPRIVATE ImplIsAutoSwapped() const { return mbAutoSwapped; }
     199             :     bool                    SVT_DLLPRIVATE ImplGetCropParams(
     200             :                                 OutputDevice* pOut,
     201             :                                 Point& rPt,
     202             :                                 Size& rSz,
     203             :                                 const GraphicAttr* pAttr,
     204             :                                 tools::PolyPolygon& rClipPolyPoly,
     205             :                                 bool& bRectClipRegion
     206             :                             ) const;
     207             : 
     208             :     /** Render a given number of tiles in an optimized way
     209             : 
     210             :         This method recursively subdivides the tile rendering problem
     211             :         in smaller parts, i.e. rendering output size x with few tiles
     212             :         of size y, which in turn are generated from the original
     213             :         bitmap in a recursive fashion. The subdivision size can be
     214             :         controlled by the exponent argument, which specifies the
     215             :         minimal number of smaller tiles used in one recursion
     216             :         step. The resulting tile size is given as the integer number
     217             :         of repetitions of the original bitmap along x and y. As the
     218             :         exponent need not necessarily divide these numbers without
     219             :         remainder, the repetition counts are effectively converted to
     220             :         base-exponent numbers, where each place denotes the number of
     221             :         times the corresponding tile size is rendered.
     222             : 
     223             :         @param rVDev
     224             :         Virtual device to render everything into
     225             : 
     226             :         @param nExponent
     227             :         Number of repetitions per subdivision step, _must_ be greater than 1
     228             : 
     229             :         @param nNumTilesX
     230             :         Number of original tiles to generate in x direction
     231             : 
     232             :         @param nNumTilesY
     233             :         Number of original tiles to generate in y direction
     234             : 
     235             :         @param rTileSizePixel
     236             :         Size in pixel of the original tile bitmap to render it in
     237             : 
     238             :         @param pAttr
     239             :         Graphic attributes to be used for rendering
     240             : 
     241             :         @param nFlags
     242             :         Graphic flags to be used for rendering
     243             : 
     244             :         @param rCurrPos
     245             :         Current output point for this recursion level (should start with (0,0))
     246             : 
     247             :         @return true, if everything was successfully rendered.
     248             :     */
     249             :     bool SVT_DLLPRIVATE     ImplRenderTempTile(
     250             :                                 VirtualDevice& rVDev,
     251             :                                 int nExponent,
     252             :                                 int nNumTilesX,
     253             :                                 int nNumTilesY,
     254             :                                 const Size& rTileSizePixel,
     255             :                                 const GraphicAttr* pAttr,
     256             :                                 sal_uLong nFlags
     257             :                             );
     258             : 
     259             :     /// internally called by ImplRenderTempTile()
     260             :     bool SVT_DLLPRIVATE     ImplRenderTileRecursive(
     261             :                                 VirtualDevice& rVDev,
     262             :                                 int nExponent,
     263             :                                 int nMSBFactor,
     264             :                                 int nNumOrigTilesX,
     265             :                                 int nNumOrigTilesY,
     266             :                                 int nRemainderTilesX,
     267             :                                 int nRemainderTilesY,
     268             :                                 const Size& rTileSizePixel,
     269             :                                 const GraphicAttr* pAttr,
     270             :                                 sal_uLong nFlags,
     271             :                                 ImplTileInfo& rTileInfo
     272             :                             );
     273             : 
     274             :     bool SVT_DLLPRIVATE     ImplDrawTiled(
     275             :                                 OutputDevice* pOut,
     276             :                                 const Rectangle& rArea,
     277             :                                 const Size& rSizePixel,
     278             :                                 const Size& rOffset,
     279             :                                 const GraphicAttr* pAttr,
     280             :                                 sal_uLong nFlags,
     281             :                                 int nTileCacheSize1D
     282             :                             );
     283             : 
     284             :     bool SVT_DLLPRIVATE     ImplDrawTiled(
     285             :                                 OutputDevice& rOut,
     286             :                                 const Point& rPos,
     287             :                                 int nNumTilesX,
     288             :                                 int nNumTilesY,
     289             :                                 const Size& rTileSize,
     290             :                                 const GraphicAttr* pAttr,
     291             :                                 sal_uLong nFlags
     292             :                             );
     293             : 
     294             :     void SVT_DLLPRIVATE     ImplTransformBitmap(
     295             :                                 BitmapEx&           rBmpEx,
     296             :                                 const GraphicAttr&  rAttr,
     297             :                                 const Size&         rCropLeftTop,
     298             :                                 const Size&         rCropRightBottom,
     299             :                                 const Rectangle&    rCropRect,
     300             :                                 const Size&         rDstSize,
     301             :                                 bool                bEnlarge
     302             :                             ) const;
     303             : 
     304             :                             DECL_LINK( ImplAutoSwapOutHdl, void* );
     305             : 
     306             :     // restart SwapOut timer; this is like touching in a cache to reset to the full timeout value
     307             :     void SVT_DLLPRIVATE     restartSwapOutTimer() const;
     308             : 
     309             :     // Handle evtl. needed AfterDataChanges, needs to be called when new
     310             :     // graphic data is swapped in/added to the GraphicManager
     311             :     void SVT_DLLPRIVATE     ImplAfterDataChange();
     312             : protected:
     313             : 
     314             :     virtual void            GraphicManagerDestroyed();
     315             :     virtual SvStream*       GetSwapStream() const;
     316             : 
     317             :     virtual void            Load( SvStream& ) SAL_OVERRIDE;
     318             :     virtual void            Save( SvStream& ) SAL_OVERRIDE;
     319             :     virtual void            Assign( const SvDataCopyStream& ) SAL_OVERRIDE;
     320             : 
     321             : public:
     322             : 
     323             :                             TYPEINFO_OVERRIDE();
     324             : 
     325             :                             GraphicObject( const GraphicManager* pMgr = NULL );
     326             :                             GraphicObject( const Graphic& rGraphic, const GraphicManager* pMgr = NULL );
     327             :                             GraphicObject( const GraphicObject& rCacheObj, const GraphicManager* pMgr = NULL );
     328             :                             explicit GraphicObject( const OString& rUniqueID, const GraphicManager* pMgr = NULL );
     329             :                             virtual ~GraphicObject();
     330             : 
     331             :     GraphicObject&          operator=( const GraphicObject& rCacheObj );
     332             :     bool                    operator==( const GraphicObject& rCacheObj ) const;
     333           0 :     bool                    operator!=( const GraphicObject& rCacheObj ) const { return !( *this == rCacheObj ); }
     334             : 
     335         240 :     bool                    HasSwapStreamHdl() const { return( mpSwapStreamHdl != NULL && mpSwapStreamHdl->IsSet() ); }
     336             :     void                    SetSwapStreamHdl();
     337             :     void                    SetSwapStreamHdl(const Link& rHdl);
     338             :     sal_uLong               GetSwapOutTimeout() const { return( mpSwapOutTimer ? mpSwapOutTimer->GetTimeout() : 0 ); }
     339             : 
     340             :     void                    FireSwapInRequest();
     341             :     void                    FireSwapOutRequest();
     342             : 
     343           0 :     GraphicManager&         GetGraphicManager() const { return *mpMgr; }
     344             : 
     345             :     bool                    IsCached(
     346             :                                 OutputDevice* pOut,
     347             :                                 const Point& rPt,
     348             :                                 const Size& rSz,
     349             :                                 const GraphicAttr* pAttr = NULL,
     350             :                                 sal_uLong nFlags = GRFMGR_DRAW_STANDARD
     351             :                             ) const;
     352             :     void                    ReleaseFromCache();
     353             : 
     354             :     const Graphic&          GetGraphic() const;
     355             :     void                    SetGraphic( const Graphic& rGraphic, const GraphicObject* pCopyObj = 0);
     356             :     void                    SetGraphic( const Graphic& rGraphic, const OUString& rLink );
     357             : 
     358             :     /** Get graphic transformed according to given attributes
     359             : 
     360             :         This method returns a Graphic transformed, cropped and scaled
     361             :         to the given parameters, ready to be rendered to printer or
     362             :         display. The returned graphic has the same visual appearance
     363             :         as if it had been drawn via GraphicObject::Draw() to a
     364             :         specific output device.
     365             : 
     366             :         @param rDestSize
     367             :         Desired output size in logical coordinates. The mapmode to
     368             :         interpret these logical coordinates in is given by the second
     369             :         parameter, rDestMap.
     370             : 
     371             :         @param rDestMap
     372             :         Mapmode the output should be interpreted in. This is used to
     373             :         interpret rDestSize, to set the appropriate PrefMapMode on the
     374             :         returned Graphic, and to deal correctly with metafile graphics.
     375             : 
     376             :         @param rAttr
     377             :         Graphic attributes used to transform the graphic. This
     378             :         includes cropping, rotation, mirroring, and various color
     379             :         adjustment parameters.
     380             : 
     381             :         @return the readily transformed Graphic
     382             :      */
     383             :     Graphic                 GetTransformedGraphic(
     384             :                                 const Size& rDestSize,
     385             :                                 const MapMode& rDestMap,
     386             :                                 const GraphicAttr& rAttr
     387             :                             ) const;
     388             :     Graphic                 GetTransformedGraphic( const GraphicAttr* pAttr = NULL ) const; // TODO: Change to Impl
     389             : 
     390             :     void                    SetAttr( const GraphicAttr& rAttr );
     391         422 :     const GraphicAttr&      GetAttr() const { return maAttr; }
     392             : 
     393           0 :     bool                    HasLink() const { return !maLink.isEmpty(); }
     394             :     void                    SetLink();
     395             :     void                    SetLink( const OUString& rLink );
     396        7170 :     OUString                GetLink() const { return maLink; }
     397             : 
     398        2646 :     bool                    HasUserData() const { return !maUserData.isEmpty(); }
     399             :     void                    SetUserData();
     400             :     void                    SetUserData( const OUString& rUserData );
     401         150 :     OUString                GetUserData() const { return maUserData; }
     402             : 
     403             :     OString                 GetUniqueID() const;
     404             : 
     405       50769 :     GraphicType             GetType() const { return meType; }
     406         414 :     const Size&             GetPrefSize() const { return maPrefSize; }
     407         414 :     const MapMode&          GetPrefMapMode() const { return maPrefMapMode; }
     408       28560 :     sal_uLong               GetSizeBytes() const { return mnSizeBytes; }
     409         425 :     bool                    IsTransparent() const { return mbTransparent; }
     410             :     bool                    IsAlpha() const { return mbAlpha; }
     411        4139 :     bool                    IsAnimated() const { return mbAnimated; }
     412        3598 :     bool                    IsEPS() const { return mbEPS; }
     413             : 
     414           0 :     Link                    GetAnimationNotifyHdl() const { return maGraphic.GetAnimationNotifyHdl(); }
     415             : 
     416             :     bool                    SwapOut();
     417             :     bool                    SwapOut( SvStream* pOStm );
     418             :     bool                    SwapIn();
     419             : 
     420        3600 :     bool                    IsInSwapIn() const { return mbIsInSwapIn; }
     421         210 :     bool                    IsInSwapOut() const { return mbIsInSwapOut; }
     422             :     bool                    IsInSwap() const { return( mbIsInSwapOut || mbIsInSwapOut ); }
     423       84024 :     bool                    IsSwappedOut() const { return( mbAutoSwapped || maGraphic.IsSwapOut() ); }
     424             :     void                    SetSwapState();
     425             : 
     426             :     bool                    Draw(
     427             :                                 OutputDevice* pOut,
     428             :                                 const Point& rPt,
     429             :                                 const Size& rSz,
     430             :                                 const GraphicAttr* pAttr = NULL,
     431             :                                 sal_uLong nFlags = GRFMGR_DRAW_STANDARD
     432             :                             );
     433             : 
     434             :     bool                    DrawWithPDFHandling(
     435             :                                 OutputDevice& rOutDev,
     436             :                                 const Point& rPt,
     437             :                                 const Size& rSz,
     438             :                                 const GraphicAttr* pGrfAttr = NULL,
     439             :                                 const sal_uLong nFlags = GRFMGR_DRAW_STANDARD
     440             :                             );
     441             : 
     442             :     /** Draw the graphic repeatedly into the given output rectangle
     443             : 
     444             :         @param pOut
     445             :         OutputDevice where the rendering should take place
     446             : 
     447             :         @param rArea
     448             :         The output area that is filled with tiled instances of this graphic
     449             : 
     450             :         @param rSize
     451             :         The actual size of a single tile
     452             : 
     453             :         @param rOffset
     454             :         Offset from the left, top position of rArea, where to start
     455             :         the tiling. The upper left corner of the graphic tilings will
     456             :         virtually start at this position. Concretely, only that many
     457             :         tiles are drawn to completely fill the given output area.
     458             : 
     459             :         @param pAttr
     460             :         Optional GraphicAttr
     461             : 
     462             :         @param nFlags
     463             :         Optional rendering flags
     464             : 
     465             :         @param nTileCacheSize1D
     466             :         Optional dimension of the generated cache tiles. The pOut sees
     467             :         a number of tile draws, which have approximately
     468             :         nTileCacheSize1D times nTileCacheSize1D bitmap sizes if the
     469             :         tile bitmap is smaller. Otherwise, the tile is drawn as
     470             :         is. This is useful if e.g. you want only a few, very large
     471             :         bitmap drawings appear on the outdev.
     472             : 
     473             :         @return sal_True, if drawing completed successfully
     474             :      */
     475             :     bool                    DrawTiled(
     476             :                                 OutputDevice* pOut,
     477             :                                 const Rectangle& rArea,
     478             :                                 const Size& rSize,
     479             :                                 const Size& rOffset,
     480             :                                 const GraphicAttr* pAttr = NULL,
     481             :                                 sal_uLong nFlags = GRFMGR_DRAW_STANDARD,
     482             :                                 int nTileCacheSize1D=128
     483             :                             );
     484             : 
     485             :     bool                    StartAnimation(
     486             :                                 OutputDevice* pOut,
     487             :                                 const Point& rPt,
     488             :                                 const Size& rSz,
     489             :                                 long nExtraData = 0L,
     490             :                                 const GraphicAttr* pAttr = NULL,
     491             :                                 sal_uLong nFlags = GRFMGR_DRAW_STANDARD,
     492             :                                 OutputDevice* pFirstFrameOutDev = NULL
     493             :                             );
     494             : 
     495             :     void                    StopAnimation( OutputDevice* pOut = NULL, long nExtraData = 0L );
     496             : 
     497             :     friend SvStream&        WriteGraphicObject( SvStream& rOStm, const GraphicObject& rGraphicObj );
     498             :     friend SvStream&        ReadGraphicObject( SvStream& rIStm, GraphicObject& rGraphicObj );
     499             : 
     500             :     static GraphicObject    CreateGraphicObjectFromURL( const OUString &rURL );
     501             :     // will inspect an object ( e.g. a control ) for any 'ImageURL'
     502             :     // properties and return these in a vector. Note: this implementation
     503             :     // will cater for XNameContainer objects and deepinspect any containees
     504             :     // if they exist
     505             :     static void InspectForGraphicObjectImageURL( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIf, std::vector< OUString >& rvEmbedImgUrls );
     506             : 
     507             :     // create CropScaling information
     508             :     // fWidth, fHeight: object size
     509             :     // f*Crop: crop values relative to original bitmap size
     510             :     basegfx::B2DVector calculateCropScaling(
     511             :         double fWidth,
     512             :         double fHeight,
     513             :         double fLeftCrop,
     514             :         double fTopCrop,
     515             :         double fRightCrop,
     516             :         double fBottomCrop) const;
     517             : 
     518             :     // read access
     519           0 :     sal_uLong GetDataChangeTimeStamp() const { return mnDataChangeTimeStamp; }
     520             : };
     521             : 
     522             : typedef ::std::vector< GraphicObject* > GraphicObjectList_impl;
     523             : 
     524             : class SVT_DLLPUBLIC GraphicManager
     525             : {
     526             :     friend class GraphicObject;
     527             :     friend class GraphicDisplayCacheEntry;
     528             : 
     529             : private:
     530             : 
     531             :     GraphicObjectList_impl  maObjList;
     532             :     GraphicCache*           mpCache;
     533             : 
     534             :                         GraphicManager( const GraphicManager& ) {}
     535             :     GraphicManager&     operator=( const GraphicManager& ) { return *this; }
     536             : 
     537             :     bool SVT_DLLPRIVATE ImplDraw(
     538             :                             OutputDevice* pOut,
     539             :                             const Point& rPt,
     540             :                             const Size& rSz,
     541             :                             GraphicObject& rObj,
     542             :                             const GraphicAttr& rAttr,
     543             :                             const sal_uLong nFlags,
     544             :                             bool& rCached
     545             :                         );
     546             : 
     547             :     bool SVT_DLLPRIVATE ImplCreateOutput(
     548             :                             OutputDevice* pOut,
     549             :                             const Point& rPt,
     550             :                             const Size& rSz,
     551             :                             const BitmapEx& rBmpEx,
     552             :                             const GraphicAttr& rAttr,
     553             :                             const sal_uLong nFlags,
     554             :                             BitmapEx* pBmpEx = NULL
     555             :                         );
     556             :     bool SVT_DLLPRIVATE ImplCreateOutput(
     557             :                             OutputDevice* pOut,
     558             :                             const Point& rPt,
     559             :                             const Size& rSz,
     560             :                             const GDIMetaFile& rMtf,
     561             :                             const GraphicAttr& rAttr,
     562             :                             const sal_uLong nFlags,
     563             :                             GDIMetaFile& rOutMtf,
     564             :                             BitmapEx& rOutBmpEx
     565             :                         );
     566             : 
     567             :     static void SVT_DLLPRIVATE ImplAdjust(
     568             :                             BitmapEx& rBmpEx,
     569             :                             const GraphicAttr& rAttr,
     570             :                             sal_uLong nAdjustmentFlags
     571             :                         );
     572             :     static void SVT_DLLPRIVATE ImplAdjust(
     573             :                             GDIMetaFile& rMtf,
     574             :                             const GraphicAttr& rAttr,
     575             :                             sal_uLong nAdjustmentFlags
     576             :                         );
     577             :     static void SVT_DLLPRIVATE ImplAdjust(
     578             :                             Animation& rAnimation,
     579             :                             const GraphicAttr& rAttr,
     580             :                             sal_uLong nAdjustmentFlags
     581             :                         );
     582             : 
     583             :     static void SVT_DLLPRIVATE ImplDraw(
     584             :                             OutputDevice* pOut,
     585             :                             const Point& rPt,
     586             :                             const Size& rSz,
     587             :                             const GDIMetaFile& rMtf,
     588             :                             const GraphicAttr& rAttr
     589             :                         );
     590             : 
     591             :                     // Only used by GraphicObject's Ctor's and Dtor's
     592             :     void SVT_DLLPRIVATE ImplRegisterObj(
     593             :                             const GraphicObject& rObj,
     594             :                             Graphic& rSubstitute,
     595             :                             const OString* pID = NULL,
     596             :                             const GraphicObject* pCopyObj = NULL
     597             :                         );
     598             :     void SVT_DLLPRIVATE ImplUnregisterObj( const GraphicObject& rObj );
     599       30772 :     inline bool SVT_DLLPRIVATE ImplHasObjects() const { return !maObjList.empty(); }
     600             : 
     601             :                     // Only used in swap case by GraphicObject
     602             :     void SVT_DLLPRIVATE ImplGraphicObjectWasSwappedOut( const GraphicObject& rObj );
     603             :     bool SVT_DLLPRIVATE ImplFillSwappedGraphicObject(
     604             :                             const GraphicObject& rObj,
     605             :                             Graphic& rSubstitute
     606             :                         );
     607             :     void SVT_DLLPRIVATE ImplGraphicObjectWasSwappedIn( const GraphicObject& rObj );
     608             : 
     609             :     OString SVT_DLLPRIVATE ImplGetUniqueID( const GraphicObject& rObj ) const;
     610             : 
     611             :     // This method allows to check memory footprint for all currently swapped in GraphicObjects on this GraphicManager
     612             :     // which are based on Bitmaps. This is needed on 32Bit systems and only does something on those systems. The problem
     613             :     // to solve is that normally the SwapOut is timer-driven, but even with short timer settings there are situations
     614             :     // where this does not trigger - or in other words: A maximum limitation for GraphicManagers was not in place before.
     615             :     // For 32Bit systems this leads to situations where graphics will be missing. This method will actively swap out
     616             :     // the longest swapped in graphics until a maximum memory boundary (derived from user settings in tools/options/memory)
     617             :     // is no longer exceeded
     618             :     void SVT_DLLPRIVATE ImplCheckSizeOfSwappedInGraphics();
     619             : public:
     620             : 
     621             :                         GraphicManager( sal_uLong nCacheSize = 10000000UL, sal_uLong nMaxObjCacheSize = 2400000UL );
     622             :                         ~GraphicManager();
     623             : 
     624             :     void                SetMaxCacheSize( sal_uLong nNewCacheSize );
     625             :     sal_uLong           GetMaxCacheSize() const;
     626             : 
     627             :     void                SetMaxObjCacheSize(
     628             :                             sal_uLong nNewMaxObjSize,
     629             :                             bool bDestroyGreaterCached = false
     630             :                         );
     631             : 
     632             :     void                SetCacheTimeout( sal_uLong nTimeoutSeconds );
     633             : 
     634             :     void                ReleaseFromCache( const GraphicObject& rObj );
     635             : 
     636             :     bool                IsInCache(
     637             :                             OutputDevice* pOut,
     638             :                             const Point& rPt,
     639             :                             const Size& rSz,
     640             :                             const GraphicObject& rObj,
     641             :                             const GraphicAttr& rAttr
     642             :                         ) const;
     643             : 
     644             :     bool                DrawObj(
     645             :                             OutputDevice* pOut,
     646             :                             const Point& rPt,
     647             :                             const Size& rSz,
     648             :                             GraphicObject& rObj,
     649             :                             const GraphicAttr& rAttr,
     650             :                             const sal_uLong nFlags,
     651             :                             bool& rCached
     652             :                         );
     653             : };
     654             : 
     655             : #endif // INCLUDED_SVTOOLS_GRFMGR_HXX
     656             : 
     657             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10