[Libreoffice-commits] core.git: 2 commits - include/vcl sc/source vcl/source

2022-03-14 Thread Luboš Luňák (via logerrit)
 include/vcl/glyphitemcache.hxx  |   69 
 sc/source/ui/view/output2.cxx   |   55 +++
 vcl/source/gdi/impglyphitem.cxx |   46 ++
 3 files changed, 121 insertions(+), 49 deletions(-)

New commits:
commit 89fb3f7e87fd7ab9312bc43dffea842ffc34b140
Author: Luboš Luňák 
AuthorDate: Fri Mar 11 17:48:41 2022 +0100
Commit: Luboš Luňák 
CommitDate: Mon Mar 14 08:38:09 2022 +0100

cache also failures in SalLayoutGlyphsCache

This is what 3f69ec9ab4236de13d229f675943123aeb42ea29 did in Writer.

Change-Id: I40fb49ce83fd24f16050318c523d87603300b06d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131392
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index 0d8c2241a21e..1fefe68994d2 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -99,8 +99,15 @@ SalLayoutGlyphsCache::GetLayoutGlyphs(const OUString& text, 
VclPtr
 {
 const CachedGlyphsKey key(text, outputDevice);
 auto it = mCachedGlyphs.find(key);
-if (it != mCachedGlyphs.end() && it->second.IsValid())
-return >second;
+if (it != mCachedGlyphs.end())
+{
+if (it->second.IsValid())
+return >second;
+// Do not try to create the layout here. If a cache item exists, it's 
already
+// been attempted and the layout was invalid (this happens with 
MultiSalLayout).
+// So in that case this is a cached failure.
+return nullptr;
+}
 std::unique_ptr layout = outputDevice->ImplLayout(
 text, 0, text.getLength(), Point(0, 0), 0, {}, 
SalLayoutFlags::GlyphItemsOnly);
 if (layout)
commit 3e3ef58be1c27e0ac32b0b5694f673f603d23224
Author: Luboš Luňák 
AuthorDate: Fri Mar 11 17:47:40 2022 +0100
Commit: Luboš Luňák 
CommitDate: Mon Mar 14 08:37:53 2022 +0100

move cache for SalLayoutGlyph's from Calc to VCL

For reuse later.

Change-Id: I43479148a8312a36e56f267435e77acc8bf9bd35
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131390
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/include/vcl/glyphitemcache.hxx b/include/vcl/glyphitemcache.hxx
new file mode 100644
index ..8afc8da0bae6
--- /dev/null
+++ b/include/vcl/glyphitemcache.hxx
@@ -0,0 +1,69 @@
+/* -*- 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 .
+ */
+
+#ifndef INCLUDED_VCL_GLYPHITEMCACHE_HXX
+#define INCLUDED_VCL_GLYPHITEMCACHE_HXX
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+/**
+A cache for SalLayoutGlyphs objects.
+
+Allows caching for OutputDevice::DrawText() and similar calls. Pass the text 
and the output device
+for the call to OutputDevice::ImplLayout(). Items are cached per output device 
and its font.
+If something more changes, call clear().
+*/
+class VCL_DLLPUBLIC SalLayoutGlyphsCache final
+{
+public:
+SalLayoutGlyphsCache(int size = 1000)
+: mCachedGlyphs(size)
+{
+}
+const SalLayoutGlyphs* GetLayoutGlyphs(const OUString& text,
+   VclPtr outputDevice) 
const;
+void clear() { mCachedGlyphs.clear(); }
+
+private:
+struct CachedGlyphsKey
+{
+OUString text;
+VclPtr outputDevice;
+size_t hashValue;
+CachedGlyphsKey(const OUString& t, const VclPtr& dev);
+bool operator==(const CachedGlyphsKey& other) const;
+};
+struct CachedGlyphsHash
+{
+size_t operator()(const CachedGlyphsKey& key) const { return 
key.hashValue; }
+};
+mutable o3tl::lru_map 
mCachedGlyphs;
+
+SalLayoutGlyphsCache(const SalLayoutGlyphsCache&) = delete;
+SalLayoutGlyphsCache& operator=(const SalLayoutGlyphsCache&) = delete;
+};
+
+#endif // INCLUDED_VCL_GLYPHITEMCACHE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index ab8e08c9d06f..0c394b0f7945 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -54,6 +54,7 @@
 #include 
 

[Libreoffice-commits] core.git: 2 commits - include/vcl sc/source vcl/source

2020-12-09 Thread Szymon Kłos (via logerrit)
 include/vcl/toolkit/svtabbx.hxx |2 ++
 sc/source/ui/view/gridwin.cxx   |   27 +--
 vcl/source/treelist/svtabbx.cxx |   34 ++
 3 files changed, 49 insertions(+), 14 deletions(-)

New commits:
commit ab224c4196b61c222fbf74a0dfbc57aab9859977
Author: Szymon Kłos 
AuthorDate: Fri Dec 4 15:14:03 2020 +0100
Commit: Szymon Kłos 
CommitDate: Wed Dec 9 14:09:01 2020 +0100

pivot table: fix interactions in online

Single clicks were identified as double so
clicks in the pivot table caused to create
new tables or other unwanted behaviour.

In case cursor is over pivot table - require
real double click.

Change-Id: I6ca9af9ff9dbe5a1e00f2b57753ce4f8f298288d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107225
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107405
Tested-by: Jenkins

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 418e73554096..654554a17dbe 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -2089,23 +2089,26 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& 
rMEvt )
 pView->ResetBrushDocument();// invalidates pBrushDoc 
pointer
 }
 
+Point aPos = rMEvt.GetPosPixel();
+SCCOL nPosX;
+SCROW nPosY;
+SCTAB nTab = mrViewData.GetTabNo();
+mrViewData.GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY );
+ScDPObject* pDPObj  = rDoc.GetDPAtCursor( nPosX, nPosY, nTab );
+
+bool bInDataPilotTable = (pDPObj != nullptr);
+
 // double click (only left button)
 // in the tiled rendering case, single click works this way too
 
 bool bIsTiledRendering = comphelper::LibreOfficeKit::isActive();
 bool bDouble = ( rMEvt.GetClicks() == 2 && rMEvt.IsLeft() );
-if ((bDouble || bIsTiledRendering)
+if ((bDouble || (bIsTiledRendering && !bInDataPilotTable))
 && !bRefMode
 && (nMouseStatus == SC_GM_DBLDOWN || (bIsTiledRendering && 
nMouseStatus != SC_GM_URLDOWN))
 && !pScMod->IsRefDialogOpen())
 {
 //  data pilot table
-Point aPos = rMEvt.GetPosPixel();
-SCCOL nPosX;
-SCROW nPosY;
-SCTAB nTab = mrViewData.GetTabNo();
-mrViewData.GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY );
-ScDPObject* pDPObj  = rDoc.GetDPAtCursor( nPosX, nPosY, nTab );
 if ( pDPObj && pDPObj->GetSaveData()->GetDrillDown() )
 {
 ScAddress aCellPos( nPosX, nPosY, mrViewData.GetTabNo() );
@@ -2221,9 +2224,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt 
)
 if (isTiledRendering && pViewShell &&
 (pViewShell->isLOKMobilePhone() || 
pViewShell->isLOKTablet()))
 {
-Point aPos = rMEvt.GetPosPixel();
-SCCOL nPosX;
-SCROW nPosY;
+aPos = rMEvt.GetPosPixel();
 mrViewData.GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, 
nPosX, nPosY );
 auto pForTabView = dynamic_cast(pViewShell);
 OString aCursor = 
pForTabView->GetViewData().describeCellCursorAt(nPosX, nPosY);
@@ -2276,10 +2277,8 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& 
rMEvt )
 uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents = 
rDoc.GetVbaEventProcessor();
 if( xVbaEvents.is() ) try
 {
-Point aPos = rMEvt.GetPosPixel();
-SCCOL nPosX;
-SCROW nPosY;
-SCTAB nTab = mrViewData.GetTabNo();
+aPos = rMEvt.GetPosPixel();
+nTab = mrViewData.GetTabNo();
 mrViewData.GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, 
nPosY );
 OUString sURL;
 ScRefCellValue aCell;
commit 2a0a670a7bae450bd9d783c7def3d3641647404d
Author: Szymon Kłos 
AuthorDate: Mon Dec 7 08:39:54 2020 +0100
Commit: Szymon Kłos 
CommitDate: Wed Dec 9 14:08:50 2020 +0100

jsdialog: dump all columns in treeview

Change-Id: Ia3fbf1c87b49e367c2ff077eee7734540e96b50b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107333
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107463
Tested-by: Jenkins

diff --git a/include/vcl/toolkit/svtabbx.hxx b/include/vcl/toolkit/svtabbx.hxx
index 971ef5eb4047..38c1b18d50d1 100644
--- a/include/vcl/toolkit/svtabbx.hxx
+++ b/include/vcl/toolkit/svtabbx.hxx
@@ -213,6 +213,8 @@ public:
 
 virtual tools::RectangleGetFieldCharacterBounds(sal_Int32 
_nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex) override;
 virtual sal_Int32   GetFieldIndexAtPoint(sal_Int32 
_nRow,sal_Int32 _nColumnPos,const Point& _rPoint) override;
+
+  

[Libreoffice-commits] core.git: 2 commits - include/vcl sc/source vcl/source

2019-01-14 Thread Libreoffice Gerrit user
 include/vcl/gdimtf.hxx|2 +-
 sc/source/ui/docshell/docfunc.cxx |4 ++--
 vcl/source/gdi/gdimtf.cxx |4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 99ccad6fa5eab2e69fa8c43db3b27b8c02ad8217
Author: Arkadiy Illarionov 
AuthorDate: Sat Jan 12 18:20:51 2019 +0300
Commit: Noel Grandin 
CommitDate: Mon Jan 14 16:40:02 2019 +0100

Fix loop conditions

2b88f6d32f572792597ccbb15276b9db52db7d10 follow-up

Change-Id: I3b525506ee222c80ff04ea38eec90a581c928985
Reviewed-on: https://gerrit.libreoffice.org/66216
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/source/ui/docshell/docfunc.cxx 
b/sc/source/ui/docshell/docfunc.cxx
index ef9fe0137e6a..bfea212bd7cc 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -1827,7 +1827,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const 
ScMarkData* pTabMark,
 std::unique_ptr pUndoRemoveMerge;
 
 itr = aMark.begin();
-for (; itr != itrEnd && nTabCount; ++itr)
+for (; itr != itrEnd && *itr < nTabCount; ++itr)
 {
 i = *itr;
 if( rDoc.HasAttrib( nMergeTestStartCol, nMergeTestStartRow, i, 
nMergeTestEndCol, nMergeTestEndRow, i, HasAttrFlags::Merged | 
HasAttrFlags::Overlapped ) )
@@ -4730,7 +4730,7 @@ bool ScDocFunc::FillAuto( ScRange& rRange, const 
ScMarkData* pTabMark, FillDir e
 pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
 pUndoDoc->InitUndo( , nDestStartTab, nDestStartTab );
 ScMarkData::iterator itr = aMark.begin(), itrEnd = aMark.end();
-for (; itr != itrEnd && nTabCount; ++itr)
+for (; itr != itrEnd && *itr < nTabCount; ++itr)
 if (*itr != nDestStartTab)
 pUndoDoc->AddUndoTab( *itr, *itr );
 
commit 0bb77f2161e8bcaf42c536a859c2095a3f03428a
Author: Muhammet Kara 
AuthorDate: Mon Jan 14 10:27:40 2019 +0300
Commit: Noel Grandin 
CommitDate: Mon Jan 14 16:39:53 2019 +0100

Add fileName to GDIMetaFile::dumpAsXml()

GDIMetaFile::dumpAsXml() is very useful while investigating/examining
the meta files, but it overwrites with the same file name each time.
To be able to get different dumps at the same time, let's add
a fileName parameter to it.

Change-Id: I993720b460f326cd65519556cf1e902591d90d42
Reviewed-on: https://gerrit.libreoffice.org/66283
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/vcl/gdimtf.hxx b/include/vcl/gdimtf.hxx
index 59d4f0939076..9b43cd2f6ef8 100644
--- a/include/vcl/gdimtf.hxx
+++ b/include/vcl/gdimtf.hxx
@@ -199,7 +199,7 @@ public:
 boolGetUseCanvas() const { return m_bUseCanvas; }
 
 /// Dumps the meta actions as XML in metafile.xml.
-void dumpAsXml() const;
+void dumpAsXml( const OUString& sFileName = OUString() ) const;
 };
 
 #endif // INCLUDED_VCL_GDIMTF_HXX
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index db292eebb298..7038fb7c5244 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -2835,9 +2835,9 @@ void GDIMetaFile::UseCanvas( bool _bUseCanvas )
 m_bUseCanvas = _bUseCanvas;
 }
 
-void GDIMetaFile::dumpAsXml() const
+void GDIMetaFile::dumpAsXml( const OUString& sFileName ) const
 {
-SvFileStream aStream("metafile.xml", StreamMode::STD_READWRITE | 
StreamMode::TRUNC);
+SvFileStream aStream(sFileName.isEmpty() ? "metafile.xml" : sFileName, 
StreamMode::STD_READWRITE | StreamMode::TRUNC);
 MetafileXmlDump aDumper;
 aDumper.dump(*this, aStream);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits