[Libreoffice-commits] .: Branch 'distro/suse/suse-3.6' - 2 commits - writerfilter/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Jan 4 08:06:55 PST 2013
writerfilter/source/dmapper/CellMarginHandler.cxx | 6 ++++-
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 17 ++++++++++++--
writerfilter/source/dmapper/TablePropertiesHandler.cxx | 20 +++++++++++++++++
3 files changed, 40 insertions(+), 3 deletions(-)
New commits:
commit 0d40dfd6e0a66e36d5ee1479a4b5fd84470ed502
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Fri Jan 4 12:56:40 2013 +0100
n#793262 DOCX: import w:tcMar inside w:tc
These were ignored previously, and in case they contained some margins,
the resulting table was potentially smaller than necessary.
(cherry picked from commit 672de66ff8ad6d1fbf8a198ee518c996611b9e2d)
diff --git a/writerfilter/source/dmapper/CellMarginHandler.cxx b/writerfilter/source/dmapper/CellMarginHandler.cxx
index 36a85f1..8b14975 100644
--- a/writerfilter/source/dmapper/CellMarginHandler.cxx
+++ b/writerfilter/source/dmapper/CellMarginHandler.cxx
@@ -84,6 +84,7 @@ void CellMarginHandler::lcl_sprm(Sprm & rSprm)
switch( rSprm.getId() )
{
case NS_ooxml::LN_CT_TblCellMar_top:
+ case NS_ooxml::LN_CT_TcMar_top:
m_nTopMargin = m_nValue;
m_bTopMarginValid = true;
break;
@@ -100,10 +101,12 @@ void CellMarginHandler::lcl_sprm(Sprm & rSprm)
}
break;
case NS_ooxml::LN_CT_TblCellMar_left:
+ case NS_ooxml::LN_CT_TcMar_left:
m_nLeftMargin = m_nValue;
m_bLeftMarginValid = true;
break;
case NS_ooxml::LN_CT_TblCellMar_bottom:
+ case NS_ooxml::LN_CT_TcMar_bottom:
m_nBottomMargin = m_nValue;
m_bBottomMarginValid = true;
break;
@@ -120,11 +123,12 @@ void CellMarginHandler::lcl_sprm(Sprm & rSprm)
}
break;
case NS_ooxml::LN_CT_TblCellMar_right:
+ case NS_ooxml::LN_CT_TcMar_right:
m_nRightMargin = m_nValue;
m_bRightMarginValid = true;
break;
default:
- OSL_FAIL( "unknown attribute");
+ OSL_FAIL( "unknown sprm");
}
}
m_nValue = 0;
diff --git a/writerfilter/source/dmapper/TablePropertiesHandler.cxx b/writerfilter/source/dmapper/TablePropertiesHandler.cxx
index 4e7e1d2..5de8cf1 100644
--- a/writerfilter/source/dmapper/TablePropertiesHandler.cxx
+++ b/writerfilter/source/dmapper/TablePropertiesHandler.cxx
@@ -152,6 +152,26 @@ namespace dmapper {
}
}
break;
+ case NS_ooxml::LN_CT_TcPrBase_tcMar:
+ {
+ writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
+ if (pProperties.get())
+ {
+ CellMarginHandlerPtr pCellMarginHandler(new CellMarginHandler);
+ pProperties->resolve(*pCellMarginHandler);
+ TablePropertyMapPtr pCellProperties(new TablePropertyMap);
+ if (pCellMarginHandler->m_bTopMarginValid)
+ pCellProperties->Insert(PROP_TOP_BORDER_DISTANCE, false, uno::makeAny(pCellMarginHandler->m_nTopMargin));
+ if (pCellMarginHandler->m_bLeftMarginValid)
+ pCellProperties->Insert(PROP_LEFT_BORDER_DISTANCE, false, uno::makeAny(pCellMarginHandler->m_nLeftMargin));
+ if (pCellMarginHandler->m_bBottomMarginValid)
+ pCellProperties->Insert(PROP_BOTTOM_BORDER_DISTANCE, false, uno::makeAny(pCellMarginHandler->m_nBottomMargin));
+ if (pCellMarginHandler->m_bRightMarginValid)
+ pCellProperties->Insert(PROP_RIGHT_BORDER_DISTANCE, false, uno::makeAny(pCellMarginHandler->m_nRightMargin));
+ cellProps(pCellProperties);
+ }
+ }
+ break;
case NS_ooxml::LN_CT_TblPrBase_shd:
{
writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
commit f60a7f9af31f69ebe22f2deffa6ebe4132a50e56
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Thu Jan 3 16:40:29 2013 +0100
n#793262 fix DOCX import of last empty header/footer para char props
At the end of the header/footer import, the last empty paragraph was
removed. In case the last but one paragraph was empty, but had character
properties (e.g. a custom font size), the removal changed these, and
used the character properties of the last paragraph instead.
Simply dispose the last paragraph, this way character properties are
always kept.
(cherry picked from commit e8b661dd0aed9b35104e910acbb814748a2c3af0)
Conflicts:
writerfilter/source/dmapper/DomainMapper_Impl.cxx
Change-Id: Ic78f197fe99458becb9d86901bee6dfcb7076a13
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 5c760e4..00f5f2f 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -298,8 +298,21 @@ void DomainMapper_Impl::RemoveLastParagraph( )
{
uno::Reference< text::XTextCursor > xCursor = xTextAppend->createTextCursor();
xCursor->gotoEnd(false);
- xCursor->goLeft( 1, true );
- xCursor->setString(::rtl::OUString());
+ uno::Reference<container::XEnumerationAccess> xEnumerationAccess(xCursor, uno::UNO_QUERY);
+ // Keep the character properties of the last but one paragraph, even if
+ // it's empty. This works for headers/footers, and maybe in other cases
+ // as well, but surely not in textboxes.
+ if (m_bInHeaderFooterImport && xEnumerationAccess.is())
+ {
+ uno::Reference<container::XEnumeration> xEnumeration = xEnumerationAccess->createEnumeration();
+ uno::Reference<lang::XComponent> xParagraph(xEnumeration->nextElement(), uno::UNO_QUERY);
+ xParagraph->dispose();
+ }
+ else
+ {
+ xCursor->goLeft( 1, true );
+ xCursor->setString(OUString());
+ }
}
catch( const uno::Exception& rEx)
{
More information about the Libreoffice-commits
mailing list