1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <sfx2/objsh.hxx>
21 #include <svx/svxids.hrc>
23 #include <strings.hrc>
24 #include <bitmaps.hlst>
26 #include <editeng/boxitem.hxx>
27 #include <editeng/lineitem.hxx>
29 #include <svx/dlgutil.hxx>
30 #include <dialmgr.hxx>
31 #include <sfx2/htmlmode.hxx>
32 #include <vcl/event.hxx>
33 #include <vcl/settings.hxx>
34 #include <vcl/svapp.hxx>
35 #include <svx/flagsdef.hxx>
36 #include <svl/grabbagitem.hxx>
37 #include <svl/intitem.hxx>
38 #include <svl/ilstitem.hxx>
39 #include <svl/int64item.hxx>
40 #include <sal/macros.h>
41 #include <com/sun/star/lang/XServiceInfo.hpp>
42 #include <comphelper/lok.hxx>
43 #include <svtools/unitconv.hxx>
45 using namespace ::editeng
;
46 using ::com::sun::star::uno::Reference
;
47 using ::com::sun::star::lang::XServiceInfo
;
48 using ::com::sun::star::uno::UNO_QUERY
;
53 * TabPage for setting the border attributes.
55 * a SvxShadowItem: shadow
56 * a SvxBoxItem: lines left, right, top, bottom,
57 * a SvxBoxInfo: lines vertical, horizontal, distance, flags
59 * Lines can have three conditions:
60 * 1. Show ( -> valid values )
61 * 2. Hide ( -> NULL-Pointer )
62 * 3. DontCare ( -> special Valid-Flags in the InfoItem )
65 // static ----------------------------------------------------------------
67 const sal_uInt16
SvxBorderTabPage::pRanges
[] =
69 SID_ATTR_BORDER_INNER
, SID_ATTR_BORDER_SHADOW
,
70 SID_ATTR_ALIGN_MARGIN
, SID_ATTR_ALIGN_MARGIN
,
71 SID_ATTR_BORDER_CONNECT
, SID_ATTR_BORDER_CONNECT
,
72 SID_SW_COLLAPSING_BORDERS
, SID_SW_COLLAPSING_BORDERS
,
73 SID_ATTR_BORDER_DIAG_TLBR
, SID_ATTR_BORDER_DIAG_BLTR
,
77 static void lcl_SetDecimalDigitsTo1(weld::MetricSpinButton
& rField
)
79 auto nMin
= rField
.denormalize(rField
.get_min(FieldUnit::TWIP
));
81 rField
.set_min(rField
.normalize(nMin
), FieldUnit::TWIP
);
84 // number of preset images to show
85 const sal_uInt16 SVX_BORDER_PRESET_COUNT
= 5;
87 // number of shadow images to show
88 const sal_uInt16 SVX_BORDER_SHADOW_COUNT
= 5;
90 ShadowControlsWrapper::ShadowControlsWrapper(SvtValueSet
& rVsPos
, weld::MetricSpinButton
& rMfSize
, ColorListBox
& rLbColor
)
97 SvxShadowItem
ShadowControlsWrapper::GetControlValue(const SvxShadowItem
& rItem
) const
99 SvxShadowItem
aItem(rItem
);
100 if (!mrVsPos
.IsNoSelection())
102 switch (mrVsPos
.GetSelectedItemId())
105 aItem
.SetLocation(SvxShadowLocation::NONE
);
108 aItem
.SetLocation(SvxShadowLocation::BottomRight
);
111 aItem
.SetLocation(SvxShadowLocation::TopRight
);
114 aItem
.SetLocation(SvxShadowLocation::BottomLeft
);
117 aItem
.SetLocation(SvxShadowLocation::TopLeft
);
120 aItem
.SetLocation(SvxShadowLocation::NONE
);
124 // Default value was saved; so don't change the aItem's width if the control
125 // has not changed its value, to avoid round-trip errors (like twip->cm->twip)
126 // E.g., initial 100 twip will become 0.18 cm, which will return as 102 twip
127 if (mrMfSize
.get_value_changed_from_saved())
128 aItem
.SetWidth(mrMfSize
.denormalize(mrMfSize
.get_value(FieldUnit::TWIP
)));
129 if (!mrLbColor
.IsNoSelection())
130 aItem
.SetColor(mrLbColor
.GetSelectEntryColor());
134 void ShadowControlsWrapper::SetControlValue(const SvxShadowItem
& rItem
)
136 switch (rItem
.GetLocation())
138 case SvxShadowLocation::NONE
:
139 mrVsPos
.SelectItem(1);
141 case SvxShadowLocation::BottomRight
:
142 mrVsPos
.SelectItem(2);
144 case SvxShadowLocation::TopRight
:
145 mrVsPos
.SelectItem(3);
147 case SvxShadowLocation::BottomLeft
:
148 mrVsPos
.SelectItem(4);
150 case SvxShadowLocation::TopLeft
:
151 mrVsPos
.SelectItem(5);
154 mrVsPos
.SetNoSelection();
158 mrMfSize
.set_value(mrMfSize
.normalize(rItem
.GetWidth()), FieldUnit::TWIP
);
159 mrMfSize
.save_value();
160 mrLbColor
.SelectEntry(rItem
.GetColor());
161 mrLbColor
.SaveValue();
164 bool ShadowControlsWrapper::get_value_changed_from_saved() const
166 return mrVsPos
.IsValueChangedFromSaved() ||
167 mrMfSize
.get_value_changed_from_saved() ||
168 mrLbColor
.IsValueChangedFromSaved();
171 void ShadowControlsWrapper::SetControlDontKnow()
173 mrVsPos
.SetNoSelection();
174 mrMfSize
.set_text("");
175 mrLbColor
.SetNoSelection();
178 MarginControlsWrapper::MarginControlsWrapper(weld::MetricSpinButton
& rMfLeft
, weld::MetricSpinButton
& rMfRight
,
179 weld::MetricSpinButton
& rMfTop
, weld::MetricSpinButton
& rMfBottom
)
181 , mrRightWrp(rMfRight
)
183 , mrBottomWrp(rMfBottom
)
187 SvxMarginItem
MarginControlsWrapper::GetControlValue(const SvxMarginItem
&rItem
) const
189 SvxMarginItem
aItem(rItem
);
190 if (mrLeftWrp
.get_sensitive())
191 aItem
.SetLeftMargin(mrLeftWrp
.denormalize(mrLeftWrp
.get_value(FieldUnit::TWIP
)));
192 if (mrRightWrp
.get_sensitive())
193 aItem
.SetRightMargin(mrRightWrp
.denormalize(mrRightWrp
.get_value(FieldUnit::TWIP
)));
194 if (mrTopWrp
.get_sensitive())
195 aItem
.SetTopMargin(mrTopWrp
.denormalize(mrTopWrp
.get_value(FieldUnit::TWIP
)));
196 if (mrBottomWrp
.get_sensitive())
197 aItem
.SetBottomMargin(mrBottomWrp
.denormalize(mrBottomWrp
.get_value(FieldUnit::TWIP
)));
201 bool MarginControlsWrapper::get_value_changed_from_saved() const
203 return mrLeftWrp
.get_value_changed_from_saved() ||
204 mrRightWrp
.get_value_changed_from_saved() ||
205 mrTopWrp
.get_value_changed_from_saved() ||
206 mrBottomWrp
.get_value_changed_from_saved();
209 void MarginControlsWrapper::SetControlValue(const SvxMarginItem
& rItem
)
211 mrLeftWrp
.set_value(mrLeftWrp
.normalize(rItem
.GetLeftMargin()), FieldUnit::TWIP
);
212 mrRightWrp
.set_value(mrRightWrp
.normalize(rItem
.GetRightMargin()), FieldUnit::TWIP
);
213 mrTopWrp
.set_value(mrTopWrp
.normalize(rItem
.GetTopMargin()), FieldUnit::TWIP
);
214 mrBottomWrp
.set_value(mrBottomWrp
.normalize(rItem
.GetBottomMargin()), FieldUnit::TWIP
);
215 mrLeftWrp
.save_value();
216 mrRightWrp
.save_value();
217 mrTopWrp
.save_value();
218 mrBottomWrp
.save_value();
221 void MarginControlsWrapper::SetControlDontKnow()
223 const OUString sEmpty
;
224 mrLeftWrp
.set_text(sEmpty
);
225 mrRightWrp
.set_text(sEmpty
);
226 mrTopWrp
.set_text(sEmpty
);
227 mrBottomWrp
.set_text(sEmpty
);
230 SvxBorderTabPage::SvxBorderTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rCoreAttrs
)
231 : SfxTabPage(pPage
, pController
, "cui/ui/borderpage.ui", "BorderPage", &rCoreAttrs
)
233 , nSWMode(SwBorderModes::NONE
)
234 , mnBoxSlot(SID_ATTR_BORDER_OUTER
)
235 , mnShadowSlot(SID_ATTR_BORDER_SHADOW
)
236 , mbHorEnabled(false)
237 , mbVerEnabled(false)
238 , mbTLBREnabled(false)
239 , mbBLTREnabled(false)
240 , mbUseMarginItem(false)
241 , mbLeftModified(false)
242 , mbRightModified(false)
243 , mbTopModified(false)
244 , mbBottomModified(false)
246 , mbRemoveAdjacentCellBorders(false)
248 , m_xWndPresets(new SvtValueSet(nullptr))
249 , m_xWndPresetsWin(new weld::CustomWeld(*m_xBuilder
, "presets", *m_xWndPresets
))
250 , m_xUserDefFT(m_xBuilder
->weld_label("userdefft"))
251 , m_xFrameSelWin(new weld::CustomWeld(*m_xBuilder
, "framesel", m_aFrameSel
))
252 , m_xLbLineStyle(new SvtLineListBox(m_xBuilder
->weld_menu_button("linestylelb")))
253 , m_xLbLineColor(new ColorListBox(m_xBuilder
->weld_menu_button("linecolorlb"), pController
->getDialog()))
254 , m_xLineWidthMF(m_xBuilder
->weld_metric_spin_button("linewidthmf", FieldUnit::POINT
))
255 , m_xSpacingFrame(m_xBuilder
->weld_container("spacing"))
256 , m_xLeftFT(m_xBuilder
->weld_label("leftft"))
257 , m_xLeftMF(m_xBuilder
->weld_metric_spin_button("leftmf", FieldUnit::MM
))
258 , m_xRightFT(m_xBuilder
->weld_label("rightft"))
259 , m_xRightMF(m_xBuilder
->weld_metric_spin_button("rightmf", FieldUnit::MM
))
260 , m_xTopFT(m_xBuilder
->weld_label("topft"))
261 , m_xTopMF(m_xBuilder
->weld_metric_spin_button("topmf", FieldUnit::MM
))
262 , m_xBottomFT(m_xBuilder
->weld_label("bottomft"))
263 , m_xBottomMF(m_xBuilder
->weld_metric_spin_button("bottommf", FieldUnit::MM
))
264 , m_xSynchronizeCB(m_xBuilder
->weld_check_button("sync"))
265 , m_xShadowFrame(m_xBuilder
->weld_container("shadow"))
266 , m_xWndShadows(new SvtValueSet(nullptr))
267 , m_xWndShadowsWin(new weld::CustomWeld(*m_xBuilder
, "shadows", *m_xWndShadows
))
268 , m_xFtShadowSize(m_xBuilder
->weld_label("distanceft"))
269 , m_xEdShadowSize(m_xBuilder
->weld_metric_spin_button("distancemf", FieldUnit::MM
))
270 , m_xFtShadowColor(m_xBuilder
->weld_label("shadowcolorft"))
271 , m_xLbShadowColor(new ColorListBox(m_xBuilder
->weld_menu_button("shadowcolorlb"), pController
->getDialog()))
272 , m_xPropertiesFrame(m_xBuilder
->weld_container("properties"))
273 , m_xMergeWithNextCB(m_xBuilder
->weld_check_button("mergewithnext"))
274 , m_xMergeAdjacentBordersCB(m_xBuilder
->weld_check_button("mergeadjacent"))
275 , m_xRemoveAdjcentCellBordersCB(m_xBuilder
->weld_check_button("rmadjcellborders"))
276 , m_xRemoveAdjcentCellBordersFT(m_xBuilder
->weld_label("rmadjcellbordersft"))
278 static std::vector
<OUStringLiteral
> aBorderImageIds
;
280 if (aBorderImageIds
.empty())
282 if (comphelper::LibreOfficeKit::isActive())
284 aBorderImageIds
.insert(aBorderImageIds
.end(), {
285 RID_SVXBMP_CELL_NONE_32
,
286 RID_SVXBMP_CELL_ALL_32
,
287 RID_SVXBMP_CELL_LR_32
,
288 RID_SVXBMP_CELL_TB_32
,
289 RID_SVXBMP_CELL_L_32
,
290 RID_SVXBMP_CELL_DIAG_32
295 aBorderImageIds
.insert(aBorderImageIds
.end(), {
296 RID_SVXBMP_CELL_NONE
,
304 aBorderImageIds
.insert(aBorderImageIds
.end(), {
306 RID_SVXBMP_HOR_OUTER
,
309 RID_SVXBMP_HOR_OUTER2
,
311 RID_SVXBMP_VER_OUTER
,
314 RID_SVXBMP_VER_OUTER2
,
315 RID_SVXBMP_TABLE_NONE
,
316 RID_SVXBMP_TABLE_OUTER
,
317 RID_SVXBMP_TABLE_OUTERH
,
318 RID_SVXBMP_TABLE_ALL
,
319 RID_SVXBMP_TABLE_OUTER2
323 for (auto const & rImageId
: aBorderImageIds
)
324 m_aBorderImgVec
.emplace_back(StockImage::Yes
, rImageId
);
326 static std::vector
<OUStringLiteral
> aShadowImageIds
;
327 if (aShadowImageIds
.empty())
329 if (comphelper::LibreOfficeKit::isActive())
331 aShadowImageIds
.insert(aShadowImageIds
.end(), {
332 RID_SVXBMP_SHADOWNONE_32
,
333 RID_SVXBMP_SHADOW_BOT_RIGHT_32
,
334 RID_SVXBMP_SHADOW_TOP_RIGHT_32
,
335 RID_SVXBMP_SHADOW_BOT_LEFT_32
,
336 RID_SVXBMP_SHADOW_TOP_LEFT_32
341 aShadowImageIds
.insert(aShadowImageIds
.end(), {
342 RID_SVXBMP_SHADOWNONE
,
343 RID_SVXBMP_SHADOW_BOT_RIGHT
,
344 RID_SVXBMP_SHADOW_TOP_RIGHT
,
345 RID_SVXBMP_SHADOW_BOT_LEFT
,
346 RID_SVXBMP_SHADOW_TOP_LEFT
351 for (auto const & rImageId
: aShadowImageIds
)
352 m_aShadowImgVec
.emplace_back(StockImage::Yes
, rImageId
);
354 assert(m_aShadowImgVec
.size() == SVX_BORDER_SHADOW_COUNT
);
356 // this page needs ExchangeSupport
357 SetExchangeSupport();
359 /* Use SvxMarginItem instead of margins from SvxBoxItem, if present.
360 -> Remember this state in mbUseMarginItem, because other special handling
361 is needed across various functions... */
362 mbUseMarginItem
= rCoreAttrs
.GetItemState(GetWhich(SID_ATTR_ALIGN_MARGIN
)) != SfxItemState::UNKNOWN
;
364 const SfxPoolItem
* pItem
= nullptr;
365 if (rCoreAttrs
.HasItem(SID_ATTR_BORDER_STYLES
, &pItem
))
367 const SfxIntegerListItem
* p
= static_cast<const SfxIntegerListItem
*>(pItem
);
368 std::vector
<sal_Int32
> aUsedStyles
= p
->GetList();
369 for (int aUsedStyle
: aUsedStyles
)
370 maUsedBorderStyles
.insert(static_cast<SvxBorderLineStyle
>(aUsedStyle
));
373 if (rCoreAttrs
.HasItem(SID_ATTR_BORDER_DEFAULT_WIDTH
, &pItem
))
375 // The caller specifies default line width. Honor it.
376 const SfxInt64Item
* p
= static_cast<const SfxInt64Item
*>(pItem
);
377 m_xLineWidthMF
->set_value(p
->GetValue(), FieldUnit::POINT
);
381 FieldUnit eFUnit
= GetModuleFieldUnit( rCoreAttrs
);
383 if( mbUseMarginItem
)
385 // copied from SvxAlignmentTabPage
388 // #103396# the default value (1pt) can't be accurately represented in
389 // inches or pica with two decimals, so point is used instead.
390 case FieldUnit::PICA
:
391 case FieldUnit::INCH
:
392 case FieldUnit::FOOT
:
393 case FieldUnit::MILE
:
394 eFUnit
= FieldUnit::POINT
;
400 eFUnit
= FieldUnit::MM
;
402 default: ;//prevent warning
411 eFUnit
= FieldUnit::MM
;
413 default: ; //prevent warning
417 SetFieldUnit(*m_xEdShadowSize
, eFUnit
);
419 sal_uInt16 nWhich
= GetWhich( SID_ATTR_BORDER_INNER
, false );
420 bool bIsDontCare
= true;
422 if ( rCoreAttrs
.GetItemState( nWhich
) >= SfxItemState::DEFAULT
)
424 // paragraph or table
425 const SvxBoxInfoItem
* pBoxInfo
=
426 static_cast<const SvxBoxInfoItem
*>(&( rCoreAttrs
.Get( nWhich
) ));
428 mbHorEnabled
= pBoxInfo
->IsHorEnabled();
429 mbVerEnabled
= pBoxInfo
->IsVerEnabled();
430 mbTLBREnabled
= rCoreAttrs
.GetItemState(GetWhich(SID_ATTR_BORDER_DIAG_TLBR
)) != SfxItemState::UNKNOWN
;
431 mbBLTREnabled
= rCoreAttrs
.GetItemState(GetWhich(SID_ATTR_BORDER_DIAG_BLTR
)) != SfxItemState::UNKNOWN
;
433 if(pBoxInfo
->IsDist())
435 SetFieldUnit(*m_xLeftMF
, eFUnit
);
436 SetFieldUnit(*m_xRightMF
, eFUnit
);
437 SetFieldUnit(*m_xTopMF
, eFUnit
);
438 SetFieldUnit(*m_xBottomMF
, eFUnit
);
439 m_xSynchronizeCB
->connect_toggled(LINK(this, SvxBorderTabPage
, SyncHdl_Impl
));
440 m_xLeftMF
->connect_value_changed(LINK(this, SvxBorderTabPage
, ModifyDistanceHdl_Impl
));
441 m_xRightMF
->connect_value_changed(LINK(this, SvxBorderTabPage
, ModifyDistanceHdl_Impl
));
442 m_xTopMF
->connect_value_changed(LINK(this, SvxBorderTabPage
, ModifyDistanceHdl_Impl
));
443 m_xBottomMF
->connect_value_changed(LINK(this, SvxBorderTabPage
, ModifyDistanceHdl_Impl
));
447 m_xSpacingFrame
->hide();
449 bIsDontCare
= !pBoxInfo
->IsValid( SvxBoxInfoItemValidFlags::DISABLE
);
451 if(!mbUseMarginItem
&& eFUnit
== FieldUnit::MM
&& MapUnit::MapTwip
== rCoreAttrs
.GetPool()->GetMetric( GetWhich( SID_ATTR_BORDER_INNER
) ))
453 //#i91548# changing the number of decimal digits changes the minimum values, too
454 lcl_SetDecimalDigitsTo1(*m_xLeftMF
);
455 lcl_SetDecimalDigitsTo1(*m_xRightMF
);
456 lcl_SetDecimalDigitsTo1(*m_xTopMF
);
457 lcl_SetDecimalDigitsTo1(*m_xBottomMF
);
458 lcl_SetDecimalDigitsTo1(*m_xEdShadowSize
);
461 FrameSelFlags nFlags
= FrameSelFlags::Outer
;
463 nFlags
|= FrameSelFlags::InnerHorizontal
;
465 nFlags
|= FrameSelFlags::InnerVertical
;
467 nFlags
|= FrameSelFlags::DiagonalTLBR
;
469 nFlags
|= FrameSelFlags::DiagonalBLTR
;
471 nFlags
|= FrameSelFlags::DontCare
;
472 m_aFrameSel
.Initialize( nFlags
);
474 m_aFrameSel
.SetSelectHdl(LINK(this, SvxBorderTabPage
, LinesChanged_Impl
));
475 m_xLbLineStyle
->SetSelectHdl( LINK( this, SvxBorderTabPage
, SelStyleHdl_Impl
) );
476 m_xLbLineColor
->SetSelectHdl( LINK( this, SvxBorderTabPage
, SelColHdl_Impl
) );
477 m_xLineWidthMF
->connect_value_changed( LINK( this, SvxBorderTabPage
, ModifyWidthHdl_Impl
) );
478 m_xWndPresets
->SetSelectHdl( LINK( this, SvxBorderTabPage
, SelPreHdl_Impl
) );
479 m_xWndShadows
->SetSelectHdl( LINK( this, SvxBorderTabPage
, SelSdwHdl_Impl
) );
482 FillLineListBox_Impl();
485 if (rCoreAttrs
.HasItem(GetWhich(SID_ATTR_PARA_GRABBAG
), &pItem
))
487 const SfxGrabBagItem
* pGrabBag
= static_cast<const SfxGrabBagItem
*>(pItem
);
488 auto it
= pGrabBag
->GetGrabBag().find("DialogUseCharAttr");
489 if (it
!= pGrabBag
->GetGrabBag().end())
491 bool bDialogUseCharAttr
= false;
492 it
->second
>>= bDialogUseCharAttr
;
493 if (bDialogUseCharAttr
)
495 mnShadowSlot
= SID_ATTR_CHAR_SHADOW
;
496 mnBoxSlot
= SID_ATTR_CHAR_BOX
;
501 bool bSupportsShadow
= !SfxItemPool::IsSlot(GetWhich(mnShadowSlot
));
502 if( bSupportsShadow
)
503 m_xShadowControls
.reset(new ShadowControlsWrapper(*m_xWndShadows
, *m_xEdShadowSize
, *m_xLbShadowColor
));
505 HideShadowControls();
508 m_xMarginControls
.reset(new MarginControlsWrapper(*m_xLeftMF
, *m_xRightMF
, *m_xTopMF
, *m_xBottomMF
));
510 // checkbox "Merge with next paragraph" only visible for Writer dialog format.paragraph
511 m_xMergeWithNextCB
->hide();
512 // checkbox "Merge adjacent line styles" only visible for Writer dialog format.table
513 m_xMergeAdjacentBordersCB
->hide();
515 SfxObjectShell
* pDocSh
= SfxObjectShell::Current();
518 Reference
< XServiceInfo
> xSI( pDocSh
->GetModel(), UNO_QUERY
);
520 bIsCalcDoc
= xSI
->supportsService("com.sun.star.sheet.SpreadsheetDocument");
524 m_xRemoveAdjcentCellBordersCB
->connect_toggled(LINK(this, SvxBorderTabPage
, RemoveAdjacentCellBorderHdl_Impl
));
525 m_xRemoveAdjcentCellBordersCB
->show();
526 m_xRemoveAdjcentCellBordersCB
->set_sensitive(false);
530 m_xRemoveAdjcentCellBordersCB
->hide();
531 m_xRemoveAdjcentCellBordersFT
->hide();
535 SvxBorderTabPage::~SvxBorderTabPage()
537 m_xLbShadowColor
.reset();
538 m_xWndShadowsWin
.reset();
539 m_xWndShadows
.reset();
540 m_xLbLineColor
.reset();
541 m_xLbLineStyle
.reset();
542 m_xFrameSelWin
.reset();
543 m_xWndPresetsWin
.reset();
544 m_xWndPresets
.reset();
547 std::unique_ptr
<SfxTabPage
> SvxBorderTabPage::Create( weld::Container
* pPage
, weld::DialogController
* pController
,
548 const SfxItemSet
* rAttrSet
)
550 return std::make_unique
<SvxBorderTabPage
>(pPage
, pController
, *rAttrSet
);
553 void SvxBorderTabPage::ResetFrameLine_Impl( svx::FrameBorderType eBorder
, const SvxBorderLine
* pCoreLine
, bool bValid
)
555 if( m_aFrameSel
.IsBorderEnabled( eBorder
) )
558 m_aFrameSel
.ShowBorder( eBorder
, pCoreLine
);
560 m_aFrameSel
.SetBorderDontCare( eBorder
);
564 bool SvxBorderTabPage::IsBorderLineStyleAllowed( SvxBorderLineStyle nStyle
) const
566 if (maUsedBorderStyles
.empty())
567 // All border styles are allowed.
570 return maUsedBorderStyles
.count(nStyle
) > 0;
573 void SvxBorderTabPage::Reset( const SfxItemSet
* rSet
)
575 SfxItemPool
* pPool
= rSet
->GetPool();
577 if (m_aFrameSel
.IsBorderEnabled(svx::FrameBorderType::TLBR
))
579 sal_uInt16 nBorderDiagId
= pPool
->GetWhich(SID_ATTR_BORDER_DIAG_TLBR
);
580 if (const SvxLineItem
* pLineItem
= static_cast<const SvxLineItem
*>(rSet
->GetItem(nBorderDiagId
)))
581 m_aFrameSel
.ShowBorder(svx::FrameBorderType::TLBR
, pLineItem
->GetLine());
583 m_aFrameSel
.SetBorderDontCare(svx::FrameBorderType::TLBR
);
586 if (m_aFrameSel
.IsBorderEnabled(svx::FrameBorderType::BLTR
))
588 sal_uInt16 nBorderDiagId
= pPool
->GetWhich(SID_ATTR_BORDER_DIAG_BLTR
);
589 if (const SvxLineItem
* pLineItem
= static_cast<const SvxLineItem
*>(rSet
->GetItem(nBorderDiagId
)))
590 m_aFrameSel
.ShowBorder(svx::FrameBorderType::BLTR
, pLineItem
->GetLine());
592 m_aFrameSel
.SetBorderDontCare(svx::FrameBorderType::BLTR
);
595 if (m_xShadowControls
)
597 sal_uInt16 nShadowId
= pPool
->GetWhich(mnShadowSlot
);
598 const SfxPoolItem
* pItem
= rSet
->GetItem(nShadowId
);
600 m_xShadowControls
->SetControlValue(*static_cast<const SvxShadowItem
*>(pItem
));
602 m_xShadowControls
->SetControlDontKnow();
605 if (m_xMarginControls
)
607 sal_uInt16 nAlignMarginId
= pPool
->GetWhich(SID_ATTR_ALIGN_MARGIN
);
608 const SfxPoolItem
* pItem
= rSet
->GetItem(nAlignMarginId
);
610 m_xMarginControls
->SetControlValue(*static_cast<const SvxMarginItem
*>(pItem
));
612 m_xMarginControls
->SetControlDontKnow();
615 sal_uInt16 nMergeAdjacentBordersId
= pPool
->GetWhich(SID_SW_COLLAPSING_BORDERS
);
616 const SfxBoolItem
*pMergeAdjacentBorders
= static_cast<const SfxBoolItem
*>(rSet
->GetItem(nMergeAdjacentBordersId
));
617 if (!pMergeAdjacentBorders
)
618 m_xMergeAdjacentBordersCB
->set_state(TRISTATE_INDET
);
620 m_xMergeAdjacentBordersCB
->set_active(pMergeAdjacentBorders
->GetValue());
621 m_xMergeAdjacentBordersCB
->save_state();
623 sal_uInt16 nMergeWithNextId
= pPool
->GetWhich(SID_ATTR_BORDER_CONNECT
);
624 const SfxBoolItem
*pMergeWithNext
= static_cast<const SfxBoolItem
*>(rSet
->GetItem(nMergeWithNextId
));
626 m_xMergeWithNextCB
->set_state(TRISTATE_INDET
);
628 m_xMergeWithNextCB
->set_active(pMergeWithNext
->GetValue());
629 m_xMergeWithNextCB
->save_state();
631 const SvxBoxItem
* pBoxItem
;
632 const SvxBoxInfoItem
* pBoxInfoItem
;
633 sal_uInt16 nWhichBox
= GetWhich(mnBoxSlot
);
636 pBoxItem
= static_cast<const SvxBoxItem
*>(GetItem( *rSet
, mnBoxSlot
));
638 pBoxInfoItem
= GetItem( *rSet
, SID_ATTR_BORDER_INNER
, false );
640 eCoreUnit
= pPool
->GetMetric( nWhichBox
);
642 if ( pBoxItem
&& pBoxInfoItem
) // -> Don't Care
644 ResetFrameLine_Impl( svx::FrameBorderType::Left
, pBoxItem
->GetLeft(), pBoxInfoItem
->IsValid( SvxBoxInfoItemValidFlags::LEFT
) );
645 ResetFrameLine_Impl( svx::FrameBorderType::Right
, pBoxItem
->GetRight(), pBoxInfoItem
->IsValid( SvxBoxInfoItemValidFlags::RIGHT
) );
646 ResetFrameLine_Impl( svx::FrameBorderType::Top
, pBoxItem
->GetTop(), pBoxInfoItem
->IsValid( SvxBoxInfoItemValidFlags::TOP
) );
647 ResetFrameLine_Impl( svx::FrameBorderType::Bottom
, pBoxItem
->GetBottom(), pBoxInfoItem
->IsValid( SvxBoxInfoItemValidFlags::BOTTOM
) );
648 ResetFrameLine_Impl( svx::FrameBorderType::Vertical
, pBoxInfoItem
->GetVert(), pBoxInfoItem
->IsValid( SvxBoxInfoItemValidFlags::VERT
) );
649 ResetFrameLine_Impl( svx::FrameBorderType::Horizontal
, pBoxInfoItem
->GetHori(), pBoxInfoItem
->IsValid( SvxBoxInfoItemValidFlags::HORI
) );
654 if( !mbUseMarginItem
)
656 if (m_xLeftMF
->get_visible())
658 SetMetricValue(*m_xLeftMF
, pBoxInfoItem
->GetDefDist(), eCoreUnit
);
659 SetMetricValue(*m_xRightMF
, pBoxInfoItem
->GetDefDist(), eCoreUnit
);
660 SetMetricValue(*m_xTopMF
, pBoxInfoItem
->GetDefDist(), eCoreUnit
);
661 SetMetricValue(*m_xBottomMF
, pBoxInfoItem
->GetDefDist(), eCoreUnit
);
663 nMinValue
= m_xLeftMF
->get_value(FieldUnit::NONE
);
665 if ( pBoxInfoItem
->IsDist() )
667 if( rSet
->GetItemState( nWhichBox
) >= SfxItemState::DEFAULT
)
669 bool bIsAnyBorderVisible
= m_aFrameSel
.IsAnyBorderVisible();
670 if( !bIsAnyBorderVisible
|| !pBoxInfoItem
->IsMinDist() )
672 m_xLeftMF
->set_min(0, FieldUnit::NONE
);
673 m_xRightMF
->set_min(0, FieldUnit::NONE
);
674 m_xTopMF
->set_min(0, FieldUnit::NONE
);
675 m_xBottomMF
->set_min(0, FieldUnit::NONE
);
677 long nLeftDist
= pBoxItem
->GetDistance( SvxBoxItemLine::LEFT
);
678 SetMetricValue(*m_xLeftMF
, nLeftDist
, eCoreUnit
);
679 long nRightDist
= pBoxItem
->GetDistance( SvxBoxItemLine::RIGHT
);
680 SetMetricValue(*m_xRightMF
, nRightDist
, eCoreUnit
);
681 long nTopDist
= pBoxItem
->GetDistance( SvxBoxItemLine::TOP
);
682 SetMetricValue( *m_xTopMF
, nTopDist
, eCoreUnit
);
683 long nBottomDist
= pBoxItem
->GetDistance( SvxBoxItemLine::BOTTOM
);
684 SetMetricValue( *m_xBottomMF
, nBottomDist
, eCoreUnit
);
686 // if the distance is set with no active border line
687 // or it is null with an active border line
688 // no automatic changes should be made
689 const long nDefDist
= bIsAnyBorderVisible
? pBoxInfoItem
->GetDefDist() : 0;
690 bool bDiffDist
= (nDefDist
!= nLeftDist
||
691 nDefDist
!= nRightDist
||
692 nDefDist
!= nTopDist
||
693 nDefDist
!= nBottomDist
);
694 if ((pBoxItem
->GetSmallestDistance() || bIsAnyBorderVisible
) && bDiffDist
)
696 mbLeftModified
= true;
697 mbRightModified
= true;
698 mbTopModified
= true;
699 mbBottomModified
= true;
704 // #106224# different margins -> do not fill the edits
705 m_xLeftMF
->set_text( OUString() );
706 m_xRightMF
->set_text( OUString() );
707 m_xTopMF
->set_text( OUString() );
708 m_xBottomMF
->set_text( OUString() );
711 m_xLeftMF
->save_value();
712 m_xRightMF
->save_value();
713 m_xTopMF
->save_value();
714 m_xBottomMF
->save_value();
720 // avoid ResetFrameLine-calls:
721 m_aFrameSel
.HideAllBorders();
724 if( !m_aFrameSel
.IsAnyBorderVisible() )
725 m_aFrameSel
.DeselectAllBorders();
727 // depict line (color) in controllers if unambiguous:
730 // Do all visible lines show the same line widths?
732 SvxBorderLineStyle nStyle
;
733 bool bWidthEq
= m_aFrameSel
.GetVisibleWidth( nWidth
, nStyle
);
736 // Determine the width first as some styles can be missing depending on it
737 sal_Int64 nWidthPt
= static_cast<sal_Int64
>(MetricField::ConvertDoubleValue(
738 sal_Int64( nWidth
), m_xLineWidthMF
->get_digits(),
739 MapUnit::MapTwip
, FieldUnit::POINT
));
740 m_xLineWidthMF
->set_value(nWidthPt
, FieldUnit::POINT
);
741 m_xLbLineStyle
->SetWidth(nWidth
);
743 // then set the style
744 m_xLbLineStyle
->SelectEntry( nStyle
);
747 m_xLbLineStyle
->SelectEntry(SvxBorderLineStyle::SOLID
);
749 // Do all visible lines show the same line color?
751 bool bColorEq
= m_aFrameSel
.GetVisibleColor( aColor
);
755 m_xLbLineColor
->SelectEntry(aColor
);
756 auto nTextColor
= Application::GetSettings().GetStyleSettings().GetWindowTextColor();
757 m_xLbLineStyle
->SetColor(nTextColor
);
759 // Select all visible lines, if they are all equal.
760 if( bWidthEq
&& bColorEq
)
761 m_aFrameSel
.SelectAllVisibleBorders();
763 // set the current style and color (caches style in control even if nothing is selected)
764 SelStyleHdl_Impl(*m_xLbLineStyle
);
765 SelColHdl_Impl(*m_xLbLineColor
);
768 bool bEnable
= m_xWndShadows
->GetSelectedItemId() > 1 ;
769 m_xFtShadowSize
->set_sensitive(bEnable
);
770 m_xEdShadowSize
->set_sensitive(bEnable
);
771 m_xFtShadowColor
->set_sensitive(bEnable
);
772 m_xLbShadowColor
->set_sensitive(bEnable
);
774 m_xWndPresets
->SetNoSelection();
776 // - no line - should not be selected
778 if (m_xLbLineStyle
->GetSelectEntryStyle() == SvxBorderLineStyle::NONE
)
780 m_xLbLineStyle
->SelectEntry(SvxBorderLineStyle::SOLID
);
781 SelStyleHdl_Impl(*m_xLbLineStyle
);
784 const SfxPoolItem
* pItem
;
785 SfxObjectShell
* pShell
;
786 if(SfxItemState::SET
== rSet
->GetItemState(SID_HTML_MODE
, false, &pItem
) ||
787 ( nullptr != (pShell
= SfxObjectShell::Current()) &&
788 nullptr != (pItem
= pShell
->GetItem(SID_HTML_MODE
))))
790 sal_uInt16 nHtmlMode
= static_cast<const SfxUInt16Item
*>(pItem
)->GetValue();
791 if(nHtmlMode
& HTMLMODE_ON
)
793 // there are no shadows in Html-mode and only complete borders
794 m_xShadowFrame
->set_sensitive(false);
796 if( !(nSWMode
& SwBorderModes::TABLE
) )
798 m_xUserDefFT
->set_sensitive(false);
799 m_xFrameSelWin
->set_sensitive(false);
800 m_xWndPresets
->RemoveItem(3);
801 m_xWndPresets
->RemoveItem(4);
802 m_xWndPresets
->RemoveItem(5);
807 LinesChanged_Impl( nullptr );
808 if (m_xLeftMF
->get_value(FieldUnit::NONE
) == m_xRightMF
->get_value(FieldUnit::NONE
) &&
809 m_xTopMF
->get_value(FieldUnit::NONE
) == m_xBottomMF
->get_value(FieldUnit::NONE
) &&
810 m_xTopMF
->get_value(FieldUnit::NONE
) == m_xLeftMF
->get_value(FieldUnit::NONE
))
816 m_xSynchronizeCB
->set_active(mbSync
);
818 mbRemoveAdjacentCellBorders
= false;
819 m_xRemoveAdjcentCellBordersCB
->set_active(false);
820 m_xRemoveAdjcentCellBordersCB
->set_sensitive(false);
823 void SvxBorderTabPage::ChangesApplied()
825 m_xLeftMF
->save_value();
826 m_xRightMF
->save_value();
827 m_xTopMF
->save_value();
828 m_xBottomMF
->save_value();
829 m_xMergeWithNextCB
->save_state();
830 m_xMergeAdjacentBordersCB
->save_state();
833 DeactivateRC
SvxBorderTabPage::DeactivatePage( SfxItemSet
* _pSet
)
836 FillItemSet( _pSet
);
838 return DeactivateRC::LeavePage
;
841 bool SvxBorderTabPage::FillItemSet( SfxItemSet
* rCoreAttrs
)
843 bool bAttrsChanged
= false;
845 SfxItemPool
* pPool
= rCoreAttrs
->GetPool();
847 if (m_aFrameSel
.IsBorderEnabled(svx::FrameBorderType::TLBR
))
849 sal_uInt16 nBorderDiagId
= pPool
->GetWhich(SID_ATTR_BORDER_DIAG_TLBR
);
850 SvxLineItem
aLineItem(*static_cast<const SvxLineItem
*>(rCoreAttrs
->GetItem(nBorderDiagId
)));
851 aLineItem
.SetLine(m_aFrameSel
.GetFrameBorderStyle(svx::FrameBorderType::TLBR
));
852 rCoreAttrs
->Put(aLineItem
);
853 bAttrsChanged
= true;
856 if (m_aFrameSel
.IsBorderEnabled(svx::FrameBorderType::BLTR
))
858 sal_uInt16 nBorderDiagId
= pPool
->GetWhich(SID_ATTR_BORDER_DIAG_BLTR
);
859 SvxLineItem
aLineItem(*static_cast<const SvxLineItem
*>(rCoreAttrs
->GetItem(nBorderDiagId
)));
860 aLineItem
.SetLine(m_aFrameSel
.GetFrameBorderStyle(svx::FrameBorderType::BLTR
));
861 rCoreAttrs
->Put(aLineItem
);
862 bAttrsChanged
= true;
865 if (m_xShadowControls
&& m_xShadowControls
->get_value_changed_from_saved())
867 sal_uInt16 nShadowId
= pPool
->GetWhich(mnShadowSlot
);
868 const SvxShadowItem
& rOldShadowItem
= *static_cast<const SvxShadowItem
*>(rCoreAttrs
->GetItem(nShadowId
));
869 rCoreAttrs
->Put(m_xShadowControls
->GetControlValue(rOldShadowItem
));
870 bAttrsChanged
= true;
873 if (m_xMarginControls
&& m_xMarginControls
->get_value_changed_from_saved())
875 sal_uInt16 nAlignMarginId
= pPool
->GetWhich(SID_ATTR_ALIGN_MARGIN
);
876 const SvxMarginItem
& rOldMarginItem
= *static_cast<const SvxMarginItem
*>(rCoreAttrs
->GetItem(nAlignMarginId
));
877 rCoreAttrs
->Put(m_xMarginControls
->GetControlValue(rOldMarginItem
));
878 bAttrsChanged
= true;
881 if (m_xMergeAdjacentBordersCB
->get_state_changed_from_saved())
883 sal_uInt16 nMergeAdjacentBordersId
= pPool
->GetWhich(SID_SW_COLLAPSING_BORDERS
);
884 auto nState
= m_xMergeAdjacentBordersCB
->get_state();
885 if (nState
== TRISTATE_INDET
)
886 rCoreAttrs
->ClearItem(nMergeAdjacentBordersId
);
889 std::unique_ptr
<SfxBoolItem
> xNewItem(static_cast<SfxBoolItem
*>(rCoreAttrs
->Get(nMergeAdjacentBordersId
).Clone()));
890 xNewItem
->SetValue(static_cast<bool>(nState
));
891 rCoreAttrs
->Put(std::move(xNewItem
));
893 bAttrsChanged
= true;
896 if (m_xMergeWithNextCB
->get_state_changed_from_saved())
898 sal_uInt16 nMergeWithNextId
= pPool
->GetWhich(SID_ATTR_BORDER_CONNECT
);
899 auto nState
= m_xMergeWithNextCB
->get_state();
900 if (nState
== TRISTATE_INDET
)
901 rCoreAttrs
->ClearItem(nMergeWithNextId
);
904 std::unique_ptr
<SfxBoolItem
> xNewItem(static_cast<SfxBoolItem
*>(rCoreAttrs
->Get(nMergeWithNextId
).Clone()));
905 xNewItem
->SetValue(static_cast<bool>(nState
));
906 rCoreAttrs
->Put(std::move(xNewItem
));
908 bAttrsChanged
= true;
912 sal_uInt16 nBoxWhich
= GetWhich( mnBoxSlot
);
913 sal_uInt16 nBoxInfoWhich
= pPool
->GetWhich( SID_ATTR_BORDER_INNER
, false );
914 const SfxItemSet
& rOldSet
= GetItemSet();
915 SvxBoxItem
aBoxItem ( nBoxWhich
);
916 SvxBoxInfoItem
aBoxInfoItem ( nBoxInfoWhich
);
917 const SvxBoxItem
* pOldBoxItem
= static_cast<const SvxBoxItem
*>(GetOldItem( *rCoreAttrs
, mnBoxSlot
));
919 MapUnit eCoreUnit
= rOldSet
.GetPool()->GetMetric( nBoxWhich
);
924 std::pair
<svx::FrameBorderType
,SvxBoxItemLine
> eTypes1
[] = {
925 { svx::FrameBorderType::Top
,SvxBoxItemLine::TOP
},
926 { svx::FrameBorderType::Bottom
,SvxBoxItemLine::BOTTOM
},
927 { svx::FrameBorderType::Left
,SvxBoxItemLine::LEFT
},
928 { svx::FrameBorderType::Right
,SvxBoxItemLine::RIGHT
},
931 for (std::pair
<svx::FrameBorderType
,SvxBoxItemLine
> const & i
: eTypes1
)
932 aBoxItem
.SetLine( m_aFrameSel
.GetFrameBorderStyle( i
.first
), i
.second
);
935 aBoxItem
.SetRemoveAdjacentCellBorder( mbRemoveAdjacentCellBorders
);
936 // border hor/ver and TableFlag
938 std::pair
<svx::FrameBorderType
,SvxBoxInfoItemLine
> eTypes2
[] = {
939 { svx::FrameBorderType::Horizontal
,SvxBoxInfoItemLine::HORI
},
940 { svx::FrameBorderType::Vertical
,SvxBoxInfoItemLine::VERT
}
942 for (std::pair
<svx::FrameBorderType
,SvxBoxInfoItemLine
> const & j
: eTypes2
)
943 aBoxInfoItem
.SetLine( m_aFrameSel
.GetFrameBorderStyle( j
.first
), j
.second
);
945 aBoxInfoItem
.EnableHor( mbHorEnabled
);
946 aBoxInfoItem
.EnableVer( mbVerEnabled
);
951 if (m_xLeftMF
->get_visible())
953 // #i40405# enable distance controls for next dialog call
954 aBoxInfoItem
.SetDist( true );
956 if( !mbUseMarginItem
)
958 // #106224# all edits empty: do nothing
959 if( !m_xLeftMF
->get_text().isEmpty() || !m_xRightMF
->get_text().isEmpty() ||
960 !m_xTopMF
->get_text().isEmpty() || !m_xBottomMF
->get_text().isEmpty() )
962 const SvxBoxInfoItem
* pOldBoxInfoItem
= GetOldItem( *rCoreAttrs
, SID_ATTR_BORDER_INNER
);
965 m_xLeftMF
->get_value_changed_from_saved() ||
966 m_xRightMF
->get_value_changed_from_saved() ||
967 m_xTopMF
->get_value_changed_from_saved() ||
968 m_xBottomMF
->get_value_changed_from_saved() ||
969 nMinValue
== m_xLeftMF
->get_value(FieldUnit::NONE
) ||
970 nMinValue
== m_xRightMF
->get_value(FieldUnit::NONE
) ||
971 nMinValue
== m_xTopMF
->get_value(FieldUnit::NONE
) ||
972 nMinValue
== m_xBottomMF
->get_value(FieldUnit::NONE
) ||
973 (pOldBoxInfoItem
&& !pOldBoxInfoItem
->IsValid(SvxBoxInfoItemValidFlags::DISTANCE
))
976 aBoxItem
.SetDistance( static_cast<sal_uInt16
>(GetCoreValue(*m_xLeftMF
, eCoreUnit
)), SvxBoxItemLine::LEFT
);
977 aBoxItem
.SetDistance( static_cast<sal_uInt16
>(GetCoreValue(*m_xRightMF
, eCoreUnit
)), SvxBoxItemLine::RIGHT
);
978 aBoxItem
.SetDistance( static_cast<sal_uInt16
>(GetCoreValue(*m_xTopMF
, eCoreUnit
)), SvxBoxItemLine::TOP
);
979 aBoxItem
.SetDistance( static_cast<sal_uInt16
>(GetCoreValue(*m_xBottomMF
, eCoreUnit
)), SvxBoxItemLine::BOTTOM
);
983 aBoxItem
.SetDistance(pOldBoxItem
->GetDistance(SvxBoxItemLine::LEFT
), SvxBoxItemLine::LEFT
);
984 aBoxItem
.SetDistance(pOldBoxItem
->GetDistance(SvxBoxItemLine::RIGHT
), SvxBoxItemLine::RIGHT
);
985 aBoxItem
.SetDistance(pOldBoxItem
->GetDistance(SvxBoxItemLine::TOP
), SvxBoxItemLine::TOP
);
986 aBoxItem
.SetDistance(pOldBoxItem
->GetDistance(SvxBoxItemLine::BOTTOM
), SvxBoxItemLine::BOTTOM
);
988 aBoxInfoItem
.SetValid( SvxBoxInfoItemValidFlags::DISTANCE
);
994 // note Don't Care Status in the Info-Item:
996 aBoxInfoItem
.SetValid( SvxBoxInfoItemValidFlags::TOP
, m_aFrameSel
.GetFrameBorderState( svx::FrameBorderType::Top
) != svx::FrameBorderState::DontCare
);
997 aBoxInfoItem
.SetValid( SvxBoxInfoItemValidFlags::BOTTOM
, m_aFrameSel
.GetFrameBorderState( svx::FrameBorderType::Bottom
) != svx::FrameBorderState::DontCare
);
998 aBoxInfoItem
.SetValid( SvxBoxInfoItemValidFlags::LEFT
, m_aFrameSel
.GetFrameBorderState( svx::FrameBorderType::Left
) != svx::FrameBorderState::DontCare
);
999 aBoxInfoItem
.SetValid( SvxBoxInfoItemValidFlags::RIGHT
, m_aFrameSel
.GetFrameBorderState( svx::FrameBorderType::Right
) != svx::FrameBorderState::DontCare
);
1000 aBoxInfoItem
.SetValid( SvxBoxInfoItemValidFlags::HORI
, m_aFrameSel
.GetFrameBorderState( svx::FrameBorderType::Horizontal
) != svx::FrameBorderState::DontCare
);
1001 aBoxInfoItem
.SetValid( SvxBoxInfoItemValidFlags::VERT
, m_aFrameSel
.GetFrameBorderState( svx::FrameBorderType::Vertical
) != svx::FrameBorderState::DontCare
);
1004 // Put or Clear of the border?
1008 if ( SfxItemState::DEFAULT
== rOldSet
.GetItemState( nBoxWhich
, false ))
1010 bPut
= aBoxItem
!= static_cast<const SvxBoxItem
&>(rOldSet
.Get(nBoxWhich
));
1012 if( SfxItemState::DEFAULT
== rOldSet
.GetItemState( nBoxInfoWhich
, false ) )
1014 const SvxBoxInfoItem
& rOldBoxInfo
= static_cast<const SvxBoxInfoItem
&>(
1015 rOldSet
.Get(nBoxInfoWhich
));
1017 aBoxInfoItem
.SetMinDist( rOldBoxInfo
.IsMinDist() );
1018 aBoxInfoItem
.SetDefDist( rOldBoxInfo
.GetDefDist() );
1019 bPut
|= (aBoxInfoItem
!= rOldBoxInfo
);
1024 if ( !pOldBoxItem
|| *pOldBoxItem
!= aBoxItem
)
1026 rCoreAttrs
->Put( aBoxItem
);
1027 bAttrsChanged
= true;
1029 const SfxPoolItem
* pOld
= GetOldItem( *rCoreAttrs
, SID_ATTR_BORDER_INNER
, false );
1031 if ( !pOld
|| *static_cast<const SvxBoxInfoItem
*>(pOld
) != aBoxInfoItem
)
1033 rCoreAttrs
->Put( aBoxInfoItem
);
1034 bAttrsChanged
= true;
1039 rCoreAttrs
->ClearItem( nBoxWhich
);
1040 rCoreAttrs
->ClearItem( nBoxInfoWhich
);
1043 return bAttrsChanged
;
1046 void SvxBorderTabPage::HideShadowControls()
1048 m_xShadowFrame
->hide();
1051 #define IID_PRE_CELL_NONE 1
1052 #define IID_PRE_CELL_ALL 2
1053 #define IID_PRE_CELL_LR 3
1054 #define IID_PRE_CELL_TB 4
1055 #define IID_PRE_CELL_L 5
1056 #define IID_PRE_CELL_DIAG 6
1057 #define IID_PRE_HOR_NONE 7
1058 #define IID_PRE_HOR_OUTER 8
1059 #define IID_PRE_HOR_HOR 9
1060 #define IID_PRE_HOR_ALL 10
1061 #define IID_PRE_HOR_OUTER2 11
1062 #define IID_PRE_VER_NONE 12
1063 #define IID_PRE_VER_OUTER 13
1064 #define IID_PRE_VER_VER 14
1065 #define IID_PRE_VER_ALL 15
1066 #define IID_PRE_VER_OUTER2 16
1067 #define IID_PRE_TABLE_NONE 17
1068 #define IID_PRE_TABLE_OUTER 18
1069 #define IID_PRE_TABLE_OUTERH 19
1070 #define IID_PRE_TABLE_ALL 20
1071 #define IID_PRE_TABLE_OUTER2 21
1073 IMPL_LINK_NOARG(SvxBorderTabPage
, SelPreHdl_Impl
, SvtValueSet
*, void)
1075 const svx::FrameBorderState SHOW
= svx::FrameBorderState::Show
;
1076 const svx::FrameBorderState HIDE
= svx::FrameBorderState::Hide
;
1077 const svx::FrameBorderState DONT
= svx::FrameBorderState::DontCare
;
1079 static const svx::FrameBorderState ppeStates
[][ svx::FRAMEBORDERTYPE_COUNT
] =
1080 { /* Left Right Top Bot Hor Ver TLBR BLTR */
1081 /* ---------------------+--------------------------------------------------- */
1082 /* IID_PRE_CELL_NONE */ { HIDE
, HIDE
, HIDE
, HIDE
, HIDE
, HIDE
, HIDE
, HIDE
},
1083 /* IID_PRE_CELL_ALL */ { SHOW
, SHOW
, SHOW
, SHOW
, HIDE
, HIDE
, HIDE
, HIDE
},
1084 /* IID_PRE_CELL_LR */ { SHOW
, SHOW
, HIDE
, HIDE
, HIDE
, HIDE
, HIDE
, HIDE
},
1085 /* IID_PRE_CELL_TB */ { HIDE
, HIDE
, SHOW
, SHOW
, HIDE
, HIDE
, HIDE
, HIDE
},
1086 /* IID_PRE_CELL_L */ { SHOW
, HIDE
, HIDE
, HIDE
, HIDE
, HIDE
, HIDE
, HIDE
},
1087 /* IID_PRE_CELL_DIAG */ { HIDE
, HIDE
, HIDE
, HIDE
, HIDE
, HIDE
, SHOW
, SHOW
},
1088 /* IID_PRE_HOR_NONE */ { HIDE
, HIDE
, HIDE
, HIDE
, HIDE
, HIDE
, HIDE
, HIDE
},
1089 /* IID_PRE_HOR_OUTER */ { SHOW
, SHOW
, SHOW
, SHOW
, HIDE
, HIDE
, HIDE
, HIDE
},
1090 /* IID_PRE_HOR_HOR */ { HIDE
, HIDE
, SHOW
, SHOW
, SHOW
, HIDE
, HIDE
, HIDE
},
1091 /* IID_PRE_HOR_ALL */ { SHOW
, SHOW
, SHOW
, SHOW
, SHOW
, HIDE
, HIDE
, HIDE
},
1092 /* IID_PRE_HOR_OUTER2 */ { SHOW
, SHOW
, SHOW
, SHOW
, DONT
, HIDE
, HIDE
, HIDE
},
1093 /* IID_PRE_VER_NONE */ { HIDE
, HIDE
, HIDE
, HIDE
, HIDE
, HIDE
, HIDE
, HIDE
},
1094 /* IID_PRE_VER_OUTER */ { SHOW
, SHOW
, SHOW
, SHOW
, HIDE
, HIDE
, HIDE
, HIDE
},
1095 /* IID_PRE_VER_VER */ { SHOW
, SHOW
, HIDE
, HIDE
, HIDE
, SHOW
, HIDE
, HIDE
},
1096 /* IID_PRE_VER_ALL */ { SHOW
, SHOW
, SHOW
, SHOW
, HIDE
, SHOW
, HIDE
, HIDE
},
1097 /* IID_PRE_VER_OUTER2 */ { SHOW
, SHOW
, SHOW
, SHOW
, HIDE
, DONT
, HIDE
, HIDE
},
1098 /* IID_PRE_TABLE_NONE */ { HIDE
, HIDE
, HIDE
, HIDE
, HIDE
, HIDE
, HIDE
, HIDE
},
1099 /* IID_PRE_TABLE_OUTER */ { SHOW
, SHOW
, SHOW
, SHOW
, HIDE
, HIDE
, HIDE
, HIDE
},
1100 /* IID_PRE_TABLE_OUTERH */ { SHOW
, SHOW
, SHOW
, SHOW
, SHOW
, HIDE
, HIDE
, HIDE
},
1101 /* IID_PRE_TABLE_ALL */ { SHOW
, SHOW
, SHOW
, SHOW
, SHOW
, SHOW
, HIDE
, HIDE
},
1102 /* IID_PRE_TABLE_OUTER2 */ { SHOW
, SHOW
, SHOW
, SHOW
, DONT
, DONT
, HIDE
, HIDE
}
1105 // first hide and deselect all frame borders
1106 m_aFrameSel
.HideAllBorders();
1107 m_aFrameSel
.DeselectAllBorders();
1109 // Using image ID to find correct line in table above.
1110 sal_uInt16 nLine
= GetPresetImageId( m_xWndPresets
->GetSelectedItemId() ) - 1;
1112 // Apply all styles from the table
1113 for( int nBorder
= 0; nBorder
< svx::FRAMEBORDERTYPE_COUNT
; ++nBorder
)
1115 svx::FrameBorderType eBorder
= svx::GetFrameBorderTypeFromIndex( nBorder
);
1116 switch( ppeStates
[ nLine
][ nBorder
] )
1118 case SHOW
: m_aFrameSel
.SelectBorder( eBorder
); break;
1119 case HIDE
: /* nothing to do */ break;
1120 case DONT
: m_aFrameSel
.SetBorderDontCare( eBorder
); break;
1124 // Show all lines that have been selected above
1125 if( m_aFrameSel
.IsAnyBorderSelected() )
1127 // any visible style, but "no-line" in line list box? -> use hair-line
1128 if (m_xLbLineStyle
->GetSelectEntryStyle() == SvxBorderLineStyle::NONE
)
1129 m_xLbLineStyle
->SelectEntry(SvxBorderLineStyle::SOLID
);
1131 // set current style to all previously selected lines
1132 SelStyleHdl_Impl(*m_xLbLineStyle
);
1133 SelColHdl_Impl(*m_xLbLineColor
);
1136 // Presets ValueSet does not show a selection (used as push buttons).
1137 m_xWndPresets
->SetNoSelection();
1139 LinesChanged_Impl( nullptr );
1140 UpdateRemoveAdjCellBorderCB( nLine
+ 1 );
1143 IMPL_LINK_NOARG(SvxBorderTabPage
, SelSdwHdl_Impl
, SvtValueSet
*, void)
1145 bool bEnable
= m_xWndShadows
->GetSelectedItemId() > 1;
1146 m_xFtShadowSize
->set_sensitive(bEnable
);
1147 m_xEdShadowSize
->set_sensitive(bEnable
);
1148 m_xFtShadowColor
->set_sensitive(bEnable
);
1149 m_xLbShadowColor
->set_sensitive(bEnable
);
1152 IMPL_LINK(SvxBorderTabPage
, SelColHdl_Impl
, ColorListBox
&, rColorBox
, void)
1154 Color aColor
= rColorBox
.GetSelectEntryColor();
1155 m_aFrameSel
.SetColorToSelection(aColor
);
1158 IMPL_LINK_NOARG(SvxBorderTabPage
, ModifyWidthHdl_Impl
, weld::MetricSpinButton
&, void)
1160 sal_Int64 nVal
= m_xLineWidthMF
->get_value(FieldUnit::NONE
);
1161 nVal
= static_cast<sal_Int64
>(MetricField::ConvertDoubleValue(
1163 m_xLineWidthMF
->get_digits(),
1164 FieldUnit::POINT
, MapUnit::MapTwip
));
1165 m_xLbLineStyle
->SetWidth( nVal
);
1167 m_aFrameSel
.SetStyleToSelection( nVal
,
1168 m_xLbLineStyle
->GetSelectEntryStyle() );
1171 IMPL_LINK_NOARG(SvxBorderTabPage
, SelStyleHdl_Impl
, SvtLineListBox
&, void)
1173 sal_Int64 nVal
= m_xLineWidthMF
->get_value(FieldUnit::NONE
);
1174 nVal
= static_cast<sal_Int64
>(MetricField::ConvertDoubleValue(
1176 m_xLineWidthMF
->get_digits(),
1177 FieldUnit::POINT
, MapUnit::MapTwip
));
1178 m_aFrameSel
.SetStyleToSelection ( nVal
,
1179 m_xLbLineStyle
->GetSelectEntryStyle() );
1182 // ValueSet handling
1183 sal_uInt16
SvxBorderTabPage::GetPresetImageId( sal_uInt16 nValueSetIdx
) const
1185 // table with all sets of predefined border styles
1186 static const sal_uInt16 ppnImgIds
[][ SVX_BORDER_PRESET_COUNT
] =
1188 // simple cell without diagonal frame borders
1189 { IID_PRE_CELL_NONE
, IID_PRE_CELL_ALL
, IID_PRE_CELL_LR
, IID_PRE_CELL_TB
, IID_PRE_CELL_L
},
1190 // simple cell with diagonal frame borders
1191 { IID_PRE_CELL_NONE
, IID_PRE_CELL_ALL
, IID_PRE_CELL_LR
, IID_PRE_CELL_TB
, IID_PRE_CELL_DIAG
},
1192 // with horizontal inner frame border
1193 { IID_PRE_HOR_NONE
, IID_PRE_HOR_OUTER
, IID_PRE_HOR_HOR
, IID_PRE_HOR_ALL
, IID_PRE_HOR_OUTER2
},
1194 // with vertical inner frame border
1195 { IID_PRE_VER_NONE
, IID_PRE_VER_OUTER
, IID_PRE_VER_VER
, IID_PRE_VER_ALL
, IID_PRE_VER_OUTER2
},
1196 // with horizontal and vertical inner frame borders
1197 { IID_PRE_TABLE_NONE
, IID_PRE_TABLE_OUTER
, IID_PRE_TABLE_OUTERH
, IID_PRE_TABLE_ALL
, IID_PRE_TABLE_OUTER2
}
1200 // find correct set of presets
1202 if( !mbHorEnabled
&& !mbVerEnabled
)
1203 nLine
= (mbTLBREnabled
|| mbBLTREnabled
) ? 1 : 0;
1204 else if( mbHorEnabled
&& !mbVerEnabled
)
1206 else if( !mbHorEnabled
&& mbVerEnabled
)
1211 DBG_ASSERT( (1 <= nValueSetIdx
) && (nValueSetIdx
<= SVX_BORDER_PRESET_COUNT
),
1212 "SvxBorderTabPage::GetPresetImageId - wrong index" );
1213 return ppnImgIds
[ nLine
][ nValueSetIdx
- 1 ];
1216 const char* SvxBorderTabPage::GetPresetStringId( sal_uInt16 nValueSetIdx
) const
1218 // string resource IDs for each image (in order of the IID_PRE_* image IDs)
1219 static const char* pnStrIds
[] =
1221 RID_SVXSTR_TABLE_PRESET_NONE
,
1222 RID_SVXSTR_PARA_PRESET_ALL
,
1223 RID_SVXSTR_PARA_PRESET_LEFTRIGHT
,
1224 RID_SVXSTR_PARA_PRESET_TOPBOTTOM
,
1225 RID_SVXSTR_PARA_PRESET_ONLYLEFT
,
1226 RID_SVXSTR_PARA_PRESET_DIAGONAL
,
1228 RID_SVXSTR_TABLE_PRESET_NONE
,
1229 RID_SVXSTR_TABLE_PRESET_ONLYOUTER
,
1230 RID_SVXSTR_HOR_PRESET_ONLYHOR
,
1231 RID_SVXSTR_TABLE_PRESET_OUTERALL
,
1232 RID_SVXSTR_TABLE_PRESET_OUTERINNER
,
1234 RID_SVXSTR_TABLE_PRESET_NONE
,
1235 RID_SVXSTR_TABLE_PRESET_ONLYOUTER
,
1236 RID_SVXSTR_VER_PRESET_ONLYVER
,
1237 RID_SVXSTR_TABLE_PRESET_OUTERALL
,
1238 RID_SVXSTR_TABLE_PRESET_OUTERINNER
,
1240 RID_SVXSTR_TABLE_PRESET_NONE
,
1241 RID_SVXSTR_TABLE_PRESET_ONLYOUTER
,
1242 RID_SVXSTR_TABLE_PRESET_OUTERHORI
,
1243 RID_SVXSTR_TABLE_PRESET_OUTERALL
,
1244 RID_SVXSTR_TABLE_PRESET_OUTERINNER
1246 return pnStrIds
[ GetPresetImageId( nValueSetIdx
) - 1 ];
1249 void SvxBorderTabPage::FillPresetVS()
1251 // basic initialization of the ValueSet
1252 m_xWndPresets
->SetStyle( m_xWndPresets
->GetStyle() | WB_ITEMBORDER
| WB_DOUBLEBORDER
);
1253 m_xWndPresets
->SetColCount( SVX_BORDER_PRESET_COUNT
);
1255 // insert images and help texts
1256 for( sal_uInt16 nVSIdx
= 1; nVSIdx
<= SVX_BORDER_PRESET_COUNT
; ++nVSIdx
)
1258 m_xWndPresets
->InsertItem( nVSIdx
);
1259 m_xWndPresets
->SetItemImage(nVSIdx
, m_aBorderImgVec
[GetPresetImageId(nVSIdx
) - 1]);
1260 m_xWndPresets
->SetItemText( nVSIdx
, CuiResId( GetPresetStringId( nVSIdx
) ) );
1264 m_xWndPresets
->SetNoSelection();
1265 m_xWndPresets
->SetOptimalSize();
1266 m_xWndPresets
->Show();
1269 void SvxBorderTabPage::FillShadowVS()
1271 // basic initialization of the ValueSet
1272 m_xWndShadows
->SetStyle( m_xWndShadows
->GetStyle() | WB_ITEMBORDER
| WB_DOUBLEBORDER
);
1273 m_xWndShadows
->SetColCount( SVX_BORDER_SHADOW_COUNT
);
1275 // string resource IDs for each image
1276 static const char* pnStrIds
[ SVX_BORDER_SHADOW_COUNT
] =
1277 { 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
};
1279 // insert images and help texts
1280 for( sal_uInt16 nVSIdx
= 1; nVSIdx
<= SVX_BORDER_SHADOW_COUNT
; ++nVSIdx
)
1282 m_xWndShadows
->InsertItem( nVSIdx
);
1283 m_xWndShadows
->SetItemImage(nVSIdx
, m_aShadowImgVec
[nVSIdx
-1]);
1284 m_xWndShadows
->SetItemText( nVSIdx
, CuiResId( pnStrIds
[ nVSIdx
- 1 ] ) );
1288 m_xWndShadows
->SelectItem( 1 );
1289 m_xWndShadows
->SetOptimalSize();
1290 m_xWndShadows
->Show();
1294 void SvxBorderTabPage::FillValueSets()
1301 static Color
lcl_mediumColor( Color aMain
, Color
/*aDefault*/ )
1303 return SvxBorderLine::threeDMediumColor( aMain
);
1306 void SvxBorderTabPage::FillLineListBox_Impl()
1308 using namespace ::com::sun::star::table::BorderLineStyle
;
1311 SvxBorderLineStyle mnStyle
;
1313 SvtLineListBox::ColorFunc mpColor1Fn
;
1314 SvtLineListBox::ColorFunc mpColor2Fn
;
1315 SvtLineListBox::ColorDistFunc mpColorDistFn
;
1316 } const aLines
[] = {
1318 { SvxBorderLineStyle::SOLID
, 0, &sameColor
, &sameColor
, &sameDistColor
},
1319 { SvxBorderLineStyle::DOTTED
, 0, &sameColor
, &sameColor
, &sameDistColor
},
1320 { SvxBorderLineStyle::DASHED
, 0, &sameColor
, &sameColor
, &sameDistColor
},
1321 { SvxBorderLineStyle::FINE_DASHED
, 0, &sameColor
, &sameColor
, &sameDistColor
},
1322 { SvxBorderLineStyle::DASH_DOT
, 0, &sameColor
, &sameColor
, &sameDistColor
},
1323 { SvxBorderLineStyle::DASH_DOT_DOT
, 0, &sameColor
, &sameColor
, &sameDistColor
},
1326 { SvxBorderLineStyle::DOUBLE
, 10, &sameColor
, &sameColor
, &sameDistColor
},
1327 { SvxBorderLineStyle::DOUBLE_THIN
, 10, &sameColor
, &sameColor
, &sameDistColor
},
1328 { SvxBorderLineStyle::THINTHICK_SMALLGAP
, 20, &sameColor
, &sameColor
, &sameDistColor
},
1329 { SvxBorderLineStyle::THINTHICK_MEDIUMGAP
, 0, &sameColor
, &sameColor
, &sameDistColor
},
1330 { SvxBorderLineStyle::THINTHICK_LARGEGAP
, 0, &sameColor
, &sameColor
, &sameDistColor
},
1331 { SvxBorderLineStyle::THICKTHIN_SMALLGAP
, 20, &sameColor
, &sameColor
, &sameDistColor
},
1332 { SvxBorderLineStyle::THICKTHIN_MEDIUMGAP
, 0, &sameColor
, &sameColor
, &sameDistColor
},
1333 { SvxBorderLineStyle::THICKTHIN_LARGEGAP
, 0, &sameColor
, &sameColor
, &sameDistColor
},
1335 { SvxBorderLineStyle::EMBOSSED
, 15, &SvxBorderLine::threeDLightColor
, &SvxBorderLine::threeDDarkColor
, &lcl_mediumColor
},
1336 { SvxBorderLineStyle::ENGRAVED
, 15, &SvxBorderLine::threeDDarkColor
, &SvxBorderLine::threeDLightColor
, &lcl_mediumColor
},
1338 { SvxBorderLineStyle::OUTSET
, 10, &SvxBorderLine::lightColor
, &SvxBorderLine::darkColor
, &sameDistColor
},
1339 { SvxBorderLineStyle::INSET
, 10, &SvxBorderLine::darkColor
, &SvxBorderLine::lightColor
, &sameDistColor
}
1342 m_xLbLineStyle
->SetSourceUnit( FieldUnit::TWIP
);
1344 for (size_t i
= 0; i
< SAL_N_ELEMENTS(aLines
); ++i
)
1346 if (!IsBorderLineStyleAllowed(aLines
[i
].mnStyle
))
1349 m_xLbLineStyle
->InsertEntry(
1350 SvxBorderLine::getWidthImpl(aLines
[i
].mnStyle
), aLines
[i
].mnStyle
,
1351 aLines
[i
].mnMinWidth
, aLines
[i
].mpColor1Fn
, aLines
[i
].mpColor2Fn
, aLines
[i
].mpColorDistFn
);
1354 sal_Int64 nVal
= m_xLineWidthMF
->get_value(FieldUnit::NONE
);
1355 nVal
= static_cast<sal_Int64
>(MetricField::ConvertDoubleValue(nVal
, m_xLineWidthMF
->get_digits(),
1356 m_xLineWidthMF
->get_unit(), MapUnit::MapTwip
));
1357 m_xLbLineStyle
->SetWidth( nVal
);
1361 IMPL_LINK_NOARG(SvxBorderTabPage
, LinesChanged_Impl
, LinkParamNone
*, void)
1363 if (!mbUseMarginItem
&& m_xLeftMF
->get_visible())
1365 bool bLineSet
= m_aFrameSel
.IsAnyBorderVisible();
1366 bool bSpaceModified
= mbLeftModified
||
1375 m_xLeftMF
->set_value(nMinValue
, FieldUnit::NONE
);
1376 m_xRightMF
->set_value(nMinValue
, FieldUnit::NONE
);
1377 m_xTopMF
->set_value(nMinValue
, FieldUnit::NONE
);
1378 m_xBottomMF
->set_value(nMinValue
, FieldUnit::NONE
);
1383 m_xLeftMF
->set_min(0, FieldUnit::NONE
);
1384 m_xRightMF
->set_min(0, FieldUnit::NONE
);
1385 m_xTopMF
->set_min(0, FieldUnit::NONE
);
1386 m_xBottomMF
->set_min(0, FieldUnit::NONE
);
1388 // for tables everything is allowed
1389 SvxBoxInfoItemValidFlags nValid
= SvxBoxInfoItemValidFlags::TOP
|SvxBoxInfoItemValidFlags::BOTTOM
|SvxBoxInfoItemValidFlags::LEFT
|SvxBoxInfoItemValidFlags::RIGHT
;
1391 m_xLeftFT
->set_sensitive( bool(nValid
& SvxBoxInfoItemValidFlags::LEFT
) );
1392 m_xRightFT
->set_sensitive( bool(nValid
& SvxBoxInfoItemValidFlags::RIGHT
) );
1393 m_xTopFT
->set_sensitive( bool(nValid
& SvxBoxInfoItemValidFlags::TOP
) );
1394 m_xBottomFT
->set_sensitive( bool(nValid
& SvxBoxInfoItemValidFlags::BOTTOM
) );
1395 m_xLeftMF
->set_sensitive( bool(nValid
& SvxBoxInfoItemValidFlags::LEFT
) );
1396 m_xRightMF
->set_sensitive( bool(nValid
& SvxBoxInfoItemValidFlags::RIGHT
) );
1397 m_xTopMF
->set_sensitive( bool(nValid
& SvxBoxInfoItemValidFlags::TOP
) );
1398 m_xBottomMF
->set_sensitive( bool(nValid
& SvxBoxInfoItemValidFlags::BOTTOM
) );
1399 m_xSynchronizeCB
->set_sensitive(m_xRightMF
->get_sensitive() || m_xTopMF
->get_sensitive() ||
1400 m_xBottomMF
->get_sensitive() || m_xLeftMF
->get_sensitive());
1402 UpdateRemoveAdjCellBorderCB( SAL_MAX_UINT16
);
1406 IMPL_LINK( SvxBorderTabPage
, ModifyDistanceHdl_Impl
, weld::MetricSpinButton
&, rField
, void)
1408 if (&rField
== m_xLeftMF
.get())
1409 mbLeftModified
= true;
1410 else if (&rField
== m_xRightMF
.get())
1411 mbRightModified
= true;
1412 else if (&rField
== m_xTopMF
.get())
1413 mbTopModified
= true;
1414 else if (&rField
== m_xBottomMF
.get())
1415 mbBottomModified
= true;
1419 const auto nVal
= rField
.get_value(FieldUnit::NONE
);
1420 if (&rField
!= m_xLeftMF
.get())
1421 m_xLeftMF
->set_value(nVal
, FieldUnit::NONE
);
1422 if (&rField
!= m_xRightMF
.get())
1423 m_xRightMF
->set_value(nVal
, FieldUnit::NONE
);
1424 if (&rField
!= m_xTopMF
.get())
1425 m_xTopMF
->set_value(nVal
, FieldUnit::NONE
);
1426 if (&rField
!= m_xBottomMF
.get())
1427 m_xBottomMF
->set_value(nVal
, FieldUnit::NONE
);
1431 IMPL_LINK( SvxBorderTabPage
, SyncHdl_Impl
, weld::ToggleButton
&, rBox
, void)
1433 mbSync
= rBox
.get_active();
1436 IMPL_LINK( SvxBorderTabPage
, RemoveAdjacentCellBorderHdl_Impl
, weld::ToggleButton
&, rBox
, void)
1438 mbRemoveAdjacentCellBorders
= rBox
.get_active();
1441 void SvxBorderTabPage::UpdateRemoveAdjCellBorderCB( sal_uInt16 nPreset
)
1445 const SfxItemSet
& rOldSet
= GetItemSet();
1446 const SvxBoxInfoItem
* pOldBoxInfoItem
= GetOldItem( rOldSet
, SID_ATTR_BORDER_INNER
);
1447 const SvxBoxItem
* pOldBoxItem
= static_cast<const SvxBoxItem
*>(GetOldItem( rOldSet
, mnBoxSlot
));
1448 if( !pOldBoxInfoItem
|| !pOldBoxItem
)
1450 std::pair
<svx::FrameBorderType
, SvxBoxInfoItemValidFlags
> eTypes1
[] = {
1451 { svx::FrameBorderType::Top
,SvxBoxInfoItemValidFlags::TOP
},
1452 { svx::FrameBorderType::Bottom
,SvxBoxInfoItemValidFlags::BOTTOM
},
1453 { svx::FrameBorderType::Left
,SvxBoxInfoItemValidFlags::LEFT
},
1454 { svx::FrameBorderType::Right
,SvxBoxInfoItemValidFlags::RIGHT
},
1456 SvxBoxItemLine
const eTypes2
[] = {
1457 SvxBoxItemLine::TOP
,
1458 SvxBoxItemLine::BOTTOM
,
1459 SvxBoxItemLine::LEFT
,
1460 SvxBoxItemLine::RIGHT
,
1463 // Check if current selection involves deletion of at least one border
1464 bool bBorderDeletionReq
= false;
1465 for ( size_t i
=0; i
< SAL_N_ELEMENTS( eTypes1
); ++i
)
1467 if( pOldBoxItem
->GetLine( eTypes2
[i
] ) || !( pOldBoxInfoItem
->IsValid( eTypes1
[i
].second
) ) )
1469 if( m_aFrameSel
.GetFrameBorderState( eTypes1
[i
].first
) == svx::FrameBorderState::Hide
)
1471 bBorderDeletionReq
= true;
1477 if( !bBorderDeletionReq
&& ( nPreset
== IID_PRE_CELL_NONE
|| nPreset
== IID_PRE_TABLE_NONE
) )
1478 bBorderDeletionReq
= true;
1480 m_xRemoveAdjcentCellBordersCB
->set_sensitive(bBorderDeletionReq
);
1482 if( !bBorderDeletionReq
)
1484 mbRemoveAdjacentCellBorders
= false;
1485 m_xRemoveAdjcentCellBordersCB
->set_active(false);
1489 void SvxBorderTabPage::PageCreated(const SfxAllItemSet
& aSet
)
1491 const SfxUInt16Item
* pSWModeItem
= aSet
.GetItem
<SfxUInt16Item
>(SID_SWMODE_TYPE
, false);
1492 const SfxUInt32Item
* pFlagItem
= aSet
.GetItem
<SfxUInt32Item
>(SID_FLAG_TYPE
, false);
1495 nSWMode
= static_cast<SwBorderModes
>(pSWModeItem
->GetValue());
1497 // show checkbox <m_xMergeWithNextCB> for format.paragraph
1498 if ( nSWMode
== SwBorderModes::PARA
)
1500 m_xMergeWithNextCB
->show();
1501 m_xPropertiesFrame
->show();
1503 // show checkbox <m_xMergeAdjacentBordersCB> for format.paragraph
1504 else if ( nSWMode
== SwBorderModes::TABLE
)
1506 m_xMergeAdjacentBordersCB
->show();
1507 m_xPropertiesFrame
->show();
1511 if ( ( pFlagItem
->GetValue() & SVX_HIDESHADOWCTL
) == SVX_HIDESHADOWCTL
)
1512 HideShadowControls();
1515 void SvxBorderTabPage::SetTableMode()
1517 nSWMode
= SwBorderModes::TABLE
;
1520 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */