[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-6-2' - 17 commits - avmedia/source cui/source dbaccess/source dbaccess/uiconfig filter/source .gitreview include/vcl sc/source sw/CppunitTest_sw_ww8import.mk sw/inc sw/qa sw/source vcl/headless vcl/inc vcl/Library_vcl.mk vcl/Library_vclplug_qt5.mk vcl/qt5 vcl/source vcl/unx
Samuel Mehrbrodt (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jul 4 14:14:23 UTC 2019
.gitreview | 2
avmedia/source/gstreamer/gstplayer.cxx | 24 ++++--
cui/source/customize/SvxMenuConfigPage.cxx | 10 ++
dbaccess/source/core/misc/dsntypes.cxx | 9 +-
dbaccess/uiconfig/ui/textconnectionsettings.ui | 1
filter/source/msfilter/msdffimp.cxx | 9 ++
include/vcl/graphicfilter.hxx | 2
sc/source/core/tool/compiler.cxx | 9 +-
sw/CppunitTest_sw_ww8import.mk | 30 --------
sw/inc/unosett.hxx | 2
sw/qa/extras/ww8import/data/tdf125281.doc |binary
sw/qa/extras/ww8import/ww8import.cxx | 26 +++++++
sw/source/core/text/porfld.cxx | 4 -
sw/source/core/text/porfld.hxx | 1
sw/source/core/text/txtfld.cxx | 12 +++
sw/source/core/unocore/unosett.cxx | 15 +++-
sw/source/uibase/config/StoredChapterNumbering.cxx | 2
vcl/Library_vcl.mk | 1
vcl/Library_vclplug_qt5.mk | 2
vcl/headless/svpvd.cxx | 10 ++
vcl/inc/headless/svpvd.hxx | 5 +
vcl/inc/impgraph.hxx | 2
vcl/inc/qt5/Qt5Frame.hxx | 23 +++---
vcl/inc/qt5/Qt5SvpGraphics.hxx | 46 +++++++++++++
vcl/inc/qt5/Qt5SvpSurface.hxx | 46 +++++++++++++
vcl/inc/salobj.hxx | 7 +-
vcl/inc/unx/gtk/gtkframe.hxx | 2
vcl/qt5/Qt5Clipboard.cxx | 37 ++++++++++
vcl/qt5/Qt5Frame.cxx | 52 ++++++++------
vcl/qt5/Qt5Menu.cxx | 4 -
vcl/qt5/Qt5SvpGraphics.cxx | 52 ++++++++++++++
vcl/qt5/Qt5SvpSurface.cxx | 73 +++++++++++++++++++++
vcl/qt5/Qt5Widget.cxx | 2
vcl/source/filter/graphicfilter.cxx | 5 -
vcl/source/gdi/impgraph.cxx | 42 +++++++-----
vcl/source/window/bufferdevice.cxx | 36 ++++++++++
vcl/source/window/bufferdevice.hxx | 36 ++++++++++
vcl/source/window/menubarwindow.cxx | 11 ---
vcl/source/window/menufloatingwindow.cxx | 9 --
vcl/source/window/syschild.cxx | 6 +
vcl/unx/gtk3/gtk3gtkframe.cxx | 13 +--
vcl/unx/kde5/KDE5SalFrame.cxx | 4 -
vcl/unx/kde5/KDE5SalGraphics.cxx | 2
vcl/unx/kde5/KDE5SalGraphics.hxx | 3
vcl/unx/kde5/KDE5SalInstance.cxx | 18 ++++-
vcl/unx/kde5/KDE5SalInstance.hxx | 4 +
vcl/unx/kde5/KDE5SalVirtualDevice.hxx | 36 ++++++++++
47 files changed, 596 insertions(+), 151 deletions(-)
New commits:
commit e09e5274910d3eec6fee078edbcfe5e4ae273a4a
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Thu Jul 4 14:51:34 2019 +0200
Commit: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Thu Jul 4 16:13:37 2019 +0200
gitreview: Update default branch
Change-Id: I7c7a1968b0dd1b326f543d52a36012d8c2fd05c2
diff --git a/.gitreview b/.gitreview
index b6f0665a9ba6..62c07bc1f29e 100644
--- a/.gitreview
+++ b/.gitreview
@@ -3,5 +3,5 @@ host=logerrit
port=29418
project=core
defaultremote=logerrit
-defaultbranch=libreoffice-6-2
+defaultbranch=distro/cib/libreoffice-6-2
commit 4ca3ac84912ab387b27d3f6c1a288a1ba12eb730
Author: Eike Rathke <erack at redhat.com>
AuthorDate: Thu Jun 13 20:25:49 2019 +0200
Commit: Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Fri Jun 14 07:51:17 2019 +0200
Resolves: tdf#113541 handle external reference in Excel syntax
... not only OOXML. This wasn't only a problem when creating a
reference by clicking or travelling to a cell in the external
document, but also when editing an external reference in Excel_A1
or Excel_R1C1 reference syntax.
Change-Id: Iee3d529ff9834e5013a61c2056238277f33356fe
Reviewed-on: https://gerrit.libreoffice.org/73979
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Jenkins
(cherry picked from commit 69903b5c5f9b9015c88931c0eb8a47b52ea3de12)
Reviewed-on: https://gerrit.libreoffice.org/73988
Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 7ed3845f967e..edb4f9fadb0b 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2125,11 +2125,14 @@ Label_MaskStateMachine:
}
else if( nMask & ScCharFlags::Char )
{
- // '[' is a special case in OOXML, it can start an external
- // reference ID like [1]Sheet1!A1 that needs to be scanned
+ // '[' is a special case in Excel syntax, it can start an
+ // external reference, ID in OOXML like [1]Sheet1!A1 or
+ // Excel_A1 [filename]Sheet!A1 or Excel_R1C1
+ // [filename]Sheet!R1C1 that needs to be scanned
// entirely, or can be ocTableRefOpen, of which the first
// transforms an ocDBArea into an ocTableRef.
- if (c == '[' && FormulaGrammar::isOOXML( meGrammar) && eLastOp != ocDBArea && maTableRefs.empty())
+ if (c == '[' && FormulaGrammar::isExcelSyntax( meGrammar)
+ && eLastOp != ocDBArea && maTableRefs.empty())
{
nMask &= ~ScCharFlags::Char;
goto Label_MaskStateMachine;
commit 5ee408eb4c9f55d3438426290e91ac31d04821de
Author: Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri Jun 7 19:09:18 2019 +0200
Commit: Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Fri Jun 14 06:09:43 2019 +0200
tdf#125673 KDE5 implement a KDE5SalVirtualDevice
We just need AcquireGraphics() to return a KDE5Graphics.
Otherwise the BufferDevice's SVP will use a SvpSalGraphics
instead of the KDE5Graphics, which knows about Qt's theming.
Reviewed-on: https://gerrit.libreoffice.org/73673
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
(cherry picked from commit 2cb6a591b643a0f65dc58f060f60cc707ad3589c)
Reviewed-on: https://gerrit.libreoffice.org/73722
Change-Id: I0ea646df260f2067d61c753f03dee01a003f382a
Reviewed-on: https://gerrit.libreoffice.org/73963
Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
Tested-by: Jenkins
diff --git a/vcl/headless/svpvd.cxx b/vcl/headless/svpvd.cxx
index eeccf2c014a9..a1e415739d6b 100644
--- a/vcl/headless/svpvd.cxx
+++ b/vcl/headless/svpvd.cxx
@@ -45,14 +45,18 @@ SvpSalVirtualDevice::~SvpSalVirtualDevice()
cairo_surface_destroy(m_pRefSurface);
}
-SalGraphics* SvpSalVirtualDevice::AcquireGraphics()
+SvpSalGraphics* SvpSalVirtualDevice::AddGraphics(SvpSalGraphics* pGraphics)
{
- SvpSalGraphics* pGraphics = new SvpSalGraphics();
pGraphics->setSurface(m_pSurface, m_aFrameSize);
- m_aGraphics.push_back( pGraphics );
+ m_aGraphics.push_back(pGraphics);
return pGraphics;
}
+SalGraphics* SvpSalVirtualDevice::AcquireGraphics()
+{
+ return AddGraphics(new SvpSalGraphics());
+}
+
void SvpSalVirtualDevice::ReleaseGraphics( SalGraphics* pGraphics )
{
m_aGraphics.erase(std::remove(m_aGraphics.begin(), m_aGraphics.end(), dynamic_cast<SvpSalGraphics*>(pGraphics)), m_aGraphics.end());
diff --git a/vcl/inc/headless/svpvd.hxx b/vcl/inc/headless/svpvd.hxx
index 776cee7cde15..3da74b5e1ba8 100644
--- a/vcl/inc/headless/svpvd.hxx
+++ b/vcl/inc/headless/svpvd.hxx
@@ -21,6 +21,8 @@
#define INCLUDED_VCL_INC_HEADLESS_SVPVD_HXX
#include <salvd.hxx>
+#include <vcl/salgtype.hxx>
+#include <basegfx/vector/b2ivector.hxx>
#include <vector>
@@ -35,6 +37,9 @@ class VCL_DLLPUBLIC SvpSalVirtualDevice : public SalVirtualDevice
basegfx::B2IVector m_aFrameSize;
std::vector< SvpSalGraphics* > m_aGraphics;
+protected:
+ SvpSalGraphics* AddGraphics(SvpSalGraphics* aGraphics);
+
public:
SvpSalVirtualDevice(DeviceFormat eFormat, cairo_surface_t* pRefSurface);
virtual ~SvpSalVirtualDevice() override;
diff --git a/vcl/source/window/bufferdevice.cxx b/vcl/source/window/bufferdevice.cxx
index 5db4cfff458a..d1480588d48f 100644
--- a/vcl/source/window/bufferdevice.cxx
+++ b/vcl/source/window/bufferdevice.cxx
@@ -12,7 +12,7 @@
namespace vcl
{
BufferDevice::BufferDevice(const VclPtr<vcl::Window>& pWindow, vcl::RenderContext& rRenderContext)
- : m_pBuffer(VclPtr<VirtualDevice>::Create())
+ : m_pBuffer(VclPtr<VirtualDevice>::Create(rRenderContext))
, m_pWindow(pWindow)
, m_rRenderContext(rRenderContext)
{
diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx
index 6e30b9599740..268f8331f7e7 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.cxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.cxx
@@ -40,7 +40,7 @@ static void QImage2BitmapBuffer(QImage* pImg, BitmapBuffer* pBuf)
}
KDE5SalGraphics::KDE5SalGraphics(Qt5Frame* pFrame)
- : Qt5SvpGraphics(pFrame->GetQWidget())
+ : Qt5SvpGraphics(pFrame ? pFrame->GetQWidget() : nullptr)
, m_pFrame(pFrame)
{
}
diff --git a/vcl/unx/kde5/KDE5SalInstance.cxx b/vcl/unx/kde5/KDE5SalInstance.cxx
index cbbf40f87a4d..96d1501cca19 100644
--- a/vcl/unx/kde5/KDE5SalInstance.cxx
+++ b/vcl/unx/kde5/KDE5SalInstance.cxx
@@ -35,7 +35,7 @@
#include "KDE5FilePicker.hxx"
#include "KDE5SalData.hxx"
#include "KDE5SalInstance.hxx"
-#include "KDE5SalFrame.hxx"
+#include "KDE5SalVirtualDevice.hxx"
using namespace com::sun::star;
@@ -89,6 +89,22 @@ KDE5SalInstance::createFolderPicker(const uno::Reference<uno::XComponentContext>
bool KDE5SalInstance::IsMainThread() const { return qApp->thread() == QThread::currentThread(); }
+std::unique_ptr<SalVirtualDevice> KDE5SalInstance::CreateVirtualDevice(SalGraphics* pGraphics,
+ long& nDX, long& nDY,
+ DeviceFormat eFormat,
+ const SystemGraphicsData*)
+{
+ std::unique_ptr<SalVirtualDevice> pVD;
+ assert(pGraphics);
+ RunInMainThread([&]() {
+ KDE5SalGraphics* pKDE5Graphics = dynamic_cast<KDE5SalGraphics*>(pGraphics);
+ assert(pKDE5Graphics);
+ pVD.reset(new KDE5SalVirtualDevice(eFormat, pKDE5Graphics->getSurface()));
+ pVD->SetSize(nDX, nDY);
+ });
+ return pVD;
+}
+
extern "C" {
VCLPLUG_KDE5_PUBLIC SalInstance* create_SalInstance()
{
diff --git a/vcl/unx/kde5/KDE5SalInstance.hxx b/vcl/unx/kde5/KDE5SalInstance.hxx
index 5980ea4699cc..ecb8f74627bb 100644
--- a/vcl/unx/kde5/KDE5SalInstance.hxx
+++ b/vcl/unx/kde5/KDE5SalInstance.hxx
@@ -42,6 +42,10 @@ public:
virtual bool IsMainThread() const override;
+ virtual std::unique_ptr<SalVirtualDevice>
+ CreateVirtualDevice(SalGraphics*, long&, long&, DeviceFormat,
+ const SystemGraphicsData* = nullptr) override;
+
private:
virtual SalFrame* CreateFrame(SalFrame* pParent, SalFrameStyleFlags nStyle) override;
diff --git a/vcl/unx/kde5/KDE5SalVirtualDevice.hxx b/vcl/unx/kde5/KDE5SalVirtualDevice.hxx
new file mode 100644
index 000000000000..baa8a2e31aa8
--- /dev/null
+++ b/vcl/unx/kde5/KDE5SalVirtualDevice.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <headless/svpvd.hxx>
+#include "KDE5SalGraphics.hxx"
+
+class VCL_DLLPUBLIC KDE5SalVirtualDevice : public SvpSalVirtualDevice
+{
+public:
+ KDE5SalVirtualDevice(DeviceFormat eFormat, cairo_surface_t* pRefSurface)
+ : SvpSalVirtualDevice(eFormat, pRefSurface)
+ {
+ }
+
+ SalGraphics* AcquireGraphics() override { return AddGraphics(new KDE5SalGraphics(nullptr)); }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit a21e297b1229dd389c691893ddc48605e9471db0
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Jun 11 08:09:14 2019 +0200
Commit: Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Thu Jun 13 23:35:27 2019 +0200
tdf#125591 DOC import: lazy-load metafiles with explicit size
Regression from commit 69b62cfcbd364d7f62142149c2f690104b217ca1
(tdf#125281 DOC import: fix size of lazy-loaded metafiles, 2019-05-27),
the problem is that setting the preferred size of a Graphic swaps it in.
Avoid this by extending ImportUnloadedGraphic(): if a size hint is
provided, then that will be used instead of info from the graphic
descriptor (which is usually only meaningful for bitmaps).
This way we maintain the correct size and we're back to lazy-loading
metafiles from binary MSO files as well.
(cherry picked from commit acb803b730f2c6bd82e39beab58949ec14f85eb0)
and:
CppunitTest_sw_ww8import: disable failing assert on Windows
It fails only sometimes, it's yet clear why.
(cherry picked from commit b5d624c4af1085d4670149e9c1d280da7bc9add0)
Change-Id: Ide12d12166110e98ea47b5347dd24fb203b22da3
Reviewed-on: https://gerrit.libreoffice.org/73961
Tested-by: Jenkins
Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index b6898f1478fb..5eb3249628bc 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -6557,11 +6557,13 @@ bool SvxMSDffManager::GetBLIPDirect( SvStream& rBLIPStream, Graphic& rData, tool
// which may be very large if the whole document is large. Limit the read
// size to the size of this record.
sal_uInt64 maxSize = pGrStream == &rBLIPStream ? nLength : 0;
- Graphic aGraphic = rGF.ImportUnloadedGraphic(*pGrStream, maxSize);
+ Graphic aGraphic;
- // Size available in metafile header, set that here.
+ // Size available in metafile header.
if (aMtfSize100.getWidth() && aMtfSize100.getHeight())
- aGraphic.SetPrefSize(aMtfSize100);
+ aGraphic = rGF.ImportUnloadedGraphic(*pGrStream, maxSize, &aMtfSize100);
+ else
+ aGraphic = rGF.ImportUnloadedGraphic(*pGrStream, maxSize);
if (aGraphic)
{
diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx
index db3d78371480..5ef927761f97 100644
--- a/include/vcl/graphicfilter.hxx
+++ b/include/vcl/graphicfilter.hxx
@@ -295,7 +295,7 @@ public:
WmfExternal const *pExtHeader = nullptr );
// Setting sizeLimit limits how much will be read from the stream.
- Graphic ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 sizeLimit = 0);
+ Graphic ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 sizeLimit = 0, Size* pSizeHint = nullptr);
const FilterErrorEx& GetLastError() const { return *pErrorEx;}
void ResetLastError();
diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx
index fdc816088f62..0b68d83eb753 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -164,6 +164,10 @@ DECLARE_WW8IMPORT_TEST(testTdf112346, "tdf112346.doc")
DECLARE_WW8IMPORT_TEST(testTdf125281, "tdf125281.doc")
{
+#if !defined(_WIN32)
+ // Windows fails with actual == 26171 for some reason; also lazy load isn't lazy in Windows
+ // debug builds, reason is not known at the moment.
+
// Load a .doc file which has an embedded .emf image.
SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
@@ -176,6 +180,11 @@ DECLARE_WW8IMPORT_TEST(testTdf125281, "tdf125281.doc")
// an actual Paint() was performed (and even then, it was wrong).
long nExpected = 25664;
CPPUNIT_ASSERT_EQUAL(nExpected, rGraphic.GetPrefSize().getWidth());
+
+ // Without the accompanying fix in place, this test would have failed, as setting the pref size
+ // swapped the image in.
+ CPPUNIT_ASSERT(!rGraphic.isAvailable());
+#endif
}
DECLARE_WW8IMPORT_TEST(testTdf110987, "tdf110987")
diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index f24c6fe34255..30c88594c5d6 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -111,7 +111,7 @@ public:
ImpGraphic( const GDIMetaFile& rMtf );
~ImpGraphic();
- void ImplSetPrepared(bool bAnimated);
+ void ImplSetPrepared(bool bAnimated, Size* pSizeHint);
private:
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 9be6f0723079..2661cf32bf00 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -1428,7 +1428,8 @@ void GraphicFilter::ImportGraphics(std::vector< std::shared_ptr<Graphic> >& rGra
}
}
-Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 sizeLimit)
+Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 sizeLimit,
+ Size* pSizeHint)
{
Graphic aGraphic;
sal_uInt16 nFormat = GRFILTER_FORMAT_DONTKNOW;
@@ -1653,7 +1654,7 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 size
bAnimated = IsGIFAnimated(aMemoryStream);
}
aGraphic.SetGfxLink(std::make_shared<GfxLink>(std::move(pGraphicContent), nGraphicContentSize, eLinkType));
- aGraphic.ImplGetImpGraphic()->ImplSetPrepared(bAnimated);
+ aGraphic.ImplGetImpGraphic()->ImplSetPrepared(bAnimated, pSizeHint);
}
}
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index bc0ff8a3e53b..9b6bf0da8d77 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -522,7 +522,7 @@ ImpSwapFile::~ImpSwapFile()
}
}
-void ImpGraphic::ImplSetPrepared(bool bAnimated)
+void ImpGraphic::ImplSetPrepared(bool bAnimated, Size* pSizeHint)
{
mbPrepared = true;
mbSwapOut = true;
@@ -530,25 +530,33 @@ void ImpGraphic::ImplSetPrepared(bool bAnimated)
SvMemoryStream aMemoryStream(const_cast<sal_uInt8*>(mpGfxLink->GetData()), mpGfxLink->GetDataSize(), StreamMode::READ | StreamMode::WRITE);
- GraphicDescriptor aDescriptor(aMemoryStream, nullptr);
- if (aDescriptor.Detect(true))
+ if (pSizeHint)
{
- // If we have logic size, work with that, as later pixel -> logic
- // conversion will work with the output device DPI, not the graphic
- // DPI.
- Size aLogSize = aDescriptor.GetSize_100TH_MM();
- if (aLogSize.getWidth() && aLogSize.getHeight())
- {
- maSwapInfo.maPrefSize = aLogSize;
- maSwapInfo.maPrefMapMode = MapMode(MapUnit::Map100thMM);
- }
- else
+ maSwapInfo.maPrefSize = *pSizeHint;
+ maSwapInfo.maPrefMapMode = MapMode(MapUnit::Map100thMM);
+ }
+ else
+ {
+ GraphicDescriptor aDescriptor(aMemoryStream, nullptr);
+ if (aDescriptor.Detect(true))
{
- maSwapInfo.maPrefSize = aDescriptor.GetSizePixel();
- maSwapInfo.maPrefMapMode = MapMode(MapUnit::MapPixel);
- }
+ // If we have logic size, work with that, as later pixel -> logic
+ // conversion will work with the output device DPI, not the graphic
+ // DPI.
+ Size aLogSize = aDescriptor.GetSize_100TH_MM();
+ if (aLogSize.getWidth() && aLogSize.getHeight())
+ {
+ maSwapInfo.maPrefSize = aLogSize;
+ maSwapInfo.maPrefMapMode = MapMode(MapUnit::Map100thMM);
+ }
+ else
+ {
+ maSwapInfo.maPrefSize = aDescriptor.GetSizePixel();
+ maSwapInfo.maPrefMapMode = MapMode(MapUnit::MapPixel);
+ }
- maSwapInfo.maSizePixel = aDescriptor.GetSizePixel();
+ maSwapInfo.maSizePixel = aDescriptor.GetSizePixel();
+ }
}
maSwapInfo.mnAnimationLoopCount = 0;
maSwapInfo.mbIsEPS = false;
commit 7ae354290af7f3fcd9c5031e437af0037e61e984
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri May 31 14:56:46 2019 +0200
Commit: Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Thu Jun 13 21:20:41 2019 +0200
tdf#125550 vcl menu bar / floating window: fix text color
Regression from commit e8d5b8beb5958147235ff955ed38c47b51d860ff
(tdf#113714 vcl menu bar window: avoid flicker, 2019-05-20), the problem
was that a freshly created VirtualDevice doesn't have the default text
color, so we need to initialize that explicitly based on the render
context text color.
Also introduce a BufferDevice to do this initialization, instead of
fixing this in MenuBarWindow::Paint(), then copy&pasting the fix to
MenuFloatingWindow::Paint().
Change-Id: Ib171cd52e7cabe0bc3c639821f558d8303039fe6
Reviewed-on: https://gerrit.libreoffice.org/73269
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
Tested-by: Jenkins
(cherry picked from commit 42bf893a8479f70d7d8f00e03105ce15e8545f8b)
Reviewed-on: https://gerrit.libreoffice.org/73314
Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
Tested-by: Michael Weghorn <m.weghorn at posteo.de>
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index da9bc387ca2f..b68252642bec 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -121,6 +121,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/window/accel \
vcl/source/window/accmgr \
vcl/source/window/brdwin \
+ vcl/source/window/bufferdevice \
vcl/source/window/accessibility \
vcl/source/window/legacyaccessibility \
vcl/source/window/clipping \
diff --git a/vcl/source/window/bufferdevice.cxx b/vcl/source/window/bufferdevice.cxx
new file mode 100644
index 000000000000..5db4cfff458a
--- /dev/null
+++ b/vcl/source/window/bufferdevice.cxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "bufferdevice.hxx"
+
+namespace vcl
+{
+BufferDevice::BufferDevice(const VclPtr<vcl::Window>& pWindow, vcl::RenderContext& rRenderContext)
+ : m_pBuffer(VclPtr<VirtualDevice>::Create())
+ , m_pWindow(pWindow)
+ , m_rRenderContext(rRenderContext)
+{
+ m_pBuffer->SetOutputSizePixel(pWindow->GetOutputSizePixel(), false);
+ m_pBuffer->SetTextColor(rRenderContext.GetTextColor());
+ m_pBuffer->DrawOutDev(Point(0, 0), pWindow->GetOutputSizePixel(), Point(0, 0),
+ pWindow->GetOutputSizePixel(), rRenderContext);
+}
+
+BufferDevice::~BufferDevice()
+{
+ m_rRenderContext.DrawOutDev(Point(0, 0), m_pWindow->GetOutputSizePixel(), Point(0, 0),
+ m_pWindow->GetOutputSizePixel(), *m_pBuffer);
+}
+
+vcl::RenderContext* BufferDevice::operator->() { return m_pBuffer.get(); }
+
+vcl::RenderContext& BufferDevice::operator*() { return *m_pBuffer; }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/bufferdevice.hxx b/vcl/source/window/bufferdevice.hxx
new file mode 100644
index 000000000000..26bf28e615fa
--- /dev/null
+++ b/vcl/source/window/bufferdevice.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_SOURCE_WINDOW_BUFFERDEVICE_HXX
+#define INCLUDED_VCL_SOURCE_WINDOW_BUFFERDEVICE_HXX
+
+#include <vcl/virdev.hxx>
+#include <vcl/window.hxx>
+
+namespace vcl
+{
+/// Buffers drawing on a vcl::RenderContext using a VirtualDevice.
+class BufferDevice
+{
+ ScopedVclPtr<VirtualDevice> m_pBuffer;
+ VclPtr<vcl::Window> m_pWindow;
+ vcl::RenderContext& m_rRenderContext;
+
+public:
+ BufferDevice(const VclPtr<vcl::Window>& pWindow, vcl::RenderContext& rRenderContext);
+ ~BufferDevice();
+
+ vcl::RenderContext* operator->();
+ vcl::RenderContext& operator*();
+};
+}
+
+#endif // INCLUDED_VCL_SOURCE_WINDOW_BUFFERDEVICE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx
index ccee51895c3e..fd0f54b4138f 100644
--- a/vcl/source/window/menubarwindow.cxx
+++ b/vcl/source/window/menubarwindow.cxx
@@ -33,6 +33,7 @@
#include <strings.hrc>
#include <bitmaps.hlst>
#include <window.h>
+#include "bufferdevice.hxx"
// document closing button
#define IID_DOCUMENTCLOSE 1
@@ -918,11 +919,7 @@ void MenuBarWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Recta
}
// Make sure that all actual rendering happens in one go to avoid flicker.
- ScopedVclPtrInstance<VirtualDevice> pBuffer;
- pBuffer->SetOutputSizePixel(aOutputSize, false);
- // Copy the current state to the buffer.
- pBuffer->DrawOutDev(Point(0, 0), GetOutputSizePixel(), Point(0, 0), GetOutputSizePixel(),
- rRenderContext);
+ vcl::BufferDevice pBuffer(this, rRenderContext);
if (rRenderContext.IsNativeControlSupported(ControlType::Menubar, ControlPart::Entire))
{
@@ -965,10 +962,6 @@ void MenuBarWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Recta
Point(aSize.Width() - 1, aSize.Height() - 1));
pBuffer->Pop();
}
-
- // Copy the current state from the buffer.
- rRenderContext.DrawOutDev(Point(0, 0), GetOutputSizePixel(), Point(0, 0), GetOutputSizePixel(),
- *pBuffer);
}
void MenuBarWindow::Resize()
diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx
index 9debcff5e5b4..9a6728766672 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -20,6 +20,7 @@
#include "menufloatingwindow.hxx"
#include "menuitemlist.hxx"
#include "menubarwindow.hxx"
+#include "bufferdevice.hxx"
#include <sal/log.hxx>
#include <salmenu.hxx>
@@ -1208,10 +1209,7 @@ void MenuFloatingWindow::Paint(vcl::RenderContext& rRenderContext, const tools::
return;
// Make sure that all actual rendering happens in one go to avoid flicker.
- ScopedVclPtrInstance<VirtualDevice> pBuffer;
- pBuffer->SetOutputSizePixel(GetOutputSizePixel(), false);
- pBuffer->DrawOutDev(Point(0, 0), GetOutputSizePixel(), Point(0, 0), GetOutputSizePixel(),
- rRenderContext);
+ vcl::BufferDevice pBuffer(this, rRenderContext);
pBuffer->Push(PushFlags::CLIPREGION);
pBuffer->SetClipRegion(vcl::Region(rPaintRect));
@@ -1239,9 +1237,6 @@ void MenuFloatingWindow::Paint(vcl::RenderContext& rRenderContext, const tools::
RenderHighlightItem(*pBuffer, nHighlightedItem);
pBuffer->Pop();
-
- rRenderContext.DrawOutDev(Point(0, 0), GetOutputSizePixel(), Point(0, 0), GetOutputSizePixel(),
- *pBuffer);
}
void MenuFloatingWindow::ImplDrawScroller(vcl::RenderContext& rRenderContext, bool bUp)
commit c9e626df57a3dd66613ec6b41a7d1ffb8da1843e
Author: Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Sun Jun 2 21:01:33 2019 +0000
Commit: Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Thu Jun 13 19:46:59 2019 +0200
tdf#125692 SalObject always holds a SystemChildWindow
Let's just face reality and store it as a VclPtr.
And this is needed, because Qt, like VCL, uses deferred deletion,
and has no way to filter events to QObjects out of its event queue
easily. This way the qt5 plugin can report focus changes for
SalObjects without a crash, which happens when you close a
presentation with a video by click.
And in addition it reverts the workaround introduced in commit
e770bacc85a0 ("Qt5 workaround modal change after show bug"), as it
seems this bug is a use-after-free error, introduced by LO.
Thanks Michael Weghorn for catching that!
Maybe someone should also rename SalObject...
Reviewed-on: https://gerrit.libreoffice.org/73567
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
(cherry picked from commit 2dc6bdd1d5789ace0500cad90f5d2eb930888bb9)
Reviewed-on: https://gerrit.libreoffice.org/73921
Change-Id: I0bc64ea64f95dfc7a838799c4a04de183adfefcf
Reviewed-on: https://gerrit.libreoffice.org/73962
Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
Tested-by: Jenkins
diff --git a/vcl/inc/salobj.hxx b/vcl/inc/salobj.hxx
index 3e8dbf152d29..af4d44e42c92 100644
--- a/vcl/inc/salobj.hxx
+++ b/vcl/inc/salobj.hxx
@@ -21,16 +21,17 @@
#define INCLUDED_VCL_INC_SALOBJ_HXX
#include <vcl/dllapi.h>
+#include <vcl/syschild.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include "salwtype.hxx"
struct SystemEnvData;
-typedef void (*SALOBJECTPROC)( void* pInst, SalObjEvent nEvent );
+typedef void (*SALOBJECTPROC)(SystemChildWindow* pInst, SalObjEvent nEvent);
class VCL_PLUGIN_PUBLIC SalObject
{
- void* m_pInst;
+ VclPtr<SystemChildWindow> m_pInst;
SALOBJECTPROC m_pCallback;
bool m_bMouseTransparent:1,
m_bEraseBackground:1;
@@ -54,7 +55,7 @@ public:
virtual const SystemEnvData* GetSystemData() const = 0;
- void SetCallback( void* pInst, SALOBJECTPROC pProc )
+ void SetCallback( SystemChildWindow* pInst, SALOBJECTPROC pProc )
{ m_pInst = pInst; m_pCallback = pProc; }
void CallCallback( SalObjEvent nEvent )
{ if (m_pCallback) m_pCallback( m_pInst, nEvent ); }
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index a47d39211ee5..6b738f159ea4 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -33,6 +33,7 @@
#include <QtCore/QMimeData>
#include <QtCore/QPoint>
#include <QtCore/QSize>
+#include <QtCore/QThread>
#include <QtGui/QIcon>
#include <QtGui/QWindow>
#include <QtGui/QScreen>
@@ -556,21 +557,18 @@ void Qt5Frame::SetModal(bool bModal)
auto* pSalInst(static_cast<Qt5Instance*>(GetSalData()->m_pInstance));
assert(pSalInst);
pSalInst->RunInMainThread([this, bModal]() {
- bool wasVisible = windowHandle()->isVisible();
+
+ QWidget* const pChild = m_pTopLevel ? m_pTopLevel : m_pQWidget;
+ const bool bWasVisible = pChild->isVisible();
// modality change is only effective if the window is hidden
- if (wasVisible)
- {
- windowHandle()->hide();
- }
+ if (bWasVisible)
+ pChild->hide();
- windowHandle()->setModality(bModal ? Qt::WindowModal : Qt::NonModal);
+ pChild->setWindowModality(bModal ? Qt::WindowModal : Qt::NonModal);
- // and shown again if it was visible
- if (wasVisible)
- {
- windowHandle()->show();
- }
+ if (bWasVisible)
+ pChild->show();
});
}
}
diff --git a/vcl/source/window/syschild.cxx b/vcl/source/window/syschild.cxx
index 28063ce19c63..e6f3e6013400 100644
--- a/vcl/source/window/syschild.cxx
+++ b/vcl/source/window/syschild.cxx
@@ -42,9 +42,9 @@
using namespace ::com::sun::star;
-static void ImplSysChildProc( void* pInst, SalObjEvent nEvent )
+static void ImplSysChildProc( SystemChildWindow* pInst, SalObjEvent nEvent )
{
- VclPtr<SystemChildWindow> pWindow = static_cast<SystemChildWindow*>(pInst);
+ VclPtr<SystemChildWindow> pWindow = pInst;
switch ( nEvent )
{
@@ -68,6 +68,8 @@ static void ImplSysChildProc( void* pInst, SalObjEvent nEvent )
case SalObjEvent::LoseFocus:
// trigger a LoseFocus which matches the status
// of the window with matching Activate-Status
+ if (pWindow->IsDisposed())
+ break;
pWindow->ImplGetFrameData()->mbSysObjFocus = false;
if ( !pWindow->ImplGetFrameData()->mnFocusId )
{
commit c98b7c9e75a951012d6693f5adecb1ff0e1f8f6b
Author: Muhammet Kara <muhammet.kara at collabora.com>
AuthorDate: Thu Jun 13 13:19:05 2019 +0200
Commit: Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Thu Jun 13 19:41:32 2019 +0200
Resolves tdf#125840: Crash when trying to customize Base Data View toolbar
Change-Id: If5b157c1f1362128d22d210286da741ba905e5aa
Reviewed-on: https://gerrit.libreoffice.org/73958
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
diff --git a/cui/source/customize/SvxMenuConfigPage.cxx b/cui/source/customize/SvxMenuConfigPage.cxx
index bf0247ca5f2c..03e3f9ac046d 100644
--- a/cui/source/customize/SvxMenuConfigPage.cxx
+++ b/cui/source/customize/SvxMenuConfigPage.cxx
@@ -223,10 +223,14 @@ void SvxMenuConfigPage::UpdateButtonStates()
{
SvxConfigEntry* pMenuData = GetTopLevelSelection();
PopupMenu* pGearPopup = m_pGearBtn->GetPopupMenu();
+
+ if (!pGearPopup)
+ return;
+
// Add option (gear_add) will always be enabled
- pGearPopup->EnableItem( "gear_delete", pMenuData->IsDeletable() );
- pGearPopup->EnableItem( "gear_rename", pMenuData->IsRenamable() );
- pGearPopup->EnableItem( "gear_move", pMenuData->IsMovable() );
+ pGearPopup->EnableItem( "gear_delete", pMenuData && pMenuData->IsDeletable() );
+ pGearPopup->EnableItem( "gear_rename", pMenuData && pMenuData->IsRenamable() );
+ pGearPopup->EnableItem( "gear_move", pMenuData && pMenuData->IsMovable() );
}
}
commit 7f89fe721d2b74ad88b5a124cda20ae419746dec
Author: Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Thu Jun 13 02:33:20 2019 +0000
Commit: Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Thu Jun 13 18:46:03 2019 +0200
Qt5 correctly hide menu bar in tabbed mode
Change-Id: I179780c2df5637b8a28c3a77b829319b1a64845b
Reviewed-on: https://gerrit.libreoffice.org/73924
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
(cherry picked from commit 9758b9b6e52e8e8a8a5cc24b51d62a853a3def82)
Reviewed-on: https://gerrit.libreoffice.org/73926
(cherry picked from commit 221f27433900490e2b00bd4ed6957ab36ecadb33)
Reviewed-on: https://gerrit.libreoffice.org/73927
Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx
index 0eeafb89f85d..916e92f794c5 100644
--- a/vcl/qt5/Qt5Menu.cxx
+++ b/vcl/qt5/Qt5Menu.cxx
@@ -536,8 +536,8 @@ Qt5Menu* Qt5Menu::GetTopLevel()
void Qt5Menu::ShowMenuBar(bool bVisible)
{
- if (mpQMenuBar && (bVisible != mpQMenuBar->isVisible()))
- bVisible ? mpQMenuBar->show() : mpQMenuBar->hide();
+ if (mpQMenuBar)
+ mpQMenuBar->setVisible(bVisible);
}
const Qt5Frame* Qt5Menu::GetFrame() const
commit 10850d0d8406a7c0b1524788bf9f6530ea4012e8
Author: Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Wed Jun 12 00:54:04 2019 +0200
Commit: Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Thu Jun 13 18:41:43 2019 +0200
tdf#125821 don't crash on missing gstreamer plugins
If GStreamer can't auto-detect an audio sink via "autoaudiosink",
it'll return a nullptr. If the volume plugin is missing, then this
currently also results in a crash.
So check the gst_element_factory_make results before using the
objects and change some wrong mpPlaybin checks to the right
mpVolumeControl ones.
This works for me without any audio and volume plugins. Since we
are linked against libgstaudio, I assume the bin is always there.
Change-Id: Ide526363d810ea48d0a62539c0a435553783e34a
Reviewed-on: https://gerrit.libreoffice.org/73848
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
(cherry picked from commit 5e6af47dc87a55fea595c952ea3e59c93d0620db)
Reviewed-on: https://gerrit.libreoffice.org/73919
(cherry picked from commit 142696e71e15db3c112796c43630bdfa6c634fa0)
Reviewed-on: https://gerrit.libreoffice.org/73922
Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx
index e900ed96ba47..4c478e3a3ba2 100644
--- a/avmedia/source/gstreamer/gstplayer.cxx
+++ b/avmedia/source/gstreamer/gstplayer.cxx
@@ -664,11 +664,18 @@ void Player::preparePlaybin( const OUString& rURL, GstElement *pSink )
mpVolumeControl = gst_element_factory_make( "volume", nullptr );
GstElement *pAudioSink = gst_element_factory_make( "autoaudiosink", nullptr );
GstElement* pAudioOutput = gst_bin_new("audio-output-bin");
- gst_bin_add_many(GST_BIN(pAudioOutput), mpVolumeControl, pAudioSink, nullptr);
- gst_element_link(mpVolumeControl, pAudioSink);
- GstPad *pPad = gst_element_get_static_pad(mpVolumeControl, "sink");
- gst_element_add_pad(GST_ELEMENT(pAudioOutput), gst_ghost_pad_new("sink", pPad));
- gst_object_unref(GST_OBJECT(pPad));
+ assert(pAudioOutput);
+ if (pAudioSink)
+ gst_bin_add(GST_BIN(pAudioOutput), pAudioSink);
+ if (mpVolumeControl)
+ {
+ gst_bin_add(GST_BIN(pAudioOutput), mpVolumeControl);
+ if (pAudioSink)
+ gst_element_link(mpVolumeControl, pAudioSink);
+ GstPad *pPad = gst_element_get_static_pad(mpVolumeControl, "sink");
+ gst_element_add_pad(GST_ELEMENT(pAudioOutput), gst_ghost_pad_new("sink", pPad));
+ gst_object_unref(GST_OBJECT(pPad));
+ }
g_object_set(G_OBJECT(mpPlaybin), "audio-sink", pAudioOutput, nullptr);
if( pSink != nullptr ) // used for getting preferred size etc.
@@ -847,7 +854,7 @@ void SAL_CALL Player::setMute( sal_Bool bSet )
SAL_INFO( "avmedia.gstreamer", AVVERSION "set mute: " << bSet << " muted: " << mbMuted << " unmuted volume: " << mnUnmutedVolume );
// change the volume to 0 or the unmuted volume
- if( mpPlaybin && mbMuted != bool(bSet) )
+ if (mpVolumeControl && mbMuted != bool(bSet))
{
double nVolume = mnUnmutedVolume;
if( bSet )
@@ -879,7 +886,7 @@ void SAL_CALL Player::setVolumeDB( sal_Int16 nVolumeDB )
SAL_INFO( "avmedia.gstreamer", AVVERSION "set volume: " << nVolumeDB << " gst volume: " << mnUnmutedVolume );
// change volume
- if( !mbMuted && mpPlaybin )
+ if (mpVolumeControl && !mbMuted)
{
g_object_set( G_OBJECT( mpVolumeControl ), "volume", mnUnmutedVolume, nullptr );
}
@@ -892,7 +899,8 @@ sal_Int16 SAL_CALL Player::getVolumeDB()
sal_Int16 nVolumeDB(0);
- if( mpPlaybin ) {
+ if (mpVolumeControl)
+ {
double nGstVolume = 0.0;
g_object_get( G_OBJECT( mpVolumeControl ), "volume", &nGstVolume, nullptr );
commit e6f0794be0bfaa55c992758a38444e1bcc481c45
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon May 27 21:24:42 2019 +0200
Commit: Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Thu Jun 13 18:27:50 2019 +0200
tdf#125281 DOC import: fix size of lazy-loaded metafiles
Metafiles may have an external header, so once graphic data is read, we
need to set the size explicitly. Otherwise the width of the EMF image in
the bugdoc will be too small.
(cherry picked from commit 69b62cfcbd364d7f62142149c2f690104b217ca1)
Conflicts:
filter/source/msfilter/msdffimp.cxx
sw/qa/extras/ww8import/ww8import.cxx
Change-Id: I2441eda61278b0f4973db5d9aa14618ccd17c397
Reviewed-on: https://gerrit.libreoffice.org/73180
Tested-by: Jenkins
Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index c9087180ecdf..b6898f1478fb 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -6558,6 +6558,11 @@ bool SvxMSDffManager::GetBLIPDirect( SvStream& rBLIPStream, Graphic& rData, tool
// size to the size of this record.
sal_uInt64 maxSize = pGrStream == &rBLIPStream ? nLength : 0;
Graphic aGraphic = rGF.ImportUnloadedGraphic(*pGrStream, maxSize);
+
+ // Size available in metafile header, set that here.
+ if (aMtfSize100.getWidth() && aMtfSize100.getHeight())
+ aGraphic.SetPrefSize(aMtfSize100);
+
if (aGraphic)
{
rData = aGraphic;
diff --git a/sw/CppunitTest_sw_ww8import.mk b/sw/CppunitTest_sw_ww8import.mk
index 1ccc1a3f20aa..932878b0e557 100644
--- a/sw/CppunitTest_sw_ww8import.mk
+++ b/sw/CppunitTest_sw_ww8import.mk
@@ -50,35 +50,7 @@ $(eval $(call gb_CppunitTest_use_api,sw_ww8import,\
$(eval $(call gb_CppunitTest_use_ure,sw_ww8import))
$(eval $(call gb_CppunitTest_use_vcl,sw_ww8import))
-$(eval $(call gb_CppunitTest_use_components,sw_ww8import,\
- basic/util/sb \
- comphelper/util/comphelp \
- configmgr/source/configmgr \
- dbaccess/util/dba \
- filter/source/config/cache/filterconfig1 \
- forms/util/frm \
- framework/util/fwk \
- i18npool/util/i18npool \
- linguistic/source/lng \
- package/util/package2 \
- package/source/xstor/xstor \
- sw/util/msword \
- sw/util/sw \
- sw/util/swd \
- sfx2/util/sfx \
- svl/source/fsstor/fsstorage \
- svtools/util/svt \
- toolkit/util/tk \
- ucb/source/core/ucb1 \
- ucb/source/ucp/file/ucpfile1 \
- ucb/source/ucp/tdoc/ucptdoc1 \
- unotools/util/utl \
- unoxml/source/rdf/unordf \
- unoxml/source/service/unoxml \
- uui/util/uui \
- vcl/vcl.common \
- $(if $(filter DESKTOP,$(BUILD_TYPE)),xmlhelp/util/ucpchelp1) \
-))
+$(eval $(call gb_CppunitTest_use_rdb,sw_ww8import,services))
$(eval $(call gb_CppunitTest_use_configuration,sw_ww8import))
diff --git a/sw/qa/extras/ww8import/data/tdf125281.doc b/sw/qa/extras/ww8import/data/tdf125281.doc
new file mode 100644
index 000000000000..15146f9e3daf
Binary files /dev/null and b/sw/qa/extras/ww8import/data/tdf125281.doc differ
diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx
index 09e3a1752504..fdc816088f62 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -14,6 +14,7 @@
#include <ndtxt.hxx>
#include <viscrs.hxx>
#include <wrtsh.hxx>
+#include <ndgrf.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/docfilt.hxx>
@@ -161,6 +162,22 @@ DECLARE_WW8IMPORT_TEST(testTdf112346, "tdf112346.doc")
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), xDrawPage->getCount());
}
+DECLARE_WW8IMPORT_TEST(testTdf125281, "tdf125281.doc")
+{
+ // Load a .doc file which has an embedded .emf image.
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
+ SwNode* pNode = pDoc->GetNodes()[6];
+ CPPUNIT_ASSERT(pNode->IsGrfNode());
+ SwGrfNode* pGrfNode = pNode->GetGrfNode();
+ const Graphic& rGraphic = pGrfNode->GetGrf();
+
+ // Without the accompanying fix in place, this test would have failed, as pref size was 0 till
+ // an actual Paint() was performed (and even then, it was wrong).
+ long nExpected = 25664;
+ CPPUNIT_ASSERT_EQUAL(nExpected, rGraphic.GetPrefSize().getWidth());
+}
+
DECLARE_WW8IMPORT_TEST(testTdf110987, "tdf110987")
{
// The input document is an empty .doc, but without file name
commit d0b03870b7eb67a5a4f4981c1e104ca03bd6e993
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Wed May 15 16:29:31 2019 +0200
Commit: Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Thu Jun 13 16:45:23 2019 +0200
Revert "tdf#120836 KDE5: Clipboard: don't put images to clipboard"
My previous commit has disabled setting non-text for selection, so
this workaround is no longer needed (and it very much looks like
a workaround, I see no good reason for never putting images
in the clipboard).
This reverts commit c8b0c382c6330865df50ae7cf7360c8a2c08ebe6.
Change-Id: I0206211e3ff0adcb89f8ca5410831a428e71fb51
Reviewed-on: https://gerrit.libreoffice.org/72370
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
(cherry picked from commit 0d58f51d7672c569c93c6e814dbfffa586eebfb7)
Reviewed-on: https://gerrit.libreoffice.org/73929
Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
diff --git a/vcl/qt5/Qt5Clipboard.cxx b/vcl/qt5/Qt5Clipboard.cxx
index d4df05504b8e..6d333d498ff2 100644
--- a/vcl/qt5/Qt5Clipboard.cxx
+++ b/vcl/qt5/Qt5Clipboard.cxx
@@ -287,6 +287,36 @@ void VclQt5Clipboard::setContents(
}
}
+ // Add image data if present
+ if (bHasImage)
+ {
+ css::datatransfer::DataFlavor aFlavor;
+ //FIXME: other image formats?
+ aFlavor.MimeType = "image/png";
+ aFlavor.DataType = cppu::UnoType<Sequence<sal_Int8>>::get();
+
+ Any aValue;
+ try
+ {
+ aValue = xTrans->getTransferData(aFlavor);
+ }
+ catch (...)
+ {
+ }
+
+ if (aValue.getValueType() == cppu::UnoType<Sequence<sal_Int8>>::get())
+ {
+ Sequence<sal_Int8> aData;
+ aValue >>= aData;
+
+ QImage image;
+ image.loadFromData(reinterpret_cast<const uchar*>(aData.getConstArray()),
+ aData.getLength());
+
+ pMimeData->setImageData(image);
+ }
+ }
+
// Add text data
// TODO: consider checking if text of suitable type is present
{
commit efef02cc463f73bd575237ce702f735b9b494733
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Wed May 15 16:26:59 2019 +0200
Commit: Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Thu Jun 13 16:45:17 2019 +0200
do not add non-text to PRIMARY selection in VclQt5Clipboard
E.g. tdf#80853 repeatedly sets the selection, which results
in the entire document getting converted to html.
Other VCL backends seem to be even faster, it looks like they convert
the data only on-demand, but this at least makes things bearable.
Change-Id: Ib08423bd89d7c7065ad0522338979f1ce66701c7
Reviewed-on: https://gerrit.libreoffice.org/72369
Tested-by: Jenkins
Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
(cherry picked from commit 294d4ed6aab4ae6dbf859626545cf6d75194bacd)
Reviewed-on: https://gerrit.libreoffice.org/73928
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
diff --git a/vcl/qt5/Qt5Clipboard.cxx b/vcl/qt5/Qt5Clipboard.cxx
index 5fdbc47dfd2c..d4df05504b8e 100644
--- a/vcl/qt5/Qt5Clipboard.cxx
+++ b/vcl/qt5/Qt5Clipboard.cxx
@@ -249,8 +249,13 @@ void VclQt5Clipboard::setContents(
{
css::uno::Sequence<css::datatransfer::DataFlavor> aFormats
= xTrans->getTransferDataFlavors();
+ // Do not add non-text formats for the selection buffer,
+ // I don't think that one is ever used for anything else
+ // besides text and this gets called whenever something
+ // in LO gets selected (which may be e.g. an entire Calc sheet).
bool bHasHtml = false, bHasImage = false;
- lcl_peekFormats(aFormats, bHasHtml, bHasImage);
+ if (m_aClipboardMode != QClipboard::Selection)
+ lcl_peekFormats(aFormats, bHasHtml, bHasImage);
std::unique_ptr<QMimeData> pMimeData(new QMimeData);
commit 7c54b11e98a7b8705eb2fc0ad41a6ec25f8e62e7
Author: Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri May 24 15:36:39 2019 +0000
Commit: Katarina Behrens <Katarina.Behrens at cib.de>
CommitDate: Thu Jun 13 13:52:27 2019 +0200
Qt5 implement SalSurface support for cairo
Current qt5+cairo uses the plain VCL canvas. This patch is just a
copy of Gtk3Surface (minus comments) with a different update call.
This way the Cairo path now uses the Cairo canvas instead.
It fixes at least tdf#122668 for me, but other Impress bugs might
be fixed this way too.
Reviewed-on: https://gerrit.libreoffice.org/72921
Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
Tested-by: Jenkins
Reviewed-by: Aleksei Nikiforov <darktemplar at basealt.ru>
(cherry picked from commit 86cab846c1a122dd4dd5f5c4ca5750a0fc397c6b)
[This also squashes the backport of commit cc237438f6d1c7ee3a391b51402aaa71cd347b6b
("qt5: Make it compile with '-Werror=shadow'") in to the same commit.]
Change-Id: Iba511c851001753328293c28e53eaa4acc4315d0
Reviewed-on: https://gerrit.libreoffice.org/73198
Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
Tested-by: Jenkins
Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
diff --git a/vcl/Library_vclplug_qt5.mk b/vcl/Library_vclplug_qt5.mk
index d51175756009..6e23c0d496da 100644
--- a/vcl/Library_vclplug_qt5.mk
+++ b/vcl/Library_vclplug_qt5.mk
@@ -102,6 +102,8 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
vcl/qt5/Qt5OpenGLContext \
vcl/qt5/Qt5Painter \
vcl/qt5/Qt5Printer \
+ vcl/qt5/Qt5SvpGraphics \
+ vcl/qt5/Qt5SvpSurface \
vcl/qt5/Qt5System \
vcl/qt5/Qt5Timer \
vcl/qt5/Qt5Tools \
diff --git a/vcl/inc/qt5/Qt5Frame.hxx b/vcl/inc/qt5/Qt5Frame.hxx
index 07a53972ee9b..26d44cb80c8e 100644
--- a/vcl/inc/qt5/Qt5Frame.hxx
+++ b/vcl/inc/qt5/Qt5Frame.hxx
@@ -30,18 +30,19 @@
#include <QtCore/QObject>
+class Qt5DragSource;
+class Qt5DropTarget;
class Qt5Graphics;
class Qt5Instance;
-class Qt5Menu;
-class QWidget;
class Qt5MainWindow;
-class Qt5DragSource;
-class Qt5DropTarget;
+class Qt5Menu;
+class Qt5SvpGraphics;
+
+class QImage;
class QMimeData;
class QPaintDevice;
class QScreen;
-class QImage;
-class SvpSalGraphics;
+class QWidget;
class VCLPLUG_QT5_PUBLIC Qt5Frame : public QObject, public SalFrame
{
@@ -56,11 +57,11 @@ class VCLPLUG_QT5_PUBLIC Qt5Frame : public QObject, public SalFrame
std::unique_ptr<QImage> m_pQImage;
std::unique_ptr<Qt5Graphics> m_pQt5Graphics;
UniqueCairoSurface m_pSurface;
- std::unique_ptr<SvpSalGraphics> m_pOurSvpGraphics;
+ std::unique_ptr<Qt5SvpGraphics> m_pOurSvpGraphics;
// in base class, this ptr is the same as m_pOurSvpGraphic
// in derived class, it can point to a derivative
- // of SvpSalGraphics (which the derived class then owns)
- SvpSalGraphics* m_pSvpGraphics;
+ // of Qt5SvpGraphics (which the derived class then owns)
+ Qt5SvpGraphics* m_pSvpGraphics;
DamageHandler m_aDamageHandler;
QRegion m_aRegion;
bool m_bNullRegion;
@@ -125,7 +126,7 @@ public:
void Damage(sal_Int32 nExtentsX, sal_Int32 nExtentsY, sal_Int32 nExtentsWidth,
sal_Int32 nExtentsHeight) const;
- virtual void InitSvpSalGraphics(SvpSalGraphics* pSvpSalGraphics);
+ void InitQt5SvpGraphics(Qt5SvpGraphics* pQt5SvpGraphics);
virtual SalGraphics* AcquireGraphics() override;
virtual void ReleaseGraphics(SalGraphics* pGraphics) override;
@@ -190,6 +191,8 @@ public:
virtual void SetApplicationID(const OUString&) override;
inline bool CallCallback(SalEvent nEvent, const void* pEvent) const;
+
+ cairo_t* getCairoContext() const;
};
inline bool Qt5Frame::CallCallback(SalEvent nEvent, const void* pEvent) const
diff --git a/vcl/inc/qt5/Qt5SvpGraphics.hxx b/vcl/inc/qt5/Qt5SvpGraphics.hxx
new file mode 100644
index 000000000000..e6a931b77f55
--- /dev/null
+++ b/vcl/inc/qt5/Qt5SvpGraphics.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <vclpluginapi.h>
+#include <headless/svpgdi.hxx>
+
+class QWidget;
+
+class VCLPLUG_QT5_PUBLIC Qt5SvpGraphics : public SvpSalGraphics
+{
+ QWidget* m_pQWidget;
+
+public:
+ Qt5SvpGraphics(QWidget* pQWidget);
+ ~Qt5SvpGraphics() override;
+
+ void updateQWidget() const;
+
+#if ENABLE_CAIRO_CANVAS
+ bool SupportsCairo() const override;
+ cairo::SurfaceSharedPtr
+ CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const override;
+ cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y, int width,
+ int height) const override;
+#endif // ENABLE_CAIRO_CANVAS
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/Qt5SvpSurface.hxx b/vcl/inc/qt5/Qt5SvpSurface.hxx
new file mode 100644
index 000000000000..196e2bbfa22c
--- /dev/null
+++ b/vcl/inc/qt5/Qt5SvpSurface.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <sal/types.h>
+
+#include <vcl/cairo.hxx>
+
+class Qt5SvpGraphics;
+class OutputDevice;
+
+namespace cairo
+{
+class Qt5SvpSurface : public Surface
+{
+ const Qt5SvpGraphics* m_pGraphics;
+ cairo_t* const m_pCairoContext;
+ CairoSurfaceSharedPtr m_pSurface;
+
+public:
+ /// takes over ownership of passed cairo_surface
+ explicit Qt5SvpSurface(const CairoSurfaceSharedPtr& pSurface);
+ /// create surface on subarea of given drawable
+ explicit Qt5SvpSurface(const Qt5SvpGraphics* pGraphics, int x, int y, int width, int height);
+ ~Qt5SvpSurface() override;
+
+ // Surface interface
+ CairoSharedPtr getCairo() const override;
+ CairoSurfaceSharedPtr getCairoSurface() const override { return m_pSurface; }
+ SurfaceSharedPtr getSimilar(int nContentType, int width, int height) const override;
+
+ VclPtr<VirtualDevice> createVirtualDevice() const override;
+ void flush() const override;
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index 27d0828539f5..a47d39211ee5 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -20,14 +20,15 @@
#include <Qt5Frame.hxx>
#include <Qt5Frame.moc>
-#include <Qt5Tools.hxx>
-#include <Qt5Instance.hxx>
+#include <Qt5Data.hxx>
+#include <Qt5DragAndDrop.hxx>
#include <Qt5Graphics.hxx>
-#include <Qt5Widget.hxx>
+#include <Qt5Instance.hxx>
#include <Qt5MainWindow.hxx>
-#include <Qt5Data.hxx>
#include <Qt5Menu.hxx>
-#include <Qt5DragAndDrop.hxx>
+#include <Qt5SvpGraphics.hxx>
+#include <Qt5Tools.hxx>
+#include <Qt5Widget.hxx>
#include <QtCore/QMimeData>
#include <QtCore/QPoint>
@@ -241,14 +242,14 @@ void Qt5Frame::TriggerPaintEvent(QRect aRect)
CallCallback(SalEvent::Paint, &aPaintEvt);
}
-void Qt5Frame::InitSvpSalGraphics(SvpSalGraphics* pSvpSalGraphics)
+void Qt5Frame::InitQt5SvpGraphics(Qt5SvpGraphics* pQt5SvpGraphics)
{
int width = 640;
int height = 480;
- m_pSvpGraphics = pSvpSalGraphics;
+ m_pSvpGraphics = pQt5SvpGraphics;
m_pSurface.reset(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height));
m_pSvpGraphics->setSurface(m_pSurface.get(), basegfx::B2IVector(width, height));
- cairo_surface_set_user_data(m_pSurface.get(), SvpSalGraphics::getDamageKey(), &m_aDamageHandler,
+ cairo_surface_set_user_data(m_pSurface.get(), Qt5SvpGraphics::getDamageKey(), &m_aDamageHandler,
nullptr);
}
@@ -263,8 +264,8 @@ SalGraphics* Qt5Frame::AcquireGraphics()
{
if (!m_pOurSvpGraphics.get())
{
- m_pOurSvpGraphics.reset(new SvpSalGraphics());
- InitSvpSalGraphics(m_pOurSvpGraphics.get());
+ m_pOurSvpGraphics.reset(new Qt5SvpGraphics(m_pQWidget));
+ InitQt5SvpGraphics(m_pOurSvpGraphics.get());
}
return m_pOurSvpGraphics.get();
}
@@ -1257,4 +1258,15 @@ void Qt5Frame::dropping(const int x, const int y, const QMimeData* pQMimeData)
}
}
+cairo_t* Qt5Frame::getCairoContext() const
+{
+ cairo_t* cr = nullptr;
+ if (m_bUseCairo)
+ {
+ cr = cairo_create(m_pSurface.get());
+ assert(cr);
+ }
+ return cr;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/Qt5SvpGraphics.cxx b/vcl/qt5/Qt5SvpGraphics.cxx
new file mode 100644
index 000000000000..f746381e6561
--- /dev/null
+++ b/vcl/qt5/Qt5SvpGraphics.cxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <sal/config.h>
+#include <sal/log.hxx>
+
+#include <config_cairo_canvas.h>
+
+#include <Qt5SvpGraphics.hxx>
+#include <Qt5SvpSurface.hxx>
+
+#include <QtWidgets/QWidget>
+
+Qt5SvpGraphics::Qt5SvpGraphics(QWidget* pQWidget)
+ : SvpSalGraphics()
+ , m_pQWidget(pQWidget)
+{
+}
+
+Qt5SvpGraphics::~Qt5SvpGraphics() {}
+
+void Qt5SvpGraphics::updateQWidget() const
+{
+ if (m_pQWidget)
+ m_pQWidget->update(m_pQWidget->rect());
+}
+
+#if ENABLE_CAIRO_CANVAS
+
+bool Qt5SvpGraphics::SupportsCairo() const { return true; }
+
+cairo::SurfaceSharedPtr
+Qt5SvpGraphics::CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const
+{
+ return cairo::SurfaceSharedPtr(new cairo::Qt5SvpSurface(rSurface));
+}
+
+cairo::SurfaceSharedPtr Qt5SvpGraphics::CreateSurface(const OutputDevice& /*rRefDevice*/, int x,
+ int y, int width, int height) const
+{
+ return cairo::SurfaceSharedPtr(new cairo::Qt5SvpSurface(this, x, y, width, height));
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/Qt5SvpSurface.cxx b/vcl/qt5/Qt5SvpSurface.cxx
new file mode 100644
index 000000000000..00f6004bd2a0
--- /dev/null
+++ b/vcl/qt5/Qt5SvpSurface.cxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <utility>
+
+#include <Qt5SvpSurface.hxx>
+
+#include <Qt5SvpGraphics.hxx>
+
+#include <vcl/sysdata.hxx>
+#include <vcl/bitmap.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/window.hxx>
+#include <basegfx/vector/b2isize.hxx>
+
+namespace cairo
+{
+Qt5SvpSurface::Qt5SvpSurface(const CairoSurfaceSharedPtr& pSurface)
+ : m_pGraphics(nullptr)
+ , m_pCairoContext(nullptr)
+ , m_pSurface(pSurface)
+{
+}
+
+Qt5SvpSurface::Qt5SvpSurface(const Qt5SvpGraphics* pGraphics, int x, int y, int width, int height)
+ : m_pGraphics(pGraphics)
+ , m_pCairoContext(pGraphics->getCairoContext(false))
+{
+ cairo_surface_t* surface = cairo_get_target(m_pCairoContext);
+ m_pSurface.reset(cairo_surface_create_for_rectangle(surface, x, y, width, height),
+ &cairo_surface_destroy);
+}
+
+Qt5SvpSurface::~Qt5SvpSurface()
+{
+ if (m_pCairoContext)
+ cairo_destroy(m_pCairoContext);
+}
+
+CairoSharedPtr Qt5SvpSurface::getCairo() const
+{
+ return CairoSharedPtr(cairo_create(m_pSurface.get()), &cairo_destroy);
+}
+
+SurfaceSharedPtr Qt5SvpSurface::getSimilar(int cairo_content_type, int width, int height) const
+{
+ return SurfaceSharedPtr(new Qt5SvpSurface(CairoSurfaceSharedPtr(
+ cairo_surface_create_similar(
+ m_pSurface.get(), static_cast<cairo_content_t>(cairo_content_type), width, height),
+ &cairo_surface_destroy)));
+}
+
+void Qt5SvpSurface::flush() const
+{
+ cairo_surface_flush(m_pSurface.get());
+ if (m_pGraphics)
+ m_pGraphics->updateQWidget();
+}
+
+VclPtr<VirtualDevice> Qt5SvpSurface::createVirtualDevice() const
+{
+ return VclPtrInstance<VirtualDevice>(nullptr, Size(1, 1), DeviceFormat::DEFAULT);
+}
+
+} // namespace cairo
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index 2137109beac7..44b62c48150d 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -22,6 +22,7 @@
#include <Qt5Frame.hxx>
#include <Qt5Graphics.hxx>
+#include <Qt5SvpGraphics.hxx>
#include <Qt5Tools.hxx>
#include <QtCore/QMimeData>
@@ -41,7 +42,6 @@
#include <QtWidgets/QWidget>
#include <cairo.h>
-#include <headless/svpgdi.hxx>
#include <vcl/commandevent.hxx>
void Qt5Widget::paintEvent(QPaintEvent* pEvent)
diff --git a/vcl/unx/kde5/KDE5SalFrame.cxx b/vcl/unx/kde5/KDE5SalFrame.cxx
index d3a13968237f..c195b641e119 100644
--- a/vcl/unx/kde5/KDE5SalFrame.cxx
+++ b/vcl/unx/kde5/KDE5SalFrame.cxx
@@ -30,8 +30,6 @@
#include <KConfigGroup>
#include <KSharedConfig>
-#undef Region
-
#include "KDE5SalFrame.hxx"
#include "KDE5SalGraphics.hxx"
@@ -211,7 +209,7 @@ SalGraphics* KDE5SalFrame::AcquireGraphics()
if (!m_pKDE5Graphics.get())
{
m_pKDE5Graphics.reset(new KDE5SalGraphics(this));
- Qt5Frame::InitSvpSalGraphics(m_pKDE5Graphics.get());
+ Qt5Frame::InitQt5SvpGraphics(m_pKDE5Graphics.get());
}
return m_pKDE5Graphics.get();
diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx
index 0b4b4283f0da..6e30b9599740 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.cxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.cxx
@@ -40,7 +40,7 @@ static void QImage2BitmapBuffer(QImage* pImg, BitmapBuffer* pBuf)
}
KDE5SalGraphics::KDE5SalGraphics(Qt5Frame* pFrame)
- : SvpSalGraphics()
+ : Qt5SvpGraphics(pFrame->GetQWidget())
, m_pFrame(pFrame)
{
}
diff --git a/vcl/unx/kde5/KDE5SalGraphics.hxx b/vcl/unx/kde5/KDE5SalGraphics.hxx
index 109a0fa8ac29..1b12d890278c 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.hxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.hxx
@@ -25,6 +25,7 @@
#include <headless/svpgdi.hxx>
#include <Qt5Graphics_Controls.hxx>
+#include <Qt5SvpGraphics.hxx>
#include <QtGui/QImage>
#include <QtWidgets/QPushButton>
@@ -34,7 +35,7 @@ class Qt5Frame;
/**
* Handles native graphics requests and performs the needed drawing operations.
*/
-class KDE5SalGraphics : public SvpSalGraphics
+class KDE5SalGraphics : public Qt5SvpGraphics
{
public:
KDE5SalGraphics(Qt5Frame* pFrame);
commit 87c418a98650ab6e4a62a0b4b72e02fee358dced
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Jun 7 09:28:12 2019 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu Jun 13 13:38:27 2019 +0200
More uses of referer URL with SvxBrushItem
Reviewed-on: https://gerrit.libreoffice.org/73643
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
(cherry picked from commit b518882de8213ef71a8003f95fbdf7689069c06d)
Conflicts:
sw/source/core/text/porfld.cxx
sw/source/core/unocore/unosett.cxx
Change-Id: I04b524784df4ef453d8b1feec13b62f183a17e23
Reviewed-on: https://gerrit.libreoffice.org/73860
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
diff --git a/sw/inc/unosett.hxx b/sw/inc/unosett.hxx
index a6d49603cf7e..4d83c771382e 100644
--- a/sw/inc/unosett.hxx
+++ b/sw/inc/unosett.hxx
@@ -209,7 +209,7 @@ public:
static css::uno::Sequence<css::beans::PropertyValue> GetPropertiesForNumFormat(
const SwNumFormat& rFormat, OUString const& rCharFormatName,
- OUString const* pHeadingStyleName);
+ OUString const* pHeadingStyleName, OUString const & referer);
static void SetPropertiesToNumFormat(
SwNumFormat & aFormat,
OUString & rCharStyleName,
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index be4bf770dd59..bb563e63875a 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -751,7 +751,7 @@ SwBulletPortion::SwBulletPortion( const sal_Unicode cBullet,
SwGrfNumPortion::SwGrfNumPortion(
const OUString& rGraphicFollowedBy,
- const SvxBrushItem* pGrfBrush,
+ const SvxBrushItem* pGrfBrush, OUString const & referer,
const SwFormatVertOrient* pGrfOrient, const Size& rGrfSize,
const bool bLft, const bool bCntr, const sal_uInt16 nMinDst,
const bool bLabelAlignmentPosAndSpaceModeActive ) :
@@ -765,7 +765,7 @@ SwGrfNumPortion::SwGrfNumPortion(
if( pGrfBrush )
{
*pBrush = *pGrfBrush;
- const Graphic* pGraph = pGrfBrush->GetGraphic();
+ const Graphic* pGraph = pGrfBrush->GetGraphic(referer);
if( pGraph )
SetAnimated( pGraph->IsAnimated() );
else
diff --git a/sw/source/core/text/porfld.hxx b/sw/source/core/text/porfld.hxx
index 151404197cd9..1490d9399c60 100644
--- a/sw/source/core/text/porfld.hxx
+++ b/sw/source/core/text/porfld.hxx
@@ -162,6 +162,7 @@ class SwGrfNumPortion : public SwNumberPortion
public:
SwGrfNumPortion( const OUString& rGraphicFollowedBy,
const SvxBrushItem* pGrfBrush,
+ OUString const & referer,
const SwFormatVertOrient* pGrfOrient,
const Size& rGrfSize,
const bool bLeft,
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index 9138a35eacdc..1bed5809698e 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -52,6 +52,7 @@
#include <flddat.hxx>
#include <fmtautofmt.hxx>
#include <IDocumentSettingAccess.hxx>
+#include <sfx2/docfile.hxx>
#include <svl/itemiter.hxx>
static bool lcl_IsInBody( SwFrame const *pFrame )
@@ -505,8 +506,17 @@ SwNumberPortion *SwTextFormatter::NewNumberPortion( SwTextFormatInfo &rInf ) con
if( SVX_NUM_BITMAP == rNumFormat.GetNumberingType() )
{
+ OUString referer;
+ if (auto const sh1 = rInf.GetVsh()) {
+ if (auto const doc = sh1->GetDoc()) {
+ auto const sh2 = doc->GetPersist();
+ if (sh2 != nullptr && sh2->HasName()) {
+ referer = sh2->GetMedium()->GetName();
+ }
+ }
+ }
pRet = new SwGrfNumPortion( pTextNd->GetLabelFollowedBy(),
- rNumFormat.GetBrush(),
+ rNumFormat.GetBrush(), referer,
rNumFormat.GetGraphicOrientation(),
rNumFormat.GetGraphicSize(),
bLeft, bCenter, nMinDist,
diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx
index 3a72361cdc49..02ae09e07886 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -60,6 +60,7 @@
#include <vcl/metric.hxx>
#include <vcl/graph.hxx>
#include <vcl/GraphicLoader.hxx>
+#include <sfx2/docfile.hxx>
#include <svtools/ctrltool.hxx>
#include <vcl/svapp.hxx>
#include <editeng/unofdesc.hxx>
@@ -1301,13 +1302,21 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetNumberingRuleByIndex(
SwStyleNameMapper::FillProgName(sValue, aUString, SwGetPoolIdFromName::TxtColl);
}
- return GetPropertiesForNumFormat(rFormat, CharStyleName, (pDocShell) ? & aUString : nullptr);
+ OUString referer;
+ if (pDoc != nullptr) {
+ auto const sh = pDoc->GetPersist();
+ if (sh != nullptr && sh->HasName()) {
+ referer = sh->GetMedium()->GetName();
+ }
+ }
+ return GetPropertiesForNumFormat(
+ rFormat, CharStyleName, (pDocShell) ? & aUString : nullptr, referer);
}
uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetPropertiesForNumFormat(
const SwNumFormat& rFormat, OUString const& rCharFormatName,
- OUString const*const pHeadingStyleName)
+ OUString const*const pHeadingStyleName, OUString const & referer)
{
bool bChapterNum = pHeadingStyleName != nullptr;
@@ -1429,7 +1438,7 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetPropertiesForNumFormat
if (SVX_NUM_BITMAP == rFormat.GetNumberingType())
{
const SvxBrushItem* pBrush = rFormat.GetBrush();
- const Graphic* pGraphic = pBrush ? pBrush->GetGraphic() : nullptr;
+ const Graphic* pGraphic = pBrush ? pBrush->GetGraphic(referer) : nullptr;
if (pGraphic)
{
//GraphicBitmap
diff --git a/sw/source/uibase/config/StoredChapterNumbering.cxx b/sw/source/uibase/config/StoredChapterNumbering.cxx
index 940ffb32d845..7be6460e036d 100644
--- a/sw/source/uibase/config/StoredChapterNumbering.cxx
+++ b/sw/source/uibase/config/StoredChapterNumbering.cxx
@@ -130,7 +130,7 @@ public:
OUString dummy; // pass in empty HeadingStyleName - can't import anyway
uno::Sequence<beans::PropertyValue> const ret(
SwXNumberingRules::GetPropertiesForNumFormat(
- *pNumFormat, *pCharStyleName, &dummy));
+ *pNumFormat, *pCharStyleName, &dummy, ""));
return uno::makeAny(ret);
}
commit 3ddccc28c0893ded5a31e1c1d023af22f6ec160f
Author: Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Sun May 19 21:08:52 2019 +0200
Commit: Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Thu Jun 13 11:13:29 2019 +0200
tdf#125381: Manage URLs beginning with an "~" in cutPrefix (dbaccess/dsntypes)
On Windows or with other renderings than gtk3, the urls may begin with an ~
In this case, cutPrefix returns only empty string
When trying to access Index management for odb files related to dBase
indexes don't display because cutPrefix returns empty url
in dbaccess/source/ui/dlg/detailpages.cxx line 200
198 ::dbaccess::ODsnTypeCollection* pTypeCollection = pTypesItem ? pTypesItem->getCollection() : nullptr;
199 if (pTypeCollection && pUrlItem && pUrlItem->GetValue().getLength())
200 m_sDsn = pTypeCollection->cutPrefix(pUrlItem->GetValue());
Change-Id: I47360e205ddea7b060a31da697bbe9857ad3f4c0
Reviewed-on: https://gerrit.libreoffice.org/72568
Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
(cherry picked from commit d34ed0008f12cfe47dd239672f1941f3c54d97fd)
Reviewed-on: https://gerrit.libreoffice.org/73709
Tested-by: Jenkins
Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>
(cherry picked from commit 27bd20cf5333a5df29286794b7384520fbc55012)
Reviewed-on: https://gerrit.libreoffice.org/73876
diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx
index aeca5a029655..8e88bb586c6c 100644
--- a/dbaccess/source/core/misc/dsntypes.cxx
+++ b/dbaccess/source/core/misc/dsntypes.cxx
@@ -84,17 +84,20 @@ OUString ODsnTypeCollection::cutPrefix(const OUString& _sURL) const
OUString sRet;
OUString sOldPattern;
+ // on Windows or with gen rendering, the urls may begin with an ~
+ const OUString& sCleanURL = comphelper::string::stripStart(_sURL, '~');
+
for (auto const& dsnPrefix : m_aDsnPrefixes)
{
WildCard aWildCard(dsnPrefix);
- if ( sOldPattern.getLength() < dsnPrefix.getLength() && aWildCard.Matches(_sURL) )
+ if ( sOldPattern.getLength() < dsnPrefix.getLength() && aWildCard.Matches(sCleanURL) )
{
// This relies on the fact that all patterns are of the form
// foo*
// that is, the very concept of "prefix" applies.
OUString prefix(comphelper::string::stripEnd(dsnPrefix, '*'));
- OSL_ENSURE(prefix.getLength() <= _sURL.getLength(), "How can A match B when A shorter than B?");
- sRet = _sURL.copy(prefix.getLength());
+ OSL_ENSURE(prefix.getLength() <= sCleanURL.getLength(), "How can A match B when A shorter than B?");
+ sRet = sCleanURL.copy(prefix.getLength());
sOldPattern = dsnPrefix;
}
}
commit 7bc1418a463fe233fbd8c27dec70a1f92474db65
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jun 11 17:10:25 2019 +0100
Commit: Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Wed Jun 12 23:23:36 2019 +0200
Resolves: rhbz#1719378 wrong signature for GtkGestureLongPress::pressed
Change-Id: Ib4c47189d5c9c89433f0c7de194ebb9777dc7bac
Reviewed-on: https://gerrit.libreoffice.org/73831
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index a77c7c61686b..732a637eda81 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -271,7 +271,7 @@ class GtkSalFrame : public SalFrame
guint time, gpointer frame);
static void gestureSwipe(GtkGestureSwipe* gesture, gdouble velocity_x, gdouble velocity_y, gpointer frame);
- static void gestureLongPress(GtkGestureLongPress* gesture, gpointer frame);
+ static void gestureLongPress(GtkGestureLongPress* gesture, gdouble x, gdouble y, gpointer frame);
#else
static gboolean signalExpose( GtkWidget*, GdkEventExpose*, gpointer );
void askForXEmbedFocus( sal_Int32 nTimecode );
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index adcde282e3b1..95898a0f827e 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -2893,17 +2893,14 @@ void GtkSalFrame::gestureSwipe(GtkGestureSwipe* gesture, gdouble velocity_x, gdo
}
}
-void GtkSalFrame::gestureLongPress(GtkGestureLongPress* gesture, gpointer frame)
+void GtkSalFrame::gestureLongPress(GtkGestureLongPress* gesture, gdouble x, gdouble y, gpointer frame)
{
- GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
-
- if(pThis)
+ GdkEventSequence *sequence = gtk_gesture_single_get_current_sequence(GTK_GESTURE_SINGLE(gesture));
+ if (gtk_gesture_get_point(GTK_GESTURE(gesture), sequence, &x, &y))
{
- SalLongPressEvent aEvent;
+ GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
- gdouble x, y;
- GdkEventSequence *sequence = gtk_gesture_single_get_current_sequence(GTK_GESTURE_SINGLE(gesture));
- gtk_gesture_get_point(GTK_GESTURE(gesture), sequence, &x, &y);
+ SalLongPressEvent aEvent;
aEvent.mnX = x;
aEvent.mnY = y;
commit 527ea6c085e22576096a056f2c84e47e96ad69dd
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jun 11 10:44:46 2019 +0100
Commit: Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Wed Jun 12 23:20:58 2019 +0200
has_default needs can_default
Change-Id: Id841d214b8d88a986c07d2827b281e5805c3c941
Reviewed-on: https://gerrit.libreoffice.org/73812
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
diff --git a/dbaccess/uiconfig/ui/textconnectionsettings.ui b/dbaccess/uiconfig/ui/textconnectionsettings.ui
index c19184429637..10f01e82dfdf 100644
--- a/dbaccess/uiconfig/ui/textconnectionsettings.ui
+++ b/dbaccess/uiconfig/ui/textconnectionsettings.ui
@@ -28,6 +28,7 @@
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
More information about the Libreoffice-commits
mailing list