diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-09-05 11:57:59 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-09-06 12:45:15 +0200 |
commit | 587899f9ced03d02fbf8ffa9a3f52ba31be30818 (patch) | |
tree | 75b303c67aad161a1f9ac571bbb51f9536f9ab25 | |
parent | 83f12a2d4e410014c70844085f19190a50e83429 (diff) |
weld SwColumnPage and SwColumnDialog
Change-Id: Ia649785047db2551044b4d765881309f83b5c838
Reviewed-on: https://gerrit.libreoffice.org/60044
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | extras/source/glade/libreoffice-catalog.xml.in | 21 | ||||
-rw-r--r-- | include/svtools/ctrlbox.hxx | 7 | ||||
-rw-r--r-- | include/svtools/valueset.hxx | 7 | ||||
-rw-r--r-- | include/svx/frmdirlbox.hxx | 2 | ||||
-rw-r--r-- | include/svx/pagectrl.hxx | 110 | ||||
-rw-r--r-- | solenv/sanitizers/ui/modules/swriter.suppr | 8 | ||||
-rw-r--r-- | svtools/source/control/ctrlbox.cxx | 35 | ||||
-rw-r--r-- | svtools/source/control/valueset.cxx | 24 | ||||
-rw-r--r-- | svx/source/dialog/pagectrl.cxx | 255 | ||||
-rw-r--r-- | sw/inc/swabstdlg.hxx | 2 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.cxx | 9 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.hxx | 5 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/column.cxx | 752 | ||||
-rw-r--r-- | sw/source/uibase/frmdlg/colex.cxx | 215 | ||||
-rw-r--r-- | sw/source/uibase/inc/colex.hxx | 33 | ||||
-rw-r--r-- | sw/source/uibase/inc/column.hxx | 152 | ||||
-rw-r--r-- | sw/source/uibase/inc/prcntfld.hxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/shells/textsh.cxx | 6 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/columnpage.ui | 141 |
19 files changed, 628 insertions, 1157 deletions
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in index fb2bbd3235ec..8e16d05dc395 100644 --- a/extras/source/glade/libreoffice-catalog.xml.in +++ b/extras/source/glade/libreoffice-catalog.xml.in @@ -174,18 +174,6 @@ </properties> </glade-widget-class> - <glade-widget-class title="Svt Line ListBox" name="svtlo-LineListBox" - generic-name="Line ListBox" parent="GtkComboBox" - icon-name="widget-gtk-combobox"> - <properties> - <property save="True" query="False" id="dropdown" default="True" name="Use DropDown"> - <parameter-spec> - <type>GParamBoolean</type> - </parameter-spec> - </property> - </properties> - </glade-widget-class> - <glade-widget-class title="Font ListBox" name="svtlo-FontStyleBox" generic-name="FontStyleBox" parent="GtkComboBox" icon-name="widget-gtk-combobox"> @@ -320,9 +308,6 @@ <glade-widget-class title="SvxPresetListBox" name="svxcorelo-SvxPresetListBox" generic-name="Set of Value Options" parent="GtkDrawingArea" icon-name="widget-gtk-drawingarea"/> - <glade-widget-class title="SwColumnValueSet" name="swuilo-ColumnValueSet" - generic-name="Set of Value Options" parent="GtkDrawingArea" - icon-name="widget-gtk-drawingarea"/> <glade-widget-class title="TableValueSet" name="sdlo-TableValueSet" generic-name="Set of Table Value Options" parent="GtkDrawingArea" icon-name="widget-gtk-drawingarea"/> @@ -356,12 +341,6 @@ <glade-widget-class title="Paragraph Preview" name="svxlo-SvxParaPrevWindow" generic-name="Paragraph Preview Window" parent="GtkDrawingArea" icon-name="widget-gtk-drawingarea"/> - <glade-widget-class title="Page Preview" name="swlo-SwColExample" - generic-name="Page Preview Window" parent="GtkDrawingArea" - icon-name="widget-gtk-drawingarea"/> - <glade-widget-class title="Page Preview" name="swlo-SwColumnOnlyExample" - generic-name="Page Preview Window" parent="GtkDrawingArea" - icon-name="widget-gtk-drawingarea"/> <glade-widget-class title="Table Preview" name="swuilo-AutoFmtPreview" generic-name="Table Preview Window" parent="GtkDrawingArea" icon-name="widget-gtk-drawingarea"/> diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx index 8df5dfdadc2b..c1cc78eb7e9f 100644 --- a/include/svtools/ctrlbox.hxx +++ b/include/svtools/ctrlbox.hxx @@ -294,13 +294,15 @@ public: ~SvtLineListBox(); /** Set the width in Twips */ - void SetWidth( long nWidth ) + void SetWidth(long nWidth) { m_nWidth = nWidth; UpdateEntries(); UpdatePreview(); } + long GetWidth() const { return m_nWidth; } + /** Insert a listbox entry with all widths in Twips. */ void InsertEntry(const BorderWidthImpl& rWidthImpl, SvxBorderLineStyle nStyle, long nMinWidth = 0, @@ -317,12 +319,15 @@ public: { aColor = rColor; UpdateEntries(); + UpdatePreview(); } const Color& GetColor() const { return aColor; } void SetSelectHdl(const Link<SvtLineListBox&,void>& rLink) { maSelectHdl = rLink; } + void set_sensitive(bool bSensitive) { m_xControl->set_sensitive(bSensitive); } + private: SVT_DLLPRIVATE void ImpGetLine( long nLine1, long nLine2, long nDistance, diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx index fa4b3994de86..b1d8596eced6 100644 --- a/include/svtools/valueset.hxx +++ b/include/svtools/valueset.hxx @@ -495,9 +495,11 @@ public: virtual void LoseFocus() override; virtual void Resize() override; virtual void StyleUpdated() override; - virtual void Select(); virtual OUString RequestHelp(tools::Rectangle& rHelpRect) override; + virtual void Select(); + virtual void UserDraw( const UserDrawEvent& rUDEvt ); + OUString const & GetText() const { return maText; } void SetText(const OUString& rText) { maText = rText; } void SetStyle(WinBits nStyle); @@ -513,6 +515,8 @@ public: const OUString& rStr); /// Insert an User Drawn item. void InsertItem(sal_uInt16 nItemId, size_t nPos = VALUESET_APPEND); + /// Insert an User Drawn item with @rStr tooltip. + void InsertItem(sal_uInt16 nItemId, const OUString& rStr, size_t nPos); void RemoveItem(sal_uInt16 nItemId); void Clear(); @@ -560,6 +564,7 @@ public: void SetExtraSpacing( sal_uInt16 nNewSpacing ); void Format(vcl::RenderContext const & rRenderContext); + void SetFormat(); Size CalcWindowSizePixel(const Size& rItemSize, sal_uInt16 nCalcCols = 0, diff --git a/include/svx/frmdirlbox.hxx b/include/svx/frmdirlbox.hxx index fb2208f59190..405065199da9 100644 --- a/include/svx/frmdirlbox.hxx +++ b/include/svx/frmdirlbox.hxx @@ -70,7 +70,7 @@ public: void set_active_id(SvxFrameDirection eDir) { m_xControl->set_active_id(OUString::number(static_cast<sal_uInt32>(eDir))); } void remove_id(SvxFrameDirection eDir) { m_xControl->remove_id(OUString::number(static_cast<sal_uInt32>(eDir))); } void hide() { m_xControl->hide(); } - void show() { m_xControl->show(); } + void show(bool bShow = true) { m_xControl->show(bShow); } int get_count() const { return m_xControl->get_count(); } /** Inserts a string with corresponding direction enum into the listbox. */ void append(SvxFrameDirection eDirection, const OUString& rString) diff --git a/include/svx/pagectrl.hxx b/include/svx/pagectrl.hxx index 074c936328c6..f2db16bbaa9b 100644 --- a/include/svx/pagectrl.hxx +++ b/include/svx/pagectrl.hxx @@ -28,112 +28,6 @@ class SvxBoxItem; enum class SvxPageUsage; enum class SvxFrameDirection; -class SVX_DLLPUBLIC SvxPageWindow : public vcl::Window -{ - using Window::GetBorder; - -private: - Size aWinSize; - Size aSize; - - long nTop; - long nBottom; - long nLeft; - long nRight; - - long nHdLeft; - long nHdRight; - long nHdDist; - long nHdHeight; - - long nFtLeft; - long nFtRight; - long nFtDist; - long nFtHeight; - - drawinglayer::attribute::SdrAllFillAttributesHelperPtr maHeaderFillAttributes; - drawinglayer::attribute::SdrAllFillAttributesHelperPtr maFooterFillAttributes; - drawinglayer::attribute::SdrAllFillAttributesHelperPtr maPageFillAttributes; - - bool bFooter : 1; - bool bHeader : 1; - - SvxPageUsage eUsage; - -protected: - virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; - - virtual void DrawPage(vcl::RenderContext& rRenderContext, const Point& rPoint, - const bool bSecond, const bool bEnabled); - - void drawFillAttributes(vcl::RenderContext& rRenderContext, - const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes, - const tools::Rectangle& rPaintRange, const tools::Rectangle& rDefineRange); - -public: - SvxPageWindow(vcl::Window* pParent); - virtual ~SvxPageWindow() override; - - void setHeaderFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes) - { - maHeaderFillAttributes = rFillAttributes; - } - void setFooterFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes) - { - maFooterFillAttributes = rFillAttributes; - } - void setPageFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes) - { - maPageFillAttributes = rFillAttributes; - } - const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& getPageFillAttributes() const - { - return maPageFillAttributes; - } - void SetSize(const Size& rSize) - { - aSize = rSize; - } - const Size& GetSize() const - { - return aSize; - } - - void SetTop(long nNew) { nTop = nNew; } - void SetBottom(long nNew) { nBottom = nNew; } - void SetLeft(long nNew) { nLeft = nNew; } - void SetRight(long nNew) { nRight = nNew; } - - long GetTop() const { return nTop; } - long GetBottom() const { return nBottom; } - long GetLeft() const { return nLeft; } - long GetRight() const { return nRight; } - - void SetHdLeft(long nNew) { nHdLeft = nNew; } - void SetHdRight(long nNew) { nHdRight = nNew; } - void SetHdDist(long nNew) { nHdDist = nNew; } - void SetHdHeight(long nNew) { nHdHeight = nNew; } - - long GetHdDist() const { return nHdDist; } - long GetHdHeight() const { return nHdHeight; } - - void SetFtLeft(long nNew) { nFtLeft = nNew; } - void SetFtRight(long nNew) { nFtRight = nNew; } - void SetFtDist(long nNew) { nFtDist = nNew; } - void SetFtHeight(long nNew) { nFtHeight = nNew; } - - long GetFtDist() const { return nFtDist; } - long GetFtHeight() const { return nFtHeight; } - - void SetUsage(SvxPageUsage eU) { eUsage = eU; } - SvxPageUsage GetUsage() const { return eUsage; } - - void SetHeader( bool bNew ) { bHeader = bNew; } - void SetFooter( bool bNew ) { bFooter = bNew; } - - virtual Size GetOptimalSize() const override; -}; - class SVX_DLLPUBLIC PageWindow : public weld::CustomWidgetController { private: @@ -198,6 +92,10 @@ public: { maPageFillAttributes = rFillAttributes; } + const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& getPageFillAttributes() const + { + return maPageFillAttributes; + } void SetSize(const Size& rSize) { aSize = rSize; diff --git a/solenv/sanitizers/ui/modules/swriter.suppr b/solenv/sanitizers/ui/modules/swriter.suppr index cf3760ffb76b..50232c5b6323 100644 --- a/solenv/sanitizers/ui/modules/swriter.suppr +++ b/solenv/sanitizers/ui/modules/swriter.suppr @@ -29,11 +29,9 @@ sw/uiconfig/swriter/ui/businessdatapage.ui://GtkEntry[@id='state'] no-labelled-b sw/uiconfig/swriter/ui/cardmediumpage.ui://GtkLabel[@id='formatinfo'] orphan-label sw/uiconfig/swriter/ui/cardmediumpage.ui://GtkComboBoxText[@id='hiddentype'] no-labelled-by sw/uiconfig/swriter/ui/ccdialog.ui://GtkLabel[@id='label4'] orphan-label -sw/uiconfig/swriter/ui/columnpage.ui://GtkSpinButton[@id='width3mf:0.00cm'] labelled-by-and-mnemonic -sw/uiconfig/swriter/ui/columnpage.ui://GtkSpinButton[@id='width2mf:0.00cm'] labelled-by-and-mnemonic -sw/uiconfig/swriter/ui/columnpage.ui://GtkSpinButton[@id='width1mf:0.00cm'] labelled-by-and-mnemonic -sw/uiconfig/swriter/ui/columnpage.ui://GtkSpinButton[@id='lineheightmf:0%'] no-labelled-by -sw/uiconfig/swriter/ui/columnpage.ui://GtkSpinButton[@id='linewidthmf:0.00pt'] duplicate-mnemonic +sw/uiconfig/swriter/ui/columnpage.ui://GtkSpinButton[@id='width3mf'] labelled-by-and-mnemonic +sw/uiconfig/swriter/ui/columnpage.ui://GtkSpinButton[@id='width2mf'] labelled-by-and-mnemonic +sw/uiconfig/swriter/ui/columnpage.ui://GtkSpinButton[@id='width1mf'] labelled-by-and-mnemonic sw/uiconfig/swriter/ui/conditionpage.ui://GtkLabel[@id='contextft'] orphan-label sw/uiconfig/swriter/ui/conditionpage.ui://GtkLabel[@id='usedft'] orphan-label sw/uiconfig/swriter/ui/conditionpage.ui://GtkLabel[@id='styleft'] orphan-label diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 3e3f2d9a7df2..162216ae1cbf 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -493,18 +493,6 @@ LineListBox::LineListBox( vcl::Window* pParent, WinBits nWinStyle ) : UpdatePaintLineColor(); } -extern "C" SAL_DLLPUBLIC_EXPORT void makeLineListBox(VclPtr<vcl::Window> & rRet, VclPtr<vcl::Window> & pParent, VclBuilder::stringmap & rMap) -{ - bool bDropdown = BuilderUtils::extractDropdown(rMap); - WinBits nWinBits = WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_TABSTOP; - if (bDropdown) - nWinBits |= WB_DROPDOWN; - VclPtrInstance<LineListBox> pListBox(pParent, nWinBits); - if (bDropdown) - pListBox->EnableAutoSize(true); - rRet = pListBox; -} - LineListBox::~LineListBox() { disposeOnce(); @@ -1587,11 +1575,19 @@ SvxBorderLineStyle SvtLineListBox::GetSelectEntryStyle() const return static_cast<SvxBorderLineStyle>(nId - 1); } +namespace +{ + Size getPreviewSize(const weld::Widget& rControl) + { + return Size(rControl.get_approximate_digit_width() * 15, rControl.get_text_height()); + } +} + void SvtLineListBox::ImpGetLine( long nLine1, long nLine2, long nDistance, Color aColor1, Color aColor2, Color aColorDist, SvxBorderLineStyle nStyle, BitmapEx& rBmp ) { - Size aSize(m_xControl->get_approximate_digit_width() * 15, m_xControl->get_text_height()); + Size aSize(getPreviewSize(*m_xControl)); // SourceUnit to Twips if ( eSourceUnit == FUNIT_POINT ) @@ -1682,9 +1678,16 @@ SvtLineListBox::SvtLineListBox(std::unique_ptr<weld::MenuButton> pControl) m_xTopLevel->connect_focus_in(LINK(this, SvtLineListBox, FocusHdl)); m_xControl->set_popover(m_xTopLevel.get()); + + // lock size to these maxes height/width so it doesn't jump around in size m_xControl->set_label(GetLineStyleName(SvxBorderLineStyle::NONE)); - // lock to this text height - m_xControl->set_size_request(-1, m_xControl->get_preferred_size().Height()); + Size aNonePrefSize = m_xControl->get_preferred_size(); + m_xControl->set_label(""); + aVirDev->SetOutputSizePixel(getPreviewSize(*m_xControl)); + m_xControl->set_image(aVirDev); + Size aSolidPrefSize = m_xControl->get_preferred_size(); + m_xControl->set_size_request(std::max(aNonePrefSize.Width(), aSolidPrefSize.Width()), + std::max(aNonePrefSize.Height(), aSolidPrefSize.Height())); eSourceUnit = FUNIT_POINT; @@ -1868,8 +1871,8 @@ void SvtLineListBox::UpdatePreview() aVirDev->SetMapMode(MapMode(MapUnit::MapPixel)); aVirDev->Erase(); aVirDev->DrawImage(Point(0, nPos), aImage); - aVirDev->Pop(); m_xControl->set_image(aVirDev.get()); + aVirDev->Pop(); } } diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index e39650e61377..d61762644e98 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -2370,6 +2370,10 @@ void SvtValueSet::Select() maSelectHdl.Call( this ); } +void SvtValueSet::UserDraw( const UserDrawEvent& ) +{ +} + size_t SvtValueSet::ImplGetItem( const Point& rPos ) const { if (!mbHasVisibleItems) @@ -3514,6 +3518,8 @@ void SvtValueSet::ImplFormatItem(vcl::RenderContext const & rRenderContext, SvtV if (pItem->meType == VALUESETITEM_USERDRAW) { + UserDrawEvent aUDEvt(nullptr, maVirDev.get(), aRect, pItem->mnId); + UserDraw(aUDEvt); } else { @@ -3841,6 +3847,19 @@ void SvtValueSet::SetItemWidth( long nNewItemWidth ) } } +//method to set accessible when the style is user draw. +void SvtValueSet::InsertItem( sal_uInt16 nItemId, const OUString& rText, size_t nPos ) +{ + DBG_ASSERT( nItemId, "ValueSet::InsertItem(): ItemId == 0" ); + DBG_ASSERT( GetItemPos( nItemId ) == VALUESET_ITEM_NOTFOUND, + "ValueSet::InsertItem(): ItemId already exists" ); + SvtValueSetItem* pItem = new SvtValueSetItem( *this ); + pItem->mnId = nItemId; + pItem->meType = VALUESETITEM_USERDRAW; + pItem->maText = rText; + ImplInsertItem( pItem, nPos ); +} + void SvtValueSet::SetItemHeight( long nNewItemHeight ) { if ( mnUserItemHeight != nNewItemHeight ) @@ -3889,6 +3908,11 @@ void SvtValueSet::SetExtraSpacing( sal_uInt16 nNewSpacing ) } } +void SvtValueSet::SetFormat() +{ + mbFormat = true; +} + void SvtValueSet::SetItemText(sal_uInt16 nItemId, const OUString& rText) { size_t nPos = GetItemPos( nItemId ); diff --git a/svx/source/dialog/pagectrl.cxx b/svx/source/dialog/pagectrl.cxx index a7e112d026a0..bf244703b31b 100644 --- a/svx/source/dialog/pagectrl.cxx +++ b/svx/source/dialog/pagectrl.cxx @@ -36,261 +36,6 @@ #define CELL_WIDTH 1600L #define CELL_HEIGHT 800L -SvxPageWindow::SvxPageWindow(vcl::Window* pParent) -: Window(pParent), - aWinSize(), - aSize(), - - nTop(0), - nBottom(0), - nLeft(0), - nRight(0), - - nHdLeft(0), - nHdRight(0), - nHdDist(0), - nHdHeight(0), - - nFtLeft(0), - nFtRight(0), - nFtDist(0), - nFtHeight(0), - - maHeaderFillAttributes(), - maFooterFillAttributes(), - maPageFillAttributes(), - - bFooter(false), - bHeader(false), - - eUsage(SvxPageUsage::All) -{ - // Count in Twips by default - SetMapMode(MapMode(MapUnit::MapTwip)); - aWinSize = GetOptimalSize(); - aWinSize.AdjustHeight( -4 ); - aWinSize.AdjustWidth( -4 ); - - aWinSize = PixelToLogic(aWinSize); - SetBackground(); -} - -SvxPageWindow::~SvxPageWindow() -{ - disposeOnce(); -} - -void SvxPageWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) -{ - Fraction aXScale(aWinSize.Width(), std::max(long(aSize.Width() * 2 + aSize.Width() / 8), 1L)); - Fraction aYScale(aWinSize.Height(), std::max(aSize.Height(), 1L)); - MapMode aMapMode(rRenderContext.GetMapMode()); - - if(aYScale < aXScale) - { - aMapMode.SetScaleX(aYScale); - aMapMode.SetScaleY(aYScale); - } - else - { - aMapMode.SetScaleX(aXScale); - aMapMode.SetScaleY(aXScale); - } - rRenderContext.SetMapMode(aMapMode); - Size aSz(rRenderContext.PixelToLogic(GetSizePixel())); - long nYPos = (aSz.Height() - aSize.Height()) / 2; - - if (eUsage == SvxPageUsage::All) - { - // all pages are equal -> draw one page - if (aSize.Width() > aSize.Height()) - { - // Draw Landscape page of the same size - Fraction aX = aMapMode.GetScaleX(); - Fraction aY = aMapMode.GetScaleY(); - Fraction a2(1.5); - aX *= a2; - aY *= a2; - aMapMode.SetScaleX(aX); - aMapMode.SetScaleY(aY); - rRenderContext.SetMapMode(aMapMode); - aSz = rRenderContext.PixelToLogic(GetSizePixel()); - nYPos = (aSz.Height() - aSize.Height()) / 2; - long nXPos = (aSz.Width() - aSize.Width()) / 2; - DrawPage(rRenderContext, Point(nXPos,nYPos),true,true); - } - else - // Portrait - DrawPage(rRenderContext, Point((aSz.Width() - aSize.Width()) / 2,nYPos),true,true); - } - else - { - // Left and right page are different -> draw two pages if possible - DrawPage(rRenderContext, Point(0, nYPos), false, - eUsage == SvxPageUsage::Left || eUsage == SvxPageUsage::All || eUsage == SvxPageUsage::Mirror); - DrawPage(rRenderContext, Point(aSize.Width() + aSize.Width() / 8, nYPos), true, - eUsage == SvxPageUsage::Right || eUsage == SvxPageUsage::All || eUsage == SvxPageUsage::Mirror); - } -} - -void SvxPageWindow::DrawPage(vcl::RenderContext& rRenderContext, const Point& rOrg, const bool bSecond, const bool bEnabled) -{ - const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); - const Color& rFieldColor = rStyleSettings.GetFieldColor(); - const Color& rFieldTextColor = rStyleSettings.GetFieldTextColor(); - const Color& rDisableColor = rStyleSettings.GetDisableColor(); - const Color& rDlgColor = rStyleSettings.GetDialogColor(); - - // background - if (!bSecond) - { - rRenderContext.SetLineColor(COL_TRANSPARENT); - rRenderContext.SetFillColor(rDlgColor); - Size winSize(rRenderContext.GetOutputSize()); - rRenderContext.DrawRect(tools::Rectangle(Point(0,0), winSize)); - } - rRenderContext.SetLineColor(rFieldTextColor); - - // Shadow - Size aTempSize = aSize; - - // Page - if (!bEnabled) - { - rRenderContext.SetFillColor(rDisableColor); - rRenderContext.DrawRect(tools::Rectangle(rOrg, aTempSize)); - return; - } - rRenderContext.SetFillColor(rFieldColor); - rRenderContext.DrawRect(tools::Rectangle(rOrg, aTempSize)); - - long nL = nLeft; - long nR = nRight; - - if (eUsage == SvxPageUsage::Mirror && !bSecond) - { - // turn for mirrored - nL = nRight; - nR = nLeft; - } - - tools::Rectangle aRect; - - aRect.SetLeft( rOrg.X() + nL ); - aRect.SetRight( rOrg.X() + aTempSize.Width() - nR ); - aRect.SetTop( rOrg.Y() + nTop ); - aRect.SetBottom( rOrg.Y() + aTempSize.Height() - nBottom ); - - tools::Rectangle aHdRect(aRect); - tools::Rectangle aFtRect(aRect); - - if (bHeader || bFooter) - { - // Header and/or footer used - const Color aLineColor(rRenderContext.GetLineColor()); - - // draw PageFill first and on the whole page, no outline - rRenderContext.SetLineColor(); - drawFillAttributes(rRenderContext, maPageFillAttributes, aRect, aRect); - rRenderContext.SetLineColor(aLineColor); - - if (bHeader) - { - // show headers if possible - aHdRect.AdjustLeft(nHdLeft ); - aHdRect.AdjustRight( -(nHdRight) ); - aHdRect.SetBottom( aRect.Top() + nHdHeight ); - aRect.AdjustTop(nHdHeight + nHdDist ); - - // draw header over PageFill, plus outline - drawFillAttributes(rRenderContext, maHeaderFillAttributes, aHdRect, aHdRect); - } - - if (bFooter) - { - // show footer if possible - aFtRect.AdjustLeft(nFtLeft ); - aFtRect.AdjustRight( -(nFtRight) ); - aFtRect.SetTop( aRect.Bottom() - nFtHeight ); - aRect.AdjustBottom( -(nFtHeight + nFtDist) ); - - // draw footer over PageFill, plus outline - drawFillAttributes(rRenderContext, maFooterFillAttributes, aFtRect, aFtRect); - } - - // draw page's reduced outline, only outline - drawFillAttributes(rRenderContext, drawinglayer::attribute::SdrAllFillAttributesHelperPtr(), aRect, aRect); - } - else - { - // draw PageFill and outline - drawFillAttributes(rRenderContext, maPageFillAttributes, aRect, aRect); - } -} - -void SvxPageWindow::drawFillAttributes(vcl::RenderContext& rRenderContext, - const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes, - const tools::Rectangle& rPaintRange, - const tools::Rectangle& rDefineRange) -{ - const basegfx::B2DRange aPaintRange( - rPaintRange.Left(), - rPaintRange.Top(), - rPaintRange.Right(), - rPaintRange.Bottom()); - - if(!aPaintRange.isEmpty() && - !basegfx::fTools::equalZero(aPaintRange.getWidth()) && - !basegfx::fTools::equalZero(aPaintRange.getHeight())) - { - const basegfx::B2DRange aDefineRange( - rDefineRange.Left(), - rDefineRange.Top(), - rDefineRange.Right(), - rDefineRange.Bottom()); - - // prepare primitive sequence - drawinglayer::primitive2d::Primitive2DContainer aSequence; - - // create fill geometry if there is something to fill - if (rFillAttributes.get() && rFillAttributes->isUsed()) - { - aSequence = rFillAttributes->getPrimitive2DSequence(aPaintRange, aDefineRange); - } - - // create line geometry if a LineColor is set at the target device - if (rRenderContext.IsLineColor()) - { - const drawinglayer::primitive2d::Primitive2DReference xOutline( - new drawinglayer::primitive2d::PolygonHairlinePrimitive2D( - basegfx::utils::createPolygonFromRect(aPaintRange), GetLineColor().getBColor())); - - aSequence.push_back(xOutline); - } - - // draw that if we have something to draw - if (!aSequence.empty()) - { - const drawinglayer::geometry::ViewInformation2D aViewInformation2D( - basegfx::B2DHomMatrix(), GetViewTransformation(), aPaintRange, nullptr, - 0.0, css::uno::Sequence<css::beans::PropertyValue >()); - - std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor( - drawinglayer::processor2d::createProcessor2DFromOutputDevice(rRenderContext, aViewInformation2D)); - if (pProcessor) - { - pProcessor->process(aSequence); - } - } - } -} - - -Size SvxPageWindow::GetOptimalSize() const -{ - return LogicToPixel(Size(75, 46), MapMode(MapUnit::MapAppFont)); -} - PageWindow::PageWindow() : aWinSize(), aSize(), diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index 9d6e4dbf147c..a1b670d2dcbc 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -407,7 +407,7 @@ public: virtual VclPtr<VclAbstractDialog> CreateSwSortingDialog(weld::Window * pParent, SwWrtShell &rSh) = 0; virtual VclPtr<VclAbstractDialog> CreateSwTableHeightDialog(weld::Window *pParent, SwWrtShell &rSh) = 0; - virtual VclPtr<VclAbstractDialog> CreateSwColumnDialog(vcl::Window *pParent, SwWrtShell &rSh) = 0; + virtual VclPtr<VclAbstractDialog> CreateSwColumnDialog(weld::Window *pParent, SwWrtShell &rSh) = 0; virtual VclPtr<AbstractSplitTableDialog> CreateSplitTableDialog(weld::Window* pParent, SwWrtShell &rSh) = 0; virtual VclPtr<AbstractSwAutoFormatDlg> CreateSwAutoFormatDlg(weld::Window* pParent, SwWrtShell* pShell, diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index f6faaabc74a8..413f886a78b4 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -119,6 +119,10 @@ short AbstractGenericDialog_Impl::Execute() { return m_xDlg->run(); } +bool AbstractGenericDialog_Impl::StartExecuteAsync(AsyncContext &rCtx) +{ + return weld::GenericDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn); +} short AbstractSwSortDlg_Impl::Execute() { return m_xDlg->execute(); @@ -820,10 +824,9 @@ VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwAutoMarkDialog(v return VclPtr<VclAbstractDialog_Impl>::Create( pDlg ); } -VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwColumnDialog(vcl::Window *pParent, SwWrtShell &rSh) +VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwColumnDialog(weld::Window *pParent, SwWrtShell &rSh) { - VclPtr<Dialog> pDlg = VclPtr<SwColumnDlg>::Create( pParent, rSh ); - return VclPtr<VclAbstractDialog_Impl>::Create( pDlg ); + return VclPtr<AbstractGenericDialog_Impl>::Create(o3tl::make_unique<SwColumnDlg>(pParent, rSh)); } VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwTableHeightDialog(weld::Window *pParent, SwWrtShell &rSh) diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index 0e13836afdd1..c7315197ecb5 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -115,13 +115,14 @@ class VclAbstractDialog_Impl : public VclAbstractDialog class AbstractGenericDialog_Impl : public VclAbstractDialog { protected: - std::unique_ptr<weld::GenericDialogController> m_xDlg; + std::shared_ptr<weld::GenericDialogController> m_xDlg; public: explicit AbstractGenericDialog_Impl(std::unique_ptr<weld::GenericDialogController> p) : m_xDlg(std::move(p)) { } virtual short Execute() override; + virtual bool StartExecuteAsync(AsyncContext &rCtx) override; }; class AbstractSwSortDlg_Impl : public VclAbstractDialog @@ -583,7 +584,7 @@ public: virtual VclPtr<AbstractSwSelGlossaryDlg> CreateSwSelGlossaryDlg(const OUString &rShortName) override; virtual VclPtr<VclAbstractDialog> CreateSwSortingDialog(weld::Window * pParent, SwWrtShell &rSh) override; virtual VclPtr<VclAbstractDialog> CreateSwTableHeightDialog(weld::Window *pParent, SwWrtShell &rSh) override; - virtual VclPtr<VclAbstractDialog> CreateSwColumnDialog(vcl::Window *pParent, SwWrtShell &rSh) override; + virtual VclPtr<VclAbstractDialog> CreateSwColumnDialog(weld::Window *pParent, SwWrtShell &rSh) override; virtual VclPtr<AbstractSplitTableDialog> CreateSplitTableDialog(weld::Window* pParent, SwWrtShell &rSh) override; virtual VclPtr<AbstractSwAutoFormatDlg> CreateSwAutoFormatDlg(weld::Window* pParent, SwWrtShell* pShell, diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx index 8232edfca584..205510a2d8d0 100644 --- a/sw/source/ui/frmdlg/column.cxx +++ b/sw/source/ui/frmdlg/column.cxx @@ -83,8 +83,8 @@ inline bool IsMarkInSameSection( SwWrtShell& rWrtSh, const SwSection* pSect ) return bRet; } -SwColumnDlg::SwColumnDlg(vcl::Window* pParent, SwWrtShell& rSh) - : SfxModalDialog(pParent, "ColumnDialog", "modules/swriter/ui/columndialog.ui") +SwColumnDlg::SwColumnDlg(weld::Window* pParent, SwWrtShell& rSh) + : weld::GenericDialogController(pParent, "modules/swriter/ui/columndialog.ui", "ColumnDialog") , m_rWrtShell(rSh) , m_pPageSet(nullptr) , m_pSectionSet(nullptr) @@ -96,6 +96,8 @@ SwColumnDlg::SwColumnDlg(vcl::Window* pParent, SwWrtShell& rSh) , m_bSectionChanged(false) , m_bSelSectionChanged(false) , m_bFrameChanged(false) + , m_xContentArea(m_xDialog->weld_content_area()) + , m_xOkButton(m_xBuilder->weld_button("ok")) { SwRect aRect; m_rWrtShell.CalcBoundRect(aRect, RndStdIds::FLY_AS_CHAR); @@ -162,52 +164,47 @@ SwColumnDlg::SwColumnDlg(vcl::Window* pParent, SwWrtShell& rSh) assert(pColPgSet); // create TabPage - m_pTabPage = static_cast<SwColumnPage*>( SwColumnPage::Create(get_content_area(), pColPgSet).get() ); - m_pTabPage->get<vcl::Window>("applytoft")->Show(); - m_pTabPage->get(m_pApplyToLB, "applytolb"); - m_pApplyToLB->Show(); + m_pTabPage = static_cast<SwColumnPage*>(SwColumnPage::Create(m_xContentArea.get(), pColPgSet).get()); + m_pTabPage->GetApplyLabel()->show(); + weld::ComboBoxText* pApplyToLB = m_pTabPage->GetApplyComboBox(); + pApplyToLB->show(); if (pCurrSection && (!m_rWrtShell.HasSelection() || 0 != nFullSectCnt)) { - m_pApplyToLB->RemoveEntry( m_pApplyToLB->GetEntryPos( - reinterpret_cast<void*>(static_cast<sal_IntPtr>( 1 >= nFullSectCnt - ? LISTBOX_SECTIONS - : LISTBOX_SECTION )))); + pApplyToLB->remove_id(1 >= nFullSectCnt ? OUString::number(LISTBOX_SECTIONS) : OUString::number(LISTBOX_SECTION)); } else { - m_pApplyToLB->RemoveEntry(m_pApplyToLB->GetEntryPos( reinterpret_cast<void*>(sal_IntPtr(LISTBOX_SECTION)) )); - m_pApplyToLB->RemoveEntry(m_pApplyToLB->GetEntryPos( reinterpret_cast<void*>(sal_IntPtr(LISTBOX_SECTIONS)) )); + pApplyToLB->remove_id(OUString::number(LISTBOX_SECTION)); + pApplyToLB->remove_id(OUString::number(LISTBOX_SECTIONS)); } if (!( m_rWrtShell.HasSelection() && m_rWrtShell.IsInsRegionAvailable() && ( !pCurrSection || ( 1 != nFullSectCnt && IsMarkInSameSection( m_rWrtShell, pCurrSection ) )))) - m_pApplyToLB->RemoveEntry(m_pApplyToLB->GetEntryPos( reinterpret_cast<void*>(sal_IntPtr(LISTBOX_SELECTION)) )); + pApplyToLB->remove_id(OUString::number(LISTBOX_SELECTION)); if (!m_rWrtShell.GetFlyFrameFormat()) - m_pApplyToLB->RemoveEntry(m_pApplyToLB->GetEntryPos( reinterpret_cast<void*>(LISTBOX_FRAME) )); + pApplyToLB->remove_id(OUString::number(LISTBOX_FRAME)); - const sal_Int32 nPagePos = m_pApplyToLB->GetEntryPos( reinterpret_cast<void*>(LISTBOX_PAGE) ); + const int nPagePos = pApplyToLB->find_id(OUString::number(LISTBOX_PAGE)); if (m_pPageSet && pPageDesc) { - const OUString sPageStr = m_pApplyToLB->GetEntry(nPagePos) + pPageDesc->GetName(); - m_pApplyToLB->RemoveEntry(nPagePos); - m_pApplyToLB->InsertEntry( sPageStr, nPagePos ); - m_pApplyToLB->SetEntryData( nPagePos, reinterpret_cast<void*>(LISTBOX_PAGE)); + const OUString sPageStr = pApplyToLB->get_text(nPagePos) + pPageDesc->GetName(); + pApplyToLB->remove(nPagePos); + pApplyToLB->insert(nPagePos, OUString::number(LISTBOX_PAGE), sPageStr); } else - m_pApplyToLB->RemoveEntry( nPagePos ); + pApplyToLB->remove( nPagePos ); - m_pApplyToLB->SelectEntryPos(0); + pApplyToLB->set_active(0); ObjectHdl(nullptr); - m_pApplyToLB->SetSelectHdl(LINK(this, SwColumnDlg, ObjectListBoxHdl)); - OKButton *pOK = get<OKButton>("ok"); - pOK->SetClickHdl(LINK(this, SwColumnDlg, OkHdl)); + pApplyToLB->connect_changed(LINK(this, SwColumnDlg, ObjectListBoxHdl)); + m_xOkButton->connect_clicked(LINK(this, SwColumnDlg, OkHdl)); //#i80458# if no columns can be set then disable OK - if( !m_pApplyToLB->GetEntryCount() ) - pOK->Enable( false ); + if (!pApplyToLB->get_count()) + m_xOkButton->set_sensitive(false); //#i97810# set focus to the TabPage m_pTabPage->ActivateColumnControl(); m_pTabPage->Show(); @@ -215,33 +212,24 @@ SwColumnDlg::SwColumnDlg(vcl::Window* pParent, SwWrtShell& rSh) SwColumnDlg::~SwColumnDlg() { - disposeOnce(); -} - -void SwColumnDlg::dispose() -{ m_pTabPage.disposeAndClear(); - m_pPageSet.reset(); - m_pSectionSet.reset(); - m_pSelectionSet.reset(); - m_pApplyToLB.clear(); - SfxModalDialog::dispose(); } -IMPL_LINK(SwColumnDlg, ObjectListBoxHdl, ListBox&, rBox, void) +IMPL_LINK(SwColumnDlg, ObjectListBoxHdl, weld::ComboBoxText&, rBox, void) { ObjectHdl(&rBox); } -void SwColumnDlg::ObjectHdl(ListBox const * pBox) +void SwColumnDlg::ObjectHdl(const weld::ComboBoxText* pBox) { SfxItemSet* pSet = EvalCurrentSelection(); - if(pBox) + if (pBox) { m_pTabPage->FillItemSet(pSet); } - m_nOldSelection = reinterpret_cast<sal_IntPtr>(m_pApplyToLB->GetSelectedEntryData()); + weld::ComboBoxText* pApplyToLB = m_pTabPage->GetApplyComboBox(); + m_nOldSelection = pApplyToLB->get_active_id().toInt32(); long nWidth = m_nSelectionWidth; switch(m_nOldSelection) { @@ -274,7 +262,7 @@ void SwColumnDlg::ObjectHdl(ListBox const * pBox) m_pTabPage->Reset(pSet); } -IMPL_LINK_NOARG(SwColumnDlg, OkHdl, Button*, void) +IMPL_LINK_NOARG(SwColumnDlg, OkHdl, weld::Button&, void) { // evaluate current selection SfxItemSet* pSet = EvalCurrentSelection(); @@ -329,7 +317,7 @@ IMPL_LINK_NOARG(SwColumnDlg, OkHdl, Button*, void) m_rWrtShell.Pop(); m_rWrtShell.EndAction(); } - EndDialog(RET_OK); + m_xDialog->response(RET_OK); } SfxItemSet* SwColumnDlg::EvalCurrentSelection(void) @@ -382,7 +370,7 @@ void SwColumnPage::ResetColWidth() { if( m_nCols ) { - const sal_uInt16 nWidth = GetMaxWidth( m_pColMgr.get(), m_nCols ) / m_nCols; + const sal_uInt16 nWidth = GetMaxWidth( m_xColMgr.get(), m_nCols ) / m_nCols; for(sal_uInt16 i = 0; i < m_nCols; ++i) m_nColWidth[i] = static_cast<long>(nWidth); @@ -391,9 +379,9 @@ void SwColumnPage::ResetColWidth() } // Now as TabPage -SwColumnPage::SwColumnPage(vcl::Window *pParent, const SfxItemSet &rSet) - : SfxTabPage(pParent, "ColumnPage", "modules/swriter/ui/columnpage.ui", &rSet) - , m_pColMgr(nullptr) +SwColumnPage::SwColumnPage(TabPageParent pParent, const SfxItemSet &rSet) + : SfxTabPage(pParent, "modules/swriter/ui/columnpage.ui", "ColumnPage", &rSet) + , m_xColMgr(nullptr) , m_nFirstVis(0) , m_nMinWidth(MINLAY) , m_pModifiedField(nullptr) @@ -401,45 +389,50 @@ SwColumnPage::SwColumnPage(vcl::Window *pParent, const SfxItemSet &rSet) , m_bFrame(false) , m_bHtmlMode(false) , m_bLockUpdate(false) + , m_xCLNrEdt(m_xBuilder->weld_spin_button("colsnf")) + , m_xBalanceColsCB(m_xBuilder->weld_check_button("balance")) + , m_xBtnBack(m_xBuilder->weld_button("back")) + , m_xLbl1(m_xBuilder->weld_label("1")) + , m_xLbl2(m_xBuilder->weld_label("2")) + , m_xLbl3(m_xBuilder->weld_label("3")) + , m_xBtnNext(m_xBuilder->weld_button("next")) + , m_xAutoWidthBox(m_xBuilder->weld_check_button("autowidth")) + , m_xLineTypeLbl(m_xBuilder->weld_label("linestyleft")) + , m_xLineWidthLbl(m_xBuilder->weld_label("linewidthft")) + , m_xLineWidthEdit(m_xBuilder->weld_metric_spin_button("linewidthmf", FUNIT_POINT)) + , m_xLineColorLbl(m_xBuilder->weld_label("linecolorft")) + , m_xLineHeightLbl(m_xBuilder->weld_label("lineheightft")) + , m_xLineHeightEdit(m_xBuilder->weld_metric_spin_button("lineheightmf", FUNIT_PERCENT)) + , m_xLinePosLbl(m_xBuilder->weld_label("lineposft")) + , m_xLinePosDLB(m_xBuilder->weld_combo_box_text("lineposlb")) + , m_xTextDirectionFT(m_xBuilder->weld_label("textdirectionft")) + , m_xTextDirectionLB(new svx::SvxFrameDirectionListBox(m_xBuilder->weld_combo_box_text("textdirectionlb"))) + , m_xLineColorDLB(new ColorListBox(m_xBuilder->weld_menu_button("colorlb"), GetFrameWeld())) + , m_xLineTypeDLB(new SvtLineListBox(m_xBuilder->weld_menu_button("linestylelb"))) + , m_xEd1(new SwPercentField(m_xBuilder->weld_metric_spin_button("width1mf", FUNIT_CM))) + , m_xEd2(new SwPercentField(m_xBuilder->weld_metric_spin_button("width2mf", FUNIT_CM))) + , m_xEd3(new SwPercentField(m_xBuilder->weld_metric_spin_button("width3mf", FUNIT_CM))) + , m_xDistEd1(new SwPercentField(m_xBuilder->weld_metric_spin_button("spacing1mf", FUNIT_CM))) + , m_xDistEd2(new SwPercentField(m_xBuilder->weld_metric_spin_button("spacing2mf", FUNIT_CM))) + , m_xDefaultVS(new weld::CustomWeld(*m_xBuilder, "valueset", m_aDefaultVS)) + , m_xPgeExampleWN(new weld::CustomWeld(*m_xBuilder, "pageexample", m_aPgeExampleWN)) + , m_xFrameExampleWN(new weld::CustomWeld(*m_xBuilder, "frameexample", m_aFrameExampleWN)) + , m_xApplyToFT(m_xBuilder->weld_label("applytoft")) + , m_xApplyToLB(m_xBuilder->weld_combo_box_text("applytolb")) { - get(m_pCLNrEdt, "colsnf"); - get(m_pBalanceColsCB, "balance"); - get(m_pBtnBack, "back"); - get(m_pLbl1, "1"); - get(m_pLbl2, "2"); - get(m_pLbl3, "3"); - get(m_pBtnNext, "next"); - get(m_pAutoWidthBox, "autowidth"); - get(m_pLineTypeLbl, "linestyleft"); - get(m_pLineWidthLbl, "linewidthft"); - get(m_pLineWidthEdit, "linewidthmf"); - get(m_pLineColorLbl, "linecolorft"); - get(m_pLineHeightLbl, "lineheightft"); - get(m_pLineHeightEdit, "lineheightmf"); - get(m_pLinePosLbl, "lineposft"); - get(m_pLinePosDLB, "lineposlb"); - get(m_pTextDirectionFT, "textdirectionft"); - get(m_pTextDirectionLB, "textdirectionlb"); - get(m_pLineColorDLB, "colorlb"); - get(m_pLineTypeDLB, "linestylelb"); - - get(m_pDefaultVS, "valueset"); - get(m_pPgeExampleWN, "pageexample"); - get(m_pFrameExampleWN, "frameexample"); - - connectPercentField(m_aEd1, "width1mf"); - connectPercentField(m_aEd2, "width2mf"); - connectPercentField(m_aEd3, "width3mf"); - connectPercentField(m_aDistEd1, "spacing1mf"); - connectPercentField(m_aDistEd2, "spacing2mf"); - - m_pTextDirectionLB->InsertEntryValue( SvxResId( RID_SVXSTR_FRAMEDIR_LTR ), SvxFrameDirection::Horizontal_LR_TB ); - m_pTextDirectionLB->InsertEntryValue( SvxResId( RID_SVXSTR_FRAMEDIR_RTL ), SvxFrameDirection::Horizontal_RL_TB ); - m_pTextDirectionLB->InsertEntryValue( SvxResId( RID_SVXSTR_FRAMEDIR_SUPER ), SvxFrameDirection::Environment ); + connectPercentField(*m_xEd1); + connectPercentField(*m_xEd2); + connectPercentField(*m_xEd3); + connectPercentField(*m_xDistEd1); + connectPercentField(*m_xDistEd2); + + m_xTextDirectionLB->append(SvxFrameDirection::Horizontal_LR_TB, SvxResId(RID_SVXSTR_FRAMEDIR_LTR)); + m_xTextDirectionLB->append(SvxFrameDirection::Horizontal_RL_TB, SvxResId(RID_SVXSTR_FRAMEDIR_RTL)); + m_xTextDirectionLB->append(SvxFrameDirection::Environment, SvxResId(RID_SVXSTR_FRAMEDIR_SUPER)); SetExchangeSupport(); - m_pDefaultVS->SetColCount( 5 ); + m_aDefaultVS.SetColCount(5); for (int i = 0; i < 5; ++i) //Set accessible name one by one @@ -463,57 +456,55 @@ SwColumnPage::SwColumnPage(vcl::Window *pParent, const SfxItemSet &rSet) aItemText = SwResId( STR_COLUMN_VALUESET_ITEM4 ); break; } - m_pDefaultVS->InsertItem( i + 1, aItemText, i ); + m_aDefaultVS.InsertItem( i + 1, aItemText, i ); } - m_pDefaultVS->SetSelectHdl(LINK(this, SwColumnPage, SetDefaultsHdl)); + m_aDefaultVS.SetSelectHdl(LINK(this, SwColumnPage, SetDefaultsHdl)); - Link<Edit&,void> aCLNrLk = LINK(this, SwColumnPage, ColModify); - m_pCLNrEdt->SetModifyHdl(aCLNrLk); - Link<Edit&,void> aLk = LINK(this, SwColumnPage, GapModify); - m_aDistEd1.SetModifyHdl(aLk); - m_aDistEd2.SetModifyHdl(aLk); + Link<weld::SpinButton&,void> aCLNrLk = LINK(this, SwColumnPage, ColModify); + m_xCLNrEdt->connect_value_changed(aCLNrLk); + Link<weld::MetricSpinButton&,void> aLk = LINK(this, SwColumnPage, GapModify); + m_xDistEd1->connect_value_changed(aLk); + m_xDistEd2->connect_value_changed(aLk); aLk = LINK(this, SwColumnPage, EdModify); - m_aEd1.SetModifyHdl(aLk); - - m_aEd2.SetModifyHdl(aLk); - - m_aEd3.SetModifyHdl(aLk); + m_xEd1->connect_value_changed(aLk); + m_xEd2->connect_value_changed(aLk); + m_xEd3->connect_value_changed(aLk); - m_pBtnBack->SetClickHdl(LINK(this, SwColumnPage, Up)); - m_pBtnNext->SetClickHdl(LINK(this, SwColumnPage, Down)); - m_pAutoWidthBox->SetClickHdl(LINK(this, SwColumnPage, AutoWidthHdl)); + m_xBtnBack->connect_clicked(LINK(this, SwColumnPage, Up)); + m_xBtnNext->connect_clicked(LINK(this, SwColumnPage, Down)); + m_xAutoWidthBox->connect_toggled(LINK(this, SwColumnPage, AutoWidthHdl)); - aLk = LINK( this, SwColumnPage, UpdateColMgr ); - m_pLineTypeDLB->SetSelectHdl(LINK(this, SwColumnPage, UpdateColMgrListBox)); - m_pLineWidthEdit->SetModifyHdl( aLk ); - m_pLineColorDLB->SetSelectHdl(LINK( this, SwColumnPage, UpdateColMgrColorBox)); - m_pLineHeightEdit->SetModifyHdl( aLk ); - m_pLinePosDLB->SetSelectHdl(LINK(this, SwColumnPage, UpdateColMgrListBox)); + Link<weld::MetricSpinButton&,void> aLk2 = LINK( this, SwColumnPage, UpdateColMgr ); + m_xLineTypeDLB->SetSelectHdl(LINK(this, SwColumnPage, UpdateColMgrLineBox)); + m_xLineWidthEdit->connect_value_changed(aLk2); + m_xLineColorDLB->SetSelectHdl(LINK( this, SwColumnPage, UpdateColMgrColorBox)); + m_xLineHeightEdit->connect_value_changed(aLk2); + m_xLinePosDLB->connect_changed(LINK(this, SwColumnPage, UpdateColMgrListBox)); // Separator line - m_pLineTypeDLB->SetSourceUnit( FUNIT_TWIP ); + m_xLineTypeDLB->SetSourceUnit( FUNIT_TWIP ); // Fill the line styles listbox - m_pLineTypeDLB->SetNone( SvxResId( RID_SVXSTR_NONE ) ); - m_pLineTypeDLB->InsertEntry( + m_xLineTypeDLB->InsertEntry( ::editeng::SvxBorderLine::getWidthImpl(SvxBorderLineStyle::SOLID), SvxBorderLineStyle::SOLID ); - m_pLineTypeDLB->InsertEntry( + m_xLineTypeDLB->InsertEntry( ::editeng::SvxBorderLine::getWidthImpl(SvxBorderLineStyle::DOTTED), SvxBorderLineStyle::DOTTED ); - m_pLineTypeDLB->InsertEntry( + m_xLineTypeDLB->InsertEntry( ::editeng::SvxBorderLine::getWidthImpl(SvxBorderLineStyle::DASHED), SvxBorderLineStyle::DASHED ); - long nLineWidth = static_cast<long>(MetricField::ConvertDoubleValue( - m_pLineWidthEdit->GetValue( ), - m_pLineWidthEdit->GetDecimalDigits( ), - m_pLineWidthEdit->GetUnit(), MapUnit::MapTwip )); - m_pLineTypeDLB->SetWidth( nLineWidth ); - m_pLineColorDLB->SelectEntry(COL_BLACK); + sal_Int64 nLineWidth = m_xLineWidthEdit->get_value(FUNIT_POINT); + nLineWidth = static_cast<long>(MetricField::ConvertDoubleValue( + nLineWidth, + m_xLineWidthEdit->get_digits(), + FUNIT_POINT, MapUnit::MapTwip )); + m_xLineTypeDLB->SetWidth(nLineWidth); + m_xLineColorDLB->SelectEntry(COL_BLACK); } SwColumnPage::~SwColumnPage() @@ -523,50 +514,35 @@ SwColumnPage::~SwColumnPage() void SwColumnPage::dispose() { - m_pColMgr.reset(); - m_pCLNrEdt.clear(); - m_pDefaultVS.clear(); - m_pBalanceColsCB.clear(); - m_pBtnBack.clear(); - m_pLbl1.clear(); - m_pLbl2.clear(); - m_pLbl3.clear(); - m_pBtnNext.clear(); - m_pAutoWidthBox.clear(); - m_pLineTypeLbl.clear(); - m_pLineTypeDLB.clear(); - m_pLineWidthLbl.clear(); - m_pLineWidthEdit.clear(); - m_pLineColorLbl.clear(); - m_pLineColorDLB.clear(); - m_pLineHeightLbl.clear(); - m_pLineHeightEdit.clear(); - m_pLinePosLbl.clear(); - m_pLinePosDLB.clear(); - m_pTextDirectionFT.clear(); - m_pTextDirectionLB.clear(); - m_pPgeExampleWN.clear(); - m_pFrameExampleWN.clear(); - m_aPercentFieldsMap.clear(); + m_xFrameExampleWN.reset(); + m_xPgeExampleWN.reset(); + m_xDefaultVS.reset(); + m_xDistEd2.reset(); + m_xDistEd1.reset(); + m_xEd3.reset(); + m_xEd2.reset(); + m_xEd1.reset(); + m_xLineTypeDLB.reset(); + m_xLineColorDLB.reset(); + m_xTextDirectionLB.reset(); SfxTabPage::dispose(); } void SwColumnPage::SetPageWidth(long nPageWidth) { - long nNewMaxWidth = static_cast< long >(m_aEd1.NormalizePercent(nPageWidth)); + long nNewMaxWidth = static_cast< long >(m_xEd1->NormalizePercent(nPageWidth)); - m_aDistEd1.SetMax(nNewMaxWidth, FUNIT_TWIP); - m_aDistEd2.SetMax(nNewMaxWidth, FUNIT_TWIP); - m_aEd1.SetMax(nNewMaxWidth, FUNIT_TWIP); - m_aEd2.SetMax(nNewMaxWidth, FUNIT_TWIP); - m_aEd3.SetMax(nNewMaxWidth, FUNIT_TWIP); + m_xDistEd1->set_max(nNewMaxWidth, FUNIT_TWIP); + m_xDistEd2->set_max(nNewMaxWidth, FUNIT_TWIP); + m_xEd1->set_max(nNewMaxWidth, FUNIT_TWIP); + m_xEd2->set_max(nNewMaxWidth, FUNIT_TWIP); + m_xEd3->set_max(nNewMaxWidth, FUNIT_TWIP); } -void SwColumnPage::connectPercentField(PercentField &rWrap, const OString &rName) +void SwColumnPage::connectPercentField(SwPercentField &rWrap) { - MetricField *pField = get<MetricField>(rName); + weld::MetricSpinButton *pField = rWrap.get(); assert(pField); - rWrap.set(pField); m_aPercentFieldsMap[pField] = &rWrap; } @@ -577,41 +553,40 @@ void SwColumnPage::Reset(const SfxItemSet *rSet) if(nHtmlMode & HTMLMODE_ON) { m_bHtmlMode = true; - m_pAutoWidthBox->Enable(false); + m_xAutoWidthBox->set_sensitive(false); } FieldUnit aMetric = ::GetDfltMetric(m_bHtmlMode); - m_aEd1.SetMetric(aMetric); - m_aEd2.SetMetric(aMetric); - m_aEd3.SetMetric(aMetric); - m_aDistEd1.SetMetric(aMetric); - m_aDistEd2.SetMetric(aMetric); + m_xEd1->SetMetric(aMetric); + m_xEd2->SetMetric(aMetric); + m_xEd3->SetMetric(aMetric); + m_xDistEd1->SetMetric(aMetric); + m_xDistEd2->SetMetric(aMetric); //default spacing between cols = 0.5cm - m_aDistEd1.SetPrcntValue(50, FUNIT_CM); - m_aDistEd2.SetPrcntValue(50, FUNIT_CM); + m_xDistEd1->SetPrcntValue(50, FUNIT_CM); + m_xDistEd2->SetPrcntValue(50, FUNIT_CM); - m_pColMgr.reset(new SwColMgr(*rSet)); - m_nCols = m_pColMgr->GetCount() ; - m_pCLNrEdt->SetMax(std::max(static_cast<sal_uInt16>(m_pCLNrEdt->GetMax()), m_nCols)); - m_pCLNrEdt->SetLast(std::max(m_nCols,static_cast<sal_uInt16>(m_pCLNrEdt->GetMax()))); + m_xColMgr.reset(new SwColMgr(*rSet)); + m_nCols = m_xColMgr->GetCount() ; + m_xCLNrEdt->set_max(std::max(static_cast<sal_uInt16>(m_xCLNrEdt->get_max()), m_nCols)); if(m_bFrame) { if(m_bFormat) // there is no size here - m_pColMgr->SetActualWidth(FRAME_FORMAT_WIDTH); + m_xColMgr->SetActualWidth(FRAME_FORMAT_WIDTH); else { const SwFormatFrameSize& rSize = rSet->Get(RES_FRM_SIZE); const SvxBoxItem& rBox = rSet->Get(RES_BOX); - m_pColMgr->SetActualWidth(static_cast<sal_uInt16>(rSize.GetSize().Width()) - rBox.GetSmallestDistance()); + m_xColMgr->SetActualWidth(static_cast<sal_uInt16>(rSize.GetSize().Width()) - rBox.GetSmallestDistance()); } } - if(m_pBalanceColsCB->IsVisible()) + if (m_xBalanceColsCB->get_visible()) { const SfxPoolItem* pItem; if( SfxItemState::SET == rSet->GetItemState( RES_COLUMNBALANCE, false, &pItem )) - m_pBalanceColsCB->Check(!static_cast<const SwFormatNoBalancedColumns*>(pItem)->GetValue()); + m_xBalanceColsCB->set_active(!static_cast<const SwFormatNoBalancedColumns*>(pItem)->GetValue()); else - m_pBalanceColsCB->Check(); + m_xBalanceColsCB->set_active(true); } //text direction @@ -619,9 +594,8 @@ void SwColumnPage::Reset(const SfxItemSet *rSet) { const SvxFrameDirectionItem& rItem = rSet->Get(RES_FRAMEDIR); SvxFrameDirection nVal = rItem.GetValue(); - const sal_Int32 nPos = m_pTextDirectionLB->GetEntryPos( reinterpret_cast<void*>(nVal) ); - m_pTextDirectionLB->SelectEntryPos( nPos ); - m_pTextDirectionLB->SaveValue(); + m_xTextDirectionLB->set_active_id(nVal); + m_xTextDirectionLB->save_value(); } Init(); @@ -631,56 +605,56 @@ void SwColumnPage::Reset(const SfxItemSet *rSet) // create TabPage VclPtr<SfxTabPage> SwColumnPage::Create(TabPageParent pParent, const SfxItemSet *rSet) { - return VclPtr<SwColumnPage>::Create(pParent.pParent, *rSet); + return VclPtr<SwColumnPage>::Create(pParent, *rSet); } // stuff attributes into the Set when OK bool SwColumnPage::FillItemSet(SfxItemSet *rSet) { - if(m_pCLNrEdt->HasChildPathFocus()) - m_pCLNrEdt->GetDownHdl().Call(*m_pCLNrEdt); // set in ItemSet; // the current settings are already present const SfxPoolItem* pOldItem; - const SwFormatCol& rCol = m_pColMgr->GetColumns(); + const SwFormatCol& rCol = m_xColMgr->GetColumns(); if(nullptr == (pOldItem = GetOldItem( *rSet, RES_COL )) || rCol != *pOldItem ) rSet->Put(rCol); - if(m_pBalanceColsCB->IsVisible() ) + if (m_xBalanceColsCB->get_visible()) { - rSet->Put(SwFormatNoBalancedColumns(!m_pBalanceColsCB->IsChecked() )); + rSet->Put(SwFormatNoBalancedColumns(!m_xBalanceColsCB->get_active())); } - if( m_pTextDirectionLB->IsVisible()) + if (m_xTextDirectionLB->get_visible()) { - const sal_Int32 nPos = m_pTextDirectionLB->GetSelectedEntryPos(); - if ( m_pTextDirectionLB->IsValueChangedFromSaved() ) + if (m_xTextDirectionLB->get_value_changed_from_saved()) { - SvxFrameDirection eDirection = static_cast<SvxFrameDirection>( - reinterpret_cast<sal_IntPtr>(m_pTextDirectionLB->GetEntryData( nPos ))); - rSet->Put( SvxFrameDirectionItem(eDirection, RES_FRAMEDIR) ); + rSet->Put(SvxFrameDirectionItem(m_xTextDirectionLB->get_active_id(), RES_FRAMEDIR) ); } } return true; } // update ColumnManager -IMPL_LINK_NOARG( SwColumnPage, UpdateColMgrListBox, ListBox&, void ) +IMPL_LINK_NOARG( SwColumnPage, UpdateColMgrListBox, weld::ComboBoxText&, void ) { - UpdateColMgr(*m_pLineWidthEdit); + UpdateColMgr(*m_xLineWidthEdit); } -IMPL_LINK_NOARG( SwColumnPage, UpdateColMgrColorBox, SvxColorListBox&, void ) +IMPL_LINK_NOARG( SwColumnPage, UpdateColMgrLineBox, SvtLineListBox&, void ) { - UpdateColMgr(*m_pLineWidthEdit); + UpdateColMgr(*m_xLineWidthEdit); } -IMPL_LINK_NOARG( SwColumnPage, UpdateColMgr, Edit&, void ) +IMPL_LINK_NOARG( SwColumnPage, UpdateColMgrColorBox, ColorListBox&, void ) { - if (!m_pColMgr) + UpdateColMgr(*m_xLineWidthEdit); +} + +IMPL_LINK_NOARG( SwColumnPage, UpdateColMgr, weld::MetricSpinButton&, void ) +{ + if (!m_xColMgr) return; - long nGutterWidth = m_pColMgr->GetGutterWidth(); + long nGutterWidth = m_xColMgr->GetGutterWidth(); if (m_nCols > 1) { // Determine whether the most narrow column is too narrow @@ -690,10 +664,10 @@ IMPL_LINK_NOARG( SwColumnPage, UpdateColMgr, Edit&, void ) for( sal_uInt16 i = 1; i < m_nCols; ++i ) nMin = std::min(nMin, m_nColWidth[i]); - bool bAutoWidth = m_pAutoWidthBox->IsChecked(); + bool bAutoWidth = m_xAutoWidthBox->get_active(); if(!bAutoWidth) { - m_pColMgr->SetAutoWidth(false); + m_xColMgr->SetAutoWidth(false); // when the user didn't allocate the whole width, // add the missing amount to the last column. long nSum = 0; @@ -704,97 +678,95 @@ IMPL_LINK_NOARG( SwColumnPage, UpdateColMgr, Edit&, void ) nGutterWidth += m_nColDist[i]; nSum += nGutterWidth; - long nMaxW = m_pColMgr->GetActualSize(); + long nMaxW = m_xColMgr->GetActualSize(); if( nSum < nMaxW ) m_nColWidth[m_nCols - 1] += nMaxW - nSum; - m_pColMgr->SetColWidth( 0, static_cast< sal_uInt16 >(m_nColWidth[0] + m_nColDist[0]/2) ); + m_xColMgr->SetColWidth( 0, static_cast< sal_uInt16 >(m_nColWidth[0] + m_nColDist[0]/2) ); for( sal_uInt16 i = 1; i < m_nCols-1; ++i ) { long nActDist = (m_nColDist[i] + m_nColDist[i - 1]) / 2; - m_pColMgr->SetColWidth( i, static_cast< sal_uInt16 >(m_nColWidth[i] + nActDist )); + m_xColMgr->SetColWidth( i, static_cast< sal_uInt16 >(m_nColWidth[i] + nActDist )); } - m_pColMgr->SetColWidth( m_nCols-1, static_cast< sal_uInt16 >(m_nColWidth[m_nCols-1] + m_nColDist[m_nCols -2]/2) ); + m_xColMgr->SetColWidth( m_nCols-1, static_cast< sal_uInt16 >(m_nColWidth[m_nCols-1] + m_nColDist[m_nCols -2]/2) ); } bool bEnable = isLineNotNone(); - m_pLineHeightEdit->Enable( bEnable ); - m_pLineHeightLbl->Enable( bEnable ); - m_pLineWidthLbl->Enable( bEnable ); - m_pLineWidthEdit->Enable( bEnable ); - m_pLineColorDLB->Enable( bEnable ); - m_pLineColorLbl->Enable( bEnable ); - - long nLineWidth = static_cast<long>(MetricField::ConvertDoubleValue( - m_pLineWidthEdit->GetValue( ), - m_pLineWidthEdit->GetDecimalDigits( ), - m_pLineWidthEdit->GetUnit(), MapUnit::MapTwip )); + m_xLineHeightEdit->set_sensitive(bEnable); + m_xLineHeightLbl->set_sensitive(bEnable); + m_xLineWidthLbl->set_sensitive(bEnable); + m_xLineWidthEdit->set_sensitive(bEnable); + m_xLineColorDLB->set_sensitive(bEnable); + m_xLineColorLbl->set_sensitive(bEnable); + + sal_Int64 nLineWidth = m_xLineWidthEdit->get_value(FUNIT_PERCENT); + nLineWidth = static_cast<long>(MetricField::ConvertDoubleValue( + nLineWidth, + m_xLineWidthEdit->get_digits(), + m_xLineWidthEdit->get_unit(), MapUnit::MapTwip )); if( !bEnable ) - m_pColMgr->SetNoLine(); + m_xColMgr->SetNoLine(); else { - m_pColMgr->SetLineWidthAndColor( - m_pLineTypeDLB->GetSelectEntryStyle(), + m_xColMgr->SetLineWidthAndColor( + m_xLineTypeDLB->GetSelectEntryStyle(), nLineWidth, - m_pLineColorDLB->GetSelectEntryColor() ); - m_pColMgr->SetAdjust( SwColLineAdj( - m_pLinePosDLB->GetSelectedEntryPos() + 1) ); - m_pColMgr->SetLineHeightPercent(static_cast<short>(m_pLineHeightEdit->GetValue())); - bEnable = m_pColMgr->GetLineHeightPercent() != 100; + m_xLineColorDLB->GetSelectEntryColor() ); + m_xColMgr->SetAdjust(SwColLineAdj(m_xLinePosDLB->get_active() + 1)); + m_xColMgr->SetLineHeightPercent(static_cast<short>(m_xLineHeightEdit->get_value(FUNIT_PERCENT))); + bEnable = m_xColMgr->GetLineHeightPercent() != 100; } - m_pLinePosLbl->Enable( bEnable ); - m_pLinePosDLB->Enable( bEnable ); + m_xLinePosLbl->set_sensitive(bEnable); + m_xLinePosDLB->set_sensitive(bEnable); //fdo#66815 if the values are going to be the same, don't update //them to avoid the listbox selection resetting - if (nLineWidth != m_pLineTypeDLB->GetWidth()) - m_pLineTypeDLB->SetWidth(nLineWidth); - Color aColor(m_pLineColorDLB->GetSelectEntryColor()); - if (aColor != m_pLineTypeDLB->GetColor()) - m_pLineTypeDLB->SetColor(aColor); + if (nLineWidth != m_xLineTypeDLB->GetWidth()) + m_xLineTypeDLB->SetWidth(nLineWidth); + Color aColor(m_xLineColorDLB->GetSelectEntryColor()); + if (aColor != m_xLineTypeDLB->GetColor()) + m_xLineTypeDLB->SetColor(aColor); } else { - m_pColMgr->NoCols(); + m_xColMgr->NoCols(); m_nCols = 0; } //set maximum values - m_pCLNrEdt->SetMax(std::max(1L, - std::min(long(nMaxCols), long( m_pColMgr->GetActualSize() / (nGutterWidth + MINLAY)) ))); - m_pCLNrEdt->SetLast(m_pCLNrEdt->GetMax()); - m_pCLNrEdt->Reformat(); + m_xCLNrEdt->set_max(std::max(1L, + std::min(long(nMaxCols), long( m_xColMgr->GetActualSize() / (nGutterWidth + MINLAY)) ))); //prompt example window if(!m_bLockUpdate) { if(m_bFrame) { - m_pFrameExampleWN->SetColumns( m_pColMgr->GetColumns() ); - m_pFrameExampleWN->Invalidate(); + m_aFrameExampleWN.SetColumns(m_xColMgr->GetColumns()); + m_aFrameExampleWN.Invalidate(); } else - m_pPgeExampleWN->Invalidate(); + m_aPgeExampleWN.Invalidate(); } } void SwColumnPage::Init() { - m_pCLNrEdt->SetValue(m_nCols); + m_xCLNrEdt->set_value(m_nCols); - bool bAutoWidth = m_pColMgr->IsAutoWidth() || m_bHtmlMode; - m_pAutoWidthBox->Check( bAutoWidth ); + bool bAutoWidth = m_xColMgr->IsAutoWidth() || m_bHtmlMode; + m_xAutoWidthBox->set_active(bAutoWidth); sal_Int32 nColumnWidthSum = 0; // set the widths for(sal_uInt16 i = 0; i < m_nCols; ++i) { - m_nColWidth[i] = m_pColMgr->GetColWidth(i); + m_nColWidth[i] = m_xColMgr->GetColWidth(i); nColumnWidthSum += m_nColWidth[i]; if(i < m_nCols - 1) - m_nColDist[i] = m_pColMgr->GetGutterWidth(i); + m_nColDist[i] = m_xColMgr->GetGutterWidth(i); } if( 1 < m_nCols ) @@ -806,31 +778,31 @@ void SwColumnPage::Init() for(sal_uInt16 i = 0; i < m_nCols; ++i) m_nColWidth[i] = nColumnWidthSum; } - SwColLineAdj eAdj = m_pColMgr->GetAdjust(); + SwColLineAdj eAdj = m_xColMgr->GetAdjust(); if( COLADJ_NONE == eAdj ) // the dialog doesn't know a NONE! { eAdj = COLADJ_TOP; //without Adjust no line type - m_pLineTypeDLB->SelectEntryPos( 0 ); - m_pLineHeightEdit->SetValue( 100 ); + m_xLineTypeDLB->SelectEntry(SvxBorderLineStyle::NONE); + m_xLineHeightEdit->set_value(100, FUNIT_PERCENT); } else { // Need to multiply by 100 because of the 2 decimals - m_pLineWidthEdit->SetValue( m_pColMgr->GetLineWidth() * 100, FUNIT_TWIP ); - m_pLineColorDLB->SelectEntry( m_pColMgr->GetLineColor() ); - m_pLineTypeDLB->SelectEntry( m_pColMgr->GetLineStyle() ); - m_pLineTypeDLB->SetWidth( m_pColMgr->GetLineWidth( ) ); - m_pLineHeightEdit->SetValue( m_pColMgr->GetLineHeightPercent() ); + m_xLineWidthEdit->set_value( m_xColMgr->GetLineWidth() * 100, FUNIT_TWIP); + m_xLineColorDLB->SelectEntry( m_xColMgr->GetLineColor() ); + m_xLineTypeDLB->SelectEntry( m_xColMgr->GetLineStyle() ); + m_xLineTypeDLB->SetWidth( m_xColMgr->GetLineWidth( ) ); + m_xLineHeightEdit->set_value(m_xColMgr->GetLineHeightPercent(), FUNIT_PERCENT); } - m_pLinePosDLB->SelectEntryPos( static_cast< sal_Int32 >(eAdj - 1) ); + m_xLinePosDLB->set_active( static_cast< sal_Int32 >(eAdj - 1) ); } else { - m_pLinePosDLB->SelectEntryPos( 0 ); - m_pLineTypeDLB->SelectEntryPos( 0 ); - m_pLineHeightEdit->SetValue( 100 ); + m_xLinePosDLB->set_active(0); + m_xLineTypeDLB->SelectEntry(SvxBorderLineStyle::NONE); + m_xLineHeightEdit->set_value(100, FUNIT_PERCENT); } UpdateCols(); @@ -838,15 +810,14 @@ void SwColumnPage::Init() // set maximum number of columns // values below 1 are not allowed - m_pCLNrEdt->SetMax(std::max(1L, - std::min(long(nMaxCols), long( m_pColMgr->GetActualSize() / m_nMinWidth) ))); + m_xCLNrEdt->set_max(std::max(1L, + std::min(long(nMaxCols), long( m_xColMgr->GetActualSize() / m_nMinWidth) ))); } bool SwColumnPage::isLineNotNone() const { // nothing is turned off - const sal_Int32 nPos = m_pLineTypeDLB->GetSelectedEntryPos(); - return nPos != LISTBOX_ENTRY_NOTFOUND && nPos != 0; + return m_xLineTypeDLB->GetSelectEntryStyle() != SvxBorderLineStyle::NONE; } /* @@ -861,7 +832,7 @@ void SwColumnPage::UpdateCols() bool bEnableBtns= false; bool bEnable12 = false; bool bEnable3 = false; - const bool bEdit = !m_pAutoWidthBox->IsChecked(); + const bool bEdit = !m_xAutoWidthBox->get_active(); if ( m_nCols > nVisCols ) { bEnableBtns = !m_bHtmlMode; @@ -878,21 +849,21 @@ void SwColumnPage::UpdateCols() default: /* do nothing */; } } - m_aEd1.Enable( bEnable12 ); + m_xEd1->set_sensitive(bEnable12); bool bEnable = m_nCols > 1; - m_aDistEd1.Enable(bEnable); - m_pAutoWidthBox->Enable( bEnable && !m_bHtmlMode ); - m_aEd2.Enable( bEnable12 ); - m_aDistEd2.Enable(bEnable3); - m_aEd3.Enable( bEnable3 ); - m_pLbl1->Enable(bEnable12 ); - m_pLbl2->Enable(bEnable12 ); - m_pLbl3->Enable(bEnable3 ); - m_pBtnBack->Enable( bEnableBtns ); - m_pBtnNext->Enable( bEnableBtns ); - - m_pLineTypeDLB->Enable( bEnable ); - m_pLineTypeLbl->Enable( bEnable ); + m_xDistEd1->set_sensitive(bEnable); + m_xAutoWidthBox->set_sensitive(bEnable && !m_bHtmlMode); + m_xEd2->set_sensitive(bEnable12); + m_xDistEd2->set_sensitive(bEnable3); + m_xEd3->set_sensitive(bEnable3); + m_xLbl1->set_sensitive(bEnable12); + m_xLbl2->set_sensitive(bEnable12); + m_xLbl3->set_sensitive(bEnable3); + m_xBtnBack->set_sensitive(bEnableBtns); + m_xBtnNext->set_sensitive(bEnableBtns); + + m_xLineTypeDLB->set_sensitive( bEnable ); + m_xLineTypeLbl->set_sensitive( bEnable ); if (bEnable) { @@ -900,19 +871,19 @@ void SwColumnPage::UpdateCols() } //all these depend on > 1 column and line style != none - m_pLineHeightEdit->Enable( bEnable ); - m_pLineHeightLbl->Enable( bEnable ); - m_pLineWidthLbl->Enable( bEnable ); - m_pLineWidthEdit->Enable( bEnable ); - m_pLineColorDLB->Enable( bEnable ); - m_pLineColorLbl->Enable( bEnable ); + m_xLineHeightEdit->set_sensitive(bEnable); + m_xLineHeightLbl->set_sensitive(bEnable); + m_xLineWidthLbl->set_sensitive(bEnable); + m_xLineWidthEdit->set_sensitive(bEnable); + m_xLineColorDLB->set_sensitive(bEnable); + m_xLineColorLbl->set_sensitive(bEnable); if (bEnable) - bEnable = m_pColMgr->GetLineHeightPercent() != 100; + bEnable = m_xColMgr->GetLineHeightPercent() != 100; //and these additionally depend on line height != 100% - m_pLinePosDLB->Enable( bEnable ); - m_pLinePosLbl->Enable( bEnable ); + m_xLinePosDLB->set_sensitive(bEnable); + m_xLinePosLbl->set_sensitive(bEnable); } void SwColumnPage::SetLabels( sal_uInt16 nVis ) @@ -921,24 +892,24 @@ void SwColumnPage::SetLabels( sal_uInt16 nVis ) const OUString sLbl( '~' ); const OUString sLbl1(OUString::number( nVis + 1 )); - m_pLbl1->SetText(sLbl1.replaceAt(sLbl1.getLength()-1, 0, sLbl)); + m_xLbl1->set_label(sLbl1.replaceAt(sLbl1.getLength()-1, 0, sLbl)); const OUString sLbl2(OUString::number( nVis + 2 )); - m_pLbl2->SetText(sLbl2.replaceAt(sLbl2.getLength()-1, 0, sLbl)); + m_xLbl2->set_label(sLbl2.replaceAt(sLbl2.getLength()-1, 0, sLbl)); const OUString sLbl3(OUString::number( nVis + 3 )); - m_pLbl3->SetText(sLbl3.replaceAt(sLbl3.getLength()-1, 0, sLbl)); + m_xLbl3->set_label(sLbl3.replaceAt(sLbl3.getLength()-1, 0, sLbl)); const OUString sColumnWidth = SwResId( STR_ACCESS_COLUMN_WIDTH ) ; - m_aEd1.SetAccessibleName(sColumnWidth.replaceFirst("%1", sLbl1)); - m_aEd2.SetAccessibleName(sColumnWidth.replaceFirst("%1", sLbl2)); - m_aEd3.SetAccessibleName(sColumnWidth.replaceFirst("%1", sLbl3)); + m_xEd1->set_accessible_name(sColumnWidth.replaceFirst("%1", sLbl1)); + m_xEd2->set_accessible_name(sColumnWidth.replaceFirst("%1", sLbl2)); + m_xEd3->set_accessible_name(sColumnWidth.replaceFirst("%1", sLbl3)); const OUString sDist = SwResId( STR_ACCESS_PAGESETUP_SPACING ) ; - m_aDistEd1.SetAccessibleName( + m_xDistEd1->set_accessible_name( sDist.replaceFirst("%1", sLbl1).replaceFirst("%2", sLbl2)); - m_aDistEd2.SetAccessibleName( + m_xDistEd2->set_accessible_name( sDist.replaceFirst("%1", sLbl2).replaceFirst("%2", sLbl3)); } @@ -947,25 +918,25 @@ void SwColumnPage::SetLabels( sal_uInt16 nVis ) * the column number overwrites potential user's width settings; all columns * are equally wide. */ -IMPL_LINK( SwColumnPage, ColModify, Edit&, rEdit, void ) +IMPL_LINK(SwColumnPage, ColModify, weld::SpinButton&, rEdit, void) { - ColModify(static_cast<NumericField*>(&rEdit)); + ColModify(&rEdit); } -void SwColumnPage::ColModify(NumericField const * pNF) +void SwColumnPage::ColModify(const weld::SpinButton* pNF) { - m_nCols = static_cast<sal_uInt16>(m_pCLNrEdt->GetValue()); + m_nCols = static_cast<sal_uInt16>(m_xCLNrEdt->get_value()); //#107890# the handler is also called from LoseFocus() //then no change has been made and thus no action should be taken // #i17816# changing the displayed types within the ValueSet //from two columns to two columns with different settings doesn't invalidate the // example windows in ::ColModify() - if (!pNF || m_pColMgr->GetCount() != m_nCols) + if (!pNF || m_xColMgr->GetCount() != m_nCols) { - if(pNF) - m_pDefaultVS->SetNoSelection(); - long nDist = static_cast< long >(m_aDistEd1.DenormalizePercent(m_aDistEd1.GetValue(FUNIT_TWIP))); - m_pColMgr->SetCount(m_nCols, static_cast<sal_uInt16>(nDist)); + if (pNF) + m_aDefaultVS.SetNoSelection(); + long nDist = static_cast< long >(m_xDistEd1->DenormalizePercent(m_xDistEd1->get_value(FUNIT_TWIP))); + m_xColMgr->SetCount(m_nCols, static_cast<sal_uInt16>(nDist)); for(sal_uInt16 i = 0; i < m_nCols; i++) m_nColDist[i] = nDist; m_nFirstVis = 0; @@ -982,24 +953,23 @@ void SwColumnPage::ColModify(NumericField const * pNF) * width the automatic calculation of the column width is overruled; only an * alteration of the column number leads back to that default. */ -IMPL_LINK( SwColumnPage, GapModify, Edit&, rEdit, void ) +IMPL_LINK(SwColumnPage, GapModify, weld::MetricSpinButton&, rMetricField, void) { if (m_nCols < 2) return; - MetricField* pMetricField = static_cast<MetricField*>(&rEdit); - PercentField *pField = m_aPercentFieldsMap[pMetricField]; + SwPercentField *pField = m_aPercentFieldsMap[&rMetricField]; assert(pField); - long nActValue = static_cast< long >(pField->DenormalizePercent(pField->GetValue(FUNIT_TWIP))); - if(m_pAutoWidthBox->IsChecked()) + long nActValue = static_cast< long >(pField->DenormalizePercent(pField->get_value(FUNIT_TWIP))); + if (m_xAutoWidthBox->get_active()) { const long nMaxGap = static_cast< long > - ((m_pColMgr->GetActualSize() - m_nCols * MINLAY)/(m_nCols - 1)); + ((m_xColMgr->GetActualSize() - m_nCols * MINLAY)/(m_nCols - 1)); if(nActValue > nMaxGap) { nActValue = nMaxGap; - m_aDistEd1.SetPrcntValue(m_aDistEd1.NormalizePercent(nMaxGap), FUNIT_TWIP); + m_xDistEd1->SetPrcntValue(m_xDistEd1->NormalizePercent(nMaxGap), FUNIT_TWIP); } - m_pColMgr->SetGutterWidth(static_cast<sal_uInt16>(nActValue)); + m_xColMgr->SetGutterWidth(static_cast<sal_uInt16>(nActValue)); for(sal_uInt16 i = 0; i < m_nCols; i++) m_nColDist[i] = nActValue; @@ -1008,7 +978,7 @@ IMPL_LINK( SwColumnPage, GapModify, Edit&, rEdit, void ) } else { - const sal_uInt16 nVis = m_nFirstVis + ((pField == &m_aDistEd2) ? 1 : 0); + const sal_uInt16 nVis = m_nFirstVis + ((pField == m_xDistEd2.get()) ? 1 : 0); long nDiff = nActValue - m_nColDist[nVis]; if(nDiff) { @@ -1040,19 +1010,18 @@ IMPL_LINK( SwColumnPage, GapModify, Edit&, rEdit, void ) m_nColWidth[nVis + 1] = nRight; m_nColDist[nVis] += nDiff; - m_pColMgr->SetColWidth( nVis, sal_uInt16(nLeft) ); - m_pColMgr->SetColWidth( nVis + 1, sal_uInt16(nRight) ); - m_pColMgr->SetGutterWidth( sal_uInt16(m_nColDist[nVis]), nVis ); + m_xColMgr->SetColWidth( nVis, sal_uInt16(nLeft) ); + m_xColMgr->SetColWidth( nVis + 1, sal_uInt16(nRight) ); + m_xColMgr->SetGutterWidth( sal_uInt16(m_nColDist[nVis]), nVis ); } } - Update(pMetricField); + Update(&rMetricField); } -IMPL_LINK( SwColumnPage, EdModify, Edit&, rEdit, void ) +IMPL_LINK(SwColumnPage, EdModify, weld::MetricSpinButton&, rEdit, void) { - MetricField * pMetricField = static_cast<MetricField*>(&rEdit); - PercentField *pField = m_aPercentFieldsMap[pMetricField]; + SwPercentField *pField = m_aPercentFieldsMap[&rEdit]; assert(pField); m_pModifiedField = pField; Timeout(); @@ -1060,25 +1029,24 @@ IMPL_LINK( SwColumnPage, EdModify, Edit&, rEdit, void ) // Handler behind the Checkbox for automatic width. When the box is checked // no explicit values for the column width can be entered. -IMPL_LINK( SwColumnPage, AutoWidthHdl, Button*, pButton, void ) +IMPL_LINK(SwColumnPage, AutoWidthHdl, weld::ToggleButton&, rBox, void) { - CheckBox* pBox = static_cast<CheckBox*>(pButton); - long nDist = static_cast< long >(m_aDistEd1.DenormalizePercent(m_aDistEd1.GetValue(FUNIT_TWIP))); - m_pColMgr->SetCount(m_nCols, static_cast<sal_uInt16>(nDist)); + long nDist = static_cast< long >(m_xDistEd1->DenormalizePercent(m_xDistEd1->get_value(FUNIT_TWIP))); + m_xColMgr->SetCount(m_nCols, static_cast<sal_uInt16>(nDist)); for(sal_uInt16 i = 0; i < m_nCols; i++) m_nColDist[i] = nDist; - if(pBox->IsChecked()) + if (rBox.get_active()) { - m_pColMgr->SetGutterWidth(sal_uInt16(nDist)); + m_xColMgr->SetGutterWidth(sal_uInt16(nDist)); ResetColWidth(); } - m_pColMgr->SetAutoWidth(pBox->IsChecked(), sal_uInt16(nDist)); + m_xColMgr->SetAutoWidth(rBox.get_active(), sal_uInt16(nDist)); UpdateCols(); Update(nullptr); } // scroll up the contents of the edits -IMPL_LINK_NOARG(SwColumnPage, Up, Button*, void) +IMPL_LINK_NOARG(SwColumnPage, Up, weld::Button&, void) { if( m_nFirstVis ) { @@ -1089,7 +1057,7 @@ IMPL_LINK_NOARG(SwColumnPage, Up, Button*, void) } // scroll down the contents of the edits. -IMPL_LINK_NOARG(SwColumnPage, Down, Button*, void) +IMPL_LINK_NOARG(SwColumnPage, Down, weld::Button&, void) { if( m_nFirstVis + nVisCols < m_nCols ) { @@ -1103,18 +1071,18 @@ IMPL_LINK_NOARG(SwColumnPage, Down, Button*, void) // an alteration of the column width or the column gap. void SwColumnPage::Timeout() { - PercentField *pField = m_pModifiedField; + SwPercentField *pField = m_pModifiedField; if (m_pModifiedField) { // find the changed column sal_uInt16 nChanged = m_nFirstVis; - if(m_pModifiedField == &m_aEd2) + if (m_pModifiedField == m_xEd2.get()) ++nChanged; - else if(m_pModifiedField == &m_aEd3) + else if (m_pModifiedField == m_xEd3.get()) nChanged += 2; long nNewWidth = static_cast< long > - (m_pModifiedField->DenormalizePercent(m_pModifiedField->GetValue(FUNIT_TWIP))); + (m_pModifiedField->DenormalizePercent(m_pModifiedField->get_value(FUNIT_TWIP))); long nDiff = nNewWidth - m_nColWidth[nChanged]; // when it's the last column @@ -1145,58 +1113,58 @@ void SwColumnPage::Timeout() } // Update the view -void SwColumnPage::Update(MetricField const *pInteractiveField) +void SwColumnPage::Update(const weld::MetricSpinButton* pInteractiveField) { - m_pBalanceColsCB->Enable(m_nCols > 1); + m_xBalanceColsCB->set_sensitive(m_nCols > 1); if(m_nCols >= 2) { sal_Int64 nCurrentValue, nNewValue; - nCurrentValue = m_aEd1.NormalizePercent(m_aEd1.DenormalizePercent(m_aEd1.GetValue(FUNIT_TWIP))); - nNewValue = m_aEd1.NormalizePercent(m_nColWidth[m_nFirstVis]); + nCurrentValue = m_xEd1->NormalizePercent(m_xEd1->DenormalizePercent(m_xEd1->get_value(FUNIT_TWIP))); + nNewValue = m_xEd1->NormalizePercent(m_nColWidth[m_nFirstVis]); //fdo#87612 if we're interacting with this widget and the value will be the same //then leave it alone (i.e. don't change equivalent values of e.g. .8 -> 0.8) - if (nNewValue != nCurrentValue || pInteractiveField != m_aEd1.get()) - m_aEd1.SetPrcntValue(nNewValue, FUNIT_TWIP); + if (nNewValue != nCurrentValue || pInteractiveField != m_xEd1->get()) + m_xEd1->SetPrcntValue(nNewValue, FUNIT_TWIP); - nCurrentValue = m_aDistEd1.NormalizePercent(m_aDistEd1.DenormalizePercent(m_aDistEd1.GetValue(FUNIT_TWIP))); - nNewValue = m_aDistEd1.NormalizePercent(m_nColDist[m_nFirstVis]); - if (nNewValue != nCurrentValue || pInteractiveField != m_aDistEd1.get()) - m_aDistEd1.SetPrcntValue(nNewValue, FUNIT_TWIP); + nCurrentValue = m_xDistEd1->NormalizePercent(m_xDistEd1->DenormalizePercent(m_xDistEd1->get_value(FUNIT_TWIP))); + nNewValue = m_xDistEd1->NormalizePercent(m_nColDist[m_nFirstVis]); + if (nNewValue != nCurrentValue || pInteractiveField != m_xDistEd1->get()) + m_xDistEd1->SetPrcntValue(nNewValue, FUNIT_TWIP); - nCurrentValue = m_aEd2.NormalizePercent(m_aEd2.DenormalizePercent(m_aEd2.GetValue(FUNIT_TWIP))); - nNewValue = m_aEd2.NormalizePercent(m_nColWidth[m_nFirstVis+1]); - if (nNewValue != nCurrentValue || pInteractiveField != m_aEd2.get()) - m_aEd2.SetPrcntValue(nNewValue, FUNIT_TWIP); + nCurrentValue = m_xEd2->NormalizePercent(m_xEd2->DenormalizePercent(m_xEd2->get_value(FUNIT_TWIP))); + nNewValue = m_xEd2->NormalizePercent(m_nColWidth[m_nFirstVis+1]); + if (nNewValue != nCurrentValue || pInteractiveField != m_xEd2->get()) + m_xEd2->SetPrcntValue(nNewValue, FUNIT_TWIP); if(m_nCols >= 3) { - nCurrentValue = m_aDistEd2.NormalizePercent(m_aDistEd2.DenormalizePercent(m_aDistEd2.GetValue(FUNIT_TWIP))); - nNewValue = m_aDistEd2.NormalizePercent(m_nColDist[m_nFirstVis+1]); - if (nNewValue != nCurrentValue || pInteractiveField != m_aDistEd2.get()) - m_aDistEd2.SetPrcntValue(nNewValue, FUNIT_TWIP); - - nCurrentValue = m_aEd3.NormalizePercent(m_aEd3.DenormalizePercent(m_aEd3.GetValue(FUNIT_TWIP))); - nNewValue = m_aEd3.NormalizePercent(m_nColWidth[m_nFirstVis+2]); - if (nNewValue != nCurrentValue || pInteractiveField != m_aEd3.get()) - m_aEd3.SetPrcntValue(nNewValue, FUNIT_TWIP); + nCurrentValue = m_xDistEd2->NormalizePercent(m_xDistEd2->DenormalizePercent(m_xDistEd2->get_value(FUNIT_TWIP))); + nNewValue = m_xDistEd2->NormalizePercent(m_nColDist[m_nFirstVis+1]); + if (nNewValue != nCurrentValue || pInteractiveField != m_xDistEd2->get()) + m_xDistEd2->SetPrcntValue(nNewValue, FUNIT_TWIP); + + nCurrentValue = m_xEd3->NormalizePercent(m_xEd3->DenormalizePercent(m_xEd3->get_value(FUNIT_TWIP))); + nNewValue = m_xEd3->NormalizePercent(m_nColWidth[m_nFirstVis+2]); + if (nNewValue != nCurrentValue || pInteractiveField != m_xEd3->get()) + m_xEd3->SetPrcntValue(nNewValue, FUNIT_TWIP); } else { - m_aEd3.SetText(OUString()); - m_aDistEd2.SetText(OUString()); + m_xEd3->set_text(OUString()); + m_xDistEd2->set_text(OUString()); } } else { - m_aEd1.SetText(OUString()); - m_aEd2.SetText(OUString()); - m_aEd3.SetText(OUString()); - m_aDistEd1.SetText(OUString()); - m_aDistEd2.SetText(OUString()); + m_xEd1->set_text(OUString()); + m_xEd2->set_text(OUString()); + m_xEd3->set_text(OUString()); + m_xDistEd1->set_text(OUString()); + m_xDistEd2->set_text(OUString()); } - UpdateColMgr(*m_pLineWidthEdit); + UpdateColMgr(*m_xLineWidthEdit); } // Update Bsp @@ -1235,22 +1203,22 @@ void SwColumnPage::ActivatePage(const SfxItemSet& rSet) } - if( m_pColMgr->GetActualSize() != nActWidth) + if( m_xColMgr->GetActualSize() != nActWidth) { - m_pColMgr->SetActualWidth(nActWidth); + m_xColMgr->SetActualWidth(nActWidth); ColModify( nullptr ); - UpdateColMgr( *m_pLineWidthEdit ); + UpdateColMgr( *m_xLineWidthEdit ); } } - m_pFrameExampleWN->Hide(); - m_pPgeExampleWN->UpdateExample( rSet, m_pColMgr.get() ); - m_pPgeExampleWN->Show(); + m_xFrameExampleWN->hide(); + m_aPgeExampleWN.UpdateExample(rSet, m_xColMgr.get()); + m_xPgeExampleWN->show(); } else { - m_pPgeExampleWN->Hide(); - m_pFrameExampleWN->Show(); + m_xPgeExampleWN->hide(); + m_xFrameExampleWN->show(); // Size const SwFormatFrameSize& rSize = rSet.Get(RES_FRM_SIZE); @@ -1268,9 +1236,9 @@ void SwColumnPage::ActivatePage(const SfxItemSet& rSet) // set maximum values of column width SetPageWidth(nTotalWish); - if(m_pColMgr->GetActualSize() != nTotalWish) + if(m_xColMgr->GetActualSize() != nTotalWish) { - m_pColMgr->SetActualWidth(nTotalWish); + m_xColMgr->SetActualWidth(nTotalWish); Init(); } bool bPercent; @@ -1278,11 +1246,11 @@ void SwColumnPage::ActivatePage(const SfxItemSet& rSet) if ( m_bFormat || (rSize.GetWidthPercent() && rSize.GetWidthPercent() != SwFormatFrameSize::SYNCED) ) { // set value for 100% - m_aEd1.SetRefValue(nTotalWish); - m_aEd2.SetRefValue(nTotalWish); - m_aEd3.SetRefValue(nTotalWish); - m_aDistEd1.SetRefValue(nTotalWish); - m_aDistEd2.SetRefValue(nTotalWish); + m_xEd1->SetRefValue(nTotalWish); + m_xEd2->SetRefValue(nTotalWish); + m_xEd3->SetRefValue(nTotalWish); + m_xDistEd1->SetRefValue(nTotalWish); + m_xDistEd2->SetRefValue(nTotalWish); // switch to %-view bPercent = true; @@ -1290,13 +1258,13 @@ void SwColumnPage::ActivatePage(const SfxItemSet& rSet) else bPercent = false; - m_aEd1.ShowPercent(bPercent); - m_aEd2.ShowPercent(bPercent); - m_aEd3.ShowPercent(bPercent); - m_aDistEd1.ShowPercent(bPercent); - m_aDistEd2.ShowPercent(bPercent); - m_aDistEd1.SetMetricFieldMin(0); - m_aDistEd2.SetMetricFieldMin(0); + m_xEd1->ShowPercent(bPercent); + m_xEd2->ShowPercent(bPercent); + m_xEd3->ShowPercent(bPercent); + m_xDistEd1->ShowPercent(bPercent); + m_xDistEd2->ShowPercent(bPercent); + m_xDistEd1->SetMetricFieldMin(0); + m_xDistEd2->SetMetricFieldMin(0); } Update(nullptr); } @@ -1309,34 +1277,34 @@ DeactivateRC SwColumnPage::DeactivatePage(SfxItemSet *_pSet) return DeactivateRC::LeavePage; } -IMPL_LINK( SwColumnPage, SetDefaultsHdl, ValueSet *, pVS, void ) +IMPL_LINK(SwColumnPage, SetDefaultsHdl, SvtValueSet *, pVS, void) { const sal_uInt16 nItem = pVS->GetSelectedItemId(); if( nItem < 4 ) { - m_pCLNrEdt->SetValue( nItem ); - m_pAutoWidthBox->Check(); - m_aDistEd1.SetPrcntValue(50, FUNIT_CM); + m_xCLNrEdt->set_value(nItem); + m_xAutoWidthBox->set_active(true); + m_xDistEd1->SetPrcntValue(50, FUNIT_CM); ColModify(nullptr); } else { m_bLockUpdate = true; - m_pCLNrEdt->SetValue( 2 ); - m_pAutoWidthBox->Check(false); - m_aDistEd1.SetPrcntValue(50, FUNIT_CM); + m_xCLNrEdt->set_value(2); + m_xAutoWidthBox->set_active(false); + m_xDistEd1->SetPrcntValue(50, FUNIT_CM); ColModify(nullptr); // now set the width ratio to 2 : 1 or 1 : 2 respectively - const long nSmall = static_cast< long >(m_pColMgr->GetActualSize() / 3); + const long nSmall = static_cast< long >(m_xColMgr->GetActualSize() / 3); if(nItem == 4) { - m_aEd2.SetPrcntValue(m_aEd2.NormalizePercent(nSmall), FUNIT_TWIP); - m_pModifiedField = &m_aEd2; + m_xEd2->SetPrcntValue(m_xEd2->NormalizePercent(nSmall), FUNIT_TWIP); + m_pModifiedField = m_xEd2.get(); } else { - m_aEd1.SetPrcntValue(m_aEd1.NormalizePercent(nSmall), FUNIT_TWIP); - m_pModifiedField = &m_aEd1; + m_xEd1->SetPrcntValue(m_xEd1->NormalizePercent(nSmall), FUNIT_TWIP); + m_pModifiedField = m_xEd1.get(); } m_bLockUpdate = false; Timeout(); @@ -1354,14 +1322,14 @@ void SwColumnPage::SetInSection(bool bSet) if(!SW_MOD()->GetCTLOptions().IsCTLFontEnabled()) return; - m_pTextDirectionFT->Show(bSet); - m_pTextDirectionLB->Show(bSet); + m_xTextDirectionFT->show(bSet); + m_xTextDirectionLB->show(bSet); } void ColumnValueSet::UserDraw(const UserDrawEvent& rUDEvt) { vcl::RenderContext* pDev = rUDEvt.GetRenderContext(); - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); tools::Rectangle aRect = rUDEvt.GetRect(); const sal_uInt16 nItemId = rUDEvt.GetItemId(); @@ -1424,17 +1392,11 @@ void ColumnValueSet::UserDraw(const UserDrawEvent& rUDEvt) pDev->SetLineColor(aLineColor); } -void ColumnValueSet::DataChanged( const DataChangedEvent& rDCEvt ) +void ColumnValueSet::StyleUpdated() { - if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && - (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) - { - SetFormat(); - Invalidate(); - } - ValueSet::DataChanged( rDCEvt ); + SetFormat(); + Invalidate(); + SvtValueSet::StyleUpdated(); } -VCL_BUILDER_FACTORY(ColumnValueSet) - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/frmdlg/colex.cxx b/sw/source/uibase/frmdlg/colex.cxx index 02957501f4b8..3c632852be21 100644 --- a/sw/source/uibase/frmdlg/colex.cxx +++ b/sw/source/uibase/frmdlg/colex.cxx @@ -40,160 +40,6 @@ #include <svx/unobrushitemhelper.hxx> #include <svx/svxids.hrc> -// Taking the updated values from the set -void SwPageExample::UpdateExample( const SfxItemSet& rSet ) -{ - if (SfxItemState::DEFAULT <= rSet.GetItemState(RES_FRAMEDIR)) - { - const SvxFrameDirectionItem& rDirItem = rSet.Get(RES_FRAMEDIR); - m_bVertical = rDirItem.GetValue() == SvxFrameDirection::Vertical_RL_TB|| - rDirItem.GetValue() == SvxFrameDirection::Vertical_LR_TB; - } - - SfxItemPool* pPool = rSet.GetPool(); - sal_uInt16 nWhich = pPool->GetWhich( SID_ATTR_PAGE ); - if ( rSet.GetItemState( nWhich, false ) == SfxItemState::SET ) - { - // alignment - const SvxPageItem* pPage = static_cast<const SvxPageItem*>(&rSet.Get( nWhich )); - - if ( pPage ) - SetUsage( pPage->GetPageUsage() ); - } - - nWhich = pPool->GetWhich( SID_ATTR_PAGE_SIZE ); - - if ( rSet.GetItemState( nWhich, false ) == SfxItemState::SET ) - { - // orientation and size from PageItem - const SvxSizeItem& rSize = static_cast<const SvxSizeItem&>(rSet.Get( nWhich )); - SetSize( rSize.GetSize() ); - } - nWhich = RES_LR_SPACE; - if ( rSet.GetItemState( nWhich, false ) == SfxItemState::SET ) - { - // set left and right border - const SvxLRSpaceItem& rLRSpace = static_cast<const SvxLRSpaceItem&>(rSet.Get( nWhich )); - - SetLeft( rLRSpace.GetLeft() ); - SetRight( rLRSpace.GetRight() ); - } - else - { - SetLeft( 0 ); - SetRight( 0 ); - } - - nWhich = RES_UL_SPACE; - - if ( rSet.GetItemState( nWhich, false ) == SfxItemState::SET ) - { - // set upper and lower border - const SvxULSpaceItem& rULSpace = static_cast<const SvxULSpaceItem&>(rSet.Get( nWhich )); - - SetTop( rULSpace.GetUpper() ); - SetBottom( rULSpace.GetLower() ); - } - else - { - SetTop( 0 ); - SetBottom( 0 ); - } - - // evaluate header-attributes - const SfxPoolItem* pItem; - if( SfxItemState::SET == rSet.GetItemState( pPool->GetWhich( SID_ATTR_PAGE_HEADERSET), - false, &pItem ) ) - { - const SfxItemSet& rHeaderSet = static_cast<const SvxSetItem*>(pItem)->GetItemSet(); - const SfxBoolItem& rHeaderOn = - static_cast<const SfxBoolItem&>(rHeaderSet.Get( pPool->GetWhich( SID_ATTR_PAGE_ON ) ) ); - - if ( rHeaderOn.GetValue() ) - { - const SvxSizeItem& rSize = - static_cast<const SvxSizeItem&>(rHeaderSet.Get(pPool->GetWhich(SID_ATTR_PAGE_SIZE))); - - const SvxULSpaceItem& rUL = static_cast<const SvxULSpaceItem&>(rHeaderSet.Get( - pPool->GetWhich(SID_ATTR_ULSPACE))); - const SvxLRSpaceItem& rLR = static_cast<const SvxLRSpaceItem&>(rHeaderSet.Get( - pPool->GetWhich(SID_ATTR_LRSPACE))); - - SetHdHeight( rSize.GetSize().Height() - rUL.GetLower()); - SetHdDist( rUL.GetLower() ); - SetHdLeft( rLR.GetLeft() ); - SetHdRight( rLR.GetRight() ); - SetHeader( true ); - - if(SfxItemState::SET == rHeaderSet.GetItemState(RES_BACKGROUND)) - { - // create FillAttributes from SvxBrushItem //SetHdColor(rItem.GetColor()); - const SvxBrushItem& rItem = rHeaderSet.Get(RES_BACKGROUND); - SfxItemSet aTempSet(*rHeaderSet.GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{}); - - setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); - setHeaderFillAttributes( - std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>( - aTempSet)); - } - } - else - SetHeader( false ); - } - - if( SfxItemState::SET == rSet.GetItemState( pPool->GetWhich( SID_ATTR_PAGE_FOOTERSET), - false, &pItem ) ) - { - const SfxItemSet& rFooterSet = static_cast<const SvxSetItem*>(pItem)->GetItemSet(); - const SfxBoolItem& rFooterOn = rFooterSet.Get( SID_ATTR_PAGE_ON ); - - if ( rFooterOn.GetValue() ) - { - const SvxSizeItem& rSize = - static_cast<const SvxSizeItem&>(rFooterSet.Get( pPool->GetWhich( SID_ATTR_PAGE_SIZE ) )); - - const SvxULSpaceItem& rUL = static_cast<const SvxULSpaceItem&>(rFooterSet.Get( - pPool->GetWhich( SID_ATTR_ULSPACE ) )); - const SvxLRSpaceItem& rLR = static_cast<const SvxLRSpaceItem&>(rFooterSet.Get( - pPool->GetWhich( SID_ATTR_LRSPACE ) )); - - SetFtHeight( rSize.GetSize().Height() - rUL.GetUpper()); - SetFtDist( rUL.GetUpper() ); - SetFtLeft( rLR.GetLeft() ); - SetFtRight( rLR.GetRight() ); - SetFooter( true ); - - if( rFooterSet.GetItemState( RES_BACKGROUND ) == SfxItemState::SET ) - { - // create FillAttributes from SvxBrushItem //SetFtColor(rItem.GetColor()); - const SvxBrushItem& rItem = rFooterSet.Get(RES_BACKGROUND); - SfxItemSet aTempSet(*rFooterSet.GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{}); - - setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); - setFooterFillAttributes( - std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>( - aTempSet)); - } - } - else - SetFooter( false ); - } - - if(SfxItemState::SET == rSet.GetItemState(RES_BACKGROUND, false, &pItem)) - { - // create FillAttributes from SvxBrushItem - const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(*pItem); - SfxItemSet aTempSet(*rSet.GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{}); - - setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); - setPageFillAttributes( - std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>( - aTempSet)); - } - - Invalidate(); -} - void PageExample::UpdateExample( const SfxItemSet& rSet ) { if (SfxItemState::DEFAULT <= rSet.GetItemState(RES_FRAMEDIR)) @@ -350,7 +196,7 @@ void PageExample::UpdateExample( const SfxItemSet& rSet ) void SwColExample::DrawPage(vcl::RenderContext& rRenderContext, const Point& rOrg, const bool bSecond, const bool bEnabled) { - SwPageExample::DrawPage(rRenderContext, rOrg, bSecond, bEnabled); + PageExample::DrawPage(rRenderContext, rOrg, bSecond, bEnabled); if (!pColMgr) return; sal_uInt16 nColumnCount = pColMgr->GetCount(); @@ -483,36 +329,22 @@ void SwColExample::DrawPage(vcl::RenderContext& rRenderContext, const Point& rOr } } -VCL_BUILDER_FACTORY(SwColExample) - -SwColumnOnlyExample::SwColumnOnlyExample(vcl::Window* pParent) - : Window(pParent) - , m_aFrameSize(1,1) +SwColumnOnlyExample::SwColumnOnlyExample() + : m_aFrameSize(SvxPaperInfo::GetPaperSize(PAPER_A4)) // DIN A4 { - SetMapMode( MapMode( MapUnit::MapTwip ) ); - m_aWinSize = GetOptimalSize(); - m_aWinSize.AdjustHeight( -4 ); - m_aWinSize.AdjustWidth( -4 ); - - m_aWinSize = PixelToLogic( m_aWinSize ); - - SetBorderStyle( WindowBorderStyle::MONO ); - - m_aFrameSize = SvxPaperInfo::GetPaperSize(PAPER_A4);// DIN A4 ::FitToActualSize(m_aCols, static_cast<sal_uInt16>(m_aFrameSize.Width())); - - long nHeight = m_aFrameSize.Height(); - Fraction aScale( m_aWinSize.Height(), nHeight ); - MapMode aMapMode( GetMapMode() ); - aMapMode.SetScaleX( aScale ); - aMapMode.SetScaleY( aScale ); - SetMapMode( aMapMode ); } -VCL_BUILDER_FACTORY(SwColumnOnlyExample) - void SwColumnOnlyExample::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/) { + rRenderContext.Push(PushFlags::MAPMODE); + + Fraction aScale(m_aWinSize.Height(), m_aFrameSize.Height()); + MapMode aMapMode(MapUnit::MapTwip); + aMapMode.SetScaleX(aScale); + aMapMode.SetScaleY(aScale); + rRenderContext.SetMapMode(aMapMode); + const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); const Color& rFieldColor = rStyleSettings.GetFieldColor(); const Color& rDlgColor = rStyleSettings.GetDialogColor(); @@ -598,6 +430,7 @@ void SwColumnOnlyExample::Paint(vcl::RenderContext& rRenderContext, const tools: } } } + rRenderContext.Pop(); } void SwColumnOnlyExample::SetColumns(const SwFormatCol& rCol) @@ -644,9 +477,25 @@ void SwColumnOnlyExample::SetColumns(const SwFormatCol& rCol) } } -Size SwColumnOnlyExample::GetOptimalSize() const +void SwColumnOnlyExample::SetDrawingArea(weld::DrawingArea* pDrawingArea) +{ + OutputDevice& rRefDevice = pDrawingArea->get_ref_device(); + Size aPrefSize(rRefDevice.LogicToPixel(Size(75, 46), MapMode(MapUnit::MapAppFont))); + pDrawingArea->set_size_request(aPrefSize.Width(), aPrefSize.Height()); + weld::CustomWidgetController::SetDrawingArea(pDrawingArea); +} + +void SwColumnOnlyExample::Resize() { - return LogicToPixel(Size(75, 46), MapMode(MapUnit::MapAppFont)); + OutputDevice& rRefDevice = GetDrawingArea()->get_ref_device(); + rRefDevice.Push(PushFlags::MAPMODE); + rRefDevice.SetMapMode(MapMode(MapUnit::MapTwip)); + m_aWinSize = GetOutputSizePixel(); + m_aWinSize.AdjustHeight( -4 ); + m_aWinSize.AdjustWidth( -4 ); + m_aWinSize = rRefDevice.PixelToLogic(m_aWinSize); + rRefDevice.Pop(); + Invalidate(); } SwPageGridExample::SwPageGridExample() @@ -742,7 +591,7 @@ void SwPageGridExample::DrawPage(vcl::RenderContext& rRenderContext, const Point while (m_bVertical ? aStart.Y() < aRect.Bottom(): aStart.X() < aRect.Right()) { rRenderContext.DrawLine(aStart, aEnd); - if(m_bVertical) + if (m_bVertical) aStart.setY( aEnd.AdjustY(nBaseHeight ) ); else aStart.setX( aEnd.AdjustX(nBaseHeight ) ); @@ -758,7 +607,7 @@ void SwPageGridExample::UpdateExample( const SfxItemSet& rSet ) { pGridItem.reset(); //get the grid information - if(SfxItemState::DEFAULT <= rSet.GetItemState(RES_TEXTGRID)) + if (SfxItemState::DEFAULT <= rSet.GetItemState(RES_TEXTGRID)) pGridItem.reset(static_cast<SwTextGridItem*>(rSet.Get(RES_TEXTGRID).Clone())); PageExample::UpdateExample(rSet); } diff --git a/sw/source/uibase/inc/colex.hxx b/sw/source/uibase/inc/colex.hxx index b6db861c1829..0be060df7103 100644 --- a/sw/source/uibase/inc/colex.hxx +++ b/sw/source/uibase/inc/colex.hxx @@ -29,21 +29,6 @@ class SwColMgr; class SfxItemSet; -class SW_DLLPUBLIC SwPageExample : public SvxPageWindow -{ -protected: - bool m_bVertical; -public: - SwPageExample(vcl::Window* pPar) - : SvxPageWindow(pPar) - , m_bVertical(false) - { - SetSize(SvxPaperInfo::GetPaperSize(PAPER_A4)); - } - - void UpdateExample( const SfxItemSet& rSet ); -}; - class SW_DLLPUBLIC PageExample : public PageWindow { protected: @@ -73,11 +58,11 @@ public: }; -class SW_DLLPUBLIC SwColExample : public SwPageExample +class SW_DLLPUBLIC SwColExample : public PageExample { SwColMgr* pColMgr; - using SwPageExample::UpdateExample; + using PageExample::UpdateExample; protected: virtual void DrawPage(vcl::RenderContext& rRenderContext, @@ -86,20 +71,19 @@ protected: const bool bEnabled) override; public: - SwColExample(vcl::Window* pPar) - : SwPageExample(pPar) - , pColMgr(nullptr) + SwColExample() + : pColMgr(nullptr) { } void UpdateExample( const SfxItemSet& rSet, SwColMgr* pMgr ) { pColMgr = pMgr; - SwPageExample::UpdateExample(rSet); + PageExample::UpdateExample(rSet); } }; -class SW_DLLPUBLIC SwColumnOnlyExample : public vcl::Window +class SW_DLLPUBLIC SwColumnOnlyExample : public weld::CustomWidgetController { private: Size m_aWinSize; @@ -108,14 +92,15 @@ private: SwFormatCol m_aCols; protected: + virtual void Resize() override; virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; public: - SwColumnOnlyExample(vcl::Window*); + SwColumnOnlyExample(); void SetColumns(const SwFormatCol& rCol); - virtual Size GetOptimalSize() const override; + virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; }; #endif // INCLUDED_SW_SOURCE_UIBASE_INC_COLEX_HXX diff --git a/sw/source/uibase/inc/column.hxx b/sw/source/uibase/inc/column.hxx index b72bc00180d6..aab97048e2b5 100644 --- a/sw/source/uibase/inc/column.hxx +++ b/sw/source/uibase/inc/column.hxx @@ -42,10 +42,8 @@ class SwColMgr; class SwWrtShell; class SwColumnPage; -class SwColumnDlg : public SfxModalDialog +class SwColumnDlg : public weld::GenericDialogController { - VclPtr<ListBox> m_pApplyToLB; - SwWrtShell& m_rWrtShell; VclPtr<SwColumnPage> m_pTabPage; std::unique_ptr<SfxItemSet> m_pPageSet; @@ -62,97 +60,108 @@ class SwColumnDlg : public SfxModalDialog bool m_bSelSectionChanged : 1; bool m_bFrameChanged : 1; - DECL_LINK(ObjectListBoxHdl, ListBox&, void); - DECL_LINK(OkHdl, Button*, void); - void ObjectHdl(ListBox const *); + std::unique_ptr<weld::Container> m_xContentArea; + std::unique_ptr<weld::Button> m_xOkButton; + + DECL_LINK(ObjectListBoxHdl, weld::ComboBoxText&, void); + DECL_LINK(OkHdl, weld::Button&, void); + void ObjectHdl(const weld::ComboBoxText*); SfxItemSet* EvalCurrentSelection(void); public: - SwColumnDlg(vcl::Window* pParent, SwWrtShell& rSh); + SwColumnDlg(weld::Window* pParent, SwWrtShell& rSh); virtual ~SwColumnDlg() override; - virtual void dispose() override; }; -class ColumnValueSet : public ValueSet +class ColumnValueSet : public SvtValueSet { public: - ColumnValueSet(vcl::Window* pParent) - : ValueSet(pParent, WB_TABSTOP | WB_ITEMBORDER | WB_DOUBLEBORDER) + ColumnValueSet() + : SvtValueSet(nullptr) { } - virtual void UserDraw( const UserDrawEvent& rUDEvt ) override; - virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override + { + SvtValueSet::SetDrawingArea(pDrawingArea); + SetStyle(WB_TABSTOP | WB_ITEMBORDER | WB_DOUBLEBORDER); + } + virtual void UserDraw(const UserDrawEvent& rUDEvt) override; + virtual void StyleUpdated() override; }; // column dialog now as TabPage class SwColumnPage : public SfxTabPage { - VclPtr<NumericField> m_pCLNrEdt; - VclPtr<ColumnValueSet> m_pDefaultVS; - VclPtr<CheckBox> m_pBalanceColsCB; - - VclPtr<PushButton> m_pBtnBack; - VclPtr<FixedText> m_pLbl1; - PercentField m_aEd1; - VclPtr<FixedText> m_pLbl2; - PercentField m_aEd2; - VclPtr<FixedText> m_pLbl3; - PercentField m_aEd3; - VclPtr<PushButton> m_pBtnNext; - PercentField m_aDistEd1; - PercentField m_aDistEd2; - VclPtr<CheckBox> m_pAutoWidthBox; - - VclPtr<FixedText> m_pLineTypeLbl; - VclPtr<LineListBox> m_pLineTypeDLB; - VclPtr<FixedText> m_pLineWidthLbl; - VclPtr<MetricField> m_pLineWidthEdit; - VclPtr<FixedText> m_pLineColorLbl; - VclPtr<SvxColorListBox> m_pLineColorDLB; - VclPtr<FixedText> m_pLineHeightLbl; - VclPtr<MetricField> m_pLineHeightEdit; - VclPtr<FixedText> m_pLinePosLbl; - VclPtr<ListBox> m_pLinePosDLB; - - VclPtr<FixedText> m_pTextDirectionFT; - VclPtr<svx::FrameDirectionListBox> m_pTextDirectionLB; - - // Example - VclPtr<SwColExample> m_pPgeExampleWN; - VclPtr<SwColumnOnlyExample> m_pFrameExampleWN; - - std::unique_ptr<SwColMgr> m_pColMgr; + std::unique_ptr<SwColMgr> m_xColMgr; - sal_uInt16 m_nFirstVis; - sal_uInt16 m_nCols; + sal_uInt16 m_nFirstVis; + sal_uInt16 m_nCols; long m_nColWidth[nMaxCols]; long m_nColDist[nMaxCols]; - sal_uInt16 m_nMinWidth; - PercentField* m_pModifiedField; + sal_uInt16 m_nMinWidth; + SwPercentField* m_pModifiedField; - std::map<VclPtr<MetricField>, PercentField*> m_aPercentFieldsMap; + std::map<weld::MetricSpinButton*, SwPercentField*> m_aPercentFieldsMap; bool m_bFormat; bool m_bFrame; bool m_bHtmlMode; bool m_bLockUpdate; + ColumnValueSet m_aDefaultVS; + SwColExample m_aPgeExampleWN; + SwColumnOnlyExample m_aFrameExampleWN; + + std::unique_ptr<weld::SpinButton> m_xCLNrEdt; + std::unique_ptr<weld::CheckButton> m_xBalanceColsCB; + std::unique_ptr<weld::Button> m_xBtnBack; + std::unique_ptr<weld::Label> m_xLbl1; + std::unique_ptr<weld::Label> m_xLbl2; + std::unique_ptr<weld::Label> m_xLbl3; + std::unique_ptr<weld::Button> m_xBtnNext; + std::unique_ptr<weld::CheckButton> m_xAutoWidthBox; + std::unique_ptr<weld::Label> m_xLineTypeLbl; + std::unique_ptr<weld::Label> m_xLineWidthLbl; + std::unique_ptr<weld::MetricSpinButton> m_xLineWidthEdit; + std::unique_ptr<weld::Label> m_xLineColorLbl; + std::unique_ptr<weld::Label> m_xLineHeightLbl; + std::unique_ptr<weld::MetricSpinButton> m_xLineHeightEdit; + std::unique_ptr<weld::Label> m_xLinePosLbl; + std::unique_ptr<weld::ComboBoxText> m_xLinePosDLB; + std::unique_ptr<weld::Label> m_xTextDirectionFT; + std::unique_ptr<svx::SvxFrameDirectionListBox> m_xTextDirectionLB; + std::unique_ptr<ColorListBox> m_xLineColorDLB; + std::unique_ptr<SvtLineListBox> m_xLineTypeDLB; + std::unique_ptr<SwPercentField> m_xEd1; + std::unique_ptr<SwPercentField> m_xEd2; + std::unique_ptr<SwPercentField> m_xEd3; + std::unique_ptr<SwPercentField> m_xDistEd1; + std::unique_ptr<SwPercentField> m_xDistEd2; + std::unique_ptr<weld::CustomWeld> m_xDefaultVS; + // Example + std::unique_ptr<weld::CustomWeld> m_xPgeExampleWN; + std::unique_ptr<weld::CustomWeld> m_xFrameExampleWN; + + std::unique_ptr<weld::Label> m_xApplyToFT; + std::unique_ptr<weld::ComboBoxText> m_xApplyToLB; + // Handler - DECL_LINK( ColModify, Edit&, void ); - void ColModify(NumericField const *); - DECL_LINK( GapModify, Edit&, void ); - DECL_LINK( EdModify, Edit&, void ); - DECL_LINK( AutoWidthHdl, Button *, void ); - DECL_LINK( SetDefaultsHdl, ValueSet *, void ); - - DECL_LINK( Up, Button *, void ); - DECL_LINK( Down, Button *, void ); - DECL_LINK( UpdateColMgr, Edit&, void ); - DECL_LINK( UpdateColMgrListBox, ListBox&, void ); - DECL_LINK( UpdateColMgrColorBox, SvxColorListBox&, void ); + DECL_LINK(ColModify, weld::SpinButton&, void); + void ColModify(const weld::SpinButton*); + DECL_LINK(GapModify, weld::MetricSpinButton&, void); + DECL_LINK(EdModify, weld::MetricSpinButton&, void); + DECL_LINK(AutoWidthHdl, weld::ToggleButton&, void ); + DECL_LINK(SetDefaultsHdl, SvtValueSet *, void); + + DECL_LINK(Up, weld::Button&, void); + DECL_LINK(Down, weld::Button&, void); + DECL_LINK(UpdateColMgr, weld::MetricSpinButton&, void); + DECL_LINK(UpdateColMgrListBox, weld::ComboBoxText&, void); + DECL_LINK(UpdateColMgrLineBox, SvtLineListBox&, void); + DECL_LINK(UpdateColMgrColorBox, ColorListBox&, void); void Timeout(); - void Update(MetricField const *pInteractiveField); + void Update(const weld::MetricSpinButton* pInteractiveField); void UpdateCols(); void Init(); void ResetColWidth(); @@ -164,14 +173,14 @@ class SwColumnPage : public SfxTabPage virtual void ActivatePage(const SfxItemSet& rSet) override; virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override; - void connectPercentField(PercentField &rWrap, const OString &rName); + void connectPercentField(SwPercentField &rWrap); bool isLineNotNone() const; static const sal_uInt16 aPageRg[]; public: - SwColumnPage(vcl::Window *pParent, const SfxItemSet &rSet); + SwColumnPage(TabPageParent pParent, const SfxItemSet &rSet); virtual ~SwColumnPage() override; virtual void dispose() override; @@ -191,15 +200,18 @@ public: void ShowBalance(bool bShow) { - m_pBalanceColsCB->Show(bShow); + m_xBalanceColsCB->show(bShow); } void SetInSection(bool bSet); void ActivateColumnControl() { - m_pCLNrEdt->GrabFocus(); + m_xCLNrEdt->grab_focus(); } + + weld::Label* GetApplyLabel() { return m_xApplyToFT.get(); } + weld::ComboBoxText* GetApplyComboBox() { return m_xApplyToLB.get(); } }; #endif diff --git a/sw/source/uibase/inc/prcntfld.hxx b/sw/source/uibase/inc/prcntfld.hxx index 20aa83ae21af..4c035687a104 100644 --- a/sw/source/uibase/inc/prcntfld.hxx +++ b/sw/source/uibase/inc/prcntfld.hxx @@ -119,6 +119,7 @@ public: void save_value() { m_pField->save_value(); } bool get_value_changed_from_saved() const { return m_pField->get_value_changed_from_saved(); } void set_text(const OUString& rStr) { m_pField->set_text(rStr); } + void set_accessible_name(const OUString& rStr) { m_pField->set_accessible_name(rStr); } void SetMetricFieldMin(int nNewMin) { m_pField->set_min(nNewMin, FUNIT_NONE); } void SetMetricFieldMax(int nNewMax) { m_pField->set_max(nNewMax, FUNIT_NONE); } diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx index b34a65a6d97b..35ebe583af3c 100644 --- a/sw/source/uibase/shells/textsh.cxx +++ b/sw/source/uibase/shells/textsh.cxx @@ -524,8 +524,10 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) case FN_FORMAT_COLUMN : { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - VclPtr<VclAbstractDialog> pColDlg(pFact->CreateSwColumnDialog(GetView().GetWindow(), rSh)); - pColDlg->StartExecuteAsync([](sal_Int32 /*nResult*/){}); + VclPtr<VclAbstractDialog> pColDlg(pFact->CreateSwColumnDialog(GetView().GetFrameWeld(), rSh)); + pColDlg->StartExecuteAsync([=](sal_Int32 /*nResult*/){ + pColDlg->disposeOnce(); + }); } break; diff --git a/sw/uiconfig/swriter/ui/columnpage.ui b/sw/uiconfig/swriter/ui/columnpage.ui index 4648d383888d..b44a54bdfc8a 100644 --- a/sw/uiconfig/swriter/ui/columnpage.ui +++ b/sw/uiconfig/swriter/ui/columnpage.ui @@ -1,7 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.0 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sw"> - <!-- interface-requires LibreOffice 1.0 --> <requires lib="gtk+" version="3.18"/> <object class="GtkAdjustment" id="adjustment1"> <property name="lower">1</property> @@ -13,12 +12,12 @@ <object class="GtkAdjustment" id="adjustment2"> <property name="lower">0.01</property> <property name="upper">56</property> - <property name="step_increment">0.1</property> + <property name="step_increment">0.10000000000000001</property> <property name="page_increment">1</property> </object> <object class="GtkAdjustment" id="adjustment3"> <property name="upper">56</property> - <property name="step_increment">0.1</property> + <property name="step_increment">0.10000000000000001</property> <property name="page_increment">1</property> </object> <object class="GtkAdjustment" id="adjustment4"> @@ -35,6 +34,23 @@ <property name="step_increment">1</property> <property name="page_increment">10</property> </object> + <object class="GtkAdjustment" id="adjustment6"> + <property name="lower">0.01</property> + <property name="upper">56</property> + <property name="step_increment">0.10000000000000001</property> + <property name="page_increment">1</property> + </object> + <object class="GtkAdjustment" id="adjustment7"> + <property name="lower">0.01</property> + <property name="upper">56</property> + <property name="step_increment">0.10000000000000001</property> + <property name="page_increment">1</property> + </object> + <object class="GtkAdjustment" id="adjustment8"> + <property name="upper">56</property> + <property name="step_increment">0.10000000000000001</property> + <property name="page_increment">1</property> + </object> <object class="GtkImage" id="image7"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -47,36 +63,6 @@ <property name="stock">gtk-go-forward</property> <property name="icon_size">1</property> </object> - <object class="GtkListStore" id="liststore2"> - <columns> - <!-- column-name gchararray1 --> - <column type="gchararray"/> - <!-- column-name gint1 --> - <column type="gint"/> - </columns> - <data> - <row> - <col id="0" translatable="yes" context="columnpage|liststore2">Selection</col> - <col id="1">0</col> - </row> - <row> - <col id="0" translatable="yes" context="columnpage|liststore2">Current Section</col> - <col id="1">1</col> - </row> - <row> - <col id="0" translatable="yes" context="columnpage|liststore2">Selected section</col> - <col id="1">2</col> - </row> - <row> - <col id="0" translatable="yes" context="columnpage|liststore2">Frame</col> - <col id="1">4</col> - </row> - <row> - <col id="0" translatable="yes" context="columnpage|liststore2">Page Style: </col> - <col id="1">3</col> - </row> - </data> - </object> <object class="GtkGrid" id="ColumnPage"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -128,7 +114,7 @@ <property name="hexpand">True</property> <property name="label">_1</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">width1mf:0.00cm</property> + <property name="mnemonic_widget">width1mf</property> </object> <packing> <property name="left_attach">2</property> @@ -142,10 +128,7 @@ <property name="hexpand">True</property> <property name="label">_2</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">width2mf:0.00cm</property> - <attributes> - <attribute name="background" value="#ffffffffffff"/> - </attributes> + <property name="mnemonic_widget">width2mf</property> </object> <packing> <property name="left_attach">3</property> @@ -159,7 +142,7 @@ <property name="hexpand">True</property> <property name="label">_3</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">width3mf:0.00cm</property> + <property name="mnemonic_widget">width3mf</property> </object> <packing> <property name="left_attach">4</property> @@ -173,9 +156,9 @@ <property name="label" translatable="yes" context="columnpage|widthft">Width:</property> <property name="xalign">1</property> <accessibility> - <relation type="label-for" target="width3mf:0.00cm"/> - <relation type="label-for" target="width2mf:0.00cm"/> - <relation type="label-for" target="width1mf:0.00cm"/> + <relation type="label-for" target="width3mf"/> + <relation type="label-for" target="width2mf"/> + <relation type="label-for" target="width1mf"/> </accessibility> </object> <packing> @@ -184,12 +167,12 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="width3mf:0.00cm"> + <object class="GtkSpinButton" id="width3mf"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="halign">center</property> <property name="hexpand">True</property> - <property name="adjustment">adjustment2</property> + <property name="adjustment">adjustment7</property> <property name="digits">2</property> <accessibility> <relation type="labelled-by" target="widthft"/> @@ -201,12 +184,12 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="width2mf:0.00cm"> + <object class="GtkSpinButton" id="width2mf"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="halign">center</property> <property name="hexpand">True</property> - <property name="adjustment">adjustment2</property> + <property name="adjustment">adjustment6</property> <property name="digits">2</property> <accessibility> <relation type="labelled-by" target="widthft"/> @@ -218,7 +201,7 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="width1mf:0.00cm"> + <object class="GtkSpinButton" id="width1mf"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="halign">center</property> @@ -241,8 +224,8 @@ <property name="label" translatable="yes" context="columnpage|distft">Spacing:</property> <property name="xalign">1</property> <accessibility> - <relation type="label-for" target="spacing1mf:0.00cm"/> - <relation type="label-for" target="spacing2mf:0.00cm"/> + <relation type="label-for" target="spacing1mf"/> + <relation type="label-for" target="spacing2mf"/> </accessibility> </object> <packing> @@ -257,7 +240,7 @@ <property name="halign">center</property> <property name="column_spacing">24</property> <child> - <object class="GtkSpinButton" id="spacing1mf:0.00cm"> + <object class="GtkSpinButton" id="spacing1mf"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="halign">center</property> @@ -273,11 +256,11 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="spacing2mf:0.00cm"> + <object class="GtkSpinButton" id="spacing2mf"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="halign">center</property> - <property name="adjustment">adjustment3</property> + <property name="adjustment">adjustment8</property> <property name="digits">2</property> <accessibility> <relation type="labelled-by" target="distft"/> @@ -423,7 +406,7 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="columnpage|linewidthft">_Width:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">linewidthmf:0.00pt</property> + <property name="mnemonic_widget">linewidthmf</property> <property name="xalign">1</property> </object> <packing> @@ -437,7 +420,7 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="columnpage|lineheightft">H_eight:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">linewidthmf:0.00pt</property> + <property name="mnemonic_widget">lineheightmf</property> <property name="xalign">1</property> </object> <packing> @@ -460,10 +443,14 @@ </packing> </child> <child> - <object class="svtlo-LineListBox" id="linestylelb"> + <object class="GtkMenuButton" id="linestylelb"> <property name="visible">True</property> - <property name="dropdown">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <child> + <placeholder/> + </child> </object> <packing> <property name="left_attach">1</property> @@ -486,7 +473,7 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="lineheightmf:0%"> + <object class="GtkSpinButton" id="lineheightmf"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="adjustment">adjustment5</property> @@ -497,7 +484,7 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="linewidthmf:0.00pt"> + <object class="GtkSpinButton" id="linewidthmf"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="adjustment">adjustment4</property> @@ -509,10 +496,14 @@ </packing> </child> <child> - <object class="svxcorelo-SvxColorListBox" id="colorlb"> + <object class="GtkMenuButton" id="colorlb"> <property name="visible">True</property> - <property name="dropdown">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <child> + <placeholder/> + </child> </object> <packing> <property name="left_attach">5</property> @@ -652,11 +643,18 @@ <property name="can_focus">False</property> <property name="column_spacing">12</property> <child> - <object class="GtkComboBox" id="applytolb"> + <object class="GtkComboBoxText" id="applytolb"> <property name="can_focus">False</property> <property name="no_show_all">True</property> + <property name="halign">start</property> <property name="hexpand">True</property> - <property name="model">liststore2</property> + <items> + <item id="0" translatable="yes" context="columnpage|liststore2">Selection</item> + <item id="1" translatable="yes" context="columnpage|liststore2">Current Section</item> + <item id="2" translatable="yes" context="columnpage|liststore2">Selected section</item> + <item id="4" translatable="yes" context="columnpage|liststore2">Frame</item> + <item id="3" translatable="yes" context="columnpage|liststore2">Page Style: </item> + </items> </object> <packing> <property name="left_attach">1</property> @@ -703,9 +701,9 @@ </packing> </child> <child> - <object class="svxlo-FrameDirectionListBox" id="textdirectionlb"> - <property name="no_show_all">True</property> + <object class="GtkComboBoxText" id="textdirectionlb"> <property name="can_focus">False</property> + <property name="no_show_all">True</property> </object> <packing> <property name="left_attach">1</property> @@ -726,11 +724,12 @@ </packing> </child> <child> - <object class="swuilo-ColumnValueSet" id="valueset"> + <object class="GtkDrawingArea" id="valueset"> <property name="width_request">160</property> <property name="height_request">35</property> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> + <property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property> <property name="hexpand">True</property> <property name="vexpand">True</property> </object> @@ -764,7 +763,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <child> - <object class="swlo-SwColExample" id="pageexample"> + <object class="GtkDrawingArea" id="pageexample"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">center</property> @@ -776,7 +775,7 @@ </packing> </child> <child> - <object class="swlo-SwColumnOnlyExample" id="frameexample"> + <object class="GtkDrawingArea" id="frameexample"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">center</property> |