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