LCOV - code coverage report
Current view: top level - sw/source/uibase/inc - srcedtw.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 19 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 15 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_SW_SOURCE_UIBASE_INC_SRCEDTW_HXX
      20             : #define INCLUDED_SW_SOURCE_UIBASE_INC_SRCEDTW_HXX
      21             : 
      22             : #include <vcl/window.hxx>
      23             : #include <svl/lstner.hxx>
      24             : #include <vcl/timer.hxx>
      25             : #include <vcl/idle.hxx>
      26             : 
      27             : #include <vcl/xtextedt.hxx>
      28             : #include <set>
      29             : 
      30             : namespace com { namespace sun { namespace star { namespace beans {
      31             :     class XMultiPropertySet;
      32             : } } } }
      33             : 
      34             : class ScrollBar;
      35             : class SwSrcView;
      36             : class SwSrcEditWindow;
      37             : class TextEngine;
      38             : class ExtTextView;
      39             : class DataChangedEvent;
      40             : 
      41           0 : class TextViewOutWin : public vcl::Window
      42             : {
      43             :     ExtTextView*    pTextView;
      44             : 
      45             : protected:
      46             :     virtual void    Paint( vcl::RenderContext& rRenderContext, const Rectangle& ) SAL_OVERRIDE;
      47             :     virtual void    KeyInput( const KeyEvent& rKeyEvt ) SAL_OVERRIDE;
      48             :     virtual void    MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
      49             :     virtual void    MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
      50             :     virtual void    MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
      51             :     virtual void    Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
      52             :     virtual void    DataChanged( const DataChangedEvent& ) SAL_OVERRIDE;
      53             : 
      54             : public:
      55           0 :         TextViewOutWin(vcl::Window* pParent, WinBits nBits) :
      56           0 :             Window(pParent, nBits), pTextView(0){}
      57             : 
      58           0 :     void    SetTextView( ExtTextView* pView ) {pTextView = pView;}
      59             : 
      60             : };
      61             : 
      62             : typedef std::set<sal_uInt16> SyntaxLineSet;
      63             : 
      64             : class SwSrcEditWindow : public vcl::Window, public SfxListener
      65             : {
      66             : private:
      67             :     class ChangesListener;
      68             :     friend class ChangesListener;
      69             :     ExtTextView*    pTextView;
      70             :     ExtTextEngine*  pTextEngine;
      71             : 
      72             :     VclPtr<TextViewOutWin> pOutWin;
      73             :     VclPtr<ScrollBar>      pHScrollbar,
      74             :                            pVScrollbar;
      75             : 
      76             :     SwSrcView*      pSrcView;
      77             : 
      78             :     rtl::Reference< ChangesListener > listener_;
      79             :     osl::Mutex mutex_;
      80             :     com::sun::star::uno::Reference< com::sun::star::beans::XMultiPropertySet >
      81             :         notifier_;
      82             : 
      83             :     long            nCurTextWidth;
      84             :     sal_uInt16          nStartLine;
      85             :     rtl_TextEncoding eSourceEncoding;
      86             :     bool            bReadonly;
      87             :     bool            bDoSyntaxHighlight;
      88             :     bool            bHighlighting;
      89             : 
      90             :     Idle            aSyntaxIdle;
      91             :     SyntaxLineSet   aSyntaxLineTable;
      92             : 
      93             :     void            ImpDoHighlight( const OUString& rSource, sal_uInt16 nLineOff );
      94             : 
      95             :     using OutputDevice::SetFont;
      96             :     void            SetFont();
      97             : 
      98             :     DECL_LINK_TYPED( SyntaxTimerHdl, Idle *, void );
      99             :     DECL_LINK( TimeoutHdl, Timer * );
     100             : 
     101             :     using Window::Notify;
     102             :     using Window::Invalidate;
     103             : 
     104             : protected:
     105             : 
     106             :     virtual void    Resize() SAL_OVERRIDE;
     107             :     virtual void    DataChanged( const DataChangedEvent& ) SAL_OVERRIDE;
     108             :     virtual void    GetFocus() SAL_OVERRIDE;
     109             : //  virtual void    LoseFocus();
     110             : 
     111             :     void            CreateTextEngine();
     112             :     void            DoSyntaxHighlight( sal_uInt16 nPara );
     113             : 
     114             :     virtual void    Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
     115             : 
     116             :     DECL_LINK(ScrollHdl, ScrollBar*);
     117             : 
     118             : public:
     119             :                     SwSrcEditWindow( vcl::Window* pParent, SwSrcView* pParentView );
     120             :                     virtual ~SwSrcEditWindow();
     121             :     virtual void    dispose() SAL_OVERRIDE;
     122             : 
     123             :     void            SetScrollBarRanges();
     124             :     void            InitScrollBars();
     125           0 :     void            Read(SvStream& rInput) { pTextEngine->Read(rInput); }
     126           0 :     void            Write(SvStream& rOutput) { pTextEngine->Write(rOutput); }
     127             : 
     128           0 :     ExtTextView*    GetTextView()
     129           0 :                         {return pTextView;}
     130           0 :     TextEngine*     GetTextEngine()
     131           0 :                         {return pTextEngine;}
     132           0 :     SwSrcView*      GetSrcView() {return pSrcView;}
     133             : 
     134           0 :     TextViewOutWin* GetOutWin() {return pOutWin;}
     135             : 
     136             :     virtual void    Invalidate( InvalidateFlags nFlags = InvalidateFlags::NONE ) SAL_OVERRIDE;
     137             : 
     138           0 :     void            ClearModifyFlag()
     139           0 :                         { pTextEngine->SetModified(false); }
     140           0 :     bool            IsModified() const
     141           0 :                         { return pTextEngine->IsModified();}
     142             :     void            CreateScrollbars();
     143             : 
     144           0 :     void            SetReadonly(bool bSet){bReadonly = bSet;}
     145           0 :     bool            IsReadonly(){return bReadonly;}
     146             : 
     147             :     void            DoDelayedSyntaxHighlight( sal_uInt16 nPara );
     148             : 
     149           0 :     void            SetStartLine(sal_uInt16 nLine){nStartLine = nLine;}
     150             : 
     151             :     virtual void    Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
     152             :     void            HandleWheelCommand( const CommandEvent& rCEvt );
     153             : 
     154             :     void            SetTextEncoding(rtl_TextEncoding eEncoding);
     155             : };
     156             : 
     157             : #endif
     158             : 
     159             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11