Files
libreoffice/xmloff/source/forms/layerexport.cxx

834 lines
36 KiB
C++
Raw Normal View History

/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org 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 version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmloff.hxx"
2000-11-29 09:36:05 +00:00
#include <stdio.h>
#include "layerexport.hxx"
#include "strings.hxx"
#include <xmloff/xmlexp.hxx>
#include <xmloff/nmspmap.hxx>
#include "xmlnmspe.hxx"
#include <xmloff/xmluconv.hxx>
#include <xmloff/xmlprmap.hxx>
#include <xmloff/prhdlfac.hxx>
#include "elementexport.hxx"
#include <xmloff/families.hxx>
#include <xmloff/contextid.hxx>
#include <xmloff/controlpropertyhdl.hxx>
#include <tools/diagnose_ex.h>
#include "controlpropertymap.hxx"
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/form/XFormsSupplier2.hpp>
#include <com/sun/star/xforms/XFormsSupplier.hpp>
#include <com/sun/star/form/FormComponentType.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/container/XChild.hpp>
2001-01-02 14:58:22 +00:00
#include <com/sun/star/script/XEventAttacherManager.hpp>
#include "eventexport.hxx"
#include <xmloff/XMLEventExport.hxx>
2001-01-02 14:58:22 +00:00
#include "formevents.hxx"
#include <xmloff/xmlnumfe.hxx>
#include "xformsexport.hxx"
/** === begin UNO includes === **/
#include <com/sun/star/text/XText.hpp>
/** === end UNO includes === **/
#include <numeric>
//.........................................................................
namespace xmloff
{
//.........................................................................
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::drawing;
using namespace ::com::sun::star::form;
2001-01-02 14:58:22 +00:00
using namespace ::com::sun::star::script;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::text;
typedef ::com::sun::star::xforms::XFormsSupplier XXFormsSupplier;
//=====================================================================
//= OFormLayerXMLExport_Impl
//=====================================================================
//---------------------------------------------------------------------
const ::rtl::OUString& OFormLayerXMLExport_Impl::getControlNumberStyleNamePrefix()
{
static const ::rtl::OUString s_sControlNumberStyleNamePrefix = ::rtl::OUString::createFromAscii("C");
return s_sControlNumberStyleNamePrefix;
}
//---------------------------------------------------------------------
OFormLayerXMLExport_Impl::OFormLayerXMLExport_Impl(SvXMLExport& _rContext)
:m_rContext(_rContext)
,m_pControlNumberStyles(NULL)
{
initializePropertyMaps();
// add our style family to the export context's style pool
m_xPropertyHandlerFactory = new OControlPropertyHandlerFactory();
::vos::ORef< XMLPropertySetMapper > xStylePropertiesMapper = new XMLPropertySetMapper( getControlStylePropertyMap(), m_xPropertyHandlerFactory.getBodyPtr() );
CWS-TOOLING: integrate CWS dba31e 2008-11-19 12:36:23 +0100 msc r263980 : i96104 2008-11-19 12:31:19 +0100 msc r263979 : i96104 2008-11-19 12:21:55 +0100 msc r263977 : i96104 2008-11-19 12:18:53 +0100 msc r263976 : i96104 2008-11-18 09:09:45 +0100 oj r263746 : disable color entry when area is set 2008-11-18 08:37:52 +0100 oj r263741 : #remove sub report entry 2008-11-17 11:20:25 +0100 fs r263708 : #i10000# 2008-11-17 11:06:52 +0100 fs r263706 : minimal version now is 3.1 2008-11-12 22:25:59 +0100 fs r263621 : #i96150# 2008-11-12 22:20:02 +0100 fs r263620 : rebased to m34 2008-11-12 21:39:41 +0100 fs r263618 : MANUAL REBASE: rebase CWS dba31d to DEV300_m34 2008-11-12 13:54:58 +0100 fs r263597 : #i96134# MediaDescriptor.URL is to be preferred over MediaDescriptor.FileName. Nonetheless, ensure both are handled 2008-11-12 13:53:40 +0100 fs r263596 : #i96134# re-enabled the code for #i41897#, a better fix is to come 2008-11-12 12:48:21 +0100 fs r263585 : #i96134# disable saving URLs of file-base databases relatively 2008-11-11 16:11:11 +0100 msc r263566 : #i96104# 2008-11-05 09:09:47 +0100 oj r263342 : #i88727# color noe added 2008-11-05 08:41:43 +0100 oj r263341 : #i77916# zoom added 2008-11-04 21:24:15 +0100 fs r263339 : disposing: call disposeAndClear without own mutex locked - some of our listeners insist on locking the SolarMutex, which sometimes led to deadlocks on the complex test cases 2008-11-04 21:23:15 +0100 fs r263338 : remove SolarMutex locking - this happned in CWS dba31c (in the CVS version), which this CWS was created from, but seems to got lost during resync 2008-11-04 20:49:50 +0100 fs r263335 : docu formatting 2008-11-04 20:06:39 +0100 fs r263334 : #i95826# use m_aMutex, not a DocumentGuard (wrongly resolved merge conflicts) 2008-11-04 17:36:29 +0100 fs r263332 : #i92688# properly revoke as XEventListener from m_xActiveController when disposing 2008-11-04 14:49:34 +0100 fs r263324 : #i92322# enable Input Required if EmptyIsNULL does not exist at the control 2008-10-31 11:10:04 +0100 oj r262857 : merge from cvs to svn 2008-10-31 09:46:45 +0100 oj r262853 : merge from cvs to svn 2008-10-31 08:46:37 +0100 oj r262849 : merge from cvs to svn 2008-10-31 08:44:24 +0100 oj r262848 : merge from cvs to svn 2008-10-31 08:43:33 +0100 oj r262847 : merge from cvs to svn 2008-10-31 08:42:28 +0100 oj r262846 : merge from cvs to svn 2008-10-31 08:41:58 +0100 oj r262845 : merge from cvs to svn 2008-10-31 08:41:32 +0100 oj r262844 : merge from cvs to svn 2008-10-28 12:19:50 +0100 oj r262733 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:42 +0100 oj r262732 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:36 +0100 oj r262731 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:31 +0100 oj r262730 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:22 +0100 oj r262729 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:18 +0100 oj r262728 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:10 +0100 oj r262727 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:06 +0100 oj r262726 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:05 +0100 oj r262725 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:01 +0100 oj r262724 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:50 +0100 oj r262723 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:41 +0100 oj r262722 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:40 +0100 oj r262721 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:27 +0100 oj r262720 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:10 +0100 oj r262719 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:01 +0100 oj r262718 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:17:39 +0100 oj r262717 : #iXXXXX#: migrate CWS dba31e to SVN
2008-12-01 12:31:27 +00:00
m_xStyleExportMapper = new OFormComponentStyleExportMapper( xStylePropertiesMapper.getBodyPtr() );
// our style family
m_rContext.GetAutoStylePool()->AddFamily(
XML_STYLE_FAMILY_CONTROL_ID, token::GetXMLToken(token::XML_PARAGRAPH),
CWS-TOOLING: integrate CWS dba31e 2008-11-19 12:36:23 +0100 msc r263980 : i96104 2008-11-19 12:31:19 +0100 msc r263979 : i96104 2008-11-19 12:21:55 +0100 msc r263977 : i96104 2008-11-19 12:18:53 +0100 msc r263976 : i96104 2008-11-18 09:09:45 +0100 oj r263746 : disable color entry when area is set 2008-11-18 08:37:52 +0100 oj r263741 : #remove sub report entry 2008-11-17 11:20:25 +0100 fs r263708 : #i10000# 2008-11-17 11:06:52 +0100 fs r263706 : minimal version now is 3.1 2008-11-12 22:25:59 +0100 fs r263621 : #i96150# 2008-11-12 22:20:02 +0100 fs r263620 : rebased to m34 2008-11-12 21:39:41 +0100 fs r263618 : MANUAL REBASE: rebase CWS dba31d to DEV300_m34 2008-11-12 13:54:58 +0100 fs r263597 : #i96134# MediaDescriptor.URL is to be preferred over MediaDescriptor.FileName. Nonetheless, ensure both are handled 2008-11-12 13:53:40 +0100 fs r263596 : #i96134# re-enabled the code for #i41897#, a better fix is to come 2008-11-12 12:48:21 +0100 fs r263585 : #i96134# disable saving URLs of file-base databases relatively 2008-11-11 16:11:11 +0100 msc r263566 : #i96104# 2008-11-05 09:09:47 +0100 oj r263342 : #i88727# color noe added 2008-11-05 08:41:43 +0100 oj r263341 : #i77916# zoom added 2008-11-04 21:24:15 +0100 fs r263339 : disposing: call disposeAndClear without own mutex locked - some of our listeners insist on locking the SolarMutex, which sometimes led to deadlocks on the complex test cases 2008-11-04 21:23:15 +0100 fs r263338 : remove SolarMutex locking - this happned in CWS dba31c (in the CVS version), which this CWS was created from, but seems to got lost during resync 2008-11-04 20:49:50 +0100 fs r263335 : docu formatting 2008-11-04 20:06:39 +0100 fs r263334 : #i95826# use m_aMutex, not a DocumentGuard (wrongly resolved merge conflicts) 2008-11-04 17:36:29 +0100 fs r263332 : #i92688# properly revoke as XEventListener from m_xActiveController when disposing 2008-11-04 14:49:34 +0100 fs r263324 : #i92322# enable Input Required if EmptyIsNULL does not exist at the control 2008-10-31 11:10:04 +0100 oj r262857 : merge from cvs to svn 2008-10-31 09:46:45 +0100 oj r262853 : merge from cvs to svn 2008-10-31 08:46:37 +0100 oj r262849 : merge from cvs to svn 2008-10-31 08:44:24 +0100 oj r262848 : merge from cvs to svn 2008-10-31 08:43:33 +0100 oj r262847 : merge from cvs to svn 2008-10-31 08:42:28 +0100 oj r262846 : merge from cvs to svn 2008-10-31 08:41:58 +0100 oj r262845 : merge from cvs to svn 2008-10-31 08:41:32 +0100 oj r262844 : merge from cvs to svn 2008-10-28 12:19:50 +0100 oj r262733 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:42 +0100 oj r262732 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:36 +0100 oj r262731 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:31 +0100 oj r262730 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:22 +0100 oj r262729 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:18 +0100 oj r262728 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:10 +0100 oj r262727 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:06 +0100 oj r262726 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:05 +0100 oj r262725 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:01 +0100 oj r262724 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:50 +0100 oj r262723 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:41 +0100 oj r262722 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:40 +0100 oj r262721 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:27 +0100 oj r262720 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:10 +0100 oj r262719 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:01 +0100 oj r262718 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:17:39 +0100 oj r262717 : #iXXXXX#: migrate CWS dba31e to SVN
2008-12-01 12:31:27 +00:00
m_xStyleExportMapper.getBodyPtr(),
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( XML_STYLE_FAMILY_CONTROL_PREFIX) )
);
2001-01-02 14:58:22 +00:00
// add our event translation table
m_rContext.GetEventExport().AddTranslationTable(g_pFormsEventTranslation);
clear();
}
OFormLayerXMLExport_Impl::~OFormLayerXMLExport_Impl()
{
}
//---------------------------------------------------------------------
sal_Bool OFormLayerXMLExport_Impl::impl_isFormPageContainingForms(const Reference< XDrawPage >& _rxDrawPage, Reference< XIndexAccess >& _rxForms)
{
Reference< XFormsSupplier2 > xFormsSupp(_rxDrawPage, UNO_QUERY);
OSL_ENSURE(xFormsSupp.is(), "OFormLayerXMLExport_Impl::impl_isFormPageContainingForms: invalid draw page (no XFormsSupplier)! Doin' nothing!");
if (!xFormsSupp.is())
return sal_False;
if ( !xFormsSupp->hasForms() )
// nothing to do at all
return sal_False;
_rxForms = Reference< XIndexAccess >(xFormsSupp->getForms(), UNO_QUERY);
Reference< XServiceInfo > xSI(_rxForms, UNO_QUERY); // order is important!
OSL_ENSURE(xSI.is(), "OFormLayerXMLExport_Impl::impl_isFormPageContainingForms: invalid collection (must not be NULL and must have a ServiceInfo)!");
if (!xSI.is())
return sal_False;
if (!xSI->supportsService(SERVICE_FORMSCOLLECTION))
{
OSL_ENSURE(sal_False, "OFormLayerXMLExport_Impl::impl_isFormPageContainingForms: invalid collection (is no com.sun.star.form.Forms)!");
// nothing to do
return sal_False;
}
return sal_True;
}
//---------------------------------------------------------------------
2001-01-02 14:58:22 +00:00
void OFormLayerXMLExport_Impl::exportGridColumn(const Reference< XPropertySet >& _rxColumn,
const Sequence< ScriptEventDescriptor >& _rEvents)
{
// do the exporting
OColumnExport aExportImpl(*this, _rxColumn, getControlId( _rxColumn ), _rEvents);
aExportImpl.doExport();
}
//---------------------------------------------------------------------
2001-01-02 14:58:22 +00:00
void OFormLayerXMLExport_Impl::exportControl(const Reference< XPropertySet >& _rxControl,
const Sequence< ScriptEventDescriptor >& _rEvents)
{
// the list of the referring controls
::rtl::OUString sReferringControls;
MapPropertySet2String::const_iterator aReferring = m_aCurrentPageReferring->second.find(_rxControl);
if (aReferring != m_aCurrentPageReferring->second.end())
sReferringControls = aReferring->second;
// the control id (should already have been created in examineForms)
::rtl::OUString sControlId( getControlId( _rxControl ) );
// do the exporting
2001-01-02 14:58:22 +00:00
OControlExport aExportImpl(*this, _rxControl, sControlId, sReferringControls, _rEvents);
aExportImpl.doExport();
}
//---------------------------------------------------------------------
2001-01-02 14:58:22 +00:00
void OFormLayerXMLExport_Impl::exportForm(const Reference< XPropertySet >& _rxProps,
const Sequence< ScriptEventDescriptor >& _rEvents)
{
2001-03-21 15:54:38 +00:00
OSL_ENSURE(_rxProps.is(), "OFormLayerXMLExport_Impl::exportForm: invalid property set!");
2001-01-02 14:58:22 +00:00
OFormExport aAttributeHandler(*this, _rxProps, _rEvents);
aAttributeHandler.doExport();
}
//---------------------------------------------------------------------
::vos::ORef< SvXMLExportPropertyMapper > OFormLayerXMLExport_Impl::getStylePropertyMapper()
{
CWS-TOOLING: integrate CWS dba31e 2008-11-19 12:36:23 +0100 msc r263980 : i96104 2008-11-19 12:31:19 +0100 msc r263979 : i96104 2008-11-19 12:21:55 +0100 msc r263977 : i96104 2008-11-19 12:18:53 +0100 msc r263976 : i96104 2008-11-18 09:09:45 +0100 oj r263746 : disable color entry when area is set 2008-11-18 08:37:52 +0100 oj r263741 : #remove sub report entry 2008-11-17 11:20:25 +0100 fs r263708 : #i10000# 2008-11-17 11:06:52 +0100 fs r263706 : minimal version now is 3.1 2008-11-12 22:25:59 +0100 fs r263621 : #i96150# 2008-11-12 22:20:02 +0100 fs r263620 : rebased to m34 2008-11-12 21:39:41 +0100 fs r263618 : MANUAL REBASE: rebase CWS dba31d to DEV300_m34 2008-11-12 13:54:58 +0100 fs r263597 : #i96134# MediaDescriptor.URL is to be preferred over MediaDescriptor.FileName. Nonetheless, ensure both are handled 2008-11-12 13:53:40 +0100 fs r263596 : #i96134# re-enabled the code for #i41897#, a better fix is to come 2008-11-12 12:48:21 +0100 fs r263585 : #i96134# disable saving URLs of file-base databases relatively 2008-11-11 16:11:11 +0100 msc r263566 : #i96104# 2008-11-05 09:09:47 +0100 oj r263342 : #i88727# color noe added 2008-11-05 08:41:43 +0100 oj r263341 : #i77916# zoom added 2008-11-04 21:24:15 +0100 fs r263339 : disposing: call disposeAndClear without own mutex locked - some of our listeners insist on locking the SolarMutex, which sometimes led to deadlocks on the complex test cases 2008-11-04 21:23:15 +0100 fs r263338 : remove SolarMutex locking - this happned in CWS dba31c (in the CVS version), which this CWS was created from, but seems to got lost during resync 2008-11-04 20:49:50 +0100 fs r263335 : docu formatting 2008-11-04 20:06:39 +0100 fs r263334 : #i95826# use m_aMutex, not a DocumentGuard (wrongly resolved merge conflicts) 2008-11-04 17:36:29 +0100 fs r263332 : #i92688# properly revoke as XEventListener from m_xActiveController when disposing 2008-11-04 14:49:34 +0100 fs r263324 : #i92322# enable Input Required if EmptyIsNULL does not exist at the control 2008-10-31 11:10:04 +0100 oj r262857 : merge from cvs to svn 2008-10-31 09:46:45 +0100 oj r262853 : merge from cvs to svn 2008-10-31 08:46:37 +0100 oj r262849 : merge from cvs to svn 2008-10-31 08:44:24 +0100 oj r262848 : merge from cvs to svn 2008-10-31 08:43:33 +0100 oj r262847 : merge from cvs to svn 2008-10-31 08:42:28 +0100 oj r262846 : merge from cvs to svn 2008-10-31 08:41:58 +0100 oj r262845 : merge from cvs to svn 2008-10-31 08:41:32 +0100 oj r262844 : merge from cvs to svn 2008-10-28 12:19:50 +0100 oj r262733 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:42 +0100 oj r262732 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:36 +0100 oj r262731 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:31 +0100 oj r262730 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:22 +0100 oj r262729 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:18 +0100 oj r262728 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:10 +0100 oj r262727 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:06 +0100 oj r262726 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:05 +0100 oj r262725 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:01 +0100 oj r262724 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:50 +0100 oj r262723 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:41 +0100 oj r262722 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:40 +0100 oj r262721 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:27 +0100 oj r262720 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:10 +0100 oj r262719 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:01 +0100 oj r262718 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:17:39 +0100 oj r262717 : #iXXXXX#: migrate CWS dba31e to SVN
2008-12-01 12:31:27 +00:00
return m_xStyleExportMapper;
}
//---------------------------------------------------------------------
SvXMLExport& OFormLayerXMLExport_Impl::getGlobalContext()
{
return m_rContext;
}
//---------------------------------------------------------------------
void OFormLayerXMLExport_Impl::exportCollectionElements(const Reference< XIndexAccess >& _rxCollection)
{
// step through all the elements of the collection
sal_Int32 nElements = _rxCollection->getCount();
2001-01-02 14:58:22 +00:00
Reference< XEventAttacherManager > xElementEventManager(_rxCollection, UNO_QUERY);
Sequence< ScriptEventDescriptor > aElementEvents;
Reference< XPropertySetInfo > xPropsInfo;
Reference< XIndexAccess > xCurrentContainer;
for (sal_Int32 i=0; i<nElements; ++i)
{
try
{
// extract the current element
Reference< XPropertySet > xCurrentProps( _rxCollection->getByIndex(i), UNO_QUERY );
2001-03-21 15:54:38 +00:00
OSL_ENSURE(xCurrentProps.is(), "OFormLayerXMLExport_Impl::exportCollectionElements: invalid child element, skipping!");
if (!xCurrentProps.is())
continue;
// check if there is a ClassId property on the current element. If so, we assume it to be a control
xPropsInfo = xCurrentProps->getPropertySetInfo();
2001-03-21 15:54:38 +00:00
OSL_ENSURE(xPropsInfo.is(), "OFormLayerXMLExport_Impl::exportCollectionElements: no property set info!");
if (!xPropsInfo.is())
// without this, a lot of stuff in the export routines may fail
continue;
// if the element is part of a ignore list, we are not allowed to export it
if ( m_aIgnoreList.end() != m_aIgnoreList.find( xCurrentProps ) )
continue;
2001-01-02 14:58:22 +00:00
if (xElementEventManager.is())
aElementEvents = xElementEventManager->getScriptEvents(i);
if (xPropsInfo->hasPropertyByName(PROPERTY_COLUMNSERVICENAME))
{
2001-01-02 14:58:22 +00:00
exportGridColumn(xCurrentProps, aElementEvents);
}
else if (xPropsInfo->hasPropertyByName(PROPERTY_CLASSID))
{
2001-01-02 14:58:22 +00:00
exportControl(xCurrentProps, aElementEvents);
}
else
{
2001-01-02 14:58:22 +00:00
exportForm(xCurrentProps, aElementEvents);
}
}
catch(Exception&)
{
2001-03-21 15:54:38 +00:00
OSL_ENSURE(sal_False, "OFormLayerXMLExport_Impl::exportCollectionElements: caught an exception ... skipping the current element!");
continue;
}
}
}
//---------------------------------------------------------------------
::rtl::OUString OFormLayerXMLExport_Impl::getObjectStyleName( const Reference< XPropertySet >& _rxObject )
{
::rtl::OUString aObjectStyle;
MapPropertySet2String::const_iterator aObjectStylePos = m_aGridColumnStyles.find( _rxObject );
if ( m_aGridColumnStyles.end() != aObjectStylePos )
aObjectStyle = aObjectStylePos->second;
return aObjectStyle;
}
//---------------------------------------------------------------------
void OFormLayerXMLExport_Impl::clear()
{
m_aControlIds.clear();
m_aReferringControls.clear();
m_aCurrentPageIds = m_aControlIds.end();
m_aCurrentPageReferring = m_aReferringControls.end();
m_aControlNumberFormats.clear();
m_aGridColumnStyles.clear();
m_aIgnoreList.clear();
}
//---------------------------------------------------------------------
void OFormLayerXMLExport_Impl::exportControlNumberStyles()
{
if (m_pControlNumberStyles)
m_pControlNumberStyles->Export(sal_False);
}
//---------------------------------------------------------------------
void OFormLayerXMLExport_Impl::exportAutoControlNumberStyles()
{
if ( m_pControlNumberStyles )
m_pControlNumberStyles->Export( sal_True );
}
//---------------------------------------------------------------------
void OFormLayerXMLExport_Impl::exportAutoStyles()
{
m_rContext.GetAutoStylePool()->exportXML(
XML_STYLE_FAMILY_CONTROL_ID,
m_rContext.GetDocHandler(),
m_rContext.GetMM100UnitConverter(),
m_rContext.GetNamespaceMap()
);
}
//---------------------------------------------------------------------
void OFormLayerXMLExport_Impl::exportForms(const Reference< XDrawPage >& _rxDrawPage)
{
// get the forms collection of the page
Reference< XIndexAccess > xCollectionIndex;
if (!impl_isFormPageContainingForms(_rxDrawPage, xCollectionIndex))
return;
#if OSL_DEBUG_LEVEL > 0
sal_Bool bPageIsKnown =
#endif
implMoveIterators(_rxDrawPage, sal_False);
OSL_ENSURE(bPageIsKnown, "OFormLayerXMLExport_Impl::exportForms: exporting a page which has not been examined!");
// export forms collection
exportCollectionElements(xCollectionIndex);
}
//---------------------------------------------------------------------
void OFormLayerXMLExport_Impl::exportXForms() const
{
// export XForms models
::exportXForms( m_rContext );
}
//---------------------------------------------------------------------
bool OFormLayerXMLExport_Impl::pageContainsForms( const Reference< XDrawPage >& _rxDrawPage ) const
{
Reference< XFormsSupplier2 > xFormsSupp( _rxDrawPage, UNO_QUERY );
2005-03-24 09:23:55 +00:00
DBG_ASSERT( xFormsSupp.is(), "OFormLayerXMLExport_Impl::pageContainsForms: no XFormsSupplier2!" );
return xFormsSupp.is() && xFormsSupp->hasForms();
}
//---------------------------------------------------------------------
bool OFormLayerXMLExport_Impl::documentContainsXForms() const
{
Reference< XXFormsSupplier > xXFormSupp( m_rContext.GetModel(), UNO_QUERY );
Reference< XNameContainer > xForms;
if ( xXFormSupp.is() )
xForms = xXFormSupp->getXForms();
return xForms.is() && xForms->hasElements();
}
//---------------------------------------------------------------------
sal_Bool OFormLayerXMLExport_Impl::implMoveIterators(const Reference< XDrawPage >& _rxDrawPage, sal_Bool _bClear)
{
sal_Bool bKnownPage = sal_False;
// the one for the ids
m_aCurrentPageIds = m_aControlIds.find(_rxDrawPage);
if (m_aControlIds.end() == m_aCurrentPageIds)
{
m_aControlIds[_rxDrawPage] = MapPropertySet2String();
m_aCurrentPageIds = m_aControlIds.find(_rxDrawPage);
}
else
{
bKnownPage = sal_True;
CWS-TOOLING: integrate CWS dbaperf1 2009-04-02 09:12:25 +0200 oj r270372 : CWS-TOOLING: rebase CWS dbaperf1 to trunk@270033 (milestone: DEV300:m45) 2009-03-17 10:20:34 +0100 oj r269577 : add parameter 2009-03-17 10:20:05 +0100 oj r269576 : add parameter 2009-03-12 12:32:24 +0100 oj r269387 : add missing ++ 2009-03-11 12:53:35 +0100 oj r269315 : compile error 2009-03-06 08:52:11 +0100 oj r268968 : #i99264# remove duplicate code 2009-03-06 08:20:08 +0100 oj r268966 : add missingheader 2009-03-06 08:17:41 +0100 oj r268965 : add header 2009-03-06 08:15:07 +0100 oj r268964 : #i99708# remove duplicate code 2009-03-06 07:24:11 +0100 oj r268963 : #i99708# remove duplicate code 2009-03-06 07:22:24 +0100 oj r268962 : #i99708# use tenary operator 2009-03-06 07:19:21 +0100 oj r268961 : remove unused rtl_logs 2009-03-06 07:15:55 +0100 oj r268960 : #i99708# extract getLength from for loop 2009-03-06 07:15:35 +0100 oj r268959 : #i99708# extract getLength from for loop 2009-03-06 07:14:57 +0100 oj r268958 : remove unused rtl_logs 2009-03-06 07:13:01 +0100 oj r268957 : insert DBG_ helper 2009-03-06 07:12:17 +0100 oj r268956 : remove unused rtl_logs 2009-03-06 07:10:26 +0100 oj r268955 : remove unused rtl_logs 2009-03-06 07:04:51 +0100 oj r268954 : #i99708# use tenary operator 2009-03-05 12:04:46 +0100 oj r268895 : comment RTL_LOG out 2009-03-05 09:05:07 +0100 oj r268874 : add rtl logfile 2009-03-04 14:21:18 +0100 oj r268828 : #i99708# make static inplace and some method calls in for loop removed 2009-03-04 14:20:34 +0100 oj r268827 : #i99708# impl double check pattern for getInfohelper 2009-03-02 09:31:42 +0100 oj r268636 : add rtl logfile 2009-03-02 08:18:37 +0100 oj r268633 : add rtl logfile 2009-02-27 11:22:16 +0100 oj r268570 : #i99709# change algorithm for marking objects 2009-02-27 11:17:04 +0100 oj r268568 : #i99708# some improvements to load forms, controls faster and replacement of size() call with !empty() which is much faster 2009-02-24 10:09:35 +0100 sb r268383 : #i99290# no longer care to set a sensible context class loader for native threads attached to the VM 2009-02-23 13:44:04 +0100 oj r268354 : #i76606# seekrow changes 2009-02-23 12:27:30 +0100 oj r268349 : deleted 2009-02-20 15:14:23 +0100 oj r268325 : #i76606# some code changes 2009-02-19 14:15:25 +0100 oj r268284 : #i76606# use of simple prep stmt instead of full blown rowset, when source and dest connection are the same use insert into ... ( select ... ) 2009-02-19 11:27:55 +0100 oj r268265 : #i76606# insert some RTL_LOG and setObject impl 2009-02-18 14:45:37 +0100 oj r268222 : #i99363# insert RTL_LOG 2009-02-18 14:45:18 +0100 oj r268221 : #i99363# insert RTL_LOG 2009-02-18 11:14:54 +0100 oj r268207 : #i99363# call some impl_ methods to avoid duplicate cechCache calls 2009-02-18 11:10:47 +0100 oj r268206 : #i99363# make isCount inline 2009-02-18 10:33:22 +0100 oj r268203 : #i99363# use bookmarkable if available and inserted some RTL_LOG 2009-02-18 10:32:57 +0100 oj r268202 : #i99363# use bookmarkable if available and inserted some RTL_LOG 2009-02-17 07:29:05 +0100 oj r267843 : #i96897# remove some dll public 2009-02-16 15:01:04 +0100 oj r267816 : #i96897# remove some dll public 2009-02-16 14:25:53 +0100 oj r267810 : #i99264# remove duplicate code 2009-02-16 14:25:33 +0100 oj r267809 : #i99264# remove duplicate code 2009-02-16 14:24:59 +0100 oj r267808 : #i99264# remove duplicate code 2009-02-13 10:56:17 +0100 oj r267703 : #i99191# comment the contextclassloader 2009-02-13 10:32:40 +0100 oj r267700 : reduce call to resultset meta data 2009-02-13 10:27:31 +0100 oj r267699 : reduce call to resultset meta data 2009-02-13 10:27:08 +0100 oj r267698 : reduce call to resultset meta data
2009-04-23 10:42:05 +00:00
if (_bClear && !m_aCurrentPageIds->second.empty() )
m_aCurrentPageIds->second.clear();
}
// the one for the ids of the referring controls
m_aCurrentPageReferring = m_aReferringControls.find(_rxDrawPage);
if (m_aReferringControls.end() == m_aCurrentPageReferring)
{
m_aReferringControls[_rxDrawPage] = MapPropertySet2String();
m_aCurrentPageReferring = m_aReferringControls.find(_rxDrawPage);
}
else
{
bKnownPage = sal_True;
CWS-TOOLING: integrate CWS dbaperf1 2009-04-02 09:12:25 +0200 oj r270372 : CWS-TOOLING: rebase CWS dbaperf1 to trunk@270033 (milestone: DEV300:m45) 2009-03-17 10:20:34 +0100 oj r269577 : add parameter 2009-03-17 10:20:05 +0100 oj r269576 : add parameter 2009-03-12 12:32:24 +0100 oj r269387 : add missing ++ 2009-03-11 12:53:35 +0100 oj r269315 : compile error 2009-03-06 08:52:11 +0100 oj r268968 : #i99264# remove duplicate code 2009-03-06 08:20:08 +0100 oj r268966 : add missingheader 2009-03-06 08:17:41 +0100 oj r268965 : add header 2009-03-06 08:15:07 +0100 oj r268964 : #i99708# remove duplicate code 2009-03-06 07:24:11 +0100 oj r268963 : #i99708# remove duplicate code 2009-03-06 07:22:24 +0100 oj r268962 : #i99708# use tenary operator 2009-03-06 07:19:21 +0100 oj r268961 : remove unused rtl_logs 2009-03-06 07:15:55 +0100 oj r268960 : #i99708# extract getLength from for loop 2009-03-06 07:15:35 +0100 oj r268959 : #i99708# extract getLength from for loop 2009-03-06 07:14:57 +0100 oj r268958 : remove unused rtl_logs 2009-03-06 07:13:01 +0100 oj r268957 : insert DBG_ helper 2009-03-06 07:12:17 +0100 oj r268956 : remove unused rtl_logs 2009-03-06 07:10:26 +0100 oj r268955 : remove unused rtl_logs 2009-03-06 07:04:51 +0100 oj r268954 : #i99708# use tenary operator 2009-03-05 12:04:46 +0100 oj r268895 : comment RTL_LOG out 2009-03-05 09:05:07 +0100 oj r268874 : add rtl logfile 2009-03-04 14:21:18 +0100 oj r268828 : #i99708# make static inplace and some method calls in for loop removed 2009-03-04 14:20:34 +0100 oj r268827 : #i99708# impl double check pattern for getInfohelper 2009-03-02 09:31:42 +0100 oj r268636 : add rtl logfile 2009-03-02 08:18:37 +0100 oj r268633 : add rtl logfile 2009-02-27 11:22:16 +0100 oj r268570 : #i99709# change algorithm for marking objects 2009-02-27 11:17:04 +0100 oj r268568 : #i99708# some improvements to load forms, controls faster and replacement of size() call with !empty() which is much faster 2009-02-24 10:09:35 +0100 sb r268383 : #i99290# no longer care to set a sensible context class loader for native threads attached to the VM 2009-02-23 13:44:04 +0100 oj r268354 : #i76606# seekrow changes 2009-02-23 12:27:30 +0100 oj r268349 : deleted 2009-02-20 15:14:23 +0100 oj r268325 : #i76606# some code changes 2009-02-19 14:15:25 +0100 oj r268284 : #i76606# use of simple prep stmt instead of full blown rowset, when source and dest connection are the same use insert into ... ( select ... ) 2009-02-19 11:27:55 +0100 oj r268265 : #i76606# insert some RTL_LOG and setObject impl 2009-02-18 14:45:37 +0100 oj r268222 : #i99363# insert RTL_LOG 2009-02-18 14:45:18 +0100 oj r268221 : #i99363# insert RTL_LOG 2009-02-18 11:14:54 +0100 oj r268207 : #i99363# call some impl_ methods to avoid duplicate cechCache calls 2009-02-18 11:10:47 +0100 oj r268206 : #i99363# make isCount inline 2009-02-18 10:33:22 +0100 oj r268203 : #i99363# use bookmarkable if available and inserted some RTL_LOG 2009-02-18 10:32:57 +0100 oj r268202 : #i99363# use bookmarkable if available and inserted some RTL_LOG 2009-02-17 07:29:05 +0100 oj r267843 : #i96897# remove some dll public 2009-02-16 15:01:04 +0100 oj r267816 : #i96897# remove some dll public 2009-02-16 14:25:53 +0100 oj r267810 : #i99264# remove duplicate code 2009-02-16 14:25:33 +0100 oj r267809 : #i99264# remove duplicate code 2009-02-16 14:24:59 +0100 oj r267808 : #i99264# remove duplicate code 2009-02-13 10:56:17 +0100 oj r267703 : #i99191# comment the contextclassloader 2009-02-13 10:32:40 +0100 oj r267700 : reduce call to resultset meta data 2009-02-13 10:27:31 +0100 oj r267699 : reduce call to resultset meta data 2009-02-13 10:27:08 +0100 oj r267698 : reduce call to resultset meta data
2009-04-23 10:42:05 +00:00
if (_bClear && !m_aCurrentPageReferring->second.empty() )
m_aCurrentPageReferring->second.clear();
}
return bKnownPage;
}
//---------------------------------------------------------------------
sal_Bool OFormLayerXMLExport_Impl::seekPage(const Reference< XDrawPage >& _rxDrawPage)
{
sal_Bool bKnownPage = implMoveIterators( _rxDrawPage, sal_False );
if ( bKnownPage )
return sal_True;
// if the page is not yet known, this does not automatically mean that it has
// not been examined. Instead, examineForms returns silently and successfully
// if a page is a XFormsPageSupplier2, but does not have a forms collection
// (This behaviour of examineForms is a performance optimization, to not force
// the page to create a forms container just to see that it's empty.)
// So, in such a case, seekPage is considered to be successfull, too, though the
// page was not yet known
Reference< XFormsSupplier2 > xFormsSupp( _rxDrawPage, UNO_QUERY );
if ( xFormsSupp.is() && !xFormsSupp->hasForms() )
return sal_True;
// anything else means that the page has not been examined before, or it's no
// valid form page. Both cases are Bad (TM).
return sal_False;
}
//---------------------------------------------------------------------
::rtl::OUString OFormLayerXMLExport_Impl::getControlId(const Reference< XPropertySet >& _rxControl)
{
2001-01-24 07:55:48 +00:00
OSL_ENSURE(m_aCurrentPageIds != m_aControlIds.end(), "OFormLayerXMLExport_Impl::getControlId: invalid current page!");
2001-03-21 15:54:38 +00:00
OSL_ENSURE(m_aCurrentPageIds->second.end() != m_aCurrentPageIds->second.find(_rxControl),
"OFormLayerXMLExport_Impl::getControlId: can not find the control!");
return m_aCurrentPageIds->second[_rxControl];
}
//---------------------------------------------------------------------
::rtl::OUString OFormLayerXMLExport_Impl::getImmediateNumberStyle( const Reference< XPropertySet >& _rxObject )
{
::rtl::OUString sNumberStyle;
sal_Int32 nOwnFormatKey = implExamineControlNumberFormat( _rxObject );
if ( -1 != nOwnFormatKey )
sNumberStyle = getControlNumberStyleExport()->GetStyleName( nOwnFormatKey );
return sNumberStyle;
}
//---------------------------------------------------------------------
::rtl::OUString OFormLayerXMLExport_Impl::getControlNumberStyle( const Reference< XPropertySet >& _rxControl )
{
::rtl::OUString sNumberStyle;
ConstMapPropertySet2IntIterator aControlFormatPos = m_aControlNumberFormats.find(_rxControl);
if (m_aControlNumberFormats.end() != aControlFormatPos)
{
OSL_ENSURE(m_pControlNumberStyles, "OFormLayerXMLExport_Impl::getControlNumberStyle: have a control which has a format style, but no style exporter!");
sNumberStyle = getControlNumberStyleExport()->GetStyleName(aControlFormatPos->second);
}
// it's allowed to ask for a control which does not have format information.
// (This is for performance reasons)
return sNumberStyle;
}
//---------------------------------------------------------------------
void OFormLayerXMLExport_Impl::examineForms(const Reference< XDrawPage >& _rxDrawPage)
{
// get the forms collection of the page
Reference< XIndexAccess > xCollectionIndex;
if (!impl_isFormPageContainingForms(_rxDrawPage, xCollectionIndex))
return;
// move the iterator which specify the currently handled page
#if OSL_DEBUG_LEVEL > 0
sal_Bool bPageIsKnown =
#endif
implMoveIterators(_rxDrawPage, sal_True);
OSL_ENSURE(!bPageIsKnown, "OFormLayerXMLExport_Impl::examineForms: examining a page twice!");
::std::stack< Reference< XIndexAccess > > aContainerHistory;
::std::stack< sal_Int32 > aIndexHistory;
Reference< XIndexAccess > xLoop = xCollectionIndex;
sal_Int32 nChildPos = 0;
do
{
if (nChildPos < xLoop->getCount())
{
Reference< XPropertySet > xCurrent( xLoop->getByIndex( nChildPos ), UNO_QUERY );
OSL_ENSURE(xCurrent.is(), "OFormLayerXMLExport_Impl::examineForms: invalid child object");
if (!xCurrent.is())
continue;
if (!checkExamineControl(xCurrent))
{
// step down
Reference< XIndexAccess > xNextContainer(xCurrent, UNO_QUERY);
OSL_ENSURE(xNextContainer.is(), "OFormLayerXMLExport_Impl::examineForms: what the heck is this ... no control, no container?");
aContainerHistory.push(xLoop);
aIndexHistory.push(nChildPos);
xLoop = xNextContainer;
nChildPos = -1; // will be incremented below
}
++nChildPos;
}
else
{
// step up
CWS-TOOLING: integrate CWS dbaperf1 2009-04-02 09:12:25 +0200 oj r270372 : CWS-TOOLING: rebase CWS dbaperf1 to trunk@270033 (milestone: DEV300:m45) 2009-03-17 10:20:34 +0100 oj r269577 : add parameter 2009-03-17 10:20:05 +0100 oj r269576 : add parameter 2009-03-12 12:32:24 +0100 oj r269387 : add missing ++ 2009-03-11 12:53:35 +0100 oj r269315 : compile error 2009-03-06 08:52:11 +0100 oj r268968 : #i99264# remove duplicate code 2009-03-06 08:20:08 +0100 oj r268966 : add missingheader 2009-03-06 08:17:41 +0100 oj r268965 : add header 2009-03-06 08:15:07 +0100 oj r268964 : #i99708# remove duplicate code 2009-03-06 07:24:11 +0100 oj r268963 : #i99708# remove duplicate code 2009-03-06 07:22:24 +0100 oj r268962 : #i99708# use tenary operator 2009-03-06 07:19:21 +0100 oj r268961 : remove unused rtl_logs 2009-03-06 07:15:55 +0100 oj r268960 : #i99708# extract getLength from for loop 2009-03-06 07:15:35 +0100 oj r268959 : #i99708# extract getLength from for loop 2009-03-06 07:14:57 +0100 oj r268958 : remove unused rtl_logs 2009-03-06 07:13:01 +0100 oj r268957 : insert DBG_ helper 2009-03-06 07:12:17 +0100 oj r268956 : remove unused rtl_logs 2009-03-06 07:10:26 +0100 oj r268955 : remove unused rtl_logs 2009-03-06 07:04:51 +0100 oj r268954 : #i99708# use tenary operator 2009-03-05 12:04:46 +0100 oj r268895 : comment RTL_LOG out 2009-03-05 09:05:07 +0100 oj r268874 : add rtl logfile 2009-03-04 14:21:18 +0100 oj r268828 : #i99708# make static inplace and some method calls in for loop removed 2009-03-04 14:20:34 +0100 oj r268827 : #i99708# impl double check pattern for getInfohelper 2009-03-02 09:31:42 +0100 oj r268636 : add rtl logfile 2009-03-02 08:18:37 +0100 oj r268633 : add rtl logfile 2009-02-27 11:22:16 +0100 oj r268570 : #i99709# change algorithm for marking objects 2009-02-27 11:17:04 +0100 oj r268568 : #i99708# some improvements to load forms, controls faster and replacement of size() call with !empty() which is much faster 2009-02-24 10:09:35 +0100 sb r268383 : #i99290# no longer care to set a sensible context class loader for native threads attached to the VM 2009-02-23 13:44:04 +0100 oj r268354 : #i76606# seekrow changes 2009-02-23 12:27:30 +0100 oj r268349 : deleted 2009-02-20 15:14:23 +0100 oj r268325 : #i76606# some code changes 2009-02-19 14:15:25 +0100 oj r268284 : #i76606# use of simple prep stmt instead of full blown rowset, when source and dest connection are the same use insert into ... ( select ... ) 2009-02-19 11:27:55 +0100 oj r268265 : #i76606# insert some RTL_LOG and setObject impl 2009-02-18 14:45:37 +0100 oj r268222 : #i99363# insert RTL_LOG 2009-02-18 14:45:18 +0100 oj r268221 : #i99363# insert RTL_LOG 2009-02-18 11:14:54 +0100 oj r268207 : #i99363# call some impl_ methods to avoid duplicate cechCache calls 2009-02-18 11:10:47 +0100 oj r268206 : #i99363# make isCount inline 2009-02-18 10:33:22 +0100 oj r268203 : #i99363# use bookmarkable if available and inserted some RTL_LOG 2009-02-18 10:32:57 +0100 oj r268202 : #i99363# use bookmarkable if available and inserted some RTL_LOG 2009-02-17 07:29:05 +0100 oj r267843 : #i96897# remove some dll public 2009-02-16 15:01:04 +0100 oj r267816 : #i96897# remove some dll public 2009-02-16 14:25:53 +0100 oj r267810 : #i99264# remove duplicate code 2009-02-16 14:25:33 +0100 oj r267809 : #i99264# remove duplicate code 2009-02-16 14:24:59 +0100 oj r267808 : #i99264# remove duplicate code 2009-02-13 10:56:17 +0100 oj r267703 : #i99191# comment the contextclassloader 2009-02-13 10:32:40 +0100 oj r267700 : reduce call to resultset meta data 2009-02-13 10:27:31 +0100 oj r267699 : reduce call to resultset meta data 2009-02-13 10:27:08 +0100 oj r267698 : reduce call to resultset meta data
2009-04-23 10:42:05 +00:00
while ((nChildPos >= xLoop->getCount()) && !aContainerHistory.empty() )
{
xLoop = aContainerHistory.top();
aContainerHistory.pop();
nChildPos = aIndexHistory.top();
aIndexHistory.pop();
++nChildPos;
}
if (nChildPos >= xLoop->getCount())
// exited the loop above because we have no history anymore (0 == aContainerHistory.size()),
// and on the current level there are no more children
// -> leave
break;
}
}
while (xLoop.is());
}
//---------------------------------------------------------------------
namespace
{
struct AccumulateSize : public ::std::binary_function< size_t, MapPropertySet2Map::value_type, size_t >
{
2008-10-10 13:02:43 +00:00
size_t operator()( size_t _size, const MapPropertySet2Map::value_type& _map ) const
{
return _size + _map.second.size();
}
};
::rtl::OUString lcl_findFreeControlId( const MapPropertySet2Map& _rAllPagesControlIds )
{
static const ::rtl::OUString sControlIdBase( RTL_CONSTASCII_USTRINGPARAM( "control" ) );
::rtl::OUString sControlId = sControlIdBase;
size_t nKnownControlCount = ::std::accumulate( _rAllPagesControlIds.begin(), _rAllPagesControlIds.end(), (size_t)0, AccumulateSize() );
sControlId += ::rtl::OUString::valueOf( (sal_Int32)nKnownControlCount + 1 );
#ifdef DBG_UTIL
// Check if the id is already used. It shouldn't, as we currently have no mechanism for removing entries
// from the map, so the approach used above (take the accumulated map size) should be sufficient. But if
// somebody changes this (e.g. allows removing entries from the map), the assertion below probably will fail.
for ( MapPropertySet2Map::const_iterator outer = _rAllPagesControlIds.begin();
outer != _rAllPagesControlIds.end();
++outer
)
for ( MapPropertySet2String::const_iterator inner = outer->second.begin();
inner != outer->second.end();
++inner
)
{
OSL_ENSURE( inner->second != sControlId,
"lcl_findFreeControlId: auto-generated control ID is already used!" );
}
#endif
return sControlId;
}
}
//---------------------------------------------------------------------
sal_Bool OFormLayerXMLExport_Impl::checkExamineControl(const Reference< XPropertySet >& _rxObject)
{
Reference< XPropertySetInfo > xCurrentInfo = _rxObject->getPropertySetInfo();
OSL_ENSURE(xCurrentInfo.is(), "OFormLayerXMLExport_Impl::checkExamineControl: no property set info");
sal_Bool bIsControl = xCurrentInfo->hasPropertyByName( PROPERTY_CLASSID );
if (bIsControl)
{
// ----------------------------------
// generate a new control id
// find a free id
::rtl::OUString sCurrentId = lcl_findFreeControlId( m_aControlIds );
// add it to the map
m_aCurrentPageIds->second[_rxObject] = sCurrentId;
// ----------------------------------
// check if this control has a "LabelControl" property referring another control
if ( xCurrentInfo->hasPropertyByName( PROPERTY_CONTROLLABEL ) )
{
Reference< XPropertySet > xCurrentReference( _rxObject->getPropertyValue( PROPERTY_CONTROLLABEL ), UNO_QUERY );
if (xCurrentReference.is())
{
::rtl::OUString& sReferencedBy = m_aCurrentPageReferring->second[xCurrentReference];
if (sReferencedBy.getLength())
// it's not the first _rxObject referring to the xCurrentReference
// -> separate the id
sReferencedBy += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","));
sReferencedBy += sCurrentId;
}
}
// ----------------------------------
// check if the control needs a number format style
if ( xCurrentInfo->hasPropertyByName( PROPERTY_FORMATKEY ) )
{
examineControlNumberFormat(_rxObject);
}
// ----------------------------------
// check if it's a control providing text
Reference< XText > xControlText( _rxObject, UNO_QUERY );
if ( xControlText.is() )
{
m_rContext.GetTextParagraphExport()->collectTextAutoStyles( xControlText );
}
// ----------------------------------
// check if it is a grid control - in this case, we need special handling for the columns
sal_Int16 nControlType = FormComponentType::CONTROL;
_rxObject->getPropertyValue( PROPERTY_CLASSID ) >>= nControlType;
if ( FormComponentType::GRIDCONTROL == nControlType )
{
collectGridColumnStylesAndIds( _rxObject );
}
}
return bIsControl;
}
//---------------------------------------------------------------------
void OFormLayerXMLExport_Impl::collectGridColumnStylesAndIds( const Reference< XPropertySet >& _rxControl )
{
// loop through all columns of the grid
try
{
Reference< XIndexAccess > xContainer( _rxControl, UNO_QUERY );
OSL_ENSURE( xContainer.is(), "OFormLayerXMLExport_Impl::collectGridColumnStylesAndIds: grid control not being a container?!" );
if ( !xContainer.is() )
return;
Reference< XPropertySetInfo > xColumnPropertiesMeta;
sal_Int32 nCount = xContainer->getCount();
for ( sal_Int32 i=0; i<nCount; ++i )
{
Reference< XPropertySet > xColumnProperties( xContainer->getByIndex( i ), UNO_QUERY );
OSL_ENSURE( xColumnProperties.is(), "OFormLayerXMLExport_Impl::collectGridColumnStylesAndIds: invalid grid column encountered!" );
if ( !xColumnProperties.is() )
continue;
// ----------------------------------
// generate a new control id
// find a free id
::rtl::OUString sCurrentId = lcl_findFreeControlId( m_aControlIds );
// add it to the map
m_aCurrentPageIds->second[ xColumnProperties ] = sCurrentId;
// ----------------------------------
// determine a number style, if needed
xColumnPropertiesMeta = xColumnProperties->getPropertySetInfo();
// get the styles of the column
CWS-TOOLING: integrate CWS dba31e 2008-11-19 12:36:23 +0100 msc r263980 : i96104 2008-11-19 12:31:19 +0100 msc r263979 : i96104 2008-11-19 12:21:55 +0100 msc r263977 : i96104 2008-11-19 12:18:53 +0100 msc r263976 : i96104 2008-11-18 09:09:45 +0100 oj r263746 : disable color entry when area is set 2008-11-18 08:37:52 +0100 oj r263741 : #remove sub report entry 2008-11-17 11:20:25 +0100 fs r263708 : #i10000# 2008-11-17 11:06:52 +0100 fs r263706 : minimal version now is 3.1 2008-11-12 22:25:59 +0100 fs r263621 : #i96150# 2008-11-12 22:20:02 +0100 fs r263620 : rebased to m34 2008-11-12 21:39:41 +0100 fs r263618 : MANUAL REBASE: rebase CWS dba31d to DEV300_m34 2008-11-12 13:54:58 +0100 fs r263597 : #i96134# MediaDescriptor.URL is to be preferred over MediaDescriptor.FileName. Nonetheless, ensure both are handled 2008-11-12 13:53:40 +0100 fs r263596 : #i96134# re-enabled the code for #i41897#, a better fix is to come 2008-11-12 12:48:21 +0100 fs r263585 : #i96134# disable saving URLs of file-base databases relatively 2008-11-11 16:11:11 +0100 msc r263566 : #i96104# 2008-11-05 09:09:47 +0100 oj r263342 : #i88727# color noe added 2008-11-05 08:41:43 +0100 oj r263341 : #i77916# zoom added 2008-11-04 21:24:15 +0100 fs r263339 : disposing: call disposeAndClear without own mutex locked - some of our listeners insist on locking the SolarMutex, which sometimes led to deadlocks on the complex test cases 2008-11-04 21:23:15 +0100 fs r263338 : remove SolarMutex locking - this happned in CWS dba31c (in the CVS version), which this CWS was created from, but seems to got lost during resync 2008-11-04 20:49:50 +0100 fs r263335 : docu formatting 2008-11-04 20:06:39 +0100 fs r263334 : #i95826# use m_aMutex, not a DocumentGuard (wrongly resolved merge conflicts) 2008-11-04 17:36:29 +0100 fs r263332 : #i92688# properly revoke as XEventListener from m_xActiveController when disposing 2008-11-04 14:49:34 +0100 fs r263324 : #i92322# enable Input Required if EmptyIsNULL does not exist at the control 2008-10-31 11:10:04 +0100 oj r262857 : merge from cvs to svn 2008-10-31 09:46:45 +0100 oj r262853 : merge from cvs to svn 2008-10-31 08:46:37 +0100 oj r262849 : merge from cvs to svn 2008-10-31 08:44:24 +0100 oj r262848 : merge from cvs to svn 2008-10-31 08:43:33 +0100 oj r262847 : merge from cvs to svn 2008-10-31 08:42:28 +0100 oj r262846 : merge from cvs to svn 2008-10-31 08:41:58 +0100 oj r262845 : merge from cvs to svn 2008-10-31 08:41:32 +0100 oj r262844 : merge from cvs to svn 2008-10-28 12:19:50 +0100 oj r262733 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:42 +0100 oj r262732 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:36 +0100 oj r262731 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:31 +0100 oj r262730 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:22 +0100 oj r262729 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:18 +0100 oj r262728 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:10 +0100 oj r262727 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:06 +0100 oj r262726 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:05 +0100 oj r262725 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:01 +0100 oj r262724 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:50 +0100 oj r262723 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:41 +0100 oj r262722 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:40 +0100 oj r262721 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:27 +0100 oj r262720 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:10 +0100 oj r262719 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:01 +0100 oj r262718 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:17:39 +0100 oj r262717 : #iXXXXX#: migrate CWS dba31e to SVN
2008-12-01 12:31:27 +00:00
::std::vector< XMLPropertyState > aPropertyStates = m_xStyleExportMapper->Filter( xColumnProperties );
// care for the number format, additionally
::rtl::OUString sColumnNumberStyle;
if ( xColumnPropertiesMeta.is() && xColumnPropertiesMeta->hasPropertyByName( PROPERTY_FORMATKEY ) )
sColumnNumberStyle = getImmediateNumberStyle( xColumnProperties );
if ( sColumnNumberStyle.getLength() )
{ // the column indeed has a formatting
CWS-TOOLING: integrate CWS dba31e 2008-11-19 12:36:23 +0100 msc r263980 : i96104 2008-11-19 12:31:19 +0100 msc r263979 : i96104 2008-11-19 12:21:55 +0100 msc r263977 : i96104 2008-11-19 12:18:53 +0100 msc r263976 : i96104 2008-11-18 09:09:45 +0100 oj r263746 : disable color entry when area is set 2008-11-18 08:37:52 +0100 oj r263741 : #remove sub report entry 2008-11-17 11:20:25 +0100 fs r263708 : #i10000# 2008-11-17 11:06:52 +0100 fs r263706 : minimal version now is 3.1 2008-11-12 22:25:59 +0100 fs r263621 : #i96150# 2008-11-12 22:20:02 +0100 fs r263620 : rebased to m34 2008-11-12 21:39:41 +0100 fs r263618 : MANUAL REBASE: rebase CWS dba31d to DEV300_m34 2008-11-12 13:54:58 +0100 fs r263597 : #i96134# MediaDescriptor.URL is to be preferred over MediaDescriptor.FileName. Nonetheless, ensure both are handled 2008-11-12 13:53:40 +0100 fs r263596 : #i96134# re-enabled the code for #i41897#, a better fix is to come 2008-11-12 12:48:21 +0100 fs r263585 : #i96134# disable saving URLs of file-base databases relatively 2008-11-11 16:11:11 +0100 msc r263566 : #i96104# 2008-11-05 09:09:47 +0100 oj r263342 : #i88727# color noe added 2008-11-05 08:41:43 +0100 oj r263341 : #i77916# zoom added 2008-11-04 21:24:15 +0100 fs r263339 : disposing: call disposeAndClear without own mutex locked - some of our listeners insist on locking the SolarMutex, which sometimes led to deadlocks on the complex test cases 2008-11-04 21:23:15 +0100 fs r263338 : remove SolarMutex locking - this happned in CWS dba31c (in the CVS version), which this CWS was created from, but seems to got lost during resync 2008-11-04 20:49:50 +0100 fs r263335 : docu formatting 2008-11-04 20:06:39 +0100 fs r263334 : #i95826# use m_aMutex, not a DocumentGuard (wrongly resolved merge conflicts) 2008-11-04 17:36:29 +0100 fs r263332 : #i92688# properly revoke as XEventListener from m_xActiveController when disposing 2008-11-04 14:49:34 +0100 fs r263324 : #i92322# enable Input Required if EmptyIsNULL does not exist at the control 2008-10-31 11:10:04 +0100 oj r262857 : merge from cvs to svn 2008-10-31 09:46:45 +0100 oj r262853 : merge from cvs to svn 2008-10-31 08:46:37 +0100 oj r262849 : merge from cvs to svn 2008-10-31 08:44:24 +0100 oj r262848 : merge from cvs to svn 2008-10-31 08:43:33 +0100 oj r262847 : merge from cvs to svn 2008-10-31 08:42:28 +0100 oj r262846 : merge from cvs to svn 2008-10-31 08:41:58 +0100 oj r262845 : merge from cvs to svn 2008-10-31 08:41:32 +0100 oj r262844 : merge from cvs to svn 2008-10-28 12:19:50 +0100 oj r262733 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:42 +0100 oj r262732 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:36 +0100 oj r262731 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:31 +0100 oj r262730 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:22 +0100 oj r262729 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:18 +0100 oj r262728 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:10 +0100 oj r262727 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:06 +0100 oj r262726 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:05 +0100 oj r262725 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:01 +0100 oj r262724 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:50 +0100 oj r262723 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:41 +0100 oj r262722 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:40 +0100 oj r262721 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:27 +0100 oj r262720 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:10 +0100 oj r262719 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:01 +0100 oj r262718 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:17:39 +0100 oj r262717 : #iXXXXX#: migrate CWS dba31e to SVN
2008-12-01 12:31:27 +00:00
sal_Int32 nStyleMapIndex = m_xStyleExportMapper->getPropertySetMapper()->FindEntryIndex( CTF_FORMS_DATA_STYLE );
// TODO: move this to the ctor
OSL_ENSURE ( -1 != nStyleMapIndex, "XMLShapeExport::collectShapeAutoStyles: could not obtain the index for our context id!");
XMLPropertyState aNumberStyleState( nStyleMapIndex, makeAny( sColumnNumberStyle ) );
aPropertyStates.push_back( aNumberStyleState );
}
#if OSL_DEBUG_LEVEL > 0
::std::vector< XMLPropertyState >::const_iterator aHaveALook = aPropertyStates.begin();
for ( ; aHaveALook != aPropertyStates.end(); ++aHaveALook )
{
(void)aHaveALook;
}
#endif
// ----------------------------------
// determine the column style
CWS-TOOLING: integrate CWS dbaperf1 2009-04-02 09:12:25 +0200 oj r270372 : CWS-TOOLING: rebase CWS dbaperf1 to trunk@270033 (milestone: DEV300:m45) 2009-03-17 10:20:34 +0100 oj r269577 : add parameter 2009-03-17 10:20:05 +0100 oj r269576 : add parameter 2009-03-12 12:32:24 +0100 oj r269387 : add missing ++ 2009-03-11 12:53:35 +0100 oj r269315 : compile error 2009-03-06 08:52:11 +0100 oj r268968 : #i99264# remove duplicate code 2009-03-06 08:20:08 +0100 oj r268966 : add missingheader 2009-03-06 08:17:41 +0100 oj r268965 : add header 2009-03-06 08:15:07 +0100 oj r268964 : #i99708# remove duplicate code 2009-03-06 07:24:11 +0100 oj r268963 : #i99708# remove duplicate code 2009-03-06 07:22:24 +0100 oj r268962 : #i99708# use tenary operator 2009-03-06 07:19:21 +0100 oj r268961 : remove unused rtl_logs 2009-03-06 07:15:55 +0100 oj r268960 : #i99708# extract getLength from for loop 2009-03-06 07:15:35 +0100 oj r268959 : #i99708# extract getLength from for loop 2009-03-06 07:14:57 +0100 oj r268958 : remove unused rtl_logs 2009-03-06 07:13:01 +0100 oj r268957 : insert DBG_ helper 2009-03-06 07:12:17 +0100 oj r268956 : remove unused rtl_logs 2009-03-06 07:10:26 +0100 oj r268955 : remove unused rtl_logs 2009-03-06 07:04:51 +0100 oj r268954 : #i99708# use tenary operator 2009-03-05 12:04:46 +0100 oj r268895 : comment RTL_LOG out 2009-03-05 09:05:07 +0100 oj r268874 : add rtl logfile 2009-03-04 14:21:18 +0100 oj r268828 : #i99708# make static inplace and some method calls in for loop removed 2009-03-04 14:20:34 +0100 oj r268827 : #i99708# impl double check pattern for getInfohelper 2009-03-02 09:31:42 +0100 oj r268636 : add rtl logfile 2009-03-02 08:18:37 +0100 oj r268633 : add rtl logfile 2009-02-27 11:22:16 +0100 oj r268570 : #i99709# change algorithm for marking objects 2009-02-27 11:17:04 +0100 oj r268568 : #i99708# some improvements to load forms, controls faster and replacement of size() call with !empty() which is much faster 2009-02-24 10:09:35 +0100 sb r268383 : #i99290# no longer care to set a sensible context class loader for native threads attached to the VM 2009-02-23 13:44:04 +0100 oj r268354 : #i76606# seekrow changes 2009-02-23 12:27:30 +0100 oj r268349 : deleted 2009-02-20 15:14:23 +0100 oj r268325 : #i76606# some code changes 2009-02-19 14:15:25 +0100 oj r268284 : #i76606# use of simple prep stmt instead of full blown rowset, when source and dest connection are the same use insert into ... ( select ... ) 2009-02-19 11:27:55 +0100 oj r268265 : #i76606# insert some RTL_LOG and setObject impl 2009-02-18 14:45:37 +0100 oj r268222 : #i99363# insert RTL_LOG 2009-02-18 14:45:18 +0100 oj r268221 : #i99363# insert RTL_LOG 2009-02-18 11:14:54 +0100 oj r268207 : #i99363# call some impl_ methods to avoid duplicate cechCache calls 2009-02-18 11:10:47 +0100 oj r268206 : #i99363# make isCount inline 2009-02-18 10:33:22 +0100 oj r268203 : #i99363# use bookmarkable if available and inserted some RTL_LOG 2009-02-18 10:32:57 +0100 oj r268202 : #i99363# use bookmarkable if available and inserted some RTL_LOG 2009-02-17 07:29:05 +0100 oj r267843 : #i96897# remove some dll public 2009-02-16 15:01:04 +0100 oj r267816 : #i96897# remove some dll public 2009-02-16 14:25:53 +0100 oj r267810 : #i99264# remove duplicate code 2009-02-16 14:25:33 +0100 oj r267809 : #i99264# remove duplicate code 2009-02-16 14:24:59 +0100 oj r267808 : #i99264# remove duplicate code 2009-02-13 10:56:17 +0100 oj r267703 : #i99191# comment the contextclassloader 2009-02-13 10:32:40 +0100 oj r267700 : reduce call to resultset meta data 2009-02-13 10:27:31 +0100 oj r267699 : reduce call to resultset meta data 2009-02-13 10:27:08 +0100 oj r267698 : reduce call to resultset meta data
2009-04-23 10:42:05 +00:00
if ( !aPropertyStates.empty() )
{ // add to the style pool
::rtl::OUString sColumnStyleName = m_rContext.GetAutoStylePool()->Add( XML_STYLE_FAMILY_CONTROL_ID, aPropertyStates );
OSL_ENSURE( m_aGridColumnStyles.end() == m_aGridColumnStyles.find( xColumnProperties ),
"OFormLayerXMLExport_Impl::collectGridColumnStylesAndIds: already have a style for this column!" );
m_aGridColumnStyles.insert( MapPropertySet2String::value_type( xColumnProperties, sColumnStyleName ) );
}
}
}
catch( const Exception& )
{
DBG_UNHANDLED_EXCEPTION();
}
}
//---------------------------------------------------------------------
sal_Int32 OFormLayerXMLExport_Impl::implExamineControlNumberFormat( const Reference< XPropertySet >& _rxObject )
{
// get the format key relative to our own formats supplier
sal_Int32 nOwnFormatKey = ensureTranslateFormat( _rxObject );
if ( -1 != nOwnFormatKey )
// tell the exporter that we used this format
getControlNumberStyleExport()->SetUsed( nOwnFormatKey );
return nOwnFormatKey;
}
//---------------------------------------------------------------------
void OFormLayerXMLExport_Impl::examineControlNumberFormat( const Reference< XPropertySet >& _rxControl )
{
sal_Int32 nOwnFormatKey = implExamineControlNumberFormat( _rxControl );
if ( -1 == nOwnFormatKey )
// nothing to do, the number format of this control is void
return;
// remember the format key for this control (we'll be asked in getControlNumberStyle for this)
OSL_ENSURE(m_aControlNumberFormats.end() == m_aControlNumberFormats.find(_rxControl),
"OFormLayerXMLExport_Impl::examineControlNumberFormat: already handled this control!");
m_aControlNumberFormats[_rxControl] = nOwnFormatKey;
}
//---------------------------------------------------------------------
sal_Int32 OFormLayerXMLExport_Impl::ensureTranslateFormat(const Reference< XPropertySet >& _rxFormattedControl)
{
ensureControlNumberStyleExport();
OSL_ENSURE(m_xControlNumberFormats.is(), "OFormLayerXMLExport_Impl::ensureTranslateFormat: no own formats supplier!");
// (should have been created in ensureControlNumberStyleExport)
sal_Int32 nOwnFormatKey = -1;
// the format key (relative to the control's supplier)
sal_Int32 nControlFormatKey = -1;
Any aControlFormatKey = _rxFormattedControl->getPropertyValue(PROPERTY_FORMATKEY);
if (aControlFormatKey >>= nControlFormatKey)
{
// the control's number format
Reference< XNumberFormatsSupplier > xControlFormatsSupplier;
_rxFormattedControl->getPropertyValue(PROPERTY_FORMATSSUPPLIER) >>= xControlFormatsSupplier;
Reference< XNumberFormats > xControlFormats;
if (xControlFormatsSupplier.is())
xControlFormats = xControlFormatsSupplier->getNumberFormats();
OSL_ENSURE(xControlFormats.is(), "OFormLayerXMLExport_Impl::ensureTranslateFormat: formatted control without supplier!");
// obtain the persistent (does not depend on the formats supplier) representation of the control's format
Locale aFormatLocale;
::rtl::OUString sFormatDescription;
if (xControlFormats.is())
{
Reference< XPropertySet > xControlFormat = xControlFormats->getByKey(nControlFormatKey);
xControlFormat->getPropertyValue(PROPERTY_LOCALE) >>= aFormatLocale;
xControlFormat->getPropertyValue(PROPERTY_FORMATSTRING) >>= sFormatDescription;
}
// check if our own formats collection already knows the format
nOwnFormatKey = m_xControlNumberFormats->queryKey(sFormatDescription, aFormatLocale, sal_False);
if (-1 == nOwnFormatKey)
{ // no, we don't
// -> create a new format
nOwnFormatKey = m_xControlNumberFormats->addNew(sFormatDescription, aFormatLocale);
}
OSL_ENSURE(-1 != nOwnFormatKey, "OFormLayerXMLExport_Impl::ensureTranslateFormat: could not translate the controls format key!");
}
else
OSL_ENSURE(!aControlFormatKey.hasValue(), "OFormLayerXMLExport_Impl::ensureTranslateFormat: invalid number format property value!");
return nOwnFormatKey;
}
//---------------------------------------------------------------------
void OFormLayerXMLExport_Impl::ensureControlNumberStyleExport()
{
if (!m_pControlNumberStyles)
{
// create our number formats supplier (if necessary)
Reference< XNumberFormatsSupplier > xFormatsSupplier;
OSL_ENSURE(!m_xControlNumberFormats.is(), "OFormLayerXMLExport_Impl::getControlNumberStyleExport: inconsistence!");
// the m_xControlNumberFormats and m_pControlNumberStyles should be maintained together
try
{
// create it for en-US (does not really matter, as we will specify a locale for every
// concrete language to use)
Sequence< Any > aSupplierArgs(1);
aSupplierArgs[0] <<= Locale ( ::rtl::OUString::createFromAscii("en"),
::rtl::OUString::createFromAscii("US"),
::rtl::OUString()
);
// #110680#
//Reference< XInterface > xFormatsSupplierUntyped =
// ::comphelper::getProcessServiceFactory()->createInstanceWithArguments(
// SERVICE_NUMBERFORMATSSUPPLIER,
// aSupplierArgs
// );
Reference< XInterface > xFormatsSupplierUntyped =
m_rContext.getServiceFactory()->createInstanceWithArguments(
SERVICE_NUMBERFORMATSSUPPLIER,
aSupplierArgs
);
OSL_ENSURE(xFormatsSupplierUntyped.is(), "OFormLayerXMLExport_Impl::getControlNumberStyleExport: could not instantiate a number formats supplier!");
xFormatsSupplier = Reference< XNumberFormatsSupplier >(xFormatsSupplierUntyped, UNO_QUERY);
if (xFormatsSupplier.is())
m_xControlNumberFormats = xFormatsSupplier->getNumberFormats();
}
catch(const Exception&)
{
}
OSL_ENSURE(m_xControlNumberFormats.is(), "OFormLayerXMLExport_Impl::getControlNumberStyleExport: could not obtain my default number formats!");
// create the exporter
m_pControlNumberStyles = new SvXMLNumFmtExport(m_rContext, xFormatsSupplier, getControlNumberStyleNamePrefix());
}
}
//---------------------------------------------------------------------
SvXMLNumFmtExport* OFormLayerXMLExport_Impl::getControlNumberStyleExport()
{
ensureControlNumberStyleExport();
return m_pControlNumberStyles;
}
//---------------------------------------------------------------------
void OFormLayerXMLExport_Impl::excludeFromExport( const Reference< XControlModel > _rxControl )
{
Reference< XPropertySet > xProps( _rxControl, UNO_QUERY );
OSL_ENSURE( xProps.is(), "OFormLayerXMLExport_Impl::excludeFromExport: invalid control model!" );
#if OSL_DEBUG_LEVEL > 0
::std::pair< PropertySetBag::iterator, bool > aPos =
#endif
m_aIgnoreList.insert( xProps );
OSL_ENSURE( aPos.second, "OFormLayerXMLExport_Impl::excludeFromExport: element already exists in the ignore list!" );
}
//.........................................................................
} // namespace xmloff
//.........................................................................