Kaydet (Commit) c268527f authored tarafından Caolán McNamara's avatar Caolán McNamara

weld AddressBookSourceDialog

Change-Id: I3e83c41db04268b7370fdb7370f5b630419c6d4e
Reviewed-on: https://gerrit.libreoffice.org/68622
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 21233e29
...@@ -22,10 +22,7 @@ ...@@ -22,10 +22,7 @@
#include <memory> #include <memory>
#include <svtools/svtdllapi.h> #include <svtools/svtdllapi.h>
#include <vcl/dialog.hxx> #include <vcl/weld.hxx>
#include <vcl/combobox.hxx>
#include <vcl/button.hxx>
#include <vcl/scrbar.hxx>
namespace com :: sun :: star :: container { class XNameAccess; } namespace com :: sun :: star :: container { class XNameAccess; }
namespace com :: sun :: star :: sdbc { class XDataSource; } namespace com :: sun :: star :: sdbc { class XDataSource; }
...@@ -38,15 +35,12 @@ namespace com :: sun :: star :: util { struct AliasProgrammaticPair; } ...@@ -38,15 +35,12 @@ namespace com :: sun :: star :: util { struct AliasProgrammaticPair; }
namespace svt namespace svt
{ {
// = AddressBookSourceDialog // = AddressBookSourceDialog
struct AddressBookSourceDialogData; struct AddressBookSourceDialogData;
class SVT_DLLPUBLIC AddressBookSourceDialog final : public ModalDialog class SVT_DLLPUBLIC AddressBookSourceDialog final : public weld::GenericDialogController
{ {
public: public:
AddressBookSourceDialog( vcl::Window* _pParent, AddressBookSourceDialog(weld::Window* _pParent,
const css::uno::Reference< css::uno::XComponentContext >& _rxORB ); const css::uno::Reference< css::uno::XComponentContext >& _rxORB );
/** if you use this ctor, the dialog /** if you use this ctor, the dialog
...@@ -68,7 +62,7 @@ namespace svt ...@@ -68,7 +62,7 @@ namespace svt
the table name to display. It must refer to a valid table, relative to a connection the table name to display. It must refer to a valid table, relative to a connection
obtained from <arg>_rxTransientDS</arg> obtained from <arg>_rxTransientDS</arg>
*/ */
AddressBookSourceDialog( vcl::Window* _pParent, AddressBookSourceDialog(weld::Window* _pParent,
const css::uno::Reference< css::uno::XComponentContext >& _rxORB, const css::uno::Reference< css::uno::XComponentContext >& _rxORB,
const css::uno::Reference< css::sdbc::XDataSource >& _rxTransientDS, const css::uno::Reference< css::sdbc::XDataSource >& _rxTransientDS,
const OUString& _rDataSourceName, const OUString& _rDataSourceName,
...@@ -77,7 +71,6 @@ namespace svt ...@@ -77,7 +71,6 @@ namespace svt
); );
virtual ~AddressBookSourceDialog() override; virtual ~AddressBookSourceDialog() override;
virtual void dispose() override;
// to be used if the object was constructed for editing a field mapping only // to be used if the object was constructed for editing a field mapping only
void getFieldMapping( void getFieldMapping(
...@@ -86,12 +79,9 @@ namespace svt ...@@ -86,12 +79,9 @@ namespace svt
private: private:
void implConstruct(); void implConstruct();
// Window overridables
virtual bool PreNotify( NotifyEvent& _rNEvt ) override;
// implementations // implementations
void implScrollFields(sal_Int32 _nPos, bool _bAdjustFocus, bool _bAdjustScrollbar); void implScrollFields(sal_Int32 nPos, bool bAdjustFocus, bool bAdjustScrollbar);
static void implSelectField(ListBox* _pBox, const OUString& _rText); static void implSelectField(weld::ComboBox* pBox, const OUString& rText);
void resetTables(); void resetTables();
void resetFields(); void resetFields();
...@@ -102,21 +92,15 @@ namespace svt ...@@ -102,21 +92,15 @@ namespace svt
// initialize the dialog from the configuration data // initialize the dialog from the configuration data
void loadConfiguration(); void loadConfiguration();
DECL_LINK(OnFieldScroll, ScrollBar*, void); DECL_LINK(OnFieldScroll, weld::ScrolledWindow&, void);
DECL_LINK(OnFieldSelect, ListBox&, void); DECL_LINK(OnFieldSelect, weld::ComboBox&, void);
DECL_LINK(OnAdministrateDatasources, Button*, void); DECL_LINK(OnAdministrateDatasources, weld::Button&, void);
DECL_STATIC_LINK(AddressBookSourceDialog, OnComboGetFocus, Control&, void); DECL_STATIC_LINK(AddressBookSourceDialog, OnComboGetFocus, weld::Widget&, void);
DECL_LINK(OnComboLoseFocus, Control&, void); DECL_LINK(OnComboLoseFocus, weld::Widget&, void);
DECL_LINK(OnComboSelect, ComboBox&, void); DECL_LINK(OnComboSelect, weld::ComboBox&, void);
DECL_LINK(OnOkClicked, Button*, void); DECL_LINK(OnOkClicked, weld::Button&, void);
DECL_LINK(OnDelayedInitialize, void*, void); DECL_LINK(OnDelayedInitialize, void*, void);
// Controls
VclPtr<ComboBox> m_pDatasource;
VclPtr<PushButton> m_pAdministrateDatasources;
VclPtr<ComboBox> m_pTable;
VclPtr<ScrollBar> m_pFieldScroller;
// string to display for "no selection" // string to display for "no selection"
const OUString m_sNoFieldSelection; const OUString m_sNoFieldSelection;
...@@ -129,13 +113,18 @@ namespace svt ...@@ -129,13 +113,18 @@ namespace svt
css::uno::Reference< css::container::XNameAccess > css::uno::Reference< css::container::XNameAccess >
m_xCurrentDatasourceTables; m_xCurrentDatasourceTables;
// Controls
std::unique_ptr<weld::ComboBox> m_xDatasource;
std::unique_ptr<weld::Button> m_xAdministrateDatasources;
std::unique_ptr<weld::ComboBox> m_xTable;
std::unique_ptr<weld::ScrolledWindow> m_xFieldScroller;
std::unique_ptr<weld::Button> m_xOKButton;
std::unique_ptr<weld::Widget> m_xGrid;
std::unique_ptr<AddressBookSourceDialogData> m_pImpl; std::unique_ptr<AddressBookSourceDialogData> m_pImpl;
}; };
} // namespace svt } // namespace svt
#endif // INCLUDED_SVTOOLS_ADDRESSTEMPLATE_HXX #endif // INCLUDED_SVTOOLS_ADDRESSTEMPLATE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -666,8 +666,8 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) ...@@ -666,8 +666,8 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
case SID_TEMPLATE_ADDRESSBOKSOURCE: case SID_TEMPLATE_ADDRESSBOKSOURCE:
{ {
ScopedVclPtrInstance< svt::AddressBookSourceDialog > aDialog(GetTopWindow(), ::comphelper::getProcessComponentContext()); svt::AddressBookSourceDialog aDialog(rReq.GetFrameWeld(), ::comphelper::getProcessComponentContext());
aDialog->Execute(); aDialog.run();
bDone = true; bDone = true;
break; break;
} }
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/util/AliasProgrammaticPair.hpp> #include <com/sun/star/util/AliasProgrammaticPair.hpp>
#include <com/sun/star/sdbc/XDataSource.hpp> #include <com/sun/star/sdbc/XDataSource.hpp>
#include <toolkit/helper/vclunohelper.hxx> #include <vcl/svapp.hxx>
#include <rtl/ref.hxx> #include <rtl/ref.hxx>
using namespace svt; using namespace svt;
...@@ -114,13 +114,11 @@ namespace { ...@@ -114,13 +114,11 @@ namespace {
return xInfo; return xInfo;
} }
::cppu::IPropertyArrayHelper& OAddressBookSourceDialogUno::getInfoHelper() ::cppu::IPropertyArrayHelper& OAddressBookSourceDialogUno::getInfoHelper()
{ {
return *getArrayHelper(); return *getArrayHelper();
} }
::cppu::IPropertyArrayHelper* OAddressBookSourceDialogUno::createArrayHelper( ) const ::cppu::IPropertyArrayHelper* OAddressBookSourceDialogUno::createArrayHelper( ) const
{ {
Sequence< Property > aProps; Sequence< Property > aProps;
...@@ -128,13 +126,12 @@ namespace { ...@@ -128,13 +126,12 @@ namespace {
return new ::cppu::OPropertyArrayHelper(aProps); return new ::cppu::OPropertyArrayHelper(aProps);
} }
void OAddressBookSourceDialogUno::executedDialog(sal_Int16 _nExecutionResult) void OAddressBookSourceDialogUno::executedDialog(sal_Int16 _nExecutionResult)
{ {
OGenericUnoDialog::executedDialog(_nExecutionResult); OGenericUnoDialog::executedDialog(_nExecutionResult);
if ( _nExecutionResult && m_aDialog ) if ( _nExecutionResult && m_aDialog )
static_cast< AddressBookSourceDialog* >( m_aDialog.m_xVclDialog.get() )->getFieldMapping( m_aAliases ); static_cast<AddressBookSourceDialog*>(m_aDialog.m_xWeldDialog.get())->getFieldMapping(m_aAliases);
} }
void SAL_CALL OAddressBookSourceDialogUno::initialize(const Sequence< Any >& rArguments) void SAL_CALL OAddressBookSourceDialogUno::initialize(const Sequence< Any >& rArguments)
...@@ -199,16 +196,14 @@ namespace { ...@@ -199,16 +196,14 @@ namespace {
OGenericUnoDialog::implInitialize( _rValue ); OGenericUnoDialog::implInitialize( _rValue );
} }
svt::OGenericUnoDialog::Dialog OAddressBookSourceDialogUno::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent) svt::OGenericUnoDialog::Dialog OAddressBookSourceDialogUno::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
{ {
auto _pParent = VCLUnoHelper::GetWindow(rParent); weld::Window* pParent = Application::GetFrameWeld(rParent);
if ( m_xDataSource.is() && !m_sTable.isEmpty() ) if ( m_xDataSource.is() && !m_sTable.isEmpty() )
return svt::OGenericUnoDialog::Dialog(VclPtr<AddressBookSourceDialog>::Create(_pParent, m_aContext, m_xDataSource, m_sDataSourceName, m_sTable, m_aAliases)); return svt::OGenericUnoDialog::Dialog(std::make_unique<AddressBookSourceDialog>(pParent, m_aContext, m_xDataSource, m_sDataSourceName, m_sTable, m_aAliases));
else else
return svt::OGenericUnoDialog::Dialog(VclPtr<AddressBookSourceDialog>::Create(_pParent, m_aContext)); return svt::OGenericUnoDialog::Dialog(std::make_unique<AddressBookSourceDialog>(pParent, m_aContext));
} }
} }
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment