diff options
Diffstat (limited to 'oox/source/drawingml')
-rw-r--r-- | oox/source/drawingml/makefile.mk | 1 | ||||
-rw-r--r-- | oox/source/drawingml/shape.cxx | 23 | ||||
-rw-r--r-- | oox/source/drawingml/shapecontext.cxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/shapegroupcontext.cxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/textbodycontext.cxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/textbodyproperties.cxx | 58 | ||||
-rw-r--r-- | oox/source/drawingml/textbodypropertiescontext.cxx | 17 | ||||
-rw-r--r-- | oox/source/drawingml/textcharacterpropertiescontext.cxx | 21 | ||||
-rw-r--r-- | oox/source/drawingml/textparagraph.cxx | 18 |
9 files changed, 125 insertions, 19 deletions
diff --git a/oox/source/drawingml/makefile.mk b/oox/source/drawingml/makefile.mk index 443c30bb16a9..e2d4ea6b8f3d 100644 --- a/oox/source/drawingml/makefile.mk +++ b/oox/source/drawingml/makefile.mk @@ -66,6 +66,7 @@ SLOFILES = \ $(SLO)$/spdefcontext.obj\ $(SLO)$/textbody.obj\ $(SLO)$/textbodycontext.obj\ + $(SLO)$/textbodyproperties.obj\ $(SLO)$/textbodypropertiescontext.obj\ $(SLO)$/textcharacterproperties.obj\ $(SLO)$/textcharacterpropertiescontext.obj\ diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index cab64f11c166..dea4a6a51206 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -47,6 +47,7 @@ #include <basegfx/point/b2dpoint.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <com/sun/star/document/XActionLockable.hpp> using rtl::OUString; using namespace ::oox::core; @@ -89,7 +90,7 @@ Shape::Shape( const sal_Char* pServiceName ) , mpCustomShapePropertiesPtr( new CustomShapeProperties ) , mpMasterTextListStyle( new TextListStyle ) , mnSubType( 0 ) -, mnIndex( 0 ) +, mnSubTypeIndex( -1 ) , mnRotation( 0 ) , mbFlipH( false ) , mbFlipV( false ) @@ -365,6 +366,10 @@ Reference< XShape > Shape::createAndInsert( } rxShapes->add( mxShape ); + Reference< document::XActionLockable > xLockable( mxShape, UNO_QUERY ); + if( xLockable.is() ) + xLockable->addActionLock(); + // sj: removing default text of placeholder objects such as SlideNumberShape or HeaderShape if ( bClearText ) { @@ -409,13 +414,23 @@ Reference< XShape > Shape::createAndInsert( aFillProperties.assignUsed( getFillProperties() ); PropertyMap aShapeProperties; + PropertyMap::const_iterator aShapePropIter; + aShapeProperties.insert( getShapeProperties().begin(), getShapeProperties().end() ); if( mxCreateCallback.get() ) - aShapeProperties.insert( mxCreateCallback->getShapeProperties().begin(), mxCreateCallback->getShapeProperties().end() ); + { + for ( aShapePropIter = mxCreateCallback->getShapeProperties().begin(); + aShapePropIter != mxCreateCallback->getShapeProperties().end(); aShapePropIter++ ) + aShapeProperties[ (*aShapePropIter).first ] = (*aShapePropIter).second; + } // add properties from textbody to shape properties if( mpTextBody.get() ) - aShapeProperties.insert( mpTextBody->getTextProperties().maPropertyMap.begin(), mpTextBody->getTextProperties().maPropertyMap.end() ); + { + for ( aShapePropIter = mpTextBody->getTextProperties().maPropertyMap.begin(); + aShapePropIter != mpTextBody->getTextProperties().maPropertyMap.end(); aShapePropIter++ ) + aShapeProperties[ (*aShapePropIter).first ] = (*aShapePropIter).second; + } // applying properties PropertySet aPropSet( xSet ); @@ -461,6 +476,8 @@ Reference< XShape > Shape::createAndInsert( getTextBody()->insertAt( rFilterBase, xText, xAt, aCharStyleProperties, mpMasterTextListStyle ); } } + if( xLockable.is() ) + xLockable->removeActionLock(); } // use a callback for further processing on the XShape (e.g. charts) diff --git a/oox/source/drawingml/shapecontext.cxx b/oox/source/drawingml/shapecontext.cxx index 4ee664b1c66c..a5a1f16f5935 100644 --- a/oox/source/drawingml/shapecontext.cxx +++ b/oox/source/drawingml/shapecontext.cxx @@ -90,7 +90,7 @@ Reference< XFastContextHandler > ShapeContext::createFastChildContext( sal_Int32 break; case XML_ph: mpShapePtr->setSubType( xAttribs->getOptionalValueToken( XML_type, XML_obj ) ); - mpShapePtr->setIndex( xAttribs->getOptionalValue( XML_idx ).toInt32() ); + mpShapePtr->setSubTypeIndex( xAttribs->getOptionalValue( XML_idx ).toInt32() ); break; // nvSpPr CT_ShapeNonVisual end diff --git a/oox/source/drawingml/shapegroupcontext.cxx b/oox/source/drawingml/shapegroupcontext.cxx index 1b90be3952ab..56ce53767641 100644 --- a/oox/source/drawingml/shapegroupcontext.cxx +++ b/oox/source/drawingml/shapegroupcontext.cxx @@ -75,7 +75,7 @@ Reference< XFastContextHandler > ShapeGroupContext::createFastChildContext( sal_ break; case XML_ph: mpGroupShapePtr->setSubType( xAttribs->getOptionalValueToken( XML_type, FastToken::DONTKNOW ) ); - mpGroupShapePtr->setIndex( xAttribs->getOptionalValue( XML_idx ).toInt32() ); + mpGroupShapePtr->setSubTypeIndex( xAttribs->getOptionalValue( XML_idx ).toInt32() ); break; // nvSpPr CT_ShapeNonVisual end diff --git a/oox/source/drawingml/textbodycontext.cxx b/oox/source/drawingml/textbodycontext.cxx index 9a197ee691bf..8de730849b24 100644 --- a/oox/source/drawingml/textbodycontext.cxx +++ b/oox/source/drawingml/textbodycontext.cxx @@ -109,7 +109,7 @@ Reference< XFastContextHandler > TextParagraphContext::createFastChildContext( s xRet.set( new TextParagraphPropertiesContext( *this, xAttribs, mrParagraph.getProperties() ) ); break; case NMSP_DRAWINGML|XML_endParaRPr: - xRet.set( new TextParagraphPropertiesContext( *this, xAttribs, mrParagraph.getEndProperties() ) ); + xRet.set( new TextCharacterPropertiesContext( *this, xAttribs, mrParagraph.getEndProperties() ) ); break; } diff --git a/oox/source/drawingml/textbodyproperties.cxx b/oox/source/drawingml/textbodyproperties.cxx new file mode 100644 index 000000000000..afd4766b0106 --- /dev/null +++ b/oox/source/drawingml/textbodyproperties.cxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: textbodyproperties.cxx,v $ + * $Revision: 1.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "oox/drawingml/textbodyproperties.hxx" +#include <com/sun/star/text/WritingMode.hpp> +#include "properties.hxx" +#include "tokens.hxx" + +namespace oox { +namespace drawingml { + +// ============================================================================ + +TextBodyProperties::TextBodyProperties() +{ +} + +void TextBodyProperties::pushToPropMap( PropertyMap& rPropMap ) const +{ + rPropMap.insert( maPropertyMap.begin(), maPropertyMap.end() ); + + // #160799# fake different vertical text modes by top-bottom writing mode + if( moVert.get( XML_horz ) != XML_horz ) + rPropMap[ PROP_TextWritingMode ] <<= ::com::sun::star::text::WritingMode_TB_RL; +} + +// ============================================================================ + +} // namespace drawingml +} // namespace oox + diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx index 291af2687149..ec605a3adadd 100644 --- a/oox/source/drawingml/textbodypropertiescontext.cxx +++ b/oox/source/drawingml/textbodypropertiescontext.cxx @@ -28,6 +28,8 @@ #include "oox/drawingml/textbodypropertiescontext.hxx" #include <com/sun/star/text/ControlCharacter.hpp> +#include <com/sun/star/drawing/TextVerticalAdjust.hpp> +#include <com/sun/star/drawing/TextHorizontalAdjust.hpp> #include "oox/drawingml/textbodyproperties.hxx" #include "oox/drawingml/drawingmltypes.hxx" #include "oox/helper/attributelist.hxx" @@ -38,6 +40,7 @@ using ::rtl::OUString; using namespace ::oox::core; +using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::text; using namespace ::com::sun::star::xml::sax; @@ -56,7 +59,7 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler& rParent, // ST_TextWrappingType sal_Int32 nWrappingType = aAttribs.getToken( XML_wrap, XML_square ); - mrTextBodyProp.maPropertyMap[ PROP_TextWordWrap ] <<= (nWrappingType == XML_square); + mrTextBodyProp.maPropertyMap[ PROP_TextWordWrap ] <<= static_cast< sal_Bool >( nWrappingType == XML_square ); // ST_Coordinate OUString sValue; @@ -78,7 +81,17 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler& rParent, // ST_TextAnchoringType -// sal_Int32 nAnchoringType = xAttributes->getOptionalValueToken( XML_anchor, XML_t ); + drawing::TextVerticalAdjust eVA( drawing::TextVerticalAdjust_TOP ); + switch( xAttributes->getOptionalValueToken( XML_anchor, XML_t ) ) + { + case XML_b : eVA = drawing::TextVerticalAdjust_BOTTOM; break; + case XML_dist : + case XML_just : + case XML_ctr : eVA = drawing::TextVerticalAdjust_CENTER; break; + default: + case XML_t : eVA = drawing::TextVerticalAdjust_TOP; break; + } + mrTextBodyProp.maPropertyMap[ PROP_TextVerticalAdjust ] <<= eVA; // bool bAnchorCenter = aAttribs.getBool( XML_anchorCtr, false ); diff --git a/oox/source/drawingml/textcharacterpropertiescontext.cxx b/oox/source/drawingml/textcharacterpropertiescontext.cxx index 6797b8336c02..cfba04a7b44b 100644 --- a/oox/source/drawingml/textcharacterpropertiescontext.cxx +++ b/oox/source/drawingml/textcharacterpropertiescontext.cxx @@ -56,13 +56,20 @@ TextCharacterPropertiesContext::TextCharacterPropertiesContext( , mrTextCharacterProperties( rTextCharacterProperties ) { AttributeList aAttribs( rXAttributes ); - mrTextCharacterProperties.moLang = aAttribs.getString( XML_lang ); - mrTextCharacterProperties.moHeight = aAttribs.getInteger( XML_sz ); - mrTextCharacterProperties.moUnderline = aAttribs.getToken( XML_u ); - mrTextCharacterProperties.moStrikeout = aAttribs.getToken( XML_strike ); -// mrTextCharacterProperties.moCaseMap = aAttribs.getToken( XML_cap ); - mrTextCharacterProperties.moBold = aAttribs.getBool( XML_b ); - mrTextCharacterProperties.moItalic = aAttribs.getBool( XML_i ); + if ( aAttribs.hasAttribute( XML_lang ) ) + mrTextCharacterProperties.moLang = aAttribs.getString( XML_lang ); + if ( aAttribs.hasAttribute( XML_sz ) ) + mrTextCharacterProperties.moHeight = aAttribs.getInteger( XML_sz ); + if ( aAttribs.hasAttribute( XML_u ) ) + mrTextCharacterProperties.moUnderline = aAttribs.getToken( XML_u ); + if ( aAttribs.hasAttribute( XML_strike ) ) + mrTextCharacterProperties.moStrikeout = aAttribs.getToken( XML_strike ); + +// mrTextCharacterProperties.moCaseMap = aAttribs.getToken( XML_cap ); + if ( aAttribs.hasAttribute( XML_b ) ) + mrTextCharacterProperties.moBold = aAttribs.getBool( XML_b ); + if ( aAttribs.hasAttribute( XML_i ) ) + mrTextCharacterProperties.moItalic = aAttribs.getBool( XML_i ); // TODO /* todo: we need to be able to iterate over the XFastAttributes diff --git a/oox/source/drawingml/textparagraph.cxx b/oox/source/drawingml/textparagraph.cxx index 1ff78541243e..a4bef1a5013c 100644 --- a/oox/source/drawingml/textparagraph.cxx +++ b/oox/source/drawingml/textparagraph.cxx @@ -29,6 +29,7 @@ #include "oox/drawingml/drawingmltypes.hxx" #include <rtl/ustring.hxx> +#include "oox/helper/propertyset.hxx" #include <com/sun/star/text/XText.hpp> #include <com/sun/star/text/XTextCursor.hpp> #include <com/sun/star/text/ControlCharacter.hpp> @@ -78,11 +79,21 @@ void TextParagraph::insertAt( xText->insertControlCharacter( xStart, ControlCharacter::APPEND_PARAGRAPH, sal_False ); xAt->gotoEnd( sal_True ); } + if ( maRuns.begin() == maRuns.end() ) + { + PropertySet aPropSet( xStart ); - for( TextRunVector::const_iterator aIt = maRuns.begin(), aEnd = maRuns.end(); aIt != aEnd; ++aIt ) + TextCharacterProperties aTextCharacterProps( aTextCharacterStyle ); + aTextCharacterProps.assignUsed( maEndProperties ); + aTextCharacterProps.pushToPropSet( aPropSet, rFilterBase ); + } + else { - (*aIt)->insertAt( rFilterBase, xText, xAt, aTextCharacterStyle ); - nParagraphSize += (*aIt)->getText().getLength(); + for( TextRunVector::const_iterator aIt = maRuns.begin(), aEnd = maRuns.end(); aIt != aEnd; ++aIt ) + { + (*aIt)->insertAt( rFilterBase, xText, xAt, aTextCharacterStyle ); + nParagraphSize += (*aIt)->getText().getLength(); + } } xAt->gotoEnd( sal_True ); @@ -94,7 +105,6 @@ void TextParagraph::insertAt( pTextParagraphStyle->pushToPropSet( rFilterBase, xProps, aioBulletList, NULL, sal_False, fCharacterSize ); fCharacterSize = pTextParagraphStyle->getCharHeightPoints( 18 ); } - maProperties.pushToPropSet( rFilterBase, xProps, aioBulletList, &pTextParagraphStyle->getBulletList(), sal_True, fCharacterSize ); // empty paragraphs do not have bullets in ppt |