Update ooo320-m1
[ooovba.git] / sc / source / ui / navipi / navcitem.cxx
blobdc1d6dc3d0892e92f74ac93aab74220acf98acb2
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: navcitem.cxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
36 // INCLUDE ---------------------------------------------------------------
38 #include <svtools/intitem.hxx>
39 #include <svtools/stritem.hxx>
41 #include "navcitem.hxx"
42 #include "global.hxx"
43 #include "navipi.hxx"
44 #include "sc.hrc" // -> Item-IDs
46 // STATIC DATA -----------------------------------------------------------
49 //------------------------------------------------------------------------
51 ScNavigatorControllerItem::ScNavigatorControllerItem( USHORT nIdP,
52 ScNavigatorDlg& rDlg,
53 SfxBindings& rBindings )
54 : SfxControllerItem ( nIdP, rBindings ),
55 rNavigatorDlg ( rDlg )
59 //------------------------------------------------------------------------
61 void __EXPORT ScNavigatorControllerItem::StateChanged( USHORT /* nSID */, SfxItemState /* eState */,
62 const SfxPoolItem* pItem )
64 switch( GetId() )
66 case SID_CURRENTCELL:
67 if ( pItem )
69 // const SfxPointItem* pCellPosItem = PTR_CAST(SfxPointItem, pItem);
70 const SfxStringItem* pCellPosItem = PTR_CAST(SfxStringItem, pItem);
72 DBG_ASSERT( pCellPosItem, "SfxStringItem expected!" );
74 if ( pCellPosItem )
76 String aAddress( pCellPosItem->GetValue() );
77 ScAddress aScAddress;
78 aScAddress.Parse( aAddress );
80 SCCOL nCol = aScAddress.Col()+1;
81 SCROW nRow = aScAddress.Row()+1;
83 // SCCOL nCol = (USHORT)pCellPosItem->GetValue().X()+1;
84 // SCROW nRow = (USHORT)pCellPosItem->GetValue().Y()+1;
86 rNavigatorDlg.UpdateColumn( &nCol );
87 rNavigatorDlg.UpdateRow ( &nRow );
88 rNavigatorDlg.CursorPosChanged();
91 break;
93 case SID_CURRENTTAB:
94 if ( pItem )
96 const SfxUInt16Item* pTabItem = PTR_CAST(SfxUInt16Item, pItem);
98 DBG_ASSERT( pTabItem, "SfxUInt16Item expected!" );
100 // Tabelle fuer Basic ist 1-basiert
101 if ( pTabItem && pTabItem->GetValue() )
103 SCTAB nTab = pTabItem->GetValue() - 1;
105 rNavigatorDlg.UpdateTable( &nTab );
106 rNavigatorDlg.UpdateColumn();
107 rNavigatorDlg.UpdateRow();
108 rNavigatorDlg.CursorPosChanged();
111 break;
113 case SID_CURRENTDOC:
115 // gar nix mehr, wird ueber SFX_HINT_DOCCHANGED erledigt
117 break;
120 case SID_SELECT_SCENARIO:
121 rNavigatorDlg.aWndScenarios.NotifyState( pItem );
122 break;
124 default:
125 break;