diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-09-13 12:40:17 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-09-13 18:05:03 +0200 |
commit | 88f7ac5ccd358069e356c544888386b745c82732 (patch) | |
tree | e3afbbfcc537f14dd9b409be8ab71106e7bbded3 /sfx2/source/dialog | |
parent | 74edbc474975266a1cee36d47cb0443808f9c19a (diff) |
add GetDialogExampleSet rather than guess at it
Change-Id: I8d7fc780c77e7f410ce78eb07bcb92dcd71f6c13
Reviewed-on: https://gerrit.libreoffice.org/60434
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2/source/dialog')
-rw-r--r-- | sfx2/source/dialog/dinfdlg.cxx | 26 | ||||
-rw-r--r-- | sfx2/source/dialog/tabdlg.cxx | 9 |
2 files changed, 19 insertions, 16 deletions
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index ea9cf40d5d9c..c015edebeff6 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -641,11 +641,7 @@ bool SfxDocumentDescPage::FillItemSet(SfxItemSet *rSet) // Generating the output data const SfxPoolItem* pItem = nullptr; SfxDocumentInfoItem* pInfo = nullptr; - SfxTabDialog* pDlg = GetTabDialog(); - const SfxItemSet* pExSet = nullptr; - - if ( pDlg ) - pExSet = pDlg->GetExampleSet(); + const SfxItemSet* pExSet = GetDialogExampleSet(); if ( pExSet && SfxItemState::SET != pExSet->GetItemState( SID_DOCINFO, true, &pItem ) ) pInfo = m_pInfoItem; @@ -938,9 +934,9 @@ bool SfxDocumentPage::FillItemSet( SfxItemSet* rSet ) if ( !bHandleDelete && bEnableUseUserData && m_pUseUserDataCB->IsValueChangedFromSaved() && - GetTabDialog() && GetTabDialog()->GetExampleSet() ) + GetDialogExampleSet() ) { - const SfxItemSet* pExpSet = GetTabDialog()->GetExampleSet(); + const SfxItemSet* pExpSet = GetDialogExampleSet(); const SfxPoolItem* pItem; if ( pExpSet && SfxItemState::SET == pExpSet->GetItemState( SID_DOCINFO, true, &pItem ) ) @@ -955,7 +951,7 @@ bool SfxDocumentPage::FillItemSet( SfxItemSet* rSet ) if ( bHandleDelete ) { - const SfxItemSet* pExpSet = GetTabDialog()->GetExampleSet(); + const SfxItemSet* pExpSet = GetDialogExampleSet(); const SfxPoolItem* pItem; if ( pExpSet && SfxItemState::SET == pExpSet->GetItemState( SID_DOCINFO, true, &pItem ) ) { @@ -975,9 +971,9 @@ bool SfxDocumentPage::FillItemSet( SfxItemSet* rSet ) } if ( m_pUseThumbnailSaveCB->IsValueChangedFromSaved() && - GetTabDialog() && GetTabDialog()->GetExampleSet() ) + GetDialogExampleSet() ) { - const SfxItemSet* pExpSet = GetTabDialog()->GetExampleSet(); + const SfxItemSet* pExpSet = GetDialogExampleSet(); const SfxPoolItem* pItem; if ( pExpSet && SfxItemState::SET == pExpSet->GetItemState( SID_DOCINFO, true, &pItem ) ) @@ -2151,10 +2147,9 @@ bool SfxCustomPropertiesPage::FillItemSet( SfxItemSet* rSet ) SfxDocumentInfoItem* pInfo = nullptr; bool bMustDelete = false; - if ( GetTabDialog() && GetTabDialog()->GetExampleSet() ) + if (const SfxItemSet* pItemSet = GetDialogExampleSet()) { - if ( SfxItemState::SET != - GetTabDialog()->GetExampleSet()->GetItemState( SID_DOCINFO, true, &pItem ) ) + if (SfxItemState::SET != pItemSet->GetItemState(SID_DOCINFO, true, &pItem)) pInfo = const_cast<SfxDocumentInfoItem*>(&rSet->Get( SID_DOCINFO )); else { @@ -2619,10 +2614,9 @@ bool SfxCmisPropertiesPage::FillItemSet( SfxItemSet* rSet ) SfxDocumentInfoItem* pInfo = nullptr; bool bMustDelete = false; - if ( GetTabDialog() && GetTabDialog()->GetExampleSet() ) + if (const SfxItemSet* pItemSet = GetDialogExampleSet()) { - if ( SfxItemState::SET != - GetTabDialog()->GetExampleSet()->GetItemState( SID_DOCINFO, true, &pItem ) ) + if (SfxItemState::SET != pItemSet->GetItemState(SID_DOCINFO, true, &pItem)) pInfo = const_cast<SfxDocumentInfoItem*>(&rSet->Get( SID_DOCINFO )); else { diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index 3890448fc6d0..57a21626add1 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -369,6 +369,15 @@ weld::Window* SfxTabPage::GetDialogFrameWeld() const return GetFrameWeld(); } +const SfxItemSet* SfxTabPage::GetDialogExampleSet() const +{ + if (pImpl->mpDialogController) + return pImpl->mpDialogController->GetExampleSet(); + if (pImpl->mxDialog) + return pImpl->mxDialog->GetExampleSet(); + return nullptr; +} + SfxTabDialog::SfxTabDialog /* [Description] |