diff options
-rw-r--r-- | cui/source/inc/align.hxx | 65 | ||||
-rw-r--r-- | cui/source/tabpages/align.cxx | 636 | ||||
-rw-r--r-- | cui/uiconfig/ui/cellalignment.ui | 162 | ||||
-rw-r--r-- | include/sfx2/controlwrapper.hxx | 70 | ||||
-rw-r--r-- | include/sfx2/itemconnect.hxx | 83 | ||||
-rw-r--r-- | include/svtools/valueset.hxx | 12 | ||||
-rw-r--r-- | include/svx/dialcontrol.hxx | 26 | ||||
-rw-r--r-- | include/svx/frmdirlbox.hxx | 22 | ||||
-rw-r--r-- | include/svx/orienthelper.hxx | 19 | ||||
-rw-r--r-- | include/vcl/customweld.hxx | 1 | ||||
-rw-r--r-- | sfx2/source/dialog/itemconnect.cxx | 28 | ||||
-rw-r--r-- | svtools/source/control/valueset.cxx | 1 | ||||
-rw-r--r-- | svx/source/dialog/dialcontrol.cxx | 67 | ||||
-rw-r--r-- | svx/source/dialog/frmdirlbox.cxx | 28 | ||||
-rw-r--r-- | svx/source/dialog/orienthelper.cxx | 28 |
15 files changed, 610 insertions, 638 deletions
diff --git a/cui/source/inc/align.hxx b/cui/source/inc/align.hxx index df2094afe684..669cac0467e0 100644 --- a/cui/source/inc/align.hxx +++ b/cui/source/inc/align.hxx @@ -69,47 +69,50 @@ public: virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; private: - explicit AlignmentTabPage( vcl::Window* pParent, const SfxItemSet& rCoreSet ); + explicit AlignmentTabPage(TabPageParent pParent, const SfxItemSet& rCoreSet); void InitVsRefEgde(); void UpdateEnableControls(); bool HasAlignmentChanged( const SfxItemSet& rNew, sal_uInt16 nWhich ) const; - DECL_LINK( UpdateEnableHdl, ListBox&, void ); - DECL_LINK( UpdateEnableClickHdl, Button*, void ); + DECL_LINK(UpdateEnableHdl, weld::ComboBox&, void); + DECL_LINK(UpdateEnableClickHdl, weld::ToggleButton&, void); private: - VclPtr<ListBox> m_pLbHorAlign; - VclPtr<FixedText> m_pFtIndent; - VclPtr<MetricField> m_pEdIndent; - VclPtr<FixedText> m_pFtVerAlign; - VclPtr<ListBox> m_pLbVerAlign; - - VclPtr<DialControl> m_pCtrlDial; - VclPtr<FixedText> m_pFtRotate; - VclPtr<NumericField> m_pNfRotate; - VclPtr<FixedText> m_pFtRefEdge; - VclPtr<ValueSet> m_pVsRefEdge; - VclPtr<TriStateBox> m_pCbStacked; - VclPtr<TriStateBox> m_pCbAsianMode; - std::unique_ptr<OrientationHelper> m_pOrientHlp; - - VclPtr<VclHBox> m_pBoxDirection; - VclPtr<TriStateBox> m_pBtnWrap; - VclPtr<TriStateBox> m_pBtnHyphen; - VclPtr<TriStateBox> m_pBtnShrink; - VclPtr<FrameDirectionListBox> m_pLbFrameDir; + SvxDialControl m_aCtrlDial; + SvtValueSet m_aVsRefEdge; + + std::unique_ptr<weld::ComboBox> m_xLbHorAlign; + std::unique_ptr<weld::Label> m_xFtIndent; + std::unique_ptr<weld::MetricSpinButton> m_xEdIndent; + std::unique_ptr<weld::Label> m_xFtVerAlign; + std::unique_ptr<weld::ComboBox> m_xLbVerAlign; + + std::unique_ptr<weld::Label> m_xFtRotate; + std::unique_ptr<weld::SpinButton> m_xNfRotate; + std::unique_ptr<weld::Label> m_xFtRefEdge; + std::unique_ptr<weld::CheckButton> m_xCbStacked; + std::unique_ptr<weld::CheckButton> m_xCbAsianMode; + + std::unique_ptr<weld::Widget> m_xBoxDirection; + std::unique_ptr<weld::CheckButton> m_xBtnWrap; + std::unique_ptr<weld::CheckButton> m_xBtnHyphen; + std::unique_ptr<weld::CheckButton> m_xBtnShrink; + std::unique_ptr<SvxFrameDirectionListBox> m_xLbFrameDir; // hidden labels/string - VclPtr<FixedText> m_pFtBotLock; - VclPtr<FixedText> m_pFtTopLock; - VclPtr<FixedText> m_pFtCelLock; - VclPtr<FixedText> m_pFtABCD; - - VclPtr<VclContainer> m_pAlignmentFrame; - VclPtr<VclContainer> m_pOrientFrame; - VclPtr<VclContainer> m_pPropertiesFrame; + std::unique_ptr<weld::Label> m_xFtBotLock; + std::unique_ptr<weld::Label> m_xFtTopLock; + std::unique_ptr<weld::Label> m_xFtCelLock; + std::unique_ptr<weld::Label> m_xFtABCD; + + std::unique_ptr<weld::Widget> m_xAlignmentFrame; + std::unique_ptr<weld::Widget> m_xOrientFrame; + std::unique_ptr<weld::Widget> m_xPropertiesFrame; + + std::unique_ptr<weld::CustomWeld> m_xVsRefEdge; + std::unique_ptr<weld::CustomWeld> m_xCtrlDial; }; diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx index ed35fa53ea6b..3dd853fe0248 100644 --- a/cui/source/tabpages/align.cxx +++ b/cui/source/tabpages/align.cxx @@ -46,55 +46,6 @@ namespace svx { -// item connections =========================================================== - -// horizontal alignment ------------------------------------------------------- - -typedef sfx::ValueItemWrapper< SvxHorJustifyItem, SvxCellHorJustify > HorJustItemWrapper; -typedef sfx::ListBoxConnection< HorJustItemWrapper > HorJustConnection; - -static const HorJustConnection::MapEntryType s_pHorJustMap[] = -{ - { ALIGNDLG_HORALIGN_STD, SvxCellHorJustify::Standard }, - { ALIGNDLG_HORALIGN_LEFT, SvxCellHorJustify::Left }, - { ALIGNDLG_HORALIGN_CENTER, SvxCellHorJustify::Center }, - { ALIGNDLG_HORALIGN_RIGHT, SvxCellHorJustify::Right }, - { ALIGNDLG_HORALIGN_BLOCK, SvxCellHorJustify::Block }, - { ALIGNDLG_HORALIGN_FILL, SvxCellHorJustify::Repeat }, - { ALIGNDLG_HORALIGN_DISTRIBUTED, SvxCellHorJustify::Block }, - { WRAPPER_LISTBOX_ENTRY_NOTFOUND, SvxCellHorJustify::Standard } -}; - -// vertical alignment --------------------------------------------------------- - -typedef sfx::ValueItemWrapper< SvxVerJustifyItem, SvxCellVerJustify > VerJustItemWrapper; -typedef sfx::ListBoxConnection< VerJustItemWrapper > VerJustConnection; - -static const VerJustConnection::MapEntryType s_pVerJustMap[] = -{ - { ALIGNDLG_VERALIGN_STD, SvxCellVerJustify::Standard }, - { ALIGNDLG_VERALIGN_TOP, SvxCellVerJustify::Top }, - { ALIGNDLG_VERALIGN_MID, SvxCellVerJustify::Center }, - { ALIGNDLG_VERALIGN_BOTTOM, SvxCellVerJustify::Bottom }, - { ALIGNDLG_VERALIGN_BLOCK, SvxCellVerJustify::Block }, - { ALIGNDLG_VERALIGN_DISTRIBUTED, SvxCellVerJustify::Block }, - { WRAPPER_LISTBOX_ENTRY_NOTFOUND, SvxCellVerJustify::Standard } -}; - -// cell rotate mode ----------------------------------------------------------- - -typedef sfx::ValueItemWrapper< SvxRotateModeItem, SvxRotateMode > RotateModeItemWrapper; -typedef sfx::ValueSetConnection< RotateModeItemWrapper > RotateModeConnection; - -static const RotateModeConnection::MapEntryType s_pRotateModeMap[] = -{ - { IID_BOTTOMLOCK, SVX_ROTATE_MODE_BOTTOM }, - { IID_TOPLOCK, SVX_ROTATE_MODE_TOP }, - { IID_CELLLOCK, SVX_ROTATE_MODE_STANDARD }, - { WRAPPER_VALUESET_ITEM_NOTFOUND, SVX_ROTATE_MODE_STANDARD } -}; - - const sal_uInt16 AlignmentTabPage::s_pRanges[] = { SID_ATTR_ALIGN_HOR_JUSTIFY,SID_ATTR_ALIGN_VER_JUSTIFY, @@ -114,7 +65,7 @@ namespace { template<typename JustContainerType, typename JustEnumType> void lcl_MaybeResetAlignToDistro( - ListBox& rLB, sal_uInt16 nListPos, const SfxItemSet& rCoreAttrs, sal_uInt16 nWhichAlign, sal_uInt16 nWhichJM, JustEnumType eBlock) + weld::ComboBox& rLB, sal_uInt16 nListPos, const SfxItemSet& rCoreAttrs, sal_uInt16 nWhichAlign, sal_uInt16 nWhichJM, JustEnumType eBlock) { const SfxPoolItem* pItem; if (rCoreAttrs.GetItemState(nWhichAlign, true, &pItem) != SfxItemState::SET) @@ -134,14 +85,16 @@ void lcl_MaybeResetAlignToDistro( p = static_cast<const SfxEnumItemInterface*>(pItem); SvxCellJustifyMethod eMethod = static_cast<SvxCellJustifyMethod>(p->GetEnumValue()); if (eMethod == SvxCellJustifyMethod::Distribute) + { // Select the 'distribute' entry in the specified list box. - rLB.SelectEntryPos(nListPos); + rLB.set_active(nListPos); + } } -void lcl_SetJustifyMethodToItemSet(SfxItemSet& rSet, sal_uInt16 nWhichJM, const ListBox& rLB, sal_uInt16 nListPos) +void lcl_SetJustifyMethodToItemSet(SfxItemSet& rSet, sal_uInt16 nWhichJM, const weld::ComboBox& rLB, sal_uInt16 nListPos) { SvxCellJustifyMethod eJM = SvxCellJustifyMethod::Auto; - if (rLB.GetSelectedEntryPos() == nListPos) + if (rLB.get_active() == nListPos) eJM = SvxCellJustifyMethod::Distribute; SvxJustifyMethodItem aItem(eJM, nWhichJM); @@ -150,93 +103,57 @@ void lcl_SetJustifyMethodToItemSet(SfxItemSet& rSet, sal_uInt16 nWhichJM, const }//namespace - -AlignmentTabPage::AlignmentTabPage( vcl::Window* pParent, const SfxItemSet& rCoreAttrs ) : - - SfxTabPage( pParent, "CellAlignPage","cui/ui/cellalignment.ui", &rCoreAttrs ) - -{ +AlignmentTabPage::AlignmentTabPage(TabPageParent pParent, const SfxItemSet& rCoreAttrs) + : SfxTabPage(pParent, "cui/ui/cellalignment.ui", "CellAlignPage", &rCoreAttrs) + , m_aVsRefEdge(nullptr) // text alignment - get(m_pLbHorAlign,"comboboxHorzAlign"); - get(m_pFtIndent,"labelIndent"); - get(m_pEdIndent,"spinIndentFrom"); - get(m_pFtVerAlign,"labelVertAlign"); - get(m_pLbVerAlign,"comboboxVertAlign"); - + , m_xLbHorAlign(m_xBuilder->weld_combo_box("comboboxHorzAlign")) + , m_xFtIndent(m_xBuilder->weld_label("labelIndent")) + , m_xEdIndent(m_xBuilder->weld_metric_spin_button("spinIndentFrom", FUNIT_POINT)) + , m_xFtVerAlign(m_xBuilder->weld_label("labelVertAlign")) + , m_xLbVerAlign(m_xBuilder->weld_combo_box("comboboxVertAlign")) //text rotation - get(m_pNfRotate,"spinDegrees"); - get(m_pCtrlDial,"dialcontrol"); - get(m_pFtRotate,"labelDegrees"); - get(m_pFtRefEdge,"labelRefEdge"); - get(m_pVsRefEdge,"references"); - get(m_pBoxDirection,"boxDirection"); - + , m_xFtRotate(m_xBuilder->weld_label("labelDegrees")) + , m_xNfRotate(m_xBuilder->weld_spin_button("spinDegrees")) + , m_xFtRefEdge(m_xBuilder->weld_label("labelRefEdge")) //Asian mode - get(m_pCbStacked,"checkVertStack"); - get(m_pCbAsianMode,"checkAsianMode"); - - m_pOrientHlp.reset( new OrientationHelper(*m_pCtrlDial, *m_pNfRotate, *m_pCbStacked) ); - + , m_xCbStacked(m_xBuilder->weld_check_button("checkVertStack")) + , m_xCbAsianMode(m_xBuilder->weld_check_button("checkAsianMode")) // Properties - get(m_pBtnWrap,"checkWrapTextAuto"); - get(m_pBtnHyphen,"checkHyphActive"); - get(m_pBtnShrink,"checkShrinkFitCellSize"); - get(m_pLbFrameDir,"comboTextDirBox"); - + , m_xBoxDirection(m_xBuilder->weld_widget("boxDirection")) + , m_xBtnWrap(m_xBuilder->weld_check_button("checkWrapTextAuto")) + , m_xBtnHyphen(m_xBuilder->weld_check_button("checkHyphActive")) + , m_xBtnShrink(m_xBuilder->weld_check_button("checkShrinkFitCellSize")) + , m_xLbFrameDir(new SvxFrameDirectionListBox(m_xBuilder->weld_combo_box("comboTextDirBox"))) //ValueSet hover strings - get(m_pFtBotLock,"labelSTR_BOTTOMLOCK"); - get(m_pFtTopLock,"labelSTR_TOPLOCK"); - get(m_pFtCelLock,"labelSTR_CELLLOCK"); - get(m_pFtABCD,"labelABCD"); - - get(m_pAlignmentFrame, "alignment"); - get(m_pOrientFrame, "orientation"); - get(m_pPropertiesFrame, "properties"); - - m_pCtrlDial->SetText(m_pFtABCD->GetText()); + , m_xFtBotLock(m_xBuilder->weld_label("labelSTR_BOTTOMLOCK")) + , m_xFtTopLock(m_xBuilder->weld_label("labelSTR_TOPLOCK")) + , m_xFtCelLock(m_xBuilder->weld_label("labelSTR_CELLLOCK")) + , m_xFtABCD(m_xBuilder->weld_label("labelABCD")) + , m_xAlignmentFrame(m_xBuilder->weld_widget("alignment")) + , m_xOrientFrame(m_xBuilder->weld_widget("orientation")) + , m_xPropertiesFrame(m_xBuilder->weld_widget("properties")) + , m_xVsRefEdge(new weld::CustomWeld(*m_xBuilder, "references", m_aVsRefEdge)) + , m_xCtrlDial(new weld::CustomWeld(*m_xBuilder, "dialcontrol", m_aCtrlDial)) +{ + m_aCtrlDial.SetLinkedField(m_xNfRotate.get()); + m_aCtrlDial.SetText(m_xFtABCD->get_label()); InitVsRefEgde(); - // windows to be disabled, if stacked text is turned ON - m_pOrientHlp->AddDependentWindow( *m_pFtRotate, TRISTATE_TRUE ); - m_pOrientHlp->AddDependentWindow( *m_pFtRefEdge, TRISTATE_TRUE ); - m_pOrientHlp->AddDependentWindow( *m_pVsRefEdge, TRISTATE_TRUE ); - // windows to be disabled, if stacked text is turned OFF - m_pOrientHlp->AddDependentWindow( *m_pCbAsianMode, TRISTATE_FALSE ); - - Link<ListBox&,void> aLink = LINK( this, AlignmentTabPage, UpdateEnableHdl ); - - m_pLbHorAlign->SetSelectHdl( aLink ); - m_pBtnWrap->SetClickHdl( LINK( this, AlignmentTabPage, UpdateEnableClickHdl ) ); + m_xLbHorAlign->connect_changed(LINK(this, AlignmentTabPage, UpdateEnableHdl)); + m_xBtnWrap->connect_toggled(LINK(this, AlignmentTabPage, UpdateEnableClickHdl)); + m_xCbStacked->connect_toggled(LINK(this, AlignmentTabPage, UpdateEnableClickHdl)); // Asian vertical mode - m_pCbAsianMode->Show( SvtCJKOptions().IsVerticalTextEnabled() ); + m_xCbAsianMode->show(SvtCJKOptions().IsVerticalTextEnabled()); - m_pLbFrameDir->InsertEntryValue( SvxResId( RID_SVXSTR_FRAMEDIR_LTR ), SvxFrameDirection::Horizontal_LR_TB ); - m_pLbFrameDir->InsertEntryValue( SvxResId( RID_SVXSTR_FRAMEDIR_RTL ), SvxFrameDirection::Horizontal_RL_TB ); - m_pLbFrameDir->InsertEntryValue( SvxResId( RID_SVXSTR_FRAMEDIR_SUPER ), SvxFrameDirection::Environment ); + m_xLbFrameDir->append(SvxFrameDirection::Horizontal_LR_TB, SvxResId(RID_SVXSTR_FRAMEDIR_LTR)); + m_xLbFrameDir->append(SvxFrameDirection::Horizontal_RL_TB, SvxResId(RID_SVXSTR_FRAMEDIR_RTL)); + m_xLbFrameDir->append(SvxFrameDirection::Environment, SvxResId(RID_SVXSTR_FRAMEDIR_SUPER)); // This page needs ExchangeSupport. SetExchangeSupport(); - - AddItemConnection( new HorJustConnection( SID_ATTR_ALIGN_HOR_JUSTIFY, *m_pLbHorAlign, s_pHorJustMap, ItemConnFlags::HideUnknown ) ); - AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_INDENT, *m_pFtIndent, ItemConnFlags::HideUnknown ) ); - AddItemConnection( new sfx::MetricConnection<sfx::UInt16ItemWrapper>( SID_ATTR_ALIGN_INDENT, *m_pEdIndent, FUNIT_TWIP, ItemConnFlags::HideUnknown ) ); - AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_VER_JUSTIFY, *m_pFtVerAlign, ItemConnFlags::HideUnknown ) ); - AddItemConnection( new VerJustConnection( SID_ATTR_ALIGN_VER_JUSTIFY, *m_pLbVerAlign, s_pVerJustMap, ItemConnFlags::HideUnknown ) ); - AddItemConnection( new DialControlConnection( SID_ATTR_ALIGN_DEGREES, *m_pCtrlDial, ItemConnFlags::HideUnknown ) ); - AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_DEGREES, *m_pFtRotate, ItemConnFlags::HideUnknown ) ); - AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_LOCKPOS, *m_pFtRefEdge, ItemConnFlags::HideUnknown ) ); - AddItemConnection( new RotateModeConnection( SID_ATTR_ALIGN_LOCKPOS, *m_pVsRefEdge, s_pRotateModeMap, ItemConnFlags::HideUnknown ) ); - AddItemConnection( new OrientStackedConnection( SID_ATTR_ALIGN_STACKED, *m_pOrientHlp ) ); - AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_STACKED, *m_pCbStacked, ItemConnFlags::HideUnknown ) ); - AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_ASIANVERTICAL, *m_pCbAsianMode, ItemConnFlags::HideUnknown ) ); - AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_LINEBREAK, *m_pBtnWrap, ItemConnFlags::HideUnknown ) ); - AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_HYPHENATION, *m_pBtnHyphen, ItemConnFlags::HideUnknown ) ); - AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_SHRINKTOFIT, *m_pBtnShrink, ItemConnFlags::HideUnknown ) ); - AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_FRAMEDIRECTION, *m_pBoxDirection, ItemConnFlags::HideUnknown ) ); - AddItemConnection( new FrameDirectionListBoxConnection( SID_ATTR_FRAMEDIRECTION, *m_pLbFrameDir, ItemConnFlags::HideUnknown ) ); - } AlignmentTabPage::~AlignmentTabPage() @@ -246,76 +163,414 @@ AlignmentTabPage::~AlignmentTabPage() void AlignmentTabPage::dispose() { - m_pOrientHlp.reset(); - m_pLbHorAlign.clear(); - m_pFtIndent.clear(); - m_pEdIndent.clear(); - m_pFtVerAlign.clear(); - m_pLbVerAlign.clear(); - m_pCtrlDial.clear(); - m_pFtRotate.clear(); - m_pNfRotate.clear(); - m_pFtRefEdge.clear(); - m_pVsRefEdge.clear(); - m_pCbStacked.clear(); - m_pCbAsianMode.clear(); - m_pBoxDirection.clear(); - m_pBtnWrap.clear(); - m_pBtnHyphen.clear(); - m_pBtnShrink.clear(); - m_pLbFrameDir.clear(); - m_pFtBotLock.clear(); - m_pFtTopLock.clear(); - m_pFtCelLock.clear(); - m_pFtABCD.clear(); - m_pAlignmentFrame.clear(); - m_pOrientFrame.clear(); - m_pPropertiesFrame.clear(); + m_xCtrlDial.reset(); + m_xVsRefEdge.reset(); + m_xLbFrameDir.reset(); SfxTabPage::dispose(); } -VclPtr<SfxTabPage> AlignmentTabPage::Create( TabPageParent pParent, const SfxItemSet* rAttrSet ) +VclPtr<SfxTabPage> AlignmentTabPage::Create(TabPageParent pParent, const SfxItemSet* rAttrSet) { - return VclPtr<AlignmentTabPage>::Create( pParent.pParent, *rAttrSet ); + return VclPtr<AlignmentTabPage>::Create(pParent, *rAttrSet); } bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet ) { bool bChanged = SfxTabPage::FillItemSet(rSet); + if (m_xLbHorAlign->get_value_changed_from_saved()) + { + SvxCellHorJustify eJustify(SvxCellHorJustify::Standard); + switch (m_xLbHorAlign->get_active_id().toInt32()) + { + case ALIGNDLG_HORALIGN_STD: + eJustify = SvxCellHorJustify::Standard; + break; + case ALIGNDLG_HORALIGN_LEFT: + eJustify = SvxCellHorJustify::Left; + break; + case ALIGNDLG_HORALIGN_CENTER: + eJustify = SvxCellHorJustify::Center; + break; + case ALIGNDLG_HORALIGN_RIGHT: + eJustify = SvxCellHorJustify::Right; + break; + case ALIGNDLG_HORALIGN_BLOCK: + eJustify = SvxCellHorJustify::Block; + break; + case ALIGNDLG_HORALIGN_FILL: + eJustify = SvxCellHorJustify::Repeat; + break; + } + rSet->Put(SvxHorJustifyItem(eJustify, GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY))); + bChanged = true; + } + + if (m_xEdIndent->get_value_changed_from_saved()) + { + rSet->Put(SfxUInt16Item(GetWhich(SID_ATTR_ALIGN_INDENT), m_xEdIndent->get_value(FUNIT_TWIP))); + bChanged = true; + } + + if (m_xLbVerAlign->get_value_changed_from_saved()) + { + SvxCellVerJustify eJustify(SvxCellVerJustify::Standard); + switch (m_xLbVerAlign->get_active_id().toInt32()) + { + case ALIGNDLG_VERALIGN_STD: + eJustify = SvxCellVerJustify::Standard; + break; + case ALIGNDLG_VERALIGN_TOP: + eJustify = SvxCellVerJustify::Top; + break; + case ALIGNDLG_VERALIGN_MID: + eJustify = SvxCellVerJustify::Center; + break; + case ALIGNDLG_VERALIGN_BOTTOM: + eJustify = SvxCellVerJustify::Bottom; + break; + case ALIGNDLG_VERALIGN_BLOCK: + eJustify = SvxCellVerJustify::Block; + break; + } + rSet->Put(SvxVerJustifyItem(eJustify, GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY))); + bChanged = true; + } + + if (m_xNfRotate->get_value_changed_from_saved()) + { + rSet->Put(SfxInt32Item(GetWhich(SID_ATTR_ALIGN_DEGREES), m_aCtrlDial.GetRotation())); + bChanged = true; + } + + if (m_aVsRefEdge.IsValueChangedFromSaved()) + { + switch (m_aVsRefEdge.GetSelectedItemId()) + { + case IID_CELLLOCK: + rSet->Put(SvxRotateModeItem(SvxRotateMode::SVX_ROTATE_MODE_STANDARD, GetWhich(SID_ATTR_ALIGN_LOCKPOS))); + break; + case IID_TOPLOCK: + rSet->Put(SvxRotateModeItem(SvxRotateMode::SVX_ROTATE_MODE_TOP, GetWhich(SID_ATTR_ALIGN_LOCKPOS))); + break; + case IID_BOTTOMLOCK: + rSet->Put(SvxRotateModeItem(SvxRotateMode::SVX_ROTATE_MODE_BOTTOM, GetWhich(SID_ATTR_ALIGN_LOCKPOS))); + break; + default: + m_aVsRefEdge.SetNoSelection(); + break; + } + bChanged = true; + } + + if (m_xCbStacked->get_state_changed_from_saved()) + { + rSet->Put(SfxBoolItem(GetWhich(SID_ATTR_ALIGN_STACKED), m_xCbStacked->get_active())); + bChanged = true; + } + + if (m_xCbAsianMode->get_state_changed_from_saved()) + { + rSet->Put(SfxBoolItem(GetWhich(SID_ATTR_ALIGN_ASIANVERTICAL), m_xCbAsianMode->get_active())); + bChanged = true; + } + + if (m_xBtnWrap->get_state_changed_from_saved()) + { + rSet->Put(SfxBoolItem(GetWhich(SID_ATTR_ALIGN_LINEBREAK), m_xBtnWrap->get_active())); + bChanged = true; + } + + if (m_xBtnHyphen->get_state_changed_from_saved()) + { + rSet->Put(SfxBoolItem(GetWhich(SID_ATTR_ALIGN_HYPHENATION), m_xBtnHyphen->get_active())); + bChanged = true; + } + + if (m_xBtnShrink->get_state_changed_from_saved()) + { + rSet->Put(SfxBoolItem(GetWhich(SID_ATTR_ALIGN_SHRINKTOFIT), m_xBtnShrink->get_active())); + bChanged = true; + } + + if (m_xLbFrameDir->get_visible()) + { + if (m_xLbFrameDir->get_value_changed_from_saved()) + { + SvxFrameDirection eDir = m_xLbFrameDir->get_active_id(); + rSet->Put(SvxFrameDirectionItem(eDir, GetWhich(SID_ATTR_FRAMEDIRECTION))); + bChanged = true; + } + } + // Special treatment for distributed alignment; we need to set the justify // method to 'distribute' to distinguish from the normal justification. sal_uInt16 nWhichHorJM = GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD); - lcl_SetJustifyMethodToItemSet(*rSet, nWhichHorJM, *m_pLbHorAlign, ALIGNDLG_HORALIGN_DISTRIBUTED); + lcl_SetJustifyMethodToItemSet(*rSet, nWhichHorJM, *m_xLbHorAlign, ALIGNDLG_HORALIGN_DISTRIBUTED); if (!bChanged) bChanged = HasAlignmentChanged(*rSet, nWhichHorJM); sal_uInt16 nWhichVerJM = GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY_METHOD); - lcl_SetJustifyMethodToItemSet(*rSet, nWhichVerJM, *m_pLbVerAlign, ALIGNDLG_VERALIGN_DISTRIBUTED); + lcl_SetJustifyMethodToItemSet(*rSet, nWhichVerJM, *m_xLbVerAlign, ALIGNDLG_VERALIGN_DISTRIBUTED); if (!bChanged) bChanged = HasAlignmentChanged(*rSet, nWhichVerJM); return bChanged; } -void AlignmentTabPage::Reset( const SfxItemSet* rCoreAttrs ) +namespace { - SfxTabPage::Reset( rCoreAttrs ); + void ResetBool(sal_uInt16 nWhich, const SfxItemSet* pSet, weld::CheckButton& rBtn) + { + SfxItemState eState = pSet->GetItemState(nWhich); + switch (eState) + { + case SfxItemState::UNKNOWN: + rBtn.hide(); + break; + case SfxItemState::DISABLED: + case SfxItemState::READONLY: + rBtn.set_sensitive(false); + break; + case SfxItemState::DONTCARE: + rBtn.set_state(TRISTATE_INDET); + break; + case SfxItemState::DEFAULT: + case SfxItemState::SET: + { + const SfxBoolItem& rItem = static_cast<const SfxBoolItem&>(pSet->Get(nWhich)); + rBtn.set_state(static_cast<TriState>(rItem.GetValue())); + break; + } + } + rBtn.save_state(); + } +} + +void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs) +{ + SfxTabPage::Reset(pCoreAttrs); + + ResetBool(GetWhich(SID_ATTR_ALIGN_STACKED), pCoreAttrs, *m_xCbStacked); + ResetBool(GetWhich(SID_ATTR_ALIGN_ASIANVERTICAL), pCoreAttrs, *m_xCbAsianMode); + ResetBool(GetWhich(SID_ATTR_ALIGN_LINEBREAK), pCoreAttrs, *m_xBtnWrap); + ResetBool(GetWhich(SID_ATTR_ALIGN_HYPHENATION), pCoreAttrs, *m_xBtnHyphen); + ResetBool(GetWhich(SID_ATTR_ALIGN_SHRINKTOFIT), pCoreAttrs, *m_xBtnShrink); + + sal_uInt16 nWhich = GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY); + SfxItemState eState = pCoreAttrs->GetItemState(nWhich); + switch (eState) + { + case SfxItemState::UNKNOWN: + m_xLbHorAlign->hide(); + break; + case SfxItemState::DISABLED: + case SfxItemState::READONLY: + m_xLbHorAlign->set_sensitive(false); + break; + case SfxItemState::DONTCARE: + m_xLbHorAlign->set_active(-1); + break; + case SfxItemState::DEFAULT: + case SfxItemState::SET: + { + const SvxHorJustifyItem& rJustifyItem = static_cast<const SvxHorJustifyItem&>(pCoreAttrs->Get(nWhich)); + switch (rJustifyItem.GetValue()) + { + case SvxCellHorJustify::Standard: + m_xLbHorAlign->set_active_id(OUString::number(ALIGNDLG_HORALIGN_STD)); + break; + case SvxCellHorJustify::Left: + m_xLbHorAlign->set_active_id(OUString::number(ALIGNDLG_HORALIGN_LEFT)); + break; + case SvxCellHorJustify::Center: + m_xLbHorAlign->set_active_id(OUString::number(ALIGNDLG_HORALIGN_CENTER)); + break; + case SvxCellHorJustify::Right: + m_xLbHorAlign->set_active_id(OUString::number(ALIGNDLG_HORALIGN_RIGHT)); + break; + case SvxCellHorJustify::Block: + m_xLbHorAlign->set_active_id(OUString::number(ALIGNDLG_HORALIGN_BLOCK)); + break; + case SvxCellHorJustify::Repeat: + m_xLbHorAlign->set_active_id(OUString::number(ALIGNDLG_HORALIGN_FILL)); + break; + } + break; + } + } + + nWhich = GetWhich(SID_ATTR_ALIGN_INDENT); + eState = pCoreAttrs->GetItemState(nWhich); + switch (eState) + { + case SfxItemState::UNKNOWN: + m_xEdIndent->hide(); + break; + case SfxItemState::DISABLED: + case SfxItemState::READONLY: + m_xEdIndent->set_sensitive(false); + break; + case SfxItemState::DONTCARE: + m_xEdIndent->set_text(""); + break; + case SfxItemState::DEFAULT: + case SfxItemState::SET: + { + const SfxUInt16Item& rIndentItem = static_cast<const SfxUInt16Item&>(pCoreAttrs->Get(nWhich)); + m_xEdIndent->set_value(rIndentItem.GetValue(), FUNIT_TWIP); + break; + } + } + + nWhich = GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY); + eState = pCoreAttrs->GetItemState(nWhich); + switch (eState) + { + case SfxItemState::UNKNOWN: + m_xLbVerAlign->hide(); + break; + case SfxItemState::DISABLED: + case SfxItemState::READONLY: + m_xLbVerAlign->set_sensitive(false); + break; + case SfxItemState::DONTCARE: + m_xLbVerAlign->set_active(-1); + break; + case SfxItemState::DEFAULT: + case SfxItemState::SET: + { + const SvxVerJustifyItem& rJustifyItem = static_cast<const SvxVerJustifyItem&>(pCoreAttrs->Get(nWhich)); + switch (rJustifyItem.GetValue()) + { + case SvxCellVerJustify::Standard: + m_xLbVerAlign->set_active_id(OUString::number(ALIGNDLG_VERALIGN_STD)); + break; + case SvxCellVerJustify::Top: + m_xLbVerAlign->set_active_id(OUString::number(ALIGNDLG_VERALIGN_TOP)); + break; + case SvxCellVerJustify::Center: + m_xLbVerAlign->set_active_id(OUString::number(ALIGNDLG_VERALIGN_MID)); + break; + case SvxCellVerJustify::Bottom: + m_xLbVerAlign->set_active_id(OUString::number(ALIGNDLG_VERALIGN_BOTTOM)); + break; + case SvxCellVerJustify::Block: + m_xLbVerAlign->set_active_id(OUString::number(ALIGNDLG_VERALIGN_BLOCK)); + break; + } + break; + } + } + + nWhich = GetWhich(SID_ATTR_ALIGN_DEGREES); + eState = pCoreAttrs->GetItemState(nWhich); + switch (eState) + { + case SfxItemState::UNKNOWN: + m_xNfRotate->hide(); + m_xCtrlDial->hide(); + break; + case SfxItemState::DISABLED: + case SfxItemState::READONLY: + m_xNfRotate->set_sensitive(false); + m_xCtrlDial->set_sensitive(false); + break; + case SfxItemState::DONTCARE: + m_aCtrlDial.SetNoRotation(); + break; + case SfxItemState::DEFAULT: + case SfxItemState::SET: + { + const SfxInt32Item& rAlignItem = static_cast<const SfxInt32Item&>(pCoreAttrs->Get(nWhich)); + m_aCtrlDial.SetRotation(rAlignItem.GetValue()); + break; + } + } + + nWhich = GetWhich(SID_ATTR_ALIGN_LOCKPOS); + eState = pCoreAttrs->GetItemState(nWhich); + switch (eState) + { + case SfxItemState::UNKNOWN: + m_xVsRefEdge->hide(); + break; + case SfxItemState::DISABLED: + case SfxItemState::READONLY: + m_xVsRefEdge->set_sensitive(false); + break; + case SfxItemState::DONTCARE: + m_aVsRefEdge.SetNoSelection(); + break; + case SfxItemState::DEFAULT: + case SfxItemState::SET: + { + const SvxRotateModeItem& rRotateModeItem = static_cast<const SvxRotateModeItem&>(pCoreAttrs->Get(nWhich)); + switch (rRotateModeItem.GetValue()) + { + case SvxRotateMode::SVX_ROTATE_MODE_STANDARD: + m_aVsRefEdge.SelectItem(IID_CELLLOCK); + break; + case SvxRotateMode::SVX_ROTATE_MODE_TOP: + m_aVsRefEdge.SelectItem(IID_TOPLOCK); + break; + case SvxRotateMode::SVX_ROTATE_MODE_BOTTOM: + m_aVsRefEdge.SelectItem(IID_BOTTOMLOCK); + break; + default: + m_aVsRefEdge.SetNoSelection(); + break; + } + break; + } + } + m_aVsRefEdge.SaveValue(); + + //text direction + nWhich = GetWhich(SID_ATTR_FRAMEDIRECTION); + eState = pCoreAttrs->GetItemState(nWhich); + switch (eState) + { + case SfxItemState::UNKNOWN: + m_xLbFrameDir->hide(); + break; + case SfxItemState::DISABLED: + case SfxItemState::READONLY: + m_xLbFrameDir->set_sensitive(false); + break; + case SfxItemState::DONTCARE: + m_xLbFrameDir->set_active(-1); + break; + case SfxItemState::DEFAULT: + case SfxItemState::SET: + { + const SvxFrameDirectionItem& rFrameDirItem = static_cast<const SvxFrameDirectionItem&>(pCoreAttrs->Get(nWhich)); + m_xLbFrameDir->set_active_id(rFrameDirItem.GetValue()); + break; + } + } + // Special treatment for distributed alignment; we need to set the justify // method to 'distribute' to distinguish from the normal justification. lcl_MaybeResetAlignToDistro<SvxCellHorJustify, SvxCellHorJustify>( - *m_pLbHorAlign, ALIGNDLG_HORALIGN_DISTRIBUTED, *rCoreAttrs, + *m_xLbHorAlign, ALIGNDLG_HORALIGN_DISTRIBUTED, *pCoreAttrs, GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY), GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD), SvxCellHorJustify::Block); lcl_MaybeResetAlignToDistro<SvxCellVerJustify, SvxCellVerJustify>( - *m_pLbVerAlign, ALIGNDLG_VERALIGN_DISTRIBUTED, *rCoreAttrs, + *m_xLbVerAlign, ALIGNDLG_VERALIGN_DISTRIBUTED, *pCoreAttrs, GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY), GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY_METHOD), SvxCellVerJustify::Block); + m_xLbHorAlign->save_value(); + m_xLbFrameDir->save_value(); + m_xLbVerAlign->save_value(); + m_xNfRotate->save_value(); + m_xEdIndent->save_value(); + UpdateEnableControls(); } @@ -338,7 +593,7 @@ void AlignmentTabPage::DataChanged( const DataChangedEvent& rDCEvt ) void AlignmentTabPage::InitVsRefEgde() { // remember selection - is deleted in call to ValueSet::Clear() - sal_uInt16 nSel = m_pVsRefEdge->GetSelectedItemId(); + sal_uInt16 nSel = m_aVsRefEdge.GetSelectedItemId(); BitmapEx aBottomLock(RID_SVXBMP_BOTTOMLOCK); BitmapEx aTopLock(RID_SVXBMP_TOPLOCK); @@ -351,49 +606,57 @@ void AlignmentTabPage::InitVsRefEgde() aCellLock.Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BmpScaleFlag::Fast); } - Size aItemSize(aBottomLock.GetSizePixel()); - - m_pVsRefEdge->Clear(); - m_pVsRefEdge->SetStyle( m_pVsRefEdge->GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER ); - - m_pVsRefEdge->SetColCount( 3 ); - m_pVsRefEdge->InsertItem(IID_BOTTOMLOCK, Image(aBottomLock), m_pFtBotLock->GetText()); - m_pVsRefEdge->InsertItem(IID_TOPLOCK, Image(aTopLock), m_pFtTopLock->GetText()); - m_pVsRefEdge->InsertItem(IID_CELLLOCK, Image(aCellLock), m_pFtCelLock->GetText()); + m_aVsRefEdge.Clear(); + m_aVsRefEdge.SetStyle(m_aVsRefEdge.GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER); - m_pVsRefEdge->SetSizePixel( m_pVsRefEdge->CalcWindowSizePixel( aItemSize ) ); + m_aVsRefEdge.SetColCount(3); + m_aVsRefEdge.InsertItem(IID_BOTTOMLOCK, Image(aBottomLock), m_xFtBotLock->get_label()); + m_aVsRefEdge.InsertItem(IID_TOPLOCK, Image(aTopLock), m_xFtTopLock->get_label()); + m_aVsRefEdge.InsertItem(IID_CELLLOCK, Image(aCellLock), m_xFtCelLock->get_label()); + m_aVsRefEdge.SetOptimalSize(); - m_pVsRefEdge->SelectItem( nSel ); + m_aVsRefEdge.SelectItem( nSel ); } void AlignmentTabPage::UpdateEnableControls() { - const sal_Int32 nHorAlign = m_pLbHorAlign->GetSelectedEntryPos(); + const sal_Int32 nHorAlign = m_xLbHorAlign->get_active(); bool bHorLeft = (nHorAlign == ALIGNDLG_HORALIGN_LEFT); bool bHorBlock = (nHorAlign == ALIGNDLG_HORALIGN_BLOCK); bool bHorFill = (nHorAlign == ALIGNDLG_HORALIGN_FILL); bool bHorDist = (nHorAlign == ALIGNDLG_HORALIGN_DISTRIBUTED); // indent edit field only for left alignment - m_pFtIndent->Enable( bHorLeft ); - m_pEdIndent->Enable( bHorLeft ); + m_xFtIndent->set_sensitive( bHorLeft ); + m_xEdIndent->set_sensitive( bHorLeft ); - // rotation/stacked disabled for fill alignment - m_pOrientHlp->Enable( !bHorFill ); + // stacked disabled for fill alignment + m_xCbStacked->set_sensitive(!bHorFill); // hyphenation only for automatic line breaks or for block alignment - m_pBtnHyphen->Enable( m_pBtnWrap->IsChecked() || bHorBlock ); + m_xBtnHyphen->set_sensitive( m_xBtnWrap->get_active() || bHorBlock ); // shrink only without automatic line break, and not for block, fill or distribute. - m_pBtnShrink->Enable( (m_pBtnWrap->GetState() == TRISTATE_FALSE) && !bHorBlock && !bHorFill && !bHorDist ); + m_xBtnShrink->set_sensitive( (m_xBtnWrap->get_state() == TRISTATE_FALSE) && !bHorBlock && !bHorFill && !bHorDist ); // visibility of frames - m_pAlignmentFrame->Show(m_pLbHorAlign->IsVisible() || m_pEdIndent->IsVisible() || - m_pLbVerAlign->IsVisible()); - m_pOrientFrame->Show(m_pCtrlDial->IsVisible() || m_pVsRefEdge->IsVisible() || - m_pCbStacked->IsVisible() || m_pCbAsianMode->IsVisible()); - m_pPropertiesFrame->Show(m_pBtnWrap->IsVisible() || m_pBtnHyphen->IsVisible() || - m_pBtnShrink->IsVisible() || m_pLbFrameDir->IsVisible()); + m_xAlignmentFrame->show(m_xLbHorAlign->get_visible() || m_xEdIndent->get_visible() || + m_xLbVerAlign->get_visible()); + m_xOrientFrame->show(m_xCtrlDial->get_visible() || m_xVsRefEdge->get_visible() || + m_xCbStacked->get_visible() || m_xCbAsianMode->get_visible()); + m_xPropertiesFrame->show(m_xBtnWrap->get_visible() || m_xBtnHyphen->get_visible() || + m_xBtnShrink->get_visible() || m_xLbFrameDir->get_visible()); + + bool bStackedText = m_xCbStacked->get_active(); + // windows to be disabled, if stacked text is turned ON + m_xFtRotate->set_sensitive(!bStackedText); + m_xFtRefEdge->set_sensitive(!bStackedText); + m_xVsRefEdge->set_sensitive(!bStackedText); + // windows to be disabled, if stacked text is turned OFF + m_xCbAsianMode->set_sensitive(bStackedText); + // rotation/stacked disabled for fill alignment/stacked + m_xCtrlDial->set_sensitive(!bHorFill && !bStackedText); + m_xNfRotate->set_sensitive(!bHorFill && !bStackedText); } bool AlignmentTabPage::HasAlignmentChanged( const SfxItemSet& rNew, sal_uInt16 nWhich ) const @@ -417,17 +680,16 @@ bool AlignmentTabPage::HasAlignmentChanged( const SfxItemSet& rNew, sal_uInt16 n return eMethodOld != eMethodNew; } -IMPL_LINK_NOARG(AlignmentTabPage, UpdateEnableClickHdl, Button*, void) +IMPL_LINK_NOARG(AlignmentTabPage, UpdateEnableClickHdl, weld::ToggleButton&, void) { UpdateEnableControls(); } -IMPL_LINK_NOARG(AlignmentTabPage, UpdateEnableHdl, ListBox&, void) +IMPL_LINK_NOARG(AlignmentTabPage, UpdateEnableHdl, weld::ComboBox&, void) { UpdateEnableControls(); } - } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/uiconfig/ui/cellalignment.ui b/cui/uiconfig/ui/cellalignment.ui index db63e0af1d8b..7721736b3326 100644 --- a/cui/uiconfig/ui/cellalignment.ui +++ b/cui/uiconfig/ui/cellalignment.ui @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="cui"> <requires lib="gtk+" version="3.18"/> - <requires lib="LibreOffice" version="1.0"/> <object class="GtkAdjustment" id="adjustmentIndent"> <property name="upper">990</property> <property name="step_increment">10</property> @@ -12,78 +11,6 @@ <property name="upper">359</property> <property name="step_increment">5</property> </object> - <object class="GtkListStore" id="liststoreHorzAlign"> - <columns> - <!-- column-name gchararray1 --> - <column type="gchararray"/> - <!-- column-name gint1 --> - <column type="gint"/> - </columns> - <data> - <row> - <col id="0" translatable="yes" context="cellalignment|liststoreHorzAlign">Default</col> - <col id="1">0</col> - </row> - <row> - <col id="0" translatable="yes" context="cellalignment|liststoreHorzAlign">Left</col> - <col id="1">1</col> - </row> - <row> - <col id="0" translatable="yes" context="cellalignment|liststoreHorzAlign">Center</col> - <col id="1">2</col> - </row> - <row> - <col id="0" translatable="yes" context="cellalignment|liststoreHorzAlign">Right</col> - <col id="1">3</col> - </row> - <row> - <col id="0" translatable="yes" context="cellalignment|liststoreHorzAlign">Justified</col> - <col id="1">4</col> - </row> - <row> - <col id="0" translatable="yes" context="cellalignment|liststoreHorzAlign">Filled</col> - <col id="1">5</col> - </row> - <row> - <col id="0" translatable="yes" context="cellalignment|liststoreHorzAlign">Distributed</col> - <col id="1">6</col> - </row> - </data> - </object> - <object class="GtkListStore" id="liststoreVertAlign"> - <columns> - <!-- column-name gchararray1 --> - <column type="gchararray"/> - <!-- column-name gint1 --> - <column type="gint"/> - </columns> - <data> - <row> - <col id="0" translatable="yes" context="cellalignment|liststoreVertAlign">Default</col> - <col id="1">0</col> - </row> - <row> - <col id="0" translatable="yes" context="cellalignment|liststoreVertAlign">Top</col> - <col id="1">1</col> - </row> - <row> - <col id="0" translatable="yes" context="cellalignment|liststoreVertAlign">Middle</col> - <col id="1">2</col> - </row> - <row> - <col id="0" translatable="yes" context="cellalignment|liststoreVertAlign">Bottom</col> - <col id="1">3</col> - </row> - <row> - <col id="0" translatable="yes" context="cellalignment|liststoreVertAlign">Justified</col> - <col id="1">4</col> - </row> - <row> - <col id="0" translatable="yes" context="cellalignment|liststoreVertAlign">Distributed</col> - <col id="1">5</col> - </row> - </data> - </object> <object class="GtkGrid" id="CellAlignPage"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -119,10 +46,10 @@ <object class="GtkLabel" id="labelDegrees"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="cellalignment|labelDegrees">_Degrees:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">spinDegrees</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -133,10 +60,10 @@ <object class="GtkLabel" id="labelRefEdge"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="cellalignment|labelRefEdge">_Reference edge:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">references</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -144,10 +71,27 @@ </packing> </child> <child> - <object class="svtlo-ValueSet" id="references"> + <object class="GtkScrolledWindow"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="halign">start</property> + <property name="hscrollbar_policy">never</property> + <property name="vscrollbar_policy">never</property> + <property name="shadow_type">in</property> + <child> + <object class="GtkViewport"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkDrawingArea" id="references"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property> + <property name="halign">start</property> + </object> + </child> + </object> + </child> </object> <packing> <property name="left_attach">0</property> @@ -158,6 +102,7 @@ <object class="GtkSpinButton" id="spinDegrees"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="activates_default">True</property> <property name="progress_pulse_step">1</property> <property name="adjustment">adjustmentSpinDegrees</property> <property name="wrap">True</property> @@ -174,12 +119,29 @@ </packing> </child> <child> - <object class="svxlo-DialControl" id="dialcontrol"> + <object class="GtkScrolledWindow"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="halign">center</property> <property name="valign">center</property> - <property name="active">True</property> + <property name="hscrollbar_policy">never</property> + <property name="vscrollbar_policy">never</property> + <property name="shadow_type">in</property> + <child> + <object class="GtkViewport"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkDrawingArea" id="dialcontrol"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property> + <property name="halign">center</property> + <property name="valign">center</property> + </object> + </child> + </object> + </child> </object> <packing> <property name="left_attach">0</property> @@ -322,7 +284,7 @@ </packing> </child> <child> - <object class="GtkHBox" id="boxDirection"> + <object class="GtkBox" id="boxDirection"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="spacing">12</property> @@ -330,10 +292,10 @@ <object class="GtkLabel" id="LabelTxtDir"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="cellalignment|LabelTxtDir">Te_xt direction:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">comboTextDirBox</property> + <property name="xalign">0</property> </object> <packing> <property name="expand">False</property> @@ -342,7 +304,7 @@ </packing> </child> <child> - <object class="svxlo-FrameDirectionListBox" id="comboTextDirBox"> + <object class="GtkComboBoxText" id="comboTextDirBox"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -398,9 +360,10 @@ <property name="row_spacing">6</property> <property name="column_spacing">12</property> <child> - <object class="GtkSpinButton" id="spinIndentFrom:0.00pt"> + <object class="GtkSpinButton" id="spinIndentFrom"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="activates_default">True</property> <property name="adjustment">adjustmentIndent</property> <property name="climb_rate">1</property> </object> @@ -413,10 +376,10 @@ <object class="GtkLabel" id="labelHorzAlign"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="cellalignment|labelHorzAlign">Hori_zontal</property> <property name="use_underline">True</property> <property name="mnemonic_widget">comboboxHorzAlign</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -427,10 +390,10 @@ <object class="GtkLabel" id="labelVertAlign"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="cellalignment|labelVertAlign">_Vertical</property> <property name="use_underline">True</property> <property name="mnemonic_widget">comboboxVertAlign</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">2</property> @@ -441,10 +404,10 @@ <object class="GtkLabel" id="labelIndent"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="cellalignment|labelIndent">I_ndent</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">spinIndentFrom:0.00pt</property> + <property name="mnemonic_widget">spinIndentFrom</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -452,11 +415,19 @@ </packing> </child> <child> - <object class="GtkComboBox" id="comboboxHorzAlign"> + <object class="GtkComboBoxText" id="comboboxHorzAlign"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> - <property name="model">liststoreHorzAlign</property> + <items> + <item id="0" translatable="yes" context="cellalignment|liststoreHorzAlign">Default</item> + <item id="1" translatable="yes" context="cellalignment|liststoreHorzAlign">Left</item> + <item id="2" translatable="yes" context="cellalignment|liststoreHorzAlign">Center</item> + <item id="3" translatable="yes" context="cellalignment|liststoreHorzAlign">Right</item> + <item id="4" translatable="yes" context="cellalignment|liststoreHorzAlign">Justified</item> + <item id="5" translatable="yes" context="cellalignment|liststoreHorzAlign">Filled</item> + <item id="6" translatable="yes" context="cellalignment|liststoreHorzAlign">Distributed</item> + </items> </object> <packing> <property name="left_attach">0</property> @@ -464,11 +435,18 @@ </packing> </child> <child> - <object class="GtkComboBox" id="comboboxVertAlign"> + <object class="GtkComboBoxText" id="comboboxVertAlign"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> - <property name="model">liststoreVertAlign</property> + <items> + <item id="0" translatable="yes" context="cellalignment|liststoreVertAlign">Default</item> + <item id="1" translatable="yes" context="cellalignment|liststoreVertAlign">Top</item> + <item id="2" translatable="yes" context="cellalignment|liststoreVertAlign">Middle</item> + <item id="3" translatable="yes" context="cellalignment|liststoreVertAlign">Bottom</item> + <item id="4" translatable="yes" context="cellalignment|liststoreVertAlign">Justified</item> + <item id="5" translatable="yes" context="cellalignment|liststoreVertAlign">Distributed</item> + </items> </object> <packing> <property name="left_attach">2</property> diff --git a/include/sfx2/controlwrapper.hxx b/include/sfx2/controlwrapper.hxx index 1758d708c455..549c21573219 100644 --- a/include/sfx2/controlwrapper.hxx +++ b/include/sfx2/controlwrapper.hxx @@ -122,12 +122,8 @@ private: | | +- [ValueType]MetricFieldWrapper [1] [2] | | | +- ListBoxWrapper< ValueT > [1] - | | | - | | +- [ValueType]ListBoxWrapper [1] [2] - | | - | +- ValueSetWrapper< ValueT > [1] | | - | +- [ValueType]ValueSetWrapper [1] [2] + | +- [ValueType]ListBoxWrapper [1] [2] | +- MultiControlWrapperHelper | @@ -226,21 +222,6 @@ public: }; -/** A wrapper for the VCL CheckBox. */ -class SFX2_DLLPUBLIC CheckBoxWrapper: - public SingleControlWrapper< CheckBox, bool > -{ -public: - explicit CheckBoxWrapper( CheckBox& rCheckBox ); - - virtual bool IsControlDontKnow() const override; - virtual void SetControlDontKnow( bool bSet ) override; - - virtual bool GetControlValue() const override; - virtual void SetControlValue( bool bValue ) override; -}; - - /** A wrapper for the VCL MetricField. Adds support for field units during accessing the control value. The @@ -298,39 +279,6 @@ public: }; -#define WRAPPER_VALUESET_ITEM_NOTFOUND 0xFFFF /* XXX was value of VALUESET_ITEM_NOTFOUND */ - -/** A wrapper for the SVTOOLS ValueSet. - - If a position<->value map is passed to the constructor, it MUST be - terminated with an entry containing WRAPPER_VALUESET_ITEM_NOTFOUND as list - position. See documentation of the PosValueMapper template for details. - */ -template< typename ValueT > -class ValueSetWrapper : - public SingleControlWrapper< ValueSet, ValueT >, - public PosValueMapper< ValueSetPosType, ValueT > -{ - typedef PosValueMapper< ValueSetPosType, ValueT > MapperType; - -public: - typedef typename MapperType::MapEntryType MapEntryType; - - /** @param pMap Optional position <-> value map. - See PosValueMapper documentation for details. */ - explicit ValueSetWrapper( ValueSet& rValueSet, const MapEntryType* pMap ) : - SingleControlWrapper< ValueSet, ValueT >( rValueSet ), MapperType( WRAPPER_VALUESET_ITEM_NOTFOUND, pMap ) {} - - virtual bool IsControlDontKnow() const override - { return this->GetControl().IsNoSelection(); } - virtual void SetControlDontKnow( bool bSet ) override - { if( bSet ) this->GetControl().SetNoSelection(); } - - virtual ValueT GetControlValue() const override; - virtual void SetControlValue( ValueT nValue ) override; -}; - - // *** Implementation of template functions *** @@ -424,22 +372,6 @@ void ListBoxWrapper< ValueT >::SetControlValue( ValueT nValue ) this->GetControl().SelectEntryPos( nPos ); } - -template< typename ValueT > -ValueT ValueSetWrapper< ValueT >::GetControlValue() const -{ - return this->GetValueFromPos( this->GetControl().GetSelectedItemId() ); -} - -template< typename ValueT > -void ValueSetWrapper< ValueT >::SetControlValue( ValueT nValue ) -{ - sal_uInt16 nPos = this->GetPosFromValue( nValue ); - if( nPos != this->GetNotFoundPos() ) - this->GetControl().SelectItem( nPos ); -} - - } // namespace sfx #endif diff --git a/include/sfx2/itemconnect.hxx b/include/sfx2/itemconnect.hxx index a4a122cddaac..622114e0a2d5 100644 --- a/include/sfx2/itemconnect.hxx +++ b/include/sfx2/itemconnect.hxx @@ -143,23 +143,13 @@ namespace sfx { | +- ItemControlConnection< ItemWrpT, ControlWrpT > | | - | +- CheckBoxConnection [1] - | | | +- NumericConnection< ItemWrpT > [1] | | | | | +- [ValueType]NumericConnection [1] [2] | | - | +- MetricConnection< ItemWrpT > [1] - | | | - | | +- [ValueType]MetricConnection [1] [2] - | | | +- ListBoxConnection< ItemWrpT > [1] - | | | - | | +- [ValueType]ListBoxConnection [1] [2] - | | - | +- ValueSetConnection< ItemWrpT > [1] | | - | +- [ValueType]ValueSetConnection [1] [2] + | +- [ValueType]ListBoxConnection [1] [2] | +- ItemConnectionArray [1] @@ -273,34 +263,6 @@ private: sal_uInt16 mnSlot; }; - -/** Connection between an SfxBoolItem and a VCL CheckBox. */ -typedef ItemControlConnection< BoolItemWrapper, CheckBoxWrapper > CheckBoxConnection; - - -/** Connection between an item and the VCL MetricField. - - Adds support of different field units during control value <-> item value - conversion. The field unit passed to the constructor applies for the item - values, while the field unit used in the control has to be set at the - control itself. - */ -template< typename ItemWrpT > -class MetricConnection : public ItemControlConnection< ItemWrpT, - MetricFieldWrapper< typename ItemWrpT::ItemValueType > > -{ - typedef ItemControlConnection< ItemWrpT, - MetricFieldWrapper< typename ItemWrpT::ItemValueType > > - ItemControlConnectionType; - -public: - typedef typename ItemControlConnectionType::ControlWrapperType MetricFieldWrapperType; - - explicit MetricConnection( sal_uInt16 nSlot, MetricField& rField, - FieldUnit eItemUnit, ItemConnFlags nFlags = ItemConnFlags::NONE ); -}; - - /** Connection between an item and a VCL ListBox. Optionally a map can be passed that maps list box positions to item values. @@ -326,31 +288,6 @@ public: }; -/** Connection between an item and an SVTOOLS ValueSet. - - Optionally a map can be passed that maps value set identifiers to item - values. This map MUST be terminated with an entry containing - WRAPPER_VALUESET_ITEM_NOTFOUND as value set identifier. The item value - contained in this last entry is used as default item value in case of an - error. - */ -template< typename ItemWrpT > -class ValueSetConnection : public ItemControlConnection< ItemWrpT, - ValueSetWrapper< typename ItemWrpT::ItemValueType > > -{ - typedef ItemControlConnection< ItemWrpT, - ValueSetWrapper< typename ItemWrpT::ItemValueType > > - ItemControlConnectionType; - -public: - typedef typename ItemControlConnectionType::ControlWrapperType ValueSetWrapperType; - typedef typename ValueSetWrapperType::MapEntryType MapEntryType; - - explicit ValueSetConnection( sal_uInt16 nSlot, ValueSet& rValueSet, - const MapEntryType* pMap, ItemConnFlags nFlags = ItemConnFlags::NONE ); -}; - - // Array of connections @@ -462,15 +399,6 @@ bool ItemControlConnection< ItemWrpT, ControlWrpT >::FillItemSet( // Standard connections - -template< typename ItemWrpT > -MetricConnection< ItemWrpT >::MetricConnection( - sal_uInt16 nSlot, MetricField& rField, FieldUnit eItemUnit, ItemConnFlags nFlags ) : - ItemControlConnectionType( nSlot, new MetricFieldWrapperType( rField, eItemUnit ), nFlags ) -{ -} - - template< typename ItemWrpT > ListBoxConnection< ItemWrpT >::ListBoxConnection( sal_uInt16 nSlot, ListBox& rListBox, const MapEntryType* pMap, ItemConnFlags nFlags ) : @@ -478,15 +406,6 @@ ListBoxConnection< ItemWrpT >::ListBoxConnection( { } - -template< typename ItemWrpT > -ValueSetConnection< ItemWrpT >::ValueSetConnection( - sal_uInt16 nSlot, ValueSet& rValueSet, const MapEntryType* pMap, ItemConnFlags nFlags ) : - ItemControlConnectionType( nSlot, new ValueSetWrapperType( rValueSet, pMap ), nFlags ) -{ -} - - } // namespace sfx #endif diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx index 6804a9622c90..7bd827eca220 100644 --- a/include/svtools/valueset.hxx +++ b/include/svtools/valueset.hxx @@ -421,6 +421,7 @@ private: long mnUserItemWidth; long mnUserItemHeight; sal_uInt16 mnSelItemId; + int mnSavedItemId; sal_uInt16 mnHighItemId; sal_uInt16 mnCols; sal_uInt16 mnCurCol; @@ -581,6 +582,17 @@ public: return mbEdgeBlending; } void SetEdgeBlending(bool bNew); + + void SaveValue() + { + mnSavedItemId = IsNoSelection() ? -1 : GetSelectedItemId(); + } + + bool IsValueChangedFromSaved() const + { + int nItemId = IsNoSelection() ? -1 : GetSelectedItemId(); + return mnSavedItemId != nItemId; + } }; diff --git a/include/svx/dialcontrol.hxx b/include/svx/dialcontrol.hxx index 085cb0ce4c1c..44a8291d7435 100644 --- a/include/svx/dialcontrol.hxx +++ b/include/svx/dialcontrol.hxx @@ -22,6 +22,7 @@ #include <memory> #include <vcl/ctrl.hxx> +#include <vcl/customweld.hxx> #include <vcl/weld.hxx> #include <sfx2/itemconnect.hxx> #include <svx/svxdllapi.h> @@ -179,6 +180,8 @@ public: sal_Int32 GetRotation() const; /** Sets the rotation to the passed value (in 1/100 degrees). */ void SetRotation( sal_Int32 nAngle ); + /** Sets the control to "don't care" state. */ + void SetNoRotation(); /** Links the passed numeric edit field to the control (bi-directional). * nDecimalPlaces: @@ -194,12 +197,16 @@ public: /** Compare value with the saved value */ bool IsValueModified(); + const OUString& GetText() const { return mpImpl->maText; } + void SetText(const OUString& rText) { mpImpl->maText = rText; } + protected: struct DialControl_Impl { ScopedVclPtr<DialControlBmp> mxBmpEnabled; ScopedVclPtr<DialControlBmp> mxBmpDisabled; ScopedVclPtr<DialControlBmp> mxBmpBuffered; + OUString maText; weld::SpinButton* mpLinkField; sal_Int32 mnLinkedFieldValueMultiplyer; Size maWinSize; @@ -209,6 +216,7 @@ protected: sal_Int32 mnOldAngle; long mnCenterX; long mnCenterY; + bool mbNoRot; explicit DialControl_Impl(OutputDevice& rReference); void Init( const Size& rWinSize, const vcl::Font& rWinFont ); @@ -225,26 +233,10 @@ protected: private: void InvalidateControl(); - DECL_LINK( LinkedFieldModifyHdl, weld::SpinButton&, void ); + DECL_LINK(LinkedFieldModifyHdl, weld::Entry&, void); void LinkedFieldModifyHdl(); }; -/** Wrapper for usage of a DialControl in item connections. */ -class SAL_WARN_UNUSED SVX_DLLPUBLIC DialControlWrapper : public sfx::SingleControlWrapper< DialControl, sal_Int32 > -{ -public: - explicit DialControlWrapper( DialControl& rDial ); - - virtual bool IsControlDontKnow() const override; - virtual void SetControlDontKnow( bool bSet ) override; - - virtual sal_Int32 GetControlValue() const override; - virtual void SetControlValue( sal_Int32 nValue ) override; -}; - -/** An item<->control connection for a DialControl. */ -typedef sfx::ItemControlConnection< sfx::Int32ItemWrapper, DialControlWrapper > DialControlConnection; - } #endif diff --git a/include/svx/frmdirlbox.hxx b/include/svx/frmdirlbox.hxx index 62d374e06a13..72455bef1770 100644 --- a/include/svx/frmdirlbox.hxx +++ b/include/svx/frmdirlbox.hxx @@ -69,6 +69,8 @@ public: SvxFrameDirection get_active_id() const { return static_cast<SvxFrameDirection>(m_xControl->get_active_id().toUInt32()); } void set_active_id(SvxFrameDirection eDir) { m_xControl->set_active_id(OUString::number(static_cast<sal_uInt32>(eDir))); } void remove_id(SvxFrameDirection eDir) { m_xControl->remove_id(OUString::number(static_cast<sal_uInt32>(eDir))); } + void set_active(int pos) { m_xControl->set_active(pos); } + void set_sensitive(bool bSensitive) { m_xControl->set_sensitive(bSensitive); } void hide() { m_xControl->hide(); } void show(bool bShow = true) { m_xControl->show(bShow); } int get_count() const { return m_xControl->get_count(); } @@ -80,26 +82,6 @@ public: void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_xControl->connect_changed(rLink); } }; -/** Wrapper for usage of a FrameDirectionListBox in item connections. */ -class SAL_WARN_UNUSED SVX_DLLPUBLIC FrameDirectionListBoxWrapper : public sfx::SingleControlWrapper< FrameDirectionListBox, SvxFrameDirection > -{ -public: - explicit FrameDirectionListBoxWrapper( FrameDirectionListBox& rListBox ); - - virtual bool IsControlDontKnow() const override; - virtual void SetControlDontKnow( bool bSet ) override; - - virtual SvxFrameDirection GetControlValue() const override; - virtual void SetControlValue( SvxFrameDirection eValue ) override; -}; - -/** Wrapper for usage of a SvxFrameDirectionItem in item connections. */ -typedef sfx::ValueItemWrapper< SvxFrameDirectionItem, SvxFrameDirection > FrameDirItemWrapper; - -/** An item<->control connection for a FrameDirectionListBox. */ -typedef sfx::ItemControlConnection< FrameDirItemWrapper, FrameDirectionListBoxWrapper > FrameDirectionListBoxConnection; - - } #endif diff --git a/include/svx/orienthelper.hxx b/include/svx/orienthelper.hxx index f3d16bc9d614..8140398589a0 100644 --- a/include/svx/orienthelper.hxx +++ b/include/svx/orienthelper.hxx @@ -89,25 +89,6 @@ private: std::unique_ptr< OrientationHelper_Impl > mpImpl; }; - -/** Wrapper for usage of the stacked attribute of an OrientationHelper in item connections. */ -class SVX_DLLPUBLIC OrientStackedWrapper : public sfx::SingleControlWrapper< OrientationHelper, bool > -{ -public: - explicit OrientStackedWrapper( OrientationHelper& rOrientHlp ); - - virtual bool IsControlDontKnow() const override; - virtual void SetControlDontKnow( bool bSet ) override; - - virtual bool GetControlValue() const override; - virtual void SetControlValue( bool bValue ) override; -}; - - -/** An item<->control connection for the stacked attribute of an OrientationHelper. */ -typedef sfx::ItemControlConnection< sfx::BoolItemWrapper, OrientStackedWrapper > OrientStackedConnection; - - } // namespace #endif diff --git a/include/vcl/customweld.hxx b/include/vcl/customweld.hxx index 5739ab11dada..5399d6c79c41 100644 --- a/include/vcl/customweld.hxx +++ b/include/vcl/customweld.hxx @@ -123,6 +123,7 @@ public: void set_margin_bottom(int nMargin) { m_xDrawingArea->set_margin_bottom(nMargin); } void set_sensitive(bool bSensitive) { m_xDrawingArea->set_sensitive(bSensitive); } bool get_sensitive() const { return m_xDrawingArea->get_sensitive(); } + bool get_visible() const { return m_xDrawingArea->get_visible(); } }; } #endif diff --git a/sfx2/source/dialog/itemconnect.cxx b/sfx2/source/dialog/itemconnect.cxx index e814a70368c2..a3b9700db4b1 100644 --- a/sfx2/source/dialog/itemconnect.cxx +++ b/sfx2/source/dialog/itemconnect.cxx @@ -101,34 +101,6 @@ void DummyWindowWrapper::SetControlValue( void* ) { } - -CheckBoxWrapper::CheckBoxWrapper( CheckBox& rCheckBox ) : - SingleControlWrapperType( rCheckBox ) -{ -} - -bool CheckBoxWrapper::IsControlDontKnow() const -{ - return GetControl().GetState() == TRISTATE_INDET; -} - -void CheckBoxWrapper::SetControlDontKnow( bool bSet ) -{ - GetControl().EnableTriState( bSet ); - GetControl().SetState( bSet ? TRISTATE_INDET : TRISTATE_FALSE ); -} - -bool CheckBoxWrapper::GetControlValue() const -{ - return GetControl().IsChecked(); -} - -void CheckBoxWrapper::SetControlValue( bool bValue ) -{ - GetControl().Check( bValue ); -} - - // Base connection classes diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index eb3daf8be985..7c851be2acb1 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -2280,6 +2280,7 @@ SvtValueSet::SvtValueSet(std::unique_ptr<weld::ScrolledWindow> pScrolledWindow) mnUserItemHeight = 0; mnFirstLine = 0; mnSelItemId = 0; + mnSavedItemId = -1; mnCols = 0; mnCurCol = 0; mnUserCols = 0; diff --git a/svx/source/dialog/dialcontrol.cxx b/svx/source/dialog/dialcontrol.cxx index ab0b12dcff86..73674cb5c66e 100644 --- a/svx/source/dialog/dialcontrol.cxx +++ b/svx/source/dialog/dialcontrol.cxx @@ -517,7 +517,8 @@ SvxDialControl::DialControl_Impl::DialControl_Impl(OutputDevice& rReference) : mnInitialAngle( 0 ), mnOldAngle( 0 ), mnCenterX( 0 ), - mnCenterY( 0 ) + mnCenterY( 0 ), + mbNoRot( false ) { } @@ -620,6 +621,17 @@ void SvxDialControl::LoseFocus() HandleEscapeEvent(); } +void SvxDialControl::SetNoRotation() +{ + if( !mpImpl->mbNoRot ) + { + mpImpl->mbNoRot = true; + InvalidateControl(); + if (mpImpl->mpLinkField) + mpImpl->mpLinkField->set_text(""); + } +} + sal_Int32 SvxDialControl::GetRotation() const { return mpImpl->mnAngle; @@ -633,7 +645,7 @@ void SvxDialControl::SetLinkedField(weld::SpinButton* pField, sal_Int32 nDecimal if( mpImpl->mpLinkField ) { weld::SpinButton& rField = *mpImpl->mpLinkField; - rField.connect_value_changed(Link<weld::SpinButton&,void>()); + rField.connect_changed(Link<weld::Entry&,void>()); } // remember the new linked field mpImpl->mpLinkField = pField; @@ -641,11 +653,11 @@ void SvxDialControl::SetLinkedField(weld::SpinButton* pField, sal_Int32 nDecimal if( mpImpl->mpLinkField ) { weld::SpinButton& rField = *mpImpl->mpLinkField; - rField.connect_value_changed(LINK(this, SvxDialControl, LinkedFieldModifyHdl)); + rField.connect_changed(LINK(this, SvxDialControl, LinkedFieldModifyHdl)); } } -IMPL_LINK_NOARG(SvxDialControl, LinkedFieldModifyHdl, weld::SpinButton&, void) +IMPL_LINK_NOARG(SvxDialControl, LinkedFieldModifyHdl, weld::Entry&, void) { LinkedFieldModifyHdl(); } @@ -689,19 +701,26 @@ void SvxDialControl::Init( const Size& rWinSize ) void SvxDialControl::InvalidateControl() { mpImpl->mxBmpBuffered->CopyBackground( IsEnabled() ? *mpImpl->mxBmpEnabled : *mpImpl->mxBmpDisabled ); - mpImpl->mxBmpBuffered->DrawElements( OUString(), mpImpl->mnAngle ); + if( !mpImpl->mbNoRot ) + mpImpl->mxBmpBuffered->DrawElements(GetText(), mpImpl->mnAngle); Invalidate(); } -void SvxDialControl::SetRotation( sal_Int32 nAngle ) +void SvxDialControl::SetRotation(sal_Int32 nAngle) { - while( nAngle < 0 ) + bool bOldSel = mpImpl->mbNoRot; + mpImpl->mbNoRot = false; + + while (nAngle < 0) nAngle += 36000; - mpImpl->mnAngle = nAngle; - InvalidateControl(); - if( mpImpl->mpLinkField ) - mpImpl->mpLinkField->set_value(GetRotation() / mpImpl->mnLinkedFieldValueMultiplyer); + if (!bOldSel || (mpImpl->mnAngle != nAngle)) + { + mpImpl->mnAngle = nAngle; + InvalidateControl(); + if( mpImpl->mpLinkField ) + mpImpl->mpLinkField->set_value(GetRotation() / mpImpl->mnLinkedFieldValueMultiplyer); + } } void SvxDialControl::HandleMouseEvent( const Point& rPos, bool bInitial ) @@ -734,32 +753,6 @@ void SvxDialControl::HandleEscapeEvent() } } -DialControlWrapper::DialControlWrapper( DialControl& rDial ) : - SingleControlWrapperType( rDial ) -{ -} - -bool DialControlWrapper::IsControlDontKnow() const -{ - return !GetControl().HasRotation(); -} - -void DialControlWrapper::SetControlDontKnow( bool bSet ) -{ - if( bSet ) - GetControl().SetNoRotation(); -} - -sal_Int32 DialControlWrapper::GetControlValue() const -{ - return GetControl().GetRotation(); -} - -void DialControlWrapper::SetControlValue( sal_Int32 nValue ) -{ - GetControl().SetRotation( nValue ); -} - } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/dialog/frmdirlbox.cxx b/svx/source/dialog/frmdirlbox.cxx index 035d5099e874..12b342db79c1 100644 --- a/svx/source/dialog/frmdirlbox.cxx +++ b/svx/source/dialog/frmdirlbox.cxx @@ -71,34 +71,6 @@ SvxFrameDirection FrameDirectionListBox::GetSelectEntryValue() const return lclVoidToEnum( GetEntryData( nPos ) ); } - -FrameDirectionListBoxWrapper::FrameDirectionListBoxWrapper( FrameDirectionListBox& rListBox ) : - SingleControlWrapperType( rListBox ) -{ -} - -bool FrameDirectionListBoxWrapper::IsControlDontKnow() const -{ - return GetControl().GetSelectedEntryCount() == 0; -} - -void FrameDirectionListBoxWrapper::SetControlDontKnow( bool bSet ) -{ - if( bSet ) - GetControl().SetNoSelection(); -} - -SvxFrameDirection FrameDirectionListBoxWrapper::GetControlValue() const -{ - return GetControl().GetSelectEntryValue(); -} - -void FrameDirectionListBoxWrapper::SetControlValue( SvxFrameDirection eValue ) -{ - GetControl().SelectEntryValue( eValue ); -} - - } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/dialog/orienthelper.cxx b/svx/source/dialog/orienthelper.cxx index f69831c1d9e5..b8b4833c808b 100644 --- a/svx/source/dialog/orienthelper.cxx +++ b/svx/source/dialog/orienthelper.cxx @@ -149,34 +149,6 @@ void OrientationHelper::EnableStackedTriState( bool bEnable ) mpImpl->mrCbStacked.EnableTriState( bEnable ); } - -OrientStackedWrapper::OrientStackedWrapper( OrientationHelper& rOrientHlp ) : - SingleControlWrapperType( rOrientHlp ) -{ -} - -bool OrientStackedWrapper::IsControlDontKnow() const -{ - return GetControl().GetStackedState() == TRISTATE_INDET; -} - -void OrientStackedWrapper::SetControlDontKnow( bool bSet ) -{ - GetControl().EnableStackedTriState( bSet ); - GetControl().SetStackedState( bSet ? TRISTATE_INDET : TRISTATE_FALSE ); -} - -bool OrientStackedWrapper::GetControlValue() const -{ - return GetControl().GetStackedState() == TRISTATE_TRUE; -} - -void OrientStackedWrapper::SetControlValue( bool bValue ) -{ - GetControl().SetStackedState( bValue ? TRISTATE_TRUE : TRISTATE_FALSE ); -} - - } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |