[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - extras/source include/svx solenv/bin svx/source sw/source sw/uiconfig
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Nov 23 08:54:56 UTC 2018
extras/source/glade/libreoffice-catalog.xml.in | 3
include/svx/swframeexample.hxx | 64 -
solenv/bin/native-code.py | 1
svx/source/dialog/swframeexample.cxx | 693 ----------------
sw/source/ui/frmdlg/column.cxx | 24
sw/source/ui/frmdlg/frmpage.cxx | 1033 +++++++++++--------------
sw/source/ui/table/tabledlg.cxx | 42 -
sw/source/uibase/inc/frmpage.hxx | 137 +--
sw/source/uibase/inc/prcntfld.hxx | 73 -
sw/source/uibase/utlui/prcntfld.cxx | 271 ------
sw/uiconfig/swriter/ui/frmtypepage.ui | 51 -
11 files changed, 645 insertions(+), 1747 deletions(-)
New commits:
commit 998d11b44eb3c57583703fa0df67e087ba187195
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Nov 21 21:21:35 2018 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Nov 23 09:54:21 2018 +0100
weld SwFramePage
Change-Id: I12f868611860867df26bd29474aa19189c2b9a96
Reviewed-on: https://gerrit.libreoffice.org/63842
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
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())
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list