bump product version to 7.2.5.1
[LibreOffice.git] / svx / source / form / fmpgeimp.cxx
blob449cc724f04f4f20d372ba2d186530336d1b6d89
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include <fmpgeimp.hxx>
22 #include <fmundo.hxx>
23 #include <svx/fmtools.hxx>
24 #include <fmprop.hxx>
25 #include <fmservs.hxx>
26 #include <fmobj.hxx>
27 #include <formcontrolfactory.hxx>
28 #include <svx/svditer.hxx>
29 #include <svx/strings.hrc>
30 #include <treevisitor.hxx>
32 #include <com/sun/star/sdb/CommandType.hpp>
33 #include <com/sun/star/sdbc/XRowSet.hpp>
34 #include <com/sun/star/container/EnumerableMap.hpp>
35 #include <com/sun/star/drawing/XControlShape.hpp>
36 #include <com/sun/star/form/Forms.hpp>
37 #include <com/sun/star/form/FormComponentType.hpp>
39 #include <sal/log.hxx>
40 #include <sfx2/objsh.hxx>
41 #include <svx/fmpage.hxx>
42 #include <svx/fmmodel.hxx>
43 #include <tools/debug.hxx>
44 #include <tools/diagnose_ex.h>
45 #include <svx/dialmgr.hxx>
46 #include <comphelper/processfactory.hxx>
47 #include <comphelper/types.hxx>
48 #include <connectivity/dbtools.hxx>
50 using namespace ::com::sun::star::uno;
51 using namespace ::com::sun::star::lang;
52 using namespace ::com::sun::star::sdbc;
53 using namespace ::com::sun::star::sdb;
54 using namespace ::com::sun::star::container;
55 using namespace ::com::sun::star::beans;
56 using namespace ::com::sun::star::form;
57 using ::com::sun::star::awt::XControlModel;
58 using ::com::sun::star::container::XMap;
59 using ::com::sun::star::container::EnumerableMap;
60 using ::com::sun::star::drawing::XControlShape;
61 using namespace ::svxform;
62 using namespace ::dbtools;
65 FmFormPageImpl::FmFormPageImpl( FmFormPage& _rPage )
66 :m_rPage( _rPage )
67 ,m_bFirstActivation( true )
68 ,m_bAttemptedFormCreation( false )
73 namespace
75 class FormComponentInfo
77 public:
78 static size_t childCount( const Reference< XInterface >& _component )
80 Reference< XIndexAccess > xContainer( _component, UNO_QUERY );
81 if ( xContainer.is() )
82 return xContainer->getCount();
83 return 0;
86 static Reference< XInterface > getChild( const Reference< XInterface >& _component, size_t _index )
88 Reference< XIndexAccess > xContainer( _component, UNO_QUERY_THROW );
89 return Reference< XInterface >( xContainer->getByIndex( _index ), UNO_QUERY );
93 typedef ::std::pair< Reference< XInterface >, Reference< XInterface > > FormComponentPair;
95 class FormHierarchyComparator
97 public:
98 FormHierarchyComparator()
102 static size_t childCount( const FormComponentPair& _components )
104 size_t lhsCount = FormComponentInfo::childCount( _components.first );
105 size_t rhsCount = FormComponentInfo::childCount( _components.second );
106 if ( lhsCount != rhsCount )
107 throw RuntimeException( "Found inconsistent form component hierarchies (1)!" );
108 return lhsCount;
111 static FormComponentPair getChild( const FormComponentPair& _components, size_t _index )
113 return FormComponentPair(
114 FormComponentInfo::getChild( _components.first, _index ),
115 FormComponentInfo::getChild( _components.second, _index )
120 typedef ::std::map< Reference< XControlModel >, Reference< XControlModel > > MapControlModels;
122 class FormComponentAssignment
124 public:
125 explicit FormComponentAssignment( MapControlModels& _out_controlModelMap )
126 :m_rControlModelMap( _out_controlModelMap )
130 void process( const FormComponentPair& _component )
132 Reference< XControlModel > lhsControlModel( _component.first, UNO_QUERY );
133 Reference< XControlModel > rhsControlModel( _component.second, UNO_QUERY );
134 if ( lhsControlModel.is() != rhsControlModel.is() )
135 throw RuntimeException( "Found inconsistent form component hierarchies (2)!" );
137 if ( lhsControlModel.is() )
138 m_rControlModelMap[ lhsControlModel ] = rhsControlModel;
141 private:
142 MapControlModels& m_rControlModelMap;
147 void FmFormPageImpl::initFrom( FmFormPageImpl& i_foreignImpl )
149 // clone the Forms collection
150 const Reference< css::form::XForms > xForeignForms( i_foreignImpl.getForms( false ) );
152 if ( !xForeignForms.is() )
153 return;
157 m_xForms.set( xForeignForms->createClone(), UNO_QUERY_THROW );
159 // create a mapping between the original control models and their clones
160 MapControlModels aModelAssignment;
162 typedef TreeVisitor< FormComponentPair, FormHierarchyComparator, FormComponentAssignment > FormComponentVisitor;
163 FormComponentVisitor aVisitor{ FormHierarchyComparator() };
165 FormComponentAssignment aAssignmentProcessor( aModelAssignment );
166 aVisitor.process( FormComponentPair( xForeignForms, m_xForms ), aAssignmentProcessor );
168 // assign the cloned models to their SdrObjects
169 SdrObjListIter aForeignIter( &i_foreignImpl.m_rPage );
170 SdrObjListIter aOwnIter( &m_rPage );
172 OSL_ENSURE( aForeignIter.IsMore() == aOwnIter.IsMore(), "FmFormPageImpl::FmFormPageImpl: inconsistent number of objects (1)!" );
173 while ( aForeignIter.IsMore() && aOwnIter.IsMore() )
175 FmFormObj* pForeignObj = dynamic_cast< FmFormObj* >( aForeignIter.Next() );
176 FmFormObj* pOwnObj = dynamic_cast< FmFormObj* >( aOwnIter.Next() );
178 bool bForeignIsForm = pForeignObj && ( pForeignObj->GetObjInventor() == SdrInventor::FmForm );
179 bool bOwnIsForm = pOwnObj && ( pOwnObj->GetObjInventor() == SdrInventor::FmForm );
181 if ( bForeignIsForm != bOwnIsForm )
183 // if this fires, don't attempt to do further assignments, something's completely messed up
184 SAL_WARN( "svx.form", "FmFormPageImpl::FmFormPageImpl: inconsistent ordering of objects!" );
185 break;
188 if ( !bForeignIsForm )
189 // no form control -> next round
190 continue;
192 Reference< XControlModel > xForeignModel( pForeignObj->GetUnoControlModel() );
193 if ( !xForeignModel.is() )
195 // if this fires, the SdrObject does not have a UNO Control Model. This is pathological, but well ...
196 // So the cloned SdrObject will also not have a UNO Control Model.
197 SAL_WARN( "svx.form", "FmFormPageImpl::FmFormPageImpl: control shape without control!" );
198 continue;
201 MapControlModels::const_iterator assignment = aModelAssignment.find( xForeignModel );
202 if ( assignment == aModelAssignment.end() )
204 // if this fires, the source SdrObject has a model, but it is not part of the model hierarchy in
205 // i_foreignImpl.getForms().
206 // Pathological, too ...
207 SAL_WARN( "svx.form", "FmFormPageImpl::FmFormPageImpl: no clone found for this model!" );
208 continue;
211 pOwnObj->SetUnoControlModel( assignment->second );
213 OSL_ENSURE( aForeignIter.IsMore() == aOwnIter.IsMore(), "FmFormPageImpl::FmFormPageImpl: inconsistent number of objects (2)!" );
215 catch( const Exception& )
217 DBG_UNHANDLED_EXCEPTION("svx");
222 Reference< XMap > FmFormPageImpl::getControlToShapeMap()
224 Reference< XMap > xControlShapeMap( m_aControlShapeMap.get(), UNO_QUERY );
225 if ( xControlShapeMap.is() )
226 return xControlShapeMap;
228 xControlShapeMap = impl_createControlShapeMap_nothrow();
229 m_aControlShapeMap = xControlShapeMap;
230 return xControlShapeMap;
234 namespace
236 void lcl_insertFormObject_throw( const FmFormObj& _object, const Reference< XMap >& _map )
238 // the control model
239 Reference< XControlModel > xControlModel = _object.GetUnoControlModel();
240 OSL_ENSURE( xControlModel.is(), "lcl_insertFormObject_throw: suspicious: no control model!" );
241 if ( !xControlModel.is() )
242 return;
244 Reference< XControlShape > xControlShape( const_cast< FmFormObj& >( _object ).getUnoShape(), UNO_QUERY );
245 OSL_ENSURE( xControlShape.is(), "lcl_insertFormObject_throw: suspicious: no control shape!" );
246 if ( !xControlShape.is() )
247 return;
249 _map->put( makeAny( xControlModel ), makeAny( xControlShape ) );
252 void lcl_removeFormObject_throw( const FmFormObj& _object, const Reference< XMap >& _map )
254 // the control model
255 Reference< XControlModel > xControlModel = _object.GetUnoControlModel();
256 OSL_ENSURE( xControlModel.is(), "lcl_removeFormObject: suspicious: no control model!" );
257 if ( !xControlModel.is() )
259 return;
262 Any aOldAssignment = _map->remove( makeAny( xControlModel ) );
263 OSL_ENSURE(
264 aOldAssignment == makeAny( Reference< XControlShape >( const_cast< FmFormObj& >( _object ).getUnoShape(), UNO_QUERY ) ),
265 "lcl_removeFormObject: map was inconsistent!" );
270 Reference< XMap > FmFormPageImpl::impl_createControlShapeMap_nothrow()
272 Reference< XMap > xMap;
276 xMap = EnumerableMap::create( comphelper::getProcessComponentContext(),
277 ::cppu::UnoType< XControlModel >::get(),
278 ::cppu::UnoType< XControlShape >::get()
281 SdrObjListIter aPageIter( &m_rPage );
282 while ( aPageIter.IsMore() )
284 // only FmFormObjs are what we're interested in
285 FmFormObj* pCurrent = FmFormObj::GetFormObject( aPageIter.Next() );
286 if ( !pCurrent )
287 continue;
289 lcl_insertFormObject_throw( *pCurrent, xMap );
292 catch( const Exception& )
294 DBG_UNHANDLED_EXCEPTION("svx");
296 return xMap;
300 const Reference< css::form::XForms >& FmFormPageImpl::getForms( bool _bForceCreate )
302 if ( m_xForms.is() || !_bForceCreate )
303 return m_xForms;
305 if ( !m_bAttemptedFormCreation )
307 m_bAttemptedFormCreation = true;
309 Reference<XComponentContext> xContext = comphelper::getProcessComponentContext();
310 m_xForms = css::form::Forms::create( xContext );
312 if ( m_aFormsCreationHdl.IsSet() )
314 m_aFormsCreationHdl.Call( *this );
317 FmFormModel& rFmFormModel(dynamic_cast< FmFormModel& >(m_rPage.getSdrModelFromSdrPage()));
319 // give the newly created collection a place in the universe
320 SfxObjectShell* pObjShell(rFmFormModel.GetObjectShell());
321 if ( pObjShell )
322 m_xForms->setParent( pObjShell->GetModel() );
324 // tell the UNDO environment that we have a new forms collection
325 rFmFormModel.GetUndoEnv().AddForms( Reference<XNameContainer>(m_xForms,UNO_QUERY_THROW) );
327 return m_xForms;
331 FmFormPageImpl::~FmFormPageImpl()
333 xCurrentForm = nullptr;
335 ::comphelper::disposeComponent( m_xForms );
339 bool FmFormPageImpl::validateCurForm()
341 if ( !xCurrentForm.is() )
342 return false;
344 if ( !xCurrentForm->getParent().is() )
345 xCurrentForm.clear();
347 return xCurrentForm.is();
351 void FmFormPageImpl::setCurForm(const Reference< css::form::XForm >& xForm)
353 xCurrentForm = xForm;
357 Reference< XForm > FmFormPageImpl::getDefaultForm()
359 Reference< XForm > xForm;
361 Reference< XForms > xForms( getForms() );
363 // by default, we use our "current form"
364 if ( !validateCurForm() )
366 // check whether there is a "standard" form
367 if ( Reference<XNameAccess>(xForms,UNO_QUERY_THROW)->hasElements() )
369 // find the standard form
370 OUString sStandardFormname = SvxResId(RID_STR_STDFORMNAME);
374 if ( xForms->hasByName( sStandardFormname ) )
375 xForm.set( xForms->getByName( sStandardFormname ), UNO_QUERY_THROW );
376 else
378 xForm.set( xForms->getByIndex(0), UNO_QUERY_THROW );
381 catch( const Exception& )
383 DBG_UNHANDLED_EXCEPTION("svx");
387 else
389 xForm = xCurrentForm;
392 // did not find an existing suitable form -> create a new one
393 if ( !xForm.is() )
395 SdrModel& rModel(m_rPage.getSdrModelFromSdrPage());
397 if( rModel.IsUndoEnabled() )
399 OUString aStr(SvxResId(RID_STR_FORM));
400 OUString aUndoStr(SvxResId(RID_STR_UNDO_CONTAINER_INSERT));
401 rModel.BegUndo(aUndoStr.replaceFirst("'#'", aStr));
406 xForm.set( ::comphelper::getProcessServiceFactory()->createInstance( FM_SUN_COMPONENT_FORM ), UNO_QUERY );
408 // a form should always have the command type table as default
409 Reference< XPropertySet > xFormProps( xForm, UNO_QUERY_THROW );
410 xFormProps->setPropertyValue( FM_PROP_COMMANDTYPE, makeAny( sal_Int32( CommandType::TABLE ) ) );
412 // and the "Standard" name
413 OUString sName = SvxResId(RID_STR_STDFORMNAME);
414 xFormProps->setPropertyValue( FM_PROP_NAME, makeAny( sName ) );
416 if( rModel.IsUndoEnabled() )
418 rModel.AddUndo(
419 std::make_unique<FmUndoContainerAction>(
420 static_cast< FmFormModel& >(rModel),
421 FmUndoContainerAction::Inserted,
422 xForms,
423 xForm,
424 xForms->getCount()));
426 xForms->insertByName( sName, makeAny( xForm ) );
427 xCurrentForm = xForm;
429 catch( const Exception& )
431 DBG_UNHANDLED_EXCEPTION("svx");
432 xForm.clear();
435 if( rModel.IsUndoEnabled() )
436 rModel.EndUndo();
439 return xForm;
443 Reference< css::form::XForm > FmFormPageImpl::findPlaceInFormComponentHierarchy(
444 const Reference< XFormComponent > & rContent, const Reference< XDataSource > & rDatabase,
445 const OUString& rDBTitle, const OUString& rCursorSource, sal_Int32 nCommandType )
447 // if the control already is child of a form, don't do anything
448 if (!rContent.is() || rContent->getParent().is())
449 return nullptr;
451 Reference< XForm > xForm;
453 // If database and CursorSource are set, the form is searched for using
454 // these criteria, otherwise only current and the DefaultForm.
455 if (rDatabase.is() && !rCursorSource.isEmpty())
457 validateCurForm();
459 // first search in the current form
460 xForm = findFormForDataSource( xCurrentForm, rDatabase, rCursorSource, nCommandType );
462 Reference< css::container::XIndexAccess > xFormsByIndex = getForms();
463 DBG_ASSERT(xFormsByIndex.is(), "FmFormPageImpl::findPlaceInFormComponentHierarchy : no index access for my forms collection !");
464 sal_Int32 nCount = xFormsByIndex->getCount();
465 for (sal_Int32 i = 0; !xForm.is() && i < nCount; i++)
467 Reference< css::form::XForm > xToSearch;
468 xFormsByIndex->getByIndex(i) >>= xToSearch;
469 xForm = findFormForDataSource( xToSearch, rDatabase, rCursorSource, nCommandType );
472 // If no css::form found, then create a new one
473 if (!xForm.is())
475 SdrModel& rModel(m_rPage.getSdrModelFromSdrPage());
476 const bool bUndo(rModel.IsUndoEnabled());
478 if( bUndo )
480 OUString aStr(SvxResId(RID_STR_FORM));
481 OUString aUndoStr(SvxResId(RID_STR_UNDO_CONTAINER_INSERT));
482 aUndoStr = aUndoStr.replaceFirst("#", aStr);
483 rModel.BegUndo(aUndoStr);
486 xForm.set(::comphelper::getProcessServiceFactory()->createInstance(FM_SUN_COMPONENT_FORM), UNO_QUERY);
487 // a form should always have the command type table as default
488 Reference< css::beans::XPropertySet > xFormProps(xForm, UNO_QUERY);
489 try { xFormProps->setPropertyValue(FM_PROP_COMMANDTYPE, makeAny(sal_Int32(CommandType::TABLE))); }
490 catch(Exception&) { }
492 if (!rDBTitle.isEmpty())
493 xFormProps->setPropertyValue(FM_PROP_DATASOURCE,makeAny(rDBTitle));
494 else
496 Reference< css::beans::XPropertySet > xDatabaseProps(rDatabase, UNO_QUERY);
497 Any aDatabaseUrl = xDatabaseProps->getPropertyValue(FM_PROP_URL);
498 xFormProps->setPropertyValue(FM_PROP_URL, aDatabaseUrl);
501 xFormProps->setPropertyValue(FM_PROP_COMMAND,makeAny(rCursorSource));
502 xFormProps->setPropertyValue(FM_PROP_COMMANDTYPE, makeAny(nCommandType));
504 Reference< css::container::XNameAccess > xNamedSet = getForms();
506 const bool bTableOrQuery = ( CommandType::TABLE == nCommandType ) || ( CommandType::QUERY == nCommandType );
507 OUString sName = FormControlFactory::getUniqueName( xNamedSet,
508 bTableOrQuery ? rCursorSource : SvxResId(RID_STR_STDFORMNAME) );
510 xFormProps->setPropertyValue( FM_PROP_NAME, makeAny( sName ) );
512 if( bUndo )
514 Reference< css::container::XIndexContainer > xContainer = getForms();
515 rModel.AddUndo(
516 std::make_unique<FmUndoContainerAction>(
517 static_cast< FmFormModel& >(rModel),
518 FmUndoContainerAction::Inserted,
519 xContainer,
520 xForm,
521 xContainer->getCount()));
524 getForms()->insertByName( sName, makeAny( xForm ) );
526 if( bUndo )
527 rModel.EndUndo();
529 xCurrentForm = xForm;
532 xForm = getDefaultForm();
533 return xForm;
537 Reference< XForm > FmFormPageImpl::findFormForDataSource(
538 const Reference< XForm > & rForm, const Reference< XDataSource > & _rxDatabase,
539 const OUString& _rCursorSource, sal_Int32 nCommandType)
541 Reference< XForm > xResultForm;
542 Reference< XRowSet > xDBForm(rForm, UNO_QUERY);
543 Reference< XPropertySet > xFormProps(rForm, UNO_QUERY);
544 if (!xDBForm.is() || !xFormProps.is())
545 return xResultForm;
547 OSL_ENSURE(_rxDatabase.is(), "FmFormPageImpl::findFormForDataSource: invalid data source!");
548 OUString sLookupName; // the name of the data source we're looking for
549 OUString sFormDataSourceName; // the name of the data source the current connection in the form is based on
552 Reference< XPropertySet > xDSProps(_rxDatabase, UNO_QUERY);
553 if (xDSProps.is())
554 xDSProps->getPropertyValue(FM_PROP_NAME) >>= sLookupName;
556 xFormProps->getPropertyValue(FM_PROP_DATASOURCE) >>= sFormDataSourceName;
557 // if there's no DataSourceName set at the form, check whether we can deduce one from its
558 // ActiveConnection
559 if (sFormDataSourceName.isEmpty())
561 Reference< XConnection > xFormConnection;
562 xFormProps->getPropertyValue( FM_PROP_ACTIVE_CONNECTION ) >>= xFormConnection;
563 if ( !xFormConnection.is() )
564 isEmbeddedInDatabase( xFormProps, xFormConnection );
565 if (xFormConnection.is())
567 Reference< XChild > xConnAsChild(xFormConnection, UNO_QUERY);
568 if (xConnAsChild.is())
570 Reference< XDataSource > xFormDS(xConnAsChild->getParent(), UNO_QUERY);
571 if (xFormDS.is())
573 xDSProps.set(xFormDS, css::uno::UNO_QUERY);
574 if (xDSProps.is())
575 xDSProps->getPropertyValue(FM_PROP_NAME) >>= sFormDataSourceName;
581 catch(const Exception&)
583 TOOLS_WARN_EXCEPTION("svx", "FmFormPageImpl::findFormForDataSource");
586 if (sLookupName == sFormDataSourceName)
588 // now check whether CursorSource and type match
589 OUString aCursorSource = ::comphelper::getString(xFormProps->getPropertyValue(FM_PROP_COMMAND));
590 sal_Int32 nType = ::comphelper::getINT32(xFormProps->getPropertyValue(FM_PROP_COMMANDTYPE));
591 if (aCursorSource.isEmpty() || ((nType == nCommandType) && (aCursorSource == _rCursorSource))) // found the form
593 xResultForm = rForm;
594 // if no data source is set yet, it is done here
595 if (aCursorSource.isEmpty())
597 xFormProps->setPropertyValue(FM_PROP_COMMAND, makeAny(_rCursorSource));
598 xFormProps->setPropertyValue(FM_PROP_COMMANDTYPE, makeAny(nCommandType));
603 // as long as xResultForm is NULL, search the child forms of rForm
604 Reference< XIndexAccess > xComponents(rForm, UNO_QUERY);
605 sal_Int32 nCount = xComponents->getCount();
606 for (sal_Int32 i = 0; !xResultForm.is() && i < nCount; ++i)
608 Reference< css::form::XForm > xSearchForm;
609 xComponents->getByIndex(i) >>= xSearchForm;
610 // continue searching in the sub form
611 if (xSearchForm.is())
612 xResultForm = findFormForDataSource( xSearchForm, _rxDatabase, _rCursorSource, nCommandType );
614 return xResultForm;
618 OUString FmFormPageImpl::setUniqueName(const Reference< XFormComponent > & xFormComponent, const Reference< XForm > & xControls)
620 #if OSL_DEBUG_LEVEL > 0
623 OSL_ENSURE( !xFormComponent->getParent().is(), "FmFormPageImpl::setUniqueName: to be called before insertion!" );
625 catch( const Exception& )
627 DBG_UNHANDLED_EXCEPTION("svx");
629 #endif
630 OUString sName;
631 Reference< css::beans::XPropertySet > xSet(xFormComponent, UNO_QUERY);
632 if (xSet.is())
634 sName = ::comphelper::getString( xSet->getPropertyValue( FM_PROP_NAME ) );
635 Reference< css::container::XNameAccess > xNameAcc(xControls, UNO_QUERY);
637 if (sName.isEmpty() || xNameAcc->hasByName(sName))
639 // set a default name via the ClassId
640 sal_Int16 nClassId( FormComponentType::CONTROL );
641 xSet->getPropertyValue( FM_PROP_CLASSID ) >>= nClassId;
643 OUString sDefaultName = FormControlFactory::getDefaultUniqueName_ByComponentType(
644 Reference< XNameAccess >( xControls, UNO_QUERY ), xSet );
646 // do not overwrite the name of radio buttons that have it!
647 if (sName.isEmpty() || nClassId != css::form::FormComponentType::RADIOBUTTON)
649 xSet->setPropertyValue(FM_PROP_NAME, makeAny(sDefaultName));
652 sName = sDefaultName;
655 return sName;
659 void FmFormPageImpl::formModelAssigned( const FmFormObj& _object )
661 Reference< XMap > xControlShapeMap( m_aControlShapeMap.get(), UNO_QUERY );
662 if ( !xControlShapeMap.is() )
663 // our map does not exist -> not interested in this event
664 return;
668 lcl_removeFormObject_throw( _object, xControlShapeMap );
669 lcl_insertFormObject_throw( _object, xControlShapeMap );
671 catch( const Exception& )
673 DBG_UNHANDLED_EXCEPTION("svx");
678 void FmFormPageImpl::formObjectInserted( const FmFormObj& _object )
680 Reference< XMap > xControlShapeMap( m_aControlShapeMap.get(), UNO_QUERY );
681 if ( !xControlShapeMap.is() )
682 // our map does not exist -> not interested in this event
683 return;
687 lcl_insertFormObject_throw( _object, xControlShapeMap );
689 catch( const Exception& )
691 DBG_UNHANDLED_EXCEPTION("svx");
696 void FmFormPageImpl::formObjectRemoved( const FmFormObj& _object )
698 Reference< XMap > xControlShapeMap( m_aControlShapeMap.get(), UNO_QUERY );
699 if ( !xControlShapeMap.is() )
700 // our map does not exist -> not interested in this event
701 return;
705 lcl_removeFormObject_throw( _object, xControlShapeMap );
707 catch( const Exception& )
709 DBG_UNHANDLED_EXCEPTION("svx");
713 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */