You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by or...@apache.org on 2013/08/20 10:00:28 UTC
svn commit: r1515732 - /openoffice/trunk/main/sw/source/filter/ww8/ww8par.cxx
Author: orw
Date: Tue Aug 20 08:00:27 2013
New Revision: 1515732
URL: http://svn.apache.org/r1515732
Log:
123021: import of graphic bullets - consider empty graphic frames in graphic bullet area
Modified:
openoffice/trunk/main/sw/source/filter/ww8/ww8par.cxx
Modified: openoffice/trunk/main/sw/source/filter/ww8/ww8par.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/filter/ww8/ww8par.cxx?rev=1515732&r1=1515731&r2=1515732&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/filter/ww8/ww8par.cxx (original)
+++ openoffice/trunk/main/sw/source/filter/ww8/ww8par.cxx Tue Aug 20 08:00:27 2013
@@ -4680,87 +4680,90 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8G
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();
- 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 )
- {
- SwTxtNode* pTxtNode = ppBkmk->get()->GetMarkStart().nNode.GetNode().GetTxtNode();
- if ( pTxtNode )
- {
- const SwpHints *pHints = pTxtNode->GetpSwpHints();
- for(int 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()))
- {
- 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);
- }
- }
- }
- // update graphic bullet information
- sal_uInt16 nCount = pLstManager->GetWW8LSTInfoNum();
- for (sal_uInt16 i = 0; i < nCount; ++i)
- {
- SwNumRule* pRule = pLstManager->GetNumRule(i);
- 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)
- {
- Graphic aGraphic = vecBulletGrf[nGrfBulletCP]->GetGrf();
- SvxBrushItem aBrush(aGraphic, GPOS_AREA, SID_ATTR_BRUSH);
- Font aFont = numfunc::GetDefBulletFont();
- int nHeight = aFont.GetHeight() * 12;//20;
- Size aPrefSize( aGraphic.GetPrefSize());
- if (aPrefSize.Height() * aPrefSize.Width() != 0 )
- {
- int nWidth = (nHeight * aPrefSize.Width()) / aPrefSize.Height();
- Size aSize(nWidth, nHeight);
- aNumFmt.SetGraphicBrush(&aBrush, &aSize);
- }
- else
- {
- aNumFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
- aNumFmt.SetBulletChar(0x2190);
- }
- pRule->Set( j, aNumFmt );
- }
- }
- }
- // Remove additional pictures
- for (sal_uInt16 i = 0; i < vecFrmFmt.size(); ++i)
- {
- rDoc.DelLayoutFmt(vecFrmFmt[i]);
- }
- }
- }
- DELETEZ( pLstManager );
- }
- }
-
+
+ //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();
+ if ( pMarkAccess )
+ {
+ 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 )
+ {
+ const SwpHints* pHints = pTxtNode->GetpSwpHints();
+ for( sal_uInt16 nHintPos = 0; pHints && nHintPos < pHints->Count(); ++nHintPos)
+ {
+ const SwTxtAttr *pHt = (*pHints)[nHintPos];
+ const xub_StrLen st = *(pHt->GetStart());
+ if( pHt
+ && pHt->Which() == RES_TXTATR_FLYCNT
+ && (st >= ppBkmk->get()->GetMarkStart().nContent.GetIndex()) )
+ {
+ 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
+ sal_uInt16 nCount = pLstManager->GetWW8LSTInfoNum();
+ for (sal_uInt16 i = 0; i < nCount; ++i)
+ {
+ SwNumRule* pRule = pLstManager->GetNumRule(i);
+ for (sal_uInt16 j = 0; j < MAXLEVEL; ++j)
+ {
+ SwNumFmt aNumFmt(pRule->Get(j));
+ 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;
+ Size aPrefSize( aGraphic.GetPrefSize());
+ if (aPrefSize.Height() * aPrefSize.Width() != 0 )
+ {
+ int nWidth = (nHeight * aPrefSize.Width()) / aPrefSize.Height();
+ Size aSize(nWidth, nHeight);
+ aNumFmt.SetGraphicBrush(&aBrush, &aSize);
+ }
+ else
+ {
+ aNumFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
+ aNumFmt.SetBulletChar(0x2190);
+ }
+ pRule->Set( j, aNumFmt );
+ }
+ }
+ }
+ // Remove additional pictures
+ for (sal_uInt16 i = 0; i < vecFrmFmt.size(); ++i)
+ {
+ rDoc.DelLayoutFmt(vecFrmFmt[i]);
+ }
+ }
+ }
+ DELETEZ( pLstManager );
+ }
+ }
+
UpdateFields();
// delete the pam before the call for hide all redlines (Bug 73683)