[Libreoffice-commits] core.git: include/vcl sw/source vcl/inc vcl/source vcl/uiconfig vcl/UIConfig_vcl.mk

Caolán McNamara caolanm at redhat.com
Sat Aug 24 07:12:13 PDT 2013


 include/vcl/layout.hxx                   |    5 ++++
 sw/source/ui/dbui/mmaddressblockpage.cxx |    6 ++---
 sw/source/ui/lingu/olmenu.cxx            |    4 +--
 sw/source/ui/table/tautofmt.cxx          |   12 +++-------
 vcl/UIConfig_vcl.mk                      |    2 +
 vcl/inc/svids.hrc                        |    2 -
 vcl/source/gdi/print3.cxx                |    8 ++++---
 vcl/source/src/print.src                 |   12 ----------
 vcl/source/window/layout.cxx             |   17 +++++++++++++++
 vcl/uiconfig/ui/errornocontentdialog.ui  |   35 +++++++++++++++++++++++++++++++
 vcl/uiconfig/ui/errornoprinterdialog.ui  |   35 +++++++++++++++++++++++++++++++
 11 files changed, 108 insertions(+), 30 deletions(-)

New commits:
commit db4154cc19c803707f34bdd5ce4e8a43eac528a6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Aug 24 14:33:06 2013 +0100

    add gtk_message_dialog_new-alike ctor for MessageDialog
    
    Change-Id: Ie422cd2c903cbd18353b1929c074574d452559ce

diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx
index e5fd0043..adecb94 100644
--- a/include/vcl/layout.hxx
+++ b/include/vcl/layout.hxx
@@ -705,6 +705,11 @@ private:
     short get_response(const Window *pWindow) const;
 public:
 
+    MessageDialog(Window* pParent,
+        const OUString &rMessage,
+        VclMessageType eMessageType = VCL_MESSAGE_ERROR,
+        VclButtonsType eButtonsType = VCL_BUTTONS_OK,
+        WinBits nStyle = WB_MOVEABLE|WB_3DLOOK|WB_CLOSEABLE);
     MessageDialog(Window* pParent, WinBits nStyle);
     MessageDialog(Window* pParent, const OString& rID, const OUString& rUIXMLDescription);
     virtual bool set_property(const OString &rKey, const OString &rValue);
diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx
index 600e069..804d769 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.cxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -21,9 +21,9 @@
 #include <mailmergewizard.hxx>
 #include <swtypes.hxx>
 #include <addresslistdialog.hxx>
-#include <vcl/xtextedt.hxx>
+#include <vcl/layout.hxx>
 #include <vcl/txtattr.hxx>
-#include <vcl/msgbox.hxx>
+#include <vcl/xtextedt.hxx>
 #include <mmconfigitem.hxx>
 #include <com/sun/star/container/XNameAccess.hpp>
 #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
@@ -185,7 +185,7 @@ IMPL_LINK_NOARG(SwMailMergeAddressBlockPage, AddressListHdl_Impl)
     catch (const uno::Exception& e)
     {
         OSL_FAIL(OUStringToOString(e.Message, osl_getThreadTextEncoding()).getStr());
-        ErrorBox(this, WB_OK, e.Message).Execute();
+        MessageDialog(this, e.Message).Execute();
     }
     return 0;
 }
diff --git a/sw/source/ui/lingu/olmenu.cxx b/sw/source/ui/lingu/olmenu.cxx
index 1909479..ee4bece 100644
--- a/sw/source/ui/lingu/olmenu.cxx
+++ b/sw/source/ui/lingu/olmenu.cxx
@@ -70,7 +70,7 @@
 #include <svx/dlgutil.hxx>
 #include <unotools/lingucfg.hxx>
 #include <unotools/linguprops.hxx>
-#include <vcl/msgbox.hxx>
+#include <vcl/layout.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/svapp.hxx>
 #include <sal/macros.h>
@@ -794,7 +794,7 @@ void SwSpellPopup::Execute( sal_uInt16 nId )
             uno::Any exc( ::cppu::getCaughtException() );
             OUString msg( ::comphelper::anyToString( exc ) );
             const SolarMutexGuard guard;
