[Libreoffice-commits] core.git: dbaccess/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Oct 25 07:58:53 UTC 2018


 dbaccess/source/ui/control/curledit.cxx     |  124 -----
 dbaccess/source/ui/dlg/ConnectionHelper.cxx |  657 ----------------------------
 dbaccess/source/ui/dlg/ConnectionHelper.hxx |   63 --
 dbaccess/source/ui/inc/curledit.hxx         |   40 -
 4 files changed, 884 deletions(-)

New commits:
commit b2fae6ba39cd57a4bd5bf8693579bfc5dbb47f6f
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Oct 24 16:28:33 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Oct 25 09:58:24 2018 +0200

    drop OConnectionURLEdit and OConnectionHelper
    
    Change-Id: I028b243b21a41f3fbd23dea57ea90f77e4a5317c
    Reviewed-on: https://gerrit.libreoffice.org/62327
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/dbaccess/source/ui/control/curledit.cxx b/dbaccess/source/ui/control/curledit.cxx
index a50a2c1fbaef..234ebdb935f9 100644
--- a/dbaccess/source/ui/control/curledit.cxx
+++ b/dbaccess/source/ui/control/curledit.cxx
@@ -26,130 +26,6 @@
 namespace dbaui
 {
 
-OConnectionURLEdit::OConnectionURLEdit(vcl::Window* _pParent, WinBits _nBits,bool _bShowPrefix)
-    :Edit(_pParent, _nBits)
-    ,m_pTypeCollection(nullptr)
-    ,m_pForcedPrefix(nullptr)
-    ,m_bShowPrefix(_bShowPrefix)
-{
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT void makeConnectionURLEdit(VclPtr<vcl::Window> & rRet, VclPtr<vcl::Window> & pParent, VclBuilder::stringmap &)
-{
-    rRet = VclPtr<OConnectionURLEdit>::Create(pParent, WB_BORDER, false);
-}
-
-OConnectionURLEdit::~OConnectionURLEdit()
-{
-    disposeOnce();
-}
-
-void OConnectionURLEdit::dispose()
-{
-    SetSubEdit(nullptr);
-    m_pForcedPrefix.disposeAndClear();
-    Edit::dispose();
-}
-
-void OConnectionURLEdit::SetTextNoPrefix(const OUString& _rText)
-{
-    OSL_ENSURE(GetSubEdit(), "OConnectionURLEdit::SetTextNoPrefix: have no current type, not changing the text!");
-    if (GetSubEdit())
-        GetSubEdit()->SetText(_rText);
-}
-
-OUString OConnectionURLEdit::GetTextNoPrefix() const
-{
-    if (GetSubEdit())
-        return GetSubEdit()->GetText();
-    return GetText();
-}
-
-void OConnectionURLEdit::SetText(const OUString& _rStr)
-{
-    Selection aNoSelection(0,0);
-    SetText(_rStr, aNoSelection);
-}
-
-void OConnectionURLEdit::Resize()
-{
-    if (GetSubEdit())
-    {
-        Size aMySize = GetSizePixel();
-        sal_Int32 nTextWidth = 0;
-        if ( m_pForcedPrefix && m_bShowPrefix)
-        {
-            nTextWidth = m_pForcedPrefix->GetTextWidth(m_pForcedPrefix->GetText()) + 2;
-            m_pForcedPrefix->SetPosSizePixel(Point(0, -2), Size(nTextWidth, aMySize.Height()));
-        }
-        GetSubEdit()->SetPosSizePixel(Point(nTextWidth, -2), Size(aMySize.Width() - nTextWidth - 4, aMySize.Height()));
-    }
-}
-
-void OConnectionURLEdit::SetText(const OUString& _rStr, const Selection& /*_rNewSelection*/)
-{
-    // create new sub controls, if necessary
-    if (!GetSubEdit())
-        SetSubEdit(VclPtr<Edit>::Create(this, 0));
-    if ( !m_pForcedPrefix )
-    {
-        m_pForcedPrefix = VclPtr<FixedText>::Create(this, WB_VCENTER);
-
-        // we use a gray background for the fixed text
-        StyleSettings aSystemStyle = Application::GetSettings().GetStyleSettings();
-        m_pForcedPrefix->SetBackground(Wallpaper(aSystemStyle.GetDialogColor()));
-    }
-
-    m_pForcedPrefix->Show(m_bShowPrefix);
-
-    bool bIsEmpty = _rStr.isEmpty();
-    // calc the prefix
-    OUString sPrefix;
-    if (!bIsEmpty)
-    {
-        // determine the type of the new URL described by the new text
-        sPrefix = m_pTypeCollection->getPrefix(_rStr);
-    }
-
-    // the fixed text gets the prefix
-    m_pForcedPrefix->SetText(sPrefix);
-
-    // both subs have to be resized according to the text len of the prefix
-    Size aMySize = GetSizePixel();
-    sal_Int32 nTextWidth = 0;
-    if ( m_pForcedPrefix && m_bShowPrefix)
-    {
-        nTextWidth = m_pForcedPrefix->GetTextWidth(sPrefix) + 2;
-        m_pForcedPrefix->SetPosSizePixel(Point(0, -2), Size(nTextWidth, aMySize.Height()));
-    }
-    GetSubEdit()->SetPosSizePixel(Point(nTextWidth, -2), Size(aMySize.Width() - nTextWidth - 4, aMySize.Height()));
-        // -2 because the edit has a frame which is 2 pixel wide ... should not be necessary, but I don't fully understand this ....
-
-    // show the sub controls (in case they were just created)
-    GetSubEdit()->Show();
-
-    // do the real SetTex
-//  Edit::SetText(bIsEmpty ? _rStr : m_pTypeCollection->cutPrefix(_rStr), _rNewSelection);
-    OUString sNewText( _rStr );
-    if ( !bIsEmpty )
-        sNewText  = m_pTypeCollection->cutPrefix( _rStr );
-    Edit::SetText( sNewText );
-}
-
-OUString OConnectionURLEdit::GetText() const
-{
-    if ( m_pForcedPrefix )
-        return m_pForcedPrefix->GetText() + Edit::GetText();
-    return Edit::GetText();
-}
-
-void OConnectionURLEdit::ShowPrefix(bool _bShowPrefix)
-{
-    m_bShowPrefix = _bShowPrefix;
-    if ( m_pForcedPrefix )
-        m_pForcedPrefix->Show(m_bShowPrefix);
-}
-
 DBOConnectionURLEdit::DBOConnectionURLEdit(std::unique_ptr<weld::Entry> xEntry, std::unique_ptr<weld::Label> xForcedPrefix)
     : m_pTypeCollection(nullptr)
     , m_bShowPrefix(false)
diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
index 000daa908ede..d9067ffeff97 100644
--- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
@@ -81,663 +81,6 @@ namespace dbaui
     using namespace ::dbtools;
     using namespace ::svt;
 
-    OConnectionHelper::OConnectionHelper( vcl::Window* pParent, const OString& _rId, const OUString& _rUIXMLDescription, const SfxItemSet& _rCoreAttrs)
-        : OGenericAdministrationPage(pParent, _rId, _rUIXMLDescription, _rCoreAttrs)
-        , m_bUserGrabFocus(false)
-        , m_pCollection(nullptr)
-    {
-        get(m_pFT_Connection, "browseurllabel");
-        get(m_pConnectionURL, "browseurl");
-        get(m_pPB_Connection, "browse");
-        get(m_pPB_CreateDB, "create");
-
-        // extract the datasource type collection from the item set
-        const DbuTypeCollectionItem* pCollectionItem = dynamic_cast<const DbuTypeCollectionItem*>( _rCoreAttrs.GetItem(DSID_TYPECOLLECTION) );
-        if (pCollectionItem)
-            m_pCollection = pCollectionItem->getCollection();
-        m_pPB_Connection->SetClickHdl(LINK(this, OConnectionHelper, OnBrowseConnections));
-        m_pPB_CreateDB->SetClickHdl(LINK(this, OConnectionHelper, OnCreateDatabase));
-        OSL_ENSURE(m_pCollection, "OConnectionHelper::OConnectionHelper : really need a DSN type collection !");
-        m_pConnectionURL->SetTypeCollection(m_pCollection);
-    }
-
-    OConnectionHelper::~OConnectionHelper()
-    {
-        disposeOnce();
-    }
-
-    void OConnectionHelper::dispose()
-    {
-        // FIXME: used to have an if (m_bDelete) ...
-        m_pFT_Connection.disposeAndClear();
-        m_pConnectionURL.disposeAndClear();
-        m_pPB_Connection.disposeAndClear();
-        m_pPB_CreateDB.disposeAndClear();
-        OGenericAdministrationPage::dispose();
-    }
-
-    void OConnectionHelper::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue)
-    {
-        // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
-        bool bValid, bReadonly;
-        getFlags(_rSet, bValid, bReadonly);
-
-        m_pFT_Connection->Show();
-        m_pConnectionURL->Show();
-        m_pConnectionURL->Resize();
-        m_pConnectionURL->ShowPrefix( ::dbaccess::DST_JDBC == m_pCollection->determineType(m_eType) );
-
-        bool bEnableBrowseButton = m_pCollection->supportsBrowsing( m_eType );
-        m_pPB_Connection->Show( bEnableBrowseButton );
-
-        bool bEnableCreateButton = m_pCollection->supportsDBCreation( m_eType );
-        m_pPB_CreateDB->Show( bEnableCreateButton );
-
-        const SfxStringItem* pUrlItem = _rSet.GetItem<SfxStringItem>(DSID_CONNECTURL);
-
-        // forward the values to the controls
-        if ( bValid )
-        {
-            const OUString& sUrl = pUrlItem->GetValue();
-            setURL( sUrl );
-
-            checkTestConnection();
-            m_pConnectionURL->ClearModifyFlag();
-        }
-
-        OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue);
-    }
-
-    void OConnectionHelper::implUpdateURLDependentStates() const
-    {
-        OSL_PRECOND( m_pAdminDialog && m_pCollection, "OConnectionHelper::implUpdateURLDependentStates: no admin dialog!" );
-        if ( !m_pAdminDialog || !m_pCollection )
-            return;
-
-        if ( m_pCollection->isFileSystemBased(m_eType) )
-            m_pAdminDialog->enableConfirmSettings( !getURLNoPrefix().isEmpty() );
-    }
-
-    IMPL_LINK_NOARG(OConnectionHelper, OnBrowseConnections, Button*, void)
-    {
-        OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
-        const ::dbaccess::DATASOURCE_TYPE eType = m_pCollection->determineType(m_eType);
-        switch ( eType )
-        {
-            case  ::dbaccess::DST_DBASE:
-            case  ::dbaccess::DST_FLAT:
-            {
-                try
-                {
-                    Reference< XFolderPicker2 > xFolderPicker = FolderPicker::create(m_xORB);
-
-                    bool bDoBrowse = false;
-                    OUString sOldPath = getURLNoPrefix();
-                    do
-                    {
-                        if (!sOldPath.isEmpty())
-                            xFolderPicker->setDisplayDirectory(sOldPath);
-                        if (0 == xFolderPicker->execute())
-                            // cancelled by the user
-                            return;
-
-                        sOldPath = xFolderPicker->getDirectory();
-                        switch (checkPathExistence(sOldPath))
-                        {
-                            case RET_RETRY:
-                                bDoBrowse = true;
-                                break;
-                            case RET_CANCEL:
-                                return;
-                            default:
-                                break;
-                        }
-                    }
-                    while (bDoBrowse);
-
-                    OUString sSelectedDirectory = xFolderPicker->getDirectory();
-                    INetURLObject aSelectedDirectory( sSelectedDirectory, INetURLObject::EncodeMechanism::WasEncoded, RTL_TEXTENCODING_UTF8 );
-
-                    // for UI purpose, we don't want to have the path encoded
-                    sSelectedDirectory = aSelectedDirectory.GetMainURL( INetURLObject::DecodeMechanism::WithCharset );
-
-                    setURLNoPrefix( sSelectedDirectory );
-                    SetRoadmapStateValue(true);
-                    callModifiedHdl();
-                }
-                catch( const Exception& )
-                {
-                    DBG_UNHANDLED_EXCEPTION("dbaccess");
-                }
-            }
-            break;
-            case  ::dbaccess::DST_CALC:
-            {
-                SvtModuleOptions aModule;
-                ::sfx2::FileDialogHelper aFileDlg(
-                    ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION,
-                    FileDialogFlags::NONE,
-                    aModule.GetFactoryEmptyDocumentURL(SvtModuleOptions::EFactory::CALC)
-                    ,SfxFilterFlags::IMPORT, SfxFilterFlags::NONE, GetFrameWeld());
-                askForFileName(aFileDlg);
-            }
-            break;
-            case  ::dbaccess::DST_WRITER:
-            {
-                SvtModuleOptions aModule;
-                ::sfx2::FileDialogHelper aFileDlg(
-                    ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION,
-                    FileDialogFlags::NONE,
-                    aModule.GetFactoryEmptyDocumentURL(SvtModuleOptions::EFactory::WRITER),
-                    SfxFilterFlags::IMPORT, SfxFilterFlags::NONE, GetFrameWeld());
-                askForFileName(aFileDlg);
-            }
-            break;
-            case  ::dbaccess::DST_MSACCESS:
-            {
-                const OUString sExt("*.mdb;*.mde");
-                OUString sFilterName(DBA_RES (STR_MSACCESS_FILTERNAME));
-                ::sfx2::FileDialogHelper aFileDlg(
-                    ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION,
-                    FileDialogFlags::NONE, GetFrameWeld());
-                aFileDlg.AddFilter(sFilterName,sExt);
-                aFileDlg.SetCurrentFilter(sFilterName);
-                askForFileName(aFileDlg);
-            }
-            break;
-            case  ::dbaccess::DST_MSACCESS_2007:
-            {
-                const OUString sAccdb("*.accdb;*.accde");
-                OUString sFilterName2(DBA_RES (STR_MSACCESS_2007_FILTERNAME));
-                ::sfx2::FileDialogHelper aFileDlg(
-                    ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION,
-                    FileDialogFlags::NONE, GetFrameWeld());
-                aFileDlg.AddFilter(sFilterName2,sAccdb);
-                aFileDlg.SetCurrentFilter(sFilterName2);
-                askForFileName(aFileDlg);
-            }
-            break;
-            case  ::dbaccess::DST_MYSQL_ODBC:
-            case  ::dbaccess::DST_ODBC:
-            {
-                // collect all ODBC data source names
-                OUString sCurrDatasource = getURLNoPrefix();
-                OUString sDataSource;
-                if ( getSelectedDataSource(sDataSource,sCurrDatasource) && !sDataSource.isEmpty() )
-                {
-                    setURLNoPrefix(sDataSource);
-                    SetRoadmapStateValue(true);
-                    callModifiedHdl();
-                }
-                else
-                    return;
-            }
-            break;
-#if defined _WIN32
-            case  ::dbaccess::DST_ADO:
-            {
-                OUString sOldDataSource=getURLNoPrefix();
-                OUString sNewDataSource;
-                HWND hWnd = GetParent()->GetSystemData()->hWnd;
-                sNewDataSource = getAdoDatalink(reinterpret_cast<LONG_PTR>(hWnd),sOldDataSource);
-                if ( !sNewDataSource.isEmpty() )
-                {
-                    setURLNoPrefix(sNewDataSource);
-                    SetRoadmapStateValue(true);
-                    callModifiedHdl();
-                }
-                else
-                    return;
-            }
-            break;
-#endif
-            case  ::dbaccess::DST_MOZILLA:
-            case  ::dbaccess::DST_THUNDERBIRD:
-            {
-                MozillaProductType profileType = MozillaProductType_Mozilla;
-                if (eType ==  ::dbaccess::DST_THUNDERBIRD)
-                    profileType = MozillaProductType_Thunderbird;
-
-                Reference<XComponentContext> xContext = ::comphelper::getProcessComponentContext();
-                Reference<XMozillaBootstrap> xMozillaBootstrap = MozillaBootstrap::create(xContext);
-
-                // collect all Mozilla Profiles
-                css::uno::Sequence< OUString > list;
-
-                xMozillaBootstrap->getProfileList( profileType, list );
-                const OUString * pArray = list.getConstArray();
-
-                sal_Int32 count = list.getLength();
-
-                std::set<OUString> aProfiles;
-                for (sal_Int32 index=0; index < count; index++)
-                    aProfiles.insert(pArray[index]);
-
-                // execute the select dialog
-                ScopedVclPtrInstance< ODatasourceSelectDialog > aSelector(GetParent(), aProfiles);
-                OUString sOldProfile=getURLNoPrefix();
-
-                if (!sOldProfile.isEmpty())
-                    aSelector->Select(sOldProfile);
-                else
-                    aSelector->Select(xMozillaBootstrap->getDefaultProfile(profileType));
-
-                if ( RET_OK == aSelector->Execute() )
-                    setURLNoPrefix(aSelector->GetSelected());
-                break;
-            }
-            case ::dbaccess::DST_FIREBIRD:
-            {
-                const OUString sExt("*.fdb");
-                OUString sFilterName(DBA_RES (STR_FIREBIRD_FILTERNAME));
-                ::sfx2::FileDialogHelper aFileDlg(
-                    ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
-                    FileDialogFlags::NONE, GetFrameWeld());
-                aFileDlg.AddFilter(sFilterName,sExt);
-                aFileDlg.SetCurrentFilter(sFilterName);
-                askForFileName(aFileDlg);
-                break;
-            }
-            default:
-                break;
-        }
-
-        checkTestConnection();
-    }
-
-    IMPL_LINK_NOARG(OConnectionHelper, OnCreateDatabase, Button*, void)
-    {
-        OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
-        const ::dbaccess::DATASOURCE_TYPE eType = m_pCollection->determineType(m_eType);
-        switch ( eType )
-        {
-        case ::dbaccess::DST_FIREBIRD:
-            {
-                const OUString sExt("*.fdb");
-                OUString sFilterName(DBA_RES (STR_FIREBIRD_FILTERNAME));
-                ::sfx2::FileDialogHelper aFileDlg(
-                    ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION,
-                    FileDialogFlags::NONE, GetFrameWeld());
-                aFileDlg.AddFilter(sFilterName,sExt);
-                aFileDlg.SetCurrentFilter(sFilterName);
-                askForFileName(aFileDlg);
-                break;
-            }
-            default:
-                break;
-        }
-
-        checkTestConnection();
-    }
-
-    bool OConnectionHelper::checkTestConnection()
-    {
-        return true;
-    }
-
-    void OConnectionHelper::impl_setURL( const OUString& _rURL, bool _bPrefix )
-    {
-        OUString sURL( comphelper::string::stripEnd(_rURL, '*') );
-        OSL_ENSURE( m_pCollection, "OConnectionHelper::impl_setURL: have no interpreter for the URLs!" );
-
-        if ( m_pCollection && !sURL.isEmpty() )
-        {
-            if ( m_pCollection->isFileSystemBased( m_eType ) )
-            {
-                // get the two parts: prefix and file URL
-                OUString sTypePrefix, sFileURLEncoded;
-                if ( _bPrefix )
-                {
-                    sTypePrefix = m_pCollection->getPrefix( m_eType );
-                    sFileURLEncoded = m_pCollection->cutPrefix( sURL );
-                }
-                else
-                {
-                    sFileURLEncoded = sURL;
-                }
-
-                // substitute any variables
-                sFileURLEncoded = SvtPathOptions().SubstituteVariable( sFileURLEncoded );
-
-                // decode the URL
-                sURL = sTypePrefix;
-                if ( !sFileURLEncoded.isEmpty() )
-                {
-                    OFileNotation aFileNotation(sFileURLEncoded);
-                    // set this decoded URL as text
-                    sURL += aFileNotation.get(OFileNotation::N_SYSTEM);
-                }
-            }
-        }
-
-        if ( _bPrefix )
-            m_pConnectionURL->SetText( sURL );
-        else
-            m_pConnectionURL->SetTextNoPrefix( sURL );
-
-        implUpdateURLDependentStates();
-    }
-
-    OUString OConnectionHelper::impl_getURL() const
-    {
-        // get the pure text
-        OUString sURL = m_pConnectionURL->GetTextNoPrefix();
-
-        OSL_ENSURE( m_pCollection, "OConnectionHelper::impl_getURL: have no interpreter for the URLs!" );
-
-        if ( m_pCollection && !sURL.isEmpty() )
-        {
-            if ( m_pCollection->isFileSystemBased( m_eType ) )
-            {
-                // get the two parts: prefix and file URL
-                OUString sFileURLDecoded;
-                sFileURLDecoded = sURL;
-
-                sURL = OUString();
-                if ( !sFileURLDecoded.isEmpty() )
-                {
-                    OFileNotation aFileNotation( sFileURLDecoded, OFileNotation::N_SYSTEM );
-                    sURL += aFileNotation.get( OFileNotation::N_URL );
-                }
-
-                // encode the URL
-                INetURLObject aFileURL( sFileURLDecoded, INetURLObject::EncodeMechanism::All, RTL_TEXTENCODING_UTF8 );
-                sFileURLDecoded = aFileURL.GetMainURL( INetURLObject::DecodeMechanism::NONE );
-            }
-        }
-        return sURL;
-    }
-
-    void OConnectionHelper::setURL( const OUString& _rURL )
-    {
-        impl_setURL( _rURL, true );
-    }
-
-    OUString OConnectionHelper::getURLNoPrefix( ) const
-    {
-        return impl_getURL();
-    }
-
-    void OConnectionHelper::setURLNoPrefix( const OUString& _rURL )
-    {
-        impl_setURL( _rURL, false );
-    }
-
-    sal_Int32 OConnectionHelper::checkPathExistence(const OUString& _rURL)
-    {
-        IS_PATH_EXIST e_exists = pathExists(_rURL, false);
-        if (!m_pCollection->supportsDBCreation(m_eType) &&
-            (( e_exists == PATH_NOT_EXIST) || ( e_exists == PATH_NOT_KNOWN)))
-        {
-            OUString sQuery(DBA_RES(STR_ASK_FOR_DIRECTORY_CREATION));
-            OFileNotation aTransformer(_rURL);
-            sQuery = sQuery.replaceFirst("$path$", aTransformer.get(OFileNotation::N_SYSTEM));
-
-            m_bUserGrabFocus = false;
-            vcl::Window* pWin = GetParent();
-            std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
-                                                           VclMessageType::Question, VclButtonsType::YesNo,
-                                                           sQuery));
-            xQueryBox->set_default_response(RET_YES);
-            sal_Int32 nQueryResult = xQueryBox->run();
-            m_bUserGrabFocus = true;
-
-            switch (nQueryResult)
-            {
-                case RET_YES:
-                {
-                    bool bTryCreate = false;
-                    do
-                    {
-                        if ( !createDirectoryDeep(_rURL) )
-                        {   // could not create the directory
-                            sQuery = DBA_RES(STR_COULD_NOT_CREATE_DIRECTORY);
-                            sQuery = sQuery.replaceFirst("$name$", aTransformer.get(OFileNotation::N_SYSTEM));
-
-                            m_bUserGrabFocus = false;
-
-                            std::unique_ptr<weld::MessageDialog> xWhatToDo(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
-                                                                           VclMessageType::Question, VclButtonsType::NONE,
-                                                                           sQuery));
-                            xWhatToDo->add_button(Button::GetStandardText(StandardButtonType::Retry), RET_RETRY);
-                            xWhatToDo->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL);
-                            xWhatToDo->set_default_response(RET_RETRY);
-                            nQueryResult = xWhatToDo->run();
-                            m_bUserGrabFocus = true;
-
-                            if (RET_RETRY == nQueryResult)
-                                bTryCreate = true;
-                            else
-                            {
-                                SetRoadmapStateValue(false);
-                                callModifiedHdl();
-                                return RET_RETRY;
-                            }
-                        }
-                    }
-                    while (bTryCreate);
-                }
-                break;
-
-                case RET_NO:
-                    callModifiedHdl();
-                    return RET_OK;
-
-                default:
-                    // cancelled
-                    SetRoadmapStateValue(false);
-                    callModifiedHdl();
-                    return RET_CANCEL;
-            }
-        }
-/*        else
-        {
-            // TODO: error msg
-            return RET_CANCEL;
-        } */
-        SetRoadmapStateValue(true);
-        callModifiedHdl();
-        return RET_OK;
-    }
-
-    IS_PATH_EXIST OConnectionHelper::pathExists(const OUString& _rURL, bool bIsFile) const
-    {
-        ::ucbhelper::Content aCheckExistence;
-        IS_PATH_EXIST eExists = PATH_NOT_EXIST;
-        Reference< css::task::XInteractionHandler > xInteractionHandler(
-            task::InteractionHandler::createWithParent(m_xORB, nullptr), UNO_QUERY );
-        OFilePickerInteractionHandler* pHandler = new OFilePickerInteractionHandler(xInteractionHandler);
-        xInteractionHandler = pHandler;
-
-        Reference< XCommandEnvironment > xCmdEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() );
-        try
-        {
-            aCheckExistence = ::ucbhelper::Content(_rURL, xCmdEnv, comphelper::getProcessComponentContext());
-            const bool bExists = bIsFile? aCheckExistence.isDocument(): aCheckExistence.isFolder();
-            eExists = bExists? PATH_EXIST: PATH_NOT_EXIST;
-        }
-        catch (const Exception&)
-        {
-            eExists = pHandler->isDoesNotExist() ? PATH_NOT_EXIST : (bIsFile ? PATH_NOT_EXIST : PATH_NOT_KNOWN);
-        }
-        return eExists;
-    }
-    bool OConnectionHelper::PreNotify( NotifyEvent& _rNEvt )
-    {
-        if ( m_pCollection->isFileSystemBased(m_eType) )
-        {
-            switch (_rNEvt.GetType())
-            {
-                case MouseNotifyEvent::GETFOCUS:
-                    if (m_pConnectionURL->IsWindowOrChild(_rNEvt.GetWindow()) && m_bUserGrabFocus)
-                    {   // a descendant of the URL edit field got the focus
-                        m_pConnectionURL->SaveValueNoPrefix();
-                    }
-                    break;
-
-                case MouseNotifyEvent::LOSEFOCUS:
-                    if (m_pConnectionURL->IsWindowOrChild(_rNEvt.GetWindow()) && m_bUserGrabFocus)
-                    {   // a descendant of the URL edit field lost the focus
-                        if (!commitURL())
-                            return true;  // handled
-                    }
-                    break;
-                default:
-                    break;
-            }
-        }
-
-        return OGenericAdministrationPage::PreNotify( _rNEvt );
-    }
-
-    bool OConnectionHelper::createDirectoryDeep(const OUString& _rPathURL)
-    {
-        // get an URL object analyzing the URL for us ...
-        INetURLObject aParser;
-        aParser.SetURL(_rPathURL);
-
-        INetProtocol eProtocol = aParser.GetProtocol();
-
-        std::vector< OUString > aToBeCreated;  // the to-be-created levels
-
-        // search a level which exists
-        IS_PATH_EXIST eParentExists = PATH_NOT_EXIST;
-        while ( eParentExists == PATH_NOT_EXIST && aParser.getSegmentCount())
-        {
-            aToBeCreated.push_back(aParser.getName());  // remember the local name for creation
-            aParser.removeSegment();                    // cut the local name
-            eParentExists = pathExists(aParser.GetMainURL(INetURLObject::DecodeMechanism::NONE), false);
-        }
-
-        if (!aParser.getSegmentCount())
-            return false;
-
-        // create all the missing levels
-        try
-        {
-            // the parent content
-            Reference< XCommandEnvironment > xEmptyEnv;
-            ::ucbhelper::Content aParent(aParser.GetMainURL(INetURLObject::DecodeMechanism::NONE), xEmptyEnv, comphelper::getProcessComponentContext());
-
-            OUString sContentType;
-            if ( INetProtocol::File == eProtocol )
-            {
-                sContentType = "application/vnd.sun.staroffice.fsys-folder";
-                // the file UCP currently does not support the ContentType property
-            }
-            else
-            {
-                Any aContentType = aParent.getPropertyValue("ContentType");
-                aContentType >>= sContentType;
-            }
-
-            // the properties which need to be set on the new content
-            Sequence< OUString > aNewDirectoryProperties { "Title" };
-
-            // the values to be set
-            Sequence< Any > aNewDirectoryAttributes(1);
-
-            // loop
-            for (   std::vector< OUString >::const_reverse_iterator aLocalName = aToBeCreated.rbegin();
-                    aLocalName != aToBeCreated.rend();
-                    ++aLocalName
-                )
-            {
-                aNewDirectoryAttributes[0] <<= *aLocalName;
-                if (!aParent.insertNewContent(sContentType, aNewDirectoryProperties, aNewDirectoryAttributes, aParent))
-                    return false;
-            }
-        }
-        catch ( const Exception& )
-        {
-            DBG_UNHANDLED_EXCEPTION("dbaccess");
-            return false;
-        }
-
-        return true;
-    }
-
-    void OConnectionHelper::fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList)
-    {
-        _rControlList.emplace_back(new ODisableWrapper<FixedText>(m_pFT_Connection));
-        _rControlList.emplace_back(new ODisableWrapper<PushButton>(m_pPB_Connection));
-        _rControlList.emplace_back(new ODisableWrapper<PushButton>(m_pPB_CreateDB));
-    }
-
-    void OConnectionHelper::fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList)
-    {
-        _rControlList.emplace_back( new OSaveValueWrapper<Edit>( m_pConnectionURL ) );
-    }
-
-    bool OConnectionHelper::commitURL()
-    {
-        OUString sURL;
-        OUString sOldPath;
-        sOldPath = m_pConnectionURL->GetSavedValueNoPrefix();
-        sURL = m_pConnectionURL->GetTextNoPrefix();
-
-        if ( m_pCollection->isFileSystemBased(m_eType) )
-        {
-            if ( ( sURL != sOldPath ) && !sURL.isEmpty() )
-            {   // the text changed since entering the control
-
-                // the path may be in system notation ....
-                OFileNotation aTransformer(sURL);
-                sURL = aTransformer.get(OFileNotation::N_URL);
-
-                const ::dbaccess::DATASOURCE_TYPE eType = m_pCollection->determineType(m_eType);
-
-                if ( ( ::dbaccess::DST_CALC == eType) || ( ::dbaccess::DST_WRITER == eType) || ( ::dbaccess::DST_MSACCESS == eType) || ( ::dbaccess::DST_MSACCESS_2007 == eType) )
-                {
-                    if( pathExists(sURL, true) == PATH_NOT_EXIST )
-                    {
-                        OUString sFile = DBA_RES( STR_FILE_DOES_NOT_EXIST );
-                        sFile = sFile.replaceFirst("$file$", aTransformer.get(OFileNotation::N_SYSTEM));
-                        OSQLWarningBox aWarning(GetFrameWeld(), sFile);
-                        aWarning.run();
-                        setURLNoPrefix(sOldPath);
-                        SetRoadmapStateValue(false);
-                        callModifiedHdl();
-                        return false;
-                    }
-                }
-                else
-                {
-                    switch (checkPathExistence(sURL))
-                    {
-                        case RET_RETRY:
-                            m_bUserGrabFocus = false;
-                            m_pConnectionURL->GrabFocus();
-                            m_bUserGrabFocus = true;
-                            return false;
-
-                        case RET_CANCEL:
-                            setURLNoPrefix(sOldPath);
-                            return false;
-                    }
-                }
-            }
-        }
-
-        setURLNoPrefix(sURL);
-        m_pConnectionURL->SaveValueNoPrefix();
-        return true;
-    }
-    void OConnectionHelper::askForFileName(::sfx2::FileDialogHelper& _aFileOpen)
-    {
-        OUString sOldPath = getURLNoPrefix();
-        if ( !sOldPath.isEmpty() )
-            _aFileOpen.SetDisplayDirectory(sOldPath);
-        else
-            _aFileOpen.SetDisplayDirectory( SvtPathOptions().GetWorkPath() );
-        if (ERRCODE_NONE == _aFileOpen.Execute())
-        {
-            setURLNoPrefix(_aFileOpen.GetPath());
-            SetRoadmapStateValue(checkTestConnection());
-            callModifiedHdl();
-        }
-    }
-
     DBOConnectionHelper::DBOConnectionHelper(TabPageParent pParent, const OUString& _rUIXMLDescription, const OString& _rId, const SfxItemSet& _rCoreAttrs)
         : OGenericAdministrationPage(pParent, _rUIXMLDescription, _rId, _rCoreAttrs)
         , m_bUserGrabFocus(false)
diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.hxx b/dbaccess/source/ui/dlg/ConnectionHelper.hxx
index 04bca0a082ab..2c558e38d04f 100644
--- a/dbaccess/source/ui/dlg/ConnectionHelper.hxx
+++ b/dbaccess/source/ui/dlg/ConnectionHelper.hxx
@@ -35,69 +35,6 @@ namespace dbaui
         PATH_NOT_KNOWN
     };
 
-    class OConnectionHelper : public OGenericAdministrationPage
-    {
-        bool            m_bUserGrabFocus : 1;
-
-    public:
-        OConnectionHelper( vcl::Window* pParent, const OString& _rId, const OUString& _rUIXMLDescription, const SfxItemSet& _rCoreAttrs);
-        virtual ~OConnectionHelper() override;
-        virtual void dispose() override;
-        VclPtr<FixedText>           m_pFT_Connection;
-        VclPtr<OConnectionURLEdit>  m_pConnectionURL;
-        VclPtr<PushButton>          m_pPB_Connection;
-        VclPtr<PushButton>          m_pPB_CreateDB;
-        OUString     m_eType;          // the type can't be changed in this class, so we hold it as member.
-
-    public:
-
-        // setting/retrieving the current connection URL
-        // necessary because for some types, the URL must be decoded for display purposes
-        ::dbaccess::ODsnTypeCollection* m_pCollection;  /// the DSN type collection instance
-        virtual bool    PreNotify( NotifyEvent& _rNEvt ) override;
-
-        // <method>OGenericAdministrationPage::fillControls</method>
-        virtual void    fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
-        // <method>OGenericAdministrationPage::fillWindows</method>
-        virtual void    fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
-        virtual void    implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override;
-
-        // setting/retrieving the current connection URL
-        // necessary because for some types, the URL must be decoded for display purposes
-        //String        getURL( OConnectionURLEdit* _m_pConnection ) const;
-        //void      setURL( const OUString& _rURL, OConnectionURLEdit* _m_pConnection );
-
-        OUString    getURLNoPrefix( ) const;
-        void        setURLNoPrefix( const OUString& _rURL );
-
-        /** checks if the path is existence
-            @param  _rURL
-                The URL to check.
-        */
-        sal_Int32   checkPathExistence(const OUString& _rURL);
-
-        IS_PATH_EXIST   pathExists(const OUString& _rURL, bool bIsFile) const;
-        bool        createDirectoryDeep(const OUString& _rPathNormalized);
-        bool        commitURL();
-
-        /** opens the FileOpen dialog and asks for a FileName
-            @param  _aFileOpen
-                Executes the file open dialog, which must be filled from caller.
-        */
-        void askForFileName(::sfx2::FileDialogHelper& _aFileOpen);
-
-    protected:
-        void            setURL( const OUString& _rURL );
-        virtual bool    checkTestConnection();
-
-    private:
-        DECL_LINK(OnBrowseConnections, Button*, void);
-        DECL_LINK(OnCreateDatabase, Button*, void);
-        OUString    impl_getURL() const;
-        void        impl_setURL( const OUString& _rURL, bool _bPrefix );
-        void        implUpdateURLDependentStates() const;
-    };
-
     class DBOConnectionHelper : public OGenericAdministrationPage
     {
         bool            m_bUserGrabFocus;
diff --git a/dbaccess/source/ui/inc/curledit.hxx b/dbaccess/source/ui/inc/curledit.hxx
index 66168e14ac66..92b62ac9a6ab 100644
--- a/dbaccess/source/ui/inc/curledit.hxx
+++ b/dbaccess/source/ui/inc/curledit.hxx
@@ -28,46 +28,6 @@
 namespace dbaui
 {
 
-// OConnectionURLEdit
-/** an edit control which may be used to edit connection URLs like
-    "sdbc:odbc:" or "jdbc:". It prevents the user from editing this prefix,
-    though it is normally shown.
-*/
-class OConnectionURLEdit : public Edit
-{
-    ::dbaccess::ODsnTypeCollection*
-                        m_pTypeCollection;
-    VclPtr<FixedText>          m_pForcedPrefix;
-    OUString            m_sSaveValueNoPrefix;
-    bool            m_bShowPrefix; // when <TRUE> the prefix will be visible, otherwise not
-
-public:
-    OConnectionURLEdit(vcl::Window* pParent, WinBits _nBits, bool _bShowPrefix);
-    virtual ~OConnectionURLEdit() override;
-    virtual void dispose() override;
-
-public:
-    // Edit overridables
-    virtual void    SetText(const OUString& _rStr) override;
-    virtual void    SetText(const OUString& _rStr, const Selection& _rNewSelection) override;
-    virtual OUString  GetText() const override;
-    virtual void Resize() override;
-
-    /** Shows the Prefix
-        @param  _bShowPrefix
-            If <TRUE/> than the prefix will be visible, otherwise not.
-    */
-    void     ShowPrefix(bool _bShowPrefix);
-    /// get the currently set text, excluding the prefix indicating the type
-    OUString GetTextNoPrefix() const;
-    /// set a new text, leave the current prefix unchanged
-    void     SetTextNoPrefix(const OUString& _rText);
-
-    void      SaveValueNoPrefix()             { m_sSaveValueNoPrefix = GetTextNoPrefix(); }
-    const OUString&  GetSavedValueNoPrefix() const   { return m_sSaveValueNoPrefix; }
-    void      SetTypeCollection(::dbaccess::ODsnTypeCollection* _pTypeCollection) { m_pTypeCollection = _pTypeCollection; }
-};
-
 class DBOConnectionURLEdit
 {
     OUString m_sSavedValue;


More information about the Libreoffice-commits mailing list