xref: /AOO41X/main/svx/workben/edittest.cxx (revision f6e50924346d0b8c0b07c91832a97665dd718b0c)
1*f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*f6e50924SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f6e50924SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f6e50924SAndrew Rist  * distributed with this work for additional information
6*f6e50924SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f6e50924SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f6e50924SAndrew Rist  * "License"); you may not use this file except in compliance
9*f6e50924SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*f6e50924SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f6e50924SAndrew Rist  * software distributed under the License is distributed on an
15*f6e50924SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f6e50924SAndrew Rist  * KIND, either express or implied.  See the License for the
17*f6e50924SAndrew Rist  * specific language governing permissions and limitations
18*f6e50924SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*f6e50924SAndrew Rist  *************************************************************/
21*f6e50924SAndrew Rist 
22*f6e50924SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <editeng/editeng.hxx>
28cdf0e10cSrcweir #include <editeng/eeitem.hxx>
29cdf0e10cSrcweir #include <editeng/editview.hxx>
30cdf0e10cSrcweir #include <editeng/editobj.hxx>
31cdf0e10cSrcweir #include <editeng/editstat.hxx>
32cdf0e10cSrcweir #include <eerdll.hxx>
33cdf0e10cSrcweir #include <editeng/flditem.hxx>
34cdf0e10cSrcweir #include <tools/urlobj.hxx>
35cdf0e10cSrcweir #include <svx/svxacorr.hxx>
36cdf0e10cSrcweir #include <tools/fsys.hxx>
37cdf0e10cSrcweir #include <svx/xpoly.hxx>
38cdf0e10cSrcweir #include <svtools/filedlg.hxx>
39cdf0e10cSrcweir 
40cdf0e10cSrcweir #include <vcl/window.hxx>
41cdf0e10cSrcweir #include <vcl/svapp.hxx>
42cdf0e10cSrcweir #include <vcl/font.hxx>
43cdf0e10cSrcweir #include <vcl/sound.hxx>
44cdf0e10cSrcweir #include <vcl/print.hxx>
45cdf0e10cSrcweir #include <vcl/toolbox.hxx>
46cdf0e10cSrcweir #include <vcl/help.hxx>
47cdf0e10cSrcweir #include <vcl/scrbar.hxx>
48cdf0e10cSrcweir #include <vcl/wrkwin.hxx>
49cdf0e10cSrcweir #include <vcl/msgbox.hxx>
50cdf0e10cSrcweir 
51cdf0e10cSrcweir #include <dialdll.hxx>
52cdf0e10cSrcweir 
53cdf0e10cSrcweir 
54cdf0e10cSrcweir #define SERVICE_SIMPLEREGISTRY             "com.sun.star.registry.SimpleRegistry"
55cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
56cdf0e10cSrcweir #include <comphelper/regpathhelper.hxx>
57cdf0e10cSrcweir #include <cppuhelper/servicefactory.hxx>
58cdf0e10cSrcweir #include <cppuhelper/bootstrap.hxx>
59cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
60cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp>
61cdf0e10cSrcweir #include <com/sun/star/registry/XSimpleRegistry.hpp>
62cdf0e10cSrcweir #include <sfx2/sfxuno.hxx>
63cdf0e10cSrcweir 
64cdf0e10cSrcweir // SVX
65cdf0e10cSrcweir #include <editeng/lrspitem.hxx>
66cdf0e10cSrcweir #include <editeng/shdditem.hxx>
67cdf0e10cSrcweir #include <editeng/cntritem.hxx>
68cdf0e10cSrcweir #include <editeng/crsditem.hxx>
69cdf0e10cSrcweir #include <editeng/udlnitem.hxx>
70cdf0e10cSrcweir #include <editeng/lspcitem.hxx>
71cdf0e10cSrcweir #include <editeng/escpitem.hxx>
72cdf0e10cSrcweir #include <editeng/kernitem.hxx>
73cdf0e10cSrcweir #include <editeng/akrnitem.hxx>
74cdf0e10cSrcweir #include <editeng/wrlmitem.hxx>
75cdf0e10cSrcweir #include <editeng/colritem.hxx>
76cdf0e10cSrcweir #include <editeng/ulspitem.hxx>
77cdf0e10cSrcweir #include <editeng/postitem.hxx>
78cdf0e10cSrcweir #include <editeng/adjitem.hxx>
79cdf0e10cSrcweir #include <editeng/wghtitem.hxx>
80cdf0e10cSrcweir #include <editeng/fhgtitem.hxx>
81cdf0e10cSrcweir #include <editeng/fontitem.hxx>
82cdf0e10cSrcweir #include <fwdtitem.hxx>
83cdf0e10cSrcweir 
84cdf0e10cSrcweir // SVTOOLS
85cdf0e10cSrcweir #include <svl/undo.hxx>
86cdf0e10cSrcweir #include <svl/itemset.hxx>
87cdf0e10cSrcweir #include <svl/itempool.hxx>
88cdf0e10cSrcweir #include <svl/poolitem.hxx>
89cdf0e10cSrcweir #include <svtools/printdlg.hxx>
90cdf0e10cSrcweir 
91cdf0e10cSrcweir #include <osl/file.hxx>
92cdf0e10cSrcweir #include <osl/process.h>
93cdf0e10cSrcweir #include <rtl/bootstrap.hxx>
94cdf0e10cSrcweir 
95cdf0e10cSrcweir #define TB_LEFT			 1
96cdf0e10cSrcweir #define TB_RIGHT		 2
97cdf0e10cSrcweir #define TB_CENTER		 3
98cdf0e10cSrcweir #define TB_UNDO			 4
99cdf0e10cSrcweir #define TB_REDO			 5
100cdf0e10cSrcweir #define TB_FONT1		 6
101cdf0e10cSrcweir #define TB_FONT2		 7
102cdf0e10cSrcweir #define TB_ITALIC		 8
103cdf0e10cSrcweir #define TB_BOLD			 9
104cdf0e10cSrcweir #define TB_UNDERLINE	10
105cdf0e10cSrcweir #define TB_BLACK		11
106cdf0e10cSrcweir #define TB_GREEN		12
107cdf0e10cSrcweir #define TB_OPEN			13
108cdf0e10cSrcweir #define TB_SAVE			14
109cdf0e10cSrcweir #define TB_SBL			15
110cdf0e10cSrcweir #define TB_SBSA			16
111cdf0e10cSrcweir #define TB_LR			17
112cdf0e10cSrcweir #define TB_DRAW			18
113cdf0e10cSrcweir #define TB_DEFTAB		19
114cdf0e10cSrcweir #define TB_OPEN2		20
115cdf0e10cSrcweir #define TB_SAVE2		21
116cdf0e10cSrcweir #define TB_STDSEL		33
117cdf0e10cSrcweir #define TB_MOVE			34
118cdf0e10cSrcweir #define TB_PARATTR1		35
119cdf0e10cSrcweir #define TB_ROTATE		38
120cdf0e10cSrcweir #define TB_RED			43
121cdf0e10cSrcweir #define TB_FLAT			46
122cdf0e10cSrcweir #define TB_BINOBJ1		47
123cdf0e10cSrcweir #define TB_BINOBJ3		49
124cdf0e10cSrcweir #define TB_BINOBJ4		50
125cdf0e10cSrcweir #define TB_BINOBJ1b		51
126cdf0e10cSrcweir #define TB_BINOBJ2b		52
127cdf0e10cSrcweir #define TB_ATTRIBS		54
128cdf0e10cSrcweir #define TB_IDLE			55
129cdf0e10cSrcweir #define TB_BLOCK		56
130cdf0e10cSrcweir #define TB_CLONEBIN		57
131cdf0e10cSrcweir #define TB_INSERT		58
132cdf0e10cSrcweir #define TB_PKERN		59
133cdf0e10cSrcweir #define TB_KERN			60
134cdf0e10cSrcweir #define TB_SUPER		61
135cdf0e10cSrcweir #define TB_SUB			62
136cdf0e10cSrcweir #define TB_PRINT		63
137cdf0e10cSrcweir #define TB_FONT			64
138cdf0e10cSrcweir #define TB_COLORS		65
139cdf0e10cSrcweir #define TB_WLM			66
140cdf0e10cSrcweir #define TB_OUTL			67
141cdf0e10cSrcweir #define TB_INSFLD		68
142cdf0e10cSrcweir #define TB_UPDFLD		69
143cdf0e10cSrcweir #define TB_ONLINESPELL  70
144cdf0e10cSrcweir #define TB_REDLINES		71
145cdf0e10cSrcweir #define TB_AUTOCORRECT	72
146cdf0e10cSrcweir #define TB_POLY			73
147cdf0e10cSrcweir #define TB_HYPH			74
148cdf0e10cSrcweir 
149cdf0e10cSrcweir // VARS...
150cdf0e10cSrcweir short nRotation = 0;
151cdf0e10cSrcweir USHORT nZoom = 100;
152cdf0e10cSrcweir sal_Bool bURLClicked = sal_False;
153cdf0e10cSrcweir 
154cdf0e10cSrcweir using namespace ::com::sun::star::connection;
155cdf0e10cSrcweir using namespace ::vos;
156cdf0e10cSrcweir using namespace ::rtl;
157cdf0e10cSrcweir using namespace ::com::sun::star::uno;
158cdf0e10cSrcweir using namespace ::com::sun::star::registry;
159cdf0e10cSrcweir using namespace ::com::sun::star::lang;
160cdf0e10cSrcweir 
161cdf0e10cSrcweir 
162cdf0e10cSrcweir 
createApplicationServiceManager()163cdf0e10cSrcweir Reference< XMultiServiceFactory > createApplicationServiceManager()
164cdf0e10cSrcweir {
165cdf0e10cSrcweir     Reference< XMultiServiceFactory > xMS;
166cdf0e10cSrcweir 	try
167cdf0e10cSrcweir 	{
168cdf0e10cSrcweir 		Reference< XComponentContext >    xComponentContext = ::cppu::defaultBootstrap_InitialComponentContext();
169cdf0e10cSrcweir         if ( xComponentContext.is() )
170cdf0e10cSrcweir 		    xMS = xMS.query( xComponentContext->getServiceManager() );
171cdf0e10cSrcweir 	}
172cdf0e10cSrcweir 	catch( ::com::sun::star::uno::Exception& )
173cdf0e10cSrcweir 	{
174cdf0e10cSrcweir 	}
175cdf0e10cSrcweir 
176cdf0e10cSrcweir 	return xMS;
177cdf0e10cSrcweir }
178cdf0e10cSrcweir 
179cdf0e10cSrcweir // --- class EditApp -------------------------------------------------
180cdf0e10cSrcweir 
181cdf0e10cSrcweir SV_DECL_PTRARR_DEL( StringList, String*, 0, 4 );
182cdf0e10cSrcweir SV_IMPL_PTRARR( StringList, String* );
183cdf0e10cSrcweir StringList aSimpleHistory;
184cdf0e10cSrcweir 
185cdf0e10cSrcweir class EditApp : public Application
186cdf0e10cSrcweir {
187cdf0e10cSrcweir public:
188cdf0e10cSrcweir 	virtual void Main();
189cdf0e10cSrcweir };
190cdf0e10cSrcweir 
191cdf0e10cSrcweir class MyEditEngine : public EditEngine
192cdf0e10cSrcweir {
193cdf0e10cSrcweir public:
MyEditEngine(SfxItemPool * pPool)194cdf0e10cSrcweir 	MyEditEngine( SfxItemPool* pPool ) : EditEngine( pPool ) { ; }
195cdf0e10cSrcweir 	virtual String	CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rTxtColor, Color*& rFldColor );
196cdf0e10cSrcweir 	virtual void	FieldClicked( const SvxFieldItem& rField, USHORT nPara, USHORT nPos );
197cdf0e10cSrcweir 	virtual void	FieldSelected( const SvxFieldItem& rField, USHORT nPara, USHORT nPos );
198cdf0e10cSrcweir };
199cdf0e10cSrcweir 
CalcFieldValue(const SvxFieldItem & rField,USHORT nPara,USHORT nPos,Color * & rpTxtColor,Color * & rpFldColor)200cdf0e10cSrcweir XubString __EXPORT MyEditEngine::CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor )
201cdf0e10cSrcweir {
202cdf0e10cSrcweir 	const SvxFieldData* pField = rField.GetField();
203cdf0e10cSrcweir 	if ( !pField )
204cdf0e10cSrcweir 		return String( RTL_CONSTASCII_USTRINGPARAM( "<Empty>" ) );
205cdf0e10cSrcweir 
206cdf0e10cSrcweir 	if ( pField->ISA( SvxDateField ) )
207cdf0e10cSrcweir 		return ((const SvxDateField*)pField)->GetFormatted( LANGUAGE_SYSTEM, LANGUAGE_SYSTEM );
208cdf0e10cSrcweir 	else if ( pField->ISA( SvxURLField ) )
209cdf0e10cSrcweir 	{
210cdf0e10cSrcweir 		const SvxURLField* pURL = (const SvxURLField*)pField;
211cdf0e10cSrcweir 		if ( !bURLClicked )
212cdf0e10cSrcweir 		{
213cdf0e10cSrcweir 			delete rpTxtColor;
214cdf0e10cSrcweir 			rpTxtColor = new Color( COL_BLUE );
215cdf0e10cSrcweir 		}
216cdf0e10cSrcweir 		else
217cdf0e10cSrcweir 		{
218cdf0e10cSrcweir 			delete rpTxtColor;
219cdf0e10cSrcweir 			rpTxtColor = new Color( COL_RED );
220cdf0e10cSrcweir 			delete rpFldColor;
221cdf0e10cSrcweir 			rpFldColor = new Color( COL_YELLOW );
222cdf0e10cSrcweir 		}
223cdf0e10cSrcweir 		if ( pURL->GetFormat() == SVXURLFORMAT_URL )
224cdf0e10cSrcweir 			return pURL->GetURL();
225cdf0e10cSrcweir 		return pURL->GetRepresentation();
226cdf0e10cSrcweir 	}
227cdf0e10cSrcweir 	return String( RTL_CONSTASCII_USTRINGPARAM( "???" ) );
228cdf0e10cSrcweir }
229cdf0e10cSrcweir 
FieldClicked(const SvxFieldItem & rField,USHORT nPara,USHORT nPos)230cdf0e10cSrcweir void __EXPORT MyEditEngine::FieldClicked( const SvxFieldItem& rField, USHORT nPara, USHORT nPos )
231cdf0e10cSrcweir {
232cdf0e10cSrcweir 	EditEngine::FieldClicked( rField, nPara, nPos );	// Falls URL
233cdf0e10cSrcweir 	const SvxFieldData* pField = rField.GetField();
234cdf0e10cSrcweir 	if ( !pField )
235cdf0e10cSrcweir 		return;
236cdf0e10cSrcweir 
237cdf0e10cSrcweir 	if ( pField->ISA( SvxURLField ) )
238cdf0e10cSrcweir 	{
239cdf0e10cSrcweir 		bURLClicked = TRUE;
240cdf0e10cSrcweir 		UpdateFields();
241cdf0e10cSrcweir 	}
242cdf0e10cSrcweir 	else
243cdf0e10cSrcweir 		Sound::Beep();
244cdf0e10cSrcweir }
245cdf0e10cSrcweir 
FieldSelected(const SvxFieldItem & rField,USHORT nPara,USHORT nPos)246cdf0e10cSrcweir void __EXPORT MyEditEngine::FieldSelected( const SvxFieldItem& rField, USHORT nPara, USHORT nPos )
247cdf0e10cSrcweir {
248cdf0e10cSrcweir 	const SvxFieldData* pField = rField.GetField();
249cdf0e10cSrcweir 	if ( !pField )
250cdf0e10cSrcweir 		return;
251cdf0e10cSrcweir 
252cdf0e10cSrcweir 	InfoBox( 0, String( RTL_CONSTASCII_USTRINGPARAM( "Feld selektiert!" ) ) ).Execute();
253cdf0e10cSrcweir }
254cdf0e10cSrcweir 
255cdf0e10cSrcweir 
256cdf0e10cSrcweir class MyView : public WorkWindow
257cdf0e10cSrcweir {
258cdf0e10cSrcweir private:
259cdf0e10cSrcweir 	EditEngine*		pEditEngine;
260cdf0e10cSrcweir 	EditView*		pEditView;
261cdf0e10cSrcweir 
262cdf0e10cSrcweir public:
263cdf0e10cSrcweir 					MyView( Window* pParent, EditEngine* pEditEngine );
264cdf0e10cSrcweir 					~MyView();
265cdf0e10cSrcweir 
266cdf0e10cSrcweir 	virtual void	Paint( const Rectangle& );
267cdf0e10cSrcweir 	virtual void	Resize();
268cdf0e10cSrcweir 	virtual void	KeyInput( const KeyEvent& rKeyEvt );
269cdf0e10cSrcweir 	virtual void	MouseMove( const MouseEvent& rMEvt );
270cdf0e10cSrcweir 	virtual void	MouseButtonDown( const MouseEvent& rMEvt );
271cdf0e10cSrcweir 	virtual void	MouseButtonUp( const MouseEvent& rMEvt );
272cdf0e10cSrcweir 	virtual void	Command( const CommandEvent& rCEvt );
273cdf0e10cSrcweir 	BOOL    		Drop( const DropEvent& rEvt );
274cdf0e10cSrcweir 	BOOL    		QueryDrop( DropEvent& rEvt );
275cdf0e10cSrcweir };
276cdf0e10cSrcweir 
MyView(Window * pParent,EditEngine * pEE)277cdf0e10cSrcweir MyView::MyView( Window* pParent, EditEngine* pEE ) : WorkWindow( pParent, WinBits( WB_STDWORK ) )
278cdf0e10cSrcweir {
279cdf0e10cSrcweir 	pEditEngine = pEE;
280cdf0e10cSrcweir 	pEditView = new EditView( pEditEngine, this );
281cdf0e10cSrcweir 	pEditEngine->InsertView( pEditView );
282cdf0e10cSrcweir 	SetText( String( RTL_CONSTASCII_USTRINGPARAM( "Another View..." ) ) );
283cdf0e10cSrcweir //	EnableDrop();
284cdf0e10cSrcweir 	SetBackgroundBrush( Brush( Color( COL_LIGHTBLUE ) ) );
285cdf0e10cSrcweir 	Show();
286cdf0e10cSrcweir }
287cdf0e10cSrcweir 
~MyView()288cdf0e10cSrcweir MyView::~MyView()
289cdf0e10cSrcweir {
290cdf0e10cSrcweir 	pEditEngine->RemoveView( pEditView );
291cdf0e10cSrcweir 	delete pEditView;
292cdf0e10cSrcweir }
293cdf0e10cSrcweir 
Paint(const Rectangle & rRec)294cdf0e10cSrcweir void __EXPORT MyView::Paint( const Rectangle& rRec )
295cdf0e10cSrcweir {
296cdf0e10cSrcweir 	pEditView->Paint( rRec );
297cdf0e10cSrcweir }
298cdf0e10cSrcweir 
Resize()299cdf0e10cSrcweir void __EXPORT MyView::Resize()
300cdf0e10cSrcweir {
301cdf0e10cSrcweir 	Size aPaperSz( GetOutputSize() );
302cdf0e10cSrcweir //	aPaperSz.Width() /= 2;
303cdf0e10cSrcweir //	aPaperSz.Height() /= 2;
304cdf0e10cSrcweir 	pEditView->SetOutputArea( Rectangle( Point( 0,0 ), aPaperSz ) );
305cdf0e10cSrcweir 	pEditView->SetVisArea( Rectangle( Point( 0,0 ), aPaperSz ) );
306cdf0e10cSrcweir 	Invalidate();
307cdf0e10cSrcweir 	pEditView->ShowCursor();
308cdf0e10cSrcweir }
309cdf0e10cSrcweir 
310cdf0e10cSrcweir // --- MyView::KeyInput() --------------------------------------
KeyInput(const KeyEvent & rKEvt)311cdf0e10cSrcweir void __EXPORT MyView::KeyInput( const KeyEvent& rKEvt )
312cdf0e10cSrcweir {
313cdf0e10cSrcweir 	pEditView->PostKeyEvent( rKEvt );
314cdf0e10cSrcweir }
315cdf0e10cSrcweir 
MouseMove(const MouseEvent & rMEvt)316cdf0e10cSrcweir void __EXPORT MyView::MouseMove( const MouseEvent& rMEvt )
317cdf0e10cSrcweir {
318cdf0e10cSrcweir 	Point aPos = PixelToLogic( rMEvt.GetPosPixel() );
319cdf0e10cSrcweir 	if ( pEditView->GetOutputArea().IsInside( aPos ) )
320cdf0e10cSrcweir 		SetPointer( pEditView->GetPointer() );
321cdf0e10cSrcweir 	else
322cdf0e10cSrcweir 		SetPointer( Pointer() );
323cdf0e10cSrcweir 
324cdf0e10cSrcweir 
325cdf0e10cSrcweir 	pEditView->MouseMove( rMEvt );
326cdf0e10cSrcweir }
327cdf0e10cSrcweir 
MouseButtonDown(const MouseEvent & rMEvt)328cdf0e10cSrcweir void __EXPORT MyView::MouseButtonDown( const MouseEvent& rMEvt )
329cdf0e10cSrcweir {
330cdf0e10cSrcweir 	pEditView->MouseButtonDown( rMEvt );
331cdf0e10cSrcweir }
332cdf0e10cSrcweir 
MouseButtonUp(const MouseEvent & rMEvt)333cdf0e10cSrcweir void __EXPORT MyView::MouseButtonUp( const MouseEvent& rMEvt )
334cdf0e10cSrcweir {
335cdf0e10cSrcweir 	pEditView->MouseButtonUp( rMEvt );
336cdf0e10cSrcweir }
337cdf0e10cSrcweir 
Command(const CommandEvent & rCEvt)338cdf0e10cSrcweir void __EXPORT MyView::Command( const CommandEvent& rCEvt )
339cdf0e10cSrcweir {
340cdf0e10cSrcweir 	if ( rCEvt.GetCommand() == COMMAND_STARTDRAG )
341cdf0e10cSrcweir 		pEditView->Command(rCEvt);
342cdf0e10cSrcweir }
343cdf0e10cSrcweir 
Drop(const DropEvent & rEvt)344cdf0e10cSrcweir BOOL __EXPORT MyView::Drop( const DropEvent& rEvt )
345cdf0e10cSrcweir {
346cdf0e10cSrcweir 	return pEditView->Drop( rEvt );
347cdf0e10cSrcweir }
348cdf0e10cSrcweir 
QueryDrop(DropEvent & rEvt)349cdf0e10cSrcweir BOOL __EXPORT MyView::QueryDrop( DropEvent& rEvt )
350cdf0e10cSrcweir {
351cdf0e10cSrcweir 	return pEditView->QueryDrop( rEvt );
352cdf0e10cSrcweir }
353cdf0e10cSrcweir 
354cdf0e10cSrcweir // --- class EditMainWindow --------------------------------------------
355cdf0e10cSrcweir DECLARE_LIST( ViewList, MyView* );
356cdf0e10cSrcweir 
357cdf0e10cSrcweir class EditViewWindow : public Window
358cdf0e10cSrcweir {
359cdf0e10cSrcweir private:
360cdf0e10cSrcweir 	MyEditEngine*			pEditEngine;
361cdf0e10cSrcweir 	EditView*				pEditView;
362cdf0e10cSrcweir 	Pointer 				aStdPtr;
363cdf0e10cSrcweir 	Pointer 				aURLPtr;
364cdf0e10cSrcweir 	WorkWindow* 			pTmpWindow;
365cdf0e10cSrcweir 	ViewList 				aViewList;
366cdf0e10cSrcweir 
367cdf0e10cSrcweir 	XubString 				aTestStr;
368cdf0e10cSrcweir 
369cdf0e10cSrcweir 
370cdf0e10cSrcweir public:
371cdf0e10cSrcweir 					EditViewWindow( Window* pParent );
372cdf0e10cSrcweir 					~EditViewWindow();
373cdf0e10cSrcweir 
374cdf0e10cSrcweir 	virtual void	Paint( const Rectangle& );
375cdf0e10cSrcweir 	virtual void	Resize();
376cdf0e10cSrcweir 	virtual void	KeyInput( const KeyEvent& rKeyEvt );
377cdf0e10cSrcweir 	virtual void	MouseMove( const MouseEvent& rMEvt );
378cdf0e10cSrcweir 	virtual void	MouseButtonDown( const MouseEvent& rMEvt );
379cdf0e10cSrcweir 	virtual void	MouseButtonUp( const MouseEvent& rMEvt );
380cdf0e10cSrcweir 	virtual void	Command( const CommandEvent& rCEvt );
381cdf0e10cSrcweir 	void			MarkOutputArea();
382cdf0e10cSrcweir 	BOOL    		Drop( const DropEvent& rEvt );
383cdf0e10cSrcweir 	BOOL    		QueryDrop( DropEvent& rEvt );
384cdf0e10cSrcweir 
GetEditView()385cdf0e10cSrcweir 	EditView*		GetEditView() 		{ return pEditView; }
386cdf0e10cSrcweir };
387cdf0e10cSrcweir 
388cdf0e10cSrcweir class EditMainWindow : public WorkWindow
389cdf0e10cSrcweir {
390cdf0e10cSrcweir private:
391cdf0e10cSrcweir 	ToolBox 				aToolBox;
392cdf0e10cSrcweir 	ScrollBar				aHScrollBar;
393cdf0e10cSrcweir 	ScrollBar				aVScrollBar;
394cdf0e10cSrcweir 	EditViewWindow			aViewWin;
395cdf0e10cSrcweir 	Printer*				pPrinter;
396cdf0e10cSrcweir 
397cdf0e10cSrcweir 	WorkWindow* 			pTmpWindow;
398cdf0e10cSrcweir 
399cdf0e10cSrcweir 	EditTextObject*			pRTFObj;
400cdf0e10cSrcweir 	EditTextObject*			pBinObj;
401cdf0e10cSrcweir 
402cdf0e10cSrcweir 	FileDialog*				pFileDialogBox;
403cdf0e10cSrcweir 	FileDialog*				pFileDialogBox2;
404cdf0e10cSrcweir 
405cdf0e10cSrcweir 
406cdf0e10cSrcweir protected:
407cdf0e10cSrcweir 	void			SetScrollBars();
408cdf0e10cSrcweir 	void			SetScrollBarRanges();
409cdf0e10cSrcweir 	void			CreatePolygon();
410cdf0e10cSrcweir 
411cdf0e10cSrcweir 	virtual void	GetFocus();
412cdf0e10cSrcweir 
413cdf0e10cSrcweir public:
414cdf0e10cSrcweir 					EditMainWindow();
415cdf0e10cSrcweir 					~EditMainWindow();
416cdf0e10cSrcweir 
417cdf0e10cSrcweir 	virtual void	Resize();
418cdf0e10cSrcweir 
419cdf0e10cSrcweir 	DECL_LINK( TBSelect, ToolBox * );
420cdf0e10cSrcweir 	void			UpdateToolBox();
421cdf0e10cSrcweir 
422cdf0e10cSrcweir 	DECL_LINK( HScrollHdl, ScrollBar * );
423cdf0e10cSrcweir 	DECL_LINK( VScrollHdl, ScrollBar * );
424cdf0e10cSrcweir 	DECL_LINK( ShowStatus, EditStatus * );
425cdf0e10cSrcweir 	void			SetTitle();
426cdf0e10cSrcweir };
427cdf0e10cSrcweir 
428cdf0e10cSrcweir 
~EditMainWindow()429cdf0e10cSrcweir EditMainWindow::~EditMainWindow()
430cdf0e10cSrcweir {
431cdf0e10cSrcweir 	delete pRTFObj;
432cdf0e10cSrcweir 	delete pBinObj;
433cdf0e10cSrcweir 	delete pFileDialogBox;
434cdf0e10cSrcweir 	delete pFileDialogBox2;
435cdf0e10cSrcweir 	delete pTmpWindow;
436cdf0e10cSrcweir 	delete pPrinter;
437cdf0e10cSrcweir }
438cdf0e10cSrcweir 
EditMainWindow()439cdf0e10cSrcweir EditMainWindow::EditMainWindow() :
440cdf0e10cSrcweir 				WorkWindow( NULL, WB_APP | WB_STDWORK | WB_SVLOOK | WB_CLIPCHILDREN ) ,
441cdf0e10cSrcweir 				aViewWin( this ),
442cdf0e10cSrcweir 				aToolBox( this, WinBits( WB_BORDER | WB_SVLOOK | WB_SCROLL | WB_LINESPACING ) ),
443cdf0e10cSrcweir 				aHScrollBar( this, WinBits( WB_HSCROLL | WB_DRAG ) ),
444cdf0e10cSrcweir 				aVScrollBar( this, WinBits( WB_VSCROLL | WB_DRAG ) )
445cdf0e10cSrcweir {
446cdf0e10cSrcweir 	pRTFObj = 0;
447cdf0e10cSrcweir 	pBinObj = 0;
448cdf0e10cSrcweir 
449cdf0e10cSrcweir 	pFileDialogBox = new FileDialog( this, WinBits( WB_OPEN | WB_SVLOOK ) );
450cdf0e10cSrcweir 	pFileDialogBox->SetText( String( RTL_CONSTASCII_USTRINGPARAM( "Open" ) ) );
451cdf0e10cSrcweir 	pFileDialogBox->AddFilter( String( RTL_CONSTASCII_USTRINGPARAM( "Text" )), String( RTL_CONSTASCII_USTRINGPARAM( "*.txt" ) ) );
452cdf0e10cSrcweir 	pFileDialogBox->AddFilter( String( RTL_CONSTASCII_USTRINGPARAM( "Rich Text Format" ) ), String( RTL_CONSTASCII_USTRINGPARAM( "*.rtf" ) ) );
453cdf0e10cSrcweir 	pFileDialogBox->AddFilter( String( RTL_CONSTASCII_USTRINGPARAM( "HTML" ) ), String( RTL_CONSTASCII_USTRINGPARAM( "*.htm;*.html" ) ) );
454cdf0e10cSrcweir 	pFileDialogBox->SetCurFilter( String( RTL_CONSTASCII_USTRINGPARAM( "Rich Text Format" ) ) );
455cdf0e10cSrcweir 
456cdf0e10cSrcweir 	pFileDialogBox2 = new FileDialog( this, WinBits( WB_SAVEAS| WB_SVLOOK ) );
457cdf0e10cSrcweir 	pFileDialogBox2->SetText( String( RTL_CONSTASCII_USTRINGPARAM( "Save" ) ) );
458cdf0e10cSrcweir 	pFileDialogBox2->AddFilter( String( RTL_CONSTASCII_USTRINGPARAM( "Text" ) ), String( RTL_CONSTASCII_USTRINGPARAM( "*.txt" ) ) );
459cdf0e10cSrcweir 	pFileDialogBox2->AddFilter( String( RTL_CONSTASCII_USTRINGPARAM( "Rich Text Format" ) ), String( RTL_CONSTASCII_USTRINGPARAM( "*.rtf" ) ) );
460cdf0e10cSrcweir 	pFileDialogBox2->AddFilter( String( RTL_CONSTASCII_USTRINGPARAM( "HTML" ) ), String( RTL_CONSTASCII_USTRINGPARAM( "*.htm" ) ) );
461cdf0e10cSrcweir 	pFileDialogBox2->SetCurFilter( String( RTL_CONSTASCII_USTRINGPARAM( "Rich Text Format" ) ) );
462cdf0e10cSrcweir 
463cdf0e10cSrcweir 	pPrinter = new Printer;
464cdf0e10cSrcweir 	pPrinter->SetMapMode( MAP_100TH_MM );
465cdf0e10cSrcweir 	aViewWin.SetMapMode( pPrinter->GetMapMode() );
466cdf0e10cSrcweir 	aViewWin.GetEditView()->GetEditEngine()->SetRefDevice( pPrinter );
467cdf0e10cSrcweir 
468cdf0e10cSrcweir 
469cdf0e10cSrcweir 
470cdf0e10cSrcweir 	pTmpWindow = new WorkWindow( this, WB_STDWORK );
471cdf0e10cSrcweir 
472cdf0e10cSrcweir 	aToolBox.SetButtonType( BUTTON_TEXT );
473cdf0e10cSrcweir 	aToolBox.SetLineCount( 4 );
474cdf0e10cSrcweir 
475cdf0e10cSrcweir 	{
476cdf0e10cSrcweir 	aToolBox.InsertItem( TB_OPEN, String( RTL_CONSTASCII_USTRINGPARAM( "Open" ) ) );
477cdf0e10cSrcweir 	aToolBox.InsertItem( TB_SAVE, String( RTL_CONSTASCII_USTRINGPARAM( "Save" ) ) );
478cdf0e10cSrcweir 	aToolBox.InsertItem( TB_PRINT, String( RTL_CONSTASCII_USTRINGPARAM( "Print" ) ) );
479cdf0e10cSrcweir 	aToolBox.InsertSeparator();
480cdf0e10cSrcweir 	aToolBox.InsertItem( TB_LEFT, String( RTL_CONSTASCII_USTRINGPARAM( "L" ) ) );
481cdf0e10cSrcweir 	aToolBox.InsertItem( TB_CENTER, String( RTL_CONSTASCII_USTRINGPARAM( "C" ) ) );
482cdf0e10cSrcweir 	aToolBox.InsertItem( TB_RIGHT, String( RTL_CONSTASCII_USTRINGPARAM( "R" ) ) );
483cdf0e10cSrcweir 	aToolBox.InsertItem( TB_BLOCK, String( RTL_CONSTASCII_USTRINGPARAM( "B" ) ) );
484cdf0e10cSrcweir 	aToolBox.InsertSeparator();
485cdf0e10cSrcweir 	aToolBox.InsertItem( TB_UNDO, String( RTL_CONSTASCII_USTRINGPARAM( "Undo" ) ) );
486cdf0e10cSrcweir 	aToolBox.InsertItem( TB_REDO, String( RTL_CONSTASCII_USTRINGPARAM( "Redo" ) ) );
487cdf0e10cSrcweir 	aToolBox.InsertSeparator();
488cdf0e10cSrcweir 	aToolBox.InsertItem( TB_FONT1, String( RTL_CONSTASCII_USTRINGPARAM( "Font1" ) ) );
489cdf0e10cSrcweir 	aToolBox.InsertItem( TB_FONT2, String( RTL_CONSTASCII_USTRINGPARAM( "Font2" ) ) );
490cdf0e10cSrcweir 	aToolBox.InsertItem( TB_DEFTAB, String( RTL_CONSTASCII_USTRINGPARAM( "DefTab" ) ) );
491cdf0e10cSrcweir 	aToolBox.InsertBreak();
492cdf0e10cSrcweir 	aToolBox.InsertItem( TB_OPEN2, String( RTL_CONSTASCII_USTRINGPARAM( "Read" ) ) );
493cdf0e10cSrcweir 	aToolBox.InsertItem( TB_SAVE2, String( RTL_CONSTASCII_USTRINGPARAM( "Write" ) ) );
494cdf0e10cSrcweir 	aToolBox.InsertSeparator();
495cdf0e10cSrcweir 	aToolBox.InsertItem( TB_FONT, String( RTL_CONSTASCII_USTRINGPARAM( "XXX" ) ) );
496cdf0e10cSrcweir 	aToolBox.InsertItem( TB_ITALIC, String( RTL_CONSTASCII_USTRINGPARAM( "K" ) ) );
497cdf0e10cSrcweir 	aToolBox.InsertItem( TB_BOLD, String( RTL_CONSTASCII_USTRINGPARAM( "F" ) ) );
498cdf0e10cSrcweir 	aToolBox.InsertItem( TB_UNDERLINE, String( RTL_CONSTASCII_USTRINGPARAM( "U" ) ) );
499cdf0e10cSrcweir 	aToolBox.InsertItem( TB_SUPER, String( RTL_CONSTASCII_USTRINGPARAM( "SP" ) ) );
500cdf0e10cSrcweir 	aToolBox.InsertItem( TB_SUB, String( RTL_CONSTASCII_USTRINGPARAM( "SB" ) ) );
501cdf0e10cSrcweir 	aToolBox.InsertItem( TB_PKERN, String( RTL_CONSTASCII_USTRINGPARAM( "PK" ) ) );
502cdf0e10cSrcweir 	aToolBox.InsertItem( TB_KERN, String( RTL_CONSTASCII_USTRINGPARAM( "TK" ) ) );
503cdf0e10cSrcweir 	aToolBox.InsertItem( TB_WLM, String( RTL_CONSTASCII_USTRINGPARAM( "W!" ) ) );
504cdf0e10cSrcweir 	aToolBox.InsertSeparator();
505cdf0e10cSrcweir 	aToolBox.InsertItem( TB_BLACK, String( RTL_CONSTASCII_USTRINGPARAM( "Black" ) ) );
506cdf0e10cSrcweir 	aToolBox.InsertItem( TB_GREEN, String( RTL_CONSTASCII_USTRINGPARAM( "Green" ) ) );
507cdf0e10cSrcweir 	aToolBox.InsertItem( TB_RED, String( RTL_CONSTASCII_USTRINGPARAM( "Red" ) ) );
508cdf0e10cSrcweir 	aToolBox.InsertSeparator();
509cdf0e10cSrcweir 	aToolBox.InsertItem( TB_SBL, String( RTL_CONSTASCII_USTRINGPARAM( "SBL" ) ) );
510cdf0e10cSrcweir 	aToolBox.InsertItem( TB_SBSA, String( RTL_CONSTASCII_USTRINGPARAM( "SBSA" ) ) );
511cdf0e10cSrcweir 	aToolBox.InsertItem( TB_LR, String( RTL_CONSTASCII_USTRINGPARAM( "LR" ) ) );
512cdf0e10cSrcweir 	aToolBox.InsertSeparator();
513cdf0e10cSrcweir 	aToolBox.InsertItem( TB_DRAW, String( RTL_CONSTASCII_USTRINGPARAM( "Draw!" ) ) );
514cdf0e10cSrcweir 	aToolBox.InsertItem( TB_ROTATE, String( RTL_CONSTASCII_USTRINGPARAM( "Rotate!" ) ) );
515cdf0e10cSrcweir 	aToolBox.InsertItem( TB_MOVE, String( RTL_CONSTASCII_USTRINGPARAM( "Move->2" ) ) );
516cdf0e10cSrcweir 	aToolBox.InsertItem( TB_PARATTR1, String( RTL_CONSTASCII_USTRINGPARAM( "ParaAttr0" ) ) );
517cdf0e10cSrcweir 	aToolBox.InsertItem( TB_ATTRIBS, String( RTL_CONSTASCII_USTRINGPARAM( "GetAttribs" ) ) );
518cdf0e10cSrcweir 	aToolBox.InsertSeparator();
519cdf0e10cSrcweir 	aToolBox.InsertItem( TB_INSFLD, String( RTL_CONSTASCII_USTRINGPARAM( "InsFld" ) ) );
520cdf0e10cSrcweir 	aToolBox.InsertItem( TB_UPDFLD, String( RTL_CONSTASCII_USTRINGPARAM( "UpdFld" ) ) );
521cdf0e10cSrcweir 	}
522cdf0e10cSrcweir 	aToolBox.InsertBreak();
523cdf0e10cSrcweir 	{
524cdf0e10cSrcweir 	aToolBox.InsertItem( TB_ONLINESPELL, String( RTL_CONSTASCII_USTRINGPARAM( "Spell" ) ) );
525cdf0e10cSrcweir 	aToolBox.InsertItem( TB_REDLINES, String( RTL_CONSTASCII_USTRINGPARAM( "RedLine" ) ) );
526cdf0e10cSrcweir 	aToolBox.InsertItem( TB_AUTOCORRECT, String( RTL_CONSTASCII_USTRINGPARAM( "Auto*" ) ) );
527cdf0e10cSrcweir 	aToolBox.InsertItem( TB_HYPH, String( RTL_CONSTASCII_USTRINGPARAM( "Hyph" ) ) );
528cdf0e10cSrcweir 	aToolBox.InsertItem( TB_STDSEL, String( RTL_CONSTASCII_USTRINGPARAM( "StdSel" ) ) );
529cdf0e10cSrcweir 	aToolBox.InsertItem( TB_FLAT, String( RTL_CONSTASCII_USTRINGPARAM( "FlatMode" ) ) );
530cdf0e10cSrcweir 	aToolBox.InsertItem( TB_OUTL, String( RTL_CONSTASCII_USTRINGPARAM( "Ocomphelper" ) ) );
531cdf0e10cSrcweir 	aToolBox.InsertItem( TB_POLY, String( RTL_CONSTASCII_USTRINGPARAM( "Poly" ) ) );
532cdf0e10cSrcweir 	aToolBox.InsertItem( TB_COLORS, String( RTL_CONSTASCII_USTRINGPARAM( "Colors" ) ));
533cdf0e10cSrcweir 	aToolBox.InsertItem( TB_IDLE, String( RTL_CONSTASCII_USTRINGPARAM( "Idle!" ) ) );
534cdf0e10cSrcweir 	aToolBox.InsertItem( TB_INSERT, String( RTL_CONSTASCII_USTRINGPARAM( "Insert" ) ) );
535cdf0e10cSrcweir 	aToolBox.InsertSeparator();
536cdf0e10cSrcweir 	aToolBox.InsertItem( TB_BINOBJ1, String( RTL_CONSTASCII_USTRINGPARAM( ">BINObj" ) ) );
537cdf0e10cSrcweir 	aToolBox.InsertItem( TB_BINOBJ1b, String( RTL_CONSTASCII_USTRINGPARAM( ">>BINObj" ) ) );
538cdf0e10cSrcweir 	aToolBox.InsertItem( TB_BINOBJ2b, String( RTL_CONSTASCII_USTRINGPARAM( "<<BINObj" ) ) );
539cdf0e10cSrcweir 	aToolBox.InsertItem( TB_CLONEBIN, String( RTL_CONSTASCII_USTRINGPARAM( "Clone" ) ) );
540cdf0e10cSrcweir 	aToolBox.InsertSeparator();
541cdf0e10cSrcweir 	aToolBox.InsertItem( TB_BINOBJ3, String( RTL_CONSTASCII_USTRINGPARAM( "StoreBin" ) ) );
542cdf0e10cSrcweir 	aToolBox.InsertItem( TB_BINOBJ4, String( RTL_CONSTASCII_USTRINGPARAM( "CreatBin" ) ) );
543cdf0e10cSrcweir 	}
544cdf0e10cSrcweir 
545cdf0e10cSrcweir 	aToolBox.SetPosPixel( Point( 0, 0 ) );
546cdf0e10cSrcweir 	aToolBox.SetSelectHdl( LINK( this, EditMainWindow, TBSelect ) );
547cdf0e10cSrcweir 
548cdf0e10cSrcweir 	SetBackgroundBrush( Brush( Color( COL_LIGHTGRAY ) ) );
549cdf0e10cSrcweir 
550cdf0e10cSrcweir 	SetPen( PEN_NULL );
551cdf0e10cSrcweir 	Show();
552cdf0e10cSrcweir 
553cdf0e10cSrcweir 	aVScrollBar.SetScrollHdl ( LINK( this, EditMainWindow, VScrollHdl ) );
554cdf0e10cSrcweir 	aVScrollBar.SetLineSize( 300 );
555cdf0e10cSrcweir 	aVScrollBar.SetPageSize( 2000 );
556cdf0e10cSrcweir 	aHScrollBar.SetScrollHdl ( LINK( this, EditMainWindow, HScrollHdl ) );
557cdf0e10cSrcweir 	aHScrollBar.SetLineSize( 300 );
558cdf0e10cSrcweir 	aHScrollBar.SetPageSize( 2000 );
559cdf0e10cSrcweir 	aHScrollBar.Enable();
560cdf0e10cSrcweir 	aVScrollBar.Enable();
561cdf0e10cSrcweir 
562cdf0e10cSrcweir 	aViewWin.GetEditView()->GetEditEngine()->SetStatusEventHdl( LINK( this, EditMainWindow, ShowStatus ) );
563cdf0e10cSrcweir 
564cdf0e10cSrcweir 	SetTitle();
565cdf0e10cSrcweir 
566cdf0e10cSrcweir 	UpdateToolBox();
567cdf0e10cSrcweir 	aToolBox.Show();
568cdf0e10cSrcweir 	aViewWin.Show();
569cdf0e10cSrcweir }
570cdf0e10cSrcweir 
SetTitle()571cdf0e10cSrcweir void EditMainWindow::SetTitle()
572cdf0e10cSrcweir {
573cdf0e10cSrcweir 	String aHeading( String( RTL_CONSTASCII_USTRINGPARAM( "SvEdit!  -  Zoom " ) ) );
574cdf0e10cSrcweir 	aHeading += String::CreateFromInt32(nZoom);
575cdf0e10cSrcweir 	aHeading += '%';
576cdf0e10cSrcweir 	EditEngine* pEditEngine = aViewWin.GetEditView()->GetEditEngine();
577cdf0e10cSrcweir 	if ( pEditEngine->GetControlWord() & EE_CNTRL_STRETCHING )
578cdf0e10cSrcweir 	{
579cdf0e10cSrcweir 		USHORT nX, nY;
580cdf0e10cSrcweir 		pEditEngine->GetGlobalCharStretching( nX, nY );
581cdf0e10cSrcweir 		aHeading += String( RTL_CONSTASCII_USTRINGPARAM( ", Stretch=(" ) );
582cdf0e10cSrcweir 		aHeading += String::CreateFromInt32(nX);
583cdf0e10cSrcweir 		aHeading += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) );
584cdf0e10cSrcweir 		aHeading += String::CreateFromInt32(nY);
585cdf0e10cSrcweir 		aHeading += ')';
586cdf0e10cSrcweir 	}
587cdf0e10cSrcweir 	SetText( aHeading );
588cdf0e10cSrcweir }
589cdf0e10cSrcweir 
UpdateToolBox()590cdf0e10cSrcweir void EditMainWindow::UpdateToolBox()
591cdf0e10cSrcweir {
592cdf0e10cSrcweir 	EditView* pEditView = aViewWin.GetEditView();
593cdf0e10cSrcweir 	EditEngine* pEditEngine = pEditView->GetEditEngine();
594cdf0e10cSrcweir 	SfxItemSet aCurSet( pEditView->GetAttribs() );
595cdf0e10cSrcweir 
596cdf0e10cSrcweir 	ULONG nControl = pEditEngine->GetControlWord();
597cdf0e10cSrcweir 	aToolBox.EnableItem( TB_UNDO, (BOOL)pEditEngine->GetUndoManager().GetUndoActionCount() );
598cdf0e10cSrcweir 	aToolBox.EnableItem( TB_REDO, (BOOL)pEditEngine->GetUndoManager().GetRedoActionCount() );
599cdf0e10cSrcweir 	aToolBox.EnableItem( TB_BINOBJ2b, (BOOL)(long)pBinObj );
600cdf0e10cSrcweir 	aToolBox.EnableItem( TB_MOVE, pEditEngine->GetParagraphCount() > 3 );
601cdf0e10cSrcweir 	aToolBox.CheckItem( TB_ONLINESPELL, nControl & EE_CNTRL_ONLINESPELLING ? TRUE : FALSE );
602cdf0e10cSrcweir 	aToolBox.CheckItem( TB_AUTOCORRECT, nControl & EE_CNTRL_AUTOCORRECT ? TRUE : FALSE );
603cdf0e10cSrcweir //	aToolBox.CheckItem( TB_HYPH, nControl & EE_CNTRL_HYPHENATE ? TRUE : FALSE );
604cdf0e10cSrcweir 	aToolBox.CheckItem( TB_REDLINES, nControl & EE_CNTRL_NOREDLINES ? FALSE : TRUE );
605cdf0e10cSrcweir 	aToolBox.CheckItem( TB_STDSEL, pEditView->GetSelectionMode() == EE_SELMODE_STD );
606cdf0e10cSrcweir 	aToolBox.CheckItem( TB_FLAT, pEditEngine->IsFlatMode() );
607cdf0e10cSrcweir 	aToolBox.CheckItem( TB_OUTL, ( nControl & EE_CNTRL_OUTLINER ) ? TRUE : FALSE );
608cdf0e10cSrcweir 	aToolBox.CheckItem( TB_POLY, pEditEngine->GetPolygon() ? TRUE : FALSE );
609cdf0e10cSrcweir 	aToolBox.CheckItem( TB_COLORS, ( nControl & EE_CNTRL_NOCOLORS ) ? FALSE : TRUE );
610cdf0e10cSrcweir 	aToolBox.CheckItem( TB_IDLE, pEditEngine->IsIdleFormatterEnabled() );
611cdf0e10cSrcweir 	aToolBox.CheckItem( TB_INSERT, pEditView->IsInsertMode() );
612cdf0e10cSrcweir 
613cdf0e10cSrcweir 	for ( USHORT nWhich = EE_ITEMS_START; nWhich <= EE_ITEMS_END; nWhich++)
614cdf0e10cSrcweir 	{
615cdf0e10cSrcweir //		if ( aCurSet.GetItemState( nWhich ) == SFX_ITEM_OFF )
616cdf0e10cSrcweir //			;
617cdf0e10cSrcweir //		else if ( aCurSet.GetItemState( nWhich ) == SFX_ITEM_DONTCARE )
618cdf0e10cSrcweir //			;
619cdf0e10cSrcweir //		else if ( aCurSet.GetItemState( nWhich ) == SFX_ITEM_ON )
620cdf0e10cSrcweir 		{
621cdf0e10cSrcweir 			const SfxPoolItem& rItem = aCurSet.Get( nWhich );
622cdf0e10cSrcweir 			switch ( nWhich )
623cdf0e10cSrcweir 			{
624cdf0e10cSrcweir 				case EE_PARA_HYPHENATE:
625cdf0e10cSrcweir 					aToolBox.CheckItem( TB_HYPH, ((SfxBoolItem&)rItem).GetValue() != 0 );
626cdf0e10cSrcweir 				break;
627cdf0e10cSrcweir 				case EE_PARA_LRSPACE:
628cdf0e10cSrcweir 					aToolBox.CheckItem( TB_LR, ((SvxLRSpaceItem&)rItem).GetTxtLeft() != 0 );
629cdf0e10cSrcweir 				break;
630cdf0e10cSrcweir 				case EE_PARA_ULSPACE:
631cdf0e10cSrcweir 					aToolBox.CheckItem( TB_SBSA, ((SvxULSpaceItem&)rItem).GetUpper() != 0 );
632cdf0e10cSrcweir 				break;
633cdf0e10cSrcweir 				case EE_PARA_SBL:
634cdf0e10cSrcweir 					aToolBox.CheckItem( TB_SBL, ((SvxLineSpacingItem&)rItem).GetPropLineSpace() != 100 );
635cdf0e10cSrcweir 				break;
636cdf0e10cSrcweir 				case EE_PARA_JUST:
637cdf0e10cSrcweir 				{
638cdf0e10cSrcweir 					SvxAdjust e = ((SvxAdjustItem&)rItem).GetAdjust();
639cdf0e10cSrcweir 					aToolBox.CheckItem( TB_LEFT, e == SVX_ADJUST_LEFT );
640cdf0e10cSrcweir 					aToolBox.CheckItem( TB_RIGHT, e == SVX_ADJUST_RIGHT);
641cdf0e10cSrcweir 					aToolBox.CheckItem( TB_CENTER, e == SVX_ADJUST_CENTER);
642cdf0e10cSrcweir 					aToolBox.CheckItem( TB_BLOCK, e == SVX_ADJUST_BLOCK );
643cdf0e10cSrcweir 				}
644cdf0e10cSrcweir 				break;
645cdf0e10cSrcweir 				case EE_PARA_TABS:
646cdf0e10cSrcweir 				break;
647cdf0e10cSrcweir 				case EE_CHAR_COLOR:
648cdf0e10cSrcweir 				{
649cdf0e10cSrcweir 					Color aColor( ((SvxColorItem&)rItem).GetValue() );
650cdf0e10cSrcweir 					aToolBox.CheckItem( TB_BLACK, aColor == COL_BLACK );
651cdf0e10cSrcweir 					aToolBox.CheckItem( TB_GREEN, aColor == COL_GREEN );
652cdf0e10cSrcweir 					aToolBox.CheckItem( TB_RED, aColor == COL_RED );
653cdf0e10cSrcweir 				}
654cdf0e10cSrcweir 				break;
655cdf0e10cSrcweir 				case EE_CHAR_FONTINFO:
656cdf0e10cSrcweir 				{
657cdf0e10cSrcweir 					FontFamily e = ((SvxFontItem&)rItem).GetFamily();
658cdf0e10cSrcweir 					aToolBox.CheckItem( TB_FONT1, e == FAMILY_ROMAN );
659cdf0e10cSrcweir 					aToolBox.CheckItem( TB_FONT2, e == FAMILY_SWISS );
660cdf0e10cSrcweir 				}
661cdf0e10cSrcweir 				break;
662cdf0e10cSrcweir 				case EE_CHAR_FONTHEIGHT:
663cdf0e10cSrcweir 				break;
664cdf0e10cSrcweir 				case EE_CHAR_WEIGHT:
665cdf0e10cSrcweir 				{
666cdf0e10cSrcweir 					FontWeight e = ((SvxWeightItem&)rItem).GetWeight();
667cdf0e10cSrcweir 					aToolBox.CheckItem( TB_BOLD, e == WEIGHT_BOLD );
668cdf0e10cSrcweir 				}
669cdf0e10cSrcweir 				break;
670cdf0e10cSrcweir 				case EE_CHAR_UNDERLINE:
671cdf0e10cSrcweir 				{
672cdf0e10cSrcweir 					aToolBox.CheckItem( TB_UNDERLINE, ((SvxUnderlineItem&)rItem).GetLineStyle() );
673cdf0e10cSrcweir 				}
674cdf0e10cSrcweir 				break;
675cdf0e10cSrcweir 				case EE_CHAR_WLM:
676cdf0e10cSrcweir 				{
677cdf0e10cSrcweir 					aToolBox.CheckItem( TB_WLM, ((SvxWordLineModeItem&)rItem).GetValue() );
678cdf0e10cSrcweir 				}
679cdf0e10cSrcweir 				break;
680cdf0e10cSrcweir 				case EE_CHAR_PAIRKERNING:
681cdf0e10cSrcweir 				{
682cdf0e10cSrcweir 					aToolBox.CheckItem( TB_PKERN, ((SvxAutoKernItem&)rItem).GetValue() );
683cdf0e10cSrcweir 				}
684cdf0e10cSrcweir 				break;
685cdf0e10cSrcweir 				case EE_CHAR_KERNING:
686cdf0e10cSrcweir 				{
687cdf0e10cSrcweir 					aToolBox.CheckItem( TB_KERN, (BOOL)((SvxKerningItem&)rItem).GetValue() );
688cdf0e10cSrcweir 				}
689cdf0e10cSrcweir 				break;
690cdf0e10cSrcweir 				case EE_CHAR_ESCAPEMENT:
691cdf0e10cSrcweir 				{
692cdf0e10cSrcweir 					aToolBox.CheckItem( TB_SUPER, ((SvxEscapementItem&)rItem).GetEsc() > 0 );
693cdf0e10cSrcweir 					aToolBox.CheckItem( TB_SUB, ((SvxEscapementItem&)rItem).GetEsc() < 0 );
694cdf0e10cSrcweir 				}
695cdf0e10cSrcweir 				break;
696cdf0e10cSrcweir 				case EE_CHAR_STRIKEOUT:
697cdf0e10cSrcweir 				break;
698cdf0e10cSrcweir 				case EE_CHAR_ITALIC:
699cdf0e10cSrcweir 				{
700cdf0e10cSrcweir 					FontItalic e = ((SvxPostureItem&)rItem).GetPosture();
701cdf0e10cSrcweir 					aToolBox.CheckItem( TB_ITALIC, e == ITALIC_NORMAL );
702cdf0e10cSrcweir 				}
703cdf0e10cSrcweir 				break;
704cdf0e10cSrcweir 				case EE_CHAR_OUTLINE:
705cdf0e10cSrcweir 				break;
706cdf0e10cSrcweir 				case EE_CHAR_SHADOW:
707cdf0e10cSrcweir 				break;
708cdf0e10cSrcweir 			}
709cdf0e10cSrcweir 		}
710cdf0e10cSrcweir 	}
711cdf0e10cSrcweir }
712cdf0e10cSrcweir 
IMPL_LINK(EditMainWindow,TBSelect,ToolBox *,p)713cdf0e10cSrcweir IMPL_LINK( EditMainWindow, TBSelect, ToolBox *, p )
714cdf0e10cSrcweir {
715cdf0e10cSrcweir 	EditView* pEditView = aViewWin.GetEditView();
716cdf0e10cSrcweir 	EditEngine* pEditEngine = pEditView->GetEditEngine();
717cdf0e10cSrcweir 	USHORT nId = aToolBox.GetCurItemId();
718cdf0e10cSrcweir 	BOOL bChecked = aToolBox.IsItemChecked( nId );
719cdf0e10cSrcweir 	SfxPoolItem* pNewItem = 0;
720cdf0e10cSrcweir 	switch ( nId )
721cdf0e10cSrcweir 	{
722cdf0e10cSrcweir 		case TB_LEFT:	pNewItem = new SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST );
723cdf0e10cSrcweir 						break;
724cdf0e10cSrcweir 		case TB_RIGHT:	pNewItem = new SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST );
725cdf0e10cSrcweir 						break;
726cdf0e10cSrcweir 		case TB_CENTER:	pNewItem = new SvxAdjustItem( SVX_ADJUST_CENTER, EE_PARA_JUST );
727cdf0e10cSrcweir 						break;
728cdf0e10cSrcweir 		case TB_BLOCK:	pNewItem = new SvxAdjustItem( SVX_ADJUST_BLOCK, EE_PARA_JUST );
729cdf0e10cSrcweir 						break;
730cdf0e10cSrcweir 		case TB_HYPH: 	pNewItem = new SfxBoolItem( EE_PARA_HYPHENATE, !bChecked );
731cdf0e10cSrcweir 						break;
732cdf0e10cSrcweir 		case TB_UNDO:	pEditView->Undo();
733cdf0e10cSrcweir 						pEditView->ShowCursor();
734cdf0e10cSrcweir 						break;
735cdf0e10cSrcweir 		case TB_REDO:	pEditView->Redo();
736cdf0e10cSrcweir 						pEditView->ShowCursor();
737cdf0e10cSrcweir 						break;
738cdf0e10cSrcweir 		case TB_ONLINESPELL: {
739cdf0e10cSrcweir 							ULONG nControl = pEditView->GetEditEngine()->GetControlWord();
740cdf0e10cSrcweir 							if ( bChecked )
741cdf0e10cSrcweir 								nControl = nControl & ~EE_CNTRL_ONLINESPELLING;
742cdf0e10cSrcweir 							else
743cdf0e10cSrcweir 								nControl = nControl | EE_CNTRL_ONLINESPELLING;
744cdf0e10cSrcweir 							pEditView->GetEditEngine()->SetControlWord( nControl );
745cdf0e10cSrcweir 							}
746cdf0e10cSrcweir 							break;
747cdf0e10cSrcweir 		case TB_REDLINES: {
748cdf0e10cSrcweir 							ULONG nControl = pEditView->GetEditEngine()->GetControlWord();
749cdf0e10cSrcweir 							if ( !bChecked )
750cdf0e10cSrcweir 								nControl = nControl & ~EE_CNTRL_NOREDLINES;
751cdf0e10cSrcweir 							else
752cdf0e10cSrcweir 								nControl = nControl | EE_CNTRL_NOREDLINES;
753cdf0e10cSrcweir 							pEditView->GetEditEngine()->SetControlWord( nControl );
754cdf0e10cSrcweir 							}
755cdf0e10cSrcweir 							break;
756cdf0e10cSrcweir 		case TB_AUTOCORRECT: {
757cdf0e10cSrcweir 							ULONG nControl = pEditView->GetEditEngine()->GetControlWord();
758cdf0e10cSrcweir 							if ( bChecked )
759cdf0e10cSrcweir 								nControl = nControl & ~EE_CNTRL_AUTOCORRECT;
760cdf0e10cSrcweir 							else
761cdf0e10cSrcweir 								nControl = nControl | EE_CNTRL_AUTOCORRECT;
762cdf0e10cSrcweir 							pEditView->GetEditEngine()->SetControlWord( nControl );
763cdf0e10cSrcweir 							}
764cdf0e10cSrcweir 							break;
765cdf0e10cSrcweir 		case TB_STDSEL:	if ( bChecked )
766cdf0e10cSrcweir 							pEditView->SetSelectionMode( EE_SELMODE_TXTONLY );
767cdf0e10cSrcweir 						else
768cdf0e10cSrcweir 							pEditView->SetSelectionMode( EE_SELMODE_STD );
769cdf0e10cSrcweir 						break;
770cdf0e10cSrcweir 		case TB_FLAT:	pEditEngine->SetFlatMode( !pEditEngine->IsFlatMode() );
771cdf0e10cSrcweir 						break;
772cdf0e10cSrcweir 		case TB_COLORS:	{
773cdf0e10cSrcweir 							ULONG nControl = pEditView->GetEditEngine()->GetControlWord();
774cdf0e10cSrcweir 							if ( bChecked )
775cdf0e10cSrcweir 								nControl = nControl | EE_CNTRL_NOCOLORS;
776cdf0e10cSrcweir 							else
777cdf0e10cSrcweir 								nControl = nControl & ~EE_CNTRL_NOCOLORS;
778cdf0e10cSrcweir 							pEditView->GetEditEngine()->SetControlWord( nControl );
779cdf0e10cSrcweir 						}
780cdf0e10cSrcweir //						aViewWin.Invalidate();
781cdf0e10cSrcweir 						pEditView->GetEditEngine()->Draw( pEditView->GetWindow(), pEditView->GetOutputArea(), pEditView->GetVisArea().TopLeft() );
782cdf0e10cSrcweir 						break;
783cdf0e10cSrcweir 		case TB_OUTL:	{
784cdf0e10cSrcweir 							ULONG nControl = pEditView->GetEditEngine()->GetControlWord();
785cdf0e10cSrcweir 							if ( !bChecked )
786cdf0e10cSrcweir 								nControl = nControl | EE_CNTRL_OUTLINER;
787cdf0e10cSrcweir 							else
788cdf0e10cSrcweir 								nControl = nControl & ~EE_CNTRL_OUTLINER;
789cdf0e10cSrcweir 							pEditView->GetEditEngine()->SetControlWord( nControl );
790cdf0e10cSrcweir 						}
791cdf0e10cSrcweir 						break;
792cdf0e10cSrcweir 		case TB_POLY:	{
793cdf0e10cSrcweir 							if ( !bChecked )
794cdf0e10cSrcweir 								CreatePolygon();
795cdf0e10cSrcweir 							else
796cdf0e10cSrcweir 								pEditView->GetEditEngine()->ClearPolygon();
797cdf0e10cSrcweir 						}
798cdf0e10cSrcweir 						break;
799cdf0e10cSrcweir 		case TB_IDLE:	pEditEngine->EnableIdleFormatter( !pEditEngine->IsIdleFormatterEnabled() );
800cdf0e10cSrcweir 						break;
801cdf0e10cSrcweir 		case TB_INSFLD:	{
802cdf0e10cSrcweir 						static BYTE nFld = 0;
803cdf0e10cSrcweir 						if ( nFld > 2 )
804cdf0e10cSrcweir 							nFld = 0;
805cdf0e10cSrcweir 						if ( nFld == 0 )
806cdf0e10cSrcweir 						{
807cdf0e10cSrcweir 							SvxFieldItem aFld( SvxURLField( String( RTL_CONSTASCII_USTRINGPARAM( "www.mopo.de" ) ), String( RTL_CONSTASCII_USTRINGPARAM( "Bla" ) ), SVXURLFORMAT_REPR ), EE_FEATURE_FIELD  );
808cdf0e10cSrcweir 							pEditView->InsertField( aFld );
809cdf0e10cSrcweir 						}
810cdf0e10cSrcweir 						else if ( nFld == 1 )
811cdf0e10cSrcweir 							pEditView->InsertField( SvxFieldItem( SvxURLField( String( RTL_CONSTASCII_USTRINGPARAM( "www.mopo.de" ) ), String( RTL_CONSTASCII_USTRINGPARAM( "Morgenpost" ) ), SVXURLFORMAT_URL ), EE_FEATURE_FIELD  ) );
812cdf0e10cSrcweir 						else if ( nFld == 2 )
813cdf0e10cSrcweir 							pEditView->InsertField( SvxFieldItem( SvxDateField( Date( 1,1,1995 ), SVXDATETYPE_FIX, SVXDATEFORMAT_D ), EE_FEATURE_FIELD ) );
814cdf0e10cSrcweir 
815cdf0e10cSrcweir 						nFld++;
816cdf0e10cSrcweir 		}
817cdf0e10cSrcweir 						break;
818cdf0e10cSrcweir 		case TB_UPDFLD:	pEditEngine->UpdateFields();
819cdf0e10cSrcweir 						break;
820cdf0e10cSrcweir 		case TB_INSERT:	pEditView->SetInsertMode( !pEditView->IsInsertMode() );
821cdf0e10cSrcweir 						break;
822cdf0e10cSrcweir 		case TB_FONT1:	pNewItem = new SvxFontItem( FAMILY_ROMAN, String( RTL_CONSTASCII_USTRINGPARAM( "Times New Roman" ) ), String(), PITCH_DONTKNOW, RTL_TEXTENCODING_MS_1252, EE_CHAR_FONTINFO );
823cdf0e10cSrcweir 						break;
824cdf0e10cSrcweir 		case TB_FONT2:	pNewItem = new SvxFontItem( FAMILY_SWISS, String( RTL_CONSTASCII_USTRINGPARAM( "Helv" ) ), String(), PITCH_DONTKNOW, RTL_TEXTENCODING_MS_1252, EE_CHAR_FONTINFO );
825cdf0e10cSrcweir 						break;
826cdf0e10cSrcweir /*
827cdf0e10cSrcweir 		case TB_FONT:
828cdf0e10cSrcweir 		{
829cdf0e10cSrcweir 			FontDialog* pDlg = new FontDialog( this, WB_SVLOOK );
830cdf0e10cSrcweir 			pDlg->SetPrinter( pPrinter );
831cdf0e10cSrcweir 			Font aFont = pEditEngine->CreateFontFromItemSet( pEditView->GetAttribs() );
832cdf0e10cSrcweir 			MapMode aPntMode( MAP_POINT );
833cdf0e10cSrcweir 			MapMode aCurrent( aViewWin.GetMapMode() );
834cdf0e10cSrcweir 			Size aSz(  aViewWin.LogicToLogic( aFont.GetSize(), &aCurrent, &aPntMode ) );
835cdf0e10cSrcweir 			aSz.Width() *= 10;
836cdf0e10cSrcweir 			aSz.Height() *= 10;
837cdf0e10cSrcweir 			aFont.SetSize(  aSz );
838cdf0e10cSrcweir 			pDlg->SetSelectFont( aFont );
839cdf0e10cSrcweir 			if ( pDlg->Execute() )
840cdf0e10cSrcweir 			{
841cdf0e10cSrcweir 				Font aNewFont( pDlg->GetSelectFont() );
842cdf0e10cSrcweir 				aSz = aViewWin.LogicToLogic( aNewFont.GetSize(), &aPntMode, &aCurrent );
843cdf0e10cSrcweir 				aSz.Width() /= 10;
844cdf0e10cSrcweir 				aSz.Height() /= 10;
845cdf0e10cSrcweir 				aNewFont.SetSize( aSz );
846cdf0e10cSrcweir 
847cdf0e10cSrcweir 				SfxItemSet aSet( pEditEngine->GetEmptyItemSet() );
848cdf0e10cSrcweir 
849cdf0e10cSrcweir 				pEditEngine->SetFontInfoInItemSet( aSet, aNewFont );
850cdf0e10cSrcweir 				pEditView->SetAttribs( aSet );
851cdf0e10cSrcweir 			}
852cdf0e10cSrcweir 			delete pDlg;
853cdf0e10cSrcweir 		}
854cdf0e10cSrcweir 		break;
855cdf0e10cSrcweir */
856cdf0e10cSrcweir 		case TB_BOLD:	if ( bChecked )
857cdf0e10cSrcweir 							pNewItem = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT);
858cdf0e10cSrcweir 						else
859cdf0e10cSrcweir 							pNewItem = new SvxWeightItem( WEIGHT_BOLD, EE_CHAR_WEIGHT);
860cdf0e10cSrcweir 						break;
861cdf0e10cSrcweir 		case TB_ITALIC:	if ( bChecked )
862cdf0e10cSrcweir 							pNewItem = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC );
863cdf0e10cSrcweir 						else
864cdf0e10cSrcweir 							pNewItem = new SvxPostureItem( ITALIC_NORMAL, EE_CHAR_ITALIC );
865cdf0e10cSrcweir 						break;
866cdf0e10cSrcweir 		case TB_UNDERLINE:	if ( bChecked )
867cdf0e10cSrcweir 								pNewItem = new SvxUnderlineItem( UNDERLINE_NONE, EE_CHAR_UNDERLINE );
868cdf0e10cSrcweir 							else
869cdf0e10cSrcweir 								pNewItem = new SvxUnderlineItem( UNDERLINE_SINGLE, EE_CHAR_UNDERLINE );
870cdf0e10cSrcweir 						break;
871cdf0e10cSrcweir 		case TB_WLM:	pNewItem = new SvxWordLineModeItem( !bChecked, EE_CHAR_WLM );
872cdf0e10cSrcweir 						break;
873cdf0e10cSrcweir 		case TB_PKERN:	pNewItem = new SvxAutoKernItem( !bChecked, EE_CHAR_PAIRKERNING );
874cdf0e10cSrcweir 						break;
875cdf0e10cSrcweir 		case TB_KERN:	if ( bChecked )
876cdf0e10cSrcweir 								pNewItem = new SvxKerningItem( 0, EE_CHAR_KERNING );
877cdf0e10cSrcweir 							else
878cdf0e10cSrcweir 								pNewItem = new SvxKerningItem( 100, EE_CHAR_KERNING);
879cdf0e10cSrcweir 						break;
880cdf0e10cSrcweir 		case TB_SUPER:	if ( bChecked )
881cdf0e10cSrcweir 								pNewItem = new SvxEscapementItem( SVX_ESCAPEMENT_OFF, EE_CHAR_ESCAPEMENT);
882cdf0e10cSrcweir 							else
883cdf0e10cSrcweir //								pNewItem = new SvxEscapementItem( SVX_ESCAPEMENT_SUPERSCRIPT, EE_CHAR_ESCAPEMENT);
884cdf0e10cSrcweir 								pNewItem = new SvxEscapementItem( 50, 100, EE_CHAR_ESCAPEMENT );
885cdf0e10cSrcweir 						break;
886cdf0e10cSrcweir 		case TB_SUB:	if ( bChecked )
887cdf0e10cSrcweir 								pNewItem = new SvxEscapementItem( SVX_ESCAPEMENT_OFF, EE_CHAR_ESCAPEMENT);
888cdf0e10cSrcweir 							else
889cdf0e10cSrcweir //								pNewItem = new SvxEscapementItem( SVX_ESCAPEMENT_SUBSCRIPT, EE_CHAR_ESCAPEMENT);
890cdf0e10cSrcweir 								pNewItem = new SvxEscapementItem( -50, 100, EE_CHAR_ESCAPEMENT );
891cdf0e10cSrcweir 						break;
892cdf0e10cSrcweir 		case TB_GREEN:	pNewItem = new SvxColorItem( Color(COL_GREEN), EE_CHAR_COLOR);
893cdf0e10cSrcweir 						break;
894cdf0e10cSrcweir 		case TB_RED:	pNewItem = new SvxColorItem( Color(COL_RED), EE_CHAR_COLOR);
895cdf0e10cSrcweir 						break;
896cdf0e10cSrcweir 		case TB_BLACK:	pNewItem = new SvxColorItem( Color(COL_BLACK), EE_CHAR_COLOR);
897cdf0e10cSrcweir 						break;
898cdf0e10cSrcweir 		case TB_SBL:	pNewItem = new SvxLineSpacingItem( 0, EE_PARA_SBL );
899cdf0e10cSrcweir 						if ( bChecked )
900cdf0e10cSrcweir 						{
901cdf0e10cSrcweir 							((SvxLineSpacingItem*)pNewItem)->SetInterLineSpace( 0 );
902cdf0e10cSrcweir 						}
903cdf0e10cSrcweir 						else
904cdf0e10cSrcweir 						{
905cdf0e10cSrcweir 							((SvxLineSpacingItem*)pNewItem)->SetPropLineSpace( 150 );
906cdf0e10cSrcweir 						}
907cdf0e10cSrcweir 						break;
908cdf0e10cSrcweir 		case TB_SBSA:	pNewItem = new SvxULSpaceItem( EE_PARA_ULSPACE );
909cdf0e10cSrcweir 						if ( !bChecked )
910cdf0e10cSrcweir 						{
911cdf0e10cSrcweir 							((SvxULSpaceItem*)pNewItem)->SetUpper( 400 );
912cdf0e10cSrcweir 							((SvxULSpaceItem*)pNewItem)->SetLower( 400 );
913cdf0e10cSrcweir 						}
914cdf0e10cSrcweir 						break;
915cdf0e10cSrcweir 		case TB_LR:		pNewItem = new SvxLRSpaceItem( EE_PARA_LRSPACE );
916cdf0e10cSrcweir 						if ( !bChecked )
917cdf0e10cSrcweir 						{
918cdf0e10cSrcweir 							((SvxLRSpaceItem*)pNewItem)->SetTxtLeft( 1000 );
919cdf0e10cSrcweir 							((SvxLRSpaceItem*)pNewItem)->SetTxtFirstLineOfst( -500 );
920cdf0e10cSrcweir 							((SvxLRSpaceItem*)pNewItem)->SetRight( 500 );
921cdf0e10cSrcweir 						}
922cdf0e10cSrcweir 						break;
923cdf0e10cSrcweir 		case TB_DEFTAB:	if ( bChecked )
924cdf0e10cSrcweir 							pEditEngine->SetDefTab( 2000 );
925cdf0e10cSrcweir 						else
926cdf0e10cSrcweir 							pEditEngine->SetDefTab( 600 );
927cdf0e10cSrcweir 						pEditView->ShowCursor();
928cdf0e10cSrcweir 						aToolBox.CheckItem( nId, !bChecked );
929cdf0e10cSrcweir 						break;
930cdf0e10cSrcweir 		case TB_DRAW:   {
931cdf0e10cSrcweir 							pTmpWindow->SetMapMode( aViewWin.GetMapMode() );
932cdf0e10cSrcweir 							pTmpWindow->SetBackgroundBrush( Brush( Color( COL_GRAY ) ) );
933cdf0e10cSrcweir 							pTmpWindow->SetFillInBrush( Brush( Color( COL_LIGHTGRAY ) ) );
934cdf0e10cSrcweir 							pTmpWindow->Show();
935cdf0e10cSrcweir 							pTmpWindow->Invalidate();
936cdf0e10cSrcweir 							pTmpWindow->Update();
937cdf0e10cSrcweir 							pTmpWindow->DrawText( Point( 20, 20 ), String( RTL_CONSTASCII_USTRINGPARAM( "It's a Test..." ) ) );
938cdf0e10cSrcweir 							Rectangle aRect( Point( 500, 500 ), Size( 10000, 4000 ) );
939cdf0e10cSrcweir 							pTmpWindow->DrawRect( aRect );
940cdf0e10cSrcweir 							pEditEngine->Draw( pTmpWindow, aRect, Point( 0, 0 ) );
941cdf0e10cSrcweir 							nRotation = 0;
942cdf0e10cSrcweir 						}
943cdf0e10cSrcweir 						break;
944cdf0e10cSrcweir 		case TB_ROTATE:   {
945cdf0e10cSrcweir 							nRotation += 100;
946cdf0e10cSrcweir 							if ( nRotation == 3600 )
947cdf0e10cSrcweir 								nRotation = 0;
948cdf0e10cSrcweir 							pTmpWindow->SetMapMode( aViewWin.GetMapMode() );
949cdf0e10cSrcweir 							pTmpWindow->SetBackgroundBrush( Brush( Color( COL_LIGHTGRAY ) ) );
950cdf0e10cSrcweir 							pTmpWindow->SetFillInBrush( Brush( Color( COL_LIGHTGRAY ) ) );
951cdf0e10cSrcweir 							pTmpWindow->Show();
952cdf0e10cSrcweir 							pTmpWindow->Invalidate();
953cdf0e10cSrcweir 							pTmpWindow->Update();
954cdf0e10cSrcweir 							pTmpWindow->DrawText( Point( 20, 20 ), String( RTL_CONSTASCII_USTRINGPARAM( "It's a Test..." ) ) );
955cdf0e10cSrcweir 							Rectangle aRect( Point( 500, 500 ), Size( 10000, 4000 ) );
956cdf0e10cSrcweir 							pEditEngine->Draw( pTmpWindow, Point( 2000, 4000 ), nRotation );
957cdf0e10cSrcweir 						}
958cdf0e10cSrcweir 						break;
959cdf0e10cSrcweir 
960cdf0e10cSrcweir 		case TB_MOVE:
961cdf0e10cSrcweir 		{
962cdf0e10cSrcweir 			ESelection aESel = pEditView->GetSelection();
963cdf0e10cSrcweir 			USHORT nStartPara = Min( aESel.nStartPara, aESel.nEndPara );
964cdf0e10cSrcweir 			USHORT nEndPara = Max( aESel.nStartPara, aESel.nEndPara );
965cdf0e10cSrcweir 			pEditView->MoveParagraphs( Range(nStartPara,nEndPara), 2 );
966cdf0e10cSrcweir 		}
967cdf0e10cSrcweir 		break;
968cdf0e10cSrcweir 		case TB_PARATTR1:
969cdf0e10cSrcweir 		{
970cdf0e10cSrcweir 			pEditEngine->SetUpdateMode( FALSE );
971cdf0e10cSrcweir 			USHORT nPara = 0;
972cdf0e10cSrcweir 			SfxItemSet aSet( pEditEngine->GetEmptyItemSet() );
973cdf0e10cSrcweir 			aSet.Put( SvxFontItem( FAMILY_DECORATIVE, String( RTL_CONSTASCII_USTRINGPARAM( "StarBats" ) ), String(),PITCH_DONTKNOW, RTL_TEXTENCODING_MS_1252, EE_CHAR_FONTINFO ) );
974cdf0e10cSrcweir 			aSet.Put( SvxColorItem( Color(COL_MAGENTA), EE_CHAR_COLOR ) );
975cdf0e10cSrcweir 			aSet.Put( SvxFontHeightItem(600, 100, EE_CHAR_FONTHEIGHT) );
976cdf0e10cSrcweir 			aSet.Put( SvxPostureItem( ITALIC_NORMAL, EE_CHAR_ITALIC ) );
977cdf0e10cSrcweir 			aSet.Put( SvxLRSpaceItem( 0, 0, 1000, 0, EE_PARA_LRSPACE ) );
978cdf0e10cSrcweir 			pEditView->SetParaAttribs( aSet, nPara );
979cdf0e10cSrcweir 			pEditEngine->SetUpdateMode( TRUE );
980cdf0e10cSrcweir 			pEditView->ShowCursor();
981cdf0e10cSrcweir 		}
982cdf0e10cSrcweir 		break;
983cdf0e10cSrcweir 		case TB_BINOBJ1:
984cdf0e10cSrcweir 		{
985cdf0e10cSrcweir 			delete pBinObj;
986cdf0e10cSrcweir 			pBinObj = pEditEngine->CreateTextObject();
987cdf0e10cSrcweir 		}
988cdf0e10cSrcweir 		break;
989cdf0e10cSrcweir 		case TB_BINOBJ1b:
990cdf0e10cSrcweir 		{
991cdf0e10cSrcweir 			delete pBinObj;
992cdf0e10cSrcweir 			pBinObj = pEditView->CreateTextObject();
993cdf0e10cSrcweir 		}
994cdf0e10cSrcweir 		break;
995cdf0e10cSrcweir 		case TB_CLONEBIN:
996cdf0e10cSrcweir 		{
997cdf0e10cSrcweir 			if ( pBinObj )
998cdf0e10cSrcweir 			{
999cdf0e10cSrcweir 				EditTextObject* p = pBinObj->Clone();
1000cdf0e10cSrcweir 				delete pBinObj;
1001cdf0e10cSrcweir 				pBinObj = p;
1002cdf0e10cSrcweir 			}
1003cdf0e10cSrcweir 		}
1004cdf0e10cSrcweir 		break;
1005cdf0e10cSrcweir 		case TB_BINOBJ2b:
1006cdf0e10cSrcweir 		{
1007cdf0e10cSrcweir 			if ( pBinObj )
1008cdf0e10cSrcweir 			{
1009cdf0e10cSrcweir 				pEditView->InsertText( *pBinObj );
1010cdf0e10cSrcweir 			}
1011cdf0e10cSrcweir 		}
1012cdf0e10cSrcweir 		break;
1013cdf0e10cSrcweir 		case TB_BINOBJ3:
1014cdf0e10cSrcweir 		{
1015cdf0e10cSrcweir 			if ( !pFileDialogBox2->Execute() )
1016cdf0e10cSrcweir 				return FALSE;
1017cdf0e10cSrcweir 			DirEntry aDirEntry( pFileDialogBox2->GetPath() );
1018cdf0e10cSrcweir 			SvFileStream aStrm( aDirEntry.GetFull(), STREAM_WRITE | STREAM_TRUNC );
1019cdf0e10cSrcweir 			EditTextObject* pTmpObj = pEditEngine->CreateTextObject();
1020cdf0e10cSrcweir 			pTmpObj->Store( aStrm );
1021cdf0e10cSrcweir 			DBG_ASSERT( !aStrm.GetError(), "Store: Error!" );
1022cdf0e10cSrcweir 			delete pTmpObj;
1023cdf0e10cSrcweir 		}
1024cdf0e10cSrcweir 		break;
1025cdf0e10cSrcweir 		case TB_BINOBJ4:
1026cdf0e10cSrcweir 		{
1027cdf0e10cSrcweir 			if ( !pFileDialogBox->Execute() )
1028cdf0e10cSrcweir 				return FALSE;
1029cdf0e10cSrcweir 			DirEntry aDirEntry( pFileDialogBox->GetPath() );
1030cdf0e10cSrcweir 			SvFileStream aStrm( aDirEntry.GetFull(), STREAM_READ );
1031cdf0e10cSrcweir 			delete pBinObj;
1032cdf0e10cSrcweir 			pBinObj = EditTextObject::Create( aStrm );
1033cdf0e10cSrcweir //			EditTextObject* pTmpObj = pEditEngine->CreateTextObject( aStrm );
1034cdf0e10cSrcweir //			pEditEngine->SetText( *pTmpObj );
1035cdf0e10cSrcweir //			pEditView->ShowCursor();
1036cdf0e10cSrcweir //			delete pTmpObj;
1037cdf0e10cSrcweir 		}
1038cdf0e10cSrcweir 		break;
1039cdf0e10cSrcweir 		case TB_OPEN:
1040cdf0e10cSrcweir 		case TB_OPEN2:
1041cdf0e10cSrcweir 		{
1042cdf0e10cSrcweir 			if ( !pFileDialogBox->Execute() )
1043cdf0e10cSrcweir 				return FALSE;
1044cdf0e10cSrcweir 			DirEntry aDirEntry( pFileDialogBox->GetPath() );
1045cdf0e10cSrcweir 			aDirEntry.ToAbs();
1046cdf0e10cSrcweir 			String aFileName( aDirEntry.GetFull() );
1047cdf0e10cSrcweir 			SvFileStream aStrm( aFileName, STREAM_READ );
1048cdf0e10cSrcweir 			if ( aStrm.GetError() )
1049cdf0e10cSrcweir 				InfoBox( 0, String( RTL_CONSTASCII_USTRINGPARAM( "StreamError!" ) ) ).Execute();
1050cdf0e10cSrcweir 			Application::EnterWait();
1051cdf0e10cSrcweir 			if ( nId == TB_OPEN )
1052cdf0e10cSrcweir 			{
1053cdf0e10cSrcweir 				if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "rtf" ) )
1054cdf0e10cSrcweir 					pEditEngine->Read( aStrm, EE_FORMAT_RTF );
1055cdf0e10cSrcweir 				if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "htm" ) )
1056cdf0e10cSrcweir 					pEditEngine->Read( aStrm, EE_FORMAT_HTML );
1057cdf0e10cSrcweir 				if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "html" ) )
1058cdf0e10cSrcweir 					pEditEngine->Read( aStrm, EE_FORMAT_HTML );
1059cdf0e10cSrcweir 				else if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "bin" ) )
1060cdf0e10cSrcweir 					pEditEngine->Read( aStrm, EE_FORMAT_BIN );
1061cdf0e10cSrcweir 				else
1062cdf0e10cSrcweir 					pEditEngine->Read( aStrm, EE_FORMAT_TEXT );
1063cdf0e10cSrcweir 
1064cdf0e10cSrcweir 				pEditView->ShowCursor();
1065cdf0e10cSrcweir 			}
1066cdf0e10cSrcweir 			else
1067cdf0e10cSrcweir 			{
1068cdf0e10cSrcweir 				if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "rtf" ) )
1069cdf0e10cSrcweir 					pEditView->Read( aStrm, EE_FORMAT_RTF );
1070cdf0e10cSrcweir 				else if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "bin" ) )
1071cdf0e10cSrcweir 					pEditView->Read( aStrm, EE_FORMAT_BIN );
1072cdf0e10cSrcweir 				else if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "html" ) )
1073cdf0e10cSrcweir 					pEditView->Read( aStrm, EE_FORMAT_HTML );
1074cdf0e10cSrcweir 				else if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "htm" ) )
1075cdf0e10cSrcweir 					pEditView->Read( aStrm, EE_FORMAT_HTML );
1076cdf0e10cSrcweir 				else
1077cdf0e10cSrcweir 					pEditView->Read( aStrm, EE_FORMAT_TEXT );
1078cdf0e10cSrcweir 			}
1079cdf0e10cSrcweir 
1080cdf0e10cSrcweir 			Application::LeaveWait();
1081cdf0e10cSrcweir 
1082cdf0e10cSrcweir 		}
1083cdf0e10cSrcweir 		break;
1084cdf0e10cSrcweir 		case TB_PRINT:
1085cdf0e10cSrcweir 		{
1086cdf0e10cSrcweir 			pPrinter->SetPageQueueSize( 1 );
1087cdf0e10cSrcweir 			PrintDialog aPrnDlg( this );
1088cdf0e10cSrcweir 			aPrnDlg.SetPrinter( pPrinter );
1089cdf0e10cSrcweir 			if ( aPrnDlg.Execute() )
1090cdf0e10cSrcweir 			{
1091cdf0e10cSrcweir 				pPrinter->StartJob( String( RTL_CONSTASCII_USTRINGPARAM( "SvEdit - PrinterTest" ) ) );
1092cdf0e10cSrcweir 				pPrinter->StartPage();
1093cdf0e10cSrcweir 				Size aSz( pEditEngine->CalcTextWidth(), pEditEngine->GetTextHeight() );
1094cdf0e10cSrcweir 				Pen aPen( PEN_SOLID );
1095cdf0e10cSrcweir 				aPen.SetColor( Color( COL_BLACK ) );
1096cdf0e10cSrcweir 				pPrinter->SetPen( aPen );
1097cdf0e10cSrcweir 				Rectangle aR( Point( 2000, 4000 ), aSz );
1098cdf0e10cSrcweir 				pPrinter->DrawRect( aR );
1099cdf0e10cSrcweir 				// So folgt auf IIISi, 75DPI kein Ausdruck!
1100cdf0e10cSrcweir //				pPrinter->SetClipRegion( Region( aR ) );
1101cdf0e10cSrcweir 				pEditEngine->Draw( pPrinter, Point( 2000, 4000 ), nRotation );
1102cdf0e10cSrcweir //				pPrinter->SetClipRegion();
1103cdf0e10cSrcweir 				pPrinter->EndPage();
1104cdf0e10cSrcweir 				pPrinter->EndJob();
1105cdf0e10cSrcweir 			}
1106cdf0e10cSrcweir 		}
1107cdf0e10cSrcweir 		break;
1108cdf0e10cSrcweir 		case TB_SAVE:
1109cdf0e10cSrcweir 		case TB_SAVE2:
1110cdf0e10cSrcweir 		{
1111cdf0e10cSrcweir 			if ( !pFileDialogBox2->Execute() )
1112cdf0e10cSrcweir 				return FALSE;
1113cdf0e10cSrcweir 			DirEntry aDirEntry( pFileDialogBox2->GetPath() );
1114cdf0e10cSrcweir //			DirEntry aDirEntry( String( RTL_CONSTASCII_USTRINGPARAM( "d:\\xxx.rtf" ) ) );
1115cdf0e10cSrcweir 			SvFileStream aStrm( aDirEntry.GetFull(), STREAM_WRITE | STREAM_TRUNC );
1116cdf0e10cSrcweir 			Application::EnterWait();
1117cdf0e10cSrcweir 			if ( nId == TB_SAVE )
1118cdf0e10cSrcweir 			{
1119cdf0e10cSrcweir 				if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "rtf") )
1120cdf0e10cSrcweir 					pEditEngine->Write( aStrm, EE_FORMAT_RTF );
1121cdf0e10cSrcweir 				else if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "bin" ) )
1122cdf0e10cSrcweir 					pEditEngine->Write( aStrm, EE_FORMAT_BIN );
1123cdf0e10cSrcweir 				else if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "html" ) )
1124cdf0e10cSrcweir 					pEditEngine->Write( aStrm, EE_FORMAT_HTML );
1125cdf0e10cSrcweir 				else if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "htm" ) )
1126cdf0e10cSrcweir 					pEditEngine->Write( aStrm, EE_FORMAT_HTML );
1127cdf0e10cSrcweir 				else
1128cdf0e10cSrcweir 					pEditEngine->Write( aStrm, EE_FORMAT_TEXT );
1129cdf0e10cSrcweir 			}
1130cdf0e10cSrcweir 			else
1131cdf0e10cSrcweir 			{
1132cdf0e10cSrcweir 				if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "rtf" ) )
1133cdf0e10cSrcweir 					pEditView->Write( aStrm, EE_FORMAT_RTF );
1134cdf0e10cSrcweir 				else if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "bin" ) )
1135cdf0e10cSrcweir 					pEditView->Write( aStrm, EE_FORMAT_BIN );
1136cdf0e10cSrcweir 				else if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "html" ) )
1137cdf0e10cSrcweir 					pEditView->Write( aStrm, EE_FORMAT_HTML );
1138cdf0e10cSrcweir 				else if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "htm" ) )
1139cdf0e10cSrcweir 					pEditView->Write( aStrm, EE_FORMAT_HTML );
1140cdf0e10cSrcweir 				else
1141cdf0e10cSrcweir 					pEditView->Write( aStrm, EE_FORMAT_TEXT );
1142cdf0e10cSrcweir 			}
1143cdf0e10cSrcweir 			Application::LeaveWait();
1144cdf0e10cSrcweir 		}
1145cdf0e10cSrcweir 		break;
1146cdf0e10cSrcweir 		case TB_ATTRIBS:
1147cdf0e10cSrcweir 		{
1148cdf0e10cSrcweir 			SfxItemSet aCurSet = pEditView->GetAttribs();
1149cdf0e10cSrcweir 			XubString aDebStr( String( RTL_CONSTASCII_USTRINGPARAM( "Attribute in Selektion:" ) ) );
1150cdf0e10cSrcweir 			aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "\nVorlage:" ) );
1151cdf0e10cSrcweir 			XubString aStyle;
1152cdf0e10cSrcweir //			pEditView->GetStyleSheet( aStyle, eFam );
1153cdf0e10cSrcweir 			aDebStr += aStyle;
1154cdf0e10cSrcweir 			for ( USHORT nWhich = EE_ITEMS_START; nWhich <= EE_ITEMS_END; nWhich++)
1155cdf0e10cSrcweir 			{
1156cdf0e10cSrcweir 				aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "\n" ) );
1157cdf0e10cSrcweir 				aDebStr += String::CreateFromInt32( nWhich );
1158cdf0e10cSrcweir 				aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "\t" ) );
1159cdf0e10cSrcweir 				if ( aCurSet.GetItemState( nWhich ) == SFX_ITEM_OFF )
1160cdf0e10cSrcweir 					aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "---" ) );
1161cdf0e10cSrcweir 				else if ( aCurSet.GetItemState( nWhich ) == SFX_ITEM_DONTCARE )
1162cdf0e10cSrcweir 					aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "XXX" ) );
1163cdf0e10cSrcweir 				else if ( aCurSet.GetItemState( nWhich ) == SFX_ITEM_ON )
1164cdf0e10cSrcweir 				{
1165cdf0e10cSrcweir 					const SfxPoolItem& rItem = aCurSet.Get( nWhich );
1166cdf0e10cSrcweir 					switch ( nWhich )
1167cdf0e10cSrcweir 					{
1168cdf0e10cSrcweir 						case EE_PARA_LRSPACE:
1169cdf0e10cSrcweir 							aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "FI=" ) );
1170cdf0e10cSrcweir                             aDebStr += String::CreateFromInt32( ((SvxLRSpaceItem&)rItem).GetTxtFirstLineOfst() );
1171cdf0e10cSrcweir 							aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( ", LI=" ) );
1172cdf0e10cSrcweir                             aDebStr += String::CreateFromInt32( ((SvxLRSpaceItem&)rItem).GetTxtLeft() );
1173cdf0e10cSrcweir 							aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( ", RI=" ) );
1174cdf0e10cSrcweir 							aDebStr += String::CreateFromInt32( ((SvxLRSpaceItem&)rItem).GetRight() );
1175cdf0e10cSrcweir 						break;
1176cdf0e10cSrcweir 						case EE_PARA_ULSPACE:
1177cdf0e10cSrcweir 							aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "SB=" ) );
1178cdf0e10cSrcweir 							aDebStr += String::CreateFromInt32( ((SvxULSpaceItem&)rItem).GetUpper() );
1179cdf0e10cSrcweir 							aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( ", SA=" ) );
1180cdf0e10cSrcweir 							aDebStr += String::CreateFromInt32( ((SvxULSpaceItem&)rItem).GetLower() );
1181cdf0e10cSrcweir 						break;
1182cdf0e10cSrcweir 						case EE_PARA_SBL:
1183cdf0e10cSrcweir 							aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "SBL=" ) );
1184cdf0e10cSrcweir 							aDebStr += String::CreateFromInt32( ((SvxLineSpacingItem&)rItem).GetInterLineSpace() );
1185cdf0e10cSrcweir 						break;
1186cdf0e10cSrcweir 						case EE_PARA_JUST:
1187cdf0e10cSrcweir 							aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "SvxAdust=" ) );
1188cdf0e10cSrcweir 							aDebStr += String::CreateFromInt32( (USHORT)((SvxAdjustItem&)rItem).GetAdjust() );
1189cdf0e10cSrcweir 						break;
1190cdf0e10cSrcweir 						case EE_PARA_TABS:
1191cdf0e10cSrcweir 							aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "Tabs = ?" ) );
1192cdf0e10cSrcweir 						break;
1193cdf0e10cSrcweir 						case EE_CHAR_COLOR:
1194cdf0e10cSrcweir 						{
1195cdf0e10cSrcweir 							aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "Color= " ) );
1196cdf0e10cSrcweir 							Color aColor( ((SvxColorItem&)rItem).GetValue() );
1197cdf0e10cSrcweir 							aDebStr += String::CreateFromInt32( aColor.GetRed() );
1198cdf0e10cSrcweir 							aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) );
1199cdf0e10cSrcweir 							aDebStr += String::CreateFromInt32( aColor.GetGreen() );
1200cdf0e10cSrcweir 							aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) );
1201cdf0e10cSrcweir 							aDebStr += String::CreateFromInt32( aColor.GetBlue() );
1202cdf0e10cSrcweir 						}
1203cdf0e10cSrcweir 						break;
1204cdf0e10cSrcweir 						case EE_CHAR_FONTINFO:
1205cdf0e10cSrcweir 							aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "Font=" ) );
1206cdf0e10cSrcweir 							aDebStr += ((SvxFontItem&)rItem).GetFamilyName();
1207cdf0e10cSrcweir 						break;
1208cdf0e10cSrcweir 						case EE_CHAR_FONTHEIGHT:
1209cdf0e10cSrcweir 							aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "Groesse=" ) );
1210cdf0e10cSrcweir 							aDebStr += String::CreateFromInt32( ((SvxFontHeightItem&)rItem).GetHeight() );
1211cdf0e10cSrcweir 						break;
1212cdf0e10cSrcweir 						case EE_CHAR_WEIGHT:
1213cdf0e10cSrcweir 							aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "FontWeight=" ) );
1214cdf0e10cSrcweir 							aDebStr += String::CreateFromInt32( ((SvxWeightItem&)rItem).GetWeight() );
1215cdf0e10cSrcweir 						break;
1216cdf0e10cSrcweir 						case EE_CHAR_UNDERLINE:
1217cdf0e10cSrcweir 							aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "FontUnderline=" ) );
1218cdf0e10cSrcweir 							aDebStr += String::CreateFromInt32( ((SvxUnderlineItem&)rItem).GetLineStyle() );
1219cdf0e10cSrcweir 						break;
1220cdf0e10cSrcweir 						case EE_CHAR_WLM:
1221cdf0e10cSrcweir 							aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "WordLineMode=" ) );
1222cdf0e10cSrcweir 							aDebStr += String::CreateFromInt32( ((SvxWordLineModeItem&)rItem).GetValue() );
1223cdf0e10cSrcweir 						break;
1224cdf0e10cSrcweir 						case EE_CHAR_STRIKEOUT:
1225cdf0e10cSrcweir 							aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "FontStrikeout=" ) );
1226cdf0e10cSrcweir 							aDebStr += String::CreateFromInt32( ((SvxCrossedOutItem&)rItem).GetStrikeout() );
1227cdf0e10cSrcweir 						break;
1228cdf0e10cSrcweir 						case EE_CHAR_ITALIC:
1229cdf0e10cSrcweir 							aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "FontPosture=" ) );
1230cdf0e10cSrcweir 							aDebStr += String::CreateFromInt32( ((SvxPostureItem&)rItem).GetPosture() );
1231cdf0e10cSrcweir 						break;
1232cdf0e10cSrcweir 						case EE_CHAR_OUTLINE:
1233cdf0e10cSrcweir 							aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "FontOutline=" ) );
1234cdf0e10cSrcweir 							aDebStr += String::CreateFromInt32( ((SvxContourItem&)rItem).GetValue() );
1235cdf0e10cSrcweir 						break;
1236cdf0e10cSrcweir 						case EE_CHAR_SHADOW:
1237cdf0e10cSrcweir 							aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "FontShadowed=" ) );
1238cdf0e10cSrcweir 							aDebStr += String::CreateFromInt32( ((SvxShadowedItem&)rItem).GetValue() );
1239cdf0e10cSrcweir 						break;
1240cdf0e10cSrcweir 					}
1241cdf0e10cSrcweir 				}
1242cdf0e10cSrcweir 				else
1243cdf0e10cSrcweir 					aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "?" ) );
1244cdf0e10cSrcweir 			}
1245cdf0e10cSrcweir 			InfoBox( 0, aDebStr ).Execute();
1246cdf0e10cSrcweir 		}
1247cdf0e10cSrcweir 		break;
1248cdf0e10cSrcweir 	}
1249cdf0e10cSrcweir 
1250cdf0e10cSrcweir 	if ( pNewItem )
1251cdf0e10cSrcweir 	{
1252cdf0e10cSrcweir 		SfxItemSet aSet = pEditView->GetEmptyItemSet();
1253cdf0e10cSrcweir 		aSet.Put( *pNewItem );
1254cdf0e10cSrcweir 		pEditView->SetAttribs( aSet );
1255cdf0e10cSrcweir 		delete pNewItem;
1256cdf0e10cSrcweir 	}
1257cdf0e10cSrcweir 	UpdateToolBox();
1258cdf0e10cSrcweir 	return 0;
1259cdf0e10cSrcweir }
1260cdf0e10cSrcweir 
CreatePolygon()1261cdf0e10cSrcweir void EditMainWindow::CreatePolygon()
1262cdf0e10cSrcweir {
1263cdf0e10cSrcweir 	EditView* pEditView = aViewWin.GetEditView();
1264cdf0e10cSrcweir 	Size aSz = pEditView->GetWindow()->GetOutputSize();
1265cdf0e10cSrcweir 	Point aOffset( aSz.Width()/8, aSz.Height()/8 );
1266cdf0e10cSrcweir 	aSz.Width() *= 3;
1267cdf0e10cSrcweir 	aSz.Width() /= 4;
1268cdf0e10cSrcweir 	aSz.Height() *= 3;
1269cdf0e10cSrcweir 	aSz.Height() /= 4;
1270cdf0e10cSrcweir 	Polygon aPoly( 5 );
1271cdf0e10cSrcweir 	aPoly.SetPoint( Point( aSz.Width()/2, 0 ), 0 );
1272cdf0e10cSrcweir 	aPoly.SetPoint( Point( aSz.Width(), aSz.Height()/3 ), 1 );
1273cdf0e10cSrcweir 	aPoly.SetPoint( Point( aSz.Width()/2, aSz.Height() ), 2 );
1274cdf0e10cSrcweir 	aPoly.SetPoint( Point( 0, aSz.Height()/2 ), 3 );
1275cdf0e10cSrcweir 	aPoly.SetPoint( Point( aSz.Width()/2, 0 ), 4 );
1276cdf0e10cSrcweir 	PolyPolygon aPPoly( aPoly );
1277cdf0e10cSrcweir 	pEditView->GetEditEngine()->SetPolygon( aPPoly );
1278cdf0e10cSrcweir 	pEditView->SetOutputArea( Rectangle( aOffset, aSz ) );
1279cdf0e10cSrcweir 	ULONG nWord = pEditView->GetControlWord();
1280cdf0e10cSrcweir 	nWord &= ~(EV_CNTRL_AUTOSCROLL);
1281cdf0e10cSrcweir 	pEditView->SetControlWord( nWord );
1282cdf0e10cSrcweir 	aViewWin.Invalidate();
1283cdf0e10cSrcweir }
1284cdf0e10cSrcweir 
GetFocus()1285cdf0e10cSrcweir void __EXPORT EditMainWindow::GetFocus()
1286cdf0e10cSrcweir {
1287cdf0e10cSrcweir 	aViewWin.GrabFocus();
1288cdf0e10cSrcweir }
1289cdf0e10cSrcweir 
IMPL_LINK_INLINE_START(EditMainWindow,HScrollHdl,ScrollBar *,pScrl)1290cdf0e10cSrcweir IMPL_LINK_INLINE_START( EditMainWindow, HScrollHdl, ScrollBar *, pScrl )
1291cdf0e10cSrcweir {
1292cdf0e10cSrcweir 	EditView* pEditView = aViewWin.GetEditView();
1293cdf0e10cSrcweir 	pEditView->Scroll( -pScrl->GetDelta(), 0, RGCHK_PAPERSZ1 );
1294cdf0e10cSrcweir 	return 0;
1295cdf0e10cSrcweir }
IMPL_LINK_INLINE_END(EditMainWindow,HScrollHdl,ScrollBar *,pScrl)1296cdf0e10cSrcweir IMPL_LINK_INLINE_END( EditMainWindow, HScrollHdl, ScrollBar *, pScrl )
1297cdf0e10cSrcweir 
1298cdf0e10cSrcweir IMPL_LINK_INLINE_START( EditMainWindow, VScrollHdl, ScrollBar *, pScrl )
1299cdf0e10cSrcweir {
1300cdf0e10cSrcweir 	EditView* pEditView = aViewWin.GetEditView();
1301cdf0e10cSrcweir 	pEditView->Scroll( 0, -pScrl->GetDelta(), RGCHK_PAPERSZ1 );
1302cdf0e10cSrcweir 	return 0;
1303cdf0e10cSrcweir }
IMPL_LINK_INLINE_END(EditMainWindow,VScrollHdl,ScrollBar *,pScrl)1304cdf0e10cSrcweir IMPL_LINK_INLINE_END( EditMainWindow, VScrollHdl, ScrollBar *, pScrl )
1305cdf0e10cSrcweir 
1306cdf0e10cSrcweir void EditMainWindow::SetScrollBarRanges()
1307cdf0e10cSrcweir {
1308cdf0e10cSrcweir 	EditView* pEditView = aViewWin.GetEditView();
1309cdf0e10cSrcweir 	long y = pEditView->GetEditEngine()->GetTextHeight();
1310cdf0e10cSrcweir 	long x = pEditView->GetEditEngine()->GetPaperSize().Width();
1311cdf0e10cSrcweir 
1312cdf0e10cSrcweir 	aHScrollBar.SetRange( Range( 0, x ) );
1313cdf0e10cSrcweir 	aVScrollBar.SetRange( Range( 0, y ) );
1314cdf0e10cSrcweir }
1315cdf0e10cSrcweir 
SetScrollBars()1316cdf0e10cSrcweir void EditMainWindow::SetScrollBars()
1317cdf0e10cSrcweir {
1318cdf0e10cSrcweir 	EditView* pEditView = aViewWin.GetEditView();
1319cdf0e10cSrcweir 	Size aSz = GetOutputSizePixel();
1320cdf0e10cSrcweir 	Size aRealSz( aSz );
1321cdf0e10cSrcweir 	long nScrollbarWidthPixel = aVScrollBar.GetSizePixel().Width();
1322cdf0e10cSrcweir 	long nTBHeight = aToolBox.GetSizePixel().Height();
1323cdf0e10cSrcweir 	aSz.Height() -= nTBHeight;
1324cdf0e10cSrcweir 	Size aOrgSz( aSz );
1325cdf0e10cSrcweir 
1326cdf0e10cSrcweir 	// VScroll...
1327cdf0e10cSrcweir 	aSz.Height() += 2;
1328cdf0e10cSrcweir 	Point aPoint( ( aSz.Width()- nScrollbarWidthPixel+1 ), -1+nTBHeight);
1329cdf0e10cSrcweir 	aSz.Width() = nScrollbarWidthPixel;
1330cdf0e10cSrcweir 	aVScrollBar.SetPosSizePixel( aPoint, aSz );
1331cdf0e10cSrcweir 
1332cdf0e10cSrcweir 	// HScroll...
1333cdf0e10cSrcweir 	aSz = aOrgSz;
1334cdf0e10cSrcweir 	Point aPoint2( 0, aRealSz.Height()-aHScrollBar.GetSizePixel().Height()+1 ); // TB-Height schon drin!
1335cdf0e10cSrcweir 	aSz.Width() -= aVScrollBar.GetSizePixel().Width();
1336cdf0e10cSrcweir 	aSz.Width() += 2;
1337cdf0e10cSrcweir 
1338cdf0e10cSrcweir 	aSz.Height() = nScrollbarWidthPixel;
1339cdf0e10cSrcweir 	aHScrollBar.SetPosSizePixel( aPoint2, aSz );
1340cdf0e10cSrcweir 
1341cdf0e10cSrcweir 	aHScrollBar.SetVisibleSize( pEditView->GetOutputArea().GetWidth() );
1342cdf0e10cSrcweir 	aVScrollBar.SetVisibleSize( pEditView->GetOutputArea().GetHeight() );
1343cdf0e10cSrcweir 
1344cdf0e10cSrcweir 	SetScrollBarRanges();
1345cdf0e10cSrcweir 
1346cdf0e10cSrcweir 	aVScrollBar.Show();
1347cdf0e10cSrcweir 	aHScrollBar.Show();
1348cdf0e10cSrcweir }
1349cdf0e10cSrcweir 
Resize()1350cdf0e10cSrcweir void __EXPORT EditMainWindow::Resize()
1351cdf0e10cSrcweir {
1352cdf0e10cSrcweir 	long nBorder = aVScrollBar.GetSizePixel().Width();
1353cdf0e10cSrcweir 	long nExtra = 10;
1354cdf0e10cSrcweir 	Size aTBSz = aToolBox.CalcWindowSizePixel();
1355cdf0e10cSrcweir 	Size aOutSzPixel( GetOutputSizePixel() );
1356cdf0e10cSrcweir 	aToolBox.SetSizePixel( Size( aOutSzPixel.Width(), aTBSz.Height()) );
1357cdf0e10cSrcweir 
1358cdf0e10cSrcweir 	aViewWin.SetSizePixel( Size( aOutSzPixel.Width()-nBorder-2*nExtra, aOutSzPixel.Height()-aTBSz.Height()-2*nExtra-nBorder) );
1359cdf0e10cSrcweir 
1360cdf0e10cSrcweir 	aViewWin.SetPosPixel( Point( nExtra, aTBSz.Height()+nExtra ) );
1361cdf0e10cSrcweir 
1362cdf0e10cSrcweir 	SetScrollBars();
1363cdf0e10cSrcweir 
1364cdf0e10cSrcweir 	EditView* pEditView = aViewWin.GetEditView();
1365cdf0e10cSrcweir 	if ( pEditView && pEditView->GetEditEngine()->GetPolygon() )
1366cdf0e10cSrcweir 		CreatePolygon();
1367cdf0e10cSrcweir }
1368cdf0e10cSrcweir 
IMPL_LINK(EditMainWindow,ShowStatus,EditStatus *,pStat)1369cdf0e10cSrcweir IMPL_LINK( EditMainWindow, ShowStatus, EditStatus *, pStat )
1370cdf0e10cSrcweir {
1371cdf0e10cSrcweir 	EditView* pEditView = aViewWin.GetEditView();
1372cdf0e10cSrcweir 	EditEngine* pEditEngine = pEditView->GetEditEngine();
1373cdf0e10cSrcweir 	if ( ( pStat->GetStatusWord() & EE_STAT_TEXTWIDTHCHANGED ) || ( pStat->GetStatusWord() & EE_STAT_TEXTHEIGHTCHANGED ) )
1374cdf0e10cSrcweir 	{
1375cdf0e10cSrcweir 		aViewWin.MarkOutputArea();
1376cdf0e10cSrcweir 		if ( pEditEngine->GetTextHeight() < (ULONG)pEditView->GetOutputArea().GetHeight() )
1377cdf0e10cSrcweir 		{
1378cdf0e10cSrcweir 			// Wird durch RGCHK_PAPERSZ1 'geklippt'
1379cdf0e10cSrcweir 			if ( !( pEditEngine->GetControlWord() & EE_CNTRL_AUTOPAGESIZE) )
1380cdf0e10cSrcweir 				pEditView->Scroll( -(long)pEditEngine->CalcTextWidth(), -(long)pEditEngine->GetTextHeight(), RGCHK_PAPERSZ1 );
1381cdf0e10cSrcweir 		}
1382cdf0e10cSrcweir 		SetScrollBarRanges();
1383cdf0e10cSrcweir 	}
1384cdf0e10cSrcweir 	if ( pStat->GetStatusWord() & EE_STAT_HSCROLL )
1385cdf0e10cSrcweir 		aHScrollBar.SetThumbPos( pEditView->GetVisArea().Left() );
1386cdf0e10cSrcweir 	if ( pStat->GetStatusWord() & EE_STAT_VSCROLL )
1387cdf0e10cSrcweir 		aVScrollBar.SetThumbPos( pEditView->GetVisArea().Top() );
1388cdf0e10cSrcweir 
1389cdf0e10cSrcweir 	return 0;
1390cdf0e10cSrcweir }
1391cdf0e10cSrcweir 
1392cdf0e10cSrcweir 
~EditViewWindow()1393cdf0e10cSrcweir EditViewWindow::~EditViewWindow()
1394cdf0e10cSrcweir {
1395cdf0e10cSrcweir 	// erst die angemeldeten Views zerstoeren
1396cdf0e10cSrcweir 	// (melden sich selbst ab)
1397cdf0e10cSrcweir 	MyView* pView = aViewList.First();
1398cdf0e10cSrcweir 	while ( pView )
1399cdf0e10cSrcweir 	{
1400cdf0e10cSrcweir 		delete pView;
1401cdf0e10cSrcweir 		pView = aViewList.Next();
1402cdf0e10cSrcweir 	}
1403cdf0e10cSrcweir 
1404cdf0e10cSrcweir 	pEditEngine->RemoveView( pEditView );
1405cdf0e10cSrcweir 	delete pEditView;
1406cdf0e10cSrcweir 	// Beim Zerstoeren der Styles am Ende, EditEngine noch nicht kaputt,
1407cdf0e10cSrcweir 	// wird der Handler gerufen, ich zerstore hier aber schon die View!
1408cdf0e10cSrcweir 	pEditEngine->SetStatusEventHdl( Link() );
1409cdf0e10cSrcweir //	SvxAutoCorrect* pAutoCorrekt = pEditEngine->GetAutoCorrect();
1410cdf0e10cSrcweir //	pEditEngine->SetAutoCorrect( 0 );
1411cdf0e10cSrcweir //	delete pAutoCorrekt;
1412cdf0e10cSrcweir 	delete pEditEngine;
1413cdf0e10cSrcweir }
1414cdf0e10cSrcweir 
EditViewWindow(Window * pParent)1415cdf0e10cSrcweir EditViewWindow::EditViewWindow( Window* pParent ) :
1416cdf0e10cSrcweir 				Window( pParent ), aURLPtr( POINTER_HAND )
1417cdf0e10cSrcweir {
1418cdf0e10cSrcweir 	SetBackgroundBrush( Brush( Color( COL_WHITE ) ) );
1419cdf0e10cSrcweir 	SetMapMode( MAP_100TH_MM );
1420cdf0e10cSrcweir //	EnableDrop();
1421cdf0e10cSrcweir 
1422cdf0e10cSrcweir 	SfxItemPool* pPool = EditEngine::CreatePool();
1423cdf0e10cSrcweir 	Font aFont = GetSettings().GetStyleSettings().GetAppFont();
1424cdf0e10cSrcweir 	MapMode aPntMode( MAP_POINT );
1425cdf0e10cSrcweir 	MapMode aCurrent( GetMapMode() );
1426cdf0e10cSrcweir 	Size aSz( LogicToLogic( Size( 12, 0 ), &aPntMode, &aCurrent ) );
1427cdf0e10cSrcweir 	aFont.SetName( String( RTL_CONSTASCII_USTRINGPARAM( "Times New Roman" ) ) );
1428cdf0e10cSrcweir 	pPool->SetPoolDefaultItem( SvxFontItem( aFont.GetFamily(), aFont.GetName(), String(),aFont.GetPitch(), aFont.GetCharSet(), EE_CHAR_FONTINFO ) );
1429cdf0e10cSrcweir 	pPool->SetPoolDefaultItem( SvxFontHeightItem( aSz.Width(), 100, EE_CHAR_FONTHEIGHT ) );
1430cdf0e10cSrcweir 	pEditEngine = new MyEditEngine( pPool );
1431cdf0e10cSrcweir 
1432cdf0e10cSrcweir 	Size aPaperSz( 10000,8000 );
1433cdf0e10cSrcweir 	pEditEngine->SetPaperSize( aPaperSz );
1434cdf0e10cSrcweir 
1435cdf0e10cSrcweir 	pEditView = new EditView( pEditEngine, this );
1436cdf0e10cSrcweir 	pEditView->SetBackgroundColor( Color( COL_WHITE ) );
1437cdf0e10cSrcweir 	pEditView->SetOutputArea( Rectangle( Point( 100, 100 ), aPaperSz ) );
1438cdf0e10cSrcweir 	pEditEngine->SetDefaultLanguage( LANGUAGE_ENGLISH );
1439cdf0e10cSrcweir 	pEditEngine->InsertView( pEditView );
1440cdf0e10cSrcweir 
1441cdf0e10cSrcweir 	SetPosSizePixel( Point( 10, 10 ), Size( 600, 400 ) );
1442cdf0e10cSrcweir 	SetPen( PEN_NULL );
1443cdf0e10cSrcweir 	Show();
1444cdf0e10cSrcweir 
1445cdf0e10cSrcweir 	// Feldbefehle grau hinterlegen
1446cdf0e10cSrcweir 	ULONG n = pEditEngine->GetControlWord();
1447cdf0e10cSrcweir 	n = n | (EE_CNTRL_MARKFIELDS|EE_CNTRL_AUTOCOMPLETE);
1448cdf0e10cSrcweir 	pEditEngine->SetControlWord( n );
1449cdf0e10cSrcweir 
1450cdf0e10cSrcweir 	// Test: Autozentrierung
1451cdf0e10cSrcweir //	ULONG n = pEditEngine->GetControlWord();
1452cdf0e10cSrcweir //	n = n | EE_CNTRL_AUTOPAGESIZE;
1453cdf0e10cSrcweir //	pEditEngine->SetControlWord( n );
1454cdf0e10cSrcweir 
1455cdf0e10cSrcweir 	// OneLineSpeling
1456cdf0e10cSrcweir #ifdef WNT
1457cdf0e10cSrcweir //	pEditEngine->CreateSpeller( DirEntry( String( RTL_CONSTASCII_USTRINGPARAM( "n:\\offenv\\wnti" ) ) ),
1458cdf0e10cSrcweir //								DirEntry( String( RTL_CONSTASCII_USTRINGPARAM( "n:\\offenv\\wnti" ) ) ) );
1459cdf0e10cSrcweir //	pEditEngine->GetSpeller()->SetActualLanguage( LANGUAGE_GERMAN );
1460cdf0e10cSrcweir //	pEditEngine->GetSpeller()->SetDefaultLanguage( LANGUAGE_GERMAN );
1461cdf0e10cSrcweir //	pEditEngine->GetSpeller()->SetMinTrail( 2 );
1462cdf0e10cSrcweir 
1463cdf0e10cSrcweir 	// AutoCorrect wird nie zerstoert
1464cdf0e10cSrcweir //	pEditEngine->SetAutoCorrect( new SvxAutoCorrect( String( RTL_CONSTASCII_USTRINGPARAM( "d:\\prj\\office\\autotext\\autocorr.dat" ) ) ) );
1465cdf0e10cSrcweir #endif
1466cdf0e10cSrcweir }
1467cdf0e10cSrcweir 
Paint(const Rectangle & rRec)1468cdf0e10cSrcweir void __EXPORT EditViewWindow::Paint( const Rectangle& rRec )
1469cdf0e10cSrcweir {
1470cdf0e10cSrcweir 	if ( pEditView->GetEditEngine()->GetPolygon() )
1471cdf0e10cSrcweir 	{
1472cdf0e10cSrcweir 		// Die Punkte des Polygons beziehen sich auf die View...
1473cdf0e10cSrcweir 		MapMode aMapMode( GetMapMode() );
1474cdf0e10cSrcweir 		aMapMode.SetOrigin( pEditView->GetOutputArea().TopLeft() );
1475cdf0e10cSrcweir 		SetMapMode( aMapMode );
1476cdf0e10cSrcweir 		DrawPolyPolygon( *pEditView->GetEditEngine()->GetPolygon() );
1477cdf0e10cSrcweir 		aMapMode.SetOrigin( Point() );
1478cdf0e10cSrcweir 		SetMapMode( aMapMode );
1479cdf0e10cSrcweir 	}
1480cdf0e10cSrcweir 	pEditView->Paint( rRec );
1481cdf0e10cSrcweir 	MarkOutputArea();
1482cdf0e10cSrcweir }
1483cdf0e10cSrcweir 
MarkOutputArea()1484cdf0e10cSrcweir void EditViewWindow::MarkOutputArea()
1485cdf0e10cSrcweir {
1486cdf0e10cSrcweir 	static Rectangle aCurFrame;
1487cdf0e10cSrcweir 	Rectangle aOutArea( pEditView->GetOutputArea() );
1488cdf0e10cSrcweir 	aOutArea = LogicToPixel( aOutArea );
1489cdf0e10cSrcweir 	aOutArea.Left()--;
1490cdf0e10cSrcweir 	aOutArea.Right()++;
1491cdf0e10cSrcweir 	aOutArea.Top()--;
1492cdf0e10cSrcweir 	aOutArea.Bottom()++;
1493cdf0e10cSrcweir 	aOutArea = PixelToLogic( aOutArea );
1494cdf0e10cSrcweir 	SetPen( Pen( Color( COL_RED ) ) );
1495cdf0e10cSrcweir 	SetFillInBrush( Brush( BRUSH_NULL ) );
1496cdf0e10cSrcweir 	DrawRect( aOutArea );
1497cdf0e10cSrcweir 	if ( !aCurFrame.IsEmpty() )
1498cdf0e10cSrcweir 	{
1499cdf0e10cSrcweir 		if ( aCurFrame.Left() < aOutArea.Left() )
1500cdf0e10cSrcweir 			Invalidate( Rectangle( aCurFrame.TopLeft(), Size( aOutArea.Left()-aCurFrame.Left(), aCurFrame.GetHeight() ) ) );
1501cdf0e10cSrcweir 		if ( aCurFrame.Right() > aOutArea.Right() )
1502cdf0e10cSrcweir 		{
1503cdf0e10cSrcweir 			long nW = aCurFrame.Right() - aOutArea.Right();
1504cdf0e10cSrcweir 			Point aPos( aCurFrame.TopRight() );
1505cdf0e10cSrcweir 			aPos.X() -= nW;
1506cdf0e10cSrcweir 			Invalidate( Rectangle( aPos, Size( nW, aCurFrame.GetHeight() ) ) );
1507cdf0e10cSrcweir 		}
1508cdf0e10cSrcweir 		if ( aCurFrame.Top() < aOutArea.Top() )
1509cdf0e10cSrcweir 			Invalidate( Rectangle( aCurFrame.TopLeft(), Size( aCurFrame.GetWidth(), aOutArea.Top() - aCurFrame.Top() ) ) );
1510cdf0e10cSrcweir 		if ( aCurFrame.Bottom() > aOutArea.Bottom() )
1511cdf0e10cSrcweir 		{
1512cdf0e10cSrcweir 			long nH = aCurFrame.Bottom() - aOutArea.Bottom();
1513cdf0e10cSrcweir 			Point aPos( aCurFrame.BottomLeft() );
1514cdf0e10cSrcweir 			aPos.Y() -= nH;
1515cdf0e10cSrcweir 			Invalidate( Rectangle( aPos, Size( aCurFrame.GetWidth(), nH ) ) );
1516cdf0e10cSrcweir 		}
1517cdf0e10cSrcweir 	}
1518cdf0e10cSrcweir 	aCurFrame = aOutArea;
1519cdf0e10cSrcweir }
1520cdf0e10cSrcweir 
Resize()1521cdf0e10cSrcweir void __EXPORT EditViewWindow::Resize()
1522cdf0e10cSrcweir {
1523cdf0e10cSrcweir 	Size aPaperSz( GetOutputSize() );
1524cdf0e10cSrcweir 	pEditView->SetOutputArea( Rectangle( Point(0,0), aPaperSz ) );
1525cdf0e10cSrcweir 	pEditEngine->SetPaperSize( Size( aPaperSz.Width()*1, aPaperSz.Height()*1 ) );
1526cdf0e10cSrcweir 	pEditView->ShowCursor();
1527cdf0e10cSrcweir 	Invalidate();
1528cdf0e10cSrcweir }
1529cdf0e10cSrcweir 
KeyInput(const KeyEvent & rKEvt)1530cdf0e10cSrcweir void __EXPORT EditViewWindow::KeyInput( const KeyEvent& rKEvt )
1531cdf0e10cSrcweir {
1532cdf0e10cSrcweir 	sal_Unicode nCharCode = rKEvt.GetCharCode();
1533cdf0e10cSrcweir 
1534cdf0e10cSrcweir 	USHORT nCode = rKEvt.GetKeyCode().GetCode();
1535cdf0e10cSrcweir 	// Auswertung fuer besondere Einstellungen....
1536cdf0e10cSrcweir 	if ( ( nCode == KEY_A) && rKEvt.GetKeyCode().IsMod1() )
1537cdf0e10cSrcweir 		pEditView->SetSelection( ESelection( 0, 0, 0xFFFF, 0xFFFF ) );
1538cdf0e10cSrcweir 	else if ( ( nCode == KEY_R ) && rKEvt.GetKeyCode().IsMod2() )
1539cdf0e10cSrcweir 		Invalidate();
1540cdf0e10cSrcweir 	else if ( ( nCode == KEY_L ) && rKEvt.GetKeyCode().IsMod2() )
1541cdf0e10cSrcweir 	{
1542cdf0e10cSrcweir 		ULONG n = pEditEngine->GetControlWord();
1543cdf0e10cSrcweir 		n = n | EE_CNTRL_ONECHARPERLINE;
1544cdf0e10cSrcweir 		pEditEngine->SetControlWord( n );
1545cdf0e10cSrcweir 		pEditEngine->QuickFormatDoc();
1546cdf0e10cSrcweir 	}
1547cdf0e10cSrcweir 	else if ( ( nCode == KEY_Z ) && rKEvt.GetKeyCode().IsMod2() )
1548cdf0e10cSrcweir 	{
1549cdf0e10cSrcweir 		pEditView->RemoveAttribs();
1550cdf0e10cSrcweir 	}
1551cdf0e10cSrcweir 	else if ( ( nCode == KEY_V ) && rKEvt.GetKeyCode().IsMod2() )
1552cdf0e10cSrcweir 	{
1553cdf0e10cSrcweir 		pEditEngine->SetVertical( TRUE );
1554cdf0e10cSrcweir 		Invalidate();
1555cdf0e10cSrcweir 	}
1556cdf0e10cSrcweir 	else if ( ( ( nCode == KEY_ADD ) || ( nCode == KEY_SUBTRACT ) )&& rKEvt.GetKeyCode().IsMod2() )
1557cdf0e10cSrcweir 	{
1558cdf0e10cSrcweir 		short nDiff = ( nCode == KEY_ADD ) ? (+5) : (-5);
1559cdf0e10cSrcweir 		if ( nZoom > 1000 )
1560cdf0e10cSrcweir 			nDiff *= 20;
1561cdf0e10cSrcweir 		if ( nZoom <= 25 )
1562cdf0e10cSrcweir 			nDiff /= 5;
1563cdf0e10cSrcweir 		if ( ( nZoom + nDiff ) > 0 )
1564cdf0e10cSrcweir 			nZoom += nDiff;
1565cdf0e10cSrcweir 		MapMode aMapMode( MAP_100TH_MM, Point(0,0), Fraction(nZoom,100), Fraction(nZoom,100) );
1566cdf0e10cSrcweir 		SetMapMode( aMapMode );
1567cdf0e10cSrcweir 		((EditMainWindow*)GetParent())->SetTitle();
1568cdf0e10cSrcweir 
1569cdf0e10cSrcweir 		if ( rKEvt.GetKeyCode().IsMod1() )
1570cdf0e10cSrcweir 		{
1571cdf0e10cSrcweir 			InfoBox( 0, String( RTL_CONSTASCII_USTRINGPARAM( "ChangingRefMapMode..." ) ) ).Execute();
1572cdf0e10cSrcweir 			pEditEngine->SetRefMapMode( aMapMode );
1573cdf0e10cSrcweir 		}
1574cdf0e10cSrcweir 		Invalidate();
1575cdf0e10cSrcweir 	}
1576cdf0e10cSrcweir 	else if ( rKEvt.GetKeyCode().IsMod2() &&
1577cdf0e10cSrcweir 			( ( nCode == KEY_UP) || ( nCode == KEY_DOWN ) ||
1578cdf0e10cSrcweir 			  ( nCode == KEY_LEFT ) || ( nCode == KEY_RIGHT ) ) )
1579cdf0e10cSrcweir 	{
1580cdf0e10cSrcweir 		if( rKEvt.GetKeyCode().IsMod1() )
1581cdf0e10cSrcweir 		{
1582cdf0e10cSrcweir 			ULONG nCtrl = pEditEngine->GetControlWord();
1583cdf0e10cSrcweir 			if ( ! ( nCtrl & EE_CNTRL_STRETCHING ) )
1584cdf0e10cSrcweir 			{
1585cdf0e10cSrcweir 				nCtrl |= EE_CNTRL_STRETCHING;
1586cdf0e10cSrcweir 				pEditEngine->SetControlWord( nCtrl );
1587cdf0e10cSrcweir 			}
1588cdf0e10cSrcweir 			USHORT nX, nY;
1589cdf0e10cSrcweir 			pEditEngine->GetGlobalCharStretching( nX, nY );
1590cdf0e10cSrcweir 			if ( ( nCode == KEY_DOWN ) && ( nY > 5 ) )
1591cdf0e10cSrcweir 				nY += 5;
1592cdf0e10cSrcweir 			else if ( nCode == KEY_UP )
1593cdf0e10cSrcweir 				nY -= 5;
1594cdf0e10cSrcweir 			else if ( nCode == KEY_RIGHT )
1595cdf0e10cSrcweir 				nX += 5;
1596cdf0e10cSrcweir 			else if ( ( nCode == KEY_LEFT ) && ( nX > 5 ) )
1597cdf0e10cSrcweir 				nX -= 5;
1598cdf0e10cSrcweir 			pEditEngine->SetGlobalCharStretching( nX, nY );
1599cdf0e10cSrcweir 			((EditMainWindow*)GetParent())->SetTitle();
1600cdf0e10cSrcweir 		}
1601cdf0e10cSrcweir 		else	// ZeichenAttr
1602cdf0e10cSrcweir 		{
1603cdf0e10cSrcweir 			SfxItemSet aAttrs( pEditView->GetAttribs() );
1604cdf0e10cSrcweir 			SfxItemSet aNewAttrs( pEditEngine->GetEmptyItemSet() );
1605cdf0e10cSrcweir 			const SvxFontWidthItem& rItem = (const SvxFontWidthItem&)aAttrs.Get( EE_CHAR_FONTWIDTH );
1606cdf0e10cSrcweir 			USHORT nProp = rItem.GetProp();
1607cdf0e10cSrcweir 			if ( nCode == KEY_RIGHT )
1608cdf0e10cSrcweir 				nProp += 5;
1609cdf0e10cSrcweir 			else if ( ( nCode == KEY_LEFT ) && ( nProp > 5 ) )
1610cdf0e10cSrcweir 				nProp -= 5;
1611cdf0e10cSrcweir 			aNewAttrs.Put( SvxFontWidthItem( 0, nProp, EE_CHAR_FONTWIDTH ) );
1612cdf0e10cSrcweir 			pEditView->SetAttribs( aNewAttrs );
1613cdf0e10cSrcweir 		}
1614cdf0e10cSrcweir 	}
1615cdf0e10cSrcweir 	else if ( ( nCode == KEY_O ) && rKEvt.GetKeyCode().IsMod2() )
1616cdf0e10cSrcweir 	{
1617cdf0e10cSrcweir 		MapMode aMapMode( GetMapMode() );
1618cdf0e10cSrcweir 		aMapMode.SetOrigin( Point( 41, 41 ) );
1619cdf0e10cSrcweir 		SetMapMode( aMapMode );
1620cdf0e10cSrcweir 		Invalidate();
1621cdf0e10cSrcweir 	}
1622cdf0e10cSrcweir 	else if ( ( nCode == KEY_B ) && rKEvt.GetKeyCode().IsMod2() )
1623cdf0e10cSrcweir 	{
1624cdf0e10cSrcweir 		SfxItemSet aSet = pEditView->GetEmptyItemSet();
1625cdf0e10cSrcweir 		aSet.Put( SvxFontHeightItem(800, 100, EE_CHAR_FONTHEIGHT) );
1626cdf0e10cSrcweir 		pEditView->SetAttribs( aSet );
1627cdf0e10cSrcweir 	}
1628cdf0e10cSrcweir 	else if ( ( nCode == KEY_P ) && rKEvt.GetKeyCode().IsMod2() )
1629cdf0e10cSrcweir 	{
1630cdf0e10cSrcweir //				ESelection aSel = pEditView->GetSelection();
1631cdf0e10cSrcweir //				for ( ULONG n = aSel.nStartPara; n <= aSel.nEndPara; n++ )
1632cdf0e10cSrcweir //				{
1633cdf0e10cSrcweir //					InfoBox( 0, pEditEngine->GetText( n ) ).Execute();
1634cdf0e10cSrcweir //				}
1635cdf0e10cSrcweir 		InfoBox( 0, pEditView->GetSelected() ).Execute();
1636cdf0e10cSrcweir 
1637cdf0e10cSrcweir 	}
1638cdf0e10cSrcweir 	else if ( rKEvt.GetKeyCode().IsMod2() &&
1639cdf0e10cSrcweir 				( nCode >= KEY_1 ) && ( nCode <= KEY_9 ) )
1640cdf0e10cSrcweir 	{
1641cdf0e10cSrcweir 		ULONG nEECtrl = pEditEngine->GetControlWord();
1642cdf0e10cSrcweir 		nEECtrl = nEECtrl | EE_CNTRL_AUTOPAGESIZE;
1643cdf0e10cSrcweir 		pEditEngine->SetControlWord( nEECtrl );
1644cdf0e10cSrcweir 
1645cdf0e10cSrcweir 		ULONG nEVCtrl = pEditView->GetControlWord();
1646cdf0e10cSrcweir 		nEVCtrl |= EV_CNTRL_AUTOSIZE;
1647cdf0e10cSrcweir 		pEditView->SetControlWord( nEVCtrl );
1648cdf0e10cSrcweir 
1649cdf0e10cSrcweir 		pEditView->SetAnchorMode( (EVAnchorMode)(nCode-KEY_1) );
1650cdf0e10cSrcweir 		pEditView->SetOutputArea( Rectangle( Point(0,0), GetOutputSize() ) );
1651cdf0e10cSrcweir 		pEditEngine->SetMaxAutoPaperSize( GetOutputSize() );
1652cdf0e10cSrcweir 		pEditEngine->SetPaperSize( Size( 0, 0 ) );
1653cdf0e10cSrcweir 	}
1654cdf0e10cSrcweir 	else if ( rKEvt.GetKeyCode().IsMod2() && ( nCode == KEY_0 ) )
1655cdf0e10cSrcweir 	{
1656cdf0e10cSrcweir 		ULONG nEVCtrl = pEditView->GetControlWord();
1657cdf0e10cSrcweir 		nEVCtrl = nEVCtrl | EV_CNTRL_AUTOSIZE;
1658cdf0e10cSrcweir 		pEditView->SetControlWord( nEVCtrl );
1659cdf0e10cSrcweir 
1660cdf0e10cSrcweir 		Size aOutSz( GetOutputSize() );
1661cdf0e10cSrcweir 		Size aPaperSz( aOutSz.Width() / 2, 0 );
1662cdf0e10cSrcweir 		pEditView->SetOutputArea( Rectangle( Point(), aPaperSz ) );
1663cdf0e10cSrcweir 		pEditEngine->SetPaperSize( aPaperSz );
1664cdf0e10cSrcweir 		// Max-Height wird bei View verwendet,
1665cdf0e10cSrcweir 		// MinSize/MaxSize nur, wenn AUTOPAGESIZE ( KEY_1 - KEY_9 )
1666cdf0e10cSrcweir 		pEditEngine->SetMaxAutoPaperSize( Size( aOutSz.Width() / 2, aOutSz.Height() / 2 ) );
1667cdf0e10cSrcweir 		pEditEngine->SetMinAutoPaperSize( Size( aOutSz.Width() / 8, aOutSz.Height() / 8 ) );
1668cdf0e10cSrcweir 	}
1669cdf0e10cSrcweir 	else if ( ( nCode == KEY_J ) && rKEvt.GetKeyCode().IsMod2() )
1670cdf0e10cSrcweir 	{
1671cdf0e10cSrcweir 		Size aTextSz( pEditEngine->CalcTextWidth(), pEditEngine->GetTextHeight() );
1672cdf0e10cSrcweir 		Rectangle aRect( pEditView->GetOutputArea().TopLeft(), aTextSz );
1673cdf0e10cSrcweir 		Brush aTmpBrush( Color( COL_LIGHTBLUE ), BRUSH_25 );
1674cdf0e10cSrcweir 		Brush aOldBrush( GetFillInBrush() );
1675cdf0e10cSrcweir 		SetFillInBrush( aTmpBrush );
1676cdf0e10cSrcweir 		DrawRect( aRect );
1677cdf0e10cSrcweir 		SetFillInBrush( aOldBrush );
1678cdf0e10cSrcweir 		pEditView->Paint( aRect );
1679cdf0e10cSrcweir 	}
1680cdf0e10cSrcweir 	else if ( ( nCode == KEY_H ) && rKEvt.GetKeyCode().IsMod2() )
1681cdf0e10cSrcweir 	{
1682cdf0e10cSrcweir 		Push();
1683cdf0e10cSrcweir 		Size aSz( pEditEngine->CalcTextWidth(), pEditEngine->GetTextHeight() );
1684cdf0e10cSrcweir 		Pen aPen( PEN_SOLID );
1685cdf0e10cSrcweir 		Brush aBrush( Color( COL_GRAY ), BRUSH_SOLID );
1686cdf0e10cSrcweir 		aPen.SetColor( Color( COL_BLACK ) );
1687cdf0e10cSrcweir 		SetPen( aPen );
1688cdf0e10cSrcweir 		SetFillInBrush( aBrush );
1689cdf0e10cSrcweir 		Rectangle aR( pEditView->GetOutputArea().TopLeft(), aSz );
1690cdf0e10cSrcweir 		DrawRect( aR );
1691cdf0e10cSrcweir 		Pop();
1692cdf0e10cSrcweir 		pEditEngine->Draw( this, pEditView->GetOutputArea() );
1693cdf0e10cSrcweir 		pEditView->ShowCursor( TRUE, TRUE );
1694cdf0e10cSrcweir 	}
1695cdf0e10cSrcweir 
1696cdf0e10cSrcweir 	// Eingabe an EditEngine...
1697cdf0e10cSrcweir 	else
1698cdf0e10cSrcweir 	{
1699cdf0e10cSrcweir 		BOOL bDone = pEditView->PostKeyEvent( rKEvt );
1700cdf0e10cSrcweir 		if ( !bDone )
1701cdf0e10cSrcweir 			Window::KeyInput( rKEvt );
1702cdf0e10cSrcweir 	}
1703cdf0e10cSrcweir 
1704cdf0e10cSrcweir 	((EditMainWindow*)GetParent())->UpdateToolBox();
1705cdf0e10cSrcweir }
1706cdf0e10cSrcweir 
MouseMove(const MouseEvent & rMEvt)1707cdf0e10cSrcweir void __EXPORT EditViewWindow::MouseMove( const MouseEvent& rMEvt )
1708cdf0e10cSrcweir {
1709cdf0e10cSrcweir 	Point aPos = PixelToLogic( rMEvt.GetPosPixel() );
1710cdf0e10cSrcweir 	if ( pEditView->GetOutputArea().IsInside( aPos ) )
1711cdf0e10cSrcweir 	{
1712cdf0e10cSrcweir 		const SvxFieldItem* pField = pEditView->GetFieldUnderMousePointer();
1713cdf0e10cSrcweir 		if ( pField )
1714cdf0e10cSrcweir 			SetPointer( aURLPtr );
1715cdf0e10cSrcweir 		else
1716cdf0e10cSrcweir 			SetPointer( pEditView->GetPointer() );
1717cdf0e10cSrcweir 
1718cdf0e10cSrcweir //		aPos -= pEditView->GetOutputArea().TopLeft();
1719cdf0e10cSrcweir //		aPos += pEditView->GetVisArea().TopLeft();
1720cdf0e10cSrcweir //		if ( pEditView->GetEditEngine()->IsTextPos( aPos, PixelToLogic( Size( 5, 0 ) ).Width() ) )
1721cdf0e10cSrcweir //			SetPointer( pEditView->GetPointer() );
1722cdf0e10cSrcweir //		else
1723cdf0e10cSrcweir //			SetPointer( Pointer( POINTER_REFHAND ) );
1724cdf0e10cSrcweir 
1725cdf0e10cSrcweir 	}
1726cdf0e10cSrcweir 	else
1727cdf0e10cSrcweir 		SetPointer( aStdPtr );
1728cdf0e10cSrcweir 
1729cdf0e10cSrcweir //	static long x = 0;
1730cdf0e10cSrcweir //	x++;
1731cdf0e10cSrcweir //	DBG_ASSERT( x < 1000, String( RTL_CONSTASCII_USTRINGPARAM( "?" ) ) );
1732cdf0e10cSrcweir 	pEditView->MouseMove( rMEvt );
1733cdf0e10cSrcweir }
1734cdf0e10cSrcweir 
MouseButtonDown(const MouseEvent & rMEvt)1735cdf0e10cSrcweir void __EXPORT EditViewWindow::MouseButtonDown( const MouseEvent& rMEvt )
1736cdf0e10cSrcweir {
1737cdf0e10cSrcweir 	GrabFocus();
1738cdf0e10cSrcweir 	pEditView->MouseButtonDown( rMEvt );
1739cdf0e10cSrcweir }
1740cdf0e10cSrcweir 
MouseButtonUp(const MouseEvent & rMEvt)1741cdf0e10cSrcweir void __EXPORT EditViewWindow::MouseButtonUp( const MouseEvent& rMEvt )
1742cdf0e10cSrcweir {
1743cdf0e10cSrcweir 	pEditView->MouseButtonUp( rMEvt );
1744cdf0e10cSrcweir 	((EditMainWindow*)GetParent())->UpdateToolBox();
1745cdf0e10cSrcweir }
1746cdf0e10cSrcweir 
Command(const CommandEvent & rCEvt)1747cdf0e10cSrcweir void __EXPORT EditViewWindow::Command( const CommandEvent& rCEvt )
1748cdf0e10cSrcweir {
1749cdf0e10cSrcweir 	if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
1750cdf0e10cSrcweir 	{
1751cdf0e10cSrcweir 		if( pEditView->IsWrongSpelledWordAtPos( rCEvt.GetMousePosPixel() ) )
1752cdf0e10cSrcweir 			pEditView->ExecuteSpellPopup( rCEvt.GetMousePosPixel() );
1753cdf0e10cSrcweir 	}
1754cdf0e10cSrcweir 	else
1755cdf0e10cSrcweir 		pEditView->Command(rCEvt);
1756cdf0e10cSrcweir 
1757cdf0e10cSrcweir }
1758cdf0e10cSrcweir 
Drop(const DropEvent & rEvt)1759cdf0e10cSrcweir BOOL __EXPORT EditViewWindow::Drop( const DropEvent& rEvt )
1760cdf0e10cSrcweir {
1761cdf0e10cSrcweir 	return pEditView->Drop( rEvt );
1762cdf0e10cSrcweir }
1763cdf0e10cSrcweir 
QueryDrop(DropEvent & rEvt)1764cdf0e10cSrcweir BOOL __EXPORT EditViewWindow::QueryDrop( DropEvent& rEvt )
1765cdf0e10cSrcweir {
1766cdf0e10cSrcweir 	return pEditView->QueryDrop( rEvt );
1767cdf0e10cSrcweir }
1768cdf0e10cSrcweir 
1769cdf0e10cSrcweir // --- aEditApp ------------------------------------------------------
1770cdf0e10cSrcweir 
Main()1771cdf0e10cSrcweir void __EXPORT EditApp::Main()
1772cdf0e10cSrcweir {
1773cdf0e10cSrcweir #ifdef WNT
1774cdf0e10cSrcweir 	SvFactory::Init();
1775cdf0e10cSrcweir #endif
1776cdf0e10cSrcweir 
1777cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >  xSMgr = createApplicationServiceManager();
1778cdf0e10cSrcweir 	::comphelper::setProcessServiceFactory( xSMgr );
1779cdf0e10cSrcweir 
1780cdf0e10cSrcweir 	EditDLL aEditDll;
1781cdf0e10cSrcweir 	SvxGlobalItemData aItemData;
1782cdf0e10cSrcweir 	SvxFieldItem::GetClassManager().SV_CLASS_REGISTER( SvxDateField );
1783cdf0e10cSrcweir 	SvxFieldItem::GetClassManager().SV_CLASS_REGISTER( SvxURLField );
1784cdf0e10cSrcweir 
1785cdf0e10cSrcweir 	Help::EnableQuickHelp();
1786cdf0e10cSrcweir 
1787cdf0e10cSrcweir 	EditMainWindow aWindow;
1788cdf0e10cSrcweir 	Execute();
1789cdf0e10cSrcweir }
1790cdf0e10cSrcweir 
1791cdf0e10cSrcweir EditApp aEditApp;
1792