summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-04-04 16:19:06 +0100
committerCaolán McNamara <caolanm@redhat.com>2016-04-05 20:24:51 +0100
commit92d43df81e282d20c129b105b2c7300a312091eb (patch)
tree2163a30e7ac2defdabc0214fc0aeba7f351669c9
parent3c36ba50f65d663f35264f2a11c99c0ff98674a2 (diff)
convert src line width popup to .ui format
Change-Id: I39e8bfd89538c36c97afb3e4e86c3ba9156274e0
-rw-r--r--include/svx/dialogs.hrc8
-rw-r--r--include/svx/sidebar/LinePropertyPanelBase.hxx9
-rw-r--r--include/svx/sidebar/LineWidthPopup.hxx38
-rw-r--r--svx/Library_svx.mk1
-rw-r--r--svx/UIConfig_svx.mk1
-rw-r--r--svx/inc/helpid.hrc2
-rw-r--r--svx/source/dialog/sdstring.src10
-rw-r--r--svx/source/sidebar/line/LinePropertyPanel.cxx1
-rw-r--r--svx/source/sidebar/line/LinePropertyPanel.hrc11
-rw-r--r--svx/source/sidebar/line/LinePropertyPanel.hxx1
-rw-r--r--svx/source/sidebar/line/LinePropertyPanel.src71
-rw-r--r--svx/source/sidebar/line/LinePropertyPanelBase.cxx18
-rw-r--r--svx/source/sidebar/line/LineWidthControl.cxx323
-rw-r--r--svx/source/sidebar/line/LineWidthControl.hxx82
-rw-r--r--svx/source/sidebar/line/LineWidthPopup.cxx229
-rw-r--r--svx/source/sidebar/line/LineWidthValueSet.cxx23
-rw-r--r--svx/source/sidebar/line/LineWidthValueSet.hxx4
-rw-r--r--svx/uiconfig/ui/floatinglineproperty.ui85
18 files changed, 364 insertions, 553 deletions
diff --git a/include/svx/dialogs.hrc b/include/svx/dialogs.hrc
index afa3889aa75a..4ff3dc5936da 100644
--- a/include/svx/dialogs.hrc
+++ b/include/svx/dialogs.hrc
@@ -201,7 +201,6 @@
#define RID_POPUPPANEL_AREAPAGE_TRGR (RID_SVX_START + 320)
#define RID_SIDEBAR_LINE_PANEL (RID_SVX_START + 321)
-#define RID_POPUPPANEL_LINEPAGE_WIDTH (RID_SVX_START + 324)
#define RID_SIDEBAR_POSSIZE_PANEL (RID_SVX_START + 325)
#define RID_SIDEBAR_GRAPHIC_PANEL (RID_SVX_START + 326)
@@ -1089,8 +1088,13 @@
#define RID_SVXSTR_ZOOM_PAGE_WIDTH (RID_SVX_START + 1389)
#define RID_SVXSTR_ZOOM_OPTIMAL_VIEW (RID_SVX_START + 1390)
+#define RID_SVXSTR_WIDTH_LAST_CUSTOM (RID_SVX_START + 1391)
+#define RID_SVXSTR_PT (RID_SVX_START + 1392)
+#define RID_SVXIMG_WIDTH_CUSTOM (RID_SVX_START + 1393)
+#define RID_SVXIMG_WIDTH_CUSTOM_GRAY (RID_SVX_START + 1394)
+
// !!! IMPORTANT: consider and update RID_SVXSTR_NEXTFREE when introducing new RIDs for Strings !!!
-#define RID_SVXSTR_NEXTFREE (RID_SVX_START + 1391)
+#define RID_SVXSTR_NEXTFREE (RID_SVX_START + 1395)
// if we have _a_lot_ time, we should group the resource ids by type, instead
// of grouping them by semantics. The reason is that resource ids have to be
diff --git a/include/svx/sidebar/LinePropertyPanelBase.hxx b/include/svx/sidebar/LinePropertyPanelBase.hxx
index ac354de4efb6..93398f80a42c 100644
--- a/include/svx/sidebar/LinePropertyPanelBase.hxx
+++ b/include/svx/sidebar/LinePropertyPanelBase.hxx
@@ -65,9 +65,6 @@ namespace svx
namespace sidebar
{
-class PopupContainer;
-class LineWidthControl;
-
class SVX_DLLPUBLIC LinePropertyPanelBase : public PanelLayout
{
public:
@@ -81,8 +78,6 @@ public:
void SetWidthIcon(int n);
void SetWidthIcon();
- void EndLineWidthPopupMode();
-
// constructor/destuctor
LinePropertyPanelBase(
vcl::Window* pParent,
@@ -152,7 +147,7 @@ private:
std::unique_ptr<XLineEndItem> mpEndItem;
//popup windows
- LineWidthPopup maLineWidthPopup;
+ VclPtr<LineWidthPopup> mxLineWidthPopup;
// images from resource
Image maIMGNone;
@@ -173,8 +168,6 @@ private:
DECL_LINK_TYPED(ChangeEndHdl, ListBox&, void);
DECL_LINK_TYPED(ChangeEdgeStyleHdl, ListBox&, void);
DECL_LINK_TYPED(ChangeCapStyleHdl, ListBox&, void);
-
- VclPtr<PopupControl> CreateLineWidthPopupControl (PopupContainer* pParent);
};
} } // end of namespace svx::sidebar
diff --git a/include/svx/sidebar/LineWidthPopup.hxx b/include/svx/sidebar/LineWidthPopup.hxx
index d507e9c39e16..79952c1f0b9f 100644
--- a/include/svx/sidebar/LineWidthPopup.hxx
+++ b/include/svx/sidebar/LineWidthPopup.hxx
@@ -19,28 +19,46 @@
#ifndef INCLUDED_SVX_SOURCE_SIDEBAR_LINE_LINEWIDTHPOPUP_HXX
#define INCLUDED_SVX_SOURCE_SIDEBAR_LINE_LINEWIDTHPOPUP_HXX
-#include "svx/sidebar/Popup.hxx"
-
#include <svl/poolitem.hxx>
+#include <vcl/floatwin.hxx>
+#include <vcl/layout.hxx>
-#include <functional>
-
+class Edit;
+class MetricField;
+class ValueSet;
namespace svx { namespace sidebar {
-class LineWidthPopup
- : public Popup
+class LinePropertyPanelBase;
+class LineWidthValueSet;
+
+class LineWidthPopup : public FloatingWindow
{
public:
- LineWidthPopup (
- vcl::Window* pParent,
- const ::std::function<PopupControl*(PopupContainer*)>& rControlCreator);
+ LineWidthPopup(LinePropertyPanelBase& rParent);
+ virtual void dispose() override;
virtual ~LineWidthPopup();
void SetWidthSelect (long lValue, bool bValuable, SfxMapUnit eMapUnit);
private:
- void PopupModeEndCallback();
+ LinePropertyPanelBase& m_rParent;
+ OUString* m_pStr;
+ OUString m_sPt;
+ SfxMapUnit m_eMapUnit;
+ bool m_bVSFocus;
+ bool m_bCustom;
+ bool m_bCloseByEdit;
+ long m_nCustomWidth;
+ long m_nTmpCustomWidth;
+ VclPtr<MetricField> m_xMFWidth;
+ VclPtr<VclContainer> m_xBox;
+ VclPtr<LineWidthValueSet> m_xVSWidth;
+ Image m_aIMGCus;
+ Image m_aIMGCusGray;
+
+ DECL_LINK_TYPED(VSSelectHdl, ValueSet*, void);
+ DECL_LINK_TYPED(MFModifyHdl, Edit&, void);
};
} } // end of namespace svx::sidebar
diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk
index 8869014381a7..b22dfa2ad999 100644
--- a/svx/Library_svx.mk
+++ b/svx/Library_svx.mk
@@ -194,7 +194,6 @@ $(eval $(call gb_Library_add_exception_objects,svx,\
svx/source/sidebar/graphic/GraphicPropertyPanel \
svx/source/sidebar/line/LinePropertyPanel \
svx/source/sidebar/line/LinePropertyPanelBase \
- svx/source/sidebar/line/LineWidthControl \
svx/source/sidebar/line/LineWidthValueSet \
svx/source/sidebar/line/LineWidthPopup \
svx/source/sidebar/possize/PosSizePropertyPanel \
diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk
index 39df1db7c2b8..c7853f8778c6 100644
--- a/svx/UIConfig_svx.mk
+++ b/svx/UIConfig_svx.mk
@@ -36,6 +36,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\
svx/uiconfig/ui/extrustiondepthdialog \
svx/uiconfig/ui/findreplacedialog \
svx/uiconfig/ui/floatingcontour \
+ svx/uiconfig/ui/floatinglineproperty \
svx/uiconfig/ui/floatingundoredo \
svx/uiconfig/ui/fontworkgallerydialog \
svx/uiconfig/ui/fontworkspacingdialog \
diff --git a/svx/inc/helpid.hrc b/svx/inc/helpid.hrc
index 82269b1c8da7..66b01938e985 100644
--- a/svx/inc/helpid.hrc
+++ b/svx/inc/helpid.hrc
@@ -89,8 +89,6 @@
#define HID_PPROPERTYPANEL_AREA_BTN_LEFT_SECOND "SVX_HID_PPROPERTYPANEL_AREA_BTN_LEFT_SECOND"
#define HID_PPROPERTYPANEL_AREA_BTN_RIGHT_FIRST "SVX_HID_PPROPERTYPANEL_AREA_BTN_RIGHT_FIRST"
#define HID_PPROPERTYPANEL_TEXT_UNDERLINE_VS "SVX_HID_PPROPERTYPANEL_TEXT_UNDERLINE_VS"
-#define HID_PPROPERTYPANEL_LINE_VS_WIDTH "SVX_HID_PPROPERTYPANEL_LINE_VS_WIDTH"
-#define HID_PPROPERTYPANEL_LINE_MTR_WIDTH "SVX_HID_PPROPERTYPANEL_LINE_MTR_WIDTH"
#define HID_PPROPERTYPANEL_TEXT_SPACING_VS "SVX_HID_PPROPERTYPANEL_TEXT_SPACING_VS"
#define HID_PPROPERTYPANEL_AREA_LB_FILL_TYPES "SVX_HID_PPROPERTYPANEL_AREA_LB_FILL_TYPES"
diff --git a/svx/source/dialog/sdstring.src b/svx/source/dialog/sdstring.src
index ce7ed3c392e1..e4726d81c886 100644
--- a/svx/source/dialog/sdstring.src
+++ b/svx/source/dialog/sdstring.src
@@ -2362,4 +2362,14 @@ String RID_SVXSTR_RECOVERYONLY_FINISH
Text[ en-US ] = "~Finish";
};
+String RID_SVXSTR_WIDTH_LAST_CUSTOM
+{
+ Text[ en-US ] = "Last Custom Value";
+};
+
+String RID_SVXSTR_PT
+{
+ Text[ en-US ] = "pt";
+};
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sidebar/line/LinePropertyPanel.cxx b/svx/source/sidebar/line/LinePropertyPanel.cxx
index 135bd210af39..925cd2056dd8 100644
--- a/svx/source/sidebar/line/LinePropertyPanel.cxx
+++ b/svx/source/sidebar/line/LinePropertyPanel.cxx
@@ -48,7 +48,6 @@
#include <svx/xlinjoit.hxx>
#include "svx/sidebar/PopupContainer.hxx"
#include "svx/sidebar/PopupControl.hxx"
-#include "LineWidthControl.hxx"
using namespace css;
using namespace css::uno;
diff --git a/svx/source/sidebar/line/LinePropertyPanel.hrc b/svx/source/sidebar/line/LinePropertyPanel.hrc
index 764ebfd2d7cc..dc46dd81784a 100644
--- a/svx/source/sidebar/line/LinePropertyPanel.hrc
+++ b/svx/source/sidebar/line/LinePropertyPanel.hrc
@@ -25,15 +25,4 @@
//style popup page
#define PB_OPTIONS 2
-//width popup page
-#define VS_WIDTH 1
-#define MF_WIDTH 2
-#define FT_CUSTOME 3
-#define FT_LINE_WIDTH 4
-#define IMG_WIDTH_CUSTOM 5
-#define IMG_WIDTH_CUSTOM_GRAY 6
-#define CT_BORDER 7
-#define STR_WIDTH_LAST_CUSTOM 8
-#define STR_PT 9
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sidebar/line/LinePropertyPanel.hxx b/svx/source/sidebar/line/LinePropertyPanel.hxx
index 594109bdac00..595cc457290a 100644
--- a/svx/source/sidebar/line/LinePropertyPanel.hxx
+++ b/svx/source/sidebar/line/LinePropertyPanel.hxx
@@ -56,7 +56,6 @@ namespace sidebar
{
class PopupContainer;
-class LineWidthControl;
class LinePropertyPanel : public LinePropertyPanelBase,
public sfx2::sidebar::IContextChangeReceiver,
diff --git a/svx/source/sidebar/line/LinePropertyPanel.src b/svx/source/sidebar/line/LinePropertyPanel.src
index 28ccd5d90a7a..41dbb970b257 100644
--- a/svx/source/sidebar/line/LinePropertyPanel.src
+++ b/svx/source/sidebar/line/LinePropertyPanel.src
@@ -58,72 +58,13 @@ Image IMG_WIDTH8_ICON
{
ImageBitmap = Bitmap{File = "symphony/width8.png";};
};
-
-Control RID_POPUPPANEL_LINEPAGE_WIDTH
+Image RID_SVXIMG_WIDTH_CUSTOM
{
- OutputSize = TRUE;
- DialogControl = TRUE;
- Border = FALSE;
-
- Size = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + 80, POPUPPANEL_MARGIN_SMALL + POPUPPANEL_MARGIN_LARGE + POPUP_BORDER_WIDTH + 12 * 9 + POPUPPANEL_MARGIN_SMALL * 2 + TEXT_HEIGHT + (POPUPPANEL_MARGIN_LARGE * 2 + TEXT_HEIGHT + 12 + TEXT_CONTROL_SPACING_VERTICAL));
-
- Control VS_WIDTH
- {
- HelpId = HID_PPROPERTYPANEL_LINE_VS_WIDTH ;
- Hide = TRUE ;
- Pos = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL + OFFSET_X , POPUPPANEL_MARGIN_SMALL + OFFSET_Y );
- Size = MAP_APPFONT ( 80 , 12 * 9);
- TabStop = TRUE ;
- Text = "Width";
- };
- FixedText FT_CUSTOME
- {
- Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_LARGE + OFFSET_X, POPUPPANEL_MARGIN_SMALL + OFFSET_Y + 12 * 9 + POPUPPANEL_MARGIN_SMALL ) ;
- Size = MAP_APPFONT ( 80 , TEXT_HEIGHT ) ;
- Text [ en-US ] = "Custom:" ;
- };
- FixedText FT_LINE_WIDTH
- {
- Pos = MAP_APPFONT ( CUSTOM_X + POPUPPANEL_MARGIN_LARGE, CUSTOM_Y + POPUPPANEL_MARGIN_LARGE) ;
- Size = MAP_APPFONT ( 74 - POPUPPANEL_MARGIN_LARGE * 2 , TEXT_HEIGHT ) ;
- Text [ en-US ] = "Line ~width:" ;
- };
- MetricField MF_WIDTH
- {
- Border = TRUE ;
- HelpID = HID_PPROPERTYPANEL_LINE_MTR_WIDTH ;
- Pos = MAP_APPFONT ( CUSTOM_X + POPUPPANEL_MARGIN_LARGE , CUSTOM_Y + POPUPPANEL_MARGIN_LARGE + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL) ;
- Size = MAP_APPFONT ( 40 , 12 ) ;
- TabStop = TRUE ;
- Right = TRUE ;
- Repeat = TRUE ;
- Spin = TRUE ;
- Maximum = 5000 ;
- StrictFormat = TRUE ;
- DecimalDigits = 2 ;
- Value = 1 ;
- Unit = FUNIT_MM ;
- Last = 5000 ;
- SpinSize = 10 ;
- QuickHelpText [ en-US ] = "Specify the width of the line.";
- };
-
- Image IMG_WIDTH_CUSTOM
- {
- ImageBitmap = Bitmap{File = "symphony/last_custom_common.png";};
- };
- Image IMG_WIDTH_CUSTOM_GRAY
- {
- ImageBitmap = Bitmap{File = "symphony/last_custom_common_grey.png";};
- };
- String STR_WIDTH_LAST_CUSTOM
- {
- Text [ en-US ] = "Last Custom Value";
- };
- String STR_PT
- {
- Text [ en-US ] = "pt";
- };
+ ImageBitmap = Bitmap{File = "symphony/last_custom_common.png";};
+};
+Image RID_SVXIMG_WIDTH_CUSTOM_GRAY
+{
+ ImageBitmap = Bitmap{File = "symphony/last_custom_common_grey.png";};
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sidebar/line/LinePropertyPanelBase.cxx b/svx/source/sidebar/line/LinePropertyPanelBase.cxx
index 2c99eb90a2f8..2efc6d63e521 100644
--- a/svx/source/sidebar/line/LinePropertyPanelBase.cxx
+++ b/svx/source/sidebar/line/LinePropertyPanelBase.cxx
@@ -48,7 +48,6 @@
#include <svx/xlinjoit.hxx>
#include "svx/sidebar/PopupContainer.hxx"
#include "svx/sidebar/PopupControl.hxx"
-#include "LineWidthControl.hxx"
using namespace css;
using namespace css::uno;
@@ -174,7 +173,7 @@ LinePropertyPanelBase::LinePropertyPanelBase(
mnWidthCoreValue(0),
mpStartItem(),
mpEndItem(),
- maLineWidthPopup(this, [this] (PopupContainer *const pContainer) { return this->CreateLineWidthPopupControl(pContainer); }),
+ mxLineWidthPopup(VclPtr<LineWidthPopup>::Create(*this)),
maIMGNone(SVX_RES(IMG_NONE_ICON)),
mpIMGWidthIcon(),
mbWidthValuable(true),
@@ -205,6 +204,7 @@ LinePropertyPanelBase::~LinePropertyPanelBase()
void LinePropertyPanelBase::dispose()
{
+ mxLineWidthPopup.disposeAndClear();
mpFTWidth.clear();
mpTBWidth.clear();
mpTBColor.clear();
@@ -683,8 +683,8 @@ IMPL_LINK_TYPED(LinePropertyPanelBase, ToolboxWidthSelectHdl,ToolBox*, pToolBox,
{
if (pToolBox->GetItemCommand(pToolBox->GetCurItemId()) == UNO_SELECTWIDTH)
{
- maLineWidthPopup.SetWidthSelect(mnWidthCoreValue, mbWidthValuable, meMapUnit);
- maLineWidthPopup.Show(*pToolBox);
+ mxLineWidthPopup->SetWidthSelect(mnWidthCoreValue, mbWidthValuable, meMapUnit);
+ mxLineWidthPopup->StartPopupMode(pToolBox, FloatWinPopupFlags::GrabFocus);
}
}
@@ -696,16 +696,6 @@ IMPL_LINK_NOARG_TYPED( LinePropertyPanelBase, ChangeTransparentHdl, Edit&, void
setLineTransparency(aItem);
}
-VclPtr<PopupControl> LinePropertyPanelBase::CreateLineWidthPopupControl (PopupContainer* pParent)
-{
- return VclPtrInstance<LineWidthControl>(pParent, *this);
-}
-
-void LinePropertyPanelBase::EndLineWidthPopupMode()
-{
- maLineWidthPopup.Hide();
-}
-
void LinePropertyPanelBase::SetWidthIcon(int n)
{
const sal_uInt16 nIdWidth = mpTBWidth->GetItemId(UNO_SELECTWIDTH);
diff --git a/svx/source/sidebar/line/LineWidthControl.cxx b/svx/source/sidebar/line/LineWidthControl.cxx
deleted file mode 100644
index c938102c401f..000000000000
--- a/svx/source/sidebar/line/LineWidthControl.cxx
+++ /dev/null
@@ -1,323 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#include "LineWidthControl.hxx"
-#include "LinePropertyPanel.hrc"
-#include <svx/sidebar/LinePropertyPanelBase.hxx>
-
-#include <svx/dialogs.hrc>
-#include <svx/dialmgr.hxx>
-#include <sfx2/sidebar/ResourceDefinitions.hrc>
-#include <comphelper/processfactory.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/settings.hxx>
-#include <unotools/viewoptions.hxx>
-#include <svx/xlnwtit.hxx>
-#include <sfx2/bindings.hxx>
-#include <sfx2/dispatch.hxx>
-#include "svx/sidebar/PopupContainer.hxx"
-
-namespace svx { namespace sidebar {
-
-LineWidthControl::LineWidthControl (
- vcl::Window* pParent,
- LinePropertyPanelBase& rPanel)
- : svx::sidebar::PopupControl(pParent,SVX_RES(RID_POPUPPANEL_LINEPAGE_WIDTH)),
- mrLinePropertyPanel(rPanel),
- maVSWidth(VclPtr<LineWidthValueSet>::Create(this, SVX_RES(VS_WIDTH))),
- maFTCus( VclPtr<FixedText>::Create(this, SVX_RES(FT_CUSTOME))),
- maFTWidth( VclPtr<FixedText>::Create(this, SVX_RES(FT_LINE_WIDTH))),
- maMFWidth( VclPtr<MetricField>::Create(this, SVX_RES(MF_WIDTH))),
- meMapUnit(SFX_MAPUNIT_TWIP),
- rStr(nullptr),
- mstrPT(SVX_RESSTR(STR_PT)),
- mnCustomWidth(0),
- mbCustom(false),
- mbCloseByEdit(false),
- mnTmpCustomWidth(0),
- mbVSFocus(true),
- maIMGCus(SVX_RES(IMG_WIDTH_CUSTOM)),
- maIMGCusGray(SVX_RES(IMG_WIDTH_CUSTOM_GRAY))
-{
- Initialize();
- FreeResource();
-}
-
-LineWidthControl::~LineWidthControl()
-{
- disposeOnce();
-}
-
-void LineWidthControl::dispose()
-{
- delete[] rStr;
- maVSWidth.disposeAndClear();
- maFTCus.disposeAndClear();
- maFTWidth.disposeAndClear();
- maMFWidth.disposeAndClear();
- svx::sidebar::PopupControl::dispose();
-}
-
-void LineWidthControl::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rect)
-{
- svx::sidebar::PopupControl::Paint(rRenderContext, rect);
-
- rRenderContext.Push(PushFlags::LINECOLOR | PushFlags::FILLCOLOR);
-
- Point aPos(rRenderContext.LogicToPixel(Point(CUSTOM_X, CUSTOM_Y), MAP_APPFONT));
- Size aSize(rRenderContext.LogicToPixel(Size(CUSTOM_W, CUSTOM_H), MAP_APPFONT));
- Rectangle aRect(aPos, aSize);
- aRect.Left() -= 1;
- aRect.Top() -= 1;
- aRect.Right() += 1;
- aRect.Bottom() += 1;
-
- Color aLineColor(189, 201, 219);
- if (!GetSettings().GetStyleSettings().GetHighContrastMode())
- rRenderContext.SetLineColor(aLineColor);
- else
- rRenderContext.SetLineColor(GetSettings().GetStyleSettings().GetShadowColor());
- rRenderContext.SetFillColor(COL_TRANSPARENT);
- rRenderContext.DrawRect(aRect);
-
- rRenderContext.Pop();
-}
-
-void LineWidthControl::Initialize()
-{
- maVSWidth->SetStyle( maVSWidth->GetStyle()| WB_3DLOOK | WB_NO_DIRECTSELECT );// WB_NAMEFIELD | WB_ITEMBORDER |WB_DOUBLEBORDER | WB_NONEFIELD |
- //for high contrast wj
- if(GetSettings().GetStyleSettings().GetHighContrastMode())
- {
- maVSWidth->SetColor(GetSettings().GetStyleSettings().GetMenuColor());
- // maBorder.SetBackground(GetSettings().GetStyleSettings().GetMenuColor());
- maFTWidth->SetBackground(GetSettings().GetStyleSettings().GetMenuColor());
- }
- else
- {
- maVSWidth->SetColor(COL_WHITE);
- // maBorder.SetBackground(Wallpaper(COL_WHITE));
- maFTWidth->SetBackground(Wallpaper(COL_WHITE));
- }
-
- sal_Int64 nFirst= maMFWidth->Denormalize( maMFWidth->GetFirst( FUNIT_TWIP ) );
- sal_Int64 nLast = maMFWidth->Denormalize( maMFWidth->GetLast( FUNIT_TWIP ) );
- sal_Int64 nMin = maMFWidth->Denormalize( maMFWidth->GetMin( FUNIT_TWIP ) );
- sal_Int64 nMax = maMFWidth->Denormalize( maMFWidth->GetMax( FUNIT_TWIP ) );
- maMFWidth->SetSpinSize( 10 );
- maMFWidth->SetUnit( FUNIT_POINT );
- if( maMFWidth->GetDecimalDigits() > 1 )
- maMFWidth->SetDecimalDigits( 1 );
- maMFWidth->SetFirst( maMFWidth->Normalize( nFirst ), FUNIT_TWIP );
- maMFWidth->SetLast( maMFWidth->Normalize( nLast ), FUNIT_TWIP );
- maMFWidth->SetMin( maMFWidth->Normalize( nMin ), FUNIT_TWIP );
- maMFWidth->SetMax( maMFWidth->Normalize( nMax ), FUNIT_TWIP );
-
- rStr = new OUString[9];
- //modify,
- rStr[0] = "0.5";
- rStr[1] = "0.8";
- rStr[2] = "1.0";
- rStr[3] = "1.5";
- rStr[4] = "2.3";
- rStr[5] = "3.0";
- rStr[6] = "4.5";
- rStr[7] = "6.0";
- rStr[8] = SVX_RESSTR(STR_WIDTH_LAST_CUSTOM);
-
- const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() );
- const sal_Unicode cSep = rLocaleWrapper.getNumDecimalSep()[0];
-
- for(int i = 0; i <= 7 ; i++)
- {
- rStr[i] = rStr[i].replace('.', cSep);//Modify
- rStr[i] += " ";
- rStr[i] += mstrPT;
- }
- //end
-
- for(sal_uInt16 i = 1 ; i <= 9 ; i++)
- {
- maVSWidth->InsertItem(i);
- maVSWidth->SetItemText(i, rStr[i-1]);
- }
- maVSWidth->SetUnit(rStr);
- maVSWidth->SetItemData(1, reinterpret_cast<void*>(5));
- maVSWidth->SetItemData(2, reinterpret_cast<void*>(8));
- maVSWidth->SetItemData(3, reinterpret_cast<void*>(10));
- maVSWidth->SetItemData(4, reinterpret_cast<void*>(15));
- maVSWidth->SetItemData(5, reinterpret_cast<void*>(23));
- maVSWidth->SetItemData(6, reinterpret_cast<void*>(30));
- maVSWidth->SetItemData(7, reinterpret_cast<void*>(45));
- maVSWidth->SetItemData(8, reinterpret_cast<void*>(60));
- maVSWidth->SetImage(maIMGCusGray);
-
- maVSWidth->SetSelItem(0);
-
- maVSWidth->SetSelectHdl(LINK( this, LineWidthControl, VSSelectHdl ));
- maMFWidth->SetModifyHdl(LINK(this, LineWidthControl, MFModifyHdl));
-
- maVSWidth->StartSelection();
- maVSWidth->Show();
-}
-
-void LineWidthControl::GetFocus()
-{
- if (!mbVSFocus && maMFWidth)
- maMFWidth->GrabFocus();
- else if (maVSWidth)
- maVSWidth->GrabFocus();
-}
-
-void LineWidthControl::SetWidthSelect( long lValue, bool bValuable, SfxMapUnit eMapUnit)
-{
- mbVSFocus = true;
- maVSWidth->SetSelItem(0);
- mbCloseByEdit = false;
- meMapUnit = eMapUnit;
- SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_LINE_WIDTH_GLOBAL_VALUE );
- if (aWinOpt.Exists())
- {
- css::uno::Sequence <css::beans::NamedValue> aSeq = aWinOpt.GetUserData();
- OUString aTmp;
- if ( aSeq.getLength())
- aSeq[0].Value >>= aTmp;
-
- OUString aWinData( aTmp );
- mnCustomWidth = aWinData.toInt32();
- mbCustom = true;
- maVSWidth->SetImage(maIMGCus);
- maVSWidth->SetCusEnable(true);
-
- OUString aStrTip( OUString::number( (double)mnCustomWidth / 10));
- aStrTip += mstrPT;
- maVSWidth->SetItemText(9, aStrTip);
- }
- else
- {
- mbCustom = false;
- maVSWidth->SetImage(maIMGCusGray);
- maVSWidth->SetCusEnable(false);
- //modify
- //String aStrTip(String(SVX_RES(STR_WIDTH_LAST_CUSTOM)));
- //maVSWidth->SetItemText(9, aStrTip);
- maVSWidth->SetItemText(9, rStr[8]);
- }
-
- if (bValuable)
- {
- sal_Int64 nVal = OutputDevice::LogicToLogic(lValue, (MapUnit) eMapUnit, MAP_100TH_MM );
- nVal = maMFWidth->Normalize(nVal);
- maMFWidth->SetValue( nVal, FUNIT_100TH_MM );
- }
- else
- {
- maMFWidth->SetText( "" );
- }
-
- OUString strCurrValue = maMFWidth->GetText();
- sal_uInt16 i = 0;
- for(; i < 8; i++)
- {
- if(strCurrValue == rStr[i])
- {
- maVSWidth->SetSelItem(i+1);
- break;
- }
- }
-
- if (i>=8)
- {
- mbVSFocus = false;
- maVSWidth->SetSelItem(0);
- }
- maVSWidth->SetFormat();
- maVSWidth->Invalidate();
- maVSWidth->StartSelection();
-}
-
-IMPL_LINK_TYPED(LineWidthControl, VSSelectHdl, ValueSet*, pControl, void)
-{
- if (pControl == maVSWidth.get())
- {
- sal_uInt16 iPos = maVSWidth->GetSelectItemId();
- if (iPos >= 1 && iPos <= 8)
- {
- sal_IntPtr nVal = LogicToLogic(reinterpret_cast<sal_IntPtr>(maVSWidth->GetItemData( iPos )), MAP_POINT, (MapUnit)meMapUnit);
- nVal = maMFWidth->Denormalize(nVal);
- XLineWidthItem aWidthItem( nVal );
- mrLinePropertyPanel.setLineWidth(aWidthItem);
- mrLinePropertyPanel.SetWidthIcon(iPos);
- mrLinePropertyPanel.SetWidth(nVal);
- mbCloseByEdit = false;
- mnTmpCustomWidth = 0;
- }
- else if (iPos == 9)
- {//last custom
- //modified
- if (mbCustom)
- {
- long nVal = LogicToLogic(mnCustomWidth , MAP_POINT, (MapUnit)meMapUnit);
- nVal = maMFWidth->Denormalize(nVal);
- XLineWidthItem aWidthItem( nVal );
- mrLinePropertyPanel.setLineWidth(aWidthItem);
- mrLinePropertyPanel.SetWidth(nVal);
- mbCloseByEdit = false;
- mnTmpCustomWidth = 0;
- }
- else
- {
- maVSWidth->SetNoSelection(); //add , set no selection and keep the last select item
- maVSWidth->SetFormat();
- maVSWidth->Invalidate();
- Invalidate();
- maVSWidth->StartSelection();
- }
- //modify end
- }
- if ((iPos >= 1 && iPos <= 8) || (iPos == 9 && mbCustom)) //add
- mrLinePropertyPanel.EndLineWidthPopupMode();
- }
-}
-
-IMPL_LINK_TYPED(LineWidthControl, MFModifyHdl, Edit&, rControl, void)
-{
- if (&rControl == maMFWidth.get())
- {
- if(maVSWidth->GetSelItem())
- {
- maVSWidth->SetSelItem(0);
- maVSWidth->SetFormat();
- maVSWidth->Invalidate();
- Invalidate();
- maVSWidth->StartSelection();
- }
- long nTmp = static_cast<long>(maMFWidth->GetValue());
- long nVal = LogicToLogic( nTmp, MAP_POINT, (MapUnit)meMapUnit );
- sal_Int32 nNewWidth = (short)maMFWidth->Denormalize( nVal );
- XLineWidthItem aWidthItem(nNewWidth);
- mrLinePropertyPanel.setLineWidth(aWidthItem);
-
- mbCloseByEdit = true;
- mnTmpCustomWidth = nTmp;
- }
-}
-
-} } // end of namespace svx::sidebar
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sidebar/line/LineWidthControl.hxx b/svx/source/sidebar/line/LineWidthControl.hxx
deleted file mode 100644
index faad9d751d31..000000000000
--- a/svx/source/sidebar/line/LineWidthControl.hxx
+++ /dev/null
@@ -1,82 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_SVX_SOURCE_SIDEBAR_LINE_LINEWIDTHCONTROL_HXX
-#define INCLUDED_SVX_SOURCE_SIDEBAR_LINE_LINEWIDTHCONTROL_HXX
-
-#include "svx/sidebar/PopupControl.hxx"
-#include "LineWidthValueSet.hxx"
-#include <svl/poolitem.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/field.hxx>
-
-class SfxBindings;
-
-namespace svx { namespace sidebar {
-
-class LinePropertyPanelBase;
-
-class LineWidthControl : public svx::sidebar::PopupControl
-{
-public:
- LineWidthControl (vcl::Window* pParent, LinePropertyPanelBase& rPanel);
- virtual ~LineWidthControl();
- virtual void dispose() override;
-
- virtual void GetFocus() override;
- virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& aRect) override;
-
- void SetWidthSelect( long lValue, bool bValuable, SfxMapUnit eMapUnit);
- bool IsCloseByEdit()
- {
- return mbCloseByEdit;
- }
- long GetTmpCustomWidth()
- {
- return mnTmpCustomWidth;
- }
-
-private:
- LinePropertyPanelBase& mrLinePropertyPanel;
- VclPtr<LineWidthValueSet> maVSWidth;
- VclPtr<FixedText> maFTCus;
- VclPtr<FixedText> maFTWidth;
- VclPtr<MetricField> maMFWidth;
- SfxMapUnit meMapUnit;
- OUString* rStr;
- OUString mstrPT;
- long mnCustomWidth;
- bool mbCustom;
- bool mbCloseByEdit;
- long mnTmpCustomWidth;
- bool mbVSFocus;
-
- Image maIMGCus;
- Image maIMGCusGray;
-
- void Initialize();
- DECL_LINK_TYPED(VSSelectHdl, ValueSet*, void);
- DECL_LINK_TYPED(MFModifyHdl, Edit&, void);
-};
-
-} } // end of namespace svx::sidebar
-
-#endif // INCLUDED_SVX_SOURCE_SIDEBAR_LINE_LINEWIDTHCONTROL_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sidebar/line/LineWidthPopup.cxx b/svx/source/sidebar/line/LineWidthPopup.cxx
index 02cc9022fdab..9112eb8d0473 100644
--- a/svx/source/sidebar/line/LineWidthPopup.cxx
+++ b/svx/source/sidebar/line/LineWidthPopup.cxx
@@ -17,52 +17,231 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <svx/sidebar/LineWidthPopup.hxx>
-#include "LineWidthControl.hxx"
-
#include <svx/sidebar/LinePropertyPanelBase.hxx>
-
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/xlnwtit.hxx>
#include <unotools/viewoptions.hxx>
-
+#include <vcl/svapp.hxx>
+#include "LineWidthValueSet.hxx"
namespace svx { namespace sidebar {
-LineWidthPopup::LineWidthPopup (
- vcl::Window* pParent,
- const ::std::function<PopupControl*(PopupContainer*)>& rControlCreator)
- : Popup(
- pParent,
- rControlCreator,
- OUString( "Width"))
+LineWidthPopup::LineWidthPopup(LinePropertyPanelBase& rParent)
+ : FloatingWindow(&rParent, "FloatingLineProperty", "svx/ui/floatinglineproperty.ui")
+ , m_rParent(rParent)
+ , m_pStr(nullptr)
+ , m_sPt(SVX_RESSTR(RID_SVXSTR_PT))
+ , m_eMapUnit(SFX_MAPUNIT_TWIP)
+ , m_bVSFocus(true)
+ , m_bCustom(false)
+ , m_bCloseByEdit(false)
+ , m_nCustomWidth(0)
+ , m_nTmpCustomWidth(0)
+ , m_aIMGCus(SVX_RES(RID_SVXIMG_WIDTH_CUSTOM))
+ , m_aIMGCusGray(SVX_RES(RID_SVXIMG_WIDTH_CUSTOM_GRAY))
{
- SetPopupModeEndHandler([this] () { return this->PopupModeEndCallback(); });
+ get(m_xMFWidth, "spin");
+
+ get(m_xBox, "box");
+
+ m_xVSWidth = VclPtr<LineWidthValueSet>::Create(m_xBox);
+
+ m_xVSWidth->SetStyle(m_xVSWidth->GetStyle()| WB_3DLOOK | WB_NO_DIRECTSELECT);
+
+ m_pStr = new OUString[9];
+
+ m_pStr[0] = "0.5";
+ m_pStr[1] = "0.8";
+ m_pStr[2] = "1.0";
+ m_pStr[3] = "1.5";
+ m_pStr[4] = "2.3";
+ m_pStr[5] = "3.0";
+ m_pStr[6] = "4.5";
+ m_pStr[7] = "6.0";
+ m_pStr[8] = SVX_RESSTR(RID_SVXSTR_WIDTH_LAST_CUSTOM);
+
+ const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() );
+ const sal_Unicode cSep = rLocaleWrapper.getNumDecimalSep()[0];
+
+ for(int i = 0; i <= 7 ; i++)
+ {
+ m_pStr[i] = m_pStr[i].replace('.', cSep);//Modify
+ m_pStr[i] += " ";
+ m_pStr[i] += m_sPt;
+ }
+
+ for (sal_uInt16 i = 1 ; i <= 9; ++i)
+ {
+ m_xVSWidth->InsertItem(i);
+ m_xVSWidth->SetItemText(i, m_pStr[i-1]);
+ }
+
+ m_xVSWidth->SetUnit(m_pStr);
+ m_xVSWidth->SetItemData(1, reinterpret_cast<void*>(5));
+ m_xVSWidth->SetItemData(2, reinterpret_cast<void*>(8));
+ m_xVSWidth->SetItemData(3, reinterpret_cast<void*>(10));
+ m_xVSWidth->SetItemData(4, reinterpret_cast<void*>(15));
+ m_xVSWidth->SetItemData(5, reinterpret_cast<void*>(23));
+ m_xVSWidth->SetItemData(6, reinterpret_cast<void*>(30));
+ m_xVSWidth->SetItemData(7, reinterpret_cast<void*>(45));
+ m_xVSWidth->SetItemData(8, reinterpret_cast<void*>(60));
+ m_xVSWidth->SetImage(m_aIMGCusGray);
+
+ m_xVSWidth->SetSelItem(0);
+
+ m_xVSWidth->SetSelectHdl(LINK(this, LineWidthPopup, VSSelectHdl));
+ m_xMFWidth->SetModifyHdl(LINK(this, LineWidthPopup, MFModifyHdl));
+
+ m_xVSWidth->StartSelection();
+ m_xVSWidth->Show();
+}
+
+void LineWidthPopup::dispose()
+{
+ delete[] m_pStr;
+ m_xVSWidth.disposeAndClear();
+ m_xBox.clear();
+ m_xMFWidth.clear();
+ FloatingWindow::dispose();
}
LineWidthPopup::~LineWidthPopup()
{
+ disposeOnce();
}
-void LineWidthPopup::SetWidthSelect (long lValue, bool bValuable, SfxMapUnit eMapUnit)
+IMPL_LINK_TYPED(LineWidthPopup, VSSelectHdl, ValueSet*, /*pControl*/, void)
{
- ProvideContainerAndControl();
+ sal_uInt16 iPos = m_xVSWidth->GetSelectItemId();
+ if (iPos >= 1 && iPos <= 8)
+ {
+ sal_IntPtr nVal = LogicToLogic(reinterpret_cast<sal_IntPtr>(m_xVSWidth->GetItemData( iPos )), MAP_POINT, (MapUnit)m_eMapUnit);
+ nVal = m_xMFWidth->Denormalize(nVal);
+ XLineWidthItem aWidthItem( nVal );
+ m_rParent.setLineWidth(aWidthItem);
+ m_rParent.SetWidthIcon(iPos);
+ m_rParent.SetWidth(nVal);
+ m_bCloseByEdit = false;
+ m_nTmpCustomWidth = 0;
+ }
+ else if (iPos == 9)
+ {//last custom
+ //modified
+ if (m_bCustom)
+ {
+ long nVal = LogicToLogic(m_nCustomWidth , MAP_POINT, (MapUnit)m_eMapUnit);
+ nVal = m_xMFWidth->Denormalize(nVal);
+ XLineWidthItem aWidthItem( nVal );
+ m_rParent.setLineWidth(aWidthItem);
+ m_rParent.SetWidth(nVal);
+ m_bCloseByEdit = false;
+ m_nTmpCustomWidth = 0;
+ }
+ else
+ {
+ m_xVSWidth->SetNoSelection(); //add , set no selection and keep the last select item
+ m_xVSWidth->SetFormat();
+ m_xVSWidth->Invalidate();
+ Invalidate();
+ m_xVSWidth->StartSelection();
+ }
+ //modify end
+ }
+ if ((iPos >= 1 && iPos <= 8) || (iPos == 9 && m_bCustom)) //add
+ {
+ EndPopupMode();
+ }
+}
- LineWidthControl* pControl = dynamic_cast<LineWidthControl*>(mxControl.get());
- if (pControl != nullptr)
- pControl->SetWidthSelect(lValue, bValuable, eMapUnit);
+IMPL_LINK_TYPED(LineWidthPopup, MFModifyHdl, Edit&, /*rControl*/, void)
+{
+ if (m_xVSWidth->GetSelItem())
+ {
+ m_xVSWidth->SetSelItem(0);
+ m_xVSWidth->SetFormat();
+ m_xVSWidth->Invalidate();
+ Invalidate();
+ m_xVSWidth->StartSelection();
+ }
+ long nTmp = static_cast<long>(m_xMFWidth->GetValue());
+ long nVal = LogicToLogic( nTmp, MAP_POINT, (MapUnit)m_eMapUnit );
+ sal_Int32 nNewWidth = (short)m_xMFWidth->Denormalize( nVal );
+ XLineWidthItem aWidthItem(nNewWidth);
+ m_rParent.setLineWidth(aWidthItem);
+
+ m_bCloseByEdit = true;
+ m_nTmpCustomWidth = nTmp;
}
-void LineWidthPopup::PopupModeEndCallback()
+void LineWidthPopup::SetWidthSelect(long lValue, bool bValuable, SfxMapUnit eMapUnit)
{
- LineWidthControl* pControl = dynamic_cast<LineWidthControl*>(mxControl.get());
- if (pControl != nullptr)
+ m_bVSFocus = true;
+ m_xVSWidth->SetSelItem(0);
+ m_bCloseByEdit = false;
+ m_eMapUnit = eMapUnit;
+ SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_LINE_WIDTH_GLOBAL_VALUE );
+ if (aWinOpt.Exists())
+ {
+ css::uno::Sequence <css::beans::NamedValue> aSeq = aWinOpt.GetUserData();
+ OUString aTmp;
+ if ( aSeq.getLength())
+ aSeq[0].Value >>= aTmp;
+
+ OUString aWinData( aTmp );
+ m_nCustomWidth = aWinData.toInt32();
+ m_bCustom = true;
+ m_xVSWidth->SetImage(m_aIMGCus);
+ m_xVSWidth->SetCusEnable(true);
+
+ OUString aStrTip( OUString::number( (double)m_nCustomWidth / 10));
+ aStrTip += m_sPt;
+ m_xVSWidth->SetItemText(9, aStrTip);
+ }
+ else
{
- if (pControl->IsCloseByEdit())
+ m_bCustom = false;
+ m_xVSWidth->SetImage(m_aIMGCusGray);
+ m_xVSWidth->SetCusEnable(false);
+ m_xVSWidth->SetItemText(9, m_pStr[8]);
+ }
+
+ if (bValuable)
+ {
+ sal_Int64 nVal = OutputDevice::LogicToLogic(lValue, (MapUnit) eMapUnit, MAP_100TH_MM );
+ nVal = m_xMFWidth->Normalize(nVal);
+ m_xMFWidth->SetValue( nVal, FUNIT_100TH_MM );
+ }
+ else
+ {
+ m_xMFWidth->SetText( "" );
+ }
+
+ OUString strCurrValue = m_xMFWidth->GetText();
+ sal_uInt16 i = 0;
+ for(; i < 8; i++)
+ {
+ if (strCurrValue == m_pStr[i])
{
- SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_LINE_WIDTH_GLOBAL_VALUE );
- css::uno::Sequence < css::beans::NamedValue > aSeq
- { { "LineWidth", css::uno::makeAny(OUString::number(pControl->GetTmpCustomWidth())) } };
- aWinOpt.SetUserData( aSeq );
+ m_xVSWidth->SetSelItem(i+1);
+ break;
}
}
+
+ if (i>=8)
+ {
+ m_bVSFocus = false;
+ m_xVSWidth->SetSelItem(0);
+ }
+
+ m_xVSWidth->SetFormat();
+ m_xVSWidth->Invalidate();
+ m_xVSWidth->StartSelection();
+
+ if (m_bVSFocus)
+ m_xVSWidth->GrabFocus();
+ else
+ m_xMFWidth->GrabFocus();
}
} } // end of namespace svx::sidebar
diff --git a/svx/source/sidebar/line/LineWidthValueSet.cxx b/svx/source/sidebar/line/LineWidthValueSet.cxx
index a260709bb678..d4172d420267 100644
--- a/svx/source/sidebar/line/LineWidthValueSet.cxx
+++ b/svx/source/sidebar/line/LineWidthValueSet.cxx
@@ -23,16 +23,20 @@
namespace svx { namespace sidebar {
-LineWidthValueSet::LineWidthValueSet (
- vcl::Window* pParent, const ResId& rResId)
- : ValueSet( pParent, rResId ),
- pVDev(nullptr),
- nSelItem(0),
- bCusEnable(false)
+LineWidthValueSet::LineWidthValueSet(vcl::Window* pParent)
+ : ValueSet(pParent, WB_TABSTOP)
+ , pVDev(nullptr)
+ , nSelItem(0)
+ , bCusEnable(false)
{
strUnit = new OUString[9];
+}
+
+void LineWidthValueSet::Resize()
+{
SetColCount();
- SetLineCount( 9);
+ SetLineCount(9);
+ ValueSet::Resize();
}
LineWidthValueSet::~LineWidthValueSet()
@@ -167,6 +171,11 @@ void LineWidthValueSet::UserDraw( const UserDrawEvent& rUDEvt )
pDev->SetFont(aOldFont);
}
+Size LineWidthValueSet::GetOptimalSize() const
+{
+ return LogicToPixel(Size(80, 12 * 9), MAP_APPFONT);
+}
+
} } // end of namespace svx::sidebar
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sidebar/line/LineWidthValueSet.hxx b/svx/source/sidebar/line/LineWidthValueSet.hxx
index b99e0dbbb402..36a17ad3d45d 100644
--- a/svx/source/sidebar/line/LineWidthValueSet.hxx
+++ b/svx/source/sidebar/line/LineWidthValueSet.hxx
@@ -28,7 +28,7 @@ class LineWidthValueSet
: public ValueSet
{
public:
- LineWidthValueSet (vcl::Window* pParent, const ResId& rResId);
+ LineWidthValueSet(vcl::Window* pParent);
virtual ~LineWidthValueSet();
virtual void dispose() override;
@@ -39,6 +39,8 @@ public:
void SetCusEnable(bool bEnable);
virtual void UserDraw( const UserDrawEvent& rUDEvt ) override;
+ virtual void Resize() override;
+ virtual Size GetOptimalSize() const override;
protected:
VclPtr<VirtualDevice> pVDev;
diff --git a/svx/uiconfig/ui/floatinglineproperty.ui b/svx/uiconfig/ui/floatinglineproperty.ui
new file mode 100644
index 000000000000..17daafe0e836
--- /dev/null
+++ b/svx/uiconfig/ui/floatinglineproperty.ui
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.19.0 -->
+<interface>
+ <requires lib="gtk+" version="3.0"/>
+ <object class="GtkAdjustment" id="adjustment1">
+ <property name="upper">500</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkWindow" id="FloatingLineProperty:border">
+ <property name="can_focus">True</property>
+ <property name="has_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="border_width">6</property>
+ <property name="resizable">False</property>
+ <property name="destroy_with_parent">True</property>
+ <property name="type_hint">popup-menu</property>
+ <property name="skip_pager_hint">True</property>
+ <property name="deletable">False</property>
+ <child>
+ <object class="GtkGrid" id="grid1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkBox" id="box">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="grid2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="column_spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Custom Line Width:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">spin:0.0pt</property>
+ <property name="ellipsize">middle</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="spin:0.0pt">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="adjustment">adjustment1</property>
+ <property name="climb_rate">10</property>
+ <property name="digits">1</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>