LibreOffice Module sw (master) 1
frmsh.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
22#include <hintids.hxx>
23#include <svl/whiter.hxx>
24#include <sfx2/viewfrm.hxx>
25#include <basic/sbstar.hxx>
26#include <svl/ptitem.hxx>
27#include <svl/stritem.hxx>
28#include <svl/intitem.hxx>
29#include <svl/eitem.hxx>
30#include <editeng/colritem.hxx>
31#include <editeng/lineitem.hxx>
32#include <editeng/boxitem.hxx>
33#include <sfx2/dispatch.hxx>
34#include <sfx2/request.hxx>
35#include <sfx2/objface.hxx>
36#include <vcl/EnumContext.hxx>
37#include <svx/hlnkitem.hxx>
38#include <svx/svdview.hxx>
39#include <svx/sdangitm.hxx>
41#include <sal/log.hxx>
42
43#include <doc.hxx>
44#include <drawdoc.hxx>
47#include <fmturl.hxx>
48#include <fmtclds.hxx>
49#include <fmtcnct.hxx>
50#include <swmodule.hxx>
51#include <wrtsh.hxx>
52#include <wview.hxx>
53#include <uitool.hxx>
54#include <frmfmt.hxx>
55#include <frmsh.hxx>
56#include <frmmgr.hxx>
57#include <edtwin.hxx>
58#include <swdtflvr.hxx>
59#include <viewopt.hxx>
60
61#include <cmdid.h>
62#include <strings.hrc>
63#include <swabstdlg.hxx>
64
65#include <svx/svxdlg.hxx>
66
67#include <docsh.hxx>
68#include <svx/drawitem.hxx>
69#include <memory>
70
71#define ShellClass_SwFrameShell
72#include <sfx2/msg.hxx>
73#include <swslots.hxx>
74#include <grfatr.hxx>
75#include <fldmgr.hxx>
76#include <flyfrm.hxx>
77
78using ::editeng::SvxBorderLine;
79using namespace ::com::sun::star;
80using namespace ::com::sun::star::uno;
81
82// Prototypes
83static void lcl_FrameGetMaxLineWidth(const SvxBorderLine* pBorderLine, SvxBorderLine& rBorderLine);
84static const SwFrameFormat* lcl_GetFrameFormatByName(SwWrtShell const & rSh, std::u16string_view rName)
85{
86 const size_t nCount = rSh.GetFlyCount(FLYCNTTYPE_FRM);
87 for( size_t i = 0; i < nCount; ++i )
88 {
89 const SwFrameFormat* pFormat = rSh.GetFlyNum(i, FLYCNTTYPE_FRM);
90 if(pFormat->GetName() == rName)
91 return pFormat;
92 }
93 return nullptr;
94}
95
97
98void SwFrameShell::InitInterface_Impl()
99{
100 GetStaticInterface()->RegisterPopupMenu("frame");
101
102 GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT, SfxVisibilityFlags::Invisible, ToolbarId::Frame_Toolbox);
103}
104
106{
107 SwWrtShell& rSh = GetShell();
108 sal_uInt16 nSlot = rReq.GetSlot();
109 switch (nSlot)
110 {
111 case SID_SELECTALL:
112 rSh.SelAll();
113 rReq.Done();
114 break;
115 }
116}
117
119{
120 SwWrtShell& rSh = GetShell();
121 sal_uInt16 nSlot = rReq.GetSlot();
122 switch (nSlot)
123 {
124 case FN_POSTIT:
125 SwFieldMgr aFieldMgr(&rSh);
126 rSh.InsertPostIt(aFieldMgr, rReq);
127 break;
128 }
129}
130
132{
133 //First those who do not need FrameMgr.
134 SwWrtShell &rSh = GetShell();
135 bool bMore = false;
136 const SfxItemSet* pArgs = rReq.GetArgs();
137 const SfxPoolItem* pItem;
138 sal_uInt16 nSlot = rReq.GetSlot();
139
140 switch ( nSlot )
141 {
143 if ( rSh.IsFrameSelected() )
144 {
145 rSh.GotoFlyAnchor();
146 rSh.EnterStdMode();
147 rSh.CallChgLnk();
148 }
149 break;
150 case SID_FRAME_TO_TOP:
151 rSh.SelectionToTop();
152 break;
153
154 case SID_FRAME_TO_BOTTOM:
155 rSh.SelectionToBottom();
156 break;
157
158 case FN_FRAME_UP:
159 rSh.SelectionToTop( false );
160 break;
161
162 case FN_FRAME_DOWN:
163 rSh.SelectionToBottom( false );
164 break;
165 case FN_INSERT_FRAME:
166 if (!pArgs)
167 {
168 // Frame already exists, open frame dialog for editing.
169 SfxStringItem aDefPage(FN_FORMAT_FRAME_DLG, "columns");
172 SfxCallMode::SYNCHRON|SfxCallMode::RECORD,
173 { &aDefPage });
174
175 }
176 else
177 {
178 // Frame already exists, only the number of columns will be changed.
179 sal_uInt16 nCols = 1;
180 if(const SfxUInt16Item* pColsItem = pArgs->GetItemIfSet(SID_ATTR_COLUMNS, false))
181 nCols = pColsItem->GetValue();
182
184 rSh.GetFlyFrameAttr( aSet );
185 SwFormatCol aCol(aSet.Get(RES_COL));
186 // GutterWidth will not always passed, hence get firstly
187 // (see view2: Execute on this slot)
188 sal_uInt16 nGutterWidth = aCol.GetGutterWidth();
189 if(!nCols )
190 nCols++;
191 aCol.Init(nCols, nGutterWidth, aCol.GetWishWidth());
192 aSet.Put(aCol);
193 // Template AutoUpdate
194 SwFrameFormat* pFormat = rSh.GetSelectedFrameFormat();
195 if(pFormat && pFormat->IsAutoUpdateFormat())
196 {
197 rSh.AutoUpdateFrame(pFormat, aSet);
198 }
199 else
200 {
201 rSh.StartAllAction();
202 rSh.SetFlyFrameAttr( aSet );
203 rSh.SetModified();
204 rSh.EndAllAction();
205 }
206
207 }
208 return;
209
210 case SID_HYPERLINK_SETLINK:
211 {
212 if(pArgs && SfxItemState::SET == pArgs->GetItemState(SID_HYPERLINK_SETLINK, false, &pItem))
213 {
214 const SvxHyperlinkItem& rHLinkItem = *static_cast<const SvxHyperlinkItem *>(pItem);
215 const OUString& rURL = rHLinkItem.GetURL();
216 const OUString& rTarget = rHLinkItem.GetTargetFrame();
217
219 rSh.GetFlyFrameAttr( aSet );
220 SwFormatURL aURL( aSet.Get( RES_URL ) );
221
222 OUString sOldName(rHLinkItem.GetName().toAsciiUpperCase());
223 OUString sFlyName(rSh.GetFlyName().toAsciiUpperCase());
224 if (sOldName != sFlyName)
225 {
226 OUString sName(sOldName);
227 sal_uInt16 i = 1;
228 while (rSh.FindFlyByName(sName))
229 {
230 sName = sOldName + "_" + OUString::number(i++);
231 }
232 rSh.SetFlyName(sName);
233 }
234 aURL.SetURL( rURL, false );
235 aURL.SetTargetFrameName(rTarget);
236
237 aSet.Put( aURL );
238 rSh.SetFlyFrameAttr( aSet );
239 }
240 }
241 break;
242
243 case FN_FRAME_CHAIN:
245 break;
246
247 case FN_FRAME_UNCHAIN:
248 rSh.Unchain( *rSh.GetFlyFrameFormat() );
250 break;
252 {
254 break;
255 }
257 {
259 rReq.Done();
260 break;
261 }
262 case SID_OPEN_XML_FILTERSETTINGS:
263 {
265 }
266 break;
268 {
269 GetView().UpdateWordCount(this, nSlot);
270 break;
271 }
272 default: bMore = true;
273 }
274
275 if ( !bMore )
276 {
277 return;
278 }
279
280 SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE, nullptr );
281 bool bUpdateMgr = true;
282 bool bCopyToFormat = false;
283 switch ( nSlot )
284 {
285 case SID_OBJECT_ALIGN_MIDDLE:
287 aMgr.SetVertOrientation( text::VertOrientation::CENTER );
288 break;
289 case SID_OBJECT_ALIGN_DOWN :
291 aMgr.SetVertOrientation( text::VertOrientation::BOTTOM );
292 break;
293 case SID_OBJECT_ALIGN_UP :
295 aMgr.SetVertOrientation( text::VertOrientation::TOP );
296 break;
297
299 aMgr.SetVertOrientation( text::VertOrientation::CHAR_CENTER );
300 break;
301
303 aMgr.SetVertOrientation( text::VertOrientation::CHAR_BOTTOM );
304 break;
305
307 aMgr.SetVertOrientation( text::VertOrientation::CHAR_TOP );
308 break;
309
311 aMgr.SetVertOrientation( text::VertOrientation::LINE_CENTER );
312 break;
313
315 aMgr.SetVertOrientation( text::VertOrientation::LINE_BOTTOM );
316 break;
317
319 aMgr.SetVertOrientation( text::VertOrientation::LINE_TOP );
320 break;
321 case SID_OBJECT_ALIGN_CENTER :
323 aMgr.SetHorzOrientation( text::HoriOrientation::CENTER );
324 break;
325 case SID_OBJECT_ALIGN_RIGHT:
327 aMgr.SetHorzOrientation( text::HoriOrientation::RIGHT );
328 break;
329 case SID_OBJECT_ALIGN_LEFT:
331 aMgr.SetHorzOrientation( text::HoriOrientation::LEFT );
332 break;
333
335 {
336 aMgr.SetAbsPos(static_cast<const SfxPointItem &>(pArgs->Get
338 }
339 break;
340 case SID_ATTR_BRUSH:
341 {
342 if(pArgs)
343 {
344 aMgr.SetAttrSet( *pArgs );
345 bCopyToFormat = true;
346 }
347 }
348 break;
349 case SID_ATTR_ULSPACE:
350 case SID_ATTR_LRSPACE:
351 {
352 if(pArgs && SfxItemState::SET == pArgs->GetItemState(GetPool().GetWhich(nSlot), false, &pItem))
353 {
354 aMgr.SetAttrSet( *pArgs );
355 bCopyToFormat = true;
356 }
357 }
358 break;
359
360 case SID_ATTR_TRANSFORM:
361 {
362 bool bApplyNewPos = false;
363 bool bApplyNewSize = false;
364
365 Point aNewPos = aMgr.GetPos();
366 if (pArgs)
367 {
368 if (const SfxInt32Item* pXItem = pArgs->GetItemIfSet(SID_ATTR_TRANSFORM_POS_X, false))
369 {
370 aNewPos.setX( pXItem->GetValue() );
371 bApplyNewPos = true;
372 }
373 if (const SfxInt32Item* pYItem = pArgs->GetItemIfSet(SID_ATTR_TRANSFORM_POS_Y, false))
374 {
375 aNewPos.setY( pYItem->GetValue() );
376 bApplyNewPos = true;
377 }
378 }
379
380 Size aNewSize = aMgr.GetSize();
381 if (pArgs)
382 {
383 if (const SfxUInt32Item* pWidthItem = pArgs->GetItemIfSet(SID_ATTR_TRANSFORM_WIDTH, false))
384 {
385 aNewSize.setWidth( pWidthItem->GetValue() );
386 bApplyNewSize = true;
387 }
388 if (const SfxUInt32Item* pHeightItem = pArgs->GetItemIfSet(SID_ATTR_TRANSFORM_HEIGHT, false))
389 {
390 aNewSize.setHeight( pHeightItem->GetValue() );
391 bApplyNewSize = true;
392 }
393 }
394
395 if (pArgs && (pArgs->HasItem(SID_ATTR_TRANSFORM_ANGLE) || pArgs->HasItem(SID_ATTR_TRANSFORM_DELTA_ANGLE)))
396 {
398 rSh.GetCurAttr(aSet);
399 const SwRotationGrf& rRotation = aSet.Get(RES_GRFATR_ROTATION);
400 const Degree10 nOldRot(rRotation.GetValue());
401
402 if (const SdrAngleItem* pAngleItem = pArgs->GetItemIfSet(SID_ATTR_TRANSFORM_DELTA_ANGLE, false))
403 {
404 const Degree10 nDeltaRot = to<Degree10>(pAngleItem->GetValue());
405 aMgr.SetRotation(nOldRot, nOldRot + nDeltaRot, rRotation.GetUnrotatedSize());
406 }
407
408 // RotGrfFlyFrame: Get Value and disable is in SwGrfShell::GetAttrStateForRotation, but the
409 // value setter uses SID_ATTR_TRANSFORM and a group of three values. Rotation is
410 // added now, so use it in this central place. Do no forget to convert angle from
411 // 100th degrees in SID_ATTR_TRANSFORM_ANGLE to 10th degrees in RES_GRFATR_ROTATION
412 if (const SdrAngleItem* pTransformItem = pArgs->GetItemIfSet(SID_ATTR_TRANSFORM_ANGLE, false))
413 {
414 const Degree10 nNewRot = to<Degree10>(pTransformItem->GetValue());
415
416 // RotGrfFlyFrame: Rotation change here, SwFlyFrameAttrMgr aMgr is available
417 aMgr.SetRotation(nOldRot, nNewRot, rRotation.GetUnrotatedSize());
418 }
419 }
420
421 if (bApplyNewPos)
422 {
423 aMgr.SetAbsPos(aNewPos);
424 }
425 if ( bApplyNewSize )
426 {
427 aMgr.SetSize( aNewSize );
428 }
429 if (!bApplyNewPos && !bApplyNewSize)
430 {
431 bUpdateMgr = false;
432 }
433
434 }
435 break;
436
438 case FN_DRAW_WRAP_DLG:
439 {
440 const SelectionType nSel = rSh.GetSelectionType();
441 if (nSel & SelectionType::Graphic)
442 {
444 bUpdateMgr = false;
445 }
446 else
447 {
450 // FillAttribute support:
452 SID_DOCFRAME, SID_DOCFRAME,
453 SID_ATTR_BRUSH, SID_ATTR_BRUSH,
454 SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
455 SID_ATTR_LRSPACE, SID_ATTR_ULSPACE,
456 SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
457 // Items to hand over XPropertyList things like
458 // XColorList, XHatchList, XGradientList, and
459 // XBitmapList to the Area TabPage
460 SID_COLOR_TABLE, SID_PATTERN_LIST,
461 SID_HTML_MODE, SID_HTML_MODE,
468
469 // create needed items for XPropertyList entries from the DrawModel so that
470 // the Area TabPage can access them
472 pDrawModel->PutAreaListItems(aSet);
473
474 const SwViewOption* pVOpt = rSh.GetViewOptions();
475 if(nSel & SelectionType::Ole)
476 aSet.Put( SfxBoolItem(FN_KEEP_ASPECT_RATIO, pVOpt->IsKeepRatio()) );
477 aSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell())));
478 aSet.Put(SfxStringItem(FN_SET_FRM_NAME, rSh.GetFlyName()));
480 if( nSel & SelectionType::Ole )
481 {
482 // #i73249#
483 aSet.Put( SfxStringItem( FN_SET_FRM_ALT_NAME, rSh.GetObjTitle() ) );
484 }
485
486 const SwRect &rPg = rSh.GetAnyCurRect(CurRectType::Page);
487 SwFormatFrameSize aFrameSize(SwFrameSize::Variable, rPg.Width(), rPg.Height());
488 aFrameSize.SetWhich(GetPool().GetWhich(SID_ATTR_PAGE_SIZE));
489 aSet.Put(aFrameSize);
490
491 const SwRect &rPr = rSh.GetAnyCurRect(CurRectType::PagePrt);
492 SwFormatFrameSize aPrtSize(SwFrameSize::Variable, rPr.Width(), rPr.Height());
493 aPrtSize.SetWhich(GetPool().GetWhich(FN_GET_PRINT_AREA));
494 aSet.Put(aPrtSize);
495
496 aSet.Put(aMgr.GetAttrSet());
497 aSet.SetParent( aMgr.GetAttrSet().GetParent() );
498
499 // On % values initialize size
500 SwFormatFrameSize& rSize = const_cast<SwFormatFrameSize&>(aSet.Get(RES_FRM_SIZE));
505
506 // disable vertical positioning for Math Objects anchored 'as char' if baseline alignment is activated
509 const uno::Reference < embed::XEmbeddedObject > xObj( rSh.GetOleRef() );
510 aSet.Put( SfxBoolItem( FN_OLE_IS_MATH, xObj.is() && SotExchange::IsMath( xObj->getClassID() ) ) );
511
512 OString sDefPage;
513 const SfxStringItem* pDlgItem;
514 if(pArgs && (pDlgItem = pArgs->GetItemIfSet(FN_FORMAT_FRAME_DLG, false)))
515 sDefPage = OUStringToOString(pDlgItem->GetValue(), RTL_TEXTENCODING_UTF8);
516
517 aSet.Put(SfxFrameItem( SID_DOCFRAME, &GetView().GetViewFrame()->GetFrame()));
518 FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( &GetView()) != nullptr );
519 SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric) ));
522 nSel & SelectionType::Graphic ? OUString("PictureDialog") :
523 nSel & SelectionType::Ole ? OUString("ObjectDialog"):
524 OUString("FrameDialog"),
525 GetView().GetViewFrame(),
527 aSet,
528 false,
529 sDefPage));
530
531 if ( nSlot == FN_DRAW_WRAP_DLG )
532 {
533 pDlg->SetCurPageId("wrap");
534 }
535
536 if ( pDlg->Execute() )
537 {
538 const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
539 if(pOutSet)
540 {
541 rReq.Done(*pOutSet);
542 const SfxBoolItem* pRatioItem = nullptr;
543 if(nSel & SelectionType::Ole &&
544 (pRatioItem = pOutSet->GetItemIfSet(FN_KEEP_ASPECT_RATIO)))
545 {
546 SwViewOption aUsrPref( *pVOpt );
547 aUsrPref.SetKeepRatio(pRatioItem->GetValue());
548 SW_MOD()->ApplyUsrPref(aUsrPref, &GetView());
549 }
550 if (const SfxStringItem* pAltNameItem = pOutSet->GetItemIfSet(FN_SET_FRM_ALT_NAME))
551 {
552 // #i73249#
553 rSh.SetObjTitle(pAltNameItem->GetValue());
554 }
555 if (const SfxStringItem* pDescripItem = pOutSet->GetItemIfSet(FN_UNO_DESCRIPTION))
556 rSh.SetObjDescription(pDescripItem->GetValue());
557
558 // Template AutoUpdate
559 SwFrameFormat* pFormat = rSh.GetSelectedFrameFormat();
560 if(pFormat && pFormat->IsAutoUpdateFormat())
561 {
562 rSh.AutoUpdateFrame(pFormat, *pOutSet);
563 // Anything which is not supported by the format must be set hard.
564 if(const SfxStringItem* pFrameName = pOutSet->GetItemIfSet(FN_SET_FRM_NAME, false))
565 rSh.SetFlyName(pFrameName->GetValue());
568 RES_SURROUND, RES_ANCHOR> aShellSet( GetPool() );
569 aShellSet.Put(*pOutSet);
570 aMgr.SetAttrSet(aShellSet);
571 if(const SfxStringItem* pFrameName = pOutSet->GetItemIfSet(FN_SET_FRM_NAME, false))
572 rSh.SetFlyName(pFrameName->GetValue());
573 }
574 else
575 aMgr.SetAttrSet( *pOutSet );
576
577 const SwFrameFormat* pCurrFlyFormat = rSh.GetFlyFrameFormat();
578 if(const SfxStringItem* pPreviousItem =
579 pOutSet->GetItemIfSet(FN_PARAM_CHAIN_PREVIOUS, false))
580 {
581 rSh.HideChainMarker();
582
583 OUString sPrevName = pPreviousItem->GetValue();
584 const SwFormatChain &rChain = pCurrFlyFormat->GetChain();
585 //needs cast - no non-const method available
586 SwFlyFrameFormat* pFlyFormat =
587 rChain.GetPrev();
588 if(pFlyFormat)
589 {
590 if (pFlyFormat->GetName() != sPrevName)
591 {
592 rSh.Unchain(*pFlyFormat);
593 }
594 else
595 sPrevName.clear();
596 }
597
598 if (!sPrevName.isEmpty())
599 {
600 //needs cast - no non-const method available
601 SwFrameFormat* pPrevFormat = const_cast<SwFrameFormat*>(
602 lcl_GetFrameFormatByName(rSh, sPrevName));
603 SAL_WARN_IF(!pPrevFormat, "sw.ui", "No frame found!");
604 if(pPrevFormat)
605 {
606 rSh.Chain(*pPrevFormat, *pCurrFlyFormat);
607 }
608 }
609 rSh.SetChainMarker();
610 }
611 if(const SfxStringItem* pChainNextItem =
612 pOutSet->GetItemIfSet(FN_PARAM_CHAIN_NEXT, false))
613 {
614 rSh.HideChainMarker();
615 OUString sNextName = pChainNextItem->GetValue();
616 const SwFormatChain &rChain = pCurrFlyFormat->GetChain();
617 //needs cast - no non-const method available
618 SwFlyFrameFormat* pFlyFormat =
619 rChain.GetNext();
620 if(pFlyFormat)
621 {
622 if (pFlyFormat->GetName() != sNextName)
623 {
624 rSh.Unchain(*const_cast<SwFlyFrameFormat*>(static_cast<const SwFlyFrameFormat*>( pCurrFlyFormat)));
625 }
626 else
627 sNextName.clear();
628 }
629
630 if (!sNextName.isEmpty())
631 {
632 //needs cast - no non-const method available
633 SwFrameFormat* pNextFormat = const_cast<SwFrameFormat*>(
634 lcl_GetFrameFormatByName(rSh, sNextName));
635 SAL_WARN_IF(!pNextFormat, "sw.ui", "No frame found!");
636 if(pNextFormat)
637 {
638 rSh.Chain(*const_cast<SwFrameFormat*>(
639 pCurrFlyFormat), *pNextFormat);
640 }
641 }
642 rSh.SetChainMarker();
643 }
644 }
645 }
646 else
647 bUpdateMgr = false;
648 }
649 }
650 break;
652 {
653 SwFormatHoriOrient aHori(aMgr.GetHoriOrient());
654 bool bMirror = !aHori.IsPosToggle();
655 aHori.SetPosToggle(bMirror);
657 aSet.Put(aHori);
658 aMgr.SetAttrSet(aSet);
659 bCopyToFormat = true;
660 rReq.SetReturnValue(SfxBoolItem(nSlot, bMirror));
661 }
662 break;
663 case FN_NAME_SHAPE:
664 {
665 bUpdateMgr = false;
666 SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList();
667 if ( pSdrView &&
668 pSdrView->GetMarkedObjectCount() == 1 )
669 {
670 OUString aName(rSh.GetFlyName());
674
675 if ( pDlg->Execute() == RET_OK )
676 {
677 pDlg->GetName(aName);
678 rSh.SetFlyName(aName);
679 }
680 }
681 }
682 break;
683 // #i73249#
685 {
686 bUpdateMgr = false;
687 SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList();
688 if ( pSdrView &&
689 pSdrView->GetMarkedObjectCount() == 1 )
690 {
691 OUString aDescription(rSh.GetObjDescription());
692 OUString aTitle(rSh.GetObjTitle());
693
697 aTitle, aDescription ));
698
699 if ( pDlg->Execute() == RET_OK )
700 {
701 pDlg->GetDescription(aDescription);
702 pDlg->GetTitle(aTitle);
703
704 rSh.SetObjDescription(aDescription);
705 rSh.SetObjTitle(aTitle);
706 }
707 }
708 }
709 break;
710 default:
711 assert(!"wrong dispatcher");
712 return;
713 }
714 if ( bUpdateMgr )
715 {
716 SwFrameFormat* pFormat = rSh.GetSelectedFrameFormat();
717 if ( bCopyToFormat && pFormat && pFormat->IsAutoUpdateFormat() )
718 {
719 rSh.AutoUpdateFrame(pFormat, aMgr.GetAttrSet());
720 }
721 else
722 {
723 aMgr.UpdateFlyFrame();
724 }
725 }
726
727}
728
730{
731 SwWrtShell &rSh = GetShell();
732 bool bHtmlMode = 0 != ::GetHtmlMode(rSh.GetView().GetDocShell());
733 if (!rSh.IsFrameSelected())
734 return;
735
739 rSh.GetFlyFrameAttr( aSet );
740
743
744 bProtect |= bParentCntProt;
745
746 const FrameTypeFlags eFrameType = rSh.GetFrameType(nullptr,true);
747 SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE, nullptr );
748
749 SfxWhichIter aIter( rSet );
750 sal_uInt16 nWhich = aIter.FirstWhich();
751 while ( nWhich )
752 {
753 switch ( nWhich )
754 {
755 case RES_FRM_SIZE:
756 {
757 const SwFormatFrameSize& aSz(aMgr.GetFrameSize());
758 rSet.Put(aSz);
759 }
760 break;
761 case RES_VERT_ORIENT:
762 case RES_HORI_ORIENT:
763 case SID_ATTR_ULSPACE:
764 case SID_ATTR_LRSPACE:
765 case RES_LR_SPACE:
766 case RES_UL_SPACE:
767 case RES_PROTECT:
768 case RES_OPAQUE:
769 case RES_PRINT:
770 case RES_SURROUND:
771 {
772 rSet.Put(aSet.Get(GetPool().GetWhich(nWhich)));
773 }
774 break;
775 case SID_OBJECT_ALIGN:
776 {
777 if ( bProtect )
778 rSet.DisableItem( nWhich );
779 }
780 break;
781 case SID_OBJECT_ALIGN_LEFT :
782 case SID_OBJECT_ALIGN_CENTER :
783 case SID_OBJECT_ALIGN_RIGHT :
787 if ( (eFrameType & FrameTypeFlags::FLY_INCNT) ||
788 bProtect ||
789 ((nWhich == FN_FRAME_ALIGN_HORZ_CENTER || nWhich == SID_OBJECT_ALIGN_CENTER) &&
790 bHtmlMode ))
791 {
792 rSet.DisableItem( nWhich );
793 }
794 else
795 {
796 sal_Int16 nHoriOrient = -1;
797 switch(nWhich)
798 {
799 case SID_OBJECT_ALIGN_LEFT:
800 nHoriOrient = text::HoriOrientation::LEFT;
801 break;
802 case SID_OBJECT_ALIGN_CENTER:
803 nHoriOrient = text::HoriOrientation::CENTER;
804 break;
805 case SID_OBJECT_ALIGN_RIGHT:
806 nHoriOrient = text::HoriOrientation::RIGHT;
807 break;
808 default:
809 break;
810 }
811 SwFormatHoriOrient aHOrient(aMgr.GetHoriOrient());
812 if (nHoriOrient != -1)
813 rSet.Put(SfxBoolItem(nWhich, nHoriOrient == aHOrient.GetHoriOrient()));
814 }
815 break;
822 if ( !(eFrameType & FrameTypeFlags::FLY_INCNT) || bProtect
823 || (bHtmlMode && FN_FRAME_ALIGN_VERT_CHAR_BOTTOM == nWhich) )
824 rSet.DisableItem( nWhich );
825 break;
826
827 case SID_OBJECT_ALIGN_UP :
828 case SID_OBJECT_ALIGN_MIDDLE :
829 case SID_OBJECT_ALIGN_DOWN :
830
834 if ( bProtect || (bHtmlMode && eFrameType & FrameTypeFlags::FLY_ATCNT))
835 rSet.DisableItem( nWhich );
836 else
837 {
838 // These slots need different labels depending on whether they are anchored in a character
839 // or on a paragraph/page etc.
840 OUString sNewLabel;
841 if (eFrameType & FrameTypeFlags::FLY_INCNT)
842 {
843 switch (nWhich)
844 {
845 case SID_OBJECT_ALIGN_UP :
847 sNewLabel = SwResId(STR_FRMUI_TOP_BASE);
848 break;
849 case SID_OBJECT_ALIGN_MIDDLE :
851 sNewLabel = SwResId(STR_FRMUI_CENTER_BASE);
852 break;
853 case SID_OBJECT_ALIGN_DOWN :
855 if(!bHtmlMode)
856 sNewLabel = SwResId(STR_FRMUI_BOTTOM_BASE);
857 else
858 rSet.DisableItem( nWhich );
859 break;
860 }
861 }
862 else
863 {
864 if (nWhich != FN_FRAME_ALIGN_VERT_TOP &&
865 nWhich != SID_OBJECT_ALIGN_UP )
866 {
867 if (aMgr.GetAnchor() == RndStdIds::FLY_AT_FLY)
868 {
869 const SwFrameFormat* pFormat = rSh.IsFlyInFly();
870 if (pFormat)
871 {
872 const SwFormatFrameSize& rFrameSz = pFormat->GetFrameSize();
873 if (rFrameSz.GetHeightSizeType() != SwFrameSize::Fixed)
874 {
875 rSet.DisableItem( nWhich );
876 break;
877 }
878 }
879 }
880 }
881 OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(GetFrame()->GetFrame().GetFrameInterface()));
882 switch (nWhich)
883 {
884 case SID_OBJECT_ALIGN_UP :
886 {
887 auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:AlignTop", aModuleName);
889 break;
890 }
891 case SID_OBJECT_ALIGN_MIDDLE:
893 {
894 auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:AlignVerticalCenter", aModuleName);
896 break;
897 }
898 case SID_OBJECT_ALIGN_DOWN:
900 {
901 auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:AlignBottom", aModuleName);
903 break;
904 }
905 }
906 }
907 if ( !sNewLabel.isEmpty() )
908 rSet.Put( SfxStringItem( nWhich, sNewLabel ));
909 }
910 break;
911 case SID_HYPERLINK_GETLINK:
912 {
913 SvxHyperlinkItem aHLinkItem;
914
916 rSh.GetFlyFrameAttr( aURLSet );
917
918 if(const SwFormatURL* pFormatURL = aURLSet.GetItemIfSet(RES_URL))
919 {
920 aHLinkItem.SetURL(pFormatURL->GetURL());
921 aHLinkItem.SetTargetFrame(pFormatURL->GetTargetFrameName());
922 aHLinkItem.SetName(rSh.GetFlyName());
923 }
924
925 aHLinkItem.SetInsertMode(static_cast<SvxLinkInsertMode>(aHLinkItem.GetInsertMode() |
926 (bHtmlMode ? HLINK_HTMLMODE : 0)));
927
928 rSet.Put(aHLinkItem);
929 }
930 break;
931
932 case FN_FRAME_CHAIN:
933 {
934 const SelectionType nSel = rSh.GetSelectionType();
935 if (nSel & SelectionType::Graphic || nSel & SelectionType::Ole)
937 else
938 {
939 const SwFrameFormat *pFormat = rSh.GetFlyFrameFormat();
940 if ( bParentCntProt || rSh.GetView().GetEditWin().GetApplyTemplate() ||
941 !pFormat || pFormat->GetChain().GetNext() )
942 {
944 }
945 else
946 {
947 bool bChainMode = rSh.GetView().GetEditWin().IsChainMode();
948 rSet.Put( SfxBoolItem( FN_FRAME_CHAIN, bChainMode ) );
949 }
950 }
951 }
952 break;
953 case FN_FRAME_UNCHAIN:
954 {
955 const SelectionType nSel = rSh.GetSelectionType();
956 if (nSel & SelectionType::Graphic || nSel & SelectionType::Ole)
958 else
959 {
960 const SwFrameFormat *pFormat = rSh.GetFlyFrameFormat();
961 if ( bParentCntProt || rSh.GetView().GetEditWin().GetApplyTemplate() ||
962 !pFormat || !pFormat->GetChain().GetNext() )
963 {
965 }
966 }
967 }
968 break;
969 case SID_FRAME_TO_TOP:
970 case SID_FRAME_TO_BOTTOM:
971 case FN_FRAME_UP:
972 case FN_FRAME_DOWN:
973 if ( bParentCntProt )
974 rSet.DisableItem( nWhich );
975 break;
976
977 case SID_ATTR_TRANSFORM:
978 {
979 rSet.DisableItem( nWhich );
980 }
981 break;
982
983 case SID_ATTR_TRANSFORM_PROTECT_SIZE:
984 {
986 if ( ( eProtection & FlyProtectFlags::Content ) ||
987 ( eProtection & FlyProtectFlags::Size ) )
988 {
989 rSet.Put( SfxBoolItem( SID_ATTR_TRANSFORM_PROTECT_SIZE, true ) );
990 }
991 else
992 {
993 rSet.Put( SfxBoolItem( SID_ATTR_TRANSFORM_PROTECT_SIZE, false ) );
994 }
995 }
996 break;
997
998 case SID_ATTR_TRANSFORM_WIDTH:
999 {
1000 rSet.Put( SfxUInt32Item( SID_ATTR_TRANSFORM_WIDTH, aMgr.GetSize().getWidth() ) );
1001 }
1002 break;
1003
1004 case SID_ATTR_TRANSFORM_HEIGHT:
1005 {
1006 rSet.Put( SfxUInt32Item( SID_ATTR_TRANSFORM_HEIGHT, aMgr.GetSize().getHeight() ) );
1007 }
1008 break;
1009
1011 {
1012 const SelectionType nSel = rSh.GetSelectionType();
1013 if ( bParentCntProt || nSel & SelectionType::Graphic)
1014 rSet.DisableItem( nWhich );
1015 }
1016 break;
1017 // #i73249#
1019 case FN_NAME_SHAPE:
1020 {
1021 SwWrtShell &rWrtSh = GetShell();
1022 SdrView* pSdrView = rWrtSh.GetDrawViewWithValidMarkList();
1023 if ( !pSdrView ||
1024 pSdrView->GetMarkedObjectCount() != 1 )
1025 {
1026 rSet.DisableItem( nWhich );
1027 }
1028 }
1029 break;
1030
1031 case FN_POSTIT:
1032 {
1033 SwFlyFrame* pFly = rSh.GetSelectedFlyFrame();
1034 if (pFly)
1035 {
1036 SwFrameFormat* pFormat = pFly->GetFormat();
1037 if (pFormat)
1038 {
1039 RndStdIds eAnchorId = pFormat->GetAnchor().GetAnchorId();
1040 // SwWrtShell::InsertPostIt() only works on as-char and at-char anchored
1041 // images.
1042 if (eAnchorId != RndStdIds::FLY_AS_CHAR && eAnchorId != RndStdIds::FLY_AT_CHAR)
1043 {
1044 rSet.DisableItem(nWhich);
1045 }
1046 }
1047 }
1048 }
1049 break;
1050
1051 default:
1052 /* do nothing */;
1053 break;
1054 }
1055 nWhich = aIter.NextWhich();
1056 }
1057}
1058
1060 SwBaseShell( _rView )
1061{
1062 SetName("Frame");
1063
1064 // #96392# Use this to announce it is the frame shell who creates the selection.
1066
1068}
1069
1071{
1072 // #96392# Only clear the selection if it was this frame shell who created it.
1074}
1075
1077{
1078 SwWrtShell &rSh = GetShell();
1079 bool bDefault = false;
1080 if (!rSh.IsFrameSelected())
1081 return;
1082 // At first pick the default BoxItem out of the pool.
1083 // If unequal to regular box item, then it has already
1084 // been changed (New one is no default).
1085 const SvxBoxItem* pPoolBoxItem = ::GetDfltAttr(RES_BOX);
1086
1087 const SfxItemSet *pArgs = rReq.GetArgs();
1089
1090 rSh.GetFlyFrameAttr( aFrameSet );
1091 const SvxBoxItem& rBoxItem = aFrameSet.Get(RES_BOX);
1092
1093 if (pPoolBoxItem == &rBoxItem)
1094 bDefault = true;
1095
1096 std::unique_ptr<SvxBoxItem> aBoxItem(rBoxItem.Clone());
1097
1098 SvxBorderLine aBorderLine;
1099
1100 if(pArgs) // Any controller can sometimes deliver nothing #48169#
1101 {
1102 switch (rReq.GetSlot())
1103 {
1104 case SID_ATTR_BORDER:
1105 {
1106 if (const SvxBoxItem* pBoxItem = pArgs->GetItemIfSet(RES_BOX))
1107 {
1108 std::unique_ptr<SvxBoxItem> aNewBox(pBoxItem->Clone());
1109 const SvxBorderLine* pBorderLine;
1110
1111 pBorderLine = aBoxItem->GetTop();
1112 if (pBorderLine != nullptr)
1113 lcl_FrameGetMaxLineWidth(pBorderLine, aBorderLine);
1114 pBorderLine = aBoxItem->GetBottom();
1115 if (pBorderLine != nullptr)
1116 lcl_FrameGetMaxLineWidth(pBorderLine, aBorderLine);
1117 pBorderLine = aBoxItem->GetLeft();
1118 if (pBorderLine != nullptr)
1119 lcl_FrameGetMaxLineWidth(pBorderLine, aBorderLine);
1120 pBorderLine = aBoxItem->GetRight();
1121 if (pBorderLine != nullptr)
1122 lcl_FrameGetMaxLineWidth(pBorderLine, aBorderLine);
1123
1124 if(aBorderLine.GetOutWidth() == 0)
1125 {
1126 aBorderLine.SetBorderLineStyle(
1127 SvxBorderLineStyle::SOLID);
1128 aBorderLine.SetWidth( SvxBorderLineWidth::Hairline );
1129 }
1130 //Set distance only if the request is received from the controller.
1131
1132#if HAVE_FEATURE_SCRIPTING
1134#endif
1135 {
1136 // TODO: should this copy 4 individual Dist instead?
1137 aNewBox->SetAllDistances(rBoxItem.GetSmallestDistance());
1138 }
1139
1140 aBoxItem = std::move(aNewBox);
1141
1142 if( aBoxItem->GetTop() != nullptr )
1143 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::TOP);
1144 if( aBoxItem->GetBottom() != nullptr )
1145 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM);
1146 if( aBoxItem->GetLeft() != nullptr )
1147 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::LEFT);
1148 if( aBoxItem->GetRight() != nullptr )
1149 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::RIGHT);
1150 }
1151 }
1152 break;
1153
1154 case SID_FRAME_LINESTYLE:
1155 {
1156 if ( const SvxLineItem* pLineItem = pArgs->GetItemIfSet(SID_FRAME_LINESTYLE, false))
1157 {
1158 if ( pLineItem->GetLine() )
1159 {
1160 aBorderLine = *(pLineItem->GetLine());
1161
1162 if (!aBoxItem->GetTop() && !aBoxItem->GetBottom() &&
1163 !aBoxItem->GetLeft() && !aBoxItem->GetRight())
1164 {
1165 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::TOP);
1166 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM);
1167 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::LEFT);
1168 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::RIGHT);
1169 }
1170 else
1171 {
1172 if( aBoxItem->GetTop() )
1173 {
1174 aBorderLine.SetColor( aBoxItem->GetTop()->GetColor() );
1175 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::TOP);
1176 }
1177 if( aBoxItem->GetBottom() )
1178 {
1179 aBorderLine.SetColor( aBoxItem->GetBottom()->GetColor());
1180 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM);
1181 }
1182 if( aBoxItem->GetLeft() )
1183 {
1184 aBorderLine.SetColor( aBoxItem->GetLeft()->GetColor());
1185 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::LEFT);
1186 }
1187 if( aBoxItem->GetRight() )
1188 {
1189 aBorderLine.SetColor(aBoxItem->GetRight()->GetColor());
1190 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::RIGHT);
1191 }
1192 }
1193 }
1194 else
1195 {
1196 aBoxItem->SetLine(nullptr, SvxBoxItemLine::TOP);
1197 aBoxItem->SetLine(nullptr, SvxBoxItemLine::BOTTOM);
1198 aBoxItem->SetLine(nullptr, SvxBoxItemLine::LEFT);
1199 aBoxItem->SetLine(nullptr, SvxBoxItemLine::RIGHT);
1200 }
1201 }
1202 }
1203 break;
1204
1205 case SID_FRAME_LINECOLOR:
1206 {
1207 if (const SvxColorItem* pColorItem = pArgs->GetItemIfSet(SID_FRAME_LINECOLOR, false))
1208 {
1209 const Color& rNewColor = pColorItem->GetValue();
1210
1211 if (!aBoxItem->GetTop() && !aBoxItem->GetBottom() &&
1212 !aBoxItem->GetLeft() && !aBoxItem->GetRight())
1213 {
1214 aBorderLine.SetColor( rNewColor );
1215 aBorderLine.SetBorderLineStyle(SvxBorderLineStyle::SOLID);
1216 aBorderLine.SetWidth(SvxBorderLineWidth::Hairline);
1217
1218 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::TOP);
1219 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM);
1220 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::LEFT);
1221 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::RIGHT);
1222 }
1223 else
1224 {
1225 if ( aBoxItem->GetTop() )
1226 const_cast<SvxBorderLine*>(aBoxItem->GetTop())->SetColor( rNewColor );
1227 if ( aBoxItem->GetBottom() )
1228 const_cast<SvxBorderLine*>(aBoxItem->GetBottom())->SetColor( rNewColor );
1229 if ( aBoxItem->GetLeft() )
1230 const_cast<SvxBorderLine*>(aBoxItem->GetLeft())->SetColor( rNewColor );
1231 if ( aBoxItem->GetRight() )
1232 const_cast<SvxBorderLine*>(aBoxItem->GetRight())->SetColor( rNewColor );
1233 }
1234 }
1235 }
1236 break;
1237 }
1238 }
1239 if (bDefault && (aBoxItem->GetTop() || aBoxItem->GetBottom() ||
1240 aBoxItem->GetLeft() || aBoxItem->GetRight()))
1241 {
1242 aBoxItem->SetAllDistances(MIN_BORDER_DIST);
1243 }
1244 aFrameSet.Put( std::move(aBoxItem) );
1245 // Template AutoUpdate
1246 SwFrameFormat* pFormat = rSh.GetSelectedFrameFormat();
1247 if(pFormat && pFormat->IsAutoUpdateFormat())
1248 {
1249 rSh.AutoUpdateFrame(pFormat, aFrameSet);
1250 }
1251 else
1252 rSh.SetFlyFrameAttr( aFrameSet );
1253
1254}
1255
1256static void lcl_FrameGetMaxLineWidth(const SvxBorderLine* pBorderLine, SvxBorderLine& rBorderLine)
1257{
1258 if(pBorderLine->GetWidth() > rBorderLine.GetWidth())
1259 rBorderLine.SetWidth(pBorderLine->GetWidth());
1260
1261 rBorderLine.SetBorderLineStyle(pBorderLine->GetBorderLineStyle());
1262 rBorderLine.SetColor(pBorderLine->GetColor());
1263}
1264
1266{
1267 SwWrtShell &rSh = GetShell();
1269
1270 if (bParentCntProt)
1271 {
1272 if (rSh.IsFrameSelected())
1273 rSet.DisableItem( SID_FRAME_LINECOLOR );
1274
1275 rSet.DisableItem( SID_ATTR_BORDER );
1276 rSet.DisableItem( SID_FRAME_LINESTYLE );
1277 }
1278 else
1279 {
1280 if (rSh.IsFrameSelected())
1281 {
1283
1284 rSh.GetFlyFrameAttr(aFrameSet);
1285
1286 const SvxBorderLine* pLine = aFrameSet.Get(RES_BOX).GetTop();
1287 rSet.Put(SvxColorItem(pLine ? pLine->GetColor() : Color(), SID_FRAME_LINECOLOR));
1288 }
1289 }
1290}
1291
1293{
1294 const SelectionType nSel = GetShell().GetSelectionType();
1295 if ( (nSel & SelectionType::Graphic)
1296 || (nSel & SelectionType::Ole) )
1297 {
1299 }
1300 else if ( GetShell().CursorInsideInputField() )
1301 {
1303 }
1304}
1305
1307{
1308 SwWrtShell &rSh = GetShell();
1309
1310 if(rSh.IsFrameSelected())
1311 {
1312 rSh.GetFlyFrameAttr(rSet);
1313 }
1314 else
1315 {
1316 SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList();
1317
1318 if(pSdrView)
1319 {
1320 rSet.Put(pSdrView->GetDefaultAttr());
1321 }
1322 }
1323}
1324
1326{
1327 const SfxItemSet* pArgs = rReq.GetArgs();
1328 SwWrtShell& rSh = GetShell();
1329
1330 if(pArgs)
1331 {
1332 if(rSh.IsFrameSelected())
1333 {
1334 rSh.SetFlyFrameAttr(const_cast< SfxItemSet& >(*pArgs));
1335 }
1336 else
1337 {
1338 SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList();
1339
1340 if(pSdrView)
1341 {
1342 pSdrView->SetDefaultAttr(*pArgs, false);
1343 }
1344 }
1345 }
1346 else
1347 {
1349
1350 switch(rReq.GetSlot())
1351 {
1352 case SID_ATTR_FILL_STYLE:
1353 case SID_ATTR_FILL_COLOR:
1354 case SID_ATTR_FILL_GRADIENT:
1355 case SID_ATTR_FILL_HATCH:
1356 case SID_ATTR_FILL_BITMAP:
1357 case SID_ATTR_FILL_TRANSPARENCE:
1358 case SID_ATTR_FILL_FLOATTRANSPARENCE:
1359 {
1360 pDis->Execute(SID_ATTRIBUTES_AREA);
1361 break;
1362 }
1363 }
1364 }
1365}
1366
1368{
1369 switch(rReq.GetSlot())
1370 {
1371 case SID_ATTRIBUTES_AREA:
1372 {
1373 SwWrtShell& rSh = GetShell();
1374
1375 if(rSh.IsFrameSelected())
1376 {
1377 SdrModel* pDoc = rSh.GetDrawView()->GetModel();
1378 SfxItemSet aNewAttr(pDoc->GetItemPool());
1379
1380 // get attributes from FlyFrame
1381 rSh.GetFlyFrameAttr(aNewAttr);
1382
1386 &aNewAttr,
1387 pDoc,
1388 false,
1389 false));
1390
1391 pDlg->StartExecuteAsync([pDlg, this](sal_Int32 nResult){
1392 if(nResult == RET_OK)
1393 {
1394 // set attributes at FlyFrame
1395 GetShell().SetFlyFrameAttr(const_cast< SfxItemSet& >(*pDlg->GetOutputItemSet()));
1396
1397 static sal_uInt16 aInval[] =
1398 {
1399 SID_ATTR_FILL_STYLE,
1400 SID_ATTR_FILL_COLOR,
1401 SID_ATTR_FILL_TRANSPARENCE,
1402 SID_ATTR_FILL_FLOATTRANSPARENCE,
1403 0
1404 };
1405
1407
1408 rBnd.Invalidate(aInval);
1409 rBnd.Update(SID_ATTR_FILL_STYLE);
1410 rBnd.Update(SID_ATTR_FILL_COLOR);
1411 rBnd.Update(SID_ATTR_FILL_TRANSPARENCE);
1412 rBnd.Update(SID_ATTR_FILL_FLOATTRANSPARENCE);
1413 }
1414 pDlg->disposeOnce();
1415 });
1416 }
1417
1418 break;
1419 }
1420 }
1421}
1422
1424{
1425 SfxWhichIter aIter(rSet);
1426 sal_uInt16 nWhich(aIter.FirstWhich());
1427
1428 while(nWhich)
1429 {
1430 switch(nWhich)
1431 {
1432 case SID_ATTRIBUTES_AREA:
1433 {
1434 SwWrtShell& rSh = GetShell();
1435
1436 if(!rSh.IsFrameSelected())
1437 {
1438 rSet.DisableItem(nWhich);
1439 }
1440
1441 break;
1442 }
1443 default:
1444 {
1445 rSet.DisableItem(nWhich);
1446 break;
1447 }
1448 }
1449
1450 nWhich = aIter.NextWhich();
1451 }
1452}
1453
1454/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
PropertiesInfo aProperties
#define GetWhich(nSlot)
const OUString & GetValue() const
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
size_t GetMarkedObjectCount() const
const SfxItemPool & GetItemPool() const
const SfxItemSet & GetDefaultAttr() const
SdrModel * GetModel() const
void SetDefaultAttr(const SfxItemSet &rAttr, bool bReplaceAll)
void Update(sal_uInt16 nId)
void Invalidate(sal_uInt16 nId)
bool GetValue() const
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 * >())
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SfxItemSet * GetParent() const
bool HasItem(sal_uInt16 nWhich, const SfxPoolItem **ppItem=nullptr) 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)
const Point & GetValue() const
sal_uInt16 GetSlot() const
const SfxItemSet * GetArgs() const
void SetReturnValue(const SfxPoolItem &)
void Done(bool bRemove=false)
SfxItemPool & GetPool() const
void SetContextName(const OUString &rsContextName)
static void HandleOpenXmlFilterSettings(SfxRequest &)
SfxViewFrame * GetFrame() const
void SetName(const OUString &rName)
SfxBindings & GetBindings()
SfxDispatcher * GetDispatcher()
SfxViewFrame * GetViewFrame() const
sal_uInt16 FirstWhich()
sal_uInt16 NextWhich()
constexpr tools::Long getHeight() const
constexpr tools::Long getWidth() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
static sal_uInt16 IsMath(const SvGlobalName &rName)
static bool IsRunning()
virtual VclPtr< AbstractSvxAreaTabDialog > CreateSvxAreaTabDialog(weld::Window *pParent, const SfxItemSet *pAttr, SdrModel *pModel, bool bShadow, bool bSlideBackground)=0
virtual VclPtr< AbstractSvxObjectTitleDescDialog > CreateSvxObjectTitleDescDialog(weld::Window *pParent, const OUString &rTitle, const OUString &rDescription)=0
virtual VclPtr< AbstractSvxObjectNameDialog > CreateSvxObjectNameDialog(weld::Window *pParent, const OUString &rName)=0
static SvxAbstractDialogFactory * Create()
static const sal_Int16 Hairline
virtual SvxBoxItem * Clone(SfxItemPool *pPool=nullptr) const override
sal_uInt16 GetSmallestDistance() const
SvxLinkInsertMode GetInsertMode() const
const OUString & GetName() const
const OUString & GetURL() const
void SetName(const OUString &rName)
void SetInsertMode(SvxLinkInsertMode eNew)
void SetURL(const OUString &rURL)
const OUString & GetTargetFrame() const
void SetTargetFrame(const OUString &rTarget)
void SetHeight(tools::Long n)
void SetWidth(tools::Long n)
virtual VclPtr< SfxAbstractTabDialog > CreateFrameTabDialog(const OUString &rDialogType, SfxViewFrame *pFrame, weld::Window *pParent, const SfxItemSet &rCoreSet, bool bNewFrame=true, const OString &sDefPage=OString())=0
static SwAbstractDialogFactory * Create()
Definition: swabstdlg.cxx:36
SwWrtShell & GetShell()
Definition: basesh.cxx:2827
SwView & GetView()
Definition: basesh.hxx:59
void GotoFlyAnchor()
jump from the frame to the anchor
Definition: trvlfnfl.cxx:350
void CallChgLnk()
Definition: crsrsh.cxx:2544
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:204
IDocumentSettingAccess const & getIDocumentSettingAccess() const
Definition: doc.cxx:182
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:161
void PutAreaListItems(SfxItemSet &rSet) const
Put needed items for XPropertyList entries from the DrawModel.
Definition: drawdoc.cxx:151
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
Definition: edattr.cxx:171
void StartAllAction()
For all views of this document.
Definition: edws.cxx:86
const SwFlyFrameFormat * FindFlyByName(const OUString &rName) const
Definition: edfmt.cxx:142
void SetModified()
Definition: edws.cxx:70
void EndAllAction()
Definition: edws.cxx:97
bool IsChainMode() const
Definition: edtwin.hxx:228
void SetChainMode(bool bOn)
Definition: edtwin.cxx:6172
SwApplyTemplate * GetApplyTemplate() const
Definition: edtwin.hxx:234
SwFlyFrame * GetSelectedFlyFrame() const
Definition: fefly1.cxx:277
void Unchain(SwFrameFormat &rFormat)
Definition: feshview.cxx:2946
bool SetFlyFrameAttr(SfxItemSet &rSet)
Definition: fefly1.cxx:1103
FrameTypeFlags GetFrameType(const Point *pPt, bool bStopAtFly) const
For return values see above FrameType.
Definition: fews.cxx:237
void SetObjDescription(const OUString &rDescription)
Definition: fefly1.cxx:2026
FlyProtectFlags IsSelObjProtected(FlyProtectFlags eType) const
Which Protection is set at selected object?
Definition: feshview.cxx:2701
void HideChainMarker()
Definition: feshview.cxx:2953
OUString GetFlyName() const
Definition: fefly1.cxx:1481
OUString GetObjTitle() const
Definition: fefly1.cxx:1964
void SetObjTitle(const OUString &rTitle)
Definition: fefly1.cxx:1984
void SetFlyName(const OUString &rName)
Set name at selected FlyFrame.
Definition: fefly1.cxx:1471
bool IsFrameSelected() const
Definition: feshview.cxx:1253
OUString GetObjDescription() const
Definition: fefly1.cxx:2006
css::uno::Reference< css::embed::XEmbeddedObject > GetOleRef() const
get reference to OLE object (if there is one) for selected FlyFrame
Definition: fefly1.cxx:1491
const SwFrameFormat * GetFlyNum(size_t nIdx, FlyCntType eType, bool bIgnoreTextBoxes=false) const
Definition: feshview.cxx:2676
SwFrameFormat * GetSelectedFrameFormat() const
If frame then frame style, else 0.
Definition: fefly1.cxx:1213
void SelectionToTop(bool bTop=true)
Move selection upwards or downwards (Z-Order).
Definition: feshview.cxx:1048
void SelectionToBottom(bool bBottom=true)
Definition: feshview.cxx:1117
void SetChainMarker()
Definition: feshview.cxx:2959
size_t GetFlyCount(FlyCntType eType, bool bIgnoreTextBoxes=false) const
Iterate over flys - for Basic-collections.
Definition: feshview.cxx:2671
SwChainRet Chain(SwFrameFormat &rSource, const Point &rPt)
Definition: feshview.cxx:2923
const SwRect & GetAnyCurRect(CurRectType eType, const Point *pPt=nullptr, const css::uno::Reference< css::embed::XEmbeddedObject > &=css::uno::Reference< css::embed::XEmbeddedObject >()) const
Definition: fews.cxx:90
bool GetFlyFrameAttr(SfxItemSet &rSet) const
Definition: fefly1.cxx:1061
const SwFrameFormat * IsFlyInFly()
Is selected frame within another frame?
Definition: fefly1.cxx:312
const SwFrameFormat * GetFlyFrameFormat() const
Get FlyFrameFormat; for UI macro linkage at Flys.
Definition: fefly1.cxx:1270
void SetVertOrientation(sal_Int16 eOrient)
Definition: frmmgr.cxx:584
void SetAbsPos(const Point &rLPoint)
Definition: frmmgr.cxx:250
const SwFormatFrameSize & GetFrameSize() const
Definition: frmmgr.hxx:151
void SetSize(const Size &rLSize)
Definition: frmmgr.cxx:612
void SetRotation(Degree10 nOld, Degree10 nNew, const Size &rUnrotatedSize)
Definition: frmmgr.cxx:598
RndStdIds GetAnchor() const
Definition: frmmgr.hxx:167
Point GetPos() const
Definition: frmmgr.hxx:163
void SetAttrSet(const SfxItemSet &rSet)
Definition: frmmgr.cxx:619
const Size & GetSize() const
Definition: frmmgr.hxx:138
const SwFormatHoriOrient & GetHoriOrient() const
Definition: frmmgr.hxx:147
const SfxItemSet & GetAttrSet() const
Definition: frmmgr.hxx:124
void UpdateFlyFrame()
Definition: frmmgr.cxx:159
void SetHorzOrientation(sal_Int16 eOrient)
Definition: frmmgr.cxx:577
general base class for all free-flowing frames
Definition: flyfrm.hxx:79
virtual const SwFlyFrameFormat * GetFormat() const override
Definition: fly.cxx:2905
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:67
Connection (text flow) between two FlyFrames.
Definition: fmtcnct.hxx:32
SwFlyFrameFormat * GetPrev() const
Definition: fmtcnct.hxx:53
SwFlyFrameFormat * GetNext() const
Definition: fmtcnct.hxx:54
sal_uInt16 GetGutterWidth(bool bMin=false) const
Definition: atrfrm.cxx:918
sal_uInt16 GetWishWidth() const
Definition: fmtclds.hxx:122
void Init(sal_uInt16 nNumCols, sal_uInt16 nGutterWidth, sal_uInt16 nAct)
This function allows to (repeatedly) initialize the columns.
Definition: atrfrm.cxx:969
sal_uInt8 GetWidthPercent() const
Definition: fmtfsize.hxx:91
SwFrameSize GetHeightSizeType() const
Definition: fmtfsize.hxx:80
sal_uInt8 GetHeightPercent() const
Definition: fmtfsize.hxx:88
Defines the horizontal position of a fly frame.
Definition: fmtornt.hxx:73
void SetPosToggle(bool bNew)
Definition: fmtornt.hxx:103
sal_Int16 GetHoriOrient() const
Definition: fmtornt.hxx:94
bool IsPosToggle() const
Definition: fmtornt.hxx:102
const SwFormatChain & GetChain(bool=true) const
Definition: fmtcnct.hxx:70
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
const OUString & GetName() const
Definition: format.hxx:131
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:83
bool IsAutoUpdateFormat() const
Query / set bAutoUpdateFormat-flag.
Definition: format.hxx:188
Style of a layout element.
Definition: frmfmt.hxx:62
void GetState(SfxItemSet &)
Definition: frmsh.cxx:729
void GetDrawAttrStateTextFrame(SfxItemSet &rSet)
Definition: frmsh.cxx:1306
void ExecDrawAttrArgsTextFrame(SfxRequest const &rReq)
Definition: frmsh.cxx:1325
virtual ~SwFrameShell() override
Definition: frmsh.cxx:1070
void GetLineStyleState(SfxItemSet &rSet)
Definition: frmsh.cxx:1265
void StateInsert(SfxItemSet &rSet)
Definition: frmsh.cxx:1292
void ExecFrameStyle(SfxRequest const &rReq)
Definition: frmsh.cxx:1076
void ExecField(const SfxRequest &rReq)
Definition: frmsh.cxx:118
void ExecDrawDlgTextFrame(SfxRequest const &rReq)
Definition: frmsh.cxx:1367
void Execute(SfxRequest &)
Definition: frmsh.cxx:131
void DisableStateTextFrame(SfxItemSet &rSet)
Definition: frmsh.cxx:1423
void ExecMove(SfxRequest &rReq)
Definition: frmsh.cxx:105
SwFrameShell(SwView &rView)
Definition: frmsh.cxx:1059
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
void Height(tools::Long nNew)
Definition: swrect.hxx:193
void Width(tools::Long nNew)
Definition: swrect.hxx:189
const Size & GetUnrotatedSize() const
Definition: grfatr.hxx:108
Degree10 GetValue() const
Definition: grfatr.hxx:109
static void ClearSelection(const SwWrtShell &rSh, const SwFrameShell *pCreator=nullptr)
Definition: swdtflvr.cxx:4323
static void CreateSelection(SwWrtShell &rSh, const SwFrameShell *pCreator=nullptr)
Definition: swdtflvr.cxx:4311
bool IsKeepRatio() const
Definition: viewopt.hxx:643
void SetKeepRatio(bool b)
Definition: viewopt.hxx:662
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:433
SdrView * GetDrawViewWithValidMarkList()
Definition: vnew.cxx:378
SwDoc * GetDoc() const
Definition: viewsh.hxx:290
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:624
SdrView * GetDrawView()
Definition: vnew.cxx:373
Definition: view.hxx:146
SwWrtShell & GetWrtShell() const
Definition: view.hxx:416
void ExecNumberingOutline(SfxItemPool &)
Definition: view0.cxx:717
SwEditWin & GetEditWin()
Definition: view.hxx:419
SwDocShell * GetDocShell()
Definition: view.cxx:1160
void UpdateWordCount(SfxShell *, sal_uInt16)
Definition: view1.cxx:202
void ExecFormatFootnote()
Definition: view0.cxx:710
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
void InsertPostIt(SwFieldMgr &rFieldMgr, const SfxRequest &rReq)
Inserts a new annotation/comment at the current cursor position / selection.
Definition: wrtsh1.cxx:2213
void AutoUpdateFrame(SwFrameFormat *pFormat, const SfxItemSet &rStyleSet)
Definition: wrtsh1.cxx:1928
SelectionType GetSelectionType() const
Definition: wrtsh1.cxx:1706
void EnterStdMode()
Definition: select.cxx:551
void SelAll()
Definition: select.cxx:123
const SwView & GetView() const
Definition: wrtsh.hxx:438
static const OUString & GetContextName(const Context eContext)
#define FN_FRAME_UP
Definition: cmdid.h:383
#define FN_SET_FRM_ALT_NAME
Definition: cmdid.h:872
#define FN_SET_FRM_POSITION
Definition: cmdid.h:354
#define FN_FRAME_MIRROR_ON_EVEN_PAGES
Definition: cmdid.h:474
#define FN_FRAME_ALIGN_VERT_CHAR_TOP
Definition: cmdid.h:423
#define FN_SET_FRM_NAME
Definition: cmdid.h:869
#define FN_FORMAT_FRAME_DLG
Definition: cmdid.h:335
#define FN_FRAME_ALIGN_VERT_BOTTOM
Definition: cmdid.h:351
#define FN_POSTIT
Definition: cmdid.h:227
#define FN_GET_PRINT_AREA
Definition: cmdid.h:754
#define FN_INSERT_FRAME
Definition: cmdid.h:232
#define FN_PARAM_CHAIN_PREVIOUS
Definition: cmdid.h:832
#define FN_FRAME_UNCHAIN
Definition: cmdid.h:469
#define FN_OLE_IS_MATH
Definition: cmdid.h:634
#define FN_FORMAT_FOOTNOTE_DLG
Definition: cmdid.h:340
#define FN_FRAME_ALIGN_VERT_ROW_TOP
Definition: cmdid.h:419
#define FN_FRAME_ALIGN_VERT_CHAR_CENTER
Definition: cmdid.h:425
#define FN_FRAME_DOWN
Definition: cmdid.h:384
#define FN_FRAME_ALIGN_VERT_ROW_BOTTOM
Definition: cmdid.h:420
#define FN_TITLE_DESCRIPTION_SHAPE
Definition: cmdid.h:457
#define FN_FORMAT_GRAFIC_DLG
Definition: cmdid.h:336
#define FN_KEEP_ASPECT_RATIO
Definition: cmdid.h:870
#define FN_FRAME_CHAIN
Definition: cmdid.h:468
#define FN_FRAME_ALIGN_HORZ_LEFT
Definition: cmdid.h:347
#define FN_DRAW_WRAP_DLG
Definition: cmdid.h:153
#define FN_NAME_SHAPE
Definition: cmdid.h:455
#define FN_MATH_BASELINE_ALIGNMENT
Definition: cmdid.h:635
#define FN_FRAME_ALIGN_HORZ_CENTER
Definition: cmdid.h:349
#define FN_NUMBERING_OUTLINE_DLG
Definition: cmdid.h:504
#define FN_FRAME_ALIGN_VERT_CENTER
Definition: cmdid.h:352
#define FN_WORDCOUNT_DIALOG
Definition: cmdid.h:608
#define FN_FRAME_TO_ANCHOR
Definition: cmdid.h:715
#define FN_FRAME_ALIGN_HORZ_RIGHT
Definition: cmdid.h:348
#define FN_FRAME_ALIGN_VERT_ROW_CENTER
Definition: cmdid.h:421
#define FN_PARAM_CHAIN_NEXT
Definition: cmdid.h:833
#define FN_FRAME_ALIGN_VERT_TOP
Definition: cmdid.h:350
#define FN_UNO_DESCRIPTION
Definition: cmdid.h:874
#define FN_SURROUND
Definition: cmdid.h:866
#define FN_FRAME_ALIGN_VERT_CHAR_BOTTOM
Definition: cmdid.h:424
int nCount
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Definition: dialoghelp.cxx:19
URL aURL
@ Page
Rect of current page.
@ FlyEmbedded
Rect of current FlyFrame.
@ PagePrt
Rect of current PrtArea of page.
FrameTypeFlags
values can be combined via logical or
Definition: fesh.hxx:63
FlyProtectFlags
values can be combined via logical or
Definition: fesh.hxx:106
@ Parent
Check only parents.
FilterGroup & rTarget
FieldUnit
@ FLYCNTTYPE_FRM
Definition: flyenum.hxx:26
@ Fixed
Frame cannot be moved in Var-direction.
@ Variable
Frame is variable in Var-direction.
static void lcl_FrameGetMaxLineWidth(const SvxBorderLine *pBorderLine, SvxBorderLine &rBorderLine)
Definition: frmsh.cxx:1256
static const SwFrameFormat * lcl_GetFrameFormatByName(SwWrtShell const &rSh, std::u16string_view rName)
Definition: frmsh.cxx:84
SelectionType
constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END)
constexpr TypedWhichId< SvxOpaqueItem > RES_OPAQUE(99)
constexpr sal_uInt16 RES_FRMATR_END(133)
constexpr TypedWhichId< SwFormatCol > RES_COL(109)
constexpr TypedWhichId< SwFormatSurround > RES_SURROUND(101)
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
constexpr TypedWhichId< SwFormatHoriOrient > RES_HORI_ORIENT(103)
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(92)
constexpr TypedWhichId< SwFormatAnchor > RES_ANCHOR(104)
constexpr TypedWhichId< SwFormatURL > RES_URL(111)
constexpr TypedWhichId< SvxPrintItem > RES_PRINT(98)
constexpr TypedWhichId< SvxProtectItem > RES_PROTECT(100)
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(102)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(106)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
constexpr TypedWhichId< SwRotationGrf > RES_GRFATR_ROTATION(135)
const SfxPoolItem * GetDfltAttr(sal_uInt16 nWhich)
Get the default attribute from corresponding default attribute table.
Definition: hints.cxx:159
SvxLinkInsertMode
HLINK_HTMLMODE
OUString aName
#define SAL_WARN_IF(condition, area, stream)
const char * sName
int i
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
Sequence< beans::PropertyValue > GetCommandProperties(const OUString &rsCommandName, const OUString &rsModuleName)
OUString GetModuleIdentifier(const Reference< frame::XFrame > &rxFrame)
OUString GetLabelForCommand(const css::uno::Sequence< css::beans::PropertyValue > &rProperties)
#define SFX_OBJECTBAR_OBJECT
static SfxItemSet & rSet
#define SFX_IMPL_INTERFACE(Class, SuperClass)
RndStdIds
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:165
#define SW_MOD()
Definition: swmodule.hxx:256
constexpr SwTwips MIN_BORDER_DIST
Definition: swtypes.hxx:70
SvxBoxItem & rBoxItem
SW_DLLPUBLIC FieldUnit GetDfltMetric(bool bWeb)
Definition: uitool.cxx:755
RET_OK
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)
Definition: viewopt.cxx:332
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLUSESLIDEBACKGROUND)