/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * 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 . */ #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(false), bNative(false), bSql(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() { } 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; } 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 ScConsolidateParam: ScConsolidateParam::ScConsolidateParam() : ppDataAreas( NULL ) { Clear(); } //------------------------------------------------------------------------ ScConsolidateParam::ScConsolidateParam( const ScConsolidateParam& r ) : nCol(r.nCol),nRow(r.nRow),nTab(r.nTab), eFunction(r.eFunction),nDataAreaCount(0), ppDataAreas( NULL ), bByCol(r.bByCol),bByRow(r.bByRow),bReferenceData(r.bReferenceData) { if ( r.nDataAreaCount > 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; } OUString ScGlobal::GetDocTabName( const OUString& rFileName, const OUString& rTabName ) { OUString aDocTab('\''); aDocTab += rFileName; sal_Int32 nPos = 1; while( (nPos = aDocTab.indexOf( '\'', nPos )) != -1 ) { // escape Quotes aDocTab = aDocTab.replaceAt( nPos, 0, "\\" ); nPos += 2; } aDocTab += "'"; aDocTab += OUString(SC_COMPILER_FILE_TAB_SEP); aDocTab += rTabName; // "'Doc'#Tab" return aDocTab; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */