[Libreoffice-commits] core.git: 2 commits - include/sfx2 sc/inc sc/source sc/uiconfig sc/UIConfig_scalc.mk svx/source

Caolán McNamara caolanm at redhat.com
Wed Oct 5 10:11:28 UTC 2016


 include/sfx2/sidebar/ResourceDefinitions.hrc         |    3 -
 sc/UIConfig_scalc.mk                                 |    1 
 sc/inc/sc.hrc                                        |    1 
 sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx |    5 -
 sc/source/ui/sidebar/CellAppearancePropertyPanel.hrc |    4 -
 sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx |   29 ----------
 sc/source/ui/sidebar/CellAppearancePropertyPanel.src |   29 ----------
 sc/source/ui/sidebar/CellLineStyleControl.cxx        |   53 +++++++-----------
 sc/source/ui/sidebar/CellLineStyleControl.hxx        |   17 ++---
 sc/source/ui/sidebar/CellLineStyleValueSet.cxx       |   23 ++++----
 sc/source/ui/sidebar/CellLineStyleValueSet.hxx       |    3 -
 sc/uiconfig/scalc/ui/floatinglinestyle.ui            |   54 +++++++++++++++++++
 svx/source/sidebar/line/LinePropertyPanel.cxx        |    1 
 svx/source/sidebar/line/LinePropertyPanel.hrc        |   28 ---------
 svx/source/sidebar/line/LinePropertyPanel.src        |    1 
 svx/source/sidebar/line/LinePropertyPanelBase.cxx    |    1 
 16 files changed, 102 insertions(+), 151 deletions(-)

New commits:
commit e6791a2efbfb3a88aefbf1829a580dc5b0812ef2
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Oct 5 10:52:57 2016 +0100

    remove various unused hrc defines and headers
    
    Change-Id: If0b47fbe1f01d84697a0c25b82ca031c32fca66e

diff --git a/include/sfx2/sidebar/ResourceDefinitions.hrc b/include/sfx2/sidebar/ResourceDefinitions.hrc
index c819045..83c114d 100644
--- a/include/sfx2/sidebar/ResourceDefinitions.hrc
+++ b/include/sfx2/sidebar/ResourceDefinitions.hrc
@@ -42,14 +42,11 @@
 #define POPUPPANEL_MARGIN_VERTICAL      7
 #define POPUPPANEL_MARGIN_HORIZONTAL    7
 
-#define POPUP_BORDER_WIDTH      2
-#define POPUP_BORDER_HEIGHT     3
 #define OFFSET_X        1
 #define OFFSET_Y        1
 
 //new
 #define POPUPPANEL_MARGIN_SMALL     2
-#define POPUPPANEL_MARGIN_LARGE     5
 
 
 #endif
diff --git a/svx/source/sidebar/line/LinePropertyPanel.cxx b/svx/source/sidebar/line/LinePropertyPanel.cxx
index 20791b5..6c75242 100644
--- a/svx/source/sidebar/line/LinePropertyPanel.cxx
+++ b/svx/source/sidebar/line/LinePropertyPanel.cxx
@@ -19,7 +19,6 @@
 #include <sfx2/sidebar/ResourceDefinitions.hrc>
 #include <sfx2/sidebar/ControlFactory.hxx>
 #include <LinePropertyPanel.hxx>
-#include <LinePropertyPanel.hrc>
 #include <svx/dialogs.hrc>
 #include <svx/dialmgr.hxx>
 #include <sfx2/objsh.hxx>
diff --git a/svx/source/sidebar/line/LinePropertyPanel.hrc b/svx/source/sidebar/line/LinePropertyPanel.hrc
deleted file mode 100644
index dc46dd8..0000000
--- a/svx/source/sidebar/line/LinePropertyPanel.hrc
+++ /dev/null
@@ -1,28 +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 .
- */
-//  RID_SIDEBAR_LINE_PANEL--------------------------------------------------------------
-#define CUSTOM_X    POPUPPANEL_MARGIN_LARGE + OFFSET_X
-#define CUSTOM_Y    POPUPPANEL_MARGIN_SMALL + OFFSET_Y + 12 * 9 + POPUPPANEL_MARGIN_SMALL * 2 + TEXT_HEIGHT
-#define CUSTOM_W    74
-#define CUSTOM_H    POPUPPANEL_MARGIN_LARGE * 2 +  TEXT_HEIGHT + 12 +  TEXT_CONTROL_SPACING_VERTICAL
-
-//style popup page
-#define PB_OPTIONS              2
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sidebar/line/LinePropertyPanel.src b/svx/source/sidebar/line/LinePropertyPanel.src
index 41dbb97..b608eab 100644
--- a/svx/source/sidebar/line/LinePropertyPanel.src
+++ b/svx/source/sidebar/line/LinePropertyPanel.src
@@ -16,7 +16,6 @@
  *   except in compliance with the License. You may obtain a copy of
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
-#include "LinePropertyPanel.hrc"
 #include <sfx2/sidebar/ResourceDefinitions.hrc>
 #include <svx/dialogs.hrc>
 #include "helpid.hrc"
diff --git a/svx/source/sidebar/line/LinePropertyPanelBase.cxx b/svx/source/sidebar/line/LinePropertyPanelBase.cxx
index 2047408..00c48d3 100644
--- a/svx/source/sidebar/line/LinePropertyPanelBase.cxx
+++ b/svx/source/sidebar/line/LinePropertyPanelBase.cxx
@@ -19,7 +19,6 @@
 #include <sfx2/sidebar/ResourceDefinitions.hrc>
 #include <sfx2/sidebar/ControlFactory.hxx>
 #include <svx/sidebar/LinePropertyPanelBase.hxx>
-#include <LinePropertyPanel.hrc>
 #include <svx/dialogs.hrc>
 #include <svx/dialmgr.hxx>
 #include <sfx2/objsh.hxx>
commit 3845bded94ea1b933d545efce3cd2e5b0a75a2f6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Oct 4 20:47:16 2016 +0100

    convert line style to .ui format
    
    andd...
    
    1) adjust the UserDraw so the units are not truncated
    2) fix focus so keyboard works inside the popup
    3) merge CellLineStylePopup and CellLineStyleControl
    
    Change-Id: I51f05dd990c0a35b5b7515876362d3fbd908167f

diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index d05aa66..41555ec 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -125,6 +125,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
 	sc/uiconfig/scalc/ui/footerdialog \
 	sc/uiconfig/scalc/ui/formatcellsdialog \
 	sc/uiconfig/scalc/ui/formulacalculationoptions \
+	sc/uiconfig/scalc/ui/floatinglinestyle \
 	sc/uiconfig/scalc/ui/goalseekdlg \
 	sc/uiconfig/scalc/ui/groupdialog \
 	sc/uiconfig/scalc/ui/groupbydate \
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index b2fedca..048111c 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -1089,7 +1089,6 @@
 #define RID_SCDLG_COND_FORMAT_MANAGER   (SC_DIALOGS_START + 159)
 
 // defines for CellAppearancePropertyPanel
-#define RID_POPUPPANEL_APPEARANCE_CELL_LINESTYLE (SC_DIALOGS_START + 162)
 #define RID_POPUPPANEL_APPEARANCE_CELL_BORDERSTYLE (SC_DIALOGS_START + 163)
 
 #define WID_CONDFRMT_REF                (SC_DIALOGS_START + 164)
diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
index 84c0742..0915add 100644
--- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
+++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
@@ -171,10 +171,9 @@ IMPL_LINK(CellAppearancePropertyPanel, TbxLineStyleSelectHdl, ToolBox*, pToolBox
     if (aCommand == UNO_LINESTYLE)
     {
         if (!mxCellLineStylePopup)
-            mxCellLineStylePopup = VclPtr<CellLineStylePopup>::Create(pToolBox, GetBindings()->GetDispatcher());
+            mxCellLineStylePopup = VclPtr<CellLineStylePopup>::Create(GetBindings()->GetDispatcher());
         mxCellLineStylePopup->SetLineStyleSelect(mnOut, mnIn, mnDis);
-        mxCellLineStylePopup->StartPopupMode(pToolBox, FloatWinPopupFlags::Down |
-                                                       FloatWinPopupFlags::NoAppFocusClose);
+        mxCellLineStylePopup->StartPopupMode(pToolBox, FloatWinPopupFlags::GrabFocus);
     }
 }
 
diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hrc b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hrc
index 439bb58..aece513 100644
--- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hrc
+++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hrc
@@ -17,10 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-//line style page
-#define VS_STYLE        1
-#define PB_OPTIONS      2
-
 //line border page
 #define TB_BORDER1              1
 #define TB_BORDER2              2
diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
index d7d36ec..612a059 100644
--- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
+++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
@@ -24,12 +24,10 @@
 #include <svx/sidebar/PanelLayout.hxx>
 #include <vcl/floatwin.hxx>
 #include "CellBorderStyleControl.hxx"
-#include "CellLineStyleControl.hxx"
 #include <memory>
 
 class FixedText;
 namespace sc { namespace sidebar {
-    class CellLineStyleControl;
     class CellBorderUpdater;
 }}
 class ToolBox;
@@ -58,30 +56,7 @@ public:
     }
 };
 
-class CellLineStylePopup : public FloatingWindow
-{
-    VclPtr<CellLineStyleControl> m_xControl;
-public:
-    CellLineStylePopup(vcl::Window* pParent, SfxDispatcher* pDispatcher)
-        : FloatingWindow(pParent, WB_BORDER | WB_SYSTEMWINDOW)
-        , m_xControl(VclPtr<CellLineStyleControl>::Create(this, pDispatcher))
-    {
-        SetSizePixel(m_xControl->GetOutputSizePixel());
-    }
-    void SetLineStyleSelect(sal_uInt16 out, sal_uInt16 in, sal_uInt16 dis)
-    {
-        m_xControl->SetLineStyleSelect(out, in, dis);
-    }
-    virtual ~CellLineStylePopup() override
-    {
-        disposeOnce();
-    }
-    virtual void dispose() override
-    {
-        m_xControl.disposeAndClear();
-        FloatingWindow::dispose();
-    }
-};
+class CellLineStylePopup;
 
 class CellAppearancePropertyPanel
 :   public PanelLayout,
@@ -89,7 +64,7 @@ class CellAppearancePropertyPanel
     public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
 {
 private:
-    friend class CellLineStyleControl;
+    friend class CellLineStylePopup;
     friend class CellBorderStyleControl;
 
 public:
diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.src b/sc/source/ui/sidebar/CellAppearancePropertyPanel.src
index 6361999..7682c1a 100644
--- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.src
+++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.src
@@ -65,35 +65,6 @@ Image IMG_LINE_STYLE9
     ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_750.png";};
 };
 
-// cell line style popup
-
-Control RID_POPUPPANEL_APPEARANCE_CELL_LINESTYLE
-{
-    OutputSize = TRUE;
-    DialogControl = TRUE;
-    Border = FALSE;
-
-    Size = MAP_APPFONT(
-        POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + 80,
-        13 + POPUP_BORDER_HEIGHT + POPUPPANEL_MARGIN_SMALL * 2 + POPUPPANEL_MARGIN_LARGE + 12*9);
-
-    Control VS_STYLE
-    {
-        Hide = TRUE ;
-        Pos = MAP_APPFONT(  POPUPPANEL_MARGIN_SMALL + OFFSET_X , POPUPPANEL_MARGIN_SMALL + OFFSET_Y );
-        Size = MAP_APPFONT ( 80  , 12 * 9);
-        TabStop = TRUE ;
-        Text [ en-US ] = "Line Style";
-    };
-    PushButton PB_OPTIONS
-    {
-        Pos = MAP_APPFONT (  POPUPPANEL_MARGIN_LARGE + OFFSET_X , POPUPPANEL_MARGIN_SMALL * 2 + OFFSET_Y + 12 * 9);
-        Size = MAP_APPFONT ( 75 , 12 );
-        TabStop = TRUE;
-        Text [ en-US ] = "~More Options...";
-    };
-};
-
 // cell border style popup
 
 Control RID_POPUPPANEL_APPEARANCE_CELL_BORDERSTYLE
diff --git a/sc/source/ui/sidebar/CellLineStyleControl.cxx b/sc/source/ui/sidebar/CellLineStyleControl.cxx
index e9e68a3..7f49749 100644
--- a/sc/source/ui/sidebar/CellLineStyleControl.cxx
+++ b/sc/source/ui/sidebar/CellLineStyleControl.cxx
@@ -33,35 +33,30 @@
 
 namespace sc { namespace sidebar {
 
-CellLineStyleControl::CellLineStyleControl(FloatingWindow* pParent, SfxDispatcher* pDispatcher)
-:   Control(pParent, ScResId(RID_POPUPPANEL_APPEARANCE_CELL_LINESTYLE)),
-    mpDispatcher(pDispatcher),
-    mxFloatParent(pParent),
-    maPushButtonMoreOptions(VclPtr<PushButton>::Create(this, ScResId(PB_OPTIONS))),
-    maCellLineStyleValueSet(VclPtr<sc::sidebar::CellLineStyleValueSet>::Create(this, ScResId(VS_STYLE))),
-    mbVSfocus(true)
+CellLineStylePopup::CellLineStylePopup(SfxDispatcher* pDispatcher)
+    : FloatingWindow(SfxGetpApp()->GetTopWindow(), "FloatingLineStyle", "modules/scalc/ui/floatinglinestyle.ui")
+    , mpDispatcher(pDispatcher)
+    , maCellLineStyleValueSet(VclPtr<sc::sidebar::CellLineStyleValueSet>::Create(get<vcl::Window>("box")))
 {
+    get(maPushButtonMoreOptions, "more");
     Initialize();
-    FreeResource();
 }
 
-CellLineStyleControl::~CellLineStyleControl()
+CellLineStylePopup::~CellLineStylePopup()
 {
     disposeOnce();
 }
 
-void CellLineStyleControl::dispose()
+void CellLineStylePopup::dispose()
 {
-    maPushButtonMoreOptions.disposeAndClear();
+    maPushButtonMoreOptions.clear();
     maCellLineStyleValueSet.disposeAndClear();
-    mxFloatParent.clear();
-    Control::dispose();
+    FloatingWindow::dispose();
 }
 
-void CellLineStyleControl::Initialize()
+void CellLineStylePopup::Initialize()
 {
-    //maPushButtonMoreOptions->SetIcoPosX(2);
-    Link<Button*,void> aLink = LINK(this, CellLineStyleControl, PBClickHdl);
+    Link<Button*,void> aLink = LINK(this, CellLineStylePopup, PBClickHdl);
     maPushButtonMoreOptions->SetClickHdl(aLink);
 
     maCellLineStyleValueSet->SetStyle(maCellLineStyleValueSet->GetStyle()| WB_3DLOOK |  WB_NO_DIRECTSELECT);
@@ -90,20 +85,12 @@ void CellLineStyleControl::Initialize()
     }
 
     SetAllNoSel();
-    maCellLineStyleValueSet->SetSelectHdl(LINK(this, CellLineStyleControl, VSSelectHdl));
+    maCellLineStyleValueSet->SetSelectHdl(LINK(this, CellLineStylePopup, VSSelectHdl));
     maCellLineStyleValueSet->StartSelection();
     maCellLineStyleValueSet->Show();
 }
 
-void CellLineStyleControl::GetFocus()
-{
-    if (!mbVSfocus && maPushButtonMoreOptions)
-        maPushButtonMoreOptions->GrabFocus();
-    else if (maCellLineStyleValueSet)
-        maCellLineStyleValueSet->GrabFocus();
-}
-
-void CellLineStyleControl::SetAllNoSel()
+void CellLineStylePopup::SetAllNoSel()
 {
     maCellLineStyleValueSet->SelectItem(0);
     maCellLineStyleValueSet->SetNoSelection();
@@ -113,7 +100,7 @@ void CellLineStyleControl::SetAllNoSel()
     maCellLineStyleValueSet->StartSelection();
 }
 
-IMPL_LINK(CellLineStyleControl, VSSelectHdl, ValueSet*, pControl, void)
+IMPL_LINK(CellLineStylePopup, VSSelectHdl, ValueSet*, pControl, void)
 {
     if(pControl == maCellLineStyleValueSet.get())
     {
@@ -181,23 +168,23 @@ IMPL_LINK(CellLineStyleControl, VSSelectHdl, ValueSet*, pControl, void)
         mpDispatcher->ExecuteList(
             SID_FRAME_LINESTYLE, SfxCallMode::RECORD, { &aLineItem });
         SetAllNoSel();
-        mxFloatParent->EndPopupMode();
+        EndPopupMode();
     }
 }
 
-IMPL_LINK(CellLineStyleControl, PBClickHdl, Button *, pPBtn, void)
+IMPL_LINK(CellLineStylePopup, PBClickHdl, Button *, pPBtn, void)
 {
     if (pPBtn == maPushButtonMoreOptions.get())
     {
         mpDispatcher->Execute(SID_CELL_FORMAT_BORDER, SfxCallMode::ASYNCHRON);
-        mxFloatParent->EndPopupMode();
+        EndPopupMode();
     }
 }
 
-void CellLineStyleControl::SetLineStyleSelect(sal_uInt16 out, sal_uInt16 in, sal_uInt16 dis)
+void CellLineStylePopup::SetLineStyleSelect(sal_uInt16 out, sal_uInt16 in, sal_uInt16 dis)
 {
+    maCellLineStyleValueSet->GrabFocus();
     SetAllNoSel();
-    mbVSfocus = true;
 
     //FIXME: fully for new border line possibilities
 
@@ -240,7 +227,7 @@ void CellLineStyleControl::SetLineStyleSelect(sal_uInt16 out, sal_uInt16 in, sal
     else
     {
         maCellLineStyleValueSet->SetSelItem(0);
-        mbVSfocus = false;
+        maPushButtonMoreOptions->GrabFocus();
     }
     maCellLineStyleValueSet->SetFormat();
     maCellLineStyleValueSet->Invalidate();
diff --git a/sc/source/ui/sidebar/CellLineStyleControl.hxx b/sc/source/ui/sidebar/CellLineStyleControl.hxx
index 9354849..ea5f090 100644
--- a/sc/source/ui/sidebar/CellLineStyleControl.hxx
+++ b/sc/source/ui/sidebar/CellLineStyleControl.hxx
@@ -20,6 +20,7 @@
 #define INCLUDED_SC_SOURCE_UI_SIDEBAR_CELLLINESTYLECONTROL_HXX
 
 #include <vcl/button.hxx>
+#include <vcl/floatwin.hxx>
 #include "CellLineStyleValueSet.hxx"
 
 class SfxDispatcher;
@@ -27,30 +28,26 @@ class SfxDispatcher;
 namespace sc { namespace sidebar {
 
 class CellAppearancePropertyPanel;
-class CellLineStyleControl : public Control
+
+class CellLineStylePopup : public FloatingWindow
 {
-private:
     SfxDispatcher*                     mpDispatcher;
-    VclPtr<FloatingWindow>             mxFloatParent;
     VclPtr<PushButton>                 maPushButtonMoreOptions;
     VclPtr<CellLineStyleValueSet>      maCellLineStyleValueSet;
     OUString                           maStr[CELL_LINE_STYLE_ENTRIES];
 
-    bool                               mbVSfocus : 1;
-
     void Initialize();
     void SetAllNoSel();
 
     DECL_LINK(VSSelectHdl, ValueSet*, void);
     DECL_LINK(PBClickHdl, Button*, void);
 
-public:
-    CellLineStyleControl(FloatingWindow* pParent, SfxDispatcher* pDispatcher);
-    virtual ~CellLineStyleControl() override;
-    virtual void dispose() override;
 
-    void GetFocus() override;
+public:
+    CellLineStylePopup(SfxDispatcher* pDispatcher);
     void SetLineStyleSelect(sal_uInt16 out, sal_uInt16 in, sal_uInt16 dis);
+    virtual ~CellLineStylePopup() override;
+    virtual void dispose() override;
 };
 
 } } // end of namespace svx::sidebar
diff --git a/sc/source/ui/sidebar/CellLineStyleValueSet.cxx b/sc/source/ui/sidebar/CellLineStyleValueSet.cxx
index ec05c91..9c3d25a 100644
--- a/sc/source/ui/sidebar/CellLineStyleValueSet.cxx
+++ b/sc/source/ui/sidebar/CellLineStyleValueSet.cxx
@@ -23,10 +23,10 @@
 
 namespace sc { namespace sidebar {
 
-CellLineStyleValueSet::CellLineStyleValueSet( vcl::Window* pParent, const ResId& rResId)
-:   ValueSet( pParent, rResId ),
-    pVDev(nullptr),
-    nSelItem(0)
+CellLineStyleValueSet::CellLineStyleValueSet(vcl::Window* pParent)
+    : ValueSet(pParent, WB_TABSTOP)
+    , pVDev(nullptr)
+    , nSelItem(0)
 {
     SetColCount();
     SetLineCount( 9);
@@ -43,6 +43,11 @@ void CellLineStyleValueSet::dispose()
     ValueSet::dispose();
 }
 
+Size CellLineStyleValueSet::GetOptimalSize() const
+{
+    return LogicToPixel(Size(80, 12 * 9), MAP_APPFONT);
+}
+
 void CellLineStyleValueSet::SetUnit(const OUString* str)
 {
     for (int i = 0; i < CELL_LINE_STYLE_ENTRIES; ++i)
@@ -85,9 +90,6 @@ void CellLineStyleValueSet::UserDraw( const UserDrawEvent& rUDEvt )
     aSize.Height() = nRectHeight*3/5;
     aFont.SetFontSize( aSize );
 
-    long  nTLX = aBLPos.X() + 5,  nTLY = aBLPos.Y() + ( nRectHeight - nItemId )/2;
-    long  nTRX = aBLPos.X() + nRectWidth * 7 / 9 - 15, nTRY = aBLPos.Y() + ( nRectHeight - nItemId )/2;
-
     if( nSelItem ==  nItemId )
     {
         Color aBackColor(50,107,197);
@@ -104,13 +106,16 @@ void CellLineStyleValueSet::UserDraw( const UserDrawEvent& rUDEvt )
     }
 
     //draw text
-    if(nSelItem ==  nItemId )
+    if (nSelItem ==  nItemId )
         aFont.SetColor(COL_WHITE);
     else
         aFont.SetColor(GetSettings().GetStyleSettings().GetFieldTextColor()); //high contrast
 
     pDev->SetFont(aFont);
-    Point aStart(aBLPos.X() + nRectWidth * 7 / 9 - 5 , aBLPos.Y() + nRectHeight/6);
+    long nTextWidth = pDev->GetTextWidth(maStrUnit[nItemId - 1]);
+    long nTLX = aBLPos.X() + 5,  nTLY = aBLPos.Y() + ( nRectHeight - nItemId )/2;
+    long nTRX = aBLPos.X() + nRectWidth - nTextWidth - 15, nTRY = aBLPos.Y() + ( nRectHeight - nItemId )/2;
+    Point aStart(aBLPos.X() + nRectWidth - nTextWidth - 5 , aBLPos.Y() + nRectHeight/6);
     pDev->DrawText(aStart, maStrUnit[nItemId - 1]); //can't set DrawTextFlags::EndEllipsis here, or the text will disappear
 
     //draw line
diff --git a/sc/source/ui/sidebar/CellLineStyleValueSet.hxx b/sc/source/ui/sidebar/CellLineStyleValueSet.hxx
index 6ab6e75..3e87b31 100644
--- a/sc/source/ui/sidebar/CellLineStyleValueSet.hxx
+++ b/sc/source/ui/sidebar/CellLineStyleValueSet.hxx
@@ -33,12 +33,13 @@ private:
     sal_uInt16      nSelItem;
     OUString        maStrUnit[CELL_LINE_STYLE_ENTRIES];
 public:
-    CellLineStyleValueSet( vcl::Window* pParent, const ResId& rResId);
+    CellLineStyleValueSet(vcl::Window* pParent);
     virtual ~CellLineStyleValueSet() override;
     virtual void dispose() override;
 
     void SetUnit(const OUString* str);
     void SetSelItem(sal_uInt16 nSel);
+    virtual Size GetOptimalSize() const override;
     virtual void UserDraw( const UserDrawEvent& rUDEvt ) override;
 };
 
diff --git a/sc/uiconfig/scalc/ui/floatinglinestyle.ui b/sc/uiconfig/scalc/ui/floatinglinestyle.ui
new file mode 100644
index 0000000..a85c56a
--- /dev/null
+++ b/sc/uiconfig/scalc/ui/floatinglinestyle.ui
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.0 -->
+<interface>
+  <requires lib="gtk+" version="3.0"/>
+  <object class="GtkWindow" id="FloatingLineStyle">
+    <property name="can_focus">False</property>
+    <property name="hexpand">True</property>
+    <property name="vexpand">True</property>
+    <property name="border_width">4</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">
+        <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>
+          <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="GtkButton" id="more">
+            <property name="label" translatable="yes">_More Options...</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="use_underline">True</property>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>


More information about the Libreoffice-commits mailing list