Kaydet (Commit) e796f0b4 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld SwFrameURLPage

Change-Id: If189c6bbc11f85a47e3908e4ffcef36344ff8f9d
Reviewed-on: https://gerrit.libreoffice.org/63819
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 257a187a
...@@ -2743,18 +2743,16 @@ void BmpWindow::SetBitmapEx(const BitmapEx& rBmp) ...@@ -2743,18 +2743,16 @@ void BmpWindow::SetBitmapEx(const BitmapEx& rBmp)
} }
// set URL and ImageMap at frames // set URL and ImageMap at frames
SwFrameURLPage::SwFrameURLPage( vcl::Window *pParent, const SfxItemSet &rSet ) : SwFrameURLPage::SwFrameURLPage(TabPageParent pParent, const SfxItemSet &rSet)
SfxTabPage(pParent, "FrameURLPage" , "modules/swriter/ui/frmurlpage.ui", &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"); m_xSearchPB->connect_clicked(LINK(this, SwFrameURLPage, InsertFileHdl));
get(pSearchPB,"search");
get(pNameED,"name");
get(pFrameCB,"frame");
get(pServerCB,"server");
get(pClientCB,"client");
pSearchPB->SetClickHdl(LINK(this, SwFrameURLPage, InsertFileHdl));
} }
SwFrameURLPage::~SwFrameURLPage() SwFrameURLPage::~SwFrameURLPage()
...@@ -2762,17 +2760,6 @@ SwFrameURLPage::~SwFrameURLPage() ...@@ -2762,17 +2760,6 @@ SwFrameURLPage::~SwFrameURLPage()
disposeOnce(); disposeOnce();
} }
void SwFrameURLPage::dispose()
{
pURLED.clear();
pSearchPB.clear();
pNameED.clear();
pFrameCB.clear();
pServerCB.clear();
pClientCB.clear();
SfxTabPage::dispose();
}
void SwFrameURLPage::Reset( const SfxItemSet *rSet ) void SwFrameURLPage::Reset( const SfxItemSet *rSet )
{ {
const SfxPoolItem* pItem; const SfxPoolItem* pItem;
...@@ -2783,9 +2770,9 @@ void SwFrameURLPage::Reset( const SfxItemSet *rSet ) ...@@ -2783,9 +2770,9 @@ void SwFrameURLPage::Reset( const SfxItemSet *rSet )
if( !pList->empty() ) if( !pList->empty() )
{ {
size_t nCount = pList->size(); 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));
} }
} }
} }
...@@ -2793,22 +2780,22 @@ void SwFrameURLPage::Reset( const SfxItemSet *rSet ) ...@@ -2793,22 +2780,22 @@ void SwFrameURLPage::Reset( const SfxItemSet *rSet )
if ( SfxItemState::SET == rSet->GetItemState( RES_URL, true, &pItem ) ) if ( SfxItemState::SET == rSet->GetItemState( RES_URL, true, &pItem ) )
{ {
const SwFormatURL* pFormatURL = static_cast<const SwFormatURL*>(pItem); const SwFormatURL* pFormatURL = static_cast<const SwFormatURL*>(pItem);
pURLED->SetText( INetURLObject::decode( pFormatURL->GetURL(), m_xURLED->set_text(INetURLObject::decode(pFormatURL->GetURL(),
INetURLObject::DecodeMechanism::Unambiguous )); INetURLObject::DecodeMechanism::Unambiguous));
pNameED->SetText( pFormatURL->GetName()); m_xNameED->set_text(pFormatURL->GetName());
pClientCB->Enable( pFormatURL->GetMap() != nullptr ); m_xClientCB->set_sensitive(pFormatURL->GetMap() != nullptr);
pClientCB->Check ( pFormatURL->GetMap() != nullptr ); m_xClientCB->set_active(pFormatURL->GetMap() != nullptr);
pServerCB->Check ( pFormatURL->IsServerMap() ); m_xServerCB->set_active(pFormatURL->IsServerMap());
pFrameCB->SetText(pFormatURL->GetTargetFrameName()); m_xFrameCB->set_entry_text(pFormatURL->GetTargetFrameName());
pFrameCB->SaveValue(); m_xFrameCB->save_value();
} }
else else
pClientCB->Enable( false ); m_xClientCB->set_sensitive(false);
pServerCB->SaveValue(); m_xServerCB->save_state();
pClientCB->SaveValue(); m_xClientCB->save_state();
} }
bool SwFrameURLPage::FillItemSet(SfxItemSet *rSet) bool SwFrameURLPage::FillItemSet(SfxItemSet *rSet)
...@@ -2822,27 +2809,27 @@ bool SwFrameURLPage::FillItemSet(SfxItemSet *rSet) ...@@ -2822,27 +2809,27 @@ bool SwFrameURLPage::FillItemSet(SfxItemSet *rSet)
pFormatURL.reset(new SwFormatURL()); pFormatURL.reset(new SwFormatURL());
{ {
const OUString sText = pURLED->GetText(); const OUString sText = m_xURLED->get_text();
if( pFormatURL->GetURL() != sText || if( pFormatURL->GetURL() != sText ||
pFormatURL->GetName() != pNameED->GetText() || pFormatURL->GetName() != m_xNameED->get_text() ||
pServerCB->IsChecked() != pFormatURL->IsServerMap() ) m_xServerCB->get_active() != pFormatURL->IsServerMap() )
{ {
pFormatURL->SetURL( sText, pServerCB->IsChecked() ); pFormatURL->SetURL(sText, m_xServerCB->get_active());
pFormatURL->SetName( pNameED->GetText() ); pFormatURL->SetName(m_xNameED->get_text());
bModified = true; bModified = true;
} }
} }
if(!pClientCB->IsChecked() && pFormatURL->GetMap() != nullptr) if (!m_xClientCB->get_active() && pFormatURL->GetMap() != nullptr)
{ {
pFormatURL->SetMap(nullptr); pFormatURL->SetMap(nullptr);
bModified = true; 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; bModified = true;
} }
rSet->Put(*pFormatURL); rSet->Put(*pFormatURL);
...@@ -2851,10 +2838,10 @@ bool SwFrameURLPage::FillItemSet(SfxItemSet *rSet) ...@@ -2851,10 +2838,10 @@ bool SwFrameURLPage::FillItemSet(SfxItemSet *rSet)
VclPtr<SfxTabPage> SwFrameURLPage::Create(TabPageParent pParent, const 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, FileDialogHelper aDlgHelper(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
FileDialogFlags::NONE, GetFrameWeld()); FileDialogFlags::NONE, GetFrameWeld());
...@@ -2862,14 +2849,14 @@ IMPL_LINK_NOARG(SwFrameURLPage, InsertFileHdl, Button*, void) ...@@ -2862,14 +2849,14 @@ IMPL_LINK_NOARG(SwFrameURLPage, InsertFileHdl, Button*, void)
try try
{ {
const OUString sTemp(pURLED->GetText()); const OUString sTemp(m_xURLED->get_text());
if(!sTemp.isEmpty()) if(!sTemp.isEmpty())
xFP->setDisplayDirectory(sTemp); xFP->setDisplayDirectory(sTemp);
} }
catch( const uno::Exception& ) {} catch( const uno::Exception& ) {}
if( aDlgHelper.Execute() == ERRCODE_NONE ) if( aDlgHelper.Execute() == ERRCODE_NONE )
{ {
pURLED->SetText( xFP->getSelectedFiles().getConstArray()[0] ); m_xURLED->set_text(xFP->getSelectedFiles().getConstArray()[0]);
} }
} }
......
...@@ -254,24 +254,23 @@ public: ...@@ -254,24 +254,23 @@ public:
class SwFrameURLPage : public SfxTabPage class SwFrameURLPage : public SfxTabPage
{ {
// hyperlink // hyperlink
VclPtr<Edit> pURLED; std::unique_ptr<weld::Entry> m_xURLED;
VclPtr<PushButton> pSearchPB; std::unique_ptr<weld::Button> m_xSearchPB;
VclPtr<Edit> pNameED; std::unique_ptr<weld::Entry> m_xNameED;
VclPtr<ComboBox> pFrameCB; std::unique_ptr<weld::ComboBox> m_xFrameCB;
// image map // image map
VclPtr<CheckBox> pServerCB; std::unique_ptr<weld::CheckButton> m_xServerCB;
VclPtr<CheckBox> pClientCB; std::unique_ptr<weld::CheckButton> m_xClientCB;
DECL_LINK(InsertFileHdl, Button*, void); DECL_LINK(InsertFileHdl, weld::Button&, void);
using SfxTabPage::ActivatePage; using SfxTabPage::ActivatePage;
using SfxTabPage::DeactivatePage; using SfxTabPage::DeactivatePage;
public: public:
SwFrameURLPage(vcl::Window *pParent, const SfxItemSet &rSet); SwFrameURLPage(TabPageParent pParent, const SfxItemSet &rSet);
virtual ~SwFrameURLPage() override; virtual ~SwFrameURLPage() override;
virtual void dispose() override;
static VclPtr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet *rSet); static VclPtr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet *rSet);
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface domain="sw"> <interface domain="sw">
<requires lib="gtk+" version="3.18"/> <requires lib="gtk+" version="3.18"/>
<object class="GtkBox" id="FrameURLPage"> <object class="GtkBox" id="FrameURLPage">
...@@ -35,12 +36,11 @@ ...@@ -35,12 +36,11 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="activates_default">True</property>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="top_attach">0</property> <property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing> </packing>
</child> </child>
<child> <child>
...@@ -48,60 +48,53 @@ ...@@ -48,60 +48,53 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="activates_default">True</property>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="top_attach">1</property> <property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="url_label"> <object class="GtkLabel" id="url_label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</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="label" translatable="yes" context="frmurlpage|url_label">_URL:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">url</property> <property name="mnemonic_widget">url</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
<property name="top_attach">0</property> <property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="name_label"> <object class="GtkLabel" id="name_label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</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="label" translatable="yes" context="frmurlpage|name_label">_Name:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">name</property> <property name="mnemonic_widget">name</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
<property name="top_attach">1</property> <property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="frame_label"> <object class="GtkLabel" id="frame_label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</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="label" translatable="yes" context="frmurlpage|frame_label">_Frame:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">frame</property> <property name="mnemonic_widget">frame</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
<property name="top_attach">2</property> <property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing> </packing>
</child> </child>
<child> <child>
...@@ -127,8 +120,6 @@ ...@@ -127,8 +120,6 @@
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>
<property name="top_attach">0</property> <property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing> </packing>
</child> </child>
<child> <child>
...@@ -137,19 +128,16 @@ ...@@ -137,19 +128,16 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="has_entry">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"> <child internal-child="entry">
<object class="GtkEntry" id="comboboxtext-entry"> <object class="GtkEntry" id="comboboxtext-entry">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="activates_default">True</property>
</object> </object>
</child> </child>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="top_attach">2</property> <property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing> </packing>
</child> </child>
<child> <child>
...@@ -217,8 +205,6 @@ ...@@ -217,8 +205,6 @@
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
<property name="top_attach">0</property> <property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing> </packing>
</child> </child>
<child> <child>
...@@ -235,8 +221,6 @@ ...@@ -235,8 +221,6 @@
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
<property name="top_attach">1</property> <property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing> </packing>
</child> </child>
</object> </object>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment