diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-11-21 21:21:35 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-11-23 09:54:21 +0100 |
commit | 998d11b44eb3c57583703fa0df67e087ba187195 (patch) | |
tree | 882c147cdd408421554f647763cc9d3a3b117d8c | |
parent | 626504ee27d853d70a5a8b3b62d69313b9b6eb98 (diff) |
weld SwFramePage
Change-Id: I12f868611860867df26bd29474aa19189c2b9a96
Reviewed-on: https://gerrit.libreoffice.org/63842
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 | 3 | ||||
-rw-r--r-- | include/svx/swframeexample.hxx | 64 | ||||
-rwxr-xr-x | solenv/bin/native-code.py | 1 | ||||
-rw-r--r-- | svx/source/dialog/swframeexample.cxx | 693 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/column.cxx | 24 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/frmpage.cxx | 1033 | ||||
-rw-r--r-- | sw/source/ui/table/tabledlg.cxx | 42 | ||||
-rw-r--r-- | sw/source/uibase/inc/frmpage.hxx | 137 | ||||
-rw-r--r-- | sw/source/uibase/inc/prcntfld.hxx | 73 | ||||
-rw-r--r-- | sw/source/uibase/utlui/prcntfld.cxx | 271 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/frmtypepage.ui | 51 |
11 files changed, 645 insertions, 1747 deletions
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in index a02836e94439..629a835e5232 100644 --- a/extras/source/glade/libreoffice-catalog.xml.in +++ b/extras/source/glade/libreoffice-catalog.xml.in @@ -250,9 +250,6 @@ <glade-widget-class title="NUP Preview" name="vcllo-ShowNupOrderWindow" generic-name="NUP Preview" parent="GtkDrawingArea" icon-name="widget-gtk-drawingarea"/> - <glade-widget-class title="Frame Preview" name="svxlo-SvxSwFrameExample" - generic-name="Frame Preview" parent="GtkDrawingArea" - icon-name="widget-gtk-drawingarea"/> <glade-widget-class title="Presentation Preview" name="sduilo-PresLayoutPreview" generic-name="Presentation Preview" parent="GtkDrawingArea" icon-name="widget-gtk-drawingarea"/> diff --git a/include/svx/swframeexample.hxx b/include/svx/swframeexample.hxx index ddcc5961b95a..814f0d84aa22 100644 --- a/include/svx/swframeexample.hxx +++ b/include/svx/swframeexample.hxx @@ -27,7 +27,7 @@ #include <vcl/window.hxx> #include <com/sun/star/text/WrapTextMode.hpp> -class SVX_DLLPUBLIC SvxSwFrameExample : public vcl::Window +class SVX_DLLPUBLIC SwFrameExample : public weld::CustomWidgetController { Color m_aTransColor; ///< transparency Color m_aBgCol; ///< background @@ -63,65 +63,6 @@ class SVX_DLLPUBLIC SvxSwFrameExample : public vcl::Window void InitColors_Impl(); void InitAllRects_Impl(vcl::RenderContext& rRenderContext); - void CalcBoundRect_Impl(tools::Rectangle &rRect); - tools::Rectangle DrawInnerFrame_Impl(vcl::RenderContext& rRenderContext, const tools::Rectangle &rRect, const Color &rFillColor, const Color &rBorderColor); - - virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override; - virtual Size GetOptimalSize() const override; -protected: - virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; -public: - - SvxSwFrameExample(vcl::Window* pParent, WinBits nStyle); - - void SetWrap(css::text::WrapTextMode nW) { nWrap = nW; } - - void SetHAlign(short nH) { nHAlign = nH; } - void SetHoriRel(short nR) { nHRel = nR; } - - void SetVAlign(short nV) { nVAlign = nV; } - void SetVertRel(short nR) { nVRel = nR; } - - void SetTransparent(bool bT) { bTrans = bT; } - void SetAnchor(RndStdIds nA) { nAnchor = nA; } - - void SetRelPos(const Point& rP); -}; - -class SVX_DLLPUBLIC SwFrameExample : public weld::CustomWidgetController -{ - Color m_aTransColor; ///< transparency - Color m_aBgCol; ///< background - Color m_aFrameColor; ///< graphic frame - Color m_aAlignColor; ///< align anchor - Color m_aBorderCol; ///< frame of doc - Color m_aPrintAreaCol; ///< frame of printable area of doc - Color m_aTxtCol; ///< symbolised text - Color m_aBlankCol; ///< area of symbol for blank - Color m_aBlankFrameCol; ///< frame of symbol for blank - - tools::Rectangle aPage; - tools::Rectangle aPagePrtArea; - tools::Rectangle aTextLine; - tools::Rectangle aPara; - tools::Rectangle aParaPrtArea; - tools::Rectangle aFrameAtFrame; - tools::Rectangle aDrawObj; - tools::Rectangle aAutoCharFrame; - Size aFrmSize; - - short nHAlign; - short nHRel; - - short nVAlign; - short nVRel; - - RndStdIds nAnchor; - - Point aRelPos; - - void InitColors_Impl(); - void InitAllRects_Impl(vcl::RenderContext& rRenderContext); void CalcBoundRect_Impl(vcl::RenderContext& rRenderContext, tools::Rectangle &rRect); tools::Rectangle DrawInnerFrame_Impl(vcl::RenderContext& rRenderContext, const tools::Rectangle &rRect, const Color &rFillColor, const Color &rBorderColor); @@ -133,12 +74,15 @@ public: virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; + void SetWrap(css::text::WrapTextMode nW) { nWrap = nW; } + void SetHAlign(short nH) { nHAlign = nH; } void SetHoriRel(short nR) { nHRel = nR; } void SetVAlign(short nV) { nVAlign = nV; } void SetVertRel(short nR) { nVRel = nR; } + void SetTransparent(bool bT) { bTrans = bT; } void SetAnchor(RndStdIds nA) { nAnchor = nA; } void SetRelPos(const Point& rP); diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py index b0e0ab1c5822..d1b805deacc7 100755 --- a/solenv/bin/native-code.py +++ b/solenv/bin/native-code.py @@ -510,7 +510,6 @@ custom_widgets = [ 'SvxNoSpaceEdit', 'SvxPathControl', 'SvxRelativeField', - 'SvxSwFrameExample', 'SvxTextEncodingBox', 'SvxTextEncodingBox', 'SwAddressPreview', diff --git a/svx/source/dialog/swframeexample.cxx b/svx/source/dialog/swframeexample.cxx index 5b6fd26ce804..c8ec11e9dfee 100644 --- a/svx/source/dialog/swframeexample.cxx +++ b/svx/source/dialog/swframeexample.cxx @@ -45,683 +45,14 @@ void DrawRect_Impl(vcl::RenderContext& rRenderContext, const tools::Rectangle &r } -SvxSwFrameExample::SvxSwFrameExample( vcl::Window *pParent, WinBits nStyle ) : - - Window(pParent, nStyle), - - nHAlign (HoriOrientation::CENTER), - nHRel (RelOrientation::FRAME), - nVAlign (VertOrientation::TOP), - nVRel (RelOrientation::PRINT_AREA), - nWrap (WrapTextMode_NONE), - nAnchor (RndStdIds::FLY_AT_PAGE), - bTrans (false), - aRelPos (Point(0,0)) -{ - InitColors_Impl(); -} - -VCL_BUILDER_FACTORY_ARGS(SvxSwFrameExample, 0) - -Size SvxSwFrameExample::GetOptimalSize() const -{ - return LogicToPixel(Size(52, 86), MapMode(MapUnit::MapAppFont)); -} - -void SvxSwFrameExample::InitColors_Impl() -{ - const StyleSettings& rSettings = GetSettings().GetStyleSettings(); - m_aBgCol = rSettings.GetWindowColor(); - - bool bHC = rSettings.GetHighContrastMode(); - - m_aFrameColor = COL_LIGHTGREEN; - m_aAlignColor = COL_LIGHTRED; - m_aTransColor = COL_TRANSPARENT; - - m_aTxtCol = bHC? - svtools::ColorConfig().GetColorValue(svtools::FONTCOLOR).nColor : - COL_GRAY; - m_aPrintAreaCol = bHC? m_aTxtCol : COL_GRAY; - m_aBorderCol = m_aTxtCol; - m_aBlankCol = bHC? m_aTxtCol : COL_LIGHTGRAY; - m_aBlankFrameCol = bHC? m_aTxtCol : COL_GRAY; -} - -void SvxSwFrameExample::DataChanged(const DataChangedEvent& rDCEvt) -{ - Window::DataChanged(rDCEvt); - - if (rDCEvt.GetType() == DataChangedEventType::SETTINGS && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) - InitColors_Impl(); -} - -void SvxSwFrameExample::InitAllRects_Impl(vcl::RenderContext& rRenderContext) -{ - aPage.SetSize(GetOutputSizePixel()); - - sal_uInt32 nOutWPix = aPage.GetWidth(); - sal_uInt32 nOutHPix = aPage.GetHeight(); - - // PrintArea - sal_uInt32 nLBorder; - sal_uInt32 nRBorder; - sal_uInt32 nTBorder; - sal_uInt32 nBBorder; - - sal_uInt32 nLTxtBorder; - sal_uInt32 nRTxtBorder; - sal_uInt32 nTTxtBorder; - sal_uInt32 nBTxtBorder; - - if (nAnchor != RndStdIds::FLY_AS_CHAR) - { - nLBorder = 14; - nRBorder = 10; - nTBorder = 10; - nBBorder = 15; - - nLTxtBorder = 8; - nRTxtBorder = 4; - nTTxtBorder = 2; - nBTxtBorder = 2; - } - else - { - nLBorder = 2; - nRBorder = 2; - nTBorder = 2; - nBBorder = 2; - - nLTxtBorder = 2; - nRTxtBorder = 2; - nTTxtBorder = 2; - nBTxtBorder = 2; - } - aPagePrtArea = tools::Rectangle(Point(nLBorder, nTBorder), Point((nOutWPix - 1) - nRBorder, (nOutHPix - 1) - nBBorder)); - - // Example text: Preparing for the text output - // A line of text - aTextLine = aPagePrtArea; - aTextLine.SetSize(Size(aTextLine.GetWidth(), 2)); - aTextLine.AdjustLeft(nLTxtBorder ); - aTextLine.AdjustRight( -sal_Int32(nRTxtBorder) ); - aTextLine.Move(0, nTTxtBorder); - - // Rectangle to edges including paragraph - sal_uInt16 nLines = static_cast<sal_uInt16>((aPagePrtArea.GetHeight() / 2 - nTTxtBorder - nBTxtBorder) - / (aTextLine.GetHeight() + 2)); - aPara = aPagePrtArea; - aPara.SetSize(Size(aPara.GetWidth(), - (aTextLine.GetHeight() + 2) * nLines + nTTxtBorder + nBTxtBorder)); - - // Rectangle around paragraph without borders - aParaPrtArea = aPara; - aParaPrtArea.AdjustLeft(nLTxtBorder ); - aParaPrtArea.AdjustRight( -sal_Int32(nRTxtBorder) ); - aParaPrtArea.AdjustTop(nTTxtBorder ); - aParaPrtArea.AdjustBottom( -sal_Int32(nBTxtBorder) ); - - if (nAnchor == RndStdIds::FLY_AS_CHAR || nAnchor == RndStdIds::FLY_AT_CHAR) - { - vcl::Font aFont = OutputDevice::GetDefaultFont( - DefaultFontType::LATIN_TEXT, Application::GetSettings().GetLanguageTag().getLanguageType(), - GetDefaultFontFlags::OnlyOne, this ); - aFont.SetColor( m_aTxtCol ); - aFont.SetFillColor( m_aBgCol ); - aFont.SetWeight(WEIGHT_NORMAL); - - if (nAnchor == RndStdIds::FLY_AS_CHAR) - { - aFont.SetFontSize(Size(0, aParaPrtArea.GetHeight() - 2)); - SetFont(aFont); - aParaPrtArea.SetSize(Size(GetTextWidth(DEMOTEXT), GetTextHeight())); - } - else - { - aFont.SetFontSize(Size(0, aParaPrtArea.GetHeight() / 2)); - rRenderContext.SetFont(aFont); - aAutoCharFrame.SetSize(Size(GetTextWidth(OUString('A')), GetTextHeight())); - aAutoCharFrame.SetPos(Point(aParaPrtArea.Left() + (aParaPrtArea.GetWidth() - aAutoCharFrame.GetWidth()) / 2, - aParaPrtArea.Top() + (aParaPrtArea.GetHeight() - aAutoCharFrame.GetHeight()) / 2)); - } - } - - // Inner Frame anchored at the Frame - aFrameAtFrame = aPara; - aFrameAtFrame.AdjustLeft(9 ); - aFrameAtFrame.AdjustRight( -5 ); - aFrameAtFrame.AdjustBottom(5 ); - aFrameAtFrame.SetPos(Point(aFrameAtFrame.Left() + 2, (aPagePrtArea.Bottom() - aFrameAtFrame.GetHeight()) / 2 + 5)); - - // Size of the frame to be positioned - if (nAnchor != RndStdIds::FLY_AS_CHAR) - { - sal_uInt32 nLFBorder = nAnchor == RndStdIds::FLY_AT_PAGE ? nLBorder : nLTxtBorder; - sal_uInt32 nRFBorder = nAnchor == RndStdIds::FLY_AT_PAGE ? nRBorder : nRTxtBorder; - - switch (nHRel) - { - case RelOrientation::PAGE_LEFT: - case RelOrientation::FRAME_LEFT: - aFrmSize = Size(nLFBorder - 4, (aTextLine.GetHeight() + 2) * 3); - break; - - case RelOrientation::PAGE_RIGHT: - case RelOrientation::FRAME_RIGHT: - aFrmSize = Size(nRFBorder - 4, (aTextLine.GetHeight() + 2) * 3); - break; - - default: - aFrmSize = Size(nLBorder - 3, (aTextLine.GetHeight() + 2) * 3); - break; - } - aFrmSize.setWidth( std::max(5L, aFrmSize.Width()) ); - aFrmSize.setHeight( std::max(5L, aFrmSize.Height()) ); - } - else - { - sal_uInt32 nFreeWidth = aPagePrtArea.GetWidth() - GetTextWidth(DEMOTEXT); - - aFrmSize = Size(nFreeWidth / 2, (aTextLine.GetHeight() + 2) * 3); - aDrawObj.SetSize(Size(std::max(5L, static_cast<long>(nFreeWidth) / 3L), std::max(5L, aFrmSize.Height() * 3L))); - aDrawObj.SetPos(Point(aParaPrtArea.Right() + 1, aParaPrtArea.Bottom() / 2)); - aParaPrtArea.SetRight( aDrawObj.Right() ); - } -} - -void SvxSwFrameExample::CalcBoundRect_Impl(tools::Rectangle &rRect) -{ - switch (nAnchor) - { - case RndStdIds::FLY_AT_PAGE: - { - switch (nHRel) - { - case RelOrientation::FRAME: - case RelOrientation::PAGE_FRAME: - rRect.SetLeft( aPage.Left() ); - rRect.SetRight( aPage.Right() ); - break; - - case RelOrientation::PRINT_AREA: - case RelOrientation::PAGE_PRINT_AREA: - rRect.SetLeft( aPagePrtArea.Left() ); - rRect.SetRight( aPagePrtArea.Right() ); - break; - - case RelOrientation::PAGE_LEFT: - rRect.SetLeft( aPage.Left() ); - rRect.SetRight( aPagePrtArea.Left() ); - break; - - case RelOrientation::PAGE_RIGHT: - rRect.SetLeft( aPagePrtArea.Right() ); - rRect.SetRight( aPage.Right() ); - break; - } - - switch (nVRel) - { - case RelOrientation::PRINT_AREA: - case RelOrientation::PAGE_PRINT_AREA: - rRect.SetTop( aPagePrtArea.Top() ); - rRect.SetBottom( aPagePrtArea.Bottom() ); - break; - - case RelOrientation::FRAME: - case RelOrientation::PAGE_FRAME: - rRect.SetTop( aPage.Top() ); - rRect.SetBottom( aPage.Bottom() ); - break; - } - } - break; - - case RndStdIds::FLY_AT_FLY: - { - switch (nHRel) - { - case RelOrientation::FRAME: - case RelOrientation::PAGE_FRAME: - rRect.SetLeft( aFrameAtFrame.Left() ); - rRect.SetRight( aFrameAtFrame.Right() ); - break; - - case RelOrientation::PRINT_AREA: - case RelOrientation::PAGE_PRINT_AREA: - rRect.SetLeft( aFrameAtFrame.Left() + FLYINFLY_BORDER ); - rRect.SetRight( aFrameAtFrame.Right() - FLYINFLY_BORDER ); - break; - - case RelOrientation::PAGE_RIGHT: - rRect.SetLeft( aFrameAtFrame.Left() ); - rRect.SetRight( aFrameAtFrame.Left() + FLYINFLY_BORDER ); - break; - - case RelOrientation::PAGE_LEFT: - rRect.SetLeft( aFrameAtFrame.Right() ); - rRect.SetRight( aFrameAtFrame.Right() - FLYINFLY_BORDER ); - break; - } - - switch (nVRel) - { - case RelOrientation::FRAME: - case RelOrientation::PAGE_FRAME: - rRect.SetTop( aFrameAtFrame.Top() ); - rRect.SetBottom( aFrameAtFrame.Bottom() ); - break; - - case RelOrientation::PRINT_AREA: - case RelOrientation::PAGE_PRINT_AREA: - rRect.SetTop( aFrameAtFrame.Top() + FLYINFLY_BORDER ); - rRect.SetBottom( aFrameAtFrame.Bottom() - FLYINFLY_BORDER ); - break; - } - } - break; - case RndStdIds::FLY_AT_PARA: - case RndStdIds::FLY_AT_CHAR: - { - switch (nHRel) - { - case RelOrientation::FRAME: - rRect.SetLeft( aPara.Left() ); - rRect.SetRight( aPara.Right() ); - break; - - case RelOrientation::PRINT_AREA: - rRect.SetLeft( aParaPrtArea.Left() ); - rRect.SetRight( aParaPrtArea.Right() ); - break; - - case RelOrientation::PAGE_LEFT: - rRect.SetLeft( aPage.Left() ); - rRect.SetRight( aPagePrtArea.Left() ); - break; - - case RelOrientation::PAGE_RIGHT: - rRect.SetLeft( aPagePrtArea.Right() ); - rRect.SetRight( aPage.Right() ); - break; - - case RelOrientation::PAGE_FRAME: - rRect.SetLeft( aPage.Left() ); - rRect.SetRight( aPage.Right() ); - break; - - case RelOrientation::PAGE_PRINT_AREA: - rRect.SetLeft( aPagePrtArea.Left() ); - rRect.SetRight( aPagePrtArea.Right() ); - break; - - case RelOrientation::FRAME_LEFT: - rRect.SetLeft( aPara.Left() ); - rRect.SetRight( aParaPrtArea.Left() ); - break; - - case RelOrientation::FRAME_RIGHT: - rRect.SetLeft( aParaPrtArea.Right() ); - rRect.SetRight( aPara.Right() ); - break; - - case RelOrientation::CHAR: - rRect.SetLeft( aAutoCharFrame.Left() ); - rRect.SetRight( aAutoCharFrame.Left() ); - break; - } - - switch (nVRel) - { - case RelOrientation::FRAME: - rRect.SetTop( aPara.Top() ); - rRect.SetBottom( aPara.Bottom() ); - break; - - case RelOrientation::PRINT_AREA: - rRect.SetTop( aParaPrtArea.Top() ); - rRect.SetBottom( aParaPrtArea.Bottom() ); - break; - - case RelOrientation::CHAR: - if (nVAlign != VertOrientation::NONE && - nVAlign != VertOrientation::CHAR_BOTTOM) - rRect.SetTop( aAutoCharFrame.Top() ); - else - rRect.SetTop( aAutoCharFrame.Bottom() ); - rRect.SetBottom( aAutoCharFrame.Bottom() ); - break; - // OD 12.11.2003 #i22341# - case RelOrientation::TEXT_LINE: - rRect.SetTop( aAutoCharFrame.Top() ); - rRect.SetBottom( aAutoCharFrame.Top() ); - break; - } - } - break; - - case RndStdIds::FLY_AS_CHAR: - rRect.SetLeft( aParaPrtArea.Left() ); - rRect.SetRight( aParaPrtArea.Right() ); - - switch (nVAlign) - { - case VertOrientation::NONE: - case VertOrientation::TOP: - case VertOrientation::CENTER: - case VertOrientation::BOTTOM: - { - FontMetric aMetric(GetFontMetric()); - - rRect.SetTop( aParaPrtArea.Bottom() - aMetric.GetDescent() ); - rRect.SetBottom( rRect.Top() ); - } - break; - - default: - - case VertOrientation::LINE_TOP: - case VertOrientation::LINE_CENTER: - case VertOrientation::LINE_BOTTOM: - rRect.SetTop( aParaPrtArea.Top() ); - rRect.SetBottom( aDrawObj.Bottom() ); - break; - - case VertOrientation::CHAR_TOP: - case VertOrientation::CHAR_CENTER: - case VertOrientation::CHAR_BOTTOM: - rRect.SetTop( aParaPrtArea.Top() ); - rRect.SetBottom( aParaPrtArea.Bottom() ); - break; - } - break; - - default: - break; - } -} - -tools::Rectangle SvxSwFrameExample::DrawInnerFrame_Impl(vcl::RenderContext& rRenderContext, const tools::Rectangle &rRect, - const Color &rFillColor, const Color &rBorderColor) -{ - DrawRect_Impl(rRenderContext, rRect, rFillColor, rBorderColor); - - // determine the area relative to which the positioning happens - tools::Rectangle aRect(rRect); // aPagePrtArea = Default - CalcBoundRect_Impl(aRect); - - if (nAnchor == RndStdIds::FLY_AT_FLY && &rRect == &aPagePrtArea) - { - // draw text paragraph - tools::Rectangle aTxt(aTextLine); - sal_Int32 nStep = aTxt.GetHeight() + 2; - sal_uInt16 nLines = static_cast<sal_uInt16>(aParaPrtArea.GetHeight() / (aTextLine.GetHeight() + 2)); - - for (sal_uInt16 i = 0; i < nLines; i++) - { - if (i == nLines - 1) - aTxt.SetSize(Size(aTxt.GetWidth() / 2, aTxt.GetHeight())); - DrawRect_Impl(rRenderContext, aTxt, m_aTxtCol, m_aTransColor); - aTxt.Move(0, nStep); - } - } - - return aRect; -} - -void SvxSwFrameExample::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) -{ - rRenderContext.SetMapMode(MapMode(MapUnit::MapPixel)); - - InitAllRects_Impl(rRenderContext); - - // Draw page - DrawRect_Impl(rRenderContext, aPage, m_aBgCol, m_aBorderCol); - - // Draw PrintArea - tools::Rectangle aRect = DrawInnerFrame_Impl(rRenderContext, aPagePrtArea, m_aTransColor, m_aPrintAreaCol); - - if (nAnchor == RndStdIds::FLY_AT_FLY) - aRect = DrawInnerFrame_Impl(rRenderContext, aFrameAtFrame, m_aBgCol, m_aBorderCol); - - long lXPos = 0; - long lYPos = 0; - - // Horizontal alignment - if (nAnchor != RndStdIds::FLY_AS_CHAR) - { - switch (nHAlign) - { - case HoriOrientation::RIGHT: - { - lXPos = aRect.Right() - aFrmSize.Width() + 1; - break; - } - case HoriOrientation::CENTER: - { - lXPos = aRect.Left() + (aRect.GetWidth() - aFrmSize.Width()) / 2; - break; - } - case HoriOrientation::NONE: - { - lXPos = aRect.Left() + aRelPos.X(); - break; - } - - default: // HoriOrientation::LEFT - lXPos = aRect.Left(); - break; - } - } - else - { - lXPos = aRect.Right() + 2; - } - - // Vertical Alignment - if (nAnchor != RndStdIds::FLY_AS_CHAR) - { - switch (nVAlign) - { - case VertOrientation::BOTTOM: - case VertOrientation::LINE_BOTTOM: - { - // #i22341# - if ( nVRel != RelOrientation::TEXT_LINE ) - { - lYPos = aRect.Bottom() - aFrmSize.Height() + 1; - } - else - { - lYPos = aRect.Top(); - } - break; - } - case VertOrientation::CENTER: - case VertOrientation::LINE_CENTER: - { - lYPos = aRect.Top() + (aRect.GetHeight() - aFrmSize.Height()) / 2; - break; - } - case VertOrientation::NONE: - { - // #i22341# - if ( nVRel != RelOrientation::CHAR && nVRel != RelOrientation::TEXT_LINE ) - lYPos = aRect.Top() + aRelPos.Y(); - else - lYPos = aRect.Top() - aRelPos.Y(); - break; - } - default: - // #i22341# - if ( nVRel != RelOrientation::TEXT_LINE ) - { - lYPos = aRect.Top(); - } - else - { - lYPos = aRect.Bottom() - aFrmSize.Height() + 1; - } - break; - } - } - else - { - switch(nVAlign) - { - case VertOrientation::CENTER: - case VertOrientation::CHAR_CENTER: - case VertOrientation::LINE_CENTER: - lYPos = aRect.Top() + (aRect.GetHeight() - aFrmSize.Height()) / 2; - break; - - case VertOrientation::TOP: - case VertOrientation::CHAR_BOTTOM: - case VertOrientation::LINE_BOTTOM: - lYPos = aRect.Bottom() - aFrmSize.Height() + 1; - break; - - default: - lYPos = aRect.Top() - aRelPos.Y(); - break; - } - } - - tools::Rectangle aFrmRect(Point(lXPos, lYPos), aFrmSize); - - tools::Rectangle* pOuterFrame = &aPage; - - if (nAnchor == RndStdIds::FLY_AT_FLY) - pOuterFrame = &aFrameAtFrame; - - if (aFrmRect.Left() < pOuterFrame->Left()) - aFrmRect.Move(pOuterFrame->Left() - aFrmRect.Left(), 0); - if (aFrmRect.Right() > pOuterFrame->Right()) - aFrmRect.Move(pOuterFrame->Right() - aFrmRect.Right(), 0); - - if (aFrmRect.Top() < pOuterFrame->Top()) - aFrmRect.Move(0, pOuterFrame->Top() - aFrmRect.Top()); - if (aFrmRect.Bottom() > pOuterFrame->Bottom()) - aFrmRect.Move(0, pOuterFrame->Bottom() - aFrmRect.Bottom()); - - // Draw Test paragraph - const long nTxtLineHeight = aTextLine.GetHeight(); - tools::Rectangle aTxt(aTextLine); - sal_Int32 nStep; - sal_uInt16 nLines; - - if (nAnchor == RndStdIds::FLY_AT_FLY) - { - aTxt.SetLeft( aFrameAtFrame.Left() + FLYINFLY_BORDER ); - aTxt.SetRight( aFrameAtFrame.Right() - FLYINFLY_BORDER ); - aTxt.SetTop( aFrameAtFrame.Top() + FLYINFLY_BORDER ); - aTxt.SetBottom( aTxt.Top() + aTextLine.GetHeight() - 1 ); - - nStep = aTxt.GetHeight() + 2; - nLines = static_cast<sal_uInt16>(((aFrameAtFrame.GetHeight() - 2 * FLYINFLY_BORDER) * 2 / 3) - / (aTxt.GetHeight() + 2)); - } - else - { - nStep = aTxt.GetHeight() + 2; - nLines = static_cast<sal_uInt16>(aParaPrtArea.GetHeight() / (aTextLine.GetHeight() + 2)); - } - - if (nAnchor != RndStdIds::FLY_AS_CHAR) - { - // Simulate text - const long nOldR = aTxt.Right(); - const long nOldL = aTxt.Left(); - - // #i22341# - const bool bIgnoreWrap = nAnchor == RndStdIds::FLY_AT_CHAR && - ( nHRel == RelOrientation::CHAR || nVRel == RelOrientation::CHAR || - nVRel == RelOrientation::TEXT_LINE ); - - for (sal_uInt16 i = 0; i < nLines; ++i) - { - if (i == (nLines - 1)) - aTxt.SetSize(Size(aTxt.GetWidth() / 2, aTxt.GetHeight())); - - if (aTxt.IsOver(aFrmRect) && nAnchor != RndStdIds::FLY_AS_CHAR && !bIgnoreWrap) - { - switch(nWrap) - { - case WrapTextMode_NONE: - aTxt.SetTop( aFrmRect.Bottom() + nTxtLineHeight ); - aTxt.SetBottom( aTxt.Top() + nTxtLineHeight - 1 ); - break; - - case WrapTextMode_LEFT: - aTxt.SetRight( aFrmRect.Left() ); - break; - - case WrapTextMode_RIGHT: - aTxt.SetLeft( aFrmRect.Right() ); - break; - default: break; - } - } - if (pOuterFrame->IsInside(aTxt)) - DrawRect_Impl(rRenderContext, aTxt, m_aTxtCol, m_aTransColor ); - - aTxt.Move(0, nStep); - aTxt.SetRight( nOldR ); - aTxt.SetLeft( nOldL ); - } - aTxt.Move(0, -nStep); - - if (nAnchor != RndStdIds::FLY_AT_FLY && aTxt.Bottom() > aParaPrtArea.Bottom()) - { - // Text has been replaced by frame, so adjust parameters height - sal_Int32 nDiff = aTxt.Bottom() - aParaPrtArea.Bottom(); - aParaPrtArea.AdjustBottom(nDiff ); - aPara.AdjustBottom(nDiff ); - - CalcBoundRect_Impl(aRect); - - aParaPrtArea.AdjustBottom( -nDiff ); - aPara.AdjustBottom( -nDiff ); - } - if (nAnchor == RndStdIds::FLY_AT_CHAR && bIgnoreWrap) - rRenderContext.DrawText(aAutoCharFrame, OUString('A')); - } - else - { - rRenderContext.DrawText(aParaPrtArea, OUString(DEMOTEXT)); - DrawRect_Impl(rRenderContext, aDrawObj, m_aBlankCol, m_aBlankFrameCol ); - } - - // Draw rectangle on which the frame is aligned: - DrawRect_Impl(rRenderContext, aRect, m_aTransColor, m_aAlignColor); - - // Frame View - bool bDontFill = (nAnchor == RndStdIds::FLY_AT_CHAR && aFrmRect.IsOver(aAutoCharFrame)) || bTrans; - DrawRect_Impl(rRenderContext, aFrmRect, bDontFill? m_aTransColor : m_aBgCol, m_aFrameColor); -} - -void SvxSwFrameExample::SetRelPos(const Point& rP) -{ - aRelPos = rP; - - if (aRelPos.X() > 0) - aRelPos.setX( 5 ); - if (aRelPos.X() < 0) - aRelPos.setX( -5 ); - - if (aRelPos.Y() > 0) - aRelPos.setY( 5 ); - if (aRelPos.Y() < 0) - aRelPos.setY( -5 ); -} - SwFrameExample::SwFrameExample() : nHAlign(HoriOrientation::CENTER) , nHRel(RelOrientation::FRAME) , nVAlign(VertOrientation::TOP) , nVRel(RelOrientation::PRINT_AREA) + , nWrap(WrapTextMode_NONE) , nAnchor(RndStdIds::FLY_AT_PAGE) + , bTrans(false) , aRelPos(Point(0,0)) { InitColors_Impl(); @@ -1310,8 +641,22 @@ void SwFrameExample::Paint(vcl::RenderContext& rRenderContext, const tools::Rect if (aTxt.IsOver(aFrmRect) && nAnchor != RndStdIds::FLY_AS_CHAR && !bIgnoreWrap) { - aTxt.SetTop( aFrmRect.Bottom() + nTxtLineHeight ); - aTxt.SetBottom( aTxt.Top() + nTxtLineHeight - 1 ); + switch(nWrap) + { + case WrapTextMode_NONE: + aTxt.SetTop( aFrmRect.Bottom() + nTxtLineHeight ); + aTxt.SetBottom( aTxt.Top() + nTxtLineHeight - 1 ); + break; + + case WrapTextMode_LEFT: + aTxt.SetRight( aFrmRect.Left() ); + break; + + case WrapTextMode_RIGHT: + aTxt.SetLeft( aFrmRect.Right() ); + break; + default: break; + } } if (pOuterFrame->IsInside(aTxt)) DrawRect_Impl(rRenderContext, aTxt, m_aTxtCol, m_aTransColor ); @@ -1347,7 +692,7 @@ void SwFrameExample::Paint(vcl::RenderContext& rRenderContext, const tools::Rect DrawRect_Impl(rRenderContext, aRect, m_aTransColor, m_aAlignColor); // Frame View - bool bDontFill = (nAnchor == RndStdIds::FLY_AT_CHAR && aFrmRect.IsOver(aAutoCharFrame)); + bool bDontFill = (nAnchor == RndStdIds::FLY_AT_CHAR && aFrmRect.IsOver(aAutoCharFrame)) || bTrans; DrawRect_Impl(rRenderContext, aFrmRect, bDontFill? m_aTransColor : m_aBgCol, m_aFrameColor); } diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx index 8afb3632617f..b65724370016 100644 --- a/sw/source/ui/frmdlg/column.cxx +++ b/sw/source/ui/frmdlg/column.cxx @@ -558,8 +558,8 @@ void SwColumnPage::Reset(const SfxItemSet *rSet) m_xDistEd1->SetMetric(aMetric); m_xDistEd2->SetMetric(aMetric); //default spacing between cols = 0.5cm - m_xDistEd1->SetPrcntValue(50, FieldUnit::CM); - m_xDistEd2->SetPrcntValue(50, FieldUnit::CM); + m_xDistEd1->set_value(50, FieldUnit::CM); + m_xDistEd2->set_value(50, FieldUnit::CM); m_xColMgr.reset(new SwColMgr(*rSet)); m_nCols = m_xColMgr->GetCount() ; @@ -963,7 +963,7 @@ IMPL_LINK(SwColumnPage, GapModify, weld::MetricSpinButton&, rMetricField, void) if(nActValue > nMaxGap) { nActValue = nMaxGap; - m_xDistEd1->SetPrcntValue(m_xDistEd1->NormalizePercent(nMaxGap), FieldUnit::TWIP); + m_xDistEd1->set_value(m_xDistEd1->NormalizePercent(nMaxGap), FieldUnit::TWIP); } m_xColMgr->SetGutterWidth(static_cast<sal_uInt16>(nActValue)); for(sal_uInt16 i = 0; i < m_nCols; i++) @@ -1122,29 +1122,29 @@ void SwColumnPage::Update(const weld::MetricSpinButton* pInteractiveField) //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_xEd1->get()) - m_xEd1->SetPrcntValue(nNewValue, FieldUnit::TWIP); + m_xEd1->set_value(nNewValue, FieldUnit::TWIP); nCurrentValue = m_xDistEd1->NormalizePercent(m_xDistEd1->DenormalizePercent(m_xDistEd1->get_value(FieldUnit::TWIP))); nNewValue = m_xDistEd1->NormalizePercent(m_nColDist[m_nFirstVis]); if (nNewValue != nCurrentValue || pInteractiveField != m_xDistEd1->get()) - m_xDistEd1->SetPrcntValue(nNewValue, FieldUnit::TWIP); + m_xDistEd1->set_value(nNewValue, FieldUnit::TWIP); nCurrentValue = m_xEd2->NormalizePercent(m_xEd2->DenormalizePercent(m_xEd2->get_value(FieldUnit::TWIP))); nNewValue = m_xEd2->NormalizePercent(m_nColWidth[m_nFirstVis+1]); if (nNewValue != nCurrentValue || pInteractiveField != m_xEd2->get()) - m_xEd2->SetPrcntValue(nNewValue, FieldUnit::TWIP); + m_xEd2->set_value(nNewValue, FieldUnit::TWIP); if(m_nCols >= 3) { nCurrentValue = m_xDistEd2->NormalizePercent(m_xDistEd2->DenormalizePercent(m_xDistEd2->get_value(FieldUnit::TWIP))); nNewValue = m_xDistEd2->NormalizePercent(m_nColDist[m_nFirstVis+1]); if (nNewValue != nCurrentValue || pInteractiveField != m_xDistEd2->get()) - m_xDistEd2->SetPrcntValue(nNewValue, FieldUnit::TWIP); + m_xDistEd2->set_value(nNewValue, FieldUnit::TWIP); nCurrentValue = m_xEd3->NormalizePercent(m_xEd3->DenormalizePercent(m_xEd3->get_value(FieldUnit::TWIP))); nNewValue = m_xEd3->NormalizePercent(m_nColWidth[m_nFirstVis+2]); if (nNewValue != nCurrentValue || pInteractiveField != m_xEd3->get()) - m_xEd3->SetPrcntValue(nNewValue, FieldUnit::TWIP); + m_xEd3->set_value(nNewValue, FieldUnit::TWIP); } else { @@ -1280,7 +1280,7 @@ IMPL_LINK(SwColumnPage, SetDefaultsHdl, SvtValueSet *, pVS, void) { m_xCLNrEdt->set_value(nItem); m_xAutoWidthBox->set_active(true); - m_xDistEd1->SetPrcntValue(50, FieldUnit::CM); + m_xDistEd1->set_value(50, FieldUnit::CM); ColModify(nullptr); } else @@ -1288,18 +1288,18 @@ IMPL_LINK(SwColumnPage, SetDefaultsHdl, SvtValueSet *, pVS, void) m_bLockUpdate = true; m_xCLNrEdt->set_value(2); m_xAutoWidthBox->set_active(false); - m_xDistEd1->SetPrcntValue(50, FieldUnit::CM); + m_xDistEd1->set_value(50, FieldUnit::CM); ColModify(nullptr); // now set the width ratio to 2 : 1 or 1 : 2 respectively const long nSmall = static_cast< long >(m_xColMgr->GetActualSize() / 3); if(nItem == 4) { - m_xEd2->SetPrcntValue(m_xEd2->NormalizePercent(nSmall), FieldUnit::TWIP); + m_xEd2->set_value(m_xEd2->NormalizePercent(nSmall), FieldUnit::TWIP); m_pModifiedField = m_xEd2.get(); } else { - m_xEd1->SetPrcntValue(m_xEd1->NormalizePercent(nSmall), FieldUnit::TWIP); + m_xEd1->set_value(m_xEd1->NormalizePercent(nSmall), FieldUnit::TWIP); m_pModifiedField = m_xEd1.get(); } m_bLockUpdate = false; diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index edee604b9759..70e81edb4375 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -595,129 +595,113 @@ static LB lcl_GetLBRelationsForStrID( const FrameMap* _pMap, // standard frame TabPage namespace { - void HandleAutoCB( bool _bChecked, FixedText& _rFT_man, FixedText& _rFT_auto, MetricField& _rPF_Edit) - { - _rFT_man.Show( !_bChecked ); - _rFT_auto.Show( _bChecked ); - OUString accName = _bChecked ? _rFT_auto.GetText() : _rFT_man.GetText(); - _rPF_Edit.SetAccessibleName(accName); - } -} - -SwFramePage::SwFramePage(vcl::Window *pParent, const SfxItemSet &rSet) - : SfxTabPage(pParent, "FrameTypePage", - "modules/swriter/ui/frmtypepage.ui", &rSet) - , - m_bAtHorzPosModified( false ), - m_bAtVertPosModified( false ), - m_bFormat(false), - m_bNew(true), - m_bNoModifyHdl(true), - m_bIsVerticalFrame(false), - m_bIsVerticalL2R(false), - m_bIsInRightToLeft(false), - m_bHtmlMode(false), - m_nHtmlMode(0), - m_nUpperBorder(0), - m_nLowerBorder(0), - m_fWidthHeightRatio(1.0), - mpToCharContentPos( nullptr ), - - m_nOldH(text::HoriOrientation::CENTER), - m_nOldHRel(text::RelOrientation::FRAME), - m_nOldV(text::VertOrientation::TOP), - m_nOldVRel(text::RelOrientation::PRINT_AREA), - m_pVMap( nullptr ), - m_pHMap( nullptr ), - m_bAllowVertPositioning( true ), - m_bIsMathOLE( false ), - m_bIsMathBaselineAlignment( true ) -{ - get(m_pWidthFT, "widthft"); - get(m_pWidthAutoFT, "autowidthft"); - m_aWidthED.set(get<MetricField>("width")); - get(m_pRelWidthCB, "relwidth"); - get(m_pRelWidthRelationLB, "relwidthrelation"); - get(m_pAutoWidthCB, "autowidth"); - - get(m_pHeightFT, "heightft"); - get(m_pHeightAutoFT, "autoheightft"); - m_aHeightED.set(get<MetricField>("height")); - get(m_pRelHeightCB, "relheight"); - get(m_pRelHeightRelationLB, "relheightrelation"); - get(m_pAutoHeightCB, "autoheight"); - - get(m_pFixedRatioCB, "ratio"); - get(m_pRealSizeBT, "origsize"); - - get(m_pAnchorFrame, "anchorframe"); - get(m_pAnchorAtPageRB, "topage"); - get(m_pAnchorAtParaRB, "topara"); - get(m_pAnchorAtCharRB, "tochar"); - get(m_pAnchorAsCharRB, "aschar"); - get(m_pAnchorAtFrameRB, "toframe"); - - get(m_pHorizontalFT, "horiposft"); - get(m_pHorizontalDLB, "horipos"); - get(m_pAtHorzPosFT, "horibyft"); - get(m_pAtHorzPosED, "byhori"); - get(m_pHoriRelationFT, "horitoft"); - get(m_pHoriRelationLB, "horianchor"); - - get(m_pMirrorPagesCB, "mirror"); - - get(m_pVerticalFT, "vertposft"); - get(m_pVerticalDLB, "vertpos"); - get(m_pAtVertPosFT, "vertbyft"); - get(m_pAtVertPosED, "byvert"); - get(m_pVertRelationFT, "verttoft"); - get(m_pVertRelationLB, "vertanchor"); - - get(m_pFollowTextFlowCB, "followtextflow"); - get(m_pExampleWN, "preview"); - - m_pAtHorzPosED->set_width_request(m_pAtHorzPosED->GetOptimalSize().Width()); - m_pAtHorzPosED->set_width_request(m_pAtVertPosED->GetOptimalSize().Width()); + void HandleAutoCB(bool _bChecked, weld::Label& _rFT_man, weld::Label& _rFT_auto, weld::MetricSpinButton& _rPF_Edit) + { + _rFT_man.show( !_bChecked ); + _rFT_auto.show( _bChecked ); + OUString accName = _bChecked ? _rFT_auto.get_label() : _rFT_man.get_label(); + _rPF_Edit.set_accessible_name(accName); + } +} + +SwFramePage::SwFramePage(TabPageParent pParent, const SfxItemSet &rSet) + : SfxTabPage(pParent, "modules/swriter/ui/frmtypepage.ui", "FrameTypePage", &rSet) + , m_bAtHorzPosModified(false) + , m_bAtVertPosModified(false) + , m_bFormat(false) + , m_bNew(true) + , m_bNoModifyHdl(true) + , m_bIsVerticalFrame(false) + , m_bIsVerticalL2R(false) + , m_bIsInRightToLeft(false) + , m_bHtmlMode(false) + , m_nHtmlMode(0) + , m_nUpperBorder(0) + , m_nLowerBorder(0) + , m_fWidthHeightRatio(1.0) + , mpToCharContentPos(nullptr) + , m_nOldH(text::HoriOrientation::CENTER) + , m_nOldHRel(text::RelOrientation::FRAME) + , m_nOldV(text::VertOrientation::TOP) + , m_nOldVRel(text::RelOrientation::PRINT_AREA) + , m_pVMap(nullptr) + , m_pHMap(nullptr) + , m_bAllowVertPositioning( true ) + , m_bIsMathOLE(false) + , m_bIsMathBaselineAlignment(true) + , m_xWidthFT(m_xBuilder->weld_label("widthft")) + , m_xWidthAutoFT(m_xBuilder->weld_label("autowidthft")) + , m_xRelWidthCB(m_xBuilder->weld_check_button("relwidth")) + , m_xRelWidthRelationLB(m_xBuilder->weld_combo_box("relwidthrelation")) + , m_xAutoWidthCB(m_xBuilder->weld_check_button("autowidth")) + , m_xHeightFT(m_xBuilder->weld_label("heightft")) + , m_xHeightAutoFT(m_xBuilder->weld_label("autoheightft")) + , m_xRelHeightCB(m_xBuilder->weld_check_button("relheight")) + , m_xRelHeightRelationLB(m_xBuilder->weld_combo_box("relheightrelation")) + , m_xAutoHeightCB(m_xBuilder->weld_check_button("autoheight")) + , m_xFixedRatioCB(m_xBuilder->weld_check_button("ratio")) + , m_xRealSizeBT(m_xBuilder->weld_button("origsize")) + , m_xAnchorFrame(m_xBuilder->weld_widget("anchorframe")) + , m_xAnchorAtPageRB(m_xBuilder->weld_radio_button("topage")) + , m_xAnchorAtParaRB(m_xBuilder->weld_radio_button("topara")) + , m_xAnchorAtCharRB(m_xBuilder->weld_radio_button("tochar")) + , m_xAnchorAsCharRB(m_xBuilder->weld_radio_button("aschar")) + , m_xAnchorAtFrameRB(m_xBuilder->weld_radio_button("toframe")) + , m_xHorizontalFT(m_xBuilder->weld_label("horiposft")) + , m_xHorizontalDLB(m_xBuilder->weld_combo_box("horipos")) + , m_xAtHorzPosFT(m_xBuilder->weld_label("horibyft")) + , m_xAtHorzPosED(m_xBuilder->weld_metric_spin_button("byhori", FieldUnit::CM)) + , m_xHoriRelationFT(m_xBuilder->weld_label("horitoft")) + , m_xHoriRelationLB(m_xBuilder->weld_combo_box("horianchor")) + , m_xMirrorPagesCB(m_xBuilder->weld_check_button("mirror")) + , m_xVerticalFT(m_xBuilder->weld_label("vertposft")) + , m_xVerticalDLB(m_xBuilder->weld_combo_box("vertpos")) + , m_xAtVertPosFT(m_xBuilder->weld_label("vertbyft")) + , m_xAtVertPosED(m_xBuilder->weld_metric_spin_button("byvert", FieldUnit::CM)) + , m_xVertRelationFT(m_xBuilder->weld_label("verttoft")) + , m_xVertRelationLB(m_xBuilder->weld_combo_box("vertanchor")) + , m_xFollowTextFlowCB(m_xBuilder->weld_check_button("followtextflow")) + , m_xExampleWN(new weld::CustomWeld(*m_xBuilder, "preview", m_aExampleWN)) + , m_xWidthED(new SwPercentField(m_xBuilder->weld_metric_spin_button("width", FieldUnit::CM))) + , m_xHeightED(new SwPercentField(m_xBuilder->weld_metric_spin_button("height", FieldUnit::CM))) +{ + const auto nWidthRequest = m_xAtHorzPosED->get_preferred_size().Width(); + m_xAtHorzPosED->set_size_request(nWidthRequest, -1); + m_xAtVertPosED->set_size_request(nWidthRequest, -1); setOptimalFrameWidth(); setOptimalRelWidth(); SetExchangeSupport(); - Link<Control&,void> aLk3 = LINK(this, SwFramePage, RangeModifyLoseFocusHdl); - m_aWidthED.SetLoseFocusHdl( aLk3 ); - m_aHeightED.SetLoseFocusHdl( aLk3 ); - m_pAtHorzPosED->SetLoseFocusHdl( aLk3 ); - m_pAtVertPosED->SetLoseFocusHdl( aLk3 ); - m_pFollowTextFlowCB->SetClickHdl( LINK(this, SwFramePage, RangeModifyClickHdl) ); - - Link<Edit&,void> aLk = LINK(this, SwFramePage, ModifyHdl); - m_aWidthED.SetModifyHdl( aLk ); - m_aHeightED.SetModifyHdl( aLk ); - m_pAtHorzPosED->SetModifyHdl( aLk ); - m_pAtVertPosED->SetModifyHdl( aLk ); + Link<weld::MetricSpinButton&,void> aLk3 = LINK(this, SwFramePage, ModifyHdl); + m_xWidthED->connect_value_changed( aLk3 ); + m_xHeightED->connect_value_changed( aLk3 ); + m_xAtHorzPosED->connect_value_changed( aLk3 ); + m_xAtVertPosED->connect_value_changed( aLk3 ); + m_xFollowTextFlowCB->connect_toggled(LINK(this, SwFramePage, RangeModifyClickHdl)); - Link<Button*,void> aLk2 = LINK(this, SwFramePage, AnchorTypeHdl); - m_pAnchorAtPageRB->SetClickHdl( aLk2 ); - m_pAnchorAtParaRB->SetClickHdl( aLk2 ); - m_pAnchorAtCharRB->SetClickHdl( aLk2 ); - m_pAnchorAsCharRB->SetClickHdl( aLk2 ); - m_pAnchorAtFrameRB->SetClickHdl( aLk2 ); + Link<weld::ToggleButton&,void> aLk2 = LINK(this, SwFramePage, AnchorTypeHdl); + m_xAnchorAtPageRB->connect_toggled( aLk2 ); + m_xAnchorAtParaRB->connect_toggled( aLk2 ); + m_xAnchorAtCharRB->connect_toggled( aLk2 ); + m_xAnchorAsCharRB->connect_toggled( aLk2 ); + m_xAnchorAtFrameRB->connect_toggled( aLk2 ); - m_pHorizontalDLB->SetSelectHdl(LINK(this, SwFramePage, PosHdl)); - m_pVerticalDLB-> SetSelectHdl(LINK(this, SwFramePage, PosHdl)); + m_xHorizontalDLB->connect_changed(LINK(this, SwFramePage, PosHdl)); + m_xVerticalDLB->connect_changed(LINK(this, SwFramePage, PosHdl)); - m_pHoriRelationLB->SetSelectHdl(LINK(this, SwFramePage, RelHdl)); - m_pVertRelationLB->SetSelectHdl(LINK(this, SwFramePage, RelHdl)); + m_xHoriRelationLB->connect_changed(LINK(this, SwFramePage, RelHdl)); + m_xVertRelationLB->connect_changed(LINK(this, SwFramePage, RelHdl)); - m_pMirrorPagesCB->SetClickHdl(LINK(this, SwFramePage, MirrorHdl)); + m_xMirrorPagesCB->connect_toggled(LINK(this, SwFramePage, MirrorHdl)); aLk2 = LINK(this, SwFramePage, RelSizeClickHdl); - m_pRelWidthCB->SetClickHdl( aLk2 ); - m_pRelHeightCB->SetClickHdl( aLk2 ); + m_xRelWidthCB->connect_toggled(aLk2); + m_xRelHeightCB->connect_toggled(aLk2); - m_pAutoWidthCB->SetClickHdl( LINK( this, SwFramePage, AutoWidthClickHdl ) ); - m_pAutoHeightCB->SetClickHdl( LINK( this, SwFramePage, AutoHeightClickHdl ) ); + m_xAutoWidthCB->connect_toggled(LINK(this, SwFramePage, AutoWidthClickHdl)); + m_xAutoHeightCB->connect_toggled(LINK(this, SwFramePage, AutoHeightClickHdl)); } SwFramePage::~SwFramePage() @@ -725,44 +709,6 @@ SwFramePage::~SwFramePage() disposeOnce(); } -void SwFramePage::dispose() -{ - m_pWidthFT.clear(); - m_pWidthAutoFT.clear(); - m_pRelWidthCB.clear(); - m_pRelWidthRelationLB.clear(); - m_pAutoWidthCB.clear(); - m_pHeightFT.clear(); - m_pHeightAutoFT.clear(); - m_pRelHeightCB.clear(); - m_pRelHeightRelationLB.clear(); - m_pAutoHeightCB.clear(); - m_pFixedRatioCB.clear(); - m_pRealSizeBT.clear(); - m_pAnchorFrame.clear(); - m_pAnchorAtPageRB.clear(); - m_pAnchorAtParaRB.clear(); - m_pAnchorAtCharRB.clear(); - m_pAnchorAsCharRB.clear(); - m_pAnchorAtFrameRB.clear(); - m_pHorizontalFT.clear(); - m_pHorizontalDLB.clear(); - m_pAtHorzPosFT.clear(); - m_pAtHorzPosED.clear(); - m_pHoriRelationFT.clear(); - m_pHoriRelationLB.clear(); - m_pMirrorPagesCB.clear(); - m_pVerticalFT.clear(); - m_pVerticalDLB.clear(); - m_pAtVertPosFT.clear(); - m_pAtVertPosED.clear(); - m_pVertRelationFT.clear(); - m_pVertRelationLB.clear(); - m_pFollowTextFlowCB.clear(); - m_pExampleWN.clear(); - SfxTabPage::dispose(); -} - namespace { struct FrameMaps @@ -813,13 +759,13 @@ void SwFramePage::setOptimalFrameWidth() for (const auto& rFrame : aFrames) { - m_pHorizontalDLB->InsertEntry(SvxSwFramePosString::GetString(rFrame)); + m_xHorizontalDLB->append_text(SvxSwFramePosString::GetString(rFrame)); } - Size aBiggest(m_pHorizontalDLB->GetOptimalSize()); - m_pHorizontalDLB->set_width_request(aBiggest.Width()); - m_pVerticalDLB->set_width_request(aBiggest.Width()); - m_pHorizontalDLB->Clear(); + Size aBiggest(m_xHorizontalDLB->get_preferred_size()); + m_xHorizontalDLB->set_size_request(aBiggest.Width(), -1); + m_xVerticalDLB->set_size_request(aBiggest.Width(), -1); + m_xHorizontalDLB->clear(); } namespace @@ -853,36 +799,36 @@ void SwFramePage::setOptimalRelWidth() for (const auto& rRel : aRels) { - m_pHoriRelationLB->InsertEntry(SvxSwFramePosString::GetString(rRel)); + m_xHoriRelationLB->append_text(SvxSwFramePosString::GetString(rRel)); } - Size aBiggest(m_pHoriRelationLB->GetOptimalSize()); - m_pHoriRelationLB->set_width_request(aBiggest.Width()); - m_pVertRelationLB->set_width_request(aBiggest.Width()); - m_pRelWidthRelationLB->set_width_request(aBiggest.Width()); - m_pRelHeightRelationLB->set_width_request(aBiggest.Width()); - m_pHoriRelationLB->Clear(); + Size aBiggest(m_xHoriRelationLB->get_preferred_size()); + m_xHoriRelationLB->set_size_request(aBiggest.Width(), -1); + m_xVertRelationLB->set_size_request(aBiggest.Width(), -1); + m_xRelWidthRelationLB->set_size_request(aBiggest.Width(), -1); + m_xRelHeightRelationLB->set_size_request(aBiggest.Width(), -1); + m_xHoriRelationLB->clear(); } VclPtr<SfxTabPage> SwFramePage::Create(TabPageParent pParent, const SfxItemSet *rSet) { - return VclPtr<SwFramePage>::Create( pParent.pParent, *rSet ); + return VclPtr<SwFramePage>::Create(pParent, *rSet); } void SwFramePage::EnableGraficMode() { // i#39692 - mustn't be called more than once - if(!m_pRealSizeBT->IsVisible()) + if (!m_xRealSizeBT->get_visible()) { - m_pWidthFT->Show(); - m_pWidthAutoFT->Hide(); - m_pAutoHeightCB->Hide(); + m_xWidthFT->show(); + m_xWidthAutoFT->hide(); + m_xAutoHeightCB->hide(); - m_pHeightFT->Show(); - m_pHeightAutoFT->Hide(); - m_pAutoWidthCB->Hide(); + m_xHeightFT->show(); + m_xHeightAutoFT->hide(); + m_xAutoWidthCB->hide(); - m_pRealSizeBT->Show(); + m_xRealSizeBT->show(); } } @@ -900,10 +846,10 @@ void SwFramePage::Reset( const SfxItemSet *rSet ) m_bHtmlMode = (m_nHtmlMode & HTMLMODE_ON) != 0; FieldUnit aMetric = ::GetDfltMetric(m_bHtmlMode); - m_aWidthED.SetMetric(aMetric); - m_aHeightED.SetMetric(aMetric); - SetMetric( *m_pAtHorzPosED, aMetric ); - SetMetric( *m_pAtVertPosED, aMetric ); + m_xWidthED->SetMetric(aMetric); + m_xHeightED->SetMetric(aMetric); + ::SetFieldUnit(*m_xAtHorzPosED, aMetric); + ::SetFieldUnit(*m_xAtVertPosED, aMetric); const SfxPoolItem* pItem = nullptr; const SwFormatAnchor& rAnchor = rSet->Get(RES_ANCHOR); @@ -918,18 +864,18 @@ void SwFramePage::Reset( const SfxItemSet *rSet ) if (m_bFormat) { // at formats no anchor editing - m_pAnchorFrame->Enable(false); - m_pFixedRatioCB->Enable(false); + m_xAnchorFrame->set_sensitive(false); + m_xFixedRatioCB->set_sensitive(false); } else { if (rAnchor.GetAnchorId() != RndStdIds::FLY_AT_FLY && !pSh->IsFlyInFly()) - m_pAnchorAtFrameRB->Hide(); + m_xAnchorAtFrameRB->hide(); if ( pSh->IsFrameVertical( true, m_bIsInRightToLeft, m_bIsVerticalL2R ) ) { - OUString sHLabel = m_pHorizontalFT->GetText(); - m_pHorizontalFT->SetText(m_pVerticalFT->GetText()); - m_pVerticalFT->SetText(sHLabel); + OUString sHLabel = m_xHorizontalFT->get_label(); + m_xHorizontalFT->set_label(m_xVerticalFT->get_label()); + m_xVerticalFT->set_label(sHLabel); m_bIsVerticalFrame = true; } } @@ -945,12 +891,12 @@ void SwFramePage::Reset( const SfxItemSet *rSet ) if ( !m_bNew ) { - m_pRealSizeBT->SetClickHdl(LINK(this, SwFramePage, RealSizeHdl)); + m_xRealSizeBT->connect_clicked(LINK(this, SwFramePage, RealSizeHdl)); EnableGraficMode(); } - if ( m_sDlgType == "PictureDialog" ) - m_pFixedRatioCB->Check( false ); + if (m_sDlgType == "PictureDialog") + m_xFixedRatioCB->set_active(false); else { if ( m_bNew ) @@ -964,48 +910,46 @@ void SwFramePage::Reset( const SfxItemSet *rSet ) m_aGrfSize = rSet->Get(RES_FRM_SIZE).GetSize(); } - // entering procent value made possible - m_aWidthED.SetBaseValue( m_aWidthED.Normalize(m_aGrfSize.Width()), FieldUnit::TWIP ); - m_aHeightED.SetBaseValue( m_aHeightED.Normalize(m_aGrfSize.Height()), FieldUnit::TWIP ); - //the available space is not yet known so the RefValue has to be calculated from size and relative size values - //this is needed only if relative values are already set + // entering percent value made possible + // the available space is not yet known so the RefValue has to be calculated from size and relative size values + // this is needed only if relative values are already set const SwFormatFrameSize& rFrameSize = rSet->Get(RES_FRM_SIZE); - m_pRelWidthRelationLB->InsertEntry(SvxSwFramePosString::GetString(SwFPos::FRAME)); - m_pRelWidthRelationLB->InsertEntry(SvxSwFramePosString::GetString(SwFPos::REL_PG_FRAME)); + m_xRelWidthRelationLB->append_text(SvxSwFramePosString::GetString(SwFPos::FRAME)); + m_xRelWidthRelationLB->append_text(SvxSwFramePosString::GetString(SwFPos::REL_PG_FRAME)); if (rFrameSize.GetWidthPercent() != SwFormatFrameSize::SYNCED && rFrameSize.GetWidthPercent() != 0) { - //calculate the reference value from the with and relative width values + //calculate the reference value from the width and relative width values sal_Int32 nSpace = rFrameSize.GetWidth() * 100 / rFrameSize.GetWidthPercent(); - m_aWidthED.SetRefValue( nSpace ); + m_xWidthED->SetRefValue( nSpace ); - m_pRelWidthRelationLB->Enable(); + m_xRelWidthRelationLB->set_sensitive(true); } else - m_pRelWidthRelationLB->Disable(); + m_xRelWidthRelationLB->set_sensitive(false); - m_pRelHeightRelationLB->InsertEntry(SvxSwFramePosString::GetString(SwFPos::FRAME)); - m_pRelHeightRelationLB->InsertEntry(SvxSwFramePosString::GetString(SwFPos::REL_PG_FRAME)); + m_xRelHeightRelationLB->append_text(SvxSwFramePosString::GetString(SwFPos::FRAME)); + m_xRelHeightRelationLB->append_text(SvxSwFramePosString::GetString(SwFPos::REL_PG_FRAME)); if (rFrameSize.GetHeightPercent() != SwFormatFrameSize::SYNCED && rFrameSize.GetHeightPercent() != 0) { //calculate the reference value from the with and relative width values sal_Int32 nSpace = rFrameSize.GetHeight() * 100 / rFrameSize.GetHeightPercent(); - m_aHeightED.SetRefValue( nSpace ); + m_xHeightED->SetRefValue( nSpace ); - m_pRelHeightRelationLB->Enable(); + m_xRelHeightRelationLB->set_sensitive(true); } else - m_pRelHeightRelationLB->Disable(); + m_xRelHeightRelationLB->set_sensitive(false); // general initialisation part switch(rAnchor.GetAnchorId()) { - case RndStdIds::FLY_AT_PAGE: m_pAnchorAtPageRB->Check(); break; - case RndStdIds::FLY_AT_PARA: m_pAnchorAtParaRB->Check(); break; - case RndStdIds::FLY_AT_CHAR: m_pAnchorAtCharRB->Check(); break; - case RndStdIds::FLY_AS_CHAR: m_pAnchorAsCharRB->Check(); break; - case RndStdIds::FLY_AT_FLY: m_pAnchorAtFrameRB->Check();break; + case RndStdIds::FLY_AT_PAGE: m_xAnchorAtPageRB->set_active(true); break; + case RndStdIds::FLY_AT_PARA: m_xAnchorAtParaRB->set_active(true); break; + case RndStdIds::FLY_AT_CHAR: m_xAnchorAtCharRB->set_active(true); break; + case RndStdIds::FLY_AS_CHAR: m_xAnchorAsCharRB->set_active(true); break; + case RndStdIds::FLY_AT_FLY: m_xAnchorAtFrameRB->set_active(true);break; default:; //prevent warning } @@ -1017,50 +961,53 @@ void SwFramePage::Reset( const SfxItemSet *rSet ) { const bool bFollowTextFlow = rSet->Get(RES_FOLLOW_TEXT_FLOW).GetValue(); - m_pFollowTextFlowCB->Check( bFollowTextFlow ); + m_xFollowTextFlowCB->set_active(bFollowTextFlow); } if(m_bHtmlMode) { - m_pAutoHeightCB->Enable(false); - m_pAutoWidthCB->Enable(false); - m_pMirrorPagesCB->Show(false); + m_xAutoHeightCB->set_sensitive(false); + m_xAutoWidthCB->set_sensitive(false); + m_xMirrorPagesCB->show(false); if (m_sDlgType == "FrameDialog") - m_pFixedRatioCB->Enable(false); + m_xFixedRatioCB->set_sensitive(false); // i#18732 hide checkbox in HTML mode - m_pFollowTextFlowCB->Show(false); + m_xFollowTextFlowCB->show(false); } else { // enable/disable of check box 'Mirror on..' - m_pMirrorPagesCB->Enable(!m_pAnchorAsCharRB->IsChecked()); + m_xMirrorPagesCB->set_sensitive(!m_xAnchorAsCharRB->get_active()); // enable/disable check box 'Follow text flow'. // enable check box 'Follow text // flow' also for anchor type to-frame. - m_pFollowTextFlowCB->Enable( m_pAnchorAtParaRB->IsChecked() || - m_pAnchorAtCharRB->IsChecked() || - m_pAnchorAtFrameRB->IsChecked() ); + m_xFollowTextFlowCB->set_sensitive(m_xAnchorAtParaRB->get_active() || + m_xAnchorAtCharRB->get_active() || + m_xAnchorAtFrameRB->get_active()); } - Init( *rSet, true ); - m_pAtVertPosED->SaveValue(); - m_pAtHorzPosED->SaveValue(); - m_pFollowTextFlowCB->SaveValue(); + Init(*rSet); + m_xAtVertPosED->save_value(); + m_xAtHorzPosED->save_value(); + m_xFollowTextFlowCB->save_state(); + + m_xWidthED->save_value(); + m_xHeightED->save_value(); m_bNoModifyHdl = false; //lock PercentFields - m_aWidthED.LockAutoCalculation(true); - m_aHeightED.LockAutoCalculation(true); + m_xWidthED->LockAutoCalculation(true); + m_xHeightED->LockAutoCalculation(true); RangeModifyHdl(); // set all maximum values initially - m_aHeightED.LockAutoCalculation(false); - m_aWidthED.LockAutoCalculation(false); + m_xHeightED->LockAutoCalculation(false); + m_xWidthED->LockAutoCalculation(false); - m_pAutoHeightCB->SaveValue(); - m_pAutoWidthCB->SaveValue(); + m_xAutoHeightCB->save_state(); + m_xAutoWidthCB->save_state(); - SwTwips nWidth = static_cast< SwTwips >(m_aWidthED.DenormalizePercent(m_aWidthED.GetValue(FieldUnit::TWIP))); - SwTwips nHeight = static_cast< SwTwips >(m_aHeightED.DenormalizePercent(m_aHeightED.GetValue(FieldUnit::TWIP))); + SwTwips nWidth = static_cast< SwTwips >(m_xWidthED->DenormalizePercent(m_xWidthED->get_value(FieldUnit::TWIP))); + SwTwips nHeight = static_cast< SwTwips >(m_xHeightED->DenormalizePercent(m_xHeightED->get_value(FieldUnit::TWIP))); m_fWidthHeightRatio = nHeight ? double(nWidth) / double(nHeight) : 1.0; } @@ -1090,21 +1037,21 @@ bool SwFramePage::FillItemSet(SfxItemSet *rSet) { SwFormatHoriOrient aHoriOrient( rOldSet.Get(RES_HORI_ORIENT) ); - const sal_Int32 nMapPos = GetMapPos(m_pHMap, *m_pHorizontalDLB); - const sal_Int16 eHOri = GetAlignment(m_pHMap, nMapPos, *m_pHoriRelationLB); - const sal_Int16 eRel = GetRelation(*m_pHoriRelationLB); + const sal_Int32 nMapPos = GetMapPos(m_pHMap, *m_xHorizontalDLB); + const sal_Int16 eHOri = GetAlignment(m_pHMap, nMapPos, *m_xHoriRelationLB); + const sal_Int16 eRel = GetRelation(*m_xHoriRelationLB); aHoriOrient.SetHoriOrient( eHOri ); aHoriOrient.SetRelationOrient( eRel ); - aHoriOrient.SetPosToggle(m_pMirrorPagesCB->IsChecked()); + aHoriOrient.SetPosToggle(m_xMirrorPagesCB->get_active()); - bool bMod = m_pAtHorzPosED->IsValueChangedFromSaved(); - bMod |= m_pMirrorPagesCB->IsValueChangedFromSaved(); + bool bMod = m_xAtHorzPosED->get_value_changed_from_saved(); + bMod |= m_xMirrorPagesCB->get_state_changed_from_saved(); if ( eHOri == text::HoriOrientation::NONE && (m_bNew || (m_bAtHorzPosModified || bMod) || m_nOldH != eHOri ) ) { - SwTwips nX = static_cast< SwTwips >(m_pAtHorzPosED->Denormalize(m_pAtHorzPosED->GetValue(FieldUnit::TWIP))); + SwTwips nX = static_cast< SwTwips >(m_xAtHorzPosED->denormalize(m_xAtHorzPosED->get_value(FieldUnit::TWIP))); aHoriOrient.SetPos( nX ); } @@ -1125,21 +1072,21 @@ bool SwFramePage::FillItemSet(SfxItemSet *rSet) // alignment vertical SwFormatVertOrient aVertOrient( rOldSet.Get(RES_VERT_ORIENT) ); - const sal_Int32 nMapPos = GetMapPos(m_pVMap, *m_pVerticalDLB); - const sal_Int16 eVOri = GetAlignment(m_pVMap, nMapPos, *m_pVertRelationLB); - const sal_Int16 eRel = GetRelation(*m_pVertRelationLB); + const sal_Int32 nMapPos = GetMapPos(m_pVMap, *m_xVerticalDLB); + const sal_Int16 eVOri = GetAlignment(m_pVMap, nMapPos, *m_xVertRelationLB); + const sal_Int16 eRel = GetRelation(*m_xVertRelationLB); aVertOrient.SetVertOrient ( eVOri); aVertOrient.SetRelationOrient( eRel ); - bool bMod = m_pAtVertPosED->IsValueChangedFromSaved(); + bool bMod = m_xAtVertPosED->get_value_changed_from_saved(); if ( eVOri == text::VertOrientation::NONE && ( m_bNew || (m_bAtVertPosModified || bMod) || m_nOldV != eVOri) ) { // vertical position // recalculate offset for character bound frames - SwTwips nY = static_cast< SwTwips >(m_pAtVertPosED->Denormalize(m_pAtVertPosED->GetValue(FieldUnit::TWIP))); + SwTwips nY = static_cast< SwTwips >(m_xAtVertPosED->denormalize(m_xAtVertPosED->get_value(FieldUnit::TWIP))); if (eAnchorId == RndStdIds::FLY_AS_CHAR) { nY *= -1; @@ -1170,16 +1117,16 @@ bool SwFramePage::FillItemSet(SfxItemSet *rSet) const SwFormatFrameSize& rOldSize = rOldSet.Get(RES_FRM_SIZE); SwFormatFrameSize aSz( rOldSize ); - sal_Int32 nRelWidthRelation = m_pRelWidthRelationLB->GetSelectedEntryPos(); - if (nRelWidthRelation != LISTBOX_ENTRY_NOTFOUND) + auto nRelWidthRelation = m_xRelWidthRelationLB->get_active(); + if (nRelWidthRelation != -1) { if (nRelWidthRelation == 0) aSz.SetWidthPercentRelation(text::RelOrientation::FRAME); else if (nRelWidthRelation == 1) aSz.SetWidthPercentRelation(text::RelOrientation::PAGE_FRAME); } - sal_Int32 nRelHeightRelation = m_pRelHeightRelationLB->GetSelectedEntryPos(); - if (nRelHeightRelation != LISTBOX_ENTRY_NOTFOUND) + auto nRelHeightRelation = m_xRelHeightRelationLB->get_active(); + if (nRelHeightRelation != -1) { if (nRelHeightRelation == 0) aSz.SetHeightPercentRelation(text::RelOrientation::FRAME); @@ -1187,35 +1134,36 @@ bool SwFramePage::FillItemSet(SfxItemSet *rSet) aSz.SetHeightPercentRelation(text::RelOrientation::PAGE_FRAME); } - bool bValueModified = (m_aWidthED.IsValueModified() || m_aHeightED.IsValueModified()); - bool bCheckChanged = m_pRelWidthCB->IsValueChangedFromSaved() - || m_pRelHeightCB->IsValueChangedFromSaved(); + bool bValueModified = m_xWidthED->get_value_changed_from_saved() || + m_xHeightED->get_value_changed_from_saved(); + bool bCheckChanged = m_xRelWidthCB->get_state_changed_from_saved() || + m_xRelHeightCB->get_state_changed_from_saved(); bool bLegalValue = !(!rOldSize.GetWidth () && !rOldSize.GetHeight() && - m_aWidthED .GetValue() == m_aWidthED .GetMin() && - m_aHeightED.GetValue() == m_aHeightED.GetMin()); + m_xWidthED->get_value() == m_xWidthED->get_min() && + m_xHeightED->get_value() == m_xHeightED->get_min()); if ((m_bNew && !m_bFormat) || ((bValueModified || bCheckChanged) && bLegalValue)) { - sal_Int64 nNewWidth = m_aWidthED.DenormalizePercent(m_aWidthED.GetRealValue(FieldUnit::TWIP)); - sal_Int64 nNewHeight = m_aHeightED.DenormalizePercent(m_aHeightED.GetRealValue(FieldUnit::TWIP)); + sal_Int64 nNewWidth = m_xWidthED->DenormalizePercent(m_xWidthED->GetRealValue(FieldUnit::TWIP)); + sal_Int64 nNewHeight = m_xHeightED->DenormalizePercent(m_xHeightED->GetRealValue(FieldUnit::TWIP)); aSz.SetWidth (static_cast< SwTwips >(nNewWidth)); aSz.SetHeight(static_cast< SwTwips >(nNewHeight)); - if (m_pRelWidthCB->IsChecked()) + if (m_xRelWidthCB->get_active()) { - aSz.SetWidthPercent(static_cast<sal_uInt8>(std::min( static_cast< sal_Int64 >(MAX_PERCENT_WIDTH), m_aWidthED.Convert(m_aWidthED.NormalizePercent(nNewWidth), FieldUnit::TWIP, FieldUnit::CUSTOM)))); + aSz.SetWidthPercent(static_cast<sal_uInt8>(std::min(MAX_PERCENT_WIDTH, m_xWidthED->Convert(m_xWidthED->NormalizePercent(nNewWidth), FieldUnit::TWIP, FieldUnit::PERCENT)))); } else aSz.SetWidthPercent(0); - if (m_pRelHeightCB->IsChecked()) - aSz.SetHeightPercent(static_cast<sal_uInt8>(std::min(static_cast< sal_Int64 >(MAX_PERCENT_HEIGHT), m_aHeightED.Convert(m_aHeightED.NormalizePercent(nNewHeight), FieldUnit::TWIP, FieldUnit::CUSTOM)))); + if (m_xRelHeightCB->get_active()) + aSz.SetHeightPercent(static_cast<sal_uInt8>(std::min(MAX_PERCENT_HEIGHT, m_xHeightED->Convert(m_xHeightED->NormalizePercent(nNewHeight), FieldUnit::TWIP, FieldUnit::PERCENT)))); else aSz.SetHeightPercent(0); - if (m_pFixedRatioCB->IsChecked() && (m_pRelWidthCB->IsChecked() != m_pRelHeightCB->IsChecked())) + if (m_xFixedRatioCB->get_active() && (m_xRelWidthCB->get_active() != m_xRelHeightCB->get_active())) { - if (m_pRelWidthCB->IsChecked()) + if (m_xRelWidthCB->get_active()) aSz.SetHeightPercent(SwFormatFrameSize::SYNCED); else aSz.SetWidthPercent(SwFormatFrameSize::SYNCED); @@ -1223,21 +1171,21 @@ bool SwFramePage::FillItemSet(SfxItemSet *rSet) } if( !IsInGraficMode() ) { - if( m_pAutoHeightCB->IsValueChangedFromSaved() ) + if (m_xAutoHeightCB->get_state_changed_from_saved()) { - SwFrameSize eFrameSize = m_pAutoHeightCB->IsChecked()? ATT_MIN_SIZE : ATT_FIX_SIZE; + SwFrameSize eFrameSize = m_xAutoHeightCB->get_active()? ATT_MIN_SIZE : ATT_FIX_SIZE; if( eFrameSize != aSz.GetHeightSizeType() ) aSz.SetHeightSizeType(eFrameSize); } - if( m_pAutoWidthCB->IsValueChangedFromSaved() ) + if (m_xAutoWidthCB->get_state_changed_from_saved()) { - SwFrameSize eFrameSize = m_pAutoWidthCB->IsChecked()? ATT_MIN_SIZE : ATT_FIX_SIZE; + SwFrameSize eFrameSize = m_xAutoWidthCB->get_active()? ATT_MIN_SIZE : ATT_FIX_SIZE; if( eFrameSize != aSz.GetWidthSizeType() ) aSz.SetWidthSizeType( eFrameSize ); } } - if( !m_bFormat && m_pFixedRatioCB->IsValueChangedFromSaved() ) - bRet |= nullptr != rSet->Put(SfxBoolItem(FN_KEEP_ASPECT_RATIO, m_pFixedRatioCB->IsChecked())); + if (!m_bFormat && m_xFixedRatioCB->get_state_changed_from_saved()) + bRet |= nullptr != rSet->Put(SfxBoolItem(FN_KEEP_ASPECT_RATIO, m_xFixedRatioCB->get_active())); pOldItem = GetOldItem(*rSet, RES_FRM_SIZE); @@ -1251,9 +1199,9 @@ bool SwFramePage::FillItemSet(SfxItemSet *rSet) bRet |= nullptr != rSet->Put( aSz ); } - if(m_pFollowTextFlowCB->IsValueChangedFromSaved()) + if (m_xFollowTextFlowCB->get_state_changed_from_saved()) { - bRet |= nullptr != rSet->Put(SwFormatFollowTextFlow(m_pFollowTextFlowCB->IsChecked())); + bRet |= nullptr != rSet->Put(SwFormatFollowTextFlow(m_xFollowTextFlowCB->get_active())); } return bRet; } @@ -1267,24 +1215,24 @@ void SwFramePage::InitPos(RndStdIds eId, long nX, long nY) { - sal_Int32 nPos = m_pVerticalDLB->GetSelectedEntryPos(); - if ( nPos != LISTBOX_ENTRY_NOTFOUND && m_pVMap ) + auto nPos = m_xVerticalDLB->get_active(); + if (nPos != -1 && m_pVMap) { m_nOldV = m_pVMap[nPos].nAlign; - nPos = m_pVertRelationLB->GetSelectedEntryPos(); - if (nPos != LISTBOX_ENTRY_NOTFOUND) - m_nOldVRel = static_cast<RelationMap *>(m_pVertRelationLB->GetEntryData(nPos))->nRelation; + nPos = m_xVertRelationLB->get_active(); + if (nPos != -1) + m_nOldVRel = reinterpret_cast<RelationMap*>(m_xVertRelationLB->get_id(nPos).toInt64())->nRelation; } - nPos = m_pHorizontalDLB->GetSelectedEntryPos(); - if ( nPos != LISTBOX_ENTRY_NOTFOUND && m_pHMap ) + nPos = m_xHorizontalDLB->get_active(); + if (nPos != -1 && m_pHMap) { m_nOldH = m_pHMap[nPos].nAlign; - nPos = m_pHoriRelationLB->GetSelectedEntryPos(); - if (nPos != LISTBOX_ENTRY_NOTFOUND) - m_nOldHRel = static_cast<RelationMap *>(m_pHoriRelationLB->GetEntryData(nPos))->nRelation; + nPos = m_xHoriRelationLB->get_active(); + if (nPos != -1) + m_nOldHRel = reinterpret_cast<RelationMap*>(m_xHoriRelationLB->get_id(nPos).toInt64())->nRelation; } bool bEnable = true; @@ -1332,8 +1280,8 @@ void SwFramePage::InitPos(RndStdIds eId, m_pHMap = nullptr; bEnable = false; } - m_pHorizontalDLB->Enable( bEnable ); - m_pHorizontalFT->Enable( bEnable ); + m_xHorizontalDLB->set_sensitive( bEnable ); + m_xHorizontalFT->set_sensitive( bEnable ); // select current Pos // horizontal @@ -1342,8 +1290,8 @@ void SwFramePage::InitPos(RndStdIds eId, nH = m_nOldH; nHRel = m_nOldHRel; } - sal_Int32 nMapPos = FillPosLB(m_pHMap, nH, nHRel, *m_pHorizontalDLB); - FillRelLB(m_pHMap, nMapPos, nH, nHRel, *m_pHoriRelationLB, *m_pHoriRelationFT); + sal_Int32 nMapPos = FillPosLB(m_pHMap, nH, nHRel, *m_xHorizontalDLB); + FillRelLB(m_pHMap, nMapPos, nH, nHRel, *m_xHoriRelationLB, *m_xHoriRelationFT); // vertical if ( nV < 0 ) @@ -1351,34 +1299,26 @@ void SwFramePage::InitPos(RndStdIds eId, nV = m_nOldV; nVRel = m_nOldVRel; } - nMapPos = FillPosLB(m_pVMap, nV, nVRel, *m_pVerticalDLB); - FillRelLB(m_pVMap, nMapPos, nV, nVRel, *m_pVertRelationLB, *m_pVertRelationFT); + nMapPos = FillPosLB(m_pVMap, nV, nVRel, *m_xVerticalDLB); + FillRelLB(m_pVMap, nMapPos, nV, nVRel, *m_xVertRelationLB, *m_xVertRelationFT); bEnable = nH == text::HoriOrientation::NONE && eId != RndStdIds::FLY_AS_CHAR; if (!bEnable) - { - m_pAtHorzPosED->SetValue( 0, FieldUnit::TWIP ); - if (nX != LONG_MAX && m_bHtmlMode) - m_pAtHorzPosED->SetModifyFlag(); - } + m_xAtHorzPosED->set_value(0, FieldUnit::TWIP); else { if (nX != LONG_MAX) - m_pAtHorzPosED->SetValue( m_pAtHorzPosED->Normalize(nX), FieldUnit::TWIP ); + m_xAtHorzPosED->set_value(m_xAtHorzPosED->normalize(nX), FieldUnit::TWIP); } - m_pAtHorzPosFT->Enable( bEnable ); - m_pAtHorzPosED->Enable( bEnable ); + m_xAtHorzPosFT->set_sensitive( bEnable ); + m_xAtHorzPosED->set_sensitive( bEnable ); bEnable = nV == text::VertOrientation::NONE; if ( !bEnable ) - { - m_pAtVertPosED->SetValue( 0, FieldUnit::TWIP ); - if(nY != LONG_MAX && m_bHtmlMode) - m_pAtVertPosED->SetModifyFlag(); - } + m_xAtVertPosED->set_value(0, FieldUnit::TWIP); else { - if ( eId == RndStdIds::FLY_AS_CHAR ) + if (eId == RndStdIds::FLY_AS_CHAR) { if ( nY == LONG_MAX ) nY = 0; @@ -1386,22 +1326,22 @@ void SwFramePage::InitPos(RndStdIds eId, nY *= -1; } if ( nY != LONG_MAX ) - m_pAtVertPosED->SetValue( m_pAtVertPosED->Normalize(nY), FieldUnit::TWIP ); + m_xAtVertPosED->set_value(m_xAtVertPosED->normalize(nY), FieldUnit::TWIP); } - m_pAtVertPosFT->Enable( bEnable && m_bAllowVertPositioning ); - m_pAtVertPosED->Enable( bEnable && m_bAllowVertPositioning ); + m_xAtVertPosFT->set_sensitive( bEnable && m_bAllowVertPositioning ); + m_xAtVertPosED->set_sensitive( bEnable && m_bAllowVertPositioning ); UpdateExample(); } sal_Int32 SwFramePage::FillPosLB(const FrameMap* _pMap, const sal_Int16 _nAlign, const sal_Int16 _nRel, - ListBox& _rLB ) + weld::ComboBox& _rLB ) { OUString sSelEntry; - const OUString sOldEntry = _rLB.GetSelectedEntry(); + const OUString sOldEntry = _rLB.get_active_text(); - _rLB.Clear(); + _rLB.clear(); // i#22341 determine all possible listbox relations for // given relation for map <aVCharMap> @@ -1414,17 +1354,17 @@ sal_Int32 SwFramePage::FillPosLB(const FrameMap* _pMap, for (size_t i = 0; _pMap && i < nCount; ++i) { // Why not from the left/from inside or from above? - SvxSwFramePosString::StringId eStrId = m_pMirrorPagesCB->IsChecked() ? _pMap[i].eMirrorStrId : _pMap[i].eStrId; + SvxSwFramePosString::StringId eStrId = m_xMirrorPagesCB->get_active() ? _pMap[i].eMirrorStrId : _pMap[i].eStrId; // --> OD 2009-08-31 #mongolianlayout# eStrId = lcl_ChangeResIdToVerticalOrRTL( eStrId, m_bIsVerticalFrame, m_bIsVerticalL2R, m_bIsInRightToLeft); OUString sEntry(SvxSwFramePosString::GetString(eStrId)); - if (_rLB.GetEntryPos(sEntry) == LISTBOX_ENTRY_NOTFOUND) + if (_rLB.find_text(sEntry) == -1) { // don't insert entries when frames are character bound - _rLB.InsertEntry(sEntry); + _rLB.append_text(sEntry); } // i#22341 - add condition to handle map <aVCharMap> // that is ambiguous in the alignment. @@ -1435,36 +1375,36 @@ sal_Int32 SwFramePage::FillPosLB(const FrameMap* _pMap, } } - _rLB.SelectEntry(sSelEntry); - if (!_rLB.GetSelectedEntryCount()) - _rLB.SelectEntry(sOldEntry); + _rLB.set_active_text(sSelEntry); + if (_rLB.get_active() == -1) + _rLB.set_active_text(sOldEntry); - if (!_rLB.GetSelectedEntryCount()) - _rLB.SelectEntryPos(0); + if (_rLB.get_active() == -1) + _rLB.set_active(0); PosHdl(_rLB); return GetMapPos(_pMap, _rLB); } -void SwFramePage::FillRelLB( const FrameMap* _pMap, +void SwFramePage::FillRelLB(const FrameMap* _pMap, const sal_uInt16 _nLBSelPos, const sal_Int16 _nAlign, const sal_Int16 _nRel, - ListBox& _rLB, - FixedText& _rFT ) + weld::ComboBox& _rLB, + weld::Label& _rFT) { OUString sSelEntry; LB nLBRelations = LB::NONE; size_t nMapCount = ::lcl_GetFrameMapCount(_pMap); - _rLB.Clear(); + _rLB.clear(); if (_nLBSelPos < nMapCount) { if (_pMap == aVAsCharHtmlMap || _pMap == aVAsCharMap) { - const OUString sOldEntry(_rLB.GetSelectedEntry()); + const OUString sOldEntry(_rLB.get_active_text()); SvxSwFramePosString::StringId eStrId = _pMap[_nLBSelPos].eStrId; for (size_t nMapPos = 0; nMapPos < nMapCount; nMapPos++) @@ -1485,8 +1425,7 @@ void SwFramePage::FillRelLB( const FrameMap* _pMap, m_bIsVerticalL2R, m_bIsInRightToLeft); const OUString sEntry = SvxSwFramePosString::GetString(sStrId1); - sal_Int32 nPos = _rLB.InsertEntry(sEntry); - _rLB.SetEntryData(nPos, const_cast<RelationMap*>(&rCharMap)); + _rLB.append(OUString::number(reinterpret_cast<sal_Int64>(&rCharMap)), sEntry); if (_pMap[nMapPos].nAlign == _nAlign) sSelEntry = sEntry; break; @@ -1495,19 +1434,19 @@ void SwFramePage::FillRelLB( const FrameMap* _pMap, } } if (!sSelEntry.isEmpty()) - _rLB.SelectEntry(sSelEntry); + _rLB.set_active_text(sSelEntry); else { - _rLB.SelectEntry(sOldEntry); + _rLB.set_active_text(sOldEntry); - if (!_rLB.GetSelectedEntryCount()) + if (_rLB.get_active() == -1) { - for (sal_Int32 i = 0; i < _rLB.GetEntryCount(); i++) + for (int i = 0; i < _rLB.get_count(); i++) { - RelationMap *pEntry = static_cast<RelationMap *>(_rLB.GetEntryData(i)); + RelationMap *pEntry = reinterpret_cast<RelationMap*>(_rLB.get_id(i).toInt64()); if (pEntry->nLBRelation == LB::RelChar) // default { - _rLB.SelectEntryPos(i); + _rLB.set_active(i); break; } } @@ -1521,10 +1460,10 @@ void SwFramePage::FillRelLB( const FrameMap* _pMap, if ( _pMap == aVCharMap ) { nLBRelations = ::lcl_GetLBRelationsForStrID( _pMap, - ( m_pMirrorPagesCB->IsChecked() + ( m_xMirrorPagesCB->get_active() ? _pMap[_nLBSelPos].eMirrorStrId : _pMap[_nLBSelPos].eStrId), - m_pMirrorPagesCB->IsChecked() ); + m_xMirrorPagesCB->get_active() ); } else { @@ -1539,7 +1478,7 @@ void SwFramePage::FillRelLB( const FrameMap* _pMap, { if (rMap.nLBRelation == static_cast<LB>(nBit)) { - SvxSwFramePosString::StringId eStrId1 = m_pMirrorPagesCB->IsChecked() ? + SvxSwFramePosString::StringId eStrId1 = m_xMirrorPagesCB->get_active() ? rMap.eMirrorStrId : rMap.eStrId; // --> OD 2009-08-31 #mongolianlayout# eStrId1 = @@ -1548,8 +1487,7 @@ void SwFramePage::FillRelLB( const FrameMap* _pMap, m_bIsVerticalL2R, m_bIsInRightToLeft); const OUString sEntry = SvxSwFramePosString::GetString(eStrId1); - sal_Int32 nPos = _rLB.InsertEntry(sEntry); - _rLB.SetEntryData(nPos, const_cast<RelationMap*>(&rMap)); + _rLB.append(OUString::number(reinterpret_cast<sal_Int64>(&rMap)), sEntry); if (sSelEntry.isEmpty() && rMap.nRelation == _nRel) sSelEntry = sEntry; } @@ -1557,7 +1495,7 @@ void SwFramePage::FillRelLB( const FrameMap* _pMap, } } if (!sSelEntry.isEmpty()) - _rLB.SelectEntry(sSelEntry); + _rLB.set_active_text(sSelEntry); else { // Probably anchor switch. So look for similar relation @@ -1590,45 +1528,44 @@ void SwFramePage::FillRelLB( const FrameMap* _pMap, break; default: - if (_rLB.GetEntryCount()) + if (_rLB.get_active() != -1) { - RelationMap *pEntry = static_cast<RelationMap *>(_rLB.GetEntryData(_rLB.GetEntryCount() - 1)); + RelationMap *pEntry = reinterpret_cast<RelationMap*>(_rLB.get_id(_rLB.get_count() - 1).toInt64()); nSimRel = pEntry->nRelation; } break; } - for (sal_Int32 i = 0; i < _rLB.GetEntryCount(); i++) + for (int i = 0; i < _rLB.get_count(); i++) { - RelationMap *pEntry = static_cast<RelationMap *>(_rLB.GetEntryData(i)); + RelationMap *pEntry = reinterpret_cast<RelationMap*>(_rLB.get_id(i).toInt64()); if (pEntry->nRelation == nSimRel) { - _rLB.SelectEntryPos(i); + _rLB.set_active(i); break; } } - if (!_rLB.GetSelectedEntryCount()) - _rLB.SelectEntryPos(0); + if (_rLB.get_active() == -1) + _rLB.set_active(0); } } } - const bool bEnable = _rLB.GetEntryCount() != 0 - && (&_rLB != m_pVertRelationLB || m_bAllowVertPositioning); - _rLB.Enable( bEnable ); - _rFT.Enable( bEnable ); + const bool bEnable = _rLB.get_count() != 0 + && (&_rLB != m_xVertRelationLB.get() || m_bAllowVertPositioning); + _rLB.set_sensitive( bEnable ); + _rFT.set_sensitive( bEnable ); RelHdl(_rLB); } -sal_Int16 SwFramePage::GetRelation(ListBox const &rRelationLB) +sal_Int16 SwFramePage::GetRelation(const weld::ComboBox& rRelationLB) { - const sal_Int32 nPos = rRelationLB.GetSelectedEntryPos(); - - if (nPos != LISTBOX_ENTRY_NOTFOUND) + const auto nPos = rRelationLB.get_active(); + if (nPos != -1) { - RelationMap *pEntry = static_cast<RelationMap *>(rRelationLB.GetEntryData(nPos)); + RelationMap *pEntry = reinterpret_cast<RelationMap *>(rRelationLB.get_id(nPos).toInt64()); return pEntry->nRelation; } @@ -1636,7 +1573,7 @@ sal_Int16 SwFramePage::GetRelation(ListBox const &rRelationLB) } sal_Int16 SwFramePage::GetAlignment(FrameMap const *pMap, sal_Int32 nMapPos, - ListBox const &rRelationLB) + const weld::ComboBox& rRelationLB) { if (!pMap || nMapPos < 0) return 0; @@ -1651,11 +1588,11 @@ sal_Int16 SwFramePage::GetAlignment(FrameMap const *pMap, sal_Int32 nMapPos, if ( pMap != aVAsCharHtmlMap && pMap != aVAsCharMap && pMap != aVCharMap ) return pMap[nMapPos].nAlign; - if (rRelationLB.GetSelectedEntryPos() == LISTBOX_ENTRY_NOTFOUND) + if (rRelationLB.get_active() == -1) return 0; - const RelationMap *const pRelationMap = static_cast<const RelationMap *>( - rRelationLB.GetSelectedEntryData()); + const RelationMap *const pRelationMap = reinterpret_cast<const RelationMap *>( + rRelationLB.get_active_id().toInt64()); const LB nRel = pRelationMap->nLBRelation; const SvxSwFramePosString::StringId eStrId = pMap[nMapPos].eStrId; @@ -1668,17 +1605,17 @@ sal_Int16 SwFramePage::GetAlignment(FrameMap const *pMap, sal_Int32 nMapPos, return 0; } -sal_Int32 SwFramePage::GetMapPos( const FrameMap *pMap, ListBox const &rAlignLB ) +sal_Int32 SwFramePage::GetMapPos(const FrameMap *pMap, const weld::ComboBox& rAlignLB) { sal_Int32 nMapPos = 0; - sal_Int32 nLBSelPos = rAlignLB.GetSelectedEntryPos(); + auto nLBSelPos = rAlignLB.get_active(); - if (nLBSelPos != LISTBOX_ENTRY_NOTFOUND) + if (nLBSelPos != -1) { if (pMap == aVAsCharHtmlMap || pMap == aVAsCharMap) { const size_t nMapCount = ::lcl_GetFrameMapCount(pMap); - const OUString sSelEntry(rAlignLB.GetSelectedEntry()); + const OUString sSelEntry(rAlignLB.get_active_text()); for (size_t i = 0; i < nMapCount; i++) { @@ -1704,19 +1641,19 @@ sal_Int32 SwFramePage::GetMapPos( const FrameMap *pMap, ListBox const &rAlignLB RndStdIds SwFramePage::GetAnchor() { RndStdIds nRet = RndStdIds::FLY_AT_PAGE; - if(m_pAnchorAtParaRB->IsChecked()) + if (m_xAnchorAtParaRB->get_active()) { nRet = RndStdIds::FLY_AT_PARA; } - else if(m_pAnchorAtCharRB->IsChecked()) + else if (m_xAnchorAtCharRB->get_active()) { nRet = RndStdIds::FLY_AT_CHAR; } - else if(m_pAnchorAsCharRB->IsChecked()) + else if (m_xAnchorAsCharRB->get_active()) { nRet = RndStdIds::FLY_AS_CHAR; } - else if(m_pAnchorAtFrameRB->IsChecked()) + else if (m_xAnchorAtFrameRB->get_active()) { nRet = RndStdIds::FLY_AT_FLY; } @@ -1730,12 +1667,12 @@ void SwFramePage::ActivatePage(const SfxItemSet& rSet) Init(rSet); m_bNoModifyHdl = false; //lock PercentFields - m_aWidthED.LockAutoCalculation(true); - m_aHeightED.LockAutoCalculation(true); + m_xWidthED->LockAutoCalculation(true); + m_xHeightED->LockAutoCalculation(true); RangeModifyHdl(); // set all maximum values initially - m_aHeightED.LockAutoCalculation(false); - m_aWidthED.LockAutoCalculation(false); - m_pFollowTextFlowCB->SaveValue(); + m_xHeightED->LockAutoCalculation(false); + m_xWidthED->LockAutoCalculation(false); + m_xFollowTextFlowCB->save_state(); } DeactivateRC SwFramePage::DeactivatePage(SfxItemSet * _pSet) @@ -1760,47 +1697,43 @@ DeactivateRC SwFramePage::DeactivatePage(SfxItemSet * _pSet) } // swap left/right with inside/outside -IMPL_LINK_NOARG(SwFramePage, MirrorHdl, Button*, void) +IMPL_LINK_NOARG(SwFramePage, MirrorHdl, weld::ToggleButton&, void) { RndStdIds eId = GetAnchor(); - InitPos( eId, -1, 0, -1, 0, LONG_MAX, LONG_MAX); + InitPos(eId, -1, 0, -1, 0, LONG_MAX, LONG_MAX); } -IMPL_LINK( SwFramePage, RelSizeClickHdl, Button *, p, void ) +IMPL_LINK( SwFramePage, RelSizeClickHdl, weld::ToggleButton&, rBtn, void ) { - CheckBox* pBtn = static_cast<CheckBox*>(p); - if (pBtn == m_pRelWidthCB) + if (&rBtn == m_xRelWidthCB.get()) { - m_aWidthED.ShowPercent(pBtn->IsChecked()); - m_pRelWidthRelationLB->Enable(pBtn->IsChecked()); - if(pBtn->IsChecked()) - m_aWidthED.get()->SetMax(MAX_PERCENT_WIDTH); + m_xWidthED->ShowPercent(rBtn.get_active()); + m_xRelWidthRelationLB->set_sensitive(rBtn.get_active()); + if (rBtn.get_active()) + m_xWidthED->get()->set_max(MAX_PERCENT_WIDTH, FieldUnit::NONE); } - else // pBtn == m_pRelHeightCB + else // rBtn == m_xRelHeightCB.get() { - m_aHeightED.ShowPercent(pBtn->IsChecked()); - m_pRelHeightRelationLB->Enable(pBtn->IsChecked()); - if(pBtn->IsChecked()) - m_aHeightED.get()->SetMax(MAX_PERCENT_HEIGHT); + m_xHeightED->ShowPercent(rBtn.get_active()); + m_xRelHeightRelationLB->set_sensitive(rBtn.get_active()); + if (rBtn.get_active()) + m_xHeightED->get()->set_max(MAX_PERCENT_HEIGHT, FieldUnit::NONE); } RangeModifyHdl(); // correct the values again - if (pBtn == m_pRelWidthCB) - ModifyHdl(*m_aWidthED.get()); - else // pBtn == m_pRelHeightCB - ModifyHdl(*m_aHeightED.get()); + if (&rBtn == m_xRelWidthCB.get()) + ModifyHdl(*m_xWidthED->get()); + else // rBtn == m_xRelHeightCB.get() + ModifyHdl(*m_xHeightED->get()); } // range check -IMPL_LINK_NOARG(SwFramePage, RangeModifyClickHdl, Button*, void) -{ - RangeModifyHdl(); -} -IMPL_LINK_NOARG(SwFramePage, RangeModifyLoseFocusHdl, Control&, void) +IMPL_LINK_NOARG(SwFramePage, RangeModifyClickHdl, weld::ToggleButton&, void) { RangeModifyHdl(); } + void SwFramePage::RangeModifyHdl() { if (m_bNoModifyHdl) @@ -1813,16 +1746,16 @@ void SwFramePage::RangeModifyHdl() SvxSwFrameValidation aVal; aVal.nAnchorType = GetAnchor(); - aVal.bAutoHeight = m_pAutoHeightCB->IsChecked(); - aVal.bMirror = m_pMirrorPagesCB->IsChecked(); - aVal.bFollowTextFlow = m_pFollowTextFlowCB->IsChecked(); + aVal.bAutoHeight = m_xAutoHeightCB->get_active(); + aVal.bMirror = m_xMirrorPagesCB->get_active(); + aVal.bFollowTextFlow = m_xFollowTextFlowCB->get_active(); if ( m_pHMap ) { // alignment horizontal - const sal_Int32 nMapPos = GetMapPos(m_pHMap, *m_pHorizontalDLB); - aVal.nHoriOrient = GetAlignment(m_pHMap, nMapPos, *m_pHoriRelationLB); - aVal.nHRelOrient = GetRelation(*m_pHoriRelationLB); + const sal_Int32 nMapPos = GetMapPos(m_pHMap, *m_xHorizontalDLB); + aVal.nHoriOrient = GetAlignment(m_pHMap, nMapPos, *m_xHoriRelationLB); + aVal.nHRelOrient = GetRelation(*m_xHoriRelationLB); } else aVal.nHoriOrient = text::HoriOrientation::NONE; @@ -1830,17 +1763,17 @@ void SwFramePage::RangeModifyHdl() if ( m_pVMap ) { // alignment vertical - const sal_Int32 nMapPos = GetMapPos(m_pVMap, *m_pVerticalDLB); - aVal.nVertOrient = GetAlignment(m_pVMap, nMapPos, *m_pVertRelationLB); - aVal.nVRelOrient = GetRelation(*m_pVertRelationLB); + const sal_Int32 nMapPos = GetMapPos(m_pVMap, *m_xVerticalDLB); + aVal.nVertOrient = GetAlignment(m_pVMap, nMapPos, *m_xVertRelationLB); + aVal.nVRelOrient = GetRelation(*m_xVertRelationLB); } else aVal.nVertOrient = text::VertOrientation::NONE; const long nAtHorzPosVal = static_cast< long >( - m_pAtHorzPosED->Denormalize(m_pAtHorzPosED->GetValue(FieldUnit::TWIP)) ); + m_xAtHorzPosED->denormalize(m_xAtHorzPosED->get_value(FieldUnit::TWIP)) ); const long nAtVertPosVal = static_cast< long >( - m_pAtVertPosED->Denormalize(m_pAtVertPosED->GetValue(FieldUnit::TWIP)) ); + m_xAtVertPosED->denormalize(m_xAtVertPosED->get_value(FieldUnit::TWIP)) ); aVal.nHPos = nAtHorzPosVal; aVal.nVPos = nAtVertPosVal; @@ -1848,12 +1781,12 @@ void SwFramePage::RangeModifyHdl() aMgr.ValidateMetrics(aVal, mpToCharContentPos, true); // one time, to get reference values for percental values // set reference values for percental values (100%) ... - m_aWidthED.SetRefValue(aVal.aPercentSize.Width()); - m_aHeightED.SetRefValue(aVal.aPercentSize.Height()); + m_xWidthED->SetRefValue(aVal.aPercentSize.Width()); + m_xHeightED->SetRefValue(aVal.aPercentSize.Height()); // ... and correctly convert width and height with it - SwTwips nWidth = static_cast< SwTwips >(m_aWidthED. DenormalizePercent(m_aWidthED.GetValue(FieldUnit::TWIP))); - SwTwips nHeight = static_cast< SwTwips >(m_aHeightED.DenormalizePercent(m_aHeightED.GetValue(FieldUnit::TWIP))); + SwTwips nWidth = static_cast< SwTwips >(m_xWidthED->DenormalizePercent(m_xWidthED->get_value(FieldUnit::TWIP))); + SwTwips nHeight = static_cast< SwTwips >(m_xHeightED->DenormalizePercent(m_xHeightED->get_value(FieldUnit::TWIP))); aVal.nWidth = nWidth; aVal.nHeight = nHeight; @@ -1880,8 +1813,8 @@ void SwFramePage::RangeModifyHdl() nHeight = aVal.nHeight; // minimum range also for template - m_aHeightED.SetMin(m_aHeightED.NormalizePercent(aVal.nMinHeight), FieldUnit::TWIP); - m_aWidthED. SetMin(m_aWidthED.NormalizePercent(aVal.nMinWidth), FieldUnit::TWIP); + m_xHeightED->set_min(m_xHeightED->NormalizePercent(aVal.nMinHeight), FieldUnit::TWIP); + m_xWidthED->set_min(m_xWidthED->NormalizePercent(aVal.nMinWidth), FieldUnit::TWIP); SwTwips nMaxWidth(aVal.nMaxWidth); SwTwips nMaxHeight(aVal.nMaxHeight); @@ -1889,47 +1822,49 @@ void SwFramePage::RangeModifyHdl() if (aVal.bAutoHeight && (m_sDlgType == "PictureDialog" || m_sDlgType == "ObjectDialog")) { SwTwips nTmp = std::min(nWidth * nMaxHeight / std::max(nHeight, 1L), nMaxHeight); - m_aWidthED.SetMax(m_aWidthED.NormalizePercent(nTmp), FieldUnit::TWIP); + m_xWidthED->set_max(m_xWidthED->NormalizePercent(nTmp), FieldUnit::TWIP); nTmp = std::min(nHeight * nMaxWidth / std::max(nWidth, 1L), nMaxWidth); - m_aHeightED.SetMax(m_aWidthED.NormalizePercent(nTmp), FieldUnit::TWIP); + m_xHeightED->set_max(m_xWidthED->NormalizePercent(nTmp), FieldUnit::TWIP); } else { - SwTwips nTmp = static_cast< SwTwips >(m_aHeightED.NormalizePercent(nMaxHeight)); - m_aHeightED.SetMax(nTmp, FieldUnit::TWIP); + SwTwips nTmp = static_cast< SwTwips >(m_xHeightED->NormalizePercent(nMaxHeight)); + m_xHeightED->set_max(nTmp, FieldUnit::TWIP); - nTmp = static_cast< SwTwips >(m_aWidthED.NormalizePercent(nMaxWidth)); - m_aWidthED.SetMax(nTmp, FieldUnit::TWIP); + nTmp = static_cast< SwTwips >(m_xWidthED->NormalizePercent(nMaxWidth)); + m_xWidthED->set_max(nTmp, FieldUnit::TWIP); } - m_pAtHorzPosED->SetMin(m_pAtHorzPosED->Normalize(aVal.nMinHPos), FieldUnit::TWIP); - m_pAtHorzPosED->SetMax(m_pAtHorzPosED->Normalize(aVal.nMaxHPos), FieldUnit::TWIP); - if ( aVal.nHPos != nAtHorzPosVal ) - m_pAtHorzPosED->SetValue(m_pAtHorzPosED->Normalize(aVal.nHPos), FieldUnit::TWIP); + m_xAtHorzPosED->set_range(m_xAtHorzPosED->normalize(aVal.nMinHPos), + m_xAtHorzPosED->normalize(aVal.nMaxHPos), + FieldUnit::TWIP); + if (aVal.nHPos != nAtHorzPosVal) + m_xAtHorzPosED->set_value(m_xAtHorzPosED->normalize(aVal.nHPos), FieldUnit::TWIP); const SwTwips nUpperOffset = (aVal.nAnchorType == RndStdIds::FLY_AS_CHAR) ? m_nUpperBorder : 0; const SwTwips nLowerOffset = (aVal.nAnchorType == RndStdIds::FLY_AS_CHAR) ? m_nLowerBorder : 0; - m_pAtVertPosED->SetMin(m_pAtVertPosED->Normalize(aVal.nMinVPos + nLowerOffset + nUpperOffset), FieldUnit::TWIP); - m_pAtVertPosED->SetMax(m_pAtVertPosED->Normalize(aVal.nMaxVPos), FieldUnit::TWIP); - if ( aVal.nVPos != nAtVertPosVal ) - m_pAtVertPosED->SetValue(m_pAtVertPosED->Normalize(aVal.nVPos), FieldUnit::TWIP); + m_xAtVertPosED->set_range(m_xAtVertPosED->normalize(aVal.nMinVPos + nLowerOffset + nUpperOffset), + m_xAtVertPosED->normalize(aVal.nMaxVPos), + FieldUnit::TWIP); + if (aVal.nVPos != nAtVertPosVal) + m_xAtVertPosED->set_value(m_xAtVertPosED->normalize(aVal.nVPos), FieldUnit::TWIP); } -IMPL_LINK_NOARG(SwFramePage, AnchorTypeHdl, Button*, void) +IMPL_LINK_NOARG(SwFramePage, AnchorTypeHdl, weld::ToggleButton&, void) { - m_pMirrorPagesCB->Enable(!m_pAnchorAsCharRB->IsChecked()); + m_xMirrorPagesCB->set_sensitive(!m_xAnchorAsCharRB->get_active()); // i#18732 - enable check box 'Follow text flow' for anchor // type to-paragraph' and to-character // i#22305 - enable check box 'Follow text // flow' also for anchor type to-frame. - m_pFollowTextFlowCB->Enable( m_pAnchorAtParaRB->IsChecked() || - m_pAnchorAtCharRB->IsChecked() || - m_pAnchorAtFrameRB->IsChecked() ); + m_xFollowTextFlowCB->set_sensitive(m_xAnchorAtParaRB->get_active() || + m_xAnchorAtCharRB->get_active() || + m_xAnchorAtFrameRB->get_active()); RndStdIds eId = GetAnchor(); @@ -1938,19 +1873,19 @@ IMPL_LINK_NOARG(SwFramePage, AnchorTypeHdl, Button*, void) if(m_bHtmlMode) { - PosHdl(*m_pHorizontalDLB); - PosHdl(*m_pVerticalDLB); + PosHdl(*m_xHorizontalDLB); + PosHdl(*m_xVerticalDLB); } EnableVerticalPositioning( !(m_bIsMathOLE && m_bIsMathBaselineAlignment && RndStdIds::FLY_AS_CHAR == eId) ); } -IMPL_LINK( SwFramePage, PosHdl, ListBox&, rLB, void ) +IMPL_LINK( SwFramePage, PosHdl, weld::ComboBox&, rLB, void ) { - bool bHori = &rLB == m_pHorizontalDLB; - ListBox *pRelLB = bHori ? m_pHoriRelationLB.get() : m_pVertRelationLB.get(); - FixedText *pRelFT = bHori ? m_pHoriRelationFT.get() : m_pVertRelationFT.get(); + bool bHori = &rLB == m_xHorizontalDLB.get(); + weld::ComboBox *pRelLB = bHori ? m_xHoriRelationLB.get() : m_xVertRelationLB.get(); + weld::Label *pRelFT = bHori ? m_xHoriRelationFT.get() : m_xVertRelationFT.get(); FrameMap const *pMap = bHori ? m_pHMap : m_pVMap; const sal_Int32 nMapPos = GetMapPos(pMap, rLB); @@ -1959,29 +1894,27 @@ IMPL_LINK( SwFramePage, PosHdl, ListBox&, rLB, void ) if (bHori) { bool bEnable = text::HoriOrientation::NONE == nAlign; - m_pAtHorzPosED->Enable( bEnable ); - m_pAtHorzPosFT->Enable( bEnable ); + m_xAtHorzPosED->set_sensitive( bEnable ); + m_xAtHorzPosFT->set_sensitive( bEnable ); } else { bool bEnable = text::VertOrientation::NONE == nAlign && m_bAllowVertPositioning; - m_pAtVertPosED->Enable( bEnable ); - m_pAtVertPosFT->Enable( bEnable ); + m_xAtVertPosED->set_sensitive( bEnable ); + m_xAtVertPosFT->set_sensitive( bEnable ); } RangeModifyHdl(); sal_Int16 nRel = 0; - if (rLB.GetSelectedEntryCount()) + if (rLB.get_active() != -1) { - - if (pRelLB->GetSelectedEntryPos() != LISTBOX_ENTRY_NOTFOUND) - nRel = static_cast<RelationMap *>(pRelLB->GetSelectedEntryData())->nRelation; - + if (pRelLB->get_active() != -1) + nRel = reinterpret_cast<RelationMap*>(pRelLB->get_active_id().toInt64())->nRelation; FillRelLB(pMap, nMapPos, nAlign, nRel, *pRelLB, *pRelFT); } else - pRelLB->Clear(); + pRelLB->clear(); UpdateExample(); @@ -1999,58 +1932,58 @@ IMPL_LINK( SwFramePage, PosHdl, ListBox&, rLB, void ) // right is allowed only above - from the left only above // from the left at character -> below if((text::HoriOrientation::LEFT == nAlign || text::HoriOrientation::RIGHT == nAlign) && - 0 == m_pVerticalDLB->GetSelectedEntryPos()) + 0 == m_xVerticalDLB->get_active()) { if(text::RelOrientation::FRAME == nRel) - m_pVerticalDLB->SelectEntryPos(1); + m_xVerticalDLB->set_active(1); else - m_pVerticalDLB->SelectEntryPos(0); + m_xVerticalDLB->set_active(0); bSet = true; } - else if(text::HoriOrientation::LEFT == nAlign && 1 == m_pVerticalDLB->GetSelectedEntryPos()) + else if(text::HoriOrientation::LEFT == nAlign && 1 == m_xVerticalDLB->get_active()) { - m_pVerticalDLB->SelectEntryPos(0); + m_xVerticalDLB->set_active(0); bSet = true; } - else if(text::HoriOrientation::NONE == nAlign && 1 == m_pVerticalDLB->GetSelectedEntryPos()) + else if(text::HoriOrientation::NONE == nAlign && 1 == m_xVerticalDLB->get_active()) { - m_pVerticalDLB->SelectEntryPos(0); + m_xVerticalDLB->set_active(0); bSet = true; } if(bSet) - PosHdl(*m_pVerticalDLB); + PosHdl(*m_xVerticalDLB); } else { if(text::VertOrientation::TOP == nAlign) { - if(1 == m_pHorizontalDLB->GetSelectedEntryPos()) + if (1 == m_xHorizontalDLB->get_active()) { - m_pHorizontalDLB->SelectEntryPos(0); + m_xHorizontalDLB->set_active(0); bSet = true; } - m_pHoriRelationLB->SelectEntryPos(1); + m_xHoriRelationLB->set_active(1); } else if(text::VertOrientation::CHAR_BOTTOM == nAlign) { - if(2 == m_pHorizontalDLB->GetSelectedEntryPos()) + if (2 == m_xHorizontalDLB->get_active()) { - m_pHorizontalDLB->SelectEntryPos(0); + m_xHorizontalDLB->set_active(0); bSet = true; } - m_pHoriRelationLB->SelectEntryPos(0) ; + m_xHoriRelationLB->set_active(0) ; } if(bSet) - PosHdl(*m_pHorizontalDLB); + PosHdl(*m_xHorizontalDLB); } } } // horizontal Pos -IMPL_LINK( SwFramePage, RelHdl, ListBox&, rLB, void ) +IMPL_LINK( SwFramePage, RelHdl, weld::ComboBox&, rLB, void ) { - bool bHori = &rLB == m_pHoriRelationLB; + bool bHori = &rLB == m_xHoriRelationLB.get(); UpdateExample(); @@ -2063,55 +1996,55 @@ IMPL_LINK( SwFramePage, RelHdl, ListBox&, rLB, void ) { if(bHori) { - const sal_Int16 nRel = GetRelation(*m_pHoriRelationLB); - if(text::RelOrientation::PRINT_AREA == nRel && 0 == m_pVerticalDLB->GetSelectedEntryPos()) + const sal_Int16 nRel = GetRelation(*m_xHoriRelationLB); + if(text::RelOrientation::PRINT_AREA == nRel && 0 == m_xVerticalDLB->get_active()) { - m_pVerticalDLB->SelectEntryPos(1); + m_xVerticalDLB->set_active(1); } - else if(text::RelOrientation::CHAR == nRel && 1 == m_pVerticalDLB->GetSelectedEntryPos()) + else if(text::RelOrientation::CHAR == nRel && 1 == m_xVerticalDLB->get_active()) { - m_pVerticalDLB->SelectEntryPos(0); + m_xVerticalDLB->set_active(0); } } } RangeModifyHdl(); } -IMPL_LINK_NOARG(SwFramePage, RealSizeHdl, Button*, void) +IMPL_LINK_NOARG(SwFramePage, RealSizeHdl, weld::Button&, void) { - m_aWidthED.SetUserValue( m_aWidthED. NormalizePercent(m_aGrfSize.Width() ), FieldUnit::TWIP); - m_aHeightED.SetUserValue(m_aHeightED.NormalizePercent(m_aGrfSize.Height()), FieldUnit::TWIP); + m_xWidthED->set_value(m_xWidthED->NormalizePercent(m_aGrfSize.Width()), FieldUnit::TWIP); + m_xHeightED->set_value(m_xHeightED->NormalizePercent(m_aGrfSize.Height()), FieldUnit::TWIP); m_fWidthHeightRatio = m_aGrfSize.Height() ? double(m_aGrfSize.Width()) / double(m_aGrfSize.Height()) : 1.0; UpdateExample(); } -IMPL_LINK_NOARG(SwFramePage, AutoWidthClickHdl, Button*, void) +IMPL_LINK_NOARG(SwFramePage, AutoWidthClickHdl, weld::ToggleButton&, void) { if( !IsInGraficMode() ) - HandleAutoCB( m_pAutoWidthCB->IsChecked(), *m_pWidthFT, *m_pWidthAutoFT, *m_aWidthED.get() ); + HandleAutoCB( m_xAutoWidthCB->get_active(), *m_xWidthFT, *m_xWidthAutoFT, *m_xWidthED->get() ); } -IMPL_LINK_NOARG(SwFramePage, AutoHeightClickHdl, Button*, void) +IMPL_LINK_NOARG(SwFramePage, AutoHeightClickHdl, weld::ToggleButton&, void) { - if( !IsInGraficMode() ) - HandleAutoCB( m_pAutoHeightCB->IsChecked(), *m_pHeightFT, *m_pHeightAutoFT, *m_aWidthED.get() ); + if (!IsInGraficMode()) + HandleAutoCB(m_xAutoHeightCB->get_active(), *m_xHeightFT, *m_xHeightAutoFT, *m_xWidthED->get()); } -IMPL_LINK( SwFramePage, ModifyHdl, Edit&, rEdit, void ) +IMPL_LINK( SwFramePage, ModifyHdl, weld::MetricSpinButton&, rEdit, void ) { - SwTwips nWidth = static_cast< SwTwips >(m_aWidthED.DenormalizePercent(m_aWidthED.GetValue(FieldUnit::TWIP))); - SwTwips nHeight = static_cast< SwTwips >(m_aHeightED.DenormalizePercent(m_aHeightED.GetValue(FieldUnit::TWIP))); - if ( m_pFixedRatioCB->IsChecked() ) + SwTwips nWidth = static_cast< SwTwips >(m_xWidthED->DenormalizePercent(m_xWidthED->get_value(FieldUnit::TWIP))); + SwTwips nHeight = static_cast< SwTwips >(m_xHeightED->DenormalizePercent(m_xHeightED->get_value(FieldUnit::TWIP))); + if (m_xFixedRatioCB->get_active()) { - if (&rEdit == m_aWidthED.get()) + if (&rEdit == m_xWidthED->get()) { nHeight = SwTwips(static_cast<double>(nWidth) / m_fWidthHeightRatio); - m_aHeightED.SetPrcntValue(m_aHeightED.NormalizePercent(nHeight), FieldUnit::TWIP); + m_xHeightED->set_value(m_xHeightED->NormalizePercent(nHeight), FieldUnit::TWIP); } - else if (&rEdit == m_aHeightED.get()) + else if (&rEdit == m_xHeightED->get()) { nWidth = SwTwips(static_cast<double>(nHeight) * m_fWidthHeightRatio); - m_aWidthED.SetPrcntValue(m_aWidthED.NormalizePercent(nWidth), FieldUnit::TWIP); + m_xWidthED->set_value(m_xWidthED->NormalizePercent(nWidth), FieldUnit::TWIP); } } m_fWidthHeightRatio = nHeight ? double(nWidth) / double(nHeight) : 1.0; @@ -2120,32 +2053,32 @@ IMPL_LINK( SwFramePage, ModifyHdl, Edit&, rEdit, void ) void SwFramePage::UpdateExample() { - sal_Int32 nPos = m_pHorizontalDLB->GetSelectedEntryPos(); - if ( m_pHMap && nPos != LISTBOX_ENTRY_NOTFOUND ) + auto nPos = m_xHorizontalDLB->get_active(); + if (m_pHMap && nPos != -1) { - const sal_Int32 nMapPos = GetMapPos(m_pHMap, *m_pHorizontalDLB); - m_pExampleWN->SetHAlign(GetAlignment(m_pHMap, nMapPos, *m_pHoriRelationLB)); - m_pExampleWN->SetHoriRel(GetRelation(*m_pHoriRelationLB)); + const sal_Int32 nMapPos = GetMapPos(m_pHMap, *m_xHorizontalDLB); + m_aExampleWN.SetHAlign(GetAlignment(m_pHMap, nMapPos, *m_xHoriRelationLB)); + m_aExampleWN.SetHoriRel(GetRelation(*m_xHoriRelationLB)); } - nPos = m_pVerticalDLB->GetSelectedEntryPos(); - if ( m_pVMap && nPos != LISTBOX_ENTRY_NOTFOUND ) + nPos = m_xVerticalDLB->get_active(); + if (m_pVMap && nPos != -1) { - const sal_Int32 nMapPos = GetMapPos(m_pVMap, *m_pVerticalDLB); - m_pExampleWN->SetVAlign(GetAlignment(m_pVMap, nMapPos, *m_pVertRelationLB)); - m_pExampleWN->SetVertRel(GetRelation(*m_pVertRelationLB)); + const sal_Int32 nMapPos = GetMapPos(m_pVMap, *m_xVerticalDLB); + m_aExampleWN.SetVAlign(GetAlignment(m_pVMap, nMapPos, *m_xVertRelationLB)); + m_aExampleWN.SetVertRel(GetRelation(*m_xVertRelationLB)); } // size - long nXPos = static_cast< long >(m_pAtHorzPosED->Denormalize(m_pAtHorzPosED->GetValue(FieldUnit::TWIP))); - long nYPos = static_cast< long >(m_pAtVertPosED->Denormalize(m_pAtVertPosED->GetValue(FieldUnit::TWIP))); - m_pExampleWN->SetRelPos(Point(nXPos, nYPos)); + auto nXPos = m_xAtHorzPosED->denormalize(m_xAtHorzPosED->get_value(FieldUnit::TWIP)); + auto nYPos = m_xAtVertPosED->denormalize(m_xAtVertPosED->get_value(FieldUnit::TWIP)); + m_aExampleWN.SetRelPos(Point(nXPos, nYPos)); - m_pExampleWN->SetAnchor(GetAnchor()); - m_pExampleWN->Invalidate(); + m_aExampleWN.SetAnchor(GetAnchor()); + m_aExampleWN.Invalidate(); } -void SwFramePage::Init(const SfxItemSet& rSet, bool bReset) +void SwFramePage::Init(const SfxItemSet& rSet) { if(!m_bFormat) { @@ -2154,8 +2087,8 @@ void SwFramePage::Init(const SfxItemSet& rSet, bool bReset) // size const bool bSizeFixed = pSh->IsSelObjProtected( FlyProtectFlags::Fixed ) != FlyProtectFlags::NONE; - m_aWidthED .Enable( !bSizeFixed ); - m_aHeightED.Enable( !bSizeFixed ); + m_xWidthED->set_sensitive( !bSizeFixed ); + m_xHeightED->set_sensitive( !bSizeFixed ); // size controls for math OLE objects if ( m_sDlgType == "ObjectDialog" && ! m_bNew ) @@ -2178,78 +2111,60 @@ void SwFramePage::Init(const SfxItemSet& rSet, bool bReset) if( rFactNm == aGlbNm ) { // disable size controls for math OLE objects - m_pWidthFT->Disable(); - m_aWidthED.Disable(); - m_pRelWidthCB->Disable(); - m_pHeightFT->Disable(); - m_aHeightED.Disable(); - m_pRelHeightCB->Disable(); - m_pFixedRatioCB->Disable(); - m_pRealSizeBT->Disable(); + m_xWidthFT->set_sensitive(false); + m_xWidthED->set_sensitive(false); + m_xRelWidthCB->set_sensitive(false); + m_xHeightFT->set_sensitive(false); + m_xHeightED->set_sensitive(false); + m_xRelHeightCB->set_sensitive(false); + m_xFixedRatioCB->set_sensitive(false); + m_xRealSizeBT->set_sensitive(false); break; } } // TODO/LATER: get correct aspect if(0 != (pSh->GetOLEObject()->getStatus( embed::Aspects::MSOLE_CONTENT ) & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE ) ) - m_pRealSizeBT->Disable(); + m_xRealSizeBT->set_sensitive(false); } } const SwFormatFrameSize& rSize = rSet.Get(RES_FRM_SIZE); - sal_Int64 nWidth = m_aWidthED.NormalizePercent(rSize.GetWidth()); - sal_Int64 nHeight = m_aHeightED.NormalizePercent(rSize.GetHeight()); + sal_Int64 nWidth = m_xWidthED->NormalizePercent(rSize.GetWidth()); + sal_Int64 nHeight = m_xHeightED->NormalizePercent(rSize.GetHeight()); - if (nWidth != m_aWidthED.GetValue(FieldUnit::TWIP)) - { - if(!bReset) - { - // value was changed by circulation-Tabpage and - // has to be set with Modify-Flag - m_aWidthED.SetUserValue(nWidth, FieldUnit::TWIP); - } - else - m_aWidthED.SetPrcntValue(nWidth, FieldUnit::TWIP); - } + if (nWidth != m_xWidthED->get_value(FieldUnit::TWIP)) + m_xWidthED->set_value(nWidth, FieldUnit::TWIP); - if (nHeight != m_aHeightED.GetValue(FieldUnit::TWIP)) - { - if (!bReset) - { - // values was changed by circulation-Tabpage and - // has to be set with Modify-Flag - m_aHeightED.SetUserValue(nHeight, FieldUnit::TWIP); - } - else - m_aHeightED.SetPrcntValue(nHeight, FieldUnit::TWIP); - } + if (nHeight != m_xHeightED->get_value(FieldUnit::TWIP)) + m_xHeightED->set_value(nHeight, FieldUnit::TWIP); if (!IsInGraficMode()) { SwFrameSize eSize = rSize.GetHeightSizeType(); bool bCheck = eSize != ATT_FIX_SIZE; - m_pAutoHeightCB->Check( bCheck ); - HandleAutoCB( bCheck, *m_pHeightFT, *m_pHeightAutoFT, *m_aWidthED.get() ); + m_xAutoHeightCB->set_active(bCheck); + HandleAutoCB( bCheck, *m_xHeightFT, *m_xHeightAutoFT, *m_xWidthED->get() ); if( eSize == ATT_VAR_SIZE ) - m_aHeightED.SetValue( m_aHeightED.GetMin() ); + m_xHeightED->set_value(m_xHeightED->get_min()); eSize = rSize.GetWidthSizeType(); bCheck = eSize != ATT_FIX_SIZE; - m_pAutoWidthCB->Check( bCheck ); - HandleAutoCB( bCheck, *m_pWidthFT, *m_pWidthAutoFT, *m_aWidthED.get() ); + m_xAutoWidthCB->set_active(bCheck); + HandleAutoCB( bCheck, *m_xWidthFT, *m_xWidthAutoFT, *m_xWidthED->get() ); if( eSize == ATT_VAR_SIZE ) - m_aWidthED.SetValue( m_aWidthED.GetMin() ); + m_xWidthED->set_value(m_xWidthED->get_min()); if ( !m_bFormat ) { SwWrtShell* pSh = getFrameDlgParentShell(); const SwFrameFormat* pFormat = pSh->GetFlyFrameFormat(); if( pFormat && pFormat->GetChain().GetNext() ) - m_pAutoHeightCB->Enable( false ); + m_xAutoHeightCB->set_sensitive( false ); } } else - m_pAutoHeightCB->Hide(); + m_xAutoHeightCB->hide(); // organise circulation-gap for character bound frames const SvxULSpaceItem &rUL = rSet.Get(RES_UL_SPACE); @@ -2258,8 +2173,8 @@ void SwFramePage::Init(const SfxItemSet& rSet, bool bReset) if(SfxItemState::SET == rSet.GetItemState(FN_KEEP_ASPECT_RATIO)) { - m_pFixedRatioCB->Check(static_cast<const SfxBoolItem&>(rSet.Get(FN_KEEP_ASPECT_RATIO)).GetValue()); - m_pFixedRatioCB->SaveValue(); + m_xFixedRatioCB->set_active(static_cast<const SfxBoolItem&>(rSet.Get(FN_KEEP_ASPECT_RATIO)).GetValue()); + m_xFixedRatioCB->save_state(); } // columns @@ -2291,8 +2206,8 @@ void SwFramePage::Init(const SfxItemSet& rSet, bool bReset) m_nOldVRel = text::RelOrientation::PAGE_PRINT_AREA; } - m_pMirrorPagesCB->Check(rHori.IsPosToggle()); - m_pMirrorPagesCB->SaveValue(); + m_xMirrorPagesCB->set_active(rHori.IsPosToggle()); + m_xMirrorPagesCB->save_state(); InitPos(eAnchorId, m_nOldH, @@ -2306,65 +2221,63 @@ void SwFramePage::Init(const SfxItemSet& rSet, bool bReset) // transparent for example // circulation for example const SwFormatSurround& rSurround = rSet.Get(RES_SURROUND); - m_pExampleWN->SetWrap( rSurround.GetSurround() ); + m_aExampleWN.SetWrap( rSurround.GetSurround() ); if ( rSurround.GetSurround() == css::text::WrapTextMode_THROUGH ) { const SvxOpaqueItem& rOpaque = rSet.Get(RES_OPAQUE); - m_pExampleWN->SetTransparent(!rOpaque.GetValue()); + m_aExampleWN.SetTransparent(!rOpaque.GetValue()); } // switch to percent if applicable RangeModifyHdl(); // set reference values (for 100%) if (rSize.GetWidthPercent() == SwFormatFrameSize::SYNCED || rSize.GetHeightPercent() == SwFormatFrameSize::SYNCED) - m_pFixedRatioCB->Check(); + m_xFixedRatioCB->set_active(true); if (rSize.GetWidthPercent() && rSize.GetWidthPercent() != SwFormatFrameSize::SYNCED && - !m_pRelWidthCB->IsChecked()) + !m_xRelWidthCB->get_active()) { - m_pRelWidthCB->Check(); - RelSizeClickHdl(m_pRelWidthCB); - m_aWidthED.SetPrcntValue(rSize.GetWidthPercent(), FieldUnit::CUSTOM); + m_xRelWidthCB->set_active(true); + RelSizeClickHdl(*m_xRelWidthCB); + m_xWidthED->set_value(rSize.GetWidthPercent(), FieldUnit::PERCENT); } if (rSize.GetHeightPercent() && rSize.GetHeightPercent() != SwFormatFrameSize::SYNCED && - !m_pRelHeightCB->IsChecked()) + !m_xRelHeightCB->get_active()) { - m_pRelHeightCB->Check(); - RelSizeClickHdl(m_pRelHeightCB); - m_aHeightED.SetPrcntValue(rSize.GetHeightPercent(), FieldUnit::CUSTOM); + m_xRelHeightCB->set_active(true); + RelSizeClickHdl(*m_xRelHeightCB); + m_xHeightED->set_value(rSize.GetHeightPercent(), FieldUnit::PERCENT); } - m_pRelWidthCB->SaveValue(); - m_pRelHeightCB->SaveValue(); + m_xRelWidthCB->save_state(); + m_xRelHeightCB->save_state(); if (rSize.GetWidthPercentRelation() == text::RelOrientation::PAGE_FRAME) - m_pRelWidthRelationLB->SelectEntryPos(1); + m_xRelWidthRelationLB->set_active(1); else - m_pRelWidthRelationLB->SelectEntryPos(0); + m_xRelWidthRelationLB->set_active(0); if (rSize.GetHeightPercentRelation() == text::RelOrientation::PAGE_FRAME) - m_pRelHeightRelationLB->SelectEntryPos(1); + m_xRelHeightRelationLB->set_active(1); else - m_pRelHeightRelationLB->SelectEntryPos(0); + m_xRelHeightRelationLB->set_active(0); } void SwFramePage::SetFormatUsed(bool bFormatUsed) { m_bFormat = bFormatUsed; if (m_bFormat) - { - m_pAnchorFrame->Hide(); - } + m_xAnchorFrame->hide(); } void SwFramePage::EnableVerticalPositioning( bool bEnable ) { m_bAllowVertPositioning = bEnable; - m_pVerticalFT->Enable( bEnable ); - m_pVerticalDLB->Enable( bEnable ); - m_pAtVertPosFT->Enable( bEnable ); - m_pAtVertPosED->Enable( bEnable ); - m_pVertRelationFT->Enable( bEnable ); - m_pVertRelationLB->Enable( bEnable ); + m_xVerticalFT->set_sensitive( bEnable ); + m_xVerticalDLB->set_sensitive( bEnable ); + m_xAtVertPosFT->set_sensitive( bEnable ); + m_xAtVertPosED->set_sensitive( bEnable ); + m_xVertRelationFT->set_sensitive( bEnable ); + m_xVertRelationLB->set_sensitive( bEnable ); } SwGrfExtPage::SwGrfExtPage(TabPageParent pParent, const SfxItemSet &rSet) diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx index d4a4bf68b9a2..b19711eb2502 100644 --- a/sw/source/ui/table/tabledlg.cxx +++ b/sw/source/ui/table/tabledlg.cxx @@ -160,8 +160,8 @@ IMPL_LINK( SwFormatTablePage, RelWidthClickHdl, weld::ToggleButton&, rBtn, void m_xRightMF->SetMetricFieldMin(0); //dito m_xLeftMF->SetMetricFieldMax(99); m_xRightMF->SetMetricFieldMax(99); - m_xLeftMF->SetPrcntValue(m_xLeftMF->NormalizePercent(nLeft ), FieldUnit::TWIP ); - m_xRightMF->SetPrcntValue(m_xRightMF->NormalizePercent(nRight ), FieldUnit::TWIP ); + m_xLeftMF->set_value(m_xLeftMF->NormalizePercent(nLeft ), FieldUnit::TWIP ); + m_xRightMF->set_value(m_xRightMF->NormalizePercent(nRight ), FieldUnit::TWIP ); } else ModifyHdl(*m_xLeftMF->get()); //correct values again @@ -184,27 +184,27 @@ IMPL_LINK_NOARG(SwFormatTablePage, AutoClickHdl, weld::ToggleButton&, void) bOthers = true; if (m_xFullBtn->get_active()) { - m_xLeftMF->SetPrcntValue(0); - m_xRightMF->SetPrcntValue(0); + m_xLeftMF->set_value(0); + m_xRightMF->set_value(0); nSaveWidth = static_cast<SwTwips>(m_xWidthMF->DenormalizePercent(m_xWidthMF->get_value(FieldUnit::TWIP))); - m_xWidthMF->SetPrcntValue(m_xWidthMF->NormalizePercent(pTableData->GetSpace()), FieldUnit::TWIP); + m_xWidthMF->set_value(m_xWidthMF->NormalizePercent(pTableData->GetSpace()), FieldUnit::TWIP); bFull = true; bRestore = false; } else if (m_xLeftBtn->get_active()) { bRightEnable = bWidthEnable = true; - m_xLeftMF->SetPrcntValue(0); + m_xLeftMF->set_value(0); } else if (m_xFromLeftBtn->get_active()) { bLeftEnable = bWidthEnable = true; - m_xRightMF->SetPrcntValue(0); + m_xRightMF->set_value(0); } else if (m_xRightBtn->get_active()) { bLeftEnable = bWidthEnable = true; - m_xRightMF->SetPrcntValue(0); + m_xRightMF->set_value(0); } else if (m_xCenterBtn->get_active()) { @@ -233,7 +233,7 @@ IMPL_LINK_NOARG(SwFormatTablePage, AutoClickHdl, weld::ToggleButton&, void) //After being switched on automatic, the width was pinned //in order to restore the width while switching back to. bFull = false; - m_xWidthMF->SetPrcntValue(m_xWidthMF->NormalizePercent(nSaveWidth ), FieldUnit::TWIP ); + m_xWidthMF->set_value(m_xWidthMF->NormalizePercent(nSaveWidth ), FieldUnit::TWIP ); } ModifyHdl(*m_xWidthMF->get()); bModified = true; @@ -358,9 +358,9 @@ void SwFormatTablePage::ModifyHdl(const weld::MetricSpinButton& rEdit) } } if (nCurWidth != nPrevWidth ) - m_xWidthMF->SetPrcntValue( m_xWidthMF->NormalizePercent( nCurWidth ), FieldUnit::TWIP ); - m_xRightMF->SetPrcntValue( m_xRightMF->NormalizePercent( nRight ), FieldUnit::TWIP ); - m_xLeftMF->SetPrcntValue( m_xLeftMF->NormalizePercent( nLeft ), FieldUnit::TWIP ); + m_xWidthMF->set_value( m_xWidthMF->NormalizePercent( nCurWidth ), FieldUnit::TWIP ); + m_xRightMF->set_value( m_xRightMF->NormalizePercent( nRight ), FieldUnit::TWIP ); + m_xLeftMF->set_value( m_xLeftMF->NormalizePercent( nLeft ), FieldUnit::TWIP ); bModified = true; } @@ -451,14 +451,14 @@ void SwFormatTablePage::Reset( const SfxItemSet* ) { m_xRelWidthCB->set_active(true); RelWidthClickHdl(*m_xRelWidthCB); - m_xWidthMF->SetPrcntValue(pTableData->GetWidthPercent(), FieldUnit::PERCENT); + m_xWidthMF->set_value(pTableData->GetWidthPercent(), FieldUnit::PERCENT); m_xWidthMF->save_value(); nSaveWidth = static_cast< SwTwips >(m_xWidthMF->get_value(FieldUnit::PERCENT)); } else { - m_xWidthMF->SetPrcntValue(m_xWidthMF->NormalizePercent( + m_xWidthMF->set_value(m_xWidthMF->NormalizePercent( pTableData->GetWidth()), FieldUnit::TWIP); m_xWidthMF->save_value(); nSaveWidth = pTableData->GetWidth(); @@ -467,9 +467,9 @@ void SwFormatTablePage::Reset( const SfxItemSet* ) m_xWidthMF->SetRefValue(pTableData->GetSpace()); - m_xLeftMF->SetPrcntValue(m_xLeftMF->NormalizePercent( + m_xLeftMF->set_value(m_xLeftMF->NormalizePercent( pTableData->GetLeftSpace()), FieldUnit::TWIP); - m_xRightMF->SetPrcntValue(m_xRightMF->NormalizePercent( + m_xRightMF->set_value(m_xRightMF->NormalizePercent( pTableData->GetRightSpace()), FieldUnit::TWIP); m_xLeftMF->save_value(); m_xRightMF->save_value(); @@ -565,14 +565,14 @@ void SwFormatTablePage::ActivatePage( const SfxItemSet& rSet ) if(pTableData->GetWidthPercent() == 0 && nCurWidth != m_xWidthMF->DenormalizePercent(m_xWidthMF->get_value(FieldUnit::TWIP))) { - m_xWidthMF->SetPrcntValue(m_xWidthMF->NormalizePercent( + m_xWidthMF->set_value(m_xWidthMF->NormalizePercent( nCurWidth), FieldUnit::TWIP); m_xWidthMF->save_value(); nSaveWidth = nCurWidth; - m_xLeftMF->SetPrcntValue(m_xLeftMF->NormalizePercent( + m_xLeftMF->set_value(m_xLeftMF->NormalizePercent( pTableData->GetLeftSpace()), FieldUnit::TWIP); m_xLeftMF->save_value(); - m_xRightMF->SetPrcntValue(m_xRightMF->NormalizePercent( + m_xRightMF->set_value(m_xRightMF->NormalizePercent( pTableData->GetRightSpace()), FieldUnit::TWIP); m_xRightMF->save_value(); } @@ -784,7 +784,7 @@ void SwTableColumnPage::Reset( const SfxItemSet* ) sal_Int64 nMaxTwips = m_aFieldArr[0].NormalizePercent( nTableWidth ); for( sal_uInt16 i = 0; (i < nMetFields) && (i < nNoOfVisibleCols); i++ ) { - m_aFieldArr[i].SetPrcntValue( m_aFieldArr[i].NormalizePercent( + m_aFieldArr[i].set_value( m_aFieldArr[i].NormalizePercent( GetVisibleWidth(i) ), FieldUnit::TWIP ); m_aFieldArr[i].set_min(nMinTwips, FieldUnit::TWIP); m_aFieldArr[i].set_max(nMaxTwips, FieldUnit::TWIP); @@ -1027,7 +1027,7 @@ void SwTableColumnPage::UpdateCols( sal_uInt16 nCurrentPos ) for( sal_uInt16 i = 0; ( i < nNoOfVisibleCols ) && ( i < nMetFields ); i++) { - m_aFieldArr[i].SetPrcntValue(m_aFieldArr[i].NormalizePercent( + m_aFieldArr[i].set_value(m_aFieldArr[i].NormalizePercent( GetVisibleWidth(aValueTable[i]) ), FieldUnit::TWIP); } } diff --git a/sw/source/uibase/inc/frmpage.hxx b/sw/source/uibase/inc/frmpage.hxx index a01b5eec508d..f635b9e50213 100644 --- a/sw/source/uibase/inc/frmpage.hxx +++ b/sw/source/uibase/inc/frmpage.hxx @@ -43,54 +43,6 @@ struct SwPosition; // frame dialog class SwFramePage: public SfxTabPage { - // size - VclPtr<FixedText> m_pWidthFT; - VclPtr<FixedText> m_pWidthAutoFT; - PercentField m_aWidthED; - VclPtr<CheckBox> m_pRelWidthCB; - VclPtr<ListBox> m_pRelWidthRelationLB; - VclPtr<CheckBox> m_pAutoWidthCB; - - VclPtr<FixedText> m_pHeightFT; - VclPtr<FixedText> m_pHeightAutoFT; - PercentField m_aHeightED; - VclPtr<CheckBox> m_pRelHeightCB; - VclPtr<ListBox> m_pRelHeightRelationLB; - VclPtr<CheckBox> m_pAutoHeightCB; - - VclPtr<CheckBox> m_pFixedRatioCB; - VclPtr<PushButton> m_pRealSizeBT; - - // anchor - VclPtr<VclContainer> m_pAnchorFrame; - VclPtr<RadioButton> m_pAnchorAtPageRB; - VclPtr<RadioButton> m_pAnchorAtParaRB; - VclPtr<RadioButton> m_pAnchorAtCharRB; - VclPtr<RadioButton> m_pAnchorAsCharRB; - VclPtr<RadioButton> m_pAnchorAtFrameRB; - - // position - VclPtr<FixedText> m_pHorizontalFT; - VclPtr<ListBox> m_pHorizontalDLB; - VclPtr<FixedText> m_pAtHorzPosFT; - VclPtr<MetricField> m_pAtHorzPosED; - VclPtr<FixedText> m_pHoriRelationFT; - VclPtr<ListBox> m_pHoriRelationLB; - - VclPtr<CheckBox> m_pMirrorPagesCB; - - VclPtr<FixedText> m_pVerticalFT; - VclPtr<ListBox> m_pVerticalDLB; - VclPtr<FixedText> m_pAtVertPosFT; - VclPtr<MetricField> m_pAtVertPosED; - VclPtr<FixedText> m_pVertRelationFT; - VclPtr<ListBox> m_pVertRelationLB; - // #i18732# - check box for new option 'FollowTextFlow' - VclPtr<CheckBox> m_pFollowTextFlowCB; - - // example - VclPtr<SvxSwFrameExample> m_pExampleWN; - bool m_bAtHorzPosModified; bool m_bAtVertPosModified; @@ -126,48 +78,98 @@ class SwFramePage: public SfxTabPage bool m_bIsMathOLE; bool m_bIsMathBaselineAlignment; + SwFrameExample m_aExampleWN; + + // size + std::unique_ptr<weld::Label> m_xWidthFT; + std::unique_ptr<weld::Label> m_xWidthAutoFT; + std::unique_ptr<weld::CheckButton> m_xRelWidthCB; + std::unique_ptr<weld::ComboBox> m_xRelWidthRelationLB; + std::unique_ptr<weld::CheckButton> m_xAutoWidthCB; + + std::unique_ptr<weld::Label> m_xHeightFT; + std::unique_ptr<weld::Label> m_xHeightAutoFT; + std::unique_ptr<weld::CheckButton> m_xRelHeightCB; + std::unique_ptr<weld::ComboBox> m_xRelHeightRelationLB; + std::unique_ptr<weld::CheckButton> m_xAutoHeightCB; + + std::unique_ptr<weld::CheckButton> m_xFixedRatioCB; + std::unique_ptr<weld::Button> m_xRealSizeBT; + + // anchor + std::unique_ptr<weld::Widget> m_xAnchorFrame; + std::unique_ptr<weld::RadioButton> m_xAnchorAtPageRB; + std::unique_ptr<weld::RadioButton> m_xAnchorAtParaRB; + std::unique_ptr<weld::RadioButton> m_xAnchorAtCharRB; + std::unique_ptr<weld::RadioButton> m_xAnchorAsCharRB; + std::unique_ptr<weld::RadioButton> m_xAnchorAtFrameRB; + + // position + std::unique_ptr<weld::Label> m_xHorizontalFT; + std::unique_ptr<weld::ComboBox> m_xHorizontalDLB; + std::unique_ptr<weld::Label> m_xAtHorzPosFT; + std::unique_ptr<weld::MetricSpinButton> m_xAtHorzPosED; + std::unique_ptr<weld::Label> m_xHoriRelationFT; + std::unique_ptr<weld::ComboBox> m_xHoriRelationLB; + + std::unique_ptr<weld::CheckButton> m_xMirrorPagesCB; + + std::unique_ptr<weld::Label> m_xVerticalFT; + std::unique_ptr<weld::ComboBox> m_xVerticalDLB; + std::unique_ptr<weld::Label> m_xAtVertPosFT; + std::unique_ptr<weld::MetricSpinButton> m_xAtVertPosED; + std::unique_ptr<weld::Label> m_xVertRelationFT; + std::unique_ptr<weld::ComboBox> m_xVertRelationLB; + // #i18732# - check box for new option 'FollowTextFlow' + std::unique_ptr<weld::CheckButton> m_xFollowTextFlowCB; + + // example + std::unique_ptr<weld::CustomWeld> m_xExampleWN; + + std::unique_ptr<SwPercentField> m_xWidthED; + std::unique_ptr<SwPercentField> m_xHeightED; + virtual void ActivatePage(const SfxItemSet& rSet) override; virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override; - DECL_LINK(RangeModifyLoseFocusHdl, Control&, void); - DECL_LINK(RangeModifyClickHdl, Button*, void); + DECL_LINK(RangeModifyClickHdl, weld::ToggleButton&, void); void RangeModifyHdl(); - DECL_LINK(AnchorTypeHdl, Button*, void); - DECL_LINK( PosHdl, ListBox&, void ); - DECL_LINK( RelHdl, ListBox&, void ); + DECL_LINK(AnchorTypeHdl, weld::ToggleButton&, void); + DECL_LINK(PosHdl, weld::ComboBox&, void); + DECL_LINK(RelHdl, weld::ComboBox&, void); void InitPos(RndStdIds eId, sal_Int16 nH, sal_Int16 nHRel, sal_Int16 nV, sal_Int16 nVRel, long nX, long nY); - DECL_LINK(RealSizeHdl, Button *, void); - DECL_LINK( RelSizeClickHdl, Button *, void ); - DECL_LINK(MirrorHdl, Button *, void); + DECL_LINK(RealSizeHdl, weld::Button&, void); + DECL_LINK(RelSizeClickHdl, weld::ToggleButton&, void); + DECL_LINK(MirrorHdl, weld::ToggleButton&, void); - DECL_LINK( AutoWidthClickHdl, Button *, void); - DECL_LINK( AutoHeightClickHdl, Button *, void); + DECL_LINK(AutoWidthClickHdl, weld::ToggleButton&, void); + DECL_LINK(AutoHeightClickHdl, weld::ToggleButton&, void); // update example void UpdateExample(); - DECL_LINK( ModifyHdl, Edit&, void ); + DECL_LINK(ModifyHdl, weld::MetricSpinButton&, void); - void Init(const SfxItemSet& rSet, bool bReset = false); + void Init(const SfxItemSet& rSet); // OD 12.11.2003 #i22341# - adjustment to handle maps, that are ambiguous // in the alignment. sal_Int32 FillPosLB( const FrameMap* _pMap, const sal_Int16 _nAlign, const sal_Int16 _nRel, - ListBox& _rLB ); + weld::ComboBox& _rLB ); // OD 14.11.2003 #i22341# - adjustment to handle maps, that are ambiguous // in their string entries. void FillRelLB( const FrameMap* _pMap, const sal_uInt16 _nLBSelPos, const sal_Int16 _nAlign, const sal_Int16 _nRel, - ListBox& _rLB, - FixedText& _rFT ); - static sal_Int32 GetMapPos(const FrameMap *pMap, ListBox const &rAlignLB); - static sal_Int16 GetAlignment(FrameMap const *pMap, sal_Int32 nMapPos, ListBox const &rRelationLB); - static sal_Int16 GetRelation(ListBox const &rRelationLB); + weld::ComboBox& _rLB, + weld::Label& _rFT ); + static sal_Int32 GetMapPos(const FrameMap *pMap, const weld::ComboBox& rAlignLB); + static sal_Int16 GetAlignment(FrameMap const *pMap, sal_Int32 nMapPos, const weld::ComboBox& rRelationLB); + static sal_Int16 GetRelation(const weld::ComboBox& rRelationLB); RndStdIds GetAnchor(); void setOptimalFrameWidth(); @@ -183,9 +185,8 @@ class SwFramePage: public SfxTabPage static const sal_uInt16 aPageRg[]; public: - SwFramePage(vcl::Window *pParent, const SfxItemSet &rSet); + SwFramePage(TabPageParent pParent, const SfxItemSet &rSet); virtual ~SwFramePage() override; - virtual void dispose() override; static VclPtr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet *rSet); static const sal_uInt16* GetRanges() { return aPageRg; } diff --git a/sw/source/uibase/inc/prcntfld.hxx b/sw/source/uibase/inc/prcntfld.hxx index f03b55f37f44..717620013d03 100644 --- a/sw/source/uibase/inc/prcntfld.hxx +++ b/sw/source/uibase/inc/prcntfld.hxx @@ -25,69 +25,6 @@ #include <swdllapi.h> #include "uitool.hxx" -class SW_DLLPUBLIC PercentField -{ - VclPtr<MetricField> m_pField; - - sal_Int64 nRefValue; // 100% value for conversion (in Twips) - sal_Int64 nOldMax; - sal_Int64 nOldMin; - sal_Int64 nOldSpinSize; - sal_Int64 nOldBaseValue; - sal_Int64 nLastPercent; - sal_Int64 nLastValue; - sal_uInt16 nOldDigits; - FieldUnit eOldUnit; - bool bLockAutoCalculation; //prevent recalculation of percent values when the - //reference value is changed - - SAL_DLLPRIVATE static sal_Int64 ImpPower10(sal_uInt16 n); - -public: - - PercentField(); - void set(MetricField *pField); - const MetricField* get() const { return m_pField; } - MetricField* get() { return m_pField; } - void SetModifyHdl(const Link<Edit&,void>& rLink) { m_pField->SetModifyHdl(rLink); } - void SetLoseFocusHdl(const Link<Control&,void>& rLink) { m_pField->SetLoseFocusHdl(rLink); } - void SetMetric(FieldUnit eUnit) { ::SetMetric(*m_pField, eUnit); } - void Enable(bool bEnable = true) { m_pField->Enable(bEnable); } - void Disable() { m_pField->Disable(); } - - void SetValue(sal_Int64 nNewValue) { m_pField->SetValue(nNewValue, FieldUnit::NONE); } - - void SetPrcntValue(sal_Int64 nNewValue, FieldUnit eInUnit = FieldUnit::NONE); - - void SetUserValue(sal_Int64 nNewValue, FieldUnit eInUnit); - - void SetBaseValue(sal_Int64 nNewValue, FieldUnit eInUnit); - - sal_Int64 GetValue(FieldUnit eOutUnit = FieldUnit::NONE); - - bool IsValueModified(); - - void SetMax(sal_Int64 nNewMax, FieldUnit eInUnit); - - void SetMin(sal_Int64 nNewMin, FieldUnit eInUnit); - - sal_Int64 GetMin() const { return m_pField->GetMin(); } - - sal_Int64 NormalizePercent(sal_Int64 nValue); - sal_Int64 DenormalizePercent(sal_Int64 nValue); - - sal_Int64 Normalize( sal_Int64 nValue ) const { return m_pField->Normalize(nValue); } - - void SetRefValue(sal_Int64 nValue); - sal_Int64 GetRealValue(FieldUnit eOutUnit); - - sal_Int64 Convert(sal_Int64 nValue, FieldUnit eInUnit, FieldUnit eOutUnit); - - void ShowPercent(bool bPercent); - - void LockAutoCalculation(bool bLock) {bLockAutoCalculation = bLock;} -}; - class SW_DLLPUBLIC SwPercentField { std::unique_ptr<weld::MetricSpinButton> m_pField; @@ -101,6 +38,8 @@ class SW_DLLPUBLIC SwPercentField int nLastValue; sal_uInt16 nOldDigits; FieldUnit eOldUnit; + bool bLockAutoCalculation; //prevent recalculation of percent values when the + //reference value is changed SAL_DLLPRIVATE static int ImpPower10(sal_uInt16 n); @@ -121,16 +60,19 @@ public: void SetMetricFieldMin(int nNewMin) { m_pField->set_min(nNewMin, FieldUnit::NONE); } void SetMetricFieldMax(int nNewMax) { m_pField->set_max(nNewMax, FieldUnit::NONE); } - void SetPrcntValue(int nNewValue, FieldUnit eInUnit = FieldUnit::NONE); - + void set_value(int nNewValue, FieldUnit eInUnit = FieldUnit::NONE); int get_value(FieldUnit eOutUnit = FieldUnit::NONE); void set_min(int nNewMin, FieldUnit eInUnit); void set_max(int nNewMax, FieldUnit eInUnit); + int get_min(FieldUnit eOutUnit = FieldUnit::NONE) const { return m_pField->get_min(eOutUnit); } + int NormalizePercent(int nValue); int DenormalizePercent(int nValue); + int normalize(int nValue) const { return m_pField->normalize(nValue); } + void SetRefValue(int nValue); int GetRealValue(FieldUnit eOutUnit); @@ -138,6 +80,7 @@ public: void ShowPercent(bool bPercent); + void LockAutoCalculation(bool bLock) {bLockAutoCalculation = bLock;} }; diff --git a/sw/source/uibase/utlui/prcntfld.cxx b/sw/source/uibase/utlui/prcntfld.cxx index 3616fb3f84fa..6564e9be928a 100644 --- a/sw/source/uibase/utlui/prcntfld.cxx +++ b/sw/source/uibase/utlui/prcntfld.cxx @@ -19,266 +19,6 @@ #include <prcntfld.hxx> -PercentField::PercentField() - : m_pField(nullptr) - , nRefValue(0) - , nOldMax(0) - , nOldMin(0) - , nOldSpinSize(0) - , nOldBaseValue(0) - , nLastPercent(-1) - , nLastValue(-1) - , nOldDigits(0) - , eOldUnit(FieldUnit::NONE) - , bLockAutoCalculation(false) -{ -} - -void PercentField::set(MetricField *pField) -{ - m_pField = pField; - nOldSpinSize = m_pField->GetSpinSize(); - nRefValue = DenormalizePercent(m_pField->GetMax(FieldUnit::TWIP)); - nOldDigits = m_pField->GetDecimalDigits(); - m_pField->SetCustomUnitText(OUString('%')); -} - -void PercentField::SetRefValue(sal_Int64 nValue) -{ - sal_Int64 nRealValue = GetRealValue(eOldUnit); - - nRefValue = nValue; - - if (!bLockAutoCalculation && (m_pField->GetUnit() == FieldUnit::CUSTOM)) - SetPrcntValue(nRealValue, eOldUnit); -} - -void PercentField::ShowPercent(bool bPercent) -{ - if ((bPercent && m_pField->GetUnit() == FieldUnit::CUSTOM) || - (!bPercent && m_pField->GetUnit() != FieldUnit::CUSTOM)) - return; - - sal_Int64 nOldValue; - - if (bPercent) - { - sal_Int64 nCurrentWidth, nPercent; - - nOldValue = GetValue(); - - eOldUnit = m_pField->GetUnit(); - nOldDigits = m_pField->GetDecimalDigits(); - nOldMin = m_pField->GetMin(); - nOldMax = m_pField->GetMax(); - nOldSpinSize = m_pField->GetSpinSize(); - nOldBaseValue = m_pField->GetBaseValue(); - m_pField->SetUnit(FieldUnit::CUSTOM); - m_pField->SetDecimalDigits( 0 ); - - nCurrentWidth = MetricField::ConvertValue(nOldMin, 0, nOldDigits, eOldUnit, FieldUnit::TWIP); - // round to 0.5 percent - nPercent = ((nCurrentWidth * 10) / nRefValue + 5) / 10; - - m_pField->SetMin(std::max(static_cast< sal_Int64 >(1), nPercent)); - m_pField->SetMax(100); - m_pField->SetSpinSize(5); - m_pField->SetBaseValue(0); - if (nOldValue != nLastValue) - { - nCurrentWidth = MetricField::ConvertValue(nOldValue, 0, nOldDigits, eOldUnit, FieldUnit::TWIP); - nPercent = ((nCurrentWidth * 10) / nRefValue + 5) / 10; - m_pField->SetValue(nPercent); - nLastPercent = nPercent; - nLastValue = nOldValue; - } - else - m_pField->SetValue(nLastPercent); - } - else - { - sal_Int64 nOldPercent = GetValue(FieldUnit::CUSTOM); - - nOldValue = Convert(GetValue(), m_pField->GetUnit(), eOldUnit); - - m_pField->SetUnit(eOldUnit); - m_pField->SetDecimalDigits(nOldDigits); - m_pField->SetMin(nOldMin); - m_pField->SetMax(nOldMax); - m_pField->SetSpinSize(nOldSpinSize); - m_pField->SetBaseValue(nOldBaseValue); - - if (nOldPercent != nLastPercent) - { - SetPrcntValue(nOldValue, eOldUnit); - nLastPercent = nOldPercent; - nLastValue = nOldValue; - } - else - SetPrcntValue(nLastValue, eOldUnit); - } -} - -void PercentField::SetPrcntValue(sal_Int64 nNewValue, FieldUnit eInUnit) -{ - if (m_pField->GetUnit() != FieldUnit::CUSTOM || eInUnit == FieldUnit::CUSTOM) - m_pField->SetValue(Convert(nNewValue, eInUnit, m_pField->GetUnit())); - else - { - // Overwrite output value, do not restore later - sal_Int64 nPercent, nCurrentWidth; - if(eInUnit == FieldUnit::TWIP) - { - nCurrentWidth = MetricField::ConvertValue(nNewValue, 0, nOldDigits, FieldUnit::TWIP, FieldUnit::TWIP); - } - else - { - sal_Int64 nValue = Convert(nNewValue, eInUnit, eOldUnit); - nCurrentWidth = MetricField::ConvertValue(nValue, 0, nOldDigits, eOldUnit, FieldUnit::TWIP); - } - nPercent = ((nCurrentWidth * 10) / nRefValue + 5) / 10; - m_pField->SetValue(nPercent); - } -} - -void PercentField::SetBaseValue(sal_Int64 nNewValue, FieldUnit eInUnit) -{ - if (m_pField->GetUnit() == FieldUnit::CUSTOM) - nOldBaseValue = MetricField::ConvertValue(nNewValue, 0, nOldDigits, eInUnit, eOldUnit); - else - m_pField->SetBaseValue(nNewValue, eInUnit); -} - -sal_Int64 PercentField::GetValue(FieldUnit eOutUnit) -{ - return Convert(m_pField->GetValue(), m_pField->GetUnit(), eOutUnit); -} - -void PercentField::SetMin(sal_Int64 nNewMin, FieldUnit eInUnit) -{ - if (m_pField->GetUnit() != FieldUnit::CUSTOM) - m_pField->SetMin(nNewMin, eInUnit); - else - { - if (eInUnit == FieldUnit::NONE) - eInUnit = eOldUnit; - nOldMin = Convert(nNewMin, eInUnit, eOldUnit); - - sal_Int64 nPercent = Convert(nNewMin, eInUnit, FieldUnit::CUSTOM); - m_pField->SetMin(std::max( static_cast< sal_Int64 >(1), nPercent)); - } -} - -void PercentField::SetMax(sal_Int64 nNewMax, FieldUnit eInUnit) -{ - if (m_pField->GetUnit() != FieldUnit::CUSTOM) - m_pField->SetMax(nNewMax, eInUnit); -} - -sal_Int64 PercentField::NormalizePercent(sal_Int64 nValue) -{ - if (m_pField->GetUnit() != FieldUnit::CUSTOM) - nValue = m_pField->Normalize(nValue); - else - nValue = nValue * ImpPower10(nOldDigits); - return nValue; -} - -sal_Int64 PercentField::DenormalizePercent(sal_Int64 nValue) -{ - if (m_pField->GetUnit() != FieldUnit::CUSTOM) - nValue = m_pField->Denormalize(nValue); - else - { - sal_Int64 nFactor = ImpPower10(nOldDigits); - nValue = ((nValue+(nFactor/2)) / nFactor); - } - return nValue; -} - -bool PercentField::IsValueModified() -{ - if (m_pField->GetUnit() == FieldUnit::CUSTOM) - return true; - else - return m_pField->IsValueModified(); -} - -void PercentField::SetUserValue(sal_Int64 nNewValue, FieldUnit eInUnit) -{ - if (m_pField->GetUnit() != FieldUnit::CUSTOM || eInUnit == FieldUnit::CUSTOM) - m_pField->SetUserValue(Convert(nNewValue, eInUnit, m_pField->GetUnit()),FieldUnit::NONE); - else - { - // Overwrite output value, do not restore later - sal_Int64 nPercent, nCurrentWidth; - if (eInUnit == FieldUnit::TWIP) - { - nCurrentWidth = MetricField::ConvertValue(nNewValue, 0, nOldDigits, FieldUnit::TWIP, FieldUnit::TWIP); - } - else - { - sal_Int64 nValue = Convert(nNewValue, eInUnit, eOldUnit); - nCurrentWidth = MetricField::ConvertValue(nValue, 0, nOldDigits, eOldUnit, FieldUnit::TWIP); - } - nPercent = ((nCurrentWidth * 10) / nRefValue + 5) / 10; - m_pField->SetUserValue(nPercent,FieldUnit::NONE); - } -} - -sal_Int64 PercentField::ImpPower10(sal_uInt16 n) -{ - sal_Int64 nValue = 1; - - for (sal_uInt16 i=0; i < n; ++i) - nValue *= 10; - - return nValue; -} - -sal_Int64 PercentField::GetRealValue(FieldUnit eOutUnit) -{ - if (m_pField->GetUnit() != FieldUnit::CUSTOM) - return GetValue(eOutUnit); - else - return Convert(GetValue(), m_pField->GetUnit(), eOutUnit); -} - -sal_Int64 PercentField::Convert(sal_Int64 nValue, FieldUnit eInUnit, FieldUnit eOutUnit) -{ - if (eInUnit == eOutUnit || - (eInUnit == FieldUnit::NONE && eOutUnit == m_pField->GetUnit()) || - (eOutUnit == FieldUnit::NONE && eInUnit == m_pField->GetUnit())) - return nValue; - - if (eInUnit == FieldUnit::CUSTOM) - { - // Convert to metric - sal_Int64 nTwipValue = (nRefValue * nValue + 50) / 100; - - if (eOutUnit == FieldUnit::TWIP) // Only convert if necessary - return NormalizePercent(nTwipValue); - else - return MetricField::ConvertValue(NormalizePercent(nTwipValue), 0, nOldDigits, FieldUnit::TWIP, eOutUnit); - } - - if (eOutUnit == FieldUnit::CUSTOM) - { - // Convert to percent - sal_Int64 nCurrentWidth; - nValue = DenormalizePercent(nValue); - - if (eInUnit == FieldUnit::TWIP) // Only convert if necessary - nCurrentWidth = nValue; - else - nCurrentWidth = MetricField::ConvertValue(nValue, 0, nOldDigits, eInUnit, FieldUnit::TWIP); - // Round to 0.5 percent - return ((nCurrentWidth * 1000) / nRefValue + 5) / 10; - } - - return MetricField::ConvertValue(nValue, 0, nOldDigits, eInUnit, eOutUnit); -} - SwPercentField::SwPercentField(std::unique_ptr<weld::MetricSpinButton> pControl) : m_pField(std::move(pControl)) , nOldMax(0) @@ -287,6 +27,7 @@ SwPercentField::SwPercentField(std::unique_ptr<weld::MetricSpinButton> pControl) , nLastValue(-1) , nOldDigits(m_pField->get_digits()) , eOldUnit(FieldUnit::NONE) + , bLockAutoCalculation(false) { int nMin, nMax; m_pField->get_range(nMin, nMax, FieldUnit::TWIP); @@ -300,8 +41,8 @@ void SwPercentField::SetRefValue(int nValue) nRefValue = nValue; - if (m_pField->get_unit() == FieldUnit::PERCENT) - SetPrcntValue(nRealValue, eOldUnit); + if (!bLockAutoCalculation && (m_pField->get_unit() == FieldUnit::PERCENT)) + set_value(nRealValue, eOldUnit); } void SwPercentField::ShowPercent(bool bPercent) @@ -355,16 +96,16 @@ void SwPercentField::ShowPercent(bool bPercent) if (nOldPercent != nLastPercent) { - SetPrcntValue(nOldValue, eOldUnit); + set_value(nOldValue, eOldUnit); nLastPercent = nOldPercent; nLastValue = nOldValue; } else - SetPrcntValue(nLastValue, eOldUnit); + set_value(nLastValue, eOldUnit); } } -void SwPercentField::SetPrcntValue(int nNewValue, FieldUnit eInUnit) +void SwPercentField::set_value(int nNewValue, FieldUnit eInUnit) { if (m_pField->get_unit() != FieldUnit::PERCENT || eInUnit == FieldUnit::PERCENT) m_pField->set_value(Convert(nNewValue, eInUnit, m_pField->get_unit()), FieldUnit::NONE); diff --git a/sw/uiconfig/swriter/ui/frmtypepage.ui b/sw/uiconfig/swriter/ui/frmtypepage.ui index e2e9f580905c..29207271c8a6 100644 --- a/sw/uiconfig/swriter/ui/frmtypepage.ui +++ b/sw/uiconfig/swriter/ui/frmtypepage.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sw"> <requires lib="gtk+" version="3.18"/> <requires lib="LibreOffice" version="1.0"/> @@ -15,6 +15,18 @@ <property name="step_increment">1</property> <property name="page_increment">10</property> </object> + <object class="GtkAdjustment" id="adjustment3"> + <property name="lower">0.050000000000000003</property> + <property name="upper">99.989999999999995</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment4"> + <property name="lower">-99.989999999999995</property> + <property name="upper">99.989999999999995</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> <object class="GtkGrid" id="FrameTypePage"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -56,9 +68,10 @@ <property name="row_spacing">6</property> <property name="column_spacing">12</property> <child> - <object class="GtkSpinButton" id="width:0.00cm"> + <object class="GtkSpinButton" id="width"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="activates_default">True</property> <property name="adjustment">adjustment1</property> <property name="digits">2</property> </object> @@ -95,7 +108,7 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="frmtypepage|autowidthft">_Width (at least)</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">width:0.00cm</property> + <property name="mnemonic_widget">width</property> <property name="xalign">0</property> </object> <packing> @@ -109,7 +122,7 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="frmtypepage|widthft">_Width</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">width:0.00cm</property> + <property name="mnemonic_widget">width</property> <property name="xalign">0</property> </object> <packing> @@ -180,10 +193,11 @@ <property name="row_spacing">6</property> <property name="column_spacing">12</property> <child> - <object class="GtkSpinButton" id="height:0.00cm"> + <object class="GtkSpinButton" id="height"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="adjustment">adjustment1</property> + <property name="activates_default">True</property> + <property name="adjustment">adjustment3</property> <property name="digits">2</property> </object> <packing> @@ -219,7 +233,7 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="frmtypepage|autoheightft">H_eight (at least)</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">height:0.00cm</property> + <property name="mnemonic_widget">height</property> <property name="xalign">0</property> </object> <packing> @@ -233,7 +247,7 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="frmtypepage|heightft">H_eight</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">height:0.00cm</property> + <property name="mnemonic_widget">height</property> <property name="xalign">0</property> </object> <packing> @@ -351,7 +365,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <child> - <object class="svxlo-SvxSwFrameExample" id="preview"> + <object class="GtkDrawingArea" id="preview"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">center</property> @@ -398,7 +412,6 @@ <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">topara</property> </object> <packing> <property name="left_attach">0</property> @@ -414,7 +427,7 @@ <property name="use_underline">True</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> - <property name="group">tochar</property> + <property name="group">topage</property> </object> <packing> <property name="left_attach">0</property> @@ -430,7 +443,7 @@ <property name="use_underline">True</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> - <property name="group">aschar</property> + <property name="group">topage</property> </object> <packing> <property name="left_attach">0</property> @@ -446,7 +459,7 @@ <property name="use_underline">True</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> - <property name="group">toframe</property> + <property name="group">topage</property> </object> <packing> <property name="left_attach">0</property> @@ -533,7 +546,7 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="frmtypepage|horibyft">b_y</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">byhori:0.00cm</property> + <property name="mnemonic_widget">byhori</property> <property name="xalign">0</property> </object> <packing> @@ -547,7 +560,7 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="frmtypepage|vertbyft">by</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">byvert:0.00cm</property> + <property name="mnemonic_widget">byvert</property> <property name="xalign">0</property> </object> <packing> @@ -570,9 +583,10 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="byhori:0.00cm"> + <object class="GtkSpinButton" id="byhori"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="activates_default">True</property> <property name="adjustment">adjustment2</property> <property name="digits">2</property> </object> @@ -626,10 +640,11 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="byvert:0.00cm"> + <object class="GtkSpinButton" id="byvert"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="adjustment">adjustment2</property> + <property name="activates_default">True</property> + <property name="adjustment">adjustment4</property> <property name="digits">2</property> </object> <packing> |