[Libreoffice-commits] core.git: solenv/clang-format svx/source

Samuel Mehrbrodt (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 27 06:35:23 UTC 2019


 solenv/clang-format/blacklist |    1 
 svx/source/svdraw/svdedxv.cxx | 2006 ++++++++++++++++++++++--------------------
 2 files changed, 1069 insertions(+), 938 deletions(-)

New commits:
commit 7da92c6fff9549ebbea5e527b72ffd89faa46f71
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Mon Aug 19 15:16:40 2019 +0200
Commit:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Tue Aug 27 08:33:43 2019 +0200

    clang-format svx/source/svdraw/svdedxv.cxx
    
    This file had lots of inline ifs making it hard to read and debug.
    Format the file using clang-format.
    
    Change-Id: I591f2724f4b10002de34c62ca178caa2a1dde4c0
    Reviewed-on: https://gerrit.libreoffice.org/77726
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist
index 1973f44db94d..381ed56ec78e 100644
--- a/solenv/clang-format/blacklist
+++ b/solenv/clang-format/blacklist
@@ -14428,7 +14428,6 @@ svx/source/svdraw/svddrgv.cxx
 svx/source/svdraw/svdedtv.cxx
 svx/source/svdraw/svdedtv1.cxx
 svx/source/svdraw/svdedtv2.cxx
-svx/source/svdraw/svdedxv.cxx
 svx/source/svdraw/svdetc.cxx
 svx/source/svdraw/svdfmtf.cxx
 svx/source/svdraw/svdfmtf.hxx
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 69d9905c9477..bc4839d1ec15 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -18,93 +18,91 @@
  */
 
 #include <com/sun/star/i18n/WordType.hpp>
-#include <svtools/accessibilityoptions.hxx>
-#include <svx/svdedxv.hxx>
-#include <svl/solar.hrc>
-#include <svl/itemiter.hxx>
-#include <vcl/commandevent.hxx>
-#include <vcl/weld.hxx>
-#include <vcl/hatch.hxx>
-#include <svl/whiter.hxx>
-#include <svl/style.hxx>
-#include <editeng/editstat.hxx>
-#include <vcl/canvastools.hxx>
-#include <vcl/cursor.hxx>
-#include <editeng/unotext.hxx>
 #include <editeng/editdata.hxx>
 #include <editeng/editeng.hxx>
 #include <editeng/editobj.hxx>
+#include <editeng/editstat.hxx>
 #include <editeng/outlobj.hxx>
-#include <svx/svdoutl.hxx>
+#include <editeng/unotext.hxx>
+#include <svl/itemiter.hxx>
+#include <svl/solar.hrc>
+#include <svl/style.hxx>
+#include <svl/whiter.hxx>
+#include <svtools/accessibilityoptions.hxx>
 #include <svx/sdtfchim.hxx>
-#include <svx/svdotext.hxx>
-#include <svx/svdundo.hxx>
-#include <svx/svditer.hxx>
-#include <svx/svdpagv.hxx>
-#include <svx/svdpage.hxx>
+#include <svx/selectioncontroller.hxx>
+#include <svx/svdedxv.hxx>
 #include <svx/svdetc.hxx>
+#include <svx/svditer.hxx>
 #include <svx/svdotable.hxx>
-#include <svx/selectioncontroller.hxx>
+#include <svx/svdotext.hxx>
+#include <svx/svdoutl.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdundo.hxx>
+#include <vcl/canvastools.hxx>
+#include <vcl/commandevent.hxx>
+#include <vcl/cursor.hxx>
+#include <vcl/hatch.hxx>
+#include <vcl/weld.hxx>
 #ifdef DBG_UTIL
 #include <svdibrow.hxx>
 #endif
-#include <svx/svddrgv.hxx>
-#include <svx/strings.hrc>
-#include <svx/dialmgr.hxx>
-#include <svx/globl3d.hxx>
-#include <svx/textchain.hxx>
-#include <svx/textchaincursor.hxx>
-#include <editeng/outliner.hxx>
-#include <editeng/adjustitem.hxx>
-#include <svtools/colorcfg.hxx>
-#include <vcl/svapp.hxx>
-#include <svx/sdrpaintwindow.hxx>
-#include <svx/sdrundomanager.hxx>
-#include <sdr/overlay/overlaytools.hxx>
-#include <svx/sdr/table/tablecontroller.hxx>
+#include <comphelper/lok.hxx>
 #include <drawinglayer/processor2d/baseprocessor2d.hxx>
 #include <drawinglayer/processor2d/processor2dtools.hxx>
-#include <comphelper/lok.hxx>
+#include <editeng/adjustitem.hxx>
+#include <editeng/outliner.hxx>
+#include <sal/log.hxx>
+#include <sdr/overlay/overlaytools.hxx>
 #include <sfx2/viewsh.hxx>
-#include <svx/svdviter.hxx>
-#include <svx/sdr/overlay/overlayselection.hxx>
+#include <svtools/colorcfg.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/globl3d.hxx>
 #include <svx/sdr/overlay/overlaymanager.hxx>
+#include <svx/sdr/overlay/overlayselection.hxx>
+#include <svx/sdr/table/tablecontroller.hxx>
 #include <svx/sdrpagewindow.hxx>
-#include <sal/log.hxx>
+#include <svx/sdrpaintwindow.hxx>
+#include <svx/sdrundomanager.hxx>
+#include <svx/strings.hrc>
+#include <svx/svddrgv.hxx>
+#include <svx/svdviter.hxx>
+#include <svx/textchain.hxx>
+#include <svx/textchaincursor.hxx>
 #include <tools/debug.hxx>
+#include <vcl/svapp.hxx>
 
 #include <memory>
 
 void SdrObjEditView::ImpClearVars()
 {
-    bQuickTextEditMode=true;
+    bQuickTextEditMode = true;
     pTextEditOutliner.reset();
-    pTextEditOutlinerView=nullptr;
-    pTextEditPV=nullptr;
-    pTextEditWin=nullptr;
-    pTextEditCursorBuffer=nullptr;
-    bTextEditNewObj=false;
-    bMacroDown=false;
-    pMacroObj=nullptr;
-    pMacroPV=nullptr;
-    pMacroWin=nullptr;
-    nMacroTol=0;
-    bTextEditDontDelete=false;
-    bTextEditOnlyOneView=false;
-}
-
-SdrObjEditView::SdrObjEditView(
-    SdrModel& rSdrModel,
-    OutputDevice* pOut)
-:   SdrGlueEditView(rSdrModel, pOut),
-    mpOldTextEditUndoManager(nullptr)
+    pTextEditOutlinerView = nullptr;
+    pTextEditPV = nullptr;
+    pTextEditWin = nullptr;
+    pTextEditCursorBuffer = nullptr;
+    bTextEditNewObj = false;
+    bMacroDown = false;
+    pMacroObj = nullptr;
+    pMacroPV = nullptr;
+    pMacroWin = nullptr;
+    nMacroTol = 0;
+    bTextEditDontDelete = false;
+    bTextEditOnlyOneView = false;
+}
+
+SdrObjEditView::SdrObjEditView(SdrModel& rSdrModel, OutputDevice* pOut)
+    : SdrGlueEditView(rSdrModel, pOut)
+    , mpOldTextEditUndoManager(nullptr)
 {
     ImpClearVars();
 }
 
 SdrObjEditView::~SdrObjEditView()
 {
-    pTextEditWin = nullptr;            // so there's no ShowCursor in SdrEndTextEdit
+    pTextEditWin = nullptr; // so there's no ShowCursor in SdrEndTextEdit
     assert(!IsTextEdit());
     if (IsTextEdit())
         SdrEndTextEdit();
@@ -112,20 +110,19 @@ SdrObjEditView::~SdrObjEditView()
     assert(nullptr == mpOldTextEditUndoManager); // should have been reset
 }
 
-bool SdrObjEditView::IsAction() const
-{
-    return IsMacroObj() || SdrGlueEditView::IsAction();
-}
+bool SdrObjEditView::IsAction() const { return IsMacroObj() || SdrGlueEditView::IsAction(); }
 
 void SdrObjEditView::MovAction(const Point& rPnt)
 {
-    if (IsMacroObj()) MovMacroObj(rPnt);
+    if (IsMacroObj())
+        MovMacroObj(rPnt);
     SdrGlueEditView::MovAction(rPnt);
 }
 
 void SdrObjEditView::EndAction()
 {
-    if (IsMacroObj()) EndMacroObj();
+    if (IsMacroObj())
+        EndMacroObj();
     SdrGlueEditView::EndAction();
 }
 
@@ -164,7 +161,8 @@ SdrPageView* SdrObjEditView::ShowSdrPage(SdrPage* pPage)
             // Call GetSfxViewShell() to make sure ImpMakeOutlinerView()
             // registers the view shell of this draw view, and not the view
             // shell of pView.
-            OutlinerView* pOutlinerView = pView->ImpMakeOutlinerView(static_cast<vcl::Window*>(pOutDev), nullptr, GetSfxViewShell());
+            OutlinerView* pOutlinerView = pView->ImpMakeOutlinerView(
+                static_cast<vcl::Window*>(pOutDev), nullptr, GetSfxViewShell());
             pOutlinerView->HideCursor();
             pView->GetTextEditOutliner()->InsertView(pOutlinerView);
         }
@@ -173,10 +171,11 @@ SdrPageView* SdrObjEditView::ShowSdrPage(SdrPage* pPage)
     return pPageView;
 }
 
-namespace {
-
+namespace
+{
 /// Removes outliner views registered in other draw views that use pOutputDevice.
-void lcl_RemoveTextEditOutlinerViews(SdrObjEditView const * pThis, SdrPageView const * pPageView, OutputDevice const * pOutputDevice)
+void lcl_RemoveTextEditOutlinerViews(SdrObjEditView const* pThis, SdrPageView const* pPageView,
+                                     OutputDevice const* pOutputDevice)
 {
     if (!comphelper::LibreOfficeKit::isActive())
         return;
@@ -205,7 +204,6 @@ void lcl_RemoveTextEditOutlinerViews(SdrObjEditView const * pThis, SdrPageView c
         }
     }
 }
-
 }
 
 void SdrObjEditView::HideSdrPage()
