From 5d8ada69d05e780ae943fe357b20f890f50526d6 Mon Sep 17 00:00:00 2001 From: "Michael E. Bohn" Date: Thu, 19 Aug 2010 00:33:36 +0200 Subject: mib19: #163374# Fix for vbproject inizialistion --- vbahelper/source/vbahelper/vbadocumentbase.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vbahelper') diff --git a/vbahelper/source/vbahelper/vbadocumentbase.cxx b/vbahelper/source/vbahelper/vbadocumentbase.cxx index 65f7f4bcfbeb..a3798e0369ed 100644 --- a/vbahelper/source/vbahelper/vbadocumentbase.cxx +++ b/vbahelper/source/vbahelper/vbadocumentbase.cxx @@ -213,7 +213,7 @@ VbaDocumentBase::getVBProject() throw (uno::RuntimeException) { uno::Sequence< uno::Any > aArgs( 2 ); aArgs[ 0 ] <<= uno::Reference< XHelperInterface >( this ); - aArgs[ 1 ] <<= mxModel; + aArgs[ 1 ] <<= getModel(); uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_SET_THROW ); uno::Reference< uno::XInterface > xVBProjects = xServiceManager->createInstanceWithArgumentsAndContext( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBProject" ) ), aArgs, mxContext ); -- cgit From dc459575467d9c444fd328dade90c0d2240795ff Mon Sep 17 00:00:00 2001 From: "Michael E. Bohn" Date: Mon, 23 Aug 2010 01:15:52 +0200 Subject: mib19: #163399# changes so that functions use right documentname to find the right docshell. --- vbahelper/source/vbahelper/vbaapplicationbase.cxx | 49 +---------------------- vbahelper/source/vbahelper/vbadocumentbase.cxx | 3 +- 2 files changed, 3 insertions(+), 49 deletions(-) (limited to 'vbahelper') diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx index 326c150edade..7c0aff2d6885 100644 --- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx +++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx @@ -295,54 +295,7 @@ VbaApplicationBase::getVersion() throw (uno::RuntimeException) void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const uno::Any& varg1, const uno::Any& varg2, const uno::Any& varg3, const uno::Any& varg4, const uno::Any& varg5, const uno::Any& varg6, const uno::Any& varg7, const uno::Any& varg8, const uno::Any& varg9, const uno::Any& varg10, const uno::Any& varg11, const uno::Any& varg12, const uno::Any& varg13, const uno::Any& varg14, const uno::Any& varg15, const uno::Any& varg16, const uno::Any& varg17, const uno::Any& varg18, const uno::Any& varg19, const uno::Any& varg20, const uno::Any& varg21, const uno::Any& varg22, const uno::Any& varg23, const uno::Any& varg24, const uno::Any& varg25, const uno::Any& varg26, const uno::Any& varg27, const uno::Any& varg28, const uno::Any& varg29, const uno::Any& varg30 ) throw (uno::RuntimeException) { - ::rtl::OUString sSeparator = ::rtl::OUString::createFromAscii("/"); - ::rtl::OUString sMacroSeparator = ::rtl::OUString::createFromAscii("!"); - ::rtl::OUString sMacro_only_Name; - sal_Int32 Position_MacroSeparator = MacroName.indexOf(sMacroSeparator); - - uno::Reference< frame::XModel > aMacroDocumentModel; - if (-1 != Position_MacroSeparator) - { - uno::Reference< container::XEnumerationAccess > xComponentEnumAccess; - uno::Reference< lang::XMultiComponentFactory > xServiceManager = mxContext->getServiceManager(); - try - { - uno::Reference< frame::XDesktop > xDesktop (xServiceManager->createInstanceWithContext( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )),mxContext ), uno::UNO_QUERY_THROW ); - xComponentEnumAccess = xDesktop->getComponents(); - } - catch(uno::Exception&) - { - } - - //rem look for the name of the document in the cmpoonents collection - uno::Reference < container::XEnumeration > xEnum = xComponentEnumAccess->createEnumeration(); - - // iterate through the collection by name - while (xEnum->hasMoreElements()) - { - // get the next element as a UNO Any - uno::Any aComponentHelper = xEnum->nextElement(); - uno::Reference xDocModel( aComponentHelper, uno::UNO_QUERY_THROW ); - - // get the name of the sheet from its XNamed interface - ::rtl::OUString aName = xDocModel->getURL(); - - - if (aName.match(MacroName.copy(0,Position_MacroSeparator-1),aName.lastIndexOf(sSeparator)+1)) - { - aMacroDocumentModel = xDocModel; - sMacro_only_Name = MacroName.copy(Position_MacroSeparator+1); - } - } - } - else - { - aMacroDocumentModel = getCurrentDocument(); - sMacro_only_Name = MacroName.copy(0); - } - - - VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( getSfxObjShell( aMacroDocumentModel ), sMacro_only_Name ); + VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( getSfxObjShell( getCurrentDocument() ), MacroName ); if( aMacroInfo.IsResolved() ) { // handle the arguments diff --git a/vbahelper/source/vbahelper/vbadocumentbase.cxx b/vbahelper/source/vbahelper/vbadocumentbase.cxx index a3798e0369ed..6023be1fd9d2 100644 --- a/vbahelper/source/vbahelper/vbadocumentbase.cxx +++ b/vbahelper/source/vbahelper/vbadocumentbase.cxx @@ -74,7 +74,8 @@ VbaDocumentBase::getName() throw (uno::RuntimeException) uno::Reference< beans::XPropertySet > xProps( xFrame, uno::UNO_QUERY_THROW ); xProps->getPropertyValue(sTitle ) >>= sName; sal_Int32 pos = 0; - sName = sName.getToken(0,' ',pos); + sName = sName.getToken(0,'-',pos); + sName = sName.trim(); } return sName; } -- cgit From df970ca6a70349f6e887661fe6164a1c857c5cdb Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Mon, 23 Aug 2010 13:53:47 +0200 Subject: mib19: improved event handling: do not supreppress global events, when Application.EnableEvents symbol set to false --- vbahelper/inc/vbahelper/vbaeventshelperbase.hxx | 4 --- vbahelper/source/vbahelper/vbaeventshelperbase.cxx | 29 ++++++++++------------ 2 files changed, 13 insertions(+), 20 deletions(-) (limited to 'vbahelper') diff --git a/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx b/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx index 89d355db71f9..b637b742b26c 100755 --- a/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx +++ b/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx @@ -105,10 +105,6 @@ protected: }; typedef ::std::deque< EventQueueEntry > EventQueue; - /** Derived classes return whether event processing is enabled. Throws if - the instance is in an invalid state. */ - virtual bool implEventsEnabled() throw (css::uno::RuntimeException) = 0; - /** Derived classes do additional prpeparations and return whether the event handler has to be called. */ virtual bool implPrepareEvent( diff --git a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx index 16a8671df601..840008e6b979 100755 --- a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx +++ b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx @@ -74,10 +74,6 @@ void SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, const un EventQueue aEventQueue; aEventQueue.push_back( EventQueueEntry( nEventId, rArgs ) ); - /* bEnabled will track if event processing is enabled. Every event handler - may disable handling of other events. */ - bool bEnabled = true; - /* bCancel will contain the current Cancel value. It is possible that multiple events will try to modify the Cancel value. Every event handler receives the Cancel value of the previous event handler. */ @@ -87,10 +83,10 @@ void SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, const un executed successfully. */ bool bSuccess = false; - /* Loop as long as there are more events to be processed, and as event - handling is still enabled. Derived classes may add new events to be - processed in the virtual implPrepareEvent() function. */ - while( bEnabled && !aEventQueue.empty() ) + /* Loop as long as there are more events to be processed. Derived classes + may add new events to be processed in the virtual implPrepareEvent() + function. */ + while( !aEventQueue.empty() ) { /* Check that all class members are available, and that we are not disposed (this may have happened at any time during execution of @@ -103,14 +99,14 @@ void SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, const un uno::Sequence< uno::Any > aEventArgs = aEventQueue.front().maArgs; aEventQueue.pop_front(); - // let derived classes decide whether event processing is still enabled - bEnabled = implEventsEnabled(); - // let derived classes prepare the event, they may add new events for next iteration - if( bEnabled && implPrepareEvent( aEventQueue, rInfo, aEventArgs ) ) + /* Let derived classes prepare the event, they may add new events for + next iteration. If false is returned, the event handler must not be + called. */ + bool bEventSuccess = false; + if( implPrepareEvent( aEventQueue, rInfo, aEventArgs ) ) { // search the event handler macro in the document ::rtl::OUString aMacroPath = getEventHandlerPath( rInfo, aEventArgs ); - bool bEventSuccess = false; if( aMacroPath.getLength() > 0 ) { // build the argument list @@ -139,11 +135,11 @@ void SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, const un bCancel = nNewCancel != 0; } } - // post processing (also, if event handler does not exist, or on error - implPostProcessEvent( aEventQueue, rInfo, bEventSuccess, bCancel ); // global success, if at least one event handler succeeded bSuccess |= bEventSuccess; } + // post processing (also, if event handler does not exist, or disabled, or on error + implPostProcessEvent( aEventQueue, rInfo, bEventSuccess, bCancel ); } // if event handlers want to cancel the event, do so regardless of any errors @@ -200,7 +196,8 @@ const VbaEventsHelperBase::EventHandlerInfo& VbaEventsHelperBase::getEventHandle append( sal_Unicode( '.' ) ).append( rInfo.maMacroName ).makeStringAndClear(); break; } - return resolveVBAMacro( mpShell, aMacroName ).ResolvedMacro(); + VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( mpShell, aMacroName, false ); + return aMacroInfo.IsResolved() ? aMacroInfo.ResolvedMacro() : ::rtl::OUString(); } void VbaEventsHelperBase::stopListening() -- cgit From 3a174f37ece7030171f7ca4907bccfaf065ccf5c Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Mon, 23 Aug 2010 15:23:52 +0200 Subject: mib19: #163105# center UserForm on window on opening --- vbahelper/source/msforms/vbauserform.cxx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'vbahelper') diff --git a/vbahelper/source/msforms/vbauserform.cxx b/vbahelper/source/msforms/vbauserform.cxx index a1333e0a655b..ae0ecce0a955 100644 --- a/vbahelper/source/msforms/vbauserform.cxx +++ b/vbahelper/source/msforms/vbauserform.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -64,9 +65,25 @@ ScVbaUserForm::Show( ) throw (uno::RuntimeException) { OSL_TRACE("ScVbaUserForm::Show( )"); short aRet = 0; - mbDispose = true; + mbDispose = true; + if ( m_xDialog.is() ) + { + // try to center dialog on model window + if( m_xModel.is() ) try + { + uno::Reference< frame::XController > xController( m_xModel->getCurrentController(), uno::UNO_SET_THROW ); + uno::Reference< frame::XFrame > xFrame( xController->getFrame(), uno::UNO_SET_THROW ); + uno::Reference< awt::XWindow > xWindow( xFrame->getContainerWindow(), uno::UNO_SET_THROW ); + awt::Rectangle aPosSize = xWindow->getPosSize(); // already in pixel + setLeft( (aPosSize.Width - getWidth()) / 2.0 ); + setTop( (aPosSize.Height - getHeight()) / 2.0 ); + } + catch( uno::Exception& ) + { + } aRet = m_xDialog->execute(); + } OSL_TRACE("ScVbaUserForm::Show() execute returned %d", aRet); if ( mbDispose ) { -- cgit From bd215a796f9ff124bd291571e49526b6a54df247 Mon Sep 17 00:00:00 2001 From: "Michael E. Bohn" Date: Tue, 24 Aug 2010 13:14:28 +0200 Subject: mib19 #163409# set the macro exeution mode during workbooks.add --- vbahelper/source/vbahelper/vbadocumentsbase.cxx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'vbahelper') diff --git a/vbahelper/source/vbahelper/vbadocumentsbase.cxx b/vbahelper/source/vbahelper/vbadocumentsbase.cxx index 2d4175b90939..f7af3a43d977 100644 --- a/vbahelper/source/vbahelper/vbadocumentsbase.cxx +++ b/vbahelper/source/vbahelper/vbadocumentsbase.cxx @@ -215,7 +215,13 @@ VbaDocumentsBase::VbaDocumentsBase( const uno::Reference< XHelperInterface >& xP uno::Any SAL_CALL VbaDocumentsBase::Add() throw (uno::RuntimeException) { - uno::Reference< lang::XMultiComponentFactory > xSMgr( + uno::Sequence< beans::PropertyValue > aArgs( 1 ); + beans::PropertyValue aArg; + aArg.Name = ::rtl::OUString::createFromAscii("MacroExecutionMode"); + aArg.Value = uno::Any(com::sun::star::document::MacroExecMode::USE_CONFIG); + aArgs[ 0 ] = aArg; + + uno::Reference< lang::XMultiComponentFactory > xSMgr( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); uno::Reference< frame::XComponentLoader > xLoader( @@ -231,8 +237,7 @@ VbaDocumentsBase::Add() throw (uno::RuntimeException) throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); uno::Reference< lang::XComponent > xComponent = xLoader->loadComponentFromURL( sURL , - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_blank") ), 0, - uno::Sequence< beans::PropertyValue >(0) ); + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_blank") ), 0, aArgs ); return uno::makeAny( xComponent ); } -- cgit From 586a71afdb0bed549f59eeb9b8b1fbf7290c8f0d Mon Sep 17 00:00:00 2001 From: "Michael E. Bohn" Date: Tue, 24 Aug 2010 13:23:34 +0200 Subject: mib19: #163415# macroname is trimmed before searching for it. --- vbahelper/source/vbahelper/vbaapplicationbase.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vbahelper') diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx index 7c0aff2d6885..7fdfa75795ef 100644 --- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx +++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx @@ -295,7 +295,7 @@ VbaApplicationBase::getVersion() throw (uno::RuntimeException) void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const uno::Any& varg1, const uno::Any& varg2, const uno::Any& varg3, const uno::Any& varg4, const uno::Any& varg5, const uno::Any& varg6, const uno::Any& varg7, const uno::Any& varg8, const uno::Any& varg9, const uno::Any& varg10, const uno::Any& varg11, const uno::Any& varg12, const uno::Any& varg13, const uno::Any& varg14, const uno::Any& varg15, const uno::Any& varg16, const uno::Any& varg17, const uno::Any& varg18, const uno::Any& varg19, const uno::Any& varg20, const uno::Any& varg21, const uno::Any& varg22, const uno::Any& varg23, const uno::Any& varg24, const uno::Any& varg25, const uno::Any& varg26, const uno::Any& varg27, const uno::Any& varg28, const uno::Any& varg29, const uno::Any& varg30 ) throw (uno::RuntimeException) { - VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( getSfxObjShell( getCurrentDocument() ), MacroName ); + VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( getSfxObjShell( getCurrentDocument() ), MacroName.trim() ); if( aMacroInfo.IsResolved() ) { // handle the arguments -- cgit From d2ab8942a1b6ab8507dbf4c8b3042991558eb44c Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Tue, 24 Aug 2010 15:50:24 +0200 Subject: mib19: #163216# handle the case when the model is already disposed --- vbahelper/source/vbahelper/vbadocumentbase.cxx | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'vbahelper') diff --git a/vbahelper/source/vbahelper/vbadocumentbase.cxx b/vbahelper/source/vbahelper/vbadocumentbase.cxx index 6023be1fd9d2..ad7ea62cd613 100644 --- a/vbahelper/source/vbahelper/vbadocumentbase.cxx +++ b/vbahelper/source/vbahelper/vbadocumentbase.cxx @@ -28,6 +28,8 @@ #include "vbahelper/vbadocumentbase.hxx" #include "vbahelper/helperdecl.hxx" +#include +#include #include #include #include @@ -36,6 +38,7 @@ #include //Michael E. Bohn #include +#include #include #include #include @@ -182,7 +185,22 @@ void VbaDocumentBase::setSaved( sal_Bool bSave ) throw (uno::RuntimeException) { uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW ); - xModifiable->setModified( !bSave ); + try + { + xModifiable->setModified( !bSave ); + } + catch ( lang::DisposedException& ) + { + // impossibility to set the modified state on disposed document should not trigger an error + } + catch ( beans::PropertyVetoException& ) + { + uno::Any aCaught( ::cppu::getCaughtException() ); + throw lang::WrappedTargetRuntimeException( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't change modified state of model!" ) ), + uno::Reference< uno::XInterface >(), + aCaught ); + } } sal_Bool -- cgit From 6e9b786ff6a7f2efca0b8ff4db9215202878a8ca Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Thu, 26 Aug 2010 19:24:07 +0200 Subject: mib19: #i163287# handle the dialog size in the way VBA does it --- vbahelper/inc/vbahelper/vbahelper.hxx | 7 +- vbahelper/source/vbahelper/vbahelper.cxx | 322 +++++++++++-------------------- 2 files changed, 115 insertions(+), 214 deletions(-) (limited to 'vbahelper') diff --git a/vbahelper/inc/vbahelper/vbahelper.hxx b/vbahelper/inc/vbahelper/vbahelper.hxx index ccabb9114f2d..4c4a9f5d7204 100644 --- a/vbahelper/inc/vbahelper/vbahelper.hxx +++ b/vbahelper/inc/vbahelper/vbahelper.hxx @@ -194,11 +194,8 @@ public: #define VBA_WIDTH "Width" class VBAHELPER_DLLPUBLIC UserFormGeometryHelper : public AbstractGeometryAttributes { - css::uno::Reference< css::awt::XUnitConversion > mxControlUnits; - css::uno::Reference< css::beans::XPropertySet > mxModel; - - sal_Int32 ConvertLogicToPixel( sal_Int32 nValue, sal_Bool bIsPoint, sal_Bool bIsX, sal_Int16 nSourceUnit ); - sal_Int32 ConvertPixelToLogic( sal_Int32 nValue, sal_Bool bIsPoint, sal_Bool bIsX, sal_Int16 nTargetUnit ); + css::uno::Reference< css::awt::XWindow > mxWindow; + sal_Bool mbDialog; public: UserFormGeometryHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::awt::XControl >& xControl ); diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx index 14f4e3ff1363..fa80e8dc9234 100644 --- a/vbahelper/source/vbahelper/vbahelper.cxx +++ b/vbahelper/source/vbahelper/vbahelper.cxx @@ -39,6 +39,9 @@ #include #include #include +#include +#include +#include #include @@ -989,277 +992,178 @@ sal_Bool setPropertyValue( uno::Sequence< beans::PropertyValue >& aProp, const r // ====UserFormGeomentryHelper==== //--------------------------------------------- UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComponentContext >& /*xContext*/, const uno::Reference< awt::XControl >& xControl ) +: mbDialog( uno::Reference< awt::XDialog >( xControl, uno::UNO_QUERY ).is() ) { if ( !xControl.is() ) - throw uno::RuntimeException(); - - mxControlUnits.set( xControl->getPeer(), uno::UNO_QUERY_THROW ); - mxModel.set( xControl->getModel(), uno::UNO_QUERY_THROW ); -} - -//--------------------------------------------- -sal_Int32 UserFormGeometryHelper::ConvertPixelToLogic( sal_Int32 nValue, sal_Bool bIsPoint, sal_Bool bIsX, sal_Int16 nTargetUnit ) -{ - sal_Int32 nResult = 0; - if ( bIsPoint ) - { - // conversion for a point - awt::Point aPixelPoint( 0, 0 ); - ( bIsX ? aPixelPoint.X : aPixelPoint.Y ) = nValue; - awt::Point aTargetPoint( 0, 0 ); - aTargetPoint = mxControlUnits->convertPointToLogic( aPixelPoint, nTargetUnit ); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No control is provided!" ) ), + uno::Reference< uno::XInterface >() ); - nResult = bIsX ? aTargetPoint.X : aTargetPoint.Y; - } - else - { - // conversion for a size - awt::Size aPixelSize( 0, 0 ); - ( bIsX ? aPixelSize.Width : aPixelSize.Height ) = nValue; - awt::Size aTargetSize( 0, 0 ); - aTargetSize = mxControlUnits->convertSizeToLogic( aPixelSize, nTargetUnit ); - - nResult = bIsX ? aTargetSize.Width : aTargetSize.Height; - } - - return nResult; + mxWindow.set( xControl->getPeer(), uno::UNO_QUERY_THROW ); } -//--------------------------------------------- -sal_Int32 UserFormGeometryHelper::ConvertLogicToPixel( sal_Int32 nValue, sal_Bool bIsPoint, sal_Bool bIsX, sal_Int16 nSourceUnit ) -{ - sal_Int32 nResult = 0; - if ( bIsPoint ) - { - // conversion for a point - awt::Point aSourcePoint( 0, 0 ); - ( bIsX ? aSourcePoint.X : aSourcePoint.Y ) = nValue; - - awt::Point aPixelPoint( 0, 0 ); - aPixelPoint = mxControlUnits->convertPointToPixel( aSourcePoint, nSourceUnit ); - - nResult = bIsX ? aPixelPoint.X : aPixelPoint.Y; - } - else - { - // conversion for a size - awt::Size aSourceSize( 0, 0 ); - ( bIsX ? aSourceSize.Width : aSourceSize.Height ) = nValue; - - awt::Size aPixelSize( 0, 0 ); - aPixelSize = mxControlUnits->convertSizeToPixel( aSourceSize, nSourceUnit ); - - nResult = bIsX ? aPixelSize.Width : aPixelSize.Height; - } - - return nResult; -} //--------------------------------------------- double UserFormGeometryHelper::getLeft() { - double nResult = 0; - - try - { - sal_Int32 nLeft = 0; - mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ) ) >>= nLeft; - nResult = ConvertLogicToPixel( nLeft, - sal_True, // Point - sal_True, // X - util::MeasureUnit::APPFONT ); - } - catch ( uno::RuntimeException& ) + if ( mbDialog ) { - throw; - } - catch ( uno::Exception& e ) - { - throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not get position X!" ) ), - uno::Reference< uno::XInterface >(), - uno::makeAny( e ) ); + const Window* pWindow = VCLUnoHelper::GetWindow( mxWindow ); + if ( pWindow ) + { + // get the size with decoration + Rectangle aResult = pWindow->GetWindowExtentsRelative( NULL ); + return aResult.getX(); + } } - return nResult; + return mxWindow->getPosSize().X; } //--------------------------------------------- void UserFormGeometryHelper::setLeft( double nLeft ) { - try - { - mxModel->setPropertyValue( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ), - uno::makeAny( ConvertPixelToLogic( nLeft, - sal_True, // Point - sal_True, // X - util::MeasureUnit::APPFONT ) ) ); - } - catch ( uno::RuntimeException& ) + sal_Int64 nNewLeft = nLeft; + if ( mbDialog ) { - throw; - } - catch ( uno::Exception& e ) - { - throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not set position X!" ) ), - uno::Reference< uno::XInterface >(), - uno::makeAny( e ) ); + const Window* pWindow = VCLUnoHelper::GetWindow( mxWindow ); + if ( pWindow ) + { + // set the size with decoration + Rectangle aRDecor = pWindow->GetWindowExtentsRelative( NULL ); + if ( !aRDecor.IsEmpty() ) + { + sal_Int64 nDecor = aRDecor.getX(); + sal_Int64 nUnDecor = mxWindow->getPosSize().X; + nNewLeft = nLeft + nUnDecor - nDecor; + } + } } + + mxWindow->setPosSize( nNewLeft, 0, 0, 0, awt::PosSize::X ); } //--------------------------------------------- double UserFormGeometryHelper::getTop() { - double nResult = 0; - - try + if ( mbDialog ) { - sal_Int32 nTop = 0; - mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ) ) >>= nTop; - nResult = ConvertLogicToPixel( nTop, - sal_True, // Point - sal_False, // Y - util::MeasureUnit::APPFONT ); - } - catch ( uno::RuntimeException& ) - { - throw; - } - catch ( uno::Exception& e ) - { - throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not get position Y!" ) ), - uno::Reference< uno::XInterface >(), - uno::makeAny( e ) ); + const Window* pWindow = VCLUnoHelper::GetWindow( mxWindow ); + if ( pWindow ) + { + // get the size with decoration + Rectangle aResult = pWindow->GetWindowExtentsRelative( NULL ); + return aResult.getY(); + } } - return nResult; + return mxWindow->getPosSize().Y; } //--------------------------------------------- void UserFormGeometryHelper::setTop( double nTop ) { - try - { - mxModel->setPropertyValue( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ), - uno::makeAny( ConvertPixelToLogic( nTop, - sal_True, // Point - sal_False, // Y - util::MeasureUnit::APPFONT ) ) ); - } - catch ( uno::RuntimeException& ) + sal_Int64 nNewTop = nTop; + if ( mbDialog ) { - throw; - } - catch ( uno::Exception& e ) - { - throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not set position X!" ) ), - uno::Reference< uno::XInterface >(), - uno::makeAny( e ) ); + const Window* pWindow = VCLUnoHelper::GetWindow( mxWindow ); + if ( pWindow ) + { + // set the size with decoration + Rectangle aRDecor = pWindow->GetWindowExtentsRelative( NULL ); + if ( !aRDecor.IsEmpty() ) + { + sal_Int64 nDecor = aRDecor.getY(); + sal_Int64 nUnDecor = mxWindow->getPosSize().Y; + nNewTop = nTop + nUnDecor - nDecor; + } + } } + + mxWindow->setPosSize( 0, nNewTop, 0, 0, awt::PosSize::Y ); } //--------------------------------------------- double UserFormGeometryHelper::getWidth() { - double nResult = 0; - - try + if ( mbDialog ) { - sal_Int32 nWidth = 0; - mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_WIDTH ) ) ) >>= nWidth; - nResult = ConvertLogicToPixel( nWidth, - sal_False, // Size - sal_True, // X - util::MeasureUnit::APPFONT ); - } - catch ( uno::RuntimeException& ) - { - throw; - } - catch ( uno::Exception& e ) - { - throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not get width!" ) ), - uno::Reference< uno::XInterface >(), - uno::makeAny( e ) ); + const Window* pWindow = VCLUnoHelper::GetWindow( mxWindow ); + if ( pWindow ) + { + // get the size with decoration + Rectangle aResult = pWindow->GetWindowExtentsRelative( NULL ); + return aResult.getWidth(); + } } - return nResult; + return mxWindow->getPosSize().Width; } //--------------------------------------------- -void UserFormGeometryHelper::setWidth( double nWidth) +void UserFormGeometryHelper::setWidth( double nWidth ) { - try - { - mxModel->setPropertyValue( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_WIDTH ) ), - uno::makeAny( ConvertPixelToLogic( nWidth, - sal_False, // Size - sal_True, // X - util::MeasureUnit::APPFONT ) ) ); - } - catch ( uno::RuntimeException& ) - { - throw; - } - catch ( uno::Exception& e ) + sal_Int64 nNewWidth = nWidth; + + if ( mbDialog ) { - throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not set width!" ) ), - uno::Reference< uno::XInterface >(), - uno::makeAny( e ) ); + const Window* pWindow = VCLUnoHelper::GetWindow( mxWindow ); + if ( pWindow ) + { + // set the size with decoration + Rectangle aRDecor = pWindow->GetWindowExtentsRelative( NULL ); + if ( !aRDecor.IsEmpty() ) + { + sal_Int64 nDecor = aRDecor.getWidth(); + sal_Int64 nUnDecor = mxWindow->getPosSize().Width; + if ( nWidth < nDecor - nUnDecor ) + nUnDecor = nDecor - nWidth; // avoid negative size + nNewWidth = nWidth + nUnDecor - nDecor; + } + } } + + mxWindow->setPosSize( 0, 0, nNewWidth, 0, awt::PosSize::WIDTH ); } //--------------------------------------------- double UserFormGeometryHelper::getHeight() { - double nResult = 0; - - try - { - sal_Int32 nHeight = 0; - mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_HEIGHT ) ) ) >>= nHeight; - nResult = ConvertLogicToPixel( nHeight, - sal_False, // Size - sal_False, // Y - util::MeasureUnit::APPFONT ); - } - catch ( uno::RuntimeException& ) + if ( mbDialog ) { - throw; - } - catch ( uno::Exception& e ) - { - throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not get height!" ) ), - uno::Reference< uno::XInterface >(), - uno::makeAny( e ) ); + const Window* pWindow = VCLUnoHelper::GetWindow( mxWindow ); + if ( pWindow ) + { + // get the size with decoration + Rectangle aResult = pWindow->GetWindowExtentsRelative( NULL ); + return aResult.getHeight(); + } } - return nResult; + return mxWindow->getPosSize().Height; } //--------------------------------------------- void UserFormGeometryHelper::setHeight( double nHeight ) { - try - { - mxModel->setPropertyValue( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_HEIGHT ) ), - uno::makeAny( ConvertPixelToLogic( nHeight, - sal_False, // Size - sal_False, // Y - util::MeasureUnit::APPFONT ) ) ); - } - catch ( uno::RuntimeException& ) - { - throw; - } - catch ( uno::Exception& e ) + sal_Int64 nNewHeight = nHeight; + if ( mbDialog ) { - throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not set height!" ) ), - uno::Reference< uno::XInterface >(), - uno::makeAny( e ) ); + const Window* pWindow = VCLUnoHelper::GetWindow( mxWindow ); + if ( pWindow ) + { + // set the size with decoration + Rectangle aRDecor = pWindow->GetWindowExtentsRelative( NULL ); + if ( !aRDecor.IsEmpty() ) + { + sal_Int64 nDecor = aRDecor.getHeight(); + sal_Int64 nUnDecor = mxWindow->getPosSize().Height; + if ( nHeight < nDecor - nUnDecor ) + nUnDecor = nDecor - nHeight; // avoid negative size + nNewHeight = nHeight + nUnDecor - nDecor; + } + } } + + mxWindow->setPosSize( 0, 0, 0, nNewHeight, awt::PosSize::HEIGHT ); } // ============ -- cgit From 99523481ef58307f6d0cd849a712905e619f584c Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Fri, 27 Aug 2010 15:51:26 +0200 Subject: mib19: #i163287# fix the dialog position handling, change position after the dialog has been started --- vbahelper/source/msforms/vbauserform.cxx | 2 +- vbahelper/source/vbahelper/vbahelper.cxx | 60 ++------------------------------ 2 files changed, 3 insertions(+), 59 deletions(-) (limited to 'vbahelper') diff --git a/vbahelper/source/msforms/vbauserform.cxx b/vbahelper/source/msforms/vbauserform.cxx index ae0ecce0a955..027c6a7384bc 100644 --- a/vbahelper/source/msforms/vbauserform.cxx +++ b/vbahelper/source/msforms/vbauserform.cxx @@ -69,6 +69,7 @@ ScVbaUserForm::Show( ) throw (uno::RuntimeException) if ( m_xDialog.is() ) { + aRet = m_xDialog->execute(); // try to center dialog on model window if( m_xModel.is() ) try { @@ -82,7 +83,6 @@ ScVbaUserForm::Show( ) throw (uno::RuntimeException) catch( uno::Exception& ) { } - aRet = m_xDialog->execute(); } OSL_TRACE("ScVbaUserForm::Show() execute returned %d", aRet); if ( mbDispose ) diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx index fa80e8dc9234..cfac3642c60b 100644 --- a/vbahelper/source/vbahelper/vbahelper.cxx +++ b/vbahelper/source/vbahelper/vbahelper.cxx @@ -1004,81 +1004,25 @@ UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComp //--------------------------------------------- double UserFormGeometryHelper::getLeft() { - if ( mbDialog ) - { - const Window* pWindow = VCLUnoHelper::GetWindow( mxWindow ); - if ( pWindow ) - { - // get the size with decoration - Rectangle aResult = pWindow->GetWindowExtentsRelative( NULL ); - return aResult.getX(); - } - } - return mxWindow->getPosSize().X; } //--------------------------------------------- void UserFormGeometryHelper::setLeft( double nLeft ) { - sal_Int64 nNewLeft = nLeft; - if ( mbDialog ) - { - const Window* pWindow = VCLUnoHelper::GetWindow( mxWindow ); - if ( pWindow ) - { - // set the size with decoration - Rectangle aRDecor = pWindow->GetWindowExtentsRelative( NULL ); - if ( !aRDecor.IsEmpty() ) - { - sal_Int64 nDecor = aRDecor.getX(); - sal_Int64 nUnDecor = mxWindow->getPosSize().X; - nNewLeft = nLeft + nUnDecor - nDecor; - } - } - } - - mxWindow->setPosSize( nNewLeft, 0, 0, 0, awt::PosSize::X ); + mxWindow->setPosSize( nLeft, 0, 0, 0, awt::PosSize::X ); } //--------------------------------------------- double UserFormGeometryHelper::getTop() { - if ( mbDialog ) - { - const Window* pWindow = VCLUnoHelper::GetWindow( mxWindow ); - if ( pWindow ) - { - // get the size with decoration - Rectangle aResult = pWindow->GetWindowExtentsRelative( NULL ); - return aResult.getY(); - } - } - return mxWindow->getPosSize().Y; } //--------------------------------------------- void UserFormGeometryHelper::setTop( double nTop ) { - sal_Int64 nNewTop = nTop; - if ( mbDialog ) - { - const Window* pWindow = VCLUnoHelper::GetWindow( mxWindow ); - if ( pWindow ) - { - // set the size with decoration - Rectangle aRDecor = pWindow->GetWindowExtentsRelative( NULL ); - if ( !aRDecor.IsEmpty() ) - { - sal_Int64 nDecor = aRDecor.getY(); - sal_Int64 nUnDecor = mxWindow->getPosSize().Y; - nNewTop = nTop + nUnDecor - nDecor; - } - } - } - - mxWindow->setPosSize( 0, nNewTop, 0, 0, awt::PosSize::Y ); + mxWindow->setPosSize( 0, nTop, 0, 0, awt::PosSize::Y ); } //--------------------------------------------- -- cgit From 16505c2b5c4e08144a3dbdd9fb27b90369ad162a Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Fri, 27 Aug 2010 16:16:02 +0200 Subject: mib19: #i163287# workaround setPosSize() problem of toolkit --- vbahelper/source/vbahelper/vbahelper.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'vbahelper') diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx index cfac3642c60b..65974738c3f4 100644 --- a/vbahelper/source/vbahelper/vbahelper.cxx +++ b/vbahelper/source/vbahelper/vbahelper.cxx @@ -1010,7 +1010,7 @@ double UserFormGeometryHelper::getLeft() //--------------------------------------------- void UserFormGeometryHelper::setLeft( double nLeft ) { - mxWindow->setPosSize( nLeft, 0, 0, 0, awt::PosSize::X ); + mxWindow->setPosSize( nLeft, mxWindow->getPosSize().Y, 0, 0, awt::PosSize::POS ); } //--------------------------------------------- @@ -1022,7 +1022,7 @@ double UserFormGeometryHelper::getTop() //--------------------------------------------- void UserFormGeometryHelper::setTop( double nTop ) { - mxWindow->setPosSize( 0, nTop, 0, 0, awt::PosSize::Y ); + mxWindow->setPosSize( mxWindow->getPosSize().X, nTop, 0, 0, awt::PosSize::POS ); } //--------------------------------------------- -- cgit From c211b684d02ef787f38a1e419bc0c9ed10244ef8 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Mon, 30 Aug 2010 09:41:48 +0200 Subject: mib19: #163217# let the document be correctly closed --- vbahelper/source/vbahelper/vbadocumentbase.cxx | 62 ++++++++++++++++++++------ 1 file changed, 48 insertions(+), 14 deletions(-) (limited to 'vbahelper') diff --git a/vbahelper/source/vbahelper/vbadocumentbase.cxx b/vbahelper/source/vbahelper/vbadocumentbase.cxx index ad7ea62cd613..894a9f55eed2 100644 --- a/vbahelper/source/vbahelper/vbadocumentbase.cxx +++ b/vbahelper/source/vbahelper/vbadocumentbase.cxx @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include //Michael E. Bohn @@ -131,23 +132,56 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg, else xModifiable->setModified( false ); - uno::Reference< util::XCloseable > xCloseable( getModel(), uno::UNO_QUERY ); + // first try to close the document using UI dispatch functionality + sal_Bool bUIClose = sal_False; + try + { + uno::Reference< frame::XController > xController( getModel()->getCurrentController(), uno::UNO_SET_THROW ); + uno::Reference< frame::XDispatchProvider > xDispatchProvider( xController->getFrame(), uno::UNO_QUERY_THROW ); - if( xCloseable.is() ) - // use close(boolean DeliverOwnership) + uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_SET_THROW ); + uno::Reference< util::XURLTransformer > xURLTransformer( + xServiceManager->createInstanceWithContext( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ) ), + mxContext ), + uno::UNO_QUERY_THROW ); - // The boolean parameter DeliverOwnership tells objects vetoing the close process that they may - // assume ownership if they object the closure by throwing a CloseVetoException - // Here we give up ownership. To be on the safe side, catch possible veto exception anyway. - xCloseable->close(sal_True); - // If close is not supported by this model - try to dispose it. - // But if the model disagree with a reset request for the modify state - // we shouldn't do so. Otherwhise some strange things can happen. - else + util::URL aURL; + aURL.Complete = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CloseDoc" ) ); + xURLTransformer->parseStrict( aURL ); + + uno::Reference< css::frame::XDispatch > xDispatch( + xDispatchProvider->queryDispatch( aURL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_self" ) ), 0 ), + uno::UNO_SET_THROW ); + xDispatch->dispatch( aURL, uno::Sequence< beans::PropertyValue >() ); + bUIClose = sal_True; + } + catch( uno::Exception& ) + { + } + + if ( !bUIClose ) { - uno::Reference< lang::XComponent > xDisposable ( getModel(), uno::UNO_QUERY ); - if ( xDisposable.is() ) - xDisposable->dispose(); + // if it is not possible to use UI dispatch, try to close the model directly + uno::Reference< util::XCloseable > xCloseable( getModel(), uno::UNO_QUERY ); + if( xCloseable.is() ) + { + // use close(boolean DeliverOwnership) + + // The boolean parameter DeliverOwnership tells objects vetoing the close process that they may + // assume ownership if they object the closure by throwing a CloseVetoException + // Here we give up ownership. To be on the safe side, catch possible veto exception anyway. + xCloseable->close(sal_True); + } + else + { + // If close is not supported by this model - try to dispose it. + // But if the model disagree with a reset request for the modify state + // we shouldn't do so. Otherwhise some strange things can happen. + uno::Reference< lang::XComponent > xDisposable ( getModel(), uno::UNO_QUERY ); + if ( xDisposable.is() ) + xDisposable->dispose(); + } } } -- cgit From c14df458b4b7da8da38e9be28db9122ee8765ad2 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Mon, 30 Aug 2010 14:34:00 +0200 Subject: mib19: #163429# switch off form design mode in new documents created with VBA symbol Workbooks.Add --- vbahelper/source/vbahelper/vbadocumentsbase.cxx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'vbahelper') diff --git a/vbahelper/source/vbahelper/vbadocumentsbase.cxx b/vbahelper/source/vbahelper/vbadocumentsbase.cxx index f7af3a43d977..e01809d5fbc3 100644 --- a/vbahelper/source/vbahelper/vbadocumentsbase.cxx +++ b/vbahelper/source/vbahelper/vbadocumentsbase.cxx @@ -25,6 +25,7 @@ * ************************************************************************/ #include +#include #include #include #include @@ -215,12 +216,6 @@ VbaDocumentsBase::VbaDocumentsBase( const uno::Reference< XHelperInterface >& xP uno::Any SAL_CALL VbaDocumentsBase::Add() throw (uno::RuntimeException) { - uno::Sequence< beans::PropertyValue > aArgs( 1 ); - beans::PropertyValue aArg; - aArg.Name = ::rtl::OUString::createFromAscii("MacroExecutionMode"); - aArg.Value = uno::Any(com::sun::star::document::MacroExecMode::USE_CONFIG); - aArgs[ 0 ] = aArg; - uno::Reference< lang::XMultiComponentFactory > xSMgr( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); @@ -235,9 +230,17 @@ VbaDocumentsBase::Add() throw (uno::RuntimeException) sURL = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("private:factory/scalc") ); else throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); + + // prepare the media descriptor + ::comphelper::MediaDescriptor aMediaDesc; + aMediaDesc[ ::comphelper::MediaDescriptor::PROP_MACROEXECUTIONMODE() ] <<= document::MacroExecMode::USE_CONFIG; + aMediaDesc.setComponentDataEntry( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ApplyFormDesignMode" ) ), uno::Any( false ) ); + + // craete the new document uno::Reference< lang::XComponent > xComponent = xLoader->loadComponentFromURL( sURL , - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_blank") ), 0, aArgs ); + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_blank") ), 0, + aMediaDesc.getAsConstPropertyValueList() ); return uno::makeAny( xComponent ); } -- cgit From c30f688a8723093f4efc5075eb96350269b2b0bf Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Mon, 30 Aug 2010 16:48:36 +0200 Subject: mib19: #i163287# workaround setPosSize() problem of toolkit --- vbahelper/source/msforms/vbacontrol.cxx | 1 - vbahelper/source/msforms/vbauserform.cxx | 10 +++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'vbahelper') diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx index 82b68bbd5be7..ed9f83a7c647 100644 --- a/vbahelper/source/msforms/vbacontrol.cxx +++ b/vbahelper/source/msforms/vbacontrol.cxx @@ -227,7 +227,6 @@ void SAL_CALL ScVbaControl::setLeft( double _left ) throw (uno::RuntimeException) { mpGeometryHelper->setLeft( _left ); - } double SAL_CALL diff --git a/vbahelper/source/msforms/vbauserform.cxx b/vbahelper/source/msforms/vbauserform.cxx index 027c6a7384bc..e10c3a373f94 100644 --- a/vbahelper/source/msforms/vbauserform.cxx +++ b/vbahelper/source/msforms/vbauserform.cxx @@ -28,6 +28,7 @@ #include "vbauserform.hxx" #include #include +#include #include #include #include @@ -69,7 +70,6 @@ ScVbaUserForm::Show( ) throw (uno::RuntimeException) if ( m_xDialog.is() ) { - aRet = m_xDialog->execute(); // try to center dialog on model window if( m_xModel.is() ) try { @@ -77,12 +77,16 @@ ScVbaUserForm::Show( ) throw (uno::RuntimeException) uno::Reference< frame::XFrame > xFrame( xController->getFrame(), uno::UNO_SET_THROW ); uno::Reference< awt::XWindow > xWindow( xFrame->getContainerWindow(), uno::UNO_SET_THROW ); awt::Rectangle aPosSize = xWindow->getPosSize(); // already in pixel - setLeft( (aPosSize.Width - getWidth()) / 2.0 ); - setTop( (aPosSize.Height - getHeight()) / 2.0 ); + + uno::Reference< awt::XControl > xControl( m_xDialog, uno::UNO_QUERY_THROW ); + uno::Reference< awt::XWindow > xControlWindow( xControl->getPeer(), uno::UNO_QUERY_THROW ); + xControlWindow->setPosSize( (aPosSize.Width - getWidth()) / 2.0, (aPosSize.Height - getHeight()) / 2.0, 0, 0, awt::PosSize::POS ); } catch( uno::Exception& ) { } + + aRet = m_xDialog->execute(); } OSL_TRACE("ScVbaUserForm::Show() execute returned %d", aRet); if ( mbDispose ) -- cgit From e48aad10ecbb86128929ef19f690eb50f8660d36 Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Tue, 31 Aug 2010 11:13:07 +0200 Subject: mib19: WaE --- vbahelper/source/vbahelper/vbaeventshelperbase.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vbahelper') diff --git a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx index 840008e6b979..b88086cd6d1d 100755 --- a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx +++ b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx @@ -197,7 +197,7 @@ const VbaEventsHelperBase::EventHandlerInfo& VbaEventsHelperBase::getEventHandle break; } VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( mpShell, aMacroName, false ); - return aMacroInfo.IsResolved() ? aMacroInfo.ResolvedMacro() : ::rtl::OUString(); + return aMacroInfo.IsResolved() ? ::rtl::OUString( aMacroInfo.ResolvedMacro() ) : ::rtl::OUString(); } void VbaEventsHelperBase::stopListening() -- cgit From 67e181bee06b98fa96aa7a37f3f6240c9f8b90f6 Mon Sep 17 00:00:00 2001 From: "Michael E. Bohn" Date: Wed, 1 Sep 2010 04:12:05 +0200 Subject: mib19: #163494# removed the exlamation mark at the begin of the macro name in application.run --- vbahelper/source/vbahelper/vbaapplicationbase.cxx | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'vbahelper') diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx index 7fdfa75795ef..b676571780be 100644 --- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx +++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx @@ -295,6 +295,13 @@ VbaApplicationBase::getVersion() throw (uno::RuntimeException) void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const uno::Any& varg1, const uno::Any& varg2, const uno::Any& varg3, const uno::Any& varg4, const uno::Any& varg5, const uno::Any& varg6, const uno::Any& varg7, const uno::Any& varg8, const uno::Any& varg9, const uno::Any& varg10, const uno::Any& varg11, const uno::Any& varg12, const uno::Any& varg13, const uno::Any& varg14, const uno::Any& varg15, const uno::Any& varg16, const uno::Any& varg17, const uno::Any& varg18, const uno::Any& varg19, const uno::Any& varg20, const uno::Any& varg21, const uno::Any& varg22, const uno::Any& varg23, const uno::Any& varg24, const uno::Any& varg25, const uno::Any& varg26, const uno::Any& varg27, const uno::Any& varg28, const uno::Any& varg29, const uno::Any& varg30 ) throw (uno::RuntimeException) { + ::rtl::OUString aMacroName; + if (0 == MacroName.trim().indexOf('!')) + { + aMacroName = MacroName.trim().copy(1); + }else{ + aMacroName = MacroName; + } VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( getSfxObjShell( getCurrentDocument() ), MacroName.trim() ); if( aMacroInfo.IsResolved() ) { -- cgit From b715d7737259726449d3fcf6c5e727bde3fbaeb0 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Wed, 1 Sep 2010 09:26:49 +0200 Subject: mib19: #163494# slight correction --- vbahelper/source/vbahelper/vbaapplicationbase.cxx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'vbahelper') diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx index b676571780be..8b0a52682ac0 100644 --- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx +++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx @@ -295,14 +295,10 @@ VbaApplicationBase::getVersion() throw (uno::RuntimeException) void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const uno::Any& varg1, const uno::Any& varg2, const uno::Any& varg3, const uno::Any& varg4, const uno::Any& varg5, const uno::Any& varg6, const uno::Any& varg7, const uno::Any& varg8, const uno::Any& varg9, const uno::Any& varg10, const uno::Any& varg11, const uno::Any& varg12, const uno::Any& varg13, const uno::Any& varg14, const uno::Any& varg15, const uno::Any& varg16, const uno::Any& varg17, const uno::Any& varg18, const uno::Any& varg19, const uno::Any& varg20, const uno::Any& varg21, const uno::Any& varg22, const uno::Any& varg23, const uno::Any& varg24, const uno::Any& varg25, const uno::Any& varg26, const uno::Any& varg27, const uno::Any& varg28, const uno::Any& varg29, const uno::Any& varg30 ) throw (uno::RuntimeException) { - ::rtl::OUString aMacroName; - if (0 == MacroName.trim().indexOf('!')) - { - aMacroName = MacroName.trim().copy(1); - }else{ - aMacroName = MacroName; - } - VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( getSfxObjShell( getCurrentDocument() ), MacroName.trim() ); + ::rtl::OUString aMacroName = MacroName.trim(); + if (0 == aMacroName.indexOf('!')) + aMacroName = aMacroName.copy(1).trim(); + VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( getSfxObjShell( getCurrentDocument() ), aMacroName ); if( aMacroInfo.IsResolved() ) { // handle the arguments -- cgit From ea2b13e9854aec115fe235b011f55708b948b24f Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Wed, 1 Sep 2010 14:32:36 +0200 Subject: mib19: #163432# on document close the control might be already removed during the call --- vbahelper/source/msforms/vbauserform.cxx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'vbahelper') diff --git a/vbahelper/source/msforms/vbauserform.cxx b/vbahelper/source/msforms/vbauserform.cxx index e10c3a373f94..16bc97babd7d 100644 --- a/vbahelper/source/msforms/vbauserform.cxx +++ b/vbahelper/source/msforms/vbauserform.cxx @@ -201,11 +201,14 @@ ScVbaUserForm::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::Un uno::Reference< awt::XControl > xDialogControl( m_xDialog, uno::UNO_QUERY_THROW ); uno::Reference< awt::XControlContainer > xContainer( m_xDialog, uno::UNO_QUERY_THROW ); uno::Reference< awt::XControl > xControl = xContainer->getControl( aPropertyName ); - ScVbaControlFactory aFac( mxContext, xControl, m_xModel ); - uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( xDialogControl->getModel() ) ); - ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xVBAControl.get() ); - pControl->setGeometryHelper( new UserFormGeometryHelper( mxContext, xControl ) ); - aResult = uno::makeAny( xVBAControl ); + if ( xControl.is() ) + { + ScVbaControlFactory aFac( mxContext, xControl, m_xModel ); + uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( xDialogControl->getModel() ) ); + ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xVBAControl.get() ); + pControl->setGeometryHelper( new UserFormGeometryHelper( mxContext, xControl ) ); + aResult = uno::makeAny( xVBAControl ); + } } return aResult; -- cgit From d4aca024ba8ff204cebe7e917064d8b204a3795b Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Tue, 7 Sep 2010 18:00:19 +0200 Subject: mib19: #163433# let Application::Run find the correct document --- vbahelper/source/vbahelper/vbaapplicationbase.cxx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'vbahelper') diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx index 8b0a52682ac0..cf6d655ff353 100644 --- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx +++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx @@ -298,7 +298,20 @@ void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const u ::rtl::OUString aMacroName = MacroName.trim(); if (0 == aMacroName.indexOf('!')) aMacroName = aMacroName.copy(1).trim(); - VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( getSfxObjShell( getCurrentDocument() ), aMacroName ); + + uno::Reference< frame::XModel > xModel; + SbMethod* pMeth = StarBASIC::GetActiveMethod(); + if ( pMeth ) + { + SbModule* pMod = dynamic_cast< SbModule* >( pMeth->GetParent() ); + if ( pMod ) + xModel = StarBASIC::GetModelFromBasic( pMod ); + } + + if ( !xModel.is() ) + xModel = getCurrentDocument(); + + VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( getSfxObjShell( xModel ), aMacroName ); if( aMacroInfo.IsResolved() ) { // handle the arguments -- cgit From a52cf2d300782298b39977331bb7bc015daedd7c Mon Sep 17 00:00:00 2001 From: Andreas Bregas Date: Thu, 9 Sep 2010 15:53:39 +0200 Subject: mib19: #163573# Fix NativeObjectWrapper implementation + VbaDocumentBase::getFullName() --- vbahelper/source/vbahelper/vbadocumentbase.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'vbahelper') diff --git a/vbahelper/source/vbahelper/vbadocumentbase.cxx b/vbahelper/source/vbahelper/vbadocumentbase.cxx index 894a9f55eed2..0df38b003556 100644 --- a/vbahelper/source/vbahelper/vbadocumentbase.cxx +++ b/vbahelper/source/vbahelper/vbadocumentbase.cxx @@ -97,8 +97,8 @@ VbaDocumentBase::getPath() throw (uno::RuntimeException) ::rtl::OUString VbaDocumentBase::getFullName() throw (uno::RuntimeException) { - rtl::OUString sPath; - ::osl::File::getSystemPathFromFileURL( getModel()->getURL(), sPath ); + rtl::OUString sPath = getName(); + //::osl::File::getSystemPathFromFileURL( getModel()->getURL(), sPath ); return sPath; } -- cgit From 7e801dd20924783ebe7f40920169179ea3b1a709 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Mon, 13 Sep 2010 17:47:04 +0200 Subject: mib19: #163557# cleanup VBA XDocuments implementation, trigger Workbook_Open event when creating a new Excel workbook via Workbooks.Add --- vbahelper/inc/vbahelper/vbadocumentsbase.hxx | 8 ++++---- vbahelper/source/vbahelper/vbadocumentsbase.cxx | 9 +++------ 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'vbahelper') diff --git a/vbahelper/inc/vbahelper/vbadocumentsbase.hxx b/vbahelper/inc/vbahelper/vbadocumentsbase.hxx index 36bc0a4963ee..8e4554b74b3d 100644 --- a/vbahelper/inc/vbahelper/vbadocumentsbase.hxx +++ b/vbahelper/inc/vbahelper/vbadocumentsbase.hxx @@ -57,10 +57,10 @@ public: // VbaDocumentsBase_BASE virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ) = 0; - // XDocumentsBase - virtual css::uno::Any SAL_CALL Add() throw (css::uno::RuntimeException); - virtual void SAL_CALL Close( ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL Open( const ::rtl::OUString& Filename, const css::uno::Any& ReadOnly, const css::uno::Sequence< css::beans::PropertyValue >& rProps ) throw (css::uno::RuntimeException); +protected: + css::uno::Any createDocument() throw (css::uno::RuntimeException); + void closeDocuments() throw (css::uno::RuntimeException); + css::uno::Any openDocument( const ::rtl::OUString& Filename, const css::uno::Any& ReadOnly, const css::uno::Sequence< css::beans::PropertyValue >& rProps ) throw (css::uno::RuntimeException); }; #endif /* SC_VBA_WORKBOOKS_HXX */ diff --git a/vbahelper/source/vbahelper/vbadocumentsbase.cxx b/vbahelper/source/vbahelper/vbadocumentsbase.cxx index e01809d5fbc3..f2b70ab231c7 100644 --- a/vbahelper/source/vbahelper/vbadocumentsbase.cxx +++ b/vbahelper/source/vbahelper/vbadocumentsbase.cxx @@ -213,8 +213,7 @@ VbaDocumentsBase::VbaDocumentsBase( const uno::Reference< XHelperInterface >& xP { } -uno::Any SAL_CALL -VbaDocumentsBase::Add() throw (uno::RuntimeException) +uno::Any VbaDocumentsBase::createDocument() throw (uno::RuntimeException) { uno::Reference< lang::XMultiComponentFactory > xSMgr( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); @@ -244,8 +243,7 @@ VbaDocumentsBase::Add() throw (uno::RuntimeException) return uno::makeAny( xComponent ); } -void -VbaDocumentsBase::Close() throw (uno::RuntimeException) +void VbaDocumentsBase::closeDocuments() throw (uno::RuntimeException) { // #FIXME this *MUST* be wrong documents::close surely closes ALL documents // in the collection, use of getCurrentDocument here is totally wrong @@ -259,8 +257,7 @@ VbaDocumentsBase::Close() throw (uno::RuntimeException) } // #TODO# #FIXME# can any of the unused params below be used? -uno::Any -VbaDocumentsBase::Open( const rtl::OUString& rFileName, const uno::Any& ReadOnly, const uno::Sequence< beans::PropertyValue >& rProps ) throw (uno::RuntimeException) +uno::Any VbaDocumentsBase::openDocument( const rtl::OUString& rFileName, const uno::Any& ReadOnly, const uno::Sequence< beans::PropertyValue >& rProps ) throw (uno::RuntimeException) { // we need to detect if this is a URL, if not then assume its a file path rtl::OUString aURL; -- cgit From 6ec6e8a3ec36f4c4f459d0e1652ebde558986283 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Wed, 15 Sep 2010 14:11:13 +0200 Subject: mib19: #163640# do not fire selection change events when changing/insertintg/deleting sheets --- vbahelper/inc/vbahelper/vbaeventshelperbase.hxx | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'vbahelper') diff --git a/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx b/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx index b637b742b26c..659837535ace 100755 --- a/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx +++ b/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx @@ -58,6 +58,17 @@ public: // XEventListener virtual void SAL_CALL disposing( const css::lang::EventObject& aSource ) throw (css::uno::RuntimeException); + // little helpers --------------------------------------------------------- + + /** Throws, if the passed sequence does not contain a value at the specified index. */ + static inline void checkArgument( const css::uno::Sequence< css::uno::Any >& rArgs, sal_Int32 nIndex ) throw (css::lang::IllegalArgumentException) + { if( (nIndex < 0) || (nIndex >= rArgs.getLength()) ) throw css::lang::IllegalArgumentException(); } + + /** Throws, if the passed sequence does not contain a value of a specific at the specified index. */ + template< typename Type > + static inline void checkArgumentType( const css::uno::Sequence< css::uno::Any >& rArgs, sal_Int32 nIndex ) throw (css::lang::IllegalArgumentException) + { checkArgument( rArgs, nIndex ); if( !rArgs[ nIndex ].has< Type >() ) throw css::lang::IllegalArgumentException(); } + protected: // ------------------------------------------------------------------------ @@ -73,7 +84,7 @@ protected: /** Registers a supported event handler. - @param nEventId Event identifier from com.sun.star.script.vba.EventIdentifier. + @param nEventId Event identifier from com.sun.star.script.vba.VBAEventId. @param pcMacroName Name of the associated VBA event handler macro. @param eType Document event or global event. @param nCancelIndex 0-based index of Cancel parameter, or -1. @@ -85,15 +96,6 @@ protected: sal_Int32 nCancelIndex = -1, const css::uno::Any& rUserData = css::uno::Any() ); - /** Throws, if the passed sequence does not contain a value at the specified index. */ - static inline void checkArgument( const css::uno::Sequence< css::uno::Any >& rArgs, sal_Int32 nIndex ) throw (css::lang::IllegalArgumentException) - { if( rArgs.getLength() <= nIndex ) throw css::lang::IllegalArgumentException(); } - - /** Throws, if the passed sequence does not contain a value of a specific at the specified index. */ - template< typename Type > - static inline void checkArgumentType( const css::uno::Sequence< css::uno::Any >& rArgs, sal_Int32 nIndex ) throw (css::lang::IllegalArgumentException) - { if( (rArgs.getLength() <= nIndex) || !rArgs[ nIndex ].has< Type >() ) throw css::lang::IllegalArgumentException(); } - // ------------------------------------------------------------------------ struct EventQueueEntry -- cgit From e0f0548d591fff66923fa9e8dee8e331a2cfc8f0 Mon Sep 17 00:00:00 2001 From: "Michael E. Bohn" Date: Fri, 17 Sep 2010 01:45:17 +0200 Subject: mib19: #163532# fix for enabling and disabling custom menue entries via vba. --- .../source/vbahelper/vbacommandbarcontrol.cxx | 31 ++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'vbahelper') diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx b/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx index 3f9c7ddeae89..afcb9041b80f 100644 --- a/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx +++ b/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx @@ -96,6 +96,7 @@ ScVbaCommandBarControl::getVisible() throw (uno::RuntimeException) if( aValue.hasValue() ) aValue >>= bVisible; return bVisible; + } void SAL_CALL ScVbaCommandBarControl::setVisible( ::sal_Bool _visible ) throw (uno::RuntimeException) @@ -106,12 +107,16 @@ ScVbaCommandBarControl::setVisible( ::sal_Bool _visible ) throw (uno::RuntimeExc setPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("IsVisible"), uno::makeAny( _visible ) ); ApplyChange(); } + } ::sal_Bool SAL_CALL ScVbaCommandBarControl::getEnabled() throw (uno::RuntimeException) { sal_Bool bEnabled = sal_True; + rtl::OUString aCommandURLappendix = rtl::OUString::createFromAscii("___"); + rtl::OUString aCommandURL ; + if( m_xParentMenu.is() ) { // currently only the menu in the MenuBat support Enable/Disable @@ -121,7 +126,14 @@ ScVbaCommandBarControl::getEnabled() throw (uno::RuntimeException) else { // emulated with Visible - bEnabled = getVisible(); + //bEnabled = getVisible(); + uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("CommandURL") ); + if (aValue >>= aCommandURL){ + if (0 == aCommandURL.indexOf(aCommandURLappendix)){ + bEnabled = sal_False; + } + } + } return bEnabled; } @@ -129,6 +141,9 @@ ScVbaCommandBarControl::getEnabled() throw (uno::RuntimeException) void SAL_CALL ScVbaCommandBarControl::setEnabled( sal_Bool _enabled ) throw (uno::RuntimeException) { + rtl::OUString aCommandURL ; + rtl::OUString aCommandURLappendix = rtl::OUString::createFromAscii("___"); + rtl::OUStringBuffer aCommandURLSringBuffer; if( m_xParentMenu.is() ) { // currently only the menu in the MenuBat support Enable/Disable @@ -136,8 +151,20 @@ ScVbaCommandBarControl::setEnabled( sal_Bool _enabled ) throw (uno::RuntimeExcep } else { + uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("CommandURL") ); + if (aValue >>= aCommandURL){ + if (0 == aCommandURL.indexOf(aCommandURLappendix)){ + aCommandURL = aCommandURL.copy(3); + } + if (false == _enabled){ + aCommandURLSringBuffer = aCommandURLappendix; + } + aCommandURLSringBuffer.append(aCommandURL); + setPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("CommandURL"), uno::makeAny( aCommandURLSringBuffer.makeStringAndClear()) ); + ApplyChange(); + } // emulated with Visible - setVisible( _enabled ); + //setVisible( _enabled ); } } -- cgit From 6f8d8311daae52da8e92f9d735efe1eac6c5aa8b Mon Sep 17 00:00:00 2001 From: "Michael E. Bohn" Date: Fri, 17 Sep 2010 02:08:24 +0200 Subject: mib19: #163501# fix for showing and hiding custom menu entries via vba. --- vbahelper/source/vbahelper/vbacommandbarcontrol.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'vbahelper') diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx b/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx index afcb9041b80f..56b89c27bb5b 100644 --- a/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx +++ b/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx @@ -91,23 +91,24 @@ ScVbaCommandBarControl::setOnAction( const ::rtl::OUString& _onaction ) throw (u ::sal_Bool SAL_CALL ScVbaCommandBarControl::getVisible() throw (uno::RuntimeException) { - sal_Bool bVisible = sal_True; + /*sal_Bool bVisible = sal_True; uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("IsVisible") ); if( aValue.hasValue() ) aValue >>= bVisible; - return bVisible; + return bVisible;*/ + return getEnabled(); } void SAL_CALL ScVbaCommandBarControl::setVisible( ::sal_Bool _visible ) throw (uno::RuntimeException) { - uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("IsVisible") ); + /*uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("IsVisible") ); if( aValue.hasValue() ) { setPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("IsVisible"), uno::makeAny( _visible ) ); ApplyChange(); - } - + }*/ + setEnabled( _visible); } ::sal_Bool SAL_CALL -- cgit