xref: /aoo42x/main/svx/source/form/fmexpl.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_svx.hxx"
30 
31 #ifndef _SVX_FMRESIDS_HRC
32 #include "svx/fmresids.hrc"
33 #endif
34 #ifndef _SVX_FMEXPL_HRC
35 #include "fmexpl.hrc"
36 #endif
37 #include "fmexpl.hxx"
38 
39 #ifndef _SVX_FMHELP_HRC
40 #include "fmhelp.hrc"
41 #endif
42 #include <svx/fmglob.hxx>
43 #include "fmservs.hxx"
44 #include <svx/fmmodel.hxx>
45 #include "fmexch.hxx"
46 #include "fmundo.hxx"
47 #include "fmpgeimp.hxx"
48 
49 #ifndef _SVX_SVXIDS_HRC
50 #include <svx/svxids.hrc>
51 #endif
52 
53 #ifndef _SVX_FMPROP_HRC
54 #include "fmprop.hrc"
55 #endif
56 #include <svx/dialmgr.hxx>
57 #include "svx/svditer.hxx"
58 #include <svx/svdouno.hxx>
59 #include <fmundo.hxx>
60 #include <svx/svdobj.hxx>
61 #include <vcl/msgbox.hxx>
62 #include <sfx2/dispatch.hxx>
63 #include <sfx2/objsh.hxx>
64 #include <sfx2/viewsh.hxx>
65 #include <sfx2/viewfrm.hxx>
66 #include <com/sun/star/lang/XServiceInfo.hpp>
67 #include <com/sun/star/form/FormComponentType.hpp>
68 #include <com/sun/star/awt/XTabControllerModel.hpp>
69 #include <vcl/menu.hxx>
70 #include <sfx2/objitem.hxx>
71 #include <sfx2/request.hxx>
72 #include <tools/shl.hxx>
73 
74 #ifndef _WRKWIN_HXX //autogen
75 #include <vcl/wrkwin.hxx>
76 #endif
77 #include <vcl/sound.hxx>
78 #include <svx/fmshell.hxx>
79 #include "fmshimp.hxx"
80 #include <svx/fmpage.hxx>
81 #include <com/sun/star/io/XPersistObject.hpp>
82 #include <com/sun/star/script/XEventAttacherManager.hpp>
83 #include <com/sun/star/sdb/CommandType.hpp>
84 #include <com/sun/star/beans/PropertyAttribute.hpp>
85 #include <comphelper/property.hxx>
86 #include <comphelper/processfactory.hxx>
87 #include <osl/diagnose.h>
88 #include <rtl/logfile.hxx>
89 
90 using namespace ::svxform;
91 using namespace ::com::sun::star::uno;
92 using namespace ::com::sun::star::sdbc;
93 using namespace ::com::sun::star::sdb;
94 using namespace ::com::sun::star::form;
95 using namespace ::com::sun::star::beans;
96 using namespace ::com::sun::star::lang;
97 using namespace ::com::sun::star::container;
98 
99 //========================================================================
100 
101 SV_IMPL_PTRARR_SORT( FmEntryDataArray, FmEntryDataPtr )
102 SV_IMPL_PTRARR_SORT( SvLBoxEntrySortedArray, SvLBoxEntryPtr )
103 
104 //========================================================================
105 // class FmNavInsertedHint
106 //========================================================================
107 TYPEINIT1( FmNavInsertedHint, SfxHint );
108 DBG_NAME(FmNavInsertedHint);
109 //------------------------------------------------------------------------
110 FmNavInsertedHint::FmNavInsertedHint( FmEntryData* pInsertedEntryData, sal_uInt32 nRelPos )
111     :pEntryData( pInsertedEntryData )
112     ,nPos( nRelPos )
113 
114 {
115     DBG_CTOR(FmNavInsertedHint,NULL);
116 }
117 
118 //------------------------------------------------------------------------
119 FmNavInsertedHint::~FmNavInsertedHint()
120 {
121     DBG_DTOR(FmNavInsertedHint,NULL);
122 }
123 
124 
125 //========================================================================
126 // class FmNavInsertedHint
127 //========================================================================
128 TYPEINIT1( FmNavModelReplacedHint, SfxHint );
129 DBG_NAME(FmNavModelReplacedHint);
130 //------------------------------------------------------------------------
131 FmNavModelReplacedHint::FmNavModelReplacedHint( FmEntryData* pAffectedEntryData )
132     :pEntryData( pAffectedEntryData )
133 {
134     DBG_CTOR(FmNavModelReplacedHint,NULL);
135 }
136 
137 //------------------------------------------------------------------------
138 FmNavModelReplacedHint::~FmNavModelReplacedHint()
139 {
140     DBG_DTOR(FmNavModelReplacedHint,NULL);
141 }
142 
143 //========================================================================
144 // class FmNavRemovedHint
145 //========================================================================
146 TYPEINIT1( FmNavRemovedHint, SfxHint );
147 DBG_NAME(FmNavRemovedHint);
148 //------------------------------------------------------------------------
149 FmNavRemovedHint::FmNavRemovedHint( FmEntryData* pRemovedEntryData )
150     :pEntryData( pRemovedEntryData )
151 {
152     DBG_CTOR(FmNavRemovedHint,NULL);
153 }
154 
155 //------------------------------------------------------------------------
156 FmNavRemovedHint::~FmNavRemovedHint()
157 {
158     DBG_DTOR(FmNavRemovedHint,NULL);
159 }
160 
161 
162 //========================================================================
163 // class FmNavNameChangedHint
164 //========================================================================
165 TYPEINIT1( FmNavNameChangedHint, SfxHint );
166 DBG_NAME(FmNavNameChangedHint);
167 //------------------------------------------------------------------------
168 FmNavNameChangedHint::FmNavNameChangedHint( FmEntryData* pData, const ::rtl::OUString& rNewName )
169     :pEntryData( pData )
170     ,aNewName( rNewName )
171 {
172     DBG_CTOR(FmNavNameChangedHint,NULL);
173 }
174 
175 //------------------------------------------------------------------------
176 FmNavNameChangedHint::~FmNavNameChangedHint()
177 {
178     DBG_DTOR(FmNavNameChangedHint,NULL);
179 }
180 
181 //========================================================================
182 // class FmNavClearedHint
183 //========================================================================
184 TYPEINIT1( FmNavClearedHint, SfxHint );
185 DBG_NAME(FmNavClearedHint);
186 //------------------------------------------------------------------------
187 FmNavClearedHint::FmNavClearedHint()
188 {
189     DBG_CTOR(FmNavClearedHint,NULL);
190 }
191 
192 //------------------------------------------------------------------------
193 FmNavClearedHint::~FmNavClearedHint()
194 {
195     DBG_DTOR(FmNavClearedHint,NULL);
196 }
197 
198 //========================================================================
199 // class FmNavRequestSelectHint
200 //========================================================================
201 TYPEINIT1(FmNavRequestSelectHint, SfxHint);
202 
203 //========================================================================
204 // class FmNavViewMarksChanged
205 //========================================================================
206 TYPEINIT1(FmNavViewMarksChanged, SfxHint);
207 
208 //========================================================================
209 // class FmEntryDataList
210 //========================================================================
211 DBG_NAME(FmEntryDataList);
212 //------------------------------------------------------------------------
213 FmEntryDataList::FmEntryDataList()
214 {
215     DBG_CTOR(FmEntryDataList,NULL);
216 }
217 
218 //------------------------------------------------------------------------
219 FmEntryDataList::~FmEntryDataList()
220 {
221     DBG_DTOR(FmEntryDataList,NULL);
222 }
223 
224 
225 //========================================================================
226 // class FmEntryData
227 //========================================================================
228 TYPEINIT0( FmEntryData );
229 DBG_NAME(FmEntryData);
230 //------------------------------------------------------------------------
231 FmEntryData::FmEntryData( FmEntryData* pParentData, const Reference< XInterface >& _rxIFace )
232     :pParent( pParentData )
233 {
234     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmEntryData::FmEntryData" );
235     DBG_CTOR(FmEntryData,NULL);
236     pChildList = new FmEntryDataList();
237 
238 	newObject( _rxIFace );
239 }
240 
241 //------------------------------------------------------------------------
242 FmEntryData::~FmEntryData()
243 {
244     Clear();
245     delete pChildList;
246     DBG_DTOR(FmEntryData,NULL);
247 }
248 
249 //------------------------------------------------------------------------
250 void FmEntryData::newObject( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxIFace )
251 {
252     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmEntryData::newObject" );
253 	// do not just copy, normalize it
254 	m_xNormalizedIFace = Reference< XInterface >( _rxIFace, UNO_QUERY );
255 	m_xProperties = m_xProperties.query( m_xNormalizedIFace );
256 	m_xChild = m_xChild.query( m_xNormalizedIFace );
257 }
258 
259 //------------------------------------------------------------------------
260 FmEntryData::FmEntryData( const FmEntryData& rEntryData )
261 {
262     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmEntryData::FmEntryData" );
263     pChildList = new FmEntryDataList();
264     aText = rEntryData.GetText();
265     m_aNormalImage = rEntryData.GetNormalImage();
266     m_aHCImage = rEntryData.GetHCImage();
267     pParent = rEntryData.GetParent();
268 
269     FmEntryData* pChildData;
270     sal_uInt32 nEntryCount = rEntryData.GetChildList()->Count();
271     for( sal_uInt32 i=0; i<nEntryCount; i++ )
272     {
273         pChildData = rEntryData.GetChildList()->GetObject(i);
274         FmEntryData* pNewChildData = pChildData->Clone();
275         pChildList->Insert( pNewChildData, LIST_APPEND );
276     }
277 
278 	m_xNormalizedIFace = rEntryData.m_xNormalizedIFace;
279 	m_xProperties = rEntryData.m_xProperties;
280 	m_xChild = rEntryData.m_xChild;
281 }
282 
283 //------------------------------------------------------------------------
284 void FmEntryData::Clear()
285 {
286     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmEntryData::Clear" );
287     for (;;)
288     {
289         FmEntryData* pEntryData = GetChildList()->Remove(sal_uLong(0));
290         if (pEntryData == NULL)
291             break;
292         delete pEntryData;
293     }
294 }
295 
296 //------------------------------------------------------------------------
297 sal_Bool FmEntryData::IsEqualWithoutChilds( FmEntryData* pEntryData )
298 {
299     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmEntryData::IsEqualWithoutChilds" );
300     if(this == pEntryData)
301         return sal_True;
302 
303     if( !pEntryData )
304         return sal_False;
305 
306     if( !aText.equals(pEntryData->GetText()))
307         return sal_False;
308 
309     if( !pEntryData->GetParent() && pParent )
310         return sal_False;
311 
312     if( pEntryData->GetParent() && !pParent )
313         return sal_False;
314 
315     if( !pEntryData->GetParent() && !pParent )
316         return sal_True;
317 
318     if( !pParent->IsEqualWithoutChilds(pEntryData->GetParent()) )
319         return sal_False;
320 
321     return sal_True;
322 }
323 
324 
325 //========================================================================
326 // class FmFormData
327 //========================================================================
328 TYPEINIT1( FmFormData, FmEntryData );
329 DBG_NAME(FmFormData);
330 //------------------------------------------------------------------------
331 FmFormData::FmFormData( const Reference< XForm >& _rxForm, const ImageList& _rNormalImages, const ImageList& _rHCImages, FmFormData* _pParent )
332     :FmEntryData( _pParent, _rxForm )
333     ,m_xForm( _rxForm )
334 {
335     DBG_CTOR(FmEntryData,NULL);
336     //////////////////////////////////////////////////////////////////////
337     // Images setzen
338 
339     m_aNormalImage = _rNormalImages.GetImage( RID_SVXIMG_FORM );
340     m_aHCImage = _rHCImages.GetImage( RID_SVXIMG_FORM );
341 
342     //////////////////////////////////////////////////////////////////////
343     // Titel setzen
344     if (m_xForm.is())
345     {
346         Reference< XPropertySet >  xSet(m_xForm, UNO_QUERY);
347         if (xSet.is())
348         {
349             ::rtl::OUString aEntryName(::comphelper::getString(xSet->getPropertyValue( FM_PROP_NAME )));
350             SetText(aEntryName);
351         }
352     }
353     else
354         SetText( ::rtl::OUString() );
355 }
356 
357 //------------------------------------------------------------------------
358 FmFormData::~FmFormData()
359 {
360     DBG_DTOR(FmEntryData,NULL);
361 }
362 
363 //------------------------------------------------------------------------
364 FmFormData::FmFormData( const FmFormData& rFormData )
365     :FmEntryData( rFormData )
366 {
367     DBG_CTOR(FmEntryData,NULL);
368     m_xForm = rFormData.GetFormIface();
369 }
370 
371 //------------------------------------------------------------------------
372 FmEntryData* FmFormData::Clone()
373 {
374     return new FmFormData( *this );
375 }
376 
377 //------------------------------------------------------------------------
378 sal_Bool FmFormData::IsEqualWithoutChilds( FmEntryData* pEntryData )
379 {
380     if(this == pEntryData)
381         return sal_True;
382     if( !pEntryData->ISA(FmFormData) )
383         return sal_False;
384     FmFormData* pFormData = (FmFormData*)pEntryData;
385     if( (XForm*)m_xForm.get() != (XForm*)pFormData->GetFormIface().get() )
386         return sal_False;
387 
388     return FmEntryData::IsEqualWithoutChilds( pFormData );
389 }
390 
391 
392 //========================================================================
393 // class FmControlData
394 //========================================================================
395 TYPEINIT1( FmControlData, FmEntryData );
396 DBG_NAME(FmControlData);
397 //------------------------------------------------------------------------
398 FmControlData::FmControlData( const Reference< XFormComponent >& _rxComponent, const ImageList& _rNormalImages, const ImageList& _rHCImages, FmFormData* _pParent )
399     :FmEntryData( _pParent, _rxComponent )
400     ,m_xFormComponent( _rxComponent )
401 {
402     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmControlData::FmControlData" );
403     DBG_CTOR(FmControlData,NULL);
404     //////////////////////////////////////////////////////////////////////
405     // Images setzen
406     m_aNormalImage = GetImage( _rNormalImages );
407     m_aHCImage = GetImage( _rHCImages );
408 
409     //////////////////////////////////////////////////////////////////////
410     // Titel setzen
411     Reference< XPropertySet >  xSet(m_xFormComponent, UNO_QUERY);
412     if( xSet.is() )
413     {
414 #ifdef DBG_UTIL
415         ::rtl::OUString aEntryName = ::comphelper::getString(xSet->getPropertyValue( FM_PROP_NAME ));
416 #endif
417         SetText( ::comphelper::getString(xSet->getPropertyValue( FM_PROP_NAME )));
418     }
419 }
420 
421 //------------------------------------------------------------------------
422 FmControlData::~FmControlData()
423 {
424     DBG_DTOR(FmControlData,NULL);
425 }
426 
427 //------------------------------------------------------------------------
428 FmControlData::FmControlData( const FmControlData& rControlData )
429     :FmEntryData( rControlData )
430 {
431     DBG_CTOR(FmControlData,NULL);
432     m_xFormComponent = rControlData.GetFormComponent();
433 }
434 
435 //------------------------------------------------------------------------
436 FmEntryData* FmControlData::Clone()
437 {
438     return new FmControlData( *this );
439 }
440 
441 //------------------------------------------------------------------------
442 Image FmControlData::GetImage(const ImageList& ilNavigatorImages) const
443 {
444     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmControlData::FmControlData" );
445     //////////////////////////////////////////////////////////////////////
446     // Default-Image
447     Image aImage = ilNavigatorImages.GetImage( RID_SVXIMG_CONTROL );
448 
449     Reference< XServiceInfo > xInfo( m_xFormComponent, UNO_QUERY );
450     if (!m_xFormComponent.is())
451 		return aImage;
452 
453     //////////////////////////////////////////////////////////////////////
454     // Spezielle Control-Images
455     sal_Int16 nObjectType = getControlTypeByObject(xInfo);
456     switch (nObjectType)
457     {
458     case OBJ_FM_BUTTON:
459         aImage = ilNavigatorImages.GetImage( RID_SVXIMG_BUTTON );
460         break;
461 
462     case OBJ_FM_FIXEDTEXT:
463         aImage = ilNavigatorImages.GetImage( RID_SVXIMG_FIXEDTEXT );
464         break;
465 
466     case OBJ_FM_EDIT:
467         aImage = ilNavigatorImages.GetImage( RID_SVXIMG_EDIT );
468         break;
469 
470     case OBJ_FM_RADIOBUTTON:
471         aImage = ilNavigatorImages.GetImage( RID_SVXIMG_RADIOBUTTON );
472         break;
473 
474     case OBJ_FM_CHECKBOX:
475         aImage = ilNavigatorImages.GetImage( RID_SVXIMG_CHECKBOX );
476         break;
477 
478     case OBJ_FM_LISTBOX:
479         aImage = ilNavigatorImages.GetImage( RID_SVXIMG_LISTBOX );
480         break;
481 
482     case OBJ_FM_COMBOBOX:
483         aImage = ilNavigatorImages.GetImage( RID_SVXIMG_COMBOBOX );
484         break;
485 
486     case OBJ_FM_NAVIGATIONBAR:
487         aImage = ilNavigatorImages.GetImage( RID_SVXIMG_NAVIGATIONBAR );
488         break;
489 
490     case OBJ_FM_GROUPBOX:
491         aImage = ilNavigatorImages.GetImage( RID_SVXIMG_GROUPBOX );
492         break;
493 
494     case OBJ_FM_IMAGEBUTTON:
495         aImage = ilNavigatorImages.GetImage( RID_SVXIMG_IMAGEBUTTON );
496         break;
497 
498     case OBJ_FM_FILECONTROL:
499         aImage = ilNavigatorImages.GetImage( RID_SVXIMG_FILECONTROL );
500         break;
501 
502     case OBJ_FM_HIDDEN:
503         aImage = ilNavigatorImages.GetImage( RID_SVXIMG_HIDDEN );
504         break;
505 
506     case OBJ_FM_DATEFIELD:
507         aImage = ilNavigatorImages.GetImage( RID_SVXIMG_DATEFIELD );
508         break;
509 
510     case OBJ_FM_TIMEFIELD:
511         aImage = ilNavigatorImages.GetImage( RID_SVXIMG_TIMEFIELD );
512         break;
513 
514     case OBJ_FM_NUMERICFIELD:
515         aImage = ilNavigatorImages.GetImage( RID_SVXIMG_NUMERICFIELD );
516         break;
517 
518     case OBJ_FM_CURRENCYFIELD:
519         aImage = ilNavigatorImages.GetImage( RID_SVXIMG_CURRENCYFIELD );
520         break;
521 
522     case OBJ_FM_PATTERNFIELD:
523         aImage = ilNavigatorImages.GetImage( RID_SVXIMG_PATTERNFIELD );
524         break;
525 
526     case OBJ_FM_IMAGECONTROL:
527         aImage = ilNavigatorImages.GetImage( RID_SVXIMG_IMAGECONTROL );
528         break;
529 
530     case OBJ_FM_FORMATTEDFIELD:
531         aImage = ilNavigatorImages.GetImage( RID_SVXIMG_FORMATTEDFIELD );
532         break;
533 
534     case OBJ_FM_GRID:
535         aImage = ilNavigatorImages.GetImage( RID_SVXIMG_GRID );
536         break;
537 
538     case OBJ_FM_SCROLLBAR:
539         aImage = ilNavigatorImages.GetImage( RID_SVXIMG_SCROLLBAR );
540         break;
541 
542     case OBJ_FM_SPINBUTTON:
543         aImage = ilNavigatorImages.GetImage( RID_SVXIMG_SPINBUTTON);
544         break;
545     }
546 
547     return aImage;
548 }
549 
550 //------------------------------------------------------------------------
551 sal_Bool FmControlData::IsEqualWithoutChilds( FmEntryData* pEntryData )
552 {
553     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmControlData::IsEqualWithoutChilds" );
554     if(this == pEntryData)
555         return sal_True;
556 
557     if( !pEntryData->ISA(FmControlData) )
558         return sal_False;
559     FmControlData* pControlData = (FmControlData*)pEntryData;
560 
561     if( (XFormComponent*)m_xFormComponent.get() != (XFormComponent*)pControlData->GetFormComponent().get() )
562         return sal_False;
563 
564     return FmEntryData::IsEqualWithoutChilds( pControlData );
565 }
566 
567 //------------------------------------------------------------------------
568 void FmControlData::ModelReplaced( const Reference< XFormComponent >& _rxNew, const ImageList& _rNormalImages, const ImageList& _rHCImages )
569 {
570     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmControlData::ModelReplaced" );
571     m_xFormComponent = _rxNew;
572 	newObject( m_xFormComponent );
573 
574     // Images neu setzen
575     m_aNormalImage = GetImage( _rNormalImages );
576 	m_aHCImage = GetImage( _rHCImages );
577 }
578 
579 //............................................................................
580 namespace svxform
581 {
582 //............................................................................
583 
584 	//========================================================================
585 	// class NavigatorFrame
586 	//========================================================================
587 	DBG_NAME(NavigatorFrame)
588 	//------------------------------------------------------------------------
589 	NavigatorFrame::NavigatorFrame( SfxBindings* _pBindings, SfxChildWindow* _pMgr,
590 								  Window* _pParent )
591 	  :SfxDockingWindow( _pBindings, _pMgr, _pParent, WinBits(WB_STDMODELESS|WB_SIZEABLE|WB_ROLLABLE|WB_3DLOOK|WB_DOCKABLE) )
592 	  ,SfxControllerItem( SID_FM_FMEXPLORER_CONTROL, *_pBindings )
593 	{
594 		DBG_CTOR(NavigatorFrame,NULL);
595 		SetHelpId( HID_FORM_NAVIGATOR_WIN );
596 
597 		m_pNavigatorTree = new NavigatorTree(comphelper::getProcessServiceFactory(), this );
598 		m_pNavigatorTree->Show();
599 		SetText( SVX_RES(RID_STR_FMEXPLORER) );
600 		SfxDockingWindow::SetFloatingSize( Size(200,200) );
601 	}
602 
603 	//------------------------------------------------------------------------
604 	NavigatorFrame::~NavigatorFrame()
605 	{
606 		delete m_pNavigatorTree;
607 		DBG_DTOR(NavigatorFrame,NULL);
608 	}
609 
610 	//-----------------------------------------------------------------------
611 	void NavigatorFrame::UpdateContent( FmFormShell* pFormShell )
612 	{
613 		m_pNavigatorTree->UpdateContent( pFormShell );
614 	}
615 
616 	//-----------------------------------------------------------------------
617 	void NavigatorFrame::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
618 	{
619 		if( !pState  || SID_FM_FMEXPLORER_CONTROL != nSID )
620 			return;
621 
622 		if( eState >= SFX_ITEM_AVAILABLE )
623 		{
624 			FmFormShell* pShell = PTR_CAST( FmFormShell,((SfxObjectItem*)pState)->GetShell() );
625 			UpdateContent( pShell );
626 		}
627 		else
628 			UpdateContent( NULL );
629 	}
630 
631 	//-----------------------------------------------------------------------
632 	void NavigatorFrame::GetFocus()
633 	{
634 		if ( m_pNavigatorTree )
635 			m_pNavigatorTree->GrabFocus();
636 		else
637 			SfxDockingWindow::GetFocus();
638 	}
639 
640 	//-----------------------------------------------------------------------
641 	sal_Bool NavigatorFrame::Close()
642 	{
643 		UpdateContent( NULL );
644 		return SfxDockingWindow::Close();
645 	}
646 
647 	//-----------------------------------------------------------------------
648 	void NavigatorFrame::FillInfo( SfxChildWinInfo& rInfo ) const
649 	{
650 		SfxDockingWindow::FillInfo( rInfo );
651 		rInfo.bVisible = sal_False;
652 	}
653 
654 	//-----------------------------------------------------------------------
655 	Size NavigatorFrame::CalcDockingSize( SfxChildAlignment eAlign )
656 	{
657         if ( ( eAlign == SFX_ALIGN_TOP ) || ( eAlign == SFX_ALIGN_BOTTOM ) )
658             return Size();
659 
660         return SfxDockingWindow::CalcDockingSize( eAlign );
661 	}
662 
663 	//-----------------------------------------------------------------------
664 	SfxChildAlignment NavigatorFrame::CheckAlignment( SfxChildAlignment _eActAlign, SfxChildAlignment _eAlign )
665 	{
666 		if ( ( _eAlign == SFX_ALIGN_LEFT ) || ( _eAlign == SFX_ALIGN_RIGHT ) || ( _eAlign == SFX_ALIGN_NOALIGNMENT ) )
667 			return _eAlign;
668         return _eActAlign;
669 	}
670 
671 	//------------------------------------------------------------------------
672 	void NavigatorFrame::Resize()
673 	{
674 		SfxDockingWindow::Resize();
675 
676 		Size aLogOutputSize = PixelToLogic( GetOutputSizePixel(), MAP_APPFONT );
677 		Size aLogExplSize = aLogOutputSize;
678 		aLogExplSize.Width() -= 6;
679 		aLogExplSize.Height() -= 6;
680 
681 		Point aExplPos = LogicToPixel( Point(3,3), MAP_APPFONT );
682 		Size aExplSize = LogicToPixel( aLogExplSize, MAP_APPFONT );
683 
684 		m_pNavigatorTree->SetPosSizePixel( aExplPos, aExplSize );
685 	}
686 
687 
688 	//========================================================================
689 	// class NavigatorFrameManager
690 	//========================================================================
691 
692 	//-----------------------------------------------------------------------
693 	SFX_IMPL_DOCKINGWINDOW( NavigatorFrameManager, SID_FM_SHOW_FMEXPLORER )
694 
695 	//-----------------------------------------------------------------------
696 	NavigatorFrameManager::NavigatorFrameManager( Window* _pParent, sal_uInt16 _nId,
697 										SfxBindings* _pBindings, SfxChildWinInfo* _pInfo )
698 					 :SfxChildWindow( _pParent, _nId )
699 	{
700 		pWindow = new NavigatorFrame( _pBindings, this, _pParent );
701 		eChildAlignment = SFX_ALIGN_NOALIGNMENT;
702 		((SfxDockingWindow*)pWindow)->Initialize( _pInfo );
703 	}
704 
705 //............................................................................
706 }	// namespace svxform
707 //............................................................................
708