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