summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-02-20 18:25:26 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-02-20 18:39:23 +0100
commitdeabda6b38417e4c7037c0d0274a4f81b338e552 (patch)
treec33273665daac1d6d34154427f219d8a2df03e58 /writerfilter
parent6e157dc78d495d94948e33822405addb48467e74 (diff)
DOCX import: fix missing underline in comment text
Regression from fb5ee5c9953635a423d3102b901e409d15800096 (sw: Add support for different grab bags at PropertyMap., 2013-11-29), PropertyMap::GetPropertyValues() assumed all XTextRange implementations support the new property, which is not true for at least editeng. Change-Id: Ib5657be522d30f203cecbbbae74d6594cef984fb
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx3
-rw-r--r--writerfilter/source/dmapper/PropertyMap.cxx21
-rw-r--r--writerfilter/source/dmapper/PropertyMap.hxx2
3 files changed, 18 insertions, 8 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index d8237f302385..70b73201b713 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1120,7 +1120,8 @@ void DomainMapper_Impl::appendTextPortion( const OUString& rString, PropertyMapP
{
try
{
- uno::Sequence< beans::PropertyValue > pValues = pPropertyMap->GetPropertyValues();
+ // If we are in comments, then disable CharGrabBag, comment text doesn't support that.
+ uno::Sequence< beans::PropertyValue > pValues = pPropertyMap->GetPropertyValues(/*bCharGrabBag=*/!m_bIsInComments);
sal_Int32 len = pValues.getLength();
if (m_bStartTOC || m_bStartIndex)
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index f90cb204ada1..19d8714168ae 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -60,7 +60,7 @@ PropertyMap::~PropertyMap()
}
-uno::Sequence< beans::PropertyValue > PropertyMap::GetPropertyValues()
+uno::Sequence< beans::PropertyValue > PropertyMap::GetPropertyValues(bool bCharGrabBag)
{
if(!m_aValues.getLength() && size())
{
@@ -73,8 +73,14 @@ uno::Sequence< beans::PropertyValue > PropertyMap::GetPropertyValues()
else if ( i->second.getGrabBagType() == PARA_GRAB_BAG )
nParaGrabBag++;
}
+
+ // In case there are properties to be grab-bagged and we can have a char grab-bag, allocate one slot for it.
+ size_t nCharGrabBagSize = 0;
+ if (bCharGrabBag)
+ nCharGrabBagSize = nCharGrabBag ? 1 : 0;
+
// If there are any grab bag properties, we need one slot for them.
- m_aValues.realloc( size() - nCharGrabBag + (nCharGrabBag ? 1 : 0)
+ m_aValues.realloc( size() - nCharGrabBag + nCharGrabBagSize
- nParaGrabBag + (nParaGrabBag ? 1 : 0));
::com::sun::star::beans::PropertyValue* pValues = m_aValues.getArray();
uno::Sequence<beans::PropertyValue> aCharGrabBagValues(nCharGrabBag);
@@ -116,9 +122,12 @@ uno::Sequence< beans::PropertyValue > PropertyMap::GetPropertyValues()
{
if ( aMapIter->second.getGrabBagType() == CHAR_GRAB_BAG )
{
- pCharGrabBagValues[nCharGrabBagValue].Name = rPropNameSupplier.GetName( aMapIter->first );
- pCharGrabBagValues[nCharGrabBagValue].Value = aMapIter->second.getValue();
- ++nCharGrabBagValue;
+ if (bCharGrabBag)
+ {
+ pCharGrabBagValues[nCharGrabBagValue].Name = rPropNameSupplier.GetName( aMapIter->first );
+ pCharGrabBagValues[nCharGrabBagValue].Value = aMapIter->second.getValue();
+ ++nCharGrabBagValue;
+ }
}
else if ( aMapIter->second.getGrabBagType() == PARA_GRAB_BAG )
{
@@ -134,7 +143,7 @@ uno::Sequence< beans::PropertyValue > PropertyMap::GetPropertyValues()
}
}
}
- if (nCharGrabBag)
+ if (nCharGrabBag && bCharGrabBag)
{
pValues[nValue].Name = "CharInteropGrabBag";
pValues[nValue].Value = uno::makeAny(aCharGrabBagValues);
diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx
index a9279f2307ab..8d9a32bd684b 100644
--- a/writerfilter/source/dmapper/PropertyMap.hxx
+++ b/writerfilter/source/dmapper/PropertyMap.hxx
@@ -112,7 +112,7 @@ public:
PropertyMap();
virtual ~PropertyMap();
- ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetPropertyValues();
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetPropertyValues(bool bCharGrabBag = true);
bool hasEmptyPropertyValues() const {return !m_aValues.getLength();}
/** Add property, usually overwrites already available attributes. It shouldn't overwrite in case of default attributes
*/