[Libreoffice-commits] core.git: Branch 'libreoffice-3-6' - 3 commits - xmloff/inc xmloff/source
Radek Doulik
rodo at novell.com
Mon Apr 8 08:51:11 PDT 2013
xmloff/inc/EnhancedCustomShapeToken.hxx | 2
xmloff/inc/xmloff/xmltoken.hxx | 1
xmloff/source/core/xmltoken.cxx | 1
xmloff/source/draw/EnhancedCustomShapeToken.cxx | 2
xmloff/source/draw/shapeexport4.cxx | 64 ++++++++++++++++++++--
xmloff/source/draw/ximpcustomshape.cxx | 68 ++++++++++++++++++++++++
6 files changed, 132 insertions(+), 6 deletions(-)
New commits:
commit d101eac309d15fdf6031be898823b3f8d1e4911a
Author: Radek Doulik <rodo at novell.com>
Date: Fri Feb 1 12:25:23 2013 +0100
export darken/darkeless/lighten/lightenless commands
Change-Id: I4531ab82a52e3da41f12409185f7c0730381aa23
diff --git a/xmloff/source/draw/shapeexport4.cxx b/xmloff/source/draw/shapeexport4.cxx
index 7b80346..41f3652 100644
--- a/xmloff/source/draw/shapeexport4.cxx
+++ b/xmloff/source/draw/shapeexport4.cxx
@@ -425,6 +425,30 @@ void ImpExportEnhancedPath( SvXMLExport& rExport,
i += 2;
}
break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::DARKEN :
+ if ( bExtended )
+ aStrBuffer.append( (sal_Unicode)'H' );
+ else
+ bNeedExtended = true;
+ break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::DARKENLESS :
+ if ( bExtended )
+ aStrBuffer.append( (sal_Unicode)'I' );
+ else
+ bNeedExtended = true;
+ break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::LIGHTEN :
+ if ( bExtended )
+ aStrBuffer.append( (sal_Unicode)'J' );
+ else
+ bNeedExtended = true;
+ break;
+ case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::LIGHTENLESS :
+ if ( bExtended )
+ aStrBuffer.append( (sal_Unicode)'K' );
+ else
+ bNeedExtended = true;
+ break;
default : // ups, seems to be something wrong
{
aSegment.Count = 1;
diff --git a/xmloff/source/draw/ximpcustomshape.cxx b/xmloff/source/draw/ximpcustomshape.cxx
index bbd85a3..39221f7 100644
--- a/xmloff/source/draw/ximpcustomshape.cxx
+++ b/xmloff/source/draw/ximpcustomshape.cxx
@@ -711,6 +711,34 @@ void GetEnhancedPath( std::vector< com::sun::star::beans::PropertyValue >& rDest
nIndex++;
}
break;
+ case 'H' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::DARKEN;
+ nParametersNeeded = 0;
+ nIndex++;
+ }
+ break;
+ case 'I' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::DARKENLESS;
+ nParametersNeeded = 0;
+ nIndex++;
+ }
+ break;
+ case 'J' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::LIGHTEN;
+ nParametersNeeded = 0;
+ nIndex++;
+ }
+ break;
+ case 'K' :
+ {
+ nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::LIGHTENLESS;
+ nParametersNeeded = 0;
+ nIndex++;
+ }
+ break;
case 'W' :
{
nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARCTO;
commit 6016589874e419a4a276041b2361400fbabc568f
Author: Radek Doulik <rodo at novell.com>
Date: Thu Jan 31 12:05:50 2013 +0100
export subpath sizes (these are for example in pptx custom shape presets)
Change-Id: Iab21d0845d0cb6e4dadeffb5f7b9ebab1e4b955a
diff --git a/xmloff/inc/EnhancedCustomShapeToken.hxx b/xmloff/inc/EnhancedCustomShapeToken.hxx
index 66b9737..755db2f 100644
--- a/xmloff/inc/EnhancedCustomShapeToken.hxx
+++ b/xmloff/inc/EnhancedCustomShapeToken.hxx
@@ -93,6 +93,7 @@ namespace xmloff { namespace EnhancedCustomShapeToken {
EAS_handle_polar,
EAS_handle_radius_range_minimum,
EAS_handle_radius_range_maximum,
+ EAS_sub_view_size,
EAS_CustomShapeEngine,
EAS_CustomShapeData,
@@ -154,6 +155,7 @@ namespace xmloff { namespace EnhancedCustomShapeToken {
EAS_SameLetterHeights,
EAS_Position,
EAS_AdjustmentValues,
+ EAS_SubViewSize,
EAS_Last,
EAS_NotFound
diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx
index dca9fcf..8c3be4e 100644
--- a/xmloff/inc/xmloff/xmltoken.hxx
+++ b/xmloff/inc/xmloff/xmltoken.hxx
@@ -1733,6 +1733,7 @@ namespace xmloff { namespace token {
XML_SUBTOTAL_FIELD,
XML_SUBTOTAL_RULE,
XML_SUBTOTAL_RULES,
+ XML_SUB_VIEW_SIZE,
XML_SUFFIX,
XML_SUM,
XML_SWISS,
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index b21d7fa..e436e59 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -1738,6 +1738,7 @@ namespace xmloff { namespace token {
TOKEN( "subtotal-field", XML_SUBTOTAL_FIELD ),
TOKEN( "subtotal-rule", XML_SUBTOTAL_RULE ),
TOKEN( "subtotal-rules", XML_SUBTOTAL_RULES ),
+ TOKEN( "sub-view-size", XML_SUB_VIEW_SIZE ),
TOKEN( "suffix", XML_SUFFIX ),
TOKEN( "sum", XML_SUM ),
TOKEN( "swiss", XML_SWISS ),
diff --git a/xmloff/source/draw/EnhancedCustomShapeToken.cxx b/xmloff/source/draw/EnhancedCustomShapeToken.cxx
index e82f175..6c86b01 100644
--- a/xmloff/source/draw/EnhancedCustomShapeToken.cxx
+++ b/xmloff/source/draw/EnhancedCustomShapeToken.cxx
@@ -121,6 +121,7 @@ static const TokenTable pTokenTableArray[] =
{ "handle-polar", EAS_handle_polar },
{ "handle-radius-range-minimum", EAS_handle_radius_range_minimum },
{ "handle-radius-range-maximum", EAS_handle_radius_range_maximum },
+ { "sub-view-size", EAS_sub_view_size },
{ "CustomShapeEngine", EAS_CustomShapeEngine },
{ "CustomShapeData", EAS_CustomShapeData },
@@ -182,6 +183,7 @@ static const TokenTable pTokenTableArray[] =
{ "SameLetterHeights", EAS_SameLetterHeights },
{ "Position", EAS_Position },
{ "AdjustmentValues", EAS_AdjustmentValues },
+ { "SubViewSize", EAS_SubViewSize },
{ "Last", EAS_Last },
{ "NotFound", EAS_NotFound }
diff --git a/xmloff/source/draw/shapeexport4.cxx b/xmloff/source/draw/shapeexport4.cxx
index 28bfd29..7b80346 100644
--- a/xmloff/source/draw/shapeexport4.cxx
+++ b/xmloff/source/draw/shapeexport4.cxx
@@ -920,8 +920,26 @@ void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Reference< bean
for ( i = 0; i < nCount; i++ )
{
const beans::PropertyValue& rProp = aPathPropSeq[ i ];
+
switch( EASGet( rProp.Name ) )
{
+ case EAS_SubViewSize:
+ {
+ uno::Sequence< awt::Size > aSubViewSizes;
+ rProp.Value >>= aSubViewSizes;
+
+ for ( int nIdx = 0; nIdx < aSubViewSizes.getLength(); nIdx++ )
+ {
+ if ( nIdx )
+ aStrBuffer.append(' ');
+ ::sax::Converter::convertNumber( aStrBuffer, aSubViewSizes[nIdx].Width );
+ aStrBuffer.append(' ');
+ ::sax::Converter::convertNumber( aStrBuffer, aSubViewSizes[nIdx].Height );
+ }
+ aStr = aStrBuffer.makeStringAndClear();
+ rExport.AddAttribute( XML_NAMESPACE_DRAW_EXT, XML_SUB_VIEW_SIZE, aStr );
+ }
+ break;
case EAS_ExtrusionAllowed :
{
sal_Bool bExtrusionAllowed = sal_Bool();
diff --git a/xmloff/source/draw/ximpcustomshape.cxx b/xmloff/source/draw/ximpcustomshape.cxx
index f8966a1..bbd85a3 100644
--- a/xmloff/source/draw/ximpcustomshape.cxx
+++ b/xmloff/source/draw/ximpcustomshape.cxx
@@ -481,6 +481,43 @@ void GetDoubleSequence( std::vector< com::sun::star::beans::PropertyValue >& rDe
}
}
+void GetSizeSequence( std::vector< com::sun::star::beans::PropertyValue >& rDest,
+ const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
+{
+ std::vector< sal_Int32 > vNum;
+ sal_Int32 nIndex = 0;
+ do
+ {
+ sal_Int32 n;
+ rtl::OUString aToken( rValue.getToken( 0, ' ', nIndex ) );
+ if (!::sax::Converter::convertNumber( n, aToken ))
+ break;
+ else
+ vNum.push_back( n );
+ }
+ while ( nIndex >= 0 );
+
+ if ( !vNum.empty() )
+ {
+ uno::Sequence< awt::Size > aSizeSeq( vNum.size() / 2 );
+ std::vector< sal_Int32 >::const_iterator aIter = vNum.begin();
+ std::vector< sal_Int32 >::const_iterator aEnd = vNum.end();
+ awt::Size* pValues = aSizeSeq.getArray();
+
+ while ( aIter != aEnd ) {
+ pValues->Width = *aIter++;
+ if ( aIter != aEnd )
+ pValues->Height = *aIter++;
+ pValues ++;
+ }
+
+ beans::PropertyValue aProp;
+ aProp.Name = EASGet( eDestProp );
+ aProp.Value <<= aSizeSeq;
+ rDest.push_back( aProp );
+ }
+}
+
void GetEnhancedParameter( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:handle-position
const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp )
{
@@ -869,6 +906,9 @@ void XMLEnhancedCustomShapeContext::StartElement( const uno::Reference< xml::sax
mrCustomShapeGeometry.push_back( aProp );
}
break;
+ case EAS_sub_view_size:
+ GetSizeSequence( maPath, rValue, EAS_SubViewSize );
+ break;
case EAS_text_rotate_angle :
GetDouble( mrCustomShapeGeometry, rValue, EAS_TextRotateAngle );
break;
commit 848be9a20843bed374c90ef2677aae9298cfe6c6
Author: Radek Doulik <rodo at novell.com>
Date: Thu Jul 19 16:06:52 2012 +0200
odf: export old path without unsupported commands in draw namespace as well
- to preserve at least some data for older versions of Libre Office
Change-Id: I2a33706c2a2344e45b57a00469a7387072f8602b
diff --git a/xmloff/source/draw/shapeexport4.cxx b/xmloff/source/draw/shapeexport4.cxx
index 43e75f9..28bfd29 100644
--- a/xmloff/source/draw/shapeexport4.cxx
+++ b/xmloff/source/draw/shapeexport4.cxx
@@ -323,13 +323,14 @@ void ImpExportHandles( SvXMLExport& rExport, const uno::Sequence< beans::Propert
}
void ImpExportEnhancedPath( SvXMLExport& rExport,
- const uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair >& rCoordinates,
- const uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment >& rSegments )
+ const uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair >& rCoordinates,
+ const uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment >& rSegments,
+ bool bExtended = false )
{
rtl::OUString aStr;
rtl::OUStringBuffer aStrBuffer;
- sal_uInt16 aNamespace = XML_NAMESPACE_DRAW;
+ bool bNeedExtended = false;
sal_Int32 i, j, k, l;
@@ -415,8 +416,15 @@ void ImpExportEnhancedPath( SvXMLExport& rExport,
case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::QUADRATICCURVETO :
aStrBuffer.append( (sal_Unicode)'Q' ); nParameter = 2; break;
case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ARCANGLETO :
- aStrBuffer.append( (sal_Unicode)'G' ); nParameter = 2; aNamespace = XML_NAMESPACE_DRAW_EXT; break;
-
+ if ( bExtended ) {
+ aStrBuffer.append( (sal_Unicode)'G' );
+ nParameter = 2;
+ } else {
+ aStrBuffer.setLength( aStrBuffer.getLength() - 1);
+ bNeedExtended = true;
+ i += 2;
+ }
+ break;
default : // ups, seems to be something wrong
{
aSegment.Count = 1;
@@ -445,7 +453,9 @@ void ImpExportEnhancedPath( SvXMLExport& rExport,
}
}
aStr = aStrBuffer.makeStringAndClear();
- rExport.AddAttribute( aNamespace, XML_ENHANCED_PATH, aStr );
+ rExport.AddAttribute( bExtended ? XML_NAMESPACE_DRAW_EXT : XML_NAMESPACE_DRAW, XML_ENHANCED_PATH, aStr );
+ if ( !bExtended && bNeedExtended )
+ ImpExportEnhancedPath( rExport, rCoordinates, rSegments, true );
}
void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Reference< beans::XPropertySet >& xPropSet )
More information about the Libreoffice-commits
mailing list