[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - 2 commits - sc/inc sc/source vbahelper/source
Noel Power
noel.power at suse.com
Fri Apr 5 02:05:08 PDT 2013
sc/inc/viewuno.hxx | 3 +
sc/source/ui/unoobj/viewuno.cxx | 49 ++++++++++++++++++++++++--
vbahelper/source/msforms/vbacontrol.cxx | 18 +++++++++
vbahelper/source/vbahelper/vbacommandbars.cxx | 4 ++
4 files changed, 69 insertions(+), 5 deletions(-)
New commits:
commit 9779054cc12fa8025f85b5d7d36c13cd25982db1
Author: Noel Power <noel.power at suse.com>
Date: Thu Apr 4 17:07:52 2013 +0100
fix selection change event firing
Change-Id: I64e8b684dd5462e1a742ba47b5480951b4e3a4c4
Reviewed-on: https://gerrit.libreoffice.org/3210
Reviewed-by: Miklos Vajna <vmiklos at suse.cz>
Tested-by: Miklos Vajna <vmiklos at suse.cz>
diff --git a/sc/inc/viewuno.hxx b/sc/inc/viewuno.hxx
index da2f96c..6411979 100644
--- a/sc/inc/viewuno.hxx
+++ b/sc/inc/viewuno.hxx
@@ -205,7 +205,8 @@ private:
void EndMouseListening();
void StartActivationListening();
void EndActivationListening();
-
+ bool mbLeftMousePressed;
+ bool mbPendingSelectionChanged;
ScTabViewObj(); // disabled
public:
ScTabViewObj(ScTabViewShell* pViewSh);
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index b9f9541..b54a4ce 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -463,7 +463,9 @@ ScTabViewObj::ScTabViewObj( ScTabViewShell* pViewSh ) :
aMouseClickHandlers( 0 ),
aActivationListeners( 0 ),
nPreviousTab( 0 ),
- bDrawSelModeSet(false)
+ bDrawSelModeSet(false),
+ mbLeftMousePressed(false ),
+ mbPendingSelectionChanged(false)
{
if (pViewSh)
nPreviousTab = pViewSh->GetViewData()->GetTabNo();
@@ -1184,13 +1186,17 @@ bool ScTabViewObj::IsMouseListening() const
SCTAB nTab = pViewData->GetTabNo();
return
pDoc->HasSheetEventScript( nTab, SC_SHEETEVENT_RIGHTCLICK, true ) ||
- pDoc->HasSheetEventScript( nTab, SC_SHEETEVENT_DOUBLECLICK, true );
+ pDoc->HasSheetEventScript( nTab, SC_SHEETEVENT_DOUBLECLICK, true ) ||
+ pDoc->HasSheetEventScript( nTab, SC_SHEETEVENT_SELECT, true );
+
}
sal_Bool ScTabViewObj::MousePressed( const awt::MouseEvent& e )
throw (::uno::RuntimeException)
{
sal_Bool bReturn(false);
+ if ( e.Buttons == ::com::sun::star::awt::MouseButton::LEFT )
+ mbLeftMousePressed = true;
uno::Reference< uno::XInterface > xTarget = GetClickedObject(Point(e.X, e.Y));
if (!aMouseClickHandlers.empty() && xTarget.is())
@@ -1281,6 +1287,26 @@ sal_Bool ScTabViewObj::MousePressed( const awt::MouseEvent& e )
sal_Bool ScTabViewObj::MouseReleased( const awt::MouseEvent& e )
throw (uno::RuntimeException)
{
+ if ( e.Buttons == ::com::sun::star::awt::MouseButton::LEFT )
+ {
+ try
+ {
+ mbPendingSelectionChanged = false;
+ ScTabViewShell* pViewSh = GetViewShell();
+ ScViewData* pViewData = pViewSh->GetViewData();
+ ScDocShell* pDocSh = pViewData->GetDocShell();
+ ScDocument* pDoc = pDocSh->GetDocument();
+ uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( pDoc->GetVbaEventProcessor(), uno::UNO_SET_THROW );
+ uno::Sequence< uno::Any > aArgs( 1 );
+ aArgs[ 0 ] <<= getSelection();
+ xVbaEvents->processVbaEvent( ScSheetEvents::GetVbaSheetEventId( SC_SHEETEVENT_SELECT ), aArgs );
+ }
+ catch( uno::Exception& )
+ {
+ }
+ mbLeftMousePressed = false;
+ }
+
sal_Bool bReturn(false);
if (!aMouseClickHandlers.empty())
@@ -1746,7 +1772,24 @@ void ScTabViewObj::SelectionChanged()
/*ErrCode eRet =*/ pDocSh->CallXScript( *pScript, aParams, aRet, aOutArgsIndex, aOutArgs );
}
}
- // Removed Sun/Oracle code intentionally, it doesn't work properly ( selection should be fired after mouse release )
+ if ( !mbLeftMousePressed ) // selection still in progress
+ {
+ mbPendingSelectionChanged = false;
+ try
+ {
+ uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( pDoc->GetVbaEventProcessor(), uno::UNO_SET_THROW );
+ uno::Sequence< uno::Any > aArgs( 1 );
+ aArgs[ 0 ] <<= getSelection();
+ xVbaEvents->processVbaEvent( ScSheetEvents::GetVbaSheetEventId( SC_SHEETEVENT_SELECT ), aArgs );
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+ else
+ {
+ mbPendingSelectionChanged = true;
+ }
}
diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx
index e9be040..b788368 100644
--- a/vbahelper/source/msforms/vbacontrol.cxx
+++ b/vbahelper/source/msforms/vbacontrol.cxx
@@ -192,11 +192,14 @@ void SAL_CALL ScVbaControl::setEnabled( sal_Bool bVisible ) throw (uno::RuntimeE
sal_Bool SAL_CALL ScVbaControl::getVisible() throw (uno::RuntimeException)
{
sal_Bool bVisible( sal_True );
+ m_xProps->getPropertyValue ( "EnableVisible" ) >>= bVisible;
uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY );
if ( xControlShape.is() )
{
+ bool bEnableVisible = bVisible;
uno::Reference< beans::XPropertySet > xProps( m_xControl, uno::UNO_QUERY_THROW );
xProps->getPropertyValue ( "Visible" ) >>= bVisible;
+ bVisible = bVisible && bEnableVisible;
}
else
m_xProps->getPropertyValue ( "EnableVisible" ) >>= bVisible;
commit efa72855b187d52a7e3c9cd4c79d6a2348c3f5bc
Author: Noel Power <noel.power at suse.com>
Date: Fri Mar 29 17:04:52 2013 +0000
fix 'Visible' property for XControlShape(s) Foreach support for CommandBars
Seems now we need to additionally set 'Visible' property for XControlShapes
to ensure correct visibility
Also we need allow 'For Each' syntax to with with CommandBar collection.
Note: the implementation of the CommandBar enumeration seems wrong, I
would have thought that it should match ( and share ) implementation
details with normal index access ( it doesn't )
Change-Id: Ia5306b4c976f6dc9a5f82e245ca5440f204f5bab
Reviewed-on: https://gerrit.libreoffice.org/3209
Reviewed-by: Miklos Vajna <vmiklos at suse.cz>
Tested-by: Miklos Vajna <vmiklos at suse.cz>
diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx
index 288cefa..e9be040 100644
--- a/vbahelper/source/msforms/vbacontrol.cxx
+++ b/vbahelper/source/msforms/vbacontrol.cxx
@@ -192,7 +192,14 @@ void SAL_CALL ScVbaControl::setEnabled( sal_Bool bVisible ) throw (uno::RuntimeE
sal_Bool SAL_CALL ScVbaControl::getVisible() throw (uno::RuntimeException)
{
sal_Bool bVisible( sal_True );
- m_xProps->getPropertyValue( "EnableVisible" ) >>= bVisible;
+ uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY );
+ if ( xControlShape.is() )
+ {
+ uno::Reference< beans::XPropertySet > xProps( m_xControl, uno::UNO_QUERY_THROW );
+ xProps->getPropertyValue ( "Visible" ) >>= bVisible;
+ }
+ else
+ m_xProps->getPropertyValue ( "EnableVisible" ) >>= bVisible;
return bVisible;
}
@@ -200,6 +207,12 @@ void SAL_CALL ScVbaControl::setVisible( sal_Bool bVisible ) throw (uno::RuntimeE
{
uno::Any aValue( bVisible );
m_xProps->setPropertyValue( "EnableVisible" , aValue);
+ uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY );
+ if ( xControlShape.is() )
+ {
+ uno::Reference< beans::XPropertySet > xProps( m_xControl, uno::UNO_QUERY_THROW );
+ xProps->setPropertyValue ( "Visible", aValue );
+ }
}
double SAL_CALL ScVbaControl::getHeight() throw (uno::RuntimeException)
{
diff --git a/vbahelper/source/vbahelper/vbacommandbars.cxx b/vbahelper/source/vbahelper/vbacommandbars.cxx
index e8a2000..a1515fb 100644
--- a/vbahelper/source/vbahelper/vbacommandbars.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbars.cxx
@@ -63,6 +63,10 @@ public:
{
uno::Reference< container::XIndexAccess > xCBarSetting = m_pCBarHelper->getSettings( sResourceUrl );
uno::Reference< XCommandBar > xCommandBar( new ScVbaCommandBar( m_xParent, m_xContext, m_pCBarHelper, xCBarSetting, sResourceUrl, sal_False ) );
+ // Strange, shouldn't the Enumeration support match/share the
+ // iteration code? ( e.g. ScVbaCommandBars::Item(...) )
+ // and we at least should return here ( something ) it seems
+ return uno::makeAny( xCommandBar );
}
else
return nextElement();
More information about the Libreoffice-commits
mailing list