tdf#147708 create floating menubutton on demand

and destroy when it is fully faded out. Otherwise windows runs out of
gdi handles with document with large number of page breaks

todo: rename some things in a follow up commit after this more easily
backportable commit is merged

Change-Id: Ibbe3cd00d1027ac34915c4bff73e3a330e300f38
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135138
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
diff --git a/sw/source/uibase/docvw/FrameControlsManager.cxx b/sw/source/uibase/docvw/FrameControlsManager.cxx
index 75ad1b6..1e13870 100644
--- a/sw/source/uibase/docvw/FrameControlsManager.cxx
+++ b/sw/source/uibase/docvw/FrameControlsManager.cxx
@@ -127,7 +127,7 @@ void SwFrameControlsManager::SetPageBreakControl( const SwPageFrame* pPageFrame 
    else
    {
        SwFrameControlPtr pNewControl = std::make_shared<SwFrameControl>(
                VclPtr<SwPageBreakWin>::Create( m_pEditWin, pPageFrame ).get() );
                VclPtr<SwBreakDashedLine>::Create( m_pEditWin, pPageFrame ).get() );
        const SwViewOption* pViewOpt = m_pEditWin->GetView().GetWrtShell().GetViewOptions();
        pNewControl->SetReadonly( pViewOpt->IsReadonly() );

@@ -136,7 +136,7 @@ void SwFrameControlsManager::SetPageBreakControl( const SwPageFrame* pPageFrame 
        pControl.swap( pNewControl );
    }

    SwPageBreakWin* pWin = static_cast<SwPageBreakWin *>(pControl->GetWindow());
    SwBreakDashedLine* pWin = static_cast<SwBreakDashedLine*>(pControl->GetWindow());
    assert (pWin != nullptr);
    pWin->UpdatePosition();
    if (!pWin->IsVisible())
@@ -215,15 +215,20 @@ void SwFrameControlsManager::SetOutlineContentVisibilityButton(const SwContentFr
        pWin->ShowAll(true);
}

const SwPageFrame* SwFrameMenuButtonBase::GetPageFrame(const SwFrame* pFrame)
{
    if (pFrame->IsPageFrame())
        return static_cast<const SwPageFrame*>(pFrame);

    if (pFrame->IsFlyFrame())
        return static_cast<const SwFlyFrame*>(pFrame)->GetAnchorFrame()->FindPageFrame();

    return pFrame->FindPageFrame();
}

const SwPageFrame* SwFrameMenuButtonBase::GetPageFrame() const
{
    if (m_pFrame->IsPageFrame())
        return static_cast<const SwPageFrame*>( m_pFrame );

    if (m_pFrame->IsFlyFrame())
        return static_cast<const SwFlyFrame*>(m_pFrame)->GetAnchorFrame()->FindPageFrame();

    return m_pFrame->FindPageFrame();
    return SwFrameMenuButtonBase::GetPageFrame(m_pFrame);
}

void SwFrameMenuButtonBase::dispose()
@@ -234,11 +239,16 @@ void SwFrameMenuButtonBase::dispose()
    InterimItemWindow::dispose();
}

void SwFrameMenuButtonBase::SetVirDevFont()
void SwFrameMenuButtonBase::SetVirDevFont(OutputDevice& rVirDev)
{
    // Get the font and configure it
    vcl::Font aFont = Application::GetSettings().GetStyleSettings().GetToolFont();
    weld::SetPointFont(*m_xVirDev, aFont);
    weld::SetPointFont(rVirDev, aFont);
}

void SwFrameMenuButtonBase::SetVirDevFont()
{
    SetVirDevFont(*m_xVirDev);
}

SwFrameControl::SwFrameControl( const VclPtr<vcl::Window> &pWindow )
diff --git a/sw/source/uibase/docvw/PageBreakWin.cxx b/sw/source/uibase/docvw/PageBreakWin.cxx
index 3fcd906..2db9b51 100644
--- a/sw/source/uibase/docvw/PageBreakWin.cxx
+++ b/sw/source/uibase/docvw/PageBreakWin.cxx
@@ -59,69 +59,91 @@
using namespace basegfx;
using namespace basegfx::utils;

namespace
SwBreakDashedLine::SwBreakDashedLine(SwEditWin* pEditWin, const SwFrame *pFrame)
    : SwDashedLine(pEditWin, &SwViewOption::GetPageBreakColor)
    , m_pEditWin(pEditWin)
    , m_pFrame(pFrame)
{
    class SwBreakDashedLine : public SwDashedLine
    set_id("PageBreak"); // for uitest
}

SwPageBreakWin& SwBreakDashedLine::GetOrCreateWin()
{
    if (!m_pWin)
    {
        private:
            VclPtr<SwPageBreakWin> m_pWin;
        m_pWin = VclPtr<SwPageBreakWin>::Create(this, m_pEditWin, m_pFrame);
        m_pWin->SetPosSizePixel(m_aBtnRect.TopLeft(), m_aBtnRect.GetSize());
        m_pWin->SetZOrder(this, ZOrderFlags::Before);
    }
    return *m_pWin;
}

        public:
            SwBreakDashedLine( vcl::Window* pParent, Color& ( *pColorFn )(), SwPageBreakWin* pWin ) :
                SwDashedLine( pParent, pColorFn ),
                m_pWin( pWin ) {};
            virtual ~SwBreakDashedLine() override { disposeOnce(); }
            virtual void dispose() override { m_pWin.clear(); SwDashedLine::dispose(); }
void SwBreakDashedLine::DestroyWin()
{
    m_pWin.disposeAndClear();
}

            virtual void MouseMove( const MouseEvent& rMEvt ) override;
    };

    void SwBreakDashedLine::MouseMove( const MouseEvent& rMEvt )
void SwBreakDashedLine::MouseMove( const MouseEvent& rMEvt )
{
    if ( rMEvt.IsLeaveWindow() )
    {
        if ( rMEvt.IsLeaveWindow() )
        {
            // don't fade if we just move to the 'button'
            Point aEventPos( GetPosPixel() + rMEvt.GetPosPixel() );
            if ( !m_pWin->Contains( aEventPos ) || !m_pWin->IsVisible() )
                m_pWin->Fade( false );
        }
        else if ( !m_pWin->IsVisible() )
        {
            m_pWin->Fade( true );
        }
        // don't fade if we just move to the 'button'
        Point aEventPos( GetPosPixel() + rMEvt.GetPosPixel() );
        if (m_pWin && (!Contains(aEventPos) || !m_pWin->IsVisible()))
            m_pWin->Fade(false);
    }
    else if (!m_pWin || !m_pWin->IsVisible())
    {
        GetOrCreateWin().Fade(true);
    }

        if ( !rMEvt.IsSynthetic() && !m_pWin->IsVisible() )
        {
            m_pWin->UpdatePosition( rMEvt.GetPosPixel() );
        }
    if (!rMEvt.IsSynthetic() && (!m_pWin || !m_pWin->IsVisible()))
    {
        UpdatePosition(rMEvt.GetPosPixel());
    }
}

SwPageBreakWin::SwPageBreakWin( SwEditWin* pEditWin, const SwFrame *pFrame ) :
    SwFrameMenuButtonBase(pEditWin, pFrame, "modules/swriter/ui/pbmenubutton.ui", "PBMenuButton"),
void SwBreakDashedLine::ShowAll(bool bShow)
{
    Show(bShow);
}

void SwBreakDashedLine::SetReadonly(bool bReadonly)
{
    ShowAll(!bReadonly);
}

bool SwBreakDashedLine::Contains(const Point &rDocPt) const
{
    if (m_aBtnRect.Contains(rDocPt))
        return true;

    ::tools::Rectangle aLineRect(GetPosPixel(), GetSizePixel());
    return aLineRect.Contains(rDocPt);
}

SwPageBreakWin::SwPageBreakWin(SwBreakDashedLine* pLine, SwEditWin* pEditWin, const SwFrame *pFrame) :
    InterimItemWindow(pEditWin, "modules/swriter/ui/pbmenubutton.ui", "PBMenuButton"),
    m_xMenuButton(m_xBuilder->weld_menu_button("menubutton")),
    m_pLine( nullptr ),
    m_pLine(pLine),
    m_pEditWin(pEditWin),
    m_pFrame(pFrame),
    m_bIsAppearing( false ),
    m_nFadeRate( 100 ),
    m_nDelayAppearing( 0 ),
    m_aFadeTimer("SwPageBreakWin m_aFadeTimer"),
    m_bDestroyed( false )
{
    set_id("PageBreak"); // for uitest

    m_xMenuButton->connect_toggled(LINK(this, SwPageBreakWin, ToggleHdl));
    m_xMenuButton->connect_selected(LINK(this, SwPageBreakWin, SelectHdl));
    m_xMenuButton->set_accessible_name(SwResId(STR_PAGE_BREAK_BUTTON));

    m_xVirDev = m_xMenuButton->create_virtual_device();
    SetVirDevFont();
    SwFrameMenuButtonBase::SetVirDevFont(*m_xVirDev);

    // Use pixels for the rest of the drawing
    m_xVirDev->SetMapMode( MapMode ( MapUnit::MapPixel ) );

    // Create the line control
    m_pLine = VclPtr<SwBreakDashedLine>::Create( GetEditWin(), &SwViewOption::GetPageBreakColor, this );

    m_aFadeTimer.SetTimeout( 50 );
    m_aFadeTimer.SetInvokeHandler( LINK( this, SwPageBreakWin, FadeHandler ) );
}
@@ -136,10 +158,12 @@ void SwPageBreakWin::dispose()
    m_bDestroyed = true;
    m_aFadeTimer.Stop();
    m_xVirDev.disposeAndClear();
    m_pLine.disposeAndClear();

    m_pLine.clear();
    m_pEditWin.clear();

    m_xMenuButton.reset();
    SwFrameMenuButtonBase::dispose();
    InterimItemWindow::dispose();
}

void SwPageBreakWin::PaintButton()
@@ -241,26 +265,27 @@ static SvxBreak lcl_GetBreakItem(const SwContentFrame* pCnt)

IMPL_LINK(SwPageBreakWin, SelectHdl, const OString&, rIdent, void)
{
    SwFrameControlPtr pThis = GetEditWin()->GetFrameControlsManager( ).GetControl( FrameControlType::PageBreak, GetFrame() );
    SwFrameControlPtr pFrameControl = m_pEditWin->GetFrameControlsManager().GetControl(FrameControlType::PageBreak, m_pFrame);

    execute(rIdent);
    m_pLine->execute(rIdent);

    // Only fade if there is more than this temporary shared pointer:
    // The main reference has been deleted due to a page break removal
    if ( pThis.use_count() > 1 )
    if (pFrameControl.use_count() > 1)
        Fade( false );
}

