From 91042f3f0a4328bc46e17e8b32d5021003fb7e04 Mon Sep 17 00:00:00 2001 From: Cédric Bosdonnat Date: Thu, 8 Sep 2011 15:38:50 +0200 Subject: Header/Footer: implement the edit menu item Opens the page style at the header or footer tab. --- sw/inc/docsh.hxx | 4 ++-- sw/inc/swabstdlg.hxx | 2 +- sw/source/ui/app/docst.cxx | 8 ++++---- sw/source/ui/dialog/swdlgfact.cxx | 4 ++-- sw/source/ui/dialog/swdlgfact.hxx | 2 +- sw/source/ui/docvw/HeaderFooterWin.cxx | 16 ++++++++++++++-- sw/source/ui/fmtui/tmpdlg.cxx | 6 +++--- sw/source/ui/inc/tmpdlg.hxx | 2 +- sw/source/ui/shells/basesh.cxx | 6 ++++-- 9 files changed, 32 insertions(+), 18 deletions(-) diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx index 4f644afc40b0..96a1eaa9f3a4 100644 --- a/sw/inc/docsh.hxx +++ b/sw/inc/docsh.hxx @@ -112,7 +112,7 @@ class SW_DLLPUBLIC SwDocShell: public SfxObjectShell, public SfxListener // Methods for StyleSheets SW_DLLPRIVATE sal_uInt16 Edit( const String &rName, const String& rParent, sal_uInt16 nFamily, sal_uInt16 nMask, sal_Bool bNew, - sal_Bool bColumn = sal_False, + sal_uInt16 nPageId = 0, SwWrtShell* pActShell = 0, sal_Bool bBasic = sal_False ); SW_DLLPRIVATE sal_uInt16 Delete(const String &rName, sal_uInt16 nFamily); @@ -254,7 +254,7 @@ public: // Display dialog for page style. If required display column page. void FormatPage( const String& rPage, - sal_Bool bColumn = sal_False, + sal_uInt16 nPageId = 0, SwWrtShell* pActShell = 0 ); // #i59688# diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index 13bf919c73a0..b92816993740 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -427,7 +427,7 @@ public: Window* pParent, SfxStyleSheetBase& rBase, sal_uInt16 nRegion, - sal_Bool bColumn = sal_False, + sal_uInt16 nPageId = 0, SwWrtShell* pActShell = 0, sal_Bool bNew = sal_False ) = 0; //add for SwTemplateDlg virtual AbstractGlossaryDlg* CreateGlossaryDlg( int nResId, diff --git a/sw/source/ui/app/docst.cxx b/sw/source/ui/app/docst.cxx index 847e629d454c..8455a400945c 100644 --- a/sw/source/ui/app/docst.cxx +++ b/sw/source/ui/app/docst.cxx @@ -508,7 +508,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) sal_uInt16 SwDocShell::Edit( const String &rName, const String &rParent, sal_uInt16 nFamily, sal_uInt16 nMask, - sal_Bool bNew, sal_Bool bColumn, SwWrtShell* pActShell, + sal_Bool bNew, sal_uInt16 nPageId, SwWrtShell* pActShell, sal_Bool bBasic ) { OSL_ENSURE(GetWrtShell(), "No Shell, no Styles"); @@ -660,7 +660,7 @@ sal_uInt16 SwDocShell::Edit( const String &rName, const String &rParent, sal_uIn SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "Dialogdiet fail!"); SfxAbstractTabDialog* pDlg = pFact->CreateTemplateDialog( DLG_TEMPLATE_BASE, - 0, *(xTmp.get()), nFamily, bColumn, + 0, *(xTmp.get()), nFamily, nPageId, pActShell ? pActShell : pWrtShell, bNew); OSL_ENSURE(pDlg, "Dialogdiet fail!"); while (true) @@ -1246,9 +1246,9 @@ void SwDocShell::_LoadStyles( SfxObjectShell& rSource, sal_Bool bPreserveCurrent } -void SwDocShell::FormatPage( const String& rPage, sal_Bool bColumn, SwWrtShell* pActShell ) +void SwDocShell::FormatPage( const String& rPage, sal_uInt16 nPageId, SwWrtShell* pActShell ) { - Edit( rPage, aEmptyStr, SFX_STYLE_FAMILY_PAGE, 0, sal_False, bColumn, pActShell); + Edit( rPage, aEmptyStr, SFX_STYLE_FAMILY_PAGE, 0, sal_False, nPageId, pActShell); } Bitmap SwDocShell::GetStyleFamilyBitmap( SfxStyleFamily eFamily ) diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index de00a12d5704..8a5505a75adc 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -1202,7 +1202,7 @@ SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateTemplateDialog( int nR Window* pParent, SfxStyleSheetBase& rBase, sal_uInt16 nRegion, - sal_Bool bColumn, + sal_uInt16 nPageId, SwWrtShell* pActShell, sal_Bool bNew ) //add for SwTemplateDlg { @@ -1210,7 +1210,7 @@ SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateTemplateDialog( int nR switch ( nResId ) { case DLG_TEMPLATE_BASE : - pDlg = new SwTemplateDlg( pParent, rBase, nRegion, bColumn, pActShell, bNew ); + pDlg = new SwTemplateDlg( pParent, rBase, nRegion, nPageId, pActShell, bNew ); break; default: break; diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index 9b883eaa979f..e13ccfd7e84e 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -506,7 +506,7 @@ public: Window* pParent, SfxStyleSheetBase& rBase, sal_uInt16 nRegion, - sal_Bool bColumn = sal_False, + sal_uInt16 nPageId = 0, SwWrtShell* pActShell = 0, sal_Bool bNew = sal_False ); //add for SwTemplateDlg virtual AbstractGlossaryDlg* CreateGlossaryDlg( int nResId, diff --git a/sw/source/ui/docvw/HeaderFooterWin.cxx b/sw/source/ui/docvw/HeaderFooterWin.cxx index 1dffb6e35edb..e926d5406bcb 100644 --- a/sw/source/ui/docvw/HeaderFooterWin.cxx +++ b/sw/source/ui/docvw/HeaderFooterWin.cxx @@ -28,10 +28,12 @@ #include #include +#include #include #include #include +#include #include #include #include @@ -252,7 +254,17 @@ void SwHeaderFooterWin::ExecuteCommand( sal_uInt16 nSlot ) switch ( nSlot ) { case FN_HEADERFOOTER_EDIT: - // TODO Implement me + { + SwView& rView = m_pEditWin->GetView(); + SwWrtShell& rSh = rView.GetWrtShell(); + sal_uInt16 nPageId = TP_FOOTER_PAGE; + if ( IsHeader() ) + nPageId = TP_HEADER_PAGE; + + rView.GetDocShell()->FormatPage( + GetPageFrame()->GetPageDesc()->GetName(), + nPageId, &rSh ); + } break; case FN_HEADERFOOTER_DELETE: ChangeHeaderOrFooter( false ); @@ -274,7 +286,7 @@ SwHeaderFooterButton::SwHeaderFooterButton( SwHeaderFooterWin* pWindow ) : SwHeaderFooterButton::~SwHeaderFooterButton( ) { - delete m_pWindow; + delete m_pPopupMenu; } void SwHeaderFooterButton::Paint( const Rectangle& ) diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx index 55cf1cc1dc0b..5f88ae761cb7 100644 --- a/sw/source/ui/fmtui/tmpdlg.cxx +++ b/sw/source/ui/fmtui/tmpdlg.cxx @@ -97,7 +97,7 @@ extern SW_DLLPUBLIC SwWrtShell* GetActiveWrtShell(); SwTemplateDlg::SwTemplateDlg(Window* pParent, SfxStyleSheetBase& rBase, sal_uInt16 nRegion, - sal_Bool bColumn, + sal_uInt16 nPageId, SwWrtShell* pActShell, sal_Bool bNew ) : SfxStyleDialog( pParent, @@ -263,8 +263,8 @@ SwTemplateDlg::SwTemplateDlg(Window* pParent, AddTabPage(TP_FOOTER_PAGE, String(SW_RES(STR_PAGE_FOOTER)), SvxFooterPage::Create, SvxFooterPage::GetRanges ); - if(bColumn) - SetCurPageId(TP_COLUMN); + if(nPageId) + SetCurPageId(nPageId); OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ), "GetTabPageCreatorFunc fail!"); OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_PAGE ), "GetTabPageRangesFunc fail!"); diff --git a/sw/source/ui/inc/tmpdlg.hxx b/sw/source/ui/inc/tmpdlg.hxx index 966ec13be1e5..f76b2b0a4d06 100644 --- a/sw/source/ui/inc/tmpdlg.hxx +++ b/sw/source/ui/inc/tmpdlg.hxx @@ -51,7 +51,7 @@ public: SwTemplateDlg( Window* pParent, SfxStyleSheetBase& rBase, sal_uInt16 nRegion, - sal_Bool bColumn = sal_False, + sal_uInt16 nPageId = 0, SwWrtShell* pActShell = 0, sal_Bool bNew = sal_False ); diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx index 4659fac0decb..ce79ff39d9df 100644 --- a/sw/source/ui/shells/basesh.cxx +++ b/sw/source/ui/shells/basesh.cxx @@ -2388,9 +2388,11 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) //temp. View, weil die Shell nach dem Dialog nicht mehr gueltig sein muss //z.B. Kopfzeile ausschalten SwView& rTempView = GetView(); + sal_uInt16 nPageId = 0; + if ( nSlot == FN_FORMAT_PAGE_COLUMN_DLG ) + nPageId = TP_COLUMN ; rTempView.GetDocShell()->FormatPage(rPageDesc.GetName(), - nSlot == FN_FORMAT_PAGE_COLUMN_DLG, - &rSh ); + nPageId, &rSh ); rTempView.InvalidateRulerPos(); } } -- cgit