Kaydet (Commit) cdd4d969 authored tarafından Caolán McNamara's avatar Caolán McNamara

Related: rhbz#790233 Allow styles to be deleted from the template dialog

I knew this used to work at some stage, appears to be a
regression since cdf8680e
GetIndices_Impl gives the region and index of the entry relative to the
immediate parent, so doesn't make sense to use those as indexes
into the template array if we're at the style level.

backup into the template level if we're below it to get the
relevant template index.

Change-Id: I37a0bbc38cbb4dd82dd3d2c8309d8be61d83adbd
üst 8856ec19
...@@ -1679,8 +1679,17 @@ sal_Bool SfxOrganizeDlg_Impl::DontDelete_Impl( SvLBoxEntry* pEntry ) ...@@ -1679,8 +1679,17 @@ sal_Bool SfxOrganizeDlg_Impl::DontDelete_Impl( SvLBoxEntry* pEntry )
return sal_True; return sal_True;
} }
//If delete is pressed on e.g. a style entry go up the chain to find the
//owning template
while (nDepth > 1)
{
pEntry = pFocusBox->GetParent(pEntry);
--nDepth;
}
SvLBoxEntry *pTemplateEntry = pEntry;
sal_uInt16 nRegion = 0, nIndex = 0; sal_uInt16 nRegion = 0, nIndex = 0;
GetIndices_Impl( pFocusBox, pEntry, nRegion, nIndex ); GetIndices_Impl( pFocusBox, pTemplateEntry, nRegion, nIndex );
const SfxDocumentTemplates* pTemplates = aMgr.GetTemplates(); const SfxDocumentTemplates* pTemplates = aMgr.GetTemplates();
if ( !pTemplates || !pTemplates->HasUserContents( nRegion, nIndex ) ) if ( !pTemplates || !pTemplates->HasUserContents( nRegion, nIndex ) )
return sal_True; return sal_True;
......
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