diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2022-10-04 16:05:06 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2022-11-19 18:13:54 +0100 |
commit | 553cfbfc9e74a03fe02a58e9aa6076fc1dddeb7b (patch) | |
tree | a33fe5384144e737ff9f2527e9f4bd4a078f9fb9 /cui/source | |
parent | bac26f91ae930902c336b1e5ceb08e1ae5de8d8a (diff) |
Prepare the dialog for cell style editing
Change-Id: I54ec1486f49f240e1ab88662b9d1b0b741cf8878
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142905
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'cui/source')
-rw-r--r-- | cui/source/dialogs/sdrcelldlg.cxx | 43 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.cxx | 4 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.hxx | 2 | ||||
-rw-r--r-- | cui/source/inc/paragrph.hxx | 8 | ||||
-rw-r--r-- | cui/source/inc/sdrcelldlg.hxx | 2 | ||||
-rw-r--r-- | cui/source/tabpages/paragrph.cxx | 40 |
6 files changed, 86 insertions, 13 deletions
diff --git a/cui/source/dialogs/sdrcelldlg.cxx b/cui/source/dialogs/sdrcelldlg.cxx index fda8b4ce1385..3afbc0f694d3 100644 --- a/cui/source/dialogs/sdrcelldlg.cxx +++ b/cui/source/dialogs/sdrcelldlg.cxx @@ -21,10 +21,15 @@ #include <cuitabarea.hxx> #include <svx/svdmodel.hxx> #include <border.hxx> +#include <paragrph.hxx> +#include <svl/intitem.hxx> +#include <svl/cjkoptions.hxx> +#include <svx/flagsdef.hxx> +#include <svx/svxids.hrc> #include <svx/dialogs.hrc> -SvxFormatCellsDialog::SvxFormatCellsDialog(weld::Window* pParent, const SfxItemSet* pAttr, const SdrModel& rModel) - : SfxTabDialogController(pParent, "cui/ui/formatcellsdialog.ui", "FormatCellsDialog", pAttr) +SvxFormatCellsDialog::SvxFormatCellsDialog(weld::Window* pParent, const SfxItemSet* pAttr, const SdrModel& rModel, bool bStyle) + : SfxTabDialogController(pParent, "cui/ui/formatcellsdialog.ui", "FormatCellsDialog", pAttr, bStyle) , mrOutAttrs(*pAttr) , mpColorTab(rModel.GetColorList()) , mnColorTabState ( ChangeType::NONE ) @@ -37,7 +42,29 @@ SvxFormatCellsDialog::SvxFormatCellsDialog(weld::Window* pParent, const SfxItemS AddTabPage("effects", RID_SVXPAGE_CHAR_EFFECTS); AddTabPage("border", RID_SVXPAGE_BORDER ); AddTabPage("area", RID_SVXPAGE_AREA); - AddTabPage("shadow", SvxShadowTabPage::Create, nullptr); + + if (bStyle) + { + AddTabPage("position", RID_SVXPAGE_CHAR_POSITION); + AddTabPage("highlight", RID_SVXPAGE_BKG); + AddTabPage("indentspacing", RID_SVXPAGE_STD_PARAGRAPH); + AddTabPage("alignment", SvxParaAlignTabPage::Create, SvxParaAlignTabPage::GetSdrRanges); + RemoveTabPage("shadow"); + } + else + { + RemoveTabPage("position"); + RemoveTabPage("highlight"); + RemoveTabPage("indentspacing"); + RemoveTabPage("alignment"); + AddTabPage("shadow", SvxShadowTabPage::Create, nullptr); + RemoveStandardButton(); + } + + if (bStyle && SvtCJKOptions::IsAsianTypographyEnabled()) + AddTabPage("asian", RID_SVXPAGE_PARA_ASIAN); + else + RemoveTabPage("asian"); } void SvxFormatCellsDialog::PageCreated(const OString& rId, SfxTabPage &rPage) @@ -62,6 +89,16 @@ void SvxFormatCellsDialog::PageCreated(const OString& rId, SfxTabPage &rPage) static_cast<SvxShadowTabPage&>(rPage).SetColorList( mpColorTab ); static_cast<SvxShadowTabPage&>(rPage).SetColorChgd( &mnColorTabState ); } + else if (rId == "alignment") + { + static_cast<SvxParaAlignTabPage&>(rPage).EnableSdrVertAlign(); + } + else if (rId == "highlight") + { + SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); + aSet.Put(SfxUInt32Item(SID_FLAG_TYPE,static_cast<sal_uInt32>(SvxBackgroundTabFlags::SHOW_CHAR_BKGCOLOR))); + rPage.PageCreated(aSet); + } else SfxTabDialogController::PageCreated(rId, rPage); } diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index fb61dafcecbb..930452d64d09 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -1428,9 +1428,9 @@ VclPtr<SfxAbstractLinksDialog> AbstractDialogFactory_Impl::CreateLinksDialog(wel return VclPtr<AbstractLinksDialog_Impl>::Create(std::move(xLinkDlg)); } -VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateSvxFormatCellsDialog(weld::Window* pParent, const SfxItemSet* pAttr, const SdrModel& rModel) +VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateSvxFormatCellsDialog(weld::Window* pParent, const SfxItemSet* pAttr, const SdrModel& rModel, bool bStyle) { - return VclPtr<CuiAbstractTabController_Impl>::Create(std::make_shared<SvxFormatCellsDialog>(pParent, pAttr, rModel)); + return VclPtr<CuiAbstractTabController_Impl>::Create(std::make_shared<SvxFormatCellsDialog>(pParent, pAttr, rModel, bStyle)); } VclPtr<SvxAbstractSplitTableDialog> AbstractDialogFactory_Impl::CreateSvxSplitTableDialog(weld::Window* pParent, bool bIsTableVertical, tools::Long nMaxVertical) diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index 079af32b444c..1c60d075a3da 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -571,7 +571,7 @@ public: const sal_uInt16 _nInitiallySelectedEvent ) override; - virtual VclPtr<SfxAbstractTabDialog> CreateSvxFormatCellsDialog(weld::Window* pParent, const SfxItemSet* pAttr, const SdrModel& rModel) override; + virtual VclPtr<SfxAbstractTabDialog> CreateSvxFormatCellsDialog(weld::Window* pParent, const SfxItemSet* pAttr, const SdrModel& rModel, bool bStyle) override; virtual VclPtr<SvxAbstractSplitTableDialog> CreateSvxSplitTableDialog(weld::Window* pParent, bool bIsTableVertical, tools::Long nMaxVertical) override; diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx index 991641e3b06c..8f9147e12ded 100644 --- a/cui/source/inc/paragrph.hxx +++ b/cui/source/inc/paragrph.hxx @@ -121,7 +121,9 @@ public: class SvxParaAlignTabPage : public SfxTabPage { - static const WhichRangesContainer pAlignRanges; + static const WhichRangesContainer pAlignRanges, pSdrAlignRanges; + + bool m_bSdrVertAlign; SvxParaPrevWindow m_aExampleWin; @@ -144,6 +146,8 @@ class SvxParaAlignTabPage : public SfxTabPage //vertical alignment std::unique_ptr<weld::Widget> m_xVertAlignFL; std::unique_ptr<weld::ComboBox> m_xVertAlignLB; + std::unique_ptr<weld::Label> m_xVertAlign; + std::unique_ptr<weld::Label> m_xVertAlignSdr; std::unique_ptr<weld::Widget> m_xPropertiesFL; std::unique_ptr<svx::FrameDirectionListBox> m_xTextDirectionLB; @@ -164,12 +168,14 @@ public: virtual ~SvxParaAlignTabPage() override; static WhichRangesContainer GetRanges() { return pAlignRanges; } + static WhichRangesContainer GetSdrRanges() { return pSdrAlignRanges; } virtual bool FillItemSet( SfxItemSet* rSet ) override; virtual void Reset( const SfxItemSet* rSet ) override; virtual void ChangesApplied() override; void EnableJustifyExt(); + void EnableSdrVertAlign(); virtual void PageCreated(const SfxAllItemSet& aSet) override; }; diff --git a/cui/source/inc/sdrcelldlg.hxx b/cui/source/inc/sdrcelldlg.hxx index 5b7e9ca71a20..c8fcbf704095 100644 --- a/cui/source/inc/sdrcelldlg.hxx +++ b/cui/source/inc/sdrcelldlg.hxx @@ -38,7 +38,7 @@ private: XPatternListRef mpPatternList; public: - SvxFormatCellsDialog(weld::Window* pParent, const SfxItemSet* pAttr, const SdrModel& rModel); + SvxFormatCellsDialog(weld::Window* pParent, const SfxItemSet* pAttr, const SdrModel& rModel, bool bStyle); virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override; diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx index 78a1cdd178aa..bd2fa72bd388 100644 --- a/cui/source/tabpages/paragrph.cxx +++ b/cui/source/tabpages/paragrph.cxx @@ -25,6 +25,7 @@ #include <vcl/settings.hxx> #include <svx/flagsdef.hxx> #include <svx/svxids.hrc> +#include <svx/sdtaitm.hxx> #include <svl/cjkoptions.hxx> #include <editeng/pgrditem.hxx> @@ -60,6 +61,13 @@ const WhichRangesContainer SvxStdParagraphTabPage::pStdRanges( const WhichRangesContainer SvxParaAlignTabPage::pAlignRanges( svl::Items<SID_ATTR_PARA_ADJUST, SID_ATTR_PARA_ADJUST>); // 10027 +const WhichRangesContainer SvxParaAlignTabPage::pSdrAlignRanges( + svl::Items< + SDRATTR_TEXT_VERTADJUST, SDRATTR_TEXT_VERTADJUST, // 1076 + SID_ATTR_PARA_ADJUST, SID_ATTR_PARA_ADJUST , // 10027 + SID_ATTR_FRAMEDIRECTION, SID_ATTR_FRAMEDIRECTION // 10944 + >); + const WhichRangesContainer SvxExtParagraphTabPage::pExtRanges(svl::Items< SID_ATTR_PARA_PAGEBREAK, SID_ATTR_PARA_WIDOWS, // 10037 - 10041 SID_ATTR_PARA_MODEL, SID_ATTR_PARA_KEEP // 10065 - 10066 @@ -976,6 +984,7 @@ void SvxStdParagraphTabPage::PageCreated(const SfxAllItemSet& aSet) SvxParaAlignTabPage::SvxParaAlignTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet) : SfxTabPage(pPage, pController, "cui/ui/paragalignpage.ui", "ParaAlignPage", &rSet) + , m_bSdrVertAlign(false) , m_xLeft(m_xBuilder->weld_radio_button("radioBTN_LEFTALIGN")) , m_xRight(m_xBuilder->weld_radio_button("radioBTN_RIGHTALIGN")) , m_xCenter(m_xBuilder->weld_radio_button("radioBTN_CENTERALIGN")) @@ -989,6 +998,8 @@ SvxParaAlignTabPage::SvxParaAlignTabPage(weld::Container* pPage, weld::DialogCon , m_xExampleWin(new weld::CustomWeld(*m_xBuilder, "drawingareaWN_EXAMPLE", m_aExampleWin)) , m_xVertAlignFL(m_xBuilder->weld_widget("frameFL_VERTALIGN")) , m_xVertAlignLB(m_xBuilder->weld_combo_box("comboLB_VERTALIGN")) + , m_xVertAlign(m_xBuilder->weld_label("labelFL_VERTALIGN")) + , m_xVertAlignSdr(m_xBuilder->weld_label("labelST_VERTALIGN_SDR")) , m_xPropertiesFL(m_xBuilder->weld_widget("framePROPERTIES")) , m_xTextDirectionLB(new svx::FrameDirectionListBox(m_xBuilder->weld_combo_box("comboLB_TEXTDIRECTION"))) { @@ -1105,7 +1116,10 @@ bool SvxParaAlignTabPage::FillItemSet( SfxItemSet* rOutSet ) if (m_xVertAlignLB->get_value_changed_from_saved()) { - rOutSet->Put(SvxParaVertAlignItem(static_cast<SvxParaVertAlignItem::Align>(m_xVertAlignLB->get_active()), GetWhich( SID_PARA_VERTALIGN ))); + if (m_bSdrVertAlign) + rOutSet->Put(SdrTextVertAdjustItem(static_cast<SdrTextVertAdjust>(m_xVertAlignLB->get_active()))); + else + rOutSet->Put(SvxParaVertAlignItem(static_cast<SvxParaVertAlignItem::Align>(m_xVertAlignLB->get_active()), GetWhich( SID_PARA_VERTALIGN ))); bModified = true; } @@ -1191,16 +1205,23 @@ void SvxParaAlignTabPage::Reset( const SfxItemSet* rSet ) m_xSnapToGridCB->set_active(rSnap.GetValue()); } - _nWhich = GetWhich( SID_PARA_VERTALIGN ); + _nWhich = m_bSdrVertAlign ? SDRATTR_TEXT_VERTADJUST : GetWhich( SID_PARA_VERTALIGN ); eItemState = rSet->GetItemState( _nWhich ); if ( eItemState >= SfxItemState::DEFAULT ) { m_xVertAlignFL->show(); - const SvxParaVertAlignItem& rAlign = static_cast<const SvxParaVertAlignItem&>(rSet->Get( _nWhich )); - - m_xVertAlignLB->set_active(static_cast<sal_Int32>(rAlign.GetValue())); + if (m_bSdrVertAlign) + { + const SdrTextVertAdjustItem& rAlign = static_cast<const SdrTextVertAdjustItem&>(rSet->Get( _nWhich )); + m_xVertAlignLB->set_active(rAlign.GetValue()); + } + else + { + const SvxParaVertAlignItem& rAlign = static_cast<const SvxParaVertAlignItem&>(rSet->Get( _nWhich )); + m_xVertAlignLB->set_active(static_cast<sal_Int32>(rAlign.GetValue())); + } } _nWhich = GetWhich( SID_ATTR_FRAMEDIRECTION ); @@ -1330,6 +1351,15 @@ void SvxParaAlignTabPage::EnableJustifyExt() } +void SvxParaAlignTabPage::EnableSdrVertAlign() +{ + m_bSdrVertAlign = true; + + m_xVertAlignLB->remove_id("0"); + m_xVertAlignLB->remove_id("1"); + m_xVertAlign->set_label(m_xVertAlignSdr->get_label()); +} + void SvxParaAlignTabPage::PageCreated (const SfxAllItemSet& aSet) { const SfxBoolItem* pBoolItem = aSet.GetItem<SfxBoolItem>(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT, false); |