22#include <document.hxx>
30#include <osl/diagnose.h>
38using ::std::unique_ptr;
43void lcl_uppercase(OUString& rStr)
48bool lcl_createStarQuery(
70 pParam->
Resize(nNewEntries);
82 lcl_uppercase(aCellStr);
83 if ( aCellStr ==
ScResId(STR_TABLE_AND) )
88 else if ( aCellStr ==
ScResId(STR_TABLE_OR) )
95 if ((nIndex < 1) || bValid)
112 aCellStr = pQueryRef->
getString(2, nRow);
113 lcl_uppercase(aCellStr);
119 else if (p[1] ==
'=')
124 else if (p[0] ==
'>')
131 else if (p[0] ==
'=')
146 while (bValid && (nRow < nRows) );
150bool lcl_createExcelQuery(
157 vector<SCCOL> aFields(nCols);
159 while (bValid && (nCol < nCols))
161 OUString aQueryStr = pQueryRef->
getString(nCol, 0);
164 aFields[nCol] = nField;
177 OSL_FAIL(
"too many filter criteria");
181 SCSIZE nNewEntries = nVisible;
182 pParam->
Resize( nNewEntries );
192 aCellStr = pQueryRef->
getString(nCol, nRow);
194 if (!aCellStr.isEmpty())
196 if (nIndex < nNewEntries)
201 if (nIndex < nNewEntries)
210 if (nIndex < nNewEntries)
217bool lcl_fillQueryEntries(
226 bool bValid = lcl_createStarQuery(pDoc, rPool, pParam, pDBRef, pQueryRef);
229 bValid = lcl_createExcelQuery(pDoc, rPool, pParam, pDBRef, pQueryRef);
263 return lcl_fillQueryEntries(
getDoc(),
getDoc()->GetSharedStringPool(), pParam, pDBRef,
this);
302 return (nRows-1)*nCols;
327 return nIndex + nDBCol1 - 1;
334 OUString aUpper = rStr;
335 lcl_uppercase(aUpper);
345 ScAddress aLook( nDBCol1, nDBRow1, nDBTab1 );
346 while (!bFound && (aLook.
Col() <= nDBCol2))
351 lcl_uppercase(aCellStr);
358 return bFound ? nField : -1;
368 pParam->nCol1 = s.
Col();
369 pParam->nRow1 = s.
Row();
370 pParam->nCol2 = e.
Col();
371 pParam->nRow2 = e.
Row();
372 pParam->nTab = s.
Tab();
380 return std::unique_ptr<ScDBQueryParamBase>(std::move(pParam));
418 return (nRows-1)*nCols;
426 return mpMatrix->GetString(nCol, nRow).getString();
442 *pErr = FormulaError::NONE;
444 OUString aUpper = rStr;
445 lcl_uppercase(aUpper);
448 OUString aUpperVal =
mpMatrix->GetString(
i, 0).getString();
449 lcl_uppercase(aUpperVal);
450 if (aUpper == aUpperVal)
466 return std::unique_ptr<ScDBQueryParamBase>(std::move(pParam));
size_t SCSIZE
size_t typedef to be able to find places where code was changed from USHORT to size_t and is used to ...
OUString uppercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
void IncCol(SCCOL nDelta=1)
virtual SCCOL findFieldColumn(SCCOL nIndex) const override
Get a 0-based column index that corresponds with the passed field index.
virtual SCSIZE getVisibleDataCellCount() const override
virtual SCCOL getColSize() const override
virtual std::unique_ptr< ScDBQueryParamBase > createQueryParam(const ScDBRangeBase *pQueryRef) const override
const ScMatrixRef mpMatrix
ScDBExternalRange(ScDocument *pDoc, ScMatrixRef pMat)
virtual bool isRangeEqual(const ScRange &rRange) const override
virtual OUString getString(SCCOL nCol, SCROW nRow) const override
Get a string value of a specified cell position.
virtual SCCOL getFirstFieldColumn() const override
virtual SCROW getRowSize() const override
virtual ~ScDBExternalRange() override
const ScRange & getRange() const
virtual SCCOL findFieldColumn(SCCOL nIndex) const override
Get a 0-based column index that corresponds with the passed field index.
virtual SCROW getRowSize() const override
virtual SCSIZE getVisibleDataCellCount() const override
virtual SCCOL getFirstFieldColumn() const override
virtual SCCOL getColSize() const override
ScDBInternalRange(ScDocument *pDoc, const ScRange &rRange)
virtual OUString getString(SCCOL nCol, SCROW nRow) const override
Get a string value of a specified cell position.
virtual ~ScDBInternalRange() override
virtual bool isRangeEqual(const ScRange &rRange) const override
virtual std::unique_ptr< ScDBQueryParamBase > createQueryParam(const ScDBRangeBase *pQueryRef) const override
Base class for abstracting range data backends for database functions.
virtual OUString getString(SCCOL nCol, SCROW nRow) const =0
Get a string value of a specified cell position.
static void fillQueryOptions(ScQueryParamBase *pParam)
Populate query options that are always the same for all database queries.
bool fillQueryEntries(ScQueryParamBase *pParam, const ScDBRangeBase *pDBRef) const
virtual ~ScDBRangeBase()=0
virtual SCSIZE getVisibleDataCellCount() const =0
virtual SCCOL findFieldColumn(SCCOL nIndex) const =0
Get a 0-based column index that corresponds with the passed field index.
ScDocument * getDoc() const
virtual SCROW getRowSize() const =0
virtual SCCOL getColSize() const =0
SC_DLLPUBLIC OUString GetInputString(SCCOL nCol, SCROW nRow, SCTAB nTab, bool bForceSystemLocale=false) const
bool ValidCol(SCCOL nCol) const
FormulaError GetStringForFormula(const ScAddress &rPos, OUString &rString)
static SC_DLLPUBLIC ::utl::TransliterationWrapper & GetTransliteration()
static SC_DLLPUBLIC const CharClass & getCharClass()
SharedString intern(const OUString &rStr)
bool isEqual(const OUString &rStr1, const OUString &rStr2) const
OUString ScResId(TranslateId aId)
svl::SharedString maString
Each instance of this struct represents a single filtering criteria.
const Item & GetQueryItem() const
void FillInExcelSyntax(svl::SharedStringPool &rPool, const OUString &aCellStr, SCSIZE nIndex, SvNumberFormatter *pFormatter)
SC_DLLPUBLIC const ScQueryEntry & GetEntry(SCSIZE n) const
utl::SearchParam::SearchType eSearchType
SC_DLLPUBLIC SCSIZE GetEntryCount() const
::boost::intrusive_ptr< ScMatrix > ScMatrixRef