15900e8ecSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 35900e8ecSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 45900e8ecSAndrew Rist * or more contributor license agreements. See the NOTICE file 55900e8ecSAndrew Rist * distributed with this work for additional information 65900e8ecSAndrew Rist * regarding copyright ownership. The ASF licenses this file 75900e8ecSAndrew Rist * to you under the Apache License, Version 2.0 (the 85900e8ecSAndrew Rist * "License"); you may not use this file except in compliance 95900e8ecSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 115900e8ecSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 135900e8ecSAndrew Rist * Unless required by applicable law or agreed to in writing, 145900e8ecSAndrew Rist * software distributed under the License is distributed on an 155900e8ecSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 165900e8ecSAndrew Rist * KIND, either express or implied. See the License for the 175900e8ecSAndrew Rist * specific language governing permissions and limitations 185900e8ecSAndrew Rist * under the License. 19cdf0e10cSrcweir * 205900e8ecSAndrew Rist *************************************************************/ 215900e8ecSAndrew Rist 225900e8ecSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_svtools.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #define ENABLE_BYTESTRING_STREAM_OPERATORS 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include <algorithm> 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include <tools/vcompat.hxx> 32cdf0e10cSrcweir #include <unotools/ucbstreamhelper.hxx> 33cdf0e10cSrcweir #include <unotools/localfilehelper.hxx> 34cdf0e10cSrcweir #include <unotools/tempfile.hxx> 35cdf0e10cSrcweir #include <vcl/svapp.hxx> 36cdf0e10cSrcweir #include <vcl/cvtgrf.hxx> 37cdf0e10cSrcweir #include <vcl/metaact.hxx> 38cdf0e10cSrcweir #include <vcl/virdev.hxx> 39cdf0e10cSrcweir #include <vcl/salbtype.hxx> 40cdf0e10cSrcweir #include <unotools/cacheoptions.hxx> 41cdf0e10cSrcweir #include <svtools/grfmgr.hxx> 42cdf0e10cSrcweir 43cdf0e10cSrcweir // --> OD 2010-01-04 #i105243# 44cdf0e10cSrcweir #include <vcl/pdfextoutdevdata.hxx> 45cdf0e10cSrcweir // <-- 46cdf0e10cSrcweir 47cdf0e10cSrcweir // ----------- 48cdf0e10cSrcweir // - Defines - 49cdf0e10cSrcweir // ----------- 50cdf0e10cSrcweir 51cdf0e10cSrcweir #define WATERMARK_LUM_OFFSET 50 52cdf0e10cSrcweir #define WATERMARK_CON_OFFSET -70 53cdf0e10cSrcweir 54cdf0e10cSrcweir // ----------- 55cdf0e10cSrcweir // - statics - 56cdf0e10cSrcweir // ----------- 57cdf0e10cSrcweir 58cdf0e10cSrcweir GraphicManager* GraphicObject::mpGlobalMgr = NULL; 59cdf0e10cSrcweir 60cdf0e10cSrcweir // --------------------- 61cdf0e10cSrcweir // - GrfDirectCacheObj - 62cdf0e10cSrcweir // --------------------- 63cdf0e10cSrcweir 64cdf0e10cSrcweir struct GrfSimpleCacheObj 65cdf0e10cSrcweir { 66cdf0e10cSrcweir Graphic maGraphic; 67cdf0e10cSrcweir GraphicAttr maAttr; 68cdf0e10cSrcweir 69cdf0e10cSrcweir GrfSimpleCacheObj( const Graphic& rGraphic, const GraphicAttr& rAttr ) : 70cdf0e10cSrcweir maGraphic( rGraphic ), maAttr( rAttr ) {} 71cdf0e10cSrcweir }; 72cdf0e10cSrcweir 73cdf0e10cSrcweir // ----------------- 74cdf0e10cSrcweir // - GraphicObject - 75cdf0e10cSrcweir // ----------------- 76cdf0e10cSrcweir 77cdf0e10cSrcweir TYPEINIT1_AUTOFACTORY( GraphicObject, SvDataCopyStream ); 78cdf0e10cSrcweir 79*d327e58aSArmin Le Grand // unique increasing ID for being able to detect the GraphicObject with the 80*d327e58aSArmin Le Grand // oldest last data changes 81*d327e58aSArmin Le Grand static sal_uLong aIncrementingTimeOfLastDataChange = 1; 82*d327e58aSArmin Le Grand 83*d327e58aSArmin Le Grand void GraphicObject::ImplAfterDataChange() 84*d327e58aSArmin Le Grand { 85*d327e58aSArmin Le Grand // set unique timestamp ID of last data change 86*d327e58aSArmin Le Grand mnDataChangeTimeStamp = aIncrementingTimeOfLastDataChange++; 87*d327e58aSArmin Le Grand 88*d327e58aSArmin Le Grand // check memory footprint of all GraphicObjects managed and evtl. take action 89*d327e58aSArmin Le Grand GetGraphicManager().ImplCheckSizeOfSwappedInGraphics(); 90*d327e58aSArmin Le Grand } 91*d327e58aSArmin Le Grand 92cdf0e10cSrcweir // ----------------------------------------------------------------------------- 93cdf0e10cSrcweir 94cdf0e10cSrcweir GraphicObject::GraphicObject( const GraphicManager* pMgr ) : 95cdf0e10cSrcweir mpLink ( NULL ), 96cdf0e10cSrcweir mpUserData ( NULL ) 97cdf0e10cSrcweir { 98cdf0e10cSrcweir ImplConstruct(); 99cdf0e10cSrcweir ImplAssignGraphicData(); 100cdf0e10cSrcweir ImplSetGraphicManager( pMgr ); 101cdf0e10cSrcweir } 102cdf0e10cSrcweir 103cdf0e10cSrcweir // ----------------------------------------------------------------------------- 104cdf0e10cSrcweir 105cdf0e10cSrcweir GraphicObject::GraphicObject( const Graphic& rGraphic, const GraphicManager* pMgr ) : 106cdf0e10cSrcweir maGraphic ( rGraphic ), 107cdf0e10cSrcweir mpLink ( NULL ), 108cdf0e10cSrcweir mpUserData ( NULL ) 109cdf0e10cSrcweir { 110cdf0e10cSrcweir ImplConstruct(); 111cdf0e10cSrcweir ImplAssignGraphicData(); 112cdf0e10cSrcweir ImplSetGraphicManager( pMgr ); 113cdf0e10cSrcweir } 114cdf0e10cSrcweir 115cdf0e10cSrcweir // ----------------------------------------------------------------------------- 116cdf0e10cSrcweir 117cdf0e10cSrcweir GraphicObject::GraphicObject( const Graphic& rGraphic, const String& rLink, const GraphicManager* pMgr ) : 118cdf0e10cSrcweir maGraphic ( rGraphic ), 119cdf0e10cSrcweir mpLink ( rLink.Len() ? ( new String( rLink ) ) : NULL ), 120cdf0e10cSrcweir mpUserData ( NULL ) 121cdf0e10cSrcweir { 122cdf0e10cSrcweir ImplConstruct(); 123cdf0e10cSrcweir ImplAssignGraphicData(); 124cdf0e10cSrcweir ImplSetGraphicManager( pMgr ); 125cdf0e10cSrcweir } 126cdf0e10cSrcweir 127cdf0e10cSrcweir // ----------------------------------------------------------------------------- 128cdf0e10cSrcweir 129cdf0e10cSrcweir GraphicObject::GraphicObject( const GraphicObject& rGraphicObj, const GraphicManager* pMgr ) : 130cdf0e10cSrcweir SvDataCopyStream(), 131cdf0e10cSrcweir maGraphic ( rGraphicObj.GetGraphic() ), 132cdf0e10cSrcweir maAttr ( rGraphicObj.maAttr ), 133cdf0e10cSrcweir mpLink ( rGraphicObj.mpLink ? ( new String( *rGraphicObj.mpLink ) ) : NULL ), 134cdf0e10cSrcweir mpUserData ( rGraphicObj.mpUserData ? ( new String( *rGraphicObj.mpUserData ) ) : NULL ) 135cdf0e10cSrcweir { 136cdf0e10cSrcweir ImplConstruct(); 137cdf0e10cSrcweir ImplAssignGraphicData(); 138cdf0e10cSrcweir ImplSetGraphicManager( pMgr, NULL, &rGraphicObj ); 139cdf0e10cSrcweir } 140cdf0e10cSrcweir 141cdf0e10cSrcweir // ----------------------------------------------------------------------------- 142cdf0e10cSrcweir 143cdf0e10cSrcweir GraphicObject::GraphicObject( const ByteString& rUniqueID, const GraphicManager* pMgr ) : 144cdf0e10cSrcweir mpLink ( NULL ), 145cdf0e10cSrcweir mpUserData ( NULL ) 146cdf0e10cSrcweir { 147cdf0e10cSrcweir ImplConstruct(); 148cdf0e10cSrcweir 149cdf0e10cSrcweir // assign default properties 150cdf0e10cSrcweir ImplAssignGraphicData(); 151cdf0e10cSrcweir 152cdf0e10cSrcweir ImplSetGraphicManager( pMgr, &rUniqueID ); 153cdf0e10cSrcweir 154cdf0e10cSrcweir // update properties 155cdf0e10cSrcweir ImplAssignGraphicData(); 156cdf0e10cSrcweir } 157cdf0e10cSrcweir 158cdf0e10cSrcweir // ----------------------------------------------------------------------------- 159cdf0e10cSrcweir 160cdf0e10cSrcweir GraphicObject::~GraphicObject() 161cdf0e10cSrcweir { 162cdf0e10cSrcweir if( mpMgr ) 163cdf0e10cSrcweir { 164cdf0e10cSrcweir mpMgr->ImplUnregisterObj( *this ); 165cdf0e10cSrcweir 166cdf0e10cSrcweir if( ( mpMgr == mpGlobalMgr ) && !mpGlobalMgr->ImplHasObjects() ) 167cdf0e10cSrcweir delete mpGlobalMgr, mpGlobalMgr = NULL; 168cdf0e10cSrcweir } 169cdf0e10cSrcweir 170cdf0e10cSrcweir delete mpSwapOutTimer; 171cdf0e10cSrcweir delete mpSwapStreamHdl; 172cdf0e10cSrcweir delete mpLink; 173cdf0e10cSrcweir delete mpUserData; 174cdf0e10cSrcweir delete mpSimpleCache; 175cdf0e10cSrcweir } 176cdf0e10cSrcweir 177cdf0e10cSrcweir // ----------------------------------------------------------------------------- 178cdf0e10cSrcweir 179cdf0e10cSrcweir void GraphicObject::ImplConstruct() 180cdf0e10cSrcweir { 181cdf0e10cSrcweir mpMgr = NULL; 182cdf0e10cSrcweir mpSwapStreamHdl = NULL; 183cdf0e10cSrcweir mpSwapOutTimer = NULL; 184cdf0e10cSrcweir mpSimpleCache = NULL; 185cdf0e10cSrcweir mnAnimationLoopCount = 0; 186cdf0e10cSrcweir mbAutoSwapped = sal_False; 187cdf0e10cSrcweir mbIsInSwapIn = sal_False; 188cdf0e10cSrcweir mbIsInSwapOut = sal_False; 189*d327e58aSArmin Le Grand 190*d327e58aSArmin Le Grand // Init with a unique, increasing ID 191*d327e58aSArmin Le Grand mnDataChangeTimeStamp = aIncrementingTimeOfLastDataChange++; 192cdf0e10cSrcweir } 193cdf0e10cSrcweir 194cdf0e10cSrcweir // ----------------------------------------------------------------------------- 195cdf0e10cSrcweir 196cdf0e10cSrcweir void GraphicObject::ImplAssignGraphicData() 197cdf0e10cSrcweir { 198cdf0e10cSrcweir maPrefSize = maGraphic.GetPrefSize(); 199cdf0e10cSrcweir maPrefMapMode = maGraphic.GetPrefMapMode(); 200cdf0e10cSrcweir mnSizeBytes = maGraphic.GetSizeBytes(); 201cdf0e10cSrcweir meType = maGraphic.GetType(); 202cdf0e10cSrcweir mbTransparent = maGraphic.IsTransparent(); 203cdf0e10cSrcweir mbAlpha = maGraphic.IsAlpha(); 204cdf0e10cSrcweir mbAnimated = maGraphic.IsAnimated(); 205cdf0e10cSrcweir mbEPS = maGraphic.IsEPS(); 206cdf0e10cSrcweir mnAnimationLoopCount = ( mbAnimated ? maGraphic.GetAnimationLoopCount() : 0 ); 207cdf0e10cSrcweir } 208cdf0e10cSrcweir 209cdf0e10cSrcweir // ----------------------------------------------------------------------------- 210cdf0e10cSrcweir 211cdf0e10cSrcweir void GraphicObject::ImplSetGraphicManager( const GraphicManager* pMgr, const ByteString* pID, const GraphicObject* pCopyObj ) 212cdf0e10cSrcweir { 213cdf0e10cSrcweir if( !mpMgr || ( pMgr != mpMgr ) ) 214cdf0e10cSrcweir { 215cdf0e10cSrcweir if( !pMgr && mpMgr && ( mpMgr == mpGlobalMgr ) ) 216cdf0e10cSrcweir return; 217cdf0e10cSrcweir else 218cdf0e10cSrcweir { 219cdf0e10cSrcweir if( mpMgr ) 220cdf0e10cSrcweir { 221cdf0e10cSrcweir mpMgr->ImplUnregisterObj( *this ); 222cdf0e10cSrcweir 223cdf0e10cSrcweir if( ( mpMgr == mpGlobalMgr ) && !mpGlobalMgr->ImplHasObjects() ) 224cdf0e10cSrcweir delete mpGlobalMgr, mpGlobalMgr = NULL; 225cdf0e10cSrcweir } 226cdf0e10cSrcweir 227cdf0e10cSrcweir if( !pMgr ) 228cdf0e10cSrcweir { 229cdf0e10cSrcweir if( !mpGlobalMgr ) 230cdf0e10cSrcweir { 231cdf0e10cSrcweir SvtCacheOptions aCacheOptions; 232cdf0e10cSrcweir 233cdf0e10cSrcweir mpGlobalMgr = new GraphicManager( aCacheOptions.GetGraphicManagerTotalCacheSize(), 234cdf0e10cSrcweir aCacheOptions.GetGraphicManagerObjectCacheSize() ); 235cdf0e10cSrcweir mpGlobalMgr->SetCacheTimeout( aCacheOptions.GetGraphicManagerObjectReleaseTime() ); 236cdf0e10cSrcweir } 237cdf0e10cSrcweir 238cdf0e10cSrcweir mpMgr = mpGlobalMgr; 239cdf0e10cSrcweir } 240cdf0e10cSrcweir else 241cdf0e10cSrcweir mpMgr = (GraphicManager*) pMgr; 242cdf0e10cSrcweir 243cdf0e10cSrcweir mpMgr->ImplRegisterObj( *this, maGraphic, pID, pCopyObj ); 244cdf0e10cSrcweir } 245cdf0e10cSrcweir } 246cdf0e10cSrcweir } 247cdf0e10cSrcweir 248cdf0e10cSrcweir // ----------------------------------------------------------------------------- 249cdf0e10cSrcweir 250cdf0e10cSrcweir void GraphicObject::ImplAutoSwapIn() 251cdf0e10cSrcweir { 252cdf0e10cSrcweir if( IsSwappedOut() ) 253cdf0e10cSrcweir { 254cdf0e10cSrcweir if( mpMgr && mpMgr->ImplFillSwappedGraphicObject( *this, maGraphic ) ) 255cdf0e10cSrcweir mbAutoSwapped = sal_False; 256cdf0e10cSrcweir else 257cdf0e10cSrcweir { 258cdf0e10cSrcweir mbIsInSwapIn = sal_True; 259cdf0e10cSrcweir 260cdf0e10cSrcweir if( maGraphic.SwapIn() ) 261cdf0e10cSrcweir mbAutoSwapped = sal_False; 262cdf0e10cSrcweir else 263cdf0e10cSrcweir { 264cdf0e10cSrcweir SvStream* pStream = GetSwapStream(); 265cdf0e10cSrcweir 266cdf0e10cSrcweir if( GRFMGR_AUTOSWAPSTREAM_NONE != pStream ) 267cdf0e10cSrcweir { 268cdf0e10cSrcweir if( GRFMGR_AUTOSWAPSTREAM_LINK == pStream ) 269cdf0e10cSrcweir { 270cdf0e10cSrcweir if( HasLink() ) 271cdf0e10cSrcweir { 272cdf0e10cSrcweir String aURLStr; 273cdf0e10cSrcweir 274cdf0e10cSrcweir if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( GetLink(), aURLStr ) ) 275cdf0e10cSrcweir { 276cdf0e10cSrcweir SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aURLStr, STREAM_READ ); 277cdf0e10cSrcweir 278cdf0e10cSrcweir if( pIStm ) 279cdf0e10cSrcweir { 280cdf0e10cSrcweir (*pIStm) >> maGraphic; 281cdf0e10cSrcweir mbAutoSwapped = ( maGraphic.GetType() != GRAPHIC_NONE ); 282cdf0e10cSrcweir delete pIStm; 283cdf0e10cSrcweir } 284cdf0e10cSrcweir } 285cdf0e10cSrcweir } 286cdf0e10cSrcweir } 287cdf0e10cSrcweir else if( GRFMGR_AUTOSWAPSTREAM_TEMP == pStream ) 288cdf0e10cSrcweir mbAutoSwapped = !maGraphic.SwapIn(); 289cdf0e10cSrcweir else if( GRFMGR_AUTOSWAPSTREAM_LOADED == pStream ) 290cdf0e10cSrcweir mbAutoSwapped = maGraphic.IsSwapOut(); 291cdf0e10cSrcweir else 292cdf0e10cSrcweir { 293cdf0e10cSrcweir mbAutoSwapped = !maGraphic.SwapIn( pStream ); 294cdf0e10cSrcweir delete pStream; 295cdf0e10cSrcweir } 296cdf0e10cSrcweir } 297cdf0e10cSrcweir else 298cdf0e10cSrcweir { 299cdf0e10cSrcweir DBG_ASSERT( ( GRAPHIC_NONE == meType ) || ( GRAPHIC_DEFAULT == meType ), 300cdf0e10cSrcweir "GraphicObject::ImplAutoSwapIn: could not get stream to swap in graphic! (=>KA)" ); 301cdf0e10cSrcweir } 302cdf0e10cSrcweir } 303cdf0e10cSrcweir 304cdf0e10cSrcweir mbIsInSwapIn = sal_False; 305cdf0e10cSrcweir 306cdf0e10cSrcweir if( !mbAutoSwapped && mpMgr ) 307cdf0e10cSrcweir mpMgr->ImplGraphicObjectWasSwappedIn( *this ); 308cdf0e10cSrcweir } 309*d327e58aSArmin Le Grand 310*d327e58aSArmin Le Grand // Handle evtl. needed AfterDataChanges 311*d327e58aSArmin Le Grand ImplAfterDataChange(); 312cdf0e10cSrcweir } 313cdf0e10cSrcweir } 314cdf0e10cSrcweir 315cdf0e10cSrcweir // ----------------------------------------------------------------------------- 316cdf0e10cSrcweir sal_Bool GraphicObject::ImplGetCropParams( OutputDevice* pOut, Point& rPt, Size& rSz, const GraphicAttr* pAttr, 317cdf0e10cSrcweir PolyPolygon& rClipPolyPoly, sal_Bool& bRectClipRegion ) const 318cdf0e10cSrcweir { 319cdf0e10cSrcweir sal_Bool bRet = sal_False; 320cdf0e10cSrcweir 321cdf0e10cSrcweir if( GetType() != GRAPHIC_NONE ) 322cdf0e10cSrcweir { 323cdf0e10cSrcweir Polygon aClipPoly( Rectangle( rPt, rSz ) ); 324cdf0e10cSrcweir const sal_uInt16 nRot10 = pAttr->GetRotation() % 3600; 325cdf0e10cSrcweir const Point aOldOrigin( rPt ); 326cdf0e10cSrcweir // --> OD 2005-09-30 #i54875# - It's not needed to get the graphic again. 327cdf0e10cSrcweir // const Graphic& rGraphic = GetGraphic(); 328cdf0e10cSrcweir // <-- 329cdf0e10cSrcweir const MapMode aMap100( MAP_100TH_MM ); 330cdf0e10cSrcweir Size aSize100; 331cdf0e10cSrcweir long nTotalWidth, nTotalHeight; 332cdf0e10cSrcweir long nNewLeft, nNewTop, nNewRight, nNewBottom; 333cdf0e10cSrcweir double fScale; 334cdf0e10cSrcweir 335cdf0e10cSrcweir if( nRot10 ) 336cdf0e10cSrcweir { 337cdf0e10cSrcweir aClipPoly.Rotate( rPt, nRot10 ); 338cdf0e10cSrcweir bRectClipRegion = sal_False; 339cdf0e10cSrcweir } 340cdf0e10cSrcweir else 341cdf0e10cSrcweir bRectClipRegion = sal_True; 342cdf0e10cSrcweir 343cdf0e10cSrcweir rClipPolyPoly = aClipPoly; 344cdf0e10cSrcweir 345cdf0e10cSrcweir // --> OD 2005-09-30 #i54875# - directly access member <maGraphic> to 346cdf0e10cSrcweir // get <PrefSize> and <PrefMapMode>. 347cdf0e10cSrcweir // if( rGraphic.GetPrefMapMode() == MAP_PIXEL ) 348cdf0e10cSrcweir // aSize100 = Application::GetDefaultDevice()->PixelToLogic( rGraphic.GetPrefSize(), aMap100 ); 349cdf0e10cSrcweir // else 350cdf0e10cSrcweir // aSize100 = pOut->LogicToLogic( rGraphic.GetPrefSize(), rGraphic.GetPrefMapMode(), aMap100 ); 351cdf0e10cSrcweir if( maGraphic.GetPrefMapMode() == MAP_PIXEL ) 352cdf0e10cSrcweir aSize100 = Application::GetDefaultDevice()->PixelToLogic( maGraphic.GetPrefSize(), aMap100 ); 353cdf0e10cSrcweir else 354cdf0e10cSrcweir { 355cdf0e10cSrcweir MapMode m(maGraphic.GetPrefMapMode()); 356cdf0e10cSrcweir aSize100 = pOut->LogicToLogic( maGraphic.GetPrefSize(), &m, &aMap100 ); 357cdf0e10cSrcweir } 358cdf0e10cSrcweir // <-- 359cdf0e10cSrcweir 360cdf0e10cSrcweir nTotalWidth = aSize100.Width() - pAttr->GetLeftCrop() - pAttr->GetRightCrop(); 361cdf0e10cSrcweir nTotalHeight = aSize100.Height() - pAttr->GetTopCrop() - pAttr->GetBottomCrop(); 362cdf0e10cSrcweir 363cdf0e10cSrcweir if( aSize100.Width() > 0 && aSize100.Height() > 0 && nTotalWidth > 0 && nTotalHeight > 0 ) 364cdf0e10cSrcweir { 365cdf0e10cSrcweir fScale = (double) aSize100.Width() / nTotalWidth; 366cdf0e10cSrcweir nNewLeft = -FRound( ( ( pAttr->GetMirrorFlags() & BMP_MIRROR_HORZ ) ? pAttr->GetRightCrop() : pAttr->GetLeftCrop() ) * fScale ); 367cdf0e10cSrcweir nNewRight = nNewLeft + FRound( aSize100.Width() * fScale ) - 1; 368cdf0e10cSrcweir 369cdf0e10cSrcweir fScale = (double) rSz.Width() / aSize100.Width(); 370cdf0e10cSrcweir rPt.X() += FRound( nNewLeft * fScale ); 371cdf0e10cSrcweir rSz.Width() = FRound( ( nNewRight - nNewLeft + 1 ) * fScale ); 372cdf0e10cSrcweir 373cdf0e10cSrcweir fScale = (double) aSize100.Height() / nTotalHeight; 374cdf0e10cSrcweir nNewTop = -FRound( ( ( pAttr->GetMirrorFlags() & BMP_MIRROR_VERT ) ? pAttr->GetBottomCrop() : pAttr->GetTopCrop() ) * fScale ); 375cdf0e10cSrcweir nNewBottom = nNewTop + FRound( aSize100.Height() * fScale ) - 1; 376cdf0e10cSrcweir 377cdf0e10cSrcweir fScale = (double) rSz.Height() / aSize100.Height(); 378cdf0e10cSrcweir rPt.Y() += FRound( nNewTop * fScale ); 379cdf0e10cSrcweir rSz.Height() = FRound( ( nNewBottom - nNewTop + 1 ) * fScale ); 380cdf0e10cSrcweir 381cdf0e10cSrcweir if( nRot10 ) 382cdf0e10cSrcweir { 383cdf0e10cSrcweir Polygon aOriginPoly( 1 ); 384cdf0e10cSrcweir 385cdf0e10cSrcweir aOriginPoly[ 0 ] = rPt; 386cdf0e10cSrcweir aOriginPoly.Rotate( aOldOrigin, nRot10 ); 387cdf0e10cSrcweir rPt = aOriginPoly[ 0 ]; 388cdf0e10cSrcweir } 389cdf0e10cSrcweir 390cdf0e10cSrcweir bRet = sal_True; 391cdf0e10cSrcweir } 392cdf0e10cSrcweir } 393cdf0e10cSrcweir 394cdf0e10cSrcweir return bRet; 395cdf0e10cSrcweir } 396cdf0e10cSrcweir 397cdf0e10cSrcweir // ----------------------------------------------------------------------------- 398cdf0e10cSrcweir 399cdf0e10cSrcweir GraphicObject& GraphicObject::operator=( const GraphicObject& rGraphicObj ) 400cdf0e10cSrcweir { 401cdf0e10cSrcweir if( &rGraphicObj != this ) 402cdf0e10cSrcweir { 403cdf0e10cSrcweir mpMgr->ImplUnregisterObj( *this ); 404cdf0e10cSrcweir 405cdf0e10cSrcweir delete mpSwapStreamHdl, mpSwapStreamHdl = NULL; 406cdf0e10cSrcweir delete mpSimpleCache, mpSimpleCache = NULL; 407cdf0e10cSrcweir delete mpLink; 408cdf0e10cSrcweir delete mpUserData; 409cdf0e10cSrcweir 410cdf0e10cSrcweir maGraphic = rGraphicObj.GetGraphic(); 411cdf0e10cSrcweir maAttr = rGraphicObj.maAttr; 412cdf0e10cSrcweir mpLink = rGraphicObj.mpLink ? new String( *rGraphicObj.mpLink ) : NULL; 413cdf0e10cSrcweir mpUserData = rGraphicObj.mpUserData ? new String( *rGraphicObj.mpUserData ) : NULL; 414cdf0e10cSrcweir ImplAssignGraphicData(); 415cdf0e10cSrcweir mbAutoSwapped = sal_False; 416cdf0e10cSrcweir mpMgr = rGraphicObj.mpMgr; 417cdf0e10cSrcweir 418cdf0e10cSrcweir mpMgr->ImplRegisterObj( *this, maGraphic, NULL, &rGraphicObj ); 419cdf0e10cSrcweir } 420cdf0e10cSrcweir 421cdf0e10cSrcweir return *this; 422cdf0e10cSrcweir } 423cdf0e10cSrcweir 424cdf0e10cSrcweir // ----------------------------------------------------------------------------- 425cdf0e10cSrcweir 426cdf0e10cSrcweir sal_Bool GraphicObject::operator==( const GraphicObject& rGraphicObj ) const 427cdf0e10cSrcweir { 428cdf0e10cSrcweir return( ( rGraphicObj.maGraphic == maGraphic ) && 429cdf0e10cSrcweir ( rGraphicObj.maAttr == maAttr ) && 430cdf0e10cSrcweir ( rGraphicObj.GetLink() == GetLink() ) ); 431cdf0e10cSrcweir } 432cdf0e10cSrcweir 433cdf0e10cSrcweir // ------------------------------------------------------------------------ 434cdf0e10cSrcweir 435cdf0e10cSrcweir void GraphicObject::Load( SvStream& rIStm ) 436cdf0e10cSrcweir { 437cdf0e10cSrcweir rIStm >> *this; 438cdf0e10cSrcweir } 439cdf0e10cSrcweir 440cdf0e10cSrcweir // ------------------------------------------------------------------------ 441cdf0e10cSrcweir 442cdf0e10cSrcweir void GraphicObject::Save( SvStream& rOStm ) 443cdf0e10cSrcweir { 444cdf0e10cSrcweir rOStm << *this; 445cdf0e10cSrcweir } 446cdf0e10cSrcweir 447cdf0e10cSrcweir // ------------------------------------------------------------------------ 448cdf0e10cSrcweir 449cdf0e10cSrcweir void GraphicObject::Assign( const SvDataCopyStream& rCopyStream ) 450cdf0e10cSrcweir { 451cdf0e10cSrcweir *this = (const GraphicObject& ) rCopyStream; 452cdf0e10cSrcweir } 453cdf0e10cSrcweir 454cdf0e10cSrcweir // ----------------------------------------------------------------------------- 455cdf0e10cSrcweir 456cdf0e10cSrcweir ByteString GraphicObject::GetUniqueID() const 457cdf0e10cSrcweir { 458ddde725dSArmin Le Grand if ( !IsInSwapIn() && IsEPS() ) 459cdf0e10cSrcweir const_cast<GraphicObject*>(this)->FireSwapInRequest(); 460cdf0e10cSrcweir 461cdf0e10cSrcweir ByteString aRet; 462cdf0e10cSrcweir 463cdf0e10cSrcweir if( mpMgr ) 464cdf0e10cSrcweir aRet = mpMgr->ImplGetUniqueID( *this ); 465cdf0e10cSrcweir 466cdf0e10cSrcweir return aRet; 467cdf0e10cSrcweir } 468cdf0e10cSrcweir 469cdf0e10cSrcweir // ----------------------------------------------------------------------------- 470cdf0e10cSrcweir 471cdf0e10cSrcweir sal_uLong GraphicObject::GetChecksum() const 472cdf0e10cSrcweir { 473cdf0e10cSrcweir return( ( maGraphic.IsSupportedGraphic() && !maGraphic.IsSwapOut() ) ? maGraphic.GetChecksum() : 0 ); 474cdf0e10cSrcweir } 475cdf0e10cSrcweir 476cdf0e10cSrcweir // ----------------------------------------------------------------------------- 477cdf0e10cSrcweir 478cdf0e10cSrcweir SvStream* GraphicObject::GetSwapStream() const 479cdf0e10cSrcweir { 480cdf0e10cSrcweir return( HasSwapStreamHdl() ? (SvStream*) mpSwapStreamHdl->Call( (void*) this ) : GRFMGR_AUTOSWAPSTREAM_NONE ); 481cdf0e10cSrcweir } 482cdf0e10cSrcweir 483cdf0e10cSrcweir // ----------------------------------------------------------------------------- 484cdf0e10cSrcweir 485cdf0e10cSrcweir // !!! to be removed 486cdf0e10cSrcweir sal_uLong GraphicObject::GetReleaseFromCache() const 487cdf0e10cSrcweir { 488cdf0e10cSrcweir return 0; 489cdf0e10cSrcweir } 490cdf0e10cSrcweir 491cdf0e10cSrcweir // ----------------------------------------------------------------------------- 492cdf0e10cSrcweir 493cdf0e10cSrcweir void GraphicObject::SetAttr( const GraphicAttr& rAttr ) 494cdf0e10cSrcweir { 495cdf0e10cSrcweir maAttr = rAttr; 496cdf0e10cSrcweir 497cdf0e10cSrcweir if( mpSimpleCache && ( mpSimpleCache->maAttr != rAttr ) ) 498cdf0e10cSrcweir delete mpSimpleCache, mpSimpleCache = NULL; 499cdf0e10cSrcweir } 500cdf0e10cSrcweir 501cdf0e10cSrcweir // ----------------------------------------------------------------------------- 502cdf0e10cSrcweir 503cdf0e10cSrcweir void GraphicObject::SetLink() 504cdf0e10cSrcweir { 505cdf0e10cSrcweir if( mpLink ) 506cdf0e10cSrcweir delete mpLink, mpLink = NULL; 507cdf0e10cSrcweir } 508cdf0e10cSrcweir 509cdf0e10cSrcweir // ----------------------------------------------------------------------------- 510cdf0e10cSrcweir 511cdf0e10cSrcweir void GraphicObject::SetLink( const String& rLink ) 512cdf0e10cSrcweir { 513cdf0e10cSrcweir delete mpLink, mpLink = new String( rLink ); 514cdf0e10cSrcweir } 515cdf0e10cSrcweir 516cdf0e10cSrcweir // ----------------------------------------------------------------------------- 517cdf0e10cSrcweir 518cdf0e10cSrcweir String GraphicObject::GetLink() const 519cdf0e10cSrcweir { 520cdf0e10cSrcweir if( mpLink ) 521cdf0e10cSrcweir return *mpLink; 522cdf0e10cSrcweir else 523cdf0e10cSrcweir return String(); 524cdf0e10cSrcweir } 525cdf0e10cSrcweir 526cdf0e10cSrcweir // ----------------------------------------------------------------------------- 527cdf0e10cSrcweir 528cdf0e10cSrcweir void GraphicObject::SetUserData() 529cdf0e10cSrcweir { 530cdf0e10cSrcweir if( mpUserData ) 531cdf0e10cSrcweir delete mpUserData, mpUserData = NULL; 532cdf0e10cSrcweir } 533cdf0e10cSrcweir 534cdf0e10cSrcweir // ----------------------------------------------------------------------------- 535cdf0e10cSrcweir 536cdf0e10cSrcweir void GraphicObject::SetUserData( const String& rUserData ) 537cdf0e10cSrcweir { 538cdf0e10cSrcweir delete mpUserData, mpUserData = new String( rUserData ); 539cdf0e10cSrcweir } 540cdf0e10cSrcweir 541cdf0e10cSrcweir // ----------------------------------------------------------------------------- 542cdf0e10cSrcweir 543cdf0e10cSrcweir String GraphicObject::GetUserData() const 544cdf0e10cSrcweir { 545cdf0e10cSrcweir if( mpUserData ) 546cdf0e10cSrcweir return *mpUserData; 547cdf0e10cSrcweir else 548cdf0e10cSrcweir return String(); 549cdf0e10cSrcweir } 550cdf0e10cSrcweir 551cdf0e10cSrcweir // ----------------------------------------------------------------------------- 552cdf0e10cSrcweir 553cdf0e10cSrcweir void GraphicObject::SetSwapStreamHdl() 554cdf0e10cSrcweir { 555cdf0e10cSrcweir if( mpSwapStreamHdl ) 556cdf0e10cSrcweir { 557cdf0e10cSrcweir delete mpSwapOutTimer, mpSwapOutTimer = NULL; 558cdf0e10cSrcweir delete mpSwapStreamHdl, mpSwapStreamHdl = NULL; 559cdf0e10cSrcweir } 560cdf0e10cSrcweir } 561cdf0e10cSrcweir 562cdf0e10cSrcweir // ----------------------------------------------------------------------------- 563cdf0e10cSrcweir 564cdf0e10cSrcweir void GraphicObject::SetSwapStreamHdl( const Link& rHdl, const sal_uLong nSwapOutTimeout ) 565cdf0e10cSrcweir { 566cdf0e10cSrcweir delete mpSwapStreamHdl, mpSwapStreamHdl = new Link( rHdl ); 567cdf0e10cSrcweir 568cdf0e10cSrcweir if( nSwapOutTimeout ) 569cdf0e10cSrcweir { 570cdf0e10cSrcweir if( !mpSwapOutTimer ) 571cdf0e10cSrcweir { 572cdf0e10cSrcweir mpSwapOutTimer = new Timer; 573cdf0e10cSrcweir mpSwapOutTimer->SetTimeoutHdl( LINK( this, GraphicObject, ImplAutoSwapOutHdl ) ); 574cdf0e10cSrcweir } 575cdf0e10cSrcweir 576cdf0e10cSrcweir mpSwapOutTimer->SetTimeout( nSwapOutTimeout ); 577cdf0e10cSrcweir mpSwapOutTimer->Start(); 578cdf0e10cSrcweir } 579cdf0e10cSrcweir else 580cdf0e10cSrcweir delete mpSwapOutTimer, mpSwapOutTimer = NULL; 581cdf0e10cSrcweir } 582cdf0e10cSrcweir 583cdf0e10cSrcweir // ----------------------------------------------------------------------------- 584cdf0e10cSrcweir 585cdf0e10cSrcweir Link GraphicObject::GetSwapStreamHdl() const 586cdf0e10cSrcweir { 587cdf0e10cSrcweir if( mpSwapStreamHdl ) 588cdf0e10cSrcweir return *mpSwapStreamHdl; 589cdf0e10cSrcweir else 590cdf0e10cSrcweir return Link(); 591cdf0e10cSrcweir } 592cdf0e10cSrcweir 593cdf0e10cSrcweir // ----------------------------------------------------------------------------- 594cdf0e10cSrcweir 595cdf0e10cSrcweir void GraphicObject::FireSwapInRequest() 596cdf0e10cSrcweir { 597cdf0e10cSrcweir ImplAutoSwapIn(); 598cdf0e10cSrcweir } 599cdf0e10cSrcweir 600cdf0e10cSrcweir // ----------------------------------------------------------------------------- 601cdf0e10cSrcweir 602cdf0e10cSrcweir void GraphicObject::FireSwapOutRequest() 603cdf0e10cSrcweir { 604cdf0e10cSrcweir ImplAutoSwapOutHdl( NULL ); 605cdf0e10cSrcweir } 606cdf0e10cSrcweir 607cdf0e10cSrcweir // ----------------------------------------------------------------------------- 608cdf0e10cSrcweir 609cdf0e10cSrcweir void GraphicObject::GraphicManagerDestroyed() 610cdf0e10cSrcweir { 611cdf0e10cSrcweir // we're alive, but our manager doesn't live anymore ==> connect to default manager 612cdf0e10cSrcweir mpMgr = NULL; 613cdf0e10cSrcweir ImplSetGraphicManager( NULL ); 614cdf0e10cSrcweir } 615cdf0e10cSrcweir 616cdf0e10cSrcweir // ----------------------------------------------------------------------------- 617cdf0e10cSrcweir 618cdf0e10cSrcweir void GraphicObject::SetGraphicManager( const GraphicManager& rMgr ) 619cdf0e10cSrcweir { 620cdf0e10cSrcweir ImplSetGraphicManager( &rMgr ); 621cdf0e10cSrcweir } 622cdf0e10cSrcweir 623cdf0e10cSrcweir // ----------------------------------------------------------------------------- 624cdf0e10cSrcweir 625cdf0e10cSrcweir sal_Bool GraphicObject::IsCached( OutputDevice* pOut, const Point& rPt, const Size& rSz, 626cdf0e10cSrcweir const GraphicAttr* pAttr, sal_uLong nFlags ) const 627cdf0e10cSrcweir { 628cdf0e10cSrcweir sal_Bool bRet; 629cdf0e10cSrcweir 630cdf0e10cSrcweir if( nFlags & GRFMGR_DRAW_CACHED ) 631cdf0e10cSrcweir { 632cdf0e10cSrcweir // --> OD 2005-10-11 #i54875# - Consider cropped graphics. 633cdf0e10cSrcweir // Note: The graphic manager caches a cropped graphic with its 634cdf0e10cSrcweir // uncropped position and size. 635cdf0e10cSrcweir // bRet = mpMgr->IsInCache( pOut, rPt, rSz, *this, ( pAttr ? *pAttr : GetAttr() ) ); 636cdf0e10cSrcweir Point aPt( rPt ); 637cdf0e10cSrcweir Size aSz( rSz ); 638cdf0e10cSrcweir if ( pAttr->IsCropped() ) 639cdf0e10cSrcweir { 640cdf0e10cSrcweir PolyPolygon aClipPolyPoly; 641cdf0e10cSrcweir sal_Bool bRectClip; 642cdf0e10cSrcweir ImplGetCropParams( pOut, aPt, aSz, pAttr, aClipPolyPoly, bRectClip ); 643cdf0e10cSrcweir } 644cdf0e10cSrcweir bRet = mpMgr->IsInCache( pOut, aPt, aSz, *this, ( pAttr ? *pAttr : GetAttr() ) ); 645cdf0e10cSrcweir } 646cdf0e10cSrcweir else 647cdf0e10cSrcweir bRet = sal_False; 648cdf0e10cSrcweir 649cdf0e10cSrcweir return bRet; 650cdf0e10cSrcweir } 651cdf0e10cSrcweir 652cdf0e10cSrcweir // ----------------------------------------------------------------------------- 653cdf0e10cSrcweir 654cdf0e10cSrcweir void GraphicObject::ReleaseFromCache() 655cdf0e10cSrcweir { 656cdf0e10cSrcweir 657cdf0e10cSrcweir mpMgr->ReleaseFromCache( *this ); 658cdf0e10cSrcweir } 659cdf0e10cSrcweir 660cdf0e10cSrcweir // ----------------------------------------------------------------------------- 661cdf0e10cSrcweir 662cdf0e10cSrcweir void GraphicObject::SetAnimationNotifyHdl( const Link& rLink ) 663cdf0e10cSrcweir { 664cdf0e10cSrcweir maGraphic.SetAnimationNotifyHdl( rLink ); 665cdf0e10cSrcweir } 666cdf0e10cSrcweir 667cdf0e10cSrcweir // ----------------------------------------------------------------------------- 668cdf0e10cSrcweir 669cdf0e10cSrcweir List* GraphicObject::GetAnimationInfoList() const 670cdf0e10cSrcweir { 671cdf0e10cSrcweir return maGraphic.GetAnimationInfoList(); 672cdf0e10cSrcweir } 673cdf0e10cSrcweir 674cdf0e10cSrcweir // ----------------------------------------------------------------------------- 675cdf0e10cSrcweir 676cdf0e10cSrcweir sal_Bool GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz, 677cdf0e10cSrcweir const GraphicAttr* pAttr, sal_uLong nFlags ) 678cdf0e10cSrcweir { 679cdf0e10cSrcweir GraphicAttr aAttr( pAttr ? *pAttr : GetAttr() ); 680cdf0e10cSrcweir Point aPt( rPt ); 681cdf0e10cSrcweir Size aSz( rSz ); 682cdf0e10cSrcweir const sal_uInt32 nOldDrawMode = pOut->GetDrawMode(); 683cdf0e10cSrcweir sal_Bool bCropped = aAttr.IsCropped(); 684cdf0e10cSrcweir sal_Bool bCached = sal_False; 685cdf0e10cSrcweir sal_Bool bRet; 686cdf0e10cSrcweir 687cdf0e10cSrcweir // #i29534# Provide output rects for PDF writer 688cdf0e10cSrcweir Rectangle aCropRect; 689cdf0e10cSrcweir 690cdf0e10cSrcweir if( !( GRFMGR_DRAW_USE_DRAWMODE_SETTINGS & nFlags ) ) 691cdf0e10cSrcweir pOut->SetDrawMode( nOldDrawMode & ( ~( DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT ) ) ); 692cdf0e10cSrcweir 693cdf0e10cSrcweir // mirrored horizontically 694cdf0e10cSrcweir if( aSz.Width() < 0L ) 695cdf0e10cSrcweir { 696cdf0e10cSrcweir aPt.X() += aSz.Width() + 1; 697cdf0e10cSrcweir aSz.Width() = -aSz.Width(); 698cdf0e10cSrcweir aAttr.SetMirrorFlags( aAttr.GetMirrorFlags() ^ BMP_MIRROR_HORZ ); 699cdf0e10cSrcweir } 700cdf0e10cSrcweir 701cdf0e10cSrcweir // mirrored vertically 702cdf0e10cSrcweir if( aSz.Height() < 0L ) 703cdf0e10cSrcweir { 704cdf0e10cSrcweir aPt.Y() += aSz.Height() + 1; 705cdf0e10cSrcweir aSz.Height() = -aSz.Height(); 706cdf0e10cSrcweir aAttr.SetMirrorFlags( aAttr.GetMirrorFlags() ^ BMP_MIRROR_VERT ); 707cdf0e10cSrcweir } 708cdf0e10cSrcweir 709cdf0e10cSrcweir if( bCropped ) 710cdf0e10cSrcweir { 711cdf0e10cSrcweir PolyPolygon aClipPolyPoly; 712cdf0e10cSrcweir sal_Bool bRectClip; 713cdf0e10cSrcweir const sal_Bool bCrop = ImplGetCropParams( pOut, aPt, aSz, &aAttr, aClipPolyPoly, bRectClip ); 714cdf0e10cSrcweir 715cdf0e10cSrcweir pOut->Push( PUSH_CLIPREGION ); 716cdf0e10cSrcweir 717cdf0e10cSrcweir if( bCrop ) 718cdf0e10cSrcweir { 719cdf0e10cSrcweir if( bRectClip ) 720cdf0e10cSrcweir { 721cdf0e10cSrcweir // #i29534# Store crop rect for later forwarding to 722cdf0e10cSrcweir // PDF writer 723cdf0e10cSrcweir aCropRect = aClipPolyPoly.GetBoundRect(); 724cdf0e10cSrcweir pOut->IntersectClipRegion( aCropRect ); 725cdf0e10cSrcweir } 726cdf0e10cSrcweir else 727cdf0e10cSrcweir { 728cdf0e10cSrcweir pOut->IntersectClipRegion( aClipPolyPoly ); 729cdf0e10cSrcweir } 730cdf0e10cSrcweir } 731cdf0e10cSrcweir } 732cdf0e10cSrcweir 733cdf0e10cSrcweir bRet = mpMgr->DrawObj( pOut, aPt, aSz, *this, aAttr, nFlags, bCached ); 734cdf0e10cSrcweir 735cdf0e10cSrcweir if( bCropped ) 736cdf0e10cSrcweir pOut->Pop(); 737cdf0e10cSrcweir 738cdf0e10cSrcweir pOut->SetDrawMode( nOldDrawMode ); 739cdf0e10cSrcweir 740cdf0e10cSrcweir // #i29534# Moved below OutDev restoration, to avoid multiple swap-ins 741cdf0e10cSrcweir // (code above needs to call GetGraphic twice) 742cdf0e10cSrcweir if( bCached ) 743cdf0e10cSrcweir { 744cdf0e10cSrcweir if( mpSwapOutTimer ) 745cdf0e10cSrcweir mpSwapOutTimer->Start(); 746cdf0e10cSrcweir else 747cdf0e10cSrcweir FireSwapOutRequest(); 748cdf0e10cSrcweir } 749cdf0e10cSrcweir 750cdf0e10cSrcweir return bRet; 751cdf0e10cSrcweir } 752cdf0e10cSrcweir 753cdf0e10cSrcweir // --> OD 2010-01-04 #i105243# 754cdf0e10cSrcweir sal_Bool GraphicObject::DrawWithPDFHandling( OutputDevice& rOutDev, 755cdf0e10cSrcweir const Point& rPt, const Size& rSz, 756cdf0e10cSrcweir const GraphicAttr* pGrfAttr, 757cdf0e10cSrcweir const sal_uLong nFlags ) 758cdf0e10cSrcweir { 759cdf0e10cSrcweir const GraphicAttr aGrfAttr( pGrfAttr ? *pGrfAttr : GetAttr() ); 760cdf0e10cSrcweir 761cdf0e10cSrcweir // Notify PDF writer about linked graphic (if any) 762cdf0e10cSrcweir sal_Bool bWritingPdfLinkedGraphic( sal_False ); 763cdf0e10cSrcweir Point aPt( rPt ); 764cdf0e10cSrcweir Size aSz( rSz ); 765cdf0e10cSrcweir Rectangle aCropRect; 766cdf0e10cSrcweir vcl::PDFExtOutDevData* pPDFExtOutDevData = 767cdf0e10cSrcweir dynamic_cast<vcl::PDFExtOutDevData*>(rOutDev.GetExtOutDevData()); 768cdf0e10cSrcweir if( pPDFExtOutDevData ) 769cdf0e10cSrcweir { 770cdf0e10cSrcweir // only delegate image handling to PDF, if no special treatment is necessary 771cdf0e10cSrcweir if( GetGraphic().IsLink() && 772cdf0e10cSrcweir rSz.Width() > 0L && 773cdf0e10cSrcweir rSz.Height() > 0L && 774cdf0e10cSrcweir !aGrfAttr.IsSpecialDrawMode() && 775cdf0e10cSrcweir !aGrfAttr.IsMirrored() && 776cdf0e10cSrcweir !aGrfAttr.IsRotated() && 777cdf0e10cSrcweir !aGrfAttr.IsAdjusted() ) 778cdf0e10cSrcweir { 779cdf0e10cSrcweir bWritingPdfLinkedGraphic = true; 780cdf0e10cSrcweir 781cdf0e10cSrcweir if( aGrfAttr.IsCropped() ) 782cdf0e10cSrcweir { 783cdf0e10cSrcweir PolyPolygon aClipPolyPoly; 784cdf0e10cSrcweir sal_Bool bRectClip; 785cdf0e10cSrcweir const sal_Bool bCrop = ImplGetCropParams( &rOutDev, 786cdf0e10cSrcweir aPt, aSz, 787cdf0e10cSrcweir &aGrfAttr, 788cdf0e10cSrcweir aClipPolyPoly, 789cdf0e10cSrcweir bRectClip ); 790cdf0e10cSrcweir if ( bCrop && bRectClip ) 791cdf0e10cSrcweir { 792cdf0e10cSrcweir aCropRect = aClipPolyPoly.GetBoundRect(); 793cdf0e10cSrcweir } 794cdf0e10cSrcweir } 795cdf0e10cSrcweir 796cdf0e10cSrcweir pPDFExtOutDevData->BeginGroup(); 797cdf0e10cSrcweir } 798cdf0e10cSrcweir } 799cdf0e10cSrcweir 800cdf0e10cSrcweir sal_Bool bRet = Draw( &rOutDev, rPt, rSz, &aGrfAttr, nFlags ); 801cdf0e10cSrcweir 802cdf0e10cSrcweir // Notify PDF writer about linked graphic (if any) 803cdf0e10cSrcweir if( bWritingPdfLinkedGraphic ) 804cdf0e10cSrcweir { 805cdf0e10cSrcweir pPDFExtOutDevData->EndGroup( const_cast< Graphic& >(GetGraphic()), 806cdf0e10cSrcweir aGrfAttr.GetTransparency(), 807cdf0e10cSrcweir Rectangle( aPt, aSz ), 808cdf0e10cSrcweir aCropRect ); 809cdf0e10cSrcweir } 810cdf0e10cSrcweir 811cdf0e10cSrcweir return bRet; 812cdf0e10cSrcweir } 813cdf0e10cSrcweir // <-- 814cdf0e10cSrcweir 815cdf0e10cSrcweir // ----------------------------------------------------------------------------- 816cdf0e10cSrcweir 817cdf0e10cSrcweir sal_Bool GraphicObject::DrawTiled( OutputDevice* pOut, const Rectangle& rArea, const Size& rSize, 818cdf0e10cSrcweir const Size& rOffset, const GraphicAttr* pAttr, sal_uLong nFlags, int nTileCacheSize1D ) 819cdf0e10cSrcweir { 820cdf0e10cSrcweir if( pOut == NULL || rSize.Width() == 0 || rSize.Height() == 0 ) 821cdf0e10cSrcweir return sal_False; 822cdf0e10cSrcweir 823cdf0e10cSrcweir const MapMode aOutMapMode( pOut->GetMapMode() ); 824cdf0e10cSrcweir const MapMode aMapMode( aOutMapMode.GetMapUnit(), Point(), aOutMapMode.GetScaleX(), aOutMapMode.GetScaleY() ); 825cdf0e10cSrcweir // #106258# Clamp size to 1 for zero values. This is okay, since 826cdf0e10cSrcweir // logical size of zero is handled above already 827cdf0e10cSrcweir const Size aOutTileSize( ::std::max( 1L, pOut->LogicToPixel( rSize, aOutMapMode ).Width() ), 828cdf0e10cSrcweir ::std::max( 1L, pOut->LogicToPixel( rSize, aOutMapMode ).Height() ) ); 829cdf0e10cSrcweir 830cdf0e10cSrcweir //#i69780 clip final tile size to a sane max size 831cdf0e10cSrcweir while (((sal_Int64)rSize.Width() * nTileCacheSize1D) > SAL_MAX_UINT16) 832cdf0e10cSrcweir nTileCacheSize1D /= 2; 833cdf0e10cSrcweir while (((sal_Int64)rSize.Height() * nTileCacheSize1D) > SAL_MAX_UINT16) 834cdf0e10cSrcweir nTileCacheSize1D /= 2; 835cdf0e10cSrcweir 836cdf0e10cSrcweir return ImplDrawTiled( pOut, rArea, aOutTileSize, rOffset, pAttr, nFlags, nTileCacheSize1D ); 837cdf0e10cSrcweir } 838cdf0e10cSrcweir 839cdf0e10cSrcweir // ----------------------------------------------------------------------------- 840cdf0e10cSrcweir 841cdf0e10cSrcweir sal_Bool GraphicObject::StartAnimation( OutputDevice* pOut, const Point& rPt, const Size& rSz, 842cdf0e10cSrcweir long nExtraData, const GraphicAttr* pAttr, sal_uLong /*nFlags*/, 843cdf0e10cSrcweir OutputDevice* pFirstFrameOutDev ) 844cdf0e10cSrcweir { 845cdf0e10cSrcweir sal_Bool bRet = sal_False; 846cdf0e10cSrcweir 847cdf0e10cSrcweir GetGraphic(); 848cdf0e10cSrcweir 849cdf0e10cSrcweir if( !IsSwappedOut() ) 850cdf0e10cSrcweir { 851cdf0e10cSrcweir const GraphicAttr aAttr( pAttr ? *pAttr : GetAttr() ); 852cdf0e10cSrcweir 853cdf0e10cSrcweir if( mbAnimated ) 854cdf0e10cSrcweir { 855cdf0e10cSrcweir Point aPt( rPt ); 856cdf0e10cSrcweir Size aSz( rSz ); 857cdf0e10cSrcweir sal_Bool bCropped = aAttr.IsCropped(); 858cdf0e10cSrcweir 859cdf0e10cSrcweir if( bCropped ) 860cdf0e10cSrcweir { 861cdf0e10cSrcweir PolyPolygon aClipPolyPoly; 862cdf0e10cSrcweir sal_Bool bRectClip; 863cdf0e10cSrcweir const sal_Bool bCrop = ImplGetCropParams( pOut, aPt, aSz, &aAttr, aClipPolyPoly, bRectClip ); 864cdf0e10cSrcweir 865cdf0e10cSrcweir pOut->Push( PUSH_CLIPREGION ); 866cdf0e10cSrcweir 867cdf0e10cSrcweir if( bCrop ) 868cdf0e10cSrcweir { 869cdf0e10cSrcweir if( bRectClip ) 870cdf0e10cSrcweir pOut->IntersectClipRegion( aClipPolyPoly.GetBoundRect() ); 871cdf0e10cSrcweir else 872cdf0e10cSrcweir pOut->IntersectClipRegion( aClipPolyPoly ); 873cdf0e10cSrcweir } 874cdf0e10cSrcweir } 875cdf0e10cSrcweir 876cdf0e10cSrcweir if( !mpSimpleCache || ( mpSimpleCache->maAttr != aAttr ) || pFirstFrameOutDev ) 877cdf0e10cSrcweir { 878cdf0e10cSrcweir if( mpSimpleCache ) 879cdf0e10cSrcweir delete mpSimpleCache; 880cdf0e10cSrcweir 881cdf0e10cSrcweir mpSimpleCache = new GrfSimpleCacheObj( GetTransformedGraphic( &aAttr ), aAttr ); 882cdf0e10cSrcweir mpSimpleCache->maGraphic.SetAnimationNotifyHdl( GetAnimationNotifyHdl() ); 883cdf0e10cSrcweir } 884cdf0e10cSrcweir 885cdf0e10cSrcweir mpSimpleCache->maGraphic.StartAnimation( pOut, aPt, aSz, nExtraData, pFirstFrameOutDev ); 886cdf0e10cSrcweir 887cdf0e10cSrcweir if( bCropped ) 888cdf0e10cSrcweir pOut->Pop(); 889cdf0e10cSrcweir 890cdf0e10cSrcweir bRet = sal_True; 891cdf0e10cSrcweir } 892cdf0e10cSrcweir else 893cdf0e10cSrcweir bRet = Draw( pOut, rPt, rSz, &aAttr, GRFMGR_DRAW_STANDARD ); 894cdf0e10cSrcweir } 895cdf0e10cSrcweir 896cdf0e10cSrcweir return bRet; 897cdf0e10cSrcweir } 898cdf0e10cSrcweir 899cdf0e10cSrcweir // ----------------------------------------------------------------------------- 900cdf0e10cSrcweir 901cdf0e10cSrcweir void GraphicObject::StopAnimation( OutputDevice* pOut, long nExtraData ) 902cdf0e10cSrcweir { 903cdf0e10cSrcweir if( mpSimpleCache ) 904cdf0e10cSrcweir mpSimpleCache->maGraphic.StopAnimation( pOut, nExtraData ); 905cdf0e10cSrcweir } 906cdf0e10cSrcweir 907cdf0e10cSrcweir // ----------------------------------------------------------------------------- 908cdf0e10cSrcweir 909cdf0e10cSrcweir const Graphic& GraphicObject::GetGraphic() const 910cdf0e10cSrcweir { 911cdf0e10cSrcweir if( mbAutoSwapped ) 912cdf0e10cSrcweir ( (GraphicObject*) this )->ImplAutoSwapIn(); 913cdf0e10cSrcweir 914cdf0e10cSrcweir return maGraphic; 915cdf0e10cSrcweir } 916cdf0e10cSrcweir 917cdf0e10cSrcweir // ----------------------------------------------------------------------------- 918cdf0e10cSrcweir 919cdf0e10cSrcweir void GraphicObject::SetGraphic( const Graphic& rGraphic, const GraphicObject* pCopyObj ) 920cdf0e10cSrcweir { 921cdf0e10cSrcweir mpMgr->ImplUnregisterObj( *this ); 922cdf0e10cSrcweir 923cdf0e10cSrcweir if( mpSwapOutTimer ) 924cdf0e10cSrcweir mpSwapOutTimer->Stop(); 925cdf0e10cSrcweir 926cdf0e10cSrcweir maGraphic = rGraphic; 927cdf0e10cSrcweir mbAutoSwapped = sal_False; 928cdf0e10cSrcweir ImplAssignGraphicData(); 929cdf0e10cSrcweir delete mpLink, mpLink = NULL; 930cdf0e10cSrcweir delete mpSimpleCache, mpSimpleCache = NULL; 931cdf0e10cSrcweir 932cdf0e10cSrcweir mpMgr->ImplRegisterObj( *this, maGraphic, 0, pCopyObj); 933cdf0e10cSrcweir 934cdf0e10cSrcweir if( mpSwapOutTimer ) 935cdf0e10cSrcweir mpSwapOutTimer->Start(); 936*d327e58aSArmin Le Grand 937*d327e58aSArmin Le Grand // Handle evtl. needed AfterDataChanges 938*d327e58aSArmin Le Grand ImplAfterDataChange(); 939cdf0e10cSrcweir } 940cdf0e10cSrcweir 941cdf0e10cSrcweir // ----------------------------------------------------------------------------- 942cdf0e10cSrcweir 943cdf0e10cSrcweir void GraphicObject::SetGraphic( const Graphic& rGraphic, const String& rLink ) 944cdf0e10cSrcweir { 945cdf0e10cSrcweir SetGraphic( rGraphic ); 946cdf0e10cSrcweir mpLink = new String( rLink ); 947cdf0e10cSrcweir } 948cdf0e10cSrcweir 949cdf0e10cSrcweir // ----------------------------------------------------------------------------- 950cdf0e10cSrcweir 951cdf0e10cSrcweir Graphic GraphicObject::GetTransformedGraphic( const Size& rDestSize, const MapMode& rDestMap, const GraphicAttr& rAttr ) const 952cdf0e10cSrcweir { 953cdf0e10cSrcweir // #104550# Extracted from svx/source/svdraw/svdograf.cxx 954cdf0e10cSrcweir Graphic aTransGraphic( maGraphic ); 955cdf0e10cSrcweir const GraphicType eType = GetType(); 956cdf0e10cSrcweir const Size aSrcSize( aTransGraphic.GetPrefSize() ); 957cdf0e10cSrcweir 958cdf0e10cSrcweir // #104115# Convert the crop margins to graphic object mapmode 959cdf0e10cSrcweir const MapMode aMapGraph( aTransGraphic.GetPrefMapMode() ); 960cdf0e10cSrcweir const MapMode aMap100( MAP_100TH_MM ); 961cdf0e10cSrcweir 962cdf0e10cSrcweir Size aCropLeftTop; 963cdf0e10cSrcweir Size aCropRightBottom; 964cdf0e10cSrcweir 965cdf0e10cSrcweir if( GRAPHIC_GDIMETAFILE == eType ) 966cdf0e10cSrcweir { 967cdf0e10cSrcweir GDIMetaFile aMtf( aTransGraphic.GetGDIMetaFile() ); 968cdf0e10cSrcweir 969cdf0e10cSrcweir if( aMapGraph == MAP_PIXEL ) 970cdf0e10cSrcweir { 971a409c94eSArmin Le Grand // crops are in 1/100th mm -> to aMapGraph -> to MAP_PIXEL 972a409c94eSArmin Le Grand aCropLeftTop = Application::GetDefaultDevice()->LogicToPixel( 973a409c94eSArmin Le Grand Size(rAttr.GetLeftCrop(), rAttr.GetTopCrop()), 974cdf0e10cSrcweir aMap100); 975a409c94eSArmin Le Grand aCropRightBottom = Application::GetDefaultDevice()->LogicToPixel( 976a409c94eSArmin Le Grand Size(rAttr.GetRightCrop(), rAttr.GetBottomCrop()), 977cdf0e10cSrcweir aMap100); 978cdf0e10cSrcweir } 979cdf0e10cSrcweir else 980cdf0e10cSrcweir { 981a409c94eSArmin Le Grand // crops are in GraphicObject units -> to aMapGraph 982a409c94eSArmin Le Grand aCropLeftTop = OutputDevice::LogicToLogic( 983a409c94eSArmin Le Grand Size(rAttr.GetLeftCrop(), rAttr.GetTopCrop()), 984cdf0e10cSrcweir aMap100, 985cdf0e10cSrcweir aMapGraph); 986a409c94eSArmin Le Grand aCropRightBottom = OutputDevice::LogicToLogic( 987a409c94eSArmin Le Grand Size(rAttr.GetRightCrop(), rAttr.GetBottomCrop()), 988cdf0e10cSrcweir aMap100, 989cdf0e10cSrcweir aMapGraph); 990cdf0e10cSrcweir } 991cdf0e10cSrcweir 992cdf0e10cSrcweir // #104115# If the metafile is cropped, give it a special 993cdf0e10cSrcweir // treatment: clip against the remaining area, scale up such 994cdf0e10cSrcweir // that this area later fills the desired size, and move the 995cdf0e10cSrcweir // origin to the upper left edge of that area. 996cdf0e10cSrcweir if( rAttr.IsCropped() ) 997cdf0e10cSrcweir { 998cdf0e10cSrcweir const MapMode aMtfMapMode( aMtf.GetPrefMapMode() ); 999cdf0e10cSrcweir 1000cdf0e10cSrcweir Rectangle aClipRect( aMtfMapMode.GetOrigin().X() + aCropLeftTop.Width(), 1001cdf0e10cSrcweir aMtfMapMode.GetOrigin().Y() + aCropLeftTop.Height(), 1002cdf0e10cSrcweir aMtfMapMode.GetOrigin().X() + aSrcSize.Width() - aCropRightBottom.Width(), 1003cdf0e10cSrcweir aMtfMapMode.GetOrigin().Y() + aSrcSize.Height() - aCropRightBottom.Height() ); 1004cdf0e10cSrcweir 1005cdf0e10cSrcweir // #104115# To correctly crop rotated metafiles, clip by view rectangle 1006cdf0e10cSrcweir aMtf.AddAction( new MetaISectRectClipRegionAction( aClipRect ), 0 ); 1007cdf0e10cSrcweir 1008cdf0e10cSrcweir // #104115# To crop the metafile, scale larger than the output rectangle 1009cdf0e10cSrcweir aMtf.Scale( (double)rDestSize.Width() / (aSrcSize.Width() - aCropLeftTop.Width() - aCropRightBottom.Width()), 1010cdf0e10cSrcweir (double)rDestSize.Height() / (aSrcSize.Height() - aCropLeftTop.Height() - aCropRightBottom.Height()) ); 1011cdf0e10cSrcweir 1012cdf0e10cSrcweir // #104115# Adapt the pref size by hand (scale changes it 1013cdf0e10cSrcweir // proportionally, but we want it to be smaller than the 1014cdf0e10cSrcweir // former size, to crop the excess out) 1015cdf0e10cSrcweir aMtf.SetPrefSize( Size( (long)((double)rDestSize.Width() * (1.0 + (aCropLeftTop.Width() + aCropRightBottom.Width()) / aSrcSize.Width()) + .5), 1016cdf0e10cSrcweir (long)((double)rDestSize.Height() * (1.0 + (aCropLeftTop.Height() + aCropRightBottom.Height()) / aSrcSize.Height()) + .5) ) ); 1017cdf0e10cSrcweir 1018cdf0e10cSrcweir // #104115# Adapt the origin of the new mapmode, such that it 1019cdf0e10cSrcweir // is shifted to the place where the cropped output starts 1020cdf0e10cSrcweir Point aNewOrigin( (long)((double)aMtfMapMode.GetOrigin().X() + rDestSize.Width() * aCropLeftTop.Width() / (aSrcSize.Width() - aCropLeftTop.Width() - aCropRightBottom.Width()) + .5), 1021cdf0e10cSrcweir (long)((double)aMtfMapMode.GetOrigin().Y() + rDestSize.Height() * aCropLeftTop.Height() / (aSrcSize.Height() - aCropLeftTop.Height() - aCropRightBottom.Height()) + .5) ); 1022cdf0e10cSrcweir MapMode aNewMap( rDestMap ); 1023cdf0e10cSrcweir aNewMap.SetOrigin( OutputDevice::LogicToLogic(aNewOrigin, aMtfMapMode, rDestMap) ); 1024cdf0e10cSrcweir aMtf.SetPrefMapMode( aNewMap ); 1025cdf0e10cSrcweir } 1026cdf0e10cSrcweir else 1027cdf0e10cSrcweir { 1028cdf0e10cSrcweir aMtf.Scale( Fraction( rDestSize.Width(), aSrcSize.Width() ), Fraction( rDestSize.Height(), aSrcSize.Height() ) ); 1029cdf0e10cSrcweir aMtf.SetPrefMapMode( rDestMap ); 1030cdf0e10cSrcweir } 1031cdf0e10cSrcweir 1032cdf0e10cSrcweir aTransGraphic = aMtf; 1033cdf0e10cSrcweir } 1034cdf0e10cSrcweir else if( GRAPHIC_BITMAP == eType ) 1035cdf0e10cSrcweir { 1036cdf0e10cSrcweir BitmapEx aBitmapEx( aTransGraphic.GetBitmapEx() ); 10372376739dSArmin Le Grand Rectangle aCropRect; 1038cdf0e10cSrcweir 1039a409c94eSArmin Le Grand // convert crops to pixel 10402376739dSArmin Le Grand if(rAttr.IsCropped()) 10412376739dSArmin Le Grand { 1042a409c94eSArmin Le Grand if( aMapGraph == MAP_PIXEL ) 1043a409c94eSArmin Le Grand { 1044a409c94eSArmin Le Grand // crops are in 1/100th mm -> to MAP_PIXEL 1045a409c94eSArmin Le Grand aCropLeftTop = Application::GetDefaultDevice()->LogicToPixel( 1046a409c94eSArmin Le Grand Size(rAttr.GetLeftCrop(), rAttr.GetTopCrop()), 1047a409c94eSArmin Le Grand aMap100); 1048a409c94eSArmin Le Grand aCropRightBottom = Application::GetDefaultDevice()->LogicToPixel( 1049a409c94eSArmin Le Grand Size(rAttr.GetRightCrop(), rAttr.GetBottomCrop()), 1050a409c94eSArmin Le Grand aMap100); 1051a409c94eSArmin Le Grand } 1052a409c94eSArmin Le Grand else 1053a409c94eSArmin Le Grand { 1054a409c94eSArmin Le Grand // crops are in GraphicObject units -> to MAP_PIXEL 10552376739dSArmin Le Grand aCropLeftTop = Application::GetDefaultDevice()->LogicToPixel( 10562376739dSArmin Le Grand Size(rAttr.GetLeftCrop(), rAttr.GetTopCrop()), 10572376739dSArmin Le Grand aMapGraph); 10582376739dSArmin Le Grand aCropRightBottom = Application::GetDefaultDevice()->LogicToPixel( 10592376739dSArmin Le Grand Size(rAttr.GetRightCrop(), rAttr.GetBottomCrop()), 10602376739dSArmin Le Grand aMapGraph); 1061a409c94eSArmin Le Grand } 1062cdf0e10cSrcweir 1063cdf0e10cSrcweir // convert from prefmapmode to pixel 10642376739dSArmin Le Grand Size aSrcSizePixel( 10652376739dSArmin Le Grand Application::GetDefaultDevice()->LogicToPixel( 10662376739dSArmin Le Grand aSrcSize, 1067cdf0e10cSrcweir aMapGraph)); 1068cdf0e10cSrcweir 10692376739dSArmin Le Grand if(rAttr.IsCropped() 10702376739dSArmin Le Grand && (aSrcSizePixel.Width() != aBitmapEx.GetSizePixel().Width() || aSrcSizePixel.Height() != aBitmapEx.GetSizePixel().Height()) 10712376739dSArmin Le Grand && aSrcSizePixel.Width()) 10722376739dSArmin Le Grand { 10732376739dSArmin Le Grand // the size in pixels calculated from Graphic's internal MapMode (aTransGraphic.GetPrefMapMode()) 10742376739dSArmin Le Grand // and it's internal size (aTransGraphic.GetPrefSize()) is different from it's real pixel size. 10752376739dSArmin Le Grand // This can be interpreted as this values to be set wrong, but needs to be corrected since e.g. 10762376739dSArmin Le Grand // existing cropping is calculated based on this logic values already. 10772376739dSArmin Le Grand // aBitmapEx.Scale(aSrcSizePixel); 10782376739dSArmin Le Grand 10792376739dSArmin Le Grand // another possibility is to adapt the values created so far with a factor; this 10802376739dSArmin Le Grand // will keep the original Bitmap untouched and thus quality will not change 1081a409c94eSArmin Le Grand // caution: convert to double first, else pretty big errors may occurr 1082a409c94eSArmin Le Grand const double fFactorX((double)aBitmapEx.GetSizePixel().Width() / aSrcSizePixel.Width()); 1083a409c94eSArmin Le Grand const double fFactorY((double)aBitmapEx.GetSizePixel().Height() / aSrcSizePixel.Height()); 10842376739dSArmin Le Grand 10852376739dSArmin Le Grand aCropLeftTop.Width() = basegfx::fround(aCropLeftTop.Width() * fFactorX); 10862376739dSArmin Le Grand aCropLeftTop.Height() = basegfx::fround(aCropLeftTop.Height() * fFactorY); 10872376739dSArmin Le Grand aCropRightBottom.Width() = basegfx::fround(aCropRightBottom.Width() * fFactorX); 10882376739dSArmin Le Grand aCropRightBottom.Height() = basegfx::fround(aCropRightBottom.Height() * fFactorY); 10892376739dSArmin Le Grand 10902376739dSArmin Le Grand aSrcSizePixel = aBitmapEx.GetSizePixel(); 10912376739dSArmin Le Grand } 10922376739dSArmin Le Grand 1093cdf0e10cSrcweir // setup crop rectangle in pixel 10942376739dSArmin Le Grand aCropRect = Rectangle( aCropLeftTop.Width(), aCropLeftTop.Height(), 1095cdf0e10cSrcweir aSrcSizePixel.Width() - aCropRightBottom.Width(), 1096cdf0e10cSrcweir aSrcSizePixel.Height() - aCropRightBottom.Height() ); 10972376739dSArmin Le Grand } 1098cdf0e10cSrcweir 1099cdf0e10cSrcweir // #105641# Also crop animations 1100cdf0e10cSrcweir if( aTransGraphic.IsAnimated() ) 1101cdf0e10cSrcweir { 1102cdf0e10cSrcweir sal_uInt16 nFrame; 1103cdf0e10cSrcweir Animation aAnim( aTransGraphic.GetAnimation() ); 1104cdf0e10cSrcweir 1105cdf0e10cSrcweir for( nFrame=0; nFrame<aAnim.Count(); ++nFrame ) 1106cdf0e10cSrcweir { 1107cdf0e10cSrcweir AnimationBitmap aAnimBmp( aAnim.Get( nFrame ) ); 1108cdf0e10cSrcweir 1109cdf0e10cSrcweir if( !aCropRect.IsInside( Rectangle(aAnimBmp.aPosPix, aAnimBmp.aSizePix) ) ) 1110cdf0e10cSrcweir { 1111cdf0e10cSrcweir // setup actual cropping (relative to frame position) 1112cdf0e10cSrcweir Rectangle aCropRectRel( aCropRect ); 1113cdf0e10cSrcweir aCropRectRel.Move( -aAnimBmp.aPosPix.X(), 1114cdf0e10cSrcweir -aAnimBmp.aPosPix.Y() ); 1115cdf0e10cSrcweir 1116cdf0e10cSrcweir // cropping affects this frame, apply it then 1117cdf0e10cSrcweir // do _not_ apply enlargement, this is done below 1118cdf0e10cSrcweir ImplTransformBitmap( aAnimBmp.aBmpEx, rAttr, Size(), Size(), 1119cdf0e10cSrcweir aCropRectRel, rDestSize, sal_False ); 1120cdf0e10cSrcweir 1121cdf0e10cSrcweir aAnim.Replace( aAnimBmp, nFrame ); 1122cdf0e10cSrcweir } 1123cdf0e10cSrcweir // else: bitmap completely within crop area, 1124cdf0e10cSrcweir // i.e. nothing is cropped away 1125cdf0e10cSrcweir } 1126cdf0e10cSrcweir 1127cdf0e10cSrcweir // now, apply enlargement (if any) through global animation size 1128cdf0e10cSrcweir if( aCropLeftTop.Width() < 0 || 1129cdf0e10cSrcweir aCropLeftTop.Height() < 0 || 1130cdf0e10cSrcweir aCropRightBottom.Width() < 0 || 1131cdf0e10cSrcweir aCropRightBottom.Height() < 0 ) 1132cdf0e10cSrcweir { 1133cdf0e10cSrcweir Size aNewSize( aAnim.GetDisplaySizePixel() ); 1134cdf0e10cSrcweir aNewSize.Width() += aCropRightBottom.Width() < 0 ? -aCropRightBottom.Width() : 0; 1135cdf0e10cSrcweir aNewSize.Width() += aCropLeftTop.Width() < 0 ? -aCropLeftTop.Width() : 0; 1136cdf0e10cSrcweir aNewSize.Height() += aCropRightBottom.Height() < 0 ? -aCropRightBottom.Height() : 0; 1137cdf0e10cSrcweir aNewSize.Height() += aCropLeftTop.Height() < 0 ? -aCropLeftTop.Height() : 0; 1138cdf0e10cSrcweir aAnim.SetDisplaySizePixel( aNewSize ); 1139cdf0e10cSrcweir } 1140cdf0e10cSrcweir 1141cdf0e10cSrcweir // if topleft has changed, we must move all frames to the 1142cdf0e10cSrcweir // right and bottom, resp. 1143cdf0e10cSrcweir if( aCropLeftTop.Width() < 0 || 1144cdf0e10cSrcweir aCropLeftTop.Height() < 0 ) 1145cdf0e10cSrcweir { 1146cdf0e10cSrcweir Point aPosOffset( aCropLeftTop.Width() < 0 ? -aCropLeftTop.Width() : 0, 1147cdf0e10cSrcweir aCropLeftTop.Height() < 0 ? -aCropLeftTop.Height() : 0 ); 1148cdf0e10cSrcweir 1149cdf0e10cSrcweir for( nFrame=0; nFrame<aAnim.Count(); ++nFrame ) 1150cdf0e10cSrcweir { 1151cdf0e10cSrcweir AnimationBitmap aAnimBmp( aAnim.Get( nFrame ) ); 1152cdf0e10cSrcweir 1153cdf0e10cSrcweir aAnimBmp.aPosPix += aPosOffset; 1154cdf0e10cSrcweir 1155cdf0e10cSrcweir aAnim.Replace( aAnimBmp, nFrame ); 1156cdf0e10cSrcweir } 1157cdf0e10cSrcweir } 1158cdf0e10cSrcweir 1159cdf0e10cSrcweir aTransGraphic = aAnim; 1160cdf0e10cSrcweir } 1161cdf0e10cSrcweir else 1162cdf0e10cSrcweir { 11632376739dSArmin Le Grand ImplTransformBitmap( aBitmapEx, rAttr, aCropLeftTop, aCropRightBottom, 1164cdf0e10cSrcweir aCropRect, rDestSize, sal_True ); 1165cdf0e10cSrcweir 11662376739dSArmin Le Grand aTransGraphic = aBitmapEx; 1167cdf0e10cSrcweir } 1168cdf0e10cSrcweir 1169cdf0e10cSrcweir aTransGraphic.SetPrefSize( rDestSize ); 1170cdf0e10cSrcweir aTransGraphic.SetPrefMapMode( rDestMap ); 1171cdf0e10cSrcweir } 1172cdf0e10cSrcweir 1173cdf0e10cSrcweir GraphicObject aGrfObj( aTransGraphic ); 1174cdf0e10cSrcweir aTransGraphic = aGrfObj.GetTransformedGraphic( &rAttr ); 1175cdf0e10cSrcweir 1176cdf0e10cSrcweir return aTransGraphic; 1177cdf0e10cSrcweir } 1178cdf0e10cSrcweir 1179cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1180cdf0e10cSrcweir 1181cdf0e10cSrcweir Graphic GraphicObject::GetTransformedGraphic( const GraphicAttr* pAttr ) const // TODO: Change to Impl 1182cdf0e10cSrcweir { 1183cdf0e10cSrcweir GetGraphic(); 1184cdf0e10cSrcweir 1185cdf0e10cSrcweir Graphic aGraphic; 1186cdf0e10cSrcweir GraphicAttr aAttr( pAttr ? *pAttr : GetAttr() ); 1187cdf0e10cSrcweir 1188cdf0e10cSrcweir if( maGraphic.IsSupportedGraphic() && !maGraphic.IsSwapOut() ) 1189cdf0e10cSrcweir { 1190cdf0e10cSrcweir if( aAttr.IsSpecialDrawMode() || aAttr.IsAdjusted() || aAttr.IsMirrored() || aAttr.IsRotated() || aAttr.IsTransparent() ) 1191cdf0e10cSrcweir { 1192cdf0e10cSrcweir if( GetType() == GRAPHIC_BITMAP ) 1193cdf0e10cSrcweir { 1194cdf0e10cSrcweir if( IsAnimated() ) 1195cdf0e10cSrcweir { 1196cdf0e10cSrcweir Animation aAnimation( maGraphic.GetAnimation() ); 1197cdf0e10cSrcweir GraphicManager::ImplAdjust( aAnimation, aAttr, ADJUSTMENT_ALL ); 1198cdf0e10cSrcweir aAnimation.SetLoopCount( mnAnimationLoopCount ); 1199cdf0e10cSrcweir aGraphic = aAnimation; 1200cdf0e10cSrcweir } 1201cdf0e10cSrcweir else 1202cdf0e10cSrcweir { 1203cdf0e10cSrcweir BitmapEx aBmpEx( maGraphic.GetBitmapEx() ); 1204cdf0e10cSrcweir GraphicManager::ImplAdjust( aBmpEx, aAttr, ADJUSTMENT_ALL ); 1205cdf0e10cSrcweir aGraphic = aBmpEx; 1206cdf0e10cSrcweir } 1207cdf0e10cSrcweir } 1208cdf0e10cSrcweir else 1209cdf0e10cSrcweir { 1210cdf0e10cSrcweir GDIMetaFile aMtf( maGraphic.GetGDIMetaFile() ); 1211cdf0e10cSrcweir GraphicManager::ImplAdjust( aMtf, aAttr, ADJUSTMENT_ALL ); 1212cdf0e10cSrcweir aGraphic = aMtf; 1213cdf0e10cSrcweir } 1214cdf0e10cSrcweir } 1215cdf0e10cSrcweir else 1216cdf0e10cSrcweir { 1217cdf0e10cSrcweir if( ( GetType() == GRAPHIC_BITMAP ) && IsAnimated() ) 1218cdf0e10cSrcweir { 1219cdf0e10cSrcweir Animation aAnimation( maGraphic.GetAnimation() ); 1220cdf0e10cSrcweir aAnimation.SetLoopCount( mnAnimationLoopCount ); 1221cdf0e10cSrcweir aGraphic = aAnimation; 1222cdf0e10cSrcweir } 1223cdf0e10cSrcweir else 1224cdf0e10cSrcweir aGraphic = maGraphic; 1225cdf0e10cSrcweir } 1226cdf0e10cSrcweir } 1227cdf0e10cSrcweir 1228cdf0e10cSrcweir return aGraphic; 1229cdf0e10cSrcweir } 1230cdf0e10cSrcweir 1231cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1232cdf0e10cSrcweir 1233cdf0e10cSrcweir void GraphicObject::ResetAnimationLoopCount() 1234cdf0e10cSrcweir { 1235cdf0e10cSrcweir if( IsAnimated() && !IsSwappedOut() ) 1236cdf0e10cSrcweir { 1237cdf0e10cSrcweir maGraphic.ResetAnimationLoopCount(); 1238cdf0e10cSrcweir 1239cdf0e10cSrcweir if( mpSimpleCache ) 1240cdf0e10cSrcweir mpSimpleCache->maGraphic.ResetAnimationLoopCount(); 1241cdf0e10cSrcweir } 1242cdf0e10cSrcweir } 1243cdf0e10cSrcweir 1244cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1245cdf0e10cSrcweir 1246cdf0e10cSrcweir sal_Bool GraphicObject::SwapOut() 1247cdf0e10cSrcweir { 1248cdf0e10cSrcweir sal_Bool bRet = ( !mbAutoSwapped ? maGraphic.SwapOut() : sal_False ); 1249cdf0e10cSrcweir 1250cdf0e10cSrcweir if( bRet && mpMgr ) 1251cdf0e10cSrcweir mpMgr->ImplGraphicObjectWasSwappedOut( *this ); 1252cdf0e10cSrcweir 1253cdf0e10cSrcweir return bRet; 1254cdf0e10cSrcweir } 1255cdf0e10cSrcweir 1256cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1257cdf0e10cSrcweir 1258cdf0e10cSrcweir sal_Bool GraphicObject::SwapOut( SvStream* pOStm ) 1259cdf0e10cSrcweir { 1260cdf0e10cSrcweir sal_Bool bRet = ( !mbAutoSwapped ? maGraphic.SwapOut( pOStm ) : sal_False ); 1261cdf0e10cSrcweir 1262cdf0e10cSrcweir if( bRet && mpMgr ) 1263cdf0e10cSrcweir mpMgr->ImplGraphicObjectWasSwappedOut( *this ); 1264cdf0e10cSrcweir 1265cdf0e10cSrcweir return bRet; 1266cdf0e10cSrcweir } 1267cdf0e10cSrcweir 1268cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1269cdf0e10cSrcweir 1270cdf0e10cSrcweir sal_Bool GraphicObject::SwapIn() 1271cdf0e10cSrcweir { 1272cdf0e10cSrcweir sal_Bool bRet; 1273cdf0e10cSrcweir 1274cdf0e10cSrcweir if( mbAutoSwapped ) 1275cdf0e10cSrcweir { 1276cdf0e10cSrcweir ImplAutoSwapIn(); 1277cdf0e10cSrcweir bRet = sal_True; 1278cdf0e10cSrcweir } 1279cdf0e10cSrcweir else if( mpMgr && mpMgr->ImplFillSwappedGraphicObject( *this, maGraphic ) ) 1280*d327e58aSArmin Le Grand { 1281cdf0e10cSrcweir bRet = sal_True; 1282*d327e58aSArmin Le Grand } 1283cdf0e10cSrcweir else 1284cdf0e10cSrcweir { 1285cdf0e10cSrcweir bRet = maGraphic.SwapIn(); 1286cdf0e10cSrcweir 1287cdf0e10cSrcweir if( bRet && mpMgr ) 1288cdf0e10cSrcweir mpMgr->ImplGraphicObjectWasSwappedIn( *this ); 1289cdf0e10cSrcweir } 1290cdf0e10cSrcweir 1291cdf0e10cSrcweir if( bRet ) 1292*d327e58aSArmin Le Grand { 1293cdf0e10cSrcweir ImplAssignGraphicData(); 1294cdf0e10cSrcweir 1295*d327e58aSArmin Le Grand // Handle evtl. needed AfterDataChanges 1296*d327e58aSArmin Le Grand ImplAfterDataChange(); 1297*d327e58aSArmin Le Grand } 1298*d327e58aSArmin Le Grand 1299cdf0e10cSrcweir return bRet; 1300cdf0e10cSrcweir } 1301cdf0e10cSrcweir 1302cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1303cdf0e10cSrcweir 1304cdf0e10cSrcweir sal_Bool GraphicObject::SwapIn( SvStream* pIStm ) 1305cdf0e10cSrcweir { 1306cdf0e10cSrcweir sal_Bool bRet; 1307cdf0e10cSrcweir 1308cdf0e10cSrcweir if( mbAutoSwapped ) 1309cdf0e10cSrcweir { 1310cdf0e10cSrcweir ImplAutoSwapIn(); 1311cdf0e10cSrcweir bRet = sal_True; 1312cdf0e10cSrcweir } 1313cdf0e10cSrcweir else if( mpMgr && mpMgr->ImplFillSwappedGraphicObject( *this, maGraphic ) ) 1314*d327e58aSArmin Le Grand { 1315cdf0e10cSrcweir bRet = sal_True; 1316*d327e58aSArmin Le Grand } 1317cdf0e10cSrcweir else 1318cdf0e10cSrcweir { 1319cdf0e10cSrcweir bRet = maGraphic.SwapIn( pIStm ); 1320cdf0e10cSrcweir 1321cdf0e10cSrcweir if( bRet && mpMgr ) 1322cdf0e10cSrcweir mpMgr->ImplGraphicObjectWasSwappedIn( *this ); 1323cdf0e10cSrcweir } 1324cdf0e10cSrcweir 1325cdf0e10cSrcweir if( bRet ) 1326*d327e58aSArmin Le Grand { 1327cdf0e10cSrcweir ImplAssignGraphicData(); 1328cdf0e10cSrcweir 1329*d327e58aSArmin Le Grand // 1330*d327e58aSArmin Le Grand ImplAfterDataChange(); 1331*d327e58aSArmin Le Grand } 1332*d327e58aSArmin Le Grand 1333cdf0e10cSrcweir return bRet; 1334cdf0e10cSrcweir } 1335cdf0e10cSrcweir 1336cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1337cdf0e10cSrcweir 1338cdf0e10cSrcweir void GraphicObject::SetSwapState() 1339cdf0e10cSrcweir { 1340cdf0e10cSrcweir if( !IsSwappedOut() ) 1341cdf0e10cSrcweir { 1342cdf0e10cSrcweir mbAutoSwapped = sal_True; 1343cdf0e10cSrcweir 1344cdf0e10cSrcweir if( mpMgr ) 1345cdf0e10cSrcweir mpMgr->ImplGraphicObjectWasSwappedOut( *this ); 1346cdf0e10cSrcweir } 1347cdf0e10cSrcweir } 1348cdf0e10cSrcweir 1349cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1350cdf0e10cSrcweir 1351cdf0e10cSrcweir IMPL_LINK( GraphicObject, ImplAutoSwapOutHdl, void*, EMPTYARG ) 1352cdf0e10cSrcweir { 1353cdf0e10cSrcweir if( !IsSwappedOut() ) 1354cdf0e10cSrcweir { 1355cdf0e10cSrcweir mbIsInSwapOut = sal_True; 1356cdf0e10cSrcweir 1357cdf0e10cSrcweir SvStream* pStream = GetSwapStream(); 1358cdf0e10cSrcweir 1359cdf0e10cSrcweir if( GRFMGR_AUTOSWAPSTREAM_NONE != pStream ) 1360cdf0e10cSrcweir { 1361cdf0e10cSrcweir if( GRFMGR_AUTOSWAPSTREAM_LINK == pStream ) 1362cdf0e10cSrcweir mbAutoSwapped = SwapOut( NULL ); 1363cdf0e10cSrcweir else 1364cdf0e10cSrcweir { 1365cdf0e10cSrcweir if( GRFMGR_AUTOSWAPSTREAM_TEMP == pStream ) 1366cdf0e10cSrcweir mbAutoSwapped = SwapOut(); 1367cdf0e10cSrcweir else 1368cdf0e10cSrcweir { 1369cdf0e10cSrcweir mbAutoSwapped = SwapOut( pStream ); 1370cdf0e10cSrcweir delete pStream; 1371cdf0e10cSrcweir } 1372cdf0e10cSrcweir } 1373cdf0e10cSrcweir } 1374cdf0e10cSrcweir 1375cdf0e10cSrcweir mbIsInSwapOut = sal_False; 1376cdf0e10cSrcweir } 1377cdf0e10cSrcweir 1378cdf0e10cSrcweir if( mpSwapOutTimer ) 1379cdf0e10cSrcweir mpSwapOutTimer->Start(); 1380cdf0e10cSrcweir 1381cdf0e10cSrcweir return 0L; 1382cdf0e10cSrcweir } 1383cdf0e10cSrcweir 1384cdf0e10cSrcweir // ------------------------------------------------------------------------ 1385cdf0e10cSrcweir 1386cdf0e10cSrcweir SvStream& operator>>( SvStream& rIStm, GraphicObject& rGraphicObj ) 1387cdf0e10cSrcweir { 1388cdf0e10cSrcweir VersionCompat aCompat( rIStm, STREAM_READ ); 1389cdf0e10cSrcweir Graphic aGraphic; 1390cdf0e10cSrcweir GraphicAttr aAttr; 1391cdf0e10cSrcweir ByteString aLink; 1392cdf0e10cSrcweir sal_Bool bLink; 1393cdf0e10cSrcweir 1394cdf0e10cSrcweir rIStm >> aGraphic >> aAttr >> bLink; 1395cdf0e10cSrcweir 1396cdf0e10cSrcweir rGraphicObj.SetGraphic( aGraphic ); 1397cdf0e10cSrcweir rGraphicObj.SetAttr( aAttr ); 1398cdf0e10cSrcweir 1399cdf0e10cSrcweir if( bLink ) 1400cdf0e10cSrcweir { 1401cdf0e10cSrcweir rIStm >> aLink; 1402cdf0e10cSrcweir rGraphicObj.SetLink( UniString( aLink, RTL_TEXTENCODING_UTF8 ) ); 1403cdf0e10cSrcweir } 1404cdf0e10cSrcweir else 1405cdf0e10cSrcweir rGraphicObj.SetLink(); 1406cdf0e10cSrcweir 1407cdf0e10cSrcweir rGraphicObj.SetSwapStreamHdl(); 1408cdf0e10cSrcweir 1409cdf0e10cSrcweir return rIStm; 1410cdf0e10cSrcweir } 1411cdf0e10cSrcweir 1412cdf0e10cSrcweir // ------------------------------------------------------------------------ 1413cdf0e10cSrcweir 1414cdf0e10cSrcweir SvStream& operator<<( SvStream& rOStm, const GraphicObject& rGraphicObj ) 1415cdf0e10cSrcweir { 1416cdf0e10cSrcweir VersionCompat aCompat( rOStm, STREAM_WRITE, 1 ); 1417cdf0e10cSrcweir const sal_Bool bLink = rGraphicObj.HasLink(); 1418cdf0e10cSrcweir 1419cdf0e10cSrcweir rOStm << rGraphicObj.GetGraphic() << rGraphicObj.GetAttr() << bLink; 1420cdf0e10cSrcweir 1421cdf0e10cSrcweir if( bLink ) 1422cdf0e10cSrcweir rOStm << ByteString( rGraphicObj.GetLink(), RTL_TEXTENCODING_UTF8 ); 1423cdf0e10cSrcweir 1424cdf0e10cSrcweir return rOStm; 1425cdf0e10cSrcweir } 1426cdf0e10cSrcweir 1427cdf0e10cSrcweir #define UNO_NAME_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:" 1428cdf0e10cSrcweir 1429cdf0e10cSrcweir GraphicObject GraphicObject::CreateGraphicObjectFromURL( const ::rtl::OUString &rURL ) 1430cdf0e10cSrcweir { 1431cdf0e10cSrcweir const String aURL( rURL ), aPrefix( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_GRAPHOBJ_URLPREFIX) ); 1432cdf0e10cSrcweir if( aURL.Search( aPrefix ) == 0 ) 1433cdf0e10cSrcweir { 1434cdf0e10cSrcweir // graphic manager url 1435cdf0e10cSrcweir ByteString aUniqueID( String(rURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 )), RTL_TEXTENCODING_UTF8 ); 1436cdf0e10cSrcweir return GraphicObject( aUniqueID ); 1437cdf0e10cSrcweir } 1438cdf0e10cSrcweir else 1439cdf0e10cSrcweir { 1440cdf0e10cSrcweir Graphic aGraphic; 1441cdf0e10cSrcweir if ( aURL.Len() ) 1442cdf0e10cSrcweir { 1443cdf0e10cSrcweir SvStream* pStream = utl::UcbStreamHelper::CreateStream( aURL, STREAM_READ ); 1444cdf0e10cSrcweir if( pStream ) 1445cdf0e10cSrcweir GraphicConverter::Import( *pStream, aGraphic ); 1446cdf0e10cSrcweir } 1447cdf0e10cSrcweir 1448cdf0e10cSrcweir return GraphicObject( aGraphic ); 1449cdf0e10cSrcweir } 1450cdf0e10cSrcweir } 14512376739dSArmin Le Grand 14522376739dSArmin Le Grand // calculate scalings between real image size and logic object size. This 14532376739dSArmin Le Grand // is necessary since the crop values are relative to original bitmap size 14542376739dSArmin Le Grand basegfx::B2DVector GraphicObject::calculateCropScaling( 14552376739dSArmin Le Grand double fWidth, 14562376739dSArmin Le Grand double fHeight, 14572376739dSArmin Le Grand double fLeftCrop, 14582376739dSArmin Le Grand double fTopCrop, 14592376739dSArmin Le Grand double fRightCrop, 14602376739dSArmin Le Grand double fBottomCrop) const 14612376739dSArmin Le Grand { 14622376739dSArmin Le Grand const MapMode aMapMode100thmm(MAP_100TH_MM); 14632376739dSArmin Le Grand Size aBitmapSize(GetPrefSize()); 14642376739dSArmin Le Grand double fFactorX(1.0); 14652376739dSArmin Le Grand double fFactorY(1.0); 14662376739dSArmin Le Grand 14672376739dSArmin Le Grand if(MAP_PIXEL == GetPrefMapMode().GetMapUnit()) 14682376739dSArmin Le Grand { 14692376739dSArmin Le Grand aBitmapSize = Application::GetDefaultDevice()->PixelToLogic(aBitmapSize, aMapMode100thmm); 14702376739dSArmin Le Grand } 14712376739dSArmin Le Grand else 14722376739dSArmin Le Grand { 14732376739dSArmin Le Grand aBitmapSize = Application::GetDefaultDevice()->LogicToLogic(aBitmapSize, GetPrefMapMode(), aMapMode100thmm); 14742376739dSArmin Le Grand } 14752376739dSArmin Le Grand 14762376739dSArmin Le Grand const double fDivX(aBitmapSize.Width() - fLeftCrop - fRightCrop); 14772376739dSArmin Le Grand const double fDivY(aBitmapSize.Height() - fTopCrop - fBottomCrop); 14782376739dSArmin Le Grand 14792376739dSArmin Le Grand if(!basegfx::fTools::equalZero(fDivX)) 14802376739dSArmin Le Grand { 14812376739dSArmin Le Grand fFactorX = fabs(fWidth) / fDivX; 14822376739dSArmin Le Grand } 14832376739dSArmin Le Grand 14842376739dSArmin Le Grand if(!basegfx::fTools::equalZero(fDivY)) 14852376739dSArmin Le Grand { 14862376739dSArmin Le Grand fFactorY = fabs(fHeight) / fDivY; 14872376739dSArmin Le Grand } 14882376739dSArmin Le Grand 14892376739dSArmin Le Grand return basegfx::B2DVector(fFactorX,fFactorY); 14902376739dSArmin Le Grand } 14912376739dSArmin Le Grand 1492*d327e58aSArmin Le Grand // ------------------------------------------------------------------------ 1493*d327e58aSArmin Le Grand // restart SwapOut timer 1494*d327e58aSArmin Le Grand 1495*d327e58aSArmin Le Grand void GraphicObject::restartSwapOutTimer() const 1496*d327e58aSArmin Le Grand { 1497*d327e58aSArmin Le Grand if( mpSwapOutTimer && mpSwapOutTimer->IsActive() ) 1498*d327e58aSArmin Le Grand { 1499*d327e58aSArmin Le Grand mpSwapOutTimer->Start(); 1500*d327e58aSArmin Le Grand } 1501*d327e58aSArmin Le Grand } 1502*d327e58aSArmin Le Grand 15032376739dSArmin Le Grand // eof 1504