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