[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - include/sfx2 include/vcl sfx2/source sfx2/uiconfig vcl/source

Caolán McNamara caolanm at redhat.com
Mon Jun 18 08:01:37 UTC 2018


 include/sfx2/mgetempl.hxx           |   48 +++---
 include/vcl/weld.hxx                |    2 
 sfx2/source/dialog/mgetempl.cxx     |  260 ++++++++++++++++--------------------
 sfx2/uiconfig/ui/managestylepage.ui |   54 +++++--
 vcl/source/window/builder.cxx       |    2 
 5 files changed, 180 insertions(+), 186 deletions(-)

New commits:
commit c34f8c317e351859daba00a3e2150126636f8aa7
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Jun 17 17:35:36 2018 +0100

    weld SfxManageStyleSheetPage
    
    Change-Id: I3769d294e5a5458d3172c330360f7e6207c3d1b1
    Reviewed-on: https://gerrit.libreoffice.org/55966
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/sfx2/mgetempl.hxx b/include/sfx2/mgetempl.hxx
index ded0aab6b0ec..4a2c906ca9c2 100644
--- a/include/sfx2/mgetempl.hxx
+++ b/include/sfx2/mgetempl.hxx
@@ -37,24 +37,6 @@ class SfxStyleSheetBase;
 
 class SfxManageStyleSheetPage final : public SfxTabPage
 {
-    VclPtr<VclMultiLineEdit> m_pNameRo;
-    VclPtr<Edit>             m_pNameRw;
-
-    VclPtr<CheckBox>         m_pAutoCB;
-
-    VclPtr<FixedText>        m_pFollowFt;
-    VclPtr<ListBox>          m_pFollowLb;
-    VclPtr<PushButton>       m_pEditStyleBtn;
-
-    VclPtr<FixedText>        m_pBaseFt;
-    VclPtr<ListBox>          m_pBaseLb;
-    VclPtr<PushButton>       m_pEditLinkStyleBtn;
-
-    VclPtr<FixedText>        m_pFilterFt;
-    VclPtr<ListBox>          m_pFilterLb;
-
-    VclPtr<FixedText>        m_pDescFt;
-
     SfxStyleSheetBase *pStyle;
     std::unique_ptr<SfxStyleFamilies> pFamilies;
     const SfxStyleFamilyItem *pItem;
@@ -67,16 +49,30 @@ class SfxManageStyleSheetPage final : public SfxTabPage
     OUString aParent;
     SfxStyleSearchBits nFlags;
 
+    std::unique_ptr<weld::TextView> m_xNameRo;
+    std::unique_ptr<weld::Entry> m_xNameRw;
+    std::unique_ptr<weld::CheckButton> m_xAutoCB;
+    std::unique_ptr<weld::Label> m_xFollowFt;
+    std::unique_ptr<weld::ComboBoxText> m_xFollowLb;
+    std::unique_ptr<weld::Button> m_xEditStyleBtn;
+    std::unique_ptr<weld::Label> m_xBaseFt;
+    std::unique_ptr<weld::ComboBoxText>          m_xBaseLb;
+    std::unique_ptr<weld::Button> m_xEditLinkStyleBtn;
+    std::unique_ptr<weld::Label> m_xFilterFt;
+    std::unique_ptr<weld::ComboBoxText> m_xFilterLb;
+    std::unique_ptr<weld::Label> m_xDescFt;
+    std::unique_ptr<weld::Label> m_xNameFt;
+
 friend class SfxStyleDialog;
 
-    DECL_LINK( GetFocusHdl, Control&, void );
-    DECL_LINK( LoseFocusHdl, Control&, void );
-    DECL_LINK( EditStyleSelectHdl_Impl, ListBox&, void );
-    DECL_LINK( EditStyleHdl_Impl, Button*, void );
-    DECL_LINK( EditLinkStyleSelectHdl_Impl, ListBox&, void );
-    DECL_LINK( EditLinkStyleHdl_Impl, Button*, void );
+    DECL_LINK(GetFocusHdl, weld::Widget&, void);
+    DECL_LINK(LoseFocusHdl, weld::Widget&, void);
+    DECL_LINK(EditStyleSelectHdl_Impl, weld::ComboBoxText&, void);
+    DECL_LINK(EditStyleHdl_Impl, weld::Button&, void);
+    DECL_LINK(EditLinkStyleSelectHdl_Impl, weld::ComboBoxText&, void);
+    DECL_LINK(EditLinkStyleHdl_Impl, weld::Button&, void);
 
-    void    UpdateName_Impl(ListBox *, const OUString &rNew);
+    void    UpdateName_Impl(weld::ComboBoxText*, const OUString &rNew);
     void    SetDescriptionText_Impl();
 
     virtual ~SfxManageStyleSheetPage() override;
@@ -94,7 +90,7 @@ friend class SfxStyleDialog;
     virtual DeactivateRC DeactivatePage(SfxItemSet *) override;
 
 public:
-    SfxManageStyleSheetPage(vcl::Window *pParent, const SfxItemSet &rAttrSet );
+    SfxManageStyleSheetPage(TabPageParent pParent, const SfxItemSet &rAttrSet);
 };
 
 #endif
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 6fe23154177d..68c5b48363d5 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -281,7 +281,7 @@ public:
     }
 
     void save_value() { m_sSavedValue = get_active_text(); }
