sw/inc/fmtpdsc.hxx | 7 ++- sw/inc/swabstdlg.hxx | 7 ++- sw/qa/extras/ooxmlexport/data/fdo44689_start_page_0.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 9 ++++ sw/source/core/crsr/findattr.cxx | 25 ++++++++++-- sw/source/core/fields/docufld.cxx | 2 - sw/source/core/frmedt/fedesc.cxx | 6 +-- sw/source/core/frmedt/fews.cxx | 6 +-- sw/source/core/layout/atrfrm.cxx | 20 +++++++--- sw/source/core/layout/flowfrm.cxx | 2 - sw/source/core/layout/laycache.cxx | 14 +++++-- sw/source/core/layout/newfrm.cxx | 14 ++++--- sw/source/core/layout/pagechg.cxx | 3 + sw/source/core/layout/trvlfrm.cxx | 21 +++++++--- sw/source/filter/ww8/attributeoutputbase.hxx | 4 +- sw/source/filter/ww8/docxattributeoutput.cxx | 8 ++-- sw/source/filter/ww8/docxattributeoutput.hxx | 3 - sw/source/filter/ww8/rtfattributeoutput.cxx | 6 +-- sw/source/filter/ww8/rtfattributeoutput.hxx | 3 - sw/source/filter/ww8/rtfexport.cxx | 2 - sw/source/filter/ww8/wrtw8sty.cxx | 13 +++--- sw/source/filter/ww8/wrtww8.hxx | 9 ++-- sw/source/filter/ww8/ww8attributeoutput.hxx | 3 - sw/source/filter/xml/xmlexpit.cxx | 12 +++--- sw/source/ui/app/appenv.cxx | 2 - sw/source/ui/chrdlg/break.cxx | 8 +++- sw/source/ui/dialog/swdlgfact.cxx | 2 - sw/source/ui/dialog/swdlgfact.hxx | 8 ++-- sw/source/ui/inc/break.hxx | 7 ++- sw/source/ui/inc/wrtsh.hxx | 3 + sw/source/ui/misc/titlepage.cxx | 30 +++++++++++++-- sw/source/ui/shells/textsh1.cxx | 27 ++++++++++--- sw/source/ui/table/tabledlg.cxx | 9 ++++ sw/source/ui/utlui/uitool.cxx | 12 ++++-- sw/source/ui/wrtsh/wrtsh1.cxx | 4 +- sw/uiconfig/swriter/ui/insertbreak.ui | 2 - 36 files changed, 216 insertions(+), 97 deletions(-)
New commits: commit c2ccd20c0fd92bddfff76447754541705e3eb8f3 Author: Adam Co <[email protected]> Date: Thu Aug 29 17:16:44 2013 +0300 fdo#44689: fix for specific case of page restart-value 0 This bug fix is for roundtripping a DOCX that has a specific 'start value' for the page numbers. In most cases LO imports it ok. However - until now - Word allowed you to start page number from 0, while LO only allowed starting page numbers from 1. This was because the 'start value' was stored in an 'unsigned int', and the value '0' was used to mark 'there is no start value'. This patch changes the way the 'start value' is stored from 'unsigned int' to 'optional unsigned int'. This way - if there is no value applied - the variable will hold NULL. However - if a value is set - it can be 0 or more. This meant also tweaking all the places that used to get this value, so that now they handle an 'optional uint', instead of a 'uint'. Conflicts: sw/source/ui/inc/break.hxx sw/source/ui/inc/wrtsh.hxx sw/source/ui/shells/textsh1.cxx sw/source/ui/utlui/uitool.cxx sw/source/ui/wrtsh/wrtsh1.cxx Change-Id: I6ad9d90e03b42c58eed2271477df43c20ad6f20a Reviewed-on: https://gerrit.libreoffice.org/5681 diff --git a/sw/inc/fmtpdsc.hxx b/sw/inc/fmtpdsc.hxx index b522aeb..e89f31f 100644 --- a/sw/inc/fmtpdsc.hxx +++ b/sw/inc/fmtpdsc.hxx @@ -25,6 +25,7 @@ #include <hintids.hxx> #include <format.hxx> #include <calbck.hxx> +#include <boost/optional.hpp> class SwPageDesc; class SwHistory; @@ -41,7 +42,7 @@ class SW_DLLPUBLIC SwFmtPageDesc : public SfxPoolItem, public SwClient to set the auto-flag after copying!! */ friend sal_Bool InsAttr( SwDoc*, const SwPaM &, const SfxItemSet&, sal_uInt16, SwHistory* ); - sal_uInt16 nNumOffset; ///< Offset page number. + ::boost::optional<sal_uInt16> oNumOffset; ///< Offset page number. sal_uInt16 nDescNameIdx; ///< SW3-Reader: stringpool-index of style name. SwModify* pDefinedIn; /**< Points to the object in which the attribute was set (CntntNode/Format). */ @@ -71,8 +72,8 @@ public: SwPageDesc *GetPageDesc() { return (SwPageDesc*)GetRegisteredIn(); } const SwPageDesc *GetPageDesc() const { return (SwPageDesc*)GetRegisteredIn(); } - sal_uInt16 GetNumOffset() const { return nNumOffset; } - void SetNumOffset( sal_uInt16 nNum ) { nNumOffset = nNum; } + ::boost::optional<sal_uInt16> GetNumOffset() const { return oNumOffset; } + void SetNumOffset( ::boost::optional<sal_uInt16> oNum ) { oNumOffset = oNum; } /// Query / set where attribute is anchored. inline const SwModify* GetDefinedIn() const { return pDefinedIn; } diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index f5ed3bf..32d1d37 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -34,6 +34,7 @@ #include <com/sun/star/awt/XControl.hpp> #include <com/sun/star/container/XNamed.hpp> #include "itabenum.hxx" +#include <boost/optional.hpp> class SfxViewFrame; class SfxBindings; @@ -205,9 +206,9 @@ public: class AbstractSwBreakDlg : public VclAbstractDialog { public: - virtual OUString GetTemplateName() = 0; - virtual sal_uInt16 GetKind() = 0; - virtual sal_uInt16 GetPageNumber() = 0; + virtual OUString GetTemplateName() = 0; + virtual sal_uInt16 GetKind() = 0; + virtual ::boost::optional<sal_uInt16> GetPageNumber() = 0; }; diff --git a/sw/qa/extras/ooxmlexport/data/fdo44689_start_page_0.docx b/sw/qa/extras/ooxmlexport/data/fdo44689_start_page_0.docx new file mode 100644 index 0000000..f7e9331 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo44689_start_page_0.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 64e4c06..867c76d 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -110,6 +110,7 @@ public: void testParaShadow(); void testTableFloating(); void testTableFloatingMargins(); + void testFdo44689_start_page_0(); void testFdo44689_start_page_7(); void testFdo67737(); void testTransparentShadow(); @@ -229,6 +230,7 @@ void Test::run() {"para-shadow.docx", &Test::testParaShadow}, {"table-floating.docx", &Test::testTableFloating}, {"table-floating-margins.docx", &Test::testTableFloatingMargins}, + {"fdo44689_start_page_0.docx", &Test::testFdo44689_start_page_0}, {"fdo44689_start_page_7.docx", &Test::testFdo44689_start_page_7}, {"fdo67737.docx", &Test::testFdo67737}, {"transparent-shadow.docx", &Test::testTransparentShadow}, @@ -1242,6 +1244,13 @@ void Test::testTableFloatingMargins() assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:pict/v:rect/v:textbox/w:txbxContent/w:tbl/w:tr[1]/w:tc[1]/w:p/w:pPr/w:spacing", "after", "0"); } +void Test::testFdo44689_start_page_0() +{ + // The problem was that the import & export process did not analyze the 'start from page' attribute of a section + uno::Reference<beans::XPropertySet> xPara(getParagraph(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty<sal_Int16>(xPara, "PageNumberOffset")); +} + void Test::testFdo44689_start_page_7() { // The problem was that the import & export process did not analyze the 'start from page' attribute of a section diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx index 006e210..7aef37b 100644 --- a/sw/source/core/crsr/findattr.cxx +++ b/sw/source/core/crsr/findattr.cxx @@ -40,6 +40,7 @@ #include <pamtyp.hxx> #include <swundo.hxx> #include <crsskip.hxx> +#include <boost/optional.hpp> using namespace ::com::sun::star; using namespace ::com::sun::star::lang; @@ -60,10 +61,26 @@ int CmpAttr( const SfxPoolItem& rItem1, const SfxPoolItem& rItem2 ) return ((SvxColorItem&)rItem1).GetValue().IsRGBEqual( ((SvxColorItem&)rItem2).GetValue() ); case RES_PAGEDESC: - return ((SwFmtPageDesc&)rItem1).GetNumOffset() == - ((SwFmtPageDesc&)rItem2).GetNumOffset() && - ((SwFmtPageDesc&)rItem1).GetPageDesc() == - ((SwFmtPageDesc&)rItem2).GetPageDesc(); + bool bNumOffsetEqual = false; + ::boost::optional<sal_uInt16> oNumOffset1 = ((SwFmtPageDesc&)rItem1).GetNumOffset(); + ::boost::optional<sal_uInt16> oNumOffset2 = ((SwFmtPageDesc&)rItem1).GetNumOffset(); + if (!oNumOffset1 && !oNumOffset2) + { + bNumOffsetEqual = true; + } + else if (oNumOffset1 && oNumOffset2) + { + bNumOffsetEqual = oNumOffset1.get() == oNumOffset2.get(); + } + else + { + bNumOffsetEqual = false; + } + + if (bNumOffsetEqual == false) + return false; + + return ((SwFmtPageDesc&)rItem1).GetPageDesc() == ((SwFmtPageDesc&)rItem2).GetPageDesc(); } return rItem1 == rItem2; } diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index 33b80da..3967351 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -115,7 +115,7 @@ OUString SwPageNumberFieldType::Expand( sal_uInt32 nFmt, short nOff, sal_uInt32 nTmpFmt = (SVX_NUM_PAGEDESC == nFmt) ? (sal_uInt32)nNumberingType : nFmt; int const nTmp = nPageNumber + nOff; - if (0 >= nTmp || SVX_NUM_NUMBER_NONE == nTmpFmt || (!bVirtuell && nTmp > nMaxPage)) + if (0 > nTmp || SVX_NUM_NUMBER_NONE == nTmpFmt || (!bVirtuell && nTmp > nMaxPage)) return OUString(); if( SVX_NUM_CHAR_SPECIAL == nTmpFmt ) diff --git a/sw/source/core/frmedt/fedesc.cxx b/sw/source/core/frmedt/fedesc.cxx index 23750cc..32bebf4 100644 --- a/sw/source/core/frmedt/fedesc.cxx +++ b/sw/source/core/frmedt/fedesc.cxx @@ -65,7 +65,7 @@ void SwFEShell::ChgCurPageDesc( const SwPageDesc& rDesc ) SwPageFrm *pPage = GetCurrFrm()->FindPageFrm(); const SwFrm *pFlow = 0; - sal_uInt16 nPageNmOffset = 0; + ::boost::optional<sal_uInt16> oPageNumOffset; OSL_ENSURE( !GetCrsr()->HasMark(), "ChgCurPageDesc only without selection!"); @@ -81,7 +81,7 @@ void SwFEShell::ChgCurPageDesc( const SwPageDesc& rDesc ) if( rPgDesc.GetPageDesc() ) { // wir haben ihn den Schlingel - nPageNmOffset = rPgDesc.GetNumOffset(); + oPageNumOffset = rPgDesc.GetNumOffset(); break; } } @@ -101,7 +101,7 @@ void SwFEShell::ChgCurPageDesc( const SwPageDesc& rDesc ) // use pagenumber SwFmtPageDesc aNew( &rDesc ); - aNew.SetNumOffset( nPageNmOffset ); + aNew.SetNumOffset( oPageNumOffset ); if ( pFlow->IsInTab() ) GetDoc()->SetAttr( aNew, *(SwFmt*)pFlow->FindTabFrm()->GetFmt() ); diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx index 8f884de..4d24122 100644 --- a/sw/source/core/frmedt/fews.cxx +++ b/sw/source/core/frmedt/fews.cxx @@ -427,9 +427,9 @@ sal_uInt16 SwFEShell::GetPageOffset() const { if ( pFlow->IsInTab() ) pFlow = pFlow->FindTabFrm(); - const sal_uInt16 nOffset = pFlow->GetAttrSet()->GetPageDesc().GetNumOffset(); - if ( nOffset ) - return nOffset; + ::boost::optional<sal_uInt16> oNumOffset = pFlow->GetAttrSet()->GetPageDesc().GetNumOffset(); + if ( oNumOffset ) + return oNumOffset.get(); } pPage = (SwPageFrm*)pPage->GetPrev(); } diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 8433959..e5b1ac6 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -550,7 +550,7 @@ SfxPoolItem* SwFmtCntnt::Clone( SfxItemPool* ) const SwFmtPageDesc::SwFmtPageDesc( const SwFmtPageDesc &rCpy ) : SfxPoolItem( RES_PAGEDESC ), SwClient( (SwPageDesc*)rCpy.GetPageDesc() ), - nNumOffset( rCpy.nNumOffset ), + oNumOffset( rCpy.oNumOffset ), nDescNameIdx( rCpy.nDescNameIdx ), pDefinedIn( 0 ) { @@ -559,7 +559,7 @@ SwFmtPageDesc::SwFmtPageDesc( const SwFmtPageDesc &rCpy ) SwFmtPageDesc::SwFmtPageDesc( const SwPageDesc *pDesc ) : SfxPoolItem( RES_PAGEDESC ), SwClient( (SwPageDesc*)pDesc ), - nNumOffset( 0 ), + oNumOffset( boost::none ), nDescNameIdx( 0xFFFF ), // IDX_NO_VALUE pDefinedIn( 0 ) { @@ -569,7 +569,7 @@ SwFmtPageDesc &SwFmtPageDesc::operator=(const SwFmtPageDesc &rCpy) { if (rCpy.GetPageDesc()) RegisterToPageDesc(*const_cast<SwPageDesc*>(rCpy.GetPageDesc())); - nNumOffset = rCpy.nNumOffset; + oNumOffset = rCpy.oNumOffset; nDescNameIdx = rCpy.nDescNameIdx; pDefinedIn = 0; @@ -587,7 +587,7 @@ int SwFmtPageDesc::operator==( const SfxPoolItem& rAttr ) const { OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" ); return ( pDefinedIn == ((SwFmtPageDesc&)rAttr).pDefinedIn ) && - ( nNumOffset == ((SwFmtPageDesc&)rAttr).nNumOffset ) && + ( oNumOffset == ((SwFmtPageDesc&)rAttr).oNumOffset ) && ( GetPageDesc() == ((SwFmtPageDesc&)rAttr).GetPageDesc() ); } @@ -668,7 +668,17 @@ bool SwFmtPageDesc::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const switch ( nMemberId ) { case MID_PAGEDESC_PAGENUMOFFSET: - rVal <<= (sal_Int16)GetNumOffset(); + { + ::boost::optional<sal_uInt16> oOffset = GetNumOffset(); + if (oOffset) + { + rVal <<= (sal_Int16)oOffset.get(); + } + else + { + rVal.clear(); + } + } break; case MID_PAGEDESC_PAGEDESCNAME: diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index e54c17c..68f9464 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -897,7 +897,7 @@ sal_Bool SwFrm::WrongPageDesc( SwPageFrm* pNew ) else if( !pDesc->GetLeftFmt() ) nTmp = 1; else if( rFmtDesc.GetNumOffset() ) - nTmp = rFmtDesc.GetNumOffset(); + nTmp = rFmtDesc.GetNumOffset().get(); } } diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx index ebd9e72..5a525763 100644 --- a/sw/source/core/layout/laycache.cxx +++ b/sw/source/core/layout/laycache.cxx @@ -621,17 +621,25 @@ bool SwLayHelper::CheckInsertPage() if ( bBrk || pDesc ) { - sal_uInt16 nPgNum = 0; + ::boost::optional<sal_uInt16> oPgNum; if ( !pDesc ) + { pDesc = rpPage->GetPageDesc()->GetFollow(); + + SwFmtPageDesc rFollowDesc( pDesc ); + oPgNum = rFollowDesc.GetNumOffset(); + if ( oPgNum ) + ((SwRootFrm*)rpPage->GetUpper())->SetVirtPageNum(sal_True); + } else { - if ( 0 != (nPgNum = rDesc.GetNumOffset()) ) + oPgNum = rDesc.GetNumOffset(); + if ( oPgNum ) ((SwRootFrm*)rpPage->GetUpper())->SetVirtPageNum(sal_True); } bool bNextPageOdd = !rpPage->OnRightPage(); bool bInsertEmpty = false; - if( nPgNum && bNextPageOdd != ( ( nPgNum % 2 ) != 0 ) ) + if( oPgNum && bNextPageOdd != ( ( oPgNum.get() % 2 ) != 0 ) ) { bNextPageOdd = !bNextPageOdd; bInsertEmpty = true; diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx index c246dbb..960fec7 100644 --- a/sw/source/core/layout/newfrm.cxx +++ b/sw/source/core/layout/newfrm.cxx @@ -524,28 +524,32 @@ void SwRootFrm::Init( SwFrmFmt* pFmt ) // Get hold of PageDesc (either via FrmFmt of the first node or the initial one). SwPageDesc *pDesc = 0; - sal_uInt16 nPgNum = 1; + ::boost::optional<sal_uInt16> oPgNum; if ( pTblNd ) { const SwFmtPageDesc &rDesc = pTblNd->GetTable().GetFrmFmt()->GetPageDesc(); pDesc = (SwPageDesc*)rDesc.GetPageDesc(); //#19104# respect the page number offset!! - bIsVirtPageNum = 0 != ( nPgNum = rDesc.GetNumOffset() ); + oPgNum = rDesc.GetNumOffset(); + if (oPgNum) + bIsVirtPageNum = true; } else if ( pNode ) { const SwFmtPageDesc &rDesc = pNode->GetSwAttrSet().GetPageDesc(); pDesc = (SwPageDesc*)rDesc.GetPageDesc(); //#19104# respect the page number offset!! - bIsVirtPageNum = 0 != ( nPgNum = rDesc.GetNumOffset() ); + oPgNum = rDesc.GetNumOffset(); + if (oPgNum) + bIsVirtPageNum = true; } else bIsVirtPageNum = sal_False; if ( !pDesc ) pDesc = &pDoc->GetPageDesc( 0 ); - const bool bOdd = !nPgNum || 0 != ( nPgNum % 2 ); - bool bFirst = !nPgNum || 1 == nPgNum; + const bool bOdd = !oPgNum || 0 != ( oPgNum.get() % 2 ); + bool bFirst = !oPgNum || 1 == oPgNum.get(); // Create a page and put it in the layout SwPageFrm *pPage = ::InsertNewPage( *pDesc, this, bOdd, bFirst, false, sal_False, 0 ); diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index a231fd1..533b2fb 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -1277,7 +1277,8 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, sal_Bool bFtn ) pDesc = rDesc.GetPageDesc(); if ( rDesc.GetNumOffset() ) { - bWishedOdd = rDesc.GetNumOffset() % 2 ? true : false; + ::boost::optional<sal_uInt16> oNumOffset = rDesc.GetNumOffset(); + bWishedOdd = (oNumOffset ? oNumOffset.get() : 0) % 2 ? true : false; //Die Gelegenheit nutzen wir um das Flag an der Root zu pflegen. pRoot->SetVirtPageNum( sal_True ); } diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index 9b9205e..14eb645 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -1731,7 +1731,7 @@ sal_Bool SwFrm::WannaRightPage() const const SwFrm *pFlow = pPage->FindFirstBodyCntnt(); const SwPageDesc *pDesc = 0; - sal_uInt16 nPgNum = 0; + ::boost::optional<sal_uInt16> oPgNum; if ( pFlow ) { if ( pFlow->IsInTab() ) @@ -1741,7 +1741,7 @@ sal_Bool SwFrm::WannaRightPage() const { const SwFmtPageDesc& rPgDesc = pFlow->GetAttrSet()->GetPageDesc(); pDesc = rPgDesc.GetPageDesc(); - nPgNum = rPgDesc.GetNumOffset(); + oPgNum = rPgDesc.GetNumOffset(); } } if ( !pDesc ) @@ -1759,8 +1759,8 @@ sal_Bool SwFrm::WannaRightPage() const } OSL_ENSURE( pDesc, "No pagedescriptor" ); sal_Bool bOdd; - if( nPgNum ) - bOdd = (nPgNum % 2) ? sal_True : sal_False; + if( oPgNum ) + bOdd = (oPgNum.get() % 2) ? sal_True : sal_False; else { bOdd = pPage->OnRightPage(); @@ -1839,8 +1839,17 @@ sal_uInt16 SwFrm::GetVirtPageNum() const } } if ( pFrm ) - return nPhyPage - pFrm->GetPhyPageNum() + - pFrm->GetAttrSet()->GetPageDesc().GetNumOffset(); + { + ::boost::optional<sal_uInt16> oNumOffset = pFrm->GetAttrSet()->GetPageDesc().GetNumOffset(); + if (oNumOffset) + { + return nPhyPage - pFrm->GetPhyPageNum() + oNumOffset.get(); + } + else + { + return nPhyPage - pFrm->GetPhyPageNum(); + } + } return nPhyPage; } diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx index a528d28..75e847a 100644 --- a/sw/source/filter/ww8/attributeoutputbase.hxx +++ b/sw/source/filter/ww8/attributeoutputbase.hxx @@ -26,6 +26,7 @@ #include <rtl/textenc.h> #include <editeng/svxenum.hxx> #include <tools/solar.h> +#include <boost/optional.hpp> #include <swtypes.hxx> #include <wrtswtbl.hxx> @@ -315,8 +316,7 @@ public: /// The style of the page numbers. /// - /// nPageRestartNumberr being 0 means no restart. - virtual void SectionPageNumbering( sal_uInt16 nNumType, sal_uInt16 nPageRestartNumber ) = 0; + virtual void SectionPageNumbering( sal_uInt16 nNumType, ::boost::optional<sal_uInt16> oPageRestartNumber ) = 0; /// The type of breaking. virtual void SectionType( sal_uInt8 nBreakCode ) = 0; diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 53f15b2..f010a7c 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3905,15 +3905,15 @@ static OString impl_NumberingType( sal_uInt16 nNumberingType ) return aType; } -void DocxAttributeOutput::SectionPageNumbering( sal_uInt16 nNumType, sal_uInt16 nPageRestartNumber ) +void DocxAttributeOutput::SectionPageNumbering( sal_uInt16 nNumType, ::boost::optional<sal_uInt16> oPageRestartNumber ) { // FIXME Not called properly with page styles like "First Page" FastAttributeList* pAttr = m_pSerializer->createAttrList(); - // 0 means no restart: then don't output that attribute if 0 - if ( nPageRestartNumber > 0 ) - pAttr->add( FSNS( XML_w, XML_start ), OString::number( nPageRestartNumber ) ); + // -1 means no restart: then don't output that attribute if it is negative + if ( oPageRestartNumber ) + pAttr->add( FSNS( XML_w, XML_start ), OString::number( oPageRestartNumber.get() ) ); // nNumType corresponds to w:fmt. See WW8Export::GetNumId() for more precisions OString aFmt( impl_NumberingType( nNumType ) ); diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx index 29dec70..5e8f90f 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -272,8 +272,7 @@ public: /// The style of the page numbers. /// - /// nPageRestartNumberr being 0 means no restart. - virtual void SectionPageNumbering( sal_uInt16 nNumType, sal_uInt16 nPageRestartNumber ); + virtual void SectionPageNumbering( sal_uInt16 nNumType, ::boost::optional<sal_uInt16> oPageRestartNumber ); /// The type of breaking. virtual void SectionType( sal_uInt8 nBreakCode ); diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index a0ce1d7..1b466e6 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -1233,14 +1233,14 @@ void RtfAttributeOutput::SectionBiDi( bool bBiDi ) m_rExport.Strm() << (bBiDi ? OOO_STRING_SVTOOLS_RTF_RTLSECT : OOO_STRING_SVTOOLS_RTF_LTRSECT); } -void RtfAttributeOutput::SectionPageNumbering( sal_uInt16 nNumType, sal_uInt16 nPageRestartNumber ) +void RtfAttributeOutput::SectionPageNumbering( sal_uInt16 nNumType, ::boost::optional<sal_uInt16> oPageRestartNumber ) { SAL_INFO("sw.rtf", OSL_THIS_FUNC); - if (nPageRestartNumber > 0) + if ( oPageRestartNumber ) { m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_PGNSTARTS); - m_aSectionBreaks.append((sal_Int32)nPageRestartNumber); + m_aSectionBreaks.append((sal_Int32)oPageRestartNumber.get()); m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_PGNRESTART); } diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx index 0ec6cbf..5bbded2 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.hxx +++ b/sw/source/filter/ww8/rtfattributeoutput.hxx @@ -181,8 +181,7 @@ public: /// The style of the page numbers. /// - /// nPageRestartNumberr being 0 means no restart. - virtual void SectionPageNumbering( sal_uInt16 nNumType, sal_uInt16 nPageRestartNumber ); + virtual void SectionPageNumbering( sal_uInt16 nNumType, ::boost::optional<sal_uInt16> oPageRestartNumber ); /// The type of breaking. virtual void SectionType( sal_uInt8 nBreakCode ); diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index 58e6bc7..92f0d02 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -1112,7 +1112,7 @@ void RtfExport::OutPageDescription( const SwPageDesc& rPgDsc, bool bWriteReset, } // numbering type - AttrOutput().SectionPageNumbering(pAktPageDesc->GetNumType().GetNumberingType(), 0); + AttrOutput().SectionPageNumbering(pAktPageDesc->GetNumType().GetNumberingType(), boost::none); pAktPageDesc = pSave; SAL_INFO("sw.rtf", OSL_THIS_FUNC << " end"); diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 8d40b97..ede643b 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -1177,8 +1177,9 @@ void MSWordSections::AppendSection( const SwFmtPageDesc& rPD, if (HeaderFooterWritten()) { return; // #i117955# prevent new sections in endnotes } - WW8_SepInfo aI( rPD.GetPageDesc(), pSectionFmt, nLnNumRestartNo, - rPD.GetNumOffset(), &rNd ); + + WW8_SepInfo aI( rPD.GetPageDesc(), pSectionFmt, nLnNumRestartNo, rPD.GetNumOffset(), &rNd ); + aSects.push_back( aI ); NeedsDocumentProtected( aI ); } @@ -1502,7 +1503,7 @@ void WW8AttributeOutput::SectionBiDi( bool bBiDi ) } } -void WW8AttributeOutput::SectionPageNumbering( sal_uInt16 nNumType, sal_uInt16 nPageRestartNumber ) +void WW8AttributeOutput::SectionPageNumbering( sal_uInt16 nNumType, ::boost::optional<sal_uInt16> oPageRestartNumber ) { // sprmSNfcPgn sal_uInt8 nb = WW8Export::GetNumId( nNumType ); @@ -1512,7 +1513,7 @@ void WW8AttributeOutput::SectionPageNumbering( sal_uInt16 nNumType, sal_uInt16 n m_rWW8Export.pO->push_back( 147 ); m_rWW8Export.pO->push_back( nb ); - if ( nPageRestartNumber ) + if ( oPageRestartNumber ) { // sprmSFPgnRestart if ( m_rWW8Export.bWrtWW8 ) @@ -1526,7 +1527,7 @@ void WW8AttributeOutput::SectionPageNumbering( sal_uInt16 nNumType, sal_uInt16 n SwWW8Writer::InsUInt16( *m_rWW8Export.pO, NS_sprm::LN_SPgnStart ); else m_rWW8Export.pO->push_back( 161 ); - SwWW8Writer::InsUInt16( *m_rWW8Export.pO, nPageRestartNumber ); + SwWW8Writer::InsUInt16( *m_rWW8Export.pO, oPageRestartNumber.get() ); } } @@ -1793,7 +1794,7 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt pISet = pOldI; // then the rest of the settings from PageDesc - AttrOutput().SectionPageNumbering( pPd->GetNumType().GetNumberingType(), rSepInfo.nPgRestartNo ); + AttrOutput().SectionPageNumbering( pPd->GetNumType().GetNumberingType(), rSepInfo.oPgRestartNo ); // werden es nur linke oder nur rechte Seiten? if ( 2 == nBreakCode ) diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 87d2c1d..5506b4e 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -23,6 +23,7 @@ #include <tools/solar.h> // UINTXX #include <tools/gen.hxx> #include <editeng/editdata.hxx> +#include <boost/optional.hpp> #include <map> #include <vector> @@ -151,17 +152,17 @@ struct WW8_SepInfo const SwNode* pPDNd; const SwTxtNode* pNumNd; sal_uLong nLnNumRestartNo; - sal_uInt16 nPgRestartNo; + ::boost::optional<sal_uInt16> oPgRestartNo; WW8_SepInfo() - : pPageDesc(0), pSectionFmt(0), pPDNd(0), pNumNd(0), nLnNumRestartNo(0), nPgRestartNo(0) + : pPageDesc(0), pSectionFmt(0), pPDNd(0), pNumNd(0), nLnNumRestartNo(0), oPgRestartNo(boost::none) {} WW8_SepInfo( const SwPageDesc* pPD, const SwSectionFmt* pFmt, - sal_uLong nLnRestart, sal_uInt16 nPgRestart = 0, const SwNode* pNd = NULL ) + sal_uLong nLnRestart, ::boost::optional<sal_uInt16> oPgRestart = boost::none, const SwNode* pNd = NULL ) : pPageDesc( pPD ), pSectionFmt( pFmt ), pPDNd( pNd ), pNumNd( 0 ), - nLnNumRestartNo( nLnRestart ), nPgRestartNo( nPgRestart ) + nLnNumRestartNo( nLnRestart ), oPgRestartNo( oPgRestart ) {} bool IsProtected() const; diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx index d1f4c9b..81691cb 100644 --- a/sw/source/filter/ww8/ww8attributeoutput.hxx +++ b/sw/source/filter/ww8/ww8attributeoutput.hxx @@ -169,8 +169,7 @@ public: /// The style of the page numbers. /// - /// nPageRestartNumberr being 0 means no restart. - virtual void SectionPageNumbering( sal_uInt16 nNumType, sal_uInt16 nPageRestartNumber ); + virtual void SectionPageNumbering( sal_uInt16 nNumType, ::boost::optional<sal_uInt16> oPageRestartNumber ); /// The type of breaking. virtual void SectionType( sal_uInt8 nBreakCode ); diff --git a/sw/source/filter/xml/xmlexpit.cxx b/sw/source/filter/xml/xmlexpit.cxx index c6c5e3a..c215a7b 100644 --- a/sw/source/filter/xml/xmlexpit.cxx +++ b/sw/source/filter/xml/xmlexpit.cxx @@ -1004,14 +1004,16 @@ bool SvXMLExportItemMapper::QueryXMLValue( if( MID_PAGEDESC_PAGENUMOFFSET==nMemberId ) { - sal_Int32 const number(pPageDesc->GetNumOffset()); - if (0 >= number) + ::boost::optional<sal_uInt16> oNumOffset = pPageDesc->GetNumOffset(); + if (oNumOffset) { - aOut.append(GetXMLToken(XML_AUTO)); + // #i114163# positiveInteger only! + sal_Int32 const number(oNumOffset.get()); + ::sax::Converter::convertNumber(aOut, number); } - else // #i114163# positiveInteger only! + else { - ::sax::Converter::convertNumber(aOut, number); + aOut.append(GetXMLToken(XML_AUTO)); } bOk = true; } diff --git a/sw/source/ui/app/appenv.cxx b/sw/source/ui/app/appenv.cxx index 76a37ca..63b614a6 100644 --- a/sw/source/ui/app/appenv.cxx +++ b/sw/source/ui/app/appenv.cxx @@ -302,7 +302,7 @@ void SwModule::InsertEnv( SfxRequest& rReq ) pSh->SetTblAttr( aBreakSet ); } else - pSh->InsertPageBreak(0, sal_False); + pSh->InsertPageBreak(0, boost::none); pSh->SttEndDoc(sal_True); } else diff --git a/sw/source/ui/chrdlg/break.cxx b/sw/source/ui/chrdlg/break.cxx index fb0cd62..37fa66c 100644 --- a/sw/source/ui/chrdlg/break.cxx +++ b/sw/source/ui/chrdlg/break.cxx @@ -49,7 +49,11 @@ void SwBreakDlg::Apply() if(0 != nPos && LISTBOX_ENTRY_NOTFOUND != nPos) { aTemplate = m_pPageCollBox->GetSelectEntry(); - nPgNum = m_pPageNumBox->IsChecked() ? (sal_uInt16)m_pPageNumEdit->GetValue() : 0; + oPgNum = boost::none; + if (m_pPageNumBox->IsChecked()) + { + oPgNum = (sal_uInt16)m_pPageNumEdit->GetValue(); + } } } } @@ -129,7 +133,7 @@ SwBreakDlg::SwBreakDlg( Window *pParent, SwWrtShell &rS ) : SvxStandardDialog(pParent, "BreakDialog", "modules/swriter/ui/insertbreak.ui") , rSh(rS) , nKind(0) - , nPgNum(0) + , oPgNum(boost::none) , bHtmlMode(0 != ::GetHtmlMode(rS.GetView().GetDocShell())) { get(m_pLineBtn, "linerb"); diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index 32a4b9a..bfd44dd 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -218,7 +218,7 @@ sal_uInt16 AbstractSwBreakDlg_Impl:: GetKind() return pDlg->GetKind(); } -sal_uInt16 AbstractSwBreakDlg_Impl:: GetPageNumber() +::boost::optional<sal_uInt16> AbstractSwBreakDlg_Impl:: GetPageNumber() { return pDlg->GetPageNumber(); } diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index 8f3dd72..fc80b86 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -40,6 +40,8 @@ class SwSplitTblDlg; #include "itabenum.hxx" +#include <boost/optional.hpp> + namespace sw { class DropDownFieldDialog; @@ -105,9 +107,9 @@ class VclAbstractDialog_Impl : public VclAbstractDialog class AbstractSwBreakDlg_Impl : public AbstractSwBreakDlg { DECL_ABSTDLG_BASE(AbstractSwBreakDlg_Impl,SwBreakDlg) - virtual OUString GetTemplateName(); - virtual sal_uInt16 GetKind(); - virtual sal_uInt16 GetPageNumber(); + virtual OUString GetTemplateName(); + virtual sal_uInt16 GetKind(); + virtual ::boost::optional<sal_uInt16> GetPageNumber(); }; class AbstractSplitTableDialog_Impl : public AbstractSplitTableDialog // add for diff --git a/sw/source/ui/inc/break.hxx b/sw/source/ui/inc/break.hxx index 9c42785..98b0db8 100644 --- a/sw/source/ui/inc/break.hxx +++ b/sw/source/ui/inc/break.hxx @@ -1,3 +1,4 @@ + /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. @@ -29,6 +30,8 @@ #include <vcl/field.hxx> +#include <boost/optional.hpp> + class SwWrtShell; class SwBreakDlg: public SvxStandardDialog @@ -44,7 +47,7 @@ class SwBreakDlg: public SvxStandardDialog OUString aTemplate; sal_uInt16 nKind; - sal_uInt16 nPgNum; + ::boost::optional<sal_uInt16> oPgNum; sal_Bool bHtmlMode; @@ -64,7 +67,7 @@ public: OUString GetTemplateName() { return aTemplate; } sal_uInt16 GetKind() { return nKind; } - sal_uInt16 GetPageNumber() { return nPgNum; } + ::boost::optional<sal_uInt16> GetPageNumber() { return oPgNum; } }; #endif diff --git a/sw/source/ui/inc/wrtsh.hxx b/sw/source/ui/inc/wrtsh.hxx index 3c6f7a3..31d4f55 100644 --- a/sw/source/ui/inc/wrtsh.hxx +++ b/sw/source/ui/inc/wrtsh.hxx @@ -26,6 +26,7 @@ #include <swurl.hxx> #include <IMark.hxx> #include "navmgr.hxx" +#include <boost/optional.hpp> class Window; class SbxArray; @@ -294,7 +295,7 @@ typedef sal_Bool (SwWrtShell:: *FNSimpleMove)(); sal_Bool bRule = sal_False ); void InsertByWord( const OUString & ); - void InsertPageBreak(const OUString *pPageDesc = 0, sal_uInt16 nPgNum = 0 ); + void InsertPageBreak(const OUString *pPageDesc = 0, ::boost::optional<sal_uInt16> pPgNum = boost::none ); void InsertLineBreak(); void InsertColumnBreak(); void InsertFootnote(const OUString &, sal_Bool bEndNote = sal_False, sal_Bool bEdit = sal_True ); diff --git a/sw/source/ui/misc/titlepage.cxx b/sw/source/ui/misc/titlepage.cxx index bf75f3f..21f3b51 100644 --- a/sw/source/ui/misc/titlepage.cxx +++ b/sw/source/ui/misc/titlepage.cxx @@ -38,7 +38,9 @@ namespace const SfxPoolItem* pItem(0); if (SFX_ITEM_SET == aSet.GetItemState( RES_PAGEDESC, sal_True, &pItem ) && pItem) { - rPageNo = ((const SwFmtPageDesc *)pItem)->GetNumOffset(); + ::boost::optional<sal_uInt16> oNumOffset = ((const SwFmtPageDesc *)pItem)->GetNumOffset(); + if (oNumOffset) + rPageNo = oNumOffset.get(); if (ppPageFmtDesc) (*ppPageFmtDesc) = (const SwFmtPageDesc *)(pItem->Clone()); bRet = true; @@ -58,8 +60,30 @@ namespace lcl_GetPageDesc(pSh, nDontCare, &pPageFmtDesc); //If we want a new number then set it, otherwise reuse the existing one - sal_uInt16 nPgNo = nNewNumber ? - nNewNumber : ( pPageFmtDesc ? pPageFmtDesc->GetNumOffset() : 0 ); + sal_uInt16 nPgNo; + if (nNewNumber) + { + nPgNo = nNewNumber; + } + else + { + if (pPageFmtDesc) + { + ::boost::optional<sal_uInt16> oNumOffset = pPageFmtDesc->GetNumOffset(); + if (oNumOffset) + { + nPgNo = oNumOffset.get(); + } + else + { + nPgNo = 0; + } + } + else + { + nPgNo = 0; + } + } //If we want a new descriptior then set it, otherwise reuse the existing one if (!pNewDesc) diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx index d0b2fbc..5f7e8ae 100644 --- a/sw/source/ui/shells/textsh1.cxx +++ b/sw/source/ui/shells/textsh1.cxx @@ -525,17 +525,19 @@ void SwTextShell::Execute(SfxRequest &rReq) } case FN_INSERT_BREAK_DLG: { - sal_uInt16 nKind=0, nPageNumber=0; + sal_uInt16 nKind=0; + ::boost::optional<sal_uInt16> oPageNumber; OUString aTemplateName; if ( pItem ) { nKind = ((SfxInt16Item*)pItem)->GetValue(); SFX_REQUEST_ARG( rReq, pTemplate, SfxStringItem, FN_PARAM_1 , sal_False ); SFX_REQUEST_ARG( rReq, pNumber, SfxUInt16Item, FN_PARAM_2 , sal_False ); + SFX_REQUEST_ARG( rReq, pIsNumberFilled, SfxBoolItem, FN_PARAM_3, sal_False ); if ( pTemplate ) aTemplateName = pTemplate->GetValue(); - if ( pNumber ) - nPageNumber = pNumber->GetValue(); + if ( pNumber && pIsNumberFilled && pIsNumberFilled->GetValue() ) + oPageNumber = pNumber->GetValue(); } else { @@ -548,10 +550,21 @@ void SwTextShell::Execute(SfxRequest &rReq) { nKind = pDlg->GetKind(); aTemplateName = pDlg->GetTemplateName(); - nPageNumber = pDlg->GetPageNumber(); - rReq.AppendItem( SfxInt16Item( FN_INSERT_BREAK_DLG, nKind ) ); - rReq.AppendItem( SfxUInt16Item( FN_PARAM_2, nPageNumber ) ); + oPageNumber = pDlg->GetPageNumber(); + + sal_Bool bIsNumberFilled = sal_False; + sal_uInt16 nPageNumber = 0; + + if (oPageNumber) + { + bIsNumberFilled = sal_True; + nPageNumber = oPageNumber.get(); + } + + rReq.AppendItem( SfxInt16Item ( FN_INSERT_BREAK_DLG, nKind ) ); rReq.AppendItem( SfxStringItem( FN_PARAM_1, aTemplateName ) ); + rReq.AppendItem( SfxUInt16Item( FN_PARAM_2, nPageNumber ) ); + rReq.AppendItem( SfxBoolItem ( FN_PARAM_3, bIsNumberFilled ) ); rReq.Done(); } else @@ -569,7 +582,7 @@ void SwTextShell::Execute(SfxRequest &rReq) { rWrtSh.StartAllAction(); if( !aTemplateName.isEmpty() ) - rWrtSh.InsertPageBreak( &aTemplateName, nPageNumber ); + rWrtSh.InsertPageBreak( &aTemplateName, oPageNumber ); else rWrtSh.InsertPageBreak(); rWrtSh.EndAllAction(); diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx index 41fa3dc..4614e2b 100644 --- a/sw/source/ui/table/tabledlg.cxx +++ b/sw/source/ui/table/tabledlg.cxx @@ -1515,7 +1515,14 @@ void SwTextFlowPage::Reset( const SfxItemSet& rSet ) { OUString sPageDesc; const SwPageDesc* pDesc = ((const SwFmtPageDesc*)pItem)->GetPageDesc(); - m_pPageNoNF->SetValue(((const SwFmtPageDesc*)pItem)->GetNumOffset()); + + //m_pPageNoNF->SetValue(((const SwFmtPageDesc*)pItem)->GetNumOffset()); + ::boost::optional<sal_uInt16> oNumOffset = ((const SwFmtPageDesc*)pItem)->GetNumOffset(); + if (oNumOffset) + m_pPageNoNF->SetValue(oNumOffset.get()); + else + m_pPageNoNF->Enable(sal_False); + if(pDesc) sPageDesc = pDesc->GetName(); if ( !sPageDesc.isEmpty() && diff --git a/sw/source/ui/utlui/uitool.cxx b/sw/source/ui/utlui/uitool.cxx index 26281cf..e0c4a36 100644 --- a/sw/source/ui/utlui/uitool.cxx +++ b/sw/source/ui/utlui/uitool.cxx @@ -619,7 +619,7 @@ void SwToSfxPageDescAttr( SfxItemSet& rCoreSet ) { const SfxPoolItem* pItem = 0; OUString aName; - sal_uInt16 nPageNum = 0; + ::boost::optional<sal_uInt16> oNumOffset; bool bPut = true; switch( rCoreSet.GetItemState( RES_PAGEDESC, sal_True, &pItem ) ) { @@ -628,7 +628,7 @@ void SwToSfxPageDescAttr( SfxItemSet& rCoreSet ) if( ((SwFmtPageDesc*)pItem)->GetPageDesc() ) { aName = ((SwFmtPageDesc*)pItem)->GetPageDesc()->GetName(); - nPageNum = ((SwFmtPageDesc*)pItem)->GetNumOffset(); + oNumOffset = ((SwFmtPageDesc*)pItem)->GetNumOffset(); } rCoreSet.ClearItem( RES_PAGEDESC ); // Page number @@ -641,8 +641,12 @@ void SwToSfxPageDescAttr( SfxItemSet& rCoreSet ) default: bPut = false; } - SfxUInt16Item aPageNum( SID_ATTR_PARA_PAGENUM, nPageNum ); - rCoreSet.Put( aPageNum ); + + if (oNumOffset) + { + SfxUInt16Item aPageNum( SID_ATTR_PARA_PAGENUM, oNumOffset.get() ); + rCoreSet.Put( aPageNum ); + } if(bPut) rCoreSet.Put( SvxPageModelItem( aName, sal_True, SID_ATTR_PARA_MODEL ) ); diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx index e23fd4d..8b974bd 100644 --- a/sw/source/ui/wrtsh/wrtsh1.cxx +++ b/sw/source/ui/wrtsh/wrtsh1.cxx @@ -824,7 +824,7 @@ void SwWrtShell::ConnectObj( svt::EmbeddedObjectRef& xObj, const SwRect &rPrt, // Insert hard page break; // Selections will be overwritten -void SwWrtShell::InsertPageBreak(const OUString *pPageDesc, sal_uInt16 nPgNum ) +void SwWrtShell::InsertPageBreak(const OUString *pPageDesc, ::boost::optional<sal_uInt16> oPgNum ) { ResetCursorStack(); if( CanInsert() ) @@ -846,7 +846,7 @@ void SwWrtShell::InsertPageBreak(const OUString *pPageDesc, sal_uInt16 nPgNum ) if( pDesc ) { SwFmtPageDesc aDesc( pDesc ); - aDesc.SetNumOffset( nPgNum ); + aDesc.SetNumOffset( oPgNum ); SetAttr( aDesc ); } else diff --git a/sw/uiconfig/swriter/ui/insertbreak.ui b/sw/uiconfig/swriter/ui/insertbreak.ui index d9b5ec6..5efb573 100644 --- a/sw/uiconfig/swriter/ui/insertbreak.ui +++ b/sw/uiconfig/swriter/ui/insertbreak.ui @@ -2,7 +2,7 @@ <interface> <!-- interface-requires gtk+ 3.0 --> <object class="GtkAdjustment" id="adjustment1"> - <property name="lower">1</property> + <property name="lower">0</property> <property name="upper">9999</property> <property name="value">1</property> <property name="step_increment">1</property> _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
