summaryrefslogtreecommitdiff
path: root/svx/source/svdraw/svdpdf.cxx
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2018-04-15 10:51:39 -0400
committerJan Holesovsky <kendy@collabora.com>2018-06-07 10:45:26 +0200
commit4a65225b304b30f6e7cbfe777067f231cac1eebc (patch)
tree4df41dbfd81d215b463ef83c0fec5247baf2a8bd /svx/source/svdraw/svdpdf.cxx
parent95b0ac87567bb80d80be9904e1fc4e5f0da08a10 (diff)
svx: support color text for imported PDFs
Change-Id: I01cba9456b37bd7a63c823bbe332d686f7ede389 (cherry picked from commit 26e37f98b08ce59a0feb93a8d2a8fbc982cfc103)
Diffstat (limited to 'svx/source/svdraw/svdpdf.cxx')
-rw-r--r--svx/source/svdraw/svdpdf.cxx42
1 files changed, 25 insertions, 17 deletions
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index 9b64b9903186..368281e89d44 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -1070,13 +1070,25 @@ void ImpSdrPdfImport::ImportText(FPDF_PAGEOBJECT pPageObject, int nPageObjectInd
dFontSizeV = lcl_ToLogic(dFontSizeV);
SAL_WARN("sd.filter", "Got Logic Font Size H: " << dFontSizeH << ", V: " << dFontSizeV);
+ const Size aFontSize(dFontSizeH, dFontSizeV);
+ vcl::Font aFnt = mpVD->GetFont();
+ if (aFontSize != aFnt.GetFontSize())
+ {
+ aFnt.SetFontSize(aFontSize);
+ mpVD->SetFont(aFnt);
+ mbFntDirty = true;
+ }
+
+ Color aTextColor(COL_TRANSPARENT);
unsigned int nR, nG, nB, nA;
- if (FPDFTextObj_GetStrokeColor(pPageObject, &nR, &nG, &nB, &nA))
- mpVD->SetTextColor(Color(nR, nG, nB));
+ if (FPDFTextObj_GetColor(pPageObject, &nR, &nG, &nB, &nA))
+ aTextColor = Color(nR, nG, nB);
- vcl::Font aFnt = mpVD->GetFont();
- aFnt.SetFontSize(Size(dFontSizeH, dFontSizeV));
- mpVD->SetFont(aFnt);
+ if (aTextColor != mpVD->GetTextColor())
+ {
+ mpVD->SetTextColor(aTextColor);
+ mbFntDirty = true;
+ }
ImportText(aRect.TopLeft(), aRect.GetSize(), sText);
}
@@ -1380,14 +1392,14 @@ void ImpSdrPdfImport::ImportPath(FPDF_PAGEOBJECT pPageObject, int nPageObjectInd
Point ImpSdrPdfImport::PointsToLogic(double x, double y) const
{
y = correctVertOrigin(y);
- SAL_WARN("sd.filter", "Corrected point x: " << x << ", y: " << y);
+ // SAL_WARN("sd.filter", "Corrected point x: " << x << ", y: " << y);
x = lcl_PointToPixel(x);
y = lcl_PointToPixel(y);
- SAL_WARN("sd.filter", "Pixel point x: " << x << ", y: " << y);
+ // SAL_WARN("sd.filter", "Pixel point x: " << x << ", y: " << y);
Point aPos(lcl_ToLogic(x), lcl_ToLogic(y));
- SAL_WARN("sd.filter", "Logical Pos: " << aPos);
+ // SAL_WARN("sd.filter", "Logical Pos: " << aPos);
return aPos;
}
@@ -1396,24 +1408,20 @@ tools::Rectangle ImpSdrPdfImport::PointsToLogic(double left, double right, doubl
{
top = correctVertOrigin(top);
bottom = correctVertOrigin(bottom);
- SAL_WARN("sd.filter", "Corrected bounds left: " << left << ", right: " << right
- << ", top: " << top << ", bottom: " << bottom);
+ // SAL_WARN("sd.filter", "Corrected bounds left: " << left << ", right: " << right
+ // << ", top: " << top << ", bottom: " << bottom);
left = lcl_PointToPixel(left);
right = lcl_PointToPixel(right);
top = lcl_PointToPixel(top);
bottom = lcl_PointToPixel(bottom);
- // if (top > bottom)
- // std::swap(top, bottom);
- // if (left > right)
- // std::swap(left, right);
- SAL_WARN("sd.filter", "Pixel bounds left: " << left << ", right: " << right << ", top: " << top
- << ", bottom: " << bottom);
+ // SAL_WARN("sd.filter", "Pixel bounds left: " << left << ", right: " << right << ", top: " << top
+ // << ", bottom: " << bottom);
Point aPos(lcl_ToLogic(left), lcl_ToLogic(top));
Size aSize(lcl_ToLogic(right - left), lcl_ToLogic(bottom - top));
tools::Rectangle aRect(aPos, aSize);
- SAL_WARN("sd.filter", "Logical BBox: " << aRect);
+ // SAL_WARN("sd.filter", "Logical BBox: " << aRect);
return aRect;
}