summaryrefslogtreecommitdiff
path: root/sw/source/uibase/utlui/bookctrl.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/uibase/utlui/bookctrl.cxx')
-rw-r--r--sw/source/uibase/utlui/bookctrl.cxx18
1 files changed, 9 insertions, 9 deletions
diff --git a/sw/source/uibase/utlui/bookctrl.cxx b/sw/source/uibase/utlui/bookctrl.cxx
index f47bfe735ec9..e79821022abc 100644
--- a/sw/source/uibase/utlui/bookctrl.cxx
+++ b/sw/source/uibase/utlui/bookctrl.cxx
@@ -17,12 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <swtypes.hxx>
-#include <strings.hrc>
-
#include <svl/intitem.hxx>
#include <svl/slstitm.hxx>
-#include <svl/eitem.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/viewfrm.hxx>
#include <vcl/commandevent.hxx>
@@ -49,10 +45,10 @@ SwBookmarkControl::~SwBookmarkControl()
{
}
-void SwBookmarkControl::StateChanged(
+void SwBookmarkControl::StateChangedAtStatusBarControl(
sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState )
{
- if( eState != SfxItemState::DEFAULT || pState->IsVoidItem() )
+ if (eState != SfxItemState::DEFAULT || SfxItemState::DISABLED == eState)
{
GetStatusBar().SetItemText(GetId(), OUString());
GetStatusBar().SetQuickHelpText(GetId(), OUString());
@@ -79,6 +75,10 @@ void SwBookmarkControl::Command( const CommandEvent& rCEvt )
if( !(pWrtShell && pWrtShell->getIDocumentMarkAccess()->getAllMarksCount() > 0) )
return;
+ SfxViewFrame* pViewFrm = SfxViewFrame::Current();
+ if (!pViewFrm)
+ return;
+
std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(nullptr, "modules/swriter/ui/bookmarkmenu.ui"));
std::unique_ptr<weld::Menu> xPopup(xBuilder->weld_menu("menu"));
@@ -93,17 +93,17 @@ void SwBookmarkControl::Command( const CommandEvent& rCEvt )
if(IDocumentMarkAccess::MarkType::BOOKMARK == IDocumentMarkAccess::GetType(**ppBookmark))
{
xPopup->append(OUString::number(nPopupId), (*ppBookmark)->GetName());
- aBookmarkIdx[nPopupId] = static_cast<sal_uInt16>(ppBookmark - ppBookmarkStart);
+ aBookmarkIdx[nPopupId] = o3tl::narrowing<sal_uInt16>(ppBookmark - ppBookmarkStart);
nPopupId++;
}
}
::tools::Rectangle aRect(rCEvt.GetMousePosPixel(), Size(1, 1));
weld::Window* pParent = weld::GetPopupParent(GetStatusBar(), aRect);
- OString sResult = xPopup->popup_at_rect(pParent, aRect);
+ OUString sResult = xPopup->popup_at_rect(pParent, aRect);
if (!sResult.isEmpty())
{
SfxUInt16Item aBookmark( FN_STAT_BOOKMARK, aBookmarkIdx[sResult.toUInt32()] );
- SfxViewFrame::Current()->GetDispatcher()->ExecuteList(FN_STAT_BOOKMARK,
+ pViewFrm->GetDispatcher()->ExecuteList(FN_STAT_BOOKMARK,
SfxCallMode::ASYNCHRON|SfxCallMode::RECORD,
{ &aBookmark });
}