LibreOffice Module sc (master) 1
navcitem.cxx
Go to the documentation of this file.
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 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <svl/intitem.hxx>
21#include <svl/stritem.hxx>
22#include <osl/diagnose.h>
23
24#include <navcitem.hxx>
25#include <navipi.hxx>
26#include <viewdata.hxx>
27#include <sc.hrc>
28
30 ScNavigatorDlg& rDlg,
31 SfxBindings& rBindings )
32 : SfxControllerItem ( nIdP, rBindings ),
33 rNavigatorDlg ( rDlg )
34{
35}
36
38 const SfxPoolItem* pItem )
39{
40 switch( GetId() )
41 {
42 case SID_CURRENTCELL:
43 if ( pItem )
44 {
46 const SfxStringItem* pCellPosItem = dynamic_cast<const SfxStringItem*>( pItem );
47
48 OSL_ENSURE( pCellPosItem, "SfxStringItem expected!" );
49
50 if (pCellPosItem && pViewData)
51 {
52 const OUString& aAddress( pCellPosItem->GetValue() );
53 ScAddress aScAddress;
54 aScAddress.Parse(aAddress, pViewData->GetDocument());
55
56 SCCOL nCol = aScAddress.Col()+1;
57 SCROW nRow = aScAddress.Row()+1;
58
60 rNavigatorDlg.UpdateRow ( &nRow );
61 }
62 }
63 break;
64
65 case SID_CURRENTTAB:
66 if ( pItem )
67 {
68 const SfxUInt16Item* pTabItem = dynamic_cast< const SfxUInt16Item *>( pItem );
69
70 OSL_ENSURE( pTabItem, "SfxUInt16Item expected!" );
71
72 // table for Basic is 1-based
73 if ( pTabItem && pTabItem->GetValue() )
74 {
75 SCTAB nTab = pTabItem->GetValue() - 1;
76
80 }
81 }
82 break;
83
84 case SID_CURRENTDOC:
85
86 // nothing is done via SfxHintId::DocChanged
87
88 break;
89
90 case SID_SELECT_SCENARIO:
91 rNavigatorDlg.m_xWndScenarios->NotifyState(pItem);
92 break;
93
94 default:
95 break;
96 }
97}
98
99/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt16 GetValue() const
const OUString & GetValue() const
SC_DLLPUBLIC ScRefFlags Parse(const OUString &, const ScDocument &, const Details &rDetails=detailsOOOa1, ExternalInfo *pExtInfo=nullptr, const css::uno::Sequence< css::sheet::ExternalLinkInfo > *pExternalLinks=nullptr, sal_Int32 *pSheetEndPos=nullptr, const OUString *pErrRef=nullptr)
Definition: address.cxx:1537
SCROW Row() const
Definition: address.hxx:274
SCCOL Col() const
Definition: address.hxx:279
ScNavigatorControllerItem(sal_uInt16 nId, ScNavigatorDlg &rDlg, SfxBindings &rBindings)
Definition: navcitem.cxx:29
ScNavigatorDlg & rNavigatorDlg
Definition: navcitem.hxx:37
virtual void StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem *pItem) override
Definition: navcitem.cxx:37
void UpdateColumn(const SCCOL *pCol=nullptr)
Definition: navipi.cxx:726
ScViewData * GetViewData()
Definition: navipi.cxx:719
void UpdateTable(const SCTAB *pTab)
Definition: navipi.cxx:746
void UpdateRow(const SCROW *pRow=nullptr)
Definition: navipi.cxx:736
std::unique_ptr< ScScenarioWindow > m_xWndScenarios
Definition: navipi.hxx:103
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
sal_uInt16 GetId() const
SfxItemState
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17