update dev300-m58
[ooovba.git] / starmath / inc / view.hxx
blob1ea4852e698c44a2c03bbc8923964717c597feb4
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: view.hxx,v $
10 * $Revision: 1.24 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef VIEW_HXX
31 #define VIEW_HXX
33 #include <sfx2/dockwin.hxx>
34 #include <sfx2/viewsh.hxx>
35 #include <svtools/scrwin.hxx>
36 #include <sfx2/ctrlitem.hxx>
37 #include <sfx2/shell.hxx>
38 #include <sfx2/viewfac.hxx>
39 #include <sfx2/viewfrm.hxx>
40 #include <svtools/colorcfg.hxx>
41 #include "edit.hxx"
42 #include "node.hxx"
43 #include "accessibility.hxx"
45 class Menu;
46 class DataChangedEvent;
47 class SmClipboardChangeListener;
48 class SmDocShell;
49 class SmViewShell;
51 /**************************************************************************/
53 class SmGraphicWindow : public ScrollableWindow
55 Point aFormulaDrawPos;
56 Rectangle aCursorRect;
58 ::com::sun::star::uno::Reference<
59 ::com::sun::star::accessibility::XAccessible > xAccessible;
60 SmGraphicAccessible * pAccessible;
62 SmViewShell *pViewShell;
63 USHORT nZoom;
64 short nModifyCount;
65 BOOL bIsCursorVisible;
67 protected:
68 void SetFormulaDrawPos(const Point &rPos) { aFormulaDrawPos = rPos; }
69 void SetIsCursorVisible(BOOL bVis) { bIsCursorVisible = bVis; }
70 using Window::SetCursor;
71 void SetCursor(const SmNode *pNode);
72 void SetCursor(const Rectangle &rRect);
74 virtual void DataChanged( const DataChangedEvent& );
75 virtual void Paint(const Rectangle&);
76 virtual void KeyInput(const KeyEvent& rKEvt);
77 virtual void Command(const CommandEvent& rCEvt);
78 virtual void StateChanged( StateChangedType eChanged );
79 DECL_LINK(MenuSelectHdl, Menu *);
81 public:
82 SmGraphicWindow(SmViewShell* pShell);
83 ~SmGraphicWindow();
85 // Window
86 virtual void MouseButtonDown(const MouseEvent &rMEvt);
87 virtual void GetFocus();
88 virtual void LoseFocus();
90 SmViewShell * GetView() { return pViewShell; }
92 using Window::SetZoom;
93 void SetZoom(USHORT Factor);
94 using Window::GetZoom;
95 USHORT GetZoom() const { return nZoom; }
97 const Point & GetFormulaDrawPos() const { return aFormulaDrawPos; }
99 void ZoomToFitInWindow();
100 using ScrollableWindow::SetTotalSize;
101 void SetTotalSize();
103 BOOL IsCursorVisible() const { return bIsCursorVisible; }
104 void ShowCursor(BOOL bShow);
105 const SmNode * SetCursorPos(USHORT nRow, USHORT nCol);
107 void ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg );
109 // for Accessibility
110 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
112 using Window::GetAccessible;
113 SmGraphicAccessible * GetAccessible_Impl() { return pAccessible; }
116 /**************************************************************************/
118 class SmGraphicController: public SfxControllerItem
120 protected:
121 SmGraphicWindow &rGraphic;
122 public:
123 SmGraphicController(SmGraphicWindow &, USHORT, SfxBindings & );
124 virtual void StateChanged(USHORT nSID,
125 SfxItemState eState,
126 const SfxPoolItem* pState);
129 /**************************************************************************/
131 class SmEditController: public SfxControllerItem
133 protected:
134 SmEditWindow &rEdit;
136 public:
137 SmEditController(SmEditWindow &, USHORT, SfxBindings & );
138 #if OSL_DEBUG_LEVEL > 1
139 virtual ~SmEditController();
140 #endif
142 virtual void StateChanged(USHORT nSID,
143 SfxItemState eState,
144 const SfxPoolItem* pState);
147 /**************************************************************************/
149 class SmCmdBoxWindow : public SfxDockingWindow
151 SmEditWindow aEdit;
152 SmEditController aController;
153 BOOL bExiting;
155 Timer aInitialFocusTimer;
157 DECL_LINK(InitialFocusTimerHdl, Timer *);
159 protected :
161 // Window
162 virtual void GetFocus();
163 virtual void Resize();
164 virtual void Paint(const Rectangle& rRect);
165 virtual void StateChanged( StateChangedType nStateChange );
167 virtual Size CalcDockingSize(SfxChildAlignment eAlign);
168 virtual SfxChildAlignment CheckAlignment(SfxChildAlignment eActual,
169 SfxChildAlignment eWish);
171 virtual void ToggleFloatingMode();
173 public:
174 SmCmdBoxWindow(SfxBindings *pBindings,
175 SfxChildWindow *pChildWindow,
176 Window *pParent);
178 virtual ~SmCmdBoxWindow ();
180 void AdjustPosition();
182 SmEditWindow *GetEditWindow() { return (&aEdit); }
183 SmViewShell *GetView();
186 /**************************************************************************/
188 class SmCmdBoxWrapper : public SfxChildWindow
190 SFX_DECL_CHILDWINDOW(SmCmdBoxWrapper);
192 protected:
193 SmCmdBoxWrapper(Window *pParentWindow,
194 USHORT nId,
195 SfxBindings *pBindings,
196 SfxChildWinInfo *pInfo);
198 #if OSL_DEBUG_LEVEL > 1
199 virtual ~SmCmdBoxWrapper();
200 #endif
202 public:
204 SmEditWindow *GetEditWindow()
206 return (((SmCmdBoxWindow *)pWindow)->GetEditWindow());
211 /**************************************************************************/
213 namespace sfx2 { class FileDialogHelper; }
214 struct SmViewShell_Impl;
216 class SmViewShell: public SfxViewShell
218 // for handling the PasteClipboardState
219 friend class SmClipboardChangeListener;
221 SmGraphicWindow aGraphic;
222 SmGraphicController aGraphicController;
223 String StatusText;
225 ::com::sun::star::uno:: Reference <
226 ::com::sun::star::lang:: XEventListener > xClipEvtLstnr;
227 SmClipboardChangeListener* pClipEvtLstnr;
228 SmViewShell_Impl* pImpl;
229 BOOL bPasteState;
231 void AddRemoveClipboardListener( BOOL bAdd );
233 DECL_LINK( DialogClosedHdl, sfx2::FileDialogHelper* );
235 protected:
237 Size GetTextLineSize(OutputDevice& rDevice,
238 const String& rLine);
239 Size GetTextSize(OutputDevice& rDevice,
240 const String& rText,
241 long MaxWidth);
242 void DrawTextLine(OutputDevice& rDevice,
243 const Point& rPosition,
244 const String& rLine);
245 void DrawText(OutputDevice& rDevice,
246 const Point& rPosition,
247 const String& rText,
248 USHORT MaxWidth);
250 virtual USHORT Print(SfxProgress &rProgress, BOOL bIsAPI, PrintDialog *pPrintDialog = 0);
251 virtual SfxPrinter *GetPrinter(BOOL bCreate = FALSE);
252 virtual USHORT SetPrinter(SfxPrinter *pNewPrinter,
253 USHORT nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false);
255 BOOL Insert( SfxMedium& rMedium );
256 BOOL InsertFrom(SfxMedium &rMedium);
258 virtual SfxTabPage *CreatePrintOptionsPage(Window *pParent,
259 const SfxItemSet &rOptions);
260 virtual void Deactivate(BOOL IsMDIActivate);
261 virtual void Activate(BOOL IsMDIActivate);
262 virtual Size GetOptimalSizePixel() const;
263 virtual void AdjustPosSizePixel(const Point &rPos, const Size &rSize);
264 virtual void InnerResizePixel(const Point &rOfs, const Size &rSize);
265 virtual void OuterResizePixel(const Point &rOfs, const Size &rSize);
266 virtual void QueryObjAreaPixel( Rectangle& rRect ) const;
267 virtual void SetZoomFactor( const Fraction &rX, const Fraction &rY );
269 public:
270 TYPEINFO();
272 SmViewShell(SfxViewFrame *pFrame, SfxViewShell *pOldSh);
273 ~SmViewShell();
275 SmDocShell * GetDoc()
277 return (SmDocShell *) GetViewFrame()->GetObjectShell();
280 SmEditWindow * GetEditWindow();
281 SmGraphicWindow & GetGraphicWindow() { return aGraphic; }
282 const SmGraphicWindow & GetGraphicWindow() const { return aGraphic; }
284 void SetStatusText(const String& Text);
286 void ShowError( const SmErrorDesc *pErrorDesc );
287 void NextError();
288 void PrevError();
290 SFX_DECL_INTERFACE(SFX_INTERFACE_SMA_START+2)
291 SFX_DECL_VIEWFACTORY(SmViewShell);
293 virtual void Execute( SfxRequest& rReq );
294 virtual void GetState(SfxItemSet &);
296 void Impl_Print( OutputDevice &rOutDev, const SmPrintSize ePrintSize,
297 Rectangle aOutRect, Point aZeroPoint );
300 #endif