fix regression of 2155c4c0af

- do not drop the master shapes anymore, but rather hide them
  - it is possible to have shapes with 0x0 geometry in slides,
    these inherit proper geometry from master slide shapes - so
    when we dropped the shapes, the geometry info was lost
This commit is contained in:
Radek Doulik 2011-08-24 14:23:47 +02:00
parent 4482fb3180
commit 9c2ae3f245
5 changed files with 35 additions and 5 deletions

View file

@ -125,6 +125,7 @@ public:
::rtl::OUString getId() { return msId; }
void setHidden( sal_Bool bHidden ) { mbHidden = bHidden; }
sal_Bool getHidden() const { return mbHidden; };
void setHiddenMasterShape( sal_Bool bHiddenMasterShape ) { mbHiddenMasterShape = bHiddenMasterShape; }
void setSubType( sal_Int32 nSubType ) { mnSubType = nSubType; }
sal_Int32 getSubType() const { return mnSubType; }
void setSubTypeIndex( sal_uInt32 nSubTypeIndex ) { mnSubTypeIndex = nSubTypeIndex; }
@ -254,6 +255,9 @@ private:
sal_Bool mbFlipH;
sal_Bool mbFlipV;
sal_Bool mbHidden;
sal_Bool mbHiddenMasterShape; // master shapes can be hidden in layout slides
// we need separate flag because we don't want
// to propagate it when applying reference shape
};
// ---------------------------------------------------------------------

View file

@ -111,7 +111,7 @@ public:
oox::drawingml::TextListStylePtr getOtherTextStyle() const { return maOtherTextStylePtr; }
oox::drawingml::ShapePtr getShapes() { return maShapesPtr; }
void dropShapes() { maShapesPtr->dropChildren(); }
void hideShapesAsMasterShapes();
::std::list< boost::shared_ptr< TimeNode > >& getTimeNodeList() { return maTimeNodeList; }
oox::ppt::HeaderFooter& getHeaderFooter(){ return maHeaderFooter; };

View file

@ -90,6 +90,7 @@ Shape::Shape( const sal_Char* pServiceName )
, mbFlipH( false )
, mbFlipV( false )
, mbHidden( false )
, mbHiddenMasterShape( false )
{
if ( pServiceName )
msServiceName = OUString::createFromAscii( pServiceName );
@ -122,6 +123,7 @@ Shape::Shape( const ShapePtr& pSourceShape )
, mbFlipH( pSourceShape->mbFlipH )
, mbFlipV( pSourceShape->mbFlipV )
, mbHidden( pSourceShape->mbHidden )
, mbHiddenMasterShape( pSourceShape->mbHiddenMasterShape )
{}
@ -203,6 +205,8 @@ void Shape::addShape(
const awt::Rectangle* pShapeRect,
ShapeIdMap* pShapeMap )
{
OSL_TRACE("Shape::addShape id: %s", rtl::OUStringToOString(msId, RTL_TEXTENCODING_UTF8 ).getStr());
try
{
rtl::OUString sServiceName( msServiceName );
@ -308,6 +312,8 @@ Reference< XShape > Shape::createAndInsert(
sal_Bool bClearText,
basegfx::B2DHomMatrix& aParentTransformation )
{
OSL_TRACE("Shape::createAndInsert id: %s", rtl::OUStringToOString(msId, RTL_TEXTENCODING_UTF8 ).getStr());
awt::Rectangle aShapeRectHmm( maPosition.X / 360, maPosition.Y / 360, maSize.Width / 360, maSize.Height / 360 );
OUString aServiceName = finalizeServiceName( rFilterBase, rServiceName, aShapeRectHmm );
@ -431,10 +437,11 @@ Reference< XShape > Shape::createAndInsert(
}
rxShapes->add( mxShape );
if ( mbHidden )
if ( mbHidden || mbHiddenMasterShape )
{
const OUString sHidden( CREATE_OUSTRING( "Visible" ) );
xSet->setPropertyValue( sHidden, Any( !mbHidden ) );
OSL_TRACE("invisible shape with id: %s", rtl::OUStringToOString(msId, RTL_TEXTENCODING_UTF8 ).getStr());
const OUString sVisible( CREATE_OUSTRING( "Visible" ) );
xSet->setPropertyValue( sVisible, Any( sal_False ) );
}
Reference< document::XActionLockable > xLockable( mxShape, UNO_QUERY );

View file

@ -70,7 +70,7 @@ ContextHandlerRef LayoutFragmentHandler::onCreateContext( sal_Int32 aElementToke
OptValue< bool > aShowMasterShapes = rAttribs.getBool( XML_showMasterSp );
if( aShowMasterShapes.has() && !aShowMasterShapes.get() ) {
mpSlidePersistPtr->dropShapes();
mpSlidePersistPtr->hideShapesAsMasterShapes();
}
break;
}

View file

@ -311,6 +311,25 @@ void SlidePersist::applyTextStyles( const XmlFilterBase& rFilterBase )
}
}
void SlidePersist::hideShapesAsMasterShapes()
{
std::vector< oox::drawingml::ShapePtr >& rShapes( maShapesPtr->getChildren() );
std::vector< oox::drawingml::ShapePtr >::iterator aShapesIter( rShapes.begin() );
while( aShapesIter != rShapes.end() )
{
while( aShapesIter != rShapes.end() )
{
std::vector< oox::drawingml::ShapePtr >& rChildren( (*aShapesIter++)->getChildren() );
std::vector< oox::drawingml::ShapePtr >::iterator aChildIter( rChildren.begin() );
while( aChildIter != rChildren.end() ) {
PPTShape* pPPTShape = dynamic_cast< PPTShape* >( (*aChildIter++).get() );
OSL_TRACE("hide shape with id: %s", rtl::OUStringToOString(pPPTShape->getId(), RTL_TEXTENCODING_UTF8 ).getStr());
pPPTShape->setHiddenMasterShape( true );
}
}
}
}
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */