diff options
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/inc/paragrph.hxx | 3 | ||||
-rw-r--r-- | cui/source/tabpages/paragrph.cxx | 85 | ||||
-rw-r--r-- | cui/uiconfig/ui/textflowpage.ui | 7 |
3 files changed, 69 insertions, 26 deletions
diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx index c38f65a88b1f..abe414a4f24c 100644 --- a/cui/source/inc/paragrph.hxx +++ b/cui/source/inc/paragrph.hxx @@ -234,7 +234,7 @@ private: VclPtr<ListBox> m_pBreakPositionLB; VclPtr<TriStateBox> m_pApplyCollBtn; VclPtr<ListBox> m_pApplyCollBox; - VclPtr<FixedText> m_pPagenumText; + VclPtr<TriStateBox> m_pPageNumBox; VclPtr<NumericField> m_pPagenumEdit; // paragraph division @@ -262,6 +262,7 @@ private: DECL_LINK(ApplyCollClickHdl_Impl, Button*, void); DECL_LINK( PageBreakPosHdl_Impl, ListBox&, void ); DECL_LINK( PageBreakTypeHdl_Impl, ListBox&, void ); + DECL_LINK(PageNumBoxClickHdl_Impl, Button*, void); virtual void PageCreated(const SfxAllItemSet& aSet) override; }; diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx index 97edb56375a9..3c283573a607 100644 --- a/cui/source/tabpages/paragrph.cxx +++ b/cui/source/tabpages/paragrph.cxx @@ -1401,18 +1401,27 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet ) } } - if (m_pPagenumEdit->IsEnabled() && m_pPagenumEdit->IsValueModified()) + if (m_pPageNumBox->IsEnabled() + && (m_pPageNumBox->IsValueChangedFromSaved() || m_pPagenumEdit->IsValueModified())) { - SfxUInt16Item aPageNum( SID_ATTR_PARA_PAGENUM, - (sal_uInt16)m_pPagenumEdit->GetValue() ); - pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_PAGENUM ); - if ( !pOld || static_cast<const SfxUInt16Item*>(pOld)->GetValue() != aPageNum.GetValue() ) + if (TRISTATE_TRUE == m_pPageNumBox->GetState() + && (!pOld || IsInvalidItem(pOld) + || static_cast<const SfxUInt16Item*>(pOld)->GetValue() != m_pPagenumEdit->GetValue())) { + SfxUInt16Item aPageNum(SID_ATTR_PARA_PAGENUM, + static_cast<sal_uInt16>(m_pPagenumEdit->GetValue())); rOutSet->Put( aPageNum ); bModified = true; } + else if (TRISTATE_FALSE == m_pPageNumBox->GetState() + && (pOld || IsInvalidItem(pOld))) + { + // need to tell sw to remove the item + rOutSet->DisableItem(SID_ATTR_PARA_PAGENUM); + bModified = true; + } } // pagebreak @@ -1604,11 +1613,34 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet ) _nWhich = GetWhich( SID_ATTR_PARA_PAGENUM ); - if (rSet->GetItemState(_nWhich) >= SfxItemState::SET) + switch (rSet->GetItemState(_nWhich)) { - const sal_uInt16 nPageNum = - static_cast<const SfxUInt16Item&>(rSet->Get( _nWhich ) ).GetValue(); - m_pPagenumEdit->SetValue( nPageNum ); + case SfxItemState::SET: + { + m_pPageNumBox->EnableTriState(false); + m_pPageNumBox->SetState(TRISTATE_TRUE); + SfxUInt16Item const*const pItem(static_cast<const SfxUInt16Item*>(rSet->GetItem(_nWhich))); + const sal_uInt16 nPageNum(pItem->GetValue()); + m_pPagenumEdit->SetValue( nPageNum ); + break; + } + case SfxItemState::DONTCARE: + { + m_pPageNumBox->EnableTriState(); + m_pPageNumBox->SetState(TRISTATE_INDET); + break; + } + case SfxItemState::UNKNOWN: + case SfxItemState::DEFAULT: + case SfxItemState::DISABLED: + { + m_pPageNumBox->EnableTriState(false); + m_pPageNumBox->SetState(TRISTATE_FALSE); + break; + } + default: + assert(false); // unexpected + break; } if ( bPageBreak ) @@ -1664,7 +1696,7 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet ) m_pApplyCollBtn->Enable(false); m_pApplyCollBox->Enable(false); m_pPagenumEdit->Enable(false); - m_pPagenumText->Enable(false); + m_pPageNumBox->Enable(false); } if ( !bIsPageModel ) @@ -1697,6 +1729,7 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet ) if(!_bEnable) { m_pApplyCollBox->Enable(_bEnable); + m_pPageNumBox->Enable(false); m_pPagenumEdit->Enable(_bEnable); } @@ -1844,6 +1877,7 @@ void SvxExtParagraphTabPage::ChangesApplied() m_pBreakTypeLB->SaveValue(); m_pApplyCollBtn->SaveValue(); m_pApplyCollBox->SaveValue(); + m_pPageNumBox->SaveValue(); m_pPagenumEdit->SaveValue(); m_pKeepTogetherBox->SaveValue(); m_pKeepParaBox->SaveValue(); @@ -1869,6 +1903,7 @@ void SvxExtParagraphTabPage::DisablePageBreak() m_pBreakPositionLB->Enable(false); m_pApplyCollBtn->Enable(false); m_pApplyCollBox->Enable(false); + m_pPageNumBox->Enable(false); m_pPagenumEdit->Enable(false); } @@ -1897,7 +1932,7 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage( vcl::Window* pParent, const SfxI get(m_pPagenumEdit,"spinPageNumber"); get(m_pBreakTypeFT,"labelType"); get(m_pBreakPositionFT,"labelPosition"); - get(m_pPagenumText,"labelPageNum"); + get(m_pPageNumBox,"labelPageNum"); // Options get(m_pKeepTogetherBox,"checkSplitPara"); @@ -1922,6 +1957,7 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage( vcl::Window* pParent, const SfxI m_pApplyCollBtn->SetClickHdl( LINK( this, SvxExtParagraphTabPage, ApplyCollClickHdl_Impl ) ); m_pBreakTypeLB->SetSelectHdl( LINK( this, SvxExtParagraphTabPage, PageBreakTypeHdl_Impl ) ); m_pBreakPositionLB->SetSelectHdl( LINK( this, SvxExtParagraphTabPage, PageBreakPosHdl_Impl ) ); + m_pPageNumBox->SetClickHdl( LINK( this, SvxExtParagraphTabPage, PageNumBoxClickHdl_Impl ) ); SfxObjectShell* pSh = SfxObjectShell::Current(); if ( pSh ) @@ -1953,7 +1989,7 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage( vcl::Window* pParent, const SfxI m_pExtHyphenAfterBox ->Enable(false); m_pMaxHyphenLabel ->Enable(false); m_pMaxHyphenEdit ->Enable(false); - m_pPagenumText ->Enable(false); + m_pPageNumBox ->Enable(false); m_pPagenumEdit ->Enable(false); // no column break in HTML m_pBreakTypeLB->RemoveEntry(1); @@ -1981,7 +2017,7 @@ void SvxExtParagraphTabPage::dispose() m_pBreakPositionLB.clear(); m_pApplyCollBtn.clear(); m_pApplyCollBox.clear(); - m_pPagenumText.clear(); + m_pPageNumBox.clear(); m_pPagenumEdit.clear(); m_pKeepTogetherBox.clear(); m_pKeepParaBox.clear(); @@ -2014,8 +2050,8 @@ IMPL_LINK_NOARG(SvxExtParagraphTabPage, PageBreakHdl_Impl, Button*, void) m_pApplyCollBox->Enable(bEnable); if(!bHtmlMode) { - m_pPagenumText->Enable(bEnable); - m_pPagenumEdit->Enable(bEnable); + m_pPageNumBox->Enable(bEnable); + m_pPagenumEdit->Enable(bEnable && m_pPageNumBox->GetState() == TRISTATE_TRUE); } } break; @@ -2025,7 +2061,7 @@ IMPL_LINK_NOARG(SvxExtParagraphTabPage, PageBreakHdl_Impl, Button*, void) m_pApplyCollBtn->SetState( TRISTATE_FALSE ); m_pApplyCollBtn->Enable(false); m_pApplyCollBox->Enable(false); - m_pPagenumText->Enable(false); + m_pPageNumBox->Enable(false); m_pPagenumEdit->Enable(false); m_pBreakTypeFT->Enable(false); m_pBreakTypeLB->Enable(false); @@ -2115,8 +2151,8 @@ IMPL_LINK_NOARG(SvxExtParagraphTabPage, ApplyCollClickHdl_Impl, Button*, void) m_pApplyCollBox->Enable(bEnable); if(!bHtmlMode) { - m_pPagenumText->Enable(bEnable); - m_pPagenumEdit->Enable(bEnable); + m_pPageNumBox->Enable(bEnable); + m_pPagenumEdit->Enable(bEnable && m_pPageNumBox->GetState() == TRISTATE_TRUE); } } @@ -2132,8 +2168,8 @@ IMPL_LINK( SvxExtParagraphTabPage, PageBreakPosHdl_Impl, ListBox&, rListBox, voi m_pApplyCollBox->Enable(bEnable); if(!bHtmlMode) { - m_pPagenumText->Enable(bEnable); - m_pPagenumEdit->Enable(bEnable); + m_pPageNumBox->Enable(bEnable); + m_pPagenumEdit->Enable(bEnable && m_pPageNumBox->GetState() == TRISTATE_TRUE); } } else if ( 1 == rListBox.GetSelectEntryPos() ) @@ -2141,7 +2177,7 @@ IMPL_LINK( SvxExtParagraphTabPage, PageBreakPosHdl_Impl, ListBox&, rListBox, voi m_pApplyCollBtn->SetState( TRISTATE_FALSE ); m_pApplyCollBtn->Enable(false); m_pApplyCollBox->Enable(false); - m_pPagenumText->Enable(false); + m_pPageNumBox->Enable(false); m_pPagenumEdit->Enable(false); } } @@ -2155,13 +2191,18 @@ IMPL_LINK( SvxExtParagraphTabPage, PageBreakTypeHdl_Impl, ListBox&, rListBox, vo m_pApplyCollBtn->SetState( TRISTATE_FALSE ); m_pApplyCollBtn->Enable(false); m_pApplyCollBox->Enable(false); - m_pPagenumText->Enable(false); + m_pPageNumBox->Enable(false); m_pPagenumEdit->Enable(false); } else PageBreakPosHdl_Impl( *m_pBreakPositionLB ); } +IMPL_LINK_NOARG(SvxExtParagraphTabPage, PageNumBoxClickHdl_Impl, Button*, void) +{ + m_pPagenumEdit->Enable(m_pPageNumBox->GetState() == TRISTATE_TRUE); +} + void SvxExtParagraphTabPage::PageCreated(const SfxAllItemSet& aSet) { const SfxBoolItem* pDisablePageBreakItem = aSet.GetItem<SfxBoolItem>(SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK, false); diff --git a/cui/uiconfig/ui/textflowpage.ui b/cui/uiconfig/ui/textflowpage.ui index 6a0d14d78584..644fb3f47e52 100644 --- a/cui/uiconfig/ui/textflowpage.ui +++ b/cui/uiconfig/ui/textflowpage.ui @@ -18,6 +18,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="GtkGrid" id="TextFlowPage"> <property name="visible">True</property> @@ -250,13 +251,13 @@ </packing> </child> <child> - <object class="GtkLabel" id="labelPageNum"> + <object class="GtkCheckButton" id="labelPageNum"> <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="inconsistent">True</property> <property name="justify">right</property> - <property name="mnemonic_widget">spinPageNumber</property> <property name="xalign">1</property> </object> <packing> |