diff options
-rw-r--r-- | include/svx/strings.hrc | 6 | ||||
-rw-r--r-- | svx/UIConfig_svx.mk | 1 | ||||
-rw-r--r-- | svx/inc/bitmaps.hlst | 6 | ||||
-rw-r--r-- | svx/source/tbxctrls/fontworkgallery.cxx | 118 | ||||
-rw-r--r-- | svx/uiconfig/ui/fontworkalignmentcontrol.ui | 134 | ||||
-rw-r--r-- | svx/uiconfig/ui/fontworkcharacterspacingcontrol.ui | 7 |
6 files changed, 216 insertions, 56 deletions
diff --git a/include/svx/strings.hrc b/include/svx/strings.hrc index a0cb6e11ed14..0c4d78465364 100644 --- a/include/svx/strings.hrc +++ b/include/svx/strings.hrc @@ -1005,12 +1005,6 @@ #define RID_GALLERYSTR_THEME_TROUBLE NC_("RID_GALLERYSTR_THEME_TROUBLE", "Problem Solving") #define RID_GALLERYSTR_THEME_SCREENBEANS NC_("RID_GALLERYSTR_THEME_SCREENBEANS", "Screen Beans") -#define RID_SVXSTR_ALIGN_LEFT NC_("RID_SVXSTR_ALIGN_LEFT", "~Left Align") -#define RID_SVXSTR_ALIGN_CENTER NC_("RID_SVXSTR_ALIGN_CENTER", "~Center") -#define RID_SVXSTR_ALIGN_RIGHT NC_("RID_SVXSTR_ALIGN_RIGHT", "~Right Align") -#define RID_SVXSTR_ALIGN_WORD NC_("RID_SVXSTR_ALIGN_WORD", "~Word Justify") -#define RID_SVXSTR_ALIGN_STRETCH NC_("RID_SVXSTR_ALIGN_STRETCH", "S~tretch Justify") - #define RID_SVXSTR_QRY_PRINT_TITLE NC_("RID_SVXSTR_QRY_PRINT_TITLE", "Printing selection") #define RID_SVXSTR_QRY_PRINT_MSG NC_("RID_SVXSTR_QRY_PRINT_MSG", "Do you want to print the selection or the entire document?") #define RID_SVXSTR_QRY_PRINT_ALL NC_("RID_SVXSTR_QRY_PRINT_ALL", "~All") diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk index 07be2bf6a62a..bf3d64b015cf 100644 --- a/svx/UIConfig_svx.mk +++ b/svx/UIConfig_svx.mk @@ -55,6 +55,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\ svx/uiconfig/ui/floatinglineproperty \ svx/uiconfig/ui/floatinglinestyle \ svx/uiconfig/ui/floatingundoredo \ + svx/uiconfig/ui/fontworkalignmentcontrol \ svx/uiconfig/ui/fontworkcharacterspacingcontrol \ svx/uiconfig/ui/fontworkgallerydialog \ svx/uiconfig/ui/fontworkspacingdialog \ diff --git a/svx/inc/bitmaps.hlst b/svx/inc/bitmaps.hlst index 9078184c6ee7..fdb60807e47d 100644 --- a/svx/inc/bitmaps.hlst +++ b/svx/inc/bitmaps.hlst @@ -259,12 +259,6 @@ #define BMP_MARKER_RECTPLUS11_5 "svx/res/marker-rectplus11-5.png" #define BMP_MARKER_RECTPLUS11_6 "svx/res/marker-rectplus11-6.png" -#define RID_SVXBMP_FONTWORK_ALIGN_LEFT "svx/res/fontworkalignleft_16.png" -#define RID_SVXBMP_FONTWORK_ALIGN_CENTER "svx/res/fontworkaligncentered_16.png" -#define RID_SVXBMP_FONTWORK_ALIGN_RIGHT "svx/res/fontworkalignright_16.png" -#define RID_SVXBMP_FONTWORK_ALIGN_WORD "svx/res/fontworkalignjustified_16.png" -#define RID_SVXBMP_FONTWORK_ALIGN_STRETCH "svx/res/fontworkalignstretch_16.png" - /* * Bitmaps for SvxFrameWindow */ diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx index ecd9588d321c..fb191fec46c2 100644 --- a/svx/source/tbxctrls/fontworkgallery.cxx +++ b/svx/source/tbxctrls/fontworkgallery.cxx @@ -54,8 +54,6 @@ #include <bitmaps.hlst> -using ::svtools::ToolbarMenu; - using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; @@ -265,17 +263,26 @@ IMPL_LINK_NOARG(FontWorkGalleryDialog, DoubleClickFavoriteHdl, SvtValueSet*, voi namespace { -class FontworkAlignmentWindow : public ToolbarMenu +class FontworkAlignmentWindow final : public WeldToolbarPopup { public: - FontworkAlignmentWindow( svt::ToolboxController& rController, vcl::Window* pParentWindow ); - + FontworkAlignmentWindow(svt::PopupWindowController* pControl, weld::Widget* pParentWindow); + virtual void GrabFocus() override + { + mxLeft->grab_focus(); + } virtual void statusChanged( const css::frame::FeatureStateEvent& Event ) override; private: - svt::ToolboxController& mrController; + rtl::Reference<svt::PopupWindowController> mxControl; + std::unique_ptr<weld::RadioButton> mxLeft; + std::unique_ptr<weld::RadioButton> mxCenter; + std::unique_ptr<weld::RadioButton> mxRight; + std::unique_ptr<weld::RadioButton> mxWord; + std::unique_ptr<weld::RadioButton> mxStretch; + bool mbSettingValue; - DECL_LINK( SelectHdl, ToolbarMenu*, void ); + DECL_LINK( SelectHdl, weld::ToggleButton&, void ); void implSetAlignment( int nAlignmentMode, bool bEnabled ); }; @@ -284,37 +291,40 @@ private: static const OUStringLiteral gsFontworkAlignment(".uno:FontworkAlignment"); -FontworkAlignmentWindow::FontworkAlignmentWindow(svt::ToolboxController& rController, vcl::Window* pParentWindow) - : ToolbarMenu(rController.getFrameInterface(), pParentWindow, WB_STDPOPUP) - , mrController(rController) +FontworkAlignmentWindow::FontworkAlignmentWindow(svt::PopupWindowController* pControl, weld::Widget* pParent) + : WeldToolbarPopup(pControl->getFrameInterface(), pParent, "svx/ui/fontworkalignmentcontrol.ui", "FontworkAlignmentControl") + , mxControl(pControl) + , mxLeft(m_xBuilder->weld_radio_button("left")) + , mxCenter(m_xBuilder->weld_radio_button("center")) + , mxRight(m_xBuilder->weld_radio_button("right")) + , mxWord(m_xBuilder->weld_radio_button("word")) + , mxStretch(m_xBuilder->weld_radio_button("stretch")) + , mbSettingValue(false) { - SetSelectHdl( LINK( this, FontworkAlignmentWindow, SelectHdl ) ); - - Image aImgAlgin1(StockImage::Yes, RID_SVXBMP_FONTWORK_ALIGN_LEFT); - Image aImgAlgin2(StockImage::Yes, RID_SVXBMP_FONTWORK_ALIGN_CENTER); - Image aImgAlgin3(StockImage::Yes, RID_SVXBMP_FONTWORK_ALIGN_RIGHT); - Image aImgAlgin4(StockImage::Yes, RID_SVXBMP_FONTWORK_ALIGN_WORD); - Image aImgAlgin5(StockImage::Yes, RID_SVXBMP_FONTWORK_ALIGN_STRETCH); - - appendEntry(0, SvxResId(RID_SVXSTR_ALIGN_LEFT), aImgAlgin1); - appendEntry(1, SvxResId(RID_SVXSTR_ALIGN_CENTER), aImgAlgin2); - appendEntry(2, SvxResId(RID_SVXSTR_ALIGN_RIGHT), aImgAlgin3); - appendEntry(3, SvxResId(RID_SVXSTR_ALIGN_WORD), aImgAlgin4); - appendEntry(4, SvxResId(RID_SVXSTR_ALIGN_STRETCH), aImgAlgin5); - - SetOutputSizePixel( getMenuSize() ); + mxLeft->connect_toggled(LINK(this, FontworkAlignmentWindow, SelectHdl)); + mxCenter->connect_toggled(LINK(this, FontworkAlignmentWindow, SelectHdl)); + mxRight->connect_toggled(LINK(this, FontworkAlignmentWindow, SelectHdl)); + mxWord->connect_toggled(LINK(this, FontworkAlignmentWindow, SelectHdl)); + mxStretch->connect_toggled(LINK(this, FontworkAlignmentWindow, SelectHdl)); AddStatusListener( gsFontworkAlignment ); } void FontworkAlignmentWindow::implSetAlignment( int nSurface, bool bEnabled ) { - int i; - for( i = 0; i < 5; i++ ) - { - checkEntry( i, (i == nSurface) && bEnabled ); - enableEntry( i, bEnabled ); - } + bool bSettingValue = mbSettingValue; + mbSettingValue = true; + mxLeft->set_active(nSurface == 0 && bEnabled); + mxLeft->set_sensitive(bEnabled); + mxCenter->set_active(nSurface == 1 && bEnabled); + mxCenter->set_sensitive(bEnabled); + mxRight->set_active(nSurface == 2 && bEnabled); + mxRight->set_sensitive(bEnabled); + mxWord->set_active(nSurface == 3 && bEnabled); + mxWord->set_sensitive(bEnabled); + mxStretch->set_active(nSurface == 4 && bEnabled); + mxStretch->set_sensitive(bEnabled); + mbSettingValue = bSettingValue; } void FontworkAlignmentWindow::statusChanged( const css::frame::FeatureStateEvent& Event ) @@ -334,22 +344,32 @@ void FontworkAlignmentWindow::statusChanged( const css::frame::FeatureStateEvent } } -IMPL_LINK_NOARG(FontworkAlignmentWindow, SelectHdl, ToolbarMenu*, void) +IMPL_LINK(FontworkAlignmentWindow, SelectHdl, weld::ToggleButton&, rButton, void) { - if ( IsInPopupMode() ) - EndPopupMode(); + if (mbSettingValue || !rButton.get_active()) + return; - sal_Int32 nAlignment = getSelectedEntryId(); - if( nAlignment >= 0 ) - { - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = OUString(gsFontworkAlignment).copy(5); - aArgs[0].Value <<= nAlignment; + sal_Int32 nAlignment; + if (mxLeft->get_active()) + nAlignment = 0; + else if (mxCenter->get_active()) + nAlignment = 1; + else if (mxRight->get_active()) + nAlignment = 2; + else if (mxWord->get_active()) + nAlignment = 3; + else + nAlignment = 4; - mrController.dispatchCommand( gsFontworkAlignment, aArgs ); + Sequence< PropertyValue > aArgs( 1 ); + aArgs[0].Name = OUString(gsFontworkAlignment).copy(5); + aArgs[0].Value <<= nAlignment; - implSetAlignment( nAlignment, true ); - } + mxControl->dispatchCommand( gsFontworkAlignment, aArgs ); + + implSetAlignment( nAlignment, true ); + + mxControl->EndPopupMode(); } namespace { @@ -359,6 +379,7 @@ class FontworkAlignmentControl : public svt::PopupWindowController public: explicit FontworkAlignmentControl( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + virtual std::unique_ptr<WeldToolbarPopup> weldPopupWindow() override; virtual VclPtr<vcl::Window> createVclPopupWindow( vcl::Window* pParent ) override; // XInitialization @@ -376,10 +397,19 @@ FontworkAlignmentControl::FontworkAlignmentControl( const Reference< XComponentC { } +std::unique_ptr<WeldToolbarPopup> FontworkAlignmentControl::weldPopupWindow() +{ + return std::make_unique<FontworkAlignmentWindow>(this, m_pToolbar); +} VclPtr<vcl::Window> FontworkAlignmentControl::createVclPopupWindow( vcl::Window* pParent ) { - return VclPtr<FontworkAlignmentWindow>::Create( *this, pParent ); + mxInterimPopover = VclPtr<InterimToolbarPopup>::Create(getFrameInterface(), pParent, + std::make_unique<FontworkAlignmentWindow>(this, pParent->GetFrameWeld())); + + mxInterimPopover->Show(); + + return mxInterimPopover; } // XInitialization diff --git a/svx/uiconfig/ui/fontworkalignmentcontrol.ui b/svx/uiconfig/ui/fontworkalignmentcontrol.ui new file mode 100644 index 000000000000..5e448b2c87da --- /dev/null +++ b/svx/uiconfig/ui/fontworkalignmentcontrol.ui @@ -0,0 +1,134 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> +<interface domain="svx"> + <requires lib="gtk+" version="3.18"/> + <object class="GtkImage" id="image1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon_name">svx/res/fontworkalignleft_16.png</property> + </object> + <object class="GtkImage" id="image2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon_name">svx/res/fontworkaligncentered_16.png</property> + </object> + <object class="GtkImage" id="image3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon_name">svx/res/fontworkalignright_16.png</property> + </object> + <object class="GtkImage" id="image4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon_name">svx/res/fontworkalignjustified_16.png</property> + </object> + <object class="GtkImage" id="image5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon_name">svx/res/fontworkalignstretch_16.png</property> + </object> + <object class="GtkPopover" id="FontworkAlignmentControl"> + <property name="can_focus">False</property> + <property name="no_show_all">True</property> + <property name="border_width">4</property> + <child> + <object class="GtkGrid" id="container"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="row_spacing">6</property> + <child> + <object class="GtkRadioButton" id="left"> + <property name="label" translatable="yes" context="fontworkalignmentcontrol|RID_SVXSTR_ALIGN_LEFT">_Left Align</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="image">image1</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="always_show_image">True</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkRadioButton" id="center"> + <property name="label" translatable="yes" context="fontworkalignmentcontrol|RID_SVXSTR_ALIGN_CENTER">_Center</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="image">image2</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="always_show_image">True</property> + <property name="draw_indicator">True</property> + <property name="group">left</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkRadioButton" id="right"> + <property name="label" translatable="yes" context="fontworkalignmentcontrol|RID_SVXSTR_ALIGN_RIGHT">_Right Align</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="image">image3</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="always_show_image">True</property> + <property name="draw_indicator">True</property> + <property name="group">left</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + </packing> + </child> + <child> + <object class="GtkRadioButton" id="word"> + <property name="label" translatable="yes" context="fontworkalignmentcontrol|RID_SVXSTR_ALIGN_WORD">_Word Justify</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="image">image4</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="always_show_image">True</property> + <property name="draw_indicator">True</property> + <property name="group">left</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">3</property> + </packing> + </child> + <child> + <object class="GtkRadioButton" id="stretch"> + <property name="label" translatable="yes" context="fontworkalignmentcontrol|RID_SVXSTR_ALIGN_STRETCH">S_tretch Justify</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="image">image5</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="always_show_image">True</property> + <property name="draw_indicator">True</property> + <property name="group">left</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">4</property> + </packing> + </child> + </object> + </child> + </object> +</interface> diff --git a/svx/uiconfig/ui/fontworkcharacterspacingcontrol.ui b/svx/uiconfig/ui/fontworkcharacterspacingcontrol.ui index b58493d6a6f3..c068a0418e28 100644 --- a/svx/uiconfig/ui/fontworkcharacterspacingcontrol.ui +++ b/svx/uiconfig/ui/fontworkcharacterspacingcontrol.ui @@ -20,6 +20,7 @@ <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="use_underline">True</property> + <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> <property name="group">normal</property> @@ -36,6 +37,7 @@ <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="use_underline">True</property> + <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> <property name="group">normal</property> @@ -52,6 +54,7 @@ <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="use_underline">True</property> + <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> </object> @@ -67,6 +70,7 @@ <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="use_underline">True</property> + <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> <property name="group">normal</property> @@ -83,6 +87,7 @@ <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="use_underline">True</property> + <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> <property name="group">normal</property> @@ -99,6 +104,7 @@ <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="use_underline">True</property> + <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> <property name="group">normal</property> @@ -115,6 +121,7 @@ <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="use_underline">True</property> + <property name="xalign">0</property> <property name="draw_indicator">True</property> </object> <packing> |