41 :
SfxTabPage(pPage, pController,
"modules/swriter/ui/textgridpage.ui",
"TextGridPage", &
rSet)
43 , m_bRubyUserValue(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"),
128 return std::make_unique<SwTextGridPage>(pPage, pController, *
rSet);
155 pView->GetHRuler().DrawTicks();
157 pView->GetVRuler().DrawTicks();
164 sal_Int32 nLinesPerPage = 0;
166 if(SfxItemState::DEFAULT <= rSet->GetItemState(
RES_TEXTGRID))
178 GridTypeHdl(*pButton);
180 nLinesPerPage = rGridItem.
GetLines();
194 if (nLinesPerPage > 0)
222 return DeactivateRC::LeavePage;
268 m_bVertical = rDirItem.GetValue() == SvxFrameDirection::Vertical_RL_TB||
269 rDirItem.GetValue() == SvxFrameDirection::Vertical_LR_TB;
286 const SfxItemSet& rExtraSet = pItem->GetItemSet();
302 sal_Int32 nValue2 = rSize.
GetSize().
Width() - nDistanceLR -
349 OUString aFieldStr =
"( 1 -" + OUString::number(
nValue) +
" )";
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);
370 m_nRubyUserValue = nWidth;
371 m_bRubyUserValue =
true;
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() );
415 if (m_xTextSizeMF.get() == &rField)
417 m_bRubyUserValue =
false;
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() );
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() );
465 if (!rButton.get_active())
468 if (m_xNoGridRB.get() == &rButton)
472 m_xLayoutFL->set_sensitive(
false);
473 m_xDisplayFL->set_sensitive(
false);
480 m_xLayoutFL->set_sensitive(
true);
481 m_xDisplayFL->set_sensitive(
true);
482 DisplayGridHdl(*m_xDisplayCB);
485 if (m_xCharsGridRB.get() == &rButton)
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);
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)
516 TextSizeChangedHdl(*m_xTextSizeMF);
524 bool bChecked = m_xDisplayCB->get_active();
525 m_xPrintCB->set_sensitive(bChecked);
526 m_xPrintCB->set_active(bChecked);
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
void UpdateExample(const SfxItemSet &rSet)
sal_uInt16 GetBaseHeight() const
void SetSnapToChars(bool bNew)
void SetRubyHeight(sal_uInt16 nNew)
sal_uInt16 GetBaseWidth() const
void SetBaseHeight(sal_uInt16 nNew)
void SetSquaredMode(bool bNew)
void SetPrintGrid(bool bNew)
sal_uInt16 GetRubyHeight() const
void SetColor(const Color &rCol)
void SetBaseWidth(sal_uInt16 nNew)
void SetGridType(SwTextGrid eNew)
SwTextGrid GetGridType() const
bool IsRubyTextBelow() const
const Color & GetColor() const
bool IsDisplayGrid() const
void SetRubyTextBelow(bool bNew)
void SetDisplayGrid(bool bNew)
void SetLines(sal_Int32 nNew)
sal_Int32 GetLines() const
bool IsSnapToChars() const
std::unique_ptr< weld::MetricSpinButton > m_xTextSizeMF
std::unique_ptr< weld::Label > m_xLinesRangeFT
static void SetLinesOrCharsRanges(weld::Label &rField, const sal_Int32 nValue)
std::unique_ptr< weld::SpinButton > m_xLinesPerPageNF
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
std::unique_ptr< weld::Label > m_xRubySizeFT
std::unique_ptr< weld::CheckButton > m_xDisplayCB
virtual void ActivatePage(const SfxItemSet &rSet) override
std::unique_ptr< weld::RadioButton > m_xLinesGridRB
static WhichRangesContainer GetRanges()
virtual ~SwTextGridPage() override
std::unique_ptr< weld::RadioButton > m_xNoGridRB
std::unique_ptr< weld::Label > m_xCharWidthFT
SwTextGridPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
sal_Int32 m_nRubyUserValue
void UpdatePageSize(const SfxItemSet &rSet)
std::unique_ptr< weld::MetricSpinButton > m_xCharWidthMF
std::unique_ptr< weld::SpinButton > m_xCharsPerLineNF
void PutGridItem(SfxItemSet &rSet)
std::unique_ptr< weld::CheckButton > m_xPrintCB
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
std::unique_ptr< weld::CheckButton > m_xSnapToCharsCB
virtual void Reset(const SfxItemSet *rSet) override
virtual bool FillItemSet(SfxItemSet *rSet) override
std::unique_ptr< weld::MetricSpinButton > m_xRubySizeMF
SwPageGridExample m_aExampleWN
std::unique_ptr< weld::RadioButton > m_xCharsGridRB
std::unique_ptr< weld::CheckButton > m_xRubyBelowCB
std::unique_ptr< ColorListBox > m_xColorLB
std::unique_ptr< weld::Label > m_xCharsRangeFT
Used by the UI to modify the document model.
virtual void set_label(const OUString &rText)=0
virtual void set_active(bool active)=0
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(126)
constexpr TypedWhichId< SwTextGridItem > RES_TEXTGRID(121)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(112)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(97)
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(98)
#define LINK(Instance, Class, Member)
constexpr auto toTwips(N number, Length from)
IMPL_LINK_NOARG(SwTextGridPage, DisplayGridHdl, weld::Toggleable &, void)
IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, weld::SpinButton &, rField, void)
constexpr tools::Long constTwips_5mm