[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - 9 commits - i18npool/inc i18npool/source sc/qa sc/source sc/uiconfig sd/source sw/inc sw/source

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 19 13:20:28 UTC 2020


 i18npool/inc/calendarImpl.hxx                           |    2 
 i18npool/source/calendar/calendarImpl.cxx               |    7 ++
 sc/qa/unit/data/xls/pass/ofz20904-1.xls                 |binary
 sc/source/core/data/dociter.cxx                         |   11 ++-
 sc/source/ui/app/transobj.cxx                           |    2 
 sc/source/ui/dialogs/searchresults.cxx                  |   31 ++++++++++
 sc/source/ui/inc/searchresults.hxx                      |    2 
 sc/uiconfig/scalc/ui/searchresults.ui                   |    3 
 sd/source/ui/dlg/dlgsnap.cxx                            |    6 +
 sw/inc/undobj.hxx                                       |    3 
 sw/source/core/crsr/crsrsh.cxx                          |    6 +
 sw/source/core/doc/DocumentContentOperationsManager.cxx |    5 +
 sw/source/core/doc/DocumentRedlineManager.cxx           |   22 +++++++
 sw/source/core/edit/eddel.cxx                           |    7 +-
 sw/source/core/edit/edglss.cxx                          |    7 +-
 sw/source/core/inc/UndoDelete.hxx                       |    3 
 sw/source/core/undo/undel.cxx                           |   49 ++++++++--------
 sw/source/core/undo/undobj.cxx                          |   33 ++++++++++
 18 files changed, 162 insertions(+), 37 deletions(-)

New commits:
commit fdff2aa16b8e4790c2732307973f23bace9f79bc
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Wed Jun 17 17:40:48 2020 +0200
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Jun 19 10:27:50 2020 +0100

    tdf#133982 sw: fix Copy of document that starts with nested table
    
    Started to assert with ef8427d12a63127a2eb867637699343d630545dd
    because a bookmark was created on the wrong node but this never worked.
    
    Change-Id: Ife01a3c8041b4c7d08b2d749dde77ced388f7215
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96556
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>
    (cherry picked from commit 4de190d55900387bc07971bac84f7cd52e329146)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96578
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx
index 99e242ba61de..ed46482bf933 100644
--- a/sw/source/core/edit/edglss.cxx
+++ b/sw/source/core/edit/edglss.cxx
@@ -232,7 +232,12 @@ bool SwEditShell::CopySelToDoc( SwDoc* pInsDoc )
                         // Selection starts at the first para of the first cell,
                         // but we want to copy the table and the start node before
                         // the first cell as well.
-                        aPaM.Start()->nNode = aPaM.Start()->nNode.GetNode().FindTableNode()->GetIndex();
+                        // tdf#133982 tables can be nested
+                        while (SwTableNode const* pTableNode =
+                            aPaM.Start()->nNode.GetNode().StartOfSectionNode()->FindTableNode())
+                        {
+                            aPaM.Start()->nNode = *pTableNode;
+                        }
                         aPaM.Start()->nContent.Assign(nullptr, 0);
                     }
                     bRet = GetDoc()->getIDocumentContentOperations().CopyRange( aPaM, aPos, /*bCopyAll=*/false, /*bCheckPos=*/true, /*bCopyText=*/false ) || bRet;
commit 8e2b94ff8022bf2bb52a4d7f9d42da7bd7160680
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Feb 27 09:17:11 2020 +0000
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Jun 19 10:27:46 2020 +0100

    tdf#134019: ofz#20904 check bounds
    
    Change-Id: I5d6d381ebd359b233b309e08131f3dda21310d80
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89620
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit 8e3a29110c8ad739bedeea90932663608d8d3935)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96573
    Tested-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/qa/unit/data/xls/pass/ofz20904-1.xls b/sc/qa/unit/data/xls/pass/ofz20904-1.xls
