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

Caolán McNamara caolanm at redhat.com
Tue Jun 4 08:14:48 PDT 2013


 include/vcl/vclmedit.hxx                   |    2 +
 sw/UIConfig_swriter.mk                     |    1 
 sw/source/ui/app/app.src                   |    6 -----
 sw/source/ui/app/docsh2.cxx                |    4 ++-
 sw/source/ui/inc/app.hrc                   |    1 
 sw/uiconfig/swriter/ui/saveashtmldialog.ui |   34 +++++++++++++++++++++++++++++
 vcl/source/edit/vclmedit.cxx               |   12 ++++++++++
 vcl/source/window/layout.cxx               |    2 +
 8 files changed, 54 insertions(+), 8 deletions(-)

New commits:
commit 4097ce73b66bce586bef0c0f41bc59559c52be0f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jun 4 11:52:03 2013 +0100

    convert some more queryboxes to new style MessageBox
    
    Change-Id: I1775d1e169919a7bfb157faba5e18695568f7f78

diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk
index daf19a7..618394b 100644
--- a/sw/UIConfig_swriter.mk
+++ b/sw/UIConfig_swriter.mk
@@ -106,6 +106,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
 	sw/uiconfig/swriter/ui/renameautotextdialog \
 	sw/uiconfig/swriter/ui/renameobjectdialog \
 	sw/uiconfig/swriter/ui/rowheight \
+	sw/uiconfig/swriter/ui/saveashtmldialog \
 	sw/uiconfig/swriter/ui/sortdialog \
 	sw/uiconfig/swriter/ui/splittable \
 	sw/uiconfig/swriter/ui/statisticsinfopage \
diff --git a/sw/source/ui/app/app.src b/sw/source/ui/app/app.src
index 134da77..fdde472 100644
--- a/sw/source/ui/app/app.src
+++ b/sw/source/ui/app/app.src
@@ -451,12 +451,6 @@ QueryBox MSG_SAVE_HTML_QUERY
     DEFBUTTON = WB_DEF_YES ;
     Message [ en-US ] = "Conversion into HTML format \nmay cause information loss. \nDo you want to save the document?" ;
 };
-QueryBox MSG_SAVEAS_HTML_QUERY
-{
-    BUTTONS = WB_YES_NO;
-    DEFBUTTON = WB_DEF_NO ;
-    Message [ en-US ] = "The source code can only be displayed if the document is saved in HTML format.\nWould you like to save the document as HTML?";
-};
 
 String STR_ABSTRACT_TITLE
 {
diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx
index 6ccf91d..07b85bd 100644
--- a/sw/source/ui/app/docsh2.cxx
+++ b/sw/source/ui/app/docsh2.cxx
@@ -872,7 +872,9 @@ void SwDocShell::Execute(SfxRequest& rReq)
                         const SfxFilter* pFlt = GetMedium()->GetFilter();
                         if(!pFlt || pFlt->GetUserData() != pHtmlFlt->GetUserData())
                         {
-                            QueryBox aQuery(&pViewFrm->GetWindow(), SW_RES(MSG_SAVEAS_HTML_QUERY));
+                            MessageDialog aQuery(&pViewFrm->GetWindow(),
+                                "SaveAsHTMLDialog", "modules/swriter/ui/saveashtmldialog.ui");
+
                             if(RET_YES == aQuery.Execute())
                                 bLocalHasName = sal_False;
                             else
diff --git a/sw/source/ui/inc/app.hrc b/sw/source/ui/inc/app.hrc
index d9295e5..a12e3b5 100644
--- a/sw/source/ui/inc/app.hrc
+++ b/sw/source/ui/inc/app.hrc
@@ -34,7 +34,6 @@
 
 // For the interface because the RID_APP_BEGIN is now Desktop.
 #define RID_SW_NAME                     ( RC_APP_BEGIN + 8)
-#define MSG_SAVEAS_HTML_QUERY           ( RC_APP_BEGIN + 9)
 
 
 #define STR_UNBENANNT                   (RC_APP_BEGIN + 13)
diff --git a/sw/uiconfig/swriter/ui/saveashtmldialog.ui b/sw/uiconfig/swriter/ui/saveashtmldialog.ui
new file mode 100644
index 0000000..cd8f0d0
--- /dev/null
+++ b/sw/uiconfig/swriter/ui/saveashtmldialog.ui
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkMessageDialog" id="SaveAsHTMLDialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">12</property>
+    <property name="title" translatable="yes">Save as HTML</property>
+    <property name="type_hint">dialog</property>
+    <property name="skip_taskbar_hint">True</property>
+    <property name="message_type">question</property>
+    <property name="buttons">yes-no</property>
+    <property name="text" translatable="yes">Would you like to save the document as HTML?</property>
+    <property name="secondary_text" translatable="yes">The source code can only be displayed if the document is saved in HTML format.</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>
commit 19a2685ec04bd6ce882d4dd08d24c7248cf99a84
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jun 4 16:13:06 2013 +0100

    clip message box dialogs to some reasonable widths
    
    Change-Id: I7fc179865306ba5b593b090b1fdb8971ba6bd508

diff --git a/include/vcl/vclmedit.hxx b/include/vcl/vclmedit.hxx
index 5b64bbb..a9ba116 100644
--- a/include/vcl/vclmedit.hxx
+++ b/include/vcl/vclmedit.hxx
@@ -81,6 +81,8 @@ public:
     virtual void    SetMaxTextLen( xub_StrLen nMaxLen = 0 );
     virtual xub_StrLen GetMaxTextLen() const;
 
+    void            SetMaxTextWidth( sal_uLong nMaxWidth );
+
     virtual void    SetSelection( const Selection& rSelection );
     virtual const Selection& GetSelection() const;
 
diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx
index 9a2b03c..d1717d5 100644
--- a/vcl/source/edit/vclmedit.cxx
+++ b/vcl/source/edit/vclmedit.cxx
@@ -115,6 +115,8 @@ public:
     void        SetMaxTextLen( xub_StrLen nLen );
     xub_StrLen  GetMaxTextLen() const;
 
+    void        SetMaxTextWidth( sal_uLong nMaxWidth );
+
     sal_Bool        IsInsertMode() const;
 
     void        InsertText( const String& rStr );
@@ -400,6 +402,11 @@ String ImpVclMEdit::GetSelected( LineEnd aSeparator ) const
     return mpTextWindow->GetTextView()->GetSelected( aSeparator );
 }
 
+void ImpVclMEdit::SetMaxTextWidth( sal_uLong nMaxWidth )
+{
+    mpTextWindow->GetTextEngine()->SetMaxTextWidth( nMaxWidth );
+}
+
 void ImpVclMEdit::Resize()
 {
     size_t nIteration = 1;
@@ -1113,6 +1120,11 @@ void VclMultiLineEdit::SetMaxTextLen( xub_StrLen nMaxLen )
     pImpVclMEdit->SetMaxTextLen( nMaxLen );
 }
 
+void VclMultiLineEdit::SetMaxTextWidth( sal_uLong nMaxWidth )
+{
+    pImpVclMEdit->SetMaxTextWidth(nMaxWidth );
+}
+
 xub_StrLen VclMultiLineEdit::GetMaxTextLen() const
 {
     return pImpVclMEdit->GetMaxTextLen();
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index dfd1098..78d7e82 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -1803,6 +1803,7 @@ short MessageDialog::Execute()
         m_pPrimaryMessage->set_hexpand(true);
         m_pPrimaryMessage->SetText(m_sPrimaryString);
         m_pPrimaryMessage->Show(!m_sPrimaryString.isEmpty());
+        m_pPrimaryMessage->SetMaxTextWidth(m_pPrimaryMessage->approximate_char_width() * 60);
 
         m_pSecondaryMessage = new VclMultiLineEdit(m_pGrid, nWinStyle);
         m_pSecondaryMessage->SetPaintTransparent(true);
@@ -1812,6 +1813,7 @@ short MessageDialog::Execute()
         m_pSecondaryMessage->set_hexpand(true);
         m_pSecondaryMessage->SetText(m_sSecondaryString);
         m_pSecondaryMessage->Show(!m_sSecondaryString.isEmpty());
+        m_pSecondaryMessage->SetMaxTextWidth(m_pPrimaryMessage->approximate_char_width() * 80);
 
         VclButtonBox *pButtonBox = get_action_area();
         assert(pButtonBox);


More information about the Libreoffice-commits mailing list