diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-02-04 11:18:12 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-02-04 11:35:08 +0100 |
commit | ae394876e7e49505efd1be514ec3893ed53d0e08 (patch) | |
tree | 85dbd60f03eb4301d4baec0118b6d02349a9be3c /sw | |
parent | a90374fc81d8fb6f41600d6901c68aaaa3052550 (diff) |
swpagerelsize ui: implement remaining height support
Change-Id: Ia603c4ac6c8e9e049473904203d2c471f03ce8a5
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/frmdlg/frmpage.cxx | 22 | ||||
-rw-r--r-- | sw/source/ui/inc/frmpage.hxx | 1 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/frmtypepage.ui | 60 |
3 files changed, 65 insertions, 18 deletions
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index 3942d5d475fd..8670fb019601 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -649,6 +649,7 @@ SwFrmPage::SwFrmPage(Window *pParent, const SfxItemSet &rSet) get(m_pHeightAutoFT, "autoheightft"); m_aHeightED.set(get<MetricField>("height")); get(m_pRelHeightCB, "relheight"); + get(m_pRelHeightRelationLB, "relheightrelation"); get(m_pAutoHeightCB, "autoheight"); get(m_pFixedRatioCB, "ratio"); @@ -823,6 +824,7 @@ void SwFrmPage::setOptimalRelWidth() m_pHoriRelationLB->set_width_request(aBiggest.Width()); m_pVertRelationLB->set_width_request(aBiggest.Width()); m_pRelWidthRelationLB->set_width_request(aBiggest.Width()); + m_pRelHeightRelationLB->set_width_request(aBiggest.Width()); m_pHoriRelationLB->Clear(); } @@ -954,12 +956,18 @@ void SwFrmPage::Reset( const SfxItemSet &rSet ) else m_pRelWidthRelationLB->Disable(); + m_pRelHeightRelationLB->InsertEntry(aFramePosString.GetString(SwFPos::FRAME)); + m_pRelHeightRelationLB->InsertEntry(aFramePosString.GetString(SwFPos::REL_PG_FRAME)); if (rFrmSize.GetHeightPercent() != 0xff && rFrmSize.GetHeightPercent() != 0) { //calculate the rerference value from the with and relative width values sal_Int32 nSpace = rFrmSize.GetHeight() * 100 / rFrmSize.GetHeightPercent(); m_aHeightED.SetRefValue( nSpace ); + + m_pRelHeightRelationLB->Enable(); } + else + m_pRelHeightRelationLB->Disable(); // general initialisation part switch(rAnchor.GetAnchorId()) @@ -1152,6 +1160,14 @@ sal_Bool SwFrmPage::FillItemSet(SfxItemSet &rSet) else if (nRelWidthRelation == 1) aSz.SetWidthPercentRelation(text::RelOrientation::PAGE_FRAME); } + sal_uInt16 nRelHeightRelation = m_pRelHeightRelationLB->GetSelectEntryPos(); + if (nRelHeightRelation != LISTBOX_ENTRY_NOTFOUND) + { + if (nRelHeightRelation == 0) + aSz.SetHeightPercentRelation(text::RelOrientation::FRAME); + else if (nRelHeightRelation == 1) + aSz.SetHeightPercentRelation(text::RelOrientation::PAGE_FRAME); + } bool bValueModified = (m_aWidthED.IsValueModified() || m_aHeightED.IsValueModified()); bool bCheckChanged = (m_pRelWidthCB->GetSavedValue() != m_pRelWidthCB->IsChecked() @@ -1743,6 +1759,7 @@ IMPL_LINK( SwFrmPage, RelSizeClickHdl, CheckBox *, pBtn ) else // pBtn == m_pRelHeightCB { m_aHeightED.ShowPercent(pBtn->IsChecked()); + m_pRelHeightRelationLB->Enable(pBtn->IsChecked()); if(pBtn->IsChecked()) m_aHeightED.get()->SetMax(MAX_PERCENT_HEIGHT); } @@ -2331,6 +2348,11 @@ void SwFrmPage::Init(const SfxItemSet& rSet, sal_Bool bReset) m_pRelWidthRelationLB->SelectEntryPos(1); else m_pRelWidthRelationLB->SelectEntryPos(0); + + if (rSize.GetHeightPercentRelation() == text::RelOrientation::PAGE_FRAME) + m_pRelHeightRelationLB->SelectEntryPos(1); + else + m_pRelHeightRelationLB->SelectEntryPos(0); } sal_uInt16* SwFrmPage::GetRanges() diff --git a/sw/source/ui/inc/frmpage.hxx b/sw/source/ui/inc/frmpage.hxx index 515a0bec77df..b033f5132985 100644 --- a/sw/source/ui/inc/frmpage.hxx +++ b/sw/source/ui/inc/frmpage.hxx @@ -55,6 +55,7 @@ class SwFrmPage: public SfxTabPage FixedText* m_pHeightAutoFT; PercentField m_aHeightED; CheckBox* m_pRelHeightCB; + ListBox* m_pRelHeightRelationLB; CheckBox* m_pAutoHeightCB; CheckBox* m_pFixedRatioCB; diff --git a/sw/uiconfig/swriter/ui/frmtypepage.ui b/sw/uiconfig/swriter/ui/frmtypepage.ui index 144ab36d2267..f6fad3de32fa 100644 --- a/sw/uiconfig/swriter/ui/frmtypepage.ui +++ b/sw/uiconfig/swriter/ui/frmtypepage.ui @@ -206,24 +206,6 @@ </packing> </child> <child> - <object class="GtkCheckButton" id="relheight"> - <property name="label" translatable="yes">Re_lative</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="margin_left">12</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">2</property> - <property name="height">1</property> - </packing> - </child> - <child> <object class="GtkCheckButton" id="autoheight"> <property name="label" translatable="yes">AutoSize</property> <property name="visible">True</property> @@ -286,6 +268,48 @@ <property name="height">1</property> </packing> </child> + <child> + <object class="GtkBox" id="box2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkCheckButton" id="relheight"> + <property name="label" translatable="yes">Re_lative from</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="margin_left">12</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkComboBoxText" id="relheightrelation"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">2</property> + <property name="height">1</property> + </packing> + </child> </object> <packing> <property name="left_attach">0</property> |