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

Thomas Arnhold thomas at arnhold.org
Mon Sep 9 01:15:56 PDT 2013


 starmath/inc/caret.hxx       |    2 -
 starmath/inc/rect.hxx        |    2 -
 starmath/inc/utility.hxx     |    6 +--
 starmath/inc/visitors.hxx    |    2 -
 starmath/source/unomodel.cxx |    6 +--
 starmath/source/view.cxx     |   25 ++++++-------
 starmath/source/visitors.cxx |   82 +++++++++++++++++++++----------------------
 7 files changed, 62 insertions(+), 63 deletions(-)

New commits:
commit 2e08ed63f070fb15b933fe9dc4c37f2daa6d4295
Author: Thomas Arnhold <thomas at arnhold.org>
Date:   Mon Sep 9 09:07:24 2013 +0200

    OSL_ENSURE -> SAL_WARN_IF
    
    Change-Id: I2807797c6906ae5aaa8aabf7298df5fd8604e96a

diff --git a/starmath/inc/caret.hxx b/starmath/inc/caret.hxx
index 7969b51..2736617 100644
--- a/starmath/inc/caret.hxx
+++ b/starmath/inc/caret.hxx
@@ -169,7 +169,7 @@ public:
     SmCaretPosGraphEntry* Add(SmCaretPos pos,
                             SmCaretPosGraphEntry* left = NULL,
                             SmCaretPosGraphEntry* right = NULL){
-        OSL_ENSURE(pos.Index >= 0, "Index shouldn't be -1!");
+        SAL_WARN_IF( pos.Index < 0, "starmath", "Index shouldn't be -1!" );
         return Add(SmCaretPosGraphEntry(pos, left, right));
     }
     /** Get an iterator for this graph */
diff --git a/starmath/inc/rect.hxx b/starmath/inc/rect.hxx
index 17ed2da..2886a57 100644
--- a/starmath/inc/rect.hxx
+++ b/starmath/inc/rect.hxx
@@ -225,7 +225,7 @@ inline void SmRect::CopyMBL(const SmRect &rRect)
 
 inline long SmRect::GetBaseline() const
 {
-    OSL_ENSURE(HasBaseline(), "Sm: Baseline nicht vorhanden");
+    SAL_WARN_IF( !HasBaseline(), "starmath", "Baseline does not exist" );
     return nBaseline;
 }
 
diff --git a/starmath/inc/utility.hxx b/starmath/inc/utility.hxx
index e20c96e..f66ecdf 100644
--- a/starmath/inc/utility.hxx
+++ b/starmath/inc/utility.hxx
@@ -33,7 +33,7 @@ inline long SmPtsTo100th_mm(long nNumPts)
     // 72.27 [pt] = 1 [inch] = 2,54 [cm] = 2540 [100th of mm].
     // result is being rounded to the nearest integer.
 {
-    OSL_ENSURE(nNumPts >= 0, "Sm : Ooops...");
+    SAL_WARN_IF( nNumPts < 0, "starmath", "Ooops..." );
     // broken into multiple and fraction of 'nNumPts' to reduce chance
     // of overflow
     // (7227 / 2) is added in order to round to the nearest integer
@@ -53,7 +53,7 @@ inline Fraction Sm100th_mmToPts(long nNum100th_mm)
     // returns the length (in points) that corresponds to the length
     // 'nNum100th_mm' (in 100th of mm).
 {
-    OSL_ENSURE(nNum100th_mm >= 0, "Sm : Ooops...");
+    SAL_WARN_IF( nNum100th_mm < 0, "starmath", "Ooops..." );
     Fraction  aTmp (7227L, 254000L);
     return aTmp *= Fraction(nNum100th_mm);
 }
@@ -61,7 +61,7 @@ inline Fraction Sm100th_mmToPts(long nNum100th_mm)
 
 inline long SmRoundFraction(const Fraction &rFrac)
 {
-    OSL_ENSURE(rFrac > Fraction(), "Sm : Ooops...");
+    SAL_WARN_IF( rFrac <= Fraction(), "starmath", "Ooops..." );
     return (rFrac.GetNumerator() + rFrac.GetDenominator() / 2) / rFrac.GetDenominator();
 }
 
diff --git a/starmath/inc/visitors.hxx b/starmath/inc/visitors.hxx
index ef21763..3e74c53 100644
--- a/starmath/inc/visitors.hxx
+++ b/starmath/inc/visitors.hxx
@@ -165,7 +165,7 @@ public:
     SmCaretPos2LineVisitor( OutputDevice *pDevice, SmCaretPos position ) {
         pDev = pDevice;
         pos = position;
-        OSL_ENSURE( position.IsValid( ), "Cannot draw invalid position!" );
+        SAL_WARN_IF( !position.IsValid(), "starmath", "Cannot draw invalid position!" );
 
         pos.pSelectedNode->Accept( this );
     }
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index 7b6415e..26f9ce7 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -66,13 +66,13 @@ using namespace ::com::sun::star::script;
 SmPrintUIOptions::SmPrintUIOptions()
 {
     ResStringArray      aLocalizedStrings( SmResId( RID_PRINTUIOPTIONS ) );
-    OSL_ENSURE( aLocalizedStrings.Count() >= 18, "resource incomplete" );
+    SAL_WARN_IF( aLocalizedStrings.Count() < 18, "starmath", "resource incomplete" );
     if( aLocalizedStrings.Count() < 9 ) // bad resource ?
         return;
 
     SmModule *pp = SM_MOD();
     SmConfig *pConfig = pp->GetConfig();
-    OSL_ENSURE( pConfig, "SmConfig not found" );
+    SAL_WARN_IF( !pConfig, "starmath", "SmConfig not found" );
     if (!pConfig)
         return;
 
@@ -1052,7 +1052,7 @@ void SAL_CALL SmModel::render(
             while (pViewSh && pViewSh->GetObjectShell() != pDocSh)
                 pViewSh = SfxViewShell::GetNext( *pViewSh, &aTypeId, sal_False /* search non-visible views as well*/ );
             SmViewShell *pView = PTR_CAST( SmViewShell, pViewSh );
-            OSL_ENSURE( pView, "SmModel::render : no SmViewShell found" );
+            SAL_WARN_IF( !pView, "starmath", "SmModel::render : no SmViewShell found" );
 
             if (pView)
             {
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index cef2397..7022cb3 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -158,7 +158,7 @@ void SmGraphicWindow::MouseButtonDown(const MouseEvent& rMEvt)
     // set formula-cursor and selection of edit window according to the
     // position clicked at
     //
-    OSL_ENSURE(rMEvt.GetClicks() > 0, "Sm : 0 clicks");
+    SAL_WARN_IF( rMEvt.GetClicks() == 0, "starmath", "0 clicks" );
     if ( rMEvt.IsLeft() )
     {
         // get click position relativ to formula
@@ -375,7 +375,7 @@ const SmNode * SmGraphicWindow::SetCursorPos(sal_uInt16 nRow, sal_uInt16 nCol)
 
 void SmGraphicWindow::Paint(const Rectangle&)
 {
-    OSL_ENSURE(pViewShell, "Sm : NULL pointer");
+    SAL_WARN_IF( !pViewShell, "starmath", "view shell missing" );
 
     SmDocShell &rDoc = *pViewShell->GetDoc();
     Point aPoint;
@@ -562,7 +562,7 @@ void SmGraphicWindow::Command(const CommandEvent& rCEvt)
                 Point aPos(5, 5);
                 if (rCEvt.IsMouseEvent())
                     aPos = rCEvt.GetMousePosPixel();
-                OSL_ENSURE( pViewShell, "view shell missing" );
+                SAL_WARN_IF( !pViewShell, "starmath", "view shell missing" );
 
                 // added for replaceability of context menus
                 pViewShell->GetViewFrame()->GetBindings().GetDispatcher()
@@ -1337,7 +1337,6 @@ void SmViewShell::Impl_Print(
 
 sal_uInt16 SmViewShell::Print(SfxProgress & /*rProgress*/, sal_Bool /*bIsAPI*/)
 {
-    SAL_INFO( "starmath", "SmViewShell::Print" );
     SAL_WARN( "starmath", "SmViewShell::Print: no longer used with new UI print dialog. Should be removed!!" );
     return 0;
 }
@@ -1396,7 +1395,7 @@ SmEditWindow *SmViewShell::GetEditWindow()
     if (pWrapper != NULL)
     {
         SmEditWindow *pEditWin  = pWrapper->GetEditWindow();
-        OSL_ENSURE( pEditWin, "SmEditWindow missing" );
+        SAL_WARN_IF( !pEditWin, "starmath", "SmEditWindow missing" );
         return pEditWin;
     }
 
@@ -1417,7 +1416,7 @@ void SmViewShell::ShowError( const SmErrorDesc *pErrorDesc )
 {
     SAL_INFO( "starmath", "SmViewShell::ShowError" );
 
-    OSL_ENSURE(GetDoc(), "Sm : Document missing");
+    SAL_WARN_IF( !GetDoc(), "starmath", "Document missing" );
     if (pErrorDesc || 0 != (pErrorDesc = GetDoc()->GetParser().GetError(0)) )
     {
         SetStatusText( pErrorDesc->Text );
@@ -1431,7 +1430,7 @@ void SmViewShell::NextError()
 {
     SAL_INFO( "starmath", "SmViewShell::NextError" );
 
-    OSL_ENSURE(GetDoc(), "Sm : Document missing");
+    SAL_WARN_IF( !GetDoc(), "starmath", "Document missing" );
     const SmErrorDesc   *pErrorDesc = GetDoc()->GetParser().NextError();
 
     if (pErrorDesc)
@@ -1443,7 +1442,7 @@ void SmViewShell::PrevError()
 {
     SAL_INFO( "starmath", "SmViewShell::PrevError" );
 
-    OSL_ENSURE(GetDoc(), "Sm : Document missing");
+    SAL_WARN_IF( !GetDoc(), "starmath", "Document missing" );
     const SmErrorDesc   *pErrorDesc = GetDoc()->GetParser().PrevError();
 
     if (pErrorDesc)
@@ -1574,7 +1573,7 @@ void SmViewShell::Execute(SfxRequest& rReq)
             break;
 
         case SID_ZOOMOUT:
-            OSL_ENSURE(aGraphic.GetZoom() >= 25, "Sm: incorrect sal_uInt16 argument");
+            SAL_WARN_IF( aGraphic.GetZoom() < 25, "starmath", "incorrect sal_uInt16 argument" );
             aGraphic.SetZoom(aGraphic.GetZoom() - 25);
             break;
 
@@ -1793,7 +1792,7 @@ void SmViewShell::Execute(SfxRequest& rReq)
                     if(pFact)
                     {
                         pDlg = pFact->CreateSvxZoomDialog(&GetViewFrame()->GetWindow(), aSet);
-                        OSL_ENSURE(pDlg, "Dialogdiet fail!");
+                        SAL_WARN_IF( !pDlg, "starmath", "Dialogdiet fail!" );
                         pDlg->SetLimits( MINZOOM, MAXZOOM );
                         if( pDlg->Execute() != RET_CANCEL )
                             pSet = pDlg->GetOutputItemSet();
@@ -1872,7 +1871,7 @@ void SmViewShell::Execute(SfxRequest& rReq)
             OutputDevice *pDev = pDoc->GetPrinter();
             if (!pDev || pDev->GetDevFontCount() == 0)
                 pDev = &SM_MOD()->GetDefaultVirtualDev();
-            OSL_ENSURE (pDev, "device for font list missing" );
+            SAL_WARN_IF( !pDev, "starmath", "device for font list missing" );
 
             SmModule *pp = SM_MOD();
             SmSymbolDialog( NULL, pDev, pp->GetSymbolManager(), *this ).Execute();
@@ -2050,8 +2049,8 @@ void SmViewShell::Activate( sal_Bool bIsMDIActivate )
 
 IMPL_LINK( SmViewShell, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg )
 {
-    OSL_ENSURE( _pFileDlg, "SmViewShell::DialogClosedHdl(): no file dialog" );
-    OSL_ENSURE( pImpl->pDocInserter, "ScDocShell::DialogClosedHdl(): no document inserter" );
+    SAL_WARN_IF( !_pFileDlg, "starmath", "SmViewShell::DialogClosedHdl(): no file dialog" );
+    SAL_WARN_IF( !pImpl->pDocInserter, "starmath", "ScDocShell::DialogClosedHdl(): no document inserter" );
 
     if ( ERRCODE_NONE == _pFileDlg->GetError() )
     {
diff --git a/starmath/source/visitors.cxx b/starmath/source/visitors.cxx
index 9305f73..941739c 100644
--- a/starmath/source/visitors.cxx
+++ b/starmath/source/visitors.cxx
@@ -13,163 +13,163 @@
 
 void SmVisitorTest::Visit( SmTableNode* pNode )
 {
-    OSL_ENSURE( pNode->GetType( ) == NTABLE, "the visitor-patterns isn't implemented correctly" );
+    assert( pNode->GetType( ) == NTABLE );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmBraceNode* pNode )
 {
-    OSL_ENSURE( pNode->GetType( ) == NBRACE, "the visitor-patterns isn't implemented correctly" );
+    assert( pNode->GetType( ) == NBRACE );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmBracebodyNode* pNode )
 {
-    OSL_ENSURE( pNode->GetType( ) == NBRACEBODY, "the visitor-patterns isn't implemented correctly" );
+    assert( pNode->GetType( ) == NBRACEBODY );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmOperNode* pNode )
 {
-    OSL_ENSURE( pNode->GetType( ) == NOPER, "the visitor-patterns isn't implemented correctly" );
+    assert( pNode->GetType( ) == NOPER );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmAlignNode* pNode )
 {
-    OSL_ENSURE( pNode->GetType( ) == NALIGN, "the visitor-patterns isn't implemented correctly" );
+    assert( pNode->GetType( ) == NALIGN );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmAttributNode* pNode )
 {
-    OSL_ENSURE( pNode->GetType( ) == NATTRIBUT, "the visitor-patterns isn't implemented correctly" );
+    assert( pNode->GetType( ) == NATTRIBUT );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmFontNode* pNode )
 {
-    OSL_ENSURE( pNode->GetType( ) == NFONT, "the visitor-patterns isn't implemented correctly" );
+    assert( pNode->GetType( ) == NFONT );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmUnHorNode* pNode )
 {
-    OSL_ENSURE( pNode->GetType( ) == NUNHOR, "the visitor-patterns isn't implemented correctly" );
+    assert( pNode->GetType( ) == NUNHOR );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmBinHorNode* pNode )
 {
-    OSL_ENSURE( pNode->GetType( ) == NBINHOR, "the visitor-patterns isn't implemented correctly" );
+    assert( pNode->GetType( ) == NBINHOR );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmBinVerNode* pNode )
 {
-    OSL_ENSURE( pNode->GetType( ) == NBINVER, "the visitor-patterns isn't implemented correctly" );
+    assert( pNode->GetType( ) == NBINVER );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmBinDiagonalNode* pNode )
 {
-    OSL_ENSURE( pNode->GetType( ) == NBINDIAGONAL, "the visitor-patterns isn't implemented correctly" );
+    assert( pNode->GetType( ) == NBINDIAGONAL );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmSubSupNode* pNode )
 {
-    OSL_ENSURE( pNode->GetType( ) == NSUBSUP, "the visitor-patterns isn't implemented correctly" );
+    assert( pNode->GetType( ) == NSUBSUP );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmMatrixNode* pNode )
 {
-    OSL_ENSURE( pNode->GetType( ) == NMATRIX, "the visitor-patterns isn't implemented correctly" );
+    assert( pNode->GetType( ) == NMATRIX );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmPlaceNode* pNode )
 {
-    OSL_ENSURE( pNode->GetType( ) == NPLACE, "the visitor-patterns isn't implemented correctly" );
+    assert( pNode->GetType( ) == NPLACE );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmTextNode* pNode )
 {
-    OSL_ENSURE( pNode->GetType( ) == NTEXT, "the visitor-patterns isn't implemented correctly" );
+    assert( pNode->GetType( ) == NTEXT );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmSpecialNode* pNode )
 {
-    OSL_ENSURE( pNode->GetType( ) == NSPECIAL, "the visitor-patterns isn't implemented correctly" );
+    assert( pNode->GetType( ) == NSPECIAL );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmGlyphSpecialNode* pNode )
 {
-    OSL_ENSURE( pNode->GetType( ) == NGLYPH_SPECIAL, "the visitor-patterns isn't implemented correctly" );
+    assert( pNode->GetType( ) == NGLYPH_SPECIAL );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmMathSymbolNode* pNode )
 {
-    OSL_ENSURE( pNode->GetType( ) == NMATH || pNode->GetType( ) == NMATHIDENT, "the visitor-patterns isn't implemented correctly" );
+    assert( pNode->GetType( ) == NMATH || pNode->GetType( ) == NMATHIDENT );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmBlankNode* pNode )
 {
-    OSL_ENSURE( pNode->GetType( ) == NBLANK, "the visitor-patterns isn't implemented correctly" );
+    assert( pNode->GetType( ) == NBLANK );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmErrorNode* pNode )
 {
-    OSL_ENSURE( pNode->GetType( ) == NERROR, "the visitor-patterns isn't implemented correctly" );
+    assert( pNode->GetType( ) == NERROR );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmLineNode* pNode )
 {
-    OSL_ENSURE( pNode->GetType( ) == NLINE, "the visitor-patterns isn't implemented correctly" );
+    assert( pNode->GetType( ) == NLINE );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmExpressionNode* pNode )
 {
-    OSL_ENSURE( pNode->GetType( ) == NEXPRESSION, "the visitor-patterns isn't implemented correctly" );
+    assert( pNode->GetType( ) == NEXPRESSION );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmPolyLineNode* pNode )
 {
-    OSL_ENSURE( pNode->GetType( ) == NPOLYLINE, "the visitor-patterns isn't implemented correctly" );
+    assert( pNode->GetType( ) == NPOLYLINE );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmRootNode* pNode )
 {
-    OSL_ENSURE( pNode->GetType( ) == NROOT, "the visitor-patterns isn't implemented correctly" );
+    assert( pNode->GetType( ) == NROOT );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmRootSymbolNode* pNode )
 {
-    OSL_ENSURE( pNode->GetType( ) == NROOTSYMBOL, "the visitor-patterns isn't implemented correctly" );
+    assert( pNode->GetType( ) == NROOTSYMBOL );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmRectangleNode* pNode )
 {
-    OSL_ENSURE( pNode->GetType( ) == NRECTANGLE, "the visitor-patterns isn't implemented correctly" );
+    assert( pNode->GetType( ) == NRECTANGLE );
     VisitChildren( pNode );
 }
 
 void SmVisitorTest::Visit( SmVerticalBraceNode* pNode )
 {
-    OSL_ENSURE( pNode->GetType( ) == NVERTICAL_BRACE, "the visitor-patterns isn't implemented correctly" );
+    assert( pNode->GetType( ) == NVERTICAL_BRACE );
     VisitChildren( pNode );
 }
 
@@ -328,7 +328,7 @@ SmCaretDrawingVisitor::SmCaretDrawingVisitor( OutputDevice& rDevice,
     pos = position;
     Offset = offset;
     isCaretVisible = caretVisible;
-    OSL_ENSURE( position.IsValid( ), "Cannot draw invalid position!" );
+    SAL_WARN_IF( !position.IsValid(), "starmath", "Cannot draw invalid position!" );
     if( !position.IsValid( ) )
         return;
 
@@ -708,8 +708,8 @@ void SmDrawingVisitor::Visit( SmRectangleNode* pNode )
     aTmp.Top( )    += nTmpBorderWidth;
     aTmp.Bottom( ) -= nTmpBorderWidth;
 
-    OSL_ENSURE( aTmp.GetHeight( ) > 0  &&  aTmp.GetWidth( ) > 0,
-               "Sm: leeres Rechteck" );
+    SAL_WARN_IF( aTmp.GetHeight() == 0 || aTmp.GetWidth() == 0,
+                "starmath", "Empty rectangle" );
 
     //! avoid GROWING AND SHRINKING of drawn rectangle when constantly
     //! increasing zoomfactor.
@@ -770,7 +770,7 @@ SmSetSelectionVisitor::SmSetSelectionVisitor( SmCaretPos startPos, SmCaretPos en
     IsSelecting = false;
 
     //Assume that pTree is a SmTableNode
-    OSL_ENSURE(pTree->GetType() == NTABLE, "pTree should be a SmTableNode!");
+    SAL_WARN_IF(pTree->GetType() != NTABLE, "starmath", "pTree should be a SmTableNode!");
     //Visit root node, this is special as this node cannot be selected, but its children can!
     if(pTree->GetType() == NTABLE){
         //Change state if StartPos is in front of this node
@@ -779,7 +779,7 @@ SmSetSelectionVisitor::SmSetSelectionVisitor( SmCaretPos startPos, SmCaretPos en
         //Change state if EndPos is in front of this node
         if( EndPos.pSelectedNode == pTree && EndPos.Index == 0 )
             IsSelecting = !IsSelecting;
-        OSL_ENSURE(!IsSelecting, "Caret positions needed to set IsSelecting about, shouldn't be possible!");
+        SAL_WARN_IF(IsSelecting, "starmath", "Caret positions needed to set IsSelecting about, shouldn't be possible!");
 
         //Visit lines
         SmNodeIterator it( pTree );
@@ -795,7 +795,7 @@ SmSetSelectionVisitor::SmSetSelectionVisitor( SmCaretPos startPos, SmCaretPos en
             }
         }
         //Check if pTree isn't selected
-        OSL_ENSURE(!pTree->IsSelected(), "pTree should never be selected!");
+        SAL_WARN_IF(pTree->IsSelected(), "starmath", "pTree should never be selected!");
         //Discard the selection if there's a bug (it's better than crashing)
         if(pTree->IsSelected())
             SetSelectedOnAll(pTree, false);
@@ -966,7 +966,7 @@ SmCaretPosGraphBuildingVisitor::SmCaretPosGraphBuildingVisitor( SmNode* pRootNod
     pRightMost  = NULL;
     pGraph = new SmCaretPosGraph( );
     //pRootNode should always be a table
-    OSL_ENSURE( pRootNode->GetType( ) == NTABLE, "pRootNode must be a table node");
+    SAL_WARN_IF( pRootNode->GetType( ) != NTABLE, "starmath", "pRootNode must be a table node");
     //Handle the special case where NTABLE is used a rootnode
     if( pRootNode->GetType( ) == NTABLE ){
         //Children are SmLineNodes
@@ -1058,10 +1058,10 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmSubSupNode* pNode )
                          *bodyRight;
 
     left = pRightMost;
-    OSL_ENSURE( pRightMost, "pRightMost shouldn't be NULL here!" );
+    SAL_WARN_IF( !pRightMost, "starmath", "pRightMost shouldn't be NULL here!" );
 
     //Create bodyLeft
-    OSL_ENSURE( pNode->GetBody( ), "SmSubSupNode Doesn't have a body!" );
+    SAL_WARN_IF( !pNode->GetBody(), "starmath", "SmSubSupNode Doesn't have a body!" );
     bodyLeft = pGraph->Add( SmCaretPos( pNode->GetBody( ), 0 ), left );
     left->SetRight( bodyLeft ); //TODO: Don't make this if LSUP or LSUB are NULL ( not sure??? )
 
@@ -1310,7 +1310,7 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmMatrixNode* pNode )
  */
 void SmCaretPosGraphBuildingVisitor::Visit( SmTextNode* pNode )
 {
-    OSL_ENSURE( !pNode->GetText().isEmpty(), "Empty SmTextNode is bad" );
+    SAL_WARN_IF( pNode->GetText().isEmpty(), "starmath", "Empty SmTextNode is bad" );
 
     int size = pNode->GetText().getLength();
     for( int i = 1; i <= size; i++ ){
@@ -1351,7 +1351,7 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmBinVerNode* pNode )
 
     //Set left
     left = pRightMost;
-    OSL_ENSURE( pRightMost, "There must be a position in front of this" );
+    SAL_WARN_IF( !pRightMost, "starmath", "There must be a position in front of this" );
 
     //Create right
     right = pGraph->Add( SmCaretPos( pNode, 1 ) );
@@ -1590,7 +1590,7 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmRootNode* pNode )
 {
     SmNode  *pExtra = pNode->GetSubNode( 0 ), //Argument, NULL for sqrt, and SmTextNode if cubicroot
             *pBody  = pNode->GetSubNode( 2 ); //Body of the root
-    OSL_ENSURE( pBody, "pBody cannot be NULL" );
+    SAL_WARN_IF( !pBody, "starmath", "pBody cannot be NULL" );
 
     SmCaretPosGraphEntry  *left,
                         *right,
@@ -1598,7 +1598,7 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmRootNode* pNode )
                         *bodyRight;
 
     //Get left and save it
-    OSL_ENSURE( pRightMost, "There must be a position in front of this" );
+    SAL_WARN_IF( !pRightMost, "starmath", "There must be a position in front of this" );
     left = pRightMost;
 
     //Create body left
@@ -2032,7 +2032,7 @@ SmSelectionDrawingVisitor::SmSelectionDrawingVisitor( OutputDevice& rDevice, SmN
     bHasSelectionArea = false;
 
     //Visit everything
-    OSL_ENSURE( pTree, "pTree can't be null!" );
+    SAL_WARN_IF( !pTree, "starmath", "pTree can't be null!" );
     if( pTree )
         pTree->Accept( this );
 


More information about the Libreoffice-commits mailing list