sc/sdi/scalc.sdi | 4 +- sc/source/ui/view/cellsh3.cxx | 82 +++++++++++++++++++++++++++--------------- 2 files changed, 56 insertions(+), 30 deletions(-)
New commits: commit 789c68003818fa1a5cb17d234d80035006c7e585 Author: Marco Cecchetti <[email protected]> Date: Tue Dec 12 12:17:32 2017 +0100 lok: calc: get uno:RowHeight/uno:ColumnWidth to work with online 2.1/3.0 This is a follow up patch for back-porting of 6fea94f8c2b31ac9ab7c92ae81b6dc07ffe6dd28 see tdf#107806: Semantic and syntax for .uno:RowHeight have been changed This patch support both Width/ColumnWidth and Height/RowHeight parameters, so that cp-5.3 can work with both online-2.1 and 3.0 Change-Id: I6a421f91460574561581300ab64ec3c6e8fc46fe Reviewed-on: https://gerrit.libreoffice.org/46294 Reviewed-by: Henry Castro <[email protected]> Reviewed-by: Jan Holesovsky <[email protected]> Tested-by: Jan Holesovsky <[email protected]> diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi index 2f855e4a7d38..544655e5fe4f 100644 --- a/sc/sdi/scalc.sdi +++ b/sc/sdi/scalc.sdi @@ -721,7 +721,7 @@ SfxInt16Item Column SID_RANGE_COL SfxUInt16Item ColumnWidth FID_COL_WIDTH -(SfxUInt16Item ColumnWidth FID_COL_WIDTH,SfxUInt16Item Column FN_PARAM_1) +(SfxUInt16Item ColumnWidth FID_COL_WIDTH,SfxUInt16Item Column FN_PARAM_1,SfxUInt16Item Width FN_PARAM_2) [ AutoUpdate = FALSE, FastCall = FALSE, @@ -4461,7 +4461,7 @@ SfxInt32Item Row SID_RANGE_ROW SfxUInt16Item RowHeight FID_ROW_HEIGHT -(SfxUInt16Item RowHeight FID_ROW_HEIGHT,SfxInt32Item Row FN_PARAM_1) +(SfxUInt16Item RowHeight FID_ROW_HEIGHT,SfxInt32Item Row FN_PARAM_1,SfxUInt16Item Height FN_PARAM_2) [ AutoUpdate = FALSE, FastCall = FALSE, diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index 78e47be0f182..a16241225e8b 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -543,24 +543,37 @@ void ScCellShell::Execute( SfxRequest& rReq ) const SfxPoolItem* pHeight; sal_uInt16 nHeight; - if ( pReqArgs && pReqArgs->HasItem( FID_ROW_HEIGHT, &pHeight ) && - pReqArgs->HasItem( FN_PARAM_1, &pRow ) ) + if ( pReqArgs && pReqArgs->HasItem( FN_PARAM_1, &pRow ) ) { - std::vector<sc::ColRowSpan> aRanges; - SCCOLROW nRow = static_cast<const SfxInt32Item*>(pRow)->GetValue() - 1; - nHeight = static_cast<const SfxUInt16Item*>(pHeight)->GetValue(); - ScMarkData& rMark = GetViewData()->GetMarkData(); + enum { NONE, OLD, NEW } eParamType; - if ( rMark.IsRowMarked( static_cast<SCROW>(nRow) ) ) - { - aRanges = rMark.GetMarkedRowSpans(); - } - else + eParamType = NONE; + if ( pReqArgs->HasItem( FN_PARAM_2, &pHeight ) ) + eParamType = OLD; + else if ( pReqArgs->HasItem( FID_ROW_HEIGHT, &pHeight ) ) + eParamType = NEW; + + if ( eParamType != NONE ) { - aRanges.push_back(sc::ColRowSpan(nRow, nRow)); - } + std::vector<sc::ColRowSpan> aRanges; + SCCOLROW nRow = static_cast<const SfxInt32Item*>(pRow)->GetValue() - 1; + nHeight = static_cast<const SfxUInt16Item*>(pHeight)->GetValue(); + ScMarkData& rMark = GetViewData()->GetMarkData(); + + if ( rMark.IsRowMarked( static_cast<SCROW>(nRow) ) ) + { + aRanges = rMark.GetMarkedRowSpans(); + } + else + { + aRanges.push_back(sc::ColRowSpan(nRow, nRow)); + } + + if ( eParamType == NEW ) + nHeight = HMMToTwips(nHeight); - pTabViewShell->SetWidthOrHeight(false, aRanges, SC_SIZE_DIRECT, HMMToTwips(nHeight)); + pTabViewShell->SetWidthOrHeight(false, aRanges, SC_SIZE_DIRECT, nHeight); + } } else if ( pReqArgs && pReqArgs->HasItem( FID_ROW_HEIGHT, &pHeight ) ) { @@ -649,24 +662,37 @@ void ScCellShell::Execute( SfxRequest& rReq ) const SfxPoolItem* pWidth; sal_uInt16 nWidth; - if ( pReqArgs && pReqArgs->HasItem( FID_COL_WIDTH, &pWidth ) && - pReqArgs->HasItem( FN_PARAM_1, &pColumn ) ) + if ( pReqArgs && pReqArgs->HasItem( FN_PARAM_1, &pColumn ) ) { - std::vector<sc::ColRowSpan> aRanges; - SCCOLROW nColumn = static_cast<const SfxUInt16Item*>(pColumn)->GetValue() - 1; - nWidth = static_cast<const SfxUInt16Item*>(pWidth)->GetValue(); - ScMarkData& rMark = GetViewData()->GetMarkData(); + enum { NONE, OLD, NEW } eParamType; - if ( rMark.IsColumnMarked( static_cast<SCCOL>(nColumn) ) ) - { - aRanges = rMark.GetMarkedColSpans(); - } - else + eParamType = NONE; + if ( pReqArgs->HasItem( FN_PARAM_2, &pWidth ) ) + eParamType = OLD; + else if ( pReqArgs->HasItem( FID_COL_WIDTH, &pWidth ) ) + eParamType = NEW; + + if ( eParamType != NONE ) { - aRanges.push_back(sc::ColRowSpan(nColumn, nColumn)); - } + std::vector<sc::ColRowSpan> aRanges; + SCCOLROW nColumn = static_cast<const SfxUInt16Item*>(pColumn)->GetValue() - 1; + nWidth = static_cast<const SfxUInt16Item*>(pWidth)->GetValue(); + ScMarkData& rMark = GetViewData()->GetMarkData(); + + if ( rMark.IsColumnMarked( static_cast<SCCOL>(nColumn) ) ) + { + aRanges = rMark.GetMarkedColSpans(); + } + else + { + aRanges.push_back(sc::ColRowSpan(nColumn, nColumn)); + } + + if ( eParamType == NEW ) + nWidth = HMMToTwips(nWidth); - pTabViewShell->SetWidthOrHeight(true, aRanges, SC_SIZE_DIRECT, HMMToTwips(nWidth)); + pTabViewShell->SetWidthOrHeight(true, aRanges, SC_SIZE_DIRECT, nWidth); + } } else if ( pReqArgs && pReqArgs->HasItem( FID_COL_WIDTH, &pWidth ) ) { _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
