diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/misc/pggrid.cxx | 434 | ||||
-rw-r--r-- | sw/source/uibase/frmdlg/colex.cxx | 173 | ||||
-rw-r--r-- | sw/source/uibase/inc/colex.hxx | 22 | ||||
-rw-r--r-- | sw/source/uibase/inc/pggrid.hxx | 77 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/textgridpage.ui | 53 |
5 files changed, 438 insertions, 321 deletions
diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx index d143f35d123f..d12fc4de6ffb 100644 --- a/sw/source/ui/misc/pggrid.cxx +++ b/sw/source/ui/misc/pggrid.cxx @@ -41,73 +41,56 @@ #include <swmodule.hxx> #include <view.hxx> -SwTextGridPage::SwTextGridPage(vcl::Window *pParent, const SfxItemSet &rSet) : - SfxTabPage(pParent, "TextGridPage", "modules/swriter/ui/textgridpage.ui", &rSet), - m_nRubyUserValue(0), - m_bRubyUserValue(false), - m_aPageSize(MM50, MM50), - m_bVertical(false), - m_bSquaredMode(false), - m_bHRulerChanged( false ), - m_bVRulerChanged( false ) +SwTextGridPage::SwTextGridPage(TabPageParent pParent, const SfxItemSet &rSet) + : SfxTabPage(pParent, "modules/swriter/ui/textgridpage.ui", "TextGridPage", &rSet) + , m_nRubyUserValue(0) + , m_bRubyUserValue(false) + , m_aPageSize(MM50, MM50) + , m_bVertical(false) + , m_bSquaredMode(false) + , m_bHRulerChanged(false) + , m_bVRulerChanged(false) + , m_xNoGridRB(m_xBuilder->weld_radio_button("radioRB_NOGRID")) + , m_xLinesGridRB(m_xBuilder->weld_radio_button("radioRB_LINESGRID")) + , m_xCharsGridRB(m_xBuilder->weld_radio_button("radioRB_CHARSGRID")) + , m_xSnapToCharsCB(m_xBuilder->weld_check_button("checkCB_SNAPTOCHARS")) + , m_xExampleWN(new weld::CustomWeld(*m_xBuilder, "drawingareaWN_EXAMPLE", m_aExampleWN)) + , m_xLayoutFL(m_xBuilder->weld_widget("frameFL_LAYOUT")) + , m_xLinesPerPageNF(m_xBuilder->weld_spin_button("spinNF_LINESPERPAGE")) + , m_xLinesRangeFT(m_xBuilder->weld_label("labelFT_LINERANGE")) + , m_xTextSizeMF(m_xBuilder->weld_metric_spin_button("spinMF_TEXTSIZE", FUNIT_POINT)) + , m_xCharsPerLineFT(m_xBuilder->weld_label("labelFT_CHARSPERLINE")) + , m_xCharsPerLineNF(m_xBuilder->weld_spin_button("spinNF_CHARSPERLINE")) + , m_xCharsRangeFT(m_xBuilder->weld_label("labelFT_CHARRANGE")) + , m_xCharWidthFT(m_xBuilder->weld_label("labelFT_CHARWIDTH")) + , m_xCharWidthMF(m_xBuilder->weld_metric_spin_button("spinMF_CHARWIDTH", FUNIT_POINT)) + , m_xRubySizeFT(m_xBuilder->weld_label("labelFT_RUBYSIZE")) + , m_xRubySizeMF(m_xBuilder->weld_metric_spin_button("spinMF_RUBYSIZE", FUNIT_POINT)) + , m_xRubyBelowCB(m_xBuilder->weld_check_button("checkCB_RUBYBELOW")) + , m_xDisplayFL(m_xBuilder->weld_widget("frameFL_DISPLAY")) + , m_xDisplayCB(m_xBuilder->weld_check_button("checkCB_DISPLAY")) + , m_xPrintCB(m_xBuilder->weld_check_button("checkCB_PRINT")) + , m_xColorLB(new ColorListBox(m_xBuilder->weld_menu_button("listLB_COLOR"), GetFrameWeld(), true)) { - get(m_pNoGridRB,"radioRB_NOGRID"); - get(m_pLinesGridRB,"radioRB_LINESGRID"); - get(m_pCharsGridRB,"radioRB_CHARSGRID"); - get(m_pSnapToCharsCB,"checkCB_SNAPTOCHARS"); - - get(m_pExampleWN,"drawingareaWN_EXAMPLE"); - get(m_pLayoutFL,"frameFL_LAYOUT"); - - get(m_pLinesPerPageNF,"spinNF_LINESPERPAGE"); - get(m_pLinesRangeFT,"labelFT_LINERANGE"); - - get(m_pTextSizeMF,"spinMF_TEXTSIZE"); - get(m_pCharsPerLineFT,"labelFT_CHARSPERLINE"); - get(m_pCharsPerLineNF,"spinNF_CHARSPERLINE"); - get(m_pCharsRangeFT,"labelFT_CHARRANGE"); - get(m_pCharWidthFT,"labelFT_CHARWIDTH"); - get(m_pCharWidthMF,"spinMF_CHARWIDTH"); - get(m_pRubySizeFT,"labelFT_RUBYSIZE"); - get(m_pRubySizeMF,"spinMF_RUBYSIZE"); - get(m_pRubyBelowCB,"checkCB_RUBYBELOW"); - - get(m_pDisplayFL,"frameFL_DISPLAY"); - get(m_pDisplayCB,"checkCB_DISPLAY"); - get(m_pPrintCB,"checkCB_PRINT"); - get(m_pColorLB,"listLB_COLOR"); - - Link<SpinField&,void> aLink = LINK(this, SwTextGridPage, CharorLineChangedHdl); - Link<Control&,void> aLink2 = LINK(this, SwTextGridPage, CharorLineLoseFocusdHdl); - m_pCharsPerLineNF->SetUpHdl(aLink); - m_pCharsPerLineNF->SetDownHdl(aLink); - m_pCharsPerLineNF->SetLoseFocusHdl(aLink2); - m_pLinesPerPageNF->SetUpHdl(aLink); - m_pLinesPerPageNF->SetDownHdl(aLink); - m_pLinesPerPageNF->SetLoseFocusHdl(aLink2); - - Link<SpinField&,void> aSizeLink = LINK(this, SwTextGridPage, TextSizeChangedHdl); - Link<Control&,void> aSizeLink2 = LINK(this, SwTextGridPage, TextSizeLoseFocusHdl); - m_pTextSizeMF->SetUpHdl(aSizeLink); - m_pTextSizeMF->SetDownHdl(aSizeLink); - m_pTextSizeMF->SetLoseFocusHdl(aSizeLink2); - m_pRubySizeMF->SetUpHdl(aSizeLink); - m_pRubySizeMF->SetDownHdl(aSizeLink); - m_pRubySizeMF->SetLoseFocusHdl(aSizeLink2); - m_pCharWidthMF->SetUpHdl(aSizeLink); - m_pCharWidthMF->SetDownHdl(aSizeLink); - m_pCharWidthMF->SetLoseFocusHdl(aSizeLink2); - - Link<Button*,void> aGridTypeHdl = LINK(this, SwTextGridPage, GridTypeHdl); - m_pNoGridRB->SetClickHdl(aGridTypeHdl); - m_pLinesGridRB->SetClickHdl(aGridTypeHdl); - m_pCharsGridRB->SetClickHdl(aGridTypeHdl); - - m_pColorLB->SetSelectHdl(LINK(this, SwTextGridPage, ColorModifyHdl)); - m_pPrintCB->SetClickHdl(LINK(this, SwTextGridPage, GridModifyClickHdl)); - m_pRubyBelowCB->SetClickHdl(LINK(this, SwTextGridPage, GridModifyClickHdl)); - - m_pDisplayCB->SetClickHdl(LINK(this, SwTextGridPage, DisplayGridHdl)); + Link<weld::SpinButton&,void> aLink = LINK(this, SwTextGridPage, CharorLineChangedHdl); + m_xCharsPerLineNF->connect_value_changed(aLink); + m_xLinesPerPageNF->connect_value_changed(aLink); + + Link<weld::MetricSpinButton&,void> aSizeLink = LINK(this, SwTextGridPage, TextSizeChangedHdl); + m_xTextSizeMF->connect_value_changed(aSizeLink); + m_xRubySizeMF->connect_value_changed(aSizeLink); + m_xCharWidthMF->connect_value_changed(aSizeLink); + + Link<weld::ToggleButton&,void> aGridTypeHdl = LINK(this, SwTextGridPage, GridTypeHdl); + m_xNoGridRB->connect_toggled(aGridTypeHdl); + m_xLinesGridRB->connect_toggled(aGridTypeHdl); + m_xCharsGridRB->connect_toggled(aGridTypeHdl); + + m_xColorLB->SetSelectHdl(LINK(this, SwTextGridPage, ColorModifyHdl)); + m_xPrintCB->connect_toggled(LINK(this, SwTextGridPage, GridModifyClickHdl)); + m_xRubyBelowCB->connect_toggled(LINK(this, SwTextGridPage, GridModifyClickHdl)); + + m_xDisplayCB->connect_toggled(LINK(this, SwTextGridPage, DisplayGridHdl)); //Get the default paper mode SwView *pView = ::GetActiveView(); @@ -122,21 +105,21 @@ SwTextGridPage::SwTextGridPage(vcl::Window *pParent, const SfxItemSet &rSet) : if( m_bSquaredMode ) { - m_pRubySizeFT->Show(); - m_pRubySizeMF->Show(); - m_pRubyBelowCB->Show(); - m_pSnapToCharsCB->Hide(); - m_pCharWidthFT->Hide(); - m_pCharWidthMF->Hide(); + m_xRubySizeFT->show(); + m_xRubySizeMF->show(); + m_xRubyBelowCB->show(); + m_xSnapToCharsCB->hide(); + m_xCharWidthFT->hide(); + m_xCharWidthMF->hide(); } else { - m_pRubySizeFT->Hide(); - m_pRubySizeMF->Hide(); - m_pRubyBelowCB->Hide(); - m_pSnapToCharsCB->Show(); - m_pCharWidthFT->Show(); - m_pCharWidthMF->Show(); + m_xRubySizeFT->hide(); + m_xRubySizeMF->hide(); + m_xRubyBelowCB->hide(); + m_xSnapToCharsCB->show(); + m_xCharWidthFT->show(); + m_xCharWidthMF->show(); } } @@ -147,50 +130,30 @@ SwTextGridPage::~SwTextGridPage() void SwTextGridPage::dispose() { - m_pNoGridRB.clear(); - m_pLinesGridRB.clear(); - m_pCharsGridRB.clear(); - m_pSnapToCharsCB.clear(); - m_pExampleWN.clear(); - m_pLayoutFL.clear(); - m_pLinesPerPageNF.clear(); - m_pLinesRangeFT.clear(); - m_pTextSizeMF.clear(); - m_pCharsPerLineFT.clear(); - m_pCharsPerLineNF.clear(); - m_pCharsRangeFT.clear(); - m_pCharWidthFT.clear(); - m_pCharWidthMF.clear(); - m_pRubySizeFT.clear(); - m_pRubySizeMF.clear(); - m_pRubyBelowCB.clear(); - m_pDisplayFL.clear(); - m_pDisplayCB.clear(); - m_pPrintCB.clear(); - m_pColorLB.clear(); + m_xColorLB.reset(); SfxTabPage::dispose(); } VclPtr<SfxTabPage> SwTextGridPage::Create(TabPageParent pParent, const SfxItemSet *rSet) { - return VclPtr<SwTextGridPage>::Create(pParent.pParent, *rSet); + return VclPtr<SwTextGridPage>::Create(pParent, *rSet); } bool SwTextGridPage::FillItemSet(SfxItemSet *rSet) { bool bRet = false; - if(m_pNoGridRB->IsValueChangedFromSaved() || - m_pLinesGridRB->IsValueChangedFromSaved() || - m_pLinesPerPageNF->IsValueChangedFromSaved() || - m_pTextSizeMF->IsValueChangedFromSaved() || - m_pCharsPerLineNF->IsValueChangedFromSaved() || - m_pSnapToCharsCB->IsValueChangedFromSaved() || - m_pRubySizeMF->IsValueChangedFromSaved() || - m_pCharWidthMF->IsValueChangedFromSaved() || - m_pRubyBelowCB->IsValueChangedFromSaved() || - m_pDisplayCB->IsValueChangedFromSaved() || - m_pPrintCB->IsValueChangedFromSaved() || - m_pColorLB->IsValueChangedFromSaved()) + if (m_xNoGridRB->get_state_changed_from_saved() || + m_xLinesGridRB->get_state_changed_from_saved() || + m_xLinesPerPageNF->get_value_changed_from_saved() || + m_xTextSizeMF->get_value_changed_from_saved() || + m_xCharsPerLineNF->get_value_changed_from_saved() || + m_xSnapToCharsCB->get_state_changed_from_saved() || + m_xRubySizeMF->get_value_changed_from_saved() || + m_xCharWidthMF->get_value_changed_from_saved() || + m_xRubyBelowCB->get_state_changed_from_saved() || + m_xDisplayCB->get_state_changed_from_saved() || + m_xPrintCB->get_state_changed_from_saved() || + m_xColorLB->IsValueChangedFromSaved()) { PutGridItem(*rSet); bRet = true; @@ -210,51 +173,51 @@ void SwTextGridPage::Reset(const SfxItemSet *rSet) if(SfxItemState::DEFAULT <= rSet->GetItemState(RES_TEXTGRID)) { const SwTextGridItem& rGridItem = rSet->Get(RES_TEXTGRID); - RadioButton* pButton = nullptr; + weld::RadioButton* pButton = nullptr; switch(rGridItem.GetGridType()) { - case GRID_NONE : pButton = m_pNoGridRB; break; - case GRID_LINES_ONLY : pButton = m_pLinesGridRB; break; - default: pButton = m_pCharsGridRB; + case GRID_NONE : pButton = m_xNoGridRB.get(); break; + case GRID_LINES_ONLY : pButton = m_xLinesGridRB.get(); break; + default: pButton = m_xCharsGridRB.get(); } - pButton->Check(); - m_pDisplayCB->Check(rGridItem.IsDisplayGrid()); - GridTypeHdl(pButton); - m_pSnapToCharsCB->Check(rGridItem.IsSnapToChars()); - m_pLinesPerPageNF->SetValue(rGridItem.GetLines()); - SetLinesOrCharsRanges( *m_pLinesRangeFT , m_pLinesPerPageNF->GetMax() ); + pButton->set_active(true); + m_xDisplayCB->set_active(rGridItem.IsDisplayGrid()); + GridTypeHdl(*pButton); + m_xSnapToCharsCB->set_active(rGridItem.IsSnapToChars()); + m_xLinesPerPageNF->set_value(rGridItem.GetLines()); + SetLinesOrCharsRanges(*m_xLinesRangeFT , m_xLinesPerPageNF->get_max()); m_nRubyUserValue = rGridItem.GetBaseHeight(); m_bRubyUserValue = true; - m_pTextSizeMF->SetValue(m_pTextSizeMF->Normalize(m_nRubyUserValue), FUNIT_TWIP); - m_pRubySizeMF->SetValue(m_pRubySizeMF->Normalize(rGridItem.GetRubyHeight()), FUNIT_TWIP); - m_pCharWidthMF->SetValue(m_pCharWidthMF->Normalize(rGridItem.GetBaseWidth()), FUNIT_TWIP); - m_pRubyBelowCB->Check(rGridItem.IsRubyTextBelow()); - m_pPrintCB->Check(rGridItem.IsPrintGrid()); - m_pColorLB->SelectEntry(rGridItem.GetColor()); + m_xTextSizeMF->set_value(m_xTextSizeMF->normalize(m_nRubyUserValue), FUNIT_TWIP); + m_xRubySizeMF->set_value(m_xRubySizeMF->normalize(rGridItem.GetRubyHeight()), FUNIT_TWIP); + m_xCharWidthMF->set_value(m_xCharWidthMF->normalize(rGridItem.GetBaseWidth()), FUNIT_TWIP); + m_xRubyBelowCB->set_active(rGridItem.IsRubyTextBelow()); + m_xPrintCB->set_active(rGridItem.IsPrintGrid()); + m_xColorLB->SelectEntry(rGridItem.GetColor()); } UpdatePageSize(*rSet); - m_pNoGridRB->SaveValue(); - m_pLinesGridRB->SaveValue(); - m_pSnapToCharsCB->SaveValue(); - m_pLinesPerPageNF->SaveValue(); - m_pTextSizeMF->SaveValue(); - m_pCharsPerLineNF->SaveValue(); - m_pRubySizeMF->SaveValue(); - m_pCharWidthMF->SaveValue(); - m_pRubyBelowCB->SaveValue(); - m_pDisplayCB->SaveValue(); - m_pPrintCB->SaveValue(); - m_pColorLB->SaveValue(); + m_xNoGridRB->save_state(); + m_xLinesGridRB->save_state(); + m_xSnapToCharsCB->save_state(); + m_xLinesPerPageNF->save_value(); + m_xTextSizeMF->save_value(); + m_xCharsPerLineNF->save_value(); + m_xRubySizeMF->save_value(); + m_xCharWidthMF->save_value(); + m_xRubyBelowCB->save_state(); + m_xDisplayCB->save_state(); + m_xPrintCB->save_state(); + m_xColorLB->SaveValue(); } void SwTextGridPage::ActivatePage( const SfxItemSet& rSet ) { - m_pExampleWN->Hide(); - m_pExampleWN->UpdateExample( rSet ); + m_aExampleWN.Hide(); + m_aExampleWN.UpdateExample(rSet); UpdatePageSize(rSet); - m_pExampleWN->Show(); - m_pExampleWN->Invalidate(); + m_aExampleWN.Show(); + m_aExampleWN.Invalidate(); } DeactivateRC SwTextGridPage::DeactivatePage( SfxItemSet* ) @@ -265,20 +228,20 @@ DeactivateRC SwTextGridPage::DeactivatePage( SfxItemSet* ) void SwTextGridPage::PutGridItem(SfxItemSet& rSet) { SwTextGridItem aGridItem; - aGridItem.SetGridType(m_pNoGridRB->IsChecked() ? GRID_NONE : - m_pLinesGridRB->IsChecked() ? GRID_LINES_ONLY : GRID_LINES_CHARS ); - aGridItem.SetSnapToChars(m_pSnapToCharsCB->IsChecked()); - aGridItem.SetLines( static_cast< sal_uInt16 >(m_pLinesPerPageNF->GetValue()) ); + aGridItem.SetGridType(m_xNoGridRB->get_active() ? GRID_NONE : + m_xLinesGridRB->get_active() ? GRID_LINES_ONLY : GRID_LINES_CHARS ); + aGridItem.SetSnapToChars(m_xSnapToCharsCB->get_active()); + aGridItem.SetLines( static_cast< sal_uInt16 >(m_xLinesPerPageNF->get_value()) ); aGridItem.SetBaseHeight( static_cast< sal_uInt16 >( m_bRubyUserValue ? m_nRubyUserValue : - m_pTextSizeMF->Denormalize(m_pTextSizeMF->GetValue(FUNIT_TWIP))) ); - aGridItem.SetRubyHeight( static_cast< sal_uInt16 >(m_pRubySizeMF->Denormalize(m_pRubySizeMF->GetValue(FUNIT_TWIP))) ); - aGridItem.SetBaseWidth( static_cast< sal_uInt16 >(m_pCharWidthMF->Denormalize(m_pCharWidthMF->GetValue(FUNIT_TWIP))) ); - aGridItem.SetRubyTextBelow(m_pRubyBelowCB->IsChecked()); + m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FUNIT_TWIP))) ); + aGridItem.SetRubyHeight( static_cast< sal_uInt16 >(m_xRubySizeMF->denormalize(m_xRubySizeMF->get_value(FUNIT_TWIP))) ); + aGridItem.SetBaseWidth( static_cast< sal_uInt16 >(m_xCharWidthMF->denormalize(m_xCharWidthMF->get_value(FUNIT_TWIP))) ); + aGridItem.SetRubyTextBelow(m_xRubyBelowCB->get_active()); aGridItem.SetSquaredMode(m_bSquaredMode); - aGridItem.SetDisplayGrid(m_pDisplayCB->IsChecked()); - aGridItem.SetPrintGrid(m_pPrintCB->IsChecked()); - aGridItem.SetColor(m_pColorLB->GetSelectEntryColor()); + aGridItem.SetDisplayGrid(m_xDisplayCB->get_active()); + aGridItem.SetPrintGrid(m_xPrintCB->get_active()); + aGridItem.SetColor(m_xColorLB->GetSelectEntryColor()); rSet.Put(aGridItem); SwView * pView = ::GetActiveView(); @@ -289,8 +252,8 @@ void SwTextGridPage::PutGridItem(SfxItemSet& rSet) m_bHRulerChanged = true; } m_bVRulerChanged = true; - pView->GetHRuler().SetCharWidth(static_cast<long>(m_pCharWidthMF->GetValue(FUNIT_TWIP)/56.7)); - pView->GetVRuler().SetLineHeight(static_cast<long>(m_pTextSizeMF->GetValue(FUNIT_TWIP)/56.7)); + pView->GetHRuler().SetCharWidth(static_cast<long>(m_xCharWidthMF->get_value(FUNIT_TWIP)/56.7)); + pView->GetVRuler().SetLineHeight(static_cast<long>(m_xTextSizeMF->get_value(FUNIT_TWIP)/56.7)); } } @@ -333,38 +296,37 @@ void SwTextGridPage::UpdatePageSize(const SfxItemSet& rSet) sal_Int32 nTextSize = static_cast< sal_Int32 >(m_bRubyUserValue ? m_nRubyUserValue : - m_pTextSizeMF->Denormalize(m_pTextSizeMF->GetValue(FUNIT_TWIP))); + m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FUNIT_TWIP))); if ( m_bSquaredMode ) { - m_pCharsPerLineNF->SetValue(m_aPageSize.Width() / nTextSize); - m_pCharsPerLineNF->SetMax( m_pCharsPerLineNF->GetValue() ); - m_pLinesPerPageNF->SetMax( m_aPageSize.Height() / - ( m_pTextSizeMF->Denormalize(m_pTextSizeMF->GetValue(FUNIT_TWIP)) + - m_pRubySizeMF->Denormalize(m_pRubySizeMF->GetValue(FUNIT_TWIP)))); - SetLinesOrCharsRanges( *m_pCharsRangeFT , m_pCharsPerLineNF->GetMax() ); - SetLinesOrCharsRanges( *m_pLinesRangeFT , m_pLinesPerPageNF->GetMax() ); + m_xCharsPerLineNF->set_value(m_aPageSize.Width() / nTextSize); + m_xCharsPerLineNF->set_max(m_xCharsPerLineNF->get_value()); + m_xLinesPerPageNF->set_max(m_aPageSize.Height() / + ( m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FUNIT_TWIP)) + + m_xRubySizeMF->denormalize(m_xRubySizeMF->get_value(FUNIT_TWIP)))); + SetLinesOrCharsRanges( *m_xCharsRangeFT , m_xCharsPerLineNF->get_max() ); + SetLinesOrCharsRanges( *m_xLinesRangeFT , m_xLinesPerPageNF->get_max() ); } else { - sal_Int32 nTextWidth = static_cast< sal_Int32 >(m_pCharWidthMF->Denormalize(m_pCharWidthMF->GetValue(FUNIT_TWIP))); - m_pLinesPerPageNF->SetValue(m_aPageSize.Height() / nTextSize); + sal_Int32 nTextWidth = static_cast< sal_Int32 >(m_xCharWidthMF->denormalize(m_xCharWidthMF->get_value(FUNIT_TWIP))); + m_xLinesPerPageNF->set_value(m_aPageSize.Height() / nTextSize); if (nTextWidth) - m_pCharsPerLineNF->SetValue(m_aPageSize.Width() / nTextWidth); + m_xCharsPerLineNF->set_value(m_aPageSize.Width() / nTextWidth); else - m_pCharsPerLineNF->SetValue( 45 ); - SetLinesOrCharsRanges( *m_pCharsRangeFT , m_pCharsPerLineNF->GetMax() ); - SetLinesOrCharsRanges( *m_pLinesRangeFT , m_pLinesPerPageNF->GetMax() ); + m_xCharsPerLineNF->set_value(45); + SetLinesOrCharsRanges( *m_xCharsRangeFT , m_xCharsPerLineNF->get_max() ); + SetLinesOrCharsRanges( *m_xLinesRangeFT , m_xLinesPerPageNF->get_max() ); } - } -void SwTextGridPage::SetLinesOrCharsRanges(FixedText & rField, const sal_Int32 nValue ) +void SwTextGridPage::SetLinesOrCharsRanges(weld::Label& rField, const sal_Int32 nValue ) { OUString aFieldStr("( 1 -"); aFieldStr += OUString::number(nValue); aFieldStr += " )"; - rField.SetText( aFieldStr ); + rField.set_label(aFieldStr); } const sal_uInt16* SwTextGridPage::GetRanges() @@ -375,21 +337,17 @@ const sal_uInt16* SwTextGridPage::GetRanges() return aPageRg; } -IMPL_LINK(SwTextGridPage, CharorLineLoseFocusdHdl, Control&, rControl, void) -{ - CharorLineChangedHdl(static_cast<SpinField&>(rControl)); -} -IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, SpinField&, rField, void) +IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, weld::SpinButton&, rField, void) { //if in squared mode if ( m_bSquaredMode ) { - if(m_pCharsPerLineNF == &rField) + if (m_xCharsPerLineNF.get() == &rField) { - auto nValue = m_pCharsPerLineNF->GetValue(); + auto nValue = m_xCharsPerLineNF->get_value(); assert(nValue && "div-by-zero"); auto nWidth = m_aPageSize.Width() / nValue; - m_pTextSizeMF->SetValue(m_pTextSizeMF->Normalize(nWidth), FUNIT_TWIP); + m_xTextSizeMF->set_value(m_xTextSizeMF->normalize(nWidth), FUNIT_TWIP); //prevent rounding errors in the MetricField by saving the used value m_nRubyUserValue = nWidth; m_bRubyUserValue = true; @@ -398,133 +356,129 @@ IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, SpinField&, rField, void) //set maximum line per page { sal_Int32 nMaxLines = static_cast< sal_Int32 >(m_aPageSize.Height() / - ( m_pTextSizeMF->Denormalize(m_pTextSizeMF->GetValue(FUNIT_TWIP)) + - m_pRubySizeMF->Denormalize(m_pRubySizeMF->GetValue(FUNIT_TWIP)))); - m_pLinesPerPageNF->SetMax(nMaxLines); + ( m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FUNIT_TWIP)) + + m_xRubySizeMF->denormalize(m_xRubySizeMF->get_value(FUNIT_TWIP)))); + m_xLinesPerPageNF->set_max(nMaxLines); } - SetLinesOrCharsRanges( *m_pLinesRangeFT , m_pLinesPerPageNF->GetMax() ); - SetLinesOrCharsRanges( *m_pCharsRangeFT , m_pCharsPerLineNF->GetMax() ); + SetLinesOrCharsRanges( *m_xLinesRangeFT , m_xLinesPerPageNF->get_max() ); + SetLinesOrCharsRanges( *m_xCharsRangeFT , m_xCharsPerLineNF->get_max() ); } else//in normal mode { - if (m_pLinesPerPageNF == &rField) + if (m_xLinesPerPageNF.get() == &rField) { - auto nValue = m_pLinesPerPageNF->GetValue(); + auto nValue = m_xLinesPerPageNF->get_value(); assert(nValue && "div-by-zero"); auto nHeight = m_aPageSize.Height() / nValue; - m_pTextSizeMF->SetValue(m_pTextSizeMF->Normalize(nHeight), FUNIT_TWIP); - m_pRubySizeMF->SetValue(0, FUNIT_TWIP); - SetLinesOrCharsRanges( *m_pLinesRangeFT , m_pLinesPerPageNF->GetMax() ); + m_xTextSizeMF->set_value(m_xTextSizeMF->normalize(nHeight), FUNIT_TWIP); + m_xRubySizeMF->set_value(0, FUNIT_TWIP); + SetLinesOrCharsRanges( *m_xLinesRangeFT , m_xLinesPerPageNF->get_max() ); m_nRubyUserValue = nHeight; m_bRubyUserValue = true; } - else if (m_pCharsPerLineNF == &rField) + else if (m_xCharsPerLineNF.get() == &rField) { - auto nValue = m_pCharsPerLineNF->GetValue(); + auto nValue = m_xCharsPerLineNF->get_value(); assert(nValue && "div-by-zero"); auto nWidth = m_aPageSize.Width() / nValue; - m_pCharWidthMF->SetValue(m_pCharWidthMF->Normalize(nWidth), FUNIT_TWIP); - SetLinesOrCharsRanges( *m_pCharsRangeFT , m_pCharsPerLineNF->GetMax() ); + m_xCharWidthMF->set_value(m_xCharWidthMF->normalize(nWidth), FUNIT_TWIP); + SetLinesOrCharsRanges( *m_xCharsRangeFT , m_xCharsPerLineNF->get_max() ); } } GridModifyHdl(); } -IMPL_LINK(SwTextGridPage, TextSizeLoseFocusHdl, Control&, rControl, void) -{ - TextSizeChangedHdl(static_cast<SpinField&>(rControl)); -} -IMPL_LINK(SwTextGridPage, TextSizeChangedHdl, SpinField&, rField, void) +IMPL_LINK(SwTextGridPage, TextSizeChangedHdl, weld::MetricSpinButton&, rField, void) { //if in squared mode if( m_bSquaredMode ) { - if (m_pTextSizeMF == &rField) + if (m_xTextSizeMF.get() == &rField) { m_bRubyUserValue = false; // fdo#50941: set maximum characters per line - sal_Int32 nTextSize = static_cast< sal_Int32 >(m_pTextSizeMF->Denormalize(m_pTextSizeMF->GetValue(FUNIT_TWIP))); + sal_Int32 nTextSize = static_cast< sal_Int32 >(m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FUNIT_TWIP))); if (nTextSize > 0) { sal_Int32 nMaxChars = m_aPageSize.Width() / nTextSize; - m_pCharsPerLineNF->SetValue(nMaxChars); - m_pCharsPerLineNF->SetMax(nMaxChars); - SetLinesOrCharsRanges( *m_pCharsRangeFT , m_pCharsPerLineNF->GetMax() ); + m_xCharsPerLineNF->set_value(nMaxChars); + m_xCharsPerLineNF->set_max(nMaxChars); + SetLinesOrCharsRanges( *m_xCharsRangeFT , m_xCharsPerLineNF->get_max() ); } } //set maximum line per page { sal_Int32 nMaxLines = static_cast< sal_Int32 >(m_aPageSize.Height() / - ( m_pTextSizeMF->Denormalize(m_pTextSizeMF->GetValue(FUNIT_TWIP)) + - m_pRubySizeMF->Denormalize(m_pRubySizeMF->GetValue(FUNIT_TWIP)))); - m_pLinesPerPageNF->SetMax(nMaxLines); - SetLinesOrCharsRanges( *m_pLinesRangeFT , m_pLinesPerPageNF->GetMax() ); + ( m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FUNIT_TWIP)) + + m_xRubySizeMF->denormalize(m_xRubySizeMF->get_value(FUNIT_TWIP)))); + m_xLinesPerPageNF->set_max(nMaxLines); + SetLinesOrCharsRanges( *m_xLinesRangeFT , m_xLinesPerPageNF->get_max() ); } } else { - if (m_pTextSizeMF == &rField) + if (m_xTextSizeMF.get() == &rField) { - sal_Int32 nTextSize = static_cast< sal_Int32 >(m_pTextSizeMF->Denormalize(m_pTextSizeMF->GetValue(FUNIT_TWIP))); - m_pLinesPerPageNF->SetValue(m_aPageSize.Height() / nTextSize); + sal_Int32 nTextSize = static_cast< sal_Int32 >(m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FUNIT_TWIP))); + m_xLinesPerPageNF->set_value(m_aPageSize.Height() / nTextSize); m_bRubyUserValue = false; - SetLinesOrCharsRanges( *m_pLinesRangeFT , m_pLinesPerPageNF->GetMax() ); + SetLinesOrCharsRanges( *m_xLinesRangeFT , m_xLinesPerPageNF->get_max() ); } - else if (m_pCharWidthMF == &rField) + else if (m_xCharWidthMF.get() == &rField) { - sal_Int32 nTextWidth = static_cast< sal_Int32 >(m_pCharWidthMF->Denormalize(m_pCharWidthMF->GetValue(FUNIT_TWIP))); + sal_Int32 nTextWidth = static_cast< sal_Int32 >(m_xCharWidthMF->denormalize(m_xCharWidthMF->get_value(FUNIT_TWIP))); sal_Int32 nMaxChar = 45 ; if (nTextWidth) nMaxChar = m_aPageSize.Width() / nTextWidth; - m_pCharsPerLineNF->SetValue( nMaxChar ); - SetLinesOrCharsRanges( *m_pCharsRangeFT , m_pCharsPerLineNF->GetMax() ); + m_xCharsPerLineNF->set_value( nMaxChar ); + SetLinesOrCharsRanges( *m_xCharsRangeFT , m_xCharsPerLineNF->get_max() ); } //rubySize is disabled } GridModifyHdl(); } -IMPL_LINK(SwTextGridPage, GridTypeHdl, Button*, pButton, void) +IMPL_LINK(SwTextGridPage, GridTypeHdl, weld::ToggleButton&, rButton, void) { - bool bEnable = m_pNoGridRB.get() != pButton; - m_pLayoutFL->Enable(bEnable); - m_pDisplayFL->Enable(bEnable); + bool bEnable = m_xNoGridRB.get() != &rButton; + m_xLayoutFL->set_sensitive(bEnable); + m_xDisplayFL->set_sensitive(bEnable); //one special case - if(bEnable) - DisplayGridHdl(m_pDisplayCB); + if (bEnable) + DisplayGridHdl(*m_xDisplayCB); - bEnable = m_pCharsGridRB == pButton; - m_pSnapToCharsCB->Enable(bEnable); + bEnable = m_xCharsGridRB.get() == &rButton; + m_xSnapToCharsCB->set_sensitive(bEnable); - bEnable = m_pLinesGridRB == pButton; - if(bEnable && !m_bSquaredMode ) + bEnable = m_xLinesGridRB.get() == &rButton; + if (bEnable && !m_bSquaredMode) { - m_pCharsPerLineFT->Enable(false); - m_pCharsPerLineNF->Enable(false); - m_pCharsRangeFT->Enable(false); - m_pCharWidthFT->Enable(false); - m_pCharWidthMF->Enable(false); + m_xCharsPerLineFT->set_sensitive(false); + m_xCharsPerLineNF->set_sensitive(false); + m_xCharsRangeFT->set_sensitive(false); + m_xCharWidthFT->set_sensitive(false); + m_xCharWidthMF->set_sensitive(false); } GridModifyHdl(); } -IMPL_LINK_NOARG(SwTextGridPage, DisplayGridHdl, Button*, void) +IMPL_LINK_NOARG(SwTextGridPage, DisplayGridHdl, weld::ToggleButton&, void) { - bool bChecked = m_pDisplayCB->IsChecked(); - m_pPrintCB->Enable(bChecked); - m_pPrintCB->Check(bChecked); + bool bChecked = m_xDisplayCB->get_active(); + m_xPrintCB->set_sensitive(bChecked); + m_xPrintCB->set_active(bChecked); } -IMPL_LINK_NOARG(SwTextGridPage, GridModifyClickHdl, Button*, void) +IMPL_LINK_NOARG(SwTextGridPage, GridModifyClickHdl, weld::ToggleButton&, void) { GridModifyHdl(); } -IMPL_LINK_NOARG(SwTextGridPage, ColorModifyHdl, SvxColorListBox&, void) +IMPL_LINK_NOARG(SwTextGridPage, ColorModifyHdl, ColorListBox&, void) { GridModifyHdl(); } @@ -537,7 +491,7 @@ void SwTextGridPage::GridModifyHdl() if(pExSet) aSet.Put(*pExSet); PutGridItem(aSet); - m_pExampleWN->UpdateExample(aSet); + m_aExampleWN.UpdateExample(aSet); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/frmdlg/colex.cxx b/sw/source/uibase/frmdlg/colex.cxx index 493d96cc3090..02957501f4b8 100644 --- a/sw/source/uibase/frmdlg/colex.cxx +++ b/sw/source/uibase/frmdlg/colex.cxx @@ -194,6 +194,159 @@ void SwPageExample::UpdateExample( const SfxItemSet& rSet ) Invalidate(); } +void PageExample::UpdateExample( const SfxItemSet& rSet ) +{ + if (SfxItemState::DEFAULT <= rSet.GetItemState(RES_FRAMEDIR)) + { + const SvxFrameDirectionItem& rDirItem = rSet.Get(RES_FRAMEDIR); + m_bVertical = rDirItem.GetValue() == SvxFrameDirection::Vertical_RL_TB|| + rDirItem.GetValue() == SvxFrameDirection::Vertical_LR_TB; + } + + SfxItemPool* pPool = rSet.GetPool(); + sal_uInt16 nWhich = pPool->GetWhich( SID_ATTR_PAGE ); + if ( rSet.GetItemState( nWhich, false ) == SfxItemState::SET ) + { + // alignment + const SvxPageItem* pPage = static_cast<const SvxPageItem*>(&rSet.Get( nWhich )); + + if ( pPage ) + SetUsage( pPage->GetPageUsage() ); + } + + nWhich = pPool->GetWhich( SID_ATTR_PAGE_SIZE ); + + if ( rSet.GetItemState( nWhich, false ) == SfxItemState::SET ) + { + // orientation and size from PageItem + const SvxSizeItem& rSize = static_cast<const SvxSizeItem&>(rSet.Get( nWhich )); + SetSize( rSize.GetSize() ); + } + nWhich = RES_LR_SPACE; + if ( rSet.GetItemState( nWhich, false ) == SfxItemState::SET ) + { + // set left and right border + const SvxLRSpaceItem& rLRSpace = static_cast<const SvxLRSpaceItem&>(rSet.Get( nWhich )); + + SetLeft( rLRSpace.GetLeft() ); + SetRight( rLRSpace.GetRight() ); + } + else + { + SetLeft( 0 ); + SetRight( 0 ); + } + + nWhich = RES_UL_SPACE; + + if ( rSet.GetItemState( nWhich, false ) == SfxItemState::SET ) + { + // set upper and lower border + const SvxULSpaceItem& rULSpace = static_cast<const SvxULSpaceItem&>(rSet.Get( nWhich )); + + SetTop( rULSpace.GetUpper() ); + SetBottom( rULSpace.GetLower() ); + } + else + { + SetTop( 0 ); + SetBottom( 0 ); + } + + // evaluate header-attributes + const SfxPoolItem* pItem; + if( SfxItemState::SET == rSet.GetItemState( pPool->GetWhich( SID_ATTR_PAGE_HEADERSET), + false, &pItem ) ) + { + const SfxItemSet& rHeaderSet = static_cast<const SvxSetItem*>(pItem)->GetItemSet(); + const SfxBoolItem& rHeaderOn = + static_cast<const SfxBoolItem&>(rHeaderSet.Get( pPool->GetWhich( SID_ATTR_PAGE_ON ) ) ); + + if ( rHeaderOn.GetValue() ) + { + const SvxSizeItem& rSize = + static_cast<const SvxSizeItem&>(rHeaderSet.Get(pPool->GetWhich(SID_ATTR_PAGE_SIZE))); + + const SvxULSpaceItem& rUL = static_cast<const SvxULSpaceItem&>(rHeaderSet.Get( + pPool->GetWhich(SID_ATTR_ULSPACE))); + const SvxLRSpaceItem& rLR = static_cast<const SvxLRSpaceItem&>(rHeaderSet.Get( + pPool->GetWhich(SID_ATTR_LRSPACE))); + + SetHdHeight( rSize.GetSize().Height() - rUL.GetLower()); + SetHdDist( rUL.GetLower() ); + SetHdLeft( rLR.GetLeft() ); + SetHdRight( rLR.GetRight() ); + SetHeader( true ); + + if(SfxItemState::SET == rHeaderSet.GetItemState(RES_BACKGROUND)) + { + // create FillAttributes from SvxBrushItem //SetHdColor(rItem.GetColor()); + const SvxBrushItem& rItem = rHeaderSet.Get(RES_BACKGROUND); + SfxItemSet aTempSet(*rHeaderSet.GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{}); + + setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); + setHeaderFillAttributes( + std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>( + aTempSet)); + } + } + else + SetHeader( false ); + } + + if( SfxItemState::SET == rSet.GetItemState( pPool->GetWhich( SID_ATTR_PAGE_FOOTERSET), + false, &pItem ) ) + { + const SfxItemSet& rFooterSet = static_cast<const SvxSetItem*>(pItem)->GetItemSet(); + const SfxBoolItem& rFooterOn = rFooterSet.Get( SID_ATTR_PAGE_ON ); + + if ( rFooterOn.GetValue() ) + { + const SvxSizeItem& rSize = + static_cast<const SvxSizeItem&>(rFooterSet.Get( pPool->GetWhich( SID_ATTR_PAGE_SIZE ) )); + + const SvxULSpaceItem& rUL = static_cast<const SvxULSpaceItem&>(rFooterSet.Get( + pPool->GetWhich( SID_ATTR_ULSPACE ) )); + const SvxLRSpaceItem& rLR = static_cast<const SvxLRSpaceItem&>(rFooterSet.Get( + pPool->GetWhich( SID_ATTR_LRSPACE ) )); + + SetFtHeight( rSize.GetSize().Height() - rUL.GetUpper()); + SetFtDist( rUL.GetUpper() ); + SetFtLeft( rLR.GetLeft() ); + SetFtRight( rLR.GetRight() ); + SetFooter( true ); + + if( rFooterSet.GetItemState( RES_BACKGROUND ) == SfxItemState::SET ) + { + // create FillAttributes from SvxBrushItem //SetFtColor(rItem.GetColor()); + const SvxBrushItem& rItem = rFooterSet.Get(RES_BACKGROUND); + SfxItemSet aTempSet(*rFooterSet.GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{}); + + setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); + setFooterFillAttributes( + std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>( + aTempSet)); + } + } + else + SetFooter( false ); + } + + if(SfxItemState::SET == rSet.GetItemState(RES_BACKGROUND, false, &pItem)) + { + // create FillAttributes from SvxBrushItem + const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(*pItem); + SfxItemSet aTempSet(*rSet.GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{}); + + setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); + setPageFillAttributes( + std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>( + aTempSet)); + } + + Invalidate(); +} + void SwColExample::DrawPage(vcl::RenderContext& rRenderContext, const Point& rOrg, const bool bSecond, const bool bEnabled) { @@ -496,25 +649,15 @@ Size SwColumnOnlyExample::GetOptimalSize() const return LogicToPixel(Size(75, 46), MapMode(MapUnit::MapAppFont)); } -SwPageGridExample::SwPageGridExample(vcl::Window* pPar) - : SwPageExample(pPar) -{} - -SwPageGridExample::~SwPageGridExample() +SwPageGridExample::SwPageGridExample() + : pGridItem(nullptr) { - disposeOnce(); -} - -void SwPageGridExample::dispose() -{ - pGridItem.reset(); - SwPageExample::dispose(); } void SwPageGridExample::DrawPage(vcl::RenderContext& rRenderContext, const Point& rOrg, const bool bSecond, const bool bEnabled) { - SwPageExample::DrawPage(rRenderContext, rOrg, bSecond, bEnabled); + PageExample::DrawPage(rRenderContext, rOrg, bSecond, bEnabled); if (!pGridItem || !pGridItem->GetGridType()) return; @@ -617,9 +760,7 @@ void SwPageGridExample::UpdateExample( const SfxItemSet& rSet ) //get the grid information if(SfxItemState::DEFAULT <= rSet.GetItemState(RES_TEXTGRID)) pGridItem.reset(static_cast<SwTextGridItem*>(rSet.Get(RES_TEXTGRID).Clone())); - SwPageExample::UpdateExample(rSet); + PageExample::UpdateExample(rSet); } -VCL_BUILDER_FACTORY(SwPageGridExample) - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/colex.hxx b/sw/source/uibase/inc/colex.hxx index 4aa5d2ec3487..38f534a1e573 100644 --- a/sw/source/uibase/inc/colex.hxx +++ b/sw/source/uibase/inc/colex.hxx @@ -43,9 +43,23 @@ public: void UpdateExample( const SfxItemSet& rSet ); }; +class SW_DLLPUBLIC PageExample : public PageWindow +{ +protected: + bool m_bVertical; +public: + PageExample() + : m_bVertical(false) + { + SetSize(SvxPaperInfo::GetPaperSize(PAPER_A4)); + } + + void UpdateExample( const SfxItemSet& rSet ); +}; + class SwTextGridItem; -class SW_DLLPUBLIC SwPageGridExample : public SwPageExample +class SW_DLLPUBLIC SwPageGridExample : public PageExample { std::unique_ptr<SwTextGridItem> pGridItem; protected: @@ -54,12 +68,12 @@ protected: const bool bSecond, const bool bEnabled) override; public: - SwPageGridExample(vcl::Window* pPar); - virtual ~SwPageGridExample() override; - virtual void dispose() override; + SwPageGridExample(); + void UpdateExample( const SfxItemSet& rSet ); }; + class SW_DLLPUBLIC SwColExample : public SwPageExample { SwColMgr* pColMgr; diff --git a/sw/source/uibase/inc/pggrid.hxx b/sw/source/uibase/inc/pggrid.hxx index 379538525ece..9da77f57239f 100644 --- a/sw/source/uibase/inc/pggrid.hxx +++ b/sw/source/uibase/inc/pggrid.hxx @@ -21,45 +21,13 @@ #include <sfx2/tabdlg.hxx> #include "colex.hxx" -#include <vcl/field.hxx> -#include <vcl/fixed.hxx> -#include <svtools/ctrlbox.hxx> +#include <vcl/customweld.hxx> +#include <vcl/weld.hxx> #include <svx/colorbox.hxx> // TabPage Format/(Styles/)Page/Text grid class SwTextGridPage: public SfxTabPage { - VclPtr<RadioButton> m_pNoGridRB; - VclPtr<RadioButton> m_pLinesGridRB; - VclPtr<RadioButton> m_pCharsGridRB; - VclPtr<CheckBox> m_pSnapToCharsCB; - - VclPtr<SwPageGridExample> m_pExampleWN; - - VclPtr<VclFrame> m_pLayoutFL; - VclPtr<NumericField> m_pLinesPerPageNF; - VclPtr<FixedText> m_pLinesRangeFT; - - VclPtr<MetricField> m_pTextSizeMF; - - VclPtr<FixedText> m_pCharsPerLineFT; - VclPtr<NumericField> m_pCharsPerLineNF; - VclPtr<FixedText> m_pCharsRangeFT; - - VclPtr<FixedText> m_pCharWidthFT; - VclPtr<MetricField> m_pCharWidthMF; - - VclPtr<FixedText> m_pRubySizeFT; - VclPtr<MetricField> m_pRubySizeMF; - - VclPtr<CheckBox> m_pRubyBelowCB; - - VclPtr<VclFrame> m_pDisplayFL; - - VclPtr<CheckBox> m_pDisplayCB; - VclPtr<CheckBox> m_pPrintCB; - VclPtr<SvxColorListBox> m_pColorLB; - sal_Int32 m_nRubyUserValue; bool m_bRubyUserValue; Size m_aPageSize; @@ -68,26 +36,47 @@ class SwTextGridPage: public SfxTabPage bool m_bHRulerChanged; bool m_bVRulerChanged; + SwPageGridExample m_aExampleWN; + std::unique_ptr<weld::RadioButton> m_xNoGridRB; + std::unique_ptr<weld::RadioButton> m_xLinesGridRB; + std::unique_ptr<weld::RadioButton> m_xCharsGridRB; + std::unique_ptr<weld::CheckButton> m_xSnapToCharsCB; + std::unique_ptr<weld::CustomWeld> m_xExampleWN; + std::unique_ptr<weld::Widget> m_xLayoutFL; + std::unique_ptr<weld::SpinButton> m_xLinesPerPageNF; + std::unique_ptr<weld::Label> m_xLinesRangeFT; + std::unique_ptr<weld::MetricSpinButton> m_xTextSizeMF; + std::unique_ptr<weld::Label> m_xCharsPerLineFT; + std::unique_ptr<weld::SpinButton> m_xCharsPerLineNF; + std::unique_ptr<weld::Label> m_xCharsRangeFT; + std::unique_ptr<weld::Label> m_xCharWidthFT; + std::unique_ptr<weld::MetricSpinButton> m_xCharWidthMF; + std::unique_ptr<weld::Label> m_xRubySizeFT; + std::unique_ptr<weld::MetricSpinButton> m_xRubySizeMF; + std::unique_ptr<weld::CheckButton> m_xRubyBelowCB; + std::unique_ptr<weld::Widget> m_xDisplayFL; + std::unique_ptr<weld::CheckButton> m_xDisplayCB; + std::unique_ptr<weld::CheckButton> m_xPrintCB; + std::unique_ptr<ColorListBox> m_xColorLB; + void UpdatePageSize(const SfxItemSet& rSet); void PutGridItem(SfxItemSet& rSet); - static void SetLinesOrCharsRanges(FixedText & rField, const sal_Int32 nValue ); + static void SetLinesOrCharsRanges(weld::Label& rField, const sal_Int32 nValue); void GridModifyHdl(); - DECL_LINK(GridTypeHdl, Button*, void); - DECL_LINK(CharorLineChangedHdl, SpinField&, void); - DECL_LINK(CharorLineLoseFocusdHdl, Control&, void); - DECL_LINK(TextSizeChangedHdl, SpinField&, void); - DECL_LINK(TextSizeLoseFocusHdl, Control&, void); - DECL_LINK(ColorModifyHdl, SvxColorListBox&, void); - DECL_LINK(GridModifyClickHdl, Button*, void); - DECL_LINK(DisplayGridHdl, Button*, void); + DECL_LINK(GridTypeHdl, weld::ToggleButton&, void); + DECL_LINK(CharorLineChangedHdl, weld::SpinButton&, void); + DECL_LINK(TextSizeChangedHdl, weld::MetricSpinButton&, void); + DECL_LINK(ColorModifyHdl, ColorListBox&, void); + DECL_LINK(GridModifyClickHdl, weld::ToggleButton&, void); + DECL_LINK(DisplayGridHdl, weld::ToggleButton&, void); using SfxTabPage::ActivatePage; using SfxTabPage::DeactivatePage; public: - SwTextGridPage(vcl::Window *pParent, const SfxItemSet &rSet); + SwTextGridPage(TabPageParent pParent, const SfxItemSet &rSet); virtual ~SwTextGridPage() override; virtual void dispose() override; diff --git a/sw/uiconfig/swriter/ui/textgridpage.ui b/sw/uiconfig/swriter/ui/textgridpage.ui index 7880adbc10f3..64ec3e518079 100644 --- a/sw/uiconfig/swriter/ui/textgridpage.ui +++ b/sw/uiconfig/swriter/ui/textgridpage.ui @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sw"> <requires lib="gtk+" version="3.18"/> - <requires lib="LibreOffice" version="1.0"/> <object class="GtkAdjustment" id="adjustmentCHARSPERLINE"> <property name="lower">1</property> <property name="upper">233</property> @@ -23,6 +22,20 @@ <property name="step_increment">1</property> <property name="page_increment">10</property> </object> + <object class="GtkAdjustment" id="adjustmentMetric1"> + <property name="lower">1</property> + <property name="upper">5600</property> + <property name="value">10</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustmentMetric2"> + <property name="lower">1</property> + <property name="upper">5600</property> + <property name="value">10</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> <object class="GtkBox" id="TextGridPage"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -61,7 +74,6 @@ <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">radioRB_LINESGRID</property> </object> <packing> <property name="left_attach">0</property> @@ -77,7 +89,7 @@ <property name="use_underline">True</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> - <property name="group">radioRB_CHARSGRID</property> + <property name="group">radioRB_NOGRID</property> </object> <packing> <property name="left_attach">0</property> @@ -125,7 +137,7 @@ </packing> </child> <child> - <object class="swlo-SwPageGridExample" id="drawingareaWN_EXAMPLE"> + <object class="GtkDrawingArea" id="drawingareaWN_EXAMPLE"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">center</property> @@ -285,10 +297,11 @@ <property name="column_spacing">12</property> <property name="row_homogeneous">True</property> <child> - <object class="GtkSpinButton" id="spinMF_CHARWIDTH:0pt"> + <object class="GtkSpinButton" id="spinMF_CHARWIDTH"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="adjustment">adjustmentMetric</property> + <property name="activates_default">True</property> + <property name="adjustment">adjustmentMetric2</property> </object> <packing> <property name="left_attach">1</property> @@ -302,7 +315,7 @@ <property name="halign">start</property> <property name="label" translatable="yes" context="textgridpage|labelFT_CHARWIDTH">Character _width:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">spinMF_CHARWIDTH:0pt</property> + <property name="mnemonic_widget">spinMF_CHARWIDTH</property> </object> <packing> <property name="left_attach">0</property> @@ -316,7 +329,7 @@ <property name="halign">start</property> <property name="label" translatable="yes" context="textgridpage|labelFT_RUBYSIZE">Max. Ruby text size:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">spinMF_RUBYSIZE:0pt</property> + <property name="mnemonic_widget">spinMF_RUBYSIZE</property> </object> <packing> <property name="left_attach">0</property> @@ -324,10 +337,11 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="spinMF_RUBYSIZE:0pt"> + <object class="GtkSpinButton" id="spinMF_RUBYSIZE"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="adjustment">adjustmentMetric</property> + <property name="activates_default">True</property> + <property name="adjustment">adjustmentMetric1</property> </object> <packing> <property name="left_attach">1</property> @@ -341,7 +355,7 @@ <property name="halign">start</property> <property name="label" translatable="yes" context="textgridpage|labelFT_TEXTSIZE">Max. base text size:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">spinMF_TEXTSIZE:0pt</property> + <property name="mnemonic_widget">spinMF_TEXTSIZE</property> </object> <packing> <property name="left_attach">0</property> @@ -349,9 +363,10 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="spinMF_TEXTSIZE:0pt"> + <object class="GtkSpinButton" id="spinMF_TEXTSIZE"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="activates_default">True</property> <property name="adjustment">adjustmentMetric</property> </object> <packing> @@ -378,9 +393,9 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> - <property name="use_underline">True</property> <property name="halign">start</property> <property name="margin_left">12</property> + <property name="use_underline">True</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> </object> @@ -435,8 +450,8 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> - <property name="use_underline">True</property> <property name="halign">start</property> + <property name="use_underline">True</property> <property name="xalign">0.14000000059604645</property> <property name="draw_indicator">True</property> </object> @@ -451,9 +466,9 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> - <property name="use_underline">True</property> <property name="halign">start</property> <property name="margin_left">12</property> + <property name="use_underline">True</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> </object> @@ -477,11 +492,15 @@ </packing> </child> <child> - <object class="svxcorelo-SvxColorListBox" id="listLB_COLOR"> + <object class="GtkMenuButton" id="listLB_COLOR"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="receives_default">False</property> <property name="halign">start</property> <property name="valign">center</property> + <child> + <placeholder/> + </child> </object> <packing> <property name="left_attach">2</property> |