[Libreoffice-commits] core.git: sc/qa sc/sdi sc/source
Henry Castro
hcastro at collabora.com
Fri Jul 29 21:17:26 UTC 2016
sc/qa/unit/tiledrendering/tiledrendering.cxx | 43 +++++++++++++++++++++++++++
sc/sdi/scalc.sdi | 4 +-
sc/source/ui/view/cellsh3.cxx | 31 ++++++++++++++++++-
3 files changed, 74 insertions(+), 4 deletions(-)
New commits:
commit ff051403381ca85724fec4f7bd2363141fa675f6
Author: Henry Castro <hcastro at collabora.com>
Date: Fri Jul 29 15:00:49 2016 -0400
sc lok: add parameters for column/row resize
Change-Id: I189178b6060c229dd8d93b6fdee7d4d81354ced5
Reviewed-on: https://gerrit.libreoffice.org/27701
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Henry Castro <hcastro at collabora.com>
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 314febc..093fa18 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -60,6 +60,7 @@ public:
void testTextViewSelection();
void testDocumentSizeChanged();
void testViewLock();
+ void testColRowResize();
CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
CPPUNIT_TEST(testRowColumnSelections);
@@ -71,6 +72,7 @@ public:
CPPUNIT_TEST(testTextViewSelection);
CPPUNIT_TEST(testDocumentSizeChanged);
CPPUNIT_TEST(testViewLock);
+ CPPUNIT_TEST(testColRowResize);
CPPUNIT_TEST_SUITE_END();
private:
@@ -539,6 +541,47 @@ void ScTiledRenderingTest::testViewLock()
comphelper::LibreOfficeKit::setActive(false);
}
+void ScTiledRenderingTest::testColRowResize()
+{
+ comphelper::LibreOfficeKit::setActive();
+ ScModelObj* pModelObj = createDoc("sort-range.ods");
+ ScDocShell* pDocSh = dynamic_cast< ScDocShell* >( pModelObj->GetEmbeddedObject() );
+ CPPUNIT_ASSERT(pDocSh);
+
+ ScTabViewShell* pViewShell = pDocSh->GetBestViewShell(false);
+ CPPUNIT_ASSERT(pViewShell);
+
+ pViewShell->registerLibreOfficeKitViewCallback(&ScTiledRenderingTest::callback, this);
+
+ uno::Sequence<beans::PropertyValue> aArgs(2);
+ ScDocument& rDoc = pDocSh->GetDocument();
+ // Col 3, Tab 0
+ int nOldWidth = rDoc.GetColWidth(static_cast<SCCOL>(2), static_cast<SCTAB>(0), false);
+
+ aArgs[0].Name = OUString::fromUtf8("Column");
+ aArgs[0].Value <<= static_cast<sal_Int16>(3);
+ aArgs[1].Name = OUString::fromUtf8("Width");
+ aArgs[1].Value <<= static_cast<sal_uInt16>(nOldWidth + 100);
+ comphelper::dispatchCommand(".uno:ColumnWidth", aArgs);
+
+ int nNewWidth = rDoc.GetColWidth(static_cast<SCCOL>(2), static_cast<SCTAB>(0), false);
+ CPPUNIT_ASSERT(nNewWidth > nOldWidth);
+
+ // Row 5, Tab 0
+ int nOldHeight = rDoc.GetRowHeight(static_cast<SCROW>(4), static_cast<SCTAB>(0), false);
+
+ aArgs[0].Name = OUString::fromUtf8("Row");
+ aArgs[0].Value <<= static_cast<sal_Int16>(5);
+ aArgs[1].Name = OUString::fromUtf8("Height");
+ aArgs[1].Value <<= static_cast<sal_uInt16>(nOldHeight + 100);
+ comphelper::dispatchCommand(".uno:RowHeight", aArgs);
+
+ int nNewHeight = rDoc.GetRowHeight(static_cast<SCROW>(4), static_cast<SCTAB>(0), false);
+ CPPUNIT_ASSERT(nNewHeight > nOldHeight);
+
+ comphelper::LibreOfficeKit::setActive(false);
+}
+
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest);
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index d55eca4..77a582b 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 Column FN_PARAM_1,SfxUInt16Item Width FN_PARAM_2)
[
AutoUpdate = FALSE,
FastCall = FALSE,
@@ -4432,7 +4432,7 @@ SfxInt32Item Row SID_RANGE_ROW
SfxUInt16Item RowHeight FID_ROW_HEIGHT
-
+(SfxUInt16Item 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 f88cb6c..d9141fe 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -43,6 +43,7 @@
#include "editable.hxx"
#include "markdata.hxx"
#include "scabstdlg.hxx"
+#include "columnspanset.hxx"
#include <config_telepathy.h>
@@ -538,7 +539,20 @@ void ScCellShell::Execute( SfxRequest& rReq )
case FID_ROW_HEIGHT:
{
- if ( pReqArgs )
+ const SfxPoolItem* pRow;
+ const SfxPoolItem* pHeight;
+
+ if ( pReqArgs && pReqArgs->HasItem( FN_PARAM_1, &pRow ) &&
+ pReqArgs->HasItem( FN_PARAM_2, &pHeight ) )
+ {
+ std::vector<sc::ColRowSpan> aRanges;
+ SCCOLROW nRow = static_cast<const SfxInt16Item*>(pRow)->GetValue() - 1;
+ sal_uInt16 nHeight = static_cast<const SfxInt16Item*>(pHeight)->GetValue();
+
+ aRanges.push_back(sc::ColRowSpan(nRow, nRow));
+ pTabViewShell->SetWidthOrHeight(false, aRanges, SC_SIZE_DIRECT, nHeight);
+ }
+ else if ( pReqArgs )
{
const SfxUInt16Item& rUInt16Item = static_cast<const SfxUInt16Item&>(pReqArgs->Get( FID_ROW_HEIGHT ));
@@ -621,7 +635,20 @@ void ScCellShell::Execute( SfxRequest& rReq )
case FID_COL_WIDTH:
{
- if ( pReqArgs )
+ const SfxPoolItem* pColumn;
+ const SfxPoolItem* pWidth;
+
+ if ( pReqArgs && pReqArgs->HasItem( FN_PARAM_1, &pColumn ) &&
+ pReqArgs->HasItem( FN_PARAM_2, &pWidth ) )
+ {
+ std::vector<sc::ColRowSpan> aRanges;
+ SCCOLROW nColumn = static_cast<const SfxInt16Item*>(pColumn)->GetValue() - 1;
+ sal_uInt16 nWidth = static_cast<const SfxInt16Item*>(pWidth)->GetValue();
+
+ aRanges.push_back(sc::ColRowSpan(nColumn, nColumn));
+ pTabViewShell->SetWidthOrHeight(true, aRanges, SC_SIZE_DIRECT, nWidth);
+ }
+ else if ( pReqArgs )
{
const SfxUInt16Item& rUInt16Item = static_cast<const SfxUInt16Item&>(pReqArgs->Get( FID_COL_WIDTH ));
More information about the Libreoffice-commits
mailing list