diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-05-04 12:24:24 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-05-04 22:10:54 +0200 |
commit | 2cab4acbe2aaaee6e5b9afeb68f3e555ecff2ec7 (patch) | |
tree | ca04beb6908221e95811e2acb26a626d7febf92b | |
parent | 5103c6a405e93bb05018ab7c89e7e9446c740aaa (diff) |
weld SwNumPositionTabPage
Change-Id: I12171eb00d5b8354456b629d58d20b22109e24f8
Reviewed-on: https://gerrit.libreoffice.org/53845
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | include/vcl/weld.hxx | 5 | ||||
-rw-r--r-- | sw/source/ui/misc/num.cxx | 453 | ||||
-rw-r--r-- | sw/source/uibase/inc/num.hxx | 92 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/outlinepositionpage.ui | 128 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 12 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 17 |
6 files changed, 336 insertions, 371 deletions
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 9e58e585a533..6c1078a04457 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -309,6 +309,7 @@ public: //by index virtual int get_selected_index() const = 0; virtual void select(int pos) = 0; + virtual void unselect(int pos) = 0; virtual void remove(int pos) = 0; virtual void set_top_entry(int pos) = 0; virtual std::vector<int> get_selected_rows() const = 0; @@ -334,6 +335,10 @@ public: virtual int find_id(const OUString& rId) const = 0; OUString get_selected_id() const { return get_id(get_selected_index()); } void select_id(const OUString& rId) { select(find_id(rId)); } + + //all of them + void select_all() { unselect(-1); } + void unselect_all() { select(-1); } }; class VCL_DLLPUBLIC Button : virtual public Container diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx index 2f7bb7c41fcf..28b4ba9ca185 100644 --- a/sw/source/ui/misc/num.cxx +++ b/sw/source/ui/misc/num.cxx @@ -54,10 +54,8 @@ static bool bLastRelative = false; //dialog to this one, except with a different preview window impl. //TODO, determine if SwNumPositionTabPage and SvxNumPositionTabPage can be //merged -SwNumPositionTabPage::SwNumPositionTabPage(vcl::Window* pParent, - const SfxItemSet& rSet) - : SfxTabPage(pParent, "OutlinePositionPage", - "modules/swriter/ui/outlinepositionpage.ui", &rSet) +SwNumPositionTabPage::SwNumPositionTabPage(TabPageParent pParent, const SfxItemSet& rSet) + : SfxTabPage(pParent, "modules/swriter/ui/outlinepositionpage.ui", "OutlinePositionPage", &rSet) , pActNum(nullptr) , pSaveNum(nullptr) , pWrtSh(nullptr) @@ -67,94 +65,73 @@ SwNumPositionTabPage::SwNumPositionTabPage(vcl::Window* pParent, , bPreset(false) , bInInintControl(false) , bLabelAlignmentPosAndSpaceModeActive(false) + , m_xLevelLB(m_xBuilder->weld_tree_view("levellb")) + , m_xPositionFrame(m_xBuilder->weld_widget("numberingframe")) + , m_xDistBorderFT(m_xBuilder->weld_label("indent")) + , m_xDistBorderMF(m_xBuilder->weld_metric_spin_button("indentmf", FUNIT_CM)) + , m_xRelativeCB(m_xBuilder->weld_check_button("relative")) + , m_xIndentFT(m_xBuilder->weld_label("numberingwidth")) + , m_xIndentMF(m_xBuilder->weld_metric_spin_button("numberingwidthmf", FUNIT_CM)) + , m_xDistNumFT(m_xBuilder->weld_label("numdist")) + , m_xDistNumMF(m_xBuilder->weld_metric_spin_button("numdistmf", FUNIT_CM)) + , m_xAlignFT(m_xBuilder->weld_label("numalign")) + , m_xAlignLB(m_xBuilder->weld_combo_box_text("numalignlb")) + , m_xLabelFollowedByFT(m_xBuilder->weld_label("numfollowedby")) + , m_xLabelFollowedByLB(m_xBuilder->weld_combo_box_text("numfollowedbylb")) + , m_xListtabFT(m_xBuilder->weld_label("at")) + , m_xListtabMF(m_xBuilder->weld_metric_spin_button("atmf", FUNIT_CM)) + , m_xAlign2FT(m_xBuilder->weld_label("num2align")) + , m_xAlign2LB(m_xBuilder->weld_combo_box_text("num2alignlb")) + , m_xAlignedAtFT(m_xBuilder->weld_label("alignedat")) + , m_xAlignedAtMF(m_xBuilder->weld_metric_spin_button("alignedatmf", FUNIT_CM)) + , m_xIndentAtFT(m_xBuilder->weld_label("indentat")) + , m_xIndentAtMF(m_xBuilder->weld_metric_spin_button("indentatmf", FUNIT_CM)) + , m_xStandardPB(m_xBuilder->weld_button("standard")) + , m_xPreviewWIN(new SwNumberingPreview(m_xBuilder->weld_drawing_area("preview"))) { - get(m_pLevelLB, "levellb"); - m_pLevelLB->EnableMultiSelection(true); - get(m_pPositionFrame, "numberingframe"); - get(m_pDistBorderFT, "indent"); - get(m_pDistBorderMF, "indentmf"); - get(m_pRelativeCB, "relative"); - get(m_pIndentFT, "numberingwidth"); - get(m_pIndentMF, "numberingwidthmf"); - get(m_pDistNumFT, "numdist"); - get(m_pDistNumMF, "numdistmf"); - get(m_pAlignFT, "numalign"); - get(m_pAlignLB, "numalignlb"); - - get(m_pLabelFollowedByFT, "numfollowedby"); - get(m_pLabelFollowedByLB, "numfollowedbylb"); - get(m_pListtabFT, "at"); - get(m_pListtabMF, "atmf"); - get(m_pAlign2FT, "num2align"); - get(m_pAlign2LB, "num2alignlb"); - get(m_pAlignedAtFT, "alignedat"); - get(m_pAlignedAtMF, "alignedatmf"); - get(m_pIndentAtFT, "indentat"); - get(m_pIndentAtMF, "indentatmf"); - get(m_pStandardPB, "standard"); - - get(m_pPreviewWIN, "preview"); - SetExchangeSupport(); - m_pPreviewWIN->SetBackground(Wallpaper(COL_TRANSPARENT)); - m_pRelativeCB->Check(); - m_pAlignLB->SetSelectHdl(LINK(this, SwNumPositionTabPage, EditModifyHdl)); - m_pAlign2LB->SetSelectHdl(LINK(this, SwNumPositionTabPage, EditModifyHdl)); - for ( sal_Int32 i = 0; i < m_pAlignLB->GetEntryCount(); ++i ) + m_xLevelLB->set_selection_mode(true); + + m_xRelativeCB->set_active(true); + m_xAlignLB->connect_changed(LINK(this, SwNumPositionTabPage, EditModifyHdl)); + m_xAlign2LB->connect_changed(LINK(this, SwNumPositionTabPage, EditModifyHdl)); + for (int i = 0; i < m_xAlignLB->get_count(); ++i) { - m_pAlign2LB->InsertEntry( m_pAlignLB->GetEntry( i ) ); + m_xAlign2LB->append_text(m_xAlignLB->get_text(i)); } - m_pAlign2LB->SetDropDownLineCount( m_pAlign2LB->GetEntryCount() ); - m_pAlign2FT->SetText( m_pAlignFT->GetText() ); - - Link<SpinField&,void> aLk = LINK(this, SwNumPositionTabPage, DistanceHdl); - Link<Control&,void> aLk2 = LINK(this, SwNumPositionTabPage, DistanceLoseFocusHdl); - m_pDistBorderMF->SetUpHdl(aLk); - m_pDistNumMF->SetUpHdl(aLk); - m_pIndentMF->SetUpHdl(aLk); - m_pDistBorderMF->SetDownHdl(aLk); - m_pDistNumMF->SetDownHdl(aLk); - m_pIndentMF->SetDownHdl(aLk); - m_pDistBorderMF->SetLoseFocusHdl(aLk2); - m_pDistNumMF->SetLoseFocusHdl(aLk2); - m_pIndentMF->SetLoseFocusHdl(aLk2); - - m_pLabelFollowedByLB->SetDropDownLineCount( m_pLabelFollowedByLB->GetEntryCount() ); - m_pLabelFollowedByLB->SetSelectHdl( LINK(this, SwNumPositionTabPage, LabelFollowedByHdl_Impl) ); + m_xAlign2FT->set_label(m_xAlignFT->get_label()); + + Link<weld::MetricSpinButton&, void> aLk = LINK(this, SwNumPositionTabPage, DistanceHdl); + m_xDistBorderMF->connect_value_changed(aLk); + m_xDistNumMF->connect_value_changed(aLk); + m_xIndentMF->connect_value_changed(aLk); + + m_xLabelFollowedByLB->connect_changed( LINK(this, SwNumPositionTabPage, LabelFollowedByHdl_Impl) ); aLk = LINK(this, SwNumPositionTabPage, ListtabPosHdl_Impl); - aLk2 = LINK(this, SwNumPositionTabPage, ListtabPosFocusHdl_Impl); - m_pListtabMF->SetUpHdl(aLk); - m_pListtabMF->SetDownHdl(aLk); - m_pListtabMF->SetLoseFocusHdl(aLk2); + m_xListtabMF->connect_value_changed(aLk); aLk = LINK(this, SwNumPositionTabPage, AlignAtHdl_Impl); - aLk2 = LINK(this, SwNumPositionTabPage, AlignAtFocusHdl_Impl); - m_pAlignedAtMF->SetUpHdl(aLk); - m_pAlignedAtMF->SetDownHdl(aLk); - m_pAlignedAtMF->SetLoseFocusHdl(aLk2); + m_xAlignedAtMF->connect_value_changed(aLk); aLk = LINK(this, SwNumPositionTabPage, IndentAtHdl_Impl); - aLk2 = LINK(this, SwNumPositionTabPage, IndentAtFocusHdl_Impl); - m_pIndentAtMF->SetUpHdl(aLk); - m_pIndentAtMF->SetDownHdl(aLk); - m_pIndentAtMF->SetLoseFocusHdl(aLk2); + m_xIndentAtMF->connect_value_changed(aLk); - m_pLevelLB->SetSelectHdl(LINK(this, SwNumPositionTabPage, LevelHdl)); - m_pRelativeCB->SetClickHdl(LINK(this, SwNumPositionTabPage, RelativeHdl)); - m_pStandardPB->SetClickHdl(LINK(this, SwNumPositionTabPage, StandardHdl)); + m_xLevelLB->connect_changed(LINK(this, SwNumPositionTabPage, LevelHdl)); + m_xRelativeCB->connect_toggled(LINK(this, SwNumPositionTabPage, RelativeHdl)); + m_xStandardPB->connect_clicked(LINK(this, SwNumPositionTabPage, StandardHdl)); // insert levels for(sal_uInt16 i = 1; i <= MAXLEVEL; i++) - m_pLevelLB->InsertEntry(OUString::number(i)); + m_xLevelLB->append_text(OUString::number(i)); OUString sEntry("1 - "); sEntry += OUString::number(MAXLEVEL); - m_pLevelLB->InsertEntry(sEntry); - m_pLevelLB->SelectEntry(sEntry); + m_xLevelLB->append_text(sEntry); + m_xLevelLB->select_text(sEntry); - m_pRelativeCB->Check(bLastRelative); - m_pPreviewWIN->SetPositionMode(); + m_xRelativeCB->set_active(bLastRelative); + m_xPreviewWIN->SetPositionMode(); } SwNumPositionTabPage::~SwNumPositionTabPage() @@ -165,29 +142,6 @@ SwNumPositionTabPage::~SwNumPositionTabPage() void SwNumPositionTabPage::dispose() { delete pActNum; - m_pLevelLB.clear(); - m_pPositionFrame.clear(); - m_pDistBorderFT.clear(); - m_pDistBorderMF.clear(); - m_pRelativeCB.clear(); - m_pIndentFT.clear(); - m_pIndentMF.clear(); - m_pDistNumFT.clear(); - m_pDistNumMF.clear(); - m_pAlignFT.clear(); - m_pAlignLB.clear(); - m_pLabelFollowedByFT.clear(); - m_pLabelFollowedByLB.clear(); - m_pListtabFT.clear(); - m_pListtabMF.clear(); - m_pAlign2FT.clear(); - m_pAlign2LB.clear(); - m_pAlignedAtFT.clear(); - m_pAlignedAtMF.clear(); - m_pIndentAtFT.clear(); - m_pIndentAtMF.clear(); - m_pStandardPB.clear(); - m_pPreviewWIN.clear(); pOutlineDlg.clear(); SfxTabPage::dispose(); } @@ -196,13 +150,13 @@ void SwNumPositionTabPage::InitControls() { bInInintControl = true; const bool bRelative = !bLabelAlignmentPosAndSpaceModeActive && - m_pRelativeCB->IsEnabled() && m_pRelativeCB->IsChecked(); - const bool bSingleSelection = m_pLevelLB->GetSelectedEntryCount() == 1 && + m_xRelativeCB->get_sensitive() && m_xRelativeCB->get_active(); + const bool bSingleSelection = m_xLevelLB->count_selected_rows() == 1 && USHRT_MAX != nActNumLvl; - m_pDistBorderMF->Enable( !bLabelAlignmentPosAndSpaceModeActive && + m_xDistBorderMF->set_sensitive( !bLabelAlignmentPosAndSpaceModeActive && ( bSingleSelection || bRelative || pOutlineDlg.get() != nullptr ) ); - m_pDistBorderFT->Enable( !bLabelAlignmentPosAndSpaceModeActive && + m_xDistBorderFT->set_sensitive( !bLabelAlignmentPosAndSpaceModeActive && ( bSingleSelection || bRelative || pOutlineDlg.get() != nullptr ) ); bool bSetDistEmpty = false; @@ -290,19 +244,19 @@ void SwNumPositionTabPage::InitControls() { nDistBorderNum = static_cast<long>(aNumFormatArr[nLvl]->GetAbsLSpace())+ aNumFormatArr[nLvl]->GetFirstLineOffset(); } - m_pDistBorderMF->SetValue(m_pDistBorderMF->Normalize(nDistBorderNum),FUNIT_TWIP); + m_xDistBorderMF->set_value(m_xDistBorderMF->normalize(nDistBorderNum),FUNIT_TWIP); } else bSetDistEmpty = true; if(bSameDist) - m_pDistNumMF->SetValue(m_pDistNumMF->Normalize(aNumFormatArr[nLvl]->GetCharTextDistance()), FUNIT_TWIP); + m_xDistNumMF->set_value(m_xDistNumMF->normalize(aNumFormatArr[nLvl]->GetCharTextDistance()), FUNIT_TWIP); else - m_pDistNumMF->SetText(aEmptyOUStr); + m_xDistNumMF->set_text(aEmptyOUStr); if(bSameIndent) - m_pIndentMF->SetValue(m_pIndentMF->Normalize(-aNumFormatArr[nLvl]->GetFirstLineOffset()), FUNIT_TWIP); + m_xIndentMF->set_value(m_xIndentMF->normalize(-aNumFormatArr[nLvl]->GetFirstLineOffset()), FUNIT_TWIP); else - m_pIndentMF->SetText(aEmptyOUStr); + m_xIndentMF->set_text(aEmptyOUStr); if(bSameAdjust) { @@ -311,13 +265,13 @@ void SwNumPositionTabPage::InitControls() nPos = 0; else if(aNumFormatArr[nLvl]->GetNumAdjust() == SvxAdjust::Right) nPos = 2; - m_pAlignLB->SelectEntryPos(nPos); - m_pAlign2LB->SelectEntryPos( nPos ); + m_xAlignLB->set_active(nPos); + m_xAlign2LB->set_active( nPos ); } else { - m_pAlignLB->SetNoSelection(); - m_pAlign2LB->SetNoSelection(); + m_xAlignLB->set_active(-1); + m_xAlign2LB->set_active(-1); } if ( bSameLabelFollowedBy ) @@ -335,57 +289,57 @@ void SwNumPositionTabPage::InitControls() { nPos = 3; } - m_pLabelFollowedByLB->SelectEntryPos( nPos ); + m_xLabelFollowedByLB->set_active(nPos); } else { - m_pLabelFollowedByLB->SetNoSelection(); + m_xLabelFollowedByLB->set_active(-1); } if ( aNumFormatArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::LISTTAB ) { - m_pListtabFT->Enable(); - m_pListtabMF->Enable(); + m_xListtabFT->set_sensitive(true); + m_xListtabMF->set_sensitive(true); if ( bSameListtab ) { - m_pListtabMF->SetValue(m_pListtabMF->Normalize(aNumFormatArr[nLvl]->GetListtabPos()),FUNIT_TWIP); + m_xListtabMF->set_value(m_xListtabMF->normalize(aNumFormatArr[nLvl]->GetListtabPos()),FUNIT_TWIP); } else { - m_pListtabMF->SetText(aEmptyOUStr); + m_xListtabMF->set_text(aEmptyOUStr); } } else { - m_pListtabFT->Enable( false ); - m_pListtabMF->Enable( false ); - m_pListtabMF->SetText(aEmptyOUStr); + m_xListtabFT->set_sensitive( false ); + m_xListtabMF->set_sensitive( false ); + m_xListtabMF->set_text(aEmptyOUStr); } if ( bSameAlignAt ) { - m_pAlignedAtMF->SetValue( - m_pAlignedAtMF->Normalize( aNumFormatArr[nLvl]->GetIndentAt() + + m_xAlignedAtMF->set_value( + m_xAlignedAtMF->normalize( aNumFormatArr[nLvl]->GetIndentAt() + aNumFormatArr[nLvl]->GetFirstLineIndent()), FUNIT_TWIP ); } else { - m_pAlignedAtMF->SetText(aEmptyOUStr); + m_xAlignedAtMF->set_text(aEmptyOUStr); } if ( bSameIndentAt ) { - m_pIndentAtMF->SetValue( - m_pIndentAtMF->Normalize( aNumFormatArr[nLvl]->GetIndentAt()), FUNIT_TWIP ); + m_xIndentAtMF->set_value( + m_xIndentAtMF->normalize( aNumFormatArr[nLvl]->GetIndentAt()), FUNIT_TWIP ); } else { - m_pIndentAtMF->SetText(aEmptyOUStr); + m_xIndentAtMF->set_text(aEmptyOUStr); } - if(bSetDistEmpty) - m_pDistBorderMF->SetText(aEmptyOUStr); + if (bSetDistEmpty) + m_xDistBorderMF->set_text(aEmptyOUStr); bInInintControl = false; } @@ -407,25 +361,26 @@ void SwNumPositionTabPage::ActivatePage(const SfxItemSet& ) *pActNum = *pSaveNum; nActNumLvl = nTmpNumLvl; sal_uInt16 nMask = 1; - m_pLevelLB->SetUpdateMode(false); - m_pLevelLB->SetNoSelection(); - m_pLevelLB->SelectEntryPos( MAXLEVEL, nActNumLvl == USHRT_MAX); - if(nActNumLvl != USHRT_MAX) - for(sal_uInt16 i = 0; i < MAXLEVEL; i++) + m_xLevelLB->unselect_all(); + if (nActNumLvl == USHRT_MAX) + m_xLevelLB->select(MAXLEVEL); + else + { + for (sal_uInt16 i = 0; i < MAXLEVEL; ++i) { - if(nActNumLvl & nMask) - m_pLevelLB->SelectEntryPos( i ); + if (nActNumLvl & nMask) + m_xLevelLB->select(i); nMask <<= 1 ; } - m_pLevelLB->SetUpdateMode(true); + } InitPosAndSpaceMode(); ShowControlsDependingOnPosAndSpaceMode(); InitControls(); } - m_pRelativeCB->Enable(1 != nActNumLvl); - m_pPreviewWIN->Invalidate(); + m_xRelativeCB->set_sensitive(1 != nActNumLvl); + m_xPreviewWIN->queue_draw(); } DeactivateRC SwNumPositionTabPage::DeactivatePage(SfxItemSet *_pSet) @@ -453,36 +408,36 @@ bool SwNumPositionTabPage::FillItemSet( SfxItemSet* rSet ) void SwNumPositionTabPage::Reset( const SfxItemSet* rSet ) { const SfxPoolItem* pItem; - if(pOutlineDlg) + if (pOutlineDlg) { pSaveNum = pOutlineDlg->GetNumRule(); - m_pLevelLB->EnableMultiSelection(false); + m_xLevelLB->set_selection_mode(false); } else if(SfxItemState::SET == rSet->GetItemState(FN_PARAM_ACT_NUMBER, false, &pItem)) pSaveNum = const_cast<SwUINumRuleItem*>(static_cast<const SwUINumRuleItem*>(pItem))->GetNumRule(); nActNumLvl = SwOutlineTabDialog::GetActNumLevel(); sal_uInt16 nMask = 1; - m_pLevelLB->SetUpdateMode(false); - m_pLevelLB->SetNoSelection(); + m_xLevelLB->unselect_all(); if(nActNumLvl == USHRT_MAX) { - m_pLevelLB->SelectEntryPos( MAXLEVEL ); + m_xLevelLB->select(MAXLEVEL); } else - for(sal_uInt16 i = 0; i < MAXLEVEL; i++) + { + for (sal_uInt16 i = 0; i < MAXLEVEL; ++i) { - if(nActNumLvl & nMask) - m_pLevelLB->SelectEntryPos( i ); + if (nActNumLvl & nMask) + m_xLevelLB->select(i); nMask <<= 1; } - m_pLevelLB->SetUpdateMode(true); + } if(!pActNum) pActNum = new SwNumRule(*pSaveNum); else if(*pSaveNum != *pActNum) *pActNum = *pSaveNum; - m_pPreviewWIN->SetNumRule(pActNum); + m_xPreviewWIN->SetNumRule(pActNum); InitPosAndSpaceMode(); ShowControlsDependingOnPosAndSpaceMode(); InitControls(); @@ -520,32 +475,32 @@ void SwNumPositionTabPage::InitPosAndSpaceMode() void SwNumPositionTabPage::ShowControlsDependingOnPosAndSpaceMode() { - m_pDistBorderFT->Show( !bLabelAlignmentPosAndSpaceModeActive ); - m_pDistBorderMF->Show( !bLabelAlignmentPosAndSpaceModeActive ); - m_pRelativeCB->Show( !bLabelAlignmentPosAndSpaceModeActive ); - m_pIndentFT->Show( !bLabelAlignmentPosAndSpaceModeActive ); - m_pIndentMF->Show( !bLabelAlignmentPosAndSpaceModeActive ); - m_pDistNumFT->Show( !bLabelAlignmentPosAndSpaceModeActive ); - m_pDistNumMF->Show( !bLabelAlignmentPosAndSpaceModeActive ); - m_pAlignFT->Show( !bLabelAlignmentPosAndSpaceModeActive ); - m_pAlignLB->Show( !bLabelAlignmentPosAndSpaceModeActive ); - - m_pLabelFollowedByFT->Show( bLabelAlignmentPosAndSpaceModeActive ); - m_pLabelFollowedByLB->Show( bLabelAlignmentPosAndSpaceModeActive ); - m_pListtabFT->Show( bLabelAlignmentPosAndSpaceModeActive ); - m_pListtabMF->Show( bLabelAlignmentPosAndSpaceModeActive ); - m_pAlign2FT->Show( bLabelAlignmentPosAndSpaceModeActive ); - m_pAlign2LB->Show( bLabelAlignmentPosAndSpaceModeActive ); - m_pAlignedAtFT->Show( bLabelAlignmentPosAndSpaceModeActive ); - m_pAlignedAtMF->Show( bLabelAlignmentPosAndSpaceModeActive ); - m_pIndentAtFT->Show( bLabelAlignmentPosAndSpaceModeActive ); - m_pIndentAtMF->Show( bLabelAlignmentPosAndSpaceModeActive ); + m_xDistBorderFT->show( !bLabelAlignmentPosAndSpaceModeActive ); + m_xDistBorderMF->show( !bLabelAlignmentPosAndSpaceModeActive ); + m_xRelativeCB->show( !bLabelAlignmentPosAndSpaceModeActive ); + m_xIndentFT->show( !bLabelAlignmentPosAndSpaceModeActive ); + m_xIndentMF->show( !bLabelAlignmentPosAndSpaceModeActive ); + m_xDistNumFT->show( !bLabelAlignmentPosAndSpaceModeActive ); + m_xDistNumMF->show( !bLabelAlignmentPosAndSpaceModeActive ); + m_xAlignFT->show( !bLabelAlignmentPosAndSpaceModeActive ); + m_xAlignLB->show( !bLabelAlignmentPosAndSpaceModeActive ); + + m_xLabelFollowedByFT->show( bLabelAlignmentPosAndSpaceModeActive ); + m_xLabelFollowedByLB->show( bLabelAlignmentPosAndSpaceModeActive ); + m_xListtabFT->show( bLabelAlignmentPosAndSpaceModeActive ); + m_xListtabMF->show( bLabelAlignmentPosAndSpaceModeActive ); + m_xAlign2FT->show( bLabelAlignmentPosAndSpaceModeActive ); + m_xAlign2LB->show( bLabelAlignmentPosAndSpaceModeActive ); + m_xAlignedAtFT->show( bLabelAlignmentPosAndSpaceModeActive ); + m_xAlignedAtMF->show( bLabelAlignmentPosAndSpaceModeActive ); + m_xIndentAtFT->show( bLabelAlignmentPosAndSpaceModeActive ); + m_xIndentAtMF->show( bLabelAlignmentPosAndSpaceModeActive ); } VclPtr<SfxTabPage> SwNumPositionTabPage::Create( TabPageParent pParent, const SfxItemSet* rAttrSet) { - return VclPtr<SwNumPositionTabPage>::Create(pParent.pParent, *rAttrSet); + return VclPtr<SwNumPositionTabPage>::Create(pParent, *rAttrSet); } void SwNumPositionTabPage::SetWrtShell(SwWrtShell* pSh) @@ -554,41 +509,34 @@ void SwNumPositionTabPage::SetWrtShell(SwWrtShell* pSh) const SwTwips nWidth = pWrtSh->GetAnyCurRect(CurRectType::Frame).Width(); - m_pDistBorderMF->SetMax(m_pDistBorderMF->Normalize( nWidth ), FUNIT_TWIP ); - m_pDistNumMF->SetMax(m_pDistNumMF->Normalize( nWidth ), FUNIT_TWIP); - m_pIndentMF->SetMax(m_pIndentMF->Normalize( nWidth ), FUNIT_TWIP ); - m_pListtabMF->SetMax(m_pListtabMF->Normalize( nWidth ), FUNIT_TWIP ); - m_pAlignedAtMF->SetMax(m_pAlignedAtMF->Normalize( nWidth ), FUNIT_TWIP ); - m_pIndentAtMF->SetMax(m_pIndentAtMF->Normalize( nWidth ), FUNIT_TWIP ); - const SwTwips nLast2 = nWidth /2; - m_pDistBorderMF->SetLast( m_pDistBorderMF->Normalize( nLast2 ), FUNIT_TWIP ); - m_pDistNumMF->SetLast(m_pDistNumMF->Normalize( nLast2 ), FUNIT_TWIP); - m_pIndentMF->SetLast(m_pIndentMF->Normalize( nLast2 ), FUNIT_TWIP ); - m_pListtabMF->SetLast(m_pListtabMF->Normalize( nLast2 ), FUNIT_TWIP ); - m_pAlignedAtMF->SetLast(m_pAlignedAtMF->Normalize( nLast2 ), FUNIT_TWIP ); - m_pIndentAtMF->SetLast(m_pIndentAtMF->Normalize( nLast2 ), FUNIT_TWIP ); + m_xDistBorderMF->set_max(m_xDistBorderMF->normalize( nWidth ), FUNIT_TWIP ); + m_xDistNumMF->set_max(m_xDistNumMF->normalize( nWidth ), FUNIT_TWIP); + m_xIndentMF->set_max(m_xIndentMF->normalize( nWidth ), FUNIT_TWIP ); + m_xListtabMF->set_max(m_xListtabMF->normalize( nWidth ), FUNIT_TWIP ); + m_xAlignedAtMF->set_max(m_xAlignedAtMF->normalize( nWidth ), FUNIT_TWIP ); + m_xIndentAtMF->set_max(m_xIndentAtMF->normalize( nWidth ), FUNIT_TWIP ); const SwRect& rPrtRect = pWrtSh->GetAnyCurRect(CurRectType::Page); - m_pPreviewWIN->SetPageWidth(rPrtRect.Width()); + m_xPreviewWIN->SetPageWidth(rPrtRect.Width()); FieldUnit eMetric = ::GetDfltMetric( dynamic_cast<SwWebView*>( &pWrtSh->GetView()) != nullptr ); if(eMetric == FUNIT_MM) { - m_pDistBorderMF->SetDecimalDigits(1); - m_pDistNumMF->SetDecimalDigits(1); - m_pIndentMF->SetDecimalDigits(1); - m_pListtabMF->SetDecimalDigits(1); - m_pAlignedAtMF->SetDecimalDigits(1); - m_pIndentAtMF->SetDecimalDigits(1); - } - m_pDistBorderMF->SetUnit( eMetric ); - m_pDistNumMF->SetUnit( eMetric ); - m_pIndentMF->SetUnit( eMetric ); - m_pListtabMF->SetUnit( eMetric ); - m_pAlignedAtMF->SetUnit( eMetric ); - m_pIndentAtMF->SetUnit( eMetric ); + m_xDistBorderMF->set_digits(1); + m_xDistNumMF->set_digits(1); + m_xIndentMF->set_digits(1); + m_xListtabMF->set_digits(1); + m_xAlignedAtMF->set_digits(1); + m_xIndentAtMF->set_digits(1); + } + m_xDistBorderMF->set_unit( eMetric ); + m_xDistNumMF->set_unit( eMetric ); + m_xIndentMF->set_unit( eMetric ); + m_xListtabMF->set_unit( eMetric ); + m_xAlignedAtMF->set_unit( eMetric ); + m_xIndentAtMF->set_unit( eMetric ); } -IMPL_LINK_NOARG(SwNumPositionTabPage, EditModifyHdl, ListBox&, void) +IMPL_LINK_NOARG(SwNumPositionTabPage, EditModifyHdl, weld::ComboBoxText&, void) { sal_uInt16 nMask = 1; for(sal_uInt16 i = 0; i < MAXLEVEL; i++) @@ -597,9 +545,9 @@ IMPL_LINK_NOARG(SwNumPositionTabPage, EditModifyHdl, ListBox&, void) { SwNumFormat aNumFormat(pActNum->Get(i)); - const sal_Int32 nPos = m_pAlignLB->IsVisible() - ? m_pAlignLB->GetSelectedEntryPos() - : m_pAlign2LB->GetSelectedEntryPos(); + const int nPos = m_xAlignLB->get_visible() + ? m_xAlignLB->get_active() + : m_xAlign2LB->get_active(); SvxAdjust eAdjust = SvxAdjust::Center; if(nPos == 0) eAdjust = SvxAdjust::Left; @@ -613,71 +561,65 @@ IMPL_LINK_NOARG(SwNumPositionTabPage, EditModifyHdl, ListBox&, void) SetModified(); } -IMPL_LINK( SwNumPositionTabPage, LevelHdl, ListBox&, rBox, void ) +IMPL_LINK( SwNumPositionTabPage, LevelHdl, weld::TreeView&, rBox, void ) { sal_uInt16 nSaveNumLvl = nActNumLvl; nActNumLvl = 0; - if(rBox.IsEntryPosSelected( MAXLEVEL ) && - (rBox.GetSelectedEntryCount() == 1 || nSaveNumLvl != 0xffff)) + auto aRows = rBox.get_selected_rows(); + if ((std::find(aRows.begin(), aRows.end(), MAXLEVEL) != aRows.end()) && + (aRows.size() == 1 || nSaveNumLvl != 0xffff)) { nActNumLvl = 0xFFFF; - rBox.SetUpdateMode(false); - for( sal_uInt16 i = 0; i < MAXLEVEL; i++ ) - rBox.SelectEntryPos( i, false ); - rBox.SetUpdateMode(true); + for (sal_uInt16 i = 0; i < MAXLEVEL; ++i) + rBox.unselect(i); } - else if(rBox.GetSelectedEntryCount()) + else if (!aRows.empty()) { sal_uInt16 nMask = 1; - for( sal_uInt16 i = 0; i < MAXLEVEL; i++ ) + for (sal_uInt16 i = 0; i < MAXLEVEL; ++i) { - if(rBox.IsEntryPosSelected( i )) + if (std::find(aRows.begin(), aRows.end(), i) != aRows.end()) nActNumLvl |= nMask; nMask <<= 1; } - rBox.SelectEntryPos( MAXLEVEL, false ); + rBox.unselect(MAXLEVEL); } else { nActNumLvl = nSaveNumLvl; sal_uInt16 nMask = 1; - for( sal_uInt16 i = 0; i < MAXLEVEL; i++ ) + for (sal_uInt16 i = 0; i < MAXLEVEL; ++i) { if(nActNumLvl & nMask) { - rBox.SelectEntryPos(i); + rBox.select(i); break; } nMask <<=1; } } - m_pRelativeCB->Enable(1 != nActNumLvl); + m_xRelativeCB->set_sensitive(1 != nActNumLvl); SetModified(); InitPosAndSpaceMode(); ShowControlsDependingOnPosAndSpaceMode(); InitControls(); } -IMPL_LINK( SwNumPositionTabPage, DistanceLoseFocusHdl, Control&, rControl, void ) -{ - DistanceHdl(static_cast<SpinField&>(rControl)); -} -IMPL_LINK( SwNumPositionTabPage, DistanceHdl, SpinField&, rSpin, void ) +IMPL_LINK(SwNumPositionTabPage, DistanceHdl, weld::MetricSpinButton&, rField, void) { if(bInInintControl) return; - MetricField& rField = static_cast<MetricField&>(rSpin); - long nValue = static_cast< long >(rField.Denormalize(rField.GetValue(FUNIT_TWIP))); + long nValue = static_cast< long >(rField.denormalize(rField.get_value(FUNIT_TWIP))); sal_uInt16 nMask = 1; for(sal_uInt16 i = 0; i < MAXLEVEL; i++) { if(nActNumLvl & nMask) { SwNumFormat aNumFormat( pActNum->Get( i ) ); - if(&rField == m_pDistBorderMF) + if (&rField == m_xDistBorderMF.get()) { - if(m_pRelativeCB->IsChecked() && m_pRelativeCB->IsEnabled()) + if (m_xRelativeCB->get_active() && m_xRelativeCB->get_sensitive()) { if(0 == i) { @@ -698,11 +640,11 @@ IMPL_LINK( SwNumPositionTabPage, DistanceHdl, SpinField&, rSpin, void ) aNumFormat.SetAbsLSpace( static_cast<short>(nValue) - aNumFormat.GetFirstLineOffset()); } } - else if (&rField == m_pDistNumMF) + else if (&rField == m_xDistNumMF.get()) { aNumFormat.SetCharTextDistance( nValue ); } - else if (&rField == m_pIndentMF) + else if (&rField == m_xIndentMF.get()) { // now AbsLSpace also has to be modified by FirstLineOffset long nDiff = nValue + aNumFormat.GetFirstLineOffset(); @@ -717,14 +659,14 @@ IMPL_LINK( SwNumPositionTabPage, DistanceHdl, SpinField&, rSpin, void ) } SetModified(); - if(!m_pDistBorderMF->IsEnabled()) - m_pDistBorderMF->SetText(aEmptyOUStr); + if(!m_xDistBorderMF->get_sensitive()) + m_xDistBorderMF->set_text(aEmptyOUStr); } -IMPL_LINK( SwNumPositionTabPage, RelativeHdl, Button *, pBox, void ) +IMPL_LINK( SwNumPositionTabPage, RelativeHdl, weld::ToggleButton&, rBox, void ) { - bool bOn = static_cast<CheckBox*>(pBox)->IsChecked(); - bool bSingleSelection = m_pLevelLB->GetSelectedEntryCount() == 1 && USHRT_MAX != nActNumLvl; + bool bOn = rBox.get_active(); + bool bSingleSelection = m_xLevelLB->n_children() == 1 && USHRT_MAX != nActNumLvl; bool bSetValue = false; long nValue = 0; if(bOn || bSingleSelection) @@ -752,19 +694,19 @@ IMPL_LINK( SwNumPositionTabPage, RelativeHdl, Button *, pBox, void ) } if(bSetValue) - m_pDistBorderMF->SetValue(m_pDistBorderMF->Normalize(nValue), FUNIT_TWIP); + m_xDistBorderMF->set_value(m_xDistBorderMF->normalize(nValue), FUNIT_TWIP); else - m_pDistBorderMF->SetText(aEmptyOUStr); - m_pDistBorderMF->Enable(bOn || bSingleSelection || pOutlineDlg); + m_xDistBorderMF->set_text(aEmptyOUStr); + m_xDistBorderMF->set_sensitive(bOn || bSingleSelection || pOutlineDlg); bLastRelative = bOn; } -IMPL_LINK_NOARG(SwNumPositionTabPage, LabelFollowedByHdl_Impl, ListBox&, void) +IMPL_LINK_NOARG(SwNumPositionTabPage, LabelFollowedByHdl_Impl, weld::ComboBoxText&, void) { // determine value to be set at the chosen list levels SvxNumberFormat::LabelFollowedBy eLabelFollowedBy = SvxNumberFormat::LISTTAB; { - const sal_Int32 nPos = m_pLabelFollowedByLB->GetSelectedEntryPos(); + const int nPos = m_xLabelFollowedByLB->get_active(); if ( nPos == 1 ) { eLabelFollowedBy = SvxNumberFormat::SPACE; @@ -806,31 +748,26 @@ IMPL_LINK_NOARG(SwNumPositionTabPage, LabelFollowedByHdl_Impl, ListBox&, void) // enable/disable metric field for list tab stop position depending on // selected item following the list label. - m_pListtabFT->Enable( eLabelFollowedBy == SvxNumberFormat::LISTTAB ); - m_pListtabMF->Enable( eLabelFollowedBy == SvxNumberFormat::LISTTAB ); + m_xListtabFT->set_sensitive( eLabelFollowedBy == SvxNumberFormat::LISTTAB ); + m_xListtabMF->set_sensitive( eLabelFollowedBy == SvxNumberFormat::LISTTAB ); if ( bSameListtabPos && eLabelFollowedBy == SvxNumberFormat::LISTTAB ) { - m_pListtabMF->SetValue( - m_pListtabMF->Normalize( pActNum->Get( nFirstLvl ).GetListtabPos() ), + m_xListtabMF->set_value( + m_xListtabMF->normalize( pActNum->Get( nFirstLvl ).GetListtabPos() ), FUNIT_TWIP ); } else { - m_pListtabMF->SetText( OUString() ); + m_xListtabMF->set_text(OUString()); } SetModified(); } -IMPL_LINK( SwNumPositionTabPage, ListtabPosFocusHdl_Impl, Control&, rControl, void ) -{ - ListtabPosHdl_Impl(static_cast<SpinField&>(rControl)); -} -IMPL_LINK( SwNumPositionTabPage, ListtabPosHdl_Impl, SpinField&, rSpin, void ) +IMPL_LINK( SwNumPositionTabPage, ListtabPosHdl_Impl, weld::MetricSpinButton&, rField, void ) { - MetricField& rField = static_cast<MetricField&>(rSpin); // determine value to be set at the chosen list levels - const long nValue = static_cast< long >(rField.Denormalize(rField.GetValue(FUNIT_TWIP))); + const long nValue = static_cast< long >(rField.denormalize(rField.get_value(FUNIT_TWIP))); // set value at the chosen list levels sal_uInt16 nMask = 1; @@ -848,15 +785,10 @@ IMPL_LINK( SwNumPositionTabPage, ListtabPosHdl_Impl, SpinField&, rSpin, void ) SetModified(); } -IMPL_LINK( SwNumPositionTabPage, AlignAtFocusHdl_Impl, Control&, rControl, void ) -{ - AlignAtHdl_Impl(static_cast<SpinField&>(rControl)); -} -IMPL_LINK( SwNumPositionTabPage, AlignAtHdl_Impl, SpinField&, rSpin, void ) +IMPL_LINK( SwNumPositionTabPage, AlignAtHdl_Impl, weld::MetricSpinButton&, rField, void ) { - MetricField& rField = static_cast<MetricField&>(rSpin); // determine value to be set at the chosen list levels - const long nValue = static_cast< long >(rField.Denormalize(rField.GetValue(FUNIT_TWIP))); + const long nValue = static_cast< long >(rField.denormalize(rField.get_value(FUNIT_TWIP))); // set value at the chosen list levels sal_uInt16 nMask = 1; @@ -875,15 +807,10 @@ IMPL_LINK( SwNumPositionTabPage, AlignAtHdl_Impl, SpinField&, rSpin, void ) SetModified(); } -IMPL_LINK( SwNumPositionTabPage, IndentAtFocusHdl_Impl, Control&, rControl, void ) -{ - IndentAtHdl_Impl(static_cast<SpinField&>(rControl)); -} -IMPL_LINK( SwNumPositionTabPage, IndentAtHdl_Impl, SpinField&, rSpin, void ) +IMPL_LINK( SwNumPositionTabPage, IndentAtHdl_Impl, weld::MetricSpinButton&, rField, void ) { - MetricField& rField = static_cast<MetricField&>(rSpin); // determine value to be set at the chosen list levels - const long nValue = static_cast< long >(rField.Denormalize(rField.GetValue(FUNIT_TWIP))); + const long nValue = static_cast< long >(rField.denormalize(rField.get_value(FUNIT_TWIP))); // set value at the chosen list levels sal_uInt16 nMask = 1; @@ -905,7 +832,7 @@ IMPL_LINK( SwNumPositionTabPage, IndentAtHdl_Impl, SpinField&, rSpin, void ) SetModified(); } -IMPL_LINK_NOARG(SwNumPositionTabPage, StandardHdl, Button*, void) +IMPL_LINK_NOARG(SwNumPositionTabPage, StandardHdl, weld::Button&, void) { sal_uInt16 nMask = 1; for(sal_uInt16 i = 0; i < MAXLEVEL; i++) @@ -945,8 +872,8 @@ IMPL_LINK_NOARG(SwNumPositionTabPage, StandardHdl, Button*, void) void SwNumPositionTabPage::SetModified() { bModified = true; - m_pPreviewWIN->SetLevel(nActNumLvl); - m_pPreviewWIN->Invalidate(); + m_xPreviewWIN->SetLevel(nActNumLvl); + m_xPreviewWIN->queue_draw(); } #endif diff --git a/sw/source/uibase/inc/num.hxx b/sw/source/uibase/inc/num.hxx index d93bd4eefb0a..5d0817cd273e 100644 --- a/sw/source/uibase/inc/num.hxx +++ b/sw/source/uibase/inc/num.hxx @@ -37,38 +37,6 @@ class SwOutlineTabDialog; class SwNumPositionTabPage : public SfxTabPage { - VclPtr<ListBox> m_pLevelLB; - VclPtr<VclFrame> m_pPositionFrame; - - // former set of controls shown for numbering rules containing list level - // attributes in SvxNumberFormat::SvxNumPositionAndSpaceMode == LABEL_WIDTH_AND_POSITION - VclPtr<FixedText> m_pDistBorderFT; - VclPtr<MetricField> m_pDistBorderMF; - VclPtr<CheckBox> m_pRelativeCB; - VclPtr<FixedText> m_pIndentFT; - VclPtr<MetricField> m_pIndentMF; - VclPtr<FixedText> m_pDistNumFT; - VclPtr<MetricField> m_pDistNumMF; - VclPtr<FixedText> m_pAlignFT; - VclPtr<ListBox> m_pAlignLB; - - // new set of controls shown for numbering rules containing list level - // attributes in SvxNumberFormat::SvxNumPositionAndSpaceMode == LABEL_ALIGNMENT - VclPtr<FixedText> m_pLabelFollowedByFT; - VclPtr<ListBox> m_pLabelFollowedByLB; - VclPtr<FixedText> m_pListtabFT; - VclPtr<MetricField> m_pListtabMF; - VclPtr<FixedText> m_pAlign2FT; - VclPtr<ListBox> m_pAlign2LB; - VclPtr<FixedText> m_pAlignedAtFT; - VclPtr<MetricField> m_pAlignedAtMF; - VclPtr<FixedText> m_pIndentAtFT; - VclPtr<MetricField> m_pIndentAtMF; - - VclPtr<PushButton> m_pStandardPB; - - VclPtr<NumberingPreview> m_pPreviewWIN; - SwNumRule* pActNum; SwNumRule* pSaveNum; SwWrtShell* pWrtSh; @@ -81,33 +49,59 @@ class SwNumPositionTabPage : public SfxTabPage bool bInInintControl : 1; // work around modify-error; should be resolved from 391 on bool bLabelAlignmentPosAndSpaceModeActive; + std::unique_ptr<weld::TreeView> m_xLevelLB; + std::unique_ptr<weld::Widget> m_xPositionFrame; + + // former set of controls shown for numbering rules containing list level + // attributes in SvxNumberFormat::SvxNumPositionAndSpaceMode == LABEL_WIDTH_AND_POSITION + std::unique_ptr<weld::Label> m_xDistBorderFT; + std::unique_ptr<weld::MetricSpinButton> m_xDistBorderMF; + std::unique_ptr<weld::CheckButton> m_xRelativeCB; + std::unique_ptr<weld::Label> m_xIndentFT; + std::unique_ptr<weld::MetricSpinButton> m_xIndentMF; + std::unique_ptr<weld::Label> m_xDistNumFT; + std::unique_ptr<weld::MetricSpinButton> m_xDistNumMF; + std::unique_ptr<weld::Label> m_xAlignFT; + std::unique_ptr<weld::ComboBoxText> m_xAlignLB; + + // new set of controls shown for numbering rules containing list level + // attributes in SvxNumberFormat::SvxNumPositionAndSpaceMode == LABEL_ALIGNMENT + std::unique_ptr<weld::Label> m_xLabelFollowedByFT; + std::unique_ptr<weld::ComboBoxText> m_xLabelFollowedByLB; + std::unique_ptr<weld::Label> m_xListtabFT; + std::unique_ptr<weld::MetricSpinButton> m_xListtabMF; + std::unique_ptr<weld::Label> m_xAlign2FT; + std::unique_ptr<weld::ComboBoxText> m_xAlign2LB; + std::unique_ptr<weld::Label> m_xAlignedAtFT; + std::unique_ptr<weld::MetricSpinButton> m_xAlignedAtMF; + std::unique_ptr<weld::Label> m_xIndentAtFT; + std::unique_ptr<weld::MetricSpinButton> m_xIndentAtMF; + std::unique_ptr<weld::Button> m_xStandardPB; + std::unique_ptr<SwNumberingPreview> m_xPreviewWIN; + + void InitControls(); - DECL_LINK( LevelHdl, ListBox&, void ); - DECL_LINK(EditModifyHdl, ListBox&, void); - DECL_LINK( DistanceHdl, SpinField&, void ); - DECL_LINK( DistanceLoseFocusHdl, Control&, void ); - DECL_LINK( RelativeHdl, Button*, void ); - DECL_LINK(StandardHdl, Button*, void); + DECL_LINK(LevelHdl, weld::TreeView&, void); + DECL_LINK(EditModifyHdl, weld::ComboBoxText&, void); + DECL_LINK(DistanceHdl, weld::MetricSpinButton&, void); + DECL_LINK(RelativeHdl, weld::ToggleButton&, void); + DECL_LINK(StandardHdl, weld::Button&, void); void InitPosAndSpaceMode(); void ShowControlsDependingOnPosAndSpaceMode(); - DECL_LINK(LabelFollowedByHdl_Impl, ListBox&, void); - DECL_LINK( ListtabPosHdl_Impl, SpinField&, void ); - DECL_LINK( ListtabPosFocusHdl_Impl, Control&, void ); - DECL_LINK( AlignAtHdl_Impl, SpinField&, void ); - DECL_LINK( AlignAtFocusHdl_Impl, Control&, void ); - DECL_LINK( IndentAtHdl_Impl, SpinField&, void ); - DECL_LINK( IndentAtFocusHdl_Impl, Control&, void ); + DECL_LINK(LabelFollowedByHdl_Impl, weld::ComboBoxText&, void); + DECL_LINK(ListtabPosHdl_Impl, weld::MetricSpinButton&, void); + DECL_LINK(AlignAtHdl_Impl, weld::MetricSpinButton&, void); + DECL_LINK(IndentAtHdl_Impl, weld::MetricSpinButton&, void); using SfxTabPage::ActivatePage; using SfxTabPage::DeactivatePage; public: - SwNumPositionTabPage(vcl::Window* pParent, - const SfxItemSet& rSet); + SwNumPositionTabPage(TabPageParent pParent, const SfxItemSet& rSet); virtual ~SwNumPositionTabPage() override; virtual void dispose() override; @@ -126,8 +120,8 @@ public: #else void SetModified() { bModified = true; - m_pPreviewWIN->SetLevel(nActNumLvl); - m_pPreviewWIN->Invalidate(); + m_xPreviewWIN->SetLevel(nActNumLvl); + m_xPreviewWIN->queue_draw(); } #endif }; diff --git a/sw/uiconfig/swriter/ui/outlinepositionpage.ui b/sw/uiconfig/swriter/ui/outlinepositionpage.ui index d334cba8f914..b310ef8bfa19 100644 --- a/sw/uiconfig/swriter/ui/outlinepositionpage.ui +++ b/sw/uiconfig/swriter/ui/outlinepositionpage.ui @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.0 --> +<!-- Generated with glade 3.20.4 --> <interface domain="sw"> <requires lib="gtk+" version="3.18"/> - <requires lib="LibreOffice" version="1.0"/> <object class="GtkAdjustment" id="adjustment1"> <property name="upper">19.989999999999998</property> <property name="step_increment">0.050000000000000003</property> @@ -14,42 +13,18 @@ <property name="step_increment">0.050000000000000003</property> <property name="page_increment">10</property> </object> + <object class="GtkAdjustment" id="adjustment3"> + <property name="upper">19.989999999999998</property> + <property name="step_increment">0.050000000000000003</property> + <property name="page_increment">10</property> + </object> <object class="GtkListStore" id="liststore1"> <columns> - <!-- column-name gchararray1 --> + <!-- column-name text --> <column type="gchararray"/> - </columns> - <data> - <row> - <col id="0" translatable="yes" context="outlinepositionpage|liststore1">Left</col> - </row> - <row> - <col id="0" translatable="yes" context="outlinepositionpage|liststore1">Centered</col> - </row> - <row> - <col id="0" translatable="yes" context="outlinepositionpage|liststore1">Right</col> - </row> - </data> - </object> - <object class="GtkListStore" id="liststore2"> - <columns> - <!-- column-name gchararray1 --> + <!-- column-name id --> <column type="gchararray"/> </columns> - <data> - <row> - <col id="0" translatable="yes" context="outlinepositionpage|liststore2">Tab stop</col> - </row> - <row> - <col id="0" translatable="yes" context="outlinepositionpage|liststore2">Space</col> - </row> - <row> - <col id="0" translatable="yes" context="outlinepositionpage|liststore2">Nothing</col> - </row> - <row> - <col id="0" translatable="yes" context="outlinepositionpage|liststore2">New Line</col> - </row> - </data> </object> <object class="GtkBox" id="OutlinePositionPage"> <property name="visible">True</property> @@ -71,14 +46,34 @@ <property name="top_padding">6</property> <property name="left_padding">12</property> <child> - <object class="GtkTreeView" id="levellb:border"> + <object class="GtkScrolledWindow"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="headers_visible">False</property> - <property name="search_column">0</property> - <child internal-child="selection"> - <object class="GtkTreeSelection" id="treeview-selection6"> - <property name="mode">multiple</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="shadow_type">in</property> + <child> + <object class="GtkTreeView" id="levellb"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="model">liststore1</property> + <property name="headers_visible">False</property> + <property name="headers_clickable">False</property> + <property name="search_column">0</property> + <property name="show_expanders">False</property> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="treeview-selection1"/> + </child> + <child> + <object class="GtkTreeViewColumn" id="treeviewcolumn1"> + <child> + <object class="GtkCellRendererText" id="cellrenderertext1"/> + <attributes> + <attribute name="text">0</attribute> + </attributes> + </child> + </object> + </child> </object> </child> </object> @@ -148,10 +143,14 @@ </packing> </child> <child> - <object class="GtkComboBox" id="numalignlb"> + <object class="GtkComboBoxText" id="numalignlb"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="model">liststore1</property> + <items> + <item translatable="yes" context="outlinepositionpage|liststore1">Left</item> + <item translatable="yes" context="outlinepositionpage|liststore1">Centered</item> + <item translatable="yes" context="outlinepositionpage|liststore1">Right</item> + </items> </object> <packing> <property name="left_attach">1</property> @@ -166,7 +165,7 @@ numbering and text:</property> <property name="use_underline">True</property> <property name="justify">right</property> - <property name="mnemonic_widget">numdistmf:0.00cm</property> + <property name="mnemonic_widget">numdistmf</property> <property name="xalign">1</property> </object> <packing> @@ -175,10 +174,11 @@ numbering and text:</property> </packing> </child> <child> - <object class="GtkSpinButton" id="numdistmf:0.00cm"> + <object class="GtkSpinButton" id="numdistmf"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="adjustment">adjustment1</property> + <property name="activates_default">True</property> + <property name="adjustment">adjustment3</property> <property name="digits">2</property> </object> <packing> @@ -192,7 +192,7 @@ numbering and text:</property> <property name="can_focus">False</property> <property name="label" translatable="yes" context="outlinepositionpage|numberingwidth">Width of numbering:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">numberingwidthmf:0.00cm</property> + <property name="mnemonic_widget">numberingwidthmf</property> <property name="xalign">1</property> </object> <packing> @@ -201,9 +201,10 @@ numbering and text:</property> </packing> </child> <child> - <object class="GtkSpinButton" id="numberingwidthmf:0.00cm"> + <object class="GtkSpinButton" id="numberingwidthmf"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="activates_default">True</property> <property name="adjustment">adjustment1</property> <property name="digits">2</property> </object> @@ -218,8 +219,8 @@ numbering and text:</property> <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">end</property> + <property name="use_underline">True</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> </object> @@ -234,7 +235,7 @@ numbering and text:</property> <property name="can_focus">False</property> <property name="label" translatable="yes" context="outlinepositionpage|indent">Indent:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">indentmf:0.00cm</property> + <property name="mnemonic_widget">indentmf</property> <property name="xalign">1</property> </object> <packing> @@ -243,9 +244,10 @@ numbering and text:</property> </packing> </child> <child> - <object class="GtkSpinButton" id="indentmf:0.00cm"> + <object class="GtkSpinButton" id="indentmf"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="activates_default">True</property> <property name="adjustment">adjustment2</property> <property name="digits">2</property> </object> @@ -260,7 +262,7 @@ numbering and text:</property> <property name="can_focus">False</property> <property name="label" translatable="yes" context="outlinepositionpage|indentat">Indent at:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">indentatmf:0.00cm</property> + <property name="mnemonic_widget">indentatmf</property> <property name="xalign">1</property> </object> <packing> @@ -269,9 +271,10 @@ numbering and text:</property> </packing> </child> <child> - <object class="GtkSpinButton" id="indentatmf:0.00cm"> + <object class="GtkSpinButton" id="indentatmf"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="activates_default">True</property> <property name="digits">2</property> </object> <packing> @@ -294,7 +297,7 @@ numbering and text:</property> </packing> </child> <child> - <object class="GtkComboBox" id="num2alignlb"> + <object class="GtkComboBoxText" id="num2alignlb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -309,7 +312,7 @@ numbering and text:</property> <property name="can_focus">False</property> <property name="label" translatable="yes" context="outlinepositionpage|alignedat">Aligned at:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">alignedatmf:0.00cm</property> + <property name="mnemonic_widget">alignedatmf</property> <property name="xalign">1</property> </object> <packing> @@ -318,9 +321,10 @@ numbering and text:</property> </packing> </child> <child> - <object class="GtkSpinButton" id="alignedatmf:0.00cm"> + <object class="GtkSpinButton" id="alignedatmf"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="activates_default">True</property> <property name="digits">2</property> </object> <packing> @@ -334,7 +338,7 @@ numbering and text:</property> <property name="can_focus">False</property> <property name="label" translatable="yes" context="outlinepositionpage|at">Tab stop at:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">atmf:0.00cm</property> + <property name="mnemonic_widget">atmf</property> <property name="xalign">1</property> </object> <packing> @@ -343,9 +347,10 @@ numbering and text:</property> </packing> </child> <child> - <object class="GtkSpinButton" id="atmf:0.00cm"> + <object class="GtkSpinButton" id="atmf"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="activates_default">True</property> <property name="digits">2</property> </object> <packing> @@ -354,10 +359,15 @@ numbering and text:</property> </packing> </child> <child> - <object class="GtkComboBox" id="numfollowedbylb"> + <object class="GtkComboBoxText" id="numfollowedbylb"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="model">liststore2</property> + <items> + <item translatable="yes" context="outlinepositionpage|liststore2">Tab stop</item> + <item translatable="yes" context="outlinepositionpage|liststore2">Space</item> + <item translatable="yes" context="outlinepositionpage|liststore2">Nothing</item> + <item translatable="yes" context="outlinepositionpage|liststore2">New Line</item> + </items> </object> <packing> <property name="left_attach">1</property> @@ -427,7 +437,7 @@ numbering and text:</property> </packing> </child> <child> - <object class="swuilo-NumberingPreview" id="preview"> + <object class="GtkDrawingArea" id="preview"> <property name="width_request">250</property> <property name="height_request">120</property> <property name="visible">True</property> diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 818ef8b778b4..0ff54771656b 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -1314,6 +1314,18 @@ public: m_xTreeView->SelectEntryPos(pos); } + virtual void unselect(int pos) override + { + assert(m_xTreeView->IsUpdateMode() && "don't select when frozen"); + if (pos == -1) + { + for (sal_Int32 i = 0; i < m_xTreeView->GetEntryCount(); ++i) + m_xTreeView->SelectEntryPos(i); + } + else + m_xTreeView->SelectEntryPos(pos, false); + } + virtual std::vector<int> get_selected_rows() const override { std::vector<int> aRows; diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index d88b8a5b9e95..845e15ad15e4 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -3102,6 +3102,23 @@ public: enable_notify_events(); } + virtual void unselect(int pos) override + { + assert(gtk_tree_view_get_model(m_pTreeView) && "don't select when frozen"); + disable_notify_events(); + if (pos != -1) + { + GtkTreePath* path = gtk_tree_path_new_from_indices(pos, -1); + gtk_tree_selection_unselect_path(gtk_tree_view_get_selection(m_pTreeView), path); + gtk_tree_path_free(path); + } + else + { + gtk_tree_selection_select_all(gtk_tree_view_get_selection(m_pTreeView)); + } + enable_notify_events(); + } + virtual std::vector<int> get_selected_rows() const override { std::vector<int> aRows; |