Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <svl/intitem.hxx>
30 : : #include <svl/stritem.hxx>
31 : :
32 : : #include "navcitem.hxx"
33 : : #include "global.hxx"
34 : : #include "navipi.hxx"
35 : : #include "sc.hrc" // -> Item-IDs
36 : :
37 : : // STATIC DATA -----------------------------------------------------------
38 : :
39 : :
40 : : //------------------------------------------------------------------------
41 : :
42 : 0 : ScNavigatorControllerItem::ScNavigatorControllerItem( sal_uInt16 nIdP,
43 : : ScNavigatorDlg& rDlg,
44 : : SfxBindings& rBindings )
45 : : : SfxControllerItem ( nIdP, rBindings ),
46 : 0 : rNavigatorDlg ( rDlg )
47 : : {
48 : 0 : }
49 : :
50 : : //------------------------------------------------------------------------
51 : :
52 : 0 : void ScNavigatorControllerItem::StateChanged( sal_uInt16 /* nSID */, SfxItemState /* eState */,
53 : : const SfxPoolItem* pItem )
54 : : {
55 [ # # # # : 0 : switch( GetId() )
# ]
56 : : {
57 : : case SID_CURRENTCELL:
58 [ # # ]: 0 : if ( pItem )
59 : : {
60 [ # # ][ # # ]: 0 : const SfxStringItem* pCellPosItem = PTR_CAST(SfxStringItem, pItem);
61 : :
62 : : OSL_ENSURE( pCellPosItem, "SfxStringItem expected!" );
63 : :
64 [ # # ]: 0 : if ( pCellPosItem )
65 : : {
66 [ # # ]: 0 : String aAddress( pCellPosItem->GetValue() );
67 : 0 : ScAddress aScAddress;
68 [ # # ]: 0 : aScAddress.Parse( aAddress );
69 : :
70 : 0 : SCCOL nCol = aScAddress.Col()+1;
71 : 0 : SCROW nRow = aScAddress.Row()+1;
72 : :
73 [ # # ]: 0 : rNavigatorDlg.UpdateColumn( &nCol );
74 [ # # ]: 0 : rNavigatorDlg.UpdateRow ( &nRow );
75 [ # # ][ # # ]: 0 : rNavigatorDlg.CursorPosChanged();
76 : : }
77 : : }
78 : 0 : break;
79 : :
80 : : case SID_CURRENTTAB:
81 [ # # ]: 0 : if ( pItem )
82 : : {
83 [ # # ][ # # ]: 0 : const SfxUInt16Item* pTabItem = PTR_CAST(SfxUInt16Item, pItem);
84 : :
85 : : OSL_ENSURE( pTabItem, "SfxUInt16Item expected!" );
86 : :
87 : : // Tabelle fuer Basic ist 1-basiert
88 [ # # ][ # # ]: 0 : if ( pTabItem && pTabItem->GetValue() )
[ # # ]
89 : : {
90 : 0 : SCTAB nTab = pTabItem->GetValue() - 1;
91 : :
92 [ # # ]: 0 : rNavigatorDlg.UpdateTable( &nTab );
93 [ # # ]: 0 : rNavigatorDlg.UpdateColumn();
94 [ # # ]: 0 : rNavigatorDlg.UpdateRow();
95 [ # # ]: 0 : rNavigatorDlg.CursorPosChanged();
96 : : }
97 : : }
98 : 0 : break;
99 : :
100 : : case SID_CURRENTDOC:
101 : : //
102 : : // gar nix mehr, wird ueber SFX_HINT_DOCCHANGED erledigt
103 : : //
104 : 0 : break;
105 : :
106 : :
107 : : case SID_SELECT_SCENARIO:
108 : 0 : rNavigatorDlg.aWndScenarios.NotifyState( pItem );
109 : 0 : break;
110 : :
111 : : default:
112 : 0 : break;
113 : : }
114 : 0 : }
115 : :
116 : :
117 : :
118 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|