[Libreoffice-commits] core.git: 2 commits - framework/inc framework/source include/vcl vcl/source
Samuel Mehrbrodt
Samuel.Mehrbrodt at cib.de
Tue Nov 17 02:10:41 PST 2015
framework/inc/uielement/toolbarmanager.hxx | 4 -
framework/source/uielement/toolbarmanager.cxx | 74 --------------------------
include/vcl/commandinfoprovider.hxx | 4 +
vcl/source/helper/commandinfoprovider.cxx | 19 ++++++
4 files changed, 24 insertions(+), 77 deletions(-)
New commits:
commit 0c48c809f09e74e79c9f8dc4c22958147f591921
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date: Tue Nov 17 11:08:46 2015 +0100
tdf#95845 Use CommandInfoProvider to receive command properties
Change-Id: I41f9a661b7a5b355e50910d7f58f0d9d55dc62a6
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index 76fa331..e4f2979 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -773,62 +773,8 @@ void ToolBarManager::RemoveControllers()
m_aControllerMap.clear();
}
-uno::Sequence< beans::PropertyValue > ToolBarManager::GetPropsForCommand( const OUString& rCmdURL )
-{
- Sequence< PropertyValue > aPropSeq;
-
- // Retrieve properties for command
- try
- {
- if ( !m_bModuleIdentified )
- {
- Reference< XModuleManager2 > xModuleManager = ModuleManager::create( m_xContext );
- Reference< XInterface > xIfac( m_xFrame, UNO_QUERY );
-
- m_bModuleIdentified = true;
- m_aModuleIdentifier = xModuleManager->identify( xIfac );
-
- if ( !m_aModuleIdentifier.isEmpty() )
- {
- Reference< XNameAccess > xNameAccess = frame::theUICommandDescription::get( m_xContext );
- xNameAccess->getByName( m_aModuleIdentifier ) >>= m_xUICommandLabels;
- }
- }
-
- if ( m_xUICommandLabels.is() )
- {
- if ( !rCmdURL.isEmpty() )
- m_xUICommandLabels->getByName( rCmdURL ) >>= aPropSeq;
- }
- }
- catch (const Exception&)
- {
- }
-
- return aPropSeq;
-}
-
-sal_Int32 ToolBarManager::RetrievePropertiesFromCommand( const OUString& aCmdURL )
-{
- sal_Int32 nProperties(0);
- Sequence< PropertyValue > aPropSeq;
-
- // Retrieve popup menu labels
- aPropSeq = GetPropsForCommand( aCmdURL );
- for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ )
- {
- if ( aPropSeq[i].Name == "Properties" )
- {
- aPropSeq[i].Value >>= nProperties;
- break;
- }
- }
- return nProperties;
-}
-
void ToolBarManager::CreateControllers()
{
-
Reference< XWindow > xToolbarWindow = VCLUnoHelper::GetInterface( m_pToolBar );
css::util::URL aURL;
@@ -932,7 +878,7 @@ void ToolBarManager::CreateControllers()
new GenericToolbarController( m_xContext, m_xFrame, m_pToolBar, nId, aCommandURL ));
// Accessibility support: Set toggle button role for specific commands
- sal_Int32 nProps = RetrievePropertiesFromCommand( aCommandURL );
+ sal_Int32 nProps = vcl::CommandInfoProvider::Instance().GetPropertiesForCommand(aCommandURL, m_xFrame);
if ( nProps & UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON )
m_pToolBar->SetItemBits( nId, m_pToolBar->GetItemBits( nId ) | ToolBoxItemBits::CHECKABLE );
}
diff --git a/include/vcl/commandinfoprovider.hxx b/include/vcl/commandinfoprovider.hxx
index 0dc69f8..3d98296 100644
--- a/include/vcl/commandinfoprovider.hxx
+++ b/include/vcl/commandinfoprovider.hxx
@@ -84,6 +84,10 @@ public:
bool bLarge,
const css::uno::Reference<css::frame::XFrame>& rxFrame);
+ sal_Int32 GetPropertiesForCommand(
+ const OUString& rsCommandName,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame);
+
/** Do not call. Should be part of a local and hidden interface.
*/
void SetFrame (const css::uno::Reference<css::frame::XFrame>& rxFrame);
diff --git a/vcl/source/helper/commandinfoprovider.cxx b/vcl/source/helper/commandinfoprovider.cxx
index 4eef99c..cb0378c 100644
--- a/vcl/source/helper/commandinfoprovider.cxx
+++ b/vcl/source/helper/commandinfoprovider.cxx
@@ -214,6 +214,25 @@ Image CommandInfoProvider::GetImageForCommand(const OUString& rsCommandName, boo
return Image();
}
+sal_Int32 CommandInfoProvider::GetPropertiesForCommand (
+ const OUString& rsCommandName,
+ const Reference<frame::XFrame>& rxFrame)
+{
+ SetFrame(rxFrame);
+
+ const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName));
+ for (sal_Int32 nIndex=0; nIndex<aProperties.getLength(); ++nIndex)
+ {
+ if (aProperties[nIndex].Name == "Properties")
+ {
+ sal_Int32 nValue;
+ aProperties[nIndex].Value >>= nValue;
+ return nValue;
+ }
+ }
+ return 0;
+}
+
void CommandInfoProvider::SetFrame (const Reference<frame::XFrame>& rxFrame)
{
if (rxFrame != mxCachedDataFrame)
commit 16f85dc485970f34c2abd06fb5379b426d3a83bc
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date: Tue Nov 17 08:37:23 2015 +0100
Remove unused methods
Change-Id: Ia78da9dac5fb426fbb145250c4e39eb7d30c4d03
diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx
index 65a5184..2f55097 100644
--- a/framework/inc/uielement/toolbarmanager.hxx
+++ b/framework/inc/uielement/toolbarmanager.hxx
@@ -144,7 +144,6 @@ class ToolBarManager : public ToolbarManager_Base
virtual bool MenuItemAllowed( sal_uInt16 ) const;
void RemoveControllers();
- OUString RetrieveFromCommand( const OUString & aName, const OUString& aCmdURL );
sal_Int32 RetrievePropertiesFromCommand( const OUString& aCmdURL );
css::uno::Sequence< css::beans::PropertyValue > GetPropsForCommand( const OUString& rCmdURL );
void CreateControllers();
@@ -165,9 +164,6 @@ class ToolBarManager : public ToolbarManager_Base
void setToolBarImage(const Image& _aImage,const CommandToInfoMap::const_iterator& _pIter);
void impl_elementChanged(bool _bRemove,const css::ui::ConfigurationEvent& Event );
- static bool impl_RetrieveShortcutsFromConfiguration( const css::uno::Reference< css::ui::XAcceleratorConfiguration >& rAccelCfg, const OUString& rCommand, OUString& rShortCut );
- bool RetrieveShortcut( const OUString& rCommandURL, OUString& rShortCut );
-
protected:
typedef std::unordered_map< sal_uInt16, css::uno::Reference< css::frame::XStatusListener > > ToolBarControllerMap;
typedef ::std::vector< css::uno::Reference< css::frame::XSubToolbarController > > SubToolBarControllerVector;
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index 2384a09..76fa331 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -808,24 +808,6 @@ uno::Sequence< beans::PropertyValue > ToolBarManager::GetPropsForCommand( const
return aPropSeq;
}
-OUString ToolBarManager::RetrieveFromCommand( const OUString & aName, const OUString& aCmdURL )
-{
- OUString aLabel;
- Sequence< PropertyValue > aPropSeq;
-
- // Retrieve popup menu labels
- aPropSeq = GetPropsForCommand( aCmdURL );
- for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ )
- {
- if ( aPropSeq[i].Name == aName )
- {
- aPropSeq[i].Value >>= aLabel;
- break;
- }
- }
- return aLabel;
-}
-
sal_Int32 ToolBarManager::RetrievePropertiesFromCommand( const OUString& aCmdURL )
{
sal_Int32 nProperties(0);
More information about the Libreoffice-commits
mailing list