summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorNoel <noelgrandin@gmail.com>2020-10-05 09:26:33 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-10-05 11:24:21 +0200
commit980cb24e1e94ed928b6db9e6b8b5ba377de2a574 (patch)
treeece36ce4b1200dc74a91f7b92ec9f08e255b03f5 /starmath
parent03dfa09886b6fd0ebda7abe7d5e142da172e8cc2 (diff)
loplugin:reducevarscope in starmath
Change-Id: I5d90de0d2fdab876899a6e072b7911921d691d14 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103946 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'starmath')
-rw-r--r--starmath/qa/cppunit/test_starmath.cxx10
-rw-r--r--starmath/source/mathtype.cxx2
-rw-r--r--starmath/source/utility.cxx4
-rw-r--r--starmath/source/view.cxx3
-rw-r--r--starmath/source/visitors.cxx16
5 files changed, 15 insertions, 20 deletions
diff --git a/starmath/qa/cppunit/test_starmath.cxx b/starmath/qa/cppunit/test_starmath.cxx
index 20dfd1148110..c9e6f2c35663 100644
--- a/starmath/qa/cppunit/test_starmath.cxx
+++ b/starmath/qa/cppunit/test_starmath.cxx
@@ -150,7 +150,6 @@ void Test::tearDown()
void Test::testSmTmpDeviceRestoreFont()
{
ScopedVclPtrInstance<Printer> pPrinter;
- bool bUseMap100th_mm = true;
OUString aFontName("Linux Libertine G");
CPPUNIT_ASSERT(pPrinter->IsFontAvailable(aFontName));
@@ -162,6 +161,7 @@ void Test::testSmTmpDeviceRestoreFont()
vcl::Font aNewFont;
{
+ bool bUseMap100th_mm = true;
SmTmpDevice aTmpDev(*pPrinter, bUseMap100th_mm);
aNewFont = pPrinter->GetFont();
@@ -384,8 +384,8 @@ void Test::editUndoRedo()
CPPUNIT_ASSERT_EQUAL_MESSAGE("Strings must match", sFinalText, sStringOne);
}
- OUString sStringTwo("a over b");
{
+ OUString sStringTwo("a over b");
rEditEngine.SetText(0, sStringTwo);
m_xDocShRef->UpdateText();
OUString sFinalText = m_xDocShRef->GetText();
@@ -439,12 +439,12 @@ void Test::replacePlaceholder()
void Test::viewZoom()
{
- sal_uInt16 nOrigZoom, nNextZoom, nFinalZoom;
+ sal_uInt16 nOrigZoom, nFinalZoom;
EditEngine &rEditEngine = m_xDocShRef->GetEditEngine();
- OUString sStringOne("a under b");
{
+ OUString sStringOne("a under b");
rEditEngine.SetText(0, sStringOne);
m_xDocShRef->UpdateText();
OUString sFinalText = m_xDocShRef->GetText();
@@ -458,7 +458,7 @@ void Test::viewZoom()
{
SfxRequest aZoomIn(SID_ZOOMIN, SfxCallMode::SYNCHRON, m_pViewShell->GetPool());
m_pViewShell->Execute(aZoomIn);
- nNextZoom = rGraphicWindow.GetZoom();
+ sal_uInt16 nNextZoom = rGraphicWindow.GetZoom();
CPPUNIT_ASSERT_MESSAGE("Should be bigger", nNextZoom > nOrigZoom);
}
diff --git a/starmath/source/mathtype.cxx b/starmath/source/mathtype.cxx
index 13297eb7fc34..43602a491d03 100644
--- a/starmath/source/mathtype.cxx
+++ b/starmath/source/mathtype.cxx
@@ -1799,10 +1799,10 @@ void MathType::HandleAlign(sal_uInt8 nHorAlign, int &rSetAlign)
* indicator by mathtype file format*/
bool MathType::HandleSize(sal_Int16 nLstSize,sal_Int16 nDefSize, int &rSetSize)
{
- const sal_Int16 nDefaultSize = 12;
bool bRet=false;
if (nLstSize < 0)
{
+ const sal_Int16 nDefaultSize = 12;
if ((-nLstSize/32 != nDefaultSize) && (-nLstSize/32 != nCurSize))
{
if (rSetSize)
diff --git a/starmath/source/utility.cxx b/starmath/source/utility.cxx
index a842c7ed66a2..62e0b0294afd 100644
--- a/starmath/source/utility.cxx
+++ b/starmath/source/utility.cxx
@@ -126,13 +126,11 @@ SmFontPickListBox::SmFontPickListBox(std::unique_ptr<weld::ComboBox> pWidget)
IMPL_LINK_NOARG(SmFontPickListBox, SelectHdl, weld::ComboBox&, void)
{
- OUString aString;
-
const int nPos = m_xWidget->get_active();
if (nPos != 0)
{
SmFontPickList::Insert(Get(nPos));
- aString = m_xWidget->get_text(nPos);
+ OUString aString = m_xWidget->get_text(nPos);
m_xWidget->remove(nPos);
m_xWidget->insert_text(0, aString);
}
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index dd967232723b..43132079dd16 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -1579,10 +1579,9 @@ void SmViewShell::Execute(SfxRequest& rReq)
{
TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard(GetEditWindow()) );
uno::Reference < io::XInputStream > xStrm;
- SotClipboardFormatId nId = SOT_FORMAT_SYSTEM_START; //dummy initialize to avoid warning
if ( aDataHelper.GetTransferable().is() )
{
- nId = SotClipboardFormatId::MATHML;
+ SotClipboardFormatId nId = SotClipboardFormatId::MATHML;
if (aDataHelper.HasFormat(nId))
{
xStrm = aDataHelper.GetInputStream(nId, "");
diff --git a/starmath/source/visitors.cxx b/starmath/source/visitors.cxx
index f4db5c10257f..b1a1798247c1 100644
--- a/starmath/source/visitors.cxx
+++ b/starmath/source/visitors.cxx
@@ -981,13 +981,11 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmOperNode* pNode )
//Get subsup pNode if any
SmSubSupNode* pSubSup = pOper->GetType( ) == SmNodeType::SubSup ? static_cast<SmSubSupNode*>(pOper) : nullptr;
- SmNode* pChild;
- SmCaretPosGraphEntry *childLeft;
if( pSubSup ) {
- pChild = pSubSup->GetSubSup( LSUP );
+ SmNode* pChild = pSubSup->GetSubSup( LSUP );
if( pChild ) {
//Create position in front of pChild
- childLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left );
+ SmCaretPosGraphEntry *childLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left );
//Visit pChild
mpRightMost = childLeft;
pChild->Accept( this );
@@ -998,7 +996,7 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmOperNode* pNode )
pChild = pSubSup->GetSubSup( LSUB );
if( pChild ) {
//Create position in front of pChild
- childLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left );
+ SmCaretPosGraphEntry *childLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left );
//Visit pChild
mpRightMost = childLeft;
pChild->Accept( this );
@@ -1009,7 +1007,7 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmOperNode* pNode )
pChild = pSubSup->GetSubSup( CSUP );
if ( pChild ) {//TO
//Create position in front of pChild
- childLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left );
+ SmCaretPosGraphEntry *childLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left );
//Visit pChild
mpRightMost = childLeft;
pChild->Accept( this );
@@ -1020,7 +1018,7 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmOperNode* pNode )
pChild = pSubSup->GetSubSup( CSUB );
if( pChild ) { //FROM
//Create position in front of pChild
- childLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left );
+ SmCaretPosGraphEntry *childLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left );
//Visit pChild
mpRightMost = childLeft;
pChild->Accept( this );
@@ -1031,7 +1029,7 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmOperNode* pNode )
pChild = pSubSup->GetSubSup( RSUP );
if ( pChild ) {
//Create position in front of pChild
- childLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left );
+ SmCaretPosGraphEntry *childLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left );
//Visit pChild
mpRightMost = childLeft;
pChild->Accept( this );
@@ -1042,7 +1040,7 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmOperNode* pNode )
pChild = pSubSup->GetSubSup( RSUB );
if ( pChild ) {
//Create position in front of pChild
- childLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left );
+ SmCaretPosGraphEntry *childLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left );
//Visit pChild
mpRightMost = childLeft;
pChild->Accept( this );