[Libreoffice-commits] core.git: starmath/inc starmath/qa starmath/source

Caolán McNamara caolanm at redhat.com
Sat Feb 14 12:34:10 PST 2015


 starmath/inc/ElementsDockingWindow.hxx          |    3 --
 starmath/inc/pch/precompiled_sm.hxx             |    1 
 starmath/qa/cppunit/test_nodetotextvisitors.cxx |    8 ++---
 starmath/source/ElementsDockingWindow.cxx       |   34 +++++++++++-----------
 starmath/source/document.cxx                    |   36 ++++++++++++------------
 starmath/source/edit.cxx                        |   22 ++++++--------
 starmath/source/view.cxx                        |   18 ++++++------
 7 files changed, 59 insertions(+), 63 deletions(-)

New commits:
commit 08348b226b6bb0ba9b1c24802c1f306b7b3905a1
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Feb 14 20:30:36 2015 +0000

    boost::scoped_ptr->std::unique_ptr
    
    Change-Id: I0f9d93e945ec554e9ea89621ecd30f683f3f184c

diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx
index c716389..96dcfd6 100644
--- a/starmath/inc/ElementsDockingWindow.hxx
+++ b/starmath/inc/ElementsDockingWindow.hxx
@@ -20,7 +20,6 @@
 #ifndef INCLUDED_STARMATH_INC_ELEMENTSDOCKINGWINDOW_HXX
 #define INCLUDED_STARMATH_INC_ELEMENTSDOCKINGWINDOW_HXX
 
-#include <boost/scoped_ptr.hpp>
 #include <boost/signals2/signal.hpp>
 #include <sfx2/dockwin.hxx>
 #include <svx/dlgctrl.hxx>
@@ -97,7 +96,7 @@ class SmElementsControl : public Control
     SmElementList maElementList;
     Size          maMaxElementDimensions;
     bool          mbVerticalMode;
-    boost::scoped_ptr< ScrollBar > mpScroll;
+    std::unique_ptr<ScrollBar> mxScroll;
 
     void addElement(const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText);
 
diff --git a/starmath/inc/pch/precompiled_sm.hxx b/starmath/inc/pch/precompiled_sm.hxx
index bcfb5ab..31dce9f 100644
--- a/starmath/inc/pch/precompiled_sm.hxx
+++ b/starmath/inc/pch/precompiled_sm.hxx
@@ -17,7 +17,6 @@
 #include "svx/modctrl.hxx"
 #include "tools/rcid.h"
 #include <boost/scoped_array.hpp>
-#include <boost/scoped_ptr.hpp>
 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
 #include <com/sun/star/accessibility/AccessibleEventObject.hpp>
 #include <com/sun/star/accessibility/AccessibleRole.hpp>
diff --git a/starmath/qa/cppunit/test_nodetotextvisitors.cxx b/starmath/qa/cppunit/test_nodetotextvisitors.cxx
index 6b66d3a..4e4de16 100644
--- a/starmath/qa/cppunit/test_nodetotextvisitors.cxx
+++ b/starmath/qa/cppunit/test_nodetotextvisitors.cxx
@@ -19,7 +19,7 @@
 #include <cursor.hxx>
 
 #include "mock-visitor.hxx"
-#include <boost/scoped_ptr.hpp>
+#include <memory>
 
 typedef tools::SvRef<SmDocShell> SmDocShellRef;
 
@@ -447,7 +447,7 @@ void Test::parseandparseagain(const char *formula, const char *test_name)
         output2);
 
     // auxiliary test for Accept()
-    boost::scoped_ptr<MockVisitor> mv(new MockVisitor);
+    std::unique_ptr<MockVisitor> mv(new MockVisitor);
     pNode1->Accept(mv.get());
     pNode2->Accept(mv.get());
 
@@ -473,7 +473,7 @@ void Test::ParseAndCheck(const char *formula, const char * expected, const char
         sOutput);
 
     // auxiliary test for Accept()
-    boost::scoped_ptr<MockVisitor> mv(new MockVisitor);
+    std::unique_ptr<MockVisitor> mv(new MockVisitor);
     pNode->Accept(mv.get());
 
     delete pNode;
@@ -500,7 +500,7 @@ void Test::ParseAndCompare(const char *formula1, const char *formula2, const cha
     CPPUNIT_ASSERT_EQUAL_MESSAGE(test_name, sOutput1, sOutput2);
 
     // auxiliary test for Accept()
-    boost::scoped_ptr<MockVisitor> mv(new MockVisitor);
+    std::unique_ptr<MockVisitor> mv(new MockVisitor);
     pNode1->Accept(mv.get());
     pNode2->Accept(mv.get());
 
diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx
index 9e4ade6..6f47b03 100644
--- a/starmath/source/ElementsDockingWindow.cxx
+++ b/starmath/source/ElementsDockingWindow.cxx
@@ -222,7 +222,7 @@ SmElementsControl::SmElementsControl(vcl::Window *pParent)
     , maCurrentSetId(0)
     , mpCurrentElement(NULL)
     , mbVerticalMode(true)
-    , mpScroll(new ScrollBar(this, WB_VERT))
+    , mxScroll(new ScrollBar(this, WB_VERT))
 {
     SetMapMode( MapMode(MAP_100TH_MM) );
     SetDrawMode( DRAWMODE_DEFAULT );
@@ -231,8 +231,8 @@ SmElementsControl::SmElementsControl(vcl::Window *pParent)
 
     maFormat.SetBaseSize(PixelToLogic(Size(0, SmPtsTo100th_mm(12))));
 
-    mpScroll->SetScrollHdl( LINK(this, SmElementsControl, ScrollHdl) );
-    mpScroll->Show();
+    mxScroll->SetScrollHdl( LINK(this, SmElementsControl, ScrollHdl) );
+    mxScroll->Show();
 }
 
 SmElementsControl::~SmElementsControl()
@@ -249,7 +249,7 @@ void SmElementsControl::Paint(const Rectangle&)
 {
     Push();
 
-    bool bOldVisibleState = mpScroll->IsVisible();
+    bool bOldVisibleState = mxScroll->IsVisible();
 
     sal_Int32 nScrollbarWidth = bOldVisibleState ? GetSettings().GetStyleSettings().GetScrollBarSize() : 0;
 
@@ -260,7 +260,7 @@ void SmElementsControl::Paint(const Rectangle&)
     sal_Int32 boxY = maMaxElementDimensions.Height() + 10;
 
     sal_Int32 x = 0;
-    sal_Int32 y = -mpScroll->GetThumbPos();
+    sal_Int32 y = -mxScroll->GetThumbPos();
 
     sal_Int32 perLine = 0;
 
@@ -351,24 +351,24 @@ void SmElementsControl::Paint(const Rectangle&)
         }
     }
 
-    sal_Int32 nTotalControlHeight = y + boxY + mpScroll->GetThumbPos();
+    sal_Int32 nTotalControlHeight = y + boxY + mxScroll->GetThumbPos();
 
     if (nTotalControlHeight > GetOutputSizePixel().Height())
     {
-        mpScroll->SetRangeMax(nTotalControlHeight);
-        mpScroll->SetPosSizePixel(Point(nControlWidth, 0), Size(nScrollbarWidth, nControlHeight));
-        mpScroll->SetVisibleSize(nControlHeight);
-        mpScroll->Show();
+        mxScroll->SetRangeMax(nTotalControlHeight);
+        mxScroll->SetPosSizePixel(Point(nControlWidth, 0), Size(nScrollbarWidth, nControlHeight));
+        mxScroll->SetVisibleSize(nControlHeight);
+        mxScroll->Show();
     }
     else
     {
-        mpScroll->SetThumbPos(0);
-        mpScroll->Hide();
+        mxScroll->SetThumbPos(0);
+        mxScroll->Hide();
     }
 
     // If scrollbar visibility changed, we have to go through the
     // calculation once more, see nScrollbarWidth
-    if (bOldVisibleState != mpScroll->IsVisible())
+    if (bOldVisibleState != mxScroll->IsVisible())
         Invalidate();
 
     Pop();
@@ -428,17 +428,17 @@ void SmElementsControl::MouseButtonDown(const MouseEvent& rMouseEvent)
 
 IMPL_LINK_NOARG( SmElementsControl, ScrollHdl )
 {
-    DoScroll(mpScroll->GetDelta());
+    DoScroll(mxScroll->GetDelta());
     return 0;
 }
 
 void SmElementsControl::DoScroll(long nDelta)
 {
-    Point aNewPoint = mpScroll->GetPosPixel();
+    Point aNewPoint = mxScroll->GetPosPixel();
     Rectangle aRect(Point(), GetOutputSize());
-    aRect.Right() -= mpScroll->GetSizePixel().Width();
+    aRect.Right() -= mxScroll->GetSizePixel().Width();
     Scroll( 0, -nDelta, aRect );
-    mpScroll->SetPosPixel(aNewPoint);
+    mxScroll->SetPosPixel(aNewPoint);
     Invalidate();
 }
 
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
index c5acddb..e958b43 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -94,7 +94,7 @@
 #include <tools/diagnose_ex.h>
 #include "visitors.hxx"
 #include "accessibility.hxx"
-#include <boost/scoped_ptr.hpp>
+#include <memory>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::accessibility;
@@ -989,15 +989,15 @@ void SmDocShell::Execute(SfxRequest& rReq)
                 pDev = &SM_MOD()->GetDefaultVirtualDev();
             OSL_ENSURE (pDev, "device for font list missing" );
 
-            boost::scoped_ptr<SmFontTypeDialog> pFontTypeDialog(new SmFontTypeDialog( NULL, pDev ));
+            std::unique_ptr<SmFontTypeDialog> xFontTypeDialog(new SmFontTypeDialog( NULL, pDev ));
 
             SmFormat aOldFormat  = GetFormat();
