[Libreoffice-commits] core.git: dbaccess/source dbaccess/uiconfig dbaccess/UIConfig_dbaccess.mk extras/source svtools/source

Csikós Tamás csks.tomi at gmail.com
Tue Jul 30 06:49:01 PDT 2013


 dbaccess/UIConfig_dbaccess.mk                  |    1 
 dbaccess/source/ui/dlg/directsql.cxx           |   66 ++---
 dbaccess/source/ui/inc/directsql.hxx           |   18 -
 dbaccess/uiconfig/ui/directsqldialog.ui        |  277 +++++++++++++++++++++++++
 extras/source/glade/libreoffice-catalog.xml.in |    6 
 svtools/source/edit/editsyntaxhighlighter.cxx  |    6 
 svtools/source/edit/svmedit.cxx                |    6 
 7 files changed, 330 insertions(+), 50 deletions(-)

New commits:
commit 471e5c1ed19afde8a92a91bfc1ccc71a2506cc01
Author: Csikós Tamás <csks.tomi at gmail.com>
Date:   Mon Jul 29 19:54:43 2013 +0200

    modern .ui widgetlayout for directsql
    
    Change-Id: I51140fe6abd2d321c5784b923f920ab9183f417e
    Reviewed-on: https://gerrit.libreoffice.org/5171
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/dbaccess/UIConfig_dbaccess.mk b/dbaccess/UIConfig_dbaccess.mk
index eb97972..cace6a8 100644
--- a/dbaccess/UIConfig_dbaccess.mk
+++ b/dbaccess/UIConfig_dbaccess.mk
@@ -10,6 +10,7 @@
 $(eval $(call gb_UIConfig_UIConfig,dbaccess))
 
 $(eval $(call gb_UIConfig_add_uifiles,dbaccess, \
+    dbaccess/uiconfig/ui/directsqldialog  \
     dbaccess/uiconfig/ui/querypropertiesdialog  \
     dbaccess/uiconfig/ui/generalpagedialog \
     dbaccess/uiconfig/ui/generalpagewizard \
diff --git a/dbaccess/source/ui/dlg/directsql.cxx b/dbaccess/source/ui/dlg/directsql.cxx
index bb73d8a..87b9173 100644
--- a/dbaccess/source/ui/dlg/directsql.cxx
+++ b/dbaccess/source/ui/dlg/directsql.cxx
@@ -73,33 +73,25 @@ namespace dbaui
 DBG_NAME(DirectSQLDialog)
 //--------------------------------------------------------------------
     DirectSQLDialog::DirectSQLDialog( Window* _pParent, const Reference< XConnection >& _rxConn )
-        :ModalDialog(_pParent, ModuleRes(DLG_DIRECTSQL))
-        ,m_aFrame               (this, ModuleRes(FL_SQL))
-        ,m_aSQLLabel            (this, ModuleRes(FT_SQL))
-        ,m_aSQL                 (this, ModuleRes(ME_SQL))
-        ,m_aExecute             (this, ModuleRes(PB_EXECUTE))
-        ,m_aHistoryLabel        (this, ModuleRes(FT_HISTORY))
-        ,m_pSQLHistory(new LargeEntryListBox(this, ModuleRes(LB_HISTORY)))
-        ,m_aStatusFrame         (this, ModuleRes(FL_STATUS))
-        ,m_aStatus              (this, ModuleRes(ME_STATUS))
-        ,m_pShowOutput(new CheckBox(this, ModuleRes(CB_SHOWOUTPUT)))
-        ,m_aOutputFrame         (this, ModuleRes(FL_OUTPUT))
-        ,m_aOutput              (this, ModuleRes(ME_OUTPUT))
-        ,m_aButtonSeparator     (this, ModuleRes(FL_BUTTONS))
-        ,m_aHelp                (this, ModuleRes(PB_HELP))
-        ,m_aClose               (this, ModuleRes(PB_CLOSE))
+        :ModalDialog(_pParent, "DirectSQLDialog" , "dbaccess/ui/directsqldialog.ui")
         ,m_nHistoryLimit(20)
         ,m_nStatusCount(1)
         ,m_xConnection(_rxConn)
     {
-        DBG_CTOR(DirectSQLDialog,NULL);
+        get(m_pSQL,"sql");
+        get(m_pExecute,"execute");
+        get(m_pSQLHistory,"sqlhistory");
+        get(m_pStatus,"status");
+        get(m_pShowOutput,"showoutput");
+        get(m_pOutput,"output");
+        get(m_pClose,"close");
 
-        FreeResource();
+        DBG_CTOR(DirectSQLDialog,NULL);
 
-        m_aSQL.GrabFocus();
+        m_pSQL->GrabFocus();
 
-        m_aExecute.SetClickHdl(LINK(this, DirectSQLDialog, OnExecute));
-        m_aClose.SetClickHdl(LINK(this, DirectSQLDialog, OnClose));
+        m_pExecute->SetClickHdl(LINK(this, DirectSQLDialog, OnExecute));
+        m_pClose->SetClickHdl(LINK(this, DirectSQLDialog, OnClose));
         m_pSQLHistory->SetSelectHdl(LINK(this, DirectSQLDialog, OnListEntrySelected));
         m_pSQLHistory->SetDropDownLineCount(10);
 
@@ -109,8 +101,8 @@ DBG_NAME(DirectSQLDialog)
         if (xConnComp.is())
             startComponentListening(xConnComp);
 
-        m_aSQL.SetModifyHdl(LINK(this, DirectSQLDialog, OnStatementModified));
-        OnStatementModified(&m_aSQL);
+        m_pSQL->SetModifyHdl(LINK(this, DirectSQLDialog, OnStatementModified));
+        OnStatementModified(m_pSQL);
     }
 
     //--------------------------------------------------------------------
@@ -120,8 +112,6 @@ DBG_NAME(DirectSQLDialog)
             ::osl::MutexGuard aGuard(m_aMutex);
             stopAllComponentListening();
         }
-        delete m_pSQLHistory;
-        delete m_pShowOutput;
 
         DBG_DTOR(DirectSQLDialog,NULL);
     }
@@ -226,7 +216,7 @@ DBG_NAME(DirectSQLDialog)
             OSL_ENSURE(xStatement.is(), "DirectSQLDialog::implExecuteStatement: no statement returned by the connection!");
 
             // clear the output box
-            m_aOutput.SetText(OUString());
+            m_pOutput->SetText(OUString());
             if (xStatement.is())
             {
                 if (OUString(_rStatement).toAsciiUpperCase().startsWith("SELECT") && m_pShowOutput->IsChecked())
@@ -288,10 +278,10 @@ DBG_NAME(DirectSQLDialog)
     {
         OUString sAppendMessage = OUString::number(m_nStatusCount++) + ": " + _rMessage + "\n\n";
 
-        OUString sCompleteMessage = m_aStatus.GetText() + sAppendMessage;
-        m_aStatus.SetText(sCompleteMessage);
+        OUString sCompleteMessage = m_pStatus->GetText() + sAppendMessage;
+        m_pStatus->SetText(sCompleteMessage);
 
-        m_aStatus.SetSelection(Selection(sCompleteMessage.getLength(), sCompleteMessage.getLength()));
+        m_pStatus->SetSelection(Selection(sCompleteMessage.getLength(), sCompleteMessage.getLength()));
     }
 
     //--------------------------------------------------------------------
@@ -300,9 +290,9 @@ DBG_NAME(DirectSQLDialog)
         String sAppendMessage = _rMessage;
         sAppendMessage += OUString("\n");
 
-        String sCompleteMessage = m_aOutput.GetText();
+        String sCompleteMessage = m_pOutput->GetText();
         sCompleteMessage += sAppendMessage;
-        m_aOutput.SetText(sCompleteMessage);
+        m_pOutput->SetText(sCompleteMessage);
     }
 
     //--------------------------------------------------------------------
@@ -310,7 +300,7 @@ DBG_NAME(DirectSQLDialog)
     {
         CHECK_INVARIANTS("DirectSQLDialog::executeCurrent");
 
-        String sStatement = m_aSQL.GetText();
+        String sStatement = m_pSQL->GetText();
 
         // execute
         implExecuteStatement(sStatement);
@@ -318,8 +308,8 @@ DBG_NAME(DirectSQLDialog)
         // add the statement to the history
         implAddToStatementHistory(sStatement);
 
-        m_aSQL.SetSelection(Selection());
-        m_aSQL.GrabFocus();
+        m_pSQL->SetSelection(Selection());
+        m_pSQL->GrabFocus();
     }
 
     //--------------------------------------------------------------------
@@ -331,8 +321,8 @@ DBG_NAME(DirectSQLDialog)
         {
             // set the text in the statement editor
             String sStatement = m_aStatementHistory[_nHistoryPos];
-            m_aSQL.SetText(sStatement);
-            OnStatementModified(&m_aSQL);
+            m_pSQL->SetText(sStatement);
+            OnStatementModified(m_pSQL);
 
             if (_bUpdateListBox)
             {
@@ -342,8 +332,8 @@ DBG_NAME(DirectSQLDialog)
                     "DirectSQLDialog::switchToHistory: inconsistent listbox entries!");
             }
 
-            m_aSQL.GrabFocus();
-            m_aSQL.SetSelection(Selection(sStatement.Len(), sStatement.Len()));
+            m_pSQL->GrabFocus();
+            m_pSQL->SetSelection(Selection(sStatement.Len(), sStatement.Len()));
         }
         else
             OSL_FAIL("DirectSQLDialog::switchToHistory: invalid position!");
@@ -352,7 +342,7 @@ DBG_NAME(DirectSQLDialog)
     //--------------------------------------------------------------------
     IMPL_LINK( DirectSQLDialog, OnStatementModified, void*, /*NOTINTERESTEDIN*/ )
     {
-        m_aExecute.Enable(!m_aSQL.GetText().isEmpty());
+        m_pExecute->Enable(!m_pSQL->GetText().isEmpty());
         return 0L;
     }
 
diff --git a/dbaccess/source/ui/inc/directsql.hxx b/dbaccess/source/ui/inc/directsql.hxx
index 0c10fc9..3b59d31 100644
--- a/dbaccess/source/ui/inc/directsql.hxx
+++ b/dbaccess/source/ui/inc/directsql.hxx
@@ -51,20 +51,14 @@ namespace dbaui
         OModuleClient m_aModuleClient;
         ::osl::Mutex    m_aMutex;
 
-        FixedLine       m_aFrame;
-        FixedText       m_aSQLLabel;
-        MultiLineEditSyntaxHighlight    m_aSQL;
-        PushButton      m_aExecute;
-        FixedText       m_aHistoryLabel;
+        MultiLineEditSyntaxHighlight*    m_pSQL;
+        PushButton*      m_pExecute;
         ListBox*        m_pSQLHistory;
-        FixedLine       m_aStatusFrame;
-        MultiLineEdit   m_aStatus;
+        MultiLineEdit*   m_pStatus;
         CheckBox*       m_pShowOutput;
-        FixedLine       m_aOutputFrame;
-        MultiLineEdit   m_aOutput;
-        FixedLine       m_aButtonSeparator;
-        HelpButton      m_aHelp;
-        PushButton      m_aClose;
+        MultiLineEdit*   m_pOutput;
+        HelpButton*      m_pHelp;
+        PushButton*      m_pClose;
 
         typedef ::std::deque< String >  StringQueue;
         StringQueue     m_aStatementHistory;    // previous statements
diff --git a/dbaccess/uiconfig/ui/directsqldialog.ui b/dbaccess/uiconfig/ui/directsqldialog.ui
new file mode 100644
index 0000000..b4ac7ec
--- /dev/null
+++ b/dbaccess/uiconfig/ui/directsqldialog.ui
@@ -0,0 +1,277 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkDialog" id="DirectSQLDialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes">Execute SQL Statement</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox1">
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">12</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area1">
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="help">
+                <property name="label">gtk-help</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">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="close">
+                <property name="label">gtk-close</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_stock">True</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>
+        <child>
+          <object class="GtkFrame" id="frame1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label_xalign">0</property>
+            <property name="shadow_type">none</property>
+            <child>
+              <object class="GtkAlignment" id="alignment1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="top_padding">6</property>
+                <property name="left_padding">12</property>
+                <child>
+                  <object class="GtkGrid" id="grid1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="row_spacing">6</property>
+                    <child>
+                      <object class="svtlo-MultiLineEditSyntaxHighlight" id="sql:border">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">1</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="sql_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">_Command to execute</property>
+                        <property name="use_underline">True</property>
+                        <property name="mnemonic_widget">sql:border</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">0</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkGrid" id="grid2">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="column_spacing">12</property>
+                        <child>
+                          <object class="GtkCheckButton" id="showoutput">
+                            <property name="label" translatable="yes">_Show output of "select" statements</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_underline">True</property>
+                            <property name="xalign">0</property>
+                            <property name="draw_indicator">True</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">0</property>
+                            <property name="top_attach">0</property>
+                            <property name="width">1</property>
+                            <property name="height">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkButton" id="execute">
+                            <property name="label">_Execute</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="use_underline">True</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="top_attach">0</property>
+                            <property name="width">1</property>
+                            <property name="height">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">2</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkComboBox" id="sqlhistory">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">4</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="sqlhistory_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">_Previous commands</property>
+                        <property name="use_underline">True</property>
+                        <property name="mnemonic_widget">sqlhistory</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">3</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child type="label">
+              <object class="GtkLabel" id="label1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">SQL command</property>
+                <attributes>
+                  <attribute name="weight" value="bold"/>
+                </attributes>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkFrame" id="frame2">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label_xalign">0</property>
+            <property name="shadow_type">none</property>
+            <child>
+              <object class="GtkAlignment" id="alignment2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="top_padding">6</property>
+                <property name="left_padding">12</property>
+                <child>
+                  <object class="svtlo-MultiLineEdit" id="status:border">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child type="label">
+              <object class="GtkLabel" id="label2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Status</property>
+                <attributes>
+                  <attribute name="weight" value="bold"/>
+                </attributes>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkFrame" id="frame3">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label_xalign">0</property>
+            <property name="shadow_type">none</property>
+            <child>
+              <object class="GtkAlignment" id="alignment3">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="top_padding">6</property>
+                <property name="left_padding">12</property>
+                <child>
+                  <object class="svtlo-MultiLineEdit" id="output:border">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child type="label">
+              <object class="GtkLabel" id="label3">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Output</property>
+                <attributes>
+                  <attribute name="weight" value="bold"/>
+                </attributes>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">3</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="0">help</action-widget>
+      <action-widget response="0">close</action-widget>
+    </action-widgets>
+  </object>
+</interface>
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index bf617a2..3fb28a9 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -227,6 +227,12 @@
     <glade-widget-class title="Frame Selector" name="svxlo-SvxFrameSelector"
                         generic-name="Frame Border Preview Window" parent="GtkDrawingArea"
                         icon-name="widget-gtk-drawingarea"/>
+    <glade-widget-class title="MultiLine Edit" name="svtlo-MultiLineEdit"
+                        generic-name="MultiLineEdit" parent="GtkTextView"
+                        icon-name="widget-gtk-textview"/>
+    <glade-widget-class title="MultiLine Edit" name="svtlo-MultiLineEditSyntaxHighlight"
+                        generic-name="MultiLineEdit" parent="GtkTextView"
+                        icon-name="widget-gtk-textview"/>
     <glade-widget-class title="ValueSet" name="svtlo-ValueSet"
                         generic-name="Set of Value Options" parent="GtkDrawingArea"
                         icon-name="widget-gtk-drawingarea"/>
diff --git a/svtools/source/edit/editsyntaxhighlighter.cxx b/svtools/source/edit/editsyntaxhighlighter.cxx
index 33e96d9..05cc7b4 100644
--- a/svtools/source/edit/editsyntaxhighlighter.cxx
+++ b/svtools/source/edit/editsyntaxhighlighter.cxx
@@ -20,6 +20,7 @@
 
 #include <svtools/svmedit.hxx>
 #include <vcl/xtextedt.hxx>
+#include <vcl/builder.hxx>
 #include <svtools/editsyntaxhighlighter.hxx>
 #include <vcl/txtattr.hxx>
 
@@ -38,6 +39,11 @@ MultiLineEditSyntaxHighlight::MultiLineEditSyntaxHighlight( Window* pParent, con
     aHighlighter.initialize( aLanguage );
 }
 
+extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeMultiLineEditSyntaxHighlight(Window *pParent, VclBuilder::stringmap &)
+{
+    return new MultiLineEditSyntaxHighlight(pParent);
+}
+
 MultiLineEditSyntaxHighlight::~MultiLineEditSyntaxHighlight()
 {
 }
diff --git a/svtools/source/edit/svmedit.cxx b/svtools/source/edit/svmedit.cxx
index 6a7c977..224a967 100644
--- a/svtools/source/edit/svmedit.cxx
+++ b/svtools/source/edit/svmedit.cxx
@@ -20,6 +20,7 @@
 
 
 #include "unoiface.hxx"
+#include <vcl/builder.hxx>
 #include <svtools/textwindowpeer.hxx>
 
 
@@ -33,6 +34,11 @@ MultiLineEdit::MultiLineEdit( Window* pParent, const ResId& rResId )
 {
 }
 
+extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeMultiLineEdit(Window *pParent, VclBuilder::stringmap &)
+{
+    return new MultiLineEdit(pParent);
+}
+
 // virtual
 css::uno::Reference< css::awt::XWindowPeer >
 MultiLineEdit::GetComponentInterface(sal_Bool bCreate)


More information about the Libreoffice-commits mailing list