summaryrefslogtreecommitdiff
path: root/vcl/source/window
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 /vcl/source/window
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 'vcl/source/window')
-rw-r--r--vcl/source/window/toolbox.cxx32
-rw-r--r--vcl/source/window/toolbox2.cxx11
2 files changed, 38 insertions, 5 deletions
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 4105b586a40e..e0e84920a33f 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -17,23 +17,25 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <tools/debug.hxx>
-#include <tools/rc.h>
-#include <tools/poly.hxx>
-
+#include <vcl/toolbox.hxx>
#include <vcl/event.hxx>
#include <vcl/decoview.hxx>
#include <vcl/accel.hxx>
#include <vcl/svapp.hxx>
#include <vcl/help.hxx>
#include <vcl/spin.h>
-#include <vcl/toolbox.hxx>
#include <vcl/bitmap.hxx>
#include <vcl/mnemonic.hxx>
#include <vcl/gradient.hxx>
#include <vcl/layout.hxx>
#include <vcl/menu.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 <window.h>
@@ -1397,6 +1399,7 @@ void ToolBox::ImplInit( vcl::Window* pParent, WinBits nStyle )
mnLastFocusItemId = 0;
mnKeyModifier = 0;
mnActivateCount = 0;
+ mpStatusListener = new VclStatusListener<ToolBox>(this, ".uno:ImageOrientation");
mpIdle = new Idle("toolbox update");
mpIdle->SetPriority( SchedulerPriority::RESIZE );
@@ -1657,6 +1660,10 @@ void ToolBox::dispose()
pSVData->maCtrlData.mpTBDragMgr = nullptr;
}
}
+
+ if (mpStatusListener.is())
+ mpStatusListener->dispose();
+
mpFloatWin.clear();
delete mpIdle;
@@ -4540,6 +4547,21 @@ void ToolBox::DataChanged( const DataChangedEvent& 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()
{
return DockingWindow::PrepareToggleFloatingMode();
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index dddb65fba628..0c916f6c1d75 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -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
{
ImplToolItem* pItem = ImplGetItem(nItemId);