#97140# HACK: simulate a loaded call when inserting a column into an already loaded form
This commit is contained in:
parent
40b1332f6a
commit
1a31e5bbd3
1 changed files with 27 additions and 3 deletions
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: datman.cxx,v $
|
||||
*
|
||||
* $Revision: 1.24 $
|
||||
* $Revision: 1.25 $
|
||||
*
|
||||
* last change: $Author: fs $ $Date: 2001-10-23 11:51:16 $
|
||||
* last change: $Author: fs $ $Date: 2002-01-30 17:14:44 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -1567,7 +1567,31 @@ Reference< awt::XControlModel > BibDataManager::loadControlModel(
|
|||
Reference< XFormComponent > aFormComp(xModel,UNO_QUERY );
|
||||
|
||||
Reference< XNameContainer > xNameCont( m_xForm, UNO_QUERY );
|
||||
xNameCont->insertByName(aName, Any(&xModel, ::getCppuType((Reference<XFormComponent>*)0)));
|
||||
xNameCont->insertByName(aName, makeAny( aFormComp ) );
|
||||
|
||||
// now if the form where we inserted the new model is already loaded, notify the model of this
|
||||
// Note that this implementation below is a HACK as it relies on the fact that the model adds itself
|
||||
// as load listener to it's parent, which is an implementation detail of the model.
|
||||
//
|
||||
// the better solution would be the following:
|
||||
// in the current scenario, we insert a control model into a form. This results in the control model
|
||||
// adding itself as load listener to the form. Now, the form should realize that it's already loaded
|
||||
// and notify the model (which it knows as XLoadListener only) immediately. This seems to make sense.
|
||||
// (as an anologon to the XStatusListener semantics).
|
||||
//
|
||||
// But this would be way too risky for this last-day fix here.
|
||||
// 97140 - 30.01.2002 - fs@openoffice.org
|
||||
Reference< XLoadable > xLoad( m_xForm, UNO_QUERY );
|
||||
if ( xLoad.is() && xLoad->isLoaded() )
|
||||
{
|
||||
Reference< XLoadListener > xListener( aFormComp, UNO_QUERY );
|
||||
if ( xListener.is() )
|
||||
{
|
||||
EventObject aLoadSource;
|
||||
aLoadSource.Source = xLoad;
|
||||
xListener->loaded( aLoadSource );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception& e )
|
||||
|
|
Loading…
Reference in a new issue