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 /sc | |
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 'sc')
-rw-r--r-- | sc/qa/unit/tiledrendering/tiledrendering.cxx | 20 | ||||
-rw-r--r-- | sc/source/ui/view/formatsh.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/view/viewutil.cxx | 4 |
3 files changed, 14 insertions, 20 deletions
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 9db6cd3a3ae3..5b84eef452b9 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -1575,12 +1575,10 @@ void ScTiledRenderingTest::testDocumentRepair() int nView2 = SfxLokHelper::getView(); CPPUNIT_ASSERT(pView1 != pView2); { - std::unique_ptr<SfxPoolItem> xItem1; - std::unique_ptr<SfxPoolItem> xItem2; - pView1->GetViewFrame()->GetBindings().QueryState(SID_DOC_REPAIR, xItem1); - pView2->GetViewFrame()->GetBindings().QueryState(SID_DOC_REPAIR, xItem2); - const SfxBoolItem* pItem1 = dynamic_cast< const SfxBoolItem* >(xItem1.get()); - const SfxBoolItem* pItem2 = dynamic_cast< const SfxBoolItem* >(xItem2.get()); + std::unique_ptr<SfxBoolItem> pItem1; + std::unique_ptr<SfxBoolItem> pItem2; + pView1->GetViewFrame()->GetBindings().QueryState(SID_DOC_REPAIR, pItem1); + pView2->GetViewFrame()->GetBindings().QueryState(SID_DOC_REPAIR, pItem2); CPPUNIT_ASSERT(pItem1); CPPUNIT_ASSERT(pItem2); CPPUNIT_ASSERT_EQUAL(false, pItem1->GetValue()); @@ -1596,12 +1594,10 @@ void ScTiledRenderingTest::testDocumentRepair() pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::RETURN); Scheduler::ProcessEventsToIdle(); { - std::unique_ptr<SfxPoolItem> xItem1; - std::unique_ptr<SfxPoolItem> xItem2; - pView1->GetViewFrame()->GetBindings().QueryState(SID_DOC_REPAIR, xItem1); - pView2->GetViewFrame()->GetBindings().QueryState(SID_DOC_REPAIR, xItem2); - const SfxBoolItem* pItem1 = dynamic_cast< const SfxBoolItem* >(xItem1.get()); - const SfxBoolItem* pItem2 = dynamic_cast< const SfxBoolItem* >(xItem2.get()); + std::unique_ptr<SfxBoolItem> pItem1; + std::unique_ptr<SfxBoolItem> pItem2; + pView1->GetViewFrame()->GetBindings().QueryState(SID_DOC_REPAIR, pItem1); + pView2->GetViewFrame()->GetBindings().QueryState(SID_DOC_REPAIR, pItem2); CPPUNIT_ASSERT(pItem1); CPPUNIT_ASSERT(pItem2); CPPUNIT_ASSERT_EQUAL(true, pItem1->GetValue()); diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index df62ac25a409..913915a20dc8 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -214,9 +214,8 @@ void ScFormatShell::GetStyleState( SfxItemSet& rSet ) case SID_STYLE_UPDATE_BY_EXAMPLE: { - std::unique_ptr<SfxPoolItem> pItem; - pTabViewShell->GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY, pItem); - SfxUInt16Item* pFamilyItem = dynamic_cast<SfxUInt16Item*>(pItem.get()); + std::unique_ptr<SfxUInt16Item> pFamilyItem; + pTabViewShell->GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY, pFamilyItem); bool bPage = pFamilyItem && SfxStyleFamily::Page == static_cast<SfxStyleFamily>(pFamilyItem->GetValue()); @@ -230,9 +229,8 @@ void ScFormatShell::GetStyleState( SfxItemSet& rSet ) case SID_STYLE_HIDE: case SID_STYLE_SHOW: { - std::unique_ptr<SfxPoolItem> pItem; - pTabViewShell->GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY, pItem); - SfxUInt16Item* pFamilyItem = dynamic_cast<SfxUInt16Item*>(pItem.get()); + std::unique_ptr<SfxUInt16Item> pFamilyItem; + pTabViewShell->GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY, pFamilyItem); bool bPage = pFamilyItem && SfxStyleFamily::Page == static_cast<SfxStyleFamily>(pFamilyItem->GetValue()); if ( bProtected && !bPage ) diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx index bf691f778a99..7607c8f71bfa 100644 --- a/sc/source/ui/view/viewutil.cxx +++ b/sc/source/ui/view/viewutil.cxx @@ -331,11 +331,11 @@ void ScViewUtil::ExecuteCharMap(const SvxFontItem& rOldFont, bool ScViewUtil::IsFullScreen( const SfxViewShell& rViewShell ) { SfxBindings& rBindings = rViewShell.GetViewFrame()->GetBindings(); - std::unique_ptr<SfxPoolItem> pItem; + std::unique_ptr<SfxBoolItem> pItem; bool bIsFullScreen = false; if (rBindings.QueryState( SID_WIN_FULLSCREEN, pItem ) >= SfxItemState::DEFAULT) - bIsFullScreen = static_cast< SfxBoolItem* >( pItem.get() )->GetValue(); + bIsFullScreen = pItem->GetValue(); return bIsFullScreen; } |