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