[Libreoffice-commits] core.git: sw/source
Ashod Nakashian
ashodnakashian at yahoo.com
Fri Nov 3 11:06:16 UTC 2017
sw/source/filter/ww8/wrtw8nds.cxx | 39 +++++++++++++++++++++++++++++++++++++-
sw/source/filter/ww8/wrtww8.hxx | 3 +-
2 files changed, 40 insertions(+), 2 deletions(-)
New commits:
commit 4bba85e04cda1cb5769114be5ad771de55d56d14
Author: Ashod Nakashian <ashodnakashian at yahoo.com>
Date: Mon Oct 30 15:08:44 2017 -0400
TSCP: don't export metadata field text in DOCX
Change-Id: I28ae3e57d3766497077af091fe4721fe653def4b
Reviewed-on: https://gerrit.libreoffice.org/44118
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index de71bd55e618..87c27db44c89 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -658,7 +658,7 @@ FlyProcessingState SwWW8AttrIter::OutFlys(sal_Int32 nSwPos)
return ( m_rExport.AttrOutput().IsFlyProcessingPostponed() ? FLY_POSTPONED : FLY_PROCESSED ) ;
}
-bool SwWW8AttrIter::IsTextAttr( sal_Int32 nSwPos )
+bool SwWW8AttrIter::IsTextAttr( sal_Int32 nSwPos ) const
{
// search for attrs with dummy character or content
if (const SwpHints* pTextAttrs = rNd.GetpSwpHints())
@@ -683,6 +683,32 @@ bool SwWW8AttrIter::IsTextAttr( sal_Int32 nSwPos )
return false;
}
+bool SwWW8AttrIter::IsExportableAttr(sal_Int32 nSwPos) const
+{
+ if (const SwpHints* pTextAttrs = rNd.GetpSwpHints())
+ {
+ for (size_t i = 0; i < pTextAttrs->Count(); ++i)
+ {
+ const SwTextAttr* pHt = pTextAttrs->GetSortedByEnd(i);
+ const sal_Int32 nStart = pHt->GetStart();
+ const sal_Int32 nEnd = pHt->End() ? *pHt->End() : INT_MAX;
+ if (nSwPos >= nStart && nSwPos < nEnd)
+ {
+ switch (pHt->GetAttr().Which())
+ {
+ // Metadata fields should be dynamically generated, not dumped as text.
+ case RES_TXTATR_METAFIELD:
+ return false;
+ }
+ }
+ else if (nSwPos > nEnd)
+ break;
+ }
+ }
+
+ return true;
+}
+
bool SwWW8AttrIter::IsDropCap( int nSwPos )
{
// see if the current position falls on a DropCap
@@ -2151,12 +2177,23 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode )
}
do {
+
const SwRedlineData* pRedlineData = aAttrIter.GetRunLevelRedline( nAktPos );
FlyProcessingState nStateOfFlyFrame = FLY_PROCESSED;
bool bPostponeWritingText = false ;
OUString aSavedSnippet ;
sal_Int32 nNextAttr = GetNextPos( &aAttrIter, rNode, nAktPos );
+
+ // Skip un-exportable attributes.
+ if (!aAttrIter.IsExportableAttr(nAktPos))
+ {
+ nAktPos = nNextAttr;
+ UpdatePosition(&aAttrIter, nAktPos);
+ eChrSet = aAttrIter.GetCharSet();
+ continue;
+ }
+
// Is this the only run in this paragraph and it's empty?
bool bSingleEmptyRun = nAktPos == 0 && nNextAttr == 0;
AttrOutput().StartRun( pRedlineData, bSingleEmptyRun );
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index e995f61cf140..c3f05caad3c9 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -1482,7 +1482,8 @@ private:
public:
SwWW8AttrIter( MSWordExportBase& rWr, const SwTextNode& rNd );
- bool IsTextAttr( sal_Int32 nSwPos );
+ bool IsTextAttr( sal_Int32 nSwPos ) const;
+ bool IsExportableAttr(sal_Int32 nSwPos) const;
bool IncludeEndOfParaCRInRedlineProperties(sal_Int32 nPos) const;
bool IsDropCap( int nSwPos );
bool RequiresImplicitBookmark();
More information about the Libreoffice-commits
mailing list