summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-09-13 12:40:17 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-09-13 18:05:03 +0200
commit88f7ac5ccd358069e356c544888386b745c82732 (patch)
treee3afbbfcc537f14dd9b409be8ab71106e7bbded3
parent74edbc474975266a1cee36d47cb0443808f9c19a (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>
-rw-r--r--cui/source/tabpages/chardlg.cxx4
-rw-r--r--cui/source/tabpages/grfpage.cxx2
-rw-r--r--cui/source/tabpages/numpages.cxx12
-rw-r--r--include/sfx2/tabdlg.hxx2
-rw-r--r--sc/source/ui/dbgui/tpsort.cxx14
-rw-r--r--sc/source/ui/dbgui/tpsubt.cxx14
-rw-r--r--sfx2/source/dialog/dinfdlg.cxx26
-rw-r--r--sfx2/source/dialog/tabdlg.cxx9
-rw-r--r--sw/source/ui/envelp/label1.cxx4
-rw-r--r--sw/source/ui/frmdlg/frmpage.cxx6
-rw-r--r--sw/source/ui/misc/num.cxx2
-rw-r--r--sw/source/ui/misc/pggrid.cxx2
12 files changed, 50 insertions, 47 deletions
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index 1bb2f41b4f82..e8183ecc0ba9 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -937,7 +937,7 @@ bool SvxCharNamePage::FillItemSet_Impl( SfxItemSet& rSet, LanguageGroup eLangGrp
const SfxItemSet& rOldSet = GetItemSet();
const SfxPoolItem* pOld = nullptr;
- const SfxItemSet* pExampleSet = GetTabDialog() ? GetTabDialog()->GetExampleSet() : nullptr;
+ const SfxItemSet* pExampleSet = GetDialogExampleSet();
bool bChanged = true;
const OUString& rFontName = pNameBox->GetText();
@@ -2361,7 +2361,7 @@ bool SvxCharEffectsPage::FillItemSet( SfxItemSet* rSet )
}
// Outline
- const SfxItemSet* pExampleSet = GetTabDialog() ? GetTabDialog()->GetExampleSet() : nullptr;
+ const SfxItemSet* pExampleSet = GetDialogExampleSet();
nWhich = GetWhich( SID_ATTR_CHAR_CONTOUR );
pOld = GetOldItem( *rSet, SID_ATTR_CHAR_CONTOUR );
TriState eState = m_xOutlineBtn->get_state();
diff --git a/cui/source/tabpages/grfpage.cxx b/cui/source/tabpages/grfpage.cxx
index 0d1b9c8af88c..abcddd4b5af3 100644
--- a/cui/source/tabpages/grfpage.cxx
+++ b/cui/source/tabpages/grfpage.cxx
@@ -271,7 +271,7 @@ bool SvxGrfCropPage::FillItemSet(SfxItemSet *rSet)
SvxSizeItem aSz( nW );
// size could already have been set from another page
- const SfxItemSet* pExSet = GetTabDialog() ? GetTabDialog()->GetExampleSet() : nullptr;
+ const SfxItemSet* pExSet = GetDialogExampleSet();
const SfxPoolItem* pItem = nullptr;
if( pExSet && SfxItemState::SET ==
pExSet->GetItemState( nW, false, &pItem ) )
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 8863e5fa968c..9edbc09a02bc 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -247,7 +247,7 @@ void SvxSingleNumPickTabPage::ActivatePage(const SfxItemSet& rSet)
const SfxPoolItem* pItem;
bPreset = false;
bool bIsPreset = false;
- const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
+ const SfxItemSet* pExampleSet = GetDialogExampleSet();
if(pExampleSet)
{
if(SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, false, &pItem))
@@ -404,7 +404,7 @@ void SvxBulletPickTabPage::ActivatePage(const SfxItemSet& rSet)
const SfxPoolItem* pItem;
bPreset = false;
bool bIsPreset = false;
- const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
+ const SfxItemSet* pExampleSet = GetDialogExampleSet();
if(pExampleSet)
{
if(SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, false, &pItem))
@@ -593,7 +593,7 @@ void SvxNumPickTabPage::ActivatePage(const SfxItemSet& rSet)
const SfxPoolItem* pItem;
bPreset = false;
bool bIsPreset = false;
- const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
+ const SfxItemSet* pExampleSet = GetDialogExampleSet();
if(pExampleSet)
{
if(SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, false, &pItem))
@@ -826,7 +826,7 @@ void SvxBitmapPickTabPage::ActivatePage(const SfxItemSet& rSet)
const SfxPoolItem* pItem;
bPreset = false;
bool bIsPreset = false;
- const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
+ const SfxItemSet* pExampleSet = GetDialogExampleSet();
if(pExampleSet)
{
if(SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, false, &pItem))
@@ -1217,7 +1217,7 @@ VclPtr<SfxTabPage> SvxNumOptionsTabPage::Create( TabPageParent pParent,
void SvxNumOptionsTabPage::ActivatePage(const SfxItemSet& rSet)
{
const SfxPoolItem* pItem;
- const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
+ const SfxItemSet* pExampleSet = GetDialogExampleSet();
sal_uInt16 nTmpNumLvl = 1;
if(pExampleSet)
{
@@ -3081,7 +3081,7 @@ void SvxNumPositionTabPage::ActivatePage(const SfxItemSet& rSet)
{
const SfxPoolItem* pItem;
sal_uInt16 nTmpNumLvl = 1;
- const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
+ const SfxItemSet* pExampleSet = GetDialogExampleSet();
if(pExampleSet)
{
if(SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, false, &pItem))
diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx
index 8102ff3ba0b6..9db50e400958 100644
--- a/include/sfx2/tabdlg.hxx
+++ b/include/sfx2/tabdlg.hxx
@@ -406,6 +406,8 @@ public:
void SetFrame(const css::uno::Reference< css::frame::XFrame >& xFrame);
css::uno::Reference< css::frame::XFrame > GetFrame();
+ const SfxItemSet* GetDialogExampleSet() const;
+
OString GetConfigId() const;
//TODO rename to GetFrameWeld when SfxTabPage doesn't inherit from anything
diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx
index 0663f6eaea12..c97a0bed3e74 100644
--- a/sc/source/ui/dbgui/tpsort.cxx
+++ b/sc/source/ui/dbgui/tpsort.cxx
@@ -219,12 +219,11 @@ bool ScTabPageSortFields::FillItemSet( SfxItemSet* rArgSet )
{
ScSortParam aNewSortData = aSortData;
- ScSortDlg* pDlg = static_cast<ScSortDlg*>(GetDialogController());
- if (pDlg)
+ const SfxItemSet* pExample = GetDialogExampleSet();
+ if (pExample)
{
- const SfxItemSet* pExample = pDlg->GetExampleSet();
const SfxPoolItem* pItem;
- if ( pExample && pExample->GetItemState( nWhichSort, true, &pItem ) == SfxItemState::SET )
+ if (pExample->GetItemState(nWhichSort, true, &pItem) == SfxItemState::SET)
{
ScSortParam aTempData = static_cast<const ScSortItem*>(pItem)->GetSortData();
aTempData.maKeyState = aNewSortData.maKeyState;
@@ -250,6 +249,7 @@ bool ScTabPageSortFields::FillItemSet( SfxItemSet* rArgSet )
// If the "OK" was selected on the Options page while the sort
// direction was changed, then the first field (i.e. nFieldArr[0])
// of the respective direction is chosen as the sorting criterion:
+ ScSortDlg* pDlg = static_cast<ScSortDlg*>(GetDialogController());
if ( pDlg && bSortByRows != pDlg->GetByRows() )
{
for ( sal_uInt16 i=0; i<nSortKeyCount; i++ )
@@ -661,11 +661,11 @@ bool ScTabPageSortOptions::FillItemSet( SfxItemSet* rArgSet )
// Create local copy of ScParam
ScSortParam aNewSortData = aSortData;
- if (ScSortDlg* pDlg = static_cast<ScSortDlg*>(GetDialogController()))
+ const SfxItemSet* pExample = GetDialogExampleSet();
+ if (pExample)
{
- const SfxItemSet* pExample = pDlg->GetExampleSet();
const SfxPoolItem* pItem;
- if ( pExample && pExample->GetItemState( nWhichSort, true, &pItem ) == SfxItemState::SET )
+ if (pExample->GetItemState(nWhichSort, true, &pItem) == SfxItemState::SET)
aNewSortData = static_cast<const ScSortItem*>(pItem)->GetSortData();
}
aNewSortData.bByRow = m_xBtnTopDown->get_active();
diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx
index b087c5dd058c..dc1ed43b0954 100644
--- a/sc/source/ui/dbgui/tpsubt.cxx
+++ b/sc/source/ui/dbgui/tpsubt.cxx
@@ -189,12 +189,11 @@ bool ScTpSubTotalGroup::DoFillItemSet( sal_uInt16 nGroupNo,
nGroupIdx = nGroupNo-1;
ScSubTotalParam theSubTotalData; // read out, if already partly filled
- SfxTabDialog* pDlg = GetTabDialog();
- if ( pDlg )
+ const SfxItemSet* pExample = GetDialogExampleSet();
+ if (pExample)
{
- const SfxItemSet* pExample = pDlg->GetExampleSet();
const SfxPoolItem* pItem;
- if ( pExample && pExample->GetItemState( nWhichSubTotals, true, &pItem ) == SfxItemState::SET )
+ if (pExample->GetItemState(nWhichSubTotals, true, &pItem) == SfxItemState::SET)
theSubTotalData = static_cast<const ScSubTotalItem*>(pItem)->GetSubTotalData();
}
@@ -531,12 +530,11 @@ void ScTpSubTotalOptions::Reset( const SfxItemSet* /* rArgSet */ )
bool ScTpSubTotalOptions::FillItemSet( SfxItemSet* rArgSet )
{
ScSubTotalParam theSubTotalData; // read out, if already partly filled
- SfxTabDialog* pDlg = GetTabDialog();
- if ( pDlg )
+ const SfxItemSet* pExample = GetDialogExampleSet();
+ if (pExample)
{
- const SfxItemSet* pExample = pDlg->GetExampleSet();
const SfxPoolItem* pItem;
- if ( pExample && pExample->GetItemState( nWhichSubTotals, true, &pItem ) == SfxItemState::SET )
+ if (pExample->GetItemState(nWhichSubTotals, true, &pItem) == SfxItemState::SET)
theSubTotalData = static_cast<const ScSubTotalItem*>(pItem)->GetSubTotalData();
}
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]
diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx
index d7eadfdce5c1..c9d62cb79f1d 100644
--- a/sw/source/ui/envelp/label1.cxx
+++ b/sw/source/ui/envelp/label1.cxx
@@ -591,7 +591,7 @@ DeactivateRC SwPrivateDataPage::DeactivatePage(SfxItemSet* _pSet)
bool SwPrivateDataPage::FillItemSet(SfxItemSet* rSet)
{
- SwLabItem aItem = static_cast<const SwLabItem&>(GetDialogController()->GetExampleSet()->Get(FN_LABEL));
+ SwLabItem aItem = static_cast<const SwLabItem&>(GetDialogExampleSet()->Get(FN_LABEL));
aItem.m_aPrivFirstName = m_xFirstNameED->get_text();
aItem.m_aPrivName = m_xNameED->get_text();
aItem.m_aPrivShortCut = m_xShortCutED->get_text();
@@ -681,7 +681,7 @@ DeactivateRC SwBusinessDataPage::DeactivatePage(SfxItemSet* _pSet)
bool SwBusinessDataPage::FillItemSet(SfxItemSet* rSet)
{
- SwLabItem aItem = static_cast<const SwLabItem&>(GetDialogController()->GetExampleSet()->Get(FN_LABEL));
+ SwLabItem aItem = static_cast<const SwLabItem&>(GetDialogExampleSet()->Get(FN_LABEL));
aItem.m_aCompCompany = m_xCompanyED->get_text();
aItem.m_aCompCompanyExt= m_xCompanyExtED->get_text();
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index a76e9034904d..2ceeaa30b729 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -1863,10 +1863,10 @@ void SwFramePage::RangeModifyHdl()
aMgr.ValidateMetrics(aVal, mpToCharContentPos); // one more time, to determine all remaining values with correct width and height.
// all columns have to be correct
- if(GetTabDialog()->GetExampleSet() &&
- SfxItemState::DEFAULT <= GetTabDialog()->GetExampleSet()->GetItemState(RES_COL))
+ const SfxItemSet* pExampleSet = GetDialogExampleSet();
+ if (pExampleSet && SfxItemState::DEFAULT <= pExampleSet->GetItemState(RES_COL))
{
- const SwFormatCol& rCol = GetTabDialog()->GetExampleSet()->Get(RES_COL);
+ const SwFormatCol& rCol = pExampleSet->Get(RES_COL);
if ( rCol.GetColumns().size() > 1 )
{
for (const SwColumn & i : rCol.GetColumns())
diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx
index 5b8d8b066e95..997ba0f5a4ad 100644
--- a/sw/source/ui/misc/num.cxx
+++ b/sw/source/ui/misc/num.cxx
@@ -348,7 +348,7 @@ void SwNumPositionTabPage::ActivatePage(const SfxItemSet& )
const SfxPoolItem* pItem;
sal_uInt16 nTmpNumLvl =
pOutlineDlg ? SwOutlineTabDialog::GetActNumLevel() : 0;
- const SfxItemSet* pExampleSet = GetDialogController()->GetExampleSet();
+ const SfxItemSet* pExampleSet = GetDialogExampleSet();
if(pExampleSet && pExampleSet->GetItemState(FN_PARAM_NUM_PRESET, false, &pItem) != SfxItemState::UNKNOWN)
{
bPreset = static_cast<const SfxBoolItem*>(pItem)->GetValue();
diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index 98dd7a271e87..036ee48ea0c6 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -487,7 +487,7 @@ void SwTextGridPage::GridModifyHdl()
{
const SfxItemSet& rOldSet = GetItemSet();
SfxItemSet aSet(rOldSet);
- const SfxItemSet* pExSet = GetDialogController()->GetExampleSet();
+ const SfxItemSet* pExSet = GetDialogExampleSet();
if(pExSet)
aSet.Put(*pExSet);
PutGridItem(aSet);