filter/source/msfilter/msdffimp.cxx | 7 +++++++ include/svx/msdffdef.hxx | 3 +++ sc/source/filter/excel/xeescher.cxx | 7 +++++++ sc/source/filter/excel/xiescher.cxx | 15 +++++++++++++++ 4 files changed, 32 insertions(+)
New commits: commit aab697c7b64e79dd9102395ae1a8fe9025995a73 Author: Andre Fischer <a...@apache.org> Date: Thu Jun 21 10:29:05 2012 +0000 Resolves: #i119903# Alternative text for form control t import/export Patch by: Jianyuan Li review by: Andre Fischer (cherry picked from commit 0ecc381c85bd4192add692d26fc60ba8e6341fd9) Conflicts: filter/source/msfilter/msdffimp.cxx sc/source/filter/excel/xiescher.cxx sc/source/filter/inc/xiescher.hxx svx/inc/svx/msdffdef.hxx Change-Id: Iac7282e50fd86244381ca174ba3f906aab89c7d9 diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 25942ee..637e2ab3 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -4705,6 +4705,13 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r pRet->SetPrintable( ( nGroupProperties & 1 ) != 0 ); } + //Import alt text as description + if ( pRet && SeekToContent( DFF_Prop_wzDescription, rSt ) ) + { + OUString aAltText = MSDFFReadZString(rSt, GetPropertyValue(DFF_Prop_wzDescription), true); + pRet->SetDescription( aAltText ); + } + return pRet; } diff --git a/include/svx/msdffdef.hxx b/include/svx/msdffdef.hxx index 3ff5a3d..007f273 100644 --- a/include/svx/msdffdef.hxx +++ b/include/svx/msdffdef.hxx @@ -1179,6 +1179,9 @@ typedef enum { mso_colorBParamShift = 16 // To extract the parameter value } MSO_SYSCOLORINDEX; +//ALT_TXT_MSINTEROP +#define MSPROP_DESCRIPTION_MAX_LEN 4096 + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index b391a07..6acbf4d 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -686,6 +686,13 @@ XclExpTbxControlObj::XclExpTbxControlObj( XclExpObjectManager& rRoot, Reference< if( aCtrlProp.GetProperty( aCtrlName, "Name" ) && !aCtrlName.isEmpty() ) aPropOpt.AddOpt( ESCHER_Prop_wzName, aCtrlName ); + //Export description as alt text + if( SdrObject* pSdrObj = SdrObject::getSdrObjectFromXShape( xShape ) ) + { + String aAltTxt( pSdrObj->GetDescription(), 0, MSPROP_DESCRIPTION_MAX_LEN ); + aPropOpt.AddOpt( ESCHER_Prop_wzDescription, aAltTxt ); + } + // write DFF property set to stream aPropOpt.Commit( mrEscherEx.GetStream() ); diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index 7acd77e..c358c1f 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -107,6 +107,7 @@ #include <comphelper/mediadescriptor.hxx> #include <sfx2/docfile.hxx> +using ::com::sun::star::uno::makeAny; using ::com::sun::star::uno::Any; using ::com::sun::star::uno::Exception; using ::com::sun::star::uno::Reference; @@ -1997,6 +1998,20 @@ void XclImpTbxObjBase::ConvertLabel( ScfPropertySet& rPropSet ) const aLabel.Insert( '~', nPos ); } rPropSet.SetStringProperty( "Label", aLabel ); + + //Excel Alt text <==> Aoo description + //For TBX control, if user does not operate alt text, alt text will be set label text as default value in Excel. + //In this case, DFF_Prop_wzDescription will not be set in excel file. + //So In the end of SvxMSDffManager::ImportShape, description will not be set. But actually in excel, + //the alt text is the label value. So here set description as label text first which is called before ImportShape. + Reference< ::com::sun::star::beans::XPropertySet > xPropset( mxShape, UNO_QUERY ); + try{ + if(xPropset.is()) + xPropset->setPropertyValue( "Description", makeAny(::rtl::OUString(aLabel)) ); + }catch( ... ) + { + OSL_TRACE( " Can't set a default text for TBX Control "); + } } ConvertFont( rPropSet ); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits