LibreOffice Module sw (master) 1
wrap.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 <hintids.hxx>
21#include <vcl/graph.hxx>
22
23#include <sfx2/htmlmode.hxx>
24#include <sfx2/objsh.hxx>
25#include <svl/intitem.hxx>
26#include <editeng/opaqitem.hxx>
27#include <editeng/ulspitem.hxx>
28#include <editeng/lrspitem.hxx>
29#include <fmtfollowtextflow.hxx>
30#include <svtools/unitconv.hxx>
32
33#include <cmdid.h>
34#include <docsh.hxx>
35#include <uitool.hxx>
36#include <wrtsh.hxx>
37#include <swmodule.hxx>
38#include <viewopt.hxx>
39#include <fmtsrnd.hxx>
40#include <frmmgr.hxx>
41#include <wrap.hxx>
42#include <bitmaps.hlst>
44
45using namespace ::com::sun::star;
46
51>);
52
53SwWrapDlg::SwWrapDlg(weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtShell, bool bDrawMode)
54 : SfxSingleTabDialogController(pParent, &rSet, "modules/swriter/ui/wrapdialog.ui", "WrapDialog")
55{
56 // create TabPage
57 auto xNewPage = SwWrapTabPage::Create(get_content_area(), this, &rSet);
58 SwWrapTabPage* pWrapPage = static_cast<SwWrapTabPage*>(xNewPage.get());
59 pWrapPage->SetFormatUsed(false, bDrawMode);
60 pWrapPage->SetShell(pWrtShell);
61 SetTabPage(std::move(xNewPage));
62}
63
65 : SfxTabPage(pPage, pController, "modules/swriter/ui/wrappage.ui", "WrapPage", &rSet)
66 , m_nAnchorId(RndStdIds::FLY_AT_PARA)
67 , m_nHtmlMode(0)
68 , m_pWrtSh(nullptr)
69 , m_bFormat(false)
70 , m_bNew(true)
71 , m_bHtmlMode(false)
72 , m_bDrawMode(false)
73 , m_bContourImage(false)
74 , m_xNoWrapImg(m_xBuilder->weld_image("noneimg"))
75 , m_xNoWrapRB(m_xBuilder->weld_radio_button("none"))
76 , m_xWrapLeftImg(m_xBuilder->weld_image("beforeimg"))
77 , m_xWrapLeftRB(m_xBuilder->weld_radio_button("before"))
78 , m_xWrapRightImg(m_xBuilder->weld_image("afterimg"))
79 , m_xWrapRightRB(m_xBuilder->weld_radio_button("after"))
80 , m_xWrapParallelImg(m_xBuilder->weld_image("parallelimg"))
81 , m_xWrapParallelRB(m_xBuilder->weld_radio_button("parallel"))
82 , m_xWrapThroughImg(m_xBuilder->weld_image("throughimg"))
83 , m_xWrapThroughRB(m_xBuilder->weld_radio_button("through"))
84 , m_xIdealWrapImg(m_xBuilder->weld_image("optimalimg"))
85 , m_xIdealWrapRB(m_xBuilder->weld_radio_button("optimal"))
86 , m_xLeftMarginED(m_xBuilder->weld_metric_spin_button("left", FieldUnit::CM))
87 , m_xRightMarginED(m_xBuilder->weld_metric_spin_button("right", FieldUnit::CM))
88 , m_xTopMarginED(m_xBuilder->weld_metric_spin_button("top", FieldUnit::CM))
89 , m_xBottomMarginED(m_xBuilder->weld_metric_spin_button("bottom", FieldUnit::CM))
90 , m_xWrapAnchorOnlyCB(m_xBuilder->weld_check_button("anchoronly"))
91 , m_xWrapTransparentCB(m_xBuilder->weld_check_button("transparent"))
92 , m_xWrapOutlineCB(m_xBuilder->weld_check_button("outline"))
93 , m_xWrapOutsideCB(m_xBuilder->weld_check_button("outside"))
94 , m_xAllowOverlapCB(m_xBuilder->weld_check_button("allowoverlap"))
95{
97
98 Link<weld::MetricSpinButton&,void> aLk = LINK(this, SwWrapTabPage, RangeModifyHdl);
99 m_xLeftMarginED->connect_value_changed(aLk);
100 m_xRightMarginED->connect_value_changed(aLk);
101 m_xTopMarginED->connect_value_changed(aLk);
102 m_xBottomMarginED->connect_value_changed(aLk);
103
104 Link<weld::Toggleable&,void> aLk2 = LINK(this, SwWrapTabPage, WrapTypeHdl);
105 m_xNoWrapRB->connect_toggled(aLk2);
106 m_xWrapLeftRB->connect_toggled(aLk2);
107 m_xWrapRightRB->connect_toggled(aLk2);
108 m_xWrapParallelRB->connect_toggled(aLk2);
109 m_xWrapThroughRB->connect_toggled(aLk2);
110 m_xIdealWrapRB->connect_toggled(aLk2);
111 SetImages();
112 m_xWrapOutlineCB->connect_toggled(LINK(this, SwWrapTabPage, ContourHdl));
113}
114
116{
117}
118
119std::unique_ptr<SfxTabPage> SwWrapTabPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet)
120{
121 return std::make_unique<SwWrapTabPage>(pPage, pController, *rSet);
122}
123
125{
126 // contour for Draw, Graphic and OLE (Insert/Graphic/Properties still missing!)
127 if( m_bDrawMode )
128 {
129 m_xWrapOutlineCB->show();
130 m_xWrapOutsideCB->show();
131
132 m_xWrapTransparentCB->set_active( 0 == rSet->Get(FN_DRAW_WRAP_DLG).GetValue() );
133 m_xWrapTransparentCB->save_state();
134 }
135 else
136 {
137 bool bShowCB = m_bFormat;
138 if( !m_bFormat )
139 {
141 if( ( nSelType & SelectionType::Graphic ) ||
142 ( nSelType & SelectionType::Ole && GraphicType::NONE !=
144 bShowCB = true;
145 }
146 if( bShowCB )
147 {
148 m_xWrapOutlineCB->show();
149 m_xWrapOutsideCB->show();
150 }
151 }
152
155
157 SetFieldUnit(*m_xLeftMarginED, aMetric);
159 SetFieldUnit(*m_xTopMarginED, aMetric);
161
162 const SwFormatSurround& rSurround = rSet->Get(RES_SURROUND);
163
164 css::text::WrapTextMode nSur = rSurround.GetSurround();
165 const SwFormatAnchor &rAnch = rSet->Get(RES_ANCHOR);
166 m_nAnchorId = rAnch.GetAnchorId();
167
168 if (((m_nAnchorId == RndStdIds::FLY_AT_PARA) || (m_nAnchorId == RndStdIds::FLY_AT_CHAR))
169 && (nSur != css::text::WrapTextMode_NONE))
170 {
171 m_xWrapAnchorOnlyCB->set_active(rSurround.IsAnchorOnly());
172 }
173 else
174 {
175 m_xWrapAnchorOnlyCB->set_sensitive(false);
176 }
177
178 const bool bContour = rSurround.IsContour();
179 m_xWrapOutlineCB->set_active(bContour);
180 m_xWrapOutsideCB->set_active(rSurround.IsOutside());
181 m_xWrapThroughRB->set_sensitive(!m_xWrapOutlineCB->get_active());
182 m_bContourImage = !bContour;
183
184 weld::RadioButton* pBtn = nullptr;
185
186 switch (nSur)
187 {
188 case css::text::WrapTextMode_NONE:
189 {
190 pBtn = m_xNoWrapRB.get();
191 break;
192 }
193
194 case css::text::WrapTextMode_THROUGH:
195 {
196 // transparent ?
197 pBtn = m_xWrapThroughRB.get();
198
199 if (!m_bDrawMode)
200 {
201 const SvxOpaqueItem& rOpaque = rSet->Get(RES_OPAQUE);
202 m_xWrapTransparentCB->set_active(!rOpaque.GetValue());
203 }
204 break;
205 }
206
207 case css::text::WrapTextMode_PARALLEL:
208 {
209 pBtn = m_xWrapParallelRB.get();
210 break;
211 }
212
213 case css::text::WrapTextMode_DYNAMIC:
214 {
215 pBtn = m_xIdealWrapRB.get();
216 break;
217 }
218
219 default:
220 {
221 if (nSur == css::text::WrapTextMode_LEFT)
222 pBtn = m_xWrapLeftRB.get();
223 else if (nSur == css::text::WrapTextMode_RIGHT)
224 pBtn = m_xWrapRightRB.get();
225 }
226 }
227 if (pBtn)
228 {
229 pBtn->set_active(true);
230 WrapTypeHdl(*pBtn);
231 // For character objects that currently are in passage, the default
232 // "contour on" is prepared here, in case we switch to any other
233 // passage later.
234 if (m_bDrawMode && !m_xWrapOutlineCB->get_sensitive())
235 m_xWrapOutlineCB->set_active(true);
236 }
237 m_xWrapTransparentCB->set_sensitive(pBtn == m_xWrapThroughRB.get() && !m_bHtmlMode);
238
239 const SvxULSpaceItem& rUL = rSet->Get(RES_UL_SPACE);
240 const SvxLRSpaceItem& rLR = rSet->Get(RES_LR_SPACE);
241
242 // gap to text
243 m_xLeftMarginED->set_value(m_xLeftMarginED->normalize(rLR.GetLeft()), FieldUnit::TWIP);
244 m_xRightMarginED->set_value(m_xRightMarginED->normalize(rLR.GetRight()), FieldUnit::TWIP);
245 m_xTopMarginED->set_value(m_xTopMarginED->normalize(rUL.GetUpper()), FieldUnit::TWIP);
246 m_xBottomMarginED->set_value(m_xBottomMarginED->normalize(rUL.GetLower()), FieldUnit::TWIP);
247
248 m_xLeftMarginED->save_value();
249 m_xRightMarginED->save_value();
250 m_xTopMarginED->save_value();
251 m_xBottomMarginED->save_value();
252
253 ContourHdl(*m_xWrapOutlineCB);
254
256 m_xAllowOverlapCB->set_active(rInfluence.GetAllowOverlap());
257
258 ActivatePage( *rSet );
259}
260
261// stuff attributes into the set when OK
263{
264 bool bModified = false;
265 const SfxPoolItem* pOldItem;
266 const SwFormatSurround& rOldSur = GetItemSet().Get(RES_SURROUND);
267 SwFormatSurround aSur( rOldSur );
268
269 std::shared_ptr<SvxOpaqueItem> aOp(std::make_shared<SvxOpaqueItem>(RES_OPAQUE));
270
271 if (!m_bDrawMode)
272 {
273 aOp.reset(GetItemSet().Get(RES_OPAQUE).Clone());
274 aOp->SetValue(true);
275 }
276
277 if (m_xNoWrapRB->get_active())
278 aSur.SetSurround(css::text::WrapTextMode_NONE);
279 else if (m_xWrapLeftRB->get_active())
280 aSur.SetSurround(css::text::WrapTextMode_LEFT);
281 else if (m_xWrapRightRB->get_active())
282 aSur.SetSurround(css::text::WrapTextMode_RIGHT);
283 else if (m_xWrapParallelRB->get_active())
284 aSur.SetSurround(css::text::WrapTextMode_PARALLEL);
285 else if (m_xWrapThroughRB->get_active())
286 {
287 aSur.SetSurround(css::text::WrapTextMode_THROUGH);
288 if (m_xWrapTransparentCB->get_active() && !m_bDrawMode)
289 aOp->SetValue(false);
290 }
291 else if (m_xIdealWrapRB->get_active())
292 aSur.SetSurround(css::text::WrapTextMode_DYNAMIC);
293
294 aSur.SetAnchorOnly( m_xWrapAnchorOnlyCB->get_active() );
295 bool bContour = m_xWrapOutlineCB->get_active() && m_xWrapOutlineCB->get_sensitive();
296 aSur.SetContour( bContour );
297
298 if ( bContour )
299 aSur.SetOutside(m_xWrapOutsideCB->get_active());
300
301 if(nullptr == (pOldItem = GetOldItem( *rSet, RES_SURROUND )) ||
302 aSur != *pOldItem )
303 {
304 rSet->Put(aSur);
305 bModified = true;
306 }
307
308 if (!m_bDrawMode)
309 {
310 if(nullptr == (pOldItem = GetOldItem( *rSet, FN_OPAQUE )) ||
311 *aOp != *pOldItem )
312 {
313 rSet->Put(*aOp);
314 bModified = true;
315 }
316 }
317
318 bool bTopMod = m_xTopMarginED->get_value_changed_from_saved();
319 bool bBottomMod = m_xBottomMarginED->get_value_changed_from_saved();
320
322 aUL.SetUpper(o3tl::narrowing<sal_uInt16>(m_xTopMarginED->denormalize(m_xTopMarginED->get_value(FieldUnit::TWIP))));
323 aUL.SetLower(o3tl::narrowing<sal_uInt16>(m_xBottomMarginED->denormalize(m_xBottomMarginED->get_value(FieldUnit::TWIP))));
324
325 if ( bTopMod || bBottomMod )
326 {
327 if(nullptr == (pOldItem = GetOldItem(*rSet, RES_UL_SPACE)) ||
328 aUL != *pOldItem )
329 {
330 rSet->Put( aUL );
331 bModified = true;
332 }
333 }
334
335 bool bLeftMod = m_xLeftMarginED->get_value_changed_from_saved();
336 bool bRightMod = m_xRightMarginED->get_value_changed_from_saved();
337
339 aLR.SetLeft(o3tl::narrowing<sal_uInt16>(m_xLeftMarginED->denormalize(m_xLeftMarginED->get_value(FieldUnit::TWIP))));
340 aLR.SetRight(o3tl::narrowing<sal_uInt16>(m_xRightMarginED->denormalize(m_xRightMarginED->get_value(FieldUnit::TWIP))));
341
342 if ( bLeftMod || bRightMod )
343 {
344 if( nullptr == (pOldItem = GetOldItem(*rSet, RES_LR_SPACE)) ||
345 aLR != *pOldItem )
346 {
347 rSet->Put(aLR);
348 bModified = true;
349 }
350 }
351
352 if ( m_bDrawMode )
353 {
354 bool bChecked = m_xWrapTransparentCB->get_active() && m_xWrapTransparentCB->get_sensitive();
355 if ((m_xWrapTransparentCB->get_saved_state() == TRISTATE_TRUE) != bChecked)
356 bModified |= nullptr != rSet->Put(SfxInt16Item(FN_DRAW_WRAP_DLG, bChecked ? 0 : 1));
357 }
358
359 const SwFormatWrapInfluenceOnObjPos& rOldInfluence
361 SwFormatWrapInfluenceOnObjPos aInfluence(rOldInfluence);
362 aInfluence.SetAllowOverlap(m_xAllowOverlapCB->get_active());
363
365 if (!pOldItem || aInfluence != *pOldItem)
366 {
367 rSet->Put(aInfluence);
368 bModified = true;
369 }
370
371 return bModified;
372}
373
374// example update
376{
377 // anchor
378 const SwFormatAnchor &rAnch = rSet.Get(RES_ANCHOR);
379 m_nAnchorId = rAnch.GetAnchorId();
380 bool bEnable = (m_nAnchorId != RndStdIds::FLY_AS_CHAR);
381
383 if (pSh && !m_bDrawMode)
384 {
385 SwFlyFrameAttrMgr aMgr( m_bNew, pSh, GetItemSet() );
387
388 // size
389 const SwFormatFrameSize& rFrameSize = rSet.Get(RES_FRM_SIZE);
390 Size aSize = rFrameSize.GetSize();
391
392 // position
395
398 aVal.bMirror = rHori.IsPosToggle();
399 // #i18732#
400 aVal.bFollowTextFlow = rSet.Get(RES_FOLLOW_TEXT_FLOW).GetValue();
401
402 aVal.nHoriOrient = static_cast<short>(rHori.GetHoriOrient());
403 aVal.nVertOrient = static_cast<short>(rVert.GetVertOrient());
404
405 aVal.nHPos = rHori.GetPos();
406 aVal.nHRelOrient = rHori.GetRelationOrient();
407 aVal.nVPos = rVert.GetPos();
408 aVal.nVRelOrient = rVert.GetRelationOrient();
409
410 if (rFrameSize.GetWidthPercent() && rFrameSize.GetWidthPercent() != SwFormatFrameSize::SYNCED)
411 aSize.setWidth( aSize.Width() * rFrameSize.GetWidthPercent() / 100 );
412
413 if (rFrameSize.GetHeightPercent() && rFrameSize.GetHeightPercent() != SwFormatFrameSize::SYNCED)
414 aSize.setHeight( aSize.Height() * rFrameSize.GetHeightPercent() / 100 );
415
416 aVal.nWidth = aSize.Width();
417 aVal.nHeight = aSize.Height();
418
419 aMgr.ValidateMetrics(aVal, nullptr);
420
421 SwTwips nLeft;
422 SwTwips nRight;
423 SwTwips nTop;
424 SwTwips nBottom;
425
426 nLeft = aVal.nHPos - aVal.nMinHPos;
427 nRight = aVal.nMaxWidth - aVal.nWidth;
428 nTop = aVal.nVPos - aVal.nMinVPos;
429 nBottom = aVal.nMaxHeight - aVal.nHeight;
430
431 {
432 if (aVal.nAnchorType == RndStdIds::FLY_AS_CHAR)
433 {
434 nLeft = nRight;
435
436 if (aVal.nVPos < 0)
437 {
438 if (aVal.nVPos <= aVal.nMaxHeight)
439 nTop = aVal.nMaxVPos - aVal.nHeight;
440 else
441 nTop = 0; // no passage
442 }
443 else
444 nTop = aVal.nMaxVPos - aVal.nHeight - aVal.nVPos;
445 }
446 else
447 {
448 nLeft += nRight;
449 nTop += nBottom;
450 }
451
452 nBottom = nTop;
453 nRight = nLeft;
454 }
455
456 m_xLeftMarginED->set_max(m_xLeftMarginED->normalize(nLeft), FieldUnit::TWIP);
457 m_xRightMarginED->set_max(m_xRightMarginED->normalize(nRight), FieldUnit::TWIP);
458
459 m_xTopMarginED->set_max(m_xTopMarginED->normalize(nTop), FieldUnit::TWIP);
460 m_xBottomMarginED->set_max(m_xBottomMarginED->normalize(nBottom), FieldUnit::TWIP);
461
462 RangeModifyHdl(*m_xLeftMarginED);
463 RangeModifyHdl(*m_xTopMarginED);
464 }
465
466 const SwFormatSurround& rSurround = rSet.Get(RES_SURROUND);
467 css::text::WrapTextMode nSur = rSurround.GetSurround();
468
469 m_xWrapTransparentCB->set_sensitive(bEnable && !m_bHtmlMode && nSur == css::text::WrapTextMode_THROUGH);
470 if(m_bHtmlMode)
471 {
473 sal_Int16 eHOrient = rHori.GetHoriOrient();
474 sal_Int16 eHRelOrient = rHori.GetRelationOrient();
475 m_xWrapOutlineCB->hide();
476 const bool bAllHtmlModes =
477 ((m_nAnchorId == RndStdIds::FLY_AT_PARA) || (m_nAnchorId == RndStdIds::FLY_AT_CHAR)) &&
478 (eHOrient == text::HoriOrientation::RIGHT || eHOrient == text::HoriOrientation::LEFT);
479 m_xWrapAnchorOnlyCB->set_sensitive(bAllHtmlModes && nSur != css::text::WrapTextMode_NONE);
480 m_xWrapOutsideCB->hide();
481 m_xIdealWrapRB->set_sensitive(false);
482
483 m_xWrapTransparentCB->set_sensitive(false);
484 m_xNoWrapRB->set_sensitive(RndStdIds::FLY_AT_PARA == m_nAnchorId);
485 m_xWrapParallelRB->set_sensitive(false);
486 m_xWrapLeftRB->set_sensitive
487 ( (RndStdIds::FLY_AT_PARA == m_nAnchorId)
488 || ( (RndStdIds::FLY_AT_CHAR == m_nAnchorId)
489 && (eHOrient == text::HoriOrientation::RIGHT)
490 && (eHRelOrient == text::RelOrientation::PRINT_AREA)));
491 m_xWrapRightRB->set_sensitive
492 ( (RndStdIds::FLY_AT_PARA == m_nAnchorId)
493 || ( (RndStdIds::FLY_AT_CHAR == m_nAnchorId)
494 && (eHOrient == text::HoriOrientation::LEFT)
495 && (eHRelOrient == text::RelOrientation::PRINT_AREA)));
496
497 m_xWrapThroughRB->set_sensitive
498 ( ( (RndStdIds::FLY_AT_PAGE == m_nAnchorId)
499 || ( (RndStdIds::FLY_AT_CHAR == m_nAnchorId)
500 && (eHRelOrient != text::RelOrientation::PRINT_AREA))
501 || (RndStdIds::FLY_AT_PARA == m_nAnchorId))
502 && (eHOrient != text::HoriOrientation::RIGHT));
503 if (m_xNoWrapRB->get_active() && !m_xNoWrapRB->get_sensitive())
504 {
505 if(m_xWrapThroughRB->get_sensitive())
506 m_xWrapThroughRB->set_active(true);
507 else if(m_xWrapLeftRB->get_sensitive())
508 m_xWrapLeftRB->set_active(true);
509 else if(m_xWrapRightRB->get_sensitive())
510 m_xWrapRightRB->set_active(true);
511
512 }
513 if (m_xWrapLeftRB->get_active() && !m_xWrapLeftRB->get_sensitive())
514 {
515 if(m_xWrapRightRB->get_sensitive())
516 m_xWrapRightRB->set_active(true);
517 else if(m_xWrapThroughRB->get_sensitive())
518 m_xWrapThroughRB->set_active(true);
519 }
520 if (m_xWrapRightRB->get_active() && !m_xWrapRightRB->get_sensitive())
521 {
522 if(m_xWrapLeftRB->get_sensitive())
523 m_xWrapLeftRB->set_active(true);
524 else if(m_xWrapThroughRB->get_sensitive())
525 m_xWrapThroughRB->set_active(true);
526 }
527 if (m_xWrapThroughRB->get_active() && !m_xWrapThroughRB->get_sensitive())
528 if(m_xNoWrapRB->get_sensitive())
529 m_xNoWrapRB->set_active(true);
530
531 if (m_xWrapParallelRB->get_active() && !m_xWrapParallelRB->get_sensitive())
532 m_xWrapThroughRB->set_active(true);
533 }
534 else
535 {
536 m_xNoWrapRB->set_sensitive(bEnable);
537 m_xWrapLeftRB->set_sensitive(bEnable);
538 m_xWrapRightRB->set_sensitive(bEnable);
539 m_xIdealWrapRB->set_sensitive(bEnable);
540 m_xWrapThroughRB->set_sensitive(bEnable);
541 m_xWrapParallelRB->set_sensitive(bEnable);
542 m_xWrapAnchorOnlyCB->set_sensitive(
543 ((m_nAnchorId == RndStdIds::FLY_AT_PARA) || (m_nAnchorId == RndStdIds::FLY_AT_CHAR))
544 && nSur != css::text::WrapTextMode_NONE );
545 }
546 ContourHdl(*m_xWrapOutlineCB);
547}
548
550{
551 if(_pSet)
552 FillItemSet(_pSet);
553
554 return DeactivateRC::LeavePage;
555}
556
557IMPL_LINK(SwWrapTabPage, RangeModifyHdl, weld::MetricSpinButton&, rEdit, void)
558{
559 auto nValue = rEdit.get_value(FieldUnit::NONE);
560 weld::MetricSpinButton* pOpposite = nullptr;
561 if (&rEdit == m_xLeftMarginED.get())
562 pOpposite = m_xRightMarginED.get();
563 else if (&rEdit == m_xRightMarginED.get())
564 pOpposite = m_xLeftMarginED.get();
565 else if (&rEdit == m_xTopMarginED.get())
566 pOpposite = m_xBottomMarginED.get();
567 else if (&rEdit == m_xBottomMarginED.get())
568 pOpposite = m_xTopMarginED.get();
569
570 assert(pOpposite);
571
572 if (pOpposite)
573 {
574 auto nOpposite = pOpposite->get_value(FieldUnit::NONE);
575
576 if (nValue + nOpposite > std::max(rEdit.get_max(FieldUnit::NONE), pOpposite->get_max(FieldUnit::NONE)))
577 pOpposite->set_value(pOpposite->get_max(FieldUnit::NONE) - nValue, FieldUnit::NONE);
578 }
579}
580
582{
583 bool bWrapThrough = m_xWrapThroughRB->get_active();
584 m_xWrapTransparentCB->set_sensitive(bWrapThrough && !m_bHtmlMode);
585 bWrapThrough |= ( m_nAnchorId == RndStdIds::FLY_AS_CHAR );
586 m_xWrapOutlineCB->set_sensitive(!bWrapThrough && !m_xNoWrapRB->get_active());
587 m_xWrapOutsideCB->set_sensitive(!bWrapThrough && m_xWrapOutlineCB->get_active());
588 m_xWrapAnchorOnlyCB->set_sensitive(
589 ((m_nAnchorId == RndStdIds::FLY_AT_PARA) || (m_nAnchorId == RndStdIds::FLY_AT_CHAR)) &&
590 (!m_xNoWrapRB->get_active()) );
591
592 ContourHdl(*m_xWrapOutlineCB);
593}
594
596{
597 bool bEnable = !(m_xWrapOutlineCB->get_active() && m_xWrapOutlineCB->get_sensitive());
598
599 m_xWrapOutsideCB->set_sensitive(!bEnable);
600
601 bEnable = !m_xWrapOutlineCB->get_active();
602 if (bEnable == m_bContourImage) // so that it doesn't always flicker
603 {
604 m_bContourImage = !bEnable;
605 SetImages();
606 }
607}
608
610{
611 m_xWrapThroughImg->set_from_icon_name(RID_BMP_WRAP_THROUGH);
612 bool bWrapOutline = !m_xWrapOutlineCB->get_active();
613 if (bWrapOutline)
614 {
615 m_xNoWrapImg->set_from_icon_name(RID_BMP_WRAP_NONE);
616 m_xWrapLeftImg->set_from_icon_name(RID_BMP_WRAP_LEFT);
617 m_xWrapRightImg->set_from_icon_name(RID_BMP_WRAP_RIGHT);
618 m_xWrapParallelImg->set_from_icon_name(RID_BMP_WRAP_PARALLEL);
619 m_xIdealWrapImg->set_from_icon_name(RID_BMP_WRAP_IDEAL);
620 }
621 else
622 {
623 m_xNoWrapImg->set_from_icon_name(RID_BMP_WRAP_CONTOUR_NONE);
624 m_xWrapLeftImg->set_from_icon_name(RID_BMP_WRAP_CONTOUR_LEFT);
625 m_xWrapRightImg->set_from_icon_name(RID_BMP_WRAP_CONTOUR_RIGHT);
626 m_xWrapParallelImg->set_from_icon_name(RID_BMP_WRAP_CONTOUR_PARALLEL);
627 m_xIdealWrapImg->set_from_icon_name(RID_BMP_WRAP_CONTOUR_IDEAL);
628 }
629}
630
631/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
GraphicType GetType() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
static SAL_WARN_UNUSED_RESULT SfxObjectShell * Current()
void SetTabPage(std::unique_ptr< SfxTabPage > xTabPage)
weld::Container * get_content_area()
const SfxItemSet & GetItemSet() const
void SetExchangeSupport()
const SfxPoolItem * GetOldItem(const SfxItemSet &rSet, sal_uInt16 nSlot, bool bDeep=true)
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
tools::Long GetRight() const
tools::Long GetLeft() const
void SetLeft(const tools::Long nL, const sal_uInt16 nProp=100)
const Size & GetSize() const
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
sal_uInt16 GetUpper() const
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
sal_uInt16 GetLower() const
Graphic GetIMapGraphic() const
Remove default parameter, because method always called this default value.
Definition: editsh.cxx:604
void ValidateMetrics(SvxSwFrameValidation &rVal, const SwFormatAnchor *pToCharContentPos, bool bOnlyPercentRefValue=false)
Definition: frmmgr.cxx:263
FlyAnchors.
Definition: fmtanchr.hxx:37
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:67
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
sal_Int16 GetHoriOrient() const
Definition: fmtornt.hxx:94
SwTwips GetPos() const
Definition: fmtornt.hxx:99
bool IsPosToggle() const
Definition: fmtornt.hxx:102
sal_Int16 GetRelationOrient() const
Definition: fmtornt.hxx:95
bool IsAnchorOnly() const
Definition: fmtsrnd.hxx:52
void SetSurround(css::text::WrapTextMode eNew)
Definition: fmtsrnd.hxx:55
bool IsOutside() const
Definition: fmtsrnd.hxx:54
bool IsContour() const
Definition: fmtsrnd.hxx:53
void SetAnchorOnly(bool bNew)
Definition: fmtsrnd.hxx:56
void SetOutside(bool bNew)
Definition: fmtsrnd.hxx:58
void SetContour(bool bNew)
Definition: fmtsrnd.hxx:57
css::text::WrapTextMode GetSurround() const
Definition: fmtsrnd.hxx:51
Defines the vertical position of a fly frame.
Definition: fmtornt.hxx:37
sal_Int16 GetRelationOrient() const
Definition: fmtornt.hxx:58
SwTwips GetPos() const
Definition: fmtornt.hxx:62
sal_Int16 GetVertOrient() const
Definition: fmtornt.hxx:57
Allows positioning of floating screen objects without considering their own wrapping type and the wra...
void SetAllowOverlap(bool bAllowOverlap)
SwWrapDlg(weld::Window *pParent, const SfxItemSet &rSet, SwWrtShell *pSh, bool bDrawMode)
Definition: wrap.cxx:53
std::unique_ptr< weld::MetricSpinButton > m_xLeftMarginED
Definition: wrap.hxx:64
bool m_bFormat
Definition: wrap.hxx:43
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: wrap.cxx:375
std::unique_ptr< weld::Image > m_xWrapLeftImg
Definition: wrap.hxx:52
SwWrapTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: wrap.cxx:64
static const WhichRangesContainer s_aWrapPageRg
Definition: wrap.hxx:84
std::unique_ptr< weld::MetricSpinButton > m_xBottomMarginED
Definition: wrap.hxx:67
bool m_bContourImage
Definition: wrap.hxx:47
std::unique_ptr< weld::MetricSpinButton > m_xTopMarginED
Definition: wrap.hxx:66
bool m_bNew
Definition: wrap.hxx:44
std::unique_ptr< weld::RadioButton > m_xWrapThroughRB
Definition: wrap.hxx:59
std::unique_ptr< weld::Image > m_xNoWrapImg
Definition: wrap.hxx:50
SwWrtShell * m_pWrtSh
Definition: wrap.hxx:41
RndStdIds m_nAnchorId
Definition: wrap.hxx:38
sal_uInt16 m_nHtmlMode
Definition: wrap.hxx:39
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: wrap.cxx:119
virtual void Reset(const SfxItemSet *rSet) override
Definition: wrap.cxx:124
std::unique_ptr< weld::Image > m_xIdealWrapImg
Definition: wrap.hxx:60
std::unique_ptr< weld::Image > m_xWrapRightImg
Definition: wrap.hxx:54
void SetShell(SwWrtShell *pSh)
Definition: wrap.hxx:97
std::unique_ptr< weld::CheckButton > m_xAllowOverlapCB
Definition: wrap.hxx:74
std::unique_ptr< weld::CheckButton > m_xWrapTransparentCB
Definition: wrap.hxx:71
std::unique_ptr< weld::RadioButton > m_xWrapParallelRB
Definition: wrap.hxx:57
std::unique_ptr< weld::Image > m_xWrapParallelImg
Definition: wrap.hxx:56
virtual ~SwWrapTabPage() override
Definition: wrap.cxx:115
std::unique_ptr< weld::RadioButton > m_xNoWrapRB
Definition: wrap.hxx:51
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: wrap.cxx:262
void SetImages()
Definition: wrap.cxx:609
void SetFormatUsed(bool bFormat, bool bDrawMode)
Definition: wrap.hxx:96
bool m_bHtmlMode
Definition: wrap.hxx:45
std::unique_ptr< weld::RadioButton > m_xWrapLeftRB
Definition: wrap.hxx:53
std::unique_ptr< weld::MetricSpinButton > m_xRightMarginED
Definition: wrap.hxx:65
std::unique_ptr< weld::Image > m_xWrapThroughImg
Definition: wrap.hxx:58
std::unique_ptr< weld::RadioButton > m_xIdealWrapRB
Definition: wrap.hxx:61
std::unique_ptr< weld::RadioButton > m_xWrapRightRB
Definition: wrap.hxx:55
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: wrap.cxx:549
std::unique_ptr< weld::CheckButton > m_xWrapOutsideCB
Definition: wrap.hxx:73
bool m_bDrawMode
Definition: wrap.hxx:46
std::unique_ptr< weld::CheckButton > m_xWrapAnchorOnlyCB
Definition: wrap.hxx:70
std::unique_ptr< weld::CheckButton > m_xWrapOutlineCB
Definition: wrap.hxx:72
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
SelectionType GetSelectionType() const
Definition: wrtsh1.cxx:1723
sal_Int64 get_max(FieldUnit eValueUnit) const
void set_value(sal_Int64 nValue, FieldUnit eValueUnit)
sal_Int64 get_value(FieldUnit eDestUnit) const
virtual void set_active(bool active)=0
#define FN_DRAW_WRAP_DLG
Definition: cmdid.h:155
#define FN_OPAQUE
Definition: cmdid.h:883
FieldUnit
sal_Int16 nValue
@ Minimum
Value in Var-direction gives minimum (can be exceeded but not be less).
TRISTATE_TRUE
SelectionType
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
constexpr TypedWhichId< SwFormatHoriOrient > RES_HORI_ORIENT(109)
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(108)
constexpr TypedWhichId< SvxOpaqueItem > RES_OPAQUE(105)
constexpr TypedWhichId< SwFormatWrapInfluenceOnObjPos > RES_WRAP_INFLUENCE_ON_OBJPOS(132)
constexpr TypedWhichId< SvxProtectItem > RES_PROTECT(106)
constexpr TypedWhichId< SwFormatAnchor > RES_ANCHOR(110)
constexpr TypedWhichId< SwFormatSurround > RES_SURROUND(107)
constexpr TypedWhichId< SwFormatFollowTextFlow > RES_FOLLOW_TEXT_FLOW(130)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(97)
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(98)
constexpr TypedWhichId< SvxPrintItem > RES_PRINT(104)
HTMLMODE_ON
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
css::uno::Reference< css::animations::XAnimationNode > Clone(const css::uno::Reference< css::animations::XAnimationNode > &xSourceNode, const SdPage *pSource=nullptr, const SdPage *pTarget=nullptr)
static constexpr auto Items
static SfxItemSet & rSet
RndStdIds
SwWrtShell * GetActiveWrtShell()
Definition: swmodul1.cxx:108
tools::Long SwTwips
Definition: swtypes.hxx:51
DeactivateRC
SW_DLLPUBLIC FieldUnit GetDfltMetric(bool bWeb)
Definition: uitool.cxx:756
SVT_DLLPUBLIC void SetFieldUnit(weld::MetricSpinButton &rCtrl, FieldUnit eUnit, bool bAll=false)
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)
Definition: viewopt.cxx:415
IMPL_LINK_NOARG(SwWrapTabPage, WrapTypeHdl, weld::Toggleable &, void)
Definition: wrap.cxx:581
IMPL_LINK(SwWrapTabPage, RangeModifyHdl, weld::MetricSpinButton &, rEdit, void)
Definition: wrap.cxx:557