Line data Source code
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 :
23 : #include "navcitem.hxx"
24 : #include "global.hxx"
25 : #include "navipi.hxx"
26 : #include "sc.hrc" // -> Item-IDs
27 :
28 : // STATIC DATA -----------------------------------------------------------
29 :
30 :
31 : //------------------------------------------------------------------------
32 :
33 0 : ScNavigatorControllerItem::ScNavigatorControllerItem( sal_uInt16 nIdP,
34 : ScNavigatorDlg& rDlg,
35 : SfxBindings& rBindings )
36 : : SfxControllerItem ( nIdP, rBindings ),
37 0 : rNavigatorDlg ( rDlg )
38 : {
39 0 : }
40 :
41 : //------------------------------------------------------------------------
42 :
43 0 : void ScNavigatorControllerItem::StateChanged( sal_uInt16 /* nSID */, SfxItemState /* eState */,
44 : const SfxPoolItem* pItem )
45 : {
46 0 : switch( GetId() )
47 : {
48 : case SID_CURRENTCELL:
49 0 : if ( pItem )
50 : {
51 0 : const SfxStringItem* pCellPosItem = PTR_CAST(SfxStringItem, pItem);
52 :
53 : OSL_ENSURE( pCellPosItem, "SfxStringItem expected!" );
54 :
55 0 : if ( pCellPosItem )
56 : {
57 0 : String aAddress( pCellPosItem->GetValue() );
58 0 : ScAddress aScAddress;
59 0 : aScAddress.Parse( aAddress );
60 :
61 0 : SCCOL nCol = aScAddress.Col()+1;
62 0 : SCROW nRow = aScAddress.Row()+1;
63 :
64 0 : rNavigatorDlg.UpdateColumn( &nCol );
65 0 : rNavigatorDlg.UpdateRow ( &nRow );
66 0 : rNavigatorDlg.CursorPosChanged();
67 : }
68 : }
69 0 : break;
70 :
71 : case SID_CURRENTTAB:
72 0 : if ( pItem )
73 : {
74 0 : const SfxUInt16Item* pTabItem = PTR_CAST(SfxUInt16Item, pItem);
75 :
76 : OSL_ENSURE( pTabItem, "SfxUInt16Item expected!" );
77 :
78 : // Tabelle fuer Basic ist 1-basiert
79 0 : if ( pTabItem && pTabItem->GetValue() )
80 : {
81 0 : SCTAB nTab = pTabItem->GetValue() - 1;
82 :
83 0 : rNavigatorDlg.UpdateTable( &nTab );
84 0 : rNavigatorDlg.UpdateColumn();
85 0 : rNavigatorDlg.UpdateRow();
86 0 : rNavigatorDlg.CursorPosChanged();
87 : }
88 : }
89 0 : break;
90 :
91 : case SID_CURRENTDOC:
92 : //
93 : // gar nix mehr, wird ueber SFX_HINT_DOCCHANGED erledigt
94 : //
95 0 : break;
96 :
97 :
98 : case SID_SELECT_SCENARIO:
99 0 : rNavigatorDlg.aWndScenarios.NotifyState( pItem );
100 0 : break;
101 :
102 : default:
103 0 : break;
104 : }
105 0 : }
106 :
107 :
108 :
109 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|