[Libreoffice-commits] core.git: dbaccess/inc dbaccess/Library_dbu.mk dbaccess/Module_dbaccess.mk dbaccess/source dbaccess/uiconfig dbaccess/UI_dbaccess.mk extras/source officecfg/registry

Zolnai Tamás zolnaitamas2000 at gmail.com
Mon Mar 4 10:34:00 PST 2013


 dbaccess/Library_dbu.mk                                          |    2 
 dbaccess/Module_dbaccess.mk                                      |    1 
 dbaccess/UI_dbaccess.mk                                          |   16 
 dbaccess/inc/dbaccess_slotid.hrc                                 |    2 
 dbaccess/source/ui/dlg/QueryPropertiesDialog.cxx                 |   37 +
 dbaccess/source/ui/inc/LimitBox.hxx                              |   46 +
 dbaccess/source/ui/inc/QueryPropertiesDialog.hxx                 |   62 ++
 dbaccess/source/ui/inc/querycontroller.hxx                       |    3 
 dbaccess/source/ui/querydesign/LimitBox.cxx                      |  150 ++++++
 dbaccess/source/ui/querydesign/limitboxcontroller.cxx            |  121 ----
 dbaccess/source/ui/querydesign/limitboxcontroller.hxx            |   30 -
 dbaccess/source/ui/querydesign/querycontroller.cxx               |   23 
 dbaccess/uiconfig/dbquery/menubar/menubar.xml                    |    2 
 dbaccess/uiconfig/ui/querypropertiesdialog.ui                    |  247 ++++++++++
 extras/source/glade/libreoffice-catalog.xml                      |    3 
 officecfg/registry/data/org/openoffice/Office/UI/DbuCommands.xcu |    5 
 16 files changed, 616 insertions(+), 134 deletions(-)

New commits:
commit 7488ad52d7aa0941ec09757240acc3f542b3832a
Author: Zolnai Tamás <zolnaitamas2000 at gmail.com>
Date:   Thu Feb 28 20:07:03 2013 +0100

    Add new dialog to Query Design View
    
    In Query Properties Dialog can be set properties like
    distinct values and limit.
    To open choose Edit\Query Properties.
    
    Steps of implementation:
    - Add new slot to Edit menu (menubar.xml): delete the slot of distinct values,
      because it can set in this dialog too
    - Separate LimitBox class from limitboxcontroller.cxx (LimitBox.hxx\cxx)
      With it only LimitBox header is included in the dialog source.
    - Extend LimitBox class to work with new layout widget (make... and GetOptimalSize())
      and add it to the galde catalog
    - Make a class for the new dialog (QueryPropertiesDialog.hxx\cxx) and
      write the .ui file. (querypropertiesdialog.ui)
    - Syncronize the two LimitBox (querycontroller.cxx)
    
    Change-Id: Ib84bef5a2ed55030333d6151342b99ff27766538

