[Libreoffice-commits] core.git: cui/source include/svx svx/source sw/source sw/uiconfig

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Jan 1 21:30:41 UTC 2020


 cui/source/tabpages/page.cxx                 |   13 -
 include/svx/dlgctrl.hxx                      |    5 
 include/svx/itemwin.hxx                      |    4 
 include/svx/pagenumberlistbox.hxx            |    5 
 svx/source/dialog/dlgctrl.cxx                |   16 ++
 svx/source/tbxctrls/itemwin.cxx              |   76 ++++++++++
 sw/source/uibase/sidebar/PageStylesPanel.cxx |  194 +++++++++++++--------------
 sw/source/uibase/sidebar/PageStylesPanel.hxx |   32 ++--
 sw/uiconfig/swriter/ui/pagestylespanel.ui    |  164 ++++++++++++----------
 9 files changed, 312 insertions(+), 197 deletions(-)

New commits:
commit 4a0d34fc4ec875d14d09156f7b4b3a51fb2f5e30
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Jan 1 17:28:23 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Jan 1 22:30:10 2020 +0100

    weld PageStylesPanel
    
    Change-Id: I8e6842a342b242eeaa6d7a27e268dbe5691a9703
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86081
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx
index c2592f0d944b..8cecd26a51c5 100644
--- a/cui/source/tabpages/page.cxx
+++ b/cui/source/tabpages/page.cxx
@@ -370,15 +370,7 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet )
     LayoutHdl_Impl( *m_xLayoutBox );
 
     //adjust numeration type of the page style
-    //Get the Position of the saved NumType
-    for (int i=0; i < m_xNumberFormatBox->get_count(); ++i)
-    {
-        if (eNumType == m_xNumberFormatBox->get_id(i).toInt32())
-        {
-            m_xNumberFormatBox->set_active(i);
-            break;
-        }
-    }
+    m_xNumberFormatBox->set_active_id(eNumType);
 
     m_xPaperTrayBox->clear();
     sal_uInt8 nPaperBin = PAPERBIN_PRINTER_SETTINGS;
@@ -689,10 +681,9 @@ bool SvxPageDescPage::FillItemSet( SfxItemSet* rSet )
     }
 
     //Get the NumType value
-    nPos = m_xNumberFormatBox->get_active();
-    SvxNumType nEntryData = static_cast<SvxNumType>(m_xNumberFormatBox->get_id(nPos).toInt32());
     if (m_xNumberFormatBox->get_value_changed_from_saved())
     {
+        SvxNumType nEntryData = m_xNumberFormatBox->get_active_id();
         aPage.SetNumType( nEntryData );
         bMod = true;
     }
diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx
index e68f881f8bce..eb7f19c79f91 100644
--- a/include/svx/dlgctrl.hxx
+++ b/include/svx/dlgctrl.hxx
@@ -215,11 +215,12 @@ public:
 
 class SAL_WARN_UNUSED SVX_DLLPUBLIC FillTypeLB : public ListBox
 {
-
 public:
-         FillTypeLB( vcl::Window* pParent, WinBits aWB ) : ListBox( pParent, aWB ) {}
+    FillTypeLB( vcl::Window* pParent, WinBits aWB ) : ListBox( pParent, aWB ) {}
 
     void Fill();
+
+    static void Fill(weld::ComboBox& rListBox);
 };
 
 /************************************************************************/
diff --git a/include/svx/itemwin.hxx b/include/svx/itemwin.hxx
index 13a63557f147..4f4c3ec140a0 100644
--- a/include/svx/itemwin.hxx
+++ b/include/svx/itemwin.hxx
@@ -112,6 +112,10 @@ public:
     void Fill( const XBitmapListRef   &pList );
     void Fill( const XPatternListRef  &pList );
 
+    static void Fill(weld::ComboBox&, const XHatchListRef &pList);
+    static void Fill(weld::ComboBox&, const XBitmapListRef &pList);
+    static void Fill(weld::ComboBox&, const XPatternListRef &pList);
+
 private:
     virtual bool    PreNotify( NotifyEvent& rNEvt ) override;
     virtual bool    EventNotify( NotifyEvent& rNEvt ) override;
diff --git a/include/svx/pagenumberlistbox.hxx b/include/svx/pagenumberlistbox.hxx
index 16307c03e0a9..e416fcb8d507 100644
--- a/include/svx/pagenumberlistbox.hxx
+++ b/include/svx/pagenumberlistbox.hxx
@@ -20,6 +20,7 @@
 #ifndef INCLUDED_SVX_PAGENUMBERINGHELPER_HXX
 #define INCLUDED_SVX_PAGENUMBERINGHELPER_HXX
 
+#include <editeng/svxenum.hxx>
 #include <svx/svxdllapi.h>
 #include <vcl/lstbox.hxx>
 #include <vcl/weld.hxx>
@@ -41,11 +42,13 @@ private:
 public:
     SvxPageNumberListBox(std::unique_ptr<weld::ComboBox> pControl);
     int get_count() const { return m_xControl->get_count(); }
-    OUString get_id(int pos) const { return m_xControl->get_id(pos); }
+    SvxNumType get_active_id() const { return static_cast<SvxNumType>(m_xControl->get_active_id().toInt32()); }
+    void set_active_id(SvxNumType eId) const { m_xControl->set_active_id(OUString::number(static_cast<sal_Int32>(eId))); }
     int get_active() const { return m_xControl->get_active(); }
     void set_active(int pos) { m_xControl->set_active(pos); }
     void save_value() { m_xControl->save_value(); }
     bool get_value_changed_from_saved() const { return m_xControl->get_value_changed_from_saved(); }
+    void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_xControl->connect_changed(rLink); }
     weld::ComboBox& get_widget() const { return *m_xControl; }
 };
 
diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx
index 7a9b7186a257..cb79d09cd6d2 100644
--- a/svx/source/dialog/dlgctrl.cxx
+++ b/svx/source/dialog/dlgctrl.cxx
@@ -915,6 +915,22 @@ void FillTypeLB::Fill()
     SetUpdateMode( true );
 }
 
+void FillTypeLB::Fill(weld::ComboBox& rListBox)
+{
+    rListBox.freeze();
+
+    rListBox.append_text(SvxResId(RID_SVXSTR_INVISIBLE));
+    rListBox.append_text(SvxResId(RID_SVXSTR_COLOR));
+    rListBox.append_text(SvxResId(RID_SVXSTR_GRADIENT));
+    rListBox.append_text(SvxResId(RID_SVXSTR_HATCH));
+    rListBox.append_text(SvxResId(RID_SVXSTR_BITMAP));
+    rListBox.append_text(SvxResId(RID_SVXSTR_PATTERN));
+
+    rListBox.thaw();
+
+    rListBox.set_active(1); // solid color
+}
+
 SvxLineLB::SvxLineLB(std::unique_ptr<weld::ComboBox> pControl)
     : m_xControl(std::move(pControl))
     , mbAddStandardFields(true)
diff --git a/svx/source/tbxctrls/itemwin.cxx b/svx/source/tbxctrls/itemwin.cxx
index b986842765a4..f879c0a84313 100644
--- a/svx/source/tbxctrls/itemwin.cxx
+++ b/svx/source/tbxctrls/itemwin.cxx
@@ -705,4 +705,80 @@ void SvxFillAttrBox::Fill( const XPatternListRef &pList )
     ListBox::SetUpdateMode(true);
 }
 
+void SvxFillAttrBox::Fill(weld::ComboBox& rBox, const XHatchListRef &pList)
+{
+    if( !pList.is() )
+        return;
+
+    long nCount = pList->Count();
+    ScopedVclPtrInstance< VirtualDevice > pVD;
+    rBox.freeze();
+
+    for( long i = 0; i < nCount; i++ )
+    {
+        const XHatchEntry* pEntry = pList->GetHatch(i);
+        const BitmapEx aBitmapEx = pList->GetUiBitmap( i );
+        if( !aBitmapEx.IsEmpty() )
+        {
+            const Size aBmpSize(aBitmapEx.GetSizePixel());
+            pVD->SetOutputSizePixel(aBmpSize, false);
+            pVD->DrawBitmapEx(Point(), aBitmapEx);
+            rBox.append("", pEntry->GetName(), *pVD);
+        }
+        else
+            rBox.append_text(pEntry->GetName());
+    }
+
+    rBox.thaw();
+}
+
+void SvxFillAttrBox::Fill(weld::ComboBox& rBox, const XBitmapListRef &pList)
+{
+    if( !pList.is() )
+        return;
+
+    long nCount = pList->Count();
+    const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+    const Size aSize(rStyleSettings.GetListBoxPreviewDefaultPixelSize());
+    ScopedVclPtrInstance< VirtualDevice > pVD;
+    pVD->SetOutputSizePixel(aSize, false);
+    rBox.freeze();
+
+    for( long i = 0; i < nCount; i++ )
+    {
+        const XBitmapEntry* pEntry = pList->GetBitmap( i );
+        BitmapEx aBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx();
+        formatBitmapExToSize(aBitmapEx, aSize);
+        pVD->DrawBitmapEx(Point(), aBitmapEx);
+        rBox.append("", pEntry->GetName(), *pVD);
+    }
+
+    rBox.thaw();
+}
+
+void SvxFillAttrBox::Fill(weld::ComboBox& rBox, const XPatternListRef &pList)
+{
+    if( !pList.is() )
+        return;
+
+    long nCount = pList->Count();
+    const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+    const Size aSize(rStyleSettings.GetListBoxPreviewDefaultPixelSize());
+    ScopedVclPtrInstance< VirtualDevice > pVD;
+    pVD->SetOutputSizePixel(aSize, false);
+    rBox.freeze();
+
+    for( long i = 0; i < nCount; i++ )
+    {
+        const XBitmapEntry* pEntry = pList->GetBitmap( i );
+        BitmapEx aBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx();
+        formatBitmapExToSize(aBitmapEx, aSize);
+        pVD->DrawBitmapEx(Point(), aBitmapEx);
+        rBox.append("", pEntry->GetName(), *pVD);
+    }
+
+    rBox.thaw();
+
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/sidebar/PageStylesPanel.cxx b/sw/source/uibase/sidebar/PageStylesPanel.cxx
index 70595db3eb37..dfb4bf41099f 100644
--- a/sw/source/uibase/sidebar/PageStylesPanel.cxx
+++ b/sw/source/uibase/sidebar/PageStylesPanel.cxx
@@ -103,7 +103,7 @@ PageStylesPanel::PageStylesPanel(
     const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame,
     SfxBindings* pBindings
     ) :
-    PanelLayout(pParent, "PageStylesPanel", "modules/swriter/ui/pagestylespanel.ui", rxFrame),
+    PanelLayout(pParent, "PageStylesPanel", "modules/swriter/ui/pagestylespanel.ui", rxFrame, true),
     mpBindings( pBindings ),
     mpPageColumnItem( new SfxInt16Item(SID_ATTR_PAGE_COLUMN) ),
     mpPageItem( new SvxPageItem(SID_ATTR_PAGE) ),
@@ -114,18 +114,17 @@ PageStylesPanel::PageStylesPanel(
     maBgGradientControl( SID_ATTR_PAGE_GRADIENT, *pBindings, *this ),
     maBgBitmapControl( SID_ATTR_PAGE_BITMAP, *pBindings, *this ),
     maBgFillStyleControl(SID_ATTR_PAGE_FILLSTYLE, *pBindings, *this),
+    mxBgColorLB(new ColorListBox(m_xBuilder->weld_menu_button("lbcolor"), GetFrameWeld())),
+    mxBgHatchingLB(m_xBuilder->weld_combo_box("lbhatching")),
+    mxBgGradientLB(new ColorListBox(m_xBuilder->weld_menu_button("lbgradient"), GetFrameWeld())),
+    mxBgBitmapLB(m_xBuilder->weld_combo_box("lbbitmap")),
+    mxLayoutSelectLB(m_xBuilder->weld_combo_box("layoutbox")),
+    mxColumnCount(m_xBuilder->weld_combo_box("columnbox")),
+    mxNumberSelectLB(new SvxPageNumberListBox(m_xBuilder->weld_combo_box("numberbox"))),
+    mxBgFillType(m_xBuilder->weld_combo_box("bgselect")),
+    mxCustomEntry(m_xBuilder->weld_label("customlabel")),
     aCustomEntry()
 {
-    get(mpColumnCount, "columnbox");
-    get(mpNumberSelectLB, "numberbox");
-    get(mpBgFillType, "bgselect");
-    get(mpBgColorLB, "lbcolor");
-    get(mpBgHatchingLB, "lbhatching");
-    get(mpBgGradientLB, "lbgradient");
-    get(mpBgBitmapLB, "lbbitmap");
-    get(mpLayoutSelectLB, "layoutbox");
-    get(mpCustomEntry, "customlabel");
-
     Initialize();
 }
 
@@ -136,14 +135,15 @@ PageStylesPanel::~PageStylesPanel()
 
 void PageStylesPanel::dispose()
 {
-    mpColumnCount.disposeAndClear();
-    mpNumberSelectLB.disposeAndClear();
-    mpBgFillType.disposeAndClear();
-    mpBgColorLB.disposeAndClear();
-    mpBgHatchingLB.disposeAndClear();
-    mpBgGradientLB.disposeAndClear();
-    mpBgBitmapLB.disposeAndClear();
-    mpLayoutSelectLB.disposeAndClear();
+    mxColumnCount.reset();
+    mxNumberSelectLB.reset();
+    mxBgFillType.reset();
+    mxBgColorLB.reset();
+    mxBgHatchingLB.reset();
+    mxBgGradientLB.reset();
+    mxBgBitmapLB.reset();
+    mxLayoutSelectLB.reset();
+    mxCustomEntry.reset();
 
     maBgBitmapControl.dispose();
     maBgColorControl.dispose();
@@ -152,104 +152,105 @@ void PageStylesPanel::dispose()
     maBgHatchingControl.dispose();
     maPageColumnControl.dispose();
     maPageNumFormatControl.dispose();
-    mpCustomEntry.clear();
     PanelLayout::dispose();
 }
 
 void PageStylesPanel::Initialize()
 {
-    aCustomEntry = mpCustomEntry->GetText();
+    FillTypeLB::Fill(*mxBgFillType);
+
+    aCustomEntry = mxCustomEntry->get_label();
     mpBindings->Invalidate(SID_ATTR_PAGE_COLUMN);
     mpBindings->Invalidate(SID_ATTR_PAGE);
     mpBindings->Invalidate(SID_ATTR_PAGE_FILLSTYLE);
     Update();
 
-    mpColumnCount->SetSelectHdl( LINK(this, PageStylesPanel, ModifyColumnCountHdl) );
-    SvxNumOptionsTabPageHelper::GetI18nNumbering( *mpNumberSelectLB, ::std::numeric_limits<sal_uInt16>::max());
-    mpNumberSelectLB->SetSelectHdl( LINK(this, PageStylesPanel, ModifyNumberingHdl) );
-    mpLayoutSelectLB->SetSelectHdl( LINK(this, PageStylesPanel, ModifyLayoutHdl) );
-    mpBgFillType->SetSelectHdl( LINK(this, PageStylesPanel, ModifyFillStyleHdl));
-    mpBgColorLB->SetSelectHdl( LINK(this, PageStylesPanel, ModifyFillColorListHdl));
-    mpBgGradientLB->SetSelectHdl( LINK(this, PageStylesPanel, ModifyFillColorListHdl));
-    mpBgHatchingLB->SetSelectHdl( LINK(this, PageStylesPanel, ModifyFillColorHdl));
-    mpBgBitmapLB->SetSelectHdl( LINK(this, PageStylesPanel, ModifyFillColorHdl));
+    mxColumnCount->connect_changed( LINK(this, PageStylesPanel, ModifyColumnCountHdl) );
+    SvxNumOptionsTabPageHelper::GetI18nNumbering(mxNumberSelectLB->get_widget(), ::std::numeric_limits<sal_uInt16>::max());
+    mxNumberSelectLB->connect_changed( LINK(this, PageStylesPanel, ModifyNumberingHdl) );
+    mxLayoutSelectLB->connect_changed( LINK(this, PageStylesPanel, ModifyLayoutHdl) );
+    mxBgFillType->connect_changed( LINK(this, PageStylesPanel, ModifyFillStyleHdl));
+    mxBgColorLB->SetSelectHdl( LINK(this, PageStylesPanel, ModifyFillColorListHdl));
+    mxBgGradientLB->SetSelectHdl( LINK(this, PageStylesPanel, ModifyFillColorListHdl));
+    mxBgHatchingLB->connect_changed( LINK(this, PageStylesPanel, ModifyFillColorHdl));
+    mxBgBitmapLB->connect_changed( LINK(this, PageStylesPanel, ModifyFillColorHdl));
 }
 
 void PageStylesPanel::Update()
 {
-    const eFillStyle eXFS = static_cast<eFillStyle>(mpBgFillType->GetSelectedEntryPos());
+    const eFillStyle eXFS = static_cast<eFillStyle>(mxBgFillType->get_active());
     SfxObjectShell* pSh = SfxObjectShell::Current();
     switch(eXFS)
     {
         case NONE:
         {
-            mpBgColorLB->Hide();
-            mpBgHatchingLB->Hide();
-            mpBgGradientLB->Hide();
-            mpBgBitmapLB->Hide();
+            mxBgColorLB->hide();
+            mxBgHatchingLB->hide();
+            mxBgGradientLB->hide();
+            mxBgBitmapLB->hide();
         }
         break;
         case SOLID:
         {
-            mpBgBitmapLB->Hide();
-            mpBgGradientLB->Hide();
-            mpBgHatchingLB->Hide();
-            mpBgColorLB->Show();
+            mxBgBitmapLB->hide();
+            mxBgGradientLB->hide();
+            mxBgHatchingLB->hide();
+            mxBgColorLB->show();
             const Color aColor = GetColorSetOrDefault();
-            mpBgColorLB->SelectEntry(aColor);
+            mxBgColorLB->SelectEntry(aColor);
         }
         break;
         case GRADIENT:
         {
-            mpBgBitmapLB->Hide();
-            mpBgHatchingLB->Hide();
-            mpBgColorLB->Show();
-            mpBgGradientLB->Show();
+            mxBgBitmapLB->hide();
+            mxBgHatchingLB->hide();
+            mxBgColorLB->show();
+            mxBgGradientLB->show();
 
             const XGradient xGradient = GetGradientSetOrDefault();
             const Color aStartColor = xGradient.GetStartColor();
-            mpBgColorLB->SelectEntry(aStartColor);
+            mxBgColorLB->SelectEntry(aStartColor);
             const Color aEndColor = xGradient.GetEndColor();
-            mpBgGradientLB->SelectEntry(aEndColor);
+            mxBgGradientLB->SelectEntry(aEndColor);
         }
         break;
 
         case HATCH:
         {
-            mpBgColorLB->Hide();
-            mpBgGradientLB->Hide();
-            mpBgBitmapLB->Hide();
-            mpBgHatchingLB->Show();
-            mpBgHatchingLB->Clear();
-            mpBgHatchingLB->Fill(pSh->GetItem(SID_HATCH_LIST)->GetHatchList());
+            mxBgColorLB->hide();
+            mxBgGradientLB->hide();
+            mxBgBitmapLB->hide();
+            mxBgHatchingLB->show();
+            mxBgHatchingLB->clear();
+            SvxFillAttrBox::Fill(*mxBgHatchingLB, pSh->GetItem(SID_HATCH_LIST)->GetHatchList());
 
             const OUString aHatchName = GetHatchingSetOrDefault();
-            mpBgHatchingLB->SelectEntry( aHatchName );
+            mxBgHatchingLB->set_active_text( aHatchName );
         }
         break;
 
         case BITMAP:
         case PATTERN:
         {
-            mpBgColorLB->Hide();
-            mpBgGradientLB->Hide();
-            mpBgHatchingLB->Hide();
-            mpBgBitmapLB->Show();
-            mpBgBitmapLB->Clear();
+            mxBgColorLB->hide();
+            mxBgGradientLB->hide();
+            mxBgHatchingLB->hide();
+            mxBgBitmapLB->show();
+            mxBgBitmapLB->clear();
             OUString aBitmapName;
 
             if( eXFS == BITMAP )
             {
-                mpBgBitmapLB->Fill(pSh->GetItem(SID_BITMAP_LIST)->GetBitmapList());
+                SvxFillAttrBox::Fill(*mxBgBitmapLB, pSh->GetItem(SID_BITMAP_LIST)->GetBitmapList());
                 aBitmapName = GetBitmapSetOrDefault();
             }
             else
             {
-                mpBgBitmapLB->Fill(pSh->GetItem(SID_PATTERN_LIST)->GetPatternList());
+                SvxFillAttrBox::Fill(*mxBgBitmapLB, pSh->GetItem(SID_PATTERN_LIST)->GetPatternList());
                 aBitmapName = GetPatternSetOrDefault();
             }
 
-            mpBgBitmapLB->SelectEntry( aBitmapName );
+            mxBgBitmapLB->set_active_text( aBitmapName );
         }
         break;
 
@@ -344,14 +345,16 @@ void PageStylesPanel::NotifyItemUpdate(
                 mpPageColumnItem.reset( static_cast<SfxInt16Item*>(pState->Clone()) );
                 if(mpPageColumnItem->GetValue() <= 5)
                 {
-                    mpColumnCount->SelectEntryPos(mpPageColumnItem->GetValue() - 1);
-                    mpColumnCount->RemoveEntry(aCustomEntry);
+                    mxColumnCount->set_active(mpPageColumnItem->GetValue() - 1);
+                    int nIndex = mxColumnCount->find_text(aCustomEntry);
+                    if (nIndex != -1)
+                        mxColumnCount->remove(nIndex);
                 }
                 else
                 {
-                    if(mpColumnCount->GetEntryPos(aCustomEntry) == LISTBOX_ENTRY_NOTFOUND)
-                        mpColumnCount->InsertEntry(aCustomEntry);
-                    mpColumnCount->SelectEntry(aCustomEntry);
+                    if (mxColumnCount->find_text(aCustomEntry) == -1)
+                        mxColumnCount->append_text(aCustomEntry);
+                    mxColumnCount->set_active_text(aCustomEntry);
                 }
             }
         }
@@ -364,10 +367,10 @@ void PageStylesPanel::NotifyItemUpdate(
             {
                 mpPageItem.reset( static_cast<SvxPageItem*>(pState->Clone()) );
                 SvxNumType eNumType = mpPageItem->GetNumType();
-                mpNumberSelectLB->SetSelection(eNumType);
+                mxNumberSelectLB->set_active_id(eNumType);
 
                 SvxPageUsage nUse = mpPageItem->GetPageUsage();
-                mpLayoutSelectLB->SelectEntryPos( PageUsageToPos_Impl( nUse ) );
+                mxLayoutSelectLB->set_active( PageUsageToPos_Impl( nUse ) );
             }
         }
         break;
@@ -376,7 +379,7 @@ void PageStylesPanel::NotifyItemUpdate(
         {
             if(eState >= SfxItemState::DEFAULT)
             {
-                mpBgFillType->SelectEntryPos( static_cast<sal_Int32>(SOLID) );
+                mxBgFillType->set_active( static_cast<sal_Int32>(SOLID) );
                 mpBgColorItem.reset(pState ? static_cast< XFillColorItem* >(pState->Clone()) : nullptr);
                 Update();
             }
@@ -387,7 +390,7 @@ void PageStylesPanel::NotifyItemUpdate(
         {
             if(eState >= SfxItemState::DEFAULT)
             {
-                mpBgFillType->SelectEntryPos( static_cast<sal_Int32>(HATCH) );
+                mxBgFillType->set_active( static_cast<sal_Int32>(HATCH) );
                 mpBgHatchItem.reset(pState ? static_cast < XFillHatchItem* >(pState->Clone()) : nullptr);
                 Update();
             }
@@ -398,7 +401,7 @@ void PageStylesPanel::NotifyItemUpdate(
         {
             if(eState >= SfxItemState::DEFAULT)
             {
-                mpBgFillType->SelectEntryPos( static_cast<sal_Int32>(GRADIENT) );
+                mxBgFillType->set_active( static_cast<sal_Int32>(GRADIENT) );
                 mpBgGradientItem.reset(pState ? static_cast< XFillGradientItem* >(pState->Clone()) : nullptr);
                 Update();
             }
@@ -412,9 +415,9 @@ void PageStylesPanel::NotifyItemUpdate(
                 if (mpBgBitmapItem)
                 {
                     if (mpBgBitmapItem->isPattern())
-                        mpBgFillType->SelectEntryPos( static_cast<sal_Int32>(PATTERN) );
+                        mxBgFillType->set_active( static_cast<sal_Int32>(PATTERN) );
                     else
-                        mpBgFillType->SelectEntryPos( static_cast<sal_Int32>(BITMAP) );
+                        mxBgFillType->set_active( static_cast<sal_Int32>(BITMAP) );
                 }
                 Update();
             }
@@ -432,22 +435,22 @@ void PageStylesPanel::NotifyItemUpdate(
                 switch(eXFS)
                 {
                     case drawing::FillStyle_NONE:
-                        mpBgFillType->SelectEntryPos( static_cast<sal_Int32>(NONE) );
+                        mxBgFillType->set_active( static_cast<sal_Int32>(NONE) );
                         break;
                     case drawing::FillStyle_SOLID:
-                        mpBgFillType->SelectEntryPos( static_cast<sal_Int32>(SOLID) );
+                        mxBgFillType->set_active( static_cast<sal_Int32>(SOLID) );
                         break;
                     case drawing::FillStyle_GRADIENT:
-                        mpBgFillType->SelectEntryPos( static_cast<sal_Int32>(GRADIENT) );
+                        mxBgFillType->set_active( static_cast<sal_Int32>(GRADIENT) );
                         break;
                     case drawing::FillStyle_HATCH:
-                        mpBgFillType->SelectEntryPos( static_cast<sal_Int32>(HATCH) );
+                        mxBgFillType->set_active( static_cast<sal_Int32>(HATCH) );
                         break;
                     case drawing::FillStyle_BITMAP:
                         if (mpBgBitmapItem->isPattern())
-                            mpBgFillType->SelectEntryPos( static_cast<sal_Int32>(PATTERN) );
+                            mxBgFillType->set_active( static_cast<sal_Int32>(PATTERN) );
                         else
-                            mpBgFillType->SelectEntryPos( static_cast<sal_Int32>(BITMAP) );
+                            mxBgFillType->set_active( static_cast<sal_Int32>(BITMAP) );
                         break;
                     default:
                         break;
@@ -462,31 +465,31 @@ void PageStylesPanel::NotifyItemUpdate(
     }
 }
 
-IMPL_LINK_NOARG( PageStylesPanel, ModifyColumnCountHdl, ListBox&, void )
+IMPL_LINK_NOARG( PageStylesPanel, ModifyColumnCountHdl, weld::ComboBox&, void )
 {
-    sal_uInt16 nColumnType = mpColumnCount->GetSelectedEntryPos() + 1;
+    sal_uInt16 nColumnType = mxColumnCount->get_active() + 1;
     mpPageColumnItem->SetValue( nColumnType );
     mpBindings->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_COLUMN,
             SfxCallMode::RECORD, { mpPageColumnItem.get() });
 }
 
-IMPL_LINK_NOARG( PageStylesPanel, ModifyNumberingHdl, ListBox&, void )
+IMPL_LINK_NOARG( PageStylesPanel, ModifyNumberingHdl, weld::ComboBox&, void )
 {
-    SvxNumType nEntryData = static_cast<SvxNumType>(reinterpret_cast<sal_uLong>(mpNumberSelectLB->GetSelectedEntryData()));
+    SvxNumType nEntryData = mxNumberSelectLB->get_active_id();
     mpPageItem->SetNumType(nEntryData);
     mpBindings->GetDispatcher()->ExecuteList(SID_ATTR_PAGE, SfxCallMode::RECORD, { mpPageItem.get() });
 }
 
-IMPL_LINK_NOARG( PageStylesPanel, ModifyLayoutHdl, ListBox&, void )
+IMPL_LINK_NOARG( PageStylesPanel, ModifyLayoutHdl, weld::ComboBox&, void )
 {
-    sal_uInt16 nUse = mpLayoutSelectLB->GetSelectedEntryPos();
+    sal_uInt16 nUse = mxLayoutSelectLB->get_active();
     mpPageItem->SetPageUsage(PosToPageUsage_Impl(nUse));
     mpBindings->GetDispatcher()->ExecuteList(SID_ATTR_PAGE, SfxCallMode::RECORD, { mpPageItem.get() });
 }
 
-IMPL_LINK_NOARG(PageStylesPanel, ModifyFillStyleHdl, ListBox&, void)
+IMPL_LINK_NOARG(PageStylesPanel, ModifyFillStyleHdl, weld::ComboBox&, void)
 {
-    const eFillStyle eXFS = static_cast<eFillStyle>(mpBgFillType->GetSelectedEntryPos());
+    const eFillStyle eXFS = static_cast<eFillStyle>(mxBgFillType->get_active());
     Update();
 
     switch (eXFS)
@@ -530,26 +533,25 @@ IMPL_LINK_NOARG(PageStylesPanel, ModifyFillStyleHdl, ListBox&, void)
         default:
         break;
     }
-    mpBgFillType->Selected();
 }
 
 void PageStylesPanel::ModifyFillColor()
 {
-    const eFillStyle eXFS = static_cast<eFillStyle>(mpBgFillType->GetSelectedEntryPos());
+    const eFillStyle eXFS = static_cast<eFillStyle>(mxBgFillType->get_active());
     SfxObjectShell* pSh = SfxObjectShell::Current();
     switch(eXFS)
     {
         case SOLID:
         {
-            XFillColorItem aItem(OUString(), mpBgColorLB->GetSelectEntryColor());
+            XFillColorItem aItem(OUString(), mxBgColorLB->GetSelectEntryColor());
             GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_COLOR, SfxCallMode::RECORD, { &aItem });
         }
         break;
         case GRADIENT:
         {
             XGradient aGradient;
-            aGradient.SetStartColor(mpBgColorLB->GetSelectEntryColor());
-            aGradient.SetEndColor(mpBgGradientLB->GetSelectEntryColor());
+            aGradient.SetStartColor(mxBgColorLB->GetSelectEntryColor());
+            aGradient.SetEndColor(mxBgGradientLB->GetSelectEntryColor());
 
             XFillGradientItem aItem(aGradient);
             GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_GRADIENT, SfxCallMode::RECORD, { &aItem });
@@ -558,7 +560,7 @@ void PageStylesPanel::ModifyFillColor()
         case HATCH:
         {
             const SvxHatchListItem * pHatchListItem = pSh->GetItem(SID_HATCH_LIST);
-            sal_uInt16 nPos = mpBgHatchingLB->GetSelectedEntryPos();
+            sal_uInt16 nPos = mxBgHatchingLB->get_active();
             XHatch aHatch = pHatchListItem->GetHatchList()->GetHatch(nPos)->GetHatch();
             const OUString aHatchName = pHatchListItem->GetHatchList()->GetHatch(nPos)->GetName();
 
@@ -569,7 +571,7 @@ void PageStylesPanel::ModifyFillColor()
         case BITMAP:
         case PATTERN:
         {
-            sal_Int16 nPos = mpBgBitmapLB->GetSelectedEntryPos();
+            sal_Int16 nPos = mxBgBitmapLB->get_active();
             GraphicObject aBitmap;
             OUString aBitmapName;
 
@@ -595,12 +597,12 @@ void PageStylesPanel::ModifyFillColor()
     }
 }
 
-IMPL_LINK_NOARG(PageStylesPanel, ModifyFillColorHdl, ListBox&, void)
+IMPL_LINK_NOARG(PageStylesPanel, ModifyFillColorHdl, weld::ComboBox&, void)
 {
     ModifyFillColor();
 }
 
-IMPL_LINK_NOARG(PageStylesPanel, ModifyFillColorListHdl, SvxColorListBox&, void)
+IMPL_LINK_NOARG(PageStylesPanel, ModifyFillColorListHdl, ColorListBox&, void)
 {
     ModifyFillColor();
 }
diff --git a/sw/source/uibase/sidebar/PageStylesPanel.hxx b/sw/source/uibase/sidebar/PageStylesPanel.hxx
index 4dcadf0d9d17..a3b7efde6337 100644
--- a/sw/source/uibase/sidebar/PageStylesPanel.hxx
+++ b/sw/source/uibase/sidebar/PageStylesPanel.hxx
@@ -40,7 +40,7 @@
 #include <svx/pagenumberlistbox.hxx>
 
 class List;
-class SvxColorListBox;
+class ColorListBox;
 namespace sw { namespace sidebar {
 
 class PageStylesPanel:
@@ -85,15 +85,15 @@ private:
     ::sfx2::sidebar::ControllerItem maBgBitmapControl;
     ::sfx2::sidebar::ControllerItem maBgFillStyleControl;
 
-    VclPtr<SvxColorListBox> mpBgColorLB;
-    VclPtr<SvxFillAttrBox>  mpBgHatchingLB;
-    VclPtr<SvxColorListBox> mpBgGradientLB;
-    VclPtr<SvxFillAttrBox>  mpBgBitmapLB;
-    VclPtr<ListBox>         mpLayoutSelectLB;
-    VclPtr<ListBox>         mpColumnCount;
-    VclPtr<PageNumberListBox> mpNumberSelectLB;
-    VclPtr<SvxFillTypeBox>  mpBgFillType;
-    VclPtr<FixedText>       mpCustomEntry;
+    std::unique_ptr<ColorListBox> mxBgColorLB;
+    std::unique_ptr<weld::ComboBox> mxBgHatchingLB;
+    std::unique_ptr<ColorListBox> mxBgGradientLB;
+    std::unique_ptr<weld::ComboBox> mxBgBitmapLB;
+    std::unique_ptr<weld::ComboBox> mxLayoutSelectLB;
+    std::unique_ptr<weld::ComboBox> mxColumnCount;
+    std::unique_ptr<SvxPageNumberListBox> mxNumberSelectLB;
+    std::unique_ptr<weld::ComboBox> mxBgFillType;
+    std::unique_ptr<weld::Label> mxCustomEntry;
     OUString aCustomEntry;
 
     void Initialize();
@@ -106,12 +106,12 @@ private:
 
     void ModifyFillColor();
 
-    DECL_LINK( ModifyColumnCountHdl, ListBox&, void );
-    DECL_LINK( ModifyNumberingHdl, ListBox&, void );
-    DECL_LINK( ModifyLayoutHdl, ListBox&, void );
-    DECL_LINK( ModifyFillStyleHdl, ListBox&, void );
-    DECL_LINK( ModifyFillColorHdl, ListBox&, void );
-    DECL_LINK( ModifyFillColorListHdl, SvxColorListBox&, void );
+    DECL_LINK( ModifyColumnCountHdl, weld::ComboBox&, void );
+    DECL_LINK( ModifyNumberingHdl, weld::ComboBox&, void );
+    DECL_LINK( ModifyLayoutHdl, weld::ComboBox&, void );
+    DECL_LINK( ModifyFillStyleHdl, weld::ComboBox&, void );
+    DECL_LINK( ModifyFillColorHdl, weld::ComboBox&, void );
+    DECL_LINK( ModifyFillColorListHdl, ColorListBox&, void );
 };
 
 } } //end of namespace sw::sidebar
diff --git a/sw/uiconfig/swriter/ui/pagestylespanel.ui b/sw/uiconfig/swriter/ui/pagestylespanel.ui
index dc6f70b1b821..f8acc399e109 100644
--- a/sw/uiconfig/swriter/ui/pagestylespanel.ui
+++ b/sw/uiconfig/swriter/ui/pagestylespanel.ui
@@ -1,33 +1,30 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.1 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="sw">
   <requires lib="gtk+" version="3.18"/>
-  <requires lib="LibreOffice" version="1.0"/>
-  <object class="GtkListStore" id="liststorePageLayout">
+  <object class="GtkListStore" id="liststore4">
     <columns>
-      <!-- column-name gchararray1 -->
+      <!-- column-name text -->
       <column type="gchararray"/>
-      <!-- column-name gint1 -->
-      <column type="gint"/>
+      <!-- column-name id -->
+      <column type="gchararray"/>
+      <!-- column-name image -->
+      <column type="GdkPixbuf"/>
+      <!-- column-name surface -->
+      <column type="CairoSurface"/>
+    </columns>
+  </object>
+  <object class="GtkListStore" id="liststore5">
+    <columns>
+      <!-- column-name text -->
+      <column type="gchararray"/>
+      <!-- column-name id -->
+      <column type="gchararray"/>
+      <!-- column-name image -->
+      <column type="GdkPixbuf"/>
+      <!-- column-name surface -->
+      <column type="CairoSurface"/>
     </columns>
-    <data>
-      <row>
-        <col id="0" translatable="yes" context="pagestylespanel|liststorePageLayout">Right and left</col>
-        <col id="1">0</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes" context="pagestylespanel|liststorePageLayout">Mirrored</col>
-        <col id="1">0</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes" context="pagestylespanel|liststorePageLayout">Only right</col>
-        <col id="1">0</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes" context="pagestylespanel|liststorePageLayout">Only left</col>
-        <col id="1">0</col>
-      </row>
-    </data>
   </object>
   <object class="GtkGrid" id="PageStylesPanel">
     <property name="visible">True</property>
@@ -47,86 +44,83 @@
           <object class="GtkLabel" id="numberslabel">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="xalign">1</property>
             <property name="label" translatable="yes" context="pagestylespanel|numberslabel">Number:</property>
+            <property name="use_underline">True</property>
             <property name="mnemonic_widget">numberbox</property>
+            <property name="xalign">1</property>
           </object>
           <packing>
             <property name="left_attach">0</property>
             <property name="top_attach">0</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
           </packing>
         </child>
         <child>
           <object class="GtkLabel" id="backgroundlabel">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="xalign">1</property>
             <property name="label" translatable="yes" context="pagestylespanel|backgroundlabel">Background:</property>
+            <property name="use_underline">True</property>
             <property name="mnemonic_widget">bgselect</property>
+            <property name="xalign">1</property>
           </object>
           <packing>
             <property name="left_attach">0</property>
             <property name="top_attach">1</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
           </packing>
         </child>
         <child>
-          <object class="svxcorelo-PageNumberListBox" id="numberbox">
+          <object class="GtkComboBoxText" id="numberbox">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
           </object>
           <packing>
             <property name="left_attach">1</property>
             <property name="top_attach">0</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
           </packing>
         </child>
         <child>
           <object class="GtkLabel" id="layoutlabel">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="xalign">1</property>
             <property name="label" translatable="yes" context="pagestylespanel|layoutlabel">Layout:</property>
+            <property name="use_underline">True</property>
             <property name="mnemonic_widget">layoutbox</property>
+            <property name="xalign">1</property>
           </object>
           <packing>
             <property name="left_attach">0</property>
             <property name="top_attach">6</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
           </packing>
         </child>
         <child>
-          <object class="GtkComboBox" id="layoutbox">
+          <object class="GtkComboBoxText" id="layoutbox">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
+            <property name="can_focus">True</property>
             <property name="hexpand">True</property>
-            <property name="model">liststorePageLayout</property>
+            <items>
+              <item translatable="yes" context="pagestylespanel|liststorePageLayout">Right and left</item>
+              <item translatable="yes" context="pagestylespanel|liststorePageLayout">Mirrored</item>
+              <item translatable="yes" context="pagestylespanel|liststorePageLayout">Only right</item>
+              <item translatable="yes" context="pagestylespanel|liststorePageLayout">Only left</item>
+            </items>
           </object>
           <packing>
             <property name="left_attach">1</property>
             <property name="top_attach">6</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
           </packing>
         </child>
         <child>
           <object class="GtkLabel" id="columnlabel">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="xalign">1</property>
             <property name="label" translatable="yes" context="pagestylespanel|columnlabel">Columns:</property>
+            <property name="use_underline">True</property>
             <property name="mnemonic_widget">columnbox</property>
+            <property name="xalign">1</property>
           </object>
           <packing>
             <property name="left_attach">0</property>
             <property name="top_attach">7</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
           </packing>
         </child>
         <child>
@@ -144,72 +138,104 @@
           <packing>
             <property name="left_attach">1</property>
             <property name="top_attach">7</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
           </packing>
         </child>
         <child>
-          <object class="svxlo-SvxFillAttrBox" id="lbhatching">
-            <property name="width_request">150</property>
+          <object class="GtkComboBox" id="lbhatching">
             <property name="visible">True</property>
-            <property name="can_focus">True</property>
+            <property name="can_focus">False</property>
+            <property name="model">liststore4</property>
+            <property name="entry_text_column">0</property>
+            <property name="id_column">1</property>
+            <child>
+              <object class="GtkCellRendererText" id="cellrenderertext3"/>
+              <attributes>
+                <attribute name="text">0</attribute>
+              </attributes>
+            </child>
+            <child>
+              <object class="GtkCellRendererPixbuf" id="cellrenderertext4"/>
+              <attributes>
+                <attribute name="surface">3</attribute>
+              </attributes>
+            </child>
           </object>
           <packing>
             <property name="left_attach">1</property>
             <property name="top_attach">3</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
           </packing>
         </child>
         <child>
-          <object class="svxlo-SvxFillAttrBox" id="lbbitmap">
-            <property name="width_request">150</property>
+          <object class="GtkComboBox" id="lbbitmap">
             <property name="visible">True</property>
-            <property name="can_focus">True</property>
+            <property name="can_focus">False</property>
+            <property name="model">liststore5</property>
+            <property name="entry_text_column">0</property>
+            <property name="id_column">1</property>
+            <child>
+              <object class="GtkCellRendererText" id="cellrenderertext5"/>
+              <attributes>
+                <attribute name="text">0</attribute>
+              </attributes>
+            </child>
+            <child>
+              <object class="GtkCellRendererPixbuf" id="cellrenderertext6"/>
+              <attributes>
+                <attribute name="surface">3</attribute>
+              </attributes>
+            </child>
           </object>
           <packing>
             <property name="left_attach">1</property>
             <property name="top_attach">4</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
           </packing>
         </child>
         <child>
-          <object class="svxcorelo-SvxColorListBox" id="lbcolor">
-            <property name="width_request">150</property>
+          <object class="GtkMenuButton" id="lbcolor">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
+            <property name="receives_default">False</property>
+            <property name="halign">start</property>
+            <property name="valign">center</property>
+            <property name="draw_indicator">True</property>
+            <property name="label" translatable="no"></property>
+            <property name="width_request">150</property>
+            <child>
+              <placeholder/>
+            </child>
           </object>
           <packing>
             <property name="left_attach">1</property>
             <property name="top_attach">2</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
           </packing>
         </child>
         <child>
-          <object class="svxcorelo-SvxColorListBox" id="lbgradient">
-            <property name="width_request">150</property>
+           <object class="GtkMenuButton" id="lbgradient">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
+            <property name="receives_default">False</property>
+            <property name="halign">start</property>
+            <property name="valign">center</property>
+            <property name="draw_indicator">True</property>
+            <property name="label" translatable="no"></property>
+            <property name="width_request">150</property>
+            <child>
+              <placeholder/>
+            </child>
           </object>
           <packing>
             <property name="left_attach">1</property>
             <property name="top_attach">5</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
           </packing>
         </child>
         <child>
-          <object class="svxlo-SvxFillTypeBox" id="bgselect">
+          <object class="GtkComboBoxText" id="bgselect">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
           </object>
           <packing>
             <property name="left_attach">1</property>
             <property name="top_attach">1</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
           </packing>
         </child>
         <child>
@@ -220,8 +246,6 @@
           <packing>
             <property name="left_attach">1</property>
             <property name="top_attach">8</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
           </packing>
         </child>
         <child>
@@ -243,8 +267,6 @@
       <packing>
         <property name="left_attach">0</property>
         <property name="top_attach">0</property>
-        <property name="width">1</property>
-        <property name="height">1</property>
       </packing>
     </child>
   </object>


More information about the Libreoffice-commits mailing list