Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
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.
15 : : *
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).
21 : : *
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.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
30 : : #include <com/sun/star/xml/sax/XErrorHandler.hpp>
31 : : #include <com/sun/star/xml/sax/SAXParseException.hpp>
32 : : #include <com/sun/star/xml/XImportFilter.hpp>
33 : : #include <com/sun/star/io/XActiveDataSource.hpp>
34 : : #include <comphelper/oslfile2streamwrap.hxx>
35 : :
36 : : #include <rtl/tencinfo.h>
37 : : #include <vcl/svapp.hxx>
38 : : #include <osl/mutex.hxx>
39 : : #include <vcl/textview.hxx>
40 : : #include <vcl/scrbar.hxx>
41 : : #include <tools/stream.hxx>
42 : : #include <tools/time.hxx>
43 : : #include <osl/file.hxx>
44 : : #include <vcl/msgbox.hxx>
45 : : #include <svtools/colorcfg.hxx>
46 : : #include <svtools/htmltokn.h>
47 : : #include <vcl/txtattr.hxx>
48 : :
49 : : #include "xmlfilterdialogstrings.hrc"
50 : : #include "xmlfiltersettingsdialog.hxx"
51 : : #include "xmlfileview.hxx"
52 : : #include "xmlfileview.hrc"
53 : : #include "xmlfilterhelpids.hrc"
54 : :
55 : : #include <deque>
56 : :
57 : : using namespace osl;
58 : : using namespace com::sun::star::lang;
59 : : using namespace com::sun::star::beans;
60 : : using namespace com::sun::star::uno;
61 : : using namespace com::sun::star::io;
62 : : using namespace com::sun::star::xml;
63 : : using namespace com::sun::star::xml::sax;
64 : :
65 : : using ::rtl::OUString;
66 : :
67 : :
68 : : #define MAX_SYNTAX_HIGHLIGHT 20
69 : : #define MAX_HIGHLIGHTTIME 200
70 : : #define SYNTAX_HIGHLIGHT_TIMEOUT 200
71 : :
72 : :
73 : : struct SwTextPortion
74 : : {
75 : : sal_uInt16 nLine;
76 : : sal_uInt16 nStart, nEnd;
77 : : svtools::ColorConfigEntry eType;
78 : : };
79 : :
80 : : typedef std::deque<SwTextPortion> SwTextPortions;
81 : :
82 : 0 : void TextViewOutWin::DataChanged( const DataChangedEvent& rDCEvt )
83 : : {
84 : 0 : Window::DataChanged( rDCEvt );
85 : :
86 : 0 : switch( rDCEvt.GetType() )
87 : : {
88 : : case DATACHANGED_SETTINGS:
89 : : // den Settings abgefragt werden.
90 : 0 : if( rDCEvt.GetFlags() & SETTINGS_STYLE )
91 : : {
92 : 0 : const Color &rCol = GetSettings().GetStyleSettings().GetWindowColor();
93 : 0 : SetBackground( rCol );
94 : 0 : Font aFont( pTextView->GetTextEngine()->GetFont() );
95 : 0 : aFont.SetFillColor( rCol );
96 : 0 : pTextView->GetTextEngine()->SetFont( aFont );
97 : : }
98 : 0 : break;
99 : : }
100 : 0 : }
101 : :
102 : 0 : void TextViewOutWin::MouseMove( const MouseEvent &rEvt )
103 : : {
104 : 0 : if ( pTextView )
105 : 0 : pTextView->MouseMove( rEvt );
106 : 0 : }
107 : :
108 : 0 : void TextViewOutWin::MouseButtonUp( const MouseEvent &rEvt )
109 : : {
110 : 0 : if ( pTextView )
111 : 0 : pTextView->MouseButtonUp( rEvt );
112 : 0 : }
113 : :
114 : 0 : void TextViewOutWin::MouseButtonDown( const MouseEvent &rEvt )
115 : : {
116 : 0 : GrabFocus();
117 : 0 : if ( pTextView )
118 : 0 : pTextView->MouseButtonDown( rEvt );
119 : 0 : }
120 : :
121 : 0 : void TextViewOutWin::Command( const CommandEvent& rCEvt )
122 : : {
123 : 0 : switch(rCEvt.GetCommand())
124 : : {
125 : : case COMMAND_CONTEXTMENU:
126 : : case COMMAND_WHEEL:
127 : : case COMMAND_STARTAUTOSCROLL:
128 : : case COMMAND_AUTOSCROLL:
129 : 0 : break;
130 : :
131 : : default:
132 : 0 : if ( pTextView )
133 : 0 : pTextView->Command( rCEvt );
134 : : else
135 : 0 : Window::Command(rCEvt);
136 : : }
137 : 0 : }
138 : :
139 : 0 : void TextViewOutWin::KeyInput( const KeyEvent& rKEvt )
140 : : {
141 : 0 : if(!TextEngine::DoesKeyChangeText( rKEvt ))
142 : 0 : pTextView->KeyInput( rKEvt );
143 : 0 : }
144 : :
145 : 0 : void TextViewOutWin::Paint( const Rectangle& rRect )
146 : : {
147 : 0 : pTextView->Paint( rRect );
148 : 0 : }
149 : :
150 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|