chart2/source/controller/main/ChartController_Window.cxx |   11 
 editeng/source/editeng/editview.cxx                      |   10 
 editeng/source/editeng/impedit.cxx                       |   97 ++++---
 editeng/source/editeng/impedit.hxx                       |   10 
 include/editeng/editview.hxx                             |    2 
 sc/source/ui/app/inputhdl.cxx                            |   21 +
 sc/source/ui/inc/gridwin.hxx                             |   29 +-
 sc/source/ui/inc/tabview.hxx                             |    2 
 sc/source/ui/inc/viewdata.hxx                            |    2 
 sc/source/ui/unoobj/docuno.cxx                           |    4 
 sc/source/ui/view/gridwin.cxx                            |  202 +++++++++++----
 sc/source/ui/view/gridwin4.cxx                           |  136 +++++++++-
 sc/source/ui/view/tabvwshc.cxx                           |    2 
 sc/source/ui/view/viewdata.cxx                           |    1 
 sfx2/source/control/unoctitm.cxx                         |    5 
 svx/sdi/svx.sdi                                          |   12 
 svx/source/xoutdev/xattr.cxx                             |   13 
 sw/source/uibase/shells/drawdlg.cxx                      |   40 ++
 sw/source/uibase/shells/frmsh.cxx                        |   23 +
 vcl/source/app/help.cxx                                  |   19 -
 20 files changed, 523 insertions(+), 118 deletions(-)

New commits:
commit c75d894ae66c306df765315a07e0dad3e78ea60b
Author:     Dennis Francis <dennis.fran...@collabora.com>
AuthorDate: Tue Apr 14 14:49:23 2020 +0530
Commit:     Dennis Francis <dennisfrancis...@gmail.com>
CommitDate: Tue May 26 23:17:27 2020 +0530

    lokit: fix edit-text/view-cursor position
    
    in case of views with heterogeneous zooms.
    
    1. EditText render position fix
    
    The EditView has an 'output-area' which is used to clip the rectangle
    we pass to the Paint() call. It also holds on to the ScGridWindow
    instance where the edit started. The 'output-area' of the EditView is in
    the coordinates/units of the MapMode of the ScGridWindow it holds. So we
    need to temporarily change the MapMode and 'output-area' of the EditView
    in agreement to the device(with the current view's zoom settings) where
    we are going to paint to. After we call the Paint(), we rollback the
    original settings of the EditView.
    
    2. EditViewCursor position fix
    
    Before this change the cursor position in twips (calculated based on
    pixel aligned cell position in the view where editing occurred) is
    broadcasted to all the client-views. If the clients have different zooms, 
then
    simply scaling this common cursor position in the client for its zoom
    is not going to be accurate enough (due to the non-linear 
Logic->Pixel->Logic
    transformation involving pixel rounding). This is very visible if you are
    editing far away from A1 (like Z50).
    The fix is to turn off this broadcast for calc-cell editing and send
    view specific edit-cursor invalidation messages.
    
    This is accompanied by a online.git patch that removes unnessecary
    broadcast of view-cursor invalidation messages which messes up things again.
    "Do not broadcast view-cursor invalidation messages"
    
    Change-Id: Ib2fbbe4b6f93f26fc85d6adaa8684dd4397d886f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92631
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>
    (cherry picked from commit d58f1e334245f9e136750fbba267c2a941a213cc)
    
    Conflicts:
            editeng/source/editeng/impedit.hxx

diff --git a/editeng/source/editeng/editview.cxx 
b/editeng/source/editeng/editview.cxx
index eaa9fe05e932..be91080cceb8 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -475,6 +475,16 @@ void EditView::Command( const CommandEvent& rCEvt )
     pImpEditView->Command( rCEvt );
 }
 
+void EditView::SetBroadcastLOKViewCursor(bool bSet)
+{
+    pImpEditView->SetBroadcastLOKViewCursor(bSet);
+}
+
+tools::Rectangle EditView::GetEditCursor() const
+{
+    return pImpEditView->GetEditCursor();
+}
+
 void EditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor, bool 
bActivate )
 {
     if ( pImpEditView->pEditEngine->HasView( this ) )
diff --git a/editeng/source/editeng/impedit.cxx 
b/editeng/source/editeng/impedit.cxx
index 7a2a3e412301..6c7360d41fea 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -82,6 +82,7 @@ ImpEditView::ImpEditView( EditView* pView, EditEngine* pEng, 
vcl::Window* pWindo
     eSelectionMode      = EESelectionMode::Std;
     eAnchorMode         = EEAnchorMode::TopLeft;
     mpEditViewCallbacks = nullptr;
+    mbBroadcastLOKViewCursor = comphelper::LibreOfficeKit::isActive();
     nInvMore            = 1;
     nTravelXPos         = TRAVEL_X_DONTKNOW;
     nControl            = EVControlBits::AUTOSCROLL | 
EVControlBits::ENABLEPASTE;
@@ -914,6 +915,69 @@ OString buildHyperlinkJSON(const OUString& sText, const 
OUString& sLink)
 
 } // End of anon namespace
 
+tools::Rectangle ImpEditView::ImplGetEditCursor(EditPaM& aPaM, GetCursorFlags 
nShowCursorFlags, sal_Int32& nTextPortionStart,
+        const ParaPortion* pParaPortion) const
+{
+    tools::Rectangle aEditCursor = 
pEditEngine->pImpEditEngine->PaMtoEditCursor( aPaM, nShowCursorFlags );
+    if ( !IsInsertMode() && !aEditSelection.HasRange() )
+    {
+        if ( aPaM.GetNode()->Len() && ( aPaM.GetIndex() < 
aPaM.GetNode()->Len() ) )
+        {
+            // If we are behind a portion, and the next portion has other 
direction, we must change position...
+            aEditCursor.SetLeft( pEditEngine->pImpEditEngine->PaMtoEditCursor( 
aPaM, GetCursorFlags::TextOnly|GetCursorFlags::PreferPortionStart ).Left() );
+            aEditCursor.SetRight( aEditCursor.Left() );
+
+            sal_Int32 nTextPortion = 
pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), 
nTextPortionStart, true );
+            const TextPortion& rTextPortion = 
pParaPortion->GetTextPortions()[nTextPortion];
+            if ( rTextPortion.GetKind() == PortionKind::TAB )
+            {
+                aEditCursor.AdjustRight(rTextPortion.GetSize().Width() );
+            }
+            else
+            {
+                EditPaM aNext = pEditEngine->CursorRight( aPaM );
+                tools::Rectangle aTmpRect = 
pEditEngine->pImpEditEngine->PaMtoEditCursor( aNext, GetCursorFlags::TextOnly );
+                if ( aTmpRect.Top() != aEditCursor.Top() )
+                    aTmpRect = pEditEngine->pImpEditEngine->PaMtoEditCursor( 
aNext, GetCursorFlags::TextOnly|GetCursorFlags::EndOfLine );
+                aEditCursor.SetRight( aTmpRect.Left() );
+            }
+        }
+    }
+
+    long nMaxHeight = !IsVertical() ? aOutArea.GetHeight() : 
aOutArea.GetWidth();
+    if ( aEditCursor.GetHeight() > nMaxHeight )
+    {
+        aEditCursor.SetBottom( aEditCursor.Top() + nMaxHeight - 1 );
+    }
+
+    return aEditCursor;
+}
+
+tools::Rectangle ImpEditView::GetEditCursor() const
+{
+    EditPaM aPaM( aEditSelection.Max() );
+
+    sal_Int32 nTextPortionStart = 0;
+    sal_Int32 nPara = pEditEngine->GetEditDoc().GetPos( aPaM.GetNode() );
+    if (nPara == EE_PARA_NOT_FOUND) // #i94322
+        return tools::Rectangle();
+
+    const ParaPortion* pParaPortion = pEditEngine->GetParaPortions()[nPara];
+
+    GetCursorFlags nShowCursorFlags = nExtraCursorFlags | 
GetCursorFlags::TextOnly;
+
+    // Use CursorBidiLevel 0/1 in meaning of
+    // 0: prefer portion end, normal mode
+    // 1: prefer portion start
+
+    if ( ( GetCursorBidiLevel() != CURSOR_BIDILEVEL_DONTKNOW ) && 
GetCursorBidiLevel() )
+    {
+        nShowCursorFlags |= GetCursorFlags::PreferPortionStart;
+    }
+
+    return ImplGetEditCursor(aPaM, nShowCursorFlags, nTextPortionStart, 
pParaPortion);
+}
+
 void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor )
 {
     // No ShowCursor in an empty View ...
@@ -958,36 +1022,8 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool 
bForceVisCursor )
         nShowCursorFlags |= GetCursorFlags::PreferPortionStart;
     }
 
-    tools::Rectangle aEditCursor = 
pEditEngine->pImpEditEngine->PaMtoEditCursor( aPaM, nShowCursorFlags );
-    if ( !IsInsertMode() && !aEditSelection.HasRange() )
-    {
-        if ( aPaM.GetNode()->Len() && ( aPaM.GetIndex() < 
aPaM.GetNode()->Len() ) )
-        {
-            // If we are behind a portion, and the next portion has other 
direction, we must change position...
-            aEditCursor.SetLeft( pEditEngine->pImpEditEngine->PaMtoEditCursor( 
aPaM, GetCursorFlags::TextOnly|GetCursorFlags::PreferPortionStart ).Left() );
-            aEditCursor.SetRight( aEditCursor.Left() );
+    tools::Rectangle aEditCursor = ImplGetEditCursor(aPaM, nShowCursorFlags, 
nTextPortionStart, pParaPortion);
 
-            sal_Int32 nTextPortion = 
pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), 
nTextPortionStart, true );
-            const TextPortion& rTextPortion = 
pParaPortion->GetTextPortions()[nTextPortion];
-            if ( rTextPortion.GetKind() == PortionKind::TAB )
-            {
-                aEditCursor.AdjustRight(rTextPortion.GetSize().Width() );
-            }
-            else
-            {
-                EditPaM aNext = pEditEngine->CursorRight( aPaM );
-                tools::Rectangle aTmpRect = 
pEditEngine->pImpEditEngine->PaMtoEditCursor( aNext, GetCursorFlags::TextOnly );
-                if ( aTmpRect.Top() != aEditCursor.Top() )
-                    aTmpRect = pEditEngine->pImpEditEngine->PaMtoEditCursor( 
aNext, GetCursorFlags::TextOnly|GetCursorFlags::EndOfLine );
-                aEditCursor.SetRight( aTmpRect.Left() );
-            }
-        }
-    }
-    long nMaxHeight = !IsVertical() ? aOutArea.GetHeight() : 
aOutArea.GetWidth();
-    if ( aEditCursor.GetHeight() > nMaxHeight )
-    {
-        aEditCursor.SetBottom( aEditCursor.Top() + nMaxHeight - 1 );
-    }
     if ( bGotoCursor  ) // && 
(!pEditEngine->pImpEditEngine->GetStatus().AutoPageSize() ) )
     {
         // check if scrolling is necessary...
@@ -1178,7 +1214,8 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool 
bForceVisCursor )
                 }
 
                 SfxLokHelper::notifyVisCursorInvalidation(mpViewShell, sRect, 
bIsWrong, sHyperlink);
-                
mpViewShell->NotifyOtherViews(LOK_CALLBACK_INVALIDATE_VIEW_CURSOR, "rectangle", 
sRect);
+                if (mbBroadcastLOKViewCursor)
+                    
mpViewShell->NotifyOtherViews(LOK_CALLBACK_INVALIDATE_VIEW_CURSOR, "rectangle", 
sRect);
             }
         }
 
diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index 26c9d25961fa..420bc67d13bf 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -269,6 +269,7 @@ private:
     // in Draw/Impress in an OverlayObject which avoids evtl. expensive full
     // repaints of the EditView(s)
     const EditViewCallbacks* mpEditViewCallbacks;
+    bool mbBroadcastLOKViewCursor;
 
     const EditViewCallbacks* getEditViewCallbacks() const
     {
@@ -285,6 +286,11 @@ private:
     css::uno::Reference<css::datatransfer::clipboard::XClipboard> 
GetClipboard() const;
     css::uno::Reference<css::datatransfer::clipboard::XClipboard> 
GetSelection() const;
 
+    void SetBroadcastLOKViewCursor(bool bSet)
+    {
+        mbBroadcastLOKViewCursor = bSet;
+    }
+
 protected:
 
     // DragAndDropClient
@@ -299,6 +305,8 @@ protected:
     void HideDDCursor();
 
     void ImplDrawHighlightRect( OutputDevice* _pTarget, const Point& 
rDocPosTopLeft, const Point& rDocPosBottomRight, tools::PolyPolygon* pPolyPoly 
);
+    tools::Rectangle ImplGetEditCursor(EditPaM& aPaM, GetCursorFlags 
nShowCursorFlags,
+            sal_Int32& nTextPortionStart, const ParaPortion* pParaPortion) 
const;
 
 public:
                     ImpEditView( EditView* pView, EditEngine* pEng, 
vcl::Window* pWindow );
@@ -377,6 +385,8 @@ public:
     void            CalcAnchorPoint();
     void            RecalcOutputArea();
 
+    tools::Rectangle GetEditCursor() const;
+
     void            ShowCursor( bool bGotoCursor, bool bForceVisCursor );
     Pair            Scroll( long ndX, long ndY, ScrollRangeCheck nRangeCheck = 
ScrollRangeCheck::NoNegative );
 
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
index fdbfd8a08fff..46bfa402dea7 100644
--- a/include/editeng/editview.hxx
+++ b/include/editeng/editview.hxx
@@ -159,6 +159,8 @@ public:
     void            Invalidate();
     Pair            Scroll( long nHorzScroll, long nVertScroll, 
ScrollRangeCheck nRangeCheck = ScrollRangeCheck::NoNegative );
 
+    void            SetBroadcastLOKViewCursor(bool bSet);
+    tools::Rectangle       GetEditCursor() const;
     void            ShowCursor( bool bGotoCursor = true, bool bForceVisCursor 
= true, bool bActivate = false );
     void            HideCursor( bool bDeactivate = false );
 
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 3d8bcb01300a..a3b75a6a5ce9 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -131,6 +131,17 @@ class SAL_DLLPUBLIC_RTTI ScGridWindow : public 
vcl::Window, public DropTargetHel
 
     VisibleRange maVisibleRange;
 
+    struct LOKCursorEntry
+    {
+        Fraction aScaleX;
+        Fraction aScaleY;
+        tools::Rectangle aRect;
+    };
+
+    // Stores the last cursor position in twips for all
+    // zoom levels demanded from a ScGridWindow instance.
+    std::vector<LOKCursorEntry> maLOKLastCursor;
+
     std::unique_ptr<sc::SpellCheckContext> mpSpellCheckCxt;
 
     ScViewData*             pViewData;
@@ -291,6 +302,10 @@ class SAL_DLLPUBLIC_RTTI ScGridWindow : public 
vcl::Window, public DropTargetHel
                                       ::std::vector< tools::Rectangle >& 
rPixelRects ) const;
     void            UpdateKitSelection(const std::vector<tools::Rectangle>& 
rRectangles,
                                        std::vector<tools::Rectangle>* 
pLogicRects = nullptr);
+    bool            NeedLOKCursorInvalidation(const tools::Rectangle& 
rCursorRect,
+                                              const Fraction aScaleX, const 
Fraction aScaleY);
+    void            InvalidateLOKViewCursor(const tools::Rectangle& 
rCursorRect,
+                                            const Fraction aScaleX, const 
Fraction aScaleY);
 
 protected:
     virtual void    PrePaint(vcl::RenderContext& rRenderContext) override;
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 93b3c55a093a..7db9ed9a9485 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -301,6 +301,59 @@ void ScGridWindow::PrePaint(vcl::RenderContext& 
/*rRenderContext*/)
     }
 }
 
+bool ScGridWindow::NeedLOKCursorInvalidation(const tools::Rectangle& 
rCursorRect,
+        const Fraction aScaleX, const Fraction aScaleY)
+{
+    // Don't see the need for a map as there will be only a few zoom levels
+    // and as of now X and Y zooms in online are the same.
+    for (auto& rEntry : maLOKLastCursor)
+    {
+        if (aScaleX == rEntry.aScaleX && aScaleY == rEntry.aScaleY)
+        {
+            if (rCursorRect == rEntry.aRect)
+                return false; // No change
+
+            // Update and allow invalidate.
+            rEntry.aRect = rCursorRect;
+            return true;
+        }
+    }
+
+    maLOKLastCursor.push_back(LOKCursorEntry{aScaleX, aScaleY, rCursorRect});
+    return true;
+}
+
+void ScGridWindow::InvalidateLOKViewCursor(const tools::Rectangle& rCursorRect,
+        const Fraction aScaleX, const Fraction aScaleY)
+{
+    if (!NeedLOKCursorInvalidation(rCursorRect, aScaleX, aScaleY))
+        return;
+
+    ScTabViewShell* pThisViewShell = pViewData->GetViewShell();
+    SfxViewShell* pViewShell = SfxViewShell::GetFirst();
+
+    while (pViewShell)
+    {
+        if (pViewShell != pThisViewShell)
+        {
+            ScTabViewShell* pOtherViewShell = 
dynamic_cast<ScTabViewShell*>(pViewShell);
+            if (pOtherViewShell)
+            {
+                ScViewData& rOtherViewData = pOtherViewShell->GetViewData();
+                Fraction aZoomX = rOtherViewData.GetZoomX();
+                Fraction aZoomY = rOtherViewData.GetZoomY();
+                if (aZoomX == aScaleX && aZoomY == aScaleY)
+                {
+                    SfxLokHelper::notifyOtherView(pThisViewShell, 
pOtherViewShell,
+                            LOK_CALLBACK_INVALIDATE_VIEW_CURSOR, "rectangle", 
rCursorRect.toString());
+                }
+            }
+        }
+
+        pViewShell = SfxViewShell::GetNext(*pViewShell);
+    }
+}
+
 void ScGridWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const 
tools::Rectangle& rRect )
 {
     ScDocument* pDoc = pViewData->GetDocument();
@@ -922,13 +975,11 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, 
const ScTableInfo& rTableI
                         {
                             long nScreenX = aOutputData.nScrX;
                             long nScreenY = aOutputData.nScrY;
-                            long nScreenW = aOutputData.GetScrW();
-                            long nScreenH = aOutputData.GetScrH();
 
                             rDevice.SetLineColor();
                             
rDevice.SetFillColor(pOtherEditView->GetBackgroundColor());
-                            Point aStart = rOtherViewData.GetScrPos( nCol1, 
nRow1, eOtherWhich );
-                            Point aEnd = rOtherViewData.GetScrPos( nCol2+1, 
nRow2+1, eOtherWhich );
+                            Point aStart = pViewData->GetScrPos( nCol1, nRow1, 
eOtherWhich );
+                            Point aEnd = pViewData->GetScrPos( nCol2+1, 
nRow2+1, eOtherWhich );
 
                             // don't overwrite grid
                             long nLayoutSign = bLayoutRTL ? -1 : 1;
@@ -956,8 +1007,24 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, 
const ScTableInfo& rTableI
                             // paint the background
                             
rDevice.DrawRect(rDevice.PixelToLogic(aBackground));
 
-                            tools::Rectangle aEditRect(Point(nScreenX, 
nScreenY), Size(nScreenW, nScreenH));
+                            tools::Rectangle aEditRect(aBackground);
+                            aEditRect.AdjustLeft(1);
+                            aEditRect.AdjustTop(1);
+
+                            // EditView has an 'output area' which is used to 
clip the 'paint area' we provide below.
+                            // So they need to be in the same 
coordinates/units. This is tied to the mapmode of the gridwin
+                            // attached to the EditView, so we have to change 
its mapmode too (temporarily). We save the
+                            // original mapmode and 'output area' and roll 
them back when we finish painting to rDevice.
+                            vcl::Window* pOtherWin = 
pOtherEditView->GetWindow();
+                            const tools::Rectangle 
aOrigOutputArea(pOtherEditView->GetOutputArea()); // Not in pixels.
+                            const MapMode aOrigMapMode = 
pOtherWin->GetMapMode();
+                            pOtherWin->SetMapMode(rDevice.GetMapMode());
+                            
pOtherEditView->SetOutputArea(rDevice.PixelToLogic(aEditRect));
                             
pOtherEditView->Paint(rDevice.PixelToLogic(aEditRect), &rDevice);
+
+                            // Rollback the mapmode and 'output area'.
+                            pOtherWin->SetMapMode(aOrigMapMode);
+                            pOtherEditView->SetOutputArea(aOrigOutputArea);
                             rDevice.SetMapMode(MapMode(MapUnit::MapPixel));
                         }
                     }
@@ -1001,6 +1068,8 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, 
const ScTableInfo& rTableI
 
         // set the correct mapmode
         tools::Rectangle aBackground(aStart, aEnd);
+        tools::Rectangle aBGAbs(aStart, aEnd);
+
         if (bIsTiledRendering)
         {
             // Need to draw the background in absolute coords.
@@ -1036,8 +1105,50 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, 
const ScTableInfo& rTableI
         rDevice.DrawRect(aLogicRect);
 
         // paint the editeng text
-        tools::Rectangle aEditRect(Point(nScrX, nScrY), 
Size(aOutputData.GetScrW(), aOutputData.GetScrH()));
-        pEditView->Paint(rDevice.PixelToLogic(aEditRect), &rDevice);
+        if (bIsTiledRendering)
+        {
+            tools::Rectangle aEditRect(aBackground);
+            aEditRect.AdjustLeft(1);
+            aEditRect.AdjustTop(1);
+            // EditView has an 'output area' which is used to clip the paint 
area we provide below.
+            // So they need to be in the same coordinates/units. This is tied 
to the mapmode of the gridwin
+            // attached to the EditView, so we have to change its mapmode too 
(temporarily). We save the
+            // original mapmode and 'output area' and roll them back when we 
finish painting to rDevice.
+            const tools::Rectangle 
aOrigOutputArea(pEditView->GetOutputArea()); // Not in pixels.
+            const MapMode aOrigMapMode = GetMapMode();
+            SetMapMode(rDevice.GetMapMode());
+            pEditView->SetOutputArea(rDevice.PixelToLogic(aEditRect));
+            pEditView->Paint(rDevice.PixelToLogic(aEditRect), &rDevice);
+
+            // Now we need to get relative cursor position within the editview.
+            // This is for sending the absolute twips position of the cursor 
to the specific views with
+            // the same given zoom level.
+            tools::Rectangle aCursorRect = pEditView->GetEditCursor();
+            Point aCursPos = OutputDevice::LogicToLogic(aCursorRect.TopLeft(), 
MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+
+            // Rollback the mapmode and 'output area'.
+            SetMapMode(aOrigMapMode);
+            pEditView->SetOutputArea(aOrigOutputArea);
+
+            const MapMode& rDevMM = rDevice.GetMapMode();
+            MapMode aMM(MapUnit::MapTwip);
+            aMM.SetScaleX(rDevMM.GetScaleX());
+            aMM.SetScaleY(rDevMM.GetScaleY());
+
+            aBGAbs.AdjustLeft(1);
+            aBGAbs.AdjustTop(1);
+            aCursorRect = OutputDevice::PixelToLogic(aBGAbs, aMM);
+            aCursorRect.setWidth(0);
+            aCursorRect.Move(aCursPos.getX(), 0);
+            // Sends view cursor position to views of all matching zooms if 
needed (avoids duplicates).
+            InvalidateLOKViewCursor(aCursorRect, aMM.GetScaleX(), 
aMM.GetScaleY());
+        }
+        else
+        {
+            tools::Rectangle aEditRect(Point(nScrX, nScrY), 
Size(aOutputData.GetScrW(), aOutputData.GetScrH()));
+            pEditView->Paint(rDevice.PixelToLogic(aEditRect), &rDevice);
+        }
+
         rDevice.SetMapMode(MapMode(MapUnit::MapPixel));
 
         // restore the cursor it was originally visible
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index d10e1d8be8ed..6849c11e314a 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -1460,6 +1460,7 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich,
 
         if (comphelper::LibreOfficeKit::isActive())
         {
+            pEditView[eWhich]->SetBroadcastLOKViewCursor(false);
             pEditView[eWhich]->RegisterViewShell(pViewShell);
         }
     }
commit a365fc8bc997a9b607d9a58511418c7bfaa5df8a
Author:     Michael Meeks <michael.me...@collabora.com>
AuthorDate: Mon Jan 13 16:24:06 2020 +0000
Commit:     Dennis Francis <dennisfrancis...@gmail.com>
CommitDate: Tue May 26 23:17:27 2020 +0530

    mobile: escape JSON for function wizard, and emit only on mobile.
    
    Otherwise typing "-> wa" into a cell gives JS exceptions.
    
    Change-Id: I5303186fe9f84e055d65cf1929ccf5a7a20cae35
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86705
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>
    (cherry picked from commit ff365eb193279bb9866b8fad7378f6068b207051)

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index bf88e234ddc9..f50d41e029ae 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -26,6 +26,7 @@
 #include <editeng/eeitem.hxx>
 
 #include <sfx2/app.hxx>
+#include <sfx2/lokhelper.hxx>
 #include <editeng/acorrcfg.hxx>
 #include <formula/errorcodes.hxx>
 #include <editeng/adjustitem.hxx>
@@ -1286,9 +1287,21 @@ bool ScInputHandler::GetFuncName( OUString& aStart, 
OUString& aResult )
     return true;
 }
 
+namespace {
+    /// Rid ourselves of unwanted " quoted json characters.
+    OString escapeJSON(const OUString &aStr)
+    {
+        OUString aEscaped = aStr;
+        aEscaped = aEscaped.replaceAll("\n", " ");
+        aEscaped = aEscaped.replaceAll("\"", "'");
+        return OUStringToOString(aEscaped, RTL_TEXTENCODING_UTF8);
+    }
+}
+
 void ScInputHandler::ShowFuncList( const ::std::vector< OUString > & 
rFuncStrVec )
 {
-    if (comphelper::LibreOfficeKit::isActive())
+    if (comphelper::LibreOfficeKit::isActive() &&
+        comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView()))
     {
         SfxViewShell* pViewShell = SfxViewShell::Current();
         if (pViewShell && rFuncStrVec.size())
@@ -1320,12 +1333,10 @@ void ScInputHandler::ShowFuncList( const ::std::vector< 
OUString > & rFuncStrVec
                     {
                         aPayload.append("{");
                         aPayload.append("\"signature\": \"");
-                        OUString aSignature = ppFDesc->getSignature();
-                        aPayload.append(OUStringToOString(aSignature, 
RTL_TEXTENCODING_UTF8));
+                        aPayload.append(escapeJSON(ppFDesc->getSignature()));
                         aPayload.append("\", ");
                         aPayload.append("\"description\": \"");
-                        OUString aFuncDescr = ppFDesc->getDescription();
-                        aPayload.append(OUStringToOString(aFuncDescr, 
RTL_TEXTENCODING_UTF8));
+                        aPayload.append(escapeJSON(ppFDesc->getDescription()));
                         aPayload.append("\"}, ");
                     }
                 }
commit e57341318cc4e38ea4c2aa7e73f20663c4cdcd5f
Author:     Michael Meeks <michael.me...@collabora.com>
AuthorDate: Mon Dec 9 15:40:24 2019 +0000
Commit:     Dennis Francis <dennisfrancis...@gmail.com>
CommitDate: Tue May 26 23:17:27 2020 +0530

    lok: calc - update our version of the other view's selections on zoom.
    
    Change-Id: I4d23bb77045b41d04109e7dd70a1f47bca8aaa56
    Reviewed-on: https://gerrit.libreoffice.org/84767
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>
    (cherry picked from commit ca2fdd792de5d6d208097b3049238865058c7cc1)

diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index d811cb48a02b..3d8bcb01300a 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -440,6 +440,7 @@ public:
     void updateKitCellCursor(const SfxViewShell* pOtherShell) const;
     /// notify this view with new positions for other view's cursors (after 
zoom)
     void updateKitOtherCursors() const;
+    void updateOtherKitSelections() const;
 
     /// Same as MouseButtonDown(), but coordinates are in logic unit.
     virtual void LogicMouseButtonDown(const MouseEvent& rMouseEvent) override;
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 40050a6cda5f..5892da8689a9 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -887,8 +887,9 @@ void ScModelObj::setClientZoom(int nTilePixelWidth_, int 
nTilePixelHeight_, int
     pViewData->SetZoom(Fraction(nTilePixelWidth_ * TWIPS_PER_PIXEL, 
nTileTwipWidth_),
                        Fraction(nTilePixelHeight_ * TWIPS_PER_PIXEL, 
nTileTwipHeight_), true);
 
-    // refresh our view's take on other view's cursors
+    // refresh our view's take on other view's cursors & selections
     pViewData->GetActiveWin()->updateKitOtherCursors();
+    pViewData->GetActiveWin()->updateOtherKitSelections();
 }
 
 OUString ScModelObj::getRowColumnHeaders(const tools::Rectangle& rRectangle)
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index b786cb59675c..b637c373d0d5 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5939,7 +5939,7 @@ static OString rectanglesToString(const 
std::vector<tools::Rectangle> &rLogicRec
 }
 
 /**
- * Turn the selection ranges rRectangles into the LibreOfficeKit selection, 
and call the callback.
+ * Turn the selection ranges rRectangles into the LibreOfficeKit selection, 
and send to other views.
  *
  * @param pLogicRects - if set then don't invoke the callback, just collect 
the rectangles in the pointed vector.
  */
@@ -5985,6 +5985,42 @@ void ScGridWindow::UpdateKitSelection(const 
std::vector<tools::Rectangle>& rRect
     }
 }
 
+/**
+ * Fetch the selection ranges for other views into the LibreOfficeKit 
selection,
+ * map them into our view co-ordinates and send to our view.
+ */
+void ScGridWindow::updateOtherKitSelections() const
+{
+    ScTabViewShell* pViewShell = pViewData->GetViewShell();
+
+    for (SfxViewShell* it = SfxViewShell::GetFirst(); it;
+         it = SfxViewShell::GetNext(*it))
+    {
+        auto pOther = dynamic_cast<const ScTabViewShell *>(it);
+        assert(pOther);
+        if (!pOther)
+            return;
+
+        const ScGridWindow *pGrid = pOther->GetViewData().GetActiveWin();
+        assert(pGrid);
+
+        // Fetch pixels & convert for each view separately.
+        tools::Rectangle aBoundingBox;
+        std::vector<tools::Rectangle> aPixelRects;
+        GetPixelRectsFor(pOther->GetViewData().GetMarkData() /* theirs */, 
aPixelRects);
+        auto aOtherLogicRects = 
convertPixelToLogical(&pViewShell->GetViewData(), aPixelRects, aBoundingBox);
+        OString aRectsString = rectanglesToString(aOtherLogicRects);
+        if (it == pViewShell)
+        {
+            
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, 
aBoundingBox.toString().getStr());
+            
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, 
aRectsString.getStr());
+        }
+        else
+            SfxLokHelper::notifyOtherView(it, pViewShell, 
LOK_CALLBACK_TEXT_VIEW_SELECTION,
+                                          "selection", aRectsString.getStr());
+    }
+}
+
 namespace
 {
 
commit da48bceb8909acec918711483c84c03ab9c87380
Author:     Michael Meeks <michael.me...@collabora.com>
AuthorDate: Wed Dec 4 22:29:10 2019 +0000
Commit:     Dennis Francis <dennisfrancis...@gmail.com>
CommitDate: Tue May 26 23:17:27 2020 +0530

    lok: calc - update our version of the other view's selections on zoom.
    
    Change-Id: I8487f28d762c8bf5be4f00a331263218dc71d179
    Reviewed-on: https://gerrit.libreoffice.org/84694
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>
    (cherry picked from commit 2986620074d104611a6e78c98ee5a09941866125)

diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 7a361fc9dc41..d811cb48a02b 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -435,7 +435,11 @@ public:
 
     /// get Cell cursor in this view's co-ordinate system @see 
ScModelObj::getCellCursor().
     OString getCellCursor() const;
-    void updateLibreOfficeKitCellCursor(const SfxViewShell* pOtherShell) const;
+    void notifyKitCellCursor() const;
+    void notifyKitCellViewCursor(const SfxViewShell* pForShell) const;
+    void updateKitCellCursor(const SfxViewShell* pOtherShell) const;
+    /// notify this view with new positions for other view's cursors (after 
zoom)
+    void updateKitOtherCursors() const;
 
     /// Same as MouseButtonDown(), but coordinates are in logic unit.
     virtual void LogicMouseButtonDown(const MouseEvent& rMouseEvent) override;
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 84d5ba33155b..40050a6cda5f 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -886,6 +886,9 @@ void ScModelObj::setClientZoom(int nTilePixelWidth_, int 
nTilePixelHeight_, int
 
     pViewData->SetZoom(Fraction(nTilePixelWidth_ * TWIPS_PER_PIXEL, 
nTileTwipWidth_),
                        Fraction(nTilePixelHeight_ * TWIPS_PER_PIXEL, 
nTileTwipHeight_), true);
+
+    // refresh our view's take on other view's cursors
+    pViewData->GetActiveWin()->updateKitOtherCursors();
 }
 
 OUString ScModelObj::getRowColumnHeaders(const tools::Rectangle& rRectangle)
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 52186a6c1918..b786cb59675c 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5721,42 +5721,69 @@ OString ScGridWindow::getCellCursor() const
     return pViewData->describeCellCursor();
 }
 
-// Send our cursor details to a view described by @pOtherShell, or all views
-// if @pOtherShell is null. In each case send the current view a cell-cursor
+void ScGridWindow::notifyKitCellCursor() const
+{
+    ScTabViewShell* pViewShell = pViewData->GetViewShell();
+
+    pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, 
getCellCursor().getStr());
+    if (bListValButton && aListValPos == pViewData->GetCurPos())
+        updateLOKValListButton(true, aListValPos);
+}
+
+void ScGridWindow::notifyKitCellViewCursor(const SfxViewShell* pForShell) const
+{
+    ScTabViewShell* pViewShell = pViewData->GetViewShell();
+
+    OString aCursor("EMPTY");
+    if (mpOOCursors) // cf. getCellCursor above
+    {
+        auto pForTabView = dynamic_cast<const ScTabViewShell *>(pForShell);
+        assert(pForTabView);
+        if (!pForTabView)
+            return;
+        aCursor = pForTabView->GetViewData().describeCellCursorAt(
+            pViewData->GetCurX(), pViewData->GetCurY()); // our position.
+    }
+    SfxLokHelper::notifyOtherView(pViewShell, pForShell, 
LOK_CALLBACK_CELL_VIEW_CURSOR, "rectangle", aCursor);
+}
+
+// Send our cursor details to a view described by @pForShell, or all views
+// if @pForShell is null. In each case send the current view a cell-cursor
 // event, and others a cell_view_cursor event.
 //
 // NB. we need to re-construct the cursor details for each other view in their
 // own zoomed co-ordinate system.
-void ScGridWindow::updateLibreOfficeKitCellCursor(const SfxViewShell* 
pForShell) const
+void ScGridWindow::updateKitCellCursor(const SfxViewShell* pForShell) const
 {
-    if (!pForShell) // recurse with it set
+    if (!pForShell)
     {
         for (SfxViewShell* it = SfxViewShell::GetFirst(); it;
              it = SfxViewShell::GetNext(*it))
-            updateLibreOfficeKitCellCursor(it);
+            updateKitCellCursor(it);
         return;
     }
 
-    ScTabViewShell* pViewShell = pViewData->GetViewShell();
-    if (pForShell == pViewShell)
-    {
-        pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, 
getCellCursor().getStr());
-        if (bListValButton && aListValPos == pViewData->GetCurPos())
-            updateLOKValListButton(true, aListValPos);
-    }
+    if (pForShell == pViewData->GetViewShell())
+        notifyKitCellCursor();
     else
+        notifyKitCellViewCursor(pForShell);
+}
+
+void ScGridWindow::updateKitOtherCursors() const
+{
+    for (SfxViewShell* it = SfxViewShell::GetFirst(); it;
+         it = SfxViewShell::GetNext(*it))
     {
-        OString aCursor("EMPTY");
-        if (mpOOCursors) // cf. getCellCursor above
-        {
-            auto pOther = dynamic_cast<const ScTabViewShell *>(pForShell);
-            assert(pOther);
-            if (!pOther)
-                return;
-            aCursor = pOther->GetViewData().describeCellCursorAt(
-                pViewData->GetCurX(), pViewData->GetCurY()); // our position.
-        }
-        SfxLokHelper::notifyOtherView(pViewShell, pForShell, 
LOK_CALLBACK_CELL_VIEW_CURSOR, "rectangle", aCursor);
+        auto pOther = dynamic_cast<const ScTabViewShell *>(it);
+        assert(pOther);
+        if (!pOther)
+            continue;
+        const ScGridWindow *pGrid = pOther->GetViewData().GetActiveWin();
+        assert(pGrid);
+        if (pGrid == this)
+            notifyKitCellCursor();
+        else
+            pGrid->notifyKitCellViewCursor(pViewData->GetViewShell());
     }
 }
 
@@ -6105,7 +6132,7 @@ void ScGridWindow::UpdateCursorOverlay()
         if (comphelper::LibreOfficeKit::isActive())
         {
             mpOOCursors.reset(new sdr::overlay::OverlayObjectList);
-            updateLibreOfficeKitCellCursor(nullptr);
+            updateKitCellCursor(nullptr);
         }
         else
         {
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index 48474a468170..b8fb79fcd69e 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -473,7 +473,7 @@ void ScTabViewShell::NotifyCursor(SfxViewShell* 
pOtherShell) const
 
     const ScGridWindow* pWin = GetViewData().GetActiveWin();
     if (pWin)
-        pWin->updateLibreOfficeKitCellCursor(pOtherShell);
+        pWin->updateKitCellCursor(pOtherShell);
 }
 
 css::uno::Reference<css::datatransfer::XTransferable2> 
ScTabViewShell::GetClipData(vcl::Window* pWin)
commit 1c78eb2e33e6218b22470096eff9fee3a3159162
Author:     Michael Meeks <michael.me...@collabora.com>
AuthorDate: Tue Dec 3 17:35:34 2019 +0000
Commit:     Dennis Francis <dennisfrancis...@gmail.com>
CommitDate: Tue May 26 23:17:26 2020 +0530

    lok: calc - send other views our selection in their co-ordinates.
    
    Change-Id: If48b5adb9b8b03310d2d2c4e4fefab84ad8bb149
    Reviewed-on: https://gerrit.libreoffice.org/84370
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>
    (cherry picked from commit ab07df7ee12aef8bb3770e69d22ecb272d379ece)

diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index c56eca68895c..7a361fc9dc41 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -286,8 +286,11 @@ class SAL_DLLPUBLIC_RTTI ScGridWindow : public 
vcl::Window, public DropTargetHel
 
     void            SelectForContextMenu( const Point& rPosPixel, SCCOL 
nCellX, SCROW nCellY );
 
-    void            GetSelectionRects( ::std::vector< tools::Rectangle >& 
rPixelRects );
-
+    void            GetSelectionRects( ::std::vector< tools::Rectangle >& 
rPixelRects ) const;
+    void            GetPixelRectsFor( const ScMarkData &rMarkData,
+                                      ::std::vector< tools::Rectangle >& 
rPixelRects ) const;
+    void            UpdateKitSelection(const std::vector<tools::Rectangle>& 
rRectangles,
+                                       std::vector<tools::Rectangle>* 
pLogicRects = nullptr);
 
 protected:
     virtual void    PrePaint(vcl::RenderContext& rRenderContext) override;
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index b4af1dd213b1..0ee1cfd48819 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -376,7 +376,7 @@ public:
     void            FakeButtonUp( ScSplitPos eWhich );
 
     ScGridWindow*   GetActiveWin();
-    vcl::Window*         GetWindowByPos( ScSplitPos ePos ) { return 
pGridWin[ePos]; }
+    vcl::Window*    GetWindowByPos( ScSplitPos ePos ) const { return 
pGridWin[ePos]; }
 
     ScSplitPos      FindWindow( const vcl::Window* pWindow ) const;
 
diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index 1dc31b11fe71..e5833dec5d32 100644
--- a/sc/source/ui/inc/viewdata.hxx
+++ b/sc/source/ui/inc/viewdata.hxx
@@ -606,7 +606,7 @@ public:
 
     /// return json for our cursor position.
     OString         describeCellCursor() const { return 
describeCellCursorAt(GetCurX(), GetCurY()); }
-    OString         describeCellCursorAt(SCCOL nCol, SCROW nRow) const;
+    OString         describeCellCursorAt( SCCOL nCol, SCROW nRow ) const;
 
     SCCOL           CellsAtX( SCCOL nPosX, SCCOL nDir, ScHSplitPos eWhichX, 
sal_uInt16 nScrSizeY = SC_SIZE_NONE ) const;
     SCROW           CellsAtY( SCROW nPosY, SCROW nDir, ScVSplitPos eWhichY, 
sal_uInt16 nScrSizeX = SC_SIZE_NONE ) const;
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 2dbedf072d74..52186a6c1918 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5870,22 +5870,16 @@ void ScGridWindow::UpdateCopySourceOverlay()
         SetMapMode( aOldMode );
 }
 
-/**
- * Turn the selection ranges rRectangles into the LibreOfficeKit selection, 
and call the callback.
- *
- * @param pLogicRects - if not 0, then don't invoke the callback, just collect 
the rectangles in the pointed vector.
- */
-static void updateLibreOfficeKitSelection(const ScViewData* pViewData, const 
std::vector<tools::Rectangle>& rRectangles, std::vector<tools::Rectangle>* 
pLogicRects = nullptr)
+static std::vector<tools::Rectangle> convertPixelToLogical(
+    const ScViewData* pViewData,
+    const std::vector<tools::Rectangle>& rRectangles,
+    tools::Rectangle &rBoundingBox)
 {
-    if (!comphelper::LibreOfficeKit::isActive())
-        return;
+    std::vector<tools::Rectangle> aLogicRects;
 
     double nPPTX = pViewData->GetPPTX();
     double nPPTY = pViewData->GetPPTY();
 
-    tools::Rectangle aBoundingBox;
-    std::vector<OString> aRectangles;
-
     for (const auto& rRectangle : rRectangles)
     {
         // We explicitly create a copy, since we need to expand
@@ -5894,31 +5888,74 @@ static void updateLibreOfficeKitSelection(const 
ScViewData* pViewData, const std
         aRectangle.AdjustRight(1 );
         aRectangle.AdjustBottom(1 );
 
-        aBoundingBox.Union(aRectangle);
-
         tools::Rectangle aRect(aRectangle.Left() / nPPTX, aRectangle.Top() / 
nPPTY,
                 aRectangle.Right() / nPPTX, aRectangle.Bottom() / nPPTY);
-        if (pLogicRects)
-            pLogicRects->push_back(aRect);
-        else
-            aRectangles.push_back(aRect.toString());
+
+        rBoundingBox.Union(aRect);
+        aLogicRects.push_back(aRect);
     }
+    return aLogicRects;
+}
 
-    if (pLogicRects)
+static OString rectanglesToString(const std::vector<tools::Rectangle> 
&rLogicRects)
+{
+    bool bFirst = true;
+    OStringBuffer aRects;
+    for (const auto &rRect : rLogicRects)
+    {
+        if (!bFirst)
+            aRects.append("; ");
+        bFirst = false;
+        aRects.append(rRect.toString());
+    }
+    return aRects.makeStringAndClear();
+}
+
+/**
+ * Turn the selection ranges rRectangles into the LibreOfficeKit selection, 
and call the callback.
+ *
+ * @param pLogicRects - if set then don't invoke the callback, just collect 
the rectangles in the pointed vector.
+ */
+void ScGridWindow::UpdateKitSelection(const std::vector<tools::Rectangle>& 
rRectangles, std::vector<tools::Rectangle>* pLogicRects)
+{
+    if (!comphelper::LibreOfficeKit::isActive())
         return;
 
-    // selection start handle
-    tools::Rectangle aRectangle(
-            aBoundingBox.Left()  / nPPTX, aBoundingBox.Top() / nPPTY,
-            aBoundingBox.Right() / nPPTX, aBoundingBox.Bottom() / nPPTY);
+    tools::Rectangle aBoundingBox;
+    std::vector<tools::Rectangle> aLogicRects;
 
-    // the selection itself
-    OString aSelection = comphelper::string::join("; ", aRectangles).getStr();
+    aLogicRects = convertPixelToLogical(pViewData, rRectangles, aBoundingBox);
+    if (pLogicRects)
+    {
+        *pLogicRects = aLogicRects;
+        return;
+    }
 
     ScTabViewShell* pViewShell = pViewData->GetViewShell();
-    pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, 
aRectangle.toString().getStr());
-    pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, 
aSelection.getStr());
-    SfxLokHelper::notifyOtherViews(pViewShell, 
LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", aSelection.getStr());
+    pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, 
aBoundingBox.toString().getStr());
+    pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, 
rectanglesToString(aLogicRects).getStr());
+
+    for (SfxViewShell* it = SfxViewShell::GetFirst(); it;
+         it = SfxViewShell::GetNext(*it))
+    {
+        if (it == pViewShell)
+            continue;
+        auto pOther = dynamic_cast<const ScTabViewShell *>(it);
+        assert(pOther);
+        if (!pOther)
+            return;
+
+        const ScGridWindow *pGrid = pOther->GetViewData().GetActiveWin();
+        assert(pGrid);
+
+        // Fetch pixels & convert for each view separately.
+        tools::Rectangle aDummyBBox;
+        std::vector<tools::Rectangle> aPixelRects;
+        pGrid->GetPixelRectsFor(pViewData->GetMarkData() /* ours */, 
aPixelRects);
+        auto aOtherLogicRects = convertPixelToLogical(&pOther->GetViewData(), 
aPixelRects, aDummyBBox);
+        SfxLokHelper::notifyOtherView(pViewShell, pOther, 
LOK_CALLBACK_TEXT_VIEW_SELECTION,
+                                      "selection", 
rectanglesToString(aOtherLogicRects).getStr());
+    }
 }
 
 namespace
@@ -6112,7 +6149,7 @@ void 
ScGridWindow::GetCellSelection(std::vector<tools::Rectangle>& rLogicRects)
 {
     std::vector<tools::Rectangle> aPixelRects;
     GetSelectionRects(aPixelRects);
-    updateLibreOfficeKitSelection(pViewData, aPixelRects, &rLogicRects);
+    UpdateKitSelection(aPixelRects, &rLogicRects);
 }
 
 void ScGridWindow::DeleteSelectionOverlay()
@@ -6138,7 +6175,7 @@ void ScGridWindow::UpdateSelectionOverlay()
         if (comphelper::LibreOfficeKit::isActive())
         {
             // notify the LibreOfficeKit too
-            updateLibreOfficeKitSelection(pViewData, aPixelRects);
+            UpdateKitSelection(aPixelRects);
         }
         else if (xOverlayManager.is())
         {
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 2f1285e1a4e2..93b3c55a093a 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1787,9 +1787,16 @@ bool ScGridWindow::IsAutoFilterActive( SCCOL nCol, SCROW 
nRow, SCTAB nTab )
     return ( bSimpleQuery && bColumnFound );
 }
 
-void ScGridWindow::GetSelectionRects( ::std::vector< tools::Rectangle >& 
rPixelRects )
+void ScGridWindow::GetSelectionRects( ::std::vector< tools::Rectangle >& 
rPixelRects ) const
 {
-    ScMarkData aMultiMark( pViewData->GetMarkData() );
+    GetPixelRectsFor( pViewData->GetMarkData(), rPixelRects );
+}
+
+/// convert rMarkData into pixel rectangles for this view
+void ScGridWindow::GetPixelRectsFor( const ScMarkData &rMarkData,
+                                     ::std::vector< tools::Rectangle >& 
rPixelRects ) const
+{
+    ScMarkData aMultiMark( rMarkData );
     aMultiMark.SetMarking( false );
     aMultiMark.MarkToMulti();
     ScDocument* pDoc = pViewData->GetDocument();
commit 970e1d0beb129c493644c34aee30cb82aa50e80b
Author:     Michael Meeks <michael.me...@collabora.com>
AuthorDate: Tue Dec 3 12:18:37 2019 +0000
Commit:     Dennis Francis <dennisfrancis...@gmail.com>
CommitDate: Tue May 26 23:17:26 2020 +0530

    lok: send other views our cursor position in their view co-ordinates.
    
    Change-Id: If8d84a04e8d7b4863dcb9bc9058939b1eb793266
    (cherry picked from commit c6b18508aec0e609b4c3c000faf89c21e93620bd)

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 996e7c90b787..2dbedf072d74 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5721,28 +5721,42 @@ OString ScGridWindow::getCellCursor() const
     return pViewData->describeCellCursor();
 }
 
-void ScGridWindow::updateLibreOfficeKitCellCursor(const SfxViewShell* 
pOtherShell) const
-{
-    OString aCursor = getCellCursor();
+// Send our cursor details to a view described by @pOtherShell, or all views
+// if @pOtherShell is null. In each case send the current view a cell-cursor
+// event, and others a cell_view_cursor event.
+//
+// NB. we need to re-construct the cursor details for each other view in their
+// own zoomed co-ordinate system.
+void ScGridWindow::updateLibreOfficeKitCellCursor(const SfxViewShell* 
pForShell) const
+{
+    if (!pForShell) // recurse with it set
+    {
+        for (SfxViewShell* it = SfxViewShell::GetFirst(); it;
+             it = SfxViewShell::GetNext(*it))
+            updateLibreOfficeKitCellCursor(it);
+        return;
+    }
+
     ScTabViewShell* pViewShell = pViewData->GetViewShell();
-    if (pOtherShell)
+    if (pForShell == pViewShell)
     {
-        if (pOtherShell == pViewShell)
-        {
-            pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, 
aCursor.getStr());
-
-            if (bListValButton && aListValPos == pViewData->GetCurPos())
-                updateLOKValListButton(true, aListValPos);
-        }
-        else
-        {
-            SfxLokHelper::notifyOtherView(pViewShell, pOtherShell, 
LOK_CALLBACK_CELL_VIEW_CURSOR, "rectangle", aCursor);
-        }
+        pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, 
getCellCursor().getStr());
+        if (bListValButton && aListValPos == pViewData->GetCurPos())
+            updateLOKValListButton(true, aListValPos);
     }
     else
     {
-        pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, 
aCursor.getStr());
-        SfxLokHelper::notifyOtherViews(pViewShell, 
LOK_CALLBACK_CELL_VIEW_CURSOR, "rectangle", aCursor);
+        OString aCursor("EMPTY");
+        if (mpOOCursors) // cf. getCellCursor above
+        {
+            auto pOther = dynamic_cast<const ScTabViewShell *>(pForShell);
+            assert(pOther);
+            if (!pOther)
+                return;
+            aCursor = pOther->GetViewData().describeCellCursorAt(
+                pViewData->GetCurX(), pViewData->GetCurY()); // our position.
+        }
+        SfxLokHelper::notifyOtherView(pViewShell, pForShell, 
LOK_CALLBACK_CELL_VIEW_CURSOR, "rectangle", aCursor);
     }
 }
 
commit de4dddbf8df57903b686d8555eb95a01a323cfaf
Author:     Michael Meeks <michael.me...@collabora.com>
AuthorDate: Wed Dec 11 23:58:08 2019 +0000
Commit:     Dennis Francis <dennisfrancis...@gmail.com>
CommitDate: Tue May 26 23:17:26 2020 +0530

    lok: avoid crash cleaning up help-windows with multiple views.
    
    Change-Id: Ic57018396de7730d9fa4fb3b4803a221cb9678da
    Reviewed-on: https://gerrit.libreoffice.org/84999
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>
    Tested-by: Michael Meeks <michael.me...@collabora.com>
    (cherry picked from commit 435659fd7e401353fc114246813b811190362293)

diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx
index f88c11f1f833..5ad273cb2bbb 100644
--- a/vcl/source/app/help.cxx
+++ b/vcl/source/app/help.cxx
@@ -562,13 +562,20 @@ void ImplDestroyHelpWindow( bool bUpdateHideTime )
 void ImplDestroyHelpWindow(ImplSVHelpData& rHelpData, bool bUpdateHideTime)
 {
     VclPtr<HelpTextWindow> pHelpWin = rHelpData.mpHelpWin;
-    if ( pHelpWin )
+    if( pHelpWin )
     {
-        vcl::Window * pWindow = pHelpWin->GetParent()->ImplGetFrameWindow();
-        // find out screen area covered by system help window
-        tools::Rectangle aInvRect( pHelpWin->GetWindowExtentsRelative( pWindow 
) );
-        if( pHelpWin->IsVisible() )
-            pWindow->Invalidate( aInvRect );
+        vcl::Window * pParent = pHelpWin->GetParent();
+        if( pParent )
+        {
+            VclPtr<vcl::Window> pWindow( pParent->ImplGetFrameWindow() );
+            if( pWindow )
+            {
+                // find out screen area covered by system help window
+                tools::Rectangle aInvRect( pHelpWin->GetWindowExtentsRelative( 
pWindow ) );
+                if( pHelpWin->IsVisible() )
+                    pWindow->Invalidate( aInvRect );
+            }
+        }
         rHelpData.mpHelpWin = nullptr;
         rHelpData.mbKeyboardHelp = false;
         pHelpWin->Hide();
commit 8e05f9fe116634e9860164e99325ee3c87449c7e
Author:     Dennis Francis <dennis.fran...@collabora.com>
AuthorDate: Sun Mar 22 19:43:03 2020 +0530
Commit:     Dennis Francis <dennisfrancis...@gmail.com>
CommitDate: Tue May 26 23:17:26 2020 +0530

    lokit: unify fill transparency items
    
    Online just listens to .uno:FillFloatTransparence but the set-item
    in core it corresponds to, does not represent the fill-transparency
    types like 'None' and 'Solid'. This is represented by another item
    called XFillTransparencyItem. As a result the mobile wizard does not
    show the correct transparency fill type always.
    To solve this, this patch encodes the constant transparency percentage
    in case of Solid and None(always 0%) as an intensity and stores this
    info in the statechange message of .uno:FillFloatTransparence whenever
    there is no gradient type and corrects the 'style' attribute of the
    message appropriately.
    
    More detailed information is provided as comments at appropriate
    places in the patch.
    
    Change-Id: I443ef4ce349badf28f6c2c702b1014868d9c6ed5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90878
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>
    (cherry picked from commit 8f062cdae1c71c9dd2a1e3f81617b08ac7463c5d)

diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index f1ef70efcc09..7ed2da3d66ac 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -2511,6 +2511,19 @@ boost::property_tree::ptree 
XFillFloatTransparenceItem::dumpAsJSON() const
     boost::property_tree::ptree aTree = XFillGradientItem::dumpAsJSON();
     aTree.put("commandName", ".uno:FillFloatTransparence");
 
+    if (!bEnabled)
+    {
+        boost::property_tree::ptree& rState = aTree.get_child("state");
+        // When gradient fill is disabled, the intensity fields contain the
+        // constant encoded percent-transparency. However we use that here to 
just
+        // distinguish between 'None' and 'Solid' types and correct the 'style'
+        // property appropriately.
+        if (GetGradientValue().GetStartIntens() == 100)
+            rState.put("style", "NONE");
+        else
+            rState.put("style", "SOLID");
+    }
+
     return aTree;
 }
 
diff --git a/sw/source/uibase/shells/drawdlg.cxx 
b/sw/source/uibase/shells/drawdlg.cxx
index c0fff23e32f8..6aea1545203c 100644
--- a/sw/source/uibase/shells/drawdlg.cxx
+++ b/sw/source/uibase/shells/drawdlg.cxx
@@ -42,6 +42,8 @@
 #include <svx/xflclit.hxx>
 #include <svx/xfillit0.hxx>
 #include <svx/xflgrit.hxx>
+#include <svx/xflftrit.hxx>
+#include <svx/xfltrit.hxx>
 #include <comphelper/lok.hxx>
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
 
@@ -324,6 +326,40 @@ void SwDrawShell::ExecDrawAttrArgs(SfxRequest const & rReq)
             pView->GetModel()->SetChanged();
 }
 
+void lcl_unifyFillTransparencyItems(SfxItemSet& rSet)
+{
+    // Transparent fill options are None, Solid, Linear, Axial, Radial, 
Elliptical, Quadratic, Square.
+    // But this is represented across two items namely XFillTransparenceItem 
(for None and Solid)
+    // and XFillFloatTransparenceItem (for the rest). To simplify the 
representation in LOKit case let's
+    // use XFillFloatTransparenceItem to carry the information of 
XFillTransparenceItem when gradients
+    // are disabled. When gradient transparency is disabled, all fields of 
XFillFloatTransparenceItem are invalid
+    // and not used. So convert XFillTransparenceItem's constant transparency 
percentage as an intensity
+    // and assign this to the XFillFloatTransparenceItem's start-intensity and 
end-intensity fields.
+    // Now the LOK clients need only listen to statechange messages of 
XFillFloatTransparenceItem
+    // to get fill-transparency settings instead of listening to two separate 
items.
+
+    XFillFloatTransparenceItem* pFillFloatTranspItem =
+        const_cast<XFillFloatTransparenceItem*>
+        
(rSet.GetItem<XFillFloatTransparenceItem>(XATTR_FILLFLOATTRANSPARENCE));
+    if (!pFillFloatTranspItem || pFillFloatTranspItem->IsEnabled())
+        return;
+
+    const XFillTransparenceItem* pFillTranspItem =
+        rSet.GetItem<XFillTransparenceItem>(XATTR_FILLTRANSPARENCE);
+
+    if (!pFillTranspItem)
+        return;
+
+    XGradient aTmpGradient = pFillFloatTranspItem->GetGradientValue();
+    sal_uInt16 nTranspPercent = pFillTranspItem->GetValue();
+    // Encode transparancy percentage as intensity
+    sal_uInt16 nIntensity = 100 - std::min<sal_uInt16>
+        (std::max<sal_uInt16>(nTranspPercent, 0), 100);
+    aTmpGradient.SetStartIntens(nIntensity);
+    aTmpGradient.SetEndIntens(nIntensity);
+    pFillFloatTranspItem->SetGradientValue(aTmpGradient);
+}
+
 void SwDrawShell::GetDrawAttrState(SfxItemSet& rSet)
 {
     SdrView* pSdrView = GetShell().GetDrawView();
@@ -333,7 +369,11 @@ void SwDrawShell::GetDrawAttrState(SfxItemSet& rSet)
         bool bDisable = Disable( rSet );
 
         if( !bDisable )
+        {
             pSdrView->GetAttributes( rSet );
+            if (comphelper::LibreOfficeKit::isActive())
+                lcl_unifyFillTransparencyItems(rSet);
+        }
     }
     else
         rSet.Put(pSdrView->GetDefaultAttr());
