[Libreoffice-commits] core.git: Branch 'aoo/trunk' - sw/source

Oliver-Rainer Wittmann orw at apache.org
Tue Aug 20 01:12:42 PDT 2013


 sw/source/filter/ww8/ww8par.cxx |   57 +++++++++++++++++++++-------------------
 1 file changed, 30 insertions(+), 27 deletions(-)

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

    123021: import of graphic bullets - consider empty graphic frames in graphic bullet area

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 70dbea9..ebf14756 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -4680,42 +4680,43 @@ 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;
         std::vector<SwFrmFmt*> vecFrmFmt;
 
         IDocumentMarkAccess* const pMarkAccess =
-                                                rDoc.getIDocumentMarkAccess();
+            rDoc.getIDocumentMarkAccess();
         if ( pMarkAccess )
         {
-                  IDocumentMarkAccess::const_iterator_t ppBkmk =
-                                        pMarkAccess->findBookmark( C2U("_PictureBullets") );
-            //for(IDocumentMarkAccess::const_iterator_t ppBookmark = ppBkmk->begin();
-                  //    ppBookmark != ppBkmk->end(); ppBookmark++)
-                  if ( ppBkmk != pMarkAccess->getBookmarksEnd() &&
-                             IDocumentMarkAccess::GetType( *(ppBkmk->get()) )
-                                == IDocumentMarkAccess::BOOKMARK )
-                    {
+            IDocumentMarkAccess::const_iterator_t ppBkmk =
+                pMarkAccess->findBookmark( C2U("_PictureBullets") );
+            if ( ppBkmk != pMarkAccess->getBookmarksEnd()
+                 && IDocumentMarkAccess::GetType( *(ppBkmk->get()) ) == IDocumentMarkAccess::BOOKMARK )
+            {
                 SwTxtNode* pTxtNode = ppBkmk->get()->GetMarkStart().nNode.GetNode().GetTxtNode();
-                         if ( pTxtNode )
+                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();
-                            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
@@ -4726,14 +4727,16 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
                         for (sal_uInt16 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