2000-11-17 18:03:33 +00:00
|
|
|
|
/*************************************************************************
|
|
|
|
|
*
|
|
|
|
|
* $RCSfile: elementexport.cxx,v $
|
|
|
|
|
*
|
2001-06-25 12:32:38 +00:00
|
|
|
|
* $Revision: 1.18 $
|
2000-11-17 18:03:33 +00:00
|
|
|
|
*
|
2001-06-25 12:32:38 +00:00
|
|
|
|
* last change: $Author: fs $ $Date: 2001-06-25 13:32:38 $
|
2000-11-17 18:03:33 +00:00
|
|
|
|
*
|
|
|
|
|
* The Contents of this file are made available subject to the terms of
|
|
|
|
|
* either of the following licenses
|
|
|
|
|
*
|
|
|
|
|
* - GNU Lesser General Public License Version 2.1
|
|
|
|
|
* - Sun Industry Standards Source License Version 1.1
|
|
|
|
|
*
|
|
|
|
|
* Sun Microsystems Inc., October, 2000
|
|
|
|
|
*
|
|
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
|
* =============================================
|
|
|
|
|
* Copyright 2000 by Sun Microsystems, Inc.
|
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
|
|
|
|
*
|
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
|
|
|
|
*
|
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
|
* MA 02111-1307 USA
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* Sun Industry Standards Source License Version 1.1
|
|
|
|
|
* =================================================
|
|
|
|
|
* The contents of this file are subject to the Sun Industry Standards
|
|
|
|
|
* Source License Version 1.1 (the "License"); You may not use this file
|
|
|
|
|
* except in compliance with the License. You may obtain a copy of the
|
|
|
|
|
* License at http://www.openoffice.org/license.html.
|
|
|
|
|
*
|
|
|
|
|
* Software provided under this License is provided on an "AS IS" basis,
|
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
|
|
|
|
|
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
|
|
|
|
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
|
|
|
|
* See the License for the specific provisions governing your rights and
|
|
|
|
|
* obligations concerning the Software.
|
|
|
|
|
*
|
|
|
|
|
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
|
|
|
|
*
|
|
|
|
|
* Copyright: 2000 by Sun Microsystems, Inc.
|
|
|
|
|
*
|
|
|
|
|
* All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Contributor(s): _______________________________________
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
************************************************************************/
|
|
|
|
|
|
2000-11-29 09:36:05 +00:00
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
2000-11-17 18:03:33 +00:00
|
|
|
|
#ifndef _XMLOFF_ELEMENTEXPORT_HXX_
|
|
|
|
|
#include "elementexport.hxx"
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef _XMLOFF_FORMS_STRINGS_HXX_
|
|
|
|
|
#include "strings.hxx"
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef _XMLOFF_XMLEXP_HXX
|
|
|
|
|
#include "xmlexp.hxx"
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef _XMLOFF_NMSPMAP_HXX
|
|
|
|
|
#include "nmspmap.hxx"
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef _XMLOFF_XMLNMSPE_HXX
|
|
|
|
|
#include "xmlnmspe.hxx"
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef _XMLOFF_XMLUCONV_HXX
|
|
|
|
|
#include "xmluconv.hxx"
|
|
|
|
|
#endif
|
2001-03-16 13:37:07 +00:00
|
|
|
|
#ifndef _COMPHELPER_EXTRACT_HXX_
|
|
|
|
|
#include <comphelper/extract.hxx>
|
2000-11-17 18:03:33 +00:00
|
|
|
|
#endif
|
2001-01-02 14:58:22 +00:00
|
|
|
|
#ifndef _XMLOFF_FORMS_EVENTEXPORT_HXX_
|
|
|
|
|
#include "eventexport.hxx"
|
|
|
|
|
#endif
|
2001-01-03 15:25:34 +00:00
|
|
|
|
#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
|
2000-11-17 18:03:33 +00:00
|
|
|
|
#ifndef _COM_SUN_STAR_FORM_FORMCOMPONENTTYPE_HPP_
|
|
|
|
|
#include <com/sun/star/form/FormComponentType.hpp>
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
|
|
|
|
|
#include <com/sun/star/beans/PropertyAttribute.hpp>
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef _XMLOFF_FORMENUMS_HXX_
|
|
|
|
|
#include "formenums.hxx"
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef _COM_SUN_STAR_FORM_FORMSUBMITENCODING_HPP_
|
|
|
|
|
#include <com/sun/star/form/FormSubmitEncoding.hpp>
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef _COM_SUN_STAR_FORM_FORMSUBMITMETHOD_HPP_
|
|
|
|
|
#include <com/sun/star/form/FormSubmitMethod.hpp>
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_
|
|
|
|
|
#include <com/sun/star/sdb/CommandType.hpp>
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef _COM_SUN_STAR_FORM_NAVIGATIONBARMODE_HPP_
|
|
|
|
|
#include <com/sun/star/form/NavigationBarMode.hpp>
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef _COM_SUN_STAR_FORM_TABULATORCYCLE_HPP_
|
|
|
|
|
#include <com/sun/star/form/TabulatorCycle.hpp>
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef _COM_SUN_STAR_FORM_FORMBUTTONTYPE_HPP_
|
|
|
|
|
#include <com/sun/star/form/FormButtonType.hpp>
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef _COM_SUN_STAR_FORM_LISTSOURCETYPE_HPP_
|
|
|
|
|
#include <com/sun/star/form/ListSourceType.hpp>
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef _SV_WINTYPES_HXX
|
|
|
|
|
#include <vcl/wintypes.hxx> // for check states
|
|
|
|
|
#endif
|
2001-01-02 14:58:22 +00:00
|
|
|
|
#ifndef _XMLOFF_XMLEVENTEXPORT_HXX
|
|
|
|
|
#include "XMLEventExport.hxx"
|
|
|
|
|
#endif
|
2000-11-17 18:03:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//.........................................................................
|
|
|
|
|
namespace xmloff
|
|
|
|
|
{
|
|
|
|
|
//.........................................................................
|
|
|
|
|
|
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
|
using namespace ::com::sun::star::sdb;
|
|
|
|
|
using namespace ::com::sun::star::form;
|
|
|
|
|
using namespace ::com::sun::star::lang;
|
|
|
|
|
using namespace ::com::sun::star::lang;
|
|
|
|
|
using namespace ::com::sun::star::beans;
|
|
|
|
|
using namespace ::com::sun::star::container;
|
2001-01-02 14:58:22 +00:00
|
|
|
|
using namespace ::com::sun::star::script;
|
2001-01-03 15:25:34 +00:00
|
|
|
|
using namespace ::com::sun::star::io;
|
2000-11-17 18:03:33 +00:00
|
|
|
|
|
|
|
|
|
//=====================================================================
|
2001-01-02 14:58:22 +00:00
|
|
|
|
//= OElementExport
|
2000-11-17 18:03:33 +00:00
|
|
|
|
//=====================================================================
|
2001-01-02 14:58:22 +00:00
|
|
|
|
OElementExport::OElementExport(IFormsExportContext& _rContext, const Reference< XPropertySet >& _rxProps,
|
|
|
|
|
const Sequence< ScriptEventDescriptor >& _rEvents)
|
|
|
|
|
:OPropertyExport(_rContext, _rxProps)
|
|
|
|
|
,m_aEvents(_rEvents)
|
2000-11-17 18:03:33 +00:00
|
|
|
|
,m_pXMLElement(NULL)
|
2000-11-19 14:41:32 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
2001-01-02 14:58:22 +00:00
|
|
|
|
OElementExport::~OElementExport()
|
2000-11-17 18:03:33 +00:00
|
|
|
|
{
|
2001-01-02 14:58:22 +00:00
|
|
|
|
implEndElement();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
|
void OElementExport::doExport()
|
|
|
|
|
{
|
|
|
|
|
// collect some general information about the element
|
2000-11-17 18:03:33 +00:00
|
|
|
|
examine();
|
|
|
|
|
|
2001-01-02 14:58:22 +00:00
|
|
|
|
// first add the attributes necessary for the element
|
|
|
|
|
m_rContext.getGlobalContext().ClearAttrList();
|
|
|
|
|
|
|
|
|
|
// add the attributes
|
|
|
|
|
exportAttributes();
|
|
|
|
|
|
|
|
|
|
// start the XML element
|
|
|
|
|
implStartElement(getXMLElementName());
|
2000-11-19 14:41:32 +00:00
|
|
|
|
|
|
|
|
|
// the sub elements (mostly control type dependent)
|
|
|
|
|
exportSubTags();
|
2001-01-02 14:58:22 +00:00
|
|
|
|
|
|
|
|
|
implEndElement();
|
2000-11-17 18:03:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
2001-01-02 14:58:22 +00:00
|
|
|
|
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()
|
2000-11-17 18:03:33 +00:00
|
|
|
|
{
|
|
|
|
|
delete m_pXMLElement;
|
2001-01-02 14:58:22 +00:00
|
|
|
|
m_pXMLElement = NULL;
|
2000-11-17 18:03:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-01-03 15:25:34 +00:00
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
2000-11-17 18:03:33 +00:00
|
|
|
|
//---------------------------------------------------------------------
|
2001-01-02 14:58:22 +00:00
|
|
|
|
void OElementExport::exportEvents()
|
2000-11-17 18:03:33 +00:00
|
|
|
|
{
|
2001-01-02 14:58:22 +00:00
|
|
|
|
if (!m_aEvents.getLength())
|
|
|
|
|
// nothing to do
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
Reference< XNameReplace > xWrapper = new OEventDescriptorMapper(m_aEvents);
|
|
|
|
|
m_rContext.getGlobalContext().GetEventExport().Export(xWrapper);
|
|
|
|
|
}
|
2000-11-17 18:03:33 +00:00
|
|
|
|
|
2001-01-02 14:58:22 +00:00
|
|
|
|
//=====================================================================
|
|
|
|
|
//= 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)
|
2001-01-03 15:25:34 +00:00
|
|
|
|
,m_pOuterElement(NULL)
|
2001-01-02 14:58:22 +00:00
|
|
|
|
{
|
|
|
|
|
OSL_ENSURE(m_xProps.is(), "OControlExport::OControlExport: invalid arguments!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
2001-01-03 15:25:34 +00:00
|
|
|
|
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()
|
2001-01-02 14:58:22 +00:00
|
|
|
|
{
|
2000-11-19 14:41:32 +00:00
|
|
|
|
// common control attributes
|
2000-11-17 18:03:33 +00:00
|
|
|
|
exportCommonControlAttributes();
|
|
|
|
|
|
2000-11-19 14:41:32 +00:00
|
|
|
|
// common database attributes
|
2000-11-17 18:03:33 +00:00
|
|
|
|
exportDatabaseAttributes();
|
|
|
|
|
|
2000-11-19 14:41:32 +00:00
|
|
|
|
// attributes special to the respective control type
|
2000-11-17 18:03:33 +00:00
|
|
|
|
exportSpecialAttributes();
|
|
|
|
|
|
2000-11-19 14:41:32 +00:00
|
|
|
|
// add the style references to the attributes
|
2001-02-01 08:46:47 +00:00
|
|
|
|
flagStyleProperties();
|
2001-01-03 15:25:34 +00:00
|
|
|
|
}
|
2000-11-19 14:41:32 +00:00
|
|
|
|
|
2001-01-03 15:25:34 +00:00
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
|
void OControlExport::exportAttributes()
|
|
|
|
|
{
|
|
|
|
|
exportOuterAttributes();
|
2000-11-17 18:03:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
2000-11-19 14:41:32 +00:00
|
|
|
|
void OControlExport::exportSubTags() throw (Exception)
|
2000-11-17 18:03:33 +00:00
|
|
|
|
{
|
|
|
|
|
// the ListSource related properties do not need to be exported in a generic way, exportListSourceAsElements
|
|
|
|
|
// will handle this (if necessary)
|
2000-11-19 14:41:32 +00:00
|
|
|
|
exportedProperty(PROPERTY_STRING_ITEM_LIST);
|
|
|
|
|
exportedProperty(PROPERTY_VALUE_SEQ);
|
|
|
|
|
exportedProperty(PROPERTY_SELECT_SEQ);
|
|
|
|
|
exportedProperty(PROPERTY_DEFAULT_SELECT_SEQ);
|
|
|
|
|
exportedProperty(PROPERTY_LISTSOURCE);
|
|
|
|
|
|
|
|
|
|
// for the upcoming exportRemainingProperties:
|
|
|
|
|
// if a control has the LabelControl property, this is not stored with the control itself, but instead with
|
|
|
|
|
// the control which is referenced by this property. As the base class' exportRemainingProperties doesn't
|
|
|
|
|
// know anything about this, we need to prevent that it tries to export this property
|
|
|
|
|
exportedProperty(PROPERTY_CONTROLLABEL);
|
2000-11-17 18:03:33 +00:00
|
|
|
|
|
2001-01-02 14:58:22 +00:00
|
|
|
|
// let the base class export the remaining properties and the events
|
|
|
|
|
OElementExport::exportSubTags();
|
2000-11-17 18:03:33 +00:00
|
|
|
|
|
|
|
|
|
// special sub tags for some controls
|
|
|
|
|
switch (m_eType)
|
|
|
|
|
{
|
|
|
|
|
case LISTBOX:
|
|
|
|
|
// a list box description has sub elements: the options
|
|
|
|
|
exportListSourceAsElements();
|
|
|
|
|
break;
|
|
|
|
|
case GRID:
|
|
|
|
|
{ // a grid control requires us to store all columns as sub elements
|
2000-11-19 14:41:32 +00:00
|
|
|
|
Reference< XIndexAccess > xColumnContainer(m_xProps, UNO_QUERY);
|
|
|
|
|
OSL_ENSURE(xColumnContainer.is(), "OControlExport::exportSubTags: a grid control which is no IndexAccess?!!");
|
|
|
|
|
if (xColumnContainer.is())
|
2000-12-18 14:14:35 +00:00
|
|
|
|
m_rContext.exportCollectionElements(xColumnContainer);
|
2000-11-17 18:03:33 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case COMBOBOX:
|
|
|
|
|
{ // a combox box description has sub elements: the items
|
|
|
|
|
DBG_CHECK_PROPERTY((const sal_Char*)PROPERTY_STRING_ITEM_LIST, Sequence< ::rtl::OUString >);
|
|
|
|
|
|
|
|
|
|
// get the item list
|
|
|
|
|
Sequence< ::rtl::OUString > aListItems;
|
|
|
|
|
m_xProps->getPropertyValue(PROPERTY_STRING_ITEM_LIST) >>= aListItems;
|
|
|
|
|
// loop through it and write the sub elements
|
|
|
|
|
const ::rtl::OUString* pListItems = aListItems.getConstArray();
|
|
|
|
|
for (sal_Int32 i=0; i<aListItems.getLength(); ++i, ++pListItems)
|
|
|
|
|
{
|
2000-12-18 14:14:35 +00:00
|
|
|
|
m_rContext.getGlobalContext().ClearAttrList();
|
2000-11-17 18:03:33 +00:00
|
|
|
|
AddAttribute(
|
|
|
|
|
getCommonControlAttributeNamespace(CCA_LABEL),
|
|
|
|
|
getCommonControlAttributeName(CCA_LABEL),
|
|
|
|
|
*pListItems);
|
2000-12-18 14:14:35 +00:00
|
|
|
|
SvXMLElementExport aFormElement(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, "item", sal_True, sal_True);
|
2000-11-17 18:03:33 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
|
void OControlExport::exportCommonControlAttributes()
|
|
|
|
|
{
|
|
|
|
|
sal_Int32 i=0;
|
|
|
|
|
|
|
|
|
|
// I decided to handle all the properties here with some static arrays describing the property-attribute
|
|
|
|
|
// relations. This leads to somewhat ugly code :), but the only alternative I can think of right now
|
|
|
|
|
// would require maps and O(log n) searches, which seems somewhat expensive as this code is used
|
|
|
|
|
// very frequently.
|
|
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------
|
2000-11-19 14:41:32 +00:00
|
|
|
|
// some string properties
|
2000-11-17 18:03:33 +00:00
|
|
|
|
{
|
|
|
|
|
// the attribute ids of all properties which are expected to be of type string
|
|
|
|
|
static sal_Int32 nStringPropertyAttributeIds[] =
|
|
|
|
|
{
|
2001-06-25 12:32:38 +00:00
|
|
|
|
CCA_IMAGE_DATA, CCA_LABEL, CCA_TITLE
|
2000-11-17 18:03:33 +00:00
|
|
|
|
};
|
|
|
|
|
// the names of all properties which are expected to be of type string
|
|
|
|
|
static const sal_Char* pStringPropertyNames[] =
|
|
|
|
|
{
|
2001-06-25 12:32:38 +00:00
|
|
|
|
PROPERTY_IMAGEURL, PROPERTY_LABEL, PROPERTY_TITLE
|
2000-11-17 18:03:33 +00:00
|
|
|
|
};
|
|
|
|
|
OSL_ENSURE( sizeof(pStringPropertyNames)/sizeof(pStringPropertyNames[0]) ==
|
|
|
|
|
sizeof(nStringPropertyAttributeIds)/sizeof(nStringPropertyAttributeIds[0]),
|
|
|
|
|
"OControlExport::exportCommonControlAttributes: somebody tampered with the maps (1)!");
|
|
|
|
|
|
|
|
|
|
for (i=0; i<sizeof(nStringPropertyAttributeIds)/sizeof(nStringPropertyAttributeIds[0]); ++i)
|
|
|
|
|
if (nStringPropertyAttributeIds[i] & m_nIncludeCommon)
|
|
|
|
|
{
|
2000-11-19 14:41:32 +00:00
|
|
|
|
exportStringPropertyAttribute(
|
2000-11-17 18:03:33 +00:00
|
|
|
|
getCommonControlAttributeNamespace(nStringPropertyAttributeIds[i]),
|
|
|
|
|
getCommonControlAttributeName(nStringPropertyAttributeIds[i]),
|
|
|
|
|
pStringPropertyNames[i]
|
|
|
|
|
);
|
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
|
// reset the bit for later checking
|
|
|
|
|
m_nIncludeCommon = m_nIncludeCommon & ~nStringPropertyAttributeIds[i];
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
// some boolean properties
|
|
|
|
|
{
|
|
|
|
|
static sal_Int32 nBooleanPropertyAttributeIds[] =
|
|
|
|
|
{ // attribute flags
|
|
|
|
|
CCA_CURRENT_SELECTED, CCA_DISABLED, CCA_DROPDOWN, CCA_PRINTABLE, CCA_READONLY, CCA_SELECTED, CCA_TAB_STOP
|
|
|
|
|
};
|
|
|
|
|
static const sal_Char* pBooleanPropertyNames[] =
|
|
|
|
|
{ // property names
|
|
|
|
|
PROPERTY_STATE, PROPERTY_ENABLED, PROPERTY_DROPDOWN, PROPERTY_PRINTABLE, PROPERTY_READONLY, PROPERTY_DEFAULT_STATE, PROPERTY_TABSTOP
|
|
|
|
|
};
|
2001-03-29 11:19:43 +00:00
|
|
|
|
static sal_Bool nBooleanPropertyAttrFlags[] =
|
2000-11-17 18:03:33 +00:00
|
|
|
|
{ // attribute defaults
|
2001-03-29 11:19:43 +00:00
|
|
|
|
BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_FALSE | BOOLATTR_INVERSE_SEMANTICS, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_VOID
|
2000-11-17 18:03:33 +00:00
|
|
|
|
};
|
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
|
sal_Int32 nIdCount = sizeof(nBooleanPropertyAttributeIds) / sizeof(nBooleanPropertyAttributeIds[0]);
|
|
|
|
|
sal_Int32 nNameCount = sizeof(pBooleanPropertyNames) / sizeof(pBooleanPropertyNames[0]);
|
2001-03-29 11:19:43 +00:00
|
|
|
|
sal_Int32 nFlagsCount = sizeof(nBooleanPropertyAttrFlags) / sizeof(nBooleanPropertyAttrFlags[0]);
|
|
|
|
|
OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nFlagsCount),
|
2000-11-17 18:03:33 +00:00
|
|
|
|
"OControlExport::exportCommonControlAttributes: somebody tampered with the maps (2)!");
|
|
|
|
|
#endif
|
|
|
|
|
for (i=0; i<sizeof(nBooleanPropertyAttributeIds)/sizeof(nBooleanPropertyAttributeIds[0]); ++i)
|
|
|
|
|
if (nBooleanPropertyAttributeIds[i] & m_nIncludeCommon)
|
|
|
|
|
{
|
2000-11-19 14:41:32 +00:00
|
|
|
|
exportBooleanPropertyAttribute(
|
2000-11-17 18:03:33 +00:00
|
|
|
|
getCommonControlAttributeNamespace(nBooleanPropertyAttributeIds[i]),
|
|
|
|
|
getCommonControlAttributeName(nBooleanPropertyAttributeIds[i]),
|
|
|
|
|
pBooleanPropertyNames[i],
|
2001-03-29 11:19:43 +00:00
|
|
|
|
nBooleanPropertyAttrFlags[i]);
|
2000-11-17 18:03:33 +00:00
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
|
// reset the bit for later checking
|
|
|
|
|
m_nIncludeCommon = m_nIncludeCommon & ~nBooleanPropertyAttributeIds[i];
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
// some integer properties
|
|
|
|
|
{
|
|
|
|
|
static sal_Int32 nIntegerPropertyAttributeIds[] =
|
|
|
|
|
{ // attribute flags
|
|
|
|
|
CCA_MAX_LENGTH, CCA_SIZE, CCA_TAB_INDEX
|
|
|
|
|
};
|
|
|
|
|
static const sal_Char* pIntegerPropertyNames[] =
|
|
|
|
|
{ // property names
|
|
|
|
|
PROPERTY_MAXTEXTLENGTH, PROPERTY_LINECOUNT, PROPERTY_TABINDEX
|
|
|
|
|
};
|
|
|
|
|
static const sal_Int16 nIntegerPropertyAttrDefaults[] =
|
|
|
|
|
{ // attribute defaults
|
|
|
|
|
0, 5, 0
|
|
|
|
|
};
|
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
|
sal_Int32 nIdCount = sizeof(nIntegerPropertyAttributeIds) / sizeof(nIntegerPropertyAttributeIds[0]);
|
|
|
|
|
sal_Int32 nNameCount = sizeof(pIntegerPropertyNames) / sizeof(pIntegerPropertyNames[0]);
|
|
|
|
|
sal_Int32 nDefaultCount = sizeof(nIntegerPropertyAttrDefaults) / sizeof(nIntegerPropertyAttrDefaults[0]);
|
|
|
|
|
OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nDefaultCount),
|
|
|
|
|
"OControlExport::exportCommonControlAttributes: somebody tampered with the maps (3)!");
|
|
|
|
|
#endif
|
|
|
|
|
for (i=0; i<sizeof(nIntegerPropertyAttributeIds)/sizeof(nIntegerPropertyAttributeIds[0]); ++i)
|
|
|
|
|
if (nIntegerPropertyAttributeIds[i] & m_nIncludeCommon)
|
|
|
|
|
{
|
2000-11-19 14:41:32 +00:00
|
|
|
|
exportInt16PropertyAttribute(
|
2000-11-17 18:03:33 +00:00
|
|
|
|
getCommonControlAttributeNamespace(nIntegerPropertyAttributeIds[i]),
|
|
|
|
|
getCommonControlAttributeName(nIntegerPropertyAttributeIds[i]),
|
|
|
|
|
pIntegerPropertyNames[i],
|
|
|
|
|
nIntegerPropertyAttrDefaults[i]);
|
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
|
// reset the bit for later checking
|
|
|
|
|
m_nIncludeCommon = m_nIncludeCommon & ~nIntegerPropertyAttributeIds[i];
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
// some enum properties
|
|
|
|
|
{
|
|
|
|
|
// (only one a at the moment)
|
|
|
|
|
if (m_nIncludeCommon & CCA_BUTTON_TYPE)
|
|
|
|
|
{
|
2000-11-19 14:41:32 +00:00
|
|
|
|
exportEnumPropertyAttribute(
|
2000-11-17 18:03:33 +00:00
|
|
|
|
getCommonControlAttributeNamespace(CCA_BUTTON_TYPE),
|
|
|
|
|
getCommonControlAttributeName(CCA_BUTTON_TYPE),
|
|
|
|
|
PROPERTY_BUTTONTYPE,
|
|
|
|
|
OEnumMapper::getEnumMap(OEnumMapper::epButtonType),
|
|
|
|
|
FormButtonType_PUSH);
|
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
|
// reset the bit for later checking
|
|
|
|
|
m_nIncludeCommon = m_nIncludeCommon & ~CCA_BUTTON_TYPE;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
|
// some properties which require a special handling
|
|
|
|
|
|
|
|
|
|
// the target frame
|
|
|
|
|
if (m_nIncludeCommon & CCA_TARGET_FRAME)
|
|
|
|
|
{
|
2000-11-19 14:41:32 +00:00
|
|
|
|
exportTargetFrameAttribute();
|
2000-11-17 18:03:33 +00:00
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
|
// reset the bit for later checking
|
|
|
|
|
m_nIncludeCommon = m_nIncludeCommon & ~CCA_TARGET_FRAME;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-25 12:32:38 +00:00
|
|
|
|
if (m_nIncludeCommon & CCA_TARGET_LOCATION)
|
|
|
|
|
{
|
|
|
|
|
exportTargetLocationAttribute();
|
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
|
// reset the bit for later checking
|
|
|
|
|
m_nIncludeCommon = m_nIncludeCommon & ~CCA_TARGET_LOCATION;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2000-11-17 18:03:33 +00:00
|
|
|
|
// the for attribute
|
|
|
|
|
// the target frame
|
|
|
|
|
if (m_nIncludeCommon & CCA_FOR)
|
|
|
|
|
{
|
|
|
|
|
if (m_sReferringControls.getLength())
|
|
|
|
|
{ // there is at least one control referring to the one we're handling currently
|
|
|
|
|
AddAttribute(
|
|
|
|
|
getCommonControlAttributeNamespace(CCA_FOR),
|
|
|
|
|
getCommonControlAttributeName(CCA_FOR),
|
|
|
|
|
m_sReferringControls);
|
|
|
|
|
}
|
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
|
// reset the bit for later checking
|
|
|
|
|
m_nIncludeCommon = m_nIncludeCommon & ~CCA_FOR;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((CCA_CURRENT_VALUE | CCA_VALUE) & m_nIncludeCommon)
|
|
|
|
|
{
|
|
|
|
|
const sal_Char* pCurrentValuePropertyName = NULL;
|
|
|
|
|
const sal_Char* pValuePropertyName = NULL;
|
|
|
|
|
|
|
|
|
|
// get the property names
|
2000-12-13 09:38:10 +00:00
|
|
|
|
getValuePropertyNames(m_eType, m_nClassId, pCurrentValuePropertyName, pValuePropertyName);
|
2000-11-17 18:03:33 +00:00
|
|
|
|
|
|
|
|
|
static const sal_Char* pCurrentValueAttributeName = getCommonControlAttributeName(CCA_CURRENT_VALUE);
|
|
|
|
|
static const sal_Char* pValueAttributeName = getCommonControlAttributeName(CCA_VALUE);
|
|
|
|
|
static const sal_uInt16 nCurrentValueAttributeNamespaceKey = getCommonControlAttributeNamespace(CCA_CURRENT_VALUE);
|
|
|
|
|
static const sal_uInt16 nValueAttributeNamespaceKey = getCommonControlAttributeNamespace(CCA_VALUE);
|
|
|
|
|
|
|
|
|
|
// add the atrtributes if necessary and possible
|
|
|
|
|
if (pCurrentValuePropertyName && (CCA_CURRENT_VALUE & m_nIncludeCommon))
|
2000-11-19 14:41:32 +00:00
|
|
|
|
exportGenericPropertyAttribute(
|
2000-11-17 18:03:33 +00:00
|
|
|
|
nCurrentValueAttributeNamespaceKey,
|
|
|
|
|
pCurrentValueAttributeName,
|
|
|
|
|
pCurrentValuePropertyName);
|
|
|
|
|
|
|
|
|
|
if (pValuePropertyName && (CCA_VALUE & m_nIncludeCommon))
|
2000-11-19 14:41:32 +00:00
|
|
|
|
exportGenericPropertyAttribute(
|
2000-11-17 18:03:33 +00:00
|
|
|
|
nValueAttributeNamespaceKey,
|
|
|
|
|
pValueAttributeName,
|
|
|
|
|
pValuePropertyName);
|
|
|
|
|
|
|
|
|
|
OSL_ENSURE((NULL == pValuePropertyName) == (0 == (CCA_VALUE & m_nIncludeCommon)),
|
|
|
|
|
"OControlExport::exportCommonControlAttributes: no property found for the value attribute!");
|
|
|
|
|
OSL_ENSURE((NULL == pCurrentValuePropertyName ) == (0 == (CCA_CURRENT_VALUE & m_nIncludeCommon)),
|
|
|
|
|
"OControlExport::exportCommonControlAttributes: no property found for the current-value attribute!");
|
2000-11-19 14:41:32 +00:00
|
|
|
|
|
2000-11-17 18:03:33 +00:00
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
|
// reset the bit for later checking
|
|
|
|
|
m_nIncludeCommon = m_nIncludeCommon & ~(CCA_CURRENT_VALUE | CCA_VALUE);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OSL_ENSURE(0 == m_nIncludeCommon,
|
|
|
|
|
"OControlExport::exportCommonControlAttributes: forgot some flags!");
|
|
|
|
|
// in the dbg_util version, we should have removed every bit we handled from the mask, so it should
|
|
|
|
|
// be 0 now ...
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
|
void OControlExport::exportDatabaseAttributes()
|
|
|
|
|
{
|
|
|
|
|
// the only string property: DataField
|
|
|
|
|
if (DA_DATA_FIELD & m_nIncludeDatabase)
|
|
|
|
|
{
|
2000-11-19 14:41:32 +00:00
|
|
|
|
exportStringPropertyAttribute(
|
2000-11-17 18:03:33 +00:00
|
|
|
|
getDatabaseAttributeNamespace(DA_DATA_FIELD),
|
|
|
|
|
getDatabaseAttributeName(DA_DATA_FIELD),
|
|
|
|
|
PROPERTY_DATAFIELD);
|
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
|
// reset the bit for later checking
|
|
|
|
|
m_nIncludeDatabase = m_nIncludeDatabase & ~DA_DATA_FIELD;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// the only int16 property: BoundColumn
|
|
|
|
|
if (DA_BOUND_COLUMN & m_nIncludeDatabase)
|
|
|
|
|
{
|
2000-11-19 14:41:32 +00:00
|
|
|
|
exportInt16PropertyAttribute(
|
2000-11-17 18:03:33 +00:00
|
|
|
|
getDatabaseAttributeNamespace(DA_BOUND_COLUMN),
|
|
|
|
|
getDatabaseAttributeName(DA_BOUND_COLUMN),
|
|
|
|
|
PROPERTY_BOUNDCOLUMN,
|
|
|
|
|
0);
|
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
|
// reset the bit for later checking
|
|
|
|
|
m_nIncludeDatabase = m_nIncludeDatabase & ~DA_BOUND_COLUMN;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// the only boolean property: ConvertEmptyToNull
|
|
|
|
|
if (DA_CONVERT_EMPTY & m_nIncludeDatabase)
|
|
|
|
|
{
|
2000-11-19 14:41:32 +00:00
|
|
|
|
exportBooleanPropertyAttribute(
|
2000-11-17 18:03:33 +00:00
|
|
|
|
getDatabaseAttributeNamespace(DA_CONVERT_EMPTY),
|
|
|
|
|
getDatabaseAttributeName(DA_CONVERT_EMPTY),
|
|
|
|
|
PROPERTY_EMPTY_IS_NULL,
|
2001-03-29 11:19:43 +00:00
|
|
|
|
BOOLATTR_DEFAULT_FALSE
|
2000-11-17 18:03:33 +00:00
|
|
|
|
);
|
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
|
// reset the bit for later checking
|
|
|
|
|
m_nIncludeDatabase = m_nIncludeDatabase & ~DA_CONVERT_EMPTY;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// the only enum property: ListSourceType
|
|
|
|
|
if (DA_LIST_SOURCE_TYPE & m_nIncludeDatabase)
|
|
|
|
|
{
|
2000-11-19 14:41:32 +00:00
|
|
|
|
exportEnumPropertyAttribute(
|
2000-11-17 18:03:33 +00:00
|
|
|
|
getDatabaseAttributeNamespace(DA_LIST_SOURCE_TYPE),
|
|
|
|
|
getDatabaseAttributeName(DA_LIST_SOURCE_TYPE),
|
|
|
|
|
PROPERTY_LISTSOURCETYPE,
|
|
|
|
|
OEnumMapper::getEnumMap(OEnumMapper::epListSourceType),
|
|
|
|
|
ListSourceType_VALUELIST
|
|
|
|
|
);
|
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
|
// reset the bit for later checking
|
|
|
|
|
m_nIncludeDatabase = m_nIncludeDatabase & ~DA_LIST_SOURCE_TYPE;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (m_nIncludeDatabase & DA_LIST_SOURCE)
|
|
|
|
|
{
|
|
|
|
|
exportListSourceAsAttribute();
|
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
|
// reset the bit for later checking
|
|
|
|
|
m_nIncludeDatabase = m_nIncludeDatabase & ~DA_LIST_SOURCE;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OSL_ENSURE(0 == m_nIncludeDatabase,
|
|
|
|
|
"OControlExport::exportDatabaseAttributes: forgot some flags!");
|
|
|
|
|
// in the dbg_util version, we should have removed every bit we handled from the mask, so it should
|
|
|
|
|
// be 0 now ...
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
|
void OControlExport::exportSpecialAttributes()
|
|
|
|
|
{
|
|
|
|
|
sal_Int32 i=0;
|
|
|
|
|
|
|
|
|
|
// ----------------------
|
|
|
|
|
// the boolean properties
|
|
|
|
|
{
|
|
|
|
|
static sal_Int32 nBooleanPropertyAttributeIds[] =
|
|
|
|
|
{ // attribute flags
|
|
|
|
|
SCA_VALIDATION, SCA_MULTI_LINE, SCA_AUTOMATIC_COMPLETION, SCA_MULTIPLE, SCA_DEFAULT_BUTTON, SCA_IS_TRISTATE
|
|
|
|
|
};
|
|
|
|
|
static const sal_Char* pBooleanPropertyNames[] =
|
|
|
|
|
{ // property names
|
|
|
|
|
PROPERTY_STRICTFORMAT, PROPERTY_MULTILINE, PROPERTY_AUTOCOMPLETE, PROPERTY_MULTISELECTION, PROPERTY_DEFAULTBUTTON, PROPERTY_TRISTATE
|
|
|
|
|
};
|
|
|
|
|
sal_Int32 nIdCount = sizeof(nBooleanPropertyAttributeIds) / sizeof(nBooleanPropertyAttributeIds[0]);
|
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
|
sal_Int32 nNameCount = sizeof(pBooleanPropertyNames) / sizeof(pBooleanPropertyNames[0]);
|
2001-03-29 11:19:43 +00:00
|
|
|
|
OSL_ENSURE((nIdCount == nNameCount),
|
2000-11-17 18:03:33 +00:00
|
|
|
|
"OControlExport::exportSpecialAttributes: somebody tampered with the maps (1)!");
|
|
|
|
|
#endif
|
|
|
|
|
for (i=0; i<nIdCount; ++i)
|
|
|
|
|
if (nBooleanPropertyAttributeIds[i] & m_nIncludeSpecial)
|
|
|
|
|
{
|
2000-11-19 14:41:32 +00:00
|
|
|
|
exportBooleanPropertyAttribute(
|
2000-11-17 18:03:33 +00:00
|
|
|
|
getSpecialAttributeNamespace(nBooleanPropertyAttributeIds[i]),
|
|
|
|
|
getSpecialAttributeName(nBooleanPropertyAttributeIds[i]),
|
|
|
|
|
pBooleanPropertyNames[i],
|
2001-03-29 11:19:43 +00:00
|
|
|
|
BOOLATTR_DEFAULT_FALSE // all of the attributes are defaulted to "false"
|
|
|
|
|
);
|
2000-11-17 18:03:33 +00:00
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
|
// reset the bit for later checking
|
|
|
|
|
m_nIncludeSpecial = m_nIncludeSpecial & ~nBooleanPropertyAttributeIds[i];
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// -------------------
|
|
|
|
|
// the enum properties
|
|
|
|
|
{
|
|
|
|
|
if (SCA_STATE & m_nIncludeSpecial)
|
|
|
|
|
{
|
2000-11-19 14:41:32 +00:00
|
|
|
|
exportEnumPropertyAttribute(
|
2000-11-17 18:03:33 +00:00
|
|
|
|
getSpecialAttributeNamespace(SCA_STATE),
|
|
|
|
|
getSpecialAttributeName(SCA_STATE),
|
|
|
|
|
PROPERTY_DEFAULT_STATE,
|
|
|
|
|
OEnumMapper::getEnumMap(OEnumMapper::epCheckState),
|
|
|
|
|
STATE_NOCHECK);
|
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
|
// reset the bit for later checking
|
|
|
|
|
m_nIncludeSpecial = m_nIncludeSpecial & ~SCA_STATE;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (SCA_CURRENT_STATE & m_nIncludeSpecial)
|
|
|
|
|
{
|
2000-11-19 14:41:32 +00:00
|
|
|
|
exportEnumPropertyAttribute(
|
2000-11-17 18:03:33 +00:00
|
|
|
|
getSpecialAttributeNamespace(SCA_CURRENT_STATE),
|
|
|
|
|
getSpecialAttributeName(SCA_CURRENT_STATE),
|
|
|
|
|
PROPERTY_STATE,
|
|
|
|
|
OEnumMapper::getEnumMap(OEnumMapper::epCheckState),
|
|
|
|
|
STATE_NOCHECK);
|
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
|
// reset the bit for later checking
|
|
|
|
|
m_nIncludeSpecial = m_nIncludeSpecial & ~SCA_CURRENT_STATE;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ----------------------------------
|
|
|
|
|
// the EchoChar property needs special handling, cause it's a Int16, but must be stored as one-character-string
|
|
|
|
|
{
|
|
|
|
|
if (SCA_ECHO_CHAR & m_nIncludeSpecial)
|
|
|
|
|
{
|
|
|
|
|
DBG_CHECK_PROPERTY((const sal_Char*)PROPERTY_ECHO_CHAR, sal_Int16);
|
|
|
|
|
sal_Int16 nValue(0);
|
|
|
|
|
m_xProps->getPropertyValue(PROPERTY_ECHO_CHAR) >>= nValue;
|
|
|
|
|
if (nValue)
|
|
|
|
|
{
|
|
|
|
|
::rtl::OUString sCharacter(reinterpret_cast<const sal_Unicode*>(&nValue), 1);
|
|
|
|
|
AddAttribute(
|
|
|
|
|
getSpecialAttributeNamespace(SCA_ECHO_CHAR),
|
|
|
|
|
getSpecialAttributeName(SCA_ECHO_CHAR),
|
|
|
|
|
sCharacter);
|
|
|
|
|
}
|
2000-11-19 14:41:32 +00:00
|
|
|
|
exportedProperty(PROPERTY_ECHO_CHAR);
|
2000-11-17 18:03:33 +00:00
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
|
// reset the bit for later checking
|
|
|
|
|
m_nIncludeSpecial = m_nIncludeSpecial & ~SCA_ECHO_CHAR;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((SCA_MIN_VALUE | SCA_MAX_VALUE) & m_nIncludeSpecial)
|
|
|
|
|
{
|
|
|
|
|
// need to export the min value and the max value as attributes
|
|
|
|
|
// It depends on the real type (FormComponentType) of the control, which properties hold these
|
|
|
|
|
// values
|
|
|
|
|
const sal_Char* pMinValuePropertyName = NULL;
|
|
|
|
|
const sal_Char* pMaxValuePropertyName = NULL;
|
2000-12-13 09:38:10 +00:00
|
|
|
|
getValueLimitPropertyNames(m_nClassId, pMinValuePropertyName, pMaxValuePropertyName);
|
|
|
|
|
|
|
|
|
|
OSL_ENSURE((NULL == pMinValuePropertyName) == (0 == (SCA_MIN_VALUE & m_nIncludeSpecial)),
|
|
|
|
|
"OControlExport::exportCommonControlAttributes: no property found for the min value attribute!");
|
|
|
|
|
OSL_ENSURE((NULL == pMaxValuePropertyName) == (0 == (SCA_MAX_VALUE & m_nIncludeSpecial)),
|
|
|
|
|
"OControlExport::exportCommonControlAttributes: no property found for the min value attribute!");
|
|
|
|
|
|
2000-11-17 18:03:33 +00:00
|
|
|
|
// add the two attributes
|
|
|
|
|
static const sal_Char* pMinValueAttributeName = getSpecialAttributeName(SCA_MIN_VALUE);
|
|
|
|
|
static const sal_Char* pMaxValueAttributeName = getSpecialAttributeName(SCA_MAX_VALUE);
|
|
|
|
|
static const sal_uInt16 nMinValueNamespaceKey = getSpecialAttributeNamespace(SCA_MIN_VALUE);
|
|
|
|
|
static const sal_uInt16 nMaxValueNamespaceKey = getSpecialAttributeNamespace(SCA_MAX_VALUE);
|
|
|
|
|
|
|
|
|
|
if (pMinValuePropertyName && (SCA_MIN_VALUE & m_nIncludeSpecial))
|
2000-11-19 14:41:32 +00:00
|
|
|
|
exportGenericPropertyAttribute(
|
2000-11-17 18:03:33 +00:00
|
|
|
|
nMinValueNamespaceKey,
|
|
|
|
|
pMinValueAttributeName,
|
|
|
|
|
pMinValuePropertyName);
|
|
|
|
|
|
|
|
|
|
if (pMaxValuePropertyName && (SCA_MAX_VALUE & m_nIncludeSpecial))
|
2000-11-19 14:41:32 +00:00
|
|
|
|
exportGenericPropertyAttribute(
|
2000-11-17 18:03:33 +00:00
|
|
|
|
nMaxValueNamespaceKey,
|
|
|
|
|
pMaxValueAttributeName,
|
|
|
|
|
pMaxValuePropertyName);
|
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
|
// reset the bit for later checking
|
|
|
|
|
m_nIncludeSpecial = m_nIncludeSpecial & ~(SCA_MIN_VALUE | SCA_MAX_VALUE);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OSL_ENSURE(0 == m_nIncludeSpecial,
|
|
|
|
|
"OControlExport::exportSpecialAttributes: forgot some flags!");
|
|
|
|
|
// in the dbg_util version, we should have removed every bit we handled from the mask, so it should
|
|
|
|
|
// be 0 now ...
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
|
void OControlExport::exportListSourceAsAttribute()
|
|
|
|
|
{
|
|
|
|
|
// DA_LIST_SOURCE needs some special handling
|
|
|
|
|
DBG_CHECK_PROPERTY_NO_TYPE((const sal_Char*)PROPERTY_LISTSOURCE);
|
|
|
|
|
|
|
|
|
|
::rtl::OUString sListSource;
|
|
|
|
|
Any aListSource = m_xProps->getPropertyValue(PROPERTY_LISTSOURCE);
|
|
|
|
|
if (!(aListSource >>= sListSource))
|
|
|
|
|
{
|
|
|
|
|
Sequence< ::rtl::OUString > aListSourceSequence;
|
|
|
|
|
aListSource >>= aListSourceSequence;
|
|
|
|
|
if (aListSourceSequence.getLength())
|
|
|
|
|
sListSource = aListSourceSequence[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sListSource.getLength())
|
|
|
|
|
{ // the ListSource property needs to be exported as attribute, and it is not empty
|
|
|
|
|
AddAttribute(
|
|
|
|
|
getDatabaseAttributeNamespace(DA_LIST_SOURCE),
|
|
|
|
|
getDatabaseAttributeName(DA_LIST_SOURCE),
|
|
|
|
|
sListSource);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
|
void OControlExport::getSequenceInt16PropertyAsSet(const ::rtl::OUString& _rPropertyName, Int16Set& _rOut)
|
|
|
|
|
{
|
|
|
|
|
Sequence< sal_Int16 > aValueSequence;
|
|
|
|
|
DBG_CHECK_PROPERTY(_rPropertyName, Sequence< sal_Int16 >);
|
|
|
|
|
m_xProps->getPropertyValue(_rPropertyName) >>= aValueSequence;
|
|
|
|
|
|
|
|
|
|
const sal_Int16* pValues = aValueSequence.getConstArray();
|
|
|
|
|
for (sal_Int32 i=0; i<aValueSequence.getLength(); ++i, ++pValues)
|
|
|
|
|
_rOut.insert(*pValues);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
|
void OControlExport::exportListSourceAsElements()
|
|
|
|
|
{
|
|
|
|
|
// the string lists
|
|
|
|
|
Sequence< ::rtl::OUString > aItems, aValues;
|
|
|
|
|
DBG_CHECK_PROPERTY((const sal_Char*)PROPERTY_STRING_ITEM_LIST, Sequence< ::rtl::OUString >);
|
|
|
|
|
m_xProps->getPropertyValue(PROPERTY_STRING_ITEM_LIST) >>= aItems;
|
|
|
|
|
|
2000-12-06 16:28:05 +00:00
|
|
|
|
DBG_CHECK_PROPERTY((const sal_Char*)PROPERTY_LISTSOURCE, Sequence< ::rtl::OUString >);
|
|
|
|
|
m_xProps->getPropertyValue(PROPERTY_LISTSOURCE) >>= aValues;
|
2000-11-17 18:03:33 +00:00
|
|
|
|
|
|
|
|
|
// the selection lists
|
|
|
|
|
Int16Set aSelection, aDefaultSelection;
|
|
|
|
|
getSequenceInt16PropertyAsSet(PROPERTY_SELECT_SEQ, aSelection);
|
|
|
|
|
getSequenceInt16PropertyAsSet(PROPERTY_DEFAULT_SELECT_SEQ, aDefaultSelection);
|
|
|
|
|
|
|
|
|
|
// the string for "true" and "false"
|
|
|
|
|
::rtl::OUString sTrue;
|
|
|
|
|
::rtl::OUStringBuffer sBuffer;
|
2000-12-18 14:14:35 +00:00
|
|
|
|
m_rContext.getGlobalContext().GetMM100UnitConverter().convertBool(sBuffer, sal_True);
|
2000-11-17 18:03:33 +00:00
|
|
|
|
sTrue = sBuffer.makeStringAndClear();
|
|
|
|
|
|
|
|
|
|
// loop through both lists ('til the maximum of both lengths)
|
|
|
|
|
const ::rtl::OUString* pItems = aItems.getConstArray();
|
|
|
|
|
const ::rtl::OUString* pValues = aValues.getConstArray();
|
2001-05-21 12:33:04 +00:00
|
|
|
|
|
2000-11-17 18:03:33 +00:00
|
|
|
|
sal_Int32 nItems = aItems.getLength();
|
|
|
|
|
sal_Int32 nValues = aValues.getLength();
|
2001-05-21 12:33:04 +00:00
|
|
|
|
|
|
|
|
|
sal_Int16 nMaxLen = (sal_Int16)max(nItems, nValues);
|
|
|
|
|
|
|
|
|
|
for (sal_Int16 i=0; i<nMaxLen; ++i )
|
2000-11-17 18:03:33 +00:00
|
|
|
|
{
|
2000-12-18 14:14:35 +00:00
|
|
|
|
m_rContext.getGlobalContext().ClearAttrList();
|
2000-11-17 18:03:33 +00:00
|
|
|
|
if (i < nItems)
|
2001-05-21 12:33:04 +00:00
|
|
|
|
{
|
2000-11-17 18:03:33 +00:00
|
|
|
|
// there is an item at this position
|
|
|
|
|
AddAttribute(
|
|
|
|
|
getCommonControlAttributeNamespace(CCA_LABEL),
|
|
|
|
|
getCommonControlAttributeName(CCA_LABEL),
|
|
|
|
|
*pItems);
|
2001-05-21 12:33:04 +00:00
|
|
|
|
++pItems;
|
|
|
|
|
}
|
2000-11-17 18:03:33 +00:00
|
|
|
|
if (i < nValues)
|
2001-05-21 12:33:04 +00:00
|
|
|
|
{
|
2000-11-17 18:03:33 +00:00
|
|
|
|
// there is an value at this position
|
|
|
|
|
AddAttribute(
|
|
|
|
|
getCommonControlAttributeNamespace(CCA_VALUE),
|
|
|
|
|
getCommonControlAttributeName(CCA_VALUE),
|
|
|
|
|
*pValues);
|
2001-05-21 12:33:04 +00:00
|
|
|
|
++pValues;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Int16SetIterator aSelectedPos = aSelection.find(i);
|
|
|
|
|
if (aSelection.end() != aSelectedPos)
|
2000-11-17 18:03:33 +00:00
|
|
|
|
{ // the item at this position is selected
|
|
|
|
|
AddAttribute(
|
|
|
|
|
getCommonControlAttributeNamespace(CCA_CURRENT_SELECTED),
|
|
|
|
|
getCommonControlAttributeName(CCA_CURRENT_SELECTED),
|
|
|
|
|
sTrue
|
|
|
|
|
);
|
2001-05-21 12:33:04 +00:00
|
|
|
|
aSelection.erase(aSelectedPos);
|
2000-11-17 18:03:33 +00:00
|
|
|
|
}
|
2001-05-21 12:33:04 +00:00
|
|
|
|
|
|
|
|
|
Int16SetIterator aDefaultSelectedPos = aDefaultSelection.find(i);
|
|
|
|
|
if (aDefaultSelection.end() != aDefaultSelectedPos)
|
2000-11-17 18:03:33 +00:00
|
|
|
|
{ // the item at this position is selected as default
|
|
|
|
|
AddAttribute(
|
|
|
|
|
getCommonControlAttributeNamespace(CCA_SELECTED),
|
|
|
|
|
getCommonControlAttributeName(CCA_SELECTED),
|
|
|
|
|
sTrue
|
|
|
|
|
);
|
2001-05-21 12:33:04 +00:00
|
|
|
|
aDefaultSelection.erase(aDefaultSelectedPos);
|
2000-11-17 18:03:33 +00:00
|
|
|
|
}
|
2000-12-18 14:14:35 +00:00
|
|
|
|
SvXMLElementExport aFormElement(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, "option", sal_True, sal_True);
|
2000-11-17 18:03:33 +00:00
|
|
|
|
}
|
2001-05-21 12:33:04 +00:00
|
|
|
|
|
|
|
|
|
// There may be more "selected" or "default-selected" items than there are in the lists in real,
|
|
|
|
|
// so we need to store some additional "form:option" items which have no name and no label, but
|
|
|
|
|
// one or both of the selected flags.
|
|
|
|
|
// 21.05.2001 - 85388 - frank.schoenheit@germany.sun.com
|
|
|
|
|
|
|
|
|
|
if (aSelection.size() || aDefaultSelection.size())
|
|
|
|
|
{
|
|
|
|
|
sal_Int16 nLastSelected = -1;
|
|
|
|
|
if (aSelection.size())
|
|
|
|
|
nLastSelected = *(--aSelection.end());
|
|
|
|
|
|
|
|
|
|
sal_Int16 nLastDefaultSelected = -1;
|
|
|
|
|
if (aDefaultSelection.size())
|
|
|
|
|
nLastDefaultSelected = *(--aDefaultSelection.end());
|
|
|
|
|
|
|
|
|
|
// the maximum element in both sets
|
|
|
|
|
sal_Int16 nLastReferredEntry = max(nLastSelected, nLastDefaultSelected);
|
2001-06-14 12:39:35 +00:00
|
|
|
|
OSL_ENSURE(nLastReferredEntry >= nMaxLen, "OControlExport::exportListSourceAsElements: inconsistence!");
|
2001-05-21 12:33:04 +00:00
|
|
|
|
// if the maximum (selected or default selected) entry number is less than the maximum item count
|
|
|
|
|
// in both lists, the entry number should have been removed from the set
|
|
|
|
|
|
|
|
|
|
for (sal_Int16 i=nMaxLen; i<=nLastReferredEntry; ++i)
|
|
|
|
|
{
|
|
|
|
|
if (aSelection.end() != aSelection.find(i))
|
|
|
|
|
{ // the (not existent) item at this position is selected
|
|
|
|
|
AddAttribute(
|
|
|
|
|
getCommonControlAttributeNamespace(CCA_CURRENT_SELECTED),
|
|
|
|
|
getCommonControlAttributeName(CCA_CURRENT_SELECTED),
|
|
|
|
|
sTrue
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (aDefaultSelection.end() != aDefaultSelection.find(i))
|
|
|
|
|
{ // the (not existent) item at this position is selected as default
|
|
|
|
|
AddAttribute(
|
|
|
|
|
getCommonControlAttributeNamespace(CCA_SELECTED),
|
|
|
|
|
getCommonControlAttributeName(CCA_SELECTED),
|
|
|
|
|
sTrue
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
SvXMLElementExport aFormElement(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, "option", sal_True, sal_True);
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-11-17 18:03:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-01-03 15:25:34 +00:00
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
|
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";
|
|
|
|
|
}
|
|
|
|
|
|
2001-01-02 14:58:22 +00:00
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
|
const sal_Char* OControlExport::getXMLElementName() const
|
|
|
|
|
{
|
|
|
|
|
return getElementName(m_eType);
|
|
|
|
|
}
|
|
|
|
|
|
2000-11-17 18:03:33 +00:00
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
|
void OControlExport::examine()
|
|
|
|
|
{
|
|
|
|
|
// get the class id to decide which kind of element we need in the XML stream
|
|
|
|
|
m_nClassId = FormComponentType::CONTROL;
|
|
|
|
|
DBG_CHECK_PROPERTY((const sal_Char*)PROPERTY_CLASSID, sal_Int16);
|
|
|
|
|
m_xProps->getPropertyValue(PROPERTY_CLASSID) >>= m_nClassId;
|
|
|
|
|
switch (m_nClassId)
|
|
|
|
|
{
|
|
|
|
|
case FormComponentType::DATEFIELD:
|
|
|
|
|
case FormComponentType::TIMEFIELD:
|
|
|
|
|
case FormComponentType::NUMERICFIELD:
|
|
|
|
|
case FormComponentType::CURRENCYFIELD:
|
|
|
|
|
case FormComponentType::PATTERNFIELD:
|
|
|
|
|
m_eType = FORMATTED_TEXT;
|
|
|
|
|
// NO BREAK
|
|
|
|
|
case FormComponentType::TEXTFIELD:
|
2000-11-19 14:41:32 +00:00
|
|
|
|
{ // it's some kind of edit. To know which type we need further investigation
|
2000-11-17 18:03:33 +00:00
|
|
|
|
|
|
|
|
|
if (FORMATTED_TEXT != m_eType)
|
|
|
|
|
{ // not coming from the presious cases which had a class id .ne. TEXTFIELD
|
|
|
|
|
|
|
|
|
|
// check if it's a formatted field
|
2000-11-19 14:41:32 +00:00
|
|
|
|
if (m_xPropertyInfo->hasPropertyByName(PROPERTY_FORMATKEY))
|
2000-11-17 18:03:33 +00:00
|
|
|
|
{
|
|
|
|
|
m_eType = FORMATTED_TEXT;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// all other controls are represented by an ordinary edit control, but which XML control type
|
|
|
|
|
// it is depends on the current values of some properties
|
|
|
|
|
|
|
|
|
|
// if the EchoChar string is not empty, it is a password field
|
|
|
|
|
sal_Int16 nEchoChar = 0;
|
2000-11-19 14:41:32 +00:00
|
|
|
|
if (m_xPropertyInfo->hasPropertyByName(PROPERTY_ECHOCHAR))
|
|
|
|
|
// grid columns do not have this property ....
|
|
|
|
|
m_xProps->getPropertyValue(PROPERTY_ECHOCHAR) >>= nEchoChar;
|
2000-11-17 18:03:33 +00:00
|
|
|
|
if (nEchoChar)
|
|
|
|
|
{
|
|
|
|
|
m_eType = PASSWORD;
|
|
|
|
|
m_nIncludeSpecial |= SCA_ECHO_CHAR;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// if the MultiLine property is sal_True, it is a TextArea
|
2000-11-19 14:41:32 +00:00
|
|
|
|
sal_Bool bMultiLine = sal_False;
|
|
|
|
|
if (m_xPropertyInfo->hasPropertyByName(PROPERTY_MULTILINE))
|
|
|
|
|
// grid columns do not have this property ....
|
|
|
|
|
bMultiLine = ::cppu::any2bool(m_xProps->getPropertyValue(PROPERTY_MULTILINE));
|
2000-11-17 18:03:33 +00:00
|
|
|
|
if (bMultiLine)
|
|
|
|
|
m_eType = TEXT_AREA;
|
|
|
|
|
else
|
|
|
|
|
// the only case left is represented by a Text element
|
|
|
|
|
m_eType = TEXT;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// attributes which are common to all the four types:
|
|
|
|
|
// common attributes
|
|
|
|
|
m_nIncludeCommon =
|
|
|
|
|
CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED |
|
|
|
|
|
CCA_PRINTABLE | CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE |
|
|
|
|
|
CCA_VALUE;
|
|
|
|
|
// database attributes
|
|
|
|
|
m_nIncludeDatabase = DA_DATA_FIELD;
|
|
|
|
|
// event attributes
|
|
|
|
|
m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE | EA_ON_SELECT;
|
|
|
|
|
|
|
|
|
|
// only text and pattern fields have a ConvertEmptyToNull property
|
|
|
|
|
if ((m_nClassId == FormComponentType::TEXTFIELD) || (m_nClassId == FormComponentType::PATTERNFIELD))
|
2000-11-19 14:41:32 +00:00
|
|
|
|
m_nIncludeDatabase |= DA_CONVERT_EMPTY;
|
2000-11-17 18:03:33 +00:00
|
|
|
|
|
|
|
|
|
// all controls but the file control fields have a readonly property
|
|
|
|
|
if (m_nClassId != FormComponentType::FILECONTROL)
|
|
|
|
|
m_nIncludeCommon |= CCA_READONLY;
|
|
|
|
|
|
|
|
|
|
// a text field has a max text len
|
|
|
|
|
if (m_nClassId == FormComponentType::TEXTFIELD)
|
|
|
|
|
m_nIncludeCommon |= CCA_MAX_LENGTH;
|
|
|
|
|
|
2000-12-13 09:38:10 +00:00
|
|
|
|
// max and min values and validation:
|
2000-11-17 18:03:33 +00:00
|
|
|
|
if (FORMATTED_TEXT == m_eType)
|
2000-12-13 09:38:10 +00:00
|
|
|
|
{ // in general all control represented as formatted-text have these props
|
|
|
|
|
if (FormComponentType::PATTERNFIELD != m_nClassId)
|
|
|
|
|
// but the PatternField does not have value limits
|
|
|
|
|
m_nIncludeSpecial |= SCA_MAX_VALUE | SCA_MIN_VALUE;
|
|
|
|
|
|
|
|
|
|
if (FormComponentType::TEXTFIELD != m_nClassId)
|
|
|
|
|
// and the FormattedField does not have a validation flag
|
|
|
|
|
m_nIncludeSpecial |= SCA_VALIDATION;
|
|
|
|
|
}
|
2000-11-17 18:03:33 +00:00
|
|
|
|
|
|
|
|
|
// if it's not a password field, the CurrentValue needs to be stored, too
|
|
|
|
|
if (PASSWORD != m_eType)
|
|
|
|
|
m_nIncludeCommon |= CCA_CURRENT_VALUE;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FormComponentType::FILECONTROL:
|
|
|
|
|
m_eType = FILE;
|
|
|
|
|
m_nIncludeCommon =
|
|
|
|
|
CCA_NAME | CCA_SERVICE_NAME | CCA_CURRENT_VALUE | CCA_DISABLED |
|
|
|
|
|
CCA_PRINTABLE | CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE |
|
|
|
|
|
CCA_VALUE;
|
|
|
|
|
m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE | EA_ON_SELECT;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FormComponentType::FIXEDTEXT:
|
|
|
|
|
m_eType = FIXED_TEXT;
|
|
|
|
|
m_nIncludeCommon =
|
|
|
|
|
CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_LABEL |
|
|
|
|
|
CCA_PRINTABLE | CCA_TITLE | CCA_FOR;
|
|
|
|
|
m_nIncludeSpecial = SCA_MULTI_LINE;
|
|
|
|
|
m_nIncludeEvents = EA_CONTROL_EVENTS;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FormComponentType::COMBOBOX:
|
|
|
|
|
m_eType = COMBOBOX;
|
|
|
|
|
m_nIncludeCommon =
|
|
|
|
|
CCA_NAME | CCA_SERVICE_NAME | CCA_CURRENT_VALUE |
|
|
|
|
|
CCA_DISABLED | CCA_DROPDOWN | CCA_MAX_LENGTH | CCA_PRINTABLE | CCA_READONLY | CCA_SIZE |
|
2000-11-19 14:41:32 +00:00
|
|
|
|
CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE | CCA_VALUE;
|
2000-11-17 18:03:33 +00:00
|
|
|
|
m_nIncludeSpecial = SCA_AUTOMATIC_COMPLETION;
|
|
|
|
|
m_nIncludeDatabase = DA_CONVERT_EMPTY | DA_DATA_FIELD | DA_LIST_SOURCE | DA_LIST_SOURCE_TYPE;
|
|
|
|
|
m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE | EA_ON_SELECT;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FormComponentType::LISTBOX:
|
|
|
|
|
m_eType = LISTBOX;
|
|
|
|
|
m_nIncludeCommon =
|
|
|
|
|
CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_DROPDOWN |
|
|
|
|
|
CCA_PRINTABLE | CCA_SIZE | CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE;
|
|
|
|
|
m_nIncludeSpecial = SCA_MULTIPLE;
|
|
|
|
|
m_nIncludeDatabase = DA_BOUND_COLUMN | DA_DATA_FIELD | DA_LIST_SOURCE_TYPE;
|
|
|
|
|
m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE | EA_ON_CLICK | EA_ON_DBLCLICK;
|
|
|
|
|
// check if we need to export the ListSource as attribute
|
|
|
|
|
{
|
|
|
|
|
// for a list box, if the ListSourceType is VALUE_LIST, no ListSource is stored, but instead
|
|
|
|
|
// a sequence of pairs which is build from the StringItemList and the ValueList
|
|
|
|
|
ListSourceType eListSourceType = ListSourceType_VALUELIST;
|
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
|
sal_Bool bSuccess =
|
|
|
|
|
#endif
|
|
|
|
|
m_xProps->getPropertyValue(PROPERTY_LISTSOURCETYPE) >>= eListSourceType;
|
2000-12-18 12:25:02 +00:00
|
|
|
|
#ifdef DBG_UTIL
|
2000-11-17 18:03:33 +00:00
|
|
|
|
OSL_ENSURE(bSuccess, "OControlExport::examineControl: could not retrieve the ListSourceType!");
|
2000-12-18 12:25:02 +00:00
|
|
|
|
#endif
|
2000-11-17 18:03:33 +00:00
|
|
|
|
if (ListSourceType_VALUELIST != eListSourceType)
|
|
|
|
|
{
|
|
|
|
|
m_nIncludeDatabase |= DA_LIST_SOURCE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FormComponentType::COMMANDBUTTON:
|
|
|
|
|
m_eType = BUTTON;
|
2000-11-19 14:41:32 +00:00
|
|
|
|
m_nIncludeCommon |= CCA_TAB_STOP | CCA_LABEL;
|
2000-11-17 18:03:33 +00:00
|
|
|
|
m_nIncludeSpecial = SCA_DEFAULT_BUTTON;
|
|
|
|
|
// NO BREAK !
|
|
|
|
|
case FormComponentType::IMAGEBUTTON:
|
|
|
|
|
if (BUTTON != m_eType)
|
|
|
|
|
// not coming from the previous case
|
|
|
|
|
m_eType = IMAGE;
|
|
|
|
|
m_nIncludeCommon |=
|
|
|
|
|
CCA_NAME | CCA_SERVICE_NAME | CCA_BUTTON_TYPE | CCA_DISABLED |
|
|
|
|
|
CCA_IMAGE_DATA | CCA_PRINTABLE | CCA_TAB_INDEX | CCA_TARGET_FRAME |
|
|
|
|
|
CCA_TARGET_LOCATION | CCA_TITLE;
|
|
|
|
|
m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CLICK | EA_ON_DBLCLICK;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FormComponentType::CHECKBOX:
|
|
|
|
|
m_eType = CHECKBOX;
|
|
|
|
|
m_nIncludeSpecial = SCA_CURRENT_STATE | SCA_IS_TRISTATE | SCA_STATE;
|
|
|
|
|
// NO BREAK !
|
|
|
|
|
case FormComponentType::RADIOBUTTON:
|
|
|
|
|
m_nIncludeCommon =
|
|
|
|
|
CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_LABEL |
|
|
|
|
|
CCA_PRINTABLE | CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE | CCA_VALUE;
|
|
|
|
|
if (CHECKBOX != m_eType)
|
|
|
|
|
{ // not coming from the previous case
|
|
|
|
|
m_eType = RADIO;
|
|
|
|
|
m_nIncludeCommon |= CCA_CURRENT_SELECTED | CCA_SELECTED;
|
|
|
|
|
}
|
|
|
|
|
m_nIncludeDatabase = DA_DATA_FIELD;
|
|
|
|
|
m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FormComponentType::GROUPBOX:
|
|
|
|
|
m_eType = FRAME;
|
|
|
|
|
m_nIncludeCommon =
|
|
|
|
|
CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_LABEL |
|
|
|
|
|
CCA_PRINTABLE | CCA_TITLE | CCA_FOR;
|
|
|
|
|
m_nIncludeEvents = EA_CONTROL_EVENTS;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FormComponentType::IMAGECONTROL:
|
|
|
|
|
m_eType = IMAGE_FRAME;
|
|
|
|
|
m_nIncludeCommon =
|
|
|
|
|
CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_IMAGE_DATA |
|
|
|
|
|
CCA_PRINTABLE | CCA_READONLY | CCA_TITLE;
|
|
|
|
|
m_nIncludeDatabase = DA_DATA_FIELD;
|
|
|
|
|
m_nIncludeEvents = EA_CONTROL_EVENTS;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FormComponentType::HIDDENCONTROL:
|
|
|
|
|
m_eType = HIDDEN;
|
|
|
|
|
m_nIncludeCommon =
|
|
|
|
|
CCA_NAME | CCA_SERVICE_NAME | CCA_VALUE;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FormComponentType::GRIDCONTROL:
|
|
|
|
|
m_eType = GRID;
|
|
|
|
|
m_nIncludeCommon =
|
|
|
|
|
CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_PRINTABLE |
|
|
|
|
|
CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE;
|
|
|
|
|
m_nIncludeEvents = EA_CONTROL_EVENTS;
|
|
|
|
|
break;
|
|
|
|
|
|
2000-11-19 14:41:32 +00:00
|
|
|
|
case FormComponentType::CONTROL:
|
2001-01-03 15:25:34 +00:00
|
|
|
|
m_eType = GENERIC_CONTROL;
|
2000-11-19 14:41:32 +00:00
|
|
|
|
// 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
|
|
|
|
|
// inserted into it's parent container
|
|
|
|
|
// In addition, the service name is absolutely necessary to create the control upon reading.
|
|
|
|
|
m_nIncludeEvents = EA_CONTROL_EVENTS;
|
|
|
|
|
// we always should be able to export events - this is not control type dependent
|
|
|
|
|
break;
|
2000-11-17 18:03:33 +00:00
|
|
|
|
default:
|
2001-03-21 15:54:38 +00:00
|
|
|
|
OSL_ENSURE(sal_False, "OControlExport::examineControl: unknown control type (class id)!");
|
2000-11-17 18:03:33 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2000-11-19 14:41:32 +00:00
|
|
|
|
|
|
|
|
|
// in general, all control types need to export the control id
|
|
|
|
|
m_nIncludeCommon |= CCA_CONTROL_ID;
|
2000-11-17 18:03:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-11-19 14:41:32 +00:00
|
|
|
|
//=====================================================================
|
|
|
|
|
//= OColumnExport
|
|
|
|
|
//=====================================================================
|
|
|
|
|
//---------------------------------------------------------------------
|
2001-01-02 14:58:22 +00:00
|
|
|
|
OColumnExport::OColumnExport(IFormsExportContext& _rContext, const Reference< XPropertySet >& _rxControl,
|
|
|
|
|
const Sequence< ScriptEventDescriptor >& _rEvents)
|
|
|
|
|
:OControlExport(_rContext, _rxControl, ::rtl::OUString(), ::rtl::OUString(), _rEvents)
|
2000-11-19 14:41:32 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
|
OColumnExport::~OColumnExport()
|
|
|
|
|
{
|
2001-01-02 14:58:22 +00:00
|
|
|
|
implEndElement();
|
2000-11-19 14:41:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
2001-01-03 15:25:34 +00:00
|
|
|
|
void OColumnExport::exportServiceNameAttribute()
|
2000-11-19 14:41:32 +00:00
|
|
|
|
{
|
|
|
|
|
// the attribute "service name" (which has a slightly different meaning for columns
|
|
|
|
|
DBG_CHECK_PROPERTY((const sal_Char*)PROPERTY_COLUMNSERVICENAME, ::rtl::OUString);
|
2000-12-13 09:38:10 +00:00
|
|
|
|
::rtl::OUString sColumnServiceName;
|
|
|
|
|
m_xProps->getPropertyValue(PROPERTY_COLUMNSERVICENAME) >>= sColumnServiceName;
|
|
|
|
|
// the service name is a full qualified one (i.e. com.sun.star.form.TextField), but the
|
|
|
|
|
// real service name for the column (for use with the XGridColumnFactory) is only the last
|
|
|
|
|
// token of this complete name.
|
|
|
|
|
sal_Int32 nLastSep = sColumnServiceName.lastIndexOf('.');
|
|
|
|
|
OSL_ENSURE(-1 != nLastSep, "OColumnExport::startExportElement: invalid service name!");
|
|
|
|
|
sColumnServiceName = sColumnServiceName.copy(nLastSep + 1);
|
|
|
|
|
// add the attribute
|
|
|
|
|
AddAttribute(getCommonControlAttributeNamespace(CCA_SERVICE_NAME), getCommonControlAttributeName(CCA_SERVICE_NAME), sColumnServiceName);
|
|
|
|
|
// flag the property as "handled"
|
|
|
|
|
exportedProperty(PROPERTY_COLUMNSERVICENAME);
|
2000-11-19 14:41:32 +00:00
|
|
|
|
|
2001-01-03 15:25:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
|
const sal_Char* OColumnExport::getOuterXMLElementName() const
|
|
|
|
|
{
|
|
|
|
|
return "column";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
|
void OColumnExport::exportAttributes()
|
|
|
|
|
{
|
|
|
|
|
OControlExport::exportAttributes();
|
|
|
|
|
|
2000-11-19 14:41:32 +00:00
|
|
|
|
// the attribute "label"
|
|
|
|
|
exportStringPropertyAttribute(
|
|
|
|
|
getCommonControlAttributeNamespace(CCA_LABEL),
|
|
|
|
|
getCommonControlAttributeName(CCA_LABEL),
|
|
|
|
|
PROPERTY_LABEL);
|
2001-01-03 15:25:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
|
void OColumnExport::examine()
|
|
|
|
|
{
|
|
|
|
|
OControlExport::examine();
|
2000-11-19 14:41:32 +00:00
|
|
|
|
|
2001-01-03 15:25:34 +00:00
|
|
|
|
// 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);
|
2000-11-19 14:41:32 +00:00
|
|
|
|
|
2001-01-03 15:25:34 +00:00
|
|
|
|
if (FormComponentType::DATEFIELD != m_nClassId)
|
|
|
|
|
// except date fields, no column has the DropDown property
|
|
|
|
|
m_nIncludeCommon &= ~CCA_DROPDOWN;
|
2000-11-19 14:41:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-11-17 18:03:33 +00:00
|
|
|
|
//=====================================================================
|
|
|
|
|
//= OFormExport
|
|
|
|
|
//=====================================================================
|
|
|
|
|
//---------------------------------------------------------------------
|
2001-01-02 14:58:22 +00:00
|
|
|
|
OFormExport::OFormExport(IFormsExportContext& _rContext, const Reference< XPropertySet >& _rxForm,
|
|
|
|
|
const Sequence< ScriptEventDescriptor >& _rEvents)
|
|
|
|
|
:OElementExport(_rContext, _rxForm, _rEvents)
|
2000-11-17 18:03:33 +00:00
|
|
|
|
{
|
2000-12-18 14:14:35 +00:00
|
|
|
|
OSL_ENSURE(m_xProps.is(), "OFormExport::OFormExport: invalid arguments!");
|
2001-01-02 14:58:22 +00:00
|
|
|
|
}
|
2000-11-17 18:03:33 +00:00
|
|
|
|
|
2001-01-02 14:58:22 +00:00
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
|
const sal_Char* OFormExport::getXMLElementName() const
|
|
|
|
|
{
|
|
|
|
|
return "form";
|
|
|
|
|
}
|
2000-11-17 18:03:33 +00:00
|
|
|
|
|
2001-01-02 14:58:22 +00:00
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
|
void OFormExport::exportSubTags()
|
|
|
|
|
{
|
|
|
|
|
// let the base class export the remaining properties and the events
|
|
|
|
|
OElementExport::exportSubTags();
|
2000-11-17 18:03:33 +00:00
|
|
|
|
|
|
|
|
|
// loop through all children
|
|
|
|
|
Reference< XIndexAccess > xCollection(m_xProps, UNO_QUERY);
|
|
|
|
|
OSL_ENSURE(xCollection.is(), "OFormLayerXMLExport::implExportForm: a form which is not an index access? Suspic<69>ous!");
|
|
|
|
|
|
2000-12-18 14:14:35 +00:00
|
|
|
|
if (xCollection.is())
|
|
|
|
|
m_rContext.exportCollectionElements(xCollection);
|
2000-11-17 18:03:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
|
void OFormExport::exportAttributes()
|
|
|
|
|
{
|
|
|
|
|
sal_Int32 i=0;
|
|
|
|
|
|
|
|
|
|
// ---------------------
|
|
|
|
|
// the string properties
|
|
|
|
|
{
|
|
|
|
|
static FormAttributes eStringPropertyIds[] =
|
|
|
|
|
{
|
|
|
|
|
faName, faAction, faCommand, faDatasource, faFilter, faOrder
|
|
|
|
|
};
|
|
|
|
|
static const sal_Char* pStringPropertyNames[] =
|
|
|
|
|
{
|
|
|
|
|
PROPERTY_NAME, PROPERTY_TARGETURL, PROPERTY_COMMAND, PROPERTY_DATASOURCENAME, PROPERTY_FILTER, PROPERTY_ORDER
|
|
|
|
|
};
|
|
|
|
|
sal_Int32 nIdCount = sizeof(eStringPropertyIds) / sizeof(eStringPropertyIds[0]);
|
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
|
sal_Int32 nNameCount = sizeof(pStringPropertyNames) / sizeof(pStringPropertyNames[0]);
|
|
|
|
|
OSL_ENSURE((nIdCount == nNameCount),
|
|
|
|
|
"OFormExport::exportAttributes: somebody tampered with the maps (1)!");
|
|
|
|
|
#endif
|
|
|
|
|
for (i=0; i<nIdCount; ++i)
|
2000-11-19 14:41:32 +00:00
|
|
|
|
exportStringPropertyAttribute(
|
2000-11-17 18:03:33 +00:00
|
|
|
|
getFormAttributeNamespace(eStringPropertyIds[i]),
|
|
|
|
|
getFormAttributeName(eStringPropertyIds[i]),
|
|
|
|
|
pStringPropertyNames[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ----------------------
|
|
|
|
|
// the boolean properties
|
|
|
|
|
{
|
|
|
|
|
static FormAttributes eBooleanPropertyIds[] =
|
|
|
|
|
{
|
|
|
|
|
faAllowDeletes, faAllowInserts, faAllowUpdates, faApplyFilter, faEscapeProcessing, faIgnoreResult
|
|
|
|
|
};
|
|
|
|
|
static const sal_Char* pBooleanPropertyNames[] =
|
|
|
|
|
{
|
|
|
|
|
PROPERTY_ALLOWDELETES, PROPERTY_ALLOWINSERTS, PROPERTY_ALLOWUPDATES, PROPERTY_APPLYFILTER, PROPERTY_ESCAPEPROCESSING, PROPERTY_IGNORERESULT
|
|
|
|
|
};
|
2001-03-29 11:19:43 +00:00
|
|
|
|
static sal_Int8 nBooleanPropertyAttrFlags[] =
|
2000-11-17 18:03:33 +00:00
|
|
|
|
{
|
2001-03-29 11:19:43 +00:00
|
|
|
|
BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE
|
2000-11-17 18:03:33 +00:00
|
|
|
|
};
|
|
|
|
|
sal_Int32 nIdCount = sizeof(eBooleanPropertyIds) / sizeof(eBooleanPropertyIds[0]);
|
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
|
sal_Int32 nNameCount = sizeof(pBooleanPropertyNames) / sizeof(pBooleanPropertyNames[0]);
|
2001-03-29 11:19:43 +00:00
|
|
|
|
sal_Int32 nFlagsCount = sizeof(nBooleanPropertyAttrFlags) / sizeof(nBooleanPropertyAttrFlags[0]);
|
|
|
|
|
OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nFlagsCount),
|
2000-11-17 18:03:33 +00:00
|
|
|
|
"OFormExport::exportAttributes: somebody tampered with the maps (2)!");
|
|
|
|
|
#endif
|
|
|
|
|
for (i=0; i<nIdCount; ++i)
|
2000-11-19 14:41:32 +00:00
|
|
|
|
exportBooleanPropertyAttribute(
|
2000-11-17 18:03:33 +00:00
|
|
|
|
getFormAttributeNamespace(eBooleanPropertyIds[i]),
|
|
|
|
|
getFormAttributeName(eBooleanPropertyIds[i]),
|
|
|
|
|
pBooleanPropertyNames[i],
|
2001-03-29 11:19:43 +00:00
|
|
|
|
nBooleanPropertyAttrFlags[i]
|
|
|
|
|
);
|
2000-11-17 18:03:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// -------------------
|
|
|
|
|
// the enum properties
|
|
|
|
|
{
|
|
|
|
|
static FormAttributes eEnumPropertyIds[] =
|
|
|
|
|
{
|
|
|
|
|
faEnctype, faMethod, faCommandType, faNavigationMode, faTabbingCycle
|
|
|
|
|
};
|
|
|
|
|
static const sal_Char* pEnumPropertyNames[] =
|
|
|
|
|
{
|
|
|
|
|
PROPERTY_SUBMIT_ENCODING, PROPERTY_SUBMIT_METHOD, PROPERTY_COMMAND_TYPE, PROPERTY_NAVIGATION, PROPERTY_CYCLE
|
|
|
|
|
};
|
|
|
|
|
static OEnumMapper::EnumProperties eEnumPropertyMaps[] =
|
|
|
|
|
{
|
|
|
|
|
OEnumMapper::epSubmitEncoding, OEnumMapper::epSubmitMethod, OEnumMapper::epCommandType, OEnumMapper::epNavigationType, OEnumMapper::epTabCyle
|
|
|
|
|
};
|
|
|
|
|
static sal_Int32 nEnumPropertyAttrDefaults[] =
|
|
|
|
|
{
|
2001-03-28 12:06:55 +00:00
|
|
|
|
FormSubmitEncoding_URL, FormSubmitMethod_GET, CommandType::COMMAND, NavigationBarMode_CURRENT, TabulatorCycle_RECORDS
|
2000-11-17 18:03:33 +00:00
|
|
|
|
};
|
2001-04-17 06:58:31 +00:00
|
|
|
|
static sal_Bool nEnumPropertyAttrDefaultFlags[] =
|
|
|
|
|
{
|
|
|
|
|
sal_False, sal_False, sal_False, sal_False, sal_True
|
|
|
|
|
};
|
2000-11-17 18:03:33 +00:00
|
|
|
|
sal_Int32 nIdCount = sizeof(eEnumPropertyIds) / sizeof(eEnumPropertyIds[0]);
|
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
|
sal_Int32 nNameCount = sizeof(pEnumPropertyNames) / sizeof(pEnumPropertyNames[0]);
|
|
|
|
|
sal_Int32 nDefaultCount = sizeof(nEnumPropertyAttrDefaults) / sizeof(nEnumPropertyAttrDefaults[0]);
|
2001-04-17 06:58:31 +00:00
|
|
|
|
sal_Int32 nDefaultFlagCount = sizeof(nEnumPropertyAttrDefaultFlags) / sizeof(nEnumPropertyAttrDefaultFlags[0]);
|
2000-11-17 18:03:33 +00:00
|
|
|
|
sal_Int32 nMapCount = sizeof(eEnumPropertyMaps) / sizeof(eEnumPropertyMaps[0]);
|
2001-04-17 06:58:31 +00:00
|
|
|
|
OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nDefaultCount) && (nDefaultCount == nDefaultFlagCount) && (nDefaultFlagCount == nMapCount),
|
2000-11-17 18:03:33 +00:00
|
|
|
|
"OFormExport::exportAttributes: somebody tampered with the maps (3)!");
|
|
|
|
|
#endif
|
|
|
|
|
for (i=0; i<nIdCount; ++i)
|
2000-11-19 14:41:32 +00:00
|
|
|
|
exportEnumPropertyAttribute(
|
2000-11-17 18:03:33 +00:00
|
|
|
|
getFormAttributeNamespace(eEnumPropertyIds[i]),
|
|
|
|
|
getFormAttributeName(eEnumPropertyIds[i]),
|
|
|
|
|
pEnumPropertyNames[i],
|
|
|
|
|
OEnumMapper::getEnumMap(eEnumPropertyMaps[i]),
|
2001-04-17 06:58:31 +00:00
|
|
|
|
nEnumPropertyAttrDefaults[i],
|
|
|
|
|
nEnumPropertyAttrDefaultFlags[i]
|
|
|
|
|
);
|
2000-11-17 18:03:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// the service name
|
2000-11-19 14:41:32 +00:00
|
|
|
|
exportServiceNameAttribute();
|
2000-11-17 18:03:33 +00:00
|
|
|
|
// the target frame
|
2000-11-19 14:41:32 +00:00
|
|
|
|
exportTargetFrameAttribute();
|
2001-06-25 12:32:38 +00:00
|
|
|
|
// the target URL
|
|
|
|
|
exportTargetLocationAttribute();
|
2000-11-19 14:41:32 +00:00
|
|
|
|
|
|
|
|
|
// master fields
|
|
|
|
|
exportStringSequenceAttribute(
|
|
|
|
|
getFormAttributeNamespace(faMasterFields),
|
|
|
|
|
getFormAttributeName(faMasterFields),
|
|
|
|
|
PROPERTY_MASTERFIELDS);
|
|
|
|
|
// detail fields
|
|
|
|
|
exportStringSequenceAttribute(
|
|
|
|
|
getFormAttributeNamespace(faDetailFiels),
|
|
|
|
|
getFormAttributeName(faDetailFiels),
|
|
|
|
|
PROPERTY_DETAILFIELDS);
|
2000-11-17 18:03:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//.........................................................................
|
|
|
|
|
} // namespace xmloff
|
|
|
|
|
//.........................................................................
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
* history:
|
|
|
|
|
* $Log: not supported by cvs2svn $
|
2001-06-25 12:32:38 +00:00
|
|
|
|
* Revision 1.17 2001/06/14 13:39:35 fs
|
|
|
|
|
* #88016# corrected the condition for the assertion
|
|
|
|
|
*
|
2001-06-14 12:39:35 +00:00
|
|
|
|
* Revision 1.16 2001/05/21 13:30:17 fs
|
|
|
|
|
* #85388# when exporting the ListSource as attribs, store form:option elements as long as there are valid 'selected' or 'default-selected' entries
|
|
|
|
|
*
|
2001-05-21 12:33:04 +00:00
|
|
|
|
* Revision 1.15 2001/04/17 07:58:31 fs
|
|
|
|
|
* #85427# TabCycle has a void-default
|
|
|
|
|
*
|
2001-04-17 06:58:31 +00:00
|
|
|
|
* Revision 1.14 2001/03/29 12:19:43 fs
|
|
|
|
|
* #85097# changed the signature of exportBooleanPropertyAttribute
|
|
|
|
|
*
|
2001-03-29 11:19:43 +00:00
|
|
|
|
* Revision 1.13 2001/03/28 13:06:55 fs
|
|
|
|
|
* #85427# corrected the default for NavigationBarMode
|
|
|
|
|
*
|
2001-03-28 12:06:55 +00:00
|
|
|
|
* Revision 1.12 2001/03/21 16:54:16 jl
|
|
|
|
|
* Replaced OSL_ENSHURE by OSL_ENSURE
|
|
|
|
|
*
|
2001-03-21 15:54:38 +00:00
|
|
|
|
* Revision 1.11 2001/03/16 14:36:39 sab
|
|
|
|
|
* did the required change (move of extract.hxx form cppuhelper to comphelper)
|
|
|
|
|
*
|
2001-03-16 13:37:07 +00:00
|
|
|
|
* Revision 1.10 2001/02/01 09:46:47 fs
|
|
|
|
|
* no own style handling anymore - the shape exporter is responsible for our styles now
|
|
|
|
|
*
|
2001-02-01 08:46:47 +00:00
|
|
|
|
* Revision 1.9 2001/01/03 16:25:34 fs
|
|
|
|
|
* file format change (extra wrapper element for controls, similar to columns)
|
|
|
|
|
*
|
2001-01-03 15:25:34 +00:00
|
|
|
|
* Revision 1.8 2001/01/02 15:58:21 fs
|
|
|
|
|
* event ex- & import
|
|
|
|
|
*
|
2001-01-02 14:58:22 +00:00
|
|
|
|
* Revision 1.7 2000/12/18 15:14:35 fs
|
|
|
|
|
* some changes ... now exporting/importing styles
|
|
|
|
|
*
|
2000-12-18 14:14:35 +00:00
|
|
|
|
* Revision 1.6 2000/12/18 13:25:01 mib
|
|
|
|
|
* #82036#: new graphic properties
|
|
|
|
|
*
|
2000-12-18 12:25:02 +00:00
|
|
|
|
* Revision 1.5 2000/12/13 10:38:10 fs
|
|
|
|
|
* moved some code to a more central place to reuse it
|
|
|
|
|
*
|
2000-12-13 09:38:10 +00:00
|
|
|
|
* Revision 1.4 2000/12/06 17:28:05 fs
|
|
|
|
|
* changes for the formlayer import - still under construction
|
|
|
|
|
*
|
2000-12-06 16:28:05 +00:00
|
|
|
|
* Revision 1.3 2000/11/29 10:36:05 mh
|
|
|
|
|
* add: stdio.h for Solaris8
|
|
|
|
|
*
|
2000-11-29 09:36:05 +00:00
|
|
|
|
* Revision 1.2 2000/11/19 15:41:32 fs
|
|
|
|
|
* extended the export capabilities - generic controls / grid columns / generic properties / some missing form properties
|
|
|
|
|
*
|
2000-11-19 14:41:32 +00:00
|
|
|
|
* Revision 1.1 2000/11/17 19:01:21 fs
|
|
|
|
|
* initial checkin - export and/or import the applications form layer
|
|
|
|
|
*
|
2000-11-17 18:03:33 +00:00
|
|
|
|
*
|
|
|
|
|
* Revision 1.0 13.11.00 18:56:13 fs
|
|
|
|
|
************************************************************************/
|
|
|
|
|
|