[Libreoffice-commits] core.git: svx/source sw/qa vcl/source

2023-04-15 Thread Andreas Heinisch (via logerrit)
 svx/source/inc/findtextfield.hxx   |3 ++
 svx/source/tbxctrls/tbunosearchcontrollers.cxx |   12 +---
 sw/qa/uitest/findBar/tdf154269.py  |   36 +
 vcl/source/uitest/uiobject.cxx |1 
 4 files changed, 48 insertions(+), 4 deletions(-)

New commits:
commit b8349ca053753bb0dc713933628a1575a70677d3
Author: Andreas Heinisch 
AuthorDate: Wed Apr 12 12:13:17 2023 +0200
Commit: Andreas Heinisch 
CommitDate: Sat Apr 15 11:33:08 2023 +0200

tdf#154269 - Respect FindReplaceRememberedSearches expert option in quick 
find

Change-Id: I88c1bed647bf6f77953ccd9921e515c1246fa96f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150273
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch 

diff --git a/svx/source/inc/findtextfield.hxx b/svx/source/inc/findtextfield.hxx
index eb1b6cc11ee5..8cfa98f03242 100644
--- a/svx/source/inc/findtextfield.hxx
+++ b/svx/source/inc/findtextfield.hxx
@@ -64,6 +64,9 @@ private:
 
 void FocusIn();
 void ActivateFind(bool bShift);
+
+// tdf#154269 - respect FindReplaceRememberedSearches expert option
+sal_uInt16 m_nRememberSize;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx 
b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index 304eb8123c56..9611f4d686c0 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -24,6 +24,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -73,8 +74,6 @@ constexpr OUStringLiteral COMMAND_FINDALL = u".uno:FindAll";
 constexpr OUStringLiteral COMMAND_MATCHCASE = u".uno:MatchCase";
 constexpr OUStringLiteral COMMAND_SEARCHFORMATTED = 
u".uno:SearchFormattedDisplayString";
 
-const sal_Int32   REMEMBER_SIZE = 10;
-
 class CheckButtonItemWindow final : public InterimItemWindow
 {
 public:
@@ -214,6 +213,11 @@ FindTextFieldControl::FindTextFieldControl( vcl::Window* 
pParent,
 
 m_xWidget->set_size_request(250, -1);
 SetSizePixel(m_xWidget->get_preferred_size());
+
+// tdf#154269 - respect FindReplaceRememberedSearches expert option
+m_nRememberSize = 
officecfg::Office::Common::Misc::FindReplaceRememberedSearches::get();
+if (m_nRememberSize < 1)
+m_nRememberSize = 1;
 }
 
 void FindTextFieldControl::Remember_Impl(const OUString& rStr)
@@ -226,8 +230,8 @@ void FindTextFieldControl::Remember_Impl(const OUString& 
rStr)
 return;
 }
 
-if (nCount == REMEMBER_SIZE)
-m_xWidget->remove(REMEMBER_SIZE-1);
+if (nCount == m_nRememberSize)
+m_xWidget->remove(m_nRememberSize - 1);
 
 m_xWidget->insert_text(0, rStr);
 }
diff --git a/sw/qa/uitest/findBar/tdf154269.py 
b/sw/qa/uitest/findBar/tdf154269.py
new file mode 100755
index ..d5752093b2b6
--- /dev/null
+++ b/sw/qa/uitest/findBar/tdf154269.py
@@ -0,0 +1,36 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-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/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_state_as_dict
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+class tdf154269(UITestCase):
+
+def test_tdf154269(self):
+
+with self.ui_test.create_doc_in_start_center("writer"):
+# Open quick search
+self.xUITest.executeCommand("vnd.sun.star.findbar:FocusToFindbar")
+xWriterDoc = self.xUITest.getTopFocusWindow()
+xFind = xWriterDoc.getChild("find")
+
+# Generate a search history with more than 10 entries (A to Z)
+for searchTerm in map(chr, range(65, 91)):
+# Search twice to generate a search history
+xFind.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"CTRL+A"}))
+xFind.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"BACKSPACE"}))
+xFind.executeAction("TYPE", mkPropertyValues({"TEXT": 
searchTerm}))
+xFind.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"RETURN"}))
+xFind.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"ESC"}))
+
self.xUITest.executeCommand("vnd.sun.star.findbar:FocusToFindbar")
+
+# The default value of FindReplaceRememberedSearches has been 
respected
+self.assertEqual("10", get_state_as_dict(xFind)["EntryCount"])
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index 38079425a41d..623591e7e218 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -1224,6 +1224,7 @@ StringMap ComboBoxUIObject::get_state()
 {
 StringMap aMap = 

[Libreoffice-commits] core.git: svx/source sw/qa vcl/source

2013-03-13 Thread Armin Le Grand
 svx/source/svdraw/svdfmtf.cxx|  174 +++
 svx/source/svdraw/svdfmtf.hxx|   20 ++-
 svx/source/svdraw/svdxcgv.cxx|   32 ++---
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |2 
 vcl/source/gdi/metaact.cxx   |3 
 vcl/source/gdi/outdev6.cxx   |3 
 vcl/source/gdi/outmap.cxx|   11 +
 7 files changed, 180 insertions(+), 65 deletions(-)

New commits:
commit 684c502ed0a6782fe1b9c7d7cd1911a4a88b543a
Author: Armin Le Grand a...@apache.org
Date:   Tue May 8 08:27:10 2012 +

Related: #119125# Added usage of the ClipRegion for dismantling Metafiles

to SdrObjects (ImpSdrGDIMetaFileImport) as good as possible with Metafile 
usage

Conflicts:
svx/source/svdraw/svdfmtf.cxx
svx/source/svdraw/svdfmtf.hxx

Change-Id: I41422696e97f919e618f7e385c68d4ac737a52c1

diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx
index 7e38fc6..1d9b948 100644
--- a/svx/source/svdraw/svdfmtf.cxx
+++ b/svx/source/svdraw/svdfmtf.cxx
@@ -61,6 +61,8 @@
 #include basegfx/matrix/b2dhommatrixtools.hxx
 #include svx/xlinjoit.hxx
 #include svx/xlndsit.hxx
+#include basegfx/polygon/b2dpolygonclipper.hxx
+#include svx/xbtmpit.hxx
 
 

 
@@ -74,7 +76,11 @@ ImpSdrGDIMetaFileImport::ImpSdrGDIMetaFileImport(SdrModel 
rModel):
 maDash(XDASH_RECT, 0, 0, 0, 0, 0),
 fScaleX(0.0),fScaleY(0.0),
 bFntDirty(sal_True),
-
bLastObjWasPolyWithoutLine(sal_False),bNoLine(sal_False),bNoFill(sal_False),bLastObjWasLine(sal_False)
+bLastObjWasPolyWithoutLine(sal_False),
+bNoLine(sal_False),
+bNoFill(sal_False),
+bLastObjWasLine(sal_False),
+maClip()
 {
 aVD.EnableOutput(sal_False);
 
@@ -87,6 +93,7 @@ ImpSdrGDIMetaFileImport::ImpSdrGDIMetaFileImport(SdrModel 
rModel):
 pFillAttr=new 
SfxItemSet(rModel.GetItemPool(),XATTR_FILL_FIRST,XATTR_FILL_LAST);
 pTextAttr=new SfxItemSet(rModel.GetItemPool(),EE_ITEMS_START,EE_ITEMS_END);
 pModel=rModel;
+checkClip();
 }
 
 ImpSdrGDIMetaFileImport::~ImpSdrGDIMetaFileImport()
@@ -371,7 +378,7 @@ void ImpSdrGDIMetaFileImport::SetAttributes(SdrObject* 
pObj, bool bForceTextAttr
 }
 }
 
-void ImpSdrGDIMetaFileImport::InsertObj( SdrObject* pObj, sal_Bool bScale )
+void ImpSdrGDIMetaFileImport::InsertObj(SdrObject* pObj, sal_Bool bScale)
 {
 if ( bScale  !aScaleRect.IsEmpty() )
 {
@@ -381,60 +388,123 @@ void ImpSdrGDIMetaFileImport::InsertObj( SdrObject* 
pObj, sal_Bool bScale )
 pObj-NbcMove( Size( aOfs.X(), aOfs.Y() ) );
 }
 
-// #i111954# check object for visibility
-// used are SdrPathObj, SdrRectObj, SdrCircObj, SdrGrafObj
-bool bVisible(false);
-
-if(pObj-HasLineStyle())
+if(isClip())
 {
-bVisible = true;
-}
+const basegfx::B2DPolyPolygon aPoly(pObj-TakeXorPoly());
+const basegfx::B2DRange aOldRange(aPoly.getB2DRange());
+const SdrLayerID aOldLayer(pObj-GetLayer());
+const SfxItemSet aOldItemSet(pObj-GetMergedItemSet());
+const SdrGrafObj* pSdrGrafObj = dynamic_cast SdrGrafObj* (pObj);
+BitmapEx aBitmapEx;
+
+if(pSdrGrafObj)
+{
+aBitmapEx = pSdrGrafObj-GetGraphic().GetBitmapEx();
+}
 
-if(!bVisible  pObj-HasFillStyle())
-{
-bVisible = true;
+SdrObject::Free(pObj);
+
+if(!aOldRange.isEmpty())
+{
+// clip against ClipRegion
+const basegfx::B2DPolyPolygon aNewPoly(
+basegfx::tools::clipPolyPolygonOnPolyPolygon(
+aPoly,
+maClip,
+true,
+aPoly.isClosed() ? false : true));
+const basegfx::B2DRange aNewRange(aNewPoly.getB2DRange());
+
+if(!aNewRange.isEmpty())
+{
+pObj = new SdrPathObj(
+aNewPoly.isClosed() ? OBJ_POLY : OBJ_PLIN,
+aNewPoly);
+
+pObj-SetLayer(aOldLayer);
+pObj-SetMergedItemSet(aOldItemSet);
+
+if(!!aBitmapEx)
+{
+// aNewRange is inside of aOldRange and defines which part 
of aBitmapEx is used
+const double fLclScaleX(aBitmapEx.GetSizePixel().Width() / 
(aOldRange.getWidth() ? aOldRange.getWidth() : 1.0));
+const double fLclScaleY(aBitmapEx.GetSizePixel().Height() 
/ (aOldRange.getHeight() ? aOldRange.getHeight() : 1.0));
+basegfx::B2DRange aPixel(aNewRange);
+basegfx::B2DHomMatrix aTrans;
+
+aTrans.translate(-aOldRange.getMinX(), 
-aOldRange.getMinY());
+aTrans.scale(fLclScaleX, fLclScaleY);
+aPixel.transform(aTrans);
+
+const BitmapEx aClippedBitmap(
+