summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-11-21 09:20:12 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-11-21 11:16:36 +0000
commite9be9ba808359d87675e20cc1c5c7e2c78e59c7d (patch)
tree1512c19da0b26193ed381cef2af7d7676e6ea5c5 /sw
parent9ac1f0aae7d1e288518e024683fade15f2713528 (diff)
make the word count dialog the right size with disabled CJK word counting
we want to hide the CJK word count features unless CJK UI is enabled, or if there are CJK chars in the word count. We want the dialog to fit to the best size, so force the dialog to resize after it's visible (like a vclexpander) if in non-CJK mode and some CJK chars appear in the document. Change-Id: I328dcf2b111d5c5f527757ca11695ce4e9c43353
Diffstat (limited to 'sw')
-rw-r--r--sw/source/ui/dialog/wordcountdialog.cxx12
-rw-r--r--sw/source/ui/inc/wordcountdialog.hxx3
-rw-r--r--sw/uiconfig/swriter/ui/wordcount.ui30
3 files changed, 29 insertions, 16 deletions
diff --git a/sw/source/ui/dialog/wordcountdialog.cxx b/sw/source/ui/dialog/wordcountdialog.cxx
index b74b970ae8f3..fa908a7b94cf 100644
--- a/sw/source/ui/dialog/wordcountdialog.cxx
+++ b/sw/source/ui/dialog/wordcountdialog.cxx
@@ -76,6 +76,16 @@ void SwWordCountFloatDlg::SetValues(const SwDocStat& rCurrent, const SwDocStat&
setValue(m_pDocCjkcharsFT, rDoc.nAsianWord);
bool bShowCJK = (SvtCJKOptions().IsAnyEnabled() || rDoc.nAsianWord);
+ bool bToggleCJK = m_pCurrentCjkcharsFT->IsVisible() != bShowCJK;
+ if (bToggleCJK)
+ {
+ showCJK(bShowCJK);
+ setInitialLayoutSize(); //force resize of dialog
+ }
+}
+
+void SwWordCountFloatDlg::showCJK(bool bShowCJK)
+{
m_pCurrentCjkcharsFT->Show(bShowCJK);
m_pDocCjkcharsFT->Show(bShowCJK);
m_pCjkcharsLabelFT->Show(bShowCJK);
@@ -112,6 +122,8 @@ SwWordCountFloatDlg::SwWordCountFloatDlg(SfxBindings* _pBindings,
m_pDocCharacterExcludingSpacesFT->set_width_request(nPrefWidth);
m_pDocCjkcharsFT->set_width_request(nPrefWidth);
+ showCJK(SvtCJKOptions().IsAnyEnabled());
+
Initialize(pInfo);
m_pClosePB->SetClickHdl(LINK(this, SwWordCountFloatDlg, CloseHdl));
diff --git a/sw/source/ui/inc/wordcountdialog.hxx b/sw/source/ui/inc/wordcountdialog.hxx
index a0dbe38bc8df..d1e7db2660c8 100644
--- a/sw/source/ui/inc/wordcountdialog.hxx
+++ b/sw/source/ui/inc/wordcountdialog.hxx
@@ -38,7 +38,8 @@ struct SwDocStat;
class SwWordCountFloatDlg : public SfxModelessDialog
{
virtual void Activate();
- void SetValues(const SwDocStat& rCurrent, const SwDocStat& rDoc);
+ void SetValues(const SwDocStat& rCurrent, const SwDocStat& rDoc);
+ void showCJK(bool bShowCJK);
FixedText* m_pCurrentWordFT;
FixedText* m_pCurrentCharacterFT;
diff --git a/sw/uiconfig/swriter/ui/wordcount.ui b/sw/uiconfig/swriter/ui/wordcount.ui
index 733f049bb316..f4e32556bdd8 100644
--- a/sw/uiconfig/swriter/ui/wordcount.ui
+++ b/sw/uiconfig/swriter/ui/wordcount.ui
@@ -77,7 +77,7 @@
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="row_spacing">2</property>
- <property name="column_spacing">10</property>
+ <property name="column_spacing">12</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
@@ -130,7 +130,7 @@
<property name="halign">end</property>
<property name="hexpand">True</property>
<property name="xalign">1</property>
- <property name="label"> 0</property>
+ <property name="label"> 0</property>
<property name="justify">right</property>
</object>
<packing>
@@ -147,7 +147,7 @@
<property name="halign">end</property>
<property name="hexpand">True</property>
<property name="xalign">1</property>
- <property name="label"> 0</property>
+ <property name="label"> 0</property>
<property name="justify">right</property>
</object>
<packing>
@@ -164,7 +164,7 @@
<property name="halign">end</property>
<property name="hexpand">True</property>
<property name="xalign">1</property>
- <property name="label"> 0</property>
+ <property name="label"> 0</property>
<property name="justify">right</property>
</object>
<packing>
@@ -215,7 +215,7 @@
<property name="halign">end</property>
<property name="hexpand">True</property>
<property name="xalign">1</property>
- <property name="label"> 0</property>
+ <property name="label"> 0</property>
<property name="justify">right</property>
</object>
<packing>
@@ -232,7 +232,7 @@
<property name="halign">end</property>
<property name="hexpand">True</property>
<property name="xalign">1</property>
- <property name="label"> 0</property>
+ <property name="label"> 0</property>
<property name="justify">right</property>
</object>
<packing>
@@ -249,7 +249,7 @@
<property name="halign">end</property>
<property name="hexpand">True</property>
<property name="xalign">1</property>
- <property name="label"> 0</property>
+ <property name="label"> 0</property>
<property name="justify">right</property>
</object>
<packing>
@@ -260,12 +260,9 @@
</packing>
</child>
<child>
- <placeholder/>
- </child>
- <child>
<object class="GtkLabel" id="cjkcharsft">
- <property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
<property name="xalign">0</property>
<property name="xpad">10</property>
<property name="label" translatable="yes">Asian characters and Korean syllables</property>
@@ -279,12 +276,12 @@
</child>
<child>
<object class="GtkLabel" id="selectcjkchars">
- <property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
<property name="halign">end</property>
<property name="hexpand">True</property>
<property name="xalign">1</property>
- <property name="label"> 0</property>
+ <property name="label"> 0</property>
<property name="justify">right</property>
</object>
<packing>
@@ -296,12 +293,12 @@
</child>
<child>
<object class="GtkLabel" id="doccjkchars">
- <property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
<property name="halign">end</property>
<property name="hexpand">True</property>
<property name="xalign">1</property>
- <property name="label"> 0</property>
+ <property name="label"> 0</property>
<property name="justify">right</property>
</object>
<packing>
@@ -311,6 +308,9 @@
<property name="height">1</property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
</object>
</child>
</object>