summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2017-12-12 12:17:32 +0100
committerJan Holesovsky <kendy@collabora.com>2017-12-12 14:29:15 +0100
commit789c68003818fa1a5cb17d234d80035006c7e585 (patch)
tree74d9199cbe4172ed700bd6fe2867be60622f5e22
parentfb956dccc281f594295d6952aed870e55edc7659 (diff)
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 <hcastro@collabora.com> Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r--sc/sdi/scalc.sdi4
-rw-r--r--sc/source/ui/view/cellsh3.cxx82
2 files changed, 56 insertions, 30 deletions
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 ) )
{