diff options
-rw-r--r-- | sw/inc/cmdid.h | 2 | ||||
-rw-r--r-- | sw/inc/globals.hrc | 5 | ||||
-rw-r--r-- | sw/inc/helpid.h | 1 | ||||
-rw-r--r-- | sw/inc/rcid.hrc | 2 | ||||
-rw-r--r-- | sw/inc/swabstdlg.hxx | 1 | ||||
-rw-r--r-- | sw/sdi/_basesh.sdi | 6 | ||||
-rw-r--r-- | sw/sdi/swriter.sdi | 25 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.cxx | 9 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.hxx | 1 | ||||
-rw-r--r-- | sw/source/ui/inc/swmn_tmpl.hrc | 7 | ||||
-rw-r--r-- | sw/source/ui/inc/titlepage.hxx | 99 | ||||
-rw-r--r-- | sw/source/ui/misc/makefile.mk | 4 | ||||
-rw-r--r-- | sw/source/ui/misc/titlepage.cxx | 363 | ||||
-rw-r--r-- | sw/source/ui/misc/titlepage.hrc | 50 | ||||
-rw-r--r-- | sw/source/ui/misc/titlepage.src | 248 | ||||
-rw-r--r-- | sw/source/ui/shells/basesh.cxx | 8 | ||||
-rw-r--r-- | sw/uiconfig/swriter/menubar/menubar.xml | 1 | ||||
-rw-r--r-- | sw/util/makefile.mk | 1 |
18 files changed, 829 insertions, 4 deletions
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index a206392aad3b..013ff27100b4 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -533,6 +533,8 @@ Achtung: Ab sofort sind in diesem File keine C++-Kommentare (//) mehr #define FN_SET_PAGE_STYLE (FN_FORMAT + 93) /* Anwenden Seitenv. */ +#define FN_FORMAT_TITLEPAGE_DLG (FN_FORMAT + 98) /* Title Page */ + #define FN_TABLE_REP (FN_FORMAT + 99) /* TableRepresentation */ #define FN_CONVERT_TEXT_TABLE (FN_FORMAT + 100) /* Konvertierung Text <-> Tabelle */ diff --git a/sw/inc/globals.hrc b/sw/inc/globals.hrc index b64494b847ae..709a25692cd7 100644 --- a/sw/inc/globals.hrc +++ b/sw/inc/globals.hrc @@ -275,7 +275,9 @@ #define TP_SECTION_INDENTS (RC_GLOBALS_BEGIN + 102) #define TP_OPTCOMPATIBILITY_PAGE (RC_GLOBALS_BEGIN + 103) #define TP_MAILCONFIG (RC_GLOBALS_BEGIN + 104) -//maximum: RC_GLOBALS_BEGIN + 119 +#define TP_TITLEPAGE (RC_GLOBALS_BEGIN + 105) +//maximum: RC_GLOBALS_BEGIN + 120 + #if STR_DOC_STAT > RC_GLOBALS_END #error Resource-Id Ueberlauf in #file, #line @@ -287,4 +289,5 @@ #define SID_WRT_SHELL (RC_GLOBALS_BEGIN + 117) #define DLG_LINE_NUMBERING (RC_GLOBALS_BEGIN + 118) +#define DLG_TITLEPAGE (RC_GLOBALS_BEGIN + 119) #endif // _GLOBALS_HRC diff --git a/sw/inc/helpid.h b/sw/inc/helpid.h index 8c43631aaf4e..380c4bd537a7 100644 --- a/sw/inc/helpid.h +++ b/sw/inc/helpid.h @@ -981,3 +981,4 @@ #define HID_MM_HEADER_12 (HID_BASE + 2279) #define HID_MM_HEADER_13 (HID_BASE + 2280) +#define HID_TITLEPAGE (HID_BASE + 2281) diff --git a/sw/inc/rcid.hrc b/sw/inc/rcid.hrc index 8a788933dc4e..aeca0cf38d0f 100644 --- a/sw/inc/rcid.hrc +++ b/sw/inc/rcid.hrc @@ -130,7 +130,7 @@ // globale Ressourcen #define RC_GLOBALS_BEGIN RC_GLOBALS -#define RC_GLOBALS_END (RC_GLOBALS_BEGIN + 119) +#define RC_GLOBALS_END (RC_GLOBALS_BEGIN + 120) // Format-Vorlagen #define RC_FMTUI_BEGIN RC_FMTUI diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index 62efb4fc8f2d..6573370ec6e8 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -434,6 +434,7 @@ public: SwField* pField, BOOL bNextButton = FALSE ) = 0; //add for SwFldInputDlg virtual AbstractInsFootNoteDlg* CreateInsFootNoteDlg( int nResId, Window * pParent, SwWrtShell &rSh, BOOL bEd = FALSE) = 0; //add for SwInsFootNoteDlg + virtual VclAbstractDialog* CreateTitlePageDlg ( Window * pParent ) = 0; virtual VclAbstractDialog * CreateVclSwViewDialog( int nResId, SwView& rView, BOOL bCol = FALSE ) = 0; //add for SwInsRowColDlg, SwLineNumberingDlg virtual AbstractInsertGrfRulerDlg* CreateInsertGrfRulerDlg( int nResId, diff --git a/sw/sdi/_basesh.sdi b/sw/sdi/_basesh.sdi index 52e59e9e5fed..115029d3c5d1 100644 --- a/sw/sdi/_basesh.sdi +++ b/sw/sdi/_basesh.sdi @@ -247,6 +247,12 @@ interface BaseTextSelection DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + FN_FORMAT_TITLEPAGE_DLG // status(final|play) + [ + ExecMethod = ExecDlg ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + FN_FORMAT_PAGE_COLUMN_DLG // status(final|play) [ ExecMethod = ExecDlg ; diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index aae7ec7a019c..5863907049dc 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -6329,6 +6329,31 @@ SfxVoidItem PageDialog FN_FORMAT_PAGE_DLG ] //-------------------------------------------------------------------------- +SfxVoidItem TitlePageDialog FN_FORMAT_TITLEPAGE_DLG +() +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = TRUE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerItem; + Asynchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- SfxVoidItem PageDown FN_PAGEDOWN () [ diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index e627ae03f94f..bca78b921509 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -93,6 +93,7 @@ #include <instable.hxx> //add for SwInsTableDlg #include <javaedit.hxx> //add for SwJavaEditDialog #include <linenum.hxx> //add for SwLineNumberingDlg +#include <titlepage.hxx> //add for SwTitlePageDlg #include <mailmrge.hxx> //add for SwMailMergeDlg, SwMailMergeCreateFromDlg, SwMailMergeFieldConnectionsDlg #include <mergetbl.hxx> //add for SwMergeTblDlg #include <multmrk.hxx> //add for SwMultiTOXMarkDlg @@ -1267,6 +1268,14 @@ AbstractInsFootNoteDlg* SwAbstractDialogFactory_Impl::CreateInsFootNoteDlg( int return 0; } +VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateTitlePageDlg ( Window *pParent ) +{ + Dialog* pDlg = new SwTitlePageDlg( pParent ); + if ( pDlg ) + return new VclAbstractDialog_Impl( pDlg ); + return 0; +} + VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateVclSwViewDialog( int nResId, SwView& rView, BOOL /*bCol*/ ) //add for SwInsRowColDlg, SwLineNumberingDlg { diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index ac1753b7d267..f80bd72f2483 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -515,6 +515,7 @@ public: SwField* pField, BOOL bNextButton = FALSE ); //add for SwFldInputDlg virtual AbstractInsFootNoteDlg* CreateInsFootNoteDlg( int nResId, Window * pParent, SwWrtShell &rSh, BOOL bEd = FALSE); //add for SwInsFootNoteDlg + virtual VclAbstractDialog * CreateTitlePageDlg ( Window * pParent ); virtual VclAbstractDialog * CreateVclSwViewDialog( int nResId, SwView& rView, BOOL bCol = FALSE ); //add for SwInsRowColDlg, SwLineNumberingDlg virtual AbstractInsertGrfRulerDlg* CreateInsertGrfRulerDlg( int nResId, diff --git a/sw/source/ui/inc/swmn_tmpl.hrc b/sw/source/ui/inc/swmn_tmpl.hrc index 23820a6fb548..eed234a6d886 100644 --- a/sw/source/ui/inc/swmn_tmpl.hrc +++ b/sw/source/ui/inc/swmn_tmpl.hrc @@ -58,9 +58,14 @@ Identifier = FN_FORMAT_PAGE_DLG ; \ HelpID = FN_FORMAT_PAGE_DLG ; \ Text [ en-US ] = "Pa~ge..." ; \ + };\ + MenuItem\ + {\ + Identifier = FN_FORMAT_TITLEPAGE_DLG ; \ + HelpID = FN_FORMAT_TITLEPAGE_DLG ; \ + Text [ en-US ] = "~Title Page..." ; \ }; - #define MN_TEXT_ATTR\ MenuItem\ {\ diff --git a/sw/source/ui/inc/titlepage.hxx b/sw/source/ui/inc/titlepage.hxx new file mode 100644 index 000000000000..f72ee66a199a --- /dev/null +++ b/sw/source/ui/inc/titlepage.hxx @@ -0,0 +1,99 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ +#ifndef _SWTITLEPAGE_HXX +#define _SWTITLEPAGE_HXX + +#include <sfx2/basedlgs.hxx> +#include <sfx2/tabdlg.hxx> +#include <vcl/fixed.hxx> +#include <vcl/field.hxx> +#include <vcl/lstbox.hxx> +#include <numberingtypelistbox.hxx> + +class Window; +class SfxItemSet; +class SwView; +class SwWrtShell; +class SwPageDesc; + +class SwTitlePageDlg : public SfxModalDialog +{ +private: + FixedLine aMakeInsertFL; + RadioButton aUseExistingPagesRB; + RadioButton aInsertNewPagesRB; + FixedText aPageCountFT; + NumericField aPageCountNF; + FixedText aPagePagesFT; + + FixedText aPageStartFT; + RadioButton aDocumentStartRB; + RadioButton aPageStartRB; + NumericField aPageStartNF; + + FixedLine aNumberingFL; + CheckBox aRestartNumberingCB; + FixedText aRestartNumberingFT; + NumericField aRestartNumberingNF; + CheckBox aSetPageNumberCB; + FixedText aSetPageNumberFT; + NumericField aSetPageNumberNF; + + FixedLine aPagePropertiesFL; + ListBox aPagePropertiesLB; + PushButton aPagePropertiesPB; + + FixedLine aBottomFL; + OKButton aOkPB; + CancelButton aCancelPB; + HelpButton aHelpPB; + + SwWrtShell *mpSh; + + const SwFmtPageDesc *mpPageFmtDesc; + + SwPageDesc *mpTitleDesc; + const SwPageDesc *mpIndexDesc; + const SwPageDesc *mpNormalDesc; + + void FillList(); + + USHORT GetInsertPosition() const; + + DECL_LINK( OKHdl, Button * ); + DECL_LINK( EditHdl, Button * ); + DECL_LINK( RestartNumberingHdl, CheckBox* ); + DECL_LINK( SetPageNumberHdl, CheckBox* ); + DECL_LINK( UpHdl, NumericField * ); + DECL_LINK( DownHdl, NumericField * ); + DECL_LINK( StartPageHdl, RadioButton * ); +public: + SwTitlePageDlg( Window *pParent ); + ~SwTitlePageDlg(); +}; + +#endif diff --git a/sw/source/ui/misc/makefile.mk b/sw/source/ui/misc/makefile.mk index 72d9f80aec3f..d2ed28a0c7f2 100644 --- a/sw/source/ui/misc/makefile.mk +++ b/sw/source/ui/misc/makefile.mk @@ -52,7 +52,8 @@ SRC1FILES=\ pgfnote.src \ pggrid.src \ redlndlg.src \ - srtdlg.src + srtdlg.src \ + titlepage.src EXCEPTIONSFILES = \ $(SLO)$/glossary.obj \ @@ -73,6 +74,7 @@ SLOFILES = \ $(SLO)$/insfnote.obj \ $(SLO)$/insrule.obj \ $(SLO)$/linenum.obj \ + $(SLO)$/titlepage.obj \ $(SLO)$/num.obj \ $(SLO)$/numberingtypelistbox.obj \ $(SLO)$/outline.obj \ diff --git a/sw/source/ui/misc/titlepage.cxx b/sw/source/ui/misc/titlepage.cxx new file mode 100644 index 000000000000..8c39bbb8b5d6 --- /dev/null +++ b/sw/source/ui/misc/titlepage.cxx @@ -0,0 +1,363 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + +#include <sfx2/viewfrm.hxx> +#include <vcl/msgbox.hxx> +#include <view.hxx> +#include <swmodule.hxx> +#include <wrtsh.hxx> +#include <poolfmt.hxx> +#include <docsh.hxx> +#include <charfmt.hxx> +#include <docstyle.hxx> + +#include "fldbas.hxx" +#include "lineinfo.hxx" +#include "globals.hrc" +#include "titlepage.hrc" +#include "titlepage.hxx" +#include "uitool.hxx" +#include "fmtpdsc.hxx" +#include "pagedesc.hxx" + +#include <IDocumentStylePoolAccess.hxx> + +namespace +{ + bool lcl_GetPageDesc(SwWrtShell *pSh, USHORT &rPageNo, const SwFmtPageDesc **ppPageFmtDesc) + { + bool bRet = false; + SfxItemSet aSet( pSh->GetAttrPool(), RES_PAGEDESC, RES_PAGEDESC ); + if (pSh->GetCurAttr( aSet )) + { + const SfxPoolItem* pItem(0); + if (SFX_ITEM_SET == aSet.GetItemState( RES_PAGEDESC, TRUE, &pItem ) && pItem) + { + rPageNo = ((const SwFmtPageDesc *)pItem)->GetNumOffset(); + if (ppPageFmtDesc) + (*ppPageFmtDesc) = (const SwFmtPageDesc *)(pItem->Clone()); + bRet = true; + } + } + return bRet; + } + + bool lcl_SkipNPages(SwWrtShell *pSh, USHORT nNoPages) + { + bool bAllOk = true; + for (USHORT nI = 0; nI < nNoPages && bAllOk; ++nI) + bAllOk = pSh->SttNxtPg(); + return bAllOk; + } + + void lcl_ChangePage(SwWrtShell *pSh, USHORT nNewNumber, + const SwPageDesc *pNewDesc) + { + const USHORT nCurIdx = pSh->GetCurPageDesc(); + const SwPageDesc &rCurrentDesc = pSh->GetPageDesc( nCurIdx ); + + const SwFmtPageDesc *pPageFmtDesc(0); + USHORT nDontCare; + lcl_GetPageDesc(pSh, nDontCare, &pPageFmtDesc); + + //If we want a new number then set it, otherwise reuse the existing one + USHORT nPgNo = nNewNumber ? + nNewNumber : ( pPageFmtDesc ? pPageFmtDesc->GetNumOffset() : 0 ); + + //If we want a new descriptior then set it, otherwise reuse the existing one + if (!pNewDesc) + { + SwFmtPageDesc aPageFmtDesc(pPageFmtDesc ? *pPageFmtDesc : &rCurrentDesc); + if (nPgNo) aPageFmtDesc.SetNumOffset(nPgNo); + pSh->SetAttr(aPageFmtDesc); + } + else + { + SwFmtPageDesc aPageFmtDesc(pNewDesc); + if (nPgNo) aPageFmtDesc.SetNumOffset(nPgNo); + pSh->SetAttr(aPageFmtDesc); + } + + delete pPageFmtDesc; + } + + void lcl_PushCursor(SwWrtShell *pSh) + { + pSh->LockView( TRUE ); + pSh->StartAllAction(); + pSh->SwCrsrShell::Push(); + } + + void lcl_PopCursor(SwWrtShell *pSh) + { + pSh->SwCrsrShell::Pop( FALSE ); + pSh->EndAllAction(); + pSh->LockView( FALSE ); + } + + USHORT lcl_GetCurrentPage(SwWrtShell *pSh) + { + String sDummy; + USHORT nPhyNum=1, nVirtNum=1; + pSh->GetPageNumber(0, true, nPhyNum, nVirtNum, sDummy); + return nPhyNum; + } +} + +/* + * Only include the Index page in the list if the page count implies one + * to reduce confusing things + */ +void SwTitlePageDlg::FillList() +{ + USHORT nTitlePages = aPageCountNF.GetValue(); + aPagePropertiesLB.Clear(); + if (mpTitleDesc) + aPagePropertiesLB.InsertEntry(mpTitleDesc->GetName()); + if (nTitlePages > 1 && mpIndexDesc) + aPagePropertiesLB.InsertEntry(mpIndexDesc->GetName()); + if (mpNormalDesc) + aPagePropertiesLB.InsertEntry(mpNormalDesc->GetName()); + aPagePropertiesLB.SelectEntryPos(0); +} + +USHORT SwTitlePageDlg::GetInsertPosition() const +{ + USHORT nPage = 1; + if (aPageStartNF.IsEnabled()) + nPage = aPageStartNF.GetValue(); + return nPage; +} + +SwTitlePageDlg::SwTitlePageDlg( Window *pParent ) : + SfxModalDialog( pParent, SW_RES(DLG_TITLEPAGE) ), +#pragma warning (disable : 4355) + aMakeInsertFL ( this, SW_RES( FL_MAKEINSERT )), + aUseExistingPagesRB ( this, SW_RES( RB_USE_EXISTING_PAGES )), + aInsertNewPagesRB ( this, SW_RES( RB_INSERT_NEW_PAGES )), + aPageCountFT ( this, SW_RES( FT_PAGE_COUNT )), + aPageCountNF ( this, SW_RES( NF_PAGE_COUNT )), + aPagePagesFT ( this, SW_RES( FT_PAGE_PAGES )), + aPageStartFT ( this, SW_RES( FT_PAGE_START )), + aDocumentStartRB ( this, SW_RES( RB_DOCUMENT_START )), + aPageStartRB ( this, SW_RES( RB_PAGE_START )), + aPageStartNF ( this, SW_RES( NF_PAGE_START )), + aNumberingFL ( this, SW_RES( FL_NUMBERING )), + aRestartNumberingCB ( this, SW_RES( CB_RESTART_NUMBERING )), + aRestartNumberingFT ( this, SW_RES( FT_RESTART_NUMBERING )), + aRestartNumberingNF ( this, SW_RES( NF_RESTART_NUMBERING )), + aSetPageNumberCB ( this, SW_RES( CB_SET_PAGE_NUMBER )), + aSetPageNumberFT ( this, SW_RES( FT_SET_PAGE_NUMBER )), + aSetPageNumberNF ( this, SW_RES( NF_SET_PAGE_NUMBER )), + aPagePropertiesFL ( this, SW_RES( FL_PAGE_PROPERTIES )), + aPagePropertiesLB ( this, SW_RES( LB_PAGE_PROPERTIES )), + aPagePropertiesPB ( this, SW_RES( PB_PAGE_PROPERTIES )), + aBottomFL ( this, SW_RES( FL_BOTTOM )), + aOkPB ( this, SW_RES( PB_OK )), + aCancelPB ( this, SW_RES( PB_CANCEL )), + aHelpPB ( this, SW_RES( PB_HELP )), + mpPageFmtDesc (0) +#pragma warning (default : 4355) +{ + FreeResource(); + + aOkPB.SetClickHdl(LINK(this, SwTitlePageDlg, OKHdl)); + aRestartNumberingCB.SetClickHdl(LINK(this, SwTitlePageDlg, RestartNumberingHdl)); + aSetPageNumberCB.SetClickHdl(LINK(this, SwTitlePageDlg, SetPageNumberHdl)); + + USHORT nSetPage = 1; + USHORT nResetPage = 1; + USHORT nTitlePages = 1; + mpSh = ::GetActiveView()->GetWrtShellPtr(); + lcl_PushCursor(mpSh); + + SwView& rView = mpSh->GetView(); + rView.InvalidateRulerPos(); + + bool bMaybeResetNumbering = false; + + mpTitleDesc = mpSh->GetPageDescFromPool(RES_POOLPAGE_FIRST); + mpIndexDesc = mpSh->GetPageDescFromPool(RES_POOLPAGE_REGISTER); + mpNormalDesc = mpSh->GetPageDescFromPool(RES_POOLPAGE_STANDARD); + + mpSh->SttDoc(); + if (lcl_GetPageDesc( mpSh, nSetPage, &mpPageFmtDesc )) + { + if (mpPageFmtDesc->GetPageDesc() == mpTitleDesc) + { + while (mpSh->SttNxtPg()) + { + const USHORT nCurIdx = mpSh->GetCurPageDesc(); + const SwPageDesc &rPageDesc = mpSh->GetPageDesc( nCurIdx ); + + if (mpIndexDesc != &rPageDesc) + { + mpNormalDesc = &rPageDesc; + bMaybeResetNumbering = lcl_GetPageDesc(mpSh, nResetPage, NULL); + break; + } + ++nTitlePages; + } + } + } + lcl_PopCursor(mpSh); + + aUseExistingPagesRB.Check(); + aPageCountNF.SetValue(nTitlePages); + aPageCountNF.SetUpHdl(LINK(this, SwTitlePageDlg, UpHdl)); + aPageCountNF.SetDownHdl(LINK(this, SwTitlePageDlg, DownHdl)); + + aDocumentStartRB.Check(); + aPageStartNF.Enable(false); + aPageStartNF.SetValue(lcl_GetCurrentPage(mpSh)); + Link aStartPageHdl = LINK(this, SwTitlePageDlg, StartPageHdl); + aDocumentStartRB.SetClickHdl(aStartPageHdl); + aPageStartRB.SetClickHdl(aStartPageHdl); + + if (bMaybeResetNumbering && nResetPage > 0) + { + aRestartNumberingCB.Check(); + aRestartNumberingNF.SetValue(nResetPage); + } + aRestartNumberingNF.Enable(aRestartNumberingCB.IsChecked()); + + aSetPageNumberNF.SetValue(nSetPage); + if (nSetPage > 1) + aSetPageNumberCB.Check(); + aSetPageNumberNF.Enable(aSetPageNumberCB.IsChecked()); + + FillList(); + aPagePropertiesPB.SetClickHdl(LINK(this, SwTitlePageDlg, EditHdl)); +} + +IMPL_LINK(SwTitlePageDlg, UpHdl, NumericField *, EMPTYARG) +{ + if (aPageCountNF.GetValue() == 2) + FillList(); + return 0; +} + +IMPL_LINK(SwTitlePageDlg, DownHdl, NumericField *, EMPTYARG) +{ + if (aPageCountNF.GetValue() == 1) + FillList(); + return 0; +} + +IMPL_LINK(SwTitlePageDlg, RestartNumberingHdl, CheckBox*, EMPTYARG) +{ + aRestartNumberingNF.Enable(aRestartNumberingCB.IsChecked()); + return 0; +} + +IMPL_LINK(SwTitlePageDlg, SetPageNumberHdl, CheckBox*, EMPTYARG) +{ + aSetPageNumberNF.Enable(aSetPageNumberCB.IsChecked()); + return 0; +} + +IMPL_LINK(SwTitlePageDlg, StartPageHdl, RadioButton*, EMPTYARG) +{ + aPageStartNF.Enable(aPageStartRB.IsChecked()); + return 0; +} + +__EXPORT SwTitlePageDlg::~SwTitlePageDlg() +{ + delete mpPageFmtDesc; +} + +IMPL_LINK( SwTitlePageDlg, EditHdl, Button *, /*pBtn*/ ) +{ + SwView& rView = mpSh->GetView(); + rView.GetDocShell()->FormatPage(aPagePropertiesLB.GetSelectEntry(), false, mpSh); + rView.InvalidateRulerPos(); + + return 0; +} + +IMPL_LINK( SwTitlePageDlg, OKHdl, Button *, /*pBtn*/ ) +{ + lcl_PushCursor(mpSh); + + mpSh->StartUndo(); + + SwFmtPageDesc aTitleDesc(mpTitleDesc); + + if (aSetPageNumberCB.IsChecked()) + aTitleDesc.SetNumOffset(aSetPageNumberNF.GetValue()); + else if (mpPageFmtDesc) + aTitleDesc.SetNumOffset(mpPageFmtDesc->GetNumOffset()); + + USHORT nNoPages = aPageCountNF.GetValue(); + if (!aUseExistingPagesRB.IsChecked()) + { + mpSh->GotoPage(GetInsertPosition(), false); + for (USHORT nI=0; nI < nNoPages; ++nI) + mpSh->InsertPageBreak(); + } + + mpSh->GotoPage(GetInsertPosition(), false); + for (USHORT nI=1; nI < nNoPages; ++nI) + { + if (mpSh->SttNxtPg()) + lcl_ChangePage(mpSh, 0, mpIndexDesc); + } + + mpSh->GotoPage(GetInsertPosition(), false); + mpSh->SetAttr(aTitleDesc); + + if (nNoPages > 1 && mpSh->GotoPage(GetInsertPosition() + nNoPages, false)) + { + SwFmtPageDesc aPageFmtDesc(mpNormalDesc); + mpSh->SetAttr(aPageFmtDesc); + } + + if (aRestartNumberingCB.IsChecked() || nNoPages > 1) + { + USHORT nPgNo = aRestartNumberingCB.IsChecked() ? aRestartNumberingNF.GetValue() : 0; + const SwPageDesc *pNewDesc = nNoPages > 1 ? mpNormalDesc : 0; + mpSh->GotoPage(GetInsertPosition() + nNoPages, false); + lcl_ChangePage(mpSh, nPgNo, pNewDesc); + } + + mpSh->EndUndo(); + lcl_PopCursor(mpSh); + if (!aUseExistingPagesRB.IsChecked()) + mpSh->GotoPage(GetInsertPosition(), false); + EndDialog( RET_OK ); + return 0; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/misc/titlepage.hrc b/sw/source/ui/misc/titlepage.hrc new file mode 100644 index 000000000000..63678427cfca --- /dev/null +++ b/sw/source/ui/misc/titlepage.hrc @@ -0,0 +1,50 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ +#define FL_MAKEINSERT 1 +#define RB_USE_EXISTING_PAGES 2 +#define RB_INSERT_NEW_PAGES 3 +#define FT_PAGE_COUNT 4 +#define NF_PAGE_COUNT 5 +#define FT_PAGE_PAGES 6 +#define FT_PAGE_START 7 +#define RB_DOCUMENT_START 8 +#define RB_PAGE_START 9 +#define NF_PAGE_START 10 +#define FL_NUMBERING 11 +#define CB_RESTART_NUMBERING 12 +#define FT_RESTART_NUMBERING 13 +#define NF_RESTART_NUMBERING 14 +#define CB_SET_PAGE_NUMBER 15 +#define FT_SET_PAGE_NUMBER 16 +#define NF_SET_PAGE_NUMBER 17 +#define FL_PAGE_PROPERTIES 18 +#define LB_PAGE_PROPERTIES 19 +#define PB_PAGE_PROPERTIES 20 +#define FL_BOTTOM 21 +#define PB_OK 22 +#define PB_CANCEL 23 +#define PB_HELP 24 diff --git a/sw/source/ui/misc/titlepage.src b/sw/source/ui/misc/titlepage.src new file mode 100644 index 000000000000..57b907586cf2 --- /dev/null +++ b/sw/source/ui/misc/titlepage.src @@ -0,0 +1,248 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ +/* StarView ressource file */ + +#include <sfx2/sfx.hrc> +#include <svx/dialogs.hrc> +#include "globals.hrc" +#include "misc.hrc" +#include "titlepage.hrc" +#include "helpid.h" +/**************************************************************************/ +/* */ +/**************************************************************************/ +ModalDialog DLG_TITLEPAGE +{ + HelpID = HID_TITLEPAGE ; + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 216 , 201 ) ; + Text [ en-US ] = "Title Pages" ; + Moveable = TRUE ; + + FixedLine FL_MAKEINSERT + { + Pos = MAP_APPFONT ( 6 , 5 ) ; + Size = MAP_APPFONT ( 204 , 8 ) ; + Text [ en-US ] = "Make Title Pages" ; + Text [ x-comment ] = " "; + }; + RadioButton RB_USE_EXISTING_PAGES + { + Pos = MAP_APPFONT ( 12 , 18 ) ; + Size = MAP_APPFONT ( 150 , 10 ) ; + Text [ en-US ] = "Convert existing pages to title pages" ; + TabStop = TRUE ; + Check = TRUE ; + Text [ x-comment ] = " "; + }; + RadioButton RB_INSERT_NEW_PAGES + { + Pos = MAP_APPFONT ( 12 , 34 ) ; + Size = MAP_APPFONT ( 150 , 10 ) ; + Text [ en-US ] = "Insert new title pages" ; + Text [ x-comment ] = " "; + }; + FixedText FT_PAGE_COUNT + { + Pos = MAP_APPFONT ( 12 , 50 ) ; + Size = MAP_APPFONT ( 80 , 8 ) ; + Text [ en-US ] = "Number of title pages" ; + Text [ x-comment ] = " "; + }; + NumericField NF_PAGE_COUNT + { + Pos = MAP_APPFONT ( 80 , 50 ) ; + Size = MAP_APPFONT ( 30 , 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + Maximum = 65535; + First = 1 ; + Last = 65535; + SpinSize = 1 ; + }; + FixedText FT_PAGE_PAGES + { + Pos = MAP_APPFONT ( 116 , 50 ) ; + Size = MAP_APPFONT ( 80 , 10 ) ; + Text [ en-US ] = "pages" ; + Text [ x-comment ] = " "; + }; + FixedText FT_PAGE_START + { + Pos = MAP_APPFONT ( 12 , 66 ) ; + Size = MAP_APPFONT ( 58 , 8 ) ; + Text [ en-US ] = "Place title pages at" ; + Text [ x-comment ] = " "; + }; + RadioButton RB_DOCUMENT_START + { + Pos = MAP_APPFONT ( 70 , 66 ) ; + Size = MAP_APPFONT ( 80 , 10 ) ; + Text [ en-US ] = "Document Start" ; + TabStop = TRUE ; + Check = TRUE ; + Text [ x-comment ] = " "; + }; + RadioButton RB_PAGE_START + { + Pos = MAP_APPFONT ( 70 , 78 ) ; + Size = MAP_APPFONT ( 30 , 10 ) ; + Text [ en-US ] = "Page" ; + Text [ x-comment ] = " "; + }; + NumericField NF_PAGE_START + { + Pos = MAP_APPFONT ( 95 , 78 ) ; + Size = MAP_APPFONT ( 30 , 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + Maximum = 65535; + First = 1 ; + Last = 65535; + SpinSize = 1 ; + }; + FixedLine FL_NUMBERING + { + Pos = MAP_APPFONT ( 6 , 98 ) ; + Size = MAP_APPFONT ( 204 , 8 ) ; + Text [ en-US ] = "Page Numbering" ; + Text [ x-comment ] = " "; + }; + CheckBox CB_RESTART_NUMBERING + { + Pos = MAP_APPFONT ( 12, 111 ) ; + Size = MAP_APPFONT ( 150 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Reset Page Numbering after title pages" ; + Text [ x-comment ] = " "; + }; + FixedText FT_RESTART_NUMBERING + { + Pos = MAP_APPFONT ( 140 , 111 ) ; + Size = MAP_APPFONT ( 50 , 10 ) ; + Text [ en-US ] = "Page Number" ; + Text [ x-comment ] = " "; + }; + NumericField NF_RESTART_NUMBERING + { + Pos = MAP_APPFONT ( 180 , 111 ) ; + Size = MAP_APPFONT ( 30 , 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + Maximum = 65535; + First = 1 ; + Last = 65535; + SpinSize = 1 ; + }; + CheckBox CB_SET_PAGE_NUMBER + { + Pos = MAP_APPFONT ( 12 , 125 ) ; + Size = MAP_APPFONT ( 150 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Set Page Number for first title page" ; + Text [ x-comment ] = " "; + }; + FixedText FT_SET_PAGE_NUMBER + { + Pos = MAP_APPFONT ( 140 , 125 ) ; + Size = MAP_APPFONT ( 50 , 10 ) ; + Text [ en-US ] = "Page Number" ; + Text [ x-comment ] = " "; + }; + NumericField NF_SET_PAGE_NUMBER + { + Pos = MAP_APPFONT ( 180 , 125 ) ; + Size = MAP_APPFONT ( 30 , 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + Maximum = 65535; + First = 1 ; + Last = 65535; + SpinSize = 1 ; + }; + FixedLine FL_PAGE_PROPERTIES + { + Pos = MAP_APPFONT ( 6 , 141 ) ; + Size = MAP_APPFONT ( 204 , 8 ) ; + Text [ en-US ] = "Edit Page Properties" ; + Text [ x-comment ] = " "; + }; + ListBox LB_PAGE_PROPERTIES + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 154 ) ; + Size = MAP_APPFONT ( 150 , 80 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + CurPos = 0 ; + }; + PushButton PB_PAGE_PROPERTIES + { + Pos = MAP_APPFONT ( 170 , 154 ) ; + Size = MAP_APPFONT ( 30 , 12 ) ; + Text [ en-US ] = "Edit..." ; + }; + FixedLine FL_BOTTOM + { + Pos = MAP_APPFONT ( 6 , 170 ) ; + Size = MAP_APPFONT ( 204 , 8 ) ; + }; + OKButton PB_OK + { + Pos = MAP_APPFONT ( 54 , 181 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + DefButton = TRUE ; + }; + CancelButton PB_CANCEL + { + Pos = MAP_APPFONT ( 107 , 181 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + DefButton = TRUE ; + }; + HelpButton PB_HELP + { + Pos = MAP_APPFONT ( 160 , 181 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + }; +}; diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx index a5e5ef83952e..2b852f6b9e8d 100644 --- a/sw/source/ui/shells/basesh.cxx +++ b/sw/source/ui/shells/basesh.cxx @@ -2394,6 +2394,14 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) switch ( nSlot ) { + case FN_FORMAT_TITLEPAGE_DLG: + { + SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); + VclAbstractDialog* pDlg = pFact->CreateTitlePageDlg( pMDI ); + pDlg->Execute(); + delete pDlg; + } + break; case FN_FORMAT_PAGE_COLUMN_DLG: case FN_FORMAT_PAGE_DLG: { diff --git a/sw/uiconfig/swriter/menubar/menubar.xml b/sw/uiconfig/swriter/menubar/menubar.xml index e32578c93434..82993b0cc7bb 100644 --- a/sw/uiconfig/swriter/menubar/menubar.xml +++ b/sw/uiconfig/swriter/menubar/menubar.xml @@ -217,6 +217,7 @@ <menu:menuitem menu:id=".uno:ParagraphDialog"/> <menu:menuitem menu:id=".uno:BulletsAndNumberingDialog"/> <menu:menuitem menu:id=".uno:PageDialog"/> + <menu:menuitem menu:id=".uno:TitlePageDialog"/> <menu:menuseparator/> <menu:menu menu:id=".uno:TransliterateMenu"> <menu:menupopup> diff --git a/sw/util/makefile.mk b/sw/util/makefile.mk index 39fa183ae5e9..72f2420da80a 100644 --- a/sw/util/makefile.mk +++ b/sw/util/makefile.mk @@ -256,6 +256,7 @@ LIB3OBJFILES = \ $(SLO)$/instable.obj \ $(SLO)$/insrule.obj \ $(SLO)$/javaedit.obj \ + $(SLO)$/titlepage.obj \ $(SLO)$/linenum.obj \ $(SLO)$/mailmrge.obj \ $(SLO)$/multmrk.obj \ |