summaryrefslogtreecommitdiff
path: root/svx
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 /svx
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 'svx')
-rw-r--r--svx/inc/pch/precompiled_svx.hxx2
-rw-r--r--svx/inc/pch/precompiled_svxcore.hxx2
-rw-r--r--svx/source/accessibility/AccessibleEmptyEditSource.cxx2
-rw-r--r--svx/source/dialog/ClassificationEditView.cxx2
-rw-r--r--svx/source/dialog/weldeditview.cxx8
-rw-r--r--svx/source/form/fmmodel.cxx4
-rw-r--r--svx/source/svdraw/svdedxv.cxx4
-rw-r--r--svx/source/svdraw/svdobj.cxx6
-rw-r--r--svx/source/svdraw/svdomeas.cxx2
-rw-r--r--svx/source/svdraw/svdotxfl.cxx2
-rw-r--r--svx/source/svdraw/svdoutl.cxx2
11 files changed, 18 insertions, 18 deletions
diff --git a/svx/inc/pch/precompiled_svx.hxx b/svx/inc/pch/precompiled_svx.hxx
index 0de6708d0827..3a99ad7ed9b3 100644
--- a/svx/inc/pch/precompiled_svx.hxx
+++ b/svx/inc/pch/precompiled_svx.hxx
@@ -41,7 +41,7 @@
#include <unordered_map>
#include <utility>
#include <vector>
-#include <boost/optional.hpp>
+#include <o3tl/optional.hxx>
#include <boost/property_tree/ptree.hpp>
#endif // PCH_LEVEL >= 1
#if PCH_LEVEL >= 2
diff --git a/svx/inc/pch/precompiled_svxcore.hxx b/svx/inc/pch/precompiled_svxcore.hxx
index ea9506e07fb9..a03b6f300169 100644
--- a/svx/inc/pch/precompiled_svxcore.hxx
+++ b/svx/inc/pch/precompiled_svxcore.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/svx/source/accessibility/AccessibleEmptyEditSource.cxx b/svx/source/accessibility/AccessibleEmptyEditSource.cxx
index a0a31d959183..297315a32bb7 100644
--- a/svx/source/accessibility/AccessibleEmptyEditSource.cxx
+++ b/svx/source/accessibility/AccessibleEmptyEditSource.cxx
@@ -121,7 +121,7 @@ namespace accessibility
//XTextCopy
void CopyText(const SvxTextForwarder& ) override {}
- OUString CalcFieldValue( const SvxFieldItem& /*rField*/, sal_Int32 /*nPara*/, sal_Int32 /*nPos*/, boost::optional<Color>& /*rpTxtColor*/, boost::optional<Color>& /*rpFldColor*/ ) override
+ OUString CalcFieldValue( const SvxFieldItem& /*rField*/, sal_Int32 /*nPara*/, sal_Int32 /*nPos*/, o3tl::optional<Color>& /*rpTxtColor*/, o3tl::optional<Color>& /*rpFldColor*/ ) override
{
return OUString();
}
diff --git a/svx/source/dialog/ClassificationEditView.cxx b/svx/source/dialog/ClassificationEditView.cxx
index bc2266626c35..6eba6e6f12d7 100644
--- a/svx/source/dialog/ClassificationEditView.cxx
+++ b/svx/source/dialog/ClassificationEditView.cxx
@@ -30,7 +30,7 @@ ClassificationEditEngine::ClassificationEditEngine(SfxItemPool* pItemPool)
{}
OUString ClassificationEditEngine::CalcFieldValue(const SvxFieldItem& rField, sal_Int32 /*nPara*/,
- sal_Int32 /*nPos*/, boost::optional<Color>& /*rTxtColor*/, boost::optional<Color>& /*rFldColor*/)
+ sal_Int32 /*nPos*/, o3tl::optional<Color>& /*rTxtColor*/, o3tl::optional<Color>& /*rFldColor*/)
{
OUString aString;
const ClassificationField* pClassificationField = dynamic_cast<const ClassificationField*>(rField.GetField());
diff --git a/svx/source/dialog/weldeditview.cxx b/svx/source/dialog/weldeditview.cxx
index 0d0173fc0be5..222a3db5747b 100644
--- a/svx/source/dialog/weldeditview.cxx
+++ b/svx/source/dialog/weldeditview.cxx
@@ -241,8 +241,8 @@ public:
virtual SfxItemPool* GetPool() const override;
virtual OUString CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos,
- boost::optional<Color>& rpTxtColor,
- boost::optional<Color>& rpFldColor) override;
+ o3tl::optional<Color>& rpTxtColor,
+ o3tl::optional<Color>& rpFldColor) override;
virtual void FieldClicked(const SvxFieldItem&) override;
virtual bool IsValid() const override;
@@ -905,8 +905,8 @@ bool WeldTextForwarder::IsValid() const
}
OUString WeldTextForwarder::CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara,
- sal_Int32 nPos, boost::optional<Color>& rpTxtColor,
- boost::optional<Color>& rpFldColor)
+ sal_Int32 nPos, o3tl::optional<Color>& rpTxtColor,
+ o3tl::optional<Color>& rpFldColor)
{
EditEngine* pEditEngine = m_rEditAcc.GetEditEngine();
return pEditEngine ? pEditEngine->CalcFieldValue(rField, nPara, nPos, rpTxtColor, rpFldColor)
diff --git a/svx/source/form/fmmodel.cxx b/svx/source/form/fmmodel.cxx
index 3791cb7a77d7..5942abfa6454 100644
--- a/svx/source/form/fmmodel.cxx
+++ b/svx/source/form/fmmodel.cxx
@@ -28,7 +28,7 @@
#include <sfx2/objsh.hxx>
-#include <boost/optional.hpp>
+#include <o3tl/optional.hxx>
using ::com::sun::star::uno::Reference;
using ::com::sun::star::container::XNameContainer;
@@ -39,7 +39,7 @@ struct FmFormModelImplData
{
rtl::Reference<FmXUndoEnvironment> mxUndoEnv;
bool bOpenInDesignIsDefaulted;
- boost::optional<bool> aControlsUseRefDevice;
+ o3tl::optional<bool> aControlsUseRefDevice;
FmFormModelImplData()
:bOpenInDesignIsDefaulted( true )
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index bafc02dc27db..f6861bdadee6 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -1012,8 +1012,8 @@ IMPL_LINK(SdrObjEditView, ImpOutlinerCalcFieldValueHdl, EditFieldInfo*, pFI, voi
SdrTextObj* pTextObj = mxTextEditObj.get();
if (pTextObj != nullptr)
{
- boost::optional<Color> pTxtCol;
- boost::optional<Color> pFldCol;
+ o3tl::optional<Color> pTxtCol;
+ o3tl::optional<Color> pFldCol;
bOk = pTextObj->CalcFieldValue(pFI->GetField(), pFI->GetPara(), pFI->GetPos(), true,
pTxtCol, pFldCol, rStr);
if (bOk)
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 3758426b974a..28fb05eae8c2 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -138,7 +138,7 @@
#include <unordered_set>
-#include <boost/optional.hpp>
+#include <o3tl/optional.hxx>
#include <libxml/xmlwriter.h>
#include <memory>
@@ -207,9 +207,9 @@ struct SdrObject::Impl
{
sdr::ObjectUserVector maObjectUsers;
- boost::optional<double> mnRelativeWidth;
+ o3tl::optional<double> mnRelativeWidth;
sal_Int16 meRelativeWidthRelation;
- boost::optional<double> mnRelativeHeight;
+ o3tl::optional<double> mnRelativeHeight;
sal_Int16 meRelativeHeightRelation;
std::shared_ptr<DiagramDataInterface> mpDiagramData;
diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx
index ca047cde59af..e950dc8f14e3 100644
--- a/svx/source/svdraw/svdomeas.cxx
+++ b/svx/source/svdraw/svdomeas.cxx
@@ -550,7 +550,7 @@ basegfx::B2DPolyPolygon SdrMeasureObj::ImpCalcXPoly(const ImpMeasurePoly& rPol)
bool SdrMeasureObj::CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos,
bool bEdit,
- boost::optional<Color>& rpTxtColor, boost::optional<Color>& rpFldColor, OUString& rRet) const
+ o3tl::optional<Color>& rpTxtColor, o3tl::optional<Color>& rpFldColor, OUString& rRet) const
{
const SvxFieldData* pField=rField.GetField();
const SdrMeasureField* pMeasureField=dynamic_cast<const SdrMeasureField*>( pField );
diff --git a/svx/source/svdraw/svdotxfl.cxx b/svx/source/svdraw/svdotxfl.cxx
index c8e82711b6a3..11fe15d6eedd 100644
--- a/svx/source/svdraw/svdotxfl.cxx
+++ b/svx/source/svdraw/svdotxfl.cxx
@@ -22,7 +22,7 @@
#include <svx/svdotext.hxx>
bool SdrTextObj::CalcFieldValue(const SvxFieldItem& /*rField*/, sal_Int32 /*nPara*/, sal_uInt16 /*nPos*/,
- bool /*bEdit*/, boost::optional<Color>& /*rpTxtColor*/, boost::optional<Color>& /*rpFldColor*/, OUString& /*rRet*/) const
+ bool /*bEdit*/, o3tl::optional<Color>& /*rpTxtColor*/, o3tl::optional<Color>& /*rpFldColor*/, OUString& /*rRet*/) const
{
return false;
}
diff --git a/svx/source/svdraw/svdoutl.cxx b/svx/source/svdraw/svdoutl.cxx
index 0387afaa5ec9..31fb093bedb2 100644
--- a/svx/source/svdraw/svdoutl.cxx
+++ b/svx/source/svdraw/svdoutl.cxx
@@ -72,7 +72,7 @@ void SdrOutliner::SetTextObjNoInit( const SdrTextObj* pObj )
}
OUString SdrOutliner::CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos,
- boost::optional<Color>& rpTxtColor, boost::optional<Color>& rpFldColor)
+ o3tl::optional<Color>& rpTxtColor, o3tl::optional<Color>& rpFldColor)
{
bool bOk = false;
OUString aRet;