From 789055bc2acb4c71483fd60ea258d158bd5aec10 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 12 Apr 2016 16:39:03 +0200 Subject: clang-tidy performance-unnecessary-copy-initialization probably not much performance benefit, but it sure is good at identifying leftover intermediate variables from previous refactorings. Change-Id: I3ce16fe496ac2733c1cb0a35f74c0fc9193cc657 Reviewed-on: https://gerrit.libreoffice.org/24026 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- sc/source/core/data/document.cxx | 4 +- sc/source/core/data/global2.cxx | 13 +- sc/source/core/tool/addincol.cxx | 6 +- sc/source/core/tool/compiler.cxx | 7 +- sc/source/core/tool/editutil.cxx | 2 +- sc/source/core/tool/queryparam.cxx | 31 +++-- sc/source/core/tool/userlist.cxx | 3 +- sc/source/filter/excel/xehelper.cxx | 16 ++- sc/source/filter/excel/xihelper.cxx | 2 +- sc/source/filter/html/htmlexp.cxx | 9 +- sc/source/filter/xcl97/xcl97rec.cxx | 2 +- sc/source/filter/xml/xmlimprt.cxx | 11 +- sc/source/ui/condformat/condformatmgr.cxx | 2 +- sc/source/ui/docshell/docfunc.cxx | 2 +- sc/source/ui/docshell/docsh.cxx | 6 +- sc/source/ui/docshell/docsh6.cxx | 6 +- sc/source/ui/docshell/docsh8.cxx | 5 +- sc/source/ui/undo/undostyl.cxx | 4 +- sc/source/ui/unoobj/addruno.cxx | 25 ++-- sc/source/ui/unoobj/afmtuno.cxx | 29 ++--- sc/source/ui/unoobj/appluno.cxx | 77 ++++++------ sc/source/ui/unoobj/cellsuno.cxx | 56 ++++----- sc/source/ui/unoobj/dapiuno.cxx | 123 +++++++++---------- sc/source/ui/unoobj/datauno.cxx | 141 ++++++++++------------ sc/source/ui/unoobj/docuno.cxx | 193 ++++++++++++++---------------- sc/source/ui/unoobj/fmtuno.cxx | 52 ++++---- sc/source/ui/unoobj/funcuno.cxx | 2 +- sc/source/ui/unoobj/linkuno.cxx | 72 +++++------ sc/source/ui/unoobj/shapeuno.cxx | 45 ++++--- sc/source/ui/unoobj/srchuno.cxx | 64 +++++----- sc/source/ui/unoobj/styleuno.cxx | 22 ++-- sc/source/ui/unoobj/targuno.cxx | 11 +- sc/source/ui/unoobj/textuno.cxx | 3 +- sc/source/ui/unoobj/tokenuno.cxx | 26 ++-- sc/source/ui/unoobj/viewuno.cxx | 86 +++++++------ sc/source/ui/vba/vbarange.cxx | 11 +- sc/source/ui/view/viewdata.cxx | 5 +- sc/source/ui/view/viewfun2.cxx | 3 +- 38 files changed, 532 insertions(+), 645 deletions(-) (limited to 'sc/source') diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index bf608c3efc27..39c86340391a 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -377,7 +377,7 @@ void ScDocument::CreateValidTabName(OUString& rName) const // Get Custom prefix const ScDefaultsOptions& rOpt = SC_MOD()->GetDefaultsOptions(); - OUString aStrTable = rOpt.GetInitTabPrefix(); + const OUString& aStrTable = rOpt.GetInitTabPrefix(); bool bOk = false; @@ -425,7 +425,7 @@ void ScDocument::CreateValidTabNames(std::vector& aNames, SCTAB nCount // Get Custom prefix const ScDefaultsOptions& rOpt = SC_MOD()->GetDefaultsOptions(); - OUString aStrTable = rOpt.GetInitTabPrefix(); + const OUString& aStrTable = rOpt.GetInitTabPrefix(); OUStringBuffer rName; diff --git a/sc/source/core/data/global2.cxx b/sc/source/core/data/global2.cxx index 5825e39339a0..87a3ae0b049b 100644 --- a/sc/source/core/data/global2.cxx +++ b/sc/source/core/data/global2.cxx @@ -441,18 +441,17 @@ Label_fallback_to_unambiguous: break; } - OUString aStr( rStr); rtl_math_ConversionStatus eStatus; sal_Int32 nParseEnd; // Decimal and group separator 0 => only integer and possibly exponent, // stops at first non-digit non-sign. - fValue = ::rtl::math::stringToDouble( aStr, 0, 0, &eStatus, &nParseEnd); + fValue = ::rtl::math::stringToDouble( rStr, 0, 0, &eStatus, &nParseEnd); sal_Int32 nLen; - if (eStatus == rtl_math_ConversionStatus_Ok && nParseEnd < (nLen = aStr.getLength())) + if (eStatus == rtl_math_ConversionStatus_Ok && nParseEnd < (nLen = rStr.getLength())) { // Not at string end, check for trailing blanks or switch to date or // time parsing or bail out. - const sal_Unicode* const pStart = aStr.getStr(); + const sal_Unicode* const pStart = rStr.getStr(); const sal_Unicode* p = pStart + nParseEnd; const sal_Unicode* const pStop = pStart + nLen; switch (*p++) @@ -472,7 +471,7 @@ Label_fallback_to_unambiguous: const sal_Int32 nLimit[done] = {0,12,31,0,59,59,0}; State eState = (bDate ? month : minute); rCurFmtType = (bDate ? css::util::NumberFormat::DATE : css::util::NumberFormat::TIME); - nUnit[eState-1] = aStr.copy( 0, nParseEnd).toInt32(); + nUnit[eState-1] = rStr.copy( 0, nParseEnd).toInt32(); const sal_Unicode* pLastStart = p; // Ensure there's no preceding sign. Negative dates // currently aren't handled correctly. Also discard @@ -498,7 +497,7 @@ Label_fallback_to_unambiguous: // We had at least one digit. if (eState < done) { - nUnit[eState] = aStr.copy( pLastStart - pStart, p - pLastStart).toInt32(); + nUnit[eState] = rStr.copy( pLastStart - pStart, p - pLastStart).toInt32(); if (nLimit[eState] && nLimit[eState] < nUnit[eState]) rError = nStringNoValueError; } @@ -569,7 +568,7 @@ Label_fallback_to_unambiguous: // Catch the very last unit at end of string. if (p > pLastStart && eState < done) { - nUnit[eState] = aStr.copy( pLastStart - pStart, p - pLastStart).toInt32(); + nUnit[eState] = rStr.copy( pLastStart - pStart, p - pLastStart).toInt32(); if (nLimit[eState] && nLimit[eState] < nUnit[eState]) rError = nStringNoValueError; } diff --git a/sc/source/core/tool/addincol.cxx b/sc/source/core/tool/addincol.cxx index ff9aaaca8f5b..d31542b08f4e 100644 --- a/sc/source/core/tool/addincol.cxx +++ b/sc/source/core/tool/addincol.cxx @@ -582,7 +582,7 @@ void ScUnoAddInCollection::ReadConfiguration() void ScUnoAddInCollection::LoadComponent( const ScUnoAddInFuncData& rFuncData ) { - OUString aFullName = rFuncData.GetOriginalName(); + const OUString& aFullName = rFuncData.GetOriginalName(); sal_Int32 nPos = aFullName.lastIndexOf( (sal_Unicode) '.' ); if ( nPos > 0 ) { @@ -975,7 +975,7 @@ void ScUnoAddInCollection::ReadFromAddIn( const uno::Reference& static void lcl_UpdateFunctionList( ScFunctionList& rFunctionList, const ScUnoAddInFuncData& rFuncData ) { - OUString aCompare = rFuncData.GetUpperLocal(); // as used in FillFunctionDescFromData + const OUString& aCompare = rFuncData.GetUpperLocal(); // as used in FillFunctionDescFromData sal_uLong nCount = rFunctionList.GetCount(); for (sal_uLong nPos=0; nPosGetSingleRef(); - ScAddress aAbs = rRef.toAbs(aPos); + const ScAddress aAbs = rRef.toAbs(aPos); if (!ValidAddress(aAbs)) { SetError( errNoRef ); @@ -4971,7 +4971,6 @@ bool ScCompiler::HandleColRowName() SCCOL nCol = aAbs.Col(); SCROW nRow = aAbs.Row(); SCTAB nTab = aAbs.Tab(); - ScAddress aLook = aAbs; bool bColName = rRef.IsColRel(); SCCOL nMyCol = aPos.Col(); SCROW nMyRow = aPos.Row(); @@ -4983,7 +4982,7 @@ bool ScCompiler::HandleColRowName() for ( size_t i = 0, nPairs = pRL->size(); i < nPairs; ++i ) { ScRangePair* pR = (*pRL)[i]; - if ( pR->GetRange(0).In( aLook ) ) + if ( pR->GetRange(0).In( aAbs ) ) { bInList = bValidName = true; aRange = pR->GetRange(1); @@ -5002,7 +5001,7 @@ bool ScCompiler::HandleColRowName() } if ( !bInList && pDoc->GetDocOptions().IsLookUpColRowNames() ) { // automagically or created by copying and NamePos isn't in list - ScRefCellValue aCell(*pDoc, aLook); + ScRefCellValue aCell(*pDoc, aAbs); bool bString = aCell.hasString(); if (!bString && aCell.isEmpty()) bString = true; // empty cell is ok diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx index 13e50c16e012..4b2836d7871d 100644 --- a/sc/source/core/tool/editutil.cxx +++ b/sc/source/core/tool/editutil.cxx @@ -199,7 +199,7 @@ OUString ScEditUtil::GetCellFieldValue( case text::textfield::Type::URL: { const SvxURLField& rField = static_cast(rFieldData); - OUString aURL = rField.GetURL(); + const OUString& aURL = rField.GetURL(); switch (rField.GetFormat()) { diff --git a/sc/source/core/tool/queryparam.cxx b/sc/source/core/tool/queryparam.cxx index ebc4b550762a..5131a31f7e1f 100644 --- a/sc/source/core/tool/queryparam.cxx +++ b/sc/source/core/tool/queryparam.cxx @@ -178,58 +178,57 @@ void ScQueryParamBase::Resize(size_t nNew) } void ScQueryParamBase::FillInExcelSyntax( - svl::SharedStringPool& rPool, const OUString& rStr, SCSIZE nIndex, SvNumberFormatter* pFormatter ) + svl::SharedStringPool& rPool, const OUString& rCellStr, SCSIZE nIndex, SvNumberFormatter* pFormatter ) { - const OUString aCellStr = rStr; if (nIndex >= m_Entries.size()) Resize(nIndex+1); ScQueryEntry& rEntry = GetEntry(nIndex); ScQueryEntry::Item& rItem = rEntry.GetQueryItem(); - if (aCellStr.isEmpty()) + if (rCellStr.isEmpty()) rItem.maString = svl::SharedString::getEmptyString(); else { rEntry.bDoQuery = true; // Operatoren herausfiltern - if (aCellStr[0] == '<') + if (rCellStr[0] == '<') { - if (aCellStr[1] == '>') + if (rCellStr[1] == '>') { - rItem.maString = rPool.intern(aCellStr.copy(2)); + rItem.maString = rPool.intern(rCellStr.copy(2)); rEntry.eOp = SC_NOT_EQUAL; } - else if (aCellStr[1] == '=') + else if (rCellStr[1] == '=') { - rItem.maString = rPool.intern(aCellStr.copy(2)); + rItem.maString = rPool.intern(rCellStr.copy(2)); rEntry.eOp = SC_LESS_EQUAL; } else { - rItem.maString = rPool.intern(aCellStr.copy(1)); + rItem.maString = rPool.intern(rCellStr.copy(1)); rEntry.eOp = SC_LESS; } } - else if (aCellStr[0]== '>') + else if (rCellStr[0]== '>') { - if (aCellStr[1] == '=') + if (rCellStr[1] == '=') { - rItem.maString = rPool.intern(aCellStr.copy(2)); + rItem.maString = rPool.intern(rCellStr.copy(2)); rEntry.eOp = SC_GREATER_EQUAL; } else { - rItem.maString = rPool.intern(aCellStr.copy(1)); + rItem.maString = rPool.intern(rCellStr.copy(1)); rEntry.eOp = SC_GREATER; } } else { - if (aCellStr[0] == '=') - rItem.maString = rPool.intern(aCellStr.copy(1)); + if (rCellStr[0] == '=') + rItem.maString = rPool.intern(rCellStr.copy(1)); else - rItem.maString = rPool.intern(aCellStr); + rItem.maString = rPool.intern(rCellStr); rEntry.eOp = SC_EQUAL; } } diff --git a/sc/source/core/tool/userlist.cxx b/sc/source/core/tool/userlist.cxx index e84a2db7bd6a..ae9977668e89 100644 --- a/sc/source/core/tool/userlist.cxx +++ b/sc/source/core/tool/userlist.cxx @@ -124,8 +124,7 @@ bool ScUserListData::GetSubIndex(const OUString& rSubStr, sal_uInt16& rIndex, bo } // When that fails, do a case insensitive search. - OUString aTmp = ScGlobal::pCharClass->uppercase(rSubStr); - OUString aUpStr = aTmp; + OUString aUpStr = ScGlobal::pCharClass->uppercase(rSubStr); itr = ::std::find_if( maSubStrings.begin(), maSubStrings.end(), FindByName(aUpStr, true)); if (itr != maSubStrings.end()) diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx index ab0c3b5dfebc..1df1135f7303 100644 --- a/sc/source/filter/excel/xehelper.cxx +++ b/sc/source/filter/excel/xehelper.cxx @@ -365,14 +365,13 @@ XclExpStringRef lclCreateFormattedString( const SfxItemSet& rItemSet = pCellAttr ? pCellAttr->GetItemSet() : rRoot.GetDoc().GetDefPattern()->GetItemSet(); // process all script portions - OUString aOUText( rText ); sal_Int32 nPortionPos = 0; - sal_Int32 nTextLen = aOUText.getLength(); + sal_Int32 nTextLen = rText.getLength(); while( nPortionPos < nTextLen ) { // get script type and end position of next script portion - sal_Int16 nScript = xBreakIt->getScriptType( aOUText, nPortionPos ); - sal_Int32 nPortionEnd = xBreakIt->endOfScript( aOUText, nPortionPos, nScript ); + sal_Int16 nScript = xBreakIt->getScriptType( rText, nPortionPos ); + sal_Int32 nPortionEnd = xBreakIt->endOfScript( rText, nPortionPos, nScript ); // reuse previous script for following weak portions if( nScript == ApiScriptType::WEAK ) @@ -384,7 +383,7 @@ XclExpStringRef lclCreateFormattedString( // Excel start position of this portion sal_Int32 nXclPortionStart = xString->Len(); // add portion text to Excel string - XclExpStringHelper::AppendString( *xString, rRoot, aOUText.copy( nPortionPos, nPortionEnd - nPortionPos ) ); + XclExpStringHelper::AppendString( *xString, rRoot, rText.copy( nPortionPos, nPortionEnd - nPortionPos ) ); if( nXclPortionStart < xString->Len() ) { // insert font into buffer @@ -641,14 +640,13 @@ sal_Int16 XclExpStringHelper::GetLeadingScriptType( const XclExpRoot& rRoot, con { namespace ApiScriptType = ::com::sun::star::i18n::ScriptType; Reference< XBreakIterator > xBreakIt = rRoot.GetDoc().GetBreakIterator(); - OUString aOUString( rString ); sal_Int32 nStrPos = 0; - sal_Int32 nStrLen = aOUString.getLength(); + sal_Int32 nStrLen = rString.getLength(); sal_Int16 nScript = ApiScriptType::WEAK; while( (nStrPos < nStrLen) && (nScript == ApiScriptType::WEAK) ) { - nScript = xBreakIt->getScriptType( aOUString, nStrPos ); - nStrPos = xBreakIt->endOfScript( aOUString, nStrPos, nScript ); + nScript = xBreakIt->getScriptType( rString, nStrPos ); + nStrPos = xBreakIt->endOfScript( rString, nStrPos, nScript ); } return (nScript == ApiScriptType::WEAK) ? rRoot.GetDefApiScript() : nScript; } diff --git a/sc/source/filter/excel/xihelper.cxx b/sc/source/filter/excel/xihelper.cxx index 6b1bc9497ddc..56774dd66342 100644 --- a/sc/source/filter/excel/xihelper.cxx +++ b/sc/source/filter/excel/xihelper.cxx @@ -236,7 +236,7 @@ void XclImpStringHelper::SetToDocument( } else { - OUString aStr = rString.GetText(); + const OUString& aStr = rString.GetText(); if (aStr.indexOf('\n') != -1 || aStr.indexOf(CHAR_CR) != -1) { // Multiline content. diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx index 073d6595356e..108cd63774d7 100644 --- a/sc/source/filter/html/htmlexp.cxx +++ b/sc/source/filter/html/htmlexp.cxx @@ -1191,8 +1191,7 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab ) } else { - OUString aStr = aStrOut; - sal_Int32 nPos = aStr.indexOf( '\n' ); + sal_Int32 nPos = aStrOut.indexOf( '\n' ); if ( nPos == -1 ) { OUT_STR( aStrOut ); @@ -1202,13 +1201,13 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab ) sal_Int32 nStartPos = 0; do { - OUString aSingleLine = aStr.copy( nStartPos, nPos - nStartPos ); + OUString aSingleLine = aStrOut.copy( nStartPos, nPos - nStartPos ); OUT_STR( aSingleLine ); TAG_ON( OOO_STRING_SVTOOLS_HTML_linebreak ); nStartPos = nPos + 1; } - while( ( nPos = aStr.indexOf( '\n', nStartPos ) ) != -1 ); - OUString aSingleLine = aStr.copy( nStartPos, aStr.getLength() - nStartPos ); + while( ( nPos = aStrOut.indexOf( '\n', nStartPos ) ) != -1 ); + OUString aSingleLine = aStrOut.copy( nStartPos, aStrOut.getLength() - nStartPos ); OUT_STR( aSingleLine ); } } diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 88b7d3a19e72..0860a8c16c03 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -797,7 +797,7 @@ XclTxo::XclTxo( const XclExpRoot& rRoot, const EditTextObject& rEditObj, SdrObje OUString aParaText( rEditObj.GetText( 0 ) ); if( !aParaText.isEmpty() ) { - SfxItemSet aSet( rEditObj.GetParaAttribs( 0)); + const SfxItemSet& aSet( rEditObj.GetParaAttribs( 0)); const SfxPoolItem* pItem = nullptr; if( aSet.GetItemState( EE_PARA_JUST, true, &pItem ) == SfxItemState::SET ) { diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index 3cae9c9713af..2701b9c63359 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -2480,8 +2480,7 @@ void ScXMLImport::SetChangeTrackingViewSettings(const css::uno::Sequence>= sOUName) { - OUString sAuthorName(sOUName); - pViewSettings->SetTheAuthorToShow(sAuthorName); + pViewSettings->SetTheAuthorToShow(sOUName); } } else if (sName == "ShowChangesByComment") @@ -2491,8 +2490,7 @@ void ScXMLImport::SetChangeTrackingViewSettings(const css::uno::Sequence>= sOUComment) { - OUString sComment(sOUComment); - pViewSettings->SetTheComment(sComment); + pViewSettings->SetTheComment(sOUComment); } } else if (sName == "ShowChangesByRanges") @@ -3198,10 +3196,9 @@ void SAL_CALL ScXMLImport::endDocument() OUString sName(aSeq[i].Name); if (sName == SC_ACTIVETABLE) { - OUString sValue; - if(aSeq[i].Value >>= sValue) + OUString sTabName; + if(aSeq[i].Value >>= sTabName) { - OUString sTabName(sValue); SCTAB nTab(0); if (pDoc->GetTable(sTabName, nTab)) { diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx index 86a08ac9f85d..69ad5a2d3601 100644 --- a/sc/source/ui/condformat/condformatmgr.cxx +++ b/sc/source/ui/condformat/condformatmgr.cxx @@ -35,7 +35,7 @@ ScCondFormatManagerWindow::ScCondFormatManagerWindow(SvSimpleTableContainer& rPa OUString ScCondFormatManagerWindow::createEntryString(const ScConditionalFormat& rFormat) { - ScRangeList aRange = rFormat.GetRange(); + const ScRangeList& aRange = rFormat.GetRange(); OUString aStr; aRange.Format(aStr, ScRefFlags::VALID, mpDoc, mpDoc->GetAddressConvention()); aStr += "\t"; diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index c69493a20f29..e7918c6efa01 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -467,7 +467,7 @@ bool ScDocFunc::DetectiveRefresh( bool bAutomatic ) for (size_t i=0; i < nCount; ++i) { const ScDetOpData& rData = pList->GetObject(i); - ScAddress aPos = rData.GetPos(); + const ScAddress& aPos = rData.GetPos(); ScDetectiveFunc aFunc( &rDoc, aPos.Tab() ); SCCOL nCol = aPos.Col(); SCROW nRow = aPos.Row(); diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index c86fc9287466..c3bb306c66da 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -639,9 +639,9 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) // (handled by AddInitial) const ScAutoStyleHint& rStlHint = static_cast(rHint); - ScRange aRange = rStlHint.GetRange(); - OUString aName1 = rStlHint.GetStyle1(); - OUString aName2 = rStlHint.GetStyle2(); + const ScRange& aRange = rStlHint.GetRange(); + const OUString& aName1 = rStlHint.GetStyle1(); + const OUString& aName2 = rStlHint.GetStyle2(); sal_uInt32 nTimeout = rStlHint.GetTimeout(); if (!pAutoStyleList) diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx index 729e93173518..9198313c19c4 100644 --- a/sc/source/ui/docshell/docsh6.cxx +++ b/sc/source/ui/docshell/docsh6.cxx @@ -483,9 +483,9 @@ void ScDocShell::CheckConfigOptions() ScModule* pScMod = SC_MOD(); const ScFormulaOptions& rOpt=pScMod->GetFormulaOptions(); - OUString aSepArg = rOpt.GetFormulaSepArg(); - OUString aSepArrRow = rOpt.GetFormulaSepArrayRow(); - OUString aSepArrCol = rOpt.GetFormulaSepArrayCol(); + const OUString& aSepArg = rOpt.GetFormulaSepArg(); + const OUString& aSepArrRow = rOpt.GetFormulaSepArrayRow(); + const OUString& aSepArrCol = rOpt.GetFormulaSepArrayCol(); if (aDecSep == aSepArg || aDecSep == aSepArrRow || aDecSep == aSepArrCol) { diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx index 2ea750ff808d..9b5df568fc8b 100644 --- a/sc/source/ui/docshell/docsh8.cxx +++ b/sc/source/ui/docshell/docsh8.cxx @@ -1101,9 +1101,8 @@ sal_uLong ScDocShell::DBaseExport( const OUString& rFullFileName, rtl_TextEncodi sal_Int32 nLen; if (bIsOctetTextEncoding) { - OUString aOUString( aString); OString aOString; - if (!aOUString.convertToString( &aOString, eCharSet, + if (!aString.convertToString( &aOString, eCharSet, RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)) { @@ -1112,7 +1111,7 @@ sal_uLong ScDocShell::DBaseExport( const OUString& rFullFileName, rtl_TextEncodi } nLen = aOString.getLength(); if (!bTest) - SAL_WARN("sc", "ScDocShell::DBaseExport encoding error, string with default replacements: ``" << aOUString << "''\n"); + SAL_WARN("sc", "ScDocShell::DBaseExport encoding error, string with default replacements: ``" << aString << "''\n"); } else nLen = aString.getLength() * sizeof(sal_Unicode); diff --git a/sc/source/ui/undo/undostyl.cxx b/sc/source/ui/undo/undostyl.cxx index 9dcbfb21f133..9d336faef5c2 100644 --- a/sc/source/ui/undo/undostyl.cxx +++ b/sc/source/ui/undo/undostyl.cxx @@ -121,7 +121,7 @@ void ScUndoModifyStyle::DoChange( ScDocShell* pDocSh, const OUString& rName, { ScDocument& rDoc = pDocSh->GetDocument(); ScStyleSheetPool* pStlPool = rDoc.GetStyleSheetPool(); - OUString aNewName = rData.GetName(); + const OUString& aNewName = rData.GetName(); bool bDelete = aNewName.isEmpty(); // no new name -> delete style bool bNew = ( rName.isEmpty() && !bDelete ); // creating new style @@ -163,7 +163,7 @@ void ScUndoModifyStyle::DoChange( ScDocShell* pDocSh, const OUString& rName, { // modify style - OUString aNewParent = rData.GetParent(); + const OUString& aNewParent = rData.GetParent(); if ( aNewParent != pStyle->GetParent() ) pStyle->SetParent( aNewParent ); diff --git a/sc/source/ui/unoobj/addruno.cxx b/sc/source/ui/unoobj/addruno.cxx index e31d80c3627a..c44ea24353dc 100644 --- a/sc/source/ui/unoobj/addruno.cxx +++ b/sc/source/ui/unoobj/addruno.cxx @@ -139,8 +139,7 @@ void SAL_CALL ScAddressConversionObj::setPropertyValue( const OUString& aPropert throw uno::RuntimeException(); bool bSuccess = false; - OUString aNameStr(aPropertyName); - if ( aNameStr == SC_UNONAME_ADDRESS ) + if ( aPropertyName == SC_UNONAME_ADDRESS ) { // read the cell/range address from API struct if ( bIsRange ) @@ -162,7 +161,7 @@ void SAL_CALL ScAddressConversionObj::setPropertyValue( const OUString& aPropert } } } - else if ( aNameStr == SC_UNONAME_REFSHEET ) + else if ( aPropertyName == SC_UNONAME_REFSHEET ) { // set the reference sheet sal_Int32 nIntVal = 0; @@ -172,19 +171,18 @@ void SAL_CALL ScAddressConversionObj::setPropertyValue( const OUString& aPropert bSuccess = true; } } - else if ( aNameStr == SC_UNONAME_UIREPR ) + else if ( aPropertyName == SC_UNONAME_UIREPR ) { // parse the UI representation string OUString sRepresentation; if (aValue >>= sRepresentation) { - OUString aUIString = sRepresentation; - bSuccess = ParseUIString( aUIString ); + bSuccess = ParseUIString( sRepresentation ); } } - else if ( aNameStr == SC_UNONAME_PERSREPR || aNameStr == SC_UNONAME_XLA1REPR ) + else if ( aPropertyName == SC_UNONAME_PERSREPR || aPropertyName == SC_UNONAME_XLA1REPR ) { - ::formula::FormulaGrammar::AddressConvention eConv = aNameStr == SC_UNONAME_XLA1REPR ? + ::formula::FormulaGrammar::AddressConvention eConv = aPropertyName == SC_UNONAME_XLA1REPR ? ::formula::FormulaGrammar::CONV_XL_A1 : ::formula::FormulaGrammar::CONV_OOO; // parse the file format string @@ -227,8 +225,7 @@ uno::Any SAL_CALL ScAddressConversionObj::getPropertyValue( const OUString& aPro ScDocument& rDoc = pDocShell->GetDocument(); uno::Any aRet; - OUString aNameStr(aPropertyName); - if ( aNameStr == SC_UNONAME_ADDRESS ) + if ( aPropertyName == SC_UNONAME_ADDRESS ) { if ( bIsRange ) { @@ -243,11 +240,11 @@ uno::Any SAL_CALL ScAddressConversionObj::getPropertyValue( const OUString& aPro aRet <<= aCellAddress; } } - else if ( aNameStr == SC_UNONAME_REFSHEET ) + else if ( aPropertyName == SC_UNONAME_REFSHEET ) { aRet <<= nRefSheet; } - else if ( aNameStr == SC_UNONAME_UIREPR ) + else if ( aPropertyName == SC_UNONAME_UIREPR ) { // generate UI representation string - include sheet only if different from ref sheet OUString aFormatStr; @@ -260,9 +257,9 @@ uno::Any SAL_CALL ScAddressConversionObj::getPropertyValue( const OUString& aPro aFormatStr = aRange.aStart.Format(nFlags, &rDoc); aRet <<= aFormatStr; } - else if ( aNameStr == SC_UNONAME_PERSREPR || aNameStr == SC_UNONAME_XLA1REPR ) + else if ( aPropertyName == SC_UNONAME_PERSREPR || aPropertyName == SC_UNONAME_XLA1REPR ) { - ::formula::FormulaGrammar::AddressConvention eConv = aNameStr == SC_UNONAME_XLA1REPR ? + ::formula::FormulaGrammar::AddressConvention eConv = aPropertyName == SC_UNONAME_XLA1REPR ? ::formula::FormulaGrammar::CONV_XL_A1 : ::formula::FormulaGrammar::CONV_OOO; // generate file format string - always include sheet diff --git a/sc/source/ui/unoobj/afmtuno.cxx b/sc/source/ui/unoobj/afmtuno.cxx index 0bd1abeb64b3..8f044626cc51 100644 --- a/sc/source/ui/unoobj/afmtuno.cxx +++ b/sc/source/ui/unoobj/afmtuno.cxx @@ -191,10 +191,9 @@ ScAutoFormatObj* ScAutoFormatsObj::GetObjectByIndex_Impl(sal_uInt16 nIndex) ScAutoFormatObj* ScAutoFormatsObj::GetObjectByName_Impl(const OUString& aName) { - OUString aString(aName); sal_uInt16 nIndex; if (lcl_FindAutoFormatIndex( - *ScGlobal::GetOrCreateAutoFormat(), aString, nIndex )) + *ScGlobal::GetOrCreateAutoFormat(), aName, nIndex )) return GetObjectByIndex_Impl(nIndex); return nullptr; } @@ -215,14 +214,13 @@ void SAL_CALL ScAutoFormatsObj::insertByName( const OUString& aName, const uno:: ScAutoFormatObj* pFormatObj = ScAutoFormatObj::getImplementation( xInterface ); if ( pFormatObj && !pFormatObj->IsInserted() ) // noch nicht eingefuegt? { - OUString aNameStr(aName); ScAutoFormat* pFormats = ScGlobal::GetOrCreateAutoFormat(); sal_uInt16 nDummy; - if (!lcl_FindAutoFormatIndex( *pFormats, aNameStr, nDummy )) + if (!lcl_FindAutoFormatIndex( *pFormats, aName, nDummy )) { ScAutoFormatData* pNew = new ScAutoFormatData(); - pNew->SetName( aNameStr ); + pNew->SetName( aName ); if (pFormats->insert(pNew)) { @@ -230,7 +228,7 @@ void SAL_CALL ScAutoFormatsObj::insertByName( const OUString& aName, const uno:: pFormats->Save(); // sofort speichern sal_uInt16 nNewIndex; - if (lcl_FindAutoFormatIndex( *pFormats, aNameStr, nNewIndex )) + if (lcl_FindAutoFormatIndex( *pFormats, aName, nNewIndex )) { pFormatObj->InitFormat( nNewIndex ); // kann jetzt benutzt werden bDone = true; @@ -359,10 +357,9 @@ sal_Bool SAL_CALL ScAutoFormatsObj::hasByName( const OUString& aName ) throw(uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - OUString aString(aName); sal_uInt16 nDummy; return lcl_FindAutoFormatIndex( - *ScGlobal::GetOrCreateAutoFormat(), aString, nDummy ); + *ScGlobal::GetOrCreateAutoFormat(), aName, nDummy ); } ScAutoFormatObj::ScAutoFormatObj(sal_uInt16 nIndex) : @@ -504,7 +501,6 @@ void SAL_CALL ScAutoFormatObj::setName( const OUString& aNewName ) throw (uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - OUString aNewString(aNewName); ScAutoFormat* pFormats = ScGlobal::GetOrCreateAutoFormat(); sal_uInt16 nDummy; @@ -517,7 +513,7 @@ void SAL_CALL ScAutoFormatObj::setName( const OUString& aNewName ) OSL_ENSURE(pData,"AutoFormat Daten nicht da"); ScAutoFormatData* pNew = new ScAutoFormatData(*pData); - pNew->SetName( aNewString ); + pNew->SetName( aNewName ); pFormats->erase(it); if (pFormats->insert(pNew)) @@ -565,19 +561,18 @@ void SAL_CALL ScAutoFormatObj::setPropertyValue( ScAutoFormatData* pData = pFormats->findByIndex(nFormatIndex); OSL_ENSURE(pData,"AutoFormat Daten nicht da"); - OUString aPropString(aPropertyName); bool bBool; - if (aPropString == SC_UNONAME_INCBACK && (aValue >>= bBool)) + if (aPropertyName == SC_UNONAME_INCBACK && (aValue >>= bBool)) pData->SetIncludeBackground( bBool ); - else if (aPropString == SC_UNONAME_INCBORD && (aValue >>= bBool)) + else if (aPropertyName == SC_UNONAME_INCBORD && (aValue >>= bBool)) pData->SetIncludeFrame( bBool ); - else if (aPropString == SC_UNONAME_INCFONT && (aValue >>= bBool)) + else if (aPropertyName == SC_UNONAME_INCFONT && (aValue >>= bBool)) pData->SetIncludeFont( bBool ); - else if (aPropString == SC_UNONAME_INCJUST && (aValue >>= bBool)) + else if (aPropertyName == SC_UNONAME_INCJUST && (aValue >>= bBool)) pData->SetIncludeJustify( bBool ); - else if (aPropString == SC_UNONAME_INCNUM && (aValue >>= bBool)) + else if (aPropertyName == SC_UNONAME_INCNUM && (aValue >>= bBool)) pData->SetIncludeValueFormat( bBool ); - else if (aPropString == SC_UNONAME_INCWIDTH && (aValue >>= bBool)) + else if (aPropertyName == SC_UNONAME_INCWIDTH && (aValue >>= bBool)) pData->SetIncludeWidthHeight( bBool ); // else Fehler diff --git a/sc/source/ui/unoobj/appluno.cxx b/sc/source/ui/unoobj/appluno.cxx index a5e09ed1a6a3..2c632b58243e 100644 --- a/sc/source/ui/unoobj/appluno.cxx +++ b/sc/source/ui/unoobj/appluno.cxx @@ -233,7 +233,6 @@ void SAL_CALL ScSpreadsheetSettings::setPropertyValue( uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - OUString aString(aPropertyName); ScModule* pScMod = SC_MOD(); ScAppOptions aAppOpt(pScMod->GetAppOptions()); @@ -242,27 +241,27 @@ void SAL_CALL ScSpreadsheetSettings::setPropertyValue( bool bSaveInp = false; // print options aren't loaded until needed - if (aString == SC_UNONAME_DOAUTOCP) + if (aPropertyName == SC_UNONAME_DOAUTOCP) { aAppOpt.SetAutoComplete( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); bSaveApp = true; } - else if (aString == SC_UNONAME_ENTERED) + else if (aPropertyName == SC_UNONAME_ENTERED) { aInpOpt.SetEnterEdit( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); bSaveInp = true; } - else if (aString == SC_UNONAME_EXPREF) + else if (aPropertyName == SC_UNONAME_EXPREF) { aInpOpt.SetExpandRefs( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); bSaveInp = true; } - else if (aString == SC_UNONAME_EXTFMT) + else if (aPropertyName == SC_UNONAME_EXTFMT) { aInpOpt.SetExtendFormat( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); bSaveInp = true; } - else if (aString == SC_UNONAME_LINKUPD) + else if (aPropertyName == SC_UNONAME_LINKUPD) { sal_Int16 n; if (!(aValue >>= n) || n < css::document::LinkUpdateModes::NEVER @@ -279,47 +278,47 @@ void SAL_CALL ScSpreadsheetSettings::setPropertyValue( aAppOpt.SetLinkMode( static_cast(n) ); bSaveApp = true; } - else if (aString == SC_UNONAME_MARKHDR) + else if (aPropertyName == SC_UNONAME_MARKHDR) { aInpOpt.SetMarkHeader( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); bSaveInp = true; } - else if (aString == SC_UNONAME_MOVESEL) + else if (aPropertyName == SC_UNONAME_MOVESEL) { aInpOpt.SetMoveSelection( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); bSaveInp = true; } - else if (aString == SC_UNONAME_RANGEFIN) + else if (aPropertyName == SC_UNONAME_RANGEFIN) { aInpOpt.SetRangeFinder( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); bSaveInp = true; } - else if (aString == SC_UNONAME_USETABCOL) + else if (aPropertyName == SC_UNONAME_USETABCOL) { aInpOpt.SetUseTabCol( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); bSaveInp = true; } - else if (aString == SC_UNONAME_PRMETRICS) + else if (aPropertyName == SC_UNONAME_PRMETRICS) { aInpOpt.SetTextWysiwyg( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); bSaveInp = true; } - else if (aString == SC_UNONAME_REPLWARN) + else if (aPropertyName == SC_UNONAME_REPLWARN) { aInpOpt.SetReplaceCellsWarn( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); bSaveInp = true; } - else if (aString == SC_UNONAME_METRIC) + else if (aPropertyName == SC_UNONAME_METRIC) { aAppOpt.SetAppMetric( (FieldUnit) ScUnoHelpFunctions::GetInt16FromAny( aValue ) ); bSaveApp = true; } - else if (aString == SC_UNONAME_MOVEDIR) + else if (aPropertyName == SC_UNONAME_MOVEDIR) { aInpOpt.SetMoveDir( ScUnoHelpFunctions::GetInt16FromAny( aValue ) ); bSaveInp = true; } - else if (aString == SC_UNONAME_SCALE) + else if (aPropertyName == SC_UNONAME_SCALE) { short nVal = ScUnoHelpFunctions::GetInt16FromAny( aValue ); if ( nVal < 0 ) @@ -340,12 +339,12 @@ void SAL_CALL ScSpreadsheetSettings::setPropertyValue( } bSaveApp = true; } - else if (aString == SC_UNONAME_STBFUNC) + else if (aPropertyName == SC_UNONAME_STBFUNC) { aAppOpt.SetStatusFunc( ScUnoHelpFunctions::GetInt16FromAny( aValue ) ); bSaveApp = true; } - else if (aString == SC_UNONAME_ULISTS) + else if (aPropertyName == SC_UNONAME_ULISTS) { ScUserList* pUserList = ScGlobal::GetUserList(); uno::Sequence aSeq; @@ -366,13 +365,13 @@ void SAL_CALL ScSpreadsheetSettings::setPropertyValue( bSaveApp = true; // Liste wird mit den App-Optionen gespeichert } } - else if (aString == SC_UNONAME_PRALLSH) + else if (aPropertyName == SC_UNONAME_PRALLSH) { ScPrintOptions aPrintOpt(pScMod->GetPrintOptions()); aPrintOpt.SetAllSheets( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); pScMod->SetPrintOptions( aPrintOpt ); } - else if (aString == SC_UNONAME_PREMPTY) + else if (aPropertyName == SC_UNONAME_PREMPTY) { ScPrintOptions aPrintOpt(pScMod->GetPrintOptions()); aPrintOpt.SetSkipEmpty( !ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); // reversed @@ -391,7 +390,6 @@ uno::Any SAL_CALL ScSpreadsheetSettings::getPropertyValue( const OUString& aProp uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - OUString aString = aPropertyName; uno::Any aRet; ScModule* pScMod = SC_MOD(); @@ -399,21 +397,21 @@ uno::Any SAL_CALL ScSpreadsheetSettings::getPropertyValue( const OUString& aProp ScInputOptions aInpOpt = pScMod->GetInputOptions(); // print options aren't loaded until needed - if (aString == SC_UNONAME_DOAUTOCP) ScUnoHelpFunctions::SetBoolInAny( aRet, aAppOpt.GetAutoComplete() ); - else if (aString == SC_UNONAME_ENTERED ) ScUnoHelpFunctions::SetBoolInAny( aRet, aInpOpt.GetEnterEdit() ); - else if (aString == SC_UNONAME_EXPREF ) ScUnoHelpFunctions::SetBoolInAny( aRet, aInpOpt.GetExpandRefs() ); - else if (aString == SC_UNONAME_EXTFMT ) ScUnoHelpFunctions::SetBoolInAny( aRet, aInpOpt.GetExtendFormat() ); - else if (aString == SC_UNONAME_LINKUPD ) aRet <<= (sal_Int16) aAppOpt.GetLinkMode(); - else if (aString == SC_UNONAME_MARKHDR ) ScUnoHelpFunctions::SetBoolInAny( aRet, aInpOpt.GetMarkHeader() ); - else if (aString == SC_UNONAME_MOVESEL ) ScUnoHelpFunctions::SetBoolInAny( aRet, aInpOpt.GetMoveSelection() ); - else if (aString == SC_UNONAME_RANGEFIN ) ScUnoHelpFunctions::SetBoolInAny( aRet, aInpOpt.GetRangeFinder() ); - else if (aString == SC_UNONAME_USETABCOL ) ScUnoHelpFunctions::SetBoolInAny( aRet, aInpOpt.GetUseTabCol() ); - else if (aString == SC_UNONAME_PRMETRICS ) ScUnoHelpFunctions::SetBoolInAny( aRet, aInpOpt.GetTextWysiwyg() ); - else if (aString == SC_UNONAME_REPLWARN ) ScUnoHelpFunctions::SetBoolInAny( aRet, aInpOpt.GetReplaceCellsWarn() ); - else if (aString == SC_UNONAME_METRIC ) aRet <<= (sal_Int16) aAppOpt.GetAppMetric(); - else if (aString == SC_UNONAME_MOVEDIR ) aRet <<= (sal_Int16) aInpOpt.GetMoveDir(); - else if (aString == SC_UNONAME_STBFUNC ) aRet <<= (sal_Int16) aAppOpt.GetStatusFunc(); - else if (aString == SC_UNONAME_SCALE ) + if (aPropertyName == SC_UNONAME_DOAUTOCP) ScUnoHelpFunctions::SetBoolInAny( aRet, aAppOpt.GetAutoComplete() ); + else if (aPropertyName == SC_UNONAME_ENTERED ) ScUnoHelpFunctions::SetBoolInAny( aRet, aInpOpt.GetEnterEdit() ); + else if (aPropertyName == SC_UNONAME_EXPREF ) ScUnoHelpFunctions::SetBoolInAny( aRet, aInpOpt.GetExpandRefs() ); + else if (aPropertyName == SC_UNONAME_EXTFMT ) ScUnoHelpFunctions::SetBoolInAny( aRet, aInpOpt.GetExtendFormat() ); + else if (aPropertyName == SC_UNONAME_LINKUPD ) aRet <<= (sal_Int16) aAppOpt.GetLinkMode(); + else if (aPropertyName == SC_UNONAME_MARKHDR ) ScUnoHelpFunctions::SetBoolInAny( aRet, aInpOpt.GetMarkHeader() ); + else if (aPropertyName == SC_UNONAME_MOVESEL ) ScUnoHelpFunctions::SetBoolInAny( aRet, aInpOpt.GetMoveSelection() ); + else if (aPropertyName == SC_UNONAME_RANGEFIN ) ScUnoHelpFunctions::SetBoolInAny( aRet, aInpOpt.GetRangeFinder() ); + else if (aPropertyName == SC_UNONAME_USETABCOL ) ScUnoHelpFunctions::SetBoolInAny( aRet, aInpOpt.GetUseTabCol() ); + else if (aPropertyName == SC_UNONAME_PRMETRICS ) ScUnoHelpFunctions::SetBoolInAny( aRet, aInpOpt.GetTextWysiwyg() ); + else if (aPropertyName == SC_UNONAME_REPLWARN ) ScUnoHelpFunctions::SetBoolInAny( aRet, aInpOpt.GetReplaceCellsWarn() ); + else if (aPropertyName == SC_UNONAME_METRIC ) aRet <<= (sal_Int16) aAppOpt.GetAppMetric(); + else if (aPropertyName == SC_UNONAME_MOVEDIR ) aRet <<= (sal_Int16) aInpOpt.GetMoveDir(); + else if (aPropertyName == SC_UNONAME_STBFUNC ) aRet <<= (sal_Int16) aAppOpt.GetStatusFunc(); + else if (aPropertyName == SC_UNONAME_SCALE ) { sal_Int16 nZoomVal = 0; switch ( aAppOpt.GetZoomType() ) @@ -429,7 +427,7 @@ uno::Any SAL_CALL ScSpreadsheetSettings::getPropertyValue( const OUString& aProp } aRet <<= (sal_Int16) nZoomVal; } - else if (aString == SC_UNONAME_ULISTS ) + else if (aPropertyName == SC_UNONAME_ULISTS ) { ScUserList* pUserList = ScGlobal::GetUserList(); if (pUserList) @@ -445,9 +443,9 @@ uno::Any SAL_CALL ScSpreadsheetSettings::getPropertyValue( const OUString& aProp aRet <<= aSeq; } } - else if (aString == SC_UNONAME_PRALLSH ) + else if (aPropertyName == SC_UNONAME_PRALLSH ) ScUnoHelpFunctions::SetBoolInAny( aRet, pScMod->GetPrintOptions().GetAllSheets() ); - else if (aString == SC_UNONAME_PREMPTY ) + else if (aPropertyName == SC_UNONAME_PREMPTY ) ScUnoHelpFunctions::SetBoolInAny( aRet, !pScMod->GetPrintOptions().GetSkipEmpty() ); // reversed return aRet; @@ -620,7 +618,6 @@ uno::Any SAL_CALL ScFunctionListObj::getByName( const OUString& aName ) lang::WrappedTargetException, uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - OUString aNameStr(aName); const ScFunctionList* pFuncList = ScGlobal::GetStarCalcFunctionList(); if ( pFuncList ) { @@ -629,7 +626,7 @@ uno::Any SAL_CALL ScFunctionListObj::getByName( const OUString& aName ) { const ScFuncDesc* pDesc = pFuncList->GetFunction(nIndex); //! Case-insensitiv ??? - if ( pDesc && pDesc->pFuncName && aNameStr == *pDesc->pFuncName ) + if ( pDesc && pDesc->pFuncName && aName == *pDesc->pFuncName ) { uno::Sequence aSeq( SC_FUNCDESC_PROPCOUNT ); lcl_FillSequence( aSeq, *pDesc ); diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index a7370d5a8344..fcc1266e88d5 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -4436,13 +4436,12 @@ void SAL_CALL ScCellRangesObj::insertByName( const OUString& aName, const uno::A { // if explicit name is given and already existing, throw exception - OUString aNamStr(aName); - if ( !aNamStr.isEmpty() ) + if ( !aName.isEmpty() ) { size_t nNamedCount = m_pImpl->m_aNamedEntries.size(); for (size_t n = 0; n < nNamedCount; n++) { - if (m_pImpl->m_aNamedEntries[n].GetName() == aNamStr) + if (m_pImpl->m_aNamedEntries[n].GetName() == aName) throw container::ElementExistException(); } } @@ -4460,7 +4459,7 @@ void SAL_CALL ScCellRangesObj::insertByName( const OUString& aName, const uno::A // if a name is given, also insert into list of named entries // (only possible for a single range) // name is not in m_pImpl->m_aNamedEntries (tested above) - m_pImpl->m_aNamedEntries.push_back(ScNamedEntry( aNamStr, *rAddRanges[ 0 ] )); + m_pImpl->m_aNamedEntries.push_back(ScNamedEntry( aName, *rAddRanges[ 0 ] )); } } } @@ -4552,11 +4551,10 @@ void SAL_CALL ScCellRangesObj::removeByName( const OUString& aName ) { SolarMutexGuard aGuard; bool bDone = false; - OUString aNameStr(aName); ScDocShell* pDocSh = GetDocShell(); const ScRangeList& rRanges = GetRangeList(); size_t nIndex = 0; - if ( lcl_FindRangeByName( rRanges, pDocSh, aNameStr, nIndex ) ) + if ( lcl_FindRangeByName( rRanges, pDocSh, aName, nIndex ) ) { // einzelnen Range weglassen ScRangeList aNew; @@ -4570,13 +4568,13 @@ void SAL_CALL ScCellRangesObj::removeByName( const OUString& aName ) { // deselect any ranges (parsed or named entry) ScRangeList aDiff; - bool bValid = ( aDiff.Parse( aNameStr, &pDocSh->GetDocument() ) & ScRefFlags::VALID ) + bool bValid = ( aDiff.Parse( aName, &pDocSh->GetDocument() ) & ScRefFlags::VALID ) == ScRefFlags::VALID; if (!bValid && !m_pImpl->m_aNamedEntries.empty()) { sal_uInt16 nCount = m_pImpl->m_aNamedEntries.size(); for (sal_uInt16 n=0; nm_aNamedEntries[n].GetName() == aNameStr) + if (m_pImpl->m_aNamedEntries[n].GetName() == aName) { aDiff.RemoveAll(); aDiff.Append(m_pImpl->m_aNamedEntries[n].GetRange()); @@ -4604,7 +4602,7 @@ void SAL_CALL ScCellRangesObj::removeByName( const OUString& aName ) } if (!m_pImpl->m_aNamedEntries.empty()) - lcl_RemoveNamedEntry(m_pImpl->m_aNamedEntries, aNameStr); + lcl_RemoveNamedEntry(m_pImpl->m_aNamedEntries, aName); if (!bDone) throw container::NoSuchElementException(); // not found @@ -4631,12 +4629,11 @@ uno::Any SAL_CALL ScCellRangesObj::getByName( const OUString& aName ) SolarMutexGuard aGuard; uno::Any aRet; - OUString aNameStr(aName); ScDocShell* pDocSh = GetDocShell(); const ScRangeList& rRanges = GetRangeList(); ScRange aRange; if (lcl_FindRangeOrEntry(m_pImpl->m_aNamedEntries, rRanges, - pDocSh, aNameStr, aRange)) + pDocSh, aName, aRange)) { uno::Reference xRange; if ( aRange.aStart == aRange.aEnd ) @@ -4698,12 +4695,11 @@ sal_Bool SAL_CALL ScCellRangesObj::hasByName( const OUString& aName ) throw(uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - OUString aNameStr(aName); ScDocShell* pDocSh = GetDocShell(); const ScRangeList& rRanges = GetRangeList(); ScRange aRange; return lcl_FindRangeOrEntry(m_pImpl->m_aNamedEntries, rRanges, pDocSh, - aNameStr, aRange); + aName, aRange); } // XEnumerationAccess @@ -4971,8 +4967,7 @@ uno::Reference ScCellRangeObj::getCellRangeByName( ScRange aCellRange; bool bFound = false; - OUString aString(aName); - ScRefFlags nParse = aCellRange.ParseAny( aString, &rDoc, rDetails ); + ScRefFlags nParse = aCellRange.ParseAny( aName, &rDoc, rDetails ); if ( nParse & ScRefFlags::VALID ) { if ( !(nParse & ScRefFlags::TAB_3D) ) // keine Tabelle angegeben -> auf dieser Tabelle @@ -4985,8 +4980,8 @@ uno::Reference ScCellRangeObj::getCellRangeByName( else { ScRangeUtil aRangeUtil; - if ( ScRangeUtil::MakeRangeFromName( aString, &rDoc, nTab, aCellRange ) || - ScRangeUtil::MakeRangeFromName( aString, &rDoc, nTab, aCellRange, RUTL_DBASE ) ) + if ( ScRangeUtil::MakeRangeFromName( aName, &rDoc, nTab, aCellRange ) || + ScRangeUtil::MakeRangeFromName( aName, &rDoc, nTab, aCellRange, RUTL_DBASE ) ) bFound = true; } @@ -6217,20 +6212,19 @@ void ScCellObj::InputEnglishString( const OUString& rText ) if (!pDocSh) return; - OUString aString(rText); ScDocument& rDoc = pDocSh->GetDocument(); SvNumberFormatter* pFormatter = rDoc.GetFormatTable(); sal_uInt32 nOldFormat = rDoc.GetNumberFormat( aCellPos ); if (pFormatter->GetType(nOldFormat) == css::util::NumberFormat::TEXT) { - SetString_Impl(aString, false, false); // text cell + SetString_Impl(rText, false, false); // text cell return; } ScDocFunc &rFunc = pDocSh->GetDocFunc(); ScInputStringType aRes = - ScStringUtil::parseInputString(*pFormatter, aString, LANGUAGE_ENGLISH_US); + ScStringUtil::parseInputString(*pFormatter, rText, LANGUAGE_ENGLISH_US); if (aRes.meType != ScInputStringType::Unknown) { @@ -6262,7 +6256,7 @@ void ScCellObj::InputEnglishString( const OUString& rText ) rFunc.SetStringOrEditCell(aCellPos, aRes.maText, false); break; default: - SetString_Impl(aString, false, false); // probably empty string + SetString_Impl(rText, false, false); // probably empty string } } @@ -6307,12 +6301,11 @@ OUString SAL_CALL ScCellObj::getString() throw(uno::RuntimeException, std::excep void SAL_CALL ScCellObj::setString( const OUString& aText ) throw(uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - OUString aString(aText); - SetString_Impl(aString, false, false); // immer Text + SetString_Impl(aText, false, false); // immer Text // don't create pUnoText here if not there if (mxUnoText.is()) - mxUnoText->SetSelection(ESelection( 0,0, 0,aString.getLength() )); + mxUnoText->SetSelection(ESelection( 0,0, 0,aText.getLength() )); } void SAL_CALL ScCellObj::insertString( const uno::Reference& xRange, @@ -6453,8 +6446,7 @@ OUString SAL_CALL ScCellObj::getFormula() throw(uno::RuntimeException, std::exce void SAL_CALL ScCellObj::setFormula( const OUString& aFormula ) throw(uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - OUString aString(aFormula); - SetString_Impl(aString, true, true); // Interpret as English + SetString_Impl(aFormula, true, true); // Interpret as English } double SAL_CALL ScCellObj::getValue() throw(uno::RuntimeException, std::exception) @@ -7157,8 +7149,7 @@ void SAL_CALL ScTableSheetObj::setName( const OUString& aNewName ) ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) { - OUString aString(aNewName); - pDocSh->GetDocFunc().RenameTable( GetTab_Impl(), aString, true, true ); + pDocSh->GetDocFunc().RenameTable( GetTab_Impl(), aNewName, true, true ); } } @@ -7639,7 +7630,6 @@ void SAL_CALL ScTableSheetObj::link( const OUString& aUrl, const OUString& aShee OUString aFileString = aUrl; OUString aFilterString = aFilterName; OUString aOptString = aFilterOptions; - OUString aSheetString = aSheetName; aFileString = ScGlobal::GetAbsDocName( aFileString, pDocSh ); if (aFilterString.isEmpty()) @@ -7656,7 +7646,7 @@ void SAL_CALL ScTableSheetObj::link( const OUString& aUrl, const OUString& aShee nLinkMode = ScLinkMode::VALUE; sal_uLong nRefresh = 0; - rDoc.SetLink( nTab, nLinkMode, aFileString, aFilterString, aOptString, aSheetString, nRefresh ); + rDoc.SetLink( nTab, nLinkMode, aFileString, aFilterString, aOptString, aSheetName, nRefresh ); pDocSh->UpdateLinks(); // ggf. Link eintragen oder loeschen SfxBindings* pBindings = pDocSh->GetViewBindings(); @@ -7899,8 +7889,7 @@ void SAL_CALL ScTableSheetObj::protect( const OUString& aPassword ) // #i108245# if already protected, don't change anything if ( pDocSh && !pDocSh->GetDocument().IsTabProtected( GetTab_Impl() ) ) { - OUString aString(aPassword); - pDocSh->GetDocFunc().Protect( GetTab_Impl(), aString, true ); + pDocSh->GetDocFunc().Protect( GetTab_Impl(), aPassword, true ); } } @@ -7911,8 +7900,7 @@ void SAL_CALL ScTableSheetObj::unprotect( const OUString& aPassword ) ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) { - OUString aString(aPassword); - bool bDone = pDocSh->GetDocFunc().Unprotect( GetTab_Impl(), aString, true ); + bool bDone = pDocSh->GetDocFunc().Unprotect( GetTab_Impl(), aPassword, true ); if (!bDone) throw lang::IllegalArgumentException(); } diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx index d5881deef641..f19bb887853e 100644 --- a/sc/source/ui/unoobj/dapiuno.cxx +++ b/sc/source/ui/unoobj/dapiuno.cxx @@ -435,8 +435,7 @@ void SAL_CALL ScDataPilotTablesObj::removeByName( const OUString& aName ) throw(RuntimeException, std::exception) { SolarMutexGuard aGuard; - OUString aNameStr(aName); - ScDPObject* pDPObj = lcl_GetDPObject( pDocShell, nTab, aNameStr ); + ScDPObject* pDPObj = lcl_GetDPObject( pDocShell, nTab, aName ); if (pDPObj && pDocShell) { ScDBDocFunc aFunc(*pDocShell); @@ -760,38 +759,37 @@ void SAL_CALL ScDataPilotDescriptorBase::setPropertyValue( const OUString& aProp { ScDPSaveData aNewData( *pOldData ); - OUString aNameString = aPropertyName; - if ( aNameString == SC_UNO_DP_COLGRAND ) + if ( aPropertyName == SC_UNO_DP_COLGRAND ) { aNewData.SetColumnGrand(::cppu::any2bool( aValue )); } - else if ( aNameString == SC_UNO_DP_IGNORE_EMPTYROWS ) + else if ( aPropertyName == SC_UNO_DP_IGNORE_EMPTYROWS ) { aNewData.SetIgnoreEmptyRows(::cppu::any2bool( aValue )); } - else if ( aNameString == SC_UNO_DP_REPEATEMPTY ) + else if ( aPropertyName == SC_UNO_DP_REPEATEMPTY ) { aNewData.SetRepeatIfEmpty(::cppu::any2bool( aValue )); } - else if ( aNameString == SC_UNO_DP_ROWGRAND ) + else if ( aPropertyName == SC_UNO_DP_ROWGRAND ) { aNewData.SetRowGrand(::cppu::any2bool( aValue )); } - else if ( aNameString == SC_UNO_DP_SHOWFILTER ) + else if ( aPropertyName == SC_UNO_DP_SHOWFILTER ) { aNewData.SetFilterButton(::cppu::any2bool( aValue )); } - else if ( aNameString == SC_UNO_DP_DRILLDOWN ) + else if ( aPropertyName == SC_UNO_DP_DRILLDOWN ) { aNewData.SetDrillDown(::cppu::any2bool( aValue )); } - else if ( aNameString == SC_UNO_DP_GRANDTOTAL_NAME ) + else if ( aPropertyName == SC_UNO_DP_GRANDTOTAL_NAME ) { OUString aStrVal; if ( aValue >>= aStrVal ) aNewData.SetGrandTotalName(aStrVal); } - else if ( aNameString == SC_UNO_DP_IMPORTDESC ) + else if ( aPropertyName == SC_UNO_DP_IMPORTDESC ) { uno::Sequence aArgSeq; if ( aValue >>= aArgSeq ) @@ -823,7 +821,7 @@ void SAL_CALL ScDataPilotDescriptorBase::setPropertyValue( const OUString& aProp pDPObject->SetImportDesc( aImportDesc ); } } - else if ( aNameString == SC_UNO_DP_SOURCESERVICE ) + else if ( aPropertyName == SC_UNO_DP_SOURCESERVICE ) { OUString aStrVal; if ( aValue >>= aStrVal ) @@ -839,7 +837,7 @@ void SAL_CALL ScDataPilotDescriptorBase::setPropertyValue( const OUString& aProp pDPObject->SetServiceData( aServiceDesc ); } } - else if ( aNameString == SC_UNO_DP_SERVICEARG ) + else if ( aPropertyName == SC_UNO_DP_SERVICEARG ) { uno::Sequence aArgSeq; if ( aValue >>= aArgSeq ) @@ -908,38 +906,37 @@ Any SAL_CALL ScDataPilotDescriptorBase::getPropertyValue( const OUString& aPrope { ScDPSaveData aNewData( *pOldData ); - OUString aNameString = aPropertyName; - if ( aNameString == SC_UNO_DP_COLGRAND ) + if ( aPropertyName == SC_UNO_DP_COLGRAND ) { aRet <<= aNewData.GetColumnGrand(); } - else if ( aNameString == SC_UNO_DP_IGNORE_EMPTYROWS ) + else if ( aPropertyName == SC_UNO_DP_IGNORE_EMPTYROWS ) { aRet <<= aNewData.GetIgnoreEmptyRows(); } - else if ( aNameString == SC_UNO_DP_REPEATEMPTY ) + else if ( aPropertyName == SC_UNO_DP_REPEATEMPTY ) { aRet <<= aNewData.GetRepeatIfEmpty(); } - else if ( aNameString == SC_UNO_DP_ROWGRAND ) + else if ( aPropertyName == SC_UNO_DP_ROWGRAND ) { aRet <<= aNewData.GetRowGrand(); } - else if ( aNameString == SC_UNO_DP_SHOWFILTER ) + else if ( aPropertyName == SC_UNO_DP_SHOWFILTER ) { aRet <<= aNewData.GetFilterButton(); } - else if ( aNameString == SC_UNO_DP_DRILLDOWN ) + else if ( aPropertyName == SC_UNO_DP_DRILLDOWN ) { aRet <<= aNewData.GetDrillDown(); } - else if ( aNameString == SC_UNO_DP_GRANDTOTAL_NAME ) + else if ( aPropertyName == SC_UNO_DP_GRANDTOTAL_NAME ) { const OUString* pGrandTotalName = aNewData.GetGrandTotalName(); if (pGrandTotalName) aRet <<= *pGrandTotalName; // same behavior as in ScDPSource } - else if ( aNameString == SC_UNO_DP_IMPORTDESC ) + else if ( aPropertyName == SC_UNO_DP_IMPORTDESC ) { const ScImportSourceDesc* pImportDesc = pDPObject->GetImportSourceDesc(); if ( pImportDesc ) @@ -964,7 +961,7 @@ Any SAL_CALL ScDataPilotDescriptorBase::getPropertyValue( const OUString& aPrope aRet <<= aEmpty; } } - else if ( aNameString == SC_UNO_DP_SOURCESERVICE ) + else if ( aPropertyName == SC_UNO_DP_SOURCESERVICE ) { OUString aServiceName; const ScDPServiceDesc* pServiceDesc = pDPObject->GetDPServiceDesc(); @@ -972,7 +969,7 @@ Any SAL_CALL ScDataPilotDescriptorBase::getPropertyValue( const OUString& aPrope aServiceName = pServiceDesc->aServiceName; aRet <<= aServiceName; // empty string if no ServiceDesc set } - else if ( aNameString == SC_UNO_DP_SERVICEARG ) + else if ( aPropertyName == SC_UNO_DP_SERVICEARG ) { const ScDPServiceDesc* pServiceDesc = pDPObject->GetDPServiceDesc(); if (pServiceDesc) @@ -1177,9 +1174,8 @@ void SAL_CALL ScDataPilotTableObj::setName( const OUString& aNewName ) { //! test for existing names !!! - OUString aString(aNewName); - pDPObj->SetName( aString ); //! Undo - DBDocFunc ??? - aName = aString; + pDPObj->SetName( aNewName ); //! Undo - DBDocFunc ??? + aName = aNewName; // DataPilotUpdate would do too much (output table is not changed) GetDocShell()->SetDocumentModified(); @@ -1861,97 +1857,96 @@ void SAL_CALL ScDataPilotFieldObj::setPropertyValue( const OUString& aPropertyNa RuntimeException, std::exception) { SolarMutexGuard aGuard; - OUString aNameString(aPropertyName); - if ( aNameString == SC_UNONAME_FUNCTION ) + if ( aPropertyName == SC_UNONAME_FUNCTION ) { // #i109350# use GetEnumFromAny because it also allows sal_Int32 GeneralFunction eFunction = (GeneralFunction) ScUnoHelpFunctions::GetEnumFromAny( aValue ); setFunction( eFunction ); } - else if ( aNameString == SC_UNONAME_SUBTOTALS ) + else if ( aPropertyName == SC_UNONAME_SUBTOTALS ) { Sequence< GeneralFunction > aSubtotals; if( aValue >>= aSubtotals ) setSubtotals( aSubtotals ); } - else if ( aNameString == SC_UNONAME_ORIENT ) + else if ( aPropertyName == SC_UNONAME_ORIENT ) { //! test for correct enum type? DataPilotFieldOrientation eOrient = (DataPilotFieldOrientation) ScUnoHelpFunctions::GetEnumFromAny( aValue ); setOrientation( eOrient ); } - else if ( aNameString == SC_UNONAME_SELPAGE ) + else if ( aPropertyName == SC_UNONAME_SELPAGE ) { OUString sCurrentPage; if (aValue >>= sCurrentPage) setCurrentPage(sCurrentPage); } - else if ( aNameString == SC_UNONAME_USESELPAGE ) + else if ( aPropertyName == SC_UNONAME_USESELPAGE ) { setUseCurrentPage(cppu::any2bool(aValue)); } - else if ( aNameString == SC_UNONAME_HASAUTOSHOW ) + else if ( aPropertyName == SC_UNONAME_HASAUTOSHOW ) { if (!cppu::any2bool(aValue)) setAutoShowInfo(nullptr); } - else if ( aNameString == SC_UNONAME_AUTOSHOW ) + else if ( aPropertyName == SC_UNONAME_AUTOSHOW ) { DataPilotFieldAutoShowInfo aInfo; if (aValue >>= aInfo) setAutoShowInfo(&aInfo); } - else if ( aNameString == SC_UNONAME_HASLAYOUTINFO ) + else if ( aPropertyName == SC_UNONAME_HASLAYOUTINFO ) { if (!cppu::any2bool(aValue)) setLayoutInfo(nullptr); } - else if ( aNameString == SC_UNONAME_LAYOUTINFO ) + else if ( aPropertyName == SC_UNONAME_LAYOUTINFO ) { DataPilotFieldLayoutInfo aInfo; if (aValue >>= aInfo) setLayoutInfo(&aInfo); } - else if ( aNameString == SC_UNONAME_HASREFERENCE ) + else if ( aPropertyName == SC_UNONAME_HASREFERENCE ) { if (!cppu::any2bool(aValue)) setReference(nullptr); } - else if ( aNameString == SC_UNONAME_REFERENCE ) + else if ( aPropertyName == SC_UNONAME_REFERENCE ) { DataPilotFieldReference aRef; if (aValue >>= aRef) setReference(&aRef); } - else if ( aNameString == SC_UNONAME_HASSORTINFO ) + else if ( aPropertyName == SC_UNONAME_HASSORTINFO ) { if (!cppu::any2bool(aValue)) setSortInfo(nullptr); } - else if ( aNameString == SC_UNONAME_SORTINFO ) + else if ( aPropertyName == SC_UNONAME_SORTINFO ) { DataPilotFieldSortInfo aInfo; if (aValue >>= aInfo) setSortInfo(&aInfo); } - else if ( aNameString == SC_UNONAME_ISGROUP ) + else if ( aPropertyName == SC_UNONAME_ISGROUP ) { if (!cppu::any2bool(aValue)) setGroupInfo(nullptr); } - else if ( aNameString == SC_UNONAME_GROUPINFO ) + else if ( aPropertyName == SC_UNONAME_GROUPINFO ) { DataPilotFieldGroupInfo aInfo; if (aValue >>= aInfo) setGroupInfo(&aInfo); } - else if ( aNameString == SC_UNONAME_SHOWEMPTY ) + else if ( aPropertyName == SC_UNONAME_SHOWEMPTY ) { setShowEmpty(cppu::any2bool(aValue)); } - else if ( aNameString == SC_UNONAME_REPEATITEMLABELS ) + else if ( aPropertyName == SC_UNONAME_REPEATITEMLABELS ) { setRepeatItemLabels(cppu::any2bool(aValue)); } @@ -1962,60 +1957,59 @@ Any SAL_CALL ScDataPilotFieldObj::getPropertyValue( const OUString& aPropertyNam RuntimeException, std::exception) { SolarMutexGuard aGuard; - OUString aNameString(aPropertyName); Any aRet; - if ( aNameString == SC_UNONAME_FUNCTION ) + if ( aPropertyName == SC_UNONAME_FUNCTION ) aRet <<= getFunction(); - else if ( aNameString == SC_UNONAME_SUBTOTALS ) + else if ( aPropertyName == SC_UNONAME_SUBTOTALS ) aRet <<= getSubtotals(); - else if ( aNameString == SC_UNONAME_ORIENT ) + else if ( aPropertyName == SC_UNONAME_ORIENT ) aRet <<= getOrientation(); - else if ( aNameString == SC_UNONAME_SELPAGE ) + else if ( aPropertyName == SC_UNONAME_SELPAGE ) aRet <<= getCurrentPage(); - else if ( aNameString == SC_UNONAME_USESELPAGE ) + else if ( aPropertyName == SC_UNONAME_USESELPAGE ) aRet <<= false; - else if ( aNameString == SC_UNONAME_HASAUTOSHOW ) + else if ( aPropertyName == SC_UNONAME_HASAUTOSHOW ) aRet <<= (getAutoShowInfo() != nullptr); - else if ( aNameString == SC_UNONAME_AUTOSHOW ) + else if ( aPropertyName == SC_UNONAME_AUTOSHOW ) { const DataPilotFieldAutoShowInfo* pInfo = getAutoShowInfo(); if (pInfo) aRet <<= DataPilotFieldAutoShowInfo(*pInfo); } - else if ( aNameString == SC_UNONAME_HASLAYOUTINFO ) + else if ( aPropertyName == SC_UNONAME_HASLAYOUTINFO ) aRet <<= (getLayoutInfo() != nullptr); - else if ( aNameString == SC_UNONAME_LAYOUTINFO ) + else if ( aPropertyName == SC_UNONAME_LAYOUTINFO ) { const DataPilotFieldLayoutInfo* pInfo = getLayoutInfo(); if (pInfo) aRet <<= DataPilotFieldLayoutInfo(*pInfo); } - else if ( aNameString == SC_UNONAME_HASREFERENCE ) + else if ( aPropertyName == SC_UNONAME_HASREFERENCE ) aRet <<= (getReference() != nullptr); - else if ( aNameString == SC_UNONAME_REFERENCE ) + else if ( aPropertyName == SC_UNONAME_REFERENCE ) { const DataPilotFieldReference* pRef = getReference(); if (pRef) aRet <<= DataPilotFieldReference(*pRef); } - else if ( aNameString == SC_UNONAME_HASSORTINFO ) + else if ( aPropertyName == SC_UNONAME_HASSORTINFO ) aRet <<= (getSortInfo() != nullptr); - else if ( aNameString == SC_UNONAME_SORTINFO ) + else if ( aPropertyName == SC_UNONAME_SORTINFO ) { const DataPilotFieldSortInfo* pInfo = getSortInfo(); if (pInfo) aRet <<= DataPilotFieldSortInfo(*pInfo); } - else if ( aNameString == SC_UNONAME_ISGROUP ) + else if ( aPropertyName == SC_UNONAME_ISGROUP ) aRet <<= (hasGroupInfo()); - else if ( aNameString == SC_UNONAME_GROUPINFO ) + else if ( aPropertyName == SC_UNONAME_GROUPINFO ) { aRet <<= getGroupInfo(); } - else if ( aNameString == SC_UNONAME_SHOWEMPTY ) + else if ( aPropertyName == SC_UNONAME_SHOWEMPTY ) aRet <<= getShowEmpty(); - else if ( aNameString == SC_UNONAME_REPEATITEMLABELS ) + else if ( aPropertyName == SC_UNONAME_REPEATITEMLABELS ) aRet <<= getRepeatItemLabels(); return aRet; @@ -3429,11 +3423,10 @@ void SAL_CALL ScDataPilotItemObj::setPropertyValue( const OUString& aPropertyNam if ( bGetNewIndex ) // after SetDPObject, get the new index { - OUString aOUName( sName ); Sequence< OUString > aItemNames = xMembers->getElementNames(); sal_Int32 nItemCount = aItemNames.getLength(); for (sal_Int32 nItem=0; nItem>= nVal ) aParam.nUserIndex = (sal_uInt16)nVal; } - else if (aString == SC_UNONAME_MAXFLD ) + else if (aPropertyName == SC_UNONAME_MAXFLD ) { sal_Int32 nVal = 0; if ( (aValue >>= nVal) && nVal > sal::static_int_cast(MAXSUBTOTAL) ) @@ -725,26 +723,25 @@ uno::Any SAL_CALL ScSubTotalDescriptorBase::getPropertyValue( const OUString& aP ScSubTotalParam aParam; GetData(aParam); - OUString aString(aPropertyName); uno::Any aRet; // some old property names are for 5.2 compatibility - if (aString == SC_UNONAME_CASE || aString == SC_UNONAME_ISCASE ) + if (aPropertyName == SC_UNONAME_CASE || aPropertyName == SC_UNONAME_ISCASE ) ScUnoHelpFunctions::SetBoolInAny( aRet, aParam.bCaseSens ); - else if (aString == SC_UNONAME_FORMATS || aString == SC_UNONAME_BINDFMT ) + else if (aPropertyName == SC_UNONAME_FORMATS || aPropertyName == SC_UNONAME_BINDFMT ) ScUnoHelpFunctions::SetBoolInAny( aRet, aParam.bIncludePattern ); - else if (aString == SC_UNONAME_ENABSORT ) + else if (aPropertyName == SC_UNONAME_ENABSORT ) ScUnoHelpFunctions::SetBoolInAny( aRet, aParam.bDoSort ); - else if (aString == SC_UNONAME_SORTASC ) + else if (aPropertyName == SC_UNONAME_SORTASC ) ScUnoHelpFunctions::SetBoolInAny( aRet, aParam.bAscending ); - else if (aString == SC_UNONAME_INSBRK ) + else if (aPropertyName == SC_UNONAME_INSBRK ) ScUnoHelpFunctions::SetBoolInAny( aRet, aParam.bPagebreak ); - else if (aString == SC_UNONAME_ULIST || aString == SC_UNONAME_ENUSLIST ) + else if (aPropertyName == SC_UNONAME_ULIST || aPropertyName == SC_UNONAME_ENUSLIST ) ScUnoHelpFunctions::SetBoolInAny( aRet, aParam.bUserDef ); - else if (aString == SC_UNONAME_UINDEX || aString == SC_UNONAME_USINDEX ) + else if (aPropertyName == SC_UNONAME_UINDEX || aPropertyName == SC_UNONAME_USINDEX ) aRet <<= (sal_Int32) aParam.nUserIndex; - else if (aString == SC_UNONAME_MAXFLD ) + else if (aPropertyName == SC_UNONAME_MAXFLD ) aRet <<= (sal_Int32) MAXSUBTOTAL; return aRet; @@ -1438,25 +1435,24 @@ void SAL_CALL ScFilterDescriptorBase::setPropertyValue( ScQueryParam aParam; GetData(aParam); - OUString aString(aPropertyName); - if (aString == SC_UNONAME_CONTHDR) + if (aPropertyName == SC_UNONAME_CONTHDR) aParam.bHasHeader = ScUnoHelpFunctions::GetBoolFromAny( aValue ); - else if (aString == SC_UNONAME_COPYOUT) + else if (aPropertyName == SC_UNONAME_COPYOUT) aParam.bInplace = !(ScUnoHelpFunctions::GetBoolFromAny( aValue )); - else if (aString == SC_UNONAME_ISCASE) + else if (aPropertyName == SC_UNONAME_ISCASE) aParam.bCaseSens = ScUnoHelpFunctions::GetBoolFromAny( aValue ); - else if (aString == SC_UNONAME_MAXFLD) + else if (aPropertyName == SC_UNONAME_MAXFLD) { // silently ignored } - else if (aString == SC_UNONAME_ORIENT) + else if (aPropertyName == SC_UNONAME_ORIENT) { //! test for correct enum type? table::TableOrientation eOrient = (table::TableOrientation) ScUnoHelpFunctions::GetEnumFromAny( aValue ); aParam.bByRow = ( eOrient != table::TableOrientation_COLUMNS ); } - else if (aString == SC_UNONAME_OUTPOS) + else if (aPropertyName == SC_UNONAME_OUTPOS) { table::CellAddress aAddress; if ( aValue >>= aAddress ) @@ -1466,11 +1462,11 @@ void SAL_CALL ScFilterDescriptorBase::setPropertyValue( aParam.nDestRow = (SCROW)aAddress.Row; } } - else if (aString == SC_UNONAME_SAVEOUT) + else if (aPropertyName == SC_UNONAME_SAVEOUT) aParam.bDestPers = ScUnoHelpFunctions::GetBoolFromAny( aValue ); - else if (aString == SC_UNONAME_SKIPDUP) + else if (aPropertyName == SC_UNONAME_SKIPDUP) aParam.bDuplicate = !(ScUnoHelpFunctions::GetBoolFromAny( aValue )); - else if (aString == SC_UNONAME_USEREGEX) + else if (aPropertyName == SC_UNONAME_USEREGEX) aParam.eSearchType = ScUnoHelpFunctions::GetBoolFromAny( aValue ) ? utl::SearchParam::SRCH_REGEXP : utl::SearchParam::SRCH_NORMAL; @@ -1485,24 +1481,23 @@ uno::Any SAL_CALL ScFilterDescriptorBase::getPropertyValue( const OUString& aPro ScQueryParam aParam; GetData(aParam); - OUString aString(aPropertyName); uno::Any aRet; - if (aString == SC_UNONAME_CONTHDR ) + if (aPropertyName == SC_UNONAME_CONTHDR ) ScUnoHelpFunctions::SetBoolInAny( aRet, aParam.bHasHeader ); - else if (aString == SC_UNONAME_COPYOUT ) + else if (aPropertyName == SC_UNONAME_COPYOUT ) ScUnoHelpFunctions::SetBoolInAny( aRet, !(aParam.bInplace) ); - else if (aString == SC_UNONAME_ISCASE ) + else if (aPropertyName == SC_UNONAME_ISCASE ) ScUnoHelpFunctions::SetBoolInAny( aRet, aParam.bCaseSens ); - else if (aString == SC_UNONAME_MAXFLD ) + else if (aPropertyName == SC_UNONAME_MAXFLD ) aRet <<= (sal_Int32) aParam.GetEntryCount(); - else if (aString == SC_UNONAME_ORIENT ) + else if (aPropertyName == SC_UNONAME_ORIENT ) { table::TableOrientation eOrient = aParam.bByRow ? table::TableOrientation_ROWS : table::TableOrientation_COLUMNS; aRet <<= eOrient; } - else if (aString == SC_UNONAME_OUTPOS ) + else if (aPropertyName == SC_UNONAME_OUTPOS ) { table::CellAddress aOutPos; aOutPos.Sheet = aParam.nDestTab; @@ -1510,11 +1505,11 @@ uno::Any SAL_CALL ScFilterDescriptorBase::getPropertyValue( const OUString& aPro aOutPos.Row = aParam.nDestRow; aRet <<= aOutPos; } - else if (aString == SC_UNONAME_SAVEOUT ) + else if (aPropertyName == SC_UNONAME_SAVEOUT ) ScUnoHelpFunctions::SetBoolInAny( aRet, aParam.bDestPers ); - else if (aString == SC_UNONAME_SKIPDUP ) + else if (aPropertyName == SC_UNONAME_SKIPDUP ) ScUnoHelpFunctions::SetBoolInAny( aRet, !(aParam.bDuplicate) ); - else if (aString == SC_UNONAME_USEREGEX ) + else if (aPropertyName == SC_UNONAME_USEREGEX ) ScUnoHelpFunctions::SetBoolInAny( aRet, aParam.eSearchType == utl::SearchParam::SRCH_REGEXP ); return aRet; @@ -1699,10 +1694,9 @@ void SAL_CALL ScDatabaseRangeObj::setName( const OUString& aNewName ) if (pDocShell) { ScDBDocFunc aFunc(*pDocShell); - OUString aNewStr(aNewName); - bool bOk = aFunc.RenameDBRange( aName, aNewStr ); + bool bOk = aFunc.RenameDBRange( aName, aNewName ); if (bOk) - aName = aNewStr; + aName = aNewName; } } @@ -2008,14 +2002,13 @@ void SAL_CALL ScDatabaseRangeObj::setPropertyValue( ScDBData aNewData( *pData ); bool bDo = true; - OUString aString(aPropertyName); - if ( aString == SC_UNONAME_KEEPFORM ) + if ( aPropertyName == SC_UNONAME_KEEPFORM ) aNewData.SetKeepFmt( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if ( aString == SC_UNONAME_MOVCELLS ) + else if ( aPropertyName == SC_UNONAME_MOVCELLS ) aNewData.SetDoSize( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if ( aString == SC_UNONAME_STRIPDAT ) + else if ( aPropertyName == SC_UNONAME_STRIPDAT ) aNewData.SetStripData( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if (aString == SC_UNONAME_AUTOFLT ) + else if (aPropertyName == SC_UNONAME_AUTOFLT ) { bool bAutoFilter(ScUnoHelpFunctions::GetBoolFromAny( aValue )); aNewData.SetAutoFilter(bAutoFilter); @@ -2034,7 +2027,7 @@ void SAL_CALL ScDatabaseRangeObj::setPropertyValue( aPaintRange.aEnd.SetRow(aPaintRange.aStart.Row()); pDocShell->PostPaint(aPaintRange, PAINT_GRID); } - else if (aString == SC_UNONAME_USEFLTCRT ) + else if (aPropertyName == SC_UNONAME_USEFLTCRT ) { if (ScUnoHelpFunctions::GetBoolFromAny( aValue )) { @@ -2046,7 +2039,7 @@ void SAL_CALL ScDatabaseRangeObj::setPropertyValue( else aNewData.SetAdvancedQuerySource(nullptr); } - else if (aString == SC_UNONAME_FLTCRT ) + else if (aPropertyName == SC_UNONAME_FLTCRT ) { table::CellRangeAddress aRange; if (aValue >>= aRange) @@ -2057,11 +2050,11 @@ void SAL_CALL ScDatabaseRangeObj::setPropertyValue( aNewData.SetAdvancedQuerySource(&aCoreRange); } } - else if (aString == SC_UNONAME_FROMSELECT ) + else if (aPropertyName == SC_UNONAME_FROMSELECT ) { aNewData.SetImportSelection(::cppu::any2bool(aValue)); } - else if (aString == SC_UNONAME_REFPERIOD ) + else if (aPropertyName == SC_UNONAME_REFPERIOD ) { sal_Int32 nRefresh = 0; if (aValue >>= nRefresh) @@ -2075,12 +2068,12 @@ void SAL_CALL ScDatabaseRangeObj::setPropertyValue( } } } - else if (aString == SC_UNONAME_CONRES ) + else if (aPropertyName == SC_UNONAME_CONRES ) { } - else if ( aString == SC_UNONAME_TOTALSROW ) + else if ( aPropertyName == SC_UNONAME_TOTALSROW ) aNewData.SetTotals( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if ( aString == SC_UNONAME_CONTHDR ) + else if ( aPropertyName == SC_UNONAME_CONTHDR ) aNewData.SetHeader( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); else bDo = false; @@ -2102,40 +2095,39 @@ uno::Any SAL_CALL ScDatabaseRangeObj::getPropertyValue( const OUString& aPropert ScDBData* pData = GetDBData_Impl(); if ( pData ) { - OUString aString(aPropertyName); - if ( aString == SC_UNONAME_KEEPFORM ) + if ( aPropertyName == SC_UNONAME_KEEPFORM ) ScUnoHelpFunctions::SetBoolInAny( aRet, pData->IsKeepFmt() ); - else if ( aString == SC_UNONAME_MOVCELLS ) + else if ( aPropertyName == SC_UNONAME_MOVCELLS ) ScUnoHelpFunctions::SetBoolInAny( aRet, pData->IsDoSize() ); - else if ( aString == SC_UNONAME_STRIPDAT ) + else if ( aPropertyName == SC_UNONAME_STRIPDAT ) ScUnoHelpFunctions::SetBoolInAny( aRet, pData->IsStripData() ); - else if ( aString == SC_UNONAME_ISUSER ) + else if ( aPropertyName == SC_UNONAME_ISUSER ) { // all database ranges except "unnamed" are user defined ScUnoHelpFunctions::SetBoolInAny( aRet, pData->GetName() != STR_DB_LOCAL_NONAME); } - else if ( aString == SC_UNO_LINKDISPBIT ) + else if ( aPropertyName == SC_UNO_LINKDISPBIT ) { // no target bitmaps for individual entries (would be all equal) // ScLinkTargetTypeObj::SetLinkTargetBitmap( aRet, SC_LINKTARGETTYPE_DBAREA ); } - else if ( aString == SC_UNO_LINKDISPNAME ) + else if ( aPropertyName == SC_UNO_LINKDISPNAME ) aRet <<= OUString( aName ); - else if (aString == SC_UNONAME_AUTOFLT ) + else if (aPropertyName == SC_UNONAME_AUTOFLT ) { bool bAutoFilter(GetDBData_Impl()->HasAutoFilter()); ScUnoHelpFunctions::SetBoolInAny( aRet, bAutoFilter ); } - else if (aString == SC_UNONAME_USEFLTCRT ) + else if (aPropertyName == SC_UNONAME_USEFLTCRT ) { ScRange aRange; bool bIsAdvancedSource(GetDBData_Impl()->GetAdvancedQuerySource(aRange)); ScUnoHelpFunctions::SetBoolInAny( aRet, bIsAdvancedSource ); } - else if (aString == SC_UNONAME_FLTCRT ) + else if (aPropertyName == SC_UNONAME_FLTCRT ) { table::CellRangeAddress aRange; ScRange aCoreRange; @@ -2144,30 +2136,30 @@ uno::Any SAL_CALL ScDatabaseRangeObj::getPropertyValue( const OUString& aPropert aRet <<= aRange; } - else if (aString == SC_UNONAME_FROMSELECT ) + else if (aPropertyName == SC_UNONAME_FROMSELECT ) { ScUnoHelpFunctions::SetBoolInAny( aRet, GetDBData_Impl()->HasImportSelection() ); } - else if (aString == SC_UNONAME_REFPERIOD ) + else if (aPropertyName == SC_UNONAME_REFPERIOD ) { sal_Int32 nRefresh(GetDBData_Impl()->GetRefreshDelay()); aRet <<= nRefresh; } - else if (aString == SC_UNONAME_CONRES ) + else if (aPropertyName == SC_UNONAME_CONRES ) { } - else if (aString == SC_UNONAME_TOKENINDEX ) + else if (aPropertyName == SC_UNONAME_TOKENINDEX ) { // get index for use in formula tokens (read-only) aRet <<= static_cast(GetDBData_Impl()->GetIndex()); } - else if (aString == SC_UNONAME_TOTALSROW ) + else if (aPropertyName == SC_UNONAME_TOTALSROW ) { bool bTotals(GetDBData_Impl()->HasTotals()); ScUnoHelpFunctions::SetBoolInAny( aRet, bTotals ); } - else if (aString == SC_UNONAME_CONTHDR ) + else if (aPropertyName == SC_UNONAME_CONTHDR ) { bool bHeader(GetDBData_Impl()->HasHeader()); @@ -2250,8 +2242,7 @@ ScDatabaseRangeObj* ScDatabaseRangesObj::GetObjectByName_Impl(const OUString& aN { if ( pDocShell && hasByName(aName) ) { - OUString aString(aName); - return new ScDatabaseRangeObj( pDocShell, aString ); + return new ScDatabaseRangeObj( pDocShell, aName ); } return nullptr; } @@ -2266,10 +2257,9 @@ void SAL_CALL ScDatabaseRangesObj::addNewByName( const OUString& aName, { ScDBDocFunc aFunc(*pDocShell); - OUString aString(aName); ScRange aNameRange( (SCCOL)aRange.StartColumn, (SCROW)aRange.StartRow, aRange.Sheet, (SCCOL)aRange.EndColumn, (SCROW)aRange.EndRow, aRange.Sheet ); - bDone = aFunc.AddDBRange( aString, aNameRange, true ); + bDone = aFunc.AddDBRange( aName, aNameRange, true ); } if (!bDone) throw uno::RuntimeException(); // no other exceptions specified @@ -2283,8 +2273,7 @@ void SAL_CALL ScDatabaseRangesObj::removeByName( const OUString& aName ) if (pDocShell) { ScDBDocFunc aFunc(*pDocShell); - OUString aString(aName); - bDone = aFunc.DeleteDBRange( aString ); + bDone = aFunc.DeleteDBRange( aName ); } if (!bDone) throw uno::RuntimeException(); // no other exceptions specified diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 81af766093c6..ffab4b206629 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -1926,8 +1926,7 @@ void SAL_CALL ScModelObj::protect( const OUString& aPassword ) throw(uno::Runtim // #i108245# if already protected, don't change anything if ( pDocShell && !pDocShell->GetDocument().IsDocProtected() ) { - OUString aString(aPassword); - pDocShell->GetDocFunc().Protect( TABLEID_DOC, aString, true ); + pDocShell->GetDocFunc().Protect( TABLEID_DOC, aPassword, true ); } } @@ -1937,8 +1936,7 @@ void SAL_CALL ScModelObj::unprotect( const OUString& aPassword ) SolarMutexGuard aGuard; if (pDocShell) { - OUString aString(aPassword); - bool bDone = pDocShell->GetDocFunc().Unprotect( TABLEID_DOC, aString, true ); + bool bDone = pDocShell->GetDocFunc().Unprotect( TABLEID_DOC, aPassword, true ); if (!bDone) throw lang::IllegalArgumentException(); } @@ -1981,13 +1979,12 @@ sheet::GoalResult SAL_CALL ScModelObj::seekGoal( if (pDocShell) { WaitObject aWait( ScDocShell::GetActiveDialogParent() ); - OUString aGoalString(aGoalValue); ScDocument& rDoc = pDocShell->GetDocument(); double fValue = 0.0; bool bFound = rDoc.Solver( (SCCOL)aFormulaPosition.Column, (SCROW)aFormulaPosition.Row, aFormulaPosition.Sheet, (SCCOL)aVariablePosition.Column, (SCROW)aVariablePosition.Row, aVariablePosition.Sheet, - aGoalString, fValue ); + aGoalValue, fValue ); aResult.Result = fValue; if (bFound) aResult.Divergence = 0.0; //! das ist gelogen @@ -2094,7 +2091,6 @@ void SAL_CALL ScModelObj::setPropertyValue( uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - OUString aString(aPropertyName); if (pDocShell) { @@ -2109,13 +2105,13 @@ void SAL_CALL ScModelObj::setPropertyValue( if (bOpt) { // done... - if ( aString == SC_UNO_IGNORECASE || - aString == SC_UNONAME_REGEXP || - aString == SC_UNONAME_WILDCARDS || - aString == SC_UNO_LOOKUPLABELS ) + if ( aPropertyName == SC_UNO_IGNORECASE || + aPropertyName == SC_UNONAME_REGEXP || + aPropertyName == SC_UNONAME_WILDCARDS || + aPropertyName == SC_UNO_LOOKUPLABELS ) bHardRecalc = false; } - else if ( aString == SC_UNONAME_CLOCAL ) + else if ( aPropertyName == SC_UNONAME_CLOCAL ) { lang::Locale aLocale; if ( aValue >>= aLocale ) @@ -2126,13 +2122,13 @@ void SAL_CALL ScModelObj::setPropertyValue( rDoc.SetLanguage( eLatin, eCjk, eCtl ); } } - else if ( aString == SC_UNO_CODENAME ) + else if ( aPropertyName == SC_UNO_CODENAME ) { OUString sCodeName; if ( aValue >>= sCodeName ) rDoc.SetCodeName( sCodeName ); } - else if ( aString == SC_UNO_CJK_CLOCAL ) + else if ( aPropertyName == SC_UNO_CJK_CLOCAL ) { lang::Locale aLocale; if ( aValue >>= aLocale ) @@ -2143,7 +2139,7 @@ void SAL_CALL ScModelObj::setPropertyValue( rDoc.SetLanguage( eLatin, eCjk, eCtl ); } } - else if ( aString == SC_UNO_CTL_CLOCAL ) + else if ( aPropertyName == SC_UNO_CTL_CLOCAL ) { lang::Locale aLocale; if ( aValue >>= aLocale ) @@ -2154,7 +2150,7 @@ void SAL_CALL ScModelObj::setPropertyValue( rDoc.SetLanguage( eLatin, eCjk, eCtl ); } } - else if ( aString == SC_UNO_APPLYFMDES ) + else if ( aPropertyName == SC_UNO_APPLYFMDES ) { // model is created if not there ScDrawLayer* pModel = pDocShell->MakeDrawLayer(); @@ -2164,7 +2160,7 @@ void SAL_CALL ScModelObj::setPropertyValue( if (pBindings) pBindings->Invalidate( SID_FM_OPEN_READONLY ); } - else if ( aString == SC_UNO_AUTOCONTFOC ) + else if ( aPropertyName == SC_UNO_AUTOCONTFOC ) { // model is created if not there ScDrawLayer* pModel = pDocShell->MakeDrawLayer(); @@ -2174,11 +2170,11 @@ void SAL_CALL ScModelObj::setPropertyValue( if (pBindings) pBindings->Invalidate( SID_FM_AUTOCONTROLFOCUS ); } - else if ( aString == SC_UNO_ISLOADED ) + else if ( aPropertyName == SC_UNO_ISLOADED ) { pDocShell->SetEmpty( !ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); } - else if ( aString == SC_UNO_ISUNDOENABLED ) + else if ( aPropertyName == SC_UNO_ISUNDOENABLED ) { bool bUndoEnabled = ScUnoHelpFunctions::GetBoolFromAny( aValue ); rDoc.EnableUndo( bUndoEnabled ); @@ -2186,7 +2182,7 @@ void SAL_CALL ScModelObj::setPropertyValue( bUndoEnabled ? officecfg::Office::Common::Undo::Steps::get() : 0); } - else if ( aString == SC_UNO_RECORDCHANGES ) + else if ( aPropertyName == SC_UNO_RECORDCHANGES ) { bool bRecordChangesEnabled = ScUnoHelpFunctions::GetBoolFromAny( aValue ); @@ -2197,33 +2193,33 @@ void SAL_CALL ScModelObj::setPropertyValue( if (bChangeAllowed) pDocShell->SetChangeRecording(bRecordChangesEnabled); } - else if ( aString == SC_UNO_ISADJUSTHEIGHTENABLED ) + else if ( aPropertyName == SC_UNO_ISADJUSTHEIGHTENABLED ) { bool bOldAdjustHeightEnabled = rDoc.IsAdjustHeightEnabled(); bool bAdjustHeightEnabled = ScUnoHelpFunctions::GetBoolFromAny( aValue ); if( bOldAdjustHeightEnabled != bAdjustHeightEnabled ) rDoc.EnableAdjustHeight( bAdjustHeightEnabled ); } - else if ( aString == SC_UNO_ISEXECUTELINKENABLED ) + else if ( aPropertyName == SC_UNO_ISEXECUTELINKENABLED ) { rDoc.EnableExecuteLink( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); } - else if ( aString == SC_UNO_ISCHANGEREADONLYENABLED ) + else if ( aPropertyName == SC_UNO_ISCHANGEREADONLYENABLED ) { rDoc.EnableChangeReadOnly( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); } - else if ( aString == "BuildId" ) + else if ( aPropertyName == "BuildId" ) { aValue >>= maBuildId; } - else if ( aString == "SavedObject" ) // set from chart after saving + else if ( aPropertyName == "SavedObject" ) // set from chart after saving { OUString aObjName; aValue >>= aObjName; if ( !aObjName.isEmpty() ) rDoc.RestoreChartListener( aObjName ); } - else if ( aString == SC_UNO_INTEROPGRABBAG ) + else if ( aPropertyName == SC_UNO_INTEROPGRABBAG ) { setGrabBagItem(aValue); } @@ -2244,7 +2240,6 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const OUString& aPropertyName ) uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - OUString aString(aPropertyName); uno::Any aRet; if (pDocShell) @@ -2256,7 +2251,7 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const OUString& aPropertyName ) { // done... } - else if ( aString == SC_UNONAME_CLOCAL ) + else if ( aPropertyName == SC_UNONAME_CLOCAL ) { LanguageType eLatin, eCjk, eCtl; rDoc.GetLanguage( eLatin, eCjk, eCtl ); @@ -2265,13 +2260,13 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const OUString& aPropertyName ) ScUnoConversion::FillLocale( aLocale, eLatin ); aRet <<= aLocale; } - else if ( aString == SC_UNO_CODENAME ) + else if ( aPropertyName == SC_UNO_CODENAME ) { OUString sCodeName = rDoc.GetCodeName(); aRet <<= sCodeName; } - else if ( aString == SC_UNO_CJK_CLOCAL ) + else if ( aPropertyName == SC_UNO_CJK_CLOCAL ) { LanguageType eLatin, eCjk, eCtl; rDoc.GetLanguage( eLatin, eCjk, eCtl ); @@ -2280,7 +2275,7 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const OUString& aPropertyName ) ScUnoConversion::FillLocale( aLocale, eCjk ); aRet <<= aLocale; } - else if ( aString == SC_UNO_CTL_CLOCAL ) + else if ( aPropertyName == SC_UNO_CTL_CLOCAL ) { LanguageType eLatin, eCjk, eCtl; rDoc.GetLanguage( eLatin, eCjk, eCtl ); @@ -2289,73 +2284,73 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const OUString& aPropertyName ) ScUnoConversion::FillLocale( aLocale, eCtl ); aRet <<= aLocale; } - else if ( aString == SC_UNO_NAMEDRANGES ) + else if ( aPropertyName == SC_UNO_NAMEDRANGES ) { aRet <<= uno::Reference(new ScGlobalNamedRangesObj( pDocShell )); } - else if ( aString == SC_UNO_DATABASERNG ) + else if ( aPropertyName == SC_UNO_DATABASERNG ) { aRet <<= uno::Reference(new ScDatabaseRangesObj( pDocShell )); } - else if ( aString == SC_UNO_UNNAMEDDBRNG ) + else if ( aPropertyName == SC_UNO_UNNAMEDDBRNG ) { aRet <<= uno::Reference(new ScUnnamedDatabaseRangesObj(pDocShell)); } - else if ( aString == SC_UNO_COLLABELRNG ) + else if ( aPropertyName == SC_UNO_COLLABELRNG ) { aRet <<= uno::Reference(new ScLabelRangesObj( pDocShell, true )); } - else if ( aString == SC_UNO_ROWLABELRNG ) + else if ( aPropertyName == SC_UNO_ROWLABELRNG ) { aRet <<= uno::Reference(new ScLabelRangesObj( pDocShell, false )); } - else if ( aString == SC_UNO_AREALINKS ) + else if ( aPropertyName == SC_UNO_AREALINKS ) { aRet <<= uno::Reference(new ScAreaLinksObj( pDocShell )); } - else if ( aString == SC_UNO_DDELINKS ) + else if ( aPropertyName == SC_UNO_DDELINKS ) { aRet <<= uno::Reference(new ScDDELinksObj( pDocShell )); } - else if ( aString == SC_UNO_EXTERNALDOCLINKS ) + else if ( aPropertyName == SC_UNO_EXTERNALDOCLINKS ) { aRet <<= uno::Reference(new ScExternalDocLinksObj(pDocShell)); } - else if ( aString == SC_UNO_SHEETLINKS ) + else if ( aPropertyName == SC_UNO_SHEETLINKS ) { aRet <<= uno::Reference(new ScSheetLinksObj( pDocShell )); } - else if ( aString == SC_UNO_APPLYFMDES ) + else if ( aPropertyName == SC_UNO_APPLYFMDES ) { // default for no model is TRUE ScDrawLayer* pModel = rDoc.GetDrawLayer(); bool bOpenInDesign = pModel == nullptr || pModel->GetOpenInDesignMode(); ScUnoHelpFunctions::SetBoolInAny( aRet, bOpenInDesign ); } - else if ( aString == SC_UNO_AUTOCONTFOC ) + else if ( aPropertyName == SC_UNO_AUTOCONTFOC ) { // default for no model is FALSE ScDrawLayer* pModel = rDoc.GetDrawLayer(); bool bAutoControlFocus = pModel && pModel->GetAutoControlFocus(); ScUnoHelpFunctions::SetBoolInAny( aRet, bAutoControlFocus ); } - else if ( aString == SC_UNO_FORBIDDEN ) + else if ( aPropertyName == SC_UNO_FORBIDDEN ) { aRet <<= uno::Reference(new ScForbiddenCharsObj( pDocShell )); } - else if ( aString == SC_UNO_HASDRAWPAGES ) + else if ( aPropertyName == SC_UNO_HASDRAWPAGES ) { ScUnoHelpFunctions::SetBoolInAny( aRet, (pDocShell->GetDocument().GetDrawLayer() != nullptr) ); } - else if ( aString == SC_UNO_BASICLIBRARIES ) + else if ( aPropertyName == SC_UNO_BASICLIBRARIES ) { aRet <<= pDocShell->GetBasicContainer(); } - else if ( aString == SC_UNO_DIALOGLIBRARIES ) + else if ( aPropertyName == SC_UNO_DIALOGLIBRARIES ) { aRet <<= pDocShell->GetDialogContainer(); } - else if ( aString == SC_UNO_VBAGLOBNAME ) + else if ( aPropertyName == SC_UNO_VBAGLOBNAME ) { /* #i111553# This property provides the name of the constant that will be used to store this model in the global Basic manager. @@ -2364,57 +2359,57 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const OUString& aPropertyName ) constant can co-exist, as required by VBA. */ aRet <<= OUString( "ThisExcelDoc" ); } - else if ( aString == SC_UNO_RUNTIMEUID ) + else if ( aPropertyName == SC_UNO_RUNTIMEUID ) { aRet <<= getRuntimeUID(); } - else if ( aString == SC_UNO_HASVALIDSIGNATURES ) + else if ( aPropertyName == SC_UNO_HASVALIDSIGNATURES ) { aRet <<= hasValidSignatures(); } - else if ( aString == SC_UNO_ISLOADED ) + else if ( aPropertyName == SC_UNO_ISLOADED ) { ScUnoHelpFunctions::SetBoolInAny( aRet, !pDocShell->IsEmpty() ); } - else if ( aString == SC_UNO_ISUNDOENABLED ) + else if ( aPropertyName == SC_UNO_ISUNDOENABLED ) { ScUnoHelpFunctions::SetBoolInAny( aRet, rDoc.IsUndoEnabled() ); } - else if ( aString == SC_UNO_RECORDCHANGES ) + else if ( aPropertyName == SC_UNO_RECORDCHANGES ) { ScUnoHelpFunctions::SetBoolInAny( aRet, pDocShell->IsChangeRecording() ); } - else if ( aString == SC_UNO_ISRECORDCHANGESPROTECTED ) + else if ( aPropertyName == SC_UNO_ISRECORDCHANGESPROTECTED ) { ScUnoHelpFunctions::SetBoolInAny( aRet, pDocShell->HasChangeRecordProtection() ); } - else if ( aString == SC_UNO_ISADJUSTHEIGHTENABLED ) + else if ( aPropertyName == SC_UNO_ISADJUSTHEIGHTENABLED ) { ScUnoHelpFunctions::SetBoolInAny( aRet, rDoc.IsAdjustHeightEnabled() ); } - else if ( aString == SC_UNO_ISEXECUTELINKENABLED ) + else if ( aPropertyName == SC_UNO_ISEXECUTELINKENABLED ) { ScUnoHelpFunctions::SetBoolInAny( aRet, rDoc.IsExecuteLinkEnabled() ); } - else if ( aString == SC_UNO_ISCHANGEREADONLYENABLED ) + else if ( aPropertyName == SC_UNO_ISCHANGEREADONLYENABLED ) { ScUnoHelpFunctions::SetBoolInAny( aRet, rDoc.IsChangeReadOnlyEnabled() ); } - else if ( aString == SC_UNO_REFERENCEDEVICE ) + else if ( aPropertyName == SC_UNO_REFERENCEDEVICE ) { VCLXDevice* pXDev = new VCLXDevice(); pXDev->SetOutputDevice( rDoc.GetRefDevice() ); aRet <<= uno::Reference< awt::XDevice >( pXDev ); } - else if ( aString == "BuildId" ) + else if ( aPropertyName == "BuildId" ) { aRet <<= maBuildId; } - else if ( aString == "InternalDocument" ) + else if ( aPropertyName == "InternalDocument" ) { ScUnoHelpFunctions::SetBoolInAny( aRet, (pDocShell->GetCreateMode() == SfxObjectCreateMode::INTERNAL) ); } - else if ( aString == SC_UNO_INTEROPGRABBAG ) + else if ( aPropertyName == SC_UNO_INTEROPGRABBAG ) { getGrabBagItem(aRet); } @@ -2434,8 +2429,7 @@ css::uno::Reference ScModelObj::create( using ServiceType = ScServiceProvider::Type; uno::Reference xRet; - OUString aNameStr(aServiceSpecifier); - ServiceType nType = ScServiceProvider::GetProviderType(aNameStr); + ServiceType nType = ScServiceProvider::GetProviderType(aServiceSpecifier); if ( nType != ServiceType::INVALID ) { // drawing layer tables must be kept as long as the model is alive @@ -3144,8 +3138,7 @@ void SAL_CALL ScTableSheetsObj::insertNewByName( const OUString& aName, sal_Int1 bool bDone = false; if (pDocShell) { - OUString aNamStr(aName); - bDone = pDocShell->GetDocFunc().InsertTable( nPosition, aNamStr, true, true ); + bDone = pDocShell->GetDocFunc().InsertTable( nPosition, aName, true, true ); } if (!bDone) throw uno::RuntimeException(); // no other exceptions specified @@ -3174,7 +3167,6 @@ void SAL_CALL ScTableSheetsObj::copyByName( const OUString& aName, bool bDone = false; if (pDocShell) { - OUString aNewStr(aCopy); SCTAB nSource; if ( pDocShell->GetDocument().GetTable( aName, nSource ) ) { @@ -3187,7 +3179,7 @@ void SAL_CALL ScTableSheetsObj::copyByName( const OUString& aName, if (nResultTab >= nTabCount) nResultTab = nTabCount - 1; - bDone = pDocShell->GetDocFunc().RenameTable( nResultTab, aNewStr, + bDone = pDocShell->GetDocFunc().RenameTable( nResultTab, aCopy, true, true ); } } @@ -3215,9 +3207,8 @@ void SAL_CALL ScTableSheetsObj::insertByName( const OUString& aName, const uno:: if ( pSheetObj && !pSheetObj->GetDocShell() ) // noch nicht eingefuegt? { ScDocument& rDoc = pDocShell->GetDocument(); - OUString aNamStr(aName); SCTAB nDummy; - if ( rDoc.GetTable( aNamStr, nDummy ) ) + if ( rDoc.GetTable( aName, nDummy ) ) { // name already exists throw container::ElementExistException(); @@ -3225,7 +3216,7 @@ void SAL_CALL ScTableSheetsObj::insertByName( const OUString& aName, const uno:: else { SCTAB nPosition = rDoc.GetTableCount(); - bDone = pDocShell->GetDocFunc().InsertTable( nPosition, aNamStr, + bDone = pDocShell->GetDocFunc().InsertTable( nPosition, aName, true, true ); if (bDone) pSheetObj->InitInsertSheet( pDocShell, nPosition ); @@ -3272,8 +3263,7 @@ void SAL_CALL ScTableSheetsObj::replaceByName( const OUString& aName, const uno: if ( pDocShell->GetDocFunc().DeleteTable( nPosition, true, true ) ) { // InsertTable kann jetzt eigentlich nicht schiefgehen... - OUString aNamStr(aName); - bDone = pDocShell->GetDocFunc().InsertTable( nPosition, aNamStr, true, true ); + bDone = pDocShell->GetDocFunc().InsertTable( nPosition, aName, true, true ); if (bDone) pSheetObj->InitInsertSheet( pDocShell, nPosition ); } @@ -3542,8 +3532,7 @@ ScTableColumnObj* ScTableColumnsObj::GetObjectByIndex_Impl(sal_Int32 nIndex) con ScTableColumnObj* ScTableColumnsObj::GetObjectByName_Impl(const OUString& aName) const { SCCOL nCol = 0; - OUString aString(aName); - if ( ::AlphaToCol( nCol, aString) ) + if ( ::AlphaToCol( nCol, aName) ) if ( pDocShell && nCol >= nStartCol && nCol <= nEndCol ) return new ScTableColumnObj( pDocShell, nCol, nTab ); @@ -3653,8 +3642,7 @@ sal_Bool SAL_CALL ScTableColumnsObj::hasByName( const OUString& aName ) { SolarMutexGuard aGuard; SCCOL nCol = 0; - OUString aString(aName); - if ( ::AlphaToCol( nCol, aString) ) + if ( ::AlphaToCol( nCol, aName) ) if ( pDocShell && nCol >= nStartCol && nCol <= nEndCol ) return sal_True; @@ -3683,24 +3671,23 @@ void SAL_CALL ScTableColumnsObj::setPropertyValue( throw uno::RuntimeException(); std::vector aColArr(1, sc::ColRowSpan(nStartCol,nEndCol)); - OUString aNameString(aPropertyName); ScDocFunc& rFunc = pDocShell->GetDocFunc(); - if ( aNameString == SC_UNONAME_CELLWID ) + if ( aPropertyName == SC_UNONAME_CELLWID ) { sal_Int32 nNewWidth = 0; if ( aValue >>= nNewWidth ) rFunc.SetWidthOrHeight( true, aColArr, nTab, SC_SIZE_ORIGINAL, (sal_uInt16)HMMToTwips(nNewWidth), true, true); } - else if ( aNameString == SC_UNONAME_CELLVIS ) + else if ( aPropertyName == SC_UNONAME_CELLVIS ) { bool bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue ); ScSizeMode eMode = bVis ? SC_SIZE_SHOW : SC_SIZE_DIRECT; rFunc.SetWidthOrHeight(true, aColArr, nTab, eMode, 0, true, true); // SC_SIZE_DIRECT with size 0: hide } - else if ( aNameString == SC_UNONAME_OWIDTH ) + else if ( aPropertyName == SC_UNONAME_OWIDTH ) { bool bOpt = ScUnoHelpFunctions::GetBoolFromAny( aValue ); if (bOpt) @@ -3708,7 +3695,7 @@ void SAL_CALL ScTableColumnsObj::setPropertyValue( true, aColArr, nTab, SC_SIZE_OPTIMAL, STD_EXTRA_WIDTH, true, true); // sal_False for columns currently has no effect } - else if ( aNameString == SC_UNONAME_NEWPAGE || aNameString == SC_UNONAME_MANPAGE ) + else if ( aPropertyName == SC_UNONAME_NEWPAGE || aPropertyName == SC_UNONAME_MANPAGE ) { //! single function to set/remove all breaks? bool bSet = ScUnoHelpFunctions::GetBoolFromAny( aValue ); @@ -3729,33 +3716,32 @@ uno::Any SAL_CALL ScTableColumnsObj::getPropertyValue( const OUString& aProperty throw uno::RuntimeException(); ScDocument& rDoc = pDocShell->GetDocument(); - OUString aNameString(aPropertyName); uno::Any aAny; //! loop over all columns for current state? - if ( aNameString == SC_UNONAME_CELLWID ) + if ( aPropertyName == SC_UNONAME_CELLWID ) { // for hidden column, return original height sal_uInt16 nWidth = rDoc.GetOriginalWidth( nStartCol, nTab ); aAny <<= (sal_Int32)TwipsToHMM(nWidth); } - else if ( aNameString == SC_UNONAME_CELLVIS ) + else if ( aPropertyName == SC_UNONAME_CELLVIS ) { bool bVis = !rDoc.ColHidden(nStartCol, nTab); ScUnoHelpFunctions::SetBoolInAny( aAny, bVis ); } - else if ( aNameString == SC_UNONAME_OWIDTH ) + else if ( aPropertyName == SC_UNONAME_OWIDTH ) { bool bOpt = !(rDoc.GetColFlags( nStartCol, nTab ) & CR_MANUALSIZE); ScUnoHelpFunctions::SetBoolInAny( aAny, bOpt ); } - else if ( aNameString == SC_UNONAME_NEWPAGE ) + else if ( aPropertyName == SC_UNONAME_NEWPAGE ) { ScBreakType nBreak = rDoc.HasColBreak(nStartCol, nTab); ScUnoHelpFunctions::SetBoolInAny( aAny, nBreak != BREAK_NONE ); } - else if ( aNameString == SC_UNONAME_MANPAGE ) + else if ( aPropertyName == SC_UNONAME_MANPAGE ) { ScBreakType nBreak = rDoc.HasColBreak(nStartCol, nTab); ScUnoHelpFunctions::SetBoolInAny( aAny, (nBreak & BREAK_MANUAL) != 0 ); @@ -3904,9 +3890,8 @@ void SAL_CALL ScTableRowsObj::setPropertyValue( ScDocFunc& rFunc = pDocShell->GetDocFunc(); ScDocument& rDoc = pDocShell->GetDocument(); std::vector aRowArr(1, sc::ColRowSpan(nStartRow,nEndRow)); - OUString aNameString(aPropertyName); - if ( aNameString == SC_UNONAME_OHEIGHT ) + if ( aPropertyName == SC_UNONAME_OHEIGHT ) { sal_Int32 nNewHeight = 0; if ( rDoc.IsImportingXML() && ( aValue >>= nNewHeight ) ) @@ -3928,7 +3913,7 @@ void SAL_CALL ScTableRowsObj::setPropertyValue( } } } - else if ( aNameString == SC_UNONAME_CELLHGT ) + else if ( aPropertyName == SC_UNONAME_CELLHGT ) { sal_Int32 nNewHeight = 0; if ( aValue >>= nNewHeight ) @@ -3946,20 +3931,20 @@ void SAL_CALL ScTableRowsObj::setPropertyValue( false, aRowArr, nTab, SC_SIZE_ORIGINAL, (sal_uInt16)HMMToTwips(nNewHeight), true, true); } } - else if ( aNameString == SC_UNONAME_CELLVIS ) + else if ( aPropertyName == SC_UNONAME_CELLVIS ) { bool bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue ); ScSizeMode eMode = bVis ? SC_SIZE_SHOW : SC_SIZE_DIRECT; rFunc.SetWidthOrHeight(false, aRowArr, nTab, eMode, 0, true, true); // SC_SIZE_DIRECT with size 0: hide } - else if ( aNameString == SC_UNONAME_VISFLAG ) + else if ( aPropertyName == SC_UNONAME_VISFLAG ) { // #i116460# Shortcut to only set the flag, without drawing layer update etc. // Should only be used from import filters. rDoc.SetRowHidden(nStartRow, nEndRow, nTab, !ScUnoHelpFunctions::GetBoolFromAny( aValue )); } - else if ( aNameString == SC_UNONAME_CELLFILT ) + else if ( aPropertyName == SC_UNONAME_CELLFILT ) { //! undo etc. if (ScUnoHelpFunctions::GetBoolFromAny( aValue )) @@ -3967,7 +3952,7 @@ void SAL_CALL ScTableRowsObj::setPropertyValue( else rDoc.SetRowFiltered(nStartRow, nEndRow, nTab, false); } - else if ( aNameString == SC_UNONAME_NEWPAGE || aNameString == SC_UNONAME_MANPAGE ) + else if ( aPropertyName == SC_UNONAME_NEWPAGE || aPropertyName == SC_UNONAME_MANPAGE ) { //! single function to set/remove all breaks? bool bSet = ScUnoHelpFunctions::GetBoolFromAny( aValue ); @@ -3977,7 +3962,7 @@ void SAL_CALL ScTableRowsObj::setPropertyValue( else rFunc.RemovePageBreak( false, ScAddress(0,nRow,nTab), true, true, true ); } - else if ( aNameString == SC_UNONAME_CELLBACK || aNameString == SC_UNONAME_CELLTRAN ) + else if ( aPropertyName == SC_UNONAME_CELLBACK || aPropertyName == SC_UNONAME_CELLTRAN ) { // #i57867# Background color is specified for row styles in the file format, // so it has to be supported along with the row properties (import only). @@ -4000,44 +3985,43 @@ uno::Any SAL_CALL ScTableRowsObj::getPropertyValue( const OUString& aPropertyNam throw uno::RuntimeException(); ScDocument& rDoc = pDocShell->GetDocument(); - OUString aNameString(aPropertyName); uno::Any aAny; //! loop over all rows for current state? - if ( aNameString == SC_UNONAME_CELLHGT ) + if ( aPropertyName == SC_UNONAME_CELLHGT ) { // for hidden row, return original height sal_uInt16 nHeight = rDoc.GetOriginalHeight( nStartRow, nTab ); aAny <<= (sal_Int32)TwipsToHMM(nHeight); } - else if ( aNameString == SC_UNONAME_CELLVIS ) + else if ( aPropertyName == SC_UNONAME_CELLVIS ) { SCROW nLastRow; bool bVis = !rDoc.RowHidden(nStartRow, nTab, nullptr, &nLastRow); ScUnoHelpFunctions::SetBoolInAny( aAny, bVis ); } - else if ( aNameString == SC_UNONAME_CELLFILT ) + else if ( aPropertyName == SC_UNONAME_CELLFILT ) { bool bVis = rDoc.RowFiltered(nStartRow, nTab); ScUnoHelpFunctions::SetBoolInAny( aAny, bVis ); } - else if ( aNameString == SC_UNONAME_OHEIGHT ) + else if ( aPropertyName == SC_UNONAME_OHEIGHT ) { bool bOpt = !(rDoc.GetRowFlags( nStartRow, nTab ) & CR_MANUALSIZE); ScUnoHelpFunctions::SetBoolInAny( aAny, bOpt ); } - else if ( aNameString == SC_UNONAME_NEWPAGE ) + else if ( aPropertyName == SC_UNONAME_NEWPAGE ) { ScBreakType nBreak = rDoc.HasRowBreak(nStartRow, nTab); ScUnoHelpFunctions::SetBoolInAny( aAny, nBreak != BREAK_NONE ); } - else if ( aNameString == SC_UNONAME_MANPAGE ) + else if ( aPropertyName == SC_UNONAME_MANPAGE ) { ScBreakType nBreak = rDoc.HasRowBreak(nStartRow, nTab); ScUnoHelpFunctions::SetBoolInAny( aAny, (nBreak & BREAK_MANUAL) != 0 ); } - else if ( aNameString == SC_UNONAME_CELLBACK || aNameString == SC_UNONAME_CELLTRAN ) + else if ( aPropertyName == SC_UNONAME_CELLBACK || aPropertyName == SC_UNONAME_CELLTRAN ) { // Use ScCellRangeObj to get the property from the cell range // (for completeness only, this is not used by the XML filter). @@ -4325,13 +4309,10 @@ void SAL_CALL ScScenariosObj::addNewByName( const OUString& aName, } } - OUString aNameStr(aName); - OUString aCommStr(aComment); - Color aColor( COL_LIGHTGRAY ); // Default sal_uInt16 nFlags = SC_SCENARIO_SHOWFRAME | SC_SCENARIO_PRINTFRAME | SC_SCENARIO_TWOWAY | SC_SCENARIO_PROTECT; - pDocShell->MakeScenario( nTab, aNameStr, aCommStr, aColor, nFlags, aMarkData ); + pDocShell->MakeScenario( nTab, aName, aComment, aColor, nFlags, aMarkData ); } } diff --git a/sc/source/ui/unoobj/fmtuno.cxx b/sc/source/ui/unoobj/fmtuno.cxx index 1c83d4a5b353..f626ba271a5c 100644 --- a/sc/source/ui/unoobj/fmtuno.cxx +++ b/sc/source/ui/unoobj/fmtuno.cxx @@ -833,37 +833,36 @@ void SAL_CALL ScTableValidationObj::setPropertyValue( uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - OUString aString(aPropertyName); - if ( aString == SC_UNONAME_SHOWINP ) bShowInput = ScUnoHelpFunctions::GetBoolFromAny( aValue ); - else if ( aString == SC_UNONAME_SHOWERR ) bShowError = ScUnoHelpFunctions::GetBoolFromAny( aValue ); - else if ( aString == SC_UNONAME_IGNOREBL ) bIgnoreBlank = ScUnoHelpFunctions::GetBoolFromAny( aValue ); - else if ( aString == SC_UNONAME_SHOWLIST ) aValue >>= nShowList; - else if ( aString == SC_UNONAME_INPTITLE ) + if ( aPropertyName == SC_UNONAME_SHOWINP ) bShowInput = ScUnoHelpFunctions::GetBoolFromAny( aValue ); + else if ( aPropertyName == SC_UNONAME_SHOWERR ) bShowError = ScUnoHelpFunctions::GetBoolFromAny( aValue ); + else if ( aPropertyName == SC_UNONAME_IGNOREBL ) bIgnoreBlank = ScUnoHelpFunctions::GetBoolFromAny( aValue ); + else if ( aPropertyName == SC_UNONAME_SHOWLIST ) aValue >>= nShowList; + else if ( aPropertyName == SC_UNONAME_INPTITLE ) { OUString aStrVal; if ( aValue >>= aStrVal ) aInputTitle = aStrVal; } - else if ( aString == SC_UNONAME_INPMESS ) + else if ( aPropertyName == SC_UNONAME_INPMESS ) { OUString aStrVal; if ( aValue >>= aStrVal ) aInputMessage = aStrVal; } - else if ( aString == SC_UNONAME_ERRTITLE ) + else if ( aPropertyName == SC_UNONAME_ERRTITLE ) { OUString aStrVal; if ( aValue >>= aStrVal ) aErrorTitle = aStrVal; } - else if ( aString == SC_UNONAME_ERRMESS ) + else if ( aPropertyName == SC_UNONAME_ERRMESS ) { OUString aStrVal; if ( aValue >>= aStrVal ) aErrorMessage = aStrVal; } - else if ( aString == SC_UNONAME_TYPE ) + else if ( aPropertyName == SC_UNONAME_TYPE ) { sheet::ValidationType eType = (sheet::ValidationType) ScUnoHelpFunctions::GetEnumFromAny( aValue ); @@ -883,7 +882,7 @@ void SAL_CALL ScTableValidationObj::setPropertyValue( } } } - else if ( aString == SC_UNONAME_ERRALSTY ) + else if ( aPropertyName == SC_UNONAME_ERRALSTY ) { sheet::ValidationAlertStyle eStyle = (sheet::ValidationAlertStyle) ScUnoHelpFunctions::GetEnumFromAny( aValue ); @@ -899,7 +898,7 @@ void SAL_CALL ScTableValidationObj::setPropertyValue( } } } - else if ( aString == SC_UNONAME_SOURCESTR ) + else if ( aPropertyName == SC_UNONAME_SOURCESTR ) { // internal - only for XML filter, not in PropertySetInfo, only set @@ -907,7 +906,7 @@ void SAL_CALL ScTableValidationObj::setPropertyValue( if ( aValue >>= aStrVal ) aPosString = aStrVal; } - else if ( aString == SC_UNONAME_FORMULANMSP1 ) + else if ( aPropertyName == SC_UNONAME_FORMULANMSP1 ) { // internal - only for XML filter, not in PropertySetInfo, only set @@ -915,7 +914,7 @@ void SAL_CALL ScTableValidationObj::setPropertyValue( if ( aValue >>= aStrVal ) maExprNmsp1 = aStrVal; } - else if ( aString == SC_UNONAME_FORMULANMSP2 ) + else if ( aPropertyName == SC_UNONAME_FORMULANMSP2 ) { // internal - only for XML filter, not in PropertySetInfo, only set @@ -923,7 +922,7 @@ void SAL_CALL ScTableValidationObj::setPropertyValue( if ( aValue >>= aStrVal ) maExprNmsp2 = aStrVal; } - else if ( aString == SC_UNONAME_GRAMMAR1 ) + else if ( aPropertyName == SC_UNONAME_GRAMMAR1 ) { // internal - only for XML filter, not in PropertySetInfo, only set @@ -931,7 +930,7 @@ void SAL_CALL ScTableValidationObj::setPropertyValue( if ( aValue >>= nVal ) meGrammar1 = static_cast< FormulaGrammar::Grammar >(nVal); } - else if ( aString == SC_UNONAME_GRAMMAR2 ) + else if ( aPropertyName == SC_UNONAME_GRAMMAR2 ) { // internal - only for XML filter, not in PropertySetInfo, only set @@ -946,18 +945,17 @@ uno::Any SAL_CALL ScTableValidationObj::getPropertyValue( const OUString& aPrope uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - OUString aString(aPropertyName); uno::Any aRet; - if ( aString == SC_UNONAME_SHOWINP ) ScUnoHelpFunctions::SetBoolInAny( aRet, bShowInput ); - else if ( aString == SC_UNONAME_SHOWERR ) ScUnoHelpFunctions::SetBoolInAny( aRet, bShowError ); - else if ( aString == SC_UNONAME_IGNOREBL ) ScUnoHelpFunctions::SetBoolInAny( aRet, bIgnoreBlank ); - else if ( aString == SC_UNONAME_SHOWLIST ) aRet <<= nShowList; - else if ( aString == SC_UNONAME_INPTITLE ) aRet <<= OUString( aInputTitle ); - else if ( aString == SC_UNONAME_INPMESS ) aRet <<= OUString( aInputMessage ); - else if ( aString == SC_UNONAME_ERRTITLE ) aRet <<= OUString( aErrorTitle ); - else if ( aString == SC_UNONAME_ERRMESS ) aRet <<= OUString( aErrorMessage ); - else if ( aString == SC_UNONAME_TYPE ) + if ( aPropertyName == SC_UNONAME_SHOWINP ) ScUnoHelpFunctions::SetBoolInAny( aRet, bShowInput ); + else if ( aPropertyName == SC_UNONAME_SHOWERR ) ScUnoHelpFunctions::SetBoolInAny( aRet, bShowError ); + else if ( aPropertyName == SC_UNONAME_IGNOREBL ) ScUnoHelpFunctions::SetBoolInAny( aRet, bIgnoreBlank ); + else if ( aPropertyName == SC_UNONAME_SHOWLIST ) aRet <<= nShowList; + else if ( aPropertyName == SC_UNONAME_INPTITLE ) aRet <<= OUString( aInputTitle ); + else if ( aPropertyName == SC_UNONAME_INPMESS ) aRet <<= OUString( aInputMessage ); + else if ( aPropertyName == SC_UNONAME_ERRTITLE ) aRet <<= OUString( aErrorTitle ); + else if ( aPropertyName == SC_UNONAME_ERRMESS ) aRet <<= OUString( aErrorMessage ); + else if ( aPropertyName == SC_UNONAME_TYPE ) { sheet::ValidationType eType = sheet::ValidationType_ANY; switch (nValMode) @@ -973,7 +971,7 @@ uno::Any SAL_CALL ScTableValidationObj::getPropertyValue( const OUString& aPrope } aRet <<= eType; } - else if ( aString == SC_UNONAME_ERRALSTY ) + else if ( aPropertyName == SC_UNONAME_ERRALSTY ) { sheet::ValidationAlertStyle eStyle = sheet::ValidationAlertStyle_STOP; switch (nErrorStyle) diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx index 90ecc9caec54..0ec86590bee2 100644 --- a/sc/source/ui/unoobj/funcuno.cxx +++ b/sc/source/ui/unoobj/funcuno.cxx @@ -519,7 +519,7 @@ uno::Any SAL_CALL ScFunctionAccess::callFunction( const OUString& aName, const uno::Any& rArg = pArgArr[nPos]; uno::TypeClass eClass = rArg.getValueTypeClass(); - uno::Type aType = rArg.getValueType(); + const uno::Type& aType = rArg.getValueType(); if ( eClass == uno::TypeClass_BYTE || eClass == uno::TypeClass_BOOLEAN || eClass == uno::TypeClass_SHORT || diff --git a/sc/source/ui/unoobj/linkuno.cxx b/sc/source/ui/unoobj/linkuno.cxx index f2addd6df475..1f19686d0720 100644 --- a/sc/source/ui/unoobj/linkuno.cxx +++ b/sc/source/ui/unoobj/linkuno.cxx @@ -214,30 +214,29 @@ void SAL_CALL ScSheetLinkObj::setPropertyValue( uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - OUString aNameString(aPropertyName); OUString aValStr; - if ( aNameString == SC_UNONAME_LINKURL ) + if ( aPropertyName == SC_UNONAME_LINKURL ) { if ( aValue >>= aValStr ) setFileName( aValStr ); } - else if ( aNameString == SC_UNONAME_FILTER ) + else if ( aPropertyName == SC_UNONAME_FILTER ) { if ( aValue >>= aValStr ) setFilter( aValStr ); } - else if ( aNameString == SC_UNONAME_FILTOPT ) + else if ( aPropertyName == SC_UNONAME_FILTOPT ) { if ( aValue >>= aValStr ) setFilterOptions( aValStr ); } - else if ( aNameString == SC_UNONAME_REFPERIOD ) + else if ( aPropertyName == SC_UNONAME_REFPERIOD ) { sal_Int32 nRefresh = 0; if ( aValue >>= nRefresh ) setRefreshDelay( nRefresh ); } - else if ( aNameString == SC_UNONAME_REFDELAY ) + else if ( aPropertyName == SC_UNONAME_REFDELAY ) { sal_Int32 nRefresh = 0; if ( aValue >>= nRefresh ) @@ -250,17 +249,16 @@ uno::Any SAL_CALL ScSheetLinkObj::getPropertyValue( const OUString& aPropertyNam uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - OUString aNameString(aPropertyName); uno::Any aRet; - if ( aNameString == SC_UNONAME_LINKURL ) + if ( aPropertyName == SC_UNONAME_LINKURL ) aRet <<= getFileName(); - else if ( aNameString == SC_UNONAME_FILTER ) + else if ( aPropertyName == SC_UNONAME_FILTER ) aRet <<= getFilter(); - else if ( aNameString == SC_UNONAME_FILTOPT ) + else if ( aPropertyName == SC_UNONAME_FILTOPT ) aRet <<= getFilterOptions(); - else if ( aNameString == SC_UNONAME_REFPERIOD ) + else if ( aPropertyName == SC_UNONAME_REFPERIOD ) aRet <<= getRefreshDelay(); - else if ( aNameString == SC_UNONAME_REFDELAY ) + else if ( aPropertyName == SC_UNONAME_REFDELAY ) aRet <<= getRefreshDelay(); return aRet; } @@ -321,14 +319,13 @@ OUString ScSheetLinkObj::getFilter() const return aRet; } -void ScSheetLinkObj::setFilter(const OUString& Filter) +void ScSheetLinkObj::setFilter(const OUString& rFilter) { SolarMutexGuard aGuard; ScTableLink* pLink = GetLink_Impl(); if (pLink) { - OUString aFilterStr(Filter); - pLink->Refresh( aFileName, aFilterStr, nullptr, pLink->GetRefreshDelay() ); + pLink->Refresh( aFileName, rFilter, nullptr, pLink->GetRefreshDelay() ); } } @@ -430,8 +427,6 @@ ScSheetLinkObj* ScSheetLinksObj::GetObjectByName_Impl(const OUString& aName) if (pDocShell) { - OUString aNameStr(aName); - ScDocument& rDoc = pDocShell->GetDocument(); SCTAB nTabCount = rDoc.GetTableCount(); for (SCTAB nTab=0; nTabGetDocument(); SCTAB nTabCount = rDoc.GetTableCount(); for (SCTAB nTab=0; nTab>= aValStr ) setFileName( aValStr ); } - else if ( aNameString == SC_UNONAME_FILTER ) + else if ( aPropertyName == SC_UNONAME_FILTER ) { if ( aValue >>= aValStr ) setFilter( aValStr ); } - else if ( aNameString == SC_UNONAME_FILTOPT ) + else if ( aPropertyName == SC_UNONAME_FILTOPT ) { if ( aValue >>= aValStr ) setFilterOptions( aValStr ); } - else if ( aNameString == SC_UNONAME_REFPERIOD ) + else if ( aPropertyName == SC_UNONAME_REFPERIOD ) { sal_Int32 nRefresh = 0; if ( aValue >>= nRefresh ) setRefreshDelay( nRefresh ); } - else if ( aNameString == SC_UNONAME_REFDELAY ) + else if ( aPropertyName == SC_UNONAME_REFDELAY ) { sal_Int32 nRefresh = 0; if ( aValue >>= nRefresh ) @@ -793,17 +785,16 @@ uno::Any SAL_CALL ScAreaLinkObj::getPropertyValue( const OUString& aPropertyName uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - OUString aNameString(aPropertyName); uno::Any aRet; - if ( aNameString == SC_UNONAME_LINKURL ) + if ( aPropertyName == SC_UNONAME_LINKURL ) aRet <<= getFileName(); - else if ( aNameString == SC_UNONAME_FILTER ) + else if ( aPropertyName == SC_UNONAME_FILTER ) aRet <<= getFilter(); - else if ( aNameString == SC_UNONAME_FILTOPT ) + else if ( aPropertyName == SC_UNONAME_FILTOPT ) aRet <<= getFilterOptions(); - else if ( aNameString == SC_UNONAME_REFPERIOD ) + else if ( aPropertyName == SC_UNONAME_REFPERIOD ) aRet <<= getRefreshDelay(); - else if ( aNameString == SC_UNONAME_REFDELAY ) + else if ( aPropertyName == SC_UNONAME_REFDELAY ) aRet <<= getRefreshDelay(); return aRet; } @@ -958,14 +949,11 @@ void SAL_CALL ScAreaLinksObj::insertAtPosition( const table::CellAddress& aDestP if (pDocShell) { OUString aFileStr (aFileName); - OUString aFilterStr (aFilter); - OUString aOptionStr (aFilterOptions); - OUString aSourceStr (aSourceArea); ScAddress aDestAddr( (SCCOL)aDestPos.Column, (SCROW)aDestPos.Row, aDestPos.Sheet ); aFileStr = ScGlobal::GetAbsDocName( aFileStr, pDocShell ); //! in InsertAreaLink ??? - pDocShell->GetDocFunc().InsertAreaLink( aFileStr, aFilterStr, aOptionStr, - aSourceStr, ScRange(aDestAddr), + pDocShell->GetDocFunc().InsertAreaLink( aFileStr, aFilter, aFilterOptions, + aSourceArea, ScRange(aDestAddr), 0, false, true ); // don't move contents } } @@ -1279,7 +1267,6 @@ ScDDELinkObj* ScDDELinksObj::GetObjectByName_Impl(const OUString& aName) { if (pDocShell) { - OUString aNamStr(aName); OUString aAppl, aTopic, aItem; ScDocument& rDoc = pDocShell->GetDocument(); @@ -1287,7 +1274,7 @@ ScDDELinkObj* ScDDELinksObj::GetObjectByName_Impl(const OUString& aName) for (size_t i=0; iGetDocument(); @@ -1386,7 +1372,7 @@ sal_Bool SAL_CALL ScDDELinksObj::hasByName( const OUString& aName ) for (size_t i=0; i xRangeAdd(aValue, uno::UNO_QUERY); if (xRangeAdd.is()) @@ -436,7 +435,7 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const else throw lang::IllegalArgumentException("only XCell or XSpreadsheet objects allowed", static_cast(this), 0); } - else if ( aNameString == SC_UNONAME_IMAGEMAP ) + else if ( aPropertyName == SC_UNONAME_IMAGEMAP ) { SdrObject* pObj = GetSdrObject(); if ( pObj ) @@ -460,7 +459,7 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const } } } - else if ( aNameString == SC_UNONAME_HORIPOS ) + else if ( aPropertyName == SC_UNONAME_HORIPOS ) { sal_Int32 nPos = 0; if (aValue >>= nPos) @@ -558,7 +557,7 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const } } } - else if ( aNameString == SC_UNONAME_VERTPOS ) + else if ( aPropertyName == SC_UNONAME_VERTPOS ) { sal_Int32 nPos = 0; if (aValue >>= nPos) @@ -627,15 +626,15 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const } } } - else if ( aNameString == SC_UNONAME_HYPERLINK || - aNameString == SC_UNONAME_URL ) + else if ( aPropertyName == SC_UNONAME_HYPERLINK || + aPropertyName == SC_UNONAME_URL ) { OUString sHlink; ScMacroInfo* pInfo = ScShapeObj_getShapeHyperMacroInfo(this, true); if ( ( aValue >>= sHlink ) && pInfo ) pInfo->SetHlink( sHlink ); } - else if ( aNameString == SC_UNONAME_MOVEPROTECT ) + else if ( aPropertyName == SC_UNONAME_MOVEPROTECT ) { if( SdrObject* pObj = this->GetSdrObject() ) { @@ -657,10 +656,9 @@ uno::Any SAL_CALL ScShapeObj::getPropertyValue( const OUString& aPropertyName ) uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - OUString aNameString = aPropertyName; uno::Any aAny; - if ( aNameString == SC_UNONAME_ANCHOR ) + if ( aPropertyName == SC_UNONAME_ANCHOR ) { SdrObject *pObj = GetSdrObject(); if (pObj) @@ -691,7 +689,7 @@ uno::Any SAL_CALL ScShapeObj::getPropertyValue( const OUString& aPropertyName ) } } } - else if ( aNameString == SC_UNONAME_IMAGEMAP ) + else if ( aPropertyName == SC_UNONAME_IMAGEMAP ) { uno::Reference< uno::XInterface > xImageMap; SdrObject* pObj = GetSdrObject(); @@ -708,7 +706,7 @@ uno::Any SAL_CALL ScShapeObj::getPropertyValue( const OUString& aPropertyName ) } aAny <<= uno::Reference< container::XIndexContainer >::query( xImageMap ); } - else if ( aNameString == SC_UNONAME_HORIPOS ) + else if ( aPropertyName == SC_UNONAME_HORIPOS ) { SdrObject *pObj = GetSdrObject(); if (pObj) @@ -767,7 +765,7 @@ uno::Any SAL_CALL ScShapeObj::getPropertyValue( const OUString& aPropertyName ) } } } - else if ( aNameString == SC_UNONAME_VERTPOS ) + else if ( aPropertyName == SC_UNONAME_VERTPOS ) { SdrObject *pObj = GetSdrObject(); if (pObj) @@ -812,15 +810,15 @@ uno::Any SAL_CALL ScShapeObj::getPropertyValue( const OUString& aPropertyName ) } } } - else if ( aNameString == SC_UNONAME_HYPERLINK || - aNameString == SC_UNONAME_URL ) + else if ( aPropertyName == SC_UNONAME_HYPERLINK || + aPropertyName == SC_UNONAME_URL ) { OUString sHlink; if ( ScMacroInfo* pInfo = ScShapeObj_getShapeHyperMacroInfo(this) ) sHlink = pInfo->GetHlink(); aAny <<= sHlink; } - else if ( aNameString == SC_UNONAME_MOVEPROTECT ) + else if ( aPropertyName == SC_UNONAME_MOVEPROTECT ) { bool aProt = false; if ( SdrObject* pObj = this->GetSdrObject() ) @@ -904,22 +902,21 @@ beans::PropertyState SAL_CALL ScShapeObj::getPropertyState( const OUString& aPro throw(beans::UnknownPropertyException, uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - OUString aNameString(aPropertyName); beans::PropertyState eRet = beans::PropertyState_DIRECT_VALUE; - if ( aNameString == SC_UNONAME_IMAGEMAP ) + if ( aPropertyName == SC_UNONAME_IMAGEMAP ) { // ImageMap is always "direct" } - else if ( aNameString == SC_UNONAME_ANCHOR ) + else if ( aPropertyName == SC_UNONAME_ANCHOR ) { // Anchor is always "direct" } - else if ( aNameString == SC_UNONAME_HORIPOS ) + else if ( aPropertyName == SC_UNONAME_HORIPOS ) { // HoriPos is always "direct" } - else if ( aNameString == SC_UNONAME_VERTPOS ) + else if ( aPropertyName == SC_UNONAME_VERTPOS ) { // VertPos is always "direct" } @@ -954,9 +951,8 @@ void SAL_CALL ScShapeObj::setPropertyToDefault( const OUString& aPropertyName ) std::exception) { SolarMutexGuard aGuard; - OUString aNameString(aPropertyName); - if ( aNameString == SC_UNONAME_IMAGEMAP ) + if ( aPropertyName == SC_UNONAME_IMAGEMAP ) { SdrObject* pObj = GetSdrObject(); if ( pObj ) @@ -986,10 +982,9 @@ uno::Any SAL_CALL ScShapeObj::getPropertyDefault( const OUString& aPropertyName uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - OUString aNameString = aPropertyName; uno::Any aAny; - if ( aNameString == SC_UNONAME_IMAGEMAP ) + if ( aPropertyName == SC_UNONAME_IMAGEMAP ) { // default: empty ImageMap uno::Reference< uno::XInterface > xImageMap(SvUnoImageMap_createInstance( GetSupportedMacroItems() )); diff --git a/sc/source/ui/unoobj/srchuno.cxx b/sc/source/ui/unoobj/srchuno.cxx index 1ad31eb41f5e..eb17c17af103 100644 --- a/sc/source/ui/unoobj/srchuno.cxx +++ b/sc/source/ui/unoobj/srchuno.cxx @@ -142,23 +142,22 @@ void SAL_CALL ScCellSearchObj::setPropertyValue( uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - OUString aString(aPropertyName); - - if (aString == SC_UNO_SRCHBACK) pSearchItem->SetBackward( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if (aString == SC_UNO_SRCHBYROW) pSearchItem->SetRowDirection( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if (aString == SC_UNO_SRCHCASE) pSearchItem->SetExact( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if (aString == SC_UNO_SRCHREGEXP) pSearchItem->SetRegExp( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if (aString == SC_UNO_SRCHWILDCARD) pSearchItem->SetWildcard( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if (aString == SC_UNO_SRCHSIM) pSearchItem->SetLevenshtein( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if (aString == SC_UNO_SRCHSIMREL) pSearchItem->SetLEVRelaxed( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if (aString == SC_UNO_SRCHSTYLES) pSearchItem->SetPattern( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if (aString == SC_UNO_SRCHWORDS) pSearchItem->SetWordOnly( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if (aString == SC_UNO_SRCHSIMADD) pSearchItem->SetLEVLonger( ScUnoHelpFunctions::GetInt16FromAny( aValue ) ); - else if (aString == SC_UNO_SRCHSIMEX) pSearchItem->SetLEVOther( ScUnoHelpFunctions::GetInt16FromAny( aValue ) ); - else if (aString == SC_UNO_SRCHSIMREM) pSearchItem->SetLEVShorter( ScUnoHelpFunctions::GetInt16FromAny( aValue ) ); - else if (aString == SC_UNO_SRCHTYPE) pSearchItem->SetCellType( static_cast(ScUnoHelpFunctions::GetInt16FromAny( aValue )) ); - else if (aString == SC_UNO_SRCHFILTERED) pSearchItem->SetSearchFiltered( ScUnoHelpFunctions::GetBoolFromAny(aValue) ); - else if (aString == SC_UNO_SRCHFORMATTED) pSearchItem->SetSearchFormatted( ScUnoHelpFunctions::GetBoolFromAny(aValue) ); + + if (aPropertyName == SC_UNO_SRCHBACK) pSearchItem->SetBackward( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); + else if (aPropertyName == SC_UNO_SRCHBYROW) pSearchItem->SetRowDirection( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); + else if (aPropertyName == SC_UNO_SRCHCASE) pSearchItem->SetExact( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); + else if (aPropertyName == SC_UNO_SRCHREGEXP) pSearchItem->SetRegExp( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); + else if (aPropertyName == SC_UNO_SRCHWILDCARD) pSearchItem->SetWildcard( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); + else if (aPropertyName == SC_UNO_SRCHSIM) pSearchItem->SetLevenshtein( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); + else if (aPropertyName == SC_UNO_SRCHSIMREL) pSearchItem->SetLEVRelaxed( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); + else if (aPropertyName == SC_UNO_SRCHSTYLES) pSearchItem->SetPattern( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); + else if (aPropertyName == SC_UNO_SRCHWORDS) pSearchItem->SetWordOnly( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); + else if (aPropertyName == SC_UNO_SRCHSIMADD) pSearchItem->SetLEVLonger( ScUnoHelpFunctions::GetInt16FromAny( aValue ) ); + else if (aPropertyName == SC_UNO_SRCHSIMEX) pSearchItem->SetLEVOther( ScUnoHelpFunctions::GetInt16FromAny( aValue ) ); + else if (aPropertyName == SC_UNO_SRCHSIMREM) pSearchItem->SetLEVShorter( ScUnoHelpFunctions::GetInt16FromAny( aValue ) ); + else if (aPropertyName == SC_UNO_SRCHTYPE) pSearchItem->SetCellType( static_cast(ScUnoHelpFunctions::GetInt16FromAny( aValue )) ); + else if (aPropertyName == SC_UNO_SRCHFILTERED) pSearchItem->SetSearchFiltered( ScUnoHelpFunctions::GetBoolFromAny(aValue) ); + else if (aPropertyName == SC_UNO_SRCHFORMATTED) pSearchItem->SetSearchFormatted( ScUnoHelpFunctions::GetBoolFromAny(aValue) ); } uno::Any SAL_CALL ScCellSearchObj::getPropertyValue( const OUString& aPropertyName ) @@ -166,24 +165,23 @@ uno::Any SAL_CALL ScCellSearchObj::getPropertyValue( const OUString& aPropertyNa uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - OUString aString(aPropertyName); uno::Any aRet; - if (aString == SC_UNO_SRCHBACK) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->GetBackward() ); - else if (aString == SC_UNO_SRCHBYROW) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->GetRowDirection() ); - else if (aString == SC_UNO_SRCHCASE) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->GetExact() ); - else if (aString == SC_UNO_SRCHREGEXP) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->GetRegExp() ); - else if (aString == SC_UNO_SRCHWILDCARD) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->GetWildcard() ); - else if (aString == SC_UNO_SRCHSIM) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->IsLevenshtein() ); - else if (aString == SC_UNO_SRCHSIMREL) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->IsLEVRelaxed() ); - else if (aString == SC_UNO_SRCHSTYLES) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->GetPattern() ); - else if (aString == SC_UNO_SRCHWORDS) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->GetWordOnly() ); - else if (aString == SC_UNO_SRCHSIMADD) aRet <<= (sal_Int16) pSearchItem->GetLEVLonger(); - else if (aString == SC_UNO_SRCHSIMEX) aRet <<= (sal_Int16) pSearchItem->GetLEVOther(); - else if (aString == SC_UNO_SRCHSIMREM) aRet <<= (sal_Int16) pSearchItem->GetLEVShorter(); - else if (aString == SC_UNO_SRCHTYPE) aRet <<= (sal_Int16) pSearchItem->GetCellType(); - else if (aString == SC_UNO_SRCHFILTERED) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->IsSearchFiltered() ); - else if (aString == SC_UNO_SRCHFORMATTED) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->IsSearchFormatted() ); + if (aPropertyName == SC_UNO_SRCHBACK) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->GetBackward() ); + else if (aPropertyName == SC_UNO_SRCHBYROW) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->GetRowDirection() ); + else if (aPropertyName == SC_UNO_SRCHCASE) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->GetExact() ); + else if (aPropertyName == SC_UNO_SRCHREGEXP) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->GetRegExp() ); + else if (aPropertyName == SC_UNO_SRCHWILDCARD) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->GetWildcard() ); + else if (aPropertyName == SC_UNO_SRCHSIM) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->IsLevenshtein() ); + else if (aPropertyName == SC_UNO_SRCHSIMREL) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->IsLEVRelaxed() ); + else if (aPropertyName == SC_UNO_SRCHSTYLES) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->GetPattern() ); + else if (aPropertyName == SC_UNO_SRCHWORDS) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->GetWordOnly() ); + else if (aPropertyName == SC_UNO_SRCHSIMADD) aRet <<= (sal_Int16) pSearchItem->GetLEVLonger(); + else if (aPropertyName == SC_UNO_SRCHSIMEX) aRet <<= (sal_Int16) pSearchItem->GetLEVOther(); + else if (aPropertyName == SC_UNO_SRCHSIMREM) aRet <<= (sal_Int16) pSearchItem->GetLEVShorter(); + else if (aPropertyName == SC_UNO_SRCHTYPE) aRet <<= (sal_Int16) pSearchItem->GetCellType(); + else if (aPropertyName == SC_UNO_SRCHFILTERED) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->IsSearchFiltered() ); + else if (aPropertyName == SC_UNO_SRCHFORMATTED) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->IsSearchFormatted() ); return aRet; } diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx index 6dd6b5701a47..cbe5f23dd7f1 100644 --- a/sc/source/ui/unoobj/styleuno.cxx +++ b/sc/source/ui/unoobj/styleuno.cxx @@ -447,10 +447,9 @@ ScStyleFamilyObj* ScStyleFamiliesObj::GetObjectByName_Impl(const OUString& aName { if ( pDocShell ) { - OUString aNameStr( aName ); - if ( aNameStr == SC_FAMILYNAME_CELL ) + if ( aName == SC_FAMILYNAME_CELL ) return new ScStyleFamilyObj( pDocShell, SFX_STYLE_FAMILY_PARA ); - else if ( aNameStr == SC_FAMILYNAME_PAGE ) + else if ( aName == SC_FAMILYNAME_PAGE ) return new ScStyleFamilyObj( pDocShell, SFX_STYLE_FAMILY_PAGE ); } // no assertion - called directly from getByName @@ -518,9 +517,7 @@ uno::Sequence SAL_CALL ScStyleFamiliesObj::getElementNames() sal_Bool SAL_CALL ScStyleFamiliesObj::hasByName( const OUString& aName ) throw(uno::RuntimeException, std::exception) { - SolarMutexGuard aGuard; - OUString aNameStr( aName ); - return aNameStr == SC_FAMILYNAME_CELL || aNameStr == SC_FAMILYNAME_PAGE; + return aName == SC_FAMILYNAME_CELL || aName == SC_FAMILYNAME_PAGE; } // style::XStyleLoader @@ -663,12 +660,10 @@ ScStyleObj* ScStyleFamilyObj::GetObjectByName_Impl(const OUString& aName) { if ( pDocShell ) { - OUString aString(aName); - ScDocument& rDoc = pDocShell->GetDocument(); ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool(); - if ( pStylePool->Find( aString, eFamily ) ) - return new ScStyleObj( pDocShell, eFamily, aString ); + if ( pStylePool->Find( aName, eFamily ) ) + return new ScStyleObj( pDocShell, eFamily, aName ); } return nullptr; } @@ -1144,15 +1139,14 @@ void SAL_CALL ScStyleObj::setName( const OUString& aNewName ) //! DocFunc-Funktion?? //! Undo ????????????? - OUString aString(aNewName); - bool bOk = pStyle->SetName( aString ); + bool bOk = pStyle->SetName( aNewName ); if (bOk) { - aStyleName = aString; //! notify other objects for this style? + aStyleName = aNewName; //! notify other objects for this style? ScDocument& rDoc = pDocShell->GetDocument(); if ( eFamily == SFX_STYLE_FAMILY_PARA && !rDoc.IsImportingXML() ) - rDoc.GetPool()->CellStyleCreated( aString, &rDoc ); + rDoc.GetPool()->CellStyleCreated( aNewName, &rDoc ); // Zellvorlagen = 2, Seitenvorlagen = 4 sal_uInt16 nId = ( eFamily == SFX_STYLE_FAMILY_PARA ) ? diff --git a/sc/source/ui/unoobj/targuno.cxx b/sc/source/ui/unoobj/targuno.cxx index 17da342e3ab8..ead87f8fecd5 100644 --- a/sc/source/ui/unoobj/targuno.cxx +++ b/sc/source/ui/unoobj/targuno.cxx @@ -95,9 +95,8 @@ uno::Any SAL_CALL ScLinkTargetTypesObj::getByName(const OUString& aName) { if (pDocShell) { - OUString aNameStr(aName); for (sal_uInt16 i=0; i(new ScLinkTargetTypeObj( pDocShell, i ))); } @@ -115,9 +114,8 @@ uno::Sequence SAL_CALL ScLinkTargetTypesObj::getElementNames() throw( sal_Bool SAL_CALL ScLinkTargetTypesObj::hasByName(const OUString& aName) throw( uno::RuntimeException, std::exception ) { - OUString aNameStr = aName; for (sal_uInt16 i=0; i>= mbCompileFAP; } - else if ( aString == SC_UNO_COMPILEENGLISH ) + else if ( aPropertyName == SC_UNO_COMPILEENGLISH ) { bool bOldEnglish = mbEnglish; if (aValue >>= mbEnglish) @@ -215,15 +214,15 @@ void SAL_CALL ScFormulaParserObj::setPropertyValue( else throw lang::IllegalArgumentException(); } - else if ( aString == SC_UNO_FORMULACONVENTION ) + else if ( aPropertyName == SC_UNO_FORMULACONVENTION ) { aValue >>= mnConv; } - else if ( aString == SC_UNO_IGNORELEADING ) + else if ( aPropertyName == SC_UNO_IGNORELEADING ) { aValue >>= mbIgnoreSpaces; } - else if ( aString == SC_UNO_OPCODEMAP ) + else if ( aPropertyName == SC_UNO_OPCODEMAP ) { if (aValue >>= maOpCodeMapping) { @@ -235,7 +234,7 @@ void SAL_CALL ScFormulaParserObj::setPropertyValue( else throw lang::IllegalArgumentException(); } - else if ( aString == SC_UNO_EXTERNALLINKS ) + else if ( aPropertyName == SC_UNO_EXTERNALLINKS ) { if (!(aValue >>= maExternalLinks)) throw lang::IllegalArgumentException(); @@ -250,28 +249,27 @@ uno::Any SAL_CALL ScFormulaParserObj::getPropertyValue( const OUString& aPropert { SolarMutexGuard aGuard; uno::Any aRet; - OUString aString(aPropertyName); - if ( aString == SC_UNO_COMPILEFAP ) + if ( aPropertyName == SC_UNO_COMPILEFAP ) { aRet <<= mbCompileFAP; } - else if ( aString == SC_UNO_COMPILEENGLISH ) + else if ( aPropertyName == SC_UNO_COMPILEENGLISH ) { aRet <<= mbEnglish; } - else if ( aString == SC_UNO_FORMULACONVENTION ) + else if ( aPropertyName == SC_UNO_FORMULACONVENTION ) { aRet <<= mnConv; } - else if ( aString == SC_UNO_IGNORELEADING ) + else if ( aPropertyName == SC_UNO_IGNORELEADING ) { aRet <<= mbIgnoreSpaces; } - else if ( aString == SC_UNO_OPCODEMAP ) + else if ( aPropertyName == SC_UNO_OPCODEMAP ) { aRet <<= maOpCodeMapping; } - else if ( aString == SC_UNO_EXTERNALLINKS ) + else if ( aPropertyName == SC_UNO_EXTERNALLINKS ) { aRet <<= maExternalLinks; } diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx index 1a17d1a67a7b..3d0aaa4d2950 100644 --- a/sc/source/ui/unoobj/viewuno.cxx +++ b/sc/source/ui/unoobj/viewuno.cxx @@ -1786,9 +1786,8 @@ void SAL_CALL ScTabViewObj::setPropertyValue( uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - OUString aString(aPropertyName); - if ( aString == SC_UNO_FILTERED_RANGE_SELECTION ) + if ( aPropertyName == SC_UNO_FILTERED_RANGE_SELECTION ) { bFilteredRangeSelection = ScUnoHelpFunctions::GetBoolFromAny(aValue); return; @@ -1801,33 +1800,33 @@ void SAL_CALL ScTabViewObj::setPropertyValue( const ScViewOptions& rOldOpt = pViewSh->GetViewData().GetOptions(); ScViewOptions aNewOpt(rOldOpt); - if ( aString == SC_UNO_COLROWHDR || aString == OLD_UNO_COLROWHDR ) + if ( aPropertyName == SC_UNO_COLROWHDR || aPropertyName == OLD_UNO_COLROWHDR ) aNewOpt.SetOption( VOPT_HEADER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if ( aString == SC_UNO_HORSCROLL || aString == OLD_UNO_HORSCROLL ) + else if ( aPropertyName == SC_UNO_HORSCROLL || aPropertyName == OLD_UNO_HORSCROLL ) aNewOpt.SetOption( VOPT_HSCROLL, ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if ( aString == SC_UNO_OUTLSYMB || aString == OLD_UNO_OUTLSYMB ) + else if ( aPropertyName == SC_UNO_OUTLSYMB || aPropertyName == OLD_UNO_OUTLSYMB ) aNewOpt.SetOption( VOPT_OUTLINER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if ( aString == SC_UNO_SHEETTABS || aString == OLD_UNO_SHEETTABS ) + else if ( aPropertyName == SC_UNO_SHEETTABS || aPropertyName == OLD_UNO_SHEETTABS ) aNewOpt.SetOption( VOPT_TABCONTROLS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if ( aString == SC_UNO_SHOWANCHOR ) + else if ( aPropertyName == SC_UNO_SHOWANCHOR ) aNewOpt.SetOption( VOPT_ANCHOR, ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if ( aString == SC_UNO_SHOWFORM ) + else if ( aPropertyName == SC_UNO_SHOWFORM ) aNewOpt.SetOption( VOPT_FORMULAS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if ( aString == SC_UNO_SHOWGRID ) + else if ( aPropertyName == SC_UNO_SHOWGRID ) aNewOpt.SetOption( VOPT_GRID, ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if ( aString == SC_UNO_SHOWHELP ) + else if ( aPropertyName == SC_UNO_SHOWHELP ) aNewOpt.SetOption( VOPT_HELPLINES, ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if ( aString == SC_UNO_SHOWNOTES ) + else if ( aPropertyName == SC_UNO_SHOWNOTES ) aNewOpt.SetOption( VOPT_NOTES, ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if ( aString == SC_UNO_SHOWPAGEBR ) + else if ( aPropertyName == SC_UNO_SHOWPAGEBR ) aNewOpt.SetOption( VOPT_PAGEBREAKS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if ( aString == SC_UNO_SHOWZERO ) + else if ( aPropertyName == SC_UNO_SHOWZERO ) aNewOpt.SetOption( VOPT_NULLVALS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if ( aString == SC_UNO_VALUEHIGH || aString == OLD_UNO_VALUEHIGH ) + else if ( aPropertyName == SC_UNO_VALUEHIGH || aPropertyName == OLD_UNO_VALUEHIGH ) aNewOpt.SetOption( VOPT_SYNTAX, ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if ( aString == SC_UNO_VERTSCROLL || aString == OLD_UNO_VERTSCROLL ) + else if ( aPropertyName == SC_UNO_VERTSCROLL || aPropertyName == OLD_UNO_VERTSCROLL ) aNewOpt.SetOption( VOPT_VSCROLL, ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); - else if ( aString == SC_UNO_SHOWOBJ ) + else if ( aPropertyName == SC_UNO_SHOWOBJ ) { sal_Int16 nIntVal = 0; if ( aValue >>= nIntVal ) @@ -1838,7 +1837,7 @@ void SAL_CALL ScTabViewObj::setPropertyValue( aNewOpt.SetObjMode( VOBJ_TYPE_OLE, (ScVObjMode)nIntVal); } } - else if ( aString == SC_UNO_SHOWCHARTS ) + else if ( aPropertyName == SC_UNO_SHOWCHARTS ) { sal_Int16 nIntVal = 0; if ( aValue >>= nIntVal ) @@ -1849,7 +1848,7 @@ void SAL_CALL ScTabViewObj::setPropertyValue( aNewOpt.SetObjMode( VOBJ_TYPE_CHART, (ScVObjMode)nIntVal); } } - else if ( aString == SC_UNO_SHOWDRAW ) + else if ( aPropertyName == SC_UNO_SHOWDRAW ) { sal_Int16 nIntVal = 0; if ( aValue >>= nIntVal ) @@ -1860,19 +1859,19 @@ void SAL_CALL ScTabViewObj::setPropertyValue( aNewOpt.SetObjMode( VOBJ_TYPE_DRAW, (ScVObjMode)nIntVal); } } - else if ( aString == SC_UNO_GRIDCOLOR ) + else if ( aPropertyName == SC_UNO_GRIDCOLOR ) { sal_Int32 nIntVal = 0; if ( aValue >>= nIntVal ) aNewOpt.SetGridColor( nIntVal, OUString() ); } - else if ( aString == SC_UNO_ZOOMTYPE ) + else if ( aPropertyName == SC_UNO_ZOOMTYPE ) { sal_Int16 nIntVal = 0; if ( aValue >>= nIntVal ) SetZoomType(nIntVal); } - else if ( aString == SC_UNO_ZOOMVALUE ) + else if ( aPropertyName == SC_UNO_ZOOMVALUE ) { sal_Int16 nIntVal = 0; if ( aValue >>= nIntVal ) @@ -1909,10 +1908,9 @@ uno::Any SAL_CALL ScTabViewObj::getPropertyValue( const OUString& aPropertyName uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - OUString aString(aPropertyName); uno::Any aRet; - if ( aString == SC_UNO_FILTERED_RANGE_SELECTION ) + if ( aPropertyName == SC_UNO_FILTERED_RANGE_SELECTION ) { ScUnoHelpFunctions::SetBoolInAny(aRet, bFilteredRangeSelection); return aRet; @@ -1923,33 +1921,33 @@ uno::Any SAL_CALL ScTabViewObj::getPropertyValue( const OUString& aPropertyName { const ScViewOptions& rOpt = pViewSh->GetViewData().GetOptions(); - if ( aString == SC_UNO_COLROWHDR || aString == OLD_UNO_COLROWHDR ) + if ( aPropertyName == SC_UNO_COLROWHDR || aPropertyName == OLD_UNO_COLROWHDR ) ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_HEADER ) ); - else if ( aString == SC_UNO_HORSCROLL || aString == OLD_UNO_HORSCROLL ) + else if ( aPropertyName == SC_UNO_HORSCROLL || aPropertyName == OLD_UNO_HORSCROLL ) ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_HSCROLL ) ); - else if ( aString == SC_UNO_OUTLSYMB || aString == OLD_UNO_OUTLSYMB ) + else if ( aPropertyName == SC_UNO_OUTLSYMB || aPropertyName == OLD_UNO_OUTLSYMB ) ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_OUTLINER ) ); - else if ( aString == SC_UNO_SHEETTABS || aString == OLD_UNO_SHEETTABS ) + else if ( aPropertyName == SC_UNO_SHEETTABS || aPropertyName == OLD_UNO_SHEETTABS ) ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_TABCONTROLS ) ); - else if ( aString == SC_UNO_SHOWANCHOR ) ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_ANCHOR ) ); - else if ( aString == SC_UNO_SHOWFORM ) ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_FORMULAS ) ); - else if ( aString == SC_UNO_SHOWGRID ) ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_GRID ) ); - else if ( aString == SC_UNO_SHOWHELP ) ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_HELPLINES ) ); - else if ( aString == SC_UNO_SHOWNOTES ) ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_NOTES ) ); - else if ( aString == SC_UNO_SHOWPAGEBR ) ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_PAGEBREAKS ) ); - else if ( aString == SC_UNO_SHOWZERO ) ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_NULLVALS ) ); - else if ( aString == SC_UNO_VALUEHIGH || aString == OLD_UNO_VALUEHIGH ) + else if ( aPropertyName == SC_UNO_SHOWANCHOR ) ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_ANCHOR ) ); + else if ( aPropertyName == SC_UNO_SHOWFORM ) ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_FORMULAS ) ); + else if ( aPropertyName == SC_UNO_SHOWGRID ) ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_GRID ) ); + else if ( aPropertyName == SC_UNO_SHOWHELP ) ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_HELPLINES ) ); + else if ( aPropertyName == SC_UNO_SHOWNOTES ) ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_NOTES ) ); + else if ( aPropertyName == SC_UNO_SHOWPAGEBR ) ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_PAGEBREAKS ) ); + else if ( aPropertyName == SC_UNO_SHOWZERO ) ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_NULLVALS ) ); + else if ( aPropertyName == SC_UNO_VALUEHIGH || aPropertyName == OLD_UNO_VALUEHIGH ) ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_SYNTAX ) ); - else if ( aString == SC_UNO_VERTSCROLL || aString == OLD_UNO_VERTSCROLL ) + else if ( aPropertyName == SC_UNO_VERTSCROLL || aPropertyName == OLD_UNO_VERTSCROLL ) ScUnoHelpFunctions::SetBoolInAny( aRet, rOpt.GetOption( VOPT_VSCROLL ) ); - else if ( aString == SC_UNO_SHOWOBJ ) aRet <<= (sal_Int16)( rOpt.GetObjMode( VOBJ_TYPE_OLE ) ); - else if ( aString == SC_UNO_SHOWCHARTS ) aRet <<= (sal_Int16)( rOpt.GetObjMode( VOBJ_TYPE_CHART ) ); - else if ( aString == SC_UNO_SHOWDRAW ) aRet <<= (sal_Int16)( rOpt.GetObjMode( VOBJ_TYPE_DRAW ) ); - else if ( aString == SC_UNO_GRIDCOLOR ) aRet <<= (sal_Int32)( rOpt.GetGridColor().GetColor() ); - else if ( aString == SC_UNO_VISAREA ) aRet <<= GetVisArea(); - else if ( aString == SC_UNO_ZOOMTYPE ) aRet <<= GetZoomType(); - else if ( aString == SC_UNO_ZOOMVALUE ) aRet <<= GetZoom(); - else if ( aString == SC_UNO_VISAREASCREEN ) + else if ( aPropertyName == SC_UNO_SHOWOBJ ) aRet <<= (sal_Int16)( rOpt.GetObjMode( VOBJ_TYPE_OLE ) ); + else if ( aPropertyName == SC_UNO_SHOWCHARTS ) aRet <<= (sal_Int16)( rOpt.GetObjMode( VOBJ_TYPE_CHART ) ); + else if ( aPropertyName == SC_UNO_SHOWDRAW ) aRet <<= (sal_Int16)( rOpt.GetObjMode( VOBJ_TYPE_DRAW ) ); + else if ( aPropertyName == SC_UNO_GRIDCOLOR ) aRet <<= (sal_Int32)( rOpt.GetGridColor().GetColor() ); + else if ( aPropertyName == SC_UNO_VISAREA ) aRet <<= GetVisArea(); + else if ( aPropertyName == SC_UNO_ZOOMTYPE ) aRet <<= GetZoomType(); + else if ( aPropertyName == SC_UNO_ZOOMVALUE ) aRet <<= GetZoom(); + else if ( aPropertyName == SC_UNO_VISAREASCREEN ) { ScViewData& rViewData = pViewSh->GetViewData(); vcl::Window* pActiveWin = rViewData.GetActiveWin(); diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index db7e146c5e5f..9ad878153c41 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -2158,21 +2158,18 @@ ScVbaRange::CellsHelper( const uno::Reference< ov::XHelperInterface >& xParent, // set in the Any, we should convert as appropriate // #FIXME - perhaps worth turning this into some sort of // conversion routine e.g. bSuccess = getValueFromAny( nRow, nRowIndex, cppu::UnoType::get() ) - uno::Any aRowIndexAny = nRowIndex; - if ( aRowIndexAny.hasValue() && !( aRowIndexAny >>= nRow ) ) + if ( nRowIndex.hasValue() && !( nRowIndex >>= nRow ) ) { uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( xContext ); uno::Any aConverted; try { - aConverted = xConverter->convertTo( aRowIndexAny, cppu::UnoType::get() ); + aConverted = xConverter->convertTo( nRowIndex, cppu::UnoType::get() ); bIsIndex = ( aConverted >>= nRow ); } catch( uno::Exception& ) {} // silence any errors } - uno::Any aColumnAny = nColumnIndex; - if ( bIsColumnIndex ) { // Column index can be a col address e.g Cells( 1, "B" ) etc. @@ -2188,13 +2185,13 @@ ScVbaRange::CellsHelper( const uno::Reference< ov::XHelperInterface >& xParent, } else { - if ( !( aColumnAny >>= nColumn ) ) + if ( !( nColumnIndex >>= nColumn ) ) { uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( xContext ); uno::Any aConverted; try { - aConverted = xConverter->convertTo( aColumnAny, cppu::UnoType::get() ); + aConverted = xConverter->convertTo( nColumnIndex, cppu::UnoType::get() ); bIsColumnIndex = ( aConverted >>= nColumn ); } catch( uno::Exception& ) {} // silence any errors diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index c7b7b2e39843..4bfa4e76b620 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -2775,10 +2775,9 @@ void ScViewData::ReadUserDataSequence(const uno::Sequence } else if (sName == SC_ACTIVETABLE) { - OUString sValue; - if(rSettings[i].Value >>= sValue) + OUString sTabName; + if(rSettings[i].Value >>= sTabName) { - OUString sTabName(sValue); SCTAB nTab(0); if (GetDocument()->GetTable(sTabName, nTab)) nTabNo = nTab; diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index fb47310614bd..18cccbf4123d 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -2380,8 +2380,7 @@ void ScViewFunc::InsertTableLink( const OUString& rFile, { OUString aFilterName = rFilter; OUString aOpt = rOptions; - OUString aURL = rFile; - ScDocumentLoader aLoader( aURL, aFilterName, aOpt ); + ScDocumentLoader aLoader( rFile, aFilterName, aOpt ); if (!aLoader.IsError()) { ScDocShell* pSrcSh = aLoader.GetDocShell(); -- cgit