writerfilter08ooo330: merged OOO330_m2

This commit is contained in:
Henning Brinkmann 2010-07-28 17:27:27 +02:00
commit 0ec004ad4c
14 changed files with 147 additions and 129 deletions

View file

@ -7122,6 +7122,10 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
PPTCharPropSet* pCurrent = (PPTCharPropSet*)aCharPropList.GetObject( nIdx );
sal_Int32 nNextStringLen = pCurrent->maString.Len();
DBG_ASSERT( pFE->pField1, "missing field!" );
if (!pFE->pField1)
break;
const SvxURLField* pField = (const SvxURLField*)pFE->pField1->GetField();
if ( pCurrent->mpFieldItem )

View file

@ -133,6 +133,8 @@ public:
OptValue< GeomRect >& getTextRect(){ return maTextRect; };
std::vector< Path2D >& getPath2DList(){ return maPath2DList; };
std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >& getSegments(){ return maSegments; };
void setMirroredX( sal_Bool bMirroredX ) { mbMirroredX = bMirroredX; };
void setMirroredY( sal_Bool bMirroredY ) { mbMirroredY = bMirroredY; };
double getValue( const std::vector< CustomShapeGuide >&, sal_uInt32 nIndex ) const;
static sal_Int32 SetCustomShapeGuideValue( std::vector< CustomShapeGuide >& rGuideList, const CustomShapeGuide& rGuide );
@ -150,6 +152,8 @@ private:
std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >
maSegments;
sal_Bool mbMirroredX;
sal_Bool mbMirroredY;
};
} }

View file

@ -127,6 +127,7 @@ public:
::rtl::OUString getName( ) { return msName; }
void setId( const rtl::OUString& rId ) { msId = rId; }
void setHidden( sal_Bool bHidden ) { mbHidden = bHidden; }
sal_Bool getHidden() const { return mbHidden; };
void setSubType( sal_Int32 nSubType ) { mnSubType = nSubType; }
sal_Int32 getSubType() const { return mnSubType; }
void setSubTypeIndex( sal_uInt32 nSubTypeIndex ) { mnSubTypeIndex = nSubTypeIndex; }

View file

@ -61,15 +61,10 @@ public:
ShapeLocation getShapeLocation() const { return meShapeLocation; };
sal_Bool isReferenced() const { return mbReferenced; };
void setReferenced( sal_Bool bReferenced ){ mbReferenced = bReferenced; };
void setPlaceholder( oox::drawingml::ShapePtr pPlaceholder ) { mpPlaceholder = pPlaceholder; }
static oox::drawingml::ShapePtr findPlaceholder( const sal_Int32 nMasterPlaceholder, std::vector< oox::drawingml::ShapePtr >& rShapes );
static oox::drawingml::ShapePtr findPlaceholderByIndex( const sal_Int32 nIdx, std::vector< oox::drawingml::ShapePtr >& rShapes );
static oox::drawingml::ShapePtr findPlaceholder( sal_Int32 nFirstPlaceholder, sal_Int32 nSecondPlaceholder, std::vector< oox::drawingml::ShapePtr >& rShapes );
protected:
oox::drawingml::ShapePtr mpPlaceholder;
};
} }

View file

