summaryrefslogtreecommitdiffstats
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2013-10-24 11:40:36 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2013-10-24 13:08:41 +0200
commit195ca828bb0ce5ce0e545eb6deb90f0c25f06fd9 (patch)
tree1adff57f5a316cbb6a52db22d6e0cdb7b022ad5c /writerfilter
parentuse MsLangId::isNonLatinWestern() (diff)
downloadcore-195ca828bb0ce5ce0e545eb6deb90f0c25f06fd9.tar.gz
core-195ca828bb0ce5ce0e545eb6deb90f0c25f06fd9.zip
writerfilter: preserve names of table styles
And also add a method stub where contents will be preserved as well. Change-Id: Ide52102d1bdf6bf9d73b84ed6760f2b1e086a805
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/StyleSheetTable.cxx33
-rw-r--r--writerfilter/source/dmapper/StyleSheetTable.hxx2
2 files changed, 35 insertions, 0 deletions
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index ab07e89f07a4..6a19538f5cfb 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -173,6 +173,13 @@ PropertyMapPtr TableStyleSheetEntry::GetProperties( sal_Int32 nMask, StyleSheetE
return pProps;
}
+beans::PropertyValue TableStyleSheetEntry::GetInteropGrabBag()
+{
+ beans::PropertyValue aRet;
+ aRet.Name = sStyleName;
+ return aRet;
+}
+
void lcl_mergeProps( PropertyMapPtr pToFill, PropertyMapPtr pToAdd, TblStyleType nStyleId )
{
static const PropertyIds pPropsToCheck[] =
@@ -795,6 +802,7 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable )
xStyleFamilies->getByName("NumberingStyles") >>= xNumberingStyles;
if(xCharStyles.is() && xParaStyles.is())
{
+ std::vector<beans::PropertyValue> aTableStylesVec;
std::vector< StyleSheetEntryPtr >::iterator aIt = m_pImpl->m_aStyleSheetEntries.begin();
while( aIt != m_pImpl->m_aStyleSheetEntries.end() )
{
@@ -1046,8 +1054,33 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable )
xStyles->insertByName( sConvertedStyleName, uno::makeAny( xStyle) );
}
}
+ else if(pEntry->nStyleTypeCode == STYLE_TYPE_TABLE)
+ {
+ // If this is a table style, save its contents as-is for roundtrip purposes.
+ TableStyleSheetEntry* pTableEntry = static_cast<TableStyleSheetEntry *>(pEntry.get());
+ aTableStylesVec.push_back(pTableEntry->GetInteropGrabBag());
+ }
++aIt;
}
+
+ if (!aTableStylesVec.empty())
+ {
+ // If we had any table styles, add a new document-level InteropGrabBag entry for them.
+ uno::Reference<beans::XPropertySet> xPropertySet(m_pImpl->m_xTextDocument, uno::UNO_QUERY);
+ uno::Sequence<beans::PropertyValue> aGrabBag;
+ xPropertySet->getPropertyValue("InteropGrabBag") >>= aGrabBag;
+ sal_Int32 nLength = aGrabBag.getLength();
+ aGrabBag.realloc(nLength + 1);
+ aGrabBag[nLength].Name = "tableStyles";
+
+ uno::Sequence<beans::PropertyValue> aTableStyles(aTableStylesVec.size());
+ beans::PropertyValue* pTableStyles = aTableStyles.getArray();
+ for (std::vector<beans::PropertyValue>::iterator i = aTableStylesVec.begin(); i != aTableStylesVec.end(); ++i)
+ *pTableStyles++ = *i;
+
+ aGrabBag[nLength].Value = uno::makeAny(aTableStyles);
+ xPropertySet->setPropertyValue("InteropGrabBag", uno::makeAny(aGrabBag));
+ }
}
}
catch( const uno::Exception& rException )
diff --git a/writerfilter/source/dmapper/StyleSheetTable.hxx b/writerfilter/source/dmapper/StyleSheetTable.hxx
index 281165324131..c415ec343aef 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.hxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.hxx
@@ -141,6 +141,8 @@ public:
// @param pStack already processed StyleSheetEntries
PropertyMapPtr GetProperties( sal_Int32 nMask, StyleSheetEntryDequePtr pStack = StyleSheetEntryDequePtr());
+ beans::PropertyValue GetInteropGrabBag();
+
TableStyleSheetEntry( StyleSheetEntry& aEntry, StyleSheetTable* pStyles );
virtual ~TableStyleSheetEntry( );