1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: editwin.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_automation.hxx"
34 #if OSL_DEBUG_LEVEL > 1
35 #include <vcl/svapp.hxx>
36 #include "editwin.hxx"
39 class ImpWorkWindow
: public WorkWindow
42 MultiLineEdit m_aInhalt
;
43 ImpWorkWindow( WorkWindow
*pParent
, const UniString
&rName
, WinBits
);
48 ImpWorkWindow::ImpWorkWindow( WorkWindow
*pParent
, const String
&rName
, WinBits iWstyle
)
49 : WorkWindow( pParent
, WB_SIZEMOVE
)
50 , m_aInhalt( this, iWstyle
)
54 SetPosSizePixel( Point( 1,40 ), Size(500,150) );
58 ImpWorkWindow::~ImpWorkWindow()
63 void ImpWorkWindow::Resize()
65 m_aInhalt
.SetPosSizePixel( Point(), GetOutputSizePixel() );
68 BOOL
EditWindow::Close()
72 delete pImpWorkWindow
;
73 pImpWorkWindow
= NULL
;
78 void EditWindow::Show()
81 pImpWorkWindow
->Show();
86 void EditWindow::Hide()
89 pImpWorkWindow
->Hide();
94 EditWindow::EditWindow( WorkWindow
*pParent
, const String
&rName
, WinBits iWstyle
)
95 : pImpWorkWindow(NULL
)
104 EditWindow::~EditWindow()
109 BOOL
EditWindow::Check()
111 if ( ! pImpWorkWindow
&& Application::IsInExecute() )
113 pImpWorkWindow
= new ImpWorkWindow( pMemParent
, aMemName
, iMemWstyle
);
114 pImpWorkWindow
->m_aInhalt
.SetText( aMemPreWinText
);
115 nTextLen
= aMemPreWinText
.Len();
116 aMemPreWinText
.Erase();
118 pImpWorkWindow
->Show();
121 return pImpWorkWindow
!= NULL
;
124 void EditWindow::Clear()
128 pImpWorkWindow
->m_aInhalt
.SetText( String() );
131 aMemPreWinText
.Erase();
134 void EditWindow::AddText( const sal_Char
* rNew
)
136 AddText( UniString::CreateFromAscii( rNew
) );
139 void EditWindow::AddText( const String
&rNew
)
141 if ( bQuiet
) return;
144 aText
.ConvertLineEnd();
148 if ( nTextLen
> 5000 )
150 pImpWorkWindow
->m_aInhalt
.SetText( pImpWorkWindow
->m_aInhalt
.GetText().Erase(0,1000) );
151 nTextLen
= pImpWorkWindow
->m_aInhalt
.GetText().Len(); // Absolut, um Fehler sonstwo auszubügeln
155 pImpWorkWindow
->m_aInhalt
.SetSelection( Selection( SELECTION_MAX
, SELECTION_MAX
) );
156 pImpWorkWindow
->m_aInhalt
.ReplaceSelected( aText
);
157 nTextLen
= nTextLen
+ aText
.Len();
158 pImpWorkWindow
->m_aInhalt
.SetSelection( Selection( SELECTION_MAX
, SELECTION_MAX
) );
162 aMemPreWinText
+= aText
;