[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - 2 commits - desktop/qa desktop/source filter/source include/LibreOfficeKit sw/source
Ashod Nakashian (via logerrit)
logerrit at kemper.freedesktop.org
Mon Nov 11 01:37:19 UTC 2019
desktop/qa/desktop_lib/test_desktop_lib.cxx | 4 +--
desktop/source/lib/init.cxx | 33 +++++++++++++++++++++++-----
filter/source/pdf/pdfexport.cxx | 27 +++++-----------------
include/LibreOfficeKit/LibreOfficeKit.h | 8 ++++++
include/LibreOfficeKit/LibreOfficeKit.hxx | 8 +++++-
sw/source/uibase/uno/unotxdoc.cxx | 4 ++-
6 files changed, 54 insertions(+), 30 deletions(-)
New commits:
commit cea0eb9cac478f247fb156563e0a99b07d5a34dc
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sun Nov 10 16:45:10 2019 -0500
Commit: Ashod Nakashian <ashnakash at gmail.com>
CommitDate: Mon Nov 11 02:36:53 2019 +0100
sw: SwView can be null when setting clipboard
Change-Id: I8a0e59f6ceec4bf89e5eed0813157297efb56af1
Reviewed-on: https://gerrit.libreoffice.org/82405
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index b747e52a1f12..9a6b70eb063c 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3214,7 +3214,9 @@ void SwXTextDocument::setClipboard(const uno::Reference<datatransfer::clipboard:
{
SolarMutexGuard aGuard;
- pDocShell->GetView()->GetEditWin().SetClipboard(xClipboard);
+ SwView* pView = pDocShell->GetView();
+ if (pView)
+ pView->GetEditWin().SetClipboard(xClipboard);
}
bool SwXTextDocument::isMimeTypeSupported()
commit 1dd66357752b01fbf3f1aee9966a55d4a16038e4
Author: Mert Tumer <mert.tumer at collabora.com>
AuthorDate: Thu Oct 24 12:11:21 2019 +0300
Commit: Ashod Nakashian <ashnakash at gmail.com>
CommitDate: Mon Nov 11 02:36:40 2019 +0100
Added Orientation argument to LOKIT renderFont
method for rendering watermarks with angle
Change-Id: Id422ed62e4f78390661e4e1efa45101af9ecfc23
Reviewed-on: https://gerrit.libreoffice.org/82404
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index dc390e72c825..1810df911b06 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -2786,11 +2786,11 @@ void DesktopLOKTest::testABI()
CPPUNIT_ASSERT_EQUAL(documentClassOffset(54), offsetof(struct _LibreOfficeKitDocumentClass, getSelectionType));
CPPUNIT_ASSERT_EQUAL(documentClassOffset(55), offsetof(struct _LibreOfficeKitDocumentClass, removeTextContext));
CPPUNIT_ASSERT_EQUAL(documentClassOffset(56), offsetof(struct _LibreOfficeKitDocumentClass, sendDialogEvent));
-
+ CPPUNIT_ASSERT_EQUAL(documentClassOffset(57), offsetof(struct _LibreOfficeKitDocumentClass, renderFontOrientation));
// Extending is fine, update this, and add new assert for the offsetof the
// new method
- CPPUNIT_ASSERT_EQUAL(documentClassOffset(57), sizeof(struct _LibreOfficeKitDocumentClass));
+ CPPUNIT_ASSERT_EQUAL(documentClassOffset(58), sizeof(struct _LibreOfficeKitDocumentClass));
}
CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest);
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index ac5fca9f39db..062ceb3dcb45 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -879,6 +879,12 @@ static int doc_getView(LibreOfficeKitDocument* pThis);
static int doc_getViewsCount(LibreOfficeKitDocument* pThis);
static bool doc_getViewIds(LibreOfficeKitDocument* pThis, int* pArray, size_t nSize);
static void doc_setViewLanguage(LibreOfficeKitDocument* pThis, int nId, const char* language);
+static unsigned char* doc_renderFontOrientation(LibreOfficeKitDocument* pThis,
+ const char *pFontName,
+ const char *pChar,
+ int* pFontWidth,
+ int* pFontHeight,
+ int pOrientation);
static unsigned char* doc_renderFont(LibreOfficeKitDocument* pThis,
const char *pFontName,
const char *pChar,
@@ -895,7 +901,8 @@ static void doc_paintWindowDPI(LibreOfficeKitDocument* pThis, unsigned nLOKWindo
const int nWidth, const int nHeight,
const double fDPIScale);
-static void doc_postWindow(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, int nAction, const char* pData);
+static void doc_postWindow(LibreOfficeKitDocument* pThis, unsigned
+ nLOKWindowId, int nAction, const char* pData);
static char* doc_getPartInfo(LibreOfficeKitDocument* pThis, int nPart);
@@ -1001,6 +1008,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone
m_pDocumentClass->getViewIds = doc_getViewIds;
m_pDocumentClass->renderFont = doc_renderFont;
+ m_pDocumentClass->renderFontOrientation = doc_renderFontOrientation;
m_pDocumentClass->getPartHash = doc_getPartHash;
m_pDocumentClass->paintWindow = doc_paintWindow;
@@ -4668,12 +4676,24 @@ static void doc_setViewLanguage(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*p
SfxLokHelper::setViewLanguage(nId, OStringToOUString(language, RTL_TEXTENCODING_UTF8));
}
-unsigned char* doc_renderFont(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/,
+
+
+unsigned char* doc_renderFont(LibreOfficeKitDocument* pThis,
const char* pFontName,
const char* pChar,
int* pFontWidth,
int* pFontHeight)
{
+ return doc_renderFontOrientation(pThis, pFontName, pChar, pFontWidth, pFontHeight, 0);
+}
+
+unsigned char* doc_renderFontOrientation(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/,
+ const char* pFontName,
+ const char* pChar,
+ int* pFontWidth,
+ int* pFontHeight,
+ int pOrientation)
+{
comphelper::ProfileZone aZone("doc_renderFont");
SolarMutexGuard aGuard;
@@ -4707,6 +4727,7 @@ unsigned char* doc_renderFont(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pTh
::tools::Rectangle aRect;
vcl::Font aFont(rFontMetric);
aFont.SetFontSize(Size(0, nDefaultFontSize));
+ aFont.SetOrientation(pOrientation);
aDevice->SetFont(aFont);
aDevice->GetTextBoundRect(aRect, aText);
if (aRect.IsEmpty())
@@ -4720,8 +4741,8 @@ unsigned char* doc_renderFont(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pTh
if (*pFontWidth > 0 && *pFontHeight > 0)
{
- double fScaleX = *pFontWidth / static_cast<double>(nFontWidth);
- double fScaleY = *pFontHeight / static_cast<double>(nFontHeight);
+ double fScaleX = *pFontWidth / static_cast<double>(nFontWidth) / 1.5;
+ double fScaleY = *pFontHeight / static_cast<double>(nFontHeight) / 1.5;
double fScale = std::min(fScaleX, fScaleY);
@@ -4754,8 +4775,9 @@ unsigned char* doc_renderFont(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pTh
DrawTextFlags const nStyle =
DrawTextFlags::Center
| DrawTextFlags::VCenter
+ | DrawTextFlags::Bottom
| DrawTextFlags::MultiLine
- | DrawTextFlags::WordBreakHyphenation;// | DrawTextFlags::WordBreak ;
+ | DrawTextFlags::WordBreak;// | DrawTextFlags::WordBreakHyphenation ;
aDevice->DrawText(aRect, aText, nStyle);
}
@@ -4774,6 +4796,7 @@ unsigned char* doc_renderFont(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pTh
return nullptr;
}
+
static void doc_paintWindow(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId,
unsigned char* pBuffer,
const int nX, const int nY,
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index bec2c8147aae..e9941c49147a 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -1159,29 +1159,16 @@ void PDFExport::ImplWriteWatermark( vcl::PDFWriter& rWriter, const Size& rPageSi
void PDFExport::ImplWriteTiledWatermark( vcl::PDFWriter& rWriter, const Size& rPageSize )
{
OUString watermark = msTiledWatermark;
- int watermarkLength = watermark.getLength();
// Maximum number of characters in one line.
- // it is set to 21 to make it look like tiled watermaks as online in secure view
+ // it is set to 21 to make it look like tiled watermarks as online in secure view
const int lineLength = 21;
- int lnIndex = lineLength;
- int lnCount = watermarkLength / lineLength;
-
- while(lnCount)
- {
- OUString tempstr = watermark;
- watermark = watermark.copy(0, lnIndex);
- watermark += "\n";
- watermark += tempstr.copy(lnIndex);
- lnIndex += lineLength;
- lnCount--;
- }
-
vcl::Font aFont( "Liberation Sans", Size( 0, 40 ) );
aFont.SetItalic( ITALIC_NONE );
aFont.SetWidthType( WIDTH_NORMAL );
aFont.SetWeight( WEIGHT_NORMAL );
aFont.SetAlignment( ALIGN_BOTTOM );
aFont.SetFontHeight(40);
+ aFont.SetOrientation(450);
OutputDevice* pDev = rWriter.GetReferenceDevice();
pDev->SetFont(aFont);
@@ -1217,20 +1204,20 @@ void PDFExport::ImplWriteTiledWatermark( vcl::PDFWriter& rWriter, const Size& rP
rWriter.SetFont(aFont);
rWriter.SetTextColor( Color(19,20,22) );
// center watermarks horizontally
- Point aTextPoint( (rPageSize.Width()/2) - (((nTextWidth*watermarkcount)+(watermarkcount-1)*(nTextWidth/2))/2),
+ Point aTextPoint( (rPageSize.Width()/2) - (((nTextWidth*watermarkcount)+(watermarkcount-1)*nTextWidth)/2),
pDev->GetTextHeight());
for( int i = 0; i < watermarkcount; i ++)
{
- while(aTextPoint.getY()+pDev->GetTextHeight()*2 <= rPageSize.Height())
+ while(aTextPoint.getY()+pDev->GetTextHeight()*3 <= rPageSize.Height())
{
- tools::Rectangle aTextRect(aTextPoint, Size(nTextWidth,pDev->GetTextHeight()*2));
+ tools::Rectangle aTextRect(aTextPoint, Size(nTextWidth*2,pDev->GetTextHeight()*4));
pDev->Push();
rWriter.SetClipRegion();
rWriter.BeginTransparencyGroup();
rWriter.SetTextColor( Color(19,20,22) );
- rWriter.DrawText(aTextRect, watermark, DrawTextFlags::MultiLine|DrawTextFlags::Center|DrawTextFlags::VCenter);
+ rWriter.DrawText(aTextRect, watermark, DrawTextFlags::MultiLine|DrawTextFlags::Center|DrawTextFlags::VCenter|DrawTextFlags::WordBreak|DrawTextFlags::Bottom);
rWriter.EndTransparencyGroup( aTextRect, 50 );
pDev->Pop();
@@ -1238,7 +1225,7 @@ void PDFExport::ImplWriteTiledWatermark( vcl::PDFWriter& rWriter, const Size& rP
rWriter.SetClipRegion();
rWriter.BeginTransparencyGroup();
rWriter.SetTextColor( Color(236,235,233) );
- rWriter.DrawText(aTextRect, watermark, DrawTextFlags::MultiLine|DrawTextFlags::Center|DrawTextFlags::VCenter);
+ rWriter.DrawText(aTextRect, watermark, DrawTextFlags::MultiLine|DrawTextFlags::Center|DrawTextFlags::VCenter|DrawTextFlags::WordBreak|DrawTextFlags::Bottom);
rWriter.EndTransparencyGroup( aTextRect, 50 );
pDev->Pop();
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 29d834969ad6..78f2b478e861 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -419,6 +419,14 @@ struct _LibreOfficeKitDocumentClass
unsigned nLOKWindowId,
const char* pArguments);
+ /// @see lok::Document::renderFontOrientation().
+ unsigned char* (*renderFontOrientation) (LibreOfficeKitDocument* pThis,
+ const char* pFontName,
+ const char* pChar,
+ int* pFontWidth,
+ int* pFontHeight,
+ int pOrientation);
+
#endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
};
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 8c8453086c63..ae33692b5ca5 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -556,9 +556,13 @@ public:
unsigned char* renderFont(const char *pFontName,
const char *pChar,
int *pFontWidth,
- int *pFontHeight)
+ int *pFontHeight,
+ int pOrientation=0)
{
- return mpDoc->pClass->renderFont(mpDoc, pFontName, pChar, pFontWidth, pFontHeight);
+ if (LIBREOFFICEKIT_DOCUMENT_HAS(mpDoc, renderFontOrientation))
+ return mpDoc->pClass->renderFontOrientation(mpDoc, pFontName, pChar, pFontWidth, pFontHeight, pOrientation);
+ else
+ return mpDoc->pClass->renderFont(mpDoc, pFontName, pChar, pFontWidth, pFontHeight);
}
/**
More information about the Libreoffice-commits
mailing list