LCOV - code coverage report
Current view: top level - extensions/source/dbpilots - listcombowizard.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 232 0.0 %
Date: 2012-08-25 Functions: 0 40 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

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

Generated by: LCOV version 1.10