diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-09-20 12:52:26 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-09-20 18:13:25 +0200 |
commit | 1c52d39970de2daeac565165491ba82122ce299c (patch) | |
tree | 4c622ccb7cae70e48f17fb844b42a092c7286ea3 | |
parent | f6ab12d5dae1212b0ad4e82ca3325f3dd4c974b6 (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>
-rw-r--r-- | include/vcl/weld.hxx | 1 | ||||
-rw-r--r-- | sw/inc/bitmaps.hlst | 12 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/wrap.cxx | 390 | ||||
-rw-r--r-- | sw/source/uibase/inc/wrap.hxx | 50 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/wrappage.ui | 427 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 10 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 62 |
7 files changed, 387 insertions, 565 deletions
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index f2ec98049023..a9f5c1c38d07 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -387,6 +387,7 @@ public: virtual void set_label(const OUString& rText) = 0; // pDevice, the image for the button, or nullptr to unset virtual void set_image(VirtualDevice* pDevice) = 0; + virtual void set_from_icon_name(const OUString& rIconName) = 0; virtual OUString get_label() const = 0; void clicked() { signal_clicked(); } diff --git a/sw/inc/bitmaps.hlst b/sw/inc/bitmaps.hlst index dd2956683c05..0b1b8c20d0c4 100644 --- a/sw/inc/bitmaps.hlst +++ b/sw/inc/bitmaps.hlst @@ -88,6 +88,18 @@ #define RID_BMP_DROP_LINK "sw/res/sc20238.png" #define RID_BMP_DROP_COPY "sw/res/sc20239.png" +#define RID_BMP_WRAP_RIGHT "sw/res/wr03.png" +#define RID_BMP_WRAP_CONTOUR_RIGHT "sw/res/wr09.png" +#define RID_BMP_WRAP_LEFT "sw/res/wr02.png" +#define RID_BMP_WRAP_CONTOUR_LEFT "sw/res/wr08.png" +#define RID_BMP_WRAP_NONE "sw/res/wr01.png" +#define RID_BMP_WRAP_CONTOUR_NONE "sw/res/wr07.png" +#define RID_BMP_WRAP_IDEAL "sw/res/wr06.png" +#define RID_BMP_WRAP_CONTOUR_IDEAL "sw/res/wr011.png" +#define RID_BMP_WRAP_THROUGH "sw/res/wr05.png" +#define RID_BMP_WRAP_PARALLEL "sw/res/wr04.png" +#define RID_BMP_WRAP_CONTOUR_PARALLEL "sw/res/wr010.png" + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ 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); } } diff --git a/sw/source/uibase/inc/wrap.hxx b/sw/source/uibase/inc/wrap.hxx index 744b9cf183f2..048e18929c04 100644 --- a/sw/source/uibase/inc/wrap.hxx +++ b/sw/source/uibase/inc/wrap.hxx @@ -38,26 +38,6 @@ public: // circulation TabPage class SwWrapTabPage: public SfxTabPage { - // WRAPPING - VclPtr<RadioButton> m_pNoWrapRB; - VclPtr<RadioButton> m_pWrapLeftRB; - VclPtr<RadioButton> m_pWrapRightRB; - VclPtr<RadioButton> m_pWrapParallelRB; - VclPtr<RadioButton> m_pWrapThroughRB; - VclPtr<RadioButton> m_pIdealWrapRB; - - // MARGIN - VclPtr<MetricField> m_pLeftMarginED; - VclPtr<MetricField> m_pRightMarginED; - VclPtr<MetricField> m_pTopMarginED; - VclPtr<MetricField> m_pBottomMarginED; - - // OPTIONS - VclPtr<CheckBox> m_pWrapAnchorOnlyCB; - VclPtr<CheckBox> m_pWrapTransparentCB; - VclPtr<CheckBox> m_pWrapOutlineCB; - VclPtr<CheckBox> m_pWrapOutsideCB; - RndStdIds m_nAnchorId; sal_uInt16 m_nHtmlMode; @@ -70,17 +50,35 @@ class SwWrapTabPage: public SfxTabPage bool m_bDrawMode; bool m_bContourImage; + // WRAPPING + std::unique_ptr<weld::RadioButton> m_xNoWrapRB; + std::unique_ptr<weld::RadioButton> m_xWrapLeftRB; + std::unique_ptr<weld::RadioButton> m_xWrapRightRB; + std::unique_ptr<weld::RadioButton> m_xWrapParallelRB; + std::unique_ptr<weld::RadioButton> m_xWrapThroughRB; + std::unique_ptr<weld::RadioButton> m_xIdealWrapRB; + + // MARGIN + std::unique_ptr<weld::MetricSpinButton> m_xLeftMarginED; + std::unique_ptr<weld::MetricSpinButton> m_xRightMarginED; + std::unique_ptr<weld::MetricSpinButton> m_xTopMarginED; + std::unique_ptr<weld::MetricSpinButton> m_xBottomMarginED; + + // OPTIONS + std::unique_ptr<weld::CheckButton> m_xWrapAnchorOnlyCB; + std::unique_ptr<weld::CheckButton> m_xWrapTransparentCB; + std::unique_ptr<weld::CheckButton> m_xWrapOutlineCB; + std::unique_ptr<weld::CheckButton> m_xWrapOutsideCB; + virtual ~SwWrapTabPage() override; - virtual void dispose() override; void SetImages(); virtual void ActivatePage(const SfxItemSet& rSet) override; virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override; - DECL_LINK( RangeModifyHdl, SpinField&, void ); - DECL_LINK( RangeLoseFocusHdl, Control&, void ); - DECL_LINK( WrapTypeHdl, Button *, void ); - DECL_LINK( ContourHdl, Button *, void); + DECL_LINK(RangeModifyHdl, weld::MetricSpinButton&, void); + DECL_LINK(WrapTypeHdl, weld::ToggleButton&, void); + DECL_LINK(ContourHdl, weld::ToggleButton&, void); using SfxTabPage::ActivatePage; using SfxTabPage::DeactivatePage; @@ -88,7 +86,7 @@ class SwWrapTabPage: public SfxTabPage static const sal_uInt16 m_aWrapPageRg[]; public: - SwWrapTabPage(vcl::Window *pParent, const SfxItemSet &rSet); + SwWrapTabPage(TabPageParent pParent, const SfxItemSet &rSet); static VclPtr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet *rSet); diff --git a/sw/uiconfig/swriter/ui/wrappage.ui b/sw/uiconfig/swriter/ui/wrappage.ui index afc0653ee06b..7d3872c119a5 100644 --- a/sw/uiconfig/swriter/ui/wrappage.ui +++ b/sw/uiconfig/swriter/ui/wrappage.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sw"> <requires lib="gtk+" version="3.18"/> <object class="GtkAdjustment" id="adjustment1"> @@ -7,6 +7,21 @@ <property name="step_increment">0.10000000000000001</property> <property name="page_increment">1</property> </object> + <object class="GtkAdjustment" id="adjustment2"> + <property name="upper">99.989999999999995</property> + <property name="step_increment">0.10000000000000001</property> + <property name="page_increment">1</property> + </object> + <object class="GtkAdjustment" id="adjustment3"> + <property name="upper">99.989999999999995</property> + <property name="step_increment">0.10000000000000001</property> + <property name="page_increment">1</property> + </object> + <object class="GtkAdjustment" id="adjustment4"> + <property name="upper">99.989999999999995</property> + <property name="step_increment">0.10000000000000001</property> + <property name="page_increment">1</property> + </object> <object class="GtkGrid" id="WrapPage"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -38,335 +53,135 @@ <property name="row_homogeneous">True</property> <property name="column_homogeneous">True</property> <child> - <object class="GtkBox" id="box4"> + <object class="GtkRadioButton" id="parallel"> + <property name="label" translatable="yes" context="wrappage|parallel">_Parallel</property> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> <property name="halign">center</property> - <child> - <object class="GtkRadioButton" id="after"> - <property name="label" translatable="yes" context="wrappage|after">After</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="halign">center</property> - <property name="valign">center</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="image_position">top</property> - <property name="draw_indicator">True</property> - <property name="group">parallel</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkImage" id="imgright"> - <property name="can_focus">False</property> - <property name="no_show_all">True</property> - <property name="pixbuf">sw/res/wr03.png</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkImage" id="imgkonright"> - <property name="can_focus">False</property> - <property name="no_show_all">True</property> - <property name="pixbuf">sw/res/wr09.png</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> + <property name="valign">center</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="image_position">top</property> + <property name="always_show_image">True</property> + <property name="draw_indicator">True</property> + <property name="group">none</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">0</property> + <property name="left_attach">0</property> + <property name="top_attach">1</property> </packing> </child> <child> - <object class="GtkBox" id="box5"> + <object class="GtkRadioButton" id="through"> + <property name="label" translatable="yes" context="wrappage|through">Thro_ugh</property> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> <property name="halign">center</property> - <child> - <object class="GtkRadioButton" id="before"> - <property name="label" translatable="yes" context="wrappage|before">Before</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="halign">center</property> - <property name="valign">center</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="image_position">top</property> - <property name="draw_indicator">True</property> - <property name="group">after</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkImage" id="imgleft"> - <property name="can_focus">False</property> - <property name="no_show_all">True</property> - <property name="pixbuf">sw/res/wr02.png</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkImage" id="imgkonleft"> - <property name="can_focus">False</property> - <property name="no_show_all">True</property> - <property name="pixbuf">sw/res/wr08.png</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> + <property name="valign">center</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="image_position">top</property> + <property name="always_show_image">True</property> + <property name="draw_indicator">True</property> + <property name="group">none</property> </object> <packing> <property name="left_attach">1</property> - <property name="top_attach">0</property> + <property name="top_attach">1</property> </packing> </child> <child> - <object class="GtkBox" id="box6"> + <object class="GtkRadioButton" id="optimal"> + <property name="label" translatable="yes" context="wrappage|optimal">_Optimal</property> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> <property name="halign">center</property> - <child> - <object class="GtkRadioButton" id="none"> - <property name="label" translatable="yes" context="wrappage|none">_None</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="halign">center</property> - <property name="valign">center</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="image_position">top</property> - <property name="active">True</property> - <property name="draw_indicator">True</property> - <property name="group">before</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkImage" id="imgnone"> - <property name="can_focus">False</property> - <property name="no_show_all">True</property> - <property name="pixbuf">sw/res/wr01.png</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkImage" id="imgkonnone"> - <property name="can_focus">False</property> - <property name="no_show_all">True</property> - <property name="pixbuf">sw/res/wr07.png</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> + <property name="valign">center</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="image_position">top</property> + <property name="always_show_image">True</property> + <property name="draw_indicator">True</property> + <property name="group">none</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> + <property name="left_attach">2</property> + <property name="top_attach">1</property> </packing> </child> <child> - <object class="GtkBox" id="box2"> + <object class="GtkRadioButton" id="none"> + <property name="label" translatable="yes" context="wrappage|none">_None</property> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> <property name="halign">center</property> - <child> - <object class="GtkRadioButton" id="optimal"> - <property name="label" translatable="yes" context="wrappage|optimal">_Optimal</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="halign">center</property> - <property name="valign">center</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="image_position">top</property> - <property name="draw_indicator">True</property> - <property name="group">none</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkImage" id="imgideal"> - <property name="can_focus">False</property> - <property name="no_show_all">True</property> - <property name="pixbuf">sw/res/wr06.png</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkImage" id="imgkonideal"> - <property name="can_focus">False</property> - <property name="no_show_all">True</property> - <property name="pixbuf">sw/res/wr011.png</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> + <property name="valign">center</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="image_position">top</property> + <property name="always_show_image">True</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">1</property> + <property name="left_attach">0</property> + <property name="top_attach">0</property> </packing> </child> <child> - <object class="GtkBox" id="box1"> + <object class="GtkRadioButton" id="before"> + <property name="label" translatable="yes" context="wrappage|before">Before</property> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="halign">center</property> <property name="valign">center</property> - <child> - <object class="GtkRadioButton" id="through"> - <property name="label" translatable="yes" context="wrappage|through">Thro_ugh</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="halign">center</property> - <property name="valign">center</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="image_position">top</property> - <property name="draw_indicator">True</property> - <property name="group">optimal</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkImage" id="imgthrough"> - <property name="can_focus">False</property> - <property name="no_show_all">True</property> - <property name="pixbuf">sw/res/wr05.png</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="image_position">top</property> + <property name="always_show_image">True</property> + <property name="draw_indicator">True</property> + <property name="group">none</property> </object> <packing> <property name="left_attach">1</property> - <property name="top_attach">1</property> + <property name="top_attach">0</property> </packing> </child> <child> - <object class="GtkBox" id="box3"> + <object class="GtkRadioButton" id="after"> + <property name="label" translatable="yes" context="wrappage|after">After</property> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> <property name="halign">center</property> - <child> - <object class="GtkRadioButton" id="parallel"> - <property name="label" translatable="yes" context="wrappage|parallel">_Parallel</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="halign">center</property> - <property name="valign">center</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="image_position">top</property> - <property name="active">True</property> - <property name="draw_indicator">True</property> - <property name="group">through</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkImage" id="imgparallel"> - <property name="can_focus">False</property> - <property name="no_show_all">True</property> - <property name="pixbuf">sw/res/wr04.png</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkImage" id="imgkonparallel"> - <property name="can_focus">False</property> - <property name="no_show_all">True</property> - <property name="pixbuf">sw/res/wr010.png</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> + <property name="valign">center</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="image_position">top</property> + <property name="always_show_image">True</property> + <property name="draw_indicator">True</property> + <property name="group">none</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> + <property name="left_attach">2</property> + <property name="top_attach">0</property> </packing> </child> </object> @@ -424,10 +239,10 @@ <object class="GtkLabel" id="label4"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="wrappage|label4">L_eft:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">left:0.00cm</property> + <property name="mnemonic_widget">left</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -438,10 +253,10 @@ <object class="GtkLabel" id="label5"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="wrappage|label5">_Right:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">right:0.00cm</property> + <property name="mnemonic_widget">right</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -452,10 +267,10 @@ <object class="GtkLabel" id="label6"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="wrappage|label6">_Top:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">top:0.00cm</property> + <property name="mnemonic_widget">top</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -466,10 +281,10 @@ <object class="GtkLabel" id="label7"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="wrappage|label7">_Bottom:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">bottom:0.00cm</property> + <property name="mnemonic_widget">bottom</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -477,9 +292,10 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="left:0.00cm"> + <object class="GtkSpinButton" id="left"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="activates_default">True</property> <property name="adjustment">adjustment1</property> <property name="digits">2</property> </object> @@ -489,10 +305,11 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="right:0.00cm"> + <object class="GtkSpinButton" id="right"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="adjustment">adjustment1</property> + <property name="activates_default">True</property> + <property name="adjustment">adjustment2</property> <property name="digits">2</property> </object> <packing> @@ -501,10 +318,11 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="top:0.00cm"> + <object class="GtkSpinButton" id="top"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="adjustment">adjustment1</property> + <property name="activates_default">True</property> + <property name="adjustment">adjustment3</property> <property name="digits">2</property> </object> <packing> @@ -513,10 +331,11 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="bottom:0.00cm"> + <object class="GtkSpinButton" id="bottom"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="adjustment">adjustment1</property> + <property name="activates_default">True</property> + <property name="adjustment">adjustment4</property> <property name="digits">2</property> </object> <packing> diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index f6827975dc61..10472c2df71b 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -1070,6 +1070,11 @@ public: m_xButton->SetModeImage(Image()); } + virtual void set_from_icon_name(const OUString& rIconName) override + { + m_xButton->SetModeImage(::Image(BitmapEx(rIconName))); + } + virtual OUString get_label() const override { return m_xButton->GetText(); @@ -1210,6 +1215,11 @@ public: return m_xRadioButton->IsChecked(); } + virtual void set_from_icon_name(const OUString& rIconName) override + { + m_xRadioButton->SetModeRadioImage(::Image(BitmapEx(rIconName))); + } + virtual void set_inconsistent(bool /*inconsistent*/) override { //not available diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 2abff266abe6..0f64c2edad45 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -2751,6 +2751,34 @@ public: } }; +namespace +{ + GdkPixbuf* load_icon_by_name(const OUString& rIconName, const OUString& rIconTheme, const OUString& rUILang) + { + GdkPixbuf* pixbuf = nullptr; + auto xMemStm = ImageTree::get().getImageStream(rIconName, rIconTheme, rUILang); + if (xMemStm) + { + GdkPixbufLoader *pixbuf_loader = gdk_pixbuf_loader_new(); + gdk_pixbuf_loader_write(pixbuf_loader, static_cast<const guchar*>(xMemStm->GetData()), + xMemStm->Seek(STREAM_SEEK_TO_END), nullptr); + gdk_pixbuf_loader_close(pixbuf_loader, nullptr); + pixbuf = gdk_pixbuf_loader_get_pixbuf(pixbuf_loader); + if (pixbuf) + g_object_ref(pixbuf); + g_object_unref(pixbuf_loader); + } + return pixbuf; + } + + GdkPixbuf* load_icon_by_name(const OUString& rIconName) + { + OUString sIconTheme = Application::GetSettings().GetStyleSettings().DetermineIconTheme(); + OUString sUILang = Application::GetSettings().GetUILanguageTag().getBcp47(); + return load_icon_by_name(rIconName, sIconTheme, sUILang); + } +} + class GtkInstanceButton : public GtkInstanceContainer, public virtual weld::Button { private: @@ -2788,6 +2816,15 @@ public: gtk_button_set_image(m_pButton, nullptr); } + virtual void set_from_icon_name(const OUString& rIconName) override + { + GdkPixbuf* pixbuf = load_icon_by_name(rIconName); + if (!pixbuf) + return; + gtk_button_set_image(m_pButton, gtk_image_new_from_pixbuf(pixbuf)); + g_object_unref(pixbuf); + } + virtual OUString get_label() const override { return ::get_label(m_pButton); @@ -3313,27 +3350,6 @@ public: } }; -namespace -{ - GdkPixbuf* load_icon_by_name(const OUString& rIconName, const OUString& rIconTheme, const OUString& rUILang) - { - GdkPixbuf* pixbuf = nullptr; - auto xMemStm = ImageTree::get().getImageStream(rIconName, rIconTheme, rUILang); - if (xMemStm) - { - GdkPixbufLoader *pixbuf_loader = gdk_pixbuf_loader_new(); - gdk_pixbuf_loader_write(pixbuf_loader, static_cast<const guchar*>(xMemStm->GetData()), - xMemStm->Seek(STREAM_SEEK_TO_END), nullptr); - gdk_pixbuf_loader_close(pixbuf_loader, nullptr); - pixbuf = gdk_pixbuf_loader_get_pixbuf(pixbuf_loader); - if (pixbuf) - g_object_ref(pixbuf); - g_object_unref(pixbuf_loader); - } - return pixbuf; - } -} - class GtkInstanceImage : public GtkInstanceWidget, public virtual weld::Image { private: @@ -3348,9 +3364,7 @@ public: virtual void set_from_icon_name(const OUString& rIconName) override { - OUString sIconTheme = Application::GetSettings().GetStyleSettings().DetermineIconTheme(); - OUString sUILang = Application::GetSettings().GetUILanguageTag().getBcp47(); - GdkPixbuf* pixbuf = load_icon_by_name(rIconName, sIconTheme, sUILang); + GdkPixbuf* pixbuf = load_icon_by_name(rIconName); if (!pixbuf) return; gtk_image_set_from_pixbuf(m_pImage, pixbuf); |