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