diff options
Diffstat (limited to 'vcl/source/control/ctrl.cxx')
-rw-r--r-- | vcl/source/control/ctrl.cxx | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx index 21056db4c58f..59d3389bc47a 100644 --- a/vcl/source/control/ctrl.cxx +++ b/vcl/source/control/ctrl.cxx @@ -38,6 +38,7 @@ void Control::ImplInitControlData() mbHasControlFocus = false; mbFont = false; mbForeground = false; + mbShowAccelerator = false; mpControlData = new ImplControlData; } @@ -379,6 +380,16 @@ void Control::ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect ) pDev->OutputDevice::SetSettings( aOriginalSettings ); } +void Control::SetShowAccelerator(bool bVal) +{ + mbShowAccelerator = bVal; +}; + +bool Control::GetShowAccelerator() const +{ + return mbShowAccelerator; +} + ControlLayoutData::~ControlLayoutData() { if( m_pParent ) @@ -442,15 +453,27 @@ void Control::ImplInitSettings(const bool _bFont, const bool _bForeground) void Control::DrawControlText( OutputDevice& _rTargetDevice, Rectangle& _io_rRect, const OUString& _rStr, DrawTextFlags _nStyle, MetricVector* _pVector, OUString* _pDisplayText ) const { + OUString rPStr = _rStr; + DrawTextFlags nPStyle = _nStyle; + + bool accel = ImplGetSVData()->maNWFData.mbEnableAccel; + bool autoacc = ImplGetSVData()->maNWFData.mbAutoAccel; + + if (!accel || (autoacc && !mbShowAccelerator)) + { + rPStr = GetNonMnemonicString( _rStr ); + nPStyle &= ~DrawTextFlags::HideMnemonic; + } + if ( !mpControlData->mpReferenceDevice || ( mpControlData->mpReferenceDevice == &_rTargetDevice ) ) { - _io_rRect = _rTargetDevice.GetTextRect( _io_rRect, _rStr, _nStyle ); - _rTargetDevice.DrawText( _io_rRect, _rStr, _nStyle, _pVector, _pDisplayText ); + _io_rRect = _rTargetDevice.GetTextRect( _io_rRect, rPStr, nPStyle ); + _rTargetDevice.DrawText( _io_rRect, rPStr, nPStyle, _pVector, _pDisplayText ); } else { ControlTextRenderer aRenderer( *this, _rTargetDevice, *mpControlData->mpReferenceDevice ); - _io_rRect = aRenderer.DrawText( _io_rRect, _rStr, _nStyle, _pVector, _pDisplayText ); + _io_rRect = aRenderer.DrawText( _io_rRect, rPStr, nPStyle, _pVector, _pDisplayText ); } } |