summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Fischer <af@apache.org>2012-06-21 10:29:05 +0000
committerAndre Fischer <af@apache.org>2012-06-21 10:29:05 +0000
commit0ecc381c85bd4192add692d26fc60ba8e6341fd9 (patch)
tree75bf2726527dcaeb333bbbde98194ac4d2a31657
parentf58ffc9e83ceee71536310d7ab54016ab2bf14f1 (diff)
#i119537# Fixed extrusion of custom shapes to XLS.
Patch by: Jianyuan Li review by: Andre Fischer
Notes
-rw-r--r--filter/source/msfilter/msdffimp.cxx8
-rw-r--r--sc/source/filter/excel/xeescher.cxx7
-rw-r--r--sc/source/filter/excel/xiescher.cxx15
-rw-r--r--sc/source/filter/inc/xiescher.hxx4
-rw-r--r--svx/inc/svx/msdffdef.hxx3
5 files changed, 35 insertions, 2 deletions
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index e31a3de5908a..d38242f578a6 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -4810,6 +4810,14 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
mpTracer->RemoveAttribute( aObjData.nSpFlags & SP_FGROUP
? rtl::OUString::createFromAscii( "GroupShape" )
: rtl::OUString::createFromAscii( "Shape" ) );
+ //Import alt text as description
+ if ( pRet && SeekToContent( DFF_Prop_wzDescription, rSt ) )
+ {
+ String aAltText;
+ MSDFFReadZString( rSt, aAltText, GetPropertyValue( DFF_Prop_wzDescription ), sal_True );
+ pRet->SetDescription( aAltText );
+ }
+
return pRet;
}
diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx
index 4362d01d0077..5b04ece3e949 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -554,6 +554,13 @@ XclExpTbxControlObj::XclExpTbxControlObj( XclExpObjectManager& rObjMgr, Referenc
if( aCtrlProp.GetProperty( aCtrlName, CREATE_OUSTRING( "Name" ) ) && (aCtrlName.getLength() > 0) )
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 329a7215aeef..ca37c5eddc06 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -109,6 +109,7 @@
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
+using ::com::sun::star::uno::makeAny;
using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::Exception;
using ::com::sun::star::uno::Reference;
@@ -1965,6 +1966,20 @@ void XclImpTbxObjBase::ConvertLabel( ScfPropertySet& rPropSet ) const
aLabel.Insert( '~', nPos );
}
rPropSet.SetStringProperty( CREATE_OUSTRING( "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( CREATE_OUSTRING( "Description" ), makeAny(::rtl::OUString(aLabel)) );
+ }catch( ... )
+ {
+ OSL_TRACE( " Can't set a default text for TBX Control ");
+ }
}
ConvertFont( rPropSet );
}
diff --git a/sc/source/filter/inc/xiescher.hxx b/sc/source/filter/inc/xiescher.hxx
index d1e083eb254b..291174737ffd 100644
--- a/sc/source/filter/inc/xiescher.hxx
+++ b/sc/source/filter/inc/xiescher.hxx
@@ -497,6 +497,8 @@ protected:
/** Derived classes will set additional properties for the current form control. */
virtual void DoProcessControl( ScfPropertySet& rPropSet ) const;
+ mutable ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ mxShape; /// The UNO wrapper of the control shape.
private:
/** Reads a list of cell ranges from a formula at the current stream position. */
@@ -506,8 +508,6 @@ private:
private:
const XclImpRoot& mrRoot; /// Not derived from XclImpRoot to allow multiple inheritance.
- mutable ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
- mxShape; /// The UNO wrapper of the control shape.
ScfRef< ScAddress > mxCellLink; /// Linked cell in the Calc document.
ScfRef< ScRange > mxSrcRange; /// Source data range in the Calc document.
XclCtrlBindMode meBindMode; /// Value binding mode.
diff --git a/svx/inc/svx/msdffdef.hxx b/svx/inc/svx/msdffdef.hxx
index d7435453ab06..da354c8cf0db 100644
--- a/svx/inc/svx/msdffdef.hxx
+++ b/svx/inc/svx/msdffdef.hxx
@@ -1220,4 +1220,7 @@ sal_uInt8 m_bTag;
void *m_pvBits; // raster bits of the blip.
#endif
+//ALT_TXT_MSINTEROP
+#define MSPROP_DESCRIPTION_MAX_LEN 4096
+
#endif