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
70
71using namespace nsSwDocInfoSubType;
72
73static OUString lcl_BuildTitleWithRedline( const SwRangeRedline *pRedline )
74{
75 const OUString sTitle(SwResId(STR_REDLINE_COMMENT));
76
77 TranslateId pResId;
78 switch( pRedline->GetType() )
79 {
80 case RedlineType::Insert:
81 pResId = STR_REDLINE_INSERTED;
82 break;
83 case RedlineType::Delete:
84 pResId = STR_REDLINE_DELETED;
85 break;
86 case RedlineType::Format:
87 case RedlineType::ParagraphFormat:
88 pResId = STR_REDLINE_FORMATTED;
89 break;
90 case RedlineType::Table:
91 pResId = STR_REDLINE_TABLECHG;
92 break;
93 case RedlineType::FmtColl:
94 pResId = STR_REDLINE_FMTCOLLSET;
95 break;
96 default:
97 return sTitle;
98 }
99
100 return sTitle + SwResId(pResId);
101}
102
104{
105 SwWrtShell& rSh = GetShell();
106 const SfxPoolItem* pItem = nullptr;
107
108 sal_uInt16 nSlot = rReq.GetSlot();
109 const SfxItemSet* pArgs = rReq.GetArgs();
110 if(pArgs)
111 pArgs->GetItemState(GetPool().GetWhich(nSlot), false, &pItem);
112
113 bool bMore = false;
114 bool bIsText = true;
116 sal_uInt16 nInsertSubType = 0;
117 sal_uInt32 nInsertFormat = 0;
118
119 switch(nSlot)
120 {
121 case FN_EDIT_FIELD:
122 {
123 SwField* pField = rSh.GetCurField(true);
124 if( pField )
125 {
126 switch ( pField->GetTypeId() )
127 {
129 {
130 ::sfx2::SvBaseLink& rLink = static_cast<SwDDEFieldType*>(pField->GetTyp())->
131 GetBaseLink();
132 if(rLink.IsVisible())
133 {
135 ScopedVclPtr<SfxAbstractLinksDialog> pDlg(pFact->CreateLinksDialog(GetView().GetFrameWeld(), &rSh.GetLinkManager(), false, &rLink));
136 pDlg->Execute();
137 }
138 break;
139 }
140 default:
141 {
144 pDlg->Execute();
145 }
146 }
147 }
148 break;
149 }
151 {
152 SwField* pField = rSh.GetCurField();
153 if(pField && pField->GetTyp()->Which() == SwFieldIds::Macro)
154 {
155
156 const OUString& rMacro = static_cast<SwMacroField*>(pField)->GetMacro();
157 sal_Int32 nPos = rMacro.indexOf('.');
158 if(nPos != -1)
159 {
160 SvxMacro aMacro( rMacro.copy(nPos + 1), rMacro.copy(0,nPos), STARBASIC );
161 rSh.ExecMacro(aMacro);
162 }
163 }
164 }
165 break;
166
169 {
170 bool bRet = false;
171 SwFieldType* pField = rSh.GetFieldType( 0, SwFieldIds::Input );
172 const bool bAddSetExpressionFields = !( rSh.GetViewOptions()->IsReadonly() );
173 if ( pField != nullptr
174 && rSh.MoveFieldType(
175 pField,
176 FN_GOTO_NEXT_INPUTFLD == nSlot,
178 bAddSetExpressionFields ) )
179 {
180 rSh.ClearMark();
181 if (!rSh.IsMultiSelection()
182 && (nullptr != dynamic_cast<const SwTextInputField*>(
184 {
185 rSh.SttSelect();
186 rSh.SelectTextModel(
189 }
190 else
191 {
192 rSh.StartInputFieldDlg(rSh.GetCurField(true), false, false, GetView().GetFrameWeld());
193 }
194 bRet = true;
195 }
196
197 rReq.SetReturnValue( SfxBoolItem( nSlot, bRet ));
198 }
199 break;
200
201 default:
202 bMore = true;
203 }
204 if(!bMore)
205 return;
206
207 // Here come the slots with FieldMgr.
208 SwFieldMgr aFieldMgr(GetShellPtr());
209 switch(nSlot)
210 {
212 {
213 bool bRes = false;
214 if( pItem )
215 {
216 sal_uInt32 nFormat = 0;
218 OUString aPar1 = static_cast<const SfxStringItem *>(pItem)->GetValue();
219 OUString aPar2;
220 sal_Int32 nCommand = 0;
221
222 if( const SfxUInt16Item* pFieldItem = pArgs->GetItemIfSet( FN_PARAM_FIELD_TYPE,
223 false ))
224 nType = static_cast<SwFieldTypesEnum>(pFieldItem->GetValue());
225 aPar1 += OUStringChar(DB_DELIM);
226 if( SfxItemState::SET == pArgs->GetItemState(
227 FN_PARAM_1, false, &pItem ))
228 {
229 aPar1 += static_cast<const SfxStringItem *>(pItem)->GetValue();
230 }
231 if( SfxItemState::SET == pArgs->GetItemState(
232 FN_PARAM_3, false, &pItem ))
233 nCommand = static_cast<const SfxInt32Item*>(pItem)->GetValue();
234 aPar1 += OUStringChar(DB_DELIM)
235 + OUString::number(nCommand)
236 + OUStringChar(DB_DELIM);
237 if( SfxItemState::SET == pArgs->GetItemState(
238 FN_PARAM_2, false, &pItem ))
239 {
240 aPar1 += static_cast<const SfxStringItem *>(pItem)->GetValue();
241 }
242 if( const SfxStringItem* pContentItem = pArgs->GetItemIfSet(
243 FN_PARAM_FIELD_CONTENT, false ))
244 aPar2 = pContentItem->GetValue();
245 if( const SfxUInt32Item* pFormatItem = pArgs->GetItemIfSet(
246 FN_PARAM_FIELD_FORMAT, false ))
247 nFormat = pFormatItem->GetValue();
248 OSL_FAIL("Command is not yet used");
249 SwInsertField_Data aData(nType, 0, aPar1, aPar2, nFormat, GetShellPtr(), ' '/*separator*/ );
250 bRes = aFieldMgr.InsertField(aData);
251 }
252 rReq.SetReturnValue(SfxBoolItem( nSlot, bRes ));
253 }
254 break;
256 case FN_INSERT_FIELD:
257 {
258 bool bRes = false;
259 if( pItem && nSlot != FN_INSERT_FIELD_CTRL)
260 {
261 sal_uInt32 nFormat = 0;
263 sal_uInt16 nSubType = 0;
264 OUString aPar1 = static_cast<const SfxStringItem *>(pItem)->GetValue();
265 OUString aPar2;
266 sal_Unicode cSeparator = ' ';
267
268 if( const SfxUInt16Item* pTypeItem = pArgs->GetItemIfSet( FN_PARAM_FIELD_TYPE,
269 false ))
270 nType = static_cast<SwFieldTypesEnum>(pTypeItem->GetValue());
271 if( const SfxUInt16Item* pSubtypeItem = pArgs->GetItemIfSet( FN_PARAM_FIELD_SUBTYPE,
272 false ))
273 nSubType = pSubtypeItem->GetValue();
274 if( const SfxStringItem* pContentItem = pArgs->GetItemIfSet(
275 FN_PARAM_FIELD_CONTENT, false ))
276 aPar2 = pContentItem->GetValue();
277 if( const SfxUInt32Item* pFormatItem = pArgs->GetItemIfSet(
278 FN_PARAM_FIELD_FORMAT, false ))
279 nFormat = pFormatItem->GetValue();
280 if( SfxItemState::SET == pArgs->GetItemState(
281 FN_PARAM_3, false, &pItem ))
282 {
283 OUString sTmp = static_cast<const SfxStringItem *>(pItem)->GetValue();
284 if(!sTmp.isEmpty())
285 cSeparator = sTmp[0];
286 }
287 SwInsertField_Data aData(nType, nSubType, aPar1, aPar2, nFormat, GetShellPtr(), cSeparator );
288 bRes = aFieldMgr.InsertField( aData );
289 }
290 else
291 {
292 //#i5788# prevent closing of the field dialog while a modal dialog ( Input field dialog ) is active
293 if(!GetView().GetViewFrame()->IsInModalMode())
294 {
295 SfxViewFrame* pVFrame = GetView().GetViewFrame();
297 bRes = pVFrame->GetChildWindow( nSlot ) != nullptr;
298 Invalidate(rReq.GetSlot());
300 rReq.Ignore();
301 }
302 }
303 rReq.SetReturnValue(SfxBoolItem( nSlot, bRes ));
304 }
305 break;
306
308 {
309 SfxViewFrame* pVFrame = GetView().GetViewFrame();
310 if (!pVFrame->HasChildWindow(FN_INSERT_FIELD))
311 pVFrame->ToggleChildWindow(FN_INSERT_FIELD); // Show dialog
312
313 // Switch Fielddlg at a new TabPage
314 sal_uInt16 nId = SwFieldDlgWrapper::GetChildWindowId();
315 SwFieldDlgWrapper *pWrp = static_cast<SwFieldDlgWrapper*>(pVFrame->GetChildWindow(nId));
316 if (pWrp)
317 pWrp->ShowReferencePage();
318 rReq.Ignore();
319 }
320 break;
322 {
323 const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID);
324 if (pIdItem && !pIdItem->GetValue().isEmpty() && GetView().GetPostItMgr())
325 {
326 GetView().GetPostItMgr()->Delete(pIdItem->GetValue().toUInt32());
327 }
328 else if ( GetView().GetPostItMgr() &&
329 GetView().GetPostItMgr()->HasActiveSidebarWin() )
330 {
332 }
333 break;
334 }
336 {
337 const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID);
338 if (pIdItem && !pIdItem->GetValue().isEmpty() && GetView().GetPostItMgr())
339 {
340 GetView().GetPostItMgr()->DeleteCommentThread(pIdItem->GetValue().toUInt32());
341 }
342 else if ( GetView().GetPostItMgr() &&
343 GetView().GetPostItMgr()->HasActiveSidebarWin() )
344 {
346 }
347 break;
348 }
349 case FN_RESOLVE_NOTE:
350 {
351 const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID);
352 if (pIdItem && !pIdItem->GetValue().isEmpty() && GetView().GetPostItMgr())
353 {
354 GetView().GetPostItMgr()->ToggleResolved(pIdItem->GetValue().toUInt32());
355 }
356 break;
357 }
359 {
360 const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID);
361 if (pIdItem && !pIdItem->GetValue().isEmpty() && GetView().GetPostItMgr())
362 {
363 GetView().GetPostItMgr()->ToggleResolvedForThread(pIdItem->GetValue().toUInt32());
364 }
365 break;
366 }
368 if ( GetView().GetPostItMgr() )
370 break;
372 {
373 SwPostItMgr* pPostItMgr = GetView().GetPostItMgr();
374 if (pPostItMgr)
375 pPostItMgr->ExecuteFormatAllDialog(GetView());
376 }
377 break;
379 {
380 const SfxStringItem* pNoteItem = rReq.GetArg<SfxStringItem>(nSlot);
381 if ( pNoteItem && GetView().GetPostItMgr() )
382 GetView().GetPostItMgr()->Delete( pNoteItem->GetValue() );
383 }
384 break;
385 case FN_HIDE_NOTE:
386 if ( GetView().GetPostItMgr() &&
388 {
390 }
391 break;
393 if ( GetView().GetPostItMgr() )
395 break;
397 {
398 const SfxStringItem* pNoteItem = rReq.GetArg<SfxStringItem>(nSlot);
399 if ( pNoteItem && GetView().GetPostItMgr() )
400 GetView().GetPostItMgr()->Hide( pNoteItem->GetValue() );
401 }
402 break;
403 case FN_REPLY:
404 {
405 const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID);
406 if (pIdItem && !pIdItem->GetValue().isEmpty())
407 {
408 SwFieldType* pType = rSh.GetDoc()->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::Postit, OUString(), false);
409 if(pType->FindFormatForPostItId(pIdItem->GetValue().toUInt32()))
410 {
411 auto pMgr = GetView().GetPostItMgr();
412 auto pWin = pMgr->GetAnnotationWin(pIdItem->GetValue().toUInt32());
413 if(pWin)
414 {
415 OUString sText;
416 if(const auto pTextItem = rReq.GetArg<SvxPostItTextItem>(SID_ATTR_POSTIT_TEXT))
417 sText = pTextItem->GetValue();
418 pMgr->RegisterAnswerText(sText);
419 pWin->ExecuteCommand(nSlot);
420 }
421 }
422 }
423 }
424 break;
425 case FN_POSTIT:
426 {
427 rSh.InsertPostIt(aFieldMgr, rReq);
428 }
429 break;
430 case SID_EDIT_POSTIT:
431 {
432 const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID);
433 if (pIdItem && !pIdItem->GetValue().isEmpty())
434 {
435 const SvxPostItTextItem* pTextItem = rReq.GetArg<SvxPostItTextItem>(SID_ATTR_POSTIT_TEXT);
436 OUString sText;
437 if ( pTextItem )
438 sText = pTextItem->GetValue();
439
440 sw::annotation::SwAnnotationWin* pAnnotationWin = GetView().GetPostItMgr()->GetAnnotationWin(pIdItem->GetValue().toUInt32());
441 if (pAnnotationWin)
442 {
443 pAnnotationWin->UpdateText(sText);
444
445 // explicit state update to get the Undo state right
446 GetView().AttrChangedNotify(nullptr);
447 }
448 }
449 }
450 break;
452 {
453 /* this code can be used once we want redline comments in the margin, all other stuff can
454 then be deleted
455 String sComment;
456 const SwRangeRedline *pRedline = rSh.GetCurrRedline();
457
458 if (pRedline)
459 {
460 sComment = pRedline->GetComment();
461 if ( !sComment.Len() )
462 GetView().GetDocShell()->Broadcast(SwRedlineHint(pRedline,SWREDLINE_INSERTED));
463 const_cast<SwRangeRedline*>(pRedline)->Broadcast(SwRedlineHint(pRedline,SWREDLINE_FOCUS,&GetView()));
464 }
465 */
466
467 const SwRangeRedline *pRedline = rSh.GetCurrRedline();
468 SwDoc *pDoc = rSh.GetDoc();
469 // If index is specified, goto and select the appropriate redline
470 if (pArgs && pArgs->GetItemState(nSlot, false, &pItem) == SfxItemState::SET)
471 {
472 const sal_uInt32 nChangeId = static_cast<const SfxUInt32Item*>(pItem)->GetValue();
473 const SwRedlineTable& rRedlineTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
474 for (SwRedlineTable::size_type nRedline = 0; nRedline < rRedlineTable.size(); ++nRedline)
475 {
476 if (nChangeId == rRedlineTable[nRedline]->GetId())
477 pRedline = rSh.GotoRedline(nRedline, true);
478 }
479 }
480
481 OUString sCommentText;
482 const SfxStringItem* pTextItem = rReq.GetArg<SvxPostItTextItem>(SID_ATTR_POSTIT_TEXT);
483 if (pTextItem)
484 sCommentText = pTextItem->GetValue();
485
486 if (pRedline)
487 {
488 // In case of LOK and comment text is already provided, skip
489 // dialog creation and just change the redline comment directly
490 if (comphelper::LibreOfficeKit::isActive() && !sCommentText.isEmpty())
491 {
492 rSh.SetRedlineComment(sCommentText);
493 GetView().AttrChangedNotify(nullptr);
494 MaybeNotifyRedlineModification(const_cast<SwRangeRedline&>(*pRedline), pRedline->GetDoc());
495 break;
496 }
497
498 OUString sComment = convertLineEnd(pRedline->GetComment(), GetSystemLineEnd());
499
500 bool bTravel = false;
501
503 ::DialogGetRanges fnGetRange = pFact->GetDialogGetRangesFunc();
504 SfxItemSet aSet(GetPool(), fnGetRange());
505 aSet.Put(SvxPostItTextItem(sComment, SID_ATTR_POSTIT_TEXT));
506 aSet.Put(SvxPostItAuthorItem(pRedline->GetAuthorString(), SID_ATTR_POSTIT_AUTHOR));
507
509 pRedline->GetRedlineData().GetTimeStamp() ),
510 SID_ATTR_POSTIT_DATE ));
511
512 // Traveling only if more than one field.
513 rSh.StartAction();
514
515 rSh.Push();
516 const SwRangeRedline *pActRed = rSh.SelPrevRedline();
517
518 if (pActRed == pRedline)
519 { // New cursor is at the beginning of the current redlines.
520 rSh.Pop(); // Throw old cursor away
521 rSh.Push();
522 pActRed = rSh.SelPrevRedline();
523 }
524
525 bool bPrev = pActRed != nullptr;
527 rSh.EndAction();
528
529 rSh.ClearMark();
530 // Select current redline.
531 pActRed = rSh.SelNextRedline();
532 if (pActRed != pRedline)
533 rSh.SelPrevRedline();
534
535 rSh.StartAction();
536 rSh.Push();
537 pActRed = rSh.SelNextRedline();
538 bool bNext = pActRed != nullptr;
539 rSh.Pop(SwCursorShell::PopMode::DeleteCurrent); // Restore cursor position
540
541 if( rSh.IsCursorPtAtEnd() )
542 rSh.SwapPam();
543
544 rSh.EndAction();
545
546 bTravel |= bNext || bPrev;
547
550 pDlg->HideAuthor();
551
552 pDlg->SetText(lcl_BuildTitleWithRedline(pRedline));
553
554 if (bTravel)
555 {
556 pDlg->EnableTravel(bNext, bPrev);
557 pDlg->SetPrevHdl(LINK(this, SwTextShell, RedlinePrevHdl));
558 pDlg->SetNextHdl(LINK(this, SwTextShell, RedlineNextHdl));
559 }
560
561 SwViewShell::SetCareDialog(pDlg->GetDialog());
562 g_bNoInterrupt = true;
563
564 if ( pDlg->Execute() == RET_OK )
565 {
566 const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
567 OUString sMsg(pOutSet->Get(SID_ATTR_POSTIT_TEXT).GetValue());
568
569 // Insert or change a comment
570 rSh.SetRedlineComment(sMsg);
571 }
572
574 pDlg.disposeAndClear();
575 g_bNoInterrupt = false;
576 rSh.ClearMark();
577 GetView().AttrChangedNotify(nullptr);
578 }
579 }
580 break;
581
582 case FN_JAVAEDIT:
583 {
584 OUString aType, aText;
585 bool bIsUrl=false;
586 bool bNew=false;
587 bool bUpdate = false;
588 SwFieldMgr aMgr;
589 if ( pItem )
590 {
591 aText = static_cast<const SfxStringItem*>(pItem)->GetValue();
592 const SfxStringItem* pType = rReq.GetArg<SfxStringItem>(FN_PARAM_2);
593 const SfxBoolItem* pIsUrl = rReq.GetArg<SfxBoolItem>(FN_PARAM_1);
594 if ( pType )
595 aType = pType->GetValue();
596 if ( pIsUrl )
597 bIsUrl = pIsUrl->GetValue();
598
599 SwScriptField* pField = static_cast<SwScriptField*>(aMgr.GetCurField());
600 bNew = !pField || (pField->GetTyp()->Which() != SwFieldIds::Script);
601 bUpdate = pField && ( bIsUrl != static_cast<bool>(pField->GetFormat()) || pField->GetPar2() != aType || pField->GetPar1() != aText );
602 }
603 else
604 {
607 if ( pDlg->Execute() )
608 {
609 aType = pDlg->GetScriptType();
610 aText = pDlg->GetScriptText();
611 bIsUrl = pDlg->IsUrl();
612 bNew = pDlg->IsNew();
613 bUpdate = pDlg->IsUpdate();
614 rReq.AppendItem( SfxStringItem( FN_JAVAEDIT, aText ) );
615 rReq.AppendItem( SfxStringItem( FN_PARAM_2, aType ) );
616 rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bIsUrl ) );
617 }
618 }
619
620 if( bNew )
621 {
622 SwInsertField_Data aData(SwFieldTypesEnum::Script, 0, aType, aText, bIsUrl ? 1 : 0);
623 aMgr.InsertField(aData);
624 rReq.Done();
625 }
626 else if( bUpdate )
627 {
628 aMgr.UpdateCurField( bIsUrl ? 1 : 0, aType, aText );
630 rReq.Done();
631 }
632 else
633 rReq.Ignore();
634 }
635 break;
636
637 case FN_INSERT_FLD_DATE :
638 {
639 nInsertType = SwFieldTypesEnum::Date;
640 bIsText = false;
641 // use long date format for Hungarian
642 SwPaM* pCursorPos = rSh.GetCursor();
643 if( pCursorPos )
644 {
645 LanguageType nLang = pCursorPos->GetPoint()->GetNode().GetTextNode()->GetLang(pCursorPos->GetPoint()->GetContentIndex());
648 }
649 goto FIELD_INSERT;
650 }
651 case FN_INSERT_FLD_TIME :
652 nInsertType = SwFieldTypesEnum::Time;
653 bIsText = false;
654 goto FIELD_INSERT;
656 nInsertType = SwFieldTypesEnum::PageNumber;
657 nInsertFormat = SVX_NUM_PAGEDESC; // Like page template
658 bIsText = false;
659 goto FIELD_INSERT;
662 nInsertSubType = 0;
663 bIsText = false;
664 nInsertFormat = SVX_NUM_PAGEDESC;
665 goto FIELD_INSERT;
667 nInsertType = SwFieldTypesEnum::DocumentInfo;
668 nInsertSubType = DI_SUBJECT;
669 goto FIELD_INSERT;
671 nInsertType = SwFieldTypesEnum::DocumentInfo;
672 nInsertSubType = DI_TITLE;
673 goto FIELD_INSERT;
675 nInsertType = SwFieldTypesEnum::DocumentInfo;
676 nInsertSubType = DI_CREATE|DI_SUB_AUTHOR;
677
678FIELD_INSERT:
679 {
680 //format conversion should only be done for number formatter formats
681 if(!nInsertFormat)
682 nInsertFormat = aFieldMgr.GetDefaultFormat(nInsertType, bIsText, rSh.GetNumberFormatter());
683 SwInsertField_Data aData(nInsertType, nInsertSubType,
684 OUString(), OUString(), nInsertFormat);
685 aFieldMgr.InsertField(aData);
686 rReq.Done();
687 }
688 break;
689
691 {
692 OUString aFieldType(ODF_FORMTEXT);
693 const SfxStringItem* pFieldType = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
694 if (pFieldType)
695 {
696 // Allow overwriting the default type.
697 aFieldType = pFieldType->GetValue();
698 }
699
700 OUString aFieldCode;
701 const SfxStringItem* pFieldCode = rReq.GetArg<SfxStringItem>(FN_PARAM_2);
702 if (pFieldCode)
703 {
704 // Allow specifying a field code/command.
705 aFieldCode = pFieldCode->GetValue();
706 }
707
708 rSh.GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::INSERT_FORM_FIELD, nullptr);
709 // Don't update the layout after inserting content and before deleting temporary
710 // text nodes.
711 rSh.StartAction();
712
713 SwPaM* pCursorPos = rSh.GetCursor();
714 if(pCursorPos)
715 {
716 // Insert five En Space into the text field so the field has extent
717 static constexpr OUStringLiteral vEnSpaces = u"\u2002\u2002\u2002\u2002\u2002";
718 OUString aFieldResult(vEnSpaces);
719 const SfxStringItem* pFieldResult = rReq.GetArg<SfxStringItem>(FN_PARAM_3);
720 if (pFieldResult)
721 {
722 // Allow specifying a field result / expanded value.
723 aFieldResult = pFieldResult->GetValue();
724 }
725
726 // Split node to remember where the start position is.
727 bool bSuccess = rSh.GetDoc()->getIDocumentContentOperations().SplitNode(
728 *pCursorPos->GetPoint(), false);
729 if(bSuccess)
730 {
731 SwPaM aFieldPam(*pCursorPos->GetPoint());
732 aFieldPam.Move(fnMoveBackward, GoInContent);
733 if (pFieldResult)
734 {
735 // Paste HTML content.
736 SwTranslateHelper::PasteHTMLToPaM(rSh, pCursorPos, aFieldResult.toUtf8(),
737 true);
738 if (pCursorPos->GetPoint()->GetContentIndex() == 0)
739 {
740 // The paste created a last empty text node, remove it.
741 SwPaM aPam(*pCursorPos->GetPoint());
742 aPam.SetMark();
745 }
746 }
747 else
748 {
749 // Insert default placeholder.
751 aFieldResult);
752 }
753 // Undo the above SplitNode().
754 aFieldPam.SetMark();
755 aFieldPam.Move(fnMoveForward, GoInContent);
757 *aFieldPam.GetMark() = *pCursorPos->GetPoint();
758
759 IDocumentMarkAccess* pMarksAccess = rSh.GetDoc()->getIDocumentMarkAccess();
760 sw::mark::IFieldmark* pFieldmark = pMarksAccess->makeFieldBookmark(
761 aFieldPam, OUString(), aFieldType, aFieldPam.Start());
762 if (pFieldmark && !aFieldCode.isEmpty())
763 {
764 pFieldmark->GetParameters()->insert(
765 std::pair<OUString, uno::Any>(ODF_CODE_PARAM, uno::Any(aFieldCode)));
766 }
767 }
768 }
769
770 rSh.EndAction();
772 rSh.GetView().GetViewFrame()->GetBindings().Invalidate( SID_UNDO );
773 }
774 break;
776 {
777 rSh.GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::INSERT_FORM_FIELD, nullptr);
778
779 SwPaM* pCursorPos = rSh.GetCursor();
780 if(pCursorPos)
781 {
782 IDocumentMarkAccess* pMarksAccess = rSh.GetDoc()->getIDocumentMarkAccess();
783 pMarksAccess->makeNoTextFieldBookmark(*pCursorPos, OUString(), ODF_FORMCHECKBOX);
784 }
785
787 rSh.GetView().GetViewFrame()->GetBindings().Invalidate( SID_UNDO );
788 }
789 break;
791 {
792 rSh.GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::INSERT_FORM_FIELD, nullptr);
793
794 SwPaM* pCursorPos = rSh.GetCursor();
795 if(pCursorPos)
796 {
797 IDocumentMarkAccess* pMarksAccess = rSh.GetDoc()->getIDocumentMarkAccess();
798 pMarksAccess->makeNoTextFieldBookmark(*pCursorPos, OUString(), ODF_FORMDROPDOWN);
799 }
800
802 rSh.GetView().GetViewFrame()->GetBindings().Invalidate( SID_UNDO );
803 }
804 break;
806 {
807 rSh.GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::INSERT_FORM_FIELD, nullptr);
808
809 SwPaM* pCursorPos = rSh.GetCursor();
810 if(pCursorPos)
811 {
812 // Insert five enspaces into the text field so the field has extent
813 sal_Unicode vEnSpaces[ODF_FORMFIELD_DEFAULT_LENGTH] = {8194, 8194, 8194, 8194, 8194};
814 bool bSuccess = rSh.GetDoc()->getIDocumentContentOperations().InsertString(*pCursorPos, OUString(vEnSpaces, ODF_FORMFIELD_DEFAULT_LENGTH));
815 if(bSuccess)
816 {
817 IDocumentMarkAccess* pMarksAccess = rSh.GetDoc()->getIDocumentMarkAccess();
818 SwPaM aFieldPam(pCursorPos->GetPoint()->GetNode(), pCursorPos->GetPoint()->GetContentIndex() - ODF_FORMFIELD_DEFAULT_LENGTH,
819 pCursorPos->GetPoint()->GetNode(), pCursorPos->GetPoint()->GetContentIndex());
820 sw::mark::IFieldmark* pFieldBM = pMarksAccess->makeFieldBookmark(aFieldPam, OUString(), ODF_FORMDATE,
821 aFieldPam.Start());
822
823 // Use a default date format and language
824 sw::mark::IFieldmark::parameter_map_t* pParameters = pFieldBM->GetParameters();
825 SvNumberFormatter* pFormatter = rSh.GetDoc()->GetNumberFormatter();
826 sal_uInt32 nStandardFormat = pFormatter->GetStandardFormat(SvNumFormatType::DATE);
827 const SvNumberformat* pFormat = pFormatter->GetEntry(nStandardFormat);
828
829 (*pParameters)[ODF_FORMDATE_DATEFORMAT] <<= pFormat->GetFormatstring();
830 (*pParameters)[ODF_FORMDATE_DATEFORMAT_LANGUAGE] <<= LanguageTag(pFormat->GetLanguage()).getBcp47();
831 }
832 }
833
835 rSh.GetView().GetViewFrame()->GetBindings().Invalidate( SID_UNDO );
836 }
837 break;
839 {
840 OUString aFieldType;
841 const SfxStringItem* pFieldType = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
842 if (pFieldType)
843 {
844 aFieldType = pFieldType->GetValue();
845 }
846 OUString aFieldCommandPrefix;
847 const SfxStringItem* pFieldCommandPrefix = rReq.GetArg<SfxStringItem>(FN_PARAM_2);
848 if (pFieldCommandPrefix)
849 {
850 aFieldCommandPrefix = pFieldCommandPrefix->GetValue();
851 }
852 uno::Sequence<beans::PropertyValues> aFields;
853 const SfxUnoAnyItem* pFields = rReq.GetArg<SfxUnoAnyItem>(FN_PARAM_3);
854 if (pFields)
855 {
856 pFields->GetValue() >>= aFields;
857 }
858
859 rSh.GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::INSERT_FORM_FIELD, nullptr);
860 rSh.StartAction();
861
862 IDocumentMarkAccess* pMarkAccess = rSh.GetDoc()->getIDocumentMarkAccess();
863 sal_Int32 nFieldIndex = 0;
864 for (auto it = pMarkAccess->getFieldmarksBegin(); it != pMarkAccess->getFieldmarksEnd(); ++it)
865 {
866 auto pFieldmark = dynamic_cast<sw::mark::IFieldmark*>(*it);
867 assert(pFieldmark);
868 if (pFieldmark->GetFieldname() != aFieldType)
869 {
870 continue;
871 }
872
873 auto itParam = pFieldmark->GetParameters()->find(ODF_CODE_PARAM);
874 if (itParam == pFieldmark->GetParameters()->end())
875 {
876 continue;
877 }
878
879 OUString aCommand;
880 itParam->second >>= aCommand;
881 if (!aCommand.startsWith(aFieldCommandPrefix))
882 {
883 continue;
884 }
885
886 if (aFields.getLength() <= nFieldIndex)
887 {
888 continue;
889 }
890
891 comphelper::SequenceAsHashMap aMap(aFields[nFieldIndex++]);
892 itParam->second = aMap["FieldCommand"];
893 SwPaM aPaM(pFieldmark->GetMarkPos(), pFieldmark->GetOtherMarkPos());
894 aPaM.Normalize();
895 // Skip field start & separator.
896 aPaM.GetPoint()->AdjustContent(2);
897 // Skip field end.
898 aPaM.GetMark()->AdjustContent(-1);
900 OUString aFieldResult;
901 aMap["FieldResult"] >>= aFieldResult;
902 SwTranslateHelper::PasteHTMLToPaM(rSh, &aPaM, aFieldResult.toUtf8(), true);
903 }
904
905 rSh.EndAction();
907 }
908 break;
909 default:
910 OSL_FAIL("wrong dispatcher");
911 return;
912 }
913}
914
916{
917 SwWrtShell& rSh = GetShell();
918 SfxWhichIter aIter( rSet );
919 const SwField* pField = nullptr;
920 bool bGetField = false;
921 sal_uInt16 nWhich = aIter.FirstWhich();
922
923 while (nWhich)
924 {
925 switch (nWhich)
926 {
931 case FN_HIDE_NOTE:
934 {
935 SwPostItMgr* pPostItMgr = GetView().GetPostItMgr();
936 if ( !pPostItMgr )
937 rSet.InvalidateItem( nWhich );
938 else if ( !pPostItMgr->HasActiveSidebarWin() )
939 {
942 }
943 // tdf#137568 do not offer comment formatting, if no comments are present
944 if (!pPostItMgr || !pPostItMgr->HasNotes())
946 }
947 break;
948
949 case FN_EDIT_FIELD:
950 {
951 if( !bGetField )
952 {
953 pField = rSh.GetCurField(true);
954 bGetField = true;
955 }
956
957 SwFieldIds nTempWhich = pField ? pField->GetTyp()->Which() : SwFieldIds::Unknown;
958 if( SwFieldIds::Unknown == nTempWhich ||
959 SwFieldIds::Postit == nTempWhich ||
960 SwFieldIds::Script == nTempWhich ||
961 SwFieldIds::TableOfAuthorities == nTempWhich )
962 rSet.DisableItem( nWhich );
963 else if( SwFieldIds::Dde == nTempWhich &&
964 !static_cast<SwDDEFieldType*>(pField->GetTyp())->GetBaseLink().IsVisible())
965 {
966 // nested links cannot be edited
967 rSet.DisableItem( nWhich );
968 }
969 }
970 break;
971
973 {
974 if(!bGetField)
975 {
976 pField = rSh.GetCurField();
977 bGetField = true;
978 }
979 if(!pField || pField->GetTyp()->Which() != SwFieldIds::Macro)
980 rSet.DisableItem(nWhich);
981 }
982 break;
983
984 case FN_INSERT_FIELD:
985 {
986 if ( rSh.CursorInsideInputField() )
987 {
988 rSet.DisableItem(nWhich);
989 }
990 else
991 {
992 SfxViewFrame* pVFrame = GetView().GetViewFrame();
993 //#i5788# prevent closing of the field dialog while a modal dialog ( Input field dialog ) is active
994 if(!pVFrame->IsInModalMode() &&
997 else
999 }
1000 }
1001 break;
1002
1004 {
1005 SfxViewFrame* pVFrame = GetView().GetViewFrame();
1006 if ( !pVFrame->KnowsChildWindow(FN_INSERT_FIELD)
1007 || rSh.CursorInsideInputField() )
1008 {
1010 }
1011 }
1012 break;
1013
1015 if ( rSh.CursorInsideInputField() )
1016 {
1017 rSet.DisableItem(nWhich);
1018 }
1019 else
1020 {
1021 rSet.Put(SfxBoolItem( nWhich, GetView().GetViewFrame()->HasChildWindow(FN_INSERT_FIELD)));
1022 }
1023 break;
1024
1025 case FN_REDLINE_COMMENT:
1027 rSet.DisableItem(nWhich);
1028 break;
1029
1030 case FN_REPLY:
1032 rSet.DisableItem(nWhich);
1033 break;
1034
1035 case FN_POSTIT :
1036 case FN_JAVAEDIT :
1037 {
1038 bool bCurField = false;
1039 pField = rSh.GetCurField();
1040 if(nWhich == FN_POSTIT)
1041 bCurField = pField && pField->GetTyp()->Which() == SwFieldIds::Postit;
1042 else
1043 bCurField = pField && pField->GetTyp()->Which() == SwFieldIds::Script;
1044
1045 if( !bCurField && rSh.IsReadOnlyAvailable() && rSh.HasReadonlySel() )
1046 {
1047 rSet.DisableItem(nWhich);
1048 }
1049 else if ( rSh.CursorInsideInputField() )
1050 {
1051 rSet.DisableItem(nWhich);
1052 }
1053 // tdf#86188, tdf#135794: Allow disabling comment insertion
1054 // on footnote/endnote/header/frames for better OOXML interoperability
1056 (rSh.IsCursorInFootnote() || rSh.IsInHeaderFooter() ||
1057 rSh.GetCurrFlyFrame(/*bCalcFrame=*/false)))
1058 {
1059 rSet.DisableItem(nWhich);
1060 }
1061 }
1062
1063 break;
1064
1066 case FN_INSERT_FLD_DATE:
1069 case FN_INSERT_FLD_TIME:
1072 case FN_INSERT_DBFIELD:
1073 if ( rSh.CursorInsideInputField() )
1074 {
1075 rSet.DisableItem(nWhich);
1076 }
1077 break;
1078
1083 if ( rSh.CursorInsideInputField() )
1084 {
1085 rSet.DisableItem(nWhich);
1086 }
1087 else
1088 {
1089 // Check whether we are in a text form field
1090 SwPosition aCursorPos(*rSh.GetCursor()->GetPoint());
1091 sw::mark::IFieldmark* pFieldBM = GetShell().getIDocumentMarkAccess()->getFieldmarkFor(aCursorPos);
1092 if ((!pFieldBM || pFieldBM->GetFieldname() != ODF_FORMTEXT)
1093 && aCursorPos.GetContentIndex() > 0)
1094 {
1095 SwPosition aPos(*aCursorPos.GetContentNode(), aCursorPos.GetContentIndex() - 1);
1096 pFieldBM = GetShell().getIDocumentMarkAccess()->getFieldmarkFor(aPos);
1097 }
1098 if (pFieldBM && pFieldBM->GetFieldname() == ODF_FORMTEXT &&
1099 (aCursorPos > pFieldBM->GetMarkStart() && aCursorPos < pFieldBM->GetMarkEnd() ))
1100 {
1101 rSet.DisableItem(nWhich);
1102 }
1103 }
1104 break;
1105
1106 }
1107 nWhich = aIter.NextWhich();
1108 }
1109}
1110
1112{
1113 const OUString& rName = rHlnkItem.GetName();
1114 const OUString& rURL = rHlnkItem.GetURL();
1115 const OUString& rTarget = rHlnkItem.GetTargetFrame();
1116 const OUString& rReplacementText = rHlnkItem.GetReplacementText();
1117 sal_uInt16 nType = o3tl::narrowing<sal_uInt16>(rHlnkItem.GetInsertMode());
1118 nType &= ~HLINK_HTMLMODE;
1119 const SvxMacroTableDtor* pMacroTable = rHlnkItem.GetMacroTable();
1120
1121 SwWrtShell& rSh = GetShell();
1122
1123 if( !(rSh.GetSelectionType() & SelectionType::Text) )
1124 return;
1125
1126 rSh.StartAction();
1128 rSh.GetCurAttr( aSet );
1129
1130 if(SfxItemState::SET == aSet.GetItemState(RES_TXTATR_INETFMT, false))
1131 {
1132 // Select links
1133 rSh.SwCursorShell::SelectTextAttr(RES_TXTATR_INETFMT, false);
1134 }
1135 switch (nType)
1136 {
1137 case HLINK_DEFAULT:
1138 case HLINK_FIELD:
1139 {
1140 SwFormatINetFormat aINetFormat( rURL, rTarget );
1141 aINetFormat.SetName(rHlnkItem.GetIntName());
1142 if(pMacroTable)
1143 {
1144 const SvxMacro *pMacro = pMacroTable->Get( SvMacroItemId::OnMouseOver );
1145 if( pMacro )
1146 aINetFormat.SetMacro(SvMacroItemId::OnMouseOver, *pMacro);
1147 pMacro = pMacroTable->Get( SvMacroItemId::OnClick );
1148 if( pMacro )
1149 aINetFormat.SetMacro(SvMacroItemId::OnClick, *pMacro);
1150 pMacro = pMacroTable->Get( SvMacroItemId::OnMouseOut );
1151 if( pMacro )
1152 aINetFormat.SetMacro(SvMacroItemId::OnMouseOut, *pMacro);
1153 }
1154 rSh.SttSelect();
1155 // inserting mention
1156 if (comphelper::LibreOfficeKit::isActive() && !rReplacementText.isEmpty())
1157 {
1158 SwPaM* pCursorPos = rSh.GetCursor();
1159 // move cursor backwards to select @mention
1160 for(int i=0; i < rReplacementText.getLength(); i++)
1161 pCursorPos->Move(fnMoveBackward);
1162 rSh.InsertURL( aINetFormat, rName, false );
1163 }
1164 else
1165 {
1166 rSh.InsertURL( aINetFormat, rName, true );
1167 }
1168 rSh.EndSelect();
1169 }
1170 break;
1171
1172 case HLINK_BUTTON:
1173 bool bSel = rSh.HasSelection();
1174 if(bSel)
1175 rSh.DelRight();
1176 InsertURLButton( rURL, rTarget, rName );
1177 rSh.EnterStdMode();
1178 break;
1179 }
1180 rSh.EndAction();
1181}
1182
1183IMPL_LINK( SwTextShell, RedlineNextHdl, AbstractSvxPostItDialog&, rDlg, void )
1184{
1185 SwWrtShell* pSh = GetShellPtr();
1186
1187 // Insert or change a comment.
1188 pSh->SetRedlineComment(rDlg.GetNote());
1189
1190 const SwRangeRedline *pRedline = pSh->GetCurrRedline();
1191
1192 if (!pRedline)
1193 return;
1194
1195 // Traveling only if more than one field.
1196 if( !pSh->IsCursorPtAtEnd() )
1197 pSh->SwapPam(); // Move the cursor behind the Redline.
1198
1199 pSh->Push();
1200 const SwRangeRedline *pActRed = pSh->SelNextRedline();
1202
1203 bool bEnable = false;
1204
1205 if (pActRed)
1206 {
1207 pSh->StartAction();
1208 pSh->Push();
1209 bEnable = pSh->SelNextRedline() != nullptr;
1211 pSh->EndAction();
1212 }
1213
1214 rDlg.EnableTravel(bEnable, true);
1215
1216 if( pSh->IsCursorPtAtEnd() )
1217 pSh->SwapPam();
1218
1219 pRedline = pSh->GetCurrRedline();
1220 OUString sComment = convertLineEnd(pRedline->GetComment(), GetSystemLineEnd());
1221
1222 rDlg.SetNote(sComment);
1223 rDlg.ShowLastAuthor( pRedline->GetAuthorString(),
1225 pRedline->GetRedlineData().GetTimeStamp() ));
1226
1227 rDlg.SetText(lcl_BuildTitleWithRedline(pRedline));
1228
1229}
1230
1231IMPL_LINK( SwTextShell, RedlinePrevHdl, AbstractSvxPostItDialog&, rDlg, void )
1232{
1233 SwWrtShell* pSh = GetShellPtr();
1234
1235 // Insert or change a comment.
1236 pSh->SetRedlineComment(rDlg.GetNote());
1237
1238 const SwRangeRedline *pRedline = pSh->GetCurrRedline();
1239
1240 if (!pRedline)
1241 return;
1242
1243 // Traveling only if more than one field.
1244 pSh->Push();
1245 const SwRangeRedline *pActRed = pSh->SelPrevRedline();
1247
1248 bool bEnable = false;
1249
1250 if (pActRed)
1251 {
1252 pSh->StartAction();
1253 pSh->Push();
1254 bEnable = pSh->SelPrevRedline() != nullptr;
1256 pSh->EndAction();
1257 }
1258
1259 rDlg.EnableTravel(true, bEnable);
1260
1261 pRedline = pSh->GetCurrRedline();
1262 OUString sComment = convertLineEnd(pRedline->GetComment(), GetSystemLineEnd());
1263
1264 rDlg.SetNote(sComment);
1265 rDlg.ShowLastAuthor(pRedline->GetAuthorString(),
1267 pRedline->GetRedlineData().GetTimeStamp() ));
1268
1269 rDlg.SetText(lcl_BuildTitleWithRedline(pRedline));
1270
1271}
1272
1273/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#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 * getFieldmarkFor(const SwPosition &pos) const =0
virtual const SwRedlineTable & GetRedlineTable() const =0
const OUString & getBcp47(bool bResolveSystem=true) const
void Invalidate(sal_uInt16 nId)
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
SwWrtShell & GetShell()
Definition: basesh.cxx:2827
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:2832
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2251
bool IsReadOnlyAvailable() const
Definition: crsrsh.hxx:490
void StartAction()
Definition: crsrsh.cxx:226
void SwapPam()
Definition: crsrsh.cxx:976
bool IsMultiSelection() const
Definition: crsrsh.hxx:904
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:2036
bool CursorInsideInputField() const
Definition: crstrvl.cxx:960
SwField * GetCurField(const bool bIncludeInputFieldAtStart=false) const
Definition: crstrvl.cxx:939
void EndAction(const bool bIdleEnd=false)
Definition: crsrsh.cxx:243
static sal_Int32 StartOfInputFieldAtPos(const SwPosition &rPos)
Definition: crstrvl.cxx:1007
static SwTextField * GetTextFieldAtCursor(const SwPaM *pCursor, ::sw::GetTextAttrMode eMode)
Definition: crstrvl.cxx:906
const SwRangeRedline * SelNextRedline()
Definition: crstrvl.cxx:2313
void ClearMark()
Definition: crsrsh.cxx:939
const SwRangeRedline * SelPrevRedline()
Definition: crstrvl.cxx:2340
static sal_Int32 EndOfInputFieldAtPos(const SwPosition &rPos)
Definition: crstrvl.cxx:1015
bool HasReadonlySel(bool isReplace=false) const
Definition: crsrsh.cxx:3359
bool IsInHeaderFooter(bool *pbInHeader=nullptr) const
Definition: crsrsh.cxx:752
bool IsCursorPtAtEnd() const
Definition: crsrsh.hxx:914
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:1151
const ::sfx2::SvBaseLink & GetBaseLink() const
Definition: ddefld.hxx:90
Definition: doc.hxx:194
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:321
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:150
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:363
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:341
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1814
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
Definition: doc.hxx:1418
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
Definition: edattr.cxx:171
void SetUndoNoResetModified()
Definition: edws.cxx:80
bool SetRedlineComment(const OUString &rS)
Set comment to Redline at position.
Definition: edredln.cxx:150
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
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:1856
void UpdateCurField(sal_uInt32 nFormat, const OUString &rPar1, const OUString &rPar2, std::unique_ptr< SwField > _pField=nullptr)
Definition: fldmgr.cxx:1536
bool InsertField(SwInsertField_Data &rData)
Definition: fldmgr.cxx:895
SwField * GetCurField()
Definition: fldmgr.cxx:430
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:242
SwFieldIds Which() const
Definition: fldbas.hxx:273
SwFormatField * FindFormatForPostItId(sal_uInt32 nPostItId) const
Definition: fldbas.cxx:175
Base class of all fields.
Definition: fldbas.hxx:292
SwFieldTypesEnum GetTypeId() const
Definition: fldbas.cxx:257
sal_uInt32 GetFormat() const
Query parameters for dialog and for BASIC.
Definition: fldbas.hxx:403
SwFieldType * GetTyp() const
Definition: fldbas.hxx:398
void SetMacro(SvMacroItemId nEvent, const SvxMacro &rMacro)
Macro getter and setter.
Definition: fmtatr2.cxx:250
void SetName(const OUString &rNm)
Definition: fmtinfmt.hxx:84
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:897
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:1521
sw::annotation::SwAnnotationWin * GetAnnotationWin(const SwPostItField *pField) const
Definition: PostItMgr.cxx:1794
void HideActiveSidebarWin()
Definition: PostItMgr.cxx:2413
bool HasNotes() const
Definition: PostItMgr.cxx:2122
void ToggleResolved(sal_uInt32 nPostItId)
Definition: PostItMgr.cxx:1600
void Hide(std::u16string_view rAuthor)
Definition: PostItMgr.cxx:1751
void ExecuteFormatAllDialog(SwView &rView)
Definition: PostItMgr.cxx:1678
void DeleteCommentThread(sal_uInt32 nPostItId)
Definition: PostItMgr.cxx:1576
void ToggleResolvedForThread(sal_uInt32 nPostItId)
Definition: PostItMgr.cxx:1625
void DeleteActiveSidebarWin()
Definition: PostItMgr.cxx:2405
SW_DLLPUBLIC bool HasActiveSidebarWin() const
Definition: PostItMgr.cxx:2378
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
LanguageType GetLang(const sal_Int32 nBegin, const sal_Int32 nLen=0, sal_uInt16 nScript=0) const
Definition: thints.cxx:3462
void StateField(SfxItemSet &)
Definition: textfld.cxx:915
void InsertHyperlink(const SvxHyperlinkItem &rHlnkItem)
Definition: textfld.cxx:1111
void ExecField(SfxRequest &rReq)
Definition: textfld.cxx:103
bool IsReadonly() const
Definition: viewopt.hxx:571
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:433
static void SetCareDialog(const std::shared_ptr< weld::Window > &rNew)
Definition: viewsh.cxx:2655
const IDocumentMarkAccess * getIDocumentMarkAccess() const
Provides access to the document bookmark interface.
Definition: viewsh.cxx:2807
SwDoc * GetDoc() const
Definition: viewsh.hxx:290
SwPostItMgr * GetPostItMgr()
Definition: view.hxx:642
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:425
void InsertPostIt(SwFieldMgr &rFieldMgr, const SfxRequest &rReq)
Inserts a new annotation/comment at the current cursor position / selection.
Definition: wrtsh1.cxx:2213
bool StartInputFieldDlg(SwField *, bool bPrevButton, bool bNextButton, weld::Widget *pParentWin, FieldDialogPressedButton *pPressedButton=nullptr)
Definition: wrtsh2.cxx:263
SelectionType GetSelectionType() const
Definition: wrtsh1.cxx:1706
void EnterStdMode()
Definition: select.cxx:551
void ExecMacro(const SvxMacro &rMacro, OUString *pRet=nullptr, SbxArray *pArgs=nullptr)
Definition: wrtsh3.cxx:323
bool DelRight(bool isReplaceHeuristic=false)
Definition: delete.cxx:291
bool HasSelection() const
Definition: wrtsh.hxx:147
void SttSelect()
Definition: select.cxx:385
bool Pop(SwCursorShell::PopMode, ::std::optional< SwCallLink > &roLink)
Definition: wrtsh1.cxx:2030
const SwView & GetView() const
Definition: wrtsh.hxx:443
void disposeAndClear()
void UpdateText(const OUString &aText)
void ExecuteCommand(sal_uInt16 nSlot)
#define FN_RESOLVE_NOTE
Definition: cmdid.h:778
#define FN_REPLY
Definition: cmdid.h:776
#define FN_INSERT_REF_FIELD
Definition: cmdid.h:212
#define FN_DELETE_NOTE_AUTHOR
Definition: cmdid.h:769
#define FN_UPDATE_TEXT_FORMFIELDS
Definition: cmdid.h:310
#define FN_JAVAEDIT
Definition: cmdid.h:287
#define FN_HIDE_NOTE_AUTHOR
Definition: cmdid.h:772
#define FN_INSERT_FLD_TIME
Definition: cmdid.h:271
#define FN_INSERT_FLD_AUTHOR
Definition: cmdid.h:276
#define FN_INSERT_FLD_TOPIC
Definition: cmdid.h:274
#define FN_INSERT_DBFIELD
Definition: cmdid.h:209
#define FN_POSTIT
Definition: cmdid.h:227
#define FN_INSERT_FLD_PGNUMBER
Definition: cmdid.h:272
#define FN_GOTO_PREV_INPUTFLD
Definition: cmdid.h:108
#define FN_INSERT_FIELD_CTRL
Definition: cmdid.h:268
#define FN_INSERT_FLD_DATE
Definition: cmdid.h:270
#define FN_REDLINE_COMMENT
Definition: cmdid.h:130
#define FN_HIDE_ALL_NOTES
Definition: cmdid.h:773
#define FN_DELETE_ALL_NOTES
Definition: cmdid.h:770
#define FN_HIDE_NOTE
Definition: cmdid.h:771
#define FN_INSERT_FIELD
Definition: cmdid.h:205
#define FN_DELETE_COMMENT
Definition: cmdid.h:775
#define FN_INSERT_FIELD_DATA_ONLY
Definition: cmdid.h:217
#define FN_DELETE_COMMENT_THREAD
Definition: cmdid.h:780
#define FN_INSERT_FLD_PGCOUNT
Definition: cmdid.h:273
#define FN_EDIT_FIELD
Definition: cmdid.h:77
#define FN_RESOLVE_NOTE_THREAD
Definition: cmdid.h:779
#define FN_INSERT_DATE_FORMFIELD
Definition: cmdid.h:305
#define FN_GOTO_NEXT_INPUTFLD
Definition: cmdid.h:107
#define FN_PARAM_FIELD_SUBTYPE
Definition: cmdid.h:806
#define FN_PARAM_FIELD_FORMAT
Definition: cmdid.h:807
#define FN_FORMAT_ALL_NOTES
Definition: cmdid.h:777
#define FN_INSERT_FLD_TITLE
Definition: cmdid.h:275
#define FN_EXECUTE_MACROFIELD
Definition: cmdid.h:83
#define FN_INSERT_CHECKBOX_FORMFIELD
Definition: cmdid.h:301
#define FN_INSERT_DROPDOWN_FORMFIELD
Definition: cmdid.h:302
#define FN_INSERT_TEXT_FORMFIELD
Definition: cmdid.h:300
#define FN_PARAM_FIELD_TYPE
Definition: cmdid.h:805
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
List of FieldTypes at UI.
Definition: fldbas.hxx:94
SwFieldIds
Definition: fldbas.hxx:45
@ TableOfAuthorities
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
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:1179
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:165
bool g_bNoInterrupt
Definition: swmodule.cxx:115
#define DB_DELIM
Definition: swtypes.hxx:130
@ INSERT_FORM_FIELD
IMPL_LINK(SwTextShell, RedlineNextHdl, AbstractSvxPostItDialog &, rDlg, void)
Definition: textfld.cxx:1183
static OUString lcl_BuildTitleWithRedline(const SwRangeRedline *pRedline)
Definition: textfld.cxx:73
OUString aCommand
sal_uInt16 sal_Unicode
OUString GetAppLangDateTimeString(const DateTime &)
Definition: uitool.cxx:862
RET_OK
NF_DATE_SYSTEM_LONG