summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-03-12 11:42:34 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-03-13 08:08:50 -0500
commit9cd8fb08f47bc0900e49a32eaee165b956406096 (patch)
treef912a9715e0ffc04a0e43e96598fc313c3bbc06c
parent0b772a163b2536fc55aa3b4de925119e33af7691 (diff)
bnc#865381 DOCX import: table cell btLr text direction fixes
(cherry picked from commit 48b5b7641d0df960558082e8948da8598f801264) (cherry picked from commit 970160f78ef6cc7abacfa252daa8451e1f0117bb) Conflicts: sw/qa/extras/ooxmlimport/ooxmlimport.cxx writerfilter/source/dmapper/DomainMapperTableManager.cxx writerfilter/source/dmapper/TablePropertiesHandler.cxx Change-Id: I527955671e1100f05da717bffe002131baaf0291 Reviewed-on: https://gerrit.libreoffice.org/8554 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--writerfilter/source/dmapper/DomainMapperTableManager.cxx15
-rw-r--r--writerfilter/source/dmapper/DomainMapperTableManager.hxx7
-rw-r--r--writerfilter/source/dmapper/TablePropertiesHandler.cxx12
3 files changed, 26 insertions, 8 deletions
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index 157fbf83b914..6ca05de8f55d 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -55,6 +55,7 @@ DomainMapperTableManager::DomainMapperTableManager(bool bOOXML) :
m_aTmpTableProperties(),
m_bPushCurrentWidth(false),
m_bRowSizeTypeInserted(false),
+ m_bHasBtlrCell(false),
m_bTableSizeTypeInserted(false),
m_nLayoutType(0),
m_nMaxFixedWidth(0),
@@ -336,10 +337,15 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
SAL_INFO( "writerfilter", "Have inserted textDirection " << nIntValue );
// We're faking a text direction, so don't allow multiple lines.
- TablePropertyMapPtr pRowPropMap( new TablePropertyMap );
- pRowPropMap->Insert(PROP_SIZE_TYPE, false, uno::makeAny(text::SizeType::FIX));
- m_bRowSizeTypeInserted = true;
- insertRowProps(pRowPropMap);
+ if (!getCellProps() || getCellProps()->find(PropertyDefinition(PROP_VERTICAL_MERGE, false)) == getCellProps()->end())
+ {
+ // Though in case there will be a vertical merge, don't do this, it hides text that is supposed to be visible.
+ TablePropertyMapPtr pRowPropMap( new TablePropertyMap );
+ pRowPropMap->Insert(PROP_SIZE_TYPE, false, uno::makeAny(text::SizeType::FIX));
+ m_bRowSizeTypeInserted = true;
+ insertRowProps(pRowPropMap);
+ }
+ m_bHasBtlrCell = true;
}
break;
case 4: // lrTbV
@@ -720,6 +726,7 @@ void DomainMapperTableManager::endOfRowAction()
m_nGridBefore = m_nGridAfter = 0;
m_bRowSizeTypeInserted = false;
+ m_bHasBtlrCell = false;
m_bTableSizeTypeInserted = false;
#ifdef DEBUG_DOMAINMAPPER
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.hxx b/writerfilter/source/dmapper/DomainMapperTableManager.hxx
index 6243b619c0e1..ea1a953c212d 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.hxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.hxx
@@ -58,6 +58,8 @@ class DomainMapperTableManager : public DomainMapperTableManager_Base_t
::std::vector< IntVectorPtr > m_aCellWidths;
/// Remember if a cell already set this, then it should not be set at a row level.
bool m_bRowSizeTypeInserted;
+ /// At least one cell in the current row has the btLr text direction.
+ bool m_bHasBtlrCell;
/// Remember if table width was already set, when we lack a w:tblW, it should be set manually at the end.
bool m_bTableSizeTypeInserted;
/// Table layout algorithm, IOW if we should consider fixed column width or not.
@@ -133,6 +135,11 @@ public:
return m_bRowSizeTypeInserted;
}
+ bool HasBtlrCell() const
+ {
+ return m_bHasBtlrCell;
+ }
+
bool IsTableSizeTypeInserted() const
{
return m_bTableSizeTypeInserted;
diff --git a/writerfilter/source/dmapper/TablePropertiesHandler.cxx b/writerfilter/source/dmapper/TablePropertiesHandler.cxx
index 4023a2134abb..0b5952cd5434 100644
--- a/writerfilter/source/dmapper/TablePropertiesHandler.cxx
+++ b/writerfilter/source/dmapper/TablePropertiesHandler.cxx
@@ -94,12 +94,16 @@ namespace dmapper {
pProperties->resolve(*pMeasureHandler);
TablePropertyMapPtr pPropMap( new TablePropertyMap );
- // In case a cell already wanted fixed size, we should not overwrite it here.
DomainMapperTableManager* pManager = dynamic_cast<DomainMapperTableManager*>(m_pTableManager);
- if (!pManager || !pManager->IsRowSizeTypeInserted())
- pPropMap->Insert( PROP_SIZE_TYPE, false, uno::makeAny( pMeasureHandler->GetRowHeightSizeType() ), false);
+ // In case any of the cells has the btLr cell direction, then an explicit minimal size will just hide the whole row, don't do that.
+ if (pMeasureHandler->GetRowHeightSizeType() != text::SizeType::MIN || !pManager->HasBtlrCell())
+ {
+ // In case a cell already wanted fixed size, we should not overwrite it here.
+ if (!pManager || !pManager->IsRowSizeTypeInserted())
+ pPropMap->Insert( PROP_SIZE_TYPE, false, uno::makeAny( pMeasureHandler->GetRowHeightSizeType() ), false);
- pPropMap->Insert( PROP_HEIGHT, false, uno::makeAny(pMeasureHandler->getMeasureValue() ));
+ pPropMap->Insert( PROP_HEIGHT, false, uno::makeAny(pMeasureHandler->getMeasureValue() ));
+ }
insertRowProps(pPropMap);
}
}