[Libreoffice-commits] core.git: sw/inc sw/qa sw/source writerfilter/source
Rohit Deshmukh
rohit.deshmukh at synerzip.com
Fri Mar 14 02:46:02 PDT 2014
sw/inc/authfld.hxx | 3
sw/inc/fldbas.hxx | 4 -
sw/inc/poolfmt.hrc | 1
sw/inc/shellres.hxx | 1
sw/inc/tox.hxx | 15 ++++
sw/inc/toxe.hxx | 3
sw/qa/extras/ooxmlexport/data/FDO74775.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 10 ++
sw/source/core/doc/docnew.cxx | 2
sw/source/core/doc/doctxm.cxx | 4 -
sw/source/core/fields/authfld.cxx | 7 +
sw/source/core/fields/fldbas.cxx | 11 ++-
sw/source/core/tox/tox.cxx | 2
sw/source/core/uibase/index/toxmgr.cxx | 1
sw/source/core/uibase/utlui/initui.cxx | 1
sw/source/core/uibase/utlui/initui.hrc | 1
sw/source/core/uibase/utlui/initui.src | 6 +
sw/source/core/unocore/unoidx.cxx | 19 +++++
sw/source/filter/ww8/docxattributeoutput.cxx | 11 ++-
sw/source/filter/ww8/fields.cxx | 3
sw/source/filter/ww8/fields.hxx | 3
sw/source/filter/ww8/ww8atr.cxx | 8 ++
sw/source/ui/index/cnttab.cxx | 3
sw/source/ui/utlui/poolfmt.src | 4 +
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 80 ++++++++++++++++++++++
writerfilter/source/dmapper/DomainMapper_Impl.hxx | 1
writerfilter/source/dmapper/FieldTypes.hxx | 7 +
27 files changed, 198 insertions(+), 13 deletions(-)
New commits:
commit 06f7d1a96eef5aa69d4872ff6d96eb5085296d09
Author: Rohit Deshmukh <rohit.deshmukh at synerzip.com>
Date: Wed Mar 12 15:07:38 2014 +0530
fdo#74775: Preseved Citation after round trip.
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
https://gerrit.libreoffice.org/8473
Change-Id: Ie1b0ac3cb4d4b9bf305323599d5e4b63f913fb1b
diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx
index 55ed5b7..a26cc6d 100644
--- a/sw/inc/authfld.hxx
+++ b/sw/inc/authfld.hxx
@@ -150,6 +150,9 @@ class SwAuthorityField : public SwField
virtual SwField* Copy() const;
public:
+ /// For internal use only, in general continue using ExpandField() instead.
+ OUString ConditionalExpand(ToxAuthorityField eField) const;
+
SwAuthorityField(SwAuthorityFieldType* pType, const OUString& rFieldContents);
SwAuthorityField(SwAuthorityFieldType* pType, sal_IntPtr nHandle);
~SwAuthorityField();
diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index 26df00f..90cd505 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -26,7 +26,7 @@
#include <com/sun/star/uno/Any.hxx>
#include <cppuhelper/weakref.hxx>
#include <vector>
-
+#include <toxe.hxx>
class SwDoc;
class SvNumberFormatter;
@@ -317,7 +317,7 @@ public:
SwTxtFormatter::NewFldPortion() sets things up properly.
@return the generated text (suitable for display)
*/
- OUString ExpandField(bool const bCached) const;
+ OUString ExpandField(bool const bCached, ToxAuthorityField eField = AUTH_FIELD_IDENTIFIER) const;
/// @return name or content.
virtual OUString GetFieldName() const;
diff --git a/sw/inc/poolfmt.hrc b/sw/inc/poolfmt.hrc
index c9c87c6..423fad5 100644
--- a/sw/inc/poolfmt.hrc
+++ b/sw/inc/poolfmt.hrc
@@ -221,6 +221,7 @@
#define STR_POOLCOLL_TOX_USER9 (RC_POOLCOLL_REGISTER_BEGIN+ 34)
#define STR_POOLCOLL_TOX_USER10 (RC_POOLCOLL_REGISTER_BEGIN+ 35)
+#define STR_POOLCOLL_TOX_CITATION (RC_POOLCOLL_REGISTER_BEGIN+ 36)
// Category Chapter/Document
#define STR_POOLCOLL_DOC_TITEL (RC_POOLCOLL_DOC_BEGIN+ 0)
diff --git a/sw/inc/shellres.hxx b/sw/inc/shellres.hxx
index df10cbd..60ab4a1 100644
--- a/sw/inc/shellres.hxx
+++ b/sw/inc/shellres.hxx
@@ -63,6 +63,7 @@ struct SW_DLLPUBLIC ShellResource : public Resource
OUString aTOXObjectsName;
OUString aTOXTablesName;
OUString aTOXAuthoritiesName;
+ OUString aTOXCitationName;
OUString aLinkCtrlClick;
OUString aLinkClick;
diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx
index ee3b6c6..f6c578f 100644
--- a/sw/inc/tox.hxx
+++ b/sw/inc/tox.hxx
@@ -56,6 +56,7 @@ class SW_DLLPUBLIC SwTOXMark
OUString aAltText; // Text of caption is different.
OUString aPrimaryKey;
OUString aSecondaryKey;
+ OUString aCitationKeyReading;
// three more strings for phonetic sorting
OUString aTextReading;
@@ -113,12 +114,14 @@ public:
inline void SetTextReading(const OUString& rStr);
inline void SetPrimaryKeyReading(const OUString& rStr );
inline void SetSecondaryKeyReading(const OUString& rStr);
+ inline void SetCitationKeyReading(const OUString& rStr);
inline OUString GetPrimaryKey() const;
inline OUString GetSecondaryKey() const;
inline OUString GetTextReading() const;
inline OUString GetPrimaryKeyReading() const;
inline OUString GetSecondaryKeyReading() const;
+ inline OUString GetCitationKeyReading() const;
sal_Bool IsAutoGenerated() const {return bAutoGenerated;}
void SetAutoGenerated(sal_Bool bSet) {bAutoGenerated = bSet;}
@@ -625,6 +628,12 @@ inline void SwTOXMark::SetPrimaryKeyReading( const OUString& rKey )
aPrimaryKeyReading = rKey;
}
+inline void SwTOXMark::SetCitationKeyReading( const OUString& rKey )
+{
+ SAL_WARN_IF(GetTOXType()->GetType() != TOX_CITATION, "sw", "Wrong type");
+ aCitationKeyReading = rKey;
+}
+
inline void SwTOXMark::SetSecondaryKeyReading( const OUString& rKey )
{
SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
@@ -667,6 +676,12 @@ inline OUString SwTOXMark::GetSecondaryKeyReading() const
return aSecondaryKeyReading;
}
+inline OUString SwTOXMark::GetCitationKeyReading() const
+{
+ SAL_WARN_IF(GetTOXType()->GetType() != TOX_CITATION, "sw", "Wrong type");
+ return aCitationKeyReading;
+}
+
//SwForm
inline void SwForm::SetTemplate(sal_uInt16 nLevel, const OUString& rTemplate)
diff --git a/sw/inc/toxe.hxx b/sw/inc/toxe.hxx
index dbb3435..5bf5c9d5 100644
--- a/sw/inc/toxe.hxx
+++ b/sw/inc/toxe.hxx
@@ -42,7 +42,8 @@ enum TOXTypes
TOX_OBJECTS,
TOX_TABLES,
TOX_AUTHORITIES,
- TOX_BIBLIOGRAPHY
+ TOX_BIBLIOGRAPHY,
+ TOX_CITATION
};
// this enum contains all types of sources
enum ToxAuthorityType
diff --git a/sw/qa/extras/ooxmlexport/data/FDO74775.docx b/sw/qa/extras/ooxmlexport/data/FDO74775.docx
new file mode 100644
index 0000000..a8ee588
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/FDO74775.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index a0ea664..96c1995 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2768,7 +2768,17 @@ DECLARE_OOXMLEXPORT_TEST(testlvlPicBulletId, "lvlPicBulletId.docx")
if (!pXmlDoc)
return;
assertXPath(pXmlDoc, "/w:numbering[1]/w:abstractNum[1]/w:lvl[1]/w:lvlPicBulletId[1]", 0);
+}
+DECLARE_OOXMLEXPORT_TEST(testCitation,"FDO74775.docx")
+{
+ xmlDocPtr pXmlDoc = parseExport();
+ if (!pXmlDoc)
+ return;
+ xmlNodeSetPtr pXmlNodes = getXPathNode(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[3]/w:instrText");
+ xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
+ OUString contents = OUString::createFromAscii((const char*)((pXmlNode->children[0]).content));
+ CPPUNIT_ASSERT(contents.match(" CITATION [Kra06]"));
}
#endif
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 48e0951..1da16aa 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -1062,6 +1062,8 @@ void SwDoc::InitTOXTypes()
mpTOXTypes->push_back( pNew );
pNew = new SwTOXType(TOX_AUTHORITIES, pShellRes->aTOXAuthoritiesName );
mpTOXTypes->push_back( pNew );
+ pNew = new SwTOXType(TOX_CITATION, pShellRes->aTOXCitationName );
+ mpTOXTypes->push_back( pNew );
}
void SwDoc::ReplaceDefaults(const SwDoc& rSource)
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 7fb5b70..0896535 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -464,6 +464,7 @@ const SwTOXBase* SwDoc::GetDefaultTOXBase( TOXTypes eTyp, bool bCreate )
case TOX_ILLUSTRATIONS: prBase = &mpDefTOXBases->pIllBase; break;
case TOX_AUTHORITIES: prBase = &mpDefTOXBases->pAuthBase; break;
case TOX_BIBLIOGRAPHY: prBase = &mpDefTOXBases->pBiblioBase; break;
+ case TOX_CITATION: /** TODO */break;
}
if(!(*prBase) && bCreate)
{
@@ -487,6 +488,7 @@ void SwDoc::SetDefaultTOXBase(const SwTOXBase& rBase)
case TOX_ILLUSTRATIONS: prBase = &mpDefTOXBases->pIllBase; break;
case TOX_AUTHORITIES: prBase = &mpDefTOXBases->pAuthBase; break;
case TOX_BIBLIOGRAPHY: prBase = &mpDefTOXBases->pBiblioBase; break;
+ case TOX_CITATION: /** TODO */break;
}
if(*prBase)
delete (*prBase);
@@ -1092,7 +1094,7 @@ SwTxtFmtColl* SwTOXBaseSection::GetTxtFmtColl( sal_uInt16 nLevel )
case TOX_AUTHORITIES:
case TOX_BIBLIOGRAPHY:
nPoolFmt = RES_POOLCOLL_TOX_AUTHORITIESH; break;
-
+ case TOX_CITATION: /** TODO */break;
case TOX_CONTENT:
// There's a jump in the ContentArea!
if( nLevel < 6 )
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx
index c83a82f..76fb0f9 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -540,9 +540,14 @@ SwAuthorityField::~SwAuthorityField()
OUString SwAuthorityField::Expand() const
{
+ return ConditionalExpand(AUTH_FIELD_IDENTIFIER);
+}
+
+OUString SwAuthorityField::ConditionalExpand(ToxAuthorityField eField) const
+{
SwAuthorityFieldType* pAuthType = (SwAuthorityFieldType*)GetTyp();
OUString sRet;
- if(pAuthType->GetPrefix())
+ if(pAuthType->GetPrefix() && eField != AUTH_FIELD_TITLE)
sRet = OUString(pAuthType->GetPrefix());
if( pAuthType->IsSequence() )
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index 1931d82..8f0abbc 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -40,6 +40,7 @@
#include <calc.hxx>
#include <comcore.hrc>
#include <docary.hxx>
+#include <authfld.hxx>
#include <math.h>
@@ -384,13 +385,19 @@ sal_Bool SwField::IsFixed() const
return bRet;
}
-OUString SwField::ExpandField(bool const bCached) const
+OUString SwField::ExpandField(bool const bCached, ToxAuthorityField eField) const
{
if ( m_bUseFieldValueCache )
{
if (!bCached) // #i85766# do not expand fields in clipboard documents
{
- m_Cache = Expand();
+ if (GetTypeId() == TYP_AUTHORITY)
+ {
+ const SwAuthorityField* pAuthorityField = static_cast<const SwAuthorityField*>(this);
+ m_Cache = pAuthorityField->ConditionalExpand(eField);
+ }
+ else
+ m_Cache = Expand();
}
return m_Cache;
}
diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx
index c5a105e..e4a5964 100644
--- a/sw/source/core/tox/tox.cxx
+++ b/sw/source/core/tox/tox.cxx
@@ -281,6 +281,7 @@ SwForm::SwForm( TOXTypes eTyp ) // #i21237#
case TOX_OBJECTS : nPoolId = STR_POOLCOLL_TOX_OBJECTH; break;
case TOX_TABLES : nPoolId = STR_POOLCOLL_TOX_TABLESH; break;
case TOX_AUTHORITIES : nPoolId = STR_POOLCOLL_TOX_AUTHORITIESH; break;
+ case TOX_CITATION : nPoolId = STR_POOLCOLL_TOX_CITATION; break;
default:
OSL_ENSURE( !this, "invalid TOXTyp");
return ;
@@ -393,6 +394,7 @@ sal_uInt16 SwForm::GetFormMaxLevel( TOXTypes eTOXType )
case TOX_OBJECTS :
case TOX_TABLES : nRet = 2; break;
case TOX_BIBLIOGRAPHY :
+ case TOX_CITATION:
case TOX_AUTHORITIES : nRet = AUTH_TYPE_END + 1; break;
}
return nRet;
diff --git a/sw/source/core/uibase/index/toxmgr.cxx b/sw/source/core/uibase/index/toxmgr.cxx
index 6287517..c29bd7b 100644
--- a/sw/source/core/uibase/index/toxmgr.cxx
+++ b/sw/source/core/uibase/index/toxmgr.cxx
@@ -363,6 +363,7 @@ sal_Bool SwTOXMgr::UpdateOrInsertTOX(const SwTOXDescription& rDesc,
pNewTOX->SetLevelFromChapter(rDesc.IsLevelFromChapter());
}
break;
+ case TOX_CITATION: /** TODO */break;
case TOX_OBJECTS:
case TOX_TABLES:
case TOX_AUTHORITIES:
diff --git a/sw/source/core/uibase/utlui/initui.cxx b/sw/source/core/uibase/utlui/initui.cxx
index 1a745a7..d59e0be 100644
--- a/sw/source/core/uibase/utlui/initui.cxx
+++ b/sw/source/core/uibase/utlui/initui.cxx
@@ -204,6 +204,7 @@ ShellResource::ShellResource()
aTOXObjectsName( SW_RES(STR_TOX_OBJ)),
aTOXTablesName( SW_RES(STR_TOX_TBL)),
aTOXAuthoritiesName( SW_RES(STR_TOX_AUTH)),
+ aTOXCitationName( SW_RES(STR_TOX_CITATION)),
aLinkCtrlClick(SW_RESSTR(STR_LINK_CTRL_CLICK)),
aLinkClick(SW_RESSTR(STR_LINK_CLICK)),
pAutoFmtNameLst(0),
diff --git a/sw/source/core/uibase/utlui/initui.hrc b/sw/source/core/uibase/utlui/initui.hrc
index 6df2907..c368dc4 100644
--- a/sw/source/core/uibase/utlui/initui.hrc
+++ b/sw/source/core/uibase/utlui/initui.hrc
@@ -52,6 +52,7 @@
#define STR_LINK_CLICK 29
#define STR_GETREFFLD_REFITEMNOTFOUND 30
#define STR_DURATION_FORMAT 31
+#define STR_TOX_CITATION 32
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/uibase/utlui/initui.src b/sw/source/core/uibase/utlui/initui.src
index 81e47ff..999b27b 100644
--- a/sw/source/core/uibase/utlui/initui.src
+++ b/sw/source/core/uibase/utlui/initui.src
@@ -121,6 +121,12 @@ Resource RID_SW_SHELLRES
{
Text [ en-US ] = "Bibliography";
};
+
+ String STR_TOX_CITATION
+ {
+ Text [ en-US ] = "Citation";
+ };
+
String STR_TOX_TBL
{
Text [ en-US ] = "Index of Tables";
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index ddedeff..94b785a 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -1519,6 +1519,7 @@ lcl_TypeToPropertyMap_Mark(const TOXTypes eType)
{
case TOX_INDEX: return PROPERTY_MAP_INDEX_MARK;
case TOX_CONTENT: return PROPERTY_MAP_CNTIDX_MARK;
+ case TOX_CITATION : return PROPERTY_MAP_FLDTYP_BIBLIOGRAPHY;
//case TOX_USER:
default:
return PROPERTY_MAP_USER_MARK;
@@ -1553,6 +1554,7 @@ public:
OUString m_sPrimaryKeyReading;
OUString m_sSecondaryKeyReading;
OUString m_sUserIndexName;
+ OUString m_sCitaitonText;
Impl( SwXDocumentIndexMark & rThis,
SwDoc *const pDoc,
@@ -1826,6 +1828,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
{
case TOX_INDEX:
case TOX_CONTENT:
+ case TOX_CITATION:
pTOXType = pDoc->GetTOXType( m_pImpl->m_eTOXType, 0 );
break;
case TOX_USER:
@@ -1899,6 +1902,13 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
}
aMark.SetMainEntry(m_pImpl->m_bMainEntry);
break;
+ case TOX_CITATION:
+ if (!m_pImpl->m_sCitaitonText.isEmpty())
+ {
+ aMark.SetCitationKeyReading(m_pImpl->m_sCitaitonText);
+ }
+ aMark.SetMainEntry(m_pImpl->m_bMainEntry);
+ break;
case TOX_USER:
case TOX_CONTENT:
if (USHRT_MAX != m_pImpl->m_nLevel)
@@ -2225,6 +2235,15 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
case WID_MAIN_ENTRY:
m_pImpl->m_bMainEntry = lcl_AnyToBool(rValue);
break;
+ case PROPERTY_MAP_INDEX_OBJECTS:
+ {
+ uno::Sequence<com::sun::star::beans::PropertyValue> aValues(1);
+ com::sun::star::beans::PropertyValue propertyVal;
+ rValue >>= aValues;
+ propertyVal = aValues[0];
+ m_pImpl->m_sCitaitonText = lcl_AnyToString(propertyVal.Value);
+ }
+ break;
}
}
else
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index a4cfd0b..a380dd0 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1043,8 +1043,15 @@ void DocxAttributeOutput::EndField_Impl( FieldInfos& rInfos )
{
// Write the Field latest value
m_pSerializer->startElementNS( XML_w, XML_r, FSEND );
-
- OUString sExpand( rInfos.pField->ExpandField( true ) );
+ OUString sExpand;
+ if(rInfos.eType == ww::eCITATION)
+ {
+ sExpand = rInfos.pField->ExpandField( false , AUTH_FIELD_TITLE);
+ }
+ else
+ {
+ sExpand = rInfos.pField->ExpandField( true );
+ }
// newlines embedded in fields are 0x0B in MSO and 0x0A for us
RunText(sExpand.replace(0x0A, 0x0B));
diff --git a/sw/source/filter/ww8/fields.cxx b/sw/source/filter/ww8/fields.cxx
index baaa4b0..41c3929 100644
--- a/sw/source/filter/ww8/fields.cxx
+++ b/sw/source/filter/ww8/fields.cxx
@@ -126,7 +126,8 @@ namespace ww
/*93*/ "ADDRESSBLOCK",
/*94*/ "GREETINGLINE",
/*95*/ "SHAPE",
- /*96*/ "BIBLIOGRAPHY"
+ /*96*/ "BIBLIOGRAPHY",
+ /*97*/ "CITATION"
};
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 ce88808..8bb8565 100644
--- a/sw/source/filter/ww8/fields.hxx
+++ b/sw/source/filter/ww8/fields.hxx
@@ -121,7 +121,8 @@ namespace ww
eADDRESSBLOCK = 93,
eGREETINGLINE = 94,
eSHAPE = 95,
- eBIBLIOGRPAHY=96
+ eBIBLIOGRPAHY=96,
+ eCITATION = 97
};
/** 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 8094d9d..7eb3134 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -116,6 +116,7 @@
#include <flddropdown.hxx>
#include <chpfld.hxx>
#include <fmthdft.hxx>
+#include <authfld.hxx>
#include <filter/msfilter/sprmids.hxx>
@@ -2862,6 +2863,13 @@ void AttributeOutputBase::TextField( const SwFmtFld& rField )
bWriteExpand = true;
}
break;
+ case RES_AUTHORITY:
+ {
+ const OUString sStr = " CITATION "
+ + lcl_GetExpandedField(*pFld);
+ GetExport().OutputField( pFld, ww::eCITATION, sStr );
+ }
+ break;
case RES_POSTITFLD:
//Sadly only possible for word in main document text
if (GetExport().nTxtTyp == TXT_MAINTEXT)
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 2874313..fe1410b 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -958,6 +958,7 @@ static long lcl_TOXTypesToUserData(CurTOXType eType)
case TOX_TABLES : nRet = TO_TABLE; break;
case TOX_AUTHORITIES : nRet = TO_AUTHORITIES; break;
case TOX_BIBLIOGRAPHY : nRet = TO_BIBLIOGRAPHY; break;
+ case TOX_CITATION :break;
}
return nRet;
}
@@ -1195,6 +1196,8 @@ void SwTOXSelectTabPage::FillTOXDescription()
rDesc.SetAuthSequence(m_pSequenceCB->IsChecked());
}
break;
+ case TOX_CITATION :
+ break;
}
rDesc.SetLevelFromChapter( m_pLevelFromChapterCB->IsVisible() &&
diff --git a/sw/source/ui/utlui/poolfmt.src b/sw/source/ui/utlui/poolfmt.src
index fe2865a..7b4d41c 100644
--- a/sw/source/ui/utlui/poolfmt.src
+++ b/sw/source/ui/utlui/poolfmt.src
@@ -583,6 +583,10 @@ String STR_POOLCOLL_TOX_USER10
{
Text [ en-US ] = "User Index 10" ;
};
+String STR_POOLCOLL_TOX_CITATION
+{
+ Text [ en-US ] = "Citation" ;
+};
String STR_POOLCOLL_TOX_ILLUSH
{
Text [ en-US ] = "Illustration Index Heading";
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 516c436..b912ab4 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -143,6 +143,7 @@ DomainMapper_Impl::DomainMapper_Impl(
m_xTextFactory( xModel, uno::UNO_QUERY ),
m_xComponentContext( xContext ),
m_bSetUserFieldContent( false ),
+ m_bSetCitation( false ),
m_bIsFirstSection( true ),
m_bIsColumnBreakDeferred( false ),
m_bIsPageBreakDeferred( false ),
@@ -2395,6 +2396,7 @@ if(!bFilled)
{OUString("INDEX"), "com.sun.star.text.DocumentIndex", "", FIELD_INDEX},
{OUString("XE"), "com.sun.star.text.DocumentIndexMark", "", FIELD_XE},
{OUString("BIBLIOGRAPHY"), "com.sun.star.text.Bibliography", "", FILED_BIBLIOGRAPHY},
+ {OUString("CITATION"), "com.sun.star.text.TextField.Bibliography", "", FIELD_CITATION},
// {OUString(""), "", "", FIELD_},
@@ -3003,6 +3005,7 @@ void DomainMapper_Impl::CloseFieldCommand()
if( pContext.get() )
{
m_bSetUserFieldContent = false;
+ m_bSetCitation = false;
FieldConversionMap_t aFieldConversionMap = lcl_GetFieldConversion();
try
@@ -3029,6 +3032,7 @@ void DomainMapper_Impl::CloseFieldCommand()
case FIELD_INDEX:
case FIELD_XE:
case FILED_BIBLIOGRAPHY:
+ case FIELD_CITATION:
case FIELD_TC:
case FIELD_EQ:
bCreateField = false;
@@ -3548,6 +3552,38 @@ void DomainMapper_Impl::CloseFieldCommand()
}
}
break;
+ case FIELD_CITATION:
+ {
+ xFieldInterface = m_xTextFactory->createInstance(
+ OUString::createFromAscii(aIt->second.cFieldServiceName));
+ uno::Reference< beans::XPropertySet > xTC(xFieldInterface,
+ uno::UNO_QUERY_THROW);
+
+ if( !sFirstParam.isEmpty()){
+ uno::Sequence<com::sun::star::beans::PropertyValue> aValues(1);
+ com::sun::star::beans::PropertyValue propertyVal;
+ propertyVal.Name = "Identifier";
+ propertyVal.Value = uno::makeAny(sFirstParam);
+ aValues[0] = propertyVal;
+ xTC->setPropertyValue("Fields",
+ uno::makeAny(aValues));
+ }
+ uno::Reference< text::XTextContent > xToInsert( xTC, uno::UNO_QUERY );
+ uno::Reference< text::XTextAppend > xTextAppend = m_aTextAppendStack.top().xTextAppend;
+ if (xTextAppend.is())
+ {
+ uno::Reference< text::XTextCursor > xCrsr = xTextAppend->getText()->createTextCursor();
+ uno::Reference< text::XText > xText = xTextAppend->getText();
+ if(xCrsr.is() && xText.is())
+ {
+ xCrsr->gotoEnd(false);
+ xText->insertTextContent(uno::Reference< text::XTextRange >( xCrsr, uno::UNO_QUERY_THROW ), xToInsert, sal_False);
+ }
+ }
+ m_bSetCitation = true;
+ }
+ break;
+
case FIELD_TC :
{
uno::Reference< beans::XPropertySet > xTC(
@@ -3679,6 +3715,50 @@ void DomainMapper_Impl::SetFieldResult(OUString const& rResult)
rPropNameSupplier.GetName(PROP_CONTENT),
uno::makeAny( rResult ));
}
+ else if ( m_bSetCitation )
+ {
+
+ uno::Reference< beans::XPropertySet > xFieldProperties( xTextField, uno::UNO_QUERY_THROW);
+ // In case of SetExpression, the field result contains the content of the variable.
+ uno::Reference<lang::XServiceInfo> xServiceInfo(xTextField, uno::UNO_QUERY);
+
+ bool bIsSetbiblio = xServiceInfo->supportsService("com.sun.star.text.TextField.Bibliography");
+ if( bIsSetbiblio )
+ {
+ com::sun::star::uno::Any aProperty = xFieldProperties->getPropertyValue("Fields");
+ uno::Sequence<com::sun::star::beans::PropertyValue> aValues ;
+ aProperty >>= aValues;
+ com::sun::star::beans::PropertyValue propertyVal;
+ bool bTitleFound = false;
+ int i=0;
+ for (; i < aValues.getLength(); i++)
+ {
+ propertyVal = aValues[i];
+ if(propertyVal.Name == "Title")
+ {
+ bTitleFound = true;
+ break;
+ }
+ }
+ if(bTitleFound)
+ {
+ OUString titleStr;
+ uno::Any aValue(propertyVal.Value);
+ aValue >>= titleStr;
+ titleStr = titleStr + rResult;
+ propertyVal.Value = uno::makeAny(titleStr);
+ aValues[i] = propertyVal;
+ }
+ else
+ {
+ propertyVal.Name = "Title";
+ propertyVal.Value = uno::makeAny(rResult);
+ aValues[i] = propertyVal;
+ }
+ xFieldProperties->setPropertyValue("Fields",
+ uno::makeAny(aValues));
+ }
+ }
else
{
uno::Reference< beans::XPropertySet > xFieldProperties( xTextField, uno::UNO_QUERY_THROW);
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 6b7ca58..fe8a938 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -313,6 +313,7 @@ private:
FieldStack m_aFieldStack;
bool m_bSetUserFieldContent;
+ bool m_bSetCitation;
bool m_bIsFirstSection;
bool m_bIsColumnBreakDeferred;
bool m_bIsPageBreakDeferred;
diff --git a/writerfilter/source/dmapper/FieldTypes.hxx b/writerfilter/source/dmapper/FieldTypes.hxx
index 9d3d360..d4daff4 100644
--- a/writerfilter/source/dmapper/FieldTypes.hxx
+++ b/writerfilter/source/dmapper/FieldTypes.hxx
@@ -259,7 +259,7 @@ enum FieldId
\f Builds a table of contents using TC entries instead of outline levels
\h Hyperlinks the entries and page numbers within the table of contents
\l Defines the TC entries field level used to build a table of contents
- \n Builds a table of contents or a range of entries, sucah as 1-9, in a table of contents without page numbers
+ \n Builds a table of contents or a range of entries, sucah as �1-9�, in a table of contents without page numbers
\o Builds a table of contents by using outline levels instead of TC entries
\p Defines the separator between the table entry and its page number
\s Builds a table of contents by using a sequence type
@@ -271,7 +271,7 @@ enum FieldId
*/
,FIELD_TOC
/*
- TOC entry: text
+ TOC entry: �text�
\f TC entry in doc with multiple tables
\l Outline Level
\n Suppress page numbers
@@ -297,6 +297,9 @@ enum FieldId
* Bibliography
*/
,FILED_BIBLIOGRAPHY
+ /* Citation
+ */
+ ,FIELD_CITATION
};
}}
More information about the Libreoffice-commits
mailing list