summaryrefslogtreecommitdiff
path: root/sd/source/ui/view/drviewsf.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-05-30 11:09:59 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-05-30 11:38:04 +0100
commit7a211e834fc271d3f28d7f8c49197c925242d862 (patch)
tree8c7c28628c96ba4503f4a459abb8869ee5474c5c /sd/source/ui/view/drviewsf.cxx
parente705c37c44e8ce43047c70e5ad9ae65bd79ae962 (diff)
Resolves: fdo#79360 impress hangs on using sidebar new style
because those styles are "pseudo-styles" and a new one cannot be added. The possibility is supposed to be disabled, and it is disabled in the floating stylelist. The old code assumes there can only be one of these stylelists and when a stylelist queries if the "new" should be disabled the callback asks the stylelist what family is selected, but only asks the floating one. So, floating closed, sidebar open, the new is not disabled. Implement the ancient TODO now that we have to. Instead of asking the stylelist what family is selected, query the frame for what is the current SID_STYLE_FAMILY as set by whatever is the active stylelist. What's disturbing is the SID_STYLE_FAMILY values are not SfxStyleFamily, but indexes that have to be mapped to SfxStyleFamily. I bet there are a pile of bugs around that, especially with little islands of different conversion codesites Change-Id: I85c8032d7c26ae6eea245685748f89b2a860e767
Diffstat (limited to 'sd/source/ui/view/drviewsf.cxx')
-rw-r--r--sd/source/ui/view/drviewsf.cxx38
1 files changed, 26 insertions, 12 deletions
diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx
index 6c7436500064..d161d0ffcb66 100644
--- a/sd/source/ui/view/drviewsf.cxx
+++ b/sd/source/ui/view/drviewsf.cxx
@@ -486,30 +486,41 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet )
case SID_STYLE_WATERCAN:
{
- ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
- if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
+ SfxPoolItem* pItem = NULL;
+ GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY, pItem);
+ SfxUInt16Item* pFamilyItem = dynamic_cast<SfxUInt16Item*>(pItem);
+ if (pFamilyItem && SfxTemplateDialog::NIdToSfxFamilyId(pFamilyItem->GetValue()) == SD_STYLE_FAMILY_PSEUDO)
rSet.Put(SfxBoolItem(nWhich,false));
else
{
SfxBoolItem aItem(nWhich, SD_MOD()->GetWaterCan());
aAllSet.Put( aItem, aItem.Which());
}
+ delete pItem;
}
break;
case SID_STYLE_NEW:
{
- ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
- if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
+ SfxPoolItem* pItem = NULL;
+ GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY, pItem);
+ SfxUInt16Item* pFamilyItem = dynamic_cast<SfxUInt16Item*>(pItem);
+ if (pFamilyItem && SfxTemplateDialog::NIdToSfxFamilyId(pFamilyItem->GetValue()) == SD_STYLE_FAMILY_PSEUDO)
+ {
rSet.DisableItem(nWhich);
+ }
+ delete pItem;
}
break;
case SID_STYLE_DRAGHIERARCHIE:
{
- ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
- if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
+ SfxPoolItem* pItem = NULL;
+ GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY, pItem);
+ SfxUInt16Item* pFamilyItem = dynamic_cast<SfxUInt16Item*>(pItem);
+ if (pFamilyItem && SfxTemplateDialog::NIdToSfxFamilyId(pFamilyItem->GetValue()) == SD_STYLE_FAMILY_PSEUDO)
rSet.DisableItem(nWhich);
+ delete pItem;
}
break;
@@ -517,14 +528,17 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet )
{
// It is not possible to create PseudoStyleSheets 'by Example';
// normal style sheets need a selected object for that
- ISfxTemplateCommon* pTemplCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
- if (pTemplCommon)
+
+ SfxPoolItem* pItem = NULL;
+ GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY, pItem);
+ SfxUInt16Item* pFamilyItem = dynamic_cast<SfxUInt16Item*>(pItem);
+ if (pFamilyItem)
{
- if (pTemplCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
+ if (SfxTemplateDialog::NIdToSfxFamilyId(pFamilyItem->GetValue()) == SD_STYLE_FAMILY_PSEUDO)
{
rSet.DisableItem(nWhich);
}
- else if (pTemplCommon->GetActualFamily() == SD_STYLE_FAMILY_GRAPHICS)
+ else if (SfxTemplateDialog::NIdToSfxFamilyId(pFamilyItem->GetValue()) == SD_STYLE_FAMILY_GRAPHICS)
{
if (!mpDrawView->AreObjectsMarked())
{
@@ -532,7 +546,7 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet )
}
}
}
- // if there is no (yet) a designer, we have to go back into the
+ // if there is no (yet) a style designer, we have to go back into the
// view state; an actual set family can not be considered
else
{
@@ -541,7 +555,7 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet )
rSet.DisableItem(nWhich);
}
}
-
+ delete pItem;
}
break;