sw/inc/fesh.hxx | 3 + sw/source/core/frmedt/fews.cxx | 12 +++++- sw/source/ui/frmdlg/frmmgr.cxx | 4 +- sw/source/ui/frmdlg/frmpage.cxx | 23 +++++++++++++ sw/source/ui/inc/frmpage.hxx | 1 sw/uiconfig/swriter/ui/frmtypepage.ui | 60 +++++++++++++++++++++++----------- 6 files changed, 81 insertions(+), 22 deletions(-)
New commits: commit 215e92735dd09954e105a09a5e349ff74009ef9f Author: Miklos Vajna <[email protected]> Date: Mon Feb 3 19:38:01 2014 +0100 swpagerelsize ui: disable RelWidthRelation when RelWidthCB is not checked Change-Id: I422f1f0d9b8436546ba355852fe6b3a21e2d1d23 diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index 6de7485..3942d5d 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -941,15 +941,18 @@ void SwFrmPage::Reset( const SfxItemSet &rSet ) const SwFmtFrmSize& rFrmSize = (const SwFmtFrmSize&)rSet.Get(RES_FRM_SIZE); + m_pRelWidthRelationLB->InsertEntry(aFramePosString.GetString(SwFPos::FRAME)); + m_pRelWidthRelationLB->InsertEntry(aFramePosString.GetString(SwFPos::REL_PG_FRAME)); if (rFrmSize.GetWidthPercent() != 0xff && rFrmSize.GetWidthPercent() != 0) { //calculate the rerference value from the with and relative width values sal_Int32 nSpace = rFrmSize.GetWidth() * 100 / rFrmSize.GetWidthPercent(); m_aWidthED.SetRefValue( nSpace ); - m_pRelWidthRelationLB->InsertEntry(aFramePosString.GetString(SwFPos::FRAME)); - m_pRelWidthRelationLB->InsertEntry(aFramePosString.GetString(SwFPos::REL_PG_FRAME)); + m_pRelWidthRelationLB->Enable(); } + else + m_pRelWidthRelationLB->Disable(); if (rFrmSize.GetHeightPercent() != 0xff && rFrmSize.GetHeightPercent() != 0) { @@ -1733,6 +1736,7 @@ IMPL_LINK( SwFrmPage, RelSizeClickHdl, CheckBox *, pBtn ) if (pBtn == m_pRelWidthCB) { m_aWidthED.ShowPercent(pBtn->IsChecked()); + m_pRelWidthRelationLB->Enable(pBtn->IsChecked()); if(pBtn->IsChecked()) m_aWidthED.get()->SetMax(MAX_PERCENT_WIDTH); } commit 5bb8a4b2e3137208d307cadf26df5a242b08e507 Author: Miklos Vajna <[email protected]> Date: Mon Feb 3 18:27:29 2014 +0100 swpagerelsize ui: write WidthPercentRelation to doc model Change-Id: Ia446566e7757f06c1bac12ae1d7a2392f20003a6 diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index 0b5733a..6de7485 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -1141,6 +1141,15 @@ sal_Bool SwFrmPage::FillItemSet(SfxItemSet &rSet) const SwFmtFrmSize& rOldSize = (const SwFmtFrmSize& )rOldSet.Get(RES_FRM_SIZE); SwFmtFrmSize aSz( rOldSize ); + sal_uInt16 nRelWidthRelation = m_pRelWidthRelationLB->GetSelectEntryPos(); + if (nRelWidthRelation != LISTBOX_ENTRY_NOTFOUND) + { + if (nRelWidthRelation == 0) + aSz.SetWidthPercentRelation(text::RelOrientation::FRAME); + else if (nRelWidthRelation == 1) + aSz.SetWidthPercentRelation(text::RelOrientation::PAGE_FRAME); + } + bool bValueModified = (m_aWidthED.IsValueModified() || m_aHeightED.IsValueModified()); bool bCheckChanged = (m_pRelWidthCB->GetSavedValue() != m_pRelWidthCB->IsChecked() || m_pRelHeightCB->GetSavedValue() != m_pRelHeightCB->IsChecked()); commit 1188866c1f0eb087a7e9b09bd9628f9c916feb68 Author: Miklos Vajna <[email protected]> Date: Mon Feb 3 17:30:25 2014 +0100 swpagerelsize ui: fix width percent value Change-Id: I6f5b937826ac37f5f8bdee26e139fd6ca1e9a925 diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx index 7877ac99..57b58ba 100644 --- a/sw/inc/fesh.hxx +++ b/sw/inc/fesh.hxx @@ -300,7 +300,8 @@ public: const bool _bFollowTextFlow = false, bool _bMirror = false, Point* _opRef = NULL, - Size* _opPercent = NULL ) const; + Size* _opPercent = NULL, + const SwFmtFrmSize* pFmtFrmSize = 0 ) const; /// Set size of draw objects. void SetObjRect( const SwRect& rRect ); diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx index a7f32a4..5853f41 100644 --- a/sw/source/core/frmedt/fews.cxx +++ b/sw/source/core/frmedt/fews.cxx @@ -36,6 +36,7 @@ #include <fmtpdsc.hxx> #include <fmtsrnd.hxx> #include <fmtcntnt.hxx> +#include <fmtfsize.hxx> #include <tabfrm.hxx> #include <cellfrm.hxx> #include <flyfrms.hxx> @@ -709,7 +710,8 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, const bool _bFollowTextFlow, bool _bMirror, Point* _opRef, - Size* _opPercent ) const + Size* _opPercent, + const SwFmtFrmSize* pFmtFrmSize) const { const SwFrm* pFrm; const SwFlyFrm* pFly; @@ -870,7 +872,13 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, pFrm : pFrm->GetUpper(); SWRECTFN( pUpper ); if ( _opPercent ) - *_opPercent = pUpper->Prt().SSize(); + { + if (pFmtFrmSize && pFmtFrmSize->GetWidthPercentRelation() == 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(); + else + *_opPercent = pUpper->Prt().SSize(); + } bRTL = pFrm->IsRightToLeft(); if ( bRTL ) diff --git a/sw/source/ui/frmdlg/frmmgr.cxx b/sw/source/ui/frmdlg/frmmgr.cxx index 21ebf55..ab4085c 100644 --- a/sw/source/ui/frmdlg/frmmgr.cxx +++ b/sw/source/ui/frmdlg/frmmgr.cxx @@ -269,12 +269,14 @@ void SwFlyFrmAttrMgr::ValidateMetrics( SvxSwFrameValidation& rVal, // OD 18.09.2003 #i18732# - adjustment for allowing vertical position // aligned to page for fly frame anchored to paragraph or to character. const RndStdIds eAnchorType = static_cast<RndStdIds >(rVal.nAnchorType); + const SwFmtFrmSize& rSize = (const SwFmtFrmSize&)aSet.Get(RES_FRM_SIZE); pOwnSh->CalcBoundRect( aBoundRect, eAnchorType, rVal.nHRelOrient, rVal.nVRelOrient, pToCharCntntPos, rVal.bFollowTextFlow, - rVal.bMirror, NULL, &rVal.aPercentSize); + rVal.bMirror, NULL, &rVal.aPercentSize, + &rSize); if (bOnlyPercentRefValue) return; commit 9480887ee8524411b13e6942a549370939608338 Author: Miklos Vajna <[email protected]> Date: Mon Feb 3 16:31:48 2014 +0100 swpagerelsize ui: read WidthPercentRelation from doc model Change-Id: Idb5774bf2a51881b385433d3476bf27b5e9b0014 diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index 1559dda..0b5733a 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -642,6 +642,7 @@ SwFrmPage::SwFrmPage(Window *pParent, const SfxItemSet &rSet) get(m_pWidthAutoFT, "autowidthft"); m_aWidthED.set(get<MetricField>("width")); get(m_pRelWidthCB, "relwidth"); + get(m_pRelWidthRelationLB, "relwidthrelation"); get(m_pAutoWidthCB, "autowidth"); get(m_pHeightFT, "heightft"); @@ -821,6 +822,7 @@ void SwFrmPage::setOptimalRelWidth() Size aBiggest(m_pHoriRelationLB->GetOptimalSize()); m_pHoriRelationLB->set_width_request(aBiggest.Width()); m_pVertRelationLB->set_width_request(aBiggest.Width()); + m_pRelWidthRelationLB->set_width_request(aBiggest.Width()); m_pHoriRelationLB->Clear(); } @@ -944,6 +946,9 @@ void SwFrmPage::Reset( const SfxItemSet &rSet ) //calculate the rerference value from the with and relative width values sal_Int32 nSpace = rFrmSize.GetWidth() * 100 / rFrmSize.GetWidthPercent(); m_aWidthED.SetRefValue( nSpace ); + + m_pRelWidthRelationLB->InsertEntry(aFramePosString.GetString(SwFPos::FRAME)); + m_pRelWidthRelationLB->InsertEntry(aFramePosString.GetString(SwFPos::REL_PG_FRAME)); } if (rFrmSize.GetHeightPercent() != 0xff && rFrmSize.GetHeightPercent() != 0) @@ -2308,6 +2313,11 @@ void SwFrmPage::Init(const SfxItemSet& rSet, sal_Bool bReset) } m_pRelWidthCB->SaveValue(); m_pRelHeightCB->SaveValue(); + + if (rSize.GetWidthPercentRelation() == text::RelOrientation::PAGE_FRAME) + m_pRelWidthRelationLB->SelectEntryPos(1); + else + m_pRelWidthRelationLB->SelectEntryPos(0); } sal_uInt16* SwFrmPage::GetRanges() diff --git a/sw/source/ui/inc/frmpage.hxx b/sw/source/ui/inc/frmpage.hxx index 11aacc0..515a0be 100644 --- a/sw/source/ui/inc/frmpage.hxx +++ b/sw/source/ui/inc/frmpage.hxx @@ -48,6 +48,7 @@ class SwFrmPage: public SfxTabPage FixedText* m_pWidthAutoFT; PercentField m_aWidthED; CheckBox* m_pRelWidthCB; + ListBox* m_pRelWidthRelationLB; CheckBox* m_pAutoWidthCB; FixedText* m_pHeightFT; commit 332ddac2e2a57f56ea5a736569b0763a1f763821 Author: Miklos Vajna <[email protected]> Date: Mon Feb 3 15:36:24 2014 +0100 swpagerelsize ui: add new combo box for relative width relation Change-Id: I0570fbfb5d36e476bb0a502509e9221c826ffa5c diff --git a/sw/uiconfig/swriter/ui/frmtypepage.ui b/sw/uiconfig/swriter/ui/frmtypepage.ui index 91b2c58..144ab36 100644 --- a/sw/uiconfig/swriter/ui/frmtypepage.ui +++ b/sw/uiconfig/swriter/ui/frmtypepage.ui @@ -71,24 +71,6 @@ </packing> </child> <child> - <object class="GtkCheckButton" id="relwidth"> - <property name="label" translatable="yes">Relat_ive</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="autowidth"> <property name="label" translatable="yes">AutoSize</property> <property name="visible">True</property> @@ -151,6 +133,48 @@ <property name="height">1</property> </packing> </child> + <child> + <object class="GtkBox" id="box1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkCheckButton" id="relwidth"> + <property name="label" translatable="yes">Relat_ive 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="relwidthrelation"> + <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> _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
