diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2017-06-19 15:32:16 +0200 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2017-07-06 15:02:39 +0200 |
commit | bba6e442b0d8a4adae1b4e64a7fa7246130e300e (patch) | |
tree | f2c586ef5c4613df5922efb9444bc4c3c4b9f845 /sw | |
parent | 0a040f72397f235f8fd61e4161efad219b1ef710 (diff) |
Watermark: tdf#91687 correct size in the .doc
Export:
* Watermarks saved using Writer were very small in the MSO.
Export fUsegtextFStretch property in the Geometry Text
Boolean Properties.
* tdf#91687: SnapRect contains size of Watermark after rotation.
We have to export size without rotation.
Import:
* When import set height depending on used font and width.
Text will keep the ratio. Remember the padding for export.
* added unit test
* introduced enum to avoid magic numbers for stretch and best fit
properties.
Change-Id: I3427afe78488d499f13c543ca401c096161aaf34
Reviewed-on: https://gerrit.libreoffice.org/38979
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
(cherry picked from commit d72e0cadceb0b43928a9b4f18d75c9d5d30afdda)
Reviewed-on: https://gerrit.libreoffice.org/39607
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ww8export/data/tdf91687.doc | bin | 0 -> 23552 bytes | |||
-rw-r--r-- | sw/qa/extras/ww8export/ww8export2.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8esh.cxx | 7 |
3 files changed, 16 insertions, 1 deletions
diff --git a/sw/qa/extras/ww8export/data/tdf91687.doc b/sw/qa/extras/ww8export/data/tdf91687.doc Binary files differnew file mode 100644 index 000000000000..d1c1e0a0c381 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf91687.doc diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx index 3f8a2037681a..681e3173b519 100644 --- a/sw/qa/extras/ww8export/ww8export2.cxx +++ b/sw/qa/extras/ww8export/ww8export2.cxx @@ -105,6 +105,16 @@ DECLARE_WW8EXPORT_TEST(testTdf108072, "tdf108072.doc") CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xTableRows->getByIndex(0), "IsSplitAllowed")); } +DECLARE_WW8EXPORT_TEST(testTdf91687, "tdf91687.doc") +{ + // Exported Watermarks were resized + uno::Reference<drawing::XShape> xWatermark = getShape(1); + uno::Reference<beans::XPropertySet> xWatermarkProperties(xWatermark, uno::UNO_QUERY); + + CPPUNIT_ASSERT_EQUAL((sal_Int32)5172, xWatermark->getSize().Height); + CPPUNIT_ASSERT_EQUAL((sal_Int32)18105, xWatermark->getSize().Width); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index da6023a18345..459509fac74d 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -756,7 +756,12 @@ void PlcDrawObj::WritePlc( WW8Export& rWrt ) const OSL_ENSURE(pObj, "Where is the SDR-Object?"); if (pObj) { - aRect = pObj->GetSnapRect(); + aRect = pObj->GetLogicRect(); + + // We have to export original size with padding + const SfxItemSet& rSet = pObj->GetMergedItemSet(); + const SdrMetricItem* pItem = static_cast<const SdrMetricItem*>(rSet.GetItem(SDRATTR_TEXT_UPPERDIST)); + aRect.SetSize(Size(aRect.GetWidth(), aRect.GetHeight() + pItem->GetValue())); } } |