/************************************************************** * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * *************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" // INCLUDE --------------------------------------------------------------- #include #include #include #include #include #include #include #include #include #include #include "global.hxx" #include "rangeutl.hxx" #include "rechead.hxx" #include "compiler.hxx" #include "paramisc.hxx" #include "sc.hrc" #include "globstr.hrc" using ::std::vector; // ----------------------------------------------------------------------- //------------------------------------------------------------------------ // struct ScImportParam: ScImportParam::ScImportParam() : nCol1(0), nRow1(0), nCol2(0), nRow2(0), bImport(sal_False), bNative(sal_False), bSql(sal_True), nType(ScDbTable) { } ScImportParam::ScImportParam( const ScImportParam& r ) : nCol1 (r.nCol1), nRow1 (r.nRow1), nCol2 (r.nCol2), nRow2 (r.nRow2), bImport (r.bImport), aDBName (r.aDBName), aStatement (r.aStatement), bNative (r.bNative), bSql (r.bSql), nType (r.nType) { } ScImportParam::~ScImportParam() { } //UNUSED2009-05 void ScImportParam::Clear() //UNUSED2009-05 { //UNUSED2009-05 nCol1 = nCol2 = 0; //UNUSED2009-05 nRow1 = nRow2 = 0; //UNUSED2009-05 bImport = sal_False; //UNUSED2009-05 bNative = sal_False; //UNUSED2009-05 bSql = sal_True; //UNUSED2009-05 nType = ScDbTable; //UNUSED2009-05 aDBName.Erase(); //UNUSED2009-05 aStatement.Erase(); //UNUSED2009-05 } ScImportParam& ScImportParam::operator=( const ScImportParam& r ) { nCol1 = r.nCol1; nRow1 = r.nRow1; nCol2 = r.nCol2; nRow2 = r.nRow2; bImport = r.bImport; aDBName = r.aDBName; aStatement = r.aStatement; bNative = r.bNative; bSql = r.bSql; nType = r.nType; return *this; } sal_Bool ScImportParam::operator==( const ScImportParam& rOther ) const { return( nCol1 == rOther.nCol1 && nRow1 == rOther.nRow1 && nCol2 == rOther.nCol2 && nRow2 == rOther.nRow2 && bImport == rOther.bImport && aDBName == rOther.aDBName && aStatement == rOther.aStatement && bNative == rOther.bNative && bSql == rOther.bSql && nType == rOther.nType ); //! nQuerySh und pConnection sind gleich ? } //------------------------------------------------------------------------ // struct ScQueryParam: ScQueryEntry::ScQueryEntry() : bDoQuery(sal_False), bQueryByString(sal_False), bQueryByDate(false), nField(0), eOp(SC_EQUAL), eConnect(SC_AND), pStr(new String), nVal(0.0), pSearchParam(NULL), pSearchText(NULL) { } ScQueryEntry::ScQueryEntry(const ScQueryEntry& r) : bDoQuery(r.bDoQuery), bQueryByString(r.bQueryByString), bQueryByDate(r.bQueryByDate), nField(r.nField), eOp(r.eOp), eConnect(r.eConnect), pStr(new String(*r.pStr)), nVal(r.nVal), pSearchParam(NULL), pSearchText(NULL) { } ScQueryEntry::~ScQueryEntry() { delete pStr; if ( pSearchParam ) { delete pSearchParam; delete pSearchText; } } ScQueryEntry& ScQueryEntry::operator=( const ScQueryEntry& r ) { bDoQuery = r.bDoQuery; bQueryByString = r.bQueryByString; bQueryByDate = r.bQueryByDate; eOp = r.eOp; eConnect = r.eConnect; nField = r.nField; nVal = r.nVal; *pStr = *r.pStr; if ( pSearchParam ) { delete pSearchParam; delete pSearchText; } pSearchParam = NULL; pSearchText = NULL; return *this; } void ScQueryEntry::Clear() { bDoQuery = sal_False; bQueryByString = sal_False; bQueryByDate = false; eOp = SC_EQUAL; eConnect = SC_AND; nField = 0; nVal = 0.0; pStr->Erase(); if ( pSearchParam ) { delete pSearchParam; delete pSearchText; } pSearchParam = NULL; pSearchText = NULL; } sal_Bool ScQueryEntry::operator==( const ScQueryEntry& r ) const { return bDoQuery == r.bDoQuery && bQueryByString == r.bQueryByString && bQueryByDate == r.bQueryByDate && eOp == r.eOp && eConnect == r.eConnect && nField == r.nField && nVal == r.nVal && *pStr == *r.pStr; //! pSearchParam und pSearchText nicht vergleichen } utl::TextSearch* ScQueryEntry::GetSearchTextPtr( sal_Bool bCaseSens ) { if ( !pSearchParam ) { pSearchParam = new utl::SearchParam( *pStr, utl::SearchParam::SRCH_REGEXP, bCaseSens, sal_False, sal_False ); pSearchText = new utl::TextSearch( *pSearchParam, *ScGlobal::pCharClass ); } return pSearchText; } //------------------------------------------------------------------------ // struct ScSubTotalParam: ScSubTotalParam::ScSubTotalParam() { for ( sal_uInt16 i=0; i 0) && r.pSubTotals[i] && r.pFunctions[i] ) { nSubTotals[i] = r.nSubTotals[i]; pSubTotals[i] = new SCCOL [r.nSubTotals[i]]; pFunctions[i] = new ScSubTotalFunc [r.nSubTotals[i]]; for (SCCOL j=0; j 0) && pSubTotals[i] && pFunctions[i] ) { for ( SCCOL j=0; j 0 ) { pSubTotals[i] = new SCCOL [r.nSubTotals[i]]; pFunctions[i] = new ScSubTotalFunc [r.nSubTotals[i]]; for (SCCOL j=0; j 0) ) { bEqual = (pSubTotals != NULL) && (pFunctions != NULL); for (SCCOL j=0; (j MAXSUBTOTAL!" ); DBG_ASSERT( ptrSubTotals, "ScSubTotalParam::SetSubTotals(): ptrSubTotals == NULL!" ); DBG_ASSERT( ptrFunctions, "ScSubTotalParam::SetSubTotals(): ptrFunctions == NULL!" ); DBG_ASSERT( (nCount > 0), "ScSubTotalParam::SetSubTotals(): nCount <= 0!" ); if ( ptrSubTotals && ptrFunctions && (nCount > 0) && (nGroup <= MAXSUBTOTAL) ) { // 0 wird als 1 aufgefasst, sonst zum Array-Index dekrementieren if (nGroup != 0) nGroup--; delete [] pSubTotals[nGroup]; delete [] pFunctions[nGroup]; pSubTotals[nGroup] = new SCCOL [nCount]; pFunctions[nGroup] = new ScSubTotalFunc [nCount]; nSubTotals[nGroup] = static_cast(nCount); for ( sal_uInt16 i=0; i 0 ) { nDataAreaCount = r.nDataAreaCount; ppDataAreas = new ScArea*[nDataAreaCount]; for ( sal_uInt16 i=0; i 0) ) for ( sal_uInt16 i=0; i 0 ) { ppDataAreas = new ScArea*[nCount]; for ( sal_uInt16 i=0; iHasName() ) { // maybe relative to document path working directory INetURLObject aObj; SvtPathOptions aPathOpt; aObj.SetSmartURL( aPathOpt.GetWorkPath() ); aObj.setFinalSlash(); // it IS a path bool bWasAbs = true; aAbsName = aObj.smartRel2Abs( rFileName, bWasAbs ).GetMainURL(INetURLObject::NO_DECODE); // returned string must be encoded because it's used directly to create SfxMedium } else { const SfxMedium* pMedium = pShell->GetMedium(); if ( pMedium ) { bool bWasAbs = true; aAbsName = pMedium->GetURLObject().smartRel2Abs( rFileName, bWasAbs ).GetMainURL(INetURLObject::NO_DECODE); } else { // This can't happen, but ... // just to be sure to have the same encoding INetURLObject aObj; aObj.SetSmartURL( aAbsName ); aAbsName = aObj.GetMainURL(INetURLObject::NO_DECODE); } } return aAbsName; } String ScGlobal::GetDocTabName( const String& rFileName, const String& rTabName ) { String aDocTab( '\'' ); aDocTab += rFileName; xub_StrLen nPos = 1; while( (nPos = aDocTab.Search( '\'', nPos )) != STRING_NOTFOUND ) { // escape Quotes aDocTab.Insert( '\\', nPos ); nPos += 2; } aDocTab += '\''; aDocTab += SC_COMPILER_FILE_TAB_SEP; aDocTab += rTabName; // "'Doc'#Tab" return aDocTab; }