LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sc/source/ui/formdlg - dwfunctr.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 440 0.5 %
Date: 2013-07-09 Functions: 4 40 10.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include <comphelper/string.hxx>
      22             : #include <editeng/editview.hxx>
      23             : #include <sfx2/bindings.hxx>
      24             : #include <sfx2/dispatch.hxx>
      25             : #include <sfx2/objsh.hxx>
      26             : #include <sfx2/viewsh.hxx>
      27             : 
      28             : #include "sc.hrc"
      29             : #include "global.hxx"       // ScAddress
      30             : #include "scresid.hxx"
      31             : #include "reffact.hxx"
      32             : #include "document.hxx"
      33             : #include "formulacell.hxx"
      34             : #include "scmod.hxx"
      35             : #include "inputhdl.hxx"
      36             : #include "tabvwsh.hxx"
      37             : #include "appoptio.hxx"
      38             : #include "compiler.hxx"
      39             : 
      40             : #include "dwfunctr.hrc"
      41             : #include "dwfunctr.hxx"
      42             : 
      43             : // -----------------------------------------------------------------------
      44             : 
      45          62 : SFX_IMPL_DOCKINGWINDOW_WITHID( ScFunctionChildWindow, FID_FUNCTION_BOX )
      46             : 
      47             : /*************************************************************************
      48             : #*  Member:     ScFunctionChildWindow
      49             : #*------------------------------------------------------------------------
      50             : #*
      51             : #*  Klasse:     ScFunctionChildWindow
      52             : #*
      53             : #*  Funktion:   Konstruktor der Klasse ScFunctionChildWindow
      54             : #*              Ableitung vom SfxChildWindow als "Behaelter" fuer
      55             : #*              Funktions- Fenster in Clac
      56             : #*
      57             : #*  Input:      ---
      58             : #*
      59             : #*  Output:     ---
      60             : #*
      61             : #************************************************************************/
      62             : 
      63           0 : ScFunctionChildWindow::ScFunctionChildWindow( Window* pParentP,
      64             :                                     sal_uInt16 nId,
      65             :                                     SfxBindings* pBindings,
      66             :                                     SfxChildWinInfo* pInfo ) :
      67           0 :     SfxChildWindow( pParentP, nId )
      68             : {
      69             :     ScFunctionDockWin* pWin = new ScFunctionDockWin( pBindings, this,
      70           0 :                                         pParentP, ScResId( FID_FUNCTION_BOX ) );
      71           0 :     pWindow = pWin;
      72             : 
      73           0 :     eChildAlignment = SFX_ALIGN_RIGHT;
      74             : 
      75           0 :     pWin->Initialize( pInfo );
      76           0 : }
      77             : 
      78             : /*************************************************************************
      79             : #*  Member:     ScFunctionDockWin
      80             : #*------------------------------------------------------------------------
      81             : #*
      82             : #*  Klasse:     ScFunctionDockWin
      83             : #*
      84             : #*  Funktion:   Konstruktor der Klasse ScFunctionDockWin
      85             : #*
      86             : #*  Input:      Sfx- Verknuepfungen, Fenster, Resource
      87             : #*
      88             : #*  Output:     ---
      89             : #*
      90             : #************************************************************************/
      91             : 
      92           0 : ScFunctionDockWin::ScFunctionDockWin( SfxBindings* pBindingsP,
      93             :                 SfxChildWindow *pCW, Window* pParent, const ResId& rResId ) :
      94             : 
      95             :     SfxDockingWindow( pBindingsP, pCW, pParent, rResId ),
      96           0 :     aPrivatSplit    ( this, ResId( FT_SPLIT, *rResId.GetResMgr()  ),SC_SPLIT_VERT),
      97           0 :     aCatBox         ( this, ResId( CB_CAT, *rResId.GetResMgr()  ) ),
      98           0 :     aFuncList       ( this, ResId( LB_FUNC, *rResId.GetResMgr()  ) ),
      99           0 :     aDDFuncList     ( this, ResId( DDLB_FUNC, *rResId.GetResMgr()  ) ),
     100           0 :     aInsertButton   ( this, ResId( IMB_INSERT, *rResId.GetResMgr()  ) ),
     101           0 :     aFiFuncDesc     ( this, ResId( FI_FUNCDESC, *rResId.GetResMgr()  ) ),
     102           0 :     aOldSize        (0,0)
     103             : {
     104           0 :     FreeResource();
     105           0 :     InitLRUList();
     106           0 :     SetStyle(GetStyle()|WB_CLIPCHILDREN);
     107             : 
     108           0 :     aTimer.SetTimeout(200);
     109           0 :     aTimer.SetTimeoutHdl(LINK( this, ScFunctionDockWin, TimerHdl));
     110             : 
     111           0 :     if (pCW != NULL)
     112           0 :         eSfxNewAlignment=GetAlignment();
     113             :     else
     114           0 :         eSfxNewAlignment=SFX_ALIGN_RIGHT;
     115           0 :     eSfxOldAlignment=eSfxNewAlignment;
     116           0 :     aFiFuncDesc.SetUpdateMode(sal_True);
     117           0 :     pAllFuncList=&aFuncList;
     118           0 :     aDDFuncList.Disable();
     119           0 :     aDDFuncList.Hide();
     120           0 :     nArgs=0;
     121           0 :     nDockMode=0;
     122           0 :     bSizeFlag=false;
     123           0 :     aCatBox.SetDropDownLineCount(9);
     124           0 :     Font aFont=aFiFuncDesc.GetFont();
     125           0 :     aFont.SetColor(Color(COL_BLACK));
     126           0 :     aFiFuncDesc.SetFont(aFont);
     127           0 :     aFiFuncDesc.SetBackground( GetBackground() );       //! never transparent?
     128             : 
     129           0 :     Link aLink=LINK( this, ScFunctionDockWin, SelHdl);
     130           0 :     aCatBox.SetSelectHdl(aLink);
     131           0 :     aFuncList.SetSelectHdl(aLink);
     132           0 :     aDDFuncList.SetSelectHdl(aLink);
     133             : 
     134           0 :     Link a2Link=LINK( this, ScFunctionDockWin, SetSelectionHdl);
     135           0 :     aFuncList.SetDoubleClickHdl(a2Link);
     136           0 :     aDDFuncList.SetSelectHdl(aLink);
     137           0 :     aInsertButton.SetClickHdl(a2Link);
     138             : 
     139           0 :     Link a3Link=LINK( this, ScFunctionDockWin, SetSplitHdl);
     140           0 :     aPrivatSplit.SetCtrModifiedHdl(a3Link);
     141           0 :     StartListening( *pBindingsP, sal_True );
     142             : 
     143           0 :     Point aTopLeft=aCatBox.GetPosPixel();
     144           0 :     OUString aString("ww");
     145           0 :     Size aTxtSize( aFiFuncDesc.GetTextWidth(aString), aFiFuncDesc.GetTextHeight() );
     146           0 :     nMinWidth=aTxtSize.Width()+aTopLeft.X()
     147           0 :             +2*aFuncList.GetPosPixel().X();
     148           0 :     nMinHeight=19*aTxtSize.Height();
     149           0 :     aCatBox.SelectEntryPos(0);
     150             : 
     151           0 :     Range aYRange(3*aTxtSize.Height()+aFuncList.GetPosPixel().Y(),
     152           0 :                 GetOutputSizePixel().Height()-2*aTxtSize.Height());
     153           0 :     aPrivatSplit.SetYRange(aYRange);
     154           0 :     SelHdl(&aCatBox);
     155           0 :     bInit=sal_True;
     156           0 : }
     157             : 
     158             : /*************************************************************************
     159             : #*  Member:     ScFunctionDockWin
     160             : #*------------------------------------------------------------------------
     161             : #*
     162             : #*  Klasse:     ScFunctionDockWin
     163             : #*
     164             : #*  Funktion:   Destruktor der Klasse ScFunctionDockWin
     165             : #*
     166             : #*  Input:      ---
     167             : #*
     168             : #*  Output:     ---
     169             : #*
     170             : #************************************************************************/
     171             : 
     172           0 : ScFunctionDockWin::~ScFunctionDockWin()
     173             : {
     174           0 :     EndListening( GetBindings() );
     175           0 : }
     176             : 
     177             : /*************************************************************************
     178             : #*  Member:     UpdateFunctionList
     179             : #*------------------------------------------------------------------------
     180             : #*
     181             : #*  Klasse:     ScFunctionDockWin
     182             : #*
     183             : #*  Funktion:   Aktualisiert die Liste der Funktionen ab-
     184             : #*              haengig von der eingestellten Kategorie.
     185             : #*
     186             : #*  Input:      ---
     187             : #*
     188             : #*  Output:     ---
     189             : #*
     190             : #************************************************************************/
     191             : 
     192           0 : void ScFunctionDockWin::InitLRUList()
     193             : {
     194           0 :     ScFunctionMgr* pFuncMgr = ScGlobal::GetStarCalcFunctionMgr();
     195           0 :     pFuncMgr->fillLastRecentlyUsedFunctions(aLRUList);
     196             : 
     197             : 
     198           0 :     sal_uInt16  nSelPos   = aCatBox.GetSelectEntryPos();
     199             : 
     200           0 :     if(nSelPos == 0)
     201           0 :         UpdateFunctionList();
     202           0 : }
     203             : 
     204             : /*************************************************************************
     205             : #*  Member:     UpdateFunctionList
     206             : #*------------------------------------------------------------------------
     207             : #*
     208             : #*  Klasse:     ScFunctionDockWin
     209             : #*
     210             : #*  Funktion:   Aktualisiert die Liste der zuletzt verwendeten Funktionen.
     211             : #*
     212             : #*  Input:      ---
     213             : #*
     214             : #*  Output:     ---
     215             : #*
     216             : #************************************************************************/
     217             : 
     218           0 : void ScFunctionDockWin::UpdateLRUList()
     219             : {
     220           0 :     if (pFuncDesc && pFuncDesc->nFIndex!=0)
     221             :     {
     222           0 :         ScModule* pScMod = SC_MOD();
     223           0 :         pScMod->InsertEntryToLRUList(pFuncDesc->nFIndex);
     224             :     }
     225           0 : }
     226             : 
     227             : 
     228             : /*************************************************************************
     229             : #*  Member:     SetSize
     230             : #*------------------------------------------------------------------------
     231             : #*
     232             : #*  Klasse:     ScFunctionDockWin
     233             : #*
     234             : #*  Funktion:   Groesse fuer die einzelnen Controls einzustellen.
     235             : #*
     236             : #*  Input:      ---
     237             : #*
     238             : #*  Output:     ---
     239             : #*
     240             : #************************************************************************/
     241             : 
     242           0 : void ScFunctionDockWin::SetSize()
     243             : {
     244           0 :     sal_uInt16 nSelEntry=0;
     245           0 :     SfxChildAlignment  aChildAlign=eSfxOldAlignment;//GetAlignment();
     246             :     short nNewDockMode;
     247           0 :     switch(aChildAlign)
     248             :     {
     249             :         case SFX_ALIGN_HIGHESTTOP:
     250             :         case SFX_ALIGN_TOP:
     251             :         case SFX_ALIGN_LOWESTTOP:
     252             :         case SFX_ALIGN_LOWESTBOTTOM:
     253             :         case SFX_ALIGN_BOTTOM:
     254             :         case SFX_ALIGN_TOOLBOXTOP:
     255             :         case SFX_ALIGN_TOOLBOXBOTTOM:
     256             : 
     257             : 
     258           0 :                         nNewDockMode=1;
     259           0 :                         if(nDockMode!=nNewDockMode)
     260             :                         {
     261           0 :                             nDockMode=nNewDockMode;
     262           0 :                             nSelEntry=aFuncList.GetSelectEntryPos();
     263           0 :                             aFuncList.Clear();
     264           0 :                             aFiFuncDesc.SetPosPixel(aFuncList.GetPosPixel());
     265           0 :                             aDDFuncList.Enable();
     266           0 :                             aDDFuncList.Show();
     267           0 :                             aPrivatSplit.Disable();
     268           0 :                             aPrivatSplit.Hide();
     269           0 :                             aFuncList.Disable();
     270           0 :                             aFuncList.Hide();
     271           0 :                             pAllFuncList=&aDDFuncList;
     272           0 :                             SelHdl(&aCatBox);
     273           0 :                             aDDFuncList.SelectEntryPos(nSelEntry);
     274             :                         }
     275           0 :                         break;
     276             : 
     277           0 :         default:        nNewDockMode=0;
     278           0 :                         if(nDockMode!=nNewDockMode)
     279             :                         {
     280           0 :                             nDockMode=nNewDockMode;
     281           0 :                             nSelEntry=aDDFuncList.GetSelectEntryPos();
     282           0 :                             aDDFuncList.Clear();
     283           0 :                             aDDFuncList.Disable();
     284           0 :                             aDDFuncList.Hide();
     285           0 :                             aPrivatSplit.Enable();
     286           0 :                             aPrivatSplit.Show();
     287           0 :                             aFuncList.Enable();
     288           0 :                             aFuncList.Show();
     289           0 :                             pAllFuncList=&aFuncList;
     290           0 :                             SelHdl(&aCatBox);
     291           0 :                             aFuncList.SelectEntryPos(nSelEntry);
     292             :                         }
     293           0 :                         break;
     294             :     }
     295             : 
     296           0 :     if(nDockMode==0)
     297             :     {
     298           0 :         SetLeftRightSize();
     299             :     }
     300             :     else
     301             :     {
     302           0 :         SetTopBottonSize();
     303             :     }
     304           0 : }
     305             : /*************************************************************************
     306             : #*  Member:     SetLeftRightSize
     307             : #*------------------------------------------------------------------------
     308             : #*
     309             : #*  Klasse:     ScFunctionDockWin
     310             : #*
     311             : #*  Funktion:   Groesse fuer die einzelnen Controls einstellen,
     312             : #*              wenn Links oder Rechts angedockt wird.
     313             : #*
     314             : #*  Input:      ---
     315             : #*
     316             : #*  Output:     ---
     317             : #*
     318             : #************************************************************************/
     319             : 
     320           0 : void ScFunctionDockWin::SetLeftRightSize()
     321             : {
     322           0 :     if(bSizeFlag==false)
     323             :     {
     324           0 :         bSizeFlag=sal_True;
     325             : 
     326           0 :         Size aDiffSize=GetSizePixel();
     327           0 :         Size aNewSize=GetOutputSizePixel();
     328           0 :         aDiffSize.Width()-=aNewSize.Width();
     329           0 :         aDiffSize.Height()-=aNewSize.Height();
     330             : 
     331           0 :         OUString aString("ww");
     332           0 :         Size aTxtSize( aFuncList.GetTextWidth(aString), aFuncList.GetTextHeight() );
     333             : 
     334           0 :         Range aYRange(3*aTxtSize.Height()+aFuncList.GetPosPixel().Y(),
     335           0 :                     GetOutputSizePixel().Height()-2*aTxtSize.Height());
     336           0 :         aPrivatSplit.SetYRange(aYRange);
     337             : 
     338             : 
     339           0 :         if(aOldSize.Width()!=aNewSize.Width())
     340           0 :             SetMyWidthLeRi(aNewSize);
     341             : 
     342           0 :         if(aOldSize.Height()!=aNewSize.Height())
     343           0 :             SetMyHeightLeRi(aNewSize);
     344             : 
     345           0 :         aOldSize=aNewSize;
     346           0 :         aNewSize.Width()+=aDiffSize.Width();
     347           0 :         aNewSize.Height()+=aDiffSize.Height();
     348           0 :         bSizeFlag=false;
     349             :     }
     350             : 
     351           0 : }
     352             : /*************************************************************************
     353             : #*  Member:     SetTopBottonSize
     354             : #*------------------------------------------------------------------------
     355             : #*
     356             : #*  Klasse:     ScFunctionDockWin
     357             : #*
     358             : #*  Funktion:   Groesse fuer die einzelnen Controls einzustellen.
     359             : #*              wenn oben oder unten angedockt wird.
     360             : #*
     361             : #*  Input:      ---
     362             : #*
     363             : #*  Output:     ---
     364             : #*
     365             : #************************************************************************/
     366             : 
     367           0 : void ScFunctionDockWin::SetTopBottonSize()
     368             : {
     369           0 :     if(bSizeFlag==false)
     370             :     {
     371           0 :         bSizeFlag=sal_True;
     372           0 :         Size aDiffSize=GetSizePixel();
     373           0 :         Size aNewSize=GetOutputSizePixel();
     374           0 :         aDiffSize.Width()-=aNewSize.Width();
     375           0 :         aDiffSize.Height()-=aNewSize.Height();
     376             : 
     377           0 :         SetMyWidthToBo(aNewSize);
     378           0 :         SetMyHeightToBo(aNewSize);
     379             : 
     380           0 :         aNewSize.Width()+=aDiffSize.Width();
     381           0 :         aNewSize.Height()+=aDiffSize.Height();
     382           0 :         bSizeFlag=false;
     383             :     }
     384           0 : }
     385             : 
     386             : /*************************************************************************
     387             : #*  Member:     SetMyWidthLeRi
     388             : #*------------------------------------------------------------------------
     389             : #*
     390             : #*  Klasse:     ScFunctionDockWin
     391             : #*
     392             : #*  Funktion:   Breite fuer die einzelnen Controls und
     393             : #*              das Fenster einstellen,wenn Li oder Re
     394             : #*
     395             : #*  Input:      neue Fenstergroesse
     396             : #*
     397             : #*  Output:     ---
     398             : #*
     399             : #************************************************************************/
     400             : 
     401           0 : void ScFunctionDockWin::SetMyWidthLeRi(Size &aNewSize)
     402             : {
     403           0 :     if((sal_uLong)aNewSize.Width()<nMinWidth)   aNewSize.Width()=nMinWidth;
     404             : 
     405           0 :     Size aCDSize=aCatBox.GetSizePixel();
     406           0 :     Size aFLSize=aFuncList.GetSizePixel();
     407           0 :     Size aSplitterSize=aPrivatSplit.GetSizePixel();
     408           0 :     Size aFDSize=aFiFuncDesc.GetSizePixel();
     409             : 
     410           0 :     Point aCDTopLeft=aCatBox.GetPosPixel();
     411           0 :     Point aFLTopLeft=aFuncList.GetPosPixel();
     412             : 
     413           0 :     aCDSize.Width()=aNewSize.Width()-aCDTopLeft.X()-aFLTopLeft.X();
     414           0 :     aFLSize.Width()=aNewSize.Width()-2*aFLTopLeft.X();
     415           0 :     aFDSize.Width()=aFLSize.Width();
     416           0 :     aSplitterSize.Width()=aFLSize.Width();
     417             : 
     418           0 :     aCatBox.SetSizePixel(aCDSize);
     419           0 :     aFuncList.SetSizePixel(aFLSize);
     420           0 :     aPrivatSplit.SetSizePixel(aSplitterSize);
     421           0 :     aFiFuncDesc.SetSizePixel(aFDSize);
     422           0 : }
     423             : 
     424             : /*************************************************************************
     425             : #*  Member:     SetHeight
     426             : #*------------------------------------------------------------------------
     427             : #*
     428             : #*  Klasse:     ScFunctionDockWin
     429             : #*
     430             : #*  Funktion:   Hoehe fuer die einzelnen Controls und
     431             : #*              das Fenster einstellen bei Li oder Re
     432             : #*
     433             : #*  Input:      neue Fenstergroesse
     434             : #*
     435             : #*  Output:     ---
     436             : #*
     437             : #************************************************************************/
     438             : 
     439           0 : void ScFunctionDockWin::SetMyHeightLeRi(Size &aNewSize)
     440             : {
     441           0 :     if((sal_uLong)aNewSize.Height()<nMinHeight) aNewSize.Height()=nMinHeight;
     442             : 
     443           0 :     Size aFLSize=aFuncList.GetSizePixel();
     444           0 :     Size aSplitterSize=aPrivatSplit.GetSizePixel();
     445           0 :     Size aFDSize=aFiFuncDesc.GetSizePixel();
     446             : 
     447           0 :     Point aFLTopLeft=aFuncList.GetPosPixel();
     448           0 :     Point aSplitterTopLeft=aPrivatSplit.GetPosPixel();
     449           0 :     Point aFDTopLeft=aFiFuncDesc.GetPosPixel();
     450             : 
     451           0 :     long nTxtHeight = aFuncList.GetTextHeight();
     452             : 
     453             :     short nY=(short)(3*nTxtHeight+
     454           0 :         aFuncList.GetPosPixel().Y()+aSplitterSize.Height());
     455             : 
     456           0 :     aFDTopLeft.Y()=aNewSize.Height()-aFDSize.Height()-4;
     457           0 :     if(nY>aFDTopLeft.Y())
     458             :     {
     459           0 :         aFDSize.Height()-=nY-aFDTopLeft.Y();
     460           0 :         aFDTopLeft.Y()=nY;
     461             :     }
     462           0 :     aSplitterTopLeft.Y()=aFDTopLeft.Y()-aSplitterSize.Height()-1;
     463           0 :     aFLSize.Height()=aSplitterTopLeft.Y()-aFLTopLeft.Y()-1;
     464             : 
     465           0 :     aFuncList.SetSizePixel(aFLSize);
     466           0 :     aPrivatSplit.SetPosPixel(aSplitterTopLeft);
     467           0 :     aFiFuncDesc.SetPosPixel(aFDTopLeft);
     468           0 :     aFiFuncDesc.SetSizePixel(aFDSize);
     469             : 
     470           0 : }
     471             : 
     472             : /*************************************************************************
     473             : #*  Member:     SetMyWidthToBo
     474             : #*------------------------------------------------------------------------
     475             : #*
     476             : #*  Klasse:     ScFunctionDockWin
     477             : #*
     478             : #*  Funktion:   Breite fuer die einzelnen Controls und
     479             : #*              das Fenster einstellen, wenn oben oder
     480             : #*              unten angedockt werden soll.
     481             : #*
     482             : #*  Input:      neue Fenstergroesse
     483             : #*
     484             : #*  Output:     ---
     485             : #*
     486             : #************************************************************************/
     487             : 
     488           0 : void ScFunctionDockWin::SetMyWidthToBo(Size &aNewSize)
     489             : {
     490           0 :     if((sal_uLong)aNewSize.Width()<nMinWidth)   aNewSize.Width()=nMinWidth;
     491             : 
     492           0 :     Size aCDSize=aCatBox.GetSizePixel();
     493           0 :     Size aDdFLSize=aDDFuncList.GetSizePixel();
     494           0 :     Size aFDSize=aFiFuncDesc.GetSizePixel();
     495             : 
     496           0 :     Point aCDTopLeft=aCatBox.GetPosPixel();
     497           0 :     Point aDdFLTopLeft=aDDFuncList.GetPosPixel();
     498           0 :     Point aFDTopLeft=aFiFuncDesc.GetPosPixel();
     499             : 
     500           0 :     aCDSize.Width()=aDdFLTopLeft.X()-aFDTopLeft.X()-aCDTopLeft.X();
     501           0 :     aDdFLTopLeft.X()=aCDSize.Width()+aCDTopLeft.X()+aFDTopLeft.X();
     502             : 
     503           0 :     aDdFLSize.Width()=aNewSize.Width()-aDdFLTopLeft.X()-aFDTopLeft.X();
     504             : 
     505           0 :     aFDSize.Width()=aNewSize.Width()-2*aFDTopLeft.X();
     506             : 
     507           0 :     aDDFuncList.SetPosPixel(aDdFLTopLeft);
     508           0 :     aDDFuncList.SetSizePixel(aDdFLSize);
     509           0 :     aCatBox.SetSizePixel(aCDSize);
     510           0 :     aFiFuncDesc.SetSizePixel(aFDSize);
     511           0 : }
     512             : 
     513             : /*************************************************************************
     514             : #*  Member:     SetHeight
     515             : #*------------------------------------------------------------------------
     516             : #*
     517             : #*  Klasse:     ScFunctionDockWin
     518             : #*
     519             : #*  Funktion:   Hoehe fuer die einzelnen Controls und
     520             : #*              das Fenster einstellen, wenn oben oder
     521             : #*              unten angedockt werden soll.
     522             : #*
     523             : #*  Input:      neue Fenstergroesse
     524             : #*
     525             : #*  Output:     ---
     526             : #*
     527             : #************************************************************************/
     528             : 
     529           0 : void ScFunctionDockWin::SetMyHeightToBo(Size &aNewSize)
     530             : {
     531           0 :     if((sal_uLong)aNewSize.Height()<nMinHeight) aNewSize.Height()=nMinHeight;
     532             : 
     533           0 :     Size aFDSize=aFiFuncDesc.GetSizePixel();
     534             : 
     535           0 :     Point aFDTopLeft=aFiFuncDesc.GetPosPixel();
     536           0 :     Point aCBTopLeft=aCatBox.GetPosPixel();
     537           0 :     aFDSize.Height()=aNewSize.Height()-aFDTopLeft.Y()-aCBTopLeft.Y();
     538           0 :     aFiFuncDesc.SetSizePixel(aFDSize);
     539             : 
     540           0 : }
     541             : 
     542             : /*************************************************************************
     543             : #*  Member:     SetDescription
     544             : #*------------------------------------------------------------------------
     545             : #*
     546             : #*  Klasse:     ScFunctionDockWin
     547             : #*
     548             : #*  Funktion:   Erklaerungstext fuer die Funktion einstellen.
     549             : #*
     550             : #*  Input:      ---
     551             : #*
     552             : #*  Output:     ---
     553             : #*
     554             : #************************************************************************/
     555             : 
     556           0 : void ScFunctionDockWin::SetDescription()
     557             : {
     558           0 :     aFiFuncDesc.SetText( EMPTY_STRING );
     559             :     const ScFuncDesc* pDesc =
     560             :              (const ScFuncDesc*)pAllFuncList->GetEntryData(
     561           0 :                     pAllFuncList->GetSelectEntryPos() );
     562           0 :     if (pDesc)
     563             :     {
     564           0 :         pDesc->initArgumentInfo();      // full argument info is needed
     565             : 
     566           0 :         OUStringBuffer aBuf(pAllFuncList->GetSelectEntry());
     567           0 :         if(nDockMode==0)
     568             :         {
     569           0 :             aBuf.appendAscii(":\n\n");
     570             :         }
     571             :         else
     572             :         {
     573           0 :             aBuf.appendAscii(":   ");
     574             :         }
     575             : 
     576           0 :         aBuf.append(pDesc->GetParamList());
     577             : 
     578           0 :         if(nDockMode==0)
     579             :         {
     580           0 :             aBuf.appendAscii("\n\n");
     581             :         }
     582             :         else
     583             :         {
     584           0 :             aBuf.appendAscii("\n");
     585             :         }
     586             : 
     587           0 :         aBuf.append(*pDesc->pFuncDesc);
     588             : 
     589           0 :         aFiFuncDesc.SetText(aBuf.makeStringAndClear());
     590           0 :         aFiFuncDesc.StateChanged(STATE_CHANGE_TEXT);
     591           0 :         aFiFuncDesc.Invalidate();
     592           0 :         aFiFuncDesc.Update();
     593             : 
     594             :     }
     595           0 :  }
     596             : 
     597             : /*************************************************************************
     598             : #*  Member:     Resizing
     599             : #*------------------------------------------------------------------------
     600             : #*
     601             : #*  Klasse:     ScFunctionDockWin
     602             : #*
     603             : #*  Funktion:   Ueberladene Funktion um die Groesse der
     604             : #*              einzelnen Controls einzustellen.
     605             : #*
     606             : #*  Input:      neue Groesse
     607             : #*
     608             : #*  Output:     ---
     609             : #*
     610             : #************************************************************************/
     611             : 
     612           0 : void ScFunctionDockWin::Resizing( Size& rNewSize )
     613             : {
     614           0 :     if((sal_uLong)rNewSize.Width()<nMinWidth) rNewSize.Width()=nMinWidth;
     615           0 :     if((sal_uLong)rNewSize.Height()<nMinHeight) rNewSize.Height()=nMinHeight;
     616             : 
     617           0 : }
     618             : 
     619             : /*************************************************************************
     620             : #*  Member:     Close
     621             : #*------------------------------------------------------------------------
     622             : #*
     623             : #*  Klasse:     ScFunctionDockWin
     624             : #*
     625             : #*  Funktion:   Schliessen des Fensters
     626             : #*
     627             : #*  Input:      ---
     628             : #*
     629             : #*  Output:     TRUE
     630             : #*
     631             : #************************************************************************/
     632             : 
     633           0 : sal_Bool ScFunctionDockWin::Close()
     634             : {
     635           0 :     SfxBoolItem aItem( FID_FUNCTION_BOX, false );
     636             : 
     637           0 :     GetBindings().GetDispatcher()->Execute( FID_FUNCTION_BOX,
     638             :                                 SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
     639           0 :                                 &aItem, 0L );
     640             : 
     641           0 :     SfxDockingWindow::Close();
     642             : 
     643           0 :     return( sal_True );
     644             : }
     645             : 
     646             : 
     647             : /*************************************************************************
     648             : #*  Member:     CheckAlignment
     649             : #*------------------------------------------------------------------------
     650             : #*
     651             : #*  Klasse:     ScFunctionDockWin
     652             : #*
     653             : #*  Funktion:   Ueberprueft den Andockmodus und stellt die
     654             : #*              Groessen dementsprechend ein.
     655             : #*
     656             : #*  Input:      Das neue Alignment
     657             : #*
     658             : #*  Output:     Das uebergebene Alignment
     659             : #*
     660             : #************************************************************************/
     661           0 : SfxChildAlignment ScFunctionDockWin::CheckAlignment(SfxChildAlignment /* abla */,
     662             :                                 SfxChildAlignment aChildAlign)
     663             : {
     664           0 :     String aString = OUString("ww");
     665           0 :     Size aTxtSize( aFiFuncDesc.GetTextWidth(aString), aFiFuncDesc.GetTextHeight() );
     666           0 :     if(!bInit)
     667             :     {
     668           0 :         eSfxOldAlignment=eSfxNewAlignment;
     669           0 :         eSfxNewAlignment=aChildAlign;
     670             :     }
     671             :     else
     672             :     {
     673           0 :         bInit=false;
     674           0 :         eSfxOldAlignment=aChildAlign;
     675           0 :         eSfxNewAlignment=aChildAlign;
     676             :     }
     677             : 
     678           0 :     switch(eSfxOldAlignment)
     679             :     {
     680             :         case SFX_ALIGN_HIGHESTTOP:
     681             :         case SFX_ALIGN_TOP:
     682             :         case SFX_ALIGN_LOWESTTOP:
     683             :         case SFX_ALIGN_LOWESTBOTTOM:
     684             :         case SFX_ALIGN_BOTTOM:
     685             :         case SFX_ALIGN_TOOLBOXTOP:
     686             :         case SFX_ALIGN_TOOLBOXBOTTOM:
     687             : 
     688           0 :                         nMinWidth= 0;
     689           0 :                         nMinHeight=0;
     690             : 
     691           0 :                         break;
     692             : 
     693             :         case SFX_ALIGN_NOALIGNMENT:
     694             : 
     695           0 :                         aString = aCatBox.GetEntry(0);
     696           0 :                         aString.AppendAscii(RTL_CONSTASCII_STRINGPARAM("www"));
     697             :                         aTxtSize = Size( aFiFuncDesc.GetTextWidth(aString),
     698           0 :                                             aFiFuncDesc.GetTextHeight() );
     699             : 
     700           0 :         default:        Point aTopLeft=aCatBox.GetPosPixel();
     701           0 :                         nMinWidth=aTxtSize.Width()+aTopLeft.X()
     702           0 :                                 +2*aFuncList.GetPosPixel().X();
     703           0 :                         nMinHeight=19*aTxtSize.Height();
     704             : 
     705           0 :                         break;
     706             :     }
     707             : 
     708           0 :     return aChildAlign;
     709             : }
     710             : /*************************************************************************
     711             : #*  Member:     Close
     712             : #*------------------------------------------------------------------------
     713             : #*
     714             : #*  Klasse:     ScFunctionDockWin
     715             : #*
     716             : #*  Funktion:   Aenderungen erkennen
     717             : #*
     718             : #*  Input:      ---
     719             : #*
     720             : #*  Output:     TRUE
     721             : #*
     722             : #************************************************************************/
     723           0 : void ScFunctionDockWin::Notify( SfxBroadcaster&, const SfxHint& /* rHint */ )
     724             : {
     725           0 : }
     726             : 
     727             : 
     728             : /*************************************************************************
     729             : #*  Member:     Resize
     730             : #*------------------------------------------------------------------------
     731             : #*
     732             : #*  Klasse:     ScFunctionDockWin
     733             : #*
     734             : #*  Funktion:   Ueberladene Funktion um die Groesse der
     735             : #*              einzelnen Controls einzustellen.
     736             : #*
     737             : #*  Input:      neue Groesse
     738             : #*
     739             : #*  Output:     ---
     740             : #*
     741             : #************************************************************************/
     742             : 
     743           0 : void ScFunctionDockWin::Resize()
     744             : {
     745           0 :     if ( !IsFloatingMode() ||
     746           0 :          !GetFloatingWindow()->IsRollUp() )
     747             :     {
     748           0 :         Size aQSize=GetOutputSizePixel();
     749           0 :         Resizing( aQSize);
     750           0 :         SetSize();
     751             :     }
     752           0 :     SfxDockingWindow::Resize();
     753           0 : }
     754             : 
     755             : /*************************************************************************
     756             : #*  Member:     UpdateFunctionList
     757             : #*------------------------------------------------------------------------
     758             : #*
     759             : #*  Klasse:     ScFunctionDockWin
     760             : #*
     761             : #*  Funktion:   Aktualisiert die Liste der Funktionen ab-
     762             : #*              haengig von der eingestellten Kategorie.
     763             : #*
     764             : #*  Input:      ---
     765             : #*
     766             : #*  Output:     ---
     767             : #*
     768             : #************************************************************************/
     769             : 
     770           0 : void ScFunctionDockWin::UpdateFunctionList()
     771             : {
     772           0 :     sal_uInt16  nSelPos   = aCatBox.GetSelectEntryPos();
     773             :     sal_uInt16  nCategory = ( LISTBOX_ENTRY_NOTFOUND != nSelPos )
     774           0 :                             ? (nSelPos-1) : 0;
     775             : 
     776           0 :     pAllFuncList->Clear();
     777           0 :     pAllFuncList->SetUpdateMode( false );
     778             : 
     779           0 :     if ( nSelPos > 0 )
     780             :     {
     781           0 :         ScFunctionMgr* pFuncMgr = ScGlobal::GetStarCalcFunctionMgr();
     782             : 
     783           0 :         const ScFuncDesc* pDesc = pFuncMgr->First( nCategory );
     784           0 :         while ( pDesc )
     785             :         {
     786             :             pAllFuncList->SetEntryData(
     787           0 :                 pAllFuncList->InsertEntry( *(pDesc->pFuncName) ),
     788           0 :                 (void*)pDesc );
     789           0 :             pDesc = pFuncMgr->Next();
     790             :         }
     791             :     }
     792             :     else // LRU-Liste
     793             :     {
     794           0 :         for(::std::vector<const formula::IFunctionDescription*>::iterator iter=aLRUList.begin();iter!=aLRUList.end();++iter)
     795             :         {
     796           0 :             const formula::IFunctionDescription* pDesc = *iter;
     797             :             pAllFuncList->SetEntryData(
     798           0 :                     pAllFuncList->InsertEntry(pDesc->getFunctionName()),
     799           0 :                     (void*)pDesc );
     800             :         }
     801             :     }
     802             : 
     803             : 
     804             :     //------------------------------------------------------
     805           0 :     pAllFuncList->SetUpdateMode( sal_True );
     806             : 
     807           0 :     if ( pAllFuncList->GetEntryCount() > 0 )
     808             :     {
     809           0 :         pAllFuncList->Enable();
     810           0 :         pAllFuncList->SelectEntryPos( 0 );
     811             :     }
     812             :     else
     813             :     {
     814           0 :         pAllFuncList->Disable();
     815             :     }
     816           0 : }
     817             : 
     818             : /*************************************************************************
     819             : #*  Member:     DoEnter
     820             : #*------------------------------------------------------------------------
     821             : #*
     822             : #*  Klasse:     ScFunctionDockWin
     823             : #*
     824             : #*  Funktion:   Eingabe ins Dokument uebernehmen. Wird aufgerufen
     825             : #*              nach betaetigen der Uebernehmen- Schaltflaeche
     826             : #*              oder einem Doppelklick in die Funktionsliste.
     827             : #*
     828             : #*  Input:      ---
     829             : #*
     830             : #*  Output:     ---
     831             : #*
     832             : #************************************************************************/
     833             : 
     834           0 : void ScFunctionDockWin::DoEnter(sal_Bool /* bOk */) //@@ ???
     835             : {
     836           0 :     String aFirstArgStr;
     837           0 :     String aArgStr;
     838           0 :     String aString=pAllFuncList->GetSelectEntry();
     839           0 :     SfxViewShell* pCurSh = SfxViewShell::Current();
     840           0 :     nArgs=0;
     841             : 
     842           0 :     if(aString.Len()>0)
     843             :     {
     844             : 
     845           0 :         ScModule* pScMod = SC_MOD();
     846           0 :         ScTabViewShell* pViewSh = PTR_CAST( ScTabViewShell, pCurSh);
     847           0 :         ScInputHandler* pHdl = pScMod->GetInputHdl( pViewSh );
     848           0 :         if(!pScMod->IsEditMode())
     849             :         {
     850           0 :             pScMod->SetInputMode(SC_INPUT_TABLE);
     851           0 :             aString = '=';
     852           0 :             aString += pAllFuncList->GetSelectEntry();
     853           0 :             if (pHdl)
     854           0 :                 pHdl->ClearText();
     855             :         }
     856             :         const ScFuncDesc* pDesc =
     857             :              (const ScFuncDesc*)pAllFuncList->GetEntryData(
     858           0 :                     pAllFuncList->GetSelectEntryPos() );
     859           0 :         if (pDesc)
     860             :         {
     861           0 :             pFuncDesc=pDesc;
     862           0 :             UpdateLRUList();
     863           0 :             nArgs = pDesc->nArgCount;
     864           0 :             if(nArgs>0)
     865             :             {
     866             :                 // NOTE: Theoretically the first parameter could have the
     867             :                 // suppress flag as well, but practically it doesn't.
     868           0 :                 aFirstArgStr = *(pDesc->ppDefArgNames[0]);
     869           0 :                 aFirstArgStr = comphelper::string::strip(aFirstArgStr, ' ');
     870           0 :                 aFirstArgStr.SearchAndReplaceAll(' ', '_');
     871           0 :                 aArgStr = aFirstArgStr;
     872           0 :                 if ( nArgs != VAR_ARGS && nArgs != PAIRED_VAR_ARGS )
     873             :                 {   // no VarArgs or Fix plus VarArgs, but not VarArgs only
     874           0 :                     OUString aArgSep("; ");
     875             :                     sal_uInt16 nFix;
     876           0 :                     if (nArgs >= PAIRED_VAR_ARGS)
     877           0 :                         nFix = nArgs - PAIRED_VAR_ARGS + 2;
     878           0 :                     else if (nArgs >= VAR_ARGS)
     879           0 :                         nFix = nArgs - VAR_ARGS + 1;
     880             :                     else
     881           0 :                         nFix = nArgs;
     882           0 :                     for ( sal_uInt16 nArg = 1;
     883           0 :                             nArg < nFix && !pDesc->pDefArgFlags[nArg].bOptional; nArg++ )
     884             :                     {
     885           0 :                         if (!pDesc->pDefArgFlags[nArg].bSuppress)
     886             :                         {
     887           0 :                             aArgStr += aArgSep;
     888           0 :                             String sTmp(*(pDesc->ppDefArgNames[nArg]));
     889           0 :                             sTmp = comphelper::string::strip(sTmp, ' ');
     890           0 :                             sTmp.SearchAndReplaceAll(' ', '_');
     891           0 :                             aArgStr += sTmp;
     892             :                         }
     893           0 :                     }
     894             :                 }
     895             :             }
     896             :         }
     897           0 :         if (pHdl)
     898             :         {
     899           0 :             if (pHdl->GetEditString().isEmpty())
     900             :             {
     901           0 :                 aString = '=';
     902           0 :                 aString += pAllFuncList->GetSelectEntry();
     903             :             }
     904           0 :             EditView *pEdView=pHdl->GetActiveView();
     905           0 :             if(pEdView!=NULL) // @ Wegen Absturz bei Namen festlegen
     906             :             {
     907           0 :                 if(nArgs>0)
     908             :                 {
     909           0 :                     pHdl->InsertFunction(aString);
     910           0 :                     pEdView->InsertText(aArgStr,sal_True);
     911           0 :                     ESelection  aESel=pEdView->GetSelection();
     912           0 :                     aESel.nEndPos=aESel.nStartPos+aFirstArgStr.Len();
     913           0 :                     pEdView->SetSelection(aESel);
     914           0 :                     pHdl->DataChanged();
     915             :                 }
     916             :                 else
     917             :                 {
     918           0 :                     aString.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "()" ));
     919           0 :                     pEdView->InsertText(aString,false);
     920           0 :                     pHdl->DataChanged();
     921             :                 }
     922             :             }
     923             :         }
     924           0 :         InitLRUList();
     925             :     }
     926           0 :     if ( pCurSh )
     927             :     {
     928           0 :         Window* pShellWnd = pCurSh->GetWindow();
     929             : 
     930           0 :         if ( pShellWnd )
     931           0 :             pShellWnd->GrabFocus();
     932           0 :     }
     933             : 
     934             : 
     935           0 : }
     936             : 
     937             : 
     938             : 
     939             : /*************************************************************************
     940             : #*  Handle:     SelHdl
     941             : #*------------------------------------------------------------------------
     942             : #*
     943             : #*  Klasse:     ScFunctionDockWin
     944             : #*
     945             : #*  Funktion:   Bei einer Aenderung der Kategorie wird die
     946             : #*              die Liste der Funktionen aktualisiert.
     947             : #*
     948             : #*  Input:      ---
     949             : #*
     950             : #*  Output:     ---
     951             : #*
     952             : #************************************************************************/
     953             : 
     954           0 : IMPL_LINK( ScFunctionDockWin, SelHdl, ListBox*, pLb )
     955             : {
     956           0 :     if ( pLb == &aCatBox)
     957             :     {
     958           0 :         UpdateFunctionList();
     959           0 :         SetDescription();
     960             :     }
     961             : 
     962           0 :     if ( pLb == &aFuncList||pLb == &aDDFuncList)
     963             :     {
     964           0 :         SetDescription();
     965             :     }
     966             : 
     967             : 
     968             :     //SetSize();
     969           0 :     return 0;
     970             : }
     971             : 
     972             : /*************************************************************************
     973             : #*  Handle:     SelHdl
     974             : #*------------------------------------------------------------------------
     975             : #*
     976             : #*  Klasse:     ScFunctionDockWin
     977             : #*
     978             : #*  Funktion:   Bei einer Aenderung der Kategorie wird die
     979             : #*              die Liste der Funktionen aktualisiert.
     980             : #*
     981             : #*  Input:      ---
     982             : #*
     983             : #*  Output:     ---
     984             : #*
     985             : #************************************************************************/
     986             : 
     987           0 : IMPL_LINK( ScFunctionDockWin, SetSelectionHdl, void*, pCtrl )
     988             : {
     989           0 :     if ((ImageButton *)pCtrl == &aInsertButton ||
     990           0 :         (ListBox *)pCtrl == &aFuncList)
     991             :     {
     992           0 :         DoEnter(sal_True);          // Uebernimmt die Eingabe
     993             :     }
     994             :     //...
     995             : 
     996           0 :     return 0;
     997             : }
     998             : 
     999             : /*************************************************************************
    1000             : #*  Handle:     SetSplitHdl
    1001             : #*------------------------------------------------------------------------
    1002             : #*
    1003             : #*  Klasse:     ScFunctionDockWin
    1004             : #*
    1005             : #*  Funktion:   Bei einer Aenderung des Split- Controls werden die
    1006             : #*              einzelnen Controls an die neue Groesse angepasst.
    1007             : #*
    1008             : #*  Input:      Zeiger auf Control
    1009             : #*
    1010             : #*  Output:     ---
    1011             : #*
    1012             : #************************************************************************/
    1013             : 
    1014           0 : IMPL_LINK( ScFunctionDockWin, SetSplitHdl, ScPrivatSplit*, pCtrl )
    1015             : {
    1016           0 :     if (pCtrl == &aPrivatSplit)
    1017             :     {
    1018           0 :         short nDeltaY=aPrivatSplit.GetDeltaY();
    1019           0 :         Size aFLSize=aFuncList.GetSizePixel();
    1020           0 :         Size aFDSize=aFiFuncDesc.GetSizePixel();
    1021           0 :         Point aFDTopLeft=aFiFuncDesc.GetPosPixel();
    1022             : 
    1023           0 :         aFLSize.Height()+=nDeltaY;
    1024           0 :         aFDSize.Height()-=nDeltaY;
    1025           0 :         aFDTopLeft.Y()+=nDeltaY;
    1026           0 :         aFuncList.SetSizePixel(aFLSize);
    1027           0 :         aFiFuncDesc.SetPosPixel(aFDTopLeft);
    1028           0 :         aFiFuncDesc.SetSizePixel(aFDSize);
    1029             :     }
    1030             :     //...
    1031             : 
    1032           0 :     return 0;
    1033             : }
    1034             : 
    1035           0 : void ScFunctionDockWin::ToggleFloatingMode()
    1036             : {
    1037           0 :     aSplitterInitPos = Point();
    1038           0 :     SfxDockingWindow::ToggleFloatingMode();
    1039             : 
    1040           0 :     eSfxNewAlignment=GetAlignment();
    1041           0 :     eSfxOldAlignment=eSfxNewAlignment;
    1042             : 
    1043           0 :     aOldSize.Height()=0;
    1044           0 :     aOldSize.Width()=0;
    1045           0 :     aTimer.Start();
    1046           0 : }
    1047             : 
    1048           0 : IMPL_LINK_NOARG(ScFunctionDockWin, TimerHdl)
    1049             : {
    1050           0 :     CheckAlignment(eSfxOldAlignment,eSfxNewAlignment);
    1051           0 :     SetSize();
    1052           0 :     return 0;
    1053             : }
    1054             : 
    1055           0 : void ScFunctionDockWin::Initialize(SfxChildWinInfo *pInfo)
    1056             : {
    1057           0 :     String aStr;
    1058           0 :     if(pInfo!=NULL)
    1059             :     {
    1060           0 :         if ( pInfo->aExtraString.Len() )
    1061             :         {
    1062             :             xub_StrLen nPos = pInfo->aExtraString.Search(
    1063           0 :                 OUString("ScFuncList:"));
    1064             : 
    1065             :             // Versuche, den Alignment-String "ALIGN:(...)" einzulesen; wenn
    1066             :             // er nicht vorhanden ist, liegt eine "altere Version vor
    1067           0 :             if ( nPos != STRING_NOTFOUND )
    1068             :             {
    1069           0 :                 xub_StrLen n1 = pInfo->aExtraString.Search('(', nPos);
    1070           0 :                 if ( n1 != STRING_NOTFOUND )
    1071             :                 {
    1072           0 :                     xub_StrLen n2 = pInfo->aExtraString.Search(')', n1);
    1073           0 :                     if ( n2 != STRING_NOTFOUND )
    1074             :                     {
    1075             :                         // Alignment-String herausschneiden
    1076           0 :                         aStr = pInfo->aExtraString.Copy(nPos, n2 - nPos + 1);
    1077           0 :                         pInfo->aExtraString.Erase(nPos, n2 - nPos + 1);
    1078           0 :                         aStr.Erase(0, n1-nPos+1);
    1079             :                     }
    1080             :                 }
    1081             :             }
    1082             :         }
    1083             :     }
    1084           0 :     SfxDockingWindow::Initialize(pInfo);
    1085             : 
    1086           0 :     if ( aStr.Len())
    1087             :     {
    1088           0 :         aSplitterInitPos=aPrivatSplit.GetPosPixel();
    1089           0 :         aSplitterInitPos.Y()=(sal_uInt16) aStr.ToInt32();
    1090           0 :         xub_StrLen n1 = aStr.Search(';');
    1091           0 :         aStr.Erase(0, n1+1);
    1092           0 :         sal_uInt16 nSelPos=sal::static_int_cast<sal_uInt16>( aStr.ToInt32() );
    1093           0 :         aCatBox.SelectEntryPos(nSelPos);
    1094           0 :         SelHdl(&aCatBox);
    1095             : 
    1096             :         //  if the window has already been shown (from SfxDockingWindow::Initialize if docked),
    1097             :         //  set the splitter position now, otherwise it is set in StateChanged with type INITSHOW
    1098             : 
    1099           0 :         UseSplitterInitPos();
    1100           0 :     }
    1101           0 : }
    1102             : 
    1103             : //-------------------------------------------------------------------------
    1104             : 
    1105           0 : void ScFunctionDockWin::FillInfo(SfxChildWinInfo& rInfo) const
    1106             : {
    1107           0 :     SfxDockingWindow::FillInfo(rInfo);
    1108           0 :     Point aPoint=aPrivatSplit.GetPosPixel();
    1109           0 :     rInfo.aExtraString += "ScFuncList:(" +
    1110           0 :                           OUString::number(aPoint.Y()) + ";" +
    1111           0 :                           OUString::number(aCatBox.GetSelectEntryPos()) + ")";
    1112           0 : }
    1113             : 
    1114           0 : void ScFunctionDockWin::UseSplitterInitPos()
    1115             : {
    1116           0 :     if ( IsVisible() && aPrivatSplit.IsEnabled() && aSplitterInitPos != Point() )
    1117             :     {
    1118           0 :         aPrivatSplit.MoveSplitTo(aSplitterInitPos);
    1119           0 :         aSplitterInitPos = Point();     // use only once
    1120             :     }
    1121           0 : }
    1122             : 
    1123           0 : void ScFunctionDockWin::StateChanged( StateChangedType nStateChange )
    1124             : {
    1125           0 :     SfxDockingWindow::StateChanged( nStateChange );
    1126             : 
    1127           0 :     if (nStateChange == STATE_CHANGE_INITSHOW)
    1128             :     {
    1129           0 :         UseSplitterInitPos();           //  set initial splitter position if necessary
    1130             :     }
    1131          93 : }
    1132             : 
    1133             : 
    1134             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10