-            ErrorBox aErrorBox( NULL, WB_OK, msg );
+            MessageDialog aErrorBox(NULL, msg);
             aErrorBox.SetText( "Explanations" );
             aErrorBox.Execute();
         }
diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx
index 20b4589..de31736 100644
--- a/sw/source/ui/table/tautofmt.cxx
+++ b/sw/source/ui/table/tautofmt.cxx
@@ -333,10 +333,8 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, AddHdl)
 
             if( !bFmtInserted )
             {
-                bOk = RET_CANCEL == ErrorBox( this,
-                                    WinBits( WB_OK_CANCEL | WB_DEF_OK),
-                                    aStrInvalidFmt
-                                    ).Execute();
+                bOk = RET_CANCEL == MessageDialog(this, aStrInvalidFmt, VCL_MESSAGE_ERROR, VCL_BUTTONS_OK_CANCEL)
+                                    .Execute();
             }
         }
         else
@@ -437,10 +435,8 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RenameHdl)
 
             if( !bFmtRenamed )
             {
-                bOk = RET_CANCEL == ErrorBox( this,
-                                    WinBits( WB_OK_CANCEL | WB_DEF_OK),
-                                    aStrInvalidFmt
-                                    ).Execute();
+                bOk = RET_CANCEL == MessageDialog(this, aStrInvalidFmt, VCL_MESSAGE_ERROR, VCL_BUTTONS_OK_CANCEL)
+                                    .Execute();
             }
         }
         else
diff --git a/vcl/UIConfig_vcl.mk b/vcl/UIConfig_vcl.mk
index ff6db5b..d3e901e 100644
--- a/vcl/UIConfig_vcl.mk
+++ b/vcl/UIConfig_vcl.mk
@@ -11,6 +11,8 @@ $(eval $(call gb_UIConfig_UIConfig,vcl))
 
 $(eval $(call gb_UIConfig_add_uifiles,vcl,\
 	vcl/uiconfig/ui/printdialog \
+	vcl/uiconfig/ui/errornocontentdialog \
+	vcl/uiconfig/ui/errornoprinterdialog \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/vcl/inc/svids.hrc b/vcl/inc/svids.hrc
index 3e831e5..0a59f80 100644
--- a/vcl/inc/svids.hrc
+++ b/vcl/inc/svids.hrc
@@ -122,8 +122,6 @@
 #define SV_PRINT_PROGRESS_TEXT              2
 
 #define SV_PRINT_NATIVE_STRINGS           2050
-#define SV_PRINT_NOPRINTERWARNING         2051
-#define SV_PRINT_NOCONTENT                2052
 
 #define SV_HELPTEXT_CLOSE                   10000
 #define SV_HELPTEXT_MINIMIZE                10001
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index 366caa80..f08bb25 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -17,10 +17,10 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include "vcl/layout.hxx"
 #include "vcl/print.hxx"
 #include "vcl/svapp.hxx"
 #include "vcl/metaact.hxx"
-#include "vcl/msgbox.hxx"
 #include "vcl/configsettings.hxx"
 #include "vcl/unohelp.hxx"
 
@@ -312,7 +312,8 @@ void Printer::ImplPrintJob( const boost::shared_ptr<PrinterController>& i_pContr
              // && ! pController->isDirectPrint()
            )
         {
-            ErrorBox aBox( NULL, VclResId( SV_PRINT_NOPRINTERWARNING ) );
+            MessageDialog aBox(NULL, "ErrorNoPrinterDialog",
+                "vcl/ui/errornoprinterdialog.ui");
             aBox.Execute();
         }
         pController->setValue( OUString( "IsDirect" ),
@@ -460,7 +461,8 @@ void Printer::ImplPrintJob( const boost::shared_ptr<PrinterController>& i_pContr
     {
         if( pController->getFilteredPageCount() == 0 )
         {
-            ErrorBox aBox( NULL, VclResId( SV_PRINT_NOCONTENT ) );
+            MessageDialog aBox(NULL, "ErrorNoContentDialog",
+                "vcl/ui/errornocontentdialog.ui");
             aBox.Execute();
             return;
         }
diff --git a/vcl/source/src/print.src b/vcl/source/src/print.src
index 89b5715..0d2f9c1 100644
--- a/vcl/source/src/print.src
+++ b/vcl/source/src/print.src
@@ -44,18 +44,6 @@ ModelessDialog SV_DLG_PRINT_PROGRESS
     };
 };
 
-ErrorBox SV_PRINT_NOPRINTERWARNING
-{
-    Title = "%PRODUCTNAME";
-    Message [en-US] = "No default printer found.\nPlease choose a printer and try again.";
-};
-
-ErrorBox SV_PRINT_NOCONTENT
-{
-    Title = "%PRODUCTNAME";
-    Message [en-US] = "There are no pages to be printed. Please check your document for ranges relevant to printing.";
-};
-
 StringArray SV_PRINT_NATIVE_STRINGS
 {
     ItemList [en-US] =
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index 622862e..898cd11 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -1768,6 +1768,23 @@ MessageDialog::MessageDialog(Window* pParent, WinBits nStyle)
     SetType(WINDOW_MESSBOX);
 }
 
+MessageDialog::MessageDialog(Window* pParent,
+    const OUString &rMessage,
+    VclMessageType eMessageType,
+    VclButtonsType eButtonsType,
+    WinBits nStyle)
+    : Dialog(pParent, nStyle)
+    , m_eButtonsType(eButtonsType)
+    , m_eMessageType(eMessageType)
+    , m_pGrid(NULL)
+    , m_pImage(NULL)
+    , m_pPrimaryMessage(NULL)
+    , m_pSecondaryMessage(NULL)
+    , m_sPrimaryString(rMessage)
+{
+    SetType(WINDOW_MESSBOX);
+}
+
 MessageDialog::MessageDialog(Window* pParent, const OString& rID, const OUString& rUIXMLDescription)
     : Dialog(pParent, rID, rUIXMLDescription, WINDOW_MESSBOX)
     , m_eButtonsType(VCL_BUTTONS_NONE)
diff --git a/vcl/uiconfig/ui/errornocontentdialog.ui b/vcl/uiconfig/ui/errornocontentdialog.ui
new file mode 100644
index 0000000..25f5d8e
--- /dev/null
+++ b/vcl/uiconfig/ui/errornocontentdialog.ui
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkMessageDialog" id="ErrorNoContentDialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">12</property>
+    <property name="title" translatable="yes">%PRODUCTNAME</property>
+    <property name="resizable">False</property>
+    <property name="type_hint">dialog</property>
+    <property name="skip_taskbar_hint">True</property>
+    <property name="message_type">error</property>
+    <property name="buttons">ok</property>
+    <property name="text" translatable="yes">There are no pages to be printed.</property>
+    <property name="secondary_text" translatable="yes">Please check your document for ranges relevant to printing.</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="messagedialog-vbox">
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">24</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="messagedialog-action_area">
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/vcl/uiconfig/ui/errornoprinterdialog.ui b/vcl/uiconfig/ui/errornoprinterdialog.ui
new file mode 100644
index 0000000..afba5c0
--- /dev/null
+++ b/vcl/uiconfig/ui/errornoprinterdialog.ui
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkMessageDialog" id="ErrorNoPrinterDialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">12</property>
+    <property name="title" translatable="yes">%PRODUCTNAME</property>
+    <property name="resizable">False</property>
+    <property name="type_hint">dialog</property>
+    <property name="skip_taskbar_hint">True</property>
+    <property name="message_type">error</property>
+    <property name="buttons">ok</property>
+    <property name="text" translatable="yes">No default printer found.</property>
+    <property name="secondary_text" translatable="yes">Please choose a printer and try again.</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="messagedialog-vbox">
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">24</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="messagedialog-action_area">
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>


More information about the Libreoffice-commits mailing list