include/sax/fastattribs.hxx | 4 include/xmloff/formlayerimport.hxx | 8 include/xmloff/xformsimport.hxx | 2 include/xmloff/xmltoken.hxx | 23 + sax/source/tools/fastattribs.cxx | 29 + xmloff/source/core/xmltoken.cxx | 23 + xmloff/source/forms/controlelement.cxx | 31 + xmloff/source/forms/controlelement.hxx | 9 xmloff/source/forms/elementimport.cxx | 589 ++++++++++++++-------------- xmloff/source/forms/elementimport.hxx | 202 ++++----- xmloff/source/forms/eventimport.cxx | 4 xmloff/source/forms/eventimport.hxx | 2 xmloff/source/forms/formattributes.cxx | 170 +++++++- xmloff/source/forms/formattributes.hxx | 56 +- xmloff/source/forms/formlayerimport.cxx | 18 xmloff/source/forms/layerimport.cxx | 125 ++--- xmloff/source/forms/layerimport.hxx | 9 xmloff/source/forms/officeforms.cxx | 24 - xmloff/source/forms/officeforms.hxx | 14 xmloff/source/forms/property_meta_data.cxx | 9 xmloff/source/forms/property_meta_data.hxx | 4 xmloff/source/forms/propertyimport.cxx | 53 +- xmloff/source/forms/propertyimport.hxx | 25 - xmloff/source/token/tokens.txt | 23 + xmloff/source/xforms/TokenContext.cxx | 9 xmloff/source/xforms/TokenContext.hxx | 3 xmloff/source/xforms/XFormsModelContext.cxx | 6 xmloff/source/xforms/XFormsModelContext.hxx | 1 xmloff/source/xforms/xformsimport.cxx | 6 29 files changed, 927 insertions(+), 554 deletions(-)
New commits: commit 3de38e95561ab7ca114d9f3307702ba89c4e3e9a Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Tue Nov 10 19:20:06 2020 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Nov 11 06:33:53 2020 +0100 use fastparser in forms Change-Id: I7d09d64857e24267b4b4baddb563e28ceea92f2e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105560 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx index 8b8138d82e9b..a9bb67e62841 100644 --- a/include/sax/fastattribs.hxx +++ b/include/sax/fastattribs.hxx @@ -73,6 +73,7 @@ class SAX_DLLPUBLIC FastAttributeList final : public cppu::WeakImplHelper< css:: { public: FastAttributeList( FastTokenHandlerBase *pTokenHandler ); + FastAttributeList( const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ); virtual ~FastAttributeList() override; void clear(); @@ -81,6 +82,8 @@ public: maAttributeValues.reserve(nNumTokens+1); maAttributeTokens.reserve(nNumTokens); } + void add( const FastAttributeList& ); + void add( const css::uno::Reference<css::xml::sax::XFastAttributeList>& ); void add( sal_Int32 nToken, const char* pValue ); void add( sal_Int32 nToken, const char* pValue, size_t nValueLength ); void add( sal_Int32 nToken, const OString& rValue ); @@ -91,6 +94,7 @@ public: const std::vector< sal_Int32 >& getFastAttributeTokens() const { return maAttributeTokens; } const char* getFastAttributeValue(size_t nIndex) const { return mpChunk + maAttributeValues[nIndex]; } sal_Int32 AttributeValueLength(size_t i) const { return maAttributeValues[i + 1] - maAttributeValues[i] - 1; } + size_t size() const { return maAttributeValues.size(); } // performance sensitive shortcuts to avoid allocation ... bool getAsInteger( sal_Int32 nToken, sal_Int32 &rInt) const; diff --git a/include/xmloff/formlayerimport.hxx b/include/xmloff/formlayerimport.hxx index 4834f85d19d9..d9797f0757ec 100644 --- a/include/xmloff/formlayerimport.hxx +++ b/include/xmloff/formlayerimport.hxx @@ -29,6 +29,7 @@ namespace com::sun::star::beans { class XPropertySet; } namespace com::sun::star::drawing { class XDrawPage; } namespace com::sun::star::xml::sax { class XAttributeList; } +namespace com::sun::star::xml::sax { class XFastAttributeList; } class SvXMLImport; class SvXMLImportContext; @@ -68,6 +69,8 @@ namespace xmloff SvXMLImport& _rImport, sal_uInt16 _nPrefix, const OUString& _rLocalName); + static SvXMLImportContext* createOfficeFormsContext( + SvXMLImport& _rImport); /** create an SvXMLImportContext instance which is able to import the <form:form> element. @@ -78,9 +81,8 @@ namespace xmloff @see endPage */ SvXMLImportContext* createContext( - const sal_uInt16 _nPrefix, - const OUString& _rLocalName, - const css::uno::Reference< css::xml::sax::XAttributeList >& _rxAttribs); + const sal_Int32 _nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& _rxAttribs); /** lookup a control given by id. diff --git a/include/xmloff/xformsimport.hxx b/include/xmloff/xformsimport.hxx index b580af57608b..b6b86044ce1b 100644 --- a/include/xmloff/xformsimport.hxx +++ b/include/xmloff/xformsimport.hxx @@ -39,6 +39,8 @@ XMLOFF_DLLPUBLIC SvXMLImportContext* createXFormsModelContext( SvXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLocalName ); +XMLOFF_DLLPUBLIC SvXMLImportContext* createXFormsModelContext( + SvXMLImport& rImport ); /** perform the actual binding of an XForms-binding with the suitable control * @param document which contains the XForms-model(s) diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx index 6b2fed011a39..e0f3ef898c65 100644 --- a/include/xmloff/xmltoken.hxx +++ b/include/xmloff/xmltoken.hxx @@ -217,6 +217,9 @@ namespace xmloff::token { XML_ALIGN, XML_ALL, XML_ALLOW_EMPTY_CELL, + XML_ALLOW_DELETES, + XML_ALLOW_INSERTS, + XML_ALLOW_UPDATES, XML_ALPHABETICAL_INDEX, XML_ALPHABETICAL_INDEX_AUTO_MARK_FILE, XML_ALPHABETICAL_INDEX_ENTRY_TEMPLATE, @@ -365,6 +368,7 @@ namespace xmloff::token { XML_BUTTON3, XML_BUTTON4, XML_BUTTONS, + XML_BUTTON_TYPE, XML_BVAR, XML_C, XML_CALCULATION_SETTINGS, @@ -488,6 +492,7 @@ namespace xmloff::token { XML_CONTROL, XML_CONVERSION_MODE, XML_CONVERSION_TYPE, + XML_CONVERT_EMPTY_TO_NULL, XML_COPY_BACK, XML_COPY_FORMULAS, XML_COPY_OUTLINE_LEVELS, @@ -612,6 +617,7 @@ namespace xmloff::token { XML_DECORATIVE, XML_DEEP, XML_DEFAULT, + XML_DEFAULT_BUTTON, XML_DEFAULT_CELL_STYLE_NAME, XML_DEFAULT_STYLE, XML_DEFAULT_STYLE_NAME, @@ -684,6 +690,7 @@ namespace xmloff::token { XML_DROPDOWN, XML_DROP_CAP, XML_DYNAMIC, + XML_ECHO_CHAR, XML_EDGE_ROUNDING, XML_EDITABLE, XML_EDITING_CYCLES, @@ -702,6 +709,7 @@ namespace xmloff::token { XML_ENABLE_NUMBERING, XML_ENABLED, XML_ENCODING, + XML_ENCTYPE, XML_END, XML_END_ANGLE, XML_END_CELL_ADDRESS, @@ -809,6 +817,7 @@ namespace xmloff::token { XML_FLOOR, XML_FN, XML_FOCAL_LENGTH, + XML_FOCUS_ON_CLICK, XML_FONT_CHAR_WIDTH, XML_FONT_CHARSET, XML_FONT_CHARSET_ASIAN, @@ -880,6 +889,7 @@ namespace xmloff::token { XML_FOOTNOTE_SEP, XML_FOOTNOTES_CONFIGURATION, XML_FOOTNOTES_POSITION, + XML_FOR, XML_FORALL, XML_FORCE_MANUAL, XML_FOREGROUND, @@ -1021,6 +1031,7 @@ namespace xmloff::token { XML_IDEOGRAPH_ALPHA, XML_IGNORE_CASE, XML_IGNORE_EMPTY_ROWS, + XML_IGNORE_RESULT, XML_IGNORE_SELECTED_PAGE, // used for ODF compatibility XML_ILLUSTRATION_INDEX, XML_ILLUSTRATION_INDEX_ENTRY_TEMPLATE, @@ -1055,6 +1066,7 @@ namespace xmloff::token { XML_INFORMATION, XML_INITIAL_CREATOR, XML_INPROCEEDINGS, + XML_INPUT_REQUIRED, XML_INSERT_COLUMNS, XML_INSERT_ROWS, XML_INSERTION, @@ -1078,6 +1090,7 @@ namespace xmloff::token { XML_IS_SELECTION, XML_ISBN, XML_ITALIC, + XML_ITEM, XML_ITERATION, XML_JOURNAL, XML_JUSTIFIED, @@ -1302,6 +1315,8 @@ namespace xmloff::token { XML_MTEXT, XML_MTR, XML_MULTI_DELETION_SPANNED, + XML_MULTI_LINE, + XML_MULTIPLE, XML_MUNDER, XML_MUNDEROVER, XML_NAME, @@ -1309,6 +1324,7 @@ namespace xmloff::token { XML_NAMED_EXPRESSION, XML_NAMED_EXPRESSIONS, XML_NAMED_RANGE, + XML_NAVIGATION_MODE, XML_NAVY, XML_NEGATIVE_COLOR, XML_NEQ, @@ -1416,6 +1432,7 @@ namespace xmloff::token { XML_PAGE_NUMBER, XML_PAGE_NUMBER_VISIBLE, XML_PAGE_START_MARGIN, + XML_PAGE_STEP_SIZE, XML_PAGE_STYLE_NAME, XML_PAGE_THUMBNAIL, XML_PAGE_USAGE, @@ -1769,6 +1786,7 @@ namespace xmloff::token { XML_START_TABLE, XML_START_VALUE, XML_START_WITH_NAVIGATOR, + XML_STATE, XML_STATISTICS, XML_STATUS, XML_STAY_ON_TOP, @@ -1823,6 +1841,8 @@ namespace xmloff::token { XML_SYMBOL_WIDTH, XML_SYSTEM, XML_TAB_COLOR, + XML_TAB_CYCLE, + XML_TAB_INDEX, XML_TAB_STOP, XML_TAB_STOP_DISTANCE, XML_TAB_STOPS, @@ -1930,6 +1950,7 @@ namespace xmloff::token { XML_TOC_MARK, XML_TOC_MARK_END, XML_TOC_MARK_START, + XML_TOGGLE, XML_TOP, XML_TOP_LEFT, XML_TOP_PERCENT, @@ -2012,6 +2033,7 @@ namespace xmloff::token { XML_USER_INDEX_SOURCE, XML_USER_TRANSFORMED, XML_USERNAME, + XML_VALIDATION, XML_VALUE, XML_VALUE_TYPE, XML_VALUES_CELL_RANGE_ADDRESS, @@ -2051,6 +2073,7 @@ namespace xmloff::token { XML_VISIBLE_AREA_TOP, XML_VISIBLE_AREA_WIDTH, XML_VISITED_STYLE_NAME, + XML_VISUAL_EFFECT, XML_VOLATILE, XML_VOLUME, XML_VPN, diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx index c021e892f91e..a8c3e57cae86 100644 --- a/sax/source/tools/fastattribs.cxx +++ b/sax/source/tools/fastattribs.cxx @@ -63,6 +63,19 @@ FastAttributeList::FastAttributeList( sax_fastparser::FastTokenHandlerBase *pTok maAttributeValues.push_back( 0 ); } +FastAttributeList::FastAttributeList( const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) +{ + const auto& rOther = castToFastAttributeList(xAttrList); + mpTokenHandler = rOther.mpTokenHandler; + mpChunk = static_cast<char *>(malloc( rOther.mnChunkLength )); + mnChunkLength = rOther.mnChunkLength; + memcpy(mpChunk, rOther.mpChunk, rOther.mnChunkLength); + maAttributeValues = rOther.maAttributeValues; + maAttributeTokens = rOther.maAttributeTokens; + maUnknownAttributes = rOther.maUnknownAttributes; +} + + FastAttributeList::~FastAttributeList() { free( mpChunk ); @@ -79,6 +92,8 @@ void FastAttributeList::clear() void FastAttributeList::add( sal_Int32 nToken, const char* pValue, size_t nValueLength ) { assert(nToken != -1); + assert(nToken != 0); + assert(nValueLength < SAL_MAX_INT32); // protect against absurd values maAttributeTokens.push_back( nToken ); sal_Int32 nWritePosition = maAttributeValues.back(); maAttributeValues.push_back( maAttributeValues.back() + nValueLength + 1 ); @@ -123,6 +138,20 @@ void FastAttributeList::addUnknown( const OString& rName, const OString& value ) maUnknownAttributes.emplace_back( rName, value ); } +void FastAttributeList::add( const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList ) +{ + const auto& rOther = castToFastAttributeList(xAttrList); + add(rOther); +} + +void FastAttributeList::add( const FastAttributeList& rOther ) +{ + for (size_t i=0; i < rOther.maAttributeTokens.size(); ++i) + add(rOther.maAttributeTokens[i], rOther.getFastAttributeValue(i), rOther.AttributeValueLength(i)); + for (const auto & i : rOther.maUnknownAttributes) + addUnknown(i.maNamespaceURL, i.maName, i.maValue); +} + // XFastAttributeList sal_Bool FastAttributeList::hasAttribute( ::sal_Int32 Token ) { diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index f8cd9c9315c7..c64f51768cf3 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -222,6 +222,9 @@ namespace xmloff::token { TOKEN( "align", XML_ALIGN ), TOKEN( "all", XML_ALL ), TOKEN( "allow-empty-cell", XML_ALLOW_EMPTY_CELL ), + TOKEN( "allow-deletes", XML_ALLOW_DELETES ), + TOKEN( "allow-inserts", XML_ALLOW_INSERTS ), + TOKEN( "allow-updates", XML_ALLOW_UPDATES ), TOKEN( "alphabetical-index", XML_ALPHABETICAL_INDEX ), TOKEN( "alphabetical-index-auto-mark-file", XML_ALPHABETICAL_INDEX_AUTO_MARK_FILE ), TOKEN( "alphabetical-index-entry-template", XML_ALPHABETICAL_INDEX_ENTRY_TEMPLATE ), @@ -370,6 +373,7 @@ namespace xmloff::token { TOKEN( "button3", XML_BUTTON3 ), TOKEN( "button4", XML_BUTTON4 ), TOKEN( "buttons", XML_BUTTONS ), + TOKEN( "button-type", XML_BUTTON_TYPE ), TOKEN( "bvar", XML_BVAR ), TOKEN( "c", XML_C ), TOKEN( "calculation-settings", XML_CALCULATION_SETTINGS ), @@ -493,6 +497,7 @@ namespace xmloff::token { TOKEN( "control", XML_CONTROL ), TOKEN( "conversion-mode", XML_CONVERSION_MODE ), TOKEN( "conversion-type", XML_CONVERSION_TYPE ), + TOKEN( "convert-empty-to-null", XML_CONVERT_EMPTY_TO_NULL ), TOKEN( "copy-back", XML_COPY_BACK ), TOKEN( "copy-formulas", XML_COPY_FORMULAS ), TOKEN( "copy-outline-levels", XML_COPY_OUTLINE_LEVELS ), @@ -617,6 +622,7 @@ namespace xmloff::token { TOKEN( "decorative", XML_DECORATIVE ), TOKEN( "deep", XML_DEEP ), TOKEN( "default", XML_DEFAULT ), + TOKEN( "default-button", XML_DEFAULT_BUTTON ), TOKEN( "default-cell-style-name", XML_DEFAULT_CELL_STYLE_NAME ), TOKEN( "default-style", XML_DEFAULT_STYLE ), TOKEN( "default-style-name", XML_DEFAULT_STYLE_NAME ), @@ -689,6 +695,7 @@ namespace xmloff::token { TOKEN( "dropdown", XML_DROPDOWN ), TOKEN( "drop-cap", XML_DROP_CAP ), TOKEN( "dynamic", XML_DYNAMIC ), + TOKEN( "echo-char", XML_ECHO_CHAR ), TOKEN( "edge-rounding", XML_EDGE_ROUNDING ), TOKEN( "editable", XML_EDITABLE ), TOKEN( "editing-cycles", XML_EDITING_CYCLES ), @@ -707,6 +714,7 @@ namespace xmloff::token { TOKEN( "enable-numbering", XML_ENABLE_NUMBERING ), TOKEN( "enabled", XML_ENABLED ), TOKEN( "encoding", XML_ENCODING ), + TOKEN( "enctype", XML_ENCTYPE ), TOKEN( "end", XML_END ), TOKEN( "end-angle", XML_END_ANGLE ), TOKEN( "end-cell-address", XML_END_CELL_ADDRESS ), @@ -814,6 +822,7 @@ namespace xmloff::token { TOKEN( "floor", XML_FLOOR ), TOKEN( "fn", XML_FN ), TOKEN( "focal-length", XML_FOCAL_LENGTH ), + TOKEN( "focus-on-click", XML_FOCUS_ON_CLICK ), TOKEN( "font-char-width", XML_FONT_CHAR_WIDTH ), TOKEN( "font-charset", XML_FONT_CHARSET ), TOKEN( "font-charset-asian", XML_FONT_CHARSET_ASIAN ), @@ -885,6 +894,7 @@ namespace xmloff::token { TOKEN( "footnote-sep", XML_FOOTNOTE_SEP ), TOKEN( "footnotes-configuration", XML_FOOTNOTES_CONFIGURATION ), TOKEN( "footnotes-position", XML_FOOTNOTES_POSITION ), + TOKEN( "for", XML_FOR ), TOKEN( "forall", XML_FORALL ), TOKEN( "force-manual", XML_FORCE_MANUAL ), TOKEN( "foreground", XML_FOREGROUND ), @@ -1027,6 +1037,7 @@ namespace xmloff::token { TOKEN( "ideograph-alpha", XML_IDEOGRAPH_ALPHA ), TOKEN( "ignore-case", XML_IGNORE_CASE ), TOKEN( "ignore-empty-rows", XML_IGNORE_EMPTY_ROWS ), + TOKEN( "ignore-result", XML_IGNORE_RESULT ), TOKEN( "ignore-selected-page", XML_IGNORE_SELECTED_PAGE ), TOKEN( "illustration-index", XML_ILLUSTRATION_INDEX ), TOKEN( "illustration-index-entry-template", XML_ILLUSTRATION_INDEX_ENTRY_TEMPLATE ), @@ -1061,6 +1072,7 @@ namespace xmloff::token { TOKEN( "information", XML_INFORMATION ), TOKEN( "initial-creator", XML_INITIAL_CREATOR ), TOKEN( "inproceedings", XML_INPROCEEDINGS ), + TOKEN( "input-required", XML_INPUT_REQUIRED ), TOKEN( "insert-columns", XML_INSERT_COLUMNS ), TOKEN( "insert-rows", XML_INSERT_ROWS ), TOKEN( "insertion", XML_INSERTION ), @@ -1084,6 +1096,7 @@ namespace xmloff::token { TOKEN( "is-selection", XML_IS_SELECTION ), TOKEN( "isbn", XML_ISBN ), TOKEN( "italic", XML_ITALIC ), + TOKEN( "item", XML_ITEM ), TOKEN( "iteration", XML_ITERATION ), TOKEN( "journal", XML_JOURNAL ), TOKEN( "justified", XML_JUSTIFIED ), @@ -1308,6 +1321,8 @@ namespace xmloff::token { TOKEN( "mtext", XML_MTEXT ), TOKEN( "mtr", XML_MTR ), TOKEN( "multi-deletion-spanned", XML_MULTI_DELETION_SPANNED ), + TOKEN( "multi-line", XML_MULTI_LINE ), + TOKEN( "multiple", XML_MULTIPLE ), TOKEN( "munder", XML_MUNDER ), TOKEN( "munderover", XML_MUNDEROVER ), TOKEN( "name", XML_NAME ), @@ -1315,6 +1330,7 @@ namespace xmloff::token { TOKEN( "named-expression", XML_NAMED_EXPRESSION ), TOKEN( "named-expressions", XML_NAMED_EXPRESSIONS ), TOKEN( "named-range", XML_NAMED_RANGE ), + TOKEN( "navigation-mode", XML_NAVIGATION_MODE ), TOKEN( "navy", XML_NAVY ), TOKEN( "negative-color", XML_NEGATIVE_COLOR ), TOKEN( "neq", XML_NEQ ), @@ -1422,6 +1438,7 @@ namespace xmloff::token { TOKEN( "page-number", XML_PAGE_NUMBER ), TOKEN( "page-number-visible", XML_PAGE_NUMBER_VISIBLE ), TOKEN( "page-start-margin", XML_PAGE_START_MARGIN ), + TOKEN( "page-step-size", XML_PAGE_STEP_SIZE ), TOKEN( "page-style-name", XML_PAGE_STYLE_NAME ), TOKEN( "page-thumbnail", XML_PAGE_THUMBNAIL ), TOKEN( "page-usage", XML_PAGE_USAGE ), @@ -1775,6 +1792,7 @@ namespace xmloff::token { TOKEN( "start-table", XML_START_TABLE ), TOKEN( "start-value", XML_START_VALUE ), TOKEN( "start-with-navigator", XML_START_WITH_NAVIGATOR ), + TOKEN( "state", XML_STATE ), TOKEN( "statistics", XML_STATISTICS ), TOKEN( "status", XML_STATUS ), TOKEN( "stay-on-top", XML_STAY_ON_TOP ), @@ -1829,6 +1847,8 @@ namespace xmloff::token { TOKEN( "symbol-width", XML_SYMBOL_WIDTH ), TOKEN( "system", XML_SYSTEM ), TOKEN( "tab-color", XML_TAB_COLOR ), + TOKEN( "tab-cycle", XML_TAB_CYCLE ), + TOKEN( "tab-index", XML_TAB_INDEX ), TOKEN( "tab-stop", XML_TAB_STOP ), TOKEN( "tab-stop-distance", XML_TAB_STOP_DISTANCE ), TOKEN( "tab-stops", XML_TAB_STOPS ), @@ -1936,6 +1956,7 @@ namespace xmloff::token { TOKEN( "toc-mark", XML_TOC_MARK ), TOKEN( "toc-mark-end", XML_TOC_MARK_END ), TOKEN( "toc-mark-start", XML_TOC_MARK_START ), + TOKEN( "toggle", XML_TOGGLE ), TOKEN( "top", XML_TOP ), TOKEN( "top-left", XML_TOP_LEFT ), TOKEN( "top percent", XML_TOP_PERCENT ), @@ -2018,6 +2039,7 @@ namespace xmloff::token { TOKEN( "user-index-source", XML_USER_INDEX_SOURCE ), TOKEN( "user-transformed", XML_USER_TRANSFORMED ), TOKEN( "username", XML_USERNAME ), + TOKEN( "validation", XML_VALIDATION ), TOKEN( "value", XML_VALUE ), TOKEN( "value-type", XML_VALUE_TYPE ), TOKEN( "values-cell-range-address", XML_VALUES_CELL_RANGE_ADDRESS ), @@ -2057,6 +2079,7 @@ namespace xmloff::token { TOKEN( "visible-area-top", XML_VISIBLE_AREA_TOP ), TOKEN( "visible-area-width", XML_VISIBLE_AREA_WIDTH ), TOKEN( "visited-style-name", XML_VISITED_STYLE_NAME ), + TOKEN( "visual-effect", XML_VISUAL_EFFECT ), TOKEN( "volatile", XML_VOLATILE ), TOKEN( "volume", XML_VOLUME ), TOKEN( "vpn", XML_VPN ), diff --git a/xmloff/source/forms/controlelement.cxx b/xmloff/source/forms/controlelement.cxx index e7fc96e71e97..af752ae4bdc5 100644 --- a/xmloff/source/forms/controlelement.cxx +++ b/xmloff/source/forms/controlelement.cxx @@ -18,6 +18,9 @@ */ #include "controlelement.hxx" +#include <xmloff/xmltoken.hxx> + +using namespace ::xmloff::token; namespace xmloff { @@ -51,6 +54,34 @@ namespace xmloff } } + sal_Int32 OControlElement::getElementToken(ElementType _eType) + { + switch (_eType) + { + case TEXT: return XML_TEXT; + case TEXT_AREA: return XML_TEXTAREA; + case PASSWORD: return XML_PASSWORD; + case FILE: return XML_FILE; + case FORMATTED_TEXT: return XML_FORMATTED_TEXT; + case FIXED_TEXT: return XML_FIXED_TEXT; + case COMBOBOX: return XML_COMBOBOX; + case LISTBOX: return XML_LISTBOX; + case BUTTON: return XML_BUTTON; + case IMAGE: return XML_IMAGE; + case CHECKBOX: return XML_CHECKBOX; + case RADIO: return XML_RADIO; + case FRAME: return XML_FRAME; + case IMAGE_FRAME: return XML_IMAGE_FRAME; + case HIDDEN: return XML_HIDDEN; + case GRID: return XML_GRID; + case VALUERANGE: return XML_VALUE_RANGE; + case TIME: return XML_TIME; + case DATE: return XML_DATE; + + default: return XML_GENERIC_CONTROL; + } + } + } // namespace xmloff /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/forms/controlelement.hxx b/xmloff/source/forms/controlelement.hxx index 8a28ecaa3155..d384d9f048f7 100644 --- a/xmloff/source/forms/controlelement.hxx +++ b/xmloff/source/forms/controlelement.hxx @@ -73,6 +73,15 @@ namespace xmloff the element type */ static const char* getElementName(ElementType _eType); + + /** retrieves the tag name to be used to describe a control of the given type + + <p>The returned string is the pure token, without any namespace.</p> + + @param _eType + the element type + */ + static sal_Int32 getElementToken(ElementType _eType); }; } // namespace xmloff diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx index 225a68fa13a4..4c6640747ac0 100644 --- a/xmloff/source/forms/elementimport.cxx +++ b/xmloff/source/forms/elementimport.cxx @@ -66,6 +66,7 @@ namespace xmloff using namespace ::com::sun::star::lang; using namespace ::com::sun::star::form; using namespace ::com::sun::star::xml; + using namespace ::com::sun::star::xml::sax; using namespace ::com::sun::star::util; using namespace ::com::sun::star::text; using namespace ::comphelper; @@ -90,6 +91,7 @@ namespace xmloff //= OElementNameMap OElementNameMap::MapString2Element OElementNameMap::s_sElementTranslations; + std::map<sal_Int32, OControlElement::ElementType> OElementNameMap::s_sElementTranslations2; const OControlElement::ElementType& operator ++(OControlElement::ElementType& _e) { @@ -113,10 +115,24 @@ namespace xmloff return UNKNOWN; } + OControlElement::ElementType OElementNameMap::getElementType(sal_Int32 nElement) + { + if ( s_sElementTranslations2.empty() ) + { // initialize + for (ElementType eType=ElementType(0); eType<UNKNOWN; ++eType) + s_sElementTranslations2[getElementToken(eType)] = eType; + } + auto aPos = s_sElementTranslations2.find(nElement & TOKEN_MASK); + if (s_sElementTranslations2.end() != aPos) + return aPos->second; + + return UNKNOWN; + } + //= OElementImport - OElementImport::OElementImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName, + OElementImport::OElementImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, const Reference< XNameContainer >& _rxParentContainer) - :OPropertyImport(_rImport, _nPrefix, _rName) + :OPropertyImport(_rImport) ,m_rFormImport(_rImport) ,m_rEventManager(_rEventManager) ,m_pStyleElement( nullptr ) @@ -135,13 +151,11 @@ namespace xmloff return OUString(); } - void OElementImport::StartElement(const Reference< XAttributeList >& _rxAttrList) + void OElementImport::startFastElement(sal_Int32 nElement, const Reference< css::xml::sax::XFastAttributeList >& _rxAttrList) { ENTER_LOG_CONTEXT( "xmloff::OElementImport - importing one element" ); - const SvXMLNamespaceMap& rMap = m_rContext.getGlobalContext().GetNamespaceMap(); - const OUString sImplNameAttribute = rMap.GetQNameByKey( XML_NAMESPACE_FORM, GetXMLToken( XML_CONTROL_IMPLEMENTATION ) ); - const OUString sControlImplementation = _rxAttrList->getValueByName( sImplNameAttribute ); + const OUString sControlImplementation = _rxAttrList->getValue( XML_ELEMENT(FORM, XML_CONTROL_IMPLEMENTATION) ); // retrieve the service name if ( !sControlImplementation.isEmpty() ) @@ -163,16 +177,17 @@ namespace xmloff m_xInfo = m_xElement->getPropertySetInfo(); // call the base class - OPropertyImport::StartElement( _rxAttrList ); + OPropertyImport::startFastElement( nElement, _rxAttrList ); } - SvXMLImportContextRef OElementImport::CreateChildContext(sal_uInt16 _nPrefix, const OUString& _rLocalName, - const Reference< XAttributeList >& _rxAttrList) + css::uno::Reference< css::xml::sax::XFastContextHandler > OElementImport::createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& _rxAttrList ) { - if( token::IsXMLToken(_rLocalName, token::XML_EVENT_LISTENERS) && (XML_NAMESPACE_OFFICE == _nPrefix)) - return new OFormEventsImportContext(m_rFormImport.getGlobalContext(), _nPrefix, _rLocalName, *this); + if( nElement == XML_ELEMENT(OFFICE, XML_EVENT_LISTENERS) ) + return new OFormEventsImportContext(m_rFormImport.getGlobalContext(), *this); - return OPropertyImport::CreateChildContext(_nPrefix, _rLocalName, _rxAttrList); + return OPropertyImport::createFastChildContext(nElement, _rxAttrList); } void OElementImport::endFastElement(sal_Int32 ) @@ -517,13 +532,64 @@ namespace xmloff return false; } - bool OElementImport::handleAttribute(sal_uInt16 _nNamespaceKey, const OUString& _rLocalName, const OUString& _rValue) + bool OElementImport::tryGenericAttribute( sal_Int32 nElement, const OUString& _rValue ) + { + // the generic approach (which I hope all props will be migrated to, on the medium term): property handlers + const AttributeDescription attribute( metadata::getAttributeDescription( nElement ) ); + if ( attribute.attributeToken != XML_TOKEN_INVALID ) + { + PropertyGroups propertyGroups; + metadata::getPropertyGroupList( attribute, propertyGroups ); + const PropertyGroups::const_iterator pos = impl_matchPropertyGroup( propertyGroups ); + if ( pos == propertyGroups.end() ) + return false; + + do + { + const PropertyDescriptionList& rProperties( *pos ); + const PropertyDescription* first = *rProperties.begin(); + if ( !first ) + { + SAL_WARN( "xmloff.forms", "OElementImport::handleAttribute: invalid property description!" ); + break; + } + + const PPropertyHandler handler = (*first->factory)( first->propertyId ); + if ( !handler ) + { + SAL_WARN( "xmloff.forms", "OElementImport::handleAttribute: invalid property handler!" ); + break; + } + + PropertyValues aValues; + for ( const auto& propDesc : rProperties ) + { + aValues[ propDesc->propertyId ] = Any(); + } + if ( handler->getPropertyValues( _rValue, aValues ) ) + { + for ( const auto& propDesc : rProperties ) + { + implPushBackPropertyValue( propDesc->propertyName, aValues[ propDesc->propertyId ] ); + } + } + } + while ( false ); + + // handled + return true; + } + return false; + } + + bool OElementImport::handleAttribute(sal_Int32 nElement, const OUString& _rValue) { - if ( token::IsXMLToken( _rLocalName, token::XML_CONTROL_IMPLEMENTATION ) ) + auto nLocal = nElement & TOKEN_MASK; + if ( nLocal == XML_CONTROL_IMPLEMENTATION ) // ignore this, it has already been handled in OElementImport::StartElement return true; - if ( token::IsXMLToken( _rLocalName, token::XML_NAME ) ) + if ( nLocal == XML_NAME ) { if ( m_sName.isEmpty() ) // remember the name for later use in EndElement @@ -532,7 +598,7 @@ namespace xmloff } // maybe it's the style attribute? - if ( token::IsXMLToken( _rLocalName, token::XML_TEXT_STYLE_NAME ) ) + if ( nLocal == XML_TEXT_STYLE_NAME ) { const SvXMLStyleContext* pStyleContext = m_rContext.getStyleElement( _rValue ); OSL_ENSURE( pStyleContext, "OElementImport::handleAttribute: do not know the style!" ); @@ -542,11 +608,11 @@ namespace xmloff } if ( m_bImplicitGenericAttributeHandling ) - if ( tryGenericAttribute( _nNamespaceKey, _rLocalName, _rValue ) ) + if ( tryGenericAttribute( nElement, _rValue ) ) return true; // let the base class handle it - return OPropertyImport::handleAttribute(_nNamespaceKey, _rLocalName, _rValue); + return OPropertyImport::handleAttribute( nElement, _rValue); } Reference< XPropertySet > OElementImport::createElement() @@ -572,30 +638,29 @@ namespace xmloff m_rEventManager.registerEvents(m_xElement, _rEvents); } - void OElementImport::simulateDefaultedAttribute(const char* _pAttributeName, const OUString& _rPropertyName, const char* _pAttributeDefault) + void OElementImport::simulateDefaultedAttribute(sal_Int32 nElement, const OUString& _rPropertyName, const char* _pAttributeDefault) { OSL_ENSURE( m_xInfo.is(), "OPropertyImport::simulateDefaultedAttribute: the component should be more gossipy about it's properties!" ); if ( !m_xInfo.is() || m_xInfo->hasPropertyByName( _rPropertyName ) ) { - OUString sLocalAttrName = OUString::createFromAscii(_pAttributeName); - if ( !encounteredAttribute( sLocalAttrName ) ) - OSL_VERIFY( handleAttribute( XML_NAMESPACE_FORM, sLocalAttrName, OUString::createFromAscii( _pAttributeDefault ) ) ); + if ( !encounteredAttribute( nElement ) ) + OSL_VERIFY( handleAttribute( XML_ELEMENT(FORM, (nElement & TOKEN_MASK)), OUString::createFromAscii( _pAttributeDefault ) ) ); } } //= OControlImport - OControlImport::OControlImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName, + OControlImport::OControlImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, const Reference< XNameContainer >& _rxParentContainer) - :OElementImport(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer) + :OElementImport(_rImport, _rEventManager, _rxParentContainer) ,m_eElementType(OControlElement::UNKNOWN) { disableImplicitGenericAttributeHandling(); } - OControlImport::OControlImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName, + OControlImport::OControlImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, const Reference< XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType) - :OElementImport(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer) + :OElementImport(_rImport, _rEventManager, _rxParentContainer) ,m_eElementType(_eType) { disableImplicitGenericAttributeHandling(); @@ -632,23 +697,23 @@ namespace xmloff return OUString(); } - void OControlImport::addOuterAttributes(const Reference< XAttributeList >& _rxOuterAttribs) + void OControlImport::addOuterAttributes(const Reference< XFastAttributeList >& _rxOuterAttribs) { OSL_ENSURE(!m_xOuterAttributes.is(), "OControlImport::addOuterAttributes: already have these attributes!"); m_xOuterAttributes = _rxOuterAttribs; } - bool OControlImport::handleAttribute(sal_uInt16 _nNamespaceKey, const OUString& _rLocalName, const OUString& _rValue) + bool OControlImport::handleAttribute(sal_Int32 nElement, const OUString& _rValue) { - static const char* pLinkedCellAttributeName = OAttributeMetaData::getBindingAttributeName(BAFlags::LinkedCell); + static sal_Int32 nLinkedCellAttributeName = OAttributeMetaData::getBindingAttributeToken(BAFlags::LinkedCell); - if (IsXMLToken(_rLocalName, XML_ID)) + if ((nElement & TOKEN_MASK) == XML_ID) { // it's the control id - if (XML_NAMESPACE_XML == _nNamespaceKey) + if (IsTokenInNamespace(nElement, XML_NAMESPACE_XML)) { m_sControlId = _rValue; } - else if (XML_NAMESPACE_FORM == _nNamespaceKey) + else if (IsTokenInNamespace(nElement, XML_NAMESPACE_FORM)) { if (m_sControlId.isEmpty()) { @@ -658,66 +723,61 @@ namespace xmloff return true; } - if ( _rLocalName.equalsAscii( pLinkedCellAttributeName ) ) + if ( (nElement & TOKEN_MASK) == nLinkedCellAttributeName ) { // it's the address of a spreadsheet cell m_sBoundCellAddress = _rValue; return true; } - if ( _nNamespaceKey == XML_NAMESPACE_XFORMS && IsXMLToken( _rLocalName, XML_BIND ) ) + if ( nElement == XML_ELEMENT(XFORMS, XML_BIND ) ) { m_sBindingID = _rValue; return true; } - if ( _nNamespaceKey == XML_NAMESPACE_FORM && IsXMLToken( _rLocalName, XML_XFORMS_LIST_SOURCE ) ) + if ( nElement == XML_ELEMENT(FORM, XML_XFORMS_LIST_SOURCE) ) { m_sListBindingID = _rValue; return true; } - if ( ( ( _nNamespaceKey == XML_NAMESPACE_FORM ) - && IsXMLToken( _rLocalName, XML_XFORMS_SUBMISSION ) - ) - || ( ( _nNamespaceKey == XML_NAMESPACE_XFORMS ) - && IsXMLToken( _rLocalName, XML_SUBMISSION ) - ) - ) + if ( nElement == XML_ELEMENT(FORM, XML_XFORMS_SUBMISSION) + || nElement == XML_ELEMENT(XFORMS, XML_SUBMISSION) ) { m_sSubmissionID = _rValue; return true; } - if ( OElementImport::tryGenericAttribute( _nNamespaceKey, _rLocalName, _rValue ) ) + if ( OElementImport::tryGenericAttribute( nElement, _rValue ) ) return true; - static const char* pValueAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Value); - static const char* pCurrentValueAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCAFlags::CurrentValue); - static const char* pMinValueAttributeName = OAttributeMetaData::getSpecialAttributeName(SCAFlags::MinValue); - static const char* pMaxValueAttributeName = OAttributeMetaData::getSpecialAttributeName(SCAFlags::MaxValue); - static const char* pRepeatDelayAttributeName = OAttributeMetaData::getSpecialAttributeName( SCAFlags::RepeatDelay ); + static const sal_Int32 nValueAttributeName = OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::Value); + static const sal_Int32 nCurrentValueAttributeName = OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::CurrentValue); + static const sal_Int32 nMinValueAttributeName = OAttributeMetaData::getSpecialAttributeToken(SCAFlags::MinValue); + static const sal_Int32 nMaxValueAttributeName = OAttributeMetaData::getSpecialAttributeToken(SCAFlags::MaxValue); + static const sal_Int32 nRepeatDelayAttributeName = OAttributeMetaData::getSpecialAttributeToken( SCAFlags::RepeatDelay ); sal_Int32 nHandle = -1; - if ( _rLocalName.equalsAscii( pValueAttributeName ) ) + if ( (nElement & TOKEN_MASK) == nValueAttributeName ) nHandle = PROPID_VALUE; - else if ( _rLocalName.equalsAscii( pCurrentValueAttributeName ) ) + else if ( (nElement & TOKEN_MASK) == nCurrentValueAttributeName ) nHandle = PROPID_CURRENT_VALUE; - else if ( _rLocalName.equalsAscii( pMinValueAttributeName ) ) + else if ( (nElement & TOKEN_MASK) == nMinValueAttributeName ) nHandle = PROPID_MIN_VALUE; - else if ( _rLocalName.equalsAscii( pMaxValueAttributeName ) ) + else if ( (nElement & TOKEN_MASK) == nMaxValueAttributeName ) nHandle = PROPID_MAX_VALUE; if ( nHandle != -1 ) { // for the moment, simply remember the name and the value PropertyValue aProp; - aProp.Name = _rLocalName; + aProp.Name = SvXMLImport::getNameFromToken(nElement); aProp.Handle = nHandle; aProp.Value <<= _rValue; m_aValueProperties.push_back(aProp); return true; } - if ( _rLocalName.equalsAscii( pRepeatDelayAttributeName ) ) + if ( (nElement & TOKEN_MASK) == nRepeatDelayAttributeName ) { util::Duration aDuration; if (::sax::Converter::convertDuration(aDuration, _rValue)) @@ -734,29 +794,27 @@ namespace xmloff return true; } - return OElementImport::handleAttribute( _nNamespaceKey, _rLocalName, _rValue ); + return OElementImport::handleAttribute( nElement, _rValue ); } - void OControlImport::StartElement(const Reference< XAttributeList >& _rxAttrList) + void OControlImport::startFastElement(sal_Int32 nElement, const Reference< css::xml::sax::XFastAttributeList >& _rxAttrList) { - css::uno::Reference< css::xml::sax::XAttributeList > xAttributes; + css::uno::Reference< css::xml::sax::XFastAttributeList > xMergedAttributes; if( m_xOuterAttributes.is() ) { - // merge the attribute lists - OAttribListMerger* pMerger = new OAttribListMerger; - // our own one - pMerger->addList(_rxAttrList); + // merge the attribute lists, our own one + rtl::Reference<sax_fastparser::FastAttributeList> xMerger(new sax_fastparser::FastAttributeList(_rxAttrList)); // and the ones of our enclosing element - pMerger->addList(m_xOuterAttributes); - xAttributes = pMerger; + xMerger->add(m_xOuterAttributes); + xMergedAttributes = xMerger.get(); } else { - xAttributes = _rxAttrList; + xMergedAttributes = _rxAttrList; } // let the base class handle all the attributes - OElementImport::StartElement(xAttributes); + OElementImport::startFastElement(nElement, xMergedAttributes); if ( m_aValueProperties.empty() || !m_xElement.is()) return; @@ -1050,26 +1108,26 @@ namespace xmloff //= OImagePositionImport OImagePositionImport::OImagePositionImport( OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, - sal_uInt16 _nPrefix, const OUString& _rName, const Reference< XNameContainer >& _rxParentContainer, + const Reference< XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType ) - :OControlImport( _rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer, _eType ) + :OControlImport( _rImport, _rEventManager, _rxParentContainer, _eType ) ,m_nImagePosition( -1 ) ,m_nImageAlign( 0 ) ,m_bHaveImagePosition( false ) { } - bool OImagePositionImport::handleAttribute( sal_uInt16 _nNamespaceKey, const OUString& _rLocalName, + bool OImagePositionImport::handleAttribute( sal_Int32 nElement, const OUString& _rValue ) { - static const char* s_pImageDataAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCAFlags::ImageData); + static const sal_Int32 s_nImageDataAttributeName = OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::ImageData); - if (_rLocalName.equalsAscii(s_pImageDataAttributeName)) + if ( (nElement & TOKEN_MASK) == s_nImageDataAttributeName) { m_xGraphic = m_rContext.getGlobalContext().loadGraphicByURL(_rValue); return true; } - else if ( _rLocalName == GetXMLToken( XML_IMAGE_POSITION ) ) + else if ( (nElement & TOKEN_MASK) == XML_IMAGE_POSITION ) { OSL_VERIFY( PropertyConversion::convertString( cppu::UnoType<decltype(m_nImagePosition)>::get(), @@ -1078,7 +1136,7 @@ namespace xmloff m_bHaveImagePosition = true; return true; } - else if ( _rLocalName == GetXMLToken( XML_IMAGE_ALIGN ) ) + else if ( (nElement & TOKEN_MASK) == XML_IMAGE_ALIGN ) { OSL_VERIFY( PropertyConversion::convertString( cppu::UnoType<decltype(m_nImageAlign)>::get(), @@ -1087,12 +1145,12 @@ namespace xmloff return true; } - return OControlImport::handleAttribute( _nNamespaceKey, _rLocalName, _rValue ); + return OControlImport::handleAttribute( nElement, _rValue ); } - void OImagePositionImport::StartElement(const Reference< XAttributeList >& _rxAttrList) + void OImagePositionImport::startFastElement(sal_Int32 nElement, const Reference< XFastAttributeList >& _rxAttrList) { - OControlImport::StartElement( _rxAttrList ); + OControlImport::startFastElement( nElement, _rxAttrList ); if (m_xGraphic.is()) { @@ -1120,44 +1178,44 @@ namespace xmloff //= OReferredControlImport OReferredControlImport::OReferredControlImport( - OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName, + OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, const Reference< XNameContainer >& _rxParentContainer ) - :OControlImport(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer) + :OControlImport(_rImport, _rEventManager, _rxParentContainer) { } - void OReferredControlImport::StartElement(const Reference< XAttributeList >& _rxAttrList) + void OReferredControlImport::startFastElement(sal_Int32 nElement, const Reference< XFastAttributeList >& _rxAttrList) { - OControlImport::StartElement(_rxAttrList); + OControlImport::startFastElement(nElement, _rxAttrList); // the base class should have created the control, so we can register it if ( !m_sReferringControls.isEmpty() ) m_rFormImport.registerControlReferences(m_xElement, m_sReferringControls); } - bool OReferredControlImport::handleAttribute(sal_uInt16 _nNamespaceKey, const OUString& _rLocalName, + bool OReferredControlImport::handleAttribute(sal_Int32 nElement, const OUString& _rValue) { - static const char * s_sReferenceAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCAFlags::For); - if (_rLocalName.equalsAscii(s_sReferenceAttributeName)) + static const sal_Int32 s_nReferenceAttributeName = OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::For); + if ((nElement & TOKEN_MASK) == s_nReferenceAttributeName) { m_sReferringControls = _rValue; return true; } - return OControlImport::handleAttribute(_nNamespaceKey, _rLocalName, _rValue); + return OControlImport::handleAttribute(nElement, _rValue); } //= OPasswordImport - OPasswordImport::OPasswordImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName, + OPasswordImport::OPasswordImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, const Reference< XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType) - :OControlImport(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer, _eType) + :OControlImport(_rImport, _rEventManager, _rxParentContainer, _eType) { } - bool OPasswordImport::handleAttribute(sal_uInt16 _nNamespaceKey, const OUString& _rLocalName, const OUString& _rValue) + bool OPasswordImport::handleAttribute(sal_Int32 nElement, const OUString& _rValue) { - static const char * s_sEchoCharAttributeName = OAttributeMetaData::getSpecialAttributeName(SCAFlags::EchoChar); - if (_rLocalName.equalsAscii(s_sEchoCharAttributeName)) + static const sal_Int32 s_nEchoCharAttributeName = OAttributeMetaData::getSpecialAttributeToken(SCAFlags::EchoChar); + if ((nElement & TOKEN_MASK) == s_nEchoCharAttributeName) { // need a special handling for the EchoChar property PropertyValue aEchoChar; @@ -1171,28 +1229,28 @@ namespace xmloff implPushBackPropertyValue(aEchoChar); return true; } - return OControlImport::handleAttribute(_nNamespaceKey, _rLocalName, _rValue); + return OControlImport::handleAttribute(nElement, _rValue); } //= ORadioImport - ORadioImport::ORadioImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName, + ORadioImport::ORadioImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, const Reference< XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType) - :OImagePositionImport( _rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer, _eType ) + :OImagePositionImport( _rImport, _rEventManager, _rxParentContainer, _eType ) { } - bool ORadioImport::handleAttribute(sal_uInt16 _nNamespaceKey, const OUString& _rLocalName, const OUString& _rValue) + bool ORadioImport::handleAttribute(sal_Int32 nElement, const OUString& _rValue) { // need special handling for the State & CurrentState properties: // they're stored as booleans, but expected to be int16 properties - static const char* pCurrentSelectedAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCAFlags::CurrentSelected); - static const char* pSelectedAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Selected); - if ( _rLocalName.equalsAscii( pCurrentSelectedAttributeName ) - || _rLocalName.equalsAscii( pSelectedAttributeName ) + static const sal_Int32 nCurrentSelectedAttributeName = OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::CurrentSelected); + static const sal_Int32 nSelectedAttributeName = OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::Selected); + if ( (nElement & TOKEN_MASK) == nCurrentSelectedAttributeName + || (nElement & TOKEN_MASK) == nSelectedAttributeName ) { - const OAttribute2Property::AttributeAssignment* pProperty = m_rContext.getAttributeMap().getAttributeTranslation(_rLocalName); - OSL_ENSURE(pProperty, "ORadioImport::handleAttribute: invalid property map!"); + const OAttribute2Property::AttributeAssignment* pProperty = m_rContext.getAttributeMap().getAttributeTranslation(nElement & TOKEN_MASK); + assert(pProperty && "ORadioImport::handleAttribute: invalid property map!"); if (pProperty) { const Any aBooleanValue( PropertyConversion::convertString(pProperty->aPropertyType, _rValue, pProperty->pEnumMap) ); @@ -1206,28 +1264,28 @@ namespace xmloff } return true; } - return OImagePositionImport::handleAttribute( _nNamespaceKey, _rLocalName, _rValue ); + return OImagePositionImport::handleAttribute( nElement, _rValue ); } //= OURLReferenceImport - OURLReferenceImport::OURLReferenceImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName, + OURLReferenceImport::OURLReferenceImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, const Reference< XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType) - :OImagePositionImport(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer, _eType) + :OImagePositionImport(_rImport, _rEventManager, _rxParentContainer, _eType) { } - bool OURLReferenceImport::handleAttribute(sal_uInt16 _nNamespaceKey, const OUString& _rLocalName, const OUString& _rValue) + bool OURLReferenceImport::handleAttribute(sal_Int32 nElement, const OUString& _rValue) { - static const char* s_pTargetLocationAttributeName = OAttributeMetaData::getCommonControlAttributeName( CCAFlags::TargetLocation ); - static const char* s_pImageDataAttributeName = OAttributeMetaData::getCommonControlAttributeName( CCAFlags::ImageData ); + static const sal_Int32 s_nTargetLocationAttributeName = OAttributeMetaData::getCommonControlAttributeToken( CCAFlags::TargetLocation ); + static const sal_Int32 s_nImageDataAttributeName = OAttributeMetaData::getCommonControlAttributeToken( CCAFlags::ImageData ); // need to make the URL absolute if // * it's the image-data attribute // * it's the target-location attribute, and we're dealing with an object which has the respective property bool bMakeAbsolute = - _rLocalName.equalsAscii( s_pImageDataAttributeName ) - || ( _rLocalName.equalsAscii( s_pTargetLocationAttributeName ) + (nElement & TOKEN_MASK) == s_nImageDataAttributeName + || ( (nElement & TOKEN_MASK) == s_nTargetLocationAttributeName && ( ( OControlElement::BUTTON == m_eElementType ) || ( OControlElement::IMAGE == m_eElementType ) ) @@ -1236,53 +1294,53 @@ namespace xmloff if (bMakeAbsolute && !_rValue.isEmpty()) { OUString sAdjustedValue = _rValue; - if (!_rLocalName.equalsAscii(s_pImageDataAttributeName)) + if ((nElement & TOKEN_MASK) != s_nImageDataAttributeName) sAdjustedValue = m_rContext.getGlobalContext().GetAbsoluteReference( _rValue ); - return OImagePositionImport::handleAttribute( _nNamespaceKey, _rLocalName, sAdjustedValue ); + return OImagePositionImport::handleAttribute( nElement, sAdjustedValue ); } - return OImagePositionImport::handleAttribute( _nNamespaceKey, _rLocalName, _rValue ); + return OImagePositionImport::handleAttribute( nElement, _rValue ); } //= OButtonImport - OButtonImport::OButtonImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName, + OButtonImport::OButtonImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, const Reference< XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType) - :OURLReferenceImport(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer, _eType) + :OURLReferenceImport(_rImport, _rEventManager, _rxParentContainer, _eType) { enableTrackAttributes(); } - void OButtonImport::StartElement(const Reference< XAttributeList >& _rxAttrList) + void OButtonImport::startFastElement(sal_Int32 nElement, const Reference< XFastAttributeList >& _rxAttrList) { - OURLReferenceImport::StartElement(_rxAttrList); + OURLReferenceImport::startFastElement(nElement, _rxAttrList); // handle the target-frame attribute - simulateDefaultedAttribute(OAttributeMetaData::getCommonControlAttributeName(CCAFlags::TargetFrame), PROPERTY_TARGETFRAME, "_blank"); + simulateDefaultedAttribute(OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::TargetFrame), PROPERTY_TARGETFRAME, "_blank"); } //= OValueRangeImport - OValueRangeImport::OValueRangeImport( OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName, + OValueRangeImport::OValueRangeImport( OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, const Reference< XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType ) - :OControlImport( _rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer, _eType ) + :OControlImport( _rImport, _rEventManager, _rxParentContainer, _eType ) ,m_nStepSizeValue( 1 ) { } - bool OValueRangeImport::handleAttribute( sal_uInt16 _nNamespaceKey, const OUString& _rLocalName, const OUString& _rValue ) + bool OValueRangeImport::handleAttribute( sal_Int32 nElement, const OUString& _rValue ) { - if ( _rLocalName.equalsAscii( OAttributeMetaData::getSpecialAttributeName( SCAFlags::StepSize ) ) ) + if ( (nElement & TOKEN_MASK) == OAttributeMetaData::getSpecialAttributeToken( SCAFlags::StepSize ) ) { ::sax::Converter::convertNumber( m_nStepSizeValue, _rValue ); return true; } - return OControlImport::handleAttribute( _nNamespaceKey, _rLocalName, _rValue ); + return OControlImport::handleAttribute( nElement, _rValue ); } - void OValueRangeImport::StartElement( const Reference< XAttributeList >& _rxAttrList ) + void OValueRangeImport::startFastElement( sal_Int32 nElement, const Reference< XFastAttributeList >& _rxAttrList ) { - OControlImport::StartElement( _rxAttrList ); + OControlImport::startFastElement( nElement, _rxAttrList ); if ( m_xInfo.is() ) { @@ -1294,10 +1352,10 @@ namespace xmloff } //= OTextLikeImport - OTextLikeImport::OTextLikeImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName, + OTextLikeImport::OTextLikeImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, const Reference< XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType) - :OControlImport(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer, _eType) + :OControlImport(_rImport, _rEventManager, _rxParentContainer, _eType) ,m_bEncounteredTextPara( false ) { enableTrackAttributes(); @@ -1340,19 +1398,19 @@ namespace xmloff } } - return OControlImport::CreateChildContext( _nPrefix, _rLocalName, _rxAttrList ); + return nullptr; } - void OTextLikeImport::StartElement(const Reference< XAttributeList >& _rxAttrList) + void OTextLikeImport::startFastElement(sal_Int32 nElement, const Reference< css::xml::sax::XFastAttributeList >& _rxAttrList) { - OControlImport::StartElement(_rxAttrList); + OControlImport::startFastElement(nElement, _rxAttrList); // handle the convert-empty-to-null attribute, whose default is different from the property default // unfortunately, different classes are imported by this class ('cause they're represented by the // same XML element), though not all of them know this property. // So we have to do a check ... if (m_xElement.is() && m_xInfo.is() && m_xInfo->hasPropertyByName(PROPERTY_EMPTY_IS_NULL) ) - simulateDefaultedAttribute(OAttributeMetaData::getDatabaseAttributeName(DAFlags::ConvertEmpty), PROPERTY_EMPTY_IS_NULL, "false"); + simulateDefaultedAttribute(OAttributeMetaData::getDatabaseAttributeToken(DAFlags::ConvertEmpty), PROPERTY_EMPTY_IS_NULL, "false"); } namespace { @@ -1473,10 +1531,10 @@ namespace xmloff } //= OListAndComboImport - OListAndComboImport::OListAndComboImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName, + OListAndComboImport::OListAndComboImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, const Reference< XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType) - :OControlImport(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer, _eType) + :OControlImport(_rImport, _rEventManager, _rxParentContainer, _eType) ,m_nEmptyListItems( 0 ) ,m_nEmptyValueItems( 0 ) ,m_bEncounteredLSAttrib( false ) @@ -1486,36 +1544,37 @@ namespace xmloff enableTrackAttributes(); } - SvXMLImportContextRef OListAndComboImport::CreateChildContext(sal_uInt16 _nPrefix, const OUString& _rLocalName, - const Reference< XAttributeList >& _rxAttrList) + css::uno::Reference< css::xml::sax::XFastContextHandler > OListAndComboImport::createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& _rxAttrList ) { // is it the "option" sub tag of a listbox ? - if (_rLocalName == "option") - return new OListOptionImport(GetImport(), _nPrefix, _rLocalName, this); + if ((nElement & TOKEN_MASK) == XML_OPTION) + return new OListOptionImport(GetImport(), this); // is it the "item" sub tag of a combobox ? - if (_rLocalName == "item") - return new OComboItemImport(GetImport(), _nPrefix, _rLocalName, this); + if ((nElement & TOKEN_MASK) == XML_ITEM) + return new OComboItemImport(GetImport(), this); // everything else - return OControlImport::CreateChildContext(_nPrefix, _rLocalName, _rxAttrList); + return OControlImport::createFastChildContext(nElement, _rxAttrList); } - void OListAndComboImport::StartElement(const Reference< XAttributeList >& _rxAttrList) + void OListAndComboImport::startFastElement(sal_Int32 nElement, const Reference< XFastAttributeList >& _rxAttrList) { m_bLinkWithIndexes = false; - OControlImport::StartElement(_rxAttrList); + OControlImport::startFastElement(nElement, _rxAttrList); if (OControlElement::COMBOBOX == m_eElementType) { // for the auto-completion // the attribute default does not equal the property default, so in case we did not read this attribute, // we have to simulate it - simulateDefaultedAttribute( OAttributeMetaData::getSpecialAttributeName( SCAFlags::AutoCompletion ), PROPERTY_AUTOCOMPLETE, "false"); + simulateDefaultedAttribute( OAttributeMetaData::getSpecialAttributeToken( SCAFlags::AutoCompletion ), PROPERTY_AUTOCOMPLETE, "false"); // same for the convert-empty-to-null attribute, which's default is different from the property default - simulateDefaultedAttribute( OAttributeMetaData::getDatabaseAttributeName( DAFlags::ConvertEmpty ), PROPERTY_EMPTY_IS_NULL, "false"); + simulateDefaultedAttribute( OAttributeMetaData::getDatabaseAttributeToken( DAFlags::ConvertEmpty ), PROPERTY_EMPTY_IS_NULL, "false"); } } @@ -1577,10 +1636,10 @@ namespace xmloff OControlImport::doRegisterCellValueBinding( sBoundCellAddress ); } - bool OListAndComboImport::handleAttribute(sal_uInt16 _nNamespaceKey, const OUString& _rLocalName, const OUString& _rValue) + bool OListAndComboImport::handleAttribute(sal_Int32 nElement, const OUString& _rValue) { - static const char* pListSourceAttributeName = OAttributeMetaData::getDatabaseAttributeName(DAFlags::ListSource); - if ( _rLocalName.equalsAscii(pListSourceAttributeName) ) + static const sal_Int32 nListSourceAttributeName = OAttributeMetaData::getDatabaseAttributeToken(DAFlags::ListSource); + if ( (nElement & TOKEN_MASK) == nListSourceAttributeName ) { PropertyValue aListSource; aListSource.Name = PROPERTY_LISTSOURCE; @@ -1604,13 +1663,13 @@ namespace xmloff return true; } - if ( _rLocalName.equalsAscii( OAttributeMetaData::getBindingAttributeName( BAFlags::ListCellRange ) ) ) + if ( (nElement & TOKEN_MASK) == OAttributeMetaData::getBindingAttributeToken( BAFlags::ListCellRange ) ) { m_sCellListSource = _rValue; return true; } - if ( _rLocalName.equalsAscii( OAttributeMetaData::getBindingAttributeName( BAFlags::ListLinkingType ) ) ) + if ( (nElement & TOKEN_MASK) == OAttributeMetaData::getBindingAttributeToken( BAFlags::ListLinkingType ) ) { sal_Int16 nLinkageType = 0; PropertyConversion::convertString( @@ -1623,7 +1682,7 @@ namespace xmloff return true; } - return OControlImport::handleAttribute(_nNamespaceKey, _rLocalName, _rValue); + return OControlImport::handleAttribute(nElement, _rValue); } void OListAndComboImport::implPushBackLabel(const OUString& _rLabel) @@ -1677,29 +1736,22 @@ namespace xmloff } //= OListOptionImport - OListOptionImport::OListOptionImport(SvXMLImport& _rImport, sal_uInt16 _nPrefix, const OUString& _rName, + OListOptionImport::OListOptionImport(SvXMLImport& _rImport, const OListAndComboImportRef& _rListBox) - :SvXMLImportContext(_rImport, _nPrefix, _rName) + :SvXMLImportContext(_rImport) ,m_xListBoxImport(_rListBox) { } - void OListOptionImport::StartElement(const Reference< XAttributeList >& _rxAttrList) + void OListOptionImport::startFastElement(sal_Int32 nElement, const Reference< XFastAttributeList >& _rxAttrList) { // the label and the value - const SvXMLNamespaceMap& rMap = GetImport().GetNamespaceMap(); - const OUString sLabelAttribute = rMap.GetQNameByKey( - GetPrefix(), "label"); - const OUString sValueAttribute = rMap.GetQNameByKey( - GetPrefix(), "value"); + const sal_Int32 nLabelAttribute = (nElement & ~TOKEN_MASK) | XML_LABEL; + const sal_Int32 nValueAttribute = (nElement & ~TOKEN_MASK) | XML_VALUE; // the label attribute - OUString sValue = _rxAttrList->getValueByName(sLabelAttribute); - bool bNonexistentAttribute = false; - if (sValue.isEmpty()) - if (_rxAttrList->getTypeByName(sLabelAttribute).isEmpty()) - // this attribute does not really exist - bNonexistentAttribute = true; + OUString sValue = _rxAttrList->getOptionalValue(nLabelAttribute); + bool bNonexistentAttribute = !_rxAttrList->hasAttribute(nLabelAttribute); if (bNonexistentAttribute) m_xListBoxImport->implEmptyLabelFound(); @@ -1707,12 +1759,8 @@ namespace xmloff m_xListBoxImport->implPushBackLabel( sValue ); // the value attribute - sValue = _rxAttrList->getValueByName(sValueAttribute); - bNonexistentAttribute = false; - if (sValue.isEmpty()) - if (_rxAttrList->getTypeByName(sValueAttribute).isEmpty()) - // this attribute does not really exist - bNonexistentAttribute = true; + sValue = _rxAttrList->getOptionalValue(nValueAttribute); + bNonexistentAttribute = !_rxAttrList->hasAttribute(nValueAttribute); if (bNonexistentAttribute) m_xListBoxImport->implEmptyValueFound(); @@ -1720,54 +1768,54 @@ namespace xmloff m_xListBoxImport->implPushBackValue( sValue ); // the current-selected and selected - const OUString sSelectedAttribute = rMap.GetQNameByKey( - GetPrefix(), OUString::createFromAscii(OAttributeMetaData::getCommonControlAttributeName(CCAFlags::CurrentSelected))); - const OUString sDefaultSelectedAttribute = rMap.GetQNameByKey( - GetPrefix(), OUString::createFromAscii(OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Selected))); + const sal_Int32 nSelectedAttribute = (nElement & ~TOKEN_MASK) | OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::CurrentSelected); + const sal_Int32 nDefaultSelectedAttribute = (nElement & ~TOKEN_MASK) | OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::Selected); // propagate the selected flag bool bSelected(false); (void)::sax::Converter::convertBool(bSelected, - _rxAttrList->getValueByName(sSelectedAttribute)); + _rxAttrList->getOptionalValue(nSelectedAttribute)); if (bSelected) m_xListBoxImport->implSelectCurrentItem(); // same for the default selected bool bDefaultSelected(false); (void)::sax::Converter::convertBool(bDefaultSelected, - _rxAttrList->getValueByName(sDefaultSelectedAttribute)); + _rxAttrList->getOptionalValue(nDefaultSelectedAttribute)); if (bDefaultSelected) m_xListBoxImport->implDefaultSelectCurrentItem(); } //= OComboItemImport - OComboItemImport::OComboItemImport(SvXMLImport& _rImport, sal_uInt16 _nPrefix, const OUString& _rName, + OComboItemImport::OComboItemImport(SvXMLImport& _rImport, const OListAndComboImportRef& _rListBox) - :SvXMLImportContext(_rImport, _nPrefix, _rName) + :SvXMLImportContext(_rImport) ,m_xListBoxImport(_rListBox) { } - void OComboItemImport::StartElement(const Reference< XAttributeList >& _rxAttrList) + void OComboItemImport::startFastElement(sal_Int32 nElement, const Reference< XFastAttributeList >& _rxAttrList) { - const OUString sLabelAttributeName = GetImport().GetNamespaceMap().GetQNameByKey( - GetPrefix(), OUString::createFromAscii(OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Label))); - m_xListBoxImport->implPushBackLabel(_rxAttrList->getValueByName(sLabelAttributeName)); + const sal_Int32 nLabelAttributeName = (nElement & ~TOKEN_MASK) | + OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::Label); + m_xListBoxImport->implPushBackLabel(_rxAttrList->getOptionalValue(nLabelAttributeName)); } //= OColumnWrapperImport - OColumnWrapperImport::OColumnWrapperImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName, + OColumnWrapperImport::OColumnWrapperImport(OFormLayerXMLImport_Impl& _rImport, + IEventAttacherManager& _rEventManager, sal_Int32 /*nElement*/, const Reference< XNameContainer >& _rxParentContainer) - :SvXMLImportContext(_rImport.getGlobalContext(), _nPrefix, _rName) + :SvXMLImportContext(_rImport.getGlobalContext()) ,m_xParentContainer(_rxParentContainer) ,m_rFormImport(_rImport) ,m_rEventManager(_rEventManager) { } - SvXMLImportContextRef OColumnWrapperImport::CreateChildContext(sal_uInt16 _nPrefix, const OUString& _rLocalName, - const Reference< XAttributeList >&) + css::uno::Reference< css::xml::sax::XFastContextHandler > OColumnWrapperImport::createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) { - OControlImport* pReturn = implCreateChildContext(_nPrefix, _rLocalName, OElementNameMap::getElementType(_rLocalName)); + OControlImport* pReturn = implCreateChildContext(nElement, OElementNameMap::getElementType(nElement & TOKEN_MASK)); if (pReturn) { OSL_ENSURE(m_xOwnAttributes.is(), "OColumnWrapperImport::CreateChildContext: had no form:column element!"); @@ -1775,7 +1823,7 @@ namespace xmloff } return pReturn; } - void OColumnWrapperImport::StartElement(const Reference< XAttributeList >& _rxAttrList) + void OColumnWrapperImport::startFastElement(sal_Int32 /*nElement*/, const Reference< XFastAttributeList >& _rxAttrList) { OSL_ENSURE(!m_xOwnAttributes.is(), "OColumnWrapperImport::StartElement: already have the cloned list!"); @@ -1788,7 +1836,7 @@ namespace xmloff } OControlImport* OColumnWrapperImport::implCreateChildContext( - sal_uInt16 _nPrefix, const OUString& _rLocalName, + sal_Int32 /*nElement*/, OControlElement::ElementType _eType) { OSL_ENSURE( (OControlElement::TEXT == _eType) @@ -1805,39 +1853,39 @@ namespace xmloff { case OControlElement::COMBOBOX: case OControlElement::LISTBOX: - return new OColumnImport<OListAndComboImport>(m_rFormImport, m_rEventManager, _nPrefix, _rLocalName, m_xParentContainer, _eType ); + return new OColumnImport<OListAndComboImport>(m_rFormImport, m_rEventManager, m_xParentContainer, _eType ); case OControlElement::PASSWORD: - return new OColumnImport<OPasswordImport>(m_rFormImport, m_rEventManager, _nPrefix, _rLocalName, m_xParentContainer, _eType ); + return new OColumnImport<OPasswordImport>(m_rFormImport, m_rEventManager, m_xParentContainer, _eType ); case OControlElement::TEXT: case OControlElement::TEXT_AREA: case OControlElement::FORMATTED_TEXT: - return new OColumnImport< OTextLikeImport >( m_rFormImport, m_rEventManager, _nPrefix, _rLocalName, m_xParentContainer, _eType ); + return new OColumnImport< OTextLikeImport >( m_rFormImport, m_rEventManager, m_xParentContainer, _eType ); default: - return new OColumnImport<OControlImport>(m_rFormImport, m_rEventManager, _nPrefix, _rLocalName, m_xParentContainer, _eType ); + return new OColumnImport<OControlImport>(m_rFormImport, m_rEventManager, m_xParentContainer, _eType ); } } //= OGridImport - OGridImport::OGridImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName, + OGridImport::OGridImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, const Reference< XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType) - :OControlImport(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer) + :OControlImport(_rImport, _rEventManager, _rxParentContainer) { setElementType(_eType); } - SvXMLImportContextRef OGridImport::CreateChildContext( - sal_uInt16 _nPrefix, const OUString& _rLocalName, - const css::uno::Reference< css::xml::sax::XAttributeList >& _rxAttrList) + css::uno::Reference< css::xml::sax::XFastContextHandler > OGridImport::createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) { // maybe it's a sub control - if (_rLocalName == "column") + if ((nElement & TOKEN_MASK) == XML_COLUMN) { if (m_xMeAsContainer.is()) - return new OColumnWrapperImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer); + return new OColumnWrapperImport(m_rFormImport, *this, nElement, m_xMeAsContainer); else { OSL_FAIL("OGridImport::CreateChildContext: don't have an element!"); @@ -1845,7 +1893,7 @@ namespace xmloff } } - return OControlImport::CreateChildContext(_nPrefix, _rLocalName, _rxAttrList); + return OControlImport::createFastChildContext(nElement, xAttrList); } void OGridImport::endFastElement(sal_Int32 nElement) @@ -1877,38 +1925,67 @@ namespace xmloff } //= OFormImport - OFormImport::OFormImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName, + OFormImport::OFormImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, const Reference< XNameContainer >& _rxParentContainer) - :OElementImport(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer) + :OElementImport(_rImport, _rEventManager, _rxParentContainer) { enableTrackAttributes(); } - SvXMLImportContextRef OFormImport::CreateChildContext(sal_uInt16 _nPrefix, const OUString& _rLocalName, - const Reference< XAttributeList >& _rxAttrList) + css::uno::Reference< css::xml::sax::XFastContextHandler > OFormImport::createFastChildContext( + sal_Int32 nElement, + const uno::Reference< xml::sax::XFastAttributeList>& _rxAttrList ) { - if( token::IsXMLToken(_rLocalName, token::XML_FORM) ) - return new OFormImport( m_rFormImport, *this, _nPrefix, _rLocalName, - m_xMeAsContainer); - else if ( token::IsXMLToken(_rLocalName, token::XML_CONNECTION_RESOURCE) ) - return new OXMLDataSourceImport(GetImport(), _nPrefix, _rLocalName, _rxAttrList,m_xElement); - else if( (token::IsXMLToken(_rLocalName, token::XML_EVENT_LISTENERS) && - (XML_NAMESPACE_OFFICE == _nPrefix)) || - token::IsXMLToken( _rLocalName, token::XML_PROPERTIES) ) - return OElementImport::CreateChildContext( _nPrefix, _rLocalName, - _rxAttrList ); + auto nToken = (nElement & TOKEN_MASK); + if( nToken == XML_FORM ) + return new OFormImport( m_rFormImport, *this, m_xMeAsContainer); + else if ( nToken == XML_CONNECTION_RESOURCE ) + return new OXMLDataSourceImport(GetImport(), _rxAttrList, m_xElement); + else if( nElement == XML_ELEMENT(OFFICE, XML_EVENT_LISTENERS) || + nToken == XML_PROPERTIES ) + return OElementImport::createFastChildContext( nElement, _rxAttrList ); else - return implCreateChildContext( _nPrefix, _rLocalName, - OElementNameMap::getElementType(_rLocalName) ); + { + OControlElement::ElementType eType = OElementNameMap::getElementType(nToken); + switch (eType) + { + case OControlElement::TEXT: + case OControlElement::TEXT_AREA: + case OControlElement::FORMATTED_TEXT: + return new OTextLikeImport(m_rFormImport, *this, m_xMeAsContainer, eType); + case OControlElement::GRID: + return new OGridImport(m_rFormImport, *this, m_xMeAsContainer, eType); + case OControlElement::COMBOBOX: + case OControlElement::LISTBOX: + return new OListAndComboImport(m_rFormImport, *this, m_xMeAsContainer, eType); + case OControlElement::PASSWORD: + return new OPasswordImport(m_rFormImport, *this, m_xMeAsContainer, eType); + case OControlElement::BUTTON: + case OControlElement::IMAGE: + case OControlElement::IMAGE_FRAME: + return new OButtonImport( m_rFormImport, *this, m_xMeAsContainer, eType ); + case OControlElement::RADIO: + return new ORadioImport(m_rFormImport, *this, m_xMeAsContainer, eType); + case OControlElement::CHECKBOX: + return new OImagePositionImport(m_rFormImport, *this, m_xMeAsContainer, eType); + case OControlElement::FRAME: + case OControlElement::FIXED_TEXT: + return new OReferredControlImport(m_rFormImport, *this, m_xMeAsContainer); + case OControlElement::VALUERANGE: + return new OValueRangeImport( m_rFormImport, *this, m_xMeAsContainer, eType ); + default: + return new OControlImport(m_rFormImport, *this, m_xMeAsContainer, eType); + } + } } - void OFormImport::StartElement(const Reference< XAttributeList >& _rxAttrList) + void OFormImport::startFastElement(sal_Int32 nElement, const Reference< XFastAttributeList >& _rxAttrList) { m_rFormImport.enterEventContext(); - OElementImport::StartElement(_rxAttrList); + OElementImport::startFastElement(nElement, _rxAttrList); // handle the target-frame attribute - simulateDefaultedAttribute(OAttributeMetaData::getCommonControlAttributeName(CCAFlags::TargetFrame), PROPERTY_TARGETFRAME, "_blank"); + simulateDefaultedAttribute(OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::TargetFrame), PROPERTY_TARGETFRAME, "_blank"); } void OFormImport::endFastElement(sal_Int32 nElement) @@ -1941,25 +2018,25 @@ namespace xmloff return xReturn; } - bool OFormImport::handleAttribute(sal_uInt16 _nNamespaceKey, const OUString& _rLocalName, const OUString& _rValue) + bool OFormImport::handleAttribute(sal_Int32 nElement, const OUString& _rValue) { // handle the master/details field attributes (they're way too special to let the OPropertyImport handle them) - static const char* s_sMasterFieldsAttributeName = OAttributeMetaData::getFormAttributeName(faMasterFields); - static const char* s_sDetailFieldsAttributeName = OAttributeMetaData::getFormAttributeName(faDetailFields); + static const sal_Int32 s_nMasterFieldsAttributeName = OAttributeMetaData::getFormAttributeToken(faMasterFields); + static const sal_Int32 s_nDetailFieldsAttributeName = OAttributeMetaData::getFormAttributeToken(faDetailFields); - if ( _rLocalName.equalsAscii(s_sMasterFieldsAttributeName) ) + if ( (nElement & TOKEN_MASK) == s_nMasterFieldsAttributeName) { implTranslateStringListProperty(PROPERTY_MASTERFIELDS, _rValue); return true; } - if ( _rLocalName.equalsAscii(s_sDetailFieldsAttributeName) ) + if ( (nElement & TOKEN_MASK) == s_nDetailFieldsAttributeName) { implTranslateStringListProperty(PROPERTY_DETAILFIELDS, _rValue); return true; } - return OElementImport::handleAttribute(_nNamespaceKey, _rLocalName, _rValue); + return OElementImport::handleAttribute(nElement, _rValue); } void OFormImport::implTranslateStringListProperty(const OUString& _rPropertyName, const OUString& _rValue) @@ -2025,27 +2102,16 @@ namespace xmloff //= OXMLDataSourceImport OXMLDataSourceImport::OXMLDataSourceImport( SvXMLImport& _rImport - ,sal_uInt16 nPrfx - , const OUString& _sLocalName - ,const Reference< css::xml::sax::XAttributeList > & _xAttrList + ,const Reference< css::xml::sax::XFastAttributeList > & _xAttrList ,const css::uno::Reference< css::beans::XPropertySet >& _xElement) : - SvXMLImportContext( _rImport, nPrfx, _sLocalName ) + SvXMLImportContext( _rImport) { - OSL_ENSURE(_xAttrList.is(),"Attribute list is NULL!"); - const SvXMLNamespaceMap& rMap = _rImport.GetNamespaceMap(); - - sal_Int16 nLength = (_xElement.is() && _xAttrList.is()) ? _xAttrList->getLength() : 0; - for(sal_Int16 i = 0; i < nLength; ++i) + for( auto& aIter : sax_fastparser::castToFastAttributeList(_xAttrList) ) { - OUString sLocalName; - OUString sAttrName = _xAttrList->getNameByIndex( i ); - sal_uInt16 nPrefix = rMap.GetKeyByAttrName( sAttrName, &sLocalName ); - - if ( ( nPrefix == OAttributeMetaData::getCommonControlAttributeNamespace( CCAFlags::TargetLocation ) ) - && ( sLocalName.equalsAscii( OAttributeMetaData::getCommonControlAttributeName( CCAFlags::TargetLocation ) ) ) - ) + if ( aIter.getToken() == + XML_ELEMENT(XLINK, OAttributeMetaData::getCommonControlAttributeToken( CCAFlags::TargetLocation ) ) ) { - OUString sValue = _xAttrList->getValueByIndex( i ); + OUString sValue = aIter.toString(); sValue = _rImport.GetAbsoluteReference(sValue); INetURLObject aURL(sValue); if ( aURL.GetProtocol() == INetProtocol::File ) @@ -2054,49 +2120,8 @@ namespace xmloff _xElement->setPropertyValue(PROPERTY_URL,makeAny(sValue)); // the url is the "sdbc:" string break; } - } - } - OControlImport* OFormImport::implCreateChildContext( - sal_uInt16 _nPrefix, const OUString& _rLocalName, - OControlElement::ElementType _eType ) - { - switch (_eType) - { - case OControlElement::TEXT: - case OControlElement::TEXT_AREA: - case OControlElement::FORMATTED_TEXT: - return new OTextLikeImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType); - - case OControlElement::BUTTON: - case OControlElement::IMAGE: - case OControlElement::IMAGE_FRAME: - return new OButtonImport( m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType ); - - case OControlElement::COMBOBOX: - case OControlElement::LISTBOX: - return new OListAndComboImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType); - - case OControlElement::RADIO: - return new ORadioImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType); - - case OControlElement::CHECKBOX: - return new OImagePositionImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType); - - case OControlElement::PASSWORD: - return new OPasswordImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType); - - case OControlElement::FRAME: - case OControlElement::FIXED_TEXT: - return new OReferredControlImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer); - - case OControlElement::GRID: - return new OGridImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType); - - case OControlElement::VALUERANGE: - return new OValueRangeImport( m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType ); - - default: - return new OControlImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType); + else + SAL_WARN("xmloff", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << aIter.toString()); } } diff --git a/xmloff/source/forms/elementimport.hxx b/xmloff/source/forms/elementimport.hxx index 62bf61152597..50fcd185c7da 100644 --- a/xmloff/source/forms/elementimport.hxx +++ b/xmloff/source/forms/elementimport.hxx @@ -53,11 +53,13 @@ namespace xmloff { typedef std::map<OUString, ElementType> MapString2Element; static MapString2Element s_sElementTranslations; + static std::map<sal_Int32, ElementType> s_sElementTranslations2; OElementNameMap() = delete; public: static ElementType getElementType(const OUString& _rName); + static ElementType getElementType(sal_Int32 nToken); }; //= OElementImport @@ -95,10 +97,6 @@ namespace xmloff the importer @param _rEventManager the event attacher manager for the control being imported - @param _nPrefix - the namespace prefix - @param _rName - the element name @param _rAttributeMap the attribute map to be used for translating attributes into properties @param _rxParentContainer @@ -106,24 +104,20 @@ namespace xmloff */ OElementImport( OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, - sal_uInt16 _nPrefix, const OUString& _rName, const css::uno::Reference< css::container::XNameContainer >& _rxParentContainer ); virtual ~OElementImport() override; protected: // SvXMLImportContext overridables - virtual void StartElement( - const css::uno::Reference< css::xml::sax::XAttributeList >& _rxAttrList) override; - virtual SvXMLImportContextRef CreateChildContext( - sal_uInt16 _nPrefix, const OUString& _rLocalName, - const css::uno::Reference< css::xml::sax::XAttributeList >& _rxAttrList) override; + virtual void SAL_CALL startFastElement( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; // OPropertyImport overridables - virtual bool handleAttribute(sal_uInt16 _nNamespaceKey, - const OUString& _rLocalName, - const OUString& _rValue) override; + virtual bool handleAttribute(sal_Int32 nElement, const OUString& _rValue) override; // IEventAttacher virtual void registerEvents( @@ -145,13 +139,18 @@ namespace xmloff property value as if the attribute was encountered.</p> @see encounteredAttribute */ - void simulateDefaultedAttribute(const char* _pAttributeName, const OUString& _rPropertyName, const char* _pAttributeDefault); + void simulateDefaultedAttribute(sal_Int32 nElement, const OUString& _rPropertyName, const char* _pAttributeDefault); /** to be called from within handleAttribute, checks whether the given attribute is covered by our generic attribute handler mechanisms */ bool tryGenericAttribute( sal_uInt16 _nNamespaceKey, const OUString& _rLocalName, const OUString& _rValue ); + /** to be called from within handleAttribute, checks whether the given attribute is covered by our generic + attribute handler mechanisms + */ + bool tryGenericAttribute( sal_Int32 nElement, const OUString& _rValue ); + /** controls whether |handleAttribute| implicitly calls |tryGenericAttribute|, or whether the derived class must do this explicitly at a suitable place in its own |handleAttribute| */ @@ -184,7 +183,7 @@ namespace xmloff // we fake the attributes our base class gets: we add the attributes of the outer wrapper // element which encloses us - css::uno::Reference< css::xml::sax::XAttributeList > + css::uno::Reference< css::xml::sax::XFastAttributeList > m_xOuterAttributes; /** the address of the calc cell which the control model should be bound to, @@ -205,29 +204,24 @@ namespace xmloff // for use by derived classes only OControlImport( OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, - sal_uInt16 _nPrefix, const OUString& _rName, const css::uno::Reference< css::container::XNameContainer >& _rxParentContainer ); public: OControlImport( OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, - sal_uInt16 _nPrefix, const OUString& _rName, const css::uno::Reference< css::container::XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType ); // SvXMLImportContext overridables - virtual void StartElement( - const css::uno::Reference< css::xml::sax::XAttributeList >& _rxAttrList) override; + virtual void SAL_CALL startFastElement( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; // OPropertyImport overridables - virtual bool handleAttribute(sal_uInt16 _nNamespaceKey, - const OUString& _rLocalName, - const OUString& _rValue) override; + virtual bool handleAttribute(sal_Int32 nElement, const OUString& _rValue) override; - void addOuterAttributes(const css::uno::Reference< css::xml::sax::XAttributeList >& _rxOuterAttribs); + void addOuterAttributes(const css::uno::Reference< css::xml::sax::XFastAttributeList >& _rxOuterAttribs); protected: void setElementType(OControlElement::ElementType _eType) { m_eElementType = _eType; } @@ -282,21 +276,19 @@ namespace xmloff public: OImagePositionImport( - OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName, + OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, const css::uno::Reference< css::container::XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType ); protected: // SvXMLImportContext overridables - virtual void StartElement( - const css::uno::Reference< css::xml::sax::XAttributeList >& _rxAttrList) override; + virtual void SAL_CALL startFastElement( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& _rxAttrList) override; // OPropertyImport overridables - virtual bool handleAttribute( sal_uInt16 _nNamespaceKey, - const OUString& _rLocalName, - const OUString& _rValue - ) override; + virtual bool handleAttribute(sal_Int32 nElement, const OUString& _rValue) override; }; //= OReferredControlImport @@ -306,18 +298,17 @@ namespace xmloff public: OReferredControlImport( - OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName, + OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, const css::uno::Reference< css::container::XNameContainer >& _rxParentContainer ); // SvXMLImportContext overridables - virtual void StartElement( - const css::uno::Reference< css::xml::sax::XAttributeList >& _rxAttrList) override; + virtual void SAL_CALL startFastElement( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& _rxAttrList) override; // OPropertyImport overridables - virtual bool handleAttribute(sal_uInt16 _nNamespaceKey, - const OUString& _rLocalName, - const OUString& _rValue) override; + virtual bool handleAttribute(sal_Int32 nElement, const OUString& _rValue) override; }; //= OPasswordImport @@ -325,15 +316,13 @@ namespace xmloff { public: OPasswordImport( - OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName, + OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, const css::uno::Reference< css::container::XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType ); // OPropertyImport overridables - virtual bool handleAttribute(sal_uInt16 _nNamespaceKey, - const OUString& _rLocalName, - const OUString& _rValue) override; + virtual bool handleAttribute(sal_Int32 nElement, const OUString& _rValue) override; }; //= ORadioImport @@ -341,16 +330,14 @@ namespace xmloff { public: ORadioImport( - OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName, + OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, const css::uno::Reference< css::container::XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType ); protected: // OPropertyImport overridables - virtual bool handleAttribute(sal_uInt16 _nNamespaceKey, - const OUString& _rLocalName, - const OUString& _rValue) override; + virtual bool handleAttribute(sal_Int32 nElement, const OUString& _rValue) override; }; //= OURLReferenceImport @@ -361,16 +348,14 @@ namespace xmloff { public: OURLReferenceImport( - OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName, + OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, const css::uno::Reference< css::container::XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType ); protected: // OPropertyImport overridables - virtual bool handleAttribute(sal_uInt16 _nNamespaceKey, - const OUString& _rLocalName, - const OUString& _rValue) override; + virtual bool handleAttribute(sal_Int32 nElement, const OUString& _rValue) override; }; //= OButtonImport @@ -381,15 +366,16 @@ namespace xmloff { public: OButtonImport( - OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName, + OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, const css::uno::Reference< css::container::XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType ); protected: // SvXMLImportContext overridables - virtual void StartElement( - const css::uno::Reference< css::xml::sax::XAttributeList >& _rxAttrList) override; + virtual void SAL_CALL startFastElement( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& _rxAttrList) override; }; //= OValueRangeImport @@ -403,20 +389,19 @@ namespace xmloff public: OValueRangeImport( - OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName, + OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, const css::uno::Reference< css::container::XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType ); protected: // SvXMLImportContext overridables - virtual void StartElement( - const css::uno::Reference< css::xml::sax::XAttributeList >& _rxAttrList ) override; + virtual void SAL_CALL startFastElement( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& _rxAttrList ) override; // OPropertyImport overridables - virtual bool handleAttribute( sal_uInt16 _nNamespaceKey, - const OUString& _rLocalName, - const OUString& _rValue ) override; + virtual bool handleAttribute(sal_Int32 nElement, const OUString& _rValue) override; }; //= OTextLikeImport @@ -432,14 +417,15 @@ namespace xmloff public: OTextLikeImport( - OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName, + OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, const css::uno::Reference< css::container::XNameContainer >& _rxParentContainer, OControlElement::ElementType _eType ); // SvXMLImportContext overridables - virtual void StartElement( - const css::uno::Reference< css::xml::sax::XAttributeList >& _rxAttrList) override; + virtual void SAL_CALL startFastElement( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& _rxAttrList) override; virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 _nPrefix, const OUString& _rLocalName, ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits