xref: /trunk/main/sc/source/ui/inc/dwfunctr.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _SC_DWFUNCTR_HXX
28 #define _SC_DWFUNCTR_HXX
29 
30 #include <sfx2/childwin.hxx>
31 #include <sfx2/dockwin.hxx>
32 #include <svl/lstner.hxx>
33 #include <svtools/stdctrl.hxx>
34 
35 #ifndef _LSTBOX_HXX //autogen
36 #include <vcl/lstbox.hxx>
37 #endif
38 
39 #ifndef _IMAGEBTN_HXX //autogen
40 #include <vcl/button.hxx>
41 #endif
42 
43 #ifndef _COMBOBOX_HXX //autogen
44 #include <vcl/combobox.hxx>
45 #endif
46 #include "anyrefdg.hxx"
47 #include "global.hxx"       // ScAddress
48 #include "privsplt.hxx"
49 #include "funcdesc.hxx"
50 
51 #ifndef LRU_MAX
52 #define LRU_MAX 10
53 #endif
54 /*************************************************************************
55 |*
56 |* Ableitung vom SfxChildWindow als "Behaelter" fuer Controller
57 |*
58 \************************************************************************/
59 
60 class ScFunctionChildWindow : public SfxChildWindow
61 {
62  public:
63     ScFunctionChildWindow( Window*, sal_uInt16, SfxBindings*,
64                             SfxChildWinInfo* );
65 
66     SFX_DECL_CHILDWINDOW(ScFunctionChildWindow);
67 };
68 
69 /*************************************************************************
70 |*
71 |* ScFuncDockWin
72 |*
73 \************************************************************************/
74 
75 class ScFunctionDockWin : public SfxDockingWindow, public SfxListener
76 {
77 
78 private:
79     Timer               aTimer;
80     ScPrivatSplit       aPrivatSplit;
81     ListBox             aCatBox;
82     ListBox             aFuncList;
83     ListBox             aDDFuncList;
84     ListBox*            pAllFuncList;
85 
86     SfxChildAlignment   eSfxNewAlignment;
87     SfxChildAlignment   eSfxOldAlignment;
88     ImageButton         aInsertButton;
89     FixedText           aFiFuncDesc;
90     sal_uInt16              nLeftSlot;
91     sal_uInt16              nRightSlot;
92     sal_uLong               nMinWidth;
93     sal_uLong               nMinHeight;
94     Size                aOldSize;
95     sal_Bool                bSizeFlag;
96     sal_Bool                bInit;
97     short               nDockMode;
98     Point               aSplitterInitPos;
99     const ScFuncDesc*   pFuncDesc;
100     sal_uInt16              nArgs;
101     String**            pArgArr;
102 
103 
104     const ScFuncDesc*   aLRUList[LRU_MAX];
105 
106     void            UpdateFunctionList();
107     void            UpdateLRUList();
108     void            DoEnter(sal_Bool bOk); //@@ ???
109     void            SetDescription();
110     void            SetLeftRightSize();
111     void            SetTopBottonSize();
112     void            SetMyWidthLeRi(Size &aNewSize);
113     void            SetMyHeightLeRi(Size &aNewSize);
114     void            SetMyWidthToBo(Size &aNewSize);
115     void            SetMyHeightToBo(Size &aNewSize);
116     void            UseSplitterInitPos();
117 
118                     DECL_LINK( SetSelectionHdl, void* );
119                     DECL_LINK( SelHdl, ListBox* );
120                     DECL_LINK(SetSplitHdl,ScPrivatSplit*);
121                     DECL_LINK( TimerHdl, Timer*);
122 
123 protected:
124 
125     virtual sal_Bool    Close();
126     virtual void    Resize();
127     virtual void    Resizing( Size& rSize );
128     virtual void    SetSize();
129     virtual void    ToggleFloatingMode();
130     virtual void    StateChanged( StateChangedType nStateChange );
131 
132 
133     virtual SfxChildAlignment CheckAlignment(SfxChildAlignment,
134                                 SfxChildAlignment eAlign);
135 
136 public:
137                     ScFunctionDockWin(  SfxBindings* pBindings,
138                                         SfxChildWindow *pCW,
139                                         Window* pParent,
140                                         const ResId& rResId );
141 
142                     ~ScFunctionDockWin();
143 
144     using SfxDockingWindow::Notify;
145     virtual void    Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
146 
147     void            SetSlotIDs( sal_uInt16 nLeft, sal_uInt16 nRight )
148                         { nLeftSlot = nLeft; nRightSlot = nRight; }
149 
150     void            InitLRUList();
151 
152     void            Initialize (SfxChildWinInfo* pInfo);
153     virtual void    FillInfo(SfxChildWinInfo&) const;
154 };
155 
156 #endif
157 
158 
159