[Libreoffice-commits] core.git: accessibility/source include/vcl solenv/clang-format vcl/inc vcl/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sun Aug 8 20:32:45 UTC 2021


 accessibility/source/extended/accessibleiconchoicectrlentry.cxx |    1 
 accessibility/source/extended/accessiblelistboxentry.cxx        |    1 
 accessibility/source/standard/vclxaccessiblestatusbaritem.cxx   |    2 
 include/vcl/ctrl.hxx                                            |   55 ++++++
 include/vcl/toolkit/controllayout.hxx                           |   80 ----------
 solenv/clang-format/excludelist                                 |    1 
 vcl/inc/pch/precompiled_vcl.hxx                                 |    1 
 vcl/inc/toolbox.h                                               |    1 
 vcl/source/control/button.cxx                                   |    7 
 vcl/source/control/combobox.cxx                                 |    3 
 vcl/source/control/ctrl.cxx                                     |   41 ++---
 vcl/source/control/edit.cxx                                     |    3 
 vcl/source/control/fixed.cxx                                    |   11 -
 vcl/source/control/imp_listbox.cxx                              |    9 -
 vcl/source/control/listbox.cxx                                  |    3 
 vcl/source/control/spinfld.cxx                                  |    3 
 vcl/source/control/tabctrl.cxx                                  |   11 -
 vcl/source/outdev/text.cxx                                      |    2 
 vcl/source/toolkit/group.cxx                                    |    7 
 vcl/source/window/menu.cxx                                      |    1 
 20 files changed, 98 insertions(+), 145 deletions(-)

New commits:
commit 2c1ae17421af0fc0e398b66bc2a07f27977a5bf0
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sun Aug 8 21:08:37 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Aug 8 22:32:12 2021 +0200

    no need to allocate ControlLayoutData separately
    
    Change-Id: I239befdaa05beea5200c81f23d0af861c9fc3baa
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120177
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/accessibility/source/extended/accessibleiconchoicectrlentry.cxx b/accessibility/source/extended/accessibleiconchoicectrlentry.cxx
index b4ed1db209ab..8cc2f083ad63 100644
--- a/accessibility/source/extended/accessibleiconchoicectrlentry.cxx
+++ b/accessibility/source/extended/accessibleiconchoicectrlentry.cxx
@@ -24,7 +24,6 @@
 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
 #include <vcl/svapp.hxx>
-#include <vcl/toolkit/controllayout.hxx>
 #include <vcl/settings.hxx>
 #include <toolkit/helper/convert.hxx>
 #include <unotools/accessiblestatesethelper.hxx>
diff --git a/accessibility/source/extended/accessiblelistboxentry.cxx b/accessibility/source/extended/accessiblelistboxentry.cxx
index ceacee0b4489..06cc2cf6897e 100644
--- a/accessibility/source/extended/accessiblelistboxentry.cxx
+++ b/accessibility/source/extended/accessiblelistboxentry.cxx
@@ -29,7 +29,6 @@
 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
 #include <i18nlangtag/languagetag.hxx>
 #include <vcl/svapp.hxx>
-#include <vcl/toolkit/controllayout.hxx>
 #include <vcl/settings.hxx>
 #include <toolkit/helper/convert.hxx>
 #include <unotools/accessiblestatesethelper.hxx>
diff --git a/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx b/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx
index b647036c316d..8406742060ac 100644
--- a/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx
+++ b/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx
@@ -30,10 +30,10 @@
 #include <cppuhelper/supportsservice.hxx>
 #include <unotools/accessiblestatesethelper.hxx>
 #include <unotools/accessiblerelationsethelper.hxx>
+#include <vcl/ctrl.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/unohelp2.hxx>
 #include <vcl/status.hxx>
-#include <vcl/toolkit/controllayout.hxx>
 #include <vcl/settings.hxx>
 #include <i18nlangtag/languagetag.hxx>
 
diff --git a/include/vcl/ctrl.hxx b/include/vcl/ctrl.hxx
index cde59c6f9e0f..a6797cc734bb 100644
--- a/include/vcl/ctrl.hxx
+++ b/include/vcl/ctrl.hxx
@@ -20,19 +20,68 @@
 #ifndef INCLUDED_VCL_CTRL_HXX
 #define INCLUDED_VCL_CTRL_HXX
 
+#include <rtl/ustring.hxx>
 #include <tools/link.hxx>
+#include <tools/gen.hxx>
 #include <vcl/dllapi.h>
 #include <vcl/window.hxx>
-#include <memory>
+#include <optional>
+#include <vector>
 
 // forward
 class StyleSettings;
-namespace vcl { struct ControlLayoutData; }
+class Control;
+
+namespace vcl
+{
+
+struct VCL_DLLPUBLIC ControlLayoutData
+{
+    // contains the string really displayed
+    // there must be exactly one bounding rectangle in m_aUnicodeBoundRects
+    // for every character in m_aDisplayText
+    OUString                            m_aDisplayText;
+    // the bounding rectangle of every character
+    // where one character may consist of many glyphs
+    std::vector< tools::Rectangle >            m_aUnicodeBoundRects;
+    // start indices of lines
+    std::vector< tools::Long >                 m_aLineIndices;
+    // notify parent control on destruction
+    VclPtr<const Control>               m_pParent;
+
+    ControlLayoutData();
+    ~ControlLayoutData();
+
+    tools::Rectangle GetCharacterBounds( tools::Long nIndex ) const;
+    // returns the character index for corresponding to rPoint (in control coordinates)
+    // -1 is returned if no character is at that point
+    tools::Long GetIndexForPoint( const Point& rPoint ) const;
+    // returns the number of lines in the result of GetDisplayText()
+    tools::Long GetLineCount() const;
+    // returns the interval [start,end] of line nLine
+    // returns [-1,-1] for an invalid line
+    ::Pair GetLineStartEnd( tools::Long nLine ) const;
+    /** ToRelativeLineIndex changes a layout data index to a count relative to its line.
+
+    This is equivalent to getting the line start/end pairs with
+    GetLineStartEnd until the index lies within [start,end] of a line
+
+    @param nIndex
+    the absolute index inside the display text to be changed to a relative index
+
+    @returns
+    the relative index inside the displayed line or -1 if the absolute index does
+    not match any line
+    */
+    tools::Long ToRelativeLineIndex( tools::Long nIndex ) const;
+};
+
+} // namespace vcl
 
 class VCL_DLLPUBLIC Control : public vcl::Window
 {
 protected:
-    mutable std::unique_ptr<vcl::ControlLayoutData>  mpLayoutData;
+    mutable std::optional<vcl::ControlLayoutData>  mxLayoutData;
     VclPtr<OutputDevice>        mpReferenceDevice;
 
 private:
diff --git a/include/vcl/toolkit/controllayout.hxx b/include/vcl/toolkit/controllayout.hxx
deleted file mode 100644
index 44b721c17dab..000000000000
--- a/include/vcl/toolkit/controllayout.hxx
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#pragma once
-
-#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
-#error "don't use this in new code"
-#endif
-
-#include <rtl/ustring.hxx>
-#include <tools/gen.hxx>
-#include <vector>
-#include <vcl/ctrl.hxx>
-#include <vcl/dllapi.h>
-
-class Control;
-
-namespace vcl
-{
-
-struct VCL_DLLPUBLIC ControlLayoutData
-{
-    // contains the string really displayed
-    // there must be exactly one bounding rectangle in m_aUnicodeBoundRects
-    // for every character in m_aDisplayText
-    OUString                            m_aDisplayText;
-    // the bounding rectangle of every character
-    // where one character may consist of many glyphs
-    std::vector< tools::Rectangle >            m_aUnicodeBoundRects;
-    // start indices of lines
-    std::vector< tools::Long >                 m_aLineIndices;
-    // notify parent control on destruction
-    VclPtr<const Control>               m_pParent;
-
-    ControlLayoutData();
-    ~ControlLayoutData();
-
-    tools::Rectangle GetCharacterBounds( tools::Long nIndex ) const;
-    // returns the character index for corresponding to rPoint (in control coordinates)
-    // -1 is returned if no character is at that point
-    tools::Long GetIndexForPoint( const Point& rPoint ) const;
-    // returns the number of lines in the result of GetDisplayText()
-    tools::Long GetLineCount() const;
-    // returns the interval [start,end] of line nLine
-    // returns [-1,-1] for an invalid line
-    ::Pair GetLineStartEnd( tools::Long nLine ) const;
-    /** ToRelativeLineIndex changes a layout data index to a count relative to its line.
-
-    This is equivalent to getting the line start/end pairs with
-    GetLineStartEnd until the index lies within [start,end] of a line
-
-    @param nIndex
-    the absolute index inside the display text to be changed to a relative index
-
-    @returns
-    the relative index inside the displayed line or -1 if the absolute index does
-    not match any line
-    */
-    tools::Long ToRelativeLineIndex( tools::Long nIndex ) const;
-};
-
-} // namespace vcl
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 83baec466610..c2cc51592e42 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -6459,7 +6459,6 @@ include/vcl/toolbox.hxx
 include/vcl/toolkit/button.hxx
 include/vcl/toolkit/calendar.hxx
 include/vcl/toolkit/combobox.hxx
-include/vcl/toolkit/controllayout.hxx
 include/vcl/toolkit/dialog.hxx
 include/vcl/toolkit/edit.hxx
 include/vcl/toolkit/field.hxx
diff --git a/vcl/inc/pch/precompiled_vcl.hxx b/vcl/inc/pch/precompiled_vcl.hxx
index cf78b4ff9e0e..b42d7e50c2f5 100644
--- a/vcl/inc/pch/precompiled_vcl.hxx
+++ b/vcl/inc/pch/precompiled_vcl.hxx
@@ -334,7 +334,6 @@
 #include <vcl/toolbox.hxx>
 #include <vcl/toolkit/button.hxx>
 #include <vcl/toolkit/combobox.hxx>
-#include <vcl/toolkit/controllayout.hxx>
 #include <vcl/toolkit/dialog.hxx>
 #include <vcl/toolkit/edit.hxx>
 #include <vcl/toolkit/fixed.hxx>
diff --git a/vcl/inc/toolbox.h b/vcl/inc/toolbox.h
index e5b1fe8b647a..9b6ae789e221 100644
--- a/vcl/inc/toolbox.h
+++ b/vcl/inc/toolbox.h
@@ -21,7 +21,6 @@
 #define INCLUDED_VCL_INC_TOOLBOX_H
 
 #include <vcl/toolbox.hxx>
-#include <vcl/toolkit/controllayout.hxx>
 
 #include <optional>
 #include <vector>
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 68b368b56c0e..e8c1b9854862 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -27,7 +27,6 @@
 #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>
@@ -1340,7 +1339,7 @@ void PushButton::KeyUp( const KeyEvent& rKEvt )
 
 void PushButton::FillLayoutData() const
 {
-    mpLayoutData.reset( new vcl::ControlLayoutData );
+    mxLayoutData.emplace();
     const_cast<PushButton*>(this)->Invalidate();
 }
 
@@ -2435,7 +2434,7 @@ void RadioButton::KeyUp( const KeyEvent& rKEvt )
 
 void RadioButton::FillLayoutData() const
 {
-    mpLayoutData.reset( new vcl::ControlLayoutData );
+    mxLayoutData.emplace();
     const_cast<RadioButton*>(this)->Invalidate();
 }
 
@@ -3249,7 +3248,7 @@ void CheckBox::KeyUp( const KeyEvent& rKEvt )
 
 void CheckBox::FillLayoutData() const
 {
-    mpLayoutData.reset( new vcl::ControlLayoutData );
+    mxLayoutData.emplace();
     const_cast<CheckBox*>(this)->Invalidate();
 }
 
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 85b418a14f86..5fc86dd6d4f9 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -22,7 +22,6 @@
 #include <set>
 
 #include <comphelper/string.hxx>
-#include <vcl/toolkit/controllayout.hxx>
 #include <vcl/toolkit/lstbox.hxx>
 #include <vcl/builder.hxx>
 #include <vcl/commandevent.hxx>
@@ -607,7 +606,7 @@ bool ComboBox::IsDropDownBox() const { return m_pImpl->m_pFloatWin != nullptr; }
 
 void ComboBox::FillLayoutData() const
 {
-    mpLayoutData.reset( new vcl::ControlLayoutData );
+    mxLayoutData.emplace();
     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 28af923cb168..cf221b2b02c7 100644
--- a/vcl/source/control/ctrl.cxx
+++ b/vcl/source/control/ctrl.cxx
@@ -23,7 +23,6 @@
 #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>
@@ -57,7 +56,7 @@ Control::~Control()
 
 void Control::dispose()
 {
-    mpLayoutData.reset();
+    mxLayoutData.reset();
     mpReferenceDevice.clear();
     Window::dispose();
 }
@@ -83,13 +82,13 @@ void Control::FillLayoutData() const
 
 void Control::CreateLayoutData() const
 {
-    SAL_WARN_IF( mpLayoutData, "vcl", "Control::CreateLayoutData: should be called with non-existent layout data only!" );
-    mpLayoutData.reset( new vcl::ControlLayoutData );
+    SAL_WARN_IF( mxLayoutData, "vcl", "Control::CreateLayoutData: should be called with non-existent layout data only!" );
+    mxLayoutData.emplace();
 }
 
 bool Control::HasLayoutData() const
 {
-    return mpLayoutData != nullptr;
+    return bool(mxLayoutData);
 }
 
 void Control::SetText( const OUString& rStr )
@@ -111,7 +110,7 @@ tools::Rectangle Control::GetCharacterBounds( tools::Long nIndex ) const
 {
     if( !HasLayoutData() )
         FillLayoutData();
-    return mpLayoutData ? mpLayoutData->GetCharacterBounds( nIndex ) : tools::Rectangle();
+    return mxLayoutData ? mxLayoutData->GetCharacterBounds( nIndex ) : tools::Rectangle();
 }
 
 tools::Long ControlLayoutData::GetIndexForPoint( const Point& rPoint ) const
@@ -135,7 +134,7 @@ tools::Long Control::GetIndexForPoint( const Point& rPoint ) const
 {
     if( ! HasLayoutData() )
         FillLayoutData();
-    return mpLayoutData ? mpLayoutData->GetIndexForPoint( rPoint ) : -1;
+    return mxLayoutData ? mxLayoutData->GetIndexForPoint( rPoint ) : -1;
 }
 
 tools::Long ControlLayoutData::GetLineCount() const
@@ -173,7 +172,7 @@ Pair Control::GetLineStartEnd( tools::Long nLine ) const
 {
     if( !HasLayoutData() )
         FillLayoutData();
-    return mpLayoutData ? mpLayoutData->GetLineStartEnd( nLine ) : Pair( -1, -1 );
+    return mxLayoutData ? mxLayoutData->GetLineStartEnd( nLine ) : Pair( -1, -1 );
 }
 
 tools::Long ControlLayoutData::ToRelativeLineIndex( tools::Long nIndex ) const
@@ -212,14 +211,14 @@ tools::Long Control::ToRelativeLineIndex( tools::Long nIndex ) const
 {
     if( !HasLayoutData() )
         FillLayoutData();
-    return mpLayoutData ? mpLayoutData->ToRelativeLineIndex( nIndex ) : -1;
+    return mxLayoutData ? mxLayoutData->ToRelativeLineIndex( nIndex ) : -1;
 }
 
 OUString Control::GetDisplayText() const
 {
     if( !HasLayoutData() )
         FillLayoutData();
-    return mpLayoutData ? mpLayoutData->m_aDisplayText : GetText();
+    return mxLayoutData ? mxLayoutData->m_aDisplayText : GetText();
 }
 
 bool Control::EventNotify( NotifyEvent& rNEvt )
@@ -270,23 +269,23 @@ void Control::AppendLayoutData( const Control& rSubControl ) const
 {
     if( !rSubControl.HasLayoutData() )
         rSubControl.FillLayoutData();
-    if( !rSubControl.HasLayoutData() || rSubControl.mpLayoutData->m_aDisplayText.isEmpty() )
+    if( !rSubControl.HasLayoutData() || rSubControl.mxLayoutData->m_aDisplayText.isEmpty() )
         return;
 
-    tools::Long nCurrentIndex = mpLayoutData->m_aDisplayText.getLength();
-    mpLayoutData->m_aDisplayText += rSubControl.mpLayoutData->m_aDisplayText;
-    int nLines = rSubControl.mpLayoutData->m_aLineIndices.size();
+    tools::Long nCurrentIndex = mxLayoutData->m_aDisplayText.getLength();
+    mxLayoutData->m_aDisplayText += rSubControl.mxLayoutData->m_aDisplayText;
+    int nLines = rSubControl.mxLayoutData->m_aLineIndices.size();
     int n;
-    mpLayoutData->m_aLineIndices.push_back( nCurrentIndex );
+    mxLayoutData->m_aLineIndices.push_back( nCurrentIndex );
     for( n = 1; n < nLines; n++ )
-        mpLayoutData->m_aLineIndices.push_back( rSubControl.mpLayoutData->m_aLineIndices[n] + nCurrentIndex );
-    int nRectangles = rSubControl.mpLayoutData->m_aUnicodeBoundRects.size();
+        mxLayoutData->m_aLineIndices.push_back( rSubControl.mxLayoutData->m_aLineIndices[n] + nCurrentIndex );
+    int nRectangles = rSubControl.mxLayoutData->m_aUnicodeBoundRects.size();
     tools::Rectangle aRel = rSubControl.GetWindowExtentsRelative(this);
     for( n = 0; n < nRectangles; n++ )
     {
-        tools::Rectangle aRect = rSubControl.mpLayoutData->m_aUnicodeBoundRects[n];
+        tools::Rectangle aRect = rSubControl.mxLayoutData->m_aUnicodeBoundRects[n];
         aRect.Move( aRel.Left(), aRel.Top() );
-        mpLayoutData->m_aUnicodeBoundRects.push_back( aRect );
+        mxLayoutData->m_aUnicodeBoundRects.push_back( aRect );
     }
 }
 
@@ -320,12 +319,12 @@ bool Control::ImplCallEventListenersAndHandler( VclEventId nEvent, std::function
 void Control::SetLayoutDataParent( const Control* pParent ) const
 {
     if( HasLayoutData() )
-        mpLayoutData->m_pParent = pParent;
+        mxLayoutData->m_pParent = pParent;
 }
 
 void Control::ImplClearLayoutData() const
 {
-    mpLayoutData.reset();
+    mxLayoutData.reset();
 }
 
 void Control::ImplDrawFrame( OutputDevice* pDev, tools::Rectangle& rRect )
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 4b6adef6bce7..c2329c45dc78 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -21,7 +21,6 @@
 #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>
@@ -1716,7 +1715,7 @@ void Edit::KeyInput( const KeyEvent& rKEvt )
 
 void Edit::FillLayoutData() const
 {
-    mpLayoutData.reset( new vcl::ControlLayoutData );
+    mxLayoutData.emplace();
     const_cast<Edit*>(this)->Invalidate();
 }
 
diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx
index 467ac69d350a..b40e82048aae 100644
--- a/vcl/source/control/fixed.cxx
+++ b/vcl/source/control/fixed.cxx
@@ -19,7 +19,6 @@
 
 #include <vcl/decoview.hxx>
 #include <vcl/event.hxx>
-#include <vcl/toolkit/controllayout.hxx>
 #include <vcl/toolkit/fixed.hxx>
 #include <vcl/settings.hxx>
 
@@ -153,12 +152,12 @@ void FixedText::ImplDraw(OutputDevice* pDev, DrawFlags nDrawFlags,
         nTextStyle |= DrawTextFlags::Mono;
 
     if( bFillLayout )
-        mpLayoutData->m_aDisplayText.clear();
+        mxLayoutData->m_aDisplayText.clear();
 
     const tools::Rectangle aRect(aPos, rSize);
     DrawControlText(*pDev, aRect, aText, nTextStyle,
-        bFillLayout ? &mpLayoutData->m_aUnicodeBoundRects : nullptr,
-        bFillLayout ? &mpLayoutData->m_aDisplayText : nullptr);
+        bFillLayout ? &mxLayoutData->m_aUnicodeBoundRects : nullptr,
+        bFillLayout ? &mxLayoutData->m_aDisplayText : nullptr);
 }
 
 void FixedText::ApplySettings(vcl::RenderContext& rRenderContext)
@@ -348,7 +347,7 @@ Size FixedText::GetOptimalSize() const
 
 void FixedText::FillLayoutData() const
 {
-    mpLayoutData.reset( new vcl::ControlLayoutData );
+    mxLayoutData.emplace();
     ImplDraw(const_cast<FixedText*>(this)->GetOutDev(), DrawFlags::NONE, Point(), GetOutputSizePixel(), true);
     //const_cast<FixedText*>(this)->Invalidate();
 }
@@ -553,7 +552,7 @@ FixedLine::FixedLine( vcl::Window* pParent, WinBits nStyle ) :
 
 void FixedLine::FillLayoutData() const
 {
-    mpLayoutData.reset( new vcl::ControlLayoutData );
+    mxLayoutData.emplace();
     const_cast<FixedLine*>(this)->Invalidate();
 }
 
diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx
index f3b06bf75543..a607aa84a45f 100644
--- a/vcl/source/control/imp_listbox.cxx
+++ b/vcl/source/control/imp_listbox.cxx
@@ -23,7 +23,6 @@
 #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>
@@ -1746,7 +1745,7 @@ void ImplListBoxWindow::DrawEntry(vcl::RenderContext& rRenderContext, sal_Int32
 
 void ImplListBoxWindow::FillLayoutData() const
 {
-    mpLayoutData.reset( new vcl::ControlLayoutData );
+    mxLayoutData.emplace();
     const_cast<ImplListBoxWindow*>(this)->Invalidate(tools::Rectangle(Point(0, 0), GetOutDev()->GetOutputSize()));
 }
 
@@ -2497,7 +2496,7 @@ void ImplWin::MouseButtonDown( const MouseEvent& )
 
 void ImplWin::FillLayoutData() const
 {
-    mpLayoutData.reset( new vcl::ControlLayoutData );
+    mxLayoutData.emplace();
     ImplWin* pThis = const_cast<ImplWin*>(this);
     pThis->ImplDraw(*pThis->GetOutDev(), true);
 }
@@ -2715,8 +2714,8 @@ void ImplWin::DrawEntry(vcl::RenderContext& rRenderContext, bool bLayout)
             aTextRect.AdjustLeft(maImage.GetSizePixel().Width() + IMG_TXT_DISTANCE );
         }
 
-        std::vector< tools::Rectangle >* pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : nullptr;
-        OUString* pDisplayText = bLayout ? &mpLayoutData->m_aDisplayText : nullptr;
+        std::vector< tools::Rectangle >* pVector = bLayout ? &mxLayoutData->m_aUnicodeBoundRects : nullptr;
+        OUString* pDisplayText = bLayout ? &mxLayoutData->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 58987498ab81..ee53bf4e9858 100644
--- a/vcl/source/control/listbox.cxx
+++ b/vcl/source/control/listbox.cxx
@@ -20,7 +20,6 @@
 #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>
@@ -627,7 +626,7 @@ void ListBox::Resize()
 
 void ListBox::FillLayoutData() const
 {
-    mpLayoutData.reset( new vcl::ControlLayoutData );
+    mxLayoutData.emplace();
     const ImplListBoxWindow* rMainWin = mpImplLB->GetMainWindow();
     if( mpFloatWin )
     {
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index af8ecbc94edf..9cd3b545d841 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -20,7 +20,6 @@
 #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>
@@ -571,7 +570,7 @@ void SpinField::FillLayoutData() const
 {
     if (mbSpin)
     {
-        mpLayoutData.reset( new vcl::ControlLayoutData );
+        mxLayoutData.emplace();
         AppendLayoutData(*GetSubEdit());
         GetSubEdit()->SetLayoutDataParent(this);
     }
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index 09c1281d63db..2a5a46b52f70 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -28,7 +28,6 @@
 #include <vcl/toolkit/button.hxx>
 #include <vcl/tabpage.hxx>
 #include <vcl/tabctrl.hxx>
-#include <vcl/toolkit/controllayout.hxx>
 #include <vcl/layout.hxx>
 #include <vcl/toolkit/lstbox.hxx>
 #include <vcl/settings.hxx>
@@ -2021,9 +2020,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 = mpLayoutData->GetLineStartEnd( it->second );
+            Pair aPair = mxLayoutData->GetLineStartEnd( it->second );
             if( (aPair.B() - aPair.A()) >= nIndex )
-                aRet = mpLayoutData->GetCharacterBounds( aPair.A() + nIndex );
+                aRet = mxLayoutData->GetCharacterBounds( aPair.A() + nIndex );
         }
     }
 
@@ -2039,15 +2038,15 @@ tools::Long TabControl::GetIndexForPoint( const Point& rPoint, sal_uInt16& rPage
 
     if( HasLayoutData() )
     {
-        int nIndex = mpLayoutData->GetIndexForPoint( rPoint );
+        int nIndex = mxLayoutData->GetIndexForPoint( rPoint );
         if( nIndex != -1 )
         {
             // what line (->pageid) is this index in ?
-            int nLines = mpLayoutData->GetLineCount();
+            int nLines = mxLayoutData->GetLineCount();
             int nLine = -1;
             while( ++nLine < nLines )
             {
-                Pair aPair = mpLayoutData->GetLineStartEnd( nLine );
+                Pair aPair = mxLayoutData->GetLineStartEnd( nLine );
                 if( aPair.A() <= nIndex && aPair.B() >= nIndex )
                 {
                     nRet = nIndex - aPair.A();
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index ef11013a02fe..3c3f651b8cba 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -30,6 +30,7 @@
 #include <sal/log.hxx>
 #include <tools/lineend.hxx>
 #include <tools/debug.hxx>
+#include <vcl/ctrl.hxx>
 #include <vcl/gdimtf.hxx>
 #include <vcl/metaact.hxx>
 #include <vcl/metric.hxx>
@@ -37,7 +38,6 @@
 #include <vcl/virdev.hxx>
 #include <vcl/sysdata.hxx>
 #include <vcl/unohelp.hxx>
-#include <vcl/toolkit/controllayout.hxx>
 
 #include <config_fuzzers.h>
 #include <outdev.h>
diff --git a/vcl/source/toolkit/group.cxx b/vcl/source/toolkit/group.cxx
index eba98f708702..9b6099c3e285 100644
--- a/vcl/source/toolkit/group.cxx
+++ b/vcl/source/toolkit/group.cxx
@@ -18,7 +18,6 @@
  */
 
 #include <vcl/event.hxx>
-#include <vcl/toolkit/controllayout.hxx>
 #include <vcl/toolkit/group.hxx>
 #include <vcl/settings.hxx>
 
@@ -161,14 +160,14 @@ void GroupBox::ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags,
         }
     }
 
-    std::vector< tools::Rectangle >* pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : nullptr;
-    OUString* pDisplayText = bLayout ? &mpLayoutData->m_aDisplayText : nullptr;
+    std::vector< tools::Rectangle >* pVector = bLayout ? &mxLayoutData->m_aUnicodeBoundRects : nullptr;
+    OUString* pDisplayText = bLayout ? &mxLayoutData->m_aDisplayText : nullptr;
     DrawControlText( *pDev, aRect, aText, nTextStyle, pVector, pDisplayText );
 }
 
 void GroupBox::FillLayoutData() const
 {
-    mpLayoutData.reset( new vcl::ControlLayoutData );
+    mxLayoutData.emplace();
     const_cast<GroupBox*>(this)->ImplDraw( const_cast<GroupBox*>(this)->GetOutDev(), DrawFlags::NONE, Point(), GetOutputSizePixel(), true );
 }
 
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 8f0b0fe23d30..5acb1c795432 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -31,7 +31,6 @@
 #include <vcl/decoview.hxx>
 #include <vcl/menu.hxx>
 #include <vcl/taskpanelist.hxx>
-#include <vcl/toolkit/controllayout.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/commandinfoprovider.hxx>
 


More information about the Libreoffice-commits mailing list