diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2023-02-22 08:11:00 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2023-03-03 08:45:03 +0100 |
commit | 58e70891131a99d4eb38b362bb2d4246c7a67cb6 (patch) | |
tree | bb97ce4f6b053a5def5eba60280c3ea032912d84 /writerfilter | |
parent | 22826c8a9e765a5894828ae1764b72b30284352c (diff) |
sw floatable: teach the DOCX filter about SwFormatFlySplit
- stop creating a grab-bag for floating tables in the DOCX import if
split flys are allowed, which gives the exporter an opportunity to
actually read the doc model
- extract that code that writes a <w:tblpPr> from a ww8::Frame to a new
CollectFloatingTableAttributes()
- in case a fly frame has a table and the fly has SwFormatFlySplit=true,
then call CollectFloatingTableAttributes() even without grab-bags
- in the unlikely case that we would have both a split fly and a
grab-bag, ignore the grab-bag
With this, we get a working DOCX export for multi-page floating tables.
The import is still disabled by default.
(cherry picked from commit e7be3b821cd42fdc9d8e51772b8202030d76497e)
Change-Id: I601833c49f49f94e1ff3cdc994e3027ee0542b94
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index df4e3fb5424e..9608509b03e6 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -59,6 +59,22 @@ #include <utility> #endif +namespace +{ +bool IsFlySplitAllowed() +{ + bool bRet + = officecfg::Office::Writer::Filter::Import::DOCX::ImportFloatingTableAsSplitFly::get(); + + if (!bRet) + { + bRet = getenv("SW_FORCE_FLY_SPLIT") != nullptr; + } + + return bRet; +} +} + namespace writerfilter::dmapper { using namespace ::com::sun::star; @@ -376,7 +392,10 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo comphelper::makePropertyValue("vertAnchor", pTablePositions->getVertAnchor()) }; - aGrabBag["TablePosition"] <<= aGrabBagTS; + if (!IsFlySplitAllowed()) + { + aGrabBag["TablePosition"] <<= aGrabBagTS; + } } else if (bConvertToFloatingInFootnote) { @@ -1566,12 +1585,7 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel, bool bTab comphelper::makePropertyValue("IsFollowingTextFlow", true)); } - bool bSplitAllowed = officecfg::Office::Writer::Filter::Import::DOCX::ImportFloatingTableAsSplitFly::get(); - if (!bSplitAllowed) - { - bSplitAllowed = getenv("SW_FORCE_FLY_SPLIT") != nullptr; - } - if (bSplitAllowed) + if (IsFlySplitAllowed()) { aFrameProperties.push_back(comphelper::makePropertyValue("IsSplitAllowed", true)); } |