xref: /trunk/main/sc/source/ui/inc/tphfedit.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 
28 #ifndef SC_TPHFEDIT_HXX
29 #define SC_TPHFEDIT_HXX
30 
31 #include <sfx2/tabdlg.hxx>
32 #include <svx/pageitem.hxx>
33 #include <svtools/stdctrl.hxx>
34 #include <vcl/group.hxx>
35 #ifndef _LSTBOX_HXX //autogen
36 #include <vcl/lstbox.hxx>
37 #endif
38 #include <vcl/timer.hxx>
39 #include <vcl/virdev.hxx>
40 #include "scdllapi.h"
41 #include "scitems.hxx"          // wegen enum SvxNumType
42 #include "popmenu.hxx"
43 #include <com/sun/star/accessibility/XAccessible.hpp>
44 #include <cppuhelper/weakref.hxx>
45 
46 //===================================================================
47 
48 class ScHeaderEditEngine;
49 class ScPatternAttr;
50 class EditView;
51 class EditTextObject;
52 class SvxFieldItem;
53 class ScAccessibleEditObject;
54 class ScEditWindow;
55 
56 SC_DLLPUBLIC ScEditWindow* GetScEditWindow (); //CHINA001
57 
58 enum ScEditWindowLocation
59 {
60     Left,
61     Center,
62     Right
63 };
64 
65 class SC_DLLPUBLIC ScEditWindow : public Control
66 {
67 public:
68             ScEditWindow( Window* pParent, const ResId& rResId, ScEditWindowLocation eLoc );
69             ~ScEditWindow();
70 
71     using Control::SetFont;
72     void            SetFont( const ScPatternAttr& rPattern );
73     using Control::SetText;
74     void            SetText( const EditTextObject& rTextObject );
75     EditTextObject* CreateTextObject();
76     void            SetCharAttriutes();
77 
78     void            InsertField( const SvxFieldItem& rFld );
79 
80     void            SetNumType(SvxNumType eNumType);
81 
82     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
83 
84     inline ScHeaderEditEngine*  GetEditEngine() const {return pEdEngine;}
85 protected:
86     virtual void    Paint( const Rectangle& rRec );
87     virtual void    MouseMove( const MouseEvent& rMEvt );
88     virtual void    MouseButtonDown( const MouseEvent& rMEvt );
89     virtual void    MouseButtonUp( const MouseEvent& rMEvt );
90     virtual void    KeyInput( const KeyEvent& rKEvt );
91     virtual void    Command( const CommandEvent& rCEvt );
92     virtual void    GetFocus();
93     virtual void    LoseFocus();
94 
95 private:
96     ScHeaderEditEngine* pEdEngine;
97     EditView*           pEdView;
98     ScEditWindowLocation eLocation;
99     bool mbRTL;
100 
101     com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible > xAcc;
102     ScAccessibleEditObject* pAcc;
103 };
104 
105 //===================================================================
106 class SC_DLLPUBLIC ScExtIButton : public ImageButton
107 {
108 private:
109 
110     Timer           aTimer;
111     ScPopupMenu*    pPopupMenu;
112     Link            aMLink;
113     sal_uInt16          nSelected;
114 
115     SC_DLLPRIVATE  DECL_LINK( TimerHdl, Timer*);
116 
117 //  void            DrawArrow();
118 
119 protected:
120 
121     virtual void    MouseButtonDown( const MouseEvent& rMEvt );
122     virtual void    MouseButtonUp( const MouseEvent& rMEvt);
123     virtual void    Click();
124 
125     virtual void    StartPopup();
126 
127 public:
128 
129     ScExtIButton(Window* pParent, const ResId& rResId );
130 
131     void            SetPopupMenu(ScPopupMenu* pPopUp);
132 
133     sal_uInt16          GetSelected();
134 
135     void            SetMenuHdl( const Link& rLink ) { aMLink = rLink; }
136     const Link&     GetMenuHdl() const { return aMLink; }
137 
138     virtual long    PreNotify( NotifyEvent& rNEvt );
139 };
140 
141 
142 //===================================================================
143 //CHINA001
144 //CHINA001 class ScHFEditPage : public SfxTabPage
145 //CHINA001 {
146 //CHINA001 public:
147 //CHINA001 virtual  sal_Bool    FillItemSet ( SfxItemSet& rCoreSet );
148 //CHINA001 virtual  void    Reset       ( const SfxItemSet& rCoreSet );
149 //CHINA001
150 //CHINA001 void         SetNumType(SvxNumType eNumType);
151 //CHINA001
152 //CHINA001 protected:
153 //CHINA001 ScHFEditPage( Window*            pParent,
154 //CHINA001 sal_uInt16           nResId,
155 //CHINA001 const SfxItemSet&    rCoreSet,
156 //CHINA001 sal_uInt16           nWhich );
157 //CHINA001 virtual      ~ScHFEditPage();
158 //CHINA001
159 //CHINA001 private:
160 //CHINA001 FixedText        aFtLeft;
161 //CHINA001 ScEditWindow aWndLeft;
162 //CHINA001 FixedText        aFtCenter;
163 //CHINA001 ScEditWindow aWndCenter;
164 //CHINA001 FixedText        aFtRight;
165 //CHINA001 ScEditWindow aWndRight;
166 //CHINA001 ImageButton      aBtnText;
167 //CHINA001 ScExtIButton aBtnFile;
168 //CHINA001 ImageButton      aBtnTable;
169 //CHINA001 ImageButton      aBtnPage;
170 //CHINA001 ImageButton      aBtnLastPage;
171 //CHINA001 ImageButton      aBtnDate;
172 //CHINA001 ImageButton      aBtnTime;
173 //CHINA001 FixedLine        aFlInfo;
174 //CHINA001 FixedInfo        aFtInfo;
175 //CHINA001 ScPopupMenu      aPopUpFile;
176 //CHINA001
177 //CHINA001 sal_uInt16           nWhich;
178 //CHINA001 String           aCmdArr[6];
179 //CHINA001
180 //CHINA001 private:
181 //CHINA001 #ifdef _TPHFEDIT_CXX
182 //CHINA001 void FillCmdArr();
183 //CHINA001 DECL_LINK( ClickHdl, ImageButton* );
184 //CHINA001 DECL_LINK( MenuHdl, ScExtIButton* );
185 //CHINA001 #endif
186 //CHINA001 };
187 //CHINA001
188 //CHINA001 //===================================================================
189 //CHINA001
190 //CHINA001 class ScRightHeaderEditPage : public ScHFEditPage
191 //CHINA001 {
192 //CHINA001 public:
193 //CHINA001 static SfxTabPage*   Create( Window* pParent, const SfxItemSet& rCoreSet );
194 //CHINA001 static sal_uInt16*       GetRanges();
195 //CHINA001
196 //CHINA001 private:
197 //CHINA001 ScRightHeaderEditPage( Window* pParent, const SfxItemSet& rSet );
198 //CHINA001 };
199 //CHINA001
200 //CHINA001 //===================================================================
201 //CHINA001
202 //CHINA001 class ScLeftHeaderEditPage : public ScHFEditPage
203 //CHINA001 {
204 //CHINA001 public:
205 //CHINA001 static SfxTabPage*   Create( Window* pParent, const SfxItemSet& rCoreSet );
206 //CHINA001 static sal_uInt16*       GetRanges();
207 //CHINA001
208 //CHINA001 private:
209 //CHINA001 ScLeftHeaderEditPage( Window* pParent, const SfxItemSet& rSet );
210 //CHINA001 };
211 //CHINA001
212 //CHINA001 //===================================================================
213 //CHINA001
214 //CHINA001 class ScRightFooterEditPage : public ScHFEditPage
215 //CHINA001 {
216 //CHINA001 public:
217 //CHINA001 static SfxTabPage*   Create( Window* pParent, const SfxItemSet& rCoreSet );
218 //CHINA001 static sal_uInt16*       GetRanges();
219 //CHINA001
220 //CHINA001 private:
221 //CHINA001 ScRightFooterEditPage( Window* pParent, const SfxItemSet& rSet );
222 //CHINA001 };
223 //CHINA001
224 //CHINA001 //===================================================================
225 //CHINA001
226 //CHINA001 class ScLeftFooterEditPage : public ScHFEditPage
227 //CHINA001 {
228 //CHINA001 public:
229 //CHINA001 static SfxTabPage*   Create( Window* pParent, const SfxItemSet& rCoreSet );
230 //CHINA001 static sal_uInt16*       GetRanges();
231 //CHINA001
232 //CHINA001 private:
233 //CHINA001 ScLeftFooterEditPage( Window* pParent, const SfxItemSet& rSet );
234 //CHINA001 };
235 
236 
237 
238 #endif // SC_TPHFEDIT_HXX
239 
240