[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - 4 commits - accessibility/inc accessibility/source sax/source svx/source sw/source xmloff/source

Michael Stahl mstahl at redhat.com
Wed Dec 18 04:23:57 PST 2013


 accessibility/inc/accessibility/extended/AccessibleGridControl.hxx |    2 -
 accessibility/source/extended/AccessibleGridControl.cxx            |   15 ++++++----
 sax/source/tools/converter.cxx                                     |   10 ++++--
 svx/source/accessibility/ChildrenManagerImpl.cxx                   |    2 -
 sw/source/core/layout/atrfrm.cxx                                   |    6 +++-
 sw/source/filter/xml/xmlexpit.cxx                                  |    2 -
 xmloff/source/style/xmlbahdl.cxx                                   |    5 ++-
 xmloff/source/style/xmlbahdl.hxx                                   |    4 +-
 8 files changed, 29 insertions(+), 17 deletions(-)

New commits:
commit 3a5f11f6dd086efdb40e1e75e6588b4c62881918
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Dec 17 23:44:38 2013 +0100

    fdo#72452: ODF import/export: fix handling of style:page-number
    
    Class XMLNumberWithAutoInsteadZeroPropHdl (which appears to be used only
    for this attribute) needs to be adapted to the change that
    "PageNumberOffset" value 0 is no longer invalid; use "void" value for
    invalid instead, which appears more appropriate anyway.
    
    Unfortunately the type of style:page-number is positiveInteger so
    writing 0 would be invalid; write "auto" instead for now.
    
    Change-Id: I9621ea201fd928087b863c562607c3d77a3b0269
    (cherry picked from commit 22355042a6fc7aecf3caab69b3fa3be1430b697f)

diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 4f482c5..b06cea4 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -710,7 +710,11 @@ bool SwFmtPageDesc::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
         case MID_PAGEDESC_PAGENUMOFFSET:
         {
             sal_Int16 nOffset = 0;
-            if(rVal >>= nOffset)
+            if (!rVal.hasValue())
+            {
+                SetNumOffset(boost::none);
+            }
+            else if (rVal >>= nOffset)
                 SetNumOffset( nOffset );
             else
                 bRet = false;
diff --git a/sw/source/filter/xml/xmlexpit.cxx b/sw/source/filter/xml/xmlexpit.cxx
index abe355d..b1e5182 100644
--- a/sw/source/filter/xml/xmlexpit.cxx
+++ b/sw/source/filter/xml/xmlexpit.cxx
@@ -1005,7 +1005,7 @@ bool SvXMLExportItemMapper::QueryXMLValue(
             if( MID_PAGEDESC_PAGENUMOFFSET==nMemberId )
             {
                 ::boost::optional<sal_uInt16> oNumOffset = pPageDesc->GetNumOffset();
-                if (oNumOffset)
+                if (oNumOffset && oNumOffset.get() > 0)
                 {
                     // #i114163# positiveInteger only!
                     sal_Int32 const number(oNumOffset.get());
diff --git a/xmloff/source/style/xmlbahdl.cxx b/xmloff/source/style/xmlbahdl.cxx
index 3397e47..0a797e5 100644
--- a/xmloff/source/style/xmlbahdl.cxx
+++ b/xmloff/source/style/xmlbahdl.cxx
@@ -879,7 +879,7 @@ bool XMLNumberWithAutoInsteadZeroPropHdl::importXML(
         lcl_xmloff_setAny( rValue, nValue, 2 );
     else if( rStrImpValue == GetXMLToken( XML_AUTO ) )
     {
-        rValue <<= (sal_Int16)nValue;
+        rValue.clear(); // void
         bRet = true;
     }
     return bRet;
@@ -891,7 +891,8 @@ bool XMLNumberWithAutoInsteadZeroPropHdl::exportXML( OUString& rStrExpValue, con
     sal_Int32 nValue = 0;
     lcl_xmloff_getAny( rValue, nValue, 2 );
 
-    if( 0 == nValue )
+    // FIXME: 0 is not a valid value - write "auto" instead
+    if (0 == nValue || !rValue.hasValue())
         rStrExpValue = GetXMLToken( XML_AUTO );
     else
     {
diff --git a/xmloff/source/style/xmlbahdl.hxx b/xmloff/source/style/xmlbahdl.hxx
index 58c6dc1..8b57ccb 100644
--- a/xmloff/source/style/xmlbahdl.hxx
+++ b/xmloff/source/style/xmlbahdl.hxx
@@ -306,8 +306,8 @@ public:
 
 /**
     PropertyHandler for the XML-data-type: XML_TYPE_NUMBER16_AUTO
-    Reads/writes numeric properties with special handling for the value zero
-    (i.e., a value 0 property will be written as "auto")
+    Reads/writes numeric properties with special handling for "void" value
+    (i.e., void property will be written as "auto")
 */
 class XMLNumberWithAutoInsteadZeroPropHdl : public XMLNumberWithoutZeroPropHdl
 {
commit b233b5f754026600a0f9712538291eaaa48d5884
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Dec 17 17:29:49 2013 +0100

    sax: avoid usage of double for parsing nanoseconds here too
    
    Change-Id: Iddf93a116cb333db6465a915dae692c33a60241a
    (cherry picked from commit 64575a5b91b0fae6283b9ad8b1356e76caa34b45)

diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index 02131ed..4e61f27 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -1645,9 +1645,13 @@ static bool lcl_parseDateTime(
             }
             if (bSuccess)
             {
-                const sal_Int32 nDigits = std::min<sal_Int32>(nPos - nStart, 9);
-                OSL_ENSURE(nDigits > 0, "bad code monkey");
-                nNanoSeconds=static_cast<double>(nTemp)*(1000000000.0/pow(10.0,nDigits));
+                sal_Int32 nDigits = std::min<sal_Int32>(nPos - nStart, 9);
+                assert(nDigits > 0);
+                for (; nDigits < 9; ++nDigits)
+                {
+                    nTemp *= 10;
+                }
+                nNanoSeconds = nTemp;
             }
         }
 
commit 20463fb3e58cb0264b311b280e623a9e1937aa43
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Dec 17 11:19:21 2013 +0100

    ChildrenManagerImpl::AddShape: do not use member after releasing mutex
    
    This crashed here once during some JunitTest with an rDescriptor that
    did not match maVisibleChildren.back().
    [The mrContext member used here is const so shouldn't cause problems.]
    
    Change-Id: I31e54b166badef6472127c64f0a4f49c51c73b30
    (cherry picked from commit ebb6c4407da2f8e913f1520b61a36ca3a4b54a7e)

diff --git a/svx/source/accessibility/ChildrenManagerImpl.cxx b/svx/source/accessibility/ChildrenManagerImpl.cxx
index ed9dc7c..6226944 100644
--- a/svx/source/accessibility/ChildrenManagerImpl.cxx
+++ b/svx/source/accessibility/ChildrenManagerImpl.cxx
@@ -458,7 +458,7 @@ void ChildrenManagerImpl::AddShape (const Reference<drawing::XShape>& rxShape)
                         AccessibleEventId::CHILD,
                         aNewShape,
                         uno::Any());
-                    RegisterAsDisposeListener (rDescriptor.mxShape);
+                    RegisterAsDisposeListener(rxShape);
                 }
         }
     }
commit c4b4058b6b3a747b96f72ab44560da11726e4468
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Dec 16 16:09:19 2013 +0100

    accessibility: don't crash if the TableControl is dead
    
    AccessibleGridControlAccess: clear the m_pTable member in dispose() so
    it is no longer accessed later.
    
    Change-Id: I490c84ce1bee55c9c69eb29b81ddfbe808301797
    (cherry picked from commit 449e0c9c7378ba32039bd5934c26011d682a8a91)

diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx
index e92e495..eb3be36 100644
--- a/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx
+++ b/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx
@@ -196,7 +196,7 @@ private:
     ::osl::Mutex                m_aMutex;
     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
                                         m_xParent;
-    ::svt::table::IAccessibleTable&    m_rTable;
+    ::svt::table::IAccessibleTable *    m_pTable;
 
     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
                                 m_xContext;
diff --git a/accessibility/source/extended/AccessibleGridControl.cxx b/accessibility/source/extended/AccessibleGridControl.cxx
index df7b8a0..fcd8dbc 100644
--- a/accessibility/source/extended/AccessibleGridControl.cxx
+++ b/accessibility/source/extended/AccessibleGridControl.cxx
@@ -407,10 +407,11 @@ void AccessibleGridControl::commitTableEvent(sal_Int16 _nEventId,const Any& _rNe
 // ============================================================================
 
 // -----------------------------------------------------------------------------
-AccessibleGridControlAccess::AccessibleGridControlAccess( const Reference< XAccessible >& _rxParent, IAccessibleTable& _rTable )
-        :m_xParent( _rxParent )
-        ,m_rTable( _rTable )
-        ,m_pContext( NULL )
+AccessibleGridControlAccess::AccessibleGridControlAccess(
+        const Reference< XAccessible >& rxParent, IAccessibleTable& rTable )
+    : m_xParent( rxParent )
+    , m_pTable( & rTable )
+    , m_pContext( 0 )
 {
 }
 
@@ -424,6 +425,7 @@ void AccessibleGridControlAccess::dispose()
 {
     ::osl::MutexGuard aGuard( m_aMutex );
 
+    m_pTable = 0;
     m_pContext = NULL;
     ::comphelper::disposeComponent( m_xContext );
 }
@@ -441,8 +443,9 @@ Reference< XAccessibleContext > SAL_CALL AccessibleGridControlAccess::getAccessi
     if ( m_pContext && !m_pContext->isAlive() )
         m_xContext = m_pContext = NULL;
 
-    if ( !m_xContext.is() )
-        m_xContext = m_pContext = new AccessibleGridControl( m_xParent, this, m_rTable );
+    if (!m_xContext.is() && m_pTable)
+        m_xContext = m_pContext =
+            new AccessibleGridControl(m_xParent, this, *m_pTable);
 
     return m_xContext;
 }


More information about the Libreoffice-commits mailing list