new file mode 100644
index 000000000000..44dbe8f6e222
Binary files /dev/null and b/sc/qa/unit/data/xls/pass/ofz20904-1.xls differ
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index f501bb8da0d0..5331e8ac33ae 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -892,14 +892,17 @@ void ScCellIterator::init()
     if (maStartPos.Tab() > maEndPos.Tab())
         maStartPos.SetTab(maEndPos.Tab());
 
-    maCurPos = maStartPos;
-
-    if (!mpDoc->maTabs[maCurPos.Tab()])
+    if (!mpDoc->maTabs[maStartPos.Tab()])
     {
         OSL_FAIL("Table not found");
         maStartPos = ScAddress(mpDoc->MaxCol()+1, mpDoc->MaxRow()+1, MAXTAB+1); // -> Abort on GetFirst.
-        maCurPos = maStartPos;
     }
+    else
+    {
+        maStartPos.SetCol(mpDoc->maTabs[maStartPos.Tab()]->ClampToAllocatedColumns(maStartPos.Col()));
+    }
+
+    maCurPos = maStartPos;
 }
 
 bool ScCellIterator::getCurrent()
commit aa3d6bfaa2a7ddf375c87dc4096de9fab9a67d07
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Jun 12 19:08:19 2020 +0200
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Jun 19 10:27:41 2020 +0100

    tdf#132944 sw_redlinehide: delete of insert redline
    
    Because of an existing insert redline with SwComparePosition::Equal
    this hits the DeleteAndJoin() call in AppendRedline() and so what
    happens on Undo is that the SwUndoDelete first creates all the layout
    frames and then the SwUndoRedlineDelete creates the frames a 2nd time.
    
    Because this can happen not only for Equal but also Inside case, it
    appears best to prevent the "inner" Undo from recreating the frames;
    it's always SwUndoDelete.
    
    This is quite hacky...
    
    Change-Id: I4438dd09bb6c2edf8154d333de403483768755fd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96233
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>
    (cherry picked from commit ad0351b84926075297fb74abbe9b31a0455782af)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96517
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index fb6a54d5cec2..d23a69717f66 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -25,6 +25,8 @@
 #include <fmtfld.hxx>
 #include <frmtool.hxx>
 #include <IDocumentUndoRedo.hxx>
+#include <UndoManager.hxx>
+#include <UndoDelete.hxx>
 #include <IDocumentFieldsAccess.hxx>
 #include <IDocumentLayoutAccess.hxx>
 #include <IDocumentState.hxx>
@@ -887,6 +889,21 @@ namespace
             static_cast<SwPaM&>(m_rRedline) = *m_pCursor;
         }
     };
+
+    auto UndoDeleteDisableFrames(SwDoc & rDoc) -> void
+    {
+        // inside AppendRedline(), a SwUndoDelete was created;
+        // prevent it from creating duplicate layout frames on Undo
+        auto & rUndo(rDoc.GetUndoManager());
+        if (rUndo.DoesUndo())
+        {
+            SwUndo *const pUndo(rUndo.GetLastUndo());
+            assert(pUndo);
+            SwUndoDelete *const pUndoDel(dynamic_cast<SwUndoDelete*>(pUndo));
+            assert(pUndoDel);
+            pUndoDel->DisableMakeFrames(); // tdf#132944
+        }
+    }
 }
 
 namespace sw
@@ -1556,12 +1573,14 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall
                                 }
                                 else
                                     m_rDoc.getIDocumentContentOperations().DeleteAndJoin( *pNewRedl );
+                                UndoDeleteDisableFrames(m_rDoc); // tdf#132944
 
                                 bCompress = true;
                             }
                             if( !bCallDelete && !bDec && *pEnd == *pREnd )
                             {
                                 m_rDoc.getIDocumentContentOperations().DeleteAndJoin( *pNewRedl );
+                                UndoDeleteDisableFrames(m_rDoc);
                                 bCompress = true;
                             }
                             else if ( bCallDelete || !bDec )
