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

Oliver-Rainer Wittmann orw at apache.org
Tue Aug 20 04:14:14 PDT 2013


 sw/source/filter/ww8/ww8par.cxx |   43 +++++++++++++++++++++-------------------
 1 file changed, 23 insertions(+), 20 deletions(-)

New commits:
commit 0659c0c8b558f295f43e0be25bc2c82f81da5f2a
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date:   Tue Aug 20 08:00:27 2013 +0000

    Related: #i123021# import of graphic bullets
    
    consider empty graphic frames in graphic bullet area
    
    (cherry picked from commit b16eb2a11359d6dfd330a46dd70a0142d6b722a2)
    
    Conflicts:
    	sw/source/filter/ww8/ww8par.cxx
    
    Change-Id: I242762556805b80787bc6c4305c2f735fef711d3

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index fda24ba9..65fe6c4 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -4807,6 +4807,7 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
     delete mpRedlineStack;
     DeleteAnchorStk();
     DeleteRefStks();
+
     // For i120928,achieve the graphics from the special bookmark with is for graphic bullet
     {
         std::vector<const SwGrfNode*> vecBulletGrf;
@@ -4823,25 +4824,25 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
 
                 if ( pTxtNode )
                 {
-                    const SwpHints *pHints = pTxtNode->GetpSwpHints();
-                    for(int nHintPos = 0; pHints && nHintPos < pHints->Count(); ++nHintPos)
+                    const SwpHints* pHints = pTxtNode->GetpSwpHints();
+                    for( sal_uInt16 nHintPos = 0; pHints && nHintPos < pHints->Count(); ++nHintPos)
                     {
                         const SwTxtAttr *pHt = (*pHints)[nHintPos];
-                        xub_StrLen st = *(pHt->GetStart());
-                        if(pHt && pHt->Which() == RES_TXTATR_FLYCNT && (st >= ppBkmk->get()->GetMarkStart().nContent.GetIndex()))
+                        const xub_StrLen st = *(pHt->GetStart());
+                        if( pHt
+                            && pHt->Which() == RES_TXTATR_FLYCNT
+                            && (st >= ppBkmk->get()->GetMarkStart().nContent.GetIndex()) )
                         {
-                            SwFrmFmt *pFrmFmt = pHt->GetFlyCnt().GetFrmFmt();
-                            const SwNodeIndex *pNdIdx = pFrmFmt->GetCntnt().GetCntntIdx();
-                            if (pNdIdx)
-                            {
-                                const SwNodes &nos = pNdIdx->GetNodes();
-                                const SwGrfNode *pGrf = dynamic_cast<const SwGrfNode*>(nos[pNdIdx->GetIndex() + 1]);
-                                if (pGrf)
-                                {
-                                    vecBulletGrf.push_back(pGrf);
-                                    vecFrmFmt.push_back(pFrmFmt);
-                                }
-                            }
+                            SwFrmFmt* pFrmFmt = pHt->GetFlyCnt().GetFrmFmt();
+                            vecFrmFmt.push_back(pFrmFmt);
+                            const SwNodeIndex* pNdIdx = pFrmFmt->GetCntnt().GetCntntIdx();
+                            const SwNodes* pNodesArray = (pNdIdx != NULL)
+                                                         ? &(pNdIdx->GetNodes())
+                                                         : NULL;
+                            const SwGrfNode *pGrf = (pNodesArray != NULL)
+                                                    ? dynamic_cast<const SwGrfNode*>((*pNodesArray)[pNdIdx->GetIndex() + 1])
+                                                    : NULL;
+                            vecBulletGrf.push_back(pGrf);
                         }
                     }
                     // update graphic bullet information
@@ -4852,14 +4853,16 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
                         for (int j = 0; j < MAXLEVEL; ++j)
                         {
                             SwNumFmt aNumFmt(pRule->Get(j));
-                            sal_Int16 nType = aNumFmt.GetNumberingType();
-                            sal_uInt16 nGrfBulletCP = aNumFmt.GetGrfBulletCP();
-                            if (nType == SVX_NUM_BITMAP && vecBulletGrf.size() > nGrfBulletCP)
+                            const sal_Int16 nType = aNumFmt.GetNumberingType();
+                            const sal_uInt16 nGrfBulletCP = aNumFmt.GetGrfBulletCP();
+                            if ( nType == SVX_NUM_BITMAP
+                                 && vecBulletGrf.size() > nGrfBulletCP
+                                 && vecBulletGrf[nGrfBulletCP] != NULL )
                             {
                                 Graphic aGraphic = vecBulletGrf[nGrfBulletCP]->GetGrf();
                                 SvxBrushItem aBrush(aGraphic, GPOS_AREA, SID_ATTR_BRUSH);
                                 Font aFont = numfunc::GetDefBulletFont();
-                                int nHeight = aFont.GetHeight() * 12;//20;
+                                int nHeight = aFont.GetHeight() * 12;
                                 Size aPrefSize( aGraphic.GetPrefSize());
                                 if (aPrefSize.Height() * aPrefSize.Width() != 0 )
                                 {


More information about the Libreoffice-commits mailing list