diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-11-30 16:50:00 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-11-30 17:44:34 +0100 |
commit | 47dd2c63f649828a833543e21d4eca5866ec9ebe (patch) | |
tree | 0b9a64485028cb9c7c0ffc52cad79033b2cb6209 /sw | |
parent | 6ddefb080b12f54f84a8de44347a9b1816972ad3 (diff) |
Rewrite uses of boost::optional
...to only use functions that are also available for std::optional (in
preparation for changing from boost::optional to std::optional):
* uses of get are replaced with operator * or operator ->
* uses of is_initialized are replaced with operator bool
* uses of reset with an argument are replace with operator =
(All of the replacements are also available for boost::optional "since forever",
so this change should not break builds against old --with-system-boost. An
alternative replacement for is_initialized would have been has_value, but that
is only available since Boost 1.68.)
Change-Id: I532687b6a5ee37dab28befb8e0eb05c22cbecf0f
Reviewed-on: https://gerrit.libreoffice.org/84124
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/crsr/findattr.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/frmedt/fews.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/inc/swfont.hxx | 8 | ||||
-rw-r--r-- | sw/source/core/layout/atrfrm.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/layout/flowfrm.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/layout/laycache.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/layout/newfrm.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/layout/pagechg.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/layout/trvlfrm.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/tox/tox.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxtablestyleexport.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8sty.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8graf.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlexpit.cxx | 4 | ||||
-rw-r--r-- | sw/source/ui/misc/titlepage.cxx | 4 | ||||
-rw-r--r-- | sw/source/ui/table/tabledlg.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/shells/textsh1.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/utlui/uitool.cxx | 2 |
20 files changed, 32 insertions, 32 deletions
diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx index 51518bccad35..3755a469dcf5 100644 --- a/sw/source/core/crsr/findattr.cxx +++ b/sw/source/core/crsr/findattr.cxx @@ -75,7 +75,7 @@ static bool CmpAttr( const SfxPoolItem& rItem1, const SfxPoolItem& rItem2 ) } else if (oNumOffset1 && oNumOffset2) { - bNumOffsetEqual = oNumOffset1.get() == oNumOffset2.get(); + bNumOffsetEqual = *oNumOffset1 == *oNumOffset2; } else { diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx index 9adc93bfbdd1..f6b338b78ca9 100644 --- a/sw/source/core/frmedt/fews.cxx +++ b/sw/source/core/frmedt/fews.cxx @@ -410,7 +410,7 @@ sal_uInt16 SwFEShell::GetPageOffset() const pFlow = pFlow->FindTabFrame(); ::boost::optional<sal_uInt16> oNumOffset = pFlow->GetPageDescItem().GetNumOffset(); if ( oNumOffset ) - return oNumOffset.get(); + return *oNumOffset; } pPage = static_cast<const SwPageFrame*>(pPage->GetPrev()); } diff --git a/sw/source/core/inc/swfont.hxx b/sw/source/core/inc/swfont.hxx index 3296d93bd226..fbec9f18a1c6 100644 --- a/sw/source/core/inc/swfont.hxx +++ b/sw/source/core/inc/swfont.hxx @@ -865,7 +865,7 @@ inline sal_uInt16 SwFont::GetTopBorderSpace() const sal_uInt16 nRet = 0; if( m_aTopBorder ) { - nRet += m_aTopBorder.get().GetScaledWidth() + m_nTopBorderDist; + nRet += m_aTopBorder->GetScaledWidth() + m_nTopBorderDist; } if( m_aShadowLocation == SvxShadowLocation::TopLeft || m_aShadowLocation == SvxShadowLocation::TopRight ) @@ -880,7 +880,7 @@ inline sal_uInt16 SwFont::GetBottomBorderSpace() const sal_uInt16 nRet = 0; if( m_aBottomBorder ) { - nRet += m_aBottomBorder.get().GetScaledWidth() + m_nBottomBorderDist; + nRet += m_aBottomBorder->GetScaledWidth() + m_nBottomBorderDist; } if( m_aShadowLocation == SvxShadowLocation::BottomLeft || m_aShadowLocation == SvxShadowLocation::BottomRight ) @@ -895,7 +895,7 @@ inline sal_uInt16 SwFont::GetRightBorderSpace() const sal_uInt16 nRet = 0; if( m_aRightBorder ) { - nRet += m_aRightBorder.get().GetScaledWidth() + m_nRightBorderDist; + nRet += m_aRightBorder->GetScaledWidth() + m_nRightBorderDist; } if( m_aShadowLocation == SvxShadowLocation::TopRight || m_aShadowLocation == SvxShadowLocation::BottomRight ) @@ -910,7 +910,7 @@ inline sal_uInt16 SwFont::GetLeftBorderSpace() const sal_uInt16 nRet = 0; if( m_aLeftBorder ) { - nRet += m_aLeftBorder.get().GetScaledWidth() + m_nLeftBorderDist; + nRet += m_aLeftBorder->GetScaledWidth() + m_nLeftBorderDist; } if( m_aShadowLocation == SvxShadowLocation::TopLeft || m_aShadowLocation == SvxShadowLocation::BottomLeft ) diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 3f54d259ec2f..25de2a9b90d1 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -703,7 +703,7 @@ bool SwFormatPageDesc::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const ::boost::optional<sal_uInt16> oOffset = GetNumOffset(); if (oOffset) { - rVal <<= static_cast<sal_Int16>(oOffset.get()); + rVal <<= static_cast<sal_Int16>(*oOffset); } else { diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index 3226d3b89ed2..8c1bada4012d 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -863,7 +863,7 @@ bool SwFrame::WrongPageDesc( SwPageFrame* pNew ) else if( !pDesc->GetLeftFormat() ) nTmp = 1; else if( rFormatDesc.GetNumOffset() ) - nTmp = rFormatDesc.GetNumOffset().get(); + nTmp = *rFormatDesc.GetNumOffset(); } } diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx index 423d63699fc9..30b32d3a8ccf 100644 --- a/sw/source/core/layout/laycache.cxx +++ b/sw/source/core/layout/laycache.cxx @@ -670,7 +670,7 @@ bool SwLayHelper::CheckInsertPage() } bool bNextPageOdd = !mrpPage->OnRightPage(); bool bInsertEmpty = false; - if( oPgNum && bNextPageOdd != ( ( oPgNum.get() % 2 ) != 0 ) ) + if( oPgNum && bNextPageOdd != ( ( *oPgNum % 2 ) != 0 ) ) { bNextPageOdd = !bNextPageOdd; bInsertEmpty = true; diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx index f53cc95412a6..90bb47890d99 100644 --- a/sw/source/core/layout/newfrm.cxx +++ b/sw/source/core/layout/newfrm.cxx @@ -487,7 +487,7 @@ void SwRootFrame::Init( SwFrameFormat* pFormat ) if ( !pDesc ) pDesc = &pDoc->GetPageDesc( 0 ); - const bool bOdd = !oPgNum || 0 != ( oPgNum.get() % 2 ); + const bool bOdd = !oPgNum || 0 != ( *oPgNum % 2 ); const bool bFirst = true; // Even page numbers are supposed to be printed as left pages. So if a // page number has been explicitly set for this first page, then we must diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index a2b70fb68e81..6d1df44ddd59 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -1304,7 +1304,7 @@ SwPageFrame *SwFrame::InsertPage( SwPageFrame *pPrevPage, bool bFootnote ) if ( rDesc.GetNumOffset() ) { ::boost::optional<sal_uInt16> oNumOffset = rDesc.GetNumOffset(); - bWishedOdd = oNumOffset && (oNumOffset.get() % 2) != 0; + bWishedOdd = oNumOffset && (*oNumOffset % 2) != 0; // use the opportunity to set the flag at root pRoot->SetVirtPageNum( true ); } diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index 369207a36221..7dc15c10e6a5 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -1743,7 +1743,7 @@ bool SwFrame::WannaRightPage() const OSL_ENSURE( pDesc, "No pagedescriptor" ); bool bOdd; if( oPgNum ) - bOdd = (oPgNum.get() % 2) != 0; + bOdd = (*oPgNum % 2) != 0; else { bOdd = pPage->OnRightPage(); @@ -1849,7 +1849,7 @@ sal_uInt16 SwFrame::GetVirtPageNum() const ::boost::optional<sal_uInt16> oNumOffset = pFrame->GetPageDescItem().GetNumOffset(); if (oNumOffset) { - return nPhyPage - pFrame->GetPhyPageNum() + oNumOffset.get(); + return nPhyPage - pFrame->GetPhyPageNum() + *oNumOffset; } else { diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx index c3167246fa2c..9d698bf0b8a1 100644 --- a/sw/source/core/tox/tox.cxx +++ b/sw/source/core/tox/tox.cxx @@ -912,7 +912,7 @@ SwFormTokensHelper::SwFormTokensHelper(const OUString & rPattern) boost::optional<SwFormToken> const oToken( lcl_BuildToken(rPattern, nCurPatternPos)); if (oToken) - m_Tokens.push_back(oToken.get()); + m_Tokens.push_back(*oToken); } } diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 9e4f6769a6d4..113d26170423 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -6328,7 +6328,7 @@ void DocxAttributeOutput::SectionPageNumbering( sal_uInt16 nNumType, const ::boo // boost::none 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() ) ); + pAttr->add( FSNS( XML_w, XML_start ), OString::number( *oPageRestartNumber ) ); // nNumType corresponds to w:fmt. See WW8Export::GetNumId() for more precisions OString aFormat( impl_NumberingType( nNumType ) ); diff --git a/sw/source/filter/ww8/docxtablestyleexport.cxx b/sw/source/filter/ww8/docxtablestyleexport.cxx index b67151ed204b..6ffa14325bf5 100644 --- a/sw/source/filter/ww8/docxtablestyleexport.cxx +++ b/sw/source/filter/ww8/docxtablestyleexport.cxx @@ -542,10 +542,10 @@ void DocxTableStyleExport::Impl::tableStyleTablePr( } if (oTableStyleRowBandSize) m_pSerializer->singleElementNS(XML_w, XML_tblStyleRowBandSize, FSNS(XML_w, XML_val), - OString::number(oTableStyleRowBandSize.get())); + OString::number(*oTableStyleRowBandSize)); if (oTableStyleColBandSize) m_pSerializer->singleElementNS(XML_w, XML_tblStyleColBandSize, FSNS(XML_w, XML_val), - OString::number(oTableStyleColBandSize.get())); + OString::number(*oTableStyleColBandSize)); tableStyleTableInd(aTableInd); tableStyleTcBorders(aTableBorders, XML_tblBorders); tableStyleTableCellMar(aTableCellMar); diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 42a125c099b2..8306c202a311 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -1297,7 +1297,7 @@ void RtfAttributeOutput::SectionPageNumbering( if (oPageRestartNumber) { m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_PGNSTARTS); - m_aSectionBreaks.append(static_cast<sal_Int32>(oPageRestartNumber.get())); + m_aSectionBreaks.append(static_cast<sal_Int32>(*oPageRestartNumber)); m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_PGNRESTART); } @@ -3385,7 +3385,7 @@ void RtfAttributeOutput::FormatBackground(const SvxBrushItem& rBrush) void RtfAttributeOutput::FormatFillStyle(const XFillStyleItem& rFillStyle) { - m_oFillStyle.reset(rFillStyle.GetValue()); + m_oFillStyle = rFillStyle.GetValue(); } void RtfAttributeOutput::FormatFillGradient(const XFillGradientItem& rFillGradient) diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 7a9b8e1c3450..ed4f15cde1a6 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -1437,7 +1437,7 @@ void WW8AttributeOutput::SectionPageNumbering( sal_uInt16 nNumType, const ::boos // sprmSPgnStart SwWW8Writer::InsUInt16( *m_rWW8Export.pO, NS_sprm::sprmSPgnStart97 ); - SwWW8Writer::InsUInt16( *m_rWW8Export.pO, oPageRestartNumber.get() ); + SwWW8Writer::InsUInt16( *m_rWW8Export.pO, *oPageRestartNumber ); } } diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index b780e3ac6c66..4f46c66e1fed 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -1926,7 +1926,7 @@ void SwWW8ImplReader::AdjustLRWrapForWordMargins( sal_uInt32 nXRelTo = SvxMSDffImportRec::RELTO_DEFAULT; if ( rRecord.nXRelTo ) { - nXRelTo = rRecord.nXRelTo.get(); + nXRelTo = *rRecord.nXRelTo; } // Left adjustments - if horizontally aligned to left of @@ -1964,7 +1964,7 @@ void SwWW8ImplReader::AdjustULWrapForWordMargins( sal_uInt32 nYRelTo = SvxMSDffImportRec::RELTO_DEFAULT; if ( rRecord.nYRelTo ) { - nYRelTo = rRecord.nYRelTo.get(); + nYRelTo = *rRecord.nYRelTo; } // Top adjustment - remove upper wrapping if aligned to page @@ -2283,7 +2283,7 @@ RndStdIds SwWW8ImplReader::ProcessEscherAlign(SvxMSDffImportRec* pRecord, // if X and Y Rel values are on default take it as a hint, that they have not been set // by <SwMSDffManager::ProcessObj(..)> - const bool bXYRelHaveDefaultValues = pRecord->nXRelTo.get() == 2 && pRecord->nYRelTo.get() == 2; + const bool bXYRelHaveDefaultValues = *pRecord->nXRelTo == 2 && *pRecord->nYRelTo == 2; if ( bXYRelHaveDefaultValues && m_nInTable > 0 && !bCurSectionVertical ) @@ -2295,8 +2295,8 @@ RndStdIds SwWW8ImplReader::ProcessEscherAlign(SvxMSDffImportRec* pRecord, } } - sal_uInt32 nXRelTo = (pRecord->nXRelTo && nCntRelTo > pRecord->nXRelTo) ? pRecord->nXRelTo.get() : 1; - sal_uInt32 nYRelTo = (pRecord->nYRelTo && nCntRelTo > pRecord->nYRelTo) ? pRecord->nYRelTo.get() : 1; + sal_uInt32 nXRelTo = (pRecord->nXRelTo && nCntRelTo > pRecord->nXRelTo) ? *pRecord->nXRelTo : 1; + sal_uInt32 nYRelTo = (pRecord->nYRelTo && nCntRelTo > pRecord->nYRelTo) ? *pRecord->nYRelTo : 1; RndStdIds eAnchor = IsInlineEscherHack() ? RndStdIds::FLY_AS_CHAR : RndStdIds::FLY_AT_CHAR; // #i43718# diff --git a/sw/source/filter/xml/xmlexpit.cxx b/sw/source/filter/xml/xmlexpit.cxx index 7c1b29df5aa1..ef7ce5bcd668 100644 --- a/sw/source/filter/xml/xmlexpit.cxx +++ b/sw/source/filter/xml/xmlexpit.cxx @@ -987,10 +987,10 @@ bool SvXMLExportItemMapper::QueryXMLValue( if( MID_PAGEDESC_PAGENUMOFFSET==nMemberId ) { ::boost::optional<sal_uInt16> oNumOffset = rPageDesc.GetNumOffset(); - if (oNumOffset && oNumOffset.get() > 0) + if (oNumOffset && *oNumOffset > 0) { // #i114163# positiveInteger only! - sal_Int32 const number(oNumOffset.get()); + sal_Int32 const number(*oNumOffset); aOut.append(number); } else diff --git a/sw/source/ui/misc/titlepage.cxx b/sw/source/ui/misc/titlepage.cxx index 5ae2c30ed62b..b000026ec775 100644 --- a/sw/source/ui/misc/titlepage.cxx +++ b/sw/source/ui/misc/titlepage.cxx @@ -39,7 +39,7 @@ namespace { ::boost::optional<sal_uInt16> oNumOffset = static_cast<const SwFormatPageDesc *>(pItem)->GetNumOffset(); if (oNumOffset) - rPageNo = oNumOffset.get(); + rPageNo = *oNumOffset; if (ppPageFormatDesc) ppPageFormatDesc->reset(static_cast<const SwFormatPageDesc *>(pItem->Clone())); bRet = true; @@ -71,7 +71,7 @@ namespace ::boost::optional<sal_uInt16> oNumOffset = pPageFormatDesc->GetNumOffset(); if (oNumOffset) { - nPgNo = oNumOffset.get(); + nPgNo = *oNumOffset; } else { diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx index 4d126dcdfc81..51ccdfbfe83a 100644 --- a/sw/source/ui/table/tabledlg.cxx +++ b/sw/source/ui/table/tabledlg.cxx @@ -1459,7 +1459,7 @@ void SwTextFlowPage::Reset( const SfxItemSet* rSet ) { m_xPageNoCB->set_active(true); m_xPageNoNF->set_sensitive(true); - m_xPageNoNF->set_value(oNumOffset.get()); + m_xPageNoNF->set_value(*oNumOffset); } else { diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 1b048c9d16b7..d6857e8156c1 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -656,7 +656,7 @@ void SwTextShell::Execute(SfxRequest &rReq) if (oPageNumber) { bIsNumberFilled = true; - nPageNumber = oPageNumber.get(); + nPageNumber = *oPageNumber; } rReq.AppendItem( SfxInt16Item ( FN_INSERT_BREAK_DLG, nKind ) ); diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx index cc0385748950..9e8434e82466 100644 --- a/sw/source/uibase/utlui/uitool.cxx +++ b/sw/source/uibase/utlui/uitool.cxx @@ -696,7 +696,7 @@ void SwToSfxPageDescAttr( SfxItemSet& rCoreSet ) if (oNumOffset) { - SfxUInt16Item aPageNum( SID_ATTR_PARA_PAGENUM, oNumOffset.get() ); + SfxUInt16Item aPageNum( SID_ATTR_PARA_PAGENUM, *oNumOffset ); rCoreSet.Put( aPageNum ); } |