summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2006-03-24 12:01:09 +0000
committerOliver Bolte <obo@openoffice.org>2006-03-24 12:01:09 +0000
commit4f3c83c32234220beb865603c6e7e66846f55c62 (patch)
treeedc41e322fdd9b5c0c19109ba1489a0540eeca6e
parente21083ae636b0fd48b7cf788f9655d59f843976e (diff)
INTEGRATION: CWS fwk33 (1.65.10); FILE MERGED
2006/03/03 13:33:11 mav 1.65.10.2: #i62746# even if the object whants to be notified on resize, it still might be scaled 2006/02/10 11:56:01 mav 1.65.10.1: #i46838# chow HC-representation of embedded object when requested
-rw-r--r--svx/source/svdraw/svdoole2.cxx88
1 files changed, 54 insertions, 34 deletions
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index 2c3c23471f1f..9e99f0fa3a61 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: svdoole2.cxx,v $
*
- * $Revision: 1.65 $
+ * $Revision: 1.66 $
*
- * last change: $Author: kz $ $Date: 2006-02-01 19:02:05 $
+ * last change: $Author: obo $ $Date: 2006-03-24 13:01:09 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -1177,8 +1177,20 @@ sal_Bool SdrOle2Obj::DoPaintObject(XOutputDevice& rOut, const SdrPaintInfoRec& r
void SdrOle2Obj::PaintGraphic_Impl( XOutputDevice& rOut, const SdrPaintInfoRec& rInfoRec, sal_Bool bActive ) const
{
- Graphic* pGr = GetGraphic();
- OutputDevice* pOutDev=rOut.GetOutDev();
+ OutputDevice* pOutDev = rOut.GetOutDev();
+ OSL_ENSURE( pOutDev, "The device must be provided!\n" );
+ if ( !pOutDev )
+ return;
+
+ // In case High Contrast mode is requested try to get a graphical representation in this mode
+ // if it is not possible the replacement image should be used
+ Graphic* pGr = NULL;
+ if ( ( pOutDev->GetDrawMode() & DRAWMODE_SETTINGSFILL ) && xObjRef.is() )
+ pGr = xObjRef.GetHCGraphic();
+
+ if ( !pGr )
+ pGr = GetGraphic();
+
if ( pGr && pGr->GetType() != GRAPHIC_NONE )
{
if( IsEmptyPresObj() )
@@ -1346,41 +1358,49 @@ void SdrOle2Obj::ImpSetVisAreaSize()
{
OSL_ASSERT( pModel );
sal_Int64 nMiscStatus = xObjRef->getStatus( GetAspect() );
- if ( (nMiscStatus & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE) && svt::EmbeddedObjectRef::TryRunningState( xObjRef.GetObject() ) )
- {
- // server wants to resize itself (f.e. Chart wants to recalculate the layout)
- MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObjRef->getMapUnit( GetAspect() ) );
- Rectangle aVisArea = OutputDevice::LogicToLogic( aRect, pModel->GetScaleUnit(), aMapUnit);
- awt::Size aSz;
- aSz.Width = aVisArea.GetSize().Width();
- aSz.Height = aVisArea.GetSize().Height();
- xObjRef->setVisualAreaSize( GetAspect(), aSz );
- try
+ // the client is required to get access to scaling
+ SfxInPlaceClient* pClient = SfxInPlaceClient::GetClient( pModel->GetPersist(), xObjRef.GetObject() );
+ if ( pClient )
+ {
+ if ( (nMiscStatus & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE) && svt::EmbeddedObjectRef::TryRunningState( xObjRef.GetObject() ) )
{
- aSz = xObjRef->getVisualAreaSize( GetAspect() );
- }
- catch( embed::NoVisualAreaSizeException& )
- {}
+ // server wants to resize itself (f.e. Chart wants to recalculate the layout)
+ // the scaling should not change, but it might exist already and must be used in calculations
+ MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObjRef->getMapUnit( GetAspect() ) );
+ Size aVisSize( (long)( Fraction( aRect.GetWidth() ) / pClient->GetScaleWidth() ),
+ (long)( Fraction( aRect.GetHeight() ) / pClient->GetScaleHeight() ) );
- Rectangle aAcceptedVisArea;
- aAcceptedVisArea.SetSize( Size( aSz.Width, aSz.Height ) );
- //Rectangle aAcceptedVisArea(rIPRef->GetVisArea());
- if (aVisArea.GetSize() != aAcceptedVisArea.GetSize())
- {
- // server changed VisArea to its liking
- MapUnit aNewMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObjRef->getMapUnit( GetAspect() ) );
- aRect.SetSize(OutputDevice::LogicToLogic( aAcceptedVisArea.GetSize(), aNewMapUnit, pModel->GetScaleUnit()));
- }
+ aVisSize = OutputDevice::LogicToLogic( aVisSize, pModel->GetScaleUnit(), aMapUnit);
+ awt::Size aSz;
+ aSz.Width = aVisSize.Width();
+ aSz.Height = aVisSize.Height();
+ xObjRef->setVisualAreaSize( GetAspect(), aSz );
- xObjRef.UpdateReplacement();
- }
- else
- {
- // change object scaling
- SfxInPlaceClient* pClient = SfxInPlaceClient::GetClient( pModel->GetPersist(), xObjRef.GetObject() );
- if ( pClient && xObjRef.is() )
+ try
+ {
+ aSz = xObjRef->getVisualAreaSize( GetAspect() );
+ }
+ catch( embed::NoVisualAreaSizeException& )
+ {}
+
+ Rectangle aAcceptedVisArea;
+ aAcceptedVisArea.SetSize( Size( (long)( Fraction( aSz.Width ) * pClient->GetScaleWidth() ),
+ (long)( Fraction( aSz.Height ) * pClient->GetScaleHeight() ) ) );
+ //Rectangle aAcceptedVisArea(rIPRef->GetVisArea());
+ if (aVisSize != aAcceptedVisArea.GetSize())
+ {
+ // server changed VisArea to its liking
+ MapUnit aNewMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObjRef->getMapUnit( GetAspect() ) );
+ aRect.SetSize(OutputDevice::LogicToLogic( aAcceptedVisArea.GetSize(), aNewMapUnit, pModel->GetScaleUnit()));
+ }
+
+ xObjRef.UpdateReplacement();
+ }
+ else
{
+ // change object scaling
+
// TODO/LEAN: to avoid rounding errors scaling always uses the VisArea.
// If we don't cache it for own objects also we must load the object here
awt::Size aObjSize;