diff --git a/dbaccess/Library_dbu.mk b/dbaccess/Library_dbu.mk
index ef84bfe..fbb385d 100644
--- a/dbaccess/Library_dbu.mk
+++ b/dbaccess/Library_dbu.mk
@@ -166,6 +166,7 @@ $(eval $(call gb_Library_add_exception_objects,dbu,\
     dbaccess/source/ui/dlg/paramdialog \
     dbaccess/source/ui/dlg/queryfilter \
     dbaccess/source/ui/dlg/queryorder \
+    dbaccess/source/ui/dlg/QueryPropertiesDialog \
     dbaccess/source/ui/dlg/RelationDlg \
     dbaccess/source/ui/dlg/sqlmessage \
     dbaccess/source/ui/dlg/tablespage \
@@ -214,6 +215,7 @@ $(eval $(call gb_Library_add_exception_objects,dbu,\
     dbaccess/source/ui/querydesign/JoinDesignView \
     dbaccess/source/ui/querydesign/JoinExchange \
     dbaccess/source/ui/querydesign/JoinTableView \
+    dbaccess/source/ui/querydesign/LimitBox \
     dbaccess/source/ui/querydesign/limitboxcontroller \
     dbaccess/source/ui/querydesign/QTableConnection \
     dbaccess/source/ui/querydesign/QTableConnectionData \
diff --git a/dbaccess/Module_dbaccess.mk b/dbaccess/Module_dbaccess.mk
index 3195bbf..0e5fe13 100644
--- a/dbaccess/Module_dbaccess.mk
+++ b/dbaccess/Module_dbaccess.mk
@@ -43,6 +43,7 @@ $(eval $(call gb_Module_add_targets,dbaccess,\
     Library_sdbt \
     Package_inc \
     Package_uiconfig \
+    UI_dbaccess \
 ))
 
 $(eval $(call gb_Module_add_check_targets,dbaccess,\
diff --git a/dbaccess/UI_dbaccess.mk b/dbaccess/UI_dbaccess.mk
new file mode 100644
index 0000000..71c6ddc
--- /dev/null
+++ b/dbaccess/UI_dbaccess.mk
@@ -0,0 +1,16 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# 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/.
+#
+
+$(eval $(call gb_UI_UI,dbaccess))
+
+$(eval $(call gb_UI_add_uifiles,dbaccess, \
+    dbaccess/uiconfig/ui/querypropertiesdialog  \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/dbaccess/inc/dbaccess_slotid.hrc b/dbaccess/inc/dbaccess_slotid.hrc
index 37a333e..7d0af41 100644
--- a/dbaccess/inc/dbaccess_slotid.hrc
+++ b/dbaccess/inc/dbaccess_slotid.hrc
@@ -102,6 +102,8 @@
 #define SID_TABLEDESIGN_TABED_PRIMARYKEY ( SID_DBACCESS_START + 67 )
 #define SID_TABLEDESIGN_INSERTROWS      ( SID_DBACCESS_START +  68 )
 
+#define SID_QUERY_PROP_DLG              ( SID_DBACCESS_START +  69 )
+
 
 #endif // _DBACCESS_SLOTID_HRC_
 
diff --git a/dbaccess/source/ui/dlg/QueryPropertiesDialog.cxx b/dbaccess/source/ui/dlg/QueryPropertiesDialog.cxx
new file mode 100644
index 0000000..fd37bcd
--- /dev/null
+++ b/dbaccess/source/ui/dlg/QueryPropertiesDialog.cxx
@@ -0,0 +1,37 @@
+/* -*- 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/.
+ */
+
+#include "QueryPropertiesDialog.hxx"
+
+namespace dbaui
+{
+
+QueryPropertiesDialog::QueryPropertiesDialog(
+    Window* pParent, const sal_Bool bDistinct, const sal_Int64 nLimit )
+    : ModalDialog(pParent, "QueryPropertiesDialog", "dbaccess/ui/querypropertiesdialog.ui")
+    , m_pRB_Distinct( 0 )
+    , m_pRB_NonDistinct( 0 )
+    , m_pLB_Limit( 0 )
+{
+    get( m_pRB_Distinct, "distinct" );
+    get( m_pRB_NonDistinct, "nondistinct" );
+    get( m_pLB_Limit, "limitbox" );
+
+    m_pRB_Distinct->Check( bDistinct );
+    m_pRB_NonDistinct->Check( !bDistinct );
+    m_pLB_Limit->SetValue( nLimit );
+}
+
+QueryPropertiesDialog::~QueryPropertiesDialog()
+{
+}
+
+} ///dbaui namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/LimitBox.hxx b/dbaccess/source/ui/inc/LimitBox.hxx
new file mode 100644
index 0000000..52084a0
--- /dev/null
+++ b/dbaccess/source/ui/inc/LimitBox.hxx
@@ -0,0 +1,46 @@
+/* -*- 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 LIMIT_BOX_HXX
+#define LIMIT_BOX_HXX
+
+#include <vcl/field.hxx>
+#include <rtl/ustring.hxx>
+
+namespace dbaui
+{
+
+/**
+ * Input box to add limit to an SQL query (maximum number of result's rows)
+ * This box is reachable on the Query Design Toolbar
+ */
+class LimitBox: public NumericBox
+{
+    public:
+        LimitBox( Window* pParent, WinBits nStyle );
+        virtual ~LimitBox();
+
+        virtual long        Notify( NotifyEvent& rNEvt );
+
+        virtual OUString    CreateFieldText( sal_Int64 nValue ) const;
+
+        virtual void        Reformat();
+        virtual void        ReformatAll();
+
+        virtual Size        GetOptimalSize() const;
+
+    private:
+        void LoadDefaultLimits();
+};
+
+} ///dbaui namespace
+
+#endif ///LIMIT_BOX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/QueryPropertiesDialog.hxx b/dbaccess/source/ui/inc/QueryPropertiesDialog.hxx
new file mode 100644
index 0000000..f6ba452
--- /dev/null
+++ b/dbaccess/source/ui/inc/QueryPropertiesDialog.hxx
@@ -0,0 +1,62 @@
+/* -*- 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 QUERYPROPERTIESDIALOG_HXX
+#define QUERYPROPERTIESDIALOG_HXX
+
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <rtl/ustring.hxx>
+#include "LimitBox.hxx"
+
+namespace dbaui
+{
+
+/**
+ * Dialog to set such properties of a query as distinct values and limit
+ * It can be opened form Edit menu in Query Design View
+ */
+class QueryPropertiesDialog : public ModalDialog
+{
+
+public:
+
+    QueryPropertiesDialog(
+        Window* pParent, const sal_Bool bDistinct, const sal_Int64 nLimit );
+    ~QueryPropertiesDialog();
+
+    sal_Bool getDistinct() const;
+    sal_Int64 getLimit() const;
+
+private:
+
+    RadioButton* m_pRB_Distinct;
+    RadioButton* m_pRB_NonDistinct;
+
+    LimitBox* m_pLB_Limit;
+
+};
+
+
+inline sal_Bool QueryPropertiesDialog::getDistinct() const
+{
+    return m_pRB_Distinct->IsChecked();
+}
+
+inline sal_Int64 QueryPropertiesDialog::getLimit() const
+{
+    return m_pLB_Limit->GetValue();
+}
+
+
+} ///dbaui namespace
+
+#endif ///QUERYPROPERTIESDIALOG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/querycontroller.hxx b/dbaccess/source/ui/inc/querycontroller.hxx
index 0b28bae..bfd3eb2 100644
--- a/dbaccess/source/ui/inc/querycontroller.hxx
+++ b/dbaccess/source/ui/inc/querycontroller.hxx
@@ -51,7 +51,6 @@ namespace dbaui
 {
     class OQueryContainerWindow;
 
-    class OQueryController;
     typedef ::comphelper::OPropertyContainer                            OQueryController_PBase;
     typedef ::comphelper::OPropertyArrayUsageHelper< OQueryController > OQueryController_PABase;
     class OQueryController  :public OJoinController
@@ -117,6 +116,8 @@ namespace dbaui
 
         ::rtl::OUString getDefaultName() const;
 
+        void execute_QueryPropDlg();
+
     protected:
         // all the features which should be handled by this class
         virtual void            describeSupportedFeatures();
diff --git a/dbaccess/source/ui/querydesign/LimitBox.cxx b/dbaccess/source/ui/querydesign/LimitBox.cxx
new file mode 100644
index 0000000..a690826
--- /dev/null
+++ b/dbaccess/source/ui/querydesign/LimitBox.cxx
@@ -0,0 +1,150 @@
+/* -*- 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/.
+ */
+
+#include "LimitBox.hxx"
+#include "dbu_qry.hrc"
+#include "moduledbu.hxx"
+
+#define ALL_STRING ModuleRes(STR_QUERY_LIMIT_ALL).toString()
+#define ALL_INT -1
+
+
+////////////////
+///LimitBox
+////////////////
+
+namespace global{
+
+/// Default values
+sal_Int64 aDefLimitAry[] =
+{
+    5,
+    10,
+    20,
+    50
+};
+
+}
+
+namespace dbaui
+{
+
+
+LimitBox::LimitBox( Window* pParent, WinBits nStyle )
+    : NumericBox( pParent, nStyle )
+{
+    SetShowTrailingZeros( sal_False );
+    SetDecimalDigits( 0 );
+    SetMin( -1 );
+    SetMax( 9999 );
+    LoadDefaultLimits();
+
+    Size aSize(
+        GetSizePixel().Width(),
+        CalcWindowSizePixel(GetEntryCount() + 1) );
+    SetSizePixel(aSize);
+}
+
+LimitBox::~LimitBox()
+{
+}
+
+long LimitBox::Notify( NotifyEvent& rNEvt )
+{
+    long nHandled = 0;
+
+    switch ( rNEvt.GetType() )
+    {
+        case EVENT_KEYINPUT:
+        {
+            const sal_uInt16 nCode = rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
+            if( nCode == KEY_RETURN )
+            {
+                GrabFocusToDocument();
+                nHandled = 1;
+            }
+            break;
+        }
+    }
+    return nHandled ? nHandled : NumericBox::Notify( rNEvt );
+}
+
+OUString LimitBox::CreateFieldText( sal_Int64 nValue ) const
+{
+    if( nValue == ALL_INT )
+        return ALL_STRING;
+    else
+        return NumericBox::CreateFieldText( nValue );
+}
+
+void LimitBox::Reformat()
+{
+
+    if( GetText() == ALL_STRING )
+    {
+        SetValue( ALL_INT );
+    }
+    ///Reformat only when text is not All
+    else
+    {
+        ///Not allow user to type in -1
+        if( GetText() == "-1" )
+        {
+            Undo();
+        }
+        else
+            NumericBox::Reformat();
+    }
+}
+
+void LimitBox::ReformatAll()
+{
+    ///First entry is All, which do not need numeric reformat
+    if ( GetEntryCount() > 0 )
+    {
+        RemoveEntry( 0 );
+        NumericBox::ReformatAll();
+        InsertEntry( ALL_STRING, 0);
+    }
+    else
+    {
+        NumericBox::ReformatAll();
+    }
+}
+
+Size LimitBox::GetOptimalSize() const
+{
+    Size aSize = NumericBox::GetOptimalSize();
+    return Size( aSize.Width() + 20, aSize.Height());
+}
+
+///Initialize entries
+void LimitBox::LoadDefaultLimits()
+{
+    SetValue( ALL_INT );
+    InsertEntry( ALL_STRING );
+
+    const unsigned nSize =
+        sizeof(global::aDefLimitAry)/sizeof(global::aDefLimitAry[0]);
+    for( unsigned nIndex = 0; nIndex< nSize; ++nIndex)
+    {
+        InsertValue( global::aDefLimitAry[nIndex] );
+    }
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeLimitBox( Window *pParent )
+{
+    LimitBox* pBox = new LimitBox( pParent, WB_DROPDOWN | WB_VSCROLL );
+    return pBox;
+}
+
+
+} ///dbaui namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/querydesign/limitboxcontroller.cxx b/dbaccess/source/ui/querydesign/limitboxcontroller.cxx
index 6669d31..7697894 100644
--- a/dbaccess/source/ui/querydesign/limitboxcontroller.cxx
+++ b/dbaccess/source/ui/querydesign/limitboxcontroller.cxx
@@ -16,105 +16,41 @@
 #include <vcl/window.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
 #include <osl/mutex.hxx>
-#include <rtl/ustring.hxx>
 
+#include "LimitBox.hxx"
 #include "dbu_reghelper.hxx"
-#include "dbu_qry.hrc"
 #include "moduledbu.hxx"
 
-#define ALL_STRING ModuleRes(STR_QUERY_LIMIT_ALL).toString()
-#define ALL_INT -1
 
 using namespace ::com::sun::star;
 
-////////////////
-///LimitBox
-////////////////
-
 namespace dbaui
 {
 
-namespace global{
-
-/// Default values
-sal_Int64 aDefLimitAry[] =
+class LimitBoxImpl: public LimitBox
 {
-    5,
-    10,
-    20,
-    50
-};
+    public:
+        LimitBoxImpl( Window* pParent, LimitBoxController* pCtrl );
+        virtual ~LimitBoxImpl();
 
-}
+        virtual long    Notify( NotifyEvent& rNEvt );
 
+    private:
+        LimitBoxController* m_pControl;
+};
 
-LimitBox::LimitBox( Window* pParent, LimitBoxController* pCtrl )
-    : NumericBox( pParent, WinBits( WB_DROPDOWN | WB_VSCROLL) )
+LimitBoxImpl::LimitBoxImpl( Window* pParent, LimitBoxController* pCtrl )
+    : LimitBox( pParent, WinBits( WB_DROPDOWN | WB_VSCROLL) )
     , m_pControl( pCtrl )
 {
-    SetShowTrailingZeros( sal_False );
-    SetDecimalDigits( 0 );
-    SetMin( -1 );
-    SetMax( 9999 );
-    LoadDefaultLimits();
-
-    Size aSize(
-        CalcMinimumSize().Width() + 20 ,
-        CalcWindowSizePixel(GetEntryCount() + 1) );
-    SetSizePixel(aSize);
 }
 
-LimitBox::~LimitBox()
+LimitBoxImpl::~LimitBoxImpl()
 {
 }
 
-void LimitBox::Reformat()
+long LimitBoxImpl::Notify( NotifyEvent& rNEvt )
 {
-
-    if( GetText() == ALL_STRING )
-    {
-        SetValue( -1 );
-    }
-    ///Reformat only when text is not All
-    else
-    {
-        ///Not allow user to type -1
-        if( GetText() == "-1" )
-        {
-            Undo();
-        }
-        else
-            NumericBox::Reformat();
-    }
-}
-
-void LimitBox::ReformatAll()
-{
-    ///First entry is All, which do not need numeric reformat
-    if ( GetEntryCount() > 0 )
-    {
-        RemoveEntry( 0 );
-        NumericBox::ReformatAll();
-        InsertEntry( ALL_STRING, 0);
-    }
-    else
-    {
-        NumericBox::ReformatAll();
-    }
-}
-
-OUString LimitBox::CreateFieldText( sal_Int64 nValue ) const
-{
-    if( nValue == ALL_INT )
-        return ALL_STRING;
-    else
-        return NumericBox::CreateFieldText( nValue );
-}
-
-long LimitBox::Notify( NotifyEvent& rNEvt )
-{
-    long nReturn = NumericBox::Notify( rNEvt );
-
     switch ( rNEvt.GetType() )
     {
         case EVENT_LOSEFOCUS:
@@ -125,36 +61,10 @@ long LimitBox::Notify( NotifyEvent& rNEvt )
             m_pControl->dispatchCommand( aArgs );
             break;
         }
-        case EVENT_KEYINPUT:
-        {
-            const sal_uInt16 nCode = rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
-            if( nCode == KEY_RETURN )
-            {
-                GrabFocusToDocument();
-            }
-            break;
-        }
-    }
-    return nReturn;
-}
-
-///Initialize entries
-void LimitBox::LoadDefaultLimits()
-{
-    SetValue( ALL_INT );
-    InsertEntry( ALL_STRING );
-
-    const unsigned nSize =
-        sizeof(global::aDefLimitAry)/sizeof(global::aDefLimitAry[0]);
-    for( unsigned nIndex = 0; nIndex< nSize; ++nIndex)
-    {
-        InsertValue( global::aDefLimitAry[nIndex] );
     }
+    return LimitBox::Notify( rNEvt );
 }
 
-/////////////////////////
-///LimitBoxController
-/////////////////////////
 
 LimitBoxController::LimitBoxController(
     const uno::Reference< lang::XMultiServiceFactory >& rServiceManager ) :
@@ -263,7 +173,8 @@ uno::Reference< awt::XWindow > SAL_CALL LimitBoxController::createItemWindow(
     if ( pParent )
     {
         SolarMutexGuard aSolarMutexGuard;
-        m_pLimitBox = new LimitBox(pParent, this);
+        m_pLimitBox = new LimitBoxImpl(pParent, this);
+        m_pLimitBox->SetSizePixel(m_pLimitBox->GetOptimalSize());
         xItemWindow = VCLUnoHelper::GetInterface( m_pLimitBox );
     }
 
diff --git a/dbaccess/source/ui/querydesign/limitboxcontroller.hxx b/dbaccess/source/ui/querydesign/limitboxcontroller.hxx
index a0e746e..64bab94 100644
--- a/dbaccess/source/ui/querydesign/limitboxcontroller.hxx
+++ b/dbaccess/source/ui/querydesign/limitboxcontroller.hxx
@@ -12,38 +12,14 @@
 
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <svtools/toolboxcontroller.hxx>
-#include <vcl/field.hxx>
+#include <rtl/ustring.hxx>
 
 #include "apitools.hxx"
 
 namespace dbaui
 {
 
-class LimitBoxController;
-
-/**
- * Input box to add limit to an SQL query (maximum number of result's rows)
- * This box is reachable on the Query Design Toolbar
- */
-class LimitBox: public NumericBox
-{
-    public:
-        LimitBox( Window* pParent, LimitBoxController* pCtrl );
-        virtual ~LimitBox();
-
-        virtual long        Notify( NotifyEvent& rNEvt );
-
-        virtual OUString    CreateFieldText( sal_Int64 nValue ) const;
-
-        virtual void        Reformat();
-        virtual void        ReformatAll();
-
-    private:
-        LimitBoxController* m_pControl;
-
-        void LoadDefaultLimits();
-};
-
+class LimitBoxImpl;
 
 /**
  * A ToolboxController to paste LimitBox onto the Query Design Toolbar
@@ -83,7 +59,7 @@ class LimitBoxController: public svt::ToolboxController,
         using svt::ToolboxController::dispatchCommand;
 
     private:
-        LimitBox* m_pLimitBox;
+        LimitBoxImpl* m_pLimitBox;
 };
 
 } ///dbaui namespace
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index 74d5715..a5b23ec 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -39,6 +39,7 @@
 #include "TableConnectionData.hxx"
 #include "TableFieldDescription.hxx"
 #include "UITools.hxx"
+#include "QueryPropertiesDialog.hxx"
 
 #include <com/sun/star/beans/PropertyAttribute.hpp>
 #include <com/sun/star/container/XChild.hpp>
@@ -551,6 +552,9 @@ FeatureState OQueryController::GetState(sal_uInt16 _nId) const
             if( aReturn.bEnabled )
                 aReturn.aValue = makeAny( m_nLimit );
             break;
+        case SID_QUERY_PROP_DLG:
+            aReturn.bEnabled = m_bGraphicalDesign;
+            break;
         case ID_BROWSER_QUERY_EXECUTE:
             aReturn.bEnabled = sal_True;
             break;
@@ -727,6 +731,10 @@ void OQueryController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >&
                 setModified(sal_True);
             }
             break;
+        case SID_QUERY_PROP_DLG:
+            grabFocusFromLimitBox(*this);
+            execute_QueryPropDlg();
+            break;
         case ID_BROWSER_QUERY_EXECUTE:
             grabFocusFromLimitBox(*this);
             if ( getContainer()->checkStatement() )
@@ -1160,6 +1168,7 @@ void OQueryController::describeSupportedFeatures()
     implDescribeSupportedFeature( ".uno:DBAddRelation",     SID_RELATION_ADD_RELATION,  CommandGroup::EDIT );
     implDescribeSupportedFeature( ".uno:DBQueryPreview",    SID_DB_QUERY_PREVIEW,       CommandGroup::VIEW );
     implDescribeSupportedFeature( ".uno:DBLimit",           SID_QUERY_LIMIT,            CommandGroup::FORMAT );
+    implDescribeSupportedFeature( ".uno:DBQueryPropertiesDialog", SID_QUERY_PROP_DLG,         CommandGroup::FORMAT );
 
 #if OSL_DEBUG_LEVEL > 1
     implDescribeSupportedFeature( ".uno:DBShowParseTree",   ID_EDIT_QUERY_SQL );
@@ -1254,6 +1263,20 @@ void OQueryController::loadViewSettings( const ::comphelper::NamedValueCollectio
     m_aFieldInformation = o_rViewSettings.getOrDefault( "Fields", m_aFieldInformation );
 }
 // -----------------------------------------------------------------------------
+void OQueryController::execute_QueryPropDlg()
+{
+    QueryPropertiesDialog aQueryPropDlg(
+        getContainer(), m_bDistinct, m_nLimit );
+
+    if( aQueryPropDlg.Execute() == RET_OK )
+    {
+        m_bDistinct = aQueryPropDlg.getDistinct();
+        m_nLimit = aQueryPropDlg.getLimit();
+        InvalidateFeature( SID_QUERY_DISTINCT_VALUES );
+        InvalidateFeature( SID_QUERY_LIMIT, 0, sal_True );
+    }
+}
+// -----------------------------------------------------------------------------
 sal_Int32 OQueryController::getColWidth(sal_uInt16 _nColPos)  const
 {
     if ( _nColPos < m_aFieldInformation.getLength() )
diff --git a/dbaccess/uiconfig/dbquery/menubar/menubar.xml b/dbaccess/uiconfig/dbquery/menubar/menubar.xml
index dd84ef3..b60371f 100644
--- a/dbaccess/uiconfig/dbquery/menubar/menubar.xml
+++ b/dbaccess/uiconfig/dbquery/menubar/menubar.xml
@@ -43,7 +43,7 @@
             <menu:menuitem menu:id=".uno:Copy"/>
             <menu:menuitem menu:id=".uno:Paste"/>
             <menu:menuseparator/>
-            <menu:menuitem menu:id=".uno:DBDistinctValues"/>
+            <menu:menuitem menu:id=".uno:DBQueryPropertiesDialog"/>
             <menu:menuitem menu:id=".uno:SbaNativeSql"/>
             <menu:menuitem menu:id=".uno:DBClearQuery"/>
             <menu:menuitem menu:id=".uno:SbaExecuteSql"/>
diff --git a/dbaccess/uiconfig/ui/querypropertiesdialog.ui b/dbaccess/uiconfig/ui/querypropertiesdialog.ui
new file mode 100644
index 0000000..5119ff0
--- /dev/null
+++ b/dbaccess/uiconfig/ui/querypropertiesdialog.ui
@@ -0,0 +1,247 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <!-- interface-requires LibreOffice 1.0 -->
+  <object class="GtkDialog" id="QueryPropertiesDialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes">Query Properties</property>
+    <property name="modal">True</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">2</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>
+            <property name="margin_top">24</property>
+            <child>
+              <object class="GtkButton" id="ok">
+                <property name="label">gtk-ok</property>
+                <property name="use_action_appearance">False</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_action_appearance">False</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="cancel">
+                <property name="label">gtk-cancel</property>
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="has_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_action_appearance">False</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>
+            <child>
+              <object class="GtkButton" id="help">
+                <property name="label">gtk-help</property>
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</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="hexpand">True</property>
+            <property name="vexpand">True</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="hexpand">True</property>
+                <property name="vexpand">True</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">12</property>
+                    <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="GtkLabel" id="distinctvalues">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="halign">start</property>
+                            <property name="label" translatable="yes">Distinct Values</property>
+                            <property name="mnemonic_widget">distinct-buttons</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="GtkButtonBox" id="distinct-buttons">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="layout_style">start</property>
+                            <child>
+                              <object class="GtkRadioButton" id="distinct">
+                                <property name="label">Yes</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="xalign">0</property>
+                                <property name="draw_indicator">True</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkRadioButton" id="nondistinct">
+                                <property name="label">No</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="xalign">0</property>
+                                <property name="draw_indicator">True</property>
+                                <property name="group">distinct</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </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">0</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkGrid" id="grid3">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="column_spacing">24</property>
+                        <child>
+                          <object class="GtkLabel" id="limit-label">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="halign">start</property>
+                            <property name="label" translatable="yes">Limit</property>
+                            <property name="mnemonic_widget">limitbox</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="dbulo-LimitBox" id="limitbox">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="expand">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">1</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">Properties:</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>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="0">ok</action-widget>
+      <action-widget response="0">cancel</action-widget>
+      <action-widget response="0">help</action-widget>
+    </action-widgets>
+  </object>
+</interface>
diff --git a/extras/source/glade/libreoffice-catalog.xml b/extras/source/glade/libreoffice-catalog.xml
index 225a194..e3a00b1 100644
--- a/extras/source/glade/libreoffice-catalog.xml
+++ b/extras/source/glade/libreoffice-catalog.xml
@@ -48,6 +48,9 @@
     <glade-widget-class title="Text Encoding ListBox" name="svxlo-SvxTextEncodingBox"
                         generic-name="TextEncodingBox" parent="GtkComboBox"
                         icon-name="widget-gtk-combobox"/>
+    <glade-widget-class title="Limit ListBox" name="dbulo-LimitBox"
+                        generic-name="LimitBox" parent="GtkComboBox"
+                        icon-name="widget-gtk-combobox"/>
     <glade-widget-class title="Font Preview" name="svxlo-SvxFontPrevWindow"
                         generic-name="Font Preview Window" parent="GtkDrawingArea"
                         icon-name="widget-gtk-drawingarea"/>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/DbuCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/DbuCommands.xcu
index 44f2d42..4445a4c 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/DbuCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/DbuCommands.xcu
@@ -77,6 +77,11 @@
                     <value xml:lang="en-US">Limit</value>
                 </prop>
             </node>
+            <node oor:name=".uno:DBQueryPropertiesDialog" oor:op="replace">
+                <prop oor:name="Label" oor:type="xs:string">
+                    <value xml:lang="en-US">Query Properties</value>
+                </prop>
+            </node>
             <node oor:name=".uno:PasteSpecial" oor:op="replace">
                 <prop oor:name="Label" oor:type="xs:string">
                     <value xml:lang="en-US">Paste ~Special...</value>


More information about the Libreoffice-commits mailing list