[Libreoffice-commits] core.git: sc/source sc/uiconfig

2020-10-11 Thread Tomofumi Yagi (via logerrit)
 sc/source/ui/dbgui/tpsubt.cxx   |   64 +---
 sc/source/ui/inc/tpsubt.hxx |2 +
 sc/uiconfig/scalc/ui/subtotalgrppage.ui |   14 +++
 3 files changed, 66 insertions(+), 14 deletions(-)

New commits:
commit e0c1fdcab23dbd2b7a0a7227557d7afc41b49bd7
Author: Tomofumi Yagi 
AuthorDate: Sat Oct 10 14:54:30 2020 +0900
Commit: Noel Grandin 
CommitDate: Sun Oct 11 11:45:35 2020 +0200

tdf#133886 - Libreoffice Calc Subtotals check all columns at once

"Select all columns" checkbox is added to the subtotal group page.

Change-Id: Iee5be3218ecb6d74c7c65b2bf49febf0703ebf35
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104135
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx
index 30133dce08ad..953c4cf50ff3 100644
--- a/sc/source/ui/dbgui/tpsubt.cxx
+++ b/sc/source/ui/dbgui/tpsubt.cxx
@@ -49,6 +49,7 @@ ScTpSubTotalGroup::ScTpSubTotalGroup(weld::Container* pPage, 
weld::DialogControl
 , mxLbGroup(m_xBuilder->weld_combo_box("group_by"))
 , mxLbColumns(m_xBuilder->weld_tree_view("columns"))
 , mxLbFunctions(m_xBuilder->weld_tree_view("functions"))
+, 
mxLbSelectAllColumns(m_xBuilder->weld_check_button("select_all_columns_button"))
 {
 for (size_t i = 0; i < SAL_N_ELEMENTS(SCSTR_SUBTOTALS); ++i)
 mxLbFunctions->append_text(ScResId(SCSTR_SUBTOTALS[i]));
@@ -80,11 +81,28 @@ void ScTpSubTotalGroup::Init()
 mxLbColumns->connect_changed( LINK( this, ScTpSubTotalGroup, 
SelectTreeListBoxHdl ) );
 mxLbColumns->connect_toggled( LINK( this, ScTpSubTotalGroup, CheckHdl ) );
 mxLbFunctions->connect_changed( LINK( this, ScTpSubTotalGroup, 
SelectTreeListBoxHdl) );
+mxLbSelectAllColumns->connect_clicked( LINK( this, ScTpSubTotalGroup, 
CheckBoxHdl ) );
 
 nFieldArr[0] = 0;
 FillListBoxes();
 }
 
+namespace
+{
+int GetCheckedEntryCount(weld::TreeView& rTreeView)
+{
+int nRet = 0;
+
+rTreeView.all_foreach([&](const weld::TreeIter& rEntry) {
+if ( rTreeView.get_toggle(rEntry) == TRISTATE_TRUE )
+++nRet;
+return false;
+});
+
+return nRet;
+}
+}
+
 bool ScTpSubTotalGroup::DoReset( sal_uInt16 nGroupNo,
  const SfxItemSet&  rArgSet  )
 {
@@ -139,21 +157,12 @@ bool ScTpSubTotalGroup::DoReset( sal_uInt16 
nGroupNo,
 mxLbFunctions->select( 0 );
 }
 
-return true;
-}
+if ( mxLbColumns->n_children() == GetCheckedEntryCount(*mxLbColumns) )
+mxLbSelectAllColumns->set_active( true );
+else
+mxLbSelectAllColumns->set_active( false );
 
-namespace
-{
-int GetCheckedEntryCount(const weld::TreeView& rTreeView)
-{
-int nRet = 0;
-for (sal_Int32 i=0, nEntryCount = rTreeView.n_children(); i < 
nEntryCount; ++i)
-{
-if (rTreeView.get_toggle(i) == TRISTATE_TRUE)
-++nRet;
-}
-return nRet;
-}
+return true;
 }
 
 bool ScTpSubTotalGroup::DoFillItemSet( sal_uInt16   nGroupNo,
@@ -335,6 +344,11 @@ sal_uInt16 ScTpSubTotalGroup::FuncToLbPos( ScSubTotalFunc 
eFunc )
 IMPL_LINK(ScTpSubTotalGroup, SelectTreeListBoxHdl, weld::TreeView&, rLb, void)
 {
 SelectHdl();
+
+if ( mxLbColumns->n_children() == GetCheckedEntryCount(*mxLbColumns) )
+mxLbSelectAllColumns->set_active( true );
+else
+mxLbSelectAllColumns->set_active( false );
 }
 
 IMPL_LINK(ScTpSubTotalGroup, SelectListBoxHdl, weld::ComboBox&, rLb, void)
@@ -366,6 +380,11 @@ IMPL_LINK( ScTpSubTotalGroup, CheckHdl, const 
weld::TreeView::iter_col&, rRowCol
 {
 mxLbColumns->select(rRowCol.first);
 SelectHdl(mxLbColumns.get());
+
+if ( mxLbColumns->n_children() == GetCheckedEntryCount(*mxLbColumns) )
+mxLbSelectAllColumns->set_active( true );
+else
+mxLbSelectAllColumns->set_active( false );
 }
 
 // Derived Group TabPages:
@@ -570,6 +589,23 @@ IMPL_LINK(ScTpSubTotalOptions, CheckHdl, weld::Button&, 
rBox, void)
 }
 }
 
+IMPL_LINK(ScTpSubTotalGroup, CheckBoxHdl, weld::Button&, rBox, void)
+{
+if ( == mxLbSelectAllColumns.get())
+{
+bool bChecked = mxLbSelectAllColumns->get_active();
+
+mxLbColumns->all_foreach([&](const weld::TreeIter& rEntry) {
+if ( bChecked )
+mxLbColumns->set_toggle(rEntry, TRISTATE_TRUE);
+else
+mxLbColumns->set_toggle(rEntry, TRISTATE_FALSE);
+
+return false;
+});
+}
+}
+
 ScTpSubTotalGroup1::~ScTpSubTotalGroup1()
 {
 }
diff --git a/sc/source/ui/inc/tpsubt.hxx b/sc/source/ui/inc/tpsubt.hxx
index d5a2ca023eed..93652127d026 100644
--- a/sc/source/ui/inc/tpsubt.hxx
+++ b/sc/source/ui/inc/tpsubt.hxx
@@ -57,6 +57,7 @@ protected:
 std::unique_ptr mxLbGroup;
 std::unique_ptr mxLbColumns;
 std::unique_ptr mxLbFunctions;
+std::unique_ptr 

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

2020-10-04 Thread Tomofumi Yagi (via logerrit)
 sc/source/ui/dbgui/scuiasciiopt.cxx |   41 +++-
 1 file changed, 22 insertions(+), 19 deletions(-)

New commits:
commit 2a338d521618333a0630a31b46fd0fc9decbe0e5
Author: Tomofumi Yagi 
AuthorDate: Sat Oct 3 19:16:43 2020 +0900
Commit: Mike Kaganski 
CommitDate: Sun Oct 4 13:23:34 2020 +0200

sc: ucsdet_detect may return nullptr

ucsdet_detect function needs a NULL checking of the return value.

"a UCharsetMatch representing the best matching charset, or NULL if no 
charset
matches the byte data."

Change-Id: I7e9a4b03ffd3c5e3f4953c2c7964dc67a53c39b5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103890
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx 
b/sc/source/ui/dbgui/scuiasciiopt.cxx
index bfc154bffc08..be524ab15437 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -394,28 +394,31 @@ ScImportAsciiDlg::ScImportAsciiDlg(weld::Window* pParent, 
const OUString& aDatNa
 UErrorCode uerr = U_ZERO_ERROR;
 UCharsetDetector* ucd = ucsdet_open(  );
 ucsdet_setText( ucd, reinterpret_cast(bytes), nRead, 
 );
-const UCharsetMatch* match = ucsdet_detect( ucd,  );
-const char* pEncodingName = ucsdet_getName( match,  );
 
-if ( U_SUCCESS(uerr) && !strcmp("UTF-8", pEncodingName) )
+if ( const UCharsetMatch* match = ucsdet_detect(ucd, ) )
 {
-ePreselectUnicode = RTL_TEXTENCODING_UTF8; // UTF-8
-mpDatStream->StartReadingUnicodeText( RTL_TEXTENCODING_UTF8 );
+const char* pEncodingName = ucsdet_getName( match,  );
+
+if ( U_SUCCESS(uerr) && !strcmp("UTF-8", pEncodingName) )
+{
+ePreselectUnicode = RTL_TEXTENCODING_UTF8; // UTF-8
+mpDatStream->StartReadingUnicodeText( 
RTL_TEXTENCODING_UTF8 );
+}
+else if ( U_SUCCESS(uerr) && !strcmp("UTF-16LE", 
pEncodingName) )
+{
+ePreselectUnicode = RTL_TEXTENCODING_UNICODE; // UTF-16LE
+mpDatStream->SetEndian( SvStreamEndian::LITTLE );
+mpDatStream->StartReadingUnicodeText( 
RTL_TEXTENCODING_UNICODE );
+}
+else if ( U_SUCCESS(uerr) && !strcmp("UTF-16BE", 
pEncodingName) )
+{
+ePreselectUnicode = RTL_TEXTENCODING_UNICODE; // UTF-16BE
+mpDatStream->SetEndian( SvStreamEndian::BIG );
+mpDatStream->StartReadingUnicodeText( 
RTL_TEXTENCODING_UNICODE );
+}
+else // other
+mpDatStream->StartReadingUnicodeText( 
RTL_TEXTENCODING_DONTKNOW );
 }
-else if ( U_SUCCESS(uerr) && !strcmp("UTF-16LE", pEncodingName) )
-{
-ePreselectUnicode = RTL_TEXTENCODING_UNICODE; // UTF-16LE
-mpDatStream->SetEndian( SvStreamEndian::LITTLE );
-mpDatStream->StartReadingUnicodeText( RTL_TEXTENCODING_UNICODE 
);
-}
-else if ( U_SUCCESS(uerr) && !strcmp("UTF-16BE", pEncodingName) )
-{
-ePreselectUnicode = RTL_TEXTENCODING_UNICODE; // UTF-16BE
-mpDatStream->SetEndian(SvStreamEndian::BIG);
-mpDatStream->StartReadingUnicodeText( RTL_TEXTENCODING_UNICODE 
);
-}
-else // other
-mpDatStream->StartReadingUnicodeText( 
RTL_TEXTENCODING_DONTKNOW );
 
 ucsdet_close( ucd );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/CppunitTest_sw_txtimport.mk sw/CppunitTest_sw_uwriter.mk sw/Library_sw.mk sw/Module_sw.mk sw/qa sw/source

2020-09-30 Thread Tomofumi Yagi (via logerrit)
 sw/CppunitTest_sw_txtimport.mk|   63 
 sw/CppunitTest_sw_uwriter.mk  |2 
 sw/Library_sw.mk  |1 
 sw/Module_sw.mk   |1 
 sw/qa/extras/txtexport/txtexport.cxx  |   97 ++---
 sw/qa/extras/txtimport/data/UTF16BEWITHBOM.txt|binary
 sw/qa/extras/txtimport/data/UTF16BEWITHOUTBOM.txt |binary
 sw/qa/extras/txtimport/data/UTF16LEWITHBOM.txt|binary
 sw/qa/extras/txtimport/data/UTF16LEWITHOUTBOM.txt |binary
 sw/qa/extras/txtimport/data/UTF8WITHBOM.txt   |2 
 sw/qa/extras/txtimport/data/UTF8WITHOUTBOM.txt|2 
 sw/qa/extras/txtimport/data/bullets.odt   |binary
 sw/qa/extras/txtimport/txtimport.cxx  |  155 ++
 sw/source/filter/basflt/iodetect.cxx  |   27 +++
 14 files changed, 269 insertions(+), 81 deletions(-)

New commits:
commit ef77a256de527f6d00212839e55f949024f2e7bc
Author: Tomofumi Yagi 
AuthorDate: Wed Sep 16 18:11:22 2020 +0900
Commit: Michael Stahl 
CommitDate: Wed Sep 30 10:18:23 2020 +0200

tdf#60145 sw: fix UTF-8 encoding without BOM is not detected

Writer can now detect Unicode type even if importing text file does not
have a BOM.

Change-Id: I70fa4145672d855f9ef9df040a930ff5d1564905
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102884
Tested-by: Jenkins
Reviewed-by: Eike Rathke 
Reviewed-by: Michael Stahl 

diff --git a/sw/CppunitTest_sw_txtimport.mk b/sw/CppunitTest_sw_txtimport.mk
new file mode 100644
index ..646a2ea83391
--- /dev/null
+++ b/sw/CppunitTest_sw_txtimport.mk
@@ -0,0 +1,63 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*
+#
+# 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/.
+#
+#*
+
+$(eval $(call gb_CppunitTest_CppunitTest,sw_txtimport))
+
+$(eval $(call gb_CppunitTest_use_common_precompiled_header,sw_txtimport))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sw_txtimport, \
+sw/qa/extras/txtimport/txtimport \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sw_txtimport, \
+comphelper \
+cppu \
+cppuhelper \
+i18nlangtag \
+sal \
+sfx \
+sw \
+   swqahelper \
+test \
+tl \
+unotest \
+utl \
+vcl \
+$(gb_UWINAPI) \
+))
+
+$(eval $(call gb_CppunitTest_use_externals,sw_txtimport,\
+boost_headers \
+libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sw_txtimport,\
+-I$(SRCDIR)/sw/inc \
+-I$(SRCDIR)/sw/source/core/inc \
+-I$(SRCDIR)/sw/source/uibase/inc \
+-I$(SRCDIR)/sw/qa/inc \
+$$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,sw_txtimport,\
+   udkapi \
+   offapi \
+   oovbaapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,sw_txtimport))
+$(eval $(call gb_CppunitTest_use_vcl,sw_txtimport))
+
+$(eval $(call gb_CppunitTest_use_rdb,sw_txtimport,services))
+
+$(eval $(call gb_CppunitTest_use_configuration,sw_txtimport))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sw/CppunitTest_sw_uwriter.mk b/sw/CppunitTest_sw_uwriter.mk
index 6b9ffa4ba683..e6a490c5dff1 100644
--- a/sw/CppunitTest_sw_uwriter.mk
+++ b/sw/CppunitTest_sw_uwriter.mk
@@ -64,7 +64,9 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_uwriter, \
 
 $(eval $(call gb_CppunitTest_use_externals,sw_uwriter,\
boost_headers \
+   icui18n \
icuuc \
+   icu_headers \
libxml2 \
 ))
 
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index 2de7d6b0e4dc..65f4154bf12e 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -87,6 +87,7 @@ $(eval $(call gb_Library_use_libraries,sw,\
 
 $(eval $(call gb_Library_use_externals,sw,\
boost_headers \
+   icui18n \
icuuc \
icu_headers \
libxml2 \
diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk
index ec6e73fd2779..2f8a9a35ed01 100644
--- a/sw/Module_sw.mk
+++ b/sw/Module_sw.mk
@@ -97,6 +97,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\
 CppunitTest_sw_odfexport \
 CppunitTest_sw_odfimport \
 CppunitTest_sw_txtexport \
+CppunitTest_sw_txtimport \
 $(if $(filter-out MACOSX,$(OS)), \
 CppunitTest_sw_uiwriter \
 ) \
diff --git a/sw/qa/extras/txtexport/txtexport.cxx 
b/sw/qa/extras/txtexport/txtexport.cxx
index d7246d05aced..0151ee289cc3 100644
--- a/sw/qa/extras/txtexport/txtexport.cxx
+++ b/sw/qa/extras/txtexport/txtexport.cxx
@@ -15,42 +15,13 @@
 #include 
 #include 
 
-class TxtImportTest : public SwModelTestBase
+class TxtExportTest : public SwModelTestBase
 {
 public:
-TxtImportTest() :
-

[Libreoffice-commits] core.git: Branch 'libreoffice-7-0-2' - include/svtools svtools/source

2020-09-28 Thread Tomofumi Yagi (via logerrit)
 include/svtools/filechangedchecker.hxx |2 +-
 svtools/source/misc/filechangedchecker.cxx |   21 -
 2 files changed, 13 insertions(+), 10 deletions(-)

New commits:
commit d62fe22aed6acf36c5321a417beb4c37a5f715a2
Author: Tomofumi Yagi 
AuthorDate: Fri Sep 18 16:21:43 2020 +0900
Commit: Xisco Fauli 
CommitDate: Mon Sep 28 19:39:30 2020 +0200

tdf#134157 fix Edit with external tool causes a CPU hit

Switch Idle to 100ms Timer for fixing the bug

Change-Id: I85a9bdcb173edd28d952d8e91c1b93d748e69206
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102984
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit f110c037114f90d219ac8d149542bf96fe66a2f1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103055
Reviewed-by: Caolán McNamara 
(cherry picked from commit 1d28170d94893171e2a358274cda62cd73f7b834)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103059
Reviewed-by: Tomofumi Yagi 
Reviewed-by: Xisco Fauli 
Tested-by: Xisco Fauli 

diff --git a/include/svtools/filechangedchecker.hxx 
b/include/svtools/filechangedchecker.hxx
index 3b7f817f3035..016fe9279800 100644
--- a/include/svtools/filechangedchecker.hxx
+++ b/include/svtools/filechangedchecker.hxx
@@ -29,7 +29,7 @@ class Timer;
 class UNLESS_MERGELIBS(SVT_DLLPUBLIC) FileChangedChecker
 {
 private:
-IdlemIdle;
+TimermTimer;
 OUString mFileName;
 TimeValuemLastModTime;
 ::std::function mpCallback;
diff --git a/svtools/source/misc/filechangedchecker.cxx 
b/svtools/source/misc/filechangedchecker.cxx
index 09e24c3fafb1..8536eb0bda57 100644
--- a/svtools/source/misc/filechangedchecker.cxx
+++ b/svtools/source/misc/filechangedchecker.cxx
@@ -16,7 +16,7 @@
 
 FileChangedChecker::FileChangedChecker(const OUString& rFilename,
 const ::std::function& rCallback)
-: mIdle("SVTools FileChangedChecker Idle")
+: mTimer("SVTools FileChangedChecker Timer")
 , mFileName(rFilename)
 , mLastModTime()
 , mpCallback(rCallback)
@@ -24,21 +24,24 @@ FileChangedChecker::FileChangedChecker(const OUString& 
rFilename,
 // Get the curren last file modified Status
 getCurrentModTime(mLastModTime);
 
-// associate the callback function for the Idle
-mIdle.SetInvokeHandler(LINK(this, FileChangedChecker, TimerHandler));
+// associate the callback function for the Timer
+mTimer.SetInvokeHandler(LINK(this, FileChangedChecker, TimerHandler));
 
-//start the timer
+// set timer interval
+mTimer.SetTimeout(100);
+
+// start the timer
 resetTimer();
 }
 
 void FileChangedChecker::resetTimer()
 {
-//Start the Idle if it's not active
-if(!mIdle.IsActive())
-mIdle.Start();
+// Start the Idle if it's not active
+if(!mTimer.IsActive())
+mTimer.Start();
 
 // Set lowest Priority
-mIdle.SetPriority(TaskPriority::LOWEST);
+mTimer.SetPriority(TaskPriority::LOWEST);
 }
 
 bool FileChangedChecker::getCurrentModTime(TimeValue& o_rValue) const
@@ -90,7 +93,7 @@ IMPL_LINK_NOARG(FileChangedChecker, TimerHandler, Timer *, 
void)
 mpCallback();
 }
 
-// Reset the Idle in any case
+// Reset the Timer in any case
 resetTimer();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - include/svtools svtools/source

2020-09-22 Thread Tomofumi Yagi (via logerrit)
 include/svtools/filechangedchecker.hxx |2 +-
 svtools/source/misc/filechangedchecker.cxx |   21 -
 2 files changed, 13 insertions(+), 10 deletions(-)

New commits:
commit bd1345f9806b1bb9940d208d75610f7c4556f05d
Author: Tomofumi Yagi 
AuthorDate: Fri Sep 18 16:21:43 2020 +0900
Commit: Noel Grandin 
CommitDate: Tue Sep 22 08:40:34 2020 +0200

tdf#134157 fix Edit with external tool causes a CPU hit

Switch Idle to 100ms Timer for fixing the bug

Change-Id: I85a9bdcb173edd28d952d8e91c1b93d748e69206
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102984
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit f110c037114f90d219ac8d149542bf96fe66a2f1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103055
Reviewed-by: Caolán McNamara 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103130

diff --git a/include/svtools/filechangedchecker.hxx 
b/include/svtools/filechangedchecker.hxx
index ec8d8a41fdac..a1c2fcb38eaa 100644
--- a/include/svtools/filechangedchecker.hxx
+++ b/include/svtools/filechangedchecker.hxx
@@ -28,7 +28,7 @@ class Timer;
 class SVT_DLLPUBLIC FileChangedChecker
 {
 private:
-IdlemIdle;
+TimermTimer;
 OUString const   mFileName;
 TimeValuemLastModTime;
 ::std::function const mpCallback;
diff --git a/svtools/source/misc/filechangedchecker.cxx 
b/svtools/source/misc/filechangedchecker.cxx
index 09e24c3fafb1..8536eb0bda57 100644
--- a/svtools/source/misc/filechangedchecker.cxx
+++ b/svtools/source/misc/filechangedchecker.cxx
@@ -16,7 +16,7 @@
 
 FileChangedChecker::FileChangedChecker(const OUString& rFilename,
 const ::std::function& rCallback)
-: mIdle("SVTools FileChangedChecker Idle")
+: mTimer("SVTools FileChangedChecker Timer")
 , mFileName(rFilename)
 , mLastModTime()
 , mpCallback(rCallback)
@@ -24,21 +24,24 @@ FileChangedChecker::FileChangedChecker(const OUString& 
rFilename,
 // Get the curren last file modified Status
 getCurrentModTime(mLastModTime);
 
-// associate the callback function for the Idle
-mIdle.SetInvokeHandler(LINK(this, FileChangedChecker, TimerHandler));
+// associate the callback function for the Timer
+mTimer.SetInvokeHandler(LINK(this, FileChangedChecker, TimerHandler));
 
-//start the timer
+// set timer interval
+mTimer.SetTimeout(100);
+
+// start the timer
 resetTimer();
 }
 
 void FileChangedChecker::resetTimer()
 {
-//Start the Idle if it's not active
-if(!mIdle.IsActive())
-mIdle.Start();
+// Start the Idle if it's not active
+if(!mTimer.IsActive())
+mTimer.Start();
 
 // Set lowest Priority
-mIdle.SetPriority(TaskPriority::LOWEST);
+mTimer.SetPriority(TaskPriority::LOWEST);
 }
 
 bool FileChangedChecker::getCurrentModTime(TimeValue& o_rValue) const
@@ -90,7 +93,7 @@ IMPL_LINK_NOARG(FileChangedChecker, TimerHandler, Timer *, 
void)
 mpCallback();
 }
 
-// Reset the Idle in any case
+// Reset the Timer in any case
 resetTimer();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - include/svtools svtools/source

2020-09-21 Thread Tomofumi Yagi (via logerrit)
 include/svtools/filechangedchecker.hxx |2 +-
 svtools/source/misc/filechangedchecker.cxx |   21 -
 2 files changed, 13 insertions(+), 10 deletions(-)

New commits:
commit 1d28170d94893171e2a358274cda62cd73f7b834
Author: Tomofumi Yagi 
AuthorDate: Fri Sep 18 16:21:43 2020 +0900
Commit: Caolán McNamara 
CommitDate: Mon Sep 21 17:56:50 2020 +0200

tdf#134157 fix Edit with external tool causes a CPU hit

Switch Idle to 100ms Timer for fixing the bug

Change-Id: I85a9bdcb173edd28d952d8e91c1b93d748e69206
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102984
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit f110c037114f90d219ac8d149542bf96fe66a2f1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103055
Reviewed-by: Caolán McNamara 

diff --git a/include/svtools/filechangedchecker.hxx 
b/include/svtools/filechangedchecker.hxx
index 3b7f817f3035..016fe9279800 100644
--- a/include/svtools/filechangedchecker.hxx
+++ b/include/svtools/filechangedchecker.hxx
@@ -29,7 +29,7 @@ class Timer;
 class UNLESS_MERGELIBS(SVT_DLLPUBLIC) FileChangedChecker
 {
 private:
-IdlemIdle;
+TimermTimer;
 OUString mFileName;
 TimeValuemLastModTime;
 ::std::function mpCallback;
diff --git a/svtools/source/misc/filechangedchecker.cxx 
b/svtools/source/misc/filechangedchecker.cxx
index 09e24c3fafb1..8536eb0bda57 100644
--- a/svtools/source/misc/filechangedchecker.cxx
+++ b/svtools/source/misc/filechangedchecker.cxx
@@ -16,7 +16,7 @@
 
 FileChangedChecker::FileChangedChecker(const OUString& rFilename,
 const ::std::function& rCallback)
-: mIdle("SVTools FileChangedChecker Idle")
+: mTimer("SVTools FileChangedChecker Timer")
 , mFileName(rFilename)
 , mLastModTime()
 , mpCallback(rCallback)
@@ -24,21 +24,24 @@ FileChangedChecker::FileChangedChecker(const OUString& 
rFilename,
 // Get the curren last file modified Status
 getCurrentModTime(mLastModTime);
 
-// associate the callback function for the Idle
-mIdle.SetInvokeHandler(LINK(this, FileChangedChecker, TimerHandler));
+// associate the callback function for the Timer
+mTimer.SetInvokeHandler(LINK(this, FileChangedChecker, TimerHandler));
 
-//start the timer
+// set timer interval
+mTimer.SetTimeout(100);
+
+// start the timer
 resetTimer();
 }
 
 void FileChangedChecker::resetTimer()
 {
-//Start the Idle if it's not active
-if(!mIdle.IsActive())
-mIdle.Start();
+// Start the Idle if it's not active
+if(!mTimer.IsActive())
+mTimer.Start();
 
 // Set lowest Priority
-mIdle.SetPriority(TaskPriority::LOWEST);
+mTimer.SetPriority(TaskPriority::LOWEST);
 }
 
 bool FileChangedChecker::getCurrentModTime(TimeValue& o_rValue) const
@@ -90,7 +93,7 @@ IMPL_LINK_NOARG(FileChangedChecker, TimerHandler, Timer *, 
void)
 mpCallback();
 }
 
-// Reset the Idle in any case
+// Reset the Timer in any case
 resetTimer();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: include/svtools svtools/source

2020-09-19 Thread Tomofumi Yagi (via logerrit)
 include/svtools/filechangedchecker.hxx |2 +-
 svtools/source/misc/filechangedchecker.cxx |   21 -
 2 files changed, 13 insertions(+), 10 deletions(-)

New commits:
commit f110c037114f90d219ac8d149542bf96fe66a2f1
Author: Tomofumi Yagi 
AuthorDate: Fri Sep 18 16:21:43 2020 +0900
Commit: Noel Grandin 
CommitDate: Sat Sep 19 08:51:14 2020 +0200

tdf#134157 fix Edit with external tool causes a CPU hit

Switch Idle to 100ms Timer for fixing the bug

Change-Id: I85a9bdcb173edd28d952d8e91c1b93d748e69206
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102984
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/svtools/filechangedchecker.hxx 
b/include/svtools/filechangedchecker.hxx
index 3b7f817f3035..016fe9279800 100644
--- a/include/svtools/filechangedchecker.hxx
+++ b/include/svtools/filechangedchecker.hxx
@@ -29,7 +29,7 @@ class Timer;
 class UNLESS_MERGELIBS(SVT_DLLPUBLIC) FileChangedChecker
 {
 private:
-IdlemIdle;
+TimermTimer;
 OUString mFileName;
 TimeValuemLastModTime;
 ::std::function mpCallback;
diff --git a/svtools/source/misc/filechangedchecker.cxx 
b/svtools/source/misc/filechangedchecker.cxx
index 09e24c3fafb1..8536eb0bda57 100644
--- a/svtools/source/misc/filechangedchecker.cxx
+++ b/svtools/source/misc/filechangedchecker.cxx
@@ -16,7 +16,7 @@
 
 FileChangedChecker::FileChangedChecker(const OUString& rFilename,
 const ::std::function& rCallback)
-: mIdle("SVTools FileChangedChecker Idle")
+: mTimer("SVTools FileChangedChecker Timer")
 , mFileName(rFilename)
 , mLastModTime()
 , mpCallback(rCallback)
@@ -24,21 +24,24 @@ FileChangedChecker::FileChangedChecker(const OUString& 
rFilename,
 // Get the curren last file modified Status
 getCurrentModTime(mLastModTime);
 
-// associate the callback function for the Idle
-mIdle.SetInvokeHandler(LINK(this, FileChangedChecker, TimerHandler));
+// associate the callback function for the Timer
+mTimer.SetInvokeHandler(LINK(this, FileChangedChecker, TimerHandler));
 
-//start the timer
+// set timer interval
+mTimer.SetTimeout(100);
+
+// start the timer
 resetTimer();
 }
 
 void FileChangedChecker::resetTimer()
 {
-//Start the Idle if it's not active
-if(!mIdle.IsActive())
-mIdle.Start();
+// Start the Idle if it's not active
+if(!mTimer.IsActive())
+mTimer.Start();
 
 // Set lowest Priority
-mIdle.SetPriority(TaskPriority::LOWEST);
+mTimer.SetPriority(TaskPriority::LOWEST);
 }
 
 bool FileChangedChecker::getCurrentModTime(TimeValue& o_rValue) const
@@ -90,7 +93,7 @@ IMPL_LINK_NOARG(FileChangedChecker, TimerHandler, Timer *, 
void)
 mpCallback();
 }
 
-// Reset the Idle in any case
+// Reset the Timer in any case
 resetTimer();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/Library_scui.mk sc/source

2020-09-13 Thread Tomofumi Yagi (via logerrit)
 sc/Library_scui.mk  |3 +
 sc/source/ui/dbgui/scuiasciiopt.cxx |   71 +++-
 2 files changed, 41 insertions(+), 33 deletions(-)

New commits:
commit 85f12e47f4a086a3923dd3a6b097776d60c6dc82
Author: Tomofumi Yagi 
AuthorDate: Sat Sep 12 11:47:10 2020 +0900
Commit: Noel Grandin 
CommitDate: Sun Sep 13 13:21:43 2020 +0200

Calc: ScImportAsciiDlg can now detect Unicode encoding without BOM

Change-Id: I8a3aa7458ce97f659c0caf2386a96f605b740fbc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102543
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/Library_scui.mk b/sc/Library_scui.mk
index a8c2097485b0..86605ab63a0d 100644
--- a/sc/Library_scui.mk
+++ b/sc/Library_scui.mk
@@ -39,6 +39,9 @@ $(eval $(call gb_Library_use_externals,scui,\
$(call gb_Helper_optional,OPENCL, \
clew) \
mdds_headers \
+   icui18n \
+   icuuc \
+   icu_headers \
 ))
 
 $(eval $(call gb_Library_use_libraries,scui,\
diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx 
b/sc/source/ui/dbgui/scuiasciiopt.cxx
index a0e645e551e0..5e5f08bf87a7 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -37,6 +37,9 @@
 #include 
 #include 
 
+#include 
+#include 
+
 //! TODO make dynamic
 const SCSIZE ASCIIDLG_MAXROWS= MAXROWCOUNT;
 
@@ -380,41 +383,43 @@ ScImportAsciiDlg::ScImportAsciiDlg(weld::Window* pParent, 
const OUString& aDatNa
 // Sniff for Unicode / not
 if( ePreselectUnicode == RTL_TEXTENCODING_DONTKNOW && mpDatStream )
 {
-Seek( 0 );
-mpDatStream->StartReadingUnicodeText( RTL_TEXTENCODING_DONTKNOW );
-sal_uLong nUniPos = mpDatStream->Tell();
-switch (nUniPos)
+mpDatStream->Seek( 0 );
+constexpr size_t buffsize = 4096;
+sal_Int8 bytes[buffsize] = { 0 };
+sal_Int32 nRead = mpDatStream->ReadBytes( bytes, buffsize );
+mpDatStream->Seek( 0 );
+
+if ( nRead > 0 )
 {
-case 2:
-ePreselectUnicode = RTL_TEXTENCODING_UNICODE;   // UTF-16
-break;
-case 3:
-ePreselectUnicode = RTL_TEXTENCODING_UTF8;  // UTF-8
-break;
-case 0:
-{
-sal_uInt16 n;
-mpDatStream->ReadUInt16( n );
-// Assume that normal ASCII/ANSI/ISO/etc. text doesn't 
start with
-// control characters except CR,LF,TAB
-if ( (n & 0xff00) < 0x2000 )
-{
-switch ( n & 0xff00 )
-{
-case 0x0900 :
-case 0x0a00 :
-case 0x0d00 :
-break;
-default:
-ePreselectUnicode = RTL_TEXTENCODING_UNICODE;  
 // UTF-16
-}
-}
-mpDatStream->Seek(0);
-}
-break;
-default:
-;   // nothing
+UErrorCode uerr = U_ZERO_ERROR;
+UCharsetDetector* ucd = ucsdet_open(  );
+ucsdet_setText( ucd, reinterpret_cast(bytes), nRead, 
 );
+const UCharsetMatch* match = ucsdet_detect( ucd,  );
+const char* pEncodingName = ucsdet_getName( match,  );
+
+if ( U_SUCCESS(uerr) && !strcmp("UTF-8", pEncodingName) )
+{
+ePreselectUnicode = RTL_TEXTENCODING_UTF8; // UTF-8
+mpDatStream->StartReadingUnicodeText( RTL_TEXTENCODING_UTF8 );
+}
+else if ( U_SUCCESS(uerr) && !strcmp("UTF-16LE", pEncodingName) )
+{
+ePreselectUnicode = RTL_TEXTENCODING_UNICODE; // UTF-16LE
+mpDatStream->SetEndian( SvStreamEndian::LITTLE );
+mpDatStream->StartReadingUnicodeText( RTL_TEXTENCODING_UNICODE 
);
+}
+else if ( U_SUCCESS(uerr) && !strcmp("UTF-16BE", pEncodingName) )
+{
+ePreselectUnicode = RTL_TEXTENCODING_UNICODE; // UTF-16BE
+mpDatStream->SetEndian(SvStreamEndian::BIG);
+mpDatStream->StartReadingUnicodeText( RTL_TEXTENCODING_UNICODE 
);
+}
+else // other
+mpDatStream->StartReadingUnicodeText( 
RTL_TEXTENCODING_DONTKNOW );
+
+ucsdet_close( ucd );
 }
+
 mnStreamPos = mpDatStream->Tell();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: officecfg/registry unotools/qa unotools/source vcl/quartz

2020-03-21 Thread Tomofumi Yagi (via logerrit)
 officecfg/registry/data/org/openoffice/VCL.xcu |   16 
 unotools/qa/unit/testGetEnglishSearchName.cxx  |   25 +
 unotools/source/misc/fontdefs.cxx  |2 ++
 vcl/quartz/ctfonts.cxx |7 ++-
 4 files changed, 33 insertions(+), 17 deletions(-)

New commits:
commit c663d0bcc93b278f50c8f6802928a7a6154207f2
Author: Tomofumi Yagi 
AuthorDate: Sun Oct 20 08:24:13 2019 +0900
Commit: Noel Grandin 
CommitDate: Sat Mar 21 10:29:13 2020 +0100

tdf#128276 Font names are not localized on macOS Catalina

1. We would like to call CTFontDescriptorCopyLocalizedAttribute function
simply.
We don't need to compare language settings of LibreOffice UI to OS lang-
uage settings.
This comparison was a way to save users from confusion, but it was bad
idea.
Because CTFontDescriptorCopyLocalizedAttribute function before macOS
Catalina returns RFC 3066 bis as a language tag, but LibreOffice and
macOS Catalina uses BCP 47 as a language tag.
CTFontDescriptorCopyLocalizedAttribute function use the language setting
for the operating system, therefore Users will change it if needed.

2. Fix font aliases on macOS Catalina
I added some entries because I notice that those doesn't working with
a Hiragino Sans font alias.

Change-Id: Ie05a96f45cba13a19fcc1b855bd908f397e585a1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/81145
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/officecfg/registry/data/org/openoffice/VCL.xcu 
b/officecfg/registry/data/org/openoffice/VCL.xcu
index 40fce619cf7c..271731c28e65 100644
--- a/officecfg/registry/data/org/openoffice/VCL.xcu
+++ b/officecfg/registry/data/org/openoffice/VCL.xcu
@@ -214,28 +214,28 @@
 Noto Serif CJK JP;游明朝;MS 明朝;MS P明朝;ヒラギノ明朝 ProN;ヒラギノ明朝 Pro;IPA 
明朝;IPA P明朝;Mincho;Serif
   
   
-Noto Sans CJK JP;游ゴシック;MS ゴシック;MS Pゴシック;ヒラギノ角ゴ ProN;ヒラギノ角ゴ 
Pro;IPA ゴシック;IPA Pゴシック;Gothic;MS 明朝;Mincho;MS P明朝;Gothic
+Noto Sans CJK JP;游ゴシック;MS ゴシック;MS Pゴシック;ヒラギノ角ゴシック;ヒラギノ角ゴ 
ProN;ヒラギノ角ゴ Pro;IPA ゴシック;IPA Pゴシック;Gothic;MS 明朝;Mincho;MS P明朝;Gothic
   
   
-Noto Sans CJK JP;ヒラギノ角ゴ ProN;ヒラギノ角ゴ Pro;游ゴシック;MS Pゴシック;IPA 
Pゴシック;MS ゴシック;MS Pゴシック;Gothic
+Noto Sans CJK JP;ヒラギノ角ゴシック;ヒラギノ角ゴ ProN;ヒラギノ角ゴ Pro;游ゴシック;MS 
Pゴシック;IPA Pゴシック;MS ゴシック;MS Pゴシック;Gothic
   
   
-Noto Sans CJK JP;ヒラギノ角ゴ ProN;ヒラギノ角ゴ Pro;游ゴシック;MS Pゴシック;IPA 
Pゴシック;MS ゴシック;MS Pゴシック;Gothic
+Noto Sans CJK JP;ヒラギノ角ゴシック;ヒラギノ角ゴ ProN;ヒラギノ角ゴ Pro;游ゴシック;MS 
Pゴシック;IPA Pゴシック;MS ゴシック;MS Pゴシック;Gothic
   
   
-Noto Sans CJK JP;游ゴシック;MS Pゴシック;ヒラギノ角ゴ ProN;ヒラギノ角ゴ Pro;IPA 
Pゴシック;Gothic
+Noto Sans CJK JP;游ゴシック;MS Pゴシック;ヒラギノ角ゴシック;ヒラギノ角ゴ ProN;ヒラギノ角ゴ 
Pro;IPA Pゴシック;Gothic
   
   
-Noto Sans CJK JP;游ゴシック;MS Pゴシック;ヒラギノ角ゴ ProN;ヒラギノ角ゴ Pro;IPA 
Pゴシック;MS Gothic;MS PGothic;Gothic
+Noto Sans CJK JP;游ゴシック;MS Pゴシック;ヒラギノ角ゴシック;ヒラギノ角ゴ ProN;ヒラギノ角ゴ 
Pro;IPA Pゴシック;MS Gothic;MS PGothic;Gothic
   
   
-Noto Sans Mono CJK JP;Yu Gothic UI;MS ゴシック;Osaka;ヒラギノ角ゴ 
ProN;ヒラギノ角ゴ Pro;IPAゴシック;Gothic
+Noto Sans Mono CJK JP;Yu Gothic UI;MS 
ゴシック;Osaka;ヒラギノ角ゴシック;ヒラギノ角ゴ ProN;ヒラギノ角ゴ Pro;IPAゴシック;Gothic
   
   
-Noto Sans Mono CJK JP:MS ゴシック;ヒラギノ角ゴ ProN;ヒラギノ角ゴ 
Pro;IPAゴシック;Gothic
+Noto Sans Mono CJK JP:MS ゴシック;ヒラギノ角ゴシック;ヒラギノ角ゴ ProN;ヒラギノ角ゴ 
Pro;IPAゴシック;Gothic
   
   
-IPA Pゴシック;IPA P Gothic;Noto Sans CJK JP;Yu Gothic UI;Meiryo 
UI;ヒラギノ角ゴ ProN;Hiragino Kaku Gothic ProN;ヒラギノ角ゴ Pro;Hiragino Kaku Gothic 
Pro
+IPA Pゴシック;IPA P Gothic;Noto Sans CJK JP;Yu Gothic UI;Meiryo 
UI;ヒラギノ角ゴシック;ヒラギノ角ゴ ProN;Hiragino Kaku Gothic ProN;ヒラギノ角ゴ Pro;Hiragino Kaku 
Gothic Pro
   
   
 
cumberlandamt;cumberland;couriernew;nimbusmonol;courier;lucidasanstypewriter;lucidatypewriter;monaco;monospaced
diff --git a/unotools/qa/unit/testGetEnglishSearchName.cxx 
b/unotools/qa/unit/testGetEnglishSearchName.cxx
index 2889ffaedcf7..4534187052fa 100644
--- a/unotools/qa/unit/testGetEnglishSearchName.cxx
+++ b/unotools/qa/unit/testGetEnglishSearchName.cxx
@@ -43,10 +43,27 @@ void Test::testSingleElement()
 
 //transformation
 
-sal_Unicode const transfor[] ={ 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x4E38, 
0x30B4, 'p','r','o','n',0};
-
-test1 = GetEnglishSearchFontName(transfor );
-CPPUNIT_ASSERT_EQUAL( OUString("hiraginomarugothicpron"),test1);
+//for Japanese fontname
+// IPAMincho
+sal_Unicode const aIPAMincho[]={'i','p','a', 0x660e, 0x671d,0};
+OUString test_ja_JP1 = GetEnglishSearchFontName(aIPAMincho);
+CPPUNIT_ASSERT_EQUAL( OUString("ipamincho"),test_ja_JP1);
+// IPAGothic
+sal_Unicode const aIPAGothic[]={'i','p','a', 0x30b4, 0x30b7, 0x30c3, 
0x30af,0};
+OUString test_ja_JP2 = GetEnglishSearchFontName(aIPAGothic);
+CPPUNIT_ASSERT_EQUAL( OUString("ipagothic"),test_ja_JP2);
+// HiraginoKakuGothic
+