LibreOffice Module sw (master) 1
textsh1.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/i18n/WordType.hpp>
21#include <com/sun/star/linguistic2/XThesaurus.hpp>
22
23#include <hintids.hxx>
24#include <cmdid.h>
25#include <comphelper/lok.hxx>
26
27#include <i18nutil/unicode.hxx>
29#include <svtools/langtab.hxx>
30#include <svl/numformat.hxx>
31#include <svl/slstitm.hxx>
32#include <svl/stritem.hxx>
33#include <sfx2/htmlmode.hxx>
34#include <svl/whiter.hxx>
35#include <sfx2/bindings.hxx>
36#include <sfx2/viewfrm.hxx>
37#include <vcl/unohelp2.hxx>
38#include <vcl/weld.hxx>
39#include <sfx2/request.hxx>
40#include <svl/eitem.hxx>
41#include <editeng/lrspitem.hxx>
42#include <editeng/colritem.hxx>
43#include <editeng/tstpitem.hxx>
44#include <editeng/brushitem.hxx>
45#include <editeng/svxacorr.hxx>
46#include <svl/cjkoptions.hxx>
47#include <svl/ctloptions.hxx>
50#include <charfmt.hxx>
51#include <svx/SmartTagItem.hxx>
52#include <svx/xflgrit.hxx>
53#include <svx/xflhtit.hxx>
54#include <fmtinfmt.hxx>
55#include <wrtsh.hxx>
56#include <wview.hxx>
57#include <swmodule.hxx>
58#include <viewopt.hxx>
59#include <uitool.hxx>
60#include <textsh.hxx>
61#include <IMark.hxx>
62#include <swdtflvr.hxx>
63#include <swundo.hxx>
64#include <reffld.hxx>
65#include <docsh.hxx>
66#include <inputwin.hxx>
67#include <chrdlgmodes.hxx>
68#include <fmtcol.hxx>
69#include <cellatr.hxx>
70#include <edtwin.hxx>
71#include <fldmgr.hxx>
72#include <strings.hrc>
73#include <paratr.hxx>
74#include <vcl/svapp.hxx>
75#include <sfx2/app.hxx>
76#include <breakit.hxx>
77#include <SwSmartTagMgr.hxx>
78#include <editeng/acorrcfg.hxx>
79#include <swabstdlg.hxx>
80#include <sfx2/sfxdlg.hxx>
81#include <com/sun/star/container/XNameContainer.hpp>
82#include <com/sun/star/beans/XPropertySet.hpp>
83#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
84#include <com/sun/star/uno/Any.hxx>
85#include <com/sun/star/linguistic2/ProofreadingResult.hpp>
86#include <com/sun/star/linguistic2/XDictionary.hpp>
87#include <com/sun/star/linguistic2/XSpellAlternatives.hpp>
88#include <editeng/unolingu.hxx>
89#include <doc.hxx>
90#include <drawdoc.hxx>
91#include <view.hxx>
92#include <pam.hxx>
93#include <sfx2/objface.hxx>
94#include <langhelper.hxx>
95#include <uiitems.hxx>
96#include <svx/nbdtmgfact.hxx>
97#include <svx/nbdtmg.hxx>
98#include <SwRewriter.hxx>
99#include <svx/drawitem.hxx>
100#include <numrule.hxx>
101#include <memory>
102#include <xmloff/odffields.hxx>
103#include <bookmark.hxx>
104#include <linguistic/misc.hxx>
107#include <authfld.hxx>
108#include <config_wasm_strip.h>
109#if !ENABLE_WASM_STRIP_EXTRA
110#include <officecfg/Office/Common.hxx>
111#include <officecfg/Office/Linguistic.hxx>
112#include <svl/visitem.hxx>
114#endif // ENABLE_WASM_STRIP_EXTRA
115#include <translatehelper.hxx>
117#include <IDocumentUndoRedo.hxx>
118#include <fmtcntnt.hxx>
119#include <fmtrfmrk.hxx>
120
121using namespace ::com::sun::star;
122using namespace com::sun::star::beans;
123using namespace ::com::sun::star::container;
124using namespace com::sun::star::style;
125using namespace svx::sidebar;
126
127static void sw_CharDialogResult(const SfxItemSet* pSet, SwWrtShell &rWrtSh, std::shared_ptr<SfxItemSet> const & pCoreSet, bool bSel, bool bSelectionPut, SfxRequest *pReq);
128
129static void sw_CharDialog(SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot, const SfxItemSet *pArgs, SfxRequest *pReq )
130{
131 FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( &rWrtSh.GetView()) != nullptr );
132 SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
133 auto pCoreSet = std::make_shared<SfxItemSetFixed<
138 SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
139 SID_HTML_MODE, SID_HTML_MODE,
140 SID_ATTR_CHAR_WIDTH_FIT_TO_LINE, SID_ATTR_CHAR_WIDTH_FIT_TO_LINE,
142 rWrtSh.GetCurAttr(*pCoreSet);
143
144 bool bSel = rWrtSh.HasSelection();
145 bool bSelectionPut = false;
146 if(bSel || rWrtSh.IsInWord())
147 {
148 if(!bSel)
149 {
150 rWrtSh.StartAction();
151 rWrtSh.Push();
153 rWrtSh.SelWrd();
154 }
155 pCoreSet->Put(SfxStringItem(FN_PARAM_SELECTION, rWrtSh.GetSelText()));
156 bSelectionPut = true;
157 if(!bSel)
158 {
160 rWrtSh.EndAction();
161 }
162 }
163 pCoreSet->Put(SfxUInt16Item(SID_ATTR_CHAR_WIDTH_FIT_TO_LINE, rWrtSh.GetScalingOfSelectedText()));
164
165 ::ConvertAttrCharToGen(*pCoreSet);
166
167 // Setting the BoxInfo
168 ::PrepareBoxInfo(*pCoreSet, rWrtSh);
169
170 pCoreSet->Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(rWrtSh.GetView().GetDocShell())));
172 if ( bUseDialog && GetActiveView() )
173 {
175 pDlg.reset(pFact->CreateSwCharDlg(rWrtSh.GetView().GetFrameWeld(), rWrtSh.GetView(), *pCoreSet, SwCharDlgMode::Std));
176
177 if (nSlot == FN_INSERT_HYPERLINK)
178 pDlg->SetCurPageId("hyperlink");
179 else if (nSlot == SID_CHAR_DLG_EFFECT)
180 pDlg->SetCurPageId("fonteffects");
181 else if (nSlot == SID_CHAR_DLG_POSITION)
182 pDlg->SetCurPageId("position");
183 else if (nSlot == SID_CHAR_DLG_FOR_PARAGRAPH)
184 pDlg->SetCurPageId("font");
185 else if (pReq)
186 {
187 const SfxStringItem* pItem = (*pReq).GetArg<SfxStringItem>(FN_PARAM_1);
188 if (pItem)
189 pDlg->SetCurPageId(OUStringToOString(pItem->GetValue(), RTL_TEXTENCODING_UTF8));
190 }
191 }
192
193 if (bUseDialog)
194 {
195 std::shared_ptr<SfxRequest> pRequest;
196 if (pReq)
197 {
198 pRequest = std::make_shared<SfxRequest>(*pReq);
199 pReq->Ignore(); // the 'old' request is not relevant any more
200 }
201 pDlg->StartExecuteAsync([pDlg, &rWrtSh, pCoreSet, bSel, bSelectionPut, pRequest](sal_Int32 nResult){
202 if (nResult == RET_OK)
203 {
204 sw_CharDialogResult(pDlg->GetOutputItemSet(), rWrtSh, pCoreSet, bSel, bSelectionPut, pRequest.get());
205 }
206 pDlg->disposeOnce();
207 });
208 }
209 else if (pArgs)
210 {
211 sw_CharDialogResult(pArgs, rWrtSh, pCoreSet, bSel, bSelectionPut, pReq);
212 }
213}
214
215static void sw_CharDialogResult(const SfxItemSet* pSet, SwWrtShell &rWrtSh, std::shared_ptr<SfxItemSet> const & pCoreSet, bool bSel, bool bSelectionPut, SfxRequest *pReq)
216{
217 SfxItemSet aTmpSet( *pSet );
218 ::ConvertAttrGenToChar(aTmpSet, *pCoreSet);
219
220 const SfxStringItem* pSelectionItem;
221 bool bInsert = false;
222 sal_Int32 nInsert = 0;
223
224 // The old item is for unknown reasons back in the set again.
225 if( !bSelectionPut && (pSelectionItem = aTmpSet.GetItemIfSet(FN_PARAM_SELECTION, false)) )
226 {
227 OUString sInsert = pSelectionItem->GetValue();
228 bInsert = !sInsert.isEmpty();
229 if(bInsert)
230 {
231 nInsert = sInsert.getLength();
232 rWrtSh.StartAction();
233 rWrtSh.Insert( sInsert );
234 rWrtSh.SetMark();
235 rWrtSh.ExtendSelection(false, sInsert.getLength());
237 aReq.AppendItem( SfxStringItem( FN_INSERT_STRING, sInsert ) );
238 aReq.Done();
239 SfxRequest aReq1(rWrtSh.GetView().GetViewFrame(), FN_CHAR_LEFT);
242 aReq1.Done();
243 }
244 }
246
247 SwTextFormatColl* pColl = rWrtSh.GetCurTextFormatColl();
248 if(bSel && rWrtSh.IsSelFullPara() && pColl && pColl->IsAutoUpdateOnDirectFormat())
249 {
250 rWrtSh.AutoUpdatePara(pColl, aTmpSet);
251 }
252 else
253 rWrtSh.SetAttrSet( aTmpSet );
254 if (pReq)
255 pReq->Done(aTmpSet);
256 if(bInsert)
257 {
258 SfxRequest aReq1(rWrtSh.GetView().GetViewFrame(), FN_CHAR_RIGHT);
261 aReq1.Done();
262 rWrtSh.SwapPam();
263 rWrtSh.ClearMark();
264 rWrtSh.DontExpandFormat();
265 rWrtSh.EndAction();
266 }
267
268}
269
270
271static void sw_ParagraphDialogResult(SfxItemSet* pSet, SwWrtShell &rWrtSh, SfxRequest& rReq, SwPaM* pPaM)
272{
273 if (!pSet)
274 return;
275
276 rReq.Done( *pSet );
277 ::SfxToSwPageDescAttr( rWrtSh, *pSet );
278 // #i56253#
279 // enclose all undos.
280 // Thus, check conditions, if actions will be performed.
281 const bool bUndoNeeded( pSet->Count() ||
282 SfxItemState::SET == pSet->GetItemState(FN_NUMBER_NEWSTART) ||
283 SfxItemState::SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) );
284 if ( bUndoNeeded )
285 {
287 }
288 if( pSet->Count() )
289 {
290 rWrtSh.StartAction();
291 if ( const SfxStringItem* pDropTextItem = pSet->GetItemIfSet(FN_DROP_TEXT, false) )
292 {
293 if ( !pDropTextItem->GetValue().isEmpty() )
294 rWrtSh.ReplaceDropText(pDropTextItem->GetValue(), pPaM);
295 }
296 rWrtSh.SetAttrSet(*pSet, SetAttrMode::DEFAULT, pPaM);
297 rWrtSh.EndAction();
298 SwTextFormatColl* pColl = rWrtSh.GetPaMTextFormatColl(pPaM);
299 if(pColl && pColl->IsAutoUpdateOnDirectFormat())
300 {
301 rWrtSh.AutoUpdatePara(pColl, *pSet, pPaM);
302 }
303 }
304
305 if( SfxItemState::SET == pSet->GetItemState(FN_NUMBER_NEWSTART) )
306 {
307 //SetNumRuleStart(true) restarts the numbering at the value
308 //that is defined at the starting point of the numbering level
309 //otherwise the SetNodeNumStart() value determines the start
310 //if it's set to something different than USHRT_MAX
311
312 bool bStart = static_cast<const SfxBoolItem&>(pSet->Get(FN_NUMBER_NEWSTART)).GetValue();
313
314 // Default value for restart value has to be USHRT_MAX
315 // in order to indicate that the restart value of the list
316 // style has to be used on restart.
317 sal_uInt16 nNumStart = USHRT_MAX;
318 if( SfxItemState::SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) )
319 {
320 nNumStart = static_cast<const SfxUInt16Item&>(pSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue();
321 }
322 rWrtSh.SetNumRuleStart(bStart, pPaM);
323 rWrtSh.SetNodeNumStart(nNumStart);
324 }
325 else if( SfxItemState::SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) )
326 {
327 rWrtSh.SetNodeNumStart(static_cast<const SfxUInt16Item&>(pSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue());
328 rWrtSh.SetNumRuleStart(false, pPaM);
329 }
330 // #i56253#
331 if ( bUndoNeeded )
332 {
333 rWrtSh.EndUndo( SwUndoId::INSATTR );
334 }
335}
336
337namespace {
338
339void InsertBreak(SwWrtShell& rWrtSh,
340 sal_uInt16 nKind,
341 ::std::optional<sal_uInt16> oPageNumber,
342 const OUString& rTemplateName, std::optional<SwLineBreakClear> oClear)
343{
344 switch ( nKind )
345 {
346 case 1 :
347 rWrtSh.InsertLineBreak(oClear);
348 break;
349 case 2 :
350 rWrtSh.InsertColumnBreak(); break;
351 case 3 :
352 {
353 rWrtSh.StartAllAction();
354 if( !rTemplateName.isEmpty() )
355 rWrtSh.InsertPageBreak( &rTemplateName, oPageNumber );
356 else
357 rWrtSh.InsertPageBreak();
358 rWrtSh.EndAllAction();
359 }
360 }
361}
362
363OUString GetLocalURL(const SwWrtShell& rSh)
364{
365 SwField* pField = rSh.GetCurField();
366 if (!pField)
367 {
368 return OUString();
369 }
370
371 if (pField->GetTyp()->Which() != SwFieldIds::TableOfAuthorities)
372 {
373 return OUString();
374 }
375
376 const auto& rAuthorityField = *static_cast<const SwAuthorityField*>(pField);
377 SwAuthEntry* pAuthEntry = rAuthorityField.GetAuthEntry();
378 if (!pAuthEntry)
379 {
380 return OUString();
381 }
382
383 const OUString& rLocalURL = pAuthEntry->GetAuthorField(AUTH_FIELD_LOCAL_URL);
384 return rLocalURL;
385}
386
387void UpdateSections(SfxRequest& rReq, SwWrtShell& rWrtSh)
388{
389 OUString aSectionNamePrefix;
390 const SfxStringItem* pSectionNamePrefix = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
391 if (pSectionNamePrefix)
392 {
393 aSectionNamePrefix = pSectionNamePrefix->GetValue();
394 }
395
396 uno::Sequence<beans::PropertyValues> aSections;
397 const SfxUnoAnyItem* pSections = rReq.GetArg<SfxUnoAnyItem>(FN_PARAM_2);
398 if (pSections)
399 {
400 pSections->GetValue() >>= aSections;
401 }
402
403 rWrtSh.GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::INSSECTION, nullptr);
404 rWrtSh.StartAction();
405
406 SwDoc* pDoc = rWrtSh.GetDoc();
407 sal_Int32 nSectionIndex = 0;
408 const SwSectionFormats& rFormats = pDoc->GetSections();
410 for (size_t i = 0; i < rFormats.size(); ++i)
411 {
412 const SwSectionFormat* pFormat = rFormats[i];
413 if (!pFormat->GetName().startsWith(aSectionNamePrefix))
414 {
415 continue;
416 }
417
418 if (nSectionIndex >= aSections.getLength())
419 {
420 break;
421 }
422
423 comphelper::SequenceAsHashMap aMap(aSections[nSectionIndex++]);
424 OUString aSectionName = aMap["RegionName"].get<OUString>();
425 if (aSectionName != pFormat->GetName())
426 {
427 const_cast<SwSectionFormat*>(pFormat)->SetFormatName(aSectionName, /*bBroadcast=*/true);
428 SwSectionData aSectionData(*pFormat->GetSection());
429 aSectionData.SetSectionName(aSectionName);
430 pDoc->UpdateSection(i, aSectionData);
431 }
432
433 const SwFormatContent& rContent = pFormat->GetContent();
434 const SwNodeIndex* pContentNodeIndex = rContent.GetContentIdx();
435 if (pContentNodeIndex)
436 {
437 SwPaM aSectionStart(SwPosition{*pContentNodeIndex});
438 aSectionStart.Move(fnMoveForward, GoInContent);
439 SwPaM* pCursorPos = rWrtSh.GetCursor();
440 *pCursorPos = aSectionStart;
441 rWrtSh.EndOfSection(/*bSelect=*/true);
442 rIDCO.DeleteAndJoin(*pCursorPos);
443 rWrtSh.EndSelect();
444
445 OUString aSectionText = aMap["Content"].get<OUString>();
446 SwTranslateHelper::PasteHTMLToPaM(rWrtSh, pCursorPos, aSectionText.toUtf8(), true);
447 }
448 }
449
450 rWrtSh.EndAction();
451 rWrtSh.GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSSECTION, nullptr);
452}
453
454void DeleteSections(SfxRequest& rReq, SwWrtShell& rWrtSh)
455{
456 OUString aSectionNamePrefix;
457 const SfxStringItem* pSectionNamePrefix = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
458 if (pSectionNamePrefix)
459 {
460 aSectionNamePrefix = pSectionNamePrefix->GetValue();
461 }
462
463 rWrtSh.GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::DELSECTION, nullptr);
464 rWrtSh.StartAction();
466 [&rWrtSh]
467 {
468 rWrtSh.EndAction();
469 rWrtSh.GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::DELSECTION, nullptr);
470 });
471
472 SwDoc* pDoc = rWrtSh.GetDoc();
473 SwSectionFormats& rFormats = pDoc->GetSections();
474 std::vector<SwSectionFormat*> aRemovals;
475 for (size_t i = 0; i < rFormats.size(); ++i)
476 {
477 SwSectionFormat* pFormat = rFormats[i];
478
479 if (!aSectionNamePrefix.isEmpty())
480 {
481 if (!pFormat->GetName().startsWith(aSectionNamePrefix))
482 {
483 continue;
484 }
485 }
486
487 aRemovals.push_back(pFormat);
488 }
489
490 for (const auto& pFormat : aRemovals)
491 {
492 // Just delete the format, not the content of the section.
493 pDoc->DelSectionFormat(pFormat);
494 }
495}
496
497void UpdateBookmarks(SfxRequest& rReq, SwWrtShell& rWrtSh)
498{
500 {
501 return;
502 }
503
504 OUString aBookmarkNamePrefix;
505 const SfxStringItem* pBookmarkNamePrefix = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
506 if (pBookmarkNamePrefix)
507 {
508 aBookmarkNamePrefix = pBookmarkNamePrefix->GetValue();
509 }
510
511 uno::Sequence<beans::PropertyValues> aBookmarks;
512 const SfxUnoAnyItem* pBookmarks = rReq.GetArg<SfxUnoAnyItem>(FN_PARAM_2);
513 if (pBookmarks)
514 {
515 pBookmarks->GetValue() >>= aBookmarks;
516 }
517
518 rWrtSh.GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::UPDATE_BOOKMARKS, nullptr);
519 rWrtSh.StartAction();
520
522 sal_Int32 nBookmarkIndex = 0;
523 bool bSortMarks = false;
524 for (auto it = rIDMA.getBookmarksBegin(); it != rIDMA.getBookmarksEnd(); ++it)
525 {
526 auto pMark = dynamic_cast<sw::mark::Bookmark*>(*it);
527 assert(pMark);
528 if (!pMark->GetName().startsWith(aBookmarkNamePrefix))
529 {
530 continue;
531 }
532
533 if (aBookmarks.getLength() <= nBookmarkIndex)
534 {
535 continue;
536 }
537
538 comphelper::SequenceAsHashMap aMap(aBookmarks[nBookmarkIndex++]);
539 if (aMap["Bookmark"].get<OUString>() != pMark->GetName())
540 {
541 rIDMA.renameMark(pMark, aMap["Bookmark"].get<OUString>());
542 }
543
544 OUString aBookmarkText = aMap["BookmarkText"].get<OUString>();
545
546 // Insert markers to remember where the paste positions are.
547 SwPaM aMarkers(pMark->GetMarkEnd());
549 bool bSuccess = rIDCO.InsertString(aMarkers, "XY");
550 if (bSuccess)
551 {
552 SwPaM aPasteEnd(pMark->GetMarkEnd());
553 aPasteEnd.Move(fnMoveForward, GoInContent);
554
555 // Paste HTML content.
556 SwPaM* pCursorPos = rWrtSh.GetCursor();
557 *pCursorPos = aPasteEnd;
558 SwTranslateHelper::PasteHTMLToPaM(rWrtSh, pCursorPos, aBookmarkText.toUtf8(), true);
559
560 // Update the bookmark to point to the new content.
561 SwPaM aPasteStart(pMark->GetMarkEnd());
562 aPasteStart.Move(fnMoveForward, GoInContent);
563 SwPaM aStartMarker(pMark->GetMarkStart(), *aPasteStart.GetPoint());
564 SwPaM aEndMarker(*aPasteEnd.GetPoint(), *aPasteEnd.GetPoint());
565 aEndMarker.GetMark()->AdjustContent(1);
566 pMark->SetMarkPos(*aPasteStart.GetPoint());
567 pMark->SetOtherMarkPos(*aPasteEnd.GetPoint());
568 bSortMarks = true;
569
570 // Remove markers. the start marker includes the old content as well.
571 rIDCO.DeleteAndJoin(aStartMarker);
572 rIDCO.DeleteAndJoin(aEndMarker);
573 }
574 }
575 if (bSortMarks)
576 {
578 }
579
580 rWrtSh.EndAction();
581 rWrtSh.GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::UPDATE_BOOKMARKS, nullptr);
582}
583
584void UpdateBookmark(SfxRequest& rReq, SwWrtShell& rWrtSh)
585{
587 {
588 return;
589 }
590
591 OUString aBookmarkNamePrefix;
592 const SfxStringItem* pBookmarkNamePrefix = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
593 if (pBookmarkNamePrefix)
594 {
595 aBookmarkNamePrefix = pBookmarkNamePrefix->GetValue();
596 }
597
598 uno::Sequence<beans::PropertyValue> aBookmark;
599 const SfxUnoAnyItem* pBookmarks = rReq.GetArg<SfxUnoAnyItem>(FN_PARAM_2);
600 if (pBookmarks)
601 {
602 pBookmarks->GetValue() >>= aBookmark;
603 }
604
606 SwPosition& rCursor = *rWrtSh.GetCursor()->GetPoint();
607 auto pBookmark = dynamic_cast<sw::mark::Bookmark*>(rIDMA.getOneInnermostBookmarkFor(rCursor));
608 if (!pBookmark || !pBookmark->GetName().startsWith(aBookmarkNamePrefix))
609 {
610 return;
611 }
612
613 SwRewriter aRewriter;
614 aRewriter.AddRule(UndoArg1, pBookmark->GetName());
615 rWrtSh.GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::UPDATE_BOOKMARK, &aRewriter);
616 rWrtSh.StartAction();
618 [&rWrtSh, &aRewriter]
619 {
620 rWrtSh.EndAction();
621 rWrtSh.GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::UPDATE_BOOKMARK, &aRewriter);
622 });
623
624
626 if (aMap["Bookmark"].get<OUString>() != pBookmark->GetName())
627 {
628 rIDMA.renameMark(pBookmark, aMap["Bookmark"].get<OUString>());
629 }
630
631 // Insert markers to remember where the paste positions are.
632 SwPaM aMarkers(pBookmark->GetMarkEnd());
634 if (!rIDCO.InsertString(aMarkers, "XY"))
635 {
636 return;
637 }
638
639 SwPaM aPasteEnd(pBookmark->GetMarkEnd());
640 aPasteEnd.Move(fnMoveForward, GoInContent);
641
642 OUString aBookmarkText = aMap["BookmarkText"].get<OUString>();
643
644 // Paste HTML content.
645 SwPaM* pCursorPos = rWrtSh.GetCursor();
646 *pCursorPos = aPasteEnd;
647 SwTranslateHelper::PasteHTMLToPaM(rWrtSh, pCursorPos, aBookmarkText.toUtf8(), true);
648
649 // Update the bookmark to point to the new content.
650 SwPaM aPasteStart(pBookmark->GetMarkEnd());
651 aPasteStart.Move(fnMoveForward, GoInContent);
652 SwPaM aStartMarker(pBookmark->GetMarkStart(), *aPasteStart.GetPoint());
653 SwPaM aEndMarker(*aPasteEnd.GetPoint(), *aPasteEnd.GetPoint());
654 aEndMarker.GetMark()->AdjustContent(1);
655 pBookmark->SetMarkPos(*aPasteStart.GetPoint());
656 pBookmark->SetOtherMarkPos(*aPasteEnd.GetPoint());
657
658 // Remove markers. the start marker includes the old content as well.
659 rIDCO.DeleteAndJoin(aStartMarker);
660 rIDCO.DeleteAndJoin(aEndMarker);
662}
663
664void DeleteBookmarks(SfxRequest& rReq, SwWrtShell& rWrtSh)
665{
667 {
668 return;
669 }
670
671 OUString aBookmarkNamePrefix;
672 const SfxStringItem* pBookmarkNamePrefix = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
673 if (pBookmarkNamePrefix)
674 {
675 aBookmarkNamePrefix = pBookmarkNamePrefix->GetValue();
676 }
677
678 rWrtSh.GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::DELETE_BOOKMARKS, nullptr);
679 rWrtSh.StartAction();
681 [&rWrtSh]
682 {
683 rWrtSh.EndAction();
684 rWrtSh.GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::DELETE_BOOKMARKS, nullptr);
685 });
686
687 IDocumentMarkAccess* pMarkAccess = rWrtSh.GetDoc()->getIDocumentMarkAccess();
688 std::vector<sw::mark::IMark*> aRemovals;
689 for (auto it = pMarkAccess->getBookmarksBegin(); it != pMarkAccess->getBookmarksEnd(); ++it)
690 {
691 auto pBookmark = dynamic_cast<sw::mark::Bookmark*>(*it);
692 assert(pBookmark);
693
694 if (!aBookmarkNamePrefix.isEmpty())
695 {
696 if (!pBookmark->GetName().startsWith(aBookmarkNamePrefix))
697 {
698 continue;
699 }
700 }
701
702 aRemovals.push_back(pBookmark);
703 }
704
705 for (const auto& pMark : aRemovals)
706 {
707 pMarkAccess->deleteMark(pMark);
708 }
709}
710
711void DeleteFields(SfxRequest& rReq, SwWrtShell& rWrtSh)
712{
713 const SfxStringItem* pTypeName = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
714 if (!pTypeName || pTypeName->GetValue() != "SetRef")
715 {
716 // This is implemented so far only for reference marks.
717 return;
718 }
719
720 OUString aNamePrefix;
721 const SfxStringItem* pNamePrefix = rReq.GetArg<SfxStringItem>(FN_PARAM_2);
722 if (pNamePrefix)
723 {
724 aNamePrefix = pNamePrefix->GetValue();
725 }
726
727 SwDoc* pDoc = rWrtSh.GetDoc();
728 pDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::DELBOOKMARK, nullptr);
729 rWrtSh.StartAction();
731 [&rWrtSh]
732 {
733 rWrtSh.EndAction();
734 rWrtSh.GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::DELBOOKMARK, nullptr);
735 });
736
737 std::vector<const SwFormatRefMark*> aRemovals;
738 for (sal_uInt16 i = 0; i < pDoc->GetRefMarks(); ++i)
739 {
740 const SwFormatRefMark* pRefMark = pDoc->GetRefMark(i);
741 if (!aNamePrefix.isEmpty())
742 {
743 if (!pRefMark->GetRefName().startsWith(aNamePrefix))
744 {
745 continue;
746 }
747 }
748
749 aRemovals.push_back(pRefMark);
750 }
751
752 for (const auto& pMark : aRemovals)
753 {
754 pDoc->DeleteFormatRefMark(pMark);
755 }
756}
757}
758
760{
761 bool bUseDialog = true;
762 const SfxItemSet *pArgs = rReq.GetArgs();
763 SwWrtShell& rWrtSh = GetShell();
764 const SfxPoolItem* pItem = nullptr;
765 const sal_uInt16 nSlot = rReq.GetSlot();
766 if(pArgs)
767 pArgs->GetItemState(GetPool().GetWhich(nSlot), false, &pItem);
768 switch( nSlot )
769 {
770 case SID_UNICODE_NOTATION_TOGGLE:
771 {
772 tools::Long nMaxUnits = 256;
773 sal_Int32 nSelLength = rWrtSh.GetSelText().getLength();
774 if( rWrtSh.IsSelection() && !rWrtSh.IsMultiSelection() && (nSelLength < nMaxUnits) )
775 nMaxUnits = nSelLength;
776
777 tools::Long index = 0;
779 while( nMaxUnits-- && aToggle.AllowMoreInput(rWrtSh.GetChar(true, index-1)) )
780 --index;
781
782 OUString sReplacement = aToggle.ReplacementString();
783 if( !sReplacement.isEmpty() )
784 {
785 if (rWrtSh.HasReadonlySel() && !rWrtSh.CursorInsideInputField())
786 {
787 // Only break if there's something to do; don't nag with the dialog otherwise
788 rWrtSh.InfoReadOnlyDialog();
789 break;
790 }
791 SwRewriter aRewriter;
792 aRewriter.AddRule( UndoArg1, aToggle.StringToReplace() );
793 aRewriter.AddRule( UndoArg2, SwResId(STR_YIELDS) );
794 aRewriter.AddRule( UndoArg3, sReplacement );
795 rWrtSh.StartUndo(SwUndoId::REPLACE, &aRewriter);
796 rWrtSh.GetCursor()->Normalize(false);
797
798 rWrtSh.ClearMark();
799 if( rWrtSh.IsInSelect() ) // cancel any in-progress keyboard selection as well
800 rWrtSh.EndSelect();
801
802 for( sal_uInt32 i=aToggle.CharsToDelete(); i > 0; --i )
803 rWrtSh.DelLeft();
804 rWrtSh.Insert2( sReplacement );
805 rWrtSh.EndUndo(SwUndoId::REPLACE, &aRewriter);
806 }
807 }
808 break;
809
810 case SID_LANGUAGE_STATUS:
811 {
812 // get the language
813 OUString aNewLangText;
814 const SfxStringItem* pItem2 = rReq.GetArg<SfxStringItem>(SID_LANGUAGE_STATUS);
815 if (pItem2)
816 aNewLangText = pItem2->GetValue();
817
821 SfxViewFrame& rViewFrame = GetView().GetViewFrame();
822
823 if (aNewLangText == "*")
824 {
825 // open the dialog "Tools/Options/Language Settings - Language"
826 // to set the documents default language
828 ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateVclDialog(GetView().GetFrameWeld(), SID_LANGUAGE_OPTIONS));
829 pDlg->Execute();
830 }
831 else
832 {
836 rWrtSh.StartAction();
837 // prevent view from jumping because of (temporary) selection changes
838 rWrtSh.LockView( true );
839
840 // setting the new language...
841 if (!aNewLangText.isEmpty())
842 {
843 static const OUStringLiteral aSelectionLangPrefix(u"Current_");
844 static const OUStringLiteral aParagraphLangPrefix(u"Paragraph_");
845 static const OUStringLiteral aDocumentLangPrefix(u"Default_");
846
851
852 sal_Int32 nPos = 0;
853 bool bForSelection = true;
854 bool bForParagraph = false;
855 if (-1 != (nPos = aNewLangText.indexOf( aSelectionLangPrefix )))
856 {
857 // ... for the current selection
858 aNewLangText = aNewLangText.replaceAt(nPos, aSelectionLangPrefix.getLength(), u"");
859 bForSelection = true;
860 }
861 else if (-1 != (nPos = aNewLangText.indexOf(aParagraphLangPrefix)))
862 {
863 // ... for the current paragraph language
864 aNewLangText = aNewLangText.replaceAt(nPos, aParagraphLangPrefix.getLength(), u"");
865 bForSelection = true;
866 bForParagraph = true;
867 }
868 else if (-1 != (nPos = aNewLangText.indexOf(aDocumentLangPrefix)))
869 {
870 // ... as default document language
871 aNewLangText = aNewLangText.replaceAt(nPos, aDocumentLangPrefix.getLength(), u"");
872 bForSelection = false;
873 }
874
875 if (bForParagraph || !bForSelection)
876 {
877 rWrtSh.Push(); // save selection for later restoration
878 rWrtSh.ClearMark(); // fdo#67796: invalidate table crsr
879 }
880
881 if (bForParagraph)
883
884 if (!bForSelection) // document language to be changed...
885 {
886 rWrtSh.SelAll();
887 rWrtSh.ExtendedSelectAll();
888 }
889
890 rWrtSh.StartUndo( ( !bForParagraph && !bForSelection ) ? SwUndoId::SETDEFTATTR : SwUndoId::EMPTY );
891 if (aNewLangText == "LANGUAGE_NONE")
892 SwLangHelper::SetLanguage_None( rWrtSh, bForSelection, aCoreSet );
893 else if (aNewLangText == "RESET_LANGUAGES")
895 else
896 SwLangHelper::SetLanguage( rWrtSh, aNewLangText, bForSelection, aCoreSet );
897 rWrtSh.EndUndo();
898
899 if (bForParagraph || !bForSelection)
900 {
901 rWrtSh.Pop(SwCursorShell::PopMode::DeleteCurrent); // restore selection...
902 }
903 }
904
905 rWrtSh.LockView( false );
906 rWrtSh.EndAction();
907 }
908
909 // invalidate slot to get the new language displayed
910 rViewFrame.GetBindings().Invalidate( nSlot );
911
912 rReq.Done();
913 break;
914 }
915
916 case SID_THES:
917 {
918 // replace word/selection with text from selected sub menu entry
919 OUString aReplaceText;
920 const SfxStringItem* pItem2 = rReq.GetArg(FN_PARAM_THES_WORD_REPLACE);
921 if (pItem2)
922 aReplaceText = pItem2->GetValue();
923 if (!aReplaceText.isEmpty())
924 {
925 SwView &rView2 = rWrtSh.GetView();
926 const bool bSelection = rWrtSh.HasSelection();
927 const OUString aLookUpText = rView2.GetThesaurusLookUpText( bSelection );
928 rView2.InsertThesaurusSynonym( aReplaceText, aLookUpText, bSelection );
929 }
930 }
931 break;
932
933 case SID_CHARMAP:
934 {
935 InsertSymbol( rReq );
936 }
937 break;
940 {
941 OUString aStr;
942 const SfxStringItem* pFont = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
943 const SfxStringItem* pNameItem = rReq.GetArg<SfxStringItem>(nSlot);
944 if ( pNameItem )
945 aStr = pNameItem->GetValue();
946 bool bFont = pFont && !pFont->GetValue().isEmpty();
948 rWrtSh.InsertFootnote( aStr, nSlot == FN_INSERT_ENDNOTE, !bFont );
949 if ( bFont )
950 {
951 rWrtSh.Left( SwCursorSkipMode::Chars, true, 1, false );
953 rWrtSh.GetCurAttr( aSet );
954 rWrtSh.SetAttrSet( aSet, SetAttrMode::DONTEXPAND );
955 rWrtSh.ResetSelect(nullptr, false);
956 rWrtSh.EndSelect();
957 rWrtSh.GotoFootnoteText();
958 }
960 rReq.Done();
961 }
962 break;
964 {
967 GetView().GetFrameWeld(), rWrtSh));
968 pDlg->SetHelpId(GetStaticInterface()->GetSlot(nSlot)->GetCommand());
969 if ( pDlg->Execute() == RET_OK )
970 {
971 const sal_uInt16 nId = pDlg->IsEndNote() ? FN_INSERT_ENDNOTE : FN_INSERT_FOOTNOTE;
972 SfxRequest aReq(GetView().GetViewFrame(), nId);
973 if ( !pDlg->GetStr().isEmpty() )
974 aReq.AppendItem( SfxStringItem( nId, pDlg->GetStr() ) );
975 if ( !pDlg->GetFontName().isEmpty() )
976 aReq.AppendItem( SfxStringItem( FN_PARAM_1, pDlg->GetFontName() ) );
977 ExecuteSlot( aReq );
978 }
979
980 rReq.Ignore();
981 }
982 break;
985 {
987 break;
988 }
989 case SID_INSERTDOC:
990 {
991 GetView().ExecuteInsertDoc( rReq, pItem );
992 break;
993 }
994 case FN_FORMAT_RESET:
995 {
996 // #i78856, reset all attributes but not the language attributes
997 // (for this build an array of all relevant attributes and
998 // remove the languages from that)
1000
1001 constexpr std::pair<sal_uInt16, sal_uInt16> aResetableSetRange[] = {
1002 // tdf#40496: we don't want to change writing direction, so exclude RES_FRAMEDIR:
1004 { RES_FRAMEDIR + 1, RES_FRMATR_END - 1 },
1012 };
1013 for (const auto& [nBegin, nEnd] : aResetableSetRange)
1014 {
1015 for (sal_uInt16 i = nBegin; i <= nEnd; ++i)
1016 aAttribs.insert( i );
1017 }
1018 rWrtSh.ResetAttr( aAttribs );
1019
1020 // also clear the direct formatting flag inside SwTableBox(es)
1021 if (SwFEShell* pFEShell = GetView().GetDocShell()->GetFEShell())
1022 pFEShell->UpdateTableStyleFormatting(nullptr, true);
1023
1024 rReq.Done();
1025 break;
1026 }
1028 {
1029 if ( pItem )
1030 {
1031 ::std::optional<sal_uInt16> oPageNumber;
1032 std::optional<SwLineBreakClear> oClear;
1033 OUString aTemplateName;
1034 sal_uInt16 nKind = static_cast<const SfxInt16Item*>(pItem)->GetValue();
1035 const SfxStringItem* pTemplate = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
1036 const SfxUInt16Item* pNumber = rReq.GetArg<SfxUInt16Item>(FN_PARAM_2);
1037 const SfxBoolItem* pIsNumberFilled = rReq.GetArg<SfxBoolItem>(FN_PARAM_3);
1038 if ( pTemplate )
1039 aTemplateName = pTemplate->GetValue();
1040 if ( pNumber && pIsNumberFilled && pIsNumberFilled->GetValue() )
1041 oPageNumber = pNumber->GetValue();
1042
1043 InsertBreak(rWrtSh, nKind, oPageNumber, aTemplateName, oClear);
1044 }
1045 else
1046 {
1048
1049 std::shared_ptr<AbstractSwBreakDlg> pAbstractDialog(pFact->CreateSwBreakDlg(GetView().GetFrameWeld(), rWrtSh));
1050 std::shared_ptr<weld::DialogController> pDialogController(pAbstractDialog->getDialogController());
1051
1052 weld::DialogController::runAsync(pDialogController,
1053 [pAbstractDialog, &rWrtSh] (sal_Int32 nResult) {
1054 if( RET_OK == nResult )
1055 {
1056 sal_uInt16 nKind = pAbstractDialog->GetKind();
1057 OUString aTemplateName = pAbstractDialog->GetTemplateName();
1058 ::std::optional<sal_uInt16> oPageNumber = pAbstractDialog->GetPageNumber();
1059 std::optional<SwLineBreakClear> oClear = pAbstractDialog->GetClear();
1060
1061 InsertBreak(rWrtSh, nKind, oPageNumber, aTemplateName, oClear);
1062 }
1063 });
1064 }
1065
1066 break;
1067 }
1068 case FN_INSERT_BOOKMARK:
1069 {
1070 const SfxStringItem* pBookmarkText = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
1071 SwPaM* pCursorPos = rWrtSh.GetCursor();
1072 if ( pItem )
1073 {
1074 rWrtSh.StartAction();
1075 OUString sName = static_cast<const SfxStringItem*>(pItem)->GetValue();
1076
1077 if (pBookmarkText)
1078 {
1079 OUString aBookmarkText = pBookmarkText->GetValue();
1080 // Split node to remember where the start position is.
1081 bool bSuccess = rWrtSh.GetDoc()->getIDocumentContentOperations().SplitNode(
1082 *pCursorPos->GetPoint(), /*bChkTableStart=*/false);
1083 if (bSuccess)
1084 {
1085 SwPaM aBookmarkPam(*pCursorPos->GetPoint());
1086 aBookmarkPam.Move(fnMoveBackward, GoInContent);
1087
1088 // Paste HTML content.
1090 rWrtSh, pCursorPos, aBookmarkText.toUtf8(), /*bSetSelection=*/true);
1091 if (pCursorPos->GetPoint()->GetContentIndex() == 0)
1092 {
1093 // The paste created a last empty text node, remove it.
1094 SwPaM aPam(*pCursorPos->GetPoint());
1095 aPam.SetMark();
1098 }
1099
1100 // Undo the above SplitNode().
1101 aBookmarkPam.SetMark();
1102 aBookmarkPam.Move(fnMoveForward, GoInContent);
1104 aBookmarkPam);
1105 *aBookmarkPam.GetMark() = *pCursorPos->GetPoint();
1106 *pCursorPos = aBookmarkPam;
1107 }
1108 }
1109
1110 rWrtSh.SetBookmark( vcl::KeyCode(), sName );
1111 if (pBookmarkText)
1112 {
1113 pCursorPos->DeleteMark();
1114 }
1115 rWrtSh.EndAction();
1116 break;
1117 }
1118 [[fallthrough]];
1119 }
1120 case FN_EDIT_BOOKMARK:
1121 {
1122 ::std::optional<OUString> oName;
1123 if (pItem)
1124 {
1125 oName.emplace(static_cast<const SfxStringItem*>(pItem)->GetValue());
1126 }
1127 {
1129 ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSwInsertBookmarkDlg(GetView().GetFrameWeld(), rWrtSh, oName ? &*oName : nullptr));
1131 aContext.maEndDialogFn = [](sal_Int32){};
1132 pDlg->StartExecuteAsync(aContext);
1133 }
1134
1135 break;
1136 }
1138 {
1139 // This updates all bookmarks in the document that match the conditions specified in
1140 // rReq.
1141 UpdateBookmarks(rReq, rWrtSh);
1142 break;
1143 }
1144 case FN_UPDATE_BOOKMARK:
1145 {
1146 // This updates the bookmark under the cursor.
1147 UpdateBookmark(rReq, rWrtSh);
1148 break;
1149 }
1150 case FN_DELETE_BOOKMARK:
1151 {
1152 // This deletes a bookmark with the specified name.
1154 {
1155 IDocumentMarkAccess* const pMarkAccess = rWrtSh.getIDocumentMarkAccess();
1156 pMarkAccess->deleteMark(pMarkAccess->findMark(static_cast<const SfxStringItem*>(pItem)->GetValue()), false);
1157 }
1158 break;
1159 }
1161 {
1162 // This deletes all bookmarks in the document matching a specified prefix.
1163 DeleteBookmarks(rReq, rWrtSh);
1164 break;
1165 }
1166 case FN_DELETE_FIELDS:
1167 {
1168 // This deletes all fields in the document matching a specified type & prefix.
1169 DeleteFields(rReq, rWrtSh);
1170 break;
1171 }
1172 case FN_UPDATE_SECTIONS:
1173 {
1174 UpdateSections(rReq, rWrtSh);
1175 break;
1176 }
1177 case FN_DELETE_SECTIONS:
1178 {
1179 // This deletes all sections in the document matching a specified prefix. Note that the
1180 // section is deleted, but not its contents.
1181 DeleteSections(rReq, rWrtSh);
1182 break;
1183 }
1184 case FN_SET_REMINDER:
1185 {
1186 // collect and sort navigator reminder names
1187 IDocumentMarkAccess* const pMarkAccess = rWrtSh.getIDocumentMarkAccess();
1188 std::vector< OUString > vNavMarkNames;
1189 for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getAllMarksBegin();
1190 ppMark != pMarkAccess->getAllMarksEnd();
1191 ++ppMark)
1192 {
1194 vNavMarkNames.push_back((*ppMark)->GetName());
1195 }
1196 std::sort(vNavMarkNames.begin(), vNavMarkNames.end());
1197
1198 // we are maxed out so delete the first one
1199 // this assumes that IDocumentMarkAccess generates Names in ascending order
1200 if(vNavMarkNames.size() == MAX_MARKS)
1201 pMarkAccess->deleteMark(pMarkAccess->findMark(vNavMarkNames[0]), false);
1202
1204 SwView::SetActMark(vNavMarkNames.size() < MAX_MARKS ? vNavMarkNames.size() : MAX_MARKS-1);
1205
1206 break;
1207 }
1209 {
1210 SvxSwAutoFormatFlags aFlags(SvxAutoCorrCfg::Get().GetAutoCorrect()->GetSwFlags());
1211 // This must always be false for the postprocessing.
1212 aFlags.bAFormatByInput = false;
1213 aFlags.bWithRedlining = true;
1214 rWrtSh.AutoFormat( &aFlags );
1215 aFlags.bWithRedlining = false;
1216
1217 SfxViewFrame& rVFrame = GetView().GetViewFrame();
1218 if (rVFrame.HasChildWindow(FN_REDLINE_ACCEPT))
1220
1223
1224 xDlg->Execute();
1225 rReq.Done();
1226 }
1227 break;
1228
1230 {
1231 SvxSwAutoFormatFlags aFlags(SvxAutoCorrCfg::Get().GetAutoCorrect()->GetSwFlags());
1232 // This must always be false for the postprocessing.
1233 aFlags.bAFormatByInput = false;
1234 rWrtSh.AutoFormat( &aFlags );
1235 rReq.Done();
1236 }
1237 break;
1238 case FN_AUTOFORMAT_AUTO:
1239 {
1241 bool bSet = pItem ? static_cast<const SfxBoolItem*>(pItem)->GetValue() : !rACfg.IsAutoFormatByInput();
1242 if( bSet != rACfg.IsAutoFormatByInput() )
1243 {
1244 rACfg.SetAutoFormatByInput( bSet );
1245 rACfg.Commit();
1247 if ( !pItem )
1248 rReq.AppendItem( SfxBoolItem( GetPool().GetWhich(nSlot), bSet ) );
1249 rReq.Done();
1250 }
1251 }
1252 break;
1253 case FN_AUTO_CORRECT:
1254 {
1255 // At first set to blank as default.
1256 rWrtSh.AutoCorrect( *SvxAutoCorrCfg::Get().GetAutoCorrect(), ' ' );
1257 rReq.Done();
1258 }
1259 break;
1261 case FN_SORTING_DLG:
1262 {
1265 pDlg->Execute();
1266 rReq.Done();
1267 }
1268 break;
1270 {
1272 rReq.Done();
1273 }
1274 break;
1275 case FN_CALCULATE:
1276 {
1277 rtl::Reference<SwTransferable> pTransfer = new SwTransferable( rWrtSh );
1278 pTransfer->CalculateAndCopy();
1279 rReq.Done();
1280 }
1281 break;
1282 case FN_GOTO_REFERENCE:
1283 {
1284 SwField *pField = rWrtSh.GetCurField();
1285 if(pField && pField->GetTypeId() == SwFieldTypesEnum::GetRef)
1286 {
1287 rWrtSh.StartAllAction();
1288 rWrtSh.SwCursorShell::GotoRefMark( static_cast<SwGetRefField*>(pField)->GetSetRefName(),
1289 static_cast<SwGetRefField*>(pField)->GetSubType(),
1290 static_cast<SwGetRefField*>(pField)->GetSeqNo() );
1291 rWrtSh.EndAllAction();
1292 rReq.Done();
1293 }
1294 }
1295 break;
1296 case FN_EDIT_FORMULA:
1297 {
1298 const sal_uInt16 nId = SwInputChild::GetChildWindowId();
1299 SfxViewFrame& rVFrame = GetView().GetViewFrame();
1300 if(pItem)
1301 {
1302 //if the ChildWindow is active it has to be removed
1303 if( rVFrame.HasChildWindow( nId ) )
1304 {
1305 rVFrame.ToggleChildWindow( nId );
1306 rVFrame.GetBindings().InvalidateAll( true );
1307 }
1308
1309 OUString sFormula(static_cast<const SfxStringItem*>(pItem)->GetValue());
1310 SwFieldMgr aFieldMgr;
1311 rWrtSh.StartAllAction();
1312 bool bDelSel = rWrtSh.HasSelection();
1313 if( bDelSel )
1314 {
1315 rWrtSh.StartUndo( SwUndoId::START );
1316 rWrtSh.DelRight();
1317 }
1318 else
1319 {
1320 rWrtSh.EnterStdMode();
1321 }
1322
1323 if( !bDelSel && aFieldMgr.GetCurField() && SwFieldTypesEnum::Formel == aFieldMgr.GetCurTypeId() )
1324 aFieldMgr.UpdateCurField( aFieldMgr.GetCurField()->GetFormat(), OUString(), sFormula );
1325 else if( !sFormula.isEmpty() )
1326 {
1327 if( rWrtSh.IsCursorInTable() )
1328 {
1330 aSet.Put( SwTableBoxFormula( sFormula ));
1331 rWrtSh.SetTableBoxFormulaAttrs( aSet );
1332 rWrtSh.UpdateTable();
1333 }
1334 else
1335 {
1336 SvNumberFormatter* pFormatter = rWrtSh.GetNumberFormatter();
1337 const sal_uInt32 nSysNumFormat = pFormatter->GetFormatIndex( NF_NUMBER_STANDARD, LANGUAGE_SYSTEM);
1339 aFieldMgr.InsertField(aData);
1340 }
1341 }
1342
1343 if( bDelSel )
1344 rWrtSh.EndUndo( SwUndoId::END );
1345 rWrtSh.EndAllAction();
1346 rReq.Done();
1347 }
1348 else
1349 {
1350 rWrtSh.EndAllTableBoxEdit();
1351 rVFrame.ToggleChildWindow( nId );
1352 if( !rVFrame.HasChildWindow( nId ) )
1353 rVFrame.GetBindings().InvalidateAll( true );
1354 rReq.Ignore();
1355 }
1356 }
1357
1358 break;
1360 {
1361 rWrtSh.UnProtectTables();
1362 }
1363 break;
1364 case SID_EDIT_HYPERLINK:
1365 GetView().GetViewFrame().SetChildWindow(SID_HYPERLINK_DIALOG, true);
1366 break;
1367 case SID_REMOVE_HYPERLINK:
1368 {
1369 bool bSel = rWrtSh.HasSelection();
1370 if(!bSel)
1371 {
1372 rWrtSh.StartAction();
1373 rWrtSh.Push();
1374 if(!rWrtSh.SelectTextAttr( RES_TXTATR_INETFMT ))
1375 rWrtSh.SelWrd();
1376 }
1377 //now remove the attribute
1378 rWrtSh.ResetAttr({ RES_TXTATR_INETFMT });
1379 if(!bSel)
1380 {
1382 rWrtSh.EndAction();
1383 }
1384 }
1385 break;
1386 case SID_ATTR_BRUSH_CHAR :
1387 case SID_ATTR_CHAR_SCALEWIDTH :
1388 case SID_ATTR_CHAR_ROTATED :
1389 case FN_TXTATR_INET :
1391 {
1392 const sal_uInt16 nWhich = GetPool().GetWhich( nSlot );
1393 if ( pArgs && pArgs->GetItemState( nWhich ) == SfxItemState::SET )
1394 bUseDialog = false;
1395 [[fallthrough]];
1396 }
1397 case SID_CHAR_DLG:
1398 case SID_CHAR_DLG_EFFECT:
1399 case SID_CHAR_DLG_POSITION:
1400 {
1401 sw_CharDialog( rWrtSh, bUseDialog, nSlot, pArgs, &rReq );
1402 }
1403 break;
1404 case SID_CHAR_DLG_FOR_PARAGRAPH:
1405 {
1406 rWrtSh.Push(); //save current cursor
1408 sw_CharDialog( rWrtSh, bUseDialog, nSlot, pArgs, &rReq );
1409 rWrtSh.Pop(SwCursorShell::PopMode::DeleteCurrent); // restore old cursor
1410 }
1411 break;
1412 case SID_ATTR_LRSPACE :
1413 case SID_ATTR_ULSPACE :
1414 case SID_ATTR_BRUSH :
1415 case SID_PARA_VERTALIGN :
1416 case SID_ATTR_PARA_NUMRULE :
1417 case SID_ATTR_PARA_REGISTER :
1418 case SID_ATTR_PARA_PAGENUM :
1420 case FN_NUMBER_NEWSTART :
1422 case FN_FORMAT_DROPCAPS :
1423 case FN_DROP_TEXT:
1424 case SID_ATTR_PARA_LRSPACE:
1425 {
1426 const sal_uInt16 nWhich = GetPool().GetWhich( nSlot );
1427 if ( pArgs && pArgs->GetItemState( nWhich ) == SfxItemState::SET )
1428 bUseDialog = false;
1429 [[fallthrough]];
1430 }
1431 case SID_PARA_DLG:
1432 {
1433 SwPaM* pPaM = nullptr;
1434
1435 if ( pArgs )
1436 {
1437 const SwPaMItem* pPaMItem = pArgs->GetItemIfSet( GetPool().GetWhich( FN_PARAM_PAM ), false );
1438 if ( pPaMItem )
1439 pPaM = pPaMItem->GetValue( );
1440 }
1441
1442 if ( !pPaM )
1443 pPaM = rWrtSh.GetCursor();
1444
1445 FieldUnit eMetric = ::GetDfltMetric( dynamic_cast<SwWebView*>( &GetView()) != nullptr );
1446 SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
1447
1448 bool bApplyCharUnit = ::HasCharUnit( dynamic_cast<SwWebView*>( &GetView()) != nullptr );
1449 SW_MOD()->PutItem(SfxBoolItem(SID_ATTR_APPLYCHARUNIT, bApplyCharUnit));
1450
1453 // FillAttribute support:
1455 // Includes SID_ATTR_TABSTOP_POS:
1456 SID_ATTR_TABSTOP_DEFAULTS, SID_ATTR_TABSTOP_OFFSET,
1457 SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
1458 SID_ATTR_PARA_MODEL, SID_ATTR_PARA_KEEP,
1459 // Items to hand over XPropertyList things like XColorList,
1460 // XHatchList, XGradientList, and XBitmapList to the Area
1461 // TabPage:
1462 SID_COLOR_TABLE, SID_PATTERN_LIST,
1463 SID_HTML_MODE, SID_HTML_MODE,
1464 SID_ATTR_PARA_PAGENUM, SID_ATTR_PARA_PAGENUM,
1465 FN_PARAM_1, FN_PARAM_1,
1468
1469 // get also the list level indent values merged as LR-SPACE item, if needed.
1470 rWrtSh.GetPaMAttr( pPaM, aCoreSet, true );
1471
1472 // create needed items for XPropertyList entries from the DrawModel so that
1473 // the Area TabPage can access them
1474 // Do this after GetCurAttr, this resets the ItemSet content again
1476
1477 aCoreSet.Put(SvxColorListItem(pDrawModel->GetColorList(), SID_COLOR_TABLE));
1478 aCoreSet.Put(SvxGradientListItem(pDrawModel->GetGradientList(), SID_GRADIENT_LIST));
1479 aCoreSet.Put(SvxHatchListItem(pDrawModel->GetHatchList(), SID_HATCH_LIST));
1480 aCoreSet.Put(SvxBitmapListItem(pDrawModel->GetBitmapList(), SID_BITMAP_LIST));
1481 aCoreSet.Put(SvxPatternListItem(pDrawModel->GetPatternList(), SID_PATTERN_LIST));
1482 aCoreSet.Put(SfxUInt16Item(SID_HTML_MODE,
1483 ::GetHtmlMode(GetView().GetDocShell())));
1484
1485 // Tabulators: Put DefaultTabs into ItemSet
1486 const SvxTabStopItem& rDefTabs =
1488
1489 const sal_uInt16 nDefDist = o3tl::narrowing<sal_uInt16>(::GetTabDist( rDefTabs ));
1490 SfxUInt16Item aDefDistItem( SID_ATTR_TABSTOP_DEFAULTS, nDefDist );
1491 aCoreSet.Put( aDefDistItem );
1492
1493 // Current tabulator
1494 SfxUInt16Item aTabPos( SID_ATTR_TABSTOP_POS, 0 );
1495 aCoreSet.Put( aTabPos );
1496
1497 // Left border as offset
1498 //#i24363# tab stops relative to indent
1500 ? aCoreSet.Get(RES_MARGIN_TEXTLEFT).GetTextLeft() : 0;
1501 SfxInt32Item aOff( SID_ATTR_TABSTOP_OFFSET, nOff );
1502 aCoreSet.Put( aOff );
1503
1504 // Setting the BoxInfo
1505 ::PrepareBoxInfo( aCoreSet, rWrtSh );
1506
1507 // Current page format
1508 ::SwToSfxPageDescAttr( aCoreSet );
1509
1510 // Properties of numbering
1511 if (rWrtSh.GetNumRuleAtCurrCursorPos())
1512 {
1513 SfxBoolItem aStart( FN_NUMBER_NEWSTART, rWrtSh.IsNumRuleStart( pPaM ) );
1514 aCoreSet.Put(aStart);
1516 rWrtSh.GetNodeNumStart( pPaM ) );
1517 aCoreSet.Put(aStartAt);
1518 }
1520
1521 if ( bUseDialog && GetActiveView() )
1522 {
1523 OString sDefPage;
1524 if (pItem)
1525 sDefPage = OUStringToOString(static_cast<const SfxStringItem*>(pItem)->GetValue(), RTL_TEXTENCODING_UTF8);
1526
1528 pDlg.reset(pFact->CreateSwParaDlg(GetView().GetFrameWeld(), GetView(), aCoreSet, false, sDefPage));
1529 }
1530
1531 if ( !bUseDialog )
1532 {
1533 if ( nSlot == SID_ATTR_PARA_LRSPACE)
1534 {
1535 SvxLRSpaceItem aParaMargin(static_cast<const SvxLRSpaceItem&>(pArgs->Get(nSlot)));
1539 firstLine.SetTextFirstLineOffset(aParaMargin.GetTextFirstLineOffset(), aParaMargin.GetPropTextFirstLineOffset());
1540 firstLine.SetAutoFirst(aParaMargin.IsAutoFirst());
1541 leftMargin.SetTextLeft(aParaMargin.GetTextLeft(), aParaMargin.GetPropLeft());
1542 rightMargin.SetRight(aParaMargin.GetRight(), aParaMargin.GetPropRight());
1543 aCoreSet.Put(firstLine);
1544 aCoreSet.Put(leftMargin);
1545 aCoreSet.Put(rightMargin);
1546
1547 sw_ParagraphDialogResult(&aCoreSet, rWrtSh, rReq, pPaM);
1548 }
1549 else
1550 sw_ParagraphDialogResult(const_cast<SfxItemSet*>(pArgs), rWrtSh, rReq, pPaM);
1551 }
1552 else if (pDlg)
1553 {
1554 auto pRequest = std::make_shared<SfxRequest>(rReq);
1555 rReq.Ignore(); // the 'old' request is not relevant any more
1556
1557 auto vCursors = CopyPaMRing(*pPaM); // tdf#134439 make a copy to use at later apply
1558 pDlg->StartExecuteAsync([pDlg, &rWrtSh, pDrawModel, pRequest, nDefDist, vCursors](sal_Int32 nResult){
1559 if (nResult == RET_OK)
1560 {
1561 // Apply defaults if necessary.
1562 SfxItemSet* pSet = const_cast<SfxItemSet*>(pDlg->GetOutputItemSet());
1563 sal_uInt16 nNewDist;
1564 const SfxUInt16Item* pDefaultsItem = pSet->GetItemIfSet(SID_ATTR_TABSTOP_DEFAULTS, false);
1565 if (pDefaultsItem && nDefDist != (nNewDist = pDefaultsItem->GetValue()) )
1566 {
1567 SvxTabStopItem aDefTabs( 0, 0, SvxTabAdjust::Default, RES_PARATR_TABSTOP );
1568 MakeDefTabs( nNewDist, aDefTabs );
1569 rWrtSh.SetDefault( aDefTabs );
1570 pSet->ClearItem( SID_ATTR_TABSTOP_DEFAULTS );
1571 }
1572
1573 const SfxPoolItem* pItem2 = nullptr;
1574 if (SfxItemState::SET == pSet->GetItemState(FN_PARAM_1, false, &pItem2))
1575 {
1576 pSet->Put(SfxStringItem(FN_DROP_TEXT, static_cast<const SfxStringItem*>(pItem2)->GetValue()));
1577 pSet->ClearItem(FN_PARAM_1);
1578 }
1579
1580 if (const SwFormatDrop* pDropItem = pSet->GetItemIfSet(RES_PARATR_DROP, false))
1581 {
1582 OUString sCharStyleName;
1583 if (pDropItem->GetCharFormat())
1584 sCharStyleName = pDropItem->GetCharFormat()->GetName();
1586 }
1587
1588 const XFillGradientItem* pTempGradItem = pSet->GetItem<XFillGradientItem>(XATTR_FILLGRADIENT);
1589 if (pTempGradItem && pTempGradItem->GetName().isEmpty())
1590 {
1591 // MigrateItemSet guarantees unique gradient names
1593 aMigrateSet.Put(XFillGradientItem("gradient", pTempGradItem->GetGradientValue()));
1594 SdrModel::MigrateItemSet(&aMigrateSet, pSet, pDrawModel);
1595 }
1596
1597 const XFillHatchItem* pTempHatchItem = pSet->GetItem<XFillHatchItem>(XATTR_FILLHATCH);
1598 if (pTempHatchItem && pTempHatchItem->GetName().isEmpty())
1599 {
1601 aMigrateSet.Put(XFillHatchItem("hatch", pTempHatchItem->GetHatchValue()));
1602 SdrModel::MigrateItemSet(&aMigrateSet, pSet, pDrawModel);
1603 }
1604
1605 sw_ParagraphDialogResult(pSet, rWrtSh, *pRequest, vCursors->front().get());
1606 }
1607 pDlg->disposeOnce();
1608 });
1609 }
1610 }
1611 break;
1612 case FN_NUM_CONTINUE:
1613 {
1614 OUString sContinuedListId;
1615 const SwNumRule* pRule =
1616 rWrtSh.SearchNumRule( true, sContinuedListId );
1617 // #i86492#
1618 // Search also for bullet list
1619 if ( !pRule )
1620 {
1621 pRule = rWrtSh.SearchNumRule( false, sContinuedListId );
1622 }
1623 if ( pRule )
1624 {
1625 rWrtSh.SetCurNumRule( *pRule, false, sContinuedListId );
1626 }
1627 }
1628 break;
1629
1630 case FN_SELECT_PARA:
1631 {
1632 if ( !rWrtSh.IsSttOfPara() )
1633 rWrtSh.SttPara();
1634 else
1635 rWrtSh.EnterStdMode();
1636 rWrtSh.EndPara( true );
1637 }
1638 break;
1639
1640 case SID_DEC_INDENT:
1641 case SID_INC_INDENT:
1642 //According to the requirement, modified the behavior when user
1643 //using the indent button on the toolbar. Now if we increase/decrease indent for a
1644 //paragraph which has bullet style it will increase/decrease the bullet level.
1645 {
1646 //If the current paragraph has bullet call the function to
1647 //increase or decrease the bullet level.
1648 //Why could I know whether a paragraph has bullet or not by checking the below conditions?
1649 //Please refer to the "case KEY_TAB:" section in SwEditWin::KeyInput(..) :
1650 // if( rSh.GetCurNumRule() && rSh.IsSttOfPara() &&
1651 // !rSh.HasReadonlySel() )
1652 // eKeyState = KS_NumDown;
1653 //Above code demonstrates that when the cursor is at the start of a paragraph which has bullet,
1654 //press TAB will increase the bullet level.
1655 //So I copied from that ^^
1656 if ( rWrtSh.GetNumRuleAtCurrCursorPos() && !rWrtSh.HasReadonlySel() )
1657 {
1658 rWrtSh.NumUpDown( SID_INC_INDENT == nSlot );
1659 }
1660 else //execute the original processing functions
1661 {
1662 //below is copied of the old codes
1663 rWrtSh.MoveLeftMargin( SID_INC_INDENT == nSlot, rReq.GetModifier() != KEY_MOD1 );
1664 }
1665 }
1666 rReq.Done();
1667 break;
1668
1671 rWrtSh.MoveLeftMargin( FN_INC_INDENT_OFFSET == nSlot, rReq.GetModifier() == KEY_MOD1 );
1672 rReq.Done();
1673 break;
1674
1675 case SID_ATTR_CHAR_COLOR2:
1676 {
1677 if (pItem)
1678 {
1679 auto* pColorItem = static_cast<const SvxColorItem*>(pItem);
1680 SwEditWin& rEditWin = GetView().GetEditWin();
1681 rEditWin.SetWaterCanTextColor(pColorItem->GetValue());
1682 SwApplyTemplate* pApply = rEditWin.GetApplyTemplate();
1683
1684 // If there is a selection, then set the color on it
1685 // otherwise, it'll be the color for the next text to be typed
1686 if (!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_EXT)
1687 {
1688 rWrtSh.SetAttrItem(SvxColorItem(pColorItem->GetValue(), pColorItem->GetThemeColor(), RES_CHRATR_COLOR));
1689 }
1690
1691 rReq.Done();
1692 }
1693 }
1694 break;
1695 case SID_ATTR_CHAR_BACK_COLOR:
1696 case SID_ATTR_CHAR_COLOR_BACKGROUND: // deprecated
1697 case SID_ATTR_CHAR_COLOR_EXT:
1698 {
1699 Color aSet;
1700
1701 if (pItem)
1702 aSet = static_cast<const SvxColorItem*>(pItem)->GetValue();
1703 else
1704 aSet = COL_TRANSPARENT;
1705
1706 SwEditWin& rEdtWin = GetView().GetEditWin();
1707 if (nSlot != SID_ATTR_CHAR_COLOR_EXT)
1708 rEdtWin.SetWaterCanTextBackColor(aSet);
1709 else if (pItem)
1710 rEdtWin.SetWaterCanTextColor(aSet);
1711
1712 SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
1713 SwApplyTemplate aTempl;
1714 if (!pApply && (rWrtSh.HasSelection() || rReq.IsAPI()))
1715 {
1716 if (nSlot != SID_ATTR_CHAR_COLOR_EXT)
1717 {
1719
1720 rWrtSh.GetCurAttr( aCoreSet );
1721
1722 // Remove highlight if already set of the same color
1723 const SvxBrushItem& rBrushItem = aCoreSet.Get(RES_CHRATR_BACKGROUND);
1724 if ( aSet == rBrushItem.GetColor() )
1725 aSet = COL_TRANSPARENT;
1726
1727 ApplyCharBackground(aSet, rWrtSh);
1728 }
1729 else
1730 rWrtSh.SetAttrItem(
1732 }
1733 else
1734 {
1735 if(!pApply || pApply->nColor != nSlot)
1736 aTempl.nColor = nSlot;
1737 rEdtWin.SetApplyTemplate(aTempl);
1738 }
1739
1740 rReq.Done();
1741 }
1742 break;
1743
1745 if (!rWrtSh.IsAddMode())
1746 rWrtSh.MoveParagraph();
1747 rReq.Done();
1748 break;
1749
1751 if (!rWrtSh.IsAddMode())
1752 rWrtSh.MoveParagraph(SwNodeOffset(-1));
1753 rReq.Done();
1754 break;
1755 case SID_RUBY_DIALOG:
1756 case SID_HYPERLINK_DIALOG:
1757 {
1758 SfxRequest aReq(nSlot, SfxCallMode::SLOT, SfxGetpApp()->GetPool());
1759 GetView().GetViewFrame().ExecuteSlot( aReq);
1760 rReq.Ignore();
1761 }
1762 break;
1765 if(pArgs && pArgs->Count())
1766 {
1767 OUString sStyleName;
1768 if(pItem)
1769 sStyleName = static_cast<const SfxStringItem*>(pItem)->GetValue();
1770 bool bOn = true;
1771 if( SfxItemState::SET == pArgs->GetItemState(FN_PARAM_1, false, &pItem))
1772 bOn = static_cast<const SfxBoolItem*>(pItem)->GetValue();
1773 rWrtSh.ChangeHeaderOrFooter(sStyleName, FN_INSERT_PAGEHEADER == nSlot, bOn, !rReq.IsAPI());
1774 rReq.Done();
1775 }
1776 break;
1778 if(GetView().GetDocShell()->IsReadOnly())
1779 {
1782 rWrtSh.ShowCursor();
1783 }
1784 break;
1787 {
1788 bool bSetBlockMode = !rWrtSh.IsBlockMode();
1789 if( pArgs && SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem))
1790 bSetBlockMode = static_cast<const SfxBoolItem*>(pItem)->GetValue();
1791 if( ( nSlot == FN_SELECTION_MODE_DEFAULT ) != bSetBlockMode )
1792 rWrtSh.EnterBlockMode();
1793 else
1794 rWrtSh.EnterStdMode();
1797 rBnd.Update(FN_STAT_SELMODE);
1798 }
1799 break;
1800 case SID_OPEN_HYPERLINK:
1801 case SID_COPY_HYPERLINK_LOCATION:
1802 {
1804 rWrtSh.GetCurAttr(aSet);
1805 if(SfxItemState::SET <= aSet.GetItemState( RES_TXTATR_INETFMT ))
1806 {
1807 const SwFormatINetFormat& rINetFormat = aSet.Get(RES_TXTATR_INETFMT);
1808 if( nSlot == SID_COPY_HYPERLINK_LOCATION )
1809 {
1810 OUString hyperlinkLocation = rINetFormat.GetValue();
1811 ::uno::Reference< datatransfer::clipboard::XClipboard > xClipboard = GetView().GetEditWin().GetClipboard();
1812
1814 }
1815 else
1816 rWrtSh.ClickToINetAttr(rINetFormat);
1817 }
1818 else
1819 {
1820 SwField* pField = rWrtSh.GetCurField();
1821 if (pField && pField->GetTyp()->Which() == SwFieldIds::TableOfAuthorities)
1822 {
1823 const auto& rAuthorityField = *static_cast<const SwAuthorityField*>(pField);
1824 if (!rAuthorityField.UseTargetURL() && rAuthorityField.HasURL())
1825 {
1826 // Bibliography entry with URL also provides a hyperlink.
1827 const OUString& rURL
1828 = rAuthorityField.GetAuthEntry()->GetAuthorField(AUTH_FIELD_URL);
1829 ::LoadURL(rWrtSh, rURL, LoadUrlFlags::NewView, /*rTargetFrameName=*/OUString());
1830 }
1831 else if (rAuthorityField.UseTargetURL() && rAuthorityField.HasTargetURL())
1832 {
1833 // Bibliography entry with URL also provides a hyperlink.
1834 const OUString& rURL
1835 = rAuthorityField.GetAuthEntry()->GetAuthorField(AUTH_FIELD_TARGET_URL);
1836 ::LoadURL(rWrtSh, rURL, LoadUrlFlags::NewView, /*rTargetFrameName=*/OUString());
1837 }
1838 }
1839 }
1840 }
1841 break;
1842 case FN_OPEN_LOCAL_URL:
1843 {
1844 OUString aLocalURL = GetLocalURL(rWrtSh);
1845 if (!aLocalURL.isEmpty())
1846 {
1847 ::LoadURL(rWrtSh, aLocalURL, LoadUrlFlags::NewView, /*rTargetFrameName=*/OUString());
1848 }
1849 }
1850 break;
1851 case SID_OPEN_XML_FILTERSETTINGS:
1852 {
1854 }
1855 break;
1857 {
1858 }
1859 break;
1861 {
1862 }
1863 break;
1865 {
1866 }
1867 break;
1869 {
1870 }
1871 break;
1873 {
1874 }
1875 break;
1877 {
1878 GetView().UpdateWordCount(this, nSlot);
1879 }
1880 break;
1881 case FN_PROTECT_FIELDS:
1883 {
1885 DocumentSettingId aSettingId = nSlot == FN_PROTECT_FIELDS
1888 rIDSA.set(aSettingId, !rIDSA.get(aSettingId));
1889 // Invalidate so that toggle state gets updated
1890 SfxViewFrame& rViewFrame = GetView().GetViewFrame();
1891 rViewFrame.GetBindings().Invalidate(nSlot);
1892 rViewFrame.GetBindings().Update(nSlot);
1893 }
1894 break;
1895 case SID_FM_CTL_PROPERTIES:
1896 {
1897 SwPosition aPos(*GetShell().GetCursor()->GetPoint());
1898 sw::mark::IFieldmark* pFieldBM = GetShell().getIDocumentMarkAccess()->getInnerFieldmarkFor(aPos);
1899 if ( !pFieldBM )
1900 {
1901 aPos.AdjustContent(-1);
1903 }
1904
1905 if ( pFieldBM && pFieldBM->GetFieldname() == ODF_FORMDROPDOWN
1906 && !(rWrtSh.GetCurrSection() && rWrtSh.GetCurrSection()->IsProtect()) )
1907 {
1910 if (pDlg->Execute() == RET_OK)
1911 {
1912 pFieldBM->Invalidate();
1913 rWrtSh.InvalidateWindows( SwRect(rWrtSh.GetView().GetVisArea()) );
1914 rWrtSh.UpdateCursor(); // cursor position might be invalid
1915 }
1916 }
1917 else if ( pFieldBM && pFieldBM->GetFieldname() == ODF_FORMDATE )
1918 {
1920 sw::mark::DateFieldmark& rDateField = dynamic_cast<sw::mark::DateFieldmark&>(*pFieldBM);
1921 ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateDateFormFieldDialog(rWrtSh.GetView().GetFrameWeld(), &rDateField, *GetView().GetDocShell()->GetDoc()));
1922 if (pDlg->Execute() == RET_OK)
1923 {
1924 rDateField.Invalidate();
1925 rWrtSh.InvalidateWindows( SwRect(rWrtSh.GetView().GetVisArea()) );
1926 rWrtSh.UpdateCursor(); // cursor position might be invalid
1927 }
1928 }
1929 else
1930 {
1931 SfxRequest aReq(GetView().GetViewFrame(), SID_FM_CTL_PROPERTIES);
1932 aReq.AppendItem( SfxBoolItem( SID_FM_CTL_PROPERTIES, true ) );
1933 rWrtSh.GetView().GetFormShell()->Execute( aReq );
1934 }
1935 }
1936 break;
1937 case SID_FM_TRANSLATE:
1938 {
1939#if !ENABLE_WASM_STRIP_EXTRA
1940 const SfxPoolItem* pTargetLangStringItem = nullptr;
1941 if (pArgs && SfxItemState::SET == pArgs->GetItemState(SID_ATTR_TARGETLANG_STR, false, &pTargetLangStringItem))
1942 {
1943 std::optional<OUString> oDeeplAPIUrl = officecfg::Office::Linguistic::Translation::Deepl::ApiURL::get();
1944 std::optional<OUString> oDeeplKey = officecfg::Office::Linguistic::Translation::Deepl::AuthKey::get();
1945 if (!oDeeplAPIUrl || oDeeplAPIUrl->isEmpty() || !oDeeplKey || oDeeplKey->isEmpty())
1946 {
1947 SAL_WARN("sw.ui", "SID_FM_TRANSLATE: API options are not set");
1948 break;
1949 }
1950 const OString aAPIUrl = OUStringToOString(rtl::Concat2View(*oDeeplAPIUrl + "?tag_handling=html"), RTL_TEXTENCODING_UTF8).trim();
1951 const OString aAuthKey = OUStringToOString(*oDeeplKey, RTL_TEXTENCODING_UTF8).trim();
1952 OString aTargetLang = OUStringToOString(static_cast<const SfxStringItem*>(pTargetLangStringItem)->GetValue(), RTL_TEXTENCODING_UTF8);
1953 SwTranslateHelper::TranslateAPIConfig aConfig({aAPIUrl, aAuthKey, aTargetLang});
1954 SwTranslateHelper::TranslateDocument(rWrtSh, aConfig);
1955 }
1956 else
1957 {
1959 std::shared_ptr<AbstractSwTranslateLangSelectDlg> pAbstractDialog(pFact->CreateSwTranslateLangSelectDlg(GetView().GetFrameWeld(), rWrtSh));
1960 std::shared_ptr<weld::DialogController> pDialogController(pAbstractDialog->getDialogController());
1961 weld::DialogController::runAsync(pDialogController, [] (sal_Int32 /*nResult*/) { });
1962 }
1963#endif // ENABLE_WASM_STRIP_EXTRA
1964 }
1965 break;
1966 case SID_SPELLCHECK_IGNORE:
1967 {
1968 SwPaM *pPaM = rWrtSh.GetCursor();
1969 if (pPaM)
1971 }
1972 break;
1973 case SID_SPELLCHECK_IGNORE_ALL:
1974 {
1975 OUString sApplyText;
1976 const SfxStringItem* pItem2 = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
1977 if (pItem2)
1978 sApplyText = pItem2->GetValue();
1979
1980 if(sApplyText == "Grammar")
1981 {
1982 linguistic2::ProofreadingResult aGrammarCheckRes;
1983 sal_Int32 nErrorInResult = -1;
1984 uno::Sequence< OUString > aSuggestions;
1985 sal_Int32 nErrorPosInText = -1;
1986 SwRect aToFill;
1987 bool bCorrectionRes = rWrtSh.GetGrammarCorrection( aGrammarCheckRes, nErrorPosInText, nErrorInResult, aSuggestions, nullptr, aToFill );
1988 if(bCorrectionRes)
1989 {
1990 try {
1991 uno::Reference< linguistic2::XDictionary > xDictionary = LinguMgr::GetIgnoreAllList();
1992 aGrammarCheckRes.xProofreader->ignoreRule(
1993 aGrammarCheckRes.aErrors[ nErrorInResult ].aRuleIdentifier,
1994 aGrammarCheckRes.aLocale );
1995 // refresh the layout of the actual paragraph (faster)
1996 SwPaM *pPaM = rWrtSh.GetCursor();
1997 if (pPaM)
1999 if (xDictionary.is())
2000 {
2001 // refresh the layout of all paragraphs (workaround to launch a dictionary event)
2002 xDictionary->setActive(false);
2003 xDictionary->setActive(true);
2004 }
2005 }
2006 catch( const uno::Exception& )
2007 {
2008 }
2009 }
2010 }
2011 else if (sApplyText == "Spelling")
2012 {
2013 SwRect aToFill;
2014 uno::Reference<linguistic2::XSpellAlternatives> xSpellAlt(rWrtSh.GetCorrection(nullptr, aToFill));
2015 if (!xSpellAlt.is())
2016 return;
2017 uno::Reference< linguistic2::XDictionary > xDictionary = LinguMgr::GetIgnoreAllList();
2018 OUString sWord(xSpellAlt->getWord());
2020 sWord, false, OUString() );
2021 if (linguistic::DictionaryError::NONE != nAddRes && xDictionary.is() && !xDictionary->getEntry(sWord).is())
2022 {
2023 SvxDicError(rWrtSh.GetView().GetFrameWeld(), nAddRes);
2024 }
2025 }
2026 }
2027 break;
2028 case SID_SPELLCHECK_APPLY_SUGGESTION:
2029 {
2030 OUString sApplyText;
2031 const SfxStringItem* pItem2 = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
2032 if (pItem2)
2033 sApplyText = pItem2->GetValue();
2034
2035 static const OUStringLiteral sSpellingRule(u"Spelling_");
2036 static const OUStringLiteral sGrammarRule(u"Grammar_");
2037
2038 bool bGrammar = false;
2039 sal_Int32 nPos = 0;
2040 uno::Reference< linguistic2::XSpellAlternatives > xSpellAlt;
2041 if(-1 != (nPos = sApplyText.indexOf( sGrammarRule )))
2042 {
2043 sApplyText = sApplyText.replaceAt(nPos, sGrammarRule.getLength(), u"");
2044 bGrammar = true;
2045 }
2046 else if (-1 != (nPos = sApplyText.indexOf( sSpellingRule )))
2047 {
2048 sApplyText = sApplyText.replaceAt(nPos, sSpellingRule.getLength(), u"");
2049 SwRect aToFill;
2050 xSpellAlt.set(rWrtSh.GetCorrection(nullptr, aToFill));
2051 bGrammar = false;
2052 }
2053
2054 if (!bGrammar && !xSpellAlt.is())
2055 return;
2056
2057 bool bOldIns = rWrtSh.IsInsMode();
2058 rWrtSh.SetInsMode();
2059
2060 OUString aTmp( sApplyText );
2061 OUString aOrig( bGrammar ? OUString() : xSpellAlt->getWord() );
2062
2063 // if original word has a trailing . (likely the end of a sentence)
2064 // and the replacement text hasn't, then add it to the replacement
2065 if (!aTmp.isEmpty() && !aOrig.isEmpty() &&
2066 aOrig.endsWith(".") && /* !IsAlphaNumeric ??*/
2067 !aTmp.endsWith("."))
2068 {
2069 aTmp += ".";
2070 }
2071
2072 SwRewriter aRewriter;
2073
2074 aRewriter.AddRule(UndoArg1, rWrtSh.GetCursorDescr()
2075 // don't show the hidden control character of the comment
2076 .replaceAll(OUStringChar(CH_TXTATR_INWORD), "") );
2077 aRewriter.AddRule(UndoArg2, SwResId(STR_YIELDS));
2078
2079 OUString aTmpStr = SwResId(STR_START_QUOTE) +
2080 aTmp + SwResId(STR_END_QUOTE);
2081 aRewriter.AddRule(UndoArg3, aTmpStr);
2082
2083 rWrtSh.StartUndo(SwUndoId::UI_REPLACE, &aRewriter);
2084 rWrtSh.StartAction();
2085
2086 // if there is a comment inside the original word, don't delete it:
2087 // but keep it at the end of the replacement
2088 // TODO: keep all the comments with a recursive function
2089
2090 if (SwPaM *pPaM = rWrtSh.GetCursor())
2091 {
2092 sal_Int32 nCommentPos(pPaM->GetText().indexOf(OUStringChar(CH_TXTATR_INWORD)));
2093 if ( nCommentPos > -1 )
2094 {
2095
2096 // delete the original word after the comment
2097 pPaM->GetPoint()->AdjustContent(nCommentPos + 1);
2098 rWrtSh.Replace(OUString(), false);
2099 // and select only the remaining part before the comment
2100 pPaM->GetPoint()->AdjustContent(-(nCommentPos + 1));
2101 pPaM->GetMark()->AdjustContent(-1);
2102 }
2103 }
2104
2105 rWrtSh.Replace(aTmp, false);
2106
2107 rWrtSh.EndAction();
2108 rWrtSh.EndUndo();
2109
2110 rWrtSh.SetInsMode( bOldIns );
2111 }
2112 break;
2113 default:
2114 OSL_ENSURE(false, "wrong dispatcher");
2115 return;
2116 }
2117}
2118
2120{
2121 SwWrtShell &rSh = GetShell();
2122 SfxWhichIter aIter( rSet );
2123 sal_uInt16 nWhich = aIter.FirstWhich();
2124 while ( nWhich )
2125 {
2126 switch ( nWhich )
2127 {
2129 if( !rSh.IsCursorInFootnote() )
2130 rSet.DisableItem( nWhich );
2131 break;
2132
2133 case SID_LANGUAGE_STATUS:
2134 {
2135 // the value of used script types
2136 OUString aScriptTypesInUse( OUString::number( static_cast<int>(rSh.GetScriptType()) ) );
2137
2138 // get keyboard language
2139 OUString aKeyboardLang;
2140 SwEditWin& rEditWin = GetView().GetEditWin();
2141 LanguageType nLang = rEditWin.GetInputLanguage();
2143 aKeyboardLang = SvtLanguageTable::GetLanguageString( nLang );
2144
2145 // get the language that is in use
2146 OUString aCurrentLang = "*";
2148 if (nLang != LANGUAGE_DONTKNOW)
2149 {
2152 {
2153 if (nLang == LANGUAGE_NONE)
2154 {
2155 aCurrentLang += ";-";
2156 }
2157 else
2158 {
2159 aCurrentLang += ";" + LanguageTag(nLang).getBcp47(false);
2160 }
2161 }
2162 }
2163
2164 // build sequence for status value
2165 uno::Sequence< OUString > aSeq{ aCurrentLang,
2166 aScriptTypesInUse,
2167 aKeyboardLang,
2169
2170 // set sequence as status value
2171 SfxStringListItem aItem( SID_LANGUAGE_STATUS );
2172 aItem.SetStringList( aSeq );
2173 rSet.Put( aItem );
2174 }
2175 break;
2176
2177 case SID_THES:
2178 {
2179 // is there a valid selection to get text from?
2180 OUString aText;
2181 bool bValid = !rSh.HasSelection() ||
2182 (rSh.IsSelOnePara() && !rSh.IsMultiSelection());
2183 // prevent context menu from showing when cursor is not in or at the end of a word
2184 // (GetCurWord will return the next word if there is none at the current position...)
2185 const sal_Int16 nWordType = ::i18n::WordType::DICTIONARY_WORD;
2186 bool bWord = rSh.IsInWord( nWordType ) || rSh.IsStartWord( nWordType ) || rSh.IsEndWord( nWordType );
2187 if (bValid && bWord)
2188 aText = rSh.HasSelection()? rSh.GetSelText() : rSh.GetCurWord();
2189
2191 LanguageTag aLanguageTag( nLang);
2192 const lang::Locale& aLocale( aLanguageTag.getLocale());
2193
2194 // disable "Thesaurus" context menu entry if there is nothing to look up
2195 uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() );
2196 if (aText.isEmpty() ||
2197 !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale ))
2198 rSet.DisableItem( SID_THES );
2199 else
2200 {
2201 // set word and locale to look up as status value
2202 OUString aStatusVal = aText + "#" + aLanguageTag.getBcp47();
2203 rSet.Put( SfxStringItem( SID_THES, aStatusVal ) );
2204 }
2205 }
2206 break;
2207
2208 case FN_NUMBER_NEWSTART :
2209 if(!rSh.GetNumRuleAtCurrCursorPos())
2210 rSet.DisableItem(nWhich);
2211 else
2213 rSh.IsNumRuleStart()));
2214 break;
2215
2216 case FN_EDIT_FORMULA:
2217 case SID_CHARMAP:
2218 case SID_CHARMAP_CONTROL:
2219 {
2220 const SelectionType nType = rSh.GetSelectionType();
2221 if (!(nType & SelectionType::Text) &&
2224 {
2225 rSet.DisableItem(nWhich);
2226 }
2227 else if ( nWhich == FN_EDIT_FORMULA
2228 && rSh.CursorInsideInputField() )
2229 {
2230 rSet.DisableItem( nWhich );
2231 }
2232 }
2233 break;
2234
2235 case FN_INSERT_ENDNOTE:
2236 case FN_INSERT_FOOTNOTE:
2238 {
2239 const FrameTypeFlags nNoType =
2241 if ( rSh.GetFrameType(nullptr,true) & nNoType )
2242 rSet.DisableItem(nWhich);
2243
2244 if ( rSh.CursorInsideInputField() )
2245 {
2246 rSet.DisableItem( nWhich );
2247 }
2248 }
2249 break;
2250
2252 case SID_INSERTDOC:
2253 case FN_INSERT_GLOSSARY:
2254 case FN_EXPAND_GLOSSARY:
2255 if ( rSh.CursorInsideInputField() )
2256 {
2257 rSet.DisableItem( nWhich );
2258 }
2259 break;
2260
2261 case FN_INSERT_TABLE:
2262 if ( rSh.CursorInsideInputField()
2263 || rSh.GetTableFormat()
2264 || (rSh.GetFrameType(nullptr,true) & FrameTypeFlags::FOOTNOTE) )
2265 {
2266 rSet.DisableItem( nWhich );
2267 }
2268 break;
2269
2270 case FN_CALCULATE:
2271 if ( !rSh.IsSelection() )
2272 rSet.DisableItem(nWhich);
2273 break;
2274 case FN_GOTO_REFERENCE:
2275 {
2276 SwField *pField = rSh.GetCurField();
2277 if ( !pField || (pField->GetTypeId() != SwFieldTypesEnum::GetRef) )
2278 rSet.DisableItem(nWhich);
2279 }
2280 break;
2281 case FN_AUTOFORMAT_AUTO:
2282 {
2283 rSet.Put( SfxBoolItem( nWhich, SvxAutoCorrCfg::Get().IsAutoFormatByInput() ));
2284 }
2285 break;
2286
2287 case SID_DEC_INDENT:
2288 case SID_INC_INDENT:
2289 {
2290 //if the paragraph has bullet we'll do the following things:
2291 //1: if the bullet level is the first level, disable the decrease-indent button
2292 //2: if the bullet level is the last level, disable the increase-indent button
2293 if ( rSh.GetNumRuleAtCurrCursorPos() && !rSh.HasReadonlySel() )
2294 {
2295 const sal_uInt8 nLevel = rSh.GetNumLevel();
2296 if ( ( nLevel == ( MAXLEVEL - 1 ) && nWhich == SID_INC_INDENT )
2297 || ( nLevel == 0 && nWhich == SID_DEC_INDENT ) )
2298 {
2299 rSet.DisableItem( nWhich );
2300 }
2301 }
2302 else
2303 {
2304 sal_uInt16 nHtmlMode = ::GetHtmlMode( GetView().GetDocShell() );
2305 nHtmlMode &= HTMLMODE_ON | HTMLMODE_SOME_STYLES;
2306 if ( ( nHtmlMode == HTMLMODE_ON )
2307 || !rSh.IsMoveLeftMargin( SID_INC_INDENT == nWhich ) )
2308 {
2309 rSet.DisableItem( nWhich );
2310 }
2311 }
2312 }
2313 break;
2314
2317 {
2318 sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
2319 nHtmlMode &= HTMLMODE_ON|HTMLMODE_SOME_STYLES;
2320 if( (nHtmlMode == HTMLMODE_ON) ||
2321 !rSh.IsMoveLeftMargin( FN_INC_INDENT_OFFSET == nWhich,
2322 false ))
2323 rSet.DisableItem( nWhich );
2324 }
2325 break;
2326
2327 case SID_ATTR_CHAR_COLOR2:
2328 {
2329 SfxItemSet aSet( GetPool() );
2330 rSh.GetCurAttr( aSet );
2331 const SvxColorItem& aColorItem = aSet.Get(RES_CHRATR_COLOR);
2332 rSet.Put( aColorItem.CloneSetWhich(SID_ATTR_CHAR_COLOR2) );
2333 }
2334 break;
2335 case SID_ATTR_CHAR_BACK_COLOR:
2336 case SID_ATTR_CHAR_COLOR_BACKGROUND:
2337 {
2338 // Always use the visible background
2339 SfxItemSet aSet( GetPool() );
2340 rSh.GetCurAttr( aSet );
2341 const SvxBrushItem& aBrushItem = aSet.Get(RES_CHRATR_HIGHLIGHT);
2342 if( aBrushItem.GetColor() != COL_TRANSPARENT )
2343 {
2344 rSet.Put( SvxColorItem(aBrushItem.GetColor(), nWhich) );
2345 }
2346 else
2347 {
2348 const SvxBrushItem& aBrushItem2 = aSet.Get(RES_CHRATR_BACKGROUND);
2349 rSet.Put( SvxColorItem(aBrushItem2.GetColor(), nWhich) );
2350 }
2351 }
2352 break;
2353 case SID_ATTR_CHAR_COLOR_BACKGROUND_EXT:
2354 {
2355 SwEditWin& rEdtWin = GetView().GetEditWin();
2356 SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
2357 const sal_uInt32 nColWhich = pApply ? pApply->nColor : 0;
2358 const bool bUseTemplate = nColWhich == SID_ATTR_CHAR_BACK_COLOR
2359 || nColWhich == SID_ATTR_CHAR_COLOR_BACKGROUND;
2360 rSet.Put(SfxBoolItem(nWhich, bUseTemplate));
2361 }
2362 break;
2363 case SID_ATTR_CHAR_COLOR_EXT:
2364 {
2365 SwEditWin& rEdtWin = GetView().GetEditWin();
2366 SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
2367 rSet.Put(SfxBoolItem(nWhich, pApply && pApply->nColor == nWhich));
2368 }
2369 break;
2370 case FN_SET_REMINDER:
2371 case FN_INSERT_BOOKMARK:
2372 if( rSh.IsTableMode()
2373 || rSh.CursorInsideInputField() )
2374 {
2375 rSet.DisableItem( nWhich );
2376 }
2377 break;
2378
2379 case FN_INSERT_BREAK:
2380 if ( rSh.HasReadonlySel()
2381 && !rSh.CursorInsideInputField() )
2382 {
2383 rSet.DisableItem( nWhich );
2384 }
2385 break;
2386
2391 {
2392 rSet.DisableItem( nWhich );
2393 }
2394 break;
2395
2399 {
2400 bool bState = false;
2401 bool bAllState = true;
2402 bool bIsPhysical = false;
2403
2404 OUString aStyleName;
2405 std::vector<OUString> aList;
2406 static const OUStringLiteral sPhysical(u"IsPhysical");
2407 static const OUStringLiteral sDisplay(u"DisplayName");
2408 const OUString sHeaderOn(nWhich == FN_INSERT_PAGEHEADER ? OUString("HeaderIsOn") : OUString("FooterIsOn"));
2409
2410 uno::Reference< XStyleFamiliesSupplier > xSupplier(GetView().GetDocShell()->GetBaseModel(), uno::UNO_QUERY);
2411 if (xSupplier.is())
2412 {
2413 uno::Reference< XNameContainer > xContainer;
2414 uno::Reference< XNameAccess > xFamilies = xSupplier->getStyleFamilies();
2415 if (xFamilies->getByName("PageStyles") >>= xContainer)
2416 {
2417 const uno::Sequence< OUString > aSeqNames = xContainer->getElementNames();
2418 for (const auto& rName : aSeqNames)
2419 {
2420 aStyleName = rName;
2421 uno::Reference<XPropertySet> xPropSet(xContainer->getByName(aStyleName), uno::UNO_QUERY);
2422 if (xPropSet.is() && (xPropSet->getPropertyValue(sPhysical) >>= bIsPhysical) && bIsPhysical)
2423 {
2424 xPropSet->getPropertyValue(sDisplay) >>= aStyleName;
2425 if ((xPropSet->getPropertyValue(sHeaderOn)>>= bState) && bState)
2426 aList.push_back(aStyleName);
2427 else
2428 bState = false;
2429
2430 // Check if all entries have the same state
2431 bAllState &= bState;
2432 }
2433 else
2434 bIsPhysical = false;
2435 }
2436 }
2437 }
2438
2439 if (bAllState && aList.size() > 1)
2440 aList.push_back("_ALL_");
2441
2442 rSet.Put(SfxStringListItem(nWhich, &aList));
2443 }
2444 else
2445 {
2446 rSet.Put( SfxObjectShellItem( nWhich, GetView().GetDocShell() ));
2447 }
2448 break;
2450 case FN_SORTING_DLG:
2451 if(!rSh.HasSelection() ||
2452 (FN_TABLE_SORT_DIALOG == nWhich && !rSh.GetTableFormat()))
2453 rSet.DisableItem( nWhich );
2454 break;
2455
2456 case SID_RUBY_DIALOG:
2457 {
2459 || rSh.CursorInsideInputField() )
2460 {
2461 GetView().GetViewFrame().GetBindings().SetVisibleState( nWhich, false );
2462 rSet.DisableItem(nWhich);
2463 }
2464 else
2465 GetView().GetViewFrame().GetBindings().SetVisibleState( nWhich, true );
2466 }
2467 break;
2468
2469 case SID_FM_TRANSLATE:
2470 {
2471#if !ENABLE_WASM_STRIP_EXTRA
2474 {
2475 rSet.Put(SfxVisibilityItem(nWhich, false));
2476 break;
2477 }
2478 std::optional<OUString> oDeeplAPIUrl = officecfg::Office::Linguistic::Translation::Deepl::ApiURL::get();
2479 std::optional<OUString> oDeeplKey = officecfg::Office::Linguistic::Translation::Deepl::AuthKey::get();
2480 if (!oDeeplAPIUrl || oDeeplAPIUrl->isEmpty() || !oDeeplKey || oDeeplKey->isEmpty())
2481 {
2482 rSet.DisableItem(nWhich);
2483 }
2484#endif
2485 }
2486 break;
2487
2488 case SID_HYPERLINK_DIALOG:
2489 if( GetView().GetDocShell()->IsReadOnly()
2490 || ( !GetView().GetViewFrame().HasChildWindow(nWhich)
2491 && rSh.HasReadonlySel() )
2492 || rSh.CursorInsideInputField() )
2493 {
2494 rSet.DisableItem(nWhich);
2495 }
2496 else
2497 {
2498 rSet.Put(SfxBoolItem( nWhich, nullptr != GetView().GetViewFrame().GetChildWindow( nWhich ) ));
2499 }
2500 break;
2501
2502 case SID_EDIT_HYPERLINK:
2503 case SID_COPY_HYPERLINK_LOCATION:
2504 {
2506 rSh.GetCurAttr(aSet);
2507 if(SfxItemState::SET > aSet.GetItemState( RES_TXTATR_INETFMT ) || rSh.HasReadonlySel())
2508 {
2509 rSet.DisableItem(nWhich);
2510 }
2511 }
2512 break;
2513 case SID_REMOVE_HYPERLINK:
2514 {
2516 rSh.GetCurAttr(aSet);
2517
2518 // If a hyperlink is selected, either alone or along with other text...
2519 if ((aSet.GetItemState(RES_TXTATR_INETFMT) < SfxItemState::SET &&
2520 aSet.GetItemState(RES_TXTATR_INETFMT) != SfxItemState::DONTCARE) ||
2521 rSh.HasReadonlySel())
2522 {
2523 rSet.DisableItem(nWhich);
2524 }
2525 }
2526 break;
2527 case SID_TRANSLITERATE_HALFWIDTH:
2528 case SID_TRANSLITERATE_FULLWIDTH:
2529 case SID_TRANSLITERATE_HIRAGANA:
2530 case SID_TRANSLITERATE_KATAKANA:
2531 {
2533 {
2534 GetView().GetViewFrame().GetBindings().SetVisibleState( nWhich, false );
2535 rSet.DisableItem(nWhich);
2536 }
2537 else
2538 GetView().GetViewFrame().GetBindings().SetVisibleState( nWhich, true );
2539 }
2540 break;
2542 if(!GetView().GetDocShell()->IsReadOnly())
2543 rSet.DisableItem( nWhich );
2544 else
2545 {
2547 }
2548 break;
2551 rSet.Put(SfxBoolItem(nWhich, (nWhich == FN_SELECTION_MODE_DEFAULT) != rSh.IsBlockMode()));
2552 break;
2553 case SID_OPEN_HYPERLINK:
2554 {
2556 rSh.GetCurAttr(aSet);
2557
2558 bool bAuthorityFieldURL = false;
2559 SwField* pField = rSh.GetCurField();
2560 if (pField && pField->GetTyp()->Which() == SwFieldIds::TableOfAuthorities)
2561 {
2562 // Bibliography entry with URL also provides a hyperlink.
2563 const auto& rAuthorityField = *static_cast<const SwAuthorityField*>(pField);
2564 if (!rAuthorityField.UseTargetURL())
2565 bAuthorityFieldURL = rAuthorityField.HasURL();
2566 else
2567 bAuthorityFieldURL = rAuthorityField.HasTargetURL();
2568 }
2569 if (SfxItemState::SET > aSet.GetItemState(RES_TXTATR_INETFMT, false)
2570 && !bAuthorityFieldURL)
2571 rSet.DisableItem(nWhich);
2572 }
2573 break;
2574 case FN_OPEN_LOCAL_URL:
2575 {
2576 if (GetLocalURL(rSh).isEmpty())
2577 {
2578 rSet.DisableItem(nWhich);
2579 }
2580 }
2581 break;
2582 case SID_OPEN_SMARTTAGMENU:
2583 {
2584 std::vector< OUString > aSmartTagTypes;
2585 uno::Sequence< uno::Reference< container::XStringKeyMap > > aStringKeyMaps;
2586 uno::Reference<text::XTextRange> xRange;
2587
2588 rSh.GetSmartTagTerm( aSmartTagTypes, aStringKeyMaps, xRange );
2589
2590 if ( xRange.is() && !aSmartTagTypes.empty() )
2591 {
2592 uno::Sequence < uno::Sequence< uno::Reference< smarttags::XSmartTagAction > > > aActionComponentsSequence;
2593 uno::Sequence < uno::Sequence< sal_Int32 > > aActionIndicesSequence;
2594
2595 const SmartTagMgr& rSmartTagMgr = SwSmartTagMgr::Get();
2596 rSmartTagMgr.GetActionSequences( aSmartTagTypes,
2597 aActionComponentsSequence,
2598 aActionIndicesSequence );
2599
2600 uno::Reference <frame::XController> xController = GetView().GetController();
2601 lang::Locale aLocale( SW_BREAKITER()->GetLocale( GetAppLanguageTag() ) );
2602 const OUString& aApplicationName( rSmartTagMgr.GetApplicationName() );
2603 const OUString aRangeText = xRange->getString();
2604
2605 const SvxSmartTagItem aItem( SID_OPEN_SMARTTAGMENU,
2606 aActionComponentsSequence,
2607 aActionIndicesSequence,
2608 aStringKeyMaps,
2609 xRange,
2611 std::move(aLocale),
2612 aApplicationName,
2613 aRangeText );
2614
2615 rSet.Put( aItem );
2616 }
2617 else
2618 rSet.DisableItem(nWhich);
2619 }
2620 break;
2621
2622 case FN_NUM_NUMBERING_ON:
2623 rSet.Put(SfxBoolItem(FN_NUM_NUMBERING_ON,rSh.SelectionHasNumber()));
2624 break;
2625
2626 case FN_NUM_BULLET_ON:
2627 rSet.Put(SfxBoolItem(FN_NUM_BULLET_ON,rSh.SelectionHasBullet()));
2628 break;
2629
2630 case FN_NUM_BULLET_OFF:
2633 break;
2634
2635 case FN_SVX_SET_OUTLINE:
2636 {
2637 NBOTypeMgrBase* pOutline = NBOutlineTypeMgrFact::CreateInstance(NBOType::Outline);
2638 auto pCurRule = const_cast<SwNumRule*>(rSh.GetNumRuleAtCurrCursorPos());
2639 if (pOutline && pCurRule)
2640 {
2641 SvxNumRule aSvxRule = pCurRule->MakeSvxNumRule();
2642 const sal_uInt16 nIndex = pOutline->GetNBOIndexForNumRule(aSvxRule, 0);
2643 rSet.Put(SfxBoolItem(FN_SVX_SET_OUTLINE, nIndex < USHRT_MAX));
2644 }
2645 break;
2646 }
2647 case FN_BUL_NUM_RULE_INDEX:
2648 case FN_NUM_NUM_RULE_INDEX:
2649 case FN_OUTLINE_RULE_INDEX:
2650 {
2651 SwNumRule* pCurRule = const_cast<SwNumRule*>(GetShell().GetNumRuleAtCurrCursorPos());
2652 if( pCurRule )
2653 {
2654 sal_uInt16 nActNumLvl = GetShell().GetNumLevel();
2655 if( nActNumLvl < MAXLEVEL )
2656 {
2657 nActNumLvl = 1<<nActNumLvl;
2658 }
2659 SvxNumRule aSvxRule = pCurRule->MakeSvxNumRule();
2660 if ( GetShell().HasBullet())
2661 {
2662 rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX, USHRT_MAX));
2663 rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX, USHRT_MAX));
2664 NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(NBOType::Bullets);
2665 if ( pBullets )
2666 {
2667 const sal_uInt16 nBulIndex = pBullets->GetNBOIndexForNumRule(aSvxRule,nActNumLvl);
2668 rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,nBulIndex));
2669 }
2670 }else if ( GetShell().HasNumber() )
2671 {
2672 rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX, USHRT_MAX));
2673 rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX, USHRT_MAX));
2674 NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(NBOType::Numbering);
2675 if ( pNumbering )
2676 {
2677 const sal_uInt16 nBulIndex = pNumbering->GetNBOIndexForNumRule(aSvxRule,nActNumLvl);
2678 rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,nBulIndex));
2679 }
2680 }
2681
2682 if ( nWhich == FN_OUTLINE_RULE_INDEX )
2683 {
2684 rSet.Put(SfxUInt16Item(FN_OUTLINE_RULE_INDEX, USHRT_MAX));
2685 NBOTypeMgrBase* pOutline = NBOutlineTypeMgrFact::CreateInstance(NBOType::Outline);
2686 if ( pOutline )
2687 {
2688 const sal_uInt16 nIndex = pOutline->GetNBOIndexForNumRule(aSvxRule,nActNumLvl);
2689 rSet.Put(SfxUInt16Item(FN_OUTLINE_RULE_INDEX,nIndex));
2690 }
2691 }
2692 }
2693 }
2694 break;
2695 case FN_NUM_CONTINUE:
2696 {
2697 // #i86492#
2698 // Search also for bullet list
2699 OUString aDummy;
2700 const SwNumRule* pRule =
2701 rSh.SearchNumRule( true, aDummy );
2702 if ( !pRule )
2703 {
2704 pRule = rSh.SearchNumRule( false, aDummy );
2705 }
2706 if ( !pRule )
2707 rSet.DisableItem(nWhich);
2708 }
2709 break;
2710 case SID_INSERT_RLM :
2711 case SID_INSERT_LRM :
2712 {
2713 SvtCTLOptions aCTLOptions;
2714 bool bEnabled = aCTLOptions.IsCTLFontEnabled();
2715 GetView().GetViewFrame().GetBindings().SetVisibleState( nWhich, bEnabled );
2716 if(!bEnabled)
2717 rSet.DisableItem(nWhich);
2718 }
2719 break;
2720 case SID_FM_CTL_PROPERTIES:
2721 {
2722 bool bDisable = false;
2723
2724 // First get the state from the form shell
2726 aSet.Put(SfxBoolItem( SID_FM_CTL_PROPERTIES, true ));
2727 GetShell().GetView().GetFormShell()->GetState( aSet );
2728
2729 if(SfxItemState::DISABLED == aSet.GetItemState(SID_FM_CTL_PROPERTIES))
2730 {
2731 bDisable = true;
2732 }
2733
2734 // Enable it if we have a valid object other than what form shell knows
2735 SwPosition aPos(*GetShell().GetCursor()->GetPoint());
2736 sw::mark::IFieldmark* pFieldBM = GetShell().getIDocumentMarkAccess()->getInnerFieldmarkFor(aPos);
2737 if ( !pFieldBM && aPos.GetContentIndex() > 0)
2738 {
2739 aPos.AdjustContent(-1);
2741 }
2742 if ( pFieldBM && (pFieldBM->GetFieldname() == ODF_FORMDROPDOWN || pFieldBM->GetFieldname() == ODF_FORMDATE) )
2743 {
2744 bDisable = false;
2745 }
2746
2747 if(bDisable)
2748 rSet.DisableItem(nWhich);
2749 }
2750 break;
2751 case SID_COPY:
2752 case SID_CUT:
2753 {
2754 if (GetObjectShell()->isContentExtractionLocked())
2755 rSet.DisableItem(nWhich);
2756 break;
2757 }
2758 case FN_PROTECT_FIELDS:
2760 {
2761 DocumentSettingId aSettingId = nWhich == FN_PROTECT_FIELDS
2764 bool bProtected = rSh.getIDocumentSettingAccess().get(aSettingId);
2765 rSet.Put(SfxBoolItem(nWhich, bProtected));
2766 }
2767 break;
2769 {
2770 if (!GetShell().CursorInsideContentControl())
2771 {
2772 rSet.DisableItem(nWhich);
2773 }
2774 }
2775 break;
2776 }
2777 nWhich = aIter.NextWhich();
2778 }
2779}
2780
2781/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString sCharStyleName
@ UndoArg1
Definition: SwRewriter.hxx:29
@ UndoArg3
Definition: SwRewriter.hxx:31
@ UndoArg2
Definition: SwRewriter.hxx:30
SfxApplication * SfxGetpApp()
static void EndUndo(SwWrtShell &rSh)
Definition: basesh.cxx:3074
#define SW_BREAKITER()
Definition: breakit.hxx:122
#define GetWhich(nSlot)
sal_uInt16 GetValue() const
const OUString & GetValue() const
void Execute(SfxRequest &)
void GetState(SfxItemSet &)
Text operation/manipulation interface.
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 const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
wrapper iterator: wraps iterator of implementation while hiding MarkBase class; only IMark instances ...
Provides access to the marks of a document.
virtual bool renameMark(::sw::mark::IMark *io_pMark, const OUString &rNewName)=0
Renames an existing Mark, if possible.
virtual const_iterator_t getBookmarksBegin() const =0
returns a STL-like random access iterator to the begin of the sequence the IBookmarks.
virtual const_iterator_t getAllMarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of marks.
virtual sw::mark::IFieldmark * getInnerFieldmarkFor(const SwPosition &pos) const =0
virtual const_iterator_t findMark(const OUString &rMark) const =0
Finds a mark by name.
virtual void assureSortedMarkContainers() const =0
virtual std::unique_ptr< ILazyDeleter > deleteMark(const IDocumentMarkAccess::const_iterator_t &ppMark, bool isMoveNodes)=0
Deletes a mark.
virtual const_iterator_t getAllMarksBegin() const =0
returns a STL-like random access iterator to the begin of the sequence of marks.
static SW_DLLPUBLIC MarkType GetType(const ::sw::mark::IMark &rMark)
Returns the MarkType used to create the mark.
Definition: docbm.cxx:489
virtual const_iterator_t getBookmarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of IBookmarks.
virtual sw::mark::IMark * getOneInnermostBookmarkFor(const SwPosition &rPos) const =0
Get the innermost bookmark that contains rPos.
Provides access to settings of a document.
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
virtual void set(DocumentSettingId id, bool value)=0
Set the specified document setting.
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
const OUString & getBcp47(bool bResolveSystem=true) const
static css::uno::Reference< css::linguistic2::XDictionary > GetIgnoreAllList()
OUString const & GetName() const
XBitmapListRef GetBitmapList() const
XGradientListRef GetGradientList() const
XPatternListRef GetPatternList() const
XColorListRef GetColorList() const
XHatchListRef GetHatchList() const
static void MigrateItemSet(const SfxItemSet *pSourceSet, SfxItemSet *pDestSet, SdrModel *pNewModel)
static SfxAbstractDialogFactory * Create()
void SetVisibleState(sal_uInt16 nId, bool bShow)
void Update(sal_uInt16 nId)
void Invalidate(sal_uInt16 nId)
void InvalidateAll(bool bWithMsg)
bool GetValue() const
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
sal_uInt16 Count() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) 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)
bool IsReadOnly() const
sal_uInt16 GetSlot() const
void Ignore()
const SfxItemSet * GetArgs() const
const T * GetArg(sal_uInt16 nSlotId) const
void AppendItem(const SfxPoolItem &)
sal_uInt16 GetModifier() const
bool IsAPI() const
void Done(bool bRemove=false)
SfxItemPool & GetPool() const
static void HandleOpenXmlFilterSettings(SfxRequest &)
virtual SfxObjectShell * GetObjectShell()
static SfxInterface * GetStaticInterface()
const SfxPoolItem * ExecuteSlot(SfxRequest &rReq, const SfxInterface *pIF=nullptr)
void SetStringList(const css::uno::Sequence< OUString > &rList)
const css::uno::Any & GetValue() const
void ToggleChildWindow(sal_uInt16)
SfxBindings & GetBindings()
bool HasChildWindow(sal_uInt16)
void SetChildWindow(sal_uInt16 nId, bool bVisible, bool bSetFocus=true)
weld::Window * GetFrameWeld() const
css::uno::Reference< css::frame::XController > GetController() const
SfxViewFrame & GetViewFrame() const
static SAL_WARN_UNUSED_RESULT SfxViewShell * Current()
sal_uInt16 FirstWhich()
sal_uInt16 NextWhich()
const OUString & GetApplicationName() const
void GetActionSequences(std::vector< OUString > &rSmartTagTypes, css::uno::Sequence< css::uno::Sequence< css::uno::Reference< css::smarttags::XSmartTagAction > > > &rActionComponentsSequence, css::uno::Sequence< css::uno::Sequence< sal_Int32 > > &rActionIndicesSequence) const
sal_uInt32 GetFormatIndex(NfIndexTableOffset, LanguageType eLnge=LANGUAGE_DONTKNOW)
bool IsCTLFontEnabled() const
static OUString GetLanguageString(const LanguageType eType)
bool IsAutoFormatByInput() const
static SvxAutoCorrCfg & Get()
void SetAutoFormatByInput(bool bSet)
const Color & GetColor() const
void SetTextFirstLineOffset(const short nF, const sal_uInt16 nProp=100)
void SetAutoFirst(const bool bNew)
bool IsAutoFirst() const
sal_uInt16 GetPropLeft() const
sal_uInt16 GetPropRight() const
short GetTextFirstLineOffset() const
tools::Long GetRight() const
tools::Long GetTextLeft() const
sal_uInt16 GetPropTextFirstLineOffset() const
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
void SetTextLeft(const tools::Long nL, const sal_uInt16 nProp=100)
virtual VclPtr< VclAbstractDialog > CreateDateFormFieldDialog(weld::Widget *pParent, sw::mark::IDateFieldmark *pDateField, SwDoc &rDoc)=0
virtual VclPtr< VclAbstractDialog > CreateSwInsertBookmarkDlg(weld::Window *pParent, SwWrtShell &rSh, OUString const *pSelected)=0
virtual std::shared_ptr< AbstractSwTranslateLangSelectDlg > CreateSwTranslateLangSelectDlg(weld::Window *pParent, SwWrtShell &rSh)=0
virtual VclPtr< AbstractSwModalRedlineAcceptDlg > CreateSwModalRedlineAcceptDlg(weld::Window *pParent)=0
virtual VclPtr< AbstractInsFootNoteDlg > CreateInsFootNoteDlg(weld::Window *pParent, SwWrtShell &rSh, bool bEd=false)=0
virtual VclPtr< VclAbstractDialog > CreateDropDownFormFieldDialog(weld::Widget *pParent, sw::mark::IFieldmark *pDropDownField)=0
virtual std::shared_ptr< AbstractSwBreakDlg > CreateSwBreakDlg(weld::Window *pParent, SwWrtShell &rSh)=0
virtual VclPtr< SfxAbstractTabDialog > CreateSwCharDlg(weld::Window *pParent, SwView &pVw, const SfxItemSet &rCoreSet, SwCharDlgMode nDialogMode, const OUString *pFormatStr=nullptr)=0
virtual VclPtr< VclAbstractDialog > CreateSwSortingDialog(weld::Window *pParent, SwWrtShell &rSh)=0
virtual VclPtr< SfxAbstractTabDialog > CreateSwParaDlg(weld::Window *pParent, SwView &rVw, const SfxItemSet &rCoreSet, bool bDraw, const OString &sDefPage=OString())=0
static SwAbstractDialogFactory * Create()
Definition: swabstdlg.cxx:36
OUString const & GetAuthorField(ToxAuthorityField ePos) const
Definition: authfld.hxx:218
Represents an inserted bibliography entry, created using Insert -> Table of Contents and Index -> Bib...
Definition: authfld.hxx:161
bool HasURL() const
Definition: authfld.cxx:648
SwAuthEntry * GetAuthEntry() const
Definition: authfld.hxx:188
static std::shared_ptr< std::vector< std::unique_ptr< SwPaM > > > CopyPaMRing(SwPaM &rOrig)
Definition: basesh.cxx:3419
SwWrtShell & GetShell()
Definition: basesh.cxx:3064
SwView & GetView()
Definition: basesh.hxx:59
void ExtendedSelectAll(bool bFootnotes=true)
Definition: crsrsh.cxx:594
SAL_DLLPRIVATE void UpdateCursor(sal_uInt16 eFlags=SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE, bool bIdleEnd=false)
Definition: crsrsh.cxx:1604
OUString GetCursorDescr() const
Returns textual description of the current selection.
Definition: crsrsh.cxx:3702
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2279
bool IsSelOnePara() const
Definition: crsrsh.cxx:1090
bool EndAllTableBoxEdit()
Definition: trvltbl.cxx:913
void ShowCursor()
Definition: crsrsh.cxx:2438
void StartAction()
Definition: crsrsh.cxx:226
const SwTableNode * IsCursorInTable() const
Definition: crsrsh.hxx:914
void SwapPam()
Definition: crsrsh.cxx:990
bool IsInWord(sal_Int16 nWordType=css::i18n::WordType::ANYWORD_IGNOREWHITESPACES) const
Definition: crstrvl1.cxx:36
bool IsMultiSelection() const
Definition: crsrsh.hxx:909
::sw::mark::IMark * SetBookmark(const vcl::KeyCode &, const OUString &rName, IDocumentMarkAccess::MarkType eMark=IDocumentMarkAccess::MarkType::BOOKMARK)
Definition: crbm.cxx:78
void GetSmartTagTerm(std::vector< OUString > &rSmartTagTypes, css::uno::Sequence< css::uno::Reference< css::container::XStringKeyMap > > &rStringKeyMaps, css::uno::Reference< css::text::XTextRange > &rRange) const
Definition: crsrsh.cxx:3771
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:194
OUString GetSelText() const
get selected text of a node at current cursor
Definition: crsrsh.cxx:2588
bool ExtendSelection(bool bEnd=true, sal_Int32 nCount=1)
extend current SSelection by n characters
Definition: crsrsh.cxx:2670
bool IsSelection() const
Definition: crsrsh.hxx:904
bool CursorInsideInputField() const
Definition: crstrvl.cxx:1089
SwField * GetCurField(const bool bIncludeInputFieldAtStart=false) const
Definition: crstrvl.cxx:1068
bool IsEndWord(sal_Int16 nWordType=css::i18n::WordType::ANYWORD_IGNOREWHITESPACES) const
Definition: crstrvl1.cxx:31
bool IsSelFullPara() const
Definition: crsrsh.cxx:3424
void EndAction(const bool bIdleEnd=false)
Definition: crsrsh.cxx:243
bool GotoFootnoteText()
jump from content to footnote
Definition: trvlfnfl.cxx:89
void ClearMark()
Definition: crsrsh.cxx:953
void SetMark()
Definition: crsrsh.hxx:900
SwTextContentControl * CursorInsideContentControl() const
Definition: crstrvl.cxx:1099
bool HasReadonlySel(bool isReplace=false) const
Definition: crsrsh.cxx:3388
bool IsTableMode() const
Definition: crsrsh.hxx:662
bool IsStartWord(sal_Int16 nWordType=css::i18n::WordType::ANYWORD_IGNOREWHITESPACES) const
Definition: crstrvl1.cxx:27
bool IsCursorInFootnote() const
Definition: crsrsh.cxx:1165
sal_Unicode GetChar(bool bEnd=true, tools::Long nOffset=0)
get the nth character of the current SSelection
Definition: crsrsh.cxx:2644
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:204
Definition: doc.hxx:195
SwSectionFormats & GetSections()
Definition: doc.hxx:1350
void DeleteFormatRefMark(const SwFormatRefMark *pFormatRefMark)
Definition: doc.cxx:1120
sal_uInt16 GetRefMarks(std::vector< OUString > *=nullptr) const
Definition: doc.cxx:1097
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:323
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:152
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1877
void UpdateSection(size_t const nSect, SwSectionData &, SfxItemSet const *const =nullptr, bool const bPreventLinkUpdate=false)
Definition: ndsect.cxx:600
const SwFormatRefMark * GetRefMark(std::u16string_view rName) const
Definition: doc.cxx:1053
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:163
void UpdateTable()
update fields of a listing
Definition: edtab.cxx:255
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
Definition: edattr.cxx:171
void StartAllAction()
For all views of this document.
Definition: edws.cxx:86
sal_uInt16 GetScalingOfSelectedText() const
Definition: edattr.cxx:821
void AutoFormat(const SvxSwAutoFormatFlags *pAFlags)
Set our styles according to the respective rules.
Definition: autofmt.cxx:2702
bool GetGrammarCorrection(css::linguistic2::ProofreadingResult &rResult, sal_Int32 &rErrorPosInText, sal_Int32 &rErrorIndexInResult, css::uno::Sequence< OUString > &rSuggestions, const Point *pPt, SwRect &rSelectRect)
Definition: edlingu.cxx:974
bool IsMoveLeftMargin(bool bRight, bool bModulus=true) const
Adjust left margin via object bar (similar to adjustment of numerations).
Definition: edattr.cxx:490
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
Definition: edws.cxx:223
sal_uInt16 GetNodeNumStart(SwPaM *pPaM) const
Definition: ednumber.cxx:858
void SetNumRuleStart(bool bFlag, SwPaM *pCursor)
Set (and query if) a numbering with StartFlag starts at current PointPos.
Definition: ednumber.cxx:800
void SetAttrItem(const SfxPoolItem &, SetAttrMode nFlags=SetAttrMode::DEFAULT, const bool bParagraphSetting=false)
Definition: edatmisc.cxx:98
void SetAttrSet(const SfxItemSet &, SetAttrMode nFlags=SetAttrMode::DEFAULT, SwPaM *pCursor=nullptr, const bool bParagraphSetting=false)
Definition: edatmisc.cxx:129
SwFrameFormat * GetTableFormat()
Definition: edws.cxx:183
SvNumberFormatter * GetNumberFormatter()
Query NumberFormatter from document.
Definition: editsh.cxx:756
void SetDefault(const SfxPoolItem &)
Set attribute as new default attribute in document.
Definition: edatmisc.cxx:84
void Insert2(const OUString &, const bool bForceExpandHints=false)
Definition: editsh.cxx:79
void SetNodeNumStart(sal_uInt16 nStt)
Definition: ednumber.cxx:832
const SwSection * GetCurrSection() const
Definition: edsect.cxx:71
bool SelectionHasNumber() const
Definition: ednumber.cxx:148
void SetCurNumRule(const SwNumRule &, const bool bCreateNewList, const OUString &sContinuedListId=OUString(), const bool bResetIndentAttrs=false)
Optional parameter <bResetIndentAttrs> (default value false).
Definition: ednumber.cxx:738
void SetTableBoxFormulaAttrs(const SfxItemSet &rSet)
Definition: edtab.cxx:339
bool IsNumRuleStart(SwPaM *pPaM=nullptr) const
Definition: ednumber.cxx:825
bool DontExpandFormat()
If Cursor is at the end of a character style in which the DontExpand-flag is not yet set,...
Definition: editsh.cxx:745
SvtScriptType GetScriptType() const
returns the script type of the selection
Definition: edattr.cxx:662
bool SelectionHasBullet() const
Definition: ednumber.cxx:183
bool MoveParagraph(SwNodeOffset nOffset=SwNodeOffset(1))
Definition: ednumber.cxx:364
sal_uInt8 GetNumLevel() const
Definition: ednumber.cxx:669
bool GetPaMAttr(SwPaM *pPaM, SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
Apply / remove attributes.
Definition: edattr.cxx:59
css::uno::Reference< css::linguistic2::XSpellAlternatives > GetCorrection(const Point *pPt, SwRect &rSelectRect)
Get a list of potential corrections for misspelled word.
Definition: edlingu.cxx:909
const SwNumRule * GetNumRuleAtCurrentSelection() const
Returns the numbering rule found at the paragraphs of the current selection, if all paragraphs of the...
Definition: ednumber.cxx:700
const SwNumRule * GetNumRuleAtCurrCursorPos() const
Definition: ednumber.cxx:694
static void IgnoreGrammarErrorAt(SwPaM &rErrorPosition)
Definition: edlingu.cxx:1716
void ReplaceDropText(const OUString &rStr, SwPaM *pPaM=nullptr)
Definition: editsh.cxx:503
SwTextFormatColl * GetPaMTextFormatColl(SwPaM *pPaM) const
Get the named paragraph format of the selection(s) described by a SwPaM.
Definition: edattr.cxx:243
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
Definition: edws.cxx:234
void NumUpDown(bool bDown=true)
Definition: ednumber.cxx:277
bool Replace(const OUString &rNewStr, bool bRegExpRplc)
Replace a selected range in a TextNode by given string.
Definition: eddel.cxx:313
SwTextFormatColl * GetCurTextFormatColl() const
Get the named paragraph format of the current selection.
Definition: edattr.cxx:238
OUString GetCurWord() const
request current word
Definition: editsh.cxx:409
void ResetAttr(const o3tl::sorted_vector< sal_uInt16 > &attrs=o3tl::sorted_vector< sal_uInt16 >(), SwPaM *pCursor=nullptr)
Definition: edatmisc.cxx:32
void EndAllAction()
Definition: edws.cxx:97
void MoveLeftMargin(bool bRight, bool bModulus=true)
Definition: edattr.cxx:543
LanguageType GetCurLang() const
Definition: edattr.cxx:801
const SwNumRule * SearchNumRule(const bool bNum, OUString &sListId)
Searches for a text node with a numbering rule.
Definition: ednumber.cxx:872
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:61
void SetWaterCanTextColor(const Color &rCol)
Definition: edtwin.hxx:239
void SetApplyTemplate(const SwApplyTemplate &)
Apply template.
Definition: edtwin.cxx:5290
void SetWaterCanTextBackColor(const Color &rCol)
Definition: edtwin.hxx:241
SwApplyTemplate * GetApplyTemplate() const
Definition: edtwin.hxx:234
FrameTypeFlags GetFrameType(const Point *pPt, bool bStopAtFly) const
For return values see above FrameType.
Definition: fews.cxx:237
void UnProtectTables()
Unprotect all tables in selection.
Definition: fetab.cxx:1069
void UpdateCurField(sal_uInt32 nFormat, const OUString &rPar1, const OUString &rPar2, std::unique_ptr< SwField > _pField=nullptr)
Definition: fldmgr.cxx:1569
SwFieldTypesEnum GetCurTypeId() const
Definition: fldmgr.cxx:889
bool InsertField(SwInsertField_Data &rData)
Definition: fldmgr.cxx:895
SwField * GetCurField()
Definition: fldmgr.cxx:430
SwFieldIds Which() const
Definition: fldbas.hxx:275
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
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:32
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
If SwFormatDrop is a Client, it is the CharFormat that describes the font for the DropCaps.
Definition: paratr.hxx:72
const OUString & GetValue() const
Definition: fmtinfmt.hxx:75
OUString & GetRefName()
Definition: fmtrfmrk.hxx:63
const OUString & GetName() const
Definition: format.hxx:131
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
bool IsAutoUpdateOnDirectFormat() const
Query / set m_bAutoUpdateOnDirectFormat-flag.
Definition: format.hxx:188
Marks a node in the document model.
Definition: ndindex.hxx:31
SvxNumRule MakeSvxNumRule() const
Definition: number.cxx:937
SwPaM * GetValue() const
Definition: uiitems.hxx:103
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
const SwPosition * GetPoint() const
Definition: pam.hxx:261
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
void AddRule(SwUndoArg eWhat, const OUString &rWith)
Definition: SwRewriter.cxx:25
SwSection * GetSection() const
Definition: section.cxx:646
Array of Undo-history.
Definition: docary.hxx:192
bool IsProtect() const
Definition: section.cxx:334
static SwSmartTagMgr & Get()
Represents the style of a paragraph.
Definition: fmtcol.hxx:61
void InsertSymbol(SfxRequest &)
Definition: textsh.cxx:918
void GetState(SfxItemSet &)
Definition: textsh1.cxx:2119
void Execute(SfxRequest &)
Definition: textsh1.cxx:759
size_t size() const
Definition: docary.hxx:87
void push_back(Value const &rVal)
Definition: docary.hxx:101
bool IsSelectionInReadonly() const
Definition: viewopt.hxx:632
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:434
void SetReadonlySelectionOption(bool bSet)
Definition: viewsh.cxx:2510
const IDocumentSettingAccess & getIDocumentSettingAccess() const
Provides access to the document setting interface.
Definition: viewsh.cxx:2809
const IDocumentMarkAccess * getIDocumentMarkAccess() const
Provides access to the document bookmark interface.
Definition: viewsh.cxx:2813
void InvalidateWindows(const SwRect &rRect)
Definition: viewsh.cxx:556
SwDoc * GetDoc() const
Definition: viewsh.hxx:290
void LockView(bool b)
Definition: viewsh.hxx:473
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:625
Definition: view.hxx:146
static void SetActMark(sal_Int32 nSet)
Definition: viewmdi.cxx:743
virtual FmFormShell * GetFormShell() override
Definition: view.hxx:587
void ExecuteInsertDoc(SfxRequest &rRequest, const SfxPoolItem *pItem)
Definition: view2.cxx:2630
const tools::Rectangle & GetVisArea() const
Definition: view.hxx:434
void ExecNumberingOutline(SfxItemPool &)
Definition: view0.cxx:726
OUString GetThesaurusLookUpText(bool bSelection) const
Definition: viewling.cxx:480
SwEditWin & GetEditWin()
Definition: view.hxx:424
SwDocShell * GetDocShell()
Definition: view.cxx:1163
void UpdateWordCount(SfxShell *, sal_uInt16)
Definition: view1.cxx:202
void ExecFormatFootnote()
Definition: view0.cxx:719
void InsertThesaurusSynonym(const OUString &rSynonmText, const OUString &rLookUpText, bool bValidSelection)
Definition: viewling.cxx:485
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
void EnterBlockMode()
Definition: select.cxx:652
void AutoUpdatePara(SwTextFormatColl *pColl, const SfxItemSet &rStyleSet, SwPaM *pPaM=nullptr)
Definition: wrtsh1.cxx:1902
bool IsSttOfPara() const
Definition: wrtsh.hxx:196
void EndSelect()
Definition: select.cxx:426
bool DelLeft()
Definition: delete.cxx:136
void InsertLineBreak(std::optional< SwLineBreakClear > oClear=std::nullopt)
Definition: wrtsh1.cxx:973
bool Left(SwCursorSkipMode nMode, bool bSelect, sal_uInt16 nCount, bool bBasicCall, bool bVisual=false)
Definition: move.cxx:110
bool SttPara(bool bSelect=false)
Definition: move.cxx:356
void Insert(const OUString &)
Definition: wrtsh1.cxx:225
void SetInsMode(bool bOn=true)
Definition: select.cxx:671
SelectionType GetSelectionType() const
Definition: wrtsh1.cxx:1717
void EnterStdMode()
Definition: select.cxx:552
void EndPara(bool bSelect=false)
Definition: move.cxx:362
bool IsBlockMode() const
Definition: wrtsh.hxx:168
bool IsInSelect() const
Definition: wrtsh.hxx:144
void InsertColumnBreak()
Definition: wrtsh1.cxx:1011
void InfoReadOnlyDialog(bool bAsync=false)
Definition: wrtsh1.cxx:2664
void InsertFootnote(const OUString &, bool bEndNote=false, bool bEdit=true)
Definition: wrtsh1.cxx:1169
void SelAll()
Definition: select.cxx:124
void ChangeHeaderOrFooter(std::u16string_view rStyleName, bool bHeader, bool bOn, bool bShowWarning)
Definition: wrtsh1.cxx:2132
bool DelRight(bool isReplaceHeuristic=false)
Definition: delete.cxx:293
void AutoCorrect(SvxAutoCorrect &rACorr, sal_Unicode cChar)
Definition: wrtsh1.cxx:1949
bool HasSelection() const
Definition: wrtsh.hxx:147
bool IsInsMode() const
Definition: wrtsh.hxx:172
void InsertPageBreak(const OUString *pPageDesc=nullptr, const ::std::optional< sal_uInt16 > &rPgNum=std::nullopt)
Definition: wrtsh1.cxx:935
bool EndOfSection(bool bSelect=false)
Definition: move.cxx:314
bool IsAddMode() const
Definition: wrtsh.hxx:163
tools::Long ResetSelect(const Point *, bool)
Definition: select.cxx:334
bool SelWrd(const Point *=nullptr)
Definition: select.cxx:74
void ClickToINetAttr(const SwFormatINetFormat &rItem, LoadUrlFlags nFilter=LoadUrlFlags::NONE)
Definition: wrtsh2.cxx:511
bool SelectTextAttr(sal_uInt16 nWhich, const SwTextAttr *pAttr=nullptr)
Definition: move.cxx:725
bool Pop(SwCursorShell::PopMode, ::std::optional< SwCallLink > &roLink)
Definition: wrtsh1.cxx:2041
const SwView & GetView() const
Definition: wrtsh.hxx:443
OUString ReplacementString()
bool AllowMoreInput(sal_Unicode uChar)
OUString StringToReplace()
sal_uInt32 CharsToDelete()
void reset(reference_type *pBody)
const XGradient & GetGradientValue() const
const XHatch & GetHatchValue() const
std::pair< const_iterator, bool > insert(Value &&x)
virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule &aNum, sal_uInt16 mLevel, sal_uInt16 nFromIndex=0)=0
Fieldmark representing a date form field.
void Invalidate() override
LanguageType GetInputLanguage() const
css::uno::Reference< css::datatransfer::clipboard::XClipboard > GetClipboard()
static void CopyStringTo(const OUString &rContent, const css::uno::Reference< css::datatransfer::clipboard::XClipboard > &rxClipboard, const vcl::ILibreOfficeKitNotifier *pNotifier=nullptr)
static bool runAsync(const std::shared_ptr< DialogController > &rController, const std::function< void(sal_Int32)> &)
#define FN_INSERT_FOOTNOTE
Definition: cmdid.h:281
#define FN_DELETE_BOOKMARKS
Definition: cmdid.h:328
#define FN_FORMAT_DROPCAPS
Definition: cmdid.h:349
#define FN_INSERT_BOOKMARK
Definition: cmdid.h:203
#define FN_INSERT_BREAK_DLG
Definition: cmdid.h:206
#define FN_NUM_BULLET_MOVEUP
Definition: cmdid.h:92
#define FN_GOTO_REFERENCE
Definition: cmdid.h:117
#define FN_AUTOFORMAT_APPLY
Definition: cmdid.h:333
#define FN_NUM_BULLET_OFF
Definition: cmdid.h:96
#define FN_INSERT_FOOTNOTE_DLG
Definition: cmdid.h:213
#define FN_OPEN_LOCAL_URL
Definition: cmdid.h:528
#define FN_FORMAT_APPLY_HEAD3
Definition: cmdid.h:509
#define FN_NUM_CONTINUE
Definition: cmdid.h:141
#define FN_EDIT_BOOKMARK
Definition: cmdid.h:322
#define FN_UPDATE_BOOKMARK
Definition: cmdid.h:326
#define FN_AUTO_CORRECT
Definition: cmdid.h:532
#define FN_DROP_TEXT
Definition: cmdid.h:846
#define FN_FORMAT_LINENUMBER
Definition: cmdid.h:495
#define FN_SORTING_DLG
Definition: cmdid.h:520
#define FN_INSERT_TABLE
Definition: cmdid.h:231
#define FN_CONTENT_CONTROL_PROPERTIES
Definition: cmdid.h:226
#define FN_UPDATE_SECTIONS
Definition: cmdid.h:324
#define FN_FORMAT_APPLY_HEAD1
Definition: cmdid.h:507
#define FN_DROP_CHAR_STYLE_NAME
Definition: cmdid.h:847
#define FN_EDIT_FORMULA
Definition: cmdid.h:84
#define FN_INSERT_PAGEHEADER
Definition: cmdid.h:294
#define FN_READONLY_SELECTION_MODE
Definition: cmdid.h:755
#define FN_SELECT_PARA
Definition: cmdid.h:126
#define FN_TABLE_SORT_DIALOG
Definition: cmdid.h:406
#define FN_TXTATR_INET
Definition: cmdid.h:768
#define FN_FORMAT_FOOTNOTE_DLG
Definition: cmdid.h:355
#define FN_FORMAT_APPLY_TEXTBODY
Definition: cmdid.h:511
#define FN_STAT_SELMODE
Definition: cmdid.h:864
#define FN_AUTOFORMAT_AUTO
Definition: cmdid.h:334
#define FN_UPDATE_BOOKMARKS
Definition: cmdid.h:323
#define FN_EXPAND_GLOSSARY
Definition: cmdid.h:524
#define FN_PARAM_MOVE_COUNT
Definition: cmdid.h:797
#define FN_INSERT_ENDNOTE
Definition: cmdid.h:297
#define FN_INSERT_HYPERLINK
Definition: cmdid.h:217
#define FN_AUTOFORMAT_REDLINE_APPLY
Definition: cmdid.h:337
#define FN_DEC_INDENT_OFFSET
Definition: cmdid.h:502
#define FN_PARAM_MOVE_SELECTION
Definition: cmdid.h:798
#define FN_INSERT_GLOSSARY
Definition: cmdid.h:615
#define FN_INSERT_PAGEBREAK
Definition: cmdid.h:224
#define FN_NUMBER_NEWSTART
Definition: cmdid.h:486
#define FN_NUMBER_NEWSTART_AT
Definition: cmdid.h:487
#define FN_PARAM_SELECTION
Definition: cmdid.h:829
#define FN_FORMAT_APPLY_DEFAULT
Definition: cmdid.h:510
#define FN_SET_REMINDER
Definition: cmdid.h:283
#define FN_INSERT_STRING
Definition: cmdid.h:232
#define FN_NUMBERING_OUTLINE_DLG
Definition: cmdid.h:519
#define FN_CHAR_LEFT
Definition: cmdid.h:673
#define FN_WORDCOUNT_DIALOG
Definition: cmdid.h:624
#define FN_DELETE_FIELDS
Definition: cmdid.h:329
#define FN_PROTECT_FIELDS
Definition: cmdid.h:311
#define FN_CHAR_RIGHT
Definition: cmdid.h:674
#define FN_FORMAT_APPLY_HEAD2
Definition: cmdid.h:508
#define FN_INSERT_COLUMN_BREAK
Definition: cmdid.h:207
#define FN_DELETE_SECTIONS
Definition: cmdid.h:330
#define FN_TABLE_UNSET_READ_ONLY
Definition: cmdid.h:427
#define FN_CALCULATE
Definition: cmdid.h:521
#define FN_INSERT_PAGEFOOTER
Definition: cmdid.h:295
#define FN_FORMAT_CURRENT_FOOTNOTE_DLG
Definition: cmdid.h:356
#define FN_SELECTION_MODE_BLOCK
Definition: cmdid.h:757
#define FN_REDLINE_ACCEPT
Definition: cmdid.h:135
#define FN_PARAM_PAM
Definition: cmdid.h:855
#define FN_NUM_BULLET_MOVEDOWN
Definition: cmdid.h:93
#define FN_SELECTION_MODE_DEFAULT
Definition: cmdid.h:756
#define FN_PROTECT_BOOKMARKS
Definition: cmdid.h:312
#define FN_INC_INDENT_OFFSET
Definition: cmdid.h:501
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Definition: dialoghelp.cxx:19
OString sFormula
float u
FrameTypeFlags
values can be combined via logical or
Definition: fesh.hxx:63
constexpr OUStringLiteral IsReadOnly(u"IsReadOnly")
@ TableOfAuthorities
FieldUnit
SelectionType
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(126)
constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END)
constexpr sal_uInt16 RES_CHRATR_END(46)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
constexpr sal_uInt16 RES_PARATR_BEGIN(RES_TXTATR_END)
constexpr TypedWhichId< SvxFirstLineIndentItem > RES_MARGIN_FIRSTLINE(91)
constexpr sal_uInt16 RES_UNKNOWNATR_END(160)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CTL_LANGUAGE(29)
constexpr TypedWhichId< SvxShadowItem > RES_SHADOW(113)
constexpr sal_uInt16 RES_FRMATR_END(141)
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
constexpr TypedWhichId< SvxBrushItem > RES_CHRATR_HIGHLIGHT(42)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(111)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
constexpr sal_uInt16 RES_PARATR_END(82)
constexpr TypedWhichId< SvxTabStopItem > RES_PARATR_TABSTOP(68)
constexpr TypedWhichId< SvxBrushItem > RES_CHRATR_BACKGROUND(21)
constexpr sal_uInt16 RES_CHRATR_BEGIN(HINT_BEGIN)
constexpr sal_uInt16 RES_UNKNOWNATR_BEGIN(RES_BOXATR_END)
#define CH_TXTATR_INWORD
Definition: hintids.hxx:176
constexpr TypedWhichId< SwFormatDrop > RES_PARATR_DROP(70)
constexpr TypedWhichId< SvxRightMarginItem > RES_MARGIN_RIGHT(93)
constexpr TypedWhichId< SvxTextLeftMarginItem > RES_MARGIN_TEXTLEFT(92)
constexpr TypedWhichId< SvXMLAttrContainerItem > RES_TXTATR_UNKNOWN_CONTAINER(54)
constexpr TypedWhichId< SvxColorItem > RES_CHRATR_COLOR(3)
const char sDisplay[]
HTMLMODE_SOME_STYLES
HTMLMODE_ON
const LanguageTag & GetAppLanguageTag()
Definition: init.cxx:746
sal_Int32 nIndex
constexpr sal_uInt16 KEY_MOD1
#define LANGUAGE_SYSTEM
#define LANGUAGE_NONE
#define LANGUAGE_DONTKNOW
sal_uInt16 nPos
Sequence< sal_Int8 > aSeq
#define SAL_WARN(area, stream)
aStr
const char * sName
constexpr OUStringLiteral aData
Definition: ww8scan.hxx:48
bool IsChangeCaseMapEnabled()
bool IsRubyEnabled()
LanguageType GetCurrentLanguage(SfxItemSet const &aSet, SvtScriptType nScriptType)
Definition: langhelper.cxx:472
void SetLanguage_None(SwWrtShell &rWrtSh, bool bIsForSelection, SfxItemSet &rCoreSet)
Definition: langhelper.cxx:299
void ResetLanguages(SwWrtShell &rWrtSh, OutlinerView const *pOLV=nullptr)
Definition: langhelper.cxx:359
void SelectCurrentPara(SwWrtShell &rWrtSh)
Definition: langhelper.cxx:564
void SetLanguage(SwWrtShell &rWrtSh, std::u16string_view rLangText, bool bIsForSelection, SfxItemSet &rCoreSet)
Definition: langhelper.cxx:217
OUString GetTextForLanguageGuessing(EditEngine const *rEditEngine, const ESelection &rDocSelection)
Definition: langhelper.cxx:538
SW_DLLPUBLIC void PasteHTMLToPaM(SwWrtShell &rWrtSh, SwPaM *pCursor, const OString &rData, bool bSetSelection)
SW_DLLPUBLIC void TranslateDocument(SwWrtShell &rWrtSh, const TranslateAPIConfig &rConfig)
int i
index
DictionaryError AddEntryToDic(uno::Reference< XDictionary > const &rxDic, const OUString &rWord, bool bIsNeg, const OUString &rRplcTxt, bool bStripDot)
const SwGetSetExpType GSE_FORMULA
Formula.
Definition: fldbas.hxx:207
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
long Long
HashMap_OWString_Interface aMap
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
Definition: nodeoffset.hxx:16
constexpr OUStringLiteral ODF_FORMDATE
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
sal_uInt16 nColor
Definition: view.hxx:118
Marks a position in the document model.
Definition: pam.hxx:37
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
std::function< void(sal_Int32)> maEndDialogFn
Reference< XController > xController
SwView * GetActiveView()
Definition: swmodul1.cxx:115
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:168
#define SW_MOD()
Definition: swmodule.hxx:256
uno::Reference< linguistic2::XThesaurus > GetThesaurus()
Definition: swtypes.cxx:59
constexpr sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:92
@ UI_INSERT_FOOTNOTE
@ UPDATE_BOOKMARK
@ UPDATE_BOOKMARKS
@ DELETE_BOOKMARKS
static void sw_CharDialogResult(const SfxItemSet *pSet, SwWrtShell &rWrtSh, std::shared_ptr< SfxItemSet > const &pCoreSet, bool bSel, bool bSelectionPut, SfxRequest *pReq)
Definition: textsh1.cxx:215
static void sw_ParagraphDialogResult(SfxItemSet *pSet, SwWrtShell &rWrtSh, SfxRequest &rReq, SwPaM *pPaM)
Definition: textsh1.cxx:271
static void sw_CharDialog(SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot, const SfxItemSet *pArgs, SfxRequest *pReq)
Definition: textsh1.cxx:129
@ AUTH_FIELD_LOCAL_URL
Definition: toxe.hxx:117
@ AUTH_FIELD_URL
Definition: toxe.hxx:110
@ AUTH_FIELD_TARGET_URL
Definition: toxe.hxx:118
unsigned char sal_uInt8
void SwToSfxPageDescAttr(SfxItemSet &rSet)
Definition: uitool.cxx:716
SW_DLLPUBLIC SwTwips GetTabDist(const SvxTabStopItem &rTabs)
Definition: uitool.cxx:649
SW_DLLPUBLIC void ConvertAttrGenToChar(SfxItemSet &rSet, const SfxItemSet &rOrigSet, bool bPara=false)
Convert general attributes to the corresponding character attributes.
Definition: uitool.cxx:144
SW_DLLPUBLIC void ConvertAttrCharToGen(SfxItemSet &rSet, bool bPara=false)
Convert character specific attributes to general ones used by tab pages.
Definition: uitool.cxx:105
bool HasCharUnit(bool bWeb)
Definition: uitool.cxx:872
SW_DLLPUBLIC FieldUnit GetDfltMetric(bool bWeb)
Definition: uitool.cxx:755
SW_DLLPUBLIC void PrepareBoxInfo(SfxItemSet &rSet, const SwWrtShell &rSh)
Definition: uitool.cxx:81
void SfxToSwPageDescAttr(const SwWrtShell &rShell, SfxItemSet &rSet)
Definition: uitool.cxx:655
void ApplyCharBackground(const Color &rBackgroundColor, SwWrtShell &rShell)
Apply character background on the shell.
Definition: uitool.cxx:196
SW_DLLPUBLIC void MakeDefTabs(SwTwips nDefDist, SvxTabStopItem &rTabs)
Definition: uitool.cxx:637
short SvxDicError(weld::Window *pParent, linguistic::DictionaryError nError)
RET_OK
#define MAX_MARKS
Definition: view.hxx:84
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)
Definition: viewopt.cxx:415
void LoadURL(SwViewShell &rVSh, const OUString &rURL, LoadUrlFlags nFilter, const OUString &rTargetFrameName)
Definition: wrtsh2.cxx:560
constexpr TypedWhichId< XFillColorItem > XATTR_FILLCOLOR(XATTR_FILL_FIRST+1)
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
constexpr TypedWhichId< XFillHatchItem > XATTR_FILLHATCH(XATTR_FILL_FIRST+3)
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLUSESLIDEBACKGROUND)
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)
constexpr TypedWhichId< XFillGradientItem > XATTR_FILLGRADIENT(XATTR_FILL_FIRST+2)
NF_NUMBER_STANDARD