sw/inc/pvprtdat.hxx               |   10 +++++-----
 sw/source/uibase/inc/pview.hxx    |   12 ++++++------
 sw/source/uibase/uiview/pview.cxx |   14 +++++++-------
 sw/source/uibase/uno/unotxdoc.cxx |    8 ++++----
 4 files changed, 22 insertions(+), 22 deletions(-)

New commits:
commit 23c9a5a2719c8ca6a7919db55989b0bb67f73f81
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Mon May 8 11:24:30 2023 +0200
Commit:     Julien Nabet <serval2...@yahoo.fr>
CommitDate: Mon May 8 16:40:08 2023 +0200

    Row and Cols in sw preview page part should be sal_Int16 instead of 
sal_uInt8
    
    Following offapi/com/sun/star/text/PagePrintSettings.idl which defines
    [property] short PageRows;
    [property] short PageColumns;
    and "short" is defined as signed 16-bit integer type
    see 
https://wiki.documentfoundation.org/Documentation/DevGuide/Professional_UNO
    
    it allows to avoid some static_cast
    
    Change-Id: I5f497a27cd56f7d07c9440e9d6e6718a5e418345
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151499
    Tested-by: Jenkins
    Reviewed-by: Julien Nabet <serval2...@yahoo.fr>

diff --git a/sw/inc/pvprtdat.hxx b/sw/inc/pvprtdat.hxx
index 2a8d5fb0c108..8150a11a5163 100644
--- a/sw/inc/pvprtdat.hxx
+++ b/sw/inc/pvprtdat.hxx
@@ -27,7 +27,7 @@ class SwPagePreviewPrtData
 
     sal_Int32 m_nLeftSpace, m_nRightSpace, m_nTopSpace, m_nBottomSpace,
             m_nHorzSpace, m_nVertSpace;
-    sal_uInt8 m_nRow, m_nCol;
+    sal_Int16 m_nRow, m_nCol;
     bool m_bLandscape : 1;
 public:
     SwPagePreviewPrtData()
@@ -54,11 +54,11 @@ public:
     sal_Int32 GetVertSpace() const          { return m_nVertSpace; }
     void SetVertSpace( sal_Int32 n )        { m_nVertSpace = n; }
 
-    sal_uInt8 GetRow() const                { return m_nRow; }
-    void SetRow(sal_uInt8 n )               { m_nRow = n; }
+    sal_Int16 GetRow() const                { return m_nRow; }
+    void SetRow(sal_Int16 n )               { m_nRow = n; }
 
-    sal_uInt8 GetCol() const                { return m_nCol; }
-    void SetCol( sal_uInt8 n )              { m_nCol = n; }
+    sal_Int16 GetCol() const                { return m_nCol; }
+    void SetCol( sal_Int16 n )              { m_nCol = n; }
 
     bool GetLandscape() const               { return m_bLandscape; }
     void SetLandscape( bool b )         { m_bLandscape = b; }
diff --git a/sw/source/uibase/inc/pview.hxx b/sw/source/uibase/inc/pview.hxx
index af0f31d94788..6a46814facd6 100644
--- a/sw/source/uibase/inc/pview.hxx
+++ b/sw/source/uibase/inc/pview.hxx
@@ -47,8 +47,8 @@ class SAL_DLLPUBLIC_RTTI SwPagePreviewWin final : public 
vcl::Window
 {
     SwViewShell* mpViewShell;
     sal_uInt16 mnSttPage;
-    sal_uInt8 mnRow;
-    sal_uInt8 mnCol;
+    sal_Int16 mnRow;
+    sal_Int16 mnCol;
     Size maPxWinSize;
     Fraction maScale;
     SwPagePreview& mrView;
@@ -56,7 +56,7 @@ class SAL_DLLPUBLIC_RTTI SwPagePreviewWin final : public 
vcl::Window
     tools::Rectangle maPaintedPreviewDocRect;
     SwPagePreviewLayout* mpPgPreviewLayout;
 
-    void SetPagePreview( sal_uInt8 nRow, sal_uInt8 nCol );
+    void SetPagePreview( sal_Int16 nRow, sal_Int16 nCol );
 
     using Window::Scroll;
 
@@ -78,12 +78,12 @@ public:
         return mpViewShell;
     }
 
-    sal_uInt8 GetRow() const
+    sal_Int16 GetRow() const
     {
         return mnRow;
     }
 
-    sal_uInt8 GetCol() const
+    sal_Int16 GetCol() const
     {
         return mnCol;
     }
@@ -114,7 +114,7 @@ public:
     // If we only have one column we do not have a oth page
     sal_uInt16 GetDefSttPage() const   { return 1 == mnCol ? 1 : 0; }
 
-    void CalcWish( sal_uInt8 nNewRow, sal_uInt8 nNewCol );
+    void CalcWish( sal_Int16 nNewRow, sal_Int16 nNewCol );
 
     void SetWinSize( const Size& rNewSize );
 
diff --git a/sw/source/uibase/uiview/pview.cxx 
b/sw/source/uibase/uiview/pview.cxx
index 0ca186c74c3e..9df4a8828daf 100644
--- a/sw/source/uibase/uiview/pview.cxx
+++ b/sw/source/uibase/uiview/pview.cxx
@@ -156,7 +156,7 @@ public:
     {
         if (run() == RET_OK)
         {
-            m_rParent.CalcWish(sal_uInt8(m_xRowEdit->get_value()), 
sal_uInt8(m_xColEdit->get_value()));
+            m_rParent.CalcWish(m_xRowEdit->get_value(), 
m_xColEdit->get_value());
         }
     }
 };
@@ -218,12 +218,12 @@ void  SwPagePreviewWin::Paint(vcl::RenderContext& 
rRenderContext, const tools::R
     }
 }
 
-void SwPagePreviewWin::CalcWish( sal_uInt8 nNewRow, sal_uInt8 nNewCol )
+void SwPagePreviewWin::CalcWish( sal_Int16 nNewRow, sal_Int16 nNewCol )
 {
     if( !mpViewShell || !mpViewShell->GetLayout() )
         return;
 
-    const sal_uInt8 nOldCol = mnCol;
+    const sal_Int16 nOldCol = mnCol;
     mnRow = nNewRow;
     mnCol = nNewCol;
     const sal_uInt16 nPages = mnRow * mnCol;
@@ -514,7 +514,7 @@ void SwPagePreviewWin::MouseButtonDown( const MouseEvent& 
rMEvt )
 
 // Set user prefs or view options
 
-void SwPagePreviewWin::SetPagePreview( sal_uInt8 nRow, sal_uInt8 nCol )
+void SwPagePreviewWin::SetPagePreview( sal_Int16 nRow, sal_Int16 nCol )
 {
     SwMasterUsrPref *pOpt = const_cast<SwMasterUsrPref 
*>(SW_MOD()->GetUsrPref(false));
 
@@ -656,7 +656,7 @@ void SwPagePreview::ExecPgUpAndPgDown( const bool  _bPgUp,
 void  SwPagePreview::Execute( SfxRequest &rReq )
 {
     int eMvMode = SwPagePreviewWin::MV_DOC_END;
-    sal_uInt8 nRow = 1;
+    sal_Int16 nRow = 1;
     bool bRefresh = true;
 
     switch(rReq.GetSlot())
@@ -671,8 +671,8 @@ void  SwPagePreview::Execute( SfxRequest &rReq )
             const SfxItemSet *pArgs = rReq.GetArgs();
             if( pArgs && pArgs->Count() >= 2 )
             {
-                sal_uInt8 nCols = 
static_cast<sal_uInt8>(pArgs->Get(SID_ATTR_TABLE_COLUMN).GetValue());
-                sal_uInt8 nRows = 
static_cast<sal_uInt8>(pArgs->Get(SID_ATTR_TABLE_ROW).GetValue());
+                sal_Int16 nCols = pArgs->Get(SID_ATTR_TABLE_COLUMN).GetValue();
+                sal_Int16 nRows = pArgs->Get(SID_ATTR_TABLE_ROW).GetValue();
                 m_pViewWin->CalcWish( nRows, nCols );
 
             }
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index e0a9feb9f5bf..b57cea597759 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -941,9 +941,9 @@ Sequence< beans::PropertyValue > 
SwXTextDocument::getPagePrintSettings()
     if(pData)
         aData = *pData;
     Any aVal;
-    aVal <<= static_cast<sal_Int16>(aData.GetRow());
+    aVal <<= aData.GetRow();
     pArray[0] = beans::PropertyValue("PageRows", -1, aVal, 
PropertyState_DIRECT_VALUE);
-    aVal <<= static_cast<sal_Int16>(aData.GetCol());
+    aVal <<= aData.GetCol();
     pArray[1] = beans::PropertyValue("PageColumns", -1, aVal, 
PropertyState_DIRECT_VALUE);
     aVal <<= static_cast<sal_Int32>(convertTwipToMm100(aData.GetLeftSpace()));
     pArray[2] = beans::PropertyValue("LeftMargin", -1, aVal, 
PropertyState_DIRECT_VALUE);
@@ -1026,13 +1026,13 @@ void SwXTextDocument::setPagePrintSettings(const 
Sequence< beans::PropertyValue
         {
             if(!nVal || nVal > 0xff)
                 throw RuntimeException("Invalid value");
-            aData.SetRow(static_cast<sal_uInt8>(nVal));
+            aData.SetRow(nVal);
         }
         else if(sName == "PageColumns")
         {
             if(!nVal  || nVal > 0xff)
                 throw RuntimeException("Invalid value");
-            aData.SetCol(static_cast<sal_uInt8>(nVal));
+            aData.SetCol(nVal);
         }
         else if(sName == "LeftMargin")
         {

Reply via email to