@@ -1581,6 +1600,7 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall
                                 {
                                     TemporaryRedlineUpdater const u(m_rDoc, *pNewRedl);
                                     m_rDoc.getIDocumentContentOperations().DeleteAndJoin( *pRedl );
+                                    UndoDeleteDisableFrames(m_rDoc);
                                     n = 0;      // re-initialize
                                 }
                                 delete pRedl;
@@ -1605,6 +1625,7 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall
                                 {
                                     TemporaryRedlineUpdater const u(m_rDoc, *pNewRedl);
                                     m_rDoc.getIDocumentContentOperations().DeleteAndJoin( aPam );
+                                    UndoDeleteDisableFrames(m_rDoc);
                                     n = 0;      // re-initialize
                                 }
                                 bDec = true;
@@ -1627,6 +1648,7 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall
                                 {
                                     TemporaryRedlineUpdater const u(m_rDoc, *pNewRedl);
                                     m_rDoc.getIDocumentContentOperations().DeleteAndJoin( aPam );
+                                    UndoDeleteDisableFrames(m_rDoc);
                                     n = 0;      // re-initialize
                                     bDec = true;
                                 }
diff --git a/sw/source/core/inc/UndoDelete.hxx b/sw/source/core/inc/UndoDelete.hxx
index b9b52583971e..a0ff970661f0 100644
--- a/sw/source/core/inc/UndoDelete.hxx
+++ b/sw/source/core/inc/UndoDelete.hxx
@@ -59,6 +59,7 @@ class SwUndoDelete
     bool m_bResetPgDesc : 1;   // TRUE: reset PgDsc on following node
     bool m_bResetPgBrk : 1;    // TRUE: reset PgBreak on following node
     bool const m_bFromTableCopy : 1; // TRUE: called by SwUndoTableCpyTable
+    bool m_bDisableMakeFrames : 1;
 
     bool SaveContent( const SwPosition* pStt, const SwPosition* pEnd,
                     SwTextNode* pSttTextNd, SwTextNode* pEndTextNd );
@@ -98,6 +99,8 @@ public:
 
     // SwUndoTableCpyTable needs this information:
     bool IsDelFullPara() const { return m_bDelFullPara; }
+
+    void DisableMakeFrames() { m_bDisableMakeFrames = true; };
 };
 
 #endif // INCLUDED_SW_SOURCE_CORE_INC_UNDODELETE_HXX
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index 30298fe1e761..0510ea64dc37 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -190,6 +190,7 @@ SwUndoDelete::SwUndoDelete(
     m_bResetPgDesc( false ),
     m_bResetPgBrk( false ),
     m_bFromTableCopy( bCalledByTableCpy )
+    , m_bDisableMakeFrames(false)
 {
 
     m_bCacheComment = false;
@@ -1051,7 +1052,26 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext)
         SetSaveData(rDoc, *m_pRedlSaveData);
 
     sal_uLong delFullParaEndNode(m_nEndNode);
-    if (m_bDelFullPara && m_pRedlSaveData)
+    if (m_bDisableMakeFrames) // tdf#132944
+    {
+        assert(!m_bDelFullPara);
+        SwTextNode *const pEndNode(aIdx.GetNodes()[m_nEndNode]->GetTextNode());
+        SwIterator<SwTextFrame, SwTextNode, sw::IteratorMode::UnwrapMulti> aIter(*pEndNode);
+        for (SwTextFrame* pFrame = aIter.First(); pFrame; pFrame = aIter.Next())
+        {
+            o3tl::sorted_vector<SwRootFrame *> layouts;
+            if (pFrame->getRootFrame()->IsHideRedlines())
+            {
+                assert(pFrame->GetTextNodeFirst() == pEndNode); // can't be merged with previous
+                layouts.insert(pFrame->getRootFrame());
+            }
+            for (SwRootFrame const*const pLayout : layouts)
+            {
+                pEndNode->DelFrames(pLayout); // SwUndoRedlineDelete will create it
+            }
+        }
+    }
+    else if (m_bDelFullPara && m_pRedlSaveData)
     {
         SwTextNode * pFirstMergedDeletedTextNode(nullptr);
         SwTextNode *const pNextNode = FindFirstAndNextNode(rDoc, *this,
@@ -1098,7 +1118,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext)
     }
 
     // create frames after SetSaveData has recreated redlines
-    if (0 != m_nNode)
+    if (0 != m_nNode && !m_bDisableMakeFrames)
     {
         // tdf#121031 if the start node is a text node, it already has a frame;
         // if it's a table, it does not
@@ -1114,7 +1134,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext)
         ::MakeFrames(&rDoc, start, end);
     }
 
-    if (pMovedNode)
+    if (pMovedNode && !m_bDisableMakeFrames)
     {   // probably better do this after creating all frames
         lcl_MakeAutoFrames(*rDoc.GetSpzFrameFormats(), pMovedNode->GetIndex());
     }
commit 23eb8ac67b7d6aafe5ae07233133f033116b90ed
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Jun 15 14:04:12 2020 +0200
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Jun 19 10:27:09 2020 +0100

    tdf#132321 tdf#133957 sw: for at-para fly, ignore anchor SwIndex
    
    ... because it's always 0, and not registered at the node; this fixes
    the case when it's anchored at a non-empty last node of a section.
    
    (follow-up to a0d0665060b75c1e7f0234b698c940d2f9d600f8)
    
    Change-Id: I627e11e84a2dcfc2944d3c9f3fd22e3c3785e505
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96350
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>
    (cherry picked from commit b314735568c1e9ab8ca52413017425bc2ef12973)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96341
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index 4974f25a467f..c46c93bbcec0 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -1519,7 +1519,9 @@ static bool IsAtEndOfSection(SwPosition const& rAnchorPos)
     SwContentNode *const pNode(SwNodes::GoPrevious(&node));
     assert(pNode);
     assert(rAnchorPos.nNode <= node); // last valid anchor pos is last content
-    return node == rAnchorPos.nNode && rAnchorPos.nContent == pNode->Len();
+    return node == rAnchorPos.nNode
+        // at-para fly has no SwIndex!
+        && (rAnchorPos.nContent == pNode->Len() || rAnchorPos.nContent.GetIdxReg() == nullptr);
 }
 
 static bool IsAtStartOfSection(SwPosition const& rAnchorPos)
commit dd2bb90a90f1d82ad5ac238348be0a88244e0997
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Jun 16 17:10:19 2020 +0200
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Jun 19 10:27:03 2020 +0100

    tdf#132093: Take aUIScale into account again
    
    ...which had inadvertently gone missing with
    bbab991c70e2a1867493d701168f49a0d0dcbd48 "Avoid
    -fsanitize=implicit-signed-integer-truncation in weld::MetricSpinButton"
    
    Change-Id: Idaccb7d1d088f1a3183f19deb3d8ca413d8b1440
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96470
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    (cherry picked from commit 5e3ac497193794b4db22d23c8efa9065786d1b9f)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96490
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/sd/source/ui/dlg/dlgsnap.cxx b/sd/source/ui/dlg/dlgsnap.cxx
index c07fa83552e4..b5e54a878e64 100644
--- a/sd/source/ui/dlg/dlgsnap.cxx
+++ b/sd/source/ui/dlg/dlgsnap.cxx
@@ -81,9 +81,11 @@ SdSnapLineDlg::SdSnapLineDlg(weld::Window* pWindow, const SfxItemSet& rInAttrs,
             auto const n4 = msb->convert_value_to(n3, FieldUnit::NONE);
             return n4;
         };
