[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - sw/source sw/uiconfig

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Nov 23 08:57:11 UTC 2018


 sw/source/ui/frmdlg/frmpage.cxx      |   81 ++++++++++++++---------------------
 sw/source/uibase/inc/frmpage.hxx     |   17 +++----
 sw/uiconfig/swriter/ui/frmurlpage.ui |   30 +++---------
 3 files changed, 49 insertions(+), 79 deletions(-)

New commits:
commit 19805f580fcbcf890790f8c6ab736aab80c08de7
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Nov 22 16:31:04 2018 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Nov 23 09:56:39 2018 +0100

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

diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index 70e81edb4375..bf1320c2a466 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -2656,18 +2656,16 @@ void BmpWindow::SetBitmapEx(const BitmapEx& rBmp)
 }
 
 // set URL and ImageMap at frames
-SwFrameURLPage::SwFrameURLPage( vcl::Window *pParent, const SfxItemSet &rSet ) :
-    SfxTabPage(pParent, "FrameURLPage" , "modules/swriter/ui/frmurlpage.ui", &rSet)
+SwFrameURLPage::SwFrameURLPage(TabPageParent pParent, const SfxItemSet &rSet)
+    : SfxTabPage(pParent, "modules/swriter/ui/frmurlpage.ui", "FrameURLPage", &rSet)
+    , m_xURLED(m_xBuilder->weld_entry("url"))
+    , m_xSearchPB(m_xBuilder->weld_button("search"))
+    , m_xNameED(m_xBuilder->weld_entry("name"))
+    , m_xFrameCB(m_xBuilder->weld_combo_box("frame"))
+    , m_xServerCB(m_xBuilder->weld_check_button("server"))
+    , m_xClientCB(m_xBuilder->weld_check_button("client"))
 {
-    get(pURLED,"url");
-    get(pSearchPB,"search");
-    get(pNameED,"name");
-    get(pFrameCB,"frame");
-
-    get(pServerCB,"server");
-    get(pClientCB,"client");
-
-    pSearchPB->SetClickHdl(LINK(this, SwFrameURLPage, InsertFileHdl));
+    m_xSearchPB->connect_clicked(LINK(this, SwFrameURLPage, InsertFileHdl));
 }
 
 SwFrameURLPage::~SwFrameURLPage()
@@ -2675,17 +2673,6 @@ SwFrameURLPage::~SwFrameURLPage()
     disposeOnce();
 }
 
-void SwFrameURLPage::dispose()
-{
-    pURLED.clear();
-    pSearchPB.clear();
-    pNameED.clear();
-    pFrameCB.clear();
-    pServerCB.clear();
-    pClientCB.clear();
-    SfxTabPage::dispose();
-}
-
 void SwFrameURLPage::Reset( const SfxItemSet *rSet )
 {
     const SfxPoolItem* pItem;
@@ -2696,9 +2683,9 @@ void SwFrameURLPage::Reset( const SfxItemSet *rSet )
         if( !pList->empty() )
         {
             size_t nCount = pList->size();
-            for ( size_t i = 0; i < nCount; i++ )
+            for (size_t i = 0; i < nCount; ++i)
             {
-                pFrameCB->InsertEntry( pList->at( i ) );
+                m_xFrameCB->append_text(pList->at(i));
             }
         }
     }
@@ -2706,22 +2693,22 @@ void SwFrameURLPage::Reset( const SfxItemSet *rSet )
     if ( SfxItemState::SET == rSet->GetItemState( RES_URL, true, &pItem ) )
     {
         const SwFormatURL* pFormatURL = static_cast<const SwFormatURL*>(pItem);
-        pURLED->SetText( INetURLObject::decode( pFormatURL->GetURL(),
-                                           INetURLObject::DecodeMechanism::Unambiguous ));
-        pNameED->SetText( pFormatURL->GetName());
+        m_xURLED->set_text(INetURLObject::decode(pFormatURL->GetURL(),
+                                           INetURLObject::DecodeMechanism::Unambiguous));
+        m_xNameED->set_text(pFormatURL->GetName());
 
-        pClientCB->Enable( pFormatURL->GetMap() != nullptr );
-        pClientCB->Check ( pFormatURL->GetMap() != nullptr );
-        pServerCB->Check ( pFormatURL->IsServerMap() );
+        m_xClientCB->set_sensitive(pFormatURL->GetMap() != nullptr);
+        m_xClientCB->set_active(pFormatURL->GetMap() != nullptr);
+        m_xServerCB->set_active(pFormatURL->IsServerMap());
 
-        pFrameCB->SetText(pFormatURL->GetTargetFrameName());
-        pFrameCB->SaveValue();
+        m_xFrameCB->set_entry_text(pFormatURL->GetTargetFrameName());
+        m_xFrameCB->save_value();
     }
     else
-        pClientCB->Enable( false );
+        m_xClientCB->set_sensitive(false);
 
-    pServerCB->SaveValue();
-    pClientCB->SaveValue();
+    m_xServerCB->save_state();
+    m_xClientCB->save_state();
 }
 
 bool SwFrameURLPage::FillItemSet(SfxItemSet *rSet)
@@ -2735,27 +2722,27 @@ bool SwFrameURLPage::FillItemSet(SfxItemSet *rSet)
         pFormatURL.reset(new SwFormatURL());
 
     {
-        const OUString sText = pURLED->GetText();
+        const OUString sText = m_xURLED->get_text();
 
         if( pFormatURL->GetURL() != sText ||
-            pFormatURL->GetName() != pNameED->GetText() ||
-            pServerCB->IsChecked() != pFormatURL->IsServerMap() )
+            pFormatURL->GetName() != m_xNameED->get_text() ||
+            m_xServerCB->get_active() != pFormatURL->IsServerMap() )
         {
-            pFormatURL->SetURL( sText, pServerCB->IsChecked() );
-            pFormatURL->SetName( pNameED->GetText() );
+            pFormatURL->SetURL(sText, m_xServerCB->get_active());
+            pFormatURL->SetName(m_xNameED->get_text());
             bModified = true;
         }
     }
 
-    if(!pClientCB->IsChecked() && pFormatURL->GetMap() != nullptr)
+    if (!m_xClientCB->get_active() && pFormatURL->GetMap() != nullptr)
     {
         pFormatURL->SetMap(nullptr);
         bModified = true;
     }
 
-    if(pFormatURL->GetTargetFrameName() != pFrameCB->GetText())
+    if(pFormatURL->GetTargetFrameName() != m_xFrameCB->get_active_text())
     {
-        pFormatURL->SetTargetFrameName(pFrameCB->GetText());
+        pFormatURL->SetTargetFrameName(m_xFrameCB->get_active_text());
         bModified = true;
     }
     rSet->Put(*pFormatURL);
@@ -2764,10 +2751,10 @@ bool SwFrameURLPage::FillItemSet(SfxItemSet *rSet)
 
 VclPtr<SfxTabPage> SwFrameURLPage::Create(TabPageParent pParent, const SfxItemSet *rSet)
 {
-    return VclPtr<SwFrameURLPage>::Create( pParent.pParent, *rSet );
+    return VclPtr<SwFrameURLPage>::Create(pParent, *rSet);
 }
 
-IMPL_LINK_NOARG(SwFrameURLPage, InsertFileHdl, Button*, void)
+IMPL_LINK_NOARG(SwFrameURLPage, InsertFileHdl, weld::Button&, void)
 {
     FileDialogHelper aDlgHelper(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
                                 FileDialogFlags::NONE, GetFrameWeld());
@@ -2775,14 +2762,14 @@ IMPL_LINK_NOARG(SwFrameURLPage, InsertFileHdl, Button*, void)
 
     try
     {
-        const OUString sTemp(pURLED->GetText());
+        const OUString sTemp(m_xURLED->get_text());
         if(!sTemp.isEmpty())
             xFP->setDisplayDirectory(sTemp);
     }
     catch( const uno::Exception& ) {}
     if( aDlgHelper.Execute() == ERRCODE_NONE )
     {
-        pURLED->SetText( xFP->getSelectedFiles().getConstArray()[0] );
+        m_xURLED->set_text(xFP->getSelectedFiles().getConstArray()[0]);
     }
 }
 
