summaryrefslogtreecommitdiff
path: root/sw/source/ui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-09-20 12:52:26 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-09-20 18:13:25 +0200
commit1c52d39970de2daeac565165491ba82122ce299c (patch)
tree4c622ccb7cae70e48f17fb844b42a092c7286ea3 /sw/source/ui
parentf6ab12d5dae1212b0ad4e82ca3325f3dd4c974b6 (diff)
weld SwWrapTabPage
Change-Id: I76e4a8e557ae6c92ad16dc9b6cf88a6c6ca59e4e Reviewed-on: https://gerrit.libreoffice.org/60812 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/ui')
-rw-r--r--sw/source/ui/frmdlg/wrap.cxx390
1 files changed, 179 insertions, 211 deletions
diff --git a/sw/source/ui/frmdlg/wrap.cxx b/sw/source/ui/frmdlg/wrap.cxx
index d01dd02ab9a2..2df017529f32 100644
--- a/sw/source/ui/frmdlg/wrap.cxx
+++ b/sw/source/ui/frmdlg/wrap.cxx
@@ -28,6 +28,7 @@
#include <editeng/ulspitem.hxx>
#include <editeng/lrspitem.hxx>
#include <fmtfollowtextflow.hxx>
+#include <svtools/unitconv.hxx>
#include <svx/swframevalidation.hxx>
#include <cmdid.h>
@@ -40,6 +41,7 @@
#include <frmmgr.hxx>
#include <globals.hrc>
#include <wrap.hxx>
+#include <bitmaps.hlst>
using namespace ::com::sun::star;
@@ -61,8 +63,8 @@ SwWrapDlg::SwWrapDlg(weld::Window* pParent, SfxItemSet& rSet, SwWrtShell* pWrtSh
SetTabPage(xNewPage);
}
-SwWrapTabPage::SwWrapTabPage(vcl::Window *pParent, const SfxItemSet &rSet)
- : SfxTabPage(pParent, "WrapPage" , "modules/swriter/ui/wrappage.ui", &rSet)
+SwWrapTabPage::SwWrapTabPage(TabPageParent pParent, const SfxItemSet &rSet)
+ : SfxTabPage(pParent, "modules/swriter/ui/wrappage.ui", "WrapPage", &rSet)
, m_nAnchorId(RndStdIds::FLY_AT_PARA)
, m_nHtmlMode(0)
, m_pWrtSh(nullptr)
@@ -71,80 +73,47 @@ SwWrapTabPage::SwWrapTabPage(vcl::Window *pParent, const SfxItemSet &rSet)
, m_bHtmlMode(false)
, m_bDrawMode(false)
, m_bContourImage(false)
+ , m_xNoWrapRB(m_xBuilder->weld_radio_button("none"))
+ , m_xWrapLeftRB(m_xBuilder->weld_radio_button("before"))
+ , m_xWrapRightRB(m_xBuilder->weld_radio_button("after"))
+ , m_xWrapParallelRB(m_xBuilder->weld_radio_button("parallel"))
+ , m_xWrapThroughRB(m_xBuilder->weld_radio_button("through"))
+ , m_xIdealWrapRB(m_xBuilder->weld_radio_button("optimal"))
+ , m_xLeftMarginED(m_xBuilder->weld_metric_spin_button("left", FUNIT_CM))
+ , m_xRightMarginED(m_xBuilder->weld_metric_spin_button("right", FUNIT_CM))
+ , m_xTopMarginED(m_xBuilder->weld_metric_spin_button("top", FUNIT_CM))
+ , m_xBottomMarginED(m_xBuilder->weld_metric_spin_button("bottom", FUNIT_CM))
+ , m_xWrapAnchorOnlyCB(m_xBuilder->weld_check_button("anchoronly"))
+ , m_xWrapTransparentCB(m_xBuilder->weld_check_button("transparent"))
+ , m_xWrapOutlineCB(m_xBuilder->weld_check_button("outline"))
+ , m_xWrapOutsideCB(m_xBuilder->weld_check_button("outside"))
{
- get(m_pNoWrapRB, "none");
- get(m_pWrapLeftRB, "before");
- get(m_pWrapRightRB, "after");
- get(m_pWrapParallelRB, "parallel");
- get(m_pWrapThroughRB, "through");
- get(m_pIdealWrapRB, "optimal");
- get(m_pLeftMarginED, "left");
- get(m_pRightMarginED, "right");
- get(m_pTopMarginED, "top");
- get(m_pBottomMarginED, "bottom");
- get(m_pWrapAnchorOnlyCB, "anchoronly");
- get(m_pWrapTransparentCB, "transparent");
- get(m_pWrapOutlineCB, "outline");
- get(m_pWrapOutsideCB, "outside");
-
SetExchangeSupport();
- Link<SpinField&,void> aLk = LINK(this, SwWrapTabPage, RangeModifyHdl);
- Link<Control&,void> aLk3 = LINK(this, SwWrapTabPage, RangeLoseFocusHdl);
- m_pLeftMarginED->SetUpHdl(aLk);
- m_pLeftMarginED->SetDownHdl(aLk);
- m_pLeftMarginED->SetLoseFocusHdl(aLk3);
-
- m_pRightMarginED->SetUpHdl(aLk);
- m_pRightMarginED->SetDownHdl(aLk);
- m_pRightMarginED->SetLoseFocusHdl(aLk3);
-
- m_pTopMarginED->SetUpHdl(aLk);
- m_pTopMarginED->SetDownHdl(aLk);
- m_pTopMarginED->SetLoseFocusHdl(aLk3);
-
- m_pBottomMarginED->SetUpHdl(aLk);
- m_pBottomMarginED->SetDownHdl(aLk);
- m_pBottomMarginED->SetLoseFocusHdl(aLk3);
-
- Link<Button*,void> aLk2 = LINK(this, SwWrapTabPage, WrapTypeHdl);
- m_pNoWrapRB->SetClickHdl(aLk2);
- m_pWrapLeftRB->SetClickHdl(aLk2);
- m_pWrapRightRB->SetClickHdl(aLk2);
- m_pWrapParallelRB->SetClickHdl(aLk2);
- m_pWrapThroughRB->SetClickHdl(aLk2);
- m_pIdealWrapRB->SetClickHdl(aLk2);
+ Link<weld::MetricSpinButton&,void> aLk = LINK(this, SwWrapTabPage, RangeModifyHdl);
+ m_xLeftMarginED->connect_value_changed(aLk);
+ m_xRightMarginED->connect_value_changed(aLk);
+ m_xTopMarginED->connect_value_changed(aLk);
+ m_xBottomMarginED->connect_value_changed(aLk);
+
+ Link<weld::ToggleButton&,void> aLk2 = LINK(this, SwWrapTabPage, WrapTypeHdl);
+ m_xNoWrapRB->connect_toggled(aLk2);
+ m_xWrapLeftRB->connect_toggled(aLk2);
+ m_xWrapRightRB->connect_toggled(aLk2);
+ m_xWrapParallelRB->connect_toggled(aLk2);
+ m_xWrapThroughRB->connect_toggled(aLk2);
+ m_xIdealWrapRB->connect_toggled(aLk2);
SetImages();
- m_pWrapOutlineCB->SetClickHdl(LINK(this, SwWrapTabPage, ContourHdl));
+ m_xWrapOutlineCB->connect_toggled(LINK(this, SwWrapTabPage, ContourHdl));
}
SwWrapTabPage::~SwWrapTabPage()
{
- disposeOnce();
-}
-
-void SwWrapTabPage::dispose()
-{
- m_pNoWrapRB.clear();
- m_pWrapLeftRB.clear();
- m_pWrapRightRB.clear();
- m_pWrapParallelRB.clear();
- m_pWrapThroughRB.clear();
- m_pIdealWrapRB.clear();
- m_pLeftMarginED.clear();
- m_pRightMarginED.clear();
- m_pTopMarginED.clear();
- m_pBottomMarginED.clear();
- m_pWrapAnchorOnlyCB.clear();
- m_pWrapTransparentCB.clear();
- m_pWrapOutlineCB.clear();
- m_pWrapOutsideCB.clear();
- SfxTabPage::dispose();
}
VclPtr<SfxTabPage> SwWrapTabPage::Create(TabPageParent pParent, const SfxItemSet *rSet)
{
- return VclPtr<SwWrapTabPage>::Create(pParent.pParent, *rSet);
+ return VclPtr<SwWrapTabPage>::Create(pParent, *rSet);
}
void SwWrapTabPage::Reset(const SfxItemSet *rSet)
@@ -152,12 +121,12 @@ void SwWrapTabPage::Reset(const SfxItemSet *rSet)
// contour for Draw, Graphic and OLE (Insert/Graphic/Properties still missing!)
if( m_bDrawMode )
{
- m_pWrapOutlineCB->Show();
- m_pWrapOutsideCB->Show();
+ m_xWrapOutlineCB->show();
+ m_xWrapOutsideCB->show();
- m_pWrapTransparentCB->Check( 0 == static_cast<const SfxInt16Item&>(rSet->Get(
+ m_xWrapTransparentCB->set_active( 0 == static_cast<const SfxInt16Item&>(rSet->Get(
FN_DRAW_WRAP_DLG)).GetValue() );
- m_pWrapTransparentCB->SaveValue();
+ m_xWrapTransparentCB->save_state();
}
else
{
@@ -172,8 +141,8 @@ void SwWrapTabPage::Reset(const SfxItemSet *rSet)
}
if( bShowCB )
{
- m_pWrapOutlineCB->Show();
- m_pWrapOutsideCB->Show();
+ m_xWrapOutlineCB->show();
+ m_xWrapOutsideCB->show();
}
}
@@ -181,10 +150,10 @@ void SwWrapTabPage::Reset(const SfxItemSet *rSet)
m_bHtmlMode = (m_nHtmlMode & HTMLMODE_ON) != 0;
FieldUnit aMetric = ::GetDfltMetric(m_bHtmlMode);
- SetMetric(*m_pLeftMarginED, aMetric);
- SetMetric(*m_pRightMarginED, aMetric);
- SetMetric(*m_pTopMarginED, aMetric);
- SetMetric(*m_pBottomMarginED, aMetric);
+ SetFieldUnit(*m_xLeftMarginED, aMetric);
+ SetFieldUnit(*m_xRightMarginED, aMetric);
+ SetFieldUnit(*m_xTopMarginED, aMetric);
+ SetFieldUnit(*m_xBottomMarginED, aMetric);
const SwFormatSurround& rSurround = rSet->Get(RES_SURROUND);
@@ -195,84 +164,89 @@ void SwWrapTabPage::Reset(const SfxItemSet *rSet)
if (((m_nAnchorId == RndStdIds::FLY_AT_PARA) || (m_nAnchorId == RndStdIds::FLY_AT_CHAR))
&& (nSur != css::text::WrapTextMode_NONE))
{
- m_pWrapAnchorOnlyCB->Check( rSurround.IsAnchorOnly() );
+ m_xWrapAnchorOnlyCB->set_active(rSurround.IsAnchorOnly());
}
else
{
- m_pWrapAnchorOnlyCB->Enable( false );
+ m_xWrapAnchorOnlyCB->set_sensitive(false);
}
- bool bContour = rSurround.IsContour();
- m_pWrapOutlineCB->Check( bContour );
- m_pWrapOutsideCB->Check( rSurround.IsOutside() );
- m_pWrapThroughRB->Enable(!m_pWrapOutlineCB->IsChecked());
+ const bool bContour = rSurround.IsContour();
+ m_xWrapOutlineCB->set_active(bContour);
+ m_xWrapOutsideCB->set_active(rSurround.IsOutside());
+ m_xWrapThroughRB->set_sensitive(!m_xWrapOutlineCB->get_active());
m_bContourImage = !bContour;
- RadioButton* pBtn = nullptr;
+ weld::RadioButton* pBtn = nullptr;
switch (nSur)
{
case css::text::WrapTextMode_NONE:
{
- pBtn = m_pNoWrapRB;
+ pBtn = m_xNoWrapRB.get();
break;
}
case css::text::WrapTextMode_THROUGH:
{
// transparent ?
- pBtn = m_pWrapThroughRB;
+ pBtn = m_xWrapThroughRB.get();
if (!m_bDrawMode)
{
const SvxOpaqueItem& rOpaque = rSet->Get(RES_OPAQUE);
- m_pWrapTransparentCB->Check(!rOpaque.GetValue());
+ m_xWrapTransparentCB->set_active(!rOpaque.GetValue());
}
break;
}
case css::text::WrapTextMode_PARALLEL:
{
- pBtn = m_pWrapParallelRB;
+ pBtn = m_xWrapParallelRB.get();
break;
}
case css::text::WrapTextMode_DYNAMIC:
{
- pBtn = m_pIdealWrapRB;
+ pBtn = m_xIdealWrapRB.get();
break;
}
default:
{
if (nSur == css::text::WrapTextMode_LEFT)
- pBtn = m_pWrapLeftRB;
+ pBtn = m_xWrapLeftRB.get();
else if (nSur == css::text::WrapTextMode_RIGHT)
- pBtn = m_pWrapRightRB;
+ pBtn = m_xWrapRightRB.get();
}
}
if (pBtn)
{
- pBtn->Check();
- WrapTypeHdl(pBtn);
+ pBtn->set_active(true);
+ WrapTypeHdl(*pBtn);
// For character objects that currently are in passage, the default
// "contour on" is prepared here, in case we switch to any other
// passage later.
- if (m_bDrawMode && !m_pWrapOutlineCB->IsEnabled())
- m_pWrapOutlineCB->Check();
+ if (m_bDrawMode && !m_xWrapOutlineCB->get_sensitive())
+ m_xWrapOutlineCB->set_active(true);
}
- m_pWrapTransparentCB->Enable( pBtn == m_pWrapThroughRB && !m_bHtmlMode );
+ m_xWrapTransparentCB->set_sensitive(pBtn == m_xWrapThroughRB.get() && !m_bHtmlMode);
const SvxULSpaceItem& rUL = rSet->Get(RES_UL_SPACE);
const SvxLRSpaceItem& rLR = rSet->Get(RES_LR_SPACE);
// gap to text
- m_pLeftMarginED->SetValue(m_pLeftMarginED->Normalize(rLR.GetLeft()), FUNIT_TWIP);
- m_pRightMarginED->SetValue(m_pRightMarginED->Normalize(rLR.GetRight()), FUNIT_TWIP);
- m_pTopMarginED->SetValue(m_pTopMarginED->Normalize(rUL.GetUpper()), FUNIT_TWIP);
- m_pBottomMarginED->SetValue(m_pBottomMarginED->Normalize(rUL.GetLower()), FUNIT_TWIP);
+ m_xLeftMarginED->set_value(m_xLeftMarginED->normalize(rLR.GetLeft()), FUNIT_TWIP);
+ m_xRightMarginED->set_value(m_xRightMarginED->normalize(rLR.GetRight()), FUNIT_TWIP);
+ m_xTopMarginED->set_value(m_xTopMarginED->normalize(rUL.GetUpper()), FUNIT_TWIP);
+ m_xBottomMarginED->set_value(m_xBottomMarginED->normalize(rUL.GetLower()), FUNIT_TWIP);
- ContourHdl(nullptr);
+ m_xLeftMarginED->save_value();
+ m_xRightMarginED->save_value();
+ m_xTopMarginED->save_value();
+ m_xBottomMarginED->save_value();
+
+ ContourHdl(*m_xWrapOutlineCB);
ActivatePage( *rSet );
}
@@ -293,29 +267,29 @@ bool SwWrapTabPage::FillItemSet(SfxItemSet *rSet)
aOp.SetValue(true);
}
- if (m_pNoWrapRB->IsChecked())
+ if (m_xNoWrapRB->get_active())
aSur.SetSurround(css::text::WrapTextMode_NONE);
- else if (m_pWrapLeftRB->IsChecked())
+ else if (m_xWrapLeftRB->get_active())
aSur.SetSurround(css::text::WrapTextMode_LEFT);
- else if (m_pWrapRightRB->IsChecked())
+ else if (m_xWrapRightRB->get_active())
aSur.SetSurround(css::text::WrapTextMode_RIGHT);
- else if (m_pWrapParallelRB->IsChecked())
+ else if (m_xWrapParallelRB->get_active())
aSur.SetSurround(css::text::WrapTextMode_PARALLEL);
- else if (m_pWrapThroughRB->IsChecked())
+ else if (m_xWrapThroughRB->get_active())
{
aSur.SetSurround(css::text::WrapTextMode_THROUGH);
- if (m_pWrapTransparentCB->IsChecked() && !m_bDrawMode)
+ if (m_xWrapTransparentCB->get_active() && !m_bDrawMode)
aOp.SetValue(false);
}
- else if (m_pIdealWrapRB->IsChecked())
+ else if (m_xIdealWrapRB->get_active())
aSur.SetSurround(css::text::WrapTextMode_DYNAMIC);
- aSur.SetAnchorOnly( m_pWrapAnchorOnlyCB->IsChecked() );
- bool bContour = m_pWrapOutlineCB->IsChecked() && m_pWrapOutlineCB->IsEnabled();
+ aSur.SetAnchorOnly( m_xWrapAnchorOnlyCB->get_active() );
+ bool bContour = m_xWrapOutlineCB->get_active() && m_xWrapOutlineCB->get_sensitive();
aSur.SetContour( bContour );
if ( bContour )
- aSur.SetOutside(m_pWrapOutsideCB->IsChecked());
+ aSur.SetOutside(m_xWrapOutsideCB->get_active());
if(nullptr == (pOldItem = GetOldItem( *rSet, RES_SURROUND )) ||
aSur != *pOldItem )
@@ -334,12 +308,12 @@ bool SwWrapTabPage::FillItemSet(SfxItemSet *rSet)
}
}
- bool bTopMod = m_pTopMarginED->IsValueModified();
- bool bBottomMod = m_pBottomMarginED->IsValueModified();
+ bool bTopMod = m_xTopMarginED->get_value_changed_from_saved();
+ bool bBottomMod = m_xBottomMarginED->get_value_changed_from_saved();
SvxULSpaceItem aUL( RES_UL_SPACE );
- aUL.SetUpper(static_cast<sal_uInt16>(m_pTopMarginED->Denormalize(m_pTopMarginED->GetValue(FUNIT_TWIP))));
- aUL.SetLower(static_cast<sal_uInt16>(m_pBottomMarginED->Denormalize(m_pBottomMarginED->GetValue(FUNIT_TWIP))));
+ aUL.SetUpper(static_cast<sal_uInt16>(m_xTopMarginED->denormalize(m_xTopMarginED->get_value(FUNIT_TWIP))));
+ aUL.SetLower(static_cast<sal_uInt16>(m_xBottomMarginED->denormalize(m_xBottomMarginED->get_value(FUNIT_TWIP))));
if ( bTopMod || bBottomMod )
{
@@ -351,12 +325,12 @@ bool SwWrapTabPage::FillItemSet(SfxItemSet *rSet)
}
}
- bool bLeftMod = m_pLeftMarginED->IsValueModified();
- bool bRightMod = m_pRightMarginED->IsValueModified();
+ bool bLeftMod = m_xLeftMarginED->get_value_changed_from_saved();
+ bool bRightMod = m_xRightMarginED->get_value_changed_from_saved();
SvxLRSpaceItem aLR( RES_LR_SPACE );
- aLR.SetLeft(static_cast<sal_uInt16>(m_pLeftMarginED->Denormalize(m_pLeftMarginED->GetValue(FUNIT_TWIP))));
- aLR.SetRight(static_cast<sal_uInt16>(m_pRightMarginED->Denormalize(m_pRightMarginED->GetValue(FUNIT_TWIP))));
+ aLR.SetLeft(static_cast<sal_uInt16>(m_xLeftMarginED->denormalize(m_xLeftMarginED->get_value(FUNIT_TWIP))));
+ aLR.SetRight(static_cast<sal_uInt16>(m_xRightMarginED->denormalize(m_xRightMarginED->get_value(FUNIT_TWIP))));
if ( bLeftMod || bRightMod )
{
@@ -370,8 +344,8 @@ bool SwWrapTabPage::FillItemSet(SfxItemSet *rSet)
if ( m_bDrawMode )
{
- bool bChecked = m_pWrapTransparentCB->IsChecked() && m_pWrapTransparentCB->IsEnabled();
- if ((m_pWrapTransparentCB->GetSavedValue() == TRISTATE_TRUE) != bChecked)
+ bool bChecked = m_xWrapTransparentCB->get_active() && m_xWrapTransparentCB->get_sensitive();
+ if ((m_xWrapTransparentCB->get_saved_state() == TRISTATE_TRUE) != bChecked)
bModified |= nullptr != rSet->Put(SfxInt16Item(FN_DRAW_WRAP_DLG, bChecked ? 0 : 1));
}
@@ -461,97 +435,97 @@ void SwWrapTabPage::ActivatePage(const SfxItemSet& rSet)
nRight = nLeft;
}
- m_pLeftMarginED->SetMax(m_pLeftMarginED->Normalize(nLeft), FUNIT_TWIP);
- m_pRightMarginED->SetMax(m_pRightMarginED->Normalize(nRight), FUNIT_TWIP);
+ m_xLeftMarginED->set_max(m_xLeftMarginED->normalize(nLeft), FUNIT_TWIP);
+ m_xRightMarginED->set_max(m_xRightMarginED->normalize(nRight), FUNIT_TWIP);
- m_pTopMarginED->SetMax(m_pTopMarginED->Normalize(nTop), FUNIT_TWIP);
- m_pBottomMarginED->SetMax(m_pBottomMarginED->Normalize(nBottom), FUNIT_TWIP);
+ m_xTopMarginED->set_max(m_xTopMarginED->normalize(nTop), FUNIT_TWIP);
+ m_xBottomMarginED->set_max(m_xBottomMarginED->normalize(nBottom), FUNIT_TWIP);
- RangeModifyHdl(*m_pLeftMarginED);
- RangeModifyHdl(*m_pTopMarginED);
+ RangeModifyHdl(*m_xLeftMarginED);
+ RangeModifyHdl(*m_xTopMarginED);
}
const SwFormatSurround& rSurround = rSet.Get(RES_SURROUND);
css::text::WrapTextMode nSur = rSurround.GetSurround();
- m_pWrapTransparentCB->Enable( bEnable && !m_bHtmlMode && nSur == css::text::WrapTextMode_THROUGH );
+ m_xWrapTransparentCB->set_sensitive(bEnable && !m_bHtmlMode && nSur == css::text::WrapTextMode_THROUGH);
if(m_bHtmlMode)
{
const SwFormatHoriOrient& rHori = rSet.Get(RES_HORI_ORIENT);
sal_Int16 eHOrient = rHori.GetHoriOrient();
sal_Int16 eHRelOrient = rHori.GetRelationOrient();
- m_pWrapOutlineCB->Hide();
+ m_xWrapOutlineCB->hide();
const bool bAllHtmlModes =
((m_nAnchorId == RndStdIds::FLY_AT_PARA) || (m_nAnchorId == RndStdIds::FLY_AT_CHAR)) &&
(eHOrient == text::HoriOrientation::RIGHT || eHOrient == text::HoriOrientation::LEFT);
- m_pWrapAnchorOnlyCB->Enable( bAllHtmlModes && nSur != css::text::WrapTextMode_NONE );
- m_pWrapOutsideCB->Hide();
- m_pIdealWrapRB->Enable( false );
-
- m_pWrapTransparentCB->Enable( false );
- m_pNoWrapRB->Enable( RndStdIds::FLY_AT_PARA == m_nAnchorId );
- m_pWrapParallelRB->Enable( false );
- m_pWrapLeftRB->Enable
+ m_xWrapAnchorOnlyCB->set_sensitive(bAllHtmlModes && nSur != css::text::WrapTextMode_NONE);
+ m_xWrapOutsideCB->hide();
+ m_xIdealWrapRB->set_sensitive(false);
+
+ m_xWrapTransparentCB->set_sensitive(false);
+ m_xNoWrapRB->set_sensitive(RndStdIds::FLY_AT_PARA == m_nAnchorId);
+ m_xWrapParallelRB->set_sensitive(false);
+ m_xWrapLeftRB->set_sensitive
( (RndStdIds::FLY_AT_PARA == m_nAnchorId)
|| ( (RndStdIds::FLY_AT_CHAR == m_nAnchorId)
&& (eHOrient == text::HoriOrientation::RIGHT)
&& (eHRelOrient == text::RelOrientation::PRINT_AREA)));
- m_pWrapRightRB->Enable
+ m_xWrapRightRB->set_sensitive
( (RndStdIds::FLY_AT_PARA == m_nAnchorId)
|| ( (RndStdIds::FLY_AT_CHAR == m_nAnchorId)
&& (eHOrient == text::HoriOrientation::LEFT)
&& (eHRelOrient == text::RelOrientation::PRINT_AREA)));
- m_pWrapThroughRB->Enable
+ m_xWrapThroughRB->set_sensitive
( ( (RndStdIds::FLY_AT_PAGE == m_nAnchorId)
|| ( (RndStdIds::FLY_AT_CHAR == m_nAnchorId)
&& (eHRelOrient != text::RelOrientation::PRINT_AREA))
|| (RndStdIds::FLY_AT_PARA == m_nAnchorId))
&& (eHOrient != text::HoriOrientation::RIGHT));
- if(m_pNoWrapRB->IsChecked() && !m_pNoWrapRB->IsEnabled())
+ if (m_xNoWrapRB->get_active() && !m_xNoWrapRB->get_sensitive())
{
- if(m_pWrapThroughRB->IsEnabled())
- m_pWrapThroughRB->Check();
- else if(m_pWrapLeftRB->IsEnabled())
- m_pWrapLeftRB->Check();
- else if(m_pWrapRightRB->IsEnabled())
- m_pWrapRightRB->Check();
+ if(m_xWrapThroughRB->get_sensitive())
+ m_xWrapThroughRB->set_active(true);
+ else if(m_xWrapLeftRB->get_sensitive())
+ m_xWrapLeftRB->set_active(true);
+ else if(m_xWrapRightRB->get_sensitive())
+ m_xWrapRightRB->set_active(true);
}
- if(m_pWrapLeftRB->IsChecked() && !m_pWrapLeftRB->IsEnabled())
+ if (m_xWrapLeftRB->get_active() && !m_xWrapLeftRB->get_sensitive())
{
- if(m_pWrapRightRB->IsEnabled())
- m_pWrapRightRB->Check();
- else if(m_pWrapThroughRB->IsEnabled())
- m_pWrapThroughRB->Check();
+ if(m_xWrapRightRB->get_sensitive())
+ m_xWrapRightRB->set_active(true);
+ else if(m_xWrapThroughRB->get_sensitive())
+ m_xWrapThroughRB->set_active(true);
}
- if(m_pWrapRightRB->IsChecked() && !m_pWrapRightRB->IsEnabled())
+ if (m_xWrapRightRB->get_active() && !m_xWrapRightRB->get_sensitive())
{
- if(m_pWrapLeftRB->IsEnabled())
- m_pWrapLeftRB->Check();
- else if(m_pWrapThroughRB->IsEnabled())
- m_pWrapThroughRB->Check();
+ if(m_xWrapLeftRB->get_sensitive())
+ m_xWrapLeftRB->set_active(true);
+ else if(m_xWrapThroughRB->get_sensitive())
+ m_xWrapThroughRB->set_active(true);
}
- if(m_pWrapThroughRB->IsChecked() && !m_pWrapThroughRB->IsEnabled())
- if(m_pNoWrapRB->IsEnabled())
- m_pNoWrapRB->Check();
+ if (m_xWrapThroughRB->get_active() && !m_xWrapThroughRB->get_sensitive())
+ if(m_xNoWrapRB->get_sensitive())
+ m_xNoWrapRB->set_active(true);
- if(m_pWrapParallelRB->IsChecked() && !m_pWrapParallelRB->IsEnabled())
- m_pWrapThroughRB->Check();
+ if (m_xWrapParallelRB->get_active() && !m_xWrapParallelRB->get_sensitive())
+ m_xWrapThroughRB->set_active(true);
}
else
{
- m_pNoWrapRB->Enable( bEnable );
- m_pWrapLeftRB->Enable( bEnable );
- m_pWrapRightRB->Enable( bEnable );
- m_pIdealWrapRB->Enable( bEnable );
- m_pWrapThroughRB->Enable( bEnable );
- m_pWrapParallelRB->Enable( bEnable );
- m_pWrapAnchorOnlyCB->Enable(
+ m_xNoWrapRB->set_sensitive(bEnable);
+ m_xWrapLeftRB->set_sensitive(bEnable);
+ m_xWrapRightRB->set_sensitive(bEnable);
+ m_xIdealWrapRB->set_sensitive(bEnable);
+ m_xWrapThroughRB->set_sensitive(bEnable);
+ m_xWrapParallelRB->set_sensitive(bEnable);
+ m_xWrapAnchorOnlyCB->set_sensitive(
((m_nAnchorId == RndStdIds::FLY_AT_PARA) || (m_nAnchorId == RndStdIds::FLY_AT_CHAR))
&& nSur != css::text::WrapTextMode_NONE );
}
- ContourHdl(nullptr);
+ ContourHdl(*m_xWrapOutlineCB);
}
DeactivateRC SwWrapTabPage::DeactivatePage(SfxItemSet* _pSet)
@@ -562,57 +536,51 @@ DeactivateRC SwWrapTabPage::DeactivatePage(SfxItemSet* _pSet)
return DeactivateRC::LeavePage;
}
-// range check
-IMPL_LINK( SwWrapTabPage, RangeLoseFocusHdl, Control&, rControl, void )
-{
- RangeModifyHdl( static_cast<SpinField&>(rControl) );
-}
-IMPL_LINK( SwWrapTabPage, RangeModifyHdl, SpinField&, rSpin, void )
+IMPL_LINK(SwWrapTabPage, RangeModifyHdl, weld::MetricSpinButton&, rEdit, void)
{
- MetricField& rEdit = static_cast<MetricField&>(rSpin);
- sal_Int64 nValue = rEdit.GetValue();
- MetricField *pOpposite = nullptr;
- if (&rEdit == m_pLeftMarginED)
- pOpposite = m_pRightMarginED;
- else if (&rEdit == m_pRightMarginED)
- pOpposite = m_pLeftMarginED;
- else if (&rEdit == m_pTopMarginED)
- pOpposite = m_pBottomMarginED;
- else if (&rEdit == m_pBottomMarginED)
- pOpposite = m_pTopMarginED;
+ auto nValue = rEdit.get_value(FUNIT_NONE);
+ weld::MetricSpinButton* pOpposite = nullptr;
+ if (&rEdit == m_xLeftMarginED.get())
+ pOpposite = m_xRightMarginED.get();
+ else if (&rEdit == m_xRightMarginED.get())
+ pOpposite = m_xLeftMarginED.get();
+ else if (&rEdit == m_xTopMarginED.get())
+ pOpposite = m_xBottomMarginED.get();
+ else if (&rEdit == m_xBottomMarginED.get())
+ pOpposite = m_xTopMarginED.get();
assert(pOpposite);
if (pOpposite)
{
- sal_Int64 nOpposite = pOpposite->GetValue();
+ auto nOpposite = pOpposite->get_value(FUNIT_NONE);
- if (nValue + nOpposite > std::max(rEdit.GetMax(), pOpposite->GetMax()))
- pOpposite->SetValue(pOpposite->GetMax() - nValue);
+ if (nValue + nOpposite > std::max(rEdit.get_max(FUNIT_NONE), pOpposite->get_max(FUNIT_NONE)))
+ pOpposite->set_value(pOpposite->get_max(FUNIT_NONE) - nValue, FUNIT_NONE);
}
}
-IMPL_LINK( SwWrapTabPage, WrapTypeHdl, Button *, pBtn, void )
+IMPL_LINK_NOARG(SwWrapTabPage, WrapTypeHdl, weld::ToggleButton&, void)
{
- bool bWrapThrough = (pBtn == m_pWrapThroughRB);
- m_pWrapTransparentCB->Enable( bWrapThrough && !m_bHtmlMode );
+ bool bWrapThrough = m_xWrapThroughRB->get_active();
+ m_xWrapTransparentCB->set_sensitive(bWrapThrough && !m_bHtmlMode);
bWrapThrough |= ( m_nAnchorId == RndStdIds::FLY_AS_CHAR );
- m_pWrapOutlineCB->Enable( !bWrapThrough && pBtn != m_pNoWrapRB);
- m_pWrapOutsideCB->Enable( !bWrapThrough && m_pWrapOutlineCB->IsChecked() );
- m_pWrapAnchorOnlyCB->Enable(
+ m_xWrapOutlineCB->set_sensitive(!bWrapThrough && !m_xNoWrapRB->get_active());
+ m_xWrapOutsideCB->set_sensitive(!bWrapThrough && m_xWrapOutlineCB->get_active());
+ m_xWrapAnchorOnlyCB->set_sensitive(
((m_nAnchorId == RndStdIds::FLY_AT_PARA) || (m_nAnchorId == RndStdIds::FLY_AT_CHAR)) &&
- (pBtn != m_pNoWrapRB) );
+ (!m_xNoWrapRB->get_active()) );
- ContourHdl(nullptr);
+ ContourHdl(*m_xWrapOutlineCB);
}
-IMPL_LINK_NOARG(SwWrapTabPage, ContourHdl, Button*, void)
+IMPL_LINK_NOARG(SwWrapTabPage, ContourHdl, weld::ToggleButton&, void)
{
- bool bEnable = !(m_pWrapOutlineCB->IsChecked() && m_pWrapOutlineCB->IsEnabled());
+ bool bEnable = !(m_xWrapOutlineCB->get_active() && m_xWrapOutlineCB->get_sensitive());
- m_pWrapOutsideCB->Enable(!bEnable);
+ m_xWrapOutsideCB->set_sensitive(!bEnable);
- bEnable = !m_pWrapOutlineCB->IsChecked();
+ bEnable = !m_xWrapOutlineCB->get_active();
if (bEnable == m_bContourImage) // so that it doesn't always flicker
{
m_bContourImage = !bEnable;
@@ -622,23 +590,23 @@ IMPL_LINK_NOARG(SwWrapTabPage, ContourHdl, Button*, void)
void SwWrapTabPage::SetImages()
{
- m_pWrapThroughRB->SetModeRadioImage(get<FixedImage>("imgthrough")->GetImage());
- bool bWrapOutline = !m_pWrapOutlineCB->IsChecked();
- if(bWrapOutline)
+ m_xWrapThroughRB->set_from_icon_name(RID_BMP_WRAP_THROUGH);
+ bool bWrapOutline = !m_xWrapOutlineCB->get_active();
+ if (bWrapOutline)
{
- m_pNoWrapRB->SetModeRadioImage(get<FixedImage>("imgnone")->GetImage());
- m_pWrapLeftRB->SetModeRadioImage(get<FixedImage>("imgleft")->GetImage());
- m_pWrapRightRB->SetModeRadioImage(get<FixedImage>("imgright")->GetImage());
- m_pWrapParallelRB->SetModeRadioImage(get<FixedImage>("imgparallel")->GetImage());
- m_pIdealWrapRB->SetModeRadioImage(get<FixedImage>("imgideal")->GetImage());
+ m_xNoWrapRB->set_from_icon_name(RID_BMP_WRAP_NONE);
+ m_xWrapLeftRB->set_from_icon_name(RID_BMP_WRAP_LEFT);
+ m_xWrapRightRB->set_from_icon_name(RID_BMP_WRAP_RIGHT);
+ m_xWrapParallelRB->set_from_icon_name(RID_BMP_WRAP_PARALLEL);
+ m_xIdealWrapRB->set_from_icon_name(RID_BMP_WRAP_IDEAL);
}
else
{
- m_pNoWrapRB->SetModeRadioImage(get<FixedImage>("imgkonnone")->GetImage());
- m_pWrapLeftRB->SetModeRadioImage(get<FixedImage>("imgkonleft")->GetImage());
- m_pWrapRightRB->SetModeRadioImage(get<FixedImage>("imgkonright")->GetImage());
- m_pWrapParallelRB->SetModeRadioImage(get<FixedImage>("imgkonparallel")->GetImage());
- m_pIdealWrapRB->SetModeRadioImage(get<FixedImage>("imgkonideal")->GetImage());
+ m_xNoWrapRB->set_from_icon_name(RID_BMP_WRAP_CONTOUR_NONE);
+ m_xWrapLeftRB->set_from_icon_name(RID_BMP_WRAP_CONTOUR_LEFT);
+ m_xWrapRightRB->set_from_icon_name(RID_BMP_WRAP_CONTOUR_RIGHT);
+ m_xWrapParallelRB->set_from_icon_name(RID_BMP_WRAP_CONTOUR_PARALLEL);
+ m_xIdealWrapRB->set_from_icon_name(RID_BMP_WRAP_CONTOUR_IDEAL);
}
}