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