summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-10-07 13:36:56 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-10-07 20:24:04 +0200
commitd46456b07df11bf774c3a7dcbcd843bb97efbe38 (patch)
treedf5be0a3ea649a44aa2e28a4e7d6a2870343380e
parent76681af6d846f9b285b4034826722766e47415e2 (diff)
weld ScreenshotAnnotationDlg
Change-Id: I94e42c1d10922170f53af917bba6848c9f006a11 Reviewed-on: https://gerrit.libreoffice.org/80383 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--cui/source/dialogs/screenshotannotationdlg.cxx299
-rw-r--r--cui/source/factory/dlgfact.cxx10
-rw-r--r--cui/source/factory/dlgfact.hxx13
-rw-r--r--cui/source/inc/screenshotannotationdlg.hxx5
-rw-r--r--cui/uiconfig/ui/screenshotannotationdialog.ui14
-rw-r--r--include/vcl/abstdlg.hxx3
-rw-r--r--vcl/source/window/layout.cxx2
7 files changed, 180 insertions, 166 deletions
diff --git a/cui/source/dialogs/screenshotannotationdlg.cxx b/cui/source/dialogs/screenshotannotationdlg.cxx
index fb1f41d29525..f9ed955f2afa 100644
--- a/cui/source/dialogs/screenshotannotationdlg.cxx
+++ b/cui/source/dialogs/screenshotannotationdlg.cxx
@@ -29,17 +29,16 @@
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include <comphelper/random.hxx>
-#include <vcl/pngwrite.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <tools/stream.hxx>
#include <tools/urlobj.hxx>
+#include <vcl/customweld.hxx>
#include <vcl/event.hxx>
-#include <vcl/fixed.hxx>
+#include <vcl/pngwrite.hxx>
#include <vcl/svapp.hxx>
#include <vcl/salgtype.hxx>
#include <vcl/virdev.hxx>
-#include <vcl/vclmedit.hxx>
-#include <vcl/button.hxx>
+#include <vcl/weld.hxx>
#include <svtools/optionsdrawinglayer.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <set>
@@ -128,20 +127,39 @@ private:
typedef std::vector< ControlDataEntry > ControlDataCollection;
+class Picture : public weld::CustomWidgetController
+{
+private:
+ ScreenshotAnnotationDlg_Impl *m_pDialog;
+ bool m_bMouseOver;
+private:
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override;
+ virtual bool MouseMove(const MouseEvent& rMouseEvent) override;
+ virtual bool MouseButtonUp(const MouseEvent& rMouseEvent) override;
+public:
+ Picture(ScreenshotAnnotationDlg_Impl* pDialog)
+ : m_pDialog(pDialog)
+ , m_bMouseOver(false)
+ {
+ }
+
+ bool IsMouseOver() const
+ {
+ return m_bMouseOver;
+ }
+};
+
class ScreenshotAnnotationDlg_Impl
{
public:
ScreenshotAnnotationDlg_Impl(
- ScreenshotAnnotationDlg& rParent,
+ weld::Builder& rParent,
Dialog& rParentDialog);
~ScreenshotAnnotationDlg_Impl();
private:
// Handler for click on save
- DECL_LINK(saveButtonHandler, Button*, void);
-
- // Handler for clicks on picture frame
- DECL_LINK(pictureFrameListener, VclWindowEvent&, void);
+ DECL_LINK(saveButtonHandler, weld::Button&, void);
// helper methods
void CollectChildren(
@@ -167,7 +185,7 @@ private:
Size maParentDialogSize;
// VirtualDevice for buffered interaction paints
- VclPtr<VirtualDevice> mpVirtualBufferDevice;
+ VclPtr<VirtualDevice> mxVirtualBufferDevice;
// all detected children
ControlDataCollection maAllChildren;
@@ -178,9 +196,10 @@ private:
maSelected;
// list of detected controls
- VclPtr<FixedImage> mpPicture;
- VclPtr<VclMultiLineEdit> mpText;
- VclPtr<PushButton> mpSave;
+ Picture maPicture;
+ std::unique_ptr<weld::CustomWeld> mxPicture;
+ std::unique_ptr<weld::TextView> mxText;
+ std::unique_ptr<weld::Button> mxSave;
// save as text
OUString maSaveAsText;
@@ -188,24 +207,26 @@ private:
// folder URL
static OUString maLastFolderURL;
+public:
+ void Paint(vcl::RenderContext& rRenderContext);
+ bool MouseMove(const MouseEvent& rMouseEvent);
+ bool MouseButtonUp();
};
OUString ScreenshotAnnotationDlg_Impl::maLastFolderURL = OUString();
ScreenshotAnnotationDlg_Impl::ScreenshotAnnotationDlg_Impl(
- ScreenshotAnnotationDlg& rParent,
+ weld::Builder& rParent,
Dialog& rParentDialog)
: mrParentDialog(rParentDialog),
maParentDialogBitmap(rParentDialog.createScreenshot()),
maDimmedDialogBitmap(maParentDialogBitmap),
maParentDialogSize(maParentDialogBitmap.GetSizePixel()),
- mpVirtualBufferDevice(nullptr),
+ mxVirtualBufferDevice(nullptr),
maAllChildren(),
mpHilighted(nullptr),
maSelected(),
- mpPicture(nullptr),
- mpText(nullptr),
- mpSave(nullptr),
+ maPicture(this),
maSaveAsText(CuiResId(RID_SVXSTR_SAVE_SCREENSHOT_AS))
{
// image ain't empty
@@ -214,15 +235,15 @@ ScreenshotAnnotationDlg_Impl::ScreenshotAnnotationDlg_Impl(
assert(0 != maParentDialogBitmap.GetSizePixel().Height());
// get needed widgets
- rParent.get(mpPicture, "picture");
- assert(mpPicture.get());
- rParent.get(mpText, "text");
- assert(mpText.get());
- rParent.get(mpSave, "save");
- assert(mpSave.get());
+ mxPicture.reset(new weld::CustomWeld(rParent, "picture", maPicture));
+ assert(mxPicture.get());
+ mxText = rParent.weld_text_view("text");
+ assert(mxText.get());
+ mxSave = rParent.weld_button("save");
+ assert(mxSave.get());
// set screenshot image at FixedImage, resize, set event listener
- if (mpPicture)
+ if (mxPicture)
{
// collect all children. Choose start pos to be negative
// of target dialog's position to get all positions relative to (0,0)
@@ -239,44 +260,37 @@ ScreenshotAnnotationDlg_Impl::ScreenshotAnnotationDlg_Impl(
maDimmedDialogBitmap.Adjust(-15, 0, 0, 0, 0);
// init paint buffering VirtualDevice
- mpVirtualBufferDevice = VclPtr<VirtualDevice>::Create(*Application::GetDefaultDevice(), DeviceFormat::DEFAULT, DeviceFormat::BITMASK);
- mpVirtualBufferDevice->SetOutputSizePixel(maParentDialogSize);
- mpVirtualBufferDevice->SetFillColor(COL_TRANSPARENT);
+ mxVirtualBufferDevice = VclPtr<VirtualDevice>::Create(*Application::GetDefaultDevice(), DeviceFormat::DEFAULT, DeviceFormat::BITMASK);
+ mxVirtualBufferDevice->SetOutputSizePixel(maParentDialogSize);
+ mxVirtualBufferDevice->SetFillColor(COL_TRANSPARENT);
// initially set image for picture control
- mpPicture->SetImage(Image(maDimmedDialogBitmap));
+ mxVirtualBufferDevice->DrawBitmapEx(Point(0, 0), maDimmedDialogBitmap);
// set size for picture control, this will re-layout so that
// the picture control shows the whole dialog
- mpPicture->set_width_request(maParentDialogSize.Width());
- mpPicture->set_height_request(maParentDialogSize.Height());
-
- // add local event listener to allow interactions with mouse
- mpPicture->AddEventListener(LINK(this, ScreenshotAnnotationDlg_Impl, pictureFrameListener));
+ maPicture.SetOutputSizePixel(maParentDialogSize);
+ mxPicture->set_size_request(maParentDialogSize.Width(), maParentDialogSize.Height());
- // avoid image scaling, this is needed for images smaller than the
- // minimal dialog size
- const WinBits aWinBits(mpPicture->GetStyle());
- mpPicture->SetStyle(aWinBits & ~WB_SCALE);
+ mxPicture->queue_draw();
}
// set some test text at VclMultiLineEdit and make read-only - only
// copying content to clipboard is allowed
- if (mpText)
+ if (mxText)
{
- mpText->set_width_request(400);
- mpText->set_height_request( mpText->GetTextHeight() * 10 );
+ mxText->set_size_request(400, mxText->get_height_rows(10));
OUString aHelpId = OStringToOUString( mrParentDialog.GetHelpId(), RTL_TEXTENCODING_UTF8 );
Size aSizeCm = mrParentDialog.PixelToLogic(maParentDialogSize, MapMode(MapUnit::MapCM));
maMainMarkupText = lcl_ParagraphWithImage( aHelpId, aSizeCm );
- mpText->SetText( maMainMarkupText );
- mpText->SetReadOnly();
+ mxText->set_text( maMainMarkupText );
+ mxText->set_editable(false);
}
// set click handler for save button
- if (mpSave)
+ if (mxSave)
{
- mpSave->SetClickHdl(LINK(this, ScreenshotAnnotationDlg_Impl, saveButtonHandler));
+ mxSave->connect_clicked(LINK(this, ScreenshotAnnotationDlg_Impl, saveButtonHandler));
}
}
@@ -311,10 +325,10 @@ void ScreenshotAnnotationDlg_Impl::CollectChildren(
ScreenshotAnnotationDlg_Impl::~ScreenshotAnnotationDlg_Impl()
{
- mpVirtualBufferDevice.disposeAndClear();
+ mxVirtualBufferDevice.disposeAndClear();
}
-IMPL_LINK_NOARG(ScreenshotAnnotationDlg_Impl, saveButtonHandler, Button*, void)
+IMPL_LINK_NOARG(ScreenshotAnnotationDlg_Impl, saveButtonHandler, weld::Button&, void)
{
// 'save screenshot...' pressed, offer to save maParentDialogBitmap
// as PNG image, use *.id file name as screenshot file name offering
@@ -388,9 +402,9 @@ IMPL_LINK_NOARG(ScreenshotAnnotationDlg_Impl, saveButtonHandler, Button*, void)
// extract Bitmap
const BitmapEx aTargetBitmap(
- mpVirtualBufferDevice->GetBitmapEx(
+ mxVirtualBufferDevice->GetBitmapEx(
Point(0, 0),
- mpVirtualBufferDevice->GetOutputSizePixel()));
+ mxVirtualBufferDevice->GetOutputSizePixel()));
// write as PNG
vcl::PNGWriter aPNGWriter(aTargetBitmap);
@@ -433,7 +447,7 @@ void ScreenshotAnnotationDlg_Impl::PaintControlDataEntry(
double fLineWidth,
double fTransparency)
{
- if (mpPicture && mpVirtualBufferDevice)
+ if (mxPicture && mxVirtualBufferDevice)
{
basegfx::B2DRange aB2DRange(rEntry.getB2IRange());
@@ -453,10 +467,10 @@ void ScreenshotAnnotationDlg_Impl::PaintControlDataEntry(
fEdgeRoundPixel / aB2DRange.getWidth(),
fEdgeRoundPixel / aB2DRange.getHeight()));
- mpVirtualBufferDevice->SetLineColor(rColor);
+ mxVirtualBufferDevice->SetLineColor(rColor);
// try to use transparency
- if (!mpVirtualBufferDevice->DrawPolyLineDirect(
+ if (!mxVirtualBufferDevice->DrawPolyLineDirect(
basegfx::B2DHomMatrix(),
aPolygon,
fLineWidth,
@@ -464,7 +478,7 @@ void ScreenshotAnnotationDlg_Impl::PaintControlDataEntry(
basegfx::B2DLineJoin::Round))
{
// no transparency, draw without
- mpVirtualBufferDevice->DrawPolyLine(
+ mxVirtualBufferDevice->DrawPolyLine(
aPolygon,
fLineWidth);
}
@@ -473,12 +487,7 @@ void ScreenshotAnnotationDlg_Impl::PaintControlDataEntry(
Point ScreenshotAnnotationDlg_Impl::GetOffsetInPicture() const
{
- if (!mpPicture)
- {
- return Point(0, 0);
- }
-
- const Size aPixelSizeTarget(mpPicture->GetOutputSizePixel());
+ const Size aPixelSizeTarget(maPicture.GetOutputSizePixel());
return Point(
aPixelSizeTarget.Width() > maParentDialogSize.Width() ? (aPixelSizeTarget.Width() - maParentDialogSize.Width()) >> 1 : 0,
@@ -489,10 +498,10 @@ void ScreenshotAnnotationDlg_Impl::RepaintToBuffer(
bool bUseDimmed,
bool bPaintHilight)
{
- if (mpVirtualBufferDevice)
+ if (mxVirtualBufferDevice)
{
// reset with original screenshot bitmap
- mpVirtualBufferDevice->DrawBitmapEx(
+ mxVirtualBufferDevice->DrawBitmapEx(
Point(0, 0),
bUseDimmed ? maDimmedDialogBitmap : maParentDialogBitmap);
@@ -501,11 +510,11 @@ void ScreenshotAnnotationDlg_Impl::RepaintToBuffer(
const Color aHilightColor(aSvtOptionsDrawinglayer.getHilightColor());
const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01);
const bool bIsAntiAliasing(aSvtOptionsDrawinglayer.IsAntiAliasing());
- const AntialiasingFlags nOldAA(mpVirtualBufferDevice->GetAntialiasing());
+ const AntialiasingFlags nOldAA(mxVirtualBufferDevice->GetAntialiasing());
if (bIsAntiAliasing)
{
- mpVirtualBufferDevice->SetAntialiasing(AntialiasingFlags::EnableB2dDraw);
+ mxVirtualBufferDevice->SetAntialiasing(AntialiasingFlags::EnableB2dDraw);
}
// paint selected entries
@@ -524,129 +533,119 @@ void ScreenshotAnnotationDlg_Impl::RepaintToBuffer(
if (bIsAntiAliasing)
{
- mpVirtualBufferDevice->SetAntialiasing(nOldAA);
+ mxVirtualBufferDevice->SetAntialiasing(nOldAA);
}
}
}
void ScreenshotAnnotationDlg_Impl::RepaintPictureElement()
{
- if (mpPicture && mpVirtualBufferDevice)
+ if (mxPicture && mxVirtualBufferDevice)
{
// reset image in buffer, use dimmed version and allow highlight
RepaintToBuffer(true, true);
+ mxPicture->queue_draw();
+ }
+}
- // copy new content to picture control (hard paint)
- mpPicture->DrawOutDev(
- GetOffsetInPicture(),
- maParentDialogSize,
- Point(0, 0),
- maParentDialogSize,
- *mpVirtualBufferDevice);
+void ScreenshotAnnotationDlg_Impl::Paint(vcl::RenderContext& rRenderContext)
+{
+ Point aPos(GetOffsetInPicture());
+ Size aSize(mxVirtualBufferDevice->GetOutputSizePixel());
+ rRenderContext.DrawOutDev(aPos, aSize, Point(), aSize, *mxVirtualBufferDevice);
+}
- // also set image to get repaints right, but trigger no repaint
- mpPicture->SetImage(
- Image(
- mpVirtualBufferDevice->GetBitmapEx(
- Point(0, 0),
- mpVirtualBufferDevice->GetOutputSizePixel())));
- mpPicture->Validate();
- }
+void Picture::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
+{
+ m_pDialog->Paint(rRenderContext);
}
-IMPL_LINK(ScreenshotAnnotationDlg_Impl, pictureFrameListener, VclWindowEvent&, rEvent, void)
+bool ScreenshotAnnotationDlg_Impl::MouseMove(const MouseEvent& rMouseEvent)
{
- // event in picture frame
bool bRepaint(false);
- switch (rEvent.GetId())
- {
- case VclEventId::WindowMouseMove:
- case VclEventId::WindowMouseButtonUp:
+ if (maPicture.IsMouseOver())
{
- MouseEvent* pMouseEvent = static_cast< MouseEvent* >(rEvent.GetData());
-
- if (pMouseEvent)
+ const ControlDataEntry* pOldHit = mpHilighted;
+ const Point aOffset(GetOffsetInPicture());
+ const basegfx::B2IPoint aMousePos(
+ rMouseEvent.GetPosPixel().X() - aOffset.X(),
+ rMouseEvent.GetPosPixel().Y() - aOffset.Y());
+ const ControlDataEntry* pHit = CheckHit(aMousePos);
+
+ if (pHit && pOldHit != pHit)
{
- switch (rEvent.GetId())
- {
- case VclEventId::WindowMouseMove:
- {
- if (mpPicture->IsMouseOver())
- {
- const ControlDataEntry* pOldHit = mpHilighted;
- const Point aOffset(GetOffsetInPicture());
- const basegfx::B2IPoint aMousePos(
- pMouseEvent->GetPosPixel().X() - aOffset.X(),
- pMouseEvent->GetPosPixel().Y() - aOffset.Y());
- const ControlDataEntry* pHit = CheckHit(aMousePos);
-
- if (pHit && pOldHit != pHit)
- {
- mpHilighted = const_cast< ControlDataEntry* >(pHit);
- bRepaint = true;
- }
- }
- else if (mpHilighted)
- {
- mpHilighted = nullptr;
- bRepaint = true;
- }
- break;
- }
- case VclEventId::WindowMouseButtonUp:
- {
- if (mpPicture->IsMouseOver() && mpHilighted)
- {
- if (maSelected.erase(mpHilighted) == 0)
- {
- maSelected.insert(mpHilighted);
- }
-
- OUStringBuffer aBookmarks(maMainMarkupText);
- for (auto&& rCandidate : maSelected)
- {
- OUString aHelpId = OStringToOUString( rCandidate->GetHelpId(), RTL_TEXTENCODING_UTF8 );
- aBookmarks.append(lcl_Bookmark( aHelpId ));
- }
-
- mpText->SetText( aBookmarks.makeStringAndClear() );
- bRepaint = true;
- }
- break;
- }
- default:
- {
- break;
- }
- }
+ mpHilighted = const_cast<ControlDataEntry*>(pHit);
+ bRepaint = true;
}
- break;
}
- default:
+ else if (mpHilighted)
{
- break;
+ mpHilighted = nullptr;
+ bRepaint = true;
}
+
+ if (bRepaint)
+ {
+ RepaintPictureElement();
+ }
+
+ return true;
+}
+
+bool Picture::MouseMove(const MouseEvent& rMouseEvent)
+{
+ if (rMouseEvent.IsEnterWindow())
+ m_bMouseOver = true;
+ if (rMouseEvent.IsLeaveWindow())
+ m_bMouseOver = false;
+ return m_pDialog->MouseMove(rMouseEvent);
+}
+
+bool ScreenshotAnnotationDlg_Impl::MouseButtonUp()
+{
+ // event in picture frame
+ bool bRepaint(false);
+
+ if (maPicture.IsMouseOver() && mpHilighted)
+ {
+ if (maSelected.erase(mpHilighted) == 0)
+ {
+ maSelected.insert(mpHilighted);
+ }
+
+ OUStringBuffer aBookmarks(maMainMarkupText);
+ for (auto&& rCandidate : maSelected)
+ {
+ OUString aHelpId = OStringToOUString( rCandidate->GetHelpId(), RTL_TEXTENCODING_UTF8 );
+ aBookmarks.append(lcl_Bookmark( aHelpId ));
+ }
+
+ mxText->set_text( aBookmarks.makeStringAndClear() );
+ bRepaint = true;
}
if (bRepaint)
{
RepaintPictureElement();
}
+
+ return true;
}
-ScreenshotAnnotationDlg::ScreenshotAnnotationDlg(
- vcl::Window* pParent,
- Dialog& rParentDialog)
-: ModalDialog(pParent, "ScreenshotAnnotationDialog", "cui/ui/screenshotannotationdialog.ui")
+bool Picture::MouseButtonUp(const MouseEvent&)
{
- m_pImpl.reset(new ScreenshotAnnotationDlg_Impl(*this, rParentDialog));
+ return m_pDialog->MouseButtonUp();
}
+ScreenshotAnnotationDlg::ScreenshotAnnotationDlg(weld::Window* pParent, Dialog& rParentDialog)
+ : GenericDialogController(pParent, "cui/ui/screenshotannotationdialog.ui", "ScreenshotAnnotationDialog")
+{
+ m_pImpl.reset(new ScreenshotAnnotationDlg_Impl(*m_xBuilder, rParentDialog));
+}
ScreenshotAnnotationDlg::~ScreenshotAnnotationDlg()
{
- disposeOnce();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index 7608d9f8cd3e..0a81690478ca 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -324,7 +324,10 @@ short AbstractQrCodeGenDialog_Impl::Execute()
return m_xDlg->run();
}
-IMPL_ABSTDLG_BASE(AbstractScreenshotAnnotationDlg_Impl);
+short AbstractScreenshotAnnotationDlg_Impl::Execute()
+{
+ return m_xDlg->run();
+}
short CuiAbstractTabController_Impl::Execute()
{
@@ -1606,11 +1609,10 @@ VclPtr<AbstractPasswordToOpenModifyDialog> AbstractDialogFactory_Impl::CreatePas
}
VclPtr<AbstractScreenshotAnnotationDlg> AbstractDialogFactory_Impl::CreateScreenshotAnnotationDlg(
- vcl::Window * pParent,
+ weld::Window* pParent,
Dialog& rParentDialog)
{
- VclPtrInstance<ScreenshotAnnotationDlg> pDlg(pParent, rParentDialog);
- return VclPtr<AbstractScreenshotAnnotationDlg_Impl>::Create(pDlg);
+ return VclPtr<AbstractScreenshotAnnotationDlg_Impl>::Create(std::make_unique<ScreenshotAnnotationDlg>(pParent, rParentDialog));
}
VclPtr<AbstractSignatureLineDialog> AbstractDialogFactory_Impl::CreateSignatureLineDialog(
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index dab0e9ae43d0..b3ada6ca80e9 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -679,7 +679,14 @@ public:
class ScreenshotAnnotationDlg;
class AbstractScreenshotAnnotationDlg_Impl : public AbstractScreenshotAnnotationDlg
{
- DECL_ABSTDLG_BASE(AbstractScreenshotAnnotationDlg_Impl, ScreenshotAnnotationDlg)
+ std::unique_ptr<ScreenshotAnnotationDlg> m_xDlg;
+
+public:
+ explicit AbstractScreenshotAnnotationDlg_Impl(std::unique_ptr<ScreenshotAnnotationDlg> p)
+ : m_xDlg(std::move(p))
+ {
+ }
+ virtual short Execute() override;
};
class SignatureLineDialog;
@@ -921,9 +928,9 @@ public:
virtual VclPtr<SvxAbstractInsRowColDlg> CreateSvxInsRowColDlg(weld::Window* pParent, bool bCol, const OString& rHelpId) override;
- virtual VclPtr<AbstractPasswordToOpenModifyDialog> CreatePasswordToOpenModifyDialog(weld::Window * pParent, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify) override;
+ virtual VclPtr<AbstractPasswordToOpenModifyDialog> CreatePasswordToOpenModifyDialog(weld::Window* pParent, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify) override;
- virtual VclPtr<AbstractScreenshotAnnotationDlg> CreateScreenshotAnnotationDlg(vcl::Window * pParent, Dialog& rParentDialog) override;
+ virtual VclPtr<AbstractScreenshotAnnotationDlg> CreateScreenshotAnnotationDlg(weld::Window* pParent, Dialog& rParentDialog) override;
virtual VclPtr<AbstractSignatureLineDialog>
CreateSignatureLineDialog(weld::Window* pParent,
diff --git a/cui/source/inc/screenshotannotationdlg.hxx b/cui/source/inc/screenshotannotationdlg.hxx
index ac9e0edc564f..53df8d4f7ea5 100644
--- a/cui/source/inc/screenshotannotationdlg.hxx
+++ b/cui/source/inc/screenshotannotationdlg.hxx
@@ -20,11 +20,12 @@
#define INCLUDED_CUI_SOURCE_INC_SCREENSHANNDLG_HXX
#include <vcl/dialog.hxx>
+#include <vcl/weld.hxx>
#include <memory>
class ScreenshotAnnotationDlg_Impl;
-class ScreenshotAnnotationDlg : public ModalDialog
+class ScreenshotAnnotationDlg : public weld::GenericDialogController
{
private:
std::unique_ptr< ScreenshotAnnotationDlg_Impl > m_pImpl;
@@ -34,7 +35,7 @@ private:
public:
ScreenshotAnnotationDlg(
- vcl::Window* pParent,
+ weld::Window* pParent,
Dialog& rParentDialog);
virtual ~ScreenshotAnnotationDlg() override;
};
diff --git a/cui/uiconfig/ui/screenshotannotationdialog.ui b/cui/uiconfig/ui/screenshotannotationdialog.ui
index b20a8edbf943..e7e3e78fa3d0 100644
--- a/cui/uiconfig/ui/screenshotannotationdialog.ui
+++ b/cui/uiconfig/ui/screenshotannotationdialog.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="cui">
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="ScreenshotAnnotationDialog">
@@ -10,6 +10,9 @@
<property name="default_width">600</property>
<property name="default_height">460</property>
<property name="type_hint">normal</property>
+ <child>
+ <placeholder/>
+ </child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
@@ -73,11 +76,10 @@
</packing>
</child>
<child>
- <object class="GtkImage" id="picture">
+ <object class="GtkDrawingArea" id="picture">
<property name="name">image</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="stock">gtk-missing-image</property>
</object>
<packing>
<property name="expand">True</property>
@@ -107,7 +109,7 @@
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
<child>
- <object class="GtkTextView" id="text:border">
+ <object class="GtkTextView" id="text">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
@@ -123,5 +125,9 @@
</child>
</object>
</child>
+ <action-widgets>
+ <action-widget response="-6">cancel</action-widget>
+ <action-widget response="101">save</action-widget>
+ </action-widgets>
</object>
</interface>
diff --git a/include/vcl/abstdlg.hxx b/include/vcl/abstdlg.hxx
index 864799204ae8..d9a5058c7e42 100644
--- a/include/vcl/abstdlg.hxx
+++ b/include/vcl/abstdlg.hxx
@@ -172,8 +172,7 @@ public:
// creates instance of ScreenshotAnnotationDlg from cui
virtual VclPtr<AbstractScreenshotAnnotationDlg> CreateScreenshotAnnotationDlg(
- vcl::Window* pParent,
- Dialog& rParentDialog) = 0;
+ weld::Window* pParent, Dialog& rParentDialog) = 0;
// create info dialog to show tip-of-the-day
virtual VclPtr<AbstractTipOfTheDayDialog>
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index b7a2d8464df9..6863a8ea4b66 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -314,7 +314,7 @@ void VclContainer::Command(const CommandEvent& rCEvt)
// open screenshot annotation dialog
VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create();
VclPtr<AbstractScreenshotAnnotationDlg> pTmp = pFact->CreateScreenshotAnnotationDlg(
- Application::GetDefDialogParent(),
+ pParentDialog->GetFrameWeld(),
*pParentDialog);
ScopedVclPtr<AbstractScreenshotAnnotationDlg> pDialog(pTmp);