Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / source / uibase / shells / drwbassh.cxx
bloba5a63a66343d8ea3ffc5e68305196ae9c7010cae
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <hintids.hxx>
21 #include <swtypes.hxx>
22 #include <sfx2/objface.hxx>
23 #include <sfx2/request.hxx>
24 #include <sfx2/bindings.hxx>
25 #include <sfx2/viewfrm.hxx>
26 #include <svx/svdview.hxx>
27 #include <svl/whiter.hxx>
28 #include <svx/swframevalidation.hxx>
29 #include <svx/anchorid.hxx>
30 #include <svx/hlnkitem.hxx>
31 #include <osl/diagnose.h>
32 #include <drawdoc.hxx>
33 #include <uitool.hxx>
34 #include <fmtornt.hxx>
35 #include <cmdid.h>
36 #include <swmodule.hxx>
37 #include <wrtsh.hxx>
38 #include <wview.hxx>
39 #include <edtwin.hxx>
40 #include <viewopt.hxx>
41 #include <dcontact.hxx>
42 #include <frmfmt.hxx>
43 #include <drawbase.hxx>
44 #include <drwbassh.hxx>
45 #include <swdtflvr.hxx>
46 #include <svx/svditer.hxx>
47 #define ShellClass_SwDrawBaseShell
48 #include <sfx2/msg.hxx>
49 #include <swslots.hxx>
50 #include <svx/svxdlg.hxx>
51 #include <svx/svdogrp.hxx>
52 #include <vcl/unohelp2.hxx>
53 #include <swabstdlg.hxx>
54 #include <swundo.hxx>
55 #include <com/sun/star/text/HoriOrientation.hpp>
56 #include <com/sun/star/text/VertOrientation.hpp>
57 #include <com/sun/star/text/RelOrientation.hpp>
58 #include <com/sun/star/uno/Reference.hxx>
59 #include <IDocumentDrawModelAccess.hxx>
60 #include <fmtfollowtextflow.hxx>
61 #include <textboxhelper.hxx>
62 #include <svx/diagram/IDiagramHelper.hxx>
64 using namespace ::com::sun::star;
65 using namespace css::beans;
66 using namespace css::drawing;
67 using namespace css::uno;
69 SFX_IMPL_SUPERCLASS_INTERFACE(SwDrawBaseShell, SwBaseShell)
71 void SwDrawBaseShell::InitInterface_Impl()
76 SwDrawBaseShell::SwDrawBaseShell(SwView &_rView)
77 : SwBaseShell(_rView)
79 GetShell().NoEdit();
81 SwEditWin& rWin = GetView().GetEditWin();
83 rWin.SetBezierMode(SID_BEZIER_MOVE);
85 if ( !_rView.GetDrawFuncPtr() )
86 _rView.GetEditWin().StdDrawMode( SdrObjKind::NONE, true );
88 SwTransferable::CreateSelection( GetShell() );
91 SwDrawBaseShell::~SwDrawBaseShell()
93 GetView().ExitDraw();
94 GetShell().Edit();
95 SwTransferable::ClearSelection( GetShell() );
98 void SwDrawBaseShell::Execute(SfxRequest const &rReq)
100 SwWrtShell *pSh = &GetShell();
101 SdrView* pSdrView = pSh->GetDrawView();
102 const SfxItemSet *pArgs = rReq.GetArgs();
103 sal_uInt16 nSlotId = rReq.GetSlot();
104 bool bChanged = pSdrView->GetModel().IsChanged();
105 pSdrView->GetModel().SetChanged(false);
106 const SfxPoolItem* pItem = nullptr;
107 if(pArgs)
108 pArgs->GetItemState(nSlotId, false, &pItem);
110 bool bAlignPossible = pSh->IsAlignPossible();
112 bool bTopParam = true, bBottomParam = true;
113 bool bDone = false;
114 SfxBindings& rBind = GetView().GetViewFrame().GetBindings();
116 switch (nSlotId)
118 case FN_DRAW_WRAP_DLG:
120 if(pSdrView->AreObjectsMarked())
122 if(!pArgs)
124 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
125 if( rMarkList.GetMark(0) != nullptr )
127 SfxItemSetFixed<
128 RES_LR_SPACE, RES_UL_SPACE,
129 RES_SURROUND, RES_SURROUND,
130 RES_ANCHOR, RES_ANCHOR,
131 RES_WRAP_INFLUENCE_ON_OBJPOS, RES_WRAP_INFLUENCE_ON_OBJPOS,
132 SID_HTML_MODE, SID_HTML_MODE,
133 FN_DRAW_WRAP_DLG, FN_DRAW_WRAP_DLG>
134 aSet( GetPool() );
136 aSet.Put(SfxBoolItem(SID_HTML_MODE,
137 0 != ::GetHtmlMode(pSh->GetView().GetDocShell())));
139 aSet.Put(SfxInt16Item(FN_DRAW_WRAP_DLG, pSh->GetLayerId().get()));
141 pSh->GetObjAttr(aSet);
142 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
143 ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateSwWrapDlg(GetView().GetFrameWeld(), aSet, pSh));
145 if (pDlg->Execute() == RET_OK)
147 const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
148 if(const SfxInt16Item* pWrapItem = pOutSet->GetItemIfSet(FN_DRAW_WRAP_DLG, false))
150 short nLayer = pWrapItem->GetValue();
151 if (nLayer == 1)
152 pSh->SelectionToHeaven();
153 else
154 pSh->SelectionToHell();
157 pSh->SetObjAttr(*pOutSet);
163 break;
165 case SID_ATTR_TRANSFORM:
167 if(pSdrView->AreObjectsMarked())
169 if(!pArgs)
171 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
172 if( rMarkList.GetMark(0) != nullptr )
174 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
175 VclPtr<SfxAbstractTabDialog> pDlg;
176 bool bCaption = false;
178 // Allowed anchorages:
179 RndStdIds nAnchor = pSh->GetAnchorId();
180 SvxAnchorIds nAllowedAnchors = SvxAnchorIds::Paragraph | SvxAnchorIds::Character | SvxAnchorIds::Page;
181 sal_uInt16 nHtmlMode = ::GetHtmlMode(pSh->GetView().GetDocShell());
183 if ( pSh->IsFlyInFly() )
184 nAllowedAnchors |= SvxAnchorIds::Fly;
186 if (pObj->GetObjIdentifier() == SdrObjKind::Caption )
187 bCaption = true;
189 if (bCaption)
191 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
192 VclPtr<AbstractSvxCaptionDialog> pCaptionDlg =
193 pFact->CreateCaptionDialog( rReq.GetFrameWeld(), pSdrView, nAllowedAnchors );
194 pDlg.reset(pCaptionDlg);
195 pCaptionDlg->SetValidateFramePosLink( LINK(this, SwDrawBaseShell, ValidatePosition) );
197 else
199 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
200 VclPtr<AbstractSvxTransformTabDialog> pTransform =
201 pFact->CreateSvxTransformTabDialog(rReq.GetFrameWeld(), nullptr, pSdrView, nAllowedAnchors);
202 pDlg.reset(pTransform);
203 pTransform->SetValidateFramePosLink( LINK(this, SwDrawBaseShell, ValidatePosition) );
205 SfxItemSet aNewAttr(pSdrView->GetGeoAttrFromMarked());
207 const WhichRangesContainer& pRange = pDlg->GetInputRanges( *aNewAttr.GetPool() );
208 SfxItemSet aSet( *aNewAttr.GetPool(), pRange );
209 FieldUnit eMetric = ::GetDfltMetric( dynamic_cast<SwWebView*>(&GetView()) != nullptr );
210 SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
212 aSet.Put( aNewAttr, false );
214 if (bCaption)
215 pSdrView->GetAttributes( aSet );
217 aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_ANCHOR, static_cast<sal_Int16>(nAnchor)));
218 bool bRTL;
219 bool bVertL2R;
220 aSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_IN_VERTICAL_TEXT, pSh->IsFrameVertical(true, bRTL, bVertL2R)));
221 aSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_IN_RTL_TEXT, bRTL));
223 SwFrameFormat* pFrameFormat = FindFrameFormat( pObj );
225 aSet.Put( pFrameFormat->GetFormatAttr(RES_FOLLOW_TEXT_FLOW) );
227 SwFormatVertOrient aVOrient(pFrameFormat->GetFormatAttr(RES_VERT_ORIENT));
228 aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_VERT_ORIENT, aVOrient.GetVertOrient()));
229 aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_VERT_RELATION, aVOrient.GetRelationOrient() ));
230 aSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_VERT_POSITION, aVOrient.GetPos()));
232 SwFormatHoriOrient aHOrient(pFrameFormat->GetFormatAttr(RES_HORI_ORIENT));
233 aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_HORI_ORIENT, aHOrient.GetHoriOrient()));
234 aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_HORI_RELATION, aHOrient.GetRelationOrient() ));
235 aSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_HORI_MIRROR, aHOrient.IsPosToggle()));
236 aSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_HORI_POSITION, aHOrient.GetPos()));
238 aSet.Put(SfxUInt16Item(SID_HTML_MODE, nHtmlMode));
240 pDlg->SetInputSet( &aSet );
242 pDlg->StartExecuteAsync([bCaption, bChanged, pDlg, pFrameFormat, pSdrView,
243 pSh, &rMarkList, this](
244 sal_Int32 nResult){
245 pSdrView->GetModel().SetChanged(false);
247 if (nResult == RET_OK)
249 SwFormatVertOrient aVOrientFinal(pFrameFormat->GetFormatAttr(RES_VERT_ORIENT));
250 SwFormatHoriOrient aHOrientFinal(pFrameFormat->GetFormatAttr(RES_HORI_ORIENT));
252 const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
253 pSh->StartAllAction();
255 // #i30451#
256 pSh->StartUndo(SwUndoId::INSFMTATTR);
258 pSdrView->SetGeoAttrToMarked(*pOutSet);
260 if (bCaption)
261 pSdrView->SetAttributes(*pOutSet);
263 bool bPosCorr =
264 SfxItemState::SET != pOutSet->GetItemState(
265 SID_ATTR_TRANSFORM_POS_X, false ) &&
266 SfxItemState::SET != pOutSet->GetItemState(
267 SID_ATTR_TRANSFORM_POS_Y, false );
269 SfxItemSetFixed<RES_FRMATR_BEGIN, RES_FRMATR_END - 1> aFrameAttrSet(GetPool());
271 bool bSingleSelection = rMarkList.GetMarkCount() == 1;
273 if(const SfxInt16Item* pAnchorItem = pOutSet->GetItemIfSet(
274 SID_ATTR_TRANSFORM_ANCHOR, false))
276 if(!bSingleSelection)
277 pSh->ChgAnchor(static_cast<RndStdIds>(pAnchorItem
278 ->GetValue()), false, bPosCorr );
279 else
281 SwFormatAnchor aAnchor(pFrameFormat->GetAnchor());
282 aAnchor.SetType(static_cast<RndStdIds>(pAnchorItem->GetValue()));
283 aFrameAttrSet.Put( aAnchor );
286 const SfxInt16Item* pHoriOrient =
287 pOutSet->GetItemIfSet(SID_ATTR_TRANSFORM_HORI_ORIENT, false);
288 const SfxInt16Item* pHoriRelation =
289 pOutSet->GetItemIfSet(SID_ATTR_TRANSFORM_HORI_RELATION, false);
290 const SfxInt32Item* pHoriPosition =
291 pOutSet->GetItemIfSet(SID_ATTR_TRANSFORM_HORI_POSITION, false);
292 const SfxBoolItem* pHoriMirror =
293 pOutSet->GetItemIfSet(SID_ATTR_TRANSFORM_HORI_MIRROR, false);
294 if(pHoriOrient || pHoriRelation || pHoriPosition || pHoriMirror)
296 if(pHoriOrient)
297 aHOrientFinal.SetHoriOrient(pHoriOrient->GetValue());
298 if(pHoriRelation)
299 aHOrientFinal.SetRelationOrient(pHoriRelation->GetValue());
300 if(pHoriPosition)
301 aHOrientFinal.SetPos( pHoriPosition->GetValue());
302 if(pHoriMirror)
303 aHOrientFinal.SetPosToggle( pHoriMirror->GetValue());
304 aFrameAttrSet.Put(aHOrientFinal);
307 const SfxInt16Item* pVertOrient =
308 pOutSet->GetItemIfSet(SID_ATTR_TRANSFORM_VERT_ORIENT, false);
309 const SfxInt16Item* pVertRelation =
310 pOutSet->GetItemIfSet(SID_ATTR_TRANSFORM_VERT_RELATION, false);
311 const SfxInt32Item* pVertPosition =
312 pOutSet->GetItemIfSet(SID_ATTR_TRANSFORM_VERT_POSITION, false);
313 if(pVertOrient || pVertRelation || pVertPosition )
315 if(pVertOrient)
316 aVOrientFinal.SetVertOrient(pVertOrient->GetValue());
317 if(pVertRelation)
318 aVOrientFinal.SetRelationOrient(pVertRelation->GetValue());
319 if(pVertPosition)
320 aVOrientFinal.SetPos( pVertPosition->GetValue());
321 aFrameAttrSet.Put( aVOrientFinal );
323 const SwFormatFollowTextFlow* pFollowItem =
324 pOutSet->GetItemIfSet(RES_FOLLOW_TEXT_FLOW, false);
325 if(pFollowItem)
326 aFrameAttrSet.Put(*pFollowItem);
328 if(aFrameAttrSet.Count())
329 pSh->SetDrawingAttr(aFrameAttrSet);
331 GetView().GetViewFrame().GetBindings().InvalidateAll(false);
333 // #i30451#
334 pSh->EndUndo( SwUndoId::INSFMTATTR );
336 pSh->EndAllAction();
339 if (pSdrView->GetModel().IsChanged())
340 pSh->SetModified();
341 else if (bChanged)
342 pSdrView->GetModel().SetChanged();
344 pDlg->disposeOnce();
348 else
350 pSh->StartAllAction();
351 pSdrView->SetGeoAttrToMarked( *pArgs );
352 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
353 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
354 if (pObj)
356 SwFrameFormat* pFrameFormat = FindFrameFormat(pObj);
357 if (pFrameFormat)
359 const SwFormatAnchor& rAnchor = pFrameFormat->GetAnchor();
360 // Don't change shape position / size, just update the anchor doc model
361 // position.
362 pSh->ChgAnchor(rAnchor.GetAnchorId(), /*bSameOnly=*/true);
365 pSh->EndAllAction();
369 break;
371 case SID_DELETE:
372 case FN_BACKSPACE:
373 if (pSh->IsObjSelected() && !pSdrView->IsTextEdit())
375 bDone = true;
377 const Point aPt = pSh->GetObjRect().TopLeft(); // tdf#150589
379 if( GetView().IsDrawRotate() )
381 pSh->SetDragMode( SdrDragMode::Move );
382 GetView().FlipDrawRotate();
385 pSh->SetModified();
386 pSh->DelSelectedObj();
388 if (rReq.IsAPI() ||
389 GetView().GetEditWin().IsObjectSelect() )
391 // If basic call, then back to the text shell, because the
392 // Basic otherwise has no possibility to return.
393 if (GetView().GetDrawFuncPtr())
395 GetView().GetDrawFuncPtr()->Deactivate();
396 GetView().SetDrawFuncPtr(nullptr);
398 GetView().LeaveDrawCreate(); // Switch to selection mode
401 if (pSh->IsSelFrameMode())
403 pSh->LeaveSelFrameMode();
404 // #105852# FME <- perhaps fixed by tdf#150589
405 static_cast<SwEditShell*>(pSh)->SetCursor(aPt);
409 break;
411 case SID_GROUP:
412 if (pSh->IsObjSelected() > 1 && pSh->IsGroupAllowed())
414 pSh->GroupSelection();
415 rBind.Invalidate(SID_UNGROUP);
417 break;
419 case SID_UNGROUP:
420 if (pSh->IsGroupSelected(true) && pSh->IsUnGroupAllowed())
422 pSh->UnGroupSelection();
423 rBind.Invalidate(SID_GROUP);
425 break;
427 case SID_ENTER_GROUP:
428 if (pSh->IsGroupSelected(false))
430 pSdrView->EnterMarkedGroup();
431 rBind.InvalidateAll(false);
433 break;
435 case SID_LEAVE_GROUP:
436 if (pSdrView->IsGroupEntered())
438 pSdrView->LeaveOneGroup();
439 rBind.Invalidate(SID_ENTER_GROUP);
440 rBind.Invalidate(SID_UNGROUP);
442 break;
444 case SID_REGENERATE_DIAGRAM:
445 case SID_EDIT_DIAGRAM:
447 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
449 if (1 == rMarkList.GetMarkCount())
451 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
453 // Support advanced DiagramHelper
454 if(nullptr != pObj && pObj->isDiagram())
456 if(SID_REGENERATE_DIAGRAM == nSlotId)
458 pSdrView->UnmarkAll();
459 pObj->getDiagramHelper()->reLayout(*static_cast<SdrObjGroup*>(pObj));
460 pSdrView->MarkObj(pObj, pSdrView->GetSdrPageView());
462 else // SID_EDIT_DIAGRAM
464 VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create();
465 ScopedVclPtr<VclAbstractDialog> pDlg = pFact->CreateDiagramDialog(
466 GetView().GetFrameWeld(),
467 *static_cast<SdrObjGroup*>(pObj));
468 pDlg->Execute();
473 break;
475 case SID_OBJECT_ALIGN_LEFT:
476 case SID_OBJECT_ALIGN_CENTER:
477 case SID_OBJECT_ALIGN_RIGHT:
478 case SID_OBJECT_ALIGN_UP:
479 case SID_OBJECT_ALIGN_MIDDLE:
480 case SID_OBJECT_ALIGN_DOWN:
482 if ( bAlignPossible )
484 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
485 if (rMarkList.GetMarkCount() == 1
486 && !SwTextBoxHelper::hasTextFrame(rMarkList.GetMark(0)->GetMarkedSdrObj()))
488 sal_Int16 nHorizOrient = -1, nVertOrient = -1;
490 switch (nSlotId)
492 case SID_OBJECT_ALIGN_LEFT:
493 nHorizOrient = text::HoriOrientation::LEFT;
494 break;
495 case SID_OBJECT_ALIGN_CENTER:
496 nHorizOrient = text::HoriOrientation::CENTER;
497 break;
498 case SID_OBJECT_ALIGN_RIGHT:
499 nHorizOrient = text::HoriOrientation::RIGHT;
500 break;
501 case SID_OBJECT_ALIGN_UP:
502 nVertOrient = text::VertOrientation::TOP;
503 break;
504 case SID_OBJECT_ALIGN_MIDDLE:
505 nVertOrient = text::VertOrientation::CENTER;
506 break;
507 case SID_OBJECT_ALIGN_DOWN:
508 nVertOrient = text::VertOrientation::BOTTOM;
509 break;
510 default:
511 break;
514 if (nHorizOrient != -1)
516 pSh->StartAction();
517 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
518 SwFrameFormat* pFrameFormat = FindFrameFormat( pObj );
519 SwFormatHoriOrient aHOrient(pFrameFormat->GetFormatAttr(RES_HORI_ORIENT));
520 aHOrient.SetHoriOrient( nHorizOrient );
521 pFrameFormat->SetFormatAttr(aHOrient);
522 pSh->EndAction();
525 if (nVertOrient != -1)
527 pSh->StartAction();
528 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
529 SwFrameFormat* pFrameFormat = FindFrameFormat( pObj );
530 SwFormatVertOrient aVOrient(pFrameFormat->GetFormatAttr(RES_VERT_ORIENT));
531 aVOrient.SetVertOrient( nVertOrient );
532 pFrameFormat->SetFormatAttr(aVOrient);
533 pSh->EndAction();
536 break;
539 pSh->StartAction();
540 switch (nSlotId)
542 case SID_OBJECT_ALIGN_LEFT:
543 pSdrView->AlignMarkedObjects(SdrHorAlign::Left, SdrVertAlign::NONE);
544 break;
545 case SID_OBJECT_ALIGN_CENTER:
546 pSdrView->AlignMarkedObjects(SdrHorAlign::Center, SdrVertAlign::NONE);
547 break;
548 case SID_OBJECT_ALIGN_RIGHT:
549 pSdrView->AlignMarkedObjects(SdrHorAlign::Right, SdrVertAlign::NONE);
550 break;
551 case SID_OBJECT_ALIGN_UP:
552 pSdrView->AlignMarkedObjects(SdrHorAlign::NONE, SdrVertAlign::Top);
553 break;
554 case SID_OBJECT_ALIGN_MIDDLE:
555 pSdrView->AlignMarkedObjects(SdrHorAlign::NONE, SdrVertAlign::Center);
556 break;
557 case SID_OBJECT_ALIGN_DOWN:
558 pSdrView->AlignMarkedObjects(SdrHorAlign::NONE, SdrVertAlign::Bottom);
559 break;
561 pSh->EndAction();
564 break;
566 case FN_FRAME_UP:
567 bTopParam = false;
568 [[fallthrough]];
569 case SID_FRAME_TO_TOP:
570 pSh->SelectionToTop( bTopParam );
571 break;
573 case FN_FRAME_DOWN:
574 bBottomParam = false;
575 [[fallthrough]];
576 case SID_FRAME_TO_BOTTOM:
577 pSh->SelectionToBottom( bBottomParam );
578 break;
580 case FN_NAME_SHAPE:
582 bDone = true;
584 if(1 == pSdrView->GetMarkedObjectCount())
586 // #i68101#
587 SdrObject* pSelected = pSdrView->GetMarkedObjectByIndex(0);
588 OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
589 OUString aName(pSelected->GetName());
591 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
592 ScopedVclPtr<AbstractSvxObjectNameDialog> pDlg(pFact->CreateSvxObjectNameDialog(GetView().GetFrameWeld(), aName));
594 pDlg->SetCheckNameHdl(LINK(this, SwDrawBaseShell, CheckGroupShapeNameHdl));
596 if(RET_OK == pDlg->Execute())
598 const OUString aOrigName = aName;
599 pDlg->GetName(aName);
600 pSelected->SetName(aName);
601 pSh->SetModified();
603 // update accessibility sidebar object name if we modify the object name on the navigator bar
604 if (!aName.isEmpty() && aOrigName != aName)
606 if (SwNode* pSwNode = FindFrameFormat(pSelected)->GetAnchor().GetAnchorNode())
607 pSwNode->resetAndQueueAccessibilityCheck(true);
612 break;
615 // #i68101#
616 case FN_TITLE_DESCRIPTION_SHAPE:
618 bDone = true;
620 if(1 == pSdrView->GetMarkedObjectCount())
622 SdrObject* pSelected = pSdrView->GetMarkedObjectByIndex(0);
623 OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
624 OUString aTitle(pSelected->GetTitle());
625 OUString aDescription(pSelected->GetDescription());
626 bool isDecorative(pSelected->IsDecorative());
628 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
629 ScopedVclPtr<AbstractSvxObjectTitleDescDialog> pDlg(pFact->CreateSvxObjectTitleDescDialog(GetView().GetFrameWeld(),
630 aTitle, aDescription, isDecorative));
632 if(RET_OK == pDlg->Execute())
634 pDlg->GetTitle(aTitle);
635 pDlg->GetDescription(aDescription);
636 pDlg->IsDecorative(isDecorative);
638 pSelected->SetTitle(aTitle);
639 pSelected->SetDescription(aDescription);
640 pSelected->SetDecorative(isDecorative);
642 pSh->SetModified();
646 break;
649 case SID_OPEN_HYPERLINK:
651 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
652 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
653 LoadURL(GetShell(), pObj->getHyperlink(), LoadUrlFlags::NewView,
654 /*rTargetFrameName=*/OUString());
655 break;
658 case SID_EDIT_HYPERLINK:
659 case SID_HYPERLINK_DIALOG:
661 GetView().GetViewFrame().SetChildWindow(SID_HYPERLINK_DIALOG, true);
662 break;
665 case SID_HYPERLINK_SETLINK:
667 if(pItem)
669 const SvxHyperlinkItem& rHLinkItem = *static_cast<const SvxHyperlinkItem *>(pItem);
670 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
671 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
672 pObj->setHyperlink(rHLinkItem.GetURL());
674 break;
677 case SID_REMOVE_HYPERLINK:
679 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
680 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
681 pObj->setHyperlink(OUString());
682 break;
685 case SID_COPY_HYPERLINK_LOCATION:
687 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
688 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
689 uno::Reference<datatransfer::clipboard::XClipboard> xClipboard
690 = GetView().GetEditWin().GetClipboard();
691 vcl::unohelper::TextDataObject::CopyStringTo(pObj->getHyperlink(), xClipboard);
692 break;
695 default:
696 OSL_ENSURE(false, "wrong Dispatcher");
697 return;
699 if(!bDone)
701 if(nSlotId >= SID_OBJECT_ALIGN_LEFT && nSlotId <= SID_OBJECT_ALIGN_DOWN)
702 rBind.Invalidate(SID_ATTR_LONG_LRSPACE);
703 if (pSdrView->GetModel().IsChanged())
704 pSh->SetModified();
705 else if (bChanged)
706 pSdrView->GetModel().SetChanged();
710 // Checks whether a given name is allowed for a group shape
712 IMPL_LINK( SwDrawBaseShell, CheckGroupShapeNameHdl, AbstractSvxObjectNameDialog&, rNameDialog, bool )
714 SwWrtShell &rSh = GetShell();
715 SdrView *pSdrView = rSh.GetDrawView();
716 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
717 OSL_ENSURE(rMarkList.GetMarkCount() == 1, "wrong draw selection");
718 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
719 const OUString sCurrentName = pObj->GetName();
720 OUString sNewName;
721 rNameDialog.GetName(sNewName);
722 bool bRet = false;
723 if (sNewName.isEmpty() || sCurrentName == sNewName)
724 bRet = true;
725 else
727 bRet = true;
728 SwDrawModel* pModel = rSh.getIDocumentDrawModelAccess().GetDrawModel();
729 SdrObjListIter aIter( pModel->GetPage(0), SdrIterMode::DeepWithGroups );
730 while( aIter.IsMore() )
732 SdrObject* pTempObj = aIter.Next();
733 if ( pObj != pTempObj && pTempObj->GetName() == sNewName )
735 bRet = false;
736 break;
740 return bRet;
743 void SwDrawBaseShell::GetState(SfxItemSet& rSet)
745 SwWrtShell &rSh = GetShell();
746 SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList();
747 SfxWhichIter aIter( rSet );
748 sal_uInt16 nWhich = aIter.FirstWhich();
749 bool bProtected = rSh.IsSelObjProtected(FlyProtectFlags::Content) != FlyProtectFlags::NONE;
751 if (!bProtected) // Look in the parent
752 bProtected |= rSh.IsSelObjProtected( FlyProtectFlags::Content|FlyProtectFlags::Parent ) != FlyProtectFlags::NONE;
754 while( nWhich )
756 switch( nWhich )
758 case FN_DRAW_WRAP_DLG:
759 case SID_ATTR_TRANSFORM:
760 case SID_FRAME_TO_TOP:
761 case SID_FRAME_TO_BOTTOM:
762 case FN_FRAME_UP:
763 case FN_FRAME_DOWN:
764 case SID_DELETE:
765 case FN_BACKSPACE:
766 if( bProtected || !rSh.IsObjSelected() )
767 rSet.DisableItem( nWhich );
768 break;
769 case SID_GROUP:
770 if ( rSh.IsObjSelected() < 2 || bProtected || !rSh.IsGroupAllowed() )
771 rSet.DisableItem( nWhich );
772 break;
773 case SID_UNGROUP:
774 if ( !rSh.IsGroupSelected(true) || bProtected || !rSh.IsUnGroupAllowed() )
775 rSet.DisableItem( nWhich );
776 break;
777 case SID_ENTER_GROUP:
778 if ( !rSh.IsGroupSelected(false) )
779 rSet.DisableItem( nWhich );
780 break;
781 case SID_LEAVE_GROUP:
782 if ( !pSdrView->IsGroupEntered() )
783 rSet.DisableItem( nWhich );
784 break;
785 case SID_OBJECT_ALIGN_LEFT:
786 case SID_OBJECT_ALIGN_CENTER:
787 case SID_OBJECT_ALIGN_RIGHT:
788 case SID_OBJECT_ALIGN_UP:
789 case SID_OBJECT_ALIGN_MIDDLE:
790 case SID_OBJECT_ALIGN_DOWN:
791 case SID_OBJECT_ALIGN:
793 bool bDisableThis = false;
794 bool bDisableHoriz = false;
795 bool bHoriz = (nWhich == SID_OBJECT_ALIGN_LEFT || nWhich == SID_OBJECT_ALIGN_CENTER ||
796 nWhich == SID_OBJECT_ALIGN_RIGHT);
797 bool bVert = (nWhich == SID_OBJECT_ALIGN_UP || nWhich == SID_OBJECT_ALIGN_MIDDLE ||
798 nWhich == SID_OBJECT_ALIGN_DOWN);
799 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
800 if ( !rSh.IsAlignPossible() || bProtected )
802 bDisableThis = true;
803 rSet.DisableItem( nWhich );
805 else if ( rSh.GetAnchorId() == RndStdIds::FLY_AS_CHAR )
807 //if only one object is selected it can only be vertically
808 // aligned because it is character bound
809 if( rMarkList.GetMarkCount() == 1 )
811 bDisableHoriz = true;
812 rSet.DisableItem(SID_OBJECT_ALIGN_LEFT);
813 rSet.DisableItem(SID_OBJECT_ALIGN_CENTER);
814 rSet.DisableItem(SID_OBJECT_ALIGN_RIGHT);
818 if (bHoriz && !bDisableThis && !bDisableHoriz &&
819 rMarkList.GetMarkCount() == 1)
821 sal_Int16 nHoriOrient = -1;
822 switch(nWhich)
824 case SID_OBJECT_ALIGN_LEFT:
825 nHoriOrient = text::HoriOrientation::LEFT;
826 break;
827 case SID_OBJECT_ALIGN_CENTER:
828 nHoriOrient = text::HoriOrientation::CENTER;
829 break;
830 case SID_OBJECT_ALIGN_RIGHT:
831 nHoriOrient = text::HoriOrientation::RIGHT;
832 break;
833 default:
834 break;
837 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
838 SwFrameFormat* pFrameFormat = FindFrameFormat(pObj);
839 SwFormatHoriOrient aHOrient(pFrameFormat->GetFormatAttr(RES_HORI_ORIENT));
840 rSet.Put(SfxBoolItem(nWhich, aHOrient.GetHoriOrient() == nHoriOrient));
843 if (bVert && !bDisableThis && rMarkList.GetMarkCount() == 1)
845 sal_Int16 nVertOrient = -1;
846 switch(nWhich)
848 case SID_OBJECT_ALIGN_UP:
849 nVertOrient = text::VertOrientation::TOP;
850 break;
851 case SID_OBJECT_ALIGN_MIDDLE:
852 nVertOrient = text::VertOrientation::CENTER;
853 break;
854 case SID_OBJECT_ALIGN_DOWN:
855 nVertOrient = text::VertOrientation::BOTTOM;
856 break;
857 default:
858 break;
861 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
862 SwFrameFormat* pFrameFormat = FindFrameFormat(pObj);
863 SwFormatVertOrient aVOrient(pFrameFormat->GetFormatAttr(RES_VERT_ORIENT));
864 rSet.Put(SfxBoolItem(nWhich, aVOrient.GetVertOrient() == nVertOrient));
867 break;
869 case FN_NAME_SHAPE :
871 if(1 != pSdrView->GetMarkedObjectCount())
873 rSet.DisableItem( nWhich );
876 break;
878 // #i68101#
879 case FN_TITLE_DESCRIPTION_SHAPE:
881 const bool bIsWebView(nullptr != dynamic_cast<SwWebView*>(&GetView()));
883 if(!bIsWebView && 1 != pSdrView->GetMarkedObjectCount())
885 rSet.DisableItem( nWhich );
888 break;
890 case SID_OPEN_HYPERLINK:
891 case SID_EDIT_HYPERLINK:
892 case SID_HYPERLINK_DIALOG:
893 case SID_REMOVE_HYPERLINK:
894 case SID_COPY_HYPERLINK_LOCATION:
896 if (pSdrView->GetMarkedObjectCount() != 1)
898 rSet.DisableItem(nWhich);
899 break;
902 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
903 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
904 SdrObjKind nObjType = pObj->GetObjIdentifier();
906 // Only enable hyperlink for the following types
907 switch (nObjType)
909 case SdrObjKind::PathFill:
910 case SdrObjKind::CircleSection:
911 case SdrObjKind::Line:
912 case SdrObjKind::CustomShape:
913 case SdrObjKind::Text:
914 case SdrObjKind::Rectangle:
915 case SdrObjKind::Caption:
916 case SdrObjKind::Polygon:
917 case SdrObjKind::PolyLine:
918 case SdrObjKind::E3D_Scene:
919 case SdrObjKind::Measure:
920 case SdrObjKind::Edge:
921 break;
922 default:
923 rSet.DisableItem(nWhich);
924 break;
927 if (nWhich == SID_OPEN_HYPERLINK || nWhich == SID_REMOVE_HYPERLINK
928 || nWhich == SID_EDIT_HYPERLINK || nWhich == SID_COPY_HYPERLINK_LOCATION)
930 if (pObj->getHyperlink().isEmpty())
931 rSet.DisableItem(nWhich);
934 break;
936 case SID_HYPERLINK_GETLINK:
938 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
939 if (rMarkList.GetMark(0) != nullptr)
941 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
942 OUString sHyperLink = pObj->getHyperlink();
943 SvxHyperlinkItem aHLinkItem;
944 aHLinkItem.SetURL(sHyperLink);
945 rSet.Put(aHLinkItem);
948 break;
950 case SID_REGENERATE_DIAGRAM:
951 case SID_EDIT_DIAGRAM:
953 bool bDisable(true);
954 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
955 if (nullptr != rMarkList.GetMark(0))
957 SdrObject* pObj(rMarkList.GetMark(0)->GetMarkedSdrObj());
959 if(nullptr != pObj && pObj->isDiagram())
961 bDisable = false;
965 if(bDisable)
967 rSet.DisableItem(nWhich);
970 break;
974 nWhich = aIter.NextWhich();
978 void SwDrawBaseShell::GetDrawAttrStateForIFBX( SfxItemSet& rSet )
980 SwWrtShell *pSh = &GetShell();
981 SdrView* pSdrView = pSh->GetDrawView();
982 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
983 if( rMarkList.GetMark(0) != nullptr )
985 SfxItemSet aNewAttr(pSdrView->GetGeoAttrFromMarked());
986 rSet.Put(aNewAttr,false);
990 bool SwDrawBaseShell::Disable(SfxItemSet& rSet, sal_uInt16 nWhich)
992 bool bDisable = GetShell().IsSelObjProtected(FlyProtectFlags::Content) != FlyProtectFlags::NONE;
994 if (bDisable)
996 if (nWhich)
997 rSet.DisableItem( nWhich );
998 else
1000 SfxWhichIter aIter( rSet );
1001 nWhich = aIter.FirstWhich();
1002 while (nWhich)
1004 rSet.DisableItem( nWhich );
1005 nWhich = aIter.NextWhich();
1010 return bDisable;
1013 void SwDrawBaseShell::DisableState( SfxItemSet& rSet )
1015 SwWrtShell *pSh = &GetShell();
1016 SdrView* pSdrView = pSh->GetDrawView();
1017 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
1018 const size_t nMarkCount = rMarkList.GetMarkCount();
1019 bool bShowArea = true, bShowMeasure = true;
1021 for (size_t i = 0; i < nMarkCount && i < 50; ++i)
1023 SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
1024 SdrObjKind nObjType = pObj->GetObjIdentifier();
1026 if ( nObjType != SdrObjKind::Measure )
1027 bShowMeasure = false;
1029 // If marked object is 2D, disable format area command.
1030 if ( nObjType == SdrObjKind::PolyLine ||
1031 nObjType == SdrObjKind::Line ||
1032 nObjType == SdrObjKind::PathLine ||
1033 nObjType == SdrObjKind::FreehandLine ||
1034 nObjType == SdrObjKind::Edge ||
1035 nObjType == SdrObjKind::CircleArc ||
1036 bShowMeasure )
1037 bShowArea = false;
1039 if (!bShowArea && !bShowMeasure)
1040 break;
1043 if (!bShowArea)
1044 rSet.DisableItem(SID_ATTRIBUTES_AREA);
1046 if (!bShowMeasure)
1047 rSet.DisableItem(SID_MEASURE_DLG);
1049 Disable(rSet);
1053 // Validate of drawing positions
1055 IMPL_LINK(SwDrawBaseShell, ValidatePosition, SvxSwFrameValidation&, rValidation, void )
1057 SwWrtShell *pSh = &GetShell();
1058 rValidation.nMinHeight = MINFLY;
1059 rValidation.nMinWidth = MINFLY;
1061 SwRect aBoundRect;
1063 // OD 18.09.2003 #i18732# - adjustment for allowing vertical position
1064 // aligned to page for fly frame anchored to paragraph or to character.
1065 const RndStdIds eAnchorType = rValidation.nAnchorType;
1066 const SwFormatAnchor* pAnchor = nullptr;
1067 SdrView* pSdrView = pSh->GetDrawView();
1068 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
1069 if( rMarkList.GetMarkCount() == 1 )
1071 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
1072 SwFrameFormat* pFrameFormat = FindFrameFormat( pObj );
1073 pAnchor = &pFrameFormat->GetAnchor();
1076 pSh->CalcBoundRect( aBoundRect, eAnchorType,
1077 rValidation.nHRelOrient,
1078 rValidation.nVRelOrient,
1079 pAnchor,
1080 rValidation.bFollowTextFlow,
1081 rValidation.bMirror, nullptr, &rValidation.aPercentSize);
1083 bool bIsInVertical( false );
1085 bool bRTL;
1086 bool bVertL2R;
1087 bIsInVertical = pSh->IsFrameVertical(true, bRTL, bVertL2R);
1089 if(bIsInVertical)
1091 Point aPos(aBoundRect.Pos());
1092 tools::Long nTmp = aPos.X();
1093 aPos.setX( aPos.Y() );
1094 aPos.setY( nTmp );
1095 Size aSize(aBoundRect.SSize());
1096 nTmp = aSize.Width();
1097 aSize.setWidth( aSize.Height() );
1098 aSize.setHeight( nTmp );
1099 aBoundRect.Chg( aPos, aSize );
1100 //exchange width/height to enable correct values
1101 nTmp = rValidation.nWidth;
1102 rValidation.nWidth = rValidation.nHeight;
1103 rValidation.nHeight = nTmp;
1105 if ((eAnchorType == RndStdIds::FLY_AT_PAGE) || (eAnchorType == RndStdIds::FLY_AT_FLY))
1107 // MinimalPosition
1108 rValidation.nMinHPos = aBoundRect.Left();
1109 rValidation.nMinVPos = aBoundRect.Top();
1110 SwTwips nH = rValidation.nHPos;
1111 SwTwips nV = rValidation.nVPos;
1113 if (rValidation.nHPos + rValidation.nWidth > aBoundRect.Right())
1115 if (rValidation.nHoriOrient == text::HoriOrientation::NONE)
1117 rValidation.nHPos -= ((rValidation.nHPos + rValidation.nWidth) - aBoundRect.Right());
1118 nH = rValidation.nHPos;
1120 else
1121 rValidation.nWidth = aBoundRect.Right() - rValidation.nHPos;
1124 if (rValidation.nHPos + rValidation.nWidth > aBoundRect.Right())
1125 rValidation.nWidth = aBoundRect.Right() - rValidation.nHPos;
1127 if (rValidation.nVPos + rValidation.nHeight > aBoundRect.Bottom())
1129 if (rValidation.nVertOrient == text::VertOrientation::NONE)
1131 rValidation.nVPos -= ((rValidation.nVPos + rValidation.nHeight) - aBoundRect.Bottom());
1132 nV = rValidation.nVPos;
1134 else
1135 rValidation.nHeight = aBoundRect.Bottom() - rValidation.nVPos;
1138 if (rValidation.nVPos + rValidation.nHeight > aBoundRect.Bottom())
1139 rValidation.nHeight = aBoundRect.Bottom() - rValidation.nVPos;
1141 if ( rValidation.nVertOrient != text::VertOrientation::NONE )
1142 nV = aBoundRect.Top();
1144 if ( rValidation.nHoriOrient != text::HoriOrientation::NONE )
1145 nH = aBoundRect.Left();
1147 rValidation.nMaxHPos = aBoundRect.Right() - rValidation.nWidth;
1148 rValidation.nMaxHeight = aBoundRect.Bottom() - nV;
1150 rValidation.nMaxVPos = aBoundRect.Bottom() - rValidation.nHeight;
1151 rValidation.nMaxWidth = aBoundRect.Right() - nH;
1153 else if ((eAnchorType == RndStdIds::FLY_AT_PARA) || (eAnchorType == RndStdIds::FLY_AT_CHAR))
1155 if (rValidation.nHPos + rValidation.nWidth > aBoundRect.Right())
1157 if (rValidation.nHoriOrient == text::HoriOrientation::NONE)
1159 rValidation.nHPos -= ((rValidation.nHPos + rValidation.nWidth) - aBoundRect.Right());
1161 else
1162 rValidation.nWidth = aBoundRect.Right() - rValidation.nHPos;
1165 // OD 29.09.2003 #i17567#, #i18732# - consider following the text flow
1166 // and alignment at page areas.
1167 const bool bMaxVPosAtBottom = !rValidation.bFollowTextFlow ||
1168 rValidation.nVRelOrient == text::RelOrientation::PAGE_FRAME ||
1169 rValidation.nVRelOrient == text::RelOrientation::PAGE_PRINT_AREA ||
1170 rValidation.nVRelOrient == text::RelOrientation::PAGE_PRINT_AREA_BOTTOM;
1172 SwTwips nTmpMaxVPos = ( bMaxVPosAtBottom
1173 ? aBoundRect.Bottom()
1174 : aBoundRect.Height() ) -
1175 rValidation.nHeight;
1176 if ( rValidation.nVPos > nTmpMaxVPos )
1178 if (rValidation.nVertOrient == text::VertOrientation::NONE)
1180 rValidation.nVPos = nTmpMaxVPos;
1182 else
1184 rValidation.nHeight = ( bMaxVPosAtBottom
1185 ? aBoundRect.Bottom()
1186 : aBoundRect.Height() ) - rValidation.nVPos;
1191 rValidation.nMinHPos = aBoundRect.Left();
1192 rValidation.nMaxHPos = aBoundRect.Right() - rValidation.nWidth;
1194 rValidation.nMinVPos = aBoundRect.Top();
1195 // OD 26.09.2003 #i17567#, #i18732# - determine maximum vertical position
1196 if ( bMaxVPosAtBottom )
1198 rValidation.nMaxVPos = aBoundRect.Bottom() - rValidation.nHeight;
1200 else
1202 rValidation.nMaxVPos = aBoundRect.Height() - rValidation.nHeight;
1205 // Maximum width height
1206 const SwTwips nH = ( rValidation.nHoriOrient != text::HoriOrientation::NONE )
1207 ? aBoundRect.Left()
1208 : rValidation.nHPos;
1209 const SwTwips nV = ( rValidation.nVertOrient != text::VertOrientation::NONE )
1210 ? aBoundRect.Top()
1211 : rValidation.nVPos;
1212 rValidation.nMaxHeight = rValidation.nMaxVPos + rValidation.nHeight - nV;
1213 rValidation.nMaxWidth = rValidation.nMaxHPos + rValidation.nWidth - nH;
1215 else if (eAnchorType == RndStdIds::FLY_AS_CHAR)
1217 rValidation.nMinHPos = 0;
1218 rValidation.nMaxHPos = 0;
1220 rValidation.nMaxHeight = aBoundRect.Height();
1221 rValidation.nMaxWidth = aBoundRect.Width();
1223 rValidation.nMaxVPos = aBoundRect.Height();
1224 rValidation.nMinVPos = -aBoundRect.Height() + rValidation.nHeight;
1225 if (rValidation.nMaxVPos < rValidation.nMinVPos)
1227 rValidation.nMinVPos = rValidation.nMaxVPos;
1228 rValidation.nMaxVPos = -aBoundRect.Height();
1231 if(bIsInVertical)
1233 //restore width/height exchange
1234 tools::Long nTmp = rValidation.nWidth;
1235 rValidation.nWidth = rValidation.nHeight;
1236 rValidation.nHeight = nTmp;
1239 if (rValidation.nMaxWidth < rValidation.nWidth)
1240 rValidation.nWidth = rValidation.nMaxWidth;
1241 if (rValidation.nMaxHeight < rValidation.nHeight)
1242 rValidation.nHeight = rValidation.nMaxHeight;
1245 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */