summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorVladimir Glazunov <vg@openoffice.org>2009-11-24 11:59:16 +0100
committerVladimir Glazunov <vg@openoffice.org>2009-11-24 11:59:16 +0100
commita3b5b70f37122b72f4c853dd371e5b2373672e25 (patch)
treeb83d48a248c06b475cba25ca270ca7cd606c9cbf /svtools
parentde0356c665eb3fc168c4e8a168e3828d50992220 (diff)
parent959cfafb5d71c24b4568473fc3fa8c3bb8c30243 (diff)
CWS-TOOLING: integrate CWS ooo32gsl01_DEV300
Diffstat (limited to 'svtools')
-rw-r--r--svtools/inc/svtools/embedhlp.hxx10
-rw-r--r--svtools/source/misc/embedhlp.cxx41
2 files changed, 40 insertions, 11 deletions
diff --git a/svtools/inc/svtools/embedhlp.hxx b/svtools/inc/svtools/embedhlp.hxx
index f4cccd3115b8..68763a3fd487 100644
--- a/svtools/inc/svtools/embedhlp.hxx
+++ b/svtools/inc/svtools/embedhlp.hxx
@@ -6,9 +6,6 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: embedhlp.hxx,v $
- * $Revision: 1.2 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -131,6 +128,13 @@ namespace svt
BOOL is() const { return mxObj.is(); }
BOOL IsChart() const;
+
+ // #i104867#
+ // Provides a graphic version number for the fetchable Graphic during this object's lifetime. Internally,
+ // that number is incremented at each change of the Graphic. This mechanism is needed to identify if a
+ // remembered Graphic (e.g. primitives) has changed compared to the current one, but without actively
+ // fetching the Graphic what would be too expensive e.g. for charts
+ sal_uInt32 getGraphicVersion() const;
void SetDefaultSizeForChart( const Size& rSizeIn_100TH_MM );//#i103460# charts do not necessaryly have an own size within ODF files, in this case they need to use the size settings from the surrounding frame, which is made available with this method
};
}
diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx
index 6bd1126f8082..edddb7c1ab6d 100644
--- a/svtools/source/misc/embedhlp.cxx
+++ b/svtools/source/misc/embedhlp.cxx
@@ -7,7 +7,6 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: embedhlp.cxx,v $
- * $Revision: 1.28 $
*
* This file is part of OpenOffice.org.
*
@@ -189,7 +188,6 @@ void SAL_CALL EmbedEventListener_Impl::modified( const lang::EventObject& ) thro
pObject->UpdateReplacementOnDemand();
}
}
-
}
void SAL_CALL EmbedEventListener_Impl::notifyEvent( const document::EventObject& aEvent ) throw( uno::RuntimeException )
@@ -250,6 +248,9 @@ struct EmbeddedObjectRef_Impl
sal_Int64 nViewAspect;
BOOL bIsLocked;
sal_Bool bNeedUpdate;
+
+ // #i104867#
+ sal_uInt32 mnGraphicVersion;
awt::Size aDefaultSizeForChart_In_100TH_MM;//#i103460# charts do not necessaryly have an own size within ODF files, in this case they need to use the size settings from the surrounding frame, which is made available with this member
};
@@ -262,6 +263,7 @@ void EmbeddedObjectRef::Construct_Impl()
mpImp->nViewAspect = embed::Aspects::MSOLE_CONTENT;
mpImp->bIsLocked = FALSE;
mpImp->bNeedUpdate = sal_False;
+ mpImp->mnGraphicVersion = 0;
mpImp->aDefaultSizeForChart_In_100TH_MM = awt::Size(8000,7000);
}
@@ -297,12 +299,14 @@ EmbeddedObjectRef::EmbeddedObjectRef( const EmbeddedObjectRef& rObj )
mpImp->pGraphic = 0;
mpImp->pHCGraphic = 0;
+ mpImp->mnGraphicVersion = 0;
}
EmbeddedObjectRef::~EmbeddedObjectRef()
{
delete mpImp->pGraphic;
- if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic );
+ if ( mpImp->pHCGraphic )
+ DELETEZ( mpImp->pHCGraphic );
Clear();
}
/*
@@ -453,10 +457,15 @@ void EmbeddedObjectRef::GetReplacement( BOOL bUpdate )
DELETEZ( mpImp->pGraphic );
mpImp->aMediaType = ::rtl::OUString();
mpImp->pGraphic = new Graphic;
- if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic );
+ if ( mpImp->pHCGraphic )
+ DELETEZ( mpImp->pHCGraphic );
+ mpImp->mnGraphicVersion++;
}
else if ( !mpImp->pGraphic )
+ {
mpImp->pGraphic = new Graphic;
+ mpImp->mnGraphicVersion++;
+ }
else
{
DBG_ERROR("No update, but replacement exists already!");
@@ -469,6 +478,7 @@ void EmbeddedObjectRef::GetReplacement( BOOL bUpdate )
GraphicFilter* pGF = GraphicFilter::GetGraphicFilter();
if( mpImp->pGraphic )
pGF->ImportGraphic( *mpImp->pGraphic, String(), *pGraphicStream, GRFILTER_FORMAT_DONTKNOW );
+ mpImp->mnGraphicVersion++;
delete pGraphicStream;
}
}
@@ -598,6 +608,7 @@ Graphic* EmbeddedObjectRef::GetHCGraphic() const
mpImp->pHCGraphic = pGraphic;
else
delete pGraphic;
+ mpImp->mnGraphicVersion++;
}
delete pStream;
@@ -615,7 +626,9 @@ void EmbeddedObjectRef::SetGraphicStream( const uno::Reference< io::XInputStream
delete mpImp->pGraphic;
mpImp->pGraphic = new Graphic();
mpImp->aMediaType = rMediaType;
- if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic );
+ if ( mpImp->pHCGraphic )
+ DELETEZ( mpImp->pHCGraphic );
+ mpImp->mnGraphicVersion++;
SvStream* pGraphicStream = ::utl::UcbStreamHelper::CreateStream( xInGrStream );
@@ -623,6 +636,7 @@ void EmbeddedObjectRef::SetGraphicStream( const uno::Reference< io::XInputStream
{
GraphicFilter* pGF = GraphicFilter::GetGraphicFilter();
pGF->ImportGraphic( *mpImp->pGraphic, String(), *pGraphicStream, GRFILTER_FORMAT_DONTKNOW );
+ mpImp->mnGraphicVersion++;
if ( mpImp->pContainer )
{
@@ -645,7 +659,9 @@ void EmbeddedObjectRef::SetGraphic( const Graphic& rGraphic, const ::rtl::OUStri
delete mpImp->pGraphic;
mpImp->pGraphic = new Graphic( rGraphic );
mpImp->aMediaType = rMediaType;
- if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic );
+ if ( mpImp->pHCGraphic )
+ DELETEZ( mpImp->pHCGraphic );
+ mpImp->mnGraphicVersion++;
if ( mpImp->pContainer )
SetGraphicToContainer( rGraphic, *mpImp->pContainer, mpImp->aPersistName, rMediaType );
@@ -880,7 +896,9 @@ void EmbeddedObjectRef::UpdateReplacementOnDemand()
{
DELETEZ( mpImp->pGraphic );
mpImp->bNeedUpdate = sal_True;
- if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic );
+ if ( mpImp->pHCGraphic )
+ DELETEZ( mpImp->pHCGraphic );
+ mpImp->mnGraphicVersion++;
if( mpImp->pContainer )
{
@@ -914,6 +932,12 @@ BOOL EmbeddedObjectRef::IsChart() const
return sal_False;
}
+// #i104867#
+sal_uInt32 EmbeddedObjectRef::getGraphicVersion() const
+{
+ return mpImp->mnGraphicVersion;
+}
+
void EmbeddedObjectRef::SetDefaultSizeForChart( const Size& rSizeIn_100TH_MM )
{
//#i103460# charts do not necessaryly have an own size within ODF files,
@@ -928,4 +952,5 @@ void EmbeddedObjectRef::SetDefaultSizeForChart( const Size& rSizeIn_100TH_MM )
xSizeTransmitter->setDefaultSize( mpImp->aDefaultSizeForChart_In_100TH_MM );
}
-}
+} // namespace svt
+