merge the formfield patch from ooo-build
[ooovba.git] / sw / source / ui / shells / textsh1.cxx
blob5ee90bac4d85dd78583cde70b75f79a160038c13
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: textsh1.cxx,v $
10 * $Revision: 1.70.84.1 $
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_sw.hxx"
33 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
34 #include <comphelper/processfactory.hxx>
35 #include <svx/dialogs.hrc>
36 #include <hintids.hxx>
37 #include <cmdid.h>
38 #include <helpid.h>
40 #include <i18npool/mslangid.hxx>
41 #include <svtools/languageoptions.hxx>
42 #include <svx/langitem.hxx>
43 #include <svtools/langtab.hxx>
44 #include <svtools/slstitm.hxx>
45 #include <string.h>
46 #include <svtools/stritem.hxx>
47 #include <svx/htmlmode.hxx>
48 #include <svtools/whiter.hxx>
49 #include <sfx2/bindings.hxx>
50 #include <sfx2/dispatch.hxx>
51 #include <sfx2/objitem.hxx>
52 #include <vcl/msgbox.hxx>
53 #include <vcl/unohelp2.hxx>
54 #include <sfx2/request.hxx>
55 #include <svtools/eitem.hxx>
56 #include <svtools/macitem.hxx>
57 #include <svx/lrspitem.hxx>
58 #include <svx/ulspitem.hxx>
59 #include <svx/colritem.hxx>
60 #include <svx/tstpitem.hxx>
61 #include <svx/brshitem.hxx>
62 #include <svx/svxacorr.hxx>
63 #include <svtools/cjkoptions.hxx>
64 #include <svtools/ctloptions.hxx>
65 #include <IDocumentSettingAccess.hxx>
66 #include <charfmt.hxx>
67 #include <svx/fontitem.hxx>
68 #include <svx/SmartTagItem.hxx>
69 #include <svx/dialmgr.hxx>
70 #include <fmtinfmt.hxx>
71 #include <swwait.hxx>
72 #include <wrtsh.hxx>
73 #include <wview.hxx>
74 #include <swmodule.hxx>
75 #include <viewopt.hxx>
76 #include <uitool.hxx>
77 #include <swevent.hxx>
78 #include <fmthdft.hxx>
79 #include <pagedesc.hxx>
80 #include <textsh.hxx>
81 #include <IMark.hxx>
82 #include <swdtflvr.hxx>
83 #include <docstat.hxx>
84 #include <outline.hxx>
85 #include <tablemgr.hxx>
86 #include <swundo.hxx> // fuer Undo-IDs
87 #include <reffld.hxx>
88 #include <docsh.hxx>
89 #include <mdiexp.hxx>
90 #include <inputwin.hxx>
91 #include <pardlg.hxx>
92 #include <frmatr.hxx>
93 #include <fmtcol.hxx>
94 #include <cellatr.hxx>
95 #include <edtwin.hxx>
96 #include <redlndlg.hxx>
97 #include "fldmgr.hxx"
99 #include <globals.hrc>
100 #include <shells.hrc>
101 #include <app.hrc>
102 #include <web.hrc>
103 #include "paratr.hxx"
104 #include <crsskip.hxx>
105 #include <docstat.hxx>
106 #include <vcl/svapp.hxx>
107 #include <sfx2/app.hxx>
108 #include <breakit.hxx>
110 #include <SwSmartTagMgr.hxx>
112 #include <svx/acorrcfg.hxx>
113 #include "swabstdlg.hxx"
114 #include "misc.hrc"
115 #include "chrdlg.hrc"
116 #include <IDocumentStatistics.hxx>
118 #include <sfx2/sfxdlg.hxx>
119 #include <svtools/languageoptions.hxx>
120 #include <svtools/lingucfg.hxx>
121 #include <com/sun/star/beans/XPropertySet.hpp>
122 #include <com/sun/star/util/XChangesBatch.hpp>
123 #include <com/sun/star/uno/Any.hxx>
124 #include <svx/unolingu.hxx>
125 #include <svtools/syslocaleoptions.hxx>
126 #include <doc.hxx>
127 #include <view.hxx>
128 #include <ndtxt.hxx>
129 #include <pam.hxx>
131 #include <langhelper.hxx>
133 using namespace ::com::sun::star;
136 void lcl_CharDialog( SwWrtShell &rWrtSh, BOOL bUseDialog, USHORT nSlot,const SfxItemSet *pArgs, SfxRequest *pReq )
138 FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &rWrtSh.GetView()));
139 SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< UINT16 >(eMetric)));
140 SfxItemSet aCoreSet( rWrtSh.GetView().GetPool(),
141 RES_CHRATR_BEGIN, RES_CHRATR_END-1,
142 RES_TXTATR_INETFMT, RES_TXTATR_INETFMT,
143 RES_BACKGROUND, RES_BACKGROUND,
144 FN_PARAM_SELECTION, FN_PARAM_SELECTION,
145 SID_HTML_MODE, SID_HTML_MODE,
146 SID_ATTR_CHAR_WIDTH_FIT_TO_LINE, SID_ATTR_CHAR_WIDTH_FIT_TO_LINE,
147 0 );
148 rWrtSh.GetCurAttr( aCoreSet );
149 BOOL bSel = rWrtSh.HasSelection();
150 BOOL bSelectionPut = FALSE;
151 if(bSel || rWrtSh.IsInWord())
153 if(!bSel)
155 rWrtSh.StartAction();
156 rWrtSh.Push();
157 if(!rWrtSh.SelectTxtAttr( RES_TXTATR_INETFMT ))
158 rWrtSh.SelWrd();
160 aCoreSet.Put(SfxStringItem(FN_PARAM_SELECTION, rWrtSh.GetSelTxt()));
161 bSelectionPut = TRUE;
162 if(!bSel)
164 rWrtSh.Pop(FALSE);
165 rWrtSh.EndAction();
168 aCoreSet.Put( SfxUInt16Item( SID_ATTR_CHAR_WIDTH_FIT_TO_LINE,
169 rWrtSh.GetScalingOfSelectedText() ) );
170 // Das CHRATR_BACKGROUND-Attribut wird fuer den Dialog in
171 // ein RES_BACKGROUND verwandelt und wieder zurueck ...
172 const SfxPoolItem *pTmpBrush;
173 if( SFX_ITEM_SET == aCoreSet.GetItemState( RES_CHRATR_BACKGROUND, TRUE, &pTmpBrush ) )
175 SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
176 aTmpBrush.SetWhich( RES_BACKGROUND );
177 aCoreSet.Put( aTmpBrush );
180 aCoreSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(rWrtSh.GetView().GetDocShell())));
181 SfxAbstractTabDialog* pDlg = NULL;
182 if ( bUseDialog && GetActiveView() )
184 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
185 DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
187 pDlg = pFact->CreateSwCharDlg( rWrtSh.GetView().GetWindow(), rWrtSh.GetView(), aCoreSet, DLG_CHAR );
188 DBG_ASSERT(pDlg, "Dialogdiet fail!");
189 if( FN_INSERT_HYPERLINK == nSlot )
190 pDlg->SetCurPageId(TP_CHAR_URL);
193 const SfxItemSet* pSet = NULL;
194 if ( !bUseDialog )
195 pSet = pArgs;
196 else if ( NULL != pDlg && pDlg->Execute() == RET_OK ) /* #110771# pDlg can be NULL */
198 pSet = pDlg->GetOutputItemSet();
201 if ( pSet)
203 SfxItemSet aTmpSet( *pSet );
204 if( SFX_ITEM_SET == aTmpSet.GetItemState( RES_BACKGROUND, FALSE, &pTmpBrush ) )
206 SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
207 aTmpBrush.SetWhich( RES_CHRATR_BACKGROUND );
208 aTmpSet.Put( aTmpBrush );
211 aTmpSet.ClearItem( RES_BACKGROUND );
213 const SfxPoolItem* pSelectionItem;
214 BOOL bInsert = FALSE;
215 xub_StrLen nInsert = 0;
217 // aus ungeklaerter Ursache ist das alte Item wieder im Set
218 if( !bSelectionPut && SFX_ITEM_SET == aTmpSet.GetItemState(FN_PARAM_SELECTION, FALSE, &pSelectionItem) )
220 String sInsert = ((const SfxStringItem*)pSelectionItem)->GetValue();
221 bInsert = sInsert.Len() != 0;
222 if(bInsert)
224 nInsert = sInsert.Len();
225 rWrtSh.StartAction();
226 rWrtSh.Insert( sInsert );
227 rWrtSh.SetMark();
228 rWrtSh.ExtendSelection(FALSE, sInsert.Len());
229 SfxRequest aReq( rWrtSh.GetView().GetViewFrame(), FN_INSERT_STRING );
230 aReq.AppendItem( SfxStringItem( FN_INSERT_STRING, sInsert ) );
231 aReq.Done();
232 SfxRequest aReq1( rWrtSh.GetView().GetViewFrame(), FN_CHAR_LEFT );
233 aReq1.AppendItem( SfxInt16Item(FN_PARAM_MOVE_COUNT, nInsert) );
234 aReq1.AppendItem( SfxBoolItem(FN_PARAM_MOVE_SELECTION, TRUE) );
235 aReq1.Done();
238 aTmpSet.ClearItem(FN_PARAM_SELECTION);
240 SwTxtFmtColl* pColl = rWrtSh.GetCurTxtFmtColl();
241 if(bSel && rWrtSh.IsSelFullPara() && pColl && pColl->IsAutoUpdateFmt())
243 rWrtSh.AutoUpdatePara(pColl, aTmpSet);
245 else
246 rWrtSh.SetAttr( aTmpSet );
247 if (pReq)
248 pReq->Done(aTmpSet);
249 if(bInsert)
251 SfxRequest aReq1( rWrtSh.GetView().GetViewFrame(), FN_CHAR_RIGHT );
252 aReq1.AppendItem( SfxInt16Item(FN_PARAM_MOVE_COUNT, nInsert) );
253 aReq1.AppendItem( SfxBoolItem(FN_PARAM_MOVE_SELECTION, FALSE) );
254 aReq1.Done();
255 rWrtSh.SwapPam();
256 rWrtSh.ClearMark();
257 rWrtSh.DontExpandFmt();
258 rWrtSh.EndAction();
262 delete pDlg;
265 /*--------------------------------------------------------------------
266 Beschreibung:
267 --------------------------------------------------------------------*/
269 short lcl_AskRedlineMode(Window *pWin)
271 MessBox aQBox( pWin, 0,
272 String( SW_RES( STR_REDLINE_TITLE ) ),
273 String( SW_RES( STR_REDLINE_MSG ) ) );
274 aQBox.SetImage( QueryBox::GetStandardImage() );
275 USHORT nBtnFlags = BUTTONDIALOG_DEFBUTTON |
276 BUTTONDIALOG_OKBUTTON |
277 BUTTONDIALOG_FOCUSBUTTON;
279 aQBox.AddButton(String(SW_RES(STR_REDLINE_ACCEPT_ALL)), RET_OK, nBtnFlags);
280 aQBox.GetPushButton( RET_OK )->SetHelpId(HID_AUTOFORMAT_ACCEPT);
281 aQBox.AddButton(String(SW_RES(STR_REDLINE_REJECT_ALL)), RET_CANCEL, BUTTONDIALOG_CANCELBUTTON);
282 aQBox.GetPushButton( RET_CANCEL )->SetHelpId(HID_AUTOFORMAT_REJECT );
283 aQBox.AddButton(String(SW_RES(STR_REDLINE_EDIT)), 2, 0);
284 aQBox.GetPushButton( 2 )->SetHelpId(HID_AUTOFORMAT_EDIT_CHG);
285 aQBox.SetButtonHelpText( RET_OK, aEmptyStr );
287 return aQBox.Execute();
290 void SwTextShell::Execute(SfxRequest &rReq)
292 BOOL bUseDialog = TRUE;
293 const SfxItemSet *pArgs = rReq.GetArgs();
294 SwWrtShell& rWrtSh = GetShell();
295 const SfxPoolItem* pItem = 0;
296 USHORT nSlot = rReq.GetSlot();
297 if(pArgs)
298 pArgs->GetItemState(GetPool().GetWhich(nSlot), FALSE, &pItem);
299 switch( nSlot )
301 case SID_LANGUAGE_STATUS:
303 // get the language
304 String aNewLangTxt;
305 SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_LANGUAGE_STATUS , sal_False );
306 if (pItem2)
307 aNewLangTxt = pItem2->GetValue();
309 //!! Remember the view frame right now...
310 //!! (call to GetView().GetViewFrame() will break if the
311 //!! SwTextShell got destroyed meanwhile.)
312 SfxViewFrame *pViewFrame = GetView().GetViewFrame();
314 if (aNewLangTxt.EqualsAscii( "*" ))
316 // open the dialog "Tools/Options/Language Settings - Language"
317 // to set the documents default language
318 SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
319 if (pFact)
321 VclAbstractDialog* pDlg = pFact->CreateVclDialog( GetView().GetWindow(), SID_LANGUAGE_OPTIONS );
322 pDlg->Execute();
323 delete pDlg;
326 else
328 //!! We have to use StartAction / EndAction bracketing in
329 //!! order to prevent possible destruction of the SwTextShell
330 //!! due to the selection changes coming below.
331 rWrtSh.StartAction();
332 // prevent view from jumping because of (temporary) selection changes
333 rWrtSh.LockView( TRUE );
334 // save selection for later restoration
335 rWrtSh.Push();
337 // setting the new language...
338 if (aNewLangTxt.Len() > 0)
340 const String aSelectionLangPrefix( String::CreateFromAscii("Current_") );
341 const String aParagraphLangPrefix( String::CreateFromAscii("Paragraph_") );
342 const String aDocumentLangPrefix( String::CreateFromAscii("Default_") );
343 const String aStrNone( String::CreateFromAscii("LANGUAGE_NONE") );
345 SfxItemSet aCoreSet( GetPool(),
346 RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE,
347 RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE,
348 RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE,
349 0 );
351 xub_StrLen nPos = 0;
352 bool bForSelection = true;
353 bool bForParagraph = false;
354 if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aSelectionLangPrefix, 0 )))
356 // ... for the current selection
357 aNewLangTxt = aNewLangTxt.Erase( nPos, aSelectionLangPrefix.Len() );
358 bForSelection = true;
360 else if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aParagraphLangPrefix , 0 )))
362 // ... for the current paragraph language
363 aNewLangTxt = aNewLangTxt.Erase( nPos, aParagraphLangPrefix.Len() );
364 bForSelection = true;
365 bForParagraph = true;
367 else if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aDocumentLangPrefix , 0 )))
369 // ... as default document language
370 aNewLangTxt = aNewLangTxt.Erase( nPos, aDocumentLangPrefix.Len() );
371 bForSelection = false;
374 if (bForParagraph)
375 SwLangHelper::SelectCurrentPara( rWrtSh );
377 if (!bForSelection) // document language to be changed...
379 rWrtSh.SelAll();
380 rWrtSh.ExtendedSelectAll();
382 if (aNewLangTxt != aStrNone)
383 SwLangHelper::SetLanguage( rWrtSh, aNewLangTxt, bForSelection, aCoreSet );
384 else
385 SwLangHelper::SetLanguage_None( rWrtSh, bForSelection, aCoreSet );
388 // restore selection...
389 rWrtSh.Pop( FALSE );
391 rWrtSh.LockView( FALSE );
392 rWrtSh.EndAction();
395 // invalidate slot to get the new language displayed
396 pViewFrame->GetBindings().Invalidate( nSlot );
398 rReq.Done();
399 break;
402 case SID_CHARMAP:
404 InsertSymbol( rReq );
406 break;
407 case FN_INSERT_FOOTNOTE:
408 case FN_INSERT_ENDNOTE:
410 String aStr;
411 SFX_REQUEST_ARG( rReq, pFont, SfxStringItem, FN_PARAM_1 , sal_False );
412 // SFX_REQUEST_ARG( rReq, pCharset, SfxInt16Item, FN_PARAM_2 , sal_False );
413 SFX_REQUEST_ARG( rReq, pNameItem, SfxStringItem, nSlot , sal_False );
414 if ( pNameItem )
415 aStr = pNameItem->GetValue();
416 BOOL bFont = pFont && pFont->GetValue().Len();
417 rWrtSh.StartUndo( UNDO_UI_INSERT_FOOTNOTE );
418 rWrtSh.InsertFootnote( aStr, nSlot == FN_INSERT_ENDNOTE, !bFont );
419 if ( bFont )
421 rWrtSh.Left( CRSR_SKIP_CHARS, TRUE, 1, FALSE );
422 SfxItemSet aSet( rWrtSh.GetAttrPool(), RES_CHRATR_FONT, RES_CHRATR_FONT );
423 rWrtSh.GetCurAttr( aSet );
424 SvxFontItem &rFont = (SvxFontItem &) aSet.Get( RES_CHRATR_FONT );
425 SvxFontItem aFont( rFont.GetFamily(), pFont->GetValue(),
426 rFont.GetStyleName(), rFont.GetPitch(), RTL_TEXTENCODING_DONTKNOW, RES_CHRATR_FONT );
427 //pCharset ? (CharSet) pCharset->GetValue() : RTL_TEXTENCODING_DONTKNOW );
428 rWrtSh.SetAttr( aSet, nsSetAttrMode::SETATTR_DONTEXPAND );
429 rWrtSh.ResetSelect(0, FALSE);
430 rWrtSh.EndSelect();
431 rWrtSh.GotoFtnTxt();
433 rWrtSh.EndUndo( UNDO_UI_INSERT_FOOTNOTE );
434 rReq.Done();
436 break;
437 case FN_INSERT_FOOTNOTE_DLG:
439 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
440 DBG_ASSERT(pFact, "Dialogdiet fail!");
441 AbstractInsFootNoteDlg* pDlg = pFact->CreateInsFootNoteDlg( DLG_INS_FOOTNOTE,
442 GetView().GetWindow(), rWrtSh, FALSE );
443 DBG_ASSERT(pDlg, "Dialogdiet fail!");
444 pDlg->SetHelpId(nSlot);
445 if ( pDlg->Execute() == RET_OK )
447 USHORT nId = pDlg->IsEndNote() ? FN_INSERT_ENDNOTE : FN_INSERT_FOOTNOTE;
448 SfxRequest aReq( GetView().GetViewFrame(), nId );
449 if ( pDlg->GetStr().Len() )
450 aReq.AppendItem( SfxStringItem( nId, pDlg->GetStr() ) );
451 if ( pDlg->GetFontName().Len() )
452 aReq.AppendItem( SfxStringItem( FN_PARAM_1, pDlg->GetFontName() ) );
453 //aReq.AppendItem( SfxStringItem( FN_PARAM_2, pDlg->GetCharSet() ) );
454 ExecuteSlot( aReq );
457 rReq.Ignore();
458 delete pDlg;
460 break;
461 case FN_FORMAT_FOOTNOTE_DLG:
463 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
464 DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
466 VclAbstractDialog* pDlg = pFact->CreateSwFootNoteOptionDlg( GetView().GetWindow(), rWrtSh, DLG_DOC_FOOTNOTE );
467 DBG_ASSERT(pDlg, "Dialogdiet fail!");
468 pDlg->Execute();
469 delete pDlg;
470 break;
472 case SID_INSERTDOC:
474 GetView().ExecuteInsertDoc( rReq, pItem );
475 break;
477 case FN_FORMAT_RESET:
479 // #i78856, reset all attributes but not the language attributes
480 // (for this build an array of all relevant attributes and
481 // remove the languages from that)
482 SvUShortsSort aAttribs;
484 USHORT __FAR_DATA aResetableSetRange[] = {
485 RES_FRMATR_BEGIN, RES_FRMATR_END-1,
486 RES_CHRATR_BEGIN, RES_CHRATR_LANGUAGE - 1,
487 RES_CHRATR_LANGUAGE + 1, RES_CHRATR_CJK_LANGUAGE - 1,
488 RES_CHRATR_CJK_LANGUAGE + 1, RES_CHRATR_CTL_LANGUAGE - 1,
489 RES_CHRATR_CTL_LANGUAGE + 1, RES_CHRATR_END-1,
490 RES_PARATR_BEGIN, RES_PARATR_END-1,
491 RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT,
492 RES_TXTATR_INETFMT, RES_TXTATR_INETFMT,
493 RES_TXTATR_CJK_RUBY, RES_TXTATR_UNKNOWN_CONTAINER,
494 RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
497 USHORT __FAR_DATA *pUShorts = aResetableSetRange;
498 while (*pUShorts)
500 USHORT nL = pUShorts[1] - pUShorts[0] + 1;
501 USHORT nE = pUShorts[0];
502 for (USHORT i = 0; i < nL; ++i)
503 aAttribs.Insert( nE++ );
504 pUShorts += 2;
507 rWrtSh.ResetAttr( &aAttribs );
508 rReq.Done();
509 break;
511 case FN_INSERT_BREAK_DLG:
513 USHORT nKind=0, nPageNumber=0;
514 String aTemplateName;
515 if ( pItem )
517 nKind = ((SfxInt16Item*)pItem)->GetValue();
518 SFX_REQUEST_ARG( rReq, pTemplate, SfxStringItem, FN_PARAM_1 , sal_False );
519 SFX_REQUEST_ARG( rReq, pNumber, SfxUInt16Item, FN_PARAM_2 , sal_False );
520 if ( pTemplate )
521 aTemplateName = pTemplate->GetValue();
522 if ( pNumber )
523 nPageNumber = pNumber->GetValue();
525 else
527 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
528 DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
530 AbstractSwBreakDlg* pDlg = pFact->CreateSwBreakDlg( GetView().GetWindow(), rWrtSh, DLG_BREAK );
531 DBG_ASSERT(pDlg, "Dialogdiet fail!");
532 if ( pDlg->Execute() == RET_OK )
534 nKind = pDlg->GetKind();
535 aTemplateName = pDlg->GetTemplateName();
536 nPageNumber = pDlg->GetPageNumber();
537 rReq.AppendItem( SfxInt16Item( FN_INSERT_BREAK_DLG, nKind ) );
538 rReq.AppendItem( SfxUInt16Item( FN_PARAM_2, nPageNumber ) );
539 rReq.AppendItem( SfxStringItem( FN_PARAM_1, aTemplateName ) );
540 rReq.Done();
542 else
543 rReq.Ignore();
544 delete pDlg;
547 switch ( nKind )
549 case 1 :
550 rWrtSh.InsertLineBreak(); break;
551 case 2 :
552 rWrtSh.InsertColumnBreak(); break;
553 case 3 :
555 rWrtSh.StartAllAction();
556 if( aTemplateName.Len() )
557 rWrtSh.InsertPageBreak( &aTemplateName, nPageNumber );
558 else
559 rWrtSh.InsertPageBreak();
560 rWrtSh.EndAllAction();
564 break;
566 case FN_INSERT_BOOKMARK:
568 if ( pItem )
570 ::rtl::OUString sName = ((SfxStringItem*)pItem)->GetValue();
571 rWrtSh.SetBookmark( KeyCode(), sName, aEmptyStr );
573 else
575 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
576 DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
578 VclAbstractDialog* pDlg = pFact->CreateSwInsertBookmarkDlg( GetView().GetWindow(), rWrtSh, rReq, DLG_INSERT_BOOKMARK );
579 DBG_ASSERT(pDlg, "Dialogdiet fail!");
580 pDlg->Execute();
581 delete pDlg;
584 break;
586 case FN_DELETE_BOOKMARK:
588 if ( pItem )
590 IDocumentMarkAccess* const pMarkAccess = rWrtSh.getIDocumentMarkAccess();
591 pMarkAccess->deleteMark( pMarkAccess->findMark(((SfxStringItem*)pItem)->GetValue()) );
593 break;
595 case FN_AUTOFORMAT_REDLINE_APPLY:
597 SvxSwAutoFmtFlags aFlags(SvxAutoCorrCfg::Get()->GetAutoCorrect()->GetSwFlags());
598 // das muss fuer die Nachbearbeitung immer FALSE sein
599 aFlags.bAFmtByInput = FALSE;
600 aFlags.bWithRedlining = TRUE;
601 rWrtSh.AutoFormat( &aFlags );
602 aFlags.bWithRedlining = FALSE;
604 SfxViewFrame* pVFrame = GetView().GetViewFrame();
605 if (pVFrame->HasChildWindow(FN_REDLINE_ACCEPT))
606 pVFrame->ToggleChildWindow(FN_REDLINE_ACCEPT);
608 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
609 DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
611 AbstractSwModalRedlineAcceptDlg* pDlg = pFact->CreateSwModalRedlineAcceptDlg( &GetView().GetEditWin(), DLG_MOD_REDLINE_ACCEPT );
612 DBG_ASSERT(pDlg, "Dialogdiet fail!");
614 switch (lcl_AskRedlineMode(&GetView().GetEditWin()))
616 case RET_OK:
618 pDlg->AcceptAll(TRUE);
619 SfxRequest aReq( pVFrame, FN_AUTOFORMAT_APPLY );
620 aReq.Done();
621 rReq.Ignore();
622 break;
625 case RET_CANCEL:
626 pDlg->AcceptAll(FALSE);
627 rReq.Ignore();
628 break;
630 case 2:
631 pDlg->Execute();
632 rReq.Done();
633 break;
635 delete pDlg;
637 break;
639 case FN_AUTOFORMAT_APPLY:
641 SvxSwAutoFmtFlags aFlags(SvxAutoCorrCfg::Get()->GetAutoCorrect()->GetSwFlags());
642 // das muss fuer die Nachbearbeitung immer FALSE sein
643 aFlags.bAFmtByInput = FALSE;
644 rWrtSh.AutoFormat( &aFlags );
645 rReq.Done();
647 break;
648 case FN_AUTOFORMAT_AUTO:
650 SvxAutoCorrCfg* pACfg = SvxAutoCorrCfg::Get();
651 BOOL bSet = pItem ? ((const SfxBoolItem*)pItem)->GetValue() : !pACfg->IsAutoFmtByInput();
652 if( bSet != pACfg->IsAutoFmtByInput() )
654 pACfg->SetAutoFmtByInput( bSet );
655 GetView().GetViewFrame()->GetBindings().Invalidate( nSlot );
656 if ( !pItem )
657 rReq.AppendItem( SfxBoolItem( GetPool().GetWhich(nSlot), bSet ) );
658 rReq.Done();
661 break;
662 case FN_AUTO_CORRECT:
664 // erstmal auf Blank defaulten
665 sal_Unicode cChar = ' ';
666 rWrtSh.AutoCorrect( *SvxAutoCorrCfg::Get()->GetAutoCorrect(), cChar );
667 rReq.Done();
669 break;
670 case FN_TABLE_SORT_DIALOG:
671 case FN_SORTING_DLG:
673 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
674 DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
676 VclAbstractDialog* pDlg = pFact->CreateVclAbstractDialog( GetView().GetWindow(), rWrtSh, DLG_SORTING );
677 DBG_ASSERT(pDlg, "Dialogdiet fail!");
678 pDlg->Execute();
679 delete pDlg;
680 rReq.Done();
682 break;
683 case FN_NUMBERING_OUTLINE_DLG:
685 SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1);
686 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
687 DBG_ASSERT(pFact, "Dialogdiet fail!");
688 SfxAbstractTabDialog* pDlg = pFact->CreateSwTabDialog( DLG_TAB_OUTLINE,
689 GetView().GetWindow(), &aTmp, rWrtSh);
690 DBG_ASSERT(pDlg, "Dialogdiet fail!");
691 pDlg->Execute();
692 delete pDlg;
693 rReq.Done();
695 break;
696 case FN_CALCULATE:
698 SwTransferable* pTransfer = new SwTransferable( rWrtSh );
699 /*??*/ uno::Reference<
700 datatransfer::XTransferable > xRef(
701 pTransfer );
702 pTransfer->CalculateAndCopy();
703 rReq.Done();
705 break;
706 case FN_GOTO_REFERENCE:
708 SwField *pFld = rWrtSh.GetCurFld();
709 if(pFld && pFld->GetTypeId() == TYP_GETREFFLD)
711 rWrtSh.StartAllAction();
712 rWrtSh.SwCrsrShell::GotoRefMark( ((SwGetRefField*)pFld)->GetSetRefName(),
713 ((SwGetRefField*)pFld)->GetSubType(),
714 ((SwGetRefField*)pFld)->GetSeqNo() );
715 rWrtSh.EndAllAction();
716 rReq.Done();
719 break;
720 case FN_EDIT_FORMULA:
722 const USHORT nId = SwInputChild::GetChildWindowId();
723 SfxViewFrame* pVFrame = GetView().GetViewFrame();
724 if(pItem)
726 //if the ChildWindow is active it has to be removed
727 if( pVFrame->HasChildWindow( nId ) )
729 pVFrame->ToggleChildWindow( nId );
730 pVFrame->GetBindings().InvalidateAll( TRUE );
733 String sFormula(((const SfxStringItem*)pItem)->GetValue());
734 SwFldMgr aFldMgr;
735 rWrtSh.StartAllAction();
736 BOOL bDelSel;
737 if( 0 != (bDelSel = rWrtSh.HasSelection()) )
739 rWrtSh.StartUndo( UNDO_START );
740 rWrtSh.DelRight();
742 else
744 rWrtSh.EnterStdMode();
747 if( !bDelSel && aFldMgr.GetCurFld() && TYP_FORMELFLD == aFldMgr.GetCurTypeId() )
748 aFldMgr.UpdateCurFld( aFldMgr.GetCurFld()->GetFormat(), aEmptyStr, sFormula );
749 else if( sFormula.Len() )
751 if( rWrtSh.IsCrsrInTbl() )
753 SfxItemSet aSet( rWrtSh.GetAttrPool(), RES_BOXATR_FORMULA, RES_BOXATR_FORMULA );
754 aSet.Put( SwTblBoxFormula( sFormula ));
755 rWrtSh.SetTblBoxFormulaAttrs( aSet );
756 rWrtSh.UpdateTable();
758 else
760 SvNumberFormatter* pFormatter = rWrtSh.GetNumberFormatter();
761 ULONG nSysNumFmt = pFormatter->GetFormatIndex( NF_NUMBER_STANDARD, LANGUAGE_SYSTEM);
762 SwInsertFld_Data aData(TYP_FORMELFLD, nsSwGetSetExpType::GSE_FORMULA, aEmptyStr, sFormula, nSysNumFmt);
763 aFldMgr.InsertFld(aData);
767 if( bDelSel )
768 rWrtSh.EndUndo( UNDO_END );
769 rWrtSh.EndAllAction();
770 rReq.Done();
772 else
774 rWrtSh.EndAllTblBoxEdit();
775 pVFrame->ToggleChildWindow( nId );
776 if( !pVFrame->HasChildWindow( nId ) )
777 pVFrame->GetBindings().InvalidateAll( TRUE );
778 rReq.Ignore();
782 break;
783 case FN_TABLE_UNSET_READ_ONLY:
785 rWrtSh.UnProtectTbls();
787 break;
788 case FN_EDIT_HYPERLINK:
789 GetView().GetViewFrame()->ToggleChildWindow(SID_HYPERLINK_DIALOG);
790 break;
791 case FN_REMOVE_HYPERLINK:
793 BOOL bSel = rWrtSh.HasSelection();
794 if(!bSel)
796 rWrtSh.StartAction();
797 rWrtSh.Push();
798 if(!rWrtSh.SelectTxtAttr( RES_TXTATR_INETFMT ))
799 rWrtSh.SelWrd();
801 //now remove the attribute
802 SvUShortsSort aAttribs;
803 aAttribs.Insert( RES_TXTATR_INETFMT );
804 rWrtSh.ResetAttr( &aAttribs );
805 if(!bSel)
807 rWrtSh.Pop(FALSE);
808 rWrtSh.EndAction();
811 break;
812 case SID_ATTR_BRUSH_CHAR :
813 case SID_ATTR_CHAR_SCALEWIDTH :
814 case SID_ATTR_CHAR_ROTATED :
815 case FN_TXTATR_INET :
816 case FN_INSERT_HYPERLINK:
818 USHORT nWhich = GetPool().GetWhich( nSlot );
819 if ( pArgs && pArgs->GetItemState( nWhich ) == SFX_ITEM_SET )
820 bUseDialog = FALSE;
821 // intentionally no break
823 case SID_CHAR_DLG:
825 lcl_CharDialog( rWrtSh, bUseDialog, nSlot, pArgs, &rReq );
827 break;
828 case SID_CHAR_DLG_FOR_PARAGRAPH:
830 rWrtSh.Push(); //save current cursor
831 SwLangHelper::SelectCurrentPara( rWrtSh );
832 lcl_CharDialog( rWrtSh, bUseDialog, nSlot, pArgs, &rReq );
833 rWrtSh.Pop( FALSE ); //restore old cursor
835 break;
836 case SID_ATTR_LRSPACE :
837 case SID_ATTR_ULSPACE :
838 case SID_ATTR_BRUSH :
839 case SID_PARA_VERTALIGN :
840 case SID_ATTR_PARA_NUMRULE :
841 case SID_ATTR_PARA_REGISTER :
842 case SID_ATTR_PARA_PAGENUM :
843 case FN_FORMAT_LINENUMBER :
844 case FN_NUMBER_NEWSTART :
845 case FN_NUMBER_NEWSTART_AT :
846 case FN_FORMAT_DROPCAPS :
847 case FN_DROP_TEXT:
849 USHORT nWhich = GetPool().GetWhich( nSlot );
850 if ( pArgs && pArgs->GetItemState( nWhich ) == SFX_ITEM_SET )
851 bUseDialog = FALSE;
852 // intentionally no break
855 case SID_PARA_DLG:
857 FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &GetView()));
858 SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< UINT16 >(eMetric)));
860 BOOL bApplyCharUnit = ::HasCharUnit(0 != PTR_CAST(SwWebView, &GetView()));
861 SW_MOD()->PutItem(SfxBoolItem(SID_ATTR_APPLYCHARUNIT, bApplyCharUnit));
863 SfxItemSet aCoreSet( GetPool(),
864 RES_PARATR_BEGIN, RES_PARATR_END - 1,
865 // --> OD 2008-02-25 #refactorlists#
866 RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1,
867 // <--
868 RES_FRMATR_BEGIN, RES_FRMATR_END - 1,
869 SID_ATTR_TABSTOP_POS, SID_ATTR_TABSTOP_POS,
870 SID_ATTR_TABSTOP_DEFAULTS, SID_ATTR_TABSTOP_DEFAULTS,
871 SID_ATTR_TABSTOP_OFFSET, SID_ATTR_TABSTOP_OFFSET,
872 SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
873 SID_ATTR_PARA_MODEL, SID_ATTR_PARA_KEEP,
874 SID_ATTR_PARA_PAGENUM, SID_ATTR_PARA_PAGENUM,
875 SID_HTML_MODE, SID_HTML_MODE,
876 FN_PARAM_1, FN_PARAM_1,
877 FN_NUMBER_NEWSTART, FN_NUMBER_NEWSTART_AT,
878 FN_DROP_TEXT, FN_DROP_CHAR_STYLE_NAME,
880 // --> OD 2008-01-16 #newlistlevelattrs#
881 // get also the list level indent values merged as LR-SPACE item, if needed.
882 rWrtSh.GetCurAttr( aCoreSet, true );
883 // <--
884 aCoreSet.Put(SfxUInt16Item(SID_HTML_MODE,
885 ::GetHtmlMode(GetView().GetDocShell())));
887 // Tabulatoren, DefaultTabs ins ItemSet Stecken
888 const SvxTabStopItem& rDefTabs = (const SvxTabStopItem&)
889 GetPool().GetDefaultItem(RES_PARATR_TABSTOP);
891 USHORT nDefDist = ::GetTabDist( rDefTabs );
892 SfxUInt16Item aDefDistItem( SID_ATTR_TABSTOP_DEFAULTS, nDefDist );
893 aCoreSet.Put( aDefDistItem );
895 // Aktueller Tab
896 SfxUInt16Item aTabPos( SID_ATTR_TABSTOP_POS, 0 );
897 aCoreSet.Put( aTabPos );
899 // linker Rand als Offset
900 //#i24363# tab stops relative to indent
901 const long nOff = rWrtSh.getIDocumentSettingAccess()->get(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT) ?
902 ((SvxLRSpaceItem&)aCoreSet.Get( RES_LR_SPACE )).GetTxtLeft() : 0;
903 SfxInt32Item aOff( SID_ATTR_TABSTOP_OFFSET, nOff );
904 aCoreSet.Put( aOff );
906 // BoxInfo setzen
907 ::PrepareBoxInfo( aCoreSet, rWrtSh );
909 //aktuelles Seitenformat
910 ::SwToSfxPageDescAttr( aCoreSet );
912 UINT16 nDefPage = 0;
913 if( pItem )
914 nDefPage = ((SfxUInt16Item *)pItem)->GetValue();
916 // Numerierungseigenschaften
917 if(rWrtSh.GetCurNumRule())
919 SfxBoolItem aStart( FN_NUMBER_NEWSTART, rWrtSh.IsNumRuleStart() );
920 aCoreSet.Put(aStart);
921 // --> OD 2008-02-29 #refactorlists#
922 // SfxUInt16Item aStartAt(FN_NUMBER_NEWSTART_AT,
923 // rWrtSh.IsNodeNumStart());
924 SfxUInt16Item aStartAt( FN_NUMBER_NEWSTART_AT,
925 rWrtSh.GetNodeNumStart() );
926 // <--
927 aCoreSet.Put(aStartAt);
929 SfxAbstractTabDialog* pDlg = NULL;
931 if ( bUseDialog && GetActiveView() )
933 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
934 DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
936 pDlg = pFact->CreateSwParaDlg( GetView().GetWindow(),GetView(), aCoreSet,DLG_STD, DLG_PARA,NULL, FALSE, nDefPage );
937 DBG_ASSERT(pDlg, "Dialogdiet fail!");
939 SfxItemSet* pSet = NULL;
940 if ( !bUseDialog )
942 pSet = (SfxItemSet*) pArgs;
945 else if ( NULL != pDlg && pDlg->Execute() == RET_OK )
947 // Defaults evtl umsetzen
948 pSet = (SfxItemSet*)pDlg->GetOutputItemSet();
949 USHORT nNewDist;
950 if( SFX_ITEM_SET == pSet->GetItemState( SID_ATTR_TABSTOP_DEFAULTS, FALSE, &pItem ) &&
951 nDefDist != (nNewDist = ((SfxUInt16Item*)pItem)->GetValue()) )
953 SvxTabStopItem aDefTabs( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
954 MakeDefTabs( nNewDist, aDefTabs );
955 rWrtSh.SetDefault( aDefTabs );
956 pSet->ClearItem( SID_ATTR_TABSTOP_DEFAULTS );
959 if ( SFX_ITEM_SET == pSet->GetItemState(FN_PARAM_1,FALSE,&pItem) )
961 pSet->Put(SfxStringItem(FN_DROP_TEXT, ((const SfxStringItem*)pItem)->GetValue()));
962 pSet->ClearItem(FN_PARAM_1);
965 if( SFX_ITEM_SET == pSet->GetItemState( RES_PARATR_DROP, FALSE, &pItem ))
967 String sCharStyleName;
968 if(((const SwFmtDrop*)pItem)->GetCharFmt())
969 sCharStyleName = ((const SwFmtDrop*)pItem)->GetCharFmt()->GetName();
970 pSet->Put(SfxStringItem(FN_DROP_CHAR_STYLE_NAME, sCharStyleName));
974 if ( pSet )
976 rReq.Done( *pSet );
977 ::SfxToSwPageDescAttr( rWrtSh, *pSet );
978 // --> OD 2006-12-06 #i56253#
979 // enclose all undos.
980 // Thus, check conditions, if actions will be performed.
981 const bool bUndoNeeded( pSet->Count() ||
982 SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART) ||
983 SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) );
984 if ( bUndoNeeded )
986 rWrtSh.StartUndo( UNDO_INSATTR );
988 // <--
989 if( pSet->Count() )
991 rWrtSh.StartAction();
992 // rWrtSh.StartUndo( UNDO_START );
993 if ( SFX_ITEM_SET == pSet->GetItemState(FN_DROP_TEXT, FALSE, &pItem) )
995 if ( ((SfxStringItem*)pItem)->GetValue().Len() )
996 rWrtSh.ReplaceDropTxt(((SfxStringItem*)pItem)->GetValue());
998 rWrtSh.SetAttr( *pSet );
999 // rWrtSh.EndUndo( UNDO_END );
1000 rWrtSh.EndAction();
1001 SwTxtFmtColl* pColl = rWrtSh.GetCurTxtFmtColl();
1002 if(pColl && pColl->IsAutoUpdateFmt())
1004 rWrtSh.AutoUpdatePara(pColl, *pSet);
1008 if( SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART) )
1010 //SetNumRuleStart(TRUE) restarts the numbering at the value
1011 //that is defined at the starting point of the numbering level
1012 //otherwise the SetNodeNumStart() value determines the start
1013 //if it's set to something different than USHRT_MAX
1015 BOOL bStart = ((SfxBoolItem&)pSet->Get(FN_NUMBER_NEWSTART)).GetValue();
1016 // --> OD 2007-06-11 #b6560525#
1017 // Default value for restart value has to be USHRT_MAX
1018 // in order to indicate that the restart value of the list
1019 // style has to be used on restart.
1020 USHORT nNumStart = USHRT_MAX;
1021 // <--
1022 if( SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) )
1024 nNumStart = ((SfxUInt16Item&)pSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue();
1026 rWrtSh.SetNumRuleStart(bStart);
1027 rWrtSh.SetNodeNumStart(nNumStart);
1029 else if( SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) )
1031 USHORT nNumStart = ((SfxUInt16Item&)pSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue();
1032 rWrtSh.SetNodeNumStart(nNumStart);
1033 rWrtSh.SetNumRuleStart(FALSE);
1035 // --> OD 2006-12-06 #i56253#
1036 if ( bUndoNeeded )
1038 rWrtSh.EndUndo( UNDO_INSATTR );
1040 // <--
1043 delete pDlg;
1045 break;
1046 case FN_NUM_CONTINUE:
1048 // --> OD 2008-03-18 #refactorlists#
1049 String sContinuedListId;
1050 const SwNumRule* pRule =
1051 rWrtSh.SearchNumRule( false, true, false, -1, sContinuedListId );
1052 // --> OD 2009-08-26 #i86492#
1053 // Search also for bullet list
1054 if ( !pRule )
1056 pRule = rWrtSh.SearchNumRule( false, false, false, -1, sContinuedListId );
1058 // <--
1059 if ( pRule )
1061 rWrtSh.SetCurNumRule( *pRule, false, sContinuedListId );
1063 // <--
1065 break;
1066 case FN_SELECT_PARA:
1068 if(!rWrtSh.IsSttOfPara())
1069 rWrtSh.SttPara(FALSE);
1070 else
1071 rWrtSh.EnterStdMode();
1072 rWrtSh.EndPara(TRUE);
1074 break;
1076 case SID_DEC_INDENT:
1077 case SID_INC_INDENT:
1078 rWrtSh.MoveLeftMargin( SID_INC_INDENT == nSlot,
1079 rReq.GetModifier() != KEY_MOD1 );
1080 rReq.Done();
1081 break;
1082 case FN_DEC_INDENT_OFFSET:
1083 case FN_INC_INDENT_OFFSET:
1084 rWrtSh.MoveLeftMargin( FN_INC_INDENT_OFFSET == nSlot,
1085 rReq.GetModifier() == KEY_MOD1 );
1086 rReq.Done();
1087 break;
1089 case SID_ATTR_CHAR_COLOR2:
1091 if(pItem)
1093 Color aSet = ((const SvxColorItem*)pItem)->GetValue();
1094 SwEditWin& rEditWin = GetView().GetEditWin();
1095 rEditWin.SetTextColor(aSet);
1096 SwApplyTemplate* pApply = rEditWin.GetApplyTemplate();
1097 SvxColorItem aItem(aSet, RES_CHRATR_COLOR);
1099 // besteht eine Selektion, wird sie gleich gefaerbt
1100 if(!pApply && rWrtSh.HasSelection())
1102 rWrtSh.SetAttr(SvxColorItem (aSet, RES_CHRATR_COLOR));
1104 else if(!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_EXT)
1106 GetView().GetViewFrame()->GetDispatcher()->Execute(SID_ATTR_CHAR_COLOR_EXT);
1109 rReq.Done();
1110 /* OS 22.02.97 18:40 Das alte Verhalten ist unerwuenscht
1111 SwEditWin& rEdtWin = GetView().GetEditWin();
1113 SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
1114 SvxColorItem aItem(aSet, RES_CHRATR_COLOR);
1116 if(!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_EXT)
1118 GetShell().SetAttr(aItem);
1123 break;
1124 case SID_ATTR_CHAR_COLOR_BACKGROUND:
1126 SwEditWin& rEdtWin = GetView().GetEditWin();
1127 SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
1128 rEdtWin.SetTextBackColorTransparent(0 == pItem);
1129 Color aSet;
1130 if(pItem)
1132 aSet = ((const SvxColorItem*)pItem)->GetValue();
1133 rEdtWin.SetTextBackColor(aSet);
1135 if(!pApply && (rWrtSh.HasSelection() || rReq.IsAPI()))
1137 SvxBrushItem aBrushItem(RES_CHRATR_BACKGROUND);
1138 if(pItem)
1139 aBrushItem.SetColor(aSet);
1140 else
1141 aBrushItem.SetColor(Color(COL_TRANSPARENT));
1142 rWrtSh.SetAttr( aBrushItem );
1144 else if(!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_BACKGROUND_EXT)
1146 GetView().GetViewFrame()->GetDispatcher()->Execute(SID_ATTR_CHAR_COLOR_BACKGROUND_EXT);
1149 rReq.Done();
1151 /* OS 22.02.97 18:40 Das alte Verhalten ist unerwuenscht
1152 if(!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_BACKGROUND_EXT)
1154 Brush aBrush(pItem ? BRUSH_SOLID : BRUSH_NULL);
1155 if(pItem)
1156 aBrush.SetColor( aSet );
1157 GetShell().SetAttr( SvxBrushItem(aBrush, RES_CHRATR_BACKGROUND) );
1161 break;
1162 case SID_ATTR_CHAR_COLOR_BACKGROUND_EXT:
1163 case SID_ATTR_CHAR_COLOR_EXT:
1165 SwEditWin& rEdtWin = GetView().GetEditWin();
1166 SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
1167 SwApplyTemplate aTempl;
1168 BOOL bSelection = rWrtSh.HasSelection();
1169 if(bSelection)
1172 if(nSlot == SID_ATTR_CHAR_COLOR_BACKGROUND_EXT)
1174 rWrtSh.SetAttr( SvxBrushItem(
1175 rEdtWin.GetTextBackColor(), RES_CHRATR_BACKGROUND) );
1177 else
1178 rWrtSh.SetAttr( SvxColorItem( rEdtWin.GetTextColor(),
1179 RES_CHRATR_COLOR) );
1181 else
1183 if(!pApply || pApply->nColor != nSlot)
1184 aTempl.nColor = nSlot;
1185 rEdtWin.SetApplyTemplate(aTempl);
1188 rReq.Done();
1190 break;
1192 case FN_NUM_BULLET_MOVEDOWN:
1193 if (!rWrtSh.IsAddMode())
1194 rWrtSh.MoveParagraph(1);
1195 rReq.Done();
1196 break;
1198 case FN_NUM_BULLET_MOVEUP:
1199 if (!rWrtSh.IsAddMode())
1200 rWrtSh.MoveParagraph(-1);
1201 rReq.Done();
1202 break;
1203 case SID_RUBY_DIALOG:
1204 case SID_HYPERLINK_DIALOG:
1206 SfxRequest aReq(nSlot, SFX_CALLMODE_SLOT, SFX_APP()->GetPool());
1207 GetView().GetViewFrame()->ExecuteSlot( aReq);
1208 rReq.Ignore();
1210 break;
1211 case FN_INSERT_PAGEHEADER:
1212 case FN_INSERT_PAGEFOOTER:
1213 if(pArgs && pArgs->Count())
1215 String sStyleName;
1216 if(pItem)
1217 sStyleName = ((const SfxStringItem*)pItem)->GetValue();
1218 BOOL bOn = TRUE;
1219 if( SFX_ITEM_SET == pArgs->GetItemState(FN_PARAM_1, FALSE, &pItem))
1220 bOn = ((const SfxBoolItem*)pItem)->GetValue();
1221 ChangeHeaderOrFooter(sStyleName, FN_INSERT_PAGEHEADER == nSlot, bOn, !rReq.IsAPI());
1222 rReq.Done();
1224 break;
1225 case FN_READONLY_SELECTION_MODE :
1226 if(GetView().GetDocShell()->IsReadOnly())
1228 rWrtSh.SetReadonlySelectionOption(
1229 !rWrtSh.GetViewOptions()->IsSelectionInReadonly());
1230 rWrtSh.ShowCrsr();
1232 break;
1233 case FN_SELECTION_MODE_DEFAULT:
1234 case FN_SELECTION_MODE_BLOCK :
1236 bool bSetBlockMode = !rWrtSh.IsBlockMode();
1237 if( pArgs && SFX_ITEM_SET == pArgs->GetItemState(nSlot, FALSE, &pItem))
1238 bSetBlockMode = ((const SfxBoolItem*)pItem)->GetValue();
1239 if( ( nSlot == FN_SELECTION_MODE_DEFAULT ) ^ bSetBlockMode )
1240 rWrtSh.EnterBlockMode();
1241 else
1242 rWrtSh.EnterStdMode();
1243 SfxBindings &rBnd = GetView().GetViewFrame()->GetBindings();
1244 rBnd.Invalidate(FN_STAT_SELMODE);
1245 rBnd.Update(FN_STAT_SELMODE);
1247 break;
1248 case SID_OPEN_HYPERLINK:
1249 case FN_COPY_HYPERLINK_LOCATION:
1251 SfxItemSet aSet(GetPool(),
1252 RES_TXTATR_INETFMT,
1253 RES_TXTATR_INETFMT);
1254 rWrtSh.GetCurAttr(aSet);
1255 if(SFX_ITEM_SET <= aSet.GetItemState( RES_TXTATR_INETFMT, TRUE ))
1257 const SwFmtINetFmt& rINetFmt = dynamic_cast<const SwFmtINetFmt&>( aSet.Get(RES_TXTATR_INETFMT, TRUE) );
1258 if( nSlot == FN_COPY_HYPERLINK_LOCATION )
1260 ::uno::Reference< datatransfer::clipboard::XClipboard > xClipboard = GetView().GetEditWin().GetClipboard();
1261 vcl::unohelper::TextDataObject::CopyStringTo(
1262 rINetFmt.GetValue(),
1263 xClipboard );
1265 else
1266 rWrtSh.ClickToINetAttr(rINetFmt, URLLOAD_NOFILTER);
1269 break;
1270 case SID_OPEN_XML_FILTERSETTINGS:
1274 uno::Reference < ui::dialogs::XExecutableDialog > xDialog(::comphelper::getProcessServiceFactory()->createInstance(rtl::OUString::createFromAscii("com.sun.star.comp.ui.XSLTFilterDialog")), uno::UNO_QUERY);
1275 if( xDialog.is() )
1277 xDialog->execute();
1280 catch( uno::Exception& )
1283 rReq.Ignore ();
1285 break;
1286 case FN_FORMAT_APPLY_HEAD1:
1289 break;
1290 case FN_FORMAT_APPLY_HEAD2:
1293 break;
1294 case FN_FORMAT_APPLY_HEAD3:
1297 break;
1298 case FN_FORMAT_APPLY_DEFAULT:
1301 break;
1302 case FN_FORMAT_APPLY_TEXTBODY:
1305 break;
1306 case FN_WORDCOUNT_DIALOG:
1308 SwWrtShell &rSh = GetShell();
1309 SwDocStat aCurr;
1310 SwDocStat aDocStat( rSh.getIDocumentStatistics()->GetDocStat() );
1312 SwWait aWait( *GetView().GetDocShell(), TRUE );
1313 rSh.StartAction();
1314 rSh.CountWords( aCurr );
1315 rSh.UpdateDocStat( aDocStat );
1316 rSh.EndAction();
1319 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
1320 DBG_ASSERT(pFact, "Dialogdiet fail!");
1321 AbstractSwWordCountDialog* pDialog = pFact->CreateSwWordCountDialog( GetView().GetWindow() );
1322 pDialog->SetValues(aCurr, aDocStat );
1323 pDialog->Execute();
1324 delete pDialog;
1326 break;
1327 default:
1328 ASSERT(!this, falscher Dispatcher);
1329 return;
1334 /*--------------------------------------------------------------------
1335 Beschreibung:
1336 --------------------------------------------------------------------*/
1339 void SwTextShell::GetState( SfxItemSet &rSet )
1341 SwWrtShell &rSh = GetShell();
1342 SfxWhichIter aIter( rSet );
1343 USHORT nWhich = aIter.FirstWhich();
1344 while ( nWhich )
1346 switch ( nWhich )
1348 case SID_LANGUAGE_STATUS:
1350 // the value of used script types
1351 String aScriptTypesInUse( String::CreateFromInt32( rSh.GetScriptType() ) );
1353 SvtLanguageTable aLangTable;
1355 // get keyboard language
1356 String aKeyboardLang;
1357 LanguageType nLang = LANGUAGE_DONTKNOW;
1358 SwEditWin& rEditWin = GetView().GetEditWin();
1359 nLang = rEditWin.GetInputLanguage();
1360 if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
1361 aKeyboardLang = aLangTable.GetString( nLang );
1363 // get the language that is in use
1364 const String aMultipleLanguages = String::CreateFromAscii("*");
1365 String aCurrentLang = aMultipleLanguages;
1366 nLang = SwLangHelper::GetCurrentLanguage( rSh );
1367 if (nLang != LANGUAGE_DONTKNOW)
1368 aCurrentLang = aLangTable.GetString( nLang );
1370 // build sequence for status value
1371 uno::Sequence< ::rtl::OUString > aSeq( 4 );
1372 aSeq[0] = aCurrentLang;
1373 aSeq[1] = aScriptTypesInUse;
1374 aSeq[2] = aKeyboardLang;
1375 aSeq[3] = SwLangHelper::GetTextForLanguageGuessing( rSh );
1377 // set sequence as status value
1378 SfxStringListItem aItem( SID_LANGUAGE_STATUS );
1379 aItem.SetStringList( aSeq );
1380 rSet.Put( aItem, SID_LANGUAGE_STATUS );
1382 break;
1384 case FN_NUMBER_NEWSTART :
1385 if(!rSh.GetCurNumRule())
1386 rSet.DisableItem(nWhich);
1387 else
1388 rSet.Put(SfxBoolItem(FN_NUMBER_NEWSTART,
1389 rSh.IsNumRuleStart()));
1390 break;
1391 case FN_EDIT_FORMULA:
1392 case SID_CHARMAP:
1394 const int nType = rSh.GetSelectionType();
1395 if (!(nType & nsSelectionType::SEL_TXT) &&
1396 !(nType & nsSelectionType::SEL_TBL) &&
1397 !(nType & nsSelectionType::SEL_NUM))
1398 rSet.DisableItem(nWhich);
1400 break;
1402 case FN_INSERT_ENDNOTE:
1403 case FN_INSERT_FOOTNOTE:
1404 case FN_INSERT_FOOTNOTE_DLG:
1406 const USHORT nNoType = FRMTYPE_FLY_ANY | FRMTYPE_HEADER |
1407 FRMTYPE_FOOTER | FRMTYPE_FOOTNOTE;
1408 if ( (rSh.GetFrmType(0,TRUE) & nNoType) )
1409 rSet.DisableItem(nWhich);
1411 break;
1412 case FN_INSERT_TABLE:
1413 if ( rSh.GetTableFmt() ||
1414 (rSh.GetFrmType(0,TRUE) & FRMTYPE_FOOTNOTE) )
1415 rSet.DisableItem( nWhich );
1416 break;
1418 case FN_CALCULATE:
1419 if ( !rSh.IsSelection() )
1420 rSet.DisableItem(nWhich);
1421 break;
1422 case FN_GOTO_REFERENCE:
1424 SwField *pFld = rSh.GetCurFld();
1425 if ( !pFld || (pFld && pFld->GetTypeId() != TYP_GETREFFLD) )
1426 rSet.DisableItem(nWhich);
1428 break;
1429 case FN_AUTOFORMAT_AUTO:
1431 rSet.Put( SfxBoolItem( nWhich, SvxAutoCorrCfg::Get()->IsAutoFmtByInput() ));
1433 break;
1434 case FN_GLOSSARY_DLG:
1436 rSet.Put(SfxBoolItem(nWhich), TRUE);
1438 break;
1440 case SID_DEC_INDENT:
1441 case SID_INC_INDENT:
1443 USHORT nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
1444 nHtmlMode &= HTMLMODE_ON|HTMLMODE_SOME_STYLES;
1445 if( (nHtmlMode == HTMLMODE_ON) || !rSh.IsMoveLeftMargin(
1446 SID_INC_INDENT == nWhich, TRUE ))
1447 rSet.DisableItem( nWhich );
1449 break;
1451 case FN_DEC_INDENT_OFFSET:
1452 case FN_INC_INDENT_OFFSET:
1454 USHORT nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
1455 nHtmlMode &= HTMLMODE_ON|HTMLMODE_SOME_STYLES;
1456 if( (nHtmlMode == HTMLMODE_ON) ||
1457 !rSh.IsMoveLeftMargin( FN_INC_INDENT_OFFSET == nWhich,
1458 FALSE ))
1459 rSet.DisableItem( nWhich );
1461 break;
1463 case SID_ATTR_CHAR_COLOR2:
1465 rSet.Put(SvxColorItem(GetView().GetEditWin().GetTextColor(), SID_ATTR_CHAR_COLOR2));
1467 break;
1468 case SID_ATTR_CHAR_COLOR_BACKGROUND:
1470 if(GetView().GetEditWin().IsTextBackColorTransparent())
1471 rSet.Put(SvxColorItem(Color(COL_TRANSPARENT), SID_ATTR_CHAR_COLOR_BACKGROUND));
1472 else
1473 rSet.Put(SvxColorItem(GetView().GetEditWin().GetTextBackColor(), SID_ATTR_CHAR_COLOR_BACKGROUND));
1475 break;
1476 case SID_ATTR_CHAR_COLOR_BACKGROUND_EXT:
1477 case SID_ATTR_CHAR_COLOR_EXT:
1479 SwEditWin& rEdtWin = GetView().GetEditWin();
1480 SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
1481 rSet.Put(SfxBoolItem(nWhich, pApply && pApply->nColor == nWhich));
1483 break;
1484 case FN_INSERT_BOOKMARK:
1485 if( rSh.IsTableMode() )
1486 rSet.DisableItem( nWhich );
1487 break;
1489 case FN_INSERT_PAGEHEADER:
1490 case FN_INSERT_PAGEFOOTER:
1492 #ifndef CHECK_MENU
1493 rSet.Put( SfxObjectShellItem( nWhich, GetView().GetDocShell() ));
1494 #else
1495 // Seitenvorlagen besorgen
1496 BOOL bFound = FALSE;
1497 USHORT n, nCnt = rSh.GetPageDescCnt();
1498 for( n = 0; n < nCnt; ++n )
1500 const SwPageDesc& rDesc = rSh.GetPageDesc( n );
1501 if( FN_INSERT_PAGEHEADER == nWhich
1502 ? !rDesc.GetMaster().GetHeader().IsActive()
1503 : !rDesc.GetMaster().GetFooter().IsActive() )
1505 bFound = TRUE;
1506 break;
1510 if( bFound )
1511 rSet.Put( SfxObjectShellItem( nWhich, GetView().GetDocShell() ));
1512 else
1513 rSet.DisableItem( nWhich );
1514 #endif
1516 break;
1517 case FN_TABLE_SORT_DIALOG:
1518 case FN_SORTING_DLG:
1519 if(!rSh.HasSelection() ||
1520 (FN_TABLE_SORT_DIALOG == nWhich && !rSh.GetTableFmt()))
1521 rSet.DisableItem( nWhich );
1522 break;
1523 case SID_RUBY_DIALOG:
1525 SvtCJKOptions aCJKOptions;
1526 if(!aCJKOptions.IsRubyEnabled())
1528 GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False );
1529 rSet.DisableItem(nWhich);
1531 else
1532 GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True );
1533 break;
1535 //no break!
1536 case SID_HYPERLINK_DIALOG:
1537 if( GetView().GetDocShell()->IsReadOnly() ||
1538 (!GetView().GetViewFrame()->HasChildWindow(nWhich) &&
1539 rSh.HasReadonlySel()) )
1540 rSet.DisableItem(nWhich);
1541 else
1542 rSet.Put(SfxBoolItem( nWhich, 0 != GetView().
1543 GetViewFrame()->GetChildWindow( nWhich ) ));
1544 break;
1545 case FN_EDIT_HYPERLINK:
1546 case FN_REMOVE_HYPERLINK:
1547 case FN_COPY_HYPERLINK_LOCATION:
1549 SfxItemSet aSet(GetPool(),
1550 RES_TXTATR_INETFMT,
1551 RES_TXTATR_INETFMT);
1552 rSh.GetCurAttr(aSet);
1553 if(SFX_ITEM_SET > aSet.GetItemState( RES_TXTATR_INETFMT, TRUE ) || rSh.HasReadonlySel())
1555 rSet.DisableItem(nWhich);
1558 break;
1559 case SID_TRANSLITERATE_HALFWIDTH:
1560 case SID_TRANSLITERATE_FULLWIDTH:
1561 case SID_TRANSLITERATE_HIRAGANA:
1562 case SID_TRANSLITERATE_KATAGANA:
1564 SvtCJKOptions aCJKOptions;
1565 if(!aCJKOptions.IsChangeCaseMapEnabled())
1567 GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False );
1568 rSet.DisableItem(nWhich);
1570 else
1571 GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True );
1573 break;
1574 case FN_READONLY_SELECTION_MODE :
1575 if(!GetView().GetDocShell()->IsReadOnly())
1576 rSet.DisableItem( nWhich );
1577 else
1579 rSet.Put(SfxBoolItem(nWhich, rSh.GetViewOptions()->IsSelectionInReadonly()));
1581 break;
1582 case FN_SELECTION_MODE_DEFAULT:
1583 case FN_SELECTION_MODE_BLOCK :
1584 rSet.Put(SfxBoolItem(nWhich, (nWhich == FN_SELECTION_MODE_DEFAULT) != rSh.IsBlockMode()));
1585 break;
1586 case SID_OPEN_HYPERLINK:
1588 SfxItemSet aSet(GetPool(),
1589 RES_TXTATR_INETFMT,
1590 RES_TXTATR_INETFMT);
1591 rSh.GetCurAttr(aSet);
1592 if(SFX_ITEM_SET > aSet.GetItemState( RES_TXTATR_INETFMT, FALSE ))
1593 rSet.DisableItem(nWhich);
1595 break;
1596 case SID_OPEN_SMARTTAGMENU:
1598 uno::Sequence< rtl::OUString > aSmartTagTypes;
1599 uno::Sequence< uno::Reference< container::XStringKeyMap > > aStringKeyMaps;
1600 uno::Reference<text::XTextRange> xRange;
1602 rSh.GetSmartTagTerm( aSmartTagTypes, aStringKeyMaps, xRange );
1604 if ( xRange.is() && aSmartTagTypes.getLength() )
1606 uno::Sequence < uno::Sequence< uno::Reference< smarttags::XSmartTagAction > > > aActionComponentsSequence;
1607 uno::Sequence < uno::Sequence< sal_Int32 > > aActionIndicesSequence;
1609 const SmartTagMgr& rSmartTagMgr = SwSmartTagMgr::Get();
1610 rSmartTagMgr.GetActionSequences( aSmartTagTypes,
1611 aActionComponentsSequence,
1612 aActionIndicesSequence );
1614 uno::Reference <frame::XController> xController = GetView().GetController();
1615 const lang::Locale aLocale( SW_BREAKITER()->GetLocale( (LanguageType)GetAppLanguage() ) );
1616 const rtl::OUString aApplicationName( rSmartTagMgr.GetApplicationName() );
1617 const rtl::OUString aRangeText = xRange->getString();
1619 const SvxSmartTagItem aItem( nWhich,
1620 aActionComponentsSequence,
1621 aActionIndicesSequence,
1622 aStringKeyMaps,
1623 xRange,
1624 xController,
1625 aLocale,
1626 aApplicationName,
1627 aRangeText );
1629 rSet.Put( aItem );
1631 else
1632 rSet.DisableItem(nWhich);
1634 break;
1635 case FN_NUM_CONTINUE:
1637 // --> OD 2009-08-26 #i86492#
1638 // Allow continuation of previous list, even if at current cursor
1639 // a list is active.
1640 // if ( rSh.GetCurNumRule() )
1641 // rSet.DisableItem(nWhich);
1642 // else
1643 // <--
1645 // --> OD 2009-08-26 #i86492#
1646 // Search also for bullet list
1647 String aDummy;
1648 const SwNumRule* pRule =
1649 rSh.SearchNumRule( false, true, false, -1, aDummy );
1650 if ( !pRule )
1652 pRule = rSh.SearchNumRule( false, false, false, -1, aDummy );
1654 // <--
1655 if ( !pRule )
1656 rSet.DisableItem(nWhich);
1659 break;
1660 case SID_INSERT_RLM :
1661 case SID_INSERT_LRM :
1662 case SID_INSERT_ZWNBSP :
1663 case SID_INSERT_ZWSP:
1665 SvtCTLOptions aCTLOptions;
1666 sal_Bool bEnabled = aCTLOptions.IsCTLFontEnabled();
1667 GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, bEnabled );
1668 if(!bEnabled)
1669 rSet.DisableItem(nWhich);
1671 break;
1673 nWhich = aIter.NextWhich();
1676 /* -----------------------------2002/07/05 10:31------------------------------
1677 Switch on/off header of footer of a page style - if an empty name is
1678 given all styles are changed
1679 ---------------------------------------------------------------------------*/
1680 void SwTextShell::ChangeHeaderOrFooter(
1681 const String& rStyleName, BOOL bHeader, BOOL bOn, BOOL bShowWarning)
1683 SwWrtShell& rSh = GetShell();
1684 rSh.StartAllAction();
1685 rSh.StartUndo( UNDO_HEADER_FOOTER ); // #i7983#
1686 BOOL bExecute = TRUE;
1687 BOOL bCrsrSet = FALSE;
1688 for( USHORT nFrom = 0, nTo = rSh.GetPageDescCnt();
1689 nFrom < nTo; ++nFrom )
1691 int bChgd = FALSE;
1692 SwPageDesc aDesc( rSh.GetPageDesc( nFrom ));
1693 String sTmp(aDesc.GetName());
1694 if( !rStyleName.Len() || rStyleName == sTmp )
1696 if( bShowWarning && !bOn && GetActiveView() && GetActiveView() == &GetView() &&
1697 (bHeader && aDesc.GetMaster().GetHeader().IsActive() ||
1698 !bHeader && aDesc.GetMaster().GetFooter().IsActive()))
1700 bShowWarning = FALSE;
1701 //Actions have to be closed while the dialog is showing
1702 rSh.EndAllAction();
1704 Window* pParent = &GetView().GetViewFrame()->GetWindow();
1705 BOOL bRet = RET_YES == QueryBox( pParent, ResId( RID_SVXQBX_DELETE_HEADFOOT,
1706 DIALOG_MGR() ) ).Execute();
1707 bExecute = bRet;
1708 rSh.StartAllAction();
1710 if( bExecute )
1712 bChgd = TRUE;
1713 SwFrmFmt &rMaster = aDesc.GetMaster();
1714 if(bHeader)
1715 rMaster.SetFmtAttr( SwFmtHeader( bOn ));
1716 else
1717 rMaster.SetFmtAttr( SwFmtFooter( bOn ));
1718 if( bOn )
1720 SvxULSpaceItem aUL(bHeader ? 0 : MM50, bHeader ? MM50 : 0, RES_UL_SPACE );
1721 SwFrmFmt* pFmt = bHeader ?
1722 (SwFrmFmt*)rMaster.GetHeader().GetHeaderFmt() :
1723 (SwFrmFmt*)rMaster.GetFooter().GetFooterFmt();
1724 pFmt->SetFmtAttr( aUL );
1727 if( bChgd )
1729 rSh.ChgPageDesc( nFrom, aDesc );
1731 if( !bCrsrSet && bOn )
1732 bCrsrSet = rSh.SetCrsrInHdFt(
1733 !rStyleName.Len() ? USHRT_MAX : nFrom,
1734 bHeader );
1738 rSh.EndUndo( UNDO_HEADER_FOOTER ); // #i7983#
1739 rSh.EndAllAction();