diff options
author | Kohei Yoshida <kohei.yoshida@suse.com> | 2011-11-17 12:26:54 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2011-11-18 14:13:21 -0500 |
commit | ff6da5057d4b66c4bdd4bdcf402382e4faf991a4 (patch) | |
tree | 6b94b68df7d26e2707acdfbfa6d3f5754b394070 | |
parent | 1e39e93af99e509245fb7e10a1b20c8e4f1aa46b (diff) |
Started working on de-UNO-izing the filter import.
The idea is to keep a local ScQueryParam, have the XML parser fill it
as it parses, then commit that to the DB data. Currently, the parser
stores it as UNO filter data, then we convert it to ScQueryParam at the
end. Not very efficient.
-rw-r--r-- | sc/source/filter/xml/xmldrani.cxx | 39 | ||||
-rw-r--r-- | sc/source/filter/xml/xmldrani.hxx | 5 |
2 files changed, 25 insertions, 19 deletions
diff --git a/sc/source/filter/xml/xmldrani.cxx b/sc/source/filter/xml/xmldrani.cxx index a9759e59664a..e7cb55126ca2 100644 --- a/sc/source/filter/xml/xmldrani.cxx +++ b/sc/source/filter/xml/xmldrani.cxx @@ -129,6 +129,7 @@ ScXMLDatabaseRangeContext::ScXMLDatabaseRangeContext( ScXMLImport& rImport, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList>& xAttrList) : SvXMLImportContext( rImport, nPrfx, rLName ), + mpQueryParam(new ScQueryParam), sDatabaseRangeName(RTL_CONSTASCII_USTRINGPARAM(STR_DB_LOCAL_NONAME)), aSortSequence(), eOrientation(table::TableOrientation_ROWS), @@ -141,7 +142,6 @@ ScXMLDatabaseRangeContext::ScXMLDatabaseRangeContext( ScXMLImport& rImport, bKeepFormats(false), bMoveCells(false), bStripData(false), - bContainsHeader(true), bAutoFilter(false), bSubTotalsBindFormatsToContent(false), bSubTotalsIsCaseSensitive(false), @@ -202,7 +202,7 @@ ScXMLDatabaseRangeContext::ScXMLDatabaseRangeContext( ScXMLImport& rImport, break; case XML_TOK_DATABASE_RANGE_ATTR_CONTAINS_HEADER : { - bContainsHeader = IsXMLToken(sValue, XML_TRUE); + mpQueryParam->bHasHeader = IsXMLToken(sValue, XML_TRUE); } break; case XML_TOK_DATABASE_RANGE_ATTR_DISPLAY_FILTER_BUTTONS : @@ -343,31 +343,34 @@ ScDBData* ScXMLDatabaseRangeContext::ConvertToDBData(const OUString& rName) } { - ScQueryParam aParam; - pData->GetQueryParam(aParam); - aParam.bByRow = (eOrientation == table::TableOrientation_ROWS); - aParam.bHasHeader = bContainsHeader; - aParam.bInplace = !bFilterCopyOutputData; - aParam.bCaseSens = bFilterIsCaseSensitive; - aParam.bDuplicate = !bFilterSkipDuplicates; - aParam.bRegExp = bFilterUseRegularExpressions; - aParam.nDestTab = aFilterOutputPosition.Sheet; - aParam.nDestCol = aFilterOutputPosition.Column; - aParam.nDestRow = aFilterOutputPosition.Row; - ScFilterDescriptorBase::fillQueryParam(aParam, pDoc, aFilterFields); + mpQueryParam->nTab = aRange.aStart.Tab(); + mpQueryParam->nCol1 = aRange.aStart.Col(); + mpQueryParam->nRow1 = aRange.aStart.Row(); + mpQueryParam->nCol2 = aRange.aEnd.Col(); + mpQueryParam->nRow2 = aRange.aEnd.Row(); + + mpQueryParam->bByRow = (eOrientation == table::TableOrientation_ROWS); + mpQueryParam->bInplace = !bFilterCopyOutputData; + mpQueryParam->bCaseSens = bFilterIsCaseSensitive; + mpQueryParam->bDuplicate = !bFilterSkipDuplicates; + mpQueryParam->bRegExp = bFilterUseRegularExpressions; + mpQueryParam->nDestTab = aFilterOutputPosition.Sheet; + mpQueryParam->nDestCol = aFilterOutputPosition.Column; + mpQueryParam->nDestRow = aFilterOutputPosition.Row; + ScFilterDescriptorBase::fillQueryParam(*mpQueryParam, pDoc, aFilterFields); // Convert from relative to absolute column IDs for the fields. Calc // core expects the field positions to be absolute column IDs. - SCCOLROW nStartPos = aParam.bByRow ? aRange.aStart.Col() : aRange.aStart.Row(); - for (SCSIZE i = 0; i < aParam.GetEntryCount(); ++i) + SCCOLROW nStartPos = mpQueryParam->bByRow ? aRange.aStart.Col() : aRange.aStart.Row(); + for (SCSIZE i = 0; i < mpQueryParam->GetEntryCount(); ++i) { - ScQueryEntry& rEntry = aParam.GetEntry(i); + ScQueryEntry& rEntry = mpQueryParam->GetEntry(i); if (!rEntry.bDoQuery) break; rEntry.nField += nStartPos; } - pData->SetQueryParam(aParam); + pData->SetQueryParam(*mpQueryParam); } if (bFilterConditionSourceRange) diff --git a/sc/source/filter/xml/xmldrani.hxx b/sc/source/filter/xml/xmldrani.hxx index 22cf214c2f08..a2eba21e069e 100644 --- a/sc/source/filter/xml/xmldrani.hxx +++ b/sc/source/filter/xml/xmldrani.hxx @@ -41,7 +41,10 @@ #include "dbdata.hxx" +#include <boost/scoped_ptr.hpp> + class ScDBData; +struct ScQueryParam; class ScXMLImport; class ScXMLDatabaseRangesContext : public SvXMLImportContext @@ -74,6 +77,7 @@ struct ScSubTotalRule class ScXMLDatabaseRangeContext : public SvXMLImportContext { + boost::scoped_ptr<ScQueryParam> mpQueryParam; rtl::OUString sDatabaseRangeName; rtl::OUString sConnectionRessource; rtl::OUString sRangeAddress; @@ -96,7 +100,6 @@ class ScXMLDatabaseRangeContext : public SvXMLImportContext bool bKeepFormats; bool bMoveCells; bool bStripData; - bool bContainsHeader; bool bAutoFilter; bool bSubTotalsBindFormatsToContent; bool bSubTotalsIsCaseSensitive; |