diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-03-14 12:28:06 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-03-14 14:20:26 +0100 |
commit | 6ba9daac763baf37c833911be5e5fb97e068bea1 (patch) | |
tree | 12ba4c5402747074f5a4b69a10fc60ab1c3d6603 /sd | |
parent | a342ac91e21dd45640b7dea063bc04b80f0feb6e (diff) |
add TypedWhichId version of QueryState
Change-Id: I95b86fc081847da01e06f50a1b2c7e7f5456c638
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131529
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/inc/app.hrc | 6 | ||||
-rw-r--r-- | sd/qa/unit/tiledrendering/tiledrendering.cxx | 30 | ||||
-rw-r--r-- | sd/source/ui/func/bulmaper.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 5 | ||||
-rw-r--r-- | sd/source/ui/view/drviews3.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/view/drviewsf.cxx | 20 | ||||
-rw-r--r-- | sd/source/ui/view/outlnvsh.cxx | 5 |
7 files changed, 30 insertions, 42 deletions
diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc index 97d43b1d1c06..875dc0cc3e75 100644 --- a/sd/inc/app.hrc +++ b/sd/inc/app.hrc @@ -137,7 +137,7 @@ // In svxids.hrc: SID_BEZIER_CONVERT (SID_SD_START+65) // In svxids.hrc: SID_BEZIER_EDGE (SID_SD_START+66) // In svxids.hrc: SID_BEZIER_SYMMTR (SID_SD_START+67) -#define SID_NOTES_MODE (SID_SD_START+69) +#define SID_NOTES_MODE TypedWhichId<SfxBoolItem>(SID_SD_START+69) #define SID_HANDOUT_MASTER_MODE (SID_SD_START+70) #define SID_LINEEND_POLYGON (SID_SD_START+71) #define SID_EXECUTE_ANIMATION_EFFECT (SID_SD_START+72) @@ -375,7 +375,7 @@ #define SID_SUMMARY_PAGE (SID_SD_START+344) #define SID_LEAVE_ALL_GROUPS (SID_SD_START+345) // FREE -#define SID_SLIDE_MASTER_MODE (SID_SD_START+348) +#define SID_SLIDE_MASTER_MODE TypedWhichId<SfxBoolItem>(SID_SD_START+348) // FREE #define SID_NOTES_MASTER_MODE (SID_SD_START+350) // FREE @@ -430,7 +430,7 @@ // FREE #define SID_NOTES_WINDOW (SID_SD_START+417) // FREE -#define SID_NORMAL_MULTI_PANE_GUI (SID_SD_START+420) +#define SID_NORMAL_MULTI_PANE_GUI TypedWhichId<SfxBoolItem>(SID_SD_START+420) #define SID_SLIDE_SORTER_MULTI_PANE_GUI (SID_SD_START+421) #define SID_SELECT_BACKGROUND (SID_SD_START+422) diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 8a4da8dbf301..ebab87741847 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -2201,15 +2201,13 @@ void SdTiledRenderingTest::testDocumentRepair() CPPUNIT_ASSERT(pView1 != pView2); { - std::unique_ptr<SfxPoolItem> xItem1; - pView1->GetViewFrame()->GetBindings().QueryState(SID_DOC_REPAIR, xItem1); - const SfxBoolItem* pItem1 = dynamic_cast<const SfxBoolItem*>(xItem1.get()); + std::unique_ptr<SfxBoolItem> pItem1; + pView1->GetViewFrame()->GetBindings().QueryState(SID_DOC_REPAIR, pItem1); CPPUNIT_ASSERT(pItem1); CPPUNIT_ASSERT_EQUAL(false, pItem1->GetValue()); - std::unique_ptr<SfxPoolItem> xItem2; - pView2->GetViewFrame()->GetBindings().QueryState(SID_DOC_REPAIR, xItem2); - const SfxBoolItem* pItem2 = dynamic_cast<const SfxBoolItem*>(xItem2.get()); + std::unique_ptr<SfxBoolItem> pItem2; + pView2->GetViewFrame()->GetBindings().QueryState(SID_DOC_REPAIR, pItem2); CPPUNIT_ASSERT(pItem2); CPPUNIT_ASSERT_EQUAL(false, pItem2->GetValue()); } @@ -2229,15 +2227,13 @@ void SdTiledRenderingTest::testDocumentRepair() CPPUNIT_ASSERT(!pViewShell2->GetView()->IsTextEdit()); { - std::unique_ptr<SfxPoolItem> xItem1; - pView1->GetViewFrame()->GetBindings().QueryState(SID_DOC_REPAIR, xItem1); - const SfxBoolItem* pItem1 = dynamic_cast<const SfxBoolItem*>(xItem1.get()); + std::unique_ptr<SfxBoolItem> pItem1; + pView1->GetViewFrame()->GetBindings().QueryState(SID_DOC_REPAIR, pItem1); CPPUNIT_ASSERT(pItem1); CPPUNIT_ASSERT_EQUAL(true, pItem1->GetValue()); - std::unique_ptr<SfxPoolItem> xItem2; - pView2->GetViewFrame()->GetBindings().QueryState(SID_DOC_REPAIR, xItem2); - const SfxBoolItem* pItem2 = dynamic_cast<const SfxBoolItem*>(xItem2.get()); + std::unique_ptr<SfxBoolItem> pItem2; + pView2->GetViewFrame()->GetBindings().QueryState(SID_DOC_REPAIR, pItem2); CPPUNIT_ASSERT(pItem2); CPPUNIT_ASSERT_EQUAL(true, pItem2->GetValue()); } @@ -2296,12 +2292,10 @@ void SdTiledRenderingTest::testDefaultView() SdXImpressDocument* pXImpressDocument = createDoc("notes-view.odp"); sd::ViewShell* pView = pXImpressDocument->GetDocShell()->GetViewShell(); { - std::unique_ptr<SfxPoolItem> xItem1; - std::unique_ptr<SfxPoolItem> xItem2; - pView->GetViewFrame()->GetBindings().QueryState(SID_NORMAL_MULTI_PANE_GUI, xItem1); - pView->GetViewFrame()->GetBindings().QueryState(SID_NOTES_MODE, xItem2); - const SfxBoolItem* pImpressView = dynamic_cast< const SfxBoolItem* >(xItem1.get()); - const SfxBoolItem* pNotesView = dynamic_cast< const SfxBoolItem* >(xItem2.get()); + std::unique_ptr<SfxBoolItem> pImpressView; + std::unique_ptr<SfxBoolItem> pNotesView; + pView->GetViewFrame()->GetBindings().QueryState(SID_NORMAL_MULTI_PANE_GUI, pImpressView); + pView->GetViewFrame()->GetBindings().QueryState(SID_NOTES_MODE, pNotesView); CPPUNIT_ASSERT(pImpressView); CPPUNIT_ASSERT(pNotesView); CPPUNIT_ASSERT_EQUAL(true, pImpressView->GetValue()); diff --git a/sd/source/ui/func/bulmaper.cxx b/sd/source/ui/func/bulmaper.cxx index 13bb404e4be9..67a6678918ea 100644 --- a/sd/source/ui/func/bulmaper.cxx +++ b/sd/source/ui/func/bulmaper.cxx @@ -74,7 +74,7 @@ void SdBulletMapper::MapFontsInNumRule( SvxNumRule& aNumRule, const SfxItemSet& static_cast<const SvxPostureItem&>(rSet.Get(GetWhich( sal_uInt16(SID_ATTR_CHAR_POSTURE) ))); aMyFont.SetItalic(rPItem.GetPosture()); - const SvxUnderlineItem& rUItem = static_cast<const SvxUnderlineItem&>(rSet.Get(GetWhich(SID_ATTR_CHAR_UNDERLINE))); + const SvxUnderlineItem& rUItem = rSet.Get(GetWhich(SID_ATTR_CHAR_UNDERLINE)); aMyFont.SetUnderline(rUItem.GetLineStyle()); const SvxOverlineItem& rOItem = static_cast<const SvxOverlineItem&>(rSet.Get(GetWhich(SID_ATTR_CHAR_OVERLINE))); diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 8c705f2a48a4..6fbcf5263118 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2381,9 +2381,8 @@ bool SdXImpressDocument::isMasterViewMode() if (pViewSh->GetDispatcher()) { - const SfxPoolItem* xItem = nullptr; - pViewSh->GetDispatcher()->QueryState(SID_SLIDE_MASTER_MODE, xItem); - const SfxBoolItem* isMasterViewMode = dynamic_cast<const SfxBoolItem*>(xItem); + const SfxBoolItem* isMasterViewMode = nullptr; + pViewSh->GetDispatcher()->QueryState(SID_SLIDE_MASTER_MODE, isMasterViewMode); if (isMasterViewMode && isMasterViewMode->GetValue()) return true; } diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx index 25422d400f73..c80c6b3bbd5b 100644 --- a/sd/source/ui/view/drviews3.cxx +++ b/sd/source/ui/view/drviews3.cxx @@ -710,8 +710,8 @@ void DrawViewShell::ExecRuler(SfxRequest& rReq) case SID_ATTR_PARA_LINESPACE: if (pArgs) { - SvxLineSpacingItem aParaLineSP = static_cast<const SvxLineSpacingItem&>(pArgs->Get( - GetPool().GetWhich(SID_ATTR_PARA_LINESPACE))); + SvxLineSpacingItem aParaLineSP = pArgs->Get( + GetPool().GetWhich(SID_ATTR_PARA_LINESPACE)); SfxItemSetFixed<EE_PARA_SBL, EE_PARA_SBL> aEditAttr( GetPool() ); aParaLineSP.SetWhich( EE_PARA_SBL ); diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx index 471d549cb12a..f23bd042ce23 100644 --- a/sd/source/ui/view/drviewsf.cxx +++ b/sd/source/ui/view/drviewsf.cxx @@ -529,9 +529,8 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet ) case SID_STYLE_WATERCAN: { - std::unique_ptr<SfxPoolItem> pItem; - GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY, pItem); - SfxUInt16Item* pFamilyItem = dynamic_cast<SfxUInt16Item*>(pItem.get()); + std::unique_ptr<SfxUInt16Item> pFamilyItem; + GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY, pFamilyItem); if (pFamilyItem && static_cast<SfxStyleFamily>(pFamilyItem->GetValue()) == SfxStyleFamily::Pseudo) rSet.Put(SfxBoolItem(nWhich,false)); else @@ -544,9 +543,8 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet ) case SID_STYLE_NEW: { - std::unique_ptr<SfxPoolItem> pItem; - GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY, pItem); - SfxUInt16Item* pFamilyItem = dynamic_cast<SfxUInt16Item*>(pItem.get()); + std::unique_ptr<SfxUInt16Item> pFamilyItem; + GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY, pFamilyItem); if (pFamilyItem && static_cast<SfxStyleFamily>(pFamilyItem->GetValue()) == SfxStyleFamily::Pseudo) { rSet.DisableItem(nWhich); @@ -556,9 +554,8 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet ) case SID_STYLE_DRAGHIERARCHIE: { - std::unique_ptr<SfxPoolItem> pItem; - GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY, pItem); - SfxUInt16Item* pFamilyItem = dynamic_cast<SfxUInt16Item*>(pItem.get()); + std::unique_ptr<SfxUInt16Item> pFamilyItem; + GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY, pFamilyItem); if (pFamilyItem && static_cast<SfxStyleFamily>(pFamilyItem->GetValue()) == SfxStyleFamily::Pseudo) rSet.DisableItem(nWhich); } @@ -569,9 +566,8 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet ) // It is not possible to create PseudoStyleSheets 'by Example'; // normal style sheets need a selected object for that - std::unique_ptr<SfxPoolItem> pItem; - GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY, pItem); - SfxUInt16Item* pFamilyItem = dynamic_cast<SfxUInt16Item*>(pItem.get()); + std::unique_ptr<SfxUInt16Item> pFamilyItem; + GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY, pFamilyItem); if (pFamilyItem) { if (static_cast<SfxStyleFamily>(pFamilyItem->GetValue()) == SfxStyleFamily::Pseudo) diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx index a24f3596b290..0eb351f915b0 100644 --- a/sd/source/ui/view/outlnvsh.cxx +++ b/sd/source/ui/view/outlnvsh.cxx @@ -1460,9 +1460,8 @@ void OutlineViewShell::GetAttrState( SfxItemSet& rSet ) case SID_STYLE_EDIT: { - std::unique_ptr<SfxPoolItem> pItem; - GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY, pItem); - SfxUInt16Item* pFamilyItem = dynamic_cast<SfxUInt16Item*>(pItem.get()); + std::unique_ptr<SfxUInt16Item> pFamilyItem; + GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY, pFamilyItem); if (pFamilyItem && static_cast<SfxStyleFamily>(pFamilyItem->GetValue()) == SfxStyleFamily::Pseudo) { SfxItemSetFixed<SID_STATUS_LAYOUT, SID_STATUS_LAYOUT> aSet(*rSet.GetPool()); |