ooo-build r13367 - in branches/ooo-build-2-4-1: . patches/src680 patches/vba



Author: tml
Date: Wed Jul 23 15:45:13 2008
New Revision: 13367
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13367&view=rev

Log:
2008-07-23  Tor Lillqvist  <tml novell com>

	Backports from trunk, patches already included in Novell Edition
	Windows build OOo-2.4.1-8:

	* patches/vba/sc-vbaimport-override-controlname.diff: bnc#359933
	* patches/src680/svx-text-rotation-fix.diff: bnc#404221
	* patches/vba/vba-range-find.diff: bnc#405304
	* patches/vba/vba-listbox-removeitem.diff: bnc#405306
	* patches/vba/vba-spin-button.diff: bnc#405308
	* patches/src680/bug-406675-fix.diff: bnc#406675



Added:
   branches/ooo-build-2-4-1/patches/src680/bug-406675-fix.diff
   branches/ooo-build-2-4-1/patches/src680/svx-text-rotation-fix.diff
   branches/ooo-build-2-4-1/patches/vba/sc-vbaimport-override-controlname.diff
   branches/ooo-build-2-4-1/patches/vba/vba-listbox-removeitem.diff
   branches/ooo-build-2-4-1/patches/vba/vba-range-find.diff
   branches/ooo-build-2-4-1/patches/vba/vba-spin-button.diff
Modified:
   branches/ooo-build-2-4-1/ChangeLog

Added: branches/ooo-build-2-4-1/patches/src680/bug-406675-fix.diff
==============================================================================
--- (empty file)
+++ branches/ooo-build-2-4-1/patches/src680/bug-406675-fix.diff	Wed Jul 23 15:45:13 2008
@@ -0,0 +1,35 @@
+--- sc/source/ui/vba/vbarange.cxx	2008-07-01 10:43:33.000000000 +0100
++++ sc/source/ui/vba/vbarange.cxx	2008-07-07 13:35:08.000000000 +0100
+@@ -223,18 +223,21 @@ uno::Reference< excel::XRange > lcl_make
+ 		ScUnoConversion::FillScRange( refRange, sAddresses[ index ] );
+ 		aCellRanges.Append( refRange );
+ 	}
+-	// Single range
+-	if ( aCellRanges.First() == aCellRanges.Last() )
+-	{
+-		uno::Reference< table::XCellRange > xTmpRange( new ScCellRangeObj( pDoc, *aCellRanges.First() ) );
+-		// #FIXME need proper (WorkSheet) parent
+-		xRange = new ScVbaRange( xParent, xContext, xTmpRange );
+-	}
+-	else
++	if ( nLen )
+ 	{
+-		uno::Reference< sheet::XSheetCellRangeContainer > xRanges( new ScCellRangesObj( pDoc, aCellRanges ) );
+-		// #FIXME need proper (WorkSheet) parent
+-		xRange = new ScVbaRange( xParent, xContext, xRanges );
++		// Single range
++		if ( aCellRanges.First() == aCellRanges.Last() )
++		{
++			uno::Reference< table::XCellRange > xTmpRange( new ScCellRangeObj( pDoc, *aCellRanges.First() ) );
++			// #FIXME need proper (WorkSheet) parent
++			xRange = new ScVbaRange( xParent, xContext, xTmpRange );
++		}
++		else
++		{
++			uno::Reference< sheet::XSheetCellRangeContainer > xRanges( new ScCellRangesObj( pDoc, aCellRanges ) );
++			// #FIXME need proper (WorkSheet) parent
++			xRange = new ScVbaRange( xParent, xContext, xRanges );
++		}
+ 	}
+ 	return xRange;
+ }

Added: branches/ooo-build-2-4-1/patches/src680/svx-text-rotation-fix.diff
==============================================================================
--- (empty file)
+++ branches/ooo-build-2-4-1/patches/src680/svx-text-rotation-fix.diff	Wed Jul 23 15:45:13 2008
@@ -0,0 +1,25 @@
+Index: svx/source/msfilter/escherex.cxx
+===================================================================
+RCS file: /cvs/graphics/svx/source/msfilter/escherex.cxx,v
+retrieving revision 1.73
+diff -u -r1.73 escherex.cxx
+--- svx/source/msfilter/escherex.cxx	31 Jul 2007 17:31:58 -0000	1.73
++++ svx/source/msfilter/escherex.cxx	7 Jul 2008 09:18:50 -0000
+@@ -853,6 +853,17 @@
+ 
+ 	if ( nTextId )
+ 		AddOpt( ESCHER_Prop_lTxid, nTextId );
++
++    // n#404221: In case of rotation we need to write the txtflTextFlow 
++    // attribute too.
++    sal_uInt16 nAngle = EscherPropertyValueHelper::GetPropertyValue( aAny, 
++                            rXPropSet,
++			    String( RTL_CONSTASCII_USTRINGPARAM( "RotateAngle" ) ), 
++			   sal_True )
++	? (sal_uInt16)( ( *((sal_Int32*)aAny.getValue() ) ) + 5 ) / 10 : 0;
++    if (nAngle==2700) {
++	AddOpt( ESCHER_Prop_txflTextFlow, 3 );
++    }
+ }
+ 
+ static sal_Bool GetLineArrow( const sal_Bool bLineStart,

Added: branches/ooo-build-2-4-1/patches/vba/sc-vbaimport-override-controlname.diff
==============================================================================
--- (empty file)
+++ branches/ooo-build-2-4-1/patches/vba/sc-vbaimport-override-controlname.diff	Wed Jul 23 15:45:13 2008
@@ -0,0 +1,214 @@
+--- svx/inc/svxmsbas.hxx	2008-04-10 20:03:26.000000000 +0100
++++ svx/inc/svxmsbas.hxx	2008-06-30 17:26:38.000000000 +0100
+@@ -35,6 +35,8 @@
+ #include "svx/svxdllapi.h"
+ 
+ #include <sot/storage.hxx>
++#include <map>
++#include <hash_map>
+ 
+ class SfxObjectShell;
+ 
+@@ -53,8 +55,15 @@ class SfxObjectShell;
+  * probably what the user expects to see when viewing the code
+  */
+ 
++typedef std::hash_map< sal_Int32, String >  ObjIdToName;
++
++typedef std::map< String, ObjIdToName >  ControlAttributeInfo;
++
+ class SVX_DLLPUBLIC SvxImportMSVBasic
+-{
++{ 
++	ControlAttributeInfo m_ModuleNameToObjIdHash;
++	void extractAttribute( const String& rAttribute, const String& rModName );
++
+ public:
+ 	SvxImportMSVBasic( SfxObjectShell &rDocS, SotStorage &rRoot,
+ 						BOOL bImportCode = TRUE, BOOL bCopyStorage = TRUE )
+@@ -73,9 +82,10 @@ public:
+ 	// - returns a warning code if a modified basic exist, in all other
+ 	//   cases return ERRCODE_NONE.
+ 	ULONG SaveOrDelMSVBAStorage( BOOL bSaveInto, const String& rStorageName );
+-
+ 	// check if the MS-VBA-Storage exist in the RootStorage of the DocShell.
+ 	// If it exist, then return the WarningId for loosing the information.
++
++        const ControlAttributeInfo& ControlNameForObjectId(){ return m_ModuleNameToObjIdHash; }
+ 	static ULONG GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS );
+ 
+ 	static String GetMSBasicStorageName();
+@@ -87,7 +97,7 @@ private:
+ 
+ 	SVX_DLLPRIVATE BOOL ImportCode_Impl( const String& rStorageName,
+ 						  const String &rSubStorageName,
+-						  BOOL bAsComment, BOOL bStripped);
++						  BOOL bAsComment, BOOL bStripped );
+ 	SVX_DLLPRIVATE bool ImportForms_Impl(const String& rStorageName, 
+ 		const String &rSubStorageName);
+ 	SVX_DLLPRIVATE BOOL CopyStorage_Impl( const String& rStorageName,
+--- svx/source/msfilter/svxmsbas.cxx	2008-06-26 21:31:45.000000000 +0100
++++ svx/source/msfilter/svxmsbas.cxx	2008-06-30 17:25:56.000000000 +0100
+@@ -62,6 +62,23 @@ using namespace com::sun::star;
+ 
+ using rtl::OUString;
+ 
++void SvxImportMSVBasic::extractAttribute( const String& rAttribute, const String& rModName )
++{
++    // format of the attribute we are interested in is
++    // Attribute VB_Control = "ControlName", intString, MSForms, ControlTypeAsString
++    // e.g.
++    // Attribute VB_Control = "CommandButton1, 201, 19, MSForms, CommandButton"
++    String sControlAttribute( RTL_CONSTASCII_USTRINGPARAM("Attribute VB_Control = \"") );
++    if ( rAttribute.Search( sControlAttribute ) !=  STRING_NOTFOUND )
++    {
++        String sRest = rAttribute.Copy( sControlAttribute.Len() );
++        xub_StrLen nPos = 0; 
++        String sCntrlName = sRest.GetToken( 0, ',', nPos );
++        
++        sal_Int32 nCntrlId = sRest.GetToken( 0, ',', nPos).ToInt32();
++        m_ModuleNameToObjIdHash[ rModName ][ nCntrlId ] =  sCntrlName;
++    }
++}
+ int SvxImportMSVBasic::Import( const String& rStorageName,
+ 								const String &rSubStorageName,
+ 								BOOL bAsComment, BOOL bStripped )
+@@ -384,7 +401,12 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
+                             if( nEnd == STRING_NOTFOUND )
+                                 pStr->Erase();
+                             else
++                            {
++								//OSL_TRACE("Erase %s", rtl::OUStringToOString(*pStr, RTL_TEXTENCODING_UTF8 ).getStr() );
++                                String sAttr= pStr->Copy( nBegin, (nEnd-nBegin)+1);
++                                extractAttribute( sAttr, sModule );
+                                 pStr->Erase(nBegin, (nEnd-nBegin)+1);
++                            }
+ 						}
+ 					}
+ 					if( aDecompressed.Get(j)->Len() )
+diff -rup sc/source/filter/excel/excimp8.cxx sc/source/filter/excel/excimp8.cxx
+--- sc/source/filter/excel/excimp8.cxx	2008-06-26 21:31:48.000000000 +0100
++++ sc/source/filter/excel/excimp8.cxx	2008-06-30 19:12:57.000000000 +0100
+@@ -291,11 +291,11 @@ void ImportExcel8::ReadBasic( void )
+         {
+             SvxImportMSVBasic aBasicImport( *pShell, *xRootStrg, bLoadCode, bLoadStrg );
+             aBasicImport.Import( EXC_STORAGE_VBA_PROJECT, EXC_STORAGE_VBA, !lcl_hasVBAEnabled() );
++            GetObjectManager().SetOleNameOverrideInfo( aBasicImport.ControlNameForObjectId() );
+         }
+     }
+ }
+ 
+-
+ void ImportExcel8::EndSheet( void )
+ {
+     GetCondFormatManager().Apply();
+diff -rup sc.orig/source/filter/excel/xiescher.cxx sc/source/filter/excel/xiescher.cxx
+--- sc/source/filter/excel/xiescher.cxx	2008-06-26 21:31:45.000000000 +0100
++++ sc/source/filter/excel/xiescher.cxx	2008-06-30 19:15:19.000000000 +0100
+@@ -105,6 +105,8 @@
+ #include "xipage.hxx"
+ #include "xichart.hxx"
+ #include "xicontent.hxx"
++#include "scextopt.hxx"
++
+
+ #include "xlescher.hxx"
+ using ::rtl::OUString;
+@@ -1172,8 +1172,13 @@ void XclImpOleObj::DoProcessSdrObj( SdrO
+         // printable
+         aPropSet.SetBoolProperty( CREATE_OUSTRING( "Printable" ), IsPrintable() );
+         // #118053# #i51348# set name from SdrObject as internal name of the control
++        String sName;
+         if( rSdrObj.GetName().Len() > 0 )
+-            aPropSet.SetStringProperty( CREATE_OUSTRING( "Name" ), rSdrObj.GetName() );
++            sName = rSdrObj.GetName();
++        String sOverRide( GetObjectManager().GetOleNameOverride( GetObjId() ) );
++        if ( sOverRide.Len() > 0 )
++            sName = sOverRide;
++        aPropSet.SetStringProperty( CREATE_OUSTRING( "Name" ), sName );
+         // sheet links
+         ConvertSheetLinks( GetRoot(), rSdrObj );
+     }
+@@ -1573,6 +1578,23 @@ XclImpDffManager::~XclImpDffManager()
+ {
+ }
+ 
++String XclImpObjectManager::GetOleNameOverride( const XclObjId& nObjId )
++{
++    String sOleName; 
++    String sCodeName= GetExtDocOptions().GetCodeName( nObjId.mnScTab );
++    
++    CodeNameToCntrlObjIdInfo::iterator it = maOleCtrlNameOverride.find( sCodeName );
++    if ( it != maOleCtrlNameOverride.end() )
++    {
++        CntrlObjIdToName::iterator it_id = it->second.find( nObjId.mnObjId );
++        if ( it_id != it->second.end() )
++        {
++            sOleName = it_id->second;
++        }
++    }
++    return sOleName;
++}
++
+ void XclImpDffManager::StartProgressBar( sal_Size nProgressSize )
+ {
+     mxProgress.reset( new ScfProgressBar( GetDocShell(), STR_PROGRESS_CALCULATING ) );
+diff -rup sc.orig/source/filter/inc/xiescher.hxx sc/source/filter/inc/xiescher.hxx
+--- sc.orig/source/filter/inc/xiescher.hxx	2008-06-26 21:31:39.000000000 +0100
++++ sc/source/filter/inc/xiescher.hxx	2008-06-30 19:14:38.000000000 +0100
+@@ -34,6 +34,7 @@
+ #include <svx/msdffimp.hxx>
+ #endif
+ 
++#include <hash_map>
+ #ifndef SC_XLESCHER_HXX
+ #include "xlescher.hxx"
+ #endif
+@@ -439,6 +440,7 @@ private:
+ 
+ // ----------------------------------------------------------------------------
+ 
++
+ class XclImpObjectManager;
+ class XclImpOcxConverter;
+ 
+@@ -482,7 +484,6 @@ protected:
+     virtual ULONG       Calc_nBLIPPos( ULONG nOrgVal, ULONG nStreamPos ) const;
+     /** Returns a color from the Excel color palette. */
+     virtual FASTBOOL    GetColorFromPalette( USHORT nIndex, Color& rColor ) const;
+-
+ private:
+     /** Reads contents of a hyperlink property and returns the extracted URL. */
+     ::rtl::OUString     ReadHlinkProperty( SvStream& rEscherStrm ) const;
+@@ -518,6 +519,7 @@ private:
+     typedef ScfRef< ScfProgressBar >        ScfProgressBarRef;
+     typedef ScfRef< XclImpOcxConverter >    XclImpOcxConvRef;
+ 
++
+     XclImpObjectManager& mrObjManager;      /// The Excel object manager.
+     XclImpSolverContainer maSolverCont;     /// The solver container for connector rules.
+     ScRangeMap          maUsedAreaMap;      /// Used ranges for all sheets.
+@@ -531,6 +533,8 @@ private:
+ /** Stores all drawing and OLE objects and additional data related to these objects. */
+ class XclImpObjectManager : protected XclImpRoot
+ {
++typedef std::hash_map< sal_Int32, String >  CntrlObjIdToName;
++typedef std::map< String, CntrlObjIdToName > CodeNameToCntrlObjIdInfo;
+ public:
+     explicit            XclImpObjectManager( const XclImpRoot& rRoot );
+     virtual             ~XclImpObjectManager();
+@@ -573,8 +577,14 @@ public:
+     /** Returns the used area in the sheet with the passed index. */
+     ScRange             GetUsedArea( SCTAB nScTab ) const;
+ 
++    void SetOleNameOverrideInfo( const CodeNameToCntrlObjIdInfo& rOverrideInfo ) {  maOleCtrlNameOverride = rOverrideInfo; }
++    String GetOleNameOverride( const XclObjId& nObjId );
++
+     // ------------------------------------------------------------------------
+ private:
++    
++    CodeNameToCntrlObjIdInfo maOleCtrlNameOverride;
++
+     /** Reads contents of an Escher record and append data to internal Escher stream. */
+     void                ReadEscherRecord( XclImpStream& rStrm );
+     /** Reads a BIFF8 OBJ record following an MSODRAWING record. */

Added: branches/ooo-build-2-4-1/patches/vba/vba-listbox-removeitem.diff
==============================================================================
--- (empty file)
+++ branches/ooo-build-2-4-1/patches/vba/vba-listbox-removeitem.diff	Wed Jul 23 15:45:13 2008
@@ -0,0 +1,58 @@
+--- oovbaapi/org/openoffice/msforms/XListBox.idl.bak	2008-07-07 14:13:05.000000000 +0800
++++ oovbaapi/org/openoffice/msforms/XListBox.idl	2008-07-07 14:14:20.000000000 +0800
+@@ -51,6 +51,7 @@ interface XListBox: com::sun::star::uno:
+ 	[attribute] boolean MultiSelect;
+ 	//[attribute] sequence< boolean > Selected;
+ 	void AddItem( [in] any pvargItem, [in] any pvargIndex );
++	void removeItem( [in] any index );
+ 	void Clear();
+     any Selected( [in] long index );
+ };
+--- sc/source/ui/vba/vbalistbox.hxx.bak	2008-07-07 14:13:20.000000000 +0800
++++ sc/source/ui/vba/vbalistbox.hxx	2008-07-07 14:14:20.000000000 +0800
+@@ -72,6 +72,7 @@ public:
+ 
+ 	// Methods
+ 	virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException);
++    virtual void SAL_CALL removeItem( const css::uno::Any& index ) throw (css::uno::RuntimeException);
+ 	virtual void SAL_CALL Clear(  ) throw (css::uno::RuntimeException);
+ 
+ 
+--- sc/source/ui/vba/vbalistbox.cxx.bak	2008-07-07 14:13:28.000000000 +0800
++++ sc/source/ui/vba/vbalistbox.cxx	2008-07-08 10:41:33.000000000 +0800
+@@ -224,6 +224,35 @@ ScVbaListBox::AddItem( const uno::Any& p
+ }
+ 
+ void SAL_CALL 
++ScVbaListBox::removeItem( const uno::Any& index ) throw (uno::RuntimeException)
++{
++    sal_Int32 nIndex = 0;
++    // for int index
++	if ( index >>= nIndex  )
++	{
++		uno::Sequence< rtl::OUString > sList;
++		m_xProps->getPropertyValue( ITEMS ) >>= sList;
++        if( nIndex < 0 || nIndex > ( sList.getLength() - 1 ) )
++            throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid index" ), uno::Reference< uno::XInterface > () );
++        if( sList.hasElements() )
++        {
++            if( sList.getLength() == 1 )
++            {
++                Clear();
++                return;
++            }
++            for( sal_Int32 i = nIndex; i < ( sList.getLength()-1 ); i++ )
++            {
++                sList[i] = sList[i+1];
++            }
++			sList.realloc(  sList.getLength() - 1 );
++		}
++
++		m_xProps->setPropertyValue( ITEMS, uno::makeAny( sList ) );
++	}
++}
++
++void SAL_CALL 
+ ScVbaListBox::Clear(  ) throw (uno::RuntimeException)
+ {
+ 	// urk, setValue doesn't seem to work !!

Added: branches/ooo-build-2-4-1/patches/vba/vba-range-find.diff
==============================================================================
--- (empty file)
+++ branches/ooo-build-2-4-1/patches/vba/vba-range-find.diff	Wed Jul 23 15:45:13 2008
@@ -0,0 +1,197 @@
+--- oovbaapi/org/openoffice/excel/XRange.idl.bak	2008-07-07 11:45:42.000000000 +0800
++++ oovbaapi/org/openoffice/excel/XRange.idl	2008-07-07 14:07:26.000000000 +0800
+@@ -139,6 +139,7 @@ interface XRange
+ 	any getCellRange();
+ 	void PasteSpecial([in] any Paste, [in] any Operation,[in] any SkipBlanks, [in] any Transpose);
+ 	boolean  Replace( [in] string What, [in] string Replacement, [in] any LookAt, [in] any SearchOrder, [in] any MatchCase, [in] any MatchByte, [in] any SearchFormat, [in] any ReplaceFormat );
++    XRange Find( [in] any What, [in] any After, [in] any LookIn, [in] any LookAt, [in] any SearchOrder, [in] any SearchDirection, [in] any MatchCase, [in] any MatchByte, [in] any SearchFormat );
+ 	
+ 	void Sort( [in] any Key1, [in] any Order1, [in] any Key2, [in] any Type,
+ 		[in] any Order2, [in] any Key3, [in] any Order3,
+--- sc/source/ui/vba/vbarange.hxx.bak	2008-07-07 11:45:51.000000000 +0800
++++ sc/source/ui/vba/vbarange.hxx	2008-07-07 14:07:26.000000000 +0800
+@@ -215,6 +215,7 @@ public:
+ 	virtual css::uno::Any SAL_CALL getCellRange(  ) throw (css::uno::RuntimeException);
+ 	virtual void SAL_CALL PasteSpecial( const css::uno::Any& Paste, const css::uno::Any& Operation, const css::uno::Any& SkipBlanks, const css::uno::Any& Transpose ) throw (css::uno::RuntimeException);
+ 	virtual ::sal_Bool SAL_CALL Replace( const ::rtl::OUString& What, const ::rtl::OUString& Replacement, const css::uno::Any& LookAt, const css::uno::Any& SearchOrder, const css::uno::Any& MatchCase, const css::uno::Any& MatchByte, const css::uno::Any& SearchFormat, const css::uno::Any& ReplaceFormat ) throw (css::uno::RuntimeException);
++    virtual css::uno::Reference< oo::excel::XRange > SAL_CALL Find( const css::uno::Any& What, const css::uno::Any& After, const css::uno::Any& LookIn, const css::uno::Any& LookAt, const css::uno::Any& SearchOrder, const css::uno::Any& SearchDirection, const css::uno::Any& MatchCase, const css::uno::Any& MatchByte, const css::uno::Any& SearchFormat ) throw (css::uno::RuntimeException);
+ 	virtual void SAL_CALL Sort( const css::uno::Any& Key1, const css::uno::Any& Order1, const css::uno::Any& Key2, const css::uno::Any& Type, const css::uno::Any& Order2, const css::uno::Any& Key3, const css::uno::Any& Order3, const css::uno::Any& Header, const css::uno::Any& OrderCustom, const css::uno::Any& MatchCase, const css::uno::Any& Orientation, const css::uno::Any& SortMethod,  const css::uno::Any& DataOption1, const css::uno::Any& DataOption2, const css::uno::Any& DataOption3 ) throw (css::uno::RuntimeException);
+ 	virtual css::uno::Reference< oo::excel::XRange > SAL_CALL End( ::sal_Int32 Direction )  throw (css::uno::RuntimeException);
+ 	virtual css::uno::Reference< oo::excel::XCharacters > SAL_CALL characters( const css::uno::Any& Start, const css::uno::Any& Length ) throw (css::uno::RuntimeException);
+--- sc/source/ui/vba/vbarange.cxx.bak	2008-07-07 11:46:00.000000000 +0800
++++ sc/source/ui/vba/vbarange.cxx	2008-07-07 14:07:26.000000000 +0800
+@@ -120,6 +120,7 @@
+ #include <org/openoffice/excel/XlCellType.hpp>
+ #include <org/openoffice/excel/XlSpecialCellsValue.hpp>
+ #include <org/openoffice/excel/XlConsolidationFunction.hpp>
++#include <org/openoffice/excel/XlSearchDirection.hpp>
+ 
+ #include <scitems.hxx>
+ #include <svx/srchitem.hxx>
+@@ -2778,6 +2779,166 @@ ScVbaRange::Replace( const ::rtl::OUStri
+ 	return sal_True; // always
+ }
+ 
++uno::Reference< excel::XRange > SAL_CALL 
++ScVbaRange::Find( const uno::Any& What, const uno::Any& After, const uno::Any& LookIn, const uno::Any& LookAt, const uno::Any& SearchOrder, const uno::Any& SearchDirection, const uno::Any& MatchCase, const uno::Any& MatchByte, const uno::Any& SearchFormat ) throw (uno::RuntimeException)
++{
++    // return a Range object that represents the first cell where that information is found.
++    rtl::OUString sWhat;
++    sal_Int32 nWhat;
++    float fWhat;
++    
++    // string.
++    if( What >>= sWhat )
++    {
++        if( !sWhat.getLength() )
++		    throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Range::Find, missing params" )) , uno::Reference< uno::XInterface >() );
++    }
++    else if( What >>= nWhat )
++    {
++        sWhat = rtl::OUString::valueOf( nWhat );
++    }
++    else if( What >>= fWhat )
++    {
++        sWhat = rtl::OUString::valueOf( fWhat );
++    }
++    else
++	    throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Range::Find, missing params" )) , uno::Reference< uno::XInterface >() );
++
++    rtl::OUString sSearch = VBAToRegexp( sWhat );
++
++	const SvxSearchItem& globalSearchOptions = ScGlobal::GetSearchItem();
++	SvxSearchItem newOptions( globalSearchOptions );
++
++	sal_Int16 nLookAt =  globalSearchOptions.GetWordOnly() ?  excel::XlLookAt::xlPart : excel::XlLookAt::xlWhole; 
++	sal_Int16 nSearchOrder = globalSearchOptions.GetRowDirection() ? excel::XlSearchOrder::xlByRows : excel::XlSearchOrder::xlByColumns;
++
++	uno::Reference< util::XSearchable > xSearch( mxRange, uno::UNO_QUERY );
++    if( xSearch.is() )
++    {
++        uno::Reference< util::XSearchDescriptor > xDescriptor = xSearch->createSearchDescriptor();
++        xDescriptor->setSearchString( sSearch );
++
++        uno::Reference< excel::XRange > xAfterRange;
++        uno::Reference< table::XCellRange > xStartCell;
++        if( After >>= xAfterRange )
++        {
++            // After must be a single cell in the range
++            if( xAfterRange->getCount() > 1 )
++		        throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("After must be a single cell." )) , uno::Reference< uno::XInterface >() );
++            uno::Reference< excel::XRange > xCell( Cells( uno::makeAny( xAfterRange->getRow() ), uno::makeAny( xAfterRange->getColumn() ) ), uno::UNO_QUERY );
++            if( !xCell.is() )
++		        throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("After must be in range." )) , uno::Reference< uno::XInterface >() );
++            xStartCell.set( xAfterRange->getCellRange(), uno::UNO_QUERY_THROW );
++        }
++
++        // LookIn
++        if( LookIn.hasValue() )
++        {
++            sal_Int32 nLookIn;
++            if( LookIn >>= nLookIn )
++            {
++                sal_Int16 nSearchType; 
++                switch( nLookIn )
++                {
++                    case excel::XlFindLookIn::xlComments :
++                        nSearchType = SVX_SEARCHIN_NOTE; // Notes
++                    break;
++                    case excel::XlFindLookIn::xlFormulas :
++                        nSearchType = SVX_SEARCHIN_FORMULA;
++                    break;
++                    case excel::XlFindLookIn::xlValues :
++                        nSearchType = SVX_SEARCHIN_VALUE;
++                    break;
++                    default:
++		                throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Range::Replace, illegal value for LookIn." )) , uno::Reference< uno::XInterface >() );
++                }
++                newOptions.SetCellType( nSearchType );
++                xDescriptor->setPropertyValue( rtl::OUString::createFromAscii( "SearchType" ), uno::makeAny( nSearchType ) );
++            }
++        }
++
++        // LookAt
++		if ( LookAt.hasValue() )
++		{
++			nLookAt =  ::comphelper::getINT16( LookAt );
++			sal_Bool bSearchWords = sal_False;
++			if ( nLookAt == excel::XlLookAt::xlPart )
++				bSearchWords = sal_False;
++			else if ( nLookAt == excel::XlLookAt::xlWhole )
++				bSearchWords = sal_True;
++			else
++				throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Range::Replace, illegal value for LookAt" )) , uno::Reference< uno::XInterface >() );
++			newOptions.SetWordOnly( bSearchWords );
++			xDescriptor->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_SRCHWORDS ) ), uno::makeAny( bSearchWords ) ); 	
++        }
++
++        // SearchOrder
++		if ( SearchOrder.hasValue() )
++		{
++			nSearchOrder =  ::comphelper::getINT16( SearchOrder );
++			sal_Bool bSearchByRow = sal_False;
++			if ( nSearchOrder == excel::XlSearchOrder::xlByColumns )
++				bSearchByRow = sal_False;
++			else if ( nSearchOrder == excel::XlSearchOrder::xlByRows )
++				bSearchByRow = sal_True;
++			else
++				throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Range::Replace, illegal value for SearchOrder" )) , uno::Reference< uno::XInterface >() );
++			
++			newOptions.SetRowDirection( bSearchByRow ); 
++			xDescriptor->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_SRCHBYROW ) ), uno::makeAny( bSearchByRow ) ); 	
++		}			
++
++        // SearchDirection
++        if ( SearchDirection.hasValue() )
++        {
++            sal_Int32 nSearchDirection;
++            if( SearchDirection >>= nSearchDirection )
++            {
++                sal_Bool bSearchBackwards = sal_False;
++                if ( nSearchDirection == excel::XlSearchDirection::xlNext )
++                    bSearchBackwards = sal_False; 
++                else if( nSearchDirection == excel::XlSearchDirection::xlPrevious )
++                    bSearchBackwards = sal_True;
++                else
++				    throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Range::Replace, illegal value for SearchDirection" )) , uno::Reference< uno::XInterface >() );
++                newOptions.SetBackward( bSearchBackwards );
++                xDescriptor->setPropertyValue( rtl::OUString::createFromAscii( "SearchBackwards" ), uno::makeAny( bSearchBackwards ) );
++            }
++        }
++
++        // MatchCase
++        sal_Bool bMatchCase = sal_False;
++		if ( MatchCase.hasValue() )
++		{
++			// SearchCaseSensitive
++			if( !( MatchCase >>= bMatchCase ) )
++			    throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Range::Replace, illegal value for MatchCase" )) , uno::Reference< uno::XInterface >() );
++		}			
++        xDescriptor->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_SRCHCASE ) ), uno::makeAny( bMatchCase ) ); 	
++
++        // MatchByte
++        // SearchFormat
++        // ignore
++
++		ScGlobal::SetSearchItem( newOptions );	
++
++		uno::Reference< util::XSearchDescriptor > xSearchDescriptor( xDescriptor, uno::UNO_QUERY );
++		uno::Reference< table::XCellRange > xCellRange( xSearch->findNext( xStartCell, xSearchDescriptor ), uno::UNO_QUERY );
++        if ( xCellRange.is() )
++        {
++            uno::Reference< excel::XRange > xResultRange = new ScVbaRange( this, mxContext, xCellRange );
++            if( xResultRange.is() )
++            {
++                xResultRange->Select();
++                return xResultRange;
++            }
++        }
++
++    }
++
++    return uno::Reference< excel::XRange >();
++}
++
+ uno::Reference< table::XCellRange > processKey( const uno::Any& Key, uno::Reference<  uno::XComponentContext >& xContext, ScDocShell* pDocSh )
+ {
+ 	uno::Reference< excel::XRange > xKeyRange;

Added: branches/ooo-build-2-4-1/patches/vba/vba-spin-button.diff
==============================================================================
--- (empty file)
+++ branches/ooo-build-2-4-1/patches/vba/vba-spin-button.diff	Wed Jul 23 15:45:13 2008
@@ -0,0 +1,286 @@
+--- /dev/null	2007-09-22 05:50:58.000000000 +0800
++++ oovbaapi/org/openoffice/msforms/XSpinButton.idl	2008-07-07 14:15:56.000000000 +0800
+@@ -0,0 +1,59 @@
++/*************************************************************************
++ *
++ *  OpenOffice.org - a multi-platform office productivity suite
++ *
++ *  $RCSfile$
++ *
++ *  $Revision$
++ *
++ *  last change: $Author$ $Date$
++ *
++ *  The Contents of this file are made available subject to
++ *  the terms of GNU Lesser General Public License Version 2.1.
++ *
++ *
++ *    GNU Lesser General Public License Version 2.1
++ *    =============================================
++ *    Copyright 2005 by Sun Microsystems, Inc.
++ *    901 San Antonio Road, Palo Alto, CA 94303, USA
++ *
++ *    This library is free software; you can redistribute it and/or
++ *    modify it under the terms of the GNU Lesser General Public
++ *    License version 2.1, as published by the Free Software Foundation.
++ *
++ *    This library is distributed in the hope that it will be useful,
++ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ *    Lesser General Public License for more details.
++ *
++ *    You should have received a copy of the GNU Lesser General Public
++ *    License along with this library; if not, write to the Free Software
++ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
++ *    MA  02111-1307  USA
++ *
++ ************************************************************************/
++#ifndef __org_openoffice_msforms_XSpinButton_idl__
++#define __org_openoffice_msforms_XSpinButton_idl__
++
++#ifndef __com_sun_star_uno_XInterface_idl__
++#include <com/sun/star/uno/XInterface.idl>
++#endif
++//=============================================================================
++
++module org {  module openoffice {  module msforms { 
++
++//=============================================================================
++interface XSpinButton: com::sun::star::uno::XInterface 
++{
++	[attribute] long Max;
++	[attribute] long Min;
++	[attribute] any Value;
++};
++
++//=============================================================================
++
++}; }; };
++
++#endif
++
++
+--- oovbaapi/org/openoffice/msforms/makefile.mk.bak	2008-07-07 14:15:29.000000000 +0800
++++ oovbaapi/org/openoffice/msforms/makefile.mk	2008-07-07 14:16:42.000000000 +0800
+@@ -60,6 +60,7 @@ IDLFILES=\
+ 	XPictureFormat.idl \
+ 	XShapeRange.idl \
+ 	XTextBoxShape.idl \
++ 	XSpinButton.idl \
+ 	XListBox.idl 
+ 
+ # ------------------------------------------------------------------
+--- /dev/null	2007-09-22 05:50:58.000000000 +0800
++++ sc/source/ui/vba/vbaspinbutton.hxx	2008-07-07 14:36:36.000000000 +0800
+@@ -0,0 +1,61 @@
++/*************************************************************************
++ *
++ *  OpenOffice.org - a multi-platform office productivity suite
++ *
++ *  $RCSfile$
++ *
++ *  $Revision$
++ *
++ *  last change: $Author$ $Date$
++ *
++ *  The Contents of this file are made available subject to
++ *  the terms of GNU Lesser General Public License Version 2.1.
++ *
++ *
++ *    GNU Lesser General Public License Version 2.1
++ *    =============================================
++ *    Copyright 2005 by Sun Microsystems, Inc.
++ *    901 San Antonio Road, Palo Alto, CA 94303, USA
++ *
++ *    This library is free software; you can redistribute it and/or
++ *    modify it under the terms of the GNU Lesser General Public
++ *    License version 2.1, as published by the Free Software Foundation.
++ *
++ *    This library is distributed in the hope that it will be useful,
++ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ *    Lesser General Public License for more details.
++ *
++ *    You should have received a copy of the GNU Lesser General Public
++ *    License along with this library; if not, write to the Free Software
++ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
++ *    MA  02111-1307  USA
++ *
++ ************************************************************************/
++#ifndef SC_VBA_SPINBUTTON_HXX
++#define SC_VBA_SPINBUTTON_HXX
++#include <cppuhelper/implbase1.hxx>
++#include <org/openoffice/msforms/XSpinButton.hpp>
++
++#include "vbacontrol.hxx"
++#include "vbahelper.hxx"
++
++typedef cppu::ImplInheritanceHelper1< ScVbaControl, oo::msforms::XSpinButton > SpinButtonImpl_BASE;
++
++class ScVbaSpinButton : public SpinButtonImpl_BASE
++{
++public:
++    ScVbaSpinButton( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XControlShape >& xControl );
++   // Attributes
++    virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
++    virtual ::sal_Int32 SAL_CALL getMax() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setMax( ::sal_Int32 _max ) throw (css::uno::RuntimeException);
++    virtual ::sal_Int32 SAL_CALL getMin() throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setMin( ::sal_Int32 _min ) throw (css::uno::RuntimeException);
++
++    //XHelperInterface
++    virtual rtl::OUString& getServiceImplName();
++    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
++};
++#endif //SC_VBA_SPINBUTTON_HXX
+--- /dev/null	2007-09-22 05:50:58.000000000 +0800
++++ sc/source/ui/vba/vbaspinbutton.cxx	2008-07-07 14:36:51.000000000 +0800
+@@ -0,0 +1,109 @@
++/*************************************************************************
++ *
++ *  OpenOffice.org - a multi-platform office productivity suite
++ *
++ *  $RCSfile$
++ *
++ *  $Revision$
++ *
++ *  last change: $Author$ $Date$
++ *
++ *  The Contents of this file are made available subject to
++ *  the terms of GNU Lesser General Public License Version 2.1.
++ *
++ *
++ *    GNU Lesser General Public License Version 2.1
++ *    =============================================
++ *    Copyright 2005 by Sun Microsystems, Inc.
++ *    901 San Antonio Road, Palo Alto, CA 94303, USA
++ *
++ *    This library is free software; you can redistribute it and/or
++ *    modify it under the terms of the GNU Lesser General Public
++ *    License version 2.1, as published by the Free Software Foundation.
++ *
++ *    This library is distributed in the hope that it will be useful,
++ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ *    Lesser General Public License for more details.
++ *
++ *    You should have received a copy of the GNU Lesser General Public
++ *    License along with this library; if not, write to the Free Software
++ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
++ *    MA  02111-1307  USA
++ *
++ ************************************************************************/
++#include "vbaspinbutton.hxx"
++#include <vector>
++
++using namespace com::sun::star;
++using namespace org::openoffice;
++
++
++const static rtl::OUString ORIENTATION( RTL_CONSTASCII_USTRINGPARAM("Orientation") );
++const static rtl::OUString SPINVALUE( RTL_CONSTASCII_USTRINGPARAM("SpinValue") );
++const static rtl::OUString SPINMAX( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") );
++const static rtl::OUString SPINMIN( RTL_CONSTASCII_USTRINGPARAM("SpinValueMin") );
++
++ScVbaSpinButton::ScVbaSpinButton( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XControlShape >& xControl ) : SpinButtonImpl_BASE(  xContext, xControl )
++{
++}
++
++// Attributes
++uno::Any SAL_CALL 
++ScVbaSpinButton::getValue() throw (css::uno::RuntimeException)
++{
++    return  m_xProps->getPropertyValue( SPINVALUE );
++}
++
++void SAL_CALL 
++ScVbaSpinButton::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
++{
++    m_xProps->setPropertyValue( SPINVALUE, _value );
++}
++
++::sal_Int32 SAL_CALL 
++ScVbaSpinButton::getMax() throw (uno::RuntimeException)
++{
++    sal_Int32 nMax = 0;
++    m_xProps->getPropertyValue( SPINMAX ) >>= nMax;
++    return nMax;
++}
++
++void SAL_CALL 
++ScVbaSpinButton::setMax( sal_Int32 nVal ) throw (uno::RuntimeException)
++{
++    m_xProps->setPropertyValue( SPINMAX, uno::makeAny( nVal ) ); 
++}
++
++::sal_Int32 SAL_CALL 
++ScVbaSpinButton::getMin() throw (uno::RuntimeException)
++{
++    sal_Int32 nVal = 0;
++    m_xProps->getPropertyValue( SPINMIN ) >>= nVal;
++    return nVal;
++}
++
++void SAL_CALL 
++ScVbaSpinButton::setMin( sal_Int32 nVal ) throw (uno::RuntimeException)
++{
++    m_xProps->setPropertyValue( SPINMIN, uno::makeAny( nVal ) ); 
++}
++
++rtl::OUString& 
++ScVbaSpinButton::getServiceImplName()
++{
++	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaSpinButton") );
++	return sImplName;
++}
++
++uno::Sequence< rtl::OUString > 
++ScVbaSpinButton::getServiceNames()
++{
++	static uno::Sequence< rtl::OUString > aServiceNames;
++	if ( aServiceNames.getLength() == 0 )
++	{
++		aServiceNames.realloc( 1 );
++		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.msforms.Frame" ) );
++	}
++	return aServiceNames;
++}
+--- sc/source/ui/vba/makefile.mk.bak	2008-07-07 14:15:38.000000000 +0800
++++ sc/source/ui/vba/makefile.mk	2008-07-07 14:17:44.000000000 +0800
+@@ -122,6 +122,7 @@ SLOFILES= \
+                 $(SLO)$/vbacommandbar.obj \
+                 $(SLO)$/vbacommandbars.obj \
+ 		        $(SLO)$/vbapagesetup.obj \
++        $(SLO)$/vbaspinbutton.obj \
+ 		$(SLO)$/service.obj \
+  
+ 
+--- sc/source/ui/vba/vbacontrol.cxx.bak	2008-07-07 14:15:46.000000000 +0800
++++ sc/source/ui/vba/vbacontrol.cxx	2008-07-07 14:26:05.000000000 +0800
+@@ -49,6 +49,7 @@
+ #include "vbatextbox.hxx"
+ #include "vbaradiobutton.hxx"
+ #include "vbalistbox.hxx"
++#include "vbaspinbutton.hxx"
+ 
+ 
+ using namespace com::sun::star;
+@@ -293,6 +294,8 @@ ScVbaControl* ScVbaControlFactory::creat
+             return new ScVbaRadioButton( m_xContext, m_xControlShape );
+         case form::FormComponentType::LISTBOX:
+             return new ScVbaListBox( m_xContext, m_xControlShape );
++        case form::FormComponentType::SPINBUTTON:
++            return new ScVbaSpinButton( m_xContext, m_xControlShape );
+         default:
+             throw uno::RuntimeException( rtl::OUString::createFromAscii(
+                     "Donot surpport this Control Type." ), uno::Reference< uno::XInterface >() );
+@@ -318,6 +321,8 @@ ScVbaControl* ScVbaControlFactory::creat
+             return new ScVbaRadioButton( m_xContext, m_xControlShape );
+         case form::FormComponentType::LISTBOX:
+             return new ScVbaListBox( m_xContext, m_xControlShape );
++        case form::FormComponentType::SPINBUTTON:
++            return new ScVbaSpinButton( m_xContext, m_xControlShape );
+         default:
+             throw uno::RuntimeException( rtl::OUString::createFromAscii(
+                     "Donot surpport this Control Type." ), uno::Reference< uno::XInterface >() );



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]