void SwPageBreakWin::execute(std::string_view rIdent)
void SwBreakDashedLine::execute(std::string_view rIdent)
{
    const SwPageFrame* pPageFrame = SwFrameMenuButtonBase::GetPageFrame(m_pFrame);
    // Is there a PageBefore break on this page?
    SwContentFrame *pCnt = const_cast<SwContentFrame*>(GetPageFrame()->FindFirstBodyContent());
    SwContentFrame *pCnt = const_cast<SwContentFrame*>(pPageFrame->FindFirstBodyContent());
    SvxBreak eBreak = lcl_GetBreakItem( pCnt );

    // Also check the previous page - to see if there is a PageAfter break
    SwContentFrame *pPrevCnt = nullptr;
    SvxBreak ePrevBreak = SvxBreak::NONE;
    const SwPageFrame* pPrevPage = static_cast<const SwPageFrame*>(GetPageFrame()->GetPrev());
    const SwPageFrame* pPrevPage = static_cast<const SwPageFrame*>(pPageFrame->GetPrev());
    if ( pPrevPage )
    {
        pPrevCnt = const_cast<SwContentFrame*>(pPrevPage->FindLastBodyContent());
@@ -269,9 +294,7 @@ void SwPageBreakWin::execute(std::string_view rIdent)

    if (pCnt && rIdent == "edit")
    {
        SwEditWin* pEditWin = GetEditWin();

        SwWrtShell& rSh = pEditWin->GetView().GetWrtShell();
        SwWrtShell& rSh = m_pEditWin->GetView().GetWrtShell();
        bool bOldLock = rSh.IsViewLocked();
        rSh.LockView( true );

@@ -290,8 +313,8 @@ void SwPageBreakWin::execute(std::string_view rIdent)

            rSh.SetSelection( rNd );

            SfxStringItem aItem(pEditWin->GetView().GetPool().GetWhich(FN_FORMAT_TABLE_DLG), "textflow");
            pEditWin->GetView().GetViewFrame()->GetDispatcher()->ExecuteList(
            SfxStringItem aItem(m_pEditWin->GetView().GetPool().GetWhich(FN_FORMAT_TABLE_DLG), "textflow");
            m_pEditWin->GetView().GetViewFrame()->GetDispatcher()->ExecuteList(
                    FN_FORMAT_TABLE_DLG,
                    SfxCallMode::SYNCHRON | SfxCallMode::RECORD,
                    { &aItem });
@@ -301,15 +324,15 @@ void SwPageBreakWin::execute(std::string_view rIdent)
        else
        {
            SwPaM aPaM( rNd );
            SwPaMItem aPaMItem( pEditWin->GetView().GetPool( ).GetWhich( FN_PARAM_PAM ), &aPaM );
            SfxStringItem aItem( pEditWin->GetView().GetPool( ).GetWhich( SID_PARA_DLG ), "textflow" );
            pEditWin->GetView().GetViewFrame()->GetDispatcher()->ExecuteList(
            SwPaMItem aPaMItem( m_pEditWin->GetView().GetPool( ).GetWhich( FN_PARAM_PAM ), &aPaM );
            SfxStringItem aItem( m_pEditWin->GetView().GetPool( ).GetWhich( SID_PARA_DLG ), "textflow" );
            m_pEditWin->GetView().GetViewFrame()->GetDispatcher()->ExecuteList(
                    SID_PARA_DLG,
                    SfxCallMode::SYNCHRON | SfxCallMode::RECORD,
                    { &aItem, &aPaMItem });
        }
        rSh.LockView( bOldLock );
        pEditWin->GrabFocus( );
        m_pEditWin->GrabFocus( );
    }
    else if (pCnt && rIdent == "delete")
    {
@@ -320,7 +343,7 @@ void SwPageBreakWin::execute(std::string_view rIdent)
        rNd.GetDoc().GetIDocumentUndoRedo( ).StartUndo( SwUndoId::UI_DELETE_PAGE_BREAK, nullptr );

        SfxItemSetFixed<RES_PAGEDESC, RES_BREAK> aSet(
            GetEditWin()->GetView().GetWrtShell().GetAttrPool());
            m_pEditWin->GetView().GetWrtShell().GetAttrPool());

        aSet.Put( SwFormatPageDesc( nullptr ) );
        // This break could be from the current paragraph, if it has a PageBefore break.
@@ -328,7 +351,7 @@ void SwPageBreakWin::execute(std::string_view rIdent)
            aSet.Put( SvxFormatBreakItem( SvxBreak::NONE, RES_BREAK ) );

        rNd.GetDoc().getIDocumentContentOperations().InsertItemSet(
            SwPaM(rNd), aSet, SetAttrMode::DEFAULT, GetPageFrame()->getRootFrame());
            SwPaM(rNd), aSet, SetAttrMode::DEFAULT, pPageFrame->getRootFrame());

        // This break could be from the previous paragraph, if it has a PageAfter break.
        if ( ePrevBreak == SvxBreak::PageAfter )
@@ -346,7 +369,7 @@ void SwPageBreakWin::execute(std::string_view rIdent)
    }
}

void SwPageBreakWin::UpdatePosition(const std::optional<Point>& xEvtPt)
void SwBreakDashedLine::UpdatePosition(const std::optional<Point>& xEvtPt)
{
    if ( xEvtPt )
    {
@@ -355,7 +378,7 @@ void SwPageBreakWin::UpdatePosition(const std::optional<Point>& xEvtPt)
        m_xMousePt = xEvtPt;
    }

    const SwPageFrame* pPageFrame = GetPageFrame();
    const SwPageFrame* pPageFrame = SwFrameMenuButtonBase::GetPageFrame(m_pFrame);
    const SwFrame* pPrevPage = pPageFrame;
    do
    {
@@ -408,34 +431,20 @@ void SwPageBreakWin::UpdatePosition(const std::optional<Point>& xEvtPt)
    }

    // Set the button position
    Point aBtnPos( nBtnLeft, nYLineOffset - BUTTON_HEIGHT / 2 );
    SetPosSizePixel( aBtnPos, aBtnSize );
    m_xVirDev->SetOutputSizePixel(aBtnSize);
    m_aBtnRect = ::tools::Rectangle(Point(nBtnLeft, nYLineOffset - BUTTON_HEIGHT / 2), aBtnSize);
    if (m_pWin)
        m_pWin->SetRectanglePixel(m_aBtnRect);

    // Set the line position
    Point aLinePos( nLineLeft, nYLineOffset - 5 );
    Size aLineSize( nLineRight - nLineLeft, 10 );
    m_pLine->SetPosSizePixel( aLinePos, aLineSize );
    SetPosSizePixel(aLinePos, aLineSize);
}

void SwPageBreakWin::ShowAll( bool bShow )
void SwPageBreakWin::SetRectanglePixel(const ::tools::Rectangle& rRect)
{
    m_pLine->Show( bShow );
}

bool SwPageBreakWin::Contains( const Point &rDocPt ) const
{
    ::tools::Rectangle aRect( GetPosPixel(), GetSizePixel() );
    if ( aRect.Contains( rDocPt ) )
        return true;

    ::tools::Rectangle aLineRect( m_pLine->GetPosPixel(), m_pLine->GetSizePixel() );
    return aLineRect.Contains( rDocPt );
}

void SwPageBreakWin::SetReadonly( bool bReadonly )
{
    ShowAll( !bReadonly );
    SetPosSizePixel(rRect.TopLeft(), rRect.GetSize());
    m_xVirDev->SetOutputSizePixel(rRect.GetSize());
}

void SwPageBreakWin::Fade( bool bFadeIn )
@@ -474,10 +483,13 @@ IMPL_LINK_NOARG(SwPageBreakWin, FadeHandler, Timer *, void)
    if ( m_nFadeRate != 100 && !IsVisible() )
        Show();
    else if ( m_nFadeRate == 100 && IsVisible( ) )
    {
        Hide();
        m_pLine->DestroyWin();
    }
    else
    {
        UpdatePosition();
        m_pLine->UpdatePosition();
        PaintButton();
    }

@@ -485,7 +497,7 @@ IMPL_LINK_NOARG(SwPageBreakWin, FadeHandler, Timer *, void)
        m_aFadeTimer.Start();
}

