ooo-build r12088 - in trunk: . patches/src680 patches/test patches/vba
- From: pmladek svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r12088 - in trunk: . patches/src680 patches/test patches/vba
- Date: Wed, 2 Apr 2008 19:00:41 +0100 (BST)
Author: pmladek
Date: Wed Apr 2 19:00:40 2008
New Revision: 12088
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12088&view=rev
Log:
2008-04-02 Petr Mladek <pmladek suse cz>
* patches/vba/vba-workbook-worksheet-events.diff: move the updated
version to patches/test/vba-workbook-worksheet-events.diff;
restored the older version from ooo-build-2.4.0.4; the new
version did not inlude any real change; it was just cleanup
before the upcomming development; we did not want to do such
changes at this stage
* patches/src680/apply: put forms-radio-button-group-names.diff and
xl-import-formradiobutton.diff into RadioButtons section and
mark it experimental
Added:
trunk/patches/test/vba-workbook-worksheet-events.diff
- copied unchanged from r12087, /trunk/patches/vba/vba-workbook-worksheet-events.diff
trunk/patches/vba/vba-workbook-worksheet-events.diff
Modified:
trunk/ChangeLog
trunk/patches/src680/apply
Modified: trunk/patches/src680/apply
==============================================================================
--- trunk/patches/src680/apply (original)
+++ trunk/patches/src680/apply Wed Apr 2 19:00:40 2008
@@ -28,7 +28,7 @@
VBAUntested, ArkOnlyExperimental, SharedWorksheets, \
UnUsedButNotYetRemovedFromSVN, \
PostgreSQL, SELinux, VOSremoval, Glib2, \
- UnitBootstrap
+ UnitBootstrap, RadioButtons
# Binfilter patches: a special distro; applied only when building with binfilter
Binfilter : BFBuildBits, BFFixes, BFShrink
# System patches: a special distro; applied only when building with the system tarball unpacked
@@ -464,11 +464,13 @@
# screws things up
userform-scrollleftandtop.diff, i#87007, noelpwer
+[ RadioButtons ]
# Add a GroupName property to RadioButtons so that RadioButtons don't need to
# share the same name to be part of the same group.
forms-radio-button-group-names.diff, n#310052, jonp
# depends on forms-radio-button-group-names.diff above ( needs bug id too )
xl-import-formradiobutton.diff, noelpwer
+
[ SELinux ]
# make OOo work under SELinux
ooo80816.selinux.bridges.diff, i#80816
Added: trunk/patches/vba/vba-workbook-worksheet-events.diff
==============================================================================
--- (empty file)
+++ trunk/patches/vba/vba-workbook-worksheet-events.diff Wed Apr 2 19:00:40 2008
@@ -0,0 +1,490 @@
+diff -rup /data4/sles/ooo-build-m180/ooo-build/build/ood680-m1/sc/source/ui/docshell/docsh.cxx sc/source/ui/docshell/docsh.cxx
+--- /data4/sles/ooo-build-m180/ooo-build/build/ood680-m1/sc/source/ui/docshell/docsh.cxx 2006-07-21 14:37:27.000000000 +0100
++++ sc/source/ui/docshell/docsh.cxx 2006-09-06 18:21:59.000000000 +0100
+@@ -148,6 +148,11 @@
+ #include <rtl/logfile.hxx>
+ #endif
+
++#include <basic/basmgr.hxx>
++#include <basic/sbmod.hxx>
++#include <basic/sbmeth.hxx>
++#include <basic/sbx.hxx>
++#include "scextopt.hxx"
+ using namespace com::sun::star;
+
+ // STATIC DATA -----------------------------------------------------------
+@@ -190,6 +195,205 @@ static const sal_Char __FAR_DATA pFilter
+ #define ScDocShell
+ #include "scslots.hxx"
+
++const static String sLibrary( RTL_CONSTASCII_USTRINGPARAM("Standard"));
++const static String sModule( RTL_CONSTASCII_USTRINGPARAM("ThisWorkbook"));
++
++const static rtl::OUString sUrlPart0 = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
++const static rtl::OUString sUrlPart1 = rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.");
++const static rtl::OUString sUrlPart2 = rtl::OUString::createFromAscii( "?language=Basic&location=document");
++
++ rtl::OUString getWorkbookModuleName( ScDocShell* pShell )
++{
++ rtl::OUString sCodeName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ThisWorkbook") );
++ if ( pShell )
++ {
++ if ( ScExtDocOptions* pExtDocOpts = pShell->GetDocument()->GetExtDocOptions() )
++ {
++ if ( pExtDocOpts->GetDocSettings().maGlobCodeName.Len() > 0 )
++ sCodeName = pExtDocOpts->GetDocSettings().maGlobCodeName;
++ }
++ }
++ return sCodeName;
++}
++// Treat the args as possible inouts ( convertion at bottom of method )
++bool executeWorkBookMacro( ScDocShell* pShell, const String& sMacroName, uno::Sequence< uno::Any >& aArgs, uno::Any& aRet )
++{
++ // until ObjectModules ( and persisting of codenames ) is supported, if this is a
++ // document saved from XL then we won't be able to determine the codename for the Workbook
++ // Module, so... we have no choice but to search all modules for the moment, thus the macro
++ // passed in should be the fully specified name.
++ //rtl::OUString sCodeName = getWorkbookModuleName( pShell );
++ //rtl::OUString sUrl = sUrlPart1.concat( sCodeName ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".") ) ).concat( sMacroName ).concat( sUrlPart2 );
++ rtl::OUString sUrl = sUrlPart0.concat( sMacroName ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".") ) ).concat( sUrlPart2 ) ;
++ uno::Sequence< sal_Int16 > aOutArgsIndex;
++ uno::Sequence< uno::Any > aOutArgs;
++ ErrCode nErr = pShell->CallXScript( sUrl, aArgs, aRet,
++ aOutArgsIndex, aOutArgs, false );
++
++ // Script Executed?
++ if ( nErr != ERRCODE_NONE )
++ return false;
++
++ sal_Int32 nLen = aOutArgs.getLength();
++ // convert any out params to seem like they were inouts
++ if ( nLen )
++ {
++ for ( sal_Int32 index=0; index < nLen; ++index )
++ {
++ sal_Int32 nOutIndex = aOutArgsIndex[ index ];
++ aArgs[ nOutIndex ] = aOutArgs[ nOutIndex ];
++ }
++
++ }
++ return true;
++}
++String docMacroExists( ScDocShell* pShell,
++const String& sMod, const String& sMacro )
++{
++ String sFullName;
++ // would use the script provider to see if the macro exists but
++ // called at this stage tdoc content handler stuff is not set up
++ // so it fails
++
++ BasicManager* pBasicMgr = pShell-> GetBasicManager();
++ if ( pBasicMgr )
++ {
++ StarBASIC* pBasic = pBasicMgr->GetLib( sLibrary );
++ if ( !pBasic )
++ {
++ USHORT nId = pBasicMgr->GetLibId( sLibrary );
++ pBasicMgr->LoadLib( nId );
++ pBasic = pBasicMgr->GetLib( sLibrary );
++ }
++ if ( pBasic )
++ {
++ if ( sMod.Len() ) // we wish to find the macro is a specific module
++ {
++ SbModule* pModule = pBasic->FindModule( sMod );
++ if ( pModule )
++ {
++ SbxArray* pMethods = pModule->GetMethods();
++ if ( pMethods )
++ {
++ SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Find( sMacro, SbxCLASS_METHOD ) );
++ if ( pMethod )
++ {
++ sFullName = sMacro;
++ sFullName.Insert( '.', 0 ).Insert( sMod, 0 ).Insert( '.', 0 ).Insert( sLibrary, 0 );
++ }
++ }
++ }
++ }
++ else if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sMacro, SbxCLASS_METHOD ) ) )
++ {
++ if( SbModule* pModule = pMethod->GetModule() )
++ {
++ sFullName = sMacro;
++ sFullName.Insert( '.', 0 ).Insert( pModule->GetName(), 0).Insert( '.', 0 ).Insert( sLibrary, 0 );
++ }
++ }
++
++ }
++ }
++ return sFullName;
++}
++
++bool processDocBeforeCloseMacro( ScDocShell* pShell )
++{
++
++ uno::Any aRet;
++ uno::Sequence< uno::Any > aArgs( 1 );
++ bool bCancel = sal_False;
++ aArgs[ 0 ] <<= bCancel;
++ const static String sBeforeClose( RTL_CONSTASCII_USTRINGPARAM("Workbook_BeforeClose") );
++ String sFullClose = docMacroExists( pShell, String(), sBeforeClose );
++ if ( sFullClose.Len() > 0 )
++ {
++ if ( !executeWorkBookMacro( pShell, sFullClose, aArgs, aRet ) )
++ return false;
++ }
++ aArgs[ 0 ] >>= bCancel;
++ return bCancel;
++}
++
++bool addOpenDocEvent( const uno::Reference< container::XNameReplace >& xEvts, const rtl::OUString& sOpenMacro )
++{
++ bool result = false;
++ const rtl::OUString sUrl = sUrlPart0.concat( sOpenMacro ).concat( sUrlPart2 );
++ const static rtl::OUString sEvtType( RTL_CONSTASCII_USTRINGPARAM("EventType") );
++ const static rtl::OUString sScript( RTL_CONSTASCII_USTRINGPARAM("Script") );
++ const static rtl::OUString sEvt( RTL_CONSTASCII_USTRINGPARAM("OnLoad") );
++ if ( xEvts.is() )
++ {
++ uno::Sequence< beans::PropertyValue > aEvents;
++ xEvts->getByName( sEvt ) >>= aEvents;
++ uno::Sequence< beans::PropertyValue > aOpenEvt( 2 );
++ aOpenEvt[ 0 ].Name = sEvtType;
++ aOpenEvt[ 0 ].Value = uno::makeAny(sScript);
++ aOpenEvt[ 1 ].Name = sScript;
++ aOpenEvt[ 1 ].Value = uno::makeAny(sUrl);
++ sal_Int32 nPos = aEvents.getLength();
++
++ sal_Int32 nNewSize = aEvents.getLength() + aOpenEvt.getLength();
++ if ( nNewSize > aEvents.getLength() )
++ aEvents.realloc( nNewSize );
++
++ for ( sal_Int32 nIndex = nPos, nCpyIndex = 0; nIndex<nNewSize; nIndex++, nCpyIndex++ )
++ aEvents[ nIndex ] = aOpenEvt[ nCpyIndex ];
++
++ uno::Any aParam = uno::makeAny( aEvents );
++
++ xEvts->replaceByName( sEvt, aParam );
++ result = true;
++ }
++ return result;
++}
++
++bool processDocOpenMacro( ScDocShell* pShell )
++{
++ bool result = false;
++ // no point adding a handler for unless it exists
++ // probably worth just doing this on import of xl document
++
++
++ // Urk due to async nature, re-enterency and other horrors of the load
++ // process, its seems the most sensible thing is to hook into the
++ // document event broadcaster
++ const static rtl::OUString sOpenMacro( RTL_CONSTASCII_USTRINGPARAM("Workbook_Open") );
++ const static rtl::OUString sAuto_OpenMacro( RTL_CONSTASCII_USTRINGPARAM("auto_open") );
++
++ uno::Reference< document::XEventsSupplier > xEvtSupplier( pShell->GetModel(), uno::UNO_QUERY );
++ String sNull;
++
++ if ( xEvtSupplier.is() )
++ {
++ uno::Reference< container::XNameReplace > xEvts( xEvtSupplier->getEvents(), uno::UNO_QUERY );
++ // until ObjectModules ( and persisting of codename ) are supported if this is a
++ // document saved from XL then we won't be able to determine the codename for the Workbook
++ // Module, so... we have no choice but to search all modules for the moment
++ //rtl::OUString workbookModule = getWorkbookModuleName( pShell );
++ rtl::OUString workbookModule; // no name means all modules will be searched
++ String sFullOpen = docMacroExists( pShell, workbookModule, sOpenMacro );
++ if ( sFullOpen.Len() > 0 )
++ {
++ if ( !addOpenDocEvent( xEvts, sFullOpen ) )
++ return false;
++ }
++ // deep sigh, you can only specify one event binding not multiple ones, thats crap
++/*
++ String sFullAuto = docMacroExists( pShell, workbookModule, sAuto_OpenMacro );
++ if ( sFullAuto.Len() > 0 )
++ {
++ if ( !addOpenDocEvent( xEvts, sFullAuto ) )
++ return false;
++ }
++*/
++ result = true;
++
++ }
++ return result;
++}
++
+
+ SFX_IMPL_INTERFACE(ScDocShell,SfxObjectShell, ScResId(SCSTR_DOCSHELL))
+ {
+@@ -682,7 +866,6 @@ BOOL ScDocShell::SaveXML( SfxMedium* pMe
+ BOOL __EXPORT ScDocShell::Load( SfxMedium& rMedium )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::Load" );
+-
+ ScRefreshTimerProtector( aDocument.GetRefreshTimerControlAddress() );
+
+ // only the latin script language is loaded
+@@ -725,6 +908,10 @@ BOOL __EXPORT ScDocShell::Load( SfxMediu
+ aDocument.InvalidateTableArea();
+
+ bIsEmpty = FALSE;
++
++ // Handler for open workbook event
++ processDocOpenMacro( this );
++
+ FinishedLoading( SFX_LOADED_MAINDOCUMENT | SFX_LOADED_IMAGES );
+ return bRet;
+ }
+@@ -807,7 +994,7 @@ BOOL __EXPORT ScDocShell::ConvertFrom( S
+ ScRefreshTimerProtector( aDocument.GetRefreshTimerControlAddress() );
+
+ GetUndoManager()->Clear();
+-
++
+ // ob nach dem Import optimale Spaltenbreiten gesetzt werden sollen
+ BOOL bSetColWidths = FALSE;
+ BOOL bSetSimpleTextColWidths = FALSE;
+@@ -828,6 +1015,7 @@ BOOL __EXPORT ScDocShell::ConvertFrom( S
+ nCanUpdate = pUpdateDocItem ? pUpdateDocItem->GetValue() : com::sun::star::document::UpdateDocMode::NO_UPDATE;
+
+ const SfxFilter* pFilter = rMedium.GetFilter();
++
+ if (pFilter)
+ {
+ String aFltName = pFilter->GetFilterName();
+@@ -1242,6 +1430,10 @@ BOOL __EXPORT ScDocShell::ConvertFrom( S
+ if ( bSetRowHeights )
+ UpdateAllRowHeights(); // with vdev or printer, depending on configuration
+ }
++
++ // Handler for open workbook event
++ processDocOpenMacro( this );
++
+ FinishedLoading( SFX_LOADED_MAINDOCUMENT | SFX_LOADED_IMAGES );
+
+ // #73762# invalidate eventually temporary table areas
+@@ -2016,7 +2208,6 @@ BOOL __EXPORT ScDocShell::SaveCompleted(
+ return SfxObjectShell::SaveCompleted( xStor );
+ }
+
+-
+ BOOL __EXPORT ScDocShell::DoSaveCompleted( SfxMedium * pNewStor )
+ {
+ BOOL bRet = SfxObjectShell::DoSaveCompleted( pNewStor );
+@@ -2053,6 +2244,11 @@ USHORT __EXPORT ScDocShell::PrepareClose
+
+ DoEnterHandler();
+
++ // start handler for possible veto from DocBefore_Close
++ if ( !IsInPrepareClose() && processDocBeforeCloseMacro( this ) )
++ return sal_False;
++ // end handler code
++
+ USHORT nRet = SfxObjectShell::PrepareClose( bUI, bForBrowsing );
+ if (nRet == TRUE) // TRUE = schliessen
+ aDocument.DisableIdle(TRUE); // nicht mehr drin rumpfuschen !!!
+diff -rup /data4/sles/ooo-build-m180/ooo-build/build/ood680-m1/sc/source/ui/view/tabview5.cxx sc/source/ui/view/tabview5.cxx
+--- /data4/sles/ooo-build-m180/ooo-build/build/ood680-m1/sc/source/ui/view/tabview5.cxx 2006-07-21 16:10:17.000000000 +0100
++++ sc/source/ui/view/tabview5.cxx 2006-09-08 13:59:24.000000000 +0100
+@@ -70,6 +70,7 @@
+ #include "seltrans.hxx"
+ #include "scmod.hxx"
+ #include "AccessibilityHints.hxx"
++#include "scextopt.hxx"
+
+
+ // STATIC DATA -----------------------------------------------------------
+@@ -338,6 +339,27 @@ void ScTabView::TabChanged()
+ aViewData.GetViewShell()->BroadcastAccessibility(aAccHint);
+ }
+ aViewData.GetDocument()->BroadcastUno( SfxSimpleHint( SC_HINT_TABLECHANGED ) );
++ ScExtDocOptions* pExtOptions = aViewData.GetDocument()->GetExtDocOptions();
++ String sSheetModuleName;
++ aViewData.GetDocument()->GetName( aViewData.GetTabNo(), sSheetModuleName);
++ // Use code name if that exists
++ if ( pExtOptions )
++ sSheetModuleName = pExtOptions->GetCodeName( aViewData. GetTabNo() );
++ static String sUrl( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.script:Standard") );
++ static String sUrl2( RTL_CONSTASCII_USTRINGPARAM("?language=Basic&location=document") );
++ static String sSheetActivateScript( RTL_CONSTASCII_USTRINGPARAM("Worksheet_Activate") );
++ String sMacroUrl = sSheetActivateScript;
++ sMacroUrl.Insert( '.', 0 ).Insert( sSheetModuleName, 0 ).Insert( '.', 0 ).Insert( sUrl, 0 );
++ sMacroUrl += sUrl2;
++ com::sun::star::uno::Sequence< sal_Int16 > aOutArgsIndex;
++ com::sun::star::uno::Sequence< com::sun::star::uno::Any > aOutArgs;
++ com::sun::star::uno::Sequence< com::sun::star::uno::Any > aArgs;
++ com::sun::star::uno::Any aRet;
++
++ aViewData.GetSfxDocShell()->CallXScript( sMacroUrl, aArgs, aRet,
++ aOutArgsIndex, aOutArgs, false );
++
++
+ }
+
+ void ScTabView::UpdateLayerLocks()
+--- /data4/sles/ooo-mLnew/ooo-build/build/ooc680-m2/sfx2/inc/objsh.hxx 2006-05-02 17:01:46.000000000 +0100
++++ sfx2/inc/sfx2/objsh.hxx 2006-06-02 13:29:01.000000000 +0100
+@@ -427,7 +427,8 @@ public:
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams,
+ ::com::sun::star::uno::Any& aRet,
+ ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
+- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam
++ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam,
++ bool bRaiseError = true
+ );
+
+ BOOL DoMacroQuery( const String& rScriptType );
+--- /data4/sles/ooo-mLnew/ooo-build/build/ooc680-m2/sfx2/source/doc/objmisc.cxx 2006-05-22 08:25:06.000000000 +0100
++++ sfx2/source/doc/objmisc.cxx 2006-06-02 13:29:02.000000000 +0100
+@@ -1396,7 +1396,7 @@ ErrCode SfxObjectShell::CallXScript( con
+ ::com::sun::star::uno::Any& aRet,
+ ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >&
+- aOutParam)
++ aOutParam, bool bRaiseError )
+ {
+ OSL_TRACE( "in CallXScript" );
+ ErrCode nErr = ERRCODE_NONE;
+@@ -1470,7 +1470,7 @@ ErrCode SfxObjectShell::CallXScript( con
+ nErr = ERRCODE_BASIC_INTERNAL_ERROR;
+ }
+
+- if ( bCaughtException )
++ if ( bCaughtException && bRaiseError )
+ {
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+
+--- backup/sc/source/ui/unoobj/viewuno.cxx 2007-11-26 14:43:13.000000000 +0000
++++ sc/source/ui/unoobj/viewuno.cxx 2008-01-23 17:29:08.000000000 +0000
+@@ -85,9 +85,79 @@
+ #ifndef SC_ACCESSIBILITYHINTS_HXX
+ #include "AccessibilityHints.hxx"
+ #endif
+-
++#include "scextopt.hxx"
++#include <comphelper/processfactory.hxx>
+ using namespace com::sun::star;
++String docMacroExists( ScDocShell* pShell,
++const String& sMod, const String& sMacro );
++bool executeWorkBookMacro( ScDocShell* pShell, const String& sMacroName, uno::Sequence< uno::Any >& aArgs, uno::Any& aRet );
++
++uno::Any createWorkSheet( ScDocShell* pShell, SCTAB nTab )
++{
++ uno::Any aRet;
++ try
++ {
++ uno::Reference< lang::XMultiComponentFactory > xSMgr( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
++ uno::Reference< beans::XPropertySet > xProps( xSMgr, uno::UNO_QUERY_THROW );
++ uno::Reference<uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
++ // Eventually we will be able to pull the Workbook/Worksheet objects
++ // directly from basic and register them as listeners
++
++ // create Workbook
++ uno::Sequence< uno::Any > aArgs(2);
++ aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() );
++ aArgs[1] = uno::Any( pShell->GetModel() );
++ uno::Reference< uno::XInterface > xWorkbook( xSMgr->createInstanceWithArgumentsAndContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Workbook") ), aArgs, xCtx ), uno::UNO_QUERY );
++
++ // create WorkSheet
++ String sSheetName;
++ pShell->GetDocument()->GetName( nTab, sSheetName );
++ aArgs = uno::Sequence< uno::Any >(3);
++ aArgs[ 0 ] <<= xWorkbook;
++ aArgs[ 1 ] <<= pShell->GetModel();
++ aArgs[ 2 ] = uno::makeAny( rtl::OUString( sSheetName ) );
++ aRet <<= xSMgr->createInstanceWithArgumentsAndContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Worksheet") ), aArgs, xCtx );
++ }
++ catch( uno::Exception& e )
++ {
++ }
++ return aRet;
++}
+
++uno::Any createRange( const uno::Any& aRange )
++{
++ uno::Any aRet;
++ try
++ {
++ uno::Reference< sheet::XSheetCellRangeContainer > xRanges( aRange, uno::UNO_QUERY );
++ uno::Reference< table::XCellRange > xRange( aRange, uno::UNO_QUERY );
++ uno::Reference< lang::XMultiComponentFactory > xSMgr( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
++ uno::Reference< beans::XPropertySet > xProps( xSMgr, uno::UNO_QUERY_THROW );
++ if ( xRanges.is() || xRange.is() )
++ {
++ uno::Reference<uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
++ uno::Sequence< uno::Any > aArgs(2);
++ aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() ); // dummy parent
++ if ( xRanges.is() )
++ {
++ aArgs[1] <<= xRanges;
++ }
++ else if ( xRange.is() )
++ {
++ aArgs[1] <<= xRange;
++ }
++ else
++ {
++ throw uno::RuntimeException(); //
++ }
++ aRet <<= xSMgr->createInstanceWithArgumentsAndContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Range") ), aArgs, xCtx );
++ }
++ }
++ catch( uno::Exception& e )
++ {
++ }
++ return aRet;
++}
+ //------------------------------------------------------------------------
+
+ //! Clipping-Markierungen
+@@ -1691,9 +1761,46 @@ void SAL_CALL ScTabViewObj::removeSelect
+ }
+ }
+ }
+-
++bool fireSelectionChangeScript( ScDocShell* pShell, const String& sMacro, uno::Sequence< uno::Any >& aArgs )
++{
++ if ( sMacro.Len() == 0 )
++ return false;
++ uno::Any aRet;
++ return executeWorkBookMacro( pShell, sMacro, aArgs, aRet );
++}
+ void ScTabViewObj::SelectionChanged()
+ {
++ ScTabViewShell* pViewSh = GetViewShell();
++ if ( pViewSh )
++ {
++ ScViewData* pViewData = pViewSh->GetViewData();
++ if ( pViewData )
++ {
++ ScExtDocOptions* pExtOptions = pViewData->GetDocument()->GetExtDocOptions();
++ String sSheetModuleName;
++ pViewData->GetDocument()->GetName( pViewData->GetTabNo(), sSheetModuleName);
++ // Use code name if that exists
++ if ( pExtOptions )
++ sSheetModuleName = pExtOptions->GetCodeName( pViewData->GetTabNo() );
++
++ String sSheetSelectionScript( RTL_CONSTASCII_USTRINGPARAM("Worksheet_SelectionChange") );
++ String sWorkBookSheetSelectionScript( RTL_CONSTASCII_USTRINGPARAM("Workbook_SheetSelectionChange") );
++ String sMacro = docMacroExists( pViewData->GetDocShell(), sSheetModuleName, sSheetSelectionScript );
++ uno::Any aRet;
++ uno::Sequence< uno::Any > aArgs(1);
++ uno::Any aRange = createRange( getSelection() );
++ aArgs[0] = aRange;
++ // Worksheet_SelectionChanged
++ fireSelectionChangeScript( pViewData->GetDocShell(), sMacro, aArgs );
++ aArgs = uno::Sequence< uno::Any >(2);
++ aArgs[0] = createWorkSheet( pViewData->GetDocShell(), pViewData->GetTabNo() );
++ aArgs[1] = aRange;
++ sMacro = docMacroExists( pViewData->GetDocShell(), String(), sWorkBookSheetSelectionScript );
++ // Workbook_SheetSelectionChanged
++ fireSelectionChangeScript( pViewData->GetDocShell(), sMacro, aArgs );
++ }
++ }
++
+ lang::EventObject aEvent;
+ aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
+ for ( USHORT n=0; n<aSelectionListeners.Count(); n++ )
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]