2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2011-03-31 10:05:04 +02:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2014-06-03 10:01:18 +02:00
|
|
|
#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_SRCEDTW_HXX
|
|
|
|
#define INCLUDED_SW_SOURCE_UIBASE_INC_SRCEDTW_HXX
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
#include <vcl/window.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/lstner.hxx>
|
2000-09-18 16:15:01 +00:00
|
|
|
#include <vcl/timer.hxx>
|
2015-01-14 13:11:28 +00:00
|
|
|
#include <vcl/idle.hxx>
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2012-08-06 20:52:37 +02:00
|
|
|
#include <vcl/xtextedt.hxx>
|
2012-03-11 20:50:15 +02:00
|
|
|
#include <set>
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2012-01-25 18:18:18 +01:00
|
|
|
namespace com { namespace sun { namespace star { namespace beans {
|
|
|
|
class XMultiPropertySet;
|
|
|
|
} } } }
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
class ScrollBar;
|
|
|
|
class SwSrcView;
|
|
|
|
class SwSrcEditWindow;
|
|
|
|
class TextEngine;
|
|
|
|
class ExtTextView;
|
|
|
|
class DataChangedEvent;
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
class TextViewOutWin : public vcl::Window
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
ExtTextView* pTextView;
|
|
|
|
|
|
|
|
protected:
|
2015-04-28 11:00:54 +09:00
|
|
|
virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& ) SAL_OVERRIDE;
|
2014-03-27 18:12:18 +01:00
|
|
|
virtual void KeyInput( const KeyEvent& rKeyEvt ) SAL_OVERRIDE;
|
|
|
|
virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
|
|
|
|
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
|
|
|
|
virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
|
|
|
|
virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
|
|
|
|
virtual void DataChanged( const DataChangedEvent& ) SAL_OVERRIDE;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
public:
|
2014-09-23 11:20:40 +02:00
|
|
|
TextViewOutWin(vcl::Window* pParent, WinBits nBits) :
|
2000-09-18 16:15:01 +00:00
|
|
|
Window(pParent, nBits), pTextView(0){}
|
|
|
|
|
|
|
|
void SetTextView( ExtTextView* pView ) {pTextView = pView;}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2012-03-11 20:50:15 +02:00
|
|
|
typedef std::set<sal_uInt16> SyntaxLineSet;
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
class SwSrcEditWindow : public vcl::Window, public SfxListener
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
private:
|
2012-01-25 18:18:18 +01:00
|
|
|
class ChangesListener;
|
|
|
|
friend class ChangesListener;
|
2000-09-18 16:15:01 +00:00
|
|
|
ExtTextView* pTextView;
|
|
|
|
ExtTextEngine* pTextEngine;
|
|
|
|
|
2015-03-09 14:29:30 +02:00
|
|
|
VclPtr<TextViewOutWin> pOutWin;
|
|
|
|
VclPtr<ScrollBar> pHScrollbar,
|
|
|
|
pVScrollbar;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
SwSrcView* pSrcView;
|
2012-01-25 18:18:18 +01:00
|
|
|
|
|
|
|
rtl::Reference< ChangesListener > listener_;
|
|
|
|
osl::Mutex mutex_;
|
|
|
|
com::sun::star::uno::Reference< com::sun::star::beans::XMultiPropertySet >
|
|
|
|
notifier_;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
long nCurTextWidth;
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nStartLine;
|
2002-08-30 09:37:39 +00:00
|
|
|
rtl_TextEncoding eSourceEncoding;
|
2014-04-25 14:00:35 +02:00
|
|
|
bool bReadonly;
|
|
|
|
bool bDoSyntaxHighlight;
|
|
|
|
bool bHighlighting;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2014-11-17 09:18:52 +00:00
|
|
|
Idle aSyntaxIdle;
|
2012-03-11 20:50:15 +02:00
|
|
|
SyntaxLineSet aSyntaxLineTable;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2013-10-08 15:03:50 +02:00
|
|
|
void ImpDoHighlight( const OUString& rSource, sal_uInt16 nLineOff );
|
2007-09-27 11:09:48 +00:00
|
|
|
|
|
|
|
using OutputDevice::SetFont;
|
2002-08-30 09:37:39 +00:00
|
|
|
void SetFont();
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2015-05-05 09:59:27 +02:00
|
|
|
DECL_LINK_TYPED( SyntaxTimerHdl, Idle *, void );
|
2000-09-18 16:15:01 +00:00
|
|
|
DECL_LINK( TimeoutHdl, Timer * );
|
|
|
|
|
2007-10-22 14:23:13 +00:00
|
|
|
using Window::Notify;
|
|
|
|
using Window::Invalidate;
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
protected:
|
|
|
|
|
2014-03-27 18:12:18 +01:00
|
|
|
virtual void Resize() SAL_OVERRIDE;
|
|
|
|
virtual void DataChanged( const DataChangedEvent& ) SAL_OVERRIDE;
|
|
|
|
virtual void GetFocus() SAL_OVERRIDE;
|
2000-09-18 16:15:01 +00:00
|
|
|
// virtual void LoseFocus();
|
|
|
|
|
|
|
|
void CreateTextEngine();
|
2011-01-17 15:06:54 +01:00
|
|
|
void DoSyntaxHighlight( sal_uInt16 nPara );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2014-03-27 18:12:18 +01:00
|
|
|
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
DECL_LINK(ScrollHdl, ScrollBar*);
|
|
|
|
|
|
|
|
public:
|
2014-09-23 11:20:40 +02:00
|
|
|
SwSrcEditWindow( vcl::Window* pParent, SwSrcView* pParentView );
|
2014-04-01 19:18:35 +02:00
|
|
|
virtual ~SwSrcEditWindow();
|
2015-01-26 13:23:37 +02:00
|
|
|
virtual void dispose() SAL_OVERRIDE;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
void SetScrollBarRanges();
|
|
|
|
void InitScrollBars();
|
2014-02-27 12:42:18 +01:00
|
|
|
void Read(SvStream& rInput) { pTextEngine->Read(rInput); }
|
|
|
|
void Write(SvStream& rOutput) { pTextEngine->Write(rOutput); }
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
ExtTextView* GetTextView()
|
|
|
|
{return pTextView;}
|
|
|
|
TextEngine* GetTextEngine()
|
|
|
|
{return pTextEngine;}
|
|
|
|
SwSrcView* GetSrcView() {return pSrcView;}
|
|
|
|
|
|
|
|
TextViewOutWin* GetOutWin() {return pOutWin;}
|
2007-09-27 11:09:48 +00:00
|
|
|
|
2015-05-25 11:20:10 +02:00
|
|
|
virtual void Invalidate( InvalidateFlags nFlags = InvalidateFlags::NONE ) SAL_OVERRIDE;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
void ClearModifyFlag()
|
2014-02-21 12:53:51 +01:00
|
|
|
{ pTextEngine->SetModified(false); }
|
2014-04-25 14:00:35 +02:00
|
|
|
bool IsModified() const
|
2000-09-18 16:15:01 +00:00
|
|
|
{ return pTextEngine->IsModified();}
|
|
|
|
void CreateScrollbars();
|
|
|
|
|
2014-04-25 14:00:35 +02:00
|
|
|
void SetReadonly(bool bSet){bReadonly = bSet;}
|
|
|
|
bool IsReadonly(){return bReadonly;}
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
void DoDelayedSyntaxHighlight( sal_uInt16 nPara );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
void SetStartLine(sal_uInt16 nLine){nStartLine = nLine;}
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2014-03-27 18:12:18 +01:00
|
|
|
virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
|
2000-09-18 16:15:01 +00:00
|
|
|
void HandleWheelCommand( const CommandEvent& rCEvt );
|
2002-08-30 09:37:39 +00:00
|
|
|
|
|
|
|
void SetTextEncoding(rtl_TextEncoding eEncoding);
|
2000-09-18 16:15:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
2010-10-14 08:30:41 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|