[Libreoffice-commits] .: Branch 'libreoffice-3-6' - sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jan 9 07:20:34 PST 2013


 sw/source/core/unocore/unocrsrhelper.cxx |   28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

New commits:
commit e5add879def40a7695fb506b42c024ef9f776062
Author: Noel Power <noel.power at suse.com>
Date:   Wed Jan 9 14:40:10 2013 +0100

    fdo#58242: getCrsrPropertyValue: fix crashes when PaM not on SwTxtNode
    
    Change-Id: I67042b5d689457921a928454c9051f0402be17e6
    (cherry picked from commit 11b380874a36869452246cc77c392d1767e60e95)
    
    Signed-off-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index 0993721..e41d237 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -302,9 +302,12 @@ sal_Bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry
             break;
         case FN_UNO_DOCUMENT_INDEX_MARK:
         {
-            ::std::vector<SwTxtAttr *> const marks(
-                rPam.GetNode()->GetTxtNode()->GetTxtAttrsAt(
-                    rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_TOXMARK));
+            ::std::vector<SwTxtAttr *> marks;
+            if (rPam.GetNode()->IsTxtNode())
+            {
+                marks = rPam.GetNode()->GetTxtNode()->GetTxtAttrsAt(
+                    rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_TOXMARK);
+            }
             if (marks.size())
             {
                 if( pAny )
@@ -428,9 +431,9 @@ sal_Bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry
         case FN_UNO_ENDNOTE:
         case FN_UNO_FOOTNOTE:
         {
-            SwTxtAttr *const pTxtAttr =
+            SwTxtAttr *const pTxtAttr = rPam.GetNode()->IsTxtNode() ?
                 rPam.GetNode()->GetTxtNode()->GetTxtAttrForCharAt(
-                    rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_FTN);
+                    rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_FTN) : 0;
             if(pTxtAttr)
             {
                 const SwFmtFtn& rFtn = pTxtAttr->GetFtn();
@@ -452,9 +455,13 @@ sal_Bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry
         break;
         case FN_UNO_REFERENCE_MARK:
         {
-            ::std::vector<SwTxtAttr *> const marks(
+            ::std::vector<SwTxtAttr *> marks;
+            if (rPam.GetNode()->IsTxtNode())
+            {
+                marks = (
                 rPam.GetNode()->GetTxtNode()->GetTxtAttrsAt(
                     rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_REFMARK));
+            }
             if (marks.size())
             {
                 if( pAny )
@@ -470,9 +477,10 @@ sal_Bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry
         break;
         case FN_UNO_NESTED_TEXT_CONTENT:
         {
-            uno::Reference<XTextContent> const xRet(
-                GetNestedTextContent(*rPam.GetNode()->GetTxtNode(),
-                    rPam.GetPoint()->nContent.GetIndex(), false));
+            uno::Reference<XTextContent> const xRet(rPam.GetNode()->IsTxtNode()
+                ? GetNestedTextContent(*rPam.GetNode()->GetTxtNode(),
+                    rPam.GetPoint()->nContent.GetIndex(), false)
+                : 0);
             if (xRet.is())
             {
                 if (pAny)
@@ -721,6 +729,8 @@ void  getNumberingProperty(SwPaM& rPam, PropertyState& eState, Any * pAny )
 
 void GetCurPageStyle(SwPaM& rPaM, String &rString)
 {
+    if (!rPaM.GetCntntNode())
+        return; // TODO: is there an easy way to get it for tables/sections?
     const SwPageFrm* pPage = rPaM.GetCntntNode()->getLayoutFrm(rPaM.GetDoc()->GetCurrentLayout())->FindPageFrm();
     if(pPage)
         SwStyleNameMapper::FillProgName( pPage->GetPageDesc()->GetName(), rString, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, sal_True );


More information about the Libreoffice-commits mailing list