sw/source/ui/table/tabledlg.cxx | 63 +++++++++++++++++----------- sw/source/uibase/table/tablepg.hxx | 3 - sw/uiconfig/swriter/ui/tabletextflowpage.ui | 10 +++- 3 files changed, 49 insertions(+), 27 deletions(-)
New commits: commit e4f50efd000734c8259ed2915bf0dd1c71700ceb Author: Michael Stahl <mst...@redhat.com> Date: Wed Mar 1 17:20:41 2017 +0100 tdf#77111 sw: fix page number offset on table dialog "Text Flow" Commit c2ccd20c0fd92bddfff76447754541705e3eb8f3 introduced 0 as a valid value for page number offset in sw core. Unfortunately the table dialog was not changed then; previously page number 0 would do automatic numbering, but since then 0 was set as the offset, and once you have a 0 offset there's no easy way to remove it, you have to remove the whole page break. * change the label before the text number edit widget to a checkbox that disables the edit widget * keep the id "pagenoft" so that translations still work * set initial value to 1; 0 is a really bad default since we can't export it to ODF * add a little bit of left margin so the line is indented below the upper line (cherry picked from commit c1e7fc6f497d7570cb0832c43647d295f8592567) Reviewed-on: https://gerrit.libreoffice.org/34763 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit 362ff67556cca0890ca01f2de44596491c0e9bc8) Change-Id: I70cf5a66d4191acd2c19b3d0a83609e2b348a886 Reviewed-on: https://gerrit.libreoffice.org/34811 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx index 0627784..16ec974 100644 --- a/sw/source/ui/table/tabledlg.cxx +++ b/sw/source/ui/table/tabledlg.cxx @@ -1287,7 +1287,7 @@ SwTextFlowPage::SwTextFlowPage(vcl::Window* pParent, const SfxItemSet& rSet) get(m_pPageCollCB, "pagestyle"); get(m_pPageCollLB, "pagestylelb"); - get(m_pPageNoFT, "pagenoft"); + get(m_pPageNoCB, "pagenoft"); get(m_pPageNoNF, "pagenonf"); get(m_pSplitCB, "split"); @@ -1318,6 +1318,8 @@ SwTextFlowPage::SwTextFlowPage(vcl::Window* pParent, const SfxItemSet& rSet) LINK( this, SwTextFlowPage, PageBreakTypeHdl_Impl ) ); m_pPgBrkRB->SetClickHdl( LINK( this, SwTextFlowPage, PageBreakTypeHdl_Impl ) ); + m_pPageNoCB->SetClickHdl( + LINK(this, SwTextFlowPage, PageNoClickHdl_Impl)); m_pSplitCB->SetClickHdl( LINK( this, SwTextFlowPage, SplitHdl_Impl)); m_pSplitRowCB->SetClickHdl( @@ -1352,7 +1354,7 @@ void SwTextFlowPage::dispose() m_pPgBrkAfterRB.clear(); m_pPageCollCB.clear(); m_pPageCollLB.clear(); - m_pPageNoFT.clear(); + m_pPageNoCB.clear(); m_pPageNoNF.clear(); m_pSplitCB.clear(); m_pSplitRowCB.clear(); @@ -1398,10 +1400,10 @@ bool SwTextFlowPage::FillItemSet( SfxItemSet* rSet ) //If we have a page style, then there's no break bool bPageItemPut = false; - if ( bState != (m_pPageCollCB->GetSavedValue() == 1) || - ( bState && - m_pPageCollLB->IsValueChangedFromSaved() ) - || (m_pPageNoNF->IsEnabled() && m_pPageNoNF->IsValueModified()) ) + if ( bState != (m_pPageCollCB->GetSavedValue() == TRISTATE_TRUE) + || (bState && m_pPageCollLB->IsValueChangedFromSaved()) + || (m_pPageNoCB->IsEnabled() && m_pPageNoCB->IsValueChangedFromSaved()) + || (m_pPageNoNF->IsEnabled() && m_pPageNoNF->IsValueModified())) { OUString sPage; @@ -1410,12 +1412,15 @@ bool SwTextFlowPage::FillItemSet( SfxItemSet* rSet ) sPage = m_pPageCollLB->GetSelectEntry(); } sal_uInt16 nPgNum = static_cast< sal_uInt16 >(m_pPageNoNF->GetValue()); - if ( !pDesc || !pDesc->GetPageDesc() || - ( pDesc->GetPageDesc() && ((pDesc->GetPageDesc()->GetName() != sPage) || - !comphelper::string::equals(m_pPageNoNF->GetSavedValue(), nPgNum)))) + bool const usePageNo(bState && m_pPageNoCB->IsChecked()); + boost::optional<sal_uInt16> const oPageNum( + (usePageNo) ? nPgNum : boost::optional<sal_Int16>()); + if (!pDesc || !pDesc->GetPageDesc() + || (pDesc->GetPageDesc()->GetName() != sPage) + || (pDesc->GetNumOffset() != oPageNum)) { SwFormatPageDesc aFormat( pShell->FindPageDescByName( sPage, true ) ); - aFormat.SetNumOffset(bState ? nPgNum : 0); + aFormat.SetNumOffset(oPageNum); bModified |= nullptr != rSet->Put( aFormat ); bPageItemPut = bState; } @@ -1537,12 +1542,18 @@ void SwTextFlowPage::Reset( const SfxItemSet* rSet ) OUString sPageDesc; const SwPageDesc* pDesc = static_cast<const SwFormatPageDesc*>(pItem)->GetPageDesc(); - //m_pPageNoNF->SetValue(static_cast<const SwFormatPageDesc*>(pItem)->GetNumOffset()); ::boost::optional<sal_uInt16> oNumOffset = static_cast<const SwFormatPageDesc*>(pItem)->GetNumOffset(); if (oNumOffset) + { + m_pPageNoCB->Check(); + m_pPageNoNF->Enable(true); m_pPageNoNF->SetValue(oNumOffset.get()); + } else + { + m_pPageNoCB->Check(false); m_pPageNoNF->Enable(false); + } if(pDesc) sPageDesc = pDesc->GetName(); @@ -1582,7 +1593,7 @@ void SwTextFlowPage::Reset( const SfxItemSet* rSet ) m_pPgBrkCB->Check(); m_pPageCollCB->Enable(false); m_pPageCollLB->Enable(false); - m_pPageNoFT->Enable(false); + m_pPageNoCB->Enable(false); m_pPageNoNF->Enable(false); } switch ( eBreak ) @@ -1670,6 +1681,7 @@ void SwTextFlowPage::Reset( const SfxItemSet* rSet ) m_pColBrkRB->SaveValue(); m_pPgBrkBeforeRB->SaveValue(); m_pPgBrkAfterRB->SaveValue(); + m_pPageNoCB->SaveValue(); m_pPageNoNF->SaveValue(); m_pTextDirectionLB->SaveValue(); m_pVertOrientLB->SaveValue(); @@ -1684,7 +1696,7 @@ void SwTextFlowPage::SetShell(SwWrtShell* pSh) if(bHtmlMode) { m_pPageNoNF->Enable(false); - m_pPageNoFT->Enable(false); + m_pPageNoCB->Enable(false); } } @@ -1706,8 +1718,8 @@ IMPL_LINK_NOARG_TYPED(SwTextFlowPage, PageBreakHdl_Impl, Button*, void) m_pPageCollLB->Enable(bEnable); if(!bHtmlMode) { - m_pPageNoFT->Enable(bEnable); - m_pPageNoNF->Enable(bEnable); + m_pPageNoCB->Enable(bEnable); + m_pPageNoNF->Enable(bEnable && m_pPageNoCB->IsChecked()); } } } @@ -1716,7 +1728,7 @@ IMPL_LINK_NOARG_TYPED(SwTextFlowPage, PageBreakHdl_Impl, Button*, void) m_pPageCollCB->Check( false ); m_pPageCollCB->Enable(false); m_pPageCollLB->Enable(false); - m_pPageNoFT->Enable(false); + m_pPageNoCB->Enable(false); m_pPageNoNF->Enable(false); m_pPgBrkRB-> Enable(false); m_pColBrkRB-> Enable(false); @@ -1741,8 +1753,8 @@ IMPL_LINK_NOARG_TYPED(SwTextFlowPage, ApplyCollClickHdl_Impl, Button*, void) m_pPageCollLB->Enable(bEnable); if(!bHtmlMode) { - m_pPageNoFT->Enable(bEnable); - m_pPageNoNF->Enable(bEnable); + m_pPageNoCB->Enable(bEnable); + m_pPageNoNF->Enable(bEnable && m_pPageNoCB->IsChecked()); } } @@ -1760,8 +1772,8 @@ IMPL_LINK_TYPED( SwTextFlowPage, PageBreakPosHdl_Impl, Button*, pBtn, void ) m_pPageCollLB->Enable(bEnable); if(!bHtmlMode) { - m_pPageNoFT->Enable(bEnable); - m_pPageNoNF->Enable(bEnable); + m_pPageNoCB->Enable(bEnable); + m_pPageNoNF->Enable(bEnable && m_pPageNoCB->IsChecked()); } } else if (pBtn == m_pPgBrkAfterRB) @@ -1769,7 +1781,7 @@ IMPL_LINK_TYPED( SwTextFlowPage, PageBreakPosHdl_Impl, Button*, pBtn, void ) m_pPageCollCB->Check( false ); m_pPageCollCB->Enable(false); m_pPageCollLB->Enable(false); - m_pPageNoFT->Enable(false); + m_pPageNoCB->Enable(false); m_pPageNoNF->Enable(false); } } @@ -1782,13 +1794,18 @@ IMPL_LINK_TYPED( SwTextFlowPage, PageBreakTypeHdl_Impl, Button*, pBtn, void ) m_pPageCollCB->Check(false); m_pPageCollCB->Enable(false); m_pPageCollLB->Enable(false); - m_pPageNoFT->Enable(false); + m_pPageNoCB->Enable(false); m_pPageNoNF->Enable(false); } else if ( m_pPgBrkBeforeRB->IsChecked() ) PageBreakPosHdl_Impl(m_pPgBrkBeforeRB); } +IMPL_LINK_NOARG_TYPED(SwTextFlowPage, PageNoClickHdl_Impl, Button*, void) +{ + m_pPageNoNF->Enable(m_pPageNoCB->IsChecked()); +} + IMPL_LINK_TYPED( SwTextFlowPage, SplitHdl_Impl, Button*, pBox, void ) { m_pSplitRowCB->Enable(static_cast<CheckBox*>(pBox)->IsChecked()); @@ -1815,7 +1832,7 @@ void SwTextFlowPage::DisablePageBreak() m_pPgBrkAfterRB->Disable(); m_pPageCollCB->Disable(); m_pPageCollLB->Disable(); - m_pPageNoFT->Disable(); + m_pPageNoCB->Disable(); m_pPageNoNF->Disable(); } diff --git a/sw/source/uibase/table/tablepg.hxx b/sw/source/uibase/table/tablepg.hxx index 75d1e76..01e8ff2 100644 --- a/sw/source/uibase/table/tablepg.hxx +++ b/sw/source/uibase/table/tablepg.hxx @@ -155,7 +155,7 @@ class SwTextFlowPage : public SfxTabPage VclPtr<CheckBox> m_pPageCollCB; VclPtr<ListBox> m_pPageCollLB; - VclPtr<FixedText> m_pPageNoFT; + VclPtr<CheckBox> m_pPageNoCB; VclPtr<NumericField> m_pPageNoNF; VclPtr<CheckBox> m_pSplitCB; VclPtr<TriStateBox> m_pSplitRowCB; @@ -176,6 +176,7 @@ class SwTextFlowPage : public SfxTabPage DECL_LINK_TYPED(ApplyCollClickHdl_Impl, Button*, void); DECL_LINK_TYPED( PageBreakPosHdl_Impl, Button*, void ); DECL_LINK_TYPED( PageBreakTypeHdl_Impl, Button*, void ); + DECL_LINK_TYPED(PageNoClickHdl_Impl, Button*, void); DECL_LINK_TYPED( SplitHdl_Impl, Button*, void ); DECL_STATIC_LINK_TYPED( SwTextFlowPage, SplitRowHdl_Impl, Button*, void ); DECL_LINK_TYPED( HeadLineCBClickHdl, Button* = nullptr, void ); diff --git a/sw/uiconfig/swriter/ui/tabletextflowpage.ui b/sw/uiconfig/swriter/ui/tabletextflowpage.ui index 9af0800..9b34ddd 100644 --- a/sw/uiconfig/swriter/ui/tabletextflowpage.ui +++ b/sw/uiconfig/swriter/ui/tabletextflowpage.ui @@ -5,6 +5,7 @@ <property name="upper">9999</property> <property name="step_increment">1</property> <property name="page_increment">10</property> + <property name="value">1</property> </object> <object class="GtkAdjustment" id="adjustment2"> <property name="upper">100</property> @@ -202,6 +203,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> + <property name="margin_left">22</property> <property name="use_underline">True</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> @@ -217,12 +219,11 @@ </packing> </child> <child> - <object class="GtkLabel" id="pagenoft"> + <object class="GtkCheckButton" id="pagenoft"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="label" translatable="yes">Page _number</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">pagenonf</property> </object> <packing> <property name="left_attach">2</property> @@ -238,6 +239,9 @@ <property name="invisible_char">â¢</property> <property name="invisible_char_set">True</property> <property name="adjustment">adjustment1</property> + <accessibility> + <relation type="labelled-by" target="pagenoft"/> + </accessibility> </object> <packing> <property name="left_attach">3</property>
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits