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