summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-06-23 10:22:25 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-06-23 13:23:42 +0200
commitbf39807c67eb2dc7596926486a22d781e8969d47 (patch)
tree55adb68b8fa059dd3b68fcc0012cf7fe7de94794 /editeng
parent20e1822a2582d4207b13368b3521b9d42407ce69 (diff)
loplugin:oncevar editeng..extensions
Change-Id: I3a63e3e3b873ef8a2d708d39be084124a6ad1346 Reviewed-on: https://gerrit.libreoffice.org/39153 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/qa/unit/core-test.cxx41
-rw-r--r--editeng/source/editeng/editobj.cxx3
-rw-r--r--editeng/source/editeng/editview.cxx2
-rw-r--r--editeng/source/editeng/impedit.cxx2
-rw-r--r--editeng/source/editeng/impedit3.cxx3
-rw-r--r--editeng/source/items/frmitems.cxx4
-rw-r--r--editeng/source/items/textitem.cxx6
-rw-r--r--editeng/source/misc/svxacorr.cxx10
-rw-r--r--editeng/source/misc/unolingu.cxx3
-rw-r--r--editeng/source/outliner/outliner.cxx2
-rw-r--r--editeng/source/uno/unotext.cxx6
11 files changed, 30 insertions, 52 deletions
diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx
index b71c90c72dfc..1f67db2b479a 100644
--- a/editeng/qa/unit/core-test.cxx
+++ b/editeng/qa/unit/core-test.cxx
@@ -332,8 +332,8 @@ void Test::testAutocorrect()
{
OUString sInput("TEst-TEst");
- sal_Unicode cNextChar(' ');
- OUString sExpected("Test-Test ");
+ sal_Unicode const cNextChar(' ');
+ OUString const sExpected("Test-Test ");
TestAutoCorrDoc aFoo(sInput, LANGUAGE_ENGLISH_US);
aAutoCorrect.DoAutoCorrect(aFoo, sInput, sInput.getLength(), cNextChar, true);
@@ -343,8 +343,8 @@ void Test::testAutocorrect()
{
OUString sInput("TEst/TEst");
- sal_Unicode cNextChar(' ');
- OUString sExpected("Test/Test ");
+ sal_Unicode const cNextChar(' ');
+ OUString const sExpected("Test/Test ");
TestAutoCorrDoc aFoo(sInput, LANGUAGE_ENGLISH_US);
aAutoCorrect.DoAutoCorrect(aFoo, sInput, sInput.getLength(), cNextChar, true);
@@ -355,8 +355,8 @@ void Test::testAutocorrect()
{
// test auto-bolding with '*'
OUString sInput("*foo");
- sal_Unicode cNextChar('*');
- OUString sExpected("foo");
+ sal_Unicode const cNextChar('*');
+ OUString const sExpected("foo");
TestAutoCorrDoc aFoo(sInput, LANGUAGE_ENGLISH_US);
aAutoCorrect.DoAutoCorrect(aFoo, sInput, sInput.getLength(), cNextChar, true);
@@ -366,8 +366,8 @@ void Test::testAutocorrect()
{
OUString sInput("Test. test");
- sal_Unicode cNextChar(' ');
- OUString sExpected("Test. Test ");
+ sal_Unicode const cNextChar(' ');
+ OUString const sExpected("Test. Test ");
TestAutoCorrDoc aFoo(sInput, LANGUAGE_ENGLISH_US);
aAutoCorrect.DoAutoCorrect(aFoo, sInput, sInput.getLength(), cNextChar, true);
@@ -378,8 +378,8 @@ void Test::testAutocorrect()
// don't autocapitalize after a field mark
{
OUString sInput("Test. \x01 test");
- sal_Unicode cNextChar(' ');
- OUString sExpected("Test. \x01 test ");
+ sal_Unicode const cNextChar(' ');
+ OUString const sExpected("Test. \x01 test ");
TestAutoCorrDoc aFoo(sInput, LANGUAGE_ENGLISH_US);
aAutoCorrect.DoAutoCorrect(aFoo, sInput, sInput.getLength(), cNextChar, true);
@@ -771,8 +771,7 @@ void Test::testBoldItalicCopyPaste()
std::vector<editeng::Section> aAttrs1;
pEditText1->GetAllSections( aAttrs1 );
// There should be 3 sections - woBold - wBold - woBold (w - with, wo - without)
- size_t nSecCountCheck1 = 3;
- CPPUNIT_ASSERT_EQUAL( nSecCountCheck1, aAttrs1.size() );
+ CPPUNIT_ASSERT_EQUAL( size_t(3), aAttrs1.size() );
const editeng::Section* pSecAttr = &aAttrs1[0];
CPPUNIT_ASSERT_EQUAL( 0, (int)pSecAttr->mnParagraph );
@@ -804,8 +803,7 @@ void Test::testBoldItalicCopyPaste()
std::vector<editeng::Section> aAttrs2;
pEditText2->GetAllSections( aAttrs2 );
// There should be 5 sections - woBold&woItalic - wBold&woItalic - wBold&wItalic - woBold&wItalic - woBold&woItalic (w - with, wo - without)
- size_t nSecCountCheck2 = 5;
- CPPUNIT_ASSERT_EQUAL( nSecCountCheck2, aAttrs2.size() );
+ CPPUNIT_ASSERT_EQUAL( size_t(5), aAttrs2.size() );
pSecAttr = &aAttrs2[0];
CPPUNIT_ASSERT_EQUAL( 0, (int)pSecAttr->mnParagraph );
@@ -856,8 +854,7 @@ void Test::testBoldItalicCopyPaste()
pEditText3->GetAllSections( aAttrs3 );
// There should be 9 sections - woBold&woItalic - wBold&woItalic - wBold&wItalic - woBold&wItalic - woBold&woItalic - wBold&woItalic
// - wBold&wItalic - woBold&wItalic - woBold&woItalic(w - with, wo - without)
- size_t nSecCountCheck3 = 9;
- CPPUNIT_ASSERT_EQUAL( nSecCountCheck3, aAttrs3.size() );
+ CPPUNIT_ASSERT_EQUAL( size_t(9), aAttrs3.size() );
pSecAttr = &aAttrs3[0];
CPPUNIT_ASSERT_EQUAL( 0, (int)pSecAttr->mnParagraph );
@@ -972,8 +969,7 @@ void Test::testUnderlineCopyPaste()
pEditText1->GetAllSections( aAttrs1 );
// There should be 3 sections - woUnderline - wUnderline - woUnderline (w - with, wo - without)
- size_t nSecCountCheck1 = 3;
- CPPUNIT_ASSERT_EQUAL( nSecCountCheck1, aAttrs1.size() );
+ CPPUNIT_ASSERT_EQUAL( size_t(3), aAttrs1.size() );
const editeng::Section* pSecAttr = &aAttrs1[0];
CPPUNIT_ASSERT_EQUAL( 0, (int)pSecAttr->mnParagraph );
@@ -1010,8 +1006,7 @@ void Test::testUnderlineCopyPaste()
pEditText2->GetAllSections( aAttrs2 );
// There should be 4 sections - woUnderline - wUnderline - woUnderline - wUnderline (w - with, wo - without)
- size_t nSecCountCheck2 = 4;
- CPPUNIT_ASSERT_EQUAL( nSecCountCheck2, aAttrs2.size() );
+ CPPUNIT_ASSERT_EQUAL( size_t(4), aAttrs2.size() );
pSecAttr = &aAttrs2[0];
CPPUNIT_ASSERT_EQUAL( 0, (int)pSecAttr->mnParagraph );
@@ -1098,8 +1093,7 @@ void Test::testSectionAttributes()
aEngine.Clear();
aEngine.SetText("one\n\ntwo\n\nthree");
sal_Int32 nParaCount = aEngine.GetParagraphCount();
- sal_Int32 nCheck = 5;
- CPPUNIT_ASSERT_EQUAL(nCheck, nParaCount);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(5), nParaCount);
// Apply boldness to paragraphs 1, 3, 5 only. Leave 2 and 4 unformatted.
pSet.reset(new SfxItemSet(aEngine.GetEmptyItemSet()));
@@ -1113,8 +1107,7 @@ void Test::testSectionAttributes()
CPPUNIT_ASSERT_MESSAGE("Failed to create text object.", pEditText.get());
std::vector<editeng::Section> aAttrs;
pEditText->GetAllSections(aAttrs);
- size_t nSecCountCheck = 5;
- CPPUNIT_ASSERT_EQUAL(nSecCountCheck, aAttrs.size());
+ CPPUNIT_ASSERT_EQUAL(size_t(5), aAttrs.size());
// 1st, 3rd and 5th sections should correspond with 1st, 3rd and 5th paragraphs.
const editeng::Section* pSecAttr = &aAttrs[0];
diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx
index 8eee9ea854ef..6c51e587b5be 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -1106,8 +1106,7 @@ public:
void EditTextObjectImpl::StoreData( SvStream& rOStream ) const
{
- sal_uInt16 nVer = 603;
- rOStream.WriteUInt16( nVer );
+ rOStream.WriteUInt16( 603 ); // nVer
rOStream.WriteBool( bOwnerOfPool );
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index d43131ee7b5a..77cabbec1123 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -133,7 +133,7 @@ LanguageType EditView::CheckLanguage(
lang::Locale a3( LanguageTag::convertToLocale( aLangList[3] ) );
#endif
- sal_Int32 nCount = SAL_N_ELEMENTS(aLangList);
+ sal_Int32 const nCount = SAL_N_ELEMENTS(aLangList);
for (sal_Int32 i = 0; i < nCount; i++)
{
LanguageType nTmpLang = aLangList[i];
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index cba53df3c486..be17edb0bc3d 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -1069,7 +1069,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor )
{
SvxFont aFont;
pEditEngine->SeekCursor( aPaM.GetNode(), aPaM.GetIndex()+1, aFont );
- InputContextFlags nContextFlags = InputContextFlags::Text|InputContextFlags::ExtText;
+ InputContextFlags const nContextFlags = InputContextFlags::Text | InputContextFlags::ExtText;
GetWindow()->SetInputContext( InputContext( aFont, nContextFlags ) );
}
}
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 3d0875993baa..5ad6d694cf22 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -1684,15 +1684,12 @@ void ImpEditEngine::CreateAndInsertEmptyLine( ParaPortion* pParaPortion )
SvxAdjust eJustification = GetJustification( nPara );
long nMaxLineWidth = !IsVertical() ? aPaperSize.Width() : aPaperSize.Height();
nMaxLineWidth -= GetXValue( rLRItem.GetRight() );
- long nTextXOffset = 0;
if ( nMaxLineWidth < 0 )
nMaxLineWidth = 1;
if ( eJustification == SvxAdjust::Center )
nStartX = nMaxLineWidth / 2;
else if ( eJustification == SvxAdjust::Right )
nStartX = nMaxLineWidth;
-
- nStartX = nStartX + nTextXOffset;
}
pTmpLine->SetStartPosX( nStartX );
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index 0d2955cdae65..b98cd2507942 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -3502,12 +3502,10 @@ bool SvxBrushItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
sLink = maStrLink;
else if (xGraphicObject)
{
- OUString sPrefix(
- UNO_NAME_GRAPHOBJ_URLPREFIX);
OUString sId(OStringToOUString(
xGraphicObject->GetUniqueID(),
RTL_TEXTENCODING_ASCII_US));
- sLink = sPrefix + sId;
+ sLink = UNO_NAME_GRAPHOBJ_URLPREFIX + sId;
}
rVal <<= sLink;
}
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index e40a630698d2..bb6b66e2ad31 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -357,8 +357,7 @@ SvStream& SvxFontItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) co
// catch for EditEngine, only set while creating clipboard stream.
if ( bEnableStoreUnicodeNames )
{
- sal_uInt32 nMagic = STORE_UNICODE_MAGIC_MARKER;
- rStrm.WriteUInt32( nMagic );
+ rStrm.WriteUInt32( STORE_UNICODE_MAGIC_MARKER );
rStrm.WriteUniOrByteString( aStoreFamilyName, RTL_TEXTENCODING_UNICODE );
rStrm.WriteUniOrByteString( GetStyleName(), RTL_TEXTENCODING_UNICODE );
}
@@ -2652,7 +2651,6 @@ bool SvxEmphasisMarkItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) cons
bool SvxEmphasisMarkItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
{
nMemberId &= ~CONVERT_TWIPS;
- bool bRet = true;
switch( nMemberId )
{
case MID_EMPHASIS:
@@ -2677,7 +2675,7 @@ bool SvxEmphasisMarkItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
}
break;
}
- return bRet;
+ return true;
}
sal_uInt16 SvxEmphasisMarkItem::GetVersion( sal_uInt16 nFFVer ) const
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index d8804dcd1727..b5dd3a1233cd 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -2067,8 +2067,7 @@ void SvxAutoCorrectLanguageLists::SaveExceptList_Imp(
{
xStrm->SetSize( 0 );
xStrm->SetBufferSize( 8192 );
- OUString aMime( "text/xml" );
- xStrm->SetProperty( "MediaType", Any(aMime) );
+ xStrm->SetProperty( "MediaType", Any(OUString( "text/xml" )) );
uno::Reference< uno::XComponentContext > xContext =
@@ -2356,8 +2355,7 @@ void SvxAutoCorrectLanguageLists::MakeUserStorage_Impl()
try
{
OUString sMain(aDest.GetMainURL( INetURLObject::DecodeMechanism::ToIUri ));
- sal_Unicode cSlash = '/';
- sal_Int32 nSlashPos = sMain.lastIndexOf(cSlash);
+ sal_Int32 nSlashPos = sMain.lastIndexOf('/');
sMain = sMain.copy(0, nSlashPos);
::ucbhelper::Content aNewContent( sMain, uno::Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext() );
TransferInfo aInfo;
@@ -2432,9 +2430,7 @@ bool SvxAutoCorrectLanguageLists::MakeBlocklist_Imp( SotStorage& rStg )
{
refList->SetSize( 0 );
refList->SetBufferSize( 8192 );
- OUString aPropName( "MediaType" );
- OUString aMime( "text/xml" );
- refList->SetProperty( aPropName, Any(aMime) );
+ refList->SetProperty( "MediaType", Any(OUString( "text/xml" )) );
uno::Reference< uno::XComponentContext > xContext =
comphelper::getProcessComponentContext();
diff --git a/editeng/source/misc/unolingu.cxx b/editeng/source/misc/unolingu.cxx
index 722ee855f9dd..e21de08007d1 100644
--- a/editeng/source/misc/unolingu.cxx
+++ b/editeng/source/misc/unolingu.cxx
@@ -104,8 +104,7 @@ void ThesDummy_Impl::GetCfgLocales()
if (!pLocaleSeq)
{
SvtLinguConfig aCfg;
- OUString aNode("ServiceManager/ThesaurusList");
- Sequence < OUString > aNodeNames( aCfg.GetNodeNames( aNode ) );
+ Sequence < OUString > aNodeNames( aCfg.GetNodeNames( "ServiceManager/ThesaurusList" ) );
const OUString *pNodeNames = aNodeNames.getConstArray();
sal_Int32 nLen = aNodeNames.getLength();
pLocaleSeq.reset( new Sequence< lang::Locale >( nLen ) );
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index 9362efbbfb5d..51b06af008d0 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -2095,7 +2095,7 @@ NonOverflowingText *Outliner::GetNonOverflowingText() const
{
ESelection aEmptySel(0,0,0,0);
//EditTextObject *pTObj = pEditEngine->CreateTextObject(aEmptySel);
- bool bLastParaInterrupted = true; // Last Para was interrupted since everything overflew
+ bool const bLastParaInterrupted = true; // Last Para was interrupted since everything overflew
return new NonOverflowingText(aEmptySel, bLastParaInterrupted);
} else { // Get the lines that of the overflowing para fit in the box
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index befcc07afa72..058e56ad7d9f 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -652,13 +652,11 @@ void SvxUnoTextRangeBase::getPropertyValue( const SfxItemPropertySimpleEntry* pM
case WID_PORTIONTYPE:
if ( rSet.GetItemState( EE_FEATURE_FIELD, false ) == SfxItemState::SET )
{
- OUString aType("TextField");
- rAny <<= aType;
+ rAny <<= OUString("TextField");
}
else
{
- OUString aType("Text");
- rAny <<= aType;
+ rAny <<= OUString("Text");
}
break;