[Libreoffice-commits] core.git: 3 commits - sfx2/source svl/source sw/source

Michael Stahl mstahl at redhat.com
Thu Dec 1 22:33:21 UTC 2016


 sfx2/source/doc/SfxDocumentMetaData.cxx |   49 ++++++++++++--------------------
 svl/source/items/aeitem.cxx             |    6 +--
 svl/source/items/cenumitm.cxx           |    6 +--
 svl/source/items/cintitem.cxx           |   16 +++++-----
 sw/source/core/view/viewsh.cxx          |    6 +++
 5 files changed, 39 insertions(+), 44 deletions(-)

New commits:
commit 002c1f7223a0363f848d37062a0043d63255ad94
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Dec 1 22:56:21 2016 +0100

    tdf#101464 fix SwAccessibleMap::mpEvents assertions switching PrintPreview
    
    The problem here is that when switching to the print preview, there are
    2 view shells, SwEditShell::UpdateTable() is called and the first one
    does some layouting in ImplEndAction(); this creates a11y events for the
    2nd print preview one (see loops in SwViewShellImp::Invalidate*) and
    stores them in the SwAccessibleMap since there is an Action going on;
    then SwViewShell::ImplEndAction() for the print preview shell is called
    but it returns early without sending out the events, so they remain
    until the ~SwAccessibleMap asserts about them.
    
    Change-Id: Ie1c6b82fc5f2cdb2998d514a632295ad07e97517

diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 83a58af..2d362a2 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -235,6 +235,12 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd )
     {
         mbPaintWorks = true;
         UISizeNotify();
+        // tdf#101464 print preview may generate events if another view shell
+        // performs layout...
+        if (IsPreview() && Imp()->IsAccessible())
+        {
+            Imp()->FireAccessibleEvents();
+        }
         return;
     }
 
commit 745fe08e187ef623486b54e3036075748e789339
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Dec 1 15:29:05 2016 +0100

    svl: convert some legacy DBG_ASSERT
    
    Change-Id: I8fc4d849e434e245d871dc2d2eef42713e1359bb

diff --git a/svl/source/items/aeitem.cxx b/svl/source/items/aeitem.cxx
index c4f9f11..6ad2c76 100644
--- a/svl/source/items/aeitem.cxx
+++ b/svl/source/items/aeitem.cxx
@@ -93,13 +93,13 @@ sal_uInt16 SfxAllEnumItem::GetValueCount() const
 
 OUString SfxAllEnumItem::GetValueTextByPos( sal_uInt16 nPos ) const
 {
-    DBG_ASSERT( pValues && nPos < pValues->size(), "enum overflow" );
+    assert(pValues && nPos < pValues->size());
     return (*pValues)[nPos].aText;
 }
 
 sal_uInt16 SfxAllEnumItem::GetValueByPos( sal_uInt16 nPos ) const
 {
-    DBG_ASSERT( pValues && nPos < pValues->size(), "enum overflow" );
+    assert(pValues && nPos < pValues->size());
     return (*pValues)[nPos].nValue;
 }
 
@@ -192,7 +192,7 @@ bool SfxAllEnumItem::IsEnabled( sal_uInt16 nValue ) const
 void SfxAllEnumItem::RemoveValue( sal_uInt16 nValue )
 {
     sal_uInt16 nPos = GetPosByValue(nValue);
-    DBG_ASSERT( nPos != USHRT_MAX, "removing value not in enum" );
+    assert(nPos != USHRT_MAX);
     pValues->erase( pValues->begin() + nPos );
 }
 
diff --git a/svl/source/items/cenumitm.cxx b/svl/source/items/cenumitm.cxx
index e31ce2c..187eb73 100644
--- a/svl/source/items/cenumitm.cxx
+++ b/svl/source/items/cenumitm.cxx
@@ -65,7 +65,7 @@ bool SfxEnumItemInterface::PutValue(const css::uno::Any& rVal,
         SetEnumValue(sal_uInt16(nTheValue));
         return true;
     }
-    OSL_FAIL("SfxEnumItemInterface::PutValue(): Wrong type");
+    SAL_WARN("svl.items", "SfxEnumItemInterface::PutValue(): Wrong type");
     return false;
 }
 
@@ -141,7 +141,7 @@ void SfxEnumItem::SetEnumValue(sal_uInt16 const nTheValue)
 
 void SfxEnumItem::SetValue(sal_uInt16 const nTheValue)
 {
-    DBG_ASSERT(GetRefCount() == 0, "SfxEnumItem::SetValue(): Pooled item");
+    assert(GetRefCount() == 0 && "SfxEnumItem::SetValue(): Pooled item");
     m_nValue = nTheValue;
 }
 
@@ -199,7 +199,7 @@ bool SfxBoolItem::PutValue(const css::uno::Any& rVal, sal_uInt8)
         m_bValue = bTheValue;
         return true;
     }
-    OSL_FAIL("SfxBoolItem::PutValue(): Wrong type");
+    SAL_WARN("svl.items", "SfxBoolItem::PutValue(): Wrong type");
     return false;
 }
 
diff --git a/svl/source/items/cintitem.cxx b/svl/source/items/cintitem.cxx
index a6c73d0..bb5aaea 100644
--- a/svl/source/items/cintitem.cxx
+++ b/svl/source/items/cintitem.cxx
@@ -57,7 +57,7 @@ bool CntByteItem::PutValue(const css::uno::Any& rVal, sal_uInt8)
         return true;
     }
 
-    OSL_FAIL( "CntByteItem::PutValue - Wrong type!" );
+    SAL_WARN("svl.items", "CntByteItem::PutValue - Wrong type!");
     return false;
 }
 
@@ -123,12 +123,12 @@ bool CntUInt16Item::PutValue(const css::uno::Any& rVal, sal_uInt8)
     sal_Int32 nValue = 0;
     if (rVal >>= nValue)
     {
-        DBG_ASSERT( nValue <= USHRT_MAX, "Overflow in UInt16 value!");
-        m_nValue = (sal_uInt16)nValue;
+        SAL_WARN_IF(nValue > USHRT_MAX, "svl.items", "Overflow in UInt16 value!");
+        m_nValue = static_cast<sal_uInt16>(nValue);
         return true;
     }
 
-    OSL_FAIL( "CntUInt16Item::PutValue - Wrong type!" );
+    SAL_WARN("svl.items", "CntUInt16Item::PutValue - Wrong type!");
     return false;
 }
 
@@ -194,7 +194,7 @@ bool CntInt32Item::PutValue(const css::uno::Any& rVal, sal_uInt8)
         return true;
     }
 
-    OSL_FAIL( "CntInt32Item::PutValue - Wrong type!" );
+    SAL_WARN("svl.items", "CntInt32Item::PutValue - Wrong type!");
     return false;
 }
 
@@ -248,7 +248,7 @@ bool CntUInt32Item::GetPresentation(SfxItemPresentation,
 bool CntUInt32Item::QueryValue(css::uno::Any& rVal, sal_uInt8) const
 {
     sal_Int32 nValue = m_nValue;
-    DBG_ASSERT( nValue>=0, "Overflow in UInt32 value!");
+    SAL_WARN_IF(nValue < 0, "svl.items", "Overflow in UInt32 value!");
     rVal <<= nValue;
     return true;
 }
@@ -259,12 +259,12 @@ bool CntUInt32Item::PutValue(const css::uno::Any& rVal, sal_uInt8)
     sal_Int32 nValue = 0;
     if (rVal >>= nValue)
     {
-        DBG_ASSERT( nValue>=0, "Overflow in UInt32 value!");
+        SAL_WARN_IF(nValue < 0, "svl.items", "Overflow in UInt32 value!");
         m_nValue = nValue;
         return true;
     }
 
-    OSL_FAIL( "CntUInt32Item::PutValue - Wrong type!" );
+    SAL_WARN("svl.items", "CntUInt32Item::PutValue - Wrong type!");
     return false;
 }
 
commit bac1c69c65e3f3908db4e8fed79271812eb00b78
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Dec 1 14:57:49 2016 +0100

    sfx2: convert legacy DBG_ASSERT in SfxDocumentMetaData
    
    Change-Id: Ic340d7226ea3af4bbd6e52c415b32d9be7cd453f

diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx
index 859e264..3bd5fd5 100644
--- a/sfx2/source/doc/SfxDocumentMetaData.cxx
+++ b/sfx2/source/doc/SfxDocumentMetaData.cxx
@@ -491,14 +491,14 @@ getQualifier(const char* i_name) {
 // NB: only call this with statically known strings!
 OUString SAL_CALL getNameSpace(const char* i_qname) throw ()
 {
-    DBG_ASSERT(i_qname, "SfxDocumentMetaData: getNameSpace: argument is null");
+    assert(i_qname);
     const char * ns = "";
     OUString n = getQualifier(i_qname).first;
     if ( n == "xlink" ) ns = s_nsXLink;
     if ( n == "dc" ) ns = s_nsDC;
     if ( n == "office" ) ns = s_nsODF;
     if ( n == "meta" ) ns = s_nsODFMeta;
-    DBG_ASSERT(*ns, "SfxDocumentMetaData: unknown namespace prefix");
+    assert(*ns);
     return OUString::createFromAscii(ns);
 }
 
@@ -679,8 +679,7 @@ SfxDocumentMetaData::getMetaText(const char* i_name) const
     checkInit();
 
     const OUString name( OUString::createFromAscii(i_name) );
-    DBG_ASSERT(m_meta.find(name) != m_meta.end(),
-        "SfxDocumentMetaData::getMetaText: not found");
+    assert(m_meta.find(name) != m_meta.end());
     css::uno::Reference<css::xml::dom::XNode> xNode = m_meta.find(name)->second;
     return (xNode.is()) ? getNodeText(xNode) : OUString();
 }
