summaryrefslogtreecommitdiff
path: root/sw/source/core/edit
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/edit')
-rw-r--r--sw/source/core/edit/edfcol.cxx17
1 files changed, 4 insertions, 13 deletions
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 19db9f1d0a41..60bba7d3c3d7 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -1463,7 +1463,6 @@ void lcl_placeWatermarkInHeader(const SfxWatermarkItem& rWatermark,
// Calc the ratio.
double fRatio = 0;
- double fRatioFrame = 0;
VclPtr<VirtualDevice> pDevice = VclPtr<VirtualDevice>::Create();
vcl::Font aFont = pDevice->GetFont();
@@ -1471,17 +1470,11 @@ void lcl_placeWatermarkInHeader(const SfxWatermarkItem& rWatermark,
aFont.SetFontSize(Size(0, 96));
pDevice->SetFont(aFont);
- tools::Rectangle aBoundingRect;
- pDevice->GetTextBoundRect(aBoundingRect, rWatermark.GetText());
- if (aBoundingRect.GetWidth())
- {
- fRatio = (double)aBoundingRect.getHeight() / aBoundingRect.getWidth();
- }
auto nTextWidth = pDevice->GetTextWidth(rWatermark.GetText());
if (nTextWidth)
{
- fRatioFrame = pDevice->GetTextHeight();
- fRatioFrame /= nTextWidth;
+ fRatio = pDevice->GetTextHeight();
+ fRatio /= nTextWidth;
}
// Calc the size.
@@ -1507,13 +1500,12 @@ void lcl_placeWatermarkInHeader(const SfxWatermarkItem& rWatermark,
nWidth = aSize.Height - nTopMargin - nBottomMargin;
}
sal_Int32 nHeight = fRatio * nWidth;
- sal_Int32 nFrameHeight = fRatioFrame * nWidth;
// Create and insert the shape.
uno::Reference<drawing::XShape> xShape(xMultiServiceFactory->createInstance(aShapeServiceName), uno::UNO_QUERY);
basegfx::B2DHomMatrix aTransformation;
aTransformation.identity();
- aTransformation.scale(nWidth, nFrameHeight);
+ aTransformation.scale(nWidth, nHeight);
aTransformation.rotate(F_PI180 * -1 * nAngle);
drawing::HomogenMatrix3 aMatrix;
aMatrix.Line1.Column1 = aTransformation.get(0, 0);
@@ -1540,14 +1532,13 @@ void lcl_placeWatermarkInHeader(const SfxWatermarkItem& rWatermark,
xPropertySet->setPropertyValue(UNO_NAME_OPAQUE, uno::makeAny(false));
xPropertySet->setPropertyValue(UNO_NAME_TEXT_AUTOGROWHEIGHT, uno::makeAny(false));
xPropertySet->setPropertyValue(UNO_NAME_TEXT_AUTOGROWWIDTH, uno::makeAny(false));
- xPropertySet->setPropertyValue(UNO_NAME_TEXT_MINFRAMEHEIGHT, uno::makeAny(nFrameHeight));
+ xPropertySet->setPropertyValue(UNO_NAME_TEXT_MINFRAMEHEIGHT, uno::makeAny(nHeight));
xPropertySet->setPropertyValue(UNO_NAME_TEXT_MINFRAMEWIDTH, uno::makeAny(nWidth));
xPropertySet->setPropertyValue(UNO_NAME_TEXT_WRAP, uno::makeAny(text::WrapTextMode_THROUGH));
xPropertySet->setPropertyValue(UNO_NAME_HORI_ORIENT_RELATION, uno::makeAny(static_cast<sal_Int16>(text::RelOrientation::PAGE_PRINT_AREA)));
xPropertySet->setPropertyValue(UNO_NAME_VERT_ORIENT_RELATION, uno::makeAny(static_cast<sal_Int16>(text::RelOrientation::PAGE_PRINT_AREA)));
xPropertySet->setPropertyValue(UNO_NAME_CHAR_FONT_NAME, uno::makeAny(sFont));
xPropertySet->setPropertyValue(UNO_NAME_CHAR_HEIGHT, uno::makeAny(WATERMARK_AUTO_SIZE));
- xPropertySet->setPropertyValue(UNO_NAME_TEXT_UPPERDIST, uno::makeAny(sal_Int32(nFrameHeight - nHeight)));
xPropertySet->setPropertyValue("Transformation", uno::makeAny(aMatrix));
uno::Reference<text::XTextRange> xTextRange(xShape, uno::UNO_QUERY);