diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2004-09-08 15:05:42 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2004-09-08 15:05:42 +0000 |
commit | 7844c0950991db14c1f0682c72c47b452f040630 (patch) | |
tree | 5562b06eadb164b8aee9550e6c66915111e6a960 /goodies | |
parent | c89b6f278b2423fceb1b8f1b9c5a5d50e2bee714 (diff) |
INTEGRATION: CWS pdf01 (1.24.122); FILE MERGED
2004/08/09 11:38:28 sj 1.24.122.3: #i29534# export of original jpeg graphics
2004/08/06 11:38:49 pl 1.24.122.2: RESYNC: (1.24-1.25); FILE MERGED
2004/06/02 17:34:09 thb 1.24.122.1: #i29534# Added PDF GfxLink support
Diffstat (limited to 'goodies')
-rw-r--r-- | goodies/source/graphic/grfmgr.cxx | 60 |
1 files changed, 52 insertions, 8 deletions
diff --git a/goodies/source/graphic/grfmgr.cxx b/goodies/source/graphic/grfmgr.cxx index 8dc7ed0b7276..8e6813d7de08 100644 --- a/goodies/source/graphic/grfmgr.cxx +++ b/goodies/source/graphic/grfmgr.cxx @@ -2,9 +2,9 @@ * * $RCSfile: grfmgr.cxx,v $ * - * $Revision: 1.25 $ + * $Revision: 1.26 $ * - * last change: $Author: kz $ $Date: 2004-06-11 09:49:13 $ + * last change: $Author: hr $ $Date: 2004-09-08 16:05:42 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -72,6 +72,7 @@ #include <vcl/metaact.hxx> #include <vcl/virdev.hxx> #include <vcl/salbtype.hxx> +#include <vcl/pdfextoutdevdata.hxx> #include <svtools/cacheoptions.hxx> #include "grfmgr.hxx" @@ -672,8 +673,32 @@ BOOL GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz, const sal_uInt32 nOldDrawMode = pOut->GetDrawMode(); BOOL bCropped = aAttr.IsCropped(); BOOL bCached = FALSE; + BOOL bWritingPdfLinkedGraphic = FALSE; BOOL bRet; + // #i29534# Provide output rects for PDF writer + Rectangle aCropRect; + + // #i29534# Notify PDF writer about linked graphic (if any) + vcl::ExtOutDevData* pExtOutDevData; + if( (pExtOutDevData=pOut->GetExtOutDevData()) && + pExtOutDevData->ISA(vcl::PDFExtOutDevData) ) + { + // #i29534# Only delegate image handling to PDF, if no special + // treatment is necessary + if( GetGraphic().IsLink() && + aSz.Width() > 0L && + aSz.Height() > 0L && + !aAttr.IsSpecialDrawMode() && + !aAttr.IsMirrored() && + !aAttr.IsRotated() && + !aAttr.IsAdjusted() ) + { + bWritingPdfLinkedGraphic = TRUE; + static_cast< vcl::PDFExtOutDevData* >( pExtOutDevData )->BeginGroup(); + } + } + if( !( GRFMGR_DRAW_USE_DRAWMODE_SETTINGS & nFlags ) ) pOut->SetDrawMode( nOldDrawMode & ( ~( DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT ) ) ); @@ -704,14 +729,38 @@ BOOL GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz, if( bCrop ) { if( bRectClip ) - pOut->IntersectClipRegion( aClipPolyPoly.GetBoundRect() ); + { + // #i29534# Store crop rect for later forwarding to + // PDF writer + aCropRect = aClipPolyPoly.GetBoundRect(); + pOut->IntersectClipRegion( aCropRect ); + } else + { pOut->IntersectClipRegion( aClipPolyPoly ); + } } } bRet = mpMgr->DrawObj( pOut, aPt, aSz, *this, aAttr, nFlags, bCached ); + if( bCropped ) + pOut->Pop(); + + pOut->SetDrawMode( nOldDrawMode ); + + // #i29534# Notify PDF writer about linked graphic (if any) + if( bWritingPdfLinkedGraphic ) + { + static_cast< vcl::PDFExtOutDevData* >( pExtOutDevData )->EndGroup( + const_cast< Graphic& >(GetGraphic()), + aAttr.GetTransparency(), + Rectangle( aPt, aSz ), + aCropRect ); + } + + // #i29534# Moved below OutDev restoration, to avoid multiple swap-ins + // (code above needs to call GetGraphic twice) if( bCached ) { if( mpSwapOutTimer ) @@ -720,11 +769,6 @@ BOOL GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz, FireSwapOutRequest(); } - if( bCropped ) - pOut->Pop(); - - pOut->SetDrawMode( nOldDrawMode ); - return bRet; } |