Kaydet (Commit) ac97f323 authored tarafından Samuel Mehrbrodt's avatar Samuel Mehrbrodt

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/20403Reviewed-by: 's avatarSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Tested-by: 's avatarSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
üst e4d5b5ef
...@@ -61,7 +61,6 @@ namespace framework ...@@ -61,7 +61,6 @@ namespace framework
typedef ::cppu::WeakImplHelper< typedef ::cppu::WeakImplHelper<
css::frame::XFrameActionListener, css::frame::XFrameActionListener,
css::frame::XStatusListener,
css::lang::XComponent, css::lang::XComponent,
css::ui::XUIConfigurationListener css::ui::XUIConfigurationListener
> ToolbarManager_Base; > ToolbarManager_Base;
...@@ -80,9 +79,6 @@ class ToolBarManager : public ToolbarManager_Base ...@@ -80,9 +79,6 @@ class ToolBarManager : public ToolbarManager_Base
// XFrameActionListener // XFrameActionListener
virtual void SAL_CALL frameAction( const css::frame::FrameActionEvent& Action ) throw ( css::uno::RuntimeException, std::exception ) override; 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 // XEventListener
virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) throw ( css::uno::RuntimeException, std::exception ) override; 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 ...@@ -145,8 +141,6 @@ class ToolBarManager : public ToolbarManager_Base
void UpdateController( css::uno::Reference< css::frame::XToolbarController > xController); void UpdateController( css::uno::Reference< css::frame::XToolbarController > xController);
//end //end
void AddFrameActionListener(); void AddFrameActionListener();
void AddImageOrientationListener();
void UpdateImageOrientation();
void ImplClearPopupMenu( ToolBox *pToolBar ); void ImplClearPopupMenu( ToolBox *pToolBar );
void RequestImages(); void RequestImages();
ToolBoxItemBits ConvertStyleToToolboxItemBits( sal_Int32 nStyle ); ToolBoxItemBits ConvertStyleToToolboxItemBits( sal_Int32 nStyle );
...@@ -167,11 +161,7 @@ class ToolBarManager : public ToolbarManager_Base ...@@ -167,11 +161,7 @@ class ToolBarManager : public ToolbarManager_Base
m_bSmallSymbols : 1, m_bSmallSymbols : 1,
m_bAddedToTaskPaneList : 1, m_bAddedToTaskPaneList : 1,
m_bFrameActionRegistered : 1, m_bFrameActionRegistered : 1,
m_bUpdateControllers : 1, m_bUpdateControllers : 1;
m_bImageOrientationRegistered : 1,
m_bImageMirrored : 1;
long m_lImageRotation;
VclPtr<ToolBox> m_pToolBar; VclPtr<ToolBox> m_pToolBar;
...@@ -188,7 +178,6 @@ class ToolBarManager : public ToolbarManager_Base ...@@ -188,7 +178,6 @@ class ToolBarManager : public ToolbarManager_Base
css::uno::Reference< css::frame::XUIControllerFactory > m_xToolbarControllerFactory; css::uno::Reference< css::frame::XUIControllerFactory > m_xToolbarControllerFactory;
css::uno::Reference< css::ui::XImageManager > m_xModuleImageManager; css::uno::Reference< css::ui::XImageManager > m_xModuleImageManager;
css::uno::Reference< css::ui::XImageManager > m_xDocImageManager; 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_xUICfgMgr;
css::uno::Reference< css::ui::XUIConfigurationManager > m_xDocUICfgMgr; css::uno::Reference< css::ui::XUIConfigurationManager > m_xDocUICfgMgr;
......
...@@ -55,8 +55,6 @@ ...@@ -55,8 +55,6 @@
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <comphelper/sequence.hxx> #include <comphelper/sequence.hxx>
#include <svtools/miscopt.hxx> #include <svtools/miscopt.hxx>
#include <svl/imageitm.hxx>
#include <svtools/framestatuslistener.hxx>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <vcl/menu.hxx> #include <vcl/menu.hxx>
#include <vcl/syswin.hxx> #include <vcl/syswin.hxx>
...@@ -98,39 +96,6 @@ static const char HELPID_PREFIX_TESTTOOL[] = ".HelpId:"; ...@@ -98,39 +96,6 @@ static const char HELPID_PREFIX_TESTTOOL[] = ".HelpId:";
static const sal_uInt16 STARTID_CUSTOMIZE_POPUPMENU = 1000; 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 ) static sal_Int16 getImageTypeFromBools( bool bBig )
{ {
...@@ -175,9 +140,6 @@ ToolBarManager::ToolBarManager( const Reference< XComponentContext >& rxContext, ...@@ -175,9 +140,6 @@ ToolBarManager::ToolBarManager( const Reference< XComponentContext >& rxContext,
m_bAddedToTaskPaneList( true ), m_bAddedToTaskPaneList( true ),
m_bFrameActionRegistered( false ), m_bFrameActionRegistered( false ),
m_bUpdateControllers( false ), m_bUpdateControllers( false ),
m_bImageOrientationRegistered( false ),
m_bImageMirrored( false ),
m_lImageRotation( 0 ),
m_pToolBar( pToolBar ), m_pToolBar( pToolBar ),
m_aResourceName( rResourceName ), m_aResourceName( rResourceName ),
m_xFrame( rFrame ), m_xFrame( rFrame ),
...@@ -343,61 +305,6 @@ void ToolBarManager::RefreshImages() ...@@ -343,61 +305,6 @@ void ToolBarManager::RefreshImages()
m_pToolBar->SetOutputSizePixel( aSize ); 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() void ToolBarManager::UpdateControllers()
{ {
...@@ -474,24 +381,6 @@ throw ( RuntimeException, std::exception ) ...@@ -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 ) 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 ...@@ -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_xDocImageManager.clear();
m_xModuleImageManager.clear(); m_xModuleImageManager.clear();
...@@ -606,14 +487,6 @@ void SAL_CALL ToolBarManager::dispose() throw( RuntimeException, std::exception ...@@ -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_xFrame.clear();
m_xContext.clear(); m_xContext.clear();
...@@ -982,7 +855,6 @@ void ToolBarManager::CreateControllers() ...@@ -982,7 +855,6 @@ void ToolBarManager::CreateControllers()
} }
AddFrameActionListener(); AddFrameActionListener();
AddImageOrientationListener();
} }
void ToolBarManager::AddFrameActionListener() void ToolBarManager::AddFrameActionListener()
...@@ -995,23 +867,6 @@ 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 ToolBarManager::ConvertStyleToToolboxItemBits( sal_Int32 nStyle )
{ {
ToolBoxItemBits nItemBits( ToolBoxItemBits::NONE ); ToolBoxItemBits nItemBits( ToolBoxItemBits::NONE );
......
...@@ -96,6 +96,9 @@ public: ...@@ -96,6 +96,9 @@ public:
const OUString& rsCommandName, const OUString& rsCommandName,
const css::uno::Reference<css::frame::XFrame>& rxFrame); const css::uno::Reference<css::frame::XFrame>& rxFrame);
bool IsRotated(const OUString& rsCommandName);
bool IsMirrored(const OUString& rsCommandName);
/** Do not call. Should be part of a local and hidden interface. /** Do not call. Should be part of a local and hidden interface.
*/ */
void SetFrame (const css::uno::Reference<css::frame::XFrame>& rxFrame); void SetFrame (const css::uno::Reference<css::frame::XFrame>& rxFrame);
...@@ -121,6 +124,7 @@ public: ...@@ -121,6 +124,7 @@ public:
css::uno::Sequence<css::beans::PropertyValue> GetCommandProperties ( css::uno::Sequence<css::beans::PropertyValue> GetCommandProperties (
const OUString& rsCommandName); const OUString& rsCommandName);
OUString GetCommandProperty(const OUString& rsProperty, const OUString& rsCommandName); OUString GetCommandProperty(const OUString& rsProperty, const OUString& rsCommandName);
bool ResourceHasKey(const OUString& rsResourceName, const OUString& rsCommandName);
static OUString RetrieveShortcutsFromConfiguration( static OUString RetrieveShortcutsFromConfiguration(
const css::uno::Reference<css::ui::XAcceleratorConfiguration>& rxConfiguration, const css::uno::Reference<css::ui::XAcceleratorConfiguration>& rxConfiguration,
const OUString& rsCommandName); const OUString& rsCommandName);
......
...@@ -20,13 +20,16 @@ ...@@ -20,13 +20,16 @@
#ifndef INCLUDED_VCL_TOOLBOX_HXX #ifndef INCLUDED_VCL_TOOLBOX_HXX
#define INCLUDED_VCL_TOOLBOX_HXX #define INCLUDED_VCL_TOOLBOX_HXX
#include <com/sun/star/frame/XFrame.hpp> #include <vcl/vclstatuslistener.hxx>
#include <rsc/rsc-vcl-shared-types.hxx> #include <rsc/rsc-vcl-shared-types.hxx>
#include <vcl/dllapi.h> #include <vcl/dllapi.h>
#include <vcl/dockwin.hxx> #include <vcl/dockwin.hxx>
#include <vcl/image.hxx> #include <vcl/image.hxx>
#include <vector> #include <vector>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/FeatureStateEvent.hpp>
class Timer; class Timer;
class UserDrawEvent; class UserDrawEvent;
struct ImplToolItem; struct ImplToolItem;
...@@ -94,6 +97,7 @@ private: ...@@ -94,6 +97,7 @@ private:
long mnBottomBorder; long mnBottomBorder;
long mnLastResizeDY; long mnLastResizeDY;
long mnActivateCount; long mnActivateCount;
long mnImagesRotationAngle;
sal_uInt16 mnLastFocusItemId; sal_uInt16 mnLastFocusItemId;
sal_uInt16 mnFocusPos; sal_uInt16 mnFocusPos;
sal_uInt16 mnOutStyle; sal_uInt16 mnOutStyle;
...@@ -128,7 +132,8 @@ private: ...@@ -128,7 +132,8 @@ private:
mbMenuStrings:1, mbMenuStrings:1,
mbIsShift:1, mbIsShift:1,
mbIsKeyEvent:1, mbIsKeyEvent:1,
mbChangingHighlight:1; mbChangingHighlight:1,
mbImagesMirrored:1;
WindowAlign meAlign; WindowAlign meAlign;
WindowAlign meDockAlign; WindowAlign meDockAlign;
ButtonType meButtonType; ButtonType meButtonType;
...@@ -143,6 +148,8 @@ private: ...@@ -143,6 +148,8 @@ private:
Link<CommandEvent const *, void> maCommandHandler; Link<CommandEvent const *, void> maCommandHandler;
Link<StateChangedType const *, void> maStateChangedHandler; Link<StateChangedType const *, void> maStateChangedHandler;
Link<DataChangedEvent const *, void> maDataChangedHandler; Link<DataChangedEvent const *, void> maDataChangedHandler;
/** StatusListener. Notifies about rotated images etc */
rtl::Reference<VclStatusListener<ToolBox>> mpStatusListener;
public: public:
using Window::ImplInit; using Window::ImplInit;
...@@ -356,6 +363,7 @@ public: ...@@ -356,6 +363,7 @@ public:
void SetItemImage( sal_uInt16 nItemId, const Image& rImage ); void SetItemImage( sal_uInt16 nItemId, const Image& rImage );
Image GetItemImage( sal_uInt16 nItemId ) const; Image GetItemImage( sal_uInt16 nItemId ) const;
Image GetItemImageOriginal( sal_uInt16 nItemId ) const; Image GetItemImageOriginal( sal_uInt16 nItemId ) const;
void UpdateImageOrientation();
void SetItemImageAngle( sal_uInt16 nItemId, long nAngle10 ); void SetItemImageAngle( sal_uInt16 nItemId, long nAngle10 );
void SetItemImageMirrorMode( sal_uInt16 nItemId, bool bMirror ); void SetItemImageMirrorMode( sal_uInt16 nItemId, bool bMirror );
void SetItemText( sal_uInt16 nItemId, const OUString& rText ); void SetItemText( sal_uInt16 nItemId, const OUString& rText );
...@@ -499,6 +507,7 @@ public: ...@@ -499,6 +507,7 @@ public:
void ChangeHighlight( sal_uInt16 nPos ); void ChangeHighlight( sal_uInt16 nPos );
void SetToolbarLayoutMode( ToolBoxLayoutMode eLayout ); void SetToolbarLayoutMode( ToolBoxLayoutMode eLayout );
void statusChanged(const css::frame::FeatureStateEvent& rEvent);
}; };
inline void ToolBox::CheckItem( sal_uInt16 nItemId, bool bCheck ) inline void ToolBox::CheckItem( sal_uInt16 nItemId, bool bCheck )
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <cppuhelper/implbase.hxx> #include <cppuhelper/implbase.hxx>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <vcl/dllapi.h>
#include <vcl/vclptr.hxx> #include <vcl/vclptr.hxx>
#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/Desktop.hpp>
...@@ -22,7 +21,7 @@ ...@@ -22,7 +21,7 @@
#include <com/sun/star/util/URL.hpp> #include <com/sun/star/util/URL.hpp>
#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/URLTransformer.hpp>
template <class T> class VCL_DLLPUBLIC VclStatusListener : public cppu::WeakImplHelper < css::frame::XStatusListener> template <class T> class VclStatusListener : public cppu::WeakImplHelper < css::frame::XStatusListener>
{ {
public: public:
VclStatusListener<T>(T* widget, const rtl::OUString& aCommand); VclStatusListener<T>(T* widget, const rtl::OUString& aCommand);
...@@ -97,4 +96,4 @@ void VclStatusListener<T>::dispose() ...@@ -97,4 +96,4 @@ void VclStatusListener<T>::dispose()
#endif // INCLUDED_VCL_VCLSTATUSLISTENER_HXX #endif // INCLUDED_VCL_VCLSTATUSLISTENER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
...@@ -276,6 +276,16 @@ sal_Int32 CommandInfoProvider::GetPropertiesForCommand ( ...@@ -276,6 +276,16 @@ sal_Int32 CommandInfoProvider::GetPropertiesForCommand (
return nValue; return nValue;
} }
bool CommandInfoProvider::IsRotated(const OUString& rsCommandName)
{
return ResourceHasKey("private:resource/image/commandrotateimagelist", rsCommandName);
}
bool CommandInfoProvider::IsMirrored(const OUString& rsCommandName)
{
return ResourceHasKey("private:resource/image/commandmirrorimagelist", rsCommandName);
}
void CommandInfoProvider::SetFrame (const Reference<frame::XFrame>& rxFrame) void CommandInfoProvider::SetFrame (const Reference<frame::XFrame>& rxFrame)
{ {
if (rxFrame != mxCachedDataFrame) if (rxFrame != mxCachedDataFrame)
...@@ -399,6 +409,32 @@ OUString CommandInfoProvider::RetrieveShortcutsFromConfiguration( ...@@ -399,6 +409,32 @@ OUString CommandInfoProvider::RetrieveShortcutsFromConfiguration(
return OUString(); return OUString();
} }
bool CommandInfoProvider::ResourceHasKey(const OUString& rsResourceName, const OUString& rsCommandName)
{
Sequence< OUString > aSequence;
try
{
const OUString sModuleIdentifier (GetModuleIdentifier());
if (!sModuleIdentifier.isEmpty())
{
Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(mxContext);
Reference<container::XNameAccess> xUICommandLabels;
if (xNameAccess->getByName(sModuleIdentifier) >>= xUICommandLabels) {
xUICommandLabels->getByName(rsResourceName) >>= aSequence;
for ( sal_Int32 i = 0; i < aSequence.getLength(); i++ )
{
if (aSequence[i] == rsCommandName)
return true;
}
}
}
}
catch (Exception&)
{
}
return false;
}
Sequence<beans::PropertyValue> CommandInfoProvider::GetCommandProperties(const OUString& rsCommandName) Sequence<beans::PropertyValue> CommandInfoProvider::GetCommandProperties(const OUString& rsCommandName)
{ {
Sequence<beans::PropertyValue> aProperties; Sequence<beans::PropertyValue> aProperties;
......
...@@ -17,23 +17,25 @@ ...@@ -17,23 +17,25 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include <tools/debug.hxx> #include <vcl/toolbox.hxx>
#include <tools/rc.h>
#include <tools/poly.hxx>
#include <vcl/event.hxx> #include <vcl/event.hxx>
#include <vcl/decoview.hxx> #include <vcl/decoview.hxx>
#include <vcl/accel.hxx> #include <vcl/accel.hxx>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <vcl/help.hxx> #include <vcl/help.hxx>
#include <vcl/spin.h> #include <vcl/spin.h>
#include <vcl/toolbox.hxx>
#include <vcl/bitmap.hxx> #include <vcl/bitmap.hxx>
#include <vcl/mnemonic.hxx> #include <vcl/mnemonic.hxx>
#include <vcl/gradient.hxx> #include <vcl/gradient.hxx>
#include <vcl/layout.hxx> #include <vcl/layout.hxx>
#include <vcl/menu.hxx> #include <vcl/menu.hxx>
#include <vcl/settings.hxx> #include <vcl/settings.hxx>
#include <vcl/vclstatuslistener.hxx>
#include <tools/debug.hxx>
#include <tools/rc.h>
#include <tools/poly.hxx>
#include <svl/imageitm.hxx>
#include <svdata.hxx> #include <svdata.hxx>
#include <window.h> #include <window.h>
...@@ -1398,6 +1400,7 @@ void ToolBox::ImplInit( vcl::Window* pParent, WinBits nStyle ) ...@@ -1398,6 +1400,7 @@ void ToolBox::ImplInit( vcl::Window* pParent, WinBits nStyle )
mnLastFocusItemId = 0; mnLastFocusItemId = 0;
mnKeyModifier = 0; mnKeyModifier = 0;
mnActivateCount = 0; mnActivateCount = 0;
mpStatusListener = new VclStatusListener<ToolBox>(this, ".uno:ImageOrientation");
mpIdle = new Idle("toolbox update"); mpIdle = new Idle("toolbox update");
mpIdle->SetPriority( SchedulerPriority::RESIZE ); mpIdle->SetPriority( SchedulerPriority::RESIZE );
...@@ -1658,6 +1661,10 @@ void ToolBox::dispose() ...@@ -1658,6 +1661,10 @@ void ToolBox::dispose()
pSVData->maCtrlData.mpTBDragMgr = nullptr; pSVData->maCtrlData.mpTBDragMgr = nullptr;
} }
} }
if (mpStatusListener.is())
mpStatusListener->dispose();
mpFloatWin.clear(); mpFloatWin.clear();
delete mpIdle; delete mpIdle;
...@@ -4542,6 +4549,21 @@ void ToolBox::DataChanged( const DataChangedEvent& rDCEvt ) ...@@ -4542,6 +4549,21 @@ void ToolBox::DataChanged( const DataChangedEvent& rDCEvt )
maDataChangedHandler.Call( &rDCEvt ); maDataChangedHandler.Call( &rDCEvt );
} }
void ToolBox::statusChanged( const css::frame::FeatureStateEvent& Event )
{
// Update image mirroring/rotation
if ( Event.FeatureURL.Complete == ".uno:ImageOrientation" )
{
SfxImageItem aItem( 1, 0 );
aItem.PutValue( Event.State, 0 );
mbImagesMirrored = aItem.IsMirrored();
mnImagesRotationAngle = aItem.GetRotation();
UpdateImageOrientation();
}
}
bool ToolBox::PrepareToggleFloatingMode() bool ToolBox::PrepareToggleFloatingMode()
{ {
return DockingWindow::PrepareToggleFloatingMode(); return DockingWindow::PrepareToggleFloatingMode();
......
...@@ -1232,6 +1232,17 @@ void ToolBox::SetItemImageMirrorMode( sal_uInt16 nItemId, bool bMirror ) ...@@ -1232,6 +1232,17 @@ void ToolBox::SetItemImageMirrorMode( sal_uInt16 nItemId, bool bMirror )
} }
} }
void ToolBox::UpdateImageOrientation()
{
for (std::vector<ImplToolItem>::const_iterator it = mpData->m_aItems.begin(); it != mpData->m_aItems.end(); ++it)
{
if (vcl::CommandInfoProvider::Instance().IsMirrored(it->maCommandStr))
SetItemImageMirrorMode(it->mnId, mbImagesMirrored);
if (vcl::CommandInfoProvider::Instance().IsRotated(it->maCommandStr))
SetItemImageAngle(it->mnId, mnImagesRotationAngle);
}
}
Image ToolBox::GetItemImage(sal_uInt16 nItemId) const Image ToolBox::GetItemImage(sal_uInt16 nItemId) const
{ {
ImplToolItem* pItem = ImplGetItem(nItemId); ImplToolItem* pItem = ImplGetItem(nItemId);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment