diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2023-11-09 08:51:59 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2023-11-09 11:37:33 +0100 |
commit | e306352b9ddd8bddfc37f0cfaac078d9260650d6 (patch) | |
tree | 9476d68e85bb9d09a430cbf426e8d622e1c979a5 /sw/source/ui | |
parent | ef5828fb45e2b46a36b73260232dede3d98e22a4 (diff) |
sw floattable, insert UI: allow direct creation of floating tables
The frame insert UI could move a table into a new fly, and then the
frame properties allowed marking this fly as a split fly, but not in one
step.
This happened because the "split fly" checkbox is only visible when we
have a fly that has exactly 1 table, but the "new frame" dialog has no
fly as it still has to be created.
Fix the problem by showing the "split fly" checkbox if we don't have a
fly, but a single table is selected, because we know
SwDoc::MakeFlyAndMove() will create a fly that has exactly one table in
it.
Extract the common code to a new
SwFlyFrameAttrMgr::SingleTableSelected() to avoid copy&paste.
Change-Id: I24129e3fb4cb6231fb10b0adda53c205dfd90d62
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159201
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw/source/ui')
-rw-r--r-- | sw/source/ui/frmdlg/frmpage.cxx | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index b38ac22d0d11..911df55f66d7 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -1050,9 +1050,23 @@ void SwFramePage::Reset( const SfxItemSet *rSet ) const SwFrameFormat* pFlyFormat = pSh->GetFlyFrameFormat(); if (!pFlyFormat || !ContainsSingleTable(*pFlyFormat) || ContainsChain(*pFlyFormat)) { + bool bSingleTable = false; + if (!pFlyFormat && m_bNew) + { + // No fly is selected: check if a whole table is selected. If so, allow moving that into + // a split fly. + if (SwFlyFrameAttrMgr::SingleTableSelected(*pSh)) + { + bSingleTable = true; + } + } + // Only allow fly split if the frame contains a single table, otherwise it would be hard to // save the resulting model to Word formats. - m_xFlySplitCB->hide(); + if (!bSingleTable) + { + m_xFlySplitCB->hide(); + } } Init(*rSet); |