FactoryFunction SwPageBreakWin::GetUITestFactory() const
FactoryFunction SwBreakDashedLine::GetUITestFactory() const
{
    return PageBreakUIObject::create;
}
diff --git a/sw/source/uibase/inc/FrameControl.hxx b/sw/source/uibase/inc/FrameControl.hxx
index e53c765..561dac7 100644
--- a/sw/source/uibase/inc/FrameControl.hxx
+++ b/sw/source/uibase/inc/FrameControl.hxx
@@ -73,6 +73,9 @@ public:
    virtual const SwFrame* GetFrame()   override { return m_pFrame; }
    virtual SwEditWin*   GetEditWin() override { return m_pEditWin; }
    const SwPageFrame*     GetPageFrame() const;

    static const SwPageFrame* GetPageFrame(const SwFrame* pFrame);
    static void SetVirDevFont(OutputDevice& rDevice);
};

#endif
diff --git a/sw/source/uibase/inc/PageBreakWin.hxx b/sw/source/uibase/inc/PageBreakWin.hxx
index 53d2eec..1806290 100644
--- a/sw/source/uibase/inc/PageBreakWin.hxx
+++ b/sw/source/uibase/inc/PageBreakWin.hxx
@@ -10,6 +10,7 @@
#define INCLUDED_SW_SOURCE_UIBASE_INC_PAGEBREAKWIN_HXX

#include "edtwin.hxx"
#include "DashedLine.hxx"
#include "FrameControl.hxx"
#include <vcl/timer.hxx>
#include <optional>
@@ -17,39 +18,72 @@
class Menu;
class SwPageFrame;

class SwPageBreakWin;

/** Class for the page break control window.

    This control shows a line indicating a manual page break and a
    button providing a few actions on that page break.
  */
class SwPageBreakWin final : public SwFrameMenuButtonBase
class SwBreakDashedLine : public SwDashedLine, public ISwFrameControl
{
private:
    VclPtr<SwPageBreakWin> m_pWin;
    VclPtr<SwEditWin> m_pEditWin;
    std::optional<Point> m_xMousePt;
    ::tools::Rectangle m_aBtnRect;
    const SwFrame* m_pFrame;

    SwPageBreakWin& GetOrCreateWin();

public:
    SwBreakDashedLine(SwEditWin* pEditWin, const SwFrame *pFrame);

    virtual ~SwBreakDashedLine() override { disposeOnce(); }
    virtual void dispose() override { m_pWin.disposeAndClear(); m_pEditWin.clear(); SwDashedLine::dispose(); }

    virtual void MouseMove(const MouseEvent& rMEvt) override;

