diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-10-13 21:39:00 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-10-14 20:18:41 +0200 |
commit | 2b9f23b9b8a62d82691233d789e830b3bde7b3da (patch) | |
tree | 786c9332f5bbfbc475c3eee80fdf5744e9deefbd | |
parent | 19be86249dcc5b13b3c95f5469600fa2bc1b749b (diff) |
weld SwFrameAddPage
Change-Id: Ia63e22d01c6bcc08f50d3e1b12943094660c7fd0
Reviewed-on: https://gerrit.libreoffice.org/61758
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
24 files changed, 261 insertions, 313 deletions
diff --git a/chart2/source/controller/dialogs/TextDirectionListBox.cxx b/chart2/source/controller/dialogs/TextDirectionListBox.cxx index b26350942f03..f0440155e9e6 100644 --- a/chart2/source/controller/dialogs/TextDirectionListBox.cxx +++ b/chart2/source/controller/dialogs/TextDirectionListBox.cxx @@ -28,7 +28,7 @@ namespace chart { TextDirectionListBox::TextDirectionListBox(std::unique_ptr<weld::ComboBox> pControl) - : svx::SvxFrameDirectionListBox(std::move(pControl)) + : svx::FrameDirectionListBox(std::move(pControl)) { append(SvxFrameDirection::Horizontal_LR_TB, SchResId(STR_TEXT_DIRECTION_LTR)); append(SvxFrameDirection::Horizontal_RL_TB, SchResId(STR_TEXT_DIRECTION_RTL)); diff --git a/chart2/source/controller/inc/TextDirectionListBox.hxx b/chart2/source/controller/inc/TextDirectionListBox.hxx index 83c64b541370..8f50065eedce 100644 --- a/chart2/source/controller/inc/TextDirectionListBox.hxx +++ b/chart2/source/controller/inc/TextDirectionListBox.hxx @@ -27,7 +27,7 @@ namespace vcl { class Window; } namespace chart { -class TextDirectionListBox : public svx::SvxFrameDirectionListBox +class TextDirectionListBox : public svx::FrameDirectionListBox { public: explicit TextDirectionListBox(std::unique_ptr<weld::ComboBox> pControl); diff --git a/cui/source/inc/align.hxx b/cui/source/inc/align.hxx index 5c96ec25aa30..1f5257e9d2c1 100644 --- a/cui/source/inc/align.hxx +++ b/cui/source/inc/align.hxx @@ -98,7 +98,7 @@ private: 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; + std::unique_ptr<svx::FrameDirectionListBox> m_xLbFrameDir; // hidden labels/string std::unique_ptr<weld::Label> m_xFtBotLock; diff --git a/cui/source/inc/page.hxx b/cui/source/inc/page.hxx index 69892a64f699..e6105af52c08 100644 --- a/cui/source/inc/page.hxx +++ b/cui/source/inc/page.hxx @@ -106,7 +106,7 @@ private: std::unique_ptr<weld::RadioButton> m_xPortraitBtn; std::unique_ptr<weld::RadioButton> m_xLandscapeBtn; std::unique_ptr<weld::Label> m_xTextFlowLbl; - std::unique_ptr<svx::SvxFrameDirectionListBox> m_xTextFlowBox; + std::unique_ptr<svx::FrameDirectionListBox> m_xTextFlowBox; std::unique_ptr<weld::ComboBox> m_xPaperTrayBox; // Margins std::unique_ptr<weld::Label> m_xLeftMarginLbl; diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx index b656f8d52b05..8acc4f4ea4bd 100644 --- a/cui/source/inc/paragrph.hxx +++ b/cui/source/inc/paragrph.hxx @@ -157,7 +157,7 @@ class SvxParaAlignTabPage : public SfxTabPage std::unique_ptr<weld::ComboBox> m_xVertAlignLB; std::unique_ptr<weld::Widget> m_xPropertiesFL; - std::unique_ptr<svx::SvxFrameDirectionListBox> m_xTextDirectionLB; + std::unique_ptr<svx::FrameDirectionListBox> m_xTextDirectionLB; DECL_LINK(AlignHdl_Impl, weld::ToggleButton&, void); DECL_LINK(LastLineHdl_Impl, weld::ComboBox&, void); diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx index 76581331f0a5..821e9abf875a 100644 --- a/cui/source/tabpages/align.cxx +++ b/cui/source/tabpages/align.cxx @@ -123,7 +123,7 @@ AlignmentTabPage::AlignmentTabPage(TabPageParent pParent, const SfxItemSet& rCor , 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"))) + , m_xLbFrameDir(new svx::FrameDirectionListBox(m_xBuilder->weld_combo_box("comboTextDirBox"))) //ValueSet hover strings , m_xFtBotLock(m_xBuilder->weld_label("labelSTR_BOTTOMLOCK")) , m_xFtTopLock(m_xBuilder->weld_label("labelSTR_TOPLOCK")) diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx index be2f6ff317f2..030e70a51eae 100644 --- a/cui/source/tabpages/page.cxx +++ b/cui/source/tabpages/page.cxx @@ -157,7 +157,7 @@ SvxPageDescPage::SvxPageDescPage(TabPageParent pParent, const SfxItemSet& rAttr) , m_xPortraitBtn(m_xBuilder->weld_radio_button("radiobuttonPortrait")) , m_xLandscapeBtn(m_xBuilder->weld_radio_button("radiobuttonLandscape")) , m_xTextFlowLbl(m_xBuilder->weld_label("labelTextFlow")) - , m_xTextFlowBox(new svx::SvxFrameDirectionListBox(m_xBuilder->weld_combo_box("comboTextFlowBox"))) + , m_xTextFlowBox(new svx::FrameDirectionListBox(m_xBuilder->weld_combo_box("comboTextFlowBox"))) , m_xPaperTrayBox(m_xBuilder->weld_combo_box("comboPaperTray")) , m_xLeftMarginLbl(m_xBuilder->weld_label("labelLeftMargin")) , m_xLeftMarginEdit(m_xBuilder->weld_metric_spin_button("spinMargLeft", FUNIT_CM)) diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx index ffb7e831e755..2b5572fd1874 100644 --- a/cui/source/tabpages/paragrph.cxx +++ b/cui/source/tabpages/paragrph.cxx @@ -1006,7 +1006,7 @@ SvxParaAlignTabPage::SvxParaAlignTabPage(TabPageParent pParent, const SfxItemSet , m_xVertAlignFL(m_xBuilder->weld_widget("frameFL_VERTALIGN")) , m_xVertAlignLB(m_xBuilder->weld_combo_box("comboLB_VERTALIGN")) , m_xPropertiesFL(m_xBuilder->weld_widget("framePROPERTIES")) - , m_xTextDirectionLB(new svx::SvxFrameDirectionListBox(m_xBuilder->weld_combo_box("comboLB_TEXTDIRECTION"))) + , m_xTextDirectionLB(new svx::FrameDirectionListBox(m_xBuilder->weld_combo_box("comboLB_TEXTDIRECTION"))) { SetExchangeSupport(); diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in index 3b365dbff79c..fffb76e04ed0 100644 --- a/extras/source/glade/libreoffice-catalog.xml.in +++ b/extras/source/glade/libreoffice-catalog.xml.in @@ -271,9 +271,6 @@ <glade-widget-class title="Assign Fields Control" name="swuilo-SwAssignFieldsControl" generic-name="Assign Fields Control" parent="GtkDrawingArea" icon-name="widget-gtk-drawingarea"/> - <glade-widget-class title="Frame Direction ListBox" name="svxlo-FrameDirectionListBox" - generic-name="FrameDirectionListBox" parent="GtkComboBox" - icon-name="widget-gtk-combobox"/> <glade-widget-class title="Chart Light Button" name="chartcontrollerlo-LightButton" generic-name="ChartLightButton" parent="GtkButton" icon-name="widget-gtk-button"/> diff --git a/include/svx/frmdirlbox.hxx b/include/svx/frmdirlbox.hxx index fcbeba468971..cb2e1452fbba 100644 --- a/include/svx/frmdirlbox.hxx +++ b/include/svx/frmdirlbox.hxx @@ -20,7 +20,6 @@ #ifndef INCLUDED_SVX_FRMDIRLBOX_HXX #define INCLUDED_SVX_FRMDIRLBOX_HXX -#include <vcl/lstbox.hxx> #include <vcl/weld.hxx> #include <editeng/frmdir.hxx> #include <svx/svxdllapi.h> @@ -29,39 +28,18 @@ class SvxFrameDirectionItem; namespace svx { - /** This listbox contains entries to select horizontal text direction. The control works on the SvxFrameDirection enumeration (i.e. left-to-right, right-to-left), used i.e. in conjunction with the SvxFrameDirectionItem. */ -class SAL_WARN_UNUSED SVX_DLLPUBLIC FrameDirectionListBox : public ListBox -{ -public: - explicit FrameDirectionListBox( vcl::Window* pParent, WinBits nBits ); - - /** Inserts a string with corresponding direction enum into the listbox. */ - void InsertEntryValue( - const OUString& rString, - SvxFrameDirection eDirection ); - - /** Selects the specified frame direction. */ - void SelectEntryValue( SvxFrameDirection eDirection ); - /** Returns the currently selected frame direction. */ - SvxFrameDirection GetSelectEntryValue() const; -}; - - -class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxFrameDirectionListBox +class SAL_WARN_UNUSED SVX_DLLPUBLIC FrameDirectionListBox { private: std::unique_ptr<weld::ComboBox> m_xControl; public: - explicit SvxFrameDirectionListBox(std::unique_ptr<weld::ComboBox> pControl) - : m_xControl(std::move(pControl)) - { - } - + explicit FrameDirectionListBox(std::unique_ptr<weld::ComboBox> pControl); + virtual ~FrameDirectionListBox(); bool get_visible() const { return m_xControl->get_visible(); } void save_value() { m_xControl->save_value(); } bool get_value_changed_from_saved() const { return m_xControl->get_value_changed_from_saved(); } diff --git a/include/vcl/combobox.hxx b/include/vcl/combobox.hxx index 890d5c1ceffc..9714aceccdcd 100644 --- a/include/vcl/combobox.hxx +++ b/include/vcl/combobox.hxx @@ -111,6 +111,11 @@ public: void SetSeparatorPos( sal_Int32 n ); + /** + * Adds a new separator at the given position n. + */ + void AddSeparator( sal_Int32 n ); + void EnableAutocomplete( bool bEnable, bool bMatchCase = false ); bool IsAutocompleteEnabled() const; diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index ec9c83c1b6fa..19aa23956bee 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -309,6 +309,8 @@ public: { insert(-1, rStr, &rId, nullptr, &rImage); } + virtual void insert_separator(int pos) = 0; + void append_separator() { insert_separator(-1); } virtual int get_count() const = 0; virtual void make_sorted() = 0; diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist index 24ee47bc52d7..2dcbc9d4d4cf 100644 --- a/solenv/clang-format/blacklist +++ b/solenv/clang-format/blacklist @@ -14210,7 +14210,6 @@ svx/source/dialog/fontlb.cxx svx/source/dialog/fontwork.cxx svx/source/dialog/framelink.cxx svx/source/dialog/framelinkarray.cxx -svx/source/dialog/frmdirlbox.cxx svx/source/dialog/frmsel.cxx svx/source/dialog/graphctl.cxx svx/source/dialog/grfflt.cxx diff --git a/svx/source/dialog/frmdirlbox.cxx b/svx/source/dialog/frmdirlbox.cxx index 5f15e23c5967..375a418671e2 100644 --- a/svx/source/dialog/frmdirlbox.cxx +++ b/svx/source/dialog/frmdirlbox.cxx @@ -18,59 +18,15 @@ */ #include <svx/frmdirlbox.hxx> -#include <vcl/builderfactory.hxx> -namespace svx { - -namespace { - -void* lclEnumToVoid( SvxFrameDirection eDirection ) -{ - return reinterpret_cast< void* >( static_cast< sal_uInt32 >( eDirection ) ); -} - -SvxFrameDirection lclVoidToEnum( void* pDirection ) -{ - return static_cast< SvxFrameDirection >( reinterpret_cast< sal_IntPtr >( pDirection ) ); -} - -} // namespace - -FrameDirectionListBox::FrameDirectionListBox( vcl::Window* pParent, WinBits nBits ) - : ListBox(pParent, nBits) -{ -} - -extern "C" SAL_DLLPUBLIC_EXPORT void makeFrameDirectionListBox(VclPtr<vcl::Window> & rRet, VclPtr<vcl::Window> & pParent, VclBuilder::stringmap &) -{ - VclPtrInstance<FrameDirectionListBox> pListBox(pParent, WB_LEFT|WB_DROPDOWN|WB_VCENTER|WB_3DLOOK|WB_TABSTOP); - pListBox->EnableAutoSize(true); - rRet = pListBox; -} - -void FrameDirectionListBox::InsertEntryValue( const OUString& rString, SvxFrameDirection eDirection ) +namespace svx { - sal_Int32 nRealPos = InsertEntry( rString ); - SetEntryData( nRealPos, lclEnumToVoid( eDirection ) ); -} - -void FrameDirectionListBox::SelectEntryValue( SvxFrameDirection eDirection ) -{ - sal_Int32 nPos = GetEntryPos( lclEnumToVoid( eDirection ) ); - if( nPos == LISTBOX_ENTRY_NOTFOUND ) - SetNoSelection(); - else - SelectEntryPos( nPos ); -} - -SvxFrameDirection FrameDirectionListBox::GetSelectEntryValue() const +FrameDirectionListBox::FrameDirectionListBox(std::unique_ptr<weld::ComboBox> pControl) + : m_xControl(std::move(pControl)) { - sal_Int32 nPos = GetSelectedEntryPos(); - if( nPos == LISTBOX_ENTRY_NOTFOUND ) - return static_cast< SvxFrameDirection >( 0xFFFF ); - return lclVoidToEnum( GetEntryData( nPos ) ); } +FrameDirectionListBox::~FrameDirectionListBox() {} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx index d7a327bc2dad..1888b02f0edf 100644 --- a/sw/source/ui/frmdlg/column.cxx +++ b/sw/source/ui/frmdlg/column.cxx @@ -402,7 +402,7 @@ SwColumnPage::SwColumnPage(TabPageParent pParent, const SfxItemSet &rSet) , m_xLinePosLbl(m_xBuilder->weld_label("lineposft")) , m_xLinePosDLB(m_xBuilder->weld_combo_box("lineposlb")) , m_xTextDirectionFT(m_xBuilder->weld_label("textdirectionft")) - , m_xTextDirectionLB(new svx::SvxFrameDirectionListBox(m_xBuilder->weld_combo_box("textdirectionlb"))) + , m_xTextDirectionLB(new svx::FrameDirectionListBox(m_xBuilder->weld_combo_box("textdirectionlb"))) , m_xLineColorDLB(new ColorListBox(m_xBuilder->weld_menu_button("colorlb"), pParent.GetFrameWeld())) , m_xLineTypeDLB(new SvtLineListBox(m_xBuilder->weld_menu_button("linestylelb"))) , m_xEd1(new SwPercentField(m_xBuilder->weld_metric_spin_button("width1mf", FUNIT_CM))) diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index 95433950dac3..68ceb2a4ea06 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -437,30 +437,29 @@ static size_t lcl_GetFrameMapCount( const FrameMap* pMap) return 0; } -static void lcl_InsertVectors(ListBox& rBox, +static void lcl_InsertVectors(weld::ComboBox& rBox, const std::vector< OUString >& rPrev, const std::vector< OUString >& rThis, const std::vector< OUString >& rNext, const std::vector< OUString >& rRemain) { std::vector< OUString >::const_iterator aIt; - sal_Int32 nEntry = 0; for(aIt = rPrev.begin(); aIt != rPrev.end(); ++aIt) - nEntry = rBox.InsertEntry(*aIt); + rBox.append_text(*aIt); for(aIt = rThis.begin(); aIt != rThis.end(); ++aIt) - nEntry = rBox.InsertEntry(*aIt); + rBox.append_text(*aIt); for(aIt = rNext.begin(); aIt != rNext.end(); ++aIt) - nEntry = rBox.InsertEntry(*aIt); - rBox.SetSeparatorPos(nEntry); + rBox.append_text(*aIt); + rBox.append_separator(); //now insert all strings sorted - const sal_Int32 nStartPos = rBox.GetEntryCount(); + const auto nStartPos = rBox.get_count(); for(aIt = rPrev.begin(); aIt != rPrev.end(); ++aIt) - ::InsertStringSorted(*aIt, rBox, nStartPos ); + ::InsertStringSorted("", *aIt, rBox, nStartPos ); for(aIt = rThis.begin(); aIt != rThis.end(); ++aIt) - ::InsertStringSorted(*aIt, rBox, nStartPos ); + ::InsertStringSorted("", *aIt, rBox, nStartPos ); for(aIt = rNext.begin(); aIt != rNext.end(); ++aIt) - ::InsertStringSorted(*aIt, rBox, nStartPos ); + ::InsertStringSorted("", *aIt, rBox, nStartPos ); for(aIt = rRemain.begin(); aIt != rRemain.end(); ++aIt) - ::InsertStringSorted(*aIt, rBox, nStartPos ); + ::InsertStringSorted("", *aIt, rBox, nStartPos ); } // --> OD 2009-08-31 #mongolianlayout# @@ -2877,46 +2876,41 @@ IMPL_LINK_NOARG(SwFrameURLPage, InsertFileHdl, Button*, void) } } -SwFrameAddPage::SwFrameAddPage(vcl::Window *pParent, const SfxItemSet &rSet) - : SfxTabPage(pParent, "FrameAddPage" , "modules/swriter/ui/frmaddpage.ui", &rSet) +SwFrameAddPage::SwFrameAddPage(TabPageParent pParent, const SfxItemSet &rSet) + : SfxTabPage(pParent, "modules/swriter/ui/frmaddpage.ui", "FrameAddPage", &rSet) , m_pWrtSh(nullptr) , m_bHtmlMode(false) , m_bFormat(false) , m_bNew(false) -{ - get(m_pNameFrame, "nameframe"); - get(m_pNameFT,"name_label"); - get(m_pNameED,"name"); - get(m_pAltNameFT,"altname_label"); - get(m_pAltNameED,"altname"); - get(m_pPrevFT,"prev_label"); - get(m_pPrevLB,"prev"); - get(m_pNextFT,"next_label"); - get(m_pNextLB,"next"); - get(m_pDescriptionFT, "description_label"); - get(m_pDescriptionED, "description"); - - get(m_pProtectFrame,"protect"); - get(m_pProtectContentCB,"protectcontent"); - get(m_pProtectFrameCB,"protectframe"); - get(m_pProtectSizeCB,"protectsize"); - - get(m_pContentAlignFrame, "contentalign"); - get(m_pVertAlignLB,"vertalign"); - - get(m_pPropertiesFrame,"properties"); - get(m_pEditInReadonlyCB,"editinreadonly"); - get(m_pPrintFrameCB,"printframe"); - get(m_pTextFlowFT,"textflow_label"); - get(m_pTextFlowLB,"textflow"); - - m_pTextFlowLB->InsertEntryValue( SvxResId( RID_SVXSTR_FRAMEDIR_LTR ), SvxFrameDirection::Horizontal_LR_TB ); - m_pTextFlowLB->InsertEntryValue( SvxResId( RID_SVXSTR_FRAMEDIR_RTL ), SvxFrameDirection::Horizontal_RL_TB ); - m_pTextFlowLB->InsertEntryValue( SvxResId( RID_SVXSTR_PAGEDIR_RTL_VERT ), SvxFrameDirection::Vertical_RL_TB ); - m_pTextFlowLB->InsertEntryValue( SvxResId( RID_SVXSTR_PAGEDIR_LTR_VERT ), SvxFrameDirection::Vertical_LR_TB ); - m_pTextFlowLB->InsertEntryValue( SvxResId( RID_SVXSTR_FRAMEDIR_SUPER ), SvxFrameDirection::Environment ); - - m_pDescriptionED->set_height_request(m_pDescriptionED->get_preferred_size().Height()); + , m_xNameFrame(m_xBuilder->weld_widget("nameframe")) + , m_xNameFT(m_xBuilder->weld_label("name_label")) + , m_xNameED(m_xBuilder->weld_entry("name")) + , m_xAltNameFT(m_xBuilder->weld_label("altname_label")) + , m_xAltNameED(m_xBuilder->weld_entry("altname")) + , m_xDescriptionFT(m_xBuilder->weld_label("description_label")) + , m_xDescriptionED(m_xBuilder->weld_entry("description")) + , m_xPrevFT(m_xBuilder->weld_label("prev_label")) + , m_xPrevLB(m_xBuilder->weld_combo_box("prev")) + , m_xNextFT(m_xBuilder->weld_label("next_label")) + , m_xNextLB(m_xBuilder->weld_combo_box("next")) + , m_xProtectFrame(m_xBuilder->weld_widget("protect")) + , m_xProtectContentCB(m_xBuilder->weld_check_button("protectcontent")) + , m_xProtectFrameCB(m_xBuilder->weld_check_button("protectframe")) + , m_xProtectSizeCB(m_xBuilder->weld_check_button("protectsize")) + , m_xContentAlignFrame(m_xBuilder->weld_widget("contentalign")) + , m_xVertAlignLB(m_xBuilder->weld_combo_box("vertalign")) + , m_xPropertiesFrame(m_xBuilder->weld_widget("properties")) + , m_xEditInReadonlyCB(m_xBuilder->weld_check_button("editinreadonly")) + , m_xPrintFrameCB(m_xBuilder->weld_check_button("printframe")) + , m_xTextFlowFT(m_xBuilder->weld_label("textflow_label")) + , m_xTextFlowLB(new svx::FrameDirectionListBox(m_xBuilder->weld_combo_box("textflow"))) +{ + m_xTextFlowLB->append(SvxFrameDirection::Horizontal_LR_TB, SvxResId(RID_SVXSTR_FRAMEDIR_LTR)); + m_xTextFlowLB->append(SvxFrameDirection::Horizontal_RL_TB, SvxResId(RID_SVXSTR_FRAMEDIR_RTL)); + m_xTextFlowLB->append(SvxFrameDirection::Vertical_RL_TB, SvxResId(RID_SVXSTR_PAGEDIR_RTL_VERT)); + m_xTextFlowLB->append(SvxFrameDirection::Vertical_LR_TB, SvxResId(RID_SVXSTR_PAGEDIR_LTR_VERT)); + m_xTextFlowLB->append(SvxFrameDirection::Environment, SvxResId(RID_SVXSTR_FRAMEDIR_SUPER)); + m_xDescriptionED->set_size_request(-1, m_xDescriptionED->get_preferred_size().Height()); } SwFrameAddPage::~SwFrameAddPage() @@ -2926,35 +2920,13 @@ SwFrameAddPage::~SwFrameAddPage() void SwFrameAddPage::dispose() { - m_pNameFrame.clear(); - m_pNameFT.clear(); - m_pNameED.clear(); - m_pAltNameFT.clear(); - m_pAltNameED.clear(); - m_pPrevFT.clear(); - m_pPrevLB.clear(); - m_pNextFT.clear(); - m_pNextLB.clear(); - m_pProtectFrame.clear(); - m_pProtectContentCB.clear(); - m_pProtectFrameCB.clear(); - m_pProtectSizeCB.clear(); - m_pContentAlignFrame.clear(); - m_pVertAlignLB.clear(); - m_pPropertiesFrame.clear(); - m_pEditInReadonlyCB.clear(); - m_pPrintFrameCB.clear(); - m_pTextFlowFT.clear(); - m_pTextFlowLB.clear(); - m_pDescriptionFT.clear(); - m_pDescriptionED.clear(); + m_xTextFlowLB.reset(); SfxTabPage::dispose(); } - VclPtr<SfxTabPage> SwFrameAddPage::Create(TabPageParent pParent, const SfxItemSet *rSet) { - return VclPtr<SwFrameAddPage>::Create(pParent.pParent, *rSet); + return VclPtr<SwFrameAddPage>::Create(pParent, *rSet); } void SwFrameAddPage::Reset(const SfxItemSet *rSet ) @@ -2964,30 +2936,30 @@ void SwFrameAddPage::Reset(const SfxItemSet *rSet ) m_bHtmlMode = (nHtmlMode & HTMLMODE_ON) != 0; if (m_bHtmlMode) { - m_pProtectFrame->Hide(); - m_pEditInReadonlyCB->Hide(); - m_pPrintFrameCB->Hide(); + m_xProtectFrame->hide(); + m_xEditInReadonlyCB->hide(); + m_xPrintFrameCB->hide(); } if (m_sDlgType == "PictureDialog" || m_sDlgType == "ObjectDialog") { - m_pEditInReadonlyCB->Hide(); + m_xEditInReadonlyCB->hide(); if (m_bHtmlMode) { - m_pPropertiesFrame->Hide(); + m_xPropertiesFrame->hide(); } - m_pContentAlignFrame->Hide(); + m_xContentAlignFrame->hide(); } if(SfxItemState::SET == rSet->GetItemState(FN_SET_FRM_ALT_NAME, false, &pItem)) { - m_pAltNameED->SetText(static_cast<const SfxStringItem*>(pItem)->GetValue()); - m_pAltNameED->SaveValue(); + m_xAltNameED->set_text(static_cast<const SfxStringItem*>(pItem)->GetValue()); + m_xAltNameED->save_value(); } if(SfxItemState::SET == rSet->GetItemState(FN_UNO_DESCRIPTION, false, &pItem)) { - m_pDescriptionED->SetText(static_cast<const SfxStringItem*>(pItem)->GetValue()); - m_pDescriptionED->SaveValue(); + m_xDescriptionED->set_text(static_cast<const SfxStringItem*>(pItem)->GetValue()); + m_xDescriptionED->save_value(); } if(!m_bFormat) @@ -3013,24 +2985,24 @@ void SwFrameAddPage::Reset(const SfxItemSet *rSet ) m_pWrtSh->SetFlyName(aTmpName1); } - m_pNameED->SetText( aTmpName1 ); - m_pNameED->SaveValue(); + m_xNameED->set_text( aTmpName1 ); + m_xNameED->save_value(); } else { - m_pNameED->Enable( false ); - m_pAltNameED->Enable(false); - m_pNameFT->Enable( false ); - m_pAltNameFT->Enable(false); + m_xNameED->set_sensitive( false ); + m_xAltNameED->set_sensitive(false); + m_xNameFT->set_sensitive( false ); + m_xAltNameFT->set_sensitive(false); } - if (m_sDlgType == "FrameDialog" && m_pAltNameFT->IsVisible()) + if (m_sDlgType == "FrameDialog" && m_xAltNameFT->get_visible()) { - m_pAltNameFT->Hide(); - m_pAltNameED->Hide(); + m_xAltNameFT->hide(); + m_xAltNameED->hide(); } else { - m_pNameED->SetModifyHdl(LINK(this, SwFrameAddPage, EditModifyHdl)); + m_xNameED->connect_changed(LINK(this, SwFrameAddPage, EditModifyHdl)); } if (!m_bNew) @@ -3058,15 +3030,17 @@ void SwFrameAddPage::Reset(const SfxItemSet *rSet ) std::vector< OUString > aRemainFrames; m_pWrtSh->GetConnectableFrameFormats(*pFormat, sNextChain, false, aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames ); - lcl_InsertVectors(*m_pPrevLB, aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames); + for (sal_Int32 nEntry = m_xPrevLB->get_count(); nEntry > 1; nEntry--) + m_xPrevLB->remove(nEntry - 1); + lcl_InsertVectors(*m_xPrevLB, aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames); if(!sPrevChain.isEmpty()) { - if(LISTBOX_ENTRY_NOTFOUND == m_pPrevLB->GetEntryPos(sPrevChain)) - m_pPrevLB->InsertEntry(sPrevChain, 1); - m_pPrevLB->SelectEntry(sPrevChain); + if (m_xPrevLB->find_text(sPrevChain) == -1) + m_xPrevLB->insert_text(1, sPrevChain); + m_xPrevLB->set_active_text(sPrevChain); } else - m_pPrevLB->SelectEntryPos(0); + m_xPrevLB->set_active(0); aPrevPageFrames.erase(aPrevPageFrames.begin(), aPrevPageFrames.end()); aNextPageFrames.erase(aNextPageFrames.begin(), aNextPageFrames.end()); aThisPageFrames.erase(aThisPageFrames.begin(), aThisPageFrames.end()); @@ -3074,58 +3048,58 @@ void SwFrameAddPage::Reset(const SfxItemSet *rSet ) m_pWrtSh->GetConnectableFrameFormats(*pFormat, sPrevChain, true, aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames ); - lcl_InsertVectors(*m_pNextLB, aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames); + for (sal_Int32 nEntry = m_xNextLB->get_count(); nEntry > 1; nEntry--) + m_xNextLB->remove(nEntry - 1); + lcl_InsertVectors(*m_xNextLB, aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames); if(!sNextChain.isEmpty()) { - if(LISTBOX_ENTRY_NOTFOUND == m_pNextLB->GetEntryPos(sNextChain)) - m_pNextLB->InsertEntry(sNextChain, 1); - m_pNextLB->SelectEntry(sNextChain); + if (m_xNextLB->find_text(sNextChain) == -1) + m_xNextLB->insert_text(1, sNextChain); + m_xNextLB->set_active_text(sNextChain); } else - m_pNextLB->SelectEntryPos(0); - Link<ListBox&,void> aLink(LINK(this, SwFrameAddPage, ChainModifyHdl)); - m_pPrevLB->SetSelectHdl(aLink); - m_pNextLB->SetSelectHdl(aLink); + m_xNextLB->set_active(0); + Link<weld::ComboBox&,void> aLink(LINK(this, SwFrameAddPage, ChainModifyHdl)); + m_xPrevLB->connect_changed(aLink); + m_xNextLB->connect_changed(aLink); } } // Pos Protected const SvxProtectItem& rProt = rSet->Get(RES_PROTECT); - m_pProtectFrameCB->Check(rProt.IsPosProtected()); - m_pProtectContentCB->Check(rProt.IsContentProtected()); - m_pProtectSizeCB->Check(rProt.IsSizeProtected()); + m_xProtectFrameCB->set_active(rProt.IsPosProtected()); + m_xProtectContentCB->set_active(rProt.IsContentProtected()); + m_xProtectSizeCB->set_active(rProt.IsSizeProtected()); const SwFormatEditInReadonly& rEdit = rSet->Get(RES_EDIT_IN_READONLY); - m_pEditInReadonlyCB->Check(rEdit.GetValue()); m_pEditInReadonlyCB->SaveValue(); + m_xEditInReadonlyCB->set_active(rEdit.GetValue()); + m_xEditInReadonlyCB->save_state(); // print const SvxPrintItem& rPrt = rSet->Get(RES_PRINT); - m_pPrintFrameCB->Check(rPrt.GetValue()); m_pPrintFrameCB->SaveValue(); + m_xPrintFrameCB->set_active(rPrt.GetValue()); + m_xPrintFrameCB->save_state(); // textflow if( (!m_bHtmlMode || (0 != (nHtmlMode&HTMLMODE_SOME_STYLES))) && m_sDlgType != "PictureDialog" && m_sDlgType != "ObjectDialog" && SfxItemState::UNKNOWN != rSet->GetItemState( RES_FRAMEDIR ) ) { - m_pTextFlowFT->Show(); - m_pTextFlowLB->Show(); + m_xTextFlowFT->show(); + m_xTextFlowLB->show(); //vertical text flow is not possible in HTML if(m_bHtmlMode) { - m_pTextFlowLB->RemoveEntry(m_pTextFlowLB->GetEntryPos(reinterpret_cast<void*>(SvxFrameDirection::Vertical_RL_TB))); + m_xTextFlowLB->remove_id(SvxFrameDirection::Vertical_RL_TB); } SvxFrameDirection nVal = rSet->Get(RES_FRAMEDIR).GetValue(); - sal_Int32 nPos; - for( nPos = m_pTextFlowLB->GetEntryCount(); nPos; ) - if( static_cast<SvxFrameDirection>(reinterpret_cast<sal_IntPtr>(m_pTextFlowLB->GetEntryData( --nPos ))) == nVal ) - break; - m_pTextFlowLB->SelectEntryPos( nPos ); - m_pTextFlowLB->SaveValue(); + m_xTextFlowLB->set_active_id(nVal); + m_xTextFlowLB->save_value(); } else { - m_pTextFlowFT->Hide(); - m_pTextFlowLB->Hide(); + m_xTextFlowFT->hide(); + m_xTextFlowLB->hide(); } // Content alignment @@ -3140,46 +3114,41 @@ void SwFrameAddPage::Reset(const SfxItemSet *rSet ) case SDRTEXTVERTADJUST_BLOCK: nPos = 1; break; case SDRTEXTVERTADJUST_BOTTOM: nPos = 2; break; } - m_pVertAlignLB->SelectEntryPos(nPos); + m_xVertAlignLB->set_active(nPos); } - m_pVertAlignLB->SaveValue(); + m_xVertAlignLB->save_value(); } bool SwFrameAddPage::FillItemSet(SfxItemSet *rSet) { bool bRet = false; - if (m_pNameED->IsValueChangedFromSaved()) - bRet |= nullptr != rSet->Put(SfxStringItem(FN_SET_FRM_NAME, m_pNameED->GetText())); - if (m_pAltNameED->IsValueChangedFromSaved()) - bRet |= nullptr != rSet->Put(SfxStringItem(FN_SET_FRM_ALT_NAME, m_pAltNameED->GetText())); - if (m_pDescriptionED->IsValueChangedFromSaved()) - bRet |= nullptr != rSet->Put(SfxStringItem(FN_UNO_DESCRIPTION, m_pDescriptionED->GetText())); + if (m_xNameED->get_value_changed_from_saved()) + bRet |= nullptr != rSet->Put(SfxStringItem(FN_SET_FRM_NAME, m_xNameED->get_text())); + if (m_xAltNameED->get_value_changed_from_saved()) + bRet |= nullptr != rSet->Put(SfxStringItem(FN_SET_FRM_ALT_NAME, m_xAltNameED->get_text())); + if (m_xDescriptionED->get_value_changed_from_saved()) + bRet |= nullptr != rSet->Put(SfxStringItem(FN_UNO_DESCRIPTION, m_xDescriptionED->get_text())); const SfxPoolItem* pOldItem; SvxProtectItem aProt ( GetItemSet().Get(RES_PROTECT) ); - aProt.SetContentProtect( m_pProtectContentCB->IsChecked() ); - aProt.SetSizeProtect ( m_pProtectSizeCB->IsChecked() ); - aProt.SetPosProtect ( m_pProtectFrameCB->IsChecked() ); + aProt.SetContentProtect( m_xProtectContentCB->get_active() ); + aProt.SetSizeProtect ( m_xProtectSizeCB->get_active() ); + aProt.SetPosProtect ( m_xProtectFrameCB->get_active() ); if ( nullptr == (pOldItem = GetOldItem(*rSet, FN_SET_PROTECT)) || aProt != *pOldItem ) bRet |= nullptr != rSet->Put( aProt); - if ( m_pEditInReadonlyCB->IsValueChangedFromSaved() ) - bRet |= nullptr != rSet->Put( SwFormatEditInReadonly( RES_EDIT_IN_READONLY, m_pEditInReadonlyCB->IsChecked())); + if ( m_xEditInReadonlyCB->get_state_changed_from_saved() ) + bRet |= nullptr != rSet->Put( SwFormatEditInReadonly( RES_EDIT_IN_READONLY, m_xEditInReadonlyCB->get_active())); - if ( m_pPrintFrameCB->IsValueChangedFromSaved() ) - bRet |= nullptr != rSet->Put( SvxPrintItem( RES_PRINT, m_pPrintFrameCB->IsChecked())); + if ( m_xPrintFrameCB->get_state_changed_from_saved() ) + bRet |= nullptr != rSet->Put( SvxPrintItem( RES_PRINT, m_xPrintFrameCB->get_active())); // textflow - if( m_pTextFlowLB->IsVisible() ) + if (m_xTextFlowLB->get_visible() && m_xTextFlowLB->get_value_changed_from_saved()) { - sal_Int32 nPos = m_pTextFlowLB->GetSelectedEntryPos(); - if( m_pTextFlowLB->IsValueChangedFromSaved() ) - { - SvxFrameDirection eDirection = static_cast<SvxFrameDirection>( - reinterpret_cast<sal_IntPtr>(m_pTextFlowLB->GetEntryData( nPos ))); - bRet |= nullptr != rSet->Put( SvxFrameDirectionItem(eDirection, RES_FRAMEDIR )); - } + SvxFrameDirection eDirection = m_xTextFlowLB->get_active_id(); + bRet |= nullptr != rSet->Put( SvxFrameDirectionItem(eDirection, RES_FRAMEDIR )); } if(m_pWrtSh) { @@ -3187,10 +3156,10 @@ bool SwFrameAddPage::FillItemSet(SfxItemSet *rSet) if (pFormat) { OUString sCurrentPrevChain, sCurrentNextChain; - if(m_pPrevLB->GetSelectedEntryPos()) - sCurrentPrevChain = m_pPrevLB->GetSelectedEntry(); - if(m_pNextLB->GetSelectedEntryPos()) - sCurrentNextChain = m_pNextLB->GetSelectedEntry(); + if (m_xPrevLB->get_active()) + sCurrentPrevChain = m_xPrevLB->get_active_text(); + if (m_xNextLB->get_active()) + sCurrentNextChain = m_xNextLB->get_active_text(); const SwFormatChain &rChain = pFormat->GetChain(); const SwFlyFrameFormat* pFlyFormat; OUString sNextChain, sPrevChain; @@ -3206,10 +3175,10 @@ bool SwFrameAddPage::FillItemSet(SfxItemSet *rSet) } } - if(m_pVertAlignLB->IsValueChangedFromSaved()) + if (m_xVertAlignLB->get_value_changed_from_saved()) { SdrTextVertAdjust nAdjust; - switch(m_pVertAlignLB->GetSelectedEntryPos()) + switch (m_xVertAlignLB->get_active()) { default: case 0 : nAdjust = SDRTEXTVERTADJUST_TOP; break; @@ -3222,11 +3191,11 @@ bool SwFrameAddPage::FillItemSet(SfxItemSet *rSet) return bRet; } -IMPL_LINK_NOARG(SwFrameAddPage, EditModifyHdl, Edit&, void) +IMPL_LINK_NOARG(SwFrameAddPage, EditModifyHdl, weld::Entry&, void) { - bool bEnable = !m_pNameED->GetText().isEmpty(); - m_pAltNameED->Enable(bEnable); - m_pAltNameFT->Enable(bEnable); + bool bEnable = !m_xNameED->get_text().isEmpty(); + m_xAltNameED->set_sensitive(bEnable); + m_xAltNameFT->set_sensitive(bEnable); } void SwFrameAddPage::SetFormatUsed(bool bFormatUsed) @@ -3234,25 +3203,25 @@ void SwFrameAddPage::SetFormatUsed(bool bFormatUsed) m_bFormat = bFormatUsed; if (m_bFormat) { - m_pNameFrame->Hide(); + m_xNameFrame->hide(); } } -IMPL_LINK(SwFrameAddPage, ChainModifyHdl, ListBox&, rBox, void) +IMPL_LINK(SwFrameAddPage, ChainModifyHdl, weld::ComboBox&, rBox, void) { OUString sCurrentPrevChain, sCurrentNextChain; - if(m_pPrevLB->GetSelectedEntryPos()) - sCurrentPrevChain = m_pPrevLB->GetSelectedEntry(); - if(m_pNextLB->GetSelectedEntryPos()) - sCurrentNextChain = m_pNextLB->GetSelectedEntry(); + if (m_xPrevLB->get_active()) + sCurrentPrevChain = m_xPrevLB->get_active_text(); + if (m_xNextLB->get_active()) + sCurrentNextChain = m_xNextLB->get_active_text(); SwFrameFormat* pFormat = m_pWrtSh->GetFlyFrameFormat(); if (!pFormat) return; - bool bNextBox = m_pNextLB == &rBox; - ListBox& rChangeLB = bNextBox ? *m_pPrevLB : *m_pNextLB; - for(sal_Int32 nEntry = rChangeLB.GetEntryCount(); nEntry > 1; nEntry--) - rChangeLB.RemoveEntry(nEntry - 1); + bool bNextBox = m_xNextLB.get() == &rBox; + weld::ComboBox& rChangeLB = bNextBox ? *m_xPrevLB : *m_xNextLB; + for (sal_Int32 nEntry = rChangeLB.get_count(); nEntry > 1; nEntry--) + rChangeLB.remove(nEntry - 1); //determine chainable frames std::vector< OUString > aPrevPageFrames; std::vector< OUString > aThisPageFrames; @@ -3263,10 +3232,10 @@ IMPL_LINK(SwFrameAddPage, ChainModifyHdl, ListBox&, rBox, void) lcl_InsertVectors(rChangeLB, aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames); const OUString sToSelect = bNextBox ? sCurrentPrevChain : sCurrentNextChain; - if(rChangeLB.GetEntryPos(sToSelect) != LISTBOX_ENTRY_NOTFOUND) - rChangeLB.SelectEntry(sToSelect); + if (rChangeLB.find_text(sToSelect) != -1) + rChangeLB.set_active_text(sToSelect); else - rChangeLB.SelectEntryPos(0); + rChangeLB.set_active(0); } diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx index 13423f5899ba..a2943bdfef65 100644 --- a/sw/source/ui/table/tabledlg.cxx +++ b/sw/source/ui/table/tabledlg.cxx @@ -88,7 +88,7 @@ SwFormatTablePage::SwFormatTablePage(TabPageParent pParent, const SfxItemSet& rS , m_xTopMF(m_xBuilder->weld_metric_spin_button("abovemf", FUNIT_CM)) , m_xBottomFT(m_xBuilder->weld_label("belowft")) , m_xBottomMF(m_xBuilder->weld_metric_spin_button("belowmf", FUNIT_CM)) - , m_xTextDirectionLB(new svx::SvxFrameDirectionListBox(m_xBuilder->weld_combo_box("textdirection"))) + , m_xTextDirectionLB(new svx::FrameDirectionListBox(m_xBuilder->weld_combo_box("textdirection"))) , m_xProperties(m_xBuilder->weld_widget("properties")) { //lock these to initial sizes so they don't change on percent to non percent change diff --git a/sw/source/uibase/inc/column.hxx b/sw/source/uibase/inc/column.hxx index 7f6f4b0478af..0abff25b0f2f 100644 --- a/sw/source/uibase/inc/column.hxx +++ b/sw/source/uibase/inc/column.hxx @@ -128,7 +128,7 @@ class SwColumnPage : public SfxTabPage std::unique_ptr<weld::Label> m_xLinePosLbl; std::unique_ptr<weld::ComboBox> m_xLinePosDLB; std::unique_ptr<weld::Label> m_xTextDirectionFT; - std::unique_ptr<svx::SvxFrameDirectionListBox> m_xTextDirectionLB; + std::unique_ptr<svx::FrameDirectionListBox> m_xTextDirectionLB; std::unique_ptr<ColorListBox> m_xLineColorDLB; std::unique_ptr<SvtLineListBox> m_xLineTypeDLB; std::unique_ptr<SwPercentField> m_xEd1; diff --git a/sw/source/uibase/inc/frmpage.hxx b/sw/source/uibase/inc/frmpage.hxx index 2388f01f30d1..377101b6232b 100644 --- a/sw/source/uibase/inc/frmpage.hxx +++ b/sw/source/uibase/inc/frmpage.hxx @@ -281,32 +281,6 @@ public: class SwFrameAddPage : public SfxTabPage { - VclPtr<VclContainer> m_pNameFrame; - VclPtr<FixedText> m_pNameFT; - VclPtr<Edit> m_pNameED; - VclPtr<FixedText> m_pAltNameFT; - VclPtr<Edit> m_pAltNameED; - VclPtr<FixedText> m_pDescriptionFT; - VclPtr<Edit> m_pDescriptionED; - VclPtr<FixedText> m_pPrevFT; - VclPtr<ListBox> m_pPrevLB; - VclPtr<FixedText> m_pNextFT; - VclPtr<ListBox> m_pNextLB; - - VclPtr<VclContainer> m_pProtectFrame; - VclPtr<CheckBox> m_pProtectContentCB; - VclPtr<CheckBox> m_pProtectFrameCB; - VclPtr<CheckBox> m_pProtectSizeCB; - - VclPtr<VclContainer> m_pContentAlignFrame; - VclPtr<ListBox> m_pVertAlignLB; - - VclPtr<VclContainer> m_pPropertiesFrame; - VclPtr<CheckBox> m_pEditInReadonlyCB; - VclPtr<CheckBox> m_pPrintFrameCB; - VclPtr<FixedText> m_pTextFlowFT; - VclPtr<svx::FrameDirectionListBox> m_pTextFlowLB; - SwWrtShell* m_pWrtSh; OUString m_sDlgType; @@ -314,13 +288,39 @@ class SwFrameAddPage : public SfxTabPage bool m_bFormat; bool m_bNew; - DECL_LINK(EditModifyHdl, Edit&, void); - DECL_LINK(ChainModifyHdl, ListBox&, void); + std::unique_ptr<weld::Widget> m_xNameFrame; + std::unique_ptr<weld::Label> m_xNameFT; + std::unique_ptr<weld::Entry> m_xNameED; + std::unique_ptr<weld::Label> m_xAltNameFT; + std::unique_ptr<weld::Entry> m_xAltNameED; + std::unique_ptr<weld::Label> m_xDescriptionFT; + std::unique_ptr<weld::Entry> m_xDescriptionED; + std::unique_ptr<weld::Label> m_xPrevFT; + std::unique_ptr<weld::ComboBox> m_xPrevLB; + std::unique_ptr<weld::Label> m_xNextFT; + std::unique_ptr<weld::ComboBox> m_xNextLB; + + std::unique_ptr<weld::Widget> m_xProtectFrame; + std::unique_ptr<weld::CheckButton> m_xProtectContentCB; + std::unique_ptr<weld::CheckButton> m_xProtectFrameCB; + std::unique_ptr<weld::CheckButton> m_xProtectSizeCB; + + std::unique_ptr<weld::Widget> m_xContentAlignFrame; + std::unique_ptr<weld::ComboBox> m_xVertAlignLB; + + std::unique_ptr<weld::Widget> m_xPropertiesFrame; + std::unique_ptr<weld::CheckButton> m_xEditInReadonlyCB; + std::unique_ptr<weld::CheckButton> m_xPrintFrameCB; + std::unique_ptr<weld::Label> m_xTextFlowFT; + std::unique_ptr<svx::FrameDirectionListBox> m_xTextFlowLB; + + DECL_LINK(EditModifyHdl, weld::Entry&, void); + DECL_LINK(ChainModifyHdl, weld::ComboBox&, void); static const sal_uInt16 aAddPgRg[]; public: - SwFrameAddPage(vcl::Window *pParent, const SfxItemSet &rSet); + SwFrameAddPage(TabPageParent pParent, const SfxItemSet &rSet); virtual ~SwFrameAddPage() override; virtual void dispose() override; diff --git a/sw/source/uibase/table/tablepg.hxx b/sw/source/uibase/table/tablepg.hxx index ad939bc635dd..4a5937d95c1b 100644 --- a/sw/source/uibase/table/tablepg.hxx +++ b/sw/source/uibase/table/tablepg.hxx @@ -66,7 +66,7 @@ class SwFormatTablePage : public SfxTabPage std::unique_ptr<weld::Label> m_xBottomFT; std::unique_ptr<weld::MetricSpinButton> m_xBottomMF; - std::unique_ptr<svx::SvxFrameDirectionListBox> m_xTextDirectionLB; + std::unique_ptr<svx::FrameDirectionListBox> m_xTextDirectionLB; std::unique_ptr<weld::Widget> m_xProperties; void Init(); diff --git a/sw/uiconfig/swriter/ui/frmaddpage.ui b/sw/uiconfig/swriter/ui/frmaddpage.ui index b6e8a278f6c1..31bedebd2325 100644 --- a/sw/uiconfig/swriter/ui/frmaddpage.ui +++ b/sw/uiconfig/swriter/ui/frmaddpage.ui @@ -1,29 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.0 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sw"> <requires lib="gtk+" version="3.18"/> - <object class="GtkListStore" id="liststore"> - <columns> - <!-- column-name gchararray1 --> - <column type="gchararray"/> - <!-- column-name gint1 --> - <column type="gint"/> - </columns> - <data> - <row> - <col id="0" translatable="yes" context="frmaddpage|liststore">Top</col> - <col id="1">0</col> - </row> - <row> - <col id="0" translatable="yes" context="frmaddpage|liststore">Centered</col> - <col id="1">1</col> - </row> - <row> - <col id="0" translatable="yes" context="frmaddpage|liststore">Bottom</col> - <col id="1">2</col> - </row> - </data> - </object> <object class="GtkTextBuffer" id="textbuffer1"> <property name="text"> @@ -64,6 +42,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="halign">start</property> + <property name="activates_default">True</property> <property name="width_chars">50</property> </object> <packing> @@ -76,6 +55,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="halign">start</property> + <property name="activates_default">True</property> <property name="width_chars">50</property> </object> <packing> @@ -173,7 +153,7 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="frmaddpage|description_label">_Description:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">description:border</property> + <property name="mnemonic_widget">description</property> <property name="xalign">0</property> </object> <packing> @@ -187,7 +167,7 @@ <property name="can_focus">True</property> <property name="shadow_type">in</property> <child> - <object class="GtkTextView" id="description:border"> + <object class="GtkTextView" id="description"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="wrap_mode">word</property> @@ -256,10 +236,14 @@ </packing> </child> <child> - <object class="GtkComboBox" id="vertalign"> + <object class="GtkComboBoxText" id="vertalign"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="model">liststore</property> + <items> + <item id="0" translatable="yes" context="frmaddpage|liststore">Top</item> + <item id="1" translatable="yes" context="frmaddpage|liststore">Centered</item> + <item id="2" translatable="yes" context="frmaddpage|liststore">Bottom</item> + </items> </object> <packing> <property name="left_attach">1</property> @@ -457,9 +441,9 @@ </packing> </child> <child> - <object class="svxlo-FrameDirectionListBox" id="textflow"> - <property name="can_focus">False</property> + <object class="GtkComboBoxText" id="textflow"> <property name="visible">True</property> + <property name="can_focus">False</property> </object> <packing> <property name="left_attach">1</property> diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index ffae3928610e..aed6316810e9 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -2399,6 +2399,12 @@ public: m_xComboBox->SetEntryData(nInsertedAt, new OUString(*pId)); } + virtual void insert_separator(int pos) override + { + auto nInsertPos = pos == -1 ? m_xComboBox->GetEntryCount() : pos; + m_xComboBox->AddSeparator(nInsertPos - 1); + } + virtual bool has_entry() const override { return false; @@ -2496,6 +2502,12 @@ public: m_xComboBox->SetEntryData(nInsertedAt, new OUString(*pId)); } + virtual void insert_separator(int pos) override + { + auto nInsertPos = pos == -1 ? m_xComboBox->GetEntryCount() : pos; + m_xComboBox->AddSeparator(nInsertPos - 1); + } + virtual void set_entry_text(const OUString& rText) override { m_xComboBox->SetText(rText); @@ -2562,6 +2574,11 @@ public: rEntry.AddEventListener(LINK(this, SalInstanceEntryTreeView, KeyPressListener)); } + virtual void insert_separator(int /*pos*/) override + { + assert(false); + } + virtual void make_sorted() override { vcl::Window *pTreeView = m_pTreeView->getWidget(); diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index f114df9deaa7..03a2946417b2 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -1294,6 +1294,11 @@ void ComboBox::SetSeparatorPos( sal_Int32 n ) m_pImpl->m_pImplLB->SetSeparatorPos( n ); } +void ComboBox::AddSeparator( sal_Int32 n ) +{ + m_pImpl->m_pImplLB->AddSeparator( n ); +} + void ComboBox::SetMRUEntries( const OUString& rEntries ) { m_pImpl->m_pImplLB->SetMRUEntries( rEntries, ';' ); diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 7caca86815a7..dd69aad8ad98 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -4833,6 +4833,7 @@ private: GtkMenu* m_pMenu; std::unique_ptr<comphelper::string::NaturalStringSorter> m_xSorter; vcl::QuickSelectionEngine m_aQuickSelectionEngine; + std::vector<int> m_aSeparatorRows; gboolean m_bPopupActive; gulong m_nChangedSignalId; gulong m_nPopupShownSignalId; @@ -4940,6 +4941,20 @@ private: g_object_unref(pCompletion); } + bool separator_function(int nIndex) + { + return std::find(m_aSeparatorRows.begin(), m_aSeparatorRows.end(), nIndex) != m_aSeparatorRows.end(); + } + + static gboolean separatorFunction(GtkTreeModel* pTreeModel, GtkTreeIter* pIter, gpointer widget) + { + GtkInstanceComboBox* pThis = static_cast<GtkInstanceComboBox*>(widget); + GtkTreePath* path = gtk_tree_model_get_path(pTreeModel, pIter); + int nIndex = gtk_tree_path_get_indices(path)[0]; + gtk_tree_path_free(path); + return pThis->separator_function(nIndex); + } + // in the absence of a built-in solution for https://gitlab.gnome.org/GNOME/gtk/issues/310 // a) support typeahead for the case where there is no entry widget, typing ahead // into the button itself will select via the vcl selection engine, a matching @@ -5237,6 +5252,7 @@ public: GtkTreeIter iter; gtk_tree_model_iter_nth_child(m_pTreeModel, &iter, nullptr, pos); gtk_list_store_remove(GTK_LIST_STORE(m_pTreeModel), &iter); + m_aSeparatorRows.erase(std::remove(m_aSeparatorRows.begin(), m_aSeparatorRows.end(), pos), m_aSeparatorRows.end()); enable_notify_events(); bodge_wayland_menu_not_appearing(); } @@ -5250,6 +5266,19 @@ public: bodge_wayland_menu_not_appearing(); } + virtual void insert_separator(int pos) override + { + disable_notify_events(); + GtkTreeIter iter; + pos = pos == -1 ? get_count() : pos; + m_aSeparatorRows.push_back(pos); + if (!gtk_combo_box_get_row_separator_func(m_pComboBox)) + gtk_combo_box_set_row_separator_func(m_pComboBox, separatorFunction, this, nullptr); + insert_row(GTK_LIST_STORE(m_pTreeModel), iter, pos, nullptr, "", nullptr, nullptr); + enable_notify_events(); + bodge_wayland_menu_not_appearing(); + } + virtual int get_count() const override { return gtk_tree_model_iter_n_children(m_pTreeModel, nullptr); @@ -5269,6 +5298,8 @@ public: { disable_notify_events(); gtk_list_store_clear(GTK_LIST_STORE(m_pTreeModel)); + m_aSeparatorRows.clear(); + gtk_combo_box_set_row_separator_func(m_pComboBox, nullptr, nullptr, nullptr); enable_notify_events(); bodge_wayland_menu_not_appearing(); } @@ -5456,6 +5487,11 @@ public: m_nKeyPressSignalId = g_signal_connect(pWidget, "key-press-event", G_CALLBACK(signalKeyPress), this); } + virtual void insert_separator(int /*pos*/) override + { + assert(false); + } + virtual void make_sorted() override { GtkWidget* pTreeView = m_pTreeView->getWidget(); |