diff options
author | Justin Luth <justin.luth@collabora.com> | 2020-12-26 10:52:08 +0300 |
---|---|---|
committer | Justin Luth <justin_luth@sil.org> | 2020-12-29 16:39:18 +0100 |
commit | ccfd8e9d09f9ac0a0ea92d0f378391006faaf934 (patch) | |
tree | 57867fcc0b60aece4194014bf2046a5a72e8be07 /sw/source/ui/misc/titlepage.cxx | |
parent | 764c2a9c2bfe4e2ab17a3bd21d65762a2bcfd351 (diff) |
tdf#138907 sw TitlePageDlg: fix round-tripping
This Format -> Title Pages dialog is completely broken,
so I threw in lots of FIXME notes.
At least for the case of just using the existing pages
and setting them up as title/follow page, fix:
1.) the ability to round-trip page number restart if a
numbering restart without a page style already existed.
(Yes, this likely is an odd case of someone messing around.
In any case, a page number restart REQUIRES a page style)
make UITest_writer_tests5 UITEST_TEST_NAME=\
titlePageWizard.tdf138907.test_tdf138907
Change-Id: I544145e9f749f471b54fa6686242e93bc98f50be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108322
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'sw/source/ui/misc/titlepage.cxx')
-rw-r--r-- | sw/source/ui/misc/titlepage.cxx | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/sw/source/ui/misc/titlepage.cxx b/sw/source/ui/misc/titlepage.cxx index 06767dbe3844..149c8f4a8046 100644 --- a/sw/source/ui/misc/titlepage.cxx +++ b/sw/source/ui/misc/titlepage.cxx @@ -76,15 +76,9 @@ namespace } // If we want a new descriptor then set it, otherwise reuse the existing one - if (!pNewDesc) + if (pNewDesc || nPgNo) { - SwFormatPageDesc aPageFormatDesc(pPageFormatDesc ? *pPageFormatDesc : &rCurrentDesc); - if (nPgNo) aPageFormatDesc.SetNumOffset(nPgNo); - pSh->SetAttrItem(aPageFormatDesc); - } - else - { - SwFormatPageDesc aPageFormatDesc(pNewDesc); + SwFormatPageDesc aPageFormatDesc(pNewDesc ? pNewDesc : &rCurrentDesc); if (nPgNo) aPageFormatDesc.SetNumOffset(nPgNo); pSh->SetAttrItem(aPageFormatDesc); } @@ -133,6 +127,8 @@ void SwTitlePageDlg::FillList() sal_uInt16 SwTitlePageDlg::GetInsertPosition() const { sal_uInt16 nPage = 1; + // FIXME: If GetInsertPosition is greater than the current number of pages, + // it needs to be reduced to page-count + 1. if (m_xPageStartNF->get_sensitive()) nPage = m_xPageStartNF->get_value(); return nPage; @@ -255,6 +251,8 @@ IMPL_LINK_NOARG(SwTitlePageDlg, EditHdl, weld::Button&, void) IMPL_LINK_NOARG(SwTitlePageDlg, OKHdl, weld::Button&, void) { + // FIXME: This wizard is almost completely non-functional for inserting new pages. + lcl_PushCursor(mpSh); mpSh->StartUndo(); @@ -269,12 +267,16 @@ IMPL_LINK_NOARG(SwTitlePageDlg, OKHdl, weld::Button&, void) sal_uInt16 nNoPages = m_xPageCountNF->get_value(); if (!m_xUseExistingPagesRB->get_active()) { + // FIXME: If the starting page number is larger than the last page, + // probably should add pages AFTER the last page, not before it. mpSh->GotoPage(GetInsertPosition(), false); + // FIXME: These new pages cannot be accessed currently with GotoPage. It doesn't know they exist. for (sal_uInt16 nI=0; nI < nNoPages; ++nI) mpSh->InsertPageBreak(); } mpSh->GotoPage(GetInsertPosition(), false); + // FIXME: GotoPage is pointing to a page after the newly created index pages, so the wrong pages are getting Index style. for (sal_uInt16 nI=1; nI < nNoPages; ++nI) { if (mpSh->SttNxtPg()) @@ -286,6 +288,7 @@ IMPL_LINK_NOARG(SwTitlePageDlg, OKHdl, weld::Button&, void) if (nNoPages > 1 && mpSh->GotoPage(GetInsertPosition() + nNoPages, false)) { + // FIXME: By definition, GotoPage(x,bRecord=false) returns false. This is dead code. SwFormatPageDesc aPageFormatDesc(mpNormalDesc); mpSh->SetAttrItem(aPageFormatDesc); } |