    virtual const SwFrame* GetFrame() override { return m_pFrame; }
    virtual SwEditWin* GetEditWin() override { return m_pEditWin; }
    virtual void ShowAll(bool bShow) override;
    virtual bool Contains(const Point &rDocPt) const override;
    virtual void SetReadonly(bool bReadonly) override;

    void execute(std::string_view rIdent);

    virtual FactoryFunction GetUITestFactory() const override;

    void UpdatePosition(const std::optional<Point>& xEvtPt = std::optional<Point>());
    void DestroyWin();
};

class SwPageBreakWin final : public InterimItemWindow
{
    std::unique_ptr<weld::MenuButton> m_xMenuButton;
    VclPtr<vcl::Window>   m_pLine;
    VclPtr<SwBreakDashedLine> m_pLine;
    VclPtr<SwEditWin>     m_pEditWin;
    VclPtr<VirtualDevice> m_xVirDev;
    const SwFrame*        m_pFrame;
    bool                  m_bIsAppearing;
    int                   m_nFadeRate;
    int                   m_nDelayAppearing; ///< Before we show the control, let it transparent for a few timer ticks to avoid appearing with every mouse over.
    Timer                 m_aFadeTimer;
    bool                  m_bDestroyed;

    std::optional<Point> m_xMousePt;

public:
    SwPageBreakWin( SwEditWin* pEditWin, const SwFrame *pFrame );
    SwPageBreakWin(SwBreakDashedLine* pLine, SwEditWin* pEditWin, const SwFrame *pFrame);
    virtual ~SwPageBreakWin() override;
    virtual void dispose() override;

    void execute(std::string_view rIdent);
    void UpdatePosition(const std::optional<Point>& xEvtPt = std::optional<Point>());

    virtual void ShowAll( bool bShow ) override;
    virtual bool Contains( const Point &rDocPt ) const override;

    void SetReadonly( bool bReadonly ) override;

    void Fade( bool bFadeIn );

    virtual FactoryFunction GetUITestFactory() const override;
    void SetRectanglePixel(const ::tools::Rectangle& rRect);

    const SwPageFrame* GetPageFrame() const
    {
        return SwFrameMenuButtonBase::GetPageFrame(m_pFrame);
    }

private:
    DECL_LINK( FadeHandler, Timer *, void );
diff --git a/sw/source/uibase/inc/uiobject.hxx b/sw/source/uibase/inc/uiobject.hxx
index 2486540..1e08e64 100644
--- a/sw/source/uibase/inc/uiobject.hxx
+++ b/sw/source/uibase/inc/uiobject.hxx
@@ -66,7 +66,7 @@ class PageBreakUIObject final : public WindowUIObject
{
public:

    PageBreakUIObject(const VclPtr<SwPageBreakWin>& xEditWin);
    PageBreakUIObject(const VclPtr<SwBreakDashedLine>& xEditWin);

    virtual void execute(const OUString& rAction,
            const StringMap& rParameters) override;
@@ -77,7 +77,7 @@ private:

    virtual OUString get_name() const override;

    VclPtr<SwPageBreakWin> mxPageBreakUIObject;
    VclPtr<SwBreakDashedLine> mxPageBreakUIObject;

};

diff --git a/sw/source/uibase/uitest/uiobject.cxx b/sw/source/uibase/uitest/uiobject.cxx
index 5f8a408..cb773c8 100644
--- a/sw/source/uibase/uitest/uiobject.cxx
+++ b/sw/source/uibase/uitest/uiobject.cxx
@@ -220,7 +220,7 @@ OUString CommentUIObject::get_name() const
    return "CommentUIObject";
}

PageBreakUIObject::PageBreakUIObject(const VclPtr<SwPageBreakWin>& xPageBreakUIObject):
PageBreakUIObject::PageBreakUIObject(const VclPtr<SwBreakDashedLine>& xPageBreakUIObject):
    WindowUIObject(xPageBreakUIObject),
    mxPageBreakUIObject(xPageBreakUIObject)
{
@@ -237,7 +237,7 @@ void PageBreakUIObject::execute(const OUString& rAction,

std::unique_ptr<UIObject> PageBreakUIObject::create(vcl::Window* pWindow)
{
    SwPageBreakWin* pPageBreakWin = dynamic_cast<SwPageBreakWin*>(pWindow);
    SwBreakDashedLine* pPageBreakWin = dynamic_cast<SwBreakDashedLine*>(pWindow);
    assert(pPageBreakWin);
    return std::unique_ptr<UIObject>(new PageBreakUIObject(pPageBreakWin));
}