[Libreoffice-commits] .: Branch 'feature/cmclayouttrans' - sw/inc sw/source
Caolán McNamara
caolan at kemper.freedesktop.org
Fri Aug 17 02:08:01 PDT 2012
sw/inc/globals.hrc | 2
sw/source/ui/inc/linenum.hxx | 49 +++---------
sw/source/ui/inc/titlepage.hxx | 4 -
sw/source/ui/misc/linenum.cxx | 155 ++++++++++++++++-------------------------
sw/source/ui/misc/linenum.hrc | 4 -
sw/source/ui/misc/linenum.src | 19 ++++-
6 files changed, 101 insertions(+), 132 deletions(-)
New commits:
commit 8dcd9ce4072c752c3914c46c93ae55accb2f1800
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Aug 17 10:07:51 2012 +0100
simplify line numbering dialog
Change-Id: I3bb2a0c6b3f468fc37332d8f390aac3290f129c3
diff --git a/sw/inc/globals.hrc b/sw/inc/globals.hrc
index d6044b7..e6ed9dc 100644
--- a/sw/inc/globals.hrc
+++ b/sw/inc/globals.hrc
@@ -172,7 +172,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_OPTINSERT_PAGE (RC_GLOBALS_BEGIN + 77)
diff --git a/sw/source/ui/inc/linenum.hxx b/sw/source/ui/inc/linenum.hxx
index 119ea40..8e22638 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 b4ff9c1..0c4a653 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 81c466a..ed57ce1 100644
--- a/sw/source/ui/misc/linenum.cxx
+++ b/sw/source/ui/misc/linenum.cxx
@@ -52,36 +52,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 )),
@@ -104,8 +76,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 += String::CreateFromAscii("(");
@@ -119,23 +93,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();
@@ -184,60 +145,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());
@@ -287,7 +207,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 223764e..714a69b 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 0c92491..345c52f 100644
--- a/sw/source/ui/misc/linenum.src
+++ b/sw/source/ui/misc/linenum.src
@@ -39,7 +39,7 @@
/**************************************************************************/
/* */
/**************************************************************************/
-TabPage TP_LINENUMBERING
+ModalDialog DLG_LINENUMBERING
{
HelpID = HID_LINENUMBERING ;
SVLook = TRUE ;
@@ -241,5 +241,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" ;
};
More information about the Libreoffice-commits
mailing list