summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-06-26 14:47:16 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-06-27 08:42:53 +0200
commit8dca2d5ac740f262b045f6529bd8e97af0ec9c47 (patch)
treee984203a66a5fb178b08341e53fab913a7af7d53 /starmath
parent513ac8eb79e45de332d7ddab5b27c70578b904f1 (diff)
loplugin:oncevar in starmath..svl
Change-Id: I20e3796407c7e429a88d2811673929ac1141a41c Reviewed-on: https://gerrit.libreoffice.org/39280 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'starmath')
-rw-r--r--starmath/qa/cppunit/test_cursor.cxx8
-rw-r--r--starmath/qa/cppunit/test_starmath.cxx2
-rw-r--r--starmath/qa/extras/mmlimport-test.cxx8
-rw-r--r--starmath/source/cfgitem.cxx3
-rw-r--r--starmath/source/cursor.cxx3
-rw-r--r--starmath/source/mathmlexport.cxx14
-rw-r--r--starmath/source/mathmlimport.cxx3
7 files changed, 16 insertions, 25 deletions
diff --git a/starmath/qa/cppunit/test_cursor.cxx b/starmath/qa/cppunit/test_cursor.cxx
index dd6b86f39439..02c7ff433371 100644
--- a/starmath/qa/cppunit/test_cursor.cxx
+++ b/starmath/qa/cppunit/test_cursor.cxx
@@ -67,7 +67,7 @@ void Test::tearDown()
void Test::testCopyPaste()
{
- OUString sInput("a * b + c");
+ OUString const sInput("a * b + c");
std::unique_ptr<SmNode> xTree(SmParser().Parse(sInput));
xTree->Prepare(xDocShRef->GetFormat(), *xDocShRef);
@@ -90,7 +90,7 @@ void Test::testCopyPaste()
void Test::testCopySelectPaste()
{
- OUString sInput("a * b + c");
+ OUString const sInput("a * b + c");
std::unique_ptr<SmNode> xTree(SmParser().Parse(sInput));
xTree->Prepare(xDocShRef->GetFormat(), *xDocShRef);
@@ -117,7 +117,7 @@ void Test::testCopySelectPaste()
void Test::testCutPaste()
{
- OUString sInput("a * b + c");
+ OUString const sInput("a * b + c");
std::unique_ptr<SmNode> xTree(SmParser().Parse(sInput));
xTree->Prepare(xDocShRef->GetFormat(), *xDocShRef);
@@ -140,7 +140,7 @@ void Test::testCutPaste()
void Test::testCutSelectPaste()
{
- OUString sInput("a * b + c");
+ OUString const sInput("a * b + c");
std::unique_ptr<SmNode> xTree(SmParser().Parse(sInput));
xTree->Prepare(xDocShRef->GetFormat(), *xDocShRef);
diff --git a/starmath/qa/cppunit/test_starmath.cxx b/starmath/qa/cppunit/test_starmath.cxx
index c7cbb284aa2f..9d0bd53ebdf3 100644
--- a/starmath/qa/cppunit/test_starmath.cxx
+++ b/starmath/qa/cppunit/test_starmath.cxx
@@ -144,7 +144,7 @@ void Test::editMarker()
}
{
- OUString sTargetText("a under b under c");
+ OUString const sTargetText("a under b under c");
ESelection aSelection;
m_pEditWindow->SelNextMark();
diff --git a/starmath/qa/extras/mmlimport-test.cxx b/starmath/qa/extras/mmlimport-test.cxx
index 26f553bd8d04..927efc7dc05c 100644
--- a/starmath/qa/extras/mmlimport-test.cxx
+++ b/starmath/qa/extras/mmlimport-test.cxx
@@ -116,21 +116,21 @@ void Test::testColor()
void Test::testSimple()
{
loadURL(m_directories.getURLFromSrc("starmath/qa/extras/data/simple.mml"));
- OUString sExpected("left ( {a + b} right )^2");
+ OUString const sExpected("left ( {a + b} right )^2");
CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", sExpected, mxDocShell->GetText());
}
void Test::testNsPrefixMath()
{
loadURL(m_directories.getURLFromSrc("starmath/qa/extras/data/ns-prefix-math.mml"));
- OUString sExpected("left ( {a + b} right )^2");
+ OUString const sExpected("left ( {a + b} right )^2");
CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", sExpected, mxDocShell->GetText());
}
void Test::testMaction()
{
loadURL(m_directories.getURLFromSrc("starmath/qa/extras/data/maction.mml"));
- OUString sExpected("matrix {1 ## 2 ## 3}");
+ OUString const sExpected("matrix {1 ## 2 ## 3}");
CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", sExpected, mxDocShell->GetText());
}
@@ -143,7 +143,7 @@ void Test::testMspace()
void Test::testtdf99556()
{
loadURL(m_directories.getURLFromSrc("starmath/qa/extras/data/tdf99556-1.mml"));
- OUString sExpected("sqrt { {} }");
+ OUString const sExpected("sqrt { {} }");
CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", sExpected, mxDocShell->GetText());
}
diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx
index bf266ceecd2b..332d50858687 100644
--- a/starmath/source/cfgitem.cxx
+++ b/starmath/source/cfgitem.cxx
@@ -316,11 +316,10 @@ const OUString SmFontFormatList::GetNewFontFormatId() const
{
// returns first unused FormatId
- OUString aPrefix("Id");
sal_Int32 nCnt = GetCount();
for (sal_Int32 i = 1; i <= nCnt + 1; ++i)
{
- OUString aTmpId = aPrefix + OUString::number(i);
+ OUString aTmpId = "Id" + OUString::number(i);
if (!GetFontFormat(aTmpId))
return aTmpId;
}
diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx
index 564df363a72d..3960498ab4a8 100644
--- a/starmath/source/cursor.cxx
+++ b/starmath/source/cursor.cxx
@@ -445,8 +445,7 @@ SmNodeList::iterator SmCursor::TakeSelectedNodesFromList(SmNodeList *pLineList,
sal_uInt16 eFontDesc = pText->GetFontDesc();
//If we need make segment 1
if(len1 > 0) {
- int start1 = 0;
- OUString str = aText.copy(start1, len1);
+ OUString str = aText.copy(0, len1);
pText->ChangeText(str);
++it;
} else {//Remove it if not needed
diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index 7c2109cf6d3a..c7824d81b23b 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -165,9 +165,8 @@ bool SmXMLExportWrapper::Export(SfxMedium &rMedium)
new comphelper::PropertySetInfo( aInfoMap ) ) );
SvtSaveOptions aSaveOpt;
- OUString sUsePrettyPrinting("UsePrettyPrinting");
bool bUsePrettyPrinting( bFlat || aSaveOpt.IsPrettyPrinting() );
- xInfoSet->setPropertyValue( sUsePrettyPrinting, Any(bUsePrettyPrinting) );
+ xInfoSet->setPropertyValue( "UsePrettyPrinting", Any(bUsePrettyPrinting) );
// Set base URI
OUString sPropName( "BaseURI" );
@@ -330,21 +329,16 @@ bool SmXMLExportWrapper::WriteThroughComponent(
return false;
}
- OUString aPropName( "MediaType" );
- OUString aMime( "text/xml" );
-
uno::Reference < beans::XPropertySet > xSet( xStream, uno::UNO_QUERY );
- xSet->setPropertyValue( aPropName, Any(aMime) );
+ xSet->setPropertyValue( "MediaType", Any(OUString( "text/xml" )) );
// all streams must be encrypted in encrypted document
- OUString aTmpPropName( "UseCommonStoragePasswordEncryption" );
- xSet->setPropertyValue( aTmpPropName, Any(true) );
+ xSet->setPropertyValue( "UseCommonStoragePasswordEncryption", Any(true) );
// set Base URL
if ( rPropSet.is() )
{
- OUString sPropName( "StreamName" );
- rPropSet->setPropertyValue( sPropName, makeAny( sStreamName ) );
+ rPropSet->setPropertyValue( "StreamName", makeAny( sStreamName ) );
}
// write the stuff
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx
index 093e72b3e690..527b97e3aa1a 100644
--- a/starmath/source/mathmlimport.cxx
+++ b/starmath/source/mathmlimport.cxx
@@ -384,8 +384,7 @@ ErrCode SmXMLImportWrapper::ReadThroughComponent(
// set Base URL
if ( rPropSet.is() )
{
- OUString sPropName( "StreamName");
- rPropSet->setPropertyValue( sPropName, makeAny( sStreamName ) );
+ rPropSet->setPropertyValue( "StreamName", makeAny( sStreamName ) );
}