summaryrefslogtreecommitdiff
path: root/sdext
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-08-10 20:47:32 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-08-11 11:20:43 +0200
commit2d582244680e7f6dec6e4a466e276f93ccb01dc9 (patch)
treeb0e880ddfb3ce1ea2f47151b648e7fbb55132f08 /sdext
parent74012c48d99634a7556a86f77e9522024f2afdb2 (diff)
loplugin:flatten
Change-Id: I6560756eb63856a22b43e3e65a7b7843cd2d5376 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100447 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sdext')
-rw-r--r--sdext/source/presenter/PresenterAccessibility.cxx156
-rw-r--r--sdext/source/presenter/PresenterProtocolHandler.cxx23
2 files changed, 90 insertions, 89 deletions
diff --git a/sdext/source/presenter/PresenterAccessibility.cxx b/sdext/source/presenter/PresenterAccessibility.cxx
index e82a0755b17c..14474f224e61 100644
--- a/sdext/source/presenter/PresenterAccessibility.cxx
+++ b/sdext/source/presenter/PresenterAccessibility.cxx
@@ -594,27 +594,27 @@ void PresenterAccessible::UpdateAccessibilityHierarchy (
}
}
- if (mxNotesContentWindow != rxNotesContentWindow)
+ if (mxNotesContentWindow == rxNotesContentWindow)
+ return;
+
+ if (mpAccessibleNotes.is())
{
- if (mpAccessibleNotes.is())
- {
- mpAccessibleConsole->RemoveChild(mpAccessibleNotes);
- mpAccessibleNotes = nullptr;
- }
+ mpAccessibleConsole->RemoveChild(mpAccessibleNotes);
+ mpAccessibleNotes = nullptr;
+ }
- mxNotesContentWindow = rxNotesContentWindow;
- mxNotesBorderWindow = rxNotesBorderWindow;
+ mxNotesContentWindow = rxNotesContentWindow;
+ mxNotesBorderWindow = rxNotesBorderWindow;
- if (mxNotesContentWindow.is())
- {
- mpAccessibleNotes = AccessibleNotes::Create(
- mxComponentContext,
- lang::Locale(),
- mxNotesContentWindow,
- mxNotesBorderWindow,
- rpNotesTextView);
- mpAccessibleConsole->AddChild(mpAccessibleNotes.get());
- }
+ if (mxNotesContentWindow.is())
+ {
+ mpAccessibleNotes = AccessibleNotes::Create(
+ mxComponentContext,
+ lang::Locale(),
+ mxNotesContentWindow,
+ mxNotesBorderWindow,
+ rpNotesTextView);
+ mpAccessibleConsole->AddChild(mpAccessibleNotes.get());
}
}
@@ -746,23 +746,23 @@ void PresenterAccessible::AccessibleObject::SetWindow (
{
Reference<awt::XWindow2> xContentWindow (rxContentWindow, UNO_QUERY);
- if (mxContentWindow.get() != xContentWindow.get())
- {
- if (mxContentWindow.is())
- {
- mxContentWindow->removeWindowListener(this);
- }
+ if (mxContentWindow.get() == xContentWindow.get())
+ return;
- mxContentWindow = xContentWindow;
- mxBorderWindow.set(rxBorderWindow, UNO_QUERY);
+ if (mxContentWindow.is())
+ {
+ mxContentWindow->removeWindowListener(this);
+ }
- if (mxContentWindow.is())
- {
- mxContentWindow->addWindowListener(this);
- }
+ mxContentWindow = xContentWindow;
+ mxBorderWindow.set(rxBorderWindow, UNO_QUERY);
- UpdateStateSet();
+ if (mxContentWindow.is())
+ {
+ mxContentWindow->addWindowListener(this);
}
+
+ UpdateStateSet();
}
void PresenterAccessible::AccessibleObject::SetAccessibleParent (
@@ -987,19 +987,19 @@ sal_Int32 SAL_CALL PresenterAccessible::AccessibleObject::getBackground()
void SAL_CALL PresenterAccessible::AccessibleObject::addAccessibleEventListener (
const Reference<XAccessibleEventListener>& rxListener)
{
- if (rxListener.is())
- {
- const osl::MutexGuard aGuard(m_aMutex);
+ if (!rxListener.is())
+ return;
- if (rBHelper.bDisposed || rBHelper.bInDispose)
- {
- uno::Reference<uno::XInterface> xThis (static_cast<XWeak*>(this), UNO_QUERY);
- rxListener->disposing (lang::EventObject(xThis));
- }
- else
- {
- maListeners.push_back(rxListener);
- }
+ const osl::MutexGuard aGuard(m_aMutex);
+
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ {
+ uno::Reference<uno::XInterface> xThis (static_cast<XWeak*>(this), UNO_QUERY);
+ rxListener->disposing (lang::EventObject(xThis));
+ }
+ else
+ {
+ maListeners.push_back(rxListener);
}
}
@@ -1700,44 +1700,44 @@ void AccessibleNotes::SetTextView (
mpTextView = rpTextView;
- if (mpTextView)
- {
- // Create a new set of children, one for each paragraph.
- const sal_Int32 nParagraphCount (mpTextView->GetParagraphCount());
- for (sal_Int32 nIndex=0; nIndex<nParagraphCount; ++nIndex)
- {
- rtl::Reference<PresenterAccessible::AccessibleParagraph> pParagraph (
- new PresenterAccessible::AccessibleParagraph(
- css::lang::Locale(),
- "Paragraph"+OUString::number(nIndex),
- rpTextView->GetParagraph(nIndex),
- nIndex));
- pParagraph->LateInitialization();
- pParagraph->SetWindow(mxContentWindow, mxBorderWindow);
- pParagraph->SetAccessibleParent(this);
- aChildren.emplace_back(pParagraph.get());
- }
- maChildren.swap(aChildren);
- FireAccessibleEvent(AccessibleEventId::INVALIDATE_ALL_CHILDREN, Any(), Any());
+ if (!mpTextView)
+ return;
- // Dispose the old children. (This will remove them from the focus
- // manager).
- for (const auto& rxChild : aChildren)
- {
- Reference<lang::XComponent> xComponent (static_cast<XWeak*>(rxChild.get()), UNO_QUERY);
- if (xComponent.is())
- xComponent->dispose();
- }
+ // Create a new set of children, one for each paragraph.
+ const sal_Int32 nParagraphCount (mpTextView->GetParagraphCount());
+ for (sal_Int32 nIndex=0; nIndex<nParagraphCount; ++nIndex)
+ {
+ rtl::Reference<PresenterAccessible::AccessibleParagraph> pParagraph (
+ new PresenterAccessible::AccessibleParagraph(
+ css::lang::Locale(),
+ "Paragraph"+OUString::number(nIndex),
+ rpTextView->GetParagraph(nIndex),
+ nIndex));
+ pParagraph->LateInitialization();
+ pParagraph->SetWindow(mxContentWindow, mxBorderWindow);
+ pParagraph->SetAccessibleParent(this);
+ aChildren.emplace_back(pParagraph.get());
+ }
+ maChildren.swap(aChildren);
+ FireAccessibleEvent(AccessibleEventId::INVALIDATE_ALL_CHILDREN, Any(), Any());
- // This class acts as a controller of who broadcasts caret motion
- // events and handles text changes. Register the corresponding
- // listeners here.
- mpTextView->GetCaret()->SetCaretMotionBroadcaster(
- [this](sal_Int32 a, sal_Int32 b, sal_Int32 c, sal_Int32 d)
- { return this->NotifyCaretChange(a, b, c, d); });
- mpTextView->SetTextChangeBroadcaster(
- [this]() { return SetTextView(mpTextView); });
+ // Dispose the old children. (This will remove them from the focus
+ // manager).
+ for (const auto& rxChild : aChildren)
+ {
+ Reference<lang::XComponent> xComponent (static_cast<XWeak*>(rxChild.get()), UNO_QUERY);
+ if (xComponent.is())
+ xComponent->dispose();
}
+
+ // This class acts as a controller of who broadcasts caret motion
+ // events and handles text changes. Register the corresponding
+ // listeners here.
+ mpTextView->GetCaret()->SetCaretMotionBroadcaster(
+ [this](sal_Int32 a, sal_Int32 b, sal_Int32 c, sal_Int32 d)
+ { return this->NotifyCaretChange(a, b, c, d); });
+ mpTextView->SetTextChangeBroadcaster(
+ [this]() { return SetTextView(mpTextView); });
}
void AccessibleNotes::SetWindow (
diff --git a/sdext/source/presenter/PresenterProtocolHandler.cxx b/sdext/source/presenter/PresenterProtocolHandler.cxx
index fcceaee4ce16..ff2cf4f251c5 100644
--- a/sdext/source/presenter/PresenterProtocolHandler.cxx
+++ b/sdext/source/presenter/PresenterProtocolHandler.cxx
@@ -602,18 +602,19 @@ void PauseResumeCommand::Execute()
if ( ! pWindowManager.is())
return;
- if (IPresentationTime* pPresentationTime = mpPresenterController->GetPresentationTime())
+ IPresentationTime* pPresentationTime = mpPresenterController->GetPresentationTime();
+ if (!pPresentationTime)
+ return;
+
+ if(pPresentationTime->isPaused())
{
- if(pPresentationTime->isPaused())
- {
- pPresentationTime->setPauseStatus(false);
- pWindowManager->SetPauseState(false);
- }
- else
- {
- pPresentationTime->setPauseStatus(true);
- pWindowManager->SetPauseState(true);
- }
+ pPresentationTime->setPauseStatus(false);
+ pWindowManager->SetPauseState(false);
+ }
+ else
+ {
+ pPresentationTime->setPauseStatus(true);
+ pWindowManager->SetPauseState(true);
}
}