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 .
21 #include <hintids.hxx>
22 #include <svx/colorbox.hxx>
23 #include <editeng/sizeitem.hxx>
24 #include <editeng/lrspitem.hxx>
25 #include <editeng/ulspitem.hxx>
26 #include <editeng/boxitem.hxx>
27 #include <editeng/frmdiritem.hxx>
28 #include <svx/ruler.hxx>
30 #include <tgrditem.hxx>
31 #include <svx/pageitem.hxx>
35 #include <swmodule.hxx>
38 constexpr tools::Long constTwips_5mm
= o3tl::toTwips(5, o3tl::Length::mm
);
40 SwTextGridPage::SwTextGridPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
&rSet
)
41 : SfxTabPage(pPage
, pController
, "modules/swriter/ui/textgridpage.ui", "TextGridPage", &rSet
)
43 , m_bRubyUserValue(false)
44 , m_aPageSize(constTwips_5mm
, constTwips_5mm
)
46 , m_bSquaredMode(false)
47 , m_bHRulerChanged(false)
48 , m_bVRulerChanged(false)
49 , m_xNoGridRB(m_xBuilder
->weld_radio_button("radioRB_NOGRID"))
50 , m_xLinesGridRB(m_xBuilder
->weld_radio_button("radioRB_LINESGRID"))
51 , m_xCharsGridRB(m_xBuilder
->weld_radio_button("radioRB_CHARSGRID"))
52 , m_xSnapToCharsCB(m_xBuilder
->weld_check_button("checkCB_SNAPTOCHARS"))
53 , m_xExampleWN(new weld::CustomWeld(*m_xBuilder
, "drawingareaWN_EXAMPLE", m_aExampleWN
))
54 , m_xLayoutFL(m_xBuilder
->weld_widget("frameFL_LAYOUT"))
55 , m_xLinesPerPageNF(m_xBuilder
->weld_spin_button("spinNF_LINESPERPAGE"))
56 , m_xLinesRangeFT(m_xBuilder
->weld_label("labelFT_LINERANGE"))
57 , m_xTextSizeMF(m_xBuilder
->weld_metric_spin_button("spinMF_TEXTSIZE", FieldUnit::POINT
))
58 , m_xCharsPerLineFT(m_xBuilder
->weld_label("labelFT_CHARSPERLINE"))
59 , m_xCharsPerLineNF(m_xBuilder
->weld_spin_button("spinNF_CHARSPERLINE"))
60 , m_xCharsRangeFT(m_xBuilder
->weld_label("labelFT_CHARRANGE"))
61 , m_xCharWidthFT(m_xBuilder
->weld_label("labelFT_CHARWIDTH"))
62 , m_xCharWidthMF(m_xBuilder
->weld_metric_spin_button("spinMF_CHARWIDTH", FieldUnit::POINT
))
63 , m_xRubySizeFT(m_xBuilder
->weld_label("labelFT_RUBYSIZE"))
64 , m_xRubySizeMF(m_xBuilder
->weld_metric_spin_button("spinMF_RUBYSIZE", FieldUnit::POINT
))
65 , m_xRubyBelowCB(m_xBuilder
->weld_check_button("checkCB_RUBYBELOW"))
66 , m_xDisplayFL(m_xBuilder
->weld_widget("frameFL_DISPLAY"))
67 , m_xDisplayCB(m_xBuilder
->weld_check_button("checkCB_DISPLAY"))
68 , m_xPrintCB(m_xBuilder
->weld_check_button("checkCB_PRINT"))
69 , m_xColorLB(new ColorListBox(m_xBuilder
->weld_menu_button("listLB_COLOR"),
70 [this]{ return GetDialogController()->getDialog(); }))
72 Link
<weld::SpinButton
&,void> aLink
= LINK(this, SwTextGridPage
, CharorLineChangedHdl
);
73 m_xCharsPerLineNF
->connect_value_changed(aLink
);
74 m_xLinesPerPageNF
->connect_value_changed(aLink
);
76 Link
<weld::MetricSpinButton
&,void> aSizeLink
= LINK(this, SwTextGridPage
, TextSizeChangedHdl
);
77 m_xTextSizeMF
->connect_value_changed(aSizeLink
);
78 m_xRubySizeMF
->connect_value_changed(aSizeLink
);
79 m_xCharWidthMF
->connect_value_changed(aSizeLink
);
81 Link
<weld::Toggleable
&,void> aGridTypeHdl
= LINK(this, SwTextGridPage
, GridTypeHdl
);
82 m_xNoGridRB
->connect_toggled(aGridTypeHdl
);
83 m_xLinesGridRB
->connect_toggled(aGridTypeHdl
);
84 m_xCharsGridRB
->connect_toggled(aGridTypeHdl
);
86 m_xColorLB
->SetSelectHdl(LINK(this, SwTextGridPage
, ColorModifyHdl
));
87 m_xPrintCB
->connect_toggled(LINK(this, SwTextGridPage
, GridModifyClickHdl
));
88 m_xRubyBelowCB
->connect_toggled(LINK(this, SwTextGridPage
, GridModifyClickHdl
));
90 m_xDisplayCB
->connect_toggled(LINK(this, SwTextGridPage
, DisplayGridHdl
));
92 //Get the default paper mode
93 if (SwView
*pView
= GetActiveView())
95 if (SwWrtShell
* pSh
= pView
->GetWrtShellPtr())
97 m_bSquaredMode
= pSh
->GetDoc()->IsSquaredPageMode();
103 m_xRubySizeFT
->show();
104 m_xRubySizeMF
->show();
105 m_xRubyBelowCB
->show();
106 m_xSnapToCharsCB
->hide();
107 m_xCharWidthFT
->hide();
108 m_xCharWidthMF
->hide();
112 m_xRubySizeFT
->hide();
113 m_xRubySizeMF
->hide();
114 m_xRubyBelowCB
->hide();
115 m_xSnapToCharsCB
->show();
116 m_xCharWidthFT
->show();
117 m_xCharWidthMF
->show();
121 SwTextGridPage::~SwTextGridPage()
126 std::unique_ptr
<SfxTabPage
> SwTextGridPage::Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
*rSet
)
128 return std::make_unique
<SwTextGridPage
>(pPage
, pController
, *rSet
);
131 bool SwTextGridPage::FillItemSet(SfxItemSet
*rSet
)
134 if (m_xNoGridRB
->get_state_changed_from_saved() ||
135 m_xLinesGridRB
->get_state_changed_from_saved() ||
136 m_xLinesPerPageNF
->get_value_changed_from_saved() ||
137 m_xTextSizeMF
->get_value_changed_from_saved() ||
138 m_xCharsPerLineNF
->get_value_changed_from_saved() ||
139 m_xSnapToCharsCB
->get_state_changed_from_saved() ||
140 m_xRubySizeMF
->get_value_changed_from_saved() ||
141 m_xCharWidthMF
->get_value_changed_from_saved() ||
142 m_xRubyBelowCB
->get_state_changed_from_saved() ||
143 m_xDisplayCB
->get_state_changed_from_saved() ||
144 m_xPrintCB
->get_state_changed_from_saved() ||
145 m_xColorLB
->IsValueChangedFromSaved())
151 // draw ticks of ruler
152 if (SwView
* pView
= GetActiveView())
154 if ( m_bHRulerChanged
)
155 pView
->GetHRuler().DrawTicks();
156 if ( m_bVRulerChanged
)
157 pView
->GetVRuler().DrawTicks();
162 void SwTextGridPage::Reset(const SfxItemSet
*rSet
)
164 sal_Int32 nLinesPerPage
= 0;
166 if(SfxItemState::DEFAULT
<= rSet
->GetItemState(RES_TEXTGRID
))
168 const SwTextGridItem
& rGridItem
= rSet
->Get(RES_TEXTGRID
);
169 weld::RadioButton
* pButton
= nullptr;
170 switch(rGridItem
.GetGridType())
172 case GRID_NONE
: pButton
= m_xNoGridRB
.get(); break;
173 case GRID_LINES_ONLY
: pButton
= m_xLinesGridRB
.get(); break;
174 default: pButton
= m_xCharsGridRB
.get();
176 pButton
->set_active(true);
177 m_xDisplayCB
->set_active(rGridItem
.IsDisplayGrid());
178 GridTypeHdl(*pButton
);
179 m_xSnapToCharsCB
->set_active(rGridItem
.IsSnapToChars());
180 nLinesPerPage
= rGridItem
.GetLines();
182 SetLinesOrCharsRanges(*m_xLinesRangeFT
, m_xLinesPerPageNF
->get_max());
183 m_nRubyUserValue
= rGridItem
.GetBaseHeight();
184 m_bRubyUserValue
= true;
185 m_xTextSizeMF
->set_value(m_xTextSizeMF
->normalize(m_nRubyUserValue
), FieldUnit::TWIP
);
186 m_xRubySizeMF
->set_value(m_xRubySizeMF
->normalize(rGridItem
.GetRubyHeight()), FieldUnit::TWIP
);
187 m_xCharWidthMF
->set_value(m_xCharWidthMF
->normalize(rGridItem
.GetBaseWidth()), FieldUnit::TWIP
);
188 m_xRubyBelowCB
->set_active(rGridItem
.IsRubyTextBelow());
189 m_xPrintCB
->set_active(rGridItem
.IsPrintGrid());
190 m_xColorLB
->SelectEntry(rGridItem
.GetColor());
192 UpdatePageSize(*rSet
);
194 if (nLinesPerPage
> 0)
195 m_xLinesPerPageNF
->set_value(nLinesPerPage
);
197 m_xNoGridRB
->save_state();
198 m_xLinesGridRB
->save_state();
199 m_xSnapToCharsCB
->save_state();
200 m_xLinesPerPageNF
->save_value();
201 m_xTextSizeMF
->save_value();
202 m_xCharsPerLineNF
->save_value();
203 m_xRubySizeMF
->save_value();
204 m_xCharWidthMF
->save_value();
205 m_xRubyBelowCB
->save_state();
206 m_xDisplayCB
->save_state();
207 m_xPrintCB
->save_state();
208 m_xColorLB
->SaveValue();
211 void SwTextGridPage::ActivatePage( const SfxItemSet
& rSet
)
214 m_aExampleWN
.UpdateExample(rSet
);
215 UpdatePageSize(rSet
);
217 m_aExampleWN
.Invalidate();
220 DeactivateRC
SwTextGridPage::DeactivatePage( SfxItemSet
* )
222 return DeactivateRC::LeavePage
;
225 void SwTextGridPage::PutGridItem(SfxItemSet
& rSet
)
227 SwTextGridItem aGridItem
;
228 aGridItem
.SetGridType(m_xNoGridRB
->get_active() ? GRID_NONE
:
229 m_xLinesGridRB
->get_active() ? GRID_LINES_ONLY
: GRID_LINES_CHARS
);
230 aGridItem
.SetSnapToChars(m_xSnapToCharsCB
->get_active());
231 aGridItem
.SetLines( static_cast< sal_Int32
>(m_xLinesPerPageNF
->get_value()) );
232 aGridItem
.SetBaseHeight( static_cast< sal_uInt16
>(
233 m_bRubyUserValue
? m_nRubyUserValue
:
234 m_xTextSizeMF
->denormalize(m_xTextSizeMF
->get_value(FieldUnit::TWIP
))) );
235 // Tdf#151544: set ruby height from the value get from UI only when in square page mode.
236 // When in normal mode, the ruby height should be zero.
238 aGridItem
.SetRubyHeight(static_cast<sal_uInt16
>(m_xRubySizeMF
->denormalize(m_xRubySizeMF
->get_value(FieldUnit::TWIP
))));
240 aGridItem
.SetRubyHeight(0);
241 aGridItem
.SetBaseWidth( static_cast< sal_uInt16
>(m_xCharWidthMF
->denormalize(m_xCharWidthMF
->get_value(FieldUnit::TWIP
))) );
242 aGridItem
.SetRubyTextBelow(m_xRubyBelowCB
->get_active());
243 aGridItem
.SetSquaredMode(m_bSquaredMode
);
244 aGridItem
.SetDisplayGrid(m_xDisplayCB
->get_active());
245 aGridItem
.SetPrintGrid(m_xPrintCB
->get_active());
246 aGridItem
.SetColor(m_xColorLB
->GetSelectEntryColor());
249 SwView
* pView
= ::GetActiveView();
250 if (pView
&& aGridItem
.GetGridType() != GRID_NONE
)
252 if ( aGridItem
.GetGridType() == GRID_LINES_CHARS
)
254 m_bHRulerChanged
= true;
256 m_bVRulerChanged
= true;
257 pView
->GetHRuler().SetCharWidth(m_xCharWidthMF
->get_value(FieldUnit::MM
));
258 pView
->GetVRuler().SetLineHeight(m_xTextSizeMF
->get_value(FieldUnit::MM
));
262 void SwTextGridPage::UpdatePageSize(const SfxItemSet
& rSet
)
264 if( SfxItemState::UNKNOWN
!= rSet
.GetItemState( RES_FRAMEDIR
))
266 const SvxFrameDirectionItem
& rDirItem
=
267 rSet
.Get(RES_FRAMEDIR
);
268 m_bVertical
= rDirItem
.GetValue() == SvxFrameDirection::Vertical_RL_TB
||
269 rDirItem
.GetValue() == SvxFrameDirection::Vertical_LR_TB
;
272 if( SfxItemState::SET
!= rSet
.GetItemState( SID_ATTR_PAGE_SIZE
))
275 const SvxSizeItem
& rSize
= rSet
.Get(SID_ATTR_PAGE_SIZE
);
276 const SvxLRSpaceItem
& rLRSpace
= rSet
.Get( RES_LR_SPACE
);
277 const SvxULSpaceItem
& rULSpace
= rSet
.Get( RES_UL_SPACE
);
278 const SvxBoxItem
& rBox
= rSet
.Get(RES_BOX
);
279 sal_Int32 nDistanceLR
= rLRSpace
.GetLeft() + rLRSpace
.GetRight();
280 sal_Int32 nDistanceUL
= rULSpace
.GetUpper() + rULSpace
.GetLower();
282 for( const TypedWhichId
<SvxSetItem
> & nId
: { SID_ATTR_PAGE_HEADERSET
, SID_ATTR_PAGE_FOOTERSET
})
284 if( const SvxSetItem
* pItem
= rSet
.GetItemIfSet( nId
, false ) )
286 const SfxItemSet
& rExtraSet
= pItem
->GetItemSet();
287 const SfxBoolItem
& rOn
=
288 rExtraSet
.Get( rSet
.GetPool()->GetWhich( SID_ATTR_PAGE_ON
) );
290 if ( rOn
.GetValue() )
292 const SvxSizeItem
& rSizeItem
=
293 rExtraSet
.Get(rSet
.GetPool()->GetWhich(SID_ATTR_PAGE_SIZE
));
294 nDistanceUL
+= rSizeItem
.GetSize().Height();
299 sal_Int32 nValue1
= rSize
.GetSize().Height() - nDistanceUL
-
300 rBox
.GetDistance(SvxBoxItemLine::TOP
) -
301 rBox
.GetDistance(SvxBoxItemLine::BOTTOM
);
302 sal_Int32 nValue2
= rSize
.GetSize().Width() - nDistanceLR
-
303 rBox
.GetDistance(SvxBoxItemLine::LEFT
) -
304 rBox
.GetDistance(SvxBoxItemLine::RIGHT
);
307 m_aPageSize
.setWidth( nValue1
);
308 m_aPageSize
.setHeight( nValue2
);
312 m_aPageSize
.setWidth( nValue2
);
313 m_aPageSize
.setHeight( nValue1
);
316 sal_Int32 nTextSize
= static_cast< sal_Int32
>(m_bRubyUserValue
?
318 m_xTextSizeMF
->denormalize(m_xTextSizeMF
->get_value(FieldUnit::TWIP
)));
320 if ( m_bSquaredMode
)
322 sal_Int32 nCharsPerLine
= m_aPageSize
.Width() / nTextSize
;
323 m_xCharsPerLineNF
->set_max(nCharsPerLine
);
324 m_xCharsPerLineNF
->set_sensitive(nCharsPerLine
!= 0);
325 m_xCharsPerLineNF
->set_value(nCharsPerLine
);
326 sal_Int32 nMaxLines
= m_aPageSize
.Height() /
327 ( m_xTextSizeMF
->denormalize(m_xTextSizeMF
->get_value(FieldUnit::TWIP
)) +
328 m_xRubySizeMF
->denormalize(m_xRubySizeMF
->get_value(FieldUnit::TWIP
)));
329 m_xLinesPerPageNF
->set_max(nMaxLines
);
330 m_xLinesPerPageNF
->set_sensitive(nMaxLines
!= 0);
331 SetLinesOrCharsRanges( *m_xCharsRangeFT
, m_xCharsPerLineNF
->get_max() );
332 SetLinesOrCharsRanges( *m_xLinesRangeFT
, m_xLinesPerPageNF
->get_max() );
336 sal_Int32 nTextWidth
= static_cast< sal_Int32
>(m_xCharWidthMF
->denormalize(m_xCharWidthMF
->get_value(FieldUnit::TWIP
)));
337 m_xLinesPerPageNF
->set_value(m_aPageSize
.Height() / nTextSize
);
339 m_xCharsPerLineNF
->set_value(m_aPageSize
.Width() / nTextWidth
);
341 m_xCharsPerLineNF
->set_value(45);
342 SetLinesOrCharsRanges( *m_xCharsRangeFT
, m_xCharsPerLineNF
->get_max() );
343 SetLinesOrCharsRanges( *m_xLinesRangeFT
, m_xLinesPerPageNF
->get_max() );
347 void SwTextGridPage::SetLinesOrCharsRanges(weld::Label
& rField
, const sal_Int32 nValue
)
349 OUString aFieldStr
= "( 1 -" + OUString::number(nValue
) + " )";
350 rField
.set_label(aFieldStr
);
353 WhichRangesContainer
SwTextGridPage::GetRanges()
355 return WhichRangesContainer(svl::Items
<RES_TEXTGRID
, RES_TEXTGRID
>);
358 IMPL_LINK(SwTextGridPage
, CharorLineChangedHdl
, weld::SpinButton
&, rField
, void)
361 if ( m_bSquaredMode
)
363 if (m_xCharsPerLineNF
.get() == &rField
)
365 auto nValue
= m_xCharsPerLineNF
->get_value();
366 assert(nValue
&& "div-by-zero");
367 auto nWidth
= m_aPageSize
.Width() / nValue
;
368 m_xTextSizeMF
->set_value(m_xTextSizeMF
->normalize(nWidth
), FieldUnit::TWIP
);
369 //prevent rounding errors in the MetricField by saving the used value
370 m_nRubyUserValue
= nWidth
;
371 m_bRubyUserValue
= true;
374 //set maximum line per page
376 sal_Int32 nMaxLines
= static_cast< sal_Int32
>(m_aPageSize
.Height() /
377 ( m_xTextSizeMF
->denormalize(m_xTextSizeMF
->get_value(FieldUnit::TWIP
)) +
378 m_xRubySizeMF
->denormalize(m_xRubySizeMF
->get_value(FieldUnit::TWIP
))));
379 m_xLinesPerPageNF
->set_max(nMaxLines
);
380 m_xLinesPerPageNF
->set_sensitive(nMaxLines
!= 0);
382 SetLinesOrCharsRanges( *m_xLinesRangeFT
, m_xLinesPerPageNF
->get_max() );
383 SetLinesOrCharsRanges( *m_xCharsRangeFT
, m_xCharsPerLineNF
->get_max() );
387 if (m_xLinesPerPageNF
.get() == &rField
)
389 auto nValue
= m_xLinesPerPageNF
->get_value();
390 assert(nValue
&& "div-by-zero");
391 auto nHeight
= m_aPageSize
.Height() / nValue
;
392 m_xTextSizeMF
->set_value(m_xTextSizeMF
->normalize(nHeight
), FieldUnit::TWIP
);
393 SetLinesOrCharsRanges( *m_xLinesRangeFT
, m_xLinesPerPageNF
->get_max() );
395 m_nRubyUserValue
= nHeight
;
396 m_bRubyUserValue
= true;
398 else if (m_xCharsPerLineNF
.get() == &rField
)
400 auto nValue
= m_xCharsPerLineNF
->get_value();
401 assert(nValue
&& "div-by-zero");
402 auto nWidth
= m_aPageSize
.Width() / nValue
;
403 m_xCharWidthMF
->set_value(m_xCharWidthMF
->normalize(nWidth
), FieldUnit::TWIP
);
404 SetLinesOrCharsRanges( *m_xCharsRangeFT
, m_xCharsPerLineNF
->get_max() );
410 IMPL_LINK(SwTextGridPage
, TextSizeChangedHdl
, weld::MetricSpinButton
&, rField
, void)
415 if (m_xTextSizeMF
.get() == &rField
)
417 m_bRubyUserValue
= false;
419 // fdo#50941: set maximum characters per line
420 sal_Int32 nTextSize
= static_cast< sal_Int32
>(m_xTextSizeMF
->denormalize(m_xTextSizeMF
->get_value(FieldUnit::TWIP
)));
423 sal_Int32 nMaxChars
= m_aPageSize
.Width() / nTextSize
;
424 m_xCharsPerLineNF
->set_value(nMaxChars
);
425 m_xCharsPerLineNF
->set_max(nMaxChars
);
426 m_xCharsPerLineNF
->set_sensitive(nMaxChars
!= 0);
427 SetLinesOrCharsRanges( *m_xCharsRangeFT
, m_xCharsPerLineNF
->get_max() );
430 //set maximum line per page
432 sal_Int32 nMaxLines
= static_cast< sal_Int32
>(m_aPageSize
.Height() /
433 ( m_xTextSizeMF
->denormalize(m_xTextSizeMF
->get_value(FieldUnit::TWIP
)) +
434 m_xRubySizeMF
->denormalize(m_xRubySizeMF
->get_value(FieldUnit::TWIP
))));
435 m_xLinesPerPageNF
->set_max(nMaxLines
);
436 m_xLinesPerPageNF
->set_sensitive(nMaxLines
!= 0);
437 SetLinesOrCharsRanges( *m_xLinesRangeFT
, m_xLinesPerPageNF
->get_max() );
442 if (m_xTextSizeMF
.get() == &rField
)
444 sal_Int32 nTextSize
= static_cast< sal_Int32
>(m_xTextSizeMF
->denormalize(m_xTextSizeMF
->get_value(FieldUnit::TWIP
)));
445 m_xLinesPerPageNF
->set_value(m_aPageSize
.Height() / nTextSize
);
446 m_bRubyUserValue
= false;
447 SetLinesOrCharsRanges( *m_xLinesRangeFT
, m_xLinesPerPageNF
->get_max() );
449 else if (m_xCharWidthMF
.get() == &rField
)
451 sal_Int32 nTextWidth
= static_cast< sal_Int32
>(m_xCharWidthMF
->denormalize(m_xCharWidthMF
->get_value(FieldUnit::TWIP
)));
452 sal_Int32 nMaxChar
= 45 ;
454 nMaxChar
= m_aPageSize
.Width() / nTextWidth
;
455 m_xCharsPerLineNF
->set_value( nMaxChar
);
456 SetLinesOrCharsRanges( *m_xCharsRangeFT
, m_xCharsPerLineNF
->get_max() );
458 //rubySize is disabled
463 IMPL_LINK(SwTextGridPage
, GridTypeHdl
, weld::Toggleable
&, rButton
, void)
465 if (!rButton
.get_active())
468 if (m_xNoGridRB
.get() == &rButton
)
471 // "Layout" and "Display" sections should all be disabled.
472 m_xLayoutFL
->set_sensitive(false);
473 m_xDisplayFL
->set_sensitive(false);
477 // GRID_LINES_ONLY or GRID_LINES_CHARS mode:
478 // "Layout" and "Display" sections should all be enabled;
479 // DisplayGridHdl should be executed;
480 m_xLayoutFL
->set_sensitive(true);
481 m_xDisplayFL
->set_sensitive(true);
482 DisplayGridHdl(*m_xDisplayCB
);
485 if (m_xCharsGridRB
.get() == &rButton
)
487 // GRID_LINES_CHARS mode:
488 // "Snap to character" should be enabled;
489 // "Characters per line" should be enabled;
490 // "Characters range" should be enabled;
491 m_xSnapToCharsCB
->set_sensitive(true);
492 m_xCharsPerLineFT
->set_sensitive(true);
493 m_xCharsPerLineNF
->set_sensitive(true);
494 m_xCharsRangeFT
->set_sensitive(true);
495 m_xCharWidthFT
->set_sensitive(true);
496 m_xCharWidthMF
->set_sensitive(true);
500 // GRID_NONE or GRID_LINES_ONLY mode:
501 // "Snap to character" should be disabled;
502 // "Characters per line" should be disabled;
503 // "Characters range" should be disabled;
504 m_xSnapToCharsCB
->set_sensitive(false);
505 m_xCharsPerLineFT
->set_sensitive(false);
506 m_xCharsPerLineNF
->set_sensitive(false);
507 m_xCharsRangeFT
->set_sensitive(false);
508 m_xCharWidthFT
->set_sensitive(false);
509 m_xCharWidthMF
->set_sensitive(false);
512 if (m_xNoGridRB
.get() != &rButton
)
514 // GRID_LINES_ONLY or GRID_LINES_CHARS mode: (additionally)
515 // TextSizeChangedHdl should be executed to recalculate which dependencies are sensitive.
516 TextSizeChangedHdl(*m_xTextSizeMF
);
522 IMPL_LINK_NOARG(SwTextGridPage
, DisplayGridHdl
, weld::Toggleable
&, void)
524 bool bChecked
= m_xDisplayCB
->get_active();
525 m_xPrintCB
->set_sensitive(bChecked
);
526 m_xPrintCB
->set_active(bChecked
);
529 IMPL_LINK_NOARG(SwTextGridPage
, GridModifyClickHdl
, weld::Toggleable
&, void)
534 IMPL_LINK_NOARG(SwTextGridPage
, ColorModifyHdl
, ColorListBox
&, void)
539 void SwTextGridPage::GridModifyHdl()
541 const SfxItemSet
& rOldSet
= GetItemSet();
542 SfxItemSet
aSet(rOldSet
);
543 const SfxItemSet
* pExSet
= GetDialogExampleSet();
547 m_aExampleWN
.UpdateExample(aSet
);
550 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */