[Libreoffice-commits] core.git: 2 commits - filter/source include/filter sd/source vcl/source
Sun Ying
sunying at apache.org
Mon May 27 02:23:31 PDT 2013
filter/source/msfilter/escherex.cxx | 73 +++++++++++++++++++++++------------
include/filter/msfilter/escherex.hxx | 7 +++
sd/source/filter/eppt/epptso.cxx | 15 ++++++-
sd/source/filter/ppt/pptin.cxx | 2
vcl/source/control/field.cxx | 22 +++++++---
5 files changed, 86 insertions(+), 33 deletions(-)
New commits:
commit c05c16635b15a47591faa737947c2dce3dcb863e
Author: Sun Ying <sunying at apache.org>
Date: Mon Sep 10 01:56:28 2012 +0000
Resolves: #i119753# fix audio video object lost when save .ppt file
Reported by: Li Feng Wang
Patch by: Ying Sun
Review by: Jian Yuan Li
(cherry picked from commit fbb7e8d8957877922f2f3a971e88685589f43939)
Conflicts:
filter/inc/filter/msfilter/escherex.hxx
filter/source/msfilter/escherex.cxx
Change-Id: I545a9e95c23cfba0cc918c9c4243528570734b2d
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index 4c8fec0..68bd12d 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -18,6 +18,7 @@
*/
#include "eschesdo.hxx"
+#include <svx/svdomedia.hxx>
#include <svx/xflftrit.hxx>
#include <filter/msfilter/escherex.hxx>
#include <svx/unoapi.hxx>
@@ -1283,38 +1284,60 @@ sal_Bool EscherPropertyContainer::CreateOLEGraphicProperties(
if ( pGraphic )
{
GraphicObject aGraphicObject( *pGraphic );
- OString aUniqueId( aGraphicObject.GetUniqueID() );
- if ( !aUniqueId.isEmpty() )
- {
- AddOpt( ESCHER_Prop_fillType, ESCHER_FillPicture );
- uno::Reference< beans::XPropertySet > aXPropSet( rXShape, uno::UNO_QUERY );
+ bRetValue = CreateGraphicProperties( rXShape,aGraphicObject );
+ }
+ }
+ }
+ return bRetValue;
+}
- if ( pGraphicProvider && pPicOutStrm && pShapeBoundRect && aXPropSet.is() )
- {
- ::com::sun::star::uno::Any aAny;
- ::com::sun::star::awt::Rectangle* pVisArea = NULL;
- if ( EscherPropertyValueHelper::GetPropertyValue( aAny, aXPropSet, OUString( "VisibleArea" ) ) )
- {
- pVisArea = new ::com::sun::star::awt::Rectangle;
- aAny >>= (*pVisArea);
- }
- Rectangle aRect( Point( 0, 0 ), pShapeBoundRect->GetSize() );
- sal_uInt32 nBlibId = pGraphicProvider->GetBlibID( *pPicOutStrm, aUniqueId, aRect, pVisArea, NULL );
- if ( nBlibId )
- {
- AddOpt( ESCHER_Prop_pib, nBlibId, sal_True );
- ImplCreateGraphicAttributes( aXPropSet, nBlibId, sal_False );
- bRetValue = sal_True;
- }
- delete pVisArea;
- }
- }
+sal_Bool EscherPropertyContainer::CreateGraphicProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape, const GraphicObject& rGraphicObj )
+{
+ sal_Bool bRetValue = sal_False;
+ OString aUniqueId( rGraphicObj.GetUniqueID() );
+ if ( !aUniqueId.isEmpty() )
+ {
+ AddOpt( ESCHER_Prop_fillType, ESCHER_FillPicture );
+ uno::Reference< beans::XPropertySet > aXPropSet( rXShape, uno::UNO_QUERY );
+
+ if ( pGraphicProvider && pPicOutStrm && pShapeBoundRect && aXPropSet.is() )
+ {
+ ::com::sun::star::uno::Any aAny;
+ ::com::sun::star::awt::Rectangle* pVisArea = NULL;
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, aXPropSet, OUString("VisibleArea" ) ) )
+ {
+ pVisArea = new ::com::sun::star::awt::Rectangle;
+ aAny >>= (*pVisArea);
}
+ Rectangle aRect( Point( 0, 0 ), pShapeBoundRect->GetSize() );
+ sal_uInt32 nBlibId = pGraphicProvider->GetBlibID( *pPicOutStrm, aUniqueId, aRect, pVisArea, NULL );
+ if ( nBlibId )
+ {
+ AddOpt( ESCHER_Prop_pib, nBlibId, sal_True );
+ ImplCreateGraphicAttributes( aXPropSet, nBlibId, sal_False );
+ bRetValue = sal_True;
+ }
+ delete pVisArea;
}
}
return bRetValue;
}
+sal_Bool EscherPropertyContainer::CreateMediaGraphicProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape )
+{
+ sal_Bool bRetValue = sal_False;
+ if ( rXShape.is() )
+ {
+ SdrObject* pSdrMedia( GetSdrObjectFromXShape( rXShape ) ); // SJ: leaving unoapi, because currently there is
+ if ( pSdrMedia && pSdrMedia->ISA( SdrMediaObj ) ) // no access to the native graphic object
+ {
+ GraphicObject aGraphicObject( ((SdrMediaObj*)pSdrMedia)->getSnapshot() );
+ bRetValue = CreateGraphicProperties( rXShape, aGraphicObject );
+ }
+ }
+ return bRetValue;
+}
sal_Bool EscherPropertyContainer::ImplCreateEmbeddedBmp( const OString& rUniqueId )
{
diff --git a/include/filter/msfilter/escherex.hxx b/include/filter/msfilter/escherex.hxx
index 9ccf435..c4807e8 100644
--- a/include/filter/msfilter/escherex.hxx
+++ b/include/filter/msfilter/escherex.hxx
@@ -1231,6 +1231,13 @@ public:
sal_Bool CreateOLEGraphicProperties(
const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXOleObject
);
+ sal_Bool CreateGraphicProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape,
+ const GraphicObject& rGraphicObj
+ );
+ sal_Bool CreateMediaGraphicProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXMediaObject
+ );
/** Creates a complex ESCHER_Prop_fillBlip containing the BLIP directly (for Excel charts). */
sal_Bool CreateEmbeddedBitmapProperties(
diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx
index f8f1a78..53c609a 100644
--- a/sd/source/filter/eppt/epptso.cxx
+++ b/sd/source/filter/eppt/epptso.cxx
@@ -3216,7 +3216,8 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
mnAngle = 0;
mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
ImplCreateShape( ESCHER_ShpInst_PictureFrame, 0xa00, aSolverContainer );
-
+ if ( aPropOpt.CreateMediaGraphicProperties( mXShape ) )
+ aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
::com::sun::star::uno::Any aAny;
if ( PropValue::GetPropertyValue( aAny, mXPropSet, OUString( "MediaURL" ), sal_True ) )
{
@@ -3266,6 +3267,18 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
<< (sal_uInt16)EPP_ExObjRefAtom
<< (sal_uInt32)4
<< nRefId;
+ // write EPP_InteractiveInfo container for no_action
+ *pClientData << (sal_uInt32)( ( EPP_InteractiveInfo << 16 ) | 0xf ) << (sal_uInt32)24;
+ *pClientData << (sal_uInt16)0
+ << (sal_uInt16)EPP_InteractiveInfoAtom
+ << (sal_uInt32)16
+ << (sal_uInt32) 0
+ << (sal_uInt32) 0
+ << (sal_uInt8) 6
+ << (sal_uInt8) 0
+ << (sal_uInt8) 0
+ << (sal_uInt8) 0
+ << (sal_uInt32) 0;
}
}
}
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index a543f5c..fd66e79 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -2005,6 +2005,8 @@ String ImplSdPPTImport::ReadMedia( sal_uInt32 nMediaRef ) const
if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aStr, aRetVal ) )
{
aRetVal = INetURLObject( aRetVal ).GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS );
+ }else{
+ aRetVal = aStr;
}
}
}
commit ba8485a9c87a5feca3c2673af532e73ecf517b69
Author: Yuri Dario <ydario at apache.org>
Date: Wed Jul 18 20:32:47 2012 +0000
cast double to sal_Int64 can throw EXCEPTION_FLT_INVALID_OPERATION on Windows
cherry picked from commit eb34ba3c343807201c62a49a19d7616e1011c118)
Conflicts:
vcl/source/control/field.cxx
Change-Id: I2fb03b1b03ea23259e9eca7305c3f86d80d79f21
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index 87043dd..38b8003 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -677,14 +677,21 @@ sal_Int64 NumericFormatter::Normalize( sal_Int64 nValue ) const
sal_Int64 NumericFormatter::Denormalize( sal_Int64 nValue ) const
{
sal_Int64 nFactor = ImplPower10( GetDecimalDigits() );
+
+ if ((nValue < ( SAL_MIN_INT64 + nFactor )) ||
+ (nValue > ( SAL_MAX_INT64 - nFactor )))
+ {
+ return ( nValue / nFactor );
+ }
+
if( nValue < 0 )
{
- sal_Int64 nHalf = nValue < ( SAL_MIN_INT64 + nFactor )? 0 : nFactor/2;
+ sal_Int64 nHalf = nFactor/2;
return ((nValue-nHalf) / nFactor );
}
else
{
- sal_Int64 nHalf = nValue > ( SAL_MAX_INT64 - nFactor )? 0 : nFactor/2;
+ sal_Int64 nHalf = nFactor/2;
return ((nValue+nHalf) / nFactor );
}
}
@@ -1238,14 +1245,15 @@ sal_Int64 MetricField::ConvertValue( sal_Int64 nValue, sal_Int64 mnBaseValue, sa
{
double nDouble = nonValueDoubleToValueDouble( ConvertDoubleValue(
(double)nValue, mnBaseValue, nDecDigits, eInUnit, eOutUnit ) );
+ sal_Int64 nLong ;
// caution: precision loss in double cast
- sal_Int64 nLong = static_cast<sal_Int64>( nDouble );
-
- if ( nDouble >= (double)SAL_MAX_INT64 )
- nLong = SAL_MAX_INT64;
- else if ( nDouble <= (double)SAL_MIN_INT64 )
+ if ( nDouble <= (double)SAL_MIN_INT64 )
nLong = SAL_MIN_INT64;
+ else if ( nDouble >= (double)SAL_MAX_INT64 )
+ nLong = SAL_MAX_INT64;
+ else
+ nLong = static_cast<sal_Int64>( nDouble );
return nLong;
}
More information about the Libreoffice-commits
mailing list