LibreOffice Module sw (master) 1
basesh.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 <config_features.h>
21#include <config_fuzzers.h>
22
23#include <sal/config.h>
24
25#include <hintids.hxx>
28#include <sfx2/linkmgr.hxx>
29#include <sfx2/htmlmode.hxx>
30#include <svx/imapdlg.hxx>
31#include <sfx2/dispatch.hxx>
32#include <sfx2/viewfrm.hxx>
33#include <sfx2/request.hxx>
34#include <svl/whiter.hxx>
35#include <svl/visitem.hxx>
36#include <editeng/langitem.hxx>
37#include <svx/clipfmtitem.hxx>
38#include <svx/contdlg.hxx>
39#include <vcl/graph.hxx>
40#include <vcl/inputctx.hxx>
41#include <svl/slstitm.hxx>
42#include <svl/ptitem.hxx>
43#include <svl/stritem.hxx>
44#include <editeng/colritem.hxx>
45#include <editeng/fhgtitem.hxx>
46#include <editeng/fontitem.hxx>
47#include <editeng/shaditem.hxx>
48#include <editeng/boxitem.hxx>
49#include <editeng/brushitem.hxx>
50#include <editeng/opaqitem.hxx>
51#include <editeng/sizeitem.hxx>
52#include <svx/flagsdef.hxx>
54#include <sfx2/objface.hxx>
55#include <fmturl.hxx>
56#include <fmthdft.hxx>
57#include <fmtclds.hxx>
58#include <docsh.hxx>
59#include <wrtsh.hxx>
60#include <view.hxx>
61#include <swmodule.hxx>
62#include <swundo.hxx>
63#include <fldbas.hxx>
64#include <uitool.hxx>
65#include <basesh.hxx>
66#include <viewopt.hxx>
67#include <fontcfg.hxx>
68#include <fmtsrnd.hxx>
69#include <fldmgr.hxx>
70#include <frmmgr.hxx>
71#include <tablemgr.hxx>
72#include <mdiexp.hxx>
73#include <swdtflvr.hxx>
74#include <pagedesc.hxx>
75#include <fmtcol.hxx>
76#include <edtwin.hxx>
77#include <tblafmt.hxx>
78#include <swwait.hxx>
79#include <cmdid.h>
80#include <strings.hrc>
81#include <unotxdoc.hxx>
82#include <doc.hxx>
83#include <drawdoc.hxx>
86#include <IDocumentUndoRedo.hxx>
87#include <ThemeColorChanger.hxx>
88#include <swabstdlg.hxx>
89#include <modcfg.hxx>
90#include <svx/fmshell.hxx>
91#include <SwRewriter.hxx>
92#include <GraphicSizeCheck.hxx>
93#include <svx/galleryitem.hxx>
96#include <com/sun/star/gallery/GalleryItemType.hpp>
97#include <com/sun/star/beans/PropertyValues.hpp>
98#include <memory>
99
100
104#include <comphelper/lok.hxx>
105#include <sfx2/lokhelper.hxx>
106#include <LibreOfficeKit/LibreOfficeKitEnums.h>
107#include <osl/diagnose.h>
108
109#include <svx/svxdlg.hxx>
111
112#include <shellres.hxx>
113#include <UndoTable.hxx>
114
115#include <ndtxt.hxx>
116#include <UndoManager.hxx>
117#include <fmtrfmrk.hxx>
118#include <txtrfmrk.hxx>
119#include <translatehelper.hxx>
120
122
123// These variables keep the state of Gallery (slot SID_GALLERY_BG_BRUSH)
124// detected by GetGalleryState() for the subsequent ExecuteGallery() call.
125
136
137#define ShellClass_SwBaseShell
138#include <sfx2/msg.hxx>
139#include <swslots.hxx>
140
141#include <AccessibilityCheck.hxx>
142
143namespace
144{
145 SvxContourDlg* GetContourDlg(SwView const &rView)
146 {
147 SfxChildWindow *pWnd = rView.GetViewFrame().GetChildWindow(SvxContourDlgChildWindow::GetChildWindowId());
148 return pWnd ? static_cast<SvxContourDlg*>(pWnd->GetController().get()) : nullptr;
149 }
150
151 SvxIMapDlg* GetIMapDlg(SwView const &rView)
152 {
153 SfxChildWindow* pWnd = rView.GetViewFrame().GetChildWindow(SvxIMapDlgChildWindow::GetChildWindowId());
154 return pWnd ? static_cast<SvxIMapDlg*>(pWnd->GetController().get()) : nullptr;
155 }
156}
157
158using namespace ::com::sun::star;
159using namespace ::com::sun::star::uno;
160using namespace ::com::sun::star::frame;
161using namespace ::com::sun::star::lang;
162
164
165void SwBaseShell::InitInterface_Impl()
166{
167 GetStaticInterface()->RegisterChildWindow(SvxIMapDlgChildWindow::GetChildWindowId());
168 GetStaticInterface()->RegisterChildWindow(SvxContourDlgChildWindow::GetChildWindowId());
169 GetStaticInterface()->RegisterChildWindow(DevelopmentToolChildWindow::GetChildWindowId());
170}
171
172static void lcl_UpdateIMapDlg( SwWrtShell& rSh )
173{
174 Graphic aGrf( rSh.GetIMapGraphic() );
175 GraphicType nGrfType = aGrf.GetType();
176 void* pEditObj = GraphicType::NONE != nGrfType && GraphicType::Default != nGrfType
177 ? rSh.GetIMapInventor() : nullptr;
178 TargetList aList;
180
182 rSh.GetFlyFrameAttr( aSet );
183 const SwFormatURL &rURL = aSet.Get( RES_URL );
185 aGrf, rURL.GetMap(), &aList, pEditObj );
186}
187
189{
190 Graphic aGraf( rSh.GetIMapGraphic() );
191 GraphicType nGrfType = aGraf.GetType();
192 bool bRet = GraphicType::NONE != nGrfType && GraphicType::Default != nGrfType;
193 if( bRet )
194 {
195 OUString aGrfName;
196 if ( nSel & SelectionType::Graphic )
197 rSh.GetGrfNms( &aGrfName, nullptr );
198
199 SvxContourDlg *pDlg = GetContourDlg(rSh.GetView());
200 if (pDlg)
201 {
202 pDlg->Update(aGraf, !aGrfName.isEmpty(),
204 }
205 }
206 return bRet;
207}
208
210{
211 SwWrtShell &rSh = GetShell();
212 SwEditWin& rTmpEditWin = GetView().GetEditWin();
213 switch(rReq.GetSlot())
214 {
215 case SID_DELETE:
217 {
218 // Disallow if the cursor is at the end of a paragraph and the document model
219 // node at this position is an outline node with folded content or the next node
220 // is an outline node with folded content.
221 if (rSh.IsEndPara())
222 {
223 SwNodeIndex aIdx(rSh.GetCursor()->GetPointNode());
224 if (aIdx.GetNode().IsTextNode())
225 {
226 bool bVisible = true;
228 if (!bVisible)
229 break;
230 ++aIdx;
231 if (aIdx.GetNode().IsTextNode())
232 {
233 bVisible = true;
235 if (!bVisible)
236 break;
237 }
238 }
239 }
240 }
241 rSh.DelRight();
242 break;
243
244 case FN_BACKSPACE:
246 {
247 // Disallow if the cursor is at the start of a paragraph and the document model
248 // node at this position is an outline node with folded content or the previous
249 // node is a content node without a layout frame.
250 if (rSh.IsSttPara())
251 {
252 SwNodeIndex aIdx(rSh.GetCursor()->GetPointNode());
253 if (aIdx.GetNode().IsTextNode())
254 {
255 bool bVisible = true;
257 if (!bVisible)
258 break;
259 --aIdx;
260 if (aIdx.GetNode().IsContentNode() &&
262 break;
263 }
264 }
265 }
266 if( rSh.IsNoNum() )
267 {
268 rSh.SttCursorMove();
269 bool bLeft = rSh.Left( SwCursorSkipMode::Chars, true, 1, false );
270 if( bLeft )
271 {
272 rSh.DelLeft();
273 }
274 else
275 // JP 15.07.96: If it no longer goes forward, cancel
276 // the numbering. For example at the beginning
277 // of a doc, frame, table or an area.
278 rSh.DelNumRules();
279
280 rSh.EndCursorMove();
281 break;
282 }
283
284 [[fallthrough]]; // otherwise call DelLeft
286 rSh.DelLeft();
287 break;
288 default:
289 OSL_FAIL("wrong Dispatcher");
290 return;
291 }
292 rReq.Done();
293
294 //#i42732# - notify the edit window that from now on we do not use the input language
295 rTmpEditWin.SetUseInputLanguage( false );
296}
297
299{
300 // Attention: At risk of suicide!
301 // After paste, paste special the shell can be destroy.
302
303 SwWrtShell &rSh = GetShell();
304 sal_uInt16 nId = rReq.GetSlot();
305 bool bIgnore = false;
307
308 switch( nId )
309 {
310 case SID_CUT:
311 case SID_COPY:
313 if ( rSh.HasSelection() )
314 {
315 rtl::Reference<SwTransferable> pTransfer = new SwTransferable( rSh );
316
318 pTransfer->Cut();
319 else
320 {
321 const bool bLockedView = rSh.IsViewLocked();
322 rSh.LockView( true ); //lock visible section
323 pTransfer->Copy();
324 rSh.LockView( bLockedView );
325 }
326 break;
327 }
328 return;
329
333 switch ( nId )
334 {
336 ePasteTable = PasteTableType::PASTE_TABLE;
337 break;
339 ePasteTable = PasteTableType::PASTE_ROW;
340 break;
342 ePasteTable = PasteTableType::PASTE_COLUMN;
343 break;
344 default:
345 ;
346 }
347 [[fallthrough]];
348 case SID_PASTE:
349 {
350 TransferableDataHelper aDataHelper(
352 if( aDataHelper.GetXTransferable().is()
353 && SwTransferable::IsPaste( rSh, aDataHelper ) )
354 {
355 // Temporary variables, because the shell could already be
356 // destroyed after the paste.
357 SwView* pView = &m_rView;
358
359 RndStdIds nAnchorType = RndStdIds::FLY_AT_PARA;
360 const SfxUInt16Item* pAnchorType = rReq.GetArg<SfxUInt16Item>(FN_PARAM_1);
361 if (pAnchorType)
362 nAnchorType = static_cast<RndStdIds>(pAnchorType->GetValue());
363 bool bIgnoreComments = false;
364 const SfxBoolItem* pIgnoreComments = rReq.GetArg<SfxBoolItem>(FN_PARAM_2);
365 if (pIgnoreComments)
366 bIgnoreComments = pIgnoreComments->GetValue();
367 SwTransferable::Paste(rSh, aDataHelper, nAnchorType, bIgnoreComments, ePasteTable);
368
369 if( rSh.IsFrameSelected() || rSh.IsObjSelected() )
370 rSh.EnterSelFrameMode();
371 pView->AttrChangedNotify(nullptr);
372
373 // Fold pasted outlines that have outline content visible attribute false
375 }
376 else
377 return;
378 }
379 break;
380
381 case SID_CLIPBOARD_FORMAT_ITEMS:
382 {
383 const SfxItemSet* pArgs = rReq.GetArgs();
384 const SfxPoolItem* pFormat;
385 if( pArgs && SfxItemState::SET == pArgs->GetItemState( nId, false, &pFormat ) )
386 {
387 TransferableDataHelper aDataHelper(
389 &rSh.GetView().GetEditWin()) );
390 if( aDataHelper.GetXTransferable().is()
391 /*&& SwTransferable::IsPaste( rSh, aDataHelper )*/ )
392 {
393 // Temporary variables, because the shell could already be
394 // destroyed after the paste.
395 SwView* pView = &m_rView;
396
397 SwTransferable::PasteFormat( rSh, aDataHelper,
398 static_cast<SotClipboardFormatId>(static_cast<const SfxUInt32Item*>(pFormat)->GetValue()) );
399
400 //Done() has to be called before the shell has been removed
401 rReq.Done();
402 bIgnore = true;
403 if( rSh.IsFrameSelected() || rSh.IsObjSelected())
404 rSh.EnterSelFrameMode();
405 pView->AttrChangedNotify(nullptr);
406
407 // Fold pasted outlines that have outline content visible attribute false
409 }
410 }
411 }
412 break;
413
414 case SID_PASTE_UNFORMATTED:
415 {
416 TransferableDataHelper aDataHelper(
418 if( aDataHelper.GetXTransferable().is()
419 && SwTransferable::IsPaste( rSh, aDataHelper ) )
420 {
421 // Temporary variables, because the shell could already be
422 // destroyed after the paste.
423 SwView* pView = &m_rView;
424 rReq.Ignore();
425 bIgnore = true;
426 if(SwTransferable::PasteUnformatted( rSh, aDataHelper ))
427 {
428 SfxViewFrame& rViewFrame = pView->GetViewFrame();
429 uno::Reference< frame::XDispatchRecorder > xRecorder =
430 rViewFrame.GetBindings().GetRecorder();
431 if(xRecorder.is()) {
432 SfxRequest aReq(rViewFrame, SID_CLIPBOARD_FORMAT_ITEMS);
433 aReq.AppendItem( SfxUInt32Item( SID_CLIPBOARD_FORMAT_ITEMS, static_cast<sal_uInt32>(SotClipboardFormatId::STRING) ) );
434 aReq.Done();
435 }
436 }
437
438 if (rSh.IsFrameSelected() || rSh.IsObjSelected())
439 rSh.EnterSelFrameMode();
440 pView->AttrChangedNotify(nullptr);
441
442 // Fold pasted outlines that have outline content visible attribute false
444 }
445 else
446 return;
447 }
448 break;
449
450 case SID_PASTE_SPECIAL:
451 {
452 std::shared_ptr<TransferableDataHelper> aDataHelper =
453 std::make_shared<TransferableDataHelper>(TransferableDataHelper::CreateFromSystemClipboard( &rSh.GetView().GetEditWin()));
454
455 if( aDataHelper->GetXTransferable().is()
456 && SwTransferable::IsPaste( rSh, *aDataHelper )
457 && !rSh.CursorInsideInputField() )
458 {
459 rReq.Ignore();
460 bIgnore = true;
461
463 VclPtr<SfxAbstractPasteDialog> pDlg(pFact->CreatePasteDialog( rReq.GetFrameWeld() ));
464
465 // Prepare the dialog
466 SwTransferable::PrePasteSpecial(rSh, *aDataHelper, pDlg);
467 pDlg->PreGetFormat(*aDataHelper);
468
469
470 pDlg->StartExecuteAsync([aDataHelper, pDlg, &rSh, this](sal_Int32 nResult){
471 if (nResult == RET_OK)
472 {
473 // Temporary variables, because the shell could already be
474 // destroyed after the paste.
475 SwView* pView = &m_rView;
476 bool bRet = false;
477 SotClipboardFormatId nFormatId = pDlg->GetFormatOnly();
478
479 if( nFormatId != SotClipboardFormatId::NONE )
480 bRet = SwTransferable::PasteFormat( rSh, *aDataHelper, nFormatId );
481
482 if (bRet)
483 {
484 SfxViewFrame& rViewFrame = pView->GetViewFrame();
485 uno::Reference< frame::XDispatchRecorder > xRecorder =
486 rViewFrame.GetBindings().GetRecorder();
487 if(xRecorder.is()) {
488 SfxRequest aReq(rViewFrame, SID_CLIPBOARD_FORMAT_ITEMS);
489 aReq.AppendItem( SfxUInt32Item( SID_CLIPBOARD_FORMAT_ITEMS, static_cast<sal_uInt32>(nFormatId) ) );
490 aReq.Done();
491 }
492 }
493
494 if (rSh.IsFrameSelected() || rSh.IsObjSelected())
495 rSh.EnterSelFrameMode();
496 pView->AttrChangedNotify(nullptr);
497
498 // Fold pasted outlines that have outline content visible attribute false
500 }
501
502 pDlg->disposeOnce();
503
504 });
505 }
506 else
507 return;
508 }
509 break;
510
511 default:
512 OSL_FAIL("wrong Dispatcher");
513 return;
514 }
515 if(!bIgnore)
516 rReq.Done();
517}
518
519// ClipBoard state
520
522{
523 SwWrtShell &rSh = GetShell();
524 SfxWhichIter aIter(rSet);
525
526 const bool bCopy = rSh.HasSelection();
527
528 sal_uInt16 nWhich = aIter.FirstWhich();
529
530 while(nWhich)
531 {
532 switch(nWhich)
533 {
534 case SID_CUT:
536 {
537 rSet.DisableItem( nWhich );
538 break;
539 }
540 [[fallthrough]];
541 case SID_COPY:
542 if( !bCopy || GetObjectShell()->isContentExtractionLocked())
543 rSet.DisableItem( nWhich );
544 break;
545
549 if( !rSh.IsCursorInTable()
550 || !GetView().IsPasteSpecialAllowed()
552 // disable if not a native Writer table and not a spreadsheet format
553 || !GetView().IsPasteSpreadsheet(rSh.GetTableCopied()) )
554 {
555 rSet.DisableItem( nWhich );
556 }
557 break;
558
559 case SID_PASTE:
560 if( !GetView().IsPasteAllowed() )
561 {
562 rSet.DisableItem( nWhich );
563 }
564 break;
565
566 case SID_PASTE_SPECIAL:
567 if( !GetView().IsPasteSpecialAllowed()
568 || rSh.CursorInsideInputField() )
569 {
570 rSet.DisableItem( nWhich );
571 }
572 break;
573
574 case SID_PASTE_UNFORMATTED:
575 if( !GetView().IsPasteSpecialAllowed() )
576 {
577 rSet.DisableItem( nWhich );
578 }
579 break;
580
581 case SID_CLIPBOARD_FORMAT_ITEMS:
582 {
583 TransferableDataHelper aDataHelper(
585 &rSh.GetView().GetEditWin()) );
586
587 SvxClipboardFormatItem aFormatItem( SID_CLIPBOARD_FORMAT_ITEMS );
588 SwTransferable::FillClipFormatItem( rSh, aDataHelper, aFormatItem );
589 rSet.Put( aFormatItem );
590 }
591 break;
592 }
593 nWhich = aIter.NextWhich();
594 }
595}
596
597// Perform undo
598
600{
602
603 SwWrtShell &rWrtShell = GetShell();
604
605 SwUndoId nUndoId(SwUndoId::EMPTY);
606 sal_uInt16 nId = rReq.GetSlot(), nCnt = 1;
607 const SfxItemSet* pArgs = rReq.GetArgs();
608 const SfxPoolItem* pItem;
609 if( pArgs && SfxItemState::SET == pArgs->GetItemState( nId, false, &pItem ))
610 nCnt = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
611
612 // Repair mode: allow undo/redo of all undo actions, even if access would
613 // be limited based on the view shell ID.
614 bool bRepair = false;
615 const SfxBoolItem* pRepairItem;
616 if (pArgs && (pRepairItem = pArgs->GetItemIfSet(SID_REPAIRPACKAGE, false)))
617 bRepair = pRepairItem->GetValue();
618
619 // #i106349#: save pointer: undo/redo may delete the shell, i.e., this!
620 SfxViewFrame& rViewFrame( GetView().GetViewFrame() );
621
622 IDocumentUndoRedo& rUndoRedo = rWrtShell.GetIDocumentUndoRedo();
623 bool bWasRepair = rUndoRedo.DoesRepair();
624 rUndoRedo.DoRepair(bRepair);
625 comphelper::ScopeGuard aGuard([&rUndoRedo, bWasRepair]()
626 {
627 rUndoRedo.DoRepair(bWasRepair);
628 });
629
630 switch( nId )
631 {
632 case SID_UNDO:
633 if (rUndoRedo.GetLastUndoInfo(nullptr, &nUndoId, &rWrtShell.GetView()))
634 {
635 for (SwViewShell& rShell : rWrtShell.GetRingContainer())
636 rShell.LockPaint(LockPaintReason::Undo);
637
638 sal_uInt16 nUndoOffset = 0;
639 if (comphelper::LibreOfficeKit::isActive() && !bRepair && nCnt == 1)
640 {
641 sw::UndoManager& rManager = rWrtShell.GetDoc()->GetUndoManager();
642 const SfxUndoAction* pAction = rManager.GetUndoAction();
643 SwView& rView = rWrtShell.GetView();
644 ViewShellId nViewShellId = rView.GetViewShellId();
645 sal_uInt16 nOffset = 0;
646 if (pAction->GetViewShellId() != nViewShellId
647 && rManager.IsViewUndoActionIndependent(&rView, nOffset))
648 {
649 // Execute the undo with an offset: don't undo the top action, but an
650 // earlier one, since it's independent and that belongs to our view.
651 nUndoOffset += nOffset;
652 }
653 }
654
655 rWrtShell.Do(SwWrtShell::UNDO, nCnt, nUndoOffset);
656
657 for (SwViewShell& rShell : rWrtShell.GetRingContainer())
658 rShell.UnlockPaint();
659
660 // tdf#141613 FIXME: Disable redoing header/footer changes for now.
661 // The proper solution would be to write a SwUndoHeaderFooter class
662 // to represent the addition of a header or footer to the current page.
663 if (nUndoId == SwUndoId::HEADER_FOOTER)
664 rUndoRedo.ClearRedo();
665 }
666 break;
667
668 case SID_REDO:
669 if (rUndoRedo.GetFirstRedoInfo(nullptr, &nUndoId, &rWrtShell.GetView()))
670 {
671 for (SwViewShell& rShell : rWrtShell.GetRingContainer())
672 rShell.LockPaint(LockPaintReason::Redo);
673 rWrtShell.Do( SwWrtShell::REDO, nCnt );
674 for (SwViewShell& rShell : rWrtShell.GetRingContainer())
675 rShell.UnlockPaint();
676 }
677 break;
678
679 case SID_REPEAT:
680 rWrtShell.Do( SwWrtShell::REPEAT );
681 break;
682 default:
683 OSL_FAIL("wrong Dispatcher");
684 }
685
686 if (nUndoId == SwUndoId::CONFLICT)
687 {
688 rReq.SetReturnValue( SfxUInt32Item(nId, static_cast<sal_uInt32>(SID_REPAIRPACKAGE)) );
689 }
690
691 rViewFrame.GetBindings().InvalidateAll(false);
692}
693
694// State of undo
695
697{
698 SwUndoId nUndoId(SwUndoId::EMPTY);
699 SwWrtShell &rSh = GetShell();
700 SfxWhichIter aIter(rSet);
701 sal_uInt16 nWhich = aIter.FirstWhich();
702 while(nWhich)
703 {
704 switch(nWhich)
705 {
706 case SID_UNDO:
707 {
708 if (rSh.GetLastUndoInfo(nullptr, &nUndoId, &rSh.GetView()))
709 {
710 rSet.Put( SfxStringItem(nWhich,
712 }
713 else if (nUndoId == SwUndoId::CONFLICT)
714 {
715 rSet.Put( SfxUInt32Item(nWhich, static_cast<sal_uInt32>(SID_REPAIRPACKAGE)) );
716 }
717 else
718 rSet.DisableItem(nWhich);
719
720 break;
721 }
722 case SID_REDO:
723 {
724 if (rSh.GetFirstRedoInfo(nullptr, &nUndoId, &rSh.GetView()))
725 {
726 rSet.Put(SfxStringItem(nWhich,
728 }
729 else if (nUndoId == SwUndoId::CONFLICT)
730 {
731 rSet.Put( SfxInt32Item(nWhich, static_cast<sal_uInt32>(SID_REPAIRPACKAGE)) );
732 }
733 else
734 rSet.DisableItem(nWhich);
735 break;
736 }
737 case SID_REPEAT:
738 { // Repeat is only possible if no REDO is possible - UI-Restriction
739 if ((!rSh.GetFirstRedoInfo(nullptr, nullptr)) &&
740 !rSh.IsSelFrameMode() &&
741 (SwUndoId::EMPTY != rSh.GetRepeatInfo(nullptr)))
742 {
743 rSet.Put(SfxStringItem(nWhich, rSh.GetRepeatString()));
744 }
745 else
746 rSet.DisableItem(nWhich);
747 break;
748 }
749
750 case SID_GETUNDOSTRINGS:
751 if (rSh.GetLastUndoInfo(nullptr, nullptr))
752 {
753 SfxStringListItem aStrLst( nWhich );
754 rSh.GetDoStrings( SwWrtShell::UNDO, aStrLst );
755 rSet.Put( aStrLst );
756 }
757 else
758 rSet.DisableItem( nWhich );
759 break;
760
761 case SID_GETREDOSTRINGS:
762 if (rSh.GetFirstRedoInfo(nullptr, nullptr))
763 {
764 SfxStringListItem aStrLst( nWhich );
765 rSh.GetDoStrings( SwWrtShell::REDO, aStrLst );
766 rSet.Put( aStrLst );
767 }
768 else
769 rSet.DisableItem( nWhich );
770 break;
771 }
772 nWhich = aIter.NextWhich();
773 }
774}
775
776namespace
777{
780bool UpdateFieldContents(SfxRequest& rReq, SwWrtShell& rWrtSh)
781{
782 const SfxStringItem* pTypeName = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
783 if (!pTypeName || pTypeName->GetValue() != "SetRef")
784 {
785 // This is implemented so far only for reference marks.
786 return false;
787 }
788
789 const SfxStringItem* pNamePrefix = rReq.GetArg<SfxStringItem>(FN_PARAM_2);
790 if (!pNamePrefix)
791 {
792 return false;
793 }
794 const OUString& rNamePrefix = pNamePrefix->GetValue();
795
796 const SfxUnoAnyItem* pFields = rReq.GetArg<SfxUnoAnyItem>(FN_PARAM_3);
797 if (!pFields)
798 {
799 return false;
800 }
801 uno::Sequence<beans::PropertyValues> aFields;
802 pFields->GetValue() >>= aFields;
803
804 SwDoc* pDoc = rWrtSh.GetDoc();
805 pDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::UPDATE_FIELDS, nullptr);
806 rWrtSh.StartAction();
807
808 std::vector<const SwFormatRefMark*> aRefMarks;
809
810 for (sal_uInt16 i = 0; i < pDoc->GetRefMarks(); ++i)
811 {
812 aRefMarks.push_back(pDoc->GetRefMark(i));
813 }
814
815 std::sort(aRefMarks.begin(), aRefMarks.end(),
816 [](const SwFormatRefMark* pMark1, const SwFormatRefMark* pMark2) -> bool {
817 const SwTextRefMark* pTextRefMark1 = pMark1->GetTextRefMark();
818 const SwTextRefMark* pTextRefMark2 = pMark2->GetTextRefMark();
819 SwPosition aPos1(pTextRefMark1->GetTextNode(), pTextRefMark1->GetStart());
820 SwPosition aPos2(pTextRefMark2->GetTextNode(), pTextRefMark2->GetStart());
821 return aPos1 < aPos2;
822 });
823
824 sal_uInt16 nFieldIndex = 0;
825 for (auto& pIntermediateRefMark : aRefMarks)
826 {
827 auto pRefMark = const_cast<SwFormatRefMark*>(pIntermediateRefMark);
828 if (!pRefMark->GetRefName().startsWith(rNamePrefix))
829 {
830 continue;
831 }
832
833 if (nFieldIndex >= aFields.getLength())
834 {
835 break;
836 }
837 comphelper::SequenceAsHashMap aMap(aFields[nFieldIndex++]);
838 auto aName = aMap["Name"].get<OUString>();
839 pRefMark->GetRefName() = aName;
840
841 OUString aContent = aMap["Content"].get<OUString>();
842 auto pTextRefMark = const_cast<SwTextRefMark*>(pRefMark->GetTextRefMark());
843 pTextRefMark->UpdateFieldContent(pDoc, rWrtSh, aContent);
844 }
845
846 rWrtSh.EndAction();
847 pDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::UPDATE_FIELDS, nullptr);
848 return true;
849}
850
853void UpdateFieldContent(SfxRequest& rReq, SwWrtShell& rWrtSh)
854{
855 const SfxStringItem* pTypeName = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
856 if (!pTypeName || pTypeName->GetValue() != "SetRef")
857 {
858 // This is implemented so far only for reference marks.
859 return;
860 }
861
862 const SfxStringItem* pNamePrefix = rReq.GetArg<SfxStringItem>(FN_PARAM_2);
863 if (!pNamePrefix)
864 {
865 return;
866 }
867 const OUString& rNamePrefix = pNamePrefix->GetValue();
868
869 const SfxUnoAnyItem* pField = rReq.GetArg<SfxUnoAnyItem>(FN_PARAM_3);
870 if (!pField)
871 {
872 return;
873 }
874 uno::Sequence<beans::PropertyValue> aField;
875 pField->GetValue() >>= aField;
876
877 SwPosition& rCursor = *rWrtSh.GetCursor()->GetPoint();
878 SwTextNode* pTextNode = rCursor.GetNode().GetTextNode();
879 std::vector<SwTextAttr*> aAttrs
880 = pTextNode->GetTextAttrsAt(rCursor.GetContentIndex(), RES_TXTATR_REFMARK);
881 if (aAttrs.empty())
882 {
883 return;
884 }
885
886 auto& rRefmark = const_cast<SwFormatRefMark&>(aAttrs[0]->GetRefMark());
887 if (!rRefmark.GetRefName().startsWith(rNamePrefix))
888 {
889 return;
890 }
891
892 SwDoc* pDoc = rWrtSh.GetDoc();
893 SwRewriter aRewriter;
894 aRewriter.AddRule(UndoArg1, rRefmark.GetRefName());
895 pDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::UPDATE_FIELD, &aRewriter);
896 rWrtSh.StartAction();
898 [&rWrtSh, &aRewriter]
899 {
900 rWrtSh.EndAction();
901 rWrtSh.GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::UPDATE_FIELD, &aRewriter);
902 });
903
905 auto aName = aMap["Name"].get<OUString>();
906 rRefmark.GetRefName() = aName;
907
908 OUString aContent = aMap["Content"].get<OUString>();
909 auto pTextRefMark = const_cast<SwTextRefMark*>(rRefmark.GetTextRefMark());
910 pTextRefMark->UpdateFieldContent(pDoc, rWrtSh, aContent);
911}
912}
913
914// Evaluate respectively dispatching the slot Id
915
917{
918 const SfxPoolItem *pItem;
919 SwWrtShell &rSh = GetShell();
920 const SfxItemSet* pArgs = rReq.GetArgs();
921 bool bMore = false;
922
923 sal_uInt16 nSlot = rReq.GetSlot();
924 switch(nSlot)
925 {
926 case FN_REPAGINATE:
927 {
928 Reference < XModel > xModel = GetView().GetDocShell()->GetModel();
929 auto pDoc = comphelper::getFromUnoTunnel<SwXTextDocument>(xModel);
930 pDoc->NotifyRefreshListeners();
931 rSh.CalcLayout();
932 }
933 break;
934 case FN_UPDATE_FIELDS:
935 {
936 if (UpdateFieldContents(rReq, rSh))
937 {
938 // Parameters indicated that the name / content of fields has to be updated to
939 // the provided values, don't do an actual fields update.
940 break;
941 }
942
943 rSh.UpdateDocStat();
944 rSh.EndAllTableBoxEdit();
945 rSh.SwViewShell::UpdateFields(true);
946
947 if( rSh.IsCursorInTable() )
948 {
949 if( !rSh.IsTableComplexForChart() )
950 SwTableFUNC( &rSh ).UpdateChart();
953 }
954 }
955 break;
956 case FN_UPDATE_FIELD:
957 {
958 UpdateFieldContent(rReq, rSh);
959 }
960 break;
961 case FN_UPDATE_CHARTS:
962 {
963 SwWait aWait( *m_rView.GetDocShell(), true );
964 rSh.UpdateAllCharts();
965 }
966 break;
967
968 case FN_UPDATE_ALL:
969 {
970 comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer
972 rEmbeddedObjectContainer.setUserAllowsLinkUpdate(true);
973
974 SwView& rTempView = GetView();
975 rSh.EnterStdMode();
976 if( !rSh.GetLinkManager().GetLinks().empty() )
977 {
978 rSh.StartAllAction();
979 rSh.GetLinkManager().UpdateAllLinks( false, true, nullptr );
980 rSh.EndAllAction();
981 }
982 SfxDispatcher &rDis = *rTempView.GetViewFrame().GetDispatcher();
984 rDis.Execute( FN_UPDATE_TOX );
986 rSh.Reformat();
988 }
989 break;
990
992 rSh.UpdateInputFields();
993 break;
994
995 case FN_PREV_BOOKMARK:
996 rReq.SetReturnValue(SfxBoolItem( nSlot, rSh.GoPrevBookmark()));
997 break;
998 case FN_NEXT_BOOKMARK:
999 rReq.SetReturnValue(SfxBoolItem( nSlot, rSh.GoNextBookmark()));
1000 break;
1001
1002 case FN_GOTO_NEXT_MARK:
1003 case FN_GOTO_PREV_MARK:
1004 {
1005 SwFieldMgr aFieldMgr;
1006 SwFieldType* pFieldType = aFieldMgr.GetFieldType(SwFieldIds::JumpEdit);
1007
1008 if (pFieldType)
1009 {
1010 if (rSh.IsSelFrameMode())
1011 {
1012 rSh.UnSelectFrame();
1013 rSh.LeaveSelFrameMode();
1014 }
1015
1016 if (rSh.HasMark())
1017 {
1018 SwMvContext aMvContext(&rSh);
1019 if (rSh.IsCursorPtAtEnd())
1020 rSh.SwapPam();
1021 rSh.ClearMark();
1022 rSh.EndSelect();
1023 }
1024 bool bRet = rSh.MoveFieldType( pFieldType, nSlot == FN_GOTO_NEXT_MARK );
1025 SwField* pCurField = bRet ? rSh.GetCurField() : nullptr;
1026 if (pCurField)
1027 rSh.ClickToField(*pCurField, /*bExecHyperlinks=*/false);
1028 rReq.SetReturnValue(SfxBoolItem( nSlot, bRet));
1029 }
1030 }
1031 break;
1032
1033 case FN_START_DOC_DIRECT:
1034 case FN_END_DOC_DIRECT:
1035 {
1036 if (rSh.IsSelFrameMode())
1037 {
1038 rSh.UnSelectFrame();
1039 rSh.LeaveSelFrameMode();
1040 }
1041 rSh.EnterStdMode();
1042 nSlot == FN_START_DOC_DIRECT ?
1043 rSh.SttEndDoc(true) :
1044 rSh.SttEndDoc(false);
1045 }
1046 break;
1047 case FN_GOTO_PREV_OBJ:
1048 case FN_GOTO_NEXT_OBJ:
1049 {
1050 bool bSuccess = rSh.GotoObj( nSlot == FN_GOTO_NEXT_OBJ );
1051 rReq.SetReturnValue(SfxBoolItem(nSlot, bSuccess));
1052 if (bSuccess && !rSh.IsSelFrameMode())
1053 {
1054 rSh.HideCursor();
1055 rSh.EnterSelFrameMode();
1056 GetView().AttrChangedNotify(nullptr);
1057 }
1058 }
1059 break;
1060 case SID_GALLERY_FORMATS:
1061 {
1062 const SvxGalleryItem* pGalleryItem = SfxItemSet::GetItem<SvxGalleryItem>(pArgs, SID_GALLERY_FORMATS, false);
1063 if ( !pGalleryItem )
1064 break;
1065
1066 const SelectionType nSelType = rSh.GetSelectionType();
1067 sal_Int8 nGalleryItemType( pGalleryItem->GetType() );
1068
1069 if ( (!rSh.IsSelFrameMode() || nSelType & SelectionType::Graphic) &&
1070 nGalleryItemType == css::gallery::GalleryItemType::GRAPHIC )
1071 {
1072 SwWait aWait( *m_rView.GetDocShell(), true );
1073
1074 OUString aGrfName, aFltName;
1075 const Graphic aGrf( pGalleryItem->GetGraphic() );
1076
1077 if ( nSelType & SelectionType::Graphic )
1078 rSh.ReRead( aGrfName, aFltName, &aGrf );
1079 else
1080 rSh.InsertGraphic( aGrfName, aFltName, aGrf );
1081
1083 }
1084 else if(!rSh.IsSelFrameMode() &&
1085 nGalleryItemType == css::gallery::GalleryItemType::MEDIA )
1086 {
1087 const SfxStringItem aMediaURLItem( SID_INSERT_AVMEDIA, pGalleryItem->GetURL() );
1089 SID_INSERT_AVMEDIA, SfxCallMode::SYNCHRON,
1090 { &aMediaURLItem });
1091 }
1092 }
1093 break;
1095 {
1096 if (pArgs)
1097 {
1098 // Determine the current PageDescriptor and fill the set with that.
1099 const size_t nCurIdx = rSh.GetCurPageDesc();
1100 SwPageDesc aPageDesc(rSh.GetPageDesc(nCurIdx));
1101
1102 SwFrameFormat &rFormat = aPageDesc.GetMaster();
1103
1104 SwFormatCol aFormatCol = rFormat.GetCol();
1105
1106 sal_uInt16 nCount;
1107 if(SfxItemState::SET == pArgs->GetItemState(nSlot))
1108 nCount = static_cast<const SfxUInt16Item &>(pArgs->Get(nSlot)).GetValue();
1109 else
1110 nCount = pArgs->Get(SID_ATTR_COLUMNS).GetValue();
1111 sal_uInt16 nGutterWidth = DEF_GUTTER_WIDTH;
1112
1113 aFormatCol.Init(nCount ? nCount : 1, nGutterWidth, USHRT_MAX);
1114 aFormatCol.SetWishWidth(USHRT_MAX);
1115 aFormatCol.SetGutterWidth(nGutterWidth, USHRT_MAX);
1116
1117 rFormat.SetFormatAttr(aFormatCol);
1118
1119 rSh.ChgPageDesc(nCurIdx, aPageDesc);
1120 }
1121 else
1123 }
1124 break;
1128 {
1129 sal_Unicode cDelim = 0;
1130 bool bToTable = false;
1131 if( nSlot == FN_CONVERT_TEXT_TO_TABLE ||
1132 ( nSlot == FN_CONVERT_TEXT_TABLE && nullptr == rSh.GetTableFormat() ))
1133 bToTable = true;
1135 SwTableAutoFormat const* pTAFormat = nullptr;
1136 std::unique_ptr<SwTableAutoFormatTable> pAutoFormatTable;
1137 bool bDeleteFormat = true;
1138 if(pArgs && SfxItemState::SET == pArgs->GetItemState( FN_PARAM_1, true, &pItem))
1139 {
1140 aInsTableOpts.mnInsMode = SwInsertTableFlags::NONE;
1141 // Delimiter
1142 OUString sDelim = static_cast< const SfxStringItem* >(pItem)->GetValue();
1143 if(!sDelim.isEmpty())
1144 cDelim = sDelim[0];
1145 // AutoFormat
1146 if(SfxItemState::SET == pArgs->GetItemState( FN_PARAM_2, true, &pItem))
1147 {
1148 OUString sAutoFormat = static_cast< const SfxStringItem* >(pItem)->GetValue();
1149
1150 pAutoFormatTable.reset(new SwTableAutoFormatTable);
1151 pAutoFormatTable->Load();
1152
1153 for( sal_uInt16 i = 0, nCount = pAutoFormatTable->size(); i < nCount; i++ )
1154 {
1155 SwTableAutoFormat const*const pFormat = &(*pAutoFormatTable)[ i ];
1156 if( pFormat->GetName() == sAutoFormat )
1157 {
1158 pTAFormat = pFormat;
1159 bDeleteFormat = false;
1160 break;
1161 }
1162 }
1163 }
1164 //WithHeader
1165 if(SfxItemState::SET == pArgs->GetItemState( FN_PARAM_3, true, &pItem) &&
1166 static_cast< const SfxBoolItem* >(pItem)->GetValue())
1167 aInsTableOpts.mnInsMode |= SwInsertTableFlags::Headline;
1168 // RepeatHeaderLines
1169 if(SfxItemState::SET == pArgs->GetItemState( FN_PARAM_4, true, &pItem))
1170 aInsTableOpts.mnRowsToRepeat =
1171 o3tl::narrowing<sal_uInt16>(static_cast< const SfxInt16Item* >(pItem)->GetValue());
1172 //WithBorder
1173 if(SfxItemState::SET == pArgs->GetItemState( FN_PARAM_5, true, &pItem) &&
1174 static_cast< const SfxBoolItem* >(pItem)->GetValue())
1176 //DontSplitTable
1177 if(SfxItemState::SET == pArgs->GetItemState( FN_PARAM_6, true, &pItem) &&
1178 !static_cast< const SfxBoolItem* >(pItem)->GetValue() )
1180 }
1181 else
1182 {
1185 if( RET_OK == pDlg->Execute() )
1186 {
1187 pDlg->GetValues( cDelim, aInsTableOpts, pTAFormat );
1188
1189 }
1190 }
1191
1192 if( cDelim )
1193 {
1194 //Shell change!
1195 SwView& rSaveView = m_rView;
1196 bool bInserted = false;
1197 //recording:
1198 SfxViewFrame& rViewFrame = GetView().GetViewFrame();
1199 if (SfxRequest::HasMacroRecorder(rViewFrame))
1200 {
1201 SfxRequest aReq(rViewFrame, nSlot);
1202 aReq.AppendItem( SfxStringItem( FN_PARAM_1, OUString(cDelim) ));
1203 if(bToTable)
1204 {
1205 if(pTAFormat)
1206 aReq.AppendItem( SfxStringItem( FN_PARAM_2, pTAFormat->GetName()));
1207 aReq.AppendItem( SfxBoolItem ( FN_PARAM_3, bool(aInsTableOpts.mnInsMode & SwInsertTableFlags::Headline)));
1208 aReq.AppendItem( SfxInt16Item( FN_PARAM_4, static_cast<short>(aInsTableOpts.mnRowsToRepeat) ));
1209 aReq.AppendItem( SfxBoolItem ( FN_PARAM_5, bool(aInsTableOpts.mnInsMode & SwInsertTableFlags::DefaultBorder) ));
1210 aReq.AppendItem( SfxBoolItem ( FN_PARAM_6, !(aInsTableOpts.mnInsMode & SwInsertTableFlags::SplitLayout)));
1211 }
1212 aReq.Done();
1213 }
1214
1215 if( !bToTable )
1216 rSh.TableToText( cDelim );
1217 else
1218 {
1219 bInserted = rSh.TextToTable( aInsTableOpts, cDelim, pTAFormat );
1220 }
1221 rSh.EnterStdMode();
1222
1223 if( bInserted )
1224 rSaveView.AutoCaption( TABLE_CAP );
1225 }
1226 if(bDeleteFormat)
1227 delete pTAFormat;
1228 }
1229 break;
1230 case SID_STYLE_WATERCAN:
1231 case SID_STYLE_UPDATE_BY_EXAMPLE:
1232 case SID_STYLE_NEW_BY_EXAMPLE:
1233 case SID_STYLE_APPLY:
1234 {
1236 if ( ShellMode::Draw != eMode &&
1240 {
1241 // oj #107754#
1242 if ( SID_STYLE_WATERCAN == nSlot )
1243 {
1244 const bool bLockedView = rSh.IsViewLocked();
1245 rSh.LockView( true ); //lock visible section
1246
1248
1249 rSh.LockView( bLockedView );
1250 }
1251 else
1252 // Will be recorded from the DocShell
1254 }
1255 }
1256 break;
1257 case SID_CLASSIFICATION_APPLY:
1258 {
1259 GetView().GetDocShell()->Execute(rReq);
1260 }
1261 break;
1262 case SID_CLASSIFICATION_DIALOG:
1263 {
1264 GetView().GetDocShell()->Execute(rReq);
1265 }
1266 break;
1267 case SID_PARAGRAPH_SIGN_CLASSIFY_DLG:
1268 {
1269 GetView().GetDocShell()->Execute(rReq);
1270 }
1271 break;
1272 case SID_WATERMARK:
1273 {
1274 GetView().GetDocShell()->Execute(rReq);
1275 }
1276 break;
1277 case FN_ESCAPE:
1278 GetView().ExecuteSlot(rReq);
1279 break;
1280 case SID_IMAP:
1281 {
1282 sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId();
1283
1284 SfxViewFrame& rVFrame = GetView().GetViewFrame();
1285 rVFrame.ToggleChildWindow( nId );
1286 rVFrame.GetBindings().Invalidate( SID_IMAP );
1287
1288 if ( rVFrame.HasChildWindow( nId ) && rSh.IsFrameSelected() )
1289 lcl_UpdateIMapDlg( rSh );
1290 }
1291 break;
1292 case SID_IMAP_EXEC:
1293 {
1294 SvxIMapDlg* pDlg = GetIMapDlg(GetView());
1295
1296 // Check, if the allocation is useful or allowed at all.
1297 if ( rSh.IsFrameSelected() &&
1298 pDlg->GetEditingObject() == rSh.GetIMapInventor() )
1299 {
1301 rSh.GetFlyFrameAttr( aSet );
1302 SwFormatURL aURL( aSet.Get( RES_URL ) );
1303 aURL.SetMap( &pDlg->GetImageMap() );
1304 aSet.Put( aURL );
1305 rSh.SetFlyFrameAttr( aSet );
1306 }
1307 }
1308 break;
1312 {
1313 SwViewOption aViewOption = *rSh.GetViewOptions();
1314 bool bAllInText = FN_SET_TRACKED_CHANGES_IN_TEXT == nSlot;
1315 aViewOption.SetShowChangesInMargin( !bAllInText );
1316 if ( !bAllInText )
1318 rSh.ApplyViewOptions( aViewOption );
1319
1320 // tdf#140982 restore annotation ranges stored in temporary bookmarks
1321 // (only remove temporary bookmarks during file saving to avoid possible
1322 // conflict with lazy deletion of the bookmarks of the moved tracked deletions)
1323 if ( bAllInText || FN_SET_TRACKED_INSERTIONS_IN_MARGIN == nSlot )
1325 }
1326 break;
1327 case SID_CONTOUR_DLG:
1328 {
1329 sal_uInt16 nId = SvxContourDlgChildWindow::GetChildWindowId();
1330
1331 SfxViewFrame& rVFrame = GetView().GetViewFrame();
1332 rVFrame.ToggleChildWindow( nId );
1333 rVFrame.GetBindings().Invalidate( SID_CONTOUR_DLG );
1334
1335 SelectionType nSel = rSh.GetSelectionType();
1336 if ( rVFrame.HasChildWindow( nId ) &&
1338 {
1339 lcl_UpdateContourDlg( rSh, nSel );
1340 }
1341 }
1342 break;
1343 case SID_CONTOUR_EXEC:
1344 {
1345 SvxContourDlg *pDlg = GetContourDlg(GetView());
1346 // Check, if the allocation is useful or allowed at all.
1347 SelectionType nSel = rSh.GetSelectionType();
1349 {
1350 if (pDlg && pDlg->GetEditingObject() == rSh.GetIMapInventor())
1351 {
1352 rSh.StartAction();
1354 rSh.GetFlyFrameAttr( aSet );
1355 SwFormatSurround aSur( aSet.Get( RES_SURROUND ) );
1356 if ( !aSur.IsContour() )
1357 {
1358 aSur.SetContour( true );
1359 if ( aSur.GetSurround() == css::text::WrapTextMode_NONE )
1360 aSur.SetSurround( css::text::WrapTextMode_PARALLEL );
1361 aSet.Put( aSur );
1362 rSh.SetFlyFrameAttr( aSet );
1363 }
1364 const tools::PolyPolygon aPoly( pDlg->GetPolyPolygon() );
1365 rSh.SetGraphicPolygon( &aPoly );
1366 if ( pDlg->IsGraphicChanged() )
1367 rSh.ReRead( OUString(), OUString(), &pDlg->GetGraphic());
1368 rSh.EndAction();
1369 }
1370 }
1371 }
1372 break;
1373 case FN_FRAME_TO_ANCHOR:
1374 {
1375 rSh.GotoFlyAnchor();
1376 rSh.EnterStdMode();
1377 rSh.CallChgLnk();
1378 }
1379 break;
1385 {
1386 RndStdIds eSet = nSlot == FN_TOOL_ANCHOR_PAGE
1387 ? RndStdIds::FLY_AT_PAGE
1388 : nSlot == FN_TOOL_ANCHOR_PARAGRAPH
1389 ? RndStdIds::FLY_AT_PARA
1390 : nSlot == FN_TOOL_ANCHOR_FRAME
1391 ? RndStdIds::FLY_AT_FLY
1392 : nSlot == FN_TOOL_ANCHOR_CHAR
1393 ? RndStdIds::FLY_AS_CHAR
1394 : RndStdIds::FLY_AT_CHAR;
1395 rSh.StartUndo();
1396 if (rSh.IsObjSelected())
1397 rSh.ChgAnchor(eSet);
1398 else if (rSh.IsFrameSelected())
1399 {
1400 SwFormatAnchor aAnc(eSet, eSet == RndStdIds::FLY_AT_PAGE ? rSh.GetPhyPageNum() : 0);
1402 rSh.SetFlyFrameAttr(aSet);
1403 }
1404 // if new anchor is 'as char' and it is a Math object and the usual
1405 // pre-conditions are met then align the formula to the baseline of the text
1406 const uno::Reference < embed::XEmbeddedObject > xObj( rSh.GetOleRef() );
1407 const bool bDoMathBaselineAlignment = xObj.is() && SotExchange::IsMath( xObj->getClassID() )
1408 && RndStdIds::FLY_AS_CHAR == eSet && rSh.GetDoc()->getIDocumentSettingAccess().get( DocumentSettingId::MATH_BASELINE_ALIGNMENT );
1409 if (bDoMathBaselineAlignment)
1410 rSh.AlignFormulaToBaseline( xObj );
1411
1412 sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
1413 if( nHtmlMode )
1414 {
1416 rSh.GetFlyFrameAttr(aSet);
1417
1418 const SwFormatSurround& rSurround = aSet.Get(RES_SURROUND);
1419 const SwFormatVertOrient& rVert = aSet.Get(RES_VERT_ORIENT);
1420 const SwFormatHoriOrient& rHori = aSet.Get(RES_HORI_ORIENT);
1421 sal_Int16 eVOrient = rVert.GetVertOrient();
1422 sal_Int16 eHOrient = rHori.GetHoriOrient();
1423 css::text::WrapTextMode eSurround = rSurround.GetSurround();
1424
1425 switch( eSet )
1426 {
1427 case RndStdIds::FLY_AT_FLY:
1428 case RndStdIds::FLY_AT_PAGE:
1429 //Wrap through, left or from left, top, from top
1430 if(eSurround != css::text::WrapTextMode_THROUGH)
1431 aSet.Put(SwFormatSurround(css::text::WrapTextMode_THROUGH));
1432
1433 if( eVOrient != text::VertOrientation::TOP && eVOrient != text::VertOrientation::NONE)
1434 aSet.Put(SwFormatVertOrient(0, text::VertOrientation::TOP));
1435
1436 if (eHOrient != text::HoriOrientation::NONE && eHOrient != text::HoriOrientation::LEFT)
1437 aSet.Put(SwFormatHoriOrient(0, text::HoriOrientation::LEFT));
1438 break;
1439
1440 case RndStdIds::FLY_AT_PARA:
1441 // left, from left, right, top, no wrap, wrap left and right
1442 if (eSurround != css::text::WrapTextMode_LEFT && eSurround != css::text::WrapTextMode_RIGHT)
1443 aSet.Put(SwFormatSurround(css::text::WrapTextMode_LEFT));
1444
1445 if( eVOrient != text::VertOrientation::TOP)
1446 aSet.Put(SwFormatVertOrient(0, text::VertOrientation::TOP));
1447
1448 if (eHOrient != text::HoriOrientation::NONE && eHOrient != text::HoriOrientation::LEFT && eHOrient != text::HoriOrientation::RIGHT)
1449 aSet.Put(SwFormatHoriOrient(0, text::HoriOrientation::LEFT));
1450 break;
1451
1452 case RndStdIds::FLY_AT_CHAR:
1453 // left, from left, right, top, wrap through
1454 if(eSurround != css::text::WrapTextMode_THROUGH)
1455 aSet.Put(SwFormatSurround(css::text::WrapTextMode_THROUGH));
1456
1457 if( eVOrient != text::VertOrientation::TOP)
1458 aSet.Put(SwFormatVertOrient(0, text::VertOrientation::TOP));
1459
1460 if (eHOrient != text::HoriOrientation::NONE && eHOrient != text::HoriOrientation::LEFT && eHOrient != text::HoriOrientation::RIGHT)
1461 aSet.Put(SwFormatHoriOrient(0, text::HoriOrientation::LEFT));
1462 break;
1463
1464 default:
1465 ;
1466 }
1467
1468 if( aSet.Count() )
1469 rSh.SetFlyFrameAttr( aSet );
1470 }
1471 rSh.EndUndo();
1472
1473 GetView().GetViewFrame().GetBindings().Invalidate( SID_ANCHOR_MENU );
1474 }
1475 break;
1476
1477 case FN_FRAME_NOWRAP:
1478 case FN_FRAME_WRAP:
1480 case FN_FRAME_WRAPTHRU:
1485 case FN_FRAME_WRAP_LEFT:
1487 SetWrapMode( nSlot );
1488 break;
1489
1491 {
1492 if( !rSh.GetLinkManager().GetLinks().empty() )
1493 {
1494 rSh.EnterStdMode();
1495 rSh.StartAllAction();
1496 rSh.GetLinkManager().UpdateAllLinks( false, false, nullptr );
1497 rSh.EndAllAction();
1498 }
1499 }
1500 break;
1501
1503 if (pArgs && pArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET)
1504 {
1505 if (const SfxBoolItem* pBoolItem = dynamic_cast<const SfxBoolItem*>(pItem))
1506 {
1507 bool bDesignMode = pBoolItem->GetValue();
1508
1509 // set from design mode
1510 OSL_ENSURE( GetView().GetFormShell() != nullptr, "form shell?" );
1511 SfxRequest aReq(GetView().GetViewFrame(), SID_FM_DESIGN_MODE);
1512 aReq.AppendItem( SfxBoolItem( SID_FM_DESIGN_MODE, bDesignMode ) );
1513 GetView().GetFormShell()->Execute( aReq );
1514 aReq.Done();
1515
1516 // also set suitable view options
1517 SwViewOption aViewOption = *rSh.GetViewOptions();
1518 aViewOption.SetFormView( ! bDesignMode );
1519 rSh.ApplyViewOptions( aViewOption );
1520 }
1521 }
1522 break;
1523
1524 default:
1525 bMore = true;
1526 }
1527
1528
1529 if(!bMore || !pArgs)
1530 return;
1531
1532 pItem = nullptr;
1533 pArgs->GetItemState(GetPool().GetWhich(nSlot), false, &pItem);
1534 if(!pItem)
1535 return;
1536
1537 switch(nSlot)
1538 {
1539 case SID_ATTR_BRUSH:
1540 case SID_ATTR_BORDER_SHADOW:
1541 case RES_SHADOW:
1542 {
1543 rSh.StartAllAction();
1544 // Table cell(s) selected?
1545 if ( rSh.IsTableMode() )
1546 {
1547 SwFrameFormat *pFormat = rSh.GetTableFormat();
1548 pFormat->SetFormatAttr( *pItem );
1549 }
1550 else if ( rSh.IsFrameSelected() )
1551 {
1552 // Set border attributes via Frame-Manager.
1553 SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE, nullptr );
1554 aMgr.SetAttrSet( *pArgs );
1555 aMgr.UpdateFlyFrame();
1556 }
1557 else
1558 {
1559 rSh.SetAttrSet( *pArgs );
1560 }
1561 rSh.EndAllAction();
1562 }
1563 break;
1569 {
1570 OSL_FAIL("not implemented");
1571 }
1572 break;
1573
1574 case SID_ATTR_BORDER_OUTER:
1575 {
1576 // Table cell(s) selected?
1577 if ( rSh.IsTableMode() )
1578 {
1579 // Set border attributes Get/SetTabBorders()
1580 rSh.SetTabBorders(*pArgs);
1581 }
1582 else if ( rSh.IsFrameSelected() )
1583 {
1584 // Set border attributes via Frame-Manager.
1585 SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE, nullptr );
1586 aMgr.SetAttrSet(*pArgs);
1587 aMgr.UpdateFlyFrame();
1588 }
1589 else
1590 {
1591 // Set border attributes via shell quite normally.
1592 rSh.SetAttrItem( *pItem );
1593 }
1594 }
1595 break;
1596 default:
1597 OSL_FAIL("wrong Dispatcher");
1598 }
1599}
1600
1601// Here the state for SID_IMAP / SID_CONTOUR will be handled
1602// until the swapping of the graphic is finished.
1603
1604IMPL_LINK_NOARG(SwBaseShell, GraphicArrivedHdl, SwCursorShell&, void)
1605{
1606 SwWrtShell &rSh = GetShell();
1607 if (CNT_GRF != rSh.SwEditShell::GetCntType())
1608 return;
1609 GraphicType const nGrfType(rSh.GetGraphicType());
1610 if (GraphicType::NONE == nGrfType || m_aGrfUpdateSlots.empty())
1611 return;
1612
1614 SfxViewFrame& rVFrame = GetView().GetViewFrame();
1615 for( const auto nSlot : m_aGrfUpdateSlots )
1616 {
1617 bool bSetState = false;
1618 bool bState = false;
1619 switch( nSlot )
1620 {
1621 case SID_IMAP:
1622 case SID_IMAP_EXEC:
1623 {
1624 sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId();
1625 SfxChildWindow *pChildWindow = rVFrame.HasChildWindow(nId) ?
1626 rVFrame.GetChildWindow(nId) : nullptr;
1627 SvxIMapDlg *pDlg = pChildWindow ?
1628 static_cast<SvxIMapDlg*>(pChildWindow->GetController().get()) : nullptr;
1629
1630 if( pDlg && ( SID_IMAP_EXEC == nSlot ||
1631 ( SID_IMAP == nSlot && !bProtect)) &&
1632 pDlg->GetEditingObject() != rSh.GetIMapInventor())
1633 lcl_UpdateIMapDlg( rSh );
1634
1635 if( !bProtect && SID_IMAP == nSlot )
1636 {
1637 bSetState = true;
1638 bState = nullptr != pDlg;
1639 }
1640 }
1641 break;
1642
1643 case SID_CONTOUR_DLG:
1644 if( !bProtect )
1645 {
1646 sal_uInt16 nId = SvxContourDlgChildWindow::GetChildWindowId();
1647 SfxChildWindow *pChildWindow = rVFrame.HasChildWindow(nId) ?
1648 rVFrame.GetChildWindow(nId) : nullptr;
1649 SvxIMapDlg *pDlg = pChildWindow ?
1650 static_cast<SvxIMapDlg*>(pChildWindow->GetController().get()) : nullptr;
1651 if( pDlg && pDlg->GetEditingObject() !=
1652 rSh.GetIMapInventor() )
1654
1655 bSetState = true;
1656 bState = nullptr != pDlg;
1657 }
1658 break;
1659
1661 if( !bProtect )
1662 {
1664 rSh.GetFlyFrameAttr(aSet);
1665 const SwFormatSurround& rWrap = aSet.Get(RES_SURROUND);
1666 bSetState = true;
1667 bState = rWrap.IsContour();
1668 }
1669 break;
1670
1671 case SID_GRFFILTER:
1672 case SID_GRFFILTER_INVERT:
1673 case SID_GRFFILTER_SMOOTH:
1674 case SID_GRFFILTER_SHARPEN:
1675 case SID_GRFFILTER_REMOVENOISE:
1676 case SID_GRFFILTER_SOBEL:
1677 case SID_GRFFILTER_MOSAIC:
1678 case SID_GRFFILTER_EMBOSS:
1679 case SID_GRFFILTER_POSTER:
1680 case SID_GRFFILTER_POPART:
1681 case SID_GRFFILTER_SEPIA:
1682 case SID_GRFFILTER_SOLARIZE:
1683 bSetState = bState = GraphicType::Bitmap == nGrfType;
1684 break;
1685 }
1686
1687 if( bSetState )
1688 {
1689 SfxBoolItem aBool( nSlot, bState );
1690 if( m_pGetStateSet )
1691 m_pGetStateSet->Put( aBool );
1692 else
1693 rVFrame.GetBindings().SetState( aBool );
1694 }
1695 }
1696 m_aGrfUpdateSlots.clear();
1697}
1698
1700{
1701 SwWrtShell &rSh = GetShell();
1702 SfxViewFrame& rVFrame = GetView().GetViewFrame();
1703 SfxWhichIter aIter( rSet );
1704 sal_uInt16 nWhich = aIter.FirstWhich();
1706 while ( nWhich )
1707 {
1708 switch ( nWhich )
1709 {
1710 case SID_GALLERY_FORMATS:
1711 if ( rSh.IsObjSelected() ||
1712 (rSh.IsSelFrameMode() &&
1714 rSet.DisableItem( nWhich );
1715 break;
1716 case SID_GALLERY_ENABLE_ADDCOPY:
1717 // #108230# allow copy from gallery in Writer AND Writer/Web!
1718 rSet.Put( SfxBoolItem( SID_GALLERY_ENABLE_ADDCOPY, true ) );
1719 break;
1720 case FN_EDIT_REGION:
1721 if( !rSh.IsAnySectionInDoc() )
1722 rSet.DisableItem(nWhich);
1723 break;
1724
1726 //tdf#112808 if cursor is in an index, don't show the edit section.
1727 if( !rSh.GetCurrSection() ||
1730 {
1731 rSet.DisableItem(nWhich);
1732 }
1733 break;
1734
1735 case FN_INSERT_REGION:
1736 if( rSh.CursorInsideInputField()
1737 || rSh.IsSelFrameMode()
1738 || !rSh.IsInsRegionAvailable() )
1739 {
1740 rSet.DisableItem( nWhich );
1741 }
1742 break;
1743
1745 {
1746 FrameTypeFlags eFrameType = rSh.GetFrameType(nullptr,true);
1747 if( (eFrameType & FrameTypeFlags::FOOTNOTE) ||
1748 !rSh.GetTableFormat() )
1749 rSet.DisableItem( nWhich );
1750 }
1751 break;
1753 {
1754 FrameTypeFlags eFrameType = rSh.GetFrameType(nullptr,true);
1755 if( (eFrameType & FrameTypeFlags::FOOTNOTE) ||
1756 !rSh.IsTextToTableAvailable() )
1757 rSet.DisableItem( nWhich );
1758 }
1759 break;
1761 {
1762 FrameTypeFlags eFrameType = rSh.GetFrameType(nullptr,true);
1763 if( (eFrameType & FrameTypeFlags::FOOTNOTE) ||
1764 (!rSh.GetTableFormat() && !rSh.IsTextToTableAvailable() ) )
1765 rSet.DisableItem( nWhich );
1766 }
1767 break;
1768 case RES_SHADOW:
1769 {
1771
1772 // Table cell(s) selected?
1773 if ( rSh.IsTableMode() )
1774 {
1775 SwFrameFormat *pFormat = rSh.GetTableFormat();
1776 aSet.Put(pFormat->GetFormatAttr( nWhich ));
1777 }
1778 else if( rSh.IsFrameSelected() )
1779 {
1780 SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE, nullptr );
1781 aSet.Put( aMgr.GetAttrSet() );
1782 }
1783 else
1784 rSh.GetCurAttr( aSet );
1785
1786 const SvxShadowItem& rShItem = static_cast<const SvxShadowItem&>(aSet.Get(nWhich));
1787 rSet.Put(rShItem);
1788 }
1789 break;
1790 case SID_IMAP:
1791 {
1792 // #i59688#
1793 // Improve efficiency:
1794 // If selected object is protected, item has to disabled.
1796 if ( bProtect )
1797 {
1798 rSet.DisableItem( nWhich );
1799 }
1800 else
1801 {
1802 const sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId();
1803 const bool bHas = rVFrame.HasChildWindow( nId );
1804 const bool bFrameSel = rSh.IsFrameSelected();
1805 const bool bIsGraphicSelection =
1807
1808 // #i59688#
1809 // Avoid unnecessary loading of selected graphic.
1810 // The graphic is only needed, if the dialog is open.
1811 // If the swapping of the graphic is finished, the status
1812 // must be determined asynchronously, until this the slot
1813 // will be disabled.
1814 if ( bHas && bIsGraphicSelection && rSh.IsLinkedGrfSwapOut() )
1815 {
1816 if( AddGrfUpdateSlot( nWhich ))
1817 rSh.GetGraphic(false); // start the loading
1818 }
1819 else
1820 {
1821 if ( !bHas &&
1822 ( !bFrameSel ||
1823 ( bIsGraphicSelection &&
1824 rSh.GetGraphicType() == GraphicType::NONE ) ) )
1825 {
1826 rSet.DisableItem( nWhich );
1827 }
1828 else
1829 {
1830 SfxBoolItem aBool(nWhich, bHas);
1831 if ( bHas && bFrameSel )
1832 lcl_UpdateIMapDlg( rSh );
1833 rSet.Put(aBool);
1834 }
1835 }
1836 }
1837 }
1838 break;
1839 case SID_IMAP_EXEC:
1840 {
1841 bool bDisable = false;
1842 if( !rSh.IsFrameSelected())
1843 bDisable = true;
1844 sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId();
1845 if(!bDisable && rVFrame.HasChildWindow( nId ))
1846 {
1848 && rSh.IsLinkedGrfSwapOut())
1849 {
1850 if( AddGrfUpdateSlot( nWhich ))
1851 rSh.GetGraphic(false); // start the loading
1852 }
1853 else
1854 {
1855 SvxIMapDlg *pDlg = GetIMapDlg(GetView());
1856 if (pDlg && pDlg->GetEditingObject() != rSh.GetIMapInventor())
1857 lcl_UpdateIMapDlg( rSh );
1858 }
1859 }
1860 rSet.Put(SfxBoolItem(nWhich, bDisable));
1861 }
1862 break;
1863
1864 case FN_BACKSPACE:
1865 case SID_DELETE:
1866 if ( ( rSh.HasReadonlySel() && !rSh.CursorInsideInputField() )
1868 {
1869 rSet.DisableItem( nWhich );
1870 }
1871 break;
1872
1873 case SID_CONTOUR_DLG:
1874 {
1876
1877 if( bParentCntProt || 0 != (HTMLMODE_ON & ::GetHtmlMode(
1878 GetView().GetDocShell() )) )
1879 rSet.DisableItem( nWhich );
1880 else
1881 {
1882 sal_uInt16 nId = SvxContourDlgChildWindow::GetChildWindowId();
1883 bool bHas = GetView().GetViewFrame().HasChildWindow( nId );
1884 SelectionType nSel = rSh.GetSelectionType();
1885 bool bOk(nSel & (SelectionType::Graphic|SelectionType::Ole));
1886
1887 bool bDisable = false;
1888 if( !bHas && !bOk )
1889 bDisable = true;
1890 // #i59688#
1891 // Avoid unnecessary loading of selected graphic.
1892 // The graphic is only needed, if the dialog is open.
1893 // If the swapping of the graphic is finished, the status
1894 // must be determined asynchronously, until this the slot
1895 // will be disabled.
1896 else if ( bHas && (nSel & SelectionType::Graphic) &&
1897 rSh.IsLinkedGrfSwapOut() )
1898 {
1899 if( AddGrfUpdateSlot( nWhich ))
1900 rSh.GetGraphic(false); // start the loading
1901 // #i75481#
1902 bDisable = true;
1903 }
1904 else if( bHas && bOk )
1905 bDisable = !lcl_UpdateContourDlg( rSh, nSel );
1906 else if( bOk )
1907 {
1908 // #i75481#
1909 // apply fix #i59688# only for selected graphics
1910 if ( nSel & SelectionType::Graphic )
1911 bDisable = GraphicType::NONE == rSh.GetGraphicType();
1912 else
1913 bDisable = GraphicType::NONE == rSh.GetIMapGraphic().GetType();
1914 }
1915
1916 if( bDisable )
1917 rSet.DisableItem( nWhich );
1918 else
1919 rSet.Put( SfxBoolItem(nWhich, bHas) );
1920 }
1921 }
1922 break;
1923 case SID_CONTOUR_EXEC:
1924 {
1925 bool bDisable = false;
1926 SelectionType nSel = rSh.GetSelectionType();
1928 bDisable = true;
1929 sal_uInt16 nId = SvxContourDlgChildWindow::GetChildWindowId();
1930 if( !bDisable && GetView().GetViewFrame().HasChildWindow( nId ))
1931 {
1932 SvxContourDlg *pDlg = GetContourDlg(GetView());
1933 if (pDlg && pDlg->GetEditingObject() != rSh.GetIMapInventor())
1934 bDisable = true;
1935 }
1936 rSet.Put(SfxBoolItem(nWhich, bDisable));
1937 }
1938 break;
1939
1940 case SID_ANCHOR_MENU:
1946 {
1947 bool bObj = 0 != rSh.IsObjSelected();
1949
1950 if( !bParentCntProt && (bObj || rSh.IsFrameSelected()))
1951 {
1953 if(bObj)
1954 rSh.GetObjAttr(aSet);
1955 else
1956 rSh.GetFlyFrameAttr(aSet);
1957 RndStdIds eSet = aSet.Get(RES_ANCHOR).GetAnchorId();
1958 const bool bSet =
1959 ((nWhich == FN_TOOL_ANCHOR_PAGE) &&
1960 (eSet == RndStdIds::FLY_AT_PAGE))
1961 || ((nWhich == FN_TOOL_ANCHOR_PARAGRAPH) &&
1962 (eSet == RndStdIds::FLY_AT_PARA))
1963 || ((nWhich == FN_TOOL_ANCHOR_FRAME) &&
1964 (eSet == RndStdIds::FLY_AT_FLY))
1965 || ((nWhich == FN_TOOL_ANCHOR_AT_CHAR) &&
1966 (eSet == RndStdIds::FLY_AT_CHAR))
1967 || ((nWhich == FN_TOOL_ANCHOR_CHAR) &&
1968 (eSet == RndStdIds::FLY_AS_CHAR));
1969
1970 if( nWhich == FN_TOOL_ANCHOR_FRAME && !rSh.IsFlyInFly() )
1971 rSet.DisableItem(nWhich);
1972 else if(nWhich != SID_ANCHOR_MENU)
1973 rSet.Put(SfxBoolItem(nWhich, bSet));
1974
1976 {
1977 if (nWhich == FN_TOOL_ANCHOR_PAGE || nWhich == FN_TOOL_ANCHOR_FRAME)
1978 {
1979 rSet.DisableItem(nWhich);
1980 }
1981 }
1982 }
1983 else
1984 rSet.DisableItem( nWhich );
1985 }
1986 break;
1987 case FN_FRAME_NOWRAP:
1988 case FN_FRAME_WRAP:
1990 case FN_FRAME_WRAPTHRU:
1995 case FN_FRAME_WRAP_LEFT:
1997 {
1998 bool bObj = 0 != rSh.IsObjSelected();
2000
2001 if( !bParentCntProt && (bObj || rSh.IsFrameSelected()))
2002 {
2004 RndStdIds nAnchorType;
2005 if(bObj)
2006 {
2007 rSh.GetObjAttr(aSet);
2008 nAnchorType = rSh.GetAnchorId();
2009 }
2010 else
2011 {
2012 rSh.GetFlyFrameAttr(aSet);
2013 nAnchorType = aSet.Get(RES_ANCHOR).GetAnchorId();
2014 }
2015 const SwFormatSurround& rWrap = aSet.Get(RES_SURROUND);
2016
2017 const SvxOpaqueItem& rOpaque = aSet.Get(RES_OPAQUE);
2018 bool bOpaque = rOpaque.GetValue();
2019 css::text::WrapTextMode nSurround = rWrap.GetSurround();
2020 bool bSet = false;
2021
2022 bool bDisable =
2023 (nAnchorType == RndStdIds::UNKNOWN) || (nAnchorType == RndStdIds::FLY_AS_CHAR);
2024 const bool bHtmlMode =
2025 0 != ::GetHtmlMode(GetView().GetDocShell());
2026
2027 switch( nWhich )
2028 {
2029 case FN_FRAME_NOWRAP:
2030 bDisable |=
2031 ( (nAnchorType != RndStdIds::FLY_AT_PARA)
2032 && (nAnchorType != RndStdIds::FLY_AT_CHAR)
2033 && (nAnchorType != RndStdIds::FLY_AT_PAGE));
2034 bSet = nSurround == css::text::WrapTextMode_NONE;
2035 break;
2036 case FN_FRAME_WRAP:
2037 bDisable |= bHtmlMode;
2038 bSet = nSurround == css::text::WrapTextMode_PARALLEL;
2039 break;
2041 bDisable |= bHtmlMode;
2042 bSet = nSurround == css::text::WrapTextMode_DYNAMIC;
2043 break;
2044 case FN_FRAME_WRAPTHRU:
2045 bDisable |= (bHtmlMode ||
2046 ( (nAnchorType != RndStdIds::FLY_AT_PARA)
2047 && (nAnchorType != RndStdIds::FLY_AT_CHAR)
2048 && (nAnchorType != RndStdIds::FLY_AT_PAGE)));
2049 if(bObj)
2050 bSet = nSurround == css::text::WrapTextMode_THROUGH && rSh.GetLayerId();
2051 else
2052 bSet = nSurround == css::text::WrapTextMode_THROUGH && bOpaque;
2053 break;
2056 bDisable |= bHtmlMode;
2057 if(bObj)
2058 bSet = nSurround == css::text::WrapTextMode_THROUGH && !rSh.GetLayerId();
2059 else
2060 bSet = nSurround == css::text::WrapTextMode_THROUGH && !bOpaque;
2061 break;
2063 bDisable |= bHtmlMode;
2064 //no contour available when no wrap or wrap through is set
2065 bDisable |= (nSurround == css::text::WrapTextMode_NONE || nSurround == css::text::WrapTextMode_THROUGH);
2066 if( !bDisable )
2067 {
2068 SelectionType nSel = rSh.GetSelectionType();
2069 if( (nSel & SelectionType::Graphic) &&
2070 rSh.IsLinkedGrfSwapOut())
2071 {
2072 if( AddGrfUpdateSlot( nWhich ))
2073 rSh.GetGraphic(false); // start the loading
2074 }
2075 else if( rSh.IsFrameSelected() )
2076 {
2077 // #i102253# applied patch from OD (see task)
2078 bDisable =
2079 nSel & SelectionType::Frame ||
2080 GraphicType::NONE == rSh.GetIMapGraphic().GetType();
2081 }
2082 }
2083 bSet = !bDisable && rWrap.IsContour();
2084
2085 break;
2087 bDisable |= (bHtmlMode ||
2088 (nAnchorType != RndStdIds::FLY_AT_PARA));
2089 bSet = rWrap.IsAnchorOnly();
2090 break;
2091 case FN_FRAME_WRAP_LEFT:
2092 bSet = nSurround == css::text::WrapTextMode_LEFT;
2093 break;
2095 bSet = nSurround == css::text::WrapTextMode_RIGHT;
2096 break;
2097 }
2098
2099 if(bDisable)
2100 rSet.DisableItem(nWhich);
2101 else
2102 rSet.Put(SfxBoolItem(nWhich, bSet));
2103 }
2104 else
2105 rSet.DisableItem(nWhich);
2106 }
2107 break;
2108 case FN_UPDATE_CHARTS:
2109 if( !rSh.HasCharts() )
2110 rSet.DisableItem( nWhich );
2111 break;
2113 if ( rSh.GetLinkManager().GetLinks().empty() )
2114 rSet.DisableItem(nWhich);
2115 break;
2117 // enable if in XForms document
2118 if( rSh.GetDoc()->isXForms() )
2119 {
2120 // determine current state from view options
2121 bool bValue = ! rSh.GetViewOptions()->IsFormView();
2122 rSet.Put( SfxBoolItem( nWhich, bValue ) );
2123 }
2124 else
2125 rSet.Put( SfxVisibilityItem( nWhich, false ) );
2126 break;
2127 case SID_GRAPHIC_SIZE_CHECK:
2128 {
2129 sal_Int32 nDPI = rSh.GetDoc()->getIDocumentSettingAccess().getImagePreferredDPI();
2130 if (nDPI <= 0)
2131 rSet.DisableItem(nWhich);
2132 }
2133 break;
2134 case SID_THEME_DIALOG:
2135 {
2136 bool bDisable = true;
2137 auto* pDocument = rSh.GetDoc();
2138 auto* pDocumentShell = pDocument->GetDocShell();
2139 if (pDocumentShell)
2140 {
2141 SdrPage* pPage = pDocument->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
2142 if (pPage)
2143 {
2144 auto const& pTheme = pPage->getSdrPageProperties().GetTheme();
2145 if (pTheme)
2146 bDisable = false;
2147 }
2148 }
2149 if (bDisable)
2150 rSet.DisableItem(nWhich);
2151 }
2152 break;
2153 }
2154 nWhich = aIter.NextWhich();
2155 }
2156 m_pGetStateSet = nullptr;
2157}
2158
2159// Disable the slots with this status method
2160
2162{
2163 SfxWhichIter aIter(rSet);
2164 sal_uInt16 nWhich = aIter.FirstWhich();
2165
2166 while (nWhich)
2167 {
2168 rSet.DisableItem( nWhich );
2169 nWhich = aIter.NextWhich();
2170 }
2171}
2172
2173// Disable the slots with this status method
2174
2176{
2179
2180 if ( bParentCntProt ||
2185 {
2186 SfxWhichIter aIter( rSet );
2187 sal_uInt16 nWhich = aIter.FirstWhich();
2188 while ( nWhich )
2189 {
2190 rSet.DisableItem( nWhich );
2191 nWhich = aIter.NextWhich();
2192 }
2193 }
2194 else
2196}
2197
2198void SwBaseShell::SetWrapMode( sal_uInt16 nSlot )
2199{
2200 SwWrtShell &rSh = GetShell();
2201 bool bObj = 0 != rSh.IsObjSelected();
2202 if( !bObj && !rSh.IsFrameSelected())
2203 return;
2204
2206 if(bObj)
2207 rSh.GetObjAttr(aSet);
2208 else
2209 rSh.GetFlyFrameAttr(aSet);
2210 SwFormatSurround aWrap( aSet.Get(RES_SURROUND) );
2211 css::text::WrapTextMode nOldSurround(aWrap.GetSurround());
2212 css::text::WrapTextMode nSurround = css::text::WrapTextMode_PARALLEL;
2213
2214 switch (nSlot)
2215 {
2216 case FN_FRAME_NOWRAP:
2217 nSurround = css::text::WrapTextMode_NONE;
2218 if (aWrap.IsContour())
2219 aWrap.SetContour(false);
2220 break;
2222 nSurround = css::text::WrapTextMode_DYNAMIC;
2223 break;
2225 aWrap.SetAnchorOnly(!aWrap.IsAnchorOnly());
2226
2227 // keep previous wrapping
2228
2229 // switch to wrap css::text::WrapTextMode_PARALLEL, if previous wrap is css::text::WrapTextMode_NONE
2230 if ( nOldSurround != css::text::WrapTextMode_NONE )
2231 {
2232 nSurround = nOldSurround;
2233 }
2234 break;
2236 aWrap.SetContour(!aWrap.IsContour());
2237 // Contour is meaningless in no-wrap or wrap-through context. Otherwise keep existing wrap.
2238 if ( !aWrap.IsContour() ||
2239 ( nOldSurround != css::text::WrapTextMode_NONE &&
2240 nOldSurround != css::text::WrapTextMode_THROUGH ) )
2241 {
2242 nSurround = nOldSurround;
2243 }
2244 break;
2247 if (aWrap.IsContour())
2248 aWrap.SetContour(false);
2249 [[fallthrough]];
2250 case FN_FRAME_WRAPTHRU:
2251 nSurround = css::text::WrapTextMode_THROUGH;
2252 break;
2253
2254 case FN_FRAME_WRAP_LEFT:
2255 nSurround = css::text::WrapTextMode_LEFT;
2256 break;
2257
2259 nSurround = css::text::WrapTextMode_RIGHT;
2260 break;
2261
2262 default:
2263 break;
2264 }
2265 aWrap.SetSurround(nSurround);
2266
2267 if (nSlot != FN_FRAME_WRAP_CONTOUR)
2268 {
2269 // Defaulting the contour wrap on draw objects.
2270 if (bObj && nOldSurround != nSurround &&
2271 (nOldSurround == css::text::WrapTextMode_NONE || nOldSurround == css::text::WrapTextMode_THROUGH))
2272 {
2273 aWrap.SetContour(true);
2274 }
2275 }
2276
2277 aSet.Put( aWrap );
2278
2279 bool bOpaque = nSlot != FN_FRAME_WRAPTHRU_TRANSP && nSlot != FN_FRAME_WRAPTHRU_TOGGLE;
2280 if( nSlot == FN_FRAME_WRAPTHRU_TOGGLE )
2281 {
2282 if( bObj )
2283 bOpaque = !rSh.GetLayerId();
2284 else
2285 {
2286 const SvxOpaqueItem& aOpaque( aSet.Get(RES_OPAQUE) );
2287 bOpaque = !aOpaque.GetValue();
2288 }
2289 }
2290 aSet.Put(SvxOpaqueItem(RES_OPAQUE, bOpaque ));
2291
2292 if(bObj)
2293 {
2294 rSh.SetObjAttr(aSet);
2295 if ( bOpaque )
2296 rSh.SelectionToHeaven();
2297 else
2298 rSh.SelectionToHell();
2299 }
2300 else
2301 rSh.SetFlyFrameAttr(aSet);
2302
2303}
2304
2305//Force update of the status line
2306
2308{
2310 SfxBindings &rBnd = pSh->GetView().GetViewFrame().GetBindings();
2311
2312 if( eMode == FLY_DRAG || pSh->IsFrameSelected() || pSh->IsObjSelected() )
2313 {
2314 const SfxPointItem aTmp1( SID_ATTR_POSITION, pSh->GetAnchorObjDiff());
2315 const SvxSizeItem aTmp2( SID_ATTR_SIZE, pSh->GetObjSize());
2316 rBnd.SetState( aTmp1 );
2317 rBnd.SetState( aTmp2 );
2318 }
2319 else if( eMode == FLY_DRAG_END )
2320 {
2321 static sal_uInt16 aInval[] =
2322 {
2323 SID_ATTR_POSITION, SID_ATTR_SIZE, 0
2324 };
2325 rBnd.Invalidate(aInval);
2326 }
2327}
2328
2330 SfxShell( &rVw ),
2331 m_rView(rVw),
2332 m_pGetStateSet(nullptr)
2333{
2334 SwWrtShell& rWrtSh = m_rView.GetWrtShell();
2335
2336 SetPool(&rWrtSh.GetAttrPool());
2337 SetName("Base");
2338 rWrtSh.SetGrfArrivedLnk( LINK( this, SwBaseShell, GraphicArrivedHdl));
2339}
2340
2342{
2343 if( m_rView.GetCurShell() == this )
2345
2346 Link<SwCursorShell&,void> aTmp( LINK( this, SwBaseShell, GraphicArrivedHdl));
2347 if( aTmp == m_rView.GetWrtShell().GetGrfArrivedLnk() )
2349}
2350
2352{
2353 const SfxItemSet *pArgs = rReq.GetArgs();
2354 const sal_uInt16 nSlot = rReq.GetSlot();
2355
2356 if( pArgs)
2357 {
2358 SwWrtShell &rSh = GetShell();
2359 std::unique_ptr<SvxScriptSetItem> pSSetItem;
2360 SfxItemPool& rPool = rSh.GetAttrPool();
2361 sal_uInt16 nWhich = rPool.GetWhich( nSlot );
2362 SvtScriptType nScripts = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
2366 aHeightSet( GetPool() );
2367
2368 switch( nSlot )
2369 {
2370 case SID_ATTR_CHAR_FONT:
2371 {
2372 nScripts = rSh.GetScriptType();
2373 // #i42732# input language should be preferred over
2374 // current cursor position to detect script type
2375 if(!rSh.HasSelection())
2376 {
2378 if(nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM)
2379 nScripts = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang );
2380 }
2381 [[fallthrough]];
2382 }
2383 case SID_ATTR_CHAR_POSTURE:
2384 case SID_ATTR_CHAR_WEIGHT:
2385 {
2386 pSSetItem.reset(new SvxScriptSetItem( nSlot, rPool ));
2387 pSSetItem->PutItemForScriptType( nScripts, pArgs->Get( nWhich ));
2388 pArgs = &pSSetItem->GetItemSet();
2389 }
2390 break;
2391 case SID_ATTR_CHAR_FONTHEIGHT:
2392 {
2393 if(rSh.HasSelection())
2394 {
2395 pSSetItem.reset(new SvxScriptSetItem( nSlot, rPool ));
2396 pSSetItem->PutItemForScriptType( nScripts, pArgs->Get( nWhich ));
2397 pArgs = &pSSetItem->GetItemSet();
2398 }
2399 else
2400 {
2401 nScripts = rSh.GetScriptType();
2403 if(nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM)
2404 nScripts = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang );
2405 sal_uInt32 nHeight = static_cast< const SvxFontHeightItem& >(pArgs->Get( nWhich )).GetHeight();
2406 SwStdFontConfig* pStdFont = SW_MOD()->GetStdFontConfig();
2407
2411 aLangSet( GetPool() );
2412 rSh.GetCurAttr( aLangSet );
2413
2414 sal_Int32 nWesternSize =
2416 aLangSet.Get( RES_CHRATR_LANGUAGE).GetLanguage());
2417 sal_Int32 nCJKSize =
2419 aLangSet.Get( RES_CHRATR_CJK_LANGUAGE).GetLanguage());
2420 sal_Int32 nCTLSize =
2422 aLangSet.Get( RES_CHRATR_CTL_LANGUAGE).GetLanguage());
2423
2424 switch(nScripts)
2425 {
2426 case SvtScriptType::LATIN:
2427 nCJKSize = nHeight * nCJKSize / nWesternSize;
2428 nCTLSize = nHeight * nCTLSize / nWesternSize;
2429 nWesternSize = static_cast<sal_Int32>(nHeight);
2430 break;
2431 case SvtScriptType::ASIAN:
2432 nCTLSize = nHeight* nCTLSize / nCJKSize;
2433 nWesternSize = nHeight * nWesternSize / nCJKSize;
2434 nCJKSize = static_cast<sal_Int32>(nHeight);
2435 break;
2436 case SvtScriptType::COMPLEX:
2437 nCJKSize = nHeight * nCJKSize / nCTLSize;
2438 nWesternSize = nHeight * nWesternSize / nCTLSize;
2439 nCTLSize = static_cast<sal_Int32>(nHeight);
2440 break;
2441 default: break;
2442 }
2443 aHeightSet.Put( SvxFontHeightItem( static_cast<sal_uInt32>(nWesternSize), 100, RES_CHRATR_FONTSIZE ));
2444 aHeightSet.Put( SvxFontHeightItem( static_cast<sal_uInt32>(nCJKSize), 100, RES_CHRATR_CJK_FONTSIZE ));
2445 aHeightSet.Put( SvxFontHeightItem( static_cast<sal_uInt32>(nCTLSize), 100, RES_CHRATR_CTL_FONTSIZE ));
2446 pArgs = &aHeightSet;
2447 }
2448 }
2449 break;
2450 }
2451
2452 if( pArgs )
2453 {
2454 bool bAuto = false;
2455 if ( !isCHRATR(nWhich) ||
2456 ( rSh.HasSelection() && rSh.IsSelFullPara() ) )
2457 {
2458 SwTextFormatColl * pColl = rSh.GetCurTextFormatColl();
2459 if ( pColl && pColl->IsAutoUpdateOnDirectFormat() )
2460 {
2461 rSh.AutoUpdatePara( pColl, *pArgs );
2462 bAuto = true;
2463 }
2464 }
2465
2466 if (!bAuto)
2467 {
2468 rSh.SetAttrSet( *pArgs );
2469 }
2470 }
2471 }
2472 else
2473 {
2474 if (nSlot == SID_ATTR_CHAR_KERNING)
2475 GetView().GetViewFrame().GetDispatcher()->Execute(SID_CHAR_DLG_POSITION);
2476 else if (nSlot == SID_ATTR_CHAR_COLOR)
2477 GetView().GetViewFrame().GetDispatcher()->Execute(SID_CHAR_DLG_EFFECT);
2478 else
2479 GetView().GetViewFrame().GetDispatcher()->Execute(SID_CHAR_DLG);
2480 }
2481 rReq.Done();
2482}
2483
2485{
2486 SwWrtShell &rSh = GetShell();
2487 rSh.GetCurAttr( rSet );
2488}
2489
2491{
2492 SwWrtShell &rSh = GetShell();
2493 bool bFirst = true;
2494 std::optional<SfxItemSet> pFntCoreSet;
2495 SvtScriptType nScriptType = SvtScriptType::LATIN;
2496 SfxWhichIter aIter( rSet );
2497 sal_uInt16 nWhich = aIter.FirstWhich();
2498 while( nWhich )
2499 {
2500 switch( nWhich )
2501 {
2502 case RES_CHRATR_FONT:
2504 case RES_CHRATR_WEIGHT:
2505 case RES_CHRATR_POSTURE:
2506 {
2507 if( !pFntCoreSet )
2508 {
2509 pFntCoreSet.emplace( *rSet.GetPool(),
2510 svl::Items<RES_CHRATR_BEGIN, RES_CHRATR_END-1> );
2511 rSh.GetCurAttr( *pFntCoreSet );
2512 nScriptType = rSh.GetScriptType();
2513 // #i42732# input language should be preferred over
2514 // current cursor position to detect script type
2515 SwEditWin& rEditWin = GetView().GetEditWin();
2516 if( rEditWin.IsUseInputLanguage() )
2517 {
2518 if(!rSh.HasSelection() && (
2519 nWhich == RES_CHRATR_FONT ||
2520 nWhich == RES_CHRATR_FONTSIZE ))
2521 {
2522 LanguageType nInputLang = rEditWin.GetInputLanguage();
2523 if(nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM)
2524 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang );
2525 }
2526 }
2527 }
2528 SfxItemPool& rPool = *rSet.GetPool();
2529 SvxScriptSetItem aSetItem( rPool.GetSlotId( nWhich ), rPool );
2530 aSetItem.GetItemSet().Put( *pFntCoreSet, false );
2531 const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType );
2532 if( pI )
2533 {
2534 rSet.Put( pI->CloneSetWhich(nWhich) );
2535 }
2536 else
2537 rSet.InvalidateItem( nWhich );
2538 // Set input context of the SwEditWin according to the selected font and script type
2539 if(RES_CHRATR_FONT == nWhich)
2540 {
2541 vcl::Font aFont;
2542 if (const SvxFontItem* pFontItem = dynamic_cast<const SvxFontItem*>(pI))
2543 {
2544 aFont.SetFamilyName(pFontItem->GetFamilyName());
2545 aFont.SetStyleName(pFontItem->GetStyleName());
2546 aFont.SetFamily(pFontItem->GetFamily());
2547 aFont.SetPitch(pFontItem->GetPitch());
2548 aFont.SetCharSet(pFontItem->GetCharSet());
2549 }
2550
2551 bool bVertical = rSh.IsInVerticalText();
2552 aFont.SetOrientation(Degree10(bVertical ? 2700 : 0));
2553 aFont.SetVertical(bVertical);
2554 GetView().GetEditWin().SetInputContext( InputContext( aFont, InputContextFlags::Text |
2555 InputContextFlags::ExtText ) );
2556 }
2557 }
2558 break;
2559
2560 default:
2561 if( bFirst )
2562 {
2563 rSh.GetCurAttr( rSet );
2564 bFirst = false;
2565 }
2566 }
2567 nWhich = aIter.NextWhich();
2568 }
2569}
2570
2572{
2573 SwWrtShell &rSh = GetShell();
2574 SfxWhichIter aIter(rSet);
2575 sal_uInt16 nWhich(aIter.FirstWhich());
2576 SelectionType nSelType(rSh.GetSelectionType());
2577 std::unique_ptr<SvxBrushItem> aBrushItem(std::make_unique<SvxBrushItem>(RES_BACKGROUND));
2578
2579 if( nWhich == SID_TABLE_CELL_BACKGROUND_COLOR )
2580 {
2581 rSh.GetBoxBackground( aBrushItem );
2582 }
2583 else
2584 {
2585 // Adapt to new DrawingLayer FillStyle; use a parent which has XFILL_NONE set
2587
2588 aCoreSet.SetParent(&GetView().GetDocShell()->GetDoc()->GetDfltFrameFormat()->GetAttrSet());
2589
2590 if(nSelType & SelectionType::Graphic || SelectionType::Frame & nSelType)
2591 {
2592 rSh.GetFlyFrameAttr(aCoreSet);
2593 }
2594 else
2595 {
2596 rSh.GetCurAttr(aCoreSet);
2597 }
2598
2599 aBrushItem = getSvxBrushItemFromSourceSet(aCoreSet, RES_BACKGROUND);
2600 }
2601
2602 while(nWhich)
2603 {
2604 switch(nWhich)
2605 {
2606 case SID_BACKGROUND_COLOR:
2607 case SID_TABLE_CELL_BACKGROUND_COLOR:
2608 {
2609 SvxColorItem aColorItem(aBrushItem->GetColor(), aBrushItem->getComplexColor(), nWhich);
2610 rSet.Put(aColorItem);
2611 break;
2612 }
2613 case SID_ATTR_BRUSH:
2614 case RES_BACKGROUND:
2615 {
2616 // if this was intended to have a independent copy of the Item to be set
2617 // this is not needed due to the ItemSet/Pool cloning Items which get set anyways.
2618 // Keeping code as reference - it may have had other reasons I do notz see (?!?)
2619 // std::unique_ptr<SfxPoolItem> pNewItem(aBrushItem.CloneSetWhich(GetPool().GetWhich(nWhich)));
2620 rSet.Put(*aBrushItem);
2621 break;
2622 }
2623 }
2624
2625 nWhich = aIter.NextWhich();
2626 }
2627}
2628
2630{
2631 SwWrtShell &rSh = GetShell();
2632 SelectionType nSelType(rSh.GetSelectionType());
2633 const SfxItemSet* pArgs = rReq.GetArgs();
2634 sal_uInt16 nSlot(rReq.GetSlot());
2635
2636 if (!pArgs && nSlot != SID_BACKGROUND_COLOR && nSlot != SID_TABLE_CELL_BACKGROUND_COLOR)
2637 {
2638 return;
2639 }
2640
2641 std::unique_ptr<SvxBrushItem> aBrushItem(std::make_unique<SvxBrushItem>(RES_BACKGROUND));
2642
2643 if ( nSlot == SID_TABLE_CELL_BACKGROUND_COLOR )
2644 {
2645 rSh.GetBoxBackground( aBrushItem );
2646 }
2647 else
2648 {
2649 // Adapt to new DrawingLayer FillStyle; use a parent which has XFILL_NONE set
2651
2652 aCoreSet.SetParent(&GetView().GetDocShell()->GetDoc()->GetDfltFrameFormat()->GetAttrSet());
2653
2654 if((SelectionType::Frame & nSelType) || (SelectionType::Graphic & nSelType))
2655 {
2656 rSh.GetFlyFrameAttr(aCoreSet);
2657 }
2658 else
2659 {
2660 rSh.GetCurAttr(aCoreSet);
2661 }
2662
2663 aBrushItem = getSvxBrushItemFromSourceSet(aCoreSet, RES_BACKGROUND);
2664 }
2665
2666 switch(nSlot)
2667 {
2668 case SID_BACKGROUND_COLOR:
2669 case SID_TABLE_CELL_BACKGROUND_COLOR:
2670 {
2671 bool bIsTransparent = false;
2672
2673 aBrushItem->SetGraphicPos(GPOS_NONE);
2674
2675 sal_uInt16 nSlotId = (nSlot == SID_BACKGROUND_COLOR) ? SID_BACKGROUND_COLOR : SID_TABLE_CELL_BACKGROUND_COLOR;
2676 if (pArgs)
2677 {
2678 const SvxColorItem& rNewColorItem = static_cast<const SvxColorItem&>(pArgs->Get(nSlotId));
2679 aBrushItem->SetColor(rNewColorItem.GetValue());
2680 aBrushItem->setComplexColor(rNewColorItem.getComplexColor());
2681 GetView().GetViewFrame().GetBindings().SetState(rNewColorItem);
2682 }
2683 else
2684 {
2685 bIsTransparent = true;
2686 }
2687
2688 if (bIsTransparent)
2689 {
2690 aBrushItem->SetColor(COL_TRANSPARENT);
2692 }
2693 break;
2694 }
2695
2696 case SID_ATTR_BRUSH:
2697 case RES_BACKGROUND:
2698 {
2699 assert(pArgs && "only SID_BACKGROUND_COLOR can have !pArgs, checked at entry");
2700 aBrushItem.reset(static_cast<SvxBrushItem*>(pArgs->Get(GetPool().GetWhich(nSlot)).Clone()));
2701 break;
2702 }
2703 default:
2704 {
2705 rReq.Ignore();
2706 OSL_FAIL("unknown message in ExecuteAttr!" );
2707 return;
2708 }
2709 }
2710
2711 if ( nSlot == SID_TABLE_CELL_BACKGROUND_COLOR )
2712 {
2713 rSh.SetBoxBackground( *aBrushItem );
2714 }
2715 else
2716 {
2717 // Adapt to new DrawingLayer FillStyle; use a parent which has XFILL_NONE set
2719
2720 aCoreSet.SetParent(&GetView().GetDocShell()->GetDoc()->GetDfltFrameFormat()->GetAttrSet());
2721 setSvxBrushItemAsFillAttributesToTargetSet(*aBrushItem, aCoreSet);
2722
2723 if((SelectionType::Frame & nSelType) || (SelectionType::Graphic & nSelType))
2724 {
2725 // Template autoupdate
2726 SwFrameFormat* pFormat = rSh.GetSelectedFrameFormat();
2727
2728 if(pFormat && pFormat->IsAutoUpdateOnDirectFormat())
2729 {
2730 rSh.AutoUpdateFrame(pFormat, aCoreSet);
2731 }
2732 else
2733 {
2734 rSh.SetFlyFrameAttr(aCoreSet);
2735 }
2736 }
2737 else
2738 {
2740
2741 if(pColl && pColl->IsAutoUpdateOnDirectFormat())
2742 {
2743 rSh.AutoUpdatePara(pColl, aCoreSet);
2744 }
2745 else
2746 {
2747 rSh.SetAttrSet(aCoreSet);
2748 }
2749 }
2750 }
2751
2752 rReq.Done();
2753}
2754
2756{
2757 SwWrtShell &rSh = GetShell();
2758 // Table cell(s) selected?
2759 bool bPrepare = true;
2760 bool bTableMode = rSh.IsTableMode();
2761 if ( bTableMode )
2762 {
2764 SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER> aCoreSet( GetPool() );
2765 SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
2766 aCoreSet.Put( aBoxInfo );
2767 rSh.GetTabBorders( aCoreSet );
2768 rSet.Put( aCoreSet );
2769 }
2770 else if ( rSh.IsFrameSelected() )
2771 {
2772 SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE, nullptr );
2773 rSet.Put( aMgr.GetAttrSet() );
2774 bPrepare = false;
2775 }
2776 else
2777 // Get border attributes via shell quite normal
2778 rSh.GetCurAttr( rSet );
2779 if ( bPrepare )
2780 ::PrepareBoxInfo( rSet, rSh );
2781 // Switch the border toolbox controller mode
2782 rSet.Put( SfxBoolItem( SID_BORDER_REDUCED_MODE, !bTableMode ));
2783}
2784
2786{
2787 SwWrtShell &rSh = GetShell();
2788 weld::Window* pMDI = GetView().GetFrameWeld();
2789 // So that from the basic no dialogues for the background views are called:
2790 bool bBackground = (&GetView() != GetActiveView());
2791 const SfxPoolItem* pItem = nullptr;
2792 const SfxItemSet* pArgs = rReq.GetArgs();
2793
2794 sal_uInt16 nSlot = rReq.GetSlot();
2795 const SfxItemSet* pOutSet = nullptr;
2796 bool bDone = false;
2797 if(pArgs)
2798 pArgs->GetItemState( GetPool().GetWhich(nSlot), false, &pItem );
2799
2800 switch ( nSlot )
2801 {
2803 {
2807 aContext.maEndDialogFn = [](sal_Int32){};
2808 pDlg->StartExecuteAsync(aContext);
2809 }
2810 break;
2811 case FN_FORMAT_PAGE_DLG:
2814 {
2815 if( !bBackground )
2816 {
2817 const size_t nCurIdx = rSh.GetCurPageDesc();
2818 const SwPageDesc& rPageDesc = rSh.GetPageDesc( nCurIdx );
2819 // Temporary view, because the shell does not need to be valid after the dialog
2820 // for example disable header
2821 SwView& rTempView = GetView();
2822
2823 OUString sPageId;
2824 switch (nSlot)
2825 {
2827 sPageId = "columns";
2828 break;
2830 sPageId = "page";
2831 break;
2832 case FN_FORMAT_PAGE_DLG:
2833 if (pItem)
2834 sPageId = static_cast<const SfxStringItem*>(pItem)->GetValue();
2835 break;
2836 }
2837 rTempView.GetDocShell()->FormatPage(rReq.GetFrameWeld(), rPageDesc.GetName(), sPageId, rSh, &rReq);
2838 rTempView.InvalidateRulerPos();
2839
2840 bDone = true; // FormatPage() takes care of calling Done()
2841 }
2842 }
2843 break;
2845 {
2847 SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER> aSet( rSh.GetAttrPool() );
2849 // Table cell(s) selected?
2850 if ( rSh.IsTableMode() )
2851 {
2852 // Set border attributes Get/SetTabBorders()
2853 ::PrepareBoxInfo( aSet, rSh );
2854 rSh.GetTabBorders( aSet );
2856 pDlg.disposeAndReset(pFact->CreateSwBorderDlg(pMDI, aSet, SwBorderModes::TABLE));
2857 if ( pDlg->Execute() == RET_OK )
2858 {
2859 rSh.SetTabBorders( *pDlg->GetOutputItemSet() );
2860 pOutSet = pDlg->GetOutputItemSet();
2861 }
2862 }
2863 else if ( rSh.IsFrameSelected() )
2864 {
2865 // Set border attributes via Frame-Manager
2866 SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE, nullptr );
2867 aSet.Put( aMgr.GetAttrSet() );
2868
2870 pDlg.disposeAndReset(pFact->CreateSwBorderDlg(pMDI, aSet, SwBorderModes::FRAME));
2871 if ( pDlg->Execute() == RET_OK )
2872 {
2873 aMgr.SetAttrSet( *pDlg->GetOutputItemSet() );
2874 aMgr.UpdateFlyFrame();
2875 pOutSet = pDlg->GetOutputItemSet();
2876 }
2877 }
2878 else
2879 {
2880 // Set border attributes via Shell quite normal
2881 rSh.GetCurAttr( aSet );
2882 ::PrepareBoxInfo( aSet, rSh );
2883
2885 pDlg.disposeAndReset(pFact->CreateSwBorderDlg(pMDI, aSet, SwBorderModes::PARA));
2886 if ( pDlg->Execute() == RET_OK )
2887 {
2888 rSh.SetAttrSet( *pDlg->GetOutputItemSet() );
2889 pOutSet = pDlg->GetOutputItemSet();
2890 }
2891 }
2892 if(pOutSet)
2893 {
2894 rReq.Done(*pOutSet);
2895 bDone = true;
2896 }
2897 }
2898 break;
2900 {
2903
2906
2907 // Table cell(s) selected?
2908 if ( rSh.IsTableMode() )
2909 {
2910 // Get background attributes of the table and put it in the set
2911 // tdf#144843 calling GetBoxBackground *requires* an incarnation to be handed over
2912 std::unique_ptr<SvxBrushItem> aBrush(std::make_unique<SvxBrushItem>(RES_BACKGROUND));
2913 rSh.GetBoxBackground( aBrush );
2914 pDlg.disposeAndReset(pFact->CreateSwBackgroundDialog(pMDI, aSet));
2915 aSet.Put( std::move(aBrush) );
2916 if ( pDlg->Execute() == RET_OK )
2917 {
2918
2919 rSh.SetBoxBackground( pDlg->GetOutputItemSet()->Get( RES_BACKGROUND ) );
2920 pOutSet = pDlg->GetOutputItemSet();
2921 }
2922 }
2923 else if ( rSh.IsFrameSelected() )
2924 {
2925
2926 rSh.GetFlyFrameAttr( aSet );
2927
2928 pDlg.disposeAndReset(pFact->CreateSwBackgroundDialog(pMDI, aSet));
2929 if ( pDlg->Execute() == RET_OK )
2930 {
2931 rSh.SetFlyFrameAttr(const_cast<SfxItemSet &>(*pDlg->GetOutputItemSet()) );
2932 pOutSet = pDlg->GetOutputItemSet();
2933 }
2934 }
2935 else
2936 {
2937 // Set border attributes Umrandungsattribute with the shell quite normal.
2938 rSh.GetCurAttr( aSet );
2939
2940 pDlg.disposeAndReset(pFact->CreateSwBackgroundDialog(pMDI, aSet));
2941 if ( pDlg->Execute() == RET_OK )
2942 {
2943 rSh.SetAttrSet( *pDlg->GetOutputItemSet() );
2944 pOutSet = pDlg->GetOutputItemSet();
2945 }
2946 }
2947 if(pOutSet)
2948 {
2949 rReq.Done(*pOutSet);
2950 bDone = true;
2951 }
2952 }
2953 break;
2954
2955 case SID_GRAPHIC_SIZE_CHECK:
2956 {
2958 svx::GenericCheckDialog aDialog(pMDI, aResult);
2959 aDialog.run();
2960 }
2961 break;
2962
2963 case SID_THEME_DIALOG:
2964 {
2965 auto* pDocument = rSh.GetDoc();
2966 auto* pDocumentShell = pDocument->GetDocShell();
2967 if (pDocumentShell)
2968 {
2969 SdrPage* pPage = pDocument->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
2970 auto const& pTheme = pPage->getSdrPageProperties().GetTheme();
2971 if (pTheme)
2972 {
2973 std::shared_ptr<svx::IThemeColorChanger> pChanger(new sw::ThemeColorChanger(pDocumentShell));
2974 auto pDialog = std::make_shared<svx::ThemeDialog>(pMDI, pTheme.get());
2975 weld::DialogController::runAsync(pDialog, [pDialog, pChanger](sal_uInt32 nResult) {
2976 if (RET_OK != nResult)
2977 return;
2978
2979 auto pColorSet = pDialog->getCurrentColorSet();
2980 if (pColorSet)
2981 {
2982 pChanger->apply(pColorSet);
2984 {
2985 svx::ThemeColorPaletteManager aManager(pColorSet);
2986 SfxLokHelper::notifyAllViews(LOK_CALLBACK_COLOR_PALETTES, aManager.generateJSON());
2987 }
2988 }
2989 });
2990 }
2991 }
2992 }
2993 break;
2994
2995 default:OSL_FAIL("wrong Dispatcher (basesh.cxx)");
2996 }
2997 if(!bDone)
2998 rReq.Done();
2999}
3000
3002{
3003 return m_rView.GetWrtShell();
3004}
3005
3007{
3008 return m_rView.GetWrtShellPtr();
3009}
3010
3011static void EndUndo(SwWrtShell& rSh)
3012{
3013 SwRewriter aRewriter;
3014
3015 if (rSh.GetTableFormat())
3016 {
3017 aRewriter.AddRule(UndoArg1, SwResId(STR_START_QUOTE));
3018 aRewriter.AddRule(UndoArg2, rSh.GetTableFormat()->GetName());
3019 aRewriter.AddRule(UndoArg3, SwResId(STR_END_QUOTE));
3020
3021 }
3022 rSh.EndUndo(SwUndoId::INSTABLE, &aRewriter); // If possible change the Shell
3023}
3024
3026 SwView &rTempView,
3027 const OUString& aTableName,
3028 sal_uInt16 nRows,
3029 sal_uInt16 nCols,
3030 SwInsertTableOptions aInsTableOpts,
3031 const OUString& aAutoName,
3032 const std::unique_ptr<SwTableAutoFormat>& pTAFormat)
3033{
3035
3036 rSh.StartAllAction();
3037 if( rSh.HasSelection() )
3038 rSh.DelRight();
3039
3040 rSh.InsertTable( aInsTableOpts, nRows, nCols, pTAFormat.get() );
3042
3043 if( !aTableName.isEmpty() && !rSh.GetTableStyle( aTableName ) )
3044 rSh.GetTableFormat()->SetFormatName( aTableName );
3045
3046 if( pTAFormat != nullptr && !aAutoName.isEmpty()
3047 && aAutoName != SwViewShell::GetShellRes()->aStrNone )
3048 {
3049 SwTableNode* pTableNode = const_cast<SwTableNode*>( rSh.IsCursorInTable() );
3050 if ( pTableNode )
3051 {
3052 pTableNode->GetTable().SetTableStyleName( aAutoName );
3053 SwUndoTableAutoFormat* pUndo = new SwUndoTableAutoFormat( *pTableNode, *pTAFormat );
3054 if ( pUndo )
3055 rSh.GetIDocumentUndoRedo().AppendUndo( std::unique_ptr<SwUndo>(pUndo) );
3056 }
3057 }
3058
3059 rSh.EndAllAction();
3060 rTempView.AutoCaption(TABLE_CAP);
3061}
3062
3064{
3065 const SfxItemSet* pArgs = _rRequest.GetArgs();
3066 SwWrtShell& rSh = GetShell();
3067
3068 if ( rSh.GetFrameType( nullptr, true ) & FrameTypeFlags::FOOTNOTE )
3069 return;
3070
3071 SwView &rTempView = GetView(); // Because GetView() does not work after the shell exchange
3072 bool bHTMLMode = 0 != (::GetHtmlMode(rTempView.GetDocShell())&HTMLMODE_ON);
3073 bool bCallEndUndo = false;
3074
3075 if( !pArgs && rSh.IsSelection() && !rSh.IsInClickToEdit() &&
3076 !rSh.IsTableMode() )
3077 {
3078 const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
3079 SwInsertTableOptions aInsTableOpts = pModOpt->GetInsTableFlags(bHTMLMode);
3080
3082 bCallEndUndo = true;
3083
3084 bool bInserted = rSh.TextToTable( aInsTableOpts, '\t' );
3085 rSh.EnterStdMode();
3086 if (bInserted)
3087 rTempView.AutoCaption(TABLE_CAP);
3088 _rRequest.Done();
3089 }
3090 else
3091 {
3092 sal_uInt16 nColsIn = 0;
3093 sal_uInt16 nRowsIn = 0;
3094 SwInsertTableOptions aInsTableOptsIn( SwInsertTableFlags::All, 1 );
3095 OUString aTableNameIn;
3096 OUString aAutoNameIn;
3097 std::unique_ptr<SwTableAutoFormat> pTAFormatIn;
3098
3099 if( pArgs && pArgs->Count() >= 2 )
3100 {
3102 const SfxUInt16Item* pCols = _rRequest.GetArg<SfxUInt16Item>(SID_ATTR_TABLE_COLUMN);
3103 const SfxUInt16Item* pRows = _rRequest.GetArg<SfxUInt16Item>(SID_ATTR_TABLE_ROW);
3104 const SfxInt32Item* pFlags = _rRequest.GetArg<SfxInt32Item>(FN_PARAM_1);
3105 const SfxStringItem* pAuto = _rRequest.GetArg<SfxStringItem>(FN_PARAM_2);
3106
3107 if ( pName )
3108 aTableNameIn = pName->GetValue();
3109 if ( pCols )
3110 nColsIn = pCols->GetValue();
3111 if ( pRows )
3112 nRowsIn = pRows->GetValue();
3113 if ( pAuto )
3114 {
3115 aAutoNameIn = pAuto->GetValue();
3116 if ( !aAutoNameIn.isEmpty() )
3117 {
3118 SwTableAutoFormatTable aTableTable;
3119 aTableTable.Load();
3120 for ( size_t n=0; n<aTableTable.size(); n++ )
3121 {
3122 if ( aTableTable[n].GetName() == aAutoNameIn )
3123 {
3124 pTAFormatIn.reset(new SwTableAutoFormat( aTableTable[n] ));
3125 break;
3126 }
3127 }
3128 }
3129 }
3130
3131 if ( pFlags )
3132 aInsTableOptsIn.mnInsMode = static_cast<SwInsertTableFlags>(pFlags->GetValue());
3133 else
3134 {
3135 const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
3136 aInsTableOptsIn = pModOpt->GetInsTableFlags(bHTMLMode);
3137 }
3138 }
3139
3140 if( !nColsIn || !nRowsIn )
3141 {
3143 std::shared_ptr<AbstractInsTableDlg> pAbstractDialog(pFact->CreateInsTableDlg(rTempView));
3144 std::shared_ptr<weld::DialogController> pDialogController(pAbstractDialog->getDialogController());
3145
3146 weld::DialogController::runAsync(pDialogController,
3147 [pAbstractDialog, &rSh, &rTempView, aTableNameIn, nRowsIn, nColsIn, aInsTableOptsIn, aAutoNameIn] (sal_Int32 nResult) {
3148 if( RET_OK == nResult )
3149 {
3150 sal_uInt16 nCols = nColsIn;
3151 sal_uInt16 nRows = nRowsIn;
3152 SwInsertTableOptions aInsTableOpts = aInsTableOptsIn;
3153 OUString aTableName = aTableNameIn;
3154 OUString aAutoName = aAutoNameIn;
3155 std::unique_ptr<SwTableAutoFormat> pTAFormat;
3156
3157 pAbstractDialog->GetValues( aTableName, nRows, nCols, aInsTableOpts, aAutoName, pTAFormat );
3158
3159 if( nCols && nRows )
3160 {
3161 InsertTableImpl( rSh, rTempView, aTableName, nRows, nCols, aInsTableOpts, aAutoName, pTAFormat );
3162 EndUndo(rSh);
3163 }
3164 }
3165 }
3166 );
3167 }
3168 else
3169 {
3170 // record before shell change
3171 _rRequest.AppendItem( SfxStringItem( FN_INSERT_TABLE, aTableNameIn ) );
3172 if ( !aAutoNameIn.isEmpty() )
3173 _rRequest.AppendItem( SfxStringItem( FN_PARAM_2, aAutoNameIn ) );
3174 _rRequest.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_COLUMN, nColsIn ) );
3175 _rRequest.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_ROW, nRowsIn ) );
3176 _rRequest.AppendItem( SfxInt32Item( FN_PARAM_1, static_cast<sal_Int32>(aInsTableOptsIn.mnInsMode) ) );
3177 _rRequest.Done();
3178
3179 InsertTableImpl( rSh, rTempView, aTableNameIn, nRowsIn, nColsIn, aInsTableOptsIn, aAutoNameIn, pTAFormatIn );
3180
3181 bCallEndUndo = true;
3182 }
3183 }
3184
3185 if( bCallEndUndo )
3186 EndUndo(rSh);
3187}
3188
3190{
3191 SwWrtShell &rSh = GetShell();
3192 SfxWhichIter aIter( rSet );
3193 sal_uInt16 nWhich = aIter.FirstWhich();
3194 switch ( nWhich )
3195 {
3196 case SID_GALLERY_BG_BRUSH:
3197 {
3198 SelectionType nSel = rSh.GetSelectionType();
3199 SfxStringListItem aLst( nWhich );
3200 std::vector<OUString> &rLst = aLst.GetList();
3203 nHeaderPos = nFooterPos = 0;
3204 sal_uInt8 nPos = 1;
3205 rLst.push_back( SwResId( STR_SWBG_PAGE ) );
3206 nPagePos = nPos++;
3207 sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
3208 bool bHtmlMode = 0 != (nHtmlMode & HTMLMODE_ON);
3209
3210 if ( (!bHtmlMode || (nHtmlMode & HTMLMODE_FULL_STYLES)) &&
3211 (nSel & SelectionType::Text) )
3212 {
3213 rLst.push_back( SwResId( STR_SWBG_PARAGRAPH ) );
3214 nParagraphPos = nPos++;
3215 }
3216 if ( (!bHtmlMode || (nHtmlMode & HTMLMODE_SOME_STYLES)) &&
3218 {
3219 rLst.push_back( SwResId( STR_SWBG_TABLE ) );
3220 nTablePos = nPos++;
3221
3222 if(!bHtmlMode)
3223 {
3224 rLst.push_back( SwResId( STR_SWBG_TABLE_ROW ) );
3225 nTableRowPos = nPos++;
3226 }
3227
3228 rLst.push_back( SwResId( STR_SWBG_TABLE_CELL) );
3229 nTableCellPos = nPos++;
3230 }
3231 if(!bHtmlMode)
3232 {
3233 if ( nSel & SelectionType::Frame )
3234 {
3235 rLst.push_back( SwResId( STR_SWBG_FRAME ) );
3236 nFramePos = nPos++;
3237 }
3238 if ( nSel & SelectionType::Graphic )
3239 {
3240 rLst.push_back( SwResId( STR_SWBG_GRAPHIC ) );
3241 nGraphicPos = nPos++;
3242 }
3243 if ( nSel & SelectionType::Ole )
3244 {
3245 rLst.push_back( SwResId( STR_SWBG_OLE ) );
3246 nOlePos = nPos++;
3247 }
3248 const FrameTypeFlags nType = rSh.GetFrameType(nullptr,true);
3250 {
3251 rLst.push_back( SwResId( STR_SWBG_HEADER ) );
3252 nHeaderPos = nPos++;
3253 }
3255 {
3256 rLst.push_back( SwResId( STR_SWBG_FOOTER ) );
3257 nFooterPos = nPos;
3258 }
3259 }
3260 if ( rLst.empty() )
3261 rSet.DisableItem( nWhich );
3262 else
3263 rSet.Put( aLst );
3264 break;
3265 }
3266 }
3267}
3268
3270{
3271 SwWrtShell &rSh = GetShell();
3272 rSh.StartAction();
3273 const SfxItemSet* pArgs = rReq.GetArgs();
3274 sal_uInt16 nSlot = rReq.GetSlot();
3275 switch(nSlot)
3276 {
3277 case SID_GALLERY_BG_BRUSH:
3278 {
3279 if ( !pArgs )
3280 break;
3281
3282 SelectionType nSel = rSh.GetSelectionType();
3284 break;
3285
3286 const SfxUInt16Item* pPos = rReq.GetArg<SfxUInt16Item>(SID_GALLERY_BG_POS);
3287 const SvxBrushItem* pBrush = rReq.GetArg<SvxBrushItem>(SID_GALLERY_BG_BRUSH);
3288 if ( !pPos || !pBrush )
3289 break;
3290
3291 sal_uInt8 nPos = pPos->GetValue();
3292 ++nPos;
3293
3294 SvxBrushItem aBrush( *pBrush );
3295 aBrush.SetWhich( RES_BACKGROUND );
3296 if ( nPos == nParagraphPos )
3297 rSh.SetAttrItem( aBrush );
3298 else if ( nPos == nTablePos )
3299 rSh.SetTabBackground( aBrush );
3300 else if ( nPos == nTableRowPos )
3301 rSh.SetRowBackground( aBrush );
3302 else if ( nPos == nTableCellPos )
3303 rSh.SetBoxBackground( aBrush );
3304 else if ( nPos == nFramePos || nPos == nGraphicPos || nPos == nOlePos )
3305 {
3307 aCoreSet.Put( aBrush );
3308 rSh.SetFlyFrameAttr( aCoreSet );
3309 }
3310 else if ( nPos == nPagePos || nPos == nHeaderPos || nPos == nFooterPos )
3311 {
3312 sal_uInt16 nDesc = rSh.GetCurPageDesc();
3313 SwPageDesc aDesc( rSh.GetPageDesc( nDesc ) );
3314 if ( nPos == nPagePos )
3315 aDesc.GetMaster().SetFormatAttr( aBrush );
3316 else if ( nPos == nHeaderPos )
3317 {
3318 SwFormatHeader aHead( aDesc.GetMaster().GetHeader() );
3319 aHead.GetHeaderFormat()->SetFormatAttr( aBrush );
3320 aDesc.GetMaster().SetFormatAttr( aHead );
3321 }
3322 else if ( nPos == nFooterPos )
3323 {
3324 SwFormatFooter aFoot( aDesc.GetMaster().GetFooter() );
3325 aFoot.GetFooterFormat()->SetFormatAttr( aBrush );
3326 aDesc.GetMaster().SetFormatAttr( aFoot );
3327 }
3328 rSh.ChgPageDesc( nDesc, aDesc );
3329 }
3330 break;
3331 }
3332 }
3333 rSh.EndAction();
3334 rReq.Done();
3335}
3336
3338{
3339 sal_uInt16 nSlot = rReq.GetSlot();
3340 switch( nSlot )
3341 {
3342#if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
3343 case FN_CHANGE_DBFIELD:
3344 {
3347 pDlg->Execute();
3348 }
3349 break;
3350#endif
3351 default:
3352 OSL_FAIL("wrong dispatcher");
3353 }
3354}
3355
3356std::shared_ptr<std::vector<std::unique_ptr<SwPaM>>> SwBaseShell::CopyPaMRing(SwPaM& rOrig)
3357{
3358 auto vCursors = std::make_shared<std::vector<std::unique_ptr<SwPaM>>>();
3359 vCursors->emplace_back(std::make_unique<SwPaM>(rOrig, nullptr));
3360 for (auto& rCursor : rOrig.GetRingContainer())
3361 {
3362 if (&rCursor != &rOrig)
3363 vCursors->emplace_back(std::make_unique<SwPaM>(rCursor, vCursors->front().get()));
3364 }
3365 return vCursors;
3366}
3367
3368/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@ TABLE_CAP
@ UndoArg1
Definition: SwRewriter.hxx:29
@ UndoArg3
Definition: SwRewriter.hxx:31
@ UndoArg2
Definition: SwRewriter.hxx:30
const char * pName
static bool lcl_UpdateContourDlg(SwWrtShell &rSh, SelectionType nSel)
Definition: basesh.cxx:188
static sal_uInt8 nTableCellPos
Definition: basesh.cxx:132
static sal_uInt8 nFramePos
Definition: basesh.cxx:129
static sal_uInt8 nOlePos
Definition: basesh.cxx:128
static sal_uInt8 nTablePos
Definition: basesh.cxx:130
static sal_uInt8 nParagraphPos
Definition: basesh.cxx:126
static sal_uInt8 nGraphicPos
Definition: basesh.cxx:127
static sal_uInt8 nTableRowPos
Definition: basesh.cxx:131
static sal_uInt8 nPagePos
Definition: basesh.cxx:133
static sal_uInt8 nFooterPos
Definition: basesh.cxx:135
static void InsertTableImpl(SwWrtShell &rSh, SwView &rTempView, const OUString &aTableName, sal_uInt16 nRows, sal_uInt16 nCols, SwInsertTableOptions aInsTableOpts, const OUString &aAutoName, const std::unique_ptr< SwTableAutoFormat > &pTAFormat)
Definition: basesh.cxx:3025
static void lcl_UpdateIMapDlg(SwWrtShell &rSh)
Definition: basesh.cxx:172
static void EndUndo(SwWrtShell &rSh)
Definition: basesh.cxx:3011
static sal_uInt8 nHeaderPos
Definition: basesh.cxx:134
IMPL_LINK_NOARG(SwBaseShell, GraphicArrivedHdl, SwCursorShell &, void)
Definition: basesh.cxx:1604
GPOS_NONE
#define GetWhich(nSlot)
sal_uInt16 GetValue() const
const OUString & GetValue() const
void Execute(SfxRequest &)
GraphicType GetType() const
virtual void restoreAnnotationMarks(bool bDelete=true)=0
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
virtual sal_Int32 getImagePreferredDPI()=0
void disposeAndReset(reference_type *pBody)
std::shared_ptr< model::Theme > const & GetTheme() const
SdrPageProperties & getSdrPageProperties()
void SetState(const SfxItemSet &rSet)
void Invalidate(sal_uInt16 nId)
const css::uno::Reference< css::frame::XDispatchRecorder > & GetRecorder() const
void InvalidateAll(bool bWithMsg)
bool GetValue() const
std::shared_ptr< SfxDialogController > & GetController()
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
static void GetDefaultTargetList(TargetList &)
sal_Int16 GetValue() const
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
sal_uInt16 GetSlotId(sal_uInt16 nWhich) const
SfxItemPool * GetPool() const
void SetParent(const SfxItemSet *pNew)
sal_uInt16 Count() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void DisableItem(sal_uInt16 nWhich)
void InvalidateItem(sal_uInt16 nWhich)
static void notifyAllViews(int nType, const OString &rPayload)
css::uno::Reference< css::frame::XModel3 > GetModel() const
virtual comphelper::EmbeddedObjectContainer & getEmbeddedObjectContainer() const override
std::unique_ptr< SfxPoolItem > CloneSetWhich(sal_uInt16 nNewWhich) const
sal_uInt16 GetSlot() const
void Ignore()
const SfxItemSet * GetArgs() const
const T * GetArg(sal_uInt16 nSlotId) const
void AppendItem(const SfxPoolItem &)
void SetReturnValue(const SfxPoolItem &)
weld::Window * GetFrameWeld() const
static bool HasMacroRecorder(const SfxViewFrame &rFrame)
void Done(bool bRemove=false)
SfxItemPool & GetPool() const
const OUString & GetName() const
virtual SfxObjectShell * GetObjectShell()
const SfxPoolItem * ExecuteSlot(SfxRequest &rReq, const SfxInterface *pIF=nullptr)
void SetPool(SfxItemPool *pNewPool)
void SetName(const OUString &rName)
std::vector< OUString > & GetList()
virtual ViewShellId GetViewShellId() const
const css::uno::Any & GetValue() const
void ToggleChildWindow(sal_uInt16)
SfxBindings & GetBindings()
bool HasChildWindow(sal_uInt16)
SfxDispatcher * GetDispatcher()
SfxChildWindow * GetChildWindow(sal_uInt16)
weld::Window * GetFrameWeld() const
ViewShellId GetViewShellId() const override
SfxViewFrame & GetViewFrame() const
sal_uInt16 FirstWhich()
sal_uInt16 NextWhich()
static sal_uInt16 IsMath(const SvGlobalName &rName)
static SvxAbstractDialogFactory * Create()
const Color & GetValue() const
void setComplexColor(model::ComplexColor const &rComplexColor)
model::ComplexColor const & getComplexColor() const
void Update(const Graphic &rGraphic, bool bGraphicLinked, const tools::PolyPolygon *pPolyPoly, void *pEditingObj)
bool IsGraphicChanged() const
const void * GetEditingObject() const
const Graphic & GetGraphic() const
tools::PolyPolygon GetPolyPolygon()
sal_Int8 GetType() const
const OUString & GetURL() const
const css::uno::Reference< css::graphic::XGraphic > & GetGraphic() const
static void UpdateIMapDlg(const Graphic &rGraphic, const ImageMap *pImageMap, const TargetList *pTargetList, void *pEditingObj)
const void * GetEditingObject() const
const ImageMap & GetImageMap() const
const SfxPoolItem * GetItemOfScript(SvtScriptType nScript) const
virtual VclPtr< VclAbstractDialog > CreateTitlePageDlg(weld::Window *pParent)=0
virtual VclPtr< SfxAbstractDialog > CreateSwBackgroundDialog(weld::Window *pParent, const SfxItemSet &rSet)=0
static SwAbstractDialogFactory * Create()
Definition: swabstdlg.cxx:36
virtual VclPtr< AbstractSwConvertTableDlg > CreateSwConvertTableDlg(SwView &rView, bool bToTable)=0
virtual VclPtr< SfxAbstractDialog > CreateSwBorderDlg(weld::Window *pParent, SfxItemSet &rSet, SwBorderModes nType)=0
virtual std::shared_ptr< AbstractInsTableDlg > CreateInsTableDlg(SwView &rView)=0
virtual VclPtr< VclAbstractDialog > CreateSwChangeDBDlg(SwView &rVw)=0
static std::shared_ptr< std::vector< std::unique_ptr< SwPaM > > > CopyPaMRing(SwPaM &rOrig)
Definition: basesh.cxx:3356
void StateUndo(SfxItemSet &)
Definition: basesh.cxx:696
void GetBckColState(SfxItemSet &rSet)
Definition: basesh.cxx:2571
SwView & m_rView
Definition: basesh.hxx:41
void GetState(SfxItemSet &)
Definition: basesh.cxx:1699
void GetTextFontCtrlState(SfxItemSet &rSet)
Definition: basesh.cxx:2490
void SetWrapMode(sal_uInt16 nSlot)
Definition: basesh.cxx:2198
SwWrtShell & GetShell()
Definition: basesh.cxx:3001
void GetGalleryState(SfxItemSet &)
Definition: basesh.cxx:3189
void ExecDelete(SfxRequest &)
Definition: basesh.cxx:209
SfxItemSet * m_pGetStateSet
Definition: basesh.hxx:48
void ExecuteGallery(SfxRequest &)
Definition: basesh.cxx:3269
bool AddGrfUpdateSlot(sal_uInt16 nSlot)
Definition: basesh.hxx:61
SwView & GetView()
Definition: basesh.hxx:59
SwBaseShell(SwView &rShell)
Definition: basesh.cxx:2329
void ExecUndo(SfxRequest &)
Definition: basesh.cxx:599
void ExecTextCtrl(SfxRequest &rReq)
Definition: basesh.cxx:2351
void ExecField(SfxRequest const &rReq)
Definition: basesh.cxx:3337
void ExecClpbrd(SfxRequest &)
Definition: basesh.cxx:298
void StateClpbrd(SfxItemSet &)
Definition: basesh.cxx:521
void Execute(SfxRequest &)
Definition: basesh.cxx:916
void InsertTable(SfxRequest &_rRequest)
Definition: basesh.cxx:3063
void StateStyle(SfxItemSet &)
Definition: basesh.cxx:2175
static void SetFrameMode(FlyMode eMode, SwWrtShell *pShell)
Definition: basesh.cxx:2307
SwWrtShell * GetShellPtr()
Definition: basesh.cxx:3006
static void StateDisableItems(SfxItemSet &)
Definition: basesh.cxx:2161
void ExecBckCol(SfxRequest &rReq)
Definition: basesh.cxx:2629
void GetTextCtrlState(SfxItemSet &rSet)
Definition: basesh.cxx:2484
void GetBorderState(SfxItemSet &rSet)
Definition: basesh.cxx:2755
static FlyMode s_eFrameMode
Definition: basesh.hxx:44
virtual ~SwBaseShell() override
Definition: basesh.cxx:2341
void ExecDlg(SfxRequest &)
Definition: basesh.cxx:2785
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1223
bool IsTableComplexForChart()
Definition: trvltbl.cxx:723
bool EndAllTableBoxEdit()
Definition: trvltbl.cxx:913
void ClearTableBoxContent()
Definition: trvltbl.cxx:906
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
bool IsInVerticalText(const Point *pPt=nullptr) const
Definition: crsrsh.cxx:3763
void SttCursorMove()
Definition: crsrsh.cxx:301
void SwapPam()
Definition: crsrsh.cxx:1262
void HideCursor()
Definition: crsrsh.cxx:2731
bool SttEndDoc(bool bStt)
Definition: crsrsh.cxx:579
bool IsEndPara() const
Definition: crsrsh.cxx:1400
bool MoveTable(SwWhichTable, SwMoveFnCollection const &)
Definition: trvltbl.cxx:679
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:194
bool IsSttPara() const
Definition: crsrsh.cxx:1381
void GotoFlyAnchor()
jump from the frame to the anchor
Definition: trvlfnfl.cxx:350
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 HasMark() const
Definition: crsrsh.hxx:908
bool IsSelFullPara() const
Definition: crsrsh.cxx:3731
void EndAction(const bool bIdleEnd=false)
Definition: crsrsh.cxx:243
void ClearMark()
Definition: crsrsh.cxx:1225
const Link< SwCursorShell &, void > & GetGrfArrivedLnk() const
Definition: crsrsh.hxx:508
void CallChgLnk()
Definition: crsrsh.cxx:2847
void SetGrfArrivedLnk(const Link< SwCursorShell &, void > &rLnk)
Definition: crsrsh.hxx:507
bool HasReadonlySel(bool isReplace=false) const
Definition: crsrsh.cxx:3662
bool IsCursorPtAtEnd() const
Definition: crsrsh.hxx:920
bool IsTableMode() const
Definition: crsrsh.hxx:668
bool MoveFieldType(const SwFieldType *pFieldType, const bool bNext, const SwFieldIds nResType=SwFieldIds::Unknown, const bool bAddSetExpressionFieldsToInputFields=true)
Definition: crstrvl.cxx:674
void EndCursorMove(const bool bIdleEnd=false)
Definition: crsrsh.cxx:310
void SaveTableBoxContent(const SwPosition *pPos=nullptr)
Definition: trvltbl.cxx:867
void StateStyleSheet(SfxItemSet &, SwWrtShell *pSh=nullptr)
Definition: docst.cxx:91
void FormatPage(weld::Window *pDialogParent, const OUString &rPage, const OUString &rPageId, SwWrtShell &rActShell, SfxRequest *pRequest=nullptr)
Show page style format dialog.
Definition: docst.cxx:1681
void Execute(SfxRequest &)
Dispatcher.
Definition: docsh2.cxx:397
void ExecStyleSheet(SfxRequest &)
Definition: docst.cxx:309
Definition: doc.hxx:197
sal_uInt16 GetRefMarks(std::vector< OUString > *=nullptr) const
Definition: doc.cxx:1104
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:158
IDocumentSettingAccess const & getIDocumentSettingAccess() const
Definition: doc.cxx:190
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1890
bool isXForms() const
Definition: docxforms.cxx:44
const SwFormatRefMark * GetRefMark(std::u16string_view rName) const
Definition: doc.cxx:1060
SwDocShell * GetDocShell()
Definition: doc.hxx:1370
::sw::UndoManager & GetUndoManager()
Definition: doc.cxx:147
virtual void CalcLayout() override
To enable set up of StartActions and EndActions.
Definition: edws.cxx:108
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
Definition: edattr.cxx:171
void StartAllAction()
For all views of this document.
Definition: edws.cxx:86
bool IsTextToTableAvailable() const
Definition: edtab.cxx:195
bool IsNoNum(bool bChkStart=true) const
Definition: ednumber.cxx:650
const SwTable & InsertTable(const SwInsertTableOptions &rInsTableOpts, sal_uInt16 nRows, sal_uInt16 nCols, const SwTableAutoFormat *pTAFormat=nullptr)
Inserts an nRows x nCols table to the document at the current position.
Definition: edtab.cxx:101
bool TextToTable(const SwInsertTableOptions &rInsTableOpts, sal_Unicode cCh, const SwTableAutoFormat *pTAFormat=nullptr)
Definition: edtab.cxx:132
GraphicType GetGraphicType() const
Definition: editsh.cxx:270
void GetGrfNms(OUString *pGrfName, OUString *pFltName, const SwFlyFrameFormat *=nullptr) const
Returns the name and the filter name of a graphic if the pointer is on a graphic.
Definition: editsh.cxx:304
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
Definition: edws.cxx:223
void UpdateDocStat()
Document - Statistics.
Definition: editsh.cxx:425
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
bool GetFirstRedoInfo(OUString *const o_pStr, SwUndoId *const o_pId, const SwView *pView=nullptr) const
Definition: edws.cxx:244
bool GetLastUndoInfo(OUString *const o_pStr, SwUndoId *const o_pId, const SwView *pView=nullptr) const
Definition: edws.cxx:237
Graphic GetIMapGraphic() const
Remove default parameter, because method always called this default value.
Definition: editsh.cxx:604
const SwSection * GetCurrSection() const
Definition: edsect.cxx:71
bool IsLinkedGrfSwapOut() const
Definition: editsh.cxx:249
SvtScriptType GetScriptType() const
returns the script type of the selection
Definition: edattr.cxx:662
bool IsAnySectionInDoc() const
Definition: edsect.cxx:119
bool IsInsRegionAvailable() const
Definition: edsect.cxx:58
void DelNumRules()
Delete, split enumeration list.
Definition: ednumber.cxx:249
void SetGraphicPolygon(const tools::PolyPolygon *pPoly)
Definition: editsh.cxx:324
sfx2::LinkManager & GetLinkManager()
Definition: editsh.cxx:592
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
Definition: edws.cxx:234
SwTextFormatColl * GetCurTextFormatColl() const
Get the named paragraph format of the current selection.
Definition: edattr.cxx:238
const Graphic * GetGraphic(bool bWait=true) const
Definition: editsh.cxx:238
void * GetIMapInventor() const
Unique identification of object (for ImageMapDlg).
Definition: editsh.cxx:597
const tools::PolyPolygon * GetGraphicPolygon() const
Definition: editsh.cxx:318
void EndAllAction()
Definition: edws.cxx:97
SwUndoId GetRepeatInfo(OUString *const o_pStr) const
Definition: edws.cxx:251
bool TableToText(sal_Unicode cCh)
Definition: edtab.cxx:149
void ReRead(const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic=nullptr)
Re-read if graphic is not ok. Current graphic is replaced by the new one.
Definition: editsh.cxx:294
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:61
void FlushInBuffer()
Character buffer is inserted into the document.
Definition: edtwin.cxx:890
void SetUseInputLanguage(bool bNew)
#i42732# display status of font size/name depending on either the input language or the selection pos...
Definition: edtwin.cxx:6624
bool IsUseInputLanguage() const
Definition: edtwin.hxx:268
void SelectionToHell()
Below document.
Definition: feshview.cxx:1120
bool SetFlyFrameAttr(SfxItemSet &rSet)
Definition: fefly1.cxx:1103
void AlignFormulaToBaseline(const css::uno::Reference< css::embed::XEmbeddedObject > &xObj)
for starmath formulas anchored 'as char' it aligns it baseline to baseline changing the previous vert...
Definition: fefly1.cxx:2097
FrameTypeFlags GetFrameType(const Point *pPt, bool bStopAtFly) const
For return values see above FrameType.
Definition: fews.cxx:237
void SetObjAttr(const SfxItemSet &rSet)
Definition: feshview.cxx:2672
Point GetAnchorObjDiff() const
Methods for status line.
Definition: feshview.cxx:2283
FlyProtectFlags IsSelObjProtected(FlyProtectFlags eType) const
Which Protection is set at selected object?
Definition: feshview.cxx:2581
void SetBoxBackground(const SvxBrushItem &rNew)
Definition: fetab.cxx:958
void ChgPageDesc(size_t i, const SwPageDesc &)
Definition: fedesc.cxx:111
RndStdIds GetAnchorId() const
Anchor type of selected object, RndStdIds::UNKNOWN if ambiguous or in case of frame selection.
Definition: feshview.cxx:2209
void SelectionToHeaven()
Above document.
Definition: feshview.cxx:1115
bool IsFrameSelected() const
Definition: feshview.cxx:1133
bool GotoObj(bool bNext, GotoObjFlags eType=GotoObjFlags::DrawAny)
Definition: feshview.cxx:1630
Size GetObjSize() const
Definition: feshview.cxx:2270
void SetRowBackground(const SvxBrushItem &rNew)
Definition: fetab.cxx:922
css::uno::Reference< css::embed::XEmbeddedObject > GetOleRef() const
get reference to OLE object (if there is one) for selected FlyFrame
Definition: fefly1.cxx:1491
SwFrameFormat * GetSelectedFrameFormat() const
If frame then frame style, else 0.
Definition: fefly1.cxx:1213
bool GetBoxBackground(std::unique_ptr< SvxBrushItem > &rToFill) const
FALSE ambiguous.
Definition: fetab.cxx:966
void ChgAnchor(RndStdIds eAnchorId, bool bSameOnly=false, bool bPosCorr=true)
frmatr.hxx.
Definition: feshview.cxx:2239
void SetTabBorders(const SfxItemSet &rSet)
Definition: fetab.cxx:935
size_t GetCurPageDesc(const bool bCalcFrame=true) const
Definition: fedesc.cxx:167
static SfxItemSetFixed< RES_VERT_ORIENT, RES_ANCHOR > makeItemSetFromFormatAnchor(SfxItemPool &rPool, const SwFormatAnchor &rAnchor)
Definition: fefly1.cxx:1137
bool GetObjAttr(SfxItemSet &rSet) const
Attention: Ambiguities if multiple selections.
Definition: feshview.cxx:2649
sal_uInt16 GetPhyPageNum() const
Phy: real page count.
Definition: fews.cxx:335
SdrLayerID GetLayerId() const
1 Heaven, 0 Hell, SDRLAYER_NOTFOUND Ambiguous.
Definition: feshview.cxx:1049
void SetTabBackground(const SvxBrushItem &rNew)
Definition: fetab.cxx:1003
void GetTabBorders(SfxItemSet &rSet) const
Definition: fetab.cxx:953
bool GetFlyFrameAttr(SfxItemSet &rSet) const
Definition: fefly1.cxx:1061
size_t IsObjSelected() const
Definition: feshview.cxx:1125
const SwPageDesc & GetPageDesc(size_t i) const
Definition: fedesc.cxx:126
const SwFrameFormat * IsFlyInFly()
Is selected frame within another frame?
Definition: fefly1.cxx:312
bool GetTableCopied() const
Definition: fesh.hxx:653
SwFieldType * GetFieldType(SwFieldIds nResId, size_t nField=0) const
Definition: fldmgr.cxx:415
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:247
Base class of all fields.
Definition: fldbas.hxx:296
void SetAttrSet(const SfxItemSet &rSet)
Definition: frmmgr.cxx:619
const SfxItemSet & GetAttrSet() const
Definition: frmmgr.hxx:124
void UpdateFlyFrame()
Definition: frmmgr.cxx:159
FlyAnchors.
Definition: fmtanchr.hxx:37
void SetGutterWidth(sal_uInt16 nNew, sal_uInt16 nAct)
Adjusts borders for columns in aColumns.
Definition: atrfrm.cxx:949
void Init(sal_uInt16 nNumCols, sal_uInt16 nGutterWidth, sal_uInt16 nAct)
This function allows to (repeatedly) initialize the columns.
Definition: atrfrm.cxx:969
void SetWishWidth(sal_uInt16 nNew)
Definition: fmtclds.hxx:134
Footer, for pageformats Client of FrameFormat describing the footer.
Definition: fmthdft.hxx:65
const SwFrameFormat * GetFooterFormat() const
Definition: fmthdft.hxx:85
Header, for PageFormats Client of FrameFormat describing the header.
Definition: fmthdft.hxx:34
const SwFrameFormat * GetHeaderFormat() const
Definition: fmthdft.hxx:54
Defines the horizontal position of a fly frame.
Definition: fmtornt.hxx:73
sal_Int16 GetHoriOrient() const
Definition: fmtornt.hxx:94
bool IsAnchorOnly() const
Definition: fmtsrnd.hxx:52
void SetSurround(css::text::WrapTextMode eNew)
Definition: fmtsrnd.hxx:55
bool IsContour() const
Definition: fmtsrnd.hxx:53
void SetAnchorOnly(bool bNew)
Definition: fmtsrnd.hxx:56
void SetContour(bool bNew)
Definition: fmtsrnd.hxx:57
css::text::WrapTextMode GetSurround() const
Definition: fmtsrnd.hxx:51
SfxPoolItem subclass that wraps a URL.
Definition: fmturl.hxx:33
const ImageMap * GetMap() const
Definition: fmturl.hxx:67
Defines the vertical position of a fly frame.
Definition: fmtornt.hxx:37
sal_Int16 GetVertOrient() const
Definition: fmtornt.hxx:57
const SwFormatFooter & GetFooter(bool=true) const
Definition: fmthdft.hxx:99
const OUString & GetName() const
Definition: format.hxx:131
const SwFormatHeader & GetHeader(bool=true) const
Definition: fmthdft.hxx:97
const SfxPoolItem & GetFormatAttr(sal_uInt16 nWhich, bool bInParents=true) const
If bInParents is FALSE, search only in this format for attribute.
Definition: format.cxx:366
const SwFormatCol & GetCol(bool=true) const
Definition: fmtclds.hxx:168
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:447
bool IsAutoUpdateOnDirectFormat() const
Query / set m_bAutoUpdateOnDirectFormat-flag.
Definition: format.hxx:188
Style of a layout element.
Definition: frmfmt.hxx:72
virtual void SetFormatName(const OUString &rNewName, bool bBroadcast=false) override
Definition: atrfrm.cxx:2608
const SwInsertTableOptions & GetInsTableFlags(bool bHTML) const
Definition: modcfg.hxx:303
Class for automated call of Start- and EndCursorMove().
Definition: editsh.hxx:1048
Marks a node in the document model.
Definition: ndindex.hxx:31
SwNode & GetNode() const
Definition: ndindex.hxx:123
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:901
bool IsContentNode() const
Definition: node.hxx:188
bool IsTextNode() const
Definition: node.hxx:190
SwContentNode * GetContentNode()
Definition: node.hxx:666
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:188
SwNode & GetPointNode() const
Definition: pam.hxx:275
const SwPosition * GetPoint() const
Definition: pam.hxx:253
const OUString & GetName() const
Definition: pagedesc.hxx:196
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:238
void AddRule(SwUndoArg eWhat, const OUString &rWith)
Definition: SwRewriter.cxx:25
SectionType GetType() const
Definition: section.hxx:173
sal_Int32 GetFontHeight(sal_uInt8 nFont, sal_uInt8 nScriptType, LanguageType eLang)
Definition: fontcfg.cxx:303
size_t size() const
Definition: tblafmt.cxx:935
SAL_DLLPRIVATE bool Load(SvStream &rStream)
Definition: tblafmt.cxx:1066
const OUString & GetName() const
Definition: tblafmt.hxx:206
void UpdateChart()
Definition: tablemgr.cxx:172
const SwTable & GetTable() const
Definition: node.hxx:542
void SetTableStyleName(const OUString &rName)
Set the new table style name for this table.
Definition: swtable.hxx:199
Represents the style of a paragraph.
Definition: fmtcol.hxx:61
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
void GetAttrOutlineContentVisible(bool &bOutlineContentVisibleAttr)
GetAttrOutlineContentVisible.
Definition: ndtxt.cxx:4183
std::vector< SwTextAttr * > GetTextAttrsAt(sal_Int32 const nIndex, sal_uInt16 const nWhich) const
get the innermost text attributes covering position nIndex.
Definition: ndtxt.cxx:1795
void UpdateFieldContent(SwDoc *pDoc, SwWrtShell &rWrtSh, OUString aContent)
Definition: atrref.cxx:161
static void FillClipFormatItem(const SwWrtShell &rSh, const TransferableDataHelper &rData, SvxClipboardFormatItem &rToFill)
Definition: swdtflvr.cxx:3543
static void PrePasteSpecial(const SwWrtShell &rSh, TransferableDataHelper &, const VclPtr< SfxAbstractPasteDialog > &pDlg)
PrePasteSpecial Prepares the given dialog without actually running it.
Definition: swdtflvr.cxx:3487
static bool Paste(SwWrtShell &, TransferableDataHelper &, RndStdIds nAnchorType=RndStdIds::FLY_AT_PARA, bool bIgnoreComments=false, PasteTableType ePasteTable=PasteTableType::PASTE_DEFAULT)
Definition: swdtflvr.cxx:1455
static bool PasteUnformatted(SwWrtShell &rSh, TransferableDataHelper &)
Definition: swdtflvr.cxx:3481
static bool IsPaste(const SwWrtShell &, const TransferableDataHelper &)
Definition: swdtflvr.cxx:1367
static bool PasteFormat(SwWrtShell &rSh, TransferableDataHelper &rData, SotClipboardFormatId nFormat)
Definition: swdtflvr.cxx:3397
void SetShowChangesInMargin(bool b)
Definition: viewopt.hxx:460
bool IsShowOutlineContentVisibilityButton() const
Definition: viewopt.cxx:177
void SetFormView(bool bSet)
Definition: viewopt.hxx:634
void SetShowChangesInMargin2(bool b)
Definition: viewopt.hxx:469
bool IsFormView() const
Definition: viewopt.hxx:633
bool IsViewLocked() const
Definition: viewsh.hxx:490
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:452
bool HasCharts() const
Definition: viewsh.cxx:779
void Reformat()
Invalidates complete Layout (ApplyViewOption).
Definition: viewsh.cxx:1050
static ShellResource * GetShellRes()
Definition: viewsh.cxx:2664
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2163
void UpdateAllCharts()
update all charts for which any table exists
Definition: viewsh.cxx:772
IDocumentUndoRedo const & GetIDocumentUndoRedo() const
Provides access to the document undo/redo interface.
Definition: viewsh.cxx:2835
SwDoc * GetDoc() const
Definition: viewsh.hxx:308
void LockView(bool b)
Definition: viewsh.hxx:491
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:648
void UpdateOleObjectPreviews()
Update the previews of all OLE objects.
Definition: viewsh.cxx:740
Definition: view.hxx:146
SfxShell * GetCurShell()
Definition: view.hxx:586
void AutoCaption(const sal_uInt16 nType, const SvGlobalName *pOleId=nullptr)
Definition: viewdlg2.cxx:183
SwWrtShell & GetWrtShell() const
Definition: view.hxx:423
virtual FmFormShell * GetFormShell() override
Definition: view.hxx:589
SwWrtShell * GetWrtShellPtr() const
Definition: view.hxx:424
void ResetSubShell()
Definition: view.hxx:593
SwEditWin & GetEditWin()
Definition: view.hxx:426
ShellMode GetShellMode() const
Definition: view0.cxx:108
SwDocShell * GetDocShell()
Definition: view.cxx:1193
void InvalidateRulerPos()
Definition: viewport.cxx:107
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
void ClickToField(const SwField &rField, bool bExecHyperlinks)
Definition: wrtsh2.cxx:342
bool IsSelFrameMode() const
Definition: wrtsh.hxx:177
void AutoUpdatePara(SwTextFormatColl *pColl, const SfxItemSet &rStyleSet, SwPaM *pPaM=nullptr)
Definition: wrtsh1.cxx:1908
void EnterSelFrameMode(const Point *pStartDrag=nullptr)
Definition: select.cxx:711
bool GoNextBookmark()
Definition: wrtsh3.cxx:277
void EndSelect()
Definition: select.cxx:434
void LeaveSelFrameMode()
Definition: select.cxx:729
OUString GetRepeatString() const
Definition: wrtundo.cxx:138
bool DelLeft()
Definition: delete.cxx:136
void GetDoStrings(DoType eDoType, SfxStringListItem &rStrLstItem) const
Definition: wrtundo.cxx:115
void AutoUpdateFrame(SwFrameFormat *pFormat, const SfxItemSet &rStyleSet)
Definition: wrtsh1.cxx:1945
bool Left(SwCursorSkipMode nMode, bool bSelect, sal_uInt16 nCount, bool bBasicCall, bool bVisual=false)
Definition: move.cxx:110
SelectionType GetSelectionType() const
Definition: wrtsh1.cxx:1723
void UpdateInputFields(SwInputFieldList *pLst=nullptr)
Definition: wrtsh2.cxx:146
void InsertGraphic(const OUString &rPath, const OUString &rFilter, const Graphic &, SwFlyFrameAttrMgr *=nullptr, RndStdIds nAnchorType=RndStdIds::FLY_AT_PARA)
Definition: wrtsh1.cxx:290
void EnterStdMode()
Definition: select.cxx:560
SwFrameFormat * GetTableStyle(std::u16string_view rFormatName)
Definition: wrtsh1.cxx:1857
virtual void ApplyViewOptions(const SwViewOption &rOpt) override
Apply ViewOptions with Start-/EndAction.
Definition: wrtsh1.cxx:2122
void Do(DoType eDoType, sal_uInt16 nCnt=1, sal_uInt16 nOffset=0)
Definition: wrtundo.cxx:33
bool GoPrevBookmark()
Definition: wrtsh3.cxx:298
bool DelRight(bool isReplaceHeuristic=false)
Definition: delete.cxx:285
bool HasSelection() const
Definition: wrtsh.hxx:147
void UnSelectFrame()
Definition: select.cxx:332
OUString GetDoString(DoType eDoType) const
Definition: wrtundo.cxx:95
bool IsInClickToEdit() const
Definition: wrtsh.hxx:669
const SwView & GetView() const
Definition: wrtsh.hxx:443
static TransferableDataHelper CreateFromSystemClipboard(vcl::Window *pWindow)
css::uno::Reference< css::datatransfer::XTransferable > GetXTransferable() const
void UpdateAllLinks(bool bAskUpdate, bool bUpdateGrfLinks, weld::Window *pParentWin)
const SvBaseLinks & GetLinks() const
virtual short run() override
The UI part presenting the graphic size check results, which is used by GenericCheckDialog.
ring_container GetRingContainer()
Definition: ring.hxx:240
Stores the undo/redo information, implementing the IDocumentUndoRedo interface.
Definition: UndoManager.hxx:44
bool IsViewUndoActionIndependent(const SwView *pView, sal_uInt16 &rOffset) const
Checks if the topmost undo action owned by pView is independent from the topmost action undo action.
Definition: docundo.cxx:364
void SetOrientation(Degree10 nLineOrientation)
void SetVertical(bool bVertical)
void SetStyleName(const OUString &rStyleName)
void SetPitch(FontPitch ePitch)
void SetFamily(FontFamily)
void SetCharSet(rtl_TextEncoding)
void SetFamilyName(const OUString &rFamilyName)
void SetInputContext(const InputContext &rInputContext)
LanguageType GetInputLanguage() const
void GrabFocus()
static bool runAsync(const std::shared_ptr< DialogController > &rController, const std::function< void(sal_Int32)> &)
#define FN_TOOL_ANCHOR_PAGE
Definition: cmdid.h:243
#define FN_UPDATE_TOX
Definition: cmdid.h:537
#define FN_UPDATE_ALL
Definition: cmdid.h:134
#define FN_TABLE_PASTE_COL_BEFORE
Definition: cmdid.h:323
#define FN_TOOL_ANCHOR_FRAME
Definition: cmdid.h:249
#define FN_INSERT_REGION
Definition: cmdid.h:301
#define FN_SET_TRACKED_INSERTIONS_IN_MARGIN
Definition: cmdid.h:202
#define FN_FORMAT_BACKGROUND_DLG
Definition: cmdid.h:349
#define FN_SET_TRACKED_CHANGES_IN_TEXT
Definition: cmdid.h:200
#define FN_PAGE_STYLE_SET_LR_MARGIN
Definition: cmdid.h:412
#define FN_ESCAPE
Definition: cmdid.h:712
#define FN_GOTO_NEXT_OBJ
Definition: cmdid.h:716
#define FN_UPDATE_CHARTS
Definition: cmdid.h:140
#define FN_SET_TRACKED_DELETIONS_IN_MARGIN
Definition: cmdid.h:201
#define FN_CONVERT_TEXT_TO_TABLE
Definition: cmdid.h:407
#define FN_INSERT_TABLE
Definition: cmdid.h:234
#define FN_FRAME_WRAP_IDEAL
Definition: cmdid.h:433
#define FN_BACKSPACE
Definition: cmdid.h:698
#define FN_UPDATE_ALL_LINKS
Definition: cmdid.h:129
#define FN_EDIT_REGION
Definition: cmdid.h:117
#define FN_TOOL_ANCHOR_CHAR
Definition: cmdid.h:267
#define FN_PAGE_STYLE_SET_NUMBER_FORMAT
Definition: cmdid.h:416
#define FN_UPDATE_FIELD
Definition: cmdid.h:330
#define FN_SHIFT_BACKSPACE
Definition: cmdid.h:713
#define FN_TOOL_ANCHOR_AT_CHAR
Definition: cmdid.h:295
#define FN_TOOL_ANCHOR_PARAGRAPH
Definition: cmdid.h:244
#define FN_PAGE_STYLE_SET_COLS
Definition: cmdid.h:417
#define FN_FORMAT_BORDER_DLG
Definition: cmdid.h:347
#define FN_FRAME_WRAPTHRU_TRANSP
Definition: cmdid.h:435
#define FN_XFORMS_DESIGN_MODE
Definition: cmdid.h:629
#define FN_FRAME_NOWRAP
Definition: cmdid.h:361
#define FN_CHANGE_DBFIELD
Definition: cmdid.h:212
#define FN_CONVERT_TABLE_TO_TEXT
Definition: cmdid.h:408
#define FN_FORMAT_PAGE_SETTING_DLG
Definition: cmdid.h:345
#define FN_EDIT_CURRENT_REGION
Definition: cmdid.h:119
#define FN_PAGE_STYLE_SET_PAPER_BIN
Definition: cmdid.h:415
#define FN_GOTO_NEXT_MARK
Definition: cmdid.h:748
#define FN_FORMAT_TITLEPAGE_DLG
Definition: cmdid.h:376
#define FN_PASTE_NESTED_TABLE
Definition: cmdid.h:321
#define FN_FRAME_WRAP_RIGHT
Definition: cmdid.h:446
#define FN_PREV_BOOKMARK
Definition: cmdid.h:123
#define FN_FORMAT_PAGE_COLUMN_DLG
Definition: cmdid.h:348
#define FN_REPAGINATE
Definition: cmdid.h:114
#define FN_UPDATE_FIELDS
Definition: cmdid.h:83
#define FN_WRAP_ANCHOR_ONLY
Definition: cmdid.h:448
#define FN_PAGE_STYLE_SET_UL_MARGIN
Definition: cmdid.h:413
#define FN_FRAME_WRAP
Definition: cmdid.h:362
#define FN_FRAME_TO_ANCHOR
Definition: cmdid.h:734
#define FN_FRAME_WRAPTHRU_TOGGLE
Definition: cmdid.h:434
#define FN_FORMAT_PAGE_DLG
Definition: cmdid.h:350
#define FN_CONVERT_TEXT_TABLE
Definition: cmdid.h:379
#define FN_FRAME_WRAP_CONTOUR
Definition: cmdid.h:453
#define FN_PAGE_STYLE_SET_PAPER_SIZE
Definition: cmdid.h:414
#define FN_GOTO_PREV_OBJ
Definition: cmdid.h:717
#define FN_NEXT_BOOKMARK
Definition: cmdid.h:122
#define FN_GOTO_PREV_MARK
Definition: cmdid.h:749
#define FN_FRAME_WRAPTHRU
Definition: cmdid.h:363
#define FN_TABLE_PASTE_ROW_BEFORE
Definition: cmdid.h:322
#define FN_FRAME_WRAP_LEFT
Definition: cmdid.h:445
#define FN_UPDATE_INPUTFIELDS
Definition: cmdid.h:104
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
int nCount
URL aURL
SFX_IMPL_SUPERCLASS_INTERFACE(DrawDocShell, SfxObjectShell)
#define CNT_GRF
Definition: editsh.hxx:132
FrameTypeFlags
values can be combined via logical or
Definition: fesh.hxx:63
@ Parent
Check only parents.
#define FONT_GROUP_CTL
Definition: fontcfg.hxx:48
#define FONT_GROUP_DEFAULT
Definition: fontcfg.hxx:46
#define FONT_STANDARD
Definition: fontcfg.hxx:27
#define FONT_GROUP_CJK
Definition: fontcfg.hxx:47
SotClipboardFormatId
GraphicType
SelectionType
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CTL_FONTSIZE(28)
constexpr TypedWhichId< SwFormatURL > RES_URL(117)
bool isCHRATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:468
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_FONTSIZE(8)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_WEIGHT(15)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CTL_LANGUAGE(29)
constexpr TypedWhichId< SwFormatHoriOrient > RES_HORI_ORIENT(109)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CJK_FONTSIZE(23)
constexpr TypedWhichId< SvxShadowItem > RES_SHADOW(113)
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(108)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(111)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
constexpr TypedWhichId< SvxOpaqueItem > RES_OPAQUE(105)
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_POSTURE(11)
constexpr TypedWhichId< SwFormatAnchor > RES_ANCHOR(110)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(112)
constexpr TypedWhichId< SwFormatRefMark > RES_TXTATR_REFMARK(RES_TXTATR_WITHEND_BEGIN)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
constexpr TypedWhichId< SwFormatSurround > RES_SURROUND(107)
HTMLMODE_SOME_STYLES
HTMLMODE_ON
HTMLMODE_FULL_STYLES
SVX_DLLPUBLIC SvxIMapDlg * GetIMapDlg()
::std::vector< OUString > TargetList
OUString aName
Mode eMode
SwInsertTableFlags
Definition: itabenum.hxx:26
sal_Int64 n
uno_Any a
#define LANGUAGE_SYSTEM
#define LANGUAGE_DONTKNOW
SvtScriptType
sal_uInt16 nPos
FlyMode
Definition: mdiexp.hxx:40
@ FLY_DRAG
Definition: mdiexp.hxx:40
@ FLY_DRAG_END
Definition: mdiexp.hxx:40
SvtScriptType GetScriptTypeOfLanguage(LanguageType nLang)
Shell * GetShell()
int i
css::uno::Reference< css::animations::XAnimationNode > Clone(const css::uno::Reference< css::animations::XAnimationNode > &xSourceNode, const SdPage *pSource=nullptr, const SdPage *pTarget=nullptr)
HashMap_OWString_Interface aMap
sal_Int16 nId
const char GetValue[]
SwMoveFnCollection const & fnTableStart
Definition: paminit.cxx:54
QPRO_FUNC_TYPE nType
static SfxItemSet & rSet
OUString aStrNone
Definition: shellres.hxx:46
sal_uInt16 mnRowsToRepeat
Definition: itabenum.hxx:41
SwInsertTableFlags mnInsMode
Definition: itabenum.hxx:40
Marks a position in the document model.
Definition: pam.hxx:38
SwNode & GetNode() const
Definition: pam.hxx:81
sal_Int32 GetContentIndex() const
Definition: pam.hxx:85
std::function< void(sal_Int32)> maEndDialogFn
Reference< XModel > xModel
PasteTableType
Definition: swdtflvr.hxx:69
RndStdIds
SwView * GetActiveView()
Definition: swmodul1.cxx:115
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:168
#define SW_MOD()
Definition: swmodule.hxx:254
constexpr SwTwips DEF_GUTTER_WIDTH
Definition: swtypes.hxx:65
SwUndoId
Definition: swundo.hxx:30
bool bVisible
bool GotoPrevTable(SwPaM &rCurrentCursor, SwMoveFnCollection const &fnPosTable, bool bInReadOnly)
Definition: trvltbl.cxx:481
unsigned char sal_uInt8
sal_uInt16 sal_Unicode
signed char sal_Int8
SW_DLLPUBLIC void PrepareBoxInfo(SfxItemSet &rSet, const SwWrtShell &rSh)
Definition: uitool.cxx:82
const sal_Unicode cDelim
SVXCORE_DLLPUBLIC std::unique_ptr< SvxBrushItem > getSvxBrushItemFromSourceSet(const SfxItemSet &rSourceSet, sal_uInt16 nBackgroundID, bool bSearchInParents=true, bool bXMLImportHack=false)
SVXCORE_DLLPUBLIC void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem &rBrush, SfxItemSet &rToSet)
RET_OK
ShellMode
Definition: view.hxx:87
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)
Definition: viewopt.cxx:415
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLUSESLIDEBACKGROUND)