LibreOffice Module sw (master) 1
textfld.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <com/sun/star/beans/PropertyValues.hpp>
21#include <AnnotationWin.hxx>
22#include <comphelper/lok.hxx>
23#include <hintids.hxx>
25#include <sfx2/bindings.hxx>
26#include <sfx2/lnkbase.hxx>
27#include <txtfld.hxx>
28#include <svl/itempool.hxx>
29#include <svl/numformat.hxx>
30#include <tools/lineend.hxx>
31#include <svl/whiter.hxx>
32#include <svl/eitem.hxx>
33#include <svl/macitem.hxx>
34#include <sfx2/viewfrm.hxx>
35#include <sfx2/request.hxx>
36#include <svx/postattr.hxx>
37#include <svx/hlnkitem.hxx>
38#include <svx/svxdlg.hxx>
39#include <osl/diagnose.h>
40#include <fmtinfmt.hxx>
41#include <fldwrap.hxx>
42#include <redline.hxx>
43#include <view.hxx>
44#include <viewopt.hxx>
45#include <wrtsh.hxx>
46#include <textsh.hxx>
47#include <docufld.hxx>
48#include <ddefld.hxx>
49#include <fldmgr.hxx>
50#include <uitool.hxx>
51#include <cmdid.h>
52#include <strings.hrc>
53#include <sfx2/event.hxx>
54#include <swabstdlg.hxx>
55#include <doc.hxx>
56#include <PostItMgr.hxx>
57#include <swmodule.hxx>
58#include <xmloff/odffields.hxx>
61#include <IDocumentUndoRedo.hxx>
62#include <svl/zforlist.hxx>
63#include <svl/zformat.hxx>
65#include <IMark.hxx>
66#include <officecfg/Office/Compatibility.hxx>
67#include <ndtxt.hxx>
68#include <translatehelper.hxx>
69#include <sfx2/dispatch.hxx>
70
71
72using namespace nsSwDocInfoSubType;
73
74static OUString lcl_BuildTitleWithRedline( const SwRangeRedline *pRedline )
75{
76 const OUString sTitle(SwResId(STR_REDLINE_COMMENT));
77
78 TranslateId pResId;
79 switch( pRedline->GetType() )
80 {
81 case RedlineType::Insert:
82 pResId = STR_REDLINE_INSERTED;
83 break;
84 case RedlineType::Delete:
85 pResId = STR_REDLINE_DELETED;
86 break;
87 case RedlineType::Format:
88 case RedlineType::ParagraphFormat:
89 pResId = STR_REDLINE_FORMATTED;
90 break;
91 case RedlineType::Table:
92 pResId = STR_REDLINE_TABLECHG;
93 break;
94 case RedlineType::FmtColl:
95 pResId = STR_REDLINE_FMTCOLLSET;
96 break;
97 default:
98 return sTitle;
99 }
100
101 return sTitle + SwResId(pResId);
102}
103
105{
106 SwWrtShell& rSh = GetShell();
107 const SfxPoolItem* pItem = nullptr;
108
109 sal_uInt16 nSlot = rReq.GetSlot();
110 const SfxItemSet* pArgs = rReq.GetArgs();
111 if(pArgs)
112 pArgs->GetItemState(GetPool().GetWhich(nSlot), false, &pItem);
113
114 bool bMore = false;
115 bool bIsText = true;
117 sal_uInt16 nInsertSubType = 0;
118 sal_uInt32 nInsertFormat = 0;
119
120 switch(nSlot)
121 {
122 case FN_EDIT_FIELD:
123 {
124 SwField* pField = rSh.GetCurField(true);
125 if( pField )
126 {
127 switch ( pField->GetTypeId() )
128 {
130 {
131 ::sfx2::SvBaseLink& rLink = static_cast<SwDDEFieldType*>(pField->GetTyp())->
132 GetBaseLink();
133 if(rLink.IsVisible())
134 {
136 ScopedVclPtr<SfxAbstractLinksDialog> pDlg(pFact->CreateLinksDialog(GetView().GetFrameWeld(), &rSh.GetLinkManager(), false, &rLink));
137 pDlg->Execute();
138 }
139 break;
140 }
141 default:
142 {
145 pDlg->Execute();
146 }
147 }
148 }
149 break;
150 }
152 {
153 SwField* pField = rSh.GetCurField();
154 if(pField && pField->GetTyp()->Which() == SwFieldIds::Macro)
155 {
156
157 const OUString& rMacro = static_cast<SwMacroField*>(pField)->GetMacro();
158 sal_Int32 nPos = rMacro.indexOf('.');
159 if(nPos != -1)
160 {
161 SvxMacro aMacro( rMacro.copy(nPos + 1), rMacro.copy(0,nPos), STARBASIC );
162 rSh.ExecMacro(aMacro);
163 }
164 }
165 }
166 break;
167
170 {
171 bool bRet = false;
172 SwFieldType* pField = rSh.GetFieldType( 0, SwFieldIds::Input );
173 const bool bAddSetExpressionFields = !( rSh.GetViewOptions()->IsReadonly() );
174 if ( pField != nullptr
175 && rSh.MoveFieldType(
176 pField,
177 FN_GOTO_NEXT_INPUTFLD == nSlot,
179 bAddSetExpressionFields ) )
180 {
181 rSh.ClearMark();
182 if (!rSh.IsMultiSelection()
183 && (nullptr != dynamic_cast<const SwTextInputField*>(
185 {
186 rSh.SttSelect();
187 rSh.SelectTextModel(
190 }
191 else
192 {
193 rSh.StartInputFieldDlg(rSh.GetCurField(true), false, false, GetView().GetFrameWeld());
194 }
195 bRet = true;
196 }
197
198 rReq.SetReturnValue( SfxBoolItem( nSlot, bRet ));
199 }
200 break;
201
202 case FN_GOTO_MARK:
203 {
205 if (pName)
206 {
207 rSh.GotoMark(pName->GetValue());
208 }
209 }
210 break;
211 default:
212 bMore = true;
213 }
214 if(!bMore)
215 return;
216
217 // Here come the slots with FieldMgr.
218 SwFieldMgr aFieldMgr(GetShellPtr());
219 switch(nSlot)
220 {
222 {
223 bool bRes = false;
224 if( pItem )
225 {
226 sal_uInt32 nFormat = 0;
228 OUString aPar1 = static_cast<const SfxStringItem *>(pItem)->GetValue();
229 OUString aPar2;
230 sal_Int32 nCommand = 0;
231
232 if( const SfxUInt16Item* pFieldItem = pArgs->GetItemIfSet( FN_PARAM_FIELD_TYPE,
233 false ))
234 nType = static_cast<SwFieldTypesEnum>(pFieldItem->GetValue());
235 aPar1 += OUStringChar(DB_DELIM);
236 if( SfxItemState::SET == pArgs->GetItemState(
237 FN_PARAM_1, false, &pItem ))
238 {
239 aPar1 += static_cast<const SfxStringItem *>(pItem)->GetValue();
240 }
241 if( SfxItemState::SET == pArgs->GetItemState(
242 FN_PARAM_3, false, &pItem ))
243 nCommand = static_cast<const SfxInt32Item*>(pItem)->GetValue();
244 aPar1 += OUStringChar(DB_DELIM)
245 + OUString::number(nCommand)
246 + OUStringChar(DB_DELIM);
247 if( SfxItemState::SET == pArgs->GetItemState(
248 FN_PARAM_2, false, &pItem ))
249 {
250 aPar1 += static_cast<const SfxStringItem *>(pItem)->GetValue();
251 }
252 if( const SfxStringItem* pContentItem = pArgs->GetItemIfSet(
253 FN_PARAM_FIELD_CONTENT, false ))
254 aPar2 = pContentItem->GetValue();
255 if( const SfxUInt32Item* pFormatItem = pArgs->GetItemIfSet(
256 FN_PARAM_FIELD_FORMAT, false ))
257 nFormat = pFormatItem->GetValue();
258 OSL_FAIL("Command is not yet used");
259 SwInsertField_Data aData(nType, 0, aPar1, aPar2, nFormat, GetShellPtr(), ' '/*separator*/ );
260 bRes = aFieldMgr.InsertField(aData);
261 }
262 rReq.SetReturnValue(SfxBoolItem( nSlot, bRes ));
263 }
264 break;
266 case FN_INSERT_FIELD:
267 {
268 bool bRes = false;
269 if( pItem && nSlot != FN_INSERT_FIELD_CTRL)
270 {
271 sal_uInt32 nFormat = 0;
273 sal_uInt16 nSubType = 0;
274 OUString aPar1 = static_cast<const SfxStringItem *>(pItem)->GetValue();
275 OUString aPar2;
276 sal_Unicode cSeparator = ' ';
277
278 if( const SfxUInt16Item* pTypeItem = pArgs->GetItemIfSet( FN_PARAM_FIELD_TYPE,
279 false ))
280 nType = static_cast<SwFieldTypesEnum>(pTypeItem->GetValue());
281 else if (pArgs->GetItemState(FN_PARAM_4, false, &pItem) == SfxItemState::SET)
282 {
283 const OUString& rTypeName = static_cast<const SfxStringItem *>(pItem)->GetValue();
284 nType = SwFieldTypeFromString(rTypeName);
285 }
286 if( const SfxUInt16Item* pSubtypeItem = pArgs->GetItemIfSet( FN_PARAM_FIELD_SUBTYPE,
287 false ))
288 nSubType = pSubtypeItem->GetValue();
289 if( const SfxStringItem* pContentItem = pArgs->GetItemIfSet(
290 FN_PARAM_FIELD_CONTENT, false ))
291 aPar2 = pContentItem->GetValue();
292 if( const SfxUInt32Item* pFormatItem = pArgs->GetItemIfSet(
293 FN_PARAM_FIELD_FORMAT, false ))
294 nFormat = pFormatItem->GetValue();
295 if( SfxItemState::SET == pArgs->GetItemState(
296 FN_PARAM_3, false, &pItem ))
297 {
298 OUString sTmp = static_cast<const SfxStringItem *>(pItem)->GetValue();
299 if(!sTmp.isEmpty())
300 cSeparator = sTmp[0];
301 }
302 if (pArgs->GetItemState(FN_PARAM_5, false, &pItem) == SfxItemState::SET)
303 {
304 // Wrap the field in the requested container instead of inserting it
305 // directly at the cursor position.
306 const OUString& rWrapper = static_cast<const SfxStringItem *>(pItem)->GetValue();
307 if (rWrapper == "Footnote")
308 {
309 GetShellPtr()->InsertFootnote(OUString());
310 }
311 else if (rWrapper == "Endnote")
312 {
313 GetShellPtr()->InsertFootnote(OUString(), /*bEndNote=*/true);
314 }
315 }
316 SwInsertField_Data aData(nType, nSubType, aPar1, aPar2, nFormat, GetShellPtr(), cSeparator );
317 bRes = aFieldMgr.InsertField( aData );
318 }
319 else
320 {
321 //#i5788# prevent closing of the field dialog while a modal dialog ( Input field dialog ) is active
322 if(!GetView().GetViewFrame().IsInModalMode())
323 {
324 SfxViewFrame& rVFrame = GetView().GetViewFrame();
326 bRes = rVFrame.GetChildWindow( nSlot ) != nullptr;
327 Invalidate(rReq.GetSlot());
329 rReq.Ignore();
330 }
331 }
332 rReq.SetReturnValue(SfxBoolItem( nSlot, bRes ));
333 }
334 break;
335
337 {
338 SfxViewFrame& rVFrame = GetView().GetViewFrame();
339 if (!rVFrame.HasChildWindow(FN_INSERT_FIELD))
340 rVFrame.ToggleChildWindow(FN_INSERT_FIELD); // Show dialog
341
342 // Switch Fielddlg at a new TabPage
343 sal_uInt16 nId = SwFieldDlgWrapper::GetChildWindowId();
344 SwFieldDlgWrapper *pWrp = static_cast<SwFieldDlgWrapper*>(rVFrame.GetChildWindow(nId));
345 if (pWrp)
346 pWrp->ShowReferencePage();
347 rReq.Ignore();
348 }
349 break;
351 {
352 const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID);
353 if (pIdItem && !pIdItem->GetValue().isEmpty() && GetView().GetPostItMgr())
354 {
355 GetView().GetPostItMgr()->Delete(pIdItem->GetValue().toUInt32());
356 }
357 else if ( GetView().GetPostItMgr() &&
358 GetView().GetPostItMgr()->HasActiveSidebarWin() )
359 {
361 }
362 break;
363 }
365 {
366 const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID);
367 if (pIdItem && !pIdItem->GetValue().isEmpty() && GetView().GetPostItMgr())
368 {
369 GetView().GetPostItMgr()->DeleteCommentThread(pIdItem->GetValue().toUInt32());
370 }
371 else if ( GetView().GetPostItMgr() &&
372 GetView().GetPostItMgr()->HasActiveSidebarWin() )
373 {
375 }
376 break;
377 }
378 case FN_RESOLVE_NOTE:
379 {
380 const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID);
381 if (pIdItem && !pIdItem->GetValue().isEmpty() && GetView().GetPostItMgr())
382 {
383 GetView().GetPostItMgr()->ToggleResolved(pIdItem->GetValue().toUInt32());
384 }
385 break;
386 }
388 {
389 const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID);
390 if (pIdItem && !pIdItem->GetValue().isEmpty() && GetView().GetPostItMgr())
391 {
392 GetView().GetPostItMgr()->ToggleResolvedForThread(pIdItem->GetValue().toUInt32());
393 }
394 break;
395 }
397 if ( GetView().GetPostItMgr() )
399 break;
401 {
402 SwPostItMgr* pPostItMgr = GetView().GetPostItMgr();
403 if (pPostItMgr)
404 pPostItMgr->ExecuteFormatAllDialog(GetView());
405 }
406 break;
408 {
409 const SfxStringItem* pNoteItem = rReq.GetArg<SfxStringItem>(nSlot);
410 if ( pNoteItem && GetView().GetPostItMgr() )
411 GetView().GetPostItMgr()->Delete( pNoteItem->GetValue() );
412 }
413 break;
414 case FN_HIDE_NOTE:
415 if ( GetView().GetPostItMgr() &&
417 {
419 }
420 break;
422 if ( GetView().GetPostItMgr() )
424 break;
426 {
427 const SfxStringItem* pNoteItem = rReq.GetArg<SfxStringItem>(nSlot);
428 if ( pNoteItem && GetView().GetPostItMgr() )
429 GetView().GetPostItMgr()->Hide( pNoteItem->GetValue() );
430 }
431 break;
432 case FN_REPLY:
433 {
434 const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID);
435 if (pIdItem && !pIdItem->GetValue().isEmpty())
436 {
437 SwFieldType* pType = rSh.GetDoc()->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::Postit, OUString(), false);
438 if(pType->FindFormatForPostItId(pIdItem->GetValue().toUInt32()))
439 {
440 auto pMgr = GetView().GetPostItMgr();
441 auto pWin = pMgr->GetAnnotationWin(pIdItem->GetValue().toUInt32());
442 if(pWin)
443 {
444 OUString sText;
445 if(const auto pTextItem = rReq.GetArg<SvxPostItTextItem>(SID_ATTR_POSTIT_TEXT))
446 sText = pTextItem->GetValue();
447 pMgr->RegisterAnswerText(sText);
448 pWin->ExecuteCommand(nSlot);
449 }
450 }
451 }
452 }
453 break;
454 case FN_POSTIT:
455 {
456 rSh.InsertPostIt(aFieldMgr, rReq);
457 }
458 break;
459 case SID_EDIT_POSTIT:
460 {
461 const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID);
462 if (pIdItem && !pIdItem->GetValue().isEmpty())
463 {
464 const SvxPostItTextItem* pTextItem = rReq.GetArg<SvxPostItTextItem>(SID_ATTR_POSTIT_TEXT);
465 OUString sText;
466 if ( pTextItem )
467 sText = pTextItem->GetValue();
468
469 sw::annotation::SwAnnotationWin* pAnnotationWin = GetView().GetPostItMgr()->GetAnnotationWin(pIdItem->GetValue().toUInt32());
470 if (pAnnotationWin)
471 {
472 pAnnotationWin->UpdateText(sText);
473
474 // explicit state update to get the Undo state right
475 GetView().AttrChangedNotify(nullptr);
476 }
477 }
478 }
479 break;
481 {
482 /* this code can be used once we want redline comments in the margin, all other stuff can
483 then be deleted
484 String sComment;
485 const SwRangeRedline *pRedline = rSh.GetCurrRedline();
486
487 if (pRedline)
488 {
489 sComment = pRedline->GetComment();
490 if ( !sComment.Len() )
491 GetView().GetDocShell()->Broadcast(SwRedlineHint(pRedline,SWREDLINE_INSERTED));
492 const_cast<SwRangeRedline*>(pRedline)->Broadcast(SwRedlineHint(pRedline,SWREDLINE_FOCUS,&GetView()));
493 }
494 */
495
496 const SwRangeRedline *pRedline = rSh.GetCurrRedline();
497 SwDoc *pDoc = rSh.GetDoc();
498 // If index is specified, goto and select the appropriate redline
499 if (pArgs && pArgs->GetItemState(nSlot, false, &pItem) == SfxItemState::SET)
500 {
501 const sal_uInt32 nChangeId = static_cast<const SfxUInt32Item*>(pItem)->GetValue();
502 const SwRedlineTable& rRedlineTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
503 for (SwRedlineTable::size_type nRedline = 0; nRedline < rRedlineTable.size(); ++nRedline)
504 {
505 if (nChangeId == rRedlineTable[nRedline]->GetId())
506 pRedline = rSh.GotoRedline(nRedline, true);
507 }
508 }
509
510 OUString sCommentText;
511 const SfxStringItem* pTextItem = rReq.GetArg<SvxPostItTextItem>(SID_ATTR_POSTIT_TEXT);
512 if (pTextItem)
513 sCommentText = pTextItem->GetValue();
514
515 if (pRedline)
516 {
517 // In case of LOK and comment text is already provided, skip
518 // dialog creation and just change the redline comment directly
519 if (comphelper::LibreOfficeKit::isActive() && !sCommentText.isEmpty())
520 {
521 rSh.SetRedlineComment(sCommentText);
522 GetView().AttrChangedNotify(nullptr);
523 MaybeNotifyRedlineModification(const_cast<SwRangeRedline&>(*pRedline), pRedline->GetDoc());
524 break;
525 }
526
527 OUString sComment = convertLineEnd(pRedline->GetComment(), GetSystemLineEnd());
528
529 bool bTravel = false;
530
532 ::DialogGetRanges fnGetRange = pFact->GetDialogGetRangesFunc();
533 SfxItemSet aSet(GetPool(), fnGetRange());
534 aSet.Put(SvxPostItTextItem(sComment, SID_ATTR_POSTIT_TEXT));
535 aSet.Put(SvxPostItAuthorItem(pRedline->GetAuthorString(), SID_ATTR_POSTIT_AUTHOR));
536
538 pRedline->GetRedlineData().GetTimeStamp() ),
539 SID_ATTR_POSTIT_DATE ));
540
541 // Traveling only if more than one field.
542 rSh.StartAction();
543
544 rSh.Push();
545 const SwRangeRedline *pActRed = rSh.SelPrevRedline();
546
547 if (pActRed == pRedline)
548 { // New cursor is at the beginning of the current redlines.
549 rSh.Pop(); // Throw old cursor away
550 rSh.Push();
551 pActRed = rSh.SelPrevRedline();
552 }
553
554 bool bPrev = pActRed != nullptr;
556 rSh.EndAction();
557
558 rSh.ClearMark();
559 // Select current redline.
560 pActRed = rSh.SelNextRedline();
561 if (pActRed != pRedline)
562 rSh.SelPrevRedline();
563
564 rSh.StartAction();
565 rSh.Push();
566 pActRed = rSh.SelNextRedline();
567 bool bNext = pActRed != nullptr;
568 rSh.Pop(SwCursorShell::PopMode::DeleteCurrent); // Restore cursor position
569
570 if( rSh.IsCursorPtAtEnd() )
571 rSh.SwapPam();
572
573 rSh.EndAction();
574
575 bTravel |= bNext || bPrev;
576
579 pDlg->HideAuthor();
580
581 pDlg->SetText(lcl_BuildTitleWithRedline(pRedline));
582
583 if (bTravel)
584 {
585 pDlg->EnableTravel(bNext, bPrev);
586 pDlg->SetPrevHdl(LINK(this, SwTextShell, RedlinePrevHdl));
587 pDlg->SetNextHdl(LINK(this, SwTextShell, RedlineNextHdl));
588 }
589
590 SwViewShell::SetCareDialog(pDlg->GetDialog());
591 g_bNoInterrupt = true;
592
593 if ( pDlg->Execute() == RET_OK )
594 {
595 const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
596 OUString sMsg(pOutSet->Get(SID_ATTR_POSTIT_TEXT).GetValue());
597
598 // Insert or change a comment
599 rSh.SetRedlineComment(sMsg);
600 }
601
603 pDlg.disposeAndClear();
604 g_bNoInterrupt = false;
605 rSh.ClearMark();
606 GetView().AttrChangedNotify(nullptr);
607 }
608 }
609 break;
610
611 case FN_JAVAEDIT:
612 {
613 OUString aType, aText;
614 bool bIsUrl=false;
615 bool bNew=false;
616 bool bUpdate = false;
617 SwFieldMgr aMgr;
618 if ( pItem )
619 {
620 aText = static_cast<const SfxStringItem*>(pItem)->GetValue();
621 const SfxStringItem* pType = rReq.GetArg<SfxStringItem>(FN_PARAM_2);
622 const SfxBoolItem* pIsUrl = rReq.GetArg<SfxBoolItem>(FN_PARAM_1);
623 if ( pType )
624 aType = pType->GetValue();
625 if ( pIsUrl )
626 bIsUrl = pIsUrl->GetValue();
627
628 SwScriptField* pField = static_cast<SwScriptField*>(aMgr.GetCurField());
629 bNew = !pField || (pField->GetTyp()->Which() != SwFieldIds::Script);
630 bUpdate = pField && ( bIsUrl != static_cast<bool>(pField->GetFormat()) || pField->GetPar2() != aType || pField->GetPar1() != aText );
631 }
632 else
633 {
636 if ( pDlg->Execute() )
637 {
638 aType = pDlg->GetScriptType();
639 aText = pDlg->GetScriptText();
640 bIsUrl = pDlg->IsUrl();
641 bNew = pDlg->IsNew();
642 bUpdate = pDlg->IsUpdate();
643 rReq.AppendItem( SfxStringItem( FN_JAVAEDIT, aText ) );
644 rReq.AppendItem( SfxStringItem( FN_PARAM_2, aType ) );
645 rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bIsUrl ) );
646 }
647 }
648
649 if( bNew )
650 {
651 SwInsertField_Data aData(SwFieldTypesEnum::Script, 0, aType, aText, bIsUrl ? 1 : 0);
652 aMgr.InsertField(aData);
653 rReq.Done();
654 }
655 else if( bUpdate )
656 {
657 aMgr.UpdateCurField( bIsUrl ? 1 : 0, aType, aText );
659 rReq.Done();
660 }
661 else
662 rReq.Ignore();
663 }
664 break;
665
666 case FN_INSERT_FLD_DATE :
667 {
668 nInsertType = SwFieldTypesEnum::Date;
669 bIsText = false;
670 // use long date format for Hungarian
671 SwPaM* pCursorPos = rSh.GetCursor();
672 if( pCursorPos )
673 {
674 LanguageType nLang = pCursorPos->GetPoint()->GetNode().GetTextNode()->GetLang(pCursorPos->GetPoint()->GetContentIndex());
677 }
678 goto FIELD_INSERT;
679 }
680 case FN_INSERT_FLD_TIME :
681 nInsertType = SwFieldTypesEnum::Time;
682 bIsText = false;
683 goto FIELD_INSERT;
685 nInsertType = SwFieldTypesEnum::PageNumber;
686 nInsertFormat = SVX_NUM_PAGEDESC; // Like page template
687 bIsText = false;
688 goto FIELD_INSERT;
691 nInsertSubType = 0;
692 bIsText = false;
693 nInsertFormat = SVX_NUM_PAGEDESC;
694 goto FIELD_INSERT;
696 nInsertType = SwFieldTypesEnum::DocumentInfo;
697 nInsertSubType = DI_SUBJECT;
698 goto FIELD_INSERT;
700 nInsertType = SwFieldTypesEnum::DocumentInfo;
701 nInsertSubType = DI_TITLE;
702 goto FIELD_INSERT;
704 nInsertType = SwFieldTypesEnum::DocumentInfo;
705 nInsertSubType = DI_CREATE|DI_SUB_AUTHOR;
706
707FIELD_INSERT:
708 {
709 //format conversion should only be done for number formatter formats
710 if(!nInsertFormat)
711 nInsertFormat = aFieldMgr.GetDefaultFormat(nInsertType, bIsText, rSh.GetNumberFormatter());
712 SwInsertField_Data aData(nInsertType, nInsertSubType,
713 OUString(), OUString(), nInsertFormat);
714 aFieldMgr.InsertField(aData);
715 rReq.Done();
716 }
717 break;
718
720 {
721 OUString aFieldType(ODF_FORMTEXT);
722 const SfxStringItem* pFieldType = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
723 if (pFieldType)
724 {
725 // Allow overwriting the default type.
726 aFieldType = pFieldType->GetValue();
727 }
728
729 OUString aFieldCode;
730 const SfxStringItem* pFieldCode = rReq.GetArg<SfxStringItem>(FN_PARAM_2);
731 if (pFieldCode)
732 {
733 // Allow specifying a field code/command.
734 aFieldCode = pFieldCode->GetValue();
735 }
736
737 if (rSh.HasReadonlySel())
738 {
739 // Inform the user that the request has been ignored.
740 auto xInfo = std::make_shared<weld::GenericDialogController>(
741 GetView().GetFrameWeld(), "modules/swriter/ui/inforeadonlydialog.ui",
742 "InfoReadonlyDialog");
743 weld::DialogController::runAsync(xInfo, [](sal_Int32 /*nResult*/) {});
744 break;
745 }
746
747 rSh.GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::INSERT_FORM_FIELD, nullptr);
748
749 SwPaM* pCursorPos = rSh.GetCursor();
750 if(pCursorPos)
751 {
752 // Insert five En Space into the text field so the field has extent
753 static constexpr OUStringLiteral vEnSpaces = u"\u2002\u2002\u2002\u2002\u2002";
754 OUString aFieldResult(vEnSpaces);
755 const SfxStringItem* pFieldResult = rReq.GetArg<SfxStringItem>(FN_PARAM_3);
756 if (pFieldResult)
757 {
758 // Allow specifying a field result / expanded value.
759 aFieldResult = pFieldResult->GetValue();
760 }
761
762 const SfxStringItem* pWrapper = rReq.GetArg<SfxStringItem>(FN_PARAM_4);
763 if (pWrapper)
764 {
765 // Wrap the fieldmark in the requested container instead of inserting it
766 // directly at the cursor position.
767 OUString aWrapper = pWrapper->GetValue();
768 if (aWrapper == "Footnote")
769 {
770 rSh.InsertFootnote(OUString());
771 }
772 else if (aWrapper == "Endnote")
773 {
774 // It's important that there is no Start/EndAction() around this, so the
775 // inner EndAction() triggers a layout update and the cursor can jump to the
776 // created SwFootnoteFrame.
777 rSh.InsertFootnote(OUString(), /*bEndNote=*/true);
778 }
779 }
780
781 // Don't update the layout after inserting content and before deleting temporary
782 // text nodes.
783 rSh.StartAction();
784
785 // Split node to remember where the start position is.
786 bool bSuccess = rSh.GetDoc()->getIDocumentContentOperations().SplitNode(
787 *pCursorPos->GetPoint(), false);
788 if(bSuccess)
789 {
790 SwPaM aFieldPam(*pCursorPos->GetPoint());
791 aFieldPam.Move(fnMoveBackward, GoInContent);
792 if (pFieldResult)
793 {
794 // Paste HTML content.
795 SwTranslateHelper::PasteHTMLToPaM(rSh, pCursorPos, aFieldResult.toUtf8(),
796 true);
797 if (pCursorPos->GetPoint()->GetContentIndex() == 0)
798 {
799 // The paste created a last empty text node, remove it.
800 SwPaM aPam(*pCursorPos->GetPoint());
801 aPam.SetMark();
804 }
805 }
806 else
807 {
808 // Insert default placeholder.
810 aFieldResult);
811 }
812 // Undo the above SplitNode().
813 aFieldPam.SetMark();
814 aFieldPam.Move(fnMoveForward, GoInContent);
816 *aFieldPam.GetMark() = *pCursorPos->GetPoint();
817
818 IDocumentMarkAccess* pMarksAccess = rSh.GetDoc()->getIDocumentMarkAccess();
819 sw::mark::IFieldmark* pFieldmark = pMarksAccess->makeFieldBookmark(
820 aFieldPam, OUString(), aFieldType, aFieldPam.Start());
821 if (pFieldmark && !aFieldCode.isEmpty())
822 {
823 pFieldmark->GetParameters()->insert(
824 std::pair<OUString, uno::Any>(ODF_CODE_PARAM, uno::Any(aFieldCode)));
825 }
826 }
827 rSh.EndAction();
828 }
829
831 rSh.GetView().GetViewFrame().GetBindings().Invalidate( SID_UNDO );
832 }
833 break;
835 {
836 rSh.GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::INSERT_FORM_FIELD, nullptr);
837
838 SwPaM* pCursorPos = rSh.GetCursor();
839 if(pCursorPos)
840 {
841 IDocumentMarkAccess* pMarksAccess = rSh.GetDoc()->getIDocumentMarkAccess();
842 pMarksAccess->makeNoTextFieldBookmark(*pCursorPos, OUString(), ODF_FORMCHECKBOX);
843 }
844
846 rSh.GetView().GetViewFrame().GetBindings().Invalidate( SID_UNDO );
847 }
848 break;
850 {
851 rSh.GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::INSERT_FORM_FIELD, nullptr);
852
853 SwPaM* pCursorPos = rSh.GetCursor();
854 if(pCursorPos)
855 {
856 IDocumentMarkAccess* pMarksAccess = rSh.GetDoc()->getIDocumentMarkAccess();
857 pMarksAccess->makeNoTextFieldBookmark(*pCursorPos, OUString(), ODF_FORMDROPDOWN);
858 }
859
861 rSh.GetView().GetViewFrame().GetBindings().Invalidate( SID_UNDO );
862 }
863 break;
865 {
866 rSh.GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::INSERT_FORM_FIELD, nullptr);
867
868 SwPaM* pCursorPos = rSh.GetCursor();
869 if(pCursorPos)
870 {
871 // Insert five enspaces into the text field so the field has extent
872 sal_Unicode vEnSpaces[ODF_FORMFIELD_DEFAULT_LENGTH] = {8194, 8194, 8194, 8194, 8194};
873 bool bSuccess = rSh.GetDoc()->getIDocumentContentOperations().InsertString(*pCursorPos, OUString(vEnSpaces, ODF_FORMFIELD_DEFAULT_LENGTH));
874 if(bSuccess)
875 {
876 IDocumentMarkAccess* pMarksAccess = rSh.GetDoc()->getIDocumentMarkAccess();
877 SwPaM aFieldPam(pCursorPos->GetPoint()->GetNode(), pCursorPos->GetPoint()->GetContentIndex() - ODF_FORMFIELD_DEFAULT_LENGTH,
878 pCursorPos->GetPoint()->GetNode(), pCursorPos->GetPoint()->GetContentIndex());
879 sw::mark::IFieldmark* pFieldBM = pMarksAccess->makeFieldBookmark(aFieldPam, OUString(), ODF_FORMDATE,
880 aFieldPam.Start());
881
882 // Use a default date format and language
883 sw::mark::IFieldmark::parameter_map_t* pParameters = pFieldBM->GetParameters();
884 SvNumberFormatter* pFormatter = rSh.GetDoc()->GetNumberFormatter();
885 sal_uInt32 nStandardFormat = pFormatter->GetStandardFormat(SvNumFormatType::DATE);
886 const SvNumberformat* pFormat = pFormatter->GetEntry(nStandardFormat);
887
888 (*pParameters)[ODF_FORMDATE_DATEFORMAT] <<= pFormat->GetFormatstring();
889 (*pParameters)[ODF_FORMDATE_DATEFORMAT_LANGUAGE] <<= LanguageTag(pFormat->GetLanguage()).getBcp47();
890 }
891 }
892
894 rSh.GetView().GetViewFrame().GetBindings().Invalidate( SID_UNDO );
895 }
896 break;
898 {
899 // This updates multiple fieldmarks in a document, based on their field name & field command
900 // prefix.
901 OUString aFieldType;
902 const SfxStringItem* pFieldType = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
903 if (pFieldType)
904 {
905 aFieldType = pFieldType->GetValue();
906 }
907 OUString aFieldCommandPrefix;
908 const SfxStringItem* pFieldCommandPrefix = rReq.GetArg<SfxStringItem>(FN_PARAM_2);
909 if (pFieldCommandPrefix)
910 {
911 aFieldCommandPrefix = pFieldCommandPrefix->GetValue();
912 }
913 uno::Sequence<beans::PropertyValues> aFields;
914 const SfxUnoAnyItem* pFields = rReq.GetArg<SfxUnoAnyItem>(FN_PARAM_3);
915 if (pFields)
916 {
917 pFields->GetValue() >>= aFields;
918 }
919
920 rSh.GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::UPDATE_FORM_FIELDS, nullptr);
921 rSh.StartAction();
922
923 IDocumentMarkAccess* pMarkAccess = rSh.GetDoc()->getIDocumentMarkAccess();
924 sal_Int32 nFieldIndex = 0;
925 for (auto it = pMarkAccess->getFieldmarksBegin(); it != pMarkAccess->getFieldmarksEnd(); ++it)
926 {
927 auto pFieldmark = dynamic_cast<sw::mark::IFieldmark*>(*it);
928 assert(pFieldmark);
929 if (pFieldmark->GetFieldname() != aFieldType)
930 {
931 continue;
932 }
933
934 auto itParam = pFieldmark->GetParameters()->find(ODF_CODE_PARAM);
935 if (itParam == pFieldmark->GetParameters()->end())
936 {
937 continue;
938 }
939
940 OUString aCommand;
941 itParam->second >>= aCommand;
942 if (!aCommand.startsWith(aFieldCommandPrefix))
943 {
944 continue;
945 }
946
947 if (aFields.getLength() <= nFieldIndex)
948 {
949 continue;
950 }
951
952 comphelper::SequenceAsHashMap aMap(aFields[nFieldIndex++]);
953 itParam->second = aMap["FieldCommand"];
954 SwPaM aPaM(pFieldmark->GetMarkPos(), pFieldmark->GetOtherMarkPos());
955 aPaM.Normalize();
956 // Skip field start & separator.
957 aPaM.GetPoint()->AdjustContent(2);
958 // Skip field end.
959 aPaM.GetMark()->AdjustContent(-1);
961 OUString aFieldResult;
962 aMap["FieldResult"] >>= aFieldResult;
963 SwTranslateHelper::PasteHTMLToPaM(rSh, &aPaM, aFieldResult.toUtf8(), true);
964 }
965
966 rSh.EndAction();
968 }
969 break;
971 {
972 // This deletes all fieldmarks that match the provided field type & field command prefix.
973 OUString aFieldType;
974 const SfxStringItem* pFieldType = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
975 if (pFieldType)
976 {
977 aFieldType = pFieldType->GetValue();
978 }
979 OUString aFieldCommandPrefix;
980 const SfxStringItem* pFieldCommandPrefix = rReq.GetArg<SfxStringItem>(FN_PARAM_2);
981 if (pFieldCommandPrefix)
982 {
983 aFieldCommandPrefix = pFieldCommandPrefix->GetValue();
984 }
985 rSh.GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::DELETE_FORM_FIELDS, nullptr);
986 rSh.StartAction();
987
988 IDocumentMarkAccess* pMarkAccess = rSh.GetDoc()->getIDocumentMarkAccess();
989 std::vector<sw::mark::IMark*> aRemovals;
990 for (auto it = pMarkAccess->getFieldmarksBegin(); it != pMarkAccess->getFieldmarksEnd(); ++it)
991 {
992 auto pFieldmark = dynamic_cast<sw::mark::IFieldmark*>(*it);
993 assert(pFieldmark);
994 if (pFieldmark->GetFieldname() != aFieldType)
995 {
996 continue;
997 }
998
999 if (!aFieldCommandPrefix.isEmpty())
1000 {
1001 auto itParam = pFieldmark->GetParameters()->find(ODF_CODE_PARAM);
1002 if (itParam == pFieldmark->GetParameters()->end())
1003 {
1004 continue;
1005 }
1006
1007 OUString aCommand;
1008 itParam->second >>= aCommand;
1009 if (!aCommand.startsWith(aFieldCommandPrefix))
1010 {
1011 continue;
1012 }
1013 }
1014
1015 aRemovals.push_back(pFieldmark);
1016 }
1017
1018 for (const auto& pMark : aRemovals)
1019 {
1020 pMarkAccess->deleteMark(pMark);
1021 }
1022
1023 rSh.EndAction();
1024 rSh.GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::DELETE_FORM_FIELDS, nullptr);
1025 }
1026 break;
1027 case FN_PGNUMBER_WIZARD:
1028 {
1032 auto pShell = GetShellPtr();
1033 pDlg->StartExecuteAsync([pShell, &rSh, pDlg](int nResult) {
1034 if ( nResult == RET_OK )
1035 {
1036 auto rDoc = rSh.GetDoc();
1037
1038 rSh.LockView(true);
1039 rSh.StartAllAction();
1040 rSh.SwCursorShell::Push();
1041 rDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::INSERT_PAGE_NUMBER, nullptr);
1042
1043 // Insert header/footer
1044 bool bFooter = (pDlg->GetPageNumberPosition() == 1);
1045 sal_uInt16 nPageNumberPosition = bFooter ?
1047 SfxBoolItem aItem(FN_PARAM_1, true);
1049 nPageNumberPosition,
1050 SfxCallMode::API | SfxCallMode::SYNCHRON,
1051 {&aItem}
1052 );
1053
1054 SwTextNode* pTextNode = rSh.GetCursor()->GetPoint()->GetNode().GetTextNode();
1055
1056 // Insert new line if there is already text in header/footer
1057 if (pTextNode && !pTextNode->GetText().isEmpty())
1058 {
1060 }
1061
1062 // Go back to start of header/footer
1063 if (bFooter)
1064 rSh.GotoFooterText();
1065 else
1066 rSh.GotoHeaderText();
1067
1068 // Set alignment for the new line
1069 switch (pDlg->GetPageNumberAlignment())
1070 {
1071 case 0:
1072 {
1073 SvxAdjustItem aAdjustItem(SvxAdjust::Left, RES_PARATR_ADJUST);
1074 rSh.SetAttrItem(aAdjustItem);
1075 break;
1076 }
1077 case 1:
1078 {
1079 SvxAdjustItem aAdjustItem(SvxAdjust::Center, RES_PARATR_ADJUST);
1080 rSh.SetAttrItem(aAdjustItem);
1081 break;
1082 }
1083 case 2:
1084 {
1085 SvxAdjustItem aAdjustItem(SvxAdjust::Right, RES_PARATR_ADJUST);
1086 rSh.SetAttrItem(aAdjustItem);
1087 break;
1088 }
1089 }
1090
1091 // Insert page number
1092 SwFieldMgr aMgr(pShell);
1094 OUString(), OUString(), SVX_NUM_PAGEDESC);
1095 aMgr.InsertField(aData);
1096
1097 rSh.SwCursorShell::Pop(SwCursorShell::PopMode::DeleteCurrent);
1098 rSh.EndAllAction();
1099 rSh.LockView(false);
1100 rDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSERT_PAGE_NUMBER, nullptr);
1101 }
1102 pDlg->disposeOnce();
1103 });
1104 rReq.Done();
1105 }
1106 break;
1108 {
1109 // This updates a single fieldmark under the current cursor.
1110 OUString aFieldType;
1111 const SfxStringItem* pFieldType = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
1112 if (pFieldType)
1113 {
1114 aFieldType = pFieldType->GetValue();
1115 }
1116 OUString aFieldCommandPrefix;
1117 const SfxStringItem* pFieldCommandPrefix = rReq.GetArg<SfxStringItem>(FN_PARAM_2);
1118 if (pFieldCommandPrefix)
1119 {
1120 aFieldCommandPrefix = pFieldCommandPrefix->GetValue();
1121 }
1122 uno::Sequence<beans::PropertyValue> aField;
1123 const SfxUnoAnyItem* pFields = rReq.GetArg<SfxUnoAnyItem>(FN_PARAM_3);
1124 if (pFields)
1125 {
1126 pFields->GetValue() >>= aField;
1127 }
1128
1130 SwPosition& rCursor = *rSh.GetCursor()->GetPoint();
1131 sw::mark::IFieldmark* pFieldmark = rIDMA.getInnerFieldmarkFor(rCursor);
1132 if (!pFieldmark)
1133 {
1134 break;
1135 }
1136
1137 if (pFieldmark->GetFieldname() != aFieldType)
1138 {
1139 break;
1140 }
1141
1142 auto itParam = pFieldmark->GetParameters()->find(ODF_CODE_PARAM);
1143 if (itParam == pFieldmark->GetParameters()->end())
1144 {
1145 break;
1146 }
1147
1148 OUString aCommand;
1149 itParam->second >>= aCommand;
1150 if (!aCommand.startsWith(aFieldCommandPrefix))
1151 {
1152 break;
1153 }
1154
1155 rSh.GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::UPDATE_FORM_FIELD, nullptr);
1156 rSh.StartAction();
1158 itParam->second = aMap["FieldCommand"];
1159 SwPaM aPaM(pFieldmark->GetMarkPos(), pFieldmark->GetOtherMarkPos());
1160 aPaM.Normalize();
1161 // Skip field start & separator.
1162 aPaM.GetPoint()->AdjustContent(2);
1163 // Skip field end.
1164 aPaM.GetMark()->AdjustContent(-1);
1166 OUString aFieldResult;
1167 aMap["FieldResult"] >>= aFieldResult;
1168 SwTranslateHelper::PasteHTMLToPaM(rSh, &aPaM, aFieldResult.toUtf8(), true);
1169
1170 rSh.EndAction();
1171 rSh.GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::UPDATE_FORM_FIELD, nullptr);
1172 }
1173 break;
1174 default:
1175 OSL_FAIL("wrong dispatcher");
1176 return;
1177 }
1178}
1179
1181{
1182 SwWrtShell& rSh = GetShell();
1183 SfxWhichIter aIter( rSet );
1184 const SwField* pField = nullptr;
1185 bool bGetField = false;
1186 sal_uInt16 nWhich = aIter.FirstWhich();
1187
1188 while (nWhich)
1189 {
1190 switch (nWhich)
1191 {
1192 case FN_DELETE_COMMENT:
1196 case FN_HIDE_NOTE:
1198 case FN_HIDE_ALL_NOTES:
1199 {
1200 SwPostItMgr* pPostItMgr = GetView().GetPostItMgr();
1201 if ( !pPostItMgr )
1202 rSet.InvalidateItem( nWhich );
1203 else if ( !pPostItMgr->HasActiveSidebarWin() )
1204 {
1207 }
1208 // tdf#137568 do not offer comment formatting, if no comments are present
1209 if (!pPostItMgr || !pPostItMgr->HasNotes())
1211 }
1212 break;
1213
1214 case FN_EDIT_FIELD:
1215 {
1216 if( !bGetField )
1217 {
1218 pField = rSh.GetCurField(true);
1219 bGetField = true;
1220 }
1221
1222 SwFieldIds nTempWhich = pField ? pField->GetTyp()->Which() : SwFieldIds::Unknown;
1223 if( SwFieldIds::Unknown == nTempWhich ||
1224 SwFieldIds::Postit == nTempWhich ||
1225 SwFieldIds::Script == nTempWhich ||
1226 SwFieldIds::TableOfAuthorities == nTempWhich )
1227 rSet.DisableItem( nWhich );
1228 else if( SwFieldIds::Dde == nTempWhich &&
1229 !static_cast<SwDDEFieldType*>(pField->GetTyp())->GetBaseLink().IsVisible())
1230 {
1231 // nested links cannot be edited
1232 rSet.DisableItem( nWhich );
1233 }
1234 }
1235 break;
1236
1238 {
1239 if(!bGetField)
1240 {
1241 pField = rSh.GetCurField();
1242 bGetField = true;
1243 }
1244 if(!pField || pField->GetTyp()->Which() != SwFieldIds::Macro)
1245 rSet.DisableItem(nWhich);
1246 }
1247 break;
1248
1249 case FN_INSERT_FIELD:
1250 {
1251 if ( rSh.CursorInsideInputField() )
1252 {
1253 rSet.DisableItem(nWhich);
1254 }
1255 else
1256 {
1257 SfxViewFrame& rVFrame = GetView().GetViewFrame();
1258 //#i5788# prevent closing of the field dialog while a modal dialog ( Input field dialog ) is active
1259 if(!rVFrame.IsInModalMode() &&
1262 else
1264 }
1265 }
1266 break;
1267
1269 {
1270 SfxViewFrame& rVFrame = GetView().GetViewFrame();
1271 if ( !rVFrame.KnowsChildWindow(FN_INSERT_FIELD)
1272 || rSh.CursorInsideInputField() )
1273 {
1275 }
1276 }
1277 break;
1278
1280 if ( rSh.CursorInsideInputField() )
1281 {
1282 rSet.DisableItem(nWhich);
1283 }
1284 else
1285 {
1286 rSet.Put(SfxBoolItem( nWhich, GetView().GetViewFrame().HasChildWindow(FN_INSERT_FIELD)));
1287 }
1288 break;
1289
1290 case FN_REDLINE_COMMENT:
1292 rSet.DisableItem(nWhich);
1293 break;
1294
1295 case FN_REPLY:
1297 rSet.DisableItem(nWhich);
1298 break;
1299
1300 case FN_POSTIT :
1301 case FN_JAVAEDIT :
1302 {
1303 bool bCurField = false;
1304 pField = rSh.GetCurField();
1305 if(nWhich == FN_POSTIT)
1306 bCurField = pField && pField->GetTyp()->Which() == SwFieldIds::Postit;
1307 else
1308 bCurField = pField && pField->GetTyp()->Which() == SwFieldIds::Script;
1309
1310 if( !bCurField && rSh.IsReadOnlyAvailable() && rSh.HasReadonlySel() )
1311 {
1312 rSet.DisableItem(nWhich);
1313 }
1314 else if ( rSh.CursorInsideInputField() )
1315 {
1316 rSet.DisableItem(nWhich);
1317 }
1318 // tdf#86188, tdf#135794: Allow disabling comment insertion
1319 // on footnote/endnote/header/frames for better OOXML interoperability
1321 (rSh.IsCursorInFootnote() || rSh.IsInHeaderFooter() ||
1322 rSh.GetCurrFlyFrame(/*bCalcFrame=*/false)))
1323 {
1324 rSet.DisableItem(nWhich);
1325 }
1326 }
1327
1328 break;
1329
1331 case FN_INSERT_FLD_DATE:
1334 case FN_INSERT_FLD_TIME:
1337 case FN_INSERT_DBFIELD:
1338 if ( rSh.CursorInsideInputField() )
1339 {
1340 rSet.DisableItem(nWhich);
1341 }
1342 break;
1343
1348 if ( rSh.CursorInsideInputField() )
1349 {
1350 rSet.DisableItem(nWhich);
1351 }
1352 else
1353 {
1354 // Check whether we are in a text form field
1355 SwPosition aCursorPos(*rSh.GetCursor()->GetPoint());
1356 sw::mark::IFieldmark* pFieldBM = GetShell().getIDocumentMarkAccess()->getInnerFieldmarkFor(aCursorPos);
1357 if ((!pFieldBM || pFieldBM->GetFieldname() != ODF_FORMTEXT)
1358 && aCursorPos.GetContentIndex() > 0)
1359 {
1360 SwPosition aPos(*aCursorPos.GetContentNode(), aCursorPos.GetContentIndex() - 1);
1362 }
1363 if (pFieldBM && pFieldBM->GetFieldname() == ODF_FORMTEXT &&
1364 (aCursorPos > pFieldBM->GetMarkStart() && aCursorPos < pFieldBM->GetMarkEnd() ))
1365 {
1366 rSet.DisableItem(nWhich);
1367 }
1368 }
1369 break;
1370
1371 }
1372 nWhich = aIter.NextWhich();
1373 }
1374}
1375
1377{
1378 const OUString& rName = rHlnkItem.GetName();
1379 const OUString& rURL = rHlnkItem.GetURL();
1380 const OUString& rTarget = rHlnkItem.GetTargetFrame();
1381 const OUString& rReplacementText = rHlnkItem.GetReplacementText();
1382 sal_uInt16 nType = o3tl::narrowing<sal_uInt16>(rHlnkItem.GetInsertMode());
1383 nType &= ~HLINK_HTMLMODE;
1384 const SvxMacroTableDtor* pMacroTable = rHlnkItem.GetMacroTable();
1385
1386 SwWrtShell& rSh = GetShell();
1387
1388 if( !(rSh.GetSelectionType() & SelectionType::Text) )
1389 return;
1390
1391 rSh.StartAction();
1393 rSh.GetCurAttr( aSet );
1394
1395 if(SfxItemState::SET == aSet.GetItemState(RES_TXTATR_INETFMT, false))
1396 {
1397 // Select links
1398 rSh.SwCursorShell::SelectTextAttr(RES_TXTATR_INETFMT, false);
1399 }
1400 switch (nType)
1401 {
1402 case HLINK_DEFAULT:
1403 case HLINK_FIELD:
1404 {
1405 SwFormatINetFormat aINetFormat( rURL, rTarget );
1406 aINetFormat.SetName(rHlnkItem.GetIntName());
1407 if(pMacroTable)
1408 {
1409 const SvxMacro *pMacro = pMacroTable->Get( SvMacroItemId::OnMouseOver );
1410 if( pMacro )
1411 aINetFormat.SetMacro(SvMacroItemId::OnMouseOver, *pMacro);
1412 pMacro = pMacroTable->Get( SvMacroItemId::OnClick );
1413 if( pMacro )
1414 aINetFormat.SetMacro(SvMacroItemId::OnClick, *pMacro);
1415 pMacro = pMacroTable->Get( SvMacroItemId::OnMouseOut );
1416 if( pMacro )
1417 aINetFormat.SetMacro(SvMacroItemId::OnMouseOut, *pMacro);
1418 }
1419 rSh.SttSelect();
1420 // inserting mention
1421 if (comphelper::LibreOfficeKit::isActive() && !rReplacementText.isEmpty())
1422 {
1423 SwPaM* pCursorPos = rSh.GetCursor();
1424 // move cursor backwards to select @mention
1425 for(int i=0; i < rReplacementText.getLength(); i++)
1426 pCursorPos->Move(fnMoveBackward);
1427 rSh.InsertURL( aINetFormat, rName, false );
1428 }
1429 else
1430 {
1431 rSh.InsertURL( aINetFormat, rName, true );
1432 }
1433 rSh.EndSelect();
1434 }
1435 break;
1436
1437 case HLINK_BUTTON:
1438 bool bSel = rSh.HasSelection();
1439 if(bSel)
1440 rSh.DelRight();
1441 InsertURLButton( rURL, rTarget, rName );
1442 rSh.EnterStdMode();
1443 break;
1444 }
1445 rSh.EndAction();
1446}
1447
1448IMPL_LINK( SwTextShell, RedlineNextHdl, AbstractSvxPostItDialog&, rDlg, void )
1449{
1450 SwWrtShell* pSh = GetShellPtr();
1451
1452 // Insert or change a comment.
1453 pSh->SetRedlineComment(rDlg.GetNote());
1454
1455 const SwRangeRedline *pRedline = pSh->GetCurrRedline();
1456
1457 if (!pRedline)
1458 return;
1459
1460 // Traveling only if more than one field.
1461 if( !pSh->IsCursorPtAtEnd() )
1462 pSh->SwapPam(); // Move the cursor behind the Redline.
1463
1464 pSh->Push();
1465 const SwRangeRedline *pActRed = pSh->SelNextRedline();
1467
1468 bool bEnable = false;
1469
1470 if (pActRed)
1471 {
1472 pSh->StartAction();
1473 pSh->Push();
1474 bEnable = pSh->SelNextRedline() != nullptr;
1476 pSh->EndAction();
1477 }
1478
1479 rDlg.EnableTravel(bEnable, true);
1480
1481 if( pSh->IsCursorPtAtEnd() )
1482 pSh->SwapPam();
1483
1484 pRedline = pSh->GetCurrRedline();
1485 OUString sComment = convertLineEnd(pRedline->GetComment(), GetSystemLineEnd());
1486
1487 rDlg.SetNote(sComment);
1488 rDlg.ShowLastAuthor( pRedline->GetAuthorString(),
1490 pRedline->GetRedlineData().GetTimeStamp() ));
1491
1492 rDlg.SetText(lcl_BuildTitleWithRedline(pRedline));
1493
1494}
1495
1496IMPL_LINK( SwTextShell, RedlinePrevHdl, AbstractSvxPostItDialog&, rDlg, void )
1497{
1498 SwWrtShell* pSh = GetShellPtr();
1499
1500 // Insert or change a comment.
1501 pSh->SetRedlineComment(rDlg.GetNote());
1502
1503 const SwRangeRedline *pRedline = pSh->GetCurrRedline();
1504
1505 if (!pRedline)
1506 return;
1507
1508 // Traveling only if more than one field.
1509 pSh->Push();
1510 const SwRangeRedline *pActRed = pSh->SelPrevRedline();
1512
1513 bool bEnable = false;
1514
1515 if (pActRed)
1516 {
1517 pSh->StartAction();
1518 pSh->Push();
1519 bEnable = pSh->SelPrevRedline() != nullptr;
1521 pSh->EndAction();
1522 }
1523
1524 rDlg.EnableTravel(true, bEnable);
1525
1526 pRedline = pSh->GetCurrRedline();
1527 OUString sComment = convertLineEnd(pRedline->GetComment(), GetSystemLineEnd());
1528
1529 rDlg.SetNote(sComment);
1530 rDlg.ShowLastAuthor(pRedline->GetAuthorString(),
1532 pRedline->GetRedlineData().GetTimeStamp() ));
1533
1534 rDlg.SetText(lcl_BuildTitleWithRedline(pRedline));
1535
1536}
1537
1538/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const char * pName
#define GetWhich(nSlot)
sal_Int32 GetValue() const
const OUString & GetValue() const
virtual bool DeleteAndJoin(SwPaM &, SwDeleteFlags flags=SwDeleteFlags::Default)=0
complete delete of a given PaM
virtual bool SplitNode(const SwPosition &rPos, bool bChkTableStart)=0
Split a node at rPos (implemented only for TextNode).
virtual bool InsertString(const SwPaM &rRg, const OUString &, const SwInsertFlags nInsertMode=SwInsertFlags::EMPTYEXPAND)=0
Insert string into existing text node at position rRg.Point().
virtual SwFieldType * GetFieldType(SwFieldIds nResId, const OUString &rName, bool bDbFieldMatching) const =0
Provides access to the marks of a document.
virtual const_iterator_t getFieldmarksBegin() const =0
returns a STL-like random access iterator to the begin of the sequence of fieldmarks.
virtual sw::mark::IFieldmark * makeNoTextFieldBookmark(const SwPaM &rPaM, const OUString &rName, const OUString &rType)=0
virtual sw::mark::IFieldmark * makeFieldBookmark(const SwPaM &rPaM, const OUString &rName, const OUString &rType, SwPosition const *pSepPos=nullptr)=0
virtual const_iterator_t getFieldmarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of fieldmarks.
virtual sw::mark::IFieldmark * getInnerFieldmarkFor(const SwPosition &pos) const =0
virtual std::unique_ptr< ILazyDeleter > deleteMark(const IDocumentMarkAccess::const_iterator_t &ppMark, bool isMoveNodes)=0
Deletes a mark.
virtual const SwRedlineTable & GetRedlineTable() const =0
const OUString & getBcp47(bool bResolveSystem=true) const
void Invalidate(sal_uInt16 nId)
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void DisableItem(sal_uInt16 nWhich)
void InvalidateItem(sal_uInt16 nWhich)
sal_uInt16 GetSlot() const
void Ignore()
const SfxItemSet * GetArgs() const
const T * GetArg(sal_uInt16 nSlotId) const
void AppendItem(const SfxPoolItem &)
void SetReturnValue(const SfxPoolItem &)
void Done(bool bRemove=false)
SfxItemPool & GetPool() const
virtual void Invalidate(sal_uInt16 nId=0)
const css::uno::Any & GetValue() const
void ToggleChildWindow(sal_uInt16)
bool IsInModalMode() const
SfxBindings & GetBindings()
bool HasChildWindow(sal_uInt16)
SfxChildWindow * GetChildWindow(sal_uInt16)
bool KnowsChildWindow(sal_uInt16)
weld::Window * GetFrameWeld() const
SfxViewFrame & GetViewFrame() const
sal_uInt16 FirstWhich()
sal_uInt16 NextWhich()
sal_uInt32 GetStandardFormat(SvNumFormatType eType, LanguageType eLnge=LANGUAGE_DONTKNOW)
sal_uInt32 GetFormatIndex(NfIndexTableOffset, LanguageType eLnge=LANGUAGE_DONTKNOW)
const SvNumberformat * GetEntry(sal_uInt32 nKey) const
LanguageType GetLanguage() const
const OUString & GetFormatstring() const
virtual VclPtr< AbstractSvxPostItDialog > CreateSvxPostItDialog(weld::Widget *pParent, const SfxItemSet &rCoreSet, bool bPrevNext=false)=0
static SvxAbstractDialogFactory * Create()
virtual DialogGetRanges GetDialogGetRangesFunc()=0
const OUString & GetReplacementText() const
SvxLinkInsertMode GetInsertMode() const
const OUString & GetName() const
const OUString & GetURL() const
const OUString & GetIntName() const
const SvxMacroTableDtor * GetMacroTable() const
const OUString & GetTargetFrame() const
const SvxMacro * Get(SvMacroItemId nEvent) const
virtual VclPtr< SfxAbstractDialog > CreateSwFieldEditDlg(SwView &rVw)=0
virtual VclPtr< AbstractJavaEditDialog > CreateJavaEditDialog(weld::Window *pParent, SwWrtShell *pWrtSh)=0
static SwAbstractDialogFactory * Create()
Definition: swabstdlg.cxx:36
virtual VclPtr< AbstractSwPageNumberDlg > CreateSwPageNumberDlg(weld::Window *pParent)=0
SwWrtShell & GetShell()
Definition: basesh.cxx:3078
SwView & GetView()
Definition: basesh.hxx:59
void InsertURLButton(const OUString &rURL, const OUString &rTarget, const OUString &rText)
Definition: textdrw.cxx:43
SwWrtShell * GetShellPtr()
Definition: basesh.cxx:3083
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2265
bool IsReadOnlyAvailable() const
Definition: crsrsh.hxx:491
void StartAction()
Definition: crsrsh.cxx:226
bool GotoHeaderText()
jump from the content to the header
Definition: crstrvl.cxx:132
void SwapPam()
Definition: crsrsh.cxx:990
bool IsMultiSelection() const
Definition: crsrsh.hxx:907
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:194
bool SelectTextModel(sal_Int32 nStart, sal_Int32 nEnd)
Definition: crstrvl.cxx:2165
bool CursorInsideInputField() const
Definition: crstrvl.cxx:1089
SwField * GetCurField(const bool bIncludeInputFieldAtStart=false) const
Definition: crstrvl.cxx:1068
void EndAction(const bool bIdleEnd=false)
Definition: crsrsh.cxx:243
static sal_Int32 StartOfInputFieldAtPos(const SwPosition &rPos)
Definition: crstrvl.cxx:1136
static SwTextField * GetTextFieldAtCursor(const SwPaM *pCursor, ::sw::GetTextAttrMode eMode)
Definition: crstrvl.cxx:1035
const SwRangeRedline * SelNextRedline()
Definition: crstrvl.cxx:2445
void ClearMark()
Definition: crsrsh.cxx:953
const SwRangeRedline * SelPrevRedline()
Definition: crstrvl.cxx:2472
static sal_Int32 EndOfInputFieldAtPos(const SwPosition &rPos)
Definition: crstrvl.cxx:1144
bool HasReadonlySel(bool isReplace=false) const
Definition: crsrsh.cxx:3374
bool IsInHeaderFooter(bool *pbInHeader=nullptr) const
Definition: crsrsh.cxx:766
bool IsCursorPtAtEnd() const
Definition: crsrsh.hxx:917
bool MoveFieldType(const SwFieldType *pFieldType, const bool bNext, const SwFieldIds nResType=SwFieldIds::Unknown, const bool bAddSetExpressionFieldsToInputFields=true)
Definition: crstrvl.cxx:669
bool IsCursorInFootnote() const
Definition: crsrsh.cxx:1165
bool GotoFooterText()
jump from the content to the footer
Definition: crstrvl.cxx:160
const ::sfx2::SvBaseLink & GetBaseLink() const
Definition: ddefld.hxx:90
Definition: doc.hxx:195
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:323
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:152
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:365
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:343
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1877
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
Definition: doc.hxx:1423
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
Definition: edattr.cxx:171
void StartAllAction()
For all views of this document.
Definition: edws.cxx:86
void SetUndoNoResetModified()
Definition: edws.cxx:80
bool SetRedlineComment(const OUString &rS)
Set comment to Redline at position.
Definition: edredln.cxx:150
void SetAttrItem(const SfxPoolItem &, SetAttrMode nFlags=SetAttrMode::DEFAULT, const bool bParagraphSetting=false)
Definition: edatmisc.cxx:98
SvNumberFormatter * GetNumberFormatter()
Query NumberFormatter from document.
Definition: editsh.cxx:756
bool InsertURL(const SwFormatINetFormat &rFormat, const OUString &rStr, bool bKeepSelection=false)
Definition: editsh.cxx:633
SwFieldType * GetFieldType(size_t nField, SwFieldIds nResId=SwFieldIds::Unknown) const
get field types with a ResId, if 0 get all
Definition: edfld.cxx:64
const SwRangeRedline * GetCurrRedline() const
Definition: edredln.cxx:161
sfx2::LinkManager & GetLinkManager()
Definition: editsh.cxx:592
void EndAllAction()
Definition: edws.cxx:97
SwFlyFrame * GetCurrFlyFrame(const bool bCalcFrame=true) const
Definition: fefly1.cxx:296
void ShowReferencePage()
Definition: fldwrap.cxx:90
sal_uInt32 GetDefaultFormat(SwFieldTypesEnum nTypeId, bool bIsText, SvNumberFormatter *pFormatter)
Definition: fldmgr.cxx:1891
void UpdateCurField(sal_uInt32 nFormat, const OUString &rPar1, const OUString &rPar2, std::unique_ptr< SwField > _pField=nullptr)
Definition: fldmgr.cxx:1571
bool InsertField(SwInsertField_Data &rData)
Definition: fldmgr.cxx:897
SwField * GetCurField()
Definition: fldmgr.cxx:432
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:244
SwFieldIds Which() const
Definition: fldbas.hxx:275
SwFormatField * FindFormatForPostItId(sal_uInt32 nPostItId) const
Definition: fldbas.cxx:175
Base class of all fields.
Definition: fldbas.hxx:295
SwFieldTypesEnum GetTypeId() const
Definition: fldbas.cxx:261
sal_uInt32 GetFormat() const
Query parameters for dialog and for BASIC.
Definition: fldbas.hxx:406
SwFieldType * GetTyp() const
Definition: fldbas.hxx:401
void SetMacro(SvMacroItemId nEvent, const SvxMacro &rMacro)
Macro getter and setter.
Definition: fmtatr2.cxx:261
void SetName(const OUString &rNm)
Definition: fmtinfmt.hxx:84
IDocumentContentOperations & getIDocumentContentOperations()
Provides access to the document content operations interface.
Definition: node.cxx:2159
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:903
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:187
const SwPosition * GetMark() const
Definition: pam.hxx:263
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:642
void Normalize(bool bPointFirst=true)
Normalizes PaM, i.e.
Definition: pam.cxx:700
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:668
SwDoc & GetDoc() const
Definition: pam.hxx:299
const SwPosition * GetPoint() const
Definition: pam.hxx:261
const SwPosition * Start() const
Definition: pam.hxx:266
void Delete(const OUString &aAuthor)
Definition: PostItMgr.cxx:1522
sw::annotation::SwAnnotationWin * GetAnnotationWin(const SwPostItField *pField) const
Definition: PostItMgr.cxx:1795
void HideActiveSidebarWin()
Definition: PostItMgr.cxx:2419
bool HasNotes() const
Definition: PostItMgr.cxx:2128
void ToggleResolved(sal_uInt32 nPostItId)
Definition: PostItMgr.cxx:1601
void Hide(std::u16string_view rAuthor)
Definition: PostItMgr.cxx:1752
void ExecuteFormatAllDialog(SwView &rView)
Definition: PostItMgr.cxx:1679
void DeleteCommentThread(sal_uInt32 nPostItId)
Definition: PostItMgr.cxx:1577
void ToggleResolvedForThread(sal_uInt32 nPostItId)
Definition: PostItMgr.cxx:1626
void DeleteActiveSidebarWin()
Definition: PostItMgr.cxx:2411
SW_DLLPUBLIC bool HasActiveSidebarWin() const
Definition: PostItMgr.cxx:2384
const OUString & GetComment(sal_uInt16 nPos=0) const
Definition: docredln.cxx:1950
OUString const & GetAuthorString(sal_uInt16 nPos=0) const
Definition: docredln.cxx:1930
RedlineType GetType(sal_uInt16 nPos=0) const
Definition: docredln.cxx:1940
const SwRedlineData & GetRedlineData(sal_uInt16 nPos=0) const
Definition: docredln.cxx:1963
const DateTime & GetTimeStamp() const
Definition: redline.hxx:130
size_type size() const
Definition: docary.hxx:267
vector_type::size_type size_type
Definition: docary.hxx:222
virtual OUString GetPar1() const override
Type.
Definition: scrptfld.cxx:66
virtual OUString GetPar2() const override
Text.
Definition: scrptfld.cxx:77
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
const OUString & GetText() const
Definition: ndtxt.hxx:244
LanguageType GetLang(const sal_Int32 nBegin, const sal_Int32 nLen=0, sal_uInt16 nScript=0) const
Definition: thints.cxx:3469
void StateField(SfxItemSet &)
Definition: textfld.cxx:1180
void InsertHyperlink(const SvxHyperlinkItem &rHlnkItem)
Definition: textfld.cxx:1376
void ExecField(SfxRequest &rReq)
Definition: textfld.cxx:104
bool IsReadonly() const
Definition: viewopt.hxx:629
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:434
static void SetCareDialog(const std::shared_ptr< weld::Window > &rNew)
Definition: viewsh.cxx:2661
const IDocumentMarkAccess * getIDocumentMarkAccess() const
Provides access to the document bookmark interface.
Definition: viewsh.cxx:2813
IDocumentUndoRedo const & GetIDocumentUndoRedo() const
Provides access to the document undo/redo interface.
Definition: viewsh.cxx:2827
SwDoc * GetDoc() const
Definition: viewsh.hxx:290
void LockView(bool b)
Definition: viewsh.hxx:473
SfxDispatcher & GetDispatcher()
Definition: view.cxx:135
SwPostItMgr * GetPostItMgr()
Definition: view.hxx:648
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
const SwRangeRedline * GotoRedline(SwRedlineTable::size_type nArrPos, bool bSelect)
Definition: move.cxx:717
void EndSelect()
Definition: select.cxx:426
void InsertPostIt(SwFieldMgr &rFieldMgr, const SfxRequest &rReq)
Inserts a new annotation/comment at the current cursor position / selection.
Definition: wrtsh1.cxx:2221
bool StartInputFieldDlg(SwField *, bool bPrevButton, bool bNextButton, weld::Widget *pParentWin, FieldDialogPressedButton *pPressedButton=nullptr)
Definition: wrtsh2.cxx:264
void GotoMark(const ::sw::mark::IMark *const pMark)
Definition: wrtsh3.cxx:272
SelectionType GetSelectionType() const
Definition: wrtsh1.cxx:1717
void EnterStdMode()
Definition: select.cxx:552
void ExecMacro(const SvxMacro &rMacro, OUString *pRet=nullptr, SbxArray *pArgs=nullptr)
Definition: wrtsh3.cxx:319
void InsertFootnote(const OUString &, bool bEndNote=false, bool bEdit=true)
Definition: wrtsh1.cxx:1169
bool DelRight(bool isReplaceHeuristic=false)
Definition: delete.cxx:293
bool HasSelection() const
Definition: wrtsh.hxx:147
void SttSelect()
Definition: select.cxx:386
bool Pop(SwCursorShell::PopMode, ::std::optional< SwCallLink > &roLink)
Definition: wrtsh1.cxx:2041
const SwView & GetView() const
Definition: wrtsh.hxx:443
void disposeAndClear()
void UpdateText(const OUString &aText)
void ExecuteCommand(sal_uInt16 nSlot)
static bool runAsync(const std::shared_ptr< DialogController > &rController, const std::function< void(sal_Int32)> &)
#define FN_RESOLVE_NOTE
Definition: cmdid.h:792
#define FN_REPLY
Definition: cmdid.h:790
#define FN_INSERT_REF_FIELD
Definition: cmdid.h:215
#define FN_GOTO_MARK
Definition: cmdid.h:109
#define FN_DELETE_NOTE_AUTHOR
Definition: cmdid.h:783
#define FN_UPDATE_TEXT_FORMFIELDS
Definition: cmdid.h:314
#define FN_JAVAEDIT
Definition: cmdid.h:291
#define FN_HIDE_NOTE_AUTHOR
Definition: cmdid.h:786
#define FN_INSERT_FLD_TIME
Definition: cmdid.h:275
#define FN_INSERT_FLD_AUTHOR
Definition: cmdid.h:280
#define FN_INSERT_FLD_TOPIC
Definition: cmdid.h:278
#define FN_INSERT_DBFIELD
Definition: cmdid.h:212
#define FN_INSERT_PAGEHEADER
Definition: cmdid.h:294
#define FN_POSTIT
Definition: cmdid.h:230
#define FN_INSERT_FLD_PGNUMBER
Definition: cmdid.h:276
#define FN_GOTO_PREV_INPUTFLD
Definition: cmdid.h:108
#define FN_INSERT_FIELD_CTRL
Definition: cmdid.h:272
#define FN_PGNUMBER_WIZARD
Definition: cmdid.h:243
#define FN_INSERT_FLD_DATE
Definition: cmdid.h:274
#define FN_REDLINE_COMMENT
Definition: cmdid.h:131
#define FN_HIDE_ALL_NOTES
Definition: cmdid.h:787
#define FN_DELETE_ALL_NOTES
Definition: cmdid.h:784
#define FN_HIDE_NOTE
Definition: cmdid.h:785
#define FN_UPDATE_TEXT_FORMFIELD
Definition: cmdid.h:315
#define FN_INSERT_FIELD
Definition: cmdid.h:208
#define FN_DELETE_COMMENT
Definition: cmdid.h:789
#define FN_INSERT_FIELD_DATA_ONLY
Definition: cmdid.h:220
#define FN_DELETE_COMMENT_THREAD
Definition: cmdid.h:794
#define FN_INSERT_FLD_PGCOUNT
Definition: cmdid.h:277
#define FN_EDIT_FIELD
Definition: cmdid.h:77
#define FN_RESOLVE_NOTE_THREAD
Definition: cmdid.h:793
#define FN_INSERT_DATE_FORMFIELD
Definition: cmdid.h:309
#define FN_INSERT_PAGEFOOTER
Definition: cmdid.h:295
#define FN_GOTO_NEXT_INPUTFLD
Definition: cmdid.h:107
#define FN_PARAM_FIELD_SUBTYPE
Definition: cmdid.h:820
#define FN_PARAM_FIELD_FORMAT
Definition: cmdid.h:821
#define FN_FORMAT_ALL_NOTES
Definition: cmdid.h:791
#define FN_DELETE_TEXT_FORMFIELDS
Definition: cmdid.h:325
#define FN_INSERT_FLD_TITLE
Definition: cmdid.h:279
#define FN_EXECUTE_MACROFIELD
Definition: cmdid.h:83
#define FN_INSERT_CHECKBOX_FORMFIELD
Definition: cmdid.h:305
#define FN_INSERT_DROPDOWN_FORMFIELD
Definition: cmdid.h:306
#define FN_INSERT_TEXT_FORMFIELD
Definition: cmdid.h:304
#define FN_PARAM_FIELD_TYPE
Definition: cmdid.h:819
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Definition: dialoghelp.cxx:19
virtual sal_uInt32 GetId() const override
void MaybeNotifyRedlineModification(SwRangeRedline &rRedline, SwDoc &rDoc)
Definition: docredln.cxx:1185
float u
FilterGroup & rTarget
SwFieldTypesEnum SwFieldTypeFromString(std::u16string_view rString)
Definition: fldbas.cxx:530
SwFieldTypesEnum
List of FieldTypes at UI.
Definition: fldbas.hxx:95
SwFieldIds
Definition: fldbas.hxx:46
@ TableOfAuthorities
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
constexpr TypedWhichId< SvxAdjustItem > RES_PARATR_ADJUST(64)
HLINK_FIELD
HLINK_DEFAULT
HLINK_BUTTON
#define LANGUAGE_HUNGARIAN
LineEnd GetSystemLineEnd()
TOOLS_DLLPUBLIC OString convertLineEnd(const OString &rIn, LineEnd eLineEnd)
sal_uInt16 nPos
STARBASIC
constexpr OUStringLiteral aData
Definition: ww8scan.hxx:48
SW_DLLPUBLIC void PasteHTMLToPaM(SwWrtShell &rWrtSh, SwPaM *pCursor, const OString &rData, bool bSetSelection)
int i
const SwDocInfoSubType DI_SUB_AUTHOR
Definition: docufld.hxx:83
const SwDocInfoSubType DI_SUBJECT
Definition: docufld.hxx:72
const SwDocInfoSubType DI_TITLE
Definition: docufld.hxx:71
const SwDocInfoSubType DI_CREATE
Definition: docufld.hxx:75
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
HashMap_OWString_Interface aMap
constexpr OUStringLiteral ODF_FORMTEXT
constexpr OUStringLiteral ODF_FORMDATE_DATEFORMAT
constexpr OUStringLiteral ODF_CODE_PARAM
constexpr OUStringLiteral ODF_FORMCHECKBOX
#define ODF_FORMFIELD_DEFAULT_LENGTH
constexpr OUStringLiteral ODF_FORMDATE
constexpr OUStringLiteral ODF_FORMDATE_DATEFORMAT_LANGUAGE
constexpr OUStringLiteral ODF_FORMDROPDOWN
sal_Int16 nId
const char GetValue[]
bool GoInContent(SwPaM &rPam, SwMoveFnCollection const &fnMove)
Definition: pam.cxx:1180
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:60
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
Definition: paminit.cxx:61
QPRO_FUNC_TYPE nType
static SfxItemSet & rSet
static LanguageType nLang
Definition: srtdlg.cxx:51
Marks a position in the document model.
Definition: pam.hxx:37
SwNode & GetNode() const
Definition: pam.hxx:80
const SwContentNode * GetContentNode() const
Definition: pam.hxx:83
sal_Int32 GetContentIndex() const
Definition: pam.hxx:84
void AdjustContent(sal_Int32 nDelta)
Adjust content index, only valid to call this if the position points to a SwContentNode subclass.
Definition: pam.cxx:261
SVX_NUM_PAGEDESC
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:168
bool g_bNoInterrupt
Definition: swmodule.cxx:115
#define DB_DELIM
Definition: swtypes.hxx:130
@ UPDATE_FORM_FIELD
@ INSERT_PAGE_NUMBER
@ INSERT_FORM_FIELD
@ UPDATE_FORM_FIELDS
@ DELETE_FORM_FIELDS
IMPL_LINK(SwTextShell, RedlineNextHdl, AbstractSvxPostItDialog &, rDlg, void)
Definition: textfld.cxx:1448
static OUString lcl_BuildTitleWithRedline(const SwRangeRedline *pRedline)
Definition: textfld.cxx:74
OUString aCommand
sal_uInt16 sal_Unicode
OUString GetAppLangDateTimeString(const DateTime &)
Definition: uitool.cxx:862
RET_OK
NF_DATE_SYSTEM_LONG