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