LCOV - code coverage report
Current view: top level - dbaccess/source/ui/dlg - ConnectionPageSetup.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 53 1.9 %
Date: 2015-06-13 12:38:46 Functions: 2 17 11.8 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "ConnectionPageSetup.hxx"
      21             : #include "dbu_dlg.hrc"
      22             : #include <svl/itemset.hxx>
      23             : #include <unotools/pathoptions.hxx>
      24             : #include <svl/stritem.hxx>
      25             : #include <svl/eitem.hxx>
      26             : #include <svl/intitem.hxx>
      27             : #include "dsitems.hxx"
      28             : #include "dbaccess_helpid.hrc"
      29             : #include "localresaccess.hxx"
      30             : #include <osl/process.h>
      31             : #include <vcl/msgbox.hxx>
      32             : #include "dbadmin.hxx"
      33             : #include <comphelper/types.hxx>
      34             : #include <vcl/stdtext.hxx>
      35             : #include "sqlmessage.hxx"
      36             : #include "odbcconfig.hxx"
      37             : #include "dsselect.hxx"
      38             : #include <svl/filenotation.hxx>
      39             : #include "dbustrings.hrc"
      40             : #include <com/sun/star/sdbc/XRow.hpp>
      41             : #include <com/sun/star/awt/XWindow.hpp>
      42             : #include <com/sun/star/task/XInteractionHandler.hpp>
      43             : #include <com/sun/star/ucb/XProgressHandler.hpp>
      44             : #include <com/sun/star/sdbc/XConnection.hpp>
      45             : #include "UITools.hxx"
      46             : #include <unotools/localfilehelper.hxx>
      47             : #include <unotools/ucbhelper.hxx>
      48             : #include <ucbhelper/commandenvironment.hxx>
      49             : #include "finteraction.hxx"
      50             : #include <connectivity/CommonTools.hxx>
      51             : #include <sfx2/docfilt.hxx>
      52             : #include <vcl/mnemonic.hxx>
      53             : 
      54             : namespace dbaui
      55             : {
      56             :     using namespace ::com::sun::star::uno;
      57             :     using namespace ::com::sun::star::ucb;
      58             :     using namespace ::com::sun::star::ui::dialogs;
      59             :     using namespace ::com::sun::star::sdbc;
      60             :     using namespace ::com::sun::star::beans;
      61             :     using namespace ::com::sun::star::lang;
      62             :     using namespace ::com::sun::star::container;
      63             :     using namespace ::dbtools;
      64             :     using namespace ::svt;
      65             : 
      66           0 :     VclPtr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateDbaseTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
      67             :     {
      68           0 :         return VclPtr<OConnectionTabPageSetup>::Create ( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_DBASE_HELPTEXT, STR_DBASE_HEADERTEXT, STR_DBASE_PATH_OR_FILE );
      69             :     }
      70             : 
      71           0 :     VclPtr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateMSAccessTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
      72             :     {
      73           0 :         return VclPtr<OConnectionTabPageSetup>::Create( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_MSACCESS_HELPTEXT, STR_MSACCESS_HEADERTEXT, STR_MSACCESS_MDB_FILE );
      74             :     }
      75             : 
      76           0 :     VclPtr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateADOTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
      77             :     {
      78           0 :         return VclPtr<OConnectionTabPageSetup>::Create( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_ADO_HELPTEXT, STR_ADO_HEADERTEXT, STR_COMMONURL );
      79             :     }
      80             : 
      81           0 :     VclPtr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateODBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
      82             :     {
      83           0 :         return VclPtr<OConnectionTabPageSetup>::Create( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_ODBC_HELPTEXT, STR_ODBC_HEADERTEXT, STR_NAME_OF_ODBC_DATASOURCE );
      84             :     }
      85             : 
      86           0 :     VclPtr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateUserDefinedTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
      87             :     {
      88           0 :         return VclPtr<OConnectionTabPageSetup>::Create( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, USHRT_MAX, USHRT_MAX, STR_COMMONURL );
      89             :     }
      90             : 
      91           0 :     OConnectionTabPageSetup::OConnectionTabPageSetup(vcl::Window* pParent, const OString& _rId, const OUString& _rUIXMLDescription, const SfxItemSet& _rCoreAttrs, sal_uInt16 _nHelpTextResId, sal_uInt16 _nHeaderResId, sal_uInt16 _nUrlResId)
      92             :         :OConnectionHelper(pParent, _rId, _rUIXMLDescription, _rCoreAttrs)
      93           0 :         ,m_bUserGrabFocus(true)
      94             :     {
      95           0 :         get(m_pHelpText, "helptext");
      96           0 :         get(m_pHeaderText, "header");
      97             : 
      98           0 :         if ( USHRT_MAX != _nHelpTextResId )
      99             :         {
     100           0 :             OUString sHelpText = ModuleRes(_nHelpTextResId);
     101           0 :             m_pHelpText->SetText(sHelpText);
     102             :         }
     103             :         else
     104           0 :             m_pHelpText->Hide();
     105             : 
     106           0 :         if ( USHRT_MAX != _nHeaderResId )
     107           0 :             m_pHeaderText->SetText(ModuleRes(_nHeaderResId));
     108             : 
     109           0 :         if ( USHRT_MAX != _nUrlResId )
     110             :         {
     111           0 :             OUString sLabelText = ModuleRes(_nUrlResId);
     112           0 :             m_pFT_Connection->SetText(sLabelText);
     113             :         }
     114             :         else
     115           0 :             m_pFT_Connection->Hide();
     116             : 
     117           0 :         m_pConnectionURL->SetModifyHdl(LINK(this, OConnectionTabPageSetup, OnEditModified));
     118             : 
     119           0 :         SetRoadmapStateValue(false);
     120           0 :     }
     121             : 
     122           0 :     OConnectionTabPageSetup::~OConnectionTabPageSetup()
     123             :     {
     124           0 :         disposeOnce();
     125           0 :     }
     126             : 
     127           0 :     void OConnectionTabPageSetup::dispose()
     128             :     {
     129           0 :         m_pHelpText.clear();
     130           0 :         m_pHeaderText.clear();
     131           0 :         OConnectionHelper::dispose();
     132           0 :     }
     133             : 
     134           0 :     void OConnectionTabPageSetup::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue)
     135             :     {
     136           0 :         m_eType = m_pAdminDialog->getDatasourceType(_rSet);
     137             :         // special handling for oracle, this can only happen
     138             :         // if the user enters the same url as used for Oracle and we are on the JDBC path
     139             :         //! TODO
     140             :         //if (  ::dbaccess::DST_ORACLE_JDBC == m_eType )
     141             :         //    m_eType =  ::dbaccess::DST_JDBC;
     142             : 
     143           0 :         OConnectionHelper::implInitControls(_rSet, _bSaveValue);
     144             : 
     145             :         //! TODO
     146             :         //if ( m_eType >=  ::dbaccess::DST_USERDEFINE1 )
     147             :         //{
     148             :         //  OUString sDisplayName = m_pCollection->getTypeDisplayName(m_eType);
     149             :         //  FixedText* ppTextControls[] ={&m_aFT_Connection};
     150             :         //  for (size_t i = 0; i < sizeof(ppTextControls)/sizeof(ppTextControls[0]); ++i)
     151             :         //  {
     152             :         //      ppTextControls[i]->SetText(sDisplayName);
     153             :         //  }
     154             :         //}
     155             : 
     156           0 :         callModifiedHdl();
     157           0 :     }
     158             : 
     159           0 :     bool OConnectionTabPageSetup::commitPage( ::svt::WizardTypes::CommitPageReason /*_eReason*/ )
     160             :     {
     161           0 :         return commitURL();
     162             :     }
     163             : 
     164           0 :     bool OConnectionTabPageSetup::FillItemSet(SfxItemSet* _rSet)
     165             :     {
     166           0 :         bool bChangedSomething = false;
     167           0 :         fillString(*_rSet,m_pConnectionURL, DSID_CONNECTURL, bChangedSomething);
     168           0 :         return bChangedSomething;
     169             :     }
     170           0 :     bool OConnectionTabPageSetup::checkTestConnection()
     171             :     {
     172           0 :         return !m_pConnectionURL->IsVisible() || !m_pConnectionURL->GetTextNoPrefix().isEmpty();
     173             :     }
     174             : 
     175           0 :     IMPL_LINK(OConnectionTabPageSetup, OnEditModified, Edit*, /*_pEdit*/)
     176             :     {
     177           0 :         SetRoadmapStateValue(checkTestConnection());
     178           0 :         callModifiedHdl();
     179           0 :         return 0L;
     180             :     }
     181          36 : }   // namespace dbaui
     182             : 
     183             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11