summaryrefslogtreecommitdiff
path: root/cui/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-10-21 13:38:33 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-10-22 14:14:48 +0200
commit7fb43031b7eec663768f5a4e78e60da86379df41 (patch)
tree026dd9b5a522aec8534763af074fc4a28ccfa58d /cui/source
parent61ea11e51ceeaec7bf197a076cf40d96bd65ad07 (diff)
loplugin:constantparam
Change-Id: Ibfe70492683ff3ec208cee95d8a11155ec54f690 Reviewed-on: https://gerrit.libreoffice.org/81314 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cui/source')
-rw-r--r--cui/source/customize/SvxMenuConfigPage.cxx4
-rw-r--r--cui/source/customize/SvxToolbarConfigPage.cxx2
-rw-r--r--cui/source/customize/cfg.cxx15
-rw-r--r--cui/source/dialogs/hangulhanjadlg.cxx49
-rw-r--r--cui/source/inc/cfg.hxx5
5 files changed, 23 insertions, 52 deletions
diff --git a/cui/source/customize/SvxMenuConfigPage.cxx b/cui/source/customize/SvxMenuConfigPage.cxx
index f7d7a5647d1e..f560a25f1632 100644
--- a/cui/source/customize/SvxMenuConfigPage.cxx
+++ b/cui/source/customize/SvxMenuConfigPage.cxx
@@ -386,7 +386,7 @@ IMPL_LINK(SvxMenuConfigPage, InsertHdl, const OString&, rIdent, void)
{
SvxConfigEntry* pNewEntryData = new SvxConfigEntry;
pNewEntryData->SetUserDefined();
- int nPos = InsertEntry(pNewEntryData, -1);
+ int nPos = AppendEntry(pNewEntryData, -1);
InsertEntryIntoUI(pNewEntryData, nPos, 0);
}
else if (rIdent == "insertsubmenu")
@@ -407,7 +407,7 @@ IMPL_LINK(SvxMenuConfigPage, InsertHdl, const OString&, rIdent, void)
pNewEntryData->SetName( aNewName );
pNewEntryData->SetUserDefined();
- int nPos = InsertEntry(pNewEntryData, -1);
+ int nPos = AppendEntry(pNewEntryData, -1);
InsertEntryIntoUI(pNewEntryData, nPos, 0);
ReloadTopLevelListBox();
diff --git a/cui/source/customize/SvxToolbarConfigPage.cxx b/cui/source/customize/SvxToolbarConfigPage.cxx
index 7f6efd83803c..36b3fd202d32 100644
--- a/cui/source/customize/SvxToolbarConfigPage.cxx
+++ b/cui/source/customize/SvxToolbarConfigPage.cxx
@@ -463,7 +463,7 @@ IMPL_LINK(SvxToolbarConfigPage, InsertHdl, const OString&, rIdent, void)
SvxConfigEntry* pNewEntryData = new SvxConfigEntry;
pNewEntryData->SetUserDefined();
- int nPos = InsertEntry(pNewEntryData, -1);
+ int nPos = AppendEntry(pNewEntryData, -1);
InsertEntryIntoUI(pNewEntryData, nPos, 1);
static_cast<ToolbarSaveInData*>( GetSaveInData())->ApplyToolbar( pToolbar );
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index b9f08fe53149..ae4d0da10834 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -1446,13 +1446,12 @@ int SvxConfigPage::AddFunction(int nTarget, bool bAllowDuplicates)
}
}
- return InsertEntry(pNewEntryData, nTarget, /*bFront*/false);
+ return AppendEntry(pNewEntryData, nTarget);
}
-int SvxConfigPage::InsertEntry(
+int SvxConfigPage::AppendEntry(
SvxConfigEntry* pNewEntryData,
- int nTarget,
- bool bFront)
+ int nTarget)
{
SvxConfigEntry* pTopLevelSelection = GetTopLevelSelection();
@@ -1468,13 +1467,7 @@ int SvxConfigPage::InsertEntry(
OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pNewEntryData)));
- if (bFront)
- {
- pEntries->insert( pEntries->begin(), pNewEntryData );
- m_xContentsListBox->insert(0, sId);
- nNewEntry = 0;
- }
- else if (nCurEntry == -1 || nCurEntry == m_xContentsListBox->n_children() - 1)
+ if (nCurEntry == -1 || nCurEntry == m_xContentsListBox->n_children() - 1)
{
pEntries->push_back( pNewEntryData );
m_xContentsListBox->insert(-1, sId);
diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx
index 2019bc6cc1f6..e3b0b2e5d592 100644
--- a/cui/source/dialogs/hangulhanjadlg.cxx
+++ b/cui/source/dialogs/hangulhanjadlg.cxx
@@ -101,7 +101,7 @@ namespace svx
const OUString& getSecondaryText() const { return m_sSecondaryText; }
public:
- void Paint( vcl::RenderContext& _rDevice, const ::tools::Rectangle& _rRect, DrawTextFlags _nTextStyle,
+ void Paint( vcl::RenderContext& _rDevice, const ::tools::Rectangle& _rRect,
::tools::Rectangle* _pPrimaryLocation, ::tools::Rectangle* _pSecondaryLocation );
};
@@ -118,9 +118,14 @@ namespace svx
}
- void PseudoRubyText::Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle& _rRect, DrawTextFlags _nTextStyle,
+ void PseudoRubyText::Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle& _rRect,
::tools::Rectangle* _pPrimaryLocation, ::tools::Rectangle* _pSecondaryLocation )
{
+ // calculate the text flags for the painting
+ constexpr DrawTextFlags nTextStyle = DrawTextFlags::Mnemonic |
+ DrawTextFlags::Left |
+ DrawTextFlags::VCenter;
+
Size aPlaygroundSize(_rRect.GetSize());
// the font for the secondary text:
@@ -129,11 +134,11 @@ namespace svx
aSmallerFont.SetFontHeight( static_cast<long>( 0.8 * aSmallerFont.GetFontHeight() ) );
// let's calculate the size of our two texts
- ::tools::Rectangle aPrimaryRect = rRenderContext.GetTextRect( _rRect, m_sPrimaryText, _nTextStyle );
+ ::tools::Rectangle aPrimaryRect = rRenderContext.GetTextRect( _rRect, m_sPrimaryText, nTextStyle );
::tools::Rectangle aSecondaryRect;
{
FontSwitch aFontRestore(rRenderContext, aSmallerFont);
- aSecondaryRect = rRenderContext.GetTextRect(_rRect, m_sSecondaryText, _nTextStyle);
+ aSecondaryRect = rRenderContext.GetTextRect(_rRect, m_sSecondaryText, nTextStyle);
}
// position these rectangles properly
@@ -145,36 +150,15 @@ namespace svx
aSecondaryRect.SetLeft( aPrimaryRect.Left() );
aPrimaryRect.SetRight( _rRect.Left() + nCombinedWidth );
aSecondaryRect.SetRight( aPrimaryRect.Right() );
- if (DrawTextFlags::Right & _nTextStyle)
- {
- // move the rectangles to the right
- aPrimaryRect.Move( aPlaygroundSize.Width() - nCombinedWidth, 0 );
- aSecondaryRect.Move( aPlaygroundSize.Width() - nCombinedWidth, 0 );
- }
- else if (DrawTextFlags::Center & _nTextStyle)
- {
- // center the rectangles
- aPrimaryRect.Move( ( aPlaygroundSize.Width() - nCombinedWidth ) / 2, 0 );
- aSecondaryRect.Move( ( aPlaygroundSize.Width() - nCombinedWidth ) / 2, 0 );
- }
// y-axis:
sal_Int32 nCombinedHeight = aPrimaryRect.GetHeight() + aSecondaryRect.GetHeight();
// align to the top, for the moment
aPrimaryRect.Move( 0, _rRect.Top() - aPrimaryRect.Top() );
aSecondaryRect.Move( 0, aPrimaryRect.Top() + aPrimaryRect.GetHeight() - aSecondaryRect.Top() );
- if (DrawTextFlags::Bottom & _nTextStyle)
- {
- // move the rects to the bottom
- aPrimaryRect.Move( 0, aPlaygroundSize.Height() - nCombinedHeight );
- aSecondaryRect.Move( 0, aPlaygroundSize.Height() - nCombinedHeight );
- }
- else if (DrawTextFlags::VCenter & _nTextStyle)
- {
- // move the rects to the bottom
- aPrimaryRect.Move( 0, ( aPlaygroundSize.Height() - nCombinedHeight ) / 2 );
- aSecondaryRect.Move( 0, ( aPlaygroundSize.Height() - nCombinedHeight ) / 2 );
- }
+ // move the rects to the bottom
+ aPrimaryRect.Move( 0, ( aPlaygroundSize.Height() - nCombinedHeight ) / 2 );
+ aSecondaryRect.Move( 0, ( aPlaygroundSize.Height() - nCombinedHeight ) / 2 );
// 'til here, everything we did assumes that the secondary text is painted _below_ the primary
// text. If this isn't the case, we need to correct the rectangles
@@ -188,7 +172,7 @@ namespace svx
// now draw the texts
// as we already calculated the precise rectangles for the texts, we don't want to
// use the alignment flags given - within it's rect, every text is centered
- DrawTextFlags nDrawTextStyle( _nTextStyle );
+ DrawTextFlags nDrawTextStyle( nTextStyle );
nDrawTextStyle &= ~DrawTextFlags( DrawTextFlags::Right | DrawTextFlags::Left | DrawTextFlags::Bottom | DrawTextFlags::Top );
nDrawTextStyle |= DrawTextFlags::Center | DrawTextFlags::VCenter;
@@ -254,16 +238,11 @@ namespace svx
aTextRect.AdjustLeft( 1 ); aTextRect.AdjustRight( -1 );
aTextRect.AdjustTop( 1 ); aTextRect.AdjustBottom( -1 );
- // calculate the text flags for the painting
- constexpr DrawTextFlags nTextStyle = DrawTextFlags::Mnemonic |
- DrawTextFlags::Left |
- DrawTextFlags::VCenter;
-
// paint the ruby text
::tools::Rectangle aPrimaryTextLocation;
::tools::Rectangle aSecondaryTextLocation;
- m_aRubyText.Paint(rRenderContext, aTextRect, nTextStyle, &aPrimaryTextLocation, &aSecondaryTextLocation);
+ m_aRubyText.Paint(rRenderContext, aTextRect, &aPrimaryTextLocation, &aSecondaryTextLocation);
}
Size RubyRadioButton::GetOptimalSize() const
diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx
index 8163387f13e9..379655697a7a 100644
--- a/cui/source/inc/cfg.hxx
+++ b/cui/source/inc/cfg.hxx
@@ -426,9 +426,8 @@ protected:
virtual void SelectElement() = 0;
- int InsertEntry(SvxConfigEntry* pNewEntryData,
- int nTarget,
- bool bFront = false);
+ int AppendEntry(SvxConfigEntry* pNewEntryData,
+ int nTarget);
void AddSubMenusToUI( const OUString& rBaseTitle,
SvxConfigEntry const * pParentData );