misc comment import/export fixes
Cherry pick the rest of the commit ...
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
Conflicts:
oox/source/export/vmlexport.cxx
sc/source/filter/xcl97/xcl97rec.cxx
diff --git a/filter/source/msfilter/eschesdo.cxx b/filter/source/msfilter/eschesdo.cxx
index bbd63d5..32d5680 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 8c758b4..0345a33 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -534,7 +534,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 );
@@ -669,6 +669,32 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect
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
fprintf( stderr, "TODO VMLExport::Commit(), unimplemented id: %d, value: %" SAL_PRIuUINT32 ", data: [%" SAL_PRIuUINT32 ", %p]\n",
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index 212bb6b..500a332 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -568,6 +568,19 @@ void VmlCommentExporter::Commit( EscherPropertyContainer& rProps, const Rectangl
lcl_FillProps( rProps, mpCaption, mbVisible );
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 );
}