xref: /AOO41X/main/sw/source/ui/inc/inputwin.hxx (revision 1d2dbeb0b7301723c6d13094e87a8714ef81a328)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef SW_INPUTWIN_HXX
24 #define SW_INPUTWIN_HXX
25 
26 #include <vcl/edit.hxx>
27 #include <vcl/menu.hxx>
28 #include <vcl/toolbox.hxx>
29 
30 #include <sfx2/childwin.hxx>
31 
32 class SwFldMgr;
33 class SwWrtShell;
34 class SwView;
35 class SfxDispatcher;
36 
37 //========================================================================
38 class InputEdit : public Edit
39 {
40 public:
InputEdit(Window * pParent,WinBits nStyle)41                     InputEdit(Window* pParent, WinBits nStyle) :
42                         Edit(pParent , nStyle){}
43 
44     void            UpdateRange(const String& aSel,
45                                 const String& aTblName );
46 
47 protected:
48     virtual void    KeyInput( const KeyEvent&  );
49 };
50 
51 //========================================================================
52 
53 class SwInputWindow : public ToolBox
54 {
55 friend class InputEdit;
56 
57     Edit            aPos;
58     InputEdit       aEdit;
59     PopupMenu       aPopMenu;
60     SwFldMgr*       pMgr;
61     SwWrtShell*     pWrtShell;
62     SwView*         pView;
63     SfxBindings*    pBindings;
64     String          aAktTableName, sOldFml;
65     sal_Int32       m_nActionCount;
66 
67     sal_Bool        bFirst : 1;  //Initialisierungen beim ersten Aufruf
68     sal_Bool        bActive : 1; //fuer Hide/Show beim Dokumentwechsel
69     sal_Bool        bIsTable : 1;
70     sal_Bool        bDelSel : 1;
71     bool            m_bDoesUndo : 1;
72     bool            m_bResetUndo : 1;
73     bool            m_bCallUndo : 1;
74 
75     void CleanupUglyHackWithUndo();
76 
77     void DelBoxCntnt();
78     DECL_LINK( ModifyHdl, InputEdit* );
79 
80     using Window::IsActive;
81 
82 protected:
83     virtual void    Resize();
84     virtual void    Click();
85     DECL_LINK( MenuHdl, Menu * );
86     DECL_LINK( DropdownClickHdl, ToolBox* );
87     void            ApplyFormula();
88     void            CancelFormula();
89 
90 public:
91                     SwInputWindow( Window* pParent, SfxBindings* pBindings );
92     virtual         ~SwInputWindow();
93 
94     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
95 
96     void            SelectHdl( ToolBox*);
97 
98     void            ShowWin();
99 
IsActive()100     sal_Bool            IsActive(){ return bActive; };
101 
102     DECL_LINK( SelTblCellsNotify, SwWrtShell * );
103 
104     void            SetFormula( const String& rFormula, sal_Bool bDelSel = sal_True );
GetView() const105     const SwView*   GetView() const{return pView;}
106 };
107 
108 class SwInputChild : public SfxChildWindow
109 {
110     sal_Bool            bObjVis;
111     SfxDispatcher*  pDispatch;
112 public:
113     SwInputChild( Window* ,
114                         sal_uInt16 nId,
115                         SfxBindings*,
116                         SfxChildWinInfo*  );
117     ~SwInputChild();
118     SFX_DECL_CHILDWINDOW( SwInputChild );
SetFormula(const String & rFormula,sal_Bool bDelSel=sal_True)119     void            SetFormula( const String& rFormula, sal_Bool bDelSel = sal_True )
120                         { ((SwInputWindow*)pWindow)->SetFormula(
121                                     rFormula, bDelSel ); }
GetView() const122     const SwView*   GetView() const{return ((SwInputWindow*)pWindow)->GetView();}
123 
124 };
125 
126 //==================================================================
127 
128 #endif
129 
130