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

Generated by: LCOV version 1.10