summaryrefslogtreecommitdiffstats
path: root/writerfilter
diff options
context:
space:
mode:
authorRohit Deshmukh <rohit.deshmukh@synerzip.com>2014-02-18 12:23:14 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-02-26 12:50:29 +0100
commit598d02d71f40901eab9275704c8bc0e1641b56e3 (patch)
tree9668886ad71e3566b07dfcfcbd843a8a9ad73624 /writerfilter
parentRemove visual noise from tools (diff)
downloadcore-598d02d71f40901eab9275704c8bc0e1641b56e3.tar.gz
core-598d02d71f40901eab9275704c8bc0e1641b56e3.zip
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 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx4
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx48
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.hxx8
-rw-r--r--writerfilter/source/dmapper/FieldTypes.hxx5
4 files changed, 54 insertions, 11 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index c4e3a9f6f163..d5f251765efb 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2459,7 +2459,7 @@ void DomainMapper::data(const sal_uInt8* /*buf*/, size_t /*len*/,
void DomainMapper::lcl_startSectionGroup()
{
- if (!m_pImpl->isInIndexContext())
+ if (!m_pImpl->isInIndexContext() || !m_pImpl->isInBibliographyContext())
{
m_pImpl->PushProperties(CONTEXT_SECTION);
}
@@ -2467,7 +2467,7 @@ void DomainMapper::lcl_startSectionGroup()
void DomainMapper::lcl_endSectionGroup()
{
- if (!m_pImpl->isInIndexContext())
+ if (!m_pImpl->isInIndexContext() || !m_pImpl->isInBibliographyContext())
{
m_pImpl->CheckUnregisteredFrameConversion();
m_pImpl->ExecuteFrameConversion();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 0d98781f5fa4..6e4d439a2204 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -148,6 +148,7 @@ DomainMapper_Impl::DomainMapper_Impl(
m_bStartTOC(false),
m_bStartedTOC(false),
m_bStartIndex(false),
+ m_bStartBibliography(false),
m_bTOCPageRef(false),
m_pLastSectionContext( ),
m_pLastCharacterContext(),
@@ -174,6 +175,7 @@ DomainMapper_Impl::DomainMapper_Impl(
m_aAnnotationPositions(),
m_xInsertTextRange(xInsertTextRange),
m_bIsNewDoc(bIsNewDoc),
+ m_bBibliographyMarkerAdded(false),
m_bInTableStyleRunProps(false),
m_pSdtHelper(0),
m_nTableDepth(0),
@@ -1125,7 +1127,7 @@ void DomainMapper_Impl::appendTextPortion( const OUString& rString, PropertyMapP
uno::Sequence< beans::PropertyValue > pValues = pPropertyMap->GetPropertyValues(/*bCharGrabBag=*/!m_bIsInComments);
sal_Int32 len = pValues.getLength();
- if (m_bStartTOC || m_bStartIndex)
+ if (m_bStartTOC || m_bStartIndex || m_bStartBibliography)
for( int i =0; i < len; ++i )
{
if (pValues[i].Name == "CharHidden")
@@ -1140,7 +1142,7 @@ void DomainMapper_Impl::appendTextPortion( const OUString& rString, PropertyMapP
}
else
{
- if (m_bStartTOC || m_bStartIndex)
+ if (m_bStartTOC || m_bStartIndex || m_bStartBibliography)
{
m_bStartedTOC = true;
uno::Reference< text::XTextCursor > xTOCTextCursor;
@@ -1148,7 +1150,7 @@ void DomainMapper_Impl::appendTextPortion( const OUString& rString, PropertyMapP
xTOCTextCursor->gotoEnd(false);
if (xTOCTextCursor.is())
{
- if (m_bStartIndex)
+ if (m_bStartIndex || m_bStartBibliography)
xTOCTextCursor->goLeft(1, false);
xTextRange = xTextAppend->insertTextPortion(rString, pValues, xTOCTextCursor);
xTOCTextCursor->gotoRange(xTextRange->getEnd(), true);
@@ -2289,6 +2291,7 @@ if(!bFilled)
{OUString("NUMPAGES"), "PageCount", "", FIELD_NUMPAGES},
{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(""), "", "", FIELD_},
@@ -2826,6 +2829,29 @@ void DomainMapper_Impl::handleToc
}
}
}
+
+void DomainMapper_Impl::handleBibliography
+ (FieldContextPtr pContext,
+ PropertyNameSupplier& rPropNameSupplier,
+ const OUString & sTOCServiceName)
+{
+ uno::Reference< beans::XPropertySet > xTOC;
+ m_bStartTOC = true;
+ m_bStartBibliography = true;
+ if (m_xTextFactory.is())
+ xTOC.set(
+ m_xTextFactory->createInstance(
+ sTOCServiceName),
+ uno::UNO_QUERY_THROW);
+ if (xTOC.is())
+ xTOC->setPropertyValue(rPropNameSupplier.GetName( PROP_TITLE ), uno::makeAny(OUString()));
+
+ pContext->SetTOC( xTOC );
+
+ uno::Reference< text::XTextContent > xToInsert( xTOC, uno::UNO_QUERY );
+ appendTextContent(xToInsert, uno::Sequence< beans::PropertyValue >() );
+}
+
void DomainMapper_Impl::handleIndex
(FieldContextPtr pContext,
PropertyNameSupplier& rPropNameSupplier,
@@ -2901,6 +2927,7 @@ void DomainMapper_Impl::CloseFieldCommand()
case FIELD_TOC:
case FIELD_INDEX:
case FIELD_XE:
+ case FILED_BIBLIOGRAPHY:
case FIELD_TC:
case FIELD_EQ:
bCreateField = false;
@@ -3386,6 +3413,10 @@ void DomainMapper_Impl::CloseFieldCommand()
handleIndex(pContext, rPropNameSupplier, xFieldInterface, xFieldProperties,
OUString::createFromAscii(aIt->second.cFieldServiceName));
break;
+ case FILED_BIBLIOGRAPHY:
+ handleBibliography(pContext, rPropNameSupplier,
+ OUString::createFromAscii(aIt->second.cFieldServiceName));
+ break;
case FIELD_TOC:
handleToc(pContext, rPropNameSupplier, xFieldInterface, xFieldProperties,
OUString::createFromAscii(aIt->second.cFieldServiceName));
@@ -3597,9 +3628,9 @@ void DomainMapper_Impl::PopFieldContext()
uno::Reference< text::XTextContent > xToInsert( pContext->GetTOC(), uno::UNO_QUERY );
if( xToInsert.is() )
{
- if(xTOCMarkerCursor.is() || m_bStartIndex)
+ if(xTOCMarkerCursor.is() || m_bStartIndex || m_bStartBibliography)
{
- if (m_bStartIndex)
+ if (m_bStartIndex || m_bStartBibliography)
{
if (mxTOCTextCursor.is())
{
@@ -3616,20 +3647,21 @@ void DomainMapper_Impl::PopFieldContext()
xTOCMarkerCursor->setString(OUString());
}
}
- if (m_bStartedTOC || m_bStartIndex)
+ if (m_bStartedTOC || m_bStartIndex || m_bStartBibliography)
{
m_bStartedTOC = false;
m_aTextAppendStack.pop();
}
m_bStartTOC = false;
m_bStartIndex = false;
+ m_bStartBibliography = false;
}
else
{
xToInsert = uno::Reference< text::XTextContent >(pContext->GetTC(), uno::UNO_QUERY);
- if( !xToInsert.is() && !m_bStartTOC && !m_bStartIndex )
+ if( !xToInsert.is() && !m_bStartTOC && !m_bStartIndex && !m_bStartBibliography )
xToInsert = uno::Reference< text::XTextContent >(pContext->GetTextField(), uno::UNO_QUERY);
- if( xToInsert.is() && !m_bStartTOC && !m_bStartIndex)
+ if( xToInsert.is() && !m_bStartTOC && !m_bStartIndex && !m_bStartBibliography)
{
uno::Sequence<beans::PropertyValue> aValues;
// Character properties of the field show up here the
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 758dcaa5a9b6..b53cd341d455 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -316,6 +316,7 @@ private:
/// If we got any text that is the pre-rendered result of the TOC field.
bool m_bStartedTOC;
bool m_bStartIndex;
+ bool m_bStartBibliography;
bool m_bTOCPageRef;
LineNumberSettings m_aLineNumberSettings;
@@ -402,6 +403,7 @@ public:
::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > m_xInsertTextRange;
private:
bool m_bIsNewDoc;
+ bool m_bBibliographyMarkerAdded;
public:
DomainMapper_Impl(
DomainMapper& rDMapper,
@@ -590,6 +592,11 @@ public:
uno::Reference< uno::XInterface > & xFieldInterface,
uno::Reference< beans::XPropertySet > xFieldProperties,
const OUString & sTOCServiceName);
+
+ void handleBibliography
+ (FieldContextPtr pContext,
+ PropertyNameSupplier& rPropNameSupplier,
+ const OUString & sTOCServiceName);
//the field command has to be closed (0x14 appeared)
void CloseFieldCommand();
//the _current_ fields require a string type result while TOCs accept richt results
@@ -755,6 +762,7 @@ public:
/// ST_PositivePercentage values we received
std::queue<OUString> m_aPositivePercentages;
bool isInIndexContext() { return m_bStartIndex;}
+ bool isInBibliographyContext() { return m_bStartBibliography;}
private:
void PushPageHeaderFooter(bool bHeader, SectionPropertyMap::PageType eType);
diff --git a/writerfilter/source/dmapper/FieldTypes.hxx b/writerfilter/source/dmapper/FieldTypes.hxx
index e61e31e04eea..2a54dfea2da6 100644
--- a/writerfilter/source/dmapper/FieldTypes.hxx
+++ b/writerfilter/source/dmapper/FieldTypes.hxx
@@ -293,7 +293,10 @@ enum FieldId
/* Document alphabetical index marks
*/
,FIELD_XE
-
+ /**
+ * Bibliography
+ */
+ ,FILED_BIBLIOGRAPHY
};
}}