summaryrefslogtreecommitdiff
path: root/sd/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-10-12 17:12:22 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-10-15 19:22:21 +0200
commiteaf0c263eb1a72a58d2a67cc0506ab022d7c4be4 (patch)
tree4c732e95b560235e83c6de4b5b96260b638fa88d /sd/source
parent921ae49cd7e332d7e1ad702efe2198b2780cc829 (diff)
loplugin:staticconstfield improvements
And fix ScXMLCachedRowAttrAccess::Cache which was never setting its mnTab field, and hence would never be hit. And fix oox::xls::CellBlockBuffer, which was never setting mnCurrRow. Change-Id: I2c46aa050b9ebe3c2dc2e52579555f97945dd61c Reviewed-on: https://gerrit.libreoffice.org/61772 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source')
-rw-r--r--sd/source/ui/animations/CustomAnimationPane.cxx6
-rw-r--r--sd/source/ui/animations/CustomAnimationPane.hxx2
-rw-r--r--sd/source/ui/sidebar/PreviewValueSet.cxx5
-rw-r--r--sd/source/ui/sidebar/PreviewValueSet.hxx1
-rw-r--r--sd/source/ui/slidesorter/view/SlsLayouter.cxx56
5 files changed, 30 insertions, 40 deletions
diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx
index c32b1788c201..7a4013469ae3 100644
--- a/sd/source/ui/animations/CustomAnimationPane.cxx
+++ b/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -130,7 +130,6 @@ CustomAnimationPane::CustomAnimationPane( Window* pParent, ViewShellBase& rBase,
mrBase( rBase ),
mpCustomAnimationPresets(nullptr),
mnPropertyType( nPropertyTypeNone ),
- mnMotionPathPos( 3 ),
mnCurvePathPos( LISTBOX_ENTRY_NOTFOUND ),
mnPolygonPathPos( LISTBOX_ENTRY_NOTFOUND ),
mnFreeformPathPos( LISTBOX_ENTRY_NOTFOUND ),
@@ -147,7 +146,6 @@ CustomAnimationPane::CustomAnimationPane( Window* pParent, ViewShellBase& rBase,
mrBase( rBase ),
mpCustomAnimationPresets(nullptr),
mnPropertyType( nPropertyTypeNone ),
- mnMotionPathPos( 3 ),
mnCurvePathPos( LISTBOX_ENTRY_NOTFOUND ),
mnPolygonPathPos( LISTBOX_ENTRY_NOTFOUND ),
mnFreeformPathPos( LISTBOX_ENTRY_NOTFOUND ),
@@ -2010,7 +2008,7 @@ PathKind CustomAnimationPane::getCreatePathKind() const
PathKind eKind = PathKind::NONE;
if( ( mpLBAnimation->GetSelectedEntryCount() == 1 ) &&
- ( mpLBCategory->GetSelectedEntryPos() == mnMotionPathPos ) )
+ ( mpLBCategory->GetSelectedEntryPos() == gnMotionPathPos ) )
{
const sal_Int32 nPos = mpLBAnimation->GetSelectedEntryPos();
if( nPos == mnCurvePathPos )
@@ -2237,7 +2235,7 @@ sal_uInt32 CustomAnimationPane::fillAnimationLB( bool bHasText )
const PresetCategoryList::const_iterator aCategoryEnd( rCategoryList.end() );
mpLBAnimation->Clear();
- if(nPosition == mnMotionPathPos)
+ if(nPosition == gnMotionPathPos)
{
OUString sMotionPathLabel( SdResId( STR_CUSTOMANIMATION_USERPATH ) );
mpLBAnimation->InsertCategory( sMotionPathLabel );
diff --git a/sd/source/ui/animations/CustomAnimationPane.hxx b/sd/source/ui/animations/CustomAnimationPane.hxx
index 1c8bd070c784..f13b0cb7c0a2 100644
--- a/sd/source/ui/animations/CustomAnimationPane.hxx
+++ b/sd/source/ui/animations/CustomAnimationPane.hxx
@@ -163,7 +163,7 @@ private:
OUString maStrProperty;
sal_Int32 mnPropertyType;
- sal_Int32 const mnMotionPathPos;
+ static sal_Int32 const gnMotionPathPos = 3;
sal_Int32 mnCurvePathPos;
sal_Int32 mnPolygonPathPos;
sal_Int32 mnFreeformPathPos;
diff --git a/sd/source/ui/sidebar/PreviewValueSet.cxx b/sd/source/ui/sidebar/PreviewValueSet.cxx
index 429411e5a754..a68144bc1b51 100644
--- a/sd/source/ui/sidebar/PreviewValueSet.cxx
+++ b/sd/source/ui/sidebar/PreviewValueSet.cxx
@@ -27,8 +27,7 @@ static const int gnBorderHeight(3);
PreviewValueSet::PreviewValueSet (vcl::Window* pParent)
: ValueSet (pParent, WB_TABSTOP),
- maPreviewSize(10,10),
- mnMaxColumnCount(-1)
+ maPreviewSize(10,10)
{
SetStyle (
GetStyle()
@@ -92,8 +91,6 @@ sal_uInt16 PreviewValueSet::CalculateColumnCount (int nWidth) const
nColumnCount = nWidth / (maPreviewSize.Width() + 2*gnBorderWidth);
if (nColumnCount < 1)
nColumnCount = 1;
- else if (mnMaxColumnCount>0 && nColumnCount>mnMaxColumnCount)
- nColumnCount = mnMaxColumnCount;
}
return static_cast<sal_uInt16>(nColumnCount);
}
diff --git a/sd/source/ui/sidebar/PreviewValueSet.hxx b/sd/source/ui/sidebar/PreviewValueSet.hxx
index 8cf4c17b9d7f..dcc326e4005a 100644
--- a/sd/source/ui/sidebar/PreviewValueSet.hxx
+++ b/sd/source/ui/sidebar/PreviewValueSet.hxx
@@ -51,7 +51,6 @@ protected:
private:
Link<const MouseEvent&,void> maRightMouseClickHandler;
Size maPreviewSize;
- const int mnMaxColumnCount;
sal_uInt16 CalculateColumnCount (int nWidth) const;
sal_uInt16 CalculateRowCount (sal_uInt16 nColumnCount) const;
diff --git a/sd/source/ui/slidesorter/view/SlsLayouter.cxx b/sd/source/ui/slidesorter/view/SlsLayouter.cxx
index f25589dfb917..d2bb1c9ca73d 100644
--- a/sd/source/ui/slidesorter/view/SlsLayouter.cxx
+++ b/sd/source/ui/slidesorter/view/SlsLayouter.cxx
@@ -38,8 +38,8 @@ public:
sal_Int32 mnRightBorder;
sal_Int32 mnTopBorder;
sal_Int32 mnBottomBorder;
- sal_Int32 const mnVerticalGap;
- sal_Int32 const mnHorizontalGap;
+ static const sal_Int32 gnVerticalGap = (10 - 2*Theme_FocusIndicatorWidth);
+ static const sal_Int32 gnHorizontalGap = (10 - 2*Theme_FocusIndicatorWidth);
Size const maMinimalSize;
Size const maPreferredSize;
Size const maMaximalSize;
@@ -429,8 +429,6 @@ Layouter::Implementation::Implementation (
mnRightBorder(5),
mnTopBorder(5),
mnBottomBorder(5),
- mnVerticalGap (10 - 2*Theme_FocusIndicatorWidth),
- mnHorizontalGap(10 - 2*Theme_FocusIndicatorWidth),
maMinimalSize(132,98),
maPreferredSize(200,150),
maMaximalSize(600,400),
@@ -453,8 +451,6 @@ Layouter::Implementation::Implementation (const Implementation& rImplementation)
mnRightBorder(rImplementation.mnRightBorder),
mnTopBorder(rImplementation.mnTopBorder),
mnBottomBorder(rImplementation.mnBottomBorder),
- mnVerticalGap(rImplementation.mnVerticalGap),
- mnHorizontalGap(rImplementation.mnHorizontalGap),
maMinimalSize(rImplementation.maMinimalSize),
maPreferredSize(rImplementation.maPreferredSize),
maMaximalSize(rImplementation.maMaximalSize),
@@ -497,7 +493,7 @@ bool Layouter::Implementation::Rearrange (
mnBottomBorder = mnRequestedBottomBorder;
if (mnColumnCount > 1)
{
- int nMinimumBorderWidth = mnHorizontalGap/2;
+ int nMinimumBorderWidth = gnHorizontalGap/2;
if (mnLeftBorder < nMinimumBorderWidth)
mnLeftBorder = nMinimumBorderWidth;
if (mnRightBorder < nMinimumBorderWidth)
@@ -505,7 +501,7 @@ bool Layouter::Implementation::Rearrange (
}
else
{
- int nMinimumBorderHeight = mnVerticalGap/2;
+ int nMinimumBorderHeight = gnVerticalGap/2;
if (mnTopBorder < nMinimumBorderHeight)
mnTopBorder = nMinimumBorderHeight;
if (mnBottomBorder < nMinimumBorderHeight)
@@ -537,7 +533,7 @@ sal_Int32 Layouter::Implementation::GetRowAtPosition (
if (nY >= 0)
{
// Vertical distance from one row to the next.
- const sal_Int32 nRowOffset (maPageObjectSize.Height() + mnVerticalGap);
+ const sal_Int32 nRowOffset (maPageObjectSize.Height() + gnVerticalGap);
// Calculate row consisting of page objects and gap below.
nRow = nY / nRowOffset;
@@ -551,7 +547,7 @@ sal_Int32 Layouter::Implementation::GetRowAtPosition (
nDistanceIntoGap,
eGapMembership,
nRow,
- mnVerticalGap);
+ gnVerticalGap);
if (!bIncludeBordersAndGaps || nResolvedRow != -1)
nRow = nResolvedRow;
}
@@ -577,7 +573,7 @@ sal_Int32 Layouter::Implementation::GetColumnAtPosition (
if (nX >= 0)
{
// Horizontal distance from one column to the next.
- const sal_Int32 nColumnOffset (maPageObjectSize.Width() + mnHorizontalGap);
+ const sal_Int32 nColumnOffset (maPageObjectSize.Width() + gnHorizontalGap);
// Calculate row consisting of page objects and gap below.
nColumn = nX / nColumnOffset;
@@ -595,7 +591,7 @@ sal_Int32 Layouter::Implementation::GetColumnAtPosition (
nDistanceIntoGap,
eGapMembership,
nColumn,
- mnHorizontalGap);
+ gnHorizontalGap);
if (!bIncludeBordersAndGaps || nResolvedColumn != -1)
nColumn = nResolvedColumn;
}
@@ -843,12 +839,12 @@ Size Layouter::Implementation::GetTargetSize (
if (bCalculateWidth)
aTargetSize.setWidth(
(rWindowSize.Width() - mnLeftBorder - mnRightBorder
- - (mnColumnCount-1) * mnHorizontalGap)
+ - (mnColumnCount-1) * gnHorizontalGap)
/ mnColumnCount);
else if (bCalculateHeight)
aTargetSize.setHeight(
(rWindowSize.Height() - mnTopBorder - mnBottomBorder
- - (mnRowCount-1) * mnVerticalGap)
+ - (mnRowCount-1) * gnVerticalGap)
/ mnRowCount);
if (bCalculateWidth)
@@ -912,10 +908,10 @@ sal_Int32 Layouter::Implementation::GetIndex (
return ::tools::Rectangle(
Point (mnLeftBorder
+ nColumn * maPageObjectSize.Width()
- + std::max<sal_Int32>(nColumn,0) * mnHorizontalGap,
+ + std::max<sal_Int32>(nColumn,0) * gnHorizontalGap,
mnTopBorder
+ nRow * maPageObjectSize.Height()
- + std::max<sal_Int32>(nRow,0) * mnVerticalGap),
+ + std::max<sal_Int32>(nRow,0) * gnVerticalGap),
maPageObjectSize);
}
@@ -929,19 +925,19 @@ sal_Int32 Layouter::Implementation::GetIndex (
if (nColumn == 0)
aBoundingBox.SetLeft( 0 );
else
- aBoundingBox.AdjustLeft( -(mnHorizontalGap/2) );
+ aBoundingBox.AdjustLeft( -(gnHorizontalGap/2) );
if (nColumn == mnColumnCount-1)
aBoundingBox.AdjustRight(mnRightBorder );
else
- aBoundingBox.AdjustRight(mnHorizontalGap/2 );
+ aBoundingBox.AdjustRight(gnHorizontalGap/2 );
if (nRow == 0)
aBoundingBox.SetTop( 0 );
else
- aBoundingBox.AdjustTop( -(mnVerticalGap/2) );
+ aBoundingBox.AdjustTop( -(gnVerticalGap/2) );
if (nRow == mnRowCount-1)
aBoundingBox.AdjustBottom(mnBottomBorder );
else
- aBoundingBox.AdjustBottom(mnVerticalGap/2 );
+ aBoundingBox.AdjustBottom(gnVerticalGap/2 );
return aBoundingBox;
}
@@ -957,13 +953,13 @@ sal_Int32 Layouter::Implementation::GetIndex (
+ mnRightBorder
+ mnColumnCount * maPageObjectSize.Width();
if (mnColumnCount > 1)
- nHorizontalSize += (mnColumnCount-1) * mnHorizontalGap;
+ nHorizontalSize += (mnColumnCount-1) * gnHorizontalGap;
nVerticalSize =
mnTopBorder
+ mnBottomBorder
+ nRowCount * maPageObjectSize.Height();
if (nRowCount > 1)
- nVerticalSize += (nRowCount-1) * mnVerticalGap;
+ nVerticalSize += (nRowCount-1) * gnVerticalGap;
}
return ::tools::Rectangle (
@@ -977,7 +973,7 @@ void Layouter::Implementation::CalculateVerticalLogicalInsertPosition (
InsertPosition& rPosition) const
{
const sal_Int32 nY = rModelPosition.Y() - mnTopBorder + maPageObjectSize.Height()/2;
- const sal_Int32 nRowHeight (maPageObjectSize.Height() + mnVerticalGap);
+ const sal_Int32 nRowHeight (maPageObjectSize.Height() + gnVerticalGap);
const sal_Int32 nRow (::std::min(mnPageCount, nY / nRowHeight));
rPosition.SetLogicalPosition (
nRow,
@@ -1010,7 +1006,7 @@ void HorizontalImplementation::CalculateRowAndColumnCount (const Size&)
void HorizontalImplementation::CalculateMaxRowAndColumnCount (const Size& rWindowSize)
{
mnMaxColumnCount = (rWindowSize.Width() - mnLeftBorder - mnRightBorder)
- / (maPageObjectSize.Width() + mnHorizontalGap);
+ / (maPageObjectSize.Width() + gnHorizontalGap);
mnMaxRowCount = 1;
}
@@ -1025,7 +1021,7 @@ void HorizontalImplementation::CalculateLogicalInsertPosition (
InsertPosition& rPosition) const
{
const sal_Int32 nX = rModelPosition.X() - mnLeftBorder + maPageObjectSize.Width()/2;
- const sal_Int32 nColumnWidth (maPageObjectSize.Width() + mnHorizontalGap);
+ const sal_Int32 nColumnWidth (maPageObjectSize.Width() + gnHorizontalGap);
const sal_Int32 nColumn (::std::min(mnPageCount, nX / nColumnWidth));
rPosition.SetLogicalPosition (
0,
@@ -1059,7 +1055,7 @@ void VerticalImplementation::CalculateRowAndColumnCount (const Size&)
void VerticalImplementation::CalculateMaxRowAndColumnCount (const Size& rWindowSize)
{
mnMaxRowCount = (rWindowSize.Height() - mnTopBorder - mnBottomBorder)
- / (maPageObjectSize.Height() + mnVerticalGap);
+ / (maPageObjectSize.Height() + gnVerticalGap);
mnMaxColumnCount = 1;
}
@@ -1100,7 +1096,7 @@ void GridImplementation::CalculateRowAndColumnCount (const Size& rWindowSize)
// Calculate the column count.
mnColumnCount
= (rWindowSize.Width() - mnRequestedLeftBorder - mnRequestedRightBorder)
- / (maPreferredSize.Width() + mnHorizontalGap);
+ / (maPreferredSize.Width() + gnHorizontalGap);
if (mnColumnCount < mnMinimalColumnCount)
mnColumnCount = mnMinimalColumnCount;
if (mnColumnCount > mnMaximalColumnCount)
@@ -1111,9 +1107,9 @@ void GridImplementation::CalculateRowAndColumnCount (const Size& rWindowSize)
void GridImplementation::CalculateMaxRowAndColumnCount (const Size& rWindowSize)
{
mnMaxColumnCount = (rWindowSize.Width() - mnLeftBorder - mnRightBorder)
- / (maPageObjectSize.Width() + mnHorizontalGap);
+ / (maPageObjectSize.Width() + gnHorizontalGap);
mnMaxRowCount = (rWindowSize.Height() - mnTopBorder - mnBottomBorder)
- / (maPageObjectSize.Height() + mnVerticalGap);
+ / (maPageObjectSize.Height() + gnVerticalGap);
}
Size GridImplementation::CalculateTargetSize (
@@ -1137,7 +1133,7 @@ void GridImplementation::CalculateLogicalInsertPosition (
mnRowCount-1,
GetRowAtPosition (rModelPosition.Y(), true, GM_BOTH)));
const sal_Int32 nX = rModelPosition.X() - mnLeftBorder + maPageObjectSize.Width()/2;
- const sal_Int32 nColumnWidth (maPageObjectSize.Width() + mnHorizontalGap);
+ const sal_Int32 nColumnWidth (maPageObjectSize.Width() + gnHorizontalGap);
sal_Int32 nColumn (::std::min(mnColumnCount, nX / nColumnWidth));
sal_Int32 nIndex (nRow * mnColumnCount + nColumn);
bool bIsAtRunEnd (nColumn == mnColumnCount);