diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-10-02 16:38:21 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-10-02 16:39:17 +0100 |
commit | c59769ec7a4f9af1086f534ae92a4f2ccd653122 (patch) | |
tree | 0ac203c66a14422b5b7cebeca13ce3aa7c0d4439 /sw | |
parent | da9a26f5f49ea56422bb791d4f96725283d3e8c6 (diff) |
GetParent()->GetParent() does't take into account containers
The assumption was that the page is directly a child of the parent
dialog => ka-boom
Change-Id: Ia0e7f33273d7a3c6b726c74371b8ee8a809ee5bb
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/frmdlg/frmpage.cxx | 18 | ||||
-rw-r--r-- | sw/source/ui/inc/frmpage.hxx | 2 |
2 files changed, 13 insertions, 7 deletions
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index b05b030db317..8396539392e4 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -775,11 +775,15 @@ void SwFrmPage::EnableGraficMode( void ) } } -void SwFrmPage::Reset( const SfxItemSet &rSet ) +SwWrtShell *SwFrmPage::getFrmDlgParentShell() { + return ((SwFrmDlg*)GetParentDialog())->GetWrtShell(); +} +void SwFrmPage::Reset( const SfxItemSet &rSet ) +{ SwWrtShell* pSh = bFormat ? ::GetActiveWrtShell() : - ((SwFrmDlg*)GetParent()->GetParent())->GetWrtShell(); + getFrmDlgParentShell(); nHtmlMode = ::GetHtmlMode(pSh->GetView().GetDocShell()); bHtmlMode = nHtmlMode & HTMLMODE_ON ? sal_True : sal_False; @@ -951,7 +955,7 @@ sal_Bool SwFrmPage::FillItemSet(SfxItemSet &rSet) { sal_Bool bRet = sal_False; SwWrtShell* pSh = bFormat ? ::GetActiveWrtShell() - : ((SwFrmDlg*)GetParent()->GetParent())->GetWrtShell(); + : getFrmDlgParentShell(); OSL_ENSURE( pSh , "shell not found"); const SfxItemSet& rOldSet = GetItemSet(); const SfxPoolItem* pOldItem = 0; @@ -1619,7 +1623,7 @@ int SwFrmPage::DeactivatePage(SfxItemSet * _pSet) //FillItemSet doesn't set the anchor into the set when it matches //the original. But for the other pages we need the current anchor. SwWrtShell* pSh = bFormat ? ::GetActiveWrtShell() - : ((SwFrmDlg*)GetParent()->GetParent())->GetWrtShell(); + : getFrmDlgParentShell(); RndStdIds eAnchorId = (RndStdIds)GetAnchor(); SwFmtAnchor aAnc( eAnchorId, pSh->GetPhyPageNum() ); _pSet->Put( aAnc ); @@ -1674,7 +1678,7 @@ IMPL_LINK_NOARG(SwFrmPage, RangeModifyHdl) return 0; SwWrtShell* pSh = bFormat ? ::GetActiveWrtShell() - :((SwFrmDlg*)GetParent()->GetParent())->GetWrtShell(); + : getFrmDlgParentShell(); OSL_ENSURE(pSh , "shell not found"); SwFlyFrmAttrMgr aMgr( bNew, pSh, (const SwAttrSet&)GetItemSet() ); SvxSwFrameValidation aVal; @@ -2045,7 +2049,7 @@ void SwFrmPage::Init(const SfxItemSet& rSet, sal_Bool bReset) { if(!bFormat) { - SwWrtShell* pSh = ((SwFrmDlg*)GetParent()->GetParent())->GetWrtShell(); + SwWrtShell* pSh = getFrmDlgParentShell(); // size const sal_Bool bSizeFixed = pSh->IsSelObjProtected( FLYPROTECT_FIXED ); @@ -2140,7 +2144,7 @@ void SwFrmPage::Init(const SfxItemSet& rSet, sal_Bool bReset) if ( !bFormat ) { - SwWrtShell* pSh = ((SwFrmDlg*)GetParent()->GetParent())->GetWrtShell(); + SwWrtShell* pSh = getFrmDlgParentShell(); const SwFrmFmt* pFmt = pSh->GetFlyFrmFmt(); if( pFmt && pFmt->GetChain().GetNext() ) aAutoHeightCB.Enable( sal_False ); diff --git a/sw/source/ui/inc/frmpage.hxx b/sw/source/ui/inc/frmpage.hxx index 94453ce5d709..1e31ccb064a4 100644 --- a/sw/source/ui/inc/frmpage.hxx +++ b/sw/source/ui/inc/frmpage.hxx @@ -184,6 +184,8 @@ class SwFrmPage: public SfxTabPage SwFrmPage(Window *pParent, const SfxItemSet &rSet); ~SwFrmPage(); + SwWrtShell *getFrmDlgParentShell(); + using SfxTabPage::ActivatePage; using SfxTabPage::DeactivatePage; |