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 : #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_INPUTWIN_HXX
20 : #define INCLUDED_SW_SOURCE_UIBASE_INC_INPUTWIN_HXX
21 :
22 : #include <vcl/edit.hxx>
23 : #include <vcl/menu.hxx>
24 : #include <vcl/toolbox.hxx>
25 :
26 : #include <sfx2/childwin.hxx>
27 :
28 : class SwFldMgr;
29 : class SwWrtShell;
30 : class SwView;
31 : class SfxDispatcher;
32 :
33 0 : class InputEdit : public Edit
34 : {
35 : public:
36 0 : InputEdit(vcl::Window* pParent, WinBits nStyle) :
37 0 : Edit(pParent , nStyle){}
38 :
39 : void UpdateRange(const OUString& aSel,
40 : const OUString& aTblName );
41 :
42 : protected:
43 : virtual void KeyInput( const KeyEvent& ) SAL_OVERRIDE;
44 : };
45 :
46 : class SwInputWindow : public ToolBox
47 : {
48 : friend class InputEdit;
49 :
50 : Edit aPos;
51 : InputEdit aEdit;
52 : PopupMenu aPopMenu;
53 : SwFldMgr* pMgr;
54 : SwWrtShell* pWrtShell;
55 : SwView* pView;
56 : SfxBindings* pBindings;
57 : OUString aAktTableName, sOldFml;
58 :
59 : bool bFirst : 1; // initialisations at first call
60 : bool bActive : 1; // for hide/show when switching documents
61 : bool bIsTable : 1;
62 : bool bDelSel : 1;
63 : bool m_bDoesUndo : 1;
64 : bool m_bResetUndo : 1;
65 : bool m_bCallUndo : 1;
66 :
67 : void CleanupUglyHackWithUndo();
68 :
69 : void DelBoxCntnt();
70 : DECL_LINK( ModifyHdl, void* );
71 :
72 : using Window::IsActive;
73 :
74 : protected:
75 : virtual void Resize() SAL_OVERRIDE;
76 : virtual void Click() SAL_OVERRIDE;
77 : DECL_LINK( MenuHdl, Menu * );
78 : DECL_LINK( DropdownClickHdl, void* );
79 : void ApplyFormula();
80 : void CancelFormula();
81 :
82 : public:
83 : SwInputWindow( vcl::Window* pParent, SfxBindings* pBindings );
84 : virtual ~SwInputWindow();
85 :
86 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
87 :
88 : void SelectHdl( ToolBox*);
89 :
90 : void ShowWin();
91 :
92 : bool IsActive(){ return bActive; };
93 :
94 : DECL_LINK( SelTblCellsNotify, SwWrtShell * );
95 :
96 : void SetFormula( const OUString& rFormula, bool bDelSel = true );
97 0 : const SwView* GetView() const{return pView;}
98 : };
99 :
100 : class SwInputChild : public SfxChildWindow
101 : {
102 : SfxDispatcher* pDispatch;
103 : public:
104 : SwInputChild( vcl::Window* ,
105 : sal_uInt16 nId,
106 : SfxBindings*,
107 : SfxChildWinInfo* );
108 : virtual ~SwInputChild();
109 : SFX_DECL_CHILDWINDOW_WITHID( SwInputChild );
110 0 : void SetFormula( const OUString& rFormula, bool bDelSel = true )
111 : { ((SwInputWindow*)pWindow)->SetFormula(
112 0 : rFormula, bDelSel ); }
113 0 : const SwView* GetView() const{return ((SwInputWindow*)pWindow)->GetView();}
114 :
115 : };
116 :
117 : #endif
118 :
119 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|