summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-03-05 18:21:20 +0100
committerZolnai Tamás <tamas.zolnai@collabora.com>2014-03-05 22:06:26 +0100
commit80d1a46e0f3b57f1bbaf7bc4c8aac81195ea8f4d (patch)
tree3b70dd8bc1399c41ad6328cba157a33178bdeed9
parent4516e300534fe982bb42d5b58b872406fa7991c5 (diff)
New feature: vertical alignment for text frames: UI part
Add a new combobox to the Options tab page of Frame dialog, which works with RES_TEXT_VERT_ADJUST attribute. The combobox is placed to the right side of the dialog, to follow ux-advise suggestion. Change-Id: I47cec8e9dea748b8e9d23fc51cacbeec1c890a4e
-rw-r--r--sw/source/ui/frmdlg/frmpage.cxx36
-rw-r--r--sw/source/ui/inc/frmpage.hxx3
-rw-r--r--sw/uiconfig/swriter/ui/frmaddpage.ui233
3 files changed, 206 insertions, 66 deletions
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index b67ab00fecde..3150515a922c 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -57,6 +57,8 @@
#include <grfatr.hxx>
#include <uiitems.hxx>
#include <fmtfollowtextflow.hxx>
+#include <editeng/adjustitem.hxx>
+#include <svx/sdtaitm.hxx>
#include <frmui.hrc>
#include <sfx2/filedlghelper.hxx>
@@ -2883,6 +2885,9 @@ SwFrmAddPage::SwFrmAddPage(Window *pParent, const SfxItemSet &rSet)
get(pProtectFrameCB,"protectframe");
get(pProtectSizeCB,"protectsize");
+ get(m_pContentAlignFrame, "contentalign");
+ get(m_pVertAlignLB,"vertalign");
+
get(pPropertiesFrame,"properties");
get(pEditInReadonlyCB,"editinreadonly");
get(pPrintFrameCB,"printframe");
@@ -2918,6 +2923,7 @@ void SwFrmAddPage::Reset(const SfxItemSet &rSet )
{
pPropertiesFrame->Hide();
}
+ m_pContentAlignFrame->Hide();
}
if(SFX_ITEM_SET == rSet.GetItemState(FN_SET_FRM_ALT_NAME, false, &pItem))
@@ -3064,6 +3070,22 @@ void SwFrmAddPage::Reset(const SfxItemSet &rSet )
pTextFlowFT->Hide();
pTextFlowLB->Hide();
}
+
+ // Content alignment
+ if ( rSet.GetItemState(RES_TEXT_VERT_ADJUST) > SFX_ITEM_AVAILABLE )
+ {
+ SdrTextVertAdjust nAdjust = ((const SdrTextVertAdjustItem&)rSet.Get(RES_TEXT_VERT_ADJUST)).GetValue();
+ sal_uInt16 nPos = 0;
+ switch(nAdjust)
+ {
+ case SDRTEXTVERTADJUST_TOP: nPos = 0; break;
+ case SDRTEXTVERTADJUST_CENTER:
+ case SDRTEXTVERTADJUST_BLOCK: nPos = 1; break;
+ case SDRTEXTVERTADJUST_BOTTOM: nPos = 2; break;
+ }
+ m_pVertAlignLB->SelectEntryPos(nPos);
+ }
+ m_pVertAlignLB->SaveValue();
}
sal_Bool SwFrmAddPage::FillItemSet(SfxItemSet &rSet)
@@ -3125,6 +3147,20 @@ sal_Bool SwFrmAddPage::FillItemSet(SfxItemSet &rSet)
bRet |= 0 != rSet.Put(SfxStringItem(FN_PARAM_CHAIN_NEXT, sCurrentNextChain));
}
}
+
+ if(m_pVertAlignLB->GetSelectEntryPos() != m_pVertAlignLB->GetSavedValue())
+ {
+ SdrTextVertAdjust nAdjust;
+ switch(m_pVertAlignLB->GetSelectEntryPos())
+ {
+ default:
+ case 0 : nAdjust = SDRTEXTVERTADJUST_TOP; break;
+ case 1 : nAdjust = SDRTEXTVERTADJUST_CENTER; break;
+ case 2 : nAdjust = SDRTEXTVERTADJUST_BOTTOM; break;
+ }
+ bRet |= 0 != rSet.Put(SdrTextVertAdjustItem(nAdjust, RES_TEXT_VERT_ADJUST));
+ }
+
return bRet;
}
diff --git a/sw/source/ui/inc/frmpage.hxx b/sw/source/ui/inc/frmpage.hxx
index 5949195c81c8..4f47b2c68067 100644
--- a/sw/source/ui/inc/frmpage.hxx
+++ b/sw/source/ui/inc/frmpage.hxx
@@ -286,6 +286,9 @@ class SwFrmAddPage : public SfxTabPage
CheckBox* pProtectFrameCB;
CheckBox* pProtectSizeCB;
+ VclContainer* m_pContentAlignFrame;
+ ListBox* m_pVertAlignLB;
+
VclContainer* pPropertiesFrame;
CheckBox* pEditInReadonlyCB;
CheckBox* pPrintFrameCB;
diff --git a/sw/uiconfig/swriter/ui/frmaddpage.ui b/sw/uiconfig/swriter/ui/frmaddpage.ui
index b668b2e956a3..dcbf12aef6cd 100644
--- a/sw/uiconfig/swriter/ui/frmaddpage.ui
+++ b/sw/uiconfig/swriter/ui/frmaddpage.ui
@@ -1,6 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
+ <object class="GtkListStore" id="liststore">
+ <columns>
+ <!-- column-name gchararray1 -->
+ <column type="gchararray"/>
+ <!-- column-name gint1 -->
+ <column type="gint"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">Top</col>
+ <col id="1">0</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Centered</col>
+ <col id="1">1</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Bottom</col>
+ <col id="1">2</col>
+ </row>
+ </data>
+ </object>
<object class="GtkBox" id="FrmAddPage">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -177,91 +199,170 @@
</packing>
</child>
<child>
- <object class="GtkFrame" id="protect">
+ <object class="GtkGrid" id="grid2">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
+ <property name="column_homogeneous">True</property>
<child>
- <object class="GtkAlignment" id="alignment2">
+ <object class="GtkFrame" id="contentalign">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="top_padding">6</property>
- <property name="left_padding">12</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
<child>
- <object class="GtkGrid" id="grid2">
+ <object class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">12</property>
+ <property name="top_padding">6</property>
+ <property name="left_padding">12</property>
<child>
- <object class="GtkCheckButton" id="protectcontent">
- <property name="label" translatable="yes">_Contents</property>
+ <object class="GtkGrid" id="grid8">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="protectframe">
- <property name="label" translatable="yes">P_osition</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="protectsize">
- <property name="label" translatable="yes">_Size</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
+ <property name="can_focus">False</property>
+ <property name="column_spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">_Vertical alignment</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="vertalign">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="model">liststore</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
</object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
</object>
</child>
+ <child type="label">
+ <object class="GtkLabel" id="label7">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Content alignment</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
</object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
</child>
- <child type="label">
- <object class="GtkLabel" id="label2">
+ <child>
+ <object class="GtkFrame" id="protect">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">Protect</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
+ <property name="hexpand">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment" id="alignment6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="top_padding">6</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkGrid" id="grid9">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="row_spacing">5</property>
+ <property name="column_spacing">12</property>
+ <child>
+ <object class="GtkCheckButton" id="protectcontent">
+ <property name="label" translatable="yes">_Contents</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="protectframe">
+ <property name="label" translatable="yes">P_osition</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="protectsize">
+ <property name="label" translatable="yes">_Size</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label8">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Protect</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
</child>
</object>
<packing>