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"),
130 return std::make_unique<SwTextGridPage>(pPage, pController, *
rSet);
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;
263 m_bVertical = rDirItem.GetValue() == SvxFrameDirection::Vertical_RL_TB||
264 rDirItem.GetValue() == SvxFrameDirection::Vertical_LR_TB;
281 const SfxItemSet& rExtraSet = pItem->GetItemSet();
297 sal_Int32 nValue2 = rSize.
GetSize().
Width() - nDistanceLR -
344 OUString aFieldStr =
"( 1 -" + OUString::number(
nValue) +
" )";
356 if ( m_bSquaredMode )
358 if (m_xCharsPerLineNF.get() == &rField)
360 auto nValue = m_xCharsPerLineNF->get_value();
361 assert(
nValue &&
"div-by-zero");
362 auto nWidth = m_aPageSize.Width() /
nValue;
363 m_xTextSizeMF->set_value(m_xTextSizeMF->normalize(nWidth), FieldUnit::TWIP);
365 m_nRubyUserValue = nWidth;
366 m_bRubyUserValue =
true;
371 sal_Int32 nMaxLines =
static_cast< sal_Int32
>(m_aPageSize.Height() /
372 ( m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FieldUnit::TWIP)) +
373 m_xRubySizeMF->denormalize(m_xRubySizeMF->get_value(FieldUnit::TWIP))));
374 m_xLinesPerPageNF->set_max(nMaxLines);
375 m_xLinesPerPageNF->set_sensitive(nMaxLines != 0);
377 SetLinesOrCharsRanges( *m_xLinesRangeFT , m_xLinesPerPageNF->get_max() );
378 SetLinesOrCharsRanges( *m_xCharsRangeFT , m_xCharsPerLineNF->get_max() );
382 if (m_xLinesPerPageNF.get() == &rField)
384 auto nValue = m_xLinesPerPageNF->get_value();
385 assert(
nValue &&
"div-by-zero");
386 auto nHeight = m_aPageSize.Height() /
nValue;
387 m_xTextSizeMF->set_value(m_xTextSizeMF->normalize(nHeight), FieldUnit::TWIP);
388 m_xRubySizeMF->set_value(0, FieldUnit::TWIP);
389 SetLinesOrCharsRanges( *m_xLinesRangeFT , m_xLinesPerPageNF->get_max() );
391 m_nRubyUserValue = nHeight;
392 m_bRubyUserValue =
true;
394 else if (m_xCharsPerLineNF.get() == &rField)
396 auto nValue = m_xCharsPerLineNF->get_value();
397 assert(
nValue &&
"div-by-zero");
398 auto nWidth = m_aPageSize.Width() /
nValue;
399 m_xCharWidthMF->set_value(m_xCharWidthMF->normalize(nWidth), FieldUnit::TWIP);
400 SetLinesOrCharsRanges( *m_xCharsRangeFT , m_xCharsPerLineNF->get_max() );
411 if (m_xTextSizeMF.get() == &rField)
413 m_bRubyUserValue =
false;
416 sal_Int32 nTextSize =
static_cast< sal_Int32
>(m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FieldUnit::TWIP)));
419 sal_Int32 nMaxChars = m_aPageSize.Width() / nTextSize;
420 m_xCharsPerLineNF->set_value(nMaxChars);
421 m_xCharsPerLineNF->set_max(nMaxChars);
422 m_xCharsPerLineNF->set_sensitive(nMaxChars != 0);
423 SetLinesOrCharsRanges( *m_xCharsRangeFT , m_xCharsPerLineNF->get_max() );
428 sal_Int32 nMaxLines =
static_cast< sal_Int32
>(m_aPageSize.Height() /
429 ( m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FieldUnit::TWIP)) +
430 m_xRubySizeMF->denormalize(m_xRubySizeMF->get_value(FieldUnit::TWIP))));
431 m_xLinesPerPageNF->set_max(nMaxLines);
432 m_xLinesPerPageNF->set_sensitive(nMaxLines != 0);
433 SetLinesOrCharsRanges( *m_xLinesRangeFT , m_xLinesPerPageNF->get_max() );
438 if (m_xTextSizeMF.get() == &rField)
440 sal_Int32 nTextSize =
static_cast< sal_Int32
>(m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FieldUnit::TWIP)));
441 m_xLinesPerPageNF->set_value(m_aPageSize.Height() / nTextSize);
442 m_bRubyUserValue =
false;
443 SetLinesOrCharsRanges( *m_xLinesRangeFT , m_xLinesPerPageNF->get_max() );
445 else if (m_xCharWidthMF.get() == &rField)
447 sal_Int32 nTextWidth =
static_cast< sal_Int32
>(m_xCharWidthMF->denormalize(m_xCharWidthMF->get_value(FieldUnit::TWIP)));
448 sal_Int32 nMaxChar = 45 ;
450 nMaxChar = m_aPageSize.Width() / nTextWidth;
451 m_xCharsPerLineNF->set_value( nMaxChar );
452 SetLinesOrCharsRanges( *m_xCharsRangeFT , m_xCharsPerLineNF->get_max() );
461 bool bEnable = m_xNoGridRB.get() != &rButton;
462 m_xLayoutFL->set_sensitive(bEnable);
463 m_xDisplayFL->set_sensitive(bEnable);
467 DisplayGridHdl(*m_xDisplayCB);
469 bEnable = m_xCharsGridRB.get() == &rButton;
470 m_xSnapToCharsCB->set_sensitive(bEnable);
472 bEnable = m_xLinesGridRB.get() == &rButton;
473 if (bEnable && !m_bSquaredMode)
475 m_xCharsPerLineFT->set_sensitive(
false);
476 m_xCharsPerLineNF->set_sensitive(
false);
477 m_xCharsRangeFT->set_sensitive(
false);
478 m_xCharWidthFT->set_sensitive(
false);
479 m_xCharWidthMF->set_sensitive(
false);
487 bool bChecked = m_xDisplayCB->get_active();
488 m_xPrintCB->set_sensitive(bChecked);
489 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
bool IsSquaredPageMode() 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 SetLines(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)
sal_uInt16 GetLines() const
SwTextGrid GetGridType() const
bool IsRubyTextBelow() const
const Color & GetColor() const
bool IsDisplayGrid() const
void SetRubyTextBelow(bool bNew)
void SetDisplayGrid(bool bNew)
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
SwWrtShell * GetWrtShellPtr() const
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(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)
#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