summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-09-18 09:57:26 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-09-18 15:19:04 +0200
commit5d86154f49d713dada4aaa541755076cfeefa2c6 (patch)
tree25c34f4a032526de9798e6f3a69a76d993d739db /cui
parent469892f65d9717fcee7996a040b32d713a83b412 (diff)
loplugin:unusedfields improve search for unused collection fields
look for collection-like fields that are never added to, and are therefore effectively unused Change-Id: Id52c5500ea5e3d2436fb5915aebb86278bf2d925 Reviewed-on: https://gerrit.libreoffice.org/60661 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/inc/cuitabarea.hxx4
-rw-r--r--cui/source/inc/numpages.hxx1
-rw-r--r--cui/source/tabpages/numpages.cxx274
-rw-r--r--cui/source/tabpages/tparea.cxx16
4 files changed, 77 insertions, 218 deletions
diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx
index 544e2e52c62c..c9d1a99bbc52 100644
--- a/cui/source/inc/cuitabarea.hxx
+++ b/cui/source/inc/cuitabarea.hxx
@@ -246,10 +246,6 @@ private:
protected:
Size m_aColorSize;
- Size m_aGradientSize;
- Size m_aBitmapSize;
- Size m_aHatchSize;
- Size m_aPatternSize;
std::unique_ptr<weld::Container> m_xFillTab;
std::unique_ptr<weld::ToggleButton> m_xBtnNone;
diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx
index 1e2dc214b44b..05cfb40a8e77 100644
--- a/cui/source/inc/numpages.hxx
+++ b/cui/source/inc/numpages.hxx
@@ -48,7 +48,6 @@ class SvxNumberingPreview : public vcl::Window
{
const SvxNumRule* pActNum;
vcl::Font aStdFont;
- bool bPosition;
sal_uInt16 nActLevel;
protected:
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 8451dd787d63..b65e195f863d 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -2252,7 +2252,6 @@ static long lcl_DrawBullet(VirtualDevice* pVDev,
SvxNumberingPreview::SvxNumberingPreview(vcl::Window* pParent, WinBits nWinBits)
: Window(pParent, nWinBits)
, pActNum(nullptr)
- , bPosition(false)
, nActLevel(SAL_MAX_UINT16)
{
SetBorderStyle(WindowBorderStyle::MONO);
@@ -2297,232 +2296,97 @@ void SvxNumberingPreview::Paint(vcl::RenderContext& rRenderContext, const ::tool
aStdFont.SetFillColor(aBackColor);
long nFontHeight = nYStep * 6 / 10;
- if (bPosition)
- nFontHeight = nYStep * 15 / 10;
aStdFont.SetFontSize(Size( 0, nFontHeight ));
SvxNodeNum aNum;
sal_uInt16 nPreNum = pActNum->GetLevel(0).GetStart();
- if (bPosition)
+ //#i5153# painting gray or black rectangles as 'normal' numbering text
+ long nWidth = pVDev->GetTextWidth("Preview");
+ long nTextHeight = pVDev->GetTextHeight();
+ long nRectHeight = nTextHeight * 2 / 3;
+ long nTopOffset = nTextHeight - nRectHeight;
+ Color aBlackColor(COL_BLACK);
+ if (aBlackColor == aBackColor)
+ aBlackColor.Invert();
+
+ for (sal_uInt16 nLevel = 0; nLevel < pActNum->GetLevelCount(); ++nLevel, nYStart = nYStart + nYStep)
{
- long nLineHeight = nFontHeight * 8 / 7;
- sal_uInt8 nStart = 0;
- while (!(nActLevel & (1<<nStart)))
+ const SvxNumberFormat &rFmt = pActNum->GetLevel(nLevel);
+ aNum.GetLevelVal()[ nLevel ] = rFmt.GetStart();
+ long nXStart( 0 );
+ pVDev->SetFillColor( aBackColor );
+
+ if (rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION)
{
- nStart++;
+ nXStart = rFmt.GetAbsLSpace() / nWidthRelation;
}
- if (nStart)
- nStart--;
- sal_uInt8 nEnd = std::min(sal_uInt8(nStart + 3), sal_uInt8(pActNum->GetLevelCount()));
- for (sal_uInt8 nLevel = nStart; nLevel < nEnd; ++nLevel)
+ else if (rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT)
{
- const SvxNumberFormat &rFmt = pActNum->GetLevel(nLevel);
- aNum.GetLevelVal()[nLevel] = rFmt.GetStart();
-
- long nXStart( 0 );
- short nTextOffset( 0 );
- long nNumberXPos( 0 );
- if (rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION)
- {
- nXStart = rFmt.GetAbsLSpace() / nWidthRelation;
- nTextOffset = rFmt.GetCharTextDistance() / nWidthRelation;
- nNumberXPos = nXStart;
- long nFirstLineOffset = (-rFmt.GetFirstLineOffset()) / nWidthRelation;
-
- if (nFirstLineOffset <= nNumberXPos)
- nNumberXPos = nNumberXPos - nFirstLineOffset;
- else
- nNumberXPos = 0;
- // in draw this is valid
- if (nTextOffset < 0)
- nNumberXPos = nNumberXPos + nTextOffset;
- }
- else if (rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT)
- {
- const long nTmpNumberXPos((rFmt.GetIndentAt() + rFmt.GetFirstLineIndent() ) / nWidthRelation);
- if (nTmpNumberXPos < 0)
- {
- nNumberXPos = 0;
- }
- else
- {
- nNumberXPos = nTmpNumberXPos;
- }
- }
-
- long nBulletWidth = 0;
- if (SVX_NUM_BITMAP == (rFmt.GetNumberingType() &(~LINK_TOKEN)))
- {
- long nYMiddle = nYStart + ( nFontHeight / 2 );
- nBulletWidth = rFmt.IsShowSymbol() ? lcl_DrawGraphic(pVDev.get(), rFmt, nNumberXPos, nYMiddle, nWidthRelation) : 0;
- }
- else if (SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType())
+ const long nTmpXStart((rFmt.GetIndentAt() + rFmt.GetFirstLineIndent() ) / nWidthRelation);
+ if (nTmpXStart < 0)
{
- nBulletWidth = rFmt.IsShowSymbol() ? lcl_DrawBullet(pVDev.get(), rFmt, nNumberXPos, nYStart, aStdFont.GetFontSize()) : 0;
+ nXStart = 0;
}
else
{
- pVDev->SetFont(aStdFont);
- aNum.SetLevel(nLevel);
- if (pActNum->IsContinuousNumbering())
- aNum.GetLevelVal()[nLevel] = nPreNum;
- OUString aText(pActNum->MakeNumString( aNum ));
- vcl::Font aSaveFont = pVDev->GetFont();
- vcl::Font aColorFont(aSaveFont);
- Color aTmpBulletColor = rFmt.GetBulletColor();
- if (aTmpBulletColor == COL_AUTO)
- aTmpBulletColor = aBackColor.IsDark() ? COL_WHITE : COL_BLACK;
- else if (aTmpBulletColor == aBackColor)
- aTmpBulletColor.Invert();
- aColorFont.SetColor(aTmpBulletColor);
- pVDev->SetFont(aColorFont);
- pVDev->DrawText(Point(nNumberXPos, nYStart), aText);
- pVDev->SetFont(aSaveFont);
- nBulletWidth = pVDev->GetTextWidth(aText);
- nPreNum++;
- }
- if (rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT &&
- rFmt.GetLabelFollowedBy() == SvxNumberFormat::SPACE )
- {
- pVDev->SetFont(aStdFont);
- OUString aText(' ');
- pVDev->DrawText( Point(nNumberXPos, nYStart), aText );
- nBulletWidth = nBulletWidth + pVDev->GetTextWidth(aText);
+ nXStart = nTmpXStart;
}
-
- long nTextXPos( 0 );
- if (rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION)
- {
- nTextXPos = nXStart;
- if (nTextOffset < 0)
- nTextXPos = nTextXPos + nTextOffset;
- if (nNumberXPos + nBulletWidth + nTextOffset > nTextXPos)
- nTextXPos = nNumberXPos + nBulletWidth + nTextOffset;
- }
- else if (rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT)
- {
- switch (rFmt.GetLabelFollowedBy())
- {
- case SvxNumberFormat::LISTTAB:
- {
- nTextXPos = rFmt.GetListtabPos() / nWidthRelation;
- if (nTextXPos < nNumberXPos + nBulletWidth)
- {
- nTextXPos = nNumberXPos + nBulletWidth;
- }
- }
- break;
- case SvxNumberFormat::SPACE:
- case SvxNumberFormat::NOTHING:
- case SvxNumberFormat::NEWLINE:
- {
- nTextXPos = nNumberXPos + nBulletWidth;
- }
- break;
- }
-
- nXStart = rFmt.GetIndentAt() / nWidthRelation;
- }
-
- ::tools::Rectangle aRect1(Point(nTextXPos, nYStart + nFontHeight / 2), Size(aSize.Width() / 2, 2));
- pVDev->SetFillColor(aBackColor);
- pVDev->DrawRect(aRect1);
-
- ::tools::Rectangle aRect2(Point(nXStart, nYStart + nLineHeight + nFontHeight / 2 ), Size(aSize.Width() / 2, 2));
- pVDev->DrawRect(aRect2);
- nYStart += 2 * nLineHeight;
}
- }
- else
- {
- //#i5153# painting gray or black rectangles as 'normal' numbering text
- long nWidth = pVDev->GetTextWidth("Preview");
- long nTextHeight = pVDev->GetTextHeight();
- long nRectHeight = nTextHeight * 2 / 3;
- long nTopOffset = nTextHeight - nRectHeight;
- Color aBlackColor(COL_BLACK);
- if (aBlackColor == aBackColor)
- aBlackColor.Invert();
-
- for (sal_uInt16 nLevel = 0; nLevel < pActNum->GetLevelCount(); ++nLevel, nYStart = nYStart + nYStep)
+ nXStart /= 2;
+ nXStart += 2;
+ long nTextOffset = 2 * nXStep;
+ if (SVX_NUM_BITMAP == (rFmt.GetNumberingType()&(~LINK_TOKEN)))
{
- const SvxNumberFormat &rFmt = pActNum->GetLevel(nLevel);
- aNum.GetLevelVal()[ nLevel ] = rFmt.GetStart();
- long nXStart( 0 );
- pVDev->SetFillColor( aBackColor );
-
- if (rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION)
- {
- nXStart = rFmt.GetAbsLSpace() / nWidthRelation;
- }
- else if (rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT)
+ if (rFmt.IsShowSymbol())
{
- const long nTmpXStart((rFmt.GetIndentAt() + rFmt.GetFirstLineIndent() ) / nWidthRelation);
- if (nTmpXStart < 0)
- {
- nXStart = 0;
- }
- else
- {
- nXStart = nTmpXStart;
- }
- }
- nXStart /= 2;
- nXStart += 2;
- long nTextOffset = 2 * nXStep;
- if (SVX_NUM_BITMAP == (rFmt.GetNumberingType()&(~LINK_TOKEN)))
- {
- if (rFmt.IsShowSymbol())
- {
- long nYMiddle = nYStart + ( nFontHeight / 2 );
- nTextOffset = lcl_DrawGraphic(pVDev.get(), rFmt, nXStart, nYMiddle, nWidthRelation);
- nTextOffset = nTextOffset + nXStep;
- }
- }
- else if (SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType())
- {
- if (rFmt.IsShowSymbol())
- {
- nTextOffset = lcl_DrawBullet(pVDev.get(), rFmt, nXStart, nYStart, aStdFont.GetFontSize());
- nTextOffset = nTextOffset + nXStep;
- }
- }
- else
- {
- vcl::Font aColorFont(aStdFont);
- Color aTmpBulletColor = rFmt.GetBulletColor();
- if (aTmpBulletColor == COL_AUTO)
- aTmpBulletColor = aBackColor.IsDark() ? COL_WHITE : COL_BLACK;
- else if (aTmpBulletColor == aBackColor)
- aTmpBulletColor.Invert();
- aColorFont.SetColor(aTmpBulletColor);
- pVDev->SetFont(aColorFont);
- aNum.SetLevel( nLevel );
- if (pActNum->IsContinuousNumbering())
- aNum.GetLevelVal()[nLevel] = nPreNum;
- OUString aText(pActNum->MakeNumString(aNum));
- pVDev->DrawText(Point(nXStart, nYStart), aText);
- pVDev->SetFont(aStdFont);
- nTextOffset = pVDev->GetTextWidth(aText);
+ long nYMiddle = nYStart + ( nFontHeight / 2 );
+ nTextOffset = lcl_DrawGraphic(pVDev.get(), rFmt, nXStart, nYMiddle, nWidthRelation);
nTextOffset = nTextOffset + nXStep;
- nPreNum++;
- }
- //#i5153# the selected rectangle(s) should be black
- if (0 != (nActLevel & (1<<nLevel)))
- {
- pVDev->SetFillColor( aBlackColor );
- pVDev->SetLineColor( aBlackColor );
}
- else
+ }
+ else if (SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType())
+ {
+ if (rFmt.IsShowSymbol())
{
- //#i5153# unselected levels are gray
- pVDev->SetFillColor( aLineColor );
- pVDev->SetLineColor( aLineColor );
+ nTextOffset = lcl_DrawBullet(pVDev.get(), rFmt, nXStart, nYStart, aStdFont.GetFontSize());
+ nTextOffset = nTextOffset + nXStep;
}
- ::tools::Rectangle aRect1(Point(nXStart + nTextOffset, nYStart + nTopOffset), Size(nWidth, nRectHeight));
- pVDev->DrawRect(aRect1);
}
+ else
+ {
+ vcl::Font aColorFont(aStdFont);
+ Color aTmpBulletColor = rFmt.GetBulletColor();
+ if (aTmpBulletColor == COL_AUTO)
+ aTmpBulletColor = aBackColor.IsDark() ? COL_WHITE : COL_BLACK;
+ else if (aTmpBulletColor == aBackColor)
+ aTmpBulletColor.Invert();
+ aColorFont.SetColor(aTmpBulletColor);
+ pVDev->SetFont(aColorFont);
+ aNum.SetLevel( nLevel );
+ if (pActNum->IsContinuousNumbering())
+ aNum.GetLevelVal()[nLevel] = nPreNum;
+ OUString aText(pActNum->MakeNumString(aNum));
+ pVDev->DrawText(Point(nXStart, nYStart), aText);
+ pVDev->SetFont(aStdFont);
+ nTextOffset = pVDev->GetTextWidth(aText);
+ nTextOffset = nTextOffset + nXStep;
+ nPreNum++;
+ }
+ //#i5153# the selected rectangle(s) should be black
+ if (0 != (nActLevel & (1<<nLevel)))
+ {
+ pVDev->SetFillColor( aBlackColor );
+ pVDev->SetLineColor( aBlackColor );
+ }
+ else
+ {
+ //#i5153# unselected levels are gray
+ pVDev->SetFillColor( aLineColor );
+ pVDev->SetLineColor( aLineColor );
+ }
+ ::tools::Rectangle aRect1(Point(nXStart + nTextOffset, nYStart + nTopOffset), Size(nWidth, nRectHeight));
+ pVDev->DrawRect(aRect1);
}
}
rRenderContext.DrawOutDev(Point(), aSize, Point(), aSize, *pVDev);
diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx
index 68d85d7f0ae1..0daa38f3b1b9 100644
--- a/cui/source/tabpages/tparea.cxx
+++ b/cui/source/tabpages/tparea.cxx
@@ -127,20 +127,20 @@ SvxAreaTabPage::SvxAreaTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs
m_pFillTabPage.disposeAndReset(SvxColorTabPage::Create(aFillTab, &m_rXFSet));
m_aColorSize = m_pFillTabPage->get_container_size();
m_pFillTabPage.disposeAndReset(SvxGradientTabPage::Create(aFillTab, &m_rXFSet));
- m_aGradientSize = m_pFillTabPage->get_container_size();
+ Size aGradientSize = m_pFillTabPage->get_container_size();
m_pFillTabPage.disposeAndReset(SvxBitmapTabPage::Create(aFillTab, &m_rXFSet));
- m_aBitmapSize = m_pFillTabPage->get_container_size();
+ Size aBitmapSize = m_pFillTabPage->get_container_size();
m_pFillTabPage.disposeAndReset(SvxHatchTabPage::Create(aFillTab, &m_rXFSet));
- m_aHatchSize = m_pFillTabPage->get_container_size();
+ Size aHatchSize = m_pFillTabPage->get_container_size();
m_pFillTabPage.disposeAndReset(SvxPatternTabPage::Create(aFillTab, &m_rXFSet));
- m_aPatternSize = m_pFillTabPage->get_container_size();
+ Size aPatternSize = m_pFillTabPage->get_container_size();
m_pFillTabPage.disposeAndClear();
Size aSize(m_aColorSize);
- lclExtendSize(aSize, m_aGradientSize);
- lclExtendSize(aSize, m_aBitmapSize);
- lclExtendSize(aSize, m_aHatchSize);
- lclExtendSize(aSize, m_aPatternSize);
+ lclExtendSize(aSize, aGradientSize);
+ lclExtendSize(aSize, aBitmapSize);
+ lclExtendSize(aSize, aHatchSize);
+ lclExtendSize(aSize, aPatternSize);
m_xFillTab->set_size_request(aSize.Width(), aSize.Height());
}