[Libreoffice-commits] core.git: 2 commits - sw/source sw/uiconfig
Miklos Vajna
vmiklos at collabora.co.uk
Tue Feb 4 02:30:09 PST 2014
sw/source/core/frmedt/fews.cxx | 10 ++++-
sw/source/ui/frmdlg/frmpage.cxx | 22 ++++++++++++
sw/source/ui/inc/frmpage.hxx | 1
sw/uiconfig/swriter/ui/frmtypepage.ui | 60 +++++++++++++++++++++++-----------
4 files changed, 73 insertions(+), 20 deletions(-)
New commits:
commit ae394876e7e49505efd1be514ec3893ed53d0e08
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Feb 4 11:18:12 2014 +0100
swpagerelsize ui: implement remaining height support
Change-Id: Ia603c4ac6c8e9e049473904203d2c471f03ce8a5
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index 3942d5d..8670fb0 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 515a0be..b033f51 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 144ab36..f6fad3d 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>
commit a90374fc81d8fb6f41600d6901c68aaaa3052550
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Feb 4 11:13:38 2014 +0100
swpagerelsize ui: fix height percent value
The problem was that SwFEShell::CalcBoundRect() expected that the same
relation is used for width/height, don't assume this.
Change-Id: I6c7a968874513299757401341ca9b54206116203
diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx
index 5853f41..58e7ee4 100644
--- a/sw/source/core/frmedt/fews.cxx
+++ b/sw/source/core/frmedt/fews.cxx
@@ -873,11 +873,17 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect,
SWRECTFN( pUpper );
if ( _opPercent )
{
+ // If the size is relative from page, then full size should be counted from the page frame.
if (pFmtFrmSize && pFmtFrmSize->GetWidthPercentRelation() == text::RelOrientation::PAGE_FRAME)
+ _opPercent->setWidth(pPage->Frm().Width());
+ else
+ _opPercent->setWidth(pUpper->Prt().Width());
+
+ if (pFmtFrmSize && pFmtFrmSize->GetHeightPercentRelation() == text::RelOrientation::PAGE_FRAME)
// If the size is relative from page, then full size should be counted from the page frame.
- *_opPercent = pPage->Frm().SSize();
+ _opPercent->setHeight(pPage->Frm().Height());
else
- *_opPercent = pUpper->Prt().SSize();
+ _opPercent->setHeight(pUpper->Prt().Height());
}
bRTL = pFrm->IsRightToLeft();
More information about the Libreoffice-commits
mailing list