commit 5b9ffb24f2dd195b04bc80220c5f70d509e81390
Author:     Dennis Francis <dennis.fran...@collabora.com>
AuthorDate: Fri Feb 21 17:02:32 2020 +0530
Commit:     Dennis Francis <dennisfrancis...@gmail.com>
CommitDate: Tue May 26 23:17:25 2020 +0530

    Remove unused lokit-only selection properties in..
    
    CID string for charts. This is messing up the parsing of
    CID string in ObjectIdentifier::getObjectType() and elsewhere
    where parsing CID is attempted, which inturn causes at least
    the sidebar's chart line properties listboxes not getting
    updated.
    
    The selection properties insertion in chart CID was introduced in commit
    
    3d705b98ca7f40a44f632f5565407274322ffde3
    
    but these are not even used in online as of present.
    
    Change-Id: Ic8040d84e1ad16f182fc7bdc3a9f533ad9664458
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89300
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>
    (cherry picked from commit eea0bc558fc1ac8d5c1537df2cf95f73720f3620)
    
    Conflicts:
            chart2/source/controller/main/ChartController_Window.cxx

diff --git a/chart2/source/controller/main/ChartController_Window.cxx 
b/chart2/source/controller/main/ChartController_Window.cxx
index 46de790c4f68..396b5ab69a88 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -1691,17 +1691,6 @@ uno::Any SAL_CALL ChartController::getSelection()
         OUString aCID( m_aSelection.getSelectedCID() );
         if ( !aCID.isEmpty() )
         {
-            if ( comphelper::LibreOfficeKit::isActive() )
-            {
-                sal_Int32 nPos = aCID.lastIndexOf('/');
-                OUString sFirst = aCID.copy(0, nPos);
-                OUString sSecond = aCID.copy(nPos);
-                aCID = sFirst +
-                    "/Draggable=" + 
OUString::number(static_cast<int>(isSelectedObjectDraggable())) +
-                    ":Resizable=" + 
OUString::number(static_cast<int>(isSelectedObjectResizable())) +
-                    ":Rotatable=" + 
OUString::number(static_cast<int>(isSelectedObjectRotatable())) +
-                    sSecond;
-            }
             aReturn <<= aCID;
         }
         else
commit b8feba385fda1d079f9b24a835172caeff23e4d2
Author:     Dennis Francis <dennis.fran...@collabora.com>
AuthorDate: Thu Feb 6 12:23:21 2020 +0530
Commit:     Dennis Francis <dennisfrancis...@gmail.com>
CommitDate: Tue May 26 23:17:25 2020 +0530

    Allow boolean valued statechange messages for...
    
    object align commands :
    
    ObjectAlignLeft [SID_OBJECT_ALIGN_LEFT]
    ObjectAlignRight [SID_OBJECT_ALIGN_RIGHT]
    AlignCenter [SID_OBJECT_ALIGN_CENTER]
    
    What is pending is to set correct align state items for Impress in
    DrawViewShell::GetMenuStateSel(). For doing that we need to store
    the object align state somewhere when we execute SID_OBJECT_ALIGN_*
    in DrawViewShell::FuTemporary().
    
    For Writer the align state information was already available in
    frame-format-manager object.
    
    Conflicts:
            desktop/source/lib/init.cxx
    
    Change-Id: I86fcf59cfc66af98097611277201ecaa3b8c22cd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88077
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Jan Holesovsky <ke...@collabora.com>
    (cherry picked from commit 00e1597c9a8a3451ae4d67ac0d1257c5ccac6a16)

diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index d2fbe28b6222..26581dabbd35 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -1008,7 +1008,10 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 
nSID, SfxViewFrame* pViewFra
         aEvent.FeatureURL.Path == "AlignLeft" ||
         aEvent.FeatureURL.Path == "AlignHorizontalCenter" ||
         aEvent.FeatureURL.Path == "AlignRight" ||
-        aEvent.FeatureURL.Path == "DocumentRepair")
+        aEvent.FeatureURL.Path == "DocumentRepair" ||
+        aEvent.FeatureURL.Path == "ObjectAlignLeft" ||
+        aEvent.FeatureURL.Path == "ObjectAlignRight" ||
+        aEvent.FeatureURL.Path == "AlignCenter")
     {
         bool bTemp = false;
         aEvent.State >>= bTemp;
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index b5775d98e3d4..4337583126b3 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -106,10 +106,10 @@ SfxBoolItem Polygon SID_DRAW_POLYGON
     GroupId = SfxGroupId::Drawing;
 ]
 
-SfxVoidItem AlignCenter SID_OBJECT_ALIGN_CENTER
+SfxBoolItem AlignCenter SID_OBJECT_ALIGN_CENTER
 ()
 [
-    AutoUpdate = FALSE,
+    AutoUpdate = TRUE,
     FastCall = FALSE,
     ReadOnlyDoc = FALSE,
     Toggle = FALSE,
@@ -142,10 +142,10 @@ SfxVoidItem AlignDown SID_OBJECT_ALIGN_DOWN
 ]
 
 
-SfxVoidItem ObjectAlignLeft SID_OBJECT_ALIGN_LEFT
+SfxBoolItem ObjectAlignLeft SID_OBJECT_ALIGN_LEFT
 ()
 [
-    AutoUpdate = FALSE,
+    AutoUpdate = TRUE,
     FastCall = FALSE,
     ReadOnlyDoc = FALSE,
     Toggle = FALSE,
@@ -197,10 +197,10 @@ SfxVoidItem AlignMiddle SID_OBJECT_ALIGN_MIDDLE
 ]
 
 
-SfxVoidItem ObjectAlignRight SID_OBJECT_ALIGN_RIGHT
+SfxBoolItem ObjectAlignRight SID_OBJECT_ALIGN_RIGHT
 ()
 [
-    AutoUpdate = FALSE,
+    AutoUpdate = TRUE,
     FastCall = FALSE,
     ReadOnlyDoc = FALSE,
     Toggle = FALSE,
diff --git a/sw/source/uibase/shells/frmsh.cxx 
b/sw/source/uibase/shells/frmsh.cxx
index 32036351a5ee..f1bc72a7c47e 100644
--- a/sw/source/uibase/shells/frmsh.cxx
+++ b/sw/source/uibase/shells/frmsh.cxx
@@ -809,7 +809,30 @@ void SwFrameShell::GetState(SfxItemSet& rSet)
                          bProtect ||
                          ((nWhich == FN_FRAME_ALIGN_HORZ_CENTER  || nWhich == 
SID_OBJECT_ALIGN_CENTER) &&
                           bHtmlMode ))
+                    {
                         rSet.DisableItem( nWhich );
+                    }
+                    else
+                    {
+                        sal_Int16 nHoriOrient = -1;
+                        switch(nWhich)
+                        {
+                            case SID_OBJECT_ALIGN_LEFT:
+                                nHoriOrient = text::HoriOrientation::LEFT;
+                                break;
+                            case SID_OBJECT_ALIGN_CENTER:
+                                nHoriOrient = text::HoriOrientation::CENTER;
+                                break;
+                            case SID_OBJECT_ALIGN_RIGHT:
+                                nHoriOrient = text::HoriOrientation::RIGHT;
+                                break;
+                            default:
+                                break;
+                        }
+                        SwFormatHoriOrient aHOrient(aMgr.GetHoriOrient());
+                        if (nHoriOrient != -1)
+                            rSet.Put(SfxBoolItem(nWhich, nHoriOrient == 
aHOrient.GetHoriOrient()));
+                    }
                 break;
                 case FN_FRAME_ALIGN_VERT_ROW_TOP:
                 case FN_FRAME_ALIGN_VERT_ROW_CENTER:
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to