xref: /aoo42x/main/sw/source/ui/ribbar/inputwin.cxx (revision efeef26f)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sw.hxx"
26 
27 
28 #include <tools/gen.hxx>
29 #include <sfx2/imgmgr.hxx>
30 #include <sfx2/viewfrm.hxx>
31 #include <sfx2/dispatch.hxx>
32 #include <svx/ruler.hxx>
33 #include <svl/zforlist.hxx>
34 #include <svl/stritem.hxx>
35 #include <unotools/undoopt.hxx>
36 
37 #include "swtypes.hxx"
38 #include "cmdid.h"
39 #include "swmodule.hxx"
40 #include "wrtsh.hxx"
41 #include "view.hxx"
42 #include "calc.hxx"
43 #include "inputwin.hxx"
44 #include "fldbas.hxx"
45 #include "fldmgr.hxx"
46 #include "frmfmt.hxx"
47 #include "cellatr.hxx"
48 #include "edtwin.hxx"
49 #include "helpid.h"
50 
51 // nur fuers UpdateRange - Box in dem der gestackte Cursor sthet loeschen
52 #include "pam.hxx"
53 
54 #include "swundo.hxx"
55 #include "ribbar.hrc"
56 #include "inputwin.hrc"
57 
58 #include <IDocumentContentOperations.hxx>
59 
60 SFX_IMPL_POS_CHILDWINDOW( SwInputChild, FN_EDIT_FORMULA, SFX_OBJECTBAR_OBJECT )
61 
62 //==================================================================
63 
64 SwInputWindow::SwInputWindow( Window* pParent, SfxBindings* pBind )
65 	: ToolBox( 	pParent ,	SW_RES( RID_TBX_FORMULA )),
66     aPos(       this,       SW_RES(ED_POS)),
67 	aEdit(      this, WB_3DLOOK|WB_TABSTOP|WB_BORDER|WB_NOHIDESELECTION),
68 	aPopMenu(	SW_RES(MN_CALC_POPUP)),
69 	pMgr(0),
70     pWrtShell(0),
71 	pView(0),
72     pBindings(pBind),
73 	aAktTableName(aEmptyStr)
74     , m_nActionCount(0)
75     , m_bDoesUndo(true)
76     , m_bResetUndo(false)
77     , m_bCallUndo(false)
78 {
79     bFirst = sal_True;
80     bActive = bIsTable = bDelSel = sal_False;
81 
82 	FreeResource();
83 
84 	aEdit.SetSizePixel( aEdit.CalcMinimumSize() );
85 
86     SfxImageManager* pManager = SfxImageManager::GetImageManager( SW_MOD() );
87     pManager->RegisterToolBox(this);
88 
89 	pView = ::GetActiveView();
90 	pWrtShell = pView ? pView->GetWrtShellPtr() : 0;
91 
92 	InsertWindow( ED_POS, &aPos, 0, 0);
93 	InsertSeparator ( 1 );
94 	InsertSeparator ();
95 	InsertWindow( ED_FORMULA, &aEdit);
96 	SetHelpId(ED_FORMULA, HID_EDIT_FORMULA);
97 
98     sal_Bool bHC = GetSettings().GetStyleSettings().GetHighContrastMode();
99     SetItemImage( FN_FORMULA_CALC, pManager->GetImage(FN_FORMULA_CALC, bHC ));
100 	SetItemImage( FN_FORMULA_CANCEL, pManager->GetImage(FN_FORMULA_CANCEL, bHC  ));
101 	SetItemImage( FN_FORMULA_APPLY, pManager->GetImage(FN_FORMULA_APPLY, bHC  ));
102 
103     SetItemBits( FN_FORMULA_CALC, GetItemBits( FN_FORMULA_CALC ) | TIB_DROPDOWNONLY );
104     SetDropdownClickHdl( LINK( this, SwInputWindow, DropdownClickHdl ));
105 
106 	Size	aSizeTbx = CalcWindowSizePixel();
107 	Size 	aEditSize = aEdit.GetSizePixel();
108 	Rectangle aItemRect( GetItemRect(FN_FORMULA_CALC) );
109 	long nMaxHeight = (aEditSize.Height() > aItemRect.GetHeight()) ? aEditSize.Height() : aItemRect.GetHeight();
110 	if( nMaxHeight+2 > aSizeTbx.Height() )
111 	    aSizeTbx.Height() = nMaxHeight+2;
112 	Size aSize = GetSizePixel();
113 	aSize.Height() = aSizeTbx.Height();
114 	SetSizePixel( aSize );
115 
116 	// align edit and item vcentered
117 	Size 	aPosSize = aPos.GetSizePixel();
118 	aPosSize.Height()  = nMaxHeight;
119 	aEditSize.Height() = nMaxHeight;
120 	Point aPosPos  = aPos.GetPosPixel();
121 	Point aEditPos = aEdit.GetPosPixel();
122 	aPosPos.Y()    = (aSize.Height() - nMaxHeight)/2 + 1;
123 	aEditPos.Y()   = (aSize.Height() - nMaxHeight)/2 + 1;
124 	aPos.SetPosSizePixel( aPosPos, aPosSize );
125 	aEdit.SetPosSizePixel( aEditPos, aEditSize );
126 
127 	aPopMenu.SetSelectHdl(LINK( this, SwInputWindow, MenuHdl ));
128 }
129 
130 //==================================================================
131 
132 __EXPORT SwInputWindow::~SwInputWindow()
133 {
134     SfxImageManager::GetImageManager( SW_MOD() )->ReleaseToolBox(this);
135 
136 	//Lineale aufwecken
137 	if(pView)
138 	{
139         pView->GetHLineal().SetActive( sal_True );
140         pView->GetVLineal().SetActive( sal_True );
141 	}
142 	if ( pMgr )
143 		delete pMgr;
144 	if(pWrtShell)
145 		pWrtShell->EndSelTblCells();
146 
147     CleanupUglyHackWithUndo();
148 }
149 
150 void SwInputWindow::CleanupUglyHackWithUndo()
151 {
152     if (m_bResetUndo)
153     {
154         DelBoxCntnt();
155         pWrtShell->DoUndo(m_bDoesUndo);
156         if (m_bCallUndo)
157         {
158             pWrtShell->Undo();
159         }
160         if (0 == m_nActionCount)
161         {
162             SW_MOD()->GetUndoOptions().SetUndoCount(0);
163         }
164         m_bResetUndo = false; // #i117122# once is enough :)
165     }
166 }
167 
168 
169 //==================================================================
170 
171 void SwInputWindow::DataChanged( const DataChangedEvent& rDCEvt )
172 {
173     if ( rDCEvt.GetType() == DATACHANGED_SETTINGS && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
174     {
175         //      update item images
176         SwModule *pMod  = SW_MOD();
177         SfxImageManager *pImgMgr = SfxImageManager::GetImageManager( pMod );
178         sal_Bool bHC = GetSettings().GetStyleSettings().GetHighContrastMode();
179         //
180         SetItemImage( FN_FORMULA_CALC,   pImgMgr->GetImage(FN_FORMULA_CALC,   bHC ));
181         SetItemImage( FN_FORMULA_CANCEL, pImgMgr->GetImage(FN_FORMULA_CANCEL, bHC ));
182         SetItemImage( FN_FORMULA_APPLY,  pImgMgr->GetImage(FN_FORMULA_APPLY,  bHC ));
183     }
184 
185     ToolBox::DataChanged( rDCEvt );
186 }
187 
188 //==================================================================
189 
190 void __EXPORT SwInputWindow::Resize()
191 {
192 	ToolBox::Resize();
193 
194 	long	nWidth		= GetSizePixel().Width();
195 	long	nLeft		= aEdit.GetPosPixel().X();
196 	Size	aEditSize	= aEdit.GetSizePixel();
197 
198 	aEditSize.Width() = Max( ((long)(nWidth - nLeft - 5)), (long)0 );
199 	aEdit.SetSizePixel( aEditSize );
200 	aEdit.Invalidate();
201 }
202 
203 //==================================================================
204 
205 void SwInputWindow::ShowWin()
206 {
207 	bIsTable = sal_False;
208 	//Lineale anhalten
209 	if(pView)
210 	{
211         pView->GetHLineal().SetActive( sal_False );
212         pView->GetVLineal().SetActive( sal_False );
213 
214 		DBG_ASSERT(pWrtShell, "Keine WrtShell!");
215 		// Cursor in Tabelle
216 		bIsTable = pWrtShell->IsCrsrInTbl() ? sal_True : sal_False;
217 
218 		if( bFirst )
219 			pWrtShell->SelTblCells( LINK( this, SwInputWindow,
220 												SelTblCellsNotify) );
221 		if( bIsTable )
222 		{
223 			const String& rPos = pWrtShell->GetBoxNms();
224 			sal_uInt16 nPos = 0;
225 			short nSrch = -1;
226 			while( (nPos = rPos.Search( ':',nPos + 1 ) ) != STRING_NOTFOUND )
227 				nSrch = (short) nPos;
228 			aPos.SetText( rPos.Copy( ++nSrch ) );
229 			aAktTableName = pWrtShell->GetTableFmt()->GetName();
230 		}
231 		else
232             aPos.SetText(SW_RESSTR(STR_TBL_FORMULA));
233 
234 		// Aktuelles Feld bearbeiten
235 		ASSERT(pMgr == 0, FieldManager nicht geloescht.);
236 		pMgr = new SwFldMgr;
237 
238 		// JP 13.01.97: Formel soll immer mit einem "=" beginnen, hier
239 		//				also setzen
240 		String sEdit( '=' );
241 		if( pMgr->GetCurFld() && TYP_FORMELFLD == pMgr->GetCurTypeId() )
242 		{
243 			sEdit += pMgr->GetCurFldPar2();
244 		}
245 		else if( bFirst )
246 		{
247 			if( bIsTable )
248             {
249                 m_bResetUndo = true;
250                 m_nActionCount = SW_MOD()->GetUndoOptions().GetUndoCount();
251                 if (0 == m_nActionCount) { // deactivated? turn it on...
252                     SW_MOD()->GetUndoOptions().SetUndoCount(1);
253                 }
254 
255                 m_bDoesUndo = pWrtShell->DoesUndo();
256                 if( !m_bDoesUndo )
257                 {
258                     pWrtShell->DoUndo( sal_True );
259                 }
260 
261 				if( !pWrtShell->SwCrsrShell::HasSelection() )
262 				{
263 					pWrtShell->MoveSection( fnSectionCurr, fnSectionStart );
264 					pWrtShell->SetMark();
265 					pWrtShell->MoveSection( fnSectionCurr, fnSectionEnd );
266 				}
267 				if( pWrtShell->SwCrsrShell::HasSelection() )
268 				{
269 					pWrtShell->StartUndo( UNDO_DELETE );
270 					pWrtShell->Delete();
271 					if( 0 != pWrtShell->EndUndo( UNDO_DELETE ))
272                     {
273                         m_bCallUndo = true;
274                     }
275                 }
276                 pWrtShell->DoUndo(false);
277 
278 				SfxItemSet aSet( pWrtShell->GetAttrPool(), RES_BOXATR_FORMULA, RES_BOXATR_FORMULA );
279 				if( pWrtShell->GetTblBoxFormulaAttrs( aSet ))
280 					sEdit += ((SwTblBoxFormula&)aSet.Get( RES_BOXATR_FORMULA )).GetFormula();
281 			}
282 		}
283 
284 		if( bFirst )
285 		{
286 			// WrtShell Flags richtig setzen
287 			pWrtShell->SttSelect();
288 			pWrtShell->EndSelect();
289 		}
290 
291 		bFirst = sal_False;
292 
293 		aEdit.SetModifyHdl( LINK( this, SwInputWindow, ModifyHdl ));
294 
295 		aEdit.SetText( sEdit );
296 		aEdit.SetSelection( Selection( sEdit.Len(), sEdit.Len() ) );
297 		sOldFml = sEdit;
298 
299 		aEdit.Invalidate();
300 		aEdit.Update();
301 		aEdit.GrabFocus();
302 		// UserInterface fuer die Eingabe abklemmen
303 
304 		pView->GetEditWin().LockKeyInput(sal_True);
305 		pView->GetViewFrame()->GetDispatcher()->Lock(sal_True);
306 		pWrtShell->Push();
307 	}
308 	ToolBox::Show();
309 }
310 //==================================================================
311 
312 IMPL_LINK( SwInputWindow, MenuHdl, Menu *, pMenu )
313 {
314 static const char * __READONLY_DATA aStrArr[] = {
315 	sCalc_Phd,
316 	sCalc_Sqrt,
317 	sCalc_Or,
318 	sCalc_Xor,
319 	sCalc_And,
320 	sCalc_Not,
321 	sCalc_Eq,
322 	sCalc_Neq,
323 	sCalc_Leq,
324 	sCalc_Geq,
325 	sCalc_L,
326 	sCalc_G,
327 	sCalc_Sum,
328 	sCalc_Mean,
329 	sCalc_Min,
330 	sCalc_Max,
331 	sCalc_Sin,
332 	sCalc_Cos,
333 	sCalc_Tan,
334 	sCalc_Asin,
335 	sCalc_Acos,
336 	sCalc_Atan,
337 	sCalc_Pow,
338 	"|",
339 	sCalc_Round
340 };
341 
342 	sal_uInt16 nId = pMenu->GetCurItemId();
343 	if ( nId <= MN_CALC_ROUND )
344 	{
345 		String aTmp( String::CreateFromAscii(aStrArr[nId - 1]) );
346 		aTmp += ' ';
347 		aEdit.ReplaceSelected( aTmp );
348 	}
349 	return 0;
350 }
351 
352 IMPL_LINK( SwInputWindow, DropdownClickHdl, ToolBox*, EMPTYARG )
353 {
354 	sal_uInt16 nCurID = GetCurItemId();
355 	EndSelection();	// setzt CurItemId zurueck !
356 	switch ( nCurID )
357 	{
358 		case FN_FORMULA_CALC :
359 		{
360             aPopMenu.Execute( this, GetItemRect( FN_FORMULA_CALC ), POPUPMENU_NOMOUSEUPCLOSE );
361             break;
362         default:
363             break;
364         }
365     }
366 
367     return sal_True;
368 }
369 
370 //==================================================================
371 
372 
373 void __EXPORT SwInputWindow::Click( )
374 {
375 	sal_uInt16 nCurID = GetCurItemId();
376 	EndSelection();	// setzt CurItemId zurueck !
377 	switch ( nCurID )
378 	{
379 		case FN_FORMULA_CANCEL:
380 		{
381 			CancelFormula();
382 		}
383 		break;
384 		case FN_FORMULA_APPLY:
385 		{
386 			ApplyFormula();
387 		}
388 		break;
389    }
390 }
391 
392 //==================================================================
393 
394 void  SwInputWindow::ApplyFormula()
395 {
396 	pView->GetViewFrame()->GetDispatcher()->Lock(sal_False);
397 	pView->GetEditWin().LockKeyInput(sal_False);
398     CleanupUglyHackWithUndo();
399 	pWrtShell->Pop( sal_False );
400 
401 	// JP 13.01.97: Formel soll immer mit einem "=" beginnen, hier
402 	//				also wieder entfernen
403 	String sEdit( aEdit.GetText() );
404 	sEdit.EraseLeadingChars().EraseTrailingChars();
405 	if( sEdit.Len() && '=' == sEdit.GetChar( 0 ) )
406 		sEdit.Erase( 0, 1 );
407     SfxStringItem aParam(FN_EDIT_FORMULA, sEdit);
408 
409 	pWrtShell->EndSelTblCells();
410 	pView->GetEditWin().GrabFocus();
411     const SfxPoolItem* aArgs[2];
412     aArgs[0] = &aParam;
413     aArgs[1] = 0;
414     pView->GetViewFrame()->GetBindings().Execute( FN_EDIT_FORMULA, aArgs, 0, SFX_CALLMODE_ASYNCHRON );
415 }
416 
417 //==================================================================
418 
419 void  SwInputWindow::CancelFormula()
420 {
421 	if(pView)
422 	{
423 		pView->GetViewFrame()->GetDispatcher()->Lock( sal_False );
424 		pView->GetEditWin().LockKeyInput(sal_False);
425         CleanupUglyHackWithUndo();
426 		pWrtShell->Pop( sal_False );
427 
428 		if( bDelSel )
429 			pWrtShell->EnterStdMode();
430 
431 		pWrtShell->EndSelTblCells();
432 
433 		pView->GetEditWin().GrabFocus();
434 	}
435 	pView->GetViewFrame()->GetDispatcher()->Execute( FN_EDIT_FORMULA, SFX_CALLMODE_ASYNCHRON);
436 }
437 //==================================================================
438 
439 const xub_Unicode CH_LRE = 0x202a;
440 const xub_Unicode CH_PDF = 0x202c;
441 
442 IMPL_LINK( SwInputWindow, SelTblCellsNotify, SwWrtShell *, pCaller )
443 {
444 	if(bIsTable)
445 	{
446 		SwFrmFmt* pTblFmt = pCaller->GetTableFmt();
447 		String sBoxNms( pCaller->GetBoxNms() );
448 		String sTblNm;
449 		if( pTblFmt && aAktTableName != pTblFmt->GetName() )
450 			sTblNm = pTblFmt->GetName();
451 
452 		aEdit.UpdateRange( sBoxNms, sTblNm );
453 
454 		String sNew;
455         sNew += CH_LRE;
456         sNew += aEdit.GetText();
457         sNew += CH_PDF;
458 
459         if( sNew != sOldFml )
460 		{
461 			// Die WrtShell ist in der Tabellen Selektion
462 			// dann die Tabellen Selektion wieder aufheben, sonst steht der
463 			// Cursor "im Wald" und das LiveUpdate funktioniert nicht!
464 			pWrtShell->StartAllAction();
465 
466 			SwPaM aPam( *pWrtShell->GetStkCrsr()->GetPoint() );
467 			aPam.Move( fnMoveBackward, fnGoSection );
468 			aPam.SetMark();
469 			aPam.Move( fnMoveForward, fnGoSection );
470 
471             IDocumentContentOperations* pIDCO = pWrtShell->getIDocumentContentOperations();
472             pIDCO->DeleteRange( aPam );
473             pIDCO->InsertString( aPam, sNew );
474 			pWrtShell->EndAllAction();
475 			sOldFml = sNew;
476 		}
477 	}
478 	else
479 		aEdit.GrabFocus();
480 	return 0;
481 }
482 
483 
484 void SwInputWindow::SetFormula( const String& rFormula, sal_Bool bDelFlag )
485 {
486 	String sEdit( '=' );
487 	if( rFormula.Len() )
488 	{
489 		if( '=' == rFormula.GetChar( 0 ) )
490 			sEdit = rFormula;
491 		else
492 			sEdit += rFormula;
493 	}
494 	aEdit.SetText( sEdit );
495 	aEdit.SetSelection( Selection( sEdit.Len(), sEdit.Len() ) );
496 	aEdit.Invalidate();
497 	bDelSel = bDelFlag;
498 }
499 
500 IMPL_LINK( SwInputWindow, ModifyHdl, InputEdit*, EMPTYARG )
501 {
502     if (bIsTable && m_bResetUndo)
503 	{
504 		pWrtShell->StartAllAction();
505 		DelBoxCntnt();
506 		String sNew;
507         sNew += CH_LRE;
508         sNew += aEdit.GetText();
509         sNew += CH_PDF;
510         pWrtShell->SwEditShell::Insert2( sNew );
511 		pWrtShell->EndAllAction();
512 		sOldFml = sNew;
513 	}
514 	return 0;
515 }
516 
517 
518 void SwInputWindow::DelBoxCntnt()
519 {
520 	if( bIsTable )
521 	{
522 		pWrtShell->StartAllAction();
523 		pWrtShell->ClearMark();
524 		pWrtShell->Pop( sal_False );
525 		pWrtShell->Push();
526 		pWrtShell->MoveSection( fnSectionCurr, fnSectionStart );
527 		pWrtShell->SetMark();
528 		pWrtShell->MoveSection( fnSectionCurr, fnSectionEnd );
529 		pWrtShell->SwEditShell::Delete();
530 		pWrtShell->EndAllAction();
531 	}
532 }
533 
534 //==================================================================
535 
536 void __EXPORT InputEdit::KeyInput(const KeyEvent& rEvent)
537 {
538 	const KeyCode aCode = rEvent.GetKeyCode();
539 	if(aCode == KEY_RETURN || aCode == KEY_F2 )
540 		((SwInputWindow*)GetParent())->ApplyFormula();
541 	else if(aCode == KEY_ESCAPE )
542 		((SwInputWindow*)GetParent())->CancelFormula();
543 	else
544 		Edit::KeyInput(rEvent);
545 }
546 
547 //==================================================================
548 
549 void __EXPORT InputEdit::UpdateRange(const String& rBoxes,
550 									const String& rName )
551 {
552 	if( !rBoxes.Len() )
553 	{
554 		GrabFocus();
555 		return;
556 	}
557 	const sal_Unicode	cOpen = '<', cClose = '>',
558                 cOpenBracket = '(';
559 	String aPrefix = rName;
560 	if(rName.Len())
561 		aPrefix += '.';
562 	String aBoxes = aPrefix;
563 	aBoxes += rBoxes;
564 	Selection aSelection(GetSelection());
565 	sal_uInt16 nSel = (sal_uInt16) aSelection.Len();
566 	//OS: mit dem folgenden Ausdruck wird sichergestellt, dass im overwrite-Modus
567 	//die selektierte schliessende Klammer nicht geloescht wird
568 	if( nSel && ( nSel > 1 ||
569 		GetText().GetChar( (sal_uInt16)aSelection.Min() ) != cClose ) )
570 		Cut();
571 	else
572 		aSelection.Max() = aSelection.Min();
573 	String aActText(GetText());
574 	const sal_uInt16 nLen = aActText.Len();
575 	if( !nLen )
576 	{
577 		String aStr(cOpen);
578 		aStr += aBoxes;
579 		aStr += cClose;
580 		SetText(aStr);
581 		sal_uInt16 nPos = aStr.Search( cClose );
582 		ASSERT(nPos < aStr.Len(), Delimiter nicht gefunden.);
583 		++nPos;
584 		SetSelection( Selection( nPos, nPos ));
585 	}
586 	else
587 	{
588 		sal_Bool bFound = sal_False;
589 		sal_Unicode cCh;
590         sal_uInt16 nPos, nEndPos = 0, nStartPos = (sal_uInt16) aSelection.Min();
591 		if( nStartPos-- )
592 		{
593 			do {
594 				if( cOpen  == (cCh = aActText.GetChar( nStartPos ) ) ||
595 					cOpenBracket == cCh )
596 				{
597 					bFound = cCh == cOpen;
598 					break;
599 				}
600 			} while( nStartPos-- > 0 );
601 		}
602 		if( bFound )
603 		{
604 			bFound = sal_False;
605 			nEndPos = nStartPos;
606 			while( nEndPos < nLen )
607 			{
608 				if( cClose == (cCh = aActText.GetChar( nEndPos )) /*||
609 					cCh == cCloseBracket*/ )
610 				{
611 					bFound = sal_True;
612 					break;
613 				}
614 				++nEndPos;
615 			}
616 			// nur wenn akt. Pos im Breich oder direkt dahinter liegt
617 			if( bFound && !( nStartPos < (sal_uInt16)aSelection.Max() &&
618 							 (sal_uInt16)aSelection.Max() <= nEndPos + 1 ))
619 				bFound = sal_False;
620 		}
621 		if( bFound )
622 		{
623 			nPos = ++nStartPos + 1; // wir wollen dahinter
624 			aActText.Erase( nStartPos, nEndPos - nStartPos );
625 			aActText.Insert( aBoxes, nStartPos );
626             nPos = nPos + aBoxes.Len();
627 		}
628 		else
629 		{
630 			String aTmp( (char)cOpen );
631 			aTmp += aBoxes;
632 			aTmp += (char)cClose;
633 			nPos = (sal_uInt16)aSelection.Min();
634 			aActText.Insert( aTmp, nPos );
635             nPos = nPos + aTmp.Len();
636 		}
637 		if( GetText() != aActText )
638 		{
639 			SetText( aActText );
640 			SetSelection( Selection( nPos, nPos ) );
641 //			GetModifyHdl().Call( this );
642 		}
643 	}
644 	GrabFocus();
645 
646 }
647 //==================================================================
648 
649 
650 SwInputChild::SwInputChild(Window* _pParent,
651 								sal_uInt16 nId,
652                                 SfxBindings* pBindings,
653 								SfxChildWinInfo* ) :
654                                 SfxChildWindow( _pParent, nId )
655 {
656     pDispatch = pBindings->GetDispatcher();
657     pWindow = new SwInputWindow( _pParent, pBindings );
658 	((SwInputWindow*)pWindow)->ShowWin();
659 	eChildAlignment = SFX_ALIGN_LOWESTTOP;
660 }
661 
662 
663 __EXPORT SwInputChild::~SwInputChild()
664 {
665 	if(pDispatch)
666 		pDispatch->Lock(sal_False);
667 }
668 
669 
670 SfxChildWinInfo __EXPORT SwInputChild::GetInfo() const
671 {
672 	SfxChildWinInfo aInfo = SfxChildWindow::GetInfo();	   \
673 	return aInfo;
674 }
675 
676