diff options
author | Jan Holesovsky <kendy@suse.cz> | 2013-05-15 11:22:26 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2013-05-15 11:31:15 +0200 |
commit | 826f28e64dfe496a211b03a2419cb71e33ed788b (patch) | |
tree | 4187b58ab6b55bf90cbf459fb0ab13771840658c /drawinglayer | |
parent | Fix fdo#64512 Handle xml:id correctly on multi-image draw:frames (diff) | |
download | core-826f28e64dfe496a211b03a2419cb71e33ed788b.tar.gz core-826f28e64dfe496a211b03a2419cb71e33ed788b.zip |
sd unittests: Update XShapeDumper to dump also (some) font properties.
+ update the expected dumps together with that.
This allows testing of the other part (wrong text color and size, commit
55c63ccfd460895af22e91979967cec15d80b72d) of n#758621 too.
Change-Id: Ie93feb9d9d05eb4e11106bf9aa1f237947351b4e
Diffstat (limited to 'drawinglayer')
-rw-r--r-- | drawinglayer/source/dumper/XShapeDumper.cxx | 56 |
1 files changed, 50 insertions, 6 deletions
diff --git a/drawinglayer/source/dumper/XShapeDumper.cxx b/drawinglayer/source/dumper/XShapeDumper.cxx index 958bc1521172..d3f50abf302d 100644 --- a/drawinglayer/source/dumper/XShapeDumper.cxx +++ b/drawinglayer/source/dumper/XShapeDumper.cxx @@ -84,6 +84,11 @@ void dumpPolygonKindAsAttribute(com::sun::star::drawing::PolygonKind ePolygonKin void dumpPolyPolygonAsElement(com::sun::star::drawing::PointSequenceSequence aPolyPolygon, xmlTextWriterPtr xmlWriter); void dumpGeometryAsElement(com::sun::star::drawing::PointSequenceSequence aGeometry, xmlTextWriterPtr xmlWriter); +// CharacterProperties.idl +void dumpCharFontNameAsAttribute(OUString aCharFontName, xmlTextWriterPtr xmlWriter); +void dumpCharHeightAsAttribute(float fHeight, xmlTextWriterPtr xmlWriter); +void dumpCharColorAsAttribute(sal_Int32 aColor, xmlTextWriterPtr xmlWriter); + // TextProperties.idl void dumpIsNumberingAsAttribute(sal_Bool bIsNumbering, xmlTextWriterPtr xmlWriter); void dumpTextAutoGrowHeightAsAttribute(sal_Bool bTextAutoGrowHeight, xmlTextWriterPtr xmlWriter); @@ -195,7 +200,7 @@ void dumpFillStyleAsAttribute(drawing::FillStyle eFillStyle, xmlTextWriterPtr xm void dumpFillColorAsAttribute(sal_Int32 aColor, xmlTextWriterPtr xmlWriter) { - xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillColor"), "%" SAL_PRIdINT32, aColor); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillColor"), "%06x", (unsigned int) aColor); } void dumpFillTransparenceAsAttribute(sal_Int32 aTransparence, xmlTextWriterPtr xmlWriter) @@ -235,8 +240,8 @@ void dumpGradientProperty(awt::Gradient aGradient, xmlTextWriterPtr xmlWriter) default: break; } - xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("startColor"), "%" SAL_PRIdINT32, (sal_Int32) aGradient.StartColor); - xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("endColor"), "%" SAL_PRIdINT32, (sal_Int32) aGradient.EndColor); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("startColor"), "%06x", (unsigned int) aGradient.StartColor); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("endColor"), "%06x", (unsigned int) aGradient.EndColor); xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("angle"), "%" SAL_PRIdINT32, (sal_Int32) aGradient.Angle); xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("border"), "%" SAL_PRIdINT32, (sal_Int32) aGradient.Border); xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("xOffset"), "%" SAL_PRIdINT32, (sal_Int32) aGradient.XOffset); @@ -283,7 +288,7 @@ void dumpFillHatchAsElement(drawing::Hatch aHatch, xmlTextWriterPtr xmlWriter) default: break; } - xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("color"), "%" SAL_PRIdINT32, (sal_Int32) aHatch.Color); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("color"), "%06x", (unsigned int) aHatch.Color); xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("distance"), "%" SAL_PRIdINT32, (sal_Int32) aHatch.Distance); xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("angle"), "%" SAL_PRIdINT32, (sal_Int32) aHatch.Angle); xmlTextWriterEndElement( xmlWriter ); @@ -481,7 +486,7 @@ void dumpLineDashNameAsAttribute(OUString sLineDashName, xmlTextWriterPtr xmlWri void dumpLineColorAsAttribute(sal_Int32 aLineColor, xmlTextWriterPtr xmlWriter) { - xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineColor"), "%" SAL_PRIdINT32, aLineColor); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineColor"), "%06x", (unsigned int) aLineColor); } void dumpLineTransparenceAsAttribute(sal_Int32 aLineTransparence, xmlTextWriterPtr xmlWriter) @@ -679,6 +684,22 @@ void dumpGeometryAsElement(drawing::PointSequenceSequence aGeometry, xmlTextWrit xmlTextWriterEndElement( xmlWriter ); } +// CharacterProperties.idl +void dumpCharFontNameAsAttribute(OUString aCharFontName, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fontName"), "%s", OUStringToOString( aCharFontName, RTL_TEXTENCODING_UTF8 ).getStr() ); +} + +void dumpCharHeightAsAttribute(float fHeight, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fontHeight"), "%f", fHeight ); +} + +void dumpCharColorAsAttribute(sal_Int32 aColor, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fontColor"), "%06x", (unsigned int) aColor); +} + // ---------------------------------------- // ---------- TextProperties.idl ---------- // ---------------------------------------- @@ -926,7 +947,7 @@ void dumpShadowAsAttribute(sal_Bool bShadow, xmlTextWriterPtr xmlWriter) void dumpShadowColorAsAttribute(sal_Int32 aShadowColor, xmlTextWriterPtr xmlWriter) { - xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("shadowColor"), "%" SAL_PRIdINT32, aShadowColor); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("shadowColor"), "%06x", (unsigned int) aShadowColor); } void dumpShadowTransparenceAsAttribute(sal_Int32 aShadowTransparence, xmlTextWriterPtr xmlWriter) @@ -1124,6 +1145,29 @@ void dumpCustomShapeReplacementURLAsAttribute(OUString sCustomShapeReplacementUR void dumpTextPropertiesService(uno::Reference< beans::XPropertySet > xPropSet, xmlTextWriterPtr xmlWriter) { uno::Reference< beans::XPropertySetInfo> xInfo = xPropSet->getPropertySetInfo(); + if(xInfo->hasPropertyByName("CharFontName")) + { + uno::Any anotherAny = xPropSet->getPropertyValue("CharFontName"); + OUString aCharFontName; + if(anotherAny >>= aCharFontName) + dumpCharFontNameAsAttribute(aCharFontName, xmlWriter); + } + if(xInfo->hasPropertyByName("CharHeight")) + { + uno::Any anotherAny = xPropSet->getPropertyValue("CharHeight"); + float fHeight; + if(anotherAny >>= fHeight) + dumpCharHeightAsAttribute(fHeight, xmlWriter); + } + if(xInfo->hasPropertyByName("CharColor")) + { + uno::Any anotherAny = xPropSet->getPropertyValue("CharColor"); + sal_Int32 aColor = sal_Int32(); + if(anotherAny >>= aColor) + dumpCharColorAsAttribute(aColor, xmlWriter); + } + // TODO - more properties from CharacterProperties.idl (similar to above) + if(xInfo->hasPropertyByName("IsNumbering")) { uno::Any anotherAny = xPropSet->getPropertyValue("IsNumbering"); |