diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-08-17 10:07:51 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-09-28 08:48:36 +0100 |
commit | cd998eb98d23ad4c1e5d9e56d7fdb78731b3f2d6 (patch) | |
tree | 1e3c3d33151a78c691c3194e04941059797af8ec /sw | |
parent | 97f69c7f75e88d51530d8263f98f8dccaa72eebc (diff) |
simplify line numbering dialog
Change-Id: I3bb2a0c6b3f468fc37332d8f390aac3290f129c3
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/globals.hrc | 2 | ||||
-rw-r--r-- | sw/source/ui/inc/linenum.hxx | 49 | ||||
-rw-r--r-- | sw/source/ui/inc/titlepage.hxx | 4 | ||||
-rw-r--r-- | sw/source/ui/misc/linenum.cxx | 155 | ||||
-rw-r--r-- | sw/source/ui/misc/linenum.hrc | 4 | ||||
-rw-r--r-- | sw/source/ui/misc/linenum.src | 19 |
6 files changed, 101 insertions, 132 deletions
diff --git a/sw/inc/globals.hrc b/sw/inc/globals.hrc index 616ea64a2e7c..e21f729b7de6 100644 --- a/sw/inc/globals.hrc +++ b/sw/inc/globals.hrc @@ -170,7 +170,7 @@ #define TP_REDLINE_OPT (RC_GLOBALS_BEGIN + 74) -#define TP_LINENUMBERING (RC_GLOBALS_BEGIN + 75) +#define DLG_LINENUMBERING (RC_GLOBALS_BEGIN + 75) #define TP_OUTLINE_NUM (RC_GLOBALS_BEGIN + 76) #define TP_OPTCAPTION_PAGE (RC_GLOBALS_BEGIN + 78) diff --git a/sw/source/ui/inc/linenum.hxx b/sw/source/ui/inc/linenum.hxx index 119ea400e5bc..8e226387ac15 100644 --- a/sw/source/ui/inc/linenum.hxx +++ b/sw/source/ui/inc/linenum.hxx @@ -29,41 +29,23 @@ #define _SWLINENUM_HXX #include <sfx2/basedlgs.hxx> -#include <sfx2/tabdlg.hxx> -#include <vcl/fixed.hxx> +#include <vcl/button.hxx> #include <vcl/field.hxx> -#include <numberingtypelistbox.hxx> - +#include <vcl/fixed.hxx> #include <vcl/lstbox.hxx> +#include <numberingtypelistbox.hxx> class Window; -class SfxItemSet; class SwView; class SwWrtShell; -/*-------------------------------------------------------------------- - Description: SingleTabDialog - --------------------------------------------------------------------*/ -class SwLineNumberingDlg : public SfxSingleTabDialog +class SwLineNumberingDlg : public SfxModalDialog { +private: SwWrtShell* pSh; - DECL_LINK(OKHdl, void *); - -public: - inline SwWrtShell* GetWrtShell() const { return pSh; } - - SwLineNumberingDlg(SwView *pVw); - ~SwLineNumberingDlg(); -}; - -/*-------------------------------------------------------------------- - Description: TabPage - --------------------------------------------------------------------*/ -class SwLineNumberingPage : public SfxTabPage -{ CheckBox aNumberingOnCB; - FixedLine aDisplayFL; + FixedLine aDisplayFL; FixedText aCharStyleFT; ListBox aCharStyleLB; FixedText aFormatFT; @@ -75,31 +57,30 @@ class SwLineNumberingPage : public SfxTabPage FixedText aNumIntervalFT; NumericField aNumIntervalNF; FixedText aNumRowsFT; - FixedLine aDivisorFL; + FixedLine aDivisorFL; FixedText aDivisorFT; Edit aDivisorED; FixedText aDivIntervalFT; NumericField aDivIntervalNF; FixedText aDivRowsFT; - FixedLine aCountFL; + FixedLine aCountFL; CheckBox aCountEmptyLinesCB; CheckBox aCountFrameLinesCB; CheckBox aRestartEachPageCB; - SwWrtShell* pSh; - - SwLineNumberingPage( Window* pParent, const SfxItemSet& rSet ); - ~SwLineNumberingPage(); + OKButton aOkPB; + CancelButton aCancelPB; + HelpButton aHelpPB; + DECL_LINK(OKHdl, void *); DECL_LINK(LineOnOffHdl, void * = 0); DECL_LINK(ModifyHdl, void * = 0); public: + SwWrtShell* GetWrtShell() const { return pSh; } - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet ); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); + SwLineNumberingDlg(SwView *pVw); + ~SwLineNumberingDlg(); }; #endif diff --git a/sw/source/ui/inc/titlepage.hxx b/sw/source/ui/inc/titlepage.hxx index b4ff9c1430ad..0c4a653596b8 100644 --- a/sw/source/ui/inc/titlepage.hxx +++ b/sw/source/ui/inc/titlepage.hxx @@ -31,9 +31,9 @@ #define _SWTITLEPAGE_HXX #include <sfx2/basedlgs.hxx> -#include <sfx2/tabdlg.hxx> -#include <vcl/fixed.hxx> +#include <vcl/button.hxx> #include <vcl/field.hxx> +#include <vcl/fixed.hxx> #include <vcl/lstbox.hxx> #include <numberingtypelistbox.hxx> diff --git a/sw/source/ui/misc/linenum.cxx b/sw/source/ui/misc/linenum.cxx index cddfd06e3545..fd54d3006614 100644 --- a/sw/source/ui/misc/linenum.cxx +++ b/sw/source/ui/misc/linenum.cxx @@ -46,36 +46,8 @@ #include <IDocumentStylePoolAccess.hxx> SwLineNumberingDlg::SwLineNumberingDlg(SwView *pVw) : - SfxSingleTabDialog(&pVw->GetViewFrame()->GetWindow(), 0, 0), - pSh(pVw->GetWrtShellPtr()) -{ - // create TabPage - SetTabPage(SwLineNumberingPage::Create(this, *(SfxItemSet*)0)); - - GetOKButton()->SetClickHdl(LINK(this, SwLineNumberingDlg, OKHdl)); -} - -SwLineNumberingDlg::~SwLineNumberingDlg() -{ -} - -IMPL_LINK_NOARG(SwLineNumberingDlg, OKHdl) -{ - if (GetOKButton()->IsEnabled()) - { - SfxTabPage* pCurPage = GetTabPage(); - if( pCurPage ) - pCurPage->FillItemSet(*(SfxItemSet*)0); - - EndDialog( RET_OK ); - } - - return 0; -} - -SwLineNumberingPage::SwLineNumberingPage( Window* pParent, - const SfxItemSet& rSet ) - : SfxTabPage(pParent, SW_RES(TP_LINENUMBERING), rSet), + SfxModalDialog(&pVw->GetViewFrame()->GetWindow(), SW_RES(DLG_LINENUMBERING)), + pSh(pVw->GetWrtShellPtr()), aNumberingOnCB ( this, SW_RES( CB_NUMBERING_ON )), aDisplayFL ( this, SW_RES( FL_DISPLAY )), aCharStyleFT ( this, SW_RES( FT_CHAR_STYLE )), @@ -98,8 +70,10 @@ SwLineNumberingPage::SwLineNumberingPage( Window* pParent, aCountFL ( this, SW_RES( FL_COUNT )), aCountEmptyLinesCB ( this, SW_RES( CB_COUNT_EMPTYLINES )), aCountFrameLinesCB ( this, SW_RES( CB_COUNT_FRAMELINES )), - aRestartEachPageCB ( this, SW_RES( CB_RESTART_PAGE )) - + aRestartEachPageCB ( this, SW_RES( CB_RESTART_PAGE )), + aOkPB ( this, SW_RES( PB_OK )), + aCancelPB ( this, SW_RES( PB_CANCEL )), + aHelpPB ( this, SW_RES( PB_HELP )) { String sIntervalName = aDivIntervalFT.GetAccessibleName(); sIntervalName += rtl::OUString("("); @@ -113,23 +87,10 @@ SwLineNumberingPage::SwLineNumberingPage( Window* pParent, aNumIntervalNF.SetAccessibleName(sIntervalName); FreeResource(); - SwLineNumberingDlg *pDlg = (SwLineNumberingDlg *)GetParent(); - pSh = pDlg->GetWrtShell(); + // char styles ::FillCharStyleListBox(aCharStyleLB, pSh->GetView().GetDocShell()); -} - -SwLineNumberingPage::~SwLineNumberingPage() -{ -} -SfxTabPage* SwLineNumberingPage::Create( Window* pParent, const SfxItemSet& rSet ) -{ - return new SwLineNumberingPage( pParent, rSet ); -} - -void SwLineNumberingPage::Reset( const SfxItemSet& ) -{ const SwLineNumberInfo &rInf = pSh->GetLineNumberInfo(); IDocumentStylePoolAccess* pIDSPA = pSh->getIDocumentStylePoolAccess(); @@ -178,60 +139,19 @@ void SwLineNumberingPage::Reset( const SfxItemSet& ) aNumberingOnCB.Check(rInf.IsPaintLineNumbers()); - aNumberingOnCB.SetClickHdl(LINK(this, SwLineNumberingPage, LineOnOffHdl)); - aDivisorED.SetModifyHdl(LINK(this, SwLineNumberingPage, ModifyHdl)); + aNumberingOnCB.SetClickHdl(LINK(this, SwLineNumberingDlg, LineOnOffHdl)); + aDivisorED.SetModifyHdl(LINK(this, SwLineNumberingDlg, ModifyHdl)); ModifyHdl(); LineOnOffHdl(); -} -/*-------------------------------------------------------------------- - Description: modify - --------------------------------------------------------------------*/ -IMPL_LINK_NOARG(SwLineNumberingPage, ModifyHdl) -{ - sal_Bool bHasValue = aDivisorED.GetText().Len() != 0; - - aDivIntervalFT.Enable(bHasValue); - aDivIntervalNF.Enable(bHasValue); - aDivRowsFT.Enable(bHasValue); - - return 0; + aOkPB.SetClickHdl(LINK(this, SwLineNumberingDlg, OKHdl)); } -/*-------------------------------------------------------------------- - Description: On/Off - --------------------------------------------------------------------*/ -IMPL_LINK_NOARG(SwLineNumberingPage, LineOnOffHdl) +SwLineNumberingDlg::~SwLineNumberingDlg() { - sal_Bool bEnable = aNumberingOnCB.IsChecked(); - - aCharStyleFT.Enable(bEnable); - aCharStyleLB.Enable(bEnable); - aFormatFT.Enable(bEnable); - aFormatLB.Enable(bEnable); - aPosFT.Enable(bEnable); - aPosLB.Enable(bEnable); - aOffsetFT.Enable(bEnable); - aOffsetMF.Enable(bEnable); - aNumIntervalFT.Enable(bEnable); - aNumIntervalNF.Enable(bEnable); - aNumRowsFT.Enable(bEnable); - aDisplayFL.Enable(bEnable); - aDivisorFT.Enable(bEnable); - aDivisorED.Enable(bEnable); - aDivIntervalFT.Enable(bEnable); - aDivIntervalNF.Enable(bEnable); - aDivRowsFT.Enable(bEnable); - aDivisorFL.Enable(bEnable); - aCountEmptyLinesCB.Enable(bEnable); - aCountFrameLinesCB.Enable(bEnable); - aRestartEachPageCB.Enable(bEnable); - aCountFL.Enable(bEnable); - - return 0; } -sal_Bool SwLineNumberingPage::FillItemSet( SfxItemSet& ) +IMPL_LINK_NOARG(SwLineNumberingDlg, OKHdl) { SwLineNumberInfo aInf(pSh->GetLineNumberInfo()); @@ -281,7 +201,56 @@ sal_Bool SwLineNumberingPage::FillItemSet( SfxItemSet& ) pSh->SetLineNumberInfo(aInf); - return sal_False; + EndDialog( RET_OK ); + + return 0; +} + +/*-------------------------------------------------------------------- + Description: modify + --------------------------------------------------------------------*/ +IMPL_LINK_NOARG(SwLineNumberingDlg, ModifyHdl) +{ + sal_Bool bHasValue = aDivisorED.GetText().Len() != 0; + + aDivIntervalFT.Enable(bHasValue); + aDivIntervalNF.Enable(bHasValue); + aDivRowsFT.Enable(bHasValue); + + return 0; +} + +/*-------------------------------------------------------------------- + Description: On/Off + --------------------------------------------------------------------*/ +IMPL_LINK_NOARG(SwLineNumberingDlg, LineOnOffHdl) +{ + sal_Bool bEnable = aNumberingOnCB.IsChecked(); + + aCharStyleFT.Enable(bEnable); + aCharStyleLB.Enable(bEnable); + aFormatFT.Enable(bEnable); + aFormatLB.Enable(bEnable); + aPosFT.Enable(bEnable); + aPosLB.Enable(bEnable); + aOffsetFT.Enable(bEnable); + aOffsetMF.Enable(bEnable); + aNumIntervalFT.Enable(bEnable); + aNumIntervalNF.Enable(bEnable); + aNumRowsFT.Enable(bEnable); + aDisplayFL.Enable(bEnable); + aDivisorFT.Enable(bEnable); + aDivisorED.Enable(bEnable); + aDivIntervalFT.Enable(bEnable); + aDivIntervalNF.Enable(bEnable); + aDivRowsFT.Enable(bEnable); + aDivisorFL.Enable(bEnable); + aCountEmptyLinesCB.Enable(bEnable); + aCountFrameLinesCB.Enable(bEnable); + aRestartEachPageCB.Enable(bEnable); + aCountFL.Enable(bEnable); + + return 0; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/misc/linenum.hrc b/sw/source/ui/misc/linenum.hrc index 223764e5cffc..714a69b9daba 100644 --- a/sw/source/ui/misc/linenum.hrc +++ b/sw/source/ui/misc/linenum.hrc @@ -38,4 +38,6 @@ #define CB_COUNT_FRAMELINES 21 #define FL_COUNT 22 #define CB_RESTART_PAGE 23 - +#define PB_OK 24 +#define PB_CANCEL 25 +#define PB_HELP 26 diff --git a/sw/source/ui/misc/linenum.src b/sw/source/ui/misc/linenum.src index 358bba996464..ac32287e513e 100644 --- a/sw/source/ui/misc/linenum.src +++ b/sw/source/ui/misc/linenum.src @@ -33,7 +33,7 @@ #include "linenum.hrc" #include "helpid.h" -TabPage TP_LINENUMBERING +ModalDialog DLG_LINENUMBERING { HelpID = HID_LINENUMBERING ; SVLook = TRUE ; @@ -235,5 +235,22 @@ TabPage TP_LINENUMBERING Size = MAP_APPFONT ( 121 , 8 ) ; Text [ en-US ] = "Count" ; }; + OKButton PB_OK + { + Pos = MAP_APPFONT ( 54 , 170 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + DefButton = TRUE ; + }; + CancelButton PB_CANCEL + { + Pos = MAP_APPFONT ( 107 , 170 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + DefButton = TRUE ; + }; + HelpButton PB_HELP + { + Pos = MAP_APPFONT ( 160 , 170 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + }; Text [ en-US ] = "Line Numbering" ; }; |