@@ -693,8 +692,7 @@ SfxDocumentMetaData::setMetaText(const char* i_name,
     checkInit();
 
     const OUString name( OUString::createFromAscii(i_name) );
-    DBG_ASSERT(m_meta.find(name) != m_meta.end(),
-        "SfxDocumentMetaData::setMetaText: not found");
+    assert(m_meta.find(name) != m_meta.end());
     css::uno::Reference<css::xml::dom::XNode> xNode = m_meta.find(name)->second;
 
     try {
@@ -758,8 +756,7 @@ SfxDocumentMetaData::getMetaAttr(const char* i_name, const char* i_attr) const
 //        throw (css::uno::RuntimeException)
 {
     OUString name = OUString::createFromAscii(i_name);
-    DBG_ASSERT(m_meta.find(name) != m_meta.end(),
-        "SfxDocumentMetaData::getMetaAttr: not found");
+    assert(m_meta.find(name) != m_meta.end());
     css::uno::Reference<css::xml::dom::XNode> xNode = m_meta.find(name)->second;
     if (xNode.is()) {
         css::uno::Reference<css::xml::dom::XElement> xElem(xNode,
@@ -777,8 +774,7 @@ SfxDocumentMetaData::getMetaList(const char* i_name) const
 {
     checkInit();
     OUString name = OUString::createFromAscii(i_name);
-    DBG_ASSERT(m_metaList.find(name) != m_metaList.end(),
-        "SfxDocumentMetaData::getMetaList: not found");
+    assert(m_metaList.find(name) != m_metaList.end());
     std::vector<css::uno::Reference<css::xml::dom::XNode> > const & vec =
         m_metaList.find(name)->second;
     css::uno::Sequence< OUString> ret(vec.size());
@@ -790,19 +786,17 @@ SfxDocumentMetaData::getMetaList(const char* i_name) const
 
 bool SAL_CALL
 SfxDocumentMetaData::setMetaList(const char* i_name,
-        const css::uno::Sequence< OUString> & i_rValue,
+        const css::uno::Sequence<OUString> & i_rValue,
         AttrVector const* i_pAttrs)
     // throw (css::uno::RuntimeException)
 {
     checkInit();
-    DBG_ASSERT((i_pAttrs == nullptr) ||
-               (static_cast<size_t>(i_rValue.getLength()) == i_pAttrs->size()),
-        "SfxDocumentMetaData::setMetaList: invalid args");
+    assert((i_pAttrs == nullptr) ||
+           (static_cast<size_t>(i_rValue.getLength()) == i_pAttrs->size()));
 
     try {
         OUString name = OUString::createFromAscii(i_name);
-        DBG_ASSERT(m_metaList.find(name) != m_metaList.end(),
-            "SfxDocumentMetaData::setMetaList: not found");
+        assert(m_metaList.find(name) != m_metaList.end());
         std::vector<css::uno::Reference<css::xml::dom::XNode> > & vec =
             m_metaList[name];
 
@@ -1113,8 +1107,7 @@ SfxDocumentMetaData::checkInit() const // throw (css::uno::RuntimeException)
                 "SfxDocumentMetaData::checkInit: not initialized"),
                 *const_cast<SfxDocumentMetaData*>(this));
     }
-    DBG_ASSERT((m_xDoc.is() && m_xParent.is() ),
-                "SfxDocumentMetaData::checkInit: reference is null");
+    assert(m_xDoc.is() && m_xParent.is());
 }
 
 // initialize state from DOM tree
@@ -1163,10 +1156,9 @@ void SAL_CALL SfxDocumentMetaData::init(
                     }
                     else
                     {
-                        OSL_TRACE("SfxDocumentMetaData::init(): "
-                                "deleting unexpected root element: %s",
-                            OUStringToOString(xNode->getLocalName(),
-                                RTL_TEXTENCODING_UTF8).getStr());
+                        SAL_INFO("sfx.doc", "SfxDocumentMetaData::init(): "
+                                "deleting unexpected root element: "
+                                << xNode->getLocalName());
                         i_xDoc->removeChild(xNode);
                         xNode = i_xDoc->getFirstChild(); // start over
                     }
@@ -1321,11 +1313,9 @@ void SAL_CALL SfxDocumentMetaData::init(
             SAL_WARN("sfx.doc", "Duplicate: " << name);
             // ignore; duplicate
         } catch (const css::beans::IllegalTypeException &) {
-            OSL_TRACE("SfxDocumentMetaData: illegal type: %s",
-                    OUStringToOString(name, RTL_TEXTENCODING_UTF8).getStr());
+            SAL_INFO("sfx.doc", "SfxDocumentMetaData: illegal type: " << name);
         } catch (const css::lang::IllegalArgumentException &) {
-            OSL_TRACE("SfxDocumentMetaData: illegal arg: %s",
-                    OUStringToOString(name, RTL_TEXTENCODING_UTF8).getStr());
+            SAL_INFO("sfx.doc", "SfxDocumentMetaData: illegal arg: " << name);
         }
     }
 
@@ -1344,9 +1334,8 @@ SfxDocumentMetaData::SfxDocumentMetaData(
     , m_isModified(false)
     , m_AutoloadSecs(0)
 {
-    DBG_ASSERT(context.is(), "SfxDocumentMetaData: context is null");
-    DBG_ASSERT(context->getServiceManager().is(),
-        "SfxDocumentMetaData: context has no service manager");
+    assert(context.is());
+    assert(context->getServiceManager().is());
     init(createDOM());
 }
 
@@ -2164,7 +2153,7 @@ void SAL_CALL SfxDocumentMetaData::setModified( sal_Bool bModified )
         if ( !bModified && m_xUserDefined.is() )
         {
             xMB.set(m_xUserDefined, css::uno::UNO_QUERY);
-            DBG_ASSERT(xMB.is(),
+            assert(xMB.is() &&
                 "SfxDocumentMetaData::setModified: PropertyBag not Modifiable?");
         }
     }


More information about the Libreoffice-commits mailing list