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