merged tag LIBREOFFICE_3_2_99_3
[LibreOffice.git] / filter / source / xsltdialog / xmlfileview.hxx
blob587d523e4fdf69ff51ad2577dae139956e81171d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
28 #ifndef _XMLFILEVIEW_HXX
29 #define _XMLFILEVIEW_HXX
31 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
32 #include <svl/lstner.hxx>
33 #include <vcl/timer.hxx>
35 #include <tools/table.hxx>
36 #include <svtools/xtextedt.hxx>
37 #include <vcl/timer.hxx>
38 #include <tools/table.hxx>
39 #include <vcl/wrkwin.hxx>
40 #include <vcl/ctrl.hxx>
41 #include <vcl/button.hxx>
42 #include <vcl/lstbox.hxx>
44 class ScrollBar;
45 class XMLFileWindow;
46 class TextEngine;
47 class TextView;
48 class DataChangedEvent;
49 class filter_info_impl;
51 class TextViewOutWin : public Window
53 TextView* pTextView;
55 protected:
56 virtual void Paint( const Rectangle& );
57 virtual void KeyInput( const KeyEvent& rKeyEvt );
58 virtual void MouseMove( const MouseEvent& rMEvt );
59 virtual void MouseButtonDown( const MouseEvent& rMEvt );
60 virtual void MouseButtonUp( const MouseEvent& rMEvt );
61 virtual void Command( const CommandEvent& rCEvt );
62 virtual void DataChanged( const DataChangedEvent& );
64 public:
65 TextViewOutWin(Window* pParent, WinBits nBits) :
66 Window(pParent, nBits), pTextView(0){}
68 void SetTextView( TextView* pView ) {pTextView = pView;}
72 //------------------------------------------------------------
74 class XMLFileWindow : public Window, public SfxListener
76 using Window::Notify;
78 private:
79 TextView* pTextView;
80 TextEngine* pTextEngine;
82 TextViewOutWin* pOutWin;
83 ScrollBar *pHScrollbar,
84 *pVScrollbar;
86 long nCurTextWidth;
87 USHORT nStartLine;
88 rtl_TextEncoding eSourceEncoding;
90 Timer aSyntaxIdleTimer;
91 Table aSyntaxLineTable;
93 bool bHighlighting;
94 protected:
95 DECL_LINK( SyntaxTimerHdl, Timer * );
96 void ImpDoHighlight( const String& rSource, USHORT nLineOff );
98 virtual void Resize();
99 virtual void DataChanged( const DataChangedEvent& );
100 virtual void GetFocus();
102 void CreateTextEngine();
104 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
106 DECL_LINK(ScrollHdl, ScrollBar*);
108 void DoDelayedSyntaxHighlight( USHORT nPara );
110 void DoSyntaxHighlight( USHORT nPara );
112 public:
113 XMLFileWindow( Window* pParent );
114 ~XMLFileWindow();
116 void SetScrollBarRanges();
117 void InitScrollBars();
118 ULONG Read( SvStream& rInput) { return pTextEngine->Read(rInput); }
120 void ShowWindow( const rtl::OUString& rFileName );
122 TextView* GetTextView() { return pTextView; }
123 TextEngine* GetTextEngine() { return pTextEngine; }
125 TextViewOutWin* GetOutWin() { return pOutWin; }
126 void InvalidateWindow();
128 void CreateScrollbars();
130 void SetStartLine(USHORT nLine) {nStartLine = nLine;}
132 virtual void Command( const CommandEvent& rCEvt );
133 void HandleWheelCommand( const CommandEvent& rCEvt );
135 TextView* getTextView() { return pTextView; }
137 void showLine( sal_Int32 nLine );
140 class XMLSourceFileDialog : public WorkWindow
143 public:
144 XMLSourceFileDialog( Window* pParent, ResMgr& rResMgr, const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxMSF );
145 virtual ~XMLSourceFileDialog();
147 void ShowWindow( const rtl::OUString& rFileName, const filter_info_impl* pFilterInfo );
149 virtual void Resize();
151 DECL_LINK(ClickHdl_Impl, PushButton * );
152 DECL_LINK(SelectHdl_Impl, ListBox * );
154 void showLine( sal_Int32 nLine );
156 sal_Int32 mnOutputHeight;
157 private:
158 void onValidate();
160 const filter_info_impl* mpFilterInfo;
161 rtl::OUString maFileURL;
163 com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF;
164 ResMgr& mrResMgr;
166 XMLFileWindow* mpTextWindow;
167 ListBox maLBOutput;
168 // Control maCtrlSourceView;
169 PushButton maPBValidate;
172 #endif
174 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */