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