summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Cruz <rpmcruz@alunos.dcc.fc.up.pt>2010-12-16 17:17:44 +0000
committerMichael Meeks <michael.meeks@novell.com>2011-07-21 11:34:01 +0100
commit5d8f9cb130c546408f33c12851b525180078f29a (patch)
treeb7b5c14d1af8e403b796bc10e4cb07d55bf69bb0
parentb77c9a6716a76fb0ccea9a389482ac9dfdf7dce4 (diff)
Word count dialog: use vcl layout code.
-rw-r--r--sw/source/ui/dialog/wordcountdialog.cxx110
-rw-r--r--sw/source/ui/inc/wordcountdialog.hxx37
2 files changed, 123 insertions, 24 deletions
diff --git a/sw/source/ui/dialog/wordcountdialog.cxx b/sw/source/ui/dialog/wordcountdialog.cxx
index 808e169859..1d022c6f19 100644
--- a/sw/source/ui/dialog/wordcountdialog.cxx
+++ b/sw/source/ui/dialog/wordcountdialog.cxx
@@ -39,6 +39,7 @@
#include <layout/layout-pre.hxx>
#include <wordcountdialog.hrc>
+#if 0
#if ENABLE_LAYOUT
#undef SW_RES
#define SW_RES(x) #x
@@ -80,6 +81,103 @@ SwWordCountDialog::SwWordCountDialog(Window* pParent) :
#endif /* ENABLE_LAYOUT */
FreeResource();
}
+#endif
+
+#include <vcl/box.hxx>
+#include <vcl/table.hxx>
+#include <vcl/notebook.hxx>
+
+SwWordCountDialog::SwWordCountDialog (Window* parent) :
+ LDialog(parent)
+{
+ // create widgets
+
+ aCurrentWordFT = new FixedText (this);
+ aCurrentWordFT->SetText (String::CreateFromAscii ("Words:"));
+ aCurrentWordFI = new FixedInfo (this);
+
+ aCurrentCharacterFT = new FixedText (this);
+ aCurrentCharacterFT->SetText (String::CreateFromAscii ("Characters:"));
+ aCurrentCharacterFI = new FixedInfo (this);
+
+ aCurrentCharacterExcludingSpacesFT = new FixedText (this);
+ aCurrentCharacterExcludingSpacesFT->SetText (String::CreateFromAscii ("Characters excluding spaces:"));
+ aCurrentCharacterExcludingSpacesFI = new FixedInfo (this);
+
+ aDocWordFT = new FixedText (this);
+ aDocWordFT->SetText (String::CreateFromAscii ("Words:"));
+ aDocWordFI = new FixedInfo (this);
+
+ aDocCharacterFT = new FixedText (this);
+ aDocCharacterFT->SetText (String::CreateFromAscii ("Characters:"));
+ aDocCharacterFI = new FixedInfo (this);
+
+ aDocCharacterExcludingSpacesFT = new FixedText (this);
+ aDocCharacterExcludingSpacesFT->SetText (String::CreateFromAscii ("Characters excluding spaces:"));
+ aDocCharacterExcludingSpacesFI = new FixedInfo (this);
+
+#if 1
+ // create layout
+
+ Notebook *notebook = new Notebook (this);
+ for (int page = 0; page < 2; page++) {
+ VBox *labels_box = new VBox (false, 6);
+ VBox *counts_box = new VBox (false, 6);
+
+ String str;
+ switch (page) {
+ case 0:
+ str = String::CreateFromAscii ("Whole Document");
+ labels_box->Pack (aCurrentWordFT, false, true);
+ labels_box->Pack (aCurrentCharacterFT, false, true);
+ labels_box->Pack (aCurrentCharacterExcludingSpacesFT, false, true);
+
+ counts_box->Pack (aCurrentWordFI, false, true);
+ counts_box->Pack (aCurrentCharacterFI, false, true);
+ counts_box->Pack (aCurrentCharacterExcludingSpacesFI, false, true);
+ break;
+ case 1:
+ str = String::CreateFromAscii ("Selected Text");
+ labels_box->Pack (aDocWordFT, false, true);
+ labels_box->Pack (aDocCharacterFT, false, true);
+ labels_box->Pack (aDocCharacterExcludingSpacesFT, false, true);
+
+ counts_box->Pack (aDocWordFI, false, true);
+ counts_box->Pack (aDocCharacterFI, false, true);
+ counts_box->Pack (aDocCharacterExcludingSpacesFI, false, true);
+ break;
+ }
+
+ Box *cols = new HBox (false, 6);
+ // FIXME: expand should be false ...
+ cols->Pack (labels_box, true, true);
+ cols->Pack (counts_box, true, true);
+
+ notebook->AddPage (str, cols);
+ }
+
+ Button *button = new Button (this);
+ button->SetText (String::CreateFromAscii ("Hello !"));
+ notebook->AddPage (String::CreateFromAscii ("Test Tab"), button);
+
+ Box *buttons_box = new HBox (true, 6);
+ aHelp = new HelpButton (this);
+ aOK = new OKButton (this);
+ buttons_box->Pack (aHelp, false, true);
+ buttons_box->Pack (aOK, true, true);
+
+ Box *vbox = new VBox (false, 12);
+ vbox->SetBorderWidth (6);
+ vbox->Pack (notebook, notebook, true, true);
+ vbox->Pack (buttons_box, false, true);
+
+ ::Layout::ShowAll (vbox);
+ SetText (String::CreateFromAscii ("Word Count"));
+// vbox->SetPosSizePixel (0, 0, width, height, WINDOW_POSSIZE_ALL);
+#endif
+
+// FreeResource();
+}
SwWordCountDialog::~SwWordCountDialog()
{
@@ -87,12 +185,12 @@ SwWordCountDialog::~SwWordCountDialog()
void SwWordCountDialog::SetValues(const SwDocStat& rCurrent, const SwDocStat& rDoc)
{
- aCurrentWordFI.SetText( String::CreateFromInt32(rCurrent.nWord ));
- aCurrentCharacterFI.SetText(String::CreateFromInt32(rCurrent.nChar ));
- aCurrentCharacterExcludingSpacesFI.SetText(String::CreateFromInt32(rCurrent.nCharExcludingSpaces ));
- aDocWordFI.SetText( String::CreateFromInt32(rDoc.nWord ));
- aDocCharacterFI.SetText( String::CreateFromInt32(rDoc.nChar ));
- aDocCharacterExcludingSpacesFI.SetText( String::CreateFromInt32(rDoc.nCharExcludingSpaces ));
+ aCurrentWordFI->SetText( String::CreateFromInt32(rCurrent.nWord ));
+ aCurrentCharacterFI->SetText(String::CreateFromInt32(rCurrent.nChar ));
+ aCurrentCharacterExcludingSpacesFI->SetText(String::CreateFromInt32(rCurrent.nCharExcludingSpaces ));
+ aDocWordFI->SetText( String::CreateFromInt32(rDoc.nWord ));
+ aDocCharacterFI->SetText( String::CreateFromInt32(rDoc.nChar ));
+ aDocCharacterExcludingSpacesFI->SetText( String::CreateFromInt32(rDoc.nCharExcludingSpaces ));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/inc/wordcountdialog.hxx b/sw/source/ui/inc/wordcountdialog.hxx
index 3d640caac2..f7715b3177 100644
--- a/sw/source/ui/inc/wordcountdialog.hxx
+++ b/sw/source/ui/inc/wordcountdialog.hxx
@@ -30,31 +30,32 @@
#include <sfx2/basedlgs.hxx>
#include <svtools/stdctrl.hxx>
#include <vcl/button.hxx>
+#include <vcl/ldialog.hxx>
#include <layout/layout.hxx>
#include <layout/layout-pre.hxx>
struct SwDocStat;
-class SwWordCountDialog : public SfxModalDialog
+class SwWordCountDialog : public LDialog
{
- FixedLine aCurrentFL;
- FixedText aCurrentWordFT;
- FixedInfo aCurrentWordFI;
- FixedText aCurrentCharacterFT;
- FixedInfo aCurrentCharacterFI;
- FixedText aCurrentCharacterExcludingSpacesFT;
- FixedInfo aCurrentCharacterExcludingSpacesFI;
+ FixedLine *aCurrentFL;
+ FixedText *aCurrentWordFT;
+ FixedInfo *aCurrentWordFI;
+ FixedText *aCurrentCharacterFT;
+ FixedInfo *aCurrentCharacterFI;
+ FixedText *aCurrentCharacterExcludingSpacesFT;
+ FixedInfo *aCurrentCharacterExcludingSpacesFI;
- FixedLine aDocFL;
- FixedText aDocWordFT;
- FixedInfo aDocWordFI;
- FixedText aDocCharacterFT;
- FixedInfo aDocCharacterFI;
- FixedText aDocCharacterExcludingSpacesFT;
- FixedInfo aDocCharacterExcludingSpacesFI;
+ FixedLine *aDocFL;
+ FixedText *aDocWordFT;
+ FixedInfo *aDocWordFI;
+ FixedText *aDocCharacterFT;
+ FixedInfo *aDocCharacterFI;
+ FixedText *aDocCharacterExcludingSpacesFT;
+ FixedInfo *aDocCharacterExcludingSpacesFI;
- FixedLine aBottomFL;
+ FixedLine *aBottomFL;
- OKButton aOK;
- HelpButton aHelp;
+ OKButton *aOK;
+ HelpButton *aHelp;
public:
SwWordCountDialog(Window* pParent);