/src/libreoffice/sc/source/ui/cctrl/SheetViewControl.cxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
5 | | * This Source Code Form is subject to the terms of the Mozilla Public |
6 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
7 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
8 | | */ |
9 | | |
10 | | #include <SheetViewControl.hxx> |
11 | | #include <SheetViewBox.hxx> |
12 | | #include <svl/intitem.hxx> |
13 | | #include <vcl/toolbox.hxx> |
14 | | |
15 | | using namespace sc; |
16 | | |
17 | | SFX_IMPL_TOOLBOX_CONTROL(SheetViewControl, SfxInt32Item); |
18 | | |
19 | | SheetViewControl::SheetViewControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx) |
20 | 0 | : SfxToolBoxControl(nSlotId, nId, rTbx) |
21 | 0 | { |
22 | 0 | } |
23 | | |
24 | 0 | SheetViewControl::~SheetViewControl() {} |
25 | | |
26 | | void SheetViewControl::StateChangedAtToolBoxControl(sal_uInt16, SfxItemState eState, |
27 | | const SfxPoolItem* pState) |
28 | 0 | { |
29 | 0 | ToolBoxItemId nId = GetId(); |
30 | 0 | ToolBox& rToolBox = GetToolBox(); |
31 | 0 | SheetViewBox* pSheetViewBox = static_cast<SheetViewBox*>(rToolBox.GetItemWindow(nId)); |
32 | |
|
33 | 0 | if (SfxItemState::DISABLED == eState) |
34 | 0 | pSheetViewBox->Disable(); |
35 | 0 | else |
36 | 0 | pSheetViewBox->Enable(); |
37 | |
|
38 | 0 | rToolBox.EnableItem(nId, SfxItemState::DISABLED != eState); |
39 | |
|
40 | 0 | switch (eState) |
41 | 0 | { |
42 | 0 | case SfxItemState::DEFAULT: |
43 | 0 | { |
44 | 0 | const auto* pItem = static_cast<const SfxInt32Item*>(pState); |
45 | 0 | sc::SheetViewID nValue = pItem->GetValue(); |
46 | 0 | pSheetViewBox->Update(nValue); |
47 | 0 | break; |
48 | 0 | } |
49 | | |
50 | 0 | default: |
51 | 0 | break; |
52 | 0 | } |
53 | 0 | } |
54 | | |
55 | | VclPtr<InterimItemWindow> SheetViewControl::CreateItemWindow(vcl::Window* pParent) |
56 | 0 | { |
57 | 0 | VclPtr<SheetViewBox> pControl = VclPtr<SheetViewBox>::Create(pParent); |
58 | 0 | pControl->Show(); |
59 | |
|
60 | 0 | return pControl; |
61 | 0 | } |
62 | | |
63 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |