Bump version to 6.4-15
[LibreOffice.git] / svx / source / form / fmpgeimp.cxx
blob9146fe6605fdff61950cfc5319081d973a88243b
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 <svx/svxerr.hxx>
22 #include <fmpgeimp.hxx>
23 #include <fmundo.hxx>
24 #include <svx/fmtools.hxx>
25 #include <fmprop.hxx>
26 #include <fmservs.hxx>
27 #include <fmobj.hxx>
28 #include <formcontrolfactory.hxx>
29 #include <svx/svditer.hxx>
30 #include <svx/strings.hrc>
31 #include <treevisitor.hxx>
33 #include <com/sun/star/sdb/CommandType.hpp>
34 #include <com/sun/star/sdbc/XRowSet.hpp>
35 #include <com/sun/star/container/EnumerableMap.hpp>
36 #include <com/sun/star/drawing/XControlShape.hpp>
37 #include <com/sun/star/form/Forms.hpp>
39 #include <sal/log.hxx>
40 #include <sfx2/objsh.hxx>
41 #include <svx/fmglob.hxx>
42 #include <svx/fmpage.hxx>
43 #include <svx/fmmodel.hxx>
44 #include <tools/debug.hxx>
45 #include <tools/diagnose_ex.h>
46 #include <vcl/stdtext.hxx>
47 #include <svx/dialmgr.hxx>
48 #include <comphelper/processfactory.hxx>
49 #include <comphelper/types.hxx>
50 #include <unotools/streamwrap.hxx>
51 #include <connectivity/dbtools.hxx>
53 using namespace ::com::sun::star::uno;
54 using namespace ::com::sun::star::lang;
55 using namespace ::com::sun::star::sdbc;
56 using namespace ::com::sun::star::sdb;
57 using namespace ::com::sun::star::container;
58 using namespace ::com::sun::star::beans;
59 using namespace ::com::sun::star::form;
60 using ::com::sun::star::awt::XControlModel;
61 using ::com::sun::star::container::XMap;
62 using ::com::sun::star::container::EnumerableMap;
63 using ::com::sun::star::drawing::XControlShape;
64 using namespace ::svxform;
65 using namespace ::dbtools;
68 FmFormPageImpl::FmFormPageImpl( FmFormPage& _rPage )
69 :m_rPage( _rPage )
70 ,m_bFirstActivation( true )
71 ,m_bAttemptedFormCreation( false )
76 namespace
78 class FormComponentInfo
80 public:
81 static size_t childCount( const Reference< XInterface >& _component )
83 Reference< XIndexAccess > xContainer( _component, UNO_QUERY );
84 if ( xContainer.is() )
85 return xContainer->getCount();
86 return 0;
89 static Reference< XInterface > getChild( const Reference< XInterface >& _component, size_t _index )
91 Reference< XIndexAccess > xContainer( _component, UNO_QUERY_THROW );
92 return Reference< XInterface >( xContainer->getByIndex( _index ), UNO_QUERY );
96 typedef ::std::pair< Reference< XInterface >, Reference< XInterface > > FormComponentPair;
98 class FormHierarchyComparator
100 public:
101 FormHierarchyComparator()
105 static size_t childCount( const FormComponentPair& _components )
107 size_t lhsCount = FormComponentInfo::childCount( _components.first );
108 size_t rhsCount = FormComponentInfo::childCount( _components.second );
109 if ( lhsCount != rhsCount )
110 throw RuntimeException( "Found inconsistent form component hierarchies (1)!" );
111 return lhsCount;
114 static FormComponentPair getChild( const FormComponentPair& _components, size_t _index )
116 return FormComponentPair(
117 FormComponentInfo::getChild( _components.first, _index ),
118 FormComponentInfo::getChild( _components.second, _index )
123 typedef ::std::map< Reference< XControlModel >, Reference< XControlModel > > MapControlModels;
125 class FormComponentAssignment
127 public:
128 explicit FormComponentAssignment( MapControlModels& _out_controlModelMap )
129 :m_rControlModelMap( _out_controlModelMap )
133 void process( const FormComponentPair& _component )
135 Reference< XControlModel > lhsControlModel( _component.first, UNO_QUERY );
136 Reference< XControlModel > rhsControlModel( _component.second, UNO_QUERY );
137 if ( lhsControlModel.is() != rhsControlModel.is() )
138 throw RuntimeException( "Found inconsistent form component hierarchies (2)!" );
140 if ( lhsControlModel.is() )
141 m_rControlModelMap[ lhsControlModel ] = rhsControlModel;
144 private:
145 MapControlModels& m_rControlModelMap;
150 void FmFormPageImpl::initFrom( FmFormPageImpl& i_foreignImpl )
152 // clone the Forms collection
153 const Reference< css::form::XForms > xForeignForms( i_foreignImpl.getForms( false ) );
155 if ( !xForeignForms.is() )
156 return;
160 m_xForms.set( xForeignForms->createClone(), UNO_QUERY_THROW );
162 // create a mapping between the original control models and their clones
163 MapControlModels aModelAssignment;
165 typedef TreeVisitor< FormComponentPair, FormHierarchyComparator, FormComponentAssignment > FormComponentVisitor;
166 FormComponentVisitor aVisitor{ FormHierarchyComparator() };
168 FormComponentAssignment aAssignmentProcessor( aModelAssignment );
169 aVisitor.process( FormComponentPair( xForeignForms, m_xForms ), aAssignmentProcessor );
171 // assign the cloned models to their SdrObjects
172 SdrObjListIter aForeignIter( &i_foreignImpl.m_rPage );
173 SdrObjListIter aOwnIter( &m_rPage );
175 OSL_ENSURE( aForeignIter.IsMore() == aOwnIter.IsMore(), "FmFormPageImpl::FmFormPageImpl: inconsistent number of objects (1)!" );
176 while ( aForeignIter.IsMore() && aOwnIter.IsMore() )
178 FmFormObj* pForeignObj = dynamic_cast< FmFormObj* >( aForeignIter.Next() );
179 FmFormObj* pOwnObj = dynamic_cast< FmFormObj* >( aOwnIter.Next() );
181 bool bForeignIsForm = pForeignObj && ( pForeignObj->GetObjInventor() == SdrInventor::FmForm );
182 bool bOwnIsForm = pOwnObj && ( pOwnObj->GetObjInventor() == SdrInventor::FmForm );
184 if ( bForeignIsForm != bOwnIsForm )
186 // if this fires, don't attempt to do further assignments, something's completely messed up
187 SAL_WARN( "svx.form", "FmFormPageImpl::FmFormPageImpl: inconsistent ordering of objects!" );
188 break;
191 if ( !bForeignIsForm )
192 // no form control -> next round
193 continue;
195 Reference< XControlModel > xForeignModel( pForeignObj->GetUnoControlModel() );
196 if ( !xForeignModel.is() )
198 // if this fires, the SdrObject does not have a UNO Control Model. This is pathological, but well ...
199 // So the cloned SdrObject will also not have a UNO Control Model.
200 SAL_WARN( "svx.form", "FmFormPageImpl::FmFormPageImpl: control shape without control!" );
201 continue;
204 MapControlModels::const_iterator assignment = aModelAssignment.find( xForeignModel );
205 if ( assignment == aModelAssignment.end() )
207 // if this fires, the source SdrObject has a model, but it is not part of the model hierarchy in
208 // i_foreignImpl.getForms().
209 // Pathological, too ...
210 SAL_WARN( "svx.form", "FmFormPageImpl::FmFormPageImpl: no clone found for this model!" );
211 continue;
214 pOwnObj->SetUnoControlModel( assignment->second );
216 OSL_ENSURE( aForeignIter.IsMore() == aOwnIter.IsMore(), "FmFormPageImpl::FmFormPageImpl: inconsistent number of objects (2)!" );
218 catch( const Exception& )
220 DBG_UNHANDLED_EXCEPTION("svx");
225 Reference< XMap > FmFormPageImpl::getControlToShapeMap()
227 Reference< XMap > xControlShapeMap( m_aControlShapeMap.get(), UNO_QUERY );
228 if ( xControlShapeMap.is() )
229 return xControlShapeMap;
231 xControlShapeMap = impl_createControlShapeMap_nothrow();
232 m_aControlShapeMap = xControlShapeMap;
233 return xControlShapeMap;
237 namespace
239 void lcl_insertFormObject_throw( const FmFormObj& _object, const Reference< XMap >& _map )
241 // the control model
242 Reference< XControlModel > xControlModel = _object.GetUnoControlModel();
243 OSL_ENSURE( xControlModel.is(), "lcl_insertFormObject_throw: suspicious: no control model!" );
244 if ( !xControlModel.is() )
245 return;
247 Reference< XControlShape > xControlShape( const_cast< FmFormObj& >( _object ).getUnoShape(), UNO_QUERY );
248 OSL_ENSURE( xControlShape.is(), "lcl_insertFormObject_throw: suspicious: no control shape!" );
249 if ( !xControlShape.is() )
250 return;
252 _map->put( makeAny( xControlModel ), makeAny( xControlShape ) );
255 void lcl_removeFormObject_throw( const FmFormObj& _object, const Reference< XMap >& _map )
257 // the control model
258 Reference< XControlModel > xControlModel = _object.GetUnoControlModel();
259 OSL_ENSURE( xControlModel.is(), "lcl_removeFormObject: suspicious: no control model!" );
260 if ( !xControlModel.is() )
262 return;
265 Any aOldAssignment = _map->remove( makeAny( xControlModel ) );
266 OSL_ENSURE(
267 aOldAssignment == makeAny( Reference< XControlShape >( const_cast< FmFormObj& >( _object ).getUnoShape(), UNO_QUERY ) ),
268 "lcl_removeFormObject: map was inconsistent!" );
273 Reference< XMap > FmFormPageImpl::impl_createControlShapeMap_nothrow()
275 Reference< XMap > xMap;
279 xMap = EnumerableMap::create( comphelper::getProcessComponentContext(),
280 ::cppu::UnoType< XControlModel >::get(),
281 ::cppu::UnoType< XControlShape >::get()
284 SdrObjListIter aPageIter( &m_rPage );
285 while ( aPageIter.IsMore() )
287 // only FmFormObjs are what we're interested in
288 FmFormObj* pCurrent = FmFormObj::GetFormObject( aPageIter.Next() );
289 if ( !pCurrent )
290 continue;
292 lcl_insertFormObject_throw( *pCurrent, xMap );
295 catch( const Exception& )
297 DBG_UNHANDLED_EXCEPTION("svx");
299 return xMap;
303 const Reference< css::form::XForms >& FmFormPageImpl::getForms( bool _bForceCreate )
305 if ( m_xForms.is() || !_bForceCreate )
306 return m_xForms;
308 if ( !m_bAttemptedFormCreation )
310 m_bAttemptedFormCreation = true;
312 Reference<XComponentContext> xContext = comphelper::getProcessComponentContext();
313 m_xForms = css::form::Forms::create( xContext );
315 if ( m_aFormsCreationHdl.IsSet() )
317 m_aFormsCreationHdl.Call( *this );
320 FmFormModel& rFmFormModel(dynamic_cast< FmFormModel& >(m_rPage.getSdrModelFromSdrPage()));
322 // give the newly created collection a place in the universe
323 SfxObjectShell* pObjShell(rFmFormModel.GetObjectShell());
324 if ( pObjShell )
325 m_xForms->setParent( pObjShell->GetModel() );
327 // tell the UNDO environment that we have a new forms collection
328 rFmFormModel.GetUndoEnv().AddForms( Reference<XNameContainer>(m_xForms,UNO_QUERY_THROW) );
330 return m_xForms;
334 FmFormPageImpl::~FmFormPageImpl()
336 xCurrentForm = nullptr;
338 ::comphelper::disposeComponent( m_xForms );
342 bool FmFormPageImpl::validateCurForm()
344 if ( !xCurrentForm.is() )
345 return false;
347 if ( !xCurrentForm->getParent().is() )
348 xCurrentForm.clear();
350 return xCurrentForm.is();
354 void FmFormPageImpl::setCurForm(const Reference< css::form::XForm >& xForm)
356 xCurrentForm = xForm;
360 Reference< XForm > FmFormPageImpl::getDefaultForm()
362 Reference< XForm > xForm;
364 Reference< XForms > xForms( getForms() );
366 // by default, we use our "current form"
367 if ( !validateCurForm() )
369 // check whether there is a "standard" form
370 if ( Reference<XNameAccess>(xForms,UNO_QUERY_THROW)->hasElements() )
372 // find the standard form
373 OUString sStandardFormname = SvxResId(RID_STR_STDFORMNAME);
377 if ( xForms->hasByName( sStandardFormname ) )
378 xForm.set( xForms->getByName( sStandardFormname ), UNO_QUERY_THROW );
379 else
381 xForm.set( xForms->getByIndex(0), UNO_QUERY_THROW );
384 catch( const Exception& )
386 DBG_UNHANDLED_EXCEPTION("svx");
390 else
392 xForm = xCurrentForm;
395 // did not find an existing suitable form -> create a new one
396 if ( !xForm.is() )
398 SdrModel& rModel(m_rPage.getSdrModelFromSdrPage());
400 if( rModel.IsUndoEnabled() )
402 OUString aStr(SvxResId(RID_STR_FORM));
403 OUString aUndoStr(SvxResId(RID_STR_UNDO_CONTAINER_INSERT));
404 rModel.BegUndo(aUndoStr.replaceFirst("'#'", aStr));
409 xForm.set( ::comphelper::getProcessServiceFactory()->createInstance( FM_SUN_COMPONENT_FORM ), UNO_QUERY );
411 // a form should always have the command type table as default
412 Reference< XPropertySet > xFormProps( xForm, UNO_QUERY_THROW );
413 xFormProps->setPropertyValue( FM_PROP_COMMANDTYPE, makeAny( sal_Int32( CommandType::TABLE ) ) );
415 // and the "Standard" name
416 OUString sName = SvxResId(RID_STR_STDFORMNAME);
417 xFormProps->setPropertyValue( FM_PROP_NAME, makeAny( sName ) );
419 if( rModel.IsUndoEnabled() )
421 rModel.AddUndo(
422 std::make_unique<FmUndoContainerAction>(
423 static_cast< FmFormModel& >(rModel),
424 FmUndoContainerAction::Inserted,
425 xForms,
426 xForm,
427 xForms->getCount()));
429 xForms->insertByName( sName, makeAny( xForm ) );
430 xCurrentForm = xForm;
432 catch( const Exception& )
434 DBG_UNHANDLED_EXCEPTION("svx");
435 xForm.clear();
438 if( rModel.IsUndoEnabled() )
439 rModel.EndUndo();
442 return xForm;
446 Reference< css::form::XForm > FmFormPageImpl::findPlaceInFormComponentHierarchy(
447 const Reference< XFormComponent > & rContent, const Reference< XDataSource > & rDatabase,
448 const OUString& rDBTitle, const OUString& rCursorSource, sal_Int32 nCommandType )
450 // if the control already is child of a form, don't do anything
451 if (!rContent.is() || rContent->getParent().is())
452 return nullptr;
454 Reference< XForm > xForm;
456 // If database and CursorSource are set, the form is searched for using
457 // these criteria, otherwise only current and the DefaultForm.
458 if (rDatabase.is() && !rCursorSource.isEmpty())
460 validateCurForm();
462 // first search in the current form
463 xForm = findFormForDataSource( xCurrentForm, rDatabase, rCursorSource, nCommandType );
465 Reference< css::container::XIndexAccess > xFormsByIndex = getForms();
466 DBG_ASSERT(xFormsByIndex.is(), "FmFormPageImpl::findPlaceInFormComponentHierarchy : no index access for my forms collection !");
467 sal_Int32 nCount = xFormsByIndex->getCount();
468 for (sal_Int32 i = 0; !xForm.is() && i < nCount; i++)
470 Reference< css::form::XForm > xToSearch;
471 xFormsByIndex->getByIndex(i) >>= xToSearch;
472 xForm = findFormForDataSource( xToSearch, rDatabase, rCursorSource, nCommandType );
475 // If no css::form found, then create a new one
476 if (!xForm.is())
478 SdrModel& rModel(m_rPage.getSdrModelFromSdrPage());
479 const bool bUndo(rModel.IsUndoEnabled());
481 if( bUndo )
483 OUString aStr(SvxResId(RID_STR_FORM));
484 OUString aUndoStr(SvxResId(RID_STR_UNDO_CONTAINER_INSERT));
485 aUndoStr = aUndoStr.replaceFirst("#", aStr);
486 rModel.BegUndo(aUndoStr);
489 xForm.set(::comphelper::getProcessServiceFactory()->createInstance(FM_SUN_COMPONENT_FORM), UNO_QUERY);
490 // a form should always have the command type table as default
491 Reference< css::beans::XPropertySet > xFormProps(xForm, UNO_QUERY);
492 try { xFormProps->setPropertyValue(FM_PROP_COMMANDTYPE, makeAny(sal_Int32(CommandType::TABLE))); }
493 catch(Exception&) { }
495 if (!rDBTitle.isEmpty())
496 xFormProps->setPropertyValue(FM_PROP_DATASOURCE,makeAny(rDBTitle));
497 else
499 Reference< css::beans::XPropertySet > xDatabaseProps(rDatabase, UNO_QUERY);
500 Any aDatabaseUrl = xDatabaseProps->getPropertyValue(FM_PROP_URL);
501 xFormProps->setPropertyValue(FM_PROP_URL, aDatabaseUrl);
504 xFormProps->setPropertyValue(FM_PROP_COMMAND,makeAny(rCursorSource));
505 xFormProps->setPropertyValue(FM_PROP_COMMANDTYPE, makeAny(nCommandType));
507 Reference< css::container::XNameAccess > xNamedSet = getForms();
509 const bool bTableOrQuery = ( CommandType::TABLE == nCommandType ) || ( CommandType::QUERY == nCommandType );
510 OUString sName = FormControlFactory::getUniqueName( xNamedSet,
511 bTableOrQuery ? rCursorSource : SvxResId(RID_STR_STDFORMNAME) );
513 xFormProps->setPropertyValue( FM_PROP_NAME, makeAny( sName ) );
515 if( bUndo )
517 Reference< css::container::XIndexContainer > xContainer = getForms();
518 rModel.AddUndo(
519 std::make_unique<FmUndoContainerAction>(
520 static_cast< FmFormModel& >(rModel),
521 FmUndoContainerAction::Inserted,
522 xContainer,
523 xForm,
524 xContainer->getCount()));
527 getForms()->insertByName( sName, makeAny( xForm ) );
529 if( bUndo )
530 rModel.EndUndo();
532 xCurrentForm = xForm;
535 xForm = getDefaultForm();
536 return xForm;
540 Reference< XForm > FmFormPageImpl::findFormForDataSource(
541 const Reference< XForm > & rForm, const Reference< XDataSource > & _rxDatabase,
542 const OUString& _rCursorSource, sal_Int32 nCommandType)
544 Reference< XForm > xResultForm;
545 Reference< XRowSet > xDBForm(rForm, UNO_QUERY);
546 Reference< XPropertySet > xFormProps(rForm, UNO_QUERY);
547 if (!xDBForm.is() || !xFormProps.is())
548 return xResultForm;
550 OSL_ENSURE(_rxDatabase.is(), "FmFormPageImpl::findFormForDataSource: invalid data source!");
551 OUString sLookupName; // the name of the data source we're looking for
552 OUString sFormDataSourceName; // the name of the data source the current connection in the form is based on
555 Reference< XPropertySet > xDSProps(_rxDatabase, UNO_QUERY);
556 if (xDSProps.is())
557 xDSProps->getPropertyValue(FM_PROP_NAME) >>= sLookupName;
559 xFormProps->getPropertyValue(FM_PROP_DATASOURCE) >>= sFormDataSourceName;
560 // if there's no DataSourceName set at the form, check whether we can deduce one from its
561 // ActiveConnection
562 if (sFormDataSourceName.isEmpty())
564 Reference< XConnection > xFormConnection;
565 xFormProps->getPropertyValue( FM_PROP_ACTIVE_CONNECTION ) >>= xFormConnection;
566 if ( !xFormConnection.is() )
567 isEmbeddedInDatabase( xFormProps, xFormConnection );
568 if (xFormConnection.is())
570 Reference< XChild > xConnAsChild(xFormConnection, UNO_QUERY);
571 if (xConnAsChild.is())
573 Reference< XDataSource > xFormDS(xConnAsChild->getParent(), UNO_QUERY);
574 if (xFormDS.is())
576 xDSProps.set(xFormDS, css::uno::UNO_QUERY);
577 if (xDSProps.is())
578 xDSProps->getPropertyValue(FM_PROP_NAME) >>= sFormDataSourceName;
584 catch(const Exception&)
586 OSL_FAIL("FmFormPageImpl::findFormForDataSource: caught an exception!");
589 if (sLookupName == sFormDataSourceName)
591 // now check whether CursorSource and type match
592 OUString aCursorSource = ::comphelper::getString(xFormProps->getPropertyValue(FM_PROP_COMMAND));
593 sal_Int32 nType = ::comphelper::getINT32(xFormProps->getPropertyValue(FM_PROP_COMMANDTYPE));
594 if (aCursorSource.isEmpty() || ((nType == nCommandType) && (aCursorSource == _rCursorSource))) // found the form
596 xResultForm = rForm;
597 // if no data source is set yet, it is done here
598 if (aCursorSource.isEmpty())
600 xFormProps->setPropertyValue(FM_PROP_COMMAND, makeAny(_rCursorSource));
601 xFormProps->setPropertyValue(FM_PROP_COMMANDTYPE, makeAny(nCommandType));
606 // as long as xResultForm is NULL, search the child forms of rForm
607 Reference< XIndexAccess > xComponents(rForm, UNO_QUERY);
608 sal_Int32 nCount = xComponents->getCount();
609 for (sal_Int32 i = 0; !xResultForm.is() && i < nCount; ++i)
611 Reference< css::form::XForm > xSearchForm;
612 xComponents->getByIndex(i) >>= xSearchForm;
613 // continue searching in the sub form
614 if (xSearchForm.is())
615 xResultForm = findFormForDataSource( xSearchForm, _rxDatabase, _rCursorSource, nCommandType );
617 return xResultForm;
621 OUString FmFormPageImpl::setUniqueName(const Reference< XFormComponent > & xFormComponent, const Reference< XForm > & xControls)
623 #if OSL_DEBUG_LEVEL > 0
626 OSL_ENSURE( !xFormComponent->getParent().is(), "FmFormPageImpl::setUniqueName: to be called before insertion!" );
628 catch( const Exception& )
630 DBG_UNHANDLED_EXCEPTION("svx");
632 #endif
633 OUString sName;
634 Reference< css::beans::XPropertySet > xSet(xFormComponent, UNO_QUERY);
635 if (xSet.is())
637 sName = ::comphelper::getString( xSet->getPropertyValue( FM_PROP_NAME ) );
638 Reference< css::container::XNameAccess > xNameAcc(xControls, UNO_QUERY);
640 if (sName.isEmpty() || xNameAcc->hasByName(sName))
642 // set a default name via the ClassId
643 sal_Int16 nClassId( FormComponentType::CONTROL );
644 xSet->getPropertyValue( FM_PROP_CLASSID ) >>= nClassId;
646 OUString sDefaultName = FormControlFactory::getDefaultUniqueName_ByComponentType(
647 Reference< XNameAccess >( xControls, UNO_QUERY ), xSet );
649 // do not overwrite the name of radio buttons that have it!
650 if (sName.isEmpty() || nClassId != css::form::FormComponentType::RADIOBUTTON)
652 xSet->setPropertyValue(FM_PROP_NAME, makeAny(sDefaultName));
655 sName = sDefaultName;
658 return sName;
662 void FmFormPageImpl::formModelAssigned( const FmFormObj& _object )
664 Reference< XMap > xControlShapeMap( m_aControlShapeMap.get(), UNO_QUERY );
665 if ( !xControlShapeMap.is() )
666 // our map does not exist -> not interested in this event
667 return;
671 lcl_removeFormObject_throw( _object, xControlShapeMap );
672 lcl_insertFormObject_throw( _object, xControlShapeMap );
674 catch( const Exception& )
676 DBG_UNHANDLED_EXCEPTION("svx");
681 void FmFormPageImpl::formObjectInserted( const FmFormObj& _object )
683 Reference< XMap > xControlShapeMap( m_aControlShapeMap.get(), UNO_QUERY );
684 if ( !xControlShapeMap.is() )
685 // our map does not exist -> not interested in this event
686 return;
690 lcl_insertFormObject_throw( _object, xControlShapeMap );
692 catch( const Exception& )
694 DBG_UNHANDLED_EXCEPTION("svx");
699 void FmFormPageImpl::formObjectRemoved( const FmFormObj& _object )
701 Reference< XMap > xControlShapeMap( m_aControlShapeMap.get(), UNO_QUERY );
702 if ( !xControlShapeMap.is() )
703 // our map does not exist -> not interested in this event
704 return;
708 lcl_removeFormObject_throw( _object, xControlShapeMap );
710 catch( const Exception& )
712 DBG_UNHANDLED_EXCEPTION("svx");
716 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */