summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--filter/source/msfilter/escherex.cxx4
-rw-r--r--filter/source/msfilter/msdffimp.cxx34
-rw-r--r--include/svx/msdffdef.hxx7
-rw-r--r--sw/qa/extras/ww8export/data/tdf91687.docbin0 -> 23552 bytes
-rw-r--r--sw/qa/extras/ww8export/ww8export2.cxx10
-rw-r--r--sw/source/filter/ww8/wrtw8esh.cxx7
6 files changed, 56 insertions, 6 deletions
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index cf83e13057d6..6149a1ccc8c0 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -3486,6 +3486,10 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT
if ( pOutlinerParaObject && pOutlinerParaObject->IsVertical() )
nTextPathFlags |= 0x2000;
}
+
+ // Use gtextFStretch for Watermark like MSO does
+ nTextPathFlags |= use_gtextFStretch | gtextFStretch;
+
if ( nTextPathFlags != nTextPathFlagsOrg )
AddOpt( DFF_Prop_gtextFStrikethrough, nTextPathFlags );
}
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 4dd1519bd74f..8053abeb8d26 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -4338,7 +4338,8 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
pRet = new SdrObjCustomShape();
pRet->SetModel( pSdrModel );
- bool bIsFontwork = ( GetPropertyValue( DFF_Prop_gtextFStrikethrough, 0 ) & 0x4000 ) != 0;
+ sal_uInt32 ngtextFStrikethrough = GetPropertyValue( DFF_Prop_gtextFStrikethrough, 0 );
+ bool bIsFontwork = ( ngtextFStrikethrough & 0x4000 ) != 0;
// in case of a FontWork, the text is set by the escher import
if ( bIsFontwork )
@@ -4363,16 +4364,16 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
// SJ: applying fontattributes for Fontwork :
if ( IsHardAttribute( DFF_Prop_gtextFItalic ) )
- aSet.Put( SvxPostureItem( ( GetPropertyValue( DFF_Prop_gtextFStrikethrough, 0 ) & 0x0010 ) != 0 ? ITALIC_NORMAL : ITALIC_NONE, EE_CHAR_ITALIC ) );
+ aSet.Put( SvxPostureItem( ( ngtextFStrikethrough & 0x0010 ) != 0 ? ITALIC_NORMAL : ITALIC_NONE, EE_CHAR_ITALIC ) );
if ( IsHardAttribute( DFF_Prop_gtextFBold ) )
- aSet.Put( SvxWeightItem( ( GetPropertyValue( DFF_Prop_gtextFStrikethrough, 0 ) & 0x0020 ) != 0 ? WEIGHT_BOLD : WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
+ aSet.Put( SvxWeightItem( ( ngtextFStrikethrough & 0x0020 ) != 0 ? WEIGHT_BOLD : WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
// SJ TODO: Vertical Writing is not correct, instead
// this should be replaced through "CharacterRotation"
// by 90 degrees, therefore a new Item has to be
// supported by svx core, api and xml file format
- static_cast<SdrObjCustomShape*>(pRet)->SetVerticalWriting( ( GetPropertyValue( DFF_Prop_gtextFStrikethrough, 0 ) & 0x2000 ) != 0 );
+ static_cast<SdrObjCustomShape*>(pRet)->SetVerticalWriting( ( ngtextFStrikethrough & 0x2000 ) != 0 );
if ( SeekToContent( DFF_Prop_gtextUNICODE, rSt ) )
{
@@ -4407,12 +4408,35 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
if ( nTextWidth != 100 )
aSet.Put( SvxCharScaleWidthItem( (sal_uInt16)nTextWidth, EE_CHAR_FONTWIDTH ) );
}
- if ( GetPropertyValue( DFF_Prop_gtextFStrikethrough, 0 ) & 0x1000 ) // SJ: Font Kerning On ?
+ if ( ngtextFStrikethrough & 0x1000 ) // SJ: Font Kerning On ?
aSet.Put( SvxKerningItem( 1, EE_CHAR_KERNING ) );
// #i119496# the resize autoshape to fit text attr of word art in MS PPT is always false
aSet.Put(makeSdrTextAutoGrowHeightItem(false));
aSet.Put(makeSdrTextAutoGrowWidthItem(false));
+
+ double fRatio = 0;
+ OutputDevice* pOut = Application::GetDefaultDevice();
+ vcl::Font aFont( pOut->GetFont() );
+ aFont.SetFamilyName( aFontName );
+ auto nTextWidth = pOut->GetTextWidth( aObjectText );
+
+ if ( nTextWidth )
+ {
+ fRatio = aFont.GetFontSize().Height();
+ fRatio /= nTextWidth;
+ sal_Int32 nNewHeight = fRatio * aObjData.aBoundRect.getWidth();
+ sal_Int32 nPaddingY = aObjData.aBoundRect.getHeight() - nNewHeight;
+
+ if ( nPaddingY > 0 )
+ {
+ // Remember that value because original size have to be exported
+ aSet.Put( SdrMetricItem( SDRATTR_TEXT_UPPERDIST, nPaddingY ) );
+ aObjData.aBoundRect.setHeight( nNewHeight );
+ }
+ else
+ aSet.Put( SdrMetricItem( SDRATTR_TEXT_UPPERDIST, 0 ) );
+ }
}
pRet->SetMergedItemSet( aSet );
diff --git a/include/svx/msdffdef.hxx b/include/svx/msdffdef.hxx
index 73b9d2c2b095..afabc5ca7c31 100644
--- a/include/svx/msdffdef.hxx
+++ b/include/svx/msdffdef.hxx
@@ -846,6 +846,13 @@ enum MSO_SYSCOLORINDEX {
mso_colorBParamShift = 16 // To extract the parameter value
};
+enum MSO_TextGeometryProperties {
+ use_gtextFBestFit = 0x00000100,
+ use_gtextFStretch = 0x00000400,
+ gtextFBestFit = 0x01000000,
+ gtextFStretch = 0x04000000
+};
+
//ALT_TXT_MSINTEROP
#define MSPROP_DESCRIPTION_MAX_LEN 4096
diff --git a/sw/qa/extras/ww8export/data/tdf91687.doc b/sw/qa/extras/ww8export/data/tdf91687.doc
new file mode 100644
index 000000000000..d1c1e0a0c381
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf91687.doc
Binary files differ
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()));
}
}