summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-11-30 17:48:32 +0100
committerStephan Bergmann <sbergman@redhat.com>2019-12-01 14:57:16 +0100
commit7e403195e574be5174815a51cf5c42f06f76a87a (patch)
treec6147bcac095cd387f06dee63a25e15db6ca84c6 /editeng
parent7b3190eda387bcd897095205732f6752dedf01ef (diff)
Introduce o3tl::optional as an alias for std::optional
...with a boost::optional fallback for Xcode < 10 (as std::optional is only available starting with Xcode 10 according to <https://en.cppreference.com/w/cpp/compiler_support>, and our baseline for iOS and macOS is still Xcode 9.3 according to README.md). And mechanically rewrite all code to use o3tl::optional instead of boost::optional. One immediate benefit is that disabling -Wmaybe-uninitialized for GCC as per fed7c3deb3f4ec81f78967c2d7f3c4554398cb9d "Slience bogus -Werror=maybe-uninitialized" should no longer be necessary (and whose check happened to no longer trigger for GCC 10 trunk, even though that compiler would still emit bogus -Wmaybe-uninitialized for uses of boost::optional under --enable-optimized, which made me ponder whether this switch from boost::optional to std::optional would be a useful thing to do; I keep that configure.ac check for now, though, and will only remove it in a follow up commit). Another longer-term benefit is that the code is now already in good shape for an eventual switch to std::optional (a switch we would have done anyway once we no longer need to support Xcode < 10). Only desktop/qa/desktop_lib/test_desktop_lib.cxx heavily uses boost::property_tree::ptree::get_child_optional returning boost::optional, so let it keep using boost::optional for now. After a number of preceding commits have paved the way for this change, this commit is completely mechanical, done with > git ls-files -z | grep -vz -e '^bin/find-unneeded-includes$' -e '^configure.ac$' -e '^desktop/qa/desktop_lib/test_desktop_lib.cxx$' -e '^dictionaries$' -e '^external/' -e '^helpcontent2$' -e '^include/IwyuFilter_include.yaml$' -e '^sc/IwyuFilter_sc.yaml$' -e '^solenv/gdb/boost/optional.py$' -e '^solenv/vs/LibreOffice.natvis$' -e '^translations$' -e '\.svg$' | xargs -0 sed -i -E -e 's|\<boost(/optional)?/optional\.hpp\>|o3tl/optional.hxx|g' -e 's/\<boost(\s*)::(\s*)(make_)?optional\>/o3tl\1::\2\3optional/g' -e 's/\<boost(\s*)::(\s*)none\>/o3tl\1::\2nullopt/g' (before committing include/o3tl/optional.hxx, and relying on some GNU features). It excludes some files where mention of boost::optional et al should apparently not be changed (and the sub-repo directory stubs). It turned out that all uses of boost::none across the code base were in combination with boost::optional, so had all to be rewritten as o3tl::nullopt. Change-Id: Ibfd9f4b3d5a8aee6e6eed310b988c4e5ffd8b11b Reviewed-on: https://gerrit.libreoffice.org/84128 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/inc/editattr.hxx10
-rw-r--r--editeng/inc/pch/precompiled_editeng.hxx2
-rw-r--r--editeng/qa/unit/core-test.cxx2
-rw-r--r--editeng/source/editeng/editeng.cxx2
-rw-r--r--editeng/source/editeng/impedit.hxx4
-rw-r--r--editeng/source/misc/svxacorr.cxx10
-rw-r--r--editeng/source/outliner/outleeng.cxx2
-rw-r--r--editeng/source/outliner/outleeng.hxx2
-rw-r--r--editeng/source/outliner/outliner.cxx2
-rw-r--r--editeng/source/uno/unoedprx.cxx2
-rw-r--r--editeng/source/uno/unofored.cxx2
-rw-r--r--editeng/source/uno/unoforou.cxx2
-rw-r--r--editeng/source/uno/unotext.cxx6
13 files changed, 24 insertions, 24 deletions
diff --git a/editeng/inc/editattr.hxx b/editeng/inc/editattr.hxx
index 2b74427f6619..99faa6ecaf9d 100644
--- a/editeng/inc/editattr.hxx
+++ b/editeng/inc/editattr.hxx
@@ -22,7 +22,7 @@
#include <editeng/eeitem.hxx>
#include <svl/poolitem.hxx>
-#include <boost/optional.hpp>
+#include <o3tl/optional.hxx>
#include <tools/color.hxx>
#include <tools/debug.hxx>
@@ -364,8 +364,8 @@ public:
class EditCharAttribField: public EditCharAttrib
{
OUString aFieldValue;
- boost::optional<Color> mxTxtColor;
- boost::optional<Color> mxFldColor;
+ o3tl::optional<Color> mxTxtColor;
+ o3tl::optional<Color> mxFldColor;
EditCharAttribField& operator = ( const EditCharAttribField& rAttr ) = delete;
@@ -379,8 +379,8 @@ public:
{ return !(operator == ( rAttr ) ); }
virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override;
- boost::optional<Color>& GetTextColor() { return mxTxtColor; }
- boost::optional<Color>& GetFieldColor() { return mxFldColor; }
+ o3tl::optional<Color>& GetTextColor() { return mxTxtColor; }
+ o3tl::optional<Color>& GetFieldColor() { return mxFldColor; }
const OUString& GetFieldValue() const { return aFieldValue;}
void SetFieldValue(const OUString& rVal);
diff --git a/editeng/inc/pch/precompiled_editeng.hxx b/editeng/inc/pch/precompiled_editeng.hxx
index fb6950330079..391feb2b9a66 100644
--- a/editeng/inc/pch/precompiled_editeng.hxx
+++ b/editeng/inc/pch/precompiled_editeng.hxx
@@ -49,7 +49,7 @@
#include <unordered_map>
#include <utility>
#include <vector>
-#include <boost/optional.hpp>
+#include <o3tl/optional.hxx>
#endif // PCH_LEVEL >= 1
#if PCH_LEVEL >= 2
#include <osl/diagnose.h>
diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx
index e832dffd39d6..d5fb5482f111 100644
--- a/editeng/qa/unit/core-test.cxx
+++ b/editeng/qa/unit/core-test.cxx
@@ -813,7 +813,7 @@ class UrlEditEngine : public EditEngine
public:
explicit UrlEditEngine(SfxItemPool *pPool) : EditEngine(pPool) {}
- virtual OUString CalcFieldValue( const SvxFieldItem&, sal_Int32, sal_Int32, boost::optional<Color>&, boost::optional<Color>& ) override
+ virtual OUString CalcFieldValue( const SvxFieldItem&, sal_Int32, sal_Int32, o3tl::optional<Color>&, o3tl::optional<Color>& ) override
{
return "jim@bob.com"; // a sophisticated view of value:
}
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index e7faf821f0ee..2cf4d88a9e6d 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -2577,7 +2577,7 @@ tools::Rectangle EditEngine::GetBulletArea( sal_Int32 )
return tools::Rectangle( Point(), Point() );
}
-OUString EditEngine::CalcFieldValue( const SvxFieldItem&, sal_Int32, sal_Int32, boost::optional<Color>&, boost::optional<Color>& )
+OUString EditEngine::CalcFieldValue( const SvxFieldItem&, sal_Int32, sal_Int32, o3tl::optional<Color>&, o3tl::optional<Color>& )
{
return OUString(' ');
}
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 5d3db66f5e18..ee0fe7948034 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -61,7 +61,7 @@
#include <o3tl/deleter.hxx>
#include <o3tl/typed_flags_set.hxx>
-#include <boost/optional.hpp>
+#include <o3tl/optional.hxx>
#include <memory>
#include <vector>
@@ -238,7 +238,7 @@ private:
EditEngine* pEditEngine;
VclPtr<vcl::Window> pOutWin;
EditView::OutWindowSet aOutWindowSet;
- boost::optional<PointerStyle> mxPointer;
+ o3tl::optional<PointerStyle> mxPointer;
std::unique_ptr<DragAndDropInfo> pDragAndDropInfo;
css::uno::Reference< css::datatransfer::dnd::XDragSourceListener > mxDnDListener;
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 7e4273203183..cad718e86f6a 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -2514,7 +2514,7 @@ bool SvxAutoCorrectLanguageLists::MakeCombinedChanges( std::vector<SvxAutocorrWo
{
for (SvxAutocorrWord & aWordToDelete : aDeleteEntries)
{
- boost::optional<SvxAutocorrWord> xFoundEntry = pAutocorr_List->FindAndRemove( &aWordToDelete );
+ o3tl::optional<SvxAutocorrWord> xFoundEntry = pAutocorr_List->FindAndRemove( &aWordToDelete );
if( xFoundEntry )
{
if( !xFoundEntry->IsTextOnly() )
@@ -2537,7 +2537,7 @@ bool SvxAutoCorrectLanguageLists::MakeCombinedChanges( std::vector<SvxAutocorrWo
for (const SvxAutocorrWord & aNewEntrie : aNewEntries)
{
SvxAutocorrWord aWordToAdd(aNewEntrie.GetShort(), aNewEntrie.GetLong(), true );
- boost::optional<SvxAutocorrWord> xRemoved = pAutocorr_List->FindAndRemove( &aWordToAdd );
+ o3tl::optional<SvxAutocorrWord> xRemoved = pAutocorr_List->FindAndRemove( &aWordToAdd );
if( xRemoved )
{
if( !xRemoved->IsTextOnly() )
@@ -2583,7 +2583,7 @@ bool SvxAutoCorrectLanguageLists::PutText( const OUString& rShort, const OUStrin
if( bRet )
{
SvxAutocorrWord aNew(rShort, rLong, true );
- boost::optional<SvxAutocorrWord> xRemove = pAutocorr_List->FindAndRemove( &aNew );
+ o3tl::optional<SvxAutocorrWord> xRemove = pAutocorr_List->FindAndRemove( &aNew );
if( xRemove )
{
if( !xRemove->IsTextOnly() )
@@ -2719,7 +2719,7 @@ bool SvxAutocorrWordList::empty() const
return mpImpl->maHash.empty() && mpImpl->maSortedVector.empty();
}
-boost::optional<SvxAutocorrWord> SvxAutocorrWordList::FindAndRemove(const SvxAutocorrWord *pWord)
+o3tl::optional<SvxAutocorrWord> SvxAutocorrWordList::FindAndRemove(const SvxAutocorrWord *pWord)
{
if ( mpImpl->maSortedVector.empty() ) // use the hash
@@ -2742,7 +2742,7 @@ boost::optional<SvxAutocorrWord> SvxAutocorrWordList::FindAndRemove(const SvxAut
return pMatch;
}
}
- return boost::optional<SvxAutocorrWord>();
+ return o3tl::optional<SvxAutocorrWord>();
}
// return the sorted contents - defer sorting until we have to.
diff --git a/editeng/source/outliner/outleeng.cxx b/editeng/source/outliner/outleeng.cxx
index eb9881e89efd..fe122a91fb0a 100644
--- a/editeng/source/outliner/outleeng.cxx
+++ b/editeng/source/outliner/outleeng.cxx
@@ -169,7 +169,7 @@ void OutlinerEditEng::DrawingTab( const Point& rStartPos, long nWidth, const OUS
bEndOfLine, bEndOfParagraph, rOverlineColor, rTextLineColor );
}
-OUString OutlinerEditEng::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, boost::optional<Color>& rpTxtColor, boost::optional<Color>& rpFldColor )
+OUString OutlinerEditEng::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, o3tl::optional<Color>& rpTxtColor, o3tl::optional<Color>& rpFldColor )
{
return pOwner->CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor );
}
diff --git a/editeng/source/outliner/outleeng.hxx b/editeng/source/outliner/outleeng.hxx
index 5110d8be28ef..46970c75d9db 100644
--- a/editeng/source/outliner/outleeng.hxx
+++ b/editeng/source/outliner/outleeng.hxx
@@ -71,7 +71,7 @@ public:
// for text conversion
virtual bool ConvertNextDocument() override;
- virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, boost::optional<Color>& rTxtColor, boost::optional<Color>& rFldColor ) override;
+ virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, o3tl::optional<Color>& rTxtColor, o3tl::optional<Color>& rFldColor ) override;
virtual tools::Rectangle GetBulletArea( sal_Int32 nPara ) override;
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index 16a3833eeea2..71b3cf56ce1a 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -648,7 +648,7 @@ void Outliner::AddText( const OutlinerParaObject& rPObj, bool bAppend )
pEditEngine->SetUpdateMode( bUpdate );
}
-OUString Outliner::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, boost::optional<Color>& rpTxtColor, boost::optional<Color>& rpFldColor )
+OUString Outliner::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, o3tl::optional<Color>& rpTxtColor, o3tl::optional<Color>& rpFldColor )
{
if ( !aCalcFieldValueHdl.IsSet() )
return OUString( ' ' );
diff --git a/editeng/source/uno/unoedprx.cxx b/editeng/source/uno/unoedprx.cxx
index c7ac1bc3786b..a56404cc0805 100644
--- a/editeng/source/uno/unoedprx.cxx
+++ b/editeng/source/uno/unoedprx.cxx
@@ -618,7 +618,7 @@ SfxItemPool* SvxAccessibleTextAdapter::GetPool() const
return mpTextForwarder->GetPool();
}
-OUString SvxAccessibleTextAdapter::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, boost::optional<Color>& rpTxtColor, boost::optional<Color>& rpFldColor )
+OUString SvxAccessibleTextAdapter::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, o3tl::optional<Color>& rpTxtColor, o3tl::optional<Color>& rpFldColor )
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
diff --git a/editeng/source/uno/unofored.cxx b/editeng/source/uno/unofored.cxx
index 73a49039fa3d..fb1236632dde 100644
--- a/editeng/source/uno/unofored.cxx
+++ b/editeng/source/uno/unofored.cxx
@@ -153,7 +153,7 @@ bool SvxEditEngineForwarder::IsValid() const
return rEditEngine.GetUpdateMode();
}
-OUString SvxEditEngineForwarder::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, boost::optional<Color>& rpTxtColor, boost::optional<Color>& rpFldColor )
+OUString SvxEditEngineForwarder::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, o3tl::optional<Color>& rpTxtColor, o3tl::optional<Color>& rpFldColor )
{
return rEditEngine.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor );
}
diff --git a/editeng/source/uno/unoforou.cxx b/editeng/source/uno/unoforou.cxx
index b9abddf04455..9fb555470456 100644
--- a/editeng/source/uno/unoforou.cxx
+++ b/editeng/source/uno/unoforou.cxx
@@ -220,7 +220,7 @@ void SvxOutlinerForwarder::QuickSetAttribs( const SfxItemSet& rSet, const ESelec
rOutliner.QuickSetAttribs( rSet, rSel );
}
-OUString SvxOutlinerForwarder::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, boost::optional<Color>& rpTxtColor, boost::optional<Color>& rpFldColor )
+OUString SvxOutlinerForwarder::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, o3tl::optional<Color>& rpTxtColor, o3tl::optional<Color>& rpFldColor )
{
return rOutliner.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor );
}
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index e0ffbfe82a20..25d2b70c3098 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -634,8 +634,8 @@ void SvxUnoTextRangeBase::getPropertyValue( const SfxItemPropertySimpleEntry* pM
uno::Reference< text::XTextRange > xAnchor( this );
// get presentation string for field
- boost::optional<Color> pTColor;
- boost::optional<Color> pFColor;
+ o3tl::optional<Color> pTColor;
+ o3tl::optional<Color> pFColor;
SvxTextForwarder* pForwarder = mpEditSource->GetTextForwarder();
OUString aPresentation( pForwarder->CalcFieldValue( SvxFieldItem(*pData, EE_FEATURE_FIELD), maSelection.nStartPara, maSelection.nStartPos, pTColor, pFColor ) );
@@ -2359,7 +2359,7 @@ void SvxDummyTextSource::QuickInsertLineBreak( const ESelection& )
{
};
-OUString SvxDummyTextSource::CalcFieldValue( const SvxFieldItem&, sal_Int32, sal_Int32, boost::optional<Color>&, boost::optional<Color>& )
+OUString SvxDummyTextSource::CalcFieldValue( const SvxFieldItem&, sal_Int32, sal_Int32, o3tl::optional<Color>&, o3tl::optional<Color>& )
{
return OUString();
}