[Libreoffice-commits] core.git: 3 commits - accessibility/source framework/source svtools/source
Maxim Monastirsky
momonasmon at gmail.com
Thu Apr 27 06:03:15 UTC 2017
accessibility/source/standard/vclxaccessibletoolbox.cxx | 12 +++++++++---
framework/source/uielement/generictoolbarcontroller.cxx | 8 +++-----
framework/source/uielement/subtoolbarcontroller.cxx | 7 +------
svtools/source/uno/generictoolboxcontroller.cxx | 9 +++------
svtools/source/uno/toolboxcontroller.cxx | 2 --
5 files changed, 16 insertions(+), 22 deletions(-)
New commits:
commit 7c4c9947b8e52ce67af1ab131ed583a41f0ddbfa
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Thu Apr 27 03:19:48 2017 +0300
tdf#107458 No active item for the overflow subtoolbar
Item id 0 has two meanings inside ToolBox. Methods like
GetCurItemId and GetDownItemId use it as "no item".
But that's also the id of a separator item, so calling
GetItemPos(0) will find a separator, if the ToolBox has
one.
Change-Id: I4f2c1fac1759fe0a3ae09d317909707084e16180
diff --git a/accessibility/source/standard/vclxaccessibletoolbox.cxx b/accessibility/source/standard/vclxaccessibletoolbox.cxx
index aa4cad63acb8..b8dd8e2436f4 100644
--- a/accessibility/source/standard/vclxaccessibletoolbox.cxx
+++ b/accessibility/source/standard/vclxaccessibletoolbox.cxx
@@ -421,8 +421,8 @@ void VCLXAccessibleToolBox::UpdateCustomPopupItemp_Impl( vcl::Window* pWindow, b
{
const sal_uInt16 nDownItem = pToolBox->GetDownItemId();
if ( !nDownItem )
- // Items with ItemId == 0 are not allowed in ToolBox, which means that currently no item is in down state.
- // Moreover, running GetItemPos with 0 could find a separator item if there is any.
+ // No item is currently in down state.
+ // Moreover, calling GetItemPos with 0 will find a separator if there is any.
return;
Reference< XAccessible > xChild( pWindow->GetAccessible() );
@@ -461,7 +461,13 @@ void VCLXAccessibleToolBox::HandleSubToolBarEvent( const VclWindowEvent& rVclWin
&& pToolBox == pChildWindow->GetParent()
&& pChildWindow->GetType() == WindowType::TOOLBOX )
{
- ToolBox::ImplToolItems::size_type nIndex = pToolBox->GetItemPos( pToolBox->GetCurItemId() );
+ const sal_uInt16 nCurItemId( pToolBox->GetCurItemId() );
+ if ( !nCurItemId )
+ // No item is currently active (might happen when opening the overflow popup).
+ // Moreover, calling GetItemPos with 0 will find a separator if there is any.
+ return;
+
+ ToolBox::ImplToolItems::size_type nIndex = pToolBox->GetItemPos( nCurItemId );
Reference< XAccessible > xItem = getAccessibleChild( nIndex );
//TODO: ToolBox::ImplToolItems::size_type -> sal_Int32!
if ( xItem.is() )
commit 17026b70731d9285d4d0d053057b0779877d8feb
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Wed Apr 26 13:43:47 2017 +0300
Use ToolBox::GetImageSize
Change-Id: Iaad0ca0e3957e54f11dfa1687b33b08239451bfb
diff --git a/framework/source/uielement/subtoolbarcontroller.cxx b/framework/source/uielement/subtoolbarcontroller.cxx
index 266ebbab247c..c5b08f190c80 100644
--- a/framework/source/uielement/subtoolbarcontroller.cxx
+++ b/framework/source/uielement/subtoolbarcontroller.cxx
@@ -284,12 +284,7 @@ void SubToolBarController::updateImage()
sal_uInt16 nId = 0;
if ( getToolboxId( nId, &pToolBox ) )
{
- vcl::ImageType eImageType = vcl::ImageType::Size16;
- if (pToolBox->GetToolboxButtonSize() == ToolBoxButtonSize::Large)
- eImageType = vcl::ImageType::Size26;
- else if (pToolBox->GetToolboxButtonSize() == ToolBoxButtonSize::Size32)
- eImageType = vcl::ImageType::Size32;
-
+ vcl::ImageType eImageType = pToolBox->GetImageSize();
Image aImage = vcl::CommandInfoProvider::GetImageForCommand(m_aLastCommand, getFrameInterface(), eImageType);
if ( !!aImage )
pToolBox->SetItemImage( nId, aImage );
commit 32680923221e1eec9020c2a21b51125f735e4a32
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Wed Apr 26 03:09:41 2017 +0300
Fix the copy-paste
Use m_xUrlTransformer, and drop the now unneeded m_xContext.is()
check.
Here is the history of this:
- commit ef8f9cfb262a7 (CWS docking1) introduced this code in
ToolboxController::execute.
- commit a2bbbc5130b80 (CWS docking3) copy-pasted this into
GenericToolbarController::execute.
- commit 0fc90c8a064f7 (CWS insight02) changed the original
code, but not the copy-pasted one.
- commit d7afd8e128177 (CWS toolbars2) That CWS didn't have
the above change yet, and copy-pasted the old code to yet
another place (GenericToolboxController::execute).
Change-Id: I7f4e8dfb52b96ea5285ea7b2bb3083847dd84932
diff --git a/framework/source/uielement/generictoolbarcontroller.cxx b/framework/source/uielement/generictoolbarcontroller.cxx
index 2cb2541c6c89..12f6d4f3558a 100644
--- a/framework/source/uielement/generictoolbarcontroller.cxx
+++ b/framework/source/uielement/generictoolbarcontroller.cxx
@@ -123,7 +123,6 @@ void SAL_CALL GenericToolbarController::dispose()
void SAL_CALL GenericToolbarController::execute( sal_Int16 KeyModifier )
{
Reference< XDispatch > xDispatch;
- Reference< XURLTransformer > xURLTransformer;
OUString aCommandURL;
{
@@ -136,8 +135,6 @@ void SAL_CALL GenericToolbarController::execute( sal_Int16 KeyModifier )
m_xFrame.is() &&
!m_aCommandURL.isEmpty() )
{
- xURLTransformer = URLTransformer::create(m_xContext);
-
aCommandURL = m_aCommandURL;
URLToDispatchMap::iterator pIter = m_aListenerMap.find( m_aCommandURL );
if ( pIter != m_aListenerMap.end() )
@@ -145,7 +142,7 @@ void SAL_CALL GenericToolbarController::execute( sal_Int16 KeyModifier )
}
}
- if ( xDispatch.is() && xURLTransformer.is() )
+ if ( xDispatch.is() )
{
css::util::URL aTargetURL;
Sequence<PropertyValue> aArgs( 1 );
@@ -155,7 +152,8 @@ void SAL_CALL GenericToolbarController::execute( sal_Int16 KeyModifier )
aArgs[0].Value <<= KeyModifier;
aTargetURL.Complete = aCommandURL;
- xURLTransformer->parseStrict( aTargetURL );
+ if ( m_xUrlTransformer.is() )
+ m_xUrlTransformer->parseStrict( aTargetURL );
// Execute dispatch asynchronously
ExecuteInfo* pExecuteInfo = new ExecuteInfo;
diff --git a/svtools/source/uno/generictoolboxcontroller.cxx b/svtools/source/uno/generictoolboxcontroller.cxx
index dd03972489b1..0ab20dc6a20e 100644
--- a/svtools/source/uno/generictoolboxcontroller.cxx
+++ b/svtools/source/uno/generictoolboxcontroller.cxx
@@ -81,7 +81,6 @@ void SAL_CALL GenericToolboxController::dispose()
void SAL_CALL GenericToolboxController::execute( sal_Int16 /*KeyModifier*/ )
{
Reference< XDispatch > xDispatch;
- Reference< XURLTransformer > xURLTransformer;
OUString aCommandURL;
{
@@ -92,11 +91,8 @@ void SAL_CALL GenericToolboxController::execute( sal_Int16 /*KeyModifier*/ )
if ( m_bInitialized &&
m_xFrame.is() &&
- m_xContext.is() &&
!m_aCommandURL.isEmpty() )
{
- xURLTransformer = URLTransformer::create( m_xContext );
-
aCommandURL = m_aCommandURL;
URLToDispatchMap::iterator pIter = m_aListenerMap.find( m_aCommandURL );
if ( pIter != m_aListenerMap.end() )
@@ -104,13 +100,14 @@ void SAL_CALL GenericToolboxController::execute( sal_Int16 /*KeyModifier*/ )
}
}
- if ( xDispatch.is() && xURLTransformer.is() )
+ if ( xDispatch.is() )
{
css::util::URL aTargetURL;
Sequence<PropertyValue> aArgs;
aTargetURL.Complete = aCommandURL;
- xURLTransformer->parseStrict( aTargetURL );
+ if ( m_xUrlTransformer.is() )
+ m_xUrlTransformer->parseStrict( aTargetURL );
// Execute dispatch asynchronously
ExecuteInfo* pExecuteInfo = new ExecuteInfo;
diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx
index 32ce1a781764..4d802f1d7763 100644
--- a/svtools/source/uno/toolboxcontroller.cxx
+++ b/svtools/source/uno/toolboxcontroller.cxx
@@ -324,10 +324,8 @@ void SAL_CALL ToolboxController::execute( sal_Int16 KeyModifier )
if ( m_bInitialized &&
m_xFrame.is() &&
- m_xContext.is() &&
!m_aCommandURL.isEmpty() )
{
-
aCommandURL = m_aCommandURL;
URLToDispatchMap::iterator pIter = m_aListenerMap.find( m_aCommandURL );
if ( pIter != m_aListenerMap.end() )
More information about the Libreoffice-commits
mailing list