diff options
-rw-r--r-- | include/svx/strings.hrc | 2 | ||||
-rw-r--r-- | solenv/sanitizers/ui/svx.suppr | 5 | ||||
-rw-r--r-- | svx/UIConfig_svx.mk | 1 | ||||
-rw-r--r-- | svx/inc/bitmaps.hlst | 6 | ||||
-rw-r--r-- | svx/source/tbxctrls/extrusioncontrols.cxx | 172 | ||||
-rw-r--r-- | svx/source/tbxctrls/extrusioncontrols.hxx | 20 | ||||
-rw-r--r-- | svx/uiconfig/ui/depthwindow.ui | 174 |
7 files changed, 293 insertions, 87 deletions
diff --git a/include/svx/strings.hrc b/include/svx/strings.hrc index e9d79ff25f89..fd082b27e5cd 100644 --- a/include/svx/strings.hrc +++ b/include/svx/strings.hrc @@ -1042,8 +1042,6 @@ #define RID_SVXSTR_DEPTH_2_INCH NC_("RID_SVXSTR_DEPTH_2_INCH", "~1 inch") #define RID_SVXSTR_DEPTH_3_INCH NC_("RID_SVXSTR_DEPTH_3_INCH", "~2 inch") #define RID_SVXSTR_DEPTH_4_INCH NC_("RID_SVXSTR_DEPTH_4_INCH", "~4 inch") -#define RID_SVXSTR_CUSTOM NC_("RID_SVXSTR_CUSTOM", "~Custom...") -#define RID_SVXSTR_INFINITY NC_("RID_SVXSTR_INFINITY", "~Infinity") #define RID_SVXSTR_NOFILL NC_("RID_SVXSTR_NOFILL", "No Fill") #define RID_SVXSTR_TRANSPARENT NC_("RID_SVXSTR_TRANSPARENT", "Transparent") diff --git a/solenv/sanitizers/ui/svx.suppr b/solenv/sanitizers/ui/svx.suppr index e7085e3358f8..97ec0ee9083c 100644 --- a/solenv/sanitizers/ui/svx.suppr +++ b/solenv/sanitizers/ui/svx.suppr @@ -13,6 +13,11 @@ svx/uiconfig/ui/compressgraphicdialog.ui://GtkLabel[@id='label16'] orphan-label svx/uiconfig/ui/crashreportdlg.ui://GtkLabel[@id='ed_pre'] orphan-label svx/uiconfig/ui/crashreportdlg.ui://GtkTextView[@id='ed_post'] no-labelled-by svx/uiconfig/ui/crashreportdlg.ui://GtkTextView[@id='ed_bugreport'] no-labelled-by +svx/uiconfig/ui/depthwindow.ui://GtkRadioButton[@id='depth0'] button-no-label +svx/uiconfig/ui/depthwindow.ui://GtkRadioButton[@id='depth1'] button-no-label +svx/uiconfig/ui/depthwindow.ui://GtkRadioButton[@id='depth2'] button-no-label +svx/uiconfig/ui/depthwindow.ui://GtkRadioButton[@id='depth3'] button-no-label +svx/uiconfig/ui/depthwindow.ui://GtkRadioButton[@id='depth4'] button-no-label svx/uiconfig/ui/docking3deffects.ui://GtkButton[@id='corner'] button-no-label svx/uiconfig/ui/docking3deffects.ui://GtkScale[@id='horiscale'] no-labelled-by svx/uiconfig/ui/docking3deffects.ui://GtkScale[@id='vertscale'] no-labelled-by diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk index e1f1783607c5..ee550cb840db 100644 --- a/svx/UIConfig_svx.mk +++ b/svx/UIConfig_svx.mk @@ -36,6 +36,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\ svx/uiconfig/ui/defaultshapespanel \ svx/uiconfig/ui/deleteheaderdialog \ svx/uiconfig/ui/deletefooterdialog \ + svx/uiconfig/ui/depthwindow \ svx/uiconfig/ui/directionwindow \ svx/uiconfig/ui/docking3deffects \ svx/uiconfig/ui/dockingcolorreplace \ diff --git a/svx/inc/bitmaps.hlst b/svx/inc/bitmaps.hlst index 9cbe6e66405e..9078184c6ee7 100644 --- a/svx/inc/bitmaps.hlst +++ b/svx/inc/bitmaps.hlst @@ -74,12 +74,6 @@ #define RID_SVXBMP_LIGHT_PREVIEW_FROM_BOTTOM_LEFT "svx/res/lightfrombottomleft_22.png" #define RID_SVXBMP_LIGHT_PREVIEW_FROM_BOTTOM "svx/res/lightfrombottom_22.png" #define RID_SVXBMP_LIGHT_PREVIEW_FROM_BOTTOM_RIGHT "svx/res/lightfrombottomright_22.png" -#define RID_SVXBMP_DEPTH_0 "svx/res/extrusion0inch_16.png" -#define RID_SVXBMP_DEPTH_1 "svx/res/extrusion05inch_16.png" -#define RID_SVXBMP_DEPTH_2 "svx/res/extrusion1inch_16.png" -#define RID_SVXBMP_DEPTH_3 "svx/res/extrusion2inch_16.png" -#define RID_SVXBMP_DEPTH_4 "svx/res/extrusion4inch_16.png" -#define RID_SVXBMP_DEPTH_INFINITY "svx/res/extrusioninfinity_16.png" #define RID_SVXBMP_LAMP_ON "svx/res/lighton.png" #define RID_SVXBMP_LAMP_OFF "svx/res/light.png" diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx index 18201c948d58..5984873ba50e 100644 --- a/svx/source/tbxctrls/extrusioncontrols.cxx +++ b/svx/source/tbxctrls/extrusioncontrols.cxx @@ -339,52 +339,54 @@ double const aDepthListMM[] = { 0, 1000, 2500, 5000, 10000 }; static const OUStringLiteral gsExtrusionDepth( ".uno:ExtrusionDepth" ); static const OUStringLiteral gsMetricUnit( ".uno:MetricUnit" ); -ExtrusionDepthWindow::ExtrusionDepthWindow( - svt::ToolboxController& rController, - vcl::Window* pParentWindow -) : ToolbarMenu( rController.getFrameInterface(), pParentWindow, WB_STDPOPUP ) - , mrController( rController ) +ExtrusionDepthWindow::ExtrusionDepthWindow(svt::PopupWindowController* pControl, weld::Widget* pParent) + : WeldToolbarPopup(pControl->getFrameInterface(), pParent, "svx/ui/depthwindow.ui", "DepthWindow") + , mxControl(pControl) + , mxDepth0(m_xBuilder->weld_radio_button("depth0")) + , mxDepth1(m_xBuilder->weld_radio_button("depth1")) + , mxDepth2(m_xBuilder->weld_radio_button("depth2")) + , mxDepth3(m_xBuilder->weld_radio_button("depth3")) + , mxDepth4(m_xBuilder->weld_radio_button("depth4")) + , mxInfinity(m_xBuilder->weld_radio_button("infinity")) + , mxCustom(m_xBuilder->weld_radio_button("custom")) , meUnit(FieldUnit::NONE) , mfDepth( -1.0 ) + , mbSettingValue(false) { - SetSelectHdl( LINK( this, ExtrusionDepthWindow, SelectHdl ) ); - - Image aImgDepth0(StockImage::Yes, RID_SVXBMP_DEPTH_0); - Image aImgDepth1(StockImage::Yes, RID_SVXBMP_DEPTH_1); - Image aImgDepth2(StockImage::Yes, RID_SVXBMP_DEPTH_2); - Image aImgDepth3(StockImage::Yes, RID_SVXBMP_DEPTH_3); - Image aImgDepth4(StockImage::Yes, RID_SVXBMP_DEPTH_4); - Image aImgDepthInfinity(StockImage::Yes, RID_SVXBMP_DEPTH_INFINITY); - - appendEntry(0, "", aImgDepth0); - appendEntry(1, "", aImgDepth1); - appendEntry(2, "", aImgDepth2); - appendEntry(3, "", aImgDepth3); - appendEntry(4, "", aImgDepth4); - appendEntry(5, SvxResId(RID_SVXSTR_INFINITY), aImgDepthInfinity); - appendEntry(6, SvxResId(RID_SVXSTR_CUSTOM)); - - SetOutputSizePixel( getMenuSize() ); + mxDepth0->connect_toggled(LINK(this, ExtrusionDepthWindow, SelectHdl)); + mxDepth1->connect_toggled(LINK(this, ExtrusionDepthWindow, SelectHdl)); + mxDepth2->connect_toggled(LINK(this, ExtrusionDepthWindow, SelectHdl)); + mxDepth3->connect_toggled(LINK(this, ExtrusionDepthWindow, SelectHdl)); + mxDepth4->connect_toggled(LINK(this, ExtrusionDepthWindow, SelectHdl)); + mxInfinity->connect_toggled(LINK(this, ExtrusionDepthWindow, SelectHdl)); + mxCustom->connect_clicked(LINK(this, ExtrusionDepthWindow, ClickHdl)); AddStatusListener( gsExtrusionDepth ); AddStatusListener( gsMetricUnit ); } +void ExtrusionDepthWindow::GrabFocus() +{ + mxDepth0->grab_focus(); +} + void ExtrusionDepthWindow::implSetDepth( double fDepth ) { mfDepth = fDepth; - int i; - for( i = 0; i < 7; i++ ) - { - if( i == 5 ) - { - checkEntry( i, fDepth >= 338666 ); - } - else if( i != 6 ) - { - checkEntry( i, (fDepth == (IsMetric( meUnit ) ? aDepthListMM[i] : aDepthListInch[i]) ) ); - } - } + + bool bSettingValue = mbSettingValue; + mbSettingValue = true; + + mxCustom->set_active(true); + bool bIsMetric = IsMetric(meUnit); + mxDepth0->set_active(fDepth == (bIsMetric ? aDepthListMM[0] : aDepthListInch[0])); + mxDepth1->set_active(fDepth == (bIsMetric ? aDepthListMM[1] : aDepthListInch[1])); + mxDepth2->set_active(fDepth == (bIsMetric ? aDepthListMM[2] : aDepthListInch[2])); + mxDepth3->set_active(fDepth == (bIsMetric ? aDepthListMM[3] : aDepthListInch[3])); + mxDepth4->set_active(fDepth == (bIsMetric ? aDepthListMM[4] : aDepthListInch[4])); + mxInfinity->set_active(fDepth >= 338666); + + mbSettingValue = bSettingValue; } void ExtrusionDepthWindow::implFillStrings( FieldUnit eUnit ) @@ -413,11 +415,11 @@ void ExtrusionDepthWindow::implFillStrings( FieldUnit eUnit ) const char** pResource = IsMetric(eUnit) ? aDepths : aDepthsInch; - for (size_t i = 0; i < SAL_N_ELEMENTS(aDepths); ++i) - { - OUString aStr(SvxResId(pResource[i])); - setEntryText(i, aStr); - } + mxDepth0->set_label(SvxResId(pResource[0])); + mxDepth1->set_label(SvxResId(pResource[1])); + mxDepth2->set_label(SvxResId(pResource[2])); + mxDepth3->set_label(SvxResId(pResource[3])); + mxDepth4->set_label(SvxResId(pResource[4])); } void ExtrusionDepthWindow::statusChanged( @@ -452,56 +454,67 @@ void ExtrusionDepthWindow::statusChanged( } } -IMPL_LINK_NOARG(ExtrusionDepthWindow, SelectHdl, ToolbarMenu*, void) +IMPL_LINK_NOARG(ExtrusionDepthWindow, ClickHdl, weld::Button&, void) { - int nSelected = getSelectedEntryId(); - if( nSelected != -1 ) + SelectHdl(*mxCustom); +} + +IMPL_LINK(ExtrusionDepthWindow, SelectHdl, weld::ToggleButton&, rButton, void) +{ + if (mbSettingValue || !rButton.get_active()) + return; + + if (mxCustom->get_active()) { - if( nSelected == 6 ) - { - if ( IsInPopupMode() ) - EndPopupMode(); + const OUString aCommand( ".uno:ExtrusionDepthDialog" ); - const OUString aCommand( ".uno:ExtrusionDepthDialog" ); + Sequence< PropertyValue > aArgs( 2 ); + aArgs[0].Name = "Depth"; + aArgs[0].Value <<= mfDepth; + aArgs[1].Name = "Metric"; + aArgs[1].Value <<= static_cast<sal_Int32>( meUnit ); - Sequence< PropertyValue > aArgs( 2 ); - aArgs[0].Name = "Depth"; - aArgs[0].Value <<= mfDepth; - aArgs[1].Name = "Metric"; - aArgs[1].Value <<= static_cast<sal_Int32>( meUnit ); + rtl::Reference<svt::PopupWindowController> xControl(mxControl); + xControl->EndPopupMode(); + xControl->dispatchCommand(aCommand, aArgs); + } + else + { + double fDepth; - mrController.dispatchCommand( aCommand, aArgs ); + if (mxInfinity->get_active()) + { + fDepth = 338666.6; } else { - double fDepth; - - if( nSelected == 5 ) - { - fDepth = 338666.6; - } + int nSelected; + if (mxDepth0->get_active()) + nSelected = 0; + else if (mxDepth1->get_active()) + nSelected = 1; + else if (mxDepth2->get_active()) + nSelected = 2; + else if (mxDepth3->get_active()) + nSelected = 3; else - { - fDepth = IsMetric( meUnit ) ? aDepthListMM[nSelected] : aDepthListInch[nSelected]; - } + nSelected = 4; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = OUString(gsExtrusionDepth).copy(5); - aArgs[0].Value <<= fDepth; + fDepth = IsMetric( meUnit ) ? aDepthListMM[nSelected] : aDepthListInch[nSelected]; + } - mrController.dispatchCommand( gsExtrusionDepth, aArgs ); - implSetDepth( fDepth ); + Sequence< PropertyValue > aArgs( 1 ); + aArgs[0].Name = OUString(gsExtrusionDepth).copy(5); + aArgs[0].Value <<= fDepth; - if ( IsInPopupMode() ) - EndPopupMode(); - } + mxControl->dispatchCommand( gsExtrusionDepth, aArgs ); + implSetDepth( fDepth ); + + mxControl->EndPopupMode(); } } - // ExtrusionDirectionControl - - ExtrusionDepthController::ExtrusionDepthController( const Reference< XComponentContext >& rxContext ) : svt::PopupWindowController( @@ -512,10 +525,19 @@ ExtrusionDepthController::ExtrusionDepthController( { } +std::unique_ptr<WeldToolbarPopup> ExtrusionDepthController::weldPopupWindow() +{ + return std::make_unique<ExtrusionDepthWindow>(this, m_pToolbar); +} VclPtr<vcl::Window> ExtrusionDepthController::createVclPopupWindow( vcl::Window* pParent ) { - return VclPtr<ExtrusionDepthWindow>::Create( *this, pParent ); + mxInterimPopover = VclPtr<InterimToolbarPopup>::Create(getFrameInterface(), pParent, + std::make_unique<ExtrusionDepthWindow>(this, pParent->GetFrameWeld())); + + mxInterimPopover->Show(); + + return mxInterimPopover; } // XInitialization diff --git a/svx/source/tbxctrls/extrusioncontrols.hxx b/svx/source/tbxctrls/extrusioncontrols.hxx index 67d99359b5b8..e323ee1b9dd7 100644 --- a/svx/source/tbxctrls/extrusioncontrols.hxx +++ b/svx/source/tbxctrls/extrusioncontrols.hxx @@ -90,20 +90,31 @@ public: virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; }; -class ExtrusionDepthWindow : public svtools::ToolbarMenu +class ExtrusionDepthWindow final : public WeldToolbarPopup { private: - svt::ToolboxController& mrController; + rtl::Reference<svt::PopupWindowController> mxControl; + std::unique_ptr<weld::RadioButton> mxDepth0; + std::unique_ptr<weld::RadioButton> mxDepth1; + std::unique_ptr<weld::RadioButton> mxDepth2; + std::unique_ptr<weld::RadioButton> mxDepth3; + std::unique_ptr<weld::RadioButton> mxDepth4; + std::unique_ptr<weld::RadioButton> mxInfinity; + std::unique_ptr<weld::RadioButton> mxCustom; + FieldUnit meUnit; double mfDepth; + bool mbSettingValue; - DECL_LINK( SelectHdl, ToolbarMenu*, void ); + DECL_LINK( SelectHdl, weld::ToggleButton&, void ); + DECL_LINK( ClickHdl, weld::Button&, void ); void implFillStrings( FieldUnit eUnit ); void implSetDepth( double fDepth ); public: - ExtrusionDepthWindow( svt::ToolboxController& rController, vcl::Window* pParentWindow ); + ExtrusionDepthWindow(svt::PopupWindowController* pControl, weld::Widget* pParentWindow); + virtual void GrabFocus() override; virtual void statusChanged( const css::frame::FeatureStateEvent& Event ) override; }; @@ -113,6 +124,7 @@ class ExtrusionDepthController : public svt::PopupWindowController public: explicit ExtrusionDepthController( 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 diff --git a/svx/uiconfig/ui/depthwindow.ui b/svx/uiconfig/ui/depthwindow.ui new file mode 100644 index 000000000000..3404b4143f97 --- /dev/null +++ b/svx/uiconfig/ui/depthwindow.ui @@ -0,0 +1,174 @@ +<?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/extrusion1inch_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/extrusion05inch_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/extrusion2inch_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/extrusion0inch_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/extrusion4inch_16.png</property> + </object> + <object class="GtkImage" id="image6"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon_name">svx/res/extrusioninfinity_16.png</property> + </object> + <object class="GtkPopover" id="DepthWindow"> + <property name="can_focus">False</property> + <property name="no_show_all">True</property> + <property name="border_width">4</property> + <child> + <object class="GtkBox" id="container"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkRadioButton" id="depth0"> + <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="active">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkRadioButton" id="depth1"> + <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">depth0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkRadioButton" id="depth2"> + <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="draw_indicator">True</property> + <property name="group">depth0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkRadioButton" id="depth3"> + <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">depth0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + <child> + <object class="GtkRadioButton" id="depth4"> + <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">depth0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">4</property> + </packing> + </child> + <child> + <object class="GtkRadioButton" id="infinity"> + <property name="label" translatable="yes" context="depthwindow|RID_SVXSTR_INFINITY">_Infinity</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="image">image6</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">depth0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">5</property> + </packing> + </child> + <child> + <object class="GtkRadioButton" id="custom"> + <property name="label" translatable="yes" context="depthwindow|RID_SVXSTR_CUSTOM">_Custom...</property> + <property name="visible">True</property> + <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> + <property name="group">depth0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">6</property> + </packing> + </child> + </object> + </child> + </object> +</interface> |