LCOV - code coverage report
Current view: top level - dbaccess/source/ui/dlg - ConnectionPageSetup.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 47 2.1 %
Date: 2014-11-03 Functions: 2 16 12.5 %
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 :     OGenericAdministrationPage* OConnectionTabPageSetup::CreateDbaseTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
      67             :     {
      68           0 :         return new OConnectionTabPageSetup( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_DBASE_HELPTEXT, STR_DBASE_HEADERTEXT, STR_DBASE_PATH_OR_FILE);
      69             :     }
      70             : 
      71           0 :     OGenericAdministrationPage* OConnectionTabPageSetup::CreateMSAccessTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
      72             :     {
      73           0 :         return new OConnectionTabPageSetup( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_MSACCESS_HELPTEXT, STR_MSACCESS_HEADERTEXT, STR_MSACCESS_MDB_FILE);
      74             :     }
      75             : 
      76           0 :     OGenericAdministrationPage* OConnectionTabPageSetup::CreateADOTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
      77             :     {
      78           0 :         return new OConnectionTabPageSetup( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_ADO_HELPTEXT, STR_ADO_HEADERTEXT, STR_COMMONURL);
      79             :     }
      80             : 
      81           0 :     OGenericAdministrationPage* OConnectionTabPageSetup::CreateODBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
      82             :     {
      83           0 :         return new OConnectionTabPageSetup( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_ODBC_HELPTEXT, STR_ODBC_HEADERTEXT, STR_NAME_OF_ODBC_DATASOURCE);
      84             :     }
      85             : 
      86           0 :     OGenericAdministrationPage* OConnectionTabPageSetup::CreateUserDefinedTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
      87             :     {
      88           0 :         return new OConnectionTabPageSetup( 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 :     }
     125             : 
     126           0 :     void OConnectionTabPageSetup::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue)
     127             :     {
     128           0 :         m_eType = m_pAdminDialog->getDatasourceType(_rSet);
     129             :         // special handling for oracle, this can only happen
     130             :         // if the user enters the same url as used for Oracle and we are on the JDBC path
     131             :         //! TODO
     132             :         //if (  ::dbaccess::DST_ORACLE_JDBC == m_eType )
     133             :         //    m_eType =  ::dbaccess::DST_JDBC;
     134             : 
     135           0 :         OConnectionHelper::implInitControls(_rSet, _bSaveValue);
     136             : 
     137             :         //! TODO
     138             :         //if ( m_eType >=  ::dbaccess::DST_USERDEFINE1 )
     139             :         //{
     140             :         //  OUString sDisplayName = m_pCollection->getTypeDisplayName(m_eType);
     141             :         //  FixedText* ppTextControls[] ={&m_aFT_Connection};
     142             :         //  for (size_t i = 0; i < sizeof(ppTextControls)/sizeof(ppTextControls[0]); ++i)
     143             :         //  {
     144             :         //      ppTextControls[i]->SetText(sDisplayName);
     145             :         //  }
     146             :         //}
     147             : 
     148           0 :         callModifiedHdl();
     149           0 :     }
     150             : 
     151           0 :     bool OConnectionTabPageSetup::commitPage( ::svt::WizardTypes::CommitPageReason /*_eReason*/ )
     152             :     {
     153           0 :         return commitURL();
     154             :     }
     155             : 
     156           0 :     bool OConnectionTabPageSetup::FillItemSet(SfxItemSet* _rSet)
     157             :     {
     158           0 :         bool bChangedSomething = false;
     159           0 :         fillString(*_rSet,m_pConnectionURL, DSID_CONNECTURL, bChangedSomething);
     160           0 :         return bChangedSomething;
     161             :     }
     162           0 :     bool OConnectionTabPageSetup::checkTestConnection()
     163             :     {
     164           0 :         return !m_pConnectionURL->IsVisible() || !m_pConnectionURL->GetTextNoPrefix().isEmpty();
     165             :     }
     166             : 
     167           0 :     IMPL_LINK(OConnectionTabPageSetup, OnEditModified, Edit*, /*_pEdit*/)
     168             :     {
     169           0 :         SetRoadmapStateValue(checkTestConnection());
     170           0 :         callModifiedHdl();
     171           0 :         return 0L;
     172             :     }
     173          72 : }   // namespace dbaui
     174             : 
     175             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10