diff options
Diffstat (limited to 'patches/vba/sc-source-ui-vba-vbaapplication-cxx.diff')
-rw-r--r-- | patches/vba/sc-source-ui-vba-vbaapplication-cxx.diff | 142 |
1 files changed, 56 insertions, 86 deletions
diff --git a/patches/vba/sc-source-ui-vba-vbaapplication-cxx.diff b/patches/vba/sc-source-ui-vba-vbaapplication-cxx.diff index 514b7fa02..9bcb02385 100644 --- a/patches/vba/sc-source-ui-vba-vbaapplication-cxx.diff +++ b/patches/vba/sc-source-ui-vba-vbaapplication-cxx.diff @@ -1,6 +1,6 @@ ---- /dev/null 2006-06-16 21:07:58.000000000 +0800 -+++ sc/source/ui/vba/vbaapplication.cxx 2006-09-29 13:11:24.000000000 +0800 -@@ -0,0 +1,506 @@ +--- /dev/null ++++ sc/source/ui/vba/vbaapplication.cxx +@@ -0,0 +1,476 @@ +#include <stdio.h> + + @@ -27,6 +27,7 @@ + +//start test includes +#include <sfx2/objsh.hxx> ++#include <sfx2/viewfrm.hxx> +#include <sfx2/app.hxx> + +#include <toolkit/awt/vclxwindow.hxx> @@ -243,12 +244,7 @@ +uno::Any SAL_CALL +ScVbaApplication::getStatusBar() throw (uno::RuntimeException) +{ -+ uno::Any result; -+ if( getDisplayStatusBar() ) -+ result <<= sal_False; -+ else -+ result <<= sal_True; -+ return result; ++ return uno::makeAny( !getDisplayStatusBar() ); +} + +void SAL_CALL @@ -262,8 +258,8 @@ + if( _statusbar >>= sText ) + { + setDisplayStatusBar( sal_True ); -+ //xStatusIndicator->start( sText, 100 ); -+ xStatusIndicator->setText( sText ); ++ xStatusIndicator->start( sText, 100 ); ++ //xStatusIndicator->setText( sText ); + } + else if( _statusbar >>= bDefault ) + { @@ -340,50 +336,8 @@ +uno::Any SAL_CALL +ScVbaApplication::Range( const uno::Any& Cell1, const uno::Any& Cell2 ) throw (uno::RuntimeException) +{ -+ // Althought the documentation seems clear that Range without a -+ // qualifier then its a shortcut for ActiveSheet.Range -+ // however, similarly Application.Range is apparently also a -+ // shortcut for ActiveSheet.Range -+ // The is however a subtle behavioural difference I've come across -+ // wrt to named ranges. -+ // If a named range "test" exists { Sheet1!$A1 } and the active sheet -+ // is Sheet2 then the following will fail -+ // msgbox ActiveSheet.Range("test").Address ' failes -+ // msgbox WorkSheets("Sheet2").Range("test").Address -+ // but !!! -+ // msgbox Range("test").Address ' works -+ // msgbox Application.Range("test").Address ' works -+ -+ // Single param Range -+ rtl::OUString sRangeName; -+ Cell1 >>= sRangeName; -+ if ( Cell1.hasValue() && !Cell2.hasValue() && sRangeName.getLength() ) -+ { -+ const static rtl::OUString sNamedRanges( RTL_CONSTASCII_USTRINGPARAM("NamedRanges")); -+ uno::Reference< beans::XPropertySet > xPropSet( getCurrentDocument(), uno::UNO_QUERY_THROW ); -+ -+ uno::Reference< container::XNameAccess > xNamed( xPropSet->getPropertyValue( sNamedRanges ), uno::UNO_QUERY_THROW ); -+ uno::Reference< sheet::XCellRangeReferrer > xReferrer; -+ try -+ { -+ xReferrer.set ( xNamed->getByName( sRangeName ), uno::UNO_QUERY ); -+ } -+ catch( uno::Exception& e ) -+ { -+ // do nothing -+ } -+ if ( xReferrer.is() ) -+ { -+ uno::Reference< table::XCellRange > xRange = xReferrer->getReferredCells(); -+ if ( xRange.is() ) -+ { -+ uno::Reference< vba::XRange > xVbRange = new ScVbaRange( m_xContext, xRange ); -+ return uno::makeAny( xVbRange ); -+ } -+ } -+ } -+ -+ return uno::makeAny( getActiveSheet()->Range( Cell1, Cell2 ) ); ++ uno::Reference< vba::XRange > xVbRange = ScVbaRange::ApplicationRange( m_xContext, Cell1, Cell2 ); ++ return uno::makeAny( xVbRange ); +} + +uno::Reference< vba::XWorksheet > SAL_CALL @@ -463,47 +417,63 @@ +sal_Int32 SAL_CALL +ScVbaApplication::getCursor() throw (uno::RuntimeException) +{ -+ SfxViewShell* pView = SfxViewShell::Current(); -+ if( pView ){ -+ //printf("\nget Cursor...%d\n", pView->GetWindow()->GetSystemWindow()->GetPointer().GetStyle()); -+ //return pView->GetWindow()->GetPointer().GetStyle(); -+ return pView->GetWindow()->GetSystemWindow()->GetPointer().GetStyle(); ++ SfxObjectShell* pObject = SfxObjectShell::GetWorkingDocument();//Current(); ++ SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pObject ); ++ sal_Int32 result = pFrame->GetFrame()->GetWindow().GetSystemWindow()->GetPointer().GetStyle(); ++ ++ switch( result ) ++ { ++ case POINTER_ARROW: ++ return vba::Excel::XlMousePointer::xlNorthwestArrow; ++ case POINTER_NULL: ++ return vba::Excel::XlMousePointer::xlDefault; ++ case POINTER_WAIT: ++ return vba::Excel::XlMousePointer::xlWait; ++ case POINTER_TEXT: ++ return vba::Excel::XlMousePointer::xlIBeam; ++ default: ++ return vba::Excel::XlMousePointer::xlDefault; + } -+ return vba::Excel::XlMousePointer::xlDefault; +} + +void SAL_CALL +ScVbaApplication::setCursor( sal_Int32 _cursor ) throw (uno::RuntimeException) +{ -+ SfxViewShell* pView;// = SfxViewShell::Current(); -+ pView = SfxViewShell::GetFirst(); -+ switch( _cursor ) ++ SfxObjectShell* pObject = SfxObjectShell::GetWorkingDocument(); ++ for( SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pObject ); pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, pObject ) ) + { -+ case vba::Excel::XlMousePointer::xlNorthwestArrow: -+ case vba::Excel::XlMousePointer::xlWait: -+ case vba::Excel::XlMousePointer::xlIBeam: -+ while( pView ){ ++ switch( _cursor ) ++ { ++ case vba::Excel::XlMousePointer::xlNorthwestArrow: ++ { ++ const Pointer& rPointer( POINTER_ARROW ); ++ pFrame->GetFrame()->GetWindow().GetSystemWindow()->SetPointer( rPointer ); ++ pFrame->GetFrame()->GetWindow().GetSystemWindow()->EnableChildPointerOverwrite( sal_False ); ++ break; ++ } ++ case vba::Excel::XlMousePointer::xlWait: ++ case vba::Excel::XlMousePointer::xlIBeam: ++ { + const Pointer& rPointer( _cursor ); + //It will set the edit window, toobar and statusbar's mouse pointer. -+ pView->GetWindow()->GetSystemWindow()->SetPointer( rPointer ); -+ pView->GetWindow()->GetSystemWindow()->EnableChildPointerOverwrite( sal_True ); ++ pFrame->GetFrame()->GetWindow().GetSystemWindow()->SetPointer( rPointer ); ++ pFrame->GetFrame()->GetWindow().GetSystemWindow()->EnableChildPointerOverwrite( sal_True ); + //It only set the edit window's mouse pointer -+ //pView->GetWindow()->SetPointer( rPointer ); -+ //pView->GetWindow()->EnableChildPointerOverwrite( sal_True ); -+ //printf("\nset Cursor...%d\n", pView->GetWindow()->GetType()/*GetPointer().GetStyle()*/); -+ pView = SfxViewShell::GetNext( *pView ); ++ //pFrame->GetFrame()->GetWindow().SetPointer( rPointer ); ++ //pFrame->GetFrame()->GetWindow().EnableChildPointerOverwrite( sal_True ); ++ //printf("\nset Cursor...%d\n", pFrame->GetFrame()->GetWindow().GetType()); ++ break; + } -+ break; -+ case vba::Excel::XlMousePointer::xlDefault: -+ while( pView ){ -+ const Pointer& rPointer( 0 ); -+ pView->GetWindow()->GetSystemWindow()->SetPointer( rPointer ); -+ pView->GetWindow()->GetSystemWindow()->EnableChildPointerOverwrite( sal_False ); -+ pView = SfxViewShell::GetNext( *pView ); ++ case vba::Excel::XlMousePointer::xlDefault: ++ { ++ const Pointer& rPointer( POINTER_NULL ); ++ pFrame->GetFrame()->GetWindow().GetSystemWindow()->SetPointer( rPointer ); ++ pFrame->GetFrame()->GetWindow().GetSystemWindow()->EnableChildPointerOverwrite( sal_False ); ++ break; + } -+ break; -+ default: -+ throw uno::RuntimeException( rtl::OUString( -+ RTL_CONSTASCII_USTRINGPARAM("Unknown value for Cursor pointer")), uno::Reference< uno::XInterface >() ); -+ } ++ default: ++ throw uno::RuntimeException( rtl::OUString( ++ RTL_CONSTASCII_USTRINGPARAM("Unknown value for Cursor pointer")), uno::Reference< uno::XInterface >() ); ++ } ++ } +} |