xref: /aoo42x/main/sc/source/ui/navipi/navipi.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_sc.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir //------------------------------------------------------------------
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir // #include <math.h>
34*cdf0e10cSrcweir #include <rangelst.hxx>
35*cdf0e10cSrcweir #include <sfx2/app.hxx>
36*cdf0e10cSrcweir #include <sfx2/bindings.hxx>
37*cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
38*cdf0e10cSrcweir #include <sfx2/event.hxx>
39*cdf0e10cSrcweir #include <sfx2/imgmgr.hxx>
40*cdf0e10cSrcweir #include <sfx2/navigat.hxx>
41*cdf0e10cSrcweir #include <svl/stritem.hxx>
42*cdf0e10cSrcweir #include <svl/urlbmk.hxx>
43*cdf0e10cSrcweir #include <vcl/sound.hxx>
44*cdf0e10cSrcweir #include <unotools/charclass.hxx>
45*cdf0e10cSrcweir #include <stdlib.h>
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir #include "viewdata.hxx"
48*cdf0e10cSrcweir #include "tabvwsh.hxx"
49*cdf0e10cSrcweir #include "docsh.hxx"
50*cdf0e10cSrcweir #include "document.hxx"
51*cdf0e10cSrcweir #include "dbcolect.hxx"
52*cdf0e10cSrcweir #include "rangenam.hxx"
53*cdf0e10cSrcweir #include "rangeutl.hxx"
54*cdf0e10cSrcweir #include "popmenu.hxx"
55*cdf0e10cSrcweir #include "scresid.hxx"
56*cdf0e10cSrcweir #include "scmod.hxx"
57*cdf0e10cSrcweir #include "navicfg.hxx"
58*cdf0e10cSrcweir #include "navcitem.hxx"
59*cdf0e10cSrcweir #include "navipi.hrc"
60*cdf0e10cSrcweir #include "navipi.hxx"
61*cdf0e10cSrcweir #include "navsett.hxx"
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir //	Timeout, um Notizen zu suchen
64*cdf0e10cSrcweir #define SC_CONTENT_TIMEOUT	1000
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir //	Toleranz, wieviel ueber der eingeklappten Groesse noch klein ist
67*cdf0e10cSrcweir #define SCNAV_MINTOL		5
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir //  maximum values for UI
70*cdf0e10cSrcweir #define SCNAV_MAXCOL        (MAXCOLCOUNT)
71*cdf0e10cSrcweir // macro is sufficient since only used in ctor
72*cdf0e10cSrcweir #define SCNAV_COLDIGITS     (static_cast<xub_StrLen>( floor( log10( static_cast<double>(SCNAV_MAXCOL)))) + 1)   // 1...256...18278
73*cdf0e10cSrcweir // precomputed constant because it is used in every change of spin button field
74*cdf0e10cSrcweir static const xub_StrLen SCNAV_COLLETTERS = ::ScColToAlpha(SCNAV_MAXCOL).Len();    // A...IV...ZZZ
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir #define SCNAV_MAXROW        (MAXROWCOUNT)
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir //------------------------------------------------------------------------
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir //	static
81*cdf0e10cSrcweir void ScNavigatorDlg::ReleaseFocus()
82*cdf0e10cSrcweir {
83*cdf0e10cSrcweir 	SfxViewShell* pCurSh = SfxViewShell::Current();
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir 	if ( pCurSh )
86*cdf0e10cSrcweir 	{
87*cdf0e10cSrcweir 		Window* pShellWnd = pCurSh->GetWindow();
88*cdf0e10cSrcweir 		if ( pShellWnd )
89*cdf0e10cSrcweir 			pShellWnd->GrabFocus();
90*cdf0e10cSrcweir 	}
91*cdf0e10cSrcweir }
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir //==================================================================
94*cdf0e10cSrcweir //	class ColumnEdit
95*cdf0e10cSrcweir //==================================================================
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir ColumnEdit::ColumnEdit( ScNavigatorDlg* pParent, const ResId& rResId )
98*cdf0e10cSrcweir 	:	SpinField	( pParent, rResId ),
99*cdf0e10cSrcweir 		rDlg		( *pParent ),
100*cdf0e10cSrcweir 		nCol		( 0 ),
101*cdf0e10cSrcweir 		nKeyGroup	( KEYGROUP_ALPHA )
102*cdf0e10cSrcweir {
103*cdf0e10cSrcweir     SetMaxTextLen( SCNAV_COLDIGITS );   // 1...256...18278 or A...IV...ZZZ
104*cdf0e10cSrcweir }
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir //------------------------------------------------------------------------
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir __EXPORT ColumnEdit::~ColumnEdit()
109*cdf0e10cSrcweir {
110*cdf0e10cSrcweir }
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir //------------------------------------------------------------------------
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir long __EXPORT ColumnEdit::Notify( NotifyEvent& rNEvt )
115*cdf0e10cSrcweir {
116*cdf0e10cSrcweir 	long nHandled = SpinField::Notify( rNEvt );
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir 	sal_uInt16 nType = rNEvt.GetType();
119*cdf0e10cSrcweir 	if ( nType == EVENT_KEYINPUT )
120*cdf0e10cSrcweir 	{
121*cdf0e10cSrcweir 		const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
122*cdf0e10cSrcweir 		KeyCode aCode = pKEvt->GetKeyCode();
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir 		if ( !aCode.IsMod1() && !aCode.IsMod2() )
125*cdf0e10cSrcweir 		{
126*cdf0e10cSrcweir 			//!	Eingabeueberpruefung (nur Zahlen oder nur Buchstaben, max 2 bzw 3 Stellen)
127*cdf0e10cSrcweir 			//!	war vor VCL per nicht weitergeleitetem KeyInput
128*cdf0e10cSrcweir 			//!	dafuer was neues ausdenken!!!
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir 			if ( aCode.GetCode() == KEY_RETURN )
131*cdf0e10cSrcweir 			{
132*cdf0e10cSrcweir 				ScNavigatorDlg::ReleaseFocus();
133*cdf0e10cSrcweir 				ExecuteCol();
134*cdf0e10cSrcweir 				nHandled = 1;
135*cdf0e10cSrcweir 			}
136*cdf0e10cSrcweir 		}
137*cdf0e10cSrcweir 	}
138*cdf0e10cSrcweir 	else if ( nType == EVENT_LOSEFOCUS )	// LoseFocus wird bei VCL nicht gerufen
139*cdf0e10cSrcweir 		EvalText();							// nCol setzen
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir 	return nHandled;
142*cdf0e10cSrcweir }
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir //------------------------------------------------------------------------
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir void __EXPORT ColumnEdit::LoseFocus()
147*cdf0e10cSrcweir {
148*cdf0e10cSrcweir 	EvalText();
149*cdf0e10cSrcweir }
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir //------------------------------------------------------------------------
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir void __EXPORT ColumnEdit::Up()
155*cdf0e10cSrcweir {
156*cdf0e10cSrcweir     nCol++;
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir #ifdef OS2
159*cdf0e10cSrcweir     if ( nCol > SCNAV_MAXCOL )
160*cdf0e10cSrcweir 		nCol = 1;
161*cdf0e10cSrcweir #endif
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir     if ( nCol <= SCNAV_MAXCOL )
164*cdf0e10cSrcweir 		SetCol( nCol );
165*cdf0e10cSrcweir 	else
166*cdf0e10cSrcweir         nCol--;
167*cdf0e10cSrcweir }
168*cdf0e10cSrcweir 
169*cdf0e10cSrcweir //------------------------------------------------------------------------
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir void __EXPORT ColumnEdit::Down()
172*cdf0e10cSrcweir {
173*cdf0e10cSrcweir 	if ( nCol>1 )
174*cdf0e10cSrcweir 		SetCol( nCol-1 );
175*cdf0e10cSrcweir #ifdef OS2
176*cdf0e10cSrcweir 	else
177*cdf0e10cSrcweir         SetCol( SCNAV_MAXCOL );
178*cdf0e10cSrcweir #endif
179*cdf0e10cSrcweir }
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir //------------------------------------------------------------------------
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir void __EXPORT ColumnEdit::First()
184*cdf0e10cSrcweir {
185*cdf0e10cSrcweir     nCol = 1;
186*cdf0e10cSrcweir 	SetText( 'A' );
187*cdf0e10cSrcweir }
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir //------------------------------------------------------------------------
190*cdf0e10cSrcweir 
191*cdf0e10cSrcweir void __EXPORT ColumnEdit::Last()
192*cdf0e10cSrcweir {
193*cdf0e10cSrcweir     String aStr;
194*cdf0e10cSrcweir     nCol = NumToAlpha( SCNAV_MAXCOL, aStr );
195*cdf0e10cSrcweir     SetText( aStr );
196*cdf0e10cSrcweir }
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir 
199*cdf0e10cSrcweir //------------------------------------------------------------------------
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir void ColumnEdit::EvalText()
202*cdf0e10cSrcweir {
203*cdf0e10cSrcweir 	String aStrCol = GetText();
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir 	if ( aStrCol.Len() > 0 )
206*cdf0e10cSrcweir 	{
207*cdf0e10cSrcweir 		//	nKeyGroup wird bei VCL mangels KeyInput nicht mehr gesetzt
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir 		if ( CharClass::isAsciiNumeric(aStrCol) )
210*cdf0e10cSrcweir 			nCol = NumStrToAlpha( aStrCol );
211*cdf0e10cSrcweir 		else
212*cdf0e10cSrcweir 			nCol = AlphaToNum( aStrCol );
213*cdf0e10cSrcweir 	}
214*cdf0e10cSrcweir 	else
215*cdf0e10cSrcweir 		nCol = 0;
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir 	SetText( aStrCol );
218*cdf0e10cSrcweir 	nKeyGroup = KEYGROUP_ALPHA;
219*cdf0e10cSrcweir }
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir //------------------------------------------------------------------------
222*cdf0e10cSrcweir 
223*cdf0e10cSrcweir void ColumnEdit::ExecuteCol()
224*cdf0e10cSrcweir {
225*cdf0e10cSrcweir 	SCROW nRow = rDlg.aEdRow.GetRow();
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir 	EvalText(); // setzt nCol
228*cdf0e10cSrcweir 
229*cdf0e10cSrcweir 	if ( (nCol > 0) && (nRow > 0) )
230*cdf0e10cSrcweir 		rDlg.SetCurrentCell( nCol-1, nRow-1 );
231*cdf0e10cSrcweir }
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir //------------------------------------------------------------------------
234*cdf0e10cSrcweir 
235*cdf0e10cSrcweir void ColumnEdit::SetCol( SCCOL nColNo )
236*cdf0e10cSrcweir {
237*cdf0e10cSrcweir 	String aStr;
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir 	if ( nColNo == 0 )
240*cdf0e10cSrcweir 	{
241*cdf0e10cSrcweir 		nCol = 0;
242*cdf0e10cSrcweir 		SetText( aStr );
243*cdf0e10cSrcweir 	}
244*cdf0e10cSrcweir 	else
245*cdf0e10cSrcweir 	{
246*cdf0e10cSrcweir 		nColNo = NumToAlpha( nColNo, aStr );
247*cdf0e10cSrcweir 		nCol = nColNo;
248*cdf0e10cSrcweir 		SetText( aStr );
249*cdf0e10cSrcweir 	}
250*cdf0e10cSrcweir }
251*cdf0e10cSrcweir 
252*cdf0e10cSrcweir //------------------------------------------------------------------------
253*cdf0e10cSrcweir 
254*cdf0e10cSrcweir SCCOL ColumnEdit::AlphaToNum( String& rStr )
255*cdf0e10cSrcweir {
256*cdf0e10cSrcweir 	SCCOL  nColumn = 0;
257*cdf0e10cSrcweir 
258*cdf0e10cSrcweir 	if ( CharClass::isAsciiAlpha( rStr) )
259*cdf0e10cSrcweir 	{
260*cdf0e10cSrcweir 		rStr.ToUpperAscii();
261*cdf0e10cSrcweir 
262*cdf0e10cSrcweir         if (::AlphaToCol( nColumn, rStr))
263*cdf0e10cSrcweir             ++nColumn;
264*cdf0e10cSrcweir 
265*cdf0e10cSrcweir         if ( (rStr.Len() > SCNAV_COLLETTERS) || (nColumn > SCNAV_MAXCOL) )
266*cdf0e10cSrcweir         {
267*cdf0e10cSrcweir             nColumn = SCNAV_MAXCOL;
268*cdf0e10cSrcweir             NumToAlpha( nColumn, rStr );
269*cdf0e10cSrcweir         }
270*cdf0e10cSrcweir 	}
271*cdf0e10cSrcweir     else
272*cdf0e10cSrcweir         rStr.Erase();
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir 	return nColumn;
275*cdf0e10cSrcweir }
276*cdf0e10cSrcweir 
277*cdf0e10cSrcweir //------------------------------------------------------------------------
278*cdf0e10cSrcweir 
279*cdf0e10cSrcweir SCCOL ColumnEdit::NumStrToAlpha( String& rStr )
280*cdf0e10cSrcweir {
281*cdf0e10cSrcweir 	SCCOL  nColumn = 0;
282*cdf0e10cSrcweir 
283*cdf0e10cSrcweir 	if ( CharClass::isAsciiNumeric(rStr) )
284*cdf0e10cSrcweir 		nColumn = NumToAlpha( (SCCOL)rStr.ToInt32(), rStr );
285*cdf0e10cSrcweir 	else
286*cdf0e10cSrcweir 		rStr.Erase();
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir 	return nColumn;
289*cdf0e10cSrcweir }
290*cdf0e10cSrcweir 
291*cdf0e10cSrcweir //------------------------------------------------------------------------
292*cdf0e10cSrcweir 
293*cdf0e10cSrcweir SCCOL ColumnEdit::NumToAlpha( SCCOL nColNo, String& rStr )
294*cdf0e10cSrcweir {
295*cdf0e10cSrcweir     if ( nColNo > SCNAV_MAXCOL )
296*cdf0e10cSrcweir         nColNo = SCNAV_MAXCOL;
297*cdf0e10cSrcweir     else if ( nColNo < 1 )
298*cdf0e10cSrcweir 		nColNo = 1;
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir     ::ScColToAlpha( rStr, nColNo - 1);
301*cdf0e10cSrcweir 
302*cdf0e10cSrcweir     return nColNo;
303*cdf0e10cSrcweir }
304*cdf0e10cSrcweir 
305*cdf0e10cSrcweir //==================================================================
306*cdf0e10cSrcweir //	class RowEdit
307*cdf0e10cSrcweir //==================================================================
308*cdf0e10cSrcweir 
309*cdf0e10cSrcweir RowEdit::RowEdit( ScNavigatorDlg* pParent, const ResId& rResId )
310*cdf0e10cSrcweir 	:	NumericField( pParent, rResId ),
311*cdf0e10cSrcweir 		rDlg		( *pParent )
312*cdf0e10cSrcweir {
313*cdf0e10cSrcweir     SetMax( SCNAV_MAXROW);
314*cdf0e10cSrcweir     SetLast( SCNAV_MAXROW);
315*cdf0e10cSrcweir }
316*cdf0e10cSrcweir 
317*cdf0e10cSrcweir //------------------------------------------------------------------------
318*cdf0e10cSrcweir 
319*cdf0e10cSrcweir __EXPORT RowEdit::~RowEdit()
320*cdf0e10cSrcweir {
321*cdf0e10cSrcweir }
322*cdf0e10cSrcweir 
323*cdf0e10cSrcweir //------------------------------------------------------------------------
324*cdf0e10cSrcweir 
325*cdf0e10cSrcweir long __EXPORT RowEdit::Notify( NotifyEvent& rNEvt )
326*cdf0e10cSrcweir {
327*cdf0e10cSrcweir 	long nHandled = NumericField::Notify( rNEvt );
328*cdf0e10cSrcweir 
329*cdf0e10cSrcweir 	if ( rNEvt.GetType() == EVENT_KEYINPUT )
330*cdf0e10cSrcweir 	{
331*cdf0e10cSrcweir 		const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
332*cdf0e10cSrcweir 		KeyCode aCode = pKEvt->GetKeyCode();
333*cdf0e10cSrcweir 		if ( aCode.GetCode() == KEY_RETURN && !aCode.IsMod1() && !aCode.IsMod2() )
334*cdf0e10cSrcweir 		{
335*cdf0e10cSrcweir 			ScNavigatorDlg::ReleaseFocus();
336*cdf0e10cSrcweir 			ExecuteRow();
337*cdf0e10cSrcweir 			nHandled = 1;
338*cdf0e10cSrcweir 		}
339*cdf0e10cSrcweir 	}
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir 	return nHandled;
342*cdf0e10cSrcweir }
343*cdf0e10cSrcweir 
344*cdf0e10cSrcweir //------------------------------------------------------------------------
345*cdf0e10cSrcweir 
346*cdf0e10cSrcweir void __EXPORT RowEdit::LoseFocus()
347*cdf0e10cSrcweir {
348*cdf0e10cSrcweir }
349*cdf0e10cSrcweir 
350*cdf0e10cSrcweir //------------------------------------------------------------------------
351*cdf0e10cSrcweir 
352*cdf0e10cSrcweir void RowEdit::ExecuteRow()
353*cdf0e10cSrcweir {
354*cdf0e10cSrcweir 	SCCOL nCol = rDlg.aEdCol.GetCol();
355*cdf0e10cSrcweir 	SCROW nRow = (SCROW)GetValue();
356*cdf0e10cSrcweir 
357*cdf0e10cSrcweir 	if ( (nCol > 0) && (nRow > 0) )
358*cdf0e10cSrcweir 		rDlg.SetCurrentCell( nCol-1, nRow-1 );
359*cdf0e10cSrcweir }
360*cdf0e10cSrcweir 
361*cdf0e10cSrcweir //==================================================================
362*cdf0e10cSrcweir //	class ScDocListBox
363*cdf0e10cSrcweir //==================================================================
364*cdf0e10cSrcweir 
365*cdf0e10cSrcweir ScDocListBox::ScDocListBox( ScNavigatorDlg* pParent, const ResId& rResId )
366*cdf0e10cSrcweir 	:	ListBox	( pParent, rResId ),
367*cdf0e10cSrcweir 		rDlg	( *pParent )
368*cdf0e10cSrcweir {
369*cdf0e10cSrcweir }
370*cdf0e10cSrcweir 
371*cdf0e10cSrcweir //------------------------------------------------------------------------
372*cdf0e10cSrcweir 
373*cdf0e10cSrcweir __EXPORT ScDocListBox::~ScDocListBox()
374*cdf0e10cSrcweir {
375*cdf0e10cSrcweir }
376*cdf0e10cSrcweir 
377*cdf0e10cSrcweir //------------------------------------------------------------------------
378*cdf0e10cSrcweir 
379*cdf0e10cSrcweir void __EXPORT ScDocListBox::Select()
380*cdf0e10cSrcweir {
381*cdf0e10cSrcweir 	ScNavigatorDlg::ReleaseFocus();
382*cdf0e10cSrcweir 
383*cdf0e10cSrcweir 	String aDocName = GetSelectEntry();
384*cdf0e10cSrcweir 	rDlg.aLbEntries.SelectDoc( aDocName );
385*cdf0e10cSrcweir }
386*cdf0e10cSrcweir 
387*cdf0e10cSrcweir //==================================================================
388*cdf0e10cSrcweir //	class CommandToolBox
389*cdf0e10cSrcweir //==================================================================
390*cdf0e10cSrcweir 
391*cdf0e10cSrcweir CommandToolBox::CommandToolBox( ScNavigatorDlg* pParent, const ResId& rResId )
392*cdf0e10cSrcweir 	:	ToolBox	( pParent, rResId ),
393*cdf0e10cSrcweir 		rDlg	( *pParent )
394*cdf0e10cSrcweir {
395*cdf0e10cSrcweir 	InitImageList();	// ImageList members of ScNavigatorDlg must be initialized before!
396*cdf0e10cSrcweir 
397*cdf0e10cSrcweir 	SetSizePixel( CalcWindowSizePixel() );
398*cdf0e10cSrcweir     SetDropdownClickHdl( LINK(this, CommandToolBox, ToolBoxDropdownClickHdl) );
399*cdf0e10cSrcweir     SetItemBits( IID_DROPMODE, GetItemBits( IID_DROPMODE ) | TIB_DROPDOWNONLY );
400*cdf0e10cSrcweir //	EnableItem( IID_UP, sal_False );
401*cdf0e10cSrcweir //	EnableItem( IID_DOWN, sal_False );
402*cdf0e10cSrcweir }
403*cdf0e10cSrcweir 
404*cdf0e10cSrcweir //------------------------------------------------------------------------
405*cdf0e10cSrcweir 
406*cdf0e10cSrcweir __EXPORT CommandToolBox::~CommandToolBox()
407*cdf0e10cSrcweir {
408*cdf0e10cSrcweir }
409*cdf0e10cSrcweir 
410*cdf0e10cSrcweir //------------------------------------------------------------------------
411*cdf0e10cSrcweir 
412*cdf0e10cSrcweir void CommandToolBox::Select( sal_uInt16 nSelId )
413*cdf0e10cSrcweir {
414*cdf0e10cSrcweir 	//	Modus umschalten ?
415*cdf0e10cSrcweir 
416*cdf0e10cSrcweir 	if ( nSelId == IID_ZOOMOUT || nSelId == IID_SCENARIOS )
417*cdf0e10cSrcweir 	{
418*cdf0e10cSrcweir 		NavListMode eOldMode = rDlg.eListMode;
419*cdf0e10cSrcweir 		NavListMode eNewMode = eOldMode;
420*cdf0e10cSrcweir 
421*cdf0e10cSrcweir 		if ( nSelId == IID_SCENARIOS )					// auf Szenario
422*cdf0e10cSrcweir 		{
423*cdf0e10cSrcweir 			if ( eOldMode == NAV_LMODE_SCENARIOS )
424*cdf0e10cSrcweir 				eNewMode = NAV_LMODE_AREAS;
425*cdf0e10cSrcweir 			else
426*cdf0e10cSrcweir 				eNewMode = NAV_LMODE_SCENARIOS;
427*cdf0e10cSrcweir 		}
428*cdf0e10cSrcweir 		else											// ein/aus
429*cdf0e10cSrcweir 		{
430*cdf0e10cSrcweir 			if ( eOldMode == NAV_LMODE_NONE )
431*cdf0e10cSrcweir 				eNewMode = NAV_LMODE_AREAS;
432*cdf0e10cSrcweir 			else
433*cdf0e10cSrcweir 				eNewMode = NAV_LMODE_NONE;
434*cdf0e10cSrcweir 		}
435*cdf0e10cSrcweir 		rDlg.SetListMode( eNewMode );
436*cdf0e10cSrcweir 		UpdateButtons();
437*cdf0e10cSrcweir 	}
438*cdf0e10cSrcweir 	else
439*cdf0e10cSrcweir 		switch ( nSelId )
440*cdf0e10cSrcweir 		{
441*cdf0e10cSrcweir 			case IID_DATA:
442*cdf0e10cSrcweir 				rDlg.MarkDataArea();
443*cdf0e10cSrcweir 				break;
444*cdf0e10cSrcweir 			case IID_UP:
445*cdf0e10cSrcweir 				rDlg.StartOfDataArea();
446*cdf0e10cSrcweir 				break;
447*cdf0e10cSrcweir 			case IID_DOWN:
448*cdf0e10cSrcweir 				rDlg.EndOfDataArea();
449*cdf0e10cSrcweir 				break;
450*cdf0e10cSrcweir 			// IID_DROPMODE ist in Click
451*cdf0e10cSrcweir 			case IID_CHANGEROOT:
452*cdf0e10cSrcweir 				rDlg.aLbEntries.ToggleRoot();
453*cdf0e10cSrcweir 				UpdateButtons();
454*cdf0e10cSrcweir 				break;
455*cdf0e10cSrcweir 		}
456*cdf0e10cSrcweir }
457*cdf0e10cSrcweir 
458*cdf0e10cSrcweir void __EXPORT CommandToolBox::Select()
459*cdf0e10cSrcweir {
460*cdf0e10cSrcweir 	Select( GetCurItemId() );
461*cdf0e10cSrcweir }
462*cdf0e10cSrcweir 
463*cdf0e10cSrcweir //------------------------------------------------------------------------
464*cdf0e10cSrcweir 
465*cdf0e10cSrcweir void __EXPORT CommandToolBox::Click()
466*cdf0e10cSrcweir {
467*cdf0e10cSrcweir }
468*cdf0e10cSrcweir 
469*cdf0e10cSrcweir //------------------------------------------------------------------------
470*cdf0e10cSrcweir 
471*cdf0e10cSrcweir IMPL_LINK( CommandToolBox, ToolBoxDropdownClickHdl, ToolBox*, EMPTYARG )
472*cdf0e10cSrcweir {
473*cdf0e10cSrcweir 	//	Das Popupmenue fuer den Dropmodus muss im Click (Button Down)
474*cdf0e10cSrcweir 	//	statt im Select (Button Up) aufgerufen werden.
475*cdf0e10cSrcweir 
476*cdf0e10cSrcweir 	if ( GetCurItemId() == IID_DROPMODE )
477*cdf0e10cSrcweir 	{
478*cdf0e10cSrcweir 		ScPopupMenu aPop( ScResId( RID_POPUP_DROPMODE ) );
479*cdf0e10cSrcweir 		aPop.CheckItem( RID_DROPMODE_URL + rDlg.GetDropMode() );
480*cdf0e10cSrcweir 		aPop.Execute( this, GetItemRect(IID_DROPMODE), POPUPMENU_EXECUTE_DOWN );
481*cdf0e10cSrcweir 		sal_uInt16 nId = aPop.GetSelected();
482*cdf0e10cSrcweir 
483*cdf0e10cSrcweir 		EndSelection();		// vor SetDropMode (SetDropMode ruft SetItemImage)
484*cdf0e10cSrcweir 
485*cdf0e10cSrcweir 		if ( nId >= RID_DROPMODE_URL && nId <= RID_DROPMODE_COPY )
486*cdf0e10cSrcweir 			rDlg.SetDropMode( nId - RID_DROPMODE_URL );
487*cdf0e10cSrcweir 
488*cdf0e10cSrcweir 		//	#49956# den gehighlighteten Button aufheben
489*cdf0e10cSrcweir 		Point aPoint;
490*cdf0e10cSrcweir 		MouseEvent aLeave( aPoint, 0, MOUSE_LEAVEWINDOW | MOUSE_SYNTHETIC );
491*cdf0e10cSrcweir 		MouseMove( aLeave );
492*cdf0e10cSrcweir 	}
493*cdf0e10cSrcweir 
494*cdf0e10cSrcweir     return 1;
495*cdf0e10cSrcweir }
496*cdf0e10cSrcweir 
497*cdf0e10cSrcweir //------------------------------------------------------------------------
498*cdf0e10cSrcweir 
499*cdf0e10cSrcweir void CommandToolBox::UpdateButtons()
500*cdf0e10cSrcweir {
501*cdf0e10cSrcweir 	NavListMode eMode = rDlg.eListMode;
502*cdf0e10cSrcweir 	CheckItem( IID_SCENARIOS,	eMode == NAV_LMODE_SCENARIOS );
503*cdf0e10cSrcweir 	CheckItem( IID_ZOOMOUT,		eMode != NAV_LMODE_NONE );
504*cdf0e10cSrcweir 
505*cdf0e10cSrcweir 	//	Umschalten-Button:
506*cdf0e10cSrcweir 	if ( eMode == NAV_LMODE_SCENARIOS || eMode == NAV_LMODE_NONE )
507*cdf0e10cSrcweir 	{
508*cdf0e10cSrcweir 		EnableItem( IID_CHANGEROOT,	sal_False );
509*cdf0e10cSrcweir 		CheckItem( IID_CHANGEROOT, sal_False );
510*cdf0e10cSrcweir 	}
511*cdf0e10cSrcweir 	else
512*cdf0e10cSrcweir 	{
513*cdf0e10cSrcweir 		EnableItem( IID_CHANGEROOT,	sal_True );
514*cdf0e10cSrcweir 		sal_Bool bRootSet = rDlg.aLbEntries.GetRootType() != SC_CONTENT_ROOT;
515*cdf0e10cSrcweir 		CheckItem( IID_CHANGEROOT, bRootSet );
516*cdf0e10cSrcweir 	}
517*cdf0e10cSrcweir 
518*cdf0e10cSrcweir 	sal_Bool bHC = GetSettings().GetStyleSettings().GetHighContrastMode();
519*cdf0e10cSrcweir 
520*cdf0e10cSrcweir 	sal_uInt16 nImageId = 0;
521*cdf0e10cSrcweir 	switch ( rDlg.nDropMode )
522*cdf0e10cSrcweir 	{
523*cdf0e10cSrcweir 		case SC_DROPMODE_URL:	nImageId = bHC ? RID_IMG_H_DROP_URL  : RID_IMG_DROP_URL;  break;
524*cdf0e10cSrcweir 		case SC_DROPMODE_LINK:	nImageId = bHC ? RID_IMG_H_DROP_LINK : RID_IMG_DROP_LINK; break;
525*cdf0e10cSrcweir 		case SC_DROPMODE_COPY:	nImageId = bHC ? RID_IMG_H_DROP_COPY : RID_IMG_DROP_COPY; break;
526*cdf0e10cSrcweir 	}
527*cdf0e10cSrcweir 	SetItemImage( IID_DROPMODE, Image(ScResId(nImageId)) );
528*cdf0e10cSrcweir }
529*cdf0e10cSrcweir 
530*cdf0e10cSrcweir void CommandToolBox::InitImageList()
531*cdf0e10cSrcweir {
532*cdf0e10cSrcweir 	sal_Bool bHC = GetSettings().GetStyleSettings().GetHighContrastMode();
533*cdf0e10cSrcweir 
534*cdf0e10cSrcweir     ImageList& rImgLst = bHC ? rDlg.aCmdImageListH : rDlg.aCmdImageList;
535*cdf0e10cSrcweir 
536*cdf0e10cSrcweir 	sal_uInt16 nCount = GetItemCount();
537*cdf0e10cSrcweir     for (sal_uInt16 i = 0; i < nCount; i++)
538*cdf0e10cSrcweir     {
539*cdf0e10cSrcweir     	sal_uInt16 nId = GetItemId(i);
540*cdf0e10cSrcweir 		SetItemImage( nId, rImgLst.GetImage( nId ) );
541*cdf0e10cSrcweir     }
542*cdf0e10cSrcweir }
543*cdf0e10cSrcweir 
544*cdf0e10cSrcweir void CommandToolBox::DataChanged( const DataChangedEvent& rDCEvt )
545*cdf0e10cSrcweir {
546*cdf0e10cSrcweir 	if ( rDCEvt.GetType() == DATACHANGED_SETTINGS && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
547*cdf0e10cSrcweir 	{
548*cdf0e10cSrcweir 		//	update item images
549*cdf0e10cSrcweir 
550*cdf0e10cSrcweir 		InitImageList();
551*cdf0e10cSrcweir 		UpdateButtons();	// drop mode
552*cdf0e10cSrcweir 	}
553*cdf0e10cSrcweir 
554*cdf0e10cSrcweir     ToolBox::DataChanged( rDCEvt );
555*cdf0e10cSrcweir }
556*cdf0e10cSrcweir 
557*cdf0e10cSrcweir //==================================================================
558*cdf0e10cSrcweir //  class ScNavigatorSettings
559*cdf0e10cSrcweir //==================================================================
560*cdf0e10cSrcweir 
561*cdf0e10cSrcweir ScNavigatorSettings::ScNavigatorSettings() :
562*cdf0e10cSrcweir     maExpandedVec( SC_CONTENT_COUNT, sal_False ),
563*cdf0e10cSrcweir     mnRootSelected( SC_CONTENT_ROOT ),
564*cdf0e10cSrcweir     mnChildSelected( SC_CONTENT_NOCHILD )
565*cdf0e10cSrcweir {
566*cdf0e10cSrcweir }
567*cdf0e10cSrcweir 
568*cdf0e10cSrcweir //==================================================================
569*cdf0e10cSrcweir //	class ScNavigatorDlgWrapper
570*cdf0e10cSrcweir //==================================================================
571*cdf0e10cSrcweir 
572*cdf0e10cSrcweir SFX_IMPL_CHILDWINDOWCONTEXT( ScNavigatorDialogWrapper, SID_NAVIGATOR )
573*cdf0e10cSrcweir 
574*cdf0e10cSrcweir #define IS_MODE(bit)(((nFlags)&(bit))==(bit))
575*cdf0e10cSrcweir 
576*cdf0e10cSrcweir ScNavigatorDialogWrapper::ScNavigatorDialogWrapper(
577*cdf0e10cSrcweir 									Window*			 pParent,
578*cdf0e10cSrcweir 									sal_uInt16			 nId,
579*cdf0e10cSrcweir 									SfxBindings*	 pBind,
580*cdf0e10cSrcweir                                     SfxChildWinInfo* /* pInfo */ ) :
581*cdf0e10cSrcweir 		SfxChildWindowContext( nId )
582*cdf0e10cSrcweir {
583*cdf0e10cSrcweir 	pNavigator = new ScNavigatorDlg( pBind, this, pParent );
584*cdf0e10cSrcweir 	SetWindow( pNavigator );
585*cdf0e10cSrcweir 
586*cdf0e10cSrcweir 	//	Einstellungen muessen anderswo gemerkt werden,
587*cdf0e10cSrcweir 	//	pInfo geht uns (ausser der Groesse) nichts mehr an
588*cdf0e10cSrcweir 
589*cdf0e10cSrcweir 	Size aInfoSize = pParent->GetOutputSizePixel();		// von aussen vorgegebene Groesse
590*cdf0e10cSrcweir 	Size aNavSize = pNavigator->GetOutputSizePixel();	// Default-Groesse
591*cdf0e10cSrcweir 
592*cdf0e10cSrcweir 	aNavSize.Width()  = Max( aInfoSize.Width(),  aNavSize.Width() );
593*cdf0e10cSrcweir 	aNavSize.Height() = Max( aInfoSize.Height(), aNavSize.Height() );
594*cdf0e10cSrcweir 	pNavigator->nListModeHeight = Max( aNavSize.Height(), pNavigator->nListModeHeight );
595*cdf0e10cSrcweir 
596*cdf0e10cSrcweir 	//	Die Groesse kann in einem anderen Modul geaendert worden sein,
597*cdf0e10cSrcweir 	//	deshalb muessen in Abhaengigkeit von der momentanen Groesse die
598*cdf0e10cSrcweir 	//	Inhalte eingeblendet werden oder nicht
599*cdf0e10cSrcweir 
600*cdf0e10cSrcweir 	sal_Bool bSmall = ( aInfoSize.Height() <= pNavigator->aInitSize.Height() + SCNAV_MINTOL );
601*cdf0e10cSrcweir 	NavListMode eNavMode = NAV_LMODE_NONE;
602*cdf0e10cSrcweir 	if (!bSmall)
603*cdf0e10cSrcweir 	{
604*cdf0e10cSrcweir 		//	wenn Szenario aktiv war, wieder einschalten
605*cdf0e10cSrcweir 
606*cdf0e10cSrcweir 		ScNavipiCfg& rCfg = SC_MOD()->GetNavipiCfg();
607*cdf0e10cSrcweir 		NavListMode eLastMode = (NavListMode) rCfg.GetListMode();
608*cdf0e10cSrcweir 		if ( eLastMode == NAV_LMODE_SCENARIOS )
609*cdf0e10cSrcweir 			eNavMode = NAV_LMODE_SCENARIOS;
610*cdf0e10cSrcweir 		else
611*cdf0e10cSrcweir 			eNavMode = NAV_LMODE_AREAS;
612*cdf0e10cSrcweir 	}
613*cdf0e10cSrcweir 
614*cdf0e10cSrcweir 	//	Die Groesse des Floats nicht neu setzen (sal_False bei SetListMode), damit der
615*cdf0e10cSrcweir 	//	Navigator nicht aufgeklappt wird, wenn er minimiert war (#38872#).
616*cdf0e10cSrcweir 
617*cdf0e10cSrcweir 	pNavigator->SetListMode( eNavMode, sal_False );		// FALSE: Groesse des Float nicht setzen
618*cdf0e10cSrcweir 
619*cdf0e10cSrcweir 	sal_uInt16 nCmdId;
620*cdf0e10cSrcweir 	switch (eNavMode)
621*cdf0e10cSrcweir 	{
622*cdf0e10cSrcweir 		case NAV_LMODE_DOCS:		nCmdId = IID_DOCS; 		break;
623*cdf0e10cSrcweir 		case NAV_LMODE_AREAS:		nCmdId = IID_AREAS; 	break;
624*cdf0e10cSrcweir 		case NAV_LMODE_DBAREAS:		nCmdId = IID_DBAREAS; 	break;
625*cdf0e10cSrcweir 		case NAV_LMODE_SCENARIOS:	nCmdId = IID_SCENARIOS; break;
626*cdf0e10cSrcweir         default:                    nCmdId = 0;
627*cdf0e10cSrcweir 	}
628*cdf0e10cSrcweir 	if (nCmdId)
629*cdf0e10cSrcweir 	{
630*cdf0e10cSrcweir 		pNavigator->aTbxCmd.CheckItem( nCmdId );
631*cdf0e10cSrcweir 		pNavigator->DoResize();
632*cdf0e10cSrcweir 	}
633*cdf0e10cSrcweir 
634*cdf0e10cSrcweir 	pNavigator->bFirstBig = ( nCmdId == 0 );	// dann spaeter
635*cdf0e10cSrcweir 
636*cdf0e10cSrcweir /*???
637*cdf0e10cSrcweir 	FloatingWindow* pFloat = GetFloatingWindow();
638*cdf0e10cSrcweir 	if ( pFloat )
639*cdf0e10cSrcweir 		pFloat->SetMinOutputSizePixel( pNavigator->GetMinOutputSizePixel() );
640*cdf0e10cSrcweir */
641*cdf0e10cSrcweir 
642*cdf0e10cSrcweir //!?	pNavigator->Show();
643*cdf0e10cSrcweir }
644*cdf0e10cSrcweir 
645*cdf0e10cSrcweir void __EXPORT ScNavigatorDialogWrapper::Resizing( Size& rSize )
646*cdf0e10cSrcweir {
647*cdf0e10cSrcweir 	((ScNavigatorDlg*)GetWindow())->Resizing(rSize);
648*cdf0e10cSrcweir }
649*cdf0e10cSrcweir 
650*cdf0e10cSrcweir //========================================================================
651*cdf0e10cSrcweir // class ScNavigatorPI
652*cdf0e10cSrcweir //========================================================================
653*cdf0e10cSrcweir 
654*cdf0e10cSrcweir #define CTRL_ITEMS 4
655*cdf0e10cSrcweir 
656*cdf0e10cSrcweir #define REGISTER_SLOT(i,id) \
657*cdf0e10cSrcweir 	ppBoundItems[i]=new ScNavigatorControllerItem(id,*this,rBindings);
658*cdf0e10cSrcweir 
659*cdf0e10cSrcweir ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, Window* pParent ) :
660*cdf0e10cSrcweir 		Window( pParent, ScResId(RID_SCDLG_NAVIGATOR) ),
661*cdf0e10cSrcweir 		rBindings	( *pB ),								// is used in CommandToolBox ctor
662*cdf0e10cSrcweir 		aCmdImageList( ScResId( IL_CMD ) ),
663*cdf0e10cSrcweir     	aCmdImageListH( ScResId( ILH_CMD ) ),
664*cdf0e10cSrcweir 		aFtCol		( this, ScResId( FT_COL ) ),
665*cdf0e10cSrcweir 		aEdCol		( this, ScResId( ED_COL ) ),
666*cdf0e10cSrcweir 		aFtRow		( this, ScResId( FT_ROW ) ),
667*cdf0e10cSrcweir 		aEdRow		( this, ScResId( ED_ROW ) ),
668*cdf0e10cSrcweir 		aTbxCmd		( this, ScResId( TBX_CMD ) ),
669*cdf0e10cSrcweir 		aLbEntries	( this, ScResId( LB_ENTRIES ) ),
670*cdf0e10cSrcweir         aWndScenarios( this,ScResId( STR_QHLP_SCEN_LISTBOX), ScResId(STR_QHLP_SCEN_COMMENT)),
671*cdf0e10cSrcweir 		aLbDocuments( this, ScResId( LB_DOCUMENTS ) ),
672*cdf0e10cSrcweir 		aStrDragMode ( ScResId( STR_DRAGMODE ) ),
673*cdf0e10cSrcweir 		aStrDisplay  ( ScResId( STR_DISPLAY ) ),
674*cdf0e10cSrcweir 		aStrActiveWin( ScResId( STR_ACTIVEWIN ) ),
675*cdf0e10cSrcweir 		pContextWin	( pCW ),
676*cdf0e10cSrcweir 		pMarkArea	( NULL ),
677*cdf0e10cSrcweir 		pViewData	( NULL ),
678*cdf0e10cSrcweir 		nListModeHeight( 0 ),
679*cdf0e10cSrcweir 		nInitListHeight( 0 ),
680*cdf0e10cSrcweir 		eListMode	( NAV_LMODE_NONE ),
681*cdf0e10cSrcweir 		nDropMode	( SC_DROPMODE_URL ),
682*cdf0e10cSrcweir 		nCurCol		( 0 ),
683*cdf0e10cSrcweir 		nCurRow		( 0 ),
684*cdf0e10cSrcweir 		nCurTab		( 0 ),
685*cdf0e10cSrcweir 		bFirstBig	( sal_False )
686*cdf0e10cSrcweir {
687*cdf0e10cSrcweir 	ScNavipiCfg& rCfg = SC_MOD()->GetNavipiCfg();
688*cdf0e10cSrcweir 	nDropMode = rCfg.GetDragMode();
689*cdf0e10cSrcweir 	//	eListMode wird von aussen gesetzt, Root weiter unten
690*cdf0e10cSrcweir 
691*cdf0e10cSrcweir 	aLbDocuments.SetDropDownLineCount(9);
692*cdf0e10cSrcweir 	String aOpen = String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM( " (" ));
693*cdf0e10cSrcweir 	aStrActive = aOpen;
694*cdf0e10cSrcweir 	aStrActive += String( ScResId( STR_ACTIVE ) );
695*cdf0e10cSrcweir 	aStrActive += ')';										// " (aktiv)"
696*cdf0e10cSrcweir 	aStrNotActive = aOpen;
697*cdf0e10cSrcweir 	aStrNotActive += String( ScResId( STR_NOTACTIVE ) );
698*cdf0e10cSrcweir 	aStrNotActive += ')';									// " (inaktiv)"
699*cdf0e10cSrcweir 	aStrHidden = aOpen;
700*cdf0e10cSrcweir 	aStrHidden += String( ScResId( STR_HIDDEN ) );
701*cdf0e10cSrcweir 	aStrHidden += ')';										// " (versteckt)"
702*cdf0e10cSrcweir 
703*cdf0e10cSrcweir 	aTitleBase = GetText();
704*cdf0e10cSrcweir 
705*cdf0e10cSrcweir     long nListboxYPos = aTbxCmd.GetPosPixel().Y() + aTbxCmd.GetSizePixel().Height() + 4;
706*cdf0e10cSrcweir     aLbEntries.SetPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y);
707*cdf0e10cSrcweir 
708*cdf0e10cSrcweir 	nBorderOffset = aLbEntries.GetPosPixel().X();
709*cdf0e10cSrcweir 
710*cdf0e10cSrcweir 	aInitSize.Width()  =  aTbxCmd.GetPosPixel().X()
711*cdf0e10cSrcweir 						+ aTbxCmd.GetSizePixel().Width()
712*cdf0e10cSrcweir 						+ nBorderOffset;
713*cdf0e10cSrcweir 	aInitSize.Height() = aLbEntries.GetPosPixel().Y();
714*cdf0e10cSrcweir 
715*cdf0e10cSrcweir 	nInitListHeight	= aLbEntries.GetSizePixel().Height();
716*cdf0e10cSrcweir 	nListModeHeight	=  aInitSize.Height()
717*cdf0e10cSrcweir 					 + nInitListHeight;
718*cdf0e10cSrcweir 
719*cdf0e10cSrcweir 	//	kein Resize, eh der ganze Kontext-Kram initialisiert ist!
720*cdf0e10cSrcweir //	SetOutputSizePixel( aInitSize );		//???
721*cdf0e10cSrcweir /*!	FloatingWindow* pFloat = pContextWin->GetFloatingWindow();
722*cdf0e10cSrcweir 	if ( pFloat)
723*cdf0e10cSrcweir 		pFloat->SetMinOutputSizePixel( aInitSize );
724*cdf0e10cSrcweir */
725*cdf0e10cSrcweir 	ppBoundItems = new ScNavigatorControllerItem* [CTRL_ITEMS];
726*cdf0e10cSrcweir 
727*cdf0e10cSrcweir 	rBindings.ENTERREGISTRATIONS();
728*cdf0e10cSrcweir 	//-----------------------------
729*cdf0e10cSrcweir 	REGISTER_SLOT( 0, SID_CURRENTCELL		);
730*cdf0e10cSrcweir 	REGISTER_SLOT( 1, SID_CURRENTTAB		);
731*cdf0e10cSrcweir 	REGISTER_SLOT( 2, SID_CURRENTDOC		);
732*cdf0e10cSrcweir 	REGISTER_SLOT( 3, SID_SELECT_SCENARIO	);
733*cdf0e10cSrcweir 	//-----------------------------
734*cdf0e10cSrcweir 	rBindings.LEAVEREGISTRATIONS();
735*cdf0e10cSrcweir 
736*cdf0e10cSrcweir 	StartListening( *(SFX_APP()) );
737*cdf0e10cSrcweir 	StartListening( rBindings );
738*cdf0e10cSrcweir 
739*cdf0e10cSrcweir 	aLbDocuments.Hide();		// bei NAV_LMODE_NONE gibts die nicht
740*cdf0e10cSrcweir 
741*cdf0e10cSrcweir 	aLbEntries.InitWindowBits(sal_True);
742*cdf0e10cSrcweir 
743*cdf0e10cSrcweir 	aLbEntries.SetSpaceBetweenEntries(0);
744*cdf0e10cSrcweir 	aLbEntries.SetSelectionMode( SINGLE_SELECTION );
745*cdf0e10cSrcweir 	aLbEntries.SetDragDropMode( 	SV_DRAGDROP_CTRL_MOVE |
746*cdf0e10cSrcweir 									SV_DRAGDROP_CTRL_COPY |
747*cdf0e10cSrcweir 									SV_DRAGDROP_ENABLE_TOP );
748*cdf0e10cSrcweir 
749*cdf0e10cSrcweir 	//	war eine Kategorie als Root ausgewaehlt?
750*cdf0e10cSrcweir 	sal_uInt16 nLastRoot = rCfg.GetRootType();
751*cdf0e10cSrcweir 	if ( nLastRoot )
752*cdf0e10cSrcweir 		aLbEntries.SetRootType( nLastRoot );
753*cdf0e10cSrcweir 
754*cdf0e10cSrcweir 	aLbEntries.Refresh();
755*cdf0e10cSrcweir 	GetDocNames();
756*cdf0e10cSrcweir 
757*cdf0e10cSrcweir 	aTbxCmd.UpdateButtons();
758*cdf0e10cSrcweir 
759*cdf0e10cSrcweir 	UpdateColumn();
760*cdf0e10cSrcweir 	UpdateRow();
761*cdf0e10cSrcweir 	UpdateTable();
762*cdf0e10cSrcweir 	aLbEntries.Hide();
763*cdf0e10cSrcweir 	aWndScenarios.Hide();
764*cdf0e10cSrcweir 	aWndScenarios.SetPosPixel( aLbEntries.GetPosPixel() );
765*cdf0e10cSrcweir 
766*cdf0e10cSrcweir 	aContentTimer.SetTimeoutHdl( LINK( this, ScNavigatorDlg, TimeHdl ) );
767*cdf0e10cSrcweir 	aContentTimer.SetTimeout( SC_CONTENT_TIMEOUT );
768*cdf0e10cSrcweir 
769*cdf0e10cSrcweir 	FreeResource();
770*cdf0e10cSrcweir 
771*cdf0e10cSrcweir 	aLbEntries.SetAccessibleRelationLabeledBy(&aLbEntries);
772*cdf0e10cSrcweir 	aTbxCmd.SetAccessibleRelationLabeledBy(&aTbxCmd);
773*cdf0e10cSrcweir 	aLbDocuments.SetAccessibleName(aStrActiveWin);
774*cdf0e10cSrcweir }
775*cdf0e10cSrcweir 
776*cdf0e10cSrcweir //------------------------------------------------------------------------
777*cdf0e10cSrcweir 
778*cdf0e10cSrcweir __EXPORT ScNavigatorDlg::~ScNavigatorDlg()
779*cdf0e10cSrcweir {
780*cdf0e10cSrcweir 	aContentTimer.Stop();
781*cdf0e10cSrcweir 
782*cdf0e10cSrcweir 	sal_uInt16 i;
783*cdf0e10cSrcweir 	for ( i=0; i<CTRL_ITEMS; i++ )
784*cdf0e10cSrcweir 		delete ppBoundItems[i];
785*cdf0e10cSrcweir 
786*cdf0e10cSrcweir 	delete [] ppBoundItems;
787*cdf0e10cSrcweir 	delete pMarkArea;
788*cdf0e10cSrcweir 
789*cdf0e10cSrcweir 	EndListening( *(SFX_APP()) );
790*cdf0e10cSrcweir 	EndListening( rBindings );
791*cdf0e10cSrcweir }
792*cdf0e10cSrcweir 
793*cdf0e10cSrcweir //------------------------------------------------------------------------
794*cdf0e10cSrcweir 
795*cdf0e10cSrcweir void __EXPORT ScNavigatorDlg::Resizing( Size& rNewSize )  // Size = Outputsize?
796*cdf0e10cSrcweir {
797*cdf0e10cSrcweir 	FloatingWindow* pFloat = pContextWin->GetFloatingWindow();
798*cdf0e10cSrcweir 	if ( pFloat )
799*cdf0e10cSrcweir 	{
800*cdf0e10cSrcweir 		Size aMinOut = pFloat->GetMinOutputSizePixel();
801*cdf0e10cSrcweir 
802*cdf0e10cSrcweir 		if ( rNewSize.Width() < aMinOut.Width() )
803*cdf0e10cSrcweir 			rNewSize.Width() = aMinOut.Width();
804*cdf0e10cSrcweir 
805*cdf0e10cSrcweir 		if ( eListMode == NAV_LMODE_NONE )
806*cdf0e10cSrcweir 			rNewSize.Height() = aInitSize.Height();
807*cdf0e10cSrcweir 		else
808*cdf0e10cSrcweir 		{
809*cdf0e10cSrcweir 			if ( rNewSize.Height() < aMinOut.Height() )
810*cdf0e10cSrcweir 				rNewSize.Height() = aMinOut.Height();
811*cdf0e10cSrcweir 		}
812*cdf0e10cSrcweir 	}
813*cdf0e10cSrcweir //	else
814*cdf0e10cSrcweir //		SfxDockingWindow::Resizing(rNewSize);
815*cdf0e10cSrcweir }
816*cdf0e10cSrcweir 
817*cdf0e10cSrcweir 
818*cdf0e10cSrcweir 
819*cdf0e10cSrcweir void ScNavigatorDlg::Paint( const Rectangle& rRec )
820*cdf0e10cSrcweir {
821*cdf0e10cSrcweir 	const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
822*cdf0e10cSrcweir 	Color aBgColor = rStyleSettings.GetFaceColor();
823*cdf0e10cSrcweir 	Wallpaper aBack( aBgColor );
824*cdf0e10cSrcweir 
825*cdf0e10cSrcweir 	SetBackground( aBack );
826*cdf0e10cSrcweir 	aFtCol.SetBackground( aBack );
827*cdf0e10cSrcweir 	aFtRow.SetBackground( aBack );
828*cdf0e10cSrcweir 
829*cdf0e10cSrcweir 	Window::Paint( rRec );
830*cdf0e10cSrcweir }
831*cdf0e10cSrcweir 
832*cdf0e10cSrcweir void ScNavigatorDlg::DataChanged( const DataChangedEvent& rDCEvt )
833*cdf0e10cSrcweir {
834*cdf0e10cSrcweir 	if ( rDCEvt.GetType() == DATACHANGED_SETTINGS && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
835*cdf0e10cSrcweir 	{
836*cdf0e10cSrcweir 		//	toolbox images are exchanged in CommandToolBox::DataChanged
837*cdf0e10cSrcweir 		Invalidate();
838*cdf0e10cSrcweir 	}
839*cdf0e10cSrcweir 
840*cdf0e10cSrcweir     Window::DataChanged( rDCEvt );
841*cdf0e10cSrcweir }
842*cdf0e10cSrcweir 
843*cdf0e10cSrcweir //------------------------------------------------------------------------
844*cdf0e10cSrcweir 
845*cdf0e10cSrcweir void __EXPORT ScNavigatorDlg::Resize()
846*cdf0e10cSrcweir {
847*cdf0e10cSrcweir 	DoResize();
848*cdf0e10cSrcweir }
849*cdf0e10cSrcweir 
850*cdf0e10cSrcweir //------------------------------------------------------------------------
851*cdf0e10cSrcweir 
852*cdf0e10cSrcweir void ScNavigatorDlg::DoResize()
853*cdf0e10cSrcweir {
854*cdf0e10cSrcweir 	Size aNewSize = GetOutputSizePixel();
855*cdf0e10cSrcweir 	long nTotalHeight = aNewSize.Height();
856*cdf0e10cSrcweir 
857*cdf0e10cSrcweir 	//	#41403# bei angedocktem Navigator wird das Fenster evtl. erst klein erzeugt,
858*cdf0e10cSrcweir 	//	dann kommt ein Resize auf die wirkliche Groesse -> dann Inhalte einschalten
859*cdf0e10cSrcweir 
860*cdf0e10cSrcweir 	sal_Bool bSmall = ( nTotalHeight <= aInitSize.Height() + SCNAV_MINTOL );
861*cdf0e10cSrcweir 	if ( !bSmall && bFirstBig )
862*cdf0e10cSrcweir 	{
863*cdf0e10cSrcweir 		//	Inhalte laut Config wieder einschalten
864*cdf0e10cSrcweir 
865*cdf0e10cSrcweir 		bFirstBig = sal_False;
866*cdf0e10cSrcweir 		NavListMode eNavMode = NAV_LMODE_AREAS;
867*cdf0e10cSrcweir 		ScNavipiCfg& rCfg = SC_MOD()->GetNavipiCfg();
868*cdf0e10cSrcweir 		NavListMode eLastMode = (NavListMode) rCfg.GetListMode();
869*cdf0e10cSrcweir 		if ( eLastMode == NAV_LMODE_SCENARIOS )
870*cdf0e10cSrcweir 			eNavMode = NAV_LMODE_SCENARIOS;
871*cdf0e10cSrcweir 		SetListMode( eNavMode, sal_False );			// FALSE: Groesse des Float nicht setzen
872*cdf0e10cSrcweir 	}
873*cdf0e10cSrcweir 
874*cdf0e10cSrcweir 	//	auch wenn die Inhalte nicht sichtbar sind, die Groessen anpassen,
875*cdf0e10cSrcweir 	//	damit die Breite stimmt
876*cdf0e10cSrcweir 
877*cdf0e10cSrcweir 	//@@ 03.11.97 changes begin
878*cdf0e10cSrcweir 	Point aEntryPos = aLbEntries.GetPosPixel();
879*cdf0e10cSrcweir 	Point aListPos = aLbDocuments.GetPosPixel();
880*cdf0e10cSrcweir 	aNewSize.Width() -= 2*nBorderOffset;
881*cdf0e10cSrcweir 	Size aDocSize = aLbDocuments.GetSizePixel();
882*cdf0e10cSrcweir 	aDocSize.Width() = aNewSize.Width();
883*cdf0e10cSrcweir 
884*cdf0e10cSrcweir 	if(!bSmall)
885*cdf0e10cSrcweir 	{
886*cdf0e10cSrcweir 
887*cdf0e10cSrcweir 		long nListHeight = aLbDocuments.GetSizePixel().Height();
888*cdf0e10cSrcweir 		aNewSize.Height() -= ( aEntryPos.Y() + nListHeight + 2*nBorderOffset );
889*cdf0e10cSrcweir 		if(aNewSize.Height()<0)	aNewSize.Height()=0;
890*cdf0e10cSrcweir 
891*cdf0e10cSrcweir 		aListPos.Y() = aEntryPos.Y() + aNewSize.Height() + nBorderOffset;
892*cdf0e10cSrcweir 
893*cdf0e10cSrcweir 		if(aListPos.Y() > aLbEntries.GetPosPixel().Y())
894*cdf0e10cSrcweir 							aLbDocuments.SetPosPixel( aListPos );
895*cdf0e10cSrcweir 
896*cdf0e10cSrcweir 	}
897*cdf0e10cSrcweir 	aLbEntries.SetSizePixel( aNewSize );
898*cdf0e10cSrcweir 	aWndScenarios.SetSizePixel( aNewSize );
899*cdf0e10cSrcweir 	aLbDocuments.SetSizePixel( aDocSize );
900*cdf0e10cSrcweir 
901*cdf0e10cSrcweir 	//@@ 03.11.97 end
902*cdf0e10cSrcweir 
903*cdf0e10cSrcweir 	sal_Bool bListMode = (eListMode != NAV_LMODE_NONE);
904*cdf0e10cSrcweir 	FloatingWindow* pFloat = pContextWin->GetFloatingWindow();
905*cdf0e10cSrcweir 	if ( pFloat && bListMode )
906*cdf0e10cSrcweir 		nListModeHeight = nTotalHeight;
907*cdf0e10cSrcweir }
908*cdf0e10cSrcweir 
909*cdf0e10cSrcweir //------------------------------------------------------------------------
910*cdf0e10cSrcweir 
911*cdf0e10cSrcweir void __EXPORT ScNavigatorDlg::Notify( SfxBroadcaster&, const SfxHint& rHint )
912*cdf0e10cSrcweir {
913*cdf0e10cSrcweir 	if ( rHint.ISA(SfxSimpleHint) )
914*cdf0e10cSrcweir 	{
915*cdf0e10cSrcweir 		sal_uLong nHintId = ((SfxSimpleHint&)rHint).GetId();
916*cdf0e10cSrcweir 
917*cdf0e10cSrcweir 		if ( nHintId == SC_HINT_DOCNAME_CHANGED )
918*cdf0e10cSrcweir 		{
919*cdf0e10cSrcweir 			aLbEntries.ActiveDocChanged();
920*cdf0e10cSrcweir 		}
921*cdf0e10cSrcweir 		else if ( NAV_LMODE_NONE == eListMode )
922*cdf0e10cSrcweir 		{
923*cdf0e10cSrcweir 			//	Tabellen hier nicht mehr
924*cdf0e10cSrcweir 		}
925*cdf0e10cSrcweir 		else
926*cdf0e10cSrcweir 		{
927*cdf0e10cSrcweir 			switch ( nHintId )
928*cdf0e10cSrcweir 			{
929*cdf0e10cSrcweir 				case SC_HINT_TABLES_CHANGED:
930*cdf0e10cSrcweir 					aLbEntries.Refresh( SC_CONTENT_TABLE );
931*cdf0e10cSrcweir 					break;
932*cdf0e10cSrcweir 
933*cdf0e10cSrcweir 				case SC_HINT_DBAREAS_CHANGED:
934*cdf0e10cSrcweir 					aLbEntries.Refresh( SC_CONTENT_DBAREA );
935*cdf0e10cSrcweir 					break;
936*cdf0e10cSrcweir 
937*cdf0e10cSrcweir 				case SC_HINT_AREAS_CHANGED:
938*cdf0e10cSrcweir 					aLbEntries.Refresh( SC_CONTENT_RANGENAME );
939*cdf0e10cSrcweir 					break;
940*cdf0e10cSrcweir 
941*cdf0e10cSrcweir 				case SC_HINT_DRAW_CHANGED:
942*cdf0e10cSrcweir 					aLbEntries.Refresh( SC_CONTENT_GRAPHIC );
943*cdf0e10cSrcweir 					aLbEntries.Refresh( SC_CONTENT_OLEOBJECT );
944*cdf0e10cSrcweir 					aLbEntries.Refresh( SC_CONTENT_DRAWING );
945*cdf0e10cSrcweir 					break;
946*cdf0e10cSrcweir 
947*cdf0e10cSrcweir 				case SC_HINT_AREALINKS_CHANGED:
948*cdf0e10cSrcweir 					aLbEntries.Refresh( SC_CONTENT_AREALINK );
949*cdf0e10cSrcweir 					break;
950*cdf0e10cSrcweir 
951*cdf0e10cSrcweir 				//	SFX_HINT_DOCCHANGED kommt nicht nur bei Dokument-Wechsel
952*cdf0e10cSrcweir 
953*cdf0e10cSrcweir 				case SC_HINT_NAVIGATOR_UPDATEALL:
954*cdf0e10cSrcweir 					UpdateAll();
955*cdf0e10cSrcweir 					break;
956*cdf0e10cSrcweir 
957*cdf0e10cSrcweir 				case FID_DATACHANGED:
958*cdf0e10cSrcweir 				case FID_ANYDATACHANGED:
959*cdf0e10cSrcweir 					aContentTimer.Start();		// Notizen nicht sofort suchen
960*cdf0e10cSrcweir 					break;
961*cdf0e10cSrcweir 
962*cdf0e10cSrcweir 				default:
963*cdf0e10cSrcweir 					break;
964*cdf0e10cSrcweir 			}
965*cdf0e10cSrcweir 		}
966*cdf0e10cSrcweir 	}
967*cdf0e10cSrcweir 	else if ( rHint.ISA(SfxEventHint) )
968*cdf0e10cSrcweir 	{
969*cdf0e10cSrcweir 		sal_uLong nEventId = ((SfxEventHint&)rHint).GetEventId();
970*cdf0e10cSrcweir 		if ( nEventId == SFX_EVENT_ACTIVATEDOC )
971*cdf0e10cSrcweir 		{
972*cdf0e10cSrcweir 			aLbEntries.ActiveDocChanged();
973*cdf0e10cSrcweir 			UpdateAll();
974*cdf0e10cSrcweir 		}
975*cdf0e10cSrcweir 	}
976*cdf0e10cSrcweir }
977*cdf0e10cSrcweir 
978*cdf0e10cSrcweir //------------------------------------------------------------------------
979*cdf0e10cSrcweir 
980*cdf0e10cSrcweir IMPL_LINK( ScNavigatorDlg, TimeHdl, Timer*, pTimer )
981*cdf0e10cSrcweir {
982*cdf0e10cSrcweir 	if ( pTimer != &aContentTimer )
983*cdf0e10cSrcweir 		return 0;
984*cdf0e10cSrcweir 
985*cdf0e10cSrcweir 	aLbEntries.Refresh( SC_CONTENT_NOTE );
986*cdf0e10cSrcweir 	return 0;
987*cdf0e10cSrcweir }
988*cdf0e10cSrcweir 
989*cdf0e10cSrcweir //------------------------------------------------------------------------
990*cdf0e10cSrcweir 
991*cdf0e10cSrcweir void ScNavigatorDlg::SetDropMode(sal_uInt16 nNew)
992*cdf0e10cSrcweir {
993*cdf0e10cSrcweir 	nDropMode = nNew;
994*cdf0e10cSrcweir 	aTbxCmd.UpdateButtons();
995*cdf0e10cSrcweir 
996*cdf0e10cSrcweir 	ScNavipiCfg& rCfg = SC_MOD()->GetNavipiCfg();
997*cdf0e10cSrcweir 	rCfg.SetDragMode(nDropMode);
998*cdf0e10cSrcweir }
999*cdf0e10cSrcweir 
1000*cdf0e10cSrcweir //------------------------------------------------------------------------
1001*cdf0e10cSrcweir 
1002*cdf0e10cSrcweir void ScNavigatorDlg::CursorPosChanged()
1003*cdf0e10cSrcweir {
1004*cdf0e10cSrcweir 	//!	Eintraege selektieren ???
1005*cdf0e10cSrcweir 
1006*cdf0e10cSrcweir //	if ( GetDBAtCursor( aStrDbName ) )
1007*cdf0e10cSrcweir //	if ( GetAreaAtCursor( aStrAreaName ) )
1008*cdf0e10cSrcweir }
1009*cdf0e10cSrcweir 
1010*cdf0e10cSrcweir //------------------------------------------------------------------------
1011*cdf0e10cSrcweir 
1012*cdf0e10cSrcweir void ScNavigatorDlg::SetCurrentCell( SCCOL nColNo, SCROW nRowNo )
1013*cdf0e10cSrcweir {
1014*cdf0e10cSrcweir 	if ( (nColNo+1 != nCurCol) || (nRowNo+1 != nCurRow) )
1015*cdf0e10cSrcweir 	{
1016*cdf0e10cSrcweir 		// SID_CURRENTCELL == Item #0 Cache leeren, damit das Setzen der
1017*cdf0e10cSrcweir 		// aktuellen Zelle auch in zusammengefassten Bereichen funktioniert.
1018*cdf0e10cSrcweir 		ppBoundItems[0]->ClearCache();
1019*cdf0e10cSrcweir 
1020*cdf0e10cSrcweir 		ScAddress aScAddress( nColNo, nRowNo, 0 );
1021*cdf0e10cSrcweir 		String	aAddr;
1022*cdf0e10cSrcweir 		aScAddress.Format( aAddr, SCA_ABS );
1023*cdf0e10cSrcweir 
1024*cdf0e10cSrcweir 		sal_Bool bUnmark = sal_False;
1025*cdf0e10cSrcweir 		if ( GetViewData() )
1026*cdf0e10cSrcweir 			bUnmark = !pViewData->GetMarkData().IsCellMarked( nColNo, nRowNo );
1027*cdf0e10cSrcweir 
1028*cdf0e10cSrcweir 		SfxStringItem	aPosItem( SID_CURRENTCELL, aAddr );
1029*cdf0e10cSrcweir 		SfxBoolItem		aUnmarkItem( FN_PARAM_1, bUnmark );		// ggf. Selektion aufheben
1030*cdf0e10cSrcweir 
1031*cdf0e10cSrcweir 		rBindings.GetDispatcher()->Execute( SID_CURRENTCELL,
1032*cdf0e10cSrcweir 								  SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD,
1033*cdf0e10cSrcweir 								  &aPosItem, &aUnmarkItem, 0L );
1034*cdf0e10cSrcweir 	}
1035*cdf0e10cSrcweir }
1036*cdf0e10cSrcweir 
1037*cdf0e10cSrcweir void ScNavigatorDlg::SetCurrentCellStr( const String rName )
1038*cdf0e10cSrcweir {
1039*cdf0e10cSrcweir 	ppBoundItems[0]->ClearCache();
1040*cdf0e10cSrcweir 	SfxStringItem	aNameItem( SID_CURRENTCELL, rName );
1041*cdf0e10cSrcweir 
1042*cdf0e10cSrcweir 	rBindings.GetDispatcher()->Execute( SID_CURRENTCELL,
1043*cdf0e10cSrcweir 							  SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD,
1044*cdf0e10cSrcweir 							  &aNameItem, 0L );
1045*cdf0e10cSrcweir }
1046*cdf0e10cSrcweir 
1047*cdf0e10cSrcweir //------------------------------------------------------------------------
1048*cdf0e10cSrcweir 
1049*cdf0e10cSrcweir void ScNavigatorDlg::SetCurrentTable( SCTAB nTabNo )
1050*cdf0e10cSrcweir {
1051*cdf0e10cSrcweir 	if ( nTabNo != nCurTab )
1052*cdf0e10cSrcweir 	{
1053*cdf0e10cSrcweir 		//	Tabelle fuer Basic ist 1-basiert
1054*cdf0e10cSrcweir 		SfxUInt16Item aTabItem( SID_CURRENTTAB, static_cast<sal_uInt16>(nTabNo) + 1 );
1055*cdf0e10cSrcweir 		rBindings.GetDispatcher()->Execute( SID_CURRENTTAB,
1056*cdf0e10cSrcweir 								  SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD,
1057*cdf0e10cSrcweir 								  &aTabItem, 0L );
1058*cdf0e10cSrcweir 	}
1059*cdf0e10cSrcweir }
1060*cdf0e10cSrcweir 
1061*cdf0e10cSrcweir void ScNavigatorDlg::SetCurrentTableStr( const String rName )
1062*cdf0e10cSrcweir {
1063*cdf0e10cSrcweir 	if (!GetViewData()) return;
1064*cdf0e10cSrcweir 
1065*cdf0e10cSrcweir 	ScDocument* pDoc = pViewData->GetDocument();
1066*cdf0e10cSrcweir 	SCTAB nCount	 = pDoc->GetTableCount();
1067*cdf0e10cSrcweir 	String aTabName;
1068*cdf0e10cSrcweir 
1069*cdf0e10cSrcweir 	for ( SCTAB i=0; i<nCount; i++ )
1070*cdf0e10cSrcweir 	{
1071*cdf0e10cSrcweir 		pDoc->GetName( i, aTabName );
1072*cdf0e10cSrcweir 		if ( aTabName == rName )
1073*cdf0e10cSrcweir 		{
1074*cdf0e10cSrcweir 			SetCurrentTable( i );
1075*cdf0e10cSrcweir 			return;
1076*cdf0e10cSrcweir 		}
1077*cdf0e10cSrcweir 	}
1078*cdf0e10cSrcweir 
1079*cdf0e10cSrcweir 	Sound::Beep();					// Tabelle nicht gefunden
1080*cdf0e10cSrcweir }
1081*cdf0e10cSrcweir 
1082*cdf0e10cSrcweir //------------------------------------------------------------------------
1083*cdf0e10cSrcweir 
1084*cdf0e10cSrcweir void ScNavigatorDlg::SetCurrentObject( const String rName )
1085*cdf0e10cSrcweir {
1086*cdf0e10cSrcweir 	SfxStringItem aNameItem( SID_CURRENTOBJECT, rName );
1087*cdf0e10cSrcweir 	rBindings.GetDispatcher()->Execute( SID_CURRENTOBJECT,
1088*cdf0e10cSrcweir 							  SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD,
1089*cdf0e10cSrcweir 							  &aNameItem, 0L );
1090*cdf0e10cSrcweir }
1091*cdf0e10cSrcweir 
1092*cdf0e10cSrcweir //------------------------------------------------------------------------
1093*cdf0e10cSrcweir 
1094*cdf0e10cSrcweir void ScNavigatorDlg::SetCurrentDoc( const String& rDocName )		// aktivieren
1095*cdf0e10cSrcweir {
1096*cdf0e10cSrcweir 	SfxStringItem aDocItem( SID_CURRENTDOC, rDocName );
1097*cdf0e10cSrcweir 	rBindings.GetDispatcher()->Execute( SID_CURRENTDOC,
1098*cdf0e10cSrcweir 							  SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD,
1099*cdf0e10cSrcweir 							  &aDocItem, 0L );
1100*cdf0e10cSrcweir }
1101*cdf0e10cSrcweir 
1102*cdf0e10cSrcweir //------------------------------------------------------------------------
1103*cdf0e10cSrcweir 
1104*cdf0e10cSrcweir ScTabViewShell* ScNavigatorDlg::GetTabViewShell() const
1105*cdf0e10cSrcweir {
1106*cdf0e10cSrcweir     return PTR_CAST( ScTabViewShell, SfxViewShell::Current() );
1107*cdf0e10cSrcweir }
1108*cdf0e10cSrcweir 
1109*cdf0e10cSrcweir //------------------------------------------------------------------------
1110*cdf0e10cSrcweir 
1111*cdf0e10cSrcweir ScNavigatorSettings* ScNavigatorDlg::GetNavigatorSettings()
1112*cdf0e10cSrcweir {
1113*cdf0e10cSrcweir     //  #95791# Don't store the settings pointer here, because the settings belong to
1114*cdf0e10cSrcweir     //  the view, and the view may be closed while the navigator is open (reload).
1115*cdf0e10cSrcweir     //  If the pointer is cached here again later for performance reasons, it has to
1116*cdf0e10cSrcweir     //  be forgotten when the view is closed.
1117*cdf0e10cSrcweir 
1118*cdf0e10cSrcweir     ScTabViewShell* pViewSh = GetTabViewShell();
1119*cdf0e10cSrcweir     return pViewSh ? pViewSh->GetNavigatorSettings() : NULL;
1120*cdf0e10cSrcweir }
1121*cdf0e10cSrcweir 
1122*cdf0e10cSrcweir //------------------------------------------------------------------------
1123*cdf0e10cSrcweir 
1124*cdf0e10cSrcweir sal_Bool ScNavigatorDlg::GetViewData()
1125*cdf0e10cSrcweir {
1126*cdf0e10cSrcweir     ScTabViewShell* pViewSh = GetTabViewShell();
1127*cdf0e10cSrcweir 	pViewData = pViewSh ? pViewSh->GetViewData() : NULL;
1128*cdf0e10cSrcweir 
1129*cdf0e10cSrcweir 	return ( pViewData != NULL );
1130*cdf0e10cSrcweir }
1131*cdf0e10cSrcweir 
1132*cdf0e10cSrcweir //------------------------------------------------------------------------
1133*cdf0e10cSrcweir 
1134*cdf0e10cSrcweir void ScNavigatorDlg::UpdateColumn( const SCCOL* pCol )
1135*cdf0e10cSrcweir {
1136*cdf0e10cSrcweir 	if ( pCol )
1137*cdf0e10cSrcweir 		nCurCol = *pCol;
1138*cdf0e10cSrcweir 	else if ( GetViewData() )
1139*cdf0e10cSrcweir 		nCurCol = pViewData->GetCurX() + 1;
1140*cdf0e10cSrcweir 
1141*cdf0e10cSrcweir 	aEdCol.SetCol( nCurCol );
1142*cdf0e10cSrcweir 	CheckDataArea();
1143*cdf0e10cSrcweir }
1144*cdf0e10cSrcweir 
1145*cdf0e10cSrcweir //------------------------------------------------------------------------
1146*cdf0e10cSrcweir 
1147*cdf0e10cSrcweir void ScNavigatorDlg::UpdateRow( const SCROW* pRow )
1148*cdf0e10cSrcweir {
1149*cdf0e10cSrcweir 	if ( pRow )
1150*cdf0e10cSrcweir 		nCurRow = *pRow;
1151*cdf0e10cSrcweir 	else if ( GetViewData() )
1152*cdf0e10cSrcweir 		nCurRow = pViewData->GetCurY() + 1;
1153*cdf0e10cSrcweir 
1154*cdf0e10cSrcweir 	aEdRow.SetRow( nCurRow );
1155*cdf0e10cSrcweir 	CheckDataArea();
1156*cdf0e10cSrcweir }
1157*cdf0e10cSrcweir 
1158*cdf0e10cSrcweir //------------------------------------------------------------------------
1159*cdf0e10cSrcweir 
1160*cdf0e10cSrcweir void ScNavigatorDlg::UpdateTable( const SCTAB* pTab )
1161*cdf0e10cSrcweir {
1162*cdf0e10cSrcweir 	if ( pTab )
1163*cdf0e10cSrcweir 		nCurTab = *pTab;
1164*cdf0e10cSrcweir 	else if ( GetViewData() )
1165*cdf0e10cSrcweir 		nCurTab = pViewData->GetTabNo();
1166*cdf0e10cSrcweir 
1167*cdf0e10cSrcweir //	aLbTables.SetTab( nCurTab );
1168*cdf0e10cSrcweir 	CheckDataArea();
1169*cdf0e10cSrcweir }
1170*cdf0e10cSrcweir 
1171*cdf0e10cSrcweir //------------------------------------------------------------------------
1172*cdf0e10cSrcweir 
1173*cdf0e10cSrcweir void ScNavigatorDlg::UpdateAll()
1174*cdf0e10cSrcweir {
1175*cdf0e10cSrcweir 	switch ( eListMode )
1176*cdf0e10cSrcweir 	{
1177*cdf0e10cSrcweir 		case NAV_LMODE_DOCS:
1178*cdf0e10cSrcweir 		case NAV_LMODE_DBAREAS:
1179*cdf0e10cSrcweir 		case NAV_LMODE_AREAS:
1180*cdf0e10cSrcweir             aLbEntries.Refresh();
1181*cdf0e10cSrcweir 			break;
1182*cdf0e10cSrcweir 
1183*cdf0e10cSrcweir 		case NAV_LMODE_NONE:
1184*cdf0e10cSrcweir 			//!	???
1185*cdf0e10cSrcweir 			break;
1186*cdf0e10cSrcweir 
1187*cdf0e10cSrcweir 		default:
1188*cdf0e10cSrcweir 			break;
1189*cdf0e10cSrcweir 	}
1190*cdf0e10cSrcweir 
1191*cdf0e10cSrcweir 	aContentTimer.Stop();		// dann nicht nochmal
1192*cdf0e10cSrcweir }
1193*cdf0e10cSrcweir 
1194*cdf0e10cSrcweir //------------------------------------------------------------------------
1195*cdf0e10cSrcweir 
1196*cdf0e10cSrcweir void ScNavigatorDlg::SetListMode( NavListMode eMode, sal_Bool bSetSize )
1197*cdf0e10cSrcweir {
1198*cdf0e10cSrcweir 	if ( eMode != eListMode )
1199*cdf0e10cSrcweir 	{
1200*cdf0e10cSrcweir 		if ( eMode != NAV_LMODE_NONE )
1201*cdf0e10cSrcweir 			bFirstBig = sal_False;				// nicht mehr automatisch umschalten
1202*cdf0e10cSrcweir 
1203*cdf0e10cSrcweir 		eListMode = eMode;
1204*cdf0e10cSrcweir 
1205*cdf0e10cSrcweir 		switch ( eMode )
1206*cdf0e10cSrcweir 		{
1207*cdf0e10cSrcweir 			case NAV_LMODE_NONE:
1208*cdf0e10cSrcweir 				ShowList( sal_False, bSetSize );
1209*cdf0e10cSrcweir 				break;
1210*cdf0e10cSrcweir 
1211*cdf0e10cSrcweir 			case NAV_LMODE_AREAS:
1212*cdf0e10cSrcweir 			case NAV_LMODE_DBAREAS:
1213*cdf0e10cSrcweir 			case NAV_LMODE_DOCS:
1214*cdf0e10cSrcweir 				aLbEntries.Refresh();
1215*cdf0e10cSrcweir 				ShowList( sal_True, bSetSize );
1216*cdf0e10cSrcweir 				break;
1217*cdf0e10cSrcweir 
1218*cdf0e10cSrcweir 			case NAV_LMODE_SCENARIOS:
1219*cdf0e10cSrcweir 				ShowScenarios( sal_True, bSetSize );
1220*cdf0e10cSrcweir 				break;
1221*cdf0e10cSrcweir 		}
1222*cdf0e10cSrcweir 
1223*cdf0e10cSrcweir 		aTbxCmd.UpdateButtons();
1224*cdf0e10cSrcweir 
1225*cdf0e10cSrcweir 		if ( eMode != NAV_LMODE_NONE )
1226*cdf0e10cSrcweir 		{
1227*cdf0e10cSrcweir 			ScNavipiCfg& rCfg = SC_MOD()->GetNavipiCfg();
1228*cdf0e10cSrcweir 			rCfg.SetListMode( (sal_uInt16) eMode );
1229*cdf0e10cSrcweir 		}
1230*cdf0e10cSrcweir 	}
1231*cdf0e10cSrcweir 
1232*cdf0e10cSrcweir 	if ( pMarkArea )
1233*cdf0e10cSrcweir 		UnmarkDataArea();
1234*cdf0e10cSrcweir }
1235*cdf0e10cSrcweir 
1236*cdf0e10cSrcweir //------------------------------------------------------------------------
1237*cdf0e10cSrcweir 
1238*cdf0e10cSrcweir void ScNavigatorDlg::ShowList( sal_Bool bShow, sal_Bool bSetSize )
1239*cdf0e10cSrcweir {
1240*cdf0e10cSrcweir 	FloatingWindow* pFloat = pContextWin->GetFloatingWindow();
1241*cdf0e10cSrcweir 	Size aSize = GetParent()->GetOutputSizePixel();
1242*cdf0e10cSrcweir 
1243*cdf0e10cSrcweir 	if ( bShow )
1244*cdf0e10cSrcweir 	{
1245*cdf0e10cSrcweir 		Size aMinSize = aInitSize;
1246*cdf0e10cSrcweir 
1247*cdf0e10cSrcweir 		aMinSize.Height() += nInitListHeight;
1248*cdf0e10cSrcweir 		if ( pFloat )
1249*cdf0e10cSrcweir 			pFloat->SetMinOutputSizePixel( aMinSize );
1250*cdf0e10cSrcweir 		aSize.Height() = nListModeHeight;
1251*cdf0e10cSrcweir 		aLbEntries.Show();
1252*cdf0e10cSrcweir 		aLbDocuments.Show();
1253*cdf0e10cSrcweir 	}
1254*cdf0e10cSrcweir 	else
1255*cdf0e10cSrcweir 	{
1256*cdf0e10cSrcweir 		if ( pFloat )
1257*cdf0e10cSrcweir 		{
1258*cdf0e10cSrcweir 			pFloat->SetMinOutputSizePixel( aInitSize );
1259*cdf0e10cSrcweir 			nListModeHeight = aSize.Height();
1260*cdf0e10cSrcweir 		}
1261*cdf0e10cSrcweir 		aSize.Height() = aInitSize.Height();
1262*cdf0e10cSrcweir 		aLbEntries.Hide();
1263*cdf0e10cSrcweir 		aLbDocuments.Hide();
1264*cdf0e10cSrcweir 	}
1265*cdf0e10cSrcweir 	aWndScenarios.Hide();
1266*cdf0e10cSrcweir 
1267*cdf0e10cSrcweir 	if ( pFloat )
1268*cdf0e10cSrcweir 	{
1269*cdf0e10cSrcweir 		if ( bSetSize )
1270*cdf0e10cSrcweir 			pFloat->SetOutputSizePixel( aSize );
1271*cdf0e10cSrcweir 	}
1272*cdf0e10cSrcweir 	else
1273*cdf0e10cSrcweir 	{
1274*cdf0e10cSrcweir 		SfxNavigator* pNav = (SfxNavigator*)GetParent();
1275*cdf0e10cSrcweir 		Size aFloating = pNav->GetFloatingSize();
1276*cdf0e10cSrcweir 		aFloating.Height() = aSize.Height();
1277*cdf0e10cSrcweir 		pNav->SetFloatingSize( aFloating );
1278*cdf0e10cSrcweir 	}
1279*cdf0e10cSrcweir }
1280*cdf0e10cSrcweir 
1281*cdf0e10cSrcweir //------------------------------------------------------------------------
1282*cdf0e10cSrcweir 
1283*cdf0e10cSrcweir void ScNavigatorDlg::ShowScenarios( sal_Bool bShow, sal_Bool bSetSize )
1284*cdf0e10cSrcweir {
1285*cdf0e10cSrcweir 	FloatingWindow* pFloat = pContextWin->GetFloatingWindow();
1286*cdf0e10cSrcweir 	Size aSize = GetParent()->GetOutputSizePixel();
1287*cdf0e10cSrcweir 
1288*cdf0e10cSrcweir 	if ( bShow )
1289*cdf0e10cSrcweir 	{
1290*cdf0e10cSrcweir 		Size aMinSize = aInitSize;
1291*cdf0e10cSrcweir 		aMinSize.Height() += nInitListHeight;
1292*cdf0e10cSrcweir 		if ( pFloat )
1293*cdf0e10cSrcweir 			pFloat->SetMinOutputSizePixel( aMinSize );
1294*cdf0e10cSrcweir 		aSize.Height() = nListModeHeight;
1295*cdf0e10cSrcweir 
1296*cdf0e10cSrcweir 		rBindings.Invalidate( SID_SELECT_SCENARIO );
1297*cdf0e10cSrcweir 		rBindings.Update( SID_SELECT_SCENARIO );
1298*cdf0e10cSrcweir 
1299*cdf0e10cSrcweir 		aWndScenarios.Show();
1300*cdf0e10cSrcweir 		aLbDocuments.Show();
1301*cdf0e10cSrcweir 	}
1302*cdf0e10cSrcweir 	else
1303*cdf0e10cSrcweir 	{
1304*cdf0e10cSrcweir 		if ( pFloat )
1305*cdf0e10cSrcweir 		{
1306*cdf0e10cSrcweir 			pFloat->SetMinOutputSizePixel( aInitSize );
1307*cdf0e10cSrcweir 			nListModeHeight = aSize.Height();
1308*cdf0e10cSrcweir 		}
1309*cdf0e10cSrcweir 		aSize.Height() = aInitSize.Height();
1310*cdf0e10cSrcweir 		aWndScenarios.Hide();
1311*cdf0e10cSrcweir 		aLbDocuments.Hide();
1312*cdf0e10cSrcweir 	}
1313*cdf0e10cSrcweir 	aLbEntries.Hide();
1314*cdf0e10cSrcweir 
1315*cdf0e10cSrcweir 	if ( pFloat )
1316*cdf0e10cSrcweir 	{
1317*cdf0e10cSrcweir 		if ( bSetSize )
1318*cdf0e10cSrcweir 			pFloat->SetOutputSizePixel( aSize );
1319*cdf0e10cSrcweir 	}
1320*cdf0e10cSrcweir 	else
1321*cdf0e10cSrcweir 	{
1322*cdf0e10cSrcweir 		SfxNavigator* pNav = (SfxNavigator*)GetParent();
1323*cdf0e10cSrcweir 		Size aFloating = pNav->GetFloatingSize();
1324*cdf0e10cSrcweir 		aFloating.Height() = aSize.Height();
1325*cdf0e10cSrcweir 		pNav->SetFloatingSize( aFloating );
1326*cdf0e10cSrcweir 	}
1327*cdf0e10cSrcweir }
1328*cdf0e10cSrcweir 
1329*cdf0e10cSrcweir 
1330*cdf0e10cSrcweir //------------------------------------------------------------------------
1331*cdf0e10cSrcweir //
1332*cdf0e10cSrcweir //		Dokumente fuer Dropdown-Listbox
1333*cdf0e10cSrcweir //
1334*cdf0e10cSrcweir //------------------------------------------------------------------------
1335*cdf0e10cSrcweir 
1336*cdf0e10cSrcweir void ScNavigatorDlg::GetDocNames( const String* pManualSel )
1337*cdf0e10cSrcweir {
1338*cdf0e10cSrcweir 	aLbDocuments.Clear();
1339*cdf0e10cSrcweir 	aLbDocuments.SetUpdateMode( sal_False );
1340*cdf0e10cSrcweir 
1341*cdf0e10cSrcweir 	ScDocShell* pCurrentSh = PTR_CAST( ScDocShell, SfxObjectShell::Current() );
1342*cdf0e10cSrcweir 
1343*cdf0e10cSrcweir 	String aSelEntry;
1344*cdf0e10cSrcweir 	SfxObjectShell* pSh = SfxObjectShell::GetFirst();
1345*cdf0e10cSrcweir 	while ( pSh )
1346*cdf0e10cSrcweir 	{
1347*cdf0e10cSrcweir 		if ( pSh->ISA(ScDocShell) )
1348*cdf0e10cSrcweir 		{
1349*cdf0e10cSrcweir 			String aName = pSh->GetTitle();
1350*cdf0e10cSrcweir 			String aEntry = aName;
1351*cdf0e10cSrcweir 			if (pSh == pCurrentSh)
1352*cdf0e10cSrcweir 				aEntry += aStrActive;
1353*cdf0e10cSrcweir 			else
1354*cdf0e10cSrcweir 				aEntry += aStrNotActive;
1355*cdf0e10cSrcweir 			aLbDocuments.InsertEntry( aEntry );
1356*cdf0e10cSrcweir 
1357*cdf0e10cSrcweir 			if ( pManualSel ? ( aName == *pManualSel )
1358*cdf0e10cSrcweir 							: ( pSh == pCurrentSh ) )
1359*cdf0e10cSrcweir 				aSelEntry = aEntry;						// kompletter Eintrag zum Selektieren
1360*cdf0e10cSrcweir 		}
1361*cdf0e10cSrcweir 
1362*cdf0e10cSrcweir 		pSh = SfxObjectShell::GetNext( *pSh );
1363*cdf0e10cSrcweir 	}
1364*cdf0e10cSrcweir 
1365*cdf0e10cSrcweir 	aLbDocuments.InsertEntry( aStrActiveWin );
1366*cdf0e10cSrcweir 
1367*cdf0e10cSrcweir 	String aHidden =  aLbEntries.GetHiddenTitle();
1368*cdf0e10cSrcweir 	if (aHidden.Len())
1369*cdf0e10cSrcweir 	{
1370*cdf0e10cSrcweir 		String aEntry = aHidden;
1371*cdf0e10cSrcweir 		aEntry += aStrHidden;
1372*cdf0e10cSrcweir 		aLbDocuments.InsertEntry( aEntry );
1373*cdf0e10cSrcweir 
1374*cdf0e10cSrcweir 		if ( pManualSel && aHidden == *pManualSel )
1375*cdf0e10cSrcweir 			aSelEntry = aEntry;
1376*cdf0e10cSrcweir 	}
1377*cdf0e10cSrcweir 
1378*cdf0e10cSrcweir 	aLbDocuments.SetUpdateMode( sal_True );
1379*cdf0e10cSrcweir 
1380*cdf0e10cSrcweir 	aLbDocuments.SelectEntry( aSelEntry );
1381*cdf0e10cSrcweir }
1382*cdf0e10cSrcweir 
1383*cdf0e10cSrcweir //------------------------------------------------------------------------
1384*cdf0e10cSrcweir 
1385*cdf0e10cSrcweir void ScNavigatorDlg::MarkDataArea()
1386*cdf0e10cSrcweir {
1387*cdf0e10cSrcweir     ScTabViewShell* pViewSh = GetTabViewShell();
1388*cdf0e10cSrcweir 
1389*cdf0e10cSrcweir 	if ( pViewSh )
1390*cdf0e10cSrcweir 	{
1391*cdf0e10cSrcweir 		if ( !pMarkArea )
1392*cdf0e10cSrcweir 			pMarkArea = new	ScArea;
1393*cdf0e10cSrcweir 
1394*cdf0e10cSrcweir 		pViewSh->MarkDataArea();
1395*cdf0e10cSrcweir 		ScRange aMarkRange;
1396*cdf0e10cSrcweir 		pViewSh->GetViewData()->GetMarkData().GetMarkArea(aMarkRange);
1397*cdf0e10cSrcweir 		pMarkArea->nColStart = aMarkRange.aStart.Col();
1398*cdf0e10cSrcweir 		pMarkArea->nRowStart = aMarkRange.aStart.Row();
1399*cdf0e10cSrcweir 		pMarkArea->nColEnd = aMarkRange.aEnd.Col();
1400*cdf0e10cSrcweir 		pMarkArea->nRowEnd = aMarkRange.aEnd.Row();
1401*cdf0e10cSrcweir 		pMarkArea->nTab = aMarkRange.aStart.Tab();
1402*cdf0e10cSrcweir 	}
1403*cdf0e10cSrcweir }
1404*cdf0e10cSrcweir 
1405*cdf0e10cSrcweir //------------------------------------------------------------------------
1406*cdf0e10cSrcweir 
1407*cdf0e10cSrcweir void ScNavigatorDlg::UnmarkDataArea()
1408*cdf0e10cSrcweir {
1409*cdf0e10cSrcweir     ScTabViewShell* pViewSh = GetTabViewShell();
1410*cdf0e10cSrcweir 
1411*cdf0e10cSrcweir 	if ( pViewSh )
1412*cdf0e10cSrcweir 	{
1413*cdf0e10cSrcweir 		pViewSh->Unmark();
1414*cdf0e10cSrcweir 		DELETEZ( pMarkArea );
1415*cdf0e10cSrcweir 	}
1416*cdf0e10cSrcweir }
1417*cdf0e10cSrcweir 
1418*cdf0e10cSrcweir //------------------------------------------------------------------------
1419*cdf0e10cSrcweir 
1420*cdf0e10cSrcweir void ScNavigatorDlg::CheckDataArea()
1421*cdf0e10cSrcweir {
1422*cdf0e10cSrcweir 	if ( aTbxCmd.IsItemChecked( IID_DATA ) && pMarkArea )
1423*cdf0e10cSrcweir 	{
1424*cdf0e10cSrcweir 		if (   nCurTab   != pMarkArea->nTab
1425*cdf0e10cSrcweir 			|| nCurCol <  pMarkArea->nColStart+1
1426*cdf0e10cSrcweir 			|| nCurCol >  pMarkArea->nColEnd+1
1427*cdf0e10cSrcweir 			|| nCurRow <  pMarkArea->nRowStart+1
1428*cdf0e10cSrcweir 			|| nCurRow >  pMarkArea->nRowEnd+1 )
1429*cdf0e10cSrcweir 		{
1430*cdf0e10cSrcweir 			aTbxCmd.SetItemState( IID_DATA, TriState(STATE_CHECK) );
1431*cdf0e10cSrcweir 			aTbxCmd.Select( IID_DATA );
1432*cdf0e10cSrcweir 		}
1433*cdf0e10cSrcweir 	}
1434*cdf0e10cSrcweir }
1435*cdf0e10cSrcweir 
1436*cdf0e10cSrcweir //------------------------------------------------------------------------
1437*cdf0e10cSrcweir 
1438*cdf0e10cSrcweir void ScNavigatorDlg::StartOfDataArea()
1439*cdf0e10cSrcweir {
1440*cdf0e10cSrcweir 	//	pMarkArea auswerten ???
1441*cdf0e10cSrcweir 
1442*cdf0e10cSrcweir 	if ( GetViewData() )
1443*cdf0e10cSrcweir 	{
1444*cdf0e10cSrcweir 		ScMarkData& rMark = pViewData->GetMarkData();
1445*cdf0e10cSrcweir 		ScRange aMarkRange;
1446*cdf0e10cSrcweir 		rMark.GetMarkArea( aMarkRange );
1447*cdf0e10cSrcweir 
1448*cdf0e10cSrcweir 		SCCOL nCol = aMarkRange.aStart.Col();
1449*cdf0e10cSrcweir 		SCROW nRow = aMarkRange.aStart.Row();
1450*cdf0e10cSrcweir 
1451*cdf0e10cSrcweir 		if ( (nCol+1 != aEdCol.GetCol()) || (nRow+1 != aEdRow.GetRow()) )
1452*cdf0e10cSrcweir 			SetCurrentCell( nCol, nRow );
1453*cdf0e10cSrcweir 	}
1454*cdf0e10cSrcweir }
1455*cdf0e10cSrcweir 
1456*cdf0e10cSrcweir //------------------------------------------------------------------------
1457*cdf0e10cSrcweir 
1458*cdf0e10cSrcweir void ScNavigatorDlg::EndOfDataArea()
1459*cdf0e10cSrcweir {
1460*cdf0e10cSrcweir 	//	pMarkArea auswerten ???
1461*cdf0e10cSrcweir 
1462*cdf0e10cSrcweir 	if ( GetViewData() )
1463*cdf0e10cSrcweir 	{
1464*cdf0e10cSrcweir 		ScMarkData& rMark = pViewData->GetMarkData();
1465*cdf0e10cSrcweir 		ScRange aMarkRange;
1466*cdf0e10cSrcweir 		rMark.GetMarkArea( aMarkRange );
1467*cdf0e10cSrcweir 
1468*cdf0e10cSrcweir 		SCCOL nCol = aMarkRange.aEnd.Col();
1469*cdf0e10cSrcweir 		SCROW nRow = aMarkRange.aEnd.Row();
1470*cdf0e10cSrcweir 
1471*cdf0e10cSrcweir 		if ( (nCol+1 != aEdCol.GetCol()) || (nRow+1 != aEdRow.GetRow()) )
1472*cdf0e10cSrcweir 			SetCurrentCell( nCol, nRow );
1473*cdf0e10cSrcweir 	}
1474*cdf0e10cSrcweir }
1475*cdf0e10cSrcweir 
1476*cdf0e10cSrcweir //------------------------------------------------------------------------
1477*cdf0e10cSrcweir 
1478*cdf0e10cSrcweir SfxChildAlignment __EXPORT ScNavigatorDlg::CheckAlignment(
1479*cdf0e10cSrcweir 							SfxChildAlignment eActAlign, SfxChildAlignment eAlign )
1480*cdf0e10cSrcweir {
1481*cdf0e10cSrcweir 	SfxChildAlignment eRetAlign;
1482*cdf0e10cSrcweir 
1483*cdf0e10cSrcweir 	//!	kein Andocken, wenn Listbox nicht da ???
1484*cdf0e10cSrcweir 
1485*cdf0e10cSrcweir 	switch (eAlign)
1486*cdf0e10cSrcweir 	{
1487*cdf0e10cSrcweir 		case SFX_ALIGN_TOP:
1488*cdf0e10cSrcweir 		case SFX_ALIGN_HIGHESTTOP:
1489*cdf0e10cSrcweir 		case SFX_ALIGN_LOWESTTOP:
1490*cdf0e10cSrcweir 		case SFX_ALIGN_BOTTOM:
1491*cdf0e10cSrcweir 		case SFX_ALIGN_LOWESTBOTTOM:
1492*cdf0e10cSrcweir 		case SFX_ALIGN_HIGHESTBOTTOM:
1493*cdf0e10cSrcweir 			eRetAlign = eActAlign;				// nicht erlaubt
1494*cdf0e10cSrcweir 			break;
1495*cdf0e10cSrcweir 
1496*cdf0e10cSrcweir 		case SFX_ALIGN_LEFT:
1497*cdf0e10cSrcweir 		case SFX_ALIGN_RIGHT:
1498*cdf0e10cSrcweir 		case SFX_ALIGN_FIRSTLEFT:
1499*cdf0e10cSrcweir 		case SFX_ALIGN_LASTLEFT:
1500*cdf0e10cSrcweir 		case SFX_ALIGN_FIRSTRIGHT:
1501*cdf0e10cSrcweir 		case SFX_ALIGN_LASTRIGHT:
1502*cdf0e10cSrcweir 			eRetAlign = eAlign;					// erlaubt
1503*cdf0e10cSrcweir 			break;
1504*cdf0e10cSrcweir 
1505*cdf0e10cSrcweir 		default:
1506*cdf0e10cSrcweir 			eRetAlign = eAlign;
1507*cdf0e10cSrcweir 			break;
1508*cdf0e10cSrcweir 	}
1509*cdf0e10cSrcweir 	return eRetAlign;
1510*cdf0e10cSrcweir }
1511*cdf0e10cSrcweir 
1512*cdf0e10cSrcweir //------------------------------------------------------------------------
1513*cdf0e10cSrcweir //
1514*cdf0e10cSrcweir //	Drop auf den Navigator - andere Datei laden (File oder Bookmark)
1515*cdf0e10cSrcweir //
1516*cdf0e10cSrcweir //------------------------------------------------------------------------
1517*cdf0e10cSrcweir 
1518*cdf0e10cSrcweir #if 0
1519*cdf0e10cSrcweir sal_Bool __EXPORT ScNavigatorDlg::Drop( const DropEvent& rEvt )
1520*cdf0e10cSrcweir {
1521*cdf0e10cSrcweir 	sal_Bool bReturn = sal_False;
1522*cdf0e10cSrcweir 
1523*cdf0e10cSrcweir 	if ( !aLbEntries.IsInDrag() )		// kein Verschieben innerhalb der TreeListBox
1524*cdf0e10cSrcweir 	{
1525*cdf0e10cSrcweir 		String aFileName;
1526*cdf0e10cSrcweir 
1527*cdf0e10cSrcweir 		SvScDataObjectRef pObject = SvScDataObject::PasteDragServer(rEvt);
1528*cdf0e10cSrcweir 
1529*cdf0e10cSrcweir 		sal_uLong nFormat = INetBookmark::HasFormat(*pObject);
1530*cdf0e10cSrcweir 		INetBookmark aBookmark;
1531*cdf0e10cSrcweir 		if (aBookmark.Paste(*pObject,nFormat))
1532*cdf0e10cSrcweir 			aFileName = aBookmark.GetURL();
1533*cdf0e10cSrcweir 		else
1534*cdf0e10cSrcweir 		{
1535*cdf0e10cSrcweir 			//	FORMAT_FILE direkt aus DragServer
1536*cdf0e10cSrcweir 
1537*cdf0e10cSrcweir 			sal_uInt16 nCount = DragServer::GetItemCount();
1538*cdf0e10cSrcweir 			for ( sal_uInt16 i = 0; i < nCount && !aFileName.Len(); ++i )
1539*cdf0e10cSrcweir 				if (DragServer::HasFormat( i, FORMAT_FILE ))
1540*cdf0e10cSrcweir 					aFileName = DragServer::PasteFile( i );
1541*cdf0e10cSrcweir 		}
1542*cdf0e10cSrcweir 
1543*cdf0e10cSrcweir 		if ( aFileName.Len() )
1544*cdf0e10cSrcweir 			bReturn = aLbEntries.LoadFile( aFileName );
1545*cdf0e10cSrcweir 	}
1546*cdf0e10cSrcweir 	return bReturn;
1547*cdf0e10cSrcweir }
1548*cdf0e10cSrcweir 
1549*cdf0e10cSrcweir sal_Bool __EXPORT ScNavigatorDlg::QueryDrop( DropEvent& rEvt )
1550*cdf0e10cSrcweir {
1551*cdf0e10cSrcweir 	sal_Bool bReturn = sal_False;
1552*cdf0e10cSrcweir 
1553*cdf0e10cSrcweir 	if ( !aLbEntries.IsInDrag() )		// kein Verschieben innerhalb der TreeListBox
1554*cdf0e10cSrcweir 	{
1555*cdf0e10cSrcweir 		SvScDataObjectRef pObject = SvScDataObject::PasteDragServer(rEvt);
1556*cdf0e10cSrcweir 		if ( pObject->HasFormat(FORMAT_FILE)
1557*cdf0e10cSrcweir 			|| INetBookmark::HasFormat(*pObject) )
1558*cdf0e10cSrcweir 		{
1559*cdf0e10cSrcweir 			rEvt.SetAction(DROP_COPY);		// Kopier-Cursor anzeigen
1560*cdf0e10cSrcweir 			bReturn = sal_True;
1561*cdf0e10cSrcweir 		}
1562*cdf0e10cSrcweir 	}
1563*cdf0e10cSrcweir 
1564*cdf0e10cSrcweir 	return bReturn;
1565*cdf0e10cSrcweir }
1566*cdf0e10cSrcweir #endif
1567*cdf0e10cSrcweir 
1568*cdf0e10cSrcweir 
1569*cdf0e10cSrcweir 
1570