[Libreoffice-commits] core.git: sw/inc sw/source sw/uiconfig sw/UIConfig_swriter.mk

Caolán McNamara caolanm at redhat.com
Fri Oct 11 07:56:10 PDT 2013


 sw/UIConfig_swriter.mk                         |    1 
 sw/inc/helpid.h                                |    1 
 sw/source/ui/app/app.src                       |   33 -----------
 sw/source/ui/inc/app.hrc                       |    8 --
 sw/source/ui/uiview/view2.cxx                  |   56 ++------------------
 sw/uiconfig/swriter/ui/warndatasourcedialog.ui |   69 +++++++++++++++++++++++++
 6 files changed, 76 insertions(+), 92 deletions(-)

New commits:
commit cc6f43275a00b0aff2e60e70ee8032222a2c9610
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 11 15:55:24 2013 +0100

    convert merge source error dialog to .ui
    
    Change-Id: I1f09a4b4377a9a6c21e0e260c856dd9fbff4f1bd

diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk
index 1a03283..64900b1 100644
--- a/sw/UIConfig_swriter.mk
+++ b/sw/UIConfig_swriter.mk
@@ -204,6 +204,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
 	sw/uiconfig/swriter/ui/titlepage \
 	sw/uiconfig/swriter/ui/tokenwidget \
 	sw/uiconfig/swriter/ui/viewoptionspage \
+	sw/uiconfig/swriter/ui/warndatasourcedialog \
 	sw/uiconfig/swriter/ui/wordcount \
 	sw/uiconfig/swriter/ui/wrapdialog \
 	sw/uiconfig/swriter/ui/wrappage \
diff --git a/sw/inc/helpid.h b/sw/inc/helpid.h
index cc4a15e..da7cb7e 100644
--- a/sw/inc/helpid.h
+++ b/sw/inc/helpid.h
@@ -365,7 +365,6 @@
 #define HID_PVIEW_ZOOM_LB                                       "SW_HID_PVIEW_ZOOM_LB"
 #define HID_MAIL_MERGE_SELECT                                   "SW_HID_MAIL_MERGE_SELECT"
 #define HID_PRINT_AS_MERGE                                      "SW_HID_PRINT_AS_MERGE"
-#define HID_MERGE_SOURCE_UNAVAILABLE                            "SW_HID_MERGE_SOURCE_UNAVAILABLE"
 #define HID_MODULE_TOOLBOX                                      "SW_HID_MODULE_TOOLBOX"
 
 #define HID_MM_ADDRESSBLOCKPAGE                                 "SW_HID_MM_ADDRESSBLOCKPAGE"
diff --git a/sw/source/ui/app/app.src b/sw/source/ui/app/app.src
index 5b4000c..a42d2de 100644
--- a/sw/source/ui/app/app.src
+++ b/sw/source/ui/app/app.src
@@ -489,39 +489,6 @@ QueryBox MSG_PRINT_AS_MERGE
     Message [ en-US ] = "Your document contains address database fields. Do you want to print a form letter?";
 };
 
-ModalDialog DLG_MERGE_SOURCE_UNAVAILABLE
-{
-    HelpId = HID_MERGE_SOURCE_UNAVAILABLE;
-    OutputSize = TRUE ;
-    SVLook = TRUE ;
-    Size = MAP_APPFONT ( 202 , 72 ) ;
-    Moveable = TRUE ;
-
-    FixedImage IMG_MERGE
-    {
-        Pos = MAP_APPFONT ( 12 , 14 ) ;
-        Size = MAP_APPFONT ( 103 , 32 ) ;
-    };
-    FixedText ST_MERGE_SOURCE_UNAVAILABLE
-    {
-        Pos = MAP_APPFONT ( 12 , 6 ) ;
-        Size = MAP_APPFONT ( 178 , 40 ) ;
-        WordBreak = TRUE;
-        Text [ en-US ] = "The data source '%1' was not found. Thus the connection to the data source could not be established.\n\nPlease check the connection settings.";
-    };
-    OKButton PB_MERGE_OK
-    {
-        Pos = MAP_APPFONT ( 12 , 52 ) ;
-        Size = MAP_APPFONT ( 125 , 14 ) ;
-        Text [ en-US ] = "Check Connection Settings...";
-    };
-    CancelButton PB_MERGE_CANCEL
-    {
-        Pos = MAP_APPFONT ( 140 , 52 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-    };
-};
-
 String RID_MODULE_TOOLBOX
 {
     Text [ en-US ] = "Function Bar (viewing mode)" ;
diff --git a/sw/source/ui/inc/app.hrc b/sw/source/ui/inc/app.hrc
index 7752ca0..d28ae33 100644
--- a/sw/source/ui/inc/app.hrc
+++ b/sw/source/ui/inc/app.hrc
@@ -45,14 +45,6 @@
 #define STR_CJK_FONT                    (RC_APP_BEGIN + 78)
 #define MSG_PRINT_AS_MERGE              (RC_APP_BEGIN + 80)
 
-#define DLG_MERGE_SOURCE_UNAVAILABLE    (RC_APP_BEGIN + 83)
-
-#define ST_MERGE_SOURCE_UNAVAILABLE     1
-#define PB_MERGE_OK                     2
-#define PB_MERGE_CANCEL                 3
-#define IMG_MERGE                       4
-
-
 #define STR_ENV_TITLE                   (RC_APP_BEGIN + 91)
 #define STR_LAB_TITLE                   (RC_APP_BEGIN + 92)
 
diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx
index 77f8637..eedf54e 100644
--- a/sw/source/ui/uiview/view2.cxx
+++ b/sw/source/ui/uiview/view2.cxx
@@ -2218,52 +2218,6 @@ namespace
     }
 }
 
-class SwMergeSourceWarningBox_Impl : public ModalDialog
-{
-        FixedInfo       aMessageFI;
-        OKButton        aOK;
-        CancelButton    aCancel;
-
-        FixedImage      aWarnImage;
-    public:
-        SwMergeSourceWarningBox_Impl( Window* pParent ) :
-            ModalDialog( pParent, SW_RES( DLG_MERGE_SOURCE_UNAVAILABLE   ) ),
-                    aMessageFI( this, SW_RES( ST_MERGE_SOURCE_UNAVAILABLE ) ),
-                    aOK(        this, SW_RES( PB_MERGE_OK                 ) ),
-                    aCancel(    this, SW_RES( PB_MERGE_CANCEL             ) ),
-                    aWarnImage( this, SW_RES( IMG_MERGE                   ) )
-                    {
-                        FreeResource();
-                        SetText( Application::GetDisplayName() );
-                        const Image& rImg = WarningBox::GetStandardImage();
-                        aWarnImage.SetImage( rImg );
-                        Size aImageSize( rImg.GetSizePixel() );
-                        aImageSize.Width()  += 4;
-                        aImageSize.Height() += 4;
-                        aWarnImage.SetSizePixel( aImageSize );
-
-                        aImageSize.Width() += aWarnImage.GetPosPixel().X();
-                        Size aSz(GetSizePixel());
-                        aSz.Width() += aImageSize.Width();
-                        SetSizePixel(aSz);
-
-                        Point aPos(aMessageFI.GetPosPixel());
-                        aPos.X() += aImageSize.Width();
-                        aMessageFI.SetPosPixel( aPos );
-
-                        aPos = aOK.GetPosPixel();
-                        aPos.X() += aImageSize.Width();
-                        aOK.SetPosPixel( aPos );
-                        aPos = aCancel.GetPosPixel();
-                        aPos.X() += aImageSize.Width();
-                        aCancel.SetPosPixel( aPos );
-
-                    }
-
-        String          GetMessText() const { return aMessageFI.GetText(); }
-        void            SetMessText( const String& rText ) { aMessageFI.SetText( rText ); }
-};
-
 void SwView::GenerateFormLetter(sal_Bool bUseCurrentDocument)
 {
     if(bUseCurrentDocument)
@@ -2326,10 +2280,12 @@ void SwView::GenerateFormLetter(sal_Bool bUseCurrentDocument)
             OUString sSource;
             if(!GetWrtShell().IsFieldDataSourceAvailable(sSource))
             {
-                SwMergeSourceWarningBox_Impl aWarning( &GetViewFrame()->GetWindow());
-                OUString sTmp(aWarning.GetMessText());
-                aWarning.SetMessText(sTmp.replaceFirst("%1", sSource));
-                if(RET_OK == aWarning.Execute())
+                MessageDialog aWarning(&GetViewFrame()->GetWindow(),
+                    "WarnDataSourceDialog",
+                    "modules/swriter/ui/warndatasourcedialog.ui");
+                OUString sTmp(aWarning.get_primary_text());
+                aWarning.set_primary_text(sTmp.replaceFirst("%1", "SOURCE"));
+                if (RET_OK == aWarning.Execute())
                 {
                     SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
                     if ( pFact )
diff --git a/sw/uiconfig/swriter/ui/warndatasourcedialog.ui b/sw/uiconfig/swriter/ui/warndatasourcedialog.ui
new file mode 100644
index 0000000..5e67094
--- /dev/null
+++ b/sw/uiconfig/swriter/ui/warndatasourcedialog.ui
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.6 -->
+  <object class="GtkMessageDialog" id="WarnDataSourceDialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">12</property>
+    <property name="title" translatable="yes">Data source not found</property>
+    <property name="resizable">False</property>
+    <property name="type_hint">dialog</property>
+    <property name="skip_taskbar_hint">True</property>
+    <property name="message_type">warning</property>
+    <property name="text" translatable="yes">The data source '%1' was not found.</property>
+    <property name="secondary_text" translatable="yes">The connection to the data source could not be established. Please check the connection settings.</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>
+            <child>
+              <object class="GtkButton" id="check">
+                <property name="label" translatable="yes">Check Connection Settings...</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="cancel">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+                <property name="image_position">right</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </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>
+    <action-widgets>
+      <action-widget response="1">check</action-widget>
+      <action-widget response="0">cancel</action-widget>
+    </action-widgets>
+  </object>
+</interface>


More information about the Libreoffice-commits mailing list