summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmloff/source/forms/callbacks.hxx33
-rw-r--r--xmloff/source/forms/elementexport.cxx208
-rw-r--r--xmloff/source/forms/elementexport.hxx108
-rw-r--r--xmloff/source/forms/elementimport.cxx97
-rw-r--r--xmloff/source/forms/elementimport.hxx68
-rw-r--r--xmloff/source/forms/elementimport_impl.hxx31
-rw-r--r--xmloff/source/forms/layerexport.cxx52
-rw-r--r--xmloff/source/forms/layerexport.hxx23
-rw-r--r--xmloff/source/forms/layerimport.cxx28
-rw-r--r--xmloff/source/forms/layerimport.hxx12
-rw-r--r--xmloff/source/forms/propertyexport.hxx12
-rw-r--r--xmloff/source/forms/strings.hxx14
12 files changed, 492 insertions, 194 deletions
diff --git a/xmloff/source/forms/callbacks.hxx b/xmloff/source/forms/callbacks.hxx
index b6cfa0e42670..1480a1b4566c 100644
--- a/xmloff/source/forms/callbacks.hxx
+++ b/xmloff/source/forms/callbacks.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: callbacks.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: fs $ $Date: 2000-12-18 15:14:35 $
+ * last change: $Author: fs $ $Date: 2001-01-02 15:58:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -71,6 +71,9 @@
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
#include <com/sun/star/beans/XPropertySet.hpp>
#endif
+#ifndef _COM_SUN_STAR_SCRIPT_SCRIPTEVENTDESCRIPTOR_HPP_
+#include <com/sun/star/script/ScriptEventDescriptor.hpp>
+#endif
#ifndef _VOS_REF_HXX_
#include <vos/ref.hxx>
#endif
@@ -145,6 +148,29 @@ namespace xmloff
virtual const SvXMLStyleContext* getStyleElement(const ::rtl::OUString& _rStyleName) const = 0;
};
+ //=====================================================================
+ //= IEventAttacherManager
+ //=====================================================================
+ class IEventAttacherManager
+ {
+ public:
+ virtual void registerEvents(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxElement,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rEvents
+ ) = 0;
+ };
+
+ //=====================================================================
+ //= IEventAttacher
+ //=====================================================================
+ class IEventAttacher
+ {
+ public:
+ virtual void registerEvents(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rEvents
+ ) = 0;
+ };
+
//.........................................................................
} // namespace xmloff
//.........................................................................
@@ -154,6 +180,9 @@ namespace xmloff
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
+ * Revision 1.4 2000/12/18 15:14:35 fs
+ * some changes ... now exporting/importing styles
+ *
* Revision 1.3 2000/12/13 10:35:50 fs
* included XPropertySet.hpp
*
diff --git a/xmloff/source/forms/elementexport.cxx b/xmloff/source/forms/elementexport.cxx
index 2818ae477ce0..729b63612d3f 100644
--- a/xmloff/source/forms/elementexport.cxx
+++ b/xmloff/source/forms/elementexport.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: elementexport.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: fs $ $Date: 2000-12-18 15:14:35 $
+ * last change: $Author: fs $ $Date: 2001-01-02 15:58:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -82,6 +82,9 @@
#ifndef _CPPUHELPER_EXTRACT_HXX_
#include <cppuhelper/extract.hxx>
#endif
+#ifndef _XMLOFF_FORMS_EVENTEXPORT_HXX_
+#include "eventexport.hxx"
+#endif
#ifndef _COM_SUN_STAR_FORM_FORMCOMPONENTTYPE_HPP_
#include <com/sun/star/form/FormComponentType.hpp>
#endif
@@ -115,6 +118,9 @@
#ifndef _SV_WINTYPES_HXX
#include <vcl/wintypes.hxx> // for check states
#endif
+#ifndef _XMLOFF_XMLEVENTEXPORT_HXX
+#include "XMLEventExport.hxx"
+#endif
//.........................................................................
@@ -129,52 +135,114 @@ namespace xmloff
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
+ using namespace ::com::sun::star::script;
//=====================================================================
- //= OControlExport
+ //= OElementExport
//=====================================================================
- //---------------------------------------------------------------------
- OControlExport::OControlExport(IFormsExportContext& _rContext, const Reference< XPropertySet >& _rxControl,
- const ::rtl::OUString& _rControlId, const ::rtl::OUString& _rReferringControls)
- :OPropertyExport(_rContext, _rxControl)
- ,m_sControlId(_rControlId)
- ,m_sReferringControls(_rReferringControls)
- ,m_nIncludeCommon(0)
- ,m_nIncludeDatabase(0)
- ,m_nIncludeSpecial(0)
- ,m_nIncludeEvents(0)
- ,m_nClassId(FormComponentType::CONTROL)
+ OElementExport::OElementExport(IFormsExportContext& _rContext, const Reference< XPropertySet >& _rxProps,
+ const Sequence< ScriptEventDescriptor >& _rEvents)
+ :OPropertyExport(_rContext, _rxProps)
+ ,m_aEvents(_rEvents)
,m_pXMLElement(NULL)
{
- OSL_ENSURE(m_xProps.is(), "OControlExport::OControlExport: invalid arguments!");
}
//---------------------------------------------------------------------
- void OControlExport::doExport()
+ OElementExport::~OElementExport()
{
- // collect some general information about the control
+ implEndElement();
+ }
+
+ //---------------------------------------------------------------------
+ void OElementExport::doExport()
+ {
+ // collect some general information about the element
examine();
- // start the element
- startExportElement();
+ // first add the attributes necessary for the element
+ m_rContext.getGlobalContext().ClearAttrList();
+
+ // add the attributes
+ exportAttributes();
+
+ // start the XML element
+ implStartElement(getXMLElementName());
// the sub elements (mostly control type dependent)
exportSubTags();
+
+ implEndElement();
}
//---------------------------------------------------------------------
- OControlExport::~OControlExport()
+ void OElementExport::examine()
+ {
+ // nothing to do here
+ }
+
+ //---------------------------------------------------------------------
+ void OElementExport::exportAttributes()
+ {
+ // nothing to do here
+ }
+
+ //---------------------------------------------------------------------
+ void OElementExport::exportSubTags()
+ {
+ // the properties which where not exported 'til now
+ exportRemainingProperties();
+
+ // the script:events sub tags
+ exportEvents();
+ }
+
+ //---------------------------------------------------------------------
+ void OElementExport::implStartElement(const sal_Char* _pName)
+ {
+ m_pXMLElement = new SvXMLElementExport(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, _pName, sal_True, sal_True);
+ }
+
+ //---------------------------------------------------------------------
+ void OElementExport::implEndElement()
{
delete m_pXMLElement;
- // if we already started the element, this will end it, if not, nothing will happen
+ m_pXMLElement = NULL;
}
//---------------------------------------------------------------------
- void OControlExport::startExportElement()
+ void OElementExport::exportEvents()
{
- // first add the attributes necessary for the element
- m_rContext.getGlobalContext().ClearAttrList();
+ if (!m_aEvents.getLength())
+ // nothing to do
+ return;
+
+ Reference< XNameReplace > xWrapper = new OEventDescriptorMapper(m_aEvents);
+ m_rContext.getGlobalContext().GetEventExport().Export(xWrapper);
+ }
+ //=====================================================================
+ //= OControlExport
+ //=====================================================================
+ //---------------------------------------------------------------------
+ OControlExport::OControlExport(IFormsExportContext& _rContext, const Reference< XPropertySet >& _rxControl,
+ const ::rtl::OUString& _rControlId, const ::rtl::OUString& _rReferringControls,
+ const Sequence< ScriptEventDescriptor >& _rEvents)
+ :OElementExport(_rContext, _rxControl, _rEvents)
+ ,m_sControlId(_rControlId)
+ ,m_sReferringControls(_rReferringControls)
+ ,m_nIncludeCommon(0)
+ ,m_nIncludeDatabase(0)
+ ,m_nIncludeSpecial(0)
+ ,m_nIncludeEvents(0)
+ ,m_nClassId(FormComponentType::CONTROL)
+ {
+ OSL_ENSURE(m_xProps.is(), "OControlExport::OControlExport: invalid arguments!");
+ }
+
+ //---------------------------------------------------------------------
+ void OControlExport::exportAttributes()
+ {
// common control attributes
exportCommonControlAttributes();
@@ -188,8 +256,6 @@ namespace xmloff
implExportStyleReference();
// TODO: add the event attributes
-
- m_pXMLElement = new SvXMLElementExport(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, getElementName(m_eType), sal_True, sal_True);
}
//---------------------------------------------------------------------
@@ -209,10 +275,8 @@ namespace xmloff
// know anything about this, we need to prevent that it tries to export this property
exportedProperty(PROPERTY_CONTROLLABEL);
- // the properties which where not exported 'til now
- exportRemainingProperties();
-
- // TODO: the script:events sub tags
+ // let the base class export the remaining properties and the events
+ OElementExport::exportSubTags();
// special sub tags for some controls
switch (m_eType)
@@ -814,6 +878,12 @@ namespace xmloff
}
//---------------------------------------------------------------------
+ const sal_Char* OControlExport::getXMLElementName() const
+ {
+ return getElementName(m_eType);
+ }
+
+ //---------------------------------------------------------------------
void OControlExport::examine()
{
// get the class id to decide which kind of element we need in the XML stream
@@ -1056,20 +1126,19 @@ namespace xmloff
//= OColumnExport
//=====================================================================
//---------------------------------------------------------------------
- OColumnExport::OColumnExport(IFormsExportContext& _rContext, const Reference< XPropertySet >& _rxControl)
- :OControlExport(_rContext, _rxControl, ::rtl::OUString(), ::rtl::OUString())
+ OColumnExport::OColumnExport(IFormsExportContext& _rContext, const Reference< XPropertySet >& _rxControl,
+ const Sequence< ScriptEventDescriptor >& _rEvents)
+ :OControlExport(_rContext, _rxControl, ::rtl::OUString(), ::rtl::OUString(), _rEvents)
,m_pColumnXMLElement(NULL)
+ ,m_bExamined(sal_False)
{
}
//---------------------------------------------------------------------
OColumnExport::~OColumnExport()
{
- // delete m_pXMLElement before m_pColumnXMLElement !!
- // TODO: this makes me seriously thinking about why OColumnExport is derived from OControlExport, and
- // not the other way round
- delete m_pXMLElement;
- m_pXMLElement = NULL;
+ // end the base class element before our own one
+ implEndElement();
delete m_pColumnXMLElement;
}
@@ -1077,25 +1146,31 @@ namespace xmloff
//---------------------------------------------------------------------
void OColumnExport::examine()
{
- OControlExport::examine();
+ if (!m_bExamined)
+ {
+ OControlExport::examine();
+
+ // grid columns miss some properties of the controls they're representing
+ m_nIncludeCommon &= ~(CCA_SERVICE_NAME | CCA_CONTROL_ID | CCA_FOR | CCA_PRINTABLE | CCA_TAB_INDEX | CCA_TAB_STOP | CCA_LABEL | CCA_NAME);
+ m_nIncludeSpecial &= ~(SCA_ECHO_CHAR | SCA_AUTOMATIC_COMPLETION | SCA_MULTIPLE | SCA_MULTI_LINE | SCA_IS_TRISTATE);
- // grid columns miss some properties of the controls they're representing
- m_nIncludeCommon &= ~(CCA_SERVICE_NAME | CCA_CONTROL_ID | CCA_FOR | CCA_PRINTABLE | CCA_TAB_INDEX | CCA_TAB_STOP | CCA_LABEL | CCA_NAME);
- m_nIncludeSpecial &= ~(SCA_ECHO_CHAR | SCA_AUTOMATIC_COMPLETION | SCA_MULTIPLE | SCA_MULTI_LINE | SCA_IS_TRISTATE);
+ if (FormComponentType::DATEFIELD != m_nClassId)
+ // except date fields, no column has the DropDown property
+ m_nIncludeCommon &= ~CCA_DROPDOWN;
- if (FormComponentType::DATEFIELD != m_nClassId)
- // except date fields, no column has the DropDown property
- m_nIncludeCommon &= ~CCA_DROPDOWN;
+ m_bExamined = sal_True;
+ }
}
//---------------------------------------------------------------------
- void OColumnExport::startExportElement()
+ void OColumnExport::doExport()
{
// before the base class can start it's element, start an additional one stating that the following is
// a grid column
- // the attributes:
- m_rContext.getGlobalContext().ClearAttrList();
+ // we do the examine here, cause we need the information about the column we're exporting
+ // (though the base class' doExport calls it, again, but we handle this in ::examine ...)
+ examine();
// the attribute "name"
exportStringPropertyAttribute(
@@ -1129,30 +1204,31 @@ namespace xmloff
m_pColumnXMLElement = new SvXMLElementExport(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, "column", sal_True, sal_True);
// let the base class do it's handling
- OControlExport::startExportElement();
+ OControlExport::doExport();
}
//=====================================================================
//= OFormExport
//=====================================================================
//---------------------------------------------------------------------
- OFormExport::OFormExport(IFormsExportContext& _rContext, const Reference< XPropertySet >& _rxForm)
- :OPropertyExport(_rContext, _rxForm)
- ,m_pXMLElement(NULL)
+ OFormExport::OFormExport(IFormsExportContext& _rContext, const Reference< XPropertySet >& _rxForm,
+ const Sequence< ScriptEventDescriptor >& _rEvents)
+ :OElementExport(_rContext, _rxForm, _rEvents)
{
OSL_ENSURE(m_xProps.is(), "OFormExport::OFormExport: invalid arguments!");
+ }
- // add the attributes
- m_rContext.getGlobalContext().ClearAttrList();
- exportAttributes();
-
- // start the form element
- m_pXMLElement = new SvXMLElementExport(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, "form", sal_True, sal_True);
-
- // the properties which where not exported 'til now
- exportRemainingProperties();
+ //---------------------------------------------------------------------
+ const sal_Char* OFormExport::getXMLElementName() const
+ {
+ return "form";
+ }
- // TODO: the remaining scripts
+ //---------------------------------------------------------------------
+ void OFormExport::exportSubTags()
+ {
+ // let the base class export the remaining properties and the events
+ OElementExport::exportSubTags();
// loop through all children
Reference< XIndexAccess > xCollection(m_xProps, UNO_QUERY);
@@ -1163,13 +1239,6 @@ namespace xmloff
}
//---------------------------------------------------------------------
- OFormExport::~OFormExport()
- {
- delete m_pXMLElement;
- // if we already started the element, this will end it, if not, nothing will happen
- }
-
- //---------------------------------------------------------------------
void OFormExport::exportAttributes()
{
sal_Int32 i=0;
@@ -1292,6 +1361,9 @@ namespace xmloff
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
+ * Revision 1.7 2000/12/18 15:14:35 fs
+ * some changes ... now exporting/importing styles
+ *
* Revision 1.6 2000/12/18 13:25:01 mib
* #82036#: new graphic properties
*
diff --git a/xmloff/source/forms/elementexport.hxx b/xmloff/source/forms/elementexport.hxx
index e29544aac72f..4c82ad7c3bed 100644
--- a/xmloff/source/forms/elementexport.hxx
+++ b/xmloff/source/forms/elementexport.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: elementexport.hxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: fs $ $Date: 2000-12-18 15:14:35 $
+ * last change: $Author: fs $ $Date: 2001-01-02 15:58:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -68,6 +68,9 @@
#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_
#include <com/sun/star/container/XIndexAccess.hpp>
#endif
+#ifndef _COM_SUN_STAR_SCRIPT_SCRIPTEVENTDESCRIPTOR_HPP_
+#include <com/sun/star/script/ScriptEventDescriptor.hpp>
+#endif
#ifndef _XMLOFF_FORMS_PROPERTYEXPORT_HXX_
#include "propertyexport.hxx"
#endif
@@ -88,6 +91,46 @@ namespace xmloff
//.........................................................................
//=====================================================================
+ //= OElementExport
+ //=====================================================================
+ class OElementExport : public OPropertyExport
+ {
+ protected:
+ ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >
+ m_aEvents;
+
+ SvXMLElementExport* m_pXMLElement; // XML element doing the concrete startElement etc.
+
+ public:
+ OElementExport(IFormsExportContext& _rContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxProps,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rEvents);
+ ~OElementExport();
+
+ virtual void doExport();
+
+ protected:
+ /// get the name of the XML element
+ virtual const sal_Char* getXMLElementName() const = 0;
+ /// examine the element we're exporting
+ virtual void examine();
+ /// export the attributes
+ virtual void exportAttributes();
+ /// export any sub tags
+ virtual void exportSubTags();
+
+ /** exports the events (as script:events tag)
+ */
+ void exportEvents();
+
+ /// start the XML element
+ void implStartElement(const sal_Char* _pName);
+
+ /// ends the XML element
+ void implEndElement();
+ };
+
+ //=====================================================================
//= OControlExport
//=====================================================================
/** Helper class for handling xml elements representing a form control
@@ -95,7 +138,7 @@ namespace xmloff
class OControlExport
:public OControlElement
,public OValuePropertiesMetaData
- ,public OPropertyExport
+ ,public OElementExport
{
protected:
DECLARE_STL_STDKEY_SET(sal_Int16, Int16Set);
@@ -110,8 +153,6 @@ namespace xmloff
sal_Int32 m_nIncludeSpecial; // special attributes to include
sal_Int32 m_nIncludeEvents; // events to include
- SvXMLElementExport* m_pXMLElement; // XML element doing the concrete startElement etc.
-
public:
/** constructs an object capable of exporting controls
@@ -127,32 +168,19 @@ namespace xmloff
OControlExport(IFormsExportContext& _rContext,
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControl,
const ::rtl::OUString& _rControlId,
- const ::rtl::OUString& _rReferringControls);
-
- /** starts the export.
-
- <p>This is an extra method because we need to call virtual methods here, else we would have placed
- it in the ctor ...<p>
- */
- void doExport();
-
- /** dtor.
-
- <p>Automatically closes the element tag which was opened for the control in the ctor</p>
- */
- ~OControlExport();
+ const ::rtl::OUString& _rReferringControls,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rxEvents);
protected:
+ // get the name of the XML element
+ virtual const sal_Char* getXMLElementName() const;
+
/** examine the control. Some kind of CtorImpl.
*/
virtual void examine();
- /** starts the XML element which represents the control.
-
- <p>The default implementation only creates <member>m_pXMLElement</member> with the parameters
- derived from the results of <method>examine</method>.
- */
- virtual void startExportElement();
+ /// export the attributes
+ virtual void exportAttributes();
/** writes everything which needs to be represented as sub tag
*/
@@ -218,19 +246,22 @@ namespace xmloff
SvXMLElementExport* m_pColumnXMLElement;
// in addition to the element written by the base class, we need another one indicating that we're a
// column
+ sal_Bool m_bExamined;
public:
/** ctor
@see OColumnExport::OColumnExport
*/
OColumnExport(IFormsExportContext& _rContext,
- const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControl);
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControl,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rxEvents);
~OColumnExport();
+ virtual void doExport();
+
protected:
virtual void examine();
- virtual void startExportElement();
};
//=====================================================================
@@ -243,24 +274,20 @@ namespace xmloff
*/
class OFormExport
:public OControlElement
- ,public OPropertyExport
+ ,public OElementExport
{
- protected:
- SvXMLElementExport* m_pXMLElement; // XML element doing the concrete startElement etc.
-
public:
/** constructs an object capable of exporting controls
*/
OFormExport(IFormsExportContext& _rContext,
- const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxForm);
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxForm,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rxEvents
+ );
- /** dtor.
- */
- ~OFormExport();
-
- /** adds form attributes of the form the object represents to the XMLExport
- */
- void exportAttributes();
+ protected:
+ virtual const sal_Char* getXMLElementName() const;
+ virtual void exportSubTags();
+ virtual void exportAttributes();
};
//.........................................................................
@@ -272,6 +299,9 @@ namespace xmloff
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
+ * Revision 1.5 2000/12/18 15:14:35 fs
+ * some changes ... now exporting/importing styles
+ *
* Revision 1.4 2000/12/13 10:38:10 fs
* moved some code to a more central place to reuse it
*
diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx
index 8860c5bb78f5..71ee406a2733 100644
--- a/xmloff/source/forms/elementimport.cxx
+++ b/xmloff/source/forms/elementimport.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: elementimport.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: vg $ $Date: 2000-12-20 14:01:19 $
+ * last change: $Author: fs $ $Date: 2001-01-02 15:58:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -83,6 +83,12 @@
#ifndef _XMLOFF_FORMS_ATTRIBLISTMERGE_HXX_
#include "attriblistmerge.hxx"
#endif
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include "xmlnmspe.hxx"
+#endif
+#ifndef _XMLOFF_FORMS_EVENTIMPORT_HXX_
+#include "eventimport.hxx"
+#endif
#ifndef _COM_SUN_STAR_UTIL_XCLONEABLE_HPP_
#include <com/sun/star/util/XCloneable.hpp>
@@ -99,6 +105,7 @@ namespace xmloff
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::script;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::form;
using namespace ::com::sun::star::xml;
@@ -161,11 +168,12 @@ namespace xmloff
//= OElementImport
//=====================================================================
//---------------------------------------------------------------------
- OElementImport::OElementImport(IFormsImportContext& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ OElementImport::OElementImport(IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
const Reference< XNameContainer >& _rxParentContainer)
:OPropertyImport(_rImport, _nPrefix, _rName)
,m_xParentContainer(_rxParentContainer)
,m_rFormImport(_rImport)
+ ,m_rEventManager(_rEventManager)
{
OSL_ENSURE(m_xParentContainer.is(), "OElementImport::OElementImport: invalid parent container!");
}
@@ -182,6 +190,17 @@ namespace xmloff
}
//---------------------------------------------------------------------
+ SvXMLImportContext* OElementImport::CreateChildContext(sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
+ const Reference< sax::XAttributeList >& _rxAttrList)
+ {
+ static const ::rtl::OUString s_sEventTagName = ::rtl::OUString::createFromAscii("events");
+ if ((s_sEventTagName == _rLocalName) && (XML_NAMESPACE_SCRIPT == _nPrefix))
+ return new OFormEventsImportContext(m_rFormImport.getGlobalContext(), _nPrefix, _rLocalName, *this);
+
+ return OPropertyImport::CreateChildContext(_nPrefix, _rLocalName, _rxAttrList);
+ }
+
+ //---------------------------------------------------------------------
void OElementImport::EndElement()
{
OSL_ENSURE(m_xElement.is(), "OElementImport::EndElement: invalid element created!");
@@ -353,21 +372,28 @@ namespace xmloff
return xReturn;
}
+ //---------------------------------------------------------------------
+ void OElementImport::registerEvents(const Sequence< ScriptEventDescriptor >& _rEvents)
+ {
+ OSL_ENSURE(m_xElement.is(), "OElementImport::registerEvents: no element to register events for!");
+ m_rEventManager.registerEvents(m_xElement, _rEvents);
+ }
+
//=====================================================================
//= OControlImport
//=====================================================================
//---------------------------------------------------------------------
- OControlImport::OControlImport(IFormsImportContext& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ OControlImport::OControlImport(IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
const Reference< XNameContainer >& _rxParentContainer)
- :OElementImport(_rImport, _nPrefix, _rName, _rxParentContainer)
+ :OElementImport(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer)
,m_eElementType(OControlElement::UNKNOWN)
{
}
//---------------------------------------------------------------------
- OControlImport::OControlImport(IFormsImportContext& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ OControlImport::OControlImport(IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
const Reference< XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType)
- :OElementImport(_rImport, _nPrefix, _rName, _rxParentContainer)
+ :OElementImport(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer)
,m_eElementType(_eType)
{
}
@@ -535,10 +561,10 @@ namespace xmloff
//=====================================================================
//---------------------------------------------------------------------
OReferredControlImport::OReferredControlImport(
- IFormsImportContext& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
const Reference< XNameContainer >& _rxParentContainer,
OControlElement::ElementType _eType)
- :OControlImport(_rImport, _nPrefix, _rName, _rxParentContainer)
+ :OControlImport(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer)
{
}
@@ -567,9 +593,9 @@ namespace xmloff
//= OPasswordImport
//=====================================================================
//---------------------------------------------------------------------
- OPasswordImport::OPasswordImport(IFormsImportContext& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ OPasswordImport::OPasswordImport(IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
const Reference< XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType)
- :OControlImport(_rImport, _nPrefix, _rName, _rxParentContainer, _eType)
+ :OControlImport(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer, _eType)
{
}
@@ -598,10 +624,10 @@ namespace xmloff
//= OListAndComboImport
//=====================================================================
//---------------------------------------------------------------------
- OListAndComboImport::OListAndComboImport(IFormsImportContext& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ OListAndComboImport::OListAndComboImport(IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
const Reference< XNameContainer >& _rxParentContainer,
OControlElement::ElementType _eType)
- :OControlImport(_rImport, _nPrefix, _rName, _rxParentContainer, _eType)
+ :OControlImport(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer, _eType)
{
}
@@ -630,10 +656,7 @@ namespace xmloff
// the string item list
PropertyValue aItemList;
aItemList.Name = PROPERTY_STRING_ITEM_LIST;
- if (OControlElement::LISTBOX == m_eElementType)
- aItemList.Value <<= m_aListSource;
- else
- aItemList.Value <<= m_aListSource.getLength() ? m_aListSource[0] : ::rtl::OUString();
+ aItemList.Value <<= m_aListSource;
implPushBackPropertyValue(aItemList);
if (OControlElement::LISTBOX == m_eElementType)
@@ -770,11 +793,12 @@ namespace xmloff
//= OColumnWrapperImport
//=====================================================================
//---------------------------------------------------------------------
- OColumnWrapperImport::OColumnWrapperImport(IFormsImportContext& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ OColumnWrapperImport::OColumnWrapperImport(IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
const Reference< XNameContainer >& _rxParentContainer)
:SvXMLImportContext(_rImport.getGlobalContext(), _nPrefix, _rName)
,m_rFormImport(_rImport)
,m_xParentContainer(_rxParentContainer)
+ ,m_rEventManager(_rEventManager)
{
}
@@ -796,11 +820,11 @@ namespace xmloff
case OControlElement::COMBOBOX:
case OControlElement::LISTBOX:
OSL_ENSURE(m_xOwnAttributes.is(), "OColumnWrapperImport::CreateChildContext: had no form:column element!");
- return new OColumnImport<OListAndComboImport>(m_rFormImport, _nPrefix, _rLocalName, m_xParentContainer, eType, m_xOwnAttributes);
+ return new OColumnImport<OListAndComboImport>(m_rFormImport, m_rEventManager, _nPrefix, _rLocalName, m_xParentContainer, eType, m_xOwnAttributes);
default:
OSL_ENSURE(m_xOwnAttributes.is(), "OColumnWrapperImport::CreateChildContext: had no form:column element!");
- return new OColumnImport<OControlImport>(m_rFormImport, _nPrefix, _rLocalName, m_xParentContainer, eType, m_xOwnAttributes);
+ return new OColumnImport<OControlImport>(m_rFormImport, m_rEventManager, _nPrefix, _rLocalName, m_xParentContainer, eType, m_xOwnAttributes);
}
}
@@ -824,10 +848,10 @@ namespace xmloff
//= OGridImport
//=====================================================================
//---------------------------------------------------------------------
- OGridImport::OGridImport(IFormsImportContext& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ OGridImport::OGridImport(IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
const Reference< XNameContainer >& _rxParentContainer,
OControlElement::ElementType _eType)
- :OGridImport_Base(_rImport, _nPrefix, _rName, _rxParentContainer)
+ :OGridImport_Base(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer)
{
setElementType(_eType);
}
@@ -840,8 +864,7 @@ namespace xmloff
{
case OControlElement::COLUMN:
// this is the wrapper element.
- return new OColumnWrapperImport(m_rFormImport, _nPrefix, _rLocalName, m_xMeAsContainer);
- break;
+ return new OColumnWrapperImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer);
default:
OSL_ENSURE(sal_False, "OGridImport::implCreateControlChild: invalid sub element!");
// below a form:grid element, the only allowed "control type" is COLUMN
@@ -855,10 +878,21 @@ namespace xmloff
//= OFormImport
//=====================================================================
//---------------------------------------------------------------------
- OFormImport::OFormImport(IFormsImportContext& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ OFormImport::OFormImport(IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
const Reference< XNameContainer >& _rxParentContainer)
- :OFormImport_Base(_rImport, _nPrefix, _rName, _rxParentContainer)
+ :OFormImport_Base(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer)
+ {
+ }
+
+ //---------------------------------------------------------------------
+ SvXMLImportContext* OFormImport::CreateChildContext(sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
+ const Reference< sax::XAttributeList >& _rxAttrList)
{
+ static const ::rtl::OUString s_sFormElementName = ::rtl::OUString::createFromAscii("form");
+ if (s_sFormElementName.equals(_rLocalName))
+ return new OFormImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer);
+
+ return OFormImport_Base::CreateChildContext(_nPrefix, _rLocalName, _rxAttrList);
}
//---------------------------------------------------------------------
@@ -869,17 +903,17 @@ namespace xmloff
{
case OControlElement::COMBOBOX:
case OControlElement::LISTBOX:
- return new OListAndComboImport(m_rFormImport, _nPrefix, _rLocalName, m_xMeAsContainer, _eType);
+ return new OListAndComboImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType);
case OControlElement::FRAME:
case OControlElement::FIXED_TEXT:
- return new OReferredControlImport(m_rFormImport, _nPrefix, _rLocalName, m_xMeAsContainer, _eType);
+ return new OReferredControlImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType);
case OControlElement::GRID:
- return new OGridImport(m_rFormImport, _nPrefix, _rLocalName, m_xMeAsContainer, _eType);
+ return new OGridImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType);
default:
- return new OControlImport(m_rFormImport, _nPrefix, _rLocalName, m_xMeAsContainer, _eType);
+ return new OControlImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType);
}
}
@@ -969,6 +1003,9 @@ namespace xmloff
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
+ * Revision 1.5 2000/12/20 14:01:19 vg
+ * #65293# type (DEBUG instead of _DEBUG)
+ *
* Revision 1.4 2000/12/18 15:14:35 fs
* some changes ... now exporting/importing styles
*
diff --git a/xmloff/source/forms/elementimport.hxx b/xmloff/source/forms/elementimport.hxx
index dbbcd1893876..38e87edd4e3c 100644
--- a/xmloff/source/forms/elementimport.hxx
+++ b/xmloff/source/forms/elementimport.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: elementimport.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: fs $ $Date: 2000-12-18 15:14:35 $
+ * last change: $Author: fs $ $Date: 2001-01-02 15:58:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -80,9 +80,15 @@
#ifndef _COM_SUN_STAR_FORM_XGRIDCOLUMNFACTORY_HPP_
#include <com/sun/star/form/XGridColumnFactory.hpp>
#endif
+#ifndef _COM_SUN_STAR_SCRIPT_XEVENTATTACHERMANAGER_HPP_
+#include <com/sun/star/script/XEventAttacherManager.hpp>
+#endif
#ifndef _COMPHELPER_STLTYPES_HXX_
#include <comphelper/stl_types.hxx>
#endif
+#ifndef _XMLOFF_FORMS_EVENTIMPORT_HXX_
+#include "eventimport.hxx"
+#endif
//.........................................................................
namespace xmloff
@@ -120,11 +126,13 @@ namespace xmloff
class OElementImport
:public OPropertyImport
,public OAttributeMetaData
+ ,public IEventAttacher
{
protected:
::rtl::OUString m_sServiceName; // the service name as extracted from the service-name attribute
::rtl::OUString m_sName; // the name of the object (redundant, already contained in the base class' array)
IFormsImportContext& m_rFormImport; // the form import context
+ IEventAttacherManager& m_rEventManager; // the event attacher manager
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
m_xParentContainer;
@@ -137,6 +145,8 @@ namespace xmloff
/** ctor
@param _rImport
the importer
+ @param _rEventManager
+ the event attacher manager for the control beeing imported
@param _nPrefix
the namespace prefix
@param _rName
@@ -147,7 +157,8 @@ namespace xmloff
the container in which the new element should be inserted
*/
OElementImport(
- IFormsImportContext& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager,
+ sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer
);
@@ -155,6 +166,9 @@ namespace xmloff
// SvXMLImportContext overridables
virtual void StartElement(
const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
virtual void EndElement();
// OPropertyImport overridables
@@ -162,6 +176,11 @@ namespace xmloff
const ::rtl::OUString& _rLocalName,
const ::rtl::OUString& _rValue);
+ // IEventAttacher
+ virtual void registerEvents(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rEvents
+ );
+
/** create the (uninitialized) element which is to represent the read data
<p>The default implementation uses <member>m_xORB</member> to create a object with <member>m_sServiceName</member>.
@@ -184,7 +203,6 @@ namespace xmloff
{
protected:
::rtl::OUString m_sControlId;
- IControlIdMap* m_pIdCollector;
OControlElement::ElementType m_eElementType;
PropertyValueArray m_aValueProperties;
@@ -194,12 +212,14 @@ namespace xmloff
protected:
// for use by derived classes only
OControlImport(
- IFormsImportContext& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager,
+ sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer);
public:
OControlImport(
- IFormsImportContext& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager,
+ sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
OControlElement::ElementType _eType
);
@@ -233,7 +253,7 @@ namespace xmloff
public:
OReferredControlImport(
- IFormsImportContext& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
OControlElement::ElementType _eType
);
@@ -255,7 +275,7 @@ namespace xmloff
{
public:
OPasswordImport(
- IFormsImportContext& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
OControlElement::ElementType _eType
);
@@ -290,7 +310,7 @@ namespace xmloff
public:
OListAndComboImport(
- IFormsImportContext& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
OControlElement::ElementType _eType
);
@@ -356,15 +376,18 @@ namespace xmloff
//=====================================================================
// BASE must be a derivee of OElementImport
template <class BASE>
- class OContainerImport : public BASE
+ class OContainerImport
+ :public BASE
+ ,public ODefaultEventAttacherManager
{
protected:
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
m_xMeAsContainer;
+
protected:
- OContainerImport(IFormsImportContext& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ OContainerImport(IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer)
- :BASE(_rImport, _nPrefix, _rName, _rxParentContainer)
+ :BASE(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer)
{
}
@@ -372,6 +395,7 @@ namespace xmloff
virtual SvXMLImportContext* CreateChildContext(
sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
+ virtual void EndElement();
protected:
// OElementImport overridables
@@ -405,7 +429,7 @@ namespace xmloff
m_xOuterAttributes;
public:
- OColumnImport(IFormsImportContext& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ OColumnImport(IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
OControlElement::ElementType _eType,
const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxOuterAttribs);
@@ -433,9 +457,10 @@ namespace xmloff
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
m_xParentContainer;
IFormsImportContext& m_rFormImport;
+ IEventAttacherManager& m_rEventManager;
public:
- OColumnWrapperImport(IFormsImportContext& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ OColumnWrapperImport(IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer);
// SvXMLImportContext overridables
@@ -456,7 +481,7 @@ namespace xmloff
{
public:
OGridImport(
- IFormsImportContext& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
OControlElement::ElementType _eType);
@@ -475,16 +500,18 @@ namespace xmloff
*/
class OFormImport : public OFormImport_Base
{
- protected:
- IControlIdMap* m_pIdCollector;
-
public:
OFormImport(
- IFormsImportContext& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+ IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer
);
protected:
+ // SvXMLImportContext overridables
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList);
+
// OContainerImport overridables
virtual SvXMLImportContext* implCreateControlChild(
sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
@@ -512,6 +539,9 @@ namespace xmloff
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
+ * Revision 1.4 2000/12/18 15:14:35 fs
+ * some changes ... now exporting/importing styles
+ *
* Revision 1.3 2000/12/13 10:40:15 fs
* new import related implementations - at this version, we should be able to import everything we export (which is all except events and styles)
*
diff --git a/xmloff/source/forms/elementimport_impl.hxx b/xmloff/source/forms/elementimport_impl.hxx
index 916d4eb8f1fd..659fbd84662f 100644
--- a/xmloff/source/forms/elementimport_impl.hxx
+++ b/xmloff/source/forms/elementimport_impl.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: elementimport_impl.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: fs $ $Date: 2000-12-13 10:40:15 $
+ * last change: $Author: fs $ $Date: 2001-01-02 15:58:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -68,6 +68,9 @@
// no namespace. Same as above: this file is included from elementimport.hxx only,
// and this is done inside the namespace
+//=========================================================================
+//= OContainerImport
+//=========================================================================
//-------------------------------------------------------------------------
template <class BASE>
SvXMLImportContext* OContainerImport< BASE >::CreateChildContext(
@@ -110,11 +113,26 @@ template <class BASE>
//-------------------------------------------------------------------------
template <class BASE>
-OColumnImport< BASE >::OColumnImport(IFormsImportContext& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
+void OContainerImport< BASE >::EndElement()
+{
+ BASE::EndElement();
+
+ // now that we have all children, attach the events
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > xIndexContainer(m_xMeAsContainer, ::com::sun::star::uno::UNO_QUERY);
+ if (xIndexContainer.is())
+ ODefaultEventAttacherManager::setEvents(xIndexContainer);
+}
+
+//=========================================================================
+//= OColumnImport
+//=========================================================================
+//-------------------------------------------------------------------------
+template <class BASE>
+OColumnImport< BASE >::OColumnImport(IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer,
OControlElement::ElementType _eType,
const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxOuterAttribs)
- :BASE(_rImport, _nPrefix, _rName, _rxParentContainer, _eType)
+ :BASE(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer, _eType)
,m_xColumnFactory(_rxParentContainer, ::com::sun::star::uno::UNO_QUERY)
,m_xOuterAttributes(_rxOuterAttribs)
{
@@ -141,7 +159,7 @@ template <class BASE>
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > OColumnImport< BASE >::createElement()
{
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xReturn;
- // no call of the base class. We have to use the grid column factory
+ // no call to the base class' method. We have to use the grid column factory
if (m_xColumnFactory.is())
{
// create the column
@@ -154,6 +172,9 @@ template <class BASE>
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
+ * Revision 1.2 2000/12/13 10:40:15 fs
+ * new import related implementations - at this version, we should be able to import everything we export (which is all except events and styles)
+ *
* Revision 1.1 2000/12/12 12:02:53 fs
* initial checkin - implementations for the template classes in elementimport
*
diff --git a/xmloff/source/forms/layerexport.cxx b/xmloff/source/forms/layerexport.cxx
index cc5f75ad53df..7fcc3312b1f7 100644
--- a/xmloff/source/forms/layerexport.cxx
+++ b/xmloff/source/forms/layerexport.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: layerexport.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: fs $ $Date: 2000-12-18 15:14:35 $
+ * last change: $Author: fs $ $Date: 2001-01-02 15:58:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -112,6 +112,18 @@
#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_
#include <com/sun/star/container/XChild.hpp>
#endif
+#ifndef _COM_SUN_STAR_SCRIPT_XEVENTATTACHERMANAGER_HPP_
+#include <com/sun/star/script/XEventAttacherManager.hpp>
+#endif
+#ifndef _XMLOFF_FORMS_EVENTEXPORT_HXX_
+#include "eventexport.hxx"
+#endif
+#ifndef _XMLOFF_XMLEVENTEXPORT_HXX
+#include "XMLEventExport.hxx"
+#endif
+#ifndef _XMLOFF_FORMS_FORMEVENTS_HXX_
+#include "formevents.hxx"
+#endif
//.........................................................................
namespace xmloff
@@ -125,6 +137,7 @@ namespace xmloff
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::drawing;
using namespace ::com::sun::star::form;
+ using namespace ::com::sun::star::script;
//=====================================================================
//= OFormLayerXMLExport_Impl
@@ -146,6 +159,9 @@ namespace xmloff
m_xExportMapper.getBodyPtr(),
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_CONTROL_PREFIX)));
+ // add our event translation table
+ m_rContext.GetEventExport().AddTranslationTable(g_pFormsEventTranslation);
+
clear();
}
@@ -173,15 +189,17 @@ namespace xmloff
}
//---------------------------------------------------------------------
- void OFormLayerXMLExport_Impl::exportGridColumn(const Reference< XPropertySet >& _rxColumn)
+ void OFormLayerXMLExport_Impl::exportGridColumn(const Reference< XPropertySet >& _rxColumn,
+ const Sequence< ScriptEventDescriptor >& _rEvents)
{
// do the exporting
- OColumnExport aExportImpl(*this, _rxColumn);
+ OColumnExport aExportImpl(*this, _rxColumn, _rEvents);
aExportImpl.doExport();
}
//---------------------------------------------------------------------
- void OFormLayerXMLExport_Impl::exportControl(const Reference< XPropertySet >& _rxControl)
+ void OFormLayerXMLExport_Impl::exportControl(const Reference< XPropertySet >& _rxControl,
+ const Sequence< ScriptEventDescriptor >& _rEvents)
{
// the list of the referring controls
::rtl::OUString sReferringControls;
@@ -197,16 +215,17 @@ namespace xmloff
sControlId = aControlId->second;
// do the exporting
- OControlExport aExportImpl(*this, _rxControl, sControlId, sReferringControls);
+ OControlExport aExportImpl(*this, _rxControl, sControlId, sReferringControls, _rEvents);
aExportImpl.doExport();
}
//---------------------------------------------------------------------
- void OFormLayerXMLExport_Impl::exportForm(const Reference< XPropertySet >& _rxProps) throw (Exception)
+ void OFormLayerXMLExport_Impl::exportForm(const Reference< XPropertySet >& _rxProps,
+ const Sequence< ScriptEventDescriptor >& _rEvents)
{
OSL_ENSHURE(_rxProps.is(), "OFormLayerXMLExport_Impl::exportForm: invalid property set!");
- OFormExport aAttributeHandler(*this, _rxProps);
- // this object will do everything necessary ...
+ OFormExport aAttributeHandler(*this, _rxProps, _rEvents);
+ aAttributeHandler.doExport();
}
//---------------------------------------------------------------------
@@ -227,6 +246,9 @@ namespace xmloff
// step through all the elements of the collection
sal_Int32 nElements = _rxCollection->getCount();
+ Reference< XEventAttacherManager > xElementEventManager(_rxCollection, UNO_QUERY);
+ Sequence< ScriptEventDescriptor > aElementEvents;
+
Reference< XPropertySet > xCurrentProps;
Reference< XPropertySetInfo > xPropsInfo;
Reference< XIndexAccess > xCurrentContainer;
@@ -247,17 +269,20 @@ namespace xmloff
// without this, a lot of stuff in the export routines may fail
continue;
+ if (xElementEventManager.is())
+ aElementEvents = xElementEventManager->getScriptEvents(i);
+
if (xPropsInfo->hasPropertyByName(PROPERTY_COLUMNSERVICENAME))
{
- exportGridColumn(xCurrentProps);
+ exportGridColumn(xCurrentProps, aElementEvents);
}
else if (xPropsInfo->hasPropertyByName(PROPERTY_CLASSID))
{
- exportControl(xCurrentProps);
+ exportControl(xCurrentProps, aElementEvents);
}
else
{
- exportForm(xCurrentProps);
+ exportForm(xCurrentProps, aElementEvents);
}
}
catch(Exception&)
@@ -483,6 +508,9 @@ namespace xmloff
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
+ * Revision 1.7 2000/12/18 15:14:35 fs
+ * some changes ... now exporting/importing styles
+ *
* Revision 1.6 2000/12/13 12:29:30 kz
* DEBUG -> _DEBUG for OSL_ENSURE
*
diff --git a/xmloff/source/forms/layerexport.hxx b/xmloff/source/forms/layerexport.hxx
index fe696ae9bbf2..8da6d1cee533 100644
--- a/xmloff/source/forms/layerexport.hxx
+++ b/xmloff/source/forms/layerexport.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: layerexport.hxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: fs $ $Date: 2000-12-19 12:13:57 $
+ * last change: $Author: fs $ $Date: 2001-01-02 15:58:22 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -65,6 +65,9 @@
#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_
#include <com/sun/star/container/XIndexAccess.hpp>
#endif
+#ifndef _COM_SUN_STAR_SCRIPT_SCRIPTEVENTDESCRIPTOR_HPP_
+#include <com/sun/star/script/ScriptEventDescriptor.hpp>
+#endif
#ifndef _XMLOFF_FORMS_CALLBACKS_HXX_
#include "callbacks.hxx"
#endif
@@ -129,17 +132,22 @@ namespace xmloff
/** exports one single grid column
*/
void exportGridColumn(
- const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn);
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rEvents
+ );
/** exports one single control
*/
void exportControl(
- const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControl);
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControl,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rEvents
+ );
/** exports one single form
*/
- void exportForm(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxProps)
- throw (::com::sun::star::uno::Exception);
+ void exportForm(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxProps,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rEvents
+ );
/** seek to the page given.
@@ -224,6 +232,9 @@ namespace xmloff
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
+ * Revision 1.7 2000/12/19 12:13:57 fs
+ * some changes ... now the exported styles are XSL conform
+ *
* Revision 1.6 2000/12/18 15:14:35 fs
* some changes ... now exporting/importing styles
*
diff --git a/xmloff/source/forms/layerimport.cxx b/xmloff/source/forms/layerimport.cxx
index b1ec78d9c1bd..d8d4c163ff25 100644
--- a/xmloff/source/forms/layerimport.cxx
+++ b/xmloff/source/forms/layerimport.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: layerimport.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: fs $ $Date: 2000-12-19 12:13:57 $
+ * last change: $Author: fs $ $Date: 2001-01-02 15:58:22 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -83,6 +83,12 @@
#ifndef _XMLOFF_PROPERTYSETMAPPER_HXX
#include "xmlprmap.hxx"
#endif
+#ifndef _XMLOFF_XMLIMP_HXX
+#include "xmlimp.hxx"
+#endif
+#ifndef _XMLOFF_EVENTIMPORTHELPER_HXX
+#include "XMLEventImportHelper.hxx"
+#endif
#ifndef _XMLOFF_XMLIMPPR_HXX
#include "xmlimppr.hxx"
#endif
@@ -122,6 +128,9 @@
#ifndef _XMLOFF_FORMS_CONTROLPROPERTYMAP_HXX_
#include "controlpropertymap.hxx"
#endif
+#ifndef _XMLOFF_FORMS_FORMEVENTS_HXX_
+#include "formevents.hxx"
+#endif
SV_IMPL_REF( SvXMLStylesContext );
@@ -273,11 +282,14 @@ namespace xmloff
TabulatorCycle_RECORDS, OEnumMapper::getEnumMap(OEnumMapper::epTabCyle),
&::getCppuType( static_cast<TabulatorCycle*>(NULL) ));
- // add our style family to the export context's style pool
+ // initialize our style map
m_xPropertyHandlerFactory = new OControlPropertyHandlerFactory;
::vos::ORef< XMLPropertySetMapper > xStylePropertiesMapper = new XMLPropertySetMapper(aControlStyleProperties, m_xPropertyHandlerFactory.getBodyPtr());
m_xImportMapper = new SvXMLImportPropertyMapper(xStylePropertiesMapper.getBodyPtr());
+ // add our event table to the event import helper
+ m_rImporter.GetEventImport().AddTranslationTable(g_pFormsEventTranslation);
+
// 'initialize'
m_aCurrentPageIds = m_aControlIds.end();
}
@@ -423,6 +435,11 @@ namespace xmloff
OSL_ENSURE(sal_False, "OFormLayerXMLImport_Impl::endPage: unable to knit the control references (caught an exception)!");
}
+ // now that we have all children of the forms collection, attach the events
+ Reference< XIndexAccess > xIndexContainer(m_xForms, UNO_QUERY);
+ if (xIndexContainer.is())
+ ODefaultEventAttacherManager::setEvents(xIndexContainer);
+
// clear the structures for the control references.
m_aControlReferences.clear();
@@ -458,7 +475,7 @@ namespace xmloff
return new SvXMLImportContext(m_rImporter, _nPrefix, _rLocalName);
}
- return new OFormImport(*this, _nPrefix, _rLocalName, m_xForms );
+ return new OFormImport(*this, *this, _nPrefix, _rLocalName, m_xForms );
}
//---------------------------------------------------------------------
@@ -476,6 +493,9 @@ namespace xmloff
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
+ * Revision 1.5 2000/12/19 12:13:57 fs
+ * some changes ... now the exported styles are XSL conform
+ *
* Revision 1.4 2000/12/18 15:14:35 fs
* some changes ... now exporting/importing styles
*
diff --git a/xmloff/source/forms/layerimport.hxx b/xmloff/source/forms/layerimport.hxx
index 63d94e453392..14c2eca33391 100644
--- a/xmloff/source/forms/layerimport.hxx
+++ b/xmloff/source/forms/layerimport.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: layerimport.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: fs $ $Date: 2000-12-18 15:14:35 $
+ * last change: $Author: fs $ $Date: 2001-01-02 15:58:22 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -75,8 +75,8 @@
#ifndef _XMLOFF_FORMS_CALLBACKS_HXX_
#include "callbacks.hxx"
#endif
-#ifndef _XMLOFF_FORMS_IFACECOMPARE_HXX_
-#include "ifacecompare.hxx"
+#ifndef _XMLOFF_FORMS_EVENTIMPORT_HXX_
+#include "eventimport.hxx"
#endif
#ifndef _REF_HXX
#include <tools/ref.hxx>
@@ -125,6 +125,7 @@ namespace xmloff
:public OAttributeMetaData
,public IControlIdMap
,public IFormsImportContext
+ ,public ODefaultEventAttacherManager
{
friend class OFormLayerXMLImport;
@@ -215,6 +216,9 @@ namespace xmloff
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
+ * Revision 1.4 2000/12/18 15:14:35 fs
+ * some changes ... now exporting/importing styles
+ *
* Revision 1.3 2000/12/13 10:40:15 fs
* new import related implementations - at this version, we should be able to import everything we export (which is all except events and styles)
*
diff --git a/xmloff/source/forms/propertyexport.hxx b/xmloff/source/forms/propertyexport.hxx
index 366970c7ac5f..ab2c962993ce 100644
--- a/xmloff/source/forms/propertyexport.hxx
+++ b/xmloff/source/forms/propertyexport.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: propertyexport.hxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: fs $ $Date: 2000-12-18 15:14:35 $
+ * last change: $Author: fs $ $Date: 2001-01-02 15:58:22 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -74,6 +74,9 @@
#ifndef _XMLOFF_XMLEXP_HXX
#include "xmlexp.hxx"
#endif
+#ifndef _XMLOFF_FORMS_CALLBACKS_HXX_
+#include "callbacks.hxx"
+#endif
//.........................................................................
namespace xmloff
@@ -344,7 +347,7 @@ namespace xmloff
#else
// in the product version, inline this, so it does not cost us extra time calling into our method
inline void AddAttribute(sal_uInt16 _nPrefix, const sal_Char* _pName, const ::rtl::OUString& _rValue)
- { m_rContext.AddAttribute(_nPrefix, _pName, _rValue); }
+ { m_rContext.getGlobalContext().AddAttribute(_nPrefix, _pName, _rValue); }
#endif
#ifdef DBG_UTIL
@@ -394,6 +397,9 @@ namespace xmloff
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
+ * Revision 1.6 2000/12/18 15:14:35 fs
+ * some changes ... now exporting/importing styles
+ *
* Revision 1.5 2000/12/13 10:38:49 fs
* slightly modified some documentations
*
diff --git a/xmloff/source/forms/strings.hxx b/xmloff/source/forms/strings.hxx
index 3115a61ac30a..700e247c4665 100644
--- a/xmloff/source/forms/strings.hxx
+++ b/xmloff/source/forms/strings.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: strings.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: fs $ $Date: 2000-12-18 15:14:35 $
+ * last change: $Author: fs $ $Date: 2001-01-02 15:58:22 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -224,6 +224,13 @@ namespace xmloff
XMLFORM_CONSTASCII_STRING( SERVICE_IMAGECONTROL, "com.sun.star.form.component.DatabaseImageControl");
XMLFORM_CONSTASCII_STRING( SERVICE_FORMATTEDFIELD, "com.sun.star.form.component.FormattedField" );
+ // various strings
+ XMLFORM_CONSTASCII_STRING( EVENT_NAME_SEPARATOR, "::" );
+ XMLFORM_CONSTASCII_STRING( EVENT_TYPE, "EventType" );
+ XMLFORM_CONSTASCII_STRING( EVENT_LIBRARY, "Library" );
+ XMLFORM_CONSTASCII_STRING( EVENT_LOCALMACRONAME, "MacroName" );
+
+
//.........................................................................
} // namespace xmloff
//.........................................................................
@@ -233,6 +240,9 @@ namespace xmloff
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
+ * Revision 1.3 2000/12/18 15:14:35 fs
+ * some changes ... now exporting/importing styles
+ *
* Revision 1.2 2000/11/19 15:41:32 fs
* extended the export capabilities - generic controls / grid columns / generic properties / some missing form properties
*