summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-02-19 16:33:35 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-02-22 22:07:38 +0100
commit6a4c464b49dbfa2801818ead1b50bc9580824d00 (patch)
tree3d6381b6b13576bc536670992b36784436486e95 /include
parentf7733528e88a6619f82b54b59e92a9bca72c0a89 (diff)
weld native message dialogs
just the straight-forward MessageDialog cases first a) remove border_width from message dialog .ui so as to take the default border width b) retain 12 as default message dialog border for vcl widget case c) remove layour_style from message dialog button boxes so as to take the default mode (a no-op for vcl widget case) d) use gtk response ids (vcl builder will converts to vcl ones) Change-Id: I7de281093a1b64f92f71ca11e7cbba42bb658154 Reviewed-on: https://gerrit.libreoffice.org/50143 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/avmedia/mediawindow.hxx3
-rw-r--r--include/dbaccess/genericcontroller.hxx2
-rw-r--r--include/sfx2/QuerySaveDocument.hxx4
-rw-r--r--include/sfx2/newstyle.hxx3
-rw-r--r--include/svtools/fileview.hxx16
-rw-r--r--include/svx/graphichelper.hxx3
-rw-r--r--include/svx/hdft.hxx27
-rw-r--r--include/svx/linkwarn.hxx15
-rw-r--r--include/vcl/edit.hxx5
-rw-r--r--include/vcl/fixedhyper.hxx2
-rw-r--r--include/vcl/layout.hxx44
-rw-r--r--include/vcl/messagedialog.hxx63
-rw-r--r--include/vcl/stdtext.hxx4
-rw-r--r--include/vcl/weld.hxx3
14 files changed, 117 insertions, 77 deletions
diff --git a/include/avmedia/mediawindow.hxx b/include/avmedia/mediawindow.hxx
index a285e26474fc..2b93d411e194 100644
--- a/include/avmedia/mediawindow.hxx
+++ b/include/avmedia/mediawindow.hxx
@@ -34,6 +34,7 @@
#define AVMEDIA_FRAMEGRABBER_DEFAULTFRAME -1.0
namespace vcl { class Window; }
+namespace weld { class Widget; }
class KeyEvent;
class MouseEvent;
class CommandEvent;
@@ -99,7 +100,7 @@ namespace avmedia
/// @param o_pbLink if not 0, this is an "insert" dialog: display link
/// checkbox and store its state in *o_pbLink
static bool executeMediaURLDialog(const vcl::Window* pParent, OUString& rURL, bool *const o_pbLink);
- static void executeFormatErrorBox( vcl::Window* pParent );
+ static void executeFormatErrorBox(weld::Widget* pParent);
static bool isMediaURL( const OUString& rURL, const OUString& rReferer, bool bDeep = false, Size* pPreferredSizePixel = nullptr );
static css::uno::Reference< css::media::XPlayer > createPlayer( const OUString& rURL, const OUString& rReferer, const OUString* pMimeType = nullptr );
diff --git a/include/dbaccess/genericcontroller.hxx b/include/dbaccess/genericcontroller.hxx
index 52fc8bcbd994..4f97727acc9b 100644
--- a/include/dbaccess/genericcontroller.hxx
+++ b/include/dbaccess/genericcontroller.hxx
@@ -90,6 +90,7 @@ namespace com { namespace sun { namespace star {
} } }
namespace vcl { class Window; }
+namespace weld { class Window; }
class NotifyEvent;
namespace dbaui
@@ -415,6 +416,7 @@ namespace dbaui
public:
const css::uno::Reference< css::uno::XComponentContext >& getORB() const { return m_xContext; }
ODataView* getView() const { return m_pView; }
+ weld::Window* getFrameWeld() const;
void setView( const VclPtr<ODataView>& i_rView );
void clearView();
// shows a error box if the SQLExceptionInfo is valid
diff --git a/include/sfx2/QuerySaveDocument.hxx b/include/sfx2/QuerySaveDocument.hxx
index 09922feb60ba..00aecfeaea99 100644
--- a/include/sfx2/QuerySaveDocument.hxx
+++ b/include/sfx2/QuerySaveDocument.hxx
@@ -22,7 +22,7 @@
#include <rtl/ustring.hxx>
#include <sfx2/dllapi.h>
-namespace vcl { class Window; }
+namespace weld { class Widget; }
/** Opens the general query save document dialog.
@param _pParent
@@ -31,7 +31,7 @@ namespace vcl { class Window; }
The title of the document.
*/
SFX2_DLLPUBLIC short ExecuteQuerySaveDocument(
- vcl::Window* _pParent, const OUString& _rTitle);
+ weld::Widget* _pParent, const OUString& _rTitle);
#endif // INCLUDED_SFX2_QUERYSAVEDOCUMENT_HXX
diff --git a/include/sfx2/newstyle.hxx b/include/sfx2/newstyle.hxx
index bbafa704f76b..dceeeec2e7ec 100644
--- a/include/sfx2/newstyle.hxx
+++ b/include/sfx2/newstyle.hxx
@@ -27,6 +27,7 @@
#include <vcl/combobox.hxx>
#include <vcl/dialog.hxx>
#include <vcl/fixed.hxx>
+#include <vcl/weld.hxx>
class SfxStyleSheetBasePool;
@@ -36,7 +37,7 @@ private:
VclPtr<ComboBox> m_pColBox;
VclPtr<OKButton> m_pOKBtn;
- VclPtr<MessageDialog> aQueryOverwriteBox;
+ std::unique_ptr<weld::MessageDialog> xQueryOverwriteBox;
SfxStyleSheetBasePool& rPool;
DECL_DLLPRIVATE_LINK( OKHdl, ComboBox&, void );
diff --git a/include/svtools/fileview.hxx b/include/svtools/fileview.hxx
index 617dd1853612..21a5098e89bf 100644
--- a/include/svtools/fileview.hxx
+++ b/include/svtools/fileview.hxx
@@ -28,7 +28,7 @@
#include <vcl/fixed.hxx>
#include <vcl/dialog.hxx>
#include <vcl/button.hxx>
-#include <vcl/layout.hxx>
+#include <vcl/weld.hxx>
#include <rtl/ustring.hxx>
// class SvtFileView -----------------------------------------------------
@@ -209,17 +209,19 @@ enum QueryDeleteResult_Impl
QUERYDELETE_ALL = 101
};
-class SVT_DLLPUBLIC QueryDeleteDlg_Impl : public MessageDialog
+class SVT_DLLPUBLIC QueryDeleteDlg_Impl
{
private:
- VclPtr<PushButton> m_pAllButton;
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::MessageDialog> m_xDialog;
+ std::unique_ptr<weld::Button> m_xAllButton;
public:
- QueryDeleteDlg_Impl(vcl::Window* pParent, const OUString& rName);
- virtual ~QueryDeleteDlg_Impl() override;
- virtual void dispose() override;
+ QueryDeleteDlg_Impl(weld::Widget* pParent, const OUString& rName);
+ short run() { return m_xDialog->run(); }
+ ~QueryDeleteDlg_Impl();
- void EnableAllButton() { m_pAllButton->Enable(); }
+ void EnableAllButton() { m_xAllButton->set_sensitive(true); }
};
}
diff --git a/include/svx/graphichelper.hxx b/include/svx/graphichelper.hxx
index 72f13e70f56c..2a833aa9f9c5 100644
--- a/include/svx/graphichelper.hxx
+++ b/include/svx/graphichelper.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_SVX_GRAPHICHELPER_HXX
#include <vcl/graph.hxx>
+#include <vcl/weld.hxx>
#include <svx/svxdllapi.h>
#include <com/sun/star/drawing/XShape.hpp>
@@ -32,7 +33,7 @@ public:
static void GetPreferredExtension( OUString& rExtension, const Graphic& rGraphic );
static OUString ExportGraphic(const vcl::Window* pWin, const Graphic& rGraphic, const OUString& rGraphicName);
static void SaveShapeAsGraphic(const vcl::Window* pWin, const css::uno::Reference< css::drawing::XShape >& xShape);
- static short HasToSaveTransformedImage(vcl::Window* pWin);
+ static short HasToSaveTransformedImage(weld::Widget* pWin);
};
diff --git a/include/svx/hdft.hxx b/include/svx/hdft.hxx
index 3531cafb3046..e9bd472446c4 100644
--- a/include/svx/hdft.hxx
+++ b/include/svx/hdft.hxx
@@ -24,7 +24,8 @@
#include <vcl/fixed.hxx>
#include <vcl/field.hxx>
#include <vcl/group.hxx>
-#include <vcl/layout.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/weld.hxx>
#include <svx/pagectrl.hxx>
#include <svx/svxdllapi.h>
@@ -120,24 +121,32 @@ public:
SVX_DLLPRIVATE SvxFooterPage( vcl::Window* pParent, const SfxItemSet& rSet );
};
-class SVX_DLLPUBLIC DeleteHeaderDialog : public MessageDialog
+class SVX_DLLPUBLIC DeleteHeaderDialog
{
+private:
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::MessageDialog> m_xDialog;
public:
- DeleteHeaderDialog(vcl::Window *pParent)
- : MessageDialog(pParent, "DeleteHeaderDialog",
- "svx/ui/deleteheaderdialog.ui")
+ DeleteHeaderDialog(weld::Widget* pParent)
+ : m_xBuilder(Application::CreateBuilder(pParent, "svx/ui/deleteheaderdialog.ui"))
+ , m_xDialog(m_xBuilder->weld_message_dialog("DeleteHeaderDialog"))
{
}
+ short run() { return m_xDialog->run(); }
};
-class SVX_DLLPUBLIC DeleteFooterDialog : public MessageDialog
+class SVX_DLLPUBLIC DeleteFooterDialog
{
+private:
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::MessageDialog> m_xDialog;
public:
- DeleteFooterDialog(vcl::Window *pParent)
- : MessageDialog(pParent, "DeleteFooterDialog",
- "svx/ui/deletefooterdialog.ui")
+ DeleteFooterDialog(weld::Widget* pParent)
+ : m_xBuilder(Application::CreateBuilder(pParent, "svx/ui/deletefooterdialog.ui"))
+ , m_xDialog(m_xBuilder->weld_message_dialog("DeleteFooterDialog"))
{
}
+ short run() { return m_xDialog->run(); }
};
#endif
diff --git a/include/svx/linkwarn.hxx b/include/svx/linkwarn.hxx
index 07ea3b892c3c..96143fd0a68d 100644
--- a/include/svx/linkwarn.hxx
+++ b/include/svx/linkwarn.hxx
@@ -20,19 +20,20 @@
#ifndef INCLUDED_SVX_LINKWARN_HXX
#define INCLUDED_SVX_LINKWARN_HXX
-#include <vcl/button.hxx>
-#include <vcl/layout.hxx>
+#include <vcl/weld.hxx>
#include <svx/svxdllapi.h>
-class SVX_DLLPUBLIC SvxLinkWarningDialog : public MessageDialog
+class SVX_DLLPUBLIC SvxLinkWarningDialog
{
private:
- VclPtr<CheckBox> m_pWarningOnBox;
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::MessageDialog> m_xDialog;
+ std::unique_ptr<weld::CheckButton> m_xWarningOnBox;
public:
- SvxLinkWarningDialog(vcl::Window* pParent, const OUString& _rFileName);
- virtual ~SvxLinkWarningDialog() override;
- virtual void dispose() override;
+ SvxLinkWarningDialog(weld::Widget* pParent, const OUString& _rFileName);
+ short run() { return m_xDialog->run(); }
+ ~SvxLinkWarningDialog();
};
#endif // INCLUDED_SVX_LINKWARN_HXX
diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx
index 9588da8b6fe6..d4a9b418c7ab 100644
--- a/include/vcl/edit.hxx
+++ b/include/vcl/edit.hxx
@@ -39,6 +39,9 @@ namespace i18n {
class XBreakIterator;
class XExtendedInputSequenceChecker;
}}}}
+namespace weld {
+ class Widget;
+}
class VclBuilder;
struct DDInfo;
@@ -249,7 +252,7 @@ public:
sal_Int32 GetCharPos( const Point& rWindowPos ) const;
// shows a warning box saying "text too long, truncated"
- static void ShowTruncationWarning( vcl::Window* pParent );
+ static void ShowTruncationWarning(weld::Widget* pParent);
static void SetGetSpecialCharsFunction( FncGetSpecialChars fn );
static FncGetSpecialChars GetGetSpecialCharsFunction();
diff --git a/include/vcl/fixedhyper.hxx b/include/vcl/fixedhyper.hxx
index c0ecc88db1e4..414ef1661c72 100644
--- a/include/vcl/fixedhyper.hxx
+++ b/include/vcl/fixedhyper.hxx
@@ -40,7 +40,7 @@ class VCL_DLLPUBLIC FixedHyperlink : public FixedText
/** is position X position hitting text */
SAL_DLLPRIVATE bool ImplIsOverText(Point rPosition);
- DECL_STATIC_LINK(FixedHyperlink, HandleClick, FixedHyperlink&, void);
+ DECL_LINK(HandleClick, FixedHyperlink&, void);
protected:
/** overwrites Window::MouseMove().
diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx
index ca60679d346c..f20bc18cac8a 100644
--- a/include/vcl/layout.hxx
+++ b/include/vcl/layout.hxx
@@ -610,50 +610,6 @@ public:
void set_property(const OString &rKey, const OUString &rValue);
};
-class VCL_DLLPUBLIC MessageDialog : public Dialog
-{
-private:
- VclButtonsType m_eButtonsType;
- VclMessageType m_eMessageType;
- VclPtr<VclBox> m_pOwnedContentArea;
- VclPtr<VclButtonBox> m_pOwnedActionArea;
- VclPtr<VclGrid> m_pGrid;
- VclPtr<FixedImage> m_pImage;
- VclPtr<VclMultiLineEdit> m_pPrimaryMessage;
- VclPtr<VclMultiLineEdit> m_pSecondaryMessage;
- std::vector<VclPtr<PushButton> > m_aOwnedButtons;
- std::map< VclPtr<const vcl::Window>, short> m_aResponses;
- OUString m_sPrimaryString;
- OUString m_sSecondaryString;
- DECL_DLLPRIVATE_LINK(ButtonHdl, Button *, void);
- void setButtonHandlers(VclButtonBox const *pButtonBox);
- short get_response(const vcl::Window *pWindow) const;
- void create_owned_areas();
-
- friend class VclPtr<MessageDialog>;
- MessageDialog(vcl::Window* pParent, WinBits nStyle);
-public:
-
- MessageDialog(vcl::Window* pParent,
- const OUString &rMessage,
- VclMessageType eMessageType = VclMessageType::Error,
- VclButtonsType eButtonsType = VclButtonsType::Ok);
- MessageDialog(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription);
- virtual bool set_property(const OString &rKey, const OUString &rValue) override;
- virtual short Execute() override;
- ///Emitted when an action widget is clicked
- virtual void response(short nResponseId);
- OUString const & get_primary_text() const;
- OUString const & get_secondary_text() const;
- void set_primary_text(const OUString &rPrimaryString);
- void set_secondary_text(const OUString &rSecondaryString);
- virtual ~MessageDialog() override;
- virtual void dispose() override;
-
- static void SetMessagesWidths(vcl::Window const *pParent, VclMultiLineEdit *pPrimaryMessage,
- VclMultiLineEdit *pSecondaryMessage);
-};
-
class VCL_DLLPUBLIC VclDrawingArea : public vcl::Window
{
private:
diff --git a/include/vcl/messagedialog.hxx b/include/vcl/messagedialog.hxx
new file mode 100644
index 000000000000..6de75a9fb9a6
--- /dev/null
+++ b/include/vcl/messagedialog.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_INC_MESSAGEDIALOG_HXX
+#define INCLUDED_VCL_INC_MESSAGEDIALOG_HXX
+
+#include <vcl/dllapi.h>
+
+#include <vcl/dialog.hxx>
+#include <vcl/layout.hxx>
+
+class VCL_DLLPUBLIC MessageDialog : public Dialog
+{
+private:
+ VclButtonsType m_eButtonsType;
+ VclMessageType m_eMessageType;
+ VclPtr<VclBox> m_pOwnedContentArea;
+ VclPtr<VclButtonBox> m_pOwnedActionArea;
+ VclPtr<VclGrid> m_pGrid;
+ VclPtr<FixedImage> m_pImage;
+ VclPtr<VclMultiLineEdit> m_pPrimaryMessage;
+ VclPtr<VclMultiLineEdit> m_pSecondaryMessage;
+ std::vector<VclPtr<PushButton>> m_aOwnedButtons;
+ std::map<VclPtr<const vcl::Window>, short> m_aResponses;
+ OUString m_sPrimaryString;
+ OUString m_sSecondaryString;
+ DECL_DLLPRIVATE_LINK(ButtonHdl, Button*, void);
+ void setButtonHandlers(VclButtonBox const* pButtonBox);
+ short get_response(const vcl::Window* pWindow) const;
+ void create_owned_areas();
+
+ friend class VclPtr<MessageDialog>;
+ MessageDialog(vcl::Window* pParent, WinBits nStyle);
+
+public:
+ MessageDialog(vcl::Window* pParent, const OUString& rMessage,
+ VclMessageType eMessageType = VclMessageType::Error,
+ VclButtonsType eButtonsType = VclButtonsType::Ok);
+ MessageDialog(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription);
+ virtual bool set_property(const OString& rKey, const OUString& rValue) override;
+ virtual short Execute() override;
+ ///Emitted when an action widget is clicked
+ virtual void response(short nResponseId);
+ OUString const& get_primary_text() const;
+ OUString const& get_secondary_text() const;
+ void set_primary_text(const OUString& rPrimaryString);
+ void set_secondary_text(const OUString& rSecondaryString);
+ virtual ~MessageDialog() override;
+ virtual void dispose() override;
+
+ static void SetMessagesWidths(vcl::Window const* pParent, VclMultiLineEdit* pPrimaryMessage,
+ VclMultiLineEdit* pSecondaryMessage);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/stdtext.hxx b/include/vcl/stdtext.hxx
index 260e85d973fb..196725d4e278 100644
--- a/include/vcl/stdtext.hxx
+++ b/include/vcl/stdtext.hxx
@@ -23,9 +23,9 @@
#include <rtl/ustring.hxx>
#include <vcl/dllapi.h>
-namespace vcl { class Window; }
+namespace weld { class Widget; }
-void VCL_DLLPUBLIC ShowServiceNotAvailableError(vcl::Window* pParent, const OUString& rServiceName, bool bError);
+void VCL_DLLPUBLIC ShowServiceNotAvailableError(weld::Widget* pParent, const OUString& rServiceName, bool bError);
#endif // INCLUDED_VCL_STDTEXT_HXX
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index e7cd5e7a4c79..bfc6a7e10214 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -39,7 +39,8 @@ public:
}
virtual void set_size_request(int nWidth, int nHeight) = 0;
virtual Size get_preferred_size() const = 0;
- virtual float approximate_char_width() const = 0;
+ virtual float get_approximate_char_width() const = 0;
+ virtual int get_text_height() const = 0;
virtual Size get_pixel_size(const OUString& rText) const = 0;
virtual OString get_buildable_name() const = 0;
virtual OString get_help_id() const = 0;