From 3de38e95561ab7ca114d9f3307702ba89c4e3e9a Mon Sep 17 00:00:00 2001
From: Noel Grandin
Date: Tue, 10 Nov 2020 19:20:06 +0200
Subject: use fastparser in forms
Change-Id: I7d09d64857e24267b4b4baddb563e28ceea92f2e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105560
Tested-by: Jenkins
Reviewed-by: Noel Grandin
---
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(-)
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& );
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(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& 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
+
+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
+
+ The returned string is the pure token, without any namespace.
+
+ @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 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); eTypesecond;
+
+ 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 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::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::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(m_rFormImport, m_rEventManager, _nPrefix, _rLocalName, m_xParentContainer, _eType );
+ return new OColumnImport(m_rFormImport, m_rEventManager, m_xParentContainer, _eType );
case OControlElement::PASSWORD:
- return new OColumnImport(m_rFormImport, m_rEventManager, _nPrefix, _rLocalName, m_xParentContainer, _eType );
+ return new OColumnImport(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(m_rFormImport, m_rEventManager, _nPrefix, _rLocalName, m_xParentContainer, _eType );
+ return new OColumnImport(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 MapString2Element;
static MapString2Element s_sElementTranslations;
+ static std::map 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.
@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,
const css::uno::Reference< css::xml::sax::XAttributeList >& _rxAttrList) override;
@@ -482,23 +468,21 @@ namespace xmloff
public:
OListAndComboImport(
- 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 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 >& ) 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;
// OControlImport overridables
virtual void doRegisterCellValueBinding( const OUString& _rBoundCellAddress ) override;
@@ -524,11 +508,11 @@ namespace xmloff
OListAndComboImportRef m_xListBoxImport;
public:
- OListOptionImport(SvXMLImport& _rImport, sal_uInt16 _nPrefix, const OUString& _rName,
+ OListOptionImport(SvXMLImport& _rImport,
const OListAndComboImportRef& _rListBox);
- 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 >& ) override;
};
//= OComboItemImport
@@ -540,13 +524,13 @@ namespace xmloff
OListAndComboImportRef m_xListBoxImport;
public:
- OComboItemImport(SvXMLImport& _rImport, sal_uInt16 _nPrefix, const OUString& _rName,
+ OComboItemImport(SvXMLImport& _rImport,
const OListAndComboImportRef& _rListBox);
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 >& ) override;
};
@@ -563,7 +547,10 @@ namespace xmloff
m_xColumnFactory;
public:
- OColumnImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName,
+ OColumnImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_Int32 nElement,
+ const css::uno::Reference< css::container::XNameContainer >& _rxParentContainer,
+ OControlElement::ElementType _eType);
+ OColumnImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager,
const css::uno::Reference< css::container::XNameContainer >& _rxParentContainer,
OControlElement::ElementType _eType);
@@ -576,7 +563,7 @@ namespace xmloff
//= OColumnWrapperImport
class OColumnWrapperImport : public SvXMLImportContext
{
- css::uno::Reference< css::xml::sax::XAttributeList >
+ css::uno::Reference< css::xml::sax::XFastAttributeList >
m_xOwnAttributes;
css::uno::Reference< css::container::XNameContainer >
m_xParentContainer;
@@ -584,18 +571,20 @@ namespace xmloff
IEventAttacherManager& m_rEventManager;
public:
- OColumnWrapperImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName,
+ OColumnWrapperImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager,
+ sal_Int32 nElement,
const css::uno::Reference< css::container::XNameContainer >& _rxParentContainer);
// SvXMLImportContext overridables
- virtual SvXMLImportContextRef CreateChildContext(
- sal_uInt16 _nPrefix, const OUString& _rLocalName,
- const css::uno::Reference< css::xml::sax::XAttributeList >& _rxAttrList) override;
- virtual void StartElement(
- const css::uno::Reference< css::xml::sax::XAttributeList >& _rxAttrList) 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;
+ virtual void SAL_CALL startFastElement(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& _rxAttrList) override;
private:
OControlImport* implCreateChildContext(
- sal_uInt16 _nPrefix, const OUString& _rLocalName,
+ sal_Int32 nElement,
OControlElement::ElementType _eType);
};
@@ -605,14 +594,14 @@ namespace xmloff
{
public:
OGridImport(
- 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 SvXMLImportContextRef CreateChildContext(
- sal_uInt16 _nPrefix, const OUString& _rLocalName,
- const css::uno::Reference< css::xml::sax::XAttributeList >& _rxAttrList) 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;
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
private:
@@ -628,23 +617,22 @@ namespace xmloff
{
public:
OFormImport(
- OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName,
+ OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager,
const css::uno::Reference< css::container::XNameContainer >& _rxParentContainer
);
private:
// SvXMLImportContext overridables
- virtual SvXMLImportContextRef CreateChildContext(
- sal_uInt16 _nPrefix, const OUString& _rLocalName,
- const css::uno::Reference< css::xml::sax::XAttributeList >& _rxAttrList) override;
- 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;
+ 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;
// OElementImport overridables
virtual css::uno::Reference< css::beans::XPropertySet >
@@ -665,18 +653,28 @@ namespace xmloff
{
public:
OXMLDataSourceImport( SvXMLImport& _rImport
- ,sal_uInt16 nPrfx
- ,const OUString& rLName
- ,const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList
+ ,const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList
,const css::uno::Reference< css::beans::XPropertySet >& _xElement);
};
//= OColumnImport
template
- OColumnImport< BASE >::OColumnImport(OFormLayerXMLImport_Impl& _rImport, IEventAttacherManager& _rEventManager, sal_uInt16 _nPrefix, const OUString& _rName,
+ OColumnImport< BASE >::OColumnImport(OFormLayerXMLImport_Impl& _rImport,
+ IEventAttacherManager& _rEventManager,
+ sal_Int32 _nElement,
+ const css::uno::Reference< css::container::XNameContainer >& _rxParentContainer,
+ OControlElement::ElementType _eType)
+ :BASE(_rImport, _rEventManager, _nElement, _rxParentContainer, _eType)
+ ,m_xColumnFactory(_rxParentContainer, css::uno::UNO_QUERY)
+ {
+ OSL_ENSURE(m_xColumnFactory.is(), "OColumnImport::OColumnImport: invalid parent container (no factory)!");
+ }
+ template
+ OColumnImport< BASE >::OColumnImport(OFormLayerXMLImport_Impl& _rImport,
+ IEventAttacherManager& _rEventManager,
const css::uno::Reference< css::container::XNameContainer >& _rxParentContainer,
OControlElement::ElementType _eType)
- :BASE(_rImport, _rEventManager, _nPrefix, _rName, _rxParentContainer, _eType)
+ :BASE(_rImport, _rEventManager, _rxParentContainer, _eType)
,m_xColumnFactory(_rxParentContainer, css::uno::UNO_QUERY)
{
OSL_ENSURE(m_xColumnFactory.is(), "OColumnImport::OColumnImport: invalid parent container (no factory)!");
diff --git a/xmloff/source/forms/eventimport.cxx b/xmloff/source/forms/eventimport.cxx
index 0744bb8270fc..150a9f27a5cc 100644
--- a/xmloff/source/forms/eventimport.cxx
+++ b/xmloff/source/forms/eventimport.cxx
@@ -32,8 +32,8 @@ namespace xmloff
using namespace ::com::sun::star::container;
//= OFormEventsImportContext
- OFormEventsImportContext::OFormEventsImportContext(SvXMLImport& _rImport, sal_uInt16 _nPrefix, const OUString& _rLocalName, IEventAttacher& _rEventAttacher)
- :XMLEventsImportContext(_rImport, _nPrefix, _rLocalName)
+ OFormEventsImportContext::OFormEventsImportContext(SvXMLImport& _rImport, IEventAttacher& _rEventAttacher)
+ :XMLEventsImportContext(_rImport)
,m_rEventAttacher(_rEventAttacher)
{
}
diff --git a/xmloff/source/forms/eventimport.hxx b/xmloff/source/forms/eventimport.hxx
index 49e5216dceba..2028a1ce8182 100644
--- a/xmloff/source/forms/eventimport.hxx
+++ b/xmloff/source/forms/eventimport.hxx
@@ -38,7 +38,7 @@ namespace xmloff
IEventAttacher& m_rEventAttacher;
public:
- OFormEventsImportContext(SvXMLImport& _rImport, sal_uInt16 _nPrefix, const OUString& _rLocalName,
+ OFormEventsImportContext(SvXMLImport& _rImport,
IEventAttacher& _rEventAttacher);
protected:
diff --git a/xmloff/source/forms/formattributes.cxx b/xmloff/source/forms/formattributes.cxx
index e3da354d9996..c8cccb55b3cb 100644
--- a/xmloff/source/forms/formattributes.cxx
+++ b/xmloff/source/forms/formattributes.cxx
@@ -21,8 +21,10 @@
#include
#include
+#include
#include
+using namespace xmloff::token;
namespace xmloff
{
@@ -67,6 +69,41 @@ namespace xmloff
return "";
}
+ sal_Int32 OAttributeMetaData::getCommonControlAttributeToken(CCAFlags _nId)
+ {
+ switch (_nId)
+ {
+ case CCAFlags::Name: return XML_NAME;
+ case CCAFlags::ServiceName: return XML_CONTROL_IMPLEMENTATION;
+ case CCAFlags::ButtonType: return XML_BUTTON_TYPE;
+// disabled(AddAttributeIdLegacy) case CCAFlags::ControlId: return "id";
+ case CCAFlags::CurrentSelected: return XML_CURRENT_SELECTED;
+ case CCAFlags::CurrentValue: return XML_CURRENT_VALUE;
+ case CCAFlags::Disabled: return XML_DISABLED;
+ case CCAFlags::EnableVisible: return XML_VISIBLE;
+ case CCAFlags::Dropdown: return XML_DROPDOWN;
+ case CCAFlags::For: return XML_FOR;
+ case CCAFlags::ImageData: return XML_IMAGE_DATA;
+ case CCAFlags::Label: return XML_LABEL;
+ case CCAFlags::MaxLength: return XML_MAX_LENGTH;
+ case CCAFlags::Printable: return XML_PRINTABLE;
+ case CCAFlags::ReadOnly: return XML_READONLY;
+ case CCAFlags::Selected: return XML_SELECTED;
+ case CCAFlags::Size: return XML_SIZE;
+ case CCAFlags::TabIndex: return XML_TAB_INDEX;
+ case CCAFlags::TargetFrame: return XML_TARGET_FRAME;
+ case CCAFlags::TargetLocation: return XML_HREF; // the only special thing here: TargetLocation is represented by an xlink:href attribute
+ case CCAFlags::TabStop: return XML_TAB_STOP;
+ case CCAFlags::Title: return XML_TITLE;
+ case CCAFlags::Value: return XML_VALUE;
+ case CCAFlags::Orientation: return XML_ORIENTATION;
+ case CCAFlags::VisualEffect: return XML_VISUAL_EFFECT;
+ default:
+ assert(false && "OAttributeMetaData::getCommonControlAttributeName: invalid id (maybe you or-ed two flags?)!");
+ }
+ return XML_UNKNOWN;
+ }
+
sal_uInt16 OAttributeMetaData::getCommonControlAttributeNamespace(CCAFlags _nId)
{
if (CCAFlags::TargetLocation == _nId)
@@ -107,6 +144,35 @@ namespace xmloff
return "";
}
+ sal_Int32 OAttributeMetaData::getFormAttributeToken(FormAttributes _eAttrib)
+ {
+ switch (_eAttrib)
+ {
+ case faName: return XML_NAME;
+ case faAction: return XML_HREF; // the only special thing here: Action is represented by an xlink:href attribute
+ case faEnctype: return XML_ENCTYPE;
+ case faMethod: return XML_METHOD;
+ case faAllowDeletes: return XML_ALLOW_DELETES;
+ case faAllowInserts: return XML_ALLOW_INSERTS;
+ case faAllowUpdates: return XML_ALLOW_UPDATES;
+ case faApplyFilter: return XML_APPLY_FILTER;
+ case faCommand: return XML_COMMAND;
+ case faCommandType: return XML_COMMAND_TYPE;
+ case faEscapeProcessing: return XML_ESCAPE_PROCESSING;
+ case faDatasource: return XML_DATASOURCE;
+ case faDetailFields: return XML_DETAIL_FIELDS;
+ case faFilter: return XML_FILTER;
+ case faIgnoreResult: return XML_IGNORE_RESULT;
+ case faMasterFields: return XML_MASTER_FIELDS;
+ case faNavigationMode: return XML_NAVIGATION_MODE;
+ case faOrder: return XML_ORDER;
+ case faTabbingCycle: return XML_TAB_CYCLE;
+ default:
+ assert(false && "OAttributeMetaData::getFormAttributeName: invalid id!");
+ }
+ return XML_NONE;
+ }
+
sal_uInt16 OAttributeMetaData::getFormAttributeNamespace(FormAttributes _eAttrib)
{
if (faAction == _eAttrib)
@@ -131,6 +197,22 @@ namespace xmloff
return "";
}
+ sal_Int32 OAttributeMetaData::getDatabaseAttributeToken(DAFlags _nId)
+ {
+ switch (_nId)
+ {
+ case DAFlags::BoundColumn: return XML_BOUND_COLUMN;
+ case DAFlags::ConvertEmpty: return XML_CONVERT_EMPTY_TO_NULL;
+ case DAFlags::DataField: return XML_DATA_FIELD;
+ case DAFlags::ListSource: return XML_LIST_SOURCE;
+ case DAFlags::ListSource_TYPE: return XML_LIST_SOURCE_TYPE;
+ case DAFlags::InputRequired: return XML_INPUT_REQUIRED;
+ default:
+ assert(false && "OAttributeMetaData::getDatabaseAttributeName: invalid id (maybe you or-ed two flags?)!");
+ }
+ return XML_NONE;
+ }
+
const char* OAttributeMetaData::getBindingAttributeName(BAFlags _nId)
{
switch (_nId)
@@ -144,6 +226,19 @@ namespace xmloff
return "";
}
+ sal_Int32 OAttributeMetaData::getBindingAttributeToken(BAFlags _nId)
+ {
+ switch (_nId)
+ {
+ case BAFlags::LinkedCell: return XML_LINKED_CELL;
+ case BAFlags::ListLinkingType: return XML_LIST_LINKAGE_TYPE;
+ case BAFlags::ListCellRange: return XML_SOURCE_CELL_RANGE;
+ default:
+ assert(false && "OAttributeMetaData::getBindingAttributeName: invalid id (maybe you or-ed two flags?)!");
+ }
+ return XML_UNKNOWN;
+ }
+
const char* OAttributeMetaData::getSpecialAttributeName(SCAFlags _nId)
{
switch (_nId)
@@ -172,6 +267,34 @@ namespace xmloff
return "";
}
+ sal_Int32 OAttributeMetaData::getSpecialAttributeToken(SCAFlags _nId)
+ {
+ switch (_nId)
+ {
+ case SCAFlags::EchoChar: return XML_ECHO_CHAR;
+ case SCAFlags::MaxValue: return XML_MAX_VALUE;
+ case SCAFlags::MinValue: return XML_MIN_VALUE;
+ case SCAFlags::Validation: return XML_VALIDATION;
+ case SCAFlags::GroupName: return XML_GROUP_NAME;
+ case SCAFlags::MultiLine: return XML_MULTI_LINE;
+ case SCAFlags::AutoCompletion: return XML_AUTO_COMPLETE;
+ case SCAFlags::Multiple: return XML_MULTIPLE;
+ case SCAFlags::DefaultButton: return XML_DEFAULT_BUTTON;
+ case SCAFlags::CurrentState: return XML_CURRENT_STATE;
+ case SCAFlags::IsTristate: return XML_IS_TRISTATE;
+ case SCAFlags::State: return XML_STATE;
+ case SCAFlags::ColumnStyleName: return XML_TEXT_STYLE_NAME;
+ case SCAFlags::StepSize: return XML_STEP_SIZE;
+ case SCAFlags::PageStepSize: return XML_PAGE_STEP_SIZE;
+ case SCAFlags::RepeatDelay: return XML_DELAY_FOR_REPEAT;
+ case SCAFlags::Toggle: return XML_TOGGLE;
+ case SCAFlags::FocusOnClick: return XML_FOCUS_ON_CLICK;
+ default:
+ assert(false && "OAttributeMetaData::getSpecialAttributeName: invalid id (maybe you or-ed two flags?)!");
+ }
+ return XML_UNKNOWN;
+ }
+
sal_uInt16 OAttributeMetaData::getSpecialAttributeNamespace(SCAFlags _nId)
{
switch( _nId )
@@ -194,6 +317,18 @@ namespace xmloff
return "";
}
+ xmloff::token::XMLTokenEnum OAttributeMetaData::getOfficeFormsAttributeToken(OfficeFormsAttributes _eAttrib)
+ {
+ switch (_eAttrib)
+ {
+ case ofaAutomaticFocus: return token::XML_AUTOMATIC_FOCUS;
+ case ofaApplyDesignMode: return token::XML_APPLY_DESIGN_MODE;
+ default:
+ assert(false && "OAttributeMetaData::getOfficeFormsAttributeName: invalid id!");
+ }
+ return token::XML_NONE;
+ }
+
//= OAttribute2Property
OAttribute2Property::OAttribute2Property()
{
@@ -204,66 +339,65 @@ namespace xmloff
}
const OAttribute2Property::AttributeAssignment* OAttribute2Property::getAttributeTranslation(
- const OUString& _rAttribName)
+ sal_Int32 nAttributeToken)
{
- AttributeAssignments::const_iterator aPos = m_aKnownProperties.find(_rAttribName);
+ auto aPos = m_aKnownProperties.find(nAttributeToken & TOKEN_MASK);
if (m_aKnownProperties.end() != aPos)
return &aPos->second;
return nullptr;
}
void OAttribute2Property::addStringProperty(
- const char* _pAttributeName, const OUString& _rPropertyName)
+ sal_Int32 nAttributeToken, const OUString& _rPropertyName)
{
- implAdd(_pAttributeName, _rPropertyName, ::cppu::UnoType::get());
+ implAdd(nAttributeToken, _rPropertyName, ::cppu::UnoType::get());
}
void OAttribute2Property::addBooleanProperty(
- const char* _pAttributeName, const OUString& _rPropertyName,
+ sal_Int32 nAttributeToken, const OUString& _rPropertyName,
const bool /*_bAttributeDefault*/, const bool _bInverseSemantics)
{
- AttributeAssignment& aAssignment = implAdd(_pAttributeName, _rPropertyName, cppu::UnoType::get());
+ AttributeAssignment& aAssignment = implAdd(nAttributeToken, _rPropertyName, cppu::UnoType::get());
aAssignment.bInverseSemantics = _bInverseSemantics;
}
void OAttribute2Property::addInt16Property(
- const char* _pAttributeName, const OUString& _rPropertyName)
+ sal_Int32 nAttributeToken, const OUString& _rPropertyName)
{
- implAdd(_pAttributeName, _rPropertyName, ::cppu::UnoType::get());
+ implAdd(nAttributeToken, _rPropertyName, ::cppu::UnoType::get());
}
void OAttribute2Property::addInt32Property(
- const char* _pAttributeName, const OUString& _rPropertyName)
+ sal_Int32 nAttributeToken, const OUString& _rPropertyName)
{
- implAdd( _pAttributeName, _rPropertyName, ::cppu::UnoType::get() );
+ implAdd( nAttributeToken, _rPropertyName, ::cppu::UnoType::get() );
}
void OAttribute2Property::addEnumPropertyImpl(
- const char* _pAttributeName, const OUString& _rPropertyName,
+ sal_Int32 nAttributeToken, const OUString& _rPropertyName,
const SvXMLEnumMapEntry* _pValueMap,
const css::uno::Type* _pType)
{
- AttributeAssignment& aAssignment = implAdd(_pAttributeName, _rPropertyName,
+ AttributeAssignment& aAssignment = implAdd(nAttributeToken, _rPropertyName,
_pType ? *_pType : ::cppu::UnoType::get());
aAssignment.pEnumMap = _pValueMap;
}
OAttribute2Property::AttributeAssignment& OAttribute2Property::implAdd(
- const char* _pAttributeName, const OUString& _rPropertyName,
+ sal_Int32 nAttributeToken, const OUString& _rPropertyName,
const css::uno::Type& _rType)
{
- OSL_ENSURE(m_aKnownProperties.end() == m_aKnownProperties.find(OUString::createFromAscii(_pAttributeName)),
+ nAttributeToken &= TOKEN_MASK;
+ OSL_ENSURE(m_aKnownProperties.end() == m_aKnownProperties.find(nAttributeToken),
"OAttribute2Property::implAdd: already have this attribute!");
- OUString sAttributeName = OUString::createFromAscii(_pAttributeName);
-
AttributeAssignment aAssignment;
aAssignment.sPropertyName = _rPropertyName;
aAssignment.aPropertyType = _rType;
// redundance, the accessor is stored in aAssignment.sAttributeName, too
- m_aKnownProperties[sAttributeName] = aAssignment;
- return m_aKnownProperties[sAttributeName];
+ m_aKnownProperties[nAttributeToken] = aAssignment;
+ return m_aKnownProperties[nAttributeToken];
}
} // namespace xmloff
diff --git a/xmloff/source/forms/formattributes.hxx b/xmloff/source/forms/formattributes.hxx
index 56c18a896ac9..041316c69927 100644
--- a/xmloff/source/forms/formattributes.hxx
+++ b/xmloff/source/forms/formattributes.hxx
@@ -28,6 +28,7 @@
#include
#include
#include
+#include
#include
template
@@ -184,6 +185,12 @@ namespace xmloff
*/
static const char* getCommonControlAttributeName(CCAFlags _nId);
+ /** calculates the xml attribute representation of a common control attribute.
+ @param _nId
+ the id of the attribute. Has to be one of the CCA_* constants.
+ */
+ static sal_Int32 getCommonControlAttributeToken(CCAFlags _nId);
+
/** calculates the xml namespace key to use for a common control attribute
@param _nId
the id of the attribute. Has to be one of the CCA_* constants.
@@ -196,6 +203,12 @@ namespace xmloff
*/
static const char* getFormAttributeName(FormAttributes _eAttrib);
+ /** retrieves the name of an attribute of a form xml representation
+ @param _eAttrib
+ enum value specifying the attribute
+ */
+ static sal_Int32 getFormAttributeToken(FormAttributes _eAttrib);
+
/** calculates the xml namespace key to use for an attribute of a form xml representation
@param _eAttrib
enum value specifying the attribute
@@ -208,6 +221,12 @@ namespace xmloff
*/
static const char* getDatabaseAttributeName(DAFlags _nId);
+ /** calculates the xml attribute representation of a database attribute.
+ @param _nId
+ the id of the attribute. Has to be one of the DA_* constants.
+ */
+ static sal_Int32 getDatabaseAttributeToken(DAFlags _nId);
+
/** calculates the xml namespace key to use for a database attribute.
@param _nId
the id of the attribute. Has to be one of the DA_* constants.
@@ -224,12 +243,24 @@ namespace xmloff
*/
static const char* getSpecialAttributeName(SCAFlags _nId);
+ /** calculates the xml attribute representation of a special attribute.
+ @param _nId
+ the id of the attribute. Has to be one of the SCA_* constants.
+ */
+ static sal_Int32 getSpecialAttributeToken(SCAFlags _nId);
+
/** calculates the xml attribute representation of a binding attribute.
@param _nId
the id of the attribute. Has to be one of the BA_* constants.
*/
static const char* getBindingAttributeName(BAFlags _nId);
+ /** calculates the xml attribute representation of a binding attribute.
+ @param _nId
+ the id of the attribute. Has to be one of the BA_* constants.
+ */
+ static sal_Int32 getBindingAttributeToken(BAFlags _nId);
+
/** calculates the xml namespace key to use for a binding attribute.
@param _nId
the id of the attribute. Has to be one of the BA_* constants.
@@ -251,6 +282,7 @@ namespace xmloff
the id of the attribute
*/
static const char* getOfficeFormsAttributeName(OfficeFormsAttributes _eAttrib);
+ static xmloff::token::XMLTokenEnum getOfficeFormsAttributeToken(OfficeFormsAttributes _eAttrib);
/** calculates the xml namedspace key of an attribute of the office:forms element
@param _nId
@@ -288,8 +320,7 @@ namespace xmloff
};
private:
- typedef std::map AttributeAssignments;
- AttributeAssignments m_aKnownProperties;
+ std::map m_aKnownProperties;
public:
OAttribute2Property();
@@ -297,14 +328,11 @@ namespace xmloff
/** return the AttributeAssignment which corresponds to the given attribute
- @param _rAttribName
- the name of the attribute
@return
a pointer to the AttributeAssignment structure as requested, NULL if the attribute
does not represent a property.
*/
- const AttributeAssignment* getAttributeTranslation(
- const OUString& _rAttribName);
+ const AttributeAssignment* getAttributeTranslation(sal_Int32 nAttributeToken);
/** add an attribute assignment referring to a string property to the map
@param _pAttributeName
@@ -313,7 +341,7 @@ namespace xmloff
the name of the property assigned to the attribute
*/
void addStringProperty(
- const char* _pAttributeName, const OUString& _rPropertyName);
+ sal_Int32 nAttributeToken, const OUString& _rPropertyName);
/** add an attribute assignment referring to a boolean property to the map
@@ -328,7 +356,7 @@ namespace xmloff
if , the attribute value is used as property value directly
*/
void addBooleanProperty(
- const char* _pAttributeName, const OUString& _rPropertyName,
+ sal_Int32 nAttributeToken, const OUString& _rPropertyName,
const bool _bAttributeDefault, const bool _bInverseSemantics = false);
/** add an attribute assignment referring to an int16 property to the map
@@ -339,7 +367,7 @@ namespace xmloff
the name of the property assigned to the attribute
*/
void addInt16Property(
- const char* _pAttributeName, const OUString& _rPropertyName);
+ sal_Int32 nAttributeToken, const OUString& _rPropertyName);
/** add an attribute assignment referring to an int32 property to the map
@@ -349,7 +377,7 @@ namespace xmloff
the name of the property assigned to the attribute
*/
void addInt32Property(
- const char* _pAttributeName, const OUString& _rPropertyName );
+ sal_Int32 nAttributeToken, const OUString& _rPropertyName );
/** add an attribute assignment referring to an enum property to the map
@@ -364,22 +392,22 @@ namespace xmloff
*/
template
void addEnumProperty(
- const char* _pAttributeName, const OUString& _rPropertyName,
+ sal_Int32 nAttributeToken, const OUString& _rPropertyName,
const SvXMLEnumMapEntry* _pValueMap,
const css::uno::Type* _pType = nullptr)
{
- addEnumPropertyImpl(_pAttributeName, _rPropertyName,
+ addEnumPropertyImpl(nAttributeToken, _rPropertyName,
reinterpret_cast*>(_pValueMap), _pType);
}
private:
void addEnumPropertyImpl(
- const char* _pAttributeName, const OUString& _rPropertyName,
+ sal_Int32 nAttributeToken, const OUString& _rPropertyName,
const SvXMLEnumMapEntry* _pValueMap,
const css::uno::Type* _pType);
/// some common code for the various add*Property methods
AttributeAssignment& implAdd(
- const char* _pAttributeName, const OUString& _rPropertyName,
+ sal_Int32 nAttributeToken, const OUString& _rPropertyName,
const css::uno::Type& _rType);
};
} // namespace xmloff
diff --git a/xmloff/source/forms/formlayerimport.cxx b/xmloff/source/forms/formlayerimport.cxx
index e879ee5a0772..43cdf63f4c40 100644
--- a/xmloff/source/forms/formlayerimport.cxx
+++ b/xmloff/source/forms/formlayerimport.cxx
@@ -65,16 +65,22 @@ namespace xmloff
SvXMLImportContext* OFormLayerXMLImport::createOfficeFormsContext(
SvXMLImport& _rImport,
- sal_uInt16 _nPrefix,
- const OUString& _rLocalName)
+ sal_uInt16 /*_nPrefix*/,
+ const OUString& /*_rLocalName*/)
{
- return OFormLayerXMLImport_Impl::createOfficeFormsContext(_rImport, _nPrefix, _rLocalName);
+ return OFormLayerXMLImport_Impl::createOfficeFormsContext(_rImport);
}
- SvXMLImportContext* OFormLayerXMLImport::createContext(const sal_uInt16 _nPrefix, const OUString& _rLocalName,
- const Reference< xml::sax::XAttributeList >& _rxAttribs)
+ SvXMLImportContext* OFormLayerXMLImport::createOfficeFormsContext(
+ SvXMLImport& _rImport)
+ {
+ return OFormLayerXMLImport_Impl::createOfficeFormsContext(_rImport);
+ }
+
+ SvXMLImportContext* OFormLayerXMLImport::createContext(sal_Int32 nElement,
+ const Reference< xml::sax::XFastAttributeList >& _rxAttribs)
{
- return m_pImpl->createContext(_nPrefix, _rLocalName, _rxAttribs);
+ return m_pImpl->createContext(nElement, _rxAttribs);
}
void OFormLayerXMLImport::applyControlNumberStyle(const Reference< XPropertySet >& _rxControlModel, const OUString& _rControlNumberStyleName)
diff --git a/xmloff/source/forms/layerimport.cxx b/xmloff/source/forms/layerimport.cxx
index 83202e4f7be9..6039a1e303f0 100644
--- a/xmloff/source/forms/layerimport.cxx
+++ b/xmloff/source/forms/layerimport.cxx
@@ -58,6 +58,7 @@ using namespace ::com::sun::star;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::form;
using namespace ::com::sun::star::sdb;
+using namespace token;
//= OFormLayerXMLImport_Impl
OFormLayerXMLImport_Impl::OFormLayerXMLImport_Impl(SvXMLImport& _rImporter)
@@ -66,27 +67,27 @@ OFormLayerXMLImport_Impl::OFormLayerXMLImport_Impl(SvXMLImport& _rImporter)
// build the attribute2property map
// string properties which are exported as attributes
m_aAttributeMetaData.addStringProperty(
- OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Name), PROPERTY_NAME);
+ OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::Name), PROPERTY_NAME);
m_aAttributeMetaData.addStringProperty(
- OAttributeMetaData::getSpecialAttributeName(SCAFlags::GroupName), PROPERTY_GROUP_NAME);
+ OAttributeMetaData::getSpecialAttributeToken(SCAFlags::GroupName), PROPERTY_GROUP_NAME);
m_aAttributeMetaData.addStringProperty(
- OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Label), PROPERTY_LABEL);
+ OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::Label), PROPERTY_LABEL);
m_aAttributeMetaData.addStringProperty(
- OAttributeMetaData::getCommonControlAttributeName(CCAFlags::TargetLocation), PROPERTY_TARGETURL);
+ OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::TargetLocation), PROPERTY_TARGETURL);
m_aAttributeMetaData.addStringProperty(
- OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Title), PROPERTY_TITLE);
+ OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::Title), PROPERTY_TITLE);
m_aAttributeMetaData.addStringProperty(
- OAttributeMetaData::getCommonControlAttributeName(CCAFlags::TargetFrame), PROPERTY_TARGETFRAME);
+ OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::TargetFrame), PROPERTY_TARGETFRAME);
m_aAttributeMetaData.addStringProperty(
- OAttributeMetaData::getDatabaseAttributeName(DAFlags::DataField), PROPERTY_DATAFIELD);
+ OAttributeMetaData::getDatabaseAttributeToken(DAFlags::DataField), PROPERTY_DATAFIELD);
m_aAttributeMetaData.addStringProperty(
- OAttributeMetaData::getFormAttributeName(faCommand), PROPERTY_COMMAND);
+ OAttributeMetaData::getFormAttributeToken(faCommand), PROPERTY_COMMAND);
m_aAttributeMetaData.addStringProperty(
- OAttributeMetaData::getFormAttributeName(faDatasource), PROPERTY_DATASOURCENAME);
+ OAttributeMetaData::getFormAttributeToken(faDatasource), PROPERTY_DATASOURCENAME);
m_aAttributeMetaData.addStringProperty(
- OAttributeMetaData::getFormAttributeName(faFilter), PROPERTY_FILTER);
+ OAttributeMetaData::getFormAttributeToken(faFilter), PROPERTY_FILTER);
m_aAttributeMetaData.addStringProperty(
- OAttributeMetaData::getFormAttributeName(faOrder), PROPERTY_ORDER);
+ OAttributeMetaData::getFormAttributeToken(faOrder), PROPERTY_ORDER);
// properties not added because they're already present in another form
OSL_ENSURE(
@@ -105,108 +106,108 @@ OFormLayerXMLImport_Impl::OFormLayerXMLImport_Impl(SvXMLImport& _rImporter)
// boolean properties which are exported as attributes
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getCommonControlAttributeName(CCAFlags::CurrentSelected), PROPERTY_STATE, false);
+ OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::CurrentSelected), PROPERTY_STATE, false);
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Disabled), PROPERTY_ENABLED, false, true);
+ OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::Disabled), PROPERTY_ENABLED, false, true);
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Dropdown), PROPERTY_DROPDOWN, false);
+ OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::Dropdown), PROPERTY_DROPDOWN, false);
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Printable), PROPERTY_PRINTABLE, true);
+ OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::Printable), PROPERTY_PRINTABLE, true);
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getCommonControlAttributeName(CCAFlags::ReadOnly), PROPERTY_READONLY, false);
+ OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::ReadOnly), PROPERTY_READONLY, false);
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Selected), PROPERTY_DEFAULT_STATE, false);
+ OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::Selected), PROPERTY_DEFAULT_STATE, false);
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getCommonControlAttributeName(CCAFlags::TabStop), PROPERTY_TABSTOP, true);
+ OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::TabStop), PROPERTY_TABSTOP, true);
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getDatabaseAttributeName(DAFlags::ConvertEmpty), PROPERTY_EMPTY_IS_NULL, false);
+ OAttributeMetaData::getDatabaseAttributeToken(DAFlags::ConvertEmpty), PROPERTY_EMPTY_IS_NULL, false);
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getSpecialAttributeName(SCAFlags::Validation), PROPERTY_STRICTFORMAT, false);
+ OAttributeMetaData::getSpecialAttributeToken(SCAFlags::Validation), PROPERTY_STRICTFORMAT, false);
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getSpecialAttributeName(SCAFlags::MultiLine), PROPERTY_MULTILINE, false);
+ OAttributeMetaData::getSpecialAttributeToken(SCAFlags::MultiLine), PROPERTY_MULTILINE, false);
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getSpecialAttributeName(SCAFlags::AutoCompletion), PROPERTY_AUTOCOMPLETE, false);
+ OAttributeMetaData::getSpecialAttributeToken(SCAFlags::AutoCompletion), PROPERTY_AUTOCOMPLETE, false);
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getSpecialAttributeName(SCAFlags::Multiple), PROPERTY_MULTISELECTION, false);
+ OAttributeMetaData::getSpecialAttributeToken(SCAFlags::Multiple), PROPERTY_MULTISELECTION, false);
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getSpecialAttributeName(SCAFlags::DefaultButton), PROPERTY_DEFAULTBUTTON, false);
+ OAttributeMetaData::getSpecialAttributeToken(SCAFlags::DefaultButton), PROPERTY_DEFAULTBUTTON, false);
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getSpecialAttributeName(SCAFlags::IsTristate), PROPERTY_TRISTATE, false);
+ OAttributeMetaData::getSpecialAttributeToken(SCAFlags::IsTristate), PROPERTY_TRISTATE, false);
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getFormAttributeName(faAllowDeletes), PROPERTY_ALLOWDELETES, true);
+ OAttributeMetaData::getFormAttributeToken(faAllowDeletes), PROPERTY_ALLOWDELETES, true);
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getFormAttributeName(faAllowInserts), PROPERTY_ALLOWINSERTS, true);
+ OAttributeMetaData::getFormAttributeToken(faAllowInserts), PROPERTY_ALLOWINSERTS, true);
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getFormAttributeName(faAllowUpdates), PROPERTY_ALLOWUPDATES, true);
+ OAttributeMetaData::getFormAttributeToken(faAllowUpdates), PROPERTY_ALLOWUPDATES, true);
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getFormAttributeName(faApplyFilter), PROPERTY_APPLYFILTER, false);
+ OAttributeMetaData::getFormAttributeToken(faApplyFilter), PROPERTY_APPLYFILTER, false);
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getFormAttributeName(faEscapeProcessing), PROPERTY_ESCAPEPROCESSING, true);
+ OAttributeMetaData::getFormAttributeToken(faEscapeProcessing), PROPERTY_ESCAPEPROCESSING, true);
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getFormAttributeName(faIgnoreResult), PROPERTY_IGNORERESULT, false);
+ OAttributeMetaData::getFormAttributeToken(faIgnoreResult), PROPERTY_IGNORERESULT, false);
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getSpecialAttributeName( SCAFlags::Toggle ), PROPERTY_TOGGLE, false );
+ OAttributeMetaData::getSpecialAttributeToken( SCAFlags::Toggle ), PROPERTY_TOGGLE, false );
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getSpecialAttributeName( SCAFlags::FocusOnClick ), PROPERTY_FOCUS_ON_CLICK, true );
+ OAttributeMetaData::getSpecialAttributeToken( SCAFlags::FocusOnClick ), PROPERTY_FOCUS_ON_CLICK, true );
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getDatabaseAttributeName( DAFlags::InputRequired ), PROPERTY_INPUT_REQUIRED, false );
+ OAttributeMetaData::getDatabaseAttributeToken( DAFlags::InputRequired ), PROPERTY_INPUT_REQUIRED, false );
// the int16 attributes
m_aAttributeMetaData.addInt16Property(
- OAttributeMetaData::getCommonControlAttributeName(CCAFlags::MaxLength), PROPERTY_MAXTEXTLENGTH);
+ OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::MaxLength), PROPERTY_MAXTEXTLENGTH);
m_aAttributeMetaData.addInt16Property(
- OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Size), PROPERTY_LINECOUNT);
+ OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::Size), PROPERTY_LINECOUNT);
m_aAttributeMetaData.addInt16Property(
- OAttributeMetaData::getCommonControlAttributeName(CCAFlags::TabIndex), PROPERTY_TABINDEX);
+ OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::TabIndex), PROPERTY_TABINDEX);
m_aAttributeMetaData.addInt16Property(
- OAttributeMetaData::getDatabaseAttributeName(DAFlags::BoundColumn), PROPERTY_BOUNDCOLUMN);
+ OAttributeMetaData::getDatabaseAttributeToken(DAFlags::BoundColumn), PROPERTY_BOUNDCOLUMN);
// the int32 attributes
m_aAttributeMetaData.addInt32Property(
- OAttributeMetaData::getSpecialAttributeName( SCAFlags::PageStepSize ), PROPERTY_BLOCK_INCREMENT );
+ OAttributeMetaData::getSpecialAttributeToken( SCAFlags::PageStepSize ), PROPERTY_BLOCK_INCREMENT );
// the enum attributes
m_aAttributeMetaData.addEnumProperty(
- OAttributeMetaData::getCommonControlAttributeName( CCAFlags::VisualEffect ), PROPERTY_VISUAL_EFFECT,
+ OAttributeMetaData::getCommonControlAttributeToken( CCAFlags::VisualEffect ), PROPERTY_VISUAL_EFFECT,
aVisualEffectMap,
&::cppu::UnoType::get() );
m_aAttributeMetaData.addEnumProperty(
- OAttributeMetaData::getCommonControlAttributeName( CCAFlags::Orientation ), PROPERTY_ORIENTATION,
+ OAttributeMetaData::getCommonControlAttributeToken( CCAFlags::Orientation ), PROPERTY_ORIENTATION,
aOrientationMap,
&::cppu::UnoType::get() );
m_aAttributeMetaData.addEnumProperty(
- OAttributeMetaData::getCommonControlAttributeName(CCAFlags::ButtonType), PROPERTY_BUTTONTYPE,
+ OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::ButtonType), PROPERTY_BUTTONTYPE,
aFormButtonTypeMap,
&::cppu::UnoType::get());
m_aAttributeMetaData.addEnumProperty(
- OAttributeMetaData::getDatabaseAttributeName(DAFlags::ListSource_TYPE), PROPERTY_LISTSOURCETYPE,
+ OAttributeMetaData::getDatabaseAttributeToken(DAFlags::ListSource_TYPE), PROPERTY_LISTSOURCETYPE,
aListSourceTypeMap,
&::cppu::UnoType::get());
m_aAttributeMetaData.addEnumProperty(
- OAttributeMetaData::getSpecialAttributeName(SCAFlags::State), PROPERTY_DEFAULT_STATE,
+ OAttributeMetaData::getSpecialAttributeToken(SCAFlags::State), PROPERTY_DEFAULT_STATE,
aCheckStateMap,
&::cppu::UnoType::get());
m_aAttributeMetaData.addEnumProperty(
- OAttributeMetaData::getSpecialAttributeName(SCAFlags::CurrentState), PROPERTY_STATE,
+ OAttributeMetaData::getSpecialAttributeToken(SCAFlags::CurrentState), PROPERTY_STATE,
aCheckStateMap,
&::cppu::UnoType::get());
m_aAttributeMetaData.addEnumProperty(
- OAttributeMetaData::getFormAttributeName(faEnctype), PROPERTY_SUBMIT_ENCODING,
+ OAttributeMetaData::getFormAttributeToken(faEnctype), PROPERTY_SUBMIT_ENCODING,
aSubmitEncodingMap,
&::cppu::UnoType::get());
m_aAttributeMetaData.addEnumProperty(
- OAttributeMetaData::getFormAttributeName(faMethod), PROPERTY_SUBMIT_METHOD,
+ OAttributeMetaData::getFormAttributeToken(faMethod), PROPERTY_SUBMIT_METHOD,
aSubmitMethodMap,
&::cppu::UnoType::get());
m_aAttributeMetaData.addEnumProperty(
- OAttributeMetaData::getFormAttributeName(faCommandType), PROPERTY_COMMAND_TYPE,
+ OAttributeMetaData::getFormAttributeToken(faCommandType), PROPERTY_COMMAND_TYPE,
aCommandTypeMap);
m_aAttributeMetaData.addEnumProperty(
- OAttributeMetaData::getFormAttributeName(faNavigationMode), PROPERTY_NAVIGATION,
+ OAttributeMetaData::getFormAttributeToken(faNavigationMode), PROPERTY_NAVIGATION,
aNavigationTypeMap,
&::cppu::UnoType::get());
m_aAttributeMetaData.addEnumProperty(
- OAttributeMetaData::getFormAttributeName(faTabbingCycle), PROPERTY_CYCLE,
+ OAttributeMetaData::getFormAttributeToken(faTabbingCycle), PROPERTY_CYCLE,
aTabulatorCycleMap,
&::cppu::UnoType::get());
@@ -435,33 +436,33 @@ Reference< XPropertySet > OFormLayerXMLImport_Impl::lookupControlId(const OUStri
if (m_aCurrentPageIds->second.end() != aPos)
xReturn = aPos->second;
else
- OSL_FAIL("OFormLayerXMLImport_Impl::lookupControlId: invalid control id (did not find it)!");
+ SAL_WARN("xmloff", "unknown control id " << _rControlId);
}
return xReturn;
}
SvXMLImportContext* OFormLayerXMLImport_Impl::createOfficeFormsContext(
- SvXMLImport& _rImport,
- sal_uInt16 _nPrefix,
- const OUString& _rLocalName)
+ SvXMLImport& _rImport)
{
- return new OFormsRootImport( _rImport, _nPrefix, _rLocalName );
+ return new OFormsRootImport( _rImport );
}
-SvXMLImportContext* OFormLayerXMLImport_Impl::createContext(const sal_uInt16 _nPrefix, const OUString& _rLocalName,
- const Reference< xml::sax::XAttributeList >&)
+SvXMLImportContext* OFormLayerXMLImport_Impl::createContext(
+ sal_Int32 nElement,
+ const Reference< xml::sax::XFastAttributeList >&)
{
SvXMLImportContext* pContext = nullptr;
- if ( _rLocalName == "form" )
+ if ( (nElement & TOKEN_MASK) == XML_FORM )
{
if ( m_xCurrentPageFormsSupp.is() )
- pContext = new OFormImport(*this, *this, _nPrefix, _rLocalName, m_xCurrentPageFormsSupp->getForms() );
+ pContext = new OFormImport(*this, *this, m_xCurrentPageFormsSupp->getForms() );
}
- else if ( _nPrefix == XML_NAMESPACE_XFORMS
- && xmloff::token::IsXMLToken( _rLocalName, xmloff::token::XML_MODEL ) )
+ else if ( nElement == XML_ELEMENT(XFORMS, XML_MODEL) )
{
- pContext = createXFormsModelContext( m_rImporter, _nPrefix, _rLocalName );
+ pContext = createXFormsModelContext( m_rImporter );
}
+ else
+ SAL_WARN("xmloff", "unknown element " << SvXMLImport::getPrefixAndNameFromToken(nElement));
return pContext;
}
diff --git a/xmloff/source/forms/layerimport.hxx b/xmloff/source/forms/layerimport.hxx
index c21523054d1c..91bf05ad66f2 100644
--- a/xmloff/source/forms/layerimport.hxx
+++ b/xmloff/source/forms/layerimport.hxx
@@ -143,17 +143,14 @@ namespace xmloff
/** creates an import context for the office:forms element
*/
static SvXMLImportContext* createOfficeFormsContext(
- SvXMLImport& _rImport,
- sal_uInt16 _nPrefix,
- const OUString& _rLocalName);
+ SvXMLImport& _rImport);
/** create an SvXMLImportContext instance which is able to import the <form:form>
element.
*/
SvXMLImportContext* createContext(
- const sal_uInt16 _nPrefix,
- const OUString& _rLocalName,
- const css::uno::Reference< css::xml::sax::XAttributeList >& _rxAttribs);
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& _rxAttribs);
/** get the control with the given id
*/
diff --git a/xmloff/source/forms/officeforms.cxx b/xmloff/source/forms/officeforms.cxx
index 6933e379568d..fac520564838 100644
--- a/xmloff/source/forms/officeforms.cxx
+++ b/xmloff/source/forms/officeforms.cxx
@@ -39,10 +39,11 @@ namespace xmloff
using namespace ::com::sun::star::xml;
using ::xmloff::token::XML_FORMS;
using ::com::sun::star::xml::sax::XAttributeList;
+ using ::com::sun::star::xml::sax::XFastAttributeList;
//= OFormsRootImport
- OFormsRootImport::OFormsRootImport( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName )
- :SvXMLImportContext(rImport, nPrfx, rLocalName)
+ OFormsRootImport::OFormsRootImport( SvXMLImport& rImport )
+ :SvXMLImportContext(rImport)
{
}
@@ -50,13 +51,14 @@ namespace xmloff
{
}
- SvXMLImportContextRef OFormsRootImport::CreateChildContext( sal_uInt16 _nPrefix, const OUString& _rLocalName,
- const Reference< XAttributeList>& xAttrList )
+ css::uno::Reference< css::xml::sax::XFastContextHandler > OFormsRootImport::createFastChildContext(
+ sal_Int32 _nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList )
{
SvXMLImportContext* pRet = nullptr;
try
{
- pRet = GetImport().GetFormImport()->createContext( _nPrefix, _rLocalName, xAttrList );
+ pRet = GetImport().GetFormImport()->createContext( _nElement, xAttrList );
} catch (const Exception&)
{
DBG_UNHANDLED_EXCEPTION("xmloff.forms");
@@ -64,17 +66,17 @@ namespace xmloff
return pRet;
}
- void OFormsRootImport::implImportBool(const Reference< XAttributeList >& _rxAttributes, OfficeFormsAttributes _eAttribute,
+ void OFormsRootImport::implImportBool(const Reference< XFastAttributeList >& _rxAttributes, OfficeFormsAttributes _eAttribute,
const Reference< XPropertySet >& _rxProps, const Reference< XPropertySetInfo >& _rxPropInfo,
const OUString& _rPropName, bool _bDefault)
{
// the complete attribute name to look for
- OUString sCompleteAttributeName = GetImport().GetNamespaceMap().GetQNameByIndex(
- OAttributeMetaData::getOfficeFormsAttributeNamespace(),
- OUString::createFromAscii(OAttributeMetaData::getOfficeFormsAttributeName(_eAttribute)));
+ sal_Int32 nCompleteAttributeName = XML_ELEMENT(
+ FORM,
+ OAttributeMetaData::getOfficeFormsAttributeToken(_eAttribute));
// get and convert the value
- OUString sAttributeValue = _rxAttributes->getValueByName(sCompleteAttributeName);
+ OUString sAttributeValue = _rxAttributes->getOptionalValue(nCompleteAttributeName);
bool bValue = _bDefault;
(void)::sax::Converter::convertBool(bValue, sAttributeValue);
@@ -85,7 +87,7 @@ namespace xmloff
}
}
- void OFormsRootImport::StartElement( const Reference< XAttributeList >& _rxAttrList )
+ void OFormsRootImport::startFastElement( sal_Int32 /*nElement*/, const Reference< XFastAttributeList >& _rxAttrList )
{
ENTER_LOG_CONTEXT( "xmloff::OFormsRootImport - importing the complete tree" );
diff --git a/xmloff/source/forms/officeforms.hxx b/xmloff/source/forms/officeforms.hxx
index 5efca14d6873..29b7bb0b3da9 100644
--- a/xmloff/source/forms/officeforms.hxx
+++ b/xmloff/source/forms/officeforms.hxx
@@ -40,18 +40,20 @@ namespace xmloff
{
public:
- OFormsRootImport( SvXMLImport& _rImport, sal_uInt16 _nPrfx, const OUString& _rLocalName);
+ OFormsRootImport( SvXMLImport& _rImport);
virtual ~OFormsRootImport() override;
// SvXMLImportContext overridable
- virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName,
- const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList ) override;
- 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;
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+ sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
private:
- void implImportBool(
- const css::uno::Reference< css::xml::sax::XAttributeList >& _rxAttributes,
+ static void implImportBool(
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& _rxAttributes,
OfficeFormsAttributes _eAttribute,
const css::uno::Reference< css::beans::XPropertySet >& _rxProps,
const css::uno::Reference< css::beans::XPropertySetInfo >& _rxPropInfo,
diff --git a/xmloff/source/forms/property_meta_data.cxx b/xmloff/source/forms/property_meta_data.cxx
index f6a6ecbc9702..16307b395646 100644
--- a/xmloff/source/forms/property_meta_data.cxx
+++ b/xmloff/source/forms/property_meta_data.cxx
@@ -21,6 +21,7 @@
#include "property_meta_data.hxx"
#include
#include "strings.hxx"
+#include
#include
#include
@@ -171,6 +172,14 @@ namespace xmloff::metadata
return attribute;
}
+ AttributeDescription getAttributeDescription( sal_Int32 nAttributeToken )
+ {
+ AttributeDescription attribute;
+ attribute.namespacePrefix = (nAttributeToken >> NMSP_SHIFT) - 1;
+ attribute.attributeToken = static_cast(nAttributeToken & TOKEN_MASK);
+ return attribute;
+ }
+
} // namespace xmloff::metadata
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/property_meta_data.hxx b/xmloff/source/forms/property_meta_data.hxx
index 612f36e6c9e5..b61a1878b745 100644
--- a/xmloff/source/forms/property_meta_data.hxx
+++ b/xmloff/source/forms/property_meta_data.hxx
@@ -39,6 +39,10 @@ namespace xmloff::metadata
AttributeDescription
getAttributeDescription( const sal_uInt16 i_namespacePrefix, const OUString& i_attributeName );
+ /** retrieves the attribute descriptor for the attribute given by namespace prefix and attribute name
+ */
+ AttributeDescription getAttributeDescription( sal_Int32 nElement );
+
} // namespace xmloff::metadata
#endif // INCLUDED_XMLOFF_SOURCE_FORMS_PROPERTY_META_DATA_HXX
diff --git a/xmloff/source/forms/propertyimport.cxx b/xmloff/source/forms/propertyimport.cxx
index 4a875a51530e..d8933bbaa52e 100644
--- a/xmloff/source/forms/propertyimport.cxx
+++ b/xmloff/source/forms/propertyimport.cxx
@@ -48,6 +48,7 @@ namespace xmloff
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::xml;
using ::com::sun::star::xml::sax::XAttributeList;
+ using ::com::sun::star::xml::sax::XFastAttributeList;
// NO using namespace ...util !!!
// need a tools Date/Time/DateTime below, which would conflict with the uno types then
@@ -250,43 +251,39 @@ Type PropertyConversion::xmlTypeToUnoType( const OUString& _rType )
}
//= OPropertyImport
-OPropertyImport::OPropertyImport(OFormLayerXMLImport_Impl& _rImport, sal_uInt16 _nPrefix, const OUString& _rName)
- :SvXMLImportContext(_rImport.getGlobalContext(), _nPrefix, _rName)
+OPropertyImport::OPropertyImport(OFormLayerXMLImport_Impl& _rImport)
+ :SvXMLImportContext(_rImport.getGlobalContext())
,m_rContext(_rImport)
,m_bTrackAttributes(false)
{
}
-SvXMLImportContextRef OPropertyImport::CreateChildContext(sal_uInt16 _nPrefix, const OUString& _rLocalName,
- const Reference< XAttributeList >& /*_rxAttrList*/)
+css::uno::Reference< css::xml::sax::XFastContextHandler > OPropertyImport::createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/ )
{
- if( token::IsXMLToken( _rLocalName, token::XML_PROPERTIES) )
+ if( (nElement & TOKEN_MASK) == token::XML_PROPERTIES )
{
- return new OPropertyElementsContext( m_rContext.getGlobalContext(),
- _nPrefix, _rLocalName, this);
+ return new OPropertyElementsContext( m_rContext.getGlobalContext(), this);
}
+ else
+ SAL_WARN("xmloff", "unknown element " << SvXMLImport::getPrefixAndNameFromToken(nElement));
return nullptr;
}
-void OPropertyImport::StartElement(const Reference< XAttributeList >& _rxAttrList)
+void OPropertyImport::startFastElement(sal_Int32 /*nElement*/, const Reference< XFastAttributeList >& xAttrList)
{
- OSL_ENSURE(_rxAttrList.is(), "OPropertyImport::StartElement: invalid attribute list!");
- const sal_Int32 nAttributeCount = _rxAttrList->getLength();
// assume the 'worst' case: all attributes describe properties. This should save our property array
// some reallocs
- m_aValues.reserve(nAttributeCount);
+ m_aValues.reserve(sax_fastparser::castToFastAttributeList(xAttrList).size());
- const SvXMLNamespaceMap& rMap = m_rContext.getGlobalContext().GetNamespaceMap();
- sal_uInt16 nNamespace;
- OUString sLocalName;
- for (sal_Int32 i=0; igetNameByIndex(i), &sLocalName);
- handleAttribute(nNamespace, sLocalName, _rxAttrList->getValueByIndex(i));
+ handleAttribute(aIter.getToken(), aIter.toString());
if (m_bTrackAttributes)
- m_aEncounteredAttributes.insert(sLocalName);
+ m_aEncounteredAttributes.insert(aIter.getToken());
}
// TODO: create PropertyValues for all the attributes which were not present, because they were implied
@@ -294,10 +291,10 @@ void OPropertyImport::StartElement(const Reference< XAttributeList >& _rxAttrLis
// default
}
-bool OPropertyImport::encounteredAttribute(const OUString& _rAttributeName) const
+bool OPropertyImport::encounteredAttribute(sal_Int32 nAttributeToken) const
{
OSL_ENSURE(m_bTrackAttributes, "OPropertyImport::encounteredAttribute: attribute tracking not enabled!");
- return m_aEncounteredAttributes.end() != m_aEncounteredAttributes.find(_rAttributeName);
+ return m_aEncounteredAttributes.end() != m_aEncounteredAttributes.find(nAttributeToken);
}
void OPropertyImport::characters(const OUString& _rChars )
@@ -306,9 +303,9 @@ void OPropertyImport::characters(const OUString& _rChars )
OSL_ENSURE(_rChars.trim().isEmpty(), "OPropertyImport::Characters: non-whitespace characters!");
}
-bool OPropertyImport::handleAttribute(sal_uInt16 /*_nNamespaceKey*/, const OUString& _rLocalName, const OUString& _rValue)
+bool OPropertyImport::handleAttribute(sal_Int32 nAttributeToken, const OUString& _rValue)
{
- const OAttribute2Property::AttributeAssignment* pProperty = m_rContext.getAttributeMap().getAttributeTranslation(_rLocalName);
+ const OAttribute2Property::AttributeAssignment* pProperty = m_rContext.getAttributeMap().getAttributeTranslation(nAttributeToken & TOKEN_MASK);
if (pProperty)
{
// create and store a new PropertyValue
@@ -316,7 +313,7 @@ bool OPropertyImport::handleAttribute(sal_uInt16 /*_nNamespaceKey*/, const OUStr
aNewValue.Name = pProperty->sPropertyName;
// convert the value string into the target type
- if (token::IsXMLToken(_rLocalName, token::XML_HREF))
+ if ((nAttributeToken & TOKEN_MASK) == token::XML_HREF)
{
aNewValue.Value <<= m_rContext.getGlobalContext().GetAbsoluteReference(_rValue);
}
@@ -329,19 +326,19 @@ bool OPropertyImport::handleAttribute(sal_uInt16 /*_nNamespaceKey*/, const OUStr
implPushBackPropertyValue( aNewValue );
return true;
}
- if (!token::IsXMLToken(_rLocalName, token::XML_TYPE)) // xlink:type is valid but ignored for
+ if ((nAttributeToken & TOKEN_MASK) != token::XML_TYPE) // xlink:type is valid but ignored for
{
- SAL_WARN( "xmloff", "OPropertyImport::handleAttribute: Can't handle the following:\n"
- " Attribute name: " << _rLocalName << "\n value: " << _rValue );
+ SAL_WARN( "xmloff", "OPropertyImport::handleAttribute: Can't handle "
+ << SvXMLImport::getPrefixAndNameFromToken(nAttributeToken) << "=" << _rValue );
return false;
}
return true;
}
//= OPropertyElementsContext
-OPropertyElementsContext::OPropertyElementsContext(SvXMLImport& _rImport, sal_uInt16 _nPrefix, const OUString& _rName,
+OPropertyElementsContext::OPropertyElementsContext(SvXMLImport& _rImport,
const OPropertyImportRef& _rPropertyImporter)
- :SvXMLImportContext(_rImport, _nPrefix, _rName)
+ :SvXMLImportContext(_rImport)
,m_xPropertyImporter(_rPropertyImporter)
{
}
diff --git a/xmloff/source/forms/propertyimport.hxx b/xmloff/source/forms/propertyimport.hxx
index 1b143df647ae..c75e662c1ad0 100644
--- a/xmloff/source/forms/propertyimport.hxx
+++ b/xmloff/source/forms/propertyimport.hxx
@@ -22,7 +22,7 @@
#include
-#include
+#include
#include
#include "formattributes.hxx"
@@ -80,7 +80,7 @@ namespace xmloff
PropertyValueArray m_aGenericValues;
// the values which the instance collects between StartElement and EndElement
- std::set m_aEncounteredAttributes;
+ o3tl::sorted_vector m_aEncounteredAttributes;
OFormLayerXMLImport_Impl& m_rContext;
@@ -91,14 +91,15 @@ namespace xmloff
// style properties) can be done in our own EndElement instead of letting derived classes do this.
public:
- OPropertyImport(OFormLayerXMLImport_Impl& _rImport, sal_uInt16 _nPrefix, const OUString& _rName);
+ OPropertyImport(OFormLayerXMLImport_Impl& _rImport);
- virtual SvXMLImportContextRef CreateChildContext(
- sal_uInt16 _nPrefix, const OUString& _rLocalName,
- const css::uno::Reference< css::xml::sax::XAttributeList >& _rxAttrList) 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;
- 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 void SAL_CALL characters(const OUString& _rChars) override;
protected:
@@ -116,15 +117,13 @@ namespace xmloff
@param _rValue
attribute value
*/
- virtual bool handleAttribute(sal_uInt16 _nNamespaceKey,
- const OUString& _rLocalName,
- const OUString& _rValue);
+ virtual bool handleAttribute(sal_Int32 nElement, const OUString& _rValue);
/** determine if the element imported by the object had a given attribute.
Please be aware of the fact that the name given must be a local name, i.e. not contain a namespace.
All form relevant attributes are in the same namespace, so this would be a redundant information.
*/
- bool encounteredAttribute(const OUString& _rAttributeName) const;
+ bool encounteredAttribute(sal_Int32 nElement) const;
/** enables the tracking of the encountered attributes
The tracking will raise the import costs a little bit, but it's cheaper than
@@ -158,7 +157,7 @@ namespace xmloff
OPropertyImportRef m_xPropertyImporter; // to add the properties
public:
- OPropertyElementsContext(SvXMLImport& _rImport, sal_uInt16 _nPrefix, const OUString& _rName,
+ OPropertyElementsContext(SvXMLImport& _rImport,
const OPropertyImportRef& _rPropertyImporter);
virtual SvXMLImportContextRef CreateChildContext(
diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt
index c3dcca040340..ff92a2f34a9c 100644
--- a/xmloff/source/token/tokens.txt
+++ b/xmloff/source/token/tokens.txt
@@ -137,6 +137,9 @@ algorithm
align
all
allow-empty-cell
+allow-deletes
+allow-inserts
+allow-updates
alphabetical-index
alphabetical-index-auto-mark-file
alphabetical-index-entry-template
@@ -285,6 +288,7 @@ button2
button3
button4
buttons
+button-type
bvar
c
calculation-settings
@@ -408,6 +412,7 @@ contrast
control
conversion-mode
conversion-type
+convert-empty-to-null
copy-back
copy-formulas
copy-outline-levels
@@ -532,6 +537,7 @@ decorate-words-only
decorative
deep
default
+default-button
default-cell-style-name
default-style
default-style-name
@@ -604,6 +610,7 @@ drawpool
dropdown
drop-cap
dynamic
+echo-char
edge-rounding
editable
editing-cycles
@@ -622,6 +629,7 @@ empty-line-refresh
enable-numbering
enabled
encoding
+enctype
end
end-angle
end-cell-address
@@ -729,6 +737,7 @@ floating-frame
floor
fn
focal-length
+focus-on-click
font-char-width
font-charset
font-charset-asian
@@ -800,6 +809,7 @@ footnote-ref
footnote-sep
footnotes-configuration
footnotes-position
+for
forall
force-manual
foreground
@@ -937,6 +947,7 @@ identify-categories
ideograph-alpha
ignore-case
ignore-empty-rows
+ignore-result
ignore-selected-page
illustration-index
illustration-index-entry-template
@@ -971,6 +982,7 @@ index-title-template
information
initial-creator
inproceedings
+input-required
insert-columns
insert-rows
insertion
@@ -994,6 +1006,7 @@ is-hidden
is-selection
isbn
italic
+item
iteration
journal
justified
@@ -1218,6 +1231,8 @@ mtd
mtext
mtr
multi-deletion-spanned
+multi-line
+multiple
munder
munderover
name
@@ -1225,6 +1240,7 @@ name-and-extension
named-expression
named-expressions
named-range
+navigation-mode
navy
negative-color
neq
@@ -1332,6 +1348,7 @@ page-name
page-number
page-number-visible
page-start-margin
+page-step-size
page-style-name
page-thumbnail
page-usage
@@ -1685,6 +1702,7 @@ start-shape
start-table
start-value
start-with-navigator
+state
statistics
status
stay-on-top
@@ -1739,6 +1757,8 @@ symbol-image-name
symbol-width
system
tab-color
+tab-cycle
+tab-index
tab-stop
tab-stop-distance
tab-stops
@@ -1846,6 +1866,7 @@ to-upper-right
toc-mark
toc-mark-end
toc-mark-start
+toggle
top
top-left
TOP_PERCENT_DUMMY
@@ -1928,6 +1949,7 @@ user-index-mark-start
user-index-source
user-transformed
username
+validation
value
value-type
values-cell-range-address
@@ -1967,6 +1989,7 @@ visible-area-left
visible-area-top
visible-area-width
visited-style-name
+visual-effect
volatile
volume
vpn
diff --git a/xmloff/source/xforms/TokenContext.cxx b/xmloff/source/xforms/TokenContext.cxx
index 5dd2aeda0450..f6cf9201d0f9 100644
--- a/xmloff/source/xforms/TokenContext.cxx
+++ b/xmloff/source/xforms/TokenContext.cxx
@@ -47,6 +47,15 @@ TokenContext::TokenContext( SvXMLImport& rImport,
{
}
+TokenContext::TokenContext( SvXMLImport& rImport,
+ const SvXMLTokenMapEntry* pAttributes,
+ const SvXMLTokenMapEntry* pChildren )
+ : SvXMLImportContext( rImport ),
+ mpAttributes( pAttributes ),
+ mpChildren( pChildren )
+{
+}
+
void TokenContext::StartElement(
const Reference& xAttributeList )
{
diff --git a/xmloff/source/xforms/TokenContext.hxx b/xmloff/source/xforms/TokenContext.hxx
index 05c5b7372a7a..9821a3c8f386 100644
--- a/xmloff/source/xforms/TokenContext.hxx
+++ b/xmloff/source/xforms/TokenContext.hxx
@@ -47,6 +47,9 @@ public:
const OUString& rLocalName,
const SvXMLTokenMapEntry* pAttributes,
const SvXMLTokenMapEntry* pChildren );
+ TokenContext( SvXMLImport& rImport,
+ const SvXMLTokenMapEntry* pAttributes,
+ const SvXMLTokenMapEntry* pChildren );
// implement SvXMLImportContext methods:
diff --git a/xmloff/source/xforms/XFormsModelContext.cxx b/xmloff/source/xforms/XFormsModelContext.cxx
index ae43be1328ff..0ccb9be98461 100644
--- a/xmloff/source/xforms/XFormsModelContext.cxx
+++ b/xmloff/source/xforms/XFormsModelContext.cxx
@@ -69,6 +69,12 @@ XFormsModelContext::XFormsModelContext( SvXMLImport& rImport,
{
}
+XFormsModelContext::XFormsModelContext( SvXMLImport& rImport ) :
+ TokenContext( rImport, aAttributes, aChildren ),
+ mxModel( xforms_createXFormsModel() )
+{
+}
+
void XFormsModelContext::HandleAttribute(
sal_uInt16 nToken,
const OUString& rValue )
diff --git a/xmloff/source/xforms/XFormsModelContext.hxx b/xmloff/source/xforms/XFormsModelContext.hxx
index f188fac8589e..a93a88a3041a 100644
--- a/xmloff/source/xforms/XFormsModelContext.hxx
+++ b/xmloff/source/xforms/XFormsModelContext.hxx
@@ -41,6 +41,7 @@ public:
XFormsModelContext( SvXMLImport& rImport,
sal_uInt16 nPrfx,
const OUString& rLName );
+ XFormsModelContext( SvXMLImport& rImport );
// implement SvXMLImportContext & TokenContext methods:
diff --git a/xmloff/source/xforms/xformsimport.cxx b/xmloff/source/xforms/xformsimport.cxx
index 4d07507a6e68..a82d8a41da8b 100644
--- a/xmloff/source/xforms/xformsimport.cxx
+++ b/xmloff/source/xforms/xformsimport.cxx
@@ -62,6 +62,12 @@ SvXMLImportContext* createXFormsModelContext(
return new XFormsModelContext( rImport, nPrefix, rLocalName );
}
+SvXMLImportContext* createXFormsModelContext(
+ SvXMLImport& rImport )
+{
+ return new XFormsModelContext( rImport );
+}
+
void bindXFormsValueBinding(Reference const& xModel,
const pair, OUString>& aPair)
{
--
cgit