summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2015-12-04 17:05:11 +0100
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2015-12-08 08:39:44 +0000
commitac97f32307feb488c86d6fa962258fe79320d31b (patch)
treebaaf15380630c4dbeeea827fb6ab004193bb5ac0 /framework
parente4d5b5efac71ed2a08dcd09877078a6cf6bde0d2 (diff)
Move icon rotation/flip handling from ToolbarManager to vcl's Toolbar
This enables rotatad/flipped icons in the Sidebar and other non-toolbar places (tdf#85767) Change-Id: I034394ae6f9b8d91ef5a376a43eda587098f064e Reviewed-on: https://gerrit.libreoffice.org/20403 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 43d285bba9e8..f99c3851a21e 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;
@@ -145,8 +141,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 );
@@ -167,11 +161,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;
@@ -188,7 +178,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 1a0abc68b175..25eda26a83db 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -55,8 +55,6 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/sequence.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>
@@ -98,39 +96,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 )
{
@@ -175,9 +140,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 ),
@@ -343,61 +305,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()
{
@@ -474,24 +381,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 )
{
{
@@ -530,14 +419,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();
@@ -606,14 +487,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();
@@ -982,7 +855,6 @@ void ToolBarManager::CreateControllers()
}
AddFrameActionListener();
- AddImageOrientationListener();
}
void ToolBarManager::AddFrameActionListener()
@@ -995,23 +867,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 );