/src/libreoffice/sc/source/ui/navipi/navcitem.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 | | * 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 | | |
29 | | ScNavigatorControllerItem::ScNavigatorControllerItem( sal_uInt16 nIdP, |
30 | | ScNavigatorDlg& rDlg, |
31 | | SfxBindings& rBindings ) |
32 | 0 | : SfxControllerItem ( nIdP, rBindings ), |
33 | 0 | rNavigatorDlg ( rDlg ) |
34 | 0 | { |
35 | 0 | } |
36 | | |
37 | | void ScNavigatorControllerItem::StateChangedAtToolBoxControl( sal_uInt16 /* nSID */, SfxItemState /* eState */, |
38 | | const SfxPoolItem* pItem ) |
39 | 0 | { |
40 | 0 | switch( GetId() ) |
41 | 0 | { |
42 | 0 | case SID_CURRENTCELL: |
43 | 0 | if ( pItem ) |
44 | 0 | { |
45 | 0 | ScViewData* pViewData = ScNavigatorDlg::GetViewData(); |
46 | 0 | const SfxStringItem* pCellPosItem = dynamic_cast<const SfxStringItem*>( pItem ); |
47 | |
|
48 | 0 | OSL_ENSURE( pCellPosItem, "SfxStringItem expected!" ); |
49 | |
|
50 | 0 | if (pCellPosItem && pViewData) |
51 | 0 | { |
52 | 0 | const OUString& aAddress( pCellPosItem->GetValue() ); |
53 | 0 | ScAddress aScAddress; |
54 | 0 | aScAddress.Parse(aAddress, pViewData->GetDocument()); |
55 | |
|
56 | 0 | SCCOL nCol = aScAddress.Col()+1; |
57 | 0 | SCROW nRow = aScAddress.Row()+1; |
58 | |
|
59 | 0 | rNavigatorDlg.UpdateColumn( &nCol ); |
60 | 0 | rNavigatorDlg.UpdateRow ( &nRow ); |
61 | 0 | } |
62 | 0 | } |
63 | 0 | break; |
64 | | |
65 | 0 | case SID_CURRENTTAB: |
66 | 0 | if ( pItem ) |
67 | 0 | { |
68 | 0 | const SfxUInt16Item* pTabItem = dynamic_cast< const SfxUInt16Item *>( pItem ); |
69 | |
|
70 | 0 | OSL_ENSURE( pTabItem, "SfxUInt16Item expected!" ); |
71 | | |
72 | | // table for Basic is 1-based |
73 | 0 | if ( pTabItem && pTabItem->GetValue() ) |
74 | 0 | { |
75 | 0 | SCTAB nTab = pTabItem->GetValue() - 1; |
76 | |
|
77 | 0 | rNavigatorDlg.UpdateTable( &nTab ); |
78 | 0 | rNavigatorDlg.UpdateColumn(); |
79 | 0 | rNavigatorDlg.UpdateRow(); |
80 | 0 | } |
81 | 0 | } |
82 | 0 | break; |
83 | | |
84 | 0 | case SID_CURRENTDOC: |
85 | | |
86 | | // nothing is done via SfxHintId::DocChanged |
87 | |
|
88 | 0 | break; |
89 | | |
90 | 0 | case SID_SELECT_SCENARIO: |
91 | 0 | rNavigatorDlg.m_xWndScenarios->NotifyState(pItem); |
92 | 0 | break; |
93 | | |
94 | 0 | default: |
95 | 0 | break; |
96 | 0 | } |
97 | 0 | } |
98 | | |
99 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |