summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2015-12-04 16:28:27 +0100
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2015-12-11 10:27:57 +0000
commitdf9e93750bb7ff39f4346f0e23a0493409b31c2b (patch)
treeabb157cbb858dd5e5e0609aaf687c65afbcc15bf /framework
parent4ebfc20386b4c3945c6387e464246f5f630efab1 (diff)
tdf#85767 Enable rotated/flipped icons in the Sidebar
This is a combination of 3 commits: * Make buttonstatuslistener a generic listener for any widgets ac97f32307feb488c86d6fa962258fe79320d31b * Move icon rotation/flip handling from ToolbarManager to vcl's Toolbar c5fe98905deac6de4f9e76a17097ce83fe381ac3 * These should still be virtual. e20df218257c45c5daa234daafac9609d53aa77f Change-Id: I34e2446660ec94d60654b4db40ce1bbb8014477f Reviewed-on: https://gerrit.libreoffice.org/20466 Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'framework')
-rw-r--r--framework/inc/uielement/toolbarmanager.hxx13
-rw-r--r--framework/source/uielement/toolbarmanager.cxx145
2 files changed, 1 insertions, 157 deletions
diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx
index 655228aec03b..f109f142eb17 100644
--- a/framework/inc/uielement/toolbarmanager.hxx
+++ b/framework/inc/uielement/toolbarmanager.hxx
@@ -61,7 +61,6 @@ namespace framework
typedef ::cppu::WeakImplHelper<
css::frame::XFrameActionListener,
- css::frame::XStatusListener,
css::lang::XComponent,
css::ui::XUIConfigurationListener
> ToolbarManager_Base;
@@ -80,9 +79,6 @@ class ToolBarManager : public ToolbarManager_Base
// XFrameActionListener
virtual void SAL_CALL frameAction( const css::frame::FrameActionEvent& Action ) throw ( css::uno::RuntimeException, std::exception ) override;
- // XStatusListener
- virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) throw ( css::uno::RuntimeException, std::exception ) override;
-
// XEventListener
virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) throw ( css::uno::RuntimeException, std::exception ) override;
@@ -147,8 +143,6 @@ class ToolBarManager : public ToolbarManager_Base
void UpdateController( css::uno::Reference< css::frame::XToolbarController > xController);
//end
void AddFrameActionListener();
- void AddImageOrientationListener();
- void UpdateImageOrientation();
void ImplClearPopupMenu( ToolBox *pToolBar );
void RequestImages();
ToolBoxItemBits ConvertStyleToToolboxItemBits( sal_Int32 nStyle );
@@ -170,11 +164,7 @@ class ToolBarManager : public ToolbarManager_Base
m_bSmallSymbols : 1,
m_bAddedToTaskPaneList : 1,
m_bFrameActionRegistered : 1,
- m_bUpdateControllers : 1,
- m_bImageOrientationRegistered : 1,
- m_bImageMirrored : 1;
-
- long m_lImageRotation;
+ m_bUpdateControllers : 1;
VclPtr<ToolBox> m_pToolBar;
@@ -191,7 +181,6 @@ class ToolBarManager : public ToolbarManager_Base
css::uno::Reference< css::frame::XUIControllerFactory > m_xToolbarControllerFactory;
css::uno::Reference< css::ui::XImageManager > m_xModuleImageManager;
css::uno::Reference< css::ui::XImageManager > m_xDocImageManager;
- css::uno::Reference< css::lang::XComponent > m_xImageOrientationListener;
css::uno::Reference< css::ui::XUIConfigurationManager > m_xUICfgMgr;
css::uno::Reference< css::ui::XUIConfigurationManager > m_xDocUICfgMgr;
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index 49588d78f782..bb80b25825b6 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -60,8 +60,6 @@
#include <unotools/mediadescriptor.hxx>
#include <comphelper/processfactory.hxx>
#include <svtools/miscopt.hxx>
-#include <svl/imageitm.hxx>
-#include <svtools/framestatuslistener.hxx>
#include <vcl/svapp.hxx>
#include <vcl/menu.hxx>
#include <vcl/syswin.hxx>
@@ -103,39 +101,6 @@ static const char HELPID_PREFIX_TESTTOOL[] = ".HelpId:";
static const sal_uInt16 STARTID_CUSTOMIZE_POPUPMENU = 1000;
-class ImageOrientationListener : public svt::FrameStatusListener
-{
- public:
- ImageOrientationListener( const Reference< XStatusListener >& rReceiver,
- const Reference< XComponentContext >& rxContext,
- const Reference< XFrame >& rFrame );
- virtual ~ImageOrientationListener();
-
- virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) throw ( css::uno::RuntimeException, std::exception ) override;
-
- private:
- Reference< XStatusListener > m_xReceiver;
-};
-
-ImageOrientationListener::ImageOrientationListener(
- const Reference< XStatusListener >& rReceiver,
- const Reference< XComponentContext >& rxContext,
- const Reference< XFrame >& rFrame ) :
- FrameStatusListener( rxContext, rFrame ),
- m_xReceiver( rReceiver )
-{
-}
-
-ImageOrientationListener::~ImageOrientationListener()
-{
-}
-
-void SAL_CALL ImageOrientationListener::statusChanged( const FeatureStateEvent& Event )
-throw ( RuntimeException, std::exception )
-{
- if ( m_xReceiver.is() )
- m_xReceiver->statusChanged( Event );
-}
static sal_Int16 getImageTypeFromBools( bool bBig )
{
@@ -180,9 +145,6 @@ ToolBarManager::ToolBarManager( const Reference< XComponentContext >& rxContext,
m_bAddedToTaskPaneList( true ),
m_bFrameActionRegistered( false ),
m_bUpdateControllers( false ),
- m_bImageOrientationRegistered( false ),
- m_bImageMirrored( false ),
- m_lImageRotation( 0 ),
m_pToolBar( pToolBar ),
m_aResourceName( rResourceName ),
m_xFrame( rFrame ),
@@ -348,61 +310,6 @@ void ToolBarManager::RefreshImages()
m_pToolBar->SetOutputSizePixel( aSize );
}
-void ToolBarManager::UpdateImageOrientation()
-{
- SolarMutexGuard g;
-
- if ( m_xUICommandLabels.is() )
- {
- sal_Int32 i;
- Sequence< OUString > aSeqMirrorCmd;
- Sequence< OUString > aSeqRotateCmd;
- m_xUICommandLabels->getByName(
- UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDMIRRORIMAGELIST ) >>= aSeqMirrorCmd;
- m_xUICommandLabels->getByName(
- UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDROTATEIMAGELIST ) >>= aSeqRotateCmd;
-
- CommandToInfoMap::iterator pIter;
- for ( i = 0; i < aSeqMirrorCmd.getLength(); i++ )
- {
- OUString aMirrorCmd = aSeqMirrorCmd[i];
- pIter = m_aCommandMap.find( aMirrorCmd );
- if ( pIter != m_aCommandMap.end() )
- pIter->second.bMirrored = true;
- }
- for ( i = 0; i < aSeqRotateCmd.getLength(); i++ )
- {
- OUString aRotateCmd = aSeqRotateCmd[i];
- pIter = m_aCommandMap.find( aRotateCmd );
- if ( pIter != m_aCommandMap.end() )
- pIter->second.bRotated = true;
- }
- }
-
- for ( sal_uInt16 nPos = 0; nPos < m_pToolBar->GetItemCount(); nPos++ )
- {
- sal_uInt16 nId = m_pToolBar->GetItemId( nPos );
- if ( nId > 0 )
- {
- OUString aCmd = m_pToolBar->GetItemCommand( nId );
-
- CommandToInfoMap::const_iterator pIter = m_aCommandMap.find( aCmd );
- if ( pIter != m_aCommandMap.end() )
- {
- if ( pIter->second.bRotated )
- {
- m_pToolBar->SetItemImageMirrorMode( nId, false );
- m_pToolBar->SetItemImageAngle( nId, m_lImageRotation );
- }
- if ( pIter->second.bMirrored )
- {
- m_pToolBar->SetItemImageMirrorMode( nId, m_bImageMirrored );
- }
- }
- }
- }
-}
-
void ToolBarManager::UpdateControllers()
{
@@ -479,24 +386,6 @@ throw ( RuntimeException, std::exception )
}
}
-void SAL_CALL ToolBarManager::statusChanged( const css::frame::FeatureStateEvent& Event )
-throw ( css::uno::RuntimeException, std::exception )
-{
- SolarMutexGuard g;
- if ( m_bDisposed )
- return;
-
- if ( Event.FeatureURL.Complete == ".uno:ImageOrientation" )
- {
- SfxImageItem aItem( 1, 0 );
- aItem.PutValue( Event.State, 0 );
-
- m_lImageRotation = aItem.GetRotation();
- m_bImageMirrored = aItem.IsMirrored();
- UpdateImageOrientation();
- }
-}
-
void SAL_CALL ToolBarManager::disposing( const EventObject& Source ) throw ( RuntimeException, std::exception )
{
{
@@ -535,14 +424,6 @@ void SAL_CALL ToolBarManager::disposing( const EventObject& Source ) throw ( Run
}
}
- if ( m_xImageOrientationListener.is() )
- {
- ImageOrientationListener* pImageOrientation =
- static_cast<ImageOrientationListener*>(m_xImageOrientationListener.get());
- pImageOrientation->unbindListener();
- m_xImageOrientationListener.clear();
- }
-
m_xDocImageManager.clear();
m_xModuleImageManager.clear();
@@ -611,14 +492,6 @@ void SAL_CALL ToolBarManager::dispose() throw( RuntimeException, std::exception
}
}
- if ( m_xImageOrientationListener.is() )
- {
- ImageOrientationListener* pImageOrientation =
- static_cast<ImageOrientationListener*>(m_xImageOrientationListener.get());
- pImageOrientation->unbindListener();
- m_xImageOrientationListener.clear();
- }
-
m_xFrame.clear();
m_xContext.clear();
Reference< XComponent > xCompGAM( m_xGlobalAcceleratorManager, UNO_QUERY );
@@ -993,7 +866,6 @@ void ToolBarManager::CreateControllers()
}
AddFrameActionListener();
- AddImageOrientationListener();
}
void ToolBarManager::AddFrameActionListener()
@@ -1006,23 +878,6 @@ void ToolBarManager::AddFrameActionListener()
}
}
-void ToolBarManager::AddImageOrientationListener()
-{
- if ( !m_bImageOrientationRegistered && m_xFrame.is() )
- {
- m_bImageOrientationRegistered = true;
- ImageOrientationListener* pImageOrientation = new ImageOrientationListener(
- Reference< XStatusListener >( static_cast< ::cppu::OWeakObject *>( this ), UNO_QUERY ),
- m_xContext,
- m_xFrame );
- m_xImageOrientationListener.set( static_cast< ::cppu::OWeakObject *>(
- pImageOrientation ), UNO_QUERY );
- pImageOrientation->addStatusListener(
- ".uno:ImageOrientation");
- pImageOrientation->bindListener();
- }
-}
-
ToolBoxItemBits ToolBarManager::ConvertStyleToToolboxItemBits( sal_Int32 nStyle )
{
ToolBoxItemBits nItemBits( ToolBoxItemBits::NONE );