@ -50,6 +50,8 @@ using namespace ::com::sun::star::drawing;
namespace oox { namespace drawingml {
CustomShapeProperties::CustomShapeProperties()
: mbMirroredX ( sal_False )
, mbMirroredY ( sal_False )
{
}
CustomShapeProperties::~CustomShapeProperties()
@ -149,7 +151,8 @@ void CustomShapeProperties::pushToPropSet( const ::oox::core::FilterBase& /* rFi
sal_uInt32 i;
PropertyMap aPropertyMap;
aPropertyMap[ PROP_Type ] <<= CREATE_OUSTRING( "non-primitive" );
aPropertyMap[ PROP_MirroredX ] <<= Any( mbMirroredX );
aPropertyMap[ PROP_MirroredY ] <<= Any( mbMirroredY );
awt::Size aSize( xShape->getSize() );
awt::Rectangle aViewBox( 0, 0, aSize.Width * 360, aSize.Height * 360 );
if ( maPath2DList.size() )

View file

@ -260,6 +260,7 @@ Reference< XShape > Shape::createAndInsert(
OUString aServiceName = rServiceName;
if( mxCreateCallback.get() )
aServiceName = mxCreateCallback->onCreateXShape( aServiceName, awt::Rectangle( aPosition.X / 360, aPosition.Y / 360, aSize.Width / 360, aSize.Height / 360 ) );
sal_Bool bIsCustomShape = aServiceName == OUString::createFromAscii( "com.sun.star.drawing.CustomShape" );
basegfx::B2DHomMatrix aTransformation;
if( aSize.Width != 1 || aSize.Height != 1)
@ -279,7 +280,7 @@ Reference< XShape > Shape::createAndInsert(
// center object at origin
aTransformation.translate( -aCenter.getX(), -aCenter.getY() );
if( mbFlipH || mbFlipV)
if( !bIsCustomShape && ( mbFlipH || mbFlipV ) )
{
// mirror around object's center
aTransformation.scale( mbFlipH ? -1.0 : 1.0, mbFlipV ? -1.0 : 1.0 );
@ -374,8 +375,8 @@ Reference< XShape > Shape::createAndInsert(
if ( mbHidden )
{
const OUString sHidden( CREATE_OUSTRING( "NumberingLevel" ) );
xSet->setPropertyValue( sHidden, Any( mbHidden ) );
const OUString sHidden( CREATE_OUSTRING( "Visible" ) );
xSet->setPropertyValue( sHidden, Any( !mbHidden ) );
}
Reference< document::XActionLockable > xLockable( mxShape, UNO_QUERY );
@ -469,8 +470,14 @@ Reference< XShape > Shape::createAndInsert(
if( aServiceName != OUString::createFromAscii( "com.sun.star.drawing.GroupShape" ) )
aPropSet.setProperties( aShapeProperties );
if( aServiceName == OUString::createFromAscii( "com.sun.star.drawing.CustomShape" ) )
if( bIsCustomShape )
{
if ( mbFlipH )
mpCustomShapePropertiesPtr->setMirroredX( sal_True );
if ( mbFlipV )
mpCustomShapePropertiesPtr->setMirroredY( sal_True );
mpCustomShapePropertiesPtr->pushToPropSet( rFilterBase, xSet, mxShape );
}
// in some cases, we don't have any text body.
if( getTextBody() )

View file

@ -29,6 +29,7 @@
#include <com/sun/star/beans/XMultiPropertySet.hpp>
#include <com/sun/star/container/XNamed.hpp>
#include "oox/helper/attributelist.hxx"
#include "oox/drawingml/shapegroupcontext.hxx"
#include "oox/drawingml/connectorshapecontext.hxx"
#include "oox/drawingml/graphicshapecontext.hxx"
@ -70,9 +71,13 @@ Reference< XFastContextHandler > ShapeGroupContext::createFastChildContext( sal_
switch( getToken( aElementToken ) )
{
case XML_cNvPr:
{
AttributeList aAttribs( xAttribs );
mpGroupShapePtr->setHidden( aAttribs.getBool( XML_hidden, false ) );
mpGroupShapePtr->setId( xAttribs->getOptionalValue( XML_id ) );
mpGroupShapePtr->setName( xAttribs->getOptionalValue( XML_name ) );
break;
}
case XML_ph:
mpGroupShapePtr->setSubType( xAttribs->getOptionalValueToken( XML_type, FastToken::DONTKNOW ) );
mpGroupShapePtr->setSubTypeIndex( xAttribs->getOptionalValue( XML_idx ).toInt32() );

View file

@ -33,8 +33,8 @@ TextListStyle::TextListStyle()
{
for ( int i = 0; i < 9; i++ )
{
maListStyle.push_back( TextParagraphPropertiesPtr( new TextParagraphProperties ) );
maAggregationListStyle.push_back( TextParagraphPropertiesPtr( new TextParagraphProperties ) );
maListStyle.push_back( TextParagraphPropertiesPtr( new TextParagraphProperties() ) );
maAggregationListStyle.push_back( TextParagraphPropertiesPtr( new TextParagraphProperties() ) );
}
}

View file

@ -169,6 +169,7 @@ 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() );
@ -182,8 +183,7 @@ void PPTShape::addShape(
aMasterTextListStyle = pNewTextListStyle;
}
}
*/
if ( sServiceName.getLength() )
{
if ( !aMasterTextListStyle.get() )

View file

@ -31,6 +31,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/container/XNamed.hpp>
#include "oox/helper/attributelist.hxx"
#include "oox/ppt/pptshape.hxx"
#include "oox/ppt/pptshapecontext.hxx"
#include "oox/ppt/pptshapepropertiescontext.hxx"
@ -100,124 +101,112 @@ Reference< XFastContextHandler > PPTShapeContext::createFastChildContext( sal_In
switch( aElementToken )
{
// nvSpPr CT_ShapeNonVisual begin
// case NMSP_PPT|XML_drElemPr:
// break;
case NMSP_PPT|XML_cNvPr:
mpShapePtr->setId( xAttribs->getOptionalValue( XML_id ) );
mpShapePtr->setName( xAttribs->getOptionalValue( XML_name ) );
break;
case NMSP_PPT|XML_ph:
{
sal_Int32 nSubType( xAttribs->getOptionalValueToken( XML_type, XML_obj ) );
mpShapePtr->setSubType( nSubType );
OUString sIdx( xAttribs->getOptionalValue( XML_idx ) );
sal_Bool bHasIdx = sIdx.getLength() > 0;
sal_Int32 nIdx = sIdx.toInt32();
mpShapePtr->setSubTypeIndex( nIdx );
if ( nSubType || bHasIdx )
// nvSpPr CT_ShapeNonVisual begin
// case NMSP_PPT|XML_drElemPr:
// break;
case NMSP_PPT|XML_cNvPr:
{
PPTShape* pPPTShapePtr = dynamic_cast< PPTShape* >( mpShapePtr.get() );
if ( pPPTShapePtr )
{
oox::ppt::ShapeLocation eShapeLocation = pPPTShapePtr->getShapeLocation();
oox::drawingml::ShapePtr pPlaceholder;
if ( bHasIdx && eShapeLocation == Slide )
{
// TODO: use id to shape map
SlidePersistPtr pMasterPersist( mpSlidePersistPtr->getMasterPersist() );
if ( pMasterPersist.get() )
pPlaceholder = PPTShape::findPlaceholderByIndex( nIdx, pMasterPersist->getShapes()->getChildren() );
}
if ( !pPlaceholder.get() && ( ( eShapeLocation == Slide ) || ( eShapeLocation == Layout ) ) )
{
// inheriting properties from placeholder objects by cloning shape
sal_Int32 nFirstPlaceholder = 0;
sal_Int32 nSecondPlaceholder = 0;
switch( nSubType )
{
case XML_ctrTitle : // slide/layout
nFirstPlaceholder = XML_ctrTitle;
nSecondPlaceholder = XML_title;
break;
case XML_subTitle : // slide/layout
nFirstPlaceholder = XML_subTitle;
nSecondPlaceholder = XML_title;
break;
case XML_obj : // slide/layout
nFirstPlaceholder = XML_obj;
nSecondPlaceholder = XML_body;
break;
case XML_dt : // slide/layout/master/notes/notesmaster/handoutmaster
case XML_sldNum : // slide/layout/master/notes/notesmaster/handoutmaster
case XML_ftr : // slide/layout/master/notes/notesmaster/handoutmaster
case XML_hdr : // notes/notesmaster/handoutmaster
case XML_body : // slide/layout/master/notes/notesmaster
case XML_title : // slide/layout/master/
case XML_chart : // slide/layout
case XML_tbl : // slide/layout
case XML_clipArt : // slide/layout
case XML_dgm : // slide/layout
case XML_media : // slide/layout
case XML_sldImg : // notes/notesmaster
case XML_pic : // slide/layout
nFirstPlaceholder = nSubType;
default:
break;
}
if ( nFirstPlaceholder )
{
if ( eShapeLocation == Layout ) // for layout objects the referenced object can be found within the same shape tree
pPlaceholder = findPlaceholder( nFirstPlaceholder, nSecondPlaceholder, -1, mpSlidePersistPtr->getShapes()->getChildren() );
else if ( eShapeLocation == Slide ) // normal slide shapes have to search within the corresponding master tree for referenced objects
{
SlidePersistPtr pMasterPersist( mpSlidePersistPtr->getMasterPersist() );
if ( pMasterPersist.get() )
pPlaceholder = findPlaceholder( nFirstPlaceholder, nSecondPlaceholder,
pPPTShapePtr->getSubTypeIndex(), pMasterPersist->getShapes()->getChildren() );
}
if ( pPlaceholder.get() )
{
mpShapePtr->applyShapeReference( *pPlaceholder.get() );
PPTShape* pPPTShape = dynamic_cast< PPTShape* >( pPlaceholder.get() );
if ( pPPTShape )
pPPTShape->setReferenced( sal_True );
}
}
}
if ( pPlaceholder.get() )
{
mpShapePtr->applyShapeReference( *pPlaceholder.get() );
PPTShape* pPPTShape = dynamic_cast< PPTShape* >( pPlaceholder.get() );
if ( pPPTShape )
pPPTShape->setReferenced( sal_True );
pPPTShapePtr->setPlaceholder( pPlaceholder );
}
}
AttributeList aAttribs( xAttribs );
mpShapePtr->setHidden( aAttribs.getBool( XML_hidden, false ) );
mpShapePtr->setId( xAttribs->getOptionalValue( XML_id ) );
mpShapePtr->setName( xAttribs->getOptionalValue( XML_name ) );
break;
}
break;
}
// nvSpPr CT_ShapeNonVisual end
case NMSP_PPT|XML_ph:
{
sal_Int32 nSubType( xAttribs->getOptionalValueToken( XML_type, XML_obj ) );
mpShapePtr->setSubType( nSubType );
mpShapePtr->setSubTypeIndex( xAttribs->getOptionalValue( XML_idx ).toInt32() );
if ( nSubType )
{
PPTShape* pPPTShapePtr = dynamic_cast< PPTShape* >( mpShapePtr.get() );
if ( pPPTShapePtr )
{
oox::ppt::ShapeLocation eShapeLocation = pPPTShapePtr->getShapeLocation();
if ( ( eShapeLocation == Slide ) || ( eShapeLocation == Layout ) )
{
// inheriting properties from placeholder objects by cloning shape
sal_Int32 nFirstPlaceholder = 0;
sal_Int32 nSecondPlaceholder = 0;
switch( nSubType )
{
case XML_ctrTitle : // slide/layout
nFirstPlaceholder = XML_ctrTitle;
nSecondPlaceholder = XML_title;
break;
case NMSP_PPT|XML_spPr:
xRet = new PPTShapePropertiesContext( *this, *mpShapePtr );
break;
case XML_subTitle : // slide/layout
nFirstPlaceholder = XML_subTitle;
nSecondPlaceholder = XML_title;
break;
case NMSP_PPT|XML_style:
xRet = new oox::drawingml::ShapeStyleContext( *this, *mpShapePtr );
break;
case XML_obj : // slide/layout
nFirstPlaceholder = XML_obj;
nSecondPlaceholder = XML_body;
break;
case NMSP_PPT|XML_txBody:
{
oox::drawingml::TextBodyPtr xTextBody( new oox::drawingml::TextBody );
xTextBody->getTextProperties().maPropertyMap[ PROP_FontIndependentLineSpacing ] <<= static_cast< sal_Bool >( sal_True );
mpShapePtr->setTextBody( xTextBody );
xRet = new oox::drawingml::TextBodyContext( *this, *xTextBody );
break;
}
case XML_dt : // slide/layout/master/notes/notesmaster/handoutmaster
case XML_sldNum : // slide/layout/master/notes/notesmaster/handoutmaster
case XML_ftr : // slide/layout/master/notes/notesmaster/handoutmaster
case XML_hdr : // notes/notesmaster/handoutmaster
case XML_body : // slide/layout/master/notes/notesmaster
case XML_title : // slide/layout/master/
case XML_chart : // slide/layout
case XML_tbl : // slide/layout
case XML_clipArt : // slide/layout
case XML_dgm : // slide/layout
case XML_media : // slide/layout
case XML_sldImg : // notes/notesmaster
case XML_pic : // slide/layout
nFirstPlaceholder = nSubType;
default:
break;
}
if ( nFirstPlaceholder )
{
oox::drawingml::ShapePtr pPlaceholder;
if ( eShapeLocation == Layout ) // for layout objects the referenced object can be found within the same shape tree
pPlaceholder = findPlaceholder( nFirstPlaceholder, nSecondPlaceholder, -1, mpSlidePersistPtr->getShapes()->getChildren() );
else if ( eShapeLocation == Slide ) // normal slide shapes have to search within the corresponding master tree for referenced objects
{
SlidePersistPtr pMasterPersist( mpSlidePersistPtr->getMasterPersist() );
if ( pMasterPersist.get() )
pPlaceholder = findPlaceholder( nFirstPlaceholder, nSecondPlaceholder,
pPPTShapePtr->getSubTypeIndex(), pMasterPersist->getShapes()->getChildren() );
}
if ( pPlaceholder.get() )
{
mpShapePtr->applyShapeReference( *pPlaceholder.get() );
PPTShape* pPPTShape = dynamic_cast< PPTShape* >( pPlaceholder.get() );
if ( pPPTShape )
pPPTShape->setReferenced( sal_True );
}
}
}
}
}
break;
}
// nvSpPr CT_ShapeNonVisual end
case NMSP_PPT|XML_spPr:
xRet = new PPTShapePropertiesContext( *this, *mpShapePtr );
break;
case NMSP_PPT|XML_style:
xRet = new oox::drawingml::ShapeStyleContext( *this, *mpShapePtr );
break;
case NMSP_PPT|XML_txBody:
{
oox::drawingml::TextBodyPtr xTextBody( new oox::drawingml::TextBody );
xTextBody->getTextProperties().maPropertyMap[ PROP_FontIndependentLineSpacing ] <<= static_cast< sal_Bool >( sal_True );
mpShapePtr->setTextBody( xTextBody );
xRet = new oox::drawingml::TextBodyContext( *this, *xTextBody );
break;
}
}
if( !xRet.is() )

View file

@ -29,6 +29,7 @@
#include <com/sun/star/beans/XMultiPropertySet.hpp>
#include <com/sun/star/container/XNamed.hpp>
#include "oox/helper/attributelist.hxx"
#include "oox/ppt/pptshape.hxx"
#include "oox/ppt/pptshapecontext.hxx"
#include "oox/ppt/pptshapegroupcontext.hxx"
@ -71,9 +72,13 @@ Reference< XFastContextHandler > PPTShapeGroupContext::createFastChildContext( s
switch( aElementToken )
{
case NMSP_PPT|XML_cNvPr:
{
AttributeList aAttribs( xAttribs );
mpGroupShapePtr->setHidden( aAttribs.getBool( XML_hidden, false ) );
mpGroupShapePtr->setId( xAttribs->getOptionalValue( XML_id ) );
mpGroupShapePtr->setName( xAttribs->getOptionalValue( XML_name ) );
break;
}
case NMSP_PPT|XML_ph:
mpGroupShapePtr->setSubType( xAttribs->getOptionalValueToken( XML_type, FastToken::DONTKNOW ) );
mpGroupShapePtr->setSubTypeIndex( xAttribs->getOptionalValue( XML_idx ).toInt32() );

View file

@ -75,8 +75,12 @@ Reference< XFastContextHandler > SlideMasterTextStylesContext::createFastChildCo
break;
}
}
if ( aTextListStylePtr )
if ( aTextListStylePtr ) // sj: the master list style is the last instance of from where properties
{ // are obtained. i got some documents without having the textsize set at
for ( int i = 0; i < 9; i++ ) // any point, the master reference application is using 18pt then
aTextListStylePtr->getListStyle()[ i ]->getTextCharacterProperties().moHeight = 1800;
xRet.set( new oox::drawingml::TextListStyleContext( *this, *aTextListStylePtr ) );
}
if( !xRet.is() )
xRet.set( this );

View file

@ -148,7 +148,6 @@ void SlidePersist::createXShapes( const XmlFilterBase& rFilterBase )
pPPTShape->addShape( rFilterBase, *this, getTheme().get(), xShapes, 0, &getShapeMap() );
else
(*aChildIter)->addShape( rFilterBase, getTheme().get(), xShapes, 0, &getShapeMap() );
aChildIter++;
}
}

View file

@ -259,6 +259,8 @@ MaxFieldCount
MaxTextLen
MediaType
MinorTickmarks
MirroredX
MirroredY
MissingValueTreatment
Model
ModifyPasswordHash