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>
48 class DataChangedEvent
;
49 class filter_info_impl
;
51 class TextViewOutWin
: public Window
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
& );
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
80 TextEngine
* pTextEngine
;
82 TextViewOutWin
* pOutWin
;
83 ScrollBar
*pHScrollbar
,
88 rtl_TextEncoding eSourceEncoding
;
90 Timer aSyntaxIdleTimer
;
91 Table aSyntaxLineTable
;
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
);
113 XMLFileWindow( Window
* pParent
);
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
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
;
160 const filter_info_impl
* mpFilterInfo
;
161 rtl::OUString maFileURL
;
163 com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
> mxMSF
;
166 XMLFileWindow
* mpTextWindow
;
168 // Control maCtrlSourceView;
169 PushButton maPBValidate
;
174 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */