Author: af
Date: Thu Jun 21 11:29:05 2012
New Revision: 1352497

URL: http://svn.apache.org/viewvc?rev=1352497&view=rev
Log:
#i119537# Fixed extrusion of custom shapes to XLS.

          Patch by: Jianyuan Li
          review by: Andre Fischer

Modified:
    incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.cxx
    incubator/ooo/trunk/main/sc/source/filter/excel/xeescher.cxx
    incubator/ooo/trunk/main/sc/source/filter/excel/xiescher.cxx
    incubator/ooo/trunk/main/sc/source/filter/inc/xiescher.hxx
    incubator/ooo/trunk/main/svx/inc/svx/msdffdef.hxx

Modified: incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.cxx
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.cxx?rev=1352497&r1=1352496&r2=1352497&view=diff
==============================================================================
--- incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.cxx (original)
+++ incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.cxx Thu Jun 21 
11:29:05 2012
@@ -4810,6 +4810,14 @@ SdrObject* SvxMSDffManager::ImportShape(
                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;
 }
 

Modified: incubator/ooo/trunk/main/sc/source/filter/excel/xeescher.cxx
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/filter/excel/xeescher.cxx?rev=1352497&r1=1352496&r2=1352497&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/filter/excel/xeescher.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/filter/excel/xeescher.cxx Thu Jun 21 
11:29:05 2012
@@ -554,6 +554,13 @@ XclExpTbxControlObj::XclExpTbxControlObj
     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() );
 

Modified: incubator/ooo/trunk/main/sc/source/filter/excel/xiescher.cxx
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/filter/excel/xiescher.cxx?rev=1352497&r1=1352496&r2=1352497&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/filter/excel/xiescher.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/filter/excel/xiescher.cxx Thu Jun 21 
11:29:05 2012
@@ -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( Scf
                 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 );
 }

Modified: incubator/ooo/trunk/main/sc/source/filter/inc/xiescher.hxx
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/filter/inc/xiescher.hxx?rev=1352497&r1=1352496&r2=1352497&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/filter/inc/xiescher.hxx (original)
+++ incubator/ooo/trunk/main/sc/source/filter/inc/xiescher.hxx Thu Jun 21 
11:29:05 2012
@@ -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.

Modified: incubator/ooo/trunk/main/svx/inc/svx/msdffdef.hxx
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/inc/svx/msdffdef.hxx?rev=1352497&r1=1352496&r2=1352497&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/inc/svx/msdffdef.hxx (original)
+++ incubator/ooo/trunk/main/svx/inc/svx/msdffdef.hxx Thu Jun 21 11:29:05 2012
@@ -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


Reply via email to