/Users/ericb/Desktop/SRC680_m247/starmath/inc/view.hxx

Go to the documentation of this file.
00001 /*************************************************************************
00002  *
00003  *  OpenOffice.org - a multi-platform office productivity suite
00004  *
00005  *  $RCSfile: view.hxx,v $
00006  *
00007  *  $Revision: 1.22 $
00008  *
00009  *  last change: $Author: obo $ $Date: 2007/07/17 13:23:11 $
00010  *
00011  *  The Contents of this file are made available subject to
00012  *  the terms of GNU Lesser General Public License Version 2.1.
00013  *
00014  *
00015  *    GNU Lesser General Public License Version 2.1
00016  *    =============================================
00017  *    Copyright 2005 by Sun Microsystems, Inc.
00018  *    901 San Antonio Road, Palo Alto, CA 94303, USA
00019  *
00020  *    This library is free software; you can redistribute it and/or
00021  *    modify it under the terms of the GNU Lesser General Public
00022  *    License version 2.1, as published by the Free Software Foundation.
00023  *
00024  *    This library is distributed in the hope that it will be useful,
00025  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00026  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00027  *    Lesser General Public License for more details.
00028  *
00029  *    You should have received a copy of the GNU Lesser General Public
00030  *    License along with this library; if not, write to the Free Software
00031  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00032  *    MA  02111-1307  USA
00033  *
00034  ************************************************************************/
00035 #ifndef VIEW_HXX
00036 #define VIEW_HXX
00037 
00038 #ifndef _SFXDOCKWIN_HXX //autogen
00039 #include <sfx2/dockwin.hxx>
00040 #endif
00041 #ifndef _SFXVIEWSH_HXX //autogen
00042 #include <sfx2/viewsh.hxx>
00043 #endif
00044 #ifndef _SCRWIN_HXX //autogen
00045 #include <svtools/scrwin.hxx>
00046 #endif
00047 #ifndef _SFXCTRLITEM_HXX //autogen
00048 #include <sfx2/ctrlitem.hxx>
00049 #endif
00050 #ifndef _SFX_SHELL_HXX //autogen
00051 #include <sfx2/shell.hxx>
00052 #endif
00053 #ifndef _VIEWFAC_HXX //autogen
00054 #include <sfx2/viewfac.hxx>
00055 #endif
00056 #ifndef _SFXVIEWFRM_HXX //autogen
00057 #include <sfx2/viewfrm.hxx>
00058 #endif
00059 #ifndef INCLUDED_SVTOOLS_COLORCFG_HXX
00060 #include <svtools/colorcfg.hxx>
00061 #endif
00062 
00063 #ifndef EDIT_HXX
00064 #include "edit.hxx"
00065 #endif
00066 #ifndef NODE_HXX
00067 #include "node.hxx"
00068 #endif
00069 #ifndef _ACCESSIBILITY_HXX_
00070 #include "accessibility.hxx"
00071 #endif
00072 
00073 class Menu;
00074 class DataChangedEvent;
00075 class SmClipboardChangeListener;
00076 class SmDocShell;
00077 class SmViewShell;
00078 
00079 /**************************************************************************/
00080 
00081 class SmGraphicWindow : public ScrollableWindow
00082 {
00083         Point                   aFormulaDrawPos;
00084         Rectangle               aCursorRect;
00085 
00086     ::com::sun::star::uno::Reference<
00087         ::com::sun::star::accessibility::XAccessible >  xAccessible;
00088     SmGraphicAccessible *                                       pAccessible;
00089 
00090     SmViewShell    *pViewShell;
00091         USHORT                  nZoom;
00092         short                   nModifyCount;
00093         BOOL                    bIsCursorVisible;
00094 
00095 protected:
00096         void            SetFormulaDrawPos(const Point &rPos) { aFormulaDrawPos = rPos; }
00097         void            SetIsCursorVisible(BOOL bVis) { bIsCursorVisible = bVis; }
00098     using   Window::SetCursor;
00099     void        SetCursor(const SmNode *pNode);
00100         void            SetCursor(const Rectangle &rRect);
00101 
00102         virtual void DataChanged( const DataChangedEvent& );
00103         virtual void Paint(const Rectangle&);
00104         virtual void KeyInput(const KeyEvent& rKEvt);
00105         virtual void Command(const CommandEvent& rCEvt);
00106         virtual void StateChanged( StateChangedType eChanged );
00107         DECL_LINK(MenuSelectHdl, Menu *);
00108 
00109 public:
00110         SmGraphicWindow(SmViewShell* pShell);
00111     ~SmGraphicWindow();
00112 
00113     // Window
00114     virtual void    MouseButtonDown(const MouseEvent &rMEvt);
00115     virtual void    GetFocus();
00116     virtual void    LoseFocus();
00117 
00118     SmViewShell *   GetView()   { return pViewShell; }
00119 
00120     using   Window::SetZoom;
00121         void   SetZoom(USHORT Factor);
00122     using   Window::GetZoom;
00123         USHORT GetZoom() const { return nZoom; }
00124 
00125     const Point &   GetFormulaDrawPos() const { return aFormulaDrawPos; }
00126 
00127     void ZoomToFitInWindow();
00128     using   ScrollableWindow::SetTotalSize;
00129         void SetTotalSize();
00130 
00131         BOOL IsCursorVisible() const { return bIsCursorVisible; }
00132         void ShowCursor(BOOL bShow);
00133         const SmNode * SetCursorPos(USHORT nRow, USHORT nCol);
00134 
00135     void ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg );
00136 
00137     // for Accessibility
00138     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
00139 
00140     using   Window::GetAccessible;
00141     SmGraphicAccessible *   GetAccessible_Impl()  { return pAccessible; }
00142 };
00143 
00144 /**************************************************************************/
00145 
00146 class SmGraphicController: public SfxControllerItem
00147 {
00148 protected:
00149         SmGraphicWindow &rGraphic;
00150 public:
00151         SmGraphicController(SmGraphicWindow &, USHORT, SfxBindings & );
00152         virtual void StateChanged(USHORT                         nSID,
00153                                                           SfxItemState           eState,
00154                                                           const SfxPoolItem* pState);
00155 };
00156 
00157 /**************************************************************************/
00158 
00159 class SmEditController: public SfxControllerItem
00160 {
00161 protected:
00162         SmEditWindow &rEdit;
00163 
00164 public:
00165         SmEditController(SmEditWindow &, USHORT, SfxBindings  & );
00166 #if OSL_DEBUG_LEVEL > 1
00167     virtual ~SmEditController();
00168 #endif
00169 
00170         virtual void StateChanged(USHORT                         nSID,
00171                                                           SfxItemState           eState,
00172                                                           const SfxPoolItem* pState);
00173 };
00174 
00175 /**************************************************************************/
00176 
00177 class SmCmdBoxWindow : public SfxDockingWindow
00178 {
00179         SmEditWindow            aEdit;
00180         SmEditController        aController;
00181     BOOL                bExiting;
00182 
00183 protected :
00184 
00185     // Window
00186     virtual void    GetFocus();
00187         virtual void Resize();
00188         virtual void Paint(const Rectangle& rRect);
00189     virtual void StateChanged( StateChangedType nStateChange );
00190 
00191     virtual Size CalcDockingSize(SfxChildAlignment eAlign);
00192         virtual SfxChildAlignment CheckAlignment(SfxChildAlignment eActual,
00193                                                                                          SfxChildAlignment eWish);
00194 
00195         virtual void    ToggleFloatingMode();
00196 
00197 public:
00198         SmCmdBoxWindow(SfxBindings        *pBindings,
00199                                    SfxChildWindow *pChildWindow,
00200                                    Window                 *pParent);
00201 
00202         virtual ~SmCmdBoxWindow ();
00203 
00204         void AdjustPosition();
00205 
00206         SmEditWindow *GetEditWindow() { return (&aEdit); }
00207     SmViewShell  *GetView();
00208 };
00209 
00210 /**************************************************************************/
00211 
00212 class SmCmdBoxWrapper : public SfxChildWindow
00213 {
00214         SFX_DECL_CHILDWINDOW(SmCmdBoxWrapper);
00215 
00216 protected:
00217         SmCmdBoxWrapper(Window                  *pParentWindow,
00218                                         USHORT                   nId,
00219                                         SfxBindings     *pBindings,
00220                                         SfxChildWinInfo *pInfo);
00221 
00222 #if OSL_DEBUG_LEVEL > 1
00223     virtual ~SmCmdBoxWrapper();
00224 #endif
00225 
00226 public:
00227 
00228         SmEditWindow *GetEditWindow()
00229         {
00230                 return (((SmCmdBoxWindow *)pWindow)->GetEditWindow());
00231         }
00232 
00233 };
00234 
00235 /**************************************************************************/
00236 
00237 namespace sfx2 { class FileDialogHelper; }
00238 struct SmViewShell_Impl;
00239 
00240 class SmViewShell: public SfxViewShell
00241 {
00242         // for handling the PasteClipboardState
00243         friend class SmClipboardChangeListener;
00244 
00245         SmGraphicWindow         aGraphic;
00246         SmGraphicController aGraphicController;
00247         String                          StatusText;
00248 
00249         ::com::sun::star::uno:: Reference <
00250                         ::com::sun::star::lang:: XEventListener > xClipEvtLstnr;
00251         SmClipboardChangeListener*      pClipEvtLstnr;
00252     SmViewShell_Impl*   pImpl;
00253         BOOL                            bPasteState;
00254 
00255         void AddRemoveClipboardListener( BOOL bAdd );
00256 
00257     DECL_LINK( DialogClosedHdl, sfx2::FileDialogHelper* );
00258 
00259 protected:
00260 
00261         Size GetTextLineSize(OutputDevice& rDevice,
00262                                                  const String& rLine);
00263         Size GetTextSize(OutputDevice& rDevice,
00264                                          const String& rText,
00265                                          long              MaxWidth);
00266         void DrawTextLine(OutputDevice& rDevice,
00267                                           const Point&  rPosition,
00268                                           const String& rLine);
00269         void DrawText(OutputDevice& rDevice,
00270                                   const Point&  rPosition,
00271                                   const String& rText,
00272                                   USHORT                MaxWidth);
00273 
00274     virtual USHORT Print(SfxProgress &rProgress, BOOL bIsAPI, PrintDialog *pPrintDialog = 0);
00275         virtual SfxPrinter *GetPrinter(BOOL bCreate = FALSE);
00276         virtual USHORT SetPrinter(SfxPrinter *pNewPrinter,
00277                               USHORT     nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false);
00278 
00279     BOOL        Insert( SfxMedium& rMedium );
00280     BOOL        InsertFrom(SfxMedium &rMedium);
00281 
00282         virtual SfxTabPage *CreatePrintOptionsPage(Window                       *pParent,
00283                                                                                            const SfxItemSet &rOptions);
00284         virtual void Deactivate(BOOL IsMDIActivate);
00285         virtual void Activate(BOOL IsMDIActivate);
00286         virtual Size GetOptimalSizePixel() const;
00287         virtual void AdjustPosSizePixel(const Point &rPos, const Size &rSize);
00288         virtual void InnerResizePixel(const Point &rOfs, const Size  &rSize);
00289         virtual void OuterResizePixel(const Point &rOfs, const Size  &rSize);
00290         virtual void QueryObjAreaPixel( Rectangle& rRect ) const;
00291         virtual void SetZoomFactor( const Fraction &rX, const Fraction &rY );
00292 
00293 public:
00294         TYPEINFO();
00295 
00296     SmViewShell(SfxViewFrame *pFrame, SfxViewShell *pOldSh);
00297         ~SmViewShell();
00298 
00299         SmDocShell * GetDoc()
00300         {
00301                 return (SmDocShell *) GetViewFrame()->GetObjectShell();
00302         }
00303 
00304         SmEditWindow * GetEditWindow();
00305                   SmGraphicWindow & GetGraphicWindow()           { return aGraphic; }
00306         const SmGraphicWindow & GetGraphicWindow() const { return aGraphic; }
00307 
00308         void            SetStatusText(const String& Text);
00309 
00310         void            ShowError( const SmErrorDesc *pErrorDesc );
00311         void            NextError();
00312         void            PrevError();
00313 
00314     SFX_DECL_INTERFACE(SFX_INTERFACE_SMA_START+2)
00315     SFX_DECL_VIEWFACTORY(SmViewShell);
00316 
00317         virtual void Execute( SfxRequest& rReq );
00318         virtual void GetState(SfxItemSet &);
00319 
00320     void Impl_Print( OutputDevice &rOutDev, const SmPrintSize ePrintSize,
00321                      Rectangle aOutRect, Point aZeroPoint );
00322 };
00323 
00324 #endif
00325 

Generated on Wed Feb 20 17:21:56 2008 for maths by  doxygen 1.5.1