don't write new elements/attribs to ODF namespaces

Related to validation errors with fdo#31296

Change-Id: I1b76e05a9996b1123db164629475a3f7b07dda69
This commit is contained in:
Markus Mohrhard
2013-12-28 12:44:02 +01:00
parent ff74eafbe6
commit 393a9d4151
4 changed files with 13 additions and 4 deletions

View File

@@ -2886,12 +2886,12 @@ void ScXMLExport::WriteTable(sal_Int32 nTable, const Reference<sheet::XSpreadshe
if (pProtect && pProtect->isProtected() && getDefaultVersion() > SvtSaveOptions::ODFVER_012)
{
if (pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS))
AddAttribute(XML_NAMESPACE_TABLE, XML_SELECT_PROTECTED_CELLS, XML_TRUE);
AddAttribute(XML_NAMESPACE_OFFICE_EXT, XML_SELECT_PROTECTED_CELLS, XML_TRUE);
if (pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS))
AddAttribute(XML_NAMESPACE_TABLE, XML_SELECT_UNPROTECTED_CELLS, XML_TRUE);
AddAttribute(XML_NAMESPACE_OFFICE_EXT, XML_SELECT_UNPROTECTED_CELLS, XML_TRUE);
OUString aElemName = GetNamespaceMap().GetQNameByKey(
XML_NAMESPACE_TABLE, GetXMLToken(XML_TABLE_PROTECTION));
XML_NAMESPACE_OFFICE_EXT, GetXMLToken(XML_TABLE_PROTECTION));
SvXMLElementExport aElemProtected(*this, aElemName, true, true);
}

View File

@@ -829,6 +829,7 @@ const SvXMLTokenMap& ScXMLImport::GetTableElemTokenMap()
{ XML_NAMESPACE_TABLE, XML_TABLE_COLUMNS, XML_TOK_TABLE_COLS },
{ XML_NAMESPACE_TABLE, XML_TABLE_COLUMN, XML_TOK_TABLE_COL },
{ XML_NAMESPACE_TABLE, XML_TABLE_PROTECTION, XML_TOK_TABLE_PROTECTION },
{ XML_NAMESPACE_OFFICE_EXT, XML_TABLE_PROTECTION, XML_TOK_TABLE_PROTECTION_EXT },
{ XML_NAMESPACE_TABLE, XML_TABLE_ROW_GROUP, XML_TOK_TABLE_ROW_GROUP },
{ XML_NAMESPACE_TABLE, XML_TABLE_HEADER_ROWS, XML_TOK_TABLE_HEADER_ROWS },
{ XML_NAMESPACE_TABLE, XML_TABLE_ROWS, XML_TOK_TABLE_ROWS },
@@ -857,6 +858,8 @@ const SvXMLTokenMap& ScXMLImport::GetTableProtectionAttrTokenMap()
{
{ XML_NAMESPACE_TABLE, XML_SELECT_PROTECTED_CELLS, XML_TOK_TABLE_SELECT_PROTECTED_CELLS },
{ XML_NAMESPACE_TABLE, XML_SELECT_UNPROTECTED_CELLS, XML_TOK_TABLE_SELECT_UNPROTECTED_CELLS },
{ XML_NAMESPACE_OFFICE_EXT, XML_SELECT_PROTECTED_CELLS, XML_TOK_TABLE_SELECT_PROTECTED_CELLS_EXT },
{ XML_NAMESPACE_OFFICE_EXT, XML_SELECT_UNPROTECTED_CELLS, XML_TOK_TABLE_SELECT_UNPROTECTED_CELLS_EXT },
XML_TOKEN_MAP_END
};
pTableProtectionElemTokenMap = new SvXMLTokenMap(aTableProtectionTokenMap);

View File

@@ -247,6 +247,7 @@ enum ScXMLTableTokens
XML_TOK_TABLE_ROW_GROUP,
XML_TOK_TABLE_HEADER_ROWS,
XML_TOK_TABLE_PROTECTION,
XML_TOK_TABLE_PROTECTION_EXT,
XML_TOK_TABLE_ROWS,
XML_TOK_TABLE_ROW,
XML_TOK_TABLE_SOURCE,
@@ -261,7 +262,9 @@ enum ScXMLTableTokens
enum ScXMLTokenProtectionTokens
{
XML_TOK_TABLE_SELECT_PROTECTED_CELLS,
XML_TOK_TABLE_SELECT_UNPROTECTED_CELLS
XML_TOK_TABLE_SELECT_UNPROTECTED_CELLS,
XML_TOK_TABLE_SELECT_PROTECTED_CELLS_EXT,
XML_TOK_TABLE_SELECT_UNPROTECTED_CELLS_EXT
};
enum ScXMLTableRowsTokens

View File

@@ -286,6 +286,7 @@ SvXMLImportContext *ScXMLTableContext::CreateChildContext( sal_uInt16 nPrefix,
rLName, xAttrList );
break;
case XML_TOK_TABLE_PROTECTION:
case XML_TOK_TABLE_PROTECTION_EXT:
pContext = new ScXMLTableProtectionContext( GetScImport(), nPrefix, rLName, xAttrList );
break;
case XML_TOK_TABLE_ROW_GROUP:
@@ -454,9 +455,11 @@ ScXMLTableProtectionContext::ScXMLTableProtectionContext(
switch (rAttrTokenMap.Get(nLocalPrefix, aLocalName))
{
case XML_TOK_TABLE_SELECT_PROTECTED_CELLS:
case XML_TOK_TABLE_SELECT_PROTECTED_CELLS_EXT:
bSelectProtectedCells = IsXMLToken(aValue, XML_TRUE);
break;
case XML_TOK_TABLE_SELECT_UNPROTECTED_CELLS:
case XML_TOK_TABLE_SELECT_UNPROTECTED_CELLS_EXT:
bSelectUnprotectedCells = IsXMLToken(aValue, XML_TRUE);
break;
default: