[Libreoffice-commits] core.git: 2 commits - sw/source
Michael Stahl
mstahl at redhat.com
Thu Nov 20 03:07:57 PST 2014
sw/source/core/edit/edundo.cxx | 15 ++++++---------
sw/source/core/txtnode/thints.cxx | 15 +++++++--------
sw/source/core/unocore/unocoll.cxx | 16 +++++++++-------
sw/source/core/unocore/unorefmk.cxx | 14 +++++++-------
sw/source/core/unocore/unotbl.cxx | 10 +++++-----
sw/source/uibase/shells/frmsh.cxx | 27 +++++++++++++--------------
6 files changed, 47 insertions(+), 50 deletions(-)
New commits:
commit 47bc38926f18c9cfa93722e98ab29ce69658c9b8
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Nov 20 12:00:48 2014 +0100
sw: convert more legacy asserts
Change-Id: I602913a1cfb8dda072945770a585e6cd9fd3e134
diff --git a/sw/source/core/edit/edundo.cxx b/sw/source/core/edit/edundo.cxx
index e3a928d..f657c06 100644
--- a/sw/source/core/edit/edundo.cxx
+++ b/sw/source/core/edit/edundo.cxx
@@ -132,9 +132,8 @@ bool SwEditShell::Undo(sal_uInt16 const nCount)
|| bRet;
}
} catch (const ::com::sun::star::uno::Exception & e) {
- OSL_TRACE("SwEditShell::Undo(): exception caught:\n %s",
- OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8)
- .getStr());
+ SAL_WARN("sw.core",
+ "SwEditShell::Undo(): exception caught: " << e.Message);
}
if (bRestoreCrsr)
@@ -189,9 +188,8 @@ bool SwEditShell::Redo(sal_uInt16 const nCount)
|| bRet;
}
} catch (const ::com::sun::star::uno::Exception & e) {
- OSL_TRACE("SwEditShell::Redo(): exception caught:\n %s",
- OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8)
- .getStr());
+ SAL_WARN("sw.core",
+ "SwEditShell::Redo(): exception caught: " << e.Message);
}
Pop( !bRestoreCrsr );
@@ -220,9 +218,8 @@ bool SwEditShell::Repeat(sal_uInt16 const nCount)
bRet = GetDoc()->GetIDocumentUndoRedo().Repeat( context, nCount )
|| bRet;
} catch (const ::com::sun::star::uno::Exception & e) {
- OSL_TRACE("SwEditShell::Repeat(): exception caught:\n %s",
- OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8)
- .getStr());
+ SAL_WARN("sw.core",
+ "SwEditShell::Repeat(): exception caught: " << e.Message);
}
EndAllAction();
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index 0e089f3..5ec497a 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -389,7 +389,7 @@ SwpHints::TryInsertNesting( SwTxtNode & rNode, SwTxtAttrNesting & rNewHint )
switch (splitPolicy(nNewWhich, nOtherWhich))
{
case FAIL:
- OSL_TRACE("cannot insert hint: overlap detected");
+ SAL_INFO("sw.core", "cannot insert hint: overlap");
::std::for_each(SplitNew.begin(), SplitNew.end(),
TxtAttrDeleter(*rNode.GetDoc()));
return false;
@@ -485,7 +485,7 @@ SwpHints::TryInsertNesting( SwTxtNode & rNode, SwTxtAttrNesting & rNewHint )
{
if ( MAX_HINTS <= Count() )
{
- OSL_FAIL("hints array full :-(");
+ SAL_INFO("sw.core", "hints array full :-(");
return false;
}
SwTxtAttrNesting * const pOtherLeft(
@@ -504,7 +504,7 @@ SwpHints::TryInsertNesting( SwTxtNode & rNode, SwTxtAttrNesting & rNewHint )
{
if ( MAX_HINTS <= Count() )
{
- OSL_FAIL("hints array full :-(");
+ SAL_INFO("sw.core", "hints array full :-(");
return false;
}
SwTxtAttrNesting * const pOtherRight(
@@ -522,7 +522,7 @@ SwpHints::TryInsertNesting( SwTxtNode & rNode, SwTxtAttrNesting & rNewHint )
if ( MAX_HINTS <= Count() || MAX_HINTS - Count() <= SplitNew.size() )
{
- OSL_FAIL("hints array full :-(");
+ SAL_INFO("sw.core", "hints array full :-(");
return false;
}
@@ -600,9 +600,8 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint,
std::vector<SwTxtAttr*> aInsDelHints;
std::vector<SwTxtAttr*>::iterator aIter;
- OSL_ENSURE( RES_TXTATR_CHARFMT == rNewHint.Which() ||
- RES_TXTATR_AUTOFMT == rNewHint.Which(),
- "Expecting CHARFMT or AUTOFMT" );
+ assert( RES_TXTATR_CHARFMT == rNewHint.Which() ||
+ RES_TXTATR_AUTOFMT == rNewHint.Which() );
// 2. Find the hints which cover the start and end position
// of the new hint. These hints have to be split into two portions:
@@ -1101,7 +1100,7 @@ SwTxtAttr* MakeTxtAttr(
static_cast<SwFmtMeta&>(rNew), nStt, nEnd, bIsCopy == COPY );
break;
default:
- OSL_ENSURE(RES_TXTATR_AUTOFMT == rNew.Which(), "unknown attribute");
+ assert(RES_TXTATR_AUTOFMT == rNew.Which());
pNew = new SwTxtAttrEnd( rNew, nStt, nEnd );
break;
}
diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index 91630f0..3cc26eb 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -143,7 +143,6 @@ public:
OUString sCodeName;
if ( mpDocShell )
{
- OSL_TRACE( "*** In ScVbaCodeNameProvider::getCodeNameForObject");
// need to find the page ( and index ) for this control
uno::Reference< drawing::XDrawPageSupplier > xSupplier( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
uno::Reference< container::XIndexAccess > xIndex( xSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
@@ -209,9 +208,8 @@ public:
OUString sProjectName;
aElement >>= sProjectName;
- OSL_TRACE("** Template cache inserting template name %s with project %s"
- , OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr()
- , OUStringToOString( sProjectName, RTL_TEXTENCODING_UTF8 ).getStr() );
+ SAL_INFO("sw.uno", "Template cache inserting template name " << aName
+ << " with project " << sProjectName);
mTemplateToProject[ aName ] = sProjectName;
}
@@ -262,11 +260,12 @@ public:
{
if ( !hasByName( aName ) )
throw container::NoSuchElementException();
- uno::Sequence< uno::Any > aArgs( 2 );
+ uno::Sequence< uno::Any > aArgs( 2 );
aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() );
aArgs[1] = uno::Any( mpDocShell->GetModel() );
uno::Reference< uno::XInterface > xDocObj = ooo::vba::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.word.Document" , aArgs );
- OSL_TRACE("Creating Object ( ooo.vba.word.Document ) 0x%p", xDocObj.get() );
+ SAL_INFO("sw.uno",
+ "Creating Object ( ooo.vba.word.Document ) 0x" << xDocObj.get());
return uno::makeAny( xDocObj );
}
virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
@@ -816,9 +815,12 @@ SwXServiceProvider::MakeInstance(sal_uInt16 nObjectType, SwDoc & rDoc)
// paste, there should be no data provider, so that own data is used
// This should not happen during copy/paste, as this will unlink
// charts using table data.
- OSL_ASSERT(rDoc.GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED);
if (rDoc.GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED)
xRet = (cppu::OWeakObject*) rDoc.getIDocumentChartDataProviderAccess().GetChartDataProvider( true /* create - if not yet available */ );
+ else
+ SAL_WARN("sw.uno",
+ "not creating chart data provider for embedded object");
+
break;
case SW_SERVICE_TYPE_META:
xRet = SwXMeta::CreateXMeta(rDoc, false);
diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx
index 9cc6a33..96a55a3 100644
--- a/sw/source/core/unocore/unorefmk.cxx
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -542,9 +542,9 @@ public:
// XInterface
virtual void SAL_CALL acquire() throw() SAL_OVERRIDE
- { OSL_FAIL("ERROR: SwXMetaText::acquire"); }
+ { assert(false); }
virtual void SAL_CALL release() throw() SAL_OVERRIDE
- { OSL_FAIL("ERROR: SwXMetaText::release"); }
+ { assert(false); }
// XTypeProvider
virtual uno::Sequence< sal_Int8 > SAL_CALL
@@ -750,7 +750,7 @@ SwXMeta::CreateXMeta(::sw::Meta & rMeta,
const uno::Reference<lang::XUnoTunnel> xUT(xMeta, uno::UNO_QUERY);
SwXMeta *const pXMeta(
::sw::UnoTunnelGetImplementation<SwXMeta>(xUT));
- OSL_ENSURE(pXMeta, "no pXMeta?");
+ assert(pXMeta);
// NB: the meta must always be created with the complete content
// if SwXTextPortionEnumeration is created for a selection,
// it must be checked that the Meta is contained in the selection!
@@ -758,7 +758,7 @@ SwXMeta::CreateXMeta(::sw::Meta & rMeta,
// ??? is this necessary?
if (pXMeta->m_pImpl->m_xParentText.get() != i_xParent.get())
{
- OSL_FAIL("SwXMeta with different parent?");
+ SAL_WARN("sw.uno", "SwXMeta with different parent?");
pXMeta->m_pImpl->m_xParentText.set(i_xParent);
}
}
@@ -767,13 +767,13 @@ SwXMeta::CreateXMeta(::sw::Meta & rMeta,
// create new SwXMeta
SwTxtNode * const pTxtNode( rMeta.GetTxtNode() );
- OSL_ENSURE(pTxtNode, "CreateXMeta: no text node?");
+ SAL_WARN_IF(!pTxtNode, "sw.uno", "CreateXMeta: no text node?");
if (!pTxtNode) { return 0; }
uno::Reference<text::XText> xParentText(i_xParent);
if (!xParentText.is())
{
SwTxtMeta * const pTxtAttr( rMeta.GetTxtAttr() );
- OSL_ENSURE(pTxtAttr, "CreateXMeta: no text attr?");
+ SAL_WARN_IF(!pTxtAttr, "sw.uno", "CreateXMeta: no text attr?");
if (!pTxtAttr) { return 0; }
const SwPosition aPos(*pTxtNode, pTxtAttr->GetStart());
xParentText.set( ::sw::CreateParentXText(*pTxtNode->GetDoc(), aPos) );
@@ -971,7 +971,7 @@ SwXMeta::dispose() throw (uno::RuntimeException, std::exception)
pDoc->getIDocumentContentOperations().DeleteAndJoin( aPam );
// removal should call Modify and do the dispose
- OSL_ENSURE(m_pImpl->m_bIsDisposed, "zombie meta");
+ assert(m_pImpl->m_bIsDisposed);
}
}
}
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index dcfdf18..dc88bfc 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -516,15 +516,15 @@ const SwTableBox* lcl_FindCornerTableBox(const SwTableLines& rTableLines, const
{
const SwTableLines& rLines(bFirst ? rTableLines : pBox->GetTabLines());
bFirst = false;
- OSL_ASSERT(rLines.size() != 0);
+ assert(rLines.size() != 0);
if (!rLines.empty())
{
const SwTableLine* pLine(i_bTopLeft ? rLines.front() : rLines.back());
- OSL_ASSERT(pLine);
+ assert(pLine);
const SwTableBoxes& rBoxes(pLine->GetTabBoxes());
- OSL_ASSERT(rBoxes.size() != 0);
+ assert(rBoxes.size() != 0);
pBox = i_bTopLeft ? rBoxes.front() : rBoxes.back();
- OSL_ASSERT(pBox);
+ assert(pBox);
}
else
{
@@ -1062,7 +1062,7 @@ void SwXCell::setPropertyValue(const OUString& rPropertyName, const uno::Any& aV
SvxFrameDirection eDir = FRMDIR_ENVIRONMENT;
sal_Int16 nNum = 0;
aValue >>= nNum;
- OSL_TRACE("FRMDirection val %d", nNum );
+ SAL_INFO("sw.uno", "FRMDirection val " << nNum);
switch (nNum)
{
case 0:
commit 537a2f4b1a11a2b97e9f2fb41d69ec443449ee57
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Nov 20 11:44:12 2014 +0100
sw: convert legacy assertions in frmsh.cxx
Change-Id: If23d47cdee2ab6f4e7f728da02c0db6d23407c8f
diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx
index 6d64d75..8ba06c9 100644
--- a/sw/source/uibase/shells/frmsh.cxx
+++ b/sw/source/uibase/shells/frmsh.cxx
@@ -43,7 +43,6 @@
#include <svx/hlnkitem.hxx>
#include <svx/svdview.hxx>
#include <vcl/msgbox.hxx>
-#include <tools/diagnose_ex.h>
#include <doc.hxx>
#include <drawdoc.hxx>
@@ -242,10 +241,10 @@ void SwFrameShell::Execute(SfxRequest &rReq)
case FN_FORMAT_FOOTNOTE_DLG:
{
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
+ assert(pFact);
boost::scoped_ptr<VclAbstractDialog> pDlg(pFact->CreateSwFootNoteOptionDlg(GetView().GetWindow(), GetView().GetWrtShell()));
- OSL_ENSURE(pDlg, "Dialog creation failed!");
+ assert(pDlg);
pDlg->Execute();
break;
}
@@ -253,10 +252,10 @@ void SwFrameShell::Execute(SfxRequest &rReq)
{
SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1);
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialog creation failed!");
+ assert(pFact);
boost::scoped_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateSwTabDialog( DLG_TAB_OUTLINE,
GetView().GetWindow(), &aTmp, GetView().GetWrtShell()));
- OSL_ENSURE(pDlg, "Dialog creation failed!");
+ assert(pDlg);
pDlg->Execute();
pDlg.reset();
rReq.Done();
@@ -499,7 +498,7 @@ void SwFrameShell::Execute(SfxRequest &rReq)
FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &GetView()));
SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric) ));
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialog creation failed!");
+ assert(pFact);
boost::scoped_ptr<SfxAbstractTabDialog> pDlg(pFact->CreateFrmTabDialog(
nSel & nsSelectionType::SEL_GRF ? OUString("PictureDialog") :
nSel & nsSelectionType::SEL_OLE ? OUString("ObjectDialog"):
@@ -509,7 +508,7 @@ void SwFrameShell::Execute(SfxRequest &rReq)
aSet, false,
false,
sDefPage));
- OSL_ENSURE(pDlg, "Dialog creation failed!");
+ assert(pDlg);
if ( nSlot == FN_DRAW_WRAP_DLG )
{
@@ -583,7 +582,7 @@ void SwFrameShell::Execute(SfxRequest &rReq)
//needs cast - no non-const method available
SwFrmFmt* pPrevFmt = (SwFrmFmt*)
lcl_GetFrmFmtByName(rSh, sPrevName);
- OSL_ENSURE(pPrevFmt, "No frame found!");
+ SAL_WARN_IF(!pPrevFmt, "sw.ui", "No frame found!");
if(pPrevFmt)
{
rSh.Chain(*pPrevFmt, *pCurrFlyFmt);
@@ -617,7 +616,7 @@ void SwFrameShell::Execute(SfxRequest &rReq)
//needs cast - no non-const method available
SwFrmFmt* pNextFmt = (SwFrmFmt*)
lcl_GetFrmFmtByName(rSh, sNextName);
- OSL_ENSURE(pNextFmt, "No frame found!");
+ SAL_WARN_IF(!pNextFmt, "sw.ui", "No frame found!");
if(pNextFmt)
{
rSh.Chain(*(SwFrmFmt*)
@@ -657,12 +656,12 @@ void SwFrameShell::Execute(SfxRequest &rReq)
OUString aTitle(rSh.GetObjTitle());
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialog creation failed!");
+ assert(pFact);
boost::scoped_ptr<AbstractSvxObjectTitleDescDialog> pDlg(
pFact->CreateSvxObjectTitleDescDialog( NULL,
aTitle,
aDescription ));
- OSL_ENSURE(pDlg, "Dialog creation failed!");
+ assert(pDlg);
if ( pDlg->Execute() == RET_OK )
{
@@ -676,7 +675,7 @@ void SwFrameShell::Execute(SfxRequest &rReq)
}
break;
default:
- OSL_ENSURE( false, "wrong dispatcher" );
+ assert(!"wrong dispatcher");
return;
}
if ( bUpdateMgr )
@@ -1290,13 +1289,13 @@ void SwFrameShell::ExecDrawDlgTextFrame(SfxRequest& rReq)
rSh.GetFlyFrmAttr(aNewAttr);
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- DBG_ASSERT(pFact, "Dialog creation failed!");
+ assert(pFact);
boost::scoped_ptr<AbstractSvxAreaTabDialog> pDlg(pFact->CreateSvxAreaTabDialog(
NULL,
&aNewAttr,
pDoc,
false));
- DBG_ASSERT(pDlg, "Dialog creation failed!");
+ assert(pDlg);
if(RET_OK == pDlg->Execute())
{
More information about the Libreoffice-commits
mailing list