[Libreoffice-commits] core.git: include/svx sc/qa svx/source

2022-03-14 Thread Szymon Kłos (via logerrit)
 include/svx/svdedtv.hxx  |2 -
 sc/qa/unit/tiledrendering/tiledrendering.cxx |   31 ++-
 svx/source/svdraw/svdedtv.cxx|7 +++---
 3 files changed, 35 insertions(+), 5 deletions(-)

New commits:
commit 7fced7bbd0d6d7769dcf13ab326c793d4096a247
Author: Szymon Kłos 
AuthorDate: Wed Mar 9 16:41:36 2022 +0100
Commit: Szymon Kłos 
CommitDate: Mon Mar 14 16:04:48 2022 +0100

svx: don't remove object right after insertion

This is regression from:
commit 2d95b3846eac367d2baadc194ab258dc31e7bd33
Author: Tomaz Vajngerl 
Date:   Thu Oct 7 16:48:46 2021 +0200

svx: Don't end text edit mode for all views

It was visible with "direct insertion" where user doesn't
need to draw anything but textbox is inserted in the center
of a screen (eg. used in LOK case)

Object was inserted into a view and right after that was removed when
EndTextEditCurrentView was called

Change-Id: I9943d46746aabadf96d76d6e74770b56d648b79d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131263
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Mert Tumer 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131537
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/include/svx/svdedtv.hxx b/include/svx/svdedtv.hxx
index 6f80c3aca0fa..d2c9b3816f6a 100644
--- a/include/svx/svdedtv.hxx
+++ b/include/svx/svdedtv.hxx
@@ -188,7 +188,7 @@ public:
  * Checks if this or other views have an active text edit, if true, end 
them.
  */
 void EndTextEditAllViews() const;
-void EndTextEditCurrentView();
+void EndTextEditCurrentView(bool bDontDeleteReally = false);
 
 std::vector< std::unique_ptr > CreateConnectorUndo( const 
SdrObject& rO );
 void AddUndoActions( std::vector< std::unique_ptr > );
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx 
b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 5b84eef452b9..04c22438f74b 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -121,6 +121,7 @@ public:
 void testEditCursorBounds();
 void testTextSelectionBounds();
 void testSheetViewDataCrash();
+void testTextBoxInsert();
 
 CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
 CPPUNIT_TEST(testRowColumnHeaders);
@@ -175,6 +176,7 @@ public:
 CPPUNIT_TEST(testEditCursorBounds);
 CPPUNIT_TEST(testTextSelectionBounds);
 CPPUNIT_TEST(testSheetViewDataCrash);
+CPPUNIT_TEST(testTextBoxInsert);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -456,7 +458,12 @@ struct EditCursorMessage final {
 std::stringstream aStream(pMessage);
 boost::property_tree::ptree aTree;
 boost::property_tree::read_json(aStream, aTree);
-std::string aVal = 
aTree.get_child("refpoint").get_value();
+std::string aVal;
+boost::property_tree::ptree::const_assoc_iterator it = 
aTree.find("refpoint");
+if (it != aTree.not_found())
+aVal = aTree.get_child("refpoint").get_value();
+else
+return; // happens in testTextBoxInsert test
 
 uno::Sequence aSeq = 
comphelper::string::convertCommaSeparated(OUString::createFromAscii(aVal.c_str()));
 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aSeq.getLength());
@@ -2783,6 +2790,28 @@ void ScTiledRenderingTest::testSheetViewDataCrash()
 Scheduler::ProcessEventsToIdle();
 }
 
+void ScTiledRenderingTest::testTextBoxInsert()
+{
+comphelper::LibreOfficeKit::setActive();
+
+createDoc("empty.ods");
+ViewCallback aView1;
+
+// insert textbox
+uno::Sequence aArgs(
+comphelper::InitPropertySequence({
+{ "CreateDirectly",  uno::Any(true) }
+}));
+comphelper::dispatchCommand(".uno:DrawText", aArgs);
+Scheduler::ProcessEventsToIdle();
+
+// check if we have textbox selected
+CPPUNIT_ASSERT(!aView1.m_ShapeSelection.isEmpty());
+CPPUNIT_ASSERT(aView1.m_ShapeSelection != "EMPTY");
+
+Scheduler::ProcessEventsToIdle();
+}
+
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest);
diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx
index c59b1e6be864..df42a3d78dea 100644
--- a/svx/source/svdraw/svdedtv.cxx
+++ b/svx/source/svdraw/svdedtv.cxx
@@ -1008,7 +1008,8 @@ bool SdrEditView::InsertObjectAtView(SdrObject* pObj, 
SdrPageView& rPV, SdrInser
 }
 if( IsUndoEnabled())
 {
-EndTextEditCurrentView();
+bool bDontDeleteReally = true;
+EndTextEditCurrentView(bDontDeleteReally);
 AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pObj));
 }
 
@@ -1088,13 +1089,13 @@ void SdrEditView::EndTextEditAllViews() const
 }
 }
 
-void SdrEditView::EndTextEditCurrentView()
+void SdrEditView::EndTextEditCurrentView(bool bDontDeleteReally)
 {
 if (IsTextEdit())
 {
 SdrView* pSdrView = dynamic_cast(this);
 if (pSdrView)
-

[Libreoffice-commits] core.git: include/svx sc/qa svx/source

2021-10-09 Thread Bayram Çiçek (via logerrit)
 include/svx/strings.hrc  |   40 +-
 sc/qa/unit/ucalc.cxx |   50 ++--
 svx/source/tbxctrls/tbcontrl.cxx |  156 +++
 3 files changed, 106 insertions(+), 140 deletions(-)

New commits:
commit ce1902d3964414f5abf5a07ec43c19641c8752f0
Author: Bayram Çiçek 
AuthorDate: Thu Aug 26 16:07:37 2021 +0300
Commit: Heiko Tietze 
CommitDate: Sat Oct 9 08:22:17 2021 +0200

Rename strings and change criss-cross border icon

regarding 3a9167e1b8a236da2862f4377e2040a8c189c99c
'tdf#143919: Calc: add diagonal borders in Toolbar>Borders'

- criss-cross border icon replaced with a new one
- rename -> 'diagonal left' to 'diagonal down'
- rename -> 'diagonal right' to 'diagonal up'
- code refactoring: large if-else blocks refactored
as methods and called from proper cases
- clang-format
- "Set" word dropped from include/svx/strings.hrc

Change-Id: I1284e69b9481e1a512f7cab29913bf23b6a493c7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121117
Tested-by: Jenkins
Reviewed-by: Heiko Tietze 

diff --git a/include/svx/strings.hrc b/include/svx/strings.hrc
index 1b30c31fa1a0..0091b44b 100644
--- a/include/svx/strings.hrc
+++ b/include/svx/strings.hrc
@@ -1774,26 +1774,26 @@
 
 
 // strings related to borders
-#define RID_SVXSTR_TABLE_PRESET_NONE
NC_("RID_SVXSTR_TABLE_PRESET_NONE", "Set No Borders")
-#define RID_SVXSTR_TABLE_PRESET_ONLYOUTER   
NC_("RID_SVXSTR_TABLE_PRESET_ONLYOUTER", "Set Outer Border Only")
-#define RID_SVXSTR_TABLE_PRESET_OUTERHORI   
NC_("RID_SVXSTR_TABLE_PRESET_OUTERHORI", "Set Outer Border and Horizontal 
Lines")
-#define RID_SVXSTR_TABLE_PRESET_OUTERALL
NC_("RID_SVXSTR_TABLE_PRESET_OUTERALL", "Set Outer Border and All Inner Lines")
-#define RID_SVXSTR_TABLE_PRESET_OUTERVERI   
NC_("RID_SVXSTR_TABLE_PRESET_OUTERVERI", "Set Outer Border and Vertical Lines")
-#define RID_SVXSTR_TABLE_PRESET_OUTERINNER  
NC_("RID_SVXSTR_TABLE_PRESET_OUTERINNER", "Set Outer Border Without Changing 
Inner Lines")
-#define RID_SVXSTR_PARA_PRESET_DIAGONAL 
NC_("RID_SVXSTR_PARA_PRESET_DIAGONAL", "Set Diagonal Lines Only")
-#define RID_SVXSTR_PARA_PRESET_DIAGONALLEFT 
NC_("RID_SVXSTR_PARA_PRESET_DIAGONALLEFT", "Set Diagonal Left Border")
-#define RID_SVXSTR_PARA_PRESET_DIAGONALRIGHT
NC_("RID_SVXSTR_PARA_PRESET_DIAGONALRIGHT", "Set Diagonal Right Border")
-#define RID_SVXSTR_PARA_PRESET_CRISSCROSS   
NC_("RID_SVXSTR_PARA_PRESET_CRISSCROSS", "Set Criss-Cross Border")
-#define RID_SVXSTR_PARA_PRESET_ALL  
NC_("RID_SVXSTR_PARA_PRESET_ALL", "Set All Four Borders")
-#define RID_SVXSTR_PARA_PRESET_LEFTRIGHT
NC_("RID_SVXSTR_PARA_PRESET_LEFTRIGHT", "Set Left and Right Borders Only")
-#define RID_SVXSTR_PARA_PRESET_TOPBOTTOM
NC_("RID_SVXSTR_PARA_PRESET_TOPBOTTOM", "Set Top and Bottom Borders Only")
-#define RID_SVXSTR_PARA_PRESET_TOPBOTTOMHORI
NC_("RID_SVXSTR_PARA_PRESET_TOPBOTTOMHORI", "Set Top and Bottom Borders, and 
All Horizontal Lines")
-#define RID_SVXSTR_PARA_PRESET_ONLYLEFT 
NC_("RID_SVXSTR_PARA_PRESET_ONLYLEFT", "Set Left Border Only")
-#define RID_SVXSTR_PARA_PRESET_ONLYRIGHT
NC_("RID_SVXSTR_PARA_PRESET_ONLYRIGHT", "Set Right Border Only")
-#define RID_SVXSTR_PARA_PRESET_ONLYTOP  
NC_("RID_SVXSTR_PARA_PRESET_ONLYTOP", "Set Top Border Only")
-#define RID_SVXSTR_PARA_PRESET_ONLYTBOTTOM  
NC_("RID_SVXSTR_PARA_PRESET_ONLYTBOTTOM", "Set Bottom Border Only")
-#define RID_SVXSTR_HOR_PRESET_ONLYHOR   
NC_("RID_SVXSTR_HOR_PRESET_ONLYHOR", "Set Top and Bottom Borders, and All Inner 
Lines")
-#define RID_SVXSTR_VER_PRESET_ONLYVER   
NC_("RID_SVXSTR_VER_PRESET_ONLYVER", "Set Left and Right Borders, and All Inner 
Lines")
+#define RID_SVXSTR_TABLE_PRESET_NONE
NC_("RID_SVXSTR_TABLE_PRESET_NONE", "No Borders")
+#define RID_SVXSTR_TABLE_PRESET_ONLYOUTER   
NC_("RID_SVXSTR_TABLE_PRESET_ONLYOUTER", "Outer Border Only")
+#define RID_SVXSTR_TABLE_PRESET_OUTERHORI   
NC_("RID_SVXSTR_TABLE_PRESET_OUTERHORI", "Outer Border and Horizontal Lines")
+#define RID_SVXSTR_TABLE_PRESET_OUTERALL
NC_("RID_SVXSTR_TABLE_PRESET_OUTERALL", "Outer Border and All Inner Lines")
+#define RID_SVXSTR_TABLE_PRESET_OUTERVERI   
NC_("RID_SVXSTR_TABLE_PRESET_OUTERVERI", "Outer Border and Vertical Lines")
+#define RID_SVXSTR_TABLE_PRESET_OUTERINNER  
NC_("RID_SVXSTR_TABLE_PRESET_OUTERINNER", "Outer Border Without Changing Inner 
Lines")
+#define RID_SVXSTR_PARA_PRESET_DIAGONAL 
NC_("RID_SVXSTR_PARA_PRESET_DIAGONAL", "Diagonal Lines Only")
+#define RID_SVXSTR_PARA_PRESET_DIAGONALDOWN 
NC_("RID_SVXSTR_PARA_PRESET_DIAGONALDOWN", "Diagonal Down Border")
+#define RID_SVXSTR_PARA_PRESET_DIAGONALUP   
NC_("RID_SVXSTR_PARA_PRESET_DIAGONALUP", 

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

2020-06-10 Thread Shiko (via logerrit)
 include/svx/SvxColorValueSet.hxx   |2 
 include/svx/uiobject.hxx   |   24 +
 sc/qa/uitest/calc_tests/cellBackgroundColorSelector.py |  209 +
 svx/source/tbxctrls/SvxColorValueSet.cxx   |7 
 svx/source/uitest/sdrobject.cxx|   56 
 vcl/source/uitest/uiobject.cxx |7 
 6 files changed, 304 insertions(+), 1 deletion(-)

New commits:
commit c36ac492c2413bdd894715dd8c89127d3498e45e
Author: Shiko 
AuthorDate: Sun Jun 7 14:23:37 2020 +0200
Commit: Ahmed ElShreif 
CommitDate: Wed Jun 10 16:08:33 2020 +0200

uitest: Add support for Calc / Format cell /  background color selector

- Add wrapper for the color-win set
- Add the factory function in the correct class
- Add a demo for cell background color and recent color selector
- Extend the ability of ComboBoxUIObject to be able to select with text

Change-Id: Ie84ba7fff2f84c3fec7f5adbb5b1cdc6c80729f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95667
Tested-by: Jenkins
Reviewed-by: Ahmed ElShreif 

diff --git a/include/svx/SvxColorValueSet.hxx b/include/svx/SvxColorValueSet.hxx
index 143627ffedb1..82792acf64f4 100644
--- a/include/svx/SvxColorValueSet.hxx
+++ b/include/svx/SvxColorValueSet.hxx
@@ -40,6 +40,8 @@ public:
 void addEntriesForColorSet(const std::set& rColorSet, const 
OUString& rNamePrefix);
 Size layoutAllVisible(sal_uInt32 nEntryCount);
 Size layoutToGivenHeight(sal_uInt32 nHeight, sal_uInt32 nEntryCount);
+
+virtual FactoryFunction GetUITestFactory() const override;
 };
 
 #endif // INCLUDED_SVX_SVXCOLORVALUESET_HXX
diff --git a/include/svx/uiobject.hxx b/include/svx/uiobject.hxx
index ea40c2a6b9e7..de47586f74c9 100644
--- a/include/svx/uiobject.hxx
+++ b/include/svx/uiobject.hxx
@@ -12,9 +12,12 @@
 
 #include 
 
+#include 
+
 #include 
 
 class SdrObject;
+class SvxColorValueSet;
 
 class SVXCORE_DLLPUBLIC SdrUIObject : public UIObject
 {
@@ -32,6 +35,27 @@ public:
 virtual SdrObject* get_object() = 0;
 };
 
+class SvxColorValueSetUIObject final : public WindowUIObject
+{
+SvxColorValueSet* mpColorSet;
+
+public:
+
+SvxColorValueSetUIObject(vcl::Window*  xColorSetWin, SvxColorValueSet* 
pColorSet);
+
+virtual void execute(const OUString& rAction,
+const StringMap& rParameters) override;
+
+static std::unique_ptr create(vcl::Window* pWindow);
+
+virtual StringMap get_state() override;
+
+private:
+
+OUString get_name() const override;
+};
+
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/uitest/calc_tests/cellBackgroundColorSelector.py 
b/sc/qa/uitest/calc_tests/cellBackgroundColorSelector.py
new file mode 100644
index ..04675dac9cfd
--- /dev/null
+++ b/sc/qa/uitest/calc_tests/cellBackgroundColorSelector.py
@@ -0,0 +1,209 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# 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 uitest.uihelper.common import select_pos
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+class CalcCellBackgroundColorSelector(UITestCase):
+
+def test_color_selector(self):
+
+#This is to test color selection
+calc_doc = self.ui_test.create_doc_in_start_center("calc")
+xCalcDoc = self.xUITest.getTopFocusWindow()
+gridwin = xCalcDoc.getChild("grid_window")
+document = self.ui_test.get_component()
+#select cell A1
+gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+#format - cell
+self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
+xDialog = self.xUITest.getTopFocusWindow()
+xTabs = xDialog.getChild("tabcontrol")
+select_pos(xTabs, "6")  #tab Numbers
+# click on color btn
+xbtncolor = xDialog.getChild("btncolor")
+xbtncolor.executeAction("CLICK",tuple())
+xpaletteselector = xDialog.getChild("paletteselector")
+
+# Now we have the ColorPage that we can get the color selector from it
+xColorpage = xDialog.getChild("ColorPage")
+color_selector = xColorpage.getChild("colorset")
+
+# For chart-palettes colors
+xpaletteselector.executeAction("SELECT", mkPropertyValues({"TEXT": 
"chart-palettes"}))
+# Select Color with id 2
+color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "2"}))
+self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "2")
+self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], 
"1")
+