[Libreoffice-commits] .: oox/inc oox/source
Radek DoulÃk
rodo at kemper.freedesktop.org
Fri Oct 8 13:44:00 PDT 2010
oox/inc/oox/drawingml/shape.hxx | 1
oox/source/drawingml/shape.cxx | 21 ++++++++++------
oox/source/helper/propertymap.cxx | 49 +++++++++++++++++++++++++++++++++++++-
oox/source/ppt/pptshape.cxx | 20 ++++++++++-----
4 files changed, 77 insertions(+), 14 deletions(-)
New commits:
commit fab9aa1dd9d1cef0cb82b44c4e642fa4260269ee
Author: Radek Doulik <rodo at novell.com>
Date: Fri Oct 8 22:28:39 2010 +0200
fix default vertical text alignment and placeholder style, n#645116
- use master's body style in case placeholder doesn't have shape in master/layout
diff --git a/oox/inc/oox/drawingml/shape.hxx b/oox/inc/oox/drawingml/shape.hxx
index 9ec5019..ccfb75f 100644
--- a/oox/inc/oox/drawingml/shape.hxx
+++ b/oox/inc/oox/drawingml/shape.hxx
@@ -198,6 +198,7 @@ protected:
CustomShapePropertiesPtr mpCustomShapePropertiesPtr;
table::TablePropertiesPtr mpTablePropertiesPtr;
PropertyMap maShapeProperties;
+ PropertyMap maDefaultShapeProperties;
TextListStylePtr mpMasterTextListStyle;
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxShape;
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index c0dacb5..ffa4532 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -44,7 +44,9 @@
#include <com/sun/star/beans/XMultiPropertySet.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/drawing/HomogenMatrix3.hpp>
+#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/style/ParagraphAdjust.hpp>
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
@@ -59,6 +61,7 @@ using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::text;
using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::style;
namespace oox { namespace drawingml {
@@ -115,13 +118,15 @@ table::TablePropertiesPtr Shape::getTableProperties()
void Shape::setDefaults()
{
- maShapeProperties[ PROP_TextAutoGrowHeight ] <<= false;
- maShapeProperties[ PROP_TextWordWrap ] <<= true;
- maShapeProperties[ PROP_TextLeftDistance ] <<= static_cast< sal_Int32 >( 250 );
- maShapeProperties[ PROP_TextUpperDistance ] <<= static_cast< sal_Int32 >( 125 );
- maShapeProperties[ PROP_TextRightDistance ] <<= static_cast< sal_Int32 >( 250 );
- maShapeProperties[ PROP_TextLowerDistance ] <<= static_cast< sal_Int32 >( 125 );
- maShapeProperties[ PROP_CharHeight ] <<= static_cast< float >( 18.0 );
+ maDefaultShapeProperties[ PROP_TextAutoGrowHeight ] <<= false;
+ maDefaultShapeProperties[ PROP_TextWordWrap ] <<= true;
+ maDefaultShapeProperties[ PROP_TextLeftDistance ] <<= static_cast< sal_Int32 >( 250 );
+ maDefaultShapeProperties[ PROP_TextUpperDistance ] <<= static_cast< sal_Int32 >( 125 );
+ maDefaultShapeProperties[ PROP_TextRightDistance ] <<= static_cast< sal_Int32 >( 250 );
+ maDefaultShapeProperties[ PROP_TextLowerDistance ] <<= static_cast< sal_Int32 >( 125 );
+ maDefaultShapeProperties[ PROP_CharHeight ] <<= static_cast< float >( 18.0 );
+ maDefaultShapeProperties[ PROP_TextVerticalAdjust ] <<= TextVerticalAdjust_TOP;
+ maDefaultShapeProperties[ PROP_ParaAdjust ] <<= static_cast< sal_Int16 >( ParagraphAdjust_LEFT ); // check for RTL?
}
void Shape::setServiceName( const sal_Char* pServiceName )
@@ -428,6 +433,8 @@ Reference< XShape > Shape::createAndInsert(
}
aShapeProperties.insert( getShapeProperties().begin(), getShapeProperties().end() );
+ aShapeProperties.insert( maDefaultShapeProperties.begin(), maDefaultShapeProperties.end() );
+
// applying properties
PropertySet aPropSet( xSet );
if ( aServiceName == OUString::createFromAscii( "com.sun.star.drawing.GraphicObjectShape" ) )
diff --git a/oox/source/helper/propertymap.cxx b/oox/source/helper/propertymap.cxx
index 2bb5c10..a779e1f 100644
--- a/oox/source/helper/propertymap.cxx
+++ b/oox/source/helper/propertymap.cxx
@@ -55,12 +55,17 @@ using ::com::sun::star::beans::XVetoableChangeListener;
#include <com/sun/star/style/LineSpacing.hpp>
#include <com/sun/star/style/LineSpacingMode.hpp>
#include <com/sun/star/text/WritingMode.hpp>
+#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
+#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
#define USS(x) OUStringToOString( x, RTL_TEXTENCODING_UTF8 ).getStr()
using namespace ::com::sun::star;
+using namespace ::com::sun::star::drawing;
using namespace ::com::sun::star::uno;
using ::rtl::OString;
using ::com::sun::star::style::LineSpacing;
using ::com::sun::star::text::WritingMode;
+using ::com::sun::star::drawing::TextHorizontalAdjust;
+using ::com::sun::star::drawing::TextVerticalAdjust;
#endif
namespace oox {
@@ -265,6 +270,8 @@ void PropertyMap::dump( Reference< XPropertySet > rXPropSet )
LineSpacing spacing;
// RectanglePoint pointValue;
WritingMode aWritingMode;
+ TextVerticalAdjust aTextVertAdj;
+ TextHorizontalAdjust aTextHorizAdj;
if( value >>= strValue )
fprintf (stderr,"\"%s\"\n", USS( strValue ) );
@@ -280,7 +287,47 @@ void PropertyMap::dump( Reference< XPropertySet > rXPropSet )
fprintf (stderr,"%d (bool)\n", boolValue);
else if( value >>= aWritingMode )
fprintf (stderr, "%d writing mode\n", aWritingMode);
- else if( value >>= spacing ) {
+ else if( value >>= aTextVertAdj ) {
+ const char* s = "uknown";
+ switch( aTextVertAdj ) {
+ case TextVerticalAdjust_TOP:
+ s = "top";
+ break;
+ case TextVerticalAdjust_CENTER:
+ s = "center";
+ break;
+ case TextVerticalAdjust_BOTTOM:
+ s = "bottom";
+ break;
+ case TextVerticalAdjust_BLOCK:
+ s = "block";
+ break;
+ case TextVerticalAdjust_MAKE_FIXED_SIZE:
+ s = "make_fixed_size";
+ break;
+ }
+ fprintf (stderr, "%s\n", s);
+ } else if( value >>= aTextHorizAdj ) {
+ const char* s = "uknown";
+ switch( aTextHorizAdj ) {
+ case TextHorizontalAdjust_LEFT:
+ s = "left";
+ break;
+ case TextHorizontalAdjust_CENTER:
+ s = "center";
+ break;
+ case TextHorizontalAdjust_RIGHT:
+ s = "right";
+ break;
+ case TextHorizontalAdjust_BLOCK:
+ s = "block";
+ break;
+ case TextHorizontalAdjust_MAKE_FIXED_SIZE:
+ s = "make_fixed_size";
+ break;
+ }
+ fprintf (stderr, "%s\n", s);
+ } else if( value >>= spacing ) {
fprintf (stderr, "mode: %d value: %d\n", spacing.Mode, spacing.Height);
} else if( value.isExtractableTo(::getCppuType((const sal_Int32*)0))) {
fprintf (stderr,"is extractable to int32\n");
diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index 88f6595..aa944c8 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -178,14 +178,18 @@ void PPTShape::addShape(
// use placeholder index if possible
if( mnSubType && getSubTypeIndex() && rSlidePersist.getMasterPersist().get() ) {
oox::drawingml::ShapePtr pPlaceholder = PPTShape::findPlaceholderByIndex( getSubTypeIndex(), rSlidePersist.getMasterPersist()->getShapes()->getChildren() );
- if( pPlaceholder.get() && pPlaceholder->getTextBody() ) {
- TextListStylePtr pNewTextListStyle ( new TextListStyle() );
+ if( pPlaceholder.get() ) {
+ if( pPlaceholder->getTextBody() ) {
+ TextListStylePtr pNewTextListStyle ( new TextListStyle() );
- pNewTextListStyle->apply( pPlaceholder->getTextBody()->getTextListStyle() );
- if( pPlaceholder->getMasterTextListStyle().get() )
- pNewTextListStyle->apply( *pPlaceholder->getMasterTextListStyle() );
+ pNewTextListStyle->apply( pPlaceholder->getTextBody()->getTextListStyle() );
+ if( pPlaceholder->getMasterTextListStyle().get() )
+ pNewTextListStyle->apply( *pPlaceholder->getMasterTextListStyle() );
- aMasterTextListStyle = pNewTextListStyle;
+ aMasterTextListStyle = pNewTextListStyle;
+ }
+ } else if( !mpPlaceholder.get() ) {
+ aMasterTextListStyle.reset();
}
}
@@ -272,6 +276,10 @@ oox::drawingml::ShapePtr PPTShape::findPlaceholder( const sal_Int32 nMasterPlace
oox::drawingml::ShapePtr PPTShape::findPlaceholderByIndex( const sal_Int32 nIdx, std::vector< oox::drawingml::ShapePtr >& rShapes )
{
oox::drawingml::ShapePtr aShapePtr;
+
+ if( nIdx == -1)
+ return aShapePtr;
+
std::vector< oox::drawingml::ShapePtr >::reverse_iterator aRevIter( rShapes.rbegin() );
while( aRevIter != rShapes.rend() )
{
More information about the Libreoffice-commits
mailing list