From 56b0b2cbc0dc6538617e3f3b1005e4723ca227b0 Mon Sep 17 00:00:00 2001 From: Noel Power Date: Thu, 9 Aug 2012 11:15:43 +0100 Subject: misc comment import/export fixes a) fix vmldrawing.vml for xlsx export ( changed from frame to textbox, added support for shadow element with attributes, shadow color, shadow obscured ) b) use proper fillcolor attribute c) detect whether note/comment is shown on import d) export state of note ( shown/hidden ) text position still not perfect, we still are missing some attributes to control that. Change-Id: I59b446175217479ce7960287aa540df8c6b2b1ea --- filter/source/msfilter/eschesdo.cxx | 10 +++++++++- oox/source/export/vmlexport.cxx | 31 +++++++++++++++++++++++++++++-- sc/source/filter/oox/commentsbuffer.cxx | 3 +-- sc/source/filter/xcl97/xcl97rec.cxx | 15 ++++++++++++++- 4 files changed, 53 insertions(+), 6 deletions(-) diff --git a/filter/source/msfilter/eschesdo.cxx b/filter/source/msfilter/eschesdo.cxx index bbd63d51d0f4..32d5680442b2 100644 --- a/filter/source/msfilter/eschesdo.cxx +++ b/filter/source/msfilter/eschesdo.cxx @@ -208,7 +208,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj, if( ( rObj.ImplGetPropertyValue( ::rtl::OUString( "IsFontwork" ) ) && ::cppu::any2bool( rObj.GetUsrAny() ) ) || - rObj.GetType().EqualsAscii( "drawing.Measure" ) || rObj.GetType().EqualsAscii( "drawing.Caption" ) ) + rObj.GetType().EqualsAscii( "drawing.Measure" ) ) { rObj.SetType( String( RTL_CONSTASCII_STRINGPARAM( "drawing.dontknow" ), @@ -614,6 +614,14 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj, if ( aPropOpt.CreateGraphicProperties( rObj.mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Bitmap" ) ), sal_False ) ) aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 ); } + else if ( rObj.GetType().EqualsAscii( "drawing.Caption" )) + { + rObj.SetAngle( 0 ); + mpEscherEx->OpenContainer( ESCHER_SpContainer ); + ADD_SHAPE( ESCHER_ShpInst_TextBox, 0xa00 ); + if ( aPropOpt.CreateGraphicProperties( rObj.mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "MetaFile" ) ), sal_False ) ) + aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 ); + } else if ( rObj.GetType().EqualsAscii( "drawing.dontknow" )) { rObj.SetAngle( 0 ); diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index 34f080250805..17ff426cff7d 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -516,7 +516,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect } if ( rProps.GetOpt( ESCHER_Prop_fillColor, nValue ) ) - impl_AddColor( pAttrList, XML_color, nValue ); + impl_AddColor( m_pShapeAttrList, XML_fillcolor, nValue ); if ( rProps.GetOpt( ESCHER_Prop_fillBackColor, nValue ) ) impl_AddColor( pAttrList, XML_color2, nValue ); @@ -634,7 +634,34 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect break; case ESCHER_Prop_fHidden: - m_pShapeStyle->append( ";visibility:hidden" ); + if ( !it->nPropValue ) + m_pShapeStyle->append( ";visibility:hidden" ); + break; + case ESCHER_Prop_shadowColor: + case ESCHER_Prop_fshadowObscured: + { + sal_uInt32 nValue = 0; + bool bShadow = false; + bool bObscured = false; + if ( rProps.GetOpt( ESCHER_Prop_fshadowObscured, nValue ) ) + { + bShadow = (( nValue & 0x20002 ) == 0x20002 ); + bObscured = (( nValue & 0x10001 ) == 0x10001 ); + } + if ( bShadow ) + { + sax_fastparser::FastAttributeList *pAttrList = m_pSerializer->createAttrList(); + impl_AddBool( pAttrList, XML_on, bShadow ); + impl_AddBool( pAttrList, XML_obscured, bObscured ); + + if ( rProps.GetOpt( ESCHER_Prop_shadowColor, nValue ) ) + impl_AddColor( pAttrList, XML_color, nValue ); + + m_pSerializer->singleElementNS( XML_v, XML_shadow, XFastAttributeListRef( pAttrList ) ); + bAlreadyWritten[ ESCHER_Prop_fshadowObscured ] = true; + bAlreadyWritten[ ESCHER_Prop_shadowColor ] = true; + } + } break; default: #if OSL_DEBUG_LEVEL > 0 diff --git a/sc/source/filter/oox/commentsbuffer.cxx b/sc/source/filter/oox/commentsbuffer.cxx index 3bbf751f2f84..39d57a0b4988 100644 --- a/sc/source/filter/oox/commentsbuffer.cxx +++ b/sc/source/filter/oox/commentsbuffer.cxx @@ -195,8 +195,7 @@ void Comment::finalizeImport() // position and formatting pNoteShape->convertFormatting( xAnnoShape ); // visibility - const ::oox::vml::ClientData* pClientData = pNoteShape->getClientData(); - xAnno->setIsVisible( pClientData && pClientData->mbVisible ); + bVisible = pNoteShape->getTypeModel().mbVisible; } } break; diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 4e7e4af970c9..6b886bfd6602 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -566,7 +566,20 @@ VmlCommentExporter::VmlCommentExporter( sax_fastparser::FSHelperPtr p, ScAddress void VmlCommentExporter::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect ) { lcl_FillProps( rProps, mpCaption, mbVisible ); - rProps.AddOpt( ESCHER_Prop_fHidden, 1 ); // bool field + rProps.AddOpt( ESCHER_Prop_fHidden, mbVisible ); // bool field + + // shadow property value for comment ( set in lcl_FillProps [*] ) has been + // overwritten by new value ( 0x20000 ) in the generic part of the export + // ( see EscherPropertyContainer::CreateShadowProperties ) + // Safer option here is to just force the needed value here for oox vml + // export alone ( and avoid potential problems with binary export ) + // #TODO investigate value of ESCHER_Prop_fshadowObscured generally + // in binary export ( if indeed this value is good for binary export ) + // we can change the heuristics and/or initialisation path and get + // rid of line below. + // [*] lcl_FillProps seems to be called twice when exporting to xlsx + // once from XclObjComment::ProcessEscherObj #TODO look into that also + rProps.AddOpt( ESCHER_Prop_fshadowObscured, 0x00030003 ); // force value for comments VMLExport::Commit( rProps, rRect ); } -- cgit