diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2023-05-08 11:24:30 +0200 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2023-05-08 16:40:08 +0200 |
commit | 23c9a5a2719c8ca6a7919db55989b0bb67f73f81 (patch) | |
tree | cb8ed472a2d63c0538cba355fc7cc46fef2ebb2d /sw/source/uibase | |
parent | 4a998c6c7325505d90780d18304267377a69225a (diff) |
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 <serval2412@yahoo.fr>
Diffstat (limited to 'sw/source/uibase')
-rw-r--r-- | sw/source/uibase/inc/pview.hxx | 12 | ||||
-rw-r--r-- | sw/source/uibase/uiview/pview.cxx | 14 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 8 |
3 files changed, 17 insertions, 17 deletions
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") { |