[Libreoffice-commits] core.git: 7 commits - include/svx svx/source sw/source vcl/source xmloff/source

Michael Stahl mstahl at redhat.com
Tue Nov 25 09:15:49 PST 2014


 include/svx/rulritem.hxx          |   10 +++++
 svx/source/dialog/rulritem.cxx    |    5 +-
 sw/source/core/layout/pagechg.cxx |    2 -
 vcl/source/outdev/map.cxx         |    2 +
 xmloff/source/text/txtimp.cxx     |   53 +++++++++++++---------------
 xmloff/source/text/txtimppr.cxx   |   71 ++++++++++++++++++++------------------
 xmloff/source/text/txtlists.cxx   |   29 +++++----------
 7 files changed, 91 insertions(+), 81 deletions(-)

New commits:
commit 52ce5239b43bf6b9ce1ceddfe90227920aa57657
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Nov 25 16:42:49 2014 +0100

    vcl: assert when LogicToPixel overflows
    
    Change-Id: I86d1c3e0c177c671b280c05b47312c79389884ed

diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index f042168..43ed48e 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -2177,7 +2177,7 @@ void SwRootFrm::CheckViewLayout( const SwViewOption* pViewOpt, const SwRect* pVi
             pSh->SetFirstVisPageInvalid();
             if (bOldCallbackActionEnabled)
             {
-                pSh->InvalidateWindows( SwRect( 0, 0, LONG_MAX, LONG_MAX ) );
+                pSh->InvalidateWindows( SwRect( 0, 0, INT_MAX, INT_MAX ) );
                 pSh->GetDoc()->GetDocShell()->Broadcast(SfxSimpleHint(SFX_HINT_DOCCHANGED));
             }
         }
diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx
index b8bc6c5..5117471 100644
--- a/vcl/source/outdev/map.cxx
+++ b/vcl/source/outdev/map.cxx
@@ -381,6 +381,8 @@ static long ImplLogicToPixel( long n, long nDPI, long nMapNum, long nMapDenom,
        }
     }
     else
