drop intermediate vcl container for impress annotation floating toplevel

Change-Id: Ia285322d69ea8ac803e1ee5ed8ba195388189058
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111661
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx
index fdd296b..28f09dd 100644
--- a/sd/source/ui/annotations/annotationmanager.cxx
+++ b/sd/source/ui/annotations/annotationmanager.cxx
@@ -18,6 +18,7 @@
 */

#include <com/sun/star/drawing/XDrawView.hpp>
#include <com/sun/star/frame/XController.hpp>
#include <com/sun/star/geometry/RealPoint2D.hpp>
#include <com/sun/star/text/XText.hpp>
#include <com/sun/star/document/XEventBroadcaster.hpp>
diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx
index 9da90e2..4e79f8d 100644
--- a/sd/source/ui/annotations/annotationtag.cxx
+++ b/sd/source/ui/annotations/annotationtag.cxx
@@ -578,43 +578,34 @@ void AnnotationTag::OpenPopup( bool bEdit )
        if( pWindow )
        {
            RealPoint2D aPosition( mxAnnotation->getPosition() );
            Point aPos( pWindow->OutputToScreenPixel( pWindow->LogicToPixel( Point( static_cast<::tools::Long>(aPosition.X * 100.0), static_cast<::tools::Long>(aPosition.Y * 100.0) ) ) ) );
            Point aPos(pWindow->LogicToPixel( Point( static_cast<::tools::Long>(aPosition.X * 100.0), static_cast<::tools::Long>(aPosition.Y * 100.0) ) ) );

            aPos.AdjustX(4 ); // magic!
            aPos.AdjustY(1 );

            ::tools::Rectangle aRect( aPos, maSize );

            mpAnnotationWindow.reset( VclPtr<AnnotationWindow>::Create( mrView.GetDocSh(), pWindow->GetWindow(GetWindowType::Frame) ) );
            AnnotationContents& rAnnotation = mpAnnotationWindow->GetContents();
            rAnnotation.InitControls();
            rAnnotation.setAnnotation(mxAnnotation);

            sal_uInt16 nArrangeIndex = 0;
            Point aPopupPos( FloatingWindow::CalcFloatingPosition( mpAnnotationWindow.get(), aRect, FloatWinPopupFlags::Right, nArrangeIndex ) );
            Size aPopupSize( 320, 240 );

            mpAnnotationWindow->SetPosSizePixel( aPopupPos, aPopupSize );
            mpAnnotationWindow->DoResize();

            mpAnnotationWindow->Show();
            mpAnnotationWindow->GrabFocus();
            mpAnnotationWindow->AddEventListener( LINK(this, AnnotationTag, WindowEventHandler));
            weld::Window* pParent = weld::GetPopupParent(*pWindow, aRect);
            mpAnnotationWindow.reset(new AnnotationWindow(pParent, aRect, mrView.GetDocSh(), mxAnnotation));
            mpAnnotationWindow->connect_closed(LINK(this, AnnotationTag, PopupModeEndHdl));
        }
    }

    if (bEdit && mpAnnotationWindow)
        mpAnnotationWindow->GetContents().StartEdit();
        mpAnnotationWindow->StartEdit();
}

IMPL_LINK_NOARG(AnnotationTag, PopupModeEndHdl, weld::Popover&, void)
{
    ClosePopup();
}

void AnnotationTag::ClosePopup()
{
    if( mpAnnotationWindow )
    if (mpAnnotationWindow)
    {
        mpAnnotationWindow->RemoveEventListener( LINK(this, AnnotationTag, WindowEventHandler));
        AnnotationContents& rAnnotation = mpAnnotationWindow->GetContents();
        rAnnotation.SaveToDocument();
        mpAnnotationWindow.disposeAndClear();
        mpAnnotationWindow->SaveToDocument();
        mpAnnotationWindow.reset();
    }
}

diff --git a/sd/source/ui/annotations/annotationtag.hxx b/sd/source/ui/annotations/annotationtag.hxx
index 7a02e30..9eea788 100644
--- a/sd/source/ui/annotations/annotationtag.hxx
+++ b/sd/source/ui/annotations/annotationtag.hxx
@@ -70,10 +70,11 @@ private:
    virtual void deselect() override;

    DECL_LINK( WindowEventHandler, VclWindowEvent&, void );
    DECL_LINK(PopupModeEndHdl, weld::Popover&, void);

    AnnotationManagerImpl& mrManager;
    css::uno::Reference< css::office::XAnnotation > mxAnnotation;
    VclPtr<AnnotationWindow>                        mpAnnotationWindow;
    std::unique_ptr<AnnotationWindow>               mpAnnotationWindow;
    Color                                           maColor;
    int                                             mnIndex;
    const vcl::Font&                                mrFont;
diff --git a/sd/source/ui/annotations/annotationwindow.cxx b/sd/source/ui/annotations/annotationwindow.cxx
index 408eb1a..89ffb94 100644
--- a/sd/source/ui/annotations/annotationwindow.cxx
+++ b/sd/source/ui/annotations/annotationwindow.cxx
@@ -147,20 +147,7 @@ bool AnnotationTextWindow::KeyInput(const KeyEvent& rKeyEvt)
    return bDone;
}

/************** AnnotationWindow***********************************++*/
AnnotationWindow::AnnotationWindow(DrawDocShell* pDocShell, vcl::Window* pParent)
    : FloatingWindow(pParent, WB_BORDER)
    , mxContents(VclPtr<AnnotationContents>::Create(this, pDocShell))
{
    EnableAlwaysOnTop();
}

AnnotationWindow::~AnnotationWindow()
{
    disposeOnce();
}

AnnotationTextWindow::AnnotationTextWindow(AnnotationContents& rContents)
AnnotationTextWindow::AnnotationTextWindow(AnnotationWindow& rContents)
    : mrContents(rContents)
{
}
@@ -220,41 +207,37 @@ void AnnotationTextWindow::SetDrawingArea(weld::DrawingArea* pDrawingArea)
}

// see SwAnnotationWin in sw for something similar
AnnotationContents::AnnotationContents(vcl::Window* pParent, DrawDocShell* pDocShell)
    : InterimItemWindow(pParent, "modules/simpress/ui/annotation.ui", "Annotation")
AnnotationWindow::AnnotationWindow(weld::Window* pParent, const ::tools::Rectangle& rRect,
                                   DrawDocShell* pDocShell,
                                   const Reference<XAnnotation>& xAnnotation)
    : mxBuilder(Application::CreateBuilder(pParent, "modules/simpress/ui/annotation.ui"))
    , mxPopover(mxBuilder->weld_popover("Annotation"))
    , mxContainer(mxBuilder->weld_widget("container"))
    , mpDocShell(pDocShell)
    , mpDoc(pDocShell->GetDoc())
    , mbReadonly(pDocShell->IsReadOnly())
    , mbProtected(false)
{
    mxContainer->set_size_request(320, 240);
    mxPopover->popup_at_rect(pParent, rRect);

    InitControls();
    setAnnotation(xAnnotation);
    FillMenuButton();

    DoResize();

    mxTextControl->GrabFocus();
}

void AnnotationContents::dispose()
AnnotationWindow::~AnnotationWindow()
{
    mxTextControlWin.reset();
    mxTextControl.reset();

    mxMeta.reset();
    mxVScrollbar.reset();

    mxMenuButton.reset();

    mpOutliner.reset();
    mpOutlinerView.reset();

    InterimItemWindow::dispose();
}

void AnnotationWindow::dispose()
{
    mxContents.disposeAndClear();
    FloatingWindow::dispose();
}

