diff options
author | Frank Schönheit <fs@openoffice.org> | 2001-01-03 15:25:34 +0000 |
---|---|---|
committer | Frank Schönheit <fs@openoffice.org> | 2001-01-03 15:25:34 +0000 |
commit | b0fc105a9fcf2fb86d51e30131308291d8ace897 (patch) | |
tree | 2cd2a83e1fffb0e5bcd527a3c05da2c715c98e7b | |
parent | 465718be7185ce19f709c150317d532c71a6d338 (diff) |
file format change (extra wrapper element for controls, similar to columns)
-rw-r--r-- | xmloff/source/forms/controlelement.cxx | 10 | ||||
-rw-r--r-- | xmloff/source/forms/controlelement.hxx | 10 | ||||
-rw-r--r-- | xmloff/source/forms/elementexport.cxx | 267 | ||||
-rw-r--r-- | xmloff/source/forms/elementexport.hxx | 49 | ||||
-rw-r--r-- | xmloff/source/forms/elementimport.cxx | 158 | ||||
-rw-r--r-- | xmloff/source/forms/elementimport.hxx | 101 | ||||
-rw-r--r-- | xmloff/source/forms/elementimport_impl.hxx | 32 | ||||
-rw-r--r-- | xmloff/source/forms/formattributes.cxx | 11 | ||||
-rw-r--r-- | xmloff/source/forms/makefile.mk | 20 | ||||
-rw-r--r-- | xmloff/source/forms/propertyexport.cxx | 75 | ||||
-rw-r--r-- | xmloff/source/forms/propertyexport.hxx | 11 |
11 files changed, 432 insertions, 312 deletions
diff --git a/xmloff/source/forms/controlelement.cxx b/xmloff/source/forms/controlelement.cxx index 885e3446fe65..b474d65892eb 100644 --- a/xmloff/source/forms/controlelement.cxx +++ b/xmloff/source/forms/controlelement.cxx @@ -2,9 +2,9 @@ * * $RCSfile: controlelement.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: fs $ $Date: 2000-12-06 17:29:46 $ + * last change: $Author: fs $ $Date: 2001-01-03 16:25:34 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,9 +92,8 @@ namespace xmloff case IMAGE_FRAME: return "image-frame"; case HIDDEN: return "hidden"; case GRID: return "grid"; - case COLUMN: return "column"; - default: return "control"; + default: return "generic-control"; } } @@ -105,6 +104,9 @@ namespace xmloff /************************************************************************* * history: * $Log: not supported by cvs2svn $ + * Revision 1.1 2000/12/06 17:29:46 fs + * initial checkin - implementations for formlayer import/export - still under construction + * * * Revision 1.0 06.12.00 14:02:39 fs ************************************************************************/ diff --git a/xmloff/source/forms/controlelement.hxx b/xmloff/source/forms/controlelement.hxx index c7363d6bf93e..24849a33aa3e 100644 --- a/xmloff/source/forms/controlelement.hxx +++ b/xmloff/source/forms/controlelement.hxx @@ -2,9 +2,9 @@ * * $RCSfile: controlelement.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: fs $ $Date: 2000-12-06 17:30:27 $ + * last change: $Author: fs $ $Date: 2001-01-03 16:25:34 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -97,8 +97,7 @@ namespace xmloff IMAGE_FRAME, HIDDEN, GRID, - COLUMN, - CONTROL, + GENERIC_CONTROL, UNKNOWN // must be the last element }; @@ -130,6 +129,9 @@ namespace xmloff /************************************************************************* * history: * $Log: not supported by cvs2svn $ + * Revision 1.1 2000/12/06 17:30:27 fs + * initial checkin - implementations for formlayer import/export - still under construction + * * * Revision 1.0 06.12.00 14:00:25 fs ************************************************************************/ diff --git a/xmloff/source/forms/elementexport.cxx b/xmloff/source/forms/elementexport.cxx index 729b63612d3f..fedeec47b89a 100644 --- a/xmloff/source/forms/elementexport.cxx +++ b/xmloff/source/forms/elementexport.cxx @@ -2,9 +2,9 @@ * * $RCSfile: elementexport.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: fs $ $Date: 2001-01-02 15:58:21 $ + * last change: $Author: fs $ $Date: 2001-01-03 16:25:34 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -85,6 +85,12 @@ #ifndef _XMLOFF_FORMS_EVENTEXPORT_HXX_ #include "eventexport.hxx" #endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif +#ifndef _COM_SUN_STAR_IO_XPERSISTOBJECT_HPP_ +#include <com/sun/star/io/XPersistObject.hpp> +#endif #ifndef _COM_SUN_STAR_FORM_FORMCOMPONENTTYPE_HPP_ #include <com/sun/star/form/FormComponentType.hpp> #endif @@ -136,6 +142,7 @@ namespace xmloff using namespace ::com::sun::star::beans; using namespace ::com::sun::star::container; using namespace ::com::sun::star::script; + using namespace ::com::sun::star::io; //===================================================================== //= OElementExport @@ -211,6 +218,70 @@ namespace xmloff } //--------------------------------------------------------------------- + void OElementExport::exportServiceNameAttribute() + { + Reference< XPersistObject > xPersistence(m_xProps, UNO_QUERY); + if (!xPersistence.is()) + { + OSL_ENSURE(sal_False, "OElementExport::exportServiceNameAttribute: no XPersistObject!"); + return; + } + + ::rtl::OUString sServiceName = xPersistence->getServiceName(); + // we don't want to write the old service name directly: it's a name used for compatibility reasons, but + // as we start some kind of new file format here (with this xml export), we don't care about + // compatibility ... + // So we translate the old persistence service name into new ones, if possible + + ::rtl::OUString sToWriteServiceName = sServiceName; +#define CHECK_N_TRANSLATE( name ) \ + else if (0 == sServiceName.compareToAscii(SERVICE_PERSISTENT_COMPONENT_##name)) \ + sToWriteServiceName = SERVICE_##name + + if (sal_False) + ; + CHECK_N_TRANSLATE( FORM ); + CHECK_N_TRANSLATE( FORM ); + CHECK_N_TRANSLATE( LISTBOX ); + CHECK_N_TRANSLATE( COMBOBOX ); + CHECK_N_TRANSLATE( RADIOBUTTON ); + CHECK_N_TRANSLATE( GROUPBOX ); + CHECK_N_TRANSLATE( FIXEDTEXT ); + CHECK_N_TRANSLATE( COMMANDBUTTON ); + CHECK_N_TRANSLATE( CHECKBOX ); + CHECK_N_TRANSLATE( GRID ); + CHECK_N_TRANSLATE( IMAGEBUTTON ); + CHECK_N_TRANSLATE( FILECONTROL ); + CHECK_N_TRANSLATE( TIMEFIELD ); + CHECK_N_TRANSLATE( DATEFIELD ); + CHECK_N_TRANSLATE( NUMERICFIELD ); + CHECK_N_TRANSLATE( CURRENCYFIELD ); + CHECK_N_TRANSLATE( PATTERNFIELD ); + CHECK_N_TRANSLATE( HIDDENCONTROL ); + CHECK_N_TRANSLATE( IMAGECONTROL ); + CHECK_N_TRANSLATE( FORMATTEDFIELD ); + else if (0 == sServiceName.compareToAscii(SERVICE_PERSISTENT_COMPONENT_EDIT)) + { // special handling for the edit field: we have to controls using this as persistence service name + sToWriteServiceName = SERVICE_EDIT; + Reference< XServiceInfo > xSI(m_xProps, UNO_QUERY); + if (xSI.is() && xSI->supportsService(SERVICE_FORMATTEDFIELD)) + sToWriteServiceName = SERVICE_FORMATTEDFIELD; + } +#ifdef DBG_UTIL + Reference< XServiceInfo > xSI(m_xProps, UNO_QUERY); + OSL_ENSURE(xSI.is() && xSI->supportsService(sToWriteServiceName), + "OElementExport::exportServiceNameAttribute: wrong service name translation!"); + +#endif + + // now write this + AddAttribute( + getCommonControlAttributeNamespace(CCA_SERVICE_NAME), + getCommonControlAttributeName(CCA_SERVICE_NAME), + sToWriteServiceName); + } + + //--------------------------------------------------------------------- void OElementExport::exportEvents() { if (!m_aEvents.getLength()) @@ -236,12 +307,61 @@ namespace xmloff ,m_nIncludeSpecial(0) ,m_nIncludeEvents(0) ,m_nClassId(FormComponentType::CONTROL) + ,m_pOuterElement(NULL) { OSL_ENSURE(m_xProps.is(), "OControlExport::OControlExport: invalid arguments!"); } //--------------------------------------------------------------------- - void OControlExport::exportAttributes() + OControlExport::~OControlExport() + { + implEndElement(); + } + + //--------------------------------------------------------------------- + void OControlExport::exportOuterAttributes() + { + // the control id + if (CCA_NAME & m_nIncludeCommon) + { + exportStringPropertyAttribute( + getCommonControlAttributeNamespace(CCA_NAME), + getCommonControlAttributeName(CCA_NAME), + PROPERTY_NAME + ); + #ifdef DBG_UTIL + // reset the bit for later checking + m_nIncludeCommon = m_nIncludeCommon & ~CCA_NAME; + #endif + } + + // the service name + if (m_nIncludeCommon & CCA_SERVICE_NAME) + { + exportServiceNameAttribute(); + #ifdef DBG_UTIL + // reset the bit for later checking + m_nIncludeCommon = m_nIncludeCommon & ~CCA_SERVICE_NAME; + #endif + } + + // the control id + if (CCA_CONTROL_ID & m_nIncludeCommon) + { + OSL_ENSURE(m_sControlId.getLength(), "OControlExport::exportCommonControlAttributes: have no control id for the control!"); + AddAttribute( + getCommonControlAttributeNamespace(CCA_CONTROL_ID), + getCommonControlAttributeName(CCA_CONTROL_ID), + m_sControlId); + #ifdef DBG_UTIL + // reset the bit for later checking + m_nIncludeCommon = m_nIncludeCommon & ~CCA_CONTROL_ID; + #endif + } + } + + //--------------------------------------------------------------------- + void OControlExport::exportInnerAttributes() { // common control attributes exportCommonControlAttributes(); @@ -254,8 +374,12 @@ namespace xmloff // add the style references to the attributes implExportStyleReference(); + } - // TODO: add the event attributes + //--------------------------------------------------------------------- + void OControlExport::exportAttributes() + { + exportOuterAttributes(); } //--------------------------------------------------------------------- @@ -329,32 +453,18 @@ namespace xmloff // the extra indents for the respective blocks are to ensure that there is no copy'n'paste error, using // map identifiers from the wrong block - // the control id - if (CCA_CONTROL_ID & m_nIncludeCommon) - { - OSL_ENSURE(m_sControlId.getLength(), "OControlExport::exportCommonControlAttributes: have no control id for the control!"); - AddAttribute( - getCommonControlAttributeNamespace(CCA_CONTROL_ID), - getCommonControlAttributeName(CCA_CONTROL_ID), - m_sControlId); - #ifdef DBG_UTIL - // reset the bit for later checking - m_nIncludeCommon = m_nIncludeCommon & ~CCA_CONTROL_ID; - #endif - } - // -------------------------------------------------------------------- // some string properties { // the attribute ids of all properties which are expected to be of type string static sal_Int32 nStringPropertyAttributeIds[] = { - CCA_NAME, CCA_IMAGE_DATA, CCA_LABEL, CCA_TARGET_LOCATION, CCA_TITLE + CCA_IMAGE_DATA, CCA_LABEL, CCA_TARGET_LOCATION, CCA_TITLE }; // the names of all properties which are expected to be of type string static const sal_Char* pStringPropertyNames[] = { - PROPERTY_NAME, PROPERTY_IMAGEURL, PROPERTY_LABEL, PROPERTY_TARGETURL, PROPERTY_TITLE + PROPERTY_IMAGEURL, PROPERTY_LABEL, PROPERTY_TARGETURL, PROPERTY_TITLE }; OSL_ENSURE( sizeof(pStringPropertyNames)/sizeof(pStringPropertyNames[0]) == sizeof(nStringPropertyAttributeIds)/sizeof(nStringPropertyAttributeIds[0]), @@ -478,16 +588,6 @@ namespace xmloff // -------------------------------------------------------------------- // some properties which require a special handling - // the service name - if (m_nIncludeCommon & CCA_SERVICE_NAME) - { - exportServiceNameAttribute(); - #ifdef DBG_UTIL - // reset the bit for later checking - m_nIncludeCommon = m_nIncludeCommon & ~CCA_SERVICE_NAME; - #endif - } - // the target frame if (m_nIncludeCommon & CCA_TARGET_FRAME) { @@ -878,6 +978,36 @@ namespace xmloff } //--------------------------------------------------------------------- + void OControlExport::implStartElement(const sal_Char* _pName) + { + // before we let the base class start it's outer element, we add a wrapper element + m_pOuterElement = new SvXMLElementExport(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, getOuterXMLElementName(), sal_True, sal_True); + + // add the attributes for the inner element + exportInnerAttributes(); + + // and start the inner element + OElementExport::implStartElement(_pName); + } + + //--------------------------------------------------------------------- + void OControlExport::implEndElement() + { + // end the inner element + OElementExport::implEndElement(); + + // end the outer element + delete m_pOuterElement; + m_pOuterElement = NULL; + } + + //--------------------------------------------------------------------- + const sal_Char* OControlExport::getOuterXMLElementName() const + { + return "control"; + } + + //--------------------------------------------------------------------- const sal_Char* OControlExport::getXMLElementName() const { return getElementName(m_eType); @@ -1104,7 +1234,7 @@ namespace xmloff break; case FormComponentType::CONTROL: - m_eType = CONTROL; + m_eType = GENERIC_CONTROL; // unknown control type m_nIncludeCommon = CCA_NAME | CCA_SERVICE_NAME; // at least a name should be there, 'cause without a name the control could never have been @@ -1129,56 +1259,18 @@ namespace xmloff 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() { - // end the base class element before our own one implEndElement(); - - delete m_pColumnXMLElement; } //--------------------------------------------------------------------- - void OColumnExport::examine() + void OColumnExport::exportServiceNameAttribute() { - 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); - - if (FormComponentType::DATEFIELD != m_nClassId) - // except date fields, no column has the DropDown property - m_nIncludeCommon &= ~CCA_DROPDOWN; - - m_bExamined = sal_True; - } - } - - //--------------------------------------------------------------------- - void OColumnExport::doExport() - { - // before the base class can start it's element, start an additional one stating that the following is - // a grid column - - // 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( - getCommonControlAttributeNamespace(CCA_NAME), - getCommonControlAttributeName(CCA_NAME), - PROPERTY_NAME - ); - // the attribute "service name" (which has a slightly different meaning for columns DBG_CHECK_PROPERTY((const sal_Char*)PROPERTY_COLUMNSERVICENAME, ::rtl::OUString); ::rtl::OUString sColumnServiceName; @@ -1194,17 +1286,38 @@ namespace xmloff // flag the property as "handled" exportedProperty(PROPERTY_COLUMNSERVICENAME); + } + + //--------------------------------------------------------------------- + const sal_Char* OColumnExport::getOuterXMLElementName() const + { + return "column"; + } + + //--------------------------------------------------------------------- + void OColumnExport::exportAttributes() + { + OControlExport::exportAttributes(); + // the attribute "label" exportStringPropertyAttribute( getCommonControlAttributeNamespace(CCA_LABEL), getCommonControlAttributeName(CCA_LABEL), PROPERTY_LABEL); + } + + //--------------------------------------------------------------------- + void OColumnExport::examine() + { + OControlExport::examine(); - // start the extra element indicating that we're a column - m_pColumnXMLElement = new SvXMLElementExport(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, "column", sal_True, sal_True); + // grid columns miss some properties of the controls they're representing + m_nIncludeCommon &= ~(CCA_CONTROL_ID | CCA_FOR | CCA_PRINTABLE | CCA_TAB_INDEX | CCA_TAB_STOP | CCA_LABEL); + m_nIncludeSpecial &= ~(SCA_ECHO_CHAR | SCA_AUTOMATIC_COMPLETION | SCA_MULTIPLE | SCA_MULTI_LINE | SCA_IS_TRISTATE); - // let the base class do it's handling - OControlExport::doExport(); + if (FormComponentType::DATEFIELD != m_nClassId) + // except date fields, no column has the DropDown property + m_nIncludeCommon &= ~CCA_DROPDOWN; } //===================================================================== @@ -1349,9 +1462,6 @@ namespace xmloff getFormAttributeNamespace(faDetailFiels), getFormAttributeName(faDetailFiels), PROPERTY_DETAILFIELDS); - - - // TODO: the events EA_RESET, EA_SUBMIT } //......................................................................... @@ -1361,6 +1471,9 @@ namespace xmloff /************************************************************************* * history: * $Log: not supported by cvs2svn $ + * Revision 1.8 2001/01/02 15:58:21 fs + * event ex- & import + * * Revision 1.7 2000/12/18 15:14:35 fs * some changes ... now exporting/importing styles * diff --git a/xmloff/source/forms/elementexport.hxx b/xmloff/source/forms/elementexport.hxx index 4c82ad7c3bed..3dec5e18dfe4 100644 --- a/xmloff/source/forms/elementexport.hxx +++ b/xmloff/source/forms/elementexport.hxx @@ -2,9 +2,9 @@ * * $RCSfile: elementexport.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: fs $ $Date: 2001-01-02 15:58:21 $ + * last change: $Author: fs $ $Date: 2001-01-03 16:25:34 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -107,7 +107,7 @@ namespace xmloff const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rEvents); ~OElementExport(); - virtual void doExport(); + void doExport(); protected: /// get the name of the XML element @@ -123,11 +123,15 @@ namespace xmloff */ void exportEvents(); + /** add the service-name attribute to the export context + */ + virtual void exportServiceNameAttribute(); + /// start the XML element - void implStartElement(const sal_Char* _pName); + virtual void implStartElement(const sal_Char* _pName); /// ends the XML element - void implEndElement(); + virtual void implEndElement(); }; //===================================================================== @@ -153,6 +157,8 @@ namespace xmloff sal_Int32 m_nIncludeSpecial; // special attributes to include sal_Int32 m_nIncludeEvents; // events to include + SvXMLElementExport* m_pOuterElement; // XML element doing the concrete startElement etc. for the outer element + public: /** constructs an object capable of exporting controls @@ -170,8 +176,18 @@ namespace xmloff const ::rtl::OUString& _rControlId, const ::rtl::OUString& _rReferringControls, const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rxEvents); + ~OControlExport(); protected: + /// start the XML element + virtual void implStartElement(const sal_Char* _pName); + + /// ends the XML element + virtual void implEndElement(); + + /// get the name of the outer XML element + virtual const sal_Char* getOuterXMLElementName() const; + // get the name of the XML element virtual const sal_Char* getXMLElementName() const; @@ -179,6 +195,12 @@ namespace xmloff */ virtual void examine(); + /// exports the attributes for the outer element + void exportOuterAttributes(); + + /// exports the attributes for the inner element + void exportInnerAttributes(); + /// export the attributes virtual void exportAttributes(); @@ -242,12 +264,6 @@ namespace xmloff */ class OColumnExport : public OControlExport { - protected: - 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 @@ -258,9 +274,13 @@ namespace xmloff ~OColumnExport(); - virtual void doExport(); - protected: + // OControlExport overridables + virtual const sal_Char* getOuterXMLElementName() const; + virtual void exportServiceNameAttribute(); + virtual void exportAttributes(); + + // OElementExport overridables virtual void examine(); }; @@ -299,6 +319,9 @@ namespace xmloff /************************************************************************* * history: * $Log: not supported by cvs2svn $ + * Revision 1.6 2001/01/02 15:58:21 fs + * event ex- & import + * * Revision 1.5 2000/12/18 15:14:35 fs * some changes ... now exporting/importing styles * diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx index 71ee406a2733..95537f9e7818 100644 --- a/xmloff/source/forms/elementimport.cxx +++ b/xmloff/source/forms/elementimport.cxx @@ -2,9 +2,9 @@ * * $RCSfile: elementimport.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: fs $ $Date: 2001-01-02 15:58:21 $ + * last change: $Author: fs $ $Date: 2001-01-03 16:25:34 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -399,6 +399,13 @@ namespace xmloff } //--------------------------------------------------------------------- + void OControlImport::addOuterAttributes(const Reference< sax::XAttributeList >& _rxOuterAttribs) + { + OSL_ENSURE(!m_xOuterAttributes.is(), "OControlImport::addOuterAttributes: already have these attributes!"); + m_xOuterAttributes = _rxOuterAttribs; + } + + //--------------------------------------------------------------------- void OControlImport::handleAttribute(sal_uInt16 _nNamespaceKey, const ::rtl::OUString& _rLocalName, const ::rtl::OUString& _rValue) { // the control id @@ -439,8 +446,16 @@ namespace xmloff //--------------------------------------------------------------------- void OControlImport::StartElement(const Reference< sax::XAttributeList >& _rxAttrList) { + // merge the attribute lists + OAttribListMerger* pMerger = new OAttribListMerger; + // our own one + pMerger->addList(_rxAttrList); + // and the ones of our enclosing element + pMerger->addList(m_xOuterAttributes); + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > xAttributes = pMerger; + // let the base class handle all the attributes - OElementImport::StartElement(_rxAttrList); + OElementImport::StartElement(xAttributes); if (m_aValueProperties.size() && m_xElement.is()) { @@ -790,10 +805,10 @@ namespace xmloff } //===================================================================== - //= OColumnWrapperImport + //= OControlWrapperImport //===================================================================== //--------------------------------------------------------------------- - OColumnWrapperImport::OColumnWrapperImport(IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName, + OControlWrapperImport::OControlWrapperImport(IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName, const Reference< XNameContainer >& _rxParentContainer) :SvXMLImportContext(_rImport.getGlobalContext(), _nPrefix, _rName) ,m_rFormImport(_rImport) @@ -803,45 +818,89 @@ namespace xmloff } //--------------------------------------------------------------------- - SvXMLImportContext* OColumnWrapperImport::CreateChildContext(sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName, + SvXMLImportContext* OControlWrapperImport::CreateChildContext(sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName, const Reference< sax::XAttributeList >& _rxAttrList) { - OControlElement::ElementType eType = OElementNameMap::getElementType(_rLocalName); - OSL_ENSURE( (OControlElement::UNKNOWN != eType) - && (OControlElement::COLUMN != eType) - && (OControlElement::GRID != eType) - && (OControlElement::FRAME != eType) - && (OControlElement::FIXED_TEXT != eType), + OControlImport* pReturn = implCreateChildContext(_nPrefix, _rLocalName, OElementNameMap::getElementType(_rLocalName)); + if (pReturn) + { + OSL_ENSURE(m_xOwnAttributes.is(), "OControlWrapperImport::CreateChildContext: had no form:column element!"); + pReturn->addOuterAttributes(m_xOwnAttributes); + } + return pReturn; + } + + //--------------------------------------------------------------------- + void OControlWrapperImport::StartElement(const Reference< sax::XAttributeList >& _rxAttrList) + { + OSL_ENSURE(!m_xOwnAttributes.is(), "OControlWrapperImport::StartElement: aready have the cloned list!"); + + // clone the attributes + Reference< XCloneable > xCloneList(_rxAttrList, UNO_QUERY); + OSL_ENSURE(xCloneList.is(), "OControlWrapperImport::StartElement: AttributeList not cloneable!"); + m_xOwnAttributes = Reference< sax::XAttributeList >(xCloneList->createClone(), UNO_QUERY); + OSL_ENSURE(m_xOwnAttributes.is(), "OControlWrapperImport::StartElement: no cloned list!"); - "OColumnWrapperImport::CreateChildContext: invalid or unrecognized sub element!"); + // forward an empty attribute list to the base class + // (the attributes are merged into the ones of the upcoming xml element which really describes the control) + SvXMLImportContext::StartElement(new OAttribListMerger); + } - switch (eType) + //--------------------------------------------------------------------- + OControlImport* OControlWrapperImport::implCreateChildContext( + sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName, + OControlElement::ElementType _eType) + { + switch (_eType) { case OControlElement::COMBOBOX: case OControlElement::LISTBOX: - OSL_ENSURE(m_xOwnAttributes.is(), "OColumnWrapperImport::CreateChildContext: had no form:column element!"); - return new OColumnImport<OListAndComboImport>(m_rFormImport, m_rEventManager, _nPrefix, _rLocalName, m_xParentContainer, eType, m_xOwnAttributes); + return new OListAndComboImport(m_rFormImport, m_rEventManager, _nPrefix, _rLocalName, m_xParentContainer, _eType); + + case OControlElement::FRAME: + case OControlElement::FIXED_TEXT: + return new OReferredControlImport(m_rFormImport, m_rEventManager, _nPrefix, _rLocalName, m_xParentContainer, _eType); + + case OControlElement::GRID: + return new OGridImport(m_rFormImport, m_rEventManager, _nPrefix, _rLocalName, m_xParentContainer, _eType); default: - OSL_ENSURE(m_xOwnAttributes.is(), "OColumnWrapperImport::CreateChildContext: had no form:column element!"); - return new OColumnImport<OControlImport>(m_rFormImport, m_rEventManager, _nPrefix, _rLocalName, m_xParentContainer, eType, m_xOwnAttributes); + return new OControlImport(m_rFormImport, m_rEventManager, _nPrefix, _rLocalName, m_xParentContainer, _eType); } } + //===================================================================== + //= OColumnWrapperImport + //===================================================================== //--------------------------------------------------------------------- - void OColumnWrapperImport::StartElement(const Reference< sax::XAttributeList >& _rxAttrList) + OColumnWrapperImport::OColumnWrapperImport(IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName, + const Reference< XNameContainer >& _rxParentContainer) + :OControlWrapperImport(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer) { - OSL_ENSURE(!m_xOwnAttributes.is(), "OColumnWrapperImport::StartElement: aready have the cloned list!"); + } - // clone the attributes - Reference< XCloneable > xCloneList(_rxAttrList, UNO_QUERY); - OSL_ENSURE(xCloneList.is(), "OColumnWrapperImport::StartElement: AttributeList not cloneable!"); - m_xOwnAttributes = Reference< sax::XAttributeList >(xCloneList->createClone(), UNO_QUERY); - OSL_ENSURE(m_xOwnAttributes.is(), "OColumnWrapperImport::StartElement: no cloned list!"); + //--------------------------------------------------------------------- + OControlImport* OColumnWrapperImport::implCreateChildContext( + sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName, + OControlElement::ElementType _eType) + { + OSL_ENSURE( (OControlElement::TEXT == _eType) + || (OControlElement::TEXT_AREA == _eType) + || (OControlElement::FORMATTED_TEXT == _eType) + || (OControlElement::CHECKBOX == _eType) + || (OControlElement::LISTBOX == _eType) + || (OControlElement::COMBOBOX == _eType), + "OColumnWrapperImport::implCreateChildContext: invalid or unrecognized sub element!"); - // forward an empty attribute list to the base class - // (the attributes are merged into the ones of the upcoming xml element which really describes the column) - SvXMLImportContext::StartElement(new OAttribListMerger); + switch (_eType) + { + case OControlElement::COMBOBOX: + case OControlElement::LISTBOX: + return new OColumnImport<OListAndComboImport>(m_rFormImport, m_rEventManager, _nPrefix, _rLocalName, m_xParentContainer, _eType, m_xOwnAttributes); + + default: + return new OColumnImport<OControlImport>(m_rFormImport, m_rEventManager, _nPrefix, _rLocalName, m_xParentContainer, _eType, m_xOwnAttributes); + } } //===================================================================== @@ -851,27 +910,15 @@ namespace xmloff OGridImport::OGridImport(IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName, const Reference< XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType) - :OGridImport_Base(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer) + :OGridImport_Base(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer, "column") { setElementType(_eType); } //--------------------------------------------------------------------- - SvXMLImportContext* OGridImport::implCreateControlChild(sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName, - OControlElement::ElementType _eType) + SvXMLImportContext* OGridImport::implCreateControlWrapper(sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName) { - switch (_eType) - { - case OControlElement::COLUMN: - // this is the wrapper element. - 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 - return NULL; - } - OSL_ENSURE(sal_False, "OGridImport::implCreateControlChild: reached the unreacheable!"); - return NULL; + return new OColumnWrapperImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer); } //===================================================================== @@ -880,7 +927,7 @@ namespace xmloff //--------------------------------------------------------------------- OFormImport::OFormImport(IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName, const Reference< XNameContainer >& _rxParentContainer) - :OFormImport_Base(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer) + :OFormImport_Base(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer, "control") { } @@ -896,25 +943,9 @@ namespace xmloff } //--------------------------------------------------------------------- - SvXMLImportContext* OFormImport::implCreateControlChild(sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName, - OControlElement::ElementType _eType) + SvXMLImportContext* OFormImport::implCreateControlWrapper(sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName) { - switch (_eType) - { - case OControlElement::COMBOBOX: - case OControlElement::LISTBOX: - return new OListAndComboImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType); - - case OControlElement::FRAME: - case OControlElement::FIXED_TEXT: - return new OReferredControlImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType); - - case OControlElement::GRID: - return new OGridImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType); - - default: - return new OControlImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType); - } + return new OControlWrapperImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer); } //--------------------------------------------------------------------- @@ -1003,6 +1034,9 @@ namespace xmloff /************************************************************************* * history: * $Log: not supported by cvs2svn $ + * Revision 1.6 2001/01/02 15:58:21 fs + * event ex- & import + * * Revision 1.5 2000/12/20 14:01:19 vg * #65293# type (DEBUG instead of _DEBUG) * diff --git a/xmloff/source/forms/elementimport.hxx b/xmloff/source/forms/elementimport.hxx index 38e87edd4e3c..e0d0af059745 100644 --- a/xmloff/source/forms/elementimport.hxx +++ b/xmloff/source/forms/elementimport.hxx @@ -2,9 +2,9 @@ * * $RCSfile: elementimport.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: fs $ $Date: 2001-01-02 15:58:21 $ + * last change: $Author: fs $ $Date: 2001-01-03 16:25:34 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -209,12 +209,18 @@ namespace xmloff // the value properties (value, current-value, min-value, max-value) require some special // handling + // we fake the attributes our base class gets: we add the attributes of the outer wrapper + // element which encloses us + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > + m_xOuterAttributes; + protected: // for use by derived classes only OControlImport( IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName, - const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer); + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer + ); public: OControlImport( @@ -234,6 +240,8 @@ namespace xmloff const ::rtl::OUString& _rLocalName, const ::rtl::OUString& _rValue); + void addOuterAttributes(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxOuterAttribs); + protected: void setElementType(OControlElement::ElementType _eType) { m_eElementType = _eType; } @@ -244,6 +252,38 @@ namespace xmloff }; //===================================================================== + //= OControlWrapperImport + //===================================================================== + /** helper class importing a <form:column> or <form:control> element. + */ + class OControlWrapperImport : public SvXMLImportContext + { + protected: + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > + m_xOwnAttributes; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > + m_xParentContainer; + IFormsImportContext& m_rFormImport; + IEventAttacherManager& m_rEventManager; + + public: + OControlWrapperImport(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 + 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 StartElement( + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList); + + protected: + virtual OControlImport* implCreateChildContext( + sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName, + OControlElement::ElementType _eType); + }; + + //===================================================================== //= OReferredControlImport //===================================================================== class OReferredControlImport : public OControlImport @@ -382,12 +422,15 @@ namespace xmloff { protected: ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > - m_xMeAsContainer; + m_xMeAsContainer; + ::rtl::OUString m_sWrapperElementName; protected: OContainerImport(IFormsImportContext& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName, - const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer) + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxParentContainer, + const sal_Char* _pWrapperElementName) :BASE(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer) + ,m_sWrapperElementName(::rtl::OUString::createFromAscii(_pWrapperElementName)) { } @@ -403,9 +446,8 @@ namespace xmloff createElement(); // create the child context for the given control type - virtual SvXMLImportContext* implCreateControlChild( - sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName, - OControlElement::ElementType _eType) = 0; + virtual SvXMLImportContext* implCreateControlWrapper( + sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName) = 0; }; //===================================================================== @@ -423,21 +465,12 @@ namespace xmloff ::com::sun::star::uno::Reference< ::com::sun::star::form::XGridColumnFactory > m_xColumnFactory; - // we fake the attributes our base class gets: we add the attributes of the <form:column> wrapper - // element which encloses us - ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > - m_xOuterAttributes; - public: 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); - // SvXMLImportContext overridables - virtual void StartElement( - const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList); - protected: // OElementImport overridables virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > @@ -447,28 +480,15 @@ namespace xmloff //===================================================================== //= OColumnWrapperImport //===================================================================== - /** helper class importing a <form:column> element. - */ - class OColumnWrapperImport : public SvXMLImportContext + class OColumnWrapperImport : public OControlWrapperImport { - protected: - ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > - m_xOwnAttributes; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > - m_xParentContainer; - IFormsImportContext& m_rFormImport; - IEventAttacherManager& m_rEventManager; - public: 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 - virtual SvXMLImportContext* CreateChildContext( + protected: + virtual OControlImport* implCreateChildContext( sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName, - const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList); - virtual void StartElement( - const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList); + OControlElement::ElementType _eType); }; //===================================================================== @@ -487,9 +507,8 @@ namespace xmloff protected: // OContainerImport overridables - virtual SvXMLImportContext* implCreateControlChild( - sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName, - OControlElement::ElementType _eType); + virtual SvXMLImportContext* implCreateControlWrapper( + sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName); }; //===================================================================== @@ -513,9 +532,8 @@ namespace xmloff 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, - OControlElement::ElementType _eType); + virtual SvXMLImportContext* implCreateControlWrapper( + sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName); // OPropertyImport overridables virtual void handleAttribute(sal_uInt16 _nNamespaceKey, @@ -539,6 +557,9 @@ namespace xmloff /************************************************************************* * history: * $Log: not supported by cvs2svn $ + * Revision 1.5 2001/01/02 15:58:21 fs + * event ex- & import + * * Revision 1.4 2000/12/18 15:14:35 fs * some changes ... now exporting/importing styles * diff --git a/xmloff/source/forms/elementimport_impl.hxx b/xmloff/source/forms/elementimport_impl.hxx index 659fbd84662f..a97187dd5969 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.3 $ + * $Revision: 1.4 $ * - * last change: $Author: fs $ $Date: 2001-01-02 15:58:21 $ + * last change: $Author: fs $ $Date: 2001-01-03 16:25:34 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -78,14 +78,14 @@ SvXMLImportContext* OContainerImport< BASE >::CreateChildContext( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList) { // maybe it's a sub control - OControlElement::ElementType eType = OElementNameMap::getElementType(_rLocalName); - if (OControlElement::UNKNOWN != eType) - { + if (_rLocalName == m_sWrapperElementName) if (m_xMeAsContainer.is()) - return implCreateControlChild(_nPrefix, _rLocalName, eType); + return implCreateControlWrapper(_nPrefix, _rLocalName); else + { OSL_ENSURE(sal_False, "OContainerImport::CreateChildContext: don't have an element!"); - } + return NULL; + } return BASE::CreateChildContext(_nPrefix, _rLocalName, _rxAttrList); } @@ -134,26 +134,11 @@ OColumnImport< BASE >::OColumnImport(IFormsImportContext& _rImport, IEventAttach const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxOuterAttribs) :BASE(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer, _eType) ,m_xColumnFactory(_rxParentContainer, ::com::sun::star::uno::UNO_QUERY) - ,m_xOuterAttributes(_rxOuterAttribs) { OSL_ENSURE(m_xColumnFactory.is(), "OColumnImport::OColumnImport: invalid parent container (no factory)!"); } //------------------------------------------------------------------------- -template <class BASE> -void OColumnImport< BASE >::StartElement(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttrList) -{ - // merge the attribute lists - OAttribListMerger* pMerger = new OAttribListMerger; - // our own one - pMerger->addList(_rxAttrList); - // and the ones of our enclosing element - pMerger->addList(m_xOuterAttributes); - ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > xMerger = pMerger; - BASE::StartElement(xMerger); -} - -//------------------------------------------------------------------------- // OElementImport overridables template <class BASE> ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > OColumnImport< BASE >::createElement() @@ -172,6 +157,9 @@ template <class BASE> /************************************************************************* * history: * $Log: not supported by cvs2svn $ + * Revision 1.3 2001/01/02 15:58:21 fs + * event ex- & import + * * 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) * diff --git a/xmloff/source/forms/formattributes.cxx b/xmloff/source/forms/formattributes.cxx index 1cf4dd5d0814..3e57140d6b12 100644 --- a/xmloff/source/forms/formattributes.cxx +++ b/xmloff/source/forms/formattributes.cxx @@ -2,9 +2,9 @@ * * $RCSfile: formattributes.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: fs $ $Date: 2000-12-12 12:01:05 $ + * last change: $Author: fs $ $Date: 2001-01-03 16:25:34 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -93,7 +93,7 @@ namespace xmloff case CCA_NAME: return "name"; case CCA_SERVICE_NAME: return "service-name"; case CCA_BUTTON_TYPE: return "button-type"; - case CCA_CONTROL_ID: return "control-id"; + case CCA_CONTROL_ID: return "id"; case CCA_CURRENT_SELECTED: return "current-selected"; case CCA_CURRENT_VALUE: return "current-value"; case CCA_DISABLED: return "disabled"; @@ -207,7 +207,7 @@ namespace xmloff case SCA_MIN_VALUE: return "min-value"; case SCA_VALIDATION: return "validation"; case SCA_MULTI_LINE: return "multi-line"; - case SCA_AUTOMATIC_COMPLETION: return "automatic-completion"; + case SCA_AUTOMATIC_COMPLETION: return "auto-complete"; case SCA_MULTIPLE: return "multiple"; case SCA_DEFAULT_BUTTON: return "default-button"; case SCA_CURRENT_STATE: return "current-state"; @@ -320,6 +320,9 @@ namespace xmloff /************************************************************************* * history: * $Log: not supported by cvs2svn $ + * Revision 1.4 2000/12/12 12:01:05 fs + * new implementations for the import - still under construction + * * Revision 1.3 2000/12/06 17:28:05 fs * changes for the formlayer import - still under construction * diff --git a/xmloff/source/forms/makefile.mk b/xmloff/source/forms/makefile.mk index d70d9e57eac3..e6ef0c7814ad 100644 --- a/xmloff/source/forms/makefile.mk +++ b/xmloff/source/forms/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.6 $ +# $Revision: 1.7 $ # -# last change: $Author: fs $ $Date: 2001-01-02 15:56:57 $ +# last change: $Author: fs $ $Date: 2001-01-03 16:25:34 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -85,15 +85,15 @@ CXXFILES = \ valueproperties.cxx \ attriblistmerge.cxx \ controlelement.cxx \ + formlayerexport.cxx \ + layerexport.cxx \ + elementexport.cxx \ + propertyexport.cxx \ elementimport.cxx \ layerimport.cxx \ propertyimport.cxx \ formlayerimport.cxx \ - formlayerexport.cxx \ - layerexport.cxx \ - elementexport.cxx \ formattributes.cxx \ - propertyexport.cxx \ formenums.cxx \ strings.cxx @@ -106,15 +106,15 @@ SLOFILES = \ $(SLO)$/valueproperties.obj \ $(SLO)$/attriblistmerge.obj \ $(SLO)$/controlelement.obj \ + $(SLO)$/formlayerexport.obj \ + $(SLO)$/layerexport.obj \ + $(SLO)$/elementexport.obj \ + $(SLO)$/propertyexport.obj \ $(SLO)$/elementimport.obj \ $(SLO)$/layerimport.obj \ $(SLO)$/propertyimport.obj \ $(SLO)$/formlayerimport.obj \ - $(SLO)$/formlayerexport.obj \ - $(SLO)$/layerexport.obj \ - $(SLO)$/elementexport.obj \ $(SLO)$/formattributes.obj \ - $(SLO)$/propertyexport.obj \ $(SLO)$/formenums.obj \ $(SLO)$/strings.obj diff --git a/xmloff/source/forms/propertyexport.cxx b/xmloff/source/forms/propertyexport.cxx index 8e491cbe679f..391a26fe1ee3 100644 --- a/xmloff/source/forms/propertyexport.cxx +++ b/xmloff/source/forms/propertyexport.cxx @@ -2,9 +2,9 @@ * * $RCSfile: propertyexport.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: fs $ $Date: 2000-12-18 15:14:35 $ + * last change: $Author: fs $ $Date: 2001-01-03 16:25:34 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -82,12 +82,6 @@ #ifndef _OSL_DIAGNOSE_H_ #include <osl/diagnose.h> #endif -#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ -#include <com/sun/star/lang/XServiceInfo.hpp> -#endif -#ifndef _COM_SUN_STAR_IO_XPERSISTOBJECT_HPP_ -#include <com/sun/star/io/XPersistObject.hpp> -#endif #ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ #include <com/sun/star/beans/PropertyAttribute.hpp> #endif @@ -134,7 +128,6 @@ namespace xmloff { //......................................................................... - using namespace ::com::sun::star::io; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; @@ -518,67 +511,6 @@ namespace xmloff } //--------------------------------------------------------------------- - void OPropertyExport::exportServiceNameAttribute() - { - Reference< XPersistObject > xPersistence(m_xProps, UNO_QUERY); - if (!xPersistence.is()) - { - OSL_ENSURE(sal_False, "OPropertyExport::exportServiceNameAttribute: no XPersistObject!"); - return; - } - - ::rtl::OUString sServiceName = xPersistence->getServiceName(); - // we don't want to write the old service name directly: it's a name used for compatibility reasons, but - // as we start some kind of new file format here (with this xml export), we don't care about - // compatibility ... - // So we translate the old persistence service name into new ones, if possible - - ::rtl::OUString sToWriteServiceName = sServiceName; -#define CHECK_N_TRANSLATE( name ) \ - else if (0 == sServiceName.compareToAscii(SERVICE_PERSISTENT_COMPONENT_##name)) \ - sToWriteServiceName = SERVICE_##name - - if (sal_False) - ; - CHECK_N_TRANSLATE( FORM ); - CHECK_N_TRANSLATE( FORM ); - CHECK_N_TRANSLATE( LISTBOX ); - CHECK_N_TRANSLATE( COMBOBOX ); - CHECK_N_TRANSLATE( RADIOBUTTON ); - CHECK_N_TRANSLATE( GROUPBOX ); - CHECK_N_TRANSLATE( FIXEDTEXT ); - CHECK_N_TRANSLATE( COMMANDBUTTON ); - CHECK_N_TRANSLATE( CHECKBOX ); - CHECK_N_TRANSLATE( GRID ); - CHECK_N_TRANSLATE( IMAGEBUTTON ); - CHECK_N_TRANSLATE( FILECONTROL ); - CHECK_N_TRANSLATE( TIMEFIELD ); - CHECK_N_TRANSLATE( DATEFIELD ); - CHECK_N_TRANSLATE( NUMERICFIELD ); - CHECK_N_TRANSLATE( CURRENCYFIELD ); - CHECK_N_TRANSLATE( PATTERNFIELD ); - CHECK_N_TRANSLATE( HIDDENCONTROL ); - CHECK_N_TRANSLATE( IMAGECONTROL ); - CHECK_N_TRANSLATE( FORMATTEDFIELD ); - else if (0 == sServiceName.compareToAscii(SERVICE_PERSISTENT_COMPONENT_EDIT)) - { // special handling for the edit field: we have to controls using this as persistence service name - sToWriteServiceName = SERVICE_EDIT; - Reference< XServiceInfo > xSI(m_xProps, UNO_QUERY); - if (xSI.is() && xSI->supportsService(SERVICE_FORMATTEDFIELD)) - sToWriteServiceName = SERVICE_FORMATTEDFIELD; - } -#ifdef DBG_UTIL - Reference< XServiceInfo > xSI(m_xProps, UNO_QUERY); - OSL_ENSURE(xSI.is() && xSI->supportsService(sToWriteServiceName), - "OPropertyExport::exportServiceNameAttribute: wrong service name translation!"); - -#endif - - // now write this - AddAttribute(XML_NAMESPACE_FORM, "service-name", sToWriteServiceName); - } - - //--------------------------------------------------------------------- void OPropertyExport::exportGenericPropertyAttribute( const sal_uInt16 _nAttributeNamespaceKey, const sal_Char* _pAttributeName, const sal_Char* _pPropertyName) { @@ -820,6 +752,9 @@ namespace xmloff /************************************************************************* * history: * $Log: not supported by cvs2svn $ + * Revision 1.8 2000/12/18 15:14:35 fs + * some changes ... now exporting/importing styles + * * Revision 1.7 2000/12/18 13:25:01 mib * #82036#: new graphic properties * diff --git a/xmloff/source/forms/propertyexport.hxx b/xmloff/source/forms/propertyexport.hxx index d3d13e3d9bfc..490ff91e37db 100644 --- a/xmloff/source/forms/propertyexport.hxx +++ b/xmloff/source/forms/propertyexport.hxx @@ -2,9 +2,9 @@ * * $RCSfile: propertyexport.hxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: mib $ $Date: 2001-01-03 11:08:56 $ + * last change: $Author: fs $ $Date: 2001-01-03 16:25:34 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -234,10 +234,6 @@ namespace xmloff // some very special methods for some very special attribute/property pairs - /** add the service-name attribute to the export context - */ - void exportServiceNameAttribute(); - /** add the hlink:xref attribute to the export context. <p>The value of this attribute is extracted from the TargetFrame property of the object given.</p> @@ -400,6 +396,9 @@ namespace xmloff /************************************************************************* * history: * $Log: not supported by cvs2svn $ + * Revision 1.8 2001/01/03 11:08:56 mib + * syntax + * * Revision 1.7 2001/01/02 15:58:22 fs * event ex- & import * |