diff options
author | RĂ¼diger Timm <rt@openoffice.org> | 2008-12-12 09:38:47 +0000 |
---|---|---|
committer | RĂ¼diger Timm <rt@openoffice.org> | 2008-12-12 09:38:47 +0000 |
commit | 47b1cc26c2697d81b44be5fb53598321cbc5d827 (patch) | |
tree | 38848d46028498de77cf271535fffac1954ad237 /sc/source/filter/xml/xmlcelli.cxx | |
parent | a190965485508c4493ee33228dae68e12cd858f9 (diff) |
CWS-TOOLING: integrate CWS mooxlsc
2008-12-12 09:32:19 +0100 dr r265390 : #i10000# warning
2008-12-11 14:54:26 +0100 dr r265301 : add strings from dr66 to meet ui freeze
2008-12-11 14:53:20 +0100 dr r265300 : add strings from dr66 to meet ui freeze
2008-12-08 14:43:25 +0100 er r264997 : DBG_... need semicolon
2008-12-04 19:16:50 +0100 er r264872 : DBG_... needs semicolon
2008-12-04 11:09:27 +0100 er r264824 : DBG_ERROR needs semicolon
2008-12-03 13:29:46 +0100 er r264770 : CWS-TOOLING: rebase CWS mooxlsc to trunk@264325 (milestone: DEV300:m36)
2008-12-02 16:49:09 +0100 er r264722 : disable code for named references #i4385# import as long as #i3740# isn't fully implemented
2008-12-02 16:45:04 +0100 er r264721 : some compilers attempt to be too smart; persuade them it's really meant what was written
2008-12-02 16:04:56 +0100 er r264715 : #i3740# no storage in ODF for external name references
2008-11-29 02:20:50 +0100 er r264575 : some huge performance improvement when reading repeated empty rows for the external references cache from ODF, as they often occur in the sparse matrix
2008-11-29 01:14:55 +0100 er r264574 : WriteExternalRefCaches: for table:number-columns-repeated write used columns instead of MAXCOLCOUNT
2008-11-28 18:30:04 +0100 er r264570 : #i3740# write/read external name references as bracketed references, as proposed on the ODFF list
2008-11-27 20:36:54 +0100 er r264521 : merge i95068 from cws calc46 for code correctness
2008-11-21 20:39:34 +0100 kohei r264174 : fixed a crash when importing a BIFF8 document with per-sheet external names.
For now, we don't support per-sheet external names. Let's throw in NoName
error until they are supported.
2008-11-21 18:47:27 +0100 kohei r264168 : I forgot to process cached range references in the EXTERNNAME record, which
prevented cached external names with range references from being imported
correctly.
P.S. I swear I thought I had covered this....
2008-11-20 23:07:22 +0100 er r264104 : #i4385# parse external defined names in MOOXML import
2008-11-14 23:18:54 +0100 er r263700 : #i92797# parse external sheet references under aspects of MOOXML import and new ScExternalRefManager
2008-11-14 18:49:48 +0100 er r263696 : remove infinity assertion, leftover from binary file format; coded double error may occur via filter import
2008-11-12 13:29:44 +0100 er r263593 : make references to entire rows/columns, such as A:A or 3:3, actually work in MOOXML import
2008-11-03 12:35:11 +0100 er r263282 : a struct is a struct is a ...
2008-10-31 00:30:59 +0100 er r262843 : aTableRowCellAttrTokenMap needed
2008-10-31 00:26:07 +0100 er r262842 : GetTableRowCellAttrTokenMap() is not unused
2008-10-31 00:13:53 +0100 er r262841 : merge error
2008-10-31 00:05:39 +0100 er r262840 : merge error
2008-10-30 23:17:48 +0100 er r262839 : unresolved merge conflict!?!
2008-10-30 22:59:11 +0100 er r262838 : merge error
2008-10-30 16:31:04 +0100 hr r262833 : CWS-TOOLING: rebase CWS mooxlsc to trunk@262620 (milestone: DEV300:m34)
2008-10-16 21:57:51 +0200 er r262272 : migrate CWS mooxlsc to SVN
Diffstat (limited to 'sc/source/filter/xml/xmlcelli.cxx')
-rw-r--r-- | sc/source/filter/xml/xmlcelli.cxx | 284 |
1 files changed, 102 insertions, 182 deletions
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index d6e88aaed484..7b44a57a926c 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: xmlcelli.cxx,v $ - * $Revision: 1.96.166.1 $ + * $Revision: 1.96.134.1 $ * * This file is part of OpenOffice.org. * @@ -146,184 +146,130 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport, rtl::OUString aLocalName; rtl::OUString* pStyleName = NULL; rtl::OUString* pCurrencySymbol = NULL; - for( sal_Int16 i=0; i < nAttrCount; ++i ) + const SvXMLTokenMap& rTokenMap = rImport.GetTableRowCellAttrTokenMap(); + for (sal_Int16 i = 0; i < nAttrCount; ++i) { - sal_uInt16 nPrefix = rXMLImport.GetNamespaceMap().GetKeyByAttrName( - xAttrList->getNameByIndex( i ), &aLocalName ); - const rtl::OUString& sValue(xAttrList->getValueByIndex( i )); + sal_uInt16 nAttrPrefix = rImport.GetNamespaceMap().GetKeyByAttrName( + xAttrList->getNameByIndex(i), &aLocalName); - if (nPrefix == XML_NAMESPACE_TABLE) + const rtl::OUString& sValue = xAttrList->getValueByIndex(i); + sal_uInt16 nToken = rTokenMap.Get(nAttrPrefix, aLocalName); + switch (nToken) { - sal_uInt32 nLength(aLocalName.getLength()); - - switch (nLength) + case XML_TOK_TABLE_ROW_CELL_ATTR_STYLE_NAME: + pStyleName = new rtl::OUString(sValue); + break; + case XML_TOK_TABLE_ROW_CELL_ATTR_CONTENT_VALIDATION_NAME: + DBG_ASSERT(!pContentValidationName, "here should be only one Validation Name"); + pContentValidationName = new rtl::OUString(sValue); + break; + case XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_ROWS: + bIsMerged = sal_True; + nMergedRows = sValue.toInt32(); + break; + case XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_COLS: + bIsMerged = sal_True; + nMergedCols = sValue.toInt32(); + break; + case XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_MATRIX_COLS: + bIsMatrix = sal_True; + nMatrixCols = sValue.toInt32(); + break; + case XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_MATRIX_ROWS: + bIsMatrix = sal_True; + nMatrixRows = sValue.toInt32(); + break; + case XML_TOK_TABLE_ROW_CELL_ATTR_REPEATED: + nCellsRepeated = std::max( sValue.toInt32(), (sal_Int32) 1 ); + break; + case XML_TOK_TABLE_ROW_CELL_ATTR_VALUE_TYPE: + nCellType = GetScImport().GetCellType(sValue); + bIsEmpty = sal_False; + break; + case XML_TOK_TABLE_ROW_CELL_ATTR_VALUE: { - case 7 : + if (sValue.getLength()) { - if (IsXMLToken(aLocalName, XML_FORMULA)) - { - if (sValue.getLength()) - { - DBG_ASSERT(!pOUFormula, "here should be only one formula"); - DELETEZ( pOUFormula); - rtl::OUString sFormula; - sal_uInt16 nFormulaPrefix = GetImport().GetNamespaceMap(). - _GetKeyByAttrName( sValue, &sFormula, sal_False ); - - if (ScXMLImport::IsAcceptedFormulaNamespace( - nFormulaPrefix, sValue, eGrammar, - eStorageGrammar)) - { - // Namespaces we accept. - pOUFormula = new rtl::OUString( sFormula); - } - else - { - // No namespace => entire string. - // Also unknown namespace included in formula, - // so hopefully will result in string or - // compile error. - pOUFormula = new rtl::OUString( sValue); - } - } - } - } - break; - case 10 : - { - if (IsXMLToken(aLocalName, XML_STYLE_NAME)) - pStyleName = new rtl::OUString(sValue); - } - break; - case 19 : - { - if (IsXMLToken(aLocalName, XML_NUMBER_ROWS_SPANNED)) - { - bIsMerged = sal_True; - nMergedRows = sValue.toInt32(); - } - } - break; - case 22 : - { - if (IsXMLToken(aLocalName, XML_NUMBER_COLUMNS_SPANNED)) - { - bIsMerged = sal_True; - nMergedCols = sValue.toInt32(); - } - } - break; - case 23 : - { - if (IsXMLToken(aLocalName, XML_NUMBER_COLUMNS_REPEATED)) - nCellsRepeated = std::max( sValue.toInt32(), (sal_Int32) 1 ); - else if (IsXMLToken(aLocalName, XML_CONTENT_VALIDATION_NAME)) - { - DBG_ASSERT(!pContentValidationName, "here should be only one Validation Name"); - pContentValidationName = new rtl::OUString(sValue); - } - } - break; - case 26 : - { - if (IsXMLToken(aLocalName, XML_NUMBER_MATRIX_ROWS_SPANNED)) - { - bIsMatrix = sal_True; - nMatrixRows = sValue.toInt32(); - } + rXMLImport.GetMM100UnitConverter().convertDouble(fValue, sValue); + bIsEmpty = sal_False; } - break; - case 29 : + } + break; + case XML_TOK_TABLE_ROW_CELL_ATTR_DATE_VALUE: + { + if (sValue.getLength() && rXMLImport.SetNullDateOnUnitConverter()) { - if (IsXMLToken(aLocalName, XML_NUMBER_MATRIX_COLUMNS_SPANNED)) - { - bIsMatrix = sal_True; - nMatrixCols = sValue.toInt32(); - } + rXMLImport.GetMM100UnitConverter().convertDateTime(fValue, sValue); + bIsEmpty = sal_False; } - break; } - } - else if (nPrefix == XML_NAMESPACE_OFFICE) - { - sal_uInt32 nLength(aLocalName.getLength()); - - switch (nLength) + break; + case XML_TOK_TABLE_ROW_CELL_ATTR_TIME_VALUE: { - case 5 : + if (sValue.getLength()) { - if (IsXMLToken(aLocalName, XML_VALUE)) - { - if (sValue.getLength()) - { - rXMLImport.GetMM100UnitConverter().convertDouble(fValue, sValue); - bIsEmpty = sal_False; - } - } + rXMLImport.GetMM100UnitConverter().convertTime(fValue, sValue); + bIsEmpty = sal_False; } - break; - case 8 : + } + break; + case XML_TOK_TABLE_ROW_CELL_ATTR_STRING_VALUE: + { + if (sValue.getLength()) { - if (IsXMLToken(aLocalName, XML_CURRENCY)) - pCurrencySymbol = new rtl::OUString(sValue); + DBG_ASSERT(!pOUTextValue, "here should be only one string value"); + pOUTextValue = new rtl::OUString(sValue); + bIsEmpty = sal_False; } - break; - case 10 : + } + break; + case XML_TOK_TABLE_ROW_CELL_ATTR_BOOLEAN_VALUE: + { + if (sValue.getLength()) { - if (IsXMLToken(aLocalName, XML_VALUE_TYPE)) - { - nCellType = GetCellType(sValue); - bIsEmpty = sal_False; - } - else if (IsXMLToken(aLocalName, XML_DATE_VALUE)) - { - if (sValue.getLength() && rXMLImport.SetNullDateOnUnitConverter()) - { - rXMLImport.GetMM100UnitConverter().convertDateTime(fValue, sValue); - bIsEmpty = sal_False; - } - } - else if (IsXMLToken(aLocalName, XML_TIME_VALUE)) - { - if (sValue.getLength()) - { - rXMLImport.GetMM100UnitConverter().convertTime(fValue, sValue); - bIsEmpty = sal_False; - } - } + if ( IsXMLToken(sValue, XML_TRUE) ) + fValue = 1.0; + else if ( IsXMLToken(sValue, XML_FALSE) ) + fValue = 0.0; + else + rXMLImport.GetMM100UnitConverter().convertDouble(fValue, sValue); + bIsEmpty = sal_False; } - break; - case 12 : + } + break; + case XML_TOK_TABLE_ROW_CELL_ATTR_FORMULA: + { + if (sValue.getLength()) { - if (IsXMLToken(aLocalName, XML_STRING_VALUE)) + DBG_ASSERT(!pOUFormula, "here should be only one formula"); + DELETEZ( pOUFormula); + rtl::OUString sFormula; + sal_uInt16 nFormulaPrefix = GetImport().GetNamespaceMap(). + _GetKeyByAttrName( sValue, &sFormula, sal_False ); + + if (ScXMLImport::IsAcceptedFormulaNamespace( + nFormulaPrefix, sValue, eGrammar, + eStorageGrammar)) { - if (sValue.getLength()) - { - DBG_ASSERT(!pOUTextValue, "here should be only one string value"); - pOUTextValue = new rtl::OUString(sValue); - bIsEmpty = sal_False; - } + // Namespaces we accept. + pOUFormula = new rtl::OUString( sFormula); } - } - break; - case 13 : - { - if (IsXMLToken(aLocalName, XML_BOOLEAN_VALUE)) + else { - if (sValue.getLength()) - { - if ( IsXMLToken(sValue, XML_TRUE) ) - fValue = 1.0; - else if ( IsXMLToken(sValue, XML_FALSE) ) - fValue = 0.0; - else - rXMLImport.GetMM100UnitConverter().convertDouble(fValue, sValue); - bIsEmpty = sal_False; - } + // No namespace => entire string. + // Also unknown namespace included in formula, + // so hopefully will result in string or + // compile error. + pOUFormula = new rtl::OUString( sValue); } } - break; } + break; + case XML_TOK_TABLE_ROW_CELL_ATTR_CURRENCY: + pCurrencySymbol = new rtl::OUString(sValue); + break; + default: + ; } } if (pOUFormula) @@ -335,32 +281,6 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport, rXMLImport.GetStylesImportHelper()->SetAttributes(pStyleName, pCurrencySymbol, nCellType); } -sal_Int16 ScXMLTableRowCellContext::GetCellType(const rtl::OUString& sOUValue) const -{ - if (IsXMLToken(sOUValue, XML_FLOAT)) - return util::NumberFormat::NUMBER; - else - if (IsXMLToken(sOUValue, XML_STRING)) - return util::NumberFormat::TEXT; - else - if (IsXMLToken(sOUValue, XML_TIME)) - return util::NumberFormat::TIME; - else - if (IsXMLToken(sOUValue, XML_DATE)) - return util::NumberFormat::DATETIME; - else - if (IsXMLToken(sOUValue, XML_PERCENTAGE)) - return util::NumberFormat::PERCENT; - else - if (IsXMLToken(sOUValue, XML_CURRENCY)) - return util::NumberFormat::CURRENCY; - else - if (IsXMLToken(sOUValue, XML_BOOLEAN)) - return util::NumberFormat::LOGICAL; - else - return util::NumberFormat::UNDEFINED; -} - ScXMLTableRowCellContext::~ScXMLTableRowCellContext() { if (pOUTextValue) |