-
+    OUString get_saved_value() const { return m_sSavedValue; }
     bool get_value_changed_from_saved() const { return m_sSavedValue != get_active_text(); }
 };
 
diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx
index 2b29c7e335d1..1d5275935896 100644
--- a/sfx2/source/dialog/mgetempl.cxx
+++ b/sfx2/source/dialog/mgetempl.cxx
@@ -45,8 +45,8 @@
  *
  *  initializes the list box with the templates
  */
-SfxManageStyleSheetPage::SfxManageStyleSheetPage(vcl::Window* pParent, const SfxItemSet& rAttrSet)
-    : SfxTabPage(pParent, "ManageStylePage", "sfx/ui/managestylepage.ui", &rAttrSet)
+SfxManageStyleSheetPage::SfxManageStyleSheetPage(TabPageParent pParent, const SfxItemSet& rAttrSet)
+    : SfxTabPage(pParent, "sfx/ui/managestylepage.ui", "ManageStylePage", &rAttrSet)
     , pStyle(&static_cast<SfxStyleDialog*>(GetParentDialog())->GetStyleSheet())
     , pItem(nullptr)
     , bModified(false)
@@ -54,43 +54,44 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(vcl::Window* pParent, const Sfx
     , aFollow(pStyle->GetFollow())
     , aParent(pStyle->GetParent())
     , nFlags(pStyle->GetMask())
+    , m_xNameRo(m_xBuilder->weld_text_view("namero"))
+    , m_xNameRw(m_xBuilder->weld_entry("namerw"))
+    , m_xAutoCB(m_xBuilder->weld_check_button("autoupdate"))
+    , m_xFollowFt(m_xBuilder->weld_label("nextstyleft"))
+    , m_xFollowLb(m_xBuilder->weld_combo_box_text("nextstyle"))
+    , m_xEditStyleBtn(m_xBuilder->weld_button("editstyle"))
+    , m_xBaseFt(m_xBuilder->weld_label("linkedwithft"))
+    , m_xBaseLb(m_xBuilder->weld_combo_box_text("linkedwith"))
+    , m_xEditLinkStyleBtn(m_xBuilder->weld_button("editlinkstyle"))
+    , m_xFilterFt(m_xBuilder->weld_label("categoryft"))
+    , m_xFilterLb(m_xBuilder->weld_combo_box_text("category"))
+    , m_xDescFt(m_xBuilder->weld_label("desc"))
+    , m_xNameFt(m_xBuilder->weld_label("nameft"))
 {
-    get(m_pNameRo, "namero");
-    get(m_pNameRw, "namerw");
-    m_pNameRo->set_width_request(m_pNameRw->get_preferred_size().Width());
-    get(m_pAutoCB, "autoupdate");
-    get(m_pFollowFt, "nextstyleft");
-    get(m_pFollowLb, "nextstyle");
-    m_pFollowLb->SetStyle(m_pFollowLb->GetStyle() | WB_SORT);
-    const sal_Int32 nMaxWidth(62);
-    m_pFollowLb->setMaxWidthChars(nMaxWidth);
-    get(m_pEditStyleBtn, "editstyle");
-    get(m_pBaseFt, "linkedwithft");
-    get(m_pBaseLb, "linkedwith");
-    get(m_pEditLinkStyleBtn, "editlinkstyle");
-    m_pBaseLb->SetStyle(m_pBaseLb->GetStyle() | WB_SORT);
-    m_pBaseLb->setMaxWidthChars(nMaxWidth);
-    get(m_pFilterFt, "categoryft");
-    get(m_pFilterLb, "category");
+    m_xNameRo->set_size_request(m_xNameRw->get_preferred_size().Width(), -1);
+    m_xFollowLb->make_sorted();
+    const int nMaxWidth(m_xFollowLb->get_approximate_digit_width() * 50);
+    m_xFollowLb->set_size_request(nMaxWidth , -1);
+    m_xBaseLb->make_sorted();
+    m_xBaseLb->set_size_request(nMaxWidth , -1);
     //note that the code depends on categories not being lexically
     //sorted, so if its changed to sorted, the code needs to
     //be adapted to be position unaware
-    m_pFilterLb->setMaxWidthChars(nMaxWidth);
-    get(m_pDescFt, "desc");
+    m_xFilterLb->set_size_request(nMaxWidth , -1);
 
     // this Page needs ExchangeSupport
     SetExchangeSupport();
 
     if ( aFollow == aName )
-        m_pEditStyleBtn->Disable();
+        m_xEditStyleBtn->set_sensitive(false);
     else
-        m_pEditStyleBtn->Enable();
+        m_xEditStyleBtn->set_sensitive(true);
 
-    sal_Int32 linkSelectPos = m_pBaseLb->GetSelectedEntryPos();
+    int linkSelectPos = m_xBaseLb->get_active();
     if ( linkSelectPos == 0 )
-        m_pEditLinkStyleBtn->Disable();
+        m_xEditLinkStyleBtn->set_sensitive(false);
     else
-        m_pEditLinkStyleBtn->Enable();
+        m_xEditLinkStyleBtn->set_sensitive(true);
 
     pFamilies.reset(SfxApplication::GetModule_Impl()->CreateStyleFamilies());
 
@@ -116,17 +117,16 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(vcl::Window* pParent, const Sfx
         aFollow = pStyle->GetFollow();
         aParent = pStyle->GetParent();
     }
-    m_pNameRw->SetText(pStyle->GetName());
+    m_xNameRw->set_text(pStyle->GetName());
 
     // Set the field read-only if it is NOT an user-defined style
     // but allow selecting and copying
     if (!pStyle->IsUserDefined())
     {
-        m_pNameRo->SetText(m_pNameRw->GetText());
-        m_pNameRw->Hide();
-        m_pNameRo->Show();
-        FixedText *pLabel = get<FixedText>("nameft");
-        pLabel->set_mnemonic_widget(m_pNameRo);
+        m_xNameRo->set_text(m_xNameRw->get_text());
+        m_xNameRw->hide();
+        m_xNameRo->show();
+        m_xNameFt->set_mnemonic_widget(m_xNameRo.get());
     }
 
     if ( pStyle->HasFollowSupport() && pPool )
@@ -135,25 +135,25 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(vcl::Window* pParent, const Sfx
 
         while ( pPoolStyle )
         {
-            m_pFollowLb->InsertEntry( pPoolStyle->GetName() );
+            m_xFollowLb->append_text(pPoolStyle->GetName());
             pPoolStyle = pPool->Next();
         }
 
         // A new Template is not yet in the Pool
-        if ( LISTBOX_ENTRY_NOTFOUND == m_pFollowLb->GetEntryPos( pStyle->GetName() ) )
-            m_pFollowLb->InsertEntry( pStyle->GetName() );
+        if (m_xFollowLb->find_text(pStyle->GetName()) == -1)
+            m_xFollowLb->append_text(pStyle->GetName());
     }
     else
     {
-        m_pFollowFt->Hide();
-        m_pFollowLb->Hide();
+        m_xFollowFt->hide();
+        m_xFollowLb->hide();
     }
 
     if ( pStyle->HasParentSupport() && pPool )
     {
         if ( pStyle->HasClearParentSupport() )
             // the base template can be set to NULL
-            m_pBaseLb->InsertEntry( SfxResId(STR_NONE) );
+            m_xBaseLb->append_text(SfxResId(STR_NONE));
 
         SfxStyleSheetBase* pPoolStyle = pPool->First();
 
@@ -162,14 +162,14 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(vcl::Window* pParent, const Sfx
             const OUString aStr( pPoolStyle->GetName() );
             // own name as base template
             if ( aStr != aName )
-                m_pBaseLb->InsertEntry( aStr );
+                m_xBaseLb->append_text(aStr);
             pPoolStyle = pPool->Next();
         }
     }
     else
     {
-        m_pBaseFt->Disable();
-        m_pBaseLb->Disable();
+        m_xBaseFt->set_sensitive(false);
+        m_xBaseLb->set_sensitive(false);
     }
 
     size_t nCount = pFamilies->size();
@@ -203,9 +203,7 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(vcl::Window* pParent, const Sfx
                  rTupel.nFlags != SfxStyleSearchBits::AllVisible &&
                  rTupel.nFlags != SfxStyleSearchBits::All )
             {
-                m_pFilterLb->InsertEntry( rTupel.aName, nIdx );
-                m_pFilterLb->SetEntryData(nIdx, reinterpret_cast<void*>(i));
-
+                m_xFilterLb->insert(nIdx, OUString::number(i), rTupel.aName);
                 if ( ( rTupel.nFlags & nMask ) == nMask )
                     nStyleFilterIdx = nIdx;
                 ++nIdx;
@@ -213,36 +211,35 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(vcl::Window* pParent, const Sfx
         }
 
         if ( nStyleFilterIdx != 0xFFFF )
-            m_pFilterLb->SelectEntryPos( nStyleFilterIdx );
+            m_xFilterLb->set_active(nStyleFilterIdx);
     }
 
-    if ( !m_pFilterLb->GetEntryCount() || !pStyle->IsUserDefined() )
+    if ( !m_xFilterLb->get_count() || !pStyle->IsUserDefined() )
     {
         pItem = nullptr;
-        m_pFilterFt->Disable();
-        m_pFilterLb->Disable();
+        m_xFilterFt->set_sensitive(false);
+        m_xFilterLb->set_sensitive(false);
     }
     else
-        m_pFilterLb->SaveValue();
+        m_xFilterLb->save_value();
     SetDescriptionText_Impl();
 
-    if ( m_pFollowLb->IsEnabled() || m_pBaseLb->IsEnabled() )
+    if (m_xFollowLb->get_sensitive() || m_xBaseLb->get_sensitive())
     {
-        m_pNameRw->SetGetFocusHdl(
+        m_xNameRw->connect_focus_in(
             LINK( this, SfxManageStyleSheetPage, GetFocusHdl ) );
-        m_pNameRw->SetLoseFocusHdl(
+        m_xNameRw->connect_focus_out(
             LINK( this, SfxManageStyleSheetPage, LoseFocusHdl ) );
     }
     // It is a style with auto update? (SW only)
     if(SfxItemState::SET == rAttrSet.GetItemState(SID_ATTR_AUTO_STYLE_UPDATE))
-        m_pAutoCB->Show();
-    m_pFollowLb->SetSelectHdl( LINK( this, SfxManageStyleSheetPage, EditStyleSelectHdl_Impl ) );
-    m_pBaseLb->SetSelectHdl( LINK( this, SfxManageStyleSheetPage, EditLinkStyleSelectHdl_Impl ) );
-    m_pEditStyleBtn->SetClickHdl( LINK( this, SfxManageStyleSheetPage, EditStyleHdl_Impl ) );
-    m_pEditLinkStyleBtn->SetClickHdl( LINK( this, SfxManageStyleSheetPage, EditLinkStyleHdl_Impl ) );
+        m_xAutoCB->show();
+    m_xFollowLb->connect_changed(LINK(this, SfxManageStyleSheetPage, EditStyleSelectHdl_Impl));
+    m_xBaseLb->connect_changed(LINK(this, SfxManageStyleSheetPage, EditLinkStyleSelectHdl_Impl));
+    m_xEditStyleBtn->connect_clicked(LINK(this, SfxManageStyleSheetPage, EditStyleHdl_Impl));
+    m_xEditLinkStyleBtn->connect_clicked(LINK(this, SfxManageStyleSheetPage, EditLinkStyleHdl_Impl));
 }
 
-
 SfxManageStyleSheetPage::~SfxManageStyleSheetPage()
 {
     disposeOnce();
@@ -250,28 +247,13 @@ SfxManageStyleSheetPage::~SfxManageStyleSheetPage()
 
 void SfxManageStyleSheetPage::dispose()
 {
-    m_pNameRw->SetGetFocusHdl( Link<Control&,void>() );
-    m_pNameRw->SetLoseFocusHdl( Link<Control&,void>() );
     pFamilies.reset();
     pItem = nullptr;
     pStyle = nullptr;
-    m_pNameRo.clear();
-    m_pNameRw.clear();
-    m_pAutoCB.clear();
-    m_pFollowFt.clear();
-    m_pFollowLb.clear();
-    m_pEditStyleBtn.clear();
-    m_pBaseFt.clear();
-    m_pBaseLb.clear();
-    m_pEditLinkStyleBtn.clear();
-    m_pFilterFt.clear();
-    m_pFilterLb.clear();
-    m_pDescFt.clear();
     SfxTabPage::dispose();
 }
 
-
-void SfxManageStyleSheetPage::UpdateName_Impl( ListBox* pBox,
+void SfxManageStyleSheetPage::UpdateName_Impl( weld::ComboBoxText* pBox,
                                                const OUString& rNew )
 
 /*  [Description]
@@ -285,19 +267,18 @@ void SfxManageStyleSheetPage::UpdateName_Impl( ListBox* pBox,
 */
 
 {
-    if ( pBox->IsEnabled() )
+    if (pBox->get_sensitive())
     {
         // it is the current entry, which name was modified
-        const bool bSelect = pBox->GetSelectedEntry() == aBuf;
-        pBox->RemoveEntry( aBuf );
-        pBox->InsertEntry( rNew );
+        const bool bSelect = pBox->get_active_text() == aBuf;
+        pBox->remove_text(aBuf);
+        pBox->append_text(rNew);
 
-        if ( bSelect )
-            pBox->SelectEntry( rNew );
+        if (bSelect)
+            pBox->set_active_text(rNew);
     }
 }
 
-
 void SfxManageStyleSheetPage::SetDescriptionText_Impl()
 
 /*  [Description]
@@ -331,37 +312,37 @@ void SfxManageStyleSheetPage::SetDescriptionText_Impl()
         default:
             OSL_FAIL( "non supported field unit" );
     }
-    m_pDescFt->SetText( pStyle->GetDescription( eUnit ) );
+    m_xDescFt->set_label(pStyle->GetDescription(eUnit));
 }
 
-IMPL_LINK_NOARG( SfxManageStyleSheetPage, EditStyleSelectHdl_Impl, ListBox&, void )
+IMPL_LINK_NOARG(SfxManageStyleSheetPage, EditStyleSelectHdl_Impl, weld::ComboBoxText&, void)
 {
-    OUString aTemplName(m_pFollowLb->GetSelectedEntry());
-    OUString aEditTemplName(m_pNameRo->GetText());
+    OUString aTemplName(m_xFollowLb->get_active_text());
+    OUString aEditTemplName(m_xNameRo->get_text());
     if (!( aTemplName == aEditTemplName))
-        m_pEditStyleBtn->Enable();
+        m_xEditStyleBtn->set_sensitive(true);
     else
-        m_pEditStyleBtn->Disable();
+        m_xEditStyleBtn->set_sensitive(false);
 }
 
-IMPL_LINK_NOARG( SfxManageStyleSheetPage, EditStyleHdl_Impl, Button*, void )
+IMPL_LINK_NOARG(SfxManageStyleSheetPage, EditStyleHdl_Impl, weld::Button&, void)
 {
-    OUString aTemplName(m_pFollowLb->GetSelectedEntry());
+    OUString aTemplName(m_xFollowLb->get_active_text());
     Execute_Impl(SID_STYLE_EDIT, aTemplName, static_cast<sal_uInt16>(pStyle->GetFamily()));
 }
 
-IMPL_LINK_NOARG( SfxManageStyleSheetPage, EditLinkStyleSelectHdl_Impl, ListBox&, void )
+IMPL_LINK_NOARG(SfxManageStyleSheetPage, EditLinkStyleSelectHdl_Impl, weld::ComboBoxText&, void)
 {
-    sal_Int32 linkSelectPos = m_pBaseLb->GetSelectedEntryPos();
+    int linkSelectPos = m_xBaseLb->get_active();
     if ( linkSelectPos == 0 )
-        m_pEditLinkStyleBtn->Disable();
+        m_xEditLinkStyleBtn->set_sensitive(false);
     else
-        m_pEditLinkStyleBtn->Enable();
+        m_xEditLinkStyleBtn->set_sensitive(true);
 }
 
-IMPL_LINK_NOARG( SfxManageStyleSheetPage, EditLinkStyleHdl_Impl, Button*, void )
+IMPL_LINK_NOARG(SfxManageStyleSheetPage, EditLinkStyleHdl_Impl, weld::Button&, void)
 {
-    OUString aTemplName(m_pBaseLb->GetSelectedEntry());
+    OUString aTemplName(m_xBaseLb->get_active_text());
     if (aTemplName != SfxResId(STR_NONE))
         Execute_Impl( SID_STYLE_EDIT, aTemplName, static_cast<sal_uInt16>(pStyle->GetFamily()) );
 }
@@ -390,7 +371,7 @@ bool SfxManageStyleSheetPage::Execute_Impl(
 
 }
 
-IMPL_LINK( SfxManageStyleSheetPage, GetFocusHdl, Control&, rControl, void )
+IMPL_LINK(SfxManageStyleSheetPage, GetFocusHdl, weld::Widget&, rControl, void)
 
 /*  [Description]
 
@@ -398,11 +379,11 @@ IMPL_LINK( SfxManageStyleSheetPage, GetFocusHdl, Control&, rControl, void )
 */
 
 {
-    Edit* pEdit = static_cast<Edit*>(&rControl);
-    aBuf = comphelper::string::stripStart(pEdit->GetText(), ' ');
+    weld::Entry& rEdit = dynamic_cast<weld::Entry&>(rControl);
+    aBuf = comphelper::string::stripStart(rEdit.get_text(), ' ');
 }
 
-IMPL_LINK( SfxManageStyleSheetPage, LoseFocusHdl, Control&, rControl, void )
+IMPL_LINK(SfxManageStyleSheetPage, LoseFocusHdl, weld::Widget&, rControl, void)
 
 /*  [Description]
 
@@ -412,12 +393,12 @@ IMPL_LINK( SfxManageStyleSheetPage, LoseFocusHdl, Control&, rControl, void )
 */
 
 {
-    Edit* pEdit = static_cast<Edit*>(&rControl);
-    const OUString aStr(comphelper::string::stripStart(pEdit->GetText(), ' '));
-    pEdit->SetText( aStr );
+    weld::Entry& rEdit = dynamic_cast<weld::Entry&>(rControl);
+    const OUString aStr(comphelper::string::stripStart(rEdit.get_text(), ' '));
+    rEdit.set_text(aStr);
     // Update the Listbox of the base template if possible
     if ( aStr != aBuf )
-        UpdateName_Impl(m_pFollowLb, aStr);
+        UpdateName_Impl(m_xFollowLb.get(), aStr);
 }
 
 bool SfxManageStyleSheetPage::FillItemSet( SfxItemSet* rSet )
@@ -442,24 +423,23 @@ bool SfxManageStyleSheetPage::FillItemSet( SfxItemSet* rSet )
 */
 
 {
-    const sal_Int32 nFilterIdx = m_pFilterLb->GetSelectedEntryPos();
+    const int nFilterIdx = m_xFilterLb->get_active();
 
     // Set Filter
 
-    if ( LISTBOX_ENTRY_NOTFOUND  != nFilterIdx      &&
-         m_pFilterLb->IsValueChangedFromSaved()    &&
-         m_pFilterLb->IsEnabled() )
+    if ( nFilterIdx != -1 &&
+         m_xFilterLb->get_value_changed_from_saved() &&
+         m_xFilterLb->get_sensitive() )
     {
         bModified = true;
         OSL_ENSURE( pItem, "No Item" );
         // is only possibly for user templates
-        SfxStyleSearchBits nMask = pItem->GetFilterList()[ reinterpret_cast<size_t>(m_pFilterLb->GetEntryData( nFilterIdx )) ].nFlags | SfxStyleSearchBits::UserDefined;
+        SfxStyleSearchBits nMask = pItem->GetFilterList()[m_xFilterLb->get_id(nFilterIdx).toInt32()].nFlags | SfxStyleSearchBits::UserDefined;
         pStyle->SetMask( nMask );
     }
-    if(m_pAutoCB->IsVisible() &&
-       m_pAutoCB->IsValueChangedFromSaved())
+    if (m_xAutoCB->get_visible() && m_xAutoCB->get_state_changed_from_saved())
     {
-        rSet->Put(SfxBoolItem(SID_ATTR_AUTO_STYLE_UPDATE, m_pAutoCB->IsChecked()));
+        rSet->Put(SfxBoolItem(SID_ATTR_AUTO_STYLE_UPDATE, m_xAutoCB->get_active()));
     }
 
     return bModified;
@@ -487,10 +467,10 @@ void SfxManageStyleSheetPage::Reset( const SfxItemSet* /*rAttrSet*/ )
 
     if ( sCmp != aName )
         pStyle->SetName( aName );
-    m_pNameRw->SetText( aName );
-    m_pNameRw->SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) );
+    m_xNameRw->set_text( aName );
+    m_xNameRw->select_region(0, -1);
 
-    if ( m_pFollowLb->IsEnabled() )
+    if ( m_xFollowLb->get_sensitive() )
     {
         sCmp = pStyle->GetFollow();
 
@@ -498,12 +478,12 @@ void SfxManageStyleSheetPage::Reset( const SfxItemSet* /*rAttrSet*/ )
             pStyle->SetFollow( aFollow );
 
         if ( aFollow.isEmpty() )
-            m_pFollowLb->SelectEntry( aName );
+            m_xFollowLb->set_active_text( aName );
         else
-            m_pFollowLb->SelectEntry( aFollow );
+            m_xFollowLb->set_active_text( aFollow );
     }
 
-    if ( m_pBaseLb->IsEnabled() )
+    if (m_xBaseLb->get_sensitive())
     {
         sCmp = pStyle->GetParent();
 
@@ -511,36 +491,34 @@ void SfxManageStyleSheetPage::Reset( const SfxItemSet* /*rAttrSet*/ )
             pStyle->SetParent( aParent );
 
         if ( aParent.isEmpty() )
-            m_pBaseLb->SelectEntry( SfxResId(STR_NONE) );
+            m_xBaseLb->set_active_text( SfxResId(STR_NONE) );
         else
-            m_pBaseLb->SelectEntry( aParent );
+            m_xBaseLb->set_active_text( aParent );
 
         if ( SfxResId(STR_STANDARD) == aName )
         {
             // the default template can not be linked
-            m_pBaseFt->Disable();
-            m_pBaseLb->Disable();
+            m_xBaseFt->set_sensitive(false);
+            m_xBaseLb->set_sensitive(false);
         }
     }
 
-    if ( m_pFilterLb->IsEnabled() )
+    if (m_xFilterLb->get_sensitive())
     {
         SfxStyleSearchBits nCmp = pStyle->GetMask();
 
         if ( nCmp != nFlags )
             pStyle->SetMask( nFlags );
-        m_pFilterLb->SelectEntryPos( m_pFilterLb->GetSavedValue() );
+        m_xFilterLb->set_active_text(m_xFilterLb->get_saved_value());
     }
 }
 
-
 VclPtr<SfxTabPage> SfxManageStyleSheetPage::Create( TabPageParent pParent,
                                                     const SfxItemSet *rAttrSet )
 {
-    return VclPtr<SfxManageStyleSheetPage>::Create( pParent.pParent, *rAttrSet );
+    return VclPtr<SfxManageStyleSheetPage>::Create(pParent, *rAttrSet);
 }
 
-
 void SfxManageStyleSheetPage::ActivatePage( const SfxItemSet& rSet)
 
 /*  [Description]
@@ -566,11 +544,11 @@ void SfxManageStyleSheetPage::ActivatePage( const SfxItemSet& rSet)
 
     if ( SfxItemState::SET ==
          rSet.GetItemState( SID_ATTR_AUTO_STYLE_UPDATE, false, &pPoolItem ) )
-        m_pAutoCB->Check( static_cast<const SfxBoolItem*>(pPoolItem)->GetValue() );
-    m_pAutoCB->SaveValue();
+        m_xAutoCB->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
+    m_xAutoCB->save_state();
+    m_xNameRw->save_value();
 }
 
-
 DeactivateRC SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet )
 
 /*  [Description]
@@ -590,28 +568,28 @@ DeactivateRC SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet )
 {
     DeactivateRC nRet = DeactivateRC::LeavePage;
 
-    if ( m_pNameRw->IsModified() )
+    if (m_xNameRw->get_value_changed_from_saved())
     {
         // By pressing <Enter> LoseFocus() is not trigged through StarView
-        if ( m_pNameRw->HasFocus() )
-            LoseFocusHdl( *m_pNameRw );
+        if (m_xNameRw->has_focus())
+            LoseFocusHdl( *m_xNameRw );
 
-        if (!pStyle->SetName(comphelper::string::stripStart(m_pNameRw->GetText(), ' ')))
+        if (!pStyle->SetName(comphelper::string::stripStart(m_xNameRw->get_text(), ' ')))
         {
             std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(),
                                                                      VclMessageType::Info, VclButtonsType::Ok,
                                                                      SfxResId(STR_TABPAGE_INVALIDNAME)));
             xBox->run();
-            m_pNameRw->GrabFocus();
-            m_pNameRw->SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) );
+            m_xNameRw->grab_focus();
+            m_xNameRw->select_region(0, -1);
             return DeactivateRC::KeepPage;
         }
         bModified = true;
     }
 
-    if ( pStyle->HasFollowSupport() && m_pFollowLb->IsEnabled() )
+    if (pStyle->HasFollowSupport() && m_xFollowLb->get_sensitive())
     {
-        const OUString aFollowEntry( m_pFollowLb->GetSelectedEntry() );
+        const OUString aFollowEntry( m_xFollowLb->get_active_text() );
 
         if ( pStyle->GetFollow() != aFollowEntry )
         {
@@ -621,16 +599,16 @@ DeactivateRC SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet )
                                                                          VclMessageType::Info, VclButtonsType::Ok,
                                                                          SfxResId(STR_TABPAGE_INVALIDSTYLE)));
                 xBox->run();
-                m_pFollowLb->GrabFocus();
+                m_xFollowLb->grab_focus();
                 return DeactivateRC::KeepPage;
             }
             bModified = true;
         }
     }
 
-    if ( m_pBaseLb->IsEnabled() )
+    if (m_xBaseLb->get_sensitive())
     {
-        OUString aParentEntry( m_pBaseLb->GetSelectedEntry() );
+        OUString aParentEntry( m_xBaseLb->get_active_text() );
 
         if ( SfxResId(STR_NONE) == aParentEntry || aParentEntry == pStyle->GetName() )
             aParentEntry.clear();
@@ -643,7 +621,7 @@ DeactivateRC SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet )
                                                                          VclMessageType::Info, VclButtonsType::Ok,
                                                                          SfxResId(STR_TABPAGE_INVALIDPARENT)));
                 xBox->run();
-                m_pBaseLb->GrabFocus();
+                m_xBaseLb->grab_focus();
                 return DeactivateRC::KeepPage;
             }
             bModified = true;
diff --git a/sfx2/uiconfig/ui/managestylepage.ui b/sfx2/uiconfig/ui/managestylepage.ui
index fddaa245c516..fd0c855a99d6 100644
--- a/sfx2/uiconfig/ui/managestylepage.ui
+++ b/sfx2/uiconfig/ui/managestylepage.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="sfx">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkBox" id="ManageStylePage">
@@ -34,10 +34,10 @@
                   <object class="GtkLabel" id="nameft">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">1</property>
                     <property name="label" translatable="yes" context="managestylepage|nameft">_Name:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">namerw</property>
+                    <property name="xalign">1</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -48,10 +48,10 @@
                   <object class="GtkLabel" id="nextstyleft">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">1</property>
                     <property name="label" translatable="yes" context="managestylepage|nextstyleft">Ne_xt style:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">nextstyle</property>
+                    <property name="xalign">1</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -62,10 +62,10 @@
                   <object class="GtkLabel" id="linkedwithft">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">1</property>
                     <property name="label" translatable="yes" context="managestylepage|linkedwithft">Inherit from:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">linkedwith</property>
+                    <property name="xalign">1</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -76,10 +76,10 @@
                   <object class="GtkLabel" id="categoryft">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">1</property>
                     <property name="label" translatable="yes" context="managestylepage|categoryft">_Category:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">category</property>
+                    <property name="xalign">1</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -103,6 +103,7 @@
                     <property name="label" translatable="yes" context="managestylepage|editstyle">Edit Style</property>
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
+                    <property name="receives_default">False</property>
                   </object>
                   <packing>
                     <property name="left_attach">2</property>
@@ -126,6 +127,7 @@
                     <property name="label" translatable="yes" context="managestylepage|editlinkstyle">Edit Style</property>
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
+                    <property name="receives_default">False</property>
                   </object>
                   <packing>
                     <property name="left_attach">2</property>
@@ -150,29 +152,38 @@
                     <property name="can_focus">False</property>
                     <property name="column_spacing">12</property>
                     <child>
-                      <object class="GtkTextView" id="namero:border">
+                      <object class="GtkEntry" id="namerw">
+                        <property name="visible">True</property>
                         <property name="can_focus">True</property>
-                        <property name="no_show_all">True</property>
                         <property name="valign">center</property>
                         <property name="hexpand">True</property>
-                        <property name="editable">False</property>
-                        <property name="cursor_visible">False</property>
+                        <property name="width_chars">52</property>
                       </object>
                       <packing>
-                        <property name="left_attach">0</property>
+                        <property name="left_attach">1</property>
                         <property name="top_attach">0</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkEntry" id="namerw">
+                      <object class="GtkScrolledWindow">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
-                        <property name="valign">center</property>
-                        <property name="hexpand">True</property>
-                        <property name="width_chars">52</property>
+                        <property name="hscrollbar_policy">never</property>
+                        <property name="vscrollbar_policy">never</property>
+                        <property name="shadow_type">in</property>
+                        <child>
+                          <object class="GtkTextView" id="namero">
+                            <property name="can_focus">True</property>
+                            <property name="no_show_all">True</property>
+                            <property name="valign">center</property>
+                            <property name="hexpand">True</property>
+                            <property name="editable">False</property>
+                            <property name="cursor_visible">False</property>
+                          </object>
+                        </child>
                       </object>
                       <packing>
-                        <property name="left_attach">1</property>
+                        <property name="left_attach">0</property>
                         <property name="top_attach">0</property>
                       </packing>
                     </child>
@@ -200,6 +211,15 @@
                 <child>
                   <placeholder/>
                 </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
               </object>
             </child>
           </object>
@@ -237,10 +257,10 @@
               <object class="GtkLabel" id="desc">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="xalign">0</property>
-                <property name="yalign">0</property>
                 <property name="wrap">True</property>
                 <property name="max_width_chars">52</property>
+                <property name="xalign">0</property>
+                <property name="yalign">0</property>
               </object>
             </child>
           </object>
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 935ffc0eacfe..b4adb2e33069 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -1306,7 +1306,7 @@ vcl::Window* VclBuilder::prepareWidgetOwnScrolling(vcl::Window *pParent, WinBits
     {
         WinBits nScrollBits = pParent->GetStyle();
         nScrollBits &= (WB_AUTOHSCROLL|WB_HSCROLL|WB_AUTOVSCROLL|WB_VSCROLL);
-        rWinStyle |= nScrollBits;
+        rWinStyle |= nScrollBits | WB_BORDER;
         pParent = pParent->GetParent();
     }
 


More information about the Libreoffice-commits mailing list