summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorNoel <noelgrandin@gmail.com>2020-10-02 09:36:35 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-10-02 10:46:46 +0200
commit268a49f473c1830be269a7db5f561e3681134bbd (patch)
tree259debcc224b3f211125ca6615b4fc25b2dcdeb2 /editeng
parenta282c9700806bc17710e8b2186b306d2a90928ee (diff)
loplugin:reducevarscope in desktop..emfio
Change-Id: I25ca760ae15114ada621d928997a7117401c75d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103811 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/editdoc.cxx3
-rw-r--r--editeng/source/misc/svxacorr.cxx5
-rw-r--r--editeng/source/outliner/outliner.cxx4
-rw-r--r--editeng/source/uno/unoedprx.cxx2
-rw-r--r--editeng/source/uno/unofored.cxx3
-rw-r--r--editeng/source/uno/unotext.cxx2
6 files changed, 8 insertions, 11 deletions
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 0d5213355c5c..75b9ef827cb3 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -1682,10 +1682,9 @@ void ContentNode::UnExpandPosition( sal_Int32 &rPos, bool bBiasStart )
if (nOffset >= rPos) // happens after the position
return;
- sal_Int32 nChunk = 0;
if (rAttr.Which() == EE_FEATURE_FIELD)
{
- nChunk += static_cast<const EditCharAttribField&>(rAttr).GetFieldValue().getLength();
+ sal_Int32 nChunk = static_cast<const EditCharAttribField&>(rAttr).GetFieldValue().getLength();
nChunk--; // Character representing the field in the string
if (nOffset + nChunk >= rPos) // we're inside the field
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index b51d34e6173d..ea7372f1e15d 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -1323,13 +1323,12 @@ void SvxAutoCorrect::DoAutoCorrect( SvxAutoCorrDoc& rDoc, const OUString& rTxt,
(IsAutoCorrFlag( ACFlags::ChgSglQuotes ) && bSingle );
if( bIsReplaceQuote )
{
- sal_Unicode cPrev;
bool bSttQuote = !nInsPos;
ACQuotes eType = ACQuotes::NONE;
const LanguageType eLang = GetDocLanguage( rDoc, nInsPos );
if (!bSttQuote)
{
- cPrev = rTxt[ nInsPos-1 ];
+ sal_Unicode cPrev = rTxt[ nInsPos-1 ];
bSttQuote = NonFieldWordDelim(cPrev) ||
lcl_IsInAsciiArr( "([{", cPrev ) ||
( cEmDash == cPrev ) ||
@@ -2775,10 +2774,10 @@ void SvxAutoCorrectLanguageLists::PutText( const OUString& rShort,
MakeUserStorage_Impl();
- OUString sLong;
try
{
uno::Reference < embed::XStorage > xStg = comphelper::OStorageHelper::GetStorageFromURL( sUserAutoCorrFile, embed::ElementModes::READWRITE );
+ OUString sLong;
bool bRet = rAutoCorrect.PutText( xStg, sUserAutoCorrFile, rShort, rShell, sLong );
xStg = nullptr;
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index ca97d103c012..5684c64a44a7 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -496,8 +496,6 @@ bool Outliner::ImpConvertEdtToOut( sal_Int32 nPara )
ESelection aDelSel;
OUString aName;
- OUString aHeading_US( "heading" );
- OUString aNumber_US( "Numbering" );
OUString aStr( pEditEngine->GetText( nPara ) );
const sal_Unicode* pPtr = aStr.getStr();
@@ -507,6 +505,8 @@ bool Outliner::ImpConvertEdtToOut( sal_Int32 nPara )
SfxStyleSheet* pStyle= pEditEngine->GetStyleSheet( nPara );
if( pStyle )
{
+ OUString aHeading_US( "heading" );
+ OUString aNumber_US( "Numbering" );
aName = pStyle->GetName();
sal_Int32 nSearch;
if ( ( nSearch = aName.indexOf( aHeading_US ) ) != -1 )
diff --git a/editeng/source/uno/unoedprx.cxx b/editeng/source/uno/unoedprx.cxx
index 628570fdca74..8cf7d8e62417 100644
--- a/editeng/source/uno/unoedprx.cxx
+++ b/editeng/source/uno/unoedprx.cxx
@@ -953,7 +953,6 @@ sal_Int32 SvxAccessibleTextAdapter::GetLineLen( sal_Int32 nPara, sal_Int32 nLine
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
- SvxAccessibleTextIndex aStartIndex;
SvxAccessibleTextIndex aEndIndex;
sal_Int32 nCurrLine;
sal_Int32 nCurrIndex, nLastIndex;
@@ -967,6 +966,7 @@ sal_Int32 SvxAccessibleTextAdapter::GetLineLen( sal_Int32 nPara, sal_Int32 nLine
aEndIndex.SetEEIndex( nPara, nCurrIndex, *this );
if( nLine > 0 )
{
+ SvxAccessibleTextIndex aStartIndex;
aStartIndex.SetEEIndex( nPara, nLastIndex, *this );
return aEndIndex.GetIndex() - aStartIndex.GetIndex();
diff --git a/editeng/source/uno/unofored.cxx b/editeng/source/uno/unofored.cxx
index 8b0a55bde535..bde2a75e26ab 100644
--- a/editeng/source/uno/unofored.cxx
+++ b/editeng/source/uno/unofored.cxx
@@ -340,7 +340,6 @@ tools::Rectangle SvxEditEngineForwarder::GetParaBounds( sal_Int32 nPara ) const
const Point aPnt = rEditEngine.GetDocPosTopLeft( nPara );
sal_uLong nWidth;
sal_uLong nHeight;
- sal_uLong nTextWidth;
if( rEditEngine.IsVertical() )
{
@@ -349,7 +348,7 @@ tools::Rectangle SvxEditEngineForwarder::GetParaBounds( sal_Int32 nPara ) const
// don't rotate.
nWidth = rEditEngine.GetTextHeight( nPara );
nHeight = rEditEngine.GetTextHeight();
- nTextWidth = rEditEngine.GetTextHeight();
+ sal_uLong nTextWidth = rEditEngine.GetTextHeight();
return tools::Rectangle( nTextWidth - aPnt.Y() - nWidth, 0, nTextWidth - aPnt.Y(), nHeight );
}
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index d4a3364f44fa..f15e57c8f704 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -1734,9 +1734,9 @@ void SAL_CALL SvxUnoTextBase::insertString( const uno::Reference< text::XTextRan
if( !xRange.is() )
return;
- ESelection aSelection;
if (GetEditSource())
{
+ ESelection aSelection;
::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );
SetSelection( aSelection );
}