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 SwFieldMgr;
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& aTableName );
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 : VclPtr<Edit> aPos;
51 : VclPtr<InputEdit> aEdit;
52 : PopupMenu aPopMenu;
53 : SwFieldMgr* pMgr;
54 : SwWrtShell* pWrtShell;
55 : SwView* pView;
56 : SfxBindings* pBindings;
57 : OUString aAktTableName, sOldFormula;
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 DelBoxContent();
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_TYPED( DropdownClickHdl, ToolBox*, void );
79 : void ApplyFormula();
80 : void CancelFormula();
81 :
82 : public:
83 : SwInputWindow( vcl::Window* pParent, SfxBindings* pBindings );
84 : virtual ~SwInputWindow();
85 : virtual void dispose() SAL_OVERRIDE;
86 :
87 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
88 :
89 : void SelectHdl( ToolBox*);
90 :
91 : void ShowWin();
92 :
93 : bool IsActive(){ return bActive; };
94 :
95 : DECL_LINK( SelTableCellsNotify, SwWrtShell * );
96 :
97 : void SetFormula( const OUString& rFormula, bool bDelSel = true );
98 0 : const SwView* GetView() const{return pView;}
99 : };
100 :
101 : class SwInputChild : public SfxChildWindow
102 : {
103 : SfxDispatcher* pDispatch;
104 : public:
105 : SwInputChild( vcl::Window* ,
106 : sal_uInt16 nId,
107 : SfxBindings*,
108 : SfxChildWinInfo* );
109 : virtual ~SwInputChild();
110 : SFX_DECL_CHILDWINDOW_WITHID( SwInputChild );
111 0 : void SetFormula( const OUString& rFormula, bool bDelSel = true )
112 0 : { static_cast<SwInputWindow*>(pWindow.get())->SetFormula(
113 0 : rFormula, bDelSel ); }
114 0 : const SwView* GetView() const{return static_cast<SwInputWindow*>(pWindow.get())->GetView();}
115 :
116 : };
117 :
118 : #endif
119 :
120 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|