diff options
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/sdi/baside.sdi | 12 | ||||
-rw-r--r-- | basctl/source/basicide/basides1.cxx | 38 |
2 files changed, 50 insertions, 0 deletions
diff --git a/basctl/sdi/baside.sdi b/basctl/sdi/baside.sdi index c1fc9b4f39e3..0d32339fc833 100644 --- a/basctl/sdi/baside.sdi +++ b/basctl/sdi/baside.sdi @@ -337,6 +337,18 @@ shell basctl_Shell StateMethod = GetState; ] + SID_ZOOM_IN + [ + ExecMethod = ExecuteGlobal; + StateMethod = GetState; + ] + + SID_ZOOM_OUT + [ + ExecMethod = ExecuteGlobal; + StateMethod = GetState; + ] + SID_BASICIDE_CURRENT_ZOOM [ StateMethod = GetState; diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index c690dccddc54..5e985211aa42 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -58,6 +58,7 @@ #include <vcl/weld.hxx> #include <svx/zoomsliderctrl.hxx> #include <svx/zoomslideritem.hxx> +#include <basegfx/utils/zoomtools.hxx> constexpr sal_Int32 TAB_HEIGHT_MARGIN = 10; @@ -68,6 +69,17 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::frame; +static void lcl_InvalidateZoomSlots(SfxBindings* pBindings) +{ + if (!pBindings) + return; + + static sal_uInt16 const aInval[] = { + SID_ZOOM_OUT, SID_ZOOM_IN, SID_ATTR_ZOOMSLIDER, 0 + }; + pBindings->Invalidate(aInval); +} + void Shell::ExecuteSearch( SfxRequest& rReq ) { if ( !pCurWin ) @@ -771,6 +783,22 @@ void Shell::ExecuteGlobal( SfxRequest& rReq ) if (pArgs && pArgs->GetItemState(SID_ATTR_ZOOMSLIDER, true, &pItem ) == SfxItemState::SET) SetGlobalEditorZoomLevel(static_cast<const SvxZoomSliderItem*>(pItem)->GetValue()); + + lcl_InvalidateZoomSlots(GetBindingsPtr()); + } + break; + + case SID_ZOOM_IN: + case SID_ZOOM_OUT: + { + const sal_uInt16 nOldZoom = GetCurrentZoomSliderValue(); + sal_uInt16 nNewZoom; + if (nSlot == SID_ZOOM_IN) + nNewZoom = std::min<sal_uInt16>(GetMaxZoom(), basegfx::zoomtools::zoomIn(nOldZoom)); + else + nNewZoom = std::max<sal_uInt16>(GetMinZoom(), basegfx::zoomtools::zoomOut(nOldZoom)); + SetGlobalEditorZoomLevel(nNewZoom); + lcl_InvalidateZoomSlots(GetBindingsPtr()); } break; @@ -1137,6 +1165,16 @@ void Shell::GetState(SfxItemSet &rSet) } break; + case SID_ZOOM_IN: + case SID_ZOOM_OUT: + { + const sal_uInt16 nCurrentZoom = GetCurrentZoomSliderValue(); + if ((nWh == SID_ZOOM_IN && nCurrentZoom >= GetMaxZoom()) || + (nWh == SID_ZOOM_OUT && nCurrentZoom <= GetMinZoom())) + rSet.DisableItem(nWh); + } + break; + case SID_ATTR_ZOOMSLIDER: { // The zoom slider is only visible in a module window |