sc/source/ui/view/output2.cxx |   13 ++++++++++---
 sd/source/ui/dlg/navigatr.cxx |   42 ++++++++++++++++++------------------------
 sd/source/ui/dlg/sdtreelb.cxx |    7 +------
 sd/source/ui/inc/sdtreelb.hxx |    1 -
 4 files changed, 29 insertions(+), 34 deletions(-)

New commits:
commit 7db586c233e1b773ed6a77be54cc4a157ea5e334
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Tue Sep 24 14:29:16 2024 +0100
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Wed Sep 25 07:13:59 2024 +0200

    prefer the per-ViewShell rendering data for default document bg color
    
    Change-Id: Ie67d6317641d63524c20a3001179ad958ebce300
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173866
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Pranam Lashkari <lpra...@collabora.com>

diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 877675c0ac48..859eae2800dc 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -74,6 +74,7 @@
 #include <stlsheet.hxx>
 #include <spellcheckcontext.hxx>
 #include <scopetools.hxx>
+#include <tabvwsh.hxx>
 
 #include <com/sun/star/i18n/DirectionProperty.hpp>
 #include <comphelper/scopeguard.hxx>
@@ -2484,6 +2485,13 @@ bool ScOutputData::DrawEditParam::readCellContent(
     return true;
 }
 
+static Color GetConfBackgroundColor()
+{
+    if (const ScTabViewShell* pTabViewShellBg = 
ScTabViewShell::GetActiveViewShell())
+        return pTabViewShellBg->GetViewRenderingData().GetDocColor();
+    return SC_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor;
+}
+
 void ScOutputData::DrawEditParam::setPatternToEngine(bool bUseStyleColor)
 {
     // syntax highlighting mode is ignored here
@@ -2492,7 +2500,7 @@ void ScOutputData::DrawEditParam::setPatternToEngine(bool 
bUseStyleColor)
     if (SfxPoolItem::areSame(mpPattern, mpOldPattern) && mpCondSet == 
mpOldCondSet && mpPreviewFontSet == mpOldPreviewFontSet )
         return;
 
-    Color nConfBackColor = 
SC_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor;
+    Color nConfBackColor = GetConfBackgroundColor();
     bool bCellContrast = bUseStyleColor &&
             
Application::GetSettings().GetStyleSettings().GetHighContrastMode();
 
@@ -4581,8 +4589,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
         if (pRowInfo[nRotY].nRotMaxCol != SC_ROTMAX_NONE && 
pRowInfo[nRotY].nRotMaxCol > nRotMax)
             nRotMax = pRowInfo[nRotY].nRotMaxCol;
 
-    ScModule* pScMod = SC_MOD();
-    Color nConfBackColor = 
pScMod->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor;
+    Color nConfBackColor = GetConfBackgroundColor();
     bool bCellContrast = mbUseStyleColor &&
             
Application::GetSettings().GetStyleSettings().GetHighContrastMode();
 
commit 4262eb0cd3bcdedfa53378e641dbb4090a10d4c7
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Mon Sep 23 21:02:20 2024 +0100
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Wed Sep 25 07:13:59 2024 +0200

    Don't change focus from sd navigator if it will be immediately refocused
    
    Instead of grabbing focus away from the treeview, and then grabbing
    focus back to the treeview (which disrupts the vcl treeview's ability to
    enter inline editing mode on 2nd click), just don't change focus at all
    if the focus will end up in the initial location.
    
    git show -w is your friend here
    
    Change-Id: Idb53fa95495f1819cd121079f3f51c39cc629336
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173830
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx
index 8741a2c913b4..88ea5d664108 100644
--- a/sd/source/ui/dlg/navigatr.cxx
+++ b/sd/source/ui/dlg/navigatr.cxx
@@ -415,33 +415,27 @@ IMPL_LINK_NOARG(SdNavigatorWin, ClickObjectHdl, 
weld::TreeView&, bool)
                     pDrawView->MarkObj(pCursorEntryObject, 
pDrawView->GetSdrPageView(), true);
                 }
 
-                // moved here from SetGetFocusHdl. Reset the
-                // focus only if something has been selected in the
-                // document.
-                SfxViewShell* pCurSh = SfxViewShell::Current();
-
-                if ( pCurSh )
+                if (mxTlbObjects->IsNavigationGrabsFocus())
                 {
-                    vcl::Window* pShellWnd = pCurSh->GetWindow();
-                    if ( pShellWnd )
-                        pShellWnd->GrabFocus();
-                }
+                    // moved here from SetGetFocusHdl. Reset the
+                    // focus only if something has been selected in the
+                    // document.
+                    SfxViewShell* pCurSh = SfxViewShell::Current();
 
-                // We navigated to an object, but the current shell may be
-                // still the slide sorter. Explicitly try to grab the draw
-                // shell focus, so follow-up operations work with the object
-                // and not with the whole slide.
-                vcl::Window* pWindow = pViewShell->GetActiveWindow();
-                if (pWindow)
-                    pWindow->GrabFocus();
+                    if ( pCurSh )
+                    {
+                        vcl::Window* pShellWnd = pCurSh->GetWindow();
+                        if ( pShellWnd )
+                            pShellWnd->GrabFocus();
+                    }
 
-                if (!mxTlbObjects->IsNavigationGrabsFocus())
-                {
-                    // This is the case when keyboard navigation inside the
-                    // navigator should continue to work.
-                    if (mxNavigatorDlg)
-                        mxNavigatorDlg->GrabFocus();
-                    mxTlbObjects->grab_focus();
+                    // We navigated to an object, but the current shell may be
+                    // still the slide sorter. Explicitly try to grab the draw
+                    // shell focus, so follow-up operations work with the 
object
+                    // and not with the whole slide.
+                    vcl::Window* pWindow = pViewShell->GetActiveWindow();
+                    if (pWindow)
+                        pWindow->GrabFocus();
                 }
             }
         }
diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index ecf2e612051a..abfacd81baea 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -301,7 +301,6 @@ IMPL_LINK(SdPageObjsTLV, CommandHdl, const CommandEvent&, 
rCEvt, bool)
 
     if (rCEvt.GetCommand() == CommandEventId::ContextMenu)
     {
-        m_bMouseReleased = false;
         m_xTreeView->grab_focus();
 
         // select clicked entry
@@ -316,7 +315,6 @@ IMPL_LINK(SdPageObjsTLV, CommandHdl, const CommandEvent&, 
rCEvt, bool)
         }
 
         bool bRet = m_aPopupMenuHdl.Call(rCEvt);
-        m_bMouseReleased = true;
         return bRet;
     }
 
@@ -357,7 +355,6 @@ IMPL_LINK(SdPageObjsTLV, KeyInputHdl, const KeyEvent&, 
rKEvt, bool)
 
 IMPL_LINK(SdPageObjsTLV, MousePressHdl, const MouseEvent&, rMEvt, bool)
 {
-    m_bMouseReleased = false;
     m_bEditing = false;
     m_bSelectionHandlerNavigates = rMEvt.GetClicks() == 1;
     m_bNavigationGrabsFocus = rMEvt.GetClicks() != 1;
@@ -366,7 +363,6 @@ IMPL_LINK(SdPageObjsTLV, MousePressHdl, const MouseEvent&, 
rMEvt, bool)
 
 IMPL_LINK_NOARG(SdPageObjsTLV, MouseReleaseHdl, const MouseEvent&, bool)
 {
-    m_bMouseReleased = true;
     if (m_aMouseReleaseHdl.IsSet() && m_aMouseReleaseHdl.Call(MouseEvent()))
         return false;
 
@@ -845,8 +841,7 @@ void SdPageObjsTLV::Select()
 {
     m_nSelectEventId = nullptr;
 
-    // m_bMouseReleased is a hack to make inplace editing work for X11
-    if (m_bMouseReleased)
+    if (IsEditingActive())
         return;
 
     m_bLinkableSelected = true;
diff --git a/sd/source/ui/inc/sdtreelb.hxx b/sd/source/ui/inc/sdtreelb.hxx
index 1f6026b557d4..ffeda2afb356 100644
--- a/sd/source/ui/inc/sdtreelb.hxx
+++ b/sd/source/ui/inc/sdtreelb.hxx
@@ -102,7 +102,6 @@ private:
      */
     bool m_bNavigationGrabsFocus;
 
-    bool m_bMouseReleased = true; // hack for x11 inplace editing
     bool m_bEditing = false;
 
     SelectionMode m_eSelectionMode;

Reply via email to