@@ -217,26 +215,32 @@ void SdrObjEditView::HideSdrPage()
 
 void SdrObjEditView::TakeActionRect(tools::Rectangle& rRect) const
 {
-    if (IsMacroObj()) {
-        rRect=pMacroObj->GetCurrentBoundRect();
-    } else {
+    if (IsMacroObj())
+    {
+        rRect = pMacroObj->GetCurrentBoundRect();
+    }
+    else
+    {
         SdrGlueEditView::TakeActionRect(rRect);
     }
 }
 
 void SdrObjEditView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
 {
-    SdrGlueEditView::Notify(rBC,rHint);
-    if (pTextEditOutliner!=nullptr) {
+    SdrGlueEditView::Notify(rBC, rHint);
+    if (pTextEditOutliner != nullptr)
+    {
         // change of printer while editing
         if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint)
         {
             const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
-            SdrHintKind eKind=pSdrHint->GetKind();
-            if (eKind==SdrHintKind::RefDeviceChange) {
+            SdrHintKind eKind = pSdrHint->GetKind();
+            if (eKind == SdrHintKind::RefDeviceChange)
+            {
                 pTextEditOutliner->SetRefDevice(mpModel->GetRefDevice());
             }
-            if (eKind==SdrHintKind::DefaultTabChange) {
+            if (eKind == SdrHintKind::DefaultTabChange)
+            {
                 pTextEditOutliner->SetDefTab(mpModel->GetDefaultTabulator());
             }
         }
@@ -246,16 +250,19 @@ void SdrObjEditView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
 void SdrObjEditView::ModelHasChanged()
 {
     SdrGlueEditView::ModelHasChanged();
-    if (mxTextEditObj.is() && !mxTextEditObj->IsInserted()) SdrEndTextEdit(); // object deleted
+    if (mxTextEditObj.is() && !mxTextEditObj->IsInserted())
+        SdrEndTextEdit(); // object deleted
     // TextEditObj changed?
-    if (IsTextEdit()) {
-        SdrTextObj* pTextObj= mxTextEditObj.get();
-        if (pTextObj!=nullptr) {
-            sal_uIntPtr nOutlViewCnt=pTextEditOutliner->GetViewCount();
-            bool bAreaChg=false;
-            bool bAnchorChg=false;
-            bool bColorChg=false;
-            bool bContourFrame=pTextObj->IsContourTextFrame();
+    if (IsTextEdit())
+    {
+        SdrTextObj* pTextObj = mxTextEditObj.get();
+        if (pTextObj != nullptr)
+        {
+            sal_uIntPtr nOutlViewCnt = pTextEditOutliner->GetViewCount();
+            bool bAreaChg = false;
+            bool bAnchorChg = false;
+            bool bColorChg = false;
+            bool bContourFrame = pTextObj->IsContourTextFrame();
             EEAnchorMode eNewAnchor(EEAnchorMode::VCenterHCenter);
             tools::Rectangle aOldArea(aMinTextEditArea);
             aOldArea.Union(aTextEditArea);
@@ -265,67 +272,77 @@ void SdrObjEditView::ModelHasChanged()
                 Size aPaperMax1;
                 tools::Rectangle aEditArea1;
                 tools::Rectangle aMinArea1;
-                pTextObj->TakeTextEditArea(&aPaperMin1,&aPaperMax1,&aEditArea1,&aMinArea1);
+                pTextObj->TakeTextEditArea(&aPaperMin1, &aPaperMax1, &aEditArea1, &aMinArea1);
                 Point aPvOfs(pTextObj->GetTextEditOffset());
 
                 // add possible GridOffset to up-to-now view-independent EditAreas
                 basegfx::B2DVector aGridOffset(0.0, 0.0);
-                if(getPossibleGridOffsetForSdrObject(aGridOffset, pTextObj, GetSdrPageView()))
+                if (getPossibleGridOffsetForSdrObject(aGridOffset, pTextObj, GetSdrPageView()))
                 {
-                    const Point aOffset(
-                        basegfx::fround(aGridOffset.getX()),
-                        basegfx::fround(aGridOffset.getY()));
+                    const Point aOffset(basegfx::fround(aGridOffset.getX()),
+                                        basegfx::fround(aGridOffset.getY()));
 
                     aEditArea1 += aOffset;
                     aMinArea1 += aOffset;
                 }
 
-                aEditArea1.Move(aPvOfs.X(),aPvOfs.Y());
-                aMinArea1.Move(aPvOfs.X(),aPvOfs.Y());
+                aEditArea1.Move(aPvOfs.X(), aPvOfs.Y());
+                aMinArea1.Move(aPvOfs.X(), aPvOfs.Y());
                 tools::Rectangle aNewArea(aMinArea1);
                 aNewArea.Union(aEditArea1);
 
-                if (aNewArea!=aOldArea || aEditArea1!=aTextEditArea || aMinArea1!=aMinTextEditArea ||
-                    pTextEditOutliner->GetMinAutoPaperSize()!=aPaperMin1 || pTextEditOutliner->GetMaxAutoPaperSize()!=aPaperMax1) {
-                    aTextEditArea=aEditArea1;
-                    aMinTextEditArea=aMinArea1;
+                if (aNewArea != aOldArea || aEditArea1 != aTextEditArea
+                    || aMinArea1 != aMinTextEditArea
+                    || pTextEditOutliner->GetMinAutoPaperSize() != aPaperMin1
+                    || pTextEditOutliner->GetMaxAutoPaperSize() != aPaperMax1)
+                {
+                    aTextEditArea = aEditArea1;
+                    aMinTextEditArea = aMinArea1;
                     pTextEditOutliner->SetUpdateMode(false);
                     pTextEditOutliner->SetMinAutoPaperSize(aPaperMin1);
                     pTextEditOutliner->SetMaxAutoPaperSize(aPaperMax1);
-                    pTextEditOutliner->SetPaperSize(Size(0,0)); // re-format Outliner
-                    if (!bContourFrame) {
+                    pTextEditOutliner->SetPaperSize(Size(0, 0)); // re-format Outliner
+                    if (!bContourFrame)
+                    {
                         pTextEditOutliner->ClearPolygon();
-                        EEControlBits nStat=pTextEditOutliner->GetControlWord();
-                        nStat|=EEControlBits::AUTOPAGESIZE;
+                        EEControlBits nStat = pTextEditOutliner->GetControlWord();
+                        nStat |= EEControlBits::AUTOPAGESIZE;
                         pTextEditOutliner->SetControlWord(nStat);
-                    } else {
-                        EEControlBits nStat=pTextEditOutliner->GetControlWord();
-                        nStat&=~EEControlBits::AUTOPAGESIZE;
+                    }
+                    else
+                    {
+                        EEControlBits nStat = pTextEditOutliner->GetControlWord();
+                        nStat &= ~EEControlBits::AUTOPAGESIZE;
                         pTextEditOutliner->SetControlWord(nStat);
                         tools::Rectangle aAnchorRect;
                         pTextObj->TakeTextAnchorRect(aAnchorRect);
-                        pTextObj->ImpSetContourPolygon(*pTextEditOutliner,aAnchorRect, true);
+                        pTextObj->ImpSetContourPolygon(*pTextEditOutliner, aAnchorRect, true);
                     }
-                    for (sal_uIntPtr nOV=0; nOV<nOutlViewCnt; nOV++) {
-                        OutlinerView* pOLV=pTextEditOutliner->GetView(nOV);
-                        EVControlBits nStat0=pOLV->GetControlWord();
-                        EVControlBits nStat=nStat0;
+                    for (sal_uIntPtr nOV = 0; nOV < nOutlViewCnt; nOV++)
+                    {
+                        OutlinerView* pOLV = pTextEditOutliner->GetView(nOV);
+                        EVControlBits nStat0 = pOLV->GetControlWord();
+                        EVControlBits nStat = nStat0;
                         // AutoViewSize only if not ContourFrame.
-                        if (!bContourFrame) nStat|=EVControlBits::AUTOSIZE;
-                        else nStat&=~EVControlBits::AUTOSIZE;
-                        if (nStat!=nStat0) pOLV->SetControlWord(nStat);
+                        if (!bContourFrame)
+                            nStat |= EVControlBits::AUTOSIZE;
+                        else
+                            nStat &= ~EVControlBits::AUTOSIZE;
+                        if (nStat != nStat0)
+                            pOLV->SetControlWord(nStat);
                     }
                     pTextEditOutliner->SetUpdateMode(true);
-                    bAreaChg=true;
+                    bAreaChg = true;
                 }
             }
-            if (pTextEditOutlinerView!=nullptr) { // check fill and anchor
-                EEAnchorMode eOldAnchor=pTextEditOutlinerView->GetAnchorMode();
-                eNewAnchor=pTextObj->GetOutlinerViewAnchorMode();
-                bAnchorChg=eOldAnchor!=eNewAnchor;
+            if (pTextEditOutlinerView != nullptr)
+            { // check fill and anchor
+                EEAnchorMode eOldAnchor = pTextEditOutlinerView->GetAnchorMode();
+                eNewAnchor = pTextObj->GetOutlinerViewAnchorMode();
+                bAnchorChg = eOldAnchor != eNewAnchor;
                 Color aOldColor(pTextEditOutlinerView->GetBackgroundColor());
                 aNewColor = GetTextEditBackgroundColor(*this);
-                bColorChg=aOldColor!=aNewColor;
+                bColorChg = aOldColor != aNewColor;
             }
             // refresh always when it's a contour frame. That
             // refresh is necessary since it triggers the repaint
@@ -344,26 +361,27 @@ void SdrObjEditView::ModelHasChanged()
             // again on ModelHasChanged().
             if (bContourFrame || bAreaChg || bAnchorChg || bColorChg)
             {
-                for (sal_uIntPtr nOV=0; nOV<nOutlViewCnt; nOV++)
+                for (sal_uIntPtr nOV = 0; nOV < nOutlViewCnt; nOV++)
                 {
-                    OutlinerView* pOLV=pTextEditOutliner->GetView(nOV);
+                    OutlinerView* pOLV = pTextEditOutliner->GetView(nOV);
                     { // invalidate old OutlinerView area
-                        vcl::Window* pWin=pOLV->GetWindow();
+                        vcl::Window* pWin = pOLV->GetWindow();
                         tools::Rectangle aTmpRect(aOldArea);
-                        sal_uInt16 nPixSiz=pOLV->GetInvalidateMore()+1;
-                        Size aMore(pWin->PixelToLogic(Size(nPixSiz,nPixSiz)));
-                        aTmpRect.AdjustLeft( -(aMore.Width()) );
-                        aTmpRect.AdjustRight(aMore.Width() );
-                        aTmpRect.AdjustTop( -(aMore.Height()) );
-                        aTmpRect.AdjustBottom(aMore.Height() );
-                        InvalidateOneWin(*pWin,aTmpRect);
+                        sal_uInt16 nPixSiz = pOLV->GetInvalidateMore() + 1;
+                        Size aMore(pWin->PixelToLogic(Size(nPixSiz, nPixSiz)));
+                        aTmpRect.AdjustLeft(-(aMore.Width()));
+                        aTmpRect.AdjustRight(aMore.Width());
+                        aTmpRect.AdjustTop(-(aMore.Height()));
+                        aTmpRect.AdjustBottom(aMore.Height());
+                        InvalidateOneWin(*pWin, aTmpRect);
                     }
                     if (bAnchorChg)
                         pOLV->SetAnchorMode(eNewAnchor);
                     if (bColorChg)
-                        pOLV->SetBackgroundColor( aNewColor );
+                        pOLV->SetBackgroundColor(aNewColor);
 
-                    pOLV->SetOutputArea(aTextEditArea); // because otherwise, we're not re-anchoring correctly
+                    pOLV->SetOutputArea(
+                        aTextEditArea); // because otherwise, we're not re-anchoring correctly
                     ImpInvalidateOutlinerView(*pOLV);
                 }
                 pTextEditOutlinerView->ShowCursor();
@@ -375,7 +393,7 @@ void SdrObjEditView::ModelHasChanged()
 
 namespace
 {
-    /**
+/**
         Helper class to visualize the content of an active EditView as an
         OverlayObject. These objects work with Primitives and are handled
         from the OverlayManager(s) in place as needed.
@@ -388,238 +406,223 @@ namespace
         It buffers as much as possible locally and *only* triggers a real
         change (see call to objectChange()) when really needed.
      */
-    class TextEditOverlayObject : public sdr::overlay::OverlayObject
-    {
-    protected:
-        /// local access to associated sdr::overlay::OverlaySelection
-        sdr::overlay::OverlaySelection*     mpOverlaySelection;
+class TextEditOverlayObject : public sdr::overlay::OverlayObject
+{
+protected:
+    /// local access to associated sdr::overlay::OverlaySelection
+    sdr::overlay::OverlaySelection* mpOverlaySelection;
 
-        /// local definition depends on active OutlinerView
-        OutlinerView&                       mrOutlinerView;
+    /// local definition depends on active OutlinerView
+    OutlinerView& mrOutlinerView;
 
-        /// geometry definitions with buffering
-        basegfx::B2DRange                   maLastRange;
-        basegfx::B2DRange                   maRange;
+    /// geometry definitions with buffering
+    basegfx::B2DRange maLastRange;
+    basegfx::B2DRange maRange;
 
-        /// text content definitions with buffering
-        drawinglayer::primitive2d::Primitive2DContainer     maTextPrimitives;
-        drawinglayer::primitive2d::Primitive2DContainer     maLastTextPrimitives;
+    /// text content definitions with buffering
+    drawinglayer::primitive2d::Primitive2DContainer maTextPrimitives;
+    drawinglayer::primitive2d::Primitive2DContainer maLastTextPrimitives;
 
-        /// bitfield
-        bool const                    mbVisualizeSurroundingFrame : 1;
+    /// bitfield
+    bool const mbVisualizeSurroundingFrame : 1;
 
-        // geometry creation for OverlayObject, can use local *Last* values
-        virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence() override;
+    // geometry creation for OverlayObject, can use local *Last* values
+    virtual drawinglayer::primitive2d::Primitive2DContainer
+    createOverlayObjectPrimitive2DSequence() override;
 
-    public:
-        TextEditOverlayObject(
-            const Color& rColor,
-            OutlinerView& rOutlinerView,
-            bool bVisualizeSurroundingFrame);
-        virtual ~TextEditOverlayObject() override;
+public:
+    TextEditOverlayObject(const Color& rColor, OutlinerView& rOutlinerView,
+                          bool bVisualizeSurroundingFrame);
+    virtual ~TextEditOverlayObject() override;
 
-        // data read access
-        const sdr::overlay::OverlaySelection* getOverlaySelection() const { return mpOverlaySelection; }
-        const OutlinerView& getOutlinerView() const { return mrOutlinerView; }
-        bool getVisualizeSurroundingFrame() const { return mbVisualizeSurroundingFrame; }
+    // data read access
+    const sdr::overlay::OverlaySelection* getOverlaySelection() const { return mpOverlaySelection; }
+    const OutlinerView& getOutlinerView() const { return mrOutlinerView; }
+    bool getVisualizeSurroundingFrame() const { return mbVisualizeSurroundingFrame; }
 
-        /// override to check conditions for last createOverlayObjectPrimitive2DSequence
-        virtual drawinglayer::primitive2d::Primitive2DContainer getOverlayObjectPrimitive2DSequence() const override;
+    /// override to check conditions for last createOverlayObjectPrimitive2DSequence
+    virtual drawinglayer::primitive2d::Primitive2DContainer
+    getOverlayObjectPrimitive2DSequence() const override;
 
-        // data write access. In this OverlayObject we only have the
-        // callback that triggers detecting if something *has* changed
-        void checkDataChange(const basegfx::B2DRange& rMinTextEditArea);
-        void checkSelectionChange();
-    };
+    // data write access. In this OverlayObject we only have the
+    // callback that triggers detecting if something *has* changed
+    void checkDataChange(const basegfx::B2DRange& rMinTextEditArea);
+    void checkSelectionChange();
+};
 
-    drawinglayer::primitive2d::Primitive2DContainer TextEditOverlayObject::createOverlayObjectPrimitive2DSequence()
+drawinglayer::primitive2d::Primitive2DContainer
+TextEditOverlayObject::createOverlayObjectPrimitive2DSequence()
+{
+    drawinglayer::primitive2d::Primitive2DContainer aRetval;
+
+    /// outer frame visualization
+    if (getVisualizeSurroundingFrame())
     {
-        drawinglayer::primitive2d::Primitive2DContainer aRetval;
+        const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
+        const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01);
+        const sal_uInt16 nPixSiz(getOutlinerView().GetInvalidateMore() - 1);
 
-        /// outer frame visualization
-        if (getVisualizeSurroundingFrame())
-        {
-            const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
-            const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01);
-            const sal_uInt16 nPixSiz(getOutlinerView().GetInvalidateMore() - 1);
+        aRetval.push_back(new drawinglayer::primitive2d::OverlayRectanglePrimitive(
+            maRange, getBaseColor().getBColor(), fTransparence, std::max(6, nPixSiz - 2), // grow
+            0.0, // shrink
+            0.0));
+    }
 
-            aRetval.push_back(
-                new drawinglayer::primitive2d::OverlayRectanglePrimitive(
-                    maRange,
-                    getBaseColor().getBColor(),
-                    fTransparence,
-                    std::max(6, nPixSiz - 2), // grow
-                    0.0, // shrink
-                    0.0));
-        }
+    // add buffered TextPrimitives
+    aRetval.append(maTextPrimitives);
 
-        // add buffered TextPrimitives
-        aRetval.append(maTextPrimitives);
+    return aRetval;
+}
 
-        return aRetval;
-    }
+TextEditOverlayObject::TextEditOverlayObject(const Color& rColor, OutlinerView& rOutlinerView,
+                                             bool bVisualizeSurroundingFrame)
+    : OverlayObject(rColor)
+    , mpOverlaySelection(nullptr)
+    , mrOutlinerView(rOutlinerView)
+    , maLastRange()
+    , maRange()
+    , maTextPrimitives()
+    , maLastTextPrimitives()
+    , mbVisualizeSurroundingFrame(bVisualizeSurroundingFrame)
+{
+    // no AA for TextEdit overlay
+    allowAntiAliase(false);
 
-    TextEditOverlayObject::TextEditOverlayObject(
-        const Color& rColor,
-        OutlinerView& rOutlinerView,
-        bool bVisualizeSurroundingFrame)
-    :   OverlayObject(rColor),
-        mpOverlaySelection(nullptr),
-        mrOutlinerView(rOutlinerView),
-        maLastRange(),
-        maRange(),
-        maTextPrimitives(),
-        maLastTextPrimitives(),
-        mbVisualizeSurroundingFrame(bVisualizeSurroundingFrame)
-    {
-        // no AA for TextEdit overlay
-        allowAntiAliase(false);
+    // create local OverlaySelection - this is an integral part of EditText
+    // visualization
+    const std::vector<basegfx::B2DRange> aEmptySelection{};
+    mpOverlaySelection = new sdr::overlay::OverlaySelection(sdr::overlay::OverlayType::Transparent,
+                                                            rColor, aEmptySelection, true);
+}
 
-        // create local OverlaySelection - this is an integral part of EditText
-        // visualization
-        const std::vector< basegfx::B2DRange > aEmptySelection{};
-        mpOverlaySelection = new sdr::overlay::OverlaySelection(
-            sdr::overlay::OverlayType::Transparent,
-            rColor,
-            aEmptySelection,
-            true);
+TextEditOverlayObject::~TextEditOverlayObject()
+{
+    if (getOverlaySelection())
+    {
+        delete mpOverlaySelection;
+        mpOverlaySelection = nullptr;
     }
 
-    TextEditOverlayObject::~TextEditOverlayObject()
+    if (getOverlayManager())
     {
-        if (getOverlaySelection())
-        {
-            delete mpOverlaySelection;
-            mpOverlaySelection = nullptr;
-        }
+        getOverlayManager()->remove(*this);
+    }
+}
 
-        if (getOverlayManager())
+drawinglayer::primitive2d::Primitive2DContainer
+TextEditOverlayObject::getOverlayObjectPrimitive2DSequence() const
+{
+    if (!getPrimitive2DSequence().empty())
+    {
+        if (!maRange.equal(maLastRange) || maLastTextPrimitives != maTextPrimitives)
         {
-            getOverlayManager()->remove(*this);
+            // conditions of last local decomposition have changed, delete to force new evaluation
+            const_cast<TextEditOverlayObject*>(this)->resetPrimitive2DSequence();
         }
     }
 
-    drawinglayer::primitive2d::Primitive2DContainer TextEditOverlayObject::getOverlayObjectPrimitive2DSequence() const
+    if (getPrimitive2DSequence().empty())
     {
-        if (!getPrimitive2DSequence().empty())
-        {
-            if (!maRange.equal(maLastRange) || maLastTextPrimitives != maTextPrimitives)
-            {
-                // conditions of last local decomposition have changed, delete to force new evaluation
-                const_cast<TextEditOverlayObject*>(this)->resetPrimitive2DSequence();
-            }
-        }
+        // remember new buffered values
+        const_cast<TextEditOverlayObject*>(this)->maLastRange = maRange;
+        const_cast<TextEditOverlayObject*>(this)->maLastTextPrimitives = maTextPrimitives;
+    }
 
-        if (getPrimitive2DSequence().empty())
-        {
-            // remember new buffered values
-            const_cast<TextEditOverlayObject*>(this)->maLastRange = maRange;
-            const_cast<TextEditOverlayObject*>(this)->maLastTextPrimitives = maTextPrimitives;
-        }
+    // call base implementation
+    return OverlayObject::getOverlayObjectPrimitive2DSequence();
+}
+
+void TextEditOverlayObject::checkDataChange(const basegfx::B2DRange& rMinTextEditArea)
+{
+    bool bObjectChange(false);
 
-        // call base implementation
-        return OverlayObject::getOverlayObjectPrimitive2DSequence();
+    // check current range
+    const tools::Rectangle aOutArea(mrOutlinerView.GetOutputArea());
+    basegfx::B2DRange aNewRange = vcl::unotools::b2DRectangleFromRectangle(aOutArea);
+    aNewRange.expand(rMinTextEditArea);
+
+    if (aNewRange != maRange)
+    {
+        maRange = aNewRange;
+        bObjectChange = true;
     }
 
-    void TextEditOverlayObject::checkDataChange(const basegfx::B2DRange& rMinTextEditArea)
+    // check if text primitives did change
+    SdrOutliner* pSdrOutliner = dynamic_cast<SdrOutliner*>(getOutlinerView().GetOutliner());
+
+    if (pSdrOutliner)
     {
-        bool bObjectChange(false);
+        // get TextPrimitives directly from active Outliner
+        basegfx::B2DHomMatrix aNewTransformA;
+        basegfx::B2DHomMatrix aNewTransformB;
+        basegfx::B2DRange aClipRange;
+        drawinglayer::primitive2d::Primitive2DContainer aNewTextPrimitives;
 
-        // check current range
-        const tools::Rectangle aOutArea(mrOutlinerView.GetOutputArea());
-        basegfx::B2DRange aNewRange = vcl::unotools::b2DRectangleFromRectangle(aOutArea);
-        aNewRange.expand(rMinTextEditArea);
+        // active Outliner is always in unified oriented coordinate system (currently)
+        // so just translate to TopLeft of visible Range. Keep in mind that top-left
+        // depends on vertical text and top-to-bottom text attributes
+        const tools::Rectangle aVisArea(mrOutlinerView.GetVisArea());
+        const bool bVerticalWriting(pSdrOutliner->IsVertical());
+        const bool bTopToBottom(pSdrOutliner->IsTopToBottom());
+        const double fStartInX(bVerticalWriting && bTopToBottom
+                                   ? aOutArea.Right() - aVisArea.Left()
+                                   : aOutArea.Left() - aVisArea.Left());
+        const double fStartInY(bVerticalWriting && !bTopToBottom
+                                   ? aOutArea.Bottom() - aVisArea.Top()
+                                   : aOutArea.Top() - aVisArea.Top());
 
-        if (aNewRange != maRange)
-        {
-            maRange = aNewRange;
-            bObjectChange = true;
-        }
+        aNewTransformB.translate(fStartInX, fStartInY);
 
-        // check if text primitives did change
-        SdrOutliner* pSdrOutliner = dynamic_cast<SdrOutliner*>(getOutlinerView().GetOutliner());
-
-        if (pSdrOutliner)
-        {
-            // get TextPrimitives directly from active Outliner
-            basegfx::B2DHomMatrix aNewTransformA;
-            basegfx::B2DHomMatrix aNewTransformB;
-            basegfx::B2DRange aClipRange;
-            drawinglayer::primitive2d::Primitive2DContainer aNewTextPrimitives;
-
-            // active Outliner is always in unified oriented coordinate system (currently)
-            // so just translate to TopLeft of visible Range. Keep in mind that top-left
-            // depends on vertical text and top-to-bottom text attributes
-            const tools::Rectangle aVisArea(mrOutlinerView.GetVisArea());
-            const bool bVerticalWriting(pSdrOutliner->IsVertical());
-            const bool bTopToBottom(pSdrOutliner->IsTopToBottom());
-            const double fStartInX(
-                bVerticalWriting && bTopToBottom
-                ? aOutArea.Right() - aVisArea.Left()
-                : aOutArea.Left() - aVisArea.Left());
-            const double fStartInY(
-                bVerticalWriting && !bTopToBottom
-                ? aOutArea.Bottom() - aVisArea.Top()
-                : aOutArea.Top() - aVisArea.Top());
-
-            aNewTransformB.translate(
-                fStartInX,
-                fStartInY);
-
-            // get the current TextPrimitives. This is the most expensive part
-            // of this mechanism, it *may* be possible to buffer layouted
-            // primitives per ParaPortion with/in/dependent on the EditEngine
-            // content if needed. For now, get and compare
-            SdrTextObj::impDecomposeBlockTextPrimitiveDirect(
-                aNewTextPrimitives,
-                *pSdrOutliner,
-                aNewTransformA,
-                aNewTransformB,
-                aClipRange);
-
-            if (aNewTextPrimitives != maTextPrimitives)
-            {
-                maTextPrimitives = aNewTextPrimitives;
-                bObjectChange = true;
-            }
-        }
+        // get the current TextPrimitives. This is the most expensive part
+        // of this mechanism, it *may* be possible to buffer layouted
+        // primitives per ParaPortion with/in/dependent on the EditEngine
+        // content if needed. For now, get and compare
+        SdrTextObj::impDecomposeBlockTextPrimitiveDirect(
+            aNewTextPrimitives, *pSdrOutliner, aNewTransformA, aNewTransformB, aClipRange);
 
-        if (bObjectChange)
+        if (aNewTextPrimitives != maTextPrimitives)
         {
-            // if there really *was* a change signal the OverlayManager to
-            // refresh this object's visualization
-            objectChange();
-
-            // on data change, always do a SelectionChange, too
-            // since the selection is an integral part of text visualization
-            checkSelectionChange();
+            maTextPrimitives = aNewTextPrimitives;
+            bObjectChange = true;
         }
     }
 
-    void TextEditOverlayObject::checkSelectionChange()
+    if (bObjectChange)
     {
-        if (getOverlaySelection() && getOverlayManager())
-        {
-            std::vector<tools::Rectangle> aLogicRects;
-            std::vector<basegfx::B2DRange> aLogicRanges;
-            const Size aLogicPixel(getOverlayManager()->getOutputDevice().PixelToLogic(Size(1, 1)));
+        // if there really *was* a change signal the OverlayManager to
+        // refresh this object's visualization
+        objectChange();
 
-            // get logic selection
-            getOutlinerView().GetSelectionRectangles(aLogicRects);
+        // on data change, always do a SelectionChange, too
+        // since the selection is an integral part of text visualization
+        checkSelectionChange();
+    }
+}
 
-            aLogicRanges.reserve(aLogicRects.size());
-            for (const auto& aRect : aLogicRects)
-            {
-                // convert from logic Rectangles to logic Ranges, do not forget to add
-                // one Unit (in this case logical units for one pixel, pre-calculated)
-                aLogicRanges.emplace_back(
-                        aRect.Left() - aLogicPixel.Width(), aRect.Top() - aLogicPixel.Height(),
-                        aRect.Right() + aLogicPixel.Width(), aRect.Bottom() + aLogicPixel.Height());
-            }
+void TextEditOverlayObject::checkSelectionChange()
+{
+    if (getOverlaySelection() && getOverlayManager())
+    {
+        std::vector<tools::Rectangle> aLogicRects;
+        std::vector<basegfx::B2DRange> aLogicRanges;
+        const Size aLogicPixel(getOverlayManager()->getOutputDevice().PixelToLogic(Size(1, 1)));
+
+        // get logic selection
+        getOutlinerView().GetSelectionRectangles(aLogicRects);
 
-            mpOverlaySelection->setRanges(aLogicRanges);
+        aLogicRanges.reserve(aLogicRects.size());
+        for (const auto& aRect : aLogicRects)
+        {
+            // convert from logic Rectangles to logic Ranges, do not forget to add
+            // one Unit (in this case logical units for one pixel, pre-calculated)
+            aLogicRanges.emplace_back(
+                aRect.Left() - aLogicPixel.Width(), aRect.Top() - aLogicPixel.Height(),
+                aRect.Right() + aLogicPixel.Width(), aRect.Bottom() + aLogicPixel.Height());
         }
+
+        mpOverlaySelection->setRanges(aLogicRanges);
     }
+}
 } // end of anonymous namespace
 
 // TextEdit
@@ -632,11 +635,13 @@ void SdrObjEditView::EditViewInvalidate(const tools::Rectangle&) const
     if (IsTextEdit())
     {
         // MinTextRange may have changed. Forward it, too
-        const basegfx::B2DRange aMinTextRange = vcl::unotools::b2DRectangleFromRectangle(aMinTextEditArea);
+        const basegfx::B2DRange aMinTextRange
+            = vcl::unotools::b2DRectangleFromRectangle(aMinTextEditArea);
 
         for (sal_uInt32 a(0); a < maTEOverlayGroup.count(); a++)
         {
-            TextEditOverlayObject* pCandidate = dynamic_cast< TextEditOverlayObject* >(&maTEOverlayGroup.getOverlayObject(a));
+            TextEditOverlayObject* pCandidate
+                = dynamic_cast<TextEditOverlayObject*>(&maTEOverlayGroup.getOverlayObject(a));
 
             if (pCandidate)
             {
@@ -655,7 +660,8 @@ void SdrObjEditView::EditViewSelectionChange() const
     {
         for (sal_uInt32 a(0); a < maTEOverlayGroup.count(); a++)
         {
-            TextEditOverlayObject* pCandidate = dynamic_cast< TextEditOverlayObject* >(&maTEOverlayGroup.getOverlayObject(a));
+            TextEditOverlayObject* pCandidate
+                = dynamic_cast<TextEditOverlayObject*>(&maTEOverlayGroup.getOverlayObject(a));
 
             if (pCandidate)
             {
@@ -665,10 +671,7 @@ void SdrObjEditView::EditViewSelectionChange() const
     }
 }
 
-OutputDevice& SdrObjEditView::EditViewOutputDevice() const
-{
-    return *pTextEditWin;
-}
+OutputDevice& SdrObjEditView::EditViewOutputDevice() const { return *pTextEditWin; }
 
 void SdrObjEditView::TextEditDrawing(SdrPaintWindow& rPaintWindow) const
 {
@@ -703,10 +706,14 @@ void SdrObjEditView::TextEditDrawing(SdrPaintWindow& rPaintWindow) const
                         // context and is aware of the underlying vcl::Window,
                         // compare against that; that's how double-buffering can
                         // still find the matching OutlinerView.
-                        OutputDevice* pOutputDevice = rPaintWindow.GetWindow() ? rPaintWindow.GetWindow() : &rPaintWindow.GetOutputDevice();
-                        if (pOLV->GetWindow() == pOutputDevice || comphelper::LibreOfficeKit::isActive())
+                        OutputDevice* pOutputDevice = rPaintWindow.GetWindow()
+                                                          ? rPaintWindow.GetWindow()
+                                                          : &rPaintWindow.GetOutputDevice();
+                        if (pOLV->GetWindow() == pOutputDevice
+                            || comphelper::LibreOfficeKit::isActive())
                         {
-                            ImpPaintOutlinerView(*pOLV, aCheckRect, rPaintWindow.GetTargetOutputDevice());
+                            ImpPaintOutlinerView(*pOLV, aCheckRect,
+                                                 rPaintWindow.GetTargetOutputDevice());
                             return;
                         }
                     }
@@ -716,7 +723,8 @@ void SdrObjEditView::TextEditDrawing(SdrPaintWindow& rPaintWindow) const
     }
 }
 
-void SdrObjEditView::ImpPaintOutlinerView(OutlinerView& rOutlView, const tools::Rectangle& rRect, OutputDevice& rTargetDevice) const
+void SdrObjEditView::ImpPaintOutlinerView(OutlinerView& rOutlView, const tools::Rectangle& rRect,
+                                          OutputDevice& rTargetDevice) const
 {
     const SdrTextObj* pText = GetTextEditObject();
     bool bTextFrame(pText && pText->IsTextFrame());
@@ -737,18 +745,18 @@ void SdrObjEditView::ImpPaintOutlinerView(OutlinerView& rOutlView, const tools::
     rOutlView.GetOutliner()->SetUpdateMode(true); // Bugfix #22596#
     rOutlView.Paint(aBlankRect, &rTargetDevice);
 
-    if(!bModified)
+    if (!bModified)
     {
         pTextEditOutliner->ClearModifyFlag();
     }
 
-    if(bTextFrame && !bFitToSize)
+    if (bTextFrame && !bFitToSize)
     {
         // completely reworked to use primitives; this ensures same look and functionality
         const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
-        std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> xProcessor(drawinglayer::processor2d::createProcessor2DFromOutputDevice(
-            rTargetDevice,
-            aViewInformation2D));
+        std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> xProcessor(
+            drawinglayer::processor2d::createProcessor2DFromOutputDevice(rTargetDevice,
+                                                                         aViewInformation2D));
 
         if (xProcessor)
         {
@@ -756,17 +764,16 @@ void SdrObjEditView::ImpPaintOutlinerView(OutlinerView& rOutlView, const tools::
             const basegfx::B2DRange aRange = vcl::unotools::b2DRectangleFromRectangle(aPixRect);
             const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
             const Color aHilightColor(aSvtOptionsDrawinglayer.getHilightColor());
-            const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01);
+            const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent()
+                                       * 0.01);
             const sal_uInt16 nPixSiz(rOutlView.GetInvalidateMore() - 1);
             const drawinglayer::primitive2d::Primitive2DReference xReference(
                 new drawinglayer::primitive2d::OverlayRectanglePrimitive(
-                    aRange,
-                    aHilightColor.getBColor(),
-                    fTransparence,
+                    aRange, aHilightColor.getBColor(), fTransparence,
                     std::max(6, nPixSiz - 2), // grow
                     0.0, // shrink
                     0.0));
-            const drawinglayer::primitive2d::Primitive2DContainer aSequence { xReference };
+            const drawinglayer::primitive2d::Primitive2DContainer aSequence{ xReference };
 
             rTargetDevice.EnableMapMode(false);
             xProcessor->process(aSequence);
@@ -777,27 +784,27 @@ void SdrObjEditView::ImpPaintOutlinerView(OutlinerView& rOutlView, const tools::
     rOutlView.ShowCursor(/*bGotoCursor=*/true, /*bActivate=*/true);
 }
 
-void SdrObjEditView::ImpInvalidateOutlinerView(OutlinerView const & rOutlView) const
+void SdrObjEditView::ImpInvalidateOutlinerView(OutlinerView const& rOutlView) const
 {
     vcl::Window* pWin = rOutlView.GetWindow();
 
-    if(pWin)
+    if (pWin)
     {
         const SdrTextObj* pText = GetTextEditObject();
         bool bTextFrame(pText && pText->IsTextFrame());
         bool bFitToSize(pText && pText->IsFitToSize());
 
-        if(bTextFrame && !bFitToSize)
+        if (bTextFrame && !bFitToSize)
         {
             tools::Rectangle aBlankRect(rOutlView.GetOutputArea());
             aBlankRect.Union(aMinTextEditArea);
             tools::Rectangle aPixRect(pWin->LogicToPixel(aBlankRect));
             sal_uInt16 nPixSiz(rOutlView.GetInvalidateMore() - 1);
 
-            aPixRect.AdjustLeft( -1 );
-            aPixRect.AdjustTop( -1 );
-            aPixRect.AdjustRight( 1 );
-            aPixRect.AdjustBottom( 1 );
+            aPixRect.AdjustLeft(-1);
+            aPixRect.AdjustTop(-1);
+            aPixRect.AdjustRight(1);
+            aPixRect.AdjustBottom(1);
 
             {
                 // limit xPixRect because of driver problems when pixel coordinates are too far out
@@ -806,17 +813,21 @@ void SdrObjEditView::ImpInvalidateOutlinerView(OutlinerView const & rOutlView) c
                 long nMaxX(aMaxXY.Width() + a);
                 long nMaxY(aMaxXY.Height() + a);
 
-                if (aPixRect.Left  ()<-a) aPixRect.SetLeft(-a );
-                if (aPixRect.Top   ()<-a) aPixRect.SetTop(-a );
-                if (aPixRect.Right ()>nMaxX) aPixRect.SetRight(nMaxX );
-                if (aPixRect.Bottom()>nMaxY) aPixRect.SetBottom(nMaxY );
+                if (aPixRect.Left() < -a)
+                    aPixRect.SetLeft(-a);
+                if (aPixRect.Top() < -a)
+                    aPixRect.SetTop(-a);
+                if (aPixRect.Right() > nMaxX)
+                    aPixRect.SetRight(nMaxX);
+                if (aPixRect.Bottom() > nMaxY)
+                    aPixRect.SetBottom(nMaxY);
             }
 
             tools::Rectangle aOuterPix(aPixRect);
-            aOuterPix.AdjustLeft( -nPixSiz );
-            aOuterPix.AdjustTop( -nPixSiz );
-            aOuterPix.AdjustRight(nPixSiz );
-            aOuterPix.AdjustBottom(nPixSiz );
+            aOuterPix.AdjustLeft(-nPixSiz);
+            aOuterPix.AdjustTop(-nPixSiz);
+            aOuterPix.AdjustRight(nPixSiz);
+            aOuterPix.AdjustBottom(nPixSiz);
 
             bool bMapModeEnabled(pWin->IsMapModeEnabled());
             pWin->EnableMapMode(false);
@@ -826,15 +837,16 @@ void SdrObjEditView::ImpInvalidateOutlinerView(OutlinerView const & rOutlView) c
     }
 }
 
-OutlinerView* SdrObjEditView::ImpMakeOutlinerView(vcl::Window* pWin, OutlinerView* pGivenView, SfxViewShell* pViewShell) const
+OutlinerView* SdrObjEditView::ImpMakeOutlinerView(vcl::Window* pWin, OutlinerView* pGivenView,
+                                                  SfxViewShell* pViewShell) const
 {
     // background
     Color aBackground(GetTextEditBackgroundColor(*this));
     SdrTextObj* pText = mxTextEditObj.get();
-    bool bTextFrame=pText!=nullptr && pText->IsTextFrame();
-    bool bContourFrame=pText!=nullptr && pText->IsContourTextFrame();
+    bool bTextFrame = pText != nullptr && pText->IsTextFrame();
+    bool bContourFrame = pText != nullptr && pText->IsContourTextFrame();
     // create OutlinerView
-    OutlinerView* pOutlView=pGivenView;
+    OutlinerView* pOutlView = pGivenView;
     pTextEditOutliner->SetUpdateMode(false);
 
     if (pOutlView == nullptr)
@@ -847,17 +859,19 @@ OutlinerView* SdrObjEditView::ImpMakeOutlinerView(vcl::Window* pWin, OutlinerVie
     }
 
     // disallow scrolling
-    EVControlBits nStat=pOutlView->GetControlWord();
-    nStat&=~EVControlBits::AUTOSCROLL;
+    EVControlBits nStat = pOutlView->GetControlWord();
+    nStat &= ~EVControlBits::AUTOSCROLL;
     // AutoViewSize only if not ContourFrame.
-    if (!bContourFrame) nStat|=EVControlBits::AUTOSIZE;
-    if (bTextFrame) {
-        sal_uInt16 nPixSiz=maHdlList.GetHdlSize()*2+1;
-        nStat|=EVControlBits::INVONEMORE;
+    if (!bContourFrame)
+        nStat |= EVControlBits::AUTOSIZE;
+    if (bTextFrame)
+    {
+        sal_uInt16 nPixSiz = maHdlList.GetHdlSize() * 2 + 1;
+        nStat |= EVControlBits::INVONEMORE;
         pOutlView->SetInvalidateMore(nPixSiz);
     }
     pOutlView->SetControlWord(nStat);
-    pOutlView->SetBackgroundColor( aBackground );
+    pOutlView->SetBackgroundColor(aBackground);
 
     // In case we're in the process of constructing a new view shell,
     // SfxViewShell::Current() may still point to the old one. So if possible,
@@ -866,10 +880,11 @@ OutlinerView* SdrObjEditView::ImpMakeOutlinerView(vcl::Window* pWin, OutlinerVie
     SfxViewShell* pSfxViewShell = pViewShell ? pViewShell : GetSfxViewShell();
     pOutlView->RegisterViewShell(pSfxViewShell ? pSfxViewShell : SfxViewShell::Current());
 
-    if (pText!=nullptr)
+    if (pText != nullptr)
     {
         pOutlView->SetAnchorMode(pText->GetOutlinerViewAnchorMode());
-        pTextEditOutliner->SetFixedCellHeight(pText->GetMergedItem(SDRATTR_TEXT_USEFIXEDCELLHEIGHT).GetValue());
+        pTextEditOutliner->SetFixedCellHeight(
+            pText->GetMergedItem(SDRATTR_TEXT_USEFIXEDCELLHEIGHT).GetValue());
     }
     // do update before setting output area so that aTextEditArea can be recalculated
     pTextEditOutliner->SetUpdateMode(true);
@@ -878,34 +893,36 @@ OutlinerView* SdrObjEditView::ImpMakeOutlinerView(vcl::Window* pWin, OutlinerVie
     return pOutlView;
 }
 
-IMPL_LINK(SdrObjEditView,ImpOutlinerStatusEventHdl, EditStatus&, rEditStat, void)
+IMPL_LINK(SdrObjEditView, ImpOutlinerStatusEventHdl, EditStatus&, rEditStat, void)
 {
-    if(pTextEditOutliner )
+    if (pTextEditOutliner)
     {
         SdrTextObj* pTextObj = mxTextEditObj.get();
-        if( pTextObj )
+        if (pTextObj)
         {
-            pTextObj->onEditOutlinerStatusEvent( &rEditStat );
+            pTextObj->onEditOutlinerStatusEvent(&rEditStat);
         }
     }
 }
 
 void SdrObjEditView::ImpChainingEventHdl()
 {
-    if(pTextEditOutliner )
+    if (pTextEditOutliner)
     {
         SdrTextObj* pTextObj = mxTextEditObj.get();
         OutlinerView* pOLV = GetTextEditOutlinerView();
-        if( pTextObj && pOLV)
+        if (pTextObj && pOLV)
         {
-            TextChain *pTextChain = pTextObj->GetTextChain();
+            TextChain* pTextChain = pTextObj->GetTextChain();
 
-             // XXX: IsChainable and GetNilChainingEvent are a bit mixed up atm
-            if (!pTextObj->IsChainable()) {
+            // XXX: IsChainable and GetNilChainingEvent are a bit mixed up atm
+            if (!pTextObj->IsChainable())
+            {
                 return;
             }
             // This is true during an underflow-caused overflow (with pEdtOutl->SetText())
-            if (pTextChain->GetNilChainingEvent(pTextObj)) {
+            if (pTextChain->GetNilChainingEvent(pTextObj))
+            {
                 return;
             }
 
@@ -922,8 +939,11 @@ void SdrObjEditView::ImpChainingEventHdl()
             const bool bUndoEnabled = GetModel() && IsUndoEnabled();
             std::unique_ptr<SdrUndoObjSetText> pTxtUndo;
             if (bUndoEnabled)
-                pTxtUndo.reset(dynamic_cast< SdrUndoObjSetText* >
-                                ( GetModel()->GetSdrUndoFactory().CreateUndoObjectSetText(*pTextObj, nText ).release() ));
+                pTxtUndo.reset(
+                    dynamic_cast<SdrUndoObjSetText*>(GetModel()
+                                                         ->GetSdrUndoFactory()
+                                                         .CreateUndoObjectSetText(*pTextObj, nText)
+                                                         .release()));
 
             // trigger actual chaining
             pTextObj->onChainingEvent();
@@ -945,15 +965,16 @@ void SdrObjEditView::ImpChainingEventHdl()
 
             // NOTE: Must be called. Don't let the function return if you set it to true and not reset it
             pTextChain->SetNilChainingEvent(pTextObj, false);
-        } else {
+        }
+        else
+        {
             // XXX
             SAL_INFO("svx.chaining", "[OnChaining] No Edit Outliner View");
         }
     }
-
 }
 
-IMPL_LINK_NOARG(SdrObjEditView,ImpAfterCutOrPasteChainingEventHdl, LinkParamNone*, void)
+IMPL_LINK_NOARG(SdrObjEditView, ImpAfterCutOrPasteChainingEventHdl, LinkParamNone*, void)
 {
     SdrTextObj* pTextObj = GetTextEditObject();
     if (!pTextObj)
@@ -963,7 +984,7 @@ IMPL_LINK_NOARG(SdrObjEditView,ImpAfterCutOrPasteChainingEventHdl, LinkParamNone
     ImpMoveCursorAfterChainingEvent(&aCursorManager);
 }
 
-void SdrObjEditView::ImpMoveCursorAfterChainingEvent(TextChainCursorManager *pCursorManager)
+void SdrObjEditView::ImpMoveCursorAfterChainingEvent(TextChainCursorManager* pCursorManager)
 {
     if (!mxTextEditObj.is() || !pCursorManager)
         return;
@@ -974,172 +995,175 @@ void SdrObjEditView::ImpMoveCursorAfterChainingEvent(TextChainCursorManager *pCu
     if (!pTextObj || !pTextObj->IsChainable())
         return;
 
-    TextChain *pTextChain = pTextObj->GetTextChain();
+    TextChain* pTextChain = pTextObj->GetTextChain();
     ESelection aNewSel = pTextChain->GetPostChainingSel(pTextObj);
 
-    pCursorManager->HandleCursorEventAfterChaining(
-        pTextChain->GetCursorEvent(pTextObj),
-        aNewSel);
+    pCursorManager->HandleCursorEventAfterChaining(pTextChain->GetCursorEvent(pTextObj), aNewSel);
 
     // Reset event
     pTextChain->SetCursorEvent(pTextObj, CursorChainingEvent::NULL_EVENT);
 }
 
-
-IMPL_LINK(SdrObjEditView,ImpOutlinerCalcFieldValueHdl,EditFieldInfo*,pFI,void)
+IMPL_LINK(SdrObjEditView, ImpOutlinerCalcFieldValueHdl, EditFieldInfo*, pFI, void)
 {
-    bool bOk=false;
-    OUString& rStr=pFI->GetRepresentation();
+    bool bOk = false;
+    OUString& rStr = pFI->GetRepresentation();
     rStr.clear();
     SdrTextObj* pTextObj = mxTextEditObj.get();
-    if (pTextObj!=nullptr) {
+    if (pTextObj != nullptr)
+    {
         boost::optional<Color> pTxtCol;
         boost::optional<Color> pFldCol;
-        bOk=pTextObj->CalcFieldValue(pFI->GetField(),pFI->GetPara(),pFI->GetPos(),true,pTxtCol,pFldCol,rStr);
-        if (bOk) {
-            if (pTxtCol) {
+        bOk = pTextObj->CalcFieldValue(pFI->GetField(), pFI->GetPara(), pFI->GetPos(), true,
+                                       pTxtCol, pFldCol, rStr);
+        if (bOk)
+        {
+            if (pTxtCol)
+            {
                 pFI->SetTextColor(*pTxtCol);
             }
-            if (pFldCol) {
+            if (pFldCol)
+            {
                 pFI->SetFieldColor(*pFldCol);
-            } else {
+            }
+            else
+            {
                 pFI->SetFieldColor(COL_LIGHTGRAY); // TODO: remove this later on (357)
             }
         }
     }
-    Outliner& rDrawOutl=mpModel->GetDrawOutliner(pTextObj);
-    Link<EditFieldInfo*,void> aDrawOutlLink=rDrawOutl.GetCalcFieldValueHdl();
-    if (!bOk && aDrawOutlLink.IsSet()) {
+    Outliner& rDrawOutl = mpModel->GetDrawOutliner(pTextObj);
+    Link<EditFieldInfo*, void> aDrawOutlLink = rDrawOutl.GetCalcFieldValueHdl();
+    if (!bOk && aDrawOutlLink.IsSet())
+    {
         aDrawOutlLink.Call(pFI);
         bOk = !rStr.isEmpty();
     }
-    if (!bOk) {
+    if (!bOk)
+    {
         aOldCalcFieldValueLink.Call(pFI);
     }
 }
 
-IMPL_LINK_NOARG(SdrObjEditView, EndTextEditHdl, SdrUndoManager*, void)
-{
-    SdrEndTextEdit();
-}
+IMPL_LINK_NOARG(SdrObjEditView, EndTextEditHdl, SdrUndoManager*, void) { SdrEndTextEdit(); }
 
 SdrUndoManager* SdrObjEditView::getSdrUndoManagerForEnhancedTextEdit() const
 {
     // default returns registered UndoManager
-    return GetModel() ? dynamic_cast< SdrUndoManager* >(GetModel()->GetSdrUndoManager()) : nullptr;
+    return GetModel() ? dynamic_cast<SdrUndoManager*>(GetModel()->GetSdrUndoManager()) : nullptr;
 }
 
-bool SdrObjEditView::SdrBeginTextEdit(
-    SdrObject* pObj_, SdrPageView* pPV, vcl::Window* pWin,
-    bool bIsNewObj, SdrOutliner* pGivenOutliner,
-    OutlinerView* pGivenOutlinerView,
-    bool bDontDeleteOutliner, bool bOnlyOneView,
-    bool bGrabFocus)
+bool SdrObjEditView::SdrBeginTextEdit(SdrObject* pObj_, SdrPageView* pPV, vcl::Window* pWin,
+                                      bool bIsNewObj, SdrOutliner* pGivenOutliner,
+                                      OutlinerView* pGivenOutlinerView, bool bDontDeleteOutliner,
+                                      bool bOnlyOneView, bool bGrabFocus)
 {
     assert(!IsTextEdit());
     // FIXME this encourages all sorts of bad habits and should be removed
     SdrEndTextEdit();
 
-    SdrTextObj* pObj = dynamic_cast< SdrTextObj* >( pObj_ );
-    if( !pObj )
+    SdrTextObj* pObj = dynamic_cast<SdrTextObj*>(pObj_);
+    if (!pObj)
         return false; // currently only possible with text objects
 
-    if(bGrabFocus && pWin)
+    if (bGrabFocus && pWin)
     {
         // attention, this call may cause an EndTextEdit() call to this view
         pWin->GrabFocus(); // to force the cursor into the edit view
     }
 
-    bTextEditDontDelete=bDontDeleteOutliner && pGivenOutliner!=nullptr;
-    bTextEditOnlyOneView=bOnlyOneView;
-    bTextEditNewObj=bIsNewObj;
+    bTextEditDontDelete = bDontDeleteOutliner && pGivenOutliner != nullptr;
+    bTextEditOnlyOneView = bOnlyOneView;
+    bTextEditNewObj = bIsNewObj;
     const sal_uInt32 nWinCount(PaintWindowCount());
     sal_uInt32 i;
     bool bBrk(false);
 
-    if(!pWin)
+    if (!pWin)
     {
-        for(i = 0; i < nWinCount && !pWin; i++)
+        for (i = 0; i < nWinCount && !pWin; i++)
         {
             SdrPaintWindow* pPaintWindow = GetPaintWindow(i);
 
-            if(OUTDEV_WINDOW == pPaintWindow->GetOutputDevice().GetOutDevType())
+            if (OUTDEV_WINDOW == pPaintWindow->GetOutputDevice().GetOutDevType())
             {
                 pWin = static_cast<vcl::Window*>(&pPaintWindow->GetOutputDevice());
             }
         }
 
         // break, when no window exists
-        if(!pWin)
+        if (!pWin)
         {
             bBrk = true;
         }
     }
 
-    if(!bBrk && !pPV)
+    if (!bBrk && !pPV)
     {
         pPV = GetSdrPageView();
 
         // break, when no PageView for the object exists
-        if(!pPV)
+        if (!pPV)
         {
             bBrk = true;
         }
     }
 
     // no TextEdit on objects in locked Layer
-    if(pPV && pPV->GetLockedLayers().IsSet(pObj->GetLayer()))
+    if (pPV && pPV->GetLockedLayers().IsSet(pObj->GetLayer()))
     {
         bBrk = true;
     }
 
-    if(pTextEditOutliner)
+    if (pTextEditOutliner)
     {
         OSL_FAIL("SdrObjEditView::SdrBeginTextEdit(): Old Outliner still exists.");
         pTextEditOutliner.reset();
     }
 
-    if(!bBrk)
+    if (!bBrk)
     {
-        pTextEditWin=pWin;
-        pTextEditPV=pPV;
-        mxTextEditObj.reset( pObj );
+        pTextEditWin = pWin;
+        pTextEditPV = pPV;
+        mxTextEditObj.reset(pObj);
         if (pGivenOutliner)
         {
             pTextEditOutliner.reset(pGivenOutliner);
             pGivenOutliner = nullptr; // so we don't delete it on the error path
         }
         else
-            pTextEditOutliner = SdrMakeOutliner( OutlinerMode::TextObject, mxTextEditObj->getSdrModelFromSdrObject() );
+            pTextEditOutliner = SdrMakeOutliner(OutlinerMode::TextObject,
+                                                mxTextEditObj->getSdrModelFromSdrObject());
 
         {
             SvtAccessibilityOptions aOptions;
-            pTextEditOutliner->ForceAutoColor( aOptions.GetIsAutomaticFontColor() );
+            pTextEditOutliner->ForceAutoColor(aOptions.GetIsAutomaticFontColor());
         }
 
-        aOldCalcFieldValueLink=pTextEditOutliner->GetCalcFieldValueHdl();
+        aOldCalcFieldValueLink = pTextEditOutliner->GetCalcFieldValueHdl();
         // FieldHdl has to be set by SdrBeginTextEdit, because this call an UpdateFields
-        pTextEditOutliner->SetCalcFieldValueHdl(LINK(this,SdrObjEditView,ImpOutlinerCalcFieldValueHdl));
-        pTextEditOutliner->SetBeginPasteOrDropHdl(LINK(this,SdrObjEditView,BeginPasteOrDropHdl));
-        pTextEditOutliner->SetEndPasteOrDropHdl(LINK(this,SdrObjEditView,EndPasteOrDropHdl));
+        pTextEditOutliner->SetCalcFieldValueHdl(
+            LINK(this, SdrObjEditView, ImpOutlinerCalcFieldValueHdl));
+        pTextEditOutliner->SetBeginPasteOrDropHdl(LINK(this, SdrObjEditView, BeginPasteOrDropHdl));
+        pTextEditOutliner->SetEndPasteOrDropHdl(LINK(this, SdrObjEditView, EndPasteOrDropHdl));
 
         // It is just necessary to make the visualized page known. Set it.
         pTextEditOutliner->setVisualizedPage(pPV->GetPage());
 
-        pTextEditOutliner->SetTextObjNoInit( mxTextEditObj.get() );
+        pTextEditOutliner->SetTextObjNoInit(mxTextEditObj.get());
 
-        if(mxTextEditObj->BegTextEdit(*pTextEditOutliner))
+        if (mxTextEditObj->BegTextEdit(*pTextEditOutliner))
         {
             SdrTextObj* pTextObj = mxTextEditObj.get();
-            DBG_ASSERT( pTextObj, "svx::SdrObjEditView::BegTextEdit(), no text object?" );
-            if( !pTextObj )
+            DBG_ASSERT(pTextObj, "svx::SdrObjEditView::BegTextEdit(), no text object?");
+            if (!pTextObj)
                 return false;
 
             // switch off any running TextAnimations
             pTextObj->SetTextAnimationAllowed(false);
 
             // remember old cursor
-            if (pTextEditOutliner->GetViewCount()!=0)
+            if (pTextEditOutliner->GetViewCount() != 0)
             {
                 pTextEditOutliner->RemoveView(static_cast<size_t>(0));
             }
@@ -1147,14 +1171,14 @@ bool SdrObjEditView::SdrBeginTextEdit(
             // Determine EditArea via TakeTextEditArea.
             // TODO: This could theoretically be left out, because TakeTextRect() calculates the aTextEditArea,
             // but aMinTextEditArea has to happen, too (therefore leaving this in right now)
-            pTextObj->TakeTextEditArea(nullptr,nullptr,&aTextEditArea,&aMinTextEditArea);
+            pTextObj->TakeTextEditArea(nullptr, nullptr, &aTextEditArea, &aMinTextEditArea);
 
             tools::Rectangle aTextRect;
             tools::Rectangle aAnchorRect;
             pTextObj->TakeTextRect(*pTextEditOutliner, aTextRect, true,
-                &aAnchorRect /* Give true here, not false */);
+                                   &aAnchorRect /* Give true here, not false */);
 
-            if ( !pTextObj->IsContourTextFrame() )
+            if (!pTextObj->IsContourTextFrame())
             {
                 // FitToSize not together with ContourFrame, for now
                 if (pTextObj->IsFitToSize())
@@ -1165,20 +1189,19 @@ bool SdrObjEditView::SdrBeginTextEdit(
 
             // add possible GridOffset to up-to-now view-independent EditAreas
             basegfx::B2DVector aGridOffset(0.0, 0.0);
-            if(getPossibleGridOffsetForSdrObject(aGridOffset, pTextObj, pPV))
+            if (getPossibleGridOffsetForSdrObject(aGridOffset, pTextObj, pPV))
             {
-                const Point aOffset(
-                    basegfx::fround(aGridOffset.getX()),
-                    basegfx::fround(aGridOffset.getY()));
+                const Point aOffset(basegfx::fround(aGridOffset.getX()),
+                                    basegfx::fround(aGridOffset.getY()));
 
                 aTextEditArea += aOffset;
                 aMinTextEditArea += aOffset;
             }
 
             Point aPvOfs(pTextObj->GetTextEditOffset());
-            aTextEditArea.Move(aPvOfs.X(),aPvOfs.Y());
-            aMinTextEditArea.Move(aPvOfs.X(),aPvOfs.Y());
-            pTextEditCursorBuffer=pWin->GetCursor();
+            aTextEditArea.Move(aPvOfs.X(), aPvOfs.Y());
+            aMinTextEditArea.Move(aPvOfs.X(), aPvOfs.Y());
+            pTextEditCursorBuffer = pWin->GetCursor();
 
             maHdlList.SetMoveOutside(true);
 
@@ -1186,7 +1209,7 @@ bool SdrObjEditView::SdrBeginTextEdit(
             // to call AdjustMarkHdl() always.
             AdjustMarkHdl();
 
-            pTextEditOutlinerView=ImpMakeOutlinerView(pWin,pGivenOutlinerView);
+            pTextEditOutlinerView = ImpMakeOutlinerView(pWin, pGivenOutlinerView);
 
             if (!comphelper::LibreOfficeKit::isActive() && pTextEditOutlinerView)
             {
@@ -1198,7 +1221,8 @@ bool SdrObjEditView::SdrBeginTextEdit(
                 const Color aHilightColor(aSvtOptionsDrawinglayer.getHilightColor());
                 const SdrTextObj* pText = GetTextEditObject();
                 const bool bTextFrame(pText && pText->IsTextFrame());
-                const bool bFitToSize(pTextEditOutliner->GetControlWord() & EEControlBits::STRETCHING);
+                const bool bFitToSize(pTextEditOutliner->GetControlWord()
+                                      & EEControlBits::STRETCHING);
                 const bool bVisualizeSurroundingFrame(bTextFrame && !bFitToSize);
                 SdrPageView* pPageView = GetSdrPageView();
 
@@ -1210,16 +1234,17 @@ bool SdrObjEditView::SdrBeginTextEdit(
 
                         if (rPageWindow.GetPaintWindow().OutputToWindow())
                         {
-                            const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
+                            const rtl::Reference<sdr::overlay::OverlayManager>& xManager
+                                = rPageWindow.GetOverlayManager();
                             if (xManager.is())
                             {
-                                std::unique_ptr<TextEditOverlayObject> pNewTextEditOverlayObject(new TextEditOverlayObject(
-                                    aHilightColor,
-                                    *pTextEditOutlinerView,
-                                    bVisualizeSurroundingFrame));
+                                std::unique_ptr<TextEditOverlayObject> pNewTextEditOverlayObject(
+                                    new TextEditOverlayObject(aHilightColor, *pTextEditOutlinerView,
+                                                              bVisualizeSurroundingFrame));
 
                                 xManager->add(*pNewTextEditOverlayObject);
-                                xManager->add(const_cast<sdr::overlay::OverlaySelection&>(*pNewTextEditOverlayObject->getOverlaySelection()));
+                                xManager->add(const_cast<sdr::overlay::OverlaySelection&>(
+                                    *pNewTextEditOverlayObject->getOverlaySelection()));
 
                                 maTEOverlayGroup.append(std::move(pNewTextEditOverlayObject));
                             }
@@ -1229,30 +1254,31 @@ bool SdrObjEditView::SdrBeginTextEdit(
             }
 
             // check if this view is already inserted
-            sal_uIntPtr i2,nCount = pTextEditOutliner->GetViewCount();
-            for( i2 = 0; i2 < nCount; i2++ )
+            sal_uIntPtr i2, nCount = pTextEditOutliner->GetViewCount();
+            for (i2 = 0; i2 < nCount; i2++)
             {
-                if( pTextEditOutliner->GetView(i2) == pTextEditOutlinerView )
+                if (pTextEditOutliner->GetView(i2) == pTextEditOutlinerView)
                     break;
             }
 
-            if( i2 == nCount )
-                pTextEditOutliner->InsertView(pTextEditOutlinerView,0);
+            if (i2 == nCount)
+                pTextEditOutliner->InsertView(pTextEditOutlinerView, 0);
 
             maHdlList.SetMoveOutside(false);
             maHdlList.SetMoveOutside(true);
 
             // register all windows as OutlinerViews with the Outliner
-            if(!bOnlyOneView)
+            if (!bOnlyOneView)
             {
-                for(i = 0; i < nWinCount; i++)
+                for (i = 0; i < nWinCount; i++)
                 {
                     SdrPaintWindow* pPaintWindow = GetPaintWindow(i);
                     OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
 
-                    if(&rOutDev != pWin && OUTDEV_WINDOW == rOutDev.GetOutDevType())
+                    if (&rOutDev != pWin && OUTDEV_WINDOW == rOutDev.GetOutDevType())
                     {
-                        OutlinerView* pOutlView = ImpMakeOutlinerView(static_cast<vcl::Window*>(&rOutDev), nullptr);
+                        OutlinerView* pOutlView
+                            = ImpMakeOutlinerView(static_cast<vcl::Window*>(&rOutDev), nullptr);
                         pTextEditOutliner->InsertView(pOutlView, static_cast<sal_uInt16>(i));
                     }
                 }
@@ -1268,14 +1294,16 @@ bool SdrObjEditView::SdrBeginTextEdit(
                         if (pView == this)
                             continue;
 
-                        for(sal_uInt32 nViewPaintWindow = 0; nViewPaintWindow < pView->PaintWindowCount(); ++nViewPaintWindow)
+                        for (sal_uInt32 nViewPaintWindow = 0;
+                             nViewPaintWindow < pView->PaintWindowCount(); ++nViewPaintWindow)
                         {
                             SdrPaintWindow* pPaintWindow = pView->GetPaintWindow(nViewPaintWindow);
                             OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
 
-                            if(&rOutDev != pWin && OUTDEV_WINDOW == rOutDev.GetOutDevType())
+                            if (&rOutDev != pWin && OUTDEV_WINDOW == rOutDev.GetOutDevType())
                             {
-                                OutlinerView* pOutlView = ImpMakeOutlinerView(static_cast<vcl::Window*>(&rOutDev), nullptr);
+                                OutlinerView* pOutlView = ImpMakeOutlinerView(
+                                    static_cast<vcl::Window*>(&rOutDev), nullptr);
                                 pOutlView->HideCursor();
                                 static_cast<vcl::Window*>(&rOutDev)->SetCursor(nullptr);
                                 pTextEditOutliner->InsertView(pOutlView);
@@ -1286,13 +1314,17 @@ bool SdrObjEditView::SdrBeginTextEdit(
             }
 
             pTextEditOutlinerView->ShowCursor();
-            pTextEditOutliner->SetStatusEventHdl(LINK(this,SdrObjEditView,ImpOutlinerStatusEventHdl));
-            if (pTextObj->IsChainable()) {
-                pTextEditOutlinerView->SetEndCutPasteLinkHdl(LINK(this,SdrObjEditView,ImpAfterCutOrPasteChainingEventHdl) );
+            pTextEditOutliner->SetStatusEventHdl(
+                LINK(this, SdrObjEditView, ImpOutlinerStatusEventHdl));
+            if (pTextObj->IsChainable())
+            {
+                pTextEditOutlinerView->SetEndCutPasteLinkHdl(
+                    LINK(this, SdrObjEditView, ImpAfterCutOrPasteChainingEventHdl));
             }
 
 #ifdef DBG_UTIL
-            if (mpItemBrowser!=nullptr) mpItemBrowser->SetDirty();
+            if (mpItemBrowser != nullptr)
+                mpItemBrowser->SetDirty();
 #endif
             pTextEditOutliner->ClearModifyFlag();
 
@@ -1301,7 +1333,7 @@ bool SdrObjEditView::SdrBeginTextEdit(
                 pWin->Invalidate(aTextEditArea);
             }
 
-            if( GetModel() )
+            if (GetModel())
             {
                 SdrHint aHint(SdrHintKind::BeginEdit, *pTextObj);
                 GetModel()->Broadcast(aHint);
@@ -1309,14 +1341,15 @@ bool SdrObjEditView::SdrBeginTextEdit(
 
             pTextEditOutliner->setVisualizedPage(nullptr);
 
-            if( mxSelectionController.is() )
+            if (mxSelectionController.is())
                 mxSelectionController->onSelectionHasChanged();
 
-            if (GetModel() && IsUndoEnabled() && !GetModel()->GetDisableTextEditUsesCommonUndoManager())
+            if (GetModel() && IsUndoEnabled()
+                && !GetModel()->GetDisableTextEditUsesCommonUndoManager())
             {
                 SdrUndoManager* pSdrUndoManager = getSdrUndoManagerForEnhancedTextEdit();
 
-                if(pSdrUndoManager)
+                if (pSdrUndoManager)
                 {
                     // we have an outliner, undo manager and it's an EditUndoManager, exchange
                     // the document undo manager and the default one from the outliner and tell
@@ -1328,7 +1361,8 @@ bool SdrObjEditView::SdrBeginTextEdit(
                 }
                 else
                 {
-                    OSL_ENSURE(false, "The document undo manager is not derived from SdrUndoManager (!)");
+                    OSL_ENSURE(false,
+                               "The document undo manager is not derived from SdrUndoManager (!)");
                 }
             }
 
@@ -1337,8 +1371,8 @@ bool SdrObjEditView::SdrBeginTextEdit(
         else
         {
             pTextEditOutliner->SetCalcFieldValueHdl(aOldCalcFieldValueLink);
-            pTextEditOutliner->SetBeginPasteOrDropHdl(Link<PasteOrDropInfos*,void>());
-            pTextEditOutliner->SetEndPasteOrDropHdl(Link<PasteOrDropInfos*,void>());
+            pTextEditOutliner->SetBeginPasteOrDropHdl(Link<PasteOrDropInfos*, void>());
+            pTextEditOutliner->SetEndPasteOrDropHdl(Link<PasteOrDropInfos*, void>());
         }
     }
     if (pTextEditOutliner != nullptr)
@@ -1347,10 +1381,10 @@ bool SdrObjEditView::SdrBeginTextEdit(
     }
 
     // something went wrong...
-    if(!bDontDeleteOutliner)
+    if (!bDontDeleteOutliner)
     {
         delete pGivenOutliner;
-        if(pGivenOutlinerView!=nullptr)
+        if (pGivenOutlinerView != nullptr)
         {
             delete pGivenOutlinerView;
             pGivenOutlinerView = nullptr;
@@ -1358,10 +1392,10 @@ bool SdrObjEditView::SdrBeginTextEdit(
     }
     pTextEditOutliner.reset();
 
-    pTextEditOutlinerView=nullptr;
+    pTextEditOutlinerView = nullptr;
     mxTextEditObj.reset(nullptr);
-    pTextEditPV=nullptr;
-    pTextEditWin=nullptr;
+    pTextEditPV = nullptr;
+    pTextEditWin = nullptr;
     maHdlList.SetMoveOutside(false);
 
     return false;
@@ -1369,28 +1403,29 @@ bool SdrObjEditView::SdrBeginTextEdit(
 
 SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally)
 {
-    SdrEndTextEditKind eRet=SdrEndTextEditKind::Unchanged;
+    SdrEndTextEditKind eRet = SdrEndTextEditKind::Unchanged;
     SdrTextObj* pTEObj = mxTextEditObj.get();
-    vcl::Window*       pTEWin         =pTextEditWin;
-    OutlinerView* pTEOutlinerView=pTextEditOutlinerView;
-    vcl::Cursor*  pTECursorBuffer=pTextEditCursorBuffer;
+    vcl::Window* pTEWin = pTextEditWin;
+    OutlinerView* pTEOutlinerView = pTextEditOutlinerView;
+    vcl::Cursor* pTECursorBuffer = pTextEditCursorBuffer;
     SdrUndoManager* pUndoEditUndoManager = nullptr;
     bool bNeedToUndoSavedRedoTextEdit(false);
 
-    if (GetModel() && IsUndoEnabled() && pTEObj && pTextEditOutliner && !GetModel()->GetDisableTextEditUsesCommonUndoManager())
+    if (GetModel() && IsUndoEnabled() && pTEObj && pTextEditOutliner
+        && !GetModel()->GetDisableTextEditUsesCommonUndoManager())
     {
         // change back the UndoManager to the remembered original one
         SfxUndoManager* pOriginal = pTextEditOutliner->SetUndoManager(mpOldTextEditUndoManager);
         mpOldTextEditUndoManager = nullptr;
 
-        if(pOriginal)
+        if (pOriginal)
         {
             // check if we got back our document undo manager
             SdrUndoManager* pSdrUndoManager = getSdrUndoManagerForEnhancedTextEdit();
 
-            if(pSdrUndoManager && dynamic_cast< SdrUndoManager* >(pOriginal) == pSdrUndoManager)
+            if (pSdrUndoManager && dynamic_cast<SdrUndoManager*>(pOriginal) == pSdrUndoManager)
             {
-                if(pSdrUndoManager->isEndTextEditTriggeredFromUndo())
+                if (pSdrUndoManager->isEndTextEditTriggeredFromUndo())
                 {
                     // remember the UndoManager where missing Undos have to be triggered after end
                     // text edit. When the undo had triggered the end text edit, the original action
@@ -1401,7 +1436,7 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally)
                     // to create a complete text change undo action for the redo buffer. Also mark this
                     // state when at least one redo was executed; the created extra TextChange needs to
                     // be undone in addition to the first real undo outside the text edit changes
-                    while(pSdrUndoManager->GetRedoActionCount())
+                    while (pSdrUndoManager->GetRedoActionCount())
                     {
                         bNeedToUndoSavedRedoTextEdit = true;
                         pSdrUndoManager->Redo();
@@ -1410,11 +1445,12 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally)
 
                 // reset the callback link and let the undo manager cleanup all text edit
                 // undo actions to get the stack back to the form before the text edit
-                pSdrUndoManager->SetEndTextEditHdl(Link<SdrUndoManager*,void>());
+                pSdrUndoManager->SetEndTextEditHdl(Link<SdrUndoManager*, void>());
             }
             else
             {
-                OSL_ENSURE(false, "Got UndoManager back in SdrEndTextEdit which is NOT the expected document UndoManager (!)");
+                OSL_ENSURE(false, "Got UndoManager back in SdrEndTextEdit which is NOT the "
+                                  "expected document UndoManager (!)");
                 delete pOriginal;
             }
         }
@@ -1424,7 +1460,7 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally)
         assert(nullptr == mpOldTextEditUndoManager); // cannot be restored!
     }
 
-    if( GetModel() && mxTextEditObj.is() )
+    if (GetModel() && mxTextEditObj.is())
     {
         SdrHint aHint(SdrHintKind::EndEdit, *mxTextEditObj.get());
         GetModel()->Broadcast(aHint);
@@ -1439,48 +1475,53 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally)
     }
 
     mxTextEditObj.reset(nullptr);
-    pTextEditPV=nullptr;
-    pTextEditWin=nullptr;
+    pTextEditPV = nullptr;
+    pTextEditWin = nullptr;
     SdrOutliner* pTEOutliner = pTextEditOutliner.release();
-    pTextEditOutlinerView=nullptr;
-    pTextEditCursorBuffer=nullptr;
-    aTextEditArea=tools::Rectangle();
+    pTextEditOutlinerView = nullptr;
+    pTextEditCursorBuffer = nullptr;
+    aTextEditArea = tools::Rectangle();
 
-    if (pTEOutliner!=nullptr)
+    if (pTEOutliner != nullptr)
     {
-        bool bModified=pTEOutliner->IsModified();
-        if (pTEOutlinerView!=nullptr)
+        bool bModified = pTEOutliner->IsModified();
+        if (pTEOutlinerView != nullptr)
         {
             pTEOutlinerView->HideCursor();
         }
-        if (pTEObj!=nullptr)
+        if (pTEObj != nullptr)
         {
             pTEOutliner->CompleteOnlineSpelling();
 
             std::unique_ptr<SdrUndoObjSetText> pTxtUndo;
 
-            if( bModified )
+            if (bModified)
             {
                 sal_Int32 nText;
-                for( nText = 0; nText < pTEObj->getTextCount(); ++nText )
-                    if( pTEObj->getText( nText ) == pTEObj->getActiveText() )
+                for (nText = 0; nText < pTEObj->getTextCount(); ++nText)
+                    if (pTEObj->getText(nText) == pTEObj->getActiveText())
                         break;
 
-                pTxtUndo.reset( dynamic_cast< SdrUndoObjSetText* >( GetModel()->GetSdrUndoFactory().CreateUndoObjectSetText(*pTEObj, nText ).release() ) );
+                pTxtUndo.reset(
+                    dynamic_cast<SdrUndoObjSetText*>(GetModel()
+                                                         ->GetSdrUndoFactory()
+                                                         .CreateUndoObjectSetText(*pTEObj, nText)
+                                                         .release()));
             }
-            DBG_ASSERT( !bModified || pTxtUndo, "svx::SdrObjEditView::EndTextEdit(), could not create undo action!" );
+            DBG_ASSERT(!bModified || pTxtUndo,
+                       "svx::SdrObjEditView::EndTextEdit(), could not create undo action!");
             // Set old CalcFieldValue-Handler again, this
             // has to happen before Obj::EndTextEdit(), as this does UpdateFields().
             pTEOutliner->SetCalcFieldValueHdl(aOldCalcFieldValueLink);
-            pTEOutliner->SetBeginPasteOrDropHdl(Link<PasteOrDropInfos*,void>());
-            pTEOutliner->SetEndPasteOrDropHdl(Link<PasteOrDropInfos*,void>());
+            pTEOutliner->SetBeginPasteOrDropHdl(Link<PasteOrDropInfos*, void>());
+            pTEOutliner->SetEndPasteOrDropHdl(Link<PasteOrDropInfos*, void>());
 
             const bool bUndo = IsUndoEnabled();
-            if( bUndo )
+            if (bUndo)
             {
                 EndTextEditAllViews();
                 OUString aObjName(pTEObj->TakeObjNameSingul());
-                BegUndo(SvxResId(STR_UndoObjSetText),aObjName);
+                BegUndo(SvxResId(STR_UndoObjSetText), aObjName);
             }
 
             pTEObj->EndTextEdit(*pTEOutliner);
@@ -1491,7 +1532,7 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally)
                 pTEObj->ActionChanged();
             }
 
-            if (pTxtUndo!=nullptr)
+            if (pTxtUndo != nullptr)
             {
                 pTxtUndo->AfterSetText();
                 if (!pTxtUndo->IsDifferent())
@@ -1501,39 +1542,39 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally)
             }
             // check deletion of entire TextObj
             std::unique_ptr<SdrUndoAction> pDelUndo;
-            bool bDelObj=false;
+            bool bDelObj = false;
             if (bTextEditNewObj)
             {
-                bDelObj=pTEObj->IsTextFrame() &&
-                        !pTEObj->HasText() &&
-                        !pTEObj->IsEmptyPresObj() &&
-                        !pTEObj->HasFill() &&
-                        !pTEObj->HasLine();
+                bDelObj = pTEObj->IsTextFrame() && !pTEObj->HasText() && !pTEObj->IsEmptyPresObj()
+                          && !pTEObj->HasFill() && !pTEObj->HasLine();
 
-                if(pTEObj->IsInserted() && bDelObj && pTEObj->GetObjInventor()==SdrInventor::Default && !bDontDeleteReally)
+                if (pTEObj->IsInserted() && bDelObj
+                    && pTEObj->GetObjInventor() == SdrInventor::Default && !bDontDeleteReally)
                 {
-                    SdrObjKind eIdent=static_cast<SdrObjKind>(pTEObj->GetObjIdentifier());
-                    if(eIdent==OBJ_TEXT)
+                    SdrObjKind eIdent = static_cast<SdrObjKind>(pTEObj->GetObjIdentifier());
+                    if (eIdent == OBJ_TEXT)
                     {
-                        pDelUndo= GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pTEObj);
+                        pDelUndo = GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pTEObj);
                     }
                 }
             }
             if (pTxtUndo)
             {
-                if( bUndo )
+                if (bUndo)
                     AddUndo(std::move(pTxtUndo));
-                eRet=SdrEndTextEditKind::Changed;
+                eRet = SdrEndTextEditKind::Changed;
             }
-            if (pDelUndo!=nullptr)
+            if (pDelUndo != nullptr)
             {
-                if( bUndo )
+                if (bUndo)
                 {
                     AddUndo(std::move(pDelUndo));
                 }
-                eRet=SdrEndTextEditKind::Deleted;
-                DBG_ASSERT(pTEObj->getParentSdrObjListFromSdrObject()!=nullptr,"SdrObjEditView::SdrEndTextEdit(): Fatal: Object edited doesn't have an ObjList!");
-                if (pTEObj->getParentSdrObjListFromSdrObject()!=nullptr)
+                eRet = SdrEndTextEditKind::Deleted;
+                DBG_ASSERT(pTEObj->getParentSdrObjListFromSdrObject() != nullptr,
+                           "SdrObjEditView::SdrEndTextEdit(): Fatal: Object edited doesn't have an "
+                           "ObjList!");
+                if (pTEObj->getParentSdrObjListFromSdrObject() != nullptr)
                 {
                     pTEObj->getParentSdrObjListFromSdrObject()->RemoveObject(pTEObj->GetOrdNum());
                     CheckMarked(); // remove selection immediately...
@@ -1541,14 +1582,14 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally)
             }
             else if (bDelObj)
             { // for Writer: the app has to do the deletion itself.
-                eRet=SdrEndTextEditKind::ShouldBeDeleted;
+                eRet = SdrEndTextEditKind::ShouldBeDeleted;
             }
 
-            if( bUndo )
+            if (bUndo)
                 EndUndo(); // EndUndo after Remove, in case UndoStack is deleted immediately
 
             // Switch on any TextAnimation again after TextEdit
-            if(dynamic_cast<const SdrTextObj*>( pTEObj) !=  nullptr)
+            if (dynamic_cast<const SdrTextObj*>(pTEObj) != nullptr)
             {
                 pTEObj->SetTextAnimationAllowed(true);
             }
@@ -1558,39 +1599,42 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally)
             AdjustMarkHdl();
         }
         // delete all OutlinerViews
-        for (sal_uIntPtr i=pTEOutliner->GetViewCount(); i>0;)
+        for (sal_uIntPtr i = pTEOutliner->GetViewCount(); i > 0;)
         {
             i--;
-            OutlinerView* pOLV=pTEOutliner->GetView(i);
-            sal_uInt16 nMorePix=pOLV->GetInvalidateMore() + 10;
-            vcl::Window* pWin=pOLV->GetWindow();
+            OutlinerView* pOLV = pTEOutliner->GetView(i);
+            sal_uInt16 nMorePix = pOLV->GetInvalidateMore() + 10;
+            vcl::Window* pWin = pOLV->GetWindow();
             tools::Rectangle aRect(pOLV->GetOutputArea());
             pTEOutliner->RemoveView(i);
-            if (!bTextEditDontDelete || i!=0)
+            if (!bTextEditDontDelete || i != 0)
             {
                 // may not own the zeroth one
                 delete pOLV;
             }
             aRect.Union(aTextEditArea);
             aRect.Union(aMinTextEditArea);
-            aRect=pWin->LogicToPixel(aRect);
-            aRect.AdjustLeft( -nMorePix );
-            aRect.AdjustTop( -nMorePix );
-            aRect.AdjustRight(nMorePix );
-            aRect.AdjustBottom(nMorePix );
-            aRect=pWin->PixelToLogic(aRect);
-            InvalidateOneWin(*pWin,aRect);
+            aRect = pWin->LogicToPixel(aRect);
+            aRect.AdjustLeft(-nMorePix);
+            aRect.AdjustTop(-nMorePix);
+            aRect.AdjustRight(nMorePix);
+            aRect.AdjustBottom(nMorePix);
+            aRect = pWin->PixelToLogic(aRect);
+            InvalidateOneWin(*pWin, aRect);
             pWin->SetFillColor();
             pWin->SetLineColor(COL_BLACK);
         }
         // and now the Outliner itself
-        if (!bTextEditDontDelete) delete pTEOutliner;
-        else pTEOutliner->Clear();
-        if (pTEWin!=nullptr) {
+        if (!bTextEditDontDelete)
+            delete pTEOutliner;
+        else
+            pTEOutliner->Clear();
+        if (pTEWin != nullptr)
+        {
             pTEWin->SetCursor(pTECursorBuffer);
         }
         maHdlList.SetMoveOutside(false);
-        if (eRet!=SdrEndTextEditKind::Unchanged)
+        if (eRet != SdrEndTextEditKind::Unchanged)
         {
             GetMarkedObjectListWriteAccess().SetNameDirty();
         }
@@ -1603,17 +1647,15 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally)
 #endif
     }
 
-    if( pTEObj &&
-        !pTEObj->getSdrModelFromSdrObject().isLocked() &&
-        pTEObj->GetBroadcaster())
+    if (pTEObj && !pTEObj->getSdrModelFromSdrObject().isLocked() && pTEObj->GetBroadcaster())
     {
         SdrHint aHint(SdrHintKind::EndEdit, *pTEObj);
         const_cast<SfxBroadcaster*>(pTEObj->GetBroadcaster())->Broadcast(aHint);
     }
 
-    if(pUndoEditUndoManager)
+    if (pUndoEditUndoManager)
     {
-        if(bNeedToUndoSavedRedoTextEdit)
+        if (bNeedToUndoSavedRedoTextEdit)
         {
             // undo the text edit action since it was created as part of an EndTextEdit
             // callback from undo itself. This needs to be done after the call to
@@ -1629,46 +1671,42 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally)
     return eRet;
 }
 
-
 // info about TextEdit. Default is false.
-bool SdrObjEditView::IsTextEdit() const
-{
-    return mxTextEditObj.is();
-}
+bool SdrObjEditView::IsTextEdit() const { return mxTextEditObj.is(); }
 
 // info about TextEditPageView. Default is 0L.
-SdrPageView* SdrObjEditView::GetTextEditPageView() const
-{
-    return pTextEditPV;
-}
-
+SdrPageView* SdrObjEditView::GetTextEditPageView() const { return pTextEditPV; }
 
-OutlinerView* SdrObjEditView::ImpFindOutlinerView(vcl::Window const * pWin) const
+OutlinerView* SdrObjEditView::ImpFindOutlinerView(vcl::Window const* pWin) const
 {
-    if (pWin==nullptr) return nullptr;
-    if (pTextEditOutliner==nullptr) return nullptr;
-    OutlinerView* pNewView=nullptr;
-    sal_uIntPtr nWinCount=pTextEditOutliner->GetViewCount();
-    for (sal_uIntPtr i=0; i<nWinCount && pNewView==nullptr; i++) {
-        OutlinerView* pView=pTextEditOutliner->GetView(i);
-        if (pView->GetWindow()==pWin) pNewView=pView;
+    if (pWin == nullptr)
+        return nullptr;
+    if (pTextEditOutliner == nullptr)
+        return nullptr;
+    OutlinerView* pNewView = nullptr;
+    sal_uIntPtr nWinCount = pTextEditOutliner->GetViewCount();
+    for (sal_uIntPtr i = 0; i < nWinCount && pNewView == nullptr; i++)
+    {
+        OutlinerView* pView = pTextEditOutliner->GetView(i);
+        if (pView->GetWindow() == pWin)
+            pNewView = pView;
     }
     return pNewView;
 }
 
 void SdrObjEditView::SetTextEditWin(vcl::Window* pWin)
 {
-    if(mxTextEditObj.is() && pWin!=nullptr && pWin!=pTextEditWin)
+    if (mxTextEditObj.is() && pWin != nullptr && pWin != pTextEditWin)
     {
-        OutlinerView* pNewView=ImpFindOutlinerView(pWin);
-        if (pNewView!=nullptr && pNewView!=pTextEditOutlinerView)
+        OutlinerView* pNewView = ImpFindOutlinerView(pWin);
+        if (pNewView != nullptr && pNewView != pTextEditOutlinerView)
         {
-            if (pTextEditOutlinerView!=nullptr)
+            if (pTextEditOutlinerView != nullptr)
             {
                 pTextEditOutlinerView->HideCursor();
             }
-            pTextEditOutlinerView=pNewView;
-            pTextEditWin=pWin;
+            pTextEditOutlinerView = pNewView;
+            pTextEditWin = pWin;
             pWin->GrabFocus(); // Make the cursor blink here as well
             pNewView->ShowCursor();
             ImpMakeTextCursorAreaVisible();
@@ -1678,25 +1716,27 @@ void SdrObjEditView::SetTextEditWin(vcl::Window* pWin)
 
 bool SdrObjEditView::IsTextEditHit(const Point& rHit) const
 {
-    bool bOk=false;
-    if(mxTextEditObj.is())
+    bool bOk = false;
+    if (mxTextEditObj.is())
     {
         tools::Rectangle aEditArea;
-        OutlinerView* pOLV=pTextEditOutliner->GetView(0);
-        if (pOLV!=nullptr)
+        OutlinerView* pOLV = pTextEditOutliner->GetView(0);
+        if (pOLV != nullptr)
         {
             aEditArea.Union(pOLV->GetOutputArea());
         }
-        bOk=aEditArea.IsInside(rHit);
+        bOk = aEditArea.IsInside(rHit);
         if (bOk)
         { // check if any characters were actually hit
-            Point aPnt(rHit); aPnt-=aEditArea.TopLeft();
+            Point aPnt(rHit);
+            aPnt -= aEditArea.TopLeft();
             long nHitTol = 2000;
             OutputDevice* pRef = pTextEditOutliner->GetRefDevice();
-            if( pRef )
-                nHitTol = OutputDevice::LogicToLogic( nHitTol, MapUnit::Map100thMM, pRef->GetMapMode().GetMapUnit() );
+            if (pRef)
+                nHitTol = OutputDevice::LogicToLogic(nHitTol, MapUnit::Map100thMM,
+                                                     pRef->GetMapMode().GetMapUnit());
 
-            bOk = pTextEditOutliner->IsTextPos( aPnt, static_cast<sal_uInt16>(nHitTol) );
+            bOk = pTextEditOutliner->IsTextPos(aPnt, static_cast<sal_uInt16>(nHitTol));
         }
     }
     return bOk;
@@ -1704,26 +1744,27 @@ bool SdrObjEditView::IsTextEditHit(const Point& rHit) const
 
 bool SdrObjEditView::IsTextEditFrameHit(const Point& rHit) const
 {
-    bool bOk=false;
-    if(mxTextEditObj.is())
+    bool bOk = false;
+    if (mxTextEditObj.is())
     {
         SdrTextObj* pText = mxTextEditObj.get();
-        OutlinerView* pOLV=pTextEditOutliner->GetView(0);
-        if( pOLV )
+        OutlinerView* pOLV = pTextEditOutliner->GetView(0);
+        if (pOLV)
         {
-            vcl::Window* pWin=pOLV->GetWindow();
+            vcl::Window* pWin = pOLV->GetWindow();
             if (pText != nullptr && pText->IsTextFrame() && pWin != nullptr)
             {
-                sal_uInt16 nPixSiz=pOLV->GetInvalidateMore();
+                sal_uInt16 nPixSiz = pOLV->GetInvalidateMore();
                 tools::Rectangle aEditArea(aMinTextEditArea);
                 aEditArea.Union(pOLV->GetOutputArea());
-                if (!aEditArea.IsInside(rHit)) {
-                    Size aSiz(pWin->PixelToLogic(Size(nPixSiz,nPixSiz)));
-                    aEditArea.AdjustLeft( -(aSiz.Width()) );
-                    aEditArea.AdjustTop( -(aSiz.Height()) );
-                    aEditArea.AdjustRight(aSiz.Width() );
-                    aEditArea.AdjustBottom(aSiz.Height() );
-                    bOk=aEditArea.IsInside(rHit);
+                if (!aEditArea.IsInside(rHit))
+                {
+                    Size aSiz(pWin->PixelToLogic(Size(nPixSiz, nPixSiz)));
+                    aEditArea.AdjustLeft(-(aSiz.Width()));
+                    aEditArea.AdjustTop(-(aSiz.Height()));
+                    aEditArea.AdjustRight(aSiz.Width());
+                    aEditArea.AdjustBottom(aSiz.Height());
+                    bOk = aEditArea.IsInside(rHit);
                 }
             }
         }
@@ -1731,9 +1772,8 @@ bool SdrObjEditView::IsTextEditFrameHit(const Point& rHit) const
     return bOk;
 }
 
-TextChainCursorManager *SdrObjEditView::ImpHandleMotionThroughBoxesKeyInput(
-                                            const KeyEvent& rKEvt,
-                                            bool *bOutHandled)
+TextChainCursorManager* SdrObjEditView::ImpHandleMotionThroughBoxesKeyInput(const KeyEvent& rKEvt,
+                                                                            bool* bOutHandled)
 {
     *bOutHandled = false;
 
@@ -1744,8 +1784,9 @@ TextChainCursorManager *SdrObjEditView::ImpHandleMotionThroughBoxesKeyInput(
     if (!pTextObj->GetNextLinkInChain() && !pTextObj->GetPrevLinkInChain())
         return nullptr;
 
-    TextChainCursorManager *pCursorManager = new TextChainCursorManager(this, pTextObj);
-    if( pCursorManager->HandleKeyEvent(rKEvt) ) {
+    TextChainCursorManager* pCursorManager = new TextChainCursorManager(this, pTextObj);
+    if (pCursorManager->HandleKeyEvent(rKEvt))
+    {
         // Possibly do other stuff here if necessary...
         // XXX: Careful with the checks below (in KeyInput) for pWin and co. You should do them here I guess.
         *bOutHandled = true;
@@ -1756,7 +1797,7 @@ TextChainCursorManager *SdrObjEditView::ImpHandleMotionThroughBoxesKeyInput(
 
 bool SdrObjEditView::KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin)
 {
-    if(pTextEditOutlinerView)
+    if (pTextEditOutlinerView)
     {
         /* Start special handling of keys within a chain */
         // We possibly move to another box before any handling
@@ -1769,9 +1810,9 @@ bool SdrObjEditView::KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin)
 
         if (pTextEditOutlinerView->PostKeyEvent(rKEvt, pWin))
         {
-            if( mpModel )
+            if (mpModel)
             {
-                if( pTextEditOutliner && pTextEditOutliner->IsModified() )
+                if (pTextEditOutliner && pTextEditOutliner->IsModified())
                     mpModel->SetChanged();
             }
 
@@ -1780,150 +1821,196 @@ bool SdrObjEditView::KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin)
             ImpMoveCursorAfterChainingEvent(xCursorManager.get());
             /* End chaining processing */
 
-            if (pWin!=nullptr && pWin!=pTextEditWin) SetTextEditWin(pWin);
+            if (pWin != nullptr && pWin != pTextEditWin)
+                SetTextEditWin(pWin);
 #ifdef DBG_UTIL
-            if (mpItemBrowser!=nullptr) mpItemBrowser->SetDirty();
+            if (mpItemBrowser != nullptr)
+                mpItemBrowser->SetDirty();
 #endif
             ImpMakeTextCursorAreaVisible();
             return true;
         }
     }
-    return SdrGlueEditView::KeyInput(rKEvt,pWin);
+    return SdrGlueEditView::KeyInput(rKEvt, pWin);
 }
 
 bool SdrObjEditView::MouseButtonDown(const MouseEvent& rMEvt, OutputDevice* pWin)
 {
-    if (pTextEditOutlinerView!=nullptr) {
-        bool bPostIt=pTextEditOutliner->IsInSelectionMode();
-        if (!bPostIt) {
+    if (pTextEditOutlinerView != nullptr)
+    {
+        bool bPostIt = pTextEditOutliner->IsInSelectionMode();
+        if (!bPostIt)
+        {
             Point aPt(rMEvt.GetPosPixel());
-            if (pWin!=nullptr) aPt=pWin->PixelToLogic(aPt);
-            else if (pTextEditWin!=nullptr) aPt=pTextEditWin->PixelToLogic(aPt);
-            bPostIt=IsTextEditHit(aPt);
+            if (pWin != nullptr)
+                aPt = pWin->PixelToLogic(aPt);
+            else if (pTextEditWin != nullptr)
+                aPt = pTextEditWin->PixelToLogic(aPt);
+            bPostIt = IsTextEditHit(aPt);
         }
-        if (bPostIt) {
+        if (bPostIt)
+        {
             Point aPixPos(rMEvt.GetPosPixel());
             if (pWin)
             {
                 tools::Rectangle aR(pWin->LogicToPixel(pTextEditOutlinerView->GetOutputArea()));
-                if (aPixPos.X()<aR.Left  ()) aPixPos.setX(aR.Left  () );
-                if (aPixPos.X()>aR.Right ()) aPixPos.setX(aR.Right () );
-                if (aPixPos.Y()<aR.Top   ()) aPixPos.setY(aR.Top   () );
-                if (aPixPos.Y()>aR.Bottom()) aPixPos.setY(aR.Bottom() );
-            }
-            MouseEvent aMEvt(aPixPos,rMEvt.GetClicks(),rMEvt.GetMode(),
-                             rMEvt.GetButtons(),rMEvt.GetModifier());
-            if (pTextEditOutlinerView->MouseButtonDown(aMEvt)) {
-                if (pWin!=nullptr && pWin!=pTextEditWin && pWin->GetOutDevType() == OUTDEV_WINDOW)
+                if (aPixPos.X() < aR.Left())
+                    aPixPos.setX(aR.Left());
+                if (aPixPos.X() > aR.Right())
+                    aPixPos.setX(aR.Right());
+                if (aPixPos.Y() < aR.Top())
+                    aPixPos.setY(aR.Top());
+                if (aPixPos.Y() > aR.Bottom())
+                    aPixPos.setY(aR.Bottom());
+            }
+            MouseEvent aMEvt(aPixPos, rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(),
+                             rMEvt.GetModifier());
+            if (pTextEditOutlinerView->MouseButtonDown(aMEvt))
+            {
+                if (pWin != nullptr && pWin != pTextEditWin
+                    && pWin->GetOutDevType() == OUTDEV_WINDOW)
                     SetTextEditWin(static_cast<vcl::Window*>(pWin));
 #ifdef DBG_UTIL
-                if (mpItemBrowser!=nullptr) mpItemBrowser->SetDirty();
+                if (mpItemBrowser != nullptr)
+                    mpItemBrowser->SetDirty();
 #endif
                 ImpMakeTextCursorAreaVisible();
                 return true;
             }
         }
     }
-    return SdrGlueEditView::MouseButtonDown(rMEvt,pWin);
+    return SdrGlueEditView::MouseButtonDown(rMEvt, pWin);
 }
 
 bool SdrObjEditView::MouseButtonUp(const MouseEvent& rMEvt, OutputDevice* pWin)
 {
-    if (pTextEditOutlinerView!=nullptr) {
-        bool bPostIt=pTextEditOutliner->IsInSelectionMode();
-        if (!bPostIt) {
+    if (pTextEditOutlinerView != nullptr)
+    {
+        bool bPostIt = pTextEditOutliner->IsInSelectionMode();
+        if (!bPostIt)
+        {

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list