1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmlfileview.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _XMLFILEVIEW_HXX
31 #define _XMLFILEVIEW_HXX
33 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
34 #include <svtools/lstner.hxx>
35 #include <vcl/timer.hxx>
37 #ifndef _TABLE_HXX //autogen
38 #include <tools/table.hxx>
40 #include <svtools/xtextedt.hxx>
41 #include <vcl/timer.hxx>
42 #ifndef _TABLE_HXX //autogen
43 #include <tools/table.hxx>
45 #include <vcl/wrkwin.hxx>
46 #include <vcl/ctrl.hxx>
47 #ifndef _SV_BUTTON_HXX
48 #include <vcl/button.hxx>
50 #include <vcl/lstbox.hxx>
56 class DataChangedEvent
;
57 class filter_info_impl
;
59 class TextViewOutWin
: public Window
64 virtual void Paint( const Rectangle
& );
65 virtual void KeyInput( const KeyEvent
& rKeyEvt
);
66 virtual void MouseMove( const MouseEvent
& rMEvt
);
67 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
68 virtual void MouseButtonUp( const MouseEvent
& rMEvt
);
69 virtual void Command( const CommandEvent
& rCEvt
);
70 virtual void DataChanged( const DataChangedEvent
& );
73 TextViewOutWin(Window
* pParent
, WinBits nBits
) :
74 Window(pParent
, nBits
), pTextView(0){}
76 void SetTextView( TextView
* pView
) {pTextView
= pView
;}
80 //------------------------------------------------------------
82 class XMLFileWindow
: public Window
, public SfxListener
88 TextEngine
* pTextEngine
;
90 TextViewOutWin
* pOutWin
;
91 ScrollBar
*pHScrollbar
,
96 rtl_TextEncoding eSourceEncoding
;
98 Timer aSyntaxIdleTimer
;
99 Table aSyntaxLineTable
;
103 DECL_LINK( SyntaxTimerHdl
, Timer
* );
104 void ImpDoHighlight( const String
& rSource
, USHORT nLineOff
);
106 virtual void Resize();
107 virtual void DataChanged( const DataChangedEvent
& );
108 virtual void GetFocus();
110 void CreateTextEngine();
112 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
114 DECL_LINK(ScrollHdl
, ScrollBar
*);
116 void DoDelayedSyntaxHighlight( USHORT nPara
);
118 void DoSyntaxHighlight( USHORT nPara
);
121 XMLFileWindow( Window
* pParent
);
124 void SetScrollBarRanges();
125 void InitScrollBars();
126 ULONG
Read( SvStream
& rInput
) { return pTextEngine
->Read(rInput
); }
128 void ShowWindow( const rtl::OUString
& rFileName
);
130 TextView
* GetTextView() { return pTextView
; }
131 TextEngine
* GetTextEngine() { return pTextEngine
; }
133 TextViewOutWin
* GetOutWin() { return pOutWin
; }
134 void InvalidateWindow();
136 void CreateScrollbars();
138 void SetStartLine(USHORT nLine
) {nStartLine
= nLine
;}
140 virtual void Command( const CommandEvent
& rCEvt
);
141 void HandleWheelCommand( const CommandEvent
& rCEvt
);
143 TextView
* getTextView() { return pTextView
; }
145 void showLine( sal_Int32 nLine
);
148 class XMLSourceFileDialog
: public WorkWindow
152 XMLSourceFileDialog( Window
* pParent
, ResMgr
& rResMgr
, const com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
>& rxMSF
);
153 virtual ~XMLSourceFileDialog();
155 void ShowWindow( const rtl::OUString
& rFileName
, const filter_info_impl
* pFilterInfo
);
157 virtual void Resize();
159 DECL_LINK(ClickHdl_Impl
, PushButton
* );
160 DECL_LINK(SelectHdl_Impl
, ListBox
* );
162 void showLine( sal_Int32 nLine
);
164 sal_Int32 mnOutputHeight
;
168 const filter_info_impl
* mpFilterInfo
;
169 rtl::OUString maFileURL
;
171 com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
> mxMSF
;
174 XMLFileWindow
* mpTextWindow
;
176 // Control maCtrlSourceView;
177 PushButton maPBValidate
;