[Libreoffice-commits] core.git: sdext/source

Noel Grandin noel.grandin at collabora.co.uk
Thu Oct 27 11:39:58 UTC 2016


 sdext/source/presenter/PresenterAccessibility.cxx   |    9 -----
 sdext/source/presenter/PresenterController.cxx      |   18 +++-------
 sdext/source/presenter/PresenterController.hxx      |    2 -
 sdext/source/presenter/PresenterNotesView.cxx       |   18 +++-------
 sdext/source/presenter/PresenterNotesView.hxx       |    6 ---
 sdext/source/presenter/PresenterProtocolHandler.cxx |   34 +++++---------------
 sdext/source/presenter/PresenterScreen.cxx          |   22 ++++--------
 sdext/source/presenter/PresenterScrollBar.cxx       |   29 +++++------------
 sdext/source/presenter/PresenterScrollBar.hxx       |    1 
 sdext/source/presenter/PresenterSlideShowView.cxx   |   20 +++++------
 sdext/source/presenter/PresenterTextView.cxx        |    7 ----
 sdext/source/presenter/PresenterTextView.hxx        |    1 
 sdext/source/presenter/PresenterWindowManager.cxx   |    7 ----
 sdext/source/presenter/PresenterWindowManager.hxx   |    2 -
 14 files changed, 50 insertions(+), 126 deletions(-)

New commits:
commit e5438e9ef75a7fdc3c8c6ba44d116f277e036d96
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Oct 27 12:48:08 2016 +0200

    loplugin:expandablemethods in sdext
    
    Change-Id: I7d375d6eafdd450ac165539f8f7dd3d02826ac5b
    Reviewed-on: https://gerrit.libreoffice.org/30323
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sdext/source/presenter/PresenterAccessibility.cxx b/sdext/source/presenter/PresenterAccessibility.cxx
index 03d3017..7c474b2 100644
--- a/sdext/source/presenter/PresenterAccessibility.cxx
+++ b/sdext/source/presenter/PresenterAccessibility.cxx
@@ -217,8 +217,6 @@ protected:
 
     void UpdateState (const sal_Int16 aState, const bool bValue);
 
-    bool IsDisposed() const;
-
     void ThrowIfDisposed() const
         throw (css::lang::DisposedException);
 };
@@ -1090,7 +1088,7 @@ void SAL_CALL PresenterAccessible::AccessibleObject::addAccessibleEventListener
     {
         const osl::MutexGuard aGuard(m_aMutex);
 
-        if (IsDisposed())
+        if (rBHelper.bDisposed || rBHelper.bInDispose)
         {
             uno::Reference<uno::XInterface> xThis (static_cast<XWeak*>(this), UNO_QUERY);
             rxListener->disposing (lang::EventObject(xThis));
@@ -1336,11 +1334,6 @@ awt::Point PresenterAccessible::AccessibleObject::GetAbsoluteParentLocation()
         return awt::Point();
 }
 
-bool PresenterAccessible::AccessibleObject::IsDisposed() const
-{
-    return (rBHelper.bDisposed || rBHelper.bInDispose);
-}
-
 void PresenterAccessible::AccessibleObject::ThrowIfDisposed() const
     throw (lang::DisposedException)
 {
diff --git a/sdext/source/presenter/PresenterController.cxx b/sdext/source/presenter/PresenterController.cxx
index 5a8235c..f6e39cd 100644
--- a/sdext/source/presenter/PresenterController.cxx
+++ b/sdext/source/presenter/PresenterController.cxx
@@ -722,7 +722,12 @@ void SAL_CALL PresenterController::notifyConfigurationChange (
     const ConfigurationChangeEvent& rEvent)
     throw (RuntimeException, std::exception)
 {
-    ThrowIfDisposed();
+    if (rBHelper.bDisposed || rBHelper.bInDispose)
+    {
+        throw lang::DisposedException (
+            OUString( "PresenterController object has already been disposed"),
+            const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
+    }
 
     sal_Int32 nType (0);
     if ( ! (rEvent.UserData >>= nType))
@@ -1208,17 +1213,6 @@ void PresenterController::UpdatePendingSlideNumber (const sal_Int32 nPendingSlid
             0));
 }
 
-void PresenterController::ThrowIfDisposed() const
-    throw (css::lang::DisposedException)
-{
-    if (rBHelper.bDisposed || rBHelper.bInDispose)
-    {
-        throw lang::DisposedException (
-            OUString( "PresenterController object has already been disposed"),
-            const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
-    }
-}
-
 void PresenterController::SwitchMonitors()
 {
     Reference<lang::XEventListener> xScreen( mxScreen );
diff --git a/sdext/source/presenter/PresenterController.hxx b/sdext/source/presenter/PresenterController.hxx
index e54bcf0..3b96626 100644
--- a/sdext/source/presenter/PresenterController.hxx
+++ b/sdext/source/presenter/PresenterController.hxx
@@ -244,8 +244,6 @@ private:
             The modifier bit field as provided by the key up event.
     */
     void HandleNumericKeyPress (const sal_Int32 nKey, const sal_Int32 nModifiers);
-
-    void ThrowIfDisposed() const throw (css::lang::DisposedException);
 };
 
 } } // end of namespace ::sdext::presenter
diff --git a/sdext/source/presenter/PresenterNotesView.cxx b/sdext/source/presenter/PresenterNotesView.cxx
index 11b6d9e..c964839 100644
--- a/sdext/source/presenter/PresenterNotesView.cxx
+++ b/sdext/source/presenter/PresenterNotesView.cxx
@@ -320,7 +320,12 @@ void SAL_CALL PresenterNotesView::windowHidden (const lang::EventObject& rEvent)
 void SAL_CALL PresenterNotesView::windowPaint (const awt::PaintEvent& rEvent)
     throw (RuntimeException, std::exception)
 {
-    ThrowIfDisposed();
+    if (rBHelper.bDisposed || rBHelper.bInDispose)
+    {
+        throw lang::DisposedException (
+            "PresenterNotesView object has already been disposed",
+            static_cast<uno::XWeak*>(this));
+    }
 
     if ( ! mbIsPresenterViewActive)
         return;
@@ -698,17 +703,6 @@ void PresenterNotesView::UpdateScrollBar()
     }
 }
 
-void PresenterNotesView::ThrowIfDisposed()
-    throw (css::lang::DisposedException)
-{
-    if (rBHelper.bDisposed || rBHelper.bInDispose)
-    {
-        throw lang::DisposedException (
-            "PresenterNotesView object has already been disposed",
-            static_cast<uno::XWeak*>(this));
-    }
-}
-
 } } // end of namespace ::sdext::presenter
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sdext/source/presenter/PresenterNotesView.hxx b/sdext/source/presenter/PresenterNotesView.hxx
index 8a0fea6..d7f1bbf 100644
--- a/sdext/source/presenter/PresenterNotesView.hxx
+++ b/sdext/source/presenter/PresenterNotesView.hxx
@@ -166,12 +166,6 @@ private:
     void Scroll (const double nDistance);
     void SetTop (const double nTop);
     void UpdateScrollBar();
-
-    /** This method throws a DisposedException when the object has already been
-        disposed.
-    */
-    void ThrowIfDisposed()
-        throw (css::lang::DisposedException);
 };
 
 } } // end of namespace ::sdext::presenter
diff --git a/sdext/source/presenter/PresenterProtocolHandler.cxx b/sdext/source/presenter/PresenterProtocolHandler.cxx
index 107c18c..cb2d556e 100644
--- a/sdext/source/presenter/PresenterProtocolHandler.cxx
+++ b/sdext/source/presenter/PresenterProtocolHandler.cxx
@@ -127,7 +127,6 @@ namespace {
     private:
         bool mbOn;
         rtl::Reference<PresenterController> mpPresenterController;
-        static bool IsActive (const ::rtl::Reference<PresenterWindowManager>& rpWindowManager);
     };
 
     class SetSlideSorterCommand : public Command
@@ -240,8 +239,6 @@ private:
         const OUString& rsURLPath,
         const ::rtl::Reference<PresenterController>& rpPresenterController);
     virtual ~Dispatch() override;
-
-    void ThrowIfDisposed() const throw (css::lang::DisposedException);
 };
 
 //----- Service ---------------------------------------------------------------
@@ -453,11 +450,16 @@ void PresenterProtocolHandler::Dispatch::disposing()
 
 void SAL_CALL PresenterProtocolHandler::Dispatch::dispatch(
     const css::util::URL& rURL,
-    const css::uno::Sequence<css::beans::PropertyValue>& rArguments)
+    const css::uno::Sequence<css::beans::PropertyValue>& /*rArguments*/)
     throw(css::uno::RuntimeException, std::exception)
 {
-    (void)rArguments;
-    ThrowIfDisposed();
+    if (rBHelper.bDisposed || rBHelper.bInDispose)
+    {
+        throw lang::DisposedException (
+            OUString(
+                "PresenterProtocolHandler::Dispatch object has already been disposed"),
+            const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
+    }
 
     if (rURL.Protocol == "vnd.org.libreoffice.presenterscreen:"
         && rURL.Path == msURLPath)
@@ -511,18 +513,6 @@ void SAL_CALL PresenterProtocolHandler::Dispatch::removeStatusListener (
         throw RuntimeException();
 }
 
-void PresenterProtocolHandler::Dispatch::ThrowIfDisposed() const
-    throw (css::lang::DisposedException)
-{
-    if (rBHelper.bDisposed || rBHelper.bInDispose)
-    {
-        throw lang::DisposedException (
-            OUString(
-                "PresenterProtocolHandler::Dispatch object has already been disposed"),
-            const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
-    }
-}
-
 //----- document::XEventListener ----------------------------------------------
 
 void SAL_CALL PresenterProtocolHandler::Dispatch::notifyEvent (
@@ -675,13 +665,7 @@ Any SetNotesViewCommand::GetState() const
     if ( ! pWindowManager.is())
         return Any(false);
 
-    return Any(IsActive(pWindowManager));
-}
-
-bool SetNotesViewCommand::IsActive (
-    const ::rtl::Reference<PresenterWindowManager>& rpWindowManager)
-{
-    return rpWindowManager->GetViewMode() == PresenterWindowManager::VM_Notes;
+    return Any(pWindowManager->GetViewMode() == PresenterWindowManager::VM_Notes);
 }
 
 //===== SetSlideSorterCommand =================================================
diff --git a/sdext/source/presenter/PresenterScreen.cxx b/sdext/source/presenter/PresenterScreen.cxx
index 0bfb452..26b4cfb 100644
--- a/sdext/source/presenter/PresenterScreen.cxx
+++ b/sdext/source/presenter/PresenterScreen.cxx
@@ -85,8 +85,6 @@ namespace {
         css::uno::Reference<css::frame::XModel2 > mxModel;
         css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
         rtl::Reference<PresenterScreen> mpPresenterScreen;
-
-        void ThrowIfDisposed() const throw (css::lang::DisposedException);
     };
 }
 
@@ -215,7 +213,13 @@ void SAL_CALL PresenterScreenListener::disposing()
 
 void SAL_CALL PresenterScreenListener::notifyEvent( const css::document::EventObject& Event ) throw (css::uno::RuntimeException, std::exception)
 {
-    ThrowIfDisposed();
+    if (rBHelper.bDisposed || rBHelper.bInDispose)
+    {
+        throw lang::DisposedException (
+            OUString(
+                "PresenterScreenListener object has already been disposed"),
+            const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
+    }
 
     if ( Event.EventName == "OnStartPresentation" )
     {
@@ -247,18 +251,6 @@ void SAL_CALL PresenterScreenListener::disposing (const css::lang::EventObject&
     }
 }
 
-void PresenterScreenListener::ThrowIfDisposed() const throw (
-    css::lang::DisposedException)
-{
-    if (rBHelper.bDisposed || rBHelper.bInDispose)
-    {
-        throw lang::DisposedException (
-            OUString(
-                "PresenterScreenListener object has already been disposed"),
-            const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
-    }
-}
-
 } // end of anonymous namespace
 
 //===== PresenterScreen =======================================================
diff --git a/sdext/source/presenter/PresenterScrollBar.cxx b/sdext/source/presenter/PresenterScrollBar.cxx
index ead527a..8cba1bc 100644
--- a/sdext/source/presenter/PresenterScrollBar.cxx
+++ b/sdext/source/presenter/PresenterScrollBar.cxx
@@ -194,7 +194,16 @@ void PresenterScrollBar::SetThumbPosition (
 
         UpdateBorders();
         Repaint(GetRectangle(Total), bAsynchronousUpdate);
-        NotifyThumbPositionChange();
+
+        mbIsNotificationActive = true;
+        try
+        {
+            maThumbMotionListener(mnThumbPosition);
+        }
+        catch (Exception&)
+        {
+        }
+        mbIsNotificationActive = false;
     }
 }
 
@@ -523,24 +532,6 @@ void PresenterScrollBar::PaintBitmap(
     }
 }
 
-void PresenterScrollBar::NotifyThumbPositionChange()
-{
-    if ( ! mbIsNotificationActive)
-    {
-        mbIsNotificationActive = true;
-
-        try
-        {
-            maThumbMotionListener(mnThumbPosition);
-        }
-        catch (Exception&)
-        {
-        }
-
-        mbIsNotificationActive = false;
-    }
-}
-
 PresenterScrollBar::Area PresenterScrollBar::GetArea (const double nX, const double nY) const
 {
     const geometry::RealPoint2D aPoint(nX, nY);
diff --git a/sdext/source/presenter/PresenterScrollBar.hxx b/sdext/source/presenter/PresenterScrollBar.hxx
index 00f8393..7706ce4 100644
--- a/sdext/source/presenter/PresenterScrollBar.hxx
+++ b/sdext/source/presenter/PresenterScrollBar.hxx
@@ -214,7 +214,6 @@ protected:
         const css::awt::Rectangle& rRepaintBox,
         const Area eArea,
         const SharedBitmapDescriptor& rpBitmaps);
-    void NotifyThumbPositionChange();
     void UpdateWidthOrHeight (sal_Int32& rSize,
         const SharedBitmapDescriptor& rpDescriptor);
     css::uno::Reference<css::rendering::XBitmap> GetBitmap (
diff --git a/sdext/source/presenter/PresenterSlideShowView.cxx b/sdext/source/presenter/PresenterSlideShowView.cxx
index 60af7c9..6237a16 100644
--- a/sdext/source/presenter/PresenterSlideShowView.cxx
+++ b/sdext/source/presenter/PresenterSlideShowView.cxx
@@ -814,8 +814,15 @@ void PresenterSlideShowView::PaintInnerWindow (const awt::PaintEvent& rEvent)
         pIterator->notifyEach(&awt::XPaintListener::windowPaint, aEvent);
     }
 
-    if (mbIsForcedPaintPending)
-        ForceRepaint();
+    /** The slide show relies on the back buffer of the canvas not being
+        modified.  With a shared canvas there are times when that can not be
+        guaranteed.
+    */
+    if (mbIsForcedPaintPending && mxSlideShow.is() && mbIsViewAdded)
+    {
+        mxSlideShow->removeView(this);
+        impl_addAndConfigureView();
+    }
 
     // Finally, in double buffered environments, request the changes to be
     // made visible.
@@ -929,15 +936,6 @@ void PresenterSlideShowView::Resize()
         mbIsForcedPaintPending = true;
 }
 
-void PresenterSlideShowView::ForceRepaint()
-{
-    if (mxSlideShow.is() && mbIsViewAdded)
-    {
-        mxSlideShow->removeView(this);
-        impl_addAndConfigureView();
-    }
-}
-
 void PresenterSlideShowView::CreateBackgroundPolygons()
 {
     const awt::Rectangle aWindowBox (mxWindow->getPosSize());
diff --git a/sdext/source/presenter/PresenterTextView.cxx b/sdext/source/presenter/PresenterTextView.cxx
index 8f40ebd..8e3800b 100644
--- a/sdext/source/presenter/PresenterTextView.cxx
+++ b/sdext/source/presenter/PresenterTextView.cxx
@@ -1201,7 +1201,7 @@ PresenterTextParagraph::Line::Line (
 
 void PresenterTextParagraph::Line::ProvideCellBoxes()
 {
-    if ( ! IsEmpty() && maCellBoxes.getLength()==0)
+    if ( mnLineStartCharacterIndex < mnLineEndCharacterIndex && maCellBoxes.getLength()==0 )
     {
         if (mxLayoutedLine.is())
             maCellBoxes = mxLayoutedLine->queryInkMeasures();
@@ -1231,11 +1231,6 @@ void PresenterTextParagraph::Line::ProvideLayoutedLine (
     }
 }
 
-bool PresenterTextParagraph::Line::IsEmpty() const
-{
-    return mnLineStartCharacterIndex >= mnLineEndCharacterIndex;
-}
-
 } } // end of namespace ::sdext::presenter
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sdext/source/presenter/PresenterTextView.hxx b/sdext/source/presenter/PresenterTextView.hxx
index 664d65e..b56bd5a 100644
--- a/sdext/source/presenter/PresenterTextView.hxx
+++ b/sdext/source/presenter/PresenterTextView.hxx
@@ -175,7 +175,6 @@ private:
             const PresenterTheme::SharedFontDescriptor& rpFont,
             const sal_Int8 nTextDirection);
         void ProvideCellBoxes();
-        bool IsEmpty() const;
     };
 
     css::uno::Reference<css::i18n::XBreakIterator> mxBreakIterator;
