Files
odfstudio/sc/source/ui/cctrl/SheetViewControl.cxx
Tomaž Vajngerl 58b03b018b sc: remove UNO command CurrentSheetView for SelectSheetView
CurrentSheetView is used mainly for the combo box on the ToolBar,
where you can change the sheet view used in the current sheet.
But we already have SelectSheetView UNO command, which is used
to show a dialog with all the sheet views. This merges the
functionality from CurrentSheetView with SelectSheetView and
changes the code to use SelectSheetView for the ToolBar as well.
All the uses for CurrentSheetView command have been removed.

This also removes the hack to force an update, as this is not
needed anymore with the changes in the SheetViewControl.

Change-Id: Id1b429fff6b01bfb69e3f5c0eb16f1ac6f27f901
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200754
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202026
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
(cherry picked from commit e4f42edf8860006f404e34c2be08873a9b561602)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205416
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-20 17:06:47 +02:00

65 lines
2.0 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <SheetViewControl.hxx>
#include <SheetViewBox.hxx>
#include <tabvwsh.hxx>
#include <svl/intitem.hxx>
#include <vcl/toolbox.hxx>
#include <sfx2/viewsh.hxx>
#include <svl/voiditem.hxx>
using namespace sc;
SFX_IMPL_TOOLBOX_CONTROL(SheetViewControl, SfxVoidItem);
SheetViewControl::SheetViewControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx)
: SfxToolBoxControl(nSlotId, nId, rTbx)
{
}
SheetViewControl::~SheetViewControl() {}
void SheetViewControl::StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemState eState,
const SfxPoolItem* pState)
{
ToolBoxItemId nId = GetId();
ToolBox& rToolBox = GetToolBox();
SheetViewBox* pSheetViewBox = static_cast<SheetViewBox*>(rToolBox.GetItemWindow(nId));
css::uno::Reference<css::frame::XFrame> xFrame = getFrameInterface();
SfxViewShell* pShell = SfxViewShell::Get(xFrame->getController());
ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pShell);
if (!pTabViewShell)
return;
ScViewData& rViewData = pTabViewShell->GetViewData();
if (SfxItemState::DISABLED == eState)
pSheetViewBox->Disable();
else
pSheetViewBox->Enable();
rToolBox.EnableItem(nId, SfxItemState::DISABLED != eState);
pSheetViewBox->Update(rViewData);
SfxToolBoxControl::StateChangedAtToolBoxControl(nSID, eState, pState);
}
VclPtr<InterimItemWindow> SheetViewControl::CreateItemWindow(vcl::Window* pParent)
{
VclPtr<SheetViewBox> pControl = VclPtr<SheetViewBox>::Create(pParent);
pControl->Show();
return pControl;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */