1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <vcl/status.hxx>
21 #include <svl/eitem.hxx>
22 #include <tools/debug.hxx>
24 #include <svx/strings.hrc>
26 #include <svx/insctrl.hxx>
27 #include <svx/dialmgr.hxx>
29 SFX_IMPL_STATUSBAR_CONTROL(SvxInsertStatusBarControl
, SfxBoolItem
);
31 SvxInsertStatusBarControl::SvxInsertStatusBarControl( sal_uInt16 _nSlotId
,
35 SfxStatusBarControl( _nSlotId
, _nId
, rStb
),
40 SvxInsertStatusBarControl::~SvxInsertStatusBarControl()
44 void SvxInsertStatusBarControl::StateChangedAtStatusBarControl( sal_uInt16
, SfxItemState eState
,
45 const SfxPoolItem
* pState
)
47 if ( SfxItemState::DEFAULT
!= eState
)
48 GetStatusBar().SetItemText( GetId(), "" );
51 DBG_ASSERT( dynamic_cast<const SfxBoolItem
*>( pState
) != nullptr, "invalid item type" );
52 const SfxBoolItem
* pItem
= static_cast<const SfxBoolItem
*>(pState
);
53 bInsert
= pItem
->GetValue();
56 GetStatusBar().SetQuickHelpText( GetId(), SvxResId( RID_SVXSTR_INSERT_HELPTEXT
) );
58 GetStatusBar().SetQuickHelpText( GetId(), SvxResId( RID_SVXSTR_OVERWRITE_HELPTEXT
) );
64 void SvxInsertStatusBarControl::Paint( const UserDrawEvent
& )
68 void SvxInsertStatusBarControl::DrawItemText_Impl()
71 // tdf#107918 on macOS without an Insert key it's hard to figure out how to switch modes
72 // so we show both Insert and Overwrite
75 aText
= SvxResId( RID_SVXSTR_INSERT_TEXT
);
78 aText
= SvxResId( RID_SVXSTR_OVERWRITE_TEXT
);
80 GetStatusBar().SetItemText( GetId(), aText
);
83 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */