diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-06-18 10:32:50 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-06-18 16:21:24 +0200 |
commit | b2e4fbba6ae627d1258dd8a9351b77ffc2e4e280 (patch) | |
tree | a6ac17ec50fc8d250024d11d09fc0fcba3a9811e /sfx2 | |
parent | 04f91f249b6ecaf87db983f7dcf514bbf4100b6b (diff) |
weld SfxDocumentDescPage
Change-Id: I52abfe33e39fbb2e96fe0634b9ac3d8d50068ee7
Reviewed-on: https://gerrit.libreoffice.org/56025
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/dialog/dinfdlg.cxx | 72 | ||||
-rw-r--r-- | sfx2/uiconfig/ui/descriptioninfopage.ui | 14 |
2 files changed, 39 insertions, 47 deletions
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 84ebee9d8c62..7d5c39c5a27f 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -605,45 +605,34 @@ bool SfxDocumentInfoItem::PutValue( const Any& rVal, sal_uInt8 nMemberId ) return bRet; } -SfxDocumentDescPage::SfxDocumentDescPage( vcl::Window * pParent, const SfxItemSet& rItemSet ) - : SfxTabPage(pParent, "DescriptionInfoPage", "sfx/ui/descriptioninfopage.ui", &rItemSet) - , m_pInfoItem ( nullptr ) - +SfxDocumentDescPage::SfxDocumentDescPage(TabPageParent pParent, const SfxItemSet& rItemSet) + : SfxTabPage(pParent, "sfx/ui/descriptioninfopage.ui", "DescriptionInfoPage", &rItemSet) + , m_pInfoItem( nullptr) + , m_xTitleEd(m_xBuilder->weld_entry("title")) + , m_xThemaEd(m_xBuilder->weld_entry("subject")) + , m_xKeywordsEd(m_xBuilder->weld_entry("keywords")) + , m_xCommentEd(m_xBuilder->weld_text_view("comments")) { - get(m_pTitleEd, "title"); - get(m_pThemaEd, "subject"); - get(m_pKeywordsEd, "keywords"); - get(m_pCommentEd, "comments"); - m_pCommentEd->set_width_request(m_pKeywordsEd->get_preferred_size().Width()); - m_pCommentEd->set_height_request(m_pCommentEd->GetTextHeight() * 16); + m_xCommentEd->set_size_request(m_xKeywordsEd->get_preferred_size().Width(), + m_xCommentEd->get_height_rows(16)); } SfxDocumentDescPage::~SfxDocumentDescPage() { - disposeOnce(); -} - -void SfxDocumentDescPage::dispose() -{ - m_pTitleEd.clear(); - m_pThemaEd.clear(); - m_pKeywordsEd.clear(); - m_pCommentEd.clear(); - SfxTabPage::dispose(); } VclPtr<SfxTabPage> SfxDocumentDescPage::Create(TabPageParent pParent, const SfxItemSet *rItemSet) { - return VclPtr<SfxDocumentDescPage>::Create(pParent.pParent, *rItemSet); + return VclPtr<SfxDocumentDescPage>::Create(pParent, *rItemSet); } bool SfxDocumentDescPage::FillItemSet(SfxItemSet *rSet) { // Test whether a change is present - const bool bTitleMod = m_pTitleEd->IsModified(); - const bool bThemeMod = m_pThemaEd->IsModified(); - const bool bKeywordsMod = m_pKeywordsEd->IsModified(); - const bool bCommentMod = m_pCommentEd->IsModified(); + const bool bTitleMod = m_xTitleEd->get_value_changed_from_saved(); + const bool bThemeMod = m_xThemaEd->get_value_changed_from_saved(); + const bool bKeywordsMod = m_xKeywordsEd->get_value_changed_from_saved(); + const bool bCommentMod = m_xCommentEd->get_value_changed_from_saved(); if ( !( bTitleMod || bThemeMod || bKeywordsMod || bCommentMod ) ) { return false; @@ -671,19 +660,19 @@ bool SfxDocumentDescPage::FillItemSet(SfxItemSet *rSet) if ( bTitleMod ) { - pInfo->setTitle( m_pTitleEd->GetText() ); + pInfo->setTitle( m_xTitleEd->get_text() ); } if ( bThemeMod ) { - pInfo->setSubject( m_pThemaEd->GetText() ); + pInfo->setSubject( m_xThemaEd->get_text() ); } if ( bKeywordsMod ) { - pInfo->setKeywords( m_pKeywordsEd->GetText() ); + pInfo->setKeywords( m_xKeywordsEd->get_text() ); } if ( bCommentMod ) { - pInfo->setDescription( m_pCommentEd->GetText() ); + pInfo->setDescription( m_xCommentEd->get_text() ); } rSet->Put( *pInfo ); if ( pInfo != m_pInfoItem ) @@ -694,27 +683,30 @@ bool SfxDocumentDescPage::FillItemSet(SfxItemSet *rSet) return true; } - void SfxDocumentDescPage::Reset(const SfxItemSet *rSet) { m_pInfoItem = const_cast<SfxDocumentInfoItem*>(&rSet->Get(SID_DOCINFO)); - m_pTitleEd->SetText( m_pInfoItem->getTitle() ); - m_pThemaEd->SetText( m_pInfoItem->getSubject() ); - m_pKeywordsEd->SetText( m_pInfoItem->getKeywords() ); - m_pCommentEd->SetText( m_pInfoItem->getDescription() ); + m_xTitleEd->set_text(m_pInfoItem->getTitle()); + m_xThemaEd->set_text(m_pInfoItem->getSubject()); + m_xKeywordsEd->set_text(m_pInfoItem->getKeywords()); + m_xCommentEd->set_text(m_pInfoItem->getDescription()); + + m_xTitleEd->save_value(); + m_xThemaEd->save_value(); + m_xKeywordsEd->save_value(); + m_xCommentEd->save_value(); const SfxBoolItem* pROItem = SfxItemSet::GetItem<SfxBoolItem>(rSet, SID_DOC_READONLY, false); - if ( pROItem && pROItem->GetValue() ) + if (pROItem && pROItem->GetValue()) { - m_pTitleEd->SetReadOnly(); - m_pThemaEd->SetReadOnly(); - m_pKeywordsEd->SetReadOnly(); - m_pCommentEd->SetReadOnly(); + m_xTitleEd->set_editable(false); + m_xThemaEd->set_editable(false); + m_xKeywordsEd->set_editable(false); + m_xCommentEd->set_editable(false); } } - namespace { OUString GetDateTimeString( sal_Int32 _nDate, sal_Int32 _nTime ) diff --git a/sfx2/uiconfig/ui/descriptioninfopage.ui b/sfx2/uiconfig/ui/descriptioninfopage.ui index 29e68e4d558e..f2db5badd612 100644 --- a/sfx2/uiconfig/ui/descriptioninfopage.ui +++ b/sfx2/uiconfig/ui/descriptioninfopage.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="GtkGrid" id="DescriptionInfoPage"> @@ -14,10 +14,10 @@ <object class="GtkLabel" id="label27"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="descriptioninfopage|label27">_Title:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">title</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -28,10 +28,10 @@ <object class="GtkLabel" id="label28"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="descriptioninfopage|label28">_Subject:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">subject</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -42,10 +42,10 @@ <object class="GtkLabel" id="label29"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="descriptioninfopage|label29">_Keywords:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">keywords</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -57,10 +57,10 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="valign">start</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="descriptioninfopage|label30">_Comments:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">comments:border</property> + <property name="mnemonic_widget">comments</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -108,7 +108,7 @@ <property name="vexpand">True</property> <property name="shadow_type">in</property> <child> - <object class="GtkTextView" id="comments:border"> + <object class="GtkTextView" id="comments"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> |