From c2ccd20c0fd92bddfff76447754541705e3eb8f3 Mon Sep 17 00:00:00 2001 From: Adam Co Date: Thu, 29 Aug 2013 17:16:44 +0300 Subject: 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 --- sw/inc/fmtpdsc.hxx | 7 ++++--- sw/inc/swabstdlg.hxx | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'sw/inc') diff --git a/sw/inc/fmtpdsc.hxx b/sw/inc/fmtpdsc.hxx index b522aebc482b..e89f31fa38b6 100644 --- a/sw/inc/fmtpdsc.hxx +++ b/sw/inc/fmtpdsc.hxx @@ -25,6 +25,7 @@ #include #include #include +#include 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 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 GetNumOffset() const { return oNumOffset; } + void SetNumOffset( ::boost::optional 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 f5ed3bf60cf3..32d1d37f0b15 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -34,6 +34,7 @@ #include #include #include "itabenum.hxx" +#include 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 GetPageNumber() = 0; }; -- cgit