summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-06-03 09:21:33 +0200
committerStephan Bergmann <sbergman@redhat.com>2020-06-03 22:37:32 +0200
commit8ddc22c45c1a338d6de0b9f8cb26c39dc4065dbc (patch)
tree1d9d627bb3eda6a6619fc810b84d9551ebd93748 /editeng
parent67f7a26c047ae2878e3ecd76f83af3941b9079c3 (diff)
Upcoming loplugin:elidestringvar: editeng
Change-Id: Ia14a1391cbc40b98d24e37c3a54b16871441fc78 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95399 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/qa/unit/core-test.cxx33
-rw-r--r--editeng/source/editeng/impedit.cxx6
-rw-r--r--editeng/source/misc/svxacorr.cxx12
-rw-r--r--editeng/source/xml/xmltxtexp.cxx3
4 files changed, 18 insertions, 36 deletions
diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx
index b98edae2b967..0a2cb4d8f82b 100644
--- a/editeng/qa/unit/core-test.cxx
+++ b/editeng/qa/unit/core-test.cxx
@@ -225,8 +225,7 @@ void Test::testConstruction()
{
EditEngine aEngine(mpItemPool);
- OUString aParaText = "I am Edit Engine.";
- aEngine.SetText(aParaText);
+ aEngine.SetText("I am Edit Engine.");
}
bool includes(const uno::Sequence<OUString>& rSeq, const OUString& rVal)
@@ -444,63 +443,58 @@ void Test::testAutocorrect()
{
OUString sInput("TEst-TEst");
sal_Unicode const cNextChar(' ');
- OUString const sExpected("Test-Test ");
bool bNbspRunNext = false;
TestAutoCorrDoc aFoo(sInput, LANGUAGE_ENGLISH_US);
aAutoCorrect.DoAutoCorrect(aFoo, sInput, sInput.getLength(), cNextChar, true, bNbspRunNext);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("autocorrect", sExpected, aFoo.getResult());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("autocorrect", OUString("Test-Test "), aFoo.getResult());
}
{
OUString sInput("TEst/TEst");
sal_Unicode const cNextChar(' ');
- OUString const sExpected("Test/Test ");
bool bNbspRunNext = false;
TestAutoCorrDoc aFoo(sInput, LANGUAGE_ENGLISH_US);
aAutoCorrect.DoAutoCorrect(aFoo, sInput, sInput.getLength(), cNextChar, true, bNbspRunNext);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("autocorrect", sExpected, aFoo.getResult());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("autocorrect", OUString("Test/Test "), aFoo.getResult());
}
{
// test auto-bolding with '*'
OUString sInput("*foo");
sal_Unicode const cNextChar('*');
- OUString const sExpected("foo");
bool bNbspRunNext = false;
TestAutoCorrDoc aFoo(sInput, LANGUAGE_ENGLISH_US);
aAutoCorrect.DoAutoCorrect(aFoo, sInput, sInput.getLength(), cNextChar, true, bNbspRunNext);
- CPPUNIT_ASSERT_EQUAL(sExpected, aFoo.getResult());
+ CPPUNIT_ASSERT_EQUAL(OUString("foo"), aFoo.getResult());
}
{
OUString sInput("Test. test");
sal_Unicode const cNextChar(' ');
- OUString const sExpected("Test. Test ");
bool bNbspRunNext = false;
TestAutoCorrDoc aFoo(sInput, LANGUAGE_ENGLISH_US);
aAutoCorrect.DoAutoCorrect(aFoo, sInput, sInput.getLength(), cNextChar, true, bNbspRunNext);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("autocorrect", sExpected, aFoo.getResult());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("autocorrect", OUString("Test. Test "), aFoo.getResult());
}
// don't autocapitalize after a field mark
{
OUString sInput("Test. \x01 test");
sal_Unicode const cNextChar(' ');
- OUString const sExpected("Test. \x01 test ");
bool bNbspRunNext = false;
TestAutoCorrDoc aFoo(sInput, LANGUAGE_ENGLISH_US);
aAutoCorrect.DoAutoCorrect(aFoo, sInput, sInput.getLength(), cNextChar, true, bNbspRunNext);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("autocorrect", sExpected, aFoo.getResult());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("autocorrect", OUString("Test. \x01 test "), aFoo.getResult());
}
// consider field contents as text for auto quotes
@@ -749,12 +743,11 @@ void Test::testMultiParaSelCopyPaste()
// Assert changes
OUString aThirdParaAfterCopyPaste = aThirdPara + "first paragraph";
- OUString aFourthPara = "This is second";
CPPUNIT_ASSERT_EQUAL( sal_uLong(aTextLen + aCopyTextLen), rDoc.GetTextLen() );
CPPUNIT_ASSERT_EQUAL( aFirstPara, rDoc.GetParaAsString(sal_Int32(0)) );
CPPUNIT_ASSERT_EQUAL( aSecondPara, rDoc.GetParaAsString(sal_Int32(1)) );
CPPUNIT_ASSERT_EQUAL( aThirdParaAfterCopyPaste, rDoc.GetParaAsString(sal_Int32(2)) );
- CPPUNIT_ASSERT_EQUAL( aFourthPara, rDoc.GetParaAsString(sal_Int32(3)) );
+ CPPUNIT_ASSERT_EQUAL( OUString("This is second"), rDoc.GetParaAsString(sal_Int32(3)) );
}
void Test::testTabsCopyPaste()
@@ -1383,12 +1376,11 @@ void Test::testParaBoldItalicCopyPaste()
// Assert changes
OUString aThirdParaAfterCopyPaste = aThirdPara + "first paragraph";
- OUString aFourthParaAfterCopyPaste = "This is second";
CPPUNIT_ASSERT_EQUAL( sal_uLong(aTextLen + aCopyTextLen), rDoc.GetTextLen() );
CPPUNIT_ASSERT_EQUAL( aFirstPara, rDoc.GetParaAsString(sal_Int32(0)) );
CPPUNIT_ASSERT_EQUAL( aSecondPara, rDoc.GetParaAsString(sal_Int32(1)) );
CPPUNIT_ASSERT_EQUAL( aThirdParaAfterCopyPaste, rDoc.GetParaAsString(sal_Int32(2)) );
- CPPUNIT_ASSERT_EQUAL( aFourthParaAfterCopyPaste, rDoc.GetParaAsString(sal_Int32(3)) );
+ CPPUNIT_ASSERT_EQUAL( OUString("This is second"), rDoc.GetParaAsString(sal_Int32(3)) );
// Check updated text for appropriate Bold/Italics
std::unique_ptr<EditTextObject> pEditText3( aEditEngine.CreateTextObject() );
@@ -1523,10 +1515,9 @@ void Test::testParaStartCopyPaste()
aEditEngine.InsertText( xData, OUString(), rDoc.GetStartPaM(), true );
// Assert changes
- OUString aFirstParaAfterCopyPaste = "first paragraph";
OUString aSecondParaAfterCopyPaste = "This is second" + aFirstPara;
CPPUNIT_ASSERT_EQUAL( sal_uLong(aTextLen + aCopyTextLen), rDoc.GetTextLen() );
- CPPUNIT_ASSERT_EQUAL( aFirstParaAfterCopyPaste, rDoc.GetParaAsString(sal_Int32(0)) );
+ CPPUNIT_ASSERT_EQUAL( OUString("first paragraph"), rDoc.GetParaAsString(sal_Int32(0)) );
CPPUNIT_ASSERT_EQUAL( aSecondParaAfterCopyPaste, rDoc.GetParaAsString(sal_Int32(1)) );
CPPUNIT_ASSERT_EQUAL( aSecondPara, rDoc.GetParaAsString(sal_Int32(2)) );
CPPUNIT_ASSERT_EQUAL( aThirdPara, rDoc.GetParaAsString(sal_Int32(3)) );
@@ -1541,8 +1532,7 @@ void Test::testSectionAttributes()
SvxPostureItem aItalic(ITALIC_NORMAL, EE_CHAR_ITALIC);
{
- OUString aParaText = "aaabbbccc";
- aEngine.SetText(aParaText);
+ aEngine.SetText("aaabbbccc");
pSet->Put(aBold);
CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be exactly one item.", static_cast<sal_uInt16>(1), pSet->Count());
aEngine.QuickSetAttribs(*pSet, ESelection(0,0,0,6)); // 'aaabbb' - end point is not inclusive.
@@ -1730,14 +1720,13 @@ void Test::testLargeParaCopyPaste()
// Assert changes
OUString aFourthParaAfterCopyPaste = aFourthPara + "sixth paragraph";
- OUString aSixthParaAfterCopyPaste = "This is eighth";
CPPUNIT_ASSERT_EQUAL( sal_uLong(aTextLen + aCopyTextLen), rDoc.GetTextLen() );
CPPUNIT_ASSERT_EQUAL( aFirstPara, rDoc.GetParaAsString(sal_Int32(0)) );
CPPUNIT_ASSERT_EQUAL( aSecondPara, rDoc.GetParaAsString(sal_Int32(1)) );
CPPUNIT_ASSERT_EQUAL( aThirdPara, rDoc.GetParaAsString(sal_Int32(2)) );
CPPUNIT_ASSERT_EQUAL( aFourthParaAfterCopyPaste, rDoc.GetParaAsString(sal_Int32(3)) );
CPPUNIT_ASSERT_EQUAL( aSeventhPara, rDoc.GetParaAsString(sal_Int32(4)) );
- CPPUNIT_ASSERT_EQUAL( aSixthParaAfterCopyPaste, rDoc.GetParaAsString(sal_Int32(5)) );
+ CPPUNIT_ASSERT_EQUAL( OUString("This is eighth"), rDoc.GetParaAsString(sal_Int32(5)) );
CPPUNIT_ASSERT_EQUAL( aFifthPara, rDoc.GetParaAsString(sal_Int32(6)) );
CPPUNIT_ASSERT_EQUAL( aSixthPara, rDoc.GetParaAsString(sal_Int32(7)) );
CPPUNIT_ASSERT_EQUAL( aSeventhPara, rDoc.GetParaAsString(sal_Int32(8)) );
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 20b6bd4dcc3c..6aa35ce94eee 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -411,12 +411,11 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, vcl::Region* pRegion,
OString sRectangle = comphelper::string::join("; ", v);
const vcl::ILibreOfficeKitNotifier* pNotifier = pParent->GetLOKNotifier();
- const OUString rAction("text_selection");
std::vector<vcl::LOKPayloadItem> aItems;
aItems.emplace_back("rectangles", sRectangle);
aItems.emplace_back("startHandleVisible", OString::boolean(bStartHandleVisible));
aItems.emplace_back("endHandleVisible", OString::boolean(bEndHandleVisible));
- pNotifier->notifyWindow(pParent->GetLOKWindowId(), rAction, aItems);
+ pNotifier->notifyWindow(pParent->GetLOKWindowId(), "text_selection", aItems);
pPolyPoly.reset();
return;
}
@@ -1830,10 +1829,9 @@ void ImpEditView::DeselectAll()
if (pParent && pParent->GetLOKWindowId())
{
const vcl::ILibreOfficeKitNotifier* pNotifier = pParent->GetLOKNotifier();
- const OUString rAction("text_selection");
std::vector<vcl::LOKPayloadItem> aItems;
aItems.emplace_back("rectangles", "");
- pNotifier->notifyWindow(pParent->GetLOKWindowId(), rAction, aItems);
+ pNotifier->notifyWindow(pParent->GetLOKWindowId(), "text_selection", aItems);
}
}
}
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index c776cb45aae7..c6a0fd9da25d 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -2387,8 +2387,7 @@ SvStringsISortDtor* SvxAutoCorrectLanguageLists::LoadCplSttExceptList()
try
{
tools::SvRef<SotStorage> xStg = new SotStorage( sShareAutoCorrFile, StreamMode::READ | StreamMode::SHARE_DENYNONE );
- OUString sTemp ( pXMLImplCplStt_ExcptLstStr );
- if( xStg.is() && xStg->IsContained( sTemp ) )
+ if( xStg.is() && xStg->IsContained( pXMLImplCplStt_ExcptLstStr ) )
LoadXMLExceptList_Imp( pCplStt_ExcptLst, pXMLImplCplStt_ExcptLstStr, xStg );
}
catch (const css::ucb::ContentCreationException&)
@@ -2417,8 +2416,7 @@ SvStringsISortDtor* SvxAutoCorrectLanguageLists::LoadWrdSttExceptList()
try
{
tools::SvRef<SotStorage> xStg = new SotStorage( sShareAutoCorrFile, StreamMode::READ | StreamMode::SHARE_DENYNONE );
- OUString sTemp ( pXMLImplWrdStt_ExcptLstStr );
- if( xStg.is() && xStg->IsContained( sTemp ) )
+ if( xStg.is() && xStg->IsContained( pXMLImplWrdStt_ExcptLstStr ) )
LoadXMLExceptList_Imp( pWrdStt_ExcptLst, pXMLImplWrdStt_ExcptLstStr, xStg );
}
catch (const css::ucb::ContentCreationException &)
@@ -2528,11 +2526,9 @@ void SvxAutoCorrectLanguageLists::MakeUserStorage_Impl()
if( xSrcStg.is() && xDstStg.is() )
{
- OUString sXMLWord ( pXMLImplWrdStt_ExcptLstStr );
- OUString sXMLSentence ( pXMLImplCplStt_ExcptLstStr );
std::unique_ptr<SvStringsISortDtor> pTmpWordList;
- if (xSrcStg->IsContained( sXMLWord ) )
+ if (xSrcStg->IsContained( pXMLImplWrdStt_ExcptLstStr ) )
LoadXMLExceptList_Imp( pTmpWordList, pXMLImplWrdStt_ExcptLstStr, xSrcStg );
if (pTmpWordList)
@@ -2542,7 +2538,7 @@ void SvxAutoCorrectLanguageLists::MakeUserStorage_Impl()
}
- if (xSrcStg->IsContained( sXMLSentence ) )
+ if (xSrcStg->IsContained( pXMLImplCplStt_ExcptLstStr ) )
LoadXMLExceptList_Imp( pTmpWordList, pXMLImplCplStt_ExcptLstStr, xSrcStg );
if (pTmpWordList)
diff --git a/editeng/source/xml/xmltxtexp.cxx b/editeng/source/xml/xmltxtexp.cxx
index f5303cd7b2e7..929a089dc14e 100644
--- a/editeng/source/xml/xmltxtexp.cxx
+++ b/editeng/source/xml/xmltxtexp.cxx
@@ -316,11 +316,10 @@ void SvxWriteXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection&
xWriter->setOutputStream( xOut );
// export text
- const OUString aName;
// SvxXMLTextExportComponent aExporter( &rEditEngine, rSel, aName, xHandler );
uno::Reference< xml::sax::XDocumentHandler > xHandler(xWriter, UNO_QUERY_THROW);
- rtl::Reference< SvxXMLTextExportComponent > xExporter( new SvxXMLTextExportComponent( xContext, &rEditEngine, rSel, aName, xHandler ) );
+ rtl::Reference< SvxXMLTextExportComponent > xExporter( new SvxXMLTextExportComponent( xContext, &rEditEngine, rSel, "", xHandler ) );
xExporter->exportDoc();