diff options
author | Rohit Deshmukh <rohit.deshmukh@synerzip.com> | 2014-02-18 12:23:14 +0530 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-02-26 12:50:29 +0100 |
commit | 598d02d71f40901eab9275704c8bc0e1641b56e3 (patch) | |
tree | 9668886ad71e3566b07dfcfcbd843a8a9ad73624 /sw | |
parent | 2cf9fe702310a2f3d69a543541582ea5fa191d58 (diff) |
fdo#75133: Preseved bibliography after round trip.
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
writerfilter/source/dmapper/DomainMapper_Impl.hxx
Reviewed on:
https://gerrit.libreoffice.org/8124
Change-Id: Ieaea19600fbda3b536549a1a100f847f9ae3654b
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/toxe.hxx | 3 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/FDO75133.docx | bin | 0 -> 16659 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 11 | ||||
-rw-r--r-- | sw/source/core/doc/doctxm.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/inc/doctxm.hxx | 5 | ||||
-rw-r--r-- | sw/source/core/tox/tox.cxx | 1 | ||||
-rw-r--r-- | sw/source/filter/ww8/fields.cxx | 3 | ||||
-rw-r--r-- | sw/source/filter/ww8/fields.hxx | 3 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 5 | ||||
-rw-r--r-- | sw/source/ui/inc/cnttab.hxx | 1 | ||||
-rw-r--r-- | sw/source/ui/index/cnttab.cxx | 3 | ||||
-rw-r--r-- | sw/source/ui/index/toxmgr.cxx | 25 |
12 files changed, 60 insertions, 6 deletions
diff --git a/sw/inc/toxe.hxx b/sw/inc/toxe.hxx index 7de90e2977c7..943a8e65a02b 100644 --- a/sw/inc/toxe.hxx +++ b/sw/inc/toxe.hxx @@ -41,7 +41,8 @@ enum TOXTypes TOX_ILLUSTRATIONS, TOX_OBJECTS, TOX_TABLES, - TOX_AUTHORITIES + TOX_AUTHORITIES, + TOX_BIBLIOGRAPHY }; // this enum contains all types of sources enum ToxAuthorityType diff --git a/sw/qa/extras/ooxmlexport/data/FDO75133.docx b/sw/qa/extras/ooxmlexport/data/FDO75133.docx Binary files differnew file mode 100644 index 000000000000..93170ddc6dc1 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/FDO75133.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 337a69b0528e..4d6e3b787b03 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -3715,6 +3715,17 @@ DECLARE_OOXMLEXPORT_TEST(testAlphabeticalIndex_AutoColumn,"alphabeticalIndex_Aut assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:pPr/w:sectPr", 0); } +DECLARE_OOXMLEXPORT_TEST(testBibliography,"FDO75133.docx") +{ + xmlDocPtr pXmlDoc = parseExport(); + if (!pXmlDoc) + return; + xmlNodeSetPtr pXmlNodes = getXPathNode(pXmlDoc,"/w:document/w:body/w:p[3]/w:r[2]/w:instrText"); + xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0]; + OUString contents = OUString::createFromAscii((const char*)((pXmlNode->children[0]).content)); + CPPUNIT_ASSERT(contents.match(" BIBLIOGRAPHY ")); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index ad894dfe2b79..6ff26a535f86 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -463,6 +463,7 @@ const SwTOXBase* SwDoc::GetDefaultTOXBase( TOXTypes eTyp, bool bCreate ) case TOX_OBJECTS: prBase = &mpDefTOXBases->pObjBase; break; case TOX_ILLUSTRATIONS: prBase = &mpDefTOXBases->pIllBase; break; case TOX_AUTHORITIES: prBase = &mpDefTOXBases->pAuthBase; break; + case TOX_BIBLIOGRAPHY: prBase = &mpDefTOXBases->pBiblioBase; break; } if(!(*prBase) && bCreate) { @@ -485,6 +486,7 @@ void SwDoc::SetDefaultTOXBase(const SwTOXBase& rBase) case TOX_OBJECTS: prBase = &mpDefTOXBases->pObjBase; break; case TOX_ILLUSTRATIONS: prBase = &mpDefTOXBases->pIllBase; break; case TOX_AUTHORITIES: prBase = &mpDefTOXBases->pAuthBase; break; + case TOX_BIBLIOGRAPHY: prBase = &mpDefTOXBases->pBiblioBase; break; } if(*prBase) delete (*prBase); @@ -1087,7 +1089,9 @@ SwTxtFmtColl* SwTOXBaseSection::GetTxtFmtColl( sal_uInt16 nLevel ) case TOX_ILLUSTRATIONS: nPoolFmt = RES_POOLCOLL_TOX_ILLUSH; break; case TOX_OBJECTS: nPoolFmt = RES_POOLCOLL_TOX_OBJECTH; break; case TOX_TABLES: nPoolFmt = RES_POOLCOLL_TOX_TABLESH; break; - case TOX_AUTHORITIES: nPoolFmt = RES_POOLCOLL_TOX_AUTHORITIESH; break; + case TOX_AUTHORITIES: + case TOX_BIBLIOGRAPHY: + nPoolFmt = RES_POOLCOLL_TOX_AUTHORITIESH; break; case TOX_CONTENT: // There's a jump in the ContentArea! diff --git a/sw/source/core/inc/doctxm.hxx b/sw/source/core/inc/doctxm.hxx index d2e30a95d8bc..65cea1f1b7c3 100644 --- a/sw/source/core/inc/doctxm.hxx +++ b/sw/source/core/inc/doctxm.hxx @@ -100,6 +100,7 @@ struct SwDefTOXBase_Impl SwTOXBase* pObjBase; SwTOXBase* pIllBase; SwTOXBase* pAuthBase; + SwTOXBase* pBiblioBase; SwDefTOXBase_Impl() : pContBase(0), @@ -108,7 +109,8 @@ struct SwDefTOXBase_Impl pTblBase(0), pObjBase(0), pIllBase(0), - pAuthBase(0) + pAuthBase(0), + pBiblioBase(0) { } ~SwDefTOXBase_Impl() @@ -120,6 +122,7 @@ struct SwDefTOXBase_Impl delete pObjBase; delete pIllBase; delete pAuthBase; + delete pBiblioBase; } }; diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx index 55c0b6f25f85..75a493f3b78b 100644 --- a/sw/source/core/tox/tox.cxx +++ b/sw/source/core/tox/tox.cxx @@ -402,6 +402,7 @@ sal_uInt16 SwForm::GetFormMaxLevel( TOXTypes eTOXType ) case TOX_ILLUSTRATIONS: case TOX_OBJECTS : case TOX_TABLES : nRet = 2; break; + case TOX_BIBLIOGRAPHY : case TOX_AUTHORITIES : nRet = AUTH_TYPE_END + 1; break; } return nRet; diff --git a/sw/source/filter/ww8/fields.cxx b/sw/source/filter/ww8/fields.cxx index 039cbf853f12..94777aaa71e3 100644 --- a/sw/source/filter/ww8/fields.cxx +++ b/sw/source/filter/ww8/fields.cxx @@ -126,7 +126,8 @@ namespace ww /*92*/ "BIDIOUTLINE", /*93*/ "ADDRESSBLOCK", /*94*/ "GREETINGLINE", - /*95*/ "SHAPE" + /*95*/ "SHAPE", + /*96*/ "BIBLIOGRAPHY" }; size_t nIndex = static_cast<size_t>(eIndex); diff --git a/sw/source/filter/ww8/fields.hxx b/sw/source/filter/ww8/fields.hxx index d3f8bb0b4035..ce888085c73e 100644 --- a/sw/source/filter/ww8/fields.hxx +++ b/sw/source/filter/ww8/fields.hxx @@ -120,7 +120,8 @@ namespace ww eBIDIOUTLINE = 92, eADDRESSBLOCK = 93, eGREETINGLINE = 94, - eSHAPE = 95 + eSHAPE = 95, + eBIBLIOGRPAHY=96 }; /** Find the English Field Name from a winword index diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 7086f7e873fc..cf876021193e 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -2106,7 +2106,6 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect ) } break; - // case TOX_AUTHORITIES: eCode = eTOA; sStr = ???; break; case TOX_ILLUSTRATIONS: case TOX_OBJECTS: case TOX_TABLES: @@ -2131,6 +2130,10 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect ) } break; + case TOX_AUTHORITIES: + eCode = ww::eBIBLIOGRPAHY; + sStr = FieldString(eCode); + break; // case TOX_USER: // case TOX_CONTENT: default: diff --git a/sw/source/ui/inc/cnttab.hxx b/sw/source/ui/inc/cnttab.hxx index 7ea8b42e1814..a1a6fae550a3 100644 --- a/sw/source/ui/inc/cnttab.hxx +++ b/sw/source/ui/inc/cnttab.hxx @@ -50,6 +50,7 @@ #define TO_USER 16 #define TO_OBJECT 32 #define TO_AUTHORITIES 64 +#define TO_BIBLIOGRAPHY 128 struct CurTOXType { diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index 7906d5382c48..5d7a07b3d5b7 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -959,6 +959,7 @@ static long lcl_TOXTypesToUserData(CurTOXType eType) case TOX_OBJECTS : nRet = TO_OBJECT; break; case TOX_TABLES : nRet = TO_TABLE; break; case TOX_AUTHORITIES : nRet = TO_AUTHORITIES; break; + case TOX_BIBLIOGRAPHY : nRet = TO_BIBLIOGRAPHY; break; } return nRet; } @@ -992,6 +993,7 @@ static CurTOXType lcl_UserData2TOXTypes(sal_uInt16 nData) case TO_OBJECT : eRet.eType = TOX_OBJECTS; break; case TO_TABLE : eRet.eType = TOX_TABLES; break; case TO_AUTHORITIES : eRet.eType = TOX_AUTHORITIES; break; + case TO_BIBLIOGRAPHY : eRet.eType = TOX_BIBLIOGRAPHY; break; default: OSL_FAIL("what a type?"); } return eRet; @@ -1186,6 +1188,7 @@ void SwTOXSelectTabPage::FillTOXDescription() } break; case TOX_AUTHORITIES: + case TOX_BIBLIOGRAPHY : { if(m_pBracketLB->GetSelectEntryPos()) rDesc.SetAuthBrackets(m_pBracketLB->GetSelectEntry()); diff --git a/sw/source/ui/index/toxmgr.cxx b/sw/source/ui/index/toxmgr.cxx index abc2e370c280..4336fbf2c8fe 100644 --- a/sw/source/ui/index/toxmgr.cxx +++ b/sw/source/ui/index/toxmgr.cxx @@ -129,6 +129,30 @@ void SwTOXMgr::InsertTOXMark(const SwTOXMarkDescription& rDesc) pMark->SetAlternativeText(*rDesc.GetAltStr()); } break; + case TOX_BIBLIOGRAPHY: + { + pMark = new SwTOXMark(pSh->GetTOXType(TOX_BIBLIOGRAPHY, 0)); + + if( rDesc.GetPrimKey() && !rDesc.GetPrimKey()->isEmpty() ) + { + pMark->SetPrimaryKey( *rDesc.GetPrimKey() ); + if(rDesc.GetPhoneticReadingOfPrimKey()) + pMark->SetPrimaryKeyReading( *rDesc.GetPhoneticReadingOfPrimKey() ); + + if( rDesc.GetSecKey() && !rDesc.GetSecKey()->isEmpty() ) + { + pMark->SetSecondaryKey( *rDesc.GetSecKey() ); + if(rDesc.GetPhoneticReadingOfSecKey()) + pMark->SetSecondaryKeyReading( *rDesc.GetPhoneticReadingOfSecKey() ); + } + } + if(rDesc.GetAltStr()) + pMark->SetAlternativeText(*rDesc.GetAltStr()); + if(rDesc.GetPhoneticReadingOfAltStr()) + pMark->SetTextReading( *rDesc.GetPhoneticReadingOfAltStr() ); + pMark->SetMainEntry(rDesc.IsMainEntry()); + } + break; default:; //prevent warning } pSh->StartAllAction(); @@ -352,6 +376,7 @@ sal_Bool SwTOXMgr::UpdateOrInsertTOX(const SwTOXDescription& rDesc, case TOX_OBJECTS: case TOX_TABLES: case TOX_AUTHORITIES: + case TOX_BIBLIOGRAPHY: case TOX_ILLUSTRATIONS: { //Special handling for TOX_AUTHORITY |