void AnnotationContents::InitControls()
void AnnotationWindow::InitControls()
{
    // window control for author and date
    mxMeta = m_xBuilder->weld_label("meta");
    mxMeta = mxBuilder->weld_label("meta");
    mxMeta->set_direction(AllSettings::GetLayoutRTL());

    maLabelFont = Application::GetSettings().GetStyleSettings().GetLabelFont();
@@ -267,7 +250,6 @@ void AnnotationContents::InitControls()
    mpOutliner.reset( new ::Outliner(GetAnnotationPool(),OutlinerMode::TextObject) );
    SdDrawDocument::SetCalcFieldValueHdl( mpOutliner.get() );
    mpOutliner->SetUpdateMode( true );
    Rescale();

    if (OutputDevice* pDev = mpDoc->GetRefDevice())
        mpOutliner->SetRefDevice( pDev );
@@ -276,27 +258,29 @@ void AnnotationContents::InitControls()
    mpOutliner->InsertView(mpOutlinerView.get() );

    //create Scrollbars
    mxVScrollbar = m_xBuilder->weld_scrolled_window("scrolledwindow", true);
    mxVScrollbar = mxBuilder->weld_scrolled_window("scrolledwindow", true);

    // actual window which holds the user text
    mxTextControl.reset(new AnnotationTextWindow(*this));
    mxTextControlWin.reset(new weld::CustomWeld(*m_xBuilder, "editview", *mxTextControl));
    mxTextControlWin.reset(new weld::CustomWeld(*mxBuilder, "editview", *mxTextControl));
    mxTextControl->SetPointer(PointerStyle::Text);

    Rescale();
    OutputDevice& rDevice = mxTextControl->GetDrawingArea()->get_ref_device();

    mxVScrollbar->set_direction(false);
    mxVScrollbar->connect_vadjustment_changed(LINK(this, AnnotationContents, ScrollHdl));
    mxVScrollbar->connect_vadjustment_changed(LINK(this, AnnotationWindow, ScrollHdl));

    mpOutlinerView->SetBackgroundColor(COL_TRANSPARENT);
    mpOutlinerView->SetOutputArea( PixelToLogic( ::tools::Rectangle(0,0,1,1) ) );
    mpOutlinerView->SetOutputArea(rDevice.PixelToLogic(::tools::Rectangle(0, 0, 1, 1)));

    mxMenuButton = m_xBuilder->weld_menu_button("menubutton");
    mxMenuButton = mxBuilder->weld_menu_button("menubutton");
    if (mbReadonly)
        mxMenuButton->hide();
    else
    {
        mxMenuButton->set_size_request(METABUTTON_WIDTH, METABUTTON_HEIGHT);
        mxMenuButton->connect_toggled(LINK(this, AnnotationContents, MenuButtonToggledHdl));
        mxMenuButton->connect_selected(LINK(this, AnnotationContents, MenuItemSelectedHdl));
        mxMenuButton->connect_selected(LINK(this, AnnotationWindow, MenuItemSelectedHdl));
    }

    EEControlBits nCntrl = mpOutliner->GetControlWord();
@@ -315,7 +299,7 @@ void AnnotationContents::InitControls()
    mxTextControl->GrabFocus();
}

IMPL_LINK(AnnotationContents, MenuItemSelectedHdl, const OString&, rIdent, void)
IMPL_LINK(AnnotationWindow, MenuItemSelectedHdl, const OString&, rIdent, void)
{
    SfxDispatcher* pDispatcher = mpDocShell->GetViewShell()->GetViewFrame()->GetDispatcher();
    if (!pDispatcher)
@@ -343,11 +327,8 @@ IMPL_LINK(AnnotationContents, MenuItemSelectedHdl, const OString&, rIdent, void)
        pDispatcher->Execute( SID_DELETEALL_POSTIT );
}

IMPL_LINK_NOARG(AnnotationContents, MenuButtonToggledHdl, weld::ToggleButton&, void)
void AnnotationWindow::FillMenuButton()
{
    if (!mxMenuButton->get_active())
        return;

    SvtUserOptions aUserOptions;
    OUString sCurrentAuthor( aUserOptions.GetFullName() );
    OUString sAuthor( mxAnnotation->getAuthor() );
@@ -367,13 +348,19 @@ IMPL_LINK_NOARG(AnnotationContents, MenuButtonToggledHdl, weld::ToggleButton&, v
    mxMenuButton->set_item_visible(".uno:DeleteAllAnnotation", !mbReadonly);
}

void AnnotationContents::StartEdit()
void AnnotationWindow::StartEdit()
{
    GetOutlinerView()->SetSelection(ESelection(EE_PARA_MAX_COUNT,EE_TEXTPOS_MAX_COUNT,EE_PARA_MAX_COUNT,EE_TEXTPOS_MAX_COUNT));
    GetOutlinerView()->ShowCursor();
}

void AnnotationContents::Rescale()
void AnnotationWindow::SetMapMode(const MapMode& rNewMapMode)
{
    OutputDevice& rDevice = mxTextControl->GetDrawingArea()->get_ref_device();
    rDevice.SetMapMode(rNewMapMode);
}

void AnnotationWindow::Rescale()
{
    MapMode aMode(MapUnit::Map100thMM);
    aMode.SetOrigin( Point() );
@@ -391,21 +378,15 @@ void AnnotationContents::Rescale()

void AnnotationWindow::DoResize()
{
    mxContents->SetSizePixel(GetSizePixel());
    mxContents->Show();
    OutputDevice& rDevice = mxTextControl->GetDrawingArea()->get_ref_device();

    mxContents->DoResize();
}

void AnnotationContents::DoResize()
{
    ::tools::Long aHeight = GetSizePixel().Height();
    ::tools::ULong aWidth = GetSizePixel().Width();
    ::tools::Long aHeight = mxContainer->get_preferred_size().Height();
    ::tools::ULong aWidth = mxContainer->get_preferred_size().Width();

    aHeight -= POSTIT_META_HEIGHT;

    mpOutliner->SetPaperSize( PixelToLogic( Size(aWidth, aHeight) ) ) ;
    ::tools::Long aTextHeight = LogicToPixel( mpOutliner->CalcTextSize()).Height();
    mpOutliner->SetPaperSize( rDevice.PixelToLogic( Size(aWidth, aHeight) ) ) ;
    ::tools::Long aTextHeight = rDevice.LogicToPixel(mpOutliner->CalcTextSize()).Height();

    if( aTextHeight > aHeight )
    {
@@ -418,7 +399,7 @@ void AnnotationContents::DoResize()
        mxVScrollbar->set_vpolicy(VclPolicyType::NEVER);
    }

    ::tools::Rectangle aOutputArea = PixelToLogic(::tools::Rectangle(0, 0, aWidth, aHeight));
    ::tools::Rectangle aOutputArea = rDevice.PixelToLogic(::tools::Rectangle(0, 0, aWidth, aHeight));
    if (mxVScrollbar->get_vpolicy() == VclPolicyType::NEVER)
    {
        // if we do not have a scrollbar anymore, we want to see the complete text
@@ -430,8 +411,8 @@ void AnnotationContents::DoResize()
    int nUpper = mpOutliner->GetTextHeight();
    int nCurrentDocPos = mpOutlinerView->GetVisArea().Top();
    int nStepIncrement = mpOutliner->GetTextHeight() / 10;
    int nPageIncrement = PixelToLogic(Size(0,aHeight)).Height() * 8 / 10;
    int nPageSize = PixelToLogic(Size(0,aHeight)).Height();
    int nPageIncrement = rDevice.PixelToLogic(Size(0,aHeight)).Height() * 8 / 10;
    int nPageSize = rDevice.PixelToLogic(Size(0,aHeight)).Height();

    /* limit the page size to below nUpper because gtk's gtk_scrolled_window_start_deceleration has
       effectively...
@@ -447,12 +428,12 @@ void AnnotationContents::DoResize()
                                        nStepIncrement, nPageIncrement, nPageSize);
}

void AnnotationContents::SetScrollbar()
void AnnotationWindow::SetScrollbar()
{
    mxVScrollbar->vadjustment_set_value(mpOutlinerView->GetVisArea().Top());
}

void AnnotationContents::ResizeIfNecessary(::tools::Long aOldHeight, ::tools::Long aNewHeight)
void AnnotationWindow::ResizeIfNecessary(::tools::Long aOldHeight, ::tools::Long aNewHeight)
{
    if (aOldHeight != aNewHeight)
        DoResize();
@@ -460,7 +441,7 @@ void AnnotationContents::ResizeIfNecessary(::tools::Long aOldHeight, ::tools::Lo
        SetScrollbar();
}

void AnnotationContents::SetLanguage(const SvxLanguageItem &aNewItem)
void AnnotationWindow::SetLanguage(const SvxLanguageItem &aNewItem)
{
    mpOutliner->SetModifyHdl( Link<LinkParamNone*,void>() );
    ESelection aOld = GetOutlinerView()->GetSelection();
@@ -473,10 +454,10 @@ void AnnotationContents::SetLanguage(const SvxLanguageItem &aNewItem)

    GetOutlinerView()->SetSelection(aOld);

    Invalidate();
    mxTextControl->Invalidate();
}

void AnnotationContents::ToggleInsMode()
void AnnotationWindow::ToggleInsMode()
{
    if( mpOutlinerView )
    {
@@ -486,12 +467,13 @@ void AnnotationContents::ToggleInsMode()
    }
}

::tools::Long AnnotationContents::GetPostItTextHeight()
::tools::Long AnnotationWindow::GetPostItTextHeight()
{
    return mpOutliner ? LogicToPixel(mpOutliner->CalcTextSize()).Height() : 0;
    OutputDevice& rDevice = mxTextControl->GetDrawingArea()->get_ref_device();
    return mpOutliner ? rDevice.LogicToPixel(mpOutliner->CalcTextSize()).Height() : 0;
}

IMPL_LINK(AnnotationContents, ScrollHdl, weld::ScrolledWindow&, rScrolledWindow, void)
IMPL_LINK(AnnotationWindow, ScrollHdl, weld::ScrolledWindow&, rScrolledWindow, void)
{
    ::tools::Long nDiff = GetOutlinerView()->GetEditView().GetVisArea().Top() - rScrolledWindow.vadjustment_get_value();
    GetOutlinerView()->Scroll( 0, nDiff );
@@ -507,7 +489,7 @@ TextApiObject* getTextApiObject( const Reference< XAnnotation >& xAnnotation )
    return nullptr;
}

void AnnotationContents::setAnnotation( const Reference< XAnnotation >& xAnnotation )
void AnnotationWindow::setAnnotation( const Reference< XAnnotation >& xAnnotation )
{
    if( (xAnnotation == mxAnnotation) || !xAnnotation.is() )
        return;
@@ -531,7 +513,7 @@ void AnnotationContents::setAnnotation( const Reference< XAnnotation >& xAnnotat
    mpOutliner->ClearModifyFlag();
    mpOutliner->GetUndoManager().Clear();

    Invalidate();
//TODO    Invalidate();

    OUString sMeta( xAnnotation->getAuthor() );
    OUString sDateTime( getAnnotationDateTimeString(xAnnotation) );
@@ -546,18 +528,17 @@ void AnnotationContents::setAnnotation( const Reference< XAnnotation >& xAnnotat
    mxMeta->set_label(sMeta);
}

void AnnotationContents::SetColor()
void AnnotationWindow::SetColor()
{
    sal_uInt16 nAuthorIdx = mpDoc->GetAnnotationAuthorIndex( mxAnnotation->getAuthor() );

    const bool bHighContrast = Application::GetSettings().GetStyleSettings().GetHighContrastMode();
    const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
    const bool bHighContrast = rStyleSettings.GetHighContrastMode();
    if( bHighContrast )
    {
        StyleSettings aStyleSettings = GetSettings().GetStyleSettings();

        maColor = aStyleSettings.GetWindowColor();
        maColor = rStyleSettings.GetWindowColor();
        maColorDark = maColor;
        maColorLight = aStyleSettings.GetWindowTextColor();
        maColorLight = rStyleSettings.GetWindowTextColor();
    }
    else
    {
@@ -571,7 +552,7 @@ void AnnotationContents::SetColor()
        mpOutliner->ForceAutoColor( bHighContrast || aOptions.GetIsAutomaticFontColor() );
    }

    m_xContainer->set_background(maColor);
    mxPopover->set_background(maColor);
    mxMenuButton->set_background(maColor);

    mxMeta->set_font_color(bHighContrast ? maColorLight : maColorDark);
@@ -582,13 +563,7 @@ void AnnotationContents::SetColor()
    mxVScrollbar->set_scroll_thickness(GetPrefScrollbarWidth());
}

void AnnotationContents::GetFocus()
{
    if (mxTextControl)
        mxTextControl->GrabFocus();
}

void AnnotationContents::SaveToDocument()
void AnnotationWindow::SaveToDocument()
{
    Reference< XAnnotation > xAnnotation( mxAnnotation );

@@ -819,14 +794,6 @@ bool AnnotationTextWindow::Command(const CommandEvent& rCEvt)
    return WeldEditView::Command(rCEvt);
}

void AnnotationWindow::GetFocus()
{
    if (mxContents)
        mxContents->GrabFocus();
    else
        FloatingWindow::GetFocus();
}

}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/annotations/annotationwindow.hxx b/sd/source/ui/annotations/annotationwindow.hxx
index 0daa64f..fe50234 100644
--- a/sd/source/ui/annotations/annotationwindow.hxx
+++ b/sd/source/ui/annotations/annotationwindow.hxx
@@ -19,8 +19,7 @@

#pragma once

#include <vcl/floatwin.hxx>
#include <vcl/InterimItemWindow.hxx>
#include <vcl/weld.hxx>
#include <tools/long.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <svx/weldeditview.hxx>
@@ -35,19 +34,18 @@ class SdDrawDocument;
namespace sd {

class AnnotationManagerImpl;
class AnnotationWindow;
class DrawDocShell;
class TextApiObject;

class AnnotationContents;
class AnnotationWindow;

class AnnotationTextWindow : public WeldEditView
{
private:
    AnnotationContents& mrContents;
    AnnotationWindow& mrContents;

public:
    AnnotationTextWindow(AnnotationContents& rContents);
    AnnotationTextWindow(AnnotationWindow& rContents);

    virtual EditView* GetEditView() const override;

@@ -62,9 +60,13 @@ public:
    virtual bool Command(const CommandEvent& rCEvt) override;
};

class AnnotationContents final : public InterimItemWindow
class AnnotationWindow final
{
private:
    std::unique_ptr<weld::Builder> mxBuilder;
    std::unique_ptr<weld::Popover> mxPopover;
    std::unique_ptr<weld::Widget> mxContainer;

    DrawDocShell* mpDocShell;
    SdDrawDocument* mpDoc;

@@ -92,19 +94,25 @@ private:

    DECL_LINK(ScrollHdl, weld::ScrolledWindow&, void);
    DECL_LINK(MenuItemSelectedHdl, const OString&, void);
    DECL_LINK(MenuButtonToggledHdl, weld::ToggleButton&, void);

    void FillMenuButton();
    void InitControls();

    void SetMapMode(const MapMode& rNewMapMode);
    void setAnnotation(const css::uno::Reference<css::office::XAnnotation>& xAnnotation);

    static sal_Int32 GetPrefScrollbarWidth() { return 16; }
public:
    AnnotationContents(vcl::Window* pParent, DrawDocShell* pDocShell);
    AnnotationWindow(weld::Window* pParent, const ::tools::Rectangle& rRect, DrawDocShell* pDocShell,
                     const css::uno::Reference<css::office::XAnnotation>& xAnnotation);

    void InitControls();
    void connect_closed(const Link<weld::Popover&, void>& rLink) { mxPopover->connect_closed(rLink); }

    void DoResize();
    void ResizeIfNecessary(::tools::Long aOldHeight, ::tools::Long aNewHeight);
    void SetScrollbar();
    void StartEdit();

    void setAnnotation(const css::uno::Reference<css::office::XAnnotation>& xAnnotation);
    const css::uno::Reference<css::office::XAnnotation>& getAnnotation() const { return mxAnnotation; }

    void SaveToDocument();
@@ -123,31 +131,11 @@ public:

    OutlinerView* GetOutlinerView() { return mpOutlinerView.get();}
    ::Outliner* GetOutliner() { return mpOutliner.get();}
    virtual ~AnnotationContents() override { disposeOnce(); }
    virtual void dispose() override;

    virtual void GetFocus() override;
    ~AnnotationWindow();

    void SetColor();
};

class AnnotationWindow : public FloatingWindow
{
    private:
        VclPtr<AnnotationContents> mxContents;

    public:
        AnnotationWindow( DrawDocShell* pDocShell, vcl::Window* pParent );
        virtual ~AnnotationWindow() override;
        virtual void dispose() override;

        AnnotationContents&  GetContents() const { return *mxContents; }

        void            DoResize();

        virtual void    GetFocus() override;
};

TextApiObject* getTextApiObject( const css::uno::Reference< css::office::XAnnotation >& xAnnotation );


diff --git a/sd/uiconfig/simpress/ui/annotation.ui b/sd/uiconfig/simpress/ui/annotation.ui
index 9daa415..49a8a30 100644
--- a/sd/uiconfig/simpress/ui/annotation.ui
+++ b/sd/uiconfig/simpress/ui/annotation.ui
@@ -4,80 +4,118 @@
  <requires lib="gtk+" version="3.20"/>
  <object class="GtkMenu" id="menu">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
    <property name="can-focus">False</property>
    <child>
      <object class="GtkMenuItem" id=".uno:ReplyToAnnotation">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="can-focus">False</property>
        <property name="label" translatable="yes" context="annotationmenu|reply">_Reply</property>
        <property name="use_underline">True</property>
        <property name="use-underline">True</property>
      </object>
    </child>
    <child>
      <object class="GtkSeparatorMenuItem" id="separator">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="can-focus">False</property>
      </object>
    </child>
    <child>
      <object class="GtkMenuItem" id=".uno:DeleteAnnotation">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="can-focus">False</property>
        <property name="label" translatable="yes" context="annotationmenu|delete">_Delete Comment</property>
        <property name="use_underline">True</property>
        <property name="use-underline">True</property>
      </object>
    </child>
    <child>
      <object class="GtkMenuItem" id=".uno:DeleteAllAnnotationByAuthor">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="can-focus">False</property>
        <property name="label" translatable="yes" context="annotationmenu|deleteby">Delete All Comments b_y %1</property>
        <property name="use_underline">True</property>
        <property name="use-underline">True</property>
      </object>
    </child>
    <child>
      <object class="GtkMenuItem" id=".uno:DeleteAllAnnotation">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="can-focus">False</property>
        <property name="label" translatable="yes" context="annotationmenu|deleteall">Delete _All Comments</property>
        <property name="use_underline">True</property>
        <property name="use-underline">True</property>
      </object>
    </child>
  </object>
  <object class="GtkBox" id="Annotation">
    <property name="visible">True</property>
  <object class="GtkPopover" id="Annotation">
    <property name="can-focus">False</property>
    <property name="events">GDK_BUTTON_MOTION_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_STRUCTURE_MASK</property>
    <property name="hexpand">True</property>
    <property name="vexpand">True</property>
    <property name="orientation">vertical</property>
    <property name="position">bottom</property>
    <child>
      <object class="GtkScrolledWindow" id="scrolledwindow">
      <object class="GtkBox" id="container">
        <property name="visible">True</property>
        <property name="can-focus">True</property>
        <property name="can-focus">False</property>
        <property name="hexpand">True</property>
        <property name="vexpand">True</property>
        <property name="hscrollbar-policy">never</property>
        <property name="orientation">vertical</property>
        <child>
          <object class="GtkViewport">
          <object class="GtkScrolledWindow" id="scrolledwindow">
            <property name="visible">True</property>
            <property name="can-focus">False</property>
            <property name="can-focus">True</property>
            <property name="hexpand">True</property>
            <property name="vexpand">True</property>
            <property name="hscrollbar-policy">never</property>
            <child>
              <object class="GtkViewport">
                <property name="visible">True</property>
                <property name="can-focus">False</property>
                <property name="hexpand">True</property>
                <property name="vexpand">True</property>
                <child>
                  <object class="GtkBox">
                    <property name="visible">True</property>
                    <property name="can-focus">False</property>
                    <property name="hexpand">True</property>
                    <property name="vexpand">True</property>
                    <property name="orientation">vertical</property>
                    <child>
                      <object class="GtkDrawingArea" id="editview">
                        <property name="visible">True</property>
                        <property name="can-focus">True</property>
                        <property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK</property>
                        <property name="hexpand">True</property>
                        <property name="vexpand">True</property>
                      </object>
                      <packing>
                        <property name="expand">False</property>
                        <property name="fill">True</property>
                        <property name="position">0</property>
                      </packing>
                    </child>
                  </object>
                </child>
              </object>
            </child>
          </object>
          <packing>
            <property name="expand">True</property>
            <property name="fill">True</property>
            <property name="position">0</property>
          </packing>
        </child>
        <child>
          <object class="GtkBox">
            <property name="visible">True</property>
            <property name="can-focus">False</property>
            <child>
              <object class="GtkBox">
                <property name="visible">True</property>
                <property name="can-focus">False</property>
                <property name="hexpand">True</property>
                <property name="vexpand">True</property>
                <property name="orientation">vertical</property>
                <child>
                  <object class="GtkDrawingArea" id="editview">
                  <object class="GtkLabel" id="meta">
                    <property name="visible">True</property>
                    <property name="can-focus">True</property>
                    <property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK</property>
                    <property name="hexpand">True</property>
                    <property name="vexpand">True</property>
                    <property name="can-focus">False</property>
                    <property name="label">label</property>
                    <property name="xalign">0</property>
                    <property name="yalign">0</property>
                  </object>
                  <packing>
                    <property name="expand">False</property>
@@ -86,66 +124,38 @@
                  </packing>
                </child>
              </object>
            </child>
          </object>
        </child>
      </object>
      <packing>
        <property name="expand">True</property>
        <property name="fill">True</property>
        <property name="position">0</property>
      </packing>
    </child>
    <child>
      <object class="GtkBox">
        <property name="visible">True</property>
        <property name="can-focus">False</property>
        <child>
          <object class="GtkBox">
            <property name="visible">True</property>
            <property name="can-focus">False</property>
            <property name="hexpand">True</property>
            <property name="orientation">vertical</property>
            <child>
              <object class="GtkLabel" id="meta">
                <property name="visible">True</property>
                <property name="can-focus">False</property>
                <property name="label">label</property>
                <property name="xalign">0</property>
                <property name="yalign">0</property>
              </object>
              <packing>
                <property name="expand">False</property>
                <property name="fill">True</property>
                <property name="position">0</property>
              </packing>
            </child>
          </object>
          <packing>
            <property name="expand">False</property>
            <property name="fill">True</property>
            <property name="position">0</property>
          </packing>
        </child>
        <child>
          <object class="GtkMenuButton" id="menubutton">
            <property name="visible">True</property>
            <property name="can-focus">True</property>
            <property name="focus-on-click">False</property>
            <property name="label" translatable="no"></property>
            <property name="receives-default">True</property>
            <property name="valign">start</property>
            <property name="margin-end">10</property>
            <property name="margin-top">5</property>
            <property name="relief">none</property>
            <property name="draw-indicator">True</property>
            <property name="popup">menu</property>
            <child>
              <placeholder/>
              <object class="GtkMenuButton" id="menubutton">
                <property name="visible">True</property>
                <property name="can-focus">True</property>
                <property name="focus-on-click">False</property>
                <property name="label" translatable="no"></property>
                <property name="receives-default">True</property>
                <property name="valign">start</property>
                <property name="margin-end">10</property>
                <property name="margin-top">5</property>
                <property name="relief">none</property>
                <property name="draw-indicator">True</property>
                <property name="popup">menu</property>
                <child>
                  <placeholder/>
                </child>
                <style>
                  <class name="small-button"/>
                </style>
              </object>
              <packing>
                <property name="expand">False</property>
                <property name="fill">True</property>
                <property name="position">1</property>
              </packing>
            </child>
            <style>
              <class name="small-button"/>
            </style>
          </object>
          <packing>
            <property name="expand">False</property>
@@ -154,11 +164,6 @@
          </packing>
        </child>
      </object>
      <packing>
        <property name="expand">False</property>
        <property name="fill">True</property>
        <property name="position">1</property>
      </packing>
    </child>
  </object>
</interface>