[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - 2 commits - sc/qa sc/sdi sc/source

Henry Castro hcastro at collabora.com
Thu Sep 1 16:48:18 UTC 2016


 sc/qa/unit/tiledrendering/tiledrendering.cxx |   43 +++++++++++++++++++++++
 sc/sdi/scalc.sdi                             |    8 +---
 sc/source/ui/view/cellsh3.cxx                |   49 +++++++++++++++++++++++++--
 3 files changed, 92 insertions(+), 8 deletions(-)

New commits:
commit fb069a007d866132c6aacfc33b5671a94046a274
Author: Henry Castro <hcastro at collabora.com>
Date:   Tue Aug 23 14:13:57 2016 -0400

    sc lok: fix re-sizing several rows/columns at once
    
    Reviewed-on: https://gerrit.libreoffice.org/28351
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Henry Castro <hcastro at collabora.com>
    
    Conflicts:
    	sc/source/ui/view/cellsh3.cxx
    
    Change-Id: I7b3760432aa4b3120bfd586a1abc42a46fff0df8

diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index 75607e0..eade314 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -548,10 +548,19 @@ void ScCellShell::Execute( SfxRequest& rReq )
                                  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();
+                    SCCOLROW nRow = static_cast<const SfxUInt16Item*>(pRow)->GetValue() - 1;
+                    sal_uInt16 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));
+                    }
 
-                    aRanges.push_back(sc::ColRowSpan(nRow, nRow));
                     pTabViewShell->SetWidthOrHeight(false, aRanges, SC_SIZE_DIRECT, nHeight);
                 }
                 else if ( pReqArgs )
@@ -644,10 +653,19 @@ void ScCellShell::Execute( SfxRequest& rReq )
                                  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();
+                    SCCOLROW nColumn = static_cast<const SfxUInt16Item*>(pColumn)->GetValue() - 1;
+                    sal_uInt16 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));
+                    }
 
-                    aRanges.push_back(sc::ColRowSpan(nColumn, nColumn));
                     pTabViewShell->SetWidthOrHeight(true, aRanges, SC_SIZE_DIRECT, nWidth);
                 }
                 else if ( pReqArgs )
commit dcec2e81a2f70e830ba7974ec1991cf92afd9133
Author: Henry Castro <hcastro at collabora.com>
Date:   Fri Jul 29 15:00:49 2016 -0400

    sc lok: add parameters for column/row resize
    
    Reviewed-on: https://gerrit.libreoffice.org/27701
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Henry Castro <hcastro at collabora.com>
    
    Conflicts:
    	sc/qa/unit/tiledrendering/tiledrendering.cxx
    
    Change-Id: I189178b6060c229dd8d93b6fdee7d4d81354ced5

diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 82f126f..72b2002 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -58,6 +58,7 @@ public:
     void testSortAscendingDescending();
     void testPartHash();
     void testDocumentSize();
+    void testColRowResize();
 #endif
 
     CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
@@ -66,6 +67,7 @@ public:
     CPPUNIT_TEST(testSortAscendingDescending);
     CPPUNIT_TEST(testPartHash);
     CPPUNIT_TEST(testDocumentSize);
+    CPPUNIT_TEST(testColRowResize);
 #endif
     CPPUNIT_TEST_SUITE_END();
 
@@ -320,6 +322,47 @@ void ScTiledRenderingTest::testDocumentSize()
     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);
+}
+
 #endif
 
 CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest);
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index 234100c..e7340ef 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,
@@ -5990,7 +5988,7 @@ SfxInt32Item Row SID_RANGE_ROW
 
 
 SfxUInt16Item RowHeight FID_ROW_HEIGHT
-
+(SfxUInt16Item Row FN_PARAM_1,SfxUInt16Item Height FN_PARAM_2)
 [
     /* flags: */
     AutoUpdate = FALSE,
@@ -6005,8 +6003,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 d01607e..75607e0 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>
 
@@ -540,7 +541,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 ));
 
@@ -623,7 +637,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