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 @@
#include <memory>
#include <svtools/svtdllapi.h>
#include <vcl/dialog.hxx>
#include <vcl/combobox.hxx>
#include <vcl/button.hxx>
#include <vcl/scrbar.hxx>
#include <vcl/weld.hxx>
namespace com :: sun :: star :: container { class XNameAccess; }
namespace com :: sun :: star :: sdbc { class XDataSource; }
......@@ -38,15 +35,12 @@ namespace com :: sun :: star :: util { struct AliasProgrammaticPair; }
namespace svt
{
// = AddressBookSourceDialog
struct AddressBookSourceDialogData;
class SVT_DLLPUBLIC AddressBookSourceDialog final : public ModalDialog
class SVT_DLLPUBLIC AddressBookSourceDialog final : public weld::GenericDialogController
{
public:
AddressBookSourceDialog( vcl::Window* _pParent,
AddressBookSourceDialog(weld::Window* _pParent,
const css::uno::Reference< css::uno::XComponentContext >& _rxORB );
/** if you use this ctor, the dialog
......@@ -68,7 +62,7 @@ namespace svt
the table name to display. It must refer to a valid table, relative to a connection
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::sdbc::XDataSource >& _rxTransientDS,
const OUString& _rDataSourceName,
......@@ -77,7 +71,6 @@ namespace svt
);
virtual ~AddressBookSourceDialog() override;
virtual void dispose() override;
// to be used if the object was constructed for editing a field mapping only
void getFieldMapping(
......@@ -86,12 +79,9 @@ namespace svt
private:
void implConstruct();
// Window overridables
virtual bool PreNotify( NotifyEvent& _rNEvt ) override;
// implementations
void implScrollFields(sal_Int32 _nPos, bool _bAdjustFocus, bool _bAdjustScrollbar);
static void implSelectField(ListBox* _pBox, const OUString& _rText);
void implScrollFields(sal_Int32 nPos, bool bAdjustFocus, bool bAdjustScrollbar);
static void implSelectField(weld::ComboBox* pBox, const OUString& rText);
void resetTables();
void resetFields();
......@@ -102,21 +92,15 @@ namespace svt
// initialize the dialog from the configuration data
void loadConfiguration();
DECL_LINK(OnFieldScroll, ScrollBar*, void);
DECL_LINK(OnFieldSelect, ListBox&, void);
DECL_LINK(OnAdministrateDatasources, Button*, void);
DECL_STATIC_LINK(AddressBookSourceDialog, OnComboGetFocus, Control&, void);
DECL_LINK(OnComboLoseFocus, Control&, void);
DECL_LINK(OnComboSelect, ComboBox&, void);
DECL_LINK(OnOkClicked, Button*, void);
DECL_LINK(OnFieldScroll, weld::ScrolledWindow&, void);
DECL_LINK(OnFieldSelect, weld::ComboBox&, void);
DECL_LINK(OnAdministrateDatasources, weld::Button&, void);
DECL_STATIC_LINK(AddressBookSourceDialog, OnComboGetFocus, weld::Widget&, void);
DECL_LINK(OnComboLoseFocus, weld::Widget&, void);
DECL_LINK(OnComboSelect, weld::ComboBox&, void);
DECL_LINK(OnOkClicked, weld::Button&, 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"
const OUString m_sNoFieldSelection;
......@@ -129,13 +113,18 @@ namespace svt
css::uno::Reference< css::container::XNameAccess >
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;
};
} // namespace svt
#endif // INCLUDED_SVTOOLS_ADDRESSTEMPLATE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -666,8 +666,8 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
case SID_TEMPLATE_ADDRESSBOKSOURCE:
{
ScopedVclPtrInstance< svt::AddressBookSourceDialog > aDialog(GetTopWindow(), ::comphelper::getProcessComponentContext());
aDialog->Execute();
svt::AddressBookSourceDialog aDialog(rReq.GetFrameWeld(), ::comphelper::getProcessComponentContext());
aDialog.run();
bDone = true;
break;
}
......
......@@ -26,7 +26,7 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/util/AliasProgrammaticPair.hpp>
#include <com/sun/star/sdbc/XDataSource.hpp>
#include <toolkit/helper/vclunohelper.hxx>
#include <vcl/svapp.hxx>
#include <rtl/ref.hxx>
using namespace svt;
......@@ -114,13 +114,11 @@ namespace {
return xInfo;
}
::cppu::IPropertyArrayHelper& OAddressBookSourceDialogUno::getInfoHelper()
{
return *getArrayHelper();
}
::cppu::IPropertyArrayHelper* OAddressBookSourceDialogUno::createArrayHelper( ) const
{
Sequence< Property > aProps;
......@@ -128,13 +126,12 @@ namespace {
return new ::cppu::OPropertyArrayHelper(aProps);
}
void OAddressBookSourceDialogUno::executedDialog(sal_Int16 _nExecutionResult)
{
OGenericUnoDialog::executedDialog(_nExecutionResult);
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)
......@@ -199,16 +196,14 @@ namespace {
OGenericUnoDialog::implInitialize( _rValue );
}
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() )
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
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 *
......
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