LCOV - code coverage report
Current view: top level - extensions/source/dbpilots - groupboxwiz.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 217 0.0 %
Date: 2012-08-25 Functions: 0 36 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 "groupboxwiz.hxx"
      30                 :            : #include "commonpagesdbp.hxx"
      31                 :            : #include <tools/debug.hxx>
      32                 :            : #include <vcl/svapp.hxx>
      33                 :            : #include <vcl/msgbox.hxx>
      34                 :            : #include "optiongrouplayouter.hxx"
      35                 :            : #include "dbpilots.hrc"
      36                 :            : 
      37                 :            : #define GBW_STATE_OPTIONLIST        0
      38                 :            : #define GBW_STATE_DEFAULTOPTION     1
      39                 :            : #define GBW_STATE_OPTIONVALUES      2
      40                 :            : #define GBW_STATE_DBFIELD           3
      41                 :            : #define GBW_STATE_FINALIZE          4
      42                 :            : 
      43                 :            : //.........................................................................
      44                 :            : namespace dbp
      45                 :            : {
      46                 :            : //.........................................................................
      47                 :            : 
      48                 :            :     using namespace ::com::sun::star::uno;
      49                 :            :     using namespace ::com::sun::star::lang;
      50                 :            :     using namespace ::com::sun::star::beans;
      51                 :            :     using namespace ::com::sun::star::form;
      52                 :            :     using namespace ::svt;
      53                 :            : 
      54                 :            :     //=====================================================================
      55                 :            :     //= OGroupBoxWizard
      56                 :            :     //=====================================================================
      57                 :            :     //---------------------------------------------------------------------
      58                 :          0 :     OGroupBoxWizard::OGroupBoxWizard( Window* _pParent,
      59                 :            :             const Reference< XPropertySet >& _rxObjectModel, const Reference< XMultiServiceFactory >& _rxORB )
      60                 :            :         :OControlWizard(_pParent, ModuleRes(RID_DLG_GROUPBOXWIZARD), _rxObjectModel, _rxORB)
      61                 :            :         ,m_bVisitedDefault(sal_False)
      62                 :          0 :         ,m_bVisitedDB(sal_False)
      63                 :            :     {
      64                 :          0 :         initControlSettings(&m_aSettings);
      65                 :            : 
      66                 :          0 :         m_pPrevPage->SetHelpId(HID_GROUPWIZARD_PREVIOUS);
      67                 :          0 :         m_pNextPage->SetHelpId(HID_GROUPWIZARD_NEXT);
      68                 :          0 :         m_pCancel->SetHelpId(HID_GROUPWIZARD_CANCEL);
      69                 :          0 :         m_pFinish->SetHelpId(HID_GROUPWIZARD_FINISH);
      70                 :          0 :     }
      71                 :            : 
      72                 :            :     //---------------------------------------------------------------------
      73                 :          0 :     sal_Bool OGroupBoxWizard::approveControl(sal_Int16 _nClassId)
      74                 :            :     {
      75                 :          0 :         return FormComponentType::GROUPBOX == _nClassId;
      76                 :            :     }
      77                 :            : 
      78                 :            :     //---------------------------------------------------------------------
      79                 :          0 :     OWizardPage* OGroupBoxWizard::createPage(::svt::WizardTypes::WizardState _nState)
      80                 :            :     {
      81                 :          0 :         switch (_nState)
      82                 :            :         {
      83                 :            :             case GBW_STATE_OPTIONLIST:
      84                 :          0 :                 return new ORadioSelectionPage(this);
      85                 :            : 
      86                 :            :             case GBW_STATE_DEFAULTOPTION:
      87                 :          0 :                 return new ODefaultFieldSelectionPage(this);
      88                 :            : 
      89                 :            :             case GBW_STATE_OPTIONVALUES:
      90                 :          0 :                 return new OOptionValuesPage(this);
      91                 :            : 
      92                 :            :             case GBW_STATE_DBFIELD:
      93                 :          0 :                 return new OOptionDBFieldPage(this);
      94                 :            : 
      95                 :            :             case GBW_STATE_FINALIZE:
      96                 :          0 :                 return new OFinalizeGBWPage(this);
      97                 :            :         }
      98                 :            : 
      99                 :          0 :         return NULL;
     100                 :            :     }
     101                 :            : 
     102                 :            :     //---------------------------------------------------------------------
     103                 :          0 :     WizardTypes::WizardState OGroupBoxWizard::determineNextState( ::svt::WizardTypes::WizardState _nCurrentState ) const
     104                 :            :     {
     105                 :          0 :         switch (_nCurrentState)
     106                 :            :         {
     107                 :            :             case GBW_STATE_OPTIONLIST:
     108                 :          0 :                 return GBW_STATE_DEFAULTOPTION;
     109                 :            : 
     110                 :            :             case GBW_STATE_DEFAULTOPTION:
     111                 :          0 :                 return GBW_STATE_OPTIONVALUES;
     112                 :            : 
     113                 :            :             case GBW_STATE_OPTIONVALUES:
     114                 :          0 :                 if (getContext().aFieldNames.getLength())
     115                 :          0 :                     return GBW_STATE_DBFIELD;
     116                 :            :                 else
     117                 :          0 :                     return GBW_STATE_FINALIZE;
     118                 :            : 
     119                 :            :             case GBW_STATE_DBFIELD:
     120                 :          0 :                 return GBW_STATE_FINALIZE;
     121                 :            :         }
     122                 :            : 
     123                 :          0 :         return WZS_INVALID_STATE;
     124                 :            :     }
     125                 :            : 
     126                 :            :     //---------------------------------------------------------------------
     127                 :          0 :     void OGroupBoxWizard::enterState(::svt::WizardTypes::WizardState _nState)
     128                 :            :     {
     129                 :            :         // some stuff to do before calling the base class (modifying our settings)
     130                 :          0 :         switch (_nState)
     131                 :            :         {
     132                 :            :             case GBW_STATE_DEFAULTOPTION:
     133                 :          0 :                 if (!m_bVisitedDefault)
     134                 :            :                 {   // assume that the first of the radio buttons should be selected
     135                 :            :                     DBG_ASSERT(m_aSettings.aLabels.size(), "OGroupBoxWizard::enterState: should never have reached this state!");
     136                 :          0 :                     m_aSettings.sDefaultField = m_aSettings.aLabels[0];
     137                 :            :                 }
     138                 :          0 :                 m_bVisitedDefault = sal_True;
     139                 :          0 :                 break;
     140                 :            : 
     141                 :            :             case GBW_STATE_DBFIELD:
     142                 :          0 :                 if (!m_bVisitedDB)
     143                 :            :                 {   // try to generate a default for the DB field
     144                 :            :                     // (simply use the first field in the DB names collection)
     145                 :          0 :                     if (getContext().aFieldNames.getLength())
     146                 :          0 :                         m_aSettings.sDBField = getContext().aFieldNames[0];
     147                 :            :                 }
     148                 :          0 :                 m_bVisitedDB = sal_True;
     149                 :          0 :                 break;
     150                 :            :         }
     151                 :            : 
     152                 :            :         // setting the def button .... to be done before the base class is called, too, 'cause the base class
     153                 :            :         // calls the pages, which are allowed to override our def button behaviour
     154                 :          0 :         defaultButton(GBW_STATE_FINALIZE == _nState ? WZB_FINISH : WZB_NEXT);
     155                 :            : 
     156                 :            :         // allow "finish" on the last page only
     157                 :          0 :         enableButtons(WZB_FINISH, GBW_STATE_FINALIZE == _nState);
     158                 :            :         // allow previous on all pages but the first one
     159                 :          0 :         enableButtons(WZB_PREVIOUS, GBW_STATE_OPTIONLIST != _nState);
     160                 :            :         // allow next on all pages but the last one
     161                 :          0 :         enableButtons(WZB_NEXT, GBW_STATE_FINALIZE != _nState);
     162                 :            : 
     163                 :          0 :         OControlWizard::enterState(_nState);
     164                 :          0 :     }
     165                 :            : 
     166                 :            :     //---------------------------------------------------------------------
     167                 :          0 :     void OGroupBoxWizard::createRadios()
     168                 :            :     {
     169                 :            :         try
     170                 :            :         {
     171                 :          0 :             OOptionGroupLayouter aLayouter(getServiceFactory());
     172                 :          0 :             aLayouter.doLayout(getContext(), getSettings());
     173                 :            :         }
     174                 :          0 :         catch(const Exception&)
     175                 :            :         {
     176                 :            :             OSL_FAIL("OGroupBoxWizard::createRadios: caught an exception while creating the radio shapes!");
     177                 :            :         }
     178                 :          0 :     }
     179                 :            : 
     180                 :            :     //---------------------------------------------------------------------
     181                 :          0 :     sal_Bool OGroupBoxWizard::onFinish()
     182                 :            :     {
     183                 :            :         // commit the basic control setttings
     184                 :          0 :         commitControlSettings(&m_aSettings);
     185                 :            : 
     186                 :            :         // create the radio buttons
     187                 :          0 :         createRadios();
     188                 :            : 
     189                 :          0 :         return OControlWizard::onFinish();
     190                 :            :     }
     191                 :            : 
     192                 :            :     //=====================================================================
     193                 :            :     //= ORadioSelectionPage
     194                 :            :     //=====================================================================
     195                 :            :     //---------------------------------------------------------------------
     196                 :          0 :     ORadioSelectionPage::ORadioSelectionPage( OControlWizard* _pParent )
     197                 :            :         :OGBWPage(_pParent, ModuleRes(RID_PAGE_GROUPRADIOSELECTION))
     198                 :            :         ,m_aFrame               (this, ModuleRes(FL_DATA))
     199                 :            :         ,m_aRadioNameLabel      (this, ModuleRes(FT_RADIOLABELS))
     200                 :            :         ,m_aRadioName           (this, ModuleRes(ET_RADIOLABELS))
     201                 :            :         ,m_aMoveRight           (this, ModuleRes(PB_MOVETORIGHT))
     202                 :            :         ,m_aMoveLeft            (this, ModuleRes(PB_MOVETOLEFT))
     203                 :            :         ,m_aExistingRadiosLabel (this, ModuleRes(FT_RADIOBUTTONS))
     204                 :          0 :         ,m_aExistingRadios      (this, ModuleRes(LB_RADIOBUTTONS))
     205                 :            :     {
     206                 :          0 :         FreeResource();
     207                 :            : 
     208                 :          0 :         if (getContext().aFieldNames.getLength())
     209                 :            :         {
     210                 :          0 :             enableFormDatasourceDisplay();
     211                 :            :         }
     212                 :            :         else
     213                 :            :         {
     214                 :          0 :             adjustControlForNoDSDisplay(&m_aFrame);
     215                 :          0 :             adjustControlForNoDSDisplay(&m_aRadioNameLabel);
     216                 :          0 :             adjustControlForNoDSDisplay(&m_aRadioName);
     217                 :          0 :             adjustControlForNoDSDisplay(&m_aMoveRight);
     218                 :          0 :             adjustControlForNoDSDisplay(&m_aMoveLeft);
     219                 :          0 :             adjustControlForNoDSDisplay(&m_aExistingRadiosLabel);
     220                 :          0 :             adjustControlForNoDSDisplay(&m_aExistingRadios, sal_True);
     221                 :            :         }
     222                 :            : 
     223                 :          0 :         m_aMoveLeft.SetClickHdl(LINK(this, ORadioSelectionPage, OnMoveEntry));
     224                 :          0 :         m_aMoveRight.SetClickHdl(LINK(this, ORadioSelectionPage, OnMoveEntry));
     225                 :          0 :         m_aRadioName.SetModifyHdl(LINK(this, ORadioSelectionPage, OnNameModified));
     226                 :          0 :         m_aExistingRadios.SetSelectHdl(LINK(this, ORadioSelectionPage, OnEntrySelected));
     227                 :            : 
     228                 :          0 :         implCheckMoveButtons();
     229                 :          0 :         m_aExistingRadios.EnableMultiSelection(sal_True);
     230                 :            : 
     231                 :          0 :         getDialog()->defaultButton(&m_aMoveRight);
     232                 :            : 
     233                 :          0 :         m_aExistingRadios.SetAccessibleRelationMemberOf(&m_aExistingRadios);
     234                 :          0 :         m_aExistingRadios.SetAccessibleRelationLabeledBy(&m_aExistingRadiosLabel);
     235                 :          0 :     }
     236                 :            : 
     237                 :            :     //---------------------------------------------------------------------
     238                 :          0 :     void ORadioSelectionPage::ActivatePage()
     239                 :            :     {
     240                 :          0 :         OGBWPage::ActivatePage();
     241                 :          0 :         m_aRadioName.GrabFocus();
     242                 :          0 :     }
     243                 :            : 
     244                 :            :     //---------------------------------------------------------------------
     245                 :          0 :     void ORadioSelectionPage::initializePage()
     246                 :            :     {
     247                 :          0 :         OGBWPage::initializePage();
     248                 :            : 
     249                 :          0 :         m_aRadioName.SetText(String());
     250                 :            : 
     251                 :            :         // no need to initialize the list of radios here
     252                 :            :         // (we're the only one affecting this special setting, so it will be in the same state as last time this
     253                 :            :         // page was commited)
     254                 :            : 
     255                 :          0 :         implCheckMoveButtons();
     256                 :          0 :     }
     257                 :            : 
     258                 :            :     //---------------------------------------------------------------------
     259                 :          0 :     sal_Bool ORadioSelectionPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason )
     260                 :            :     {
     261                 :          0 :         if (!OGBWPage::commitPage(_eReason))
     262                 :          0 :             return sal_False;
     263                 :            : 
     264                 :            :         // copy the names of the radio buttons to be inserted
     265                 :            :         // and initialize the values
     266                 :          0 :         OOptionGroupSettings& rSettings = getSettings();
     267                 :          0 :         rSettings.aLabels.clear();
     268                 :          0 :         rSettings.aValues.clear();
     269                 :          0 :         rSettings.aLabels.reserve(m_aExistingRadios.GetEntryCount());
     270                 :          0 :         rSettings.aValues.reserve(m_aExistingRadios.GetEntryCount());
     271                 :          0 :         for (::svt::WizardTypes::WizardState i=0; i<m_aExistingRadios.GetEntryCount(); ++i)
     272                 :            :         {
     273                 :          0 :             rSettings.aLabels.push_back(m_aExistingRadios.GetEntry(i));
     274                 :          0 :             rSettings.aValues.push_back(rtl::OUString::valueOf((sal_Int32)(i + 1)));
     275                 :            :         }
     276                 :            : 
     277                 :          0 :         return sal_True;
     278                 :            :     }
     279                 :            : 
     280                 :            :     //---------------------------------------------------------------------
     281                 :          0 :     IMPL_LINK( ORadioSelectionPage, OnMoveEntry, PushButton*, _pButton )
     282                 :            :     {
     283                 :          0 :         sal_Bool bMoveLeft = (&m_aMoveLeft == _pButton);
     284                 :          0 :         if (bMoveLeft)
     285                 :            :         {
     286                 :          0 :             while (m_aExistingRadios.GetSelectEntryCount())
     287                 :          0 :                 m_aExistingRadios.RemoveEntry(m_aExistingRadios.GetSelectEntryPos(0));
     288                 :            :         }
     289                 :            :         else
     290                 :            :         {
     291                 :          0 :             m_aExistingRadios.InsertEntry(m_aRadioName.GetText());
     292                 :          0 :             m_aRadioName.SetText(String());
     293                 :            :         }
     294                 :            : 
     295                 :          0 :         implCheckMoveButtons();
     296                 :            : 
     297                 :            :         //adjust the focus
     298                 :          0 :         if (bMoveLeft)
     299                 :          0 :             m_aExistingRadios.GrabFocus();
     300                 :            :         else
     301                 :          0 :             m_aRadioName.GrabFocus();
     302                 :          0 :         return 0L;
     303                 :            :     }
     304                 :            : 
     305                 :            :     //---------------------------------------------------------------------
     306                 :          0 :     IMPL_LINK( ORadioSelectionPage, OnEntrySelected, ListBox*, /*_pList*/ )
     307                 :            :     {
     308                 :          0 :         implCheckMoveButtons();
     309                 :          0 :         return 0L;
     310                 :            :     }
     311                 :            : 
     312                 :            :     //---------------------------------------------------------------------
     313                 :          0 :     IMPL_LINK( ORadioSelectionPage, OnNameModified, Edit*, /*_pList*/ )
     314                 :            :     {
     315                 :          0 :         implCheckMoveButtons();
     316                 :          0 :         return 0L;
     317                 :            :     }
     318                 :            : 
     319                 :            :     //---------------------------------------------------------------------
     320                 :          0 :     bool ORadioSelectionPage::canAdvance() const
     321                 :            :     {
     322                 :          0 :         return 0 != m_aExistingRadios.GetEntryCount();
     323                 :            :     }
     324                 :            : 
     325                 :            :     //---------------------------------------------------------------------
     326                 :          0 :     void ORadioSelectionPage::implCheckMoveButtons()
     327                 :            :     {
     328                 :          0 :         sal_Bool bHaveSome = (0 != m_aExistingRadios.GetEntryCount());
     329                 :          0 :         sal_Bool bSelectedSome = (0 != m_aExistingRadios.GetSelectEntryCount());
     330                 :          0 :         sal_Bool bUnfinishedInput = (0 != m_aRadioName.GetText().Len());
     331                 :            : 
     332                 :          0 :         m_aMoveLeft.Enable(bSelectedSome);
     333                 :          0 :         m_aMoveRight.Enable(bUnfinishedInput);
     334                 :            : 
     335                 :          0 :         getDialog()->enableButtons(WZB_NEXT, bHaveSome);
     336                 :            : 
     337                 :          0 :         if (bUnfinishedInput)
     338                 :            :         {
     339                 :          0 :             if (0 == (m_aMoveRight.GetStyle() & WB_DEFBUTTON))
     340                 :          0 :                 getDialog()->defaultButton(&m_aMoveRight);
     341                 :            :         }
     342                 :            :         else
     343                 :            :         {
     344                 :          0 :             if (WB_DEFBUTTON == (m_aMoveRight.GetStyle() & WB_DEFBUTTON))
     345                 :          0 :                 getDialog()->defaultButton(WZB_NEXT);
     346                 :            :         }
     347                 :          0 :     }
     348                 :            : 
     349                 :            :     //=====================================================================
     350                 :            :     //= ODefaultFieldSelectionPage
     351                 :            :     //=====================================================================
     352                 :            :     //---------------------------------------------------------------------
     353                 :          0 :     ODefaultFieldSelectionPage::ODefaultFieldSelectionPage( OControlWizard* _pParent )
     354                 :            :         :OMaybeListSelectionPage(_pParent, ModuleRes(RID_PAGE_DEFAULTFIELDSELECTION))
     355                 :            :         ,m_aFrame                   (this, ModuleRes(FL_DEFAULTSELECTION))
     356                 :            :         ,m_aDefaultSelectionLabel   (this, ModuleRes(FT_DEFAULTSELECTION))
     357                 :            :         ,m_aDefSelYes               (this, ModuleRes(RB_DEFSELECTION_YES))
     358                 :            :         ,m_aDefSelNo                (this, ModuleRes(RB_DEFSELECTION_NO))
     359                 :          0 :         ,m_aDefSelection            (this, ModuleRes(LB_DEFSELECTIONFIELD))
     360                 :            :     {
     361                 :          0 :         FreeResource();
     362                 :            : 
     363                 :          0 :         announceControls(m_aDefSelYes, m_aDefSelNo, m_aDefSelection);
     364                 :          0 :         m_aDefSelection.SetDropDownLineCount(10);
     365                 :          0 :         m_aDefSelection.SetAccessibleRelationLabeledBy( &m_aDefSelYes );
     366                 :          0 :         m_aDefSelection.SetAccessibleRelationMemberOf(&m_aDefaultSelectionLabel);
     367                 :          0 :     }
     368                 :            : 
     369                 :            :     //---------------------------------------------------------------------
     370                 :          0 :     void ODefaultFieldSelectionPage::initializePage()
     371                 :            :     {
     372                 :          0 :         OMaybeListSelectionPage::initializePage();
     373                 :            : 
     374                 :          0 :         const OOptionGroupSettings& rSettings = getSettings();
     375                 :            : 
     376                 :            :         // fill the listbox
     377                 :          0 :         m_aDefSelection.Clear();
     378                 :          0 :         for (   ConstStringArrayIterator aLoop = rSettings.aLabels.begin();
     379                 :          0 :                 aLoop != rSettings.aLabels.end();
     380                 :            :                 ++aLoop
     381                 :            :             )
     382                 :          0 :             m_aDefSelection.InsertEntry(*aLoop);
     383                 :            : 
     384                 :            : 
     385                 :          0 :         implInitialize(rSettings.sDefaultField);
     386                 :          0 :     }
     387                 :            : 
     388                 :            :     //---------------------------------------------------------------------
     389                 :          0 :     sal_Bool ODefaultFieldSelectionPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason )
     390                 :            :     {
     391                 :          0 :         if (!OMaybeListSelectionPage::commitPage(_eReason))
     392                 :          0 :             return sal_False;
     393                 :            : 
     394                 :          0 :         OOptionGroupSettings& rSettings = getSettings();
     395                 :          0 :         implCommit(rSettings.sDefaultField);
     396                 :            : 
     397                 :          0 :         return sal_True;
     398                 :            :     }
     399                 :            : 
     400                 :            :     //=====================================================================
     401                 :            :     //= OOptionValuesPage
     402                 :            :     //=====================================================================
     403                 :            :     //---------------------------------------------------------------------
     404                 :          0 :     OOptionValuesPage::OOptionValuesPage( OControlWizard* _pParent )
     405                 :            :         :OGBWPage(_pParent, ModuleRes(RID_PAGE_OPTIONVALUES))
     406                 :            :         ,m_aFrame               (this, ModuleRes(FL_OPTIONVALUES))
     407                 :            :         ,m_aDescription         (this, ModuleRes(FT_OPTIONVALUES_EXPL))
     408                 :            :         ,m_aValueLabel          (this, ModuleRes(FT_OPTIONVALUES))
     409                 :            :         ,m_aValue               (this, ModuleRes(ET_OPTIONVALUE))
     410                 :            :         ,m_aOptionsLabel        (this, ModuleRes(FT_RADIOBUTTONS))
     411                 :            :         ,m_aOptions             (this, ModuleRes(LB_RADIOBUTTONS))
     412                 :          0 :         ,m_nLastSelection((::svt::WizardTypes::WizardState)-1)
     413                 :            :     {
     414                 :          0 :         FreeResource();
     415                 :            : 
     416                 :          0 :         m_aOptions.SetSelectHdl(LINK(this, OOptionValuesPage, OnOptionSelected));
     417                 :            : 
     418                 :          0 :         m_aOptions.SetAccessibleRelationMemberOf(&m_aOptions);
     419                 :          0 :         m_aOptions.SetAccessibleRelationLabeledBy(&m_aOptionsLabel);
     420                 :          0 :     }
     421                 :            : 
     422                 :            :     //---------------------------------------------------------------------
     423                 :          0 :     IMPL_LINK( OOptionValuesPage, OnOptionSelected, ListBox*, /*NOTINTERESTEDIN*/ )
     424                 :            :     {
     425                 :          0 :         implTraveledOptions();
     426                 :          0 :         return 0L;
     427                 :            :     }
     428                 :            : 
     429                 :            :     //---------------------------------------------------------------------
     430                 :          0 :     void OOptionValuesPage::ActivatePage()
     431                 :            :     {
     432                 :          0 :         OGBWPage::ActivatePage();
     433                 :          0 :         m_aValue.GrabFocus();
     434                 :          0 :     }
     435                 :            : 
     436                 :            :     //---------------------------------------------------------------------
     437                 :          0 :     void OOptionValuesPage::implTraveledOptions()
     438                 :            :     {
     439                 :          0 :         if ((::svt::WizardTypes::WizardState)-1 != m_nLastSelection)
     440                 :            :         {
     441                 :            :             // save the value for the last option
     442                 :            :             DBG_ASSERT((size_t)m_nLastSelection < m_aUncommittedValues.size(), "OOptionValuesPage::implTraveledOptions: invalid previous selection index!");
     443                 :          0 :             m_aUncommittedValues[m_nLastSelection] = m_aValue.GetText();
     444                 :            :         }
     445                 :            : 
     446                 :          0 :         m_nLastSelection = m_aOptions.GetSelectEntryPos();
     447                 :            :         DBG_ASSERT((size_t)m_nLastSelection < m_aUncommittedValues.size(), "OOptionValuesPage::implTraveledOptions: invalid new selection index!");
     448                 :          0 :         m_aValue.SetText(m_aUncommittedValues[m_nLastSelection]);
     449                 :          0 :     }
     450                 :            : 
     451                 :            :     //---------------------------------------------------------------------
     452                 :          0 :     void OOptionValuesPage::initializePage()
     453                 :            :     {
     454                 :          0 :         OGBWPage::initializePage();
     455                 :            : 
     456                 :          0 :         const OOptionGroupSettings& rSettings = getSettings();
     457                 :            :         DBG_ASSERT(rSettings.aLabels.size(), "OOptionValuesPage::initializePage: no options!!");
     458                 :            :         DBG_ASSERT(rSettings.aLabels.size() == rSettings.aValues.size(), "OOptionValuesPage::initializePage: inconsistent data!");
     459                 :            : 
     460                 :            :         // fill the list with all available options
     461                 :          0 :         m_aOptions.Clear();
     462                 :          0 :         m_nLastSelection = -1;
     463                 :          0 :         for (   ConstStringArrayIterator aLoop = rSettings.aLabels.begin();
     464                 :          0 :                 aLoop != rSettings.aLabels.end();
     465                 :            :                 ++aLoop
     466                 :            :             )
     467                 :          0 :             m_aOptions.InsertEntry(*aLoop);
     468                 :            : 
     469                 :            :         // remember the values ... can't set them directly in the settings without the explicit commit call
     470                 :            :         // so we need have a copy of the values
     471                 :          0 :         m_aUncommittedValues = rSettings.aValues;
     472                 :            : 
     473                 :            :         // select the first entry
     474                 :          0 :         m_aOptions.SelectEntryPos(0);
     475                 :          0 :         implTraveledOptions();
     476                 :          0 :     }
     477                 :            : 
     478                 :            :     //---------------------------------------------------------------------
     479                 :          0 :     sal_Bool OOptionValuesPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason )
     480                 :            :     {
     481                 :          0 :         if (!OGBWPage::commitPage(_eReason))
     482                 :          0 :             return sal_False;
     483                 :            : 
     484                 :          0 :         OOptionGroupSettings& rSettings = getSettings();
     485                 :            : 
     486                 :            :         // commit the current value
     487                 :          0 :         implTraveledOptions();
     488                 :            :         // copy the uncommitted values
     489                 :          0 :         rSettings.aValues = m_aUncommittedValues;
     490                 :            : 
     491                 :          0 :         return sal_True;
     492                 :            :     }
     493                 :            : 
     494                 :            :     //=====================================================================
     495                 :            :     //= OOptionDBFieldPage
     496                 :            :     //=====================================================================
     497                 :            :     //---------------------------------------------------------------------
     498                 :          0 :     OOptionDBFieldPage::OOptionDBFieldPage( OControlWizard* _pParent )
     499                 :          0 :         :ODBFieldPage(_pParent)
     500                 :            :     {
     501                 :          0 :         setDescriptionText(String(ModuleRes(RID_STR_GROUPWIZ_DBFIELD)));
     502                 :          0 :     }
     503                 :            : 
     504                 :            :     //---------------------------------------------------------------------
     505                 :          0 :     String& OOptionDBFieldPage::getDBFieldSetting()
     506                 :            :     {
     507                 :          0 :         return getSettings().sDBField;
     508                 :            :     }
     509                 :            : 
     510                 :            :     //=====================================================================
     511                 :            :     //= OFinalizeGBWPage
     512                 :            :     //=====================================================================
     513                 :            :     //---------------------------------------------------------------------
     514                 :          0 :     OFinalizeGBWPage::OFinalizeGBWPage( OControlWizard* _pParent )
     515                 :            :         :OGBWPage(_pParent, ModuleRes(RID_PAGE_OPTIONS_FINAL))
     516                 :            :         ,m_aFrame           (this, ModuleRes(FL_NAMEIT))
     517                 :            :         ,m_aNameLabel       (this, ModuleRes(FT_NAMEIT))
     518                 :            :         ,m_aName            (this, ModuleRes(ET_NAMEIT))
     519                 :          0 :         ,m_aThatsAll        (this, ModuleRes(FT_THATSALL))
     520                 :            :     {
     521                 :          0 :         FreeResource();
     522                 :          0 :     }
     523                 :            : 
     524                 :            :     //---------------------------------------------------------------------
     525                 :          0 :     void OFinalizeGBWPage::ActivatePage()
     526                 :            :     {
     527                 :          0 :         OGBWPage::ActivatePage();
     528                 :          0 :         m_aName.GrabFocus();
     529                 :          0 :     }
     530                 :            : 
     531                 :            :     //---------------------------------------------------------------------
     532                 :          0 :     bool OFinalizeGBWPage::canAdvance() const
     533                 :            :     {
     534                 :          0 :         return false;
     535                 :            :     }
     536                 :            : 
     537                 :            :     //---------------------------------------------------------------------
     538                 :          0 :     void OFinalizeGBWPage::initializePage()
     539                 :            :     {
     540                 :          0 :         OGBWPage::initializePage();
     541                 :            : 
     542                 :          0 :         const OOptionGroupSettings& rSettings = getSettings();
     543                 :          0 :         m_aName.SetText(rSettings.sControlLabel);
     544                 :          0 :     }
     545                 :            : 
     546                 :            :     //---------------------------------------------------------------------
     547                 :          0 :     sal_Bool OFinalizeGBWPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason )
     548                 :            :     {
     549                 :          0 :         if (!OGBWPage::commitPage(_eReason))
     550                 :          0 :             return sal_False;
     551                 :            : 
     552                 :          0 :         getSettings().sControlLabel = m_aName.GetText();
     553                 :            : 
     554                 :          0 :         return sal_True;
     555                 :            :     }
     556                 :            : 
     557                 :            : //.........................................................................
     558                 :            : }   // namespace dbp
     559                 :            : //.........................................................................
     560                 :            : 
     561                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10