diff options
Diffstat (limited to 'extensions/source')
19 files changed, 241 insertions, 339 deletions
diff --git a/extensions/source/abpilot/abpfinalpage.cxx b/extensions/source/abpilot/abpfinalpage.cxx index e32374b7ed43..730b669e4062 100644 --- a/extensions/source/abpilot/abpfinalpage.cxx +++ b/extensions/source/abpilot/abpfinalpage.cxx @@ -42,28 +42,30 @@ namespace abp return pFilter; } - FinalPage::FinalPage( OAddressBookSourcePilot* _pParent ) - : AddressBookSourcePage(_pParent, "DataSourcePage", - "modules/sabpilot/ui/datasourcepage.ui") - { - get(m_pLocation, "location"); - get(m_pBrowse, "browse"); - get(m_pRegisterName, "available"); - get(m_pEmbed, "embed"); - get(m_pNameLabel, "nameft"); - get(m_pLocationLabel, "locationft"); - get(m_pName, "name"); - get(m_pDuplicateNameError, "warning"); - m_pLocationController.reset( new svx::DatabaseLocationInputController(_pParent->getORB(), - *m_pLocation, *m_pBrowse) ); - - m_pName->SetModifyHdl( LINK(this, FinalPage, OnNameModified) ); - m_pLocation->SetModifyHdl( LINK(this, FinalPage, OnNameModified) ); - m_pRegisterName->SetClickHdl( LINK( this, FinalPage, OnRegister ) ); - m_pRegisterName->Check(); - m_pEmbed->SetClickHdl( LINK( this, FinalPage, OnEmbed ) ); - m_pEmbed->Check(); - OnEmbed(m_pEmbed); + FinalPage::FinalPage(OAddressBookSourcePilot* pDialog, TabPageParent pPageParent) + : AddressBookSourcePage(pDialog, pPageParent, "modules/sabpilot/ui/datasourcepage.ui", + "DataSourcePage") + , m_xLocation(new URLBox(m_xBuilder->weld_combo_box("location"))) + , m_xBrowse(m_xBuilder->weld_button("browse")) + , m_xRegisterName(m_xBuilder->weld_check_button("available")) + , m_xEmbed(m_xBuilder->weld_check_button("embed")) + , m_xNameLabel(m_xBuilder->weld_label("nameft")) + , m_xLocationLabel(m_xBuilder->weld_label("locationft")) + , m_xName(m_xBuilder->weld_entry("name")) + , m_xDuplicateNameError(m_xBuilder->weld_label("warning")) + { + m_xLocation->SetSmartProtocol(INetProtocol::File); + m_xLocation->DisableHistory(); + + m_xLocationController.reset( new svx::DatabaseLocationInputController(pDialog->getORB(), + *m_xLocation, *m_xBrowse, *pPageParent.GetFrameWeld()) ); + + m_xName->connect_changed( LINK(this, FinalPage, OnEntryNameModified) ); + m_xLocation->connect_changed( LINK(this, FinalPage, OnComboNameModified) ); + m_xRegisterName->connect_clicked( LINK( this, FinalPage, OnRegister ) ); + m_xRegisterName->set_active(true); + m_xEmbed->connect_clicked( LINK( this, FinalPage, OnEmbed ) ); + m_xEmbed->set_active(true); } FinalPage::~FinalPage() @@ -73,21 +75,13 @@ namespace abp void FinalPage::dispose() { - m_pLocationController.reset(); - m_pLocation.clear(); - m_pBrowse.clear(); - m_pRegisterName.clear(); - m_pEmbed.clear(); - m_pNameLabel.clear(); - m_pLocationLabel.clear(); - m_pName.clear(); - m_pDuplicateNameError.clear(); + m_xLocationController.reset(); AddressBookSourcePage::dispose(); } bool FinalPage::isValidName() const { - OUString sCurrentName(m_pName->GetText()); + OUString sCurrentName(m_xName->get_text()); if (sCurrentName.isEmpty()) // the name must not be empty @@ -122,16 +116,16 @@ namespace abp } OSL_ENSURE( aURL.GetProtocol() != INetProtocol::NotValid ,"No valid file name!"); rSettings.sDataSourceName = aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ); - m_pLocationController->setURL( rSettings.sDataSourceName ); + m_xLocationController->setURL( rSettings.sDataSourceName ); OUString sName = aURL.getName( ); sal_Int32 nPos = sName.indexOf(aURL.GetFileExtension()); if ( nPos != -1 ) { sName = sName.replaceAt(nPos-1, 4, ""); } - m_pName->SetText(sName); + m_xName->set_text(sName); - OnRegister(m_pRegisterName); + OnRegister(*m_xRegisterName); } @@ -142,28 +136,26 @@ namespace abp setFields(); } - bool FinalPage::commitPage( ::vcl::WizardTypes::CommitPageReason _eReason ) { if (!AddressBookSourcePage::commitPage(_eReason)) return false; if ( ( ::vcl::WizardTypes::eTravelBackward != _eReason ) - && ( !m_pLocationController->prepareCommit() ) + && ( !m_xLocationController->prepareCommit() ) ) return false; AddressSettings& rSettings = getSettings(); - rSettings.sDataSourceName = m_pLocationController->getURL(); - rSettings.bRegisterDataSource = m_pRegisterName->IsChecked(); + rSettings.sDataSourceName = m_xLocationController->getURL(); + rSettings.bRegisterDataSource = m_xRegisterName->get_active(); if ( rSettings.bRegisterDataSource ) - rSettings.sRegisteredDataSourceName = m_pName->GetText(); - rSettings.bEmbedDataSource = m_pEmbed->IsChecked(); + rSettings.sRegisteredDataSourceName = m_xName->get_text(); + rSettings.bEmbedDataSource = m_xEmbed->get_active(); return true; } - void FinalPage::ActivatePage() { AddressBookSourcePage::ActivatePage(); @@ -173,12 +165,13 @@ namespace abp aContext.getDataSourceNames( m_aInvalidDataSourceNames ); // give the name edit the focus - m_pLocation->GrabFocus(); + m_xLocation->grab_focus(); // default the finish button getDialog()->defaultButton( WizardButtonFlags::FINISH ); - } + OnEmbed(*m_xEmbed); + } void FinalPage::DeactivatePage() { @@ -196,41 +189,43 @@ namespace abp return false; } - void FinalPage::implCheckName() { bool bValidName = isValidName(); - bool bEmptyName = m_pName->GetText().isEmpty(); - bool bEmptyLocation = m_pLocation->GetText().isEmpty(); + bool bEmptyName = m_xName->get_text().isEmpty(); + bool bEmptyLocation = m_xLocation->get_active_text().isEmpty(); // enable or disable the finish button - getDialog()->enableButtons( WizardButtonFlags::FINISH, !bEmptyLocation && (!m_pRegisterName->IsChecked() || bValidName) ); + getDialog()->enableButtons( WizardButtonFlags::FINISH, !bEmptyLocation && (!m_xRegisterName->get_active() || bValidName) ); // show the error message for an invalid name - m_pDuplicateNameError->Show( !bValidName && !bEmptyName ); + m_xDuplicateNameError->set_visible(!bValidName && !bEmptyName); } - - IMPL_LINK_NOARG( FinalPage, OnNameModified, Edit&, void ) + IMPL_LINK_NOARG( FinalPage, OnEntryNameModified, weld::Entry&, void ) { implCheckName(); } + IMPL_LINK_NOARG( FinalPage, OnComboNameModified, weld::ComboBox&, void ) + { + implCheckName(); + } - IMPL_LINK_NOARG(FinalPage, OnRegister, Button*, void) + IMPL_LINK_NOARG(FinalPage, OnRegister, weld::Button&, void) { - bool bEnable = m_pRegisterName->IsChecked(); - m_pNameLabel->Enable(bEnable); - m_pName->Enable(bEnable); + bool bEnable = m_xRegisterName->get_active(); + m_xNameLabel->set_sensitive(bEnable); + m_xName->set_sensitive(bEnable); implCheckName(); } - IMPL_LINK_NOARG(FinalPage, OnEmbed, Button*, void) + IMPL_LINK_NOARG(FinalPage, OnEmbed, weld::Button&, void) { - bool bEmbed = m_pEmbed->IsChecked(); - m_pLocationLabel->Enable(!bEmbed); - m_pLocation->Enable(!bEmbed); - m_pBrowse->Enable(!bEmbed); + bool bEmbed = m_xEmbed->get_active(); + m_xLocationLabel->set_sensitive(!bEmbed); + m_xLocation->set_sensitive(!bEmbed); + m_xBrowse->set_sensitive(!bEmbed); } } // namespace abp diff --git a/extensions/source/abpilot/abpfinalpage.hxx b/extensions/source/abpilot/abpfinalpage.hxx index 719d894be872..c44f6659e3ca 100644 --- a/extensions/source/abpilot/abpfinalpage.hxx +++ b/extensions/source/abpilot/abpfinalpage.hxx @@ -34,22 +34,22 @@ namespace abp class FinalPage final : public AddressBookSourcePage { - VclPtr< ::svt::OFileURLControl> m_pLocation; - VclPtr<PushButton> m_pBrowse; - VclPtr<CheckBox> m_pRegisterName; - VclPtr<CheckBox> m_pEmbed; - VclPtr<FixedText> m_pNameLabel; - VclPtr<FixedText> m_pLocationLabel; - VclPtr<Edit> m_pName; - VclPtr<FixedText> m_pDuplicateNameError; + std::unique_ptr<URLBox> m_xLocation; + std::unique_ptr<weld::Button> m_xBrowse; + std::unique_ptr<weld::CheckButton> m_xRegisterName; + std::unique_ptr<weld::CheckButton> m_xEmbed; + std::unique_ptr<weld::Label> m_xNameLabel; + std::unique_ptr<weld::Label> m_xLocationLabel; + std::unique_ptr<weld::Entry> m_xName; + std::unique_ptr<weld::Label> m_xDuplicateNameError; std::unique_ptr<svx::DatabaseLocationInputController> - m_pLocationController; + m_xLocationController; StringBag m_aInvalidDataSourceNames; public: - explicit FinalPage(OAddressBookSourcePilot* _pParent); + explicit FinalPage(OAddressBookSourcePilot* pDialog, TabPageParent pPageParent); virtual ~FinalPage() override; virtual void dispose() override; @@ -65,19 +65,18 @@ namespace abp // OImportPage overridables virtual bool canAdvance() const override; - DECL_LINK( OnNameModified, Edit&, void ); - DECL_LINK(OnRegister, Button*, void); - DECL_LINK(OnEmbed, Button*, void); + DECL_LINK(OnEntryNameModified, weld::Entry&, void); + DECL_LINK(OnComboNameModified, weld::ComboBox&, void); + DECL_LINK(OnRegister, weld::Button&, void); + DECL_LINK(OnEmbed, weld::Button&, void); - bool isValidName() const; - void implCheckName(); - void setFields(); + bool isValidName() const; + void implCheckName(); + void setFields(); }; - } // namespace abp - #endif // INCLUDED_EXTENSIONS_SOURCE_ABPILOT_ABPFINALPAGE_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/abspage.cxx b/extensions/source/abpilot/abspage.cxx index b62d13f52b17..33770402a664 100644 --- a/extensions/source/abpilot/abspage.cxx +++ b/extensions/source/abpilot/abspage.cxx @@ -29,48 +29,49 @@ namespace abp using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; - AddressBookSourcePage::AddressBookSourcePage(OAddressBookSourcePilot* _pParent, const OString& rID, const OUString& rUIXMLDescription) - :AddressBookSourcePage_Base(_pParent, rID, rUIXMLDescription) + AddressBookSourcePage::AddressBookSourcePage(OAddressBookSourcePilot* pParent, TabPageParent pPageParent, const OUString& rUIXMLDescription, const OString& rID) + : AddressBookSourcePage_Base(pPageParent, rUIXMLDescription, rID) + , m_pDialog(pParent) { } + void AddressBookSourcePage::ActivatePage() + { + AddressBookSourcePage_Base::ActivatePage(); + m_pDialog->updateTravelUI(); + } + void AddressBookSourcePage::DeactivatePage() { AddressBookSourcePage_Base::DeactivatePage(); - getDialog()->enableButtons(WizardButtonFlags::NEXT, true); + m_pDialog->enableButtons(WizardButtonFlags::NEXT, true); } - OAddressBookSourcePilot* AddressBookSourcePage::getDialog() { - return static_cast<OAddressBookSourcePilot*>(GetParent()); + return m_pDialog; } - const OAddressBookSourcePilot* AddressBookSourcePage::getDialog() const { - return static_cast<const OAddressBookSourcePilot*>(GetParent()); + return m_pDialog; } - AddressSettings& AddressBookSourcePage::getSettings() { - return getDialog()->getSettings(); + return m_pDialog->getSettings(); } - const AddressSettings& AddressBookSourcePage::getSettings() const { - return getDialog()->getSettings(); + return m_pDialog->getSettings(); } - const Reference< XComponentContext > & AddressBookSourcePage::getORB() { - return getDialog()->getORB(); + return m_pDialog->getORB(); } - } // namespace abp diff --git a/extensions/source/abpilot/abspage.hxx b/extensions/source/abpilot/abspage.hxx index 257e9735b858..89f50fbd2112 100644 --- a/extensions/source/abpilot/abspage.hxx +++ b/extensions/source/abpilot/abspage.hxx @@ -38,19 +38,22 @@ namespace abp /// the base class for all tab pages in the address book source wizard class AddressBookSourcePage : public AddressBookSourcePage_Base { + OAddressBookSourcePilot* m_pDialog; + protected: - AddressBookSourcePage(OAddressBookSourcePilot *pParent, const OString& rID, const OUString& rUIXMLDescription); + AddressBookSourcePage(OAddressBookSourcePilot *pParent, TabPageParent pPageParent, const OUString& rUIXMLDescription, const OString& rID); protected: // helper OAddressBookSourcePilot* getDialog(); - const OAddressBookSourcePilot* getDialog() const; + const OAddressBookSourcePilot* getDialog() const; const css::uno::Reference< css::uno::XComponentContext > & getORB(); AddressSettings& getSettings(); const AddressSettings& getSettings() const; // TabDialog overridables + virtual void ActivatePage() override; virtual void DeactivatePage() override; }; diff --git a/extensions/source/abpilot/abspilot.cxx b/extensions/source/abpilot/abspilot.cxx index faf99e5184da..e7d929a8dd98 100644 --- a/extensions/source/abpilot/abspilot.cxx +++ b/extensions/source/abpilot/abspilot.cxx @@ -50,21 +50,16 @@ namespace abp #define PATH_NO_FIELDS 3 #define PATH_NO_SETTINGS_NO_FIELDS 4 -#define WINDOW_SIZE_X 240 -#define WINDOW_SIZE_Y 185 - using namespace ::svt; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; - OAddressBookSourcePilot::OAddressBookSourcePilot(vcl::Window* _pParent, const Reference< XComponentContext >& _rxORB) + OAddressBookSourcePilot::OAddressBookSourcePilot(weld::Window* _pParent, const Reference< XComponentContext >& _rxORB) :OAddressBookSourcePilot_Base( _pParent ) ,m_xORB(_rxORB) ,m_aNewDataSource(_rxORB) ,m_eNewDataSourceType( AST_INVALID ) { - SetPageSizePixel(LogicToPixel(Size(WINDOW_SIZE_X, WINDOW_SIZE_Y), MapMode(MapUnit::MapAppFont))); - declarePath( PATH_COMPLETE, {STATE_SELECT_ABTYPE, STATE_INVOKE_ADMIN_DIALOG, @@ -90,13 +85,11 @@ namespace abp STATE_FINAL_CONFIRM} ); - m_pPrevPage->SetHelpId(HID_ABSPILOT_PREVIOUS); - m_pNextPage->SetHelpId(HID_ABSPILOT_NEXT); - m_pCancel->SetHelpId(HID_ABSPILOT_CANCEL); - m_pFinish->SetHelpId(HID_ABSPILOT_FINISH); - m_pHelp->SetHelpId(UID_ABSPILOT_HELP); - - m_pCancel->SetClickHdl( LINK( this, OAddressBookSourcePilot, OnCancelClicked) ); + m_xPrevPage->set_help_id(HID_ABSPILOT_PREVIOUS); + m_xNextPage->set_help_id(HID_ABSPILOT_NEXT); + m_xCancel->set_help_id(HID_ABSPILOT_CANCEL); + m_xFinish->set_help_id(HID_ABSPILOT_FINISH); + m_xHelp->set_help_id(UID_ABSPILOT_HELP); // some initial settings #ifdef UNX @@ -117,12 +110,13 @@ namespace abp defaultButton(WizardButtonFlags::NEXT); enableButtons(WizardButtonFlags::FINISH, false); ActivatePage(); + m_xAssistant->set_current_page(0); typeSelectionChanged( m_aSettings.eType ); OUString sDialogTitle = compmodule::ModuleRes(RID_STR_ABSOURCEDIALOGTITLE); setTitleBase(sDialogTitle); - SetHelpId(HID_ABSPILOT); + m_xAssistant->set_help_id(HID_ABSPILOT); } OUString OAddressBookSourcePilot::getStateDisplayName( WizardState _nState ) const @@ -147,7 +141,6 @@ namespace abp return sDisplayName; } - void OAddressBookSourcePilot::implCommitAll() { // in real, the data source already exists in the data source context @@ -169,34 +162,21 @@ namespace abp fieldmapping::writeTemplateAddressFieldMapping( getORB(), m_aSettings.aFieldMapping ); } - void OAddressBookSourcePilot::implCleanup() { if ( m_aNewDataSource.isValid() ) m_aNewDataSource.remove(); } - - IMPL_LINK_NOARG( OAddressBookSourcePilot, OnCancelClicked, Button*, void ) + short OAddressBookSourcePilot::run() { - // do cleanups - implCleanup(); - - // reset the click hdl - m_pCancel->SetClickHdl( Link<Button*, void>() ); - // simulate the click again - this time, the default handling of the button will strike .... - m_pCancel->Click(); - } + short nRet = OAddressBookSourcePilot_Base::run(); - - bool OAddressBookSourcePilot::Close() - { implCleanup(); - return OAddressBookSourcePilot_Base::Close(); + return nRet; } - bool OAddressBookSourcePilot::onFinish() { if ( !OAddressBookSourcePilot_Base::onFinish() ) @@ -209,7 +189,6 @@ namespace abp return true; } - void OAddressBookSourcePilot::enterState( WizardState _nState ) { switch ( _nState ) @@ -264,7 +243,7 @@ namespace abp if ( aTables.empty() ) { - std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xAssistant.get(), VclMessageType::Question, VclButtonsType::YesNo, compmodule::ModuleRes(getSettings().eType == AST_EVOLUTION_GROUPWISE ? RID_STR_QRY_NO_EVO_GW : RID_STR_QRY_NOTABLES))); @@ -289,7 +268,6 @@ namespace abp return bAllow; } - void OAddressBookSourcePilot::implDefaultTableName() { const StringBag& rTableNames = getDataSource().getTableNames(); @@ -314,7 +292,6 @@ namespace abp getSettings().sSelectedTable = sGuess; } - void OAddressBookSourcePilot::implDoAutoFieldMapping() { DBG_ASSERT( !needManualFieldMapping( ), "OAddressBookSourcePilot::implDoAutoFieldMapping: invalid call!" ); @@ -322,7 +299,6 @@ namespace abp fieldmapping::defaultMapping( getORB(), m_aSettings.aFieldMapping ); } - void OAddressBookSourcePilot::implCreateDataSource() { if (m_aNewDataSource.isValid()) @@ -379,44 +355,52 @@ namespace abp m_eNewDataSourceType = m_aSettings.eType; } - bool OAddressBookSourcePilot::connectToDataSource( bool _bForceReConnect ) { DBG_ASSERT( m_aNewDataSource.isValid(), "OAddressBookSourcePilot::implConnect: invalid current data source!" ); - WaitObject aWaitCursor( this ); + weld::WaitObject aWaitCursor(m_xAssistant.get()); if ( _bForceReConnect && m_aNewDataSource.isConnected( ) ) m_aNewDataSource.disconnect( ); - return m_aNewDataSource.connect(GetFrameWeld()); + return m_aNewDataSource.connect(m_xAssistant.get()); } - VclPtr<TabPage> OAddressBookSourcePilot::createPage(WizardState _nState) { + OString sIdent(OString::number(_nState)); + weld::Container* pPageContainer = m_xAssistant->append_page(sIdent); + // TODO eventually pass DialogController as distinct argument instead of bundling into TabPageParent + TabPageParent aParent(pPageContainer, this); + + VclPtr<vcl::OWizardPage> pRet; + switch (_nState) { case STATE_SELECT_ABTYPE: - return VclPtr<TypeSelectionPage>::Create( this ); - + pRet = VclPtr<TypeSelectionPage>::Create( this, aParent ); + break; case STATE_INVOKE_ADMIN_DIALOG: - return VclPtr<AdminDialogInvokationPage>::Create( this ); - + pRet = VclPtr<AdminDialogInvokationPage>::Create( this, aParent ); + break; case STATE_TABLE_SELECTION: - return VclPtr<TableSelectionPage>::Create( this ); - + pRet = VclPtr<TableSelectionPage>::Create( this, aParent ); + break; case STATE_MANUAL_FIELD_MAPPING: - return VclPtr<FieldMappingPage>::Create( this ); - + pRet = VclPtr<FieldMappingPage>::Create( this, aParent ); + break; case STATE_FINAL_CONFIRM: - return VclPtr<FinalPage>::Create( this ); - + pRet = VclPtr<FinalPage>::Create( this, aParent ); + break; default: - OSL_FAIL("OAddressBookSourcePilot::createPage: invalid state!"); - return nullptr; + assert(false && "OAddressBookSourcePilot::createPage: invalid state!"); + break; } - } + m_xAssistant->set_page_title(sIdent, getStateDisplayName(_nState)); + + return pRet; + } void OAddressBookSourcePilot::impl_updateRoadmap( AddressSourceType _eType ) { @@ -446,7 +430,6 @@ namespace abp ); } - void OAddressBookSourcePilot::typeSelectionChanged( AddressSourceType _eType ) { PathId nCurrentPathID( PATH_COMPLETE ); @@ -469,7 +452,6 @@ namespace abp impl_updateRoadmap( _eType ); } - } // namespace abp diff --git a/extensions/source/abpilot/abspilot.hxx b/extensions/source/abpilot/abspilot.hxx index a161181e2518..2ad80c3cdc77 100644 --- a/extensions/source/abpilot/abspilot.hxx +++ b/extensions/source/abpilot/abspilot.hxx @@ -29,7 +29,7 @@ namespace abp { - typedef ::vcl::RoadmapWizard OAddressBookSourcePilot_Base; + typedef ::vcl::RoadmapWizardMachine OAddressBookSourcePilot_Base; class OAddressBookSourcePilot final : public OAddressBookSourcePilot_Base { css::uno::Reference< css::uno::XComponentContext > @@ -42,9 +42,11 @@ namespace abp public: /// ctor OAddressBookSourcePilot( - vcl::Window* _pParent, + weld::Window* _pParent, const css::uno::Reference< css::uno::XComponentContext >& _rxORB); + virtual short run() override; + /// get the service factory which was used to create the dialog const css::uno::Reference< css::uno::XComponentContext >& getORB() { return m_xORB; } @@ -70,10 +72,6 @@ namespace abp // RoadmapWizard virtual OUString getStateDisplayName( WizardState _nState ) const override; - virtual bool Close() override; - - DECL_LINK( OnCancelClicked, Button*, void ); - /** creates a new data source of the type indicated by m_aSettings <p>If another data source has been created before, this one is deleted.</p> */ diff --git a/extensions/source/abpilot/admininvokationimpl.cxx b/extensions/source/abpilot/admininvokationimpl.cxx index 4795c05e6b95..6243acce482a 100644 --- a/extensions/source/abpilot/admininvokationimpl.cxx +++ b/extensions/source/abpilot/admininvokationimpl.cxx @@ -45,8 +45,8 @@ namespace abp using namespace ::com::sun::star::sdbc; OAdminDialogInvokation::OAdminDialogInvokation(const Reference< XComponentContext >& _rxContext, - const css::uno::Reference< css::beans::XPropertySet >& _rxDataSource - , vcl::Window* _pMessageParent) + const css::uno::Reference< css::beans::XPropertySet >& _rxDataSource, + weld::Window* _pMessageParent) :m_xContext(_rxContext) ,m_xDataSource(_rxDataSource) ,m_pMessageParent(_pMessageParent) @@ -71,7 +71,7 @@ namespace abp // the parameters for the call Sequence<Any> aArguments(comphelper::InitAnyPropertySequence( { - {"ParentWindow", Any(VCLUnoHelper::GetInterface(m_pMessageParent))}, + {"ParentWindow", Any(m_pMessageParent->GetXWindow())}, {"Title", Any(compmodule::ModuleRes(RID_STR_ADMINDIALOGTITLE))}, {"InitialSelection", Any(m_xDataSource)}, // the name of the new data source })); @@ -82,7 +82,7 @@ namespace abp { // creating the dialog service is potentially expensive (if all the libraries invoked need to be loaded) // so we display a wait cursor - WaitObject aWaitCursor(m_pMessageParent); + weld::WaitObject aWaitCursor(m_pMessageParent); Reference<XInterface> x = m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(s_sDataSourceTypeChangeDialog, aArguments, m_xContext); xDialog.set( x, UNO_QUERY ); @@ -103,7 +103,7 @@ namespace abp return true; } else - ShowServiceNotAvailableError(m_pMessageParent->GetFrameWeld(), s_sAdministrationServiceName, true); + ShowServiceNotAvailableError(m_pMessageParent, s_sAdministrationServiceName, true); } catch(const Exception&) { diff --git a/extensions/source/abpilot/admininvokationimpl.hxx b/extensions/source/abpilot/admininvokationimpl.hxx index e0124a6ba4df..fb7642ded503 100644 --- a/extensions/source/abpilot/admininvokationimpl.hxx +++ b/extensions/source/abpilot/admininvokationimpl.hxx @@ -22,9 +22,8 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/beans/XPropertySet.hpp> -#include <vcl/vclptr.hxx> -namespace vcl { class Window; } +namespace weld { class Window; } namespace abp { @@ -37,13 +36,13 @@ namespace abp css::uno::Reference< css::uno::XComponentContext > m_xContext; css::uno::Reference< css::beans::XPropertySet > m_xDataSource; - VclPtr<vcl::Window> m_pMessageParent; + weld::Window* m_pMessageParent; public: OAdminDialogInvokation( const css::uno::Reference< css::uno::XComponentContext >& _rxContext, const css::uno::Reference< css::beans::XPropertySet >& _rDataSource, - vcl::Window* _pMessageParent + weld::Window* _pMessageParent ); bool invokeAdministration(); diff --git a/extensions/source/abpilot/admininvokationpage.cxx b/extensions/source/abpilot/admininvokationpage.cxx index 4cd97989a108..5658677ef63d 100644 --- a/extensions/source/abpilot/admininvokationpage.cxx +++ b/extensions/source/abpilot/admininvokationpage.cxx @@ -23,40 +23,34 @@ namespace abp { - AdminDialogInvokationPage::AdminDialogInvokationPage( OAddressBookSourcePilot* _pParent ) - : AddressBookSourcePage(_pParent, "InvokeAdminPage", - "modules/sabpilot/ui/invokeadminpage.ui") + AdminDialogInvokationPage::AdminDialogInvokationPage(OAddressBookSourcePilot* pDialog, TabPageParent pPageParent) + : AddressBookSourcePage(pDialog, pPageParent, "modules/sabpilot/ui/invokeadminpage.ui", "InvokeAdminPage") + , m_xInvokeAdminDialog(m_xBuilder->weld_button("settings")) + , m_xErrorMessage(m_xBuilder->weld_label("warning")) { - get(m_pInvokeAdminDialog, "settings"); - get(m_pErrorMessage, "warning"); - m_pInvokeAdminDialog->SetClickHdl( LINK(this, AdminDialogInvokationPage, OnInvokeAdminDialog) ); + m_xInvokeAdminDialog->connect_clicked(LINK(this, AdminDialogInvokationPage, OnInvokeAdminDialog)); } + AdminDialogInvokationPage::~AdminDialogInvokationPage() { - disposeOnce(); - } - void AdminDialogInvokationPage::dispose() - { - m_pInvokeAdminDialog.clear(); - m_pErrorMessage.clear(); - AddressBookSourcePage::dispose(); } + void AdminDialogInvokationPage::ActivatePage() { AddressBookSourcePage::ActivatePage(); - m_pInvokeAdminDialog->GrabFocus(); + m_xInvokeAdminDialog->grab_focus(); } void AdminDialogInvokationPage::implUpdateErrorMessage() { const bool bIsConnected = getDialog()->getDataSource().isConnected(); - m_pErrorMessage->Show( !bIsConnected ); + m_xErrorMessage->set_visible( !bIsConnected ); } void AdminDialogInvokationPage::initializePage() { AddressBookSourcePage::initializePage(); - m_pErrorMessage->Hide(); + m_xErrorMessage->hide(); // if we're entering this page, we assume we had no connection trial with this data source } @@ -81,9 +75,9 @@ namespace abp } // davido: Do we need it? - IMPL_LINK_NOARG( AdminDialogInvokationPage, OnInvokeAdminDialog, Button*, void ) + IMPL_LINK_NOARG(AdminDialogInvokationPage, OnInvokeAdminDialog, weld::Button&, void) { - OAdminDialogInvokation aInvokation( getORB(), getDialog()->getDataSource().getDataSource(), getDialog() ); + OAdminDialogInvokation aInvokation(getORB(), getDialog()->getDataSource().getDataSource(), getDialog()->getDialog()); if ( aInvokation.invokeAdministration() ) { // try to connect to this data source diff --git a/extensions/source/abpilot/admininvokationpage.hxx b/extensions/source/abpilot/admininvokationpage.hxx index 22e8ac21cdb0..c29b3dad75a2 100644 --- a/extensions/source/abpilot/admininvokationpage.hxx +++ b/extensions/source/abpilot/admininvokationpage.hxx @@ -27,13 +27,12 @@ namespace abp { class AdminDialogInvokationPage final : public AddressBookSourcePage { - VclPtr<PushButton> m_pInvokeAdminDialog; - VclPtr<FixedText> m_pErrorMessage; + std::unique_ptr<weld::Button> m_xInvokeAdminDialog; + std::unique_ptr<weld::Label> m_xErrorMessage; public: - explicit AdminDialogInvokationPage(OAddressBookSourcePilot* _pParent); + explicit AdminDialogInvokationPage(OAddressBookSourcePilot* pDialog, TabPageParent pPageParent); virtual ~AdminDialogInvokationPage() override; - virtual void dispose() override; private: // TabDialog overridables virtual void ActivatePage() override; @@ -42,16 +41,14 @@ namespace abp // OImportPage overridables virtual bool canAdvance() const override; - DECL_LINK( OnInvokeAdminDialog, Button*, void ); + DECL_LINK( OnInvokeAdminDialog, weld::Button&, void ); void implTryConnect(); void implUpdateErrorMessage(); }; - } // namespace abp - #endif // INCLUDED_EXTENSIONS_SOURCE_ABPILOT_ADMININVOKATIONPAGE_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/fieldmappingimpl.cxx b/extensions/source/abpilot/fieldmappingimpl.cxx index d1ed34353752..dc81dee64764 100644 --- a/extensions/source/abpilot/fieldmappingimpl.cxx +++ b/extensions/source/abpilot/fieldmappingimpl.cxx @@ -26,8 +26,8 @@ #include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/sdb/CommandType.hpp> #include <tools/debug.hxx> -#include <toolkit/helper/vclunohelper.hxx> #include <vcl/stdtext.hxx> +#include <vcl/weld.hxx> #include <com/sun/star/util/AliasProgrammaticPair.hpp> #include <strings.hrc> #include <componentmodule.hxx> @@ -55,12 +55,9 @@ namespace abp static const char sDriverSettingsNodeName[] = "/org.openoffice.Office.DataAccess/DriverSettings/com.sun.star.comp.sdbc.MozabDriver"; static const char sAddressBookNodeName[] = "/org.openoffice.Office.DataAccess/AddressBook"; - namespace fieldmapping { - - - bool invokeDialog( const Reference< XComponentContext >& _rxORB, class vcl::Window* _pParent, + bool invokeDialog( const Reference< XComponentContext >& _rxORB, class weld::Window* _pParent, const Reference< XPropertySet >& _rxDataSource, AddressSettings& _rSettings ) { _rSettings.aFieldMapping.clear(); @@ -74,7 +71,7 @@ namespace abp { // create an instance of the dialog service - Reference< XWindow > xDialogParent = VCLUnoHelper::GetInterface( _pParent ); + Reference< XWindow > xDialogParent = _pParent->GetXWindow(); OUString sTitle(compmodule::ModuleRes(RID_STR_FIELDDIALOGTITLE)); Reference< XExecutableDialog > xDialog = AddressBookSourceDialog::createWithDataSource(_rxORB, // the parent window diff --git a/extensions/source/abpilot/fieldmappingimpl.hxx b/extensions/source/abpilot/fieldmappingimpl.hxx index 3cbe2919bb3a..4d0b26e9c166 100644 --- a/extensions/source/abpilot/fieldmappingimpl.hxx +++ b/extensions/source/abpilot/fieldmappingimpl.hxx @@ -36,8 +36,7 @@ namespace com { namespace sun { namespace star { class XPropertySet; } } } } -namespace vcl { class Window; } - +namespace weld { class Window; } namespace abp { @@ -59,7 +58,7 @@ namespace abp */ bool invokeDialog( const css::uno::Reference< css::uno::XComponentContext >& _rxORB, - class vcl::Window* _pParent, + class weld::Window* _pParent, const css::uno::Reference< css::beans::XPropertySet >& _rxDataSource, AddressSettings& _rSettings ); diff --git a/extensions/source/abpilot/fieldmappingpage.cxx b/extensions/source/abpilot/fieldmappingpage.cxx index d0962e8f85c0..93a2ca733bda 100644 --- a/extensions/source/abpilot/fieldmappingpage.cxx +++ b/extensions/source/abpilot/fieldmappingpage.cxx @@ -25,58 +25,45 @@ namespace abp { - FieldMappingPage::FieldMappingPage( OAddressBookSourcePilot* _pParent ) - : AddressBookSourcePage(_pParent, "FieldAssignPage", - "modules/sabpilot/ui/fieldassignpage.ui") + FieldMappingPage::FieldMappingPage(OAddressBookSourcePilot* pDialog, TabPageParent pPageParent) + : AddressBookSourcePage(pDialog, pPageParent, "modules/sabpilot/ui/fieldassignpage.ui", "FieldAssignPage") + , m_xInvokeDialog(m_xBuilder->weld_button("assign")) + , m_xHint(m_xBuilder->weld_label("hint")) { - get(m_pInvokeDialog, "assign"); - get(m_pHint, "hint"); - - m_pInvokeDialog->SetClickHdl( LINK( this, FieldMappingPage, OnInvokeDialog ) ); + m_xInvokeDialog->connect_clicked(LINK(this, FieldMappingPage, OnInvokeDialog)); } FieldMappingPage::~FieldMappingPage() { - disposeOnce(); - } - - void FieldMappingPage::dispose() - { - m_pInvokeDialog.clear(); - m_pHint.clear(); - AddressBookSourcePage::dispose(); } void FieldMappingPage::ActivatePage() { AddressBookSourcePage::ActivatePage(); - m_pInvokeDialog->GrabFocus(); + m_xInvokeDialog->grab_focus(); } - void FieldMappingPage::initializePage() { AddressBookSourcePage::initializePage(); implUpdateHint(); } - void FieldMappingPage::implUpdateHint() { const AddressSettings& rSettings = getSettings(); OUString sHint; if ( rSettings.aFieldMapping.empty() ) sHint = compmodule::ModuleRes(RID_STR_NOFIELDSASSIGNED); - m_pHint->SetText( sHint ); + m_xHint->set_label(sHint); } - - IMPL_LINK_NOARG( FieldMappingPage, OnInvokeDialog, Button*, void ) + IMPL_LINK_NOARG( FieldMappingPage, OnInvokeDialog, weld::Button&, void ) { AddressSettings& rSettings = getSettings(); // invoke the dialog doing the mapping - if ( fieldmapping::invokeDialog( getORB(), this, getDialog()->getDataSource().getDataSource(), rSettings ) ) + if ( fieldmapping::invokeDialog( getORB(), getDialog()->getDialog(), getDialog()->getDataSource().getDataSource(), rSettings ) ) { if ( !rSettings.aFieldMapping.empty() ) getDialog()->travelNext(); @@ -85,8 +72,6 @@ namespace abp } } - } // namespace abp - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/fieldmappingpage.hxx b/extensions/source/abpilot/fieldmappingpage.hxx index 8623b6d21220..8aaebbefbfee 100644 --- a/extensions/source/abpilot/fieldmappingpage.hxx +++ b/extensions/source/abpilot/fieldmappingpage.hxx @@ -21,21 +21,17 @@ #define INCLUDED_EXTENSIONS_SOURCE_ABPILOT_FIELDMAPPINGPAGE_HXX #include "abspage.hxx" -#include <vcl/vclptr.hxx> - +#include <vcl/weld.hxx> namespace abp { - class FieldMappingPage final : public AddressBookSourcePage { - VclPtr<PushButton> m_pInvokeDialog; - VclPtr<FixedText> m_pHint; - + std::unique_ptr<weld::Button> m_xInvokeDialog; + std::unique_ptr<weld::Label> m_xHint; public: - explicit FieldMappingPage(OAddressBookSourcePilot* _pParent); + explicit FieldMappingPage(OAddressBookSourcePilot* pDialog, TabPageParent pPageParent); virtual ~FieldMappingPage() override; - virtual void dispose() override; private: // OWizardPage overridables virtual void initializePage() override; @@ -43,12 +39,10 @@ namespace abp // TabDialog overridables virtual void ActivatePage() override; - DECL_LINK( OnInvokeDialog, Button*, void ); + DECL_LINK(OnInvokeDialog, weld::Button&, void); void implUpdateHint(); }; - - } // namespace abp diff --git a/extensions/source/abpilot/tableselectionpage.cxx b/extensions/source/abpilot/tableselectionpage.cxx index 7e68a65e88e9..3d56a33fb8bf 100644 --- a/extensions/source/abpilot/tableselectionpage.cxx +++ b/extensions/source/abpilot/tableselectionpage.cxx @@ -27,41 +27,32 @@ namespace abp { - TableSelectionPage::TableSelectionPage( OAddressBookSourcePilot* _pParent ) - :AddressBookSourcePage(_pParent, "SelectTablePage", - "modules/sabpilot/ui/selecttablepage.ui") + TableSelectionPage::TableSelectionPage(OAddressBookSourcePilot* pDialog, TabPageParent pPageParent) + : AddressBookSourcePage(pDialog, pPageParent, "modules/sabpilot/ui/selecttablepage.ui", "SelectTablePage") + , m_xTableList(m_xBuilder->weld_tree_view("table")) { - get(m_pTableList, "table"); - m_pTableList->SetSelectHdl( LINK( this, TableSelectionPage, OnTableSelected ) ); - m_pTableList->SetDoubleClickHdl( LINK( this, TableSelectionPage, OnTableDoubleClicked ) ); + m_xTableList->connect_changed( LINK( this, TableSelectionPage, OnTableSelected ) ); + m_xTableList->connect_row_activated( LINK( this, TableSelectionPage, OnTableDoubleClicked ) ); } TableSelectionPage::~TableSelectionPage() { - disposeOnce(); - } - - void TableSelectionPage::dispose() - { - m_pTableList.clear(); - AddressBookSourcePage::dispose(); } void TableSelectionPage::ActivatePage() { AddressBookSourcePage::ActivatePage(); - m_pTableList->GrabFocus(); + m_xTableList->grab_focus(); } - void TableSelectionPage::initializePage() { AddressBookSourcePage::initializePage(); const AddressSettings& rSettings = getSettings(); - m_pTableList->Clear(); + m_xTableList->clear(); // get the table names const StringBag& aTableNames = getDialog()->getDataSource().getTableNames(); @@ -70,46 +61,40 @@ namespace abp // fill the list for (auto const& tableName : aTableNames) - m_pTableList->InsertEntry(tableName); + m_xTableList->append_text(tableName); // initially select the proper table - m_pTableList->SelectEntry( rSettings.sSelectedTable ); + m_xTableList->select_text(rSettings.sSelectedTable); } - - IMPL_LINK_NOARG( TableSelectionPage, OnTableDoubleClicked, ListBox&, void ) + IMPL_LINK_NOARG( TableSelectionPage, OnTableDoubleClicked, weld::TreeView&, void ) { - if ( 1 == m_pTableList->GetSelectedEntryCount() ) + if (m_xTableList->count_selected_rows() == 1) getDialog()->travelNext(); } - - IMPL_LINK_NOARG( TableSelectionPage, OnTableSelected, ListBox&, void ) + IMPL_LINK_NOARG( TableSelectionPage, OnTableSelected, weld::TreeView&, void ) { updateDialogTravelUI(); } - bool TableSelectionPage::commitPage( ::vcl::WizardTypes::CommitPageReason _eReason ) { if (!AddressBookSourcePage::commitPage(_eReason)) return false; AddressSettings& rSettings = getSettings(); - rSettings.sSelectedTable = m_pTableList->GetSelectedEntry(); + rSettings.sSelectedTable = m_xTableList->get_selected_text(); return true; } - bool TableSelectionPage::canAdvance() const { return AddressBookSourcePage::canAdvance() - && ( 0 < m_pTableList->GetSelectedEntryCount() ); + && (m_xTableList->count_selected_rows() > 0); } - } // namespace abp - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/tableselectionpage.hxx b/extensions/source/abpilot/tableselectionpage.hxx index 9f58ea945976..f25258bc894a 100644 --- a/extensions/source/abpilot/tableselectionpage.hxx +++ b/extensions/source/abpilot/tableselectionpage.hxx @@ -21,21 +21,17 @@ #define INCLUDED_EXTENSIONS_SOURCE_ABPILOT_TABLESELECTIONPAGE_HXX #include "abspage.hxx" -#include <vcl/lstbox.hxx> -#include <vcl/vclptr.hxx> - +#include <vcl/weld.hxx> namespace abp { - class TableSelectionPage final : public AddressBookSourcePage { - VclPtr<ListBox> m_pTableList; + std::unique_ptr<weld::TreeView> m_xTableList; public: - explicit TableSelectionPage( OAddressBookSourcePilot* _pParent ); + explicit TableSelectionPage(OAddressBookSourcePilot* pDialog, TabPageParent pPageParent); virtual ~TableSelectionPage() override; - virtual void dispose() override; private: // OWizardPage overridables virtual void initializePage() override; @@ -47,14 +43,12 @@ namespace abp // OImportPage overridables virtual bool canAdvance() const override; - DECL_LINK( OnTableSelected, ListBox&, void ); - DECL_LINK( OnTableDoubleClicked, ListBox&, void ); + DECL_LINK(OnTableSelected, weld::TreeView&, void); + DECL_LINK(OnTableDoubleClicked, weld::TreeView&, void); }; - } // namespace abp - #endif // INCLUDED_EXTENSIONS_SOURCE_ABPILOT_TABLESELECTIONPAGE_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/typeselectionpage.cxx b/extensions/source/abpilot/typeselectionpage.cxx index ae72d77a3ce1..a9f68fd1afd3 100644 --- a/extensions/source/abpilot/typeselectionpage.cxx +++ b/extensions/source/abpilot/typeselectionpage.cxx @@ -31,19 +31,17 @@ namespace abp using namespace ::com::sun::star::sdbc; // TypeSelectionPage - TypeSelectionPage::TypeSelectionPage( OAddressBookSourcePilot* _pParent ) - : AddressBookSourcePage(_pParent, "SelectTypePage", - "modules/sabpilot/ui/selecttypepage.ui") + TypeSelectionPage::TypeSelectionPage(OAddressBookSourcePilot* pDialog, TabPageParent pPageParent) + : AddressBookSourcePage(pDialog, pPageParent, "modules/sabpilot/ui/selecttypepage.ui", "SelectTypePage") + , m_xEvolution(m_xBuilder->weld_radio_button("evolution")) + , m_xEvolutionGroupwise(m_xBuilder->weld_radio_button("groupwise")) + , m_xEvolutionLdap(m_xBuilder->weld_radio_button("evoldap")) + , m_xMORK(m_xBuilder->weld_radio_button("firefox")) + , m_xThunderbird(m_xBuilder->weld_radio_button("thunderbird")) + , m_xKab(m_xBuilder->weld_radio_button("kde")) + , m_xMacab(m_xBuilder->weld_radio_button("macosx")) + , m_xOther(m_xBuilder->weld_radio_button("other")) { - get(m_pEvolution, "evolution"); - get(m_pEvolutionGroupwise, "groupwise"); - get(m_pEvolutionLdap, "evoldap"); - get(m_pMORK, "firefox"); - get(m_pThunderbird, "thunderbird"); - get(m_pKab, "kde"); - get(m_pMacab, "macosx"); - get(m_pOther, "other"); - //TODO: For now, try to keep offering the same choices like before the // Mozilla/MORK cleanup, even if the status of what driver actually // provides which functionality is somewhat unclear, see the discussions @@ -71,7 +69,7 @@ namespace abp bool bHaveKab = false; bool bHaveMacab = false; - Reference< XDriverManager2 > xManager = DriverManager::create( _pParent->getORB() ); + Reference< XDriverManager2 > xManager = DriverManager::create( pDialog->getORB() ); try { @@ -112,29 +110,28 @@ namespace abp #endif // Items are displayed in list order - m_aAllTypes.push_back( ButtonItem( m_pEvolution, AST_EVOLUTION, bHaveEvolution ) ); - m_aAllTypes.push_back( ButtonItem( m_pEvolutionGroupwise, AST_EVOLUTION_GROUPWISE, bHaveEvolution ) ); - m_aAllTypes.push_back( ButtonItem( m_pEvolutionLdap, AST_EVOLUTION_LDAP, bHaveEvolution ) ); - m_aAllTypes.push_back( ButtonItem( m_pMORK, AST_MORK, true ) ); - m_aAllTypes.push_back( ButtonItem( m_pThunderbird, AST_THUNDERBIRD, true ) ); - m_aAllTypes.push_back( ButtonItem( m_pKab, AST_KAB, bHaveKab ) ); - m_aAllTypes.push_back( ButtonItem( m_pMacab, AST_MACAB, bHaveMacab ) ); - m_aAllTypes.push_back( ButtonItem( m_pOther, AST_OTHER, true ) ); - - Link<Button*,void> aTypeSelectionHandler = LINK(this, TypeSelectionPage, OnTypeSelected ); + m_aAllTypes.push_back( ButtonItem( m_xEvolution.get(), AST_EVOLUTION, bHaveEvolution ) ); + m_aAllTypes.push_back( ButtonItem( m_xEvolutionGroupwise.get(), AST_EVOLUTION_GROUPWISE, bHaveEvolution ) ); + m_aAllTypes.push_back( ButtonItem( m_xEvolutionLdap.get(), AST_EVOLUTION_LDAP, bHaveEvolution ) ); + m_aAllTypes.push_back( ButtonItem( m_xMORK.get(), AST_MORK, true ) ); + m_aAllTypes.push_back( ButtonItem( m_xThunderbird.get(), AST_THUNDERBIRD, true ) ); + m_aAllTypes.push_back( ButtonItem( m_xKab.get(), AST_KAB, bHaveKab ) ); + m_aAllTypes.push_back( ButtonItem( m_xMacab.get(), AST_MACAB, bHaveMacab ) ); + m_aAllTypes.push_back( ButtonItem( m_xOther.get(), AST_OTHER, true ) ); + + Link<weld::Button&,void> aTypeSelectionHandler = LINK(this, TypeSelectionPage, OnTypeSelected ); for (auto const& elem : m_aAllTypes) { if (!elem.m_bVisible) - elem.m_pItem->Hide(); + elem.m_pItem->hide(); else { - elem.m_pItem->SetClickHdl( aTypeSelectionHandler ); - elem.m_pItem->Show(); + elem.m_pItem->connect_clicked( aTypeSelectionHandler ); + elem.m_pItem->show(); } } } - TypeSelectionPage::~TypeSelectionPage() { disposeOnce(); @@ -146,27 +143,18 @@ namespace abp { elem.m_bVisible = false; } - m_pEvolution.clear(); - m_pEvolutionGroupwise.clear(); - m_pEvolutionLdap.clear(); - m_pMORK.clear(); - m_pThunderbird.clear(); - m_pKab.clear(); - m_pMacab.clear(); - m_pOther.clear(); AddressBookSourcePage::dispose(); } - void TypeSelectionPage::ActivatePage() { AddressBookSourcePage::ActivatePage(); for (auto const& elem : m_aAllTypes) { - if( elem.m_pItem->IsChecked() && elem.m_bVisible ) + if( elem.m_pItem->get_active() && elem.m_bVisible ) { - elem.m_pItem->GrabFocus(); + elem.m_pItem->grab_focus(); break; } } @@ -174,35 +162,31 @@ namespace abp getDialog()->enableButtons(WizardButtonFlags::PREVIOUS, false); } - void TypeSelectionPage::DeactivatePage() { AddressBookSourcePage::DeactivatePage(); getDialog()->enableButtons(WizardButtonFlags::PREVIOUS, true); } - void TypeSelectionPage::selectType( AddressSourceType _eType ) { for (auto const& elem : m_aAllTypes) { - elem.m_pItem->Check( _eType == elem.m_eType ); + elem.m_pItem->set_active( _eType == elem.m_eType ); } } - AddressSourceType TypeSelectionPage::getSelectedType() const { for (auto const& elem : m_aAllTypes) { - if ( elem.m_pItem->IsChecked() && elem.m_bVisible ) + if ( elem.m_pItem->get_active() && elem.m_bVisible ) return elem.m_eType; } return AST_INVALID; } - void TypeSelectionPage::initializePage() { AddressBookSourcePage::initializePage(); @@ -211,7 +195,6 @@ namespace abp selectType(rSettings.eType); } - bool TypeSelectionPage::commitPage( ::vcl::WizardTypes::CommitPageReason _eReason ) { if (!AddressBookSourcePage::commitPage(_eReason)) @@ -219,7 +202,7 @@ namespace abp if (AST_INVALID == getSelectedType( )) { - std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xContainer.get(), VclMessageType::Warning, VclButtonsType::Ok, compmodule::ModuleRes(RID_STR_NEEDTYPESELECTION))); xBox->run(); @@ -240,7 +223,7 @@ namespace abp } - IMPL_LINK_NOARG( TypeSelectionPage, OnTypeSelected, Button*, void ) + IMPL_LINK_NOARG( TypeSelectionPage, OnTypeSelected, weld::Button&, void ) { getDialog()->typeSelectionChanged( getSelectedType() ); updateDialogTravelUI(); diff --git a/extensions/source/abpilot/typeselectionpage.hxx b/extensions/source/abpilot/typeselectionpage.hxx index 219afd059bf2..cf5c537b39f0 100644 --- a/extensions/source/abpilot/typeselectionpage.hxx +++ b/extensions/source/abpilot/typeselectionpage.hxx @@ -22,30 +22,28 @@ #include "abspage.hxx" #include "addresssettings.hxx" -#include <vcl/edit.hxx> -#include <vcl/vclptr.hxx> - +#include <vcl/weld.hxx> namespace abp { class TypeSelectionPage final : public AddressBookSourcePage { - VclPtr<RadioButton> m_pEvolution; - VclPtr<RadioButton> m_pEvolutionGroupwise; - VclPtr<RadioButton> m_pEvolutionLdap; - VclPtr<RadioButton> m_pMORK; - VclPtr<RadioButton> m_pThunderbird; - VclPtr<RadioButton> m_pKab; - VclPtr<RadioButton> m_pMacab; - VclPtr<RadioButton> m_pOther; + std::unique_ptr<weld::RadioButton> m_xEvolution; + std::unique_ptr<weld::RadioButton> m_xEvolutionGroupwise; + std::unique_ptr<weld::RadioButton> m_xEvolutionLdap; + std::unique_ptr<weld::RadioButton> m_xMORK; + std::unique_ptr<weld::RadioButton> m_xThunderbird; + std::unique_ptr<weld::RadioButton> m_xKab; + std::unique_ptr<weld::RadioButton> m_xMacab; + std::unique_ptr<weld::RadioButton> m_xOther; struct ButtonItem { - VclPtr<RadioButton> m_pItem; + weld::RadioButton* m_pItem; AddressSourceType m_eType; bool m_bVisible; - ButtonItem( RadioButton *pItem, + ButtonItem( weld::RadioButton *pItem, AddressSourceType eType, bool bVisible ) : m_pItem( pItem ), @@ -57,7 +55,7 @@ namespace abp std::vector< ButtonItem > m_aAllTypes; public: - explicit TypeSelectionPage( OAddressBookSourcePilot* _pParent ); + explicit TypeSelectionPage(OAddressBookSourcePilot* pDialog, TabPageParent pPageParent); virtual ~TypeSelectionPage() override; virtual void dispose() override; @@ -76,7 +74,7 @@ namespace abp // OImportPage overridables virtual bool canAdvance() const override; - DECL_LINK( OnTypeSelected, Button*, void ); + DECL_LINK( OnTypeSelected, weld::Button&, void ); void selectType( AddressSourceType _eType ); }; diff --git a/extensions/source/abpilot/unodialogabp.cxx b/extensions/source/abpilot/unodialogabp.cxx index ded9cd8c3049..90320dff9fd7 100644 --- a/extensions/source/abpilot/unodialogabp.cxx +++ b/extensions/source/abpilot/unodialogabp.cxx @@ -21,7 +21,7 @@ #include <cppuhelper/typeprovider.hxx> #include "abspilot.hxx" #include <comphelper/sequence.hxx> -#include <toolkit/helper/vclunohelper.hxx> +#include <vcl/svapp.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/awt/XWindow.hpp> @@ -116,10 +116,9 @@ namespace abp svt::OGenericUnoDialog::Dialog OABSPilotUno::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent) { - return svt::OGenericUnoDialog::Dialog(VclPtr<OAddressBookSourcePilot>::Create(VCLUnoHelper::GetWindow(rParent), m_aContext)); + return svt::OGenericUnoDialog::Dialog(std::make_unique<OAddressBookSourcePilot>(Application::GetFrameWeld(rParent), m_aContext)); } - Any SAL_CALL OABSPilotUno::execute( const Sequence< NamedValue >& /*lArgs*/ ) { // not interested in the context, not interested in the args @@ -139,7 +138,7 @@ namespace abp { if ( _nExecutionResult == RET_OK ) { - const AddressSettings& aSettings = static_cast<OAddressBookSourcePilot*>(m_aDialog.m_xVclDialog.get())->getSettings(); + const AddressSettings& aSettings = static_cast<OAddressBookSourcePilot*>(m_aDialog.m_xWeldDialog.get())->getSettings(); m_sDataSourceName = aSettings.bRegisterDataSource ? aSettings.sRegisteredDataSourceName : aSettings.sDataSourceName; } } |