LCOV - code coverage report
Current view: top level - starmath/inc - view.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 23 0.0 %
Date: 2014-04-14 Functions: 0 22 0.0 %
Legend: Lines: hit not hit

          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_STARMATH_INC_VIEW_HXX
      20             : #define INCLUDED_STARMATH_INC_VIEW_HXX
      21             : 
      22             : #include <sfx2/dockwin.hxx>
      23             : #include <sfx2/viewsh.hxx>
      24             : #include <svtools/scrwin.hxx>
      25             : #include <sfx2/ctrlitem.hxx>
      26             : #include <sfx2/shell.hxx>
      27             : #include <sfx2/viewfac.hxx>
      28             : #include <sfx2/viewfrm.hxx>
      29             : #include <vcl/timer.hxx>
      30             : #include <svtools/colorcfg.hxx>
      31             : #include "edit.hxx"
      32             : #include "node.hxx"
      33             : 
      34             : class Menu;
      35             : class DataChangedEvent;
      36             : class SmClipboardChangeListener;
      37             : class SmDocShell;
      38             : class SmViewShell;
      39             : class SmPrintUIOptions;
      40             : class SmGraphicAccessible;
      41             : 
      42             : /**************************************************************************/
      43             : 
      44             : class SmGraphicWindow : public ScrollableWindow
      45             : {
      46             :     Point     aFormulaDrawPos;
      47             : 
      48             :     // old style editing pieces
      49             :     Rectangle aCursorRect;
      50             :     bool      bIsCursorVisible;
      51             :     bool      bIsLineVisible;
      52             :     AutoTimer aCaretBlinkTimer;
      53             : public:
      54           0 :     bool IsCursorVisible() const { return bIsCursorVisible; }
      55             :     void ShowCursor(bool bShow);
      56           0 :     bool IsLineVisible() const { return bIsLineVisible; }
      57             :     void ShowLine(bool bShow);
      58             :     const SmNode * SetCursorPos(sal_uInt16 nRow, sal_uInt16 nCol);
      59             : protected:
      60           0 :     void        SetIsCursorVisible(bool bVis) { bIsCursorVisible = bVis; }
      61             :     using   Window::SetCursor;
      62             :     void        SetCursor(const SmNode *pNode);
      63             :     void        SetCursor(const Rectangle &rRect);
      64             :     bool        IsInlineEditEnabled() const;
      65             : 
      66             : private:
      67             :     ::com::sun::star::uno::Reference<
      68             :         ::com::sun::star::accessibility::XAccessible >  xAccessible;
      69             :     SmGraphicAccessible *                                       pAccessible;
      70             : 
      71             :     SmViewShell    *pViewShell;
      72             :     sal_uInt16          nZoom;
      73             : 
      74             : protected:
      75           0 :     void        SetFormulaDrawPos(const Point &rPos) { aFormulaDrawPos = rPos; }
      76             : 
      77             :     virtual void DataChanged( const DataChangedEvent& ) SAL_OVERRIDE;
      78             :     virtual void Paint(const Rectangle&) SAL_OVERRIDE;
      79             :     virtual void KeyInput(const KeyEvent& rKEvt) SAL_OVERRIDE;
      80             :     virtual void Command(const CommandEvent& rCEvt) SAL_OVERRIDE;
      81             :     virtual void StateChanged( StateChangedType eChanged ) SAL_OVERRIDE;
      82             :     DECL_LINK(MenuSelectHdl, Menu *);
      83             : 
      84             : private:
      85             :     void RepaintViewShellDoc();
      86             :     DECL_LINK(CaretBlinkTimerHdl, void *);
      87             :     void CaretBlinkInit();
      88             :     void CaretBlinkStart();
      89             :     void CaretBlinkStop();
      90             : public:
      91             :     SmGraphicWindow(SmViewShell* pShell);
      92             :     virtual ~SmGraphicWindow();
      93             : 
      94             :     // Window
      95             :     virtual void    MouseButtonDown(const MouseEvent &rMEvt) SAL_OVERRIDE;
      96             :     virtual void    MouseMove(const MouseEvent &rMEvt) SAL_OVERRIDE;
      97             :     virtual void    GetFocus() SAL_OVERRIDE;
      98             :     virtual void    LoseFocus() SAL_OVERRIDE;
      99             : 
     100           0 :     SmViewShell *   GetView()   { return pViewShell; }
     101             : 
     102             :     using   Window::SetZoom;
     103             :     void   SetZoom(sal_uInt16 Factor);
     104             :     using   Window::GetZoom;
     105           0 :     sal_uInt16 GetZoom() const { return nZoom; }
     106             : 
     107           0 :     const Point &   GetFormulaDrawPos() const { return aFormulaDrawPos; }
     108             : 
     109             :     void ZoomToFitInWindow();
     110             :     using   ScrollableWindow::SetTotalSize;
     111             :     void SetTotalSize();
     112             : 
     113             :     void ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg );
     114             : 
     115             :     // for Accessibility
     116             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
     117             : 
     118             :     using   Window::GetAccessible;
     119           0 :     SmGraphicAccessible *   GetAccessible_Impl()  { return pAccessible; }
     120             : };
     121             : 
     122             : /**************************************************************************/
     123             : 
     124           0 : class SmGraphicController: public SfxControllerItem
     125             : {
     126             : protected:
     127             :     SmGraphicWindow &rGraphic;
     128             : public:
     129             :     SmGraphicController(SmGraphicWindow &, sal_uInt16, SfxBindings & );
     130             :     virtual void StateChanged(sal_uInt16             nSID,
     131             :                               SfxItemState       eState,
     132             :                               const SfxPoolItem* pState) SAL_OVERRIDE;
     133             : };
     134             : 
     135             : /**************************************************************************/
     136             : 
     137           0 : class SmEditController: public SfxControllerItem
     138             : {
     139             : protected:
     140             :     SmEditWindow &rEdit;
     141             : 
     142             : public:
     143             :     SmEditController(SmEditWindow &, sal_uInt16, SfxBindings  & );
     144             : #if OSL_DEBUG_LEVEL > 1
     145             :     virtual ~SmEditController();
     146             : #endif
     147             : 
     148             :     virtual void StateChanged(sal_uInt16             nSID,
     149             :                               SfxItemState       eState,
     150             :                               const SfxPoolItem* pState) SAL_OVERRIDE;
     151             : };
     152             : 
     153             : /**************************************************************************/
     154             : 
     155             : class SmCmdBoxWindow : public SfxDockingWindow
     156             : {
     157             :     SmEditWindow        aEdit;
     158             :     SmEditController    aController;
     159             :     bool                bExiting;
     160             : 
     161             :     Timer               aInitialFocusTimer;
     162             : 
     163             :     DECL_LINK(InitialFocusTimerHdl, Timer *);
     164             : 
     165             : protected :
     166             : 
     167             :     // Window
     168             :     virtual void    GetFocus() SAL_OVERRIDE;
     169             :     virtual void Resize() SAL_OVERRIDE;
     170             :     virtual void Paint(const Rectangle& rRect) SAL_OVERRIDE;
     171             :     virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
     172             : 
     173             :     virtual Size CalcDockingSize(SfxChildAlignment eAlign) SAL_OVERRIDE;
     174             :     virtual SfxChildAlignment CheckAlignment(SfxChildAlignment eActual,
     175             :                                              SfxChildAlignment eWish) SAL_OVERRIDE;
     176             : 
     177             :     virtual void    ToggleFloatingMode() SAL_OVERRIDE;
     178             : 
     179             : public:
     180             :     SmCmdBoxWindow(SfxBindings    *pBindings,
     181             :                    SfxChildWindow *pChildWindow,
     182             :                    Window         *pParent);
     183             : 
     184             :     virtual ~SmCmdBoxWindow ();
     185             : 
     186             :     void AdjustPosition();
     187             : 
     188           0 :     SmEditWindow *GetEditWindow() { return (&aEdit); }
     189             :     SmViewShell  *GetView();
     190             : };
     191             : 
     192             : /**************************************************************************/
     193             : 
     194           0 : class SmCmdBoxWrapper : public SfxChildWindow
     195             : {
     196             :     SFX_DECL_CHILDWINDOW_WITHID(SmCmdBoxWrapper);
     197             : 
     198             : protected:
     199             :     SmCmdBoxWrapper(Window          *pParentWindow,
     200             :                     sal_uInt16           nId,
     201             :                     SfxBindings     *pBindings,
     202             :                     SfxChildWinInfo *pInfo);
     203             : 
     204             : #if OSL_DEBUG_LEVEL > 1
     205             :     virtual ~SmCmdBoxWrapper();
     206             : #endif
     207             : 
     208             : public:
     209             : 
     210           0 :     SmEditWindow *GetEditWindow()
     211             :     {
     212           0 :         return (((SmCmdBoxWindow *)pWindow)->GetEditWindow());
     213             :     }
     214             : 
     215             : };
     216             : 
     217             : /**************************************************************************/
     218             : 
     219             : namespace sfx2 { class FileDialogHelper; }
     220             : struct SmViewShell_Impl;
     221             : 
     222             : class SmViewShell: public SfxViewShell
     223             : {
     224             :     // for handling the PasteClipboardState
     225             :     friend class SmClipboardChangeListener;
     226             : 
     227             :     SmViewShell_Impl*   pImpl;
     228             : 
     229             :     SmGraphicWindow     aGraphic;
     230             :     SmGraphicController aGraphicController;
     231             :     OUString            aStatusText;
     232             : 
     233             :     bool                bPasteState;
     234             : 
     235             :     DECL_LINK( DialogClosedHdl, sfx2::FileDialogHelper* );
     236             :     virtual void            Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
     237             : 
     238             :     /** Used to determine whether insertions using SID_INSERTSYMBOL and SID_INSERTCOMMAND
     239             :      * should be inserted into SmEditWindow or directly into the SmDocShell as done if the
     240             :      * visual editor was last to have focus.
     241             :      */
     242             :     bool bInsertIntoEditWindow;
     243             : protected:
     244             : 
     245             :     Size GetTextLineSize(OutputDevice& rDevice,
     246             :                          const OUString& rLine);
     247             :     Size GetTextSize(OutputDevice& rDevice,
     248             :                      const OUString& rText,
     249             :                      long          MaxWidth);
     250             :     void DrawTextLine(OutputDevice& rDevice,
     251             :                       const Point&  rPosition,
     252             :                       const OUString& rLine);
     253             :     void DrawText(OutputDevice& rDevice,
     254             :                   const Point&  rPosition,
     255             :                   const OUString& rText,
     256             :                   sal_uInt16        MaxWidth);
     257             : 
     258             :     virtual sal_uInt16 Print(SfxProgress &rProgress, sal_Bool bIsAPI);
     259             :     virtual SfxPrinter *GetPrinter(bool bCreate = false) SAL_OVERRIDE;
     260             :     virtual sal_uInt16 SetPrinter(SfxPrinter *pNewPrinter,
     261             :                               sal_uInt16     nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false) SAL_OVERRIDE;
     262             : 
     263             :     void Insert( SfxMedium& rMedium );
     264             :     void InsertFrom(SfxMedium &rMedium);
     265             : 
     266             :     virtual bool HasPrintOptionsPage() const SAL_OVERRIDE;
     267             :     virtual SfxTabPage *CreatePrintOptionsPage(Window           *pParent,
     268             :                                                const SfxItemSet &rOptions) SAL_OVERRIDE;
     269             :     virtual void Deactivate(bool IsMDIActivate) SAL_OVERRIDE;
     270             :     virtual void Activate(bool IsMDIActivate) SAL_OVERRIDE;
     271             :     virtual void AdjustPosSizePixel(const Point &rPos, const Size &rSize) SAL_OVERRIDE;
     272             :     virtual void InnerResizePixel(const Point &rOfs, const Size  &rSize) SAL_OVERRIDE;
     273             :     virtual void OuterResizePixel(const Point &rOfs, const Size  &rSize) SAL_OVERRIDE;
     274             :     virtual void QueryObjAreaPixel( Rectangle& rRect ) const SAL_OVERRIDE;
     275             :     virtual void SetZoomFactor( const Fraction &rX, const Fraction &rY ) SAL_OVERRIDE;
     276             : 
     277             : public:
     278             :     TYPEINFO_OVERRIDE();
     279             : 
     280             :     SmViewShell(SfxViewFrame *pFrame, SfxViewShell *pOldSh);
     281             :     virtual ~SmViewShell();
     282             : 
     283           0 :     SmDocShell * GetDoc()
     284             :     {
     285           0 :         return (SmDocShell *) GetViewFrame()->GetObjectShell();
     286             :     }
     287             : 
     288             :     SmEditWindow * GetEditWindow();
     289           0 :           SmGraphicWindow & GetGraphicWindow()       { return aGraphic; }
     290           0 :     const SmGraphicWindow & GetGraphicWindow() const { return aGraphic; }
     291             : 
     292             :     void        SetStatusText(const OUString& rText);
     293             : 
     294             :     void        ShowError( const SmErrorDesc *pErrorDesc );
     295             :     void        NextError();
     296             :     void        PrevError();
     297             : 
     298           0 :     SFX_DECL_INTERFACE(SFX_INTERFACE_SMA_START+2)
     299           0 :     SFX_DECL_VIEWFACTORY(SmViewShell);
     300             : 
     301             :     virtual void Execute( SfxRequest& rReq );
     302             :     virtual void GetState(SfxItemSet &);
     303             : 
     304             :     void Impl_Print( OutputDevice &rOutDev, const SmPrintUIOptions &rPrintUIOptions,
     305             :             Rectangle aOutRect, Point aZeroPoint );
     306             : 
     307             :     /** Set bInsertIntoEditWindow so we know where to insert
     308             :      *
     309             :      * This method is called whenever SmGraphicWindow or SmEditWindow gets focus,
     310             :      * so that when text is inserted from catalog or elsewhere we know whether to
     311             :      * insert for the visual editor, or the text editor.
     312             :      */
     313           0 :     void SetInsertIntoEditWindow(bool bEditWindowHadFocusLast = true){
     314           0 :         bInsertIntoEditWindow = bEditWindowHadFocusLast;
     315           0 :     }
     316             :     bool IsInlineEditEnabled() const;
     317             : };
     318             : 
     319             : #endif
     320             : 
     321             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10