diff --git a/sw/source/uibase/inc/frmpage.hxx b/sw/source/uibase/inc/frmpage.hxx
index f635b9e50213..a3b9691c4230 100644
--- a/sw/source/uibase/inc/frmpage.hxx
+++ b/sw/source/uibase/inc/frmpage.hxx
@@ -255,24 +255,23 @@ public:
 class SwFrameURLPage : public SfxTabPage
 {
     // hyperlink
-    VclPtr<Edit>            pURLED;
-    VclPtr<PushButton>      pSearchPB;
-    VclPtr<Edit>            pNameED;
-    VclPtr<ComboBox>        pFrameCB;
+    std::unique_ptr<weld::Entry> m_xURLED;
+    std::unique_ptr<weld::Button> m_xSearchPB;
+    std::unique_ptr<weld::Entry> m_xNameED;
+    std::unique_ptr<weld::ComboBox> m_xFrameCB;
 
     // image map
-    VclPtr<CheckBox>        pServerCB;
-    VclPtr<CheckBox>        pClientCB;
+    std::unique_ptr<weld::CheckButton> m_xServerCB;
+    std::unique_ptr<weld::CheckButton> m_xClientCB;
 
-    DECL_LINK(InsertFileHdl, Button*, void);
+    DECL_LINK(InsertFileHdl, weld::Button&, void);
 
     using SfxTabPage::ActivatePage;
     using SfxTabPage::DeactivatePage;
 
 public:
-    SwFrameURLPage(vcl::Window *pParent, const SfxItemSet &rSet);
+    SwFrameURLPage(TabPageParent pParent, const SfxItemSet &rSet);
     virtual ~SwFrameURLPage() override;
-    virtual void dispose() override;
 
     static VclPtr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet *rSet);
 
diff --git a/sw/uiconfig/swriter/ui/frmurlpage.ui b/sw/uiconfig/swriter/ui/frmurlpage.ui
index 7323ecdd7e9f..271844fab5c8 100644
--- a/sw/uiconfig/swriter/ui/frmurlpage.ui
+++ b/sw/uiconfig/swriter/ui/frmurlpage.ui
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
 <interface domain="sw">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkBox" id="FrameURLPage">
@@ -35,12 +36,11 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="hexpand">True</property>
+                    <property name="activates_default">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>
@@ -48,60 +48,53 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="hexpand">True</property>
+                    <property name="activates_default">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>
                   <object class="GtkLabel" id="url_label">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
                     <property name="label" translatable="yes" context="frmurlpage|url_label">_URL:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">url</property>
+                    <property name="xalign">0</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="name_label">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
                     <property name="label" translatable="yes" context="frmurlpage|name_label">_Name:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">name</property>
+                    <property name="xalign">0</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="GtkLabel" id="frame_label">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
                     <property name="label" translatable="yes" context="frmurlpage|frame_label">_Frame:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">frame</property>
+                    <property name="xalign">0</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
                     <property name="top_attach">2</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
                   </packing>
                 </child>
                 <child>
@@ -127,8 +120,6 @@
                   <packing>
                     <property name="left_attach">2</property>
                     <property name="top_attach">0</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
                   </packing>
                 </child>
                 <child>
@@ -137,19 +128,16 @@
                     <property name="can_focus">False</property>
                     <property name="hexpand">True</property>
                     <property name="has_entry">True</property>
-                    <property name="entry_text_column">0</property>
-                    <property name="id_column">1</property>
                     <child internal-child="entry">
                       <object class="GtkEntry" id="comboboxtext-entry">
                         <property name="can_focus">False</property>
+                        <property name="activates_default">True</property>
                       </object>
                     </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>
@@ -217,8 +205,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>
                 <child>
@@ -235,8 +221,6 @@
                   <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>
               </object>


More information about the Libreoffice-commits mailing list