+#else
+    assert(n < std::numeric_limits<long>::max() / nMapNum); //detect overflows
 #endif
     {
        sal_Int64 n64 = n;
commit d288ee633d7964cf89a32a96e6e0af8c3c3e0db9
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Nov 25 16:36:45 2014 +0100

    fdo#85858: svx: fix mouse dragging of table row separators in Writer
    
    Add a work-around for Writer's usage of LONG_MAX to SvxColumnDescription:
    on 64-bit platforms the LONG_MAX added in SwView::StateTabWin() for
    SID_RULER_ROWS will overflow in vcl's LogicToPixel mapping and that
    causes wrong positioning of the row highlight lines.
    
    Probably Writer should use something other than LONG_MAX (no reason why
    these types need to be bigger than 32-bit anyway) but that needs a
    bigger cleanup.
    
    (regression from 4c60f722afdc0be5c129ce5f5ed6786d09d0051e)
    
    Change-Id: I08147462356368d48959a85a85ef7dd8dcae0943

diff --git a/svx/source/dialog/rulritem.cxx b/svx/source/dialog/rulritem.cxx
index 11efac1..f993d69 100644
--- a/svx/source/dialog/rulritem.cxx
+++ b/svx/source/dialog/rulritem.cxx
@@ -670,8 +670,9 @@ SvxColumnDescription::SvxColumnDescription(long start, long end, long endMin, lo
     nStart   (start),
     nEnd     (end),
     bVisible (bVis),
-    nEndMin  (endMin),
-    nEndMax  (endMax)
+    // fdo#85858 hack: clamp these to smaller value to prevent overflow
+    nEndMin(std::min<long>(endMin, std::numeric_limits<unsigned short>::max())),
+    nEndMax(std::min<long>(endMax, std::numeric_limits<unsigned short>::max()))
 {}
 
 bool SvxColumnDescription::operator==(const SvxColumnDescription& rCmp) const
commit 19576d843af13df618bad500d2e92cf9bca0a062
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Nov 25 15:14:22 2014 +0100

    svx: add debug printing of SvxColumnDescription
    
    Change-Id: I009e3a506d9b3418215341cb7f3e232e7fcfa04b

diff --git a/include/svx/rulritem.hxx b/include/svx/rulritem.hxx
index 9671f85..a114e2a 100644
--- a/include/svx/rulritem.hxx
+++ b/include/svx/rulritem.hxx
@@ -146,6 +146,16 @@ struct SVX_DLLPUBLIC SvxColumnDescription
     long GetWidth() const;
 };
 
+template<typename charT, typename traits>
+inline std::basic_ostream<charT, traits> & operator <<(
+    std::basic_ostream<charT, traits> & stream, SvxColumnDescription const& dsc)
+{
+    return stream << "{ nStart " << dsc.nStart << " nEnd " << dsc.nEnd
+        << " bVisible " << dsc.bVisible  << " nEndMin " << dsc.nEndMin
+        << " nEndMax " << dsc.nEndMax << " }";
+}
+
+
 class SVX_DLLPUBLIC SvxColumnItem : public SfxPoolItem
 {
     typedef std::vector<SvxColumnDescription> SvxColumnDescriptionVector;
commit 501ae485c7c5f7629f190755f8d1537cfe5a3d4d
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Nov 25 14:49:20 2014 +0100

    xmloff: clean up some debug printfs
    
    Change-Id: I208bbe47d1134b6a362e50d54093e6d35e85f51b

diff --git a/xmloff/source/text/txtlists.cxx b/xmloff/source/text/txtlists.cxx
index 912c9a5..2343364 100644
--- a/xmloff/source/text/txtlists.cxx
+++ b/xmloff/source/text/txtlists.cxx
@@ -76,7 +76,6 @@ XMLTextListsHelper::~XMLTextListsHelper()
 void XMLTextListsHelper::PushListContext(
     XMLTextListBlockContext *i_pListBlock)
 {
-//    fprintf(stderr, "PushListContext\n");
     mListStack.push(::boost::make_tuple(i_pListBlock,
         static_cast<XMLTextListItemContext*>(0),
         static_cast<XMLNumberedParaContext*>(0)));
@@ -85,7 +84,6 @@ void XMLTextListsHelper::PushListContext(
 void XMLTextListsHelper::PushListContext(
     XMLNumberedParaContext *i_pNumberedParagraph)
 {
-//    fprintf(stderr, "PushListContext(NP)\n");
     mListStack.push(::boost::make_tuple(
         static_cast<XMLTextListBlockContext*>(0),
         static_cast<XMLTextListItemContext*>(0), i_pNumberedParagraph));
@@ -94,7 +92,6 @@ void XMLTextListsHelper::PushListContext(
 void XMLTextListsHelper::PopListContext()
 {
     assert(mListStack.size());
-//    fprintf(stderr, "PopListContext\n");
     if ( !mListStack.empty())
         mListStack.pop();
 }
commit 1eb6e229892bb4248fca33259c85c8e26f527c47
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Nov 25 14:48:21 2014 +0100

    xmloff: replace DBG_ASSERTs in txtlists.cxx
    
    Change-Id: I0b7ab0ed27ba23f9ad924819193dd30c70e48fed

diff --git a/xmloff/source/text/txtlists.cxx b/xmloff/source/text/txtlists.cxx
index 27a9a1c..912c9a5 100644
--- a/xmloff/source/text/txtlists.cxx
+++ b/xmloff/source/text/txtlists.cxx
@@ -20,8 +20,6 @@
 
 #include <txtlists.hxx>
 #include <comphelper/random.hxx>
-#include <tools/debug.hxx>
-#include <osl/diagnose.h>
 #include <tools/date.hxx>
 #include <tools/time.hxx>
 
@@ -95,8 +93,7 @@ void XMLTextListsHelper::PushListContext(
 
 void XMLTextListsHelper::PopListContext()
 {
-    OSL_ENSURE(mListStack.size(),
-        "internal error: PopListContext: mListStack empty");
+    assert(mListStack.size());
 //    fprintf(stderr, "PopListContext\n");
     if ( !mListStack.empty())
         mListStack.pop();
@@ -121,11 +118,10 @@ void XMLTextListsHelper::SetListItem( XMLTextListItemContext *i_pListItem )
 {
     // may be cleared by ListBlockContext for upper list...
     if (i_pListItem) {
-        OSL_ENSURE(mListStack.size(),
-            "internal error: SetListItem: mListStack empty");
-        OSL_ENSURE(mListStack.top().get<0>(),
+        assert(mListStack.size());
+        assert(mListStack.top().get<0>() &&
             "internal error: SetListItem: mListStack has no ListBlock");
-        OSL_ENSURE(!mListStack.top().get<1>(),
+        assert(!mListStack.top().get<1>() &&
             "error: SetListItem: list item already exists");
     }
     if ( !mListStack.empty() ) {
@@ -141,7 +137,7 @@ void XMLTextListsHelper::KeepListAsProcessed( const OUString& sListId,
 {
     if ( IsListProcessed( sListId ) )
     {
-        DBG_ASSERT( false,
+        assert(false &&
                     "<XMLTextListsHelper::KeepListAsProcessed(..)> - list id already added" );
         return;
     }
@@ -345,13 +341,13 @@ XMLTextListsHelper::GetNumberedParagraphListId(
     const OUString& i_StyleName)
 {
     if (i_StyleName.isEmpty()) {
-        OSL_FAIL("invalid numbered-paragraph: no style-name");
+        SAL_INFO("xmloff.text", "invalid numbered-paragraph: no style-name");
     }
     if (!i_StyleName.isEmpty()
         && (i_Level < mLastNumberedParagraphs.size())
         && (mLastNumberedParagraphs[i_Level].first == i_StyleName) )
     {
-        OSL_ENSURE(!mLastNumberedParagraphs[i_Level].second.isEmpty(),
+        assert(!mLastNumberedParagraphs[i_Level].second.isEmpty() &&
             "internal error: numbered-paragraph style-name but no list-id?");
         return mLastNumberedParagraphs[i_Level].second;
     } else {
@@ -363,7 +359,7 @@ static void
 ClampLevel(uno::Reference<container::XIndexReplace> const& i_xNumRules,
     sal_Int16 & io_rLevel)
 {
-    OSL_ENSURE(i_xNumRules.is(), "internal error: ClampLevel: NumRules null");
+    assert(i_xNumRules.is());
     if (i_xNumRules.is()) {
         const sal_Int32 nLevelCount( i_xNumRules->getCount() );
         if ( io_rLevel >= nLevelCount ) {
@@ -378,8 +374,8 @@ XMLTextListsHelper::EnsureNumberedParagraph(
     const OUString& i_ListId,
     sal_Int16 & io_rLevel, const OUString& i_StyleName)
 {
-    OSL_ENSURE(!i_ListId.isEmpty(), "invalid ListId");
-    OSL_ENSURE(io_rLevel >= 0, "invalid Level");
+    assert(!i_ListId.isEmpty());
+    assert(io_rLevel >= 0);
     NumParaList_t & rNPList( mNPLists[i_ListId] );
     const OUString none; // default
     if ( rNPList.empty() ) {
@@ -488,7 +484,7 @@ XMLTextListsHelper::MakeNumRule(
 
         xNumRules =
             SvxXMLListStyleContext::CreateNumRule( i_rImport.GetModel() );
-        DBG_ASSERT( xNumRules.is(), "got no numbering rule" );
+        assert(xNumRules.is());
         if ( !xNumRules.is() )
             return xNumRules;
 
commit c0ab2172fc262ea506594f14f513d14597a65221
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Nov 25 14:47:53 2014 +0100

    xmloff: replace DBG_ASSERTs in txtimppr.cxx
    
    Also tweak some of the assertions so they don't fire for character
    borders.
    
    Change-Id: Id63631864ab3e5f0366a514adc1ff73f01f57a84

diff --git a/xmloff/source/text/txtimppr.cxx b/xmloff/source/text/txtimppr.cxx
index 11b00e4..ef38374 100644
--- a/xmloff/source/text/txtimppr.cxx
+++ b/xmloff/source/text/txtimppr.cxx
@@ -17,8 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <tools/debug.hxx>
-#include <osl/diagnose.h>
 #include <osl/thread.h>
 #include <com/sun/star/awt/FontFamily.hpp>
 #include <com/sun/star/awt/FontPitch.hpp>
@@ -58,7 +56,7 @@ bool XMLTextImportPropertyMapper::handleSpecialItem(
     case CTF_FONTNAME_CTL:
         if( GetImport().GetFontDecls() != NULL )
         {
-            DBG_ASSERT(
+            assert((
                 ( CTF_FONTFAMILYNAME ==
                     getPropertySetMapper()->GetEntryContextId(nIndex+1) &&
                   CTF_FONTSTYLENAME ==
@@ -88,8 +86,8 @@ bool XMLTextImportPropertyMapper::handleSpecialItem(
                   CTF_FONTPITCH_CTL ==
                     getPropertySetMapper()->GetEntryContextId(nIndex+4) &&
                   CTF_FONTCHARSET_CTL ==
-                    getPropertySetMapper()->GetEntryContextId(nIndex+5) ),
-                "illegal property map" );
+                    getPropertySetMapper()->GetEntryContextId(nIndex+5) )
+              ) && "illegal property map" );
 
             GetImport().GetFontDecls()->FillProperties(
                             rValue, rProperties,
@@ -197,11 +195,10 @@ void XMLTextImportPropertyMapper::FontDefaultsCheck(
         if( !pFontStyleName )
         {
             aAny <<= sEmpty;
-    #ifdef DBG_UTIL
+    #if OSL_DEBUG_LEVEL > 0
                 sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
                                                 pFontFamilyName->mnIndex + 1 );
-                DBG_ASSERT( nTmp == CTF_FONTSTYLENAME || nTmp == CTF_FONTSTYLENAME_CJK || nTmp == CTF_FONTSTYLENAME_CTL,
-                            "wrong property context id" );
+                assert(nTmp == CTF_FONTSTYLENAME || nTmp == CTF_FONTSTYLENAME_CJK || nTmp == CTF_FONTSTYLENAME_CTL);
     #endif
                 *ppNewFontStyleName = new XMLPropertyState( pFontFamilyName->mnIndex + 1,
                                                        aAny );
@@ -211,11 +208,10 @@ void XMLTextImportPropertyMapper::FontDefaultsCheck(
         {
             aAny <<= (sal_Int16)com::sun::star::awt::FontFamily::DONTKNOW;
 
-    #ifdef DBG_UTIL
+    #if OSL_DEBUG_LEVEL > 0
                 sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
                                                 pFontFamilyName->mnIndex + 2 );
-                DBG_ASSERT( nTmp == CTF_FONTFAMILY || nTmp == CTF_FONTFAMILY_CJK || nTmp == CTF_FONTFAMILY_CTL,
-                            "wrong property context id" );
+                assert(nTmp == CTF_FONTFAMILY || nTmp == CTF_FONTFAMILY_CJK || nTmp == CTF_FONTFAMILY_CTL);
     #endif
                 *ppNewFontFamily = new XMLPropertyState( pFontFamilyName->mnIndex + 2,
                                                        aAny );
@@ -224,11 +220,10 @@ void XMLTextImportPropertyMapper::FontDefaultsCheck(
         if( !pFontPitch )
         {
             aAny <<= (sal_Int16)com::sun::star::awt::FontPitch::DONTKNOW;
-    #ifdef DBG_UTIL
+    #if OSL_DEBUG_LEVEL > 0
                 sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
                                                 pFontFamilyName->mnIndex + 3 );
-                DBG_ASSERT( nTmp == CTF_FONTPITCH || nTmp == CTF_FONTPITCH_CJK || nTmp == CTF_FONTPITCH_CTL,
-                            "wrong property context id" );
+                assert(nTmp == CTF_FONTPITCH || nTmp == CTF_FONTPITCH_CJK || nTmp == CTF_FONTPITCH_CTL);
     #endif
                 *ppNewFontPitch = new XMLPropertyState( pFontFamilyName->mnIndex + 3,
                                                        aAny );
@@ -237,11 +232,10 @@ void XMLTextImportPropertyMapper::FontDefaultsCheck(
         if( !pFontCharSet )
         {
             aAny <<= (sal_Int16)osl_getThreadTextEncoding();
-    #ifdef DBG_UTIL
+    #if OSL_DEBUG_LEVEL > 0
                 sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
                                                 pFontFamilyName->mnIndex + 4 );
-                DBG_ASSERT( nTmp == CTF_FONTCHARSET || nTmp == CTF_FONTCHARSET_CJK || nTmp == CTF_FONTCHARSET_CTL,
-                            "wrong property context id" );
+                assert(nTmp == CTF_FONTCHARSET || nTmp == CTF_FONTCHARSET_CJK || nTmp == CTF_FONTCHARSET_CTL);
     #endif
                 *ppNewFontCharSet = new XMLPropertyState( pFontFamilyName->mnIndex + 4,
                                                        aAny );
@@ -282,19 +276,27 @@ static void lcl_SeparateBorder(
     XMLPropertyState* pAllBorder, XMLPropertyState* pBorders[4],
     XMLPropertyState* pNewBorders[4], XMLPropertyState* pAllBorderWidth,
     XMLPropertyState* pBorderWidths[4]
-#ifdef DBG_UTIL
+#if OSL_DEBUG_LEVEL > 0
     , const rtl::Reference< XMLPropertySetMapper >& rMapper
 #endif
 )
 {
     if( pAllBorderDistance && !pBorderDistances[nIndex] )
     {
-#ifdef DBG_UTIL
+#if OSL_DEBUG_LEVEL > 0
         sal_Int16 nTmp = rMapper->GetEntryContextId(
                                     pAllBorderDistance->mnIndex + nIndex + 1 );
-        DBG_ASSERT( nTmp >= CTF_LEFTBORDERDISTANCE &&
-                    nTmp <= CTF_BOTTOMBORDERDISTANCE,
-                    "wrong property context id" );
+        if (CTF_CHARALLBORDERDISTANCE ==
+                rMapper->GetEntryContextId(pAllBorderDistance->mnIndex))
+        {
+            assert(nTmp >= CTF_CHARLEFTBORDERDISTANCE &&
+                   nTmp <= CTF_CHARBOTTOMBORDERDISTANCE);
+        }
+        else
+        {
+            assert(nTmp >= CTF_LEFTBORDERDISTANCE &&
+                   nTmp <= CTF_BOTTOMBORDERDISTANCE);
+        }
 #endif
         pNewBorderDistances[nIndex] =
             new XMLPropertyState( pAllBorderDistance->mnIndex + nIndex + 1,
@@ -303,11 +305,18 @@ static void lcl_SeparateBorder(
     }
     if( pAllBorder && !pBorders[nIndex] )
     {
-#ifdef DBG_UTIL
+#if OSL_DEBUG_LEVEL > 0
         sal_Int16 nTmp = rMapper->GetEntryContextId(
                                         pAllBorder->mnIndex + nIndex + 1 );
-        DBG_ASSERT( nTmp >= CTF_LEFTBORDER && nTmp <= CTF_BOTTOMBORDER,
-                    "wrong property context id" );
+        if (CTF_CHARALLBORDER ==
+                rMapper->GetEntryContextId(pAllBorder->mnIndex))
+        {
+            assert(nTmp >= CTF_CHARLEFTBORDER && nTmp <= CTF_CHARBOTTOMBORDER);
+        }
+        else
+        {
+            assert(nTmp >= CTF_LEFTBORDER && nTmp <= CTF_BOTTOMBORDER);
+        }
 #endif
         pNewBorders[nIndex] = new XMLPropertyState( pAllBorder->mnIndex + nIndex + 1,
                                                    pAllBorder->maValue );
@@ -531,9 +540,8 @@ void XMLTextImportPropertyMapper::finished(
 #if OSL_DEBUG_LEVEL > 0
             sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
                                         pAllParaMargin->mnIndex + (2*i) + 2 );
-            OSL_ENSURE( nTmp >= CTF_PARALEFTMARGIN &&
-                        nTmp <= CTF_PARABOTTOMMARGIN_REL,
-                        "wrong property context id" );
+            assert(nTmp >= CTF_PARALEFTMARGIN &&
+                   nTmp <= CTF_PARABOTTOMMARGIN_REL);
 #endif
             pNewParaMargins[i].reset(new XMLPropertyState(
                 pAllParaMargin->mnIndex + (2*i) + 2, pAllParaMargin->maValue));
@@ -543,8 +551,7 @@ void XMLTextImportPropertyMapper::finished(
 #if OSL_DEBUG_LEVEL > 0
             sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
                                         pAllMargin->mnIndex + i + 1 );
-            OSL_ENSURE( nTmp >= CTF_MARGINLEFT && nTmp <= CTF_MARGINBOTTOM,
-                        "wrong property context id" );
+            assert(nTmp >= CTF_MARGINLEFT && nTmp <= CTF_MARGINBOTTOM);
 #endif
             pNewMargins[i].reset(new XMLPropertyState(
                 pAllMargin->mnIndex + i + 1, pAllMargin->maValue));
@@ -554,7 +561,7 @@ void XMLTextImportPropertyMapper::finished(
             i, pAllBorderDistance, pBorderDistances, pNewBorderDistances,
             pAllBorder, pBorders, pNewBorders,
             pAllBorderWidth, pBorderWidths
-#ifdef DBG_UTIL
+#if OSL_DEBUG_LEVEL > 0
             , getPropertySetMapper()
 #endif
             );
@@ -563,7 +570,7 @@ void XMLTextImportPropertyMapper::finished(
             i, pCharAllBorderDistance, pCharBorderDistances,
             pCharNewBorderDistances, pCharAllBorder, pCharBorders,
             pCharNewBorders, pCharAllBorderWidth, pCharBorderWidths
-#ifdef DBG_UTIL
+#if OSL_DEBUG_LEVEL > 0
             , getPropertySetMapper()
 #endif
             );
commit 7501084112d414688456d6129047b7c1976b7928
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Nov 25 14:47:32 2014 +0100

    xmloff: replace DBG_ASSERTs in txtimp.cxx
    
    Change-Id: I7f3ed82652e98da767cf7021bc5fc42e31e80b73

diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index d70efff..efc6ca9 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -34,8 +34,6 @@
 #include <xmloff/xmlnmspe.hxx>
 #include <xmloff/txtstyli.hxx>
 #include <xmloff/xmlnumi.hxx>
-#include <tools/debug.hxx>
-#include <osl/diagnose.h>
 #include <xmloff/maptype.hxx>
 
 #include "txtparai.hxx"
@@ -919,7 +917,7 @@ XMLTextImportHelper::XMLTextImportHelper(
                     OUString sListId;
                     xNumRuleProps->getPropertyValue(s_PropNameDefaultListId)
                         >>= sListId;
-                    DBG_ASSERT( !sListId.isEmpty(),
+                    assert( !sListId.isEmpty() &&
                                 "no default list id found at chapter numbering rules instance. Serious defect -> please inform OD." );
                     if ( !sListId.isEmpty() )
                     {
@@ -1097,8 +1095,8 @@ bool XMLTextImportHelper::HasFrameByName( const OUString& rName ) const
 
 void XMLTextImportHelper::InsertString( const OUString& rChars )
 {
-    DBG_ASSERT(m_pImpl->m_xText.is(), "no text");
-    DBG_ASSERT(m_pImpl->m_xCursorAsRange.is(), "no range");
+    assert(m_pImpl->m_xText.is());
+    assert(m_pImpl->m_xCursorAsRange.is());
     if (m_pImpl->m_xText.is())
     {
         m_pImpl->m_xText->insertString(m_pImpl->m_xCursorAsRange,
@@ -1109,8 +1107,8 @@ void XMLTextImportHelper::InsertString( const OUString& rChars )
 void XMLTextImportHelper::InsertString( const OUString& rChars,
                                         bool& rIgnoreLeadingSpace )
 {
-    DBG_ASSERT(m_pImpl->m_xText.is(), "no text");
-    DBG_ASSERT(m_pImpl->m_xCursorAsRange.is(), "no range");
+    assert(m_pImpl->m_xText.is());
+    assert(m_pImpl->m_xCursorAsRange.is());
     if (m_pImpl->m_xText.is())
     {
         sal_Int32 nLen = rChars.getLength();
@@ -1142,8 +1140,8 @@ void XMLTextImportHelper::InsertString( const OUString& rChars,
 
 void XMLTextImportHelper::InsertControlCharacter( sal_Int16 nControl )
 {
-    DBG_ASSERT(m_pImpl->m_xText.is(), "no text");
-    DBG_ASSERT(m_pImpl->m_xCursorAsRange.is(), "no range");
+    assert(m_pImpl->m_xText.is());
+    assert(m_pImpl->m_xCursorAsRange.is());
     if (m_pImpl->m_xText.is())
     {
         m_pImpl->m_xText->insertControlCharacter(
@@ -1154,8 +1152,8 @@ void XMLTextImportHelper::InsertControlCharacter( sal_Int16 nControl )
 void XMLTextImportHelper::InsertTextContent(
     Reference < XTextContent > & xContent )
 {
-    DBG_ASSERT(m_pImpl->m_xText.is(), "no text");
-    DBG_ASSERT(m_pImpl->m_xCursorAsRange.is(), "no range");
+    assert(m_pImpl->m_xText.is());
+    assert(m_pImpl->m_xCursorAsRange.is());
     if (m_pImpl->m_xText.is())
     {
         try {
@@ -1169,9 +1167,9 @@ void XMLTextImportHelper::InsertTextContent(
 
 void XMLTextImportHelper::DeleteParagraph()
 {
-    DBG_ASSERT(m_pImpl->m_xText.is(), "no text");
-    DBG_ASSERT(m_pImpl->m_xCursor.is(), "no cursor");
-    DBG_ASSERT(m_pImpl->m_xCursorAsRange.is(), "no range");
+    assert(m_pImpl->m_xText.is());
+    assert(m_pImpl->m_xCursor.is());
+    assert(m_pImpl->m_xCursorAsRange.is());
 
     bool bDelete = true;
     Reference < XEnumerationAccess > const xEnumAccess(
@@ -1179,11 +1177,12 @@ void XMLTextImportHelper::DeleteParagraph()
     if( xEnumAccess.is() )
     {
         Reference < XEnumeration > xEnum(xEnumAccess->createEnumeration());
-        DBG_ASSERT( xEnum->hasMoreElements(), "empty text enumeration" );
+        SAL_WARN_IF(!xEnum->hasMoreElements(), "xmloff.text",
+                "empty text enumeration");
         if( xEnum->hasMoreElements() )
         {
             Reference < XComponent > xComp( xEnum->nextElement(), UNO_QUERY );
-            DBG_ASSERT( xComp.is(), "got no component" );
+            assert(xComp.is());
             if( xComp.is() )
             {
                 xComp->dispose();
@@ -1480,7 +1479,7 @@ OUString XMLTextImportHelper::SetStyleAndAttrs(
         GetTextListHelper().ListContextTop(
             pListBlock, pListItem, pNumberedParagraph);
 
-        OSL_ENSURE(!(pListBlock && pNumberedParagraph), "XMLTextImportHelper::"
+        assert(!(pListBlock && pNumberedParagraph) && "XMLTextImportHelper::"
             "SetStyleAndAttrs: both list and numbered-paragraph???");
 
         Reference < XIndexReplace > xNewNumRules;
@@ -1619,11 +1618,6 @@ OUString XMLTextImportHelper::SetStyleAndAttrs(
                 sal_Int32 nUPD( 0 );
                 sal_Int32 nBuild( 0 );
                 const bool bBuildIdFound = rImport.getBuildIds( nUPD, nBuild );
-                DBG_ASSERT( ( bBuildIdFound && nUPD == 680 ) ||
-                            !pStyle ||
-                            !pStyle->IsListStyleSet() ||
-                            pStyle->GetListStyle().isEmpty(),
-                            "automatic paragraph style with list style name, but paragraph not in list???" );
                 if ( ( bBuildIdFound && nUPD == 680 ) ||
                      !pStyle || !pStyle->IsListStyleSet() )
                 {
@@ -1641,6 +1635,12 @@ OUString XMLTextImportHelper::SetStyleAndAttrs(
                         }
                     }
                 }
+                else
+                {
+                    SAL_INFO_IF(!pStyle->GetListStyle().isEmpty(),
+                        "xmloff.text",
+                        "automatic paragraph style with list style name, but paragraph not in list???");
+                }
                 if ( bRemove )
                 {
                     xPropSet->setPropertyValue( s_NumberingRules, Any() );
@@ -2566,8 +2566,7 @@ void XMLTextImportHelper::popFieldCtx()
 
 void XMLTextImportHelper::addFieldParam( const OUString& name, const OUString& value )
 {
-    DBG_ASSERT(!m_pImpl->m_FieldStack.empty(),
-        "stack is empty: not good! Do a pushFieldCtx before...");
+    assert(!m_pImpl->m_FieldStack.empty());
     if (!m_pImpl->m_FieldStack.empty()) {
         Impl::field_stack_item_t & FieldStackItem(m_pImpl->m_FieldStack.top());
         FieldStackItem.second.push_back(Impl::field_param_t( name, value ));
@@ -2576,8 +2575,7 @@ void XMLTextImportHelper::addFieldParam( const OUString& name, const OUString& v
 
 OUString XMLTextImportHelper::getCurrentFieldType()
 {
-    DBG_ASSERT(!m_pImpl->m_FieldStack.empty(),
-        "stack is empty: not good! Do a pushFieldCtx before...");
+    assert(!m_pImpl->m_FieldStack.empty());
     if (!m_pImpl->m_FieldStack.empty())
     {
         return m_pImpl->m_FieldStack.top().first.second;
@@ -2595,8 +2593,7 @@ bool XMLTextImportHelper::hasCurrentFieldCtx()
 
 void XMLTextImportHelper::setCurrentFieldParamsTo(::com::sun::star::uno::Reference< ::com::sun::star::text::XFormField> &xFormField)
 {
-    DBG_ASSERT(!m_pImpl->m_FieldStack.empty(),
-        "stack is empty: not good! Do a pushFieldCtx before...");
+    assert(!m_pImpl->m_FieldStack.empty());
     if (!m_pImpl->m_FieldStack.empty() && xFormField.is())
     {
         FieldParamImporter(&m_pImpl->m_FieldStack.top().second,


More information about the Libreoffice-commits mailing list