LibreOffice Module cui (master)  1
border.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 <sfx2/app.hxx>
21 #include <sfx2/objsh.hxx>
22 #include <sfx2/module.hxx>
23 #include <svx/dialogs.hrc>
24 #include <svx/svxids.hrc>
25 #include <svx/dialmgr.hxx>
26 #include <svx/strings.hrc>
27 
28 #include <strings.hrc>
29 #include <bitmaps.hlst>
30 
31 #include <svx/xtable.hxx>
32 #include <svx/drawitem.hxx>
33 #include <editeng/boxitem.hxx>
34 #include <editeng/lineitem.hxx>
35 #include <border.hxx>
36 #include <svx/dlgutil.hxx>
37 #include <dialmgr.hxx>
38 #include <sfx2/htmlmode.hxx>
39 #include <vcl/event.hxx>
40 #include <vcl/settings.hxx>
41 #include <svx/flagsdef.hxx>
42 #include <sfx2/request.hxx>
43 #include <svl/grabbagitem.hxx>
44 #include <svl/intitem.hxx>
45 #include <svl/ilstitem.hxx>
46 #include <svl/int64item.hxx>
47 #include <sal/macros.h>
48 #include <com/sun/star/lang/XServiceInfo.hpp>
49 #include <comphelper/lok.hxx>
50 #include <svtools/unitconv.hxx>
51 
52 using namespace ::editeng;
53 using ::com::sun::star::uno::Reference;
54 using ::com::sun::star::lang::XServiceInfo;
55 using ::com::sun::star::uno::UNO_QUERY;
56 
57 
58 /*
59  * [Description:]
60  * TabPage for setting the border attributes.
61  * Needs
62  * a SvxShadowItem: shadow
63  * a SvxBoxItem: lines left, right, top, bottom,
64  * a SvxBoxInfo: lines vertical, horizontal, distance, flags
65  *
66  * Lines can have three conditions:
67  * 1. Show ( -> valid values )
68  * 2. Hide ( -> NULL-Pointer )
69  * 3. DontCare ( -> special Valid-Flags in the InfoItem )
70  */
71 
72 // static ----------------------------------------------------------------
73 
74 const sal_uInt16 SvxBorderTabPage::pRanges[] =
75 {
76  SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_SHADOW,
77  SID_ATTR_ALIGN_MARGIN, SID_ATTR_ALIGN_MARGIN,
78  SID_ATTR_BORDER_CONNECT, SID_ATTR_BORDER_CONNECT,
79  SID_SW_COLLAPSING_BORDERS, SID_SW_COLLAPSING_BORDERS,
80  SID_ATTR_BORDER_DIAG_TLBR, SID_ATTR_BORDER_DIAG_BLTR,
81  0
82 };
83 
85 {
86  auto nMin = rField.denormalize(rField.get_min(FieldUnit::TWIP));
87  rField.set_digits(1);
88  rField.set_min(rField.normalize(nMin), FieldUnit::TWIP);
89 }
90 
91 // number of preset images to show
92 const sal_uInt16 SVX_BORDER_PRESET_COUNT = 5;
93 
94 // number of shadow images to show
95 const sal_uInt16 SVX_BORDER_SHADOW_COUNT = 5;
96 
98  : mrVsPos(rVsPos)
99  , mrMfSize(rMfSize)
100  , mrLbColor(rLbColor)
101 {
102 }
103 
105 {
106  SvxShadowItem aItem(rItem);
107  if (!mrVsPos.IsNoSelection())
108  {
109  switch (mrVsPos.GetSelectedItemId())
110  {
111  case 1:
112  aItem.SetLocation(SvxShadowLocation::NONE);
113  break;
114  case 2:
115  aItem.SetLocation(SvxShadowLocation::BottomRight);
116  break;
117  case 3:
118  aItem.SetLocation(SvxShadowLocation::TopRight);
119  break;
120  case 4:
121  aItem.SetLocation(SvxShadowLocation::BottomLeft);
122  break;
123  case 5:
124  aItem.SetLocation(SvxShadowLocation::TopLeft);
125  break;
126  default:
127  aItem.SetLocation(SvxShadowLocation::NONE);
128  break;
129  }
130  }
131  // Default value was saved; so don't change the aItem's width if the control
132  // has not changed its value, to avoid round-trip errors (like twip->cm->twip)
133  // E.g., initial 100 twip will become 0.18 cm, which will return as 102 twip
135  aItem.SetWidth(mrMfSize.denormalize(mrMfSize.get_value(FieldUnit::TWIP)));
136  if (!mrLbColor.IsNoSelection())
138  return aItem;
139 }
140 
142 {
143  switch (rItem.GetLocation())
144  {
145  case SvxShadowLocation::NONE:
146  mrVsPos.SelectItem(1);
147  break;
148  case SvxShadowLocation::BottomRight:
149  mrVsPos.SelectItem(2);
150  break;
151  case SvxShadowLocation::TopRight:
152  mrVsPos.SelectItem(3);
153  break;
154  case SvxShadowLocation::BottomLeft:
155  mrVsPos.SelectItem(4);
156  break;
157  case SvxShadowLocation::TopLeft:
158  mrVsPos.SelectItem(5);
159  break;
160  default:
162  break;
163  }
164  mrVsPos.SaveValue();
165  mrMfSize.set_value(mrMfSize.normalize(rItem.GetWidth()), FieldUnit::TWIP);
167  mrLbColor.SelectEntry(rItem.GetColor());
169 }
170 
172 {
173  return mrVsPos.IsValueChangedFromSaved() ||
176 }
177 
179 {
181  mrMfSize.set_text("");
183 }
184 
187  : mrLeftWrp(rMfLeft)
188  , mrRightWrp(rMfRight)
189  , mrTopWrp(rMfTop)
190  , mrBottomWrp(rMfBottom)
191 {
192 }
193 
195 {
196  SvxMarginItem aItem(rItem);
197  if (mrLeftWrp.get_sensitive())
198  aItem.SetLeftMargin(mrLeftWrp.denormalize(mrLeftWrp.get_value(FieldUnit::TWIP)));
200  aItem.SetRightMargin(mrRightWrp.denormalize(mrRightWrp.get_value(FieldUnit::TWIP)));
201  if (mrTopWrp.get_sensitive())
202  aItem.SetTopMargin(mrTopWrp.denormalize(mrTopWrp.get_value(FieldUnit::TWIP)));
205  return aItem;
206 }
207 
209 {
214 }
215 
217 {
218  mrLeftWrp.set_value(mrLeftWrp.normalize(rItem.GetLeftMargin()), FieldUnit::TWIP);
219  mrRightWrp.set_value(mrRightWrp.normalize(rItem.GetRightMargin()), FieldUnit::TWIP);
220  mrTopWrp.set_value(mrTopWrp.normalize(rItem.GetTopMargin()), FieldUnit::TWIP);
221  mrBottomWrp.set_value(mrBottomWrp.normalize(rItem.GetBottomMargin()), FieldUnit::TWIP);
226 }
227 
229 {
230  const OUString sEmpty;
231  mrLeftWrp.set_text(sEmpty);
232  mrRightWrp.set_text(sEmpty);
233  mrTopWrp.set_text(sEmpty);
234  mrBottomWrp.set_text(sEmpty);
235 }
236 
238  : SfxTabPage(pParent, "cui/ui/borderpage.ui", "BorderPage", &rCoreAttrs)
239  , nMinValue(0)
240  , nSWMode(SwBorderModes::NONE)
241  , mnBoxSlot(SID_ATTR_BORDER_OUTER)
242  , mnShadowSlot(SID_ATTR_BORDER_SHADOW)
243  , mbHorEnabled(false)
244  , mbVerEnabled(false)
245  , mbTLBREnabled(false)
246  , mbBLTREnabled(false)
247  , mbUseMarginItem(false)
248  , mbLeftModified(false)
249  , mbRightModified(false)
250  , mbTopModified(false)
251  , mbBottomModified(false)
252  , mbSync(true)
253  , mbRemoveAdjacentCellBorders(false)
254  , bIsCalcDoc(false)
255  , m_xWndPresets(new SvtValueSet(m_xBuilder->weld_scrolled_window("presetswin")))
256  , m_xWndPresetsWin(new weld::CustomWeld(*m_xBuilder, "presets", *m_xWndPresets))
257  , m_xUserDefFT(m_xBuilder->weld_label("userdefft"))
258  , m_xFrameSelWin(new weld::CustomWeld(*m_xBuilder, "framesel", m_aFrameSel))
259  , m_xLbLineStyle(new SvtLineListBox(m_xBuilder->weld_menu_button("linestylelb")))
260  , m_xLbLineColor(new ColorListBox(m_xBuilder->weld_menu_button("linecolorlb"), pParent.GetFrameWeld()))
261  , m_xLineWidthMF(m_xBuilder->weld_metric_spin_button("linewidthmf", FieldUnit::POINT))
262  , m_xSpacingFrame(m_xBuilder->weld_container("spacing"))
263  , m_xLeftFT(m_xBuilder->weld_label("leftft"))
264  , m_xLeftMF(m_xBuilder->weld_metric_spin_button("leftmf", FieldUnit::MM))
265  , m_xRightFT(m_xBuilder->weld_label("rightft"))
266  , m_xRightMF(m_xBuilder->weld_metric_spin_button("rightmf", FieldUnit::MM))
267  , m_xTopFT(m_xBuilder->weld_label("topft"))
268  , m_xTopMF(m_xBuilder->weld_metric_spin_button("topmf", FieldUnit::MM))
269  , m_xBottomFT(m_xBuilder->weld_label("bottomft"))
270  , m_xBottomMF(m_xBuilder->weld_metric_spin_button("bottommf", FieldUnit::MM))
271  , m_xSynchronizeCB(m_xBuilder->weld_check_button("sync"))
272  , m_xShadowFrame(m_xBuilder->weld_container("shadow"))
273  , m_xWndShadows(new SvtValueSet(m_xBuilder->weld_scrolled_window("shadowswin")))
274  , m_xWndShadowsWin(new weld::CustomWeld(*m_xBuilder, "shadows", *m_xWndShadows))
275  , m_xFtShadowSize(m_xBuilder->weld_label("distanceft"))
276  , m_xEdShadowSize(m_xBuilder->weld_metric_spin_button("distancemf", FieldUnit::MM))
277  , m_xFtShadowColor(m_xBuilder->weld_label("shadowcolorft"))
278  , m_xLbShadowColor(new ColorListBox(m_xBuilder->weld_menu_button("shadowcolorlb"), pParent.GetFrameWeld()))
279  , m_xPropertiesFrame(m_xBuilder->weld_container("properties"))
280  , m_xMergeWithNextCB(m_xBuilder->weld_check_button("mergewithnext"))
281  , m_xMergeAdjacentBordersCB(m_xBuilder->weld_check_button("mergeadjacent"))
282  , m_xRemoveAdjcentCellBordersCB(m_xBuilder->weld_check_button("rmadjcellborders"))
283  , m_xRemoveAdjcentCellBordersFT(m_xBuilder->weld_label("rmadjcellbordersft"))
284 {
285  static std::vector<OUStringLiteral> aBorderImageIds;
286 
287  if (aBorderImageIds.empty())
288  {
290  {
291  aBorderImageIds.insert(aBorderImageIds.end(), {
292  RID_SVXBMP_CELL_NONE_32,
293  RID_SVXBMP_CELL_ALL_32,
294  RID_SVXBMP_CELL_LR_32,
295  RID_SVXBMP_CELL_TB_32,
296  RID_SVXBMP_CELL_L_32,
297  RID_SVXBMP_CELL_DIAG_32
298  });
299  }
300  else
301  {
302  aBorderImageIds.insert(aBorderImageIds.end(), {
303  RID_SVXBMP_CELL_NONE,
304  RID_SVXBMP_CELL_ALL,
305  RID_SVXBMP_CELL_LR,
306  RID_SVXBMP_CELL_TB,
307  RID_SVXBMP_CELL_L,
308  RID_SVXBMP_CELL_DIAG
309  });
310  }
311  aBorderImageIds.insert(aBorderImageIds.end(), {
312  RID_SVXBMP_HOR_NONE,
313  RID_SVXBMP_HOR_OUTER,
314  RID_SVXBMP_HOR_HOR,
315  RID_SVXBMP_HOR_ALL,
316  RID_SVXBMP_HOR_OUTER2,
317  RID_SVXBMP_VER_NONE,
318  RID_SVXBMP_VER_OUTER,
319  RID_SVXBMP_VER_VER,
320  RID_SVXBMP_VER_ALL,
321  RID_SVXBMP_VER_OUTER2,
322  RID_SVXBMP_TABLE_NONE,
323  RID_SVXBMP_TABLE_OUTER,
324  RID_SVXBMP_TABLE_OUTERH,
325  RID_SVXBMP_TABLE_ALL,
326  RID_SVXBMP_TABLE_OUTER2
327  });
328  }
329 
330  for (auto const & rImageId : aBorderImageIds)
331  m_aBorderImgVec.emplace_back(StockImage::Yes, rImageId);
332 
333  static std::vector<OUStringLiteral> aShadowImageIds;
334  if (aShadowImageIds.empty())
335  {
337  {
338  aShadowImageIds.insert(aShadowImageIds.end(), {
339  RID_SVXBMP_SHADOWNONE_32,
340  RID_SVXBMP_SHADOW_BOT_RIGHT_32,
341  RID_SVXBMP_SHADOW_TOP_RIGHT_32,
342  RID_SVXBMP_SHADOW_BOT_LEFT_32,
343  RID_SVXBMP_SHADOW_TOP_LEFT_32
344  });
345  }
346  else
347  {
348  aShadowImageIds.insert(aShadowImageIds.end(), {
349  RID_SVXBMP_SHADOWNONE,
350  RID_SVXBMP_SHADOW_BOT_RIGHT,
351  RID_SVXBMP_SHADOW_TOP_RIGHT,
352  RID_SVXBMP_SHADOW_BOT_LEFT,
353  RID_SVXBMP_SHADOW_TOP_LEFT
354  });
355  }
356  }
357 
358  for (auto const & rImageId : aShadowImageIds)
359  m_aShadowImgVec.emplace_back(StockImage::Yes, rImageId);
360 
361  assert(m_aShadowImgVec.size() == SVX_BORDER_SHADOW_COUNT);
362 
363  // this page needs ExchangeSupport
365 
366  /* Use SvxMarginItem instead of margins from SvxBoxItem, if present.
367  -> Remember this state in mbUseMarginItem, because other special handling
368  is needed across various functions... */
369  mbUseMarginItem = rCoreAttrs.GetItemState(GetWhich(SID_ATTR_ALIGN_MARGIN)) != SfxItemState::UNKNOWN;
370 
371  const SfxPoolItem* pItem = nullptr;
372  if (rCoreAttrs.HasItem(SID_ATTR_BORDER_STYLES, &pItem))
373  {
374  const SfxIntegerListItem* p = static_cast<const SfxIntegerListItem*>(pItem);
375  std::vector<sal_Int32> aUsedStyles = p->GetList();
376  for (int aUsedStyle : aUsedStyles)
377  maUsedBorderStyles.insert(static_cast<SvxBorderLineStyle>(aUsedStyle));
378  }
379 
380  if (rCoreAttrs.HasItem(SID_ATTR_BORDER_DEFAULT_WIDTH, &pItem))
381  {
382  // The caller specifies default line width. Honor it.
383  const SfxInt64Item* p = static_cast<const SfxInt64Item*>(pItem);
384  m_xLineWidthMF->set_value(p->GetValue(), FieldUnit::POINT);
385  }
386 
387  // set metric
388  FieldUnit eFUnit = GetModuleFieldUnit( rCoreAttrs );
389 
390  if( mbUseMarginItem )
391  {
392  // copied from SvxAlignmentTabPage
393  switch ( eFUnit )
394  {
395  // #103396# the default value (1pt) can't be accurately represented in
396  // inches or pica with two decimals, so point is used instead.
397  case FieldUnit::PICA:
398  case FieldUnit::INCH:
399  case FieldUnit::FOOT:
400  case FieldUnit::MILE:
401  eFUnit = FieldUnit::POINT;
402  break;
403 
404  case FieldUnit::CM:
405  case FieldUnit::M:
406  case FieldUnit::KM:
407  eFUnit = FieldUnit::MM;
408  break;
409  default: ;//prevent warning
410  }
411  }
412  else
413  {
414  switch ( eFUnit )
415  {
416  case FieldUnit::M:
417  case FieldUnit::KM:
418  eFUnit = FieldUnit::MM;
419  break;
420  default: ; //prevent warning
421  }
422  }
423 
424  SetFieldUnit(*m_xEdShadowSize, eFUnit);
425 
426  sal_uInt16 nWhich = GetWhich( SID_ATTR_BORDER_INNER, false );
427  bool bIsDontCare = true;
428 
429  if ( rCoreAttrs.GetItemState( nWhich ) >= SfxItemState::DEFAULT )
430  {
431  // paragraph or table
432  const SvxBoxInfoItem* pBoxInfo =
433  static_cast<const SvxBoxInfoItem*>(&( rCoreAttrs.Get( nWhich ) ));
434 
435  mbHorEnabled = pBoxInfo->IsHorEnabled();
436  mbVerEnabled = pBoxInfo->IsVerEnabled();
437  mbTLBREnabled = rCoreAttrs.GetItemState(GetWhich(SID_ATTR_BORDER_DIAG_TLBR)) != SfxItemState::UNKNOWN;
438  mbBLTREnabled = rCoreAttrs.GetItemState(GetWhich(SID_ATTR_BORDER_DIAG_BLTR)) != SfxItemState::UNKNOWN;
439 
440  if(pBoxInfo->IsDist())
441  {
442  SetFieldUnit(*m_xLeftMF, eFUnit);
443  SetFieldUnit(*m_xRightMF, eFUnit);
444  SetFieldUnit(*m_xTopMF, eFUnit);
445  SetFieldUnit(*m_xBottomMF, eFUnit);
446  m_xSynchronizeCB->connect_toggled(LINK(this, SvxBorderTabPage, SyncHdl_Impl));
447  m_xLeftMF->connect_value_changed(LINK(this, SvxBorderTabPage, ModifyDistanceHdl_Impl));
448  m_xRightMF->connect_value_changed(LINK(this, SvxBorderTabPage, ModifyDistanceHdl_Impl));
449  m_xTopMF->connect_value_changed(LINK(this, SvxBorderTabPage, ModifyDistanceHdl_Impl));
450  m_xBottomMF->connect_value_changed(LINK(this, SvxBorderTabPage, ModifyDistanceHdl_Impl));
451  }
452  else
453  {
454  m_xSpacingFrame->hide();
455  }
456  bIsDontCare = !pBoxInfo->IsValid( SvxBoxInfoItemValidFlags::DISABLE );
457  }
458  if(!mbUseMarginItem && eFUnit == FieldUnit::MM && MapUnit::MapTwip == rCoreAttrs.GetPool()->GetMetric( GetWhich( SID_ATTR_BORDER_INNER ) ))
459  {
460  //#i91548# changing the number of decimal digits changes the minimum values, too
466  }
467 
468  FrameSelFlags nFlags = FrameSelFlags::Outer;
469  if( mbHorEnabled )
470  nFlags |= FrameSelFlags::InnerHorizontal;
471  if( mbVerEnabled )
472  nFlags |= FrameSelFlags::InnerVertical;
473  if( mbTLBREnabled )
474  nFlags |= FrameSelFlags::DiagonalTLBR;
475  if( mbBLTREnabled )
476  nFlags |= FrameSelFlags::DiagonalBLTR;
477  if( bIsDontCare )
478  nFlags |= FrameSelFlags::DontCare;
479  m_aFrameSel.Initialize( nFlags );
480 
481  m_aFrameSel.SetSelectHdl(LINK(this, SvxBorderTabPage, LinesChanged_Impl));
482  m_xLbLineStyle->SetSelectHdl( LINK( this, SvxBorderTabPage, SelStyleHdl_Impl ) );
483  m_xLbLineColor->SetSelectHdl( LINK( this, SvxBorderTabPage, SelColHdl_Impl ) );
484  m_xLineWidthMF->connect_value_changed( LINK( this, SvxBorderTabPage, ModifyWidthHdl_Impl ) );
485  m_xWndPresets->SetSelectHdl( LINK( this, SvxBorderTabPage, SelPreHdl_Impl ) );
486  m_xWndShadows->SetSelectHdl( LINK( this, SvxBorderTabPage, SelSdwHdl_Impl ) );
487 
488  FillValueSets();
490 
491  // connections
492  if (rCoreAttrs.HasItem(GetWhich(SID_ATTR_PARA_GRABBAG), &pItem))
493  {
494  const SfxGrabBagItem* pGrabBag = static_cast<const SfxGrabBagItem*>(pItem);
495  auto it = pGrabBag->GetGrabBag().find("DialogUseCharAttr");
496  if (it != pGrabBag->GetGrabBag().end())
497  {
498  bool bDialogUseCharAttr = false;
499  it->second >>= bDialogUseCharAttr;
500  if (bDialogUseCharAttr)
501  {
502  mnShadowSlot = SID_ATTR_CHAR_SHADOW;
503  mnBoxSlot = SID_ATTR_CHAR_BOX;
504  }
505  }
506  }
507 
508  bool bSupportsShadow = !SfxItemPool::IsSlot(GetWhich(mnShadowSlot));
509  if( bSupportsShadow )
511  else
513 
514  if (mbUseMarginItem)
516 
517  // checkbox "Merge with next paragraph" only visible for Writer dialog format.paragraph
518  m_xMergeWithNextCB->hide();
519  // checkbox "Merge adjacent line styles" only visible for Writer dialog format.table
521 
523  if (pDocSh)
524  {
525  Reference< XServiceInfo > xSI( pDocSh->GetModel(), UNO_QUERY );
526  if ( xSI.is() )
527  bIsCalcDoc = xSI->supportsService("com.sun.star.sheet.SpreadsheetDocument");
528  }
529  if( bIsCalcDoc )
530  {
531  m_xRemoveAdjcentCellBordersCB->connect_toggled(LINK(this, SvxBorderTabPage, RemoveAdjacentCellBorderHdl_Impl));
533  m_xRemoveAdjcentCellBordersCB->set_sensitive(false);
534  }
535  else
536  {
539  }
540 }
541 
543 {
544  disposeOnce();
545 }
546 
548 {
549  m_xLbShadowColor.reset();
550  m_xWndShadowsWin.reset();
551  m_xWndShadows.reset();
552  m_xLbLineColor.reset();
553  m_xLbLineStyle.reset();
554  m_xFrameSelWin.reset();
555  m_xWndPresetsWin.reset();
556  m_xWndPresets.reset();
558 }
559 
561  const SfxItemSet* rAttrSet )
562 {
563  return VclPtr<SvxBorderTabPage>::Create(pParent, *rAttrSet);
564 }
565 
566 void SvxBorderTabPage::ResetFrameLine_Impl( svx::FrameBorderType eBorder, const SvxBorderLine* pCoreLine, bool bValid )
567 {
568  if( m_aFrameSel.IsBorderEnabled( eBorder ) )
569  {
570  if( bValid )
571  m_aFrameSel.ShowBorder( eBorder, pCoreLine );
572  else
573  m_aFrameSel.SetBorderDontCare( eBorder );
574  }
575 }
576 
578 {
579  if (maUsedBorderStyles.empty())
580  // All border styles are allowed.
581  return true;
582 
583  return maUsedBorderStyles.count(nStyle) > 0;
584 }
585 
587 {
588  SfxItemPool* pPool = rSet->GetPool();
589 
591  {
592  sal_uInt16 nBorderDiagId = pPool->GetWhich(SID_ATTR_BORDER_DIAG_TLBR);
593  if (const SvxLineItem* pLineItem = static_cast<const SvxLineItem*>(rSet->GetItem(nBorderDiagId)))
594  m_aFrameSel.ShowBorder(svx::FrameBorderType::TLBR, pLineItem->GetLine());
595  else
597  }
598 
600  {
601  sal_uInt16 nBorderDiagId = pPool->GetWhich(SID_ATTR_BORDER_DIAG_BLTR);
602  if (const SvxLineItem* pLineItem = static_cast<const SvxLineItem*>(rSet->GetItem(nBorderDiagId)))
603  m_aFrameSel.ShowBorder(svx::FrameBorderType::BLTR, pLineItem->GetLine());
604  else
606  }
607 
608  if (m_xShadowControls)
609  {
610  sal_uInt16 nShadowId = pPool->GetWhich(mnShadowSlot);
611  const SfxPoolItem* pItem = rSet->GetItem(nShadowId);
612  if (pItem)
613  m_xShadowControls->SetControlValue(*static_cast<const SvxShadowItem*>(pItem));
614  else
615  m_xShadowControls->SetControlDontKnow();
616  }
617 
618  if (m_xMarginControls)
619  {
620  sal_uInt16 nAlignMarginId = pPool->GetWhich(SID_ATTR_ALIGN_MARGIN);
621  const SfxPoolItem* pItem = rSet->GetItem(nAlignMarginId);
622  if (pItem)
623  m_xMarginControls->SetControlValue(*static_cast<const SvxMarginItem*>(pItem));
624  else
625  m_xMarginControls->SetControlDontKnow();
626  }
627 
628  sal_uInt16 nMergeAdjacentBordersId = pPool->GetWhich(SID_SW_COLLAPSING_BORDERS);
629  const SfxBoolItem *pMergeAdjacentBorders = static_cast<const SfxBoolItem*>(rSet->GetItem(nMergeAdjacentBordersId));
630  if (!pMergeAdjacentBorders)
632  else
633  m_xMergeAdjacentBordersCB->set_active(pMergeAdjacentBorders->GetValue());
634  m_xMergeAdjacentBordersCB->save_state();
635 
636  sal_uInt16 nMergeWithNextId = pPool->GetWhich(SID_ATTR_BORDER_CONNECT);
637  const SfxBoolItem *pMergeWithNext = static_cast<const SfxBoolItem*>(rSet->GetItem(nMergeWithNextId));
638  if (!pMergeWithNext)
640  else
641  m_xMergeWithNextCB->set_active(pMergeWithNext->GetValue());
642  m_xMergeWithNextCB->save_state();
643 
644  const SvxBoxItem* pBoxItem;
645  const SvxBoxInfoItem* pBoxInfoItem;
646  sal_uInt16 nWhichBox = GetWhich(mnBoxSlot);
647  MapUnit eCoreUnit;
648 
649  pBoxItem = static_cast<const SvxBoxItem*>(GetItem( *rSet, mnBoxSlot ));
650 
651  pBoxInfoItem = GetItem( *rSet, SID_ATTR_BORDER_INNER, false );
652 
653  eCoreUnit = pPool->GetMetric( nWhichBox );
654 
655  if ( pBoxItem && pBoxInfoItem ) // -> Don't Care
656  {
657  ResetFrameLine_Impl( svx::FrameBorderType::Left, pBoxItem->GetLeft(), pBoxInfoItem->IsValid( SvxBoxInfoItemValidFlags::LEFT ) );
658  ResetFrameLine_Impl( svx::FrameBorderType::Right, pBoxItem->GetRight(), pBoxInfoItem->IsValid( SvxBoxInfoItemValidFlags::RIGHT ) );
659  ResetFrameLine_Impl( svx::FrameBorderType::Top, pBoxItem->GetTop(), pBoxInfoItem->IsValid( SvxBoxInfoItemValidFlags::TOP ) );
660  ResetFrameLine_Impl( svx::FrameBorderType::Bottom, pBoxItem->GetBottom(), pBoxInfoItem->IsValid( SvxBoxInfoItemValidFlags::BOTTOM ) );
661  ResetFrameLine_Impl( svx::FrameBorderType::Vertical, pBoxInfoItem->GetVert(), pBoxInfoItem->IsValid( SvxBoxInfoItemValidFlags::VERT ) );
662  ResetFrameLine_Impl( svx::FrameBorderType::Horizontal, pBoxInfoItem->GetHori(), pBoxInfoItem->IsValid( SvxBoxInfoItemValidFlags::HORI ) );
663 
664 
665  // distance inside
666 
667  if( !mbUseMarginItem )
668  {
669  if (m_xLeftMF->get_visible())
670  {
671  SetMetricValue(*m_xLeftMF, pBoxInfoItem->GetDefDist(), eCoreUnit);
672  SetMetricValue(*m_xRightMF, pBoxInfoItem->GetDefDist(), eCoreUnit);
673  SetMetricValue(*m_xTopMF, pBoxInfoItem->GetDefDist(), eCoreUnit);
674  SetMetricValue(*m_xBottomMF, pBoxInfoItem->GetDefDist(), eCoreUnit);
675 
676  nMinValue = m_xLeftMF->get_value(FieldUnit::NONE);
677 
678  if ( pBoxInfoItem->IsDist() )
679  {
680  if( rSet->GetItemState( nWhichBox ) >= SfxItemState::DEFAULT )
681  {
682  bool bIsAnyBorderVisible = m_aFrameSel.IsAnyBorderVisible();
683  if( !bIsAnyBorderVisible || !pBoxInfoItem->IsMinDist() )
684  {
685  m_xLeftMF->set_min(0, FieldUnit::NONE);
686  m_xRightMF->set_min(0, FieldUnit::NONE);
687  m_xTopMF->set_min(0, FieldUnit::NONE);
688  m_xBottomMF->set_min(0, FieldUnit::NONE);
689  }
690  long nLeftDist = pBoxItem->GetDistance( SvxBoxItemLine::LEFT);
691  SetMetricValue(*m_xLeftMF, nLeftDist, eCoreUnit);
692  long nRightDist = pBoxItem->GetDistance( SvxBoxItemLine::RIGHT);
693  SetMetricValue(*m_xRightMF, nRightDist, eCoreUnit);
694  long nTopDist = pBoxItem->GetDistance( SvxBoxItemLine::TOP);
695  SetMetricValue( *m_xTopMF, nTopDist, eCoreUnit );
696  long nBottomDist = pBoxItem->GetDistance( SvxBoxItemLine::BOTTOM);
697  SetMetricValue( *m_xBottomMF, nBottomDist, eCoreUnit );
698 
699  // if the distance is set with no active border line
700  // or it is null with an active border line
701  // no automatic changes should be made
702  const long nDefDist = bIsAnyBorderVisible ? pBoxInfoItem->GetDefDist() : 0;
703  bool bDiffDist = (nDefDist != nLeftDist ||
704  nDefDist != nRightDist ||
705  nDefDist != nTopDist ||
706  nDefDist != nBottomDist);
707  if ((pBoxItem->GetSmallestDistance() || bIsAnyBorderVisible) && bDiffDist )
708  {
709  mbLeftModified = true;
710  mbRightModified = true;
711  mbTopModified = true;
712  mbBottomModified = true;
713  }
714  }
715  else
716  {
717  // #106224# different margins -> do not fill the edits
718  m_xLeftMF->set_text( OUString() );
719  m_xRightMF->set_text( OUString() );
720  m_xTopMF->set_text( OUString() );
721  m_xBottomMF->set_text( OUString() );
722  }
723  }
724  m_xLeftMF->save_value();
725  m_xRightMF->save_value();
726  m_xTopMF->save_value();
727  m_xBottomMF->save_value();
728  }
729  }
730  }
731  else
732  {
733  // avoid ResetFrameLine-calls:
735  }
736 
739 
740  // depict line (color) in controllers if unambiguous:
741 
742  {
743  // Do all visible lines show the same line widths?
744  long nWidth;
745  SvxBorderLineStyle nStyle;
746  bool bWidthEq = m_aFrameSel.GetVisibleWidth( nWidth, nStyle );
747  if( bWidthEq )
748  {
749  // Determine the width first as some styles can be missing depending on it
750  sal_Int64 nWidthPt = static_cast<sal_Int64>(MetricField::ConvertDoubleValue(
751  sal_Int64( nWidth ), m_xLineWidthMF->get_digits(),
752  MapUnit::MapTwip, FieldUnit::POINT ));
753  m_xLineWidthMF->set_value(nWidthPt, FieldUnit::POINT);
754  m_xLbLineStyle->SetWidth(nWidth);
755 
756  // then set the style
757  m_xLbLineStyle->SelectEntry( nStyle );
758  }
759  else
760  m_xLbLineStyle->SelectEntry(SvxBorderLineStyle::SOLID);
761 
762  // Do all visible lines show the same line color?
763  Color aColor;
764  bool bColorEq = m_aFrameSel.GetVisibleColor( aColor );
765  if( !bColorEq )
766  aColor = COL_BLACK;
767 
768  m_xLbLineColor->SelectEntry(aColor);
769  m_xLbLineStyle->SetColor(GetTextColor());
770 
771  // Select all visible lines, if they are all equal.
772  if( bWidthEq && bColorEq )
774 
775  // set the current style and color (caches style in control even if nothing is selected)
776  SelStyleHdl_Impl(*m_xLbLineStyle);
777  SelColHdl_Impl(*m_xLbLineColor);
778  }
779 
780  bool bEnable = m_xWndShadows->GetSelectedItemId() > 1 ;
781  m_xFtShadowSize->set_sensitive(bEnable);
782  m_xEdShadowSize->set_sensitive(bEnable);
783  m_xFtShadowColor->set_sensitive(bEnable);
784  m_xLbShadowColor->set_sensitive(bEnable);
785 
786  m_xWndPresets->SetNoSelection();
787 
788  // - no line - should not be selected
789 
790  if (m_xLbLineStyle->GetSelectEntryStyle() == SvxBorderLineStyle::NONE)
791  {
792  m_xLbLineStyle->SelectEntry(SvxBorderLineStyle::SOLID);
793  SelStyleHdl_Impl(*m_xLbLineStyle);
794  }
795 
796  const SfxPoolItem* pItem;
797  SfxObjectShell* pShell;
798  if(SfxItemState::SET == rSet->GetItemState(SID_HTML_MODE, false, &pItem) ||
799  ( nullptr != (pShell = SfxObjectShell::Current()) &&
800  nullptr != (pItem = pShell->GetItem(SID_HTML_MODE))))
801  {
802  sal_uInt16 nHtmlMode = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
803  if(nHtmlMode & HTMLMODE_ON)
804  {
805  // there are no shadows in Html-mode and only complete borders
806  m_xShadowFrame->set_sensitive(false);
807 
808  if( !(nSWMode & SwBorderModes::TABLE) )
809  {
810  m_xUserDefFT->set_sensitive(false);
811  m_xFrameSelWin->set_sensitive(false);
812  m_xWndPresets->RemoveItem(3);
813  m_xWndPresets->RemoveItem(4);
814  m_xWndPresets->RemoveItem(5);
815  }
816  }
817  }
818 
819  LinesChanged_Impl( nullptr );
820  if (m_xLeftMF->get_value(FieldUnit::NONE) == m_xRightMF->get_value(FieldUnit::NONE) &&
821  m_xTopMF->get_value(FieldUnit::NONE) == m_xBottomMF->get_value(FieldUnit::NONE) &&
822  m_xTopMF->get_value(FieldUnit::NONE) == m_xLeftMF->get_value(FieldUnit::NONE))
823  {
824  mbSync = true;
825  }
826  else
827  mbSync = false;
828  m_xSynchronizeCB->set_active(mbSync);
829 
831  m_xRemoveAdjcentCellBordersCB->set_active(false);
832  m_xRemoveAdjcentCellBordersCB->set_sensitive(false);
833 }
834 
836 {
837  m_xLeftMF->save_value();
838  m_xRightMF->save_value();
839  m_xTopMF->save_value();
840  m_xBottomMF->save_value();
841  m_xMergeWithNextCB->save_state();
842  m_xMergeAdjacentBordersCB->save_state();
843 }
844 
846 {
847  if ( _pSet )
848  FillItemSet( _pSet );
849 
850  return DeactivateRC::LeavePage;
851 }
852 
854 {
855  bool bAttrsChanged = false;
856 
857  SfxItemPool* pPool = rCoreAttrs->GetPool();
858 
860  {
861  sal_uInt16 nBorderDiagId = pPool->GetWhich(SID_ATTR_BORDER_DIAG_TLBR);
862  SvxLineItem aLineItem(*static_cast<const SvxLineItem*>(rCoreAttrs->GetItem(nBorderDiagId)));
864  rCoreAttrs->Put(aLineItem);
865  bAttrsChanged = true;
866  }
867 
869  {
870  sal_uInt16 nBorderDiagId = pPool->GetWhich(SID_ATTR_BORDER_DIAG_BLTR);
871  SvxLineItem aLineItem(*static_cast<const SvxLineItem*>(rCoreAttrs->GetItem(nBorderDiagId)));
873  rCoreAttrs->Put(aLineItem);
874  bAttrsChanged = true;
875  }
876 
877  if (m_xShadowControls && m_xShadowControls->get_value_changed_from_saved())
878  {
879  sal_uInt16 nShadowId = pPool->GetWhich(mnShadowSlot);
880  const SvxShadowItem& rOldShadowItem = *static_cast<const SvxShadowItem*>(rCoreAttrs->GetItem(nShadowId));
881  rCoreAttrs->Put(m_xShadowControls->GetControlValue(rOldShadowItem));
882  bAttrsChanged = true;
883  }
884 
885  if (m_xMarginControls && m_xMarginControls->get_value_changed_from_saved())
886  {
887  sal_uInt16 nAlignMarginId = pPool->GetWhich(SID_ATTR_ALIGN_MARGIN);
888  const SvxMarginItem& rOldMarginItem = *static_cast<const SvxMarginItem*>(rCoreAttrs->GetItem(nAlignMarginId));
889  rCoreAttrs->Put(m_xMarginControls->GetControlValue(rOldMarginItem));
890  bAttrsChanged = true;
891  }
892 
893  if (m_xMergeAdjacentBordersCB->get_state_changed_from_saved())
894  {
895  sal_uInt16 nMergeAdjacentBordersId = pPool->GetWhich(SID_SW_COLLAPSING_BORDERS);
896  auto nState = m_xMergeAdjacentBordersCB->get_state();
897  if (nState == TRISTATE_INDET)
898  rCoreAttrs->ClearItem(nMergeAdjacentBordersId);
899  else
900  {
901  std::unique_ptr<SfxBoolItem> xNewItem(static_cast<SfxBoolItem*>(rCoreAttrs->Get(nMergeAdjacentBordersId).Clone()));
902  xNewItem->SetValue(static_cast<bool>(nState));
903  rCoreAttrs->Put(std::move(xNewItem));
904  }
905  bAttrsChanged = true;
906  }
907 
908  if (m_xMergeWithNextCB->get_state_changed_from_saved())
909  {
910  sal_uInt16 nMergeWithNextId = pPool->GetWhich(SID_ATTR_BORDER_CONNECT);
911  auto nState = m_xMergeWithNextCB->get_state();
912  if (nState == TRISTATE_INDET)
913  rCoreAttrs->ClearItem(nMergeWithNextId);
914  else
915  {
916  std::unique_ptr<SfxBoolItem> xNewItem(static_cast<SfxBoolItem*>(rCoreAttrs->Get(nMergeWithNextId).Clone()));
917  xNewItem->SetValue(static_cast<bool>(nState));
918  rCoreAttrs->Put(std::move(xNewItem));
919  }
920  bAttrsChanged = true;
921  }
922 
923  bool bPut = true;
924  sal_uInt16 nBoxWhich = GetWhich( mnBoxSlot );
925  sal_uInt16 nBoxInfoWhich = pPool->GetWhich( SID_ATTR_BORDER_INNER, false );
926  const SfxItemSet& rOldSet = GetItemSet();
927  SvxBoxItem aBoxItem ( nBoxWhich );
928  SvxBoxInfoItem aBoxInfoItem ( nBoxInfoWhich );
929  const SvxBoxItem* pOldBoxItem = static_cast<const SvxBoxItem*>(GetOldItem( *rCoreAttrs, mnBoxSlot ));
930 
931  MapUnit eCoreUnit = rOldSet.GetPool()->GetMetric( nBoxWhich );
932 
933 
934  // outer border:
935 
936  std::pair<svx::FrameBorderType,SvxBoxItemLine> eTypes1[] = {
937  { svx::FrameBorderType::Top,SvxBoxItemLine::TOP },
938  { svx::FrameBorderType::Bottom,SvxBoxItemLine::BOTTOM },
939  { svx::FrameBorderType::Left,SvxBoxItemLine::LEFT },
940  { svx::FrameBorderType::Right,SvxBoxItemLine::RIGHT },
941  };
942 
943  for (std::pair<svx::FrameBorderType,SvxBoxItemLine> const & i : eTypes1)
944  aBoxItem.SetLine( m_aFrameSel.GetFrameBorderStyle( i.first ), i.second );
945 
946 
948  // border hor/ver and TableFlag
949 
950  std::pair<svx::FrameBorderType,SvxBoxInfoItemLine> eTypes2[] = {
951  { svx::FrameBorderType::Horizontal,SvxBoxInfoItemLine::HORI },
952  { svx::FrameBorderType::Vertical,SvxBoxInfoItemLine::VERT }
953  };
954  for (std::pair<svx::FrameBorderType,SvxBoxInfoItemLine> const & j : eTypes2)
955  aBoxInfoItem.SetLine( m_aFrameSel.GetFrameBorderStyle( j.first ), j.second );
956 
957  aBoxInfoItem.EnableHor( mbHorEnabled );
958  aBoxInfoItem.EnableVer( mbVerEnabled );
959 
960 
961  // inner distance
962 
963  if (m_xLeftMF->get_visible())
964  {
965  // #i40405# enable distance controls for next dialog call
966  aBoxInfoItem.SetDist( true );
967 
968  if( !mbUseMarginItem )
969  {
970  // #106224# all edits empty: do nothing
971  if( !m_xLeftMF->get_text().isEmpty() || !m_xRightMF->get_text().isEmpty() ||
972  !m_xTopMF->get_text().isEmpty() || !m_xBottomMF->get_text().isEmpty() )
973  {
974  const SvxBoxInfoItem* pOldBoxInfoItem = GetOldItem( *rCoreAttrs, SID_ATTR_BORDER_INNER );
975  if (
976  !pOldBoxItem ||
977  m_xLeftMF->get_value_changed_from_saved() ||
978  m_xRightMF->get_value_changed_from_saved() ||
979  m_xTopMF->get_value_changed_from_saved() ||
980  m_xBottomMF->get_value_changed_from_saved() ||
981  nMinValue == m_xLeftMF->get_value(FieldUnit::NONE) ||
982  nMinValue == m_xRightMF->get_value(FieldUnit::NONE) ||
983  nMinValue == m_xTopMF->get_value(FieldUnit::NONE) ||
984  nMinValue == m_xBottomMF->get_value(FieldUnit::NONE) ||
985  (pOldBoxInfoItem && !pOldBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::DISTANCE))
986  )
987  {
988  aBoxItem.SetDistance( static_cast<sal_uInt16>(GetCoreValue(*m_xLeftMF, eCoreUnit )), SvxBoxItemLine::LEFT );
989  aBoxItem.SetDistance( static_cast<sal_uInt16>(GetCoreValue(*m_xRightMF, eCoreUnit )), SvxBoxItemLine::RIGHT );
990  aBoxItem.SetDistance( static_cast<sal_uInt16>(GetCoreValue(*m_xTopMF, eCoreUnit )), SvxBoxItemLine::TOP );
991  aBoxItem.SetDistance( static_cast<sal_uInt16>(GetCoreValue(*m_xBottomMF, eCoreUnit )), SvxBoxItemLine::BOTTOM);
992  }
993  else
994  {
995  aBoxItem.SetDistance(pOldBoxItem->GetDistance(SvxBoxItemLine::LEFT ), SvxBoxItemLine::LEFT);
996  aBoxItem.SetDistance(pOldBoxItem->GetDistance(SvxBoxItemLine::RIGHT), SvxBoxItemLine::RIGHT);
997  aBoxItem.SetDistance(pOldBoxItem->GetDistance(SvxBoxItemLine::TOP ), SvxBoxItemLine::TOP);
998  aBoxItem.SetDistance(pOldBoxItem->GetDistance(SvxBoxItemLine::BOTTOM), SvxBoxItemLine::BOTTOM);
999  }
1000  aBoxInfoItem.SetValid( SvxBoxInfoItemValidFlags::DISTANCE );
1001  }
1002  }
1003  }
1004 
1005 
1006  // note Don't Care Status in the Info-Item:
1007 
1008  aBoxInfoItem.SetValid( SvxBoxInfoItemValidFlags::TOP, m_aFrameSel.GetFrameBorderState( svx::FrameBorderType::Top ) != svx::FrameBorderState::DontCare );
1009  aBoxInfoItem.SetValid( SvxBoxInfoItemValidFlags::BOTTOM, m_aFrameSel.GetFrameBorderState( svx::FrameBorderType::Bottom ) != svx::FrameBorderState::DontCare );
1010  aBoxInfoItem.SetValid( SvxBoxInfoItemValidFlags::LEFT, m_aFrameSel.GetFrameBorderState( svx::FrameBorderType::Left ) != svx::FrameBorderState::DontCare );
1011  aBoxInfoItem.SetValid( SvxBoxInfoItemValidFlags::RIGHT, m_aFrameSel.GetFrameBorderState( svx::FrameBorderType::Right ) != svx::FrameBorderState::DontCare );
1013  aBoxInfoItem.SetValid( SvxBoxInfoItemValidFlags::VERT, m_aFrameSel.GetFrameBorderState( svx::FrameBorderType::Vertical ) != svx::FrameBorderState::DontCare );
1014 
1015 
1016  // Put or Clear of the border?
1017 
1018  bPut = true;
1019 
1020  if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nBoxWhich, false ))
1021  {
1022  bPut = aBoxItem != static_cast<const SvxBoxItem&>(rOldSet.Get(nBoxWhich));
1023  }
1024  if( SfxItemState::DEFAULT == rOldSet.GetItemState( nBoxInfoWhich, false ) )
1025  {
1026  const SvxBoxInfoItem& rOldBoxInfo = static_cast<const SvxBoxInfoItem&>(
1027  rOldSet.Get(nBoxInfoWhich));
1028 
1029  aBoxInfoItem.SetMinDist( rOldBoxInfo.IsMinDist() );
1030  aBoxInfoItem.SetDefDist( rOldBoxInfo.GetDefDist() );
1031  bPut |= (aBoxInfoItem != rOldBoxInfo );
1032  }
1033 
1034  if ( bPut )
1035  {
1036  if ( !pOldBoxItem || *pOldBoxItem != aBoxItem )
1037  {
1038  rCoreAttrs->Put( aBoxItem );
1039  bAttrsChanged = true;
1040  }
1041  const SfxPoolItem* pOld = GetOldItem( *rCoreAttrs, SID_ATTR_BORDER_INNER, false );
1042 
1043  if ( !pOld || *static_cast<const SvxBoxInfoItem*>(pOld) != aBoxInfoItem )
1044  {
1045  rCoreAttrs->Put( aBoxInfoItem );
1046  bAttrsChanged = true;
1047  }
1048  }
1049  else
1050  {
1051  rCoreAttrs->ClearItem( nBoxWhich );
1052  rCoreAttrs->ClearItem( nBoxInfoWhich );
1053  }
1054 
1055  return bAttrsChanged;
1056 }
1057 
1059 {
1060  m_xShadowFrame->hide();
1061 }
1062 
1063 #define IID_PRE_CELL_NONE 1
1064 #define IID_PRE_CELL_ALL 2
1065 #define IID_PRE_CELL_LR 3
1066 #define IID_PRE_CELL_TB 4
1067 #define IID_PRE_CELL_L 5
1068 #define IID_PRE_CELL_DIAG 6
1069 #define IID_PRE_HOR_NONE 7
1070 #define IID_PRE_HOR_OUTER 8
1071 #define IID_PRE_HOR_HOR 9
1072 #define IID_PRE_HOR_ALL 10
1073 #define IID_PRE_HOR_OUTER2 11
1074 #define IID_PRE_VER_NONE 12
1075 #define IID_PRE_VER_OUTER 13
1076 #define IID_PRE_VER_VER 14
1077 #define IID_PRE_VER_ALL 15
1078 #define IID_PRE_VER_OUTER2 16
1079 #define IID_PRE_TABLE_NONE 17
1080 #define IID_PRE_TABLE_OUTER 18
1081 #define IID_PRE_TABLE_OUTERH 19
1082 #define IID_PRE_TABLE_ALL 20
1083 #define IID_PRE_TABLE_OUTER2 21
1084 
1086 {
1090 
1091  static const svx::FrameBorderState ppeStates[][ svx::FRAMEBORDERTYPE_COUNT ] =
1092  { /* Left Right Top Bot Hor Ver TLBR BLTR */
1093 /* ---------------------+--------------------------------------------------- */
1094 /* IID_PRE_CELL_NONE */ { HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE },
1095 /* IID_PRE_CELL_ALL */ { SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE, HIDE },
1096 /* IID_PRE_CELL_LR */ { SHOW, SHOW, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE },
1097 /* IID_PRE_CELL_TB */ { HIDE, HIDE, SHOW, SHOW, HIDE, HIDE, HIDE, HIDE },
1098 /* IID_PRE_CELL_L */ { SHOW, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE },
1099 /* IID_PRE_CELL_DIAG */ { HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, SHOW, SHOW },
1100 /* IID_PRE_HOR_NONE */ { HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE },
1101 /* IID_PRE_HOR_OUTER */ { SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE, HIDE },
1102 /* IID_PRE_HOR_HOR */ { HIDE, HIDE, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE },
1103 /* IID_PRE_HOR_ALL */ { SHOW, SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE },
1104 /* IID_PRE_HOR_OUTER2 */ { SHOW, SHOW, SHOW, SHOW, DONT, HIDE, HIDE, HIDE },
1105 /* IID_PRE_VER_NONE */ { HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE },
1106 /* IID_PRE_VER_OUTER */ { SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE, HIDE },
1107 /* IID_PRE_VER_VER */ { SHOW, SHOW, HIDE, HIDE, HIDE, SHOW, HIDE, HIDE },
1108 /* IID_PRE_VER_ALL */ { SHOW, SHOW, SHOW, SHOW, HIDE, SHOW, HIDE, HIDE },
1109 /* IID_PRE_VER_OUTER2 */ { SHOW, SHOW, SHOW, SHOW, HIDE, DONT, HIDE, HIDE },
1110 /* IID_PRE_TABLE_NONE */ { HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE },
1111 /* IID_PRE_TABLE_OUTER */ { SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE, HIDE },
1112 /* IID_PRE_TABLE_OUTERH */ { SHOW, SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE },
1113 /* IID_PRE_TABLE_ALL */ { SHOW, SHOW, SHOW, SHOW, SHOW, SHOW, HIDE, HIDE },
1114 /* IID_PRE_TABLE_OUTER2 */ { SHOW, SHOW, SHOW, SHOW, DONT, DONT, HIDE, HIDE }
1115  };
1116 
1117  // first hide and deselect all frame borders
1118  m_aFrameSel.HideAllBorders();
1119  m_aFrameSel.DeselectAllBorders();
1120 
1121  // Using image ID to find correct line in table above.
1122  sal_uInt16 nLine = GetPresetImageId( m_xWndPresets->GetSelectedItemId() ) - 1;
1123 
1124  // Apply all styles from the table
1125  for( int nBorder = 0; nBorder < svx::FRAMEBORDERTYPE_COUNT; ++nBorder )
1126  {
1128  switch( ppeStates[ nLine ][ nBorder ] )
1129  {
1130  case SHOW: m_aFrameSel.SelectBorder( eBorder ); break;
1131  case HIDE: /* nothing to do */ break;
1132  case DONT: m_aFrameSel.SetBorderDontCare( eBorder ); break;
1133  }
1134  }
1135 
1136  // Show all lines that have been selected above
1137  if( m_aFrameSel.IsAnyBorderSelected() )
1138  {
1139  // any visible style, but "no-line" in line list box? -> use hair-line
1140  if (m_xLbLineStyle->GetSelectEntryStyle() == SvxBorderLineStyle::NONE)
1141  m_xLbLineStyle->SelectEntry(SvxBorderLineStyle::SOLID);
1142 
1143  // set current style to all previously selected lines
1144  SelStyleHdl_Impl(*m_xLbLineStyle);
1145  SelColHdl_Impl(*m_xLbLineColor);
1146  }
1147 
1148  // Presets ValueSet does not show a selection (used as push buttons).
1149  m_xWndPresets->SetNoSelection();
1150 
1151  LinesChanged_Impl( nullptr );
1152  UpdateRemoveAdjCellBorderCB( nLine + 1 );
1153 }
1154 
1156 {
1157  bool bEnable = m_xWndShadows->GetSelectedItemId() > 1;
1158  m_xFtShadowSize->set_sensitive(bEnable);
1159  m_xEdShadowSize->set_sensitive(bEnable);
1160  m_xFtShadowColor->set_sensitive(bEnable);
1161  m_xLbShadowColor->set_sensitive(bEnable);
1162 }
1163 
1164 IMPL_LINK(SvxBorderTabPage, SelColHdl_Impl, ColorListBox&, rColorBox, void)
1165 {
1166  Color aColor = rColorBox.GetSelectEntryColor();
1167  m_aFrameSel.SetColorToSelection(aColor);
1168 }
1169 
1171 {
1172  sal_Int64 nVal = m_xLineWidthMF->get_value(FieldUnit::NONE);
1173  nVal = static_cast<sal_Int64>(MetricField::ConvertDoubleValue(
1174  nVal,
1175  m_xLineWidthMF->get_digits(),
1176  FieldUnit::POINT, MapUnit::MapTwip ));
1177  m_xLbLineStyle->SetWidth( nVal );
1178 
1179  m_aFrameSel.SetStyleToSelection( nVal,
1180  m_xLbLineStyle->GetSelectEntryStyle() );
1181 }
1182 
1184 {
1185  sal_Int64 nVal = m_xLineWidthMF->get_value(FieldUnit::NONE);
1186  nVal = static_cast<sal_Int64>(MetricField::ConvertDoubleValue(
1187  nVal,
1188  m_xLineWidthMF->get_digits(),
1189  FieldUnit::POINT, MapUnit::MapTwip ));
1190  m_aFrameSel.SetStyleToSelection ( nVal,
1191  m_xLbLineStyle->GetSelectEntryStyle() );
1192 }
1193 
1194 // ValueSet handling
1195 sal_uInt16 SvxBorderTabPage::GetPresetImageId( sal_uInt16 nValueSetIdx ) const
1196 {
1197  // table with all sets of predefined border styles
1198  static const sal_uInt16 ppnImgIds[][ SVX_BORDER_PRESET_COUNT ] =
1199  {
1200  // simple cell without diagonal frame borders
1202  // simple cell with diagonal frame borders
1204  // with horizontal inner frame border
1206  // with vertical inner frame border
1208  // with horizontal and vertical inner frame borders
1210  };
1211 
1212  // find correct set of presets
1213  int nLine = 0;
1214  if( !mbHorEnabled && !mbVerEnabled )
1215  nLine = (mbTLBREnabled || mbBLTREnabled) ? 1 : 0;
1216  else if( mbHorEnabled && !mbVerEnabled )
1217  nLine = 2;
1218  else if( !mbHorEnabled && mbVerEnabled )
1219  nLine = 3;
1220  else
1221  nLine = 4;
1222 
1223  DBG_ASSERT( (1 <= nValueSetIdx) && (nValueSetIdx <= SVX_BORDER_PRESET_COUNT),
1224  "SvxBorderTabPage::GetPresetImageId - wrong index" );
1225  return ppnImgIds[ nLine ][ nValueSetIdx - 1 ];
1226 }
1227 
1228 const char* SvxBorderTabPage::GetPresetStringId( sal_uInt16 nValueSetIdx ) const
1229 {
1230  // string resource IDs for each image (in order of the IID_PRE_* image IDs)
1231  static const char* pnStrIds[] =
1232  {
1233  RID_SVXSTR_TABLE_PRESET_NONE,
1234  RID_SVXSTR_PARA_PRESET_ALL,
1235  RID_SVXSTR_PARA_PRESET_LEFTRIGHT,
1236  RID_SVXSTR_PARA_PRESET_TOPBOTTOM,
1237  RID_SVXSTR_PARA_PRESET_ONLYLEFT,
1238  RID_SVXSTR_PARA_PRESET_DIAGONAL,
1239 
1240  RID_SVXSTR_TABLE_PRESET_NONE,
1241  RID_SVXSTR_TABLE_PRESET_ONLYOUTER,
1242  RID_SVXSTR_HOR_PRESET_ONLYHOR,
1243  RID_SVXSTR_TABLE_PRESET_OUTERALL,
1244  RID_SVXSTR_TABLE_PRESET_OUTERINNER,
1245 
1246  RID_SVXSTR_TABLE_PRESET_NONE,
1247  RID_SVXSTR_TABLE_PRESET_ONLYOUTER,
1248  RID_SVXSTR_VER_PRESET_ONLYVER,
1249  RID_SVXSTR_TABLE_PRESET_OUTERALL,
1250  RID_SVXSTR_TABLE_PRESET_OUTERINNER,
1251 
1252  RID_SVXSTR_TABLE_PRESET_NONE,
1253  RID_SVXSTR_TABLE_PRESET_ONLYOUTER,
1254  RID_SVXSTR_TABLE_PRESET_OUTERHORI,
1255  RID_SVXSTR_TABLE_PRESET_OUTERALL,
1256  RID_SVXSTR_TABLE_PRESET_OUTERINNER
1257  };
1258  return pnStrIds[ GetPresetImageId( nValueSetIdx ) - 1 ];
1259 }
1260 
1262 {
1263  // basic initialization of the ValueSet
1264  m_xWndPresets->SetStyle( m_xWndPresets->GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER );
1265  m_xWndPresets->SetColCount( SVX_BORDER_PRESET_COUNT );
1266 
1267  // insert images and help texts
1268  for( sal_uInt16 nVSIdx = 1; nVSIdx <= SVX_BORDER_PRESET_COUNT; ++nVSIdx )
1269  {
1270  m_xWndPresets->InsertItem( nVSIdx );
1271  m_xWndPresets->SetItemImage(nVSIdx, m_aBorderImgVec[GetPresetImageId(nVSIdx) - 1]);
1272  m_xWndPresets->SetItemText( nVSIdx, CuiResId( GetPresetStringId( nVSIdx ) ) );
1273  }
1274 
1275  // show the control
1276  m_xWndPresets->SetNoSelection();
1277  m_xWndPresets->SetOptimalSize();
1278  m_xWndPresets->Show();
1279 }
1280 
1282 {
1283  // basic initialization of the ValueSet
1284  m_xWndShadows->SetStyle( m_xWndShadows->GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER );
1285  m_xWndShadows->SetColCount( SVX_BORDER_SHADOW_COUNT );
1286 
1287  // string resource IDs for each image
1288  static const char* pnStrIds[ SVX_BORDER_SHADOW_COUNT ] =
1289  { RID_SVXSTR_SHADOW_STYLE_NONE, RID_SVXSTR_SHADOW_STYLE_BOTTOMRIGHT, RID_SVXSTR_SHADOW_STYLE_TOPRIGHT, RID_SVXSTR_SHADOW_STYLE_BOTTOMLEFT, RID_SVXSTR_SHADOW_STYLE_TOPLEFT };
1290 
1291  // insert images and help texts
1292  for( sal_uInt16 nVSIdx = 1; nVSIdx <= SVX_BORDER_SHADOW_COUNT; ++nVSIdx )
1293  {
1294  m_xWndShadows->InsertItem( nVSIdx );
1295  m_xWndShadows->SetItemImage(nVSIdx, m_aShadowImgVec[nVSIdx-1]);
1296  m_xWndShadows->SetItemText( nVSIdx, CuiResId( pnStrIds[ nVSIdx - 1 ] ) );
1297  }
1298 
1299  // show the control
1300  m_xWndShadows->SelectItem( 1 );
1301  m_xWndShadows->SetOptimalSize();
1302  m_xWndShadows->Show();
1303 }
1304 
1305 
1307 {
1308  FillPresetVS();
1309  FillShadowVS();
1310 }
1311 
1312 
1313 static Color lcl_mediumColor( Color aMain, Color /*aDefault*/ )
1314 {
1315  return SvxBorderLine::threeDMediumColor( aMain );
1316 }
1317 
1319 {
1320  using namespace ::com::sun::star::table::BorderLineStyle;
1321 
1322  static struct {
1323  SvxBorderLineStyle mnStyle;
1324  long mnMinWidth;
1325  SvtLineListBox::ColorFunc mpColor1Fn;
1326  SvtLineListBox::ColorFunc mpColor2Fn;
1327  SvtLineListBox::ColorDistFunc mpColorDistFn;
1328  } const aLines[] = {
1329  // Simple lines
1330  { SvxBorderLineStyle::SOLID, 0, &sameColor, &sameColor, &sameDistColor },
1331  { SvxBorderLineStyle::DOTTED, 0, &sameColor, &sameColor, &sameDistColor },
1332  { SvxBorderLineStyle::DASHED, 0, &sameColor, &sameColor, &sameDistColor },
1333  { SvxBorderLineStyle::FINE_DASHED, 0, &sameColor, &sameColor, &sameDistColor },
1334  { SvxBorderLineStyle::DASH_DOT, 0, &sameColor, &sameColor, &sameDistColor },
1335  { SvxBorderLineStyle::DASH_DOT_DOT, 0, &sameColor, &sameColor, &sameDistColor },
1336 
1337  // Double lines
1338  { SvxBorderLineStyle::DOUBLE, 10, &sameColor, &sameColor, &sameDistColor },
1339  { SvxBorderLineStyle::DOUBLE_THIN, 10, &sameColor, &sameColor, &sameDistColor },
1340  { SvxBorderLineStyle::THINTHICK_SMALLGAP, 20, &sameColor, &sameColor, &sameDistColor },
1341  { SvxBorderLineStyle::THINTHICK_MEDIUMGAP, 0, &sameColor, &sameColor, &sameDistColor },
1342  { SvxBorderLineStyle::THINTHICK_LARGEGAP, 0, &sameColor, &sameColor, &sameDistColor },
1343  { SvxBorderLineStyle::THICKTHIN_SMALLGAP, 20, &sameColor, &sameColor, &sameDistColor },
1344  { SvxBorderLineStyle::THICKTHIN_MEDIUMGAP, 0, &sameColor, &sameColor, &sameDistColor },
1345  { SvxBorderLineStyle::THICKTHIN_LARGEGAP, 0, &sameColor, &sameColor, &sameDistColor },
1346 
1347  { SvxBorderLineStyle::EMBOSSED, 15, &SvxBorderLine::threeDLightColor, &SvxBorderLine::threeDDarkColor, &lcl_mediumColor },
1348  { SvxBorderLineStyle::ENGRAVED, 15, &SvxBorderLine::threeDDarkColor, &SvxBorderLine::threeDLightColor, &lcl_mediumColor },
1349 
1350  { SvxBorderLineStyle::OUTSET, 10, &SvxBorderLine::lightColor, &SvxBorderLine::darkColor, &sameDistColor },
1351  { SvxBorderLineStyle::INSET, 10, &SvxBorderLine::darkColor, &SvxBorderLine::lightColor, &sameDistColor }
1352  };
1353 
1354  m_xLbLineStyle->SetSourceUnit( FieldUnit::TWIP );
1355 
1356  for (size_t i = 0; i < SAL_N_ELEMENTS(aLines); ++i)
1357  {
1358  if (!IsBorderLineStyleAllowed(aLines[i].mnStyle))
1359  continue;
1360 
1361  m_xLbLineStyle->InsertEntry(
1362  SvxBorderLine::getWidthImpl(aLines[i].mnStyle), aLines[i].mnStyle,
1363  aLines[i].mnMinWidth, aLines[i].mpColor1Fn, aLines[i].mpColor2Fn, aLines[i].mpColorDistFn);
1364  }
1365 
1366  sal_Int64 nVal = m_xLineWidthMF->get_value(FieldUnit::NONE);
1367  nVal = static_cast<sal_Int64>(MetricField::ConvertDoubleValue(nVal, m_xLineWidthMF->get_digits(),
1368  m_xLineWidthMF->get_unit(), MapUnit::MapTwip));
1369  m_xLbLineStyle->SetWidth( nVal );
1370 }
1371 
1372 
1374 {
1375  if (!mbUseMarginItem && m_xLeftMF->get_visible())
1376  {
1377  bool bLineSet = m_aFrameSel.IsAnyBorderVisible();
1378  bool bSpaceModified = mbLeftModified ||
1379  mbRightModified ||
1380  mbTopModified ||
1381  mbBottomModified;
1382 
1383  if(bLineSet)
1384  {
1385  if(!bSpaceModified)
1386  {
1387  m_xLeftMF->set_value(nMinValue, FieldUnit::NONE);
1388  m_xRightMF->set_value(nMinValue, FieldUnit::NONE);
1389  m_xTopMF->set_value(nMinValue, FieldUnit::NONE);
1390  m_xBottomMF->set_value(nMinValue, FieldUnit::NONE);
1391  }
1392  }
1393  else
1394  {
1395  m_xLeftMF->set_min(0, FieldUnit::NONE);
1396  m_xRightMF->set_min(0, FieldUnit::NONE);
1397  m_xTopMF->set_min(0, FieldUnit::NONE);
1398  m_xBottomMF->set_min(0, FieldUnit::NONE);
1399  }
1400  // for tables everything is allowed
1401  SvxBoxInfoItemValidFlags nValid = SvxBoxInfoItemValidFlags::TOP|SvxBoxInfoItemValidFlags::BOTTOM|SvxBoxInfoItemValidFlags::LEFT|SvxBoxInfoItemValidFlags::RIGHT;
1402 
1403  m_xLeftFT->set_sensitive( bool(nValid & SvxBoxInfoItemValidFlags::LEFT) );
1404  m_xRightFT->set_sensitive( bool(nValid & SvxBoxInfoItemValidFlags::RIGHT) );
1405  m_xTopFT->set_sensitive( bool(nValid & SvxBoxInfoItemValidFlags::TOP) );
1406  m_xBottomFT->set_sensitive( bool(nValid & SvxBoxInfoItemValidFlags::BOTTOM) );
1407  m_xLeftMF->set_sensitive( bool(nValid & SvxBoxInfoItemValidFlags::LEFT) );
1408  m_xRightMF->set_sensitive( bool(nValid & SvxBoxInfoItemValidFlags::RIGHT) );
1409  m_xTopMF->set_sensitive( bool(nValid & SvxBoxInfoItemValidFlags::TOP) );
1410  m_xBottomMF->set_sensitive( bool(nValid & SvxBoxInfoItemValidFlags::BOTTOM) );
1411  m_xSynchronizeCB->set_sensitive(m_xRightMF->get_sensitive() || m_xTopMF->get_sensitive() ||
1412  m_xBottomMF->get_sensitive() || m_xLeftMF->get_sensitive());
1413  }
1414  UpdateRemoveAdjCellBorderCB( SAL_MAX_UINT16 );
1415 }
1416 
1417 
1418 IMPL_LINK( SvxBorderTabPage, ModifyDistanceHdl_Impl, weld::MetricSpinButton&, rField, void)
1419 {
1420  if (&rField == m_xLeftMF.get())
1421  mbLeftModified = true;
1422  else if (&rField == m_xRightMF.get())
1423  mbRightModified = true;
1424  else if (&rField == m_xTopMF.get())
1425  mbTopModified = true;
1426  else if (&rField == m_xBottomMF.get())
1427  mbBottomModified = true;
1428 
1429  if (mbSync)
1430  {
1431  const auto nVal = rField.get_value(FieldUnit::NONE);
1432  if (&rField != m_xLeftMF.get())
1433  m_xLeftMF->set_value(nVal, FieldUnit::NONE);
1434  if (&rField != m_xRightMF.get())
1435  m_xRightMF->set_value(nVal, FieldUnit::NONE);
1436  if (&rField != m_xTopMF.get())
1437  m_xTopMF->set_value(nVal, FieldUnit::NONE);
1438  if (&rField != m_xBottomMF.get())
1439  m_xBottomMF->set_value(nVal, FieldUnit::NONE);
1440  }
1441 }
1442 
1443 IMPL_LINK( SvxBorderTabPage, SyncHdl_Impl, weld::ToggleButton&, rBox, void)
1444 {
1445  mbSync = rBox.get_active();
1446 }
1447 
1448 IMPL_LINK( SvxBorderTabPage, RemoveAdjacentCellBorderHdl_Impl, weld::ToggleButton&, rBox, void)
1449 {
1450  mbRemoveAdjacentCellBorders = rBox.get_active();
1451 }
1452 
1454 {
1455  if( !bIsCalcDoc )
1456  return;
1457  const SfxItemSet& rOldSet = GetItemSet();
1458  const SvxBoxInfoItem* pOldBoxInfoItem = GetOldItem( rOldSet, SID_ATTR_BORDER_INNER );
1459  const SvxBoxItem* pOldBoxItem = static_cast<const SvxBoxItem*>(GetOldItem( rOldSet, mnBoxSlot ));
1460  if( !pOldBoxInfoItem || !pOldBoxItem )
1461  return;
1462  std::pair<svx::FrameBorderType, SvxBoxInfoItemValidFlags> eTypes1[] = {
1463  { svx::FrameBorderType::Top,SvxBoxInfoItemValidFlags::TOP },
1464  { svx::FrameBorderType::Bottom,SvxBoxInfoItemValidFlags::BOTTOM },
1465  { svx::FrameBorderType::Left,SvxBoxInfoItemValidFlags::LEFT },
1466  { svx::FrameBorderType::Right,SvxBoxInfoItemValidFlags::RIGHT },
1467  };
1468  SvxBoxItemLine const eTypes2[] = {
1469  SvxBoxItemLine::TOP,
1470  SvxBoxItemLine::BOTTOM,
1471  SvxBoxItemLine::LEFT,
1472  SvxBoxItemLine::RIGHT,
1473  };
1474 
1475  // Check if current selection involves deletion of at least one border
1476  bool bBorderDeletionReq = false;
1477  for ( size_t i=0; i < SAL_N_ELEMENTS( eTypes1 ); ++i )
1478  {
1479  if( pOldBoxItem->GetLine( eTypes2[i] ) || !( pOldBoxInfoItem->IsValid( eTypes1[i].second ) ) )
1480  {
1481  if( m_aFrameSel.GetFrameBorderState( eTypes1[i].first ) == svx::FrameBorderState::Hide )
1482  {
1483  bBorderDeletionReq = true;
1484  break;
1485  }
1486  }
1487  }
1488 
1489  if( !bBorderDeletionReq && ( nPreset == IID_PRE_CELL_NONE || nPreset == IID_PRE_TABLE_NONE ) )
1490  bBorderDeletionReq = true;
1491 
1492  m_xRemoveAdjcentCellBordersCB->set_sensitive(bBorderDeletionReq);
1493 
1494  if( !bBorderDeletionReq )
1495  {
1497  m_xRemoveAdjcentCellBordersCB->set_active(false);
1498  }
1499 }
1500 
1502 {
1503  if( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
1504  FillValueSets();
1505 
1506  SfxTabPage::DataChanged( rDCEvt );
1507 }
1508 
1510 {
1511  const SfxUInt16Item* pSWModeItem = aSet.GetItem<SfxUInt16Item>(SID_SWMODE_TYPE, false);
1512  const SfxUInt32Item* pFlagItem = aSet.GetItem<SfxUInt32Item>(SID_FLAG_TYPE, false);
1513  if (pSWModeItem)
1514  {
1515  nSWMode = static_cast<SwBorderModes>(pSWModeItem->GetValue());
1516  // #i43593#
1517  // show checkbox <m_xMergeWithNextCB> for format.paragraph
1518  if ( nSWMode == SwBorderModes::PARA )
1519  {
1520  m_xMergeWithNextCB->show();
1521  m_xPropertiesFrame->show();
1522  }
1523  // show checkbox <m_xMergeAdjacentBordersCB> for format.paragraph
1524  else if ( nSWMode == SwBorderModes::TABLE )
1525  {
1526  m_xMergeAdjacentBordersCB->show();
1527  m_xPropertiesFrame->show();
1528  }
1529  }
1530  if (pFlagItem)
1531  if ( ( pFlagItem->GetValue() & SVX_HIDESHADOWCTL ) == SVX_HIDESHADOWCTL )
1533 }
1534 
1536 {
1537  nSWMode = SwBorderModes::TABLE;
1538 }
1539 
1540 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define IID_PRE_HOR_NONE
Definition: border.cxx:1069
sal_uInt16 mnShadowSlot
Definition: border.hxx:111
bool GetValue() const
virtual ~SvxBorderTabPage() override
Definition: border.cxx:542
#define IID_PRE_VER_VER
Definition: border.cxx:1076
std::unique_ptr< SvtValueSet > m_xWndShadows
Definition: border.hxx:151
bool mbHorEnabled
true = Inner horizontal border enabled.
Definition: border.hxx:113
void SetFieldUnit(weld::MetricSpinButton &rField, FieldUnit eUnit, bool bAll)
std::unique_ptr< ShadowControlsWrapper > m_xShadowControls
Definition: border.hxx:164
FrameBorderType GetFrameBorderTypeFromIndex(size_t nIndex)
bool mbUseMarginItem
Definition: border.hxx:117
FieldUnit
static Color lcl_mediumColor(Color aMain, Color)
Definition: border.cxx:1313
bool GetVisibleWidth(long &rnWidth, SvxBorderLineStyle &rnStyle) const
static const sal_uInt16 pRanges[]
Definition: border.hxx:82
constexpr::Color COL_BLACK(0x00, 0x00, 0x00)
std::unique_ptr< weld::Label > m_xRemoveAdjcentCellBordersFT
Definition: border.hxx:163
bool get_value_changed_from_saved() const
Definition: border.cxx:208
void SetLeftMargin(sal_Int16 nLeft)
void SetDefDist(sal_uInt16 nNew)
std::unique_ptr< weld::CheckButton > m_xMergeWithNextCB
Definition: border.hxx:159
bool mbLeftModified
Definition: border.hxx:118
bool IsNoSelection() const
weld::MetricSpinButton & mrRightWrp
Definition: border.hxx:72
std::string GetValue
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
bool mbRemoveAdjacentCellBorders
Definition: border.hxx:123
void SetMinDist(bool bNew)
void set_digits(unsigned int digits)
#define IID_PRE_TABLE_OUTERH
Definition: border.cxx:1081
Color(* ColorFunc)(Color)
bool IsHorEnabled() const
void SetColor(const Color &rNew)
const editeng::SvxBorderLine * GetVert() const
SvtValueSet & mrVsPos
Definition: border.hxx:53
sal_uInt16 GetValue() const
virtual void ChangesApplied() override
Definition: border.cxx:835
sal_uInt16 GetDistance(SvxBoxItemLine nLine) const
#define IID_PRE_HOR_OUTER
Definition: border.cxx:1070
sal_uInt16 GetPresetImageId(sal_uInt16 nValueSetIdx) const
Definition: border.cxx:1195
std::unique_ptr< weld::Container > m_xSpacingFrame
Definition: border.hxx:139
virtual void Reset(const SfxItemSet *) override
Definition: border.cxx:586
sal_uInt16 GetDefDist() const
bool mbBottomModified
Definition: border.hxx:121
DataChangedEventType GetType() const
std::unique_ptr< ColorListBox > m_xLbLineColor
Definition: border.hxx:136
static SfxObjectShell * Current()
sal_Int16 GetRightMargin() const
virtual void PageCreated(const SfxAllItemSet &aSet) override
Definition: border.cxx:1509
void SetLine(const editeng::SvxBorderLine *pNew)
css::uno::Reference< css::frame::XModel > GetModel() const
const editeng::SvxBorderLine * GetRight() const
sal_uInt16 mnBoxSlot
Definition: border.hxx:110
std::vector< Image > m_aShadowImgVec
Definition: border.hxx:105
void ResetFrameLine_Impl(svx::FrameBorderType eBorder, const editeng::SvxBorderLine *pCurLine, bool bValid)
share for individual Frame-/Core-Line
Definition: border.cxx:566
std::unique_ptr< weld::Container > m_xShadowFrame
Definition: border.hxx:150
static const SfxPoolItem * GetItem(const SfxItemSet &rSet, sal_uInt16 nSlot, bool bDeep=true)
std::unique_ptr< weld::CheckButton > m_xSynchronizeCB
Definition: border.hxx:148
FieldUnit GetModuleFieldUnit(const SfxItemSet &rSet)
void SetSelectHdl(const Link< LinkParamNone *, void > &rHdl)
void Initialize(FrameSelFlags nFlags)
int normalize(int nValue) const
std::unique_ptr< weld::CustomWeld > m_xWndShadowsWin
Definition: border.hxx:152
void SetControlDontKnow()
Definition: border.cxx:178
virtual MapUnit GetMetric(sal_uInt16 nWhich) const
void SaveValue()
SvxBorderLineStyle
IMPL_LINK(SvxBorderTabPage, SelColHdl_Impl, ColorListBox &, rColorBox, void)
Definition: border.cxx:1164
void SetNoSelection()
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rAttrSet)
Definition: border.cxx:560
SvxShadowLocation GetLocation() const
FrameBorderState
#define SAL_MAX_UINT16
virtual void dispose() override
Definition: border.cxx:547
SvxBoxInfoItemValidFlags
std::unique_ptr< weld::CustomWeld > m_xFrameSelWin
Definition: border.hxx:133
#define WB_ITEMBORDER
sal_uInt16 GetSelectedItemId() const
void SetExchangeSupport()
weld::Window * GetFrameWeld(SfxFrame *pFrame)
bool get_value_changed_from_saved() const
Definition: border.cxx:171
AllSettingsFlags GetFlags() const
std::unique_ptr< weld::Label > m_xFtShadowColor
Definition: border.hxx:155
bool mbBLTREnabled
true = Bottom-left to top-right border enabled.
Definition: border.hxx:116
enum SvxBorderLineStyle sal_Int16 typedef::std::vector< FontMetric > ImplFontList Color sameColor(Color rMain)
bool IsAnyBorderVisible() const
bool IsMinDist() const
std::unique_ptr< weld::Container > m_xPropertiesFrame
properties - "Merge with next paragraph" in Writer
Definition: border.hxx:158
const editeng::SvxBorderLine * GetLine(SvxBoxItemLine nLine) const
void EnableHor(bool bEnable)
std::unique_ptr< weld::MetricSpinButton > m_xBottomMF
Definition: border.hxx:147
IMPL_LINK_NOARG(SvxBorderTabPage, SelPreHdl_Impl, SvtValueSet *, void)
Definition: border.cxx:1085
virtual void dispose() override
TRISTATE_INDET
std::unique_ptr< weld::MetricSpinButton > m_xRightMF
Definition: border.hxx:143
#define IID_PRE_TABLE_NONE
Definition: border.cxx:1079
std::vector< Image > m_aBorderImgVec
Definition: border.hxx:106
const SfxItemSet & GetItemSet() const
#define SAL_N_ELEMENTS(arr)
void set_text(const OUString &rText)
void FillShadowVS()
Definition: border.cxx:1281
Color(* ColorDistFunc)(Color, Color)
#define IID_PRE_VER_NONE
Definition: border.cxx:1074
void SetTopMargin(sal_Int16 nTop)
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: border.cxx:845
weld::MetricSpinButton & mrLeftWrp
Definition: border.hxx:71
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
const editeng::SvxBorderLine * GetHori() const
const SfxPoolItem * GetOldItem(const SfxItemSet &rSet, sal_uInt16 nSlot, bool bDeep=true)
void SelectEntry(const NamedColor &rColor)
void SetRemoveAdjacentCellBorder(bool bSet)
const Color & GetColor() const
std::set< SvxBorderLineStyle > maUsedBorderStyles
Definition: border.hxx:126
NONE
SwBorderModes nSWMode
table, textframe, paragraph
Definition: border.hxx:109
const editeng::SvxBorderLine * GetTop() const
#define IID_PRE_CELL_ALL
Definition: border.cxx:1064
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
const editeng::SvxBorderLine * GetLeft() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
#define DBG_ASSERT(sCon, aError)
weld::MetricSpinButton & mrBottomWrp
Definition: border.hxx:74
std::unique_ptr< weld::MetricSpinButton > m_xEdShadowSize
Definition: border.hxx:154
std::unique_ptr< weld::CheckButton > m_xRemoveAdjcentCellBordersCB
Definition: border.hxx:162
void SetRightMargin(sal_Int16 nRight)
bool IsBorderLineStyleAllowed(SvxBorderLineStyle nStyle) const
Definition: border.cxx:577
bool IsValueChangedFromSaved() const
std::unique_ptr< ColorListBox > m_xLbShadowColor
Definition: border.hxx:156
std::unique_ptr< weld::MetricSpinButton > m_xTopMF
Definition: border.hxx:145
Color sameDistColor(Color, Color rDefault)
bool mbVerEnabled
true = Inner vertical border enabled.
Definition: border.hxx:114
bool mbTopModified
Definition: border.hxx:120
int i
int GetCoreValue(const weld::MetricSpinButton &rField, MapUnit eUnit)
bool IsBorderEnabled(FrameBorderType eBorder) const
HTMLMODE_ON
weld::MetricSpinButton & mrTopWrp
Definition: border.hxx:73
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxInfoItemLine nLine)
void FillValueSets()
Definition: border.cxx:1306
#define IID_PRE_HOR_ALL
Definition: border.cxx:1072
FrameBorderType
const char * GetPresetStringId(sal_uInt16 nValueSetIdx) const
Definition: border.cxx:1228
long const nBorder
const std::map< OUString, css::uno::Any > & GetGrabBag() const
#define IID_PRE_CELL_TB
Definition: border.cxx:1066
virtual bool FillItemSet(SfxItemSet *rCoreAttrs) override
Definition: border.cxx:853
#define IID_PRE_HOR_OUTER2
Definition: border.cxx:1073
void set_value(int nValue, FieldUnit eValueUnit)
void SetControlValue(const SvxMarginItem &rItem)
Definition: border.cxx:216
void SetBottomMargin(sal_Int16 nBottom)
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: border.cxx:1501
#define IID_PRE_VER_OUTER2
Definition: border.cxx:1078
void SetDistance(sal_uInt16 nNew, SvxBoxItemLine nLine)
const editeng::SvxBorderLine * GetFrameBorderStyle(FrameBorderType eBorder) const
bool IsValueChangedFromSaved() const
SvxShadowItem GetControlValue(const SvxShadowItem &rItem) const
Definition: border.cxx:104
bool get_sensitive() const
const sal_uInt16 SVX_BORDER_PRESET_COUNT
Definition: border.cxx:92
void SetMetricValue(weld::MetricSpinButton &rField, int nCoreValue, MapUnit eUnit)
#define IID_PRE_VER_OUTER
Definition: border.cxx:1075
bool get_value_changed_from_saved() const
bool mbRightModified
Definition: border.hxx:119
SfxItemPool * GetPool() const
OUString CuiResId(const char *pKey)
Definition: cuiresmgr.cxx:23
sal_Int16 GetBottomMargin() const
static bool IsSlot(sal_uInt16 nId)
void EnableVer(bool bEnable)
sal_Int64 GetValue() const
std::unique_ptr< weld::MetricSpinButton > m_xLeftMF
Definition: border.hxx:141
long nMinValue
minimum distance
Definition: border.hxx:108
bool GetVisibleColor(Color &rColor) const
int get_min(FieldUnit eValueUnit) const
SvxMarginItem GetControlValue(const SvxMarginItem &rItem) const
Definition: border.cxx:194
bool IsValid(SvxBoxInfoItemValidFlags nValid) const
#define IID_PRE_TABLE_OUTER
Definition: border.cxx:1080
void SelectAllVisibleBorders()
FrameSelFlags
void ShowBorder(FrameBorderType eBorder, const editeng::SvxBorderLine *pStyle)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
#define IID_PRE_CELL_L
Definition: border.cxx:1067
std::unique_ptr< weld::Label > m_xFtShadowSize
Definition: border.hxx:153
MarginControlsWrapper(weld::MetricSpinButton &rMfLeft, weld::MetricSpinButton &rMfRight, weld::MetricSpinButton &rMfTop, weld::MetricSpinButton &rMfBottom)
Definition: border.cxx:185
svx::FrameSelector m_aFrameSel
Definition: border.hxx:129
std::unique_ptr< weld::CustomWeld > m_xWndPresetsWin
Definition: border.hxx:131
void SetTableMode()
Definition: border.cxx:1535
Color const & GetSelectEntryColor() const
std::unique_ptr< SvtValueSet > m_xWndPresets
Definition: border.hxx:130
std::unique_ptr< SvtLineListBox > m_xLbLineStyle
Definition: border.hxx:135
#define IID_PRE_CELL_NONE
Definition: border.cxx:1063
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
void SetWidth(sal_uInt16 nNew)
SvxBorderTabPage(TabPageParent pParent, const SfxItemSet &rCoreAttrs)
Definition: border.cxx:237
void SetLocation(SvxShadowLocation eNew)
#define SVX_HIDESHADOWCTL
bool mbTLBREnabled
true = Top-left to bottom-right border enabled.
Definition: border.hxx:115
SvxBoxItemLine
const int FRAMEBORDERTYPE_COUNT
static VclPtr< reference_type > Create(Arg &&...arg)
sal_Int16 GetLeftMargin() const
void set_min(int min, FieldUnit eValueUnit)
bool HasItem(sal_uInt16 nWhich, const SfxPoolItem **ppItem=nullptr) const
ColorListBox & mrLbColor
Definition: border.hxx:55
#define IID_PRE_TABLE_OUTER2
Definition: border.cxx:1083
std::unique_ptr< weld::Label > m_xUserDefFT
Definition: border.hxx:132
std::unique_ptr< weld::MetricSpinButton > m_xLineWidthMF
Definition: border.hxx:137
void HideShadowControls()
Definition: border.cxx:1058
void SetControlValue(const SvxShadowItem &rItem)
Definition: border.cxx:141
DeactivateRC
const sal_uInt16 SVX_BORDER_SHADOW_COUNT
Definition: border.cxx:95
SwBorderModes
void SelectItem(sal_uInt16 nItemId)
void SetValid(SvxBoxInfoItemValidFlags nValid, bool bValid=true)
void FillLineListBox_Impl()
Definition: border.cxx:1318
FrameBorderState GetFrameBorderState(FrameBorderType eBorder) const
int get_value(FieldUnit eDestUnit) const
#define WB_DOUBLEBORDER
MapUnit
static double ConvertDoubleValue(double nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits, FieldUnit eInUnit, FieldUnit eOutUnit)
void FillPresetVS()
Definition: border.cxx:1261
#define IID_PRE_CELL_DIAG
Definition: border.cxx:1068
void SaveValue()
#define IID_PRE_CELL_LR
Definition: border.cxx:1065
#define IID_PRE_TABLE_ALL
Definition: border.cxx:1082
std::unique_ptr< MarginControlsWrapper > m_xMarginControls
Definition: border.hxx:165
void SetBorderDontCare(FrameBorderType eBorder)
#define IID_PRE_VER_ALL
Definition: border.cxx:1077
std::unique_ptr< weld::CheckButton > m_xMergeAdjacentBordersCB
Definition: border.hxx:161
ShadowControlsWrapper(SvtValueSet &rVsPos, weld::MetricSpinButton &rMfSize, ColorListBox &rLbColor)
Definition: border.cxx:97
sal_uInt16 GetSmallestDistance() const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const std::vector< sal_Int32 > & GetList() const
void SetNoSelection()
bool IsNoSelection() const
void UpdateRemoveAdjCellBorderCB(sal_uInt16 nPreset)
Definition: border.cxx:1453
#define IID_PRE_HOR_HOR
Definition: border.cxx:1071
weld::MetricSpinButton & mrMfSize
Definition: border.hxx:54
const editeng::SvxBorderLine * GetBottom() const
bool IsDist() const
int denormalize(int nValue) const
void SetControlDontKnow()
Definition: border.cxx:228
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
void SetDist(bool bNew)
bool IsVerEnabled() const
sal_uInt16 GetWidth() const
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxItemLine nLine)
sal_Int16 GetTopMargin() const
static void lcl_SetDecimalDigitsTo1(weld::MetricSpinButton &rField)
Definition: border.cxx:84