summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorZolnai Tamás <zolnaitamas2000@gmail.com>2013-02-28 20:07:03 +0100
committerLionel Elie Mamane <lionel@mamane.lu>2013-03-04 19:33:16 +0100
commit7488ad52d7aa0941ec09757240acc3f542b3832a (patch)
tree2da251ad36765987bba0f480352432401697ff48 /dbaccess
parent30e14d7d3a70f0b5f5a6163d122e501cc5edc334 (diff)
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
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/Library_dbu.mk2
-rw-r--r--dbaccess/Module_dbaccess.mk1
-rw-r--r--dbaccess/UI_dbaccess.mk16
-rw-r--r--dbaccess/inc/dbaccess_slotid.hrc2
-rw-r--r--dbaccess/source/ui/dlg/QueryPropertiesDialog.cxx37
-rw-r--r--dbaccess/source/ui/inc/LimitBox.hxx46
-rw-r--r--dbaccess/source/ui/inc/QueryPropertiesDialog.hxx62
-rw-r--r--dbaccess/source/ui/inc/querycontroller.hxx3
-rw-r--r--dbaccess/source/ui/querydesign/LimitBox.cxx150
-rw-r--r--dbaccess/source/ui/querydesign/limitboxcontroller.cxx121
-rw-r--r--dbaccess/source/ui/querydesign/limitboxcontroller.hxx30
-rw-r--r--dbaccess/source/ui/querydesign/querycontroller.cxx23
-rw-r--r--dbaccess/uiconfig/dbquery/menubar/menubar.xml2
-rw-r--r--dbaccess/uiconfig/ui/querypropertiesdialog.ui247
14 files changed, 608 insertions, 134 deletions
diff --git a/dbaccess/Library_dbu.mk b/dbaccess/Library_dbu.mk
index ef84bfe2bdac..fbb385dd37f8 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 3195bbf1ff85..0e5fe133ad2c 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 000000000000..71c6ddc12d98
--- /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 37a333ebec61..7d0af41b5f32 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 000000000000..fd37bcdeaa6f
--- /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 000000000000..52084a0ce33a
--- /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 000000000000..f6ba4523bbc3
--- /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 0b28bae4af06..bfd3eb2350a7 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 000000000000..a6908269b96b
--- /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 6669d31119de..7697894e9b8c 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 a0e746ea8b22..64bab94a870c 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 74d5715155cb..a5b23ecb5f65 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 dd84ef30e99a..b60371f44f86 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 000000000000..5119ff0d5035
--- /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>