LCOV - code coverage report
Current view: top level - libreoffice/extensions/source/dbpilots - listcombowizard.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 232 0.0 %
Date: 2012-12-17 Functions: 0 40 0.0 %
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 "listcombowizard.hxx"
      21             : #include "commonpagesdbp.hxx"
      22             : #include <com/sun/star/sdbc/XConnection.hpp>
      23             : #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
      24             : #include <com/sun/star/container/XNameAccess.hpp>
      25             : #include <com/sun/star/form/ListSourceType.hpp>
      26             : #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
      27             : #include <tools/debug.hxx>
      28             : #include <vcl/msgbox.hxx>
      29             : #include <connectivity/dbtools.hxx>
      30             : #include "dbpilots.hrc"
      31             : #include <comphelper/extract.hxx>
      32             : 
      33             : //.........................................................................
      34             : namespace dbp
      35             : {
      36             : //.........................................................................
      37             : 
      38             :     using namespace ::com::sun::star::uno;
      39             :     using namespace ::com::sun::star::lang;
      40             :     using namespace ::com::sun::star::beans;
      41             :     using namespace ::com::sun::star::sdbc;
      42             :     using namespace ::com::sun::star::sdbcx;
      43             :     using namespace ::com::sun::star::container;
      44             :     using namespace ::com::sun::star::form;
      45             :     using namespace ::svt;
      46             :     using namespace ::dbtools;
      47             : 
      48             :     //=====================================================================
      49             :     //= OListComboWizard
      50             :     //=====================================================================
      51             :     //---------------------------------------------------------------------
      52           0 :     OListComboWizard::OListComboWizard( Window* _pParent,
      53             :             const Reference< XPropertySet >& _rxObjectModel, const Reference< XComponentContext >& _rxContext )
      54             :         :OControlWizard(_pParent, ModuleRes(RID_DLG_LISTCOMBOWIZARD), _rxObjectModel, _rxContext)
      55             :         ,m_bListBox(sal_False)
      56           0 :         ,m_bHadDataSelection(sal_True)
      57             :     {
      58           0 :         initControlSettings(&m_aSettings);
      59             : 
      60           0 :         m_pPrevPage->SetHelpId(HID_LISTWIZARD_PREVIOUS);
      61           0 :         m_pNextPage->SetHelpId(HID_LISTWIZARD_NEXT);
      62           0 :         m_pCancel->SetHelpId(HID_LISTWIZARD_CANCEL);
      63           0 :         m_pFinish->SetHelpId(HID_LISTWIZARD_FINISH);
      64             : 
      65             :         // if we do not need the data source selection page ...
      66           0 :         if (!needDatasourceSelection())
      67             :         {   // ... skip it!
      68           0 :             skip(1);
      69           0 :             m_bHadDataSelection = sal_False;
      70             :         }
      71           0 :     }
      72             : 
      73             :     //---------------------------------------------------------------------
      74           0 :     sal_Bool OListComboWizard::approveControl(sal_Int16 _nClassId)
      75             :     {
      76           0 :         switch (_nClassId)
      77             :         {
      78             :             case FormComponentType::LISTBOX:
      79           0 :                 m_bListBox = sal_True;
      80           0 :                 setTitleBase(String(ModuleRes(RID_STR_LISTWIZARD_TITLE)));
      81           0 :                 return sal_True;
      82             :             case FormComponentType::COMBOBOX:
      83           0 :                 m_bListBox = sal_False;
      84           0 :                 setTitleBase(String(ModuleRes(RID_STR_COMBOWIZARD_TITLE)));
      85           0 :                 return sal_True;
      86             :         }
      87           0 :         return sal_False;
      88             :     }
      89             : 
      90             :     //---------------------------------------------------------------------
      91           0 :     OWizardPage* OListComboWizard::createPage(WizardState _nState)
      92             :     {
      93           0 :         switch (_nState)
      94             :         {
      95             :             case LCW_STATE_DATASOURCE_SELECTION:
      96           0 :                 return new OTableSelectionPage(this);
      97             :             case LCW_STATE_TABLESELECTION:
      98           0 :                 return new OContentTableSelection(this);
      99             :             case LCW_STATE_FIELDSELECTION:
     100           0 :                 return new OContentFieldSelection(this);
     101             :             case LCW_STATE_FIELDLINK:
     102           0 :                 return new OLinkFieldsPage(this);
     103             :             case LCW_STATE_COMBODBFIELD:
     104           0 :                 return new OComboDBFieldPage(this);
     105             :         }
     106             : 
     107           0 :         return NULL;
     108             :     }
     109             : 
     110             :     //---------------------------------------------------------------------
     111           0 :     WizardTypes::WizardState OListComboWizard::determineNextState( WizardState _nCurrentState ) const
     112             :     {
     113           0 :         switch (_nCurrentState)
     114             :         {
     115             :             case LCW_STATE_DATASOURCE_SELECTION:
     116           0 :                 return LCW_STATE_TABLESELECTION;
     117             :             case LCW_STATE_TABLESELECTION:
     118           0 :                 return LCW_STATE_FIELDSELECTION;
     119             :             case LCW_STATE_FIELDSELECTION:
     120           0 :                 return getFinalState();
     121             :         }
     122             : 
     123           0 :         return WZS_INVALID_STATE;
     124             :     }
     125             : 
     126             :     //---------------------------------------------------------------------
     127           0 :     void OListComboWizard::enterState(WizardState _nState)
     128             :     {
     129           0 :         OControlWizard::enterState(_nState);
     130             : 
     131           0 :         enableButtons(WZB_PREVIOUS, m_bHadDataSelection ? (LCW_STATE_DATASOURCE_SELECTION < _nState) : LCW_STATE_TABLESELECTION < _nState);
     132           0 :         enableButtons(WZB_NEXT, getFinalState() != _nState);
     133           0 :         if (_nState < getFinalState())
     134           0 :             enableButtons(WZB_FINISH, sal_False);
     135             : 
     136           0 :         if (getFinalState() == _nState)
     137           0 :             defaultButton(WZB_FINISH);
     138           0 :     }
     139             : 
     140             :     //---------------------------------------------------------------------
     141           0 :     sal_Bool OListComboWizard::leaveState(WizardState _nState)
     142             :     {
     143           0 :         if (!OControlWizard::leaveState(_nState))
     144           0 :             return sal_False;
     145             : 
     146           0 :         if (getFinalState() == _nState)
     147           0 :             defaultButton(WZB_NEXT);
     148             : 
     149           0 :         return sal_True;
     150             :     }
     151             : 
     152             :     //---------------------------------------------------------------------
     153           0 :     void OListComboWizard::implApplySettings()
     154             :     {
     155             :         try
     156             :         {
     157             :             // for quoting identifiers, we need the connection meta data
     158           0 :             Reference< XConnection > xConn = getFormConnection();
     159             :             DBG_ASSERT(xConn.is(), "OListComboWizard::implApplySettings: no connection, unable to quote!");
     160           0 :             Reference< XDatabaseMetaData > xMetaData;
     161           0 :             if (xConn.is())
     162           0 :                 xMetaData = xConn->getMetaData();
     163             : 
     164             :             // do some quotings
     165           0 :             if (xMetaData.is())
     166             :             {
     167           0 :                 ::rtl::OUString sQuoteString = xMetaData->getIdentifierQuoteString();
     168           0 :                 if (isListBox()) // only when we have a listbox this should be not empty
     169           0 :                     getSettings().sLinkedListField = quoteName(sQuoteString, getSettings().sLinkedListField);
     170             : 
     171           0 :                 ::rtl::OUString sCatalog, sSchema, sName;
     172           0 :                 ::dbtools::qualifiedNameComponents( xMetaData, getSettings().sListContentTable, sCatalog, sSchema, sName, ::dbtools::eInDataManipulation );
     173           0 :                 getSettings().sListContentTable = ::dbtools::composeTableNameForSelect( xConn, sCatalog, sSchema, sName );
     174             : 
     175           0 :                 getSettings().sListContentField = quoteName(sQuoteString, getSettings().sListContentField);
     176             :             }
     177             : 
     178             :             // ListSourceType: SQL
     179           0 :             getContext().xObjectModel->setPropertyValue(::rtl::OUString("ListSourceType"), makeAny((sal_Int32)ListSourceType_SQL));
     180             : 
     181           0 :             if (isListBox())
     182             :             {
     183             :                 // BoundColumn: 1
     184           0 :                 getContext().xObjectModel->setPropertyValue(::rtl::OUString("BoundColumn"), makeAny((sal_Int16)1));
     185             : 
     186             :                 // build the statement to set as list source
     187           0 :                 String sStatement;
     188           0 :                 sStatement.AppendAscii("SELECT ");
     189           0 :                 sStatement += getSettings().sListContentField;
     190           0 :                 sStatement.AppendAscii(", ");
     191           0 :                 sStatement += getSettings().sLinkedListField;
     192           0 :                 sStatement.AppendAscii(" FROM ");
     193           0 :                 sStatement += getSettings().sListContentTable;
     194           0 :                 Sequence< ::rtl::OUString > aListSource(1);
     195           0 :                 aListSource[0] = sStatement;
     196           0 :                 getContext().xObjectModel->setPropertyValue(::rtl::OUString("ListSource"), makeAny(aListSource));
     197             :             }
     198             :             else
     199             :             {
     200             :                 // build the statement to set as list source
     201           0 :                 String sStatement;
     202           0 :                 sStatement.AppendAscii("SELECT DISTINCT ");
     203           0 :                 sStatement += getSettings().sListContentField;
     204           0 :                 sStatement.AppendAscii(" FROM ");
     205           0 :                 sStatement += getSettings().sListContentTable;
     206           0 :                 getContext().xObjectModel->setPropertyValue(::rtl::OUString("ListSource"), makeAny(::rtl::OUString(sStatement)));
     207             :             }
     208             : 
     209             :             // the bound field
     210           0 :             getContext().xObjectModel->setPropertyValue(::rtl::OUString("DataField"), makeAny(::rtl::OUString(getSettings().sLinkedFormField)));
     211             :         }
     212           0 :         catch(const Exception&)
     213             :         {
     214             :             OSL_FAIL("OListComboWizard::implApplySettings: could not set the property values for the listbox!");
     215             :         }
     216           0 :     }
     217             : 
     218             :     //---------------------------------------------------------------------
     219           0 :     sal_Bool OListComboWizard::onFinish()
     220             :     {
     221           0 :         if ( !OControlWizard::onFinish() )
     222           0 :             return sal_False;
     223             : 
     224           0 :         implApplySettings();
     225           0 :         return sal_True;
     226             :     }
     227             : 
     228             :     //=====================================================================
     229             :     //= OLCPage
     230             :     //=====================================================================
     231             :     //---------------------------------------------------------------------
     232           0 :     Reference< XNameAccess > OLCPage::getTables(sal_Bool _bNeedIt)
     233             :     {
     234           0 :         Reference< XConnection > xConn = getFormConnection();
     235             :         DBG_ASSERT(!_bNeedIt || xConn.is(), "OLCPage::getTables: should have an active connection when reaching this page!");
     236             :         (void)_bNeedIt;
     237             : 
     238           0 :         Reference< XTablesSupplier > xSuppTables(xConn, UNO_QUERY);
     239           0 :         Reference< XNameAccess > xTables;
     240           0 :         if (xSuppTables.is())
     241           0 :             xTables = xSuppTables->getTables();
     242             : 
     243             :         DBG_ASSERT(!_bNeedIt || xTables.is() || !xConn.is(), "OLCPage::getTables: got no tables from the connection!");
     244             : 
     245           0 :         return xTables;
     246             :     }
     247             : 
     248             :     //---------------------------------------------------------------------
     249           0 :     Sequence< ::rtl::OUString > OLCPage::getTableFields(sal_Bool _bNeedIt)
     250             :     {
     251           0 :         Reference< XNameAccess > xTables = getTables(_bNeedIt);
     252           0 :         Sequence< ::rtl::OUString > aColumnNames;
     253           0 :         if (xTables.is())
     254             :         {
     255             :             try
     256             :             {
     257             :                 // the list table as XColumnsSupplier
     258           0 :                 Reference< XColumnsSupplier > xSuppCols;
     259           0 :                 xTables->getByName(getSettings().sListContentTable) >>= xSuppCols;
     260             :                 DBG_ASSERT(!_bNeedIt || xSuppCols.is(), "OLCPage::getTableFields: no columns supplier!");
     261             : 
     262             :                 // the columns
     263           0 :                 Reference< XNameAccess > xColumns;
     264           0 :                 if (xSuppCols.is())
     265           0 :                     xColumns = xSuppCols->getColumns();
     266             : 
     267             :                 // the column names
     268           0 :                 if (xColumns.is())
     269           0 :                     aColumnNames = xColumns->getElementNames();
     270             :             }
     271           0 :             catch(const Exception&)
     272             :             {
     273             :                 DBG_ASSERT(!_bNeedIt, "OLinkFieldsPage::initializePage: caught an exception while retrieving the columns!");
     274             :             }
     275             :         }
     276           0 :         return aColumnNames;
     277             :     }
     278             : 
     279             :     //=====================================================================
     280             :     //= OContentTableSelection
     281             :     //=====================================================================
     282             :     //---------------------------------------------------------------------
     283           0 :     OContentTableSelection::OContentTableSelection( OListComboWizard* _pParent )
     284             :         :OLCPage(_pParent, ModuleRes(RID_PAGE_LCW_CONTENTSELECTION_TABLE))
     285             :         ,m_aFrame               (this, ModuleRes(FL_FRAME))
     286             :         ,m_aSelectTableLabel    (this, ModuleRes(FT_SELECTTABLE_LABEL))
     287           0 :         ,m_aSelectTable         (this, ModuleRes(LB_SELECTTABLE))
     288             :     {
     289           0 :         FreeResource();
     290             : 
     291           0 :         enableFormDatasourceDisplay();
     292             : 
     293           0 :         m_aSelectTable.SetDoubleClickHdl(LINK(this, OContentTableSelection, OnTableDoubleClicked));
     294           0 :         m_aSelectTable.SetSelectHdl(LINK(this, OContentTableSelection, OnTableSelected));
     295           0 :     }
     296             : 
     297             :     //---------------------------------------------------------------------
     298           0 :     void OContentTableSelection::ActivatePage()
     299             :     {
     300           0 :         OLCPage::ActivatePage();
     301           0 :         m_aSelectTable.GrabFocus();
     302           0 :     }
     303             : 
     304             :     //---------------------------------------------------------------------
     305           0 :     bool OContentTableSelection::canAdvance() const
     306             :     {
     307           0 :         if (!OLCPage::canAdvance())
     308           0 :             return false;
     309             : 
     310           0 :         return 0 != m_aSelectTable.GetSelectEntryCount();
     311             :     }
     312             : 
     313             :     //---------------------------------------------------------------------
     314           0 :     IMPL_LINK( OContentTableSelection, OnTableSelected, ListBox*, /*_pListBox*/ )
     315             :     {
     316           0 :         updateDialogTravelUI();
     317           0 :         return 0L;
     318             :     }
     319             : 
     320             :     //---------------------------------------------------------------------
     321           0 :     IMPL_LINK( OContentTableSelection, OnTableDoubleClicked, ListBox*, _pListBox )
     322             :     {
     323           0 :         if (_pListBox->GetSelectEntryCount())
     324           0 :             getDialog()->travelNext();
     325           0 :         return 0L;
     326             :     }
     327             : 
     328             :     //---------------------------------------------------------------------
     329           0 :     void OContentTableSelection::initializePage()
     330             :     {
     331           0 :         OLCPage::initializePage();
     332             : 
     333             :         // fill the list with the table name
     334           0 :         m_aSelectTable.Clear();
     335             :         try
     336             :         {
     337           0 :             Reference< XNameAccess > xTables = getTables(sal_True);
     338           0 :             Sequence< ::rtl::OUString > aTableNames;
     339           0 :             if (xTables.is())
     340           0 :                 aTableNames = xTables->getElementNames();
     341           0 :             fillListBox(m_aSelectTable, aTableNames);
     342             :         }
     343           0 :         catch(const Exception&)
     344             :         {
     345             :             OSL_FAIL("OContentTableSelection::initializePage: could not retrieve the table names!");
     346             :         }
     347             : 
     348           0 :         m_aSelectTable.SelectEntry(getSettings().sListContentTable);
     349           0 :     }
     350             : 
     351             :     //---------------------------------------------------------------------
     352           0 :     sal_Bool OContentTableSelection::commitPage( ::svt::WizardTypes::CommitPageReason _eReason )
     353             :     {
     354           0 :         if (!OLCPage::commitPage(_eReason))
     355           0 :             return sal_False;
     356             : 
     357           0 :         OListComboSettings& rSettings = getSettings();
     358           0 :         rSettings.sListContentTable = m_aSelectTable.GetSelectEntry();
     359           0 :         if (!rSettings.sListContentTable.Len() && (::svt::WizardTypes::eTravelBackward != _eReason))
     360             :             // need to select a table
     361           0 :             return sal_False;
     362             : 
     363           0 :         return sal_True;
     364             :     }
     365             : 
     366             :     //=====================================================================
     367             :     //= OContentFieldSelection
     368             :     //=====================================================================
     369             :     //---------------------------------------------------------------------
     370           0 :     OContentFieldSelection::OContentFieldSelection( OListComboWizard* _pParent )
     371             :         :OLCPage(_pParent, ModuleRes(RID_PAGE_LCW_CONTENTSELECTION_FIELD))
     372             :         ,m_aFrame               (this, ModuleRes(FL_FRAME))
     373             :         ,m_aTableFields         (this, ModuleRes(FT_TABLEFIELDS))
     374             :         ,m_aSelectTableField    (this, ModuleRes(LB_SELECTFIELD))
     375             :         ,m_aDisplayedFieldLabel (this, ModuleRes(FT_DISPLAYEDFIELD))
     376             :         ,m_aDisplayedField      (this, ModuleRes(ET_DISPLAYEDFIELD))
     377           0 :         ,m_aInfo                (this, ModuleRes(FT_CONTENTFIELD_INFO))
     378             :     {
     379           0 :         m_aInfo.SetText(String(ModuleRes( isListBox() ? STR_FIELDINFO_LISTBOX : STR_FIELDINFO_COMBOBOX)));
     380           0 :         FreeResource();
     381           0 :         m_aSelectTableField.SetSelectHdl(LINK(this, OContentFieldSelection, OnFieldSelected));
     382           0 :         m_aSelectTableField.SetDoubleClickHdl(LINK(this, OContentFieldSelection, OnTableDoubleClicked));
     383           0 :     }
     384             : 
     385             :     //---------------------------------------------------------------------
     386           0 :     void OContentFieldSelection::ActivatePage()
     387             :     {
     388           0 :         OLCPage::ActivatePage();
     389           0 :         m_aTableFields.GrabFocus();
     390           0 :     }
     391             : 
     392             :     //---------------------------------------------------------------------
     393           0 :     void OContentFieldSelection::initializePage()
     394             :     {
     395           0 :         OLCPage::initializePage();
     396             : 
     397             :         // fill the list of fields
     398           0 :         fillListBox(m_aSelectTableField, getTableFields(sal_True));
     399             : 
     400           0 :         m_aSelectTableField.SelectEntry(getSettings().sListContentField);
     401           0 :         m_aDisplayedField.SetText(getSettings().sListContentField);
     402           0 :     }
     403             : 
     404             :     //---------------------------------------------------------------------
     405           0 :     bool OContentFieldSelection::canAdvance() const
     406             :     {
     407           0 :         if (!OLCPage::canAdvance())
     408           0 :             return false;
     409             : 
     410           0 :         return 0 != m_aSelectTableField.GetSelectEntryCount();
     411             :     }
     412             : 
     413             :     //---------------------------------------------------------------------
     414           0 :     IMPL_LINK( OContentFieldSelection, OnTableDoubleClicked, ListBox*, /*NOTINTERESTEDIN*/ )
     415             :     {
     416           0 :         if (m_aSelectTableField.GetSelectEntryCount())
     417           0 :             getDialog()->travelNext();
     418           0 :         return 0L;
     419             :     }
     420             : 
     421             :     //---------------------------------------------------------------------
     422           0 :     IMPL_LINK( OContentFieldSelection, OnFieldSelected, ListBox*, /*NOTINTERESTEDIN*/ )
     423             :     {
     424           0 :         updateDialogTravelUI();
     425           0 :         m_aDisplayedField.SetText(m_aSelectTableField.GetSelectEntry());
     426           0 :         return 0L;
     427             :     }
     428             : 
     429             :     //---------------------------------------------------------------------
     430           0 :     sal_Bool OContentFieldSelection::commitPage( ::svt::WizardTypes::CommitPageReason _eReason )
     431             :     {
     432           0 :         if (!OLCPage::commitPage(_eReason))
     433           0 :             return sal_False;
     434             : 
     435           0 :         getSettings().sListContentField = m_aSelectTableField.GetSelectEntry();
     436             : 
     437           0 :         return sal_True;
     438             :     }
     439             : 
     440             :     //=====================================================================
     441             :     //= OLinkFieldsPage
     442             :     //=====================================================================
     443             :     //---------------------------------------------------------------------
     444           0 :     OLinkFieldsPage::OLinkFieldsPage( OListComboWizard* _pParent )
     445             :         :OLCPage(_pParent, ModuleRes(RID_PAGE_LCW_FIELDLINK))
     446             :         ,m_aDescription         (this, ModuleRes(FT_FIELDLINK_DESC))
     447             :         ,m_aFrame               (this, ModuleRes(FL_FRAME))
     448             :         ,m_aValueListFieldLabel (this, ModuleRes(FT_VALUELISTFIELD))
     449             :         ,m_aValueListField      (this, ModuleRes(CMB_VALUELISTFIELD))
     450             :         ,m_aTableFieldLabel     (this, ModuleRes(FT_TABLEFIELD))
     451           0 :         ,m_aTableField          (this, ModuleRes(CMB_TABLEFIELD))
     452             :     {
     453           0 :         FreeResource();
     454             : 
     455           0 :         m_aValueListField.SetModifyHdl(LINK(this, OLinkFieldsPage, OnSelectionModified));
     456           0 :         m_aTableField.SetModifyHdl(LINK(this, OLinkFieldsPage, OnSelectionModified));
     457           0 :         m_aValueListField.SetSelectHdl(LINK(this, OLinkFieldsPage, OnSelectionModified));
     458           0 :         m_aTableField.SetSelectHdl(LINK(this, OLinkFieldsPage, OnSelectionModified));
     459           0 :     }
     460             : 
     461             :     //---------------------------------------------------------------------
     462           0 :     void OLinkFieldsPage::ActivatePage()
     463             :     {
     464           0 :         OLCPage::ActivatePage();
     465           0 :         m_aValueListField.GrabFocus();
     466           0 :     }
     467             : 
     468             :     //---------------------------------------------------------------------
     469           0 :     void OLinkFieldsPage::initializePage()
     470             :     {
     471           0 :         OLCPage::initializePage();
     472             : 
     473             :         // fill the value list
     474           0 :         fillListBox(m_aValueListField, getContext().aFieldNames);
     475             :         // fill the table field list
     476           0 :         fillListBox(m_aTableField, getTableFields(sal_True));
     477             : 
     478             :         // the initial selections
     479           0 :         m_aValueListField.SetText(getSettings().sLinkedFormField);
     480           0 :         m_aTableField.SetText(getSettings().sLinkedListField);
     481             : 
     482           0 :         implCheckFinish();
     483           0 :     }
     484             : 
     485             :     //---------------------------------------------------------------------
     486           0 :     bool OLinkFieldsPage::canAdvance() const
     487             :     {
     488             :         // we're on the last page here, no travelNext allowed ...
     489           0 :         return false;
     490             :     }
     491             : 
     492             :     //---------------------------------------------------------------------
     493           0 :     void OLinkFieldsPage::implCheckFinish()
     494             :     {
     495           0 :         sal_Bool bInvalidSelection = (COMBOBOX_ENTRY_NOTFOUND == m_aValueListField.GetEntryPos(m_aValueListField.GetText()));
     496           0 :         bInvalidSelection |= (COMBOBOX_ENTRY_NOTFOUND == m_aTableField.GetEntryPos(m_aTableField.GetText()));
     497           0 :         getDialog()->enableButtons(WZB_FINISH, !bInvalidSelection);
     498           0 :     }
     499             : 
     500             :     //---------------------------------------------------------------------
     501           0 :     IMPL_LINK_NOARG(OLinkFieldsPage, OnSelectionModified)
     502             :     {
     503           0 :         implCheckFinish();
     504           0 :         return 0L;
     505             :     }
     506             : 
     507             :     //---------------------------------------------------------------------
     508           0 :     sal_Bool OLinkFieldsPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason )
     509             :     {
     510           0 :         if (!OLCPage::commitPage(_eReason))
     511           0 :             return sal_False;
     512             : 
     513           0 :         getSettings().sLinkedFormField = m_aValueListField.GetText();
     514           0 :         getSettings().sLinkedListField = m_aTableField.GetText();
     515             : 
     516           0 :         return sal_True;
     517             :     }
     518             : 
     519             :     //=====================================================================
     520             :     //= OComboDBFieldPage
     521             :     //=====================================================================
     522             :     //---------------------------------------------------------------------
     523           0 :     OComboDBFieldPage::OComboDBFieldPage( OControlWizard* _pParent )
     524           0 :         :ODBFieldPage(_pParent)
     525             :     {
     526           0 :         setDescriptionText(String(ModuleRes(RID_STR_COMBOWIZ_DBFIELD)));
     527           0 :     }
     528             : 
     529             :     //---------------------------------------------------------------------
     530           0 :     String& OComboDBFieldPage::getDBFieldSetting()
     531             :     {
     532           0 :         return getSettings().sLinkedFormField;
     533             :     }
     534             : 
     535             :     //---------------------------------------------------------------------
     536           0 :     void OComboDBFieldPage::ActivatePage()
     537             :     {
     538           0 :         ODBFieldPage::ActivatePage();
     539           0 :         getDialog()->enableButtons(WZB_FINISH, sal_True);
     540           0 :     }
     541             : 
     542             :     //---------------------------------------------------------------------
     543           0 :     bool OComboDBFieldPage::canAdvance() const
     544             :     {
     545             :         // we're on the last page here, no travelNext allowed ...
     546           0 :         return false;
     547             :     }
     548             : 
     549             : //.........................................................................
     550             : }   // namespace dbp
     551             : //.........................................................................
     552             : 
     553             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10