diff options
Diffstat (limited to 'cui/source')
-rw-r--r-- | cui/source/inc/border.hxx | 133 | ||||
-rw-r--r-- | cui/source/tabpages/border.cxx | 869 | ||||
-rw-r--r-- | cui/source/tabpages/borderconn.cxx | 291 | ||||
-rw-r--r-- | cui/source/tabpages/borderconn.hxx | 57 | ||||
-rw-r--r-- | cui/source/tabpages/tpbitmap.cxx | 1 |
5 files changed, 584 insertions, 767 deletions
diff --git a/cui/source/inc/border.hxx b/cui/source/inc/border.hxx index e59638036e7d..80dea4edc8b0 100644 --- a/cui/source/inc/border.hxx +++ b/cui/source/inc/border.hxx @@ -19,12 +19,15 @@ #ifndef INCLUDED_CUI_SOURCE_INC_BORDER_HXX #define INCLUDED_CUI_SOURCE_INC_BORDER_HXX +#include <editeng/shaditem.hxx> #include <svtools/ctrlbox.hxx> #include <vcl/group.hxx> #include <vcl/field.hxx> #include <vcl/fixed.hxx> +#include <vcl/weld.hxx> #include <svtools/valueset.hxx> #include <sfx2/tabdlg.hxx> +#include <svx/algitem.hxx> #include <svx/colorbox.hxx> #include <svx/frmsel.hxx> #include <svx/flagsdef.hxx> @@ -38,6 +41,37 @@ namespace editeng class SvxBorderLine; } +class ShadowControlsWrapper +{ +public: + explicit ShadowControlsWrapper(SvtValueSet& rVsPos, weld::MetricSpinButton& rMfSize, ColorListBox& rLbColor); + + SvxShadowItem GetControlValue(const SvxShadowItem& rItem) const; + void SetControlValue(const SvxShadowItem& rItem); + +private: + SvtValueSet& mrVsPos; + weld::MetricSpinButton& mrMfSize; + ColorListBox& mrLbColor; +}; + +class MarginControlsWrapper +{ +public: + explicit MarginControlsWrapper(weld::MetricSpinButton& rMfLeft, weld::MetricSpinButton& rMfRight, + weld::MetricSpinButton& rMfTop, weld::MetricSpinButton& rMfBottom); + + SvxMarginItem GetControlValue(const SvxMarginItem& rItem) const; + void SetControlValue(const SvxMarginItem& rItem); + + bool get_value_changed_from_saved() const; + +private: + weld::MetricSpinButton& mrLeftWrp; + weld::MetricSpinButton& mrRightWrp; + weld::MetricSpinButton& mrTopWrp; + weld::MetricSpinButton& mrBottomWrp; +}; class SvxBorderTabPage : public SfxTabPage { @@ -65,49 +99,15 @@ protected: virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; private: - SvxBorderTabPage( vcl::Window* pParent, const SfxItemSet& rCoreAttrs ); - - // Controls - VclPtr<ValueSet> m_pWndPresets; - VclPtr<FixedText> m_pUserDefFT; - VclPtr<svx::FrameSelector> m_pFrameSel; - - VclPtr<LineListBox> m_pLbLineStyle; - VclPtr<SvxColorListBox> m_pLbLineColor; - VclPtr<MetricField> m_pLineWidthMF; - - VclPtr<VclContainer> m_pSpacingFrame; - VclPtr<FixedText> m_pLeftFT; - VclPtr<MetricField> m_pLeftMF; - VclPtr<FixedText> m_pRightFT; - VclPtr<MetricField> m_pRightMF; - VclPtr<FixedText> m_pTopFT; - VclPtr<MetricField> m_pTopMF; - VclPtr<FixedText> m_pBottomFT; - VclPtr<MetricField> m_pBottomMF; - VclPtr<CheckBox> m_pSynchronizeCB; - - VclPtr<VclContainer> m_pShadowFrame; - VclPtr<ValueSet> m_pWndShadows; - VclPtr<FixedText> m_pFtShadowSize; - VclPtr<MetricField> m_pEdShadowSize; - VclPtr<FixedText> m_pFtShadowColor; - VclPtr<SvxColorListBox> m_pLbShadowColor; - - - VclPtr<VclContainer> m_pPropertiesFrame;///< properties - "Merge with next paragraph" in Writer - VclPtr<CheckBox> m_pMergeWithNextCB; - // #i29550# - VclPtr<CheckBox> m_pMergeAdjacentBordersCB; - VclPtr<CheckBox> m_pRemoveAdjcentCellBordersCB; - VclPtr<FixedText> m_pRemoveAdjcentCellBordersFT; + SvxBorderTabPage(TabPageParent pParent, const SfxItemSet& rCoreAttrs); - std::vector<BitmapEx> m_aShadowImgVec; - std::vector<BitmapEx> m_aBorderImgVec; + std::vector<BitmapEx> m_aShadowImgVec; + std::vector<BitmapEx> m_aBorderImgVec; long nMinValue; ///< minimum distance SwBorderModes nSWMode; ///< table, textframe, paragraph sal_uInt16 mnBoxSlot; + sal_uInt16 mnShadowSlot; bool mbHorEnabled; ///< true = Inner horizontal border enabled. bool mbVerEnabled; ///< true = Inner vertical border enabled. @@ -121,16 +121,55 @@ private: std::set<SvxBorderLineStyle> maUsedBorderStyles; + // Controls + svx::FrameSelector m_aFrameSel; + std::unique_ptr<SvtValueSet> m_xWndPresets; + std::unique_ptr<weld::CustomWeld> m_xWndPresetsWin; + std::unique_ptr<weld::Label> m_xUserDefFT; + std::unique_ptr<weld::CustomWeld> m_xFrameSelWin; + + std::unique_ptr<SvtLineListBox> m_xLbLineStyle; + std::unique_ptr<ColorListBox> m_xLbLineColor; + std::unique_ptr<weld::MetricSpinButton> m_xLineWidthMF; + + std::unique_ptr<weld::Container> m_xSpacingFrame; + std::unique_ptr<weld::Label> m_xLeftFT; + std::unique_ptr<weld::MetricSpinButton> m_xLeftMF; + std::unique_ptr<weld::Label> m_xRightFT; + std::unique_ptr<weld::MetricSpinButton> m_xRightMF; + std::unique_ptr<weld::Label> m_xTopFT; + std::unique_ptr<weld::MetricSpinButton> m_xTopMF; + std::unique_ptr<weld::Label> m_xBottomFT; + std::unique_ptr<weld::MetricSpinButton> m_xBottomMF; + std::unique_ptr<weld::CheckButton> m_xSynchronizeCB; + + std::unique_ptr<weld::Container> m_xShadowFrame; + std::unique_ptr<SvtValueSet> m_xWndShadows; + std::unique_ptr<weld::CustomWeld> m_xWndShadowsWin; + std::unique_ptr<weld::Label> m_xFtShadowSize; + std::unique_ptr<weld::MetricSpinButton> m_xEdShadowSize; + std::unique_ptr<weld::Label> m_xFtShadowColor; + std::unique_ptr<ColorListBox> m_xLbShadowColor; + + std::unique_ptr<weld::Container> m_xPropertiesFrame;///< properties - "Merge with next paragraph" in Writer + std::unique_ptr<weld::CheckButton> m_xMergeWithNextCB; + // #i29550# + std::unique_ptr<weld::CheckButton> m_xMergeAdjacentBordersCB; + std::unique_ptr<weld::CheckButton> m_xRemoveAdjcentCellBordersCB; + std::unique_ptr<weld::Label> m_xRemoveAdjcentCellBordersFT; + std::unique_ptr<ShadowControlsWrapper> m_xShadowControls; + std::unique_ptr<MarginControlsWrapper> m_xMarginControls; + // Handler - DECL_LINK( SelStyleHdl_Impl, ListBox&, void ); - DECL_LINK( SelColHdl_Impl, SvxColorListBox&, void ); - DECL_LINK( SelPreHdl_Impl, ValueSet*, void ); - DECL_LINK( SelSdwHdl_Impl, ValueSet*, void ); - DECL_LINK( LinesChanged_Impl, LinkParamNone*, void ); - DECL_LINK( ModifyDistanceHdl_Impl, Edit&, void); - DECL_LINK( ModifyWidthHdl_Impl, Edit&, void); - DECL_LINK( SyncHdl_Impl, Button*, void); - DECL_LINK( RemoveAdjacentCellBorderHdl_Impl, Button*, void); + DECL_LINK(SelStyleHdl_Impl, SvtLineListBox&, void); + DECL_LINK(SelColHdl_Impl, ColorListBox&, void); + DECL_LINK(SelPreHdl_Impl, SvtValueSet*, void); + DECL_LINK(SelSdwHdl_Impl, SvtValueSet*, void); + DECL_LINK(LinesChanged_Impl, LinkParamNone*, void); + DECL_LINK(ModifyDistanceHdl_Impl, weld::MetricSpinButton&, void); + DECL_LINK(ModifyWidthHdl_Impl, weld::MetricSpinButton&, void); + DECL_LINK(SyncHdl_Impl, weld::ToggleButton&, void); + DECL_LINK(RemoveAdjacentCellBorderHdl_Impl, weld::ToggleButton&, void); sal_uInt16 GetPresetImageId(sal_uInt16 nValueSetIdx) const; const char* GetPresetStringId(sal_uInt16 nValueSetIdx) const; diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx index d638e8657c62..97894415ba4d 100644 --- a/cui/source/tabpages/border.cxx +++ b/cui/source/tabpages/border.cxx @@ -30,7 +30,7 @@ #include <svx/xtable.hxx> #include <svx/drawitem.hxx> #include <editeng/boxitem.hxx> -#include <editeng/shaditem.hxx> +#include <editeng/lineitem.hxx> #include <border.hxx> #include <svx/dlgutil.hxx> #include <dialmgr.hxx> @@ -45,7 +45,6 @@ #include <sfx2/itemconnect.hxx> #include <sal/macros.h> #include <com/sun/star/lang/XServiceInfo.hpp> -#include "borderconn.hxx" using namespace ::editeng; using ::com::sun::star::uno::Reference; @@ -79,11 +78,11 @@ const sal_uInt16 SvxBorderTabPage::pRanges[] = 0 }; -static void lcl_SetDecimalDigitsTo1(MetricField& rField) +static void lcl_SetDecimalDigitsTo1(weld::MetricSpinButton& rField) { - sal_Int64 nMin = rField.Denormalize( rField.GetMin( FUNIT_TWIP ) ); - rField.SetDecimalDigits(1); - rField.SetMin( rField.Normalize( nMin ), FUNIT_TWIP ); + auto nMin = rField.denormalize(rField.get_min(FUNIT_TWIP)); + rField.set_digits(1); + rField.set_min(rField.normalize(nMin), FUNIT_TWIP); } // number of preset images to show @@ -92,11 +91,126 @@ const sal_uInt16 SVX_BORDER_PRESET_COUNT = 5; // number of shadow images to show const sal_uInt16 SVX_BORDER_SHADOW_COUNT = 5; -SvxBorderTabPage::SvxBorderTabPage(vcl::Window* pParent, const SfxItemSet& rCoreAttrs) - : SfxTabPage(pParent, "BorderPage", "cui/ui/borderpage.ui", &rCoreAttrs) +ShadowControlsWrapper::ShadowControlsWrapper(SvtValueSet& rVsPos, weld::MetricSpinButton& rMfSize, ColorListBox& rLbColor) + : mrVsPos(rVsPos) + , mrMfSize(rMfSize) + , mrLbColor(rLbColor) +{ +} + +SvxShadowItem ShadowControlsWrapper::GetControlValue(const SvxShadowItem& rItem) const +{ + SvxShadowItem aItem(rItem); + if (!mrVsPos.IsNoSelection()) + { + switch (mrVsPos.GetSelectedItemId()) + { + case 1: + aItem.SetLocation(SvxShadowLocation::NONE); + break; + case 2: + aItem.SetLocation(SvxShadowLocation::BottomRight); + break; + case 3: + aItem.SetLocation(SvxShadowLocation::TopRight); + break; + case 4: + aItem.SetLocation(SvxShadowLocation::BottomLeft); + break; + case 5: + aItem.SetLocation(SvxShadowLocation::TopLeft); + break; + default: + aItem.SetLocation(SvxShadowLocation::NONE); + break; + } + } + // Default value was saved; so don't change the aItem's width if the control + // has not changed its value, to avoid round-trip errors (like twip->cm->twip) + // E.g., initial 100 twip will become 0.18 cm, which will return as 102 twip + if (mrMfSize.get_value_changed_from_saved()) + aItem.SetWidth(mrMfSize.denormalize(mrMfSize.get_value(FUNIT_TWIP))); + if (!mrLbColor.IsNoSelection()) + aItem.SetColor(mrLbColor.GetSelectEntryColor()); + return aItem; +} + +void ShadowControlsWrapper::SetControlValue(const SvxShadowItem& rItem) +{ + switch (rItem.GetLocation()) + { + case SvxShadowLocation::NONE: + mrVsPos.SelectItem(1); + break; + case SvxShadowLocation::BottomRight: + mrVsPos.SelectItem(2); + break; + case SvxShadowLocation::TopRight: + mrVsPos.SelectItem(3); + break; + case SvxShadowLocation::BottomLeft: + mrVsPos.SelectItem(4); + break; + case SvxShadowLocation::TopLeft: + mrVsPos.SelectItem(5); + break; + default: + mrVsPos.SetNoSelection(); + break; + } + mrMfSize.set_value(mrMfSize.normalize(rItem.GetWidth()), FUNIT_TWIP); + mrLbColor.SelectEntry(rItem.GetColor()); +} + +MarginControlsWrapper::MarginControlsWrapper(weld::MetricSpinButton& rMfLeft, weld::MetricSpinButton& rMfRight, + weld::MetricSpinButton& rMfTop, weld::MetricSpinButton& rMfBottom) + : mrLeftWrp(rMfLeft) + , mrRightWrp(rMfRight) + , mrTopWrp(rMfTop) + , mrBottomWrp(rMfBottom) +{ +} + +SvxMarginItem MarginControlsWrapper::GetControlValue(const SvxMarginItem &rItem) const +{ + SvxMarginItem aItem(rItem); + if (mrLeftWrp.get_sensitive()) + aItem.SetLeftMargin(mrLeftWrp.denormalize(mrLeftWrp.get_value(FUNIT_TWIP))); + if (mrRightWrp.get_sensitive()) + aItem.SetRightMargin(mrRightWrp.denormalize(mrRightWrp.get_value(FUNIT_TWIP))); + if (mrTopWrp.get_sensitive()) + aItem.SetTopMargin(mrTopWrp.denormalize(mrTopWrp.get_value(FUNIT_TWIP))); + if (mrBottomWrp.get_sensitive()) + aItem.SetBottomMargin(mrBottomWrp.denormalize(mrBottomWrp.get_value(FUNIT_TWIP))); + return aItem; +} + +bool MarginControlsWrapper::get_value_changed_from_saved() const +{ + return mrLeftWrp.get_value_changed_from_saved() || + mrRightWrp.get_value_changed_from_saved() || + mrTopWrp.get_value_changed_from_saved() || + mrBottomWrp.get_value_changed_from_saved(); +} + +void MarginControlsWrapper::SetControlValue(const SvxMarginItem& rItem) +{ + mrLeftWrp.set_value(mrLeftWrp.normalize(rItem.GetLeftMargin()), FUNIT_TWIP); + mrRightWrp.set_value(mrRightWrp.normalize(rItem.GetRightMargin()), FUNIT_TWIP); + mrTopWrp.set_value(mrTopWrp.normalize(rItem.GetTopMargin()), FUNIT_TWIP); + mrBottomWrp.set_value(mrBottomWrp.normalize(rItem.GetBottomMargin()), FUNIT_TWIP); + mrLeftWrp.save_value(); + mrRightWrp.save_value(); + mrTopWrp.save_value(); + mrBottomWrp.save_value(); +} + +SvxBorderTabPage::SvxBorderTabPage(TabPageParent pParent, const SfxItemSet& rCoreAttrs) + : SfxTabPage(pParent, "cui/ui/borderpage.ui", "BorderPage", &rCoreAttrs) , nMinValue(0) , nSWMode(SwBorderModes::NONE) , mnBoxSlot(SID_ATTR_BORDER_OUTER) + , mnShadowSlot(SID_ATTR_BORDER_SHADOW) , mbHorEnabled(false) , mbVerEnabled(false) , mbTLBREnabled(false) @@ -106,38 +220,36 @@ SvxBorderTabPage::SvxBorderTabPage(vcl::Window* pParent, const SfxItemSet& rCore , mbSync(true) , mbRemoveAdjacentCellBorders(false) , bIsCalcDoc(false) + , m_xWndPresets(new SvtValueSet(m_xBuilder->weld_scrolled_window("presetswin"))) + , m_xWndPresetsWin(new weld::CustomWeld(*m_xBuilder, "presets", *m_xWndPresets)) + , m_xUserDefFT(m_xBuilder->weld_label("userdefft")) + , m_xFrameSelWin(new weld::CustomWeld(*m_xBuilder, "framesel", m_aFrameSel)) + , m_xLbLineStyle(new SvtLineListBox(m_xBuilder->weld_menu_button("linestylelb"))) + , m_xLbLineColor(new ColorListBox(m_xBuilder->weld_menu_button("linecolorlb"), GetFrameWeld())) + , m_xLineWidthMF(m_xBuilder->weld_metric_spin_button("linewidthmf", FUNIT_POINT)) + , m_xSpacingFrame(m_xBuilder->weld_container("spacing")) + , m_xLeftFT(m_xBuilder->weld_label("leftft")) + , m_xLeftMF(m_xBuilder->weld_metric_spin_button("leftmf", FUNIT_MM)) + , m_xRightFT(m_xBuilder->weld_label("rightft")) + , m_xRightMF(m_xBuilder->weld_metric_spin_button("rightmf", FUNIT_MM)) + , m_xTopFT(m_xBuilder->weld_label("topft")) + , m_xTopMF(m_xBuilder->weld_metric_spin_button("topmf", FUNIT_MM)) + , m_xBottomFT(m_xBuilder->weld_label("bottomft")) + , m_xBottomMF(m_xBuilder->weld_metric_spin_button("bottommf", FUNIT_MM)) + , m_xSynchronizeCB(m_xBuilder->weld_check_button("sync")) + , m_xShadowFrame(m_xBuilder->weld_container("shadow")) + , m_xWndShadows(new SvtValueSet(m_xBuilder->weld_scrolled_window("shadowswin"))) + , m_xWndShadowsWin(new weld::CustomWeld(*m_xBuilder, "shadows", *m_xWndShadows)) + , m_xFtShadowSize(m_xBuilder->weld_label("distanceft")) + , m_xEdShadowSize(m_xBuilder->weld_metric_spin_button("distancemf", FUNIT_MM)) + , m_xFtShadowColor(m_xBuilder->weld_label("shadowcolorft")) + , m_xLbShadowColor(new ColorListBox(m_xBuilder->weld_menu_button("shadowcolorlb"), GetFrameWeld())) + , m_xPropertiesFrame(m_xBuilder->weld_container("properties")) + , m_xMergeWithNextCB(m_xBuilder->weld_check_button("mergewithnext")) + , m_xMergeAdjacentBordersCB(m_xBuilder->weld_check_button("mergeadjacent")) + , m_xRemoveAdjcentCellBordersCB(m_xBuilder->weld_check_button("rmadjcellborders")) + , m_xRemoveAdjcentCellBordersFT(m_xBuilder->weld_label("rmadjcellbordersft")) { - get(m_pWndPresets, "presets"); - get(m_pUserDefFT, "userdefft"); - get(m_pFrameSel, "framesel"); - get(m_pLbLineStyle, "linestylelb"); - get(m_pLbLineColor, "linecolorlb"); - get(m_pLineWidthMF, "linewidthmf"); - - get(m_pSpacingFrame, "spacing"); - get(m_pLeftFT, "leftft"); - get(m_pLeftMF, "leftmf"); - get(m_pRightFT, "rightft"); - get(m_pRightMF, "rightmf"); - get(m_pTopFT, "topft"); - get(m_pTopMF, "topmf"); - get(m_pBottomFT, "bottomft"); - get(m_pBottomMF, "bottommf"); - get(m_pSynchronizeCB, "sync"); - - get(m_pShadowFrame, "shadow"); - get(m_pWndShadows, "shadows"); - get(m_pFtShadowSize, "distanceft"); - get(m_pEdShadowSize, "distancemf"); - get(m_pFtShadowColor, "shadowcolorft"); - get(m_pLbShadowColor, "shadowcolorlb"); - - get(m_pPropertiesFrame, "properties"); - get(m_pMergeWithNextCB, "mergewithnext"); - get(m_pMergeAdjacentBordersCB, "mergeadjacent"); - get(m_pRemoveAdjcentCellBordersCB, "rmadjcellborders"); - get(m_pRemoveAdjcentCellBordersFT, "rmadjcellbordersft"); - static const OUStringLiteral pnBorderImgIds[] = { RID_SVXBMP_CELL_NONE, @@ -209,7 +321,7 @@ SvxBorderTabPage::SvxBorderTabPage(vcl::Window* pParent, const SfxItemSet& rCore { // The caller specifies default line width. Honor it. const SfxInt64Item* p = static_cast<const SfxInt64Item*>(pItem); - m_pLineWidthMF->SetValue(p->GetValue()); + m_xLineWidthMF->set_value(p->GetValue(), FUNIT_POINT); } // set metric @@ -249,7 +361,7 @@ SvxBorderTabPage::SvxBorderTabPage(vcl::Window* pParent, const SfxItemSet& rCore } } - SetFieldUnit(*m_pEdShadowSize, eFUnit); + SetFieldUnit(*m_xEdShadowSize, eFUnit); sal_uInt16 nWhich = GetWhich( SID_ATTR_BORDER_INNER, false ); bool bIsDontCare = true; @@ -267,30 +379,30 @@ SvxBorderTabPage::SvxBorderTabPage(vcl::Window* pParent, const SfxItemSet& rCore if(pBoxInfo->IsDist()) { - SetFieldUnit(*m_pLeftMF, eFUnit); - SetFieldUnit(*m_pRightMF, eFUnit); - SetFieldUnit(*m_pTopMF, eFUnit); - SetFieldUnit(*m_pBottomMF, eFUnit); - m_pSynchronizeCB->SetClickHdl(LINK(this, SvxBorderTabPage, SyncHdl_Impl)); - m_pLeftMF->SetModifyHdl(LINK(this, SvxBorderTabPage, ModifyDistanceHdl_Impl)); - m_pRightMF->SetModifyHdl(LINK(this, SvxBorderTabPage, ModifyDistanceHdl_Impl)); - m_pTopMF->SetModifyHdl(LINK(this, SvxBorderTabPage, ModifyDistanceHdl_Impl)); - m_pBottomMF->SetModifyHdl(LINK(this, SvxBorderTabPage, ModifyDistanceHdl_Impl)); + SetFieldUnit(*m_xLeftMF, eFUnit); + SetFieldUnit(*m_xRightMF, eFUnit); + SetFieldUnit(*m_xTopMF, eFUnit); + SetFieldUnit(*m_xBottomMF, eFUnit); + m_xSynchronizeCB->connect_toggled(LINK(this, SvxBorderTabPage, SyncHdl_Impl)); + m_xLeftMF->connect_value_changed(LINK(this, SvxBorderTabPage, ModifyDistanceHdl_Impl)); + m_xRightMF->connect_value_changed(LINK(this, SvxBorderTabPage, ModifyDistanceHdl_Impl)); + m_xTopMF->connect_value_changed(LINK(this, SvxBorderTabPage, ModifyDistanceHdl_Impl)); + m_xBottomMF->connect_value_changed(LINK(this, SvxBorderTabPage, ModifyDistanceHdl_Impl)); } else { - m_pSpacingFrame->Hide(); + m_xSpacingFrame->hide(); } bIsDontCare = !pBoxInfo->IsValid( SvxBoxInfoItemValidFlags::DISABLE ); } if(!mbUseMarginItem && eFUnit == FUNIT_MM && MapUnit::MapTwip == rCoreAttrs.GetPool()->GetMetric( GetWhich( SID_ATTR_BORDER_INNER ) )) { //#i91548# changing the number of decimal digits changes the minimum values, too - lcl_SetDecimalDigitsTo1(*m_pLeftMF); - lcl_SetDecimalDigitsTo1(*m_pRightMF); - lcl_SetDecimalDigitsTo1(*m_pTopMF); - lcl_SetDecimalDigitsTo1(*m_pBottomMF); - lcl_SetDecimalDigitsTo1(*m_pEdShadowSize); + lcl_SetDecimalDigitsTo1(*m_xLeftMF); + lcl_SetDecimalDigitsTo1(*m_xRightMF); + lcl_SetDecimalDigitsTo1(*m_xTopMF); + lcl_SetDecimalDigitsTo1(*m_xBottomMF); + lcl_SetDecimalDigitsTo1(*m_xEdShadowSize); } FrameSelFlags nFlags = FrameSelFlags::Outer; @@ -304,20 +416,19 @@ SvxBorderTabPage::SvxBorderTabPage(vcl::Window* pParent, const SfxItemSet& rCore nFlags |= FrameSelFlags::DiagonalBLTR; if( bIsDontCare ) nFlags |= FrameSelFlags::DontCare; - m_pFrameSel->Initialize( nFlags ); + m_aFrameSel.Initialize( nFlags ); - m_pFrameSel->SetSelectHdl(LINK(this, SvxBorderTabPage, LinesChanged_Impl)); - m_pLbLineStyle->SetSelectHdl( LINK( this, SvxBorderTabPage, SelStyleHdl_Impl ) ); - m_pLbLineColor->SetSelectHdl( LINK( this, SvxBorderTabPage, SelColHdl_Impl ) ); - m_pLineWidthMF->SetModifyHdl( LINK( this, SvxBorderTabPage, ModifyWidthHdl_Impl ) ); - m_pWndPresets->SetSelectHdl( LINK( this, SvxBorderTabPage, SelPreHdl_Impl ) ); - m_pWndShadows->SetSelectHdl( LINK( this, SvxBorderTabPage, SelSdwHdl_Impl ) ); + m_aFrameSel.SetSelectHdl(LINK(this, SvxBorderTabPage, LinesChanged_Impl)); + m_xLbLineStyle->SetSelectHdl( LINK( this, SvxBorderTabPage, SelStyleHdl_Impl ) ); + m_xLbLineColor->SetSelectHdl( LINK( this, SvxBorderTabPage, SelColHdl_Impl ) ); + m_xLineWidthMF->connect_value_changed( LINK( this, SvxBorderTabPage, ModifyWidthHdl_Impl ) ); + m_xWndPresets->SetSelectHdl( LINK( this, SvxBorderTabPage, SelPreHdl_Impl ) ); + m_xWndShadows->SetSelectHdl( LINK( this, SvxBorderTabPage, SelSdwHdl_Impl ) ); FillValueSets(); FillLineListBox_Impl(); // connections - sal_uInt16 nShadowSlot = SID_ATTR_BORDER_SHADOW; if (rCoreAttrs.HasItem(GetWhich(SID_ATTR_CHAR_GRABBAG), &pItem)) { const SfxGrabBagItem* pGrabBag = static_cast<const SfxGrabBagItem*>(pItem); @@ -328,29 +439,25 @@ SvxBorderTabPage::SvxBorderTabPage(vcl::Window* pParent, const SfxItemSet& rCore it->second >>= bDialogUseCharAttr; if (bDialogUseCharAttr) { - nShadowSlot = SID_ATTR_CHAR_SHADOW; + mnShadowSlot = SID_ATTR_CHAR_SHADOW; mnBoxSlot = SID_ATTR_CHAR_BOX; } } } - bool bSupportsShadow = !SfxItemPool::IsSlot( GetWhich( nShadowSlot ) ); + bool bSupportsShadow = !SfxItemPool::IsSlot(GetWhich(mnShadowSlot)); if( bSupportsShadow ) - AddItemConnection( svx::CreateShadowConnection( nShadowSlot, rCoreAttrs, *m_pWndShadows, *m_pEdShadowSize, *m_pLbShadowColor ) ); + m_xShadowControls.reset(new ShadowControlsWrapper(*m_xWndShadows, *m_xEdShadowSize, *m_xLbShadowColor)); else HideShadowControls(); - if( mbUseMarginItem ) - AddItemConnection( svx::CreateMarginConnection( rCoreAttrs, *m_pLeftMF, *m_pRightMF, *m_pTopMF, *m_pBottomMF ) ); - if( m_pFrameSel->IsBorderEnabled( svx::FrameBorderType::TLBR ) ) - AddItemConnection( svx::CreateFrameLineConnection( SID_ATTR_BORDER_DIAG_TLBR, *m_pFrameSel, svx::FrameBorderType::TLBR ) ); - if( m_pFrameSel->IsBorderEnabled( svx::FrameBorderType::BLTR ) ) - AddItemConnection( svx::CreateFrameLineConnection( SID_ATTR_BORDER_DIAG_BLTR, *m_pFrameSel, svx::FrameBorderType::BLTR ) ); + if (mbUseMarginItem) + m_xMarginControls.reset(new MarginControlsWrapper(*m_xLeftMF, *m_xRightMF, *m_xTopMF, *m_xBottomMF)); // checkbox "Merge with next paragraph" only visible for Writer dialog format.paragraph - m_pMergeWithNextCB->Hide(); + m_xMergeWithNextCB->hide(); // checkbox "Merge adjacent line styles" only visible for Writer dialog format.table - m_pMergeAdjacentBordersCB->Hide(); + m_xMergeAdjacentBordersCB->hide(); SfxObjectShell* pDocSh = SfxObjectShell::Current(); if (pDocSh) @@ -361,14 +468,14 @@ SvxBorderTabPage::SvxBorderTabPage(vcl::Window* pParent, const SfxItemSet& rCore } if( bIsCalcDoc ) { - m_pRemoveAdjcentCellBordersCB->SetClickHdl(LINK(this, SvxBorderTabPage, RemoveAdjacentCellBorderHdl_Impl)); - m_pRemoveAdjcentCellBordersCB->Show(); - m_pRemoveAdjcentCellBordersCB->Enable( false ); + m_xRemoveAdjcentCellBordersCB->connect_toggled(LINK(this, SvxBorderTabPage, RemoveAdjacentCellBorderHdl_Impl)); + m_xRemoveAdjcentCellBordersCB->show(); + m_xRemoveAdjcentCellBordersCB->set_sensitive(false); } else { - m_pRemoveAdjcentCellBordersCB->Hide(); - m_pRemoveAdjcentCellBordersFT->Hide(); + m_xRemoveAdjcentCellBordersCB->hide(); + m_xRemoveAdjcentCellBordersFT->hide(); } } @@ -379,50 +486,31 @@ SvxBorderTabPage::~SvxBorderTabPage() void SvxBorderTabPage::dispose() { - m_pWndPresets.clear(); - m_pUserDefFT.clear(); - m_pFrameSel.clear(); - m_pLbLineStyle.clear(); - m_pLbLineColor.clear(); - m_pLineWidthMF.clear(); - m_pSpacingFrame.clear(); - m_pLeftFT.clear(); - m_pLeftMF.clear(); - m_pRightFT.clear(); - m_pRightMF.clear(); - m_pTopFT.clear(); - m_pTopMF.clear(); - m_pBottomFT.clear(); - m_pBottomMF.clear(); - m_pSynchronizeCB.clear(); - m_pShadowFrame.clear(); - m_pWndShadows.clear(); - m_pFtShadowSize.clear(); - m_pEdShadowSize.clear(); - m_pFtShadowColor.clear(); - m_pLbShadowColor.clear(); - m_pPropertiesFrame.clear(); - m_pMergeWithNextCB.clear(); - m_pMergeAdjacentBordersCB.clear(); - m_pRemoveAdjcentCellBordersCB.clear(); - m_pRemoveAdjcentCellBordersFT.clear(); + m_xLbShadowColor.reset(); + m_xWndShadowsWin.reset(); + m_xWndShadows.reset(); + m_xLbLineColor.reset(); + m_xLbLineStyle.reset(); + m_xFrameSelWin.reset(); + m_xWndPresetsWin.reset(); + m_xWndPresets.reset(); SfxTabPage::dispose(); } VclPtr<SfxTabPage> SvxBorderTabPage::Create( TabPageParent pParent, const SfxItemSet* rAttrSet ) { - return VclPtr<SvxBorderTabPage>::Create( pParent.pParent, *rAttrSet ); + return VclPtr<SvxBorderTabPage>::Create(pParent, *rAttrSet); } void SvxBorderTabPage::ResetFrameLine_Impl( svx::FrameBorderType eBorder, const SvxBorderLine* pCoreLine, bool bValid ) { - if( m_pFrameSel->IsBorderEnabled( eBorder ) ) + if( m_aFrameSel.IsBorderEnabled( eBorder ) ) { if( bValid ) - m_pFrameSel->ShowBorder( eBorder, pCoreLine ); + m_aFrameSel.ShowBorder( eBorder, pCoreLine ); else - m_pFrameSel->SetBorderDontCare( eBorder ); + m_aFrameSel.SetBorderDontCare( eBorder ); } } @@ -437,24 +525,49 @@ bool SvxBorderTabPage::IsBorderLineStyleAllowed( SvxBorderLineStyle nStyle ) con void SvxBorderTabPage::Reset( const SfxItemSet* rSet ) { - SfxTabPage::Reset( rSet ); - SfxItemPool* pPool = rSet->GetPool(); + + if (m_aFrameSel.IsBorderEnabled(svx::FrameBorderType::TLBR)) + { + sal_uInt16 nBorderDiagId = pPool->GetWhich(SID_ATTR_BORDER_DIAG_TLBR); + const SvxLineItem& rLineItem(*static_cast<const SvxLineItem*>(rSet->GetItem(nBorderDiagId))); + m_aFrameSel.ShowBorder(svx::FrameBorderType::TLBR, rLineItem.GetLine()); + } + + if (m_aFrameSel.IsBorderEnabled(svx::FrameBorderType::BLTR)) + { + sal_uInt16 nBorderDiagId = pPool->GetWhich(SID_ATTR_BORDER_DIAG_BLTR); + const SvxLineItem& rLineItem(*static_cast<const SvxLineItem*>(rSet->GetItem(nBorderDiagId))); + m_aFrameSel.ShowBorder(svx::FrameBorderType::BLTR, rLineItem.GetLine()); + } + + if (m_xShadowControls) + { + sal_uInt16 nShadowId = pPool->GetWhich(mnShadowSlot); + m_xShadowControls->SetControlValue(*static_cast<const SvxShadowItem*>(rSet->GetItem(nShadowId))); + } + + if (m_xMarginControls) + { + sal_uInt16 nAlignMarginId = pPool->GetWhich(SID_ATTR_ALIGN_MARGIN); + m_xMarginControls->SetControlValue(*static_cast<const SvxMarginItem*>(rSet->GetItem(nAlignMarginId))); + } + sal_uInt16 nMergeAdjacentBordersId = pPool->GetWhich(SID_SW_COLLAPSING_BORDERS); const SfxBoolItem *pMergeAdjacentBorders = static_cast<const SfxBoolItem*>(rSet->GetItem(nMergeAdjacentBordersId)); if (!pMergeAdjacentBorders) - m_pMergeAdjacentBordersCB->SetState(TRISTATE_INDET); + m_xMergeAdjacentBordersCB->set_state(TRISTATE_INDET); else - m_pMergeAdjacentBordersCB->Check(pMergeAdjacentBorders->GetValue()); - m_pMergeAdjacentBordersCB->SaveValue(); + m_xMergeAdjacentBordersCB->set_active(pMergeAdjacentBorders->GetValue()); + m_xMergeAdjacentBordersCB->save_state(); sal_uInt16 nMergeWithNextId = pPool->GetWhich(SID_ATTR_BORDER_CONNECT); const SfxBoolItem *pMergeWithNext = static_cast<const SfxBoolItem*>(rSet->GetItem(nMergeWithNextId)); if (!pMergeWithNext) - m_pMergeWithNextCB->SetState(TRISTATE_INDET); + m_xMergeWithNextCB->set_state(TRISTATE_INDET); else - m_pMergeWithNextCB->Check(pMergeWithNext->GetValue()); - m_pMergeWithNextCB->SaveValue(); + m_xMergeWithNextCB->set_active(pMergeWithNext->GetValue()); + m_xMergeWithNextCB->save_state(); const SvxBoxItem* pBoxItem; const SvxBoxInfoItem* pBoxInfoItem; @@ -481,89 +594,68 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet ) if( !mbUseMarginItem ) { - if ( m_pLeftMF->IsVisible() ) + if (m_xLeftMF->get_visible()) { - SetMetricValue(*m_pLeftMF, pBoxInfoItem->GetDefDist(), eCoreUnit); - SetMetricValue(*m_pRightMF, pBoxInfoItem->GetDefDist(), eCoreUnit); - SetMetricValue(*m_pTopMF, pBoxInfoItem->GetDefDist(), eCoreUnit); - SetMetricValue(*m_pBottomMF, pBoxInfoItem->GetDefDist(), eCoreUnit); + SetMetricValue(*m_xLeftMF, pBoxInfoItem->GetDefDist(), eCoreUnit); + SetMetricValue(*m_xRightMF, pBoxInfoItem->GetDefDist(), eCoreUnit); + SetMetricValue(*m_xTopMF, pBoxInfoItem->GetDefDist(), eCoreUnit); + SetMetricValue(*m_xBottomMF, pBoxInfoItem->GetDefDist(), eCoreUnit); - nMinValue = static_cast<long>(m_pLeftMF->GetValue()); + nMinValue = m_xLeftMF->get_value(FUNIT_NONE); if ( pBoxInfoItem->IsMinDist() ) { - m_pLeftMF->SetFirst( nMinValue ); - m_pRightMF->SetFirst( nMinValue ); - m_pTopMF->SetFirst( nMinValue ); - m_pBottomMF->SetFirst( nMinValue ); + m_xLeftMF->set_min(nMinValue, FUNIT_NONE); + m_xRightMF->set_min(nMinValue, FUNIT_NONE); + m_xTopMF->set_min(nMinValue, FUNIT_NONE); + m_xBottomMF->set_min(nMinValue, FUNIT_NONE); } if ( pBoxInfoItem->IsDist() ) { if( rSet->GetItemState( nWhichBox ) >= SfxItemState::DEFAULT ) { - bool bIsAnyBorderVisible = m_pFrameSel->IsAnyBorderVisible(); + bool bIsAnyBorderVisible = m_aFrameSel.IsAnyBorderVisible(); if( !bIsAnyBorderVisible || !pBoxInfoItem->IsMinDist() ) { - m_pLeftMF->SetMin( 0 ); - m_pLeftMF->SetFirst( 0 ); - m_pRightMF->SetMin( 0 ); - m_pRightMF->SetFirst( 0 ); - m_pTopMF->SetMin( 0 ); - m_pTopMF->SetFirst( 0 ); - m_pBottomMF->SetMin( 0 ); - m_pBottomMF->SetFirst( 0 ); + m_xLeftMF->set_min(0, FUNIT_NONE); + m_xRightMF->set_min(0, FUNIT_NONE); + m_xTopMF->set_min(0, FUNIT_NONE); + m_xBottomMF->set_min(0, FUNIT_NONE); } long nLeftDist = pBoxItem->GetDistance( SvxBoxItemLine::LEFT); - SetMetricValue(*m_pLeftMF, nLeftDist, eCoreUnit); + SetMetricValue(*m_xLeftMF, nLeftDist, eCoreUnit); long nRightDist = pBoxItem->GetDistance( SvxBoxItemLine::RIGHT); - SetMetricValue(*m_pRightMF, nRightDist, eCoreUnit); + SetMetricValue(*m_xRightMF, nRightDist, eCoreUnit); long nTopDist = pBoxItem->GetDistance( SvxBoxItemLine::TOP); - SetMetricValue( *m_pTopMF, nTopDist, eCoreUnit ); + SetMetricValue( *m_xTopMF, nTopDist, eCoreUnit ); long nBottomDist = pBoxItem->GetDistance( SvxBoxItemLine::BOTTOM); - SetMetricValue( *m_pBottomMF, nBottomDist, eCoreUnit ); - - // if the distance is set with no active border line - // or it is null with an active border line - // no automatic changes should be made - const long nDefDist = bIsAnyBorderVisible ? pBoxInfoItem->GetDefDist() : 0; - bool bDiffDist = (nDefDist != nLeftDist || - nDefDist != nRightDist || - nDefDist != nTopDist || - nDefDist != nBottomDist); - if ((pBoxItem->GetSmallestDistance() || - bIsAnyBorderVisible) && bDiffDist ) - { - m_pLeftMF->SetModifyFlag(); - m_pRightMF->SetModifyFlag(); - m_pTopMF->SetModifyFlag(); - m_pBottomMF->SetModifyFlag(); - } + SetMetricValue( *m_xBottomMF, nBottomDist, eCoreUnit ); } else { // #106224# different margins -> do not fill the edits - m_pLeftMF->SetText( OUString() ); - m_pRightMF->SetText( OUString() ); - m_pTopMF->SetText( OUString() ); - m_pBottomMF->SetText( OUString() ); + m_xLeftMF->set_text( OUString() ); + m_xRightMF->set_text( OUString() ); + m_xTopMF->set_text( OUString() ); + m_xBottomMF->set_text( OUString() ); } } - m_pLeftMF->SaveValue(); - m_pRightMF->SaveValue(); - m_pTopMF->SaveValue(); - m_pBottomMF->SaveValue(); + m_xLeftMF->save_value(); + m_xRightMF->save_value(); + m_xTopMF->save_value(); + m_xBottomMF->save_value(); } } } else { // avoid ResetFrameLine-calls: - m_pFrameSel->HideAllBorders(); + m_aFrameSel.HideAllBorders(); } - if( !m_pFrameSel->IsAnyBorderVisible() ) - m_pFrameSel->DeselectAllBorders(); + if( !m_aFrameSel.IsAnyBorderVisible() ) + m_aFrameSel.DeselectAllBorders(); // depict line (color) in controllers if unambiguous: @@ -571,54 +663,54 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet ) // Do all visible lines show the same line widths? long nWidth; SvxBorderLineStyle nStyle; - bool bWidthEq = m_pFrameSel->GetVisibleWidth( nWidth, nStyle ); + bool bWidthEq = m_aFrameSel.GetVisibleWidth( nWidth, nStyle ); if( bWidthEq ) { // Determine the width first as some styles can be missing depending on it sal_Int64 nWidthPt = static_cast<sal_Int64>(MetricField::ConvertDoubleValue( - sal_Int64( nWidth ), m_pLineWidthMF->GetDecimalDigits( ), - MapUnit::MapTwip, m_pLineWidthMF->GetUnit() )); - m_pLineWidthMF->SetValue( nWidthPt ); - m_pLbLineStyle->SetWidth(5); + sal_Int64( nWidth ), m_xLineWidthMF->get_digits(), + MapUnit::MapTwip, FUNIT_POINT )); + m_xLineWidthMF->set_value(nWidthPt, FUNIT_POINT); + m_xLbLineStyle->SetWidth(nWidth); // then set the style - m_pLbLineStyle->SelectEntry( nStyle ); + m_xLbLineStyle->SelectEntry( nStyle ); } else - m_pLbLineStyle->SelectEntryPos( 1 ); + m_xLbLineStyle->SelectEntry(SvxBorderLineStyle::SOLID); // Do all visible lines show the same line color? Color aColor; - bool bColorEq = m_pFrameSel->GetVisibleColor( aColor ); + bool bColorEq = m_aFrameSel.GetVisibleColor( aColor ); if( !bColorEq ) aColor = COL_BLACK; - m_pLbLineColor->SelectEntry(aColor); - m_pLbLineStyle->SetColor(GetTextColor()); + m_xLbLineColor->SelectEntry(aColor); + m_xLbLineStyle->SetColor(GetTextColor()); // Select all visible lines, if they are all equal. if( bWidthEq && bColorEq ) - m_pFrameSel->SelectAllVisibleBorders(); + m_aFrameSel.SelectAllVisibleBorders(); // set the current style and color (caches style in control even if nothing is selected) - SelStyleHdl_Impl(*m_pLbLineStyle); - SelColHdl_Impl(*m_pLbLineColor); + SelStyleHdl_Impl(*m_xLbLineStyle); + SelColHdl_Impl(*m_xLbLineColor); } - bool bEnable = m_pWndShadows->GetSelectedItemId() > 1 ; - m_pFtShadowSize->Enable(bEnable); - m_pEdShadowSize->Enable(bEnable); - m_pFtShadowColor->Enable(bEnable); - m_pLbShadowColor->Enable(bEnable); + bool bEnable = m_xWndShadows->GetSelectedItemId() > 1 ; + m_xFtShadowSize->set_sensitive(bEnable); + m_xEdShadowSize->set_sensitive(bEnable); + m_xFtShadowColor->set_sensitive(bEnable); + m_xLbShadowColor->set_sensitive(bEnable); - m_pWndPresets->SetNoSelection(); + m_xWndPresets->SetNoSelection(); // - no line - should not be selected - if ( m_pLbLineStyle->GetSelectedEntryPos() == 0 ) + if (m_xLbLineStyle->GetSelectEntryStyle() == SvxBorderLineStyle::NONE) { - m_pLbLineStyle->SelectEntryPos( 1 ); - SelStyleHdl_Impl(*m_pLbLineStyle); + m_xLbLineStyle->SelectEntry(SvxBorderLineStyle::SOLID); + SelStyleHdl_Impl(*m_xLbLineStyle); } const SfxPoolItem* pItem; @@ -631,39 +723,43 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet ) if(nHtmlMode & HTMLMODE_ON) { // there are no shadows in Html-mode and only complete borders - m_pShadowFrame->Disable(); + m_xShadowFrame->set_sensitive(false); if( !(nSWMode & SwBorderModes::TABLE) ) { - m_pUserDefFT->Disable(); - m_pFrameSel->Disable(); - m_pWndPresets->RemoveItem(3); - m_pWndPresets->RemoveItem(4); - m_pWndPresets->RemoveItem(5); + m_xUserDefFT->set_sensitive(false); + m_xFrameSelWin->set_sensitive(false); + m_xWndPresets->RemoveItem(3); + m_xWndPresets->RemoveItem(4); + m_xWndPresets->RemoveItem(5); } } } LinesChanged_Impl( nullptr ); - if(m_pLeftMF->GetValue() == m_pRightMF->GetValue() && m_pTopMF->GetValue() == m_pBottomMF->GetValue() && m_pTopMF->GetValue() == m_pLeftMF->GetValue()) + if (m_xLeftMF->get_value(FUNIT_NONE) == m_xRightMF->get_value(FUNIT_NONE) && + m_xTopMF->get_value(FUNIT_NONE) == m_xBottomMF->get_value(FUNIT_NONE) && + m_xTopMF->get_value(FUNIT_NONE) == m_xLeftMF->get_value(FUNIT_NONE)) + { mbSync = true; + } else mbSync = false; - m_pSynchronizeCB->Check(mbSync); + m_xSynchronizeCB->set_active(mbSync); mbRemoveAdjacentCellBorders = false; - m_pRemoveAdjcentCellBordersCB->Check( false ); - m_pRemoveAdjcentCellBordersCB->Enable( false ); + m_xRemoveAdjcentCellBordersCB->set_active(false); + m_xRemoveAdjcentCellBordersCB->set_sensitive(false); } void SvxBorderTabPage::ChangesApplied() { - m_pLeftMF->SaveValue(); - m_pRightMF->SaveValue(); - m_pTopMF->SaveValue(); - m_pBottomMF->SaveValue(); - m_pMergeWithNextCB->SaveValue(); - m_pMergeAdjacentBordersCB->SaveValue(); + m_xLeftMF->save_value(); + m_xRightMF->save_value(); + m_xTopMF->save_value(); + m_xBottomMF->save_value(); + m_xMergeWithNextCB->save_state(); + m_xMergeAdjacentBordersCB->save_state(); } DeactivateRC SvxBorderTabPage::DeactivatePage( SfxItemSet* _pSet ) @@ -676,13 +772,52 @@ DeactivateRC SvxBorderTabPage::DeactivatePage( SfxItemSet* _pSet ) bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs ) { - bool bAttrsChanged = SfxTabPage::FillItemSet( rCoreAttrs ); + bool bAttrsChanged = false; SfxItemPool* pPool = rCoreAttrs->GetPool(); - if (m_pMergeAdjacentBordersCB->IsValueChangedFromSaved()) + + if (m_aFrameSel.IsBorderEnabled(svx::FrameBorderType::TLBR)) + { + sal_uInt16 nBorderDiagId = pPool->GetWhich(SID_ATTR_BORDER_DIAG_TLBR); + SvxLineItem aLineItem(*static_cast<const SvxLineItem*>(rCoreAttrs->GetItem(nBorderDiagId))); + aLineItem.SetLine(m_aFrameSel.GetFrameBorderStyle(svx::FrameBorderType::TLBR)); + rCoreAttrs->Put(aLineItem); + bAttrsChanged = true; + } + + if (m_aFrameSel.IsBorderEnabled(svx::FrameBorderType::BLTR)) + { + sal_uInt16 nBorderDiagId = pPool->GetWhich(SID_ATTR_BORDER_DIAG_BLTR); + SvxLineItem aLineItem(*static_cast<const SvxLineItem*>(rCoreAttrs->GetItem(nBorderDiagId))); + aLineItem.SetLine(m_aFrameSel.GetFrameBorderStyle(svx::FrameBorderType::BLTR)); + rCoreAttrs->Put(aLineItem); + bAttrsChanged = true; + } + + if (m_xShadowControls) + { + sal_uInt16 nShadowId = pPool->GetWhich(mnShadowSlot); + const SvxShadowItem& rOldShadowItem = *static_cast<const SvxShadowItem*>(rCoreAttrs->GetItem(nShadowId)); + SvxShadowItem aNewShadowItem = m_xShadowControls->GetControlValue(rOldShadowItem); + if (aNewShadowItem != rOldShadowItem) + { + rCoreAttrs->Put(aNewShadowItem); + bAttrsChanged = true; + } + } + + if (m_xMarginControls && m_xMarginControls->get_value_changed_from_saved()) + { + sal_uInt16 nAlignMarginId = pPool->GetWhich(SID_ATTR_ALIGN_MARGIN); + const SvxMarginItem& rOldMarginItem = *static_cast<const SvxMarginItem*>(rCoreAttrs->GetItem(nAlignMarginId)); + rCoreAttrs->Put(m_xMarginControls->GetControlValue(rOldMarginItem)); + bAttrsChanged = true; + } + + if (m_xMergeAdjacentBordersCB->get_state_changed_from_saved()) { sal_uInt16 nMergeAdjacentBordersId = pPool->GetWhich(SID_SW_COLLAPSING_BORDERS); - auto nState = m_pMergeAdjacentBordersCB->GetState(); + auto nState = m_xMergeAdjacentBordersCB->get_state(); if (nState == TRISTATE_INDET) rCoreAttrs->ClearItem(nMergeAdjacentBordersId); else @@ -694,10 +829,10 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs ) bAttrsChanged = true; } - if (m_pMergeWithNextCB->IsValueChangedFromSaved()) + if (m_xMergeWithNextCB->get_state_changed_from_saved()) { sal_uInt16 nMergeWithNextId = pPool->GetWhich(SID_ATTR_BORDER_CONNECT); - auto nState = m_pMergeWithNextCB->GetState(); + auto nState = m_xMergeWithNextCB->get_state(); if (nState == TRISTATE_INDET) rCoreAttrs->ClearItem(nMergeWithNextId); else @@ -730,7 +865,7 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs ) }; for (std::pair<svx::FrameBorderType,SvxBoxItemLine> const & i : eTypes1) - aBoxItem.SetLine( m_pFrameSel->GetFrameBorderStyle( i.first ), i.second ); + aBoxItem.SetLine( m_aFrameSel.GetFrameBorderStyle( i.first ), i.second ); aBoxItem.SetRemoveAdjacentCellBorder( mbRemoveAdjacentCellBorders ); @@ -741,7 +876,7 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs ) { svx::FrameBorderType::Vertical,SvxBoxInfoItemLine::VERT } }; for (std::pair<svx::FrameBorderType,SvxBoxInfoItemLine> const & j : eTypes2) - aBoxInfoItem.SetLine( m_pFrameSel->GetFrameBorderStyle( j.first ), j.second ); + aBoxInfoItem.SetLine( m_aFrameSel.GetFrameBorderStyle( j.first ), j.second ); aBoxInfoItem.EnableHor( mbHorEnabled ); aBoxInfoItem.EnableVer( mbVerEnabled ); @@ -749,7 +884,7 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs ) // inner distance - if( m_pLeftMF->IsVisible() ) + if (m_xLeftMF->get_visible()) { // #i40405# enable distance controls for next dialog call aBoxInfoItem.SetDist( true ); @@ -757,36 +892,36 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs ) if( !mbUseMarginItem ) { // #106224# all edits empty: do nothing - if( !m_pLeftMF->GetText().isEmpty() || !m_pRightMF->GetText().isEmpty() || - !m_pTopMF->GetText().isEmpty() || !m_pBottomMF->GetText().isEmpty() ) + if( !m_xLeftMF->get_text().isEmpty() || !m_xRightMF->get_text().isEmpty() || + !m_xTopMF->get_text().isEmpty() || !m_xBottomMF->get_text().isEmpty() ) { if ( mbAllowPaddingWithoutBorders || ((mbHorEnabled || mbVerEnabled || (nSWMode & SwBorderModes::TABLE)) && - (m_pLeftMF->IsModified()||m_pRightMF->IsModified()|| - m_pTopMF->IsModified()||m_pBottomMF->IsModified()) ) - || m_pFrameSel->GetFrameBorderState( svx::FrameBorderType::Top ) != svx::FrameBorderState::Hide - || m_pFrameSel->GetFrameBorderState( svx::FrameBorderType::Bottom ) != svx::FrameBorderState::Hide - || m_pFrameSel->GetFrameBorderState( svx::FrameBorderType::Left ) != svx::FrameBorderState::Hide - || m_pFrameSel->GetFrameBorderState( svx::FrameBorderType::Right ) != svx::FrameBorderState::Hide ) + (m_xLeftMF->get_value_changed_from_saved()||m_xRightMF->get_value_changed_from_saved()|| + m_xTopMF->get_value_changed_from_saved()||m_xBottomMF->get_value_changed_from_saved()) ) + || m_aFrameSel.GetFrameBorderState( svx::FrameBorderType::Top ) != svx::FrameBorderState::Hide + || m_aFrameSel.GetFrameBorderState( svx::FrameBorderType::Bottom ) != svx::FrameBorderState::Hide + || m_aFrameSel.GetFrameBorderState( svx::FrameBorderType::Left ) != svx::FrameBorderState::Hide + || m_aFrameSel.GetFrameBorderState( svx::FrameBorderType::Right ) != svx::FrameBorderState::Hide ) { const SvxBoxInfoItem* pOldBoxInfoItem = GetOldItem( *rCoreAttrs, SID_ATTR_BORDER_INNER ); if ( !pOldBoxItem || - m_pLeftMF->IsValueChangedFromSaved() || - m_pRightMF->IsValueChangedFromSaved() || - m_pTopMF->IsValueChangedFromSaved() || - m_pBottomMF->IsValueChangedFromSaved() || - nMinValue == m_pLeftMF->GetValue() || - nMinValue == m_pRightMF->GetValue() || - nMinValue == m_pTopMF->GetValue() || - nMinValue == m_pBottomMF->GetValue() || + m_xLeftMF->get_value_changed_from_saved() || + m_xRightMF->get_value_changed_from_saved() || + m_xTopMF->get_value_changed_from_saved() || + m_xBottomMF->get_value_changed_from_saved() || + nMinValue == m_xLeftMF->get_value(FUNIT_NONE) || + nMinValue == m_xRightMF->get_value(FUNIT_NONE) || + nMinValue == m_xTopMF->get_value(FUNIT_NONE) || + nMinValue == m_xBottomMF->get_value(FUNIT_NONE) || (pOldBoxInfoItem && !pOldBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::DISTANCE)) ) { - aBoxItem.SetDistance( static_cast<sal_uInt16>(GetCoreValue(*m_pLeftMF, eCoreUnit )), SvxBoxItemLine::LEFT ); - aBoxItem.SetDistance( static_cast<sal_uInt16>(GetCoreValue(*m_pRightMF, eCoreUnit )), SvxBoxItemLine::RIGHT ); - aBoxItem.SetDistance( static_cast<sal_uInt16>(GetCoreValue(*m_pTopMF, eCoreUnit )), SvxBoxItemLine::TOP ); - aBoxItem.SetDistance( static_cast<sal_uInt16>(GetCoreValue(*m_pBottomMF, eCoreUnit )), SvxBoxItemLine::BOTTOM); + aBoxItem.SetDistance( static_cast<sal_uInt16>(GetCoreValue(*m_xLeftMF, eCoreUnit )), SvxBoxItemLine::LEFT ); + aBoxItem.SetDistance( static_cast<sal_uInt16>(GetCoreValue(*m_xRightMF, eCoreUnit )), SvxBoxItemLine::RIGHT ); + aBoxItem.SetDistance( static_cast<sal_uInt16>(GetCoreValue(*m_xTopMF, eCoreUnit )), SvxBoxItemLine::TOP ); + aBoxItem.SetDistance( static_cast<sal_uInt16>(GetCoreValue(*m_xBottomMF, eCoreUnit )), SvxBoxItemLine::BOTTOM); } else { @@ -806,12 +941,12 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs ) // note Don't Care Status in the Info-Item: - aBoxInfoItem.SetValid( SvxBoxInfoItemValidFlags::TOP, m_pFrameSel->GetFrameBorderState( svx::FrameBorderType::Top ) != svx::FrameBorderState::DontCare ); - aBoxInfoItem.SetValid( SvxBoxInfoItemValidFlags::BOTTOM, m_pFrameSel->GetFrameBorderState( svx::FrameBorderType::Bottom ) != svx::FrameBorderState::DontCare ); - aBoxInfoItem.SetValid( SvxBoxInfoItemValidFlags::LEFT, m_pFrameSel->GetFrameBorderState( svx::FrameBorderType::Left ) != svx::FrameBorderState::DontCare ); - aBoxInfoItem.SetValid( SvxBoxInfoItemValidFlags::RIGHT, m_pFrameSel->GetFrameBorderState( svx::FrameBorderType::Right ) != svx::FrameBorderState::DontCare ); - aBoxInfoItem.SetValid( SvxBoxInfoItemValidFlags::HORI, m_pFrameSel->GetFrameBorderState( svx::FrameBorderType::Horizontal ) != svx::FrameBorderState::DontCare ); - aBoxInfoItem.SetValid( SvxBoxInfoItemValidFlags::VERT, m_pFrameSel->GetFrameBorderState( svx::FrameBorderType::Vertical ) != svx::FrameBorderState::DontCare ); + aBoxInfoItem.SetValid( SvxBoxInfoItemValidFlags::TOP, m_aFrameSel.GetFrameBorderState( svx::FrameBorderType::Top ) != svx::FrameBorderState::DontCare ); + aBoxInfoItem.SetValid( SvxBoxInfoItemValidFlags::BOTTOM, m_aFrameSel.GetFrameBorderState( svx::FrameBorderType::Bottom ) != svx::FrameBorderState::DontCare ); + aBoxInfoItem.SetValid( SvxBoxInfoItemValidFlags::LEFT, m_aFrameSel.GetFrameBorderState( svx::FrameBorderType::Left ) != svx::FrameBorderState::DontCare ); + aBoxInfoItem.SetValid( SvxBoxInfoItemValidFlags::RIGHT, m_aFrameSel.GetFrameBorderState( svx::FrameBorderType::Right ) != svx::FrameBorderState::DontCare ); + aBoxInfoItem.SetValid( SvxBoxInfoItemValidFlags::HORI, m_aFrameSel.GetFrameBorderState( svx::FrameBorderType::Horizontal ) != svx::FrameBorderState::DontCare ); + aBoxInfoItem.SetValid( SvxBoxInfoItemValidFlags::VERT, m_aFrameSel.GetFrameBorderState( svx::FrameBorderType::Vertical ) != svx::FrameBorderState::DontCare ); // Put or Clear of the border? @@ -858,7 +993,7 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs ) void SvxBorderTabPage::HideShadowControls() { - m_pShadowFrame->Hide(); + m_xShadowFrame->hide(); } #define IID_PRE_CELL_NONE 1 @@ -883,7 +1018,7 @@ void SvxBorderTabPage::HideShadowControls() #define IID_PRE_TABLE_ALL 20 #define IID_PRE_TABLE_OUTER2 21 -IMPL_LINK_NOARG(SvxBorderTabPage, SelPreHdl_Impl, ValueSet*, void) +IMPL_LINK_NOARG(SvxBorderTabPage, SelPreHdl_Impl, SvtValueSet*, void) { const svx::FrameBorderState SHOW = svx::FrameBorderState::Show; const svx::FrameBorderState HIDE = svx::FrameBorderState::Hide; @@ -916,11 +1051,11 @@ IMPL_LINK_NOARG(SvxBorderTabPage, SelPreHdl_Impl, ValueSet*, void) }; // first hide and deselect all frame borders - m_pFrameSel->HideAllBorders(); - m_pFrameSel->DeselectAllBorders(); + m_aFrameSel.HideAllBorders(); + m_aFrameSel.DeselectAllBorders(); // Using image ID to find correct line in table above. - sal_uInt16 nLine = GetPresetImageId( m_pWndPresets->GetSelectedItemId() ) - 1; + sal_uInt16 nLine = GetPresetImageId( m_xWndPresets->GetSelectedItemId() ) - 1; // Apply all styles from the table for( int nBorder = 0; nBorder < svx::FRAMEBORDERTYPE_COUNT; ++nBorder ) @@ -928,73 +1063,70 @@ IMPL_LINK_NOARG(SvxBorderTabPage, SelPreHdl_Impl, ValueSet*, void) svx::FrameBorderType eBorder = svx::GetFrameBorderTypeFromIndex( nBorder ); switch( ppeStates[ nLine ][ nBorder ] ) { - case SHOW: m_pFrameSel->SelectBorder( eBorder ); break; + case SHOW: m_aFrameSel.SelectBorder( eBorder ); break; case HIDE: /* nothing to do */ break; - case DONT: m_pFrameSel->SetBorderDontCare( eBorder ); break; + case DONT: m_aFrameSel.SetBorderDontCare( eBorder ); break; } } // Show all lines that have been selected above - if( m_pFrameSel->IsAnyBorderSelected() ) + if( m_aFrameSel.IsAnyBorderSelected() ) { // any visible style, but "no-line" in line list box? -> use hair-line - if( (m_pLbLineStyle->GetSelectedEntryPos() == 0) || (m_pLbLineStyle->GetSelectedEntryPos() == LISTBOX_ENTRY_NOTFOUND) ) - m_pLbLineStyle->SelectEntryPos( 1 ); + if (m_xLbLineStyle->GetSelectEntryStyle() == SvxBorderLineStyle::NONE) + m_xLbLineStyle->SelectEntry(SvxBorderLineStyle::SOLID); // set current style to all previously selected lines - SelStyleHdl_Impl(*m_pLbLineStyle); - SelColHdl_Impl(*m_pLbLineColor); + SelStyleHdl_Impl(*m_xLbLineStyle); + SelColHdl_Impl(*m_xLbLineColor); } // Presets ValueSet does not show a selection (used as push buttons). - m_pWndPresets->SetNoSelection(); + m_xWndPresets->SetNoSelection(); LinesChanged_Impl( nullptr ); UpdateRemoveAdjCellBorderCB( nLine + 1 ); } - -IMPL_LINK_NOARG(SvxBorderTabPage, SelSdwHdl_Impl, ValueSet*, void) +IMPL_LINK_NOARG(SvxBorderTabPage, SelSdwHdl_Impl, SvtValueSet*, void) { - bool bEnable = m_pWndShadows->GetSelectedItemId() > 1; - m_pFtShadowSize->Enable(bEnable); - m_pEdShadowSize->Enable(bEnable); - m_pFtShadowColor->Enable(bEnable); - m_pLbShadowColor->Enable(bEnable); + bool bEnable = m_xWndShadows->GetSelectedItemId() > 1; + m_xFtShadowSize->set_sensitive(bEnable); + m_xEdShadowSize->set_sensitive(bEnable); + m_xFtShadowColor->set_sensitive(bEnable); + m_xLbShadowColor->set_sensitive(bEnable); } -IMPL_LINK(SvxBorderTabPage, SelColHdl_Impl, SvxColorListBox&, rColorBox, void) +IMPL_LINK(SvxBorderTabPage, SelColHdl_Impl, ColorListBox&, rColorBox, void) { Color aColor = rColorBox.GetSelectEntryColor(); - m_pFrameSel->SetColorToSelection(aColor); + m_aFrameSel.SetColorToSelection(aColor); } -IMPL_LINK_NOARG(SvxBorderTabPage, ModifyWidthHdl_Impl, Edit&, void) +IMPL_LINK_NOARG(SvxBorderTabPage, ModifyWidthHdl_Impl, weld::MetricSpinButton&, void) { - sal_Int64 nVal = static_cast<sal_Int64>(MetricField::ConvertDoubleValue( - m_pLineWidthMF->GetValue( ), - m_pLineWidthMF->GetDecimalDigits( ), - m_pLineWidthMF->GetUnit(), MapUnit::MapTwip )); - - m_pFrameSel->SetStyleToSelection( nVal, - m_pLbLineStyle->GetSelectEntryStyle() ); + sal_Int64 nVal = m_xLineWidthMF->get_value(FUNIT_NONE); + nVal = static_cast<sal_Int64>(MetricField::ConvertDoubleValue( + nVal, + m_xLineWidthMF->get_digits(), + FUNIT_POINT, MapUnit::MapTwip )); + m_xLbLineStyle->SetWidth( nVal ); + + m_aFrameSel.SetStyleToSelection( nVal, + m_xLbLineStyle->GetSelectEntryStyle() ); } - -IMPL_LINK( SvxBorderTabPage, SelStyleHdl_Impl, ListBox&, rLb, void ) +IMPL_LINK_NOARG(SvxBorderTabPage, SelStyleHdl_Impl, SvtLineListBox&, void) { - if (&rLb == m_pLbLineStyle) - { - sal_Int64 nVal = static_cast<sal_Int64>(MetricField::ConvertDoubleValue( - m_pLineWidthMF->GetValue( ), - m_pLineWidthMF->GetDecimalDigits( ), - m_pLineWidthMF->GetUnit(), MapUnit::MapTwip )); - m_pFrameSel->SetStyleToSelection ( nVal, - m_pLbLineStyle->GetSelectEntryStyle() ); - } + sal_Int64 nVal = m_xLineWidthMF->get_value(FUNIT_NONE); + nVal = static_cast<sal_Int64>(MetricField::ConvertDoubleValue( + nVal, + m_xLineWidthMF->get_digits(), + FUNIT_POINT, MapUnit::MapTwip )); + m_aFrameSel.SetStyleToSelection ( nVal, + m_xLbLineStyle->GetSelectEntryStyle() ); } - // ValueSet handling sal_uInt16 SvxBorderTabPage::GetPresetImageId( sal_uInt16 nValueSetIdx ) const { @@ -1065,27 +1197,28 @@ const char* SvxBorderTabPage::GetPresetStringId( sal_uInt16 nValueSetIdx ) const void SvxBorderTabPage::FillPresetVS() { // basic initialization of the ValueSet - m_pWndPresets->SetStyle( m_pWndPresets->GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER ); - m_pWndPresets->SetColCount( SVX_BORDER_PRESET_COUNT ); + m_xWndPresets->SetStyle( m_xWndPresets->GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER ); + m_xWndPresets->SetColCount( SVX_BORDER_PRESET_COUNT ); // insert images and help texts for( sal_uInt16 nVSIdx = 1; nVSIdx <= SVX_BORDER_PRESET_COUNT; ++nVSIdx ) { - m_pWndPresets->InsertItem( nVSIdx ); - m_pWndPresets->SetItemImage(nVSIdx, Image(m_aBorderImgVec[GetPresetImageId(nVSIdx) - 1])); - m_pWndPresets->SetItemText( nVSIdx, CuiResId( GetPresetStringId( nVSIdx ) ) ); + m_xWndPresets->InsertItem( nVSIdx ); + m_xWndPresets->SetItemImage(nVSIdx, Image(m_aBorderImgVec[GetPresetImageId(nVSIdx) - 1])); + m_xWndPresets->SetItemText( nVSIdx, CuiResId( GetPresetStringId( nVSIdx ) ) ); } // show the control - m_pWndPresets->SetNoSelection(); - m_pWndPresets->Show(); + m_xWndPresets->SetNoSelection(); + m_xWndPresets->SetOptimalSize(); + m_xWndPresets->Show(); } void SvxBorderTabPage::FillShadowVS() { // basic initialization of the ValueSet - m_pWndShadows->SetStyle( m_pWndShadows->GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER ); - m_pWndShadows->SetColCount( SVX_BORDER_SHADOW_COUNT ); + m_xWndShadows->SetStyle( m_xWndShadows->GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER ); + m_xWndShadows->SetColCount( SVX_BORDER_SHADOW_COUNT ); // string resource IDs for each image static const char* pnStrIds[ SVX_BORDER_SHADOW_COUNT ] = @@ -1094,14 +1227,15 @@ void SvxBorderTabPage::FillShadowVS() // insert images and help texts for( sal_uInt16 nVSIdx = 1; nVSIdx <= SVX_BORDER_SHADOW_COUNT; ++nVSIdx ) { - m_pWndShadows->InsertItem( nVSIdx ); - m_pWndShadows->SetItemImage(nVSIdx, Image(m_aShadowImgVec[nVSIdx-1])); - m_pWndShadows->SetItemText( nVSIdx, CuiResId( pnStrIds[ nVSIdx - 1 ] ) ); + m_xWndShadows->InsertItem( nVSIdx ); + m_xWndShadows->SetItemImage(nVSIdx, Image(m_aShadowImgVec[nVSIdx-1])); + m_xWndShadows->SetItemText( nVSIdx, CuiResId( pnStrIds[ nVSIdx - 1 ] ) ); } // show the control - m_pWndShadows->SelectItem( 1 ); - m_pWndShadows->Show(); + m_xWndShadows->SelectItem( 1 ); + m_xWndShadows->SetOptimalSize(); + m_xWndShadows->Show(); } @@ -1153,72 +1287,65 @@ void SvxBorderTabPage::FillLineListBox_Impl() { SvxBorderLineStyle::INSET, 10, &SvxBorderLine::darkColor, &SvxBorderLine::lightColor, &sameDistColor } }; - m_pLbLineStyle->SetSourceUnit( FUNIT_TWIP ); - - m_pLbLineStyle->SetNone( SvxResId( RID_SVXSTR_NONE ) ); + m_xLbLineStyle->SetSourceUnit( FUNIT_TWIP ); for (size_t i = 0; i < SAL_N_ELEMENTS(aLines); ++i) { if (!IsBorderLineStyleAllowed(aLines[i].mnStyle)) continue; - m_pLbLineStyle->InsertEntry( + m_xLbLineStyle->InsertEntry( SvxBorderLine::getWidthImpl(aLines[i].mnStyle), aLines[i].mnStyle, aLines[i].mnMinWidth, aLines[i].mpColor1Fn, aLines[i].mpColor2Fn, aLines[i].mpColorDistFn); } - sal_Int64 nVal = static_cast<sal_Int64>(MetricField::ConvertDoubleValue( - m_pLineWidthMF->GetValue( ), - m_pLineWidthMF->GetDecimalDigits( ), - m_pLineWidthMF->GetUnit(), MapUnit::MapTwip )); - m_pLbLineStyle->SetWidth( nVal ); + sal_Int64 nVal = m_xLineWidthMF->get_value(FUNIT_NONE); + nVal = static_cast<sal_Int64>(MetricField::ConvertDoubleValue(nVal, m_xLineWidthMF->get_digits(), + m_xLineWidthMF->get_unit(), MapUnit::MapTwip)); + m_xLbLineStyle->SetWidth( nVal ); } IMPL_LINK_NOARG(SvxBorderTabPage, LinesChanged_Impl, LinkParamNone*, void) { - if(!mbUseMarginItem && m_pLeftMF->IsVisible()) + if (!mbUseMarginItem && m_xLeftMF->get_visible()) { - bool bLineSet = m_pFrameSel->IsAnyBorderVisible(); + bool bLineSet = m_aFrameSel.IsAnyBorderVisible(); bool bMinAllowed = bool(nSWMode & (SwBorderModes::FRAME|SwBorderModes::TABLE)); - bool bSpaceModified = m_pLeftMF->IsModified()|| - m_pRightMF->IsModified()|| - m_pTopMF->IsModified()|| - m_pBottomMF->IsModified(); + bool bSpaceModified = m_xLeftMF->get_value_changed_from_saved() || + m_xRightMF->get_value_changed_from_saved() || + m_xTopMF->get_value_changed_from_saved() || + m_xBottomMF->get_value_changed_from_saved(); if(bLineSet) { if(!bMinAllowed) { - m_pLeftMF->SetFirst(nMinValue); - m_pRightMF->SetFirst(nMinValue); - m_pTopMF->SetFirst(nMinValue); - m_pBottomMF->SetFirst(nMinValue); + m_xLeftMF->set_min(nMinValue, FUNIT_NONE); + m_xRightMF->set_min(nMinValue, FUNIT_NONE); + m_xTopMF->set_min(nMinValue, FUNIT_NONE); + m_xBottomMF->set_min(nMinValue, FUNIT_NONE); } if(!bSpaceModified) { - m_pLeftMF->SetValue(nMinValue); - m_pRightMF->SetValue(nMinValue); - m_pTopMF->SetValue(nMinValue); - m_pBottomMF->SetValue(nMinValue); + m_xLeftMF->set_value(nMinValue, FUNIT_NONE); + m_xRightMF->set_value(nMinValue, FUNIT_NONE); + m_xTopMF->set_value(nMinValue, FUNIT_NONE); + m_xBottomMF->set_value(nMinValue, FUNIT_NONE); } } else { - m_pLeftMF->SetMin(0); - m_pRightMF->SetMin(0); - m_pTopMF->SetMin(0); - m_pBottomMF->SetMin(0); - m_pLeftMF->SetFirst(0); - m_pRightMF->SetFirst(0); - m_pTopMF->SetFirst(0); - m_pBottomMF->SetFirst(0); + m_xLeftMF->set_min(0, FUNIT_NONE); + m_xRightMF->set_min(0, FUNIT_NONE); + m_xTopMF->set_min(0, FUNIT_NONE); + m_xBottomMF->set_min(0, FUNIT_NONE); if(!bSpaceModified && !mbAllowPaddingWithoutBorders) { - m_pLeftMF->SetValue(0); - m_pRightMF->SetValue(0); - m_pTopMF->SetValue(0); - m_pBottomMF->SetValue(0); + m_xLeftMF->set_value(0, FUNIT_NONE); + m_xRightMF->set_value(0, FUNIT_NONE); + m_xTopMF->set_value(0, FUNIT_NONE); + m_xBottomMF->set_value(0, FUNIT_NONE); } } // for tables everything is allowed @@ -1229,53 +1356,53 @@ IMPL_LINK_NOARG(SvxBorderTabPage, LinesChanged_Impl, LinkParamNone*, void) { if(bLineSet) { - nValid = (m_pFrameSel->GetFrameBorderState( svx::FrameBorderType::Top) == svx::FrameBorderState::Show) ? SvxBoxInfoItemValidFlags::TOP : SvxBoxInfoItemValidFlags::NONE; - nValid |= (m_pFrameSel->GetFrameBorderState( svx::FrameBorderType::Bottom) == svx::FrameBorderState::Show) ? SvxBoxInfoItemValidFlags::BOTTOM : SvxBoxInfoItemValidFlags::NONE; - nValid |= (m_pFrameSel->GetFrameBorderState( svx::FrameBorderType::Left) == svx::FrameBorderState::Show) ? SvxBoxInfoItemValidFlags::LEFT : SvxBoxInfoItemValidFlags::NONE; - nValid |= (m_pFrameSel->GetFrameBorderState( svx::FrameBorderType::Right ) == svx::FrameBorderState::Show) ? SvxBoxInfoItemValidFlags::RIGHT : SvxBoxInfoItemValidFlags::NONE; + nValid = (m_aFrameSel.GetFrameBorderState( svx::FrameBorderType::Top) == svx::FrameBorderState::Show) ? SvxBoxInfoItemValidFlags::TOP : SvxBoxInfoItemValidFlags::NONE; + nValid |= (m_aFrameSel.GetFrameBorderState( svx::FrameBorderType::Bottom) == svx::FrameBorderState::Show) ? SvxBoxInfoItemValidFlags::BOTTOM : SvxBoxInfoItemValidFlags::NONE; + nValid |= (m_aFrameSel.GetFrameBorderState( svx::FrameBorderType::Left) == svx::FrameBorderState::Show) ? SvxBoxInfoItemValidFlags::LEFT : SvxBoxInfoItemValidFlags::NONE; + nValid |= (m_aFrameSel.GetFrameBorderState( svx::FrameBorderType::Right ) == svx::FrameBorderState::Show) ? SvxBoxInfoItemValidFlags::RIGHT : SvxBoxInfoItemValidFlags::NONE; } else nValid = SvxBoxInfoItemValidFlags::NONE; } - m_pLeftFT->Enable( bool(nValid & SvxBoxInfoItemValidFlags::LEFT) ); - m_pRightFT->Enable( bool(nValid & SvxBoxInfoItemValidFlags::RIGHT) ); - m_pTopFT->Enable( bool(nValid & SvxBoxInfoItemValidFlags::TOP) ); - m_pBottomFT->Enable( bool(nValid & SvxBoxInfoItemValidFlags::BOTTOM) ); - m_pLeftMF->Enable( bool(nValid & SvxBoxInfoItemValidFlags::LEFT) ); - m_pRightMF->Enable( bool(nValid & SvxBoxInfoItemValidFlags::RIGHT) ); - m_pTopMF->Enable( bool(nValid & SvxBoxInfoItemValidFlags::TOP) ); - m_pBottomMF->Enable( bool(nValid & SvxBoxInfoItemValidFlags::BOTTOM) ); - m_pSynchronizeCB->Enable( m_pRightMF->IsEnabled() || m_pTopMF->IsEnabled() || - m_pBottomMF->IsEnabled() || m_pLeftMF->IsEnabled() ); + m_xLeftFT->set_sensitive( bool(nValid & SvxBoxInfoItemValidFlags::LEFT) ); + m_xRightFT->set_sensitive( bool(nValid & SvxBoxInfoItemValidFlags::RIGHT) ); + m_xTopFT->set_sensitive( bool(nValid & SvxBoxInfoItemValidFlags::TOP) ); + m_xBottomFT->set_sensitive( bool(nValid & SvxBoxInfoItemValidFlags::BOTTOM) ); + m_xLeftMF->set_sensitive( bool(nValid & SvxBoxInfoItemValidFlags::LEFT) ); + m_xRightMF->set_sensitive( bool(nValid & SvxBoxInfoItemValidFlags::RIGHT) ); + m_xTopMF->set_sensitive( bool(nValid & SvxBoxInfoItemValidFlags::TOP) ); + m_xBottomMF->set_sensitive( bool(nValid & SvxBoxInfoItemValidFlags::BOTTOM) ); + m_xSynchronizeCB->set_sensitive(m_xRightMF->get_sensitive() || m_xTopMF->get_sensitive() || + m_xBottomMF->get_sensitive() || m_xLeftMF->get_sensitive()); } UpdateRemoveAdjCellBorderCB( SAL_MAX_UINT16 ); } -IMPL_LINK( SvxBorderTabPage, ModifyDistanceHdl_Impl, Edit&, rField, void) +IMPL_LINK( SvxBorderTabPage, ModifyDistanceHdl_Impl, weld::MetricSpinButton&, rField, void) { - if ( mbSync ) + if (mbSync) { - sal_Int64 nVal = static_cast<MetricField&>(rField).GetValue(); - if(&rField != m_pLeftMF) - m_pLeftMF->SetValue(nVal); - if(&rField != m_pRightMF) - m_pRightMF->SetValue(nVal); - if(&rField != m_pTopMF) - m_pTopMF->SetValue(nVal); - if(&rField != m_pBottomMF) - m_pBottomMF->SetValue(nVal); + const auto nVal = rField.get_value(FUNIT_NONE); + if (&rField != m_xLeftMF.get()) + m_xLeftMF->set_value(nVal, FUNIT_NONE); + if (&rField != m_xRightMF.get()) + m_xRightMF->set_value(nVal, FUNIT_NONE); + if (&rField != m_xTopMF.get()) + m_xTopMF->set_value(nVal, FUNIT_NONE); + if (&rField != m_xBottomMF.get()) + m_xBottomMF->set_value(nVal, FUNIT_NONE); } } -IMPL_LINK( SvxBorderTabPage, SyncHdl_Impl, Button*, pBox, void) +IMPL_LINK( SvxBorderTabPage, SyncHdl_Impl, weld::ToggleButton&, rBox, void) { - mbSync = static_cast<CheckBox*>(pBox)->IsChecked(); + mbSync = rBox.get_active(); } -IMPL_LINK( SvxBorderTabPage, RemoveAdjacentCellBorderHdl_Impl, Button*, pBox, void) +IMPL_LINK( SvxBorderTabPage, RemoveAdjacentCellBorderHdl_Impl, weld::ToggleButton&, rBox, void) { - mbRemoveAdjacentCellBorders = static_cast<CheckBox*>(pBox)->IsChecked(); + mbRemoveAdjacentCellBorders = rBox.get_active(); } void SvxBorderTabPage::UpdateRemoveAdjCellBorderCB( sal_uInt16 nPreset ) @@ -1306,7 +1433,7 @@ void SvxBorderTabPage::UpdateRemoveAdjCellBorderCB( sal_uInt16 nPreset ) { if( pOldBoxItem->GetLine( eTypes2[i] ) || !( pOldBoxInfoItem->IsValid( eTypes1[i].second ) ) ) { - if( m_pFrameSel->GetFrameBorderState( eTypes1[i].first ) == svx::FrameBorderState::Hide ) + if( m_aFrameSel.GetFrameBorderState( eTypes1[i].first ) == svx::FrameBorderState::Hide ) { bBorderDeletionReq = true; break; @@ -1317,12 +1444,12 @@ void SvxBorderTabPage::UpdateRemoveAdjCellBorderCB( sal_uInt16 nPreset ) if( !bBorderDeletionReq && ( nPreset == IID_PRE_CELL_NONE || nPreset == IID_PRE_TABLE_NONE ) ) bBorderDeletionReq = true; - m_pRemoveAdjcentCellBordersCB->Enable( bBorderDeletionReq ); + m_xRemoveAdjcentCellBordersCB->set_sensitive(bBorderDeletionReq); if( !bBorderDeletionReq ) { mbRemoveAdjacentCellBorders = false; - m_pRemoveAdjcentCellBordersCB->Check( false ); + m_xRemoveAdjcentCellBordersCB->set_active(false); } } @@ -1342,17 +1469,17 @@ void SvxBorderTabPage::PageCreated(const SfxAllItemSet& aSet) { nSWMode = static_cast<SwBorderModes>(pSWModeItem->GetValue()); // #i43593# - // show checkbox <m_pMergeWithNextCB> for format.paragraph + // show checkbox <m_xMergeWithNextCB> for format.paragraph if ( nSWMode == SwBorderModes::PARA ) { - m_pMergeWithNextCB->Show(); - m_pPropertiesFrame->Show(); + m_xMergeWithNextCB->show(); + m_xPropertiesFrame->show(); } - // show checkbox <m_pMergeAdjacentBordersCB> for format.paragraph + // show checkbox <m_xMergeAdjacentBordersCB> for format.paragraph else if ( nSWMode == SwBorderModes::TABLE ) { - m_pMergeAdjacentBordersCB->Show(); - m_pPropertiesFrame->Show(); + m_xMergeAdjacentBordersCB->show(); + m_xPropertiesFrame->show(); } } if (pFlagItem) diff --git a/cui/source/tabpages/borderconn.cxx b/cui/source/tabpages/borderconn.cxx deleted file mode 100644 index 78d2c3ba637e..000000000000 --- a/cui/source/tabpages/borderconn.cxx +++ /dev/null @@ -1,291 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "borderconn.hxx" -#include <svx/frmsel.hxx> -#include <svx/svxids.hrc> -#include <editeng/lineitem.hxx> -#include <editeng/boxitem.hxx> -#include <svx/algitem.hxx> -#include <svx/colorbox.hxx> -#include <editeng/shaditem.hxx> - -namespace svx { - -/* ============================================================================ -SvxLineItem connection ----------------------- -Connects an SvxLineItem (that contains the style of one line of a cell border) -with one frame border from a svx::FrameSelector control. If this connection is -used, no additional code is needed in the Reset() and FillItemSet() functions -of the tab page. -============================================================================ */ - -// 1st: item wrappers --------------------------------------------------------- - -class LineItemWrapper : public sfx::SingleItemWrapper< SvxLineItem, const editeng::SvxBorderLine* > -{ -public: - explicit LineItemWrapper( sal_uInt16 nSlot ) : SingleItemWrapperType( nSlot ) {} - - virtual const editeng::SvxBorderLine* GetItemValue( const SvxLineItem& rItem ) const override - { return rItem.GetLine(); } - virtual void SetItemValue( SvxLineItem& rItem, const editeng::SvxBorderLine* pLine ) const override - { rItem.SetLine( pLine ); } -}; - -// 2nd: control wrappers ------------------------------------------------------ - -class FrameSelectorWrapper : public sfx::SingleControlWrapper< FrameSelector, const editeng::SvxBorderLine* > -{ -public: - explicit FrameSelectorWrapper( FrameSelector& rFrameSel, FrameBorderType eBorder ) : - SingleControlWrapperType( rFrameSel ), meBorder( eBorder ) {} - - virtual bool IsControlDontKnow() const override; - virtual void SetControlDontKnow( bool bSet ) override; - - virtual const editeng::SvxBorderLine* GetControlValue() const override; - virtual void SetControlValue( const editeng::SvxBorderLine* pLine ) override; - -private: - FrameBorderType meBorder; /// The line this wrapper works with. -}; - -bool FrameSelectorWrapper::IsControlDontKnow() const -{ - return GetControl().GetFrameBorderState( meBorder ) == FrameBorderState::DontCare; -} - -void FrameSelectorWrapper::SetControlDontKnow( bool bSet ) -{ - if( bSet ) - GetControl().SetBorderDontCare( meBorder ); -} - -const editeng::SvxBorderLine* FrameSelectorWrapper::GetControlValue() const -{ - return GetControl().GetFrameBorderStyle( meBorder ); -} - -void FrameSelectorWrapper::SetControlValue( const editeng::SvxBorderLine* pLine ) -{ - GetControl().ShowBorder( meBorder, pLine ); -} - -// 3rd: connection ------------------------------------------------------------ - -/* ============================================================================ -SvxMarginItem connection ------------------------- -Connects an SvxMarginItem (that contains the inner margin of all cell borders) -with the numerical edit controls of the SvxBorderTabPage. If this connection is -used, no additional code is needed in the Reset() and FillItemSet() functions -of the tab page. -============================================================================ */ - -// 1st: item wrappers --------------------------------------------------------- - -typedef sfx::IdentItemWrapper< SvxMarginItem > MarginItemWrapper; - -// 2nd: control wrappers ------------------------------------------------------ - -class MarginControlsWrapper : public sfx::MultiControlWrapper< SvxMarginItem > -{ -public: - explicit MarginControlsWrapper( - MetricField& rMfLeft, MetricField& rMfRight, - MetricField& rMfTop, MetricField& rMfBottom ); - - virtual SvxMarginItem GetControlValue() const override; - virtual void SetControlValue( SvxMarginItem aItem ) override; - -private: - sfx::MetricFieldWrapper<sal_Int16> maLeftWrp; - sfx::MetricFieldWrapper<sal_Int16> maRightWrp; - sfx::MetricFieldWrapper<sal_Int16> maTopWrp; - sfx::MetricFieldWrapper<sal_Int16> maBottomWrp; -}; - -MarginControlsWrapper::MarginControlsWrapper( - MetricField& rMfLeft, MetricField& rMfRight, MetricField& rMfTop, MetricField& rMfBottom ) : - maLeftWrp( rMfLeft, FUNIT_TWIP ), - maRightWrp( rMfRight, FUNIT_TWIP ), - maTopWrp( rMfTop, FUNIT_TWIP ), - maBottomWrp( rMfBottom, FUNIT_TWIP ) -{ - RegisterControlWrapper( maLeftWrp ); - RegisterControlWrapper( maRightWrp ); - RegisterControlWrapper( maTopWrp ); - RegisterControlWrapper( maBottomWrp ); -} - -SvxMarginItem MarginControlsWrapper::GetControlValue() const -{ - SvxMarginItem aItem( GetDefaultValue() ); - if( !maLeftWrp.IsControlDontKnow() ) - aItem.SetLeftMargin( maLeftWrp.GetControlValue() ); - if( !maRightWrp.IsControlDontKnow() ) - aItem.SetRightMargin( maRightWrp.GetControlValue() ); - if( !maTopWrp.IsControlDontKnow() ) - aItem.SetTopMargin( maTopWrp.GetControlValue() ); - if( !maBottomWrp.IsControlDontKnow() ) - aItem.SetBottomMargin( maBottomWrp.GetControlValue() ); - return aItem; -} - -void MarginControlsWrapper::SetControlValue( SvxMarginItem aItem ) -{ - maLeftWrp.SetControlValue( aItem.GetLeftMargin() ); - maRightWrp.SetControlValue( aItem.GetRightMargin() ); - maTopWrp.SetControlValue( aItem.GetTopMargin() ); - maBottomWrp.SetControlValue( aItem.GetBottomMargin() ); -} - -// 3rd: connection ------------------------------------------------------------ - -class MarginConnection : public sfx::ItemControlConnection< MarginItemWrapper, MarginControlsWrapper > -{ -public: - explicit MarginConnection( const SfxItemSet& rItemSet, - MetricField& rMfLeft, MetricField& rMfRight, - MetricField& rMfTop, MetricField& rMfBottom ); -}; - -MarginConnection::MarginConnection( const SfxItemSet& rItemSet, - MetricField& rMfLeft, MetricField& rMfRight, MetricField& rMfTop, MetricField& rMfBottom ) : - ItemControlConnectionType( SID_ATTR_ALIGN_MARGIN, new MarginControlsWrapper( rMfLeft, rMfRight, rMfTop, rMfBottom ), ItemConnFlags::NONE ) -{ - mxCtrlWrp->SetDefaultValue( maItemWrp.GetDefaultItem( rItemSet ) ); -} - -/* ============================================================================ -SvxShadowItem connection ------------------------- -Connects an SvxShadowItem (that contains shadow position, size, and color) with -the controls of the SvxBorderTabPage. If this connection is used, no additional -code is needed in the Reset() and FillItemSet() functions of the tab page. -============================================================================ */ - -// 1st: item wrappers --------------------------------------------------------- - -typedef sfx::IdentItemWrapper< SvxShadowItem > ShadowItemWrapper; - -// 2nd: control wrappers ------------------------------------------------------ - -typedef sfx::ValueSetWrapper< SvxShadowLocation > ShadowPosWrapper; -static const ShadowPosWrapper::MapEntryType s_pShadowPosMap[] = -{ - { 1, SvxShadowLocation::NONE }, - { 2, SvxShadowLocation::BottomRight }, - { 3, SvxShadowLocation::TopRight }, - { 4, SvxShadowLocation::BottomLeft }, - { 5, SvxShadowLocation::TopLeft }, - { WRAPPER_VALUESET_ITEM_NOTFOUND, SvxShadowLocation::NONE } -}; - -class ShadowControlsWrapper : public sfx::MultiControlWrapper< SvxShadowItem > -{ -public: - explicit ShadowControlsWrapper( ValueSet& rVsPos, MetricField& rMfSize, SvxColorListBox& rLbColor ); - - virtual SvxShadowItem GetControlValue() const override; - virtual void SetControlValue( SvxShadowItem aItem ) override; - -private: - ShadowPosWrapper maPosWrp; - sfx::MetricFieldWrapper<sal_uInt16> maSizeWrp; - SvxColorListBoxWrapper maColorWrp; -}; - -ShadowControlsWrapper::ShadowControlsWrapper( - ValueSet& rVsPos, MetricField& rMfSize, SvxColorListBox& rLbColor ) : - maPosWrp( rVsPos, s_pShadowPosMap ), - maSizeWrp( rMfSize, FUNIT_TWIP ), - maColorWrp( rLbColor ) -{ - RegisterControlWrapper( maPosWrp ); - RegisterControlWrapper( maSizeWrp ); - RegisterControlWrapper( maColorWrp ); -} - -SvxShadowItem ShadowControlsWrapper::GetControlValue() const -{ - SvxShadowItem aItem( GetDefaultValue() ); - if( !maPosWrp.IsControlDontKnow() ) - aItem.SetLocation( maPosWrp.GetControlValue() ); - // Default value was saved; so don't change the aItem's width if the control - // has not changed its value, to avoid round-trip errors (like twip->cm->twip) - // E.g., initial 100 twip will become 0.18 cm, which will return as 102 twip - if( !maSizeWrp.IsControlDontKnow() && maSizeWrp.IsControlValueChanged() ) - aItem.SetWidth( maSizeWrp.GetControlValue() ); - if( !maColorWrp.IsControlDontKnow() ) - aItem.SetColor( maColorWrp.GetControlValue() ); - return aItem; -} - -void ShadowControlsWrapper::SetControlValue( SvxShadowItem aItem ) -{ - SetDefaultValue(aItem); - maPosWrp.SetControlValue( aItem.GetLocation() ); - maSizeWrp.SetControlValue( aItem.GetWidth() ); - maSizeWrp.GetControl().SaveValue(); - maColorWrp.SetControlValue( aItem.GetColor() ); -} - -// 3rd: connection ------------------------------------------------------------ - -class ShadowConnection : public sfx::ItemControlConnection< ShadowItemWrapper, ShadowControlsWrapper > -{ -public: - explicit ShadowConnection( sal_uInt16 nSlot, const SfxItemSet& rItemSet, - ValueSet& rVsPos, MetricField& rMfSize, SvxColorListBox& rLbColor ); -}; - -ShadowConnection::ShadowConnection( sal_uInt16 nSlot, const SfxItemSet& rItemSet, - ValueSet& rVsPos, MetricField& rMfSize, SvxColorListBox& rLbColor ) : - ItemControlConnectionType( nSlot, new ShadowControlsWrapper( rVsPos, rMfSize, rLbColor ), ItemConnFlags::NONE ) -{ - mxCtrlWrp->SetDefaultValue( maItemWrp.GetDefaultItem( rItemSet ) ); -} - - -sfx::ItemConnectionBase* CreateFrameLineConnection( sal_uInt16 nSlot, - FrameSelector& rFrameSel, FrameBorderType eBorder ) -{ - return new sfx::ItemControlConnection< LineItemWrapper, FrameSelectorWrapper >( nSlot, new FrameSelectorWrapper( rFrameSel, eBorder ), ItemConnFlags::NONE ); -} - -sfx::ItemConnectionBase* CreateMarginConnection( const SfxItemSet& rItemSet, - MetricField& rMfLeft, MetricField& rMfRight, - MetricField& rMfTop, MetricField& rMfBottom ) -{ - return new MarginConnection( rItemSet, rMfLeft, rMfRight, rMfTop, rMfBottom ); -} - -sfx::ItemConnectionBase* CreateShadowConnection( sal_uInt16 nSlot, const SfxItemSet& rItemSet, - ValueSet& rVsPos, MetricField& rMfSize, SvxColorListBox& rLbColor ) -{ - return new ShadowConnection( nSlot, rItemSet, rVsPos, rMfSize, rLbColor ); -} - - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/borderconn.hxx b/cui/source/tabpages/borderconn.hxx deleted file mode 100644 index 01b404667f49..000000000000 --- a/cui/source/tabpages/borderconn.hxx +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_CUI_SOURCE_TABPAGES_BORDERCONN_HXX -#define INCLUDED_CUI_SOURCE_TABPAGES_BORDERCONN_HXX - -#include <sfx2/itemconnect.hxx> -#include <svx/framebordertype.hxx> - -class SfxItemSet; -class MetricField; -class ValueSet; -class SvxColorListBox; - -namespace svx { - -class FrameSelector; - - -/** Creates an item connection object that connects an SvxLineItem with an - svx::FrameSelector control. */ -sfx::ItemConnectionBase* CreateFrameLineConnection( sal_uInt16 nSlot, - FrameSelector& rFrameSel, FrameBorderType eBorder ); - -/** Creates an item connection object that connects an SvxMarginItem with the - controls of the SvxBorderTabPage. */ -sfx::ItemConnectionBase* CreateMarginConnection( const SfxItemSet& rItemSet, - MetricField& rMfLeft, MetricField& rMfRight, - MetricField& rMfTop, MetricField& rMfBottom ); - -/** Creates an item connection object that connects an SvxShadowItem with the - controls of the SvxBorderTabPage. */ -sfx::ItemConnectionBase* CreateShadowConnection( sal_uInt16 nSlot, const SfxItemSet& rItemSet, - ValueSet& rVsPos, MetricField& rMfSize, SvxColorListBox& rLbColor ); - - -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx index edd5f5981c6e..7e8682d255ac 100644 --- a/cui/source/tabpages/tpbitmap.cxx +++ b/cui/source/tabpages/tpbitmap.cxx @@ -113,7 +113,6 @@ SvxBitmapTabPage::SvxBitmapTabPage(TabPageParent pParent, const SfxItemSet& rInA Link<weld::MetricSpinButton&, void> aLink( LINK( this, SvxBitmapTabPage, ModifyPositionOffsetHdl ) ); m_xPositionOffX->connect_value_changed(aLink); m_xPositionOffY->connect_value_changed(aLink); - m_xTileOffset->set_value(0, FUNIT_PERCENT); m_xTileOffset->connect_value_changed( LINK( this, SvxBitmapTabPage, ModifyTileOffsetHdl ) ); m_xBtnImport->connect_clicked( LINK(this, SvxBitmapTabPage, ClickImportHdl) ); |