diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2023-11-10 10:17:16 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2023-11-10 13:49:10 +0100 |
commit | 8d973c5b9405bfa6964d3dfebd0017fd60ec3eca (patch) | |
tree | 2b8a1ff98834edf2a17241e8f5e1bf4a8abce6c3 /sw | |
parent | c1bd25e4674571e04b6445af36e4520a70ac166b (diff) |
sw floattable, insert UI: default to at-char for non-split flys
Inserting new images defaulted to the at-char anchor type, but inserting
a new frame defaulted to at-para, which is inconsistent. This is now more
visible, since LOK exposes the insert frame dialog.
An additional problem is that the LOK case hides anything other than
at-char and as-char in the frame properties dialog since commit
4154d281fbecaadf6cd118c00cc6cff929e339a4 (sw lok: hide UI to set
Word-incompatible anchor types, 2019-07-05), which was intended for
images, but also affects text frames as well. But floating tables want
to-para anchored frames to be able to split.
Fix the problem by defaulting to at-char anchoring, unless we deal with
floating tables.
And show the to-para anchor widget in the LOK case again, given that all
of to-para, to-char and as-char have their use-cases, even when editing
Word documents.
Change-Id: I89b0973183a750d86f56e0cccd7b0fbcb3dc070d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159261
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/uitest/ui/frmdlg/frmdlg.py | 12 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/frmpage.cxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/shells/textsh.cxx | 6 |
3 files changed, 18 insertions, 1 deletions
diff --git a/sw/qa/uitest/ui/frmdlg/frmdlg.py b/sw/qa/uitest/ui/frmdlg/frmdlg.py index 4a438895572b..bbb9d9a270dd 100644 --- a/sw/qa/uitest/ui/frmdlg/frmdlg.py +++ b/sw/qa/uitest/ui/frmdlg/frmdlg.py @@ -98,4 +98,16 @@ class Test(UITestCase): # inserted first, only then it could be marked as "split allowed". self.assertEqual(fly_split_visible, True) + def test_insert_simple_frame(self): + # Given a Writer document: + with self.ui_test.create_doc_in_start_center("writer") as xComponent: + # When inserting a simple text frame (not a floating table): + with self.ui_test.execute_dialog_through_command(".uno:InsertFrame") as xDialog: + to_char = xDialog.getChild("tochar") + to_char_enabled = get_state_as_dict(to_char)["Checked"] == "true" + # Then make sure the anchor type is to-char, matching the default anchor for images: + # This failed, text frames defaulted to to-para, images defaulted to to-char, which was + # inconsistent. + self.assertTrue(to_char_enabled) + # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index 911df55f66d7..bdf1c90291ff 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -721,7 +721,6 @@ SwFramePage::SwFramePage(weld::Container* pPage, weld::DialogController* pContro if (comphelper::LibreOfficeKit::isActive()) { m_xAnchorAtPageRB->hide(); - m_xAnchorAtParaRB->hide(); m_xAnchorAtFrameRB->hide(); } } diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx index c9e0e8a4d6f9..d0c9aabc979f 100644 --- a/sw/source/uibase/shells/textsh.cxx +++ b/sw/source/uibase/shells/textsh.cxx @@ -918,6 +918,12 @@ SfxItemSet SwTextShell::CreateInsertFrameItemSet(SwFlyFrameAttrMgr& rMgr) aBoxInfo.SetDefDist(rBox.GetDistance(SvxBoxItemLine::LEFT)); aSet.Put(aBoxInfo); + if (!SwFlyFrameAttrMgr::SingleTableSelected(GetShell())) + { + SwFormatAnchor aAnchor(RndStdIds::FLY_AT_CHAR); + aSet.Put(aAnchor); + } + return aSet; } |