LCOV - code coverage report
Current view: top level - formula/source/ui/dlg - parawin.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 293 0.0 %
Date: 2012-08-25 Functions: 0 42 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 530 0.0 %

           Branch data     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 <comphelper/string.hxx>
      21                 :            : #include <svl/zforlist.hxx>
      22                 :            : #include <svl/stritem.hxx>
      23                 :            : 
      24                 :            : #include "parawin.hxx"
      25                 :            : #include "parawin.hrc"
      26                 :            : #include "helpids.hrc"
      27                 :            : #include "formula/formdata.hxx"
      28                 :            : #include "formula/IFunctionDescription.hxx"
      29                 :            : #include "ModuleHelper.hxx"
      30                 :            : #include "ForResId.hrc"
      31                 :            : 
      32                 :            : #define VAR_ARGS 30
      33                 :            : namespace formula
      34                 :            : {
      35                 :            : //============================================================================
      36                 :            : 
      37                 :          0 : ParaWin::ParaWin(Window* pParent,IControlReferenceHandler* _pDlg,Point aPos):
      38                 :            :     TabPage         (pParent,ModuleRes(RID_FORMULATAB_PARAMETER)),
      39                 :            :     pFuncDesc       ( NULL ),
      40                 :            :     pMyParent       (_pDlg),
      41                 :            :     aFtEditDesc     ( this, ModuleRes( FT_EDITDESC ) ),
      42                 :            :     aFtArgName      ( this, ModuleRes( FT_PARNAME ) ),
      43                 :            :     aFtArgDesc      ( this, ModuleRes( FT_PARDESC ) ),
      44                 :            : 
      45                 :            :     aBtnFx1         ( this, ModuleRes( BTN_FX1 ) ),
      46                 :            :     aFtArg1         ( this, ModuleRes( FT_ARG1 ) ),
      47                 :            :     aEdArg1         ( this, ModuleRes( ED_ARG1 ) ),
      48                 :            :     aRefBtn1        ( this, ModuleRes( RB_ARG1 ) ),
      49                 :            : 
      50                 :            :     aBtnFx2         ( this, ModuleRes( BTN_FX2 ) ),
      51                 :            :     aFtArg2         ( this, ModuleRes( FT_ARG2 ) ),
      52                 :            :     aEdArg2         ( this, ModuleRes( ED_ARG2 ) ),
      53                 :            :     aRefBtn2        ( this, ModuleRes( RB_ARG2 ) ),
      54                 :            : 
      55                 :            :     aBtnFx3         ( this, ModuleRes( BTN_FX3 ) ),
      56                 :            :     aFtArg3         ( this, ModuleRes( FT_ARG3 ) ),
      57                 :            :     aEdArg3         ( this, ModuleRes( ED_ARG3 ) ),
      58                 :            :     aRefBtn3        ( this, ModuleRes( RB_ARG3 ) ),
      59                 :            : 
      60                 :            :     aBtnFx4         ( this, ModuleRes( BTN_FX4 ) ),
      61                 :            :     aFtArg4         ( this, ModuleRes( FT_ARG4 ) ),
      62                 :            :     aEdArg4         ( this, ModuleRes( ED_ARG4 ) ),
      63                 :            :     aRefBtn4        ( this, ModuleRes( RB_ARG4 ) ),
      64                 :            : 
      65                 :            :     aSlider         ( this, ModuleRes( WND_SLIDER ) ),
      66                 :            :     m_sOptional     ( ModuleRes( STR_OPTIONAL ) ),
      67                 :            :     m_sRequired     ( ModuleRes( STR_REQUIRED ) ),
      68 [ #  # ][ #  # ]:          0 :     bRefMode        (sal_False)
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  #  
             #  #  #  # ]
      69                 :            : {
      70         [ #  # ]:          0 :     FreeResource();
      71 [ #  # ][ #  # ]:          0 :     aDefaultString=aFtEditDesc.GetText();
                 [ #  # ]
      72                 :            : 
      73         [ #  # ]:          0 :     SetPosPixel(aPos);
      74                 :          0 :     nEdFocus=NOT_FOUND;
      75                 :          0 :     nActiveLine=0;
      76         [ #  # ]:          0 :     Size aSize = aSlider.GetSizePixel();
      77                 :          0 :     aSize.Width() = GetSettings().GetStyleSettings().GetScrollBarSize();
      78         [ #  # ]:          0 :     aSlider.SetSizePixel( aSize );
      79         [ #  # ]:          0 :     aSlider.SetEndScrollHdl( LINK( this, ParaWin, ScrollHdl ) );
      80         [ #  # ]:          0 :     aSlider.SetScrollHdl( LINK( this, ParaWin, ScrollHdl ) );
      81                 :            : 
      82         [ #  # ]:          0 :     InitArgInput( 0, aFtArg1, aBtnFx1, aEdArg1, aRefBtn1);
      83         [ #  # ]:          0 :     InitArgInput( 1, aFtArg2, aBtnFx2, aEdArg2, aRefBtn2);
      84         [ #  # ]:          0 :     InitArgInput( 2, aFtArg3, aBtnFx3, aEdArg3, aRefBtn3);
      85         [ #  # ]:          0 :     InitArgInput( 3, aFtArg4, aBtnFx4, aEdArg4, aRefBtn4);
      86         [ #  # ]:          0 :     ClearAll();
      87   [ #  #  #  # ]:          0 : }
      88                 :            : 
      89                 :          0 : void ParaWin::UpdateArgDesc( sal_uInt16 nArg )
      90                 :            : {
      91         [ #  # ]:          0 :     if (nArg==NOT_FOUND) return;
      92                 :            : 
      93         [ #  # ]:          0 :     if ( nArgs > 4 )
      94                 :          0 :         nArg = sal::static_int_cast<sal_uInt16>( nArg + GetSliderPos() );
      95                 :            : 
      96 [ #  # ][ #  # ]:          0 :     if ( (nArgs > 0) && (nArg<nArgs) )
      97                 :            :     {
      98         [ #  # ]:          0 :         String  aArgDesc;
      99         [ #  # ]:          0 :         String  aArgName;
     100                 :            : 
     101 [ #  # ][ #  # ]:          0 :         SetArgumentDesc( String() );
                 [ #  # ]
     102 [ #  # ][ #  # ]:          0 :         SetArgumentText( String() );
                 [ #  # ]
     103                 :            : 
     104         [ #  # ]:          0 :         if ( nArgs < VAR_ARGS )
     105                 :            :         {
     106 [ #  # ][ #  # ]:          0 :             sal_uInt16 nRealArg = (aVisibleArgMapping.size() < nArg) ? aVisibleArgMapping[nArg] : nArg;
     107 [ #  # ][ #  # ]:          0 :             aArgDesc  = pFuncDesc->getParameterDescription(nRealArg);
     108 [ #  # ][ #  # ]:          0 :             aArgName  = pFuncDesc->getParameterName(nRealArg);
     109         [ #  # ]:          0 :             aArgName += ' ';
     110 [ #  # ][ #  # ]:          0 :             aArgName += (pFuncDesc->isParameterOptional(nRealArg)) ? m_sOptional : m_sRequired ;
                 [ #  # ]
     111                 :            :         }
     112                 :            :         else
     113                 :            :         {
     114                 :          0 :             sal_uInt16 nFix = nArgs - VAR_ARGS;
     115         [ #  # ]:          0 :             sal_uInt16 nPos = ( nArg < nFix ? nArg : nFix );
     116                 :          0 :             sal_uInt16 nRealArg = (nPos < aVisibleArgMapping.size() ?
     117 [ #  # ][ #  # ]:          0 :                     aVisibleArgMapping[nPos] : aVisibleArgMapping.back());
                 [ #  # ]
     118 [ #  # ][ #  # ]:          0 :             aArgDesc  = pFuncDesc->getParameterDescription(nRealArg);
     119 [ #  # ][ #  # ]:          0 :             aArgName  = pFuncDesc->getParameterName(nRealArg);
     120         [ #  # ]:          0 :             if ( nArg >= nFix )
     121 [ #  # ][ #  # ]:          0 :                 aArgName += String::CreateFromInt32(nArg-nFix+1);
                 [ #  # ]
     122         [ #  # ]:          0 :             aArgName += ' ';
     123                 :            : 
     124 [ #  # ][ #  # ]:          0 :             aArgName += (nArg > nFix || pFuncDesc->isParameterOptional(nRealArg)) ? m_sOptional : m_sRequired ;
         [ #  # ][ #  # ]
     125                 :            :         }
     126                 :            : 
     127         [ #  # ]:          0 :         SetArgumentDesc(aArgDesc);
     128 [ #  # ][ #  # ]:          0 :         SetArgumentText(aArgName);
                 [ #  # ]
     129                 :            :     }
     130                 :            : }
     131                 :            : 
     132                 :          0 : void ParaWin::UpdateArgInput( sal_uInt16 nOffset, sal_uInt16 i )
     133                 :            : {
     134                 :          0 :     sal_uInt16 nArg = nOffset + i;
     135         [ #  # ]:          0 :     if ( nArgs < VAR_ARGS)
     136                 :            :     {
     137         [ #  # ]:          0 :         if(nArg<nArgs)
     138                 :            :         {
     139                 :          0 :             sal_uInt16 nRealArg = aVisibleArgMapping[nArg];
     140                 :          0 :             SetArgNameFont  (i,(pFuncDesc->isParameterOptional(nRealArg))
     141         [ #  # ]:          0 :                                             ? aFntLight : aFntBold );
     142 [ #  # ][ #  # ]:          0 :             SetArgName      (i,pFuncDesc->getParameterName(nRealArg));
                 [ #  # ]
     143                 :            :         }
     144                 :            :     }
     145                 :            :     else
     146                 :            :     {
     147                 :          0 :         sal_uInt16 nFix = nArgs - VAR_ARGS;
     148         [ #  # ]:          0 :         sal_uInt16 nPos = ( nArg < nFix ? nArg : nFix );
     149                 :          0 :         sal_uInt16 nRealArg = (nPos < aVisibleArgMapping.size() ?
     150         [ #  # ]:          0 :                 aVisibleArgMapping[nPos] : aVisibleArgMapping.back());
     151                 :            :         SetArgNameFont( i,
     152                 :          0 :                 (nArg > nFix || pFuncDesc->isParameterOptional(nRealArg)) ?
     153   [ #  #  #  # ]:          0 :                 aFntLight : aFntBold );
     154         [ #  # ]:          0 :         if ( nArg >= nFix )
     155                 :            :         {
     156 [ #  # ][ #  # ]:          0 :             String aArgName( pFuncDesc->getParameterName(nRealArg) );
     157 [ #  # ][ #  # ]:          0 :             aArgName += String::CreateFromInt32(nArg-nFix+1);
                 [ #  # ]
     158 [ #  # ][ #  # ]:          0 :             SetArgName( i, aArgName );
     159                 :            :         }
     160                 :            :         else
     161 [ #  # ][ #  # ]:          0 :             SetArgName( i, pFuncDesc->getParameterName(nRealArg) );
                 [ #  # ]
     162                 :            :     }
     163         [ #  # ]:          0 :     if(nArg<nArgs) SetArgVal(i,aParaArray[nArg]);
     164                 :            : 
     165                 :          0 : }
     166                 :            : 
     167 [ #  # ][ #  # ]:          0 : ParaWin::~ParaWin()
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     168                 :            : {
     169                 :            :     // #i66422# if the focus changes during destruction of the controls,
     170                 :            :     // don't call the focus handlers
     171         [ #  # ]:          0 :     Link aEmptyLink;
     172                 :          0 :     aBtnFx1.SetGetFocusHdl( aEmptyLink );
     173                 :          0 :     aBtnFx2.SetGetFocusHdl( aEmptyLink );
     174                 :          0 :     aBtnFx3.SetGetFocusHdl( aEmptyLink );
     175                 :          0 :     aBtnFx4.SetGetFocusHdl( aEmptyLink );
     176 [ #  # ][ #  # ]:          0 : }
                 [ #  # ]
           [ #  #  #  # ]
     177                 :            : 
     178                 :          0 : sal_uInt16 ParaWin::GetActiveLine()
     179                 :            : {
     180                 :          0 :     return nActiveLine;
     181                 :            : }
     182                 :            : 
     183                 :          0 : void ParaWin::SetActiveLine(sal_uInt16 no)
     184                 :            : {
     185         [ #  # ]:          0 :     if(no<nArgs)
     186                 :            :     {
     187                 :          0 :         long nOffset = GetSliderPos();
     188                 :          0 :         nActiveLine=no;
     189                 :          0 :         long nNewEdPos=(long)nActiveLine-nOffset;
     190 [ #  # ][ #  # ]:          0 :         if(nNewEdPos<0 || nNewEdPos>3)
     191                 :            :         {
     192                 :          0 :             nOffset+=nNewEdPos;
     193                 :          0 :             SetSliderPos((sal_uInt16) nOffset);
     194                 :          0 :             nOffset=GetSliderPos();
     195                 :            :         }
     196                 :          0 :         nEdFocus=no-(sal_uInt16)nOffset;
     197                 :          0 :         UpdateArgDesc( nEdFocus );
     198                 :            :     }
     199                 :          0 : }
     200                 :            : 
     201                 :          0 : RefEdit* ParaWin::GetActiveEdit()
     202                 :            : {
     203 [ #  # ][ #  # ]:          0 :     if(nArgs>0 && nEdFocus!=NOT_FOUND)
     204                 :            :     {
     205                 :          0 :         return aArgInput[nEdFocus].GetArgEdPtr();
     206                 :            :     }
     207                 :            :     else
     208                 :            :     {
     209                 :          0 :         return NULL;
     210                 :            :     }
     211                 :            : }
     212                 :            : 
     213                 :            : 
     214                 :          0 : String ParaWin::GetArgument(sal_uInt16 no)
     215                 :            : {
     216                 :          0 :     String aStr;
     217         [ #  # ]:          0 :     if(no<aParaArray.size())
     218                 :            :     {
     219 [ #  # ][ #  # ]:          0 :         aStr=aParaArray[no];
     220 [ #  # ][ #  # ]:          0 :         if(no==nActiveLine && aStr.Len()==0)
                 [ #  # ]
     221         [ #  # ]:          0 :             aStr+=' ';
     222                 :            :     }
     223                 :          0 :     return aStr;
     224                 :            : }
     225                 :            : 
     226                 :          0 : String  ParaWin::GetActiveArgName()
     227                 :            : {
     228                 :          0 :     String aStr;
     229 [ #  # ][ #  # ]:          0 :     if(nArgs>0 && nEdFocus!=NOT_FOUND)
     230                 :            :     {
     231 [ #  # ][ #  # ]:          0 :         aStr=aArgInput[nEdFocus].GetArgName();
                 [ #  # ]
     232                 :            :     }
     233                 :          0 :     return aStr;
     234                 :            : }
     235                 :            : 
     236                 :            : 
     237                 :          0 : void ParaWin::SetArgument(sal_uInt16 no, const String& aString)
     238                 :            : {
     239         [ #  # ]:          0 :     if (no < aParaArray.size())
     240 [ #  # ][ #  # ]:          0 :         aParaArray[no] = comphelper::string::stripStart(aString, ' ');
                 [ #  # ]
     241                 :          0 : }
     242                 :            : 
     243                 :          0 : void ParaWin::DelParaArray()
     244                 :            : {
     245                 :          0 :     ::std::vector<String>().swap(aParaArray);
     246                 :          0 : }
     247                 :            : 
     248                 :          0 : void ParaWin::SetArgumentFonts(const Font&aBoldFont,const Font&aLightFont)
     249                 :            : {
     250                 :          0 :     aFntBold=aBoldFont;
     251                 :          0 :     aFntLight=aLightFont;
     252                 :          0 : }
     253                 :            : 
     254                 :          0 : void ParaWin::SetFunctionDesc(const IFunctionDescription* pFDesc)
     255                 :            : {
     256                 :          0 :     pFuncDesc=pFDesc;
     257                 :            : 
     258         [ #  # ]:          0 :     SetArgumentDesc( String() );
     259         [ #  # ]:          0 :     SetArgumentText( String() );
     260         [ #  # ]:          0 :     SetEditDesc( String() );
     261                 :          0 :     nArgs = 0;
     262         [ #  # ]:          0 :     if ( pFuncDesc!=NULL)
     263                 :            :     {
     264 [ #  # ][ #  # ]:          0 :         if ( !pFuncDesc->getDescription().isEmpty() )
     265                 :            :         {
     266 [ #  # ][ #  # ]:          0 :             SetEditDesc(pFuncDesc->getDescription());
         [ #  # ][ #  # ]
     267                 :            :         }
     268                 :            :         else
     269                 :            :         {
     270         [ #  # ]:          0 :             SetEditDesc(aDefaultString);
     271                 :            :         }
     272         [ #  # ]:          0 :         nArgs = pFuncDesc->getSuppressedArgumentCount();
     273         [ #  # ]:          0 :         pFuncDesc->fillVisibleArgumentMapping(aVisibleArgMapping);
     274         [ #  # ]:          0 :         aSlider.Hide();
     275         [ #  # ]:          0 :         rtl::OString sHelpId = pFuncDesc->getHelpId();
     276         [ #  # ]:          0 :         SetHelpId( sHelpId );
     277         [ #  # ]:          0 :         aEdArg1.SetHelpId( sHelpId );
     278         [ #  # ]:          0 :         aEdArg2.SetHelpId( sHelpId );
     279         [ #  # ]:          0 :         aEdArg3.SetHelpId( sHelpId );
     280         [ #  # ]:          0 :         aEdArg4.SetHelpId( sHelpId );
     281                 :            : 
     282                 :            :         //  Unique-IDs muessen gleich bleiben fuer Automatisierung
     283         [ #  # ]:          0 :         SetUniqueId( HID_FORMULA_FAP_PAGE );
     284         [ #  # ]:          0 :         aEdArg1.SetUniqueId( HID_FORMULA_FAP_EDIT1 );
     285         [ #  # ]:          0 :         aEdArg2.SetUniqueId( HID_FORMULA_FAP_EDIT2 );
     286         [ #  # ]:          0 :         aEdArg3.SetUniqueId( HID_FORMULA_FAP_EDIT3 );
     287         [ #  # ]:          0 :         aEdArg4.SetUniqueId( HID_FORMULA_FAP_EDIT4 );
     288         [ #  # ]:          0 :         SetActiveLine(0);
     289                 :            :     }
     290                 :            :     else
     291                 :            :     {
     292                 :          0 :         nActiveLine=0;
     293                 :            :     }
     294                 :            : 
     295                 :          0 : }
     296                 :            : 
     297                 :          0 : void ParaWin::SetArgumentText(const String& aText)
     298                 :            : {
     299                 :          0 :     aFtArgName.SetText(aText);
     300                 :          0 : }
     301                 :            : 
     302                 :          0 : void ParaWin::SetArgumentDesc(const String& aText)
     303                 :            : {
     304                 :          0 :     aFtArgDesc.SetText(aText);
     305                 :          0 : }
     306                 :            : 
     307                 :          0 : void ParaWin::SetEditDesc(const String& aText)
     308                 :            : {
     309                 :          0 :     aFtEditDesc.SetText(aText);
     310                 :          0 : }
     311                 :            : 
     312                 :          0 : void ParaWin::SetArgName(sal_uInt16 no,const String& aText)
     313                 :            : {
     314                 :          0 :     aArgInput[no].SetArgName(aText);
     315                 :          0 : }
     316                 :            : 
     317                 :          0 : void ParaWin::SetArgNameFont(sal_uInt16 no,const Font& aFont)
     318                 :            : {
     319                 :          0 :     aArgInput[no].SetArgNameFont(aFont);
     320                 :          0 : }
     321                 :            : 
     322                 :          0 : void ParaWin::SetArgVal(sal_uInt16 no,const String& aText)
     323                 :            : {
     324                 :          0 :     aArgInput[no].SetArgVal(aText);
     325                 :          0 : }
     326                 :            : 
     327                 :          0 : void ParaWin::HideParaLine(sal_uInt16 no)
     328                 :            : {
     329                 :          0 :     aArgInput[no].Hide();
     330                 :          0 : }
     331                 :            : 
     332                 :          0 : void ParaWin::ShowParaLine(sal_uInt16 no)
     333                 :            : {
     334                 :          0 :     aArgInput[no].Show();
     335                 :          0 : }
     336                 :            : 
     337                 :          0 : void ParaWin::SetEdFocus(sal_uInt16 no)
     338                 :            : {
     339                 :          0 :     UpdateArgDesc(no);
     340 [ #  # ][ #  # ]:          0 :     if(no<4 && no<aParaArray.size())
                 [ #  # ]
     341                 :          0 :         aArgInput[no].GetArgEdPtr()->GrabFocus();
     342                 :          0 : }
     343                 :            : 
     344                 :            : 
     345                 :          0 : void ParaWin::InitArgInput( sal_uInt16 nPos, FixedText& rFtArg, ImageButton& rBtnFx,
     346                 :            :                         ArgEdit& rEdArg, RefButton& rRefBtn)
     347                 :            : {
     348                 :            : 
     349                 :          0 :     rRefBtn.SetReferences(pMyParent,&rEdArg);
     350                 :          0 :     rEdArg.SetRefDialog(pMyParent);
     351                 :            : 
     352                 :          0 :     aArgInput[nPos].InitArgInput (&rFtArg,&rBtnFx,&rEdArg,&rRefBtn);
     353                 :            : 
     354                 :          0 :     aArgInput[nPos].Hide();
     355                 :            : 
     356                 :          0 :     aArgInput[nPos].SetFxClickHdl   ( LINK( this, ParaWin, GetFxHdl ) );
     357                 :          0 :     aArgInput[nPos].SetFxFocusHdl   ( LINK( this, ParaWin, GetFxFocusHdl ) );
     358                 :          0 :     aArgInput[nPos].SetEdFocusHdl   ( LINK( this, ParaWin, GetEdFocusHdl ) );
     359                 :          0 :     aArgInput[nPos].SetEdModifyHdl  ( LINK( this, ParaWin, ModifyHdl ) );
     360                 :          0 : }
     361                 :            : 
     362                 :          0 : void ParaWin::ClearAll()
     363                 :            : {
     364                 :          0 :     SetFunctionDesc(NULL);
     365                 :          0 :     SetArgumentOffset(0);
     366                 :          0 : }
     367                 :            : 
     368                 :          0 : void ParaWin::SetArgumentOffset(sal_uInt16 nOffset)
     369                 :            : {
     370                 :          0 :     DelParaArray();
     371                 :          0 :     aSlider.SetThumbPos(0);
     372                 :            : 
     373                 :          0 :     aParaArray.resize(nArgs);
     374                 :            : 
     375         [ #  # ]:          0 :     if ( nArgs > 0 )
     376                 :            :     {
     377 [ #  # ][ #  # ]:          0 :         for ( int i=0; i<4 && i<nArgs; i++ )
                 [ #  # ]
     378                 :            :         {
     379         [ #  # ]:          0 :             String aString;
     380         [ #  # ]:          0 :             aArgInput[i].SetArgVal(aString);
     381                 :            :             aArgInput[i].GetArgEdPtr()->Init(
     382                 :          0 :                 (i==0)               ? (ArgEdit *)NULL : aArgInput[i-1].GetArgEdPtr(),
     383                 :          0 :                 (i==3 || i==nArgs-1) ? (ArgEdit *)NULL : aArgInput[i+1].GetArgEdPtr(),
     384 [ #  # ][ #  # ]:          0 :                                        aSlider, nArgs );
         [ #  # ][ #  # ]
     385         [ #  # ]:          0 :         }
     386                 :            :     }
     387                 :            : 
     388         [ #  # ]:          0 :     if ( nArgs < 5 )
     389                 :            :     {
     390                 :          0 :         aSlider.Hide();
     391                 :            :     }
     392                 :            :     else
     393                 :            :     {
     394                 :          0 :         aSlider.SetPageSize( 4 );
     395                 :          0 :         aSlider.SetVisibleSize( 4 );
     396                 :          0 :         aSlider.SetLineSize( 1 );
     397         [ #  # ]:          0 :         aSlider.SetRange( Range( 0, nArgs ) );
     398                 :          0 :         aSlider.SetThumbPos( nOffset );
     399                 :          0 :         aSlider.Show();
     400                 :            :     }
     401                 :            : 
     402                 :          0 :     UpdateParas();
     403                 :          0 : }
     404                 :            : 
     405                 :          0 : void ParaWin::UpdateParas()
     406                 :            : {
     407                 :            :     sal_uInt16 i;
     408                 :          0 :     sal_uInt16 nOffset = GetSliderPos();
     409                 :            : 
     410         [ #  # ]:          0 :     if ( nArgs > 0 )
     411                 :            :     {
     412 [ #  # ][ #  # ]:          0 :         for ( i=0; (i<nArgs) && (i<4); i++ )
                 [ #  # ]
     413                 :            :         {
     414                 :          0 :             UpdateArgInput( nOffset, i );
     415                 :          0 :             ShowParaLine(i);
     416                 :            :         }
     417                 :            :     }
     418                 :            : 
     419         [ #  # ]:          0 :     for ( i=nArgs; i<4; i++ ) HideParaLine(i);
     420                 :          0 : }
     421                 :            : 
     422                 :            : 
     423                 :          0 : sal_uInt16 ParaWin::GetSliderPos()
     424                 :            : {
     425                 :          0 :     return (sal_uInt16) aSlider.GetThumbPos();
     426                 :            : }
     427                 :            : 
     428                 :          0 : void ParaWin::SetSliderPos(sal_uInt16 nSliderPos)
     429                 :            : {
     430                 :          0 :     sal_uInt16 nOffset = GetSliderPos();
     431                 :            : 
     432 [ #  # ][ #  # ]:          0 :     if(aSlider.IsVisible() && nOffset!=nSliderPos)
                 [ #  # ]
     433                 :            :     {
     434                 :          0 :         aSlider.SetThumbPos(nSliderPos);
     435         [ #  # ]:          0 :         for ( sal_uInt16 i=0; i<4; i++ )
     436                 :            :         {
     437                 :          0 :             UpdateArgInput( nSliderPos, i );
     438                 :            :         }
     439                 :            :     }
     440                 :          0 : }
     441                 :            : 
     442                 :          0 : void ParaWin::SliderMoved()
     443                 :            : {
     444                 :          0 :     sal_uInt16 nOffset = GetSliderPos();
     445                 :            : 
     446         [ #  # ]:          0 :     for ( sal_uInt16 i=0; i<4; i++ )
     447                 :            :     {
     448                 :          0 :         UpdateArgInput( nOffset, i );
     449                 :            :     }
     450         [ #  # ]:          0 :     if(nEdFocus!=NOT_FOUND)
     451                 :            :     {
     452                 :          0 :         UpdateArgDesc( nEdFocus );
     453         [ #  # ]:          0 :         aArgInput[nEdFocus].SetArgSelection(Selection(0,SELECTION_MAX ));
     454                 :          0 :         nActiveLine=nEdFocus+nOffset;
     455                 :          0 :         ArgumentModified();
     456                 :            :     }
     457                 :          0 :     aScrollLink.Call(this);
     458                 :          0 : }
     459                 :            : 
     460                 :          0 : void ParaWin::ArgumentModified()
     461                 :            : {
     462                 :          0 :     aArgModifiedLink.Call(this);
     463                 :          0 : }
     464                 :            : 
     465                 :          0 : void ParaWin::FxClick()
     466                 :            : {
     467                 :          0 :     aFxLink.Call(this);
     468                 :          0 : }
     469                 :            : 
     470                 :            : 
     471                 :          0 : IMPL_LINK( ParaWin, GetFxHdl, ArgInput*, pPtr )
     472                 :            : {
     473                 :          0 :     sal_uInt16 nOffset = GetSliderPos();
     474                 :          0 :     nEdFocus=NOT_FOUND;
     475         [ #  # ]:          0 :     for ( sal_uInt16 nPos=0; nPos<5;nPos++)
     476                 :            :     {
     477         [ #  # ]:          0 :         if(pPtr == &aArgInput[nPos])
     478                 :            :         {
     479                 :          0 :             nEdFocus=nPos;
     480                 :          0 :             break;
     481                 :            :         }
     482                 :            :     }
     483                 :            : 
     484         [ #  # ]:          0 :     if(nEdFocus!=NOT_FOUND)
     485                 :            :     {
     486         [ #  # ]:          0 :         aArgInput[nEdFocus].SetArgSelection(Selection(0,SELECTION_MAX ));
     487                 :          0 :         nActiveLine=nEdFocus+nOffset;
     488                 :          0 :         FxClick();
     489                 :            :     }
     490                 :          0 :     return 0;
     491                 :            : }
     492                 :            : 
     493                 :          0 : IMPL_LINK( ParaWin, GetFxFocusHdl, ArgInput*, pPtr )
     494                 :            : {
     495                 :          0 :     sal_uInt16 nOffset = GetSliderPos();
     496                 :          0 :     nEdFocus=NOT_FOUND;
     497         [ #  # ]:          0 :     for ( sal_uInt16 nPos=0; nPos<5;nPos++)
     498                 :            :     {
     499         [ #  # ]:          0 :         if(pPtr == &aArgInput[nPos])
     500                 :            :         {
     501                 :          0 :             nEdFocus=nPos;
     502                 :          0 :             break;
     503                 :            :         }
     504                 :            :     }
     505                 :            : 
     506         [ #  # ]:          0 :     if(nEdFocus!=NOT_FOUND)
     507                 :            :     {
     508         [ #  # ]:          0 :         aArgInput[nEdFocus].SetArgSelection(Selection(0,SELECTION_MAX ));
     509                 :          0 :         UpdateArgDesc( nEdFocus );
     510                 :          0 :         nActiveLine=nEdFocus+nOffset;
     511                 :            :     }
     512                 :          0 :     return 0;
     513                 :            : }
     514                 :            : 
     515                 :            : 
     516                 :            : 
     517                 :          0 : IMPL_LINK( ParaWin, GetEdFocusHdl, ArgInput*, pPtr )
     518                 :            : {
     519                 :          0 :     sal_uInt16 nOffset = GetSliderPos();
     520                 :          0 :     nEdFocus=NOT_FOUND;
     521         [ #  # ]:          0 :     for ( sal_uInt16 nPos=0; nPos<5;nPos++)
     522                 :            :     {
     523         [ #  # ]:          0 :         if(pPtr == &aArgInput[nPos])
     524                 :            :         {
     525                 :          0 :             nEdFocus=nPos;
     526                 :          0 :             break;
     527                 :            :         }
     528                 :            :     }
     529                 :            : 
     530         [ #  # ]:          0 :     if(nEdFocus!=NOT_FOUND)
     531                 :            :     {
     532         [ #  # ]:          0 :         aArgInput[nEdFocus].SetArgSelection(Selection(0,SELECTION_MAX ));
     533                 :          0 :         UpdateArgDesc( nEdFocus );
     534                 :          0 :         nActiveLine=nEdFocus+nOffset;
     535                 :          0 :         ArgumentModified();
     536                 :            :     }
     537                 :            : 
     538                 :          0 :     return 0;
     539                 :            : }
     540                 :            : 
     541                 :            : 
     542                 :          0 : IMPL_LINK_NOARG(ParaWin, ScrollHdl)
     543                 :            : {
     544                 :          0 :     SliderMoved();
     545                 :            : 
     546                 :          0 :     return 0;
     547                 :            : }
     548                 :            : 
     549                 :          0 : IMPL_LINK( ParaWin, ModifyHdl, ArgInput*, pPtr )
     550                 :            : {
     551                 :          0 :     sal_uInt16 nOffset = GetSliderPos();
     552                 :          0 :     nEdFocus=NOT_FOUND;
     553         [ #  # ]:          0 :     for ( sal_uInt16 nPos=0; nPos<5;nPos++)
     554                 :            :     {
     555         [ #  # ]:          0 :         if(pPtr == &aArgInput[nPos])
     556                 :            :         {
     557                 :          0 :             nEdFocus=nPos;
     558                 :          0 :             break;
     559                 :            :         }
     560                 :            :     }
     561         [ #  # ]:          0 :     if(nEdFocus!=NOT_FOUND)
     562                 :            :     {
     563 [ #  # ][ #  # ]:          0 :         aParaArray[nEdFocus+nOffset] = aArgInput[nEdFocus].GetArgVal();
     564                 :          0 :         UpdateArgDesc( nEdFocus);
     565                 :          0 :         nActiveLine=nEdFocus+nOffset;
     566                 :            :     }
     567                 :            : 
     568                 :          0 :     ArgumentModified();
     569                 :          0 :     return 0;
     570                 :            : }
     571                 :            : 
     572                 :            : 
     573                 :            : 
     574                 :            : } // formula
     575                 :            : 
     576                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10