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;
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);
454 const Reference< xml::sax::XFastAttributeList >&)
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.
rtl::Reference< XMLShapeImportHelper > const & GetShapeImport()
static OUString getPrefixAndNameFromToken(sal_Int32 nToken)
SvXMLImportFlags getImportFlags() const
const css::uno::Reference< css::frame::XModel > & GetModel() const
XMLEventImportHelper & GetEventImport()
void AddTranslationTable(const XMLEventNameTranslation *pTransTable)
add event name translation to the internal table
void PopTranslationTable()
recover the top-most previously saved translation table
void PushTranslationTable()
save the old translation table on a stack and install an empty table
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)
const SvXMLEnumMapEntry< TriState > aCheckStateMap[]
const SvXMLEnumMapEntry< NavigationBarMode > aNavigationTypeMap[]
const SvXMLEnumMapEntry< sal_Int16 > aVisualEffectMap[]
const SvXMLEnumMapEntry< sal_Int32 > aOrientationMap[]
const SvXMLEnumMapEntry< FormSubmitMethod > aSubmitMethodMap[]
const SvXMLEnumMapEntry< ListSourceType > aListSourceTypeMap[]
const SvXMLEnumMapEntry< FormButtonType > aFormButtonTypeMap[]
const XMLEventNameTranslation * g_pFormsEventTranslation
const SvXMLEnumMapEntry< FormSubmitEncoding > aSubmitEncodingMap[]
const SvXMLEnumMapEntry< sal_Int32 > aCommandTypeMap[]
const SvXMLEnumMapEntry< TabulatorCycle > aTabulatorCycleMap[]
#define PROPERTY_TABINDEX
#define PROPERTY_DEFAULT_STATE
#define PROPERTY_MAXTEXTLENGTH
#define PROPERTY_BUTTONTYPE
#define PROPERTY_STRICTFORMAT
#define PROPERTY_EMPTY_IS_NULL
#define PROPERTY_MULTISELECTION
#define PROPERTY_DROPDOWN
#define PROPERTY_NAVIGATION
#define PROPERTY_VISUAL_EFFECT
#define PROPERTY_LINECOUNT
#define PROPERTY_ALLOWDELETES
#define PROPERTY_TARGETFRAME
#define PROPERTY_FORMATKEY
#define PROPERTY_ALLOWUPDATES
#define PROPERTY_LISTSOURCETYPE
#define PROPERTY_FOCUS_ON_CLICK
#define PROPERTY_BOUNDCOLUMN
#define PROPERTY_CONTROLLABEL
#define PROPERTY_INPUT_REQUIRED
#define PROPERTY_MULTILINE
#define PROPERTY_IGNORERESULT
#define PROPERTY_FORMATSSUPPLIER
#define PROPERTY_DATASOURCENAME
#define PROPERTY_ORIENTATION
#define PROPERTY_GROUP_NAME
#define PROPERTY_SUBMIT_ENCODING
#define PROPERTY_BLOCK_INCREMENT
#define PROPERTY_COMMAND_TYPE
#define PROPERTY_TARGETURL
#define PROPERTY_DATAFIELD
#define PROPERTY_AUTOCOMPLETE
#define PROPERTY_APPLYFILTER
#define PROPERTY_SUBMIT_METHOD
#define PROPERTY_ALLOWINSERTS
#define PROPERTY_READONLY
#define PROPERTY_TRISTATE
#define PROPERTY_DEFAULTBUTTON
#define PROPERTY_PRINTABLE
#define PROPERTY_ESCAPEPROCESSING
#define XML_ELEMENT(prefix, name)
constexpr sal_Int32 TOKEN_MASK