[Libreoffice-commits] core.git: 5 commits - include/oox oox/source
Markus Mohrhard
markus.mohrhard at collabora.co.uk
Tue Feb 25 22:38:10 PST 2014
include/oox/export/drawingml.hxx | 12 ++++++++----
oox/source/export/drawingml.cxx | 27 +++++++++++++++++----------
oox/source/export/shapes.cxx | 3 +--
3 files changed, 26 insertions(+), 16 deletions(-)
New commits:
commit c816729beb6ad79fedf3566dbfccdc17f4dc1584
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Wed Feb 26 07:05:42 2014 +0100
fix OOXML validation error for text shapes, related fdo#31551
blipFill and other fill elements are not allowed to appear together. See
EG_FillProperties in the OOXML spec.
See fdo31551-2.ods
Change-Id: If5869ab9dc69815938c1f4c6fb180b0c1652ddcc
diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 758f9bf..cf2de85 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -135,6 +135,9 @@ public:
void WriteGradientFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
void WriteGradientFill( ::com::sun::star::awt::Gradient rGradient );
void WriteGrabBagGradientFill( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aGradientStops, ::com::sun::star::awt::Gradient rGradient);
+
+ void WriteBlipOrNormalFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
+ const OUString& rURLPropName );
void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
const OUString& sBitmapURL, sal_Int32 nXmlNamespace,
bool bWriteMode, bool bRelPathToMedia = false );
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 3e5b9f0..cd67e57 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -847,6 +847,17 @@ void DrawingML::WriteBlipMode( Reference< XPropertySet > rXPropSet, const OUStri
}
}
+void DrawingML::WriteBlipOrNormalFill( Reference< XPropertySet > xPropSet, const OUString& rURLPropName )
+{
+ // check for blip and otherwise fall back to normal fill
+ // we always store normal fill properties but OOXML
+ // uses a choice between our fill props and BlipFill
+ if (GetProperty ( xPropSet, rURLPropName ))
+ WriteBlipFill( xPropSet, rURLPropName );
+ else
+ WriteFill(xPropSet);
+}
+
void DrawingML::WriteBlipFill( Reference< XPropertySet > rXPropSet, const OUString& sURLPropName )
{
WriteBlipFill( rXPropSet, sURLPropName, XML_a );
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index b62f8a3..2a8fe7e 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -943,8 +943,7 @@ ShapeExport& ShapeExport::WriteTextShape( Reference< XShape > xShape )
WriteShapeTransformation( xShape, XML_a,0,0,false);
WritePresetShape( "rect" );
uno::Reference<beans::XPropertySet> xPropertySet(xShape, UNO_QUERY);
- WriteFill(xPropertySet);
- WriteBlipFill(xPropertySet, "GraphicURL");
+ WriteBlipOrNormalFill(xPropertySet, "GraphicURL");
WriteOutline(xPropertySet);
pFS->endElementNS( mnXmlNamespace, XML_spPr );
commit 3ca2069f0dc829e2a0fd9594e351c9fee6b3413a
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Wed Feb 26 06:59:24 2014 +0100
use const reference for OUString
Change-Id: I66b5f144da7951f36e32a840b8ed70f38539f105
diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 4fe42cc..758f9bf 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -136,11 +136,12 @@ public:
void WriteGradientFill( ::com::sun::star::awt::Gradient rGradient );
void WriteGrabBagGradientFill( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aGradientStops, ::com::sun::star::awt::Gradient rGradient);
void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
- OUString sBitmapURL, sal_Int32 nXmlNamespace,
+ const OUString& sBitmapURL, sal_Int32 nXmlNamespace,
bool bWriteMode, bool bRelPathToMedia = false );
- void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, OUString sURLPropName );
void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
- OUString sURLPropName, sal_Int32 nXmlNamespace );
+ const OUString& sURLPropName );
+ void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
+ const OUString& sURLPropName, sal_Int32 nXmlNamespace );
void WritePattFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
void WriteSrcRect( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >, const OUString& );
void WriteOutline( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
@@ -148,7 +149,7 @@ public:
void WriteLinespacing( ::com::sun::star::style::LineSpacing& rLineSpacing );
OUString WriteBlip( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
- OUString& rURL, bool bRelPathToMedia = false , const Graphic *pGraphic=NULL );
+ const OUString& rURL, bool bRelPathToMedia = false , const Graphic *pGraphic=NULL );
void WriteBlipMode( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, const OUString& rURL );
void WriteShapeTransformation( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rXShape,
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 43e4fe8..3e5b9f0 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -804,7 +804,7 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia )
return sRelId;
}
-OUString DrawingML::WriteBlip( Reference< XPropertySet > rXPropSet, OUString& rURL, bool bRelPathToMedia, const Graphic *pGraphic )
+OUString DrawingML::WriteBlip( Reference< XPropertySet > rXPropSet, const OUString& rURL, bool bRelPathToMedia, const Graphic *pGraphic )
{
OUString sRelId = pGraphic ? WriteImage( *pGraphic, bRelPathToMedia ) : WriteImage( rURL, bRelPathToMedia );
sal_Int16 nBright = 0;
@@ -847,12 +847,12 @@ void DrawingML::WriteBlipMode( Reference< XPropertySet > rXPropSet, const OUStri
}
}
-void DrawingML::WriteBlipFill( Reference< XPropertySet > rXPropSet, OUString sURLPropName )
+void DrawingML::WriteBlipFill( Reference< XPropertySet > rXPropSet, const OUString& sURLPropName )
{
WriteBlipFill( rXPropSet, sURLPropName, XML_a );
}
-void DrawingML::WriteBlipFill( Reference< XPropertySet > rXPropSet, OUString sURLPropName, sal_Int32 nXmlNamespace )
+void DrawingML::WriteBlipFill( Reference< XPropertySet > rXPropSet, const OUString& sURLPropName, sal_Int32 nXmlNamespace )
{
if ( GetProperty( rXPropSet, sURLPropName ) ) {
OUString aURL;
@@ -864,7 +864,7 @@ void DrawingML::WriteBlipFill( Reference< XPropertySet > rXPropSet, OUString sUR
}
}
-void DrawingML::WriteBlipFill( Reference< XPropertySet > rXPropSet, OUString sBitmapURL, sal_Int32 nXmlNamespace, bool bWriteMode, bool bRelPathToMedia )
+void DrawingML::WriteBlipFill( Reference< XPropertySet > rXPropSet, const OUString& sBitmapURL, sal_Int32 nXmlNamespace, bool bWriteMode, bool bRelPathToMedia )
{
if ( !sBitmapURL.isEmpty() ) {
DBG(fprintf (stderr, "URL: %s\n", OUStringToOString( sBitmapURL, RTL_TEXTENCODING_UTF8 ).getStr() ));
commit 66cbbe4f3a3df0769c71f5f8878110c585f15a3b
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Wed Feb 26 06:54:17 2014 +0100
fix indentation
Change-Id: Iae492bf19edffe84f86bfa9bf247f120f8c9cb79
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 9677e5e..43e4fe8 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -813,8 +813,8 @@ OUString DrawingML::WriteBlip( Reference< XPropertySet > rXPropSet, OUString& rU
GET( nBright, AdjustLuminance );
GET( nContrast, AdjustContrast );
- mpFS->startElementNS( XML_a, XML_blip,
- FSNS( XML_r, XML_embed), OUStringToOString( sRelId, RTL_TEXTENCODING_UTF8 ).getStr(),
+ mpFS->startElementNS( XML_a, XML_blip,
+ FSNS( XML_r, XML_embed), OUStringToOString( sRelId, RTL_TEXTENCODING_UTF8 ).getStr(),
FSEND );
if( nBright || nContrast )
mpFS->singleElementNS( XML_a, XML_lum,
commit c26ebdb818dd0063eb0182fe4b5c22f59b0b3efe
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Wed Feb 26 06:47:03 2014 +0100
reduntant check
Change-Id: I7969af2e6c73175b020816156478021dcaf8afb0
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index e019ed6..9677e5e 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -869,10 +869,6 @@ void DrawingML::WriteBlipFill( Reference< XPropertySet > rXPropSet, OUString sBi
if ( !sBitmapURL.isEmpty() ) {
DBG(fprintf (stderr, "URL: %s\n", OUStringToOString( sBitmapURL, RTL_TEXTENCODING_UTF8 ).getStr() ));
-
- if( sBitmapURL.isEmpty() )
- return;
-
mpFS->startElementNS( nXmlNamespace , XML_blipFill, FSEND );
WriteBlip( rXPropSet, sBitmapURL, bRelPathToMedia );
commit 75f5eb2646834811f4984dc9c0d228ddc7dcdd27
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Wed Feb 26 06:40:28 2014 +0100
first step in improving the OOXML validation result
Change-Id: Ie4b99e2791cd3575d6544bfca6c6b4e386ac04ea
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 18d6c36..b62f8a3 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -944,8 +944,8 @@ ShapeExport& ShapeExport::WriteTextShape( Reference< XShape > xShape )
WritePresetShape( "rect" );
uno::Reference<beans::XPropertySet> xPropertySet(xShape, UNO_QUERY);
WriteFill(xPropertySet);
- WriteOutline(xPropertySet);
WriteBlipFill(xPropertySet, "GraphicURL");
+ WriteOutline(xPropertySet);
pFS->endElementNS( mnXmlNamespace, XML_spPr );
WriteTextBox( xShape, mnXmlNamespace );
More information about the Libreoffice-commits
mailing list