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)
}
// 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()
......@@ -2762,17 +2760,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;
......@@ -2783,9 +2770,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));
}
}
}
......@@ -2793,22 +2780,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)
......@@ -2822,27 +2809,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);
......@@ -2851,10 +2838,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());
......@@ -2862,14 +2849,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]);
}
}
......
......@@ -254,24 +254,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);
......
<?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>
......
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