diff options
Diffstat (limited to 'vcl/source/control')
-rw-r--r-- | vcl/source/control/button.cxx | 8 | ||||
-rw-r--r-- | vcl/source/control/combobox.cxx | 4 | ||||
-rw-r--r-- | vcl/source/control/ctrl.cxx | 91 | ||||
-rw-r--r-- | vcl/source/control/edit.cxx | 4 | ||||
-rw-r--r-- | vcl/source/control/fixed.cxx | 12 | ||||
-rw-r--r-- | vcl/source/control/imp_listbox.cxx | 10 | ||||
-rw-r--r-- | vcl/source/control/listbox.cxx | 4 | ||||
-rw-r--r-- | vcl/source/control/spinfld.cxx | 4 | ||||
-rw-r--r-- | vcl/source/control/tabctrl.cxx | 11 |
9 files changed, 71 insertions, 77 deletions
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index ac867a292533..68b368b56c0e 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -27,6 +27,7 @@ #include <vcl/event.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> +#include <vcl/toolkit/controllayout.hxx> #include <vcl/toolkit/dialog.hxx> #include <vcl/toolkit/fixed.hxx> #include <vcl/toolkit/button.hxx> @@ -39,7 +40,6 @@ #include <bitmaps.hlst> #include <svdata.hxx> #include <window.h> -#include <controldata.hxx> #include <vclstatuslistener.hxx> #include <osl/diagnose.h> @@ -1340,7 +1340,7 @@ void PushButton::KeyUp( const KeyEvent& rKEvt ) void PushButton::FillLayoutData() const { - mpControlData->mpLayoutData.reset( new vcl::ControlLayoutData ); + mpLayoutData.reset( new vcl::ControlLayoutData ); const_cast<PushButton*>(this)->Invalidate(); } @@ -2435,7 +2435,7 @@ void RadioButton::KeyUp( const KeyEvent& rKEvt ) void RadioButton::FillLayoutData() const { - mpControlData->mpLayoutData.reset( new vcl::ControlLayoutData ); + mpLayoutData.reset( new vcl::ControlLayoutData ); const_cast<RadioButton*>(this)->Invalidate(); } @@ -3249,7 +3249,7 @@ void CheckBox::KeyUp( const KeyEvent& rKEvt ) void CheckBox::FillLayoutData() const { - mpControlData->mpLayoutData.reset( new vcl::ControlLayoutData ); + mpLayoutData.reset( new vcl::ControlLayoutData ); const_cast<CheckBox*>(this)->Invalidate(); } diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index cc4ca5465a63..85b418a14f86 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -22,6 +22,7 @@ #include <set> #include <comphelper/string.hxx> +#include <vcl/toolkit/controllayout.hxx> #include <vcl/toolkit/lstbox.hxx> #include <vcl/builder.hxx> #include <vcl/commandevent.hxx> @@ -32,7 +33,6 @@ #include <sal/log.hxx> #include <listbox.hxx> -#include <controldata.hxx> #include <comphelper/lok.hxx> #include <tools/json_writer.hxx> @@ -607,7 +607,7 @@ bool ComboBox::IsDropDownBox() const { return m_pImpl->m_pFloatWin != nullptr; } void ComboBox::FillLayoutData() const { - mpControlData->mpLayoutData.reset( new vcl::ControlLayoutData ); + mpLayoutData.reset( new vcl::ControlLayoutData ); AppendLayoutData( *m_pImpl->m_pSubEdit ); m_pImpl->m_pSubEdit->SetLayoutDataParent( this ); ImplListBoxWindow* rMainWindow = GetMainWindow(); diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx index c7dba808975a..28af923cb168 100644 --- a/vcl/source/control/ctrl.cxx +++ b/vcl/source/control/ctrl.cxx @@ -23,11 +23,11 @@ #include <vcl/decoview.hxx> #include <vcl/settings.hxx> #include <vcl/uitest/logger.hxx> +#include <vcl/toolkit/controllayout.hxx> #include <sal/log.hxx> #include <textlayout.hxx> #include <svdata.hxx> -#include <controldata.hxx> using namespace vcl; @@ -35,7 +35,6 @@ void Control::ImplInitControlData() { mbHasControlFocus = false; mbShowAccelerator = false; - mpControlData.reset(new ImplControlData); } Control::Control( WindowType nType ) : @@ -58,7 +57,8 @@ Control::~Control() void Control::dispose() { - mpControlData.reset(); + mpLayoutData.reset(); + mpReferenceDevice.clear(); Window::dispose(); } @@ -83,13 +83,13 @@ void Control::FillLayoutData() const void Control::CreateLayoutData() const { - SAL_WARN_IF( mpControlData->mpLayoutData, "vcl", "Control::CreateLayoutData: should be called with non-existent layout data only!" ); - mpControlData->mpLayoutData.reset( new vcl::ControlLayoutData ); + SAL_WARN_IF( mpLayoutData, "vcl", "Control::CreateLayoutData: should be called with non-existent layout data only!" ); + mpLayoutData.reset( new vcl::ControlLayoutData ); } bool Control::HasLayoutData() const { - return mpControlData && mpControlData->mpLayoutData != nullptr; + return mpLayoutData != nullptr; } void Control::SetText( const OUString& rStr ) @@ -111,7 +111,7 @@ tools::Rectangle Control::GetCharacterBounds( tools::Long nIndex ) const { if( !HasLayoutData() ) FillLayoutData(); - return mpControlData->mpLayoutData ? mpControlData->mpLayoutData->GetCharacterBounds( nIndex ) : tools::Rectangle(); + return mpLayoutData ? mpLayoutData->GetCharacterBounds( nIndex ) : tools::Rectangle(); } tools::Long ControlLayoutData::GetIndexForPoint( const Point& rPoint ) const @@ -135,7 +135,7 @@ tools::Long Control::GetIndexForPoint( const Point& rPoint ) const { if( ! HasLayoutData() ) FillLayoutData(); - return mpControlData->mpLayoutData ? mpControlData->mpLayoutData->GetIndexForPoint( rPoint ) : -1; + return mpLayoutData ? mpLayoutData->GetIndexForPoint( rPoint ) : -1; } tools::Long ControlLayoutData::GetLineCount() const @@ -173,7 +173,7 @@ Pair Control::GetLineStartEnd( tools::Long nLine ) const { if( !HasLayoutData() ) FillLayoutData(); - return mpControlData->mpLayoutData ? mpControlData->mpLayoutData->GetLineStartEnd( nLine ) : Pair( -1, -1 ); + return mpLayoutData ? mpLayoutData->GetLineStartEnd( nLine ) : Pair( -1, -1 ); } tools::Long ControlLayoutData::ToRelativeLineIndex( tools::Long nIndex ) const @@ -212,47 +212,43 @@ tools::Long Control::ToRelativeLineIndex( tools::Long nIndex ) const { if( !HasLayoutData() ) FillLayoutData(); - return mpControlData->mpLayoutData ? mpControlData->mpLayoutData->ToRelativeLineIndex( nIndex ) : -1; + return mpLayoutData ? mpLayoutData->ToRelativeLineIndex( nIndex ) : -1; } OUString Control::GetDisplayText() const { if( !HasLayoutData() ) FillLayoutData(); - return mpControlData->mpLayoutData ? mpControlData->mpLayoutData->m_aDisplayText : GetText(); + return mpLayoutData ? mpLayoutData->m_aDisplayText : GetText(); } bool Control::EventNotify( NotifyEvent& rNEvt ) { - // tdf#91081 if control is not valid, skip the emission - chaining to the parent - if (mpControlData) + if ( rNEvt.GetType() == MouseNotifyEvent::GETFOCUS ) { - if ( rNEvt.GetType() == MouseNotifyEvent::GETFOCUS ) + if ( !mbHasControlFocus ) { - if ( !mbHasControlFocus ) + mbHasControlFocus = true; + CompatStateChanged( StateChangedType::ControlFocus ); + if ( ImplCallEventListenersAndHandler( VclEventId::ControlGetFocus, {} ) ) + // been destroyed within the handler + return true; + } + } + else + { + if ( rNEvt.GetType() == MouseNotifyEvent::LOSEFOCUS ) + { + vcl::Window* pFocusWin = Application::GetFocusWindow(); + if ( !pFocusWin || !ImplIsWindowOrChild( pFocusWin ) ) { - mbHasControlFocus = true; + mbHasControlFocus = false; CompatStateChanged( StateChangedType::ControlFocus ); - if ( ImplCallEventListenersAndHandler( VclEventId::ControlGetFocus, {} ) ) + if ( ImplCallEventListenersAndHandler( VclEventId::ControlLoseFocus, [this] () { maLoseFocusHdl.Call(*this); } ) ) // been destroyed within the handler return true; } } - else - { - if ( rNEvt.GetType() == MouseNotifyEvent::LOSEFOCUS ) - { - vcl::Window* pFocusWin = Application::GetFocusWindow(); - if ( !pFocusWin || !ImplIsWindowOrChild( pFocusWin ) ) - { - mbHasControlFocus = false; - CompatStateChanged( StateChangedType::ControlFocus ); - if ( ImplCallEventListenersAndHandler( VclEventId::ControlLoseFocus, [this] () { maLoseFocusHdl.Call(*this); } ) ) - // been destroyed within the handler - return true; - } - } - } } return Window::EventNotify( rNEvt ); } @@ -274,23 +270,23 @@ void Control::AppendLayoutData( const Control& rSubControl ) const { if( !rSubControl.HasLayoutData() ) rSubControl.FillLayoutData(); - if( !rSubControl.HasLayoutData() || rSubControl.mpControlData->mpLayoutData->m_aDisplayText.isEmpty() ) + if( !rSubControl.HasLayoutData() || rSubControl.mpLayoutData->m_aDisplayText.isEmpty() ) return; - tools::Long nCurrentIndex = mpControlData->mpLayoutData->m_aDisplayText.getLength(); - mpControlData->mpLayoutData->m_aDisplayText += rSubControl.mpControlData->mpLayoutData->m_aDisplayText; - int nLines = rSubControl.mpControlData->mpLayoutData->m_aLineIndices.size(); + tools::Long nCurrentIndex = mpLayoutData->m_aDisplayText.getLength(); + mpLayoutData->m_aDisplayText += rSubControl.mpLayoutData->m_aDisplayText; + int nLines = rSubControl.mpLayoutData->m_aLineIndices.size(); int n; - mpControlData->mpLayoutData->m_aLineIndices.push_back( nCurrentIndex ); + mpLayoutData->m_aLineIndices.push_back( nCurrentIndex ); for( n = 1; n < nLines; n++ ) - mpControlData->mpLayoutData->m_aLineIndices.push_back( rSubControl.mpControlData->mpLayoutData->m_aLineIndices[n] + nCurrentIndex ); - int nRectangles = rSubControl.mpControlData->mpLayoutData->m_aUnicodeBoundRects.size(); + mpLayoutData->m_aLineIndices.push_back( rSubControl.mpLayoutData->m_aLineIndices[n] + nCurrentIndex ); + int nRectangles = rSubControl.mpLayoutData->m_aUnicodeBoundRects.size(); tools::Rectangle aRel = rSubControl.GetWindowExtentsRelative(this); for( n = 0; n < nRectangles; n++ ) { - tools::Rectangle aRect = rSubControl.mpControlData->mpLayoutData->m_aUnicodeBoundRects[n]; + tools::Rectangle aRect = rSubControl.mpLayoutData->m_aUnicodeBoundRects[n]; aRect.Move( aRel.Left(), aRel.Top() ); - mpControlData->mpLayoutData->m_aUnicodeBoundRects.push_back( aRect ); + mpLayoutData->m_aUnicodeBoundRects.push_back( aRect ); } } @@ -324,13 +320,12 @@ bool Control::ImplCallEventListenersAndHandler( VclEventId nEvent, std::function void Control::SetLayoutDataParent( const Control* pParent ) const { if( HasLayoutData() ) - mpControlData->mpLayoutData->m_pParent = pParent; + mpLayoutData->m_pParent = pParent; } void Control::ImplClearLayoutData() const { - if (mpControlData) - mpControlData->mpLayoutData.reset(); + mpLayoutData.reset(); } void Control::ImplDrawFrame( OutputDevice* pDev, tools::Rectangle& rRect ) @@ -379,10 +374,10 @@ Size Control::GetOptimalSize() const void Control::SetReferenceDevice( OutputDevice* _referenceDevice ) { - if ( mpControlData->mpReferenceDevice == _referenceDevice ) + if ( mpReferenceDevice == _referenceDevice ) return; - mpControlData->mpReferenceDevice = _referenceDevice; + mpReferenceDevice = _referenceDevice; Invalidate(); } @@ -397,12 +392,12 @@ OutputDevice* Control::GetReferenceDevice() const // inside Control::SetReferenceDevice and Control::GetReferenceDevice(). // Control::GetReferenceDevice() will now reset mpReferenceDevice if it is already // disposed. This way all usages will do a kind of 'test-and-get' call. - if(nullptr != mpControlData->mpReferenceDevice && mpControlData->mpReferenceDevice->isDisposed()) + if(nullptr != mpReferenceDevice && mpReferenceDevice->isDisposed()) { const_cast<Control*>(this)->SetReferenceDevice(nullptr); } - return mpControlData->mpReferenceDevice; + return mpReferenceDevice; } const vcl::Font& Control::GetCanonicalFont( const StyleSettings& _rStyle ) const diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 395c52587de8..4b6adef6bce7 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -21,6 +21,7 @@ #include <vcl/event.hxx> #include <vcl/cursor.hxx> #include <vcl/menu.hxx> +#include <vcl/toolkit/controllayout.hxx> #include <vcl/toolkit/edit.hxx> #include <vcl/weld.hxx> #include <vcl/specialchars.hxx> @@ -33,7 +34,6 @@ #include <window.h> #include <svdata.hxx> #include <strings.hrc> -#include <controldata.hxx> #include <com/sun/star/i18n/BreakIterator.hpp> #include <com/sun/star/i18n/CharacterIteratorMode.hpp> @@ -1716,7 +1716,7 @@ void Edit::KeyInput( const KeyEvent& rKEvt ) void Edit::FillLayoutData() const { - mpControlData->mpLayoutData.reset( new vcl::ControlLayoutData ); + mpLayoutData.reset( new vcl::ControlLayoutData ); const_cast<Edit*>(this)->Invalidate(); } diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index 6ed615dd6259..467ac69d350a 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -19,12 +19,12 @@ #include <vcl/decoview.hxx> #include <vcl/event.hxx> +#include <vcl/toolkit/controllayout.hxx> #include <vcl/toolkit/fixed.hxx> #include <vcl/settings.hxx> #include <comphelper/string.hxx> #include <sal/log.hxx> -#include <controldata.hxx> #include <tools/json_writer.hxx> #define FIXEDLINE_TEXT_BORDER 4 @@ -153,12 +153,12 @@ void FixedText::ImplDraw(OutputDevice* pDev, DrawFlags nDrawFlags, nTextStyle |= DrawTextFlags::Mono; if( bFillLayout ) - mpControlData->mpLayoutData->m_aDisplayText.clear(); + mpLayoutData->m_aDisplayText.clear(); const tools::Rectangle aRect(aPos, rSize); DrawControlText(*pDev, aRect, aText, nTextStyle, - bFillLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : nullptr, - bFillLayout ? &mpControlData->mpLayoutData->m_aDisplayText : nullptr); + bFillLayout ? &mpLayoutData->m_aUnicodeBoundRects : nullptr, + bFillLayout ? &mpLayoutData->m_aDisplayText : nullptr); } void FixedText::ApplySettings(vcl::RenderContext& rRenderContext) @@ -348,7 +348,7 @@ Size FixedText::GetOptimalSize() const void FixedText::FillLayoutData() const { - mpControlData->mpLayoutData.reset( new vcl::ControlLayoutData ); + mpLayoutData.reset( new vcl::ControlLayoutData ); ImplDraw(const_cast<FixedText*>(this)->GetOutDev(), DrawFlags::NONE, Point(), GetOutputSizePixel(), true); //const_cast<FixedText*>(this)->Invalidate(); } @@ -553,7 +553,7 @@ FixedLine::FixedLine( vcl::Window* pParent, WinBits nStyle ) : void FixedLine::FillLayoutData() const { - mpControlData->mpLayoutData.reset( new vcl::ControlLayoutData ); + mpLayoutData.reset( new vcl::ControlLayoutData ); const_cast<FixedLine*>(this)->Invalidate(); } diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx index 322578909b17..f3b06bf75543 100644 --- a/vcl/source/control/imp_listbox.cxx +++ b/vcl/source/control/imp_listbox.cxx @@ -23,12 +23,12 @@ #include <vcl/settings.hxx> #include <vcl/event.hxx> #include <vcl/scrbar.hxx> +#include <vcl/toolkit/controllayout.hxx> #include <vcl/toolkit/lstbox.hxx> #include <vcl/i18nhelp.hxx> #include <vcl/naturalsort.hxx> #include <listbox.hxx> -#include <controldata.hxx> #include <svdata.hxx> #include <window.h> @@ -1746,7 +1746,7 @@ void ImplListBoxWindow::DrawEntry(vcl::RenderContext& rRenderContext, sal_Int32 void ImplListBoxWindow::FillLayoutData() const { - mpControlData->mpLayoutData.reset( new vcl::ControlLayoutData ); + mpLayoutData.reset( new vcl::ControlLayoutData ); const_cast<ImplListBoxWindow*>(this)->Invalidate(tools::Rectangle(Point(0, 0), GetOutDev()->GetOutputSize())); } @@ -2497,7 +2497,7 @@ void ImplWin::MouseButtonDown( const MouseEvent& ) void ImplWin::FillLayoutData() const { - mpControlData->mpLayoutData.reset( new vcl::ControlLayoutData ); + mpLayoutData.reset( new vcl::ControlLayoutData ); ImplWin* pThis = const_cast<ImplWin*>(this); pThis->ImplDraw(*pThis->GetOutDev(), true); } @@ -2715,8 +2715,8 @@ void ImplWin::DrawEntry(vcl::RenderContext& rRenderContext, bool bLayout) aTextRect.AdjustLeft(maImage.GetSizePixel().Width() + IMG_TXT_DISTANCE ); } - std::vector< tools::Rectangle >* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : nullptr; - OUString* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : nullptr; + std::vector< tools::Rectangle >* pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : nullptr; + OUString* pDisplayText = bLayout ? &mpLayoutData->m_aDisplayText : nullptr; rRenderContext.DrawText( aTextRect, maString, nTextStyle, pVector, pDisplayText ); } diff --git a/vcl/source/control/listbox.cxx b/vcl/source/control/listbox.cxx index 444d7e899727..58987498ab81 100644 --- a/vcl/source/control/listbox.cxx +++ b/vcl/source/control/listbox.cxx @@ -20,13 +20,13 @@ #include <vcl/builder.hxx> #include <vcl/commandevent.hxx> #include <vcl/event.hxx> +#include <vcl/toolkit/controllayout.hxx> #include <vcl/toolkit/lstbox.hxx> #include <vcl/settings.hxx> #include <vcl/uitest/uiobject.hxx> #include <sal/log.hxx> #include <svdata.hxx> -#include <controldata.hxx> #include <listbox.hxx> #include <dndeventdispatcher.hxx> #include <comphelper/lok.hxx> @@ -627,7 +627,7 @@ void ListBox::Resize() void ListBox::FillLayoutData() const { - mpControlData->mpLayoutData.reset( new vcl::ControlLayoutData ); + mpLayoutData.reset( new vcl::ControlLayoutData ); const ImplListBoxWindow* rMainWin = mpImplLB->GetMainWindow(); if( mpFloatWin ) { diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index faeed4062e32..af8ecbc94edf 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -20,12 +20,12 @@ #include <vcl/commandevent.hxx> #include <vcl/event.hxx> #include <vcl/decoview.hxx> +#include <vcl/toolkit/controllayout.hxx> #include <vcl/toolkit/spinfld.hxx> #include <vcl/settings.hxx> #include <vcl/uitest/uiobject.hxx> #include <sal/log.hxx> -#include <controldata.hxx> #include <spin.hxx> #include <svdata.hxx> @@ -571,7 +571,7 @@ void SpinField::FillLayoutData() const { if (mbSpin) { - mpControlData->mpLayoutData.reset( new vcl::ControlLayoutData ); + mpLayoutData.reset( new vcl::ControlLayoutData ); AppendLayoutData(*GetSubEdit()); GetSubEdit()->SetLayoutDataParent(this); } diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 14e2510d33d0..09c1281d63db 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -36,7 +36,6 @@ #include <bitmaps.hlst> #include <tools/json_writer.hxx> -#include <controldata.hxx> #include <svdata.hxx> #include <window.h> @@ -2022,9 +2021,9 @@ tools::Rectangle TabControl::GetCharacterBounds( sal_uInt16 nPageId, tools::Long std::unordered_map< int, int >::const_iterator it = mpTabCtrlData->maLayoutPageIdToLine.find( static_cast<int>(nPageId) ); if( it != mpTabCtrlData->maLayoutPageIdToLine.end() ) { - Pair aPair = mpControlData->mpLayoutData->GetLineStartEnd( it->second ); + Pair aPair = mpLayoutData->GetLineStartEnd( it->second ); if( (aPair.B() - aPair.A()) >= nIndex ) - aRet = mpControlData->mpLayoutData->GetCharacterBounds( aPair.A() + nIndex ); + aRet = mpLayoutData->GetCharacterBounds( aPair.A() + nIndex ); } } @@ -2040,15 +2039,15 @@ tools::Long TabControl::GetIndexForPoint( const Point& rPoint, sal_uInt16& rPage if( HasLayoutData() ) { - int nIndex = mpControlData->mpLayoutData->GetIndexForPoint( rPoint ); + int nIndex = mpLayoutData->GetIndexForPoint( rPoint ); if( nIndex != -1 ) { // what line (->pageid) is this index in ? - int nLines = mpControlData->mpLayoutData->GetLineCount(); + int nLines = mpLayoutData->GetLineCount(); int nLine = -1; while( ++nLine < nLines ) { - Pair aPair = mpControlData->mpLayoutData->GetLineStartEnd( nLine ); + Pair aPair = mpLayoutData->GetLineStartEnd( nLine ); if( aPair.A() <= nIndex && aPair.B() >= nIndex ) { nRet = nIndex - aPair.A(); |