diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-01 14:37:24 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-02 07:12:46 +0000 |
commit | a7369d98991eb41e0e6bb008ef0305c17859540e (patch) | |
tree | 8bc87665d071392677446332725de3b6004d1530 | |
parent | tdf#71603: Create a new DC for the font fallback (diff) | |
download | core-a7369d98991eb41e0e6bb008ef0305c17859540e.tar.gz core-a7369d98991eb41e0e6bb008ef0305c17859540e.zip |
loplugin:oncevar in helpcompiler..reportdesign
Change-Id: I2dc57931fb230953c285aeb18f57c0a41fedafcb
Reviewed-on: https://gerrit.libreoffice.org/30463
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | helpcompiler/source/HelpSearch.cxx | 4 | ||||
-rw-r--r-- | idlc/source/idlccompile.cxx | 6 | ||||
-rw-r--r-- | linguistic/source/dicimp.cxx | 4 | ||||
-rw-r--r-- | linguistic/source/dlistimp.cxx | 7 | ||||
-rw-r--r-- | oox/source/drawingml/texteffectscontext.cxx | 4 | ||||
-rw-r--r-- | oox/source/ole/axcontrol.cxx | 7 | ||||
-rw-r--r-- | reportdesign/source/core/api/ReportEngineJFree.cxx | 6 | ||||
-rw-r--r-- | reportdesign/source/filter/xml/xmlExport.cxx | 15 | ||||
-rw-r--r-- | reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx | 12 | ||||
-rw-r--r-- | reportdesign/source/filter/xml/xmlFormattedField.cxx | 8 | ||||
-rw-r--r-- | reportdesign/source/filter/xml/xmlGroup.cxx | 3 |
11 files changed, 23 insertions, 53 deletions
diff --git a/helpcompiler/source/HelpSearch.cxx b/helpcompiler/source/HelpSearch.cxx index 96f121932240..6f0fa2eeaf6a 100644 --- a/helpcompiler/source/HelpSearch.cxx +++ b/helpcompiler/source/HelpSearch.cxx @@ -26,9 +26,7 @@ void HelpSearch::query(OUString const &queryStr, bool captionOnly, lucene::index::IndexReader *reader = lucene::index::IndexReader::open(d_indexDir.getStr()); lucene::search::IndexSearcher searcher(reader); - TCHAR captionField[] = L"caption"; - TCHAR contentField[] = L"content"; - TCHAR *field = captionOnly ? captionField : contentField; + const TCHAR* field = captionOnly ? L"caption" : L"content"; bool isWildcard = queryStr[queryStr.getLength() - 1] == L'*'; std::vector<TCHAR> aQueryStr(OUStringToTCHARVec(queryStr)); diff --git a/idlc/source/idlccompile.cxx b/idlc/source/idlccompile.cxx index 1cc5fac9005d..1f628718f479 100644 --- a/idlc/source/idlccompile.cxx +++ b/idlc/source/idlccompile.cxx @@ -51,8 +51,6 @@ extern int yydebug; sal_Int32 lineNumber = 1; -static const char TMP[] = "TMP"; -static const char TEMP[] = "TEMP"; static sal_Char tmpFilePattern[512]; bool isFileUrl(const OString& fileName) @@ -123,9 +121,9 @@ OString makeTempName(const OString& prefix) OUString uTmpPath; OString tmpPath; - if ( osl_getEnvironment(OUString(TMP).pData, &uTmpPath.pData) != osl_Process_E_None ) + if ( osl_getEnvironment(OUString("TMP").pData, &uTmpPath.pData) != osl_Process_E_None ) { - if ( osl_getEnvironment(OUString(TEMP).pData, &uTmpPath.pData) != osl_Process_E_None ) + if ( osl_getEnvironment(OUString("TEMP").pData, &uTmpPath.pData) != osl_Process_E_None ) { #if defined(SAL_W32) tmpPath = OString("c:\\temp"); diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx index 3e7ff05ab18e..5efe94f475de 100644 --- a/linguistic/source/dicimp.cxx +++ b/linguistic/source/dicimp.cxx @@ -1018,9 +1018,7 @@ void DicEntry::splitDicFileWord(const OUString &rDicFileWord, { MutexGuard aGuard( GetLinguMutex() ); - static const char aDelim[] = "=="; - - sal_Int32 nDelimPos = rDicFileWord.indexOf( aDelim ); + sal_Int32 nDelimPos = rDicFileWord.indexOf( "==" ); if (-1 != nDelimPos) { sal_Int32 nTriplePos = nDelimPos + 2; diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx index f4506ee5343f..6b2a43be4068 100644 --- a/linguistic/source/dlistimp.cxx +++ b/linguistic/source/dlistimp.cxx @@ -790,16 +790,13 @@ static void AddInternal( if (rDic.is()) { //! TL TODO: word iterator should be used to break up the text - static const char aDefWordDelim[] = - "!\"#$%&'()*+,-/:;<=>?[]\\_^`{|}~\t \n"; - OUString aDelim(aDefWordDelim); + OUString aDelim("!\"#$%&'()*+,-/:;<=>?[]\\_^`{|}~\t \n"); OSL_ENSURE(aDelim.indexOf(static_cast<sal_Unicode>('.')) == -1, "ensure no '.'"); OUString aToken; sal_Int32 nPos = 0; - while (-1 != - (nPos = lcl_GetToken( aToken, rNew, nPos, aDelim ))) + while (-1 != (nPos = lcl_GetToken( aToken, rNew, nPos, aDelim ))) { if( !aToken.isEmpty() && !IsNumeric( aToken ) ) { diff --git a/oox/source/drawingml/texteffectscontext.cxx b/oox/source/drawingml/texteffectscontext.cxx index 7b7f32e69976..52abd9500456 100644 --- a/oox/source/drawingml/texteffectscontext.cxx +++ b/oox/source/drawingml/texteffectscontext.cxx @@ -98,8 +98,6 @@ OUString lclGetGrabBagName(sal_uInt32 aId) return aGrabBagNameMap[aId]; } -const char constAttributesSequenceName[] = "attributes"; - } using namespace oox::core; @@ -131,7 +129,7 @@ void TextEffectsContext::pushAttributeToGrabBag (sal_Int32 aAttributeId, const O void TextEffectsContext::processAttributes(const AttributeList& rAttribs) { - mpGrabBagStack->push(constAttributesSequenceName); + mpGrabBagStack->push("attributes"); switch(mnCurrentElement) { case OOX_TOKEN(w14, glow): diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx index 69ab00395709..b6ea8a2726e6 100644 --- a/oox/source/ole/axcontrol.cxx +++ b/oox/source/ole/axcontrol.cxx @@ -2520,9 +2520,6 @@ HtmlSelectModel::HtmlSelectModel() bool HtmlSelectModel::importBinaryModel( BinaryInputStream& rInStrm ) { - static const char sMultiple[] = "<SELECT MULTIPLE"; - static const char sSelected[] = "OPTION SELECTED"; - OUString sStringContents = rInStrm.readUnicodeArray( rInStrm.size() ); OUString data = sStringContents; @@ -2540,7 +2537,7 @@ HtmlSelectModel::importBinaryModel( BinaryInputStream& rInStrm ) OUString sLine( data.getToken( nToken, '\n' ) ); if ( !nToken ) // first line will tell us if multiselect is enabled { - if ( sLine == sMultiple ) + if ( sLine == "<SELECT MULTIPLE" ) mnMultiSelect = AX_SELECTION_MULTI; } // skip first and last lines, no data there @@ -2558,7 +2555,7 @@ HtmlSelectModel::importBinaryModel( BinaryInputStream& rInStrm ) displayValue = displayValue.replaceAll( """, "\"" ); displayValue = displayValue.replaceAll( "&", "&" ); listValues.push_back( displayValue ); - if( sLine.indexOf( sSelected ) != -1 ) + if( sLine.indexOf( "OPTION SELECTED" ) != -1 ) selectedIndices.push_back( static_cast< sal_Int16 >( listValues.size() ) - 1 ); } } diff --git a/reportdesign/source/core/api/ReportEngineJFree.cxx b/reportdesign/source/core/api/ReportEngineJFree.cxx index f56651570fad..893441c1becd 100644 --- a/reportdesign/source/core/api/ReportEngineJFree.cxx +++ b/reportdesign/source/core/api/ReportEngineJFree.cxx @@ -228,12 +228,10 @@ OUString OReportEngineJFree::getNewOutputName() OUStringBuffer sAuthor(aUserOpts.GetFirstName()); sAuthor.append(" "); sAuthor.append(aUserOpts.GetLastName()); - static const char s_sAuthor[] = "Author"; - aConvertedProperties[nPos].Name = s_sAuthor; + aConvertedProperties[nPos].Name = "Author"; aConvertedProperties[nPos++].Value <<= sAuthor.makeStringAndClear(); - static const char s_sTitle[] = "Title"; - aConvertedProperties[nPos].Name = s_sTitle; + aConvertedProperties[nPos].Name = "Title"; aConvertedProperties[nPos++].Value <<= m_xReport->getCaption(); // create job factory and initialize diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx index 1fbf33e42440..f4cb39528786 100644 --- a/reportdesign/source/filter/xml/xmlExport.cxx +++ b/reportdesign/source/filter/xml/xmlExport.cxx @@ -999,10 +999,8 @@ OUString ORptExport::convertFormula(const OUString& _sFormula) bool ORptExport::exportFormula(enum ::xmloff::token::XMLTokenEnum eName,const OUString& _sFormula) { const OUString sFieldData = convertFormula(_sFormula); - static const char s_sPageNumber[] = "PageNumber()"; - static const char s_sPageCount[] = "PageCount()"; - sal_Int32 nPageNumberIndex = sFieldData.indexOf(s_sPageNumber); - sal_Int32 nPageCountIndex = sFieldData.indexOf(s_sPageCount); + sal_Int32 nPageNumberIndex = sFieldData.indexOf("PageNumber()"); + sal_Int32 nPageCountIndex = sFieldData.indexOf("PageCount()"); bool bRet = nPageNumberIndex != -1 || nPageCountIndex != -1; if ( !bRet ) AddAttribute(XML_NAMESPACE_REPORT, eName,sFieldData); @@ -1056,11 +1054,10 @@ void ORptExport::exportGroup(const Reference<XReportDefinition>& _xReportDefinit OUString sExpression = sField; if ( !sExpression.isEmpty() ) { - static const char s_sQuote[] = "\"\""; sal_Int32 nIndex = sExpression.indexOf('"'); while ( nIndex > -1 ) { - sExpression = sExpression.replaceAt(nIndex,1,s_sQuote); + sExpression = sExpression.replaceAt(nIndex, 1, "\"\""); nIndex = sExpression.indexOf('"',nIndex+2); } OUString sFormula("rpt:HASCHANGED(\""); @@ -1404,7 +1401,6 @@ void ORptExport::exportParagraph(const Reference< XReportControlModel >& _xRepor { OUString sFieldData = _xReportElement->getDataField(); static const char s_sPageNumber[] = "PageNumber()"; - static const char s_sPageCount[] = "PageCount()"; static const char s_sReportPrefix[] = "rpt:"; sFieldData = sFieldData.copy(strlen(s_sReportPrefix), sFieldData.getLength() - strlen(s_sReportPrefix)); sal_Int32 nPageNumberIndex = sFieldData.indexOf(s_sPageNumber); @@ -1419,12 +1415,11 @@ void ORptExport::exportParagraph(const Reference< XReportControlModel >& _xRepor { if ( sToken == s_sPageNumber ) { - static const char s_sCurrent[] = "current"; - AddAttribute(XML_NAMESPACE_TEXT, XML_SELECT_PAGE, s_sCurrent ); + AddAttribute(XML_NAMESPACE_TEXT, XML_SELECT_PAGE, "current" ); SvXMLElementExport aPageNumber(*this,XML_NAMESPACE_TEXT, XML_PAGE_NUMBER, false, false); Characters("1"); } - else if ( sToken == s_sPageCount ) + else if ( sToken == "PageCount()" ) { SvXMLElementExport aPageNumber(*this,XML_NAMESPACE_TEXT, XML_PAGE_COUNT, false, false); Characters("1"); diff --git a/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx b/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx index b5af7b79acff..7a56abb2e8db 100644 --- a/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx +++ b/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx @@ -43,8 +43,7 @@ void lcl_exportPrettyPrinting(const uno::Reference< xml::sax::XDocumentHandler > SvtSaveOptions aSaveOpt; if ( aSaveOpt.IsPrettyPrinting() ) { - static const char s_sWhitespaces[] = " "; - _xDelegatee->ignorableWhitespace(s_sWhitespaces); + _xDelegatee->ignorableWhitespace(" "); } } @@ -358,20 +357,17 @@ void ExportDocumentHandler::exportTableRows() const OUString sValueType( lcl_createAttribute(XML_NP_OFFICE, XML_VALUE_TYPE) ); - static const char s_sFieldPrefix[] = "field:["; - static const char s_sFieldPostfix[] = "]"; const OUString sCell( lcl_createAttribute(XML_NP_TABLE, XML_TABLE_CELL) ); const OUString sP( lcl_createAttribute(XML_NP_TEXT, XML_P) ); const OUString sFtext(lcl_createAttribute(XML_NP_RPT,XML_FORMATTED_TEXT) ); const OUString sRElement(lcl_createAttribute(XML_NP_RPT,XML_REPORT_ELEMENT) ); const OUString sRComponent( lcl_createAttribute(XML_NP_RPT,XML_REPORT_COMPONENT) ) ; const OUString sFormulaAttrib( lcl_createAttribute(XML_NP_RPT,XML_FORMULA) ); - static const char s_sString[] = "string"; static const char s_sFloat[] = "float"; SvXMLAttributeList* pCellAtt = new SvXMLAttributeList(); uno::Reference< xml::sax::XAttributeList > xCellAtt = pCellAtt; - pCellAtt->AddAttribute(sValueType,s_sString); + pCellAtt->AddAttribute(sValueType, "string"); bool bRemoveString = true; OUString sFormula; @@ -395,9 +391,9 @@ void ExportDocumentHandler::exportTableRows() } for(sal_Int32 i = 0; i < nCount ; ++i) { - sFormula = s_sFieldPrefix; + sFormula = "field:["; sFormula += m_aColumns[i]; - sFormula += s_sFieldPostfix; + sFormula += "]"; SvXMLAttributeList* pList = new SvXMLAttributeList(); uno::Reference< xml::sax::XAttributeList > xAttribs = pList; pList->AddAttribute(sFormulaAttrib,sFormula); diff --git a/reportdesign/source/filter/xml/xmlFormattedField.cxx b/reportdesign/source/filter/xml/xmlFormattedField.cxx index 47053d3a8137..fed1adea735b 100644 --- a/reportdesign/source/filter/xml/xmlFormattedField.cxx +++ b/reportdesign/source/filter/xml/xmlFormattedField.cxx @@ -63,10 +63,7 @@ OXMLFormattedField::OXMLFormattedField( ORptFilter& rImport, _xComponent->setDataField(ORptFilter::convertFormula(sValue)); break; case XML_TOK_SELECT_PAGE: - { - static const char s_sPageNumber[] = "rpt:PageNumber()"; - _xComponent->setDataField(s_sPageNumber); - } + _xComponent->setDataField("rpt:PageNumber()"); break; default: break; @@ -74,8 +71,7 @@ OXMLFormattedField::OXMLFormattedField( ORptFilter& rImport, } if ( _bPageCount ) { - static const char s_sPageNumber[] = "rpt:PageCount()"; - _xComponent->setDataField(s_sPageNumber); + _xComponent->setDataField("rpt:PageCount()"); } } catch(Exception&) diff --git a/reportdesign/source/filter/xml/xmlGroup.cxx b/reportdesign/source/filter/xml/xmlGroup.cxx index 1a29e2263a01..79b30a80784e 100644 --- a/reportdesign/source/filter/xml/xmlGroup.cxx +++ b/reportdesign/source/filter/xml/xmlGroup.cxx @@ -100,11 +100,10 @@ OXMLGroup::OXMLGroup( ORptFilter& _rImport { nPos = strlen(s_sChanged); static const char s_sQuote[] = "\"\""; - static const char s_sSingleQuote[] = "\""; sal_Int32 nIndex = sValue.indexOf(s_sQuote,nPos); while ( nIndex > -1 ) { - sValue = sValue.replaceAt(nIndex,2,s_sSingleQuote); + sValue = sValue.replaceAt(nIndex,2, "\""); nIndex = sValue.indexOf(s_sQuote,nIndex+2); } nLen = sValue.getLength() - 1; |