[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - 2 commits - include/sfx2 include/svx svx/sdi svx/source sw/source

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Fri Sep 6 10:01:31 UTC 2019


 include/sfx2/sfxsids.hrc             |    2 -
 include/svx/svxids.hrc               |    3 +-
 svx/sdi/svx.sdi                      |    2 -
 svx/source/table/tablecontroller.cxx |   11 ---------
 sw/source/uibase/uiview/viewtab.cxx  |   42 +++++++++++++++++------------------
 5 files changed, 26 insertions(+), 34 deletions(-)

New commits:
commit e10f1090be5c293d42cda093d26541b77a9f0142
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Aug 26 20:17:06 2019 +0900
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Fri Sep 6 12:00:54 2019 +0200

    lok: use cell instead of text selection for tables in impress
    
    Change-Id: I0169538eb763d55c38d09e751ccf9e17b3eee4d0
    Reviewed-on: https://gerrit.libreoffice.org/78122
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
    (cherry picked from commit 1bad7f0b19e47a41a1919573f80785ec62c611af)
    Reviewed-on: https://gerrit.libreoffice.org/78687
    Tested-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
index 156909c6f6de..dd679484db3e 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -2218,23 +2218,14 @@ void SvxTableController::updateSelectionOverlay()
             // If tiled rendering, emit callbacks for sdr table selection.
             if (pOutDev && comphelper::LibreOfficeKit::isActive())
             {
-                // Left edge of aStartRect.
-                tools::Rectangle aSelectionStart(aStartRect.Left(), aStartRect.Top(), aStartRect.Left(), aStartRect.Bottom());
-                // Right edge of aEndRect.
-                tools::Rectangle aSelectionEnd(aEndRect.Right(), aEndRect.Top(), aEndRect.Right(), aEndRect.Bottom());
                 tools::Rectangle aSelection(a2DRange.getMinX(), a2DRange.getMinY(), a2DRange.getMaxX(), a2DRange.getMaxY());
 
                 if (pOutDev->GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
-                {
-                    aSelectionStart = OutputDevice::LogicToLogic(aSelectionStart, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
-                    aSelectionEnd = OutputDevice::LogicToLogic(aSelectionEnd, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
                     aSelection = OutputDevice::LogicToLogic(aSelection, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
-                }
 
                 if(SfxViewShell* pViewShell = SfxViewShell::Current())
                 {
-                    pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, aSelectionStart.toString().getStr());
-                    pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, aSelectionEnd.toString().getStr());
+                    pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, aSelection.toString().getStr());
                     pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, aSelection.toString().getStr());
                 }
             }
commit 35986320365de1e1fb9cd442a0faed2d97909954
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Aug 26 19:44:14 2019 +0900
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Fri Sep 6 12:00:42 2019 +0200

    lok: change table border position param. from new pos. to offset
    
    To implement table border position changing for Impress requires
    that instead of parameter with new absolute position, we use
    offset from the previous position.
    It's easy to change the code for Writer to do this instead of
    Impress so this commit does this.
    
    Reviewed-on: https://gerrit.libreoffice.org/78121
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
    (cherry picked from commit 19d88b15ec52a0560b96c5e71b5a328952ba7f28)
    
    Change-Id: I2d3ebe5ba0dc30fb8b4a58cc9ca820cc8330204b
    Reviewed-on: https://gerrit.libreoffice.org/78686
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
    Tested-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index de3318ea18cd..ece766088ab2 100644
--- a/include/sfx2/sfxsids.hrc
+++ b/include/sfx2/sfxsids.hrc
@@ -563,7 +563,7 @@ class SfxDocumentInfoItem;
 #define SID_RULER_MARGIN2                   (SID_SVX_START + 1064)
 #define SID_TABLE_BORDER_TYPE               (SID_SVX_START + 1065)
 #define SID_TABLE_BORDER_INDEX              (SID_SVX_START + 1066)
-#define SID_TABLE_BORDER_NEW_POSITION       (SID_SVX_START + 1067)
+#define SID_TABLE_BORDER_OFFSET             (SID_SVX_START + 1067)
 
 #define FID_SVX_START                       (SID_LIB_START + 500)
 #define FID_SEARCH_NOW                      (FID_SVX_START + 2)
diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc
index c3bc6f19f7a0..8b6dd9b5a699 100644
--- a/include/svx/svxids.hrc
+++ b/include/svx/svxids.hrc
@@ -241,12 +241,13 @@ class SfxStringItem;
 #define SID_ATTR_TRANSFORM_ROT_Y                        TypedWhichId<SfxInt32Item>( SID_SVX_START + 94 )
 #define SID_ATTR_TRANSFORM_ANGLE                        TypedWhichId<SfxInt32Item>( SID_SVX_START + 95 )
 #define SID_ATTR_TRANSFORM_DELTA_ANGLE                  TypedWhichId<SfxInt32Item>( SID_SVX_START + 96 )
-#define SID_TABLE_CHANGE_CURRENT_BORDER_POSITION        ( SID_SVX_START + 100 )
+// CAUTION! Range <96..100> used by SFX2 (!)
 #define SID_SIZE_ALL                                    ( SID_SVX_START + 101 )
 #define SID_DRAW_LINE                                   ( SID_SVX_START + 102 )
 #define SID_DRAW_XLINE                                  ( SID_SVX_START + 103 )
 #define SID_DRAW_RECT                                   ( SID_SVX_START + 104 )
 #define SID_DRAW_RECT_ROUND                             ( SID_SVX_START + 105 )
+#define SID_TABLE_CHANGE_CURRENT_BORDER_POSITION        ( SID_SVX_START + 106 )
 #define SID_DRAW_ELLIPSE                                ( SID_SVX_START + 110 )
 #define SID_DRAW_PIE                                    ( SID_SVX_START + 112 )
 #define SID_DRAW_ARC                                    ( SID_SVX_START + 114 )
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index 2650f122ac54..984198ea64d2 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -7177,7 +7177,7 @@ SfxVoidItem RulerChangeState SID_RULER_CHANGE_STATE
 SfxVoidItem TableChangeCurrentBorderPosition SID_TABLE_CHANGE_CURRENT_BORDER_POSITION
     (SfxStringItem BorderType SID_TABLE_BORDER_TYPE,
      SfxUInt16Item Index SID_TABLE_BORDER_INDEX,
-     SfxInt32Item NewPosition SID_TABLE_BORDER_NEW_POSITION)
+     SfxInt32Item Offset SID_TABLE_BORDER_OFFSET)
 [
     AutoUpdate = FALSE,
     FastCall = TRUE,
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index f64017ab5162..d978d6a7451b 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -1012,16 +1012,16 @@ void SwView::ExecTabWin( SfxRequest const & rReq )
         {
             const SfxPoolItem *pBorderType;
             const SfxPoolItem *pIndex;
-            const SfxPoolItem *pNewPosition;
+            const SfxPoolItem *pOffset;
             constexpr long constDistanceOffset = 40;
 
             if (pReqArgs->GetItemState(SID_TABLE_BORDER_TYPE, true, &pBorderType) == SfxItemState::SET
             && pReqArgs->GetItemState(SID_TABLE_BORDER_INDEX, true, &pIndex) == SfxItemState::SET
-            && pReqArgs->GetItemState(SID_TABLE_BORDER_NEW_POSITION, true, &pNewPosition) == SfxItemState::SET)
+            && pReqArgs->GetItemState(SID_TABLE_BORDER_OFFSET, true, &pOffset) == SfxItemState::SET)
             {
                 const OUString sType = static_cast<const SfxStringItem*>(pBorderType)->GetValue();
                 const sal_uInt16 nIndex = static_cast<const SfxUInt16Item*>(pIndex)->GetValue();
-                const sal_Int32 nNewPosition = static_cast<const SfxInt32Item*>(pNewPosition)->GetValue();
+                const sal_Int32 nOffset = static_cast<const SfxInt32Item*>(pOffset)->GetValue();
 
                 if (sType.startsWith("column"))
                 {
@@ -1031,23 +1031,23 @@ void SwView::ExecTabWin( SfxRequest const & rReq )
                     if (sType == "column-left")
                     {
                         auto & rEntry = aTabCols.GetEntry(0);
-                        long nPosition = std::min(long(nNewPosition), rEntry.nPos - constDistanceOffset);
+                        long nNewPosition = aTabCols.GetLeft() + long(nOffset);
+                        long nPosition = std::min(nNewPosition, rEntry.nPos - constDistanceOffset);
                         aTabCols.SetLeft(nPosition);
                     }
                     else if (sType == "column-right")
                     {
                         auto & rEntry = aTabCols.GetEntry(aTabCols.Count() - 1);
-                        long nPosition = std::max(long(nNewPosition), rEntry.nPos + constDistanceOffset);
+                        long nNewPosition = aTabCols.GetRight() + long(nOffset);
+                        long nPosition = std::max(nNewPosition, rEntry.nPos + constDistanceOffset);
                         aTabCols.SetRight(nPosition);
                     }
-                    else if (sType == "column-middle")
+                    else if (sType == "column-middle" && nIndex < aTabCols.Count())
                     {
-                        if (nIndex < aTabCols.Count())
-                        {
-                            auto & rEntry = aTabCols.GetEntry(nIndex);
-                            long nPosition = o3tl::clamp(long(nNewPosition), rEntry.nMin, rEntry.nMax - constDistanceOffset);
-                            rEntry.nPos = nPosition;
-                        }
+                        auto & rEntry = aTabCols.GetEntry(nIndex);
+                        long nNewPosition = rEntry.nPos + long(nOffset);
+                        long nPosition = o3tl::clamp(nNewPosition, rEntry.nMin, rEntry.nMax - constDistanceOffset);
+                        rEntry.nPos = nPosition;
                     }
 
                     rSh.SetTabCols(aTabCols, false);
@@ -1060,23 +1060,23 @@ void SwView::ExecTabWin( SfxRequest const & rReq )
                     if (sType == "row-left")
                     {
                         auto & rEntry = aTabRows.GetEntry(0);
-                        long nPosition = std::min(long(nNewPosition), rEntry.nPos - constDistanceOffset);
+                        long nNewPosition = aTabRows.GetLeft() + long(nOffset);
+                        long nPosition = std::min(nNewPosition, rEntry.nPos - constDistanceOffset);
                         aTabRows.SetLeft(nPosition);
                     }
                     else if (sType == "row-right")
                     {
                         auto & rEntry = aTabRows.GetEntry(aTabRows.Count() - 1);
-                        long nPosition = std::max(long(nNewPosition), rEntry.nPos + constDistanceOffset);
+                        long nNewPosition = aTabRows.GetRight() + long(nOffset);
+                        long nPosition = std::max(nNewPosition, rEntry.nPos + constDistanceOffset);
                         aTabRows.SetRight(nPosition);
                     }
-                    else if (sType == "row-middle")
+                    else if (sType == "row-middle" && nIndex < aTabRows.Count())
                     {
-                        if (nIndex < aTabRows.Count())
-                        {
-                            auto & rEntry = aTabRows.GetEntry(nIndex);
-                            long nPosition = o3tl::clamp(long(nNewPosition), rEntry.nMin, rEntry.nMax - constDistanceOffset);
-                            rEntry.nPos = nPosition;
-                        }
+                        auto & rEntry = aTabRows.GetEntry(nIndex);
+                        long nNewPosition = rEntry.nPos + long(nOffset);
+                        long nPosition = o3tl::clamp(nNewPosition, rEntry.nMin, rEntry.nMax - constDistanceOffset);
+                        rEntry.nPos = nPosition;
                     }
 
                     rSh.SetTabRows(aTabRows, false);


More information about the Libreoffice-commits mailing list