sc/qa/unit/tiledrendering/tiledrendering.cxx | 43 +++++++++++++++++++++++++++ sc/sdi/scalc.sdi | 8 +---- sc/source/ui/view/cellsh3.cxx | 31 ++++++++++++++++++- 3 files changed, 74 insertions(+), 8 deletions(-)
New commits: commit 8eccd8f82572f5dfdeabca7010b13bf773aa6a97 Author: Henry Castro <[email protected]> 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 <[email protected]> Reviewed-by: Henry Castro <[email protected]> diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index a1a9dc8..f049f4e 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -59,6 +59,7 @@ public: void testTextViewSelection(); void testDocumentSizeChanged(); void testViewLock(); + void testColRowResize(); CPPUNIT_TEST_SUITE(ScTiledRenderingTest); CPPUNIT_TEST(testRowColumnSelections); @@ -69,6 +70,7 @@ public: CPPUNIT_TEST(testTextViewSelection); CPPUNIT_TEST(testDocumentSizeChanged); CPPUNIT_TEST(testViewLock); + CPPUNIT_TEST(testColRowResize); CPPUNIT_TEST_SUITE_END(); private: @@ -517,6 +519,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 f1a7225..5cac4bb 100644 --- a/sc/sdi/scalc.sdi +++ b/sc/sdi/scalc.sdi @@ -1009,7 +1009,7 @@ SfxInt16Item Column SID_RANGE_COL SfxUInt16Item ColumnWidth FID_COL_WIDTH - +(SfxUInt16Item Column FN_PARAM_1,SfxUInt16Item Width FN_PARAM_2) [ /* flags: */ AutoUpdate = FALSE, @@ -1024,8 +1024,6 @@ SfxUInt16Item ColumnWidth FID_COL_WIDTH RecordPerSet; Synchron; - Readonly = FALSE, - /* config: */ AccelConfig = TRUE, MenuConfig = TRUE, @@ -6089,7 +6087,7 @@ SfxInt32Item Row SID_RANGE_ROW SfxUInt16Item RowHeight FID_ROW_HEIGHT - +(SfxUInt16Item Row FN_PARAM_1,SfxUInt16Item Height FN_PARAM_2) [ /* flags: */ AutoUpdate = FALSE, @@ -6104,8 +6102,6 @@ SfxUInt16Item RowHeight FID_ROW_HEIGHT RecordPerSet; Synchron; - Readonly = FALSE, - /* config: */ AccelConfig = TRUE, MenuConfig = TRUE, diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index b287493..036c45e 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> @@ -539,7 +540,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 )); @@ -622,7 +636,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 )); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