-    m_xMtrFldX->set_range(map(m_xMtrFldX, aLeftTop.X()), map(m_xMtrFldX, aRightBottom.X()),
+    m_xMtrFldX->set_range(map(m_xMtrFldX, sal_Int32(aLeftTop.X() / aUIScale)),
+                          map(m_xMtrFldX, sal_Int32(aRightBottom.X() / aUIScale)),
                           FieldUnit::NONE);
-    m_xMtrFldY->set_range(map(m_xMtrFldY, aLeftTop.Y()), map(m_xMtrFldY, aRightBottom.Y()),
+    m_xMtrFldY->set_range(map(m_xMtrFldY, sal_Int32(aLeftTop.Y() / aUIScale)),
+                          map(m_xMtrFldY, sal_Int32(aRightBottom.Y() / aUIScale)),
                           FieldUnit::NONE);
 
     // set values
commit ede0c12946836f4b602cb1dd4388379343f18c7e
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jun 9 09:27:56 2020 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Jun 19 10:26:57 2020 +0100

    Resolves: tdf#133780 allow sorting search result treeview columns
    
    Change-Id: I7d5b1ffdaf99fd2e28dfd124db0fbbd4036e2dd6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95878
    Tested-by: Jenkins
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/ui/dialogs/searchresults.cxx b/sc/source/ui/dialogs/searchresults.cxx
index 8b896b466ab6..3604e1599a16 100644
--- a/sc/source/ui/dialogs/searchresults.cxx
+++ b/sc/source/ui/dialogs/searchresults.cxx
@@ -24,6 +24,7 @@ SearchResultsDlg::SearchResultsDlg(SfxBindings* _pBindings, weld::Window* pParen
     , aSkipped(ScResId(SCSTR_SKIPPED))
     , mpBindings(_pBindings)
     , mpDoc(nullptr)
+    , mbSorted(false)
     , mxList(m_xBuilder->weld_tree_view("results"))
     , mxSearchResults(m_xBuilder->weld_label("lbSearchResults"))
     , mxShowDialog(m_xBuilder->weld_check_button("cbShow"))
@@ -35,6 +36,7 @@ SearchResultsDlg::SearchResultsDlg(SfxBindings* _pBindings, weld::Window* pParen
     aWidths.push_back(mxList->get_approximate_digit_width() * 10);
     mxList->set_column_fixed_widths(aWidths);
     mxList->connect_changed(LINK(this, SearchResultsDlg, ListSelectHdl));
+    mxList->connect_column_clicked(LINK(this, SearchResultsDlg, HeaderBarClick));
 }
 
 SearchResultsDlg::~SearchResultsDlg()
@@ -161,6 +163,35 @@ void SearchResultsDlg::Close()
     SfxDialogController::Close();
 }
 
+IMPL_LINK(SearchResultsDlg, HeaderBarClick, int, nColumn, void)
+{
+    if (!mbSorted)
+    {
+        mxList->make_sorted();
+        mbSorted = true;
+    }
+
+    bool bSortAtoZ = mxList->get_sort_order();
+
+    //set new arrow positions in headerbar
+    if (nColumn == mxList->get_sort_column())
+    {
+        bSortAtoZ = !bSortAtoZ;
+        mxList->set_sort_order(bSortAtoZ);
+    }
+    else
+    {
+        mxList->set_sort_indicator(TRISTATE_INDET, mxList->get_sort_column());
+        mxList->set_sort_column(nColumn);
+    }
+
+    if (nColumn != -1)
+    {
+        //sort lists
+        mxList->set_sort_indicator(bSortAtoZ ? TRISTATE_TRUE : TRISTATE_FALSE, nColumn);
+    }
+}
+
 IMPL_LINK_NOARG( SearchResultsDlg, ListSelectHdl, weld::TreeView&, void )
 {
     if (!mpDoc)
diff --git a/sc/source/ui/inc/searchresults.hxx b/sc/source/ui/inc/searchresults.hxx
index 137b999d967c..a0ca894141d9 100644
--- a/sc/source/ui/inc/searchresults.hxx
+++ b/sc/source/ui/inc/searchresults.hxx
@@ -24,11 +24,13 @@ class SearchResultsDlg : public SfxDialogController
     OUString const aSkipped;
     SfxBindings* const mpBindings;
     ScDocument* mpDoc;
+    bool mbSorted;
     std::unique_ptr<weld::TreeView> mxList;
     std::unique_ptr<weld::Label> mxSearchResults;
     std::unique_ptr<weld::CheckButton> mxShowDialog;
 
     DECL_LINK(ListSelectHdl, weld::TreeView&, void);
+    DECL_LINK(HeaderBarClick, int, void);
     DECL_STATIC_LINK(SearchResultsDlg, OnShowToggled, weld::ToggleButton&, void);
 public:
     SearchResultsDlg(SfxBindings* _pBindings, weld::Window* pParent);
diff --git a/sc/uiconfig/scalc/ui/searchresults.ui b/sc/uiconfig/scalc/ui/searchresults.ui
index cb8fbaf44e7e..ca56a9950a7f 100644
--- a/sc/uiconfig/scalc/ui/searchresults.ui
+++ b/sc/uiconfig/scalc/ui/searchresults.ui
@@ -100,6 +100,7 @@
                     <property name="resizable">True</property>
                     <property name="spacing">6</property>
                     <property name="title" translatable="yes" context="searchresults|sheet">Sheet</property>
+                    <property name="clickable">True</property>
                     <child>
                       <object class="GtkCellRendererText" id="cellrenderer1"/>
                       <attributes>
@@ -113,6 +114,7 @@
                     <property name="resizable">True</property>
                     <property name="spacing">6</property>
                     <property name="title" translatable="yes" context="searchresults|cell">Cell</property>
+                    <property name="clickable">True</property>
                     <child>
                       <object class="GtkCellRendererText" id="cellrenderer2"/>
                       <attributes>
@@ -126,6 +128,7 @@
                     <property name="resizable">True</property>
                     <property name="spacing">6</property>
                     <property name="title" translatable="yes" context="searchresults|content">Content</property>
+                    <property name="clickable">True</property>
                     <child>
                       <object class="GtkCellRendererText" id="cellrenderer3"/>
                       <attributes>
commit 149c4195dca1b8e3b5358f94b11229cee96f9d26
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Thu Jun 11 19:04:18 2020 +0200
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Jun 19 10:26:53 2020 +0100

    tdf#133898: get a context in default ctr (i18npool/calendarImpl)
    
    See bt here:
    https://bugs.documentfoundation.org/attachment.cgi?id=161882
    
    Change-Id: If5a6c5e2b52af9ef97af9522296aaa58352cfa69
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96161
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
    (cherry picked from commit 56e2183b4916888fa104b62411151401932d8f92)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96179
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
    (cherry picked from commit 0634b66805f0f4bc3f45a44b1f6a984f17ff8a09)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96421

diff --git a/i18npool/inc/calendarImpl.hxx b/i18npool/inc/calendarImpl.hxx
index 299bfe79bae2..927bf42935aa 100644
--- a/i18npool/inc/calendarImpl.hxx
+++ b/i18npool/inc/calendarImpl.hxx
@@ -40,7 +40,7 @@ class CalendarImpl : public cppu::WeakImplHelper
 public:
 
     // Constructors
-    CalendarImpl() {};
+    CalendarImpl();
     CalendarImpl(const css::uno::Reference < css::uno::XComponentContext >& rxContext);
 
     /**
diff --git a/i18npool/source/calendar/calendarImpl.cxx b/i18npool/source/calendar/calendarImpl.cxx
index 2cb659560489..8a288bcb6c31 100644
--- a/i18npool/source/calendar/calendarImpl.cxx
+++ b/i18npool/source/calendar/calendarImpl.cxx
@@ -20,6 +20,7 @@
 #include <calendarImpl.hxx>
 #include <calendar_gregorian.hxx>
 #include <localedata.hxx>
+#include <comphelper/processfactory.hxx>
 #include <comphelper/sequence.hxx>
 #include <cppuhelper/supportsservice.hxx>
 
@@ -32,8 +33,14 @@ namespace i18npool {
 
 #define ERROR RuntimeException()
 
+CalendarImpl::CalendarImpl() : m_xContext(comphelper::getProcessComponentContext())
+{
+}
+
 CalendarImpl::CalendarImpl(const Reference< XComponentContext > &rxContext) : m_xContext(rxContext)
 {
+    if (!m_xContext.is())
+        throw ERROR;
 }
 
 CalendarImpl::~CalendarImpl()
commit 51703be4e72eaaeaa3765f125df127a111895cc5
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Jun 15 13:11:29 2020 +0200
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Jun 19 10:26:49 2020 +0100

    tdf#133957 sw: SelectAll should select fly in empty section
    
    Ctrl+A should select everything in the section; if the section is empty,
    there's no text to select, and then the shell will cancel the selection
    because SwCursorShell::HasSelection() returns false - so check if
    there are flys anchored there, which fixes the Copy.
    
    To fix Delete, a few more checks for empty selection need to be changed.
    
    Change-Id: If54160bdca976ad5f153b89cf8492f4da1e774b7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96324
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>
    (cherry picked from commit 2d89b9929e85bede4c72684a12e7508751875f0e)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96368
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx
index d449de1f8c9f..c76a1dfbec0e 100644
--- a/sw/inc/undobj.hxx
+++ b/sw/inc/undobj.hxx
@@ -152,6 +152,9 @@ bool IsDestroyFrameAnchoredAtChar(SwPosition const & rAnchorPos,
 bool IsSelectFrameAnchoredAtPara(SwPosition const & rAnchorPos,
         SwPosition const & rStart, SwPosition const & rEnd,
         DelContentType const nDelContentType = DelContentType::AllMask);
+/// check at-char and at-para flys in rDoc
+bool IsFlySelectedByCursor(SwDoc const & rDoc,
+        SwPosition const & rStart, SwPosition const & rEnd);
 
 // This class has to be inherited into an Undo-object if it saves content
 // for Redo/Undo...
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index f37345368f39..7e0defb67ca0 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -71,6 +71,7 @@
 #include <vcl/uitest/eventdescription.hxx>
 #include <tabcol.hxx>
 #include <wrtsh.hxx>
+#include <undobj.hxx>
 #include <boost/property_tree/json_parser.hpp>
 
 using namespace com::sun::star;
@@ -2486,7 +2487,10 @@ void SwCursorShell::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
 bool SwCursorShell::HasSelection() const
 {
     const SwPaM* pCursor = getShellCursor( true );
-    return IsTableMode() || ( pCursor->HasMark() && *pCursor->GetPoint() != *pCursor->GetMark() );
+    return IsTableMode()
+        || (pCursor->HasMark() &&
+                (*pCursor->GetPoint() != *pCursor->GetMark()
+                || IsFlySelectedByCursor(*GetDoc(), *pCursor->Start(), *pCursor->End())));
 }
 
 void SwCursorShell::CallChgLnk()
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 403089bdc586..456b1ba60f93 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -4059,8 +4059,11 @@ bool DocumentContentOperationsManager::DeleteRangeImplImpl(SwPaM & rPam)
 {
     SwPosition *pStt = rPam.Start(), *pEnd = rPam.End();
 
-    if( !rPam.HasMark() || *pStt >= *pEnd )
+    if (!rPam.HasMark()
+        || (*pStt == *pEnd && !IsFlySelectedByCursor(m_rDoc, *pStt, *pEnd)))
+    {
         return false;
+    }
 
     if( m_rDoc.GetAutoCorrExceptWord() )
     {
diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx
index 162be4b48fff..2951b56b4cd5 100644
--- a/sw/source/core/edit/eddel.cxx
+++ b/sw/source/core/edit/eddel.cxx
@@ -31,6 +31,7 @@
 #include <edimp.hxx>
 #include <IMark.hxx>
 #include <docary.hxx>
+#include <undobj.hxx>
 #include <SwRewriter.hxx>
 #include <globals.hrc>
 
@@ -41,8 +42,12 @@ void SwEditShell::DeleteSel( SwPaM& rPam, bool* pUndo )
 {
     bool bSelectAll = StartsWithTable() && ExtendedSelectedAll();
     // only for selections
-    if( !rPam.HasMark() || *rPam.GetPoint() == *rPam.GetMark())
+    if (!rPam.HasMark()
+        || (*rPam.GetPoint() == *rPam.GetMark()
+            && !IsFlySelectedByCursor(*GetDoc(), *rPam.Start(), *rPam.End())))
+    {
         return;
+    }
 
     // Is the selection in a table? Then delete only the content of the selected boxes.
     // Here, there are two cases:
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index b12696554e65..30298fe1e761 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -565,28 +565,9 @@ bool SwUndoDelete::CanGrouping( SwDoc* pDoc, const SwPaM& rDelPam )
     // tdf#132725 - if at-char/at-para flys would be deleted, don't group!
     // DelContentIndex() would be called at the wrong time here, the indexes
     // in the stored SwHistoryTextFlyCnt would be wrong when Undo is invoked
-    for (SwFrameFormat const*const pFly : *pDoc->GetSpzFrameFormats())
+    if (IsFlySelectedByCursor(*pDoc, *pStt, *pEnd))
     {
-        SwFormatAnchor const& rAnchor(pFly->GetAnchor());
-        switch (rAnchor.GetAnchorId())
-        {
-            case RndStdIds::FLY_AT_CHAR:
-            case RndStdIds::FLY_AT_PARA:
-            {
-                SwPosition const*const pAnchorPos(rAnchor.GetContentAnchor());
-                // can this really be null?
-                if (pAnchorPos != nullptr
-                    && ((rAnchor.GetAnchorId() == RndStdIds::FLY_AT_CHAR)
-                        ? IsDestroyFrameAnchoredAtChar(*pAnchorPos, *pStt, *pEnd)
-                        : IsSelectFrameAnchoredAtPara(*pAnchorPos, *pStt, *pEnd)))
-                {
-                    return false;
-                }
-            }
-            break;
-            default: // other types not relevant
-            break;
-        }
+        return false;
     }
 
     {
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index 3e4ddb2c01ef..4974f25a467f 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -1638,4 +1638,33 @@ bool IsSelectFrameAnchoredAtPara(SwPosition const & rAnchorPos,
                     || (IsAtEndOfSection(rAnchorPos) && IsAtStartOfSection2(rStart)))));
 }
 
+bool IsFlySelectedByCursor(SwDoc const & rDoc,
+        SwPosition const & rStart, SwPosition const & rEnd)
+{
+    for (SwFrameFormat const*const pFly : *rDoc.GetSpzFrameFormats())
+    {
+        SwFormatAnchor const& rAnchor(pFly->GetAnchor());
+        switch (rAnchor.GetAnchorId())
+        {
+            case RndStdIds::FLY_AT_CHAR:
+            case RndStdIds::FLY_AT_PARA:
+            {
+                SwPosition const*const pAnchorPos(rAnchor.GetContentAnchor());
+                // can this really be null?
+                if (pAnchorPos != nullptr
+                    && ((rAnchor.GetAnchorId() == RndStdIds::FLY_AT_CHAR)
+                        ? IsDestroyFrameAnchoredAtChar(*pAnchorPos, rStart, rEnd)
+                        : IsSelectFrameAnchoredAtPara(*pAnchorPos, rStart, rEnd)))
+                {
+                    return true;
+                }
+            }
+            break;
+            default: // other types not relevant
+            break;
+        }
+    }
+    return false;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 943e072fdfd0f54e6408662caab5837a28e2568d
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Jun 15 14:51:48 2020 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Jun 19 09:54:19 2020 +0100

    rhbz#1847031 null-deref
    
    Change-Id: Ic9327788ebf49ac1ab0d3463f2f1e4d87ef14cb3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96339
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index 88f80d77f272..2730ec0c1f93 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -179,7 +179,7 @@ ScTransferObj::~ScTransferObj()
     SolarMutexGuard aSolarGuard;
 
     ScModule* pScMod = SC_MOD();
-    if ( pScMod->GetDragData().pCellTransfer == this )
+    if (pScMod && pScMod->GetDragData().pCellTransfer == this)
     {
         OSL_FAIL("ScTransferObj wasn't released");
         pScMod->ResetDragObject();


More information about the Libreoffice-commits mailing list