LibreOffice Module sw (master) 1
pggrid.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 <cmdid.h>
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>
28#include <svx/ruler.hxx>
29#include <pggrid.hxx>
30#include <tgrditem.hxx>
31#include <svx/pageitem.hxx>
32
33#include <wrtsh.hxx>
34#include <doc.hxx>
35#include <swmodule.hxx>
36#include <view.hxx>
37
39
41 : SfxTabPage(pPage, pController, "modules/swriter/ui/textgridpage.ui", "TextGridPage", &rSet)
42 , m_nRubyUserValue(0)
43 , m_bRubyUserValue(false)
44 , m_aPageSize(constTwips_5mm, constTwips_5mm)
45 , m_bVertical(false)
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(); }))
71{
72 Link<weld::SpinButton&,void> aLink = LINK(this, SwTextGridPage, CharorLineChangedHdl);
73 m_xCharsPerLineNF->connect_value_changed(aLink);
74 m_xLinesPerPageNF->connect_value_changed(aLink);
75
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);
80
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);
85
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));
89
90 m_xDisplayCB->connect_toggled(LINK(this, SwTextGridPage, DisplayGridHdl));
91
92 //Get the default paper mode
93 SwView *pView = ::GetActiveView();
94 if( pView )
95 {
96 SwWrtShell* pSh = pView->GetWrtShellPtr();
97 if( pSh )
98 {
100 }
101 }
102 if( m_bSquaredMode )
103 {
104
105 m_xRubySizeFT->show();
106 m_xRubySizeMF->show();
107 m_xRubyBelowCB->show();
108 m_xSnapToCharsCB->hide();
109 m_xCharWidthFT->hide();
110 m_xCharWidthMF->hide();
111 }
112 else
113 {
114 m_xRubySizeFT->hide();
115 m_xRubySizeMF->hide();
116 m_xRubyBelowCB->hide();
117 m_xSnapToCharsCB->show();
118 m_xCharWidthFT->show();
119 m_xCharWidthMF->show();
120 }
121}
122
124{
125 m_xColorLB.reset();
126}
127
128std::unique_ptr<SfxTabPage> SwTextGridPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet)
129{
130 return std::make_unique<SwTextGridPage>(pPage, pController, *rSet);
131}
132
134{
135 bool bRet = false;
136 if (m_xNoGridRB->get_state_changed_from_saved() ||
137 m_xLinesGridRB->get_state_changed_from_saved() ||
138 m_xLinesPerPageNF->get_value_changed_from_saved() ||
139 m_xTextSizeMF->get_value_changed_from_saved() ||
140 m_xCharsPerLineNF->get_value_changed_from_saved() ||
141 m_xSnapToCharsCB->get_state_changed_from_saved() ||
142 m_xRubySizeMF->get_value_changed_from_saved() ||
143 m_xCharWidthMF->get_value_changed_from_saved() ||
144 m_xRubyBelowCB->get_state_changed_from_saved() ||
145 m_xDisplayCB->get_state_changed_from_saved() ||
146 m_xPrintCB->get_state_changed_from_saved() ||
147 m_xColorLB->IsValueChangedFromSaved())
148 {
150 bRet = true;
151 }
152
153 // draw ticks of ruler
154 SwView * pView = ::GetActiveView();
155 if (pView)
156 {
157 if ( m_bHRulerChanged )
158 pView->GetHRuler().DrawTicks();
159 if ( m_bVRulerChanged )
160 pView->GetVRuler().DrawTicks();
161 }
162 return bRet;
163}
164
166{
167 sal_Int32 nLinesPerPage = 0;
168
169 if(SfxItemState::DEFAULT <= rSet->GetItemState(RES_TEXTGRID))
170 {
171 const SwTextGridItem& rGridItem = rSet->Get(RES_TEXTGRID);
172 weld::RadioButton* pButton = nullptr;
173 switch(rGridItem.GetGridType())
174 {
175 case GRID_NONE : pButton = m_xNoGridRB.get(); break;
176 case GRID_LINES_ONLY : pButton = m_xLinesGridRB.get(); break;
177 default: pButton = m_xCharsGridRB.get();
178 }
179 pButton->set_active(true);
180 m_xDisplayCB->set_active(rGridItem.IsDisplayGrid());
181 GridTypeHdl(*pButton);
182 m_xSnapToCharsCB->set_active(rGridItem.IsSnapToChars());
183 nLinesPerPage = rGridItem.GetLines();
184
186 m_nRubyUserValue = rGridItem.GetBaseHeight();
187 m_bRubyUserValue = true;
188 m_xTextSizeMF->set_value(m_xTextSizeMF->normalize(m_nRubyUserValue), FieldUnit::TWIP);
189 m_xRubySizeMF->set_value(m_xRubySizeMF->normalize(rGridItem.GetRubyHeight()), FieldUnit::TWIP);
190 m_xCharWidthMF->set_value(m_xCharWidthMF->normalize(rGridItem.GetBaseWidth()), FieldUnit::TWIP);
191 m_xRubyBelowCB->set_active(rGridItem.IsRubyTextBelow());
192 m_xPrintCB->set_active(rGridItem.IsPrintGrid());
193 m_xColorLB->SelectEntry(rGridItem.GetColor());
194 }
196
197 if (nLinesPerPage > 0)
198 m_xLinesPerPageNF->set_value(nLinesPerPage);
199
200 m_xNoGridRB->save_state();
201 m_xLinesGridRB->save_state();
202 m_xSnapToCharsCB->save_state();
203 m_xLinesPerPageNF->save_value();
204 m_xTextSizeMF->save_value();
205 m_xCharsPerLineNF->save_value();
206 m_xRubySizeMF->save_value();
207 m_xCharWidthMF->save_value();
208 m_xRubyBelowCB->save_state();
209 m_xDisplayCB->save_state();
210 m_xPrintCB->save_state();
211 m_xColorLB->SaveValue();
212}
213
215{
216 m_aExampleWN.Hide();
219 m_aExampleWN.Show();
220 m_aExampleWN.Invalidate();
221}
222
224{
225 return DeactivateRC::LeavePage;
226}
227
229{
230 SwTextGridItem aGridItem;
231 aGridItem.SetGridType(m_xNoGridRB->get_active() ? GRID_NONE :
233 aGridItem.SetSnapToChars(m_xSnapToCharsCB->get_active());
234 aGridItem.SetLines( static_cast< sal_uInt16 >(m_xLinesPerPageNF->get_value()) );
235 aGridItem.SetBaseHeight( static_cast< sal_uInt16 >(
237 m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FieldUnit::TWIP))) );
238 // Tdf#151544: set ruby height from the value get from UI only when in square page mode.
239 // When in normal mode, the ruby height should be zero.
240 if (m_bSquaredMode)
241 aGridItem.SetRubyHeight(static_cast<sal_uInt16>(m_xRubySizeMF->denormalize(m_xRubySizeMF->get_value(FieldUnit::TWIP))));
242 else
243 aGridItem.SetRubyHeight(0);
244 aGridItem.SetBaseWidth( static_cast< sal_uInt16 >(m_xCharWidthMF->denormalize(m_xCharWidthMF->get_value(FieldUnit::TWIP))) );
245 aGridItem.SetRubyTextBelow(m_xRubyBelowCB->get_active());
247 aGridItem.SetDisplayGrid(m_xDisplayCB->get_active());
248 aGridItem.SetPrintGrid(m_xPrintCB->get_active());
249 aGridItem.SetColor(m_xColorLB->GetSelectEntryColor());
250 rSet.Put(aGridItem);
251
252 SwView * pView = ::GetActiveView();
253 if (pView && aGridItem.GetGridType() != GRID_NONE)
254 {
255 if ( aGridItem.GetGridType() == GRID_LINES_CHARS )
256 {
257 m_bHRulerChanged = true;
258 }
259 m_bVRulerChanged = true;
260 pView->GetHRuler().SetCharWidth(m_xCharWidthMF->get_value(FieldUnit::MM));
261 pView->GetVRuler().SetLineHeight(m_xTextSizeMF->get_value(FieldUnit::MM));
262 }
263}
264
266{
267 if( SfxItemState::UNKNOWN != rSet.GetItemState( RES_FRAMEDIR ))
268 {
269 const SvxFrameDirectionItem& rDirItem =
271 m_bVertical = rDirItem.GetValue() == SvxFrameDirection::Vertical_RL_TB||
272 rDirItem.GetValue() == SvxFrameDirection::Vertical_LR_TB;
273 }
274
275 if( SfxItemState::SET != rSet.GetItemState( SID_ATTR_PAGE_SIZE ))
276 return;
277
278 const SvxSizeItem& rSize = rSet.Get(SID_ATTR_PAGE_SIZE);
279 const SvxLRSpaceItem& rLRSpace = rSet.Get( RES_LR_SPACE );
280 const SvxULSpaceItem& rULSpace = rSet.Get( RES_UL_SPACE );
281 const SvxBoxItem& rBox = rSet.Get(RES_BOX);
282 sal_Int32 nDistanceLR = rLRSpace.GetLeft() + rLRSpace.GetRight();
283 sal_Int32 nDistanceUL = rULSpace.GetUpper() + rULSpace.GetLower();
284
285 for( const TypedWhichId<SvxSetItem> & nId : { SID_ATTR_PAGE_HEADERSET, SID_ATTR_PAGE_FOOTERSET })
286 {
287 if( const SvxSetItem* pItem = rSet.GetItemIfSet( nId, false ) )
288 {
289 const SfxItemSet& rExtraSet = pItem->GetItemSet();
290 const SfxBoolItem& rOn =
291 rExtraSet.Get( rSet.GetPool()->GetWhich( SID_ATTR_PAGE_ON ) );
292
293 if ( rOn.GetValue() )
294 {
295 const SvxSizeItem& rSizeItem =
296 rExtraSet.Get(rSet.GetPool()->GetWhich(SID_ATTR_PAGE_SIZE));
297 nDistanceUL += rSizeItem.GetSize().Height();
298 }
299 }
300 }
301
302 sal_Int32 nValue1 = rSize.GetSize().Height() - nDistanceUL -
303 rBox.GetDistance(SvxBoxItemLine::TOP) -
304 rBox.GetDistance(SvxBoxItemLine::BOTTOM);
305 sal_Int32 nValue2 = rSize.GetSize().Width() - nDistanceLR -
306 rBox.GetDistance(SvxBoxItemLine::LEFT) -
307 rBox.GetDistance(SvxBoxItemLine::RIGHT);
308 if(m_bVertical)
309 {
310 m_aPageSize.setWidth( nValue1 );
311 m_aPageSize.setHeight( nValue2 );
312 }
313 else
314 {
315 m_aPageSize.setWidth( nValue2 );
316 m_aPageSize.setHeight( nValue1 );
317 }
318
319 sal_Int32 nTextSize = static_cast< sal_Int32 >(m_bRubyUserValue ?
321 m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FieldUnit::TWIP)));
322
323 if ( m_bSquaredMode )
324 {
325 sal_Int32 nCharsPerLine = m_aPageSize.Width() / nTextSize;
326 m_xCharsPerLineNF->set_max(nCharsPerLine);
327 m_xCharsPerLineNF->set_sensitive(nCharsPerLine != 0);
328 m_xCharsPerLineNF->set_value(nCharsPerLine);
329 sal_Int32 nMaxLines = m_aPageSize.Height() /
330 ( m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FieldUnit::TWIP)) +
331 m_xRubySizeMF->denormalize(m_xRubySizeMF->get_value(FieldUnit::TWIP)));
332 m_xLinesPerPageNF->set_max(nMaxLines);
333 m_xLinesPerPageNF->set_sensitive(nMaxLines != 0);
336 }
337 else
338 {
339 sal_Int32 nTextWidth = static_cast< sal_Int32 >(m_xCharWidthMF->denormalize(m_xCharWidthMF->get_value(FieldUnit::TWIP)));
340 m_xLinesPerPageNF->set_value(m_aPageSize.Height() / nTextSize);
341 if (nTextWidth)
342 m_xCharsPerLineNF->set_value(m_aPageSize.Width() / nTextWidth);
343 else
344 m_xCharsPerLineNF->set_value(45);
347 }
348}
349
350void SwTextGridPage::SetLinesOrCharsRanges(weld::Label& rField, const sal_Int32 nValue )
351{
352 OUString aFieldStr = "( 1 -" + OUString::number(nValue) + " )";
353 rField.set_label(aFieldStr);
354}
355
357{
358 return WhichRangesContainer(svl::Items<RES_TEXTGRID, RES_TEXTGRID>);
359}
360
361IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, weld::SpinButton&, rField, void)
362{
363 //if in squared mode
364 if ( m_bSquaredMode )
365 {
366 if (m_xCharsPerLineNF.get() == &rField)
367 {
368 auto nValue = m_xCharsPerLineNF->get_value();
369 assert(nValue && "div-by-zero");
370 auto nWidth = m_aPageSize.Width() / nValue;
371 m_xTextSizeMF->set_value(m_xTextSizeMF->normalize(nWidth), FieldUnit::TWIP);
372 //prevent rounding errors in the MetricField by saving the used value
373 m_nRubyUserValue = nWidth;
374 m_bRubyUserValue = true;
375
376 }
377 //set maximum line per page
378 {
379 sal_Int32 nMaxLines = static_cast< sal_Int32 >(m_aPageSize.Height() /
380 ( m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FieldUnit::TWIP)) +
381 m_xRubySizeMF->denormalize(m_xRubySizeMF->get_value(FieldUnit::TWIP))));
382 m_xLinesPerPageNF->set_max(nMaxLines);
383 m_xLinesPerPageNF->set_sensitive(nMaxLines != 0);
384 }
385 SetLinesOrCharsRanges( *m_xLinesRangeFT , m_xLinesPerPageNF->get_max() );
386 SetLinesOrCharsRanges( *m_xCharsRangeFT , m_xCharsPerLineNF->get_max() );
387 }
388 else//in normal mode
389 {
390 if (m_xLinesPerPageNF.get() == &rField)
391 {
392 auto nValue = m_xLinesPerPageNF->get_value();
393 assert(nValue && "div-by-zero");
394 auto nHeight = m_aPageSize.Height() / nValue;
395 m_xTextSizeMF->set_value(m_xTextSizeMF->normalize(nHeight), FieldUnit::TWIP);
396 SetLinesOrCharsRanges( *m_xLinesRangeFT , m_xLinesPerPageNF->get_max() );
397
398 m_nRubyUserValue = nHeight;
399 m_bRubyUserValue = true;
400 }
401 else if (m_xCharsPerLineNF.get() == &rField)
402 {
403 auto nValue = m_xCharsPerLineNF->get_value();
404 assert(nValue && "div-by-zero");
405 auto nWidth = m_aPageSize.Width() / nValue;
406 m_xCharWidthMF->set_value(m_xCharWidthMF->normalize(nWidth), FieldUnit::TWIP);
407 SetLinesOrCharsRanges( *m_xCharsRangeFT , m_xCharsPerLineNF->get_max() );
408 }
409 }
410 GridModifyHdl();
411}
412
413IMPL_LINK(SwTextGridPage, TextSizeChangedHdl, weld::MetricSpinButton&, rField, void)
414{
415 //if in squared mode
416 if( m_bSquaredMode )
417 {
418 if (m_xTextSizeMF.get() == &rField)
419 {
420 m_bRubyUserValue = false;
421
422 // fdo#50941: set maximum characters per line
423 sal_Int32 nTextSize = static_cast< sal_Int32 >(m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FieldUnit::TWIP)));
424 if (nTextSize > 0)
425 {
426 sal_Int32 nMaxChars = m_aPageSize.Width() / nTextSize;
427 m_xCharsPerLineNF->set_value(nMaxChars);
428 m_xCharsPerLineNF->set_max(nMaxChars);
429 m_xCharsPerLineNF->set_sensitive(nMaxChars != 0);
430 SetLinesOrCharsRanges( *m_xCharsRangeFT , m_xCharsPerLineNF->get_max() );
431 }
432 }
433 //set maximum line per page
434 {
435 sal_Int32 nMaxLines = static_cast< sal_Int32 >(m_aPageSize.Height() /
436 ( m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FieldUnit::TWIP)) +
437 m_xRubySizeMF->denormalize(m_xRubySizeMF->get_value(FieldUnit::TWIP))));
438 m_xLinesPerPageNF->set_max(nMaxLines);
439 m_xLinesPerPageNF->set_sensitive(nMaxLines != 0);
440 SetLinesOrCharsRanges( *m_xLinesRangeFT , m_xLinesPerPageNF->get_max() );
441 }
442 }
443 else
444 {
445 if (m_xTextSizeMF.get() == &rField)
446 {
447 sal_Int32 nTextSize = static_cast< sal_Int32 >(m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FieldUnit::TWIP)));
448 m_xLinesPerPageNF->set_value(m_aPageSize.Height() / nTextSize);
449 m_bRubyUserValue = false;
450 SetLinesOrCharsRanges( *m_xLinesRangeFT , m_xLinesPerPageNF->get_max() );
451 }
452 else if (m_xCharWidthMF.get() == &rField)
453 {
454 sal_Int32 nTextWidth = static_cast< sal_Int32 >(m_xCharWidthMF->denormalize(m_xCharWidthMF->get_value(FieldUnit::TWIP)));
455 sal_Int32 nMaxChar = 45 ;
456 if (nTextWidth)
457 nMaxChar = m_aPageSize.Width() / nTextWidth;
458 m_xCharsPerLineNF->set_value( nMaxChar );
459 SetLinesOrCharsRanges( *m_xCharsRangeFT , m_xCharsPerLineNF->get_max() );
460 }
461 //rubySize is disabled
462 }
463 GridModifyHdl();
464}
465
466IMPL_LINK(SwTextGridPage, GridTypeHdl, weld::Toggleable&, rButton, void)
467{
468 if (!rButton.get_active())
469 return;
470
471 if (m_xNoGridRB.get() == &rButton)
472 {
473 // GRID_NONE mode:
474 // "Layout" and "Display" sections should all be disabled.
475 m_xLayoutFL->set_sensitive(false);
476 m_xDisplayFL->set_sensitive(false);
477 }
478 else
479 {
480 // GRID_LINES_ONLY or GRID_LINES_CHARS mode:
481 // "Layout" and "Display" sections should all be enabled;
482 // DisplayGridHdl should be executed;
483 m_xLayoutFL->set_sensitive(true);
484 m_xDisplayFL->set_sensitive(true);
485 DisplayGridHdl(*m_xDisplayCB);
486 }
487
488 if (m_xCharsGridRB.get() == &rButton)
489 {
490 // GRID_LINES_CHARS mode:
491 // "Snap to character" should be enabled;
492 // "Characters per line" should be enabled;
493 // "Characters range" should be enabled;
494 m_xSnapToCharsCB->set_sensitive(true);
495 m_xCharsPerLineFT->set_sensitive(true);
496 m_xCharsPerLineNF->set_sensitive(true);
497 m_xCharsRangeFT->set_sensitive(true);
498 m_xCharWidthFT->set_sensitive(true);
499 m_xCharWidthMF->set_sensitive(true);
500 }
501 else
502 {
503 // GRID_NONE or GRID_LINES_ONLY mode:
504 // "Snap to character" should be disabled;
505 // "Characters per line" should be disabled;
506 // "Characters range" should be disabled;
507 m_xSnapToCharsCB->set_sensitive(false);
508 m_xCharsPerLineFT->set_sensitive(false);
509 m_xCharsPerLineNF->set_sensitive(false);
510 m_xCharsRangeFT->set_sensitive(false);
511 m_xCharWidthFT->set_sensitive(false);
512 m_xCharWidthMF->set_sensitive(false);
513 }
514
515 if (m_xNoGridRB.get() != &rButton)
516 {
517 // GRID_LINES_ONLY or GRID_LINES_CHARS mode: (additionally)
518 // TextSizeChangedHdl should be executed to recalculate which dependencies are sensitive.
519 TextSizeChangedHdl(*m_xTextSizeMF);
520 }
521
522 GridModifyHdl();
523}
524
526{
527 bool bChecked = m_xDisplayCB->get_active();
528 m_xPrintCB->set_sensitive(bChecked);
529 m_xPrintCB->set_active(bChecked);
530}
531
533{
534 GridModifyHdl();
535}
536
538{
539 GridModifyHdl();
540}
541
543{
544 const SfxItemSet& rOldSet = GetItemSet();
545 SfxItemSet aSet(rOldSet);
546 const SfxItemSet* pExSet = GetDialogExampleSet();
547 if(pExSet)
548 aSet.Put(*pExSet);
549 PutGridItem(aSet);
551}
552
553/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool GetValue() const
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
SfxItemPool * GetPool() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
const SfxItemSet & GetItemSet() const
SfxOkDialogController * GetDialogController() const
const SfxItemSet * GetDialogExampleSet() const
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
sal_Int16 GetDistance(SvxBoxItemLine nLine, bool bAllowNegative=false) const
tools::Long GetRight() const
tools::Long GetLeft() const
const Size & GetSize() const
sal_uInt16 GetUpper() const
sal_uInt16 GetLower() const
bool IsSquaredPageMode() const
Definition: docdesc.cxx:1038
void UpdateExample(const SfxItemSet &rSet)
Definition: colex.cxx:597
sal_uInt16 GetBaseHeight() const
Definition: tgrditem.hxx:75
void SetSnapToChars(bool bNew)
Definition: tgrditem.hxx:102
void SetRubyHeight(sal_uInt16 nNew)
Definition: tgrditem.hxx:79
sal_uInt16 GetBaseWidth() const
Definition: tgrditem.hxx:97
void SetBaseHeight(sal_uInt16 nNew)
Definition: tgrditem.hxx:76
void SetLines(sal_uInt16 nNew)
Definition: tgrditem.hxx:73
void SetSquaredMode(bool bNew)
Definition: tgrditem.hxx:106
void SetPrintGrid(bool bNew)
Definition: tgrditem.hxx:90
sal_uInt16 GetRubyHeight() const
Definition: tgrditem.hxx:78
void SetColor(const Color &rCol)
Definition: tgrditem.hxx:70
void SetBaseWidth(sal_uInt16 nNew)
Definition: tgrditem.hxx:98
void SetGridType(SwTextGrid eNew)
Definition: tgrditem.hxx:82
sal_uInt16 GetLines() const
Definition: tgrditem.hxx:72
SwTextGrid GetGridType() const
Definition: tgrditem.hxx:81
bool IsRubyTextBelow() const
Definition: tgrditem.hxx:84
const Color & GetColor() const
Definition: tgrditem.hxx:69
bool IsDisplayGrid() const
Definition: tgrditem.hxx:92
void SetRubyTextBelow(bool bNew)
Definition: tgrditem.hxx:86
void SetDisplayGrid(bool bNew)
Definition: tgrditem.hxx:94
bool IsPrintGrid() const
Definition: tgrditem.hxx:88
bool IsSnapToChars() const
Definition: tgrditem.hxx:100
std::unique_ptr< weld::MetricSpinButton > m_xTextSizeMF
Definition: pggrid.hxx:48
bool m_bVertical
Definition: pggrid.hxx:34
std::unique_ptr< weld::Label > m_xLinesRangeFT
Definition: pggrid.hxx:47
bool m_bSquaredMode
Definition: pggrid.hxx:35
static void SetLinesOrCharsRanges(weld::Label &rField, const sal_Int32 nValue)
Definition: pggrid.cxx:350
std::unique_ptr< weld::SpinButton > m_xLinesPerPageNF
Definition: pggrid.hxx:46
bool m_bVRulerChanged
Definition: pggrid.hxx:37
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: pggrid.cxx:128
std::unique_ptr< weld::Label > m_xRubySizeFT
Definition: pggrid.hxx:54
std::unique_ptr< weld::CheckButton > m_xDisplayCB
Definition: pggrid.hxx:58
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: pggrid.cxx:214
std::unique_ptr< weld::RadioButton > m_xLinesGridRB
Definition: pggrid.hxx:41
static WhichRangesContainer GetRanges()
Definition: pggrid.cxx:356
virtual ~SwTextGridPage() override
Definition: pggrid.cxx:123
std::unique_ptr< weld::RadioButton > m_xNoGridRB
Definition: pggrid.hxx:40
std::unique_ptr< weld::Label > m_xCharWidthFT
Definition: pggrid.hxx:52
SwTextGridPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: pggrid.cxx:40
sal_Int32 m_nRubyUserValue
Definition: pggrid.hxx:31
void UpdatePageSize(const SfxItemSet &rSet)
Definition: pggrid.cxx:265
std::unique_ptr< weld::MetricSpinButton > m_xCharWidthMF
Definition: pggrid.hxx:53
bool m_bRubyUserValue
Definition: pggrid.hxx:32
std::unique_ptr< weld::SpinButton > m_xCharsPerLineNF
Definition: pggrid.hxx:50
void PutGridItem(SfxItemSet &rSet)
Definition: pggrid.cxx:228
void GridModifyHdl()
Definition: pggrid.cxx:542
std::unique_ptr< weld::CheckButton > m_xPrintCB
Definition: pggrid.hxx:59
bool m_bHRulerChanged
Definition: pggrid.hxx:36
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: pggrid.cxx:223
std::unique_ptr< weld::CheckButton > m_xSnapToCharsCB
Definition: pggrid.hxx:43
virtual void Reset(const SfxItemSet *rSet) override
Definition: pggrid.cxx:165
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: pggrid.cxx:133
std::unique_ptr< weld::MetricSpinButton > m_xRubySizeMF
Definition: pggrid.hxx:55
SwPageGridExample m_aExampleWN
Definition: pggrid.hxx:39
std::unique_ptr< weld::RadioButton > m_xCharsGridRB
Definition: pggrid.hxx:42
std::unique_ptr< weld::CheckButton > m_xRubyBelowCB
Definition: pggrid.hxx:56
Size m_aPageSize
Definition: pggrid.hxx:33
std::unique_ptr< ColorListBox > m_xColorLB
Definition: pggrid.hxx:60
std::unique_ptr< weld::Label > m_xCharsRangeFT
Definition: pggrid.hxx:51
SwDoc * GetDoc() const
Definition: viewsh.hxx:290
Definition: view.hxx:146
SvxRuler & GetVRuler()
Definition: view.hxx:498
SwWrtShell * GetWrtShellPtr() const
Definition: view.hxx:417
SvxRuler & GetHRuler()
Definition: view.hxx:497
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
virtual void set_label(const OUString &rText)=0
virtual void set_active(bool active)=0
FieldUnit
sal_Int16 nValue
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(120)
constexpr TypedWhichId< SwTextGridItem > RES_TEXTGRID(115)
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(92)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(106)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
constexpr auto toTwips(N number, Length from)
long Long
sal_Int16 nId
IMPL_LINK_NOARG(SwTextGridPage, DisplayGridHdl, weld::Toggleable &, void)
Definition: pggrid.cxx:525
IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, weld::SpinButton &, rField, void)
Definition: pggrid.cxx:361
constexpr tools::Long constTwips_5mm
Definition: pggrid.cxx:38
static SfxItemSet & rSet
SwView * GetActiveView()
Definition: swmodul1.cxx:116
DeactivateRC
@ GRID_LINES_ONLY
Definition: tgrditem.hxx:30
@ GRID_LINES_CHARS
Definition: tgrditem.hxx:30
@ GRID_NONE
Definition: tgrditem.hxx:30