-            pFontTypeDialog->ReadFrom( aOldFormat );
-            if (pFontTypeDialog->Execute() == RET_OK)
+            xFontTypeDialog->ReadFrom( aOldFormat );
+            if (xFontTypeDialog->Execute() == RET_OK)
             {
                 SmFormat aNewFormat( aOldFormat );
 
-                pFontTypeDialog->WriteTo(aNewFormat);
+                xFontTypeDialog->WriteTo(aNewFormat);
                 ::svl::IUndoManager *pTmpUndoMgr = GetUndoManager();
                 if (pTmpUndoMgr)
                     pTmpUndoMgr->AddUndoAction(
@@ -1011,15 +1011,15 @@ void SmDocShell::Execute(SfxRequest& rReq)
 
         case SID_FONTSIZE:
         {
-            boost::scoped_ptr<SmFontSizeDialog> pFontSizeDialog(new SmFontSizeDialog(NULL));
+            std::unique_ptr<SmFontSizeDialog> xFontSizeDialog(new SmFontSizeDialog(NULL));
 
             SmFormat aOldFormat  = GetFormat();
-            pFontSizeDialog->ReadFrom( aOldFormat );
-            if (pFontSizeDialog->Execute() == RET_OK)
+            xFontSizeDialog->ReadFrom( aOldFormat );
+            if (xFontSizeDialog->Execute() == RET_OK)
             {
                 SmFormat aNewFormat( aOldFormat );
 
-                pFontSizeDialog->WriteTo(aNewFormat);
+                xFontSizeDialog->WriteTo(aNewFormat);
 
                 ::svl::IUndoManager *pTmpUndoMgr = GetUndoManager();
                 if (pTmpUndoMgr)
@@ -1034,15 +1034,15 @@ void SmDocShell::Execute(SfxRequest& rReq)
 
         case SID_DISTANCE:
         {
-            boost::scoped_ptr<SmDistanceDialog> pDistanceDialog(new SmDistanceDialog(NULL));
+            std::unique_ptr<SmDistanceDialog> xDistanceDialog(new SmDistanceDialog(NULL));
 
             SmFormat aOldFormat  = GetFormat();
-            pDistanceDialog->ReadFrom( aOldFormat );
-            if (pDistanceDialog->Execute() == RET_OK)
+            xDistanceDialog->ReadFrom( aOldFormat );
+            if (xDistanceDialog->Execute() == RET_OK)
             {
                 SmFormat aNewFormat( aOldFormat );
 
-                pDistanceDialog->WriteTo(aNewFormat);
+                xDistanceDialog->WriteTo(aNewFormat);
 
                 ::svl::IUndoManager *pTmpUndoMgr = GetUndoManager();
                 if (pTmpUndoMgr)
@@ -1057,19 +1057,19 @@ void SmDocShell::Execute(SfxRequest& rReq)
 
         case SID_ALIGN:
         {
-            boost::scoped_ptr<SmAlignDialog> pAlignDialog(new SmAlignDialog(NULL));
+            std::unique_ptr<SmAlignDialog> xAlignDialog(new SmAlignDialog(NULL));
 
             SmFormat aOldFormat  = GetFormat();
-            pAlignDialog->ReadFrom( aOldFormat );
-            if (pAlignDialog->Execute() == RET_OK)
+            xAlignDialog->ReadFrom( aOldFormat );
+            if (xAlignDialog->Execute() == RET_OK)
             {
                 SmFormat aNewFormat( aOldFormat );
 
-                pAlignDialog->WriteTo(aNewFormat);
+                xAlignDialog->WriteTo(aNewFormat);
 
                 SmModule *pp = SM_MOD();
                 SmFormat aFmt( pp->GetConfig()->GetStandardFormat() );
-                pAlignDialog->WriteTo( aFmt );
+                xAlignDialog->WriteTo( aFmt );
                 pp->GetConfig()->SetStandardFormat( aFmt );
 
                 ::svl::IUndoManager *pTmpUndoMgr = GetUndoManager();
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index 97b6826..78a28c2 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -49,7 +49,7 @@
 #include "document.hxx"
 #include "config.hxx"
 #include "accessibility.hxx"
-#include <boost/scoped_ptr.hpp>
+#include <memory>
 
 #define SCROLL_LINE         24
 
@@ -337,7 +337,7 @@ void SmEditWindow::Command(const CommandEvent& rCEvt)
         GetParent()->ToTop();
 
         Point aPoint = rCEvt.GetMousePosPixel();
-        boost::scoped_ptr<PopupMenu> pPopupMenu(new PopupMenu(SmResId(RID_COMMANDMENU)));
+        std::unique_ptr<PopupMenu> xPopupMenu(new PopupMenu(SmResId(RID_COMMANDMENU)));
 
         // added for replaceability of context menus
         Menu* pMenu = NULL;
@@ -346,17 +346,17 @@ void SmEditWindow::Command(const CommandEvent& rCEvt)
         aEvent.ExecutePosition.X = aPoint.X();
         aEvent.ExecutePosition.Y = aPoint.Y();
         OUString sDummy;
-        if ( GetView()->TryContextMenuInterception( *pPopupMenu, sDummy, pMenu, aEvent ) )
+        if ( GetView()->TryContextMenuInterception( *xPopupMenu, sDummy, pMenu, aEvent ) )
         {
             if ( pMenu )
             {
-                pPopupMenu.reset(static_cast<PopupMenu*>(pMenu));
+                xPopupMenu.reset(static_cast<PopupMenu*>(pMenu));
             }
         }
 
-        pPopupMenu->SetSelectHdl(LINK(this, SmEditWindow, MenuSelectHdl));
+        xPopupMenu->SetSelectHdl(LINK(this, SmEditWindow, MenuSelectHdl));
 
-        pPopupMenu->Execute( this, aPoint );
+        xPopupMenu->Execute( this, aPoint );
         bForwardEvt = false;
     }
     else if (rCEvt.GetCommand() == COMMAND_WHEEL)
@@ -1088,22 +1088,20 @@ void SmEditWindow::Flush()
     }
 }
 
-
 void SmEditWindow::DeleteEditView( SmViewShell & /*rView*/ )
 {
     if (pEditView)
     {
-        boost::scoped_ptr<EditEngine> pEditEngine(pEditView->GetEditEngine());
-        if (pEditEngine)
+        std::unique_ptr<EditEngine> xEditEngine(pEditView->GetEditEngine());
+        if (xEditEngine)
         {
-            pEditEngine->SetStatusEventHdl( Link() );
-            pEditEngine->RemoveView( pEditView );
+            xEditEngine->SetStatusEventHdl( Link() );
+            xEditEngine->RemoveView( pEditView );
         }
         pEditView = 0;
     }
 }
 
-
 uno::Reference< XAccessible > SmEditWindow::CreateAccessible()
 {
     if (!pAccessible)
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 9f7a4f0..6b1f2cf 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -73,7 +73,7 @@
 #include "cursor.hxx"
 #include "accessibility.hxx"
 #include "ElementsDockingWindow.hxx"
-#include <boost/scoped_ptr.hpp>
+#include <memory>
 
 #define MINZOOM         25
 #define MAXZOOM         800
@@ -563,8 +563,8 @@ void SmGraphicWindow::Command(const CommandEvent& rCEvt)
             {
                 GetParent()->ToTop();
                 SmResId aResId( RID_VIEWMENU );
-                boost::scoped_ptr<PopupMenu> pPopupMenu(new PopupMenu(aResId));
-                pPopupMenu->SetSelectHdl(LINK(this, SmGraphicWindow, MenuSelectHdl));
+                std::unique_ptr<PopupMenu> xPopupMenu(new PopupMenu(aResId));
+                xPopupMenu->SetSelectHdl(LINK(this, SmGraphicWindow, MenuSelectHdl));
                 Point aPos(5, 5);
                 if (rCEvt.IsMouseEvent())
                     aPos = rCEvt.GetMousePosPixel();
@@ -1738,7 +1738,7 @@ void SmViewShell::Execute(SfxRequest& rReq)
         {
             if ( !GetViewFrame()->GetFrame().IsInPlace() )
             {
-                boost::scoped_ptr<AbstractSvxZoomDialog> pDlg;
+                std::unique_ptr<AbstractSvxZoomDialog> xDlg;
                 const SfxItemSet *pSet = rReq.GetArgs();
                 if ( !pSet )
                 {
@@ -1747,11 +1747,11 @@ void SmViewShell::Execute(SfxRequest& rReq)
                     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
                     if(pFact)
                     {
-                        pDlg.reset(pFact->CreateSvxZoomDialog(&GetViewFrame()->GetWindow(), aSet));
-                        SAL_WARN_IF( !pDlg, "starmath", "Dialog creation failed!" );
-                        pDlg->SetLimits( MINZOOM, MAXZOOM );
-                        if( pDlg->Execute() != RET_CANCEL )
-                            pSet = pDlg->GetOutputItemSet();
+                        xDlg.reset(pFact->CreateSvxZoomDialog(&GetViewFrame()->GetWindow(), aSet));
+                        SAL_WARN_IF( !xDlg, "starmath", "Dialog creation failed!" );
+                        xDlg->SetLimits( MINZOOM, MAXZOOM );
+                        if (xDlg->Execute() != RET_CANCEL)
+                            pSet = xDlg->GetOutputItemSet();
                     }
                 }
                 if ( pSet )


More information about the Libreoffice-commits mailing list