include/xmloff/txtparae.hxx | 29 +++++++++++++++++++++---- sw/inc/redline.hxx | 6 ++++- sw/inc/redline.hxx.gch |binary sw/source/core/unocore/unoredline.cxx | 6 +++-- xmloff/source/text/XMLRedlineExport.cxx | 37 +++++++++++++++++--------------- xmloff/source/text/XMLRedlineExport.hxx | 8 +++--- xmloff/source/text/txtparae.cxx | 13 ++++++----- 7 files changed, 66 insertions(+), 33 deletions(-)
New commits: commit 39816f01c52176d6a262e7684ab9535d9f0ebb61 Author: Rosemary Sebastian <rosemarys...@gmail.com> Date: Sat Jun 25 10:55:35 2016 +0530 Get text positions with changes applied Change-Id: I5ceaad492380d00e55c84cfcf0d66a7c3f4cf9c1 diff --git a/include/xmloff/txtparae.hxx b/include/xmloff/txtparae.hxx index 92fae21..fd13ff1 100644 --- a/include/xmloff/txtparae.hxx +++ b/include/xmloff/txtparae.hxx @@ -93,6 +93,8 @@ class XMLOFF_DLLPUBLIC XMLTextParagraphExport : public XMLStyleExport /// may be NULL (if no redlines should be exported; e.g. in block mode) XMLRedlineExport *pRedlineExport; sal_uInt32 nParaIdx; + sal_uInt32 nParaDelCount; + sal_uInt32 nTextDelCount; bool bProgress; @@ -249,7 +251,7 @@ public: void exportUndoTextRangeEnumeration( const css::uno::Reference< css::container::XEnumeration > & rRangeEnum, - const sal_uInt32& rParaIdx, + sal_uInt32 nParagraphIdx, bool bAutoStyles ); void exportTextRangeEnumeration( const css::uno::Reference< css::container::XEnumeration > & rRangeEnum, @@ -304,7 +306,7 @@ protected: TextPNS eExtensionNS = TextPNS::ODF); void exportUndoParagraph( const css::uno::Reference< css::text::XTextContent > & rTextContent, - const sal_uInt32& rParaIdx, + sal_uInt32 nParaIdx, bool bAutoStyles, bool bProgress, MultiPropertySetHelper& rPropSetHelper); void exportParagraph( @@ -542,9 +544,9 @@ public: void exportTitleAndDescription( const css::uno::Reference< css::beans::XPropertySet > & rPropSet, const css::uno::Reference< css::beans::XPropertySetInfo > & rPropSetInfo ); - void setParaIdx(sal_uInt32 rParaIdx) + void setParaIdx(sal_uInt32 nParagraphIdx) { - nParaIdx = rParaIdx; + nParaIdx = nParagraphIdx; } sal_uInt32 getParaIdx() @@ -552,6 +554,25 @@ public: return nParaIdx; } + void setTextDelCount(sal_uInt32 nTextDeleteCount ) + { + nTextDelCount = nTextDeleteCount; + } + + sal_uInt32 getTextDelCount() + { + return nTextDelCount; + } + + void setParaDelCount(sal_uInt32 nParagraphDelCount) + { + nParaDelCount = nParagraphDelCount; + } + + sal_uInt32 getParaDelCount() + { + return nParaDelCount; + } // This method exports the given XText void exportTrackedChanges( const css::uno::Reference< css::text::XText > & rText, diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx index 5588b94..2ebe5cc 100644 --- a/sw/inc/redline.hxx +++ b/sw/inc/redline.hxx @@ -114,6 +114,7 @@ class SW_DLLPUBLIC SwRedlineData DateTime aStamp; RedlineType_t eType; sal_uInt16 nAuthor, nSeqNo; + OUString sUndoType; public: SwRedlineData( RedlineType_t eT, sal_uInt16 nAut ); @@ -151,6 +152,7 @@ public: void SetComment( const OUString& rS ) { sComment = rS; } void SetUndoStart( const sal_uInt32& rUndoStart ) { nUndoStart = rUndoStart; } void SetUndoEnd( const sal_uInt32& rUndoEnd ) { nUndoEnd = rUndoEnd; } + void SetUndoType( const OUString& rUndoType ) { sUndoType = rUndoType; } void SetTimeStamp( const DateTime& rDT ) { aStamp = rDT; } void SetAutoFormatFlag() @@ -166,7 +168,8 @@ public: pNext->CanCombine( *rCmp.pNext ))) && (( !pExtraData && !rCmp.pExtraData ) || ( pExtraData && rCmp.pExtraData && - *pExtraData == *rCmp.pExtraData )); + *pExtraData == *rCmp.pExtraData )) && + nUndoEnd == rCmp.nUndoStart - 1; } // ExtraData gets copied, the pointer is therefore not taken over by @@ -247,6 +250,7 @@ public: void SetUndoStart( const sal_uInt32& rUndoStart ) { pRedlineData->SetUndoStart( rUndoStart ); } void SetUndoEnd( const sal_uInt32& rUndoEnd ) { pRedlineData->SetUndoEnd( rUndoEnd ); } + void SetUndoType( const OUString& rUndoType ) { pRedlineData->SetUndoType( rUndoType ); } void SetComment( const OUString& rS ) { pRedlineData->SetComment( rS ); } /** ExtraData gets copied, the pointer is therefore not taken over by diff --git a/sw/inc/redline.hxx.gch b/sw/inc/redline.hxx.gch new file mode 100644 index 0000000..1fac9bb Binary files /dev/null and b/sw/inc/redline.hxx.gch differ diff --git a/sw/source/core/unocore/unoredline.cxx b/sw/source/core/unocore/unoredline.cxx index f76f395..d3dd929 100644 --- a/sw/source/core/unocore/unoredline.cxx +++ b/sw/source/core/unocore/unoredline.cxx @@ -311,11 +311,13 @@ uno::Any SwXRedlinePortion::GetPropertyValue( const OUString& rPropertyName, co } else if (rPropertyName == UNO_NAME_REDLINE_UNDO_TYPE) { + OUString sType; if( rRedline.GetUndoEnd() == COMPLETE_STRING || rRedline.GetUndoStart() == rRedline.GetUndoEnd() || rRedline.GetUndoEnd() == 0 ) - aRet <<= OUString("paragraph"); + sType = "paragraph"; else - aRet <<= OUString("text"); + sType = "text"; + aRet <<= sType; } else if (rPropertyName == UNO_NAME_REDLINE_UNDO_START) { diff --git a/xmloff/source/text/XMLRedlineExport.cxx b/xmloff/source/text/XMLRedlineExport.cxx index 1013281..731260c 100644 --- a/xmloff/source/text/XMLRedlineExport.cxx +++ b/xmloff/source/text/XMLRedlineExport.cxx @@ -104,12 +104,12 @@ XMLRedlineExport::~XMLRedlineExport() void XMLRedlineExport::ExportUndoChange( const Reference<XPropertySet> & rPropSet, - const sal_uInt32& rParaIdx, + sal_uInt32 nParaIdx, bool bAutoStyle) { if (!bAutoStyle) { - ExportUndoChangeInfo(rPropSet, rParaIdx); + ExportUndoChangeInfo(rPropSet, nParaIdx); } } @@ -141,39 +141,42 @@ void XMLRedlineExport::SetCurrentXText() pCurrentChangesList = nullptr; } -void XMLRedlineExport::ExportUndoChangeInline( - const Reference<XPropertySet> & rPropSet, const sal_uInt32& rParaIdx) +void XMLRedlineExport::ExportUndoChangedRegion( + const Reference<XPropertySet> & rPropSet, sal_uInt32 nParaIdx) { { Any aAny = rPropSet->getPropertyValue(sRedlineType); OUString sType; aAny >>= sType; - sal_uInt32 nParagraphIdx = rParaIdx, nCharStart, nCharEnd; + sal_uInt32 nCharStart, nCharEnd; + sal_uInt32 nTextDelCount = rExport.GetTextParagraphExport()->getTextDelCount(); rPropSet->getPropertyValue(sRedlineUndoStart) >>= nCharStart; rPropSet->getPropertyValue(sRedlineUndoEnd) >>= nCharEnd; + nCharStart -= nTextDelCount; + nCharEnd -= nTextDelCount; - XMLTokenEnum eUndoType = XML_TEXT; OUString sUndoType; aAny = rPropSet->getPropertyValue(sRedlineUndoType); aAny >>= sUndoType; if( sUndoType == "paragraph" ) { - eUndoType = XML_PARAGRAPH; - nParagraphIdx++; - } - if(eUndoType == XML_PARAGRAPH) - { - rExport.AddAttribute(XML_NAMESPACE_C, XML_START, "/" + rtl::OUString::number(nParagraphIdx)); + nParaIdx++; + rExport.AddAttribute(XML_NAMESPACE_C, XML_START, "/" + rtl::OUString::number(nParaIdx)); rExport.AddAttribute(XML_NAMESPACE_DC, XML_TYPE, XML_PARAGRAPH); } else { - rExport.AddAttribute(XML_NAMESPACE_C, XML_START, "/" + rtl::OUString::number(nParagraphIdx) + "/" + rtl::OUString::number(nCharStart)); + rExport.AddAttribute(XML_NAMESPACE_C, XML_START, "/" + rtl::OUString::number(nParaIdx) + "/" + rtl::OUString::number(nCharStart)); if( sType == sInsert || sType == sFormat ) - rExport.AddAttribute(XML_NAMESPACE_C, XML_END, "/" + rtl::OUString::number(nParagraphIdx) + "/" + rtl::OUString::number(nCharEnd)); - rExport.AddAttribute(XML_NAMESPACE_DC, XML_TYPE, eUndoType); + rExport.AddAttribute(XML_NAMESPACE_C, XML_END, "/" + rtl::OUString::number(nParaIdx) + "/" + rtl::OUString::number(nCharEnd)); + else + rExport.GetTextParagraphExport()->setTextDelCount( rExport.GetTextParagraphExport()->getTextDelCount() + nCharEnd - nCharStart + 1 ); + if( sType == sFormat ) + rExport.AddAttribute(XML_NAMESPACE_DC, XML_TYPE, XML_FORMAT_CHANGE); + else + rExport.AddAttribute(XML_NAMESPACE_DC, XML_TYPE, XML_TEXT); } SvXMLElementExport aChange(rExport, XML_NAMESPACE_TEXT, ConvertTypeName(sType), true, true); @@ -213,7 +216,7 @@ const OUString XMLRedlineExport::ConvertTypeName( } void XMLRedlineExport::ExportUndoChangeInfo( - const Reference<XPropertySet> & rPropSet, const sal_uInt32& rParaIdx) + const Reference<XPropertySet> & rPropSet, sal_uInt32 nParaIdx) { Any aAny = rPropSet->getPropertyValue(sIsCollapsed); bool bCollapsed = *static_cast<sal_Bool const *>(aAny.getValue()); @@ -238,7 +241,7 @@ void XMLRedlineExport::ExportUndoChangeInfo( SvXMLElementExport aChange(rExport, XML_NAMESPACE_OFFICE, XML_CHANGE, true, true); - ExportUndoChangeInline(rPropSet, rParaIdx); + ExportUndoChangedRegion(rPropSet, nParaIdx); } } diff --git a/xmloff/source/text/XMLRedlineExport.hxx b/xmloff/source/text/XMLRedlineExport.hxx index bc86667..40e66b3 100644 --- a/xmloff/source/text/XMLRedlineExport.hxx +++ b/xmloff/source/text/XMLRedlineExport.hxx @@ -106,7 +106,7 @@ public: void ExportUndoChange( /// PropertySet of RedlinePortion const css::uno::Reference<css::beans::XPropertySet> & rPropSet, - const sal_uInt32& rParaIdx, + sal_uInt32 nParaIdx, bool bAutoStyle); /// set the current XText for which changes should be recorded. @@ -139,13 +139,13 @@ public: private: /// export the change mark contained in the text body - void ExportUndoChangeInline( + void ExportUndoChangedRegion( /// PropertySet of RedlinePortion - const css::uno::Reference<css::beans::XPropertySet> & rPropSet, const sal_uInt32& rParaIdx); + const css::uno::Reference<css::beans::XPropertySet> & rPropSet, sal_uInt32 nParaIdx); /// export an change-info element (from a PropertySet) void ExportUndoChangeInfo( - const css::uno::Reference<css::beans::XPropertySet> & rPropSet, const sal_uInt32& rParaIdx); + const css::uno::Reference<css::beans::XPropertySet> & rPropSet, sal_uInt32 nParaIdx); /// convert the change type from API to XML names const OUString ConvertTypeName(const OUString& sApiName); diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index c51bd8e..9abbcbf 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -1163,6 +1163,8 @@ XMLTextParagraphExport::XMLTextParagraphExport( pIndexMarkExport( nullptr ), pRedlineExport( nullptr ), nParaIdx(0), + nParaDelCount(0), + nTextDelCount(0), bProgress( false ), bBlock( false ), bOpenRuby( false ), @@ -1816,6 +1818,7 @@ bool XMLTextParagraphExport::exportUndoTextContentEnumeration( { setParaIdx(getParaIdx() + 1); exportUndoParagraph( xTxtCntnt, getParaIdx(), bAutoStyles, bIsProgress, aPropSetHelper ); + setTextDelCount(0); } } bHasMoreElements = rContEnum->hasMoreElements(); @@ -1992,7 +1995,7 @@ bool XMLTextParagraphExport::exportTextContentEnumeration( } void XMLTextParagraphExport::exportUndoParagraph( - const Reference < XTextContent > & rTextContent, const sal_uInt32& rParaIdx, + const Reference < XTextContent > & rTextContent, sal_uInt32 nParaIdx, bool bAutoStyles, bool bIsProgress, MultiPropertySetHelper& rPropSetHelper) { @@ -2052,10 +2055,10 @@ void XMLTextParagraphExport::exportUndoParagraph( xContentEnum, bAutoStyles, xSection, bIsProgress ); if ( bHasPortions ) - exportUndoTextRangeEnumeration( xTextEnum, rParaIdx, bAutoStyles ); + exportUndoTextRangeEnumeration( xTextEnum, nParaIdx, bAutoStyles ); } else - exportUndoTextRangeEnumeration( xTextEnum, rParaIdx, bAutoStyles ); + exportUndoTextRangeEnumeration( xTextEnum, nParaIdx, bAutoStyles ); } void XMLTextParagraphExport::exportParagraph( @@ -2320,7 +2323,7 @@ void XMLTextParagraphExport::exportParagraph( void XMLTextParagraphExport::exportUndoTextRangeEnumeration( const Reference < XEnumeration > & rTextEnum, - const sal_uInt32& rParaIdx, + sal_uInt32 nParagraphIdx, bool bAutoStyles ) { while( rTextEnum->hasMoreElements() ) @@ -2337,7 +2340,7 @@ void XMLTextParagraphExport::exportUndoTextRangeEnumeration( if (sType.equals(sRedline)) { if (nullptr != pRedlineExport) - pRedlineExport->ExportUndoChange(xPropSet, rParaIdx, bAutoStyles); + pRedlineExport->ExportUndoChange(xPropSet, nParaIdx, bAutoStyles); } } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits