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 /sfx2 | |
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 'sfx2')
-rw-r--r-- | sfx2/source/dialog/dinfdlg.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/doc/SfxDocumentMetaData.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/sidebar/SidebarController.cxx | 18 | ||||
-rw-r--r-- | sfx2/source/view/viewfrm.cxx | 2 |
4 files changed, 18 insertions, 18 deletions
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 1abf3e3d3d91..b6f1398f13d1 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -1591,10 +1591,10 @@ void CustomPropertiesWindow::StoreCustomProperties() aTmpTime.GetSec(), aTmpTime.GetMin(), aTmpTime.GetHour(), aTmpDate.GetDay(), aTmpDate.GetMonth(), aTmpDate.GetYear(), pLine->m_xTimeField->m_isUTC); - if (pLine->m_xDateField->m_TZ.is_initialized()) + if (pLine->m_xDateField->m_TZ) { m_aCustomProperties[nDataModelPos + i]->m_aValue <<= util::DateTimeWithTimezone( - aDateTime, pLine->m_xDateField->m_TZ.get()); + aDateTime, *pLine->m_xDateField->m_TZ); } else { @@ -1606,10 +1606,10 @@ void CustomPropertiesWindow::StoreCustomProperties() Date aTmpDate = pLine->m_xDateField->get_date(); util::Date const aDate(aTmpDate.GetDay(), aTmpDate.GetMonth(), aTmpDate.GetYear()); - if (pLine->m_xDateField->m_TZ.is_initialized()) + if (pLine->m_xDateField->m_TZ) { m_aCustomProperties[nDataModelPos + i]->m_aValue <<= util::DateWithTimezone( - aDate, pLine->m_xDateField->m_TZ.get()); + aDate, *pLine->m_xDateField->m_TZ); } else { diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index 8e6bf6f29c39..b8f0b04818bc 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -1191,15 +1191,15 @@ void SfxDocumentMetaData::init( boost::optional<sal_Int16> nTimeZone; if (textToDateOrDateTime(d, dt, isDateTime, nTimeZone, text)) { if (isDateTime) { - if (nTimeZone.is_initialized()) { + if (nTimeZone) { any <<= css::util::DateTimeWithTimezone(dt, - nTimeZone.get()); + *nTimeZone); } else { any <<= dt; } } else { - if (nTimeZone.is_initialized()) { - any <<= css::util::DateWithTimezone(d, nTimeZone.get()); + if (nTimeZone) { + any <<= css::util::DateWithTimezone(d, *nTimeZone); } else { any <<= d; } diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 794cfef82b81..9214c651f3a6 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -473,11 +473,11 @@ void SidebarController::ProcessNewWidth (const sal_Int32 nNewWidth) if ( ! mbIsDeckRequestedOpen) return; - if (mbIsDeckRequestedOpen.get()) + if (*mbIsDeckRequestedOpen) { // Deck became large enough to be shown. Show it. mnSavedSidebarWidth = nNewWidth; - if (!mbIsDeckOpen.get()) + if (!*mbIsDeckOpen) RequestOpenDeck(); } else @@ -1237,12 +1237,12 @@ bool SidebarController::IsDeckOpen(const sal_Int32 nIndex) OUString asDeckId(mpTabBar->GetDeckIdForIndex(nIndex)); return IsDeckVisible(asDeckId); } - return mbIsDeckOpen && mbIsDeckOpen.get(); + return mbIsDeckOpen && *mbIsDeckOpen; } bool SidebarController::IsDeckVisible(const OUString& rsDeckId) { - return mbIsDeckOpen && mbIsDeckOpen.get() && msCurrentDeckId == rsDeckId; + return mbIsDeckOpen && *mbIsDeckOpen && msCurrentDeckId == rsDeckId; } void SidebarController::UpdateDeckOpenState() @@ -1255,10 +1255,10 @@ void SidebarController::UpdateDeckOpenState() // Update (change) the open state when it either has not yet been initialized // or when its value differs from the requested state. - if ( mbIsDeckOpen && mbIsDeckOpen.get() == mbIsDeckRequestedOpen.get() ) + if ( mbIsDeckOpen && *mbIsDeckOpen == *mbIsDeckRequestedOpen ) return; - if (mbIsDeckRequestedOpen.get()) + if (*mbIsDeckRequestedOpen) { if (!mpParentWindow->IsFloatingMode()) { @@ -1336,9 +1336,9 @@ void SidebarController::UpdateDeckOpenState() mpParentWindow->SetStyle(mpParentWindow->GetStyle() & ~WB_SIZEABLE); } - mbIsDeckOpen = mbIsDeckRequestedOpen.get(); - if (mbIsDeckOpen.get() && mpCurrentDeck) - mpCurrentDeck->Show(mbIsDeckOpen.get()); + mbIsDeckOpen = *mbIsDeckRequestedOpen; + if (*mbIsDeckOpen && mpCurrentDeck) + mpCurrentDeck->Show(*mbIsDeckOpen); NotifyResize(); } diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 80d66831f0bb..9b7c763a8eb2 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -2358,7 +2358,7 @@ static bool impl_maxOpenDocCountReached() // NIL means: count of allowed documents = infinite ! if (!x) return false; - sal_Int32 nMaxDocs(x.get()); + sal_Int32 nMaxDocs(*x); sal_Int32 nOpenDocs = 0; css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create(xContext); |