31#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
32#include <com/sun/star/form/FormSubmitEncoding.hpp>
33#include <com/sun/star/form/FormSubmitMethod.hpp>
34#include <com/sun/star/sdb/CommandType.hpp>
35#include <com/sun/star/form/NavigationBarMode.hpp>
36#include <com/sun/star/form/TabulatorCycle.hpp>
37#include <com/sun/star/form/FormButtonType.hpp>
38#include <com/sun/star/form/ListSourceType.hpp>
44#include <rtl/strbuf.hxx>
65 :m_rImporter(_rImporter)
96 "OFormLayerXMLImport_Impl::OFormLayerXMLImport_Impl: invalid attribute names (1)!");
104 "OFormLayerXMLImport_Impl::OFormLayerXMLImport_Impl: invalid attribute names (2)!");
223 OSL_ENSURE(!
m_xAutoStyles.is(),
"OFormLayerXMLImport_Impl::setAutoStyleContext: not to be called twice!");
229 OSL_ENSURE(_rxControlModel.is() && (!_rControlNumberStyleName.isEmpty()),
230 "OFormLayerXMLImport_Impl::applyControlNumberStyle: invalid arguments (this will crash)!");
232 OSL_ENSURE(
m_xAutoStyles.is(),
"OFormLayerXMLImport_Impl::applyControlNumberStyle: have no auto style context!");
250 Reference< XNumberFormatsSupplier > xFormatsSupplier;
252 Reference< XNumberFormats > xFormats;
253 if (xFormatsSupplier.is())
254 xFormats = xFormatsSupplier->getNumberFormats();
255 OSL_ENSURE(xFormats.is(),
"OFormLayerXMLImport_Impl::applyControlNumberStyle: could not obtain the controls number formats!");
260 sal_Int32 nFormatKey =
const_cast<SvXMLNumFormatContext*
>(pDataStyle)->CreateAndInsert( xFormatsSupplier );
261 OSL_ENSURE(-1 != nFormatKey,
"OFormLayerXMLImport_Impl::applyControlNumberStyle: could not obtain a format key!");
269 OSL_FAIL(
"OFormLayerXMLImport_Impl::applyControlNumberStyle: couldn't set the format!");
273 OSL_FAIL(
"OFormLayerXMLImport_Impl::applyControlNumberStyle: did not find the style with the given name!");
278 OSL_ENSURE( _rxControlModel.is() && !_rCellAddress.isEmpty(),
279 "OFormLayerXMLImport_Impl::registerCellValueBinding: invalid arguments!" );
284 const Reference< XPropertySet >& _rxControlModel,
285 const OUString& _rBindingID )
288 OSL_ENSURE( _rxControlModel.is(),
"need model" );
294 const Reference< XPropertySet >& _rxControlModel,
295 const OUString& _rBindingID )
298 OSL_ENSURE( _rxControlModel.is(),
"need model" );
304 const Reference< XPropertySet >& _rxControlModel,
305 const OUString& _rSubmissionID )
308 OSL_ENSURE( _rxControlModel.is(),
"need model" );
315 OSL_ENSURE( _rxControlModel.is() && !_rCellRangeAddress.isEmpty(),
316 "OFormLayerXMLImport_Impl::registerCellRangeListSource: invalid arguments!" );
321 OSL_ENSURE(
m_xAutoStyles.is(),
"OFormLayerXMLImport_Impl::getStyleElement: have no auto style context!" );
327 OStringBuffer(
"OFormLayerXMLImport_Impl::getStyleElement: did not find the style named \"" +
330 return pControlStyle;
336 m_rImporter.GetEventImport().PushTranslationTable();
343 m_rImporter.GetEventImport().PopTranslationTable();
349 OSL_ENSURE(!_rId.isEmpty(),
"OFormLayerXMLImport_Impl::registerControlId: invalid (empty) control id!");
357 OSL_ENSURE(!_rReferringControls.isEmpty(),
"OFormLayerXMLImport_Impl::registerControlReferences: invalid (empty) control id list!");
358 OSL_ENSURE(_rxControl.is(),
"OFormLayerXMLImport_Impl::registerControlReferences: invalid (NULL) control!");
366 OSL_ENSURE(_rxDrawPage.is(),
"OFormLayerXMLImport_Impl::startPage: NULL page!");
368 OSL_ENSURE(
m_xCurrentPageFormsSupp.is(),
"OFormLayerXMLImport_Impl::startPage: invalid draw page (no XFormsSupplier)!" );
374 OSL_ENSURE(aPagePosition.second,
"OFormLayerXMLImport_Impl::startPage: already imported this page!");
380 OSL_ENSURE(
m_xCurrentPageFormsSupp.is(),
"OFormLayerXMLImport_Impl::endPage: sure you called startPage before?" );
386 OUString sCurrentReferring;
387 OUString sSeparator(&s_nSeparator, 1);
388 Reference< XPropertySet > xCurrentReferring;
389 sal_Int32 nSeparator, nPrevSep;
396 OUString sReferring = rReferences.second + sSeparator;
399 while (-1 != (nSeparator = sReferring.indexOf(s_nSeparator, nPrevSep + 1)))
401 sCurrentReferring = sReferring.copy(nPrevSep + 1, nSeparator - nPrevSep - 1);
403 if (xCurrentReferring.is())
407 nPrevSep = nSeparator;
414 "unable to knit the control references (caught an exception)!");
418 Reference< XIndexAccess > xIndexContainer;
421 if ( xIndexContainer.is() )
434 Reference< XPropertySet > xReturn;
437 MapString2PropertySet::const_iterator aPos =
m_aCurrentPageIds->second.find(_rControlId);
439 xReturn = aPos->second;
441 SAL_WARN(
"xmloff",
"unknown control id " << _rControlId);
447 SvXMLImport& _rImport)
454 const Reference< xml::sax::XFastAttributeList >&)
467 SAL_WARN(
"xmloff",
"unknown element " << SvXMLImport::getPrefixAndNameFromToken(nElement));
488 OSL_ENSURE(
aHelper.isCellBindingAllowed(),
"OFormLayerXMLImport_Impl::documentDone: can't bind this control model!" );
489 if (
aHelper.isCellBindingAllowed() )
493 OUString sBoundCellAddress( rCellBindings.second );
494 sal_Int32 nIndicator = sBoundCellAddress.lastIndexOf(
":index" );
496 bool bUseIndexBinding =
false;
497 if ( nIndicator != -1 )
499 sBoundCellAddress = sBoundCellAddress.copy( 0, nIndicator );
500 bUseIndexBinding =
true;
503 aHelper.setBinding(
aHelper.createCellBindingFromStringAddress( sBoundCellAddress, bUseIndexBinding ) );
509 "caught an exception while binding to a cell!");
525 OSL_ENSURE(
aHelper.isListCellRangeAllowed(),
"OFormLayerXMLImport_Impl::documentDone: can't bind this control model!" );
526 if (
aHelper.isListCellRangeAllowed() )
528 aHelper.setListSource(
aHelper.createCellListSourceFromStringAddress( rRangeBindings.second ) );
534 "caught an exception while binding to a cell range!");
This class deliberately does not support XWeak, to improve performance when loading large documents.
void addEnumProperty(sal_Int32 nAttributeToken, const OUString &_rPropertyName, const SvXMLEnumMapEntry< EnumT > *_pValueMap, const css::uno::Type *_pType=nullptr)
add an attribute assignment referring to an enum property to the map
void addInt16Property(sal_Int32 nAttributeToken, const OUString &_rPropertyName)
add an attribute assignment referring to an int16 property to the map
void addStringProperty(sal_Int32 nAttributeToken, const OUString &_rPropertyName)
add an attribute assignment referring to a string property to the map
void addBooleanProperty(sal_Int32 nAttributeToken, const OUString &_rPropertyName, const bool _bAttributeDefault, const bool _bInverseSemantics=false)
add an attribute assignment referring to a boolean property to the map
void addInt32Property(sal_Int32 nAttributeToken, const OUString &_rPropertyName)
add an attribute assignment referring to an int32 property to the map
void setEvents(const css::uno::Reference< css::container::XIndexAccess > &_rxContainer)
#define TOOLS_WARN_EXCEPTION(area, stream)
#define SAL_WARN(area, stream)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
constexpr OUStringLiteral PROPERTY_INPUT_REQUIRED
constexpr OUStringLiteral PROPERTY_CYCLE
constexpr OUStringLiteral PROPERTY_BUTTONTYPE
constexpr OUStringLiteral PROPERTY_BLOCK_INCREMENT
const SvXMLEnumMapEntry< TriState > aCheckStateMap[]
constexpr OUStringLiteral PROPERTY_DEFAULT_STATE
constexpr OUStringLiteral PROPERTY_ALLOWUPDATES
const SvXMLEnumMapEntry< NavigationBarMode > aNavigationTypeMap[]
constexpr OUStringLiteral PROPERTY_LINECOUNT
constexpr OUStringLiteral PROPERTY_STRICTFORMAT
constexpr OUStringLiteral PROPERTY_ALLOWDELETES
constexpr OUStringLiteral PROPERTY_TARGETFRAME
constexpr OUStringLiteral PROPERTY_ENABLED
const SvXMLEnumMapEntry< sal_Int16 > aVisualEffectMap[]
const SvXMLEnumMapEntry< sal_Int32 > aOrientationMap[]
constexpr OUStringLiteral PROPERTY_ESCAPEPROCESSING
const SvXMLEnumMapEntry< FormSubmitMethod > aSubmitMethodMap[]
constexpr OUStringLiteral PROPERTY_COMMAND_TYPE
constexpr OUStringLiteral PROPERTY_TRISTATE
constexpr OUStringLiteral PROPERTY_TITLE
constexpr OUStringLiteral PROPERTY_DEFAULTBUTTON
constexpr OUStringLiteral PROPERTY_ALLOWINSERTS
constexpr OUStringLiteral PROPERTY_COMMAND
constexpr OUStringLiteral PROPERTY_DATAFIELD
constexpr OUStringLiteral PROPERTY_STATE
const SvXMLEnumMapEntry< ListSourceType > aListSourceTypeMap[]
constexpr OUStringLiteral PROPERTY_MULTISELECTION
const SvXMLEnumMapEntry< FormButtonType > aFormButtonTypeMap[]
constexpr OUStringLiteral PROPERTY_NAME
const XMLEventNameTranslation * g_pFormsEventTranslation
constexpr OUStringLiteral PROPERTY_LABEL
constexpr OUStringLiteral PROPERTY_PRINTABLE
constexpr OUStringLiteral PROPERTY_IGNORERESULT
constexpr OUStringLiteral PROPERTY_CONTROLLABEL
constexpr OUStringLiteral PROPERTY_READONLY
const SvXMLEnumMapEntry< FormSubmitEncoding > aSubmitEncodingMap[]
constexpr OUStringLiteral PROPERTY_ORIENTATION
constexpr OUStringLiteral PROPERTY_MAXTEXTLENGTH
const SvXMLEnumMapEntry< sal_Int32 > aCommandTypeMap[]
constexpr OUStringLiteral PROPERTY_TABSTOP
constexpr OUStringLiteral PROPERTY_SUBMIT_ENCODING
constexpr OUStringLiteral PROPERTY_TARGETURL
constexpr OUStringLiteral PROPERTY_VISUAL_EFFECT
constexpr OUStringLiteral PROPERTY_DROPDOWN
constexpr OUStringLiteral PROPERTY_ORDER
constexpr OUStringLiteral PROPERTY_SUBMIT_METHOD
constexpr OUStringLiteral PROPERTY_EMPTY_IS_NULL
constexpr OUStringLiteral PROPERTY_FOCUS_ON_CLICK
constexpr OUStringLiteral PROPERTY_APPLYFILTER
constexpr OUStringLiteral PROPERTY_TOGGLE
const SvXMLEnumMapEntry< TabulatorCycle > aTabulatorCycleMap[]
constexpr OUStringLiteral PROPERTY_MULTILINE
constexpr OUStringLiteral PROPERTY_TABINDEX
constexpr OUStringLiteral PROPERTY_NAVIGATION
constexpr OUStringLiteral PROPERTY_FILTER
constexpr OUStringLiteral PROPERTY_BOUNDCOLUMN
constexpr OUStringLiteral PROPERTY_DATASOURCENAME
constexpr OUStringLiteral PROPERTY_FORMATSSUPPLIER
constexpr OUStringLiteral PROPERTY_AUTOCOMPLETE
constexpr OUStringLiteral PROPERTY_LISTSOURCETYPE
constexpr OUStringLiteral PROPERTY_FORMATKEY
constexpr OUStringLiteral PROPERTY_GROUP_NAME
#define XML_ELEMENT(prefix, name)
constexpr sal_Int32 TOKEN_MASK