diff --git a/sdext/source/presenter/PresenterWindowManager.cxx b/sdext/source/presenter/PresenterWindowManager.cxx
index 557b4f9..2db64ef 100644
--- a/sdext/source/presenter/PresenterWindowManager.cxx
+++ b/sdext/source/presenter/PresenterWindowManager.cxx
@@ -1111,17 +1111,12 @@ Reference<rendering::XPolyPolygon2D> PresenterWindowManager::CreateClipPolyPolyg
     return xPolyPolygon;
 }
 
-
-void PresenterWindowManager::Invalidate()
-{
-    mpPresenterController->GetPaintManager()->Invalidate(mxParentWindow);
-}
 void PresenterWindowManager::Update()
 {
     mxClipPolygon = nullptr;
     mbIsLayoutPending = true;
 
-    Invalidate();
+    mpPresenterController->GetPaintManager()->Invalidate(mxParentWindow);
 }
 
 void PresenterWindowManager::ThrowIfDisposed() const
diff --git a/sdext/source/presenter/PresenterWindowManager.hxx b/sdext/source/presenter/PresenterWindowManager.hxx
index 13115fb..1724da4 100644
--- a/sdext/source/presenter/PresenterWindowManager.hxx
+++ b/sdext/source/presenter/PresenterWindowManager.hxx
@@ -193,8 +193,6 @@ private:
     void ProvideBackgroundBitmap();
     css::uno::Reference<css::rendering::XPolyPolygon2D> CreateClipPolyPolygon() const;
 
-    void Invalidate();
-
     void StoreViewMode (const ViewMode eViewMode);
 
     void LayoutStandardMode();


More information about the Libreoffice-commits mailing list