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;
95bool 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;
149 , mpTitleDesc(nullptr)
150 , mpIndexDesc(nullptr)
151 , mpNormalDesc(nullptr)
152 , m_xUseExistingPagesRB(m_xBuilder->weld_radio_button(
"RB_USE_EXISTING_PAGES"))
153 , m_xInsertNewPagesRB(m_xBuilder->weld_radio_button(
"RB_INSERT_NEW_PAGES"))
154 , m_xPageCountNF(m_xBuilder->weld_spin_button(
"NF_PAGE_COUNT"))
155 , m_xDocumentStartRB(m_xBuilder->weld_radio_button(
"RB_DOCUMENT_START"))
156 , m_xPageStartRB(m_xBuilder->weld_radio_button(
"RB_PAGE_START"))
157 , m_xPageStartNF(m_xBuilder->weld_spin_button(
"NF_PAGE_START"))
158 , m_xRestartNumberingCB(m_xBuilder->weld_check_button(
"CB_RESTART_NUMBERING"))
159 , m_xRestartNumberingNF(m_xBuilder->weld_spin_button(
"NF_RESTART_NUMBERING"))
160 , m_xSetPageNumberCB(m_xBuilder->weld_check_button(
"CB_SET_PAGE_NUMBER"))
161 , m_xSetPageNumberNF(m_xBuilder->weld_spin_button(
"NF_SET_PAGE_NUMBER"))
162 , m_xPagePropertiesLB(m_xBuilder->weld_combo_box(
"LB_PAGE_PROPERTIES"))
163 , m_xPagePropertiesPB(m_xBuilder->weld_button(
"PB_PAGE_PROPERTIES"))
164 , m_xOkPB(m_xBuilder->weld_button(
"ok"))
176 sal_uInt16 nSetPage = 1;
177 sal_uInt16 nResetPage = 1;
178 sal_uInt16 nTitlePages = 1;
179 lcl_PushCursor(rWrtShell);
184 bool bMaybeResetNumbering =
false;
203 bMaybeResetNumbering =
lcl_GetPageDesc(rWrtShell, nResetPage,
nullptr);
210 lcl_PopCursor(rWrtShell);
224 if (bMaybeResetNumbering && nResetPage > 0)
241 if (m_xPageCountNF->get_value() == 1 || m_xPageCountNF->get_value() == 2)
247 m_xRestartNumberingNF->set_sensitive(m_xRestartNumberingCB->get_active());
252 m_xSetPageNumberNF->set_sensitive(m_xSetPageNumberCB->get_active());
257 m_xPageStartNF->set_sensitive(m_xPageStartRB->get_active());
271 rView.
GetDocShell()->
FormatPage(getDialog(), m_xPagePropertiesLB->get_active_text(),
"page", rWrtShell);
281 lcl_PushCursor(rWrtShell);
287 if (m_xSetPageNumberCB->get_active())
288 aTitleDesc.
SetNumOffset(m_xSetPageNumberNF->get_value());
289 else if (mpPageFormatDesc)
290 aTitleDesc.
SetNumOffset(mpPageFormatDesc->GetNumOffset());
292 sal_uInt16 nNumTitlePages = m_xPageCountNF->get_value();
293 if (!m_xUseExistingPagesRB->get_active())
297 if (!lcl_GotoPage(rWrtShell, GetInsertPosition()))
303 for (sal_uInt16 nI = 0; nI < nNumTitlePages; ++nI)
309 if (lcl_GotoPage(rWrtShell, GetInsertPosition()))
312 for (sal_uInt16 nI = 1; nI < nNumTitlePages; ++nI)
319 if ((m_xRestartNumberingCB->get_active() || nNumTitlePages > 1)
320 && lcl_GotoPage(rWrtShell, GetInsertPosition(), nNumTitlePages))
323 = m_xRestartNumberingCB->get_active() ? m_xRestartNumberingNF->get_value() : 0;
324 const SwPageDesc* pNewDesc = nNumTitlePages > 1 ? mpNormalDesc :
nullptr;
325 lcl_ChangePage(rWrtShell, nPgNo, pNewDesc);
329 lcl_PopCursor(rWrtShell);
330 if (!m_xUseExistingPagesRB->get_active())
331 lcl_GotoPage(rWrtShell, GetInsertPosition());
Reference< XExecutableDialog > m_xDialog
void FormatPage(weld::Window *pDialogParent, const OUString &rPage, const OUString &rPageId, SwWrtShell &rActShell, SfxRequest *pRequest=nullptr)
Show page style format dialog.
virtual void CalcLayout() override
To enable set up of StartActions and EndActions.
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
void StartAllAction()
For all views of this document.
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
void SetAttrItem(const SfxPoolItem &, SetAttrMode nFlags=SetAttrMode::DEFAULT, const bool bParagraphSetting=false)
SwPageDesc * GetPageDescFromPool(sal_uInt16 nId)
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
size_t GetCurPageDesc(const bool bCalcFrame=true) const
const SwPageDesc & GetPageDesc(size_t i) const
sal_uInt16 GetPageNumber(const Point &rPoint) const
Page number of the page containing Point, O if no page.
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
void SetNumOffset(const ::std::optional< sal_uInt16 > &oNum)
const OUString & GetName() const
std::unique_ptr< weld::RadioButton > m_xDocumentStartRB
std::unique_ptr< weld::SpinButton > m_xPageStartNF
const SwPageDesc * mpIndexDesc
std::unique_ptr< weld::RadioButton > m_xUseExistingPagesRB
std::unique_ptr< weld::ComboBox > m_xPagePropertiesLB
virtual ~SwTitlePageDlg() override
SwTitlePageDlg(weld::Window *pParent)
sal_uInt16 GetInsertPosition() const
std::unique_ptr< weld::SpinButton > m_xRestartNumberingNF
std::unique_ptr< weld::CheckButton > m_xSetPageNumberCB
std::unique_ptr< weld::SpinButton > m_xSetPageNumberNF
std::unique_ptr< weld::CheckButton > m_xRestartNumberingCB
std::unique_ptr< const SwFormatPageDesc > mpPageFormatDesc
std::unique_ptr< weld::RadioButton > m_xPageStartRB
const SwPageDesc * mpNormalDesc
std::unique_ptr< weld::Button > m_xPagePropertiesPB
std::unique_ptr< weld::Button > m_xOkPB
std::unique_ptr< weld::SpinButton > m_xPageCountNF
const SfxItemPool & GetAttrPool() const
SwWrtShell & GetWrtShell() const
SwDocShell * GetDocShell()
void InvalidateRulerPos()
Used by the UI to modify the document model.
bool EndPg(bool bSelect=false)
bool GotoPage(sal_uInt16 nPage, bool bRecord)
bool SttNxtPg(bool bSelect=false)
void InsertPageBreak(const OUString *pPageDesc=nullptr, const ::std::optional< sal_uInt16 > &rPgNum=std::nullopt)
bool StartOfSection(bool bSelect=false)
const SwView & GetView() const
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(99)
#define LINK(Instance, Class, Member)
@ RES_POOLPAGE_REGISTER
Index.
@ RES_POOLPAGE_FIRST
First page.
@ RES_POOLPAGE_STANDARD
Standard page.
IMPL_LINK_NOARG(SwTitlePageDlg, ValueChangeHdl, weld::SpinButton &, void)
static SwPageDesc * lcl_GetPageDesc(SwDoc *pDoc, const uno::Any &aValue)