1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sc.hxx"
26
27
28
29 // INCLUDE ---------------------------------------------------------------
30
31 #include <svl/intitem.hxx>
32 #include <svl/stritem.hxx>
33
34 #include "navcitem.hxx"
35 #include "global.hxx"
36 #include "navipi.hxx"
37 #include "sc.hrc" // -> Item-IDs
38
39 // STATIC DATA -----------------------------------------------------------
40
41
42 //------------------------------------------------------------------------
43
ScNavigatorControllerItem(sal_uInt16 nIdP,ScNavigatorDlg & rDlg,SfxBindings & rBindings)44 ScNavigatorControllerItem::ScNavigatorControllerItem( sal_uInt16 nIdP,
45 ScNavigatorDlg& rDlg,
46 SfxBindings& rBindings )
47 : SfxControllerItem ( nIdP, rBindings ),
48 rNavigatorDlg ( rDlg )
49 {
50 }
51
52 //------------------------------------------------------------------------
53
StateChanged(sal_uInt16,SfxItemState,const SfxPoolItem * pItem)54 void __EXPORT ScNavigatorControllerItem::StateChanged( sal_uInt16 /* nSID */, SfxItemState /* eState */,
55 const SfxPoolItem* pItem )
56 {
57 switch( GetId() )
58 {
59 case SID_CURRENTCELL:
60 if ( pItem )
61 {
62 // const SfxPointItem* pCellPosItem = PTR_CAST(SfxPointItem, pItem);
63 const SfxStringItem* pCellPosItem = PTR_CAST(SfxStringItem, pItem);
64
65 DBG_ASSERT( pCellPosItem, "SfxStringItem expected!" );
66
67 if ( pCellPosItem )
68 {
69 String aAddress( pCellPosItem->GetValue() );
70 ScAddress aScAddress;
71 aScAddress.Parse( aAddress );
72
73 SCCOL nCol = aScAddress.Col()+1;
74 SCROW nRow = aScAddress.Row()+1;
75
76 // SCCOL nCol = (sal_uInt16)pCellPosItem->GetValue().X()+1;
77 // SCROW nRow = (sal_uInt16)pCellPosItem->GetValue().Y()+1;
78
79 rNavigatorDlg.UpdateColumn( &nCol );
80 rNavigatorDlg.UpdateRow ( &nRow );
81 rNavigatorDlg.CursorPosChanged();
82 }
83 }
84 break;
85
86 case SID_CURRENTTAB:
87 if ( pItem )
88 {
89 const SfxUInt16Item* pTabItem = PTR_CAST(SfxUInt16Item, pItem);
90
91 DBG_ASSERT( pTabItem, "SfxUInt16Item expected!" );
92
93 // Tabelle fuer Basic ist 1-basiert
94 if ( pTabItem && pTabItem->GetValue() )
95 {
96 SCTAB nTab = pTabItem->GetValue() - 1;
97
98 rNavigatorDlg.UpdateTable( &nTab );
99 rNavigatorDlg.UpdateColumn();
100 rNavigatorDlg.UpdateRow();
101 rNavigatorDlg.CursorPosChanged();
102 }
103 }
104 break;
105
106 case SID_CURRENTDOC:
107 //
108 // gar nix mehr, wird ueber SFX_HINT_DOCCHANGED erledigt
109 //
110 break;
111
112
113 case SID_SELECT_SCENARIO:
114 rNavigatorDlg.aWndScenarios.NotifyState( pItem );
115 break;
116
117 default:
118 break;
119 }
120 }
121
122
123
124