30 ::std::optional<sal_uInt16> oNumOffset = pDescItem->GetNumOffset();
32 rPageNo = *oNumOffset;
34 ppPageFormatDesc->reset(static_cast<const SwFormatPageDesc *>(pDescItem->Clone()));
46 std::unique_ptr<const SwFormatPageDesc> pPageFormatDesc;
57 else if (pPageFormatDesc)
59 ::std::optional<sal_uInt16> oNumOffset = pPageFormatDesc->GetNumOffset();
65 if (pNewDesc || nPgNo)
68 if (nPgNo) aPageFormatDesc.SetNumOffset(nPgNo);
77 rSh.SwCursorShell::Push();
87 sal_uInt16 lcl_GetCurrentPage(
const SwWrtShell& rSh)
90 sal_uInt16 nPhyNum=1, nVirtNum=1;
95 bool lcl_GotoPage(
SwWrtShell& rSh,
const sal_uInt16 nStartingPage, sal_uInt16 nOffset = 0)
99 sal_uInt16 nCurrentPage = lcl_GetCurrentPage(rSh);
102 return nCurrentPage == nStartingPage + nOffset;
104 if (nCurrentPage != nStartingPage)
106 assert(nStartingPage != 1 &&
"Physical page 1 couldn't be found/moved to?");
108 rSh.
GotoPage(nStartingPage + 1,
false);
110 nCurrentPage = lcl_GetCurrentPage(rSh);
111 assert(nCurrentPage == nStartingPage + 1 &&
"Impossible, since unknown goes to last page");
112 if (nCurrentPage != nStartingPage + 1)
141 sal_uInt16 nPage = 1;
150 , m_xUseExistingPagesRB(m_xBuilder->weld_radio_button(
"RB_USE_EXISTING_PAGES"))
151 , m_xPageCountNF(m_xBuilder->weld_spin_button(
"NF_PAGE_COUNT"))
152 , m_xDocumentStartRB(m_xBuilder->weld_radio_button(
"RB_DOCUMENT_START"))
153 , m_xPageStartRB(m_xBuilder->weld_radio_button(
"RB_PAGE_START"))
154 , m_xPageStartNF(m_xBuilder->weld_spin_button(
"NF_PAGE_START"))
155 , m_xRestartNumberingCB(m_xBuilder->weld_check_button(
"CB_RESTART_NUMBERING"))
156 , m_xRestartNumberingNF(m_xBuilder->weld_spin_button(
"NF_RESTART_NUMBERING"))
157 , m_xSetPageNumberCB(m_xBuilder->weld_check_button(
"CB_SET_PAGE_NUMBER"))
158 , m_xSetPageNumberNF(m_xBuilder->weld_spin_button(
"NF_SET_PAGE_NUMBER"))
159 , m_xPagePropertiesLB(m_xBuilder->weld_combo_box(
"LB_PAGE_PROPERTIES"))
160 , m_xPagePropertiesPB(m_xBuilder->weld_button(
"PB_PAGE_PROPERTIES"))
161 , m_xOkPB(m_xBuilder->weld_button(
"ok"))
168 sal_uInt16 nSetPage = 1;
169 sal_uInt16 nResetPage = 1;
170 sal_uInt16 nTitlePages = 1;
171 lcl_PushCursor(
mrSh);
176 bool bMaybeResetNumbering =
false;
216 if (bMaybeResetNumbering && nResetPage > 0)
233 if (m_xPageCountNF->get_value() == 1 || m_xPageCountNF->get_value() == 2)
239 m_xRestartNumberingNF->set_sensitive(m_xRestartNumberingCB->get_active());
244 m_xSetPageNumberNF->set_sensitive(m_xSetPageNumberCB->get_active());
249 m_xPageStartNF->set_sensitive(m_xPageStartRB->get_active());
258 SwView& rView = mrSh.GetView();
265 lcl_PushCursor(mrSh);
271 if (m_xSetPageNumberCB->get_active())
272 aTitleDesc.
SetNumOffset(m_xSetPageNumberNF->get_value());
273 else if (mpPageFormatDesc)
274 aTitleDesc.
SetNumOffset(mpPageFormatDesc->GetNumOffset());
276 sal_uInt16 nNumTitlePages = m_xPageCountNF->get_value();
277 if (!m_xUseExistingPagesRB->get_active())
281 if (!lcl_GotoPage(mrSh, GetInsertPosition()))
285 mrSh.InsertPageBreak();
287 for (sal_uInt16 nI = 0; nI < nNumTitlePages; ++nI)
288 mrSh.InsertPageBreak();
293 if (lcl_GotoPage(mrSh, GetInsertPosition()))
295 mrSh.SetAttrItem(aTitleDesc);
296 for (sal_uInt16 nI = 1; nI < nNumTitlePages; ++nI)
303 if ((m_xRestartNumberingCB->get_active() || nNumTitlePages > 1)
304 && lcl_GotoPage(mrSh, GetInsertPosition(), nNumTitlePages))
307 = m_xRestartNumberingCB->get_active() ? m_xRestartNumberingNF->get_value() : 0;
308 const SwPageDesc* pNewDesc = nNumTitlePages > 1 ? mpNormalDesc :
nullptr;
309 lcl_ChangePage(mrSh, nPgNo, pNewDesc);
314 if (!m_xUseExistingPagesRB->get_active())
315 lcl_GotoPage(mrSh, GetInsertPosition());
#define LINK(Instance, Class, Member)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
std::unique_ptr< weld::CheckButton > m_xSetPageNumberCB
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
bool SttNxtPg(bool bSelect=false)
std::unique_ptr< weld::ComboBox > m_xPagePropertiesLB
std::unique_ptr< weld::Button > m_xPagePropertiesPB
std::unique_ptr< weld::SpinButton > m_xPageCountNF
SwTitlePageDlg(weld::Window *pParent)
const OUString & GetName() const
Used by the UI to modify the document model.
const SwView & GetView() const
std::unique_ptr< weld::RadioButton > m_xDocumentStartRB
void FormatPage(weld::Window *pDialogParent, const OUString &rPage, const OString &rPageId, SwWrtShell &rActShell, SfxRequest *pRequest=nullptr)
Show page style format dialog.
IMPL_LINK_NOARG(SwTitlePageDlg, ValueChangeHdl, weld::SpinButton &, void)
std::unique_ptr< weld::SpinButton > m_xPageStartNF
sal_uInt16 GetInsertPosition() const
std::unique_ptr< weld::CheckButton > m_xRestartNumberingCB
const SfxItemPool & GetAttrPool() const
void SetAttrItem(const SfxPoolItem &, SetAttrMode nFlags=SetAttrMode::DEFAULT, const bool bParagraphSetting=false)
const SwPageDesc & GetPageDesc(size_t i) const
const SwPageDesc * mpIndexDesc
std::unique_ptr< weld::RadioButton > m_xPageStartRB
bool StartOfSection(bool bSelect=false)
SwDocShell * GetDocShell()
const SwPageDesc * mpNormalDesc
std::unique_ptr< weld::SpinButton > m_xSetPageNumberNF
std::unique_ptr< weld::SpinButton > m_xRestartNumberingNF
std::unique_ptr< const SwFormatPageDesc > mpPageFormatDesc
virtual ~SwTitlePageDlg() override
SwPageDesc * GetPageDescFromPool(sal_uInt16 nId)
Reference< XExecutableDialog > m_xDialog
void InvalidateRulerPos()
static SwPageDesc * lcl_GetPageDesc(SwDoc *pDoc, const uno::Any &aValue)
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
std::unique_ptr< weld::RadioButton > m_xUseExistingPagesRB
std::unique_ptr< weld::Button > m_xOkPB
bool GotoPage(sal_uInt16 nPage, bool bRecord)
void SetNumOffset(const ::std::optional< sal_uInt16 > &oNum)
sal_uInt16 GetPageNumber(const Point &rPoint) const
Page number of the page containing Point, O if no page.
void StartAllAction()
For all views of this document.
size_t GetCurPageDesc(const bool bCalcFrame=true) const