Kaydet (Commit) ae394876 authored tarafından Miklos Vajna's avatar Miklos Vajna

swpagerelsize ui: implement remaining height support

Change-Id: Ia603c4ac6c8e9e049473904203d2c471f03ce8a5
üst a90374fc
......@@ -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()
......
......@@ -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;
......
......@@ -205,24 +205,6 @@
<property name="height">1</property>
</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>
......@@ -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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment