summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Schönheit <fs@openoffice.org>2001-05-18 06:22:41 +0000
committerFrank Schönheit <fs@openoffice.org>2001-05-18 06:22:41 +0000
commit10d78ec7c8c4b27ec0b5cfc0bd09b366efcf41de (patch)
treeb8a7a084237383a7a9452b52f1207f823b478e73
parent033a4d7e7ec8f00c0d5e95ed806f8f1e3b820c66 (diff)
#86558# when inserting a column while the form is already loaded, call the XLoadListener::loaded on the column
-rw-r--r--forms/source/component/Grid.cxx58
-rw-r--r--forms/source/component/Grid.hxx16
2 files changed, 46 insertions, 28 deletions
diff --git a/forms/source/component/Grid.cxx b/forms/source/component/Grid.cxx
index e15c9165e6ff..6fc1db540340 100644
--- a/forms/source/component/Grid.cxx
+++ b/forms/source/component/Grid.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: Grid.cxx,v $
*
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
*
- * last change: $Author: fs $ $Date: 2001-05-14 07:06:59 $
+ * last change: $Author: fs $ $Date: 2001-05-18 07:22:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -237,17 +237,15 @@ Any SAL_CALL OGridControlModel::queryAggregation( const Type& _rType ) throw (Ru
//------------------------------------------------------------------------------
void SAL_CALL OGridControlModel::setParent(const InterfaceRef& Parent) throw(NoSupportException, RuntimeException)
{
- Reference<XForm> xForm(m_xParent, UNO_QUERY);
- Reference<XLoadable> xLoadable(xForm, UNO_QUERY);
- if (xLoadable.is())
- xLoadable->removeLoadListener(this);
+ if (m_xParentFormLoadable.is())
+ m_xParentFormLoadable->removeLoadListener(this);
OControlModel::setParent(Parent);
- xForm = Reference<XForm> (m_xParent, UNO_QUERY);
- xLoadable = Reference<XLoadable> (xForm, UNO_QUERY);
- if (xLoadable.is())
- xLoadable->addLoadListener(this);
+ Reference< XForm > xForm(m_xParent, UNO_QUERY);
+ m_xParentFormLoadable = Reference< XLoadable > (xForm, UNO_QUERY);
+ if (m_xParentFormLoadable.is())
+ m_xParentFormLoadable->addLoadListener(this);
}
//------------------------------------------------------------------------------
Sequence< Type > SAL_CALL OGridControlModel::getTypes( ) throw(RuntimeException)
@@ -1036,11 +1034,26 @@ OGridColumn* OGridControlModel::getColumnImplementation(const InterfaceRef& _rxI
}
//------------------------------------------------------------------------------
-void OGridControlModel::implRemoved(const InterfaceRef& _rxObject)
+void OGridControlModel::gotColumn(const Reference< XInterface >& _rxColumn)
{
- OInterfaceContainer::implRemoved(_rxObject);
+ // if our form is already loaded, tell the column
+ // 18.05.2001 - 86558 - frank.schoenheit@germany.sun.com
+ if (m_xParentFormLoadable.is() && m_xParentFormLoadable->isLoaded())
+ {
+ Reference< XLoadListener > xColumnLoadListener(_rxColumn, UNO_QUERY);
+ if (xColumnLoadListener.is())
+ { // it's kind of a fake ...
+ EventObject aFakedLoadEvent;
+ aFakedLoadEvent.Source = m_xParentFormLoadable;
+ xColumnLoadListener->loaded(aFakedLoadEvent);
+ }
+ }
+}
- if (Reference<XInterface>(m_xSelection, UNO_QUERY).get() == Reference<XInterface>(_rxObject, UNO_QUERY).get())
+//------------------------------------------------------------------------------
+void OGridControlModel::lostColumn(const Reference< XInterface >& _rxColumn)
+{
+ if (Reference<XInterface>(m_xSelection, UNO_QUERY).get() == Reference<XInterface>(_rxColumn, UNO_QUERY).get())
{ // the currently selected element was replaced
m_xSelection.clear();
EventObject aEvt(static_cast<XWeak*>(this));
@@ -1049,22 +1062,25 @@ void OGridControlModel::implRemoved(const InterfaceRef& _rxObject)
}
//------------------------------------------------------------------------------
+void OGridControlModel::implRemoved(const InterfaceRef& _rxObject)
+{
+ OInterfaceContainer::implRemoved(_rxObject);
+ lostColumn(_rxObject);
+}
+
+//------------------------------------------------------------------------------
void OGridControlModel::implInserted(const InterfaceRef& _rxObject)
{
OInterfaceContainer::implInserted(_rxObject);
+ gotColumn(_rxObject);
}
//------------------------------------------------------------------------------
void OGridControlModel::implReplaced(const InterfaceRef& _rxReplacedObject, const InterfaceRef& _rxNewObject)
{
OInterfaceContainer::implReplaced(_rxReplacedObject, _rxNewObject);
-
- if (Reference<XInterface>(m_xSelection, UNO_QUERY).get() == Reference<XInterface>(_rxReplacedObject, UNO_QUERY).get())
- { // the currently selected element was replaced
- m_xSelection.clear();
- EventObject aEvt(static_cast<XWeak*>(this));
- NOTIFY_LISTENERS(m_aSelectListeners, XSelectionChangeListener, selectionChanged, aEvt);
- }
+ lostColumn(_rxReplacedObject);
+ gotColumn(_rxNewObject);
}
//------------------------------------------------------------------------------
@@ -1072,9 +1088,7 @@ void OGridControlModel::insert(sal_Int32 _nIndex, const InterfaceRef& xElement,
{
OGridColumn* pCol = getColumnImplementation(xElement);
if (!pCol)
- {
throw IllegalArgumentException();
- }
OInterfaceContainer::insert(_nIndex, xElement, bEvents);
}
diff --git a/forms/source/component/Grid.hxx b/forms/source/component/Grid.hxx
index 45459651bd88..23f89b0e3b12 100644
--- a/forms/source/component/Grid.hxx
+++ b/forms/source/component/Grid.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: Grid.hxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: fs $ $Date: 2001-04-02 10:28:06 $
+ * last change: $Author: fs $ $Date: 2001-05-18 07:22:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -63,15 +63,15 @@
#include "FormComponent.hxx"
#endif
-#ifndef _COM_SUN_STAR_FORM_XLOADLISTENER_HPP_
-#include <com/sun/star/form/XLoadListener.hpp>
-#endif
#ifndef _COM_SUN_STAR_FORM_XGRIDCOLUMNFACTORY_HPP_
#include <com/sun/star/form/XGridColumnFactory.hpp>
#endif
#ifndef _COM_SUN_STAR_VIEW_XSELECTIONSUPPLIER_HPP_
#include <com/sun/star/view/XSelectionSupplier.hpp>
#endif
+#ifndef _COM_SUN_STAR_FORM_XLOADABLE_HPP_
+#include <com/sun/star/form/XLoadable.hpp>
+#endif
#ifndef _LINK_HXX
#include <tools/link.hxx>
@@ -126,7 +126,8 @@ class OGridControlModel :public OControlModel
::rtl::OUString m_sHelpText;
// [properties]
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> m_xSelection;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xSelection;
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable > m_xParentFormLoadable;
sal_uInt32 m_nFontEvent;
// [properties]
@@ -229,6 +230,9 @@ protected:
virtual void implInserted(const InterfaceRef& _rxObject);
virtual void implReplaced(const InterfaceRef& _rxReplacedObject, const InterfaceRef& _rxNewObject);
+ void gotColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxColumn);
+ void lostColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxColumn);
+
private:
DECL_LINK( OnFontChanged, void* );
};