diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-05-29 11:16:47 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-05-30 11:55:34 +0100 |
commit | 3988f17d14ee28b4bb117ca9961708ad3a867fb1 (patch) | |
tree | e5d2acf8488814ad837cc63929a448994df678a3 /sd | |
parent | 6e6e03c9b7d591802c485acc5eb979c0e3ba5610 (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
(cherry picked from commit 7a211e834fc271d3f28d7f8c49197c925242d862)
Conflicts:
sfx2/source/appl/appmisc.cxx
convert from NId to FamilyId instead of FamilyId to NId
should be equivalent for comparison purposes
(cherry picked from commit f48f5138ecedd3bb9ec0b454b9fe216001610156)
remove unused virtual method, slim this down initially
(cherry picked from commit fa551c422426962194b6bff4234f12eb5bdf57ca)
Change-Id: I85c8032d7c26ae6eea245685748f89b2a860e767
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/view/drviewsf.cxx | 38 | ||||
-rw-r--r-- | sd/source/ui/view/outlnvsh.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/view/viewshe3.cxx | 10 |
3 files changed, 34 insertions, 22 deletions
diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx index ea10bdf6bb04..6de7c98887e8 100644 --- a/sd/source/ui/view/drviewsf.cxx +++ b/sd/source/ui/view/drviewsf.cxx @@ -485,30 +485,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; @@ -516,14 +527,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()) { @@ -531,7 +545,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 { @@ -540,7 +554,7 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet ) rSet.DisableItem(nWhich); } } - + delete pItem; } break; diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx index fcfb881ec9f4..136fcce3ca48 100644 --- a/sd/source/ui/view/outlnvsh.cxx +++ b/sd/source/ui/view/outlnvsh.cxx @@ -1596,9 +1596,10 @@ void OutlineViewShell::GetAttrState( SfxItemSet& rSet ) case SID_STYLE_EDIT: { - ISfxTemplateCommon* pTmplCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings()); - - if (pTmplCommon && pTmplCommon->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) { SfxItemSet aSet(*rSet.GetPool(), SID_STATUS_LAYOUT, SID_STATUS_LAYOUT); GetStatusBarState(aSet); @@ -1609,6 +1610,7 @@ void OutlineViewShell::GetAttrState( SfxItemSet& rSet ) rSet.DisableItem(nWhich); } } + delete pItem; } break; diff --git a/sd/source/ui/view/viewshe3.cxx b/sd/source/ui/view/viewshe3.cxx index e5205c4c1b54..826a39447b89 100644 --- a/sd/source/ui/view/viewshe3.cxx +++ b/sd/source/ui/view/viewshe3.cxx @@ -72,6 +72,7 @@ #include <svx/svxids.hrc> #include <sfx2/request.hxx> +#include <sfx2/templdlg.hxx> #include <svl/aeitem.hxx> #include <basic/sbstar.hxx> @@ -102,17 +103,12 @@ void ViewShell::GetMenuState( SfxItemSet &rSet ) if( pStyleSheet ) { SfxStyleFamily eFamily = pStyleSheet->GetFamily(); - if(eFamily == SD_STYLE_FAMILY_GRAPHICS) - nFamily = 2; - else if(eFamily == SD_STYLE_FAMILY_CELL ) - nFamily = 3; - else // SD_STYLE_FAMILY_PSEUDO - nFamily = 5; - + nFamily = SfxTemplateDialog::SfxFamilyIdToNId(eFamily); GetDocSh()->SetStyleFamily(nFamily); } } } + rSet.Put(SfxUInt16Item(SID_STYLE_FAMILY, nFamily )); } |