[Libreoffice-commits] core.git: sw/source

Miklos Vajna vmiklos at collabora.co.uk
Wed May 2 08:16:57 UTC 2018


 sw/source/ui/table/autoformatpreview.cxx   |   99 ++++++++++++++---------------
 sw/source/uibase/inc/autoformatpreview.hxx |   28 ++++----
 2 files changed, 64 insertions(+), 63 deletions(-)

New commits:
commit eef7d1614ee279dfe43e0a4b575d96e0e7e9470c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed May 2 09:14:13 2018 +0200

    sw: prefix members of AutoFormatPreview
    
    Change-Id: I3651abc70862d44238d24bb4b24cffa2731611f7
    Reviewed-on: https://gerrit.libreoffice.org/53720
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sw/source/ui/table/autoformatpreview.cxx b/sw/source/ui/table/autoformatpreview.cxx
index 47447886ba0d..7b302a401703 100644
--- a/sw/source/ui/table/autoformatpreview.cxx
+++ b/sw/source/ui/table/autoformatpreview.cxx
@@ -30,16 +30,16 @@
 
 AutoFormatPreview::AutoFormatPreview(weld::DrawingArea* pDrawingArea)
     : mxDrawingArea(pDrawingArea)
-    , aCurData(OUString())
-    , bFitWidth(false)
+    , maCurrentData(OUString())
+    , mbFitWidth(false)
     , mbRTL(false)
-    , aStrJan(SwResId(STR_JAN))
-    , aStrFeb(SwResId(STR_FEB))
-    , aStrMar(SwResId(STR_MAR))
-    , aStrNorth(SwResId(STR_NORTH))
-    , aStrMid(SwResId(STR_MID))
-    , aStrSouth(SwResId(STR_SOUTH))
-    , aStrSum(SwResId(STR_SUM))
+    , maStringJan(SwResId(STR_JAN))
+    , maStringFeb(SwResId(STR_FEB))
+    , maStringMar(SwResId(STR_MAR))
+    , maStringNorth(SwResId(STR_NORTH))
+    , maStringMid(SwResId(STR_MID))
+    , maStringSouth(SwResId(STR_SOUTH))
+    , maStringSum(SwResId(STR_SUM))
 {
     uno::Reference<uno::XComponentContext> xContext = comphelper::getProcessComponentContext();
     m_xBreak = i18n::BreakIterator::create(xContext);
@@ -53,12 +53,12 @@ AutoFormatPreview::AutoFormatPreview(weld::DrawingArea* pDrawingArea)
 
 IMPL_LINK(AutoFormatPreview, DoResize, const Size&, rSize, void)
 {
-    aPrvSize = Size(rSize.Width() - 6, rSize.Height() - 30);
-    nLabelColWidth = (aPrvSize.Width() - 4) / 4 - 12;
-    nDataColWidth1 = (aPrvSize.Width() - 4 - 2 * nLabelColWidth) / 3;
-    nDataColWidth2 = (aPrvSize.Width() - 4 - 2 * nLabelColWidth) / 4;
-    nRowHeight = (aPrvSize.Height() - 4) / 5;
-    NotifyChange(aCurData);
+    maPreviousSize = Size(rSize.Width() - 6, rSize.Height() - 30);
+    mnLabelColumnWidth = (maPreviousSize.Width() - 4) / 4 - 12;
+    mnDataColumnWidth1 = (maPreviousSize.Width() - 4 - 2 * mnLabelColumnWidth) / 3;
+    mnDataColumnWidth2 = (maPreviousSize.Width() - 4 - 2 * mnLabelColumnWidth) / 4;
+    mnRowHeight = (maPreviousSize.Height() - 4) / 5;
+    NotifyChange(maCurrentData);
 }
 
 void AutoFormatPreview::DetectRTL(SwWrtShell const* pWrtShell)
@@ -90,7 +90,7 @@ static void lcl_SetFontProperties(vcl::Font& rFont, const SvxFontItem& rFontItem
 void AutoFormatPreview::MakeFonts(vcl::RenderContext const& rRenderContext, sal_uInt8 nIndex,
                                   vcl::Font& rFont, vcl::Font& rCJKFont, vcl::Font& rCTLFont)
 {
-    const SwBoxAutoFormat& rBoxFormat = aCurData.GetBoxFormat(nIndex);
+    const SwBoxAutoFormat& rBoxFormat = maCurrentData.GetBoxFormat(nIndex);
 
     rFont = rCJKFont = rCTLFont = rRenderContext.GetFont();
     Size aFontSize(rFont.GetFontSize().Width(), 10 * rRenderContext.GetDPIScaleFactor());
@@ -130,26 +130,26 @@ void AutoFormatPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nC
     switch (nIndex)
     {
         case 1:
-            cellString = aStrJan;
+            cellString = maStringJan;
             break;
         case 2:
-            cellString = aStrFeb;
+            cellString = maStringFeb;
             break;
         case 3:
-            cellString = aStrMar;
+            cellString = maStringMar;
             break;
         case 5:
-            cellString = aStrNorth;
+            cellString = maStringNorth;
             break;
         case 10:
-            cellString = aStrMid;
+            cellString = maStringMid;
             break;
         case 15:
-            cellString = aStrSouth;
+            cellString = maStringSouth;
             break;
         case 4:
         case 20:
-            cellString = aStrSum;
+            cellString = maStringSum;
             break;
         case 6:
         case 8:
@@ -199,11 +199,11 @@ void AutoFormatPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nC
             goto MAKENUMSTR;
 
         MAKENUMSTR:
-            if (aCurData.IsValueFormat())
+            if (maCurrentData.IsValueFormat())
             {
                 OUString sFormat;
                 LanguageType eLng, eSys;
-                aCurData.GetBoxFormat(sal_uInt8(nNum)).GetValueFormat(sFormat, eLng, eSys);
+                maCurrentData.GetBoxFormat(sal_uInt8(nNum)).GetValueFormat(sFormat, eLng, eSys);
 
                 SvNumFormatType nType;
                 bool bNew;
@@ -232,7 +232,7 @@ void AutoFormatPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nC
     long nRightX = 0;
 
     Size theMaxStrSize(cellRect.GetWidth() - FRAME_OFFSET, cellRect.GetHeight() - FRAME_OFFSET);
-    if (aCurData.IsFont())
+    if (maCurrentData.IsFont())
     {
         vcl::Font aFont, aCJKFont, aCTLFont;
         MakeFonts(rRenderContext, nFormatIndex, aFont, aCJKFont, aCTLFont);
@@ -244,7 +244,7 @@ void AutoFormatPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nC
     aScriptedText.SetText(cellString, m_xBreak);
     aStrSize = aScriptedText.GetTextSize();
 
-    if (aCurData.IsFont() && theMaxStrSize.Height() < aStrSize.Height())
+    if (maCurrentData.IsFont() && theMaxStrSize.Height() < aStrSize.Height())
     {
         // If the string in this font does not
         // fit into the cell, the standard font
@@ -263,14 +263,14 @@ void AutoFormatPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nC
     nRightX = cellRect.GetWidth() - aStrSize.Width() - FRAME_OFFSET;
 
     // vertical (always centering):
-    aPos.AdjustY((nRowHeight - aStrSize.Height()) / 2);
+    aPos.AdjustY((mnRowHeight - aStrSize.Height()) / 2);
 
     // horizontal
     if (mbRTL)
         aPos.AdjustX(nRightX);
-    else if (aCurData.IsJustify())
+    else if (maCurrentData.IsJustify())
     {
-        const SvxAdjustItem& rAdj = aCurData.GetBoxFormat(nFormatIndex).GetAdjust();
+        const SvxAdjustItem& rAdj = maCurrentData.GetBoxFormat(nFormatIndex).GetAdjust();
         switch (rAdj.GetAdjust())
         {
             case SvxAdjust::Left:
@@ -309,7 +309,7 @@ void AutoFormatPreview::DrawBackground(vcl::RenderContext& rRenderContext)
         for (size_t nCol = 0; nCol < 5; ++nCol)
         {
             SvxBrushItem aBrushItem(
-                aCurData.GetBoxFormat(GetFormatIndex(nCol, nRow)).GetBackground());
+                maCurrentData.GetBoxFormat(GetFormatIndex(nCol, nRow)).GetBackground());
 
             rRenderContext.Push(PushFlags::LINECOLOR | PushFlags::FILLCOLOR);
             rRenderContext.SetLineColor();
@@ -326,7 +326,7 @@ void AutoFormatPreview::DrawBackground(vcl::RenderContext& rRenderContext)
 void AutoFormatPreview::PaintCells(vcl::RenderContext& rRenderContext)
 {
     // 1) background
-    if (aCurData.IsBackground())
+    if (maCurrentData.IsBackground())
         DrawBackground(rRenderContext);
 
     // 2) values
@@ -335,7 +335,7 @@ void AutoFormatPreview::PaintCells(vcl::RenderContext& rRenderContext)
             DrawString(rRenderContext, nCol, nRow);
 
     // 3) border
-    if (aCurData.IsFrame())
+    if (maCurrentData.IsFrame())
     {
         const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D;
         std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor2D(
@@ -353,24 +353,24 @@ void AutoFormatPreview::PaintCells(vcl::RenderContext& rRenderContext)
 void AutoFormatPreview::Init()
 {
     maArray.Initialize(5, 5);
-    nLabelColWidth = 0;
-    nDataColWidth1 = 0;
-    nDataColWidth2 = 0;
-    nRowHeight = 0;
+    mnLabelColumnWidth = 0;
+    mnDataColumnWidth1 = 0;
+    mnDataColumnWidth2 = 0;
+    mnRowHeight = 0;
     CalcCellArray(false);
     CalcLineMap();
 }
 
 void AutoFormatPreview::CalcCellArray(bool _bFitWidth)
 {
-    maArray.SetAllColWidths(_bFitWidth ? nDataColWidth2 : nDataColWidth1);
-    maArray.SetColWidth(0, nLabelColWidth);
-    maArray.SetColWidth(4, nLabelColWidth);
+    maArray.SetAllColWidths(_bFitWidth ? mnDataColumnWidth2 : mnDataColumnWidth1);
+    maArray.SetColWidth(0, mnLabelColumnWidth);
+    maArray.SetColWidth(4, mnLabelColumnWidth);
 
-    maArray.SetAllRowHeights(nRowHeight);
+    maArray.SetAllRowHeights(mnRowHeight);
 
-    aPrvSize.setWidth(maArray.GetWidth() + 4);
-    aPrvSize.setHeight(maArray.GetHeight() + 4);
+    maPreviousSize.setWidth(maArray.GetWidth() + 4);
+    maPreviousSize.setHeight(maArray.GetHeight() + 4);
 }
 
 inline void lclSetStyleFromBorder(svx::frame::Style& rStyle,
@@ -387,7 +387,8 @@ void AutoFormatPreview::CalcLineMap()
         {
             svx::frame::Style aStyle;
 
-            const SvxBoxItem& rItem = aCurData.GetBoxFormat(GetFormatIndex(nCol, nRow)).GetBox();
+            const SvxBoxItem& rItem
+                = maCurrentData.GetBoxFormat(GetFormatIndex(nCol, nRow)).GetBox();
             lclSetStyleFromBorder(aStyle, rItem.GetLeft());
             maArray.SetCellStyleLeft(nCol, nRow, aStyle);
             lclSetStyleFromBorder(aStyle, rItem.GetRight());
@@ -408,9 +409,9 @@ void AutoFormatPreview::CalcLineMap()
 
 void AutoFormatPreview::NotifyChange(const SwTableAutoFormat& rNewData)
 {
-    aCurData = rNewData;
-    bFitWidth = aCurData.IsJustify(); // true;  //???
-    CalcCellArray(bFitWidth);
+    maCurrentData = rNewData;
+    mbFitWidth = maCurrentData.IsJustify(); // true;  //???
+    CalcCellArray(mbFitWidth);
     CalcLineMap();
     mxDrawingArea->queue_draw();
 }
@@ -444,8 +445,8 @@ IMPL_LINK(AutoFormatPreview, DoPaint, weld::DrawingArea::draw_args, aPayload, vo
     rRenderContext.SetLineColor(oldColor);
 
     // Center the preview
-    maArray.SetXOffset(2 + (theWndSize.Width() - aPrvSize.Width()) / 2);
-    maArray.SetYOffset(2 + (theWndSize.Height() - aPrvSize.Height()) / 2);
+    maArray.SetXOffset(2 + (theWndSize.Width() - maPreviousSize.Width()) / 2);
+    maArray.SetYOffset(2 + (theWndSize.Height() - maPreviousSize.Height()) / 2);
     // Draw cells on virtual device
     PaintCells(rRenderContext);
 
diff --git a/sw/source/uibase/inc/autoformatpreview.hxx b/sw/source/uibase/inc/autoformatpreview.hxx
index 1b9bd74b1589..c1e3b77c9f14 100644
--- a/sw/source/uibase/inc/autoformatpreview.hxx
+++ b/sw/source/uibase/inc/autoformatpreview.hxx
@@ -51,22 +51,22 @@ public:
 
 private:
     std::unique_ptr<weld::DrawingArea> mxDrawingArea;
-    SwTableAutoFormat aCurData;
+    SwTableAutoFormat maCurrentData;
     svx::frame::Array maArray; /// Implementation to draw the frame borders.
-    bool bFitWidth;
+    bool mbFitWidth;
     bool mbRTL;
-    Size aPrvSize;
-    long nLabelColWidth;
-    long nDataColWidth1;
-    long nDataColWidth2;
-    long nRowHeight;
-    const OUString aStrJan;
-    const OUString aStrFeb;
-    const OUString aStrMar;
-    const OUString aStrNorth;
-    const OUString aStrMid;
-    const OUString aStrSouth;
-    const OUString aStrSum;
+    Size maPreviousSize;
+    long mnLabelColumnWidth;
+    long mnDataColumnWidth1;
+    long mnDataColumnWidth2;
+    long mnRowHeight;
+    const OUString maStringJan;
+    const OUString maStringFeb;
+    const OUString maStringMar;
+    const OUString maStringNorth;
+    const OUString maStringMid;
+    const OUString maStringSouth;
+    const OUString maStringSum;
     std::unique_ptr<SvNumberFormatter> mxNumFormat;
 
     uno::Reference<i18n::XBreakIterator> m_xBreak;


More information about the Libreoffice-commits mailing list