[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/source

2023-11-28 Thread Paris Oplopoios (via logerrit)
 sw/source/uibase/app/apphdl.cxx |   14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

New commits:
commit b58317e2fee41ae8dbe28604d4674cae84a7e4de
Author: Paris Oplopoios 
AuthorDate: Mon Jun 12 00:49:27 2023 +0300
Commit: Miklos Vajna 
CommitDate: Tue Nov 28 11:01:03 2023 +0100

Fix unchecked dynamic cast

Change-Id: If662e24bb864690ead959b2599a6448d84da0de9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152866
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159991
Tested-by: Miklos Vajna 
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index 030a5b73c14e..ba92304518f2 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -984,17 +984,15 @@ void SwModule::ConfigurationChanged( 
utl::ConfigurationBroadcaster* pBrdCst, Con
 {
 if(pViewShell->GetWindow())
 {
-auto pSwView = dynamic_cast( pViewShell );
-if(pSwView !=  nullptr ||
-   dynamic_cast< const SwPagePreview *>( pViewShell ) !=  
nullptr ||
-   dynamic_cast< const SwSrcView *>( pViewShell ) !=  nullptr)
+auto pSwView = dynamic_cast(pViewShell);
+if (pSwView)
 {
 SwViewOption aNewOptions = 
*pSwView->GetWrtShell().GetViewOptions();
 
aNewOptions.SetThemeName(m_pColorConfig->GetCurrentSchemeName());
 SwViewColors aViewColors(*m_pColorConfig);
 aNewOptions.SetColorConfig(aViewColors);
 pSwView->GetWrtShell().ApplyViewOptions(aNewOptions);
-pViewShell->GetWindow()->Invalidate();
+
 if (bOnlyInvalidateCurrentView)
 {
 
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR,
@@ -1003,6 +1001,12 @@ void SwModule::ConfigurationChanged( 
utl::ConfigurationBroadcaster* pBrdCst, Con
 
aViewColors.m_aDocColor.AsRGBHexString().toUtf8().getStr());
 }
 }
+if(pSwView !=  nullptr ||
+   dynamic_cast< const SwPagePreview *>( pViewShell ) !=  
nullptr ||
+   dynamic_cast< const SwSrcView *>( pViewShell ) !=  nullptr)
+{
+pViewShell->GetWindow()->Invalidate();
+}
 }
 if (bOnlyInvalidateCurrentView)
 break;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - 2 commits - sc/qa sc/source

2023-10-31 Thread Paris Oplopoios (via logerrit)
 sc/qa/unit/subsequent_export_test.cxx |   31 +++
 sc/source/filter/excel/xecontent.cxx  |   17 -
 2 files changed, 47 insertions(+), 1 deletion(-)

New commits:
commit eb889e467d64e4d131604744fe6d165bd2d9304a
Author: Paris Oplopoios 
AuthorDate: Thu Oct 26 14:28:06 2023 +0300
Commit: Xisco Fauli 
CommitDate: Tue Oct 31 09:35:04 2023 +0100

sc: Test numeric conditional format text rule exports correctly

Change-Id: Ib57ea44912b4cb0be7cbdb127dd7ea6f08ec8392
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158498
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158647

diff --git a/sc/qa/unit/subsequent_export_test.cxx 
b/sc/qa/unit/subsequent_export_test.cxx
index 1ce8ef99c926..0d69e3d18ce5 100644
--- a/sc/qa/unit/subsequent_export_test.cxx
+++ b/sc/qa/unit/subsequent_export_test.cxx
@@ -2133,6 +2133,37 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, 
testSheetProtectionXLSB)
 
CPPUNIT_ASSERT(!pTabProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS));
 }
 
+CPPUNIT_TEST_FIXTURE(ScExportTest, testConditionalFormatNumberInTextRule)
+{
+createScDoc();
+
+ScDocument* pDocument = getScDoc();
+ScAddress aAddress(0, 0, 0);
+
+auto pFormat = std::make_unique(0, pDocument);
+ScRange aCondFormatRange(aAddress);
+ScRangeList aRangeList(aCondFormatRange);
+pFormat->SetRange(aRangeList);
+ScCondFormatEntry* pEntry
+= new ScCondFormatEntry(ScConditionMode::BeginsWith, "15", "", 
*pDocument, aAddress, "");
+pFormat->AddEntry(pEntry);
+pDocument->AddCondFormat(std::move(pFormat), 0);
+
+saveAndReload("Calc Office Open XML");
+pDocument = getScDoc();
+
+ScConditionalFormat* pCondFormat = pDocument->GetCondFormat(0, 0, 0);
+CPPUNIT_ASSERT(pCondFormat);
+CPPUNIT_ASSERT_EQUAL(size_t(1), pCondFormat->size());
+const ScFormatEntry* pCondFormatEntry = pCondFormat->GetEntry(0);
+CPPUNIT_ASSERT(pCondFormatEntry);
+CPPUNIT_ASSERT_EQUAL(ScFormatEntry::Type::Condition, 
pCondFormatEntry->GetType());
+const ScConditionEntry* pConditionEntry
+= static_cast(pCondFormatEntry);
+CPPUNIT_ASSERT_EQUAL(ScConditionMode::BeginsWith, 
pConditionEntry->GetOperation());
+CPPUNIT_ASSERT_EQUAL(OUString("\"15\""), 
pConditionEntry->GetExpression(aAddress, 0));
+}
+
 namespace
 {
 const char* toBorderName(SvxBorderLineStyle eStyle)
commit 565c4acc5042cf142b0996f71dee3e511f3b0d29
Author: Paris Oplopoios 
AuthorDate: Thu Oct 26 12:35:23 2023 +0300
Commit: Xisco Fauli 
CommitDate: Tue Oct 31 09:34:51 2023 +0100

sc: Export conditional formatting expression correctly for text rules

Text rules like BeginsWith would discard the expression if it was a
number when exporting, which is not what is supposed to happen - as
something like a conditional formatting rule BeginsWith "1" should be
valid.

Change-Id: I2d53754c462403f20b1991fa201184fcab3616a8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158494
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158646

diff --git a/sc/source/filter/excel/xecontent.cxx 
b/sc/source/filter/excel/xecontent.cxx
index b1329e56f535..6f48a6f3ef96 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -1057,7 +1057,22 @@ void XclExpCFImpl::SaveXml( XclExpXmlStream& rStrm )
 // the token array for that
 std::unique_ptr 
pTokenArray(mrFormatEntry.CreateFlatCopiedTokenArray(0));
 if(pTokenArray->GetLen())
-aText = 
pTokenArray->FirstToken()->GetString().getString().toUtf8();
+{
+formula::StackVar eType = pTokenArray->FirstToken()->GetType();
+switch (eType)
+{
+case formula::svDouble:
+{
+aText = 
OString::number(pTokenArray->FirstToken()->GetDouble());
+break;
+}
+default:
+{
+aText = 
pTokenArray->FirstToken()->GetString().getString().toUtf8();
+break;
+}
+}
+}
 }
 
 sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();


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

2023-10-29 Thread Paris Oplopoios (via logerrit)
 sc/qa/unit/subsequent_export_test.cxx |   31 +++
 sc/source/filter/excel/xecontent.cxx  |   17 -
 2 files changed, 47 insertions(+), 1 deletion(-)

New commits:
commit e123c772db8a12a37dfa14370b9db7c220f33ef1
Author: Paris Oplopoios 
AuthorDate: Thu Oct 26 14:28:06 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Sun Oct 29 22:18:41 2023 +0100

sc: Test numeric conditional format text rule exports correctly

Change-Id: Ib57ea44912b4cb0be7cbdb127dd7ea6f08ec8392
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158498
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/sc/qa/unit/subsequent_export_test.cxx 
b/sc/qa/unit/subsequent_export_test.cxx
index 5f5132c299c2..035709a036ac 100644
--- a/sc/qa/unit/subsequent_export_test.cxx
+++ b/sc/qa/unit/subsequent_export_test.cxx
@@ -2153,6 +2153,37 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, 
testSheetProtectionXLSB)
 
CPPUNIT_ASSERT(!pTabProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS));
 }
 
+CPPUNIT_TEST_FIXTURE(ScExportTest, testConditionalFormatNumberInTextRule)
+{
+createScDoc();
+
+ScDocument* pDocument = getScDoc();
+ScAddress aAddress(0, 0, 0);
+
+auto pFormat = std::make_unique(0, pDocument);
+ScRange aCondFormatRange(aAddress);
+ScRangeList aRangeList(aCondFormatRange);
+pFormat->SetRange(aRangeList);
+ScCondFormatEntry* pEntry
+= new ScCondFormatEntry(ScConditionMode::BeginsWith, "15", "", 
*pDocument, aAddress, "");
+pFormat->AddEntry(pEntry);
+pDocument->AddCondFormat(std::move(pFormat), 0);
+
+saveAndReload("Calc Office Open XML");
+pDocument = getScDoc();
+
+ScConditionalFormat* pCondFormat = pDocument->GetCondFormat(0, 0, 0);
+CPPUNIT_ASSERT(pCondFormat);
+CPPUNIT_ASSERT_EQUAL(size_t(1), pCondFormat->size());
+const ScFormatEntry* pCondFormatEntry = pCondFormat->GetEntry(0);
+CPPUNIT_ASSERT(pCondFormatEntry);
+CPPUNIT_ASSERT_EQUAL(ScFormatEntry::Type::Condition, 
pCondFormatEntry->GetType());
+const ScConditionEntry* pConditionEntry
+= static_cast(pCondFormatEntry);
+CPPUNIT_ASSERT_EQUAL(ScConditionMode::BeginsWith, 
pConditionEntry->GetOperation());
+CPPUNIT_ASSERT_EQUAL(OUString("\"15\""), 
pConditionEntry->GetExpression(aAddress, 0));
+}
+
 namespace
 {
 const char* toBorderName(SvxBorderLineStyle eStyle)
commit ac0a4b7c22b65325b3502cde3e05e106136c4f5b
Author: Paris Oplopoios 
AuthorDate: Thu Oct 26 12:35:23 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Sun Oct 29 22:18:33 2023 +0100

sc: Export conditional formatting expression correctly for text rules

Text rules like BeginsWith would discard the expression if it was a
number when exporting, which is not what is supposed to happen - as
something like a conditional formatting rule BeginsWith "1" should be
valid.

Change-Id: I2d53754c462403f20b1991fa201184fcab3616a8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158494
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/sc/source/filter/excel/xecontent.cxx 
b/sc/source/filter/excel/xecontent.cxx
index 037e99c408a0..d8d21e360cd6 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -1058,7 +1058,22 @@ void XclExpCFImpl::SaveXml( XclExpXmlStream& rStrm )
 // the token array for that
 std::unique_ptr 
pTokenArray(mrFormatEntry.CreateFlatCopiedTokenArray(0));
 if(pTokenArray->GetLen())
-aText = 
pTokenArray->FirstToken()->GetString().getString().toUtf8();
+{
+formula::StackVar eType = pTokenArray->FirstToken()->GetType();
+switch (eType)
+{
+case formula::svDouble:
+{
+aText = 
OString::number(pTokenArray->FirstToken()->GetDouble());
+break;
+}
+default:
+{
+aText = 
pTokenArray->FirstToken()->GetString().getString().toUtf8();
+break;
+}
+}
+}
 }
 
 sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();


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

2023-10-28 Thread Paris Oplopoios (via logerrit)
 sc/source/ui/condformat/condformateasydlg.cxx |2 +
 sc/source/ui/inc/condformateasydlg.hxx|1 
 sc/uiconfig/scalc/ui/conditionaleasydialog.ui |   29 +-
 3 files changed, 31 insertions(+), 1 deletion(-)

New commits:
commit f8f8d5ec4568a10dc77144369f52b2dd165e66c5
Author: Paris Oplopoios 
AuthorDate: Fri Oct 27 13:12:19 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Sun Oct 29 01:05:30 2023 +0200

tdf#157930 Add button to switch to range view in condformateasydlg

Add a button that minimizes the dialog to make it easier to choose the
conditional formatting range in the condformateasydlg. Also added more
spacing.

Change-Id: Ibf90e1d44caf2ab7a5c7bdb0bb2fa6c11d58
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158555
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/sc/source/ui/condformat/condformateasydlg.cxx 
b/sc/source/ui/condformat/condformateasydlg.cxx
index c371861ac355..7e07b1a1dc19 100644
--- a/sc/source/ui/condformat/condformateasydlg.cxx
+++ b/sc/source/ui/condformat/condformateasydlg.cxx
@@ -67,11 +67,13 @@ 
ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings,
 , mxNumberEntry(m_xBuilder->weld_spin_button("entryNumber"))
 , mxNumberEntry2(m_xBuilder->weld_spin_button("entryNumber2"))
 , mxRangeEntry(new formula::RefEdit(m_xBuilder->weld_entry("entryRange")))
+, mxButtonRangeEdit(new 
formula::RefButton(m_xBuilder->weld_button("rbassign")))
 , mxStyles(m_xBuilder->weld_combo_box("themeCombo"))
 , mxDescription(m_xBuilder->weld_label("description"))
 , mxButtonOk(m_xBuilder->weld_button("ok"))
 , mxButtonCancel(m_xBuilder->weld_button("cancel"))
 {
+mxButtonRangeEdit->SetReferences(this, mxRangeEntry.get());
 mpTabViewShell = GetTabViewShell(pBindings);
 if (!mpTabViewShell)
 mpTabViewShell = 
dynamic_cast(SfxViewShell::Current());
diff --git a/sc/source/ui/inc/condformateasydlg.hxx 
b/sc/source/ui/inc/condformateasydlg.hxx
index 469613d2f1c8..9ca15a11bda9 100644
--- a/sc/source/ui/inc/condformateasydlg.hxx
+++ b/sc/source/ui/inc/condformateasydlg.hxx
@@ -45,6 +45,7 @@ private:
 std::unique_ptr mxNumberEntry;
 std::unique_ptr mxNumberEntry2;
 std::unique_ptr mxRangeEntry;
+std::unique_ptr mxButtonRangeEdit;
 std::unique_ptr mxStyles;
 std::unique_ptr mxDescription;
 std::unique_ptr mxButtonOk;
diff --git a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui 
b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
index 8f3da05b2ce8..2bee383956a9 100644
--- a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
+++ b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
@@ -68,7 +68,7 @@
 True
 False
 vertical
-12
+24
 
   
 True
@@ -79,6 +79,10 @@
   
 True
 False
+12
+12
+6
+6
 12
 
   
@@ -191,6 +195,11 @@
   
 True
 False
+12
+12
+6
+6
+12
 
   
 True
@@ -205,6 +214,24 @@
 0
   
 
+
+  
+True
+True
+True
+center
+
+  
+Click 
the Shrink icon to reduce the dialog to the size of the input field. It is then 
easier to mark the required reference in the sheet. The icons then 
automatically convert to the Maximize icon. Click it to restore the dialog to 
its original size.
+  
+
+  
+  
+False
+True
+1
+  
+
   
 
 


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa

2023-10-28 Thread Paris Oplopoios (via logerrit)
 sc/qa/unit/subsequent_export_test.cxx |   31 +++
 1 file changed, 31 insertions(+)

New commits:
commit 17bc207d3054b4cbecb56b4d1195c73db203f21f
Author: Paris Oplopoios 
AuthorDate: Thu Oct 26 14:28:06 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Sun Oct 29 01:04:53 2023 +0200

sc: Test numeric conditional format text rule exports correctly

Change-Id: Ib57ea44912b4cb0be7cbdb127dd7ea6f08ec8392
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158540
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Paris Oplopoios 

diff --git a/sc/qa/unit/subsequent_export_test.cxx 
b/sc/qa/unit/subsequent_export_test.cxx
index cbbc99de69d8..d3927c136677 100644
--- a/sc/qa/unit/subsequent_export_test.cxx
+++ b/sc/qa/unit/subsequent_export_test.cxx
@@ -2402,6 +2402,37 @@ void ScExportTest::testSheetProtectionXLSB()
 
CPPUNIT_ASSERT(!pTabProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS));
 }
 
+CPPUNIT_TEST_FIXTURE(ScExportTest, testConditionalFormatNumberInTextRule)
+{
+createScDoc();
+
+ScDocument* pDocument = getScDoc();
+ScAddress aAddress(0, 0, 0);
+
+auto pFormat = std::make_unique(0, pDocument);
+ScRange aCondFormatRange(aAddress);
+ScRangeList aRangeList(aCondFormatRange);
+pFormat->SetRange(aRangeList);
+ScCondFormatEntry* pEntry
+= new ScCondFormatEntry(ScConditionMode::BeginsWith, "15", "", 
*pDocument, aAddress, "");
+pFormat->AddEntry(pEntry);
+pDocument->AddCondFormat(std::move(pFormat), 0);
+
+saveAndReload("Calc Office Open XML");
+pDocument = getScDoc();
+
+ScConditionalFormat* pCondFormat = pDocument->GetCondFormat(0, 0, 0);
+CPPUNIT_ASSERT(pCondFormat);
+CPPUNIT_ASSERT_EQUAL(size_t(1), pCondFormat->size());
+const ScFormatEntry* pCondFormatEntry = pCondFormat->GetEntry(0);
+CPPUNIT_ASSERT(pCondFormatEntry);
+CPPUNIT_ASSERT_EQUAL(ScFormatEntry::Type::Condition, 
pCondFormatEntry->GetType());
+const ScConditionEntry* pConditionEntry
+= static_cast(pCondFormatEntry);
+CPPUNIT_ASSERT_EQUAL(ScConditionMode::BeginsWith, 
pConditionEntry->GetOperation());
+CPPUNIT_ASSERT_EQUAL(OUString("\"15\""), 
pConditionEntry->GetExpression(aAddress, 0));
+}
+
 namespace
 {
 const char* toBorderName(SvxBorderLineStyle eStyle)


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source sc/uiconfig

2023-10-28 Thread Paris Oplopoios (via logerrit)
 sc/source/ui/condformat/condformateasydlg.cxx |2 +
 sc/source/ui/inc/condformateasydlg.hxx|1 
 sc/uiconfig/scalc/ui/conditionaleasydialog.ui |   29 +-
 3 files changed, 31 insertions(+), 1 deletion(-)

New commits:
commit 1373bacdb99caec73b1a534e534c758c26982324
Author: Paris Oplopoios 
AuthorDate: Fri Oct 27 13:12:19 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Sat Oct 28 22:36:19 2023 +0200

tdf#157930 Add button to switch to range view in condformateasydlg

Add a button that minimizes the dialog to make it easier to choose the
conditional formatting range in the condformateasydlg. Also added more
spacing.

Change-Id: Ibf90e1d44caf2ab7a5c7bdb0bb2fa6c11d58
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158532
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Paris Oplopoios 

diff --git a/sc/source/ui/condformat/condformateasydlg.cxx 
b/sc/source/ui/condformat/condformateasydlg.cxx
index 8ddb297269dc..41b8a31eafd3 100644
--- a/sc/source/ui/condformat/condformateasydlg.cxx
+++ b/sc/source/ui/condformat/condformateasydlg.cxx
@@ -60,11 +60,13 @@ 
ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings,
 , mxNumberEntry(m_xBuilder->weld_spin_button("entryNumber"))
 , mxNumberEntry2(m_xBuilder->weld_spin_button("entryNumber2"))
 , mxRangeEntry(new formula::RefEdit(m_xBuilder->weld_entry("entryRange")))
+, mxButtonRangeEdit(new 
formula::RefButton(m_xBuilder->weld_button("rbassign")))
 , mxStyles(m_xBuilder->weld_combo_box("themeCombo"))
 , mxDescription(m_xBuilder->weld_label("description"))
 , mxButtonOk(m_xBuilder->weld_button("ok"))
 , mxButtonCancel(m_xBuilder->weld_button("cancel"))
 {
+mxButtonRangeEdit->SetReferences(this, mxRangeEntry.get());
 mpTabViewShell = GetTabViewShell(pBindings);
 if (!mpTabViewShell)
 mpTabViewShell = 
dynamic_cast(SfxViewShell::Current());
diff --git a/sc/source/ui/inc/condformateasydlg.hxx 
b/sc/source/ui/inc/condformateasydlg.hxx
index 001414396522..856e5fe9463f 100644
--- a/sc/source/ui/inc/condformateasydlg.hxx
+++ b/sc/source/ui/inc/condformateasydlg.hxx
@@ -43,6 +43,7 @@ private:
 std::unique_ptr mxNumberEntry;
 std::unique_ptr mxNumberEntry2;
 std::unique_ptr mxRangeEntry;
+std::unique_ptr mxButtonRangeEdit;
 std::unique_ptr mxStyles;
 std::unique_ptr mxDescription;
 std::unique_ptr mxButtonOk;
diff --git a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui 
b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
index 8f3da05b2ce8..2bee383956a9 100644
--- a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
+++ b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
@@ -68,7 +68,7 @@
 True
 False
 vertical
-12
+24
 
   
 True
@@ -79,6 +79,10 @@
   
 True
 False
+12
+12
+6
+6
 12
 
   
@@ -191,6 +195,11 @@
   
 True
 False
+12
+12
+6
+6
+12
 
   
 True
@@ -205,6 +214,24 @@
 0
   
 
+
+  
+True
+True
+True
+center
+
+  
+Click 
the Shrink icon to reduce the dialog to the size of the input field. It is then 
easier to mark the required reference in the sheet. The icons then 
automatically convert to the Maximize icon. Click it to restore the dialog to 
its original size.
+  
+
+  
+  
+False
+True
+1
+  
+
   
 
 


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-10-28 Thread Paris Oplopoios (via logerrit)
 sc/source/filter/excel/xecontent.cxx |   17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

New commits:
commit a63bd448c84c8b337b099d3b0c027f40516bc603
Author: Paris Oplopoios 
AuthorDate: Thu Oct 26 12:35:23 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Sat Oct 28 22:26:11 2023 +0200

sc: Export conditional formatting expression correctly for text rules

Text rules like BeginsWith would discard the expression if it was a
number when exporting, which is not what is supposed to happen - as
something like a conditional formatting rule BeginsWith "1" should be
valid.

Change-Id: I2d53754c462403f20b1991fa201184fcab3616a8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158440
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Paris Oplopoios 

diff --git a/sc/source/filter/excel/xecontent.cxx 
b/sc/source/filter/excel/xecontent.cxx
index 316fe673c359..71bf09cc84f5 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -1057,7 +1057,22 @@ void XclExpCFImpl::SaveXml( XclExpXmlStream& rStrm )
 // the token array for that
 std::unique_ptr 
pTokenArray(mrFormatEntry.CreateFlatCopiedTokenArray(0));
 if(pTokenArray->GetLen())
-aText = 
pTokenArray->FirstToken()->GetString().getString().toUtf8();
+{
+formula::StackVar eType = pTokenArray->FirstToken()->GetType();
+switch (eType)
+{
+case formula::svDouble:
+{
+aText = 
OString::number(pTokenArray->FirstToken()->GetDouble());
+break;
+}
+default:
+{
+aText = 
pTokenArray->FirstToken()->GetString().getString().toUtf8();
+break;
+}
+}
+}
 }
 
 sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();


[Libreoffice-commits] core.git: officecfg/registry sc/inc sc/Library_sc.mk sc/sdi sc/source sc/uiconfig sc/UIConfig_scalc.mk static/CustomTarget_emscripten_fs_image.mk

2023-10-27 Thread Paris Oplopoios (via logerrit)
 officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu |   57 ++
 officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu   |   14 
 sc/Library_sc.mk  |1 
 sc/UIConfig_scalc.mk  |2 
 sc/inc/document.hxx   |4 
 sc/inc/sc.hrc |3 
 sc/sdi/cellsh.sdi |9 
 sc/sdi/scalc.sdi  |   31 +
 sc/source/core/data/documen2.cxx  |5 
 sc/source/ui/app/scdll.cxx|1 
 sc/source/ui/condformat/condformateasydlg.cxx |  192 

 sc/source/ui/inc/condformateasydlg.hxx|   54 ++
 sc/source/ui/inc/reffact.hxx  |7 
 sc/source/ui/view/cellsh3.cxx |   20 
 sc/source/ui/view/reffact.cxx |1 
 sc/source/ui/view/tabvwsh.cxx |1 
 sc/source/ui/view/tabvwshc.cxx|6 
 sc/uiconfig/scalc/popupmenu/conditional.xml   |2 
 sc/uiconfig/scalc/popupmenu/conditional_easy.xml  |   17 
 sc/uiconfig/scalc/ui/conditionaleasydialog.ui |  237 
++
 static/CustomTarget_emscripten_fs_image.mk|2 
 21 files changed, 663 insertions(+), 3 deletions(-)

New commits:
commit 217f23f6437b1cac10fb4ea09b72fa896d46bd6b
Author: Paris Oplopoios 
AuthorDate: Mon Sep 11 23:20:50 2023 +0300
Commit: Szymon Kłos 
CommitDate: Fri Oct 27 18:15:38 2023 +0200

tdf#157930 sc: Add easy to use conditional formatting menu

Add menu options that open a dialog that can add conditional formatting
in a cell range with common options.

Change-Id: Ia54baba08e4b78c4c6e37fa7bff744af8cf06037
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156831
Tested-by: Szymon Kłos 
Reviewed-by: Szymon Kłos 

diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index 89e66c5be42e..7bd5215d627e 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -642,7 +642,7 @@
   1
 
   
-  
+  
 
   Conditional Formatting: Condition
 
@@ -653,6 +653,61 @@
   1
 
   
+  
+
+  Conditional Formatting: Greater Than
+
+
+  Greater than...
+
+
+  1
+
+  
+  
+
+  Conditional Formatting: Condition Less 
Than
+
+
+  Less than...
+
+
+  1
+
+  
+  
+
+  Conditional Formatting: Condition 
Equals
+
+
+  Equals...
+
+
+  1
+
+  
+  
+
+  Conditional Formatting: Between
+
+
+  Between...
+
+
+  1
+
+  
+  
+
+  Conditional Formatting: More Rules
+
+
+  More rules...
+
+
+  1
+
+  
   
 
   Conditional Formatting...
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
index 956b1641bb43..2d99b67a7368 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
@@ -604,6 +604,20 @@
   distributebar
 
   
+  
+
+  .uno:ConditionalFormatConditionMenu
+
+
+  com.sun.star.sheet.SpreadsheetDocument
+
+
+  com.sun.star.comp.framework.ResourceMenuController
+
+
+  conditional_easy
+
+  
 
 
   
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 2b4082d3688e..ff53d9b63ef1 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -398,6 +398,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
 sc/source/ui/condformat/condformatdlg \
 sc/source/ui/condformat/condformatdlgentry \
 sc/source/ui/condformat/condformatdlgitem \
+sc/source/ui/condformat/condformateasydlg \
 sc/source/ui/condformat/condformathelper \
 sc/source/ui/condformat/colorformat \
 sc/source/ui/dataprovider/csvdataprovider \
diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index 0b9f514d0fd5..12cc9825f0c5 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -21,6 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - officecfg/registry sc/inc sc/Library_sc.mk sc/sdi sc/source sc/uiconfig sc/UIConfig_scalc.mk static/CustomTarget_emscripten_fs_imag

2023-10-19 Thread Paris Oplopoios (via logerrit)
 officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu |   57 ++
 officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu   |   14 
 sc/Library_sc.mk  |1 
 sc/UIConfig_scalc.mk  |2 
 sc/inc/document.hxx   |4 
 sc/inc/sc.hrc |3 
 sc/sdi/cellsh.sdi |9 
 sc/sdi/scalc.sdi  |   31 +
 sc/source/core/data/documen2.cxx  |5 
 sc/source/ui/app/scdll.cxx|1 
 sc/source/ui/condformat/condformateasydlg.cxx |  192 

 sc/source/ui/inc/condformateasydlg.hxx|   54 ++
 sc/source/ui/inc/reffact.hxx  |7 
 sc/source/ui/view/cellsh3.cxx |   20 
 sc/source/ui/view/reffact.cxx |1 
 sc/source/ui/view/tabvwsh.cxx |1 
 sc/source/ui/view/tabvwshc.cxx|6 
 sc/uiconfig/scalc/popupmenu/conditional.xml   |2 
 sc/uiconfig/scalc/popupmenu/conditional_easy.xml  |   17 
 sc/uiconfig/scalc/ui/conditionaleasydialog.ui |  237 
++
 static/CustomTarget_emscripten_fs_image.mk|2 
 21 files changed, 663 insertions(+), 3 deletions(-)

New commits:
commit a9f6f63d21e368fe6bcc9080fd1ba23b0e52
Author: Paris Oplopoios 
AuthorDate: Mon Sep 11 23:20:50 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Thu Oct 19 14:09:51 2023 +0200

sc: Add easy to use conditional formatting menu

Add menu options that open a dialog that can add conditional formatting
in a cell range with common options.

Change-Id: Ia54baba08e4b78c4c6e37fa7bff744af8cf06037
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157718
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Paris Oplopoios 

diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index ccf99067b033..815151845c14 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -636,7 +636,7 @@
   1
 
   
-  
+  
 
   Conditional Formatting: Condition
 
@@ -647,6 +647,61 @@
   1
 
   
+  
+
+  Conditional Formatting: Greater Than
+
+
+  Greater than...
+
+
+  1
+
+  
+  
+
+  Conditional Formatting: Condition Less 
Than
+
+
+  Less than...
+
+
+  1
+
+  
+  
+
+  Conditional Formatting: Condition 
Equals
+
+
+  Equals...
+
+
+  1
+
+  
+  
+
+  Conditional Formatting: Between
+
+
+  Between...
+
+
+  1
+
+  
+  
+
+  Conditional Formatting: More Rules
+
+
+  More rules...
+
+
+  1
+
+  
   
 
   Conditional Formatting...
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
index de6221954ab0..2dd6eb87d620 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
@@ -548,6 +548,20 @@
   distributebar
 
   
+  
+
+  .uno:ConditionalFormatConditionMenu
+
+
+  com.sun.star.sheet.SpreadsheetDocument
+
+
+  com.sun.star.comp.framework.ResourceMenuController
+
+
+  conditional_easy
+
+  
 
 
   
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 12eab51a41d5..ec97db031a38 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -396,6 +396,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
 sc/source/ui/condformat/condformatdlg \
 sc/source/ui/condformat/condformatdlgentry \
 sc/source/ui/condformat/condformatdlgitem \
+sc/source/ui/condformat/condformateasydlg \
 sc/source/ui/condformat/condformathelper \
 sc/source/ui/condformat/colorformat \
 sc/source/ui/dataprovider/csvdataprovider \
diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index 0696cf11acda..126875711de9 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk

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

2023-10-16 Thread Paris Oplopoios (via logerrit)
 sc/source/ui/view/tabvwsh4.cxx   |6 ++
 sd/source/ui/view/drviewsa.cxx   |   10 ++
 sw/source/uibase/uiview/view.cxx |8 
 3 files changed, 24 insertions(+)

New commits:
commit e99936639379acfe7949b6b77d3b401990f50dde
Author: Paris Oplopoios 
AuthorDate: Thu Jul 20 19:49:10 2023 +0300
Commit: Caolán McNamara 
CommitDate: Mon Oct 16 20:12:39 2023 +0200

Execute notifyViewRenderState on view constructor

notifyViewRenderState should be executed as soon as a view is created in
order to give a view id to the client

Change-Id: I31b7e61599f546bd5ec134775e6235633a6526f3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154681
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Paris Oplopoios 
(cherry picked from commit 6c6bb1d434d5c0be2f71470483f3ce56f5210e01)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154709
Tested-by: Jenkins
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index d82c7e15c11c..c5fe69007fcc 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1802,6 +1802,12 @@ ScTabViewShell::ScTabViewShell( SfxViewFrame& rViewFrame,
 pInputHdl->SetMode(SC_INPUT_NONE);
 }
 }
+
+if (comphelper::LibreOfficeKit::isActive())
+{
+ScModelObj* pModel = 
comphelper::getFromUnoTunnel(GetCurrentDocument());
+SfxLokHelper::notifyViewRenderState(this, pModel);
+}
 }
 
 ScTabViewShell::~ScTabViewShell()
diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx
index 2868c38d6c90..9bc5c0030f76 100644
--- a/sd/source/ui/view/drviewsa.cxx
+++ b/sd/source/ui/view/drviewsa.cxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -64,7 +65,10 @@
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
+#include 
 #include 
 
 #include 
@@ -130,6 +134,12 @@ DrawViewShell::DrawViewShell( ViewShellBase& 
rViewShellBase, vcl::Window* pParen
 ConfigureAppBackgroundColor();
 SD_MOD()->GetColorConfig().AddListener(this);
 maViewOptions.mnDocBackgroundColor = 
SD_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor;
+
+if (comphelper::LibreOfficeKit::isActive())
+{
+SdXImpressDocument* pModel = 
comphelper::getFromUnoTunnel(rViewShellBase.GetCurrentDocument());
+SfxLokHelper::notifyViewRenderState(, pModel);
+}
 }
 
 DrawViewShell::~DrawViewShell()
diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index 85138778bf65..3bad54a839b8 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -87,6 +87,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -106,6 +107,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1113,6 +1115,12 @@ SwView::SwView(SfxViewFrame& _rFrame, SfxViewShell* 
pOldSh)
 m_aBringToAttentionBlinkTimer.SetInvokeHandler(
 LINK(this, SwView, BringToAttentionBlinkTimerHdl));
 m_aBringToAttentionBlinkTimer.SetTimeout(350);
+
+if (comphelper::LibreOfficeKit::isActive())
+{
+SwXTextDocument* pModel = 
comphelper::getFromUnoTunnel(GetCurrentDocument());
+SfxLokHelper::notifyViewRenderState(this, pModel);
+}
 }
 
 SwViewGlueDocShell::SwViewGlueDocShell(SwView& rView, SwDocShell& rDocSh)


[Libreoffice-commits] core.git: include/sfx2 sc/source sd/source sfx2/source sw/inc sw/source

2023-10-16 Thread Paris Oplopoios (via logerrit)
 include/sfx2/viewsh.hxx |2 --
 sc/source/ui/inc/tabvwsh.hxx|2 --
 sc/source/ui/view/tabvwshc.cxx  |5 -
 sd/source/ui/inc/ViewShellBase.hxx  |2 --
 sd/source/ui/view/ViewShellBase.cxx |   12 
 sfx2/source/appl/appserv.cxx|   20 ++--
 sfx2/source/view/viewsh.cxx |6 --
 sw/inc/view.hxx |2 --
 sw/inc/viewopt.hxx  |2 +-
 sw/source/core/view/vnew.cxx|   17 +
 sw/source/uibase/uiview/viewprt.cxx |   14 --
 11 files changed, 4 insertions(+), 80 deletions(-)

New commits:
commit cfba837abe3137b2bb20ddb414bb91078c4a1c9f
Author: Paris Oplopoios 
AuthorDate: Fri Oct 13 15:55:51 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Mon Oct 16 10:41:57 2023 +0200

Revert "Make sure views get new themes on .uno:ChangeTheme"

Seems to cause more issues than it solves, reverting for now

This reverts commit 884fd220d0025a92510d3ff4710c8c517c8f271e.

Change-Id: If32a9d3bd922afe5611e5258987eec9ec685bc8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157951
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index c0628a0bd4fb..14d9ca94881c 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -431,8 +431,6 @@ public:
 virtual vcl::Window* GetEditWindowForActiveOLEObj() const override;
 /// Get a color config color from this view
 virtual ::Color GetColorConfigColor(svtools::ColorConfigEntry nColorType) 
const;
-/// Get the color scheme name of this view
-virtual OUString GetColorConfigName() const;
 
 /// Set the LibreOfficeKit language of this view.
 void SetLOKLanguageTag(const OUString& rBcp47LanguageTag);
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index 3c80dbc1995d..53b093695297 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -398,8 +398,6 @@ public:
 void NotifyCursor(SfxViewShell* pViewShell) const override;
 /// See SfxViewShell::GetColorConfigColor().
 ::Color GetColorConfigColor(svtools::ColorConfigEntry nColorType) const 
override;
-/// See SfxViewShell::GetColorConfigName().
-OUString GetColorConfigName() const override;
 /// Emits a LOK_CALLBACK_INVALIDATE_HEADER for all views whose current tab 
is equal to nCurrentTabIndex
 static void notifyAllViewsHeaderInvalidation(const SfxViewShell* 
pForViewShell, HeaderType eHeaderType, SCTAB nCurrentTabIndex);
 static bool isAnyEditViewInRange(const SfxViewShell* pForViewShell, bool 
bColumns, SCCOLROW nStart, SCCOLROW nEnd);
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index 56cfba5ddfdb..bb3824d8e6a5 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -514,11 +514,6 @@ void ScTabViewShell::NotifyCursor(SfxViewShell* 
pOtherShell) const
 }
 }
 
-OUString ScTabViewShell::GetColorConfigName() const
-{
-return GetViewData().GetOptions().GetColorSchemeName();
-}
-
 css::uno::Reference 
ScTabViewShell::GetClipData(vcl::Window* pWin)
 {
 SfxViewFrame* pViewFrame = nullptr;
diff --git a/sd/source/ui/inc/ViewShellBase.hxx 
b/sd/source/ui/inc/ViewShellBase.hxx
index c2b2d16158e0..acdd244c70f3 100644
--- a/sd/source/ui/inc/ViewShellBase.hxx
+++ b/sd/source/ui/inc/ViewShellBase.hxx
@@ -221,8 +221,6 @@ public:
 void NotifyCursor(SfxViewShell* pViewShell) const override;
 /// See SfxViewShell::GetColorConfigColor().
 ::Color GetColorConfigColor(svtools::ColorConfigEntry nColorType) const 
override;
-/// See SfxViewShell::GetColorConfigName().
-OUString GetColorConfigName() const override;
 
 void setLOKVisibleArea(const ::tools::Rectangle& rArea) { maLOKVisibleArea 
= rArea; }
 virtual ::tools::Rectangle getLOKVisibleArea() const override { return 
maLOKVisibleArea; }
diff --git a/sd/source/ui/view/ViewShellBase.cxx 
b/sd/source/ui/view/ViewShellBase.cxx
index 9737245f89ff..6c083b2ef45c 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -1079,18 +1079,6 @@ void ViewShellBase::NotifyCursor(SfxViewShell* 
pOtherShell) const
 return {};
 }
 
-OUString ViewShellBase::GetColorConfigName() const
-{
-if (DrawViewShell* pCurrentDrawShell = 
dynamic_cast(GetMainViewShell().get()))
-{
-const SdViewOptions& rViewOptions = 
pCurrentDrawShell->GetViewOptions();
-return rViewOptions.msColorSchemeName;
-}
-
-SAL_WARN("sd", "dynamic_cast to DrawViewShell failed");
-return {};
-}
-
 //= ViewShellBase::Implementation =
 
 ViewShellBase::Implementation::Implementation (ViewShellBase& rBase)
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 507cc60cc672..493361fabc0f 100644
--- a/sfx2/source/appl/appserv.cxx
+++ 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - include/sfx2 sc/source sd/source sfx2/source sw/inc sw/source

2023-10-13 Thread Paris Oplopoios (via logerrit)
 include/sfx2/viewsh.hxx |2 --
 sc/source/ui/inc/tabvwsh.hxx|2 --
 sc/source/ui/view/tabvwshc.cxx  |5 -
 sd/source/ui/inc/ViewShellBase.hxx  |2 --
 sd/source/ui/view/ViewShellBase.cxx |   12 
 sfx2/source/appl/appserv.cxx|   20 ++--
 sfx2/source/view/viewsh.cxx |6 --
 sw/inc/view.hxx |2 --
 sw/inc/viewopt.hxx  |2 +-
 sw/source/core/view/vnew.cxx|   17 +
 sw/source/uibase/uiview/viewprt.cxx |   14 --
 11 files changed, 4 insertions(+), 80 deletions(-)

New commits:
commit 6ada59c8a8b5e3357577ac00c5249bb61f926a89
Author: Paris Oplopoios 
AuthorDate: Fri Oct 13 15:55:51 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Fri Oct 13 16:02:11 2023 +0200

Revert "Make sure views get new themes on .uno:ChangeTheme"

This reverts commit 884fd220d0025a92510d3ff4710c8c517c8f271e.

Change-Id: If32a9d3bd922afe5611e5258987eec9ec685bc8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157937
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Paris Oplopoios 

diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index 78f75b7067dd..2435caa52a47 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -409,8 +409,6 @@ public:
 virtual vcl::Window* GetEditWindowForActiveOLEObj() const override;
 /// Get a color config color from this view
 virtual ::Color GetColorConfigColor(svtools::ColorConfigEntry nColorType) 
const;
-/// Get the color scheme name of this view
-virtual OUString GetColorConfigName() const;
 
 /// Set the LibreOfficeKit language of this view.
 void SetLOKLanguageTag(const OUString& rBcp47LanguageTag);
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index 4bb7b79c9102..e1087d0d8b70 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -396,8 +396,6 @@ public:
 void NotifyCursor(SfxViewShell* pViewShell) const override;
 /// See SfxViewShell::GetColorConfigColor().
 ::Color GetColorConfigColor(svtools::ColorConfigEntry nColorType) const 
override;
-/// See SfxViewShell::GetColorConfigName().
-OUString GetColorConfigName() const override;
 /// Emits a LOK_CALLBACK_INVALIDATE_HEADER for all views whose current tab 
is equal to nCurrentTabIndex
 static void notifyAllViewsHeaderInvalidation(const SfxViewShell* 
pForViewShell, HeaderType eHeaderType, SCTAB nCurrentTabIndex);
 static bool isAnyEditViewInRange(const SfxViewShell* pForViewShell, bool 
bColumns, SCCOLROW nStart, SCCOLROW nEnd);
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index 517a00c8f2e1..3b50da7114cb 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -516,11 +516,6 @@ void ScTabViewShell::NotifyCursor(SfxViewShell* 
pOtherShell) const
 return {};
 }
 
-OUString ScTabViewShell::GetColorConfigName() const
-{
-return GetViewData().GetOptions().GetColorSchemeName();
-}
-
 css::uno::Reference 
ScTabViewShell::GetClipData(vcl::Window* pWin)
 {
 SfxViewFrame* pViewFrame = nullptr;
diff --git a/sd/source/ui/inc/ViewShellBase.hxx 
b/sd/source/ui/inc/ViewShellBase.hxx
index 71522c7892d4..aa0346ea5b2f 100644
--- a/sd/source/ui/inc/ViewShellBase.hxx
+++ b/sd/source/ui/inc/ViewShellBase.hxx
@@ -223,8 +223,6 @@ public:
 void NotifyCursor(SfxViewShell* pViewShell) const override;
 /// See SfxViewShell::GetColorConfigColor().
 ::Color GetColorConfigColor(svtools::ColorConfigEntry nColorType) const 
override;
-/// See SfxViewShell::GetColorConfigName().
-OUString GetColorConfigName() const override;
 
 void setLOKVisibleArea(const ::tools::Rectangle& rArea) { maLOKVisibleArea 
= rArea; }
 virtual ::tools::Rectangle getLOKVisibleArea() const override { return 
maLOKVisibleArea; }
diff --git a/sd/source/ui/view/ViewShellBase.cxx 
b/sd/source/ui/view/ViewShellBase.cxx
index 0f9123f5c374..8b88da65aa1e 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -1091,18 +1091,6 @@ void ViewShellBase::NotifyCursor(SfxViewShell* 
pOtherShell) const
 return {};
 }
 
-OUString ViewShellBase::GetColorConfigName() const
-{
-if (DrawViewShell* pCurrentDrawShell = 
dynamic_cast(GetMainViewShell().get()))
-{
-const SdViewOptions& rViewOptions = 
pCurrentDrawShell->GetViewOptions();
-return rViewOptions.msColorSchemeName;
-}
-
-SAL_WARN("sd", "dynamic_cast to DrawViewShell failed");
-return {};
-}
-
 //= ViewShellBase::Implementation =
 
 ViewShellBase::Implementation::Implementation (ViewShellBase& rBase)
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 7c322bc8109a..418bcb88430b 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -602,26 +602,10 @@ void 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - compilerplugins/clang

2023-10-03 Thread Paris Oplopoios (via logerrit)
 compilerplugins/clang/includeform.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 96e29e35b3797e00510736768aa4755424c464b1
Author: Paris Oplopoios 
AuthorDate: Tue Oct 3 10:47:42 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Tue Oct 3 11:25:18 2023 +0200

Adapt to clang 16 InclusionDirective change

Change-Id: I3e77848aa95238f141d1027223ae1bbc831ce281
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157509
Reviewed-by: Paris Oplopoios 
Tested-by: Jenkins CollaboraOffice 

diff --git a/compilerplugins/clang/includeform.cxx 
b/compilerplugins/clang/includeform.cxx
index 7b2c0feb07ea..da955c20d3bb 100644
--- a/compilerplugins/clang/includeform.cxx
+++ b/compilerplugins/clang/includeform.cxx
@@ -29,7 +29,9 @@ private:
 void InclusionDirective(
 SourceLocation HashLoc, Token const & IncludeTok, StringRef,
 bool IsAngled, CharSourceRange FilenameRange,
-#if CLANG_VERSION >= 15
+#if CLANG_VERSION >= 16
+OptionalFileEntryRef File,
+#elif CLANG_VERSION >= 15
 Optional File,
 #else
 FileEntry const * File,


[Libreoffice-commits] core.git: Branch 'libreoffice-7-6-1' - sw/source

2023-09-06 Thread Paris Oplopoios (via logerrit)
 sw/source/uibase/app/apphdl.cxx |   14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

New commits:
commit a4f1e9f65559f155659a92b0e708777fb2e0c5e1
Author: Paris Oplopoios 
AuthorDate: Mon Jun 12 00:49:27 2023 +0300
Commit: Xisco Fauli 
CommitDate: Wed Sep 6 14:33:07 2023 +0200

Fix unchecked dynamic cast

Change-Id: If662e24bb864690ead959b2599a6448d84da0de9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152866
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 
(cherry picked from commit 20a6c2df3ea899cce15775d954ffa50bb9dc81cd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156448
Reviewed-by: Ilmari Lauhakangas 
Reviewed-by: Hossein 
Tested-by: Xisco Fauli 
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index bd4cdbe28f0f..d7ab78d6e392 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -983,23 +983,27 @@ void SwModule::ConfigurationChanged( 
utl::ConfigurationBroadcaster* pBrdCst, Con
 {
 if(pViewShell->GetWindow())
 {
-auto pSwView = dynamic_cast( pViewShell );
-if(pSwView !=  nullptr ||
-   dynamic_cast< const SwPagePreview *>( pViewShell ) !=  
nullptr ||
-   dynamic_cast< const SwSrcView *>( pViewShell ) !=  nullptr)
+auto pSwView = dynamic_cast(pViewShell);
+if (pSwView)
 {
 SwViewOption aNewOptions = 
*pSwView->GetWrtShell().GetViewOptions();
 
aNewOptions.SetThemeName(svtools::ColorConfig::GetCurrentSchemeName());
 SwViewColors aViewColors(*m_pColorConfig);
 aNewOptions.SetColorConfig(aViewColors);
 pSwView->GetWrtShell().ApplyViewOptions(aNewOptions);
-pViewShell->GetWindow()->Invalidate();
+
 if (bOnlyInvalidateCurrentView)
 {
 
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR,
 
aViewColors.m_aAppBackgroundColor.AsRGBHexString().toUtf8());
 }
 }
+if(pSwView !=  nullptr ||
+   dynamic_cast< const SwPagePreview *>( pViewShell ) !=  
nullptr ||
+   dynamic_cast< const SwSrcView *>( pViewShell ) !=  nullptr)
+{
+pViewShell->GetWindow()->Invalidate();
+}
 }
 if (bOnlyInvalidateCurrentView)
 break;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/source

2023-09-04 Thread Paris Oplopoios (via logerrit)
 sw/source/uibase/app/apphdl.cxx |   14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

New commits:
commit ed191e04cb846074c4e65025405bba889751edef
Author: Paris Oplopoios 
AuthorDate: Mon Jun 12 00:49:27 2023 +0300
Commit: Xisco Fauli 
CommitDate: Mon Sep 4 12:51:08 2023 +0200

Fix unchecked dynamic cast

Change-Id: If662e24bb864690ead959b2599a6448d84da0de9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152866
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 
(cherry picked from commit 20a6c2df3ea899cce15775d954ffa50bb9dc81cd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156447
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index bd4cdbe28f0f..d7ab78d6e392 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -983,23 +983,27 @@ void SwModule::ConfigurationChanged( 
utl::ConfigurationBroadcaster* pBrdCst, Con
 {
 if(pViewShell->GetWindow())
 {
-auto pSwView = dynamic_cast( pViewShell );
-if(pSwView !=  nullptr ||
-   dynamic_cast< const SwPagePreview *>( pViewShell ) !=  
nullptr ||
-   dynamic_cast< const SwSrcView *>( pViewShell ) !=  nullptr)
+auto pSwView = dynamic_cast(pViewShell);
+if (pSwView)
 {
 SwViewOption aNewOptions = 
*pSwView->GetWrtShell().GetViewOptions();
 
aNewOptions.SetThemeName(svtools::ColorConfig::GetCurrentSchemeName());
 SwViewColors aViewColors(*m_pColorConfig);
 aNewOptions.SetColorConfig(aViewColors);
 pSwView->GetWrtShell().ApplyViewOptions(aNewOptions);
-pViewShell->GetWindow()->Invalidate();
+
 if (bOnlyInvalidateCurrentView)
 {
 
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR,
 
aViewColors.m_aAppBackgroundColor.AsRGBHexString().toUtf8());
 }
 }
+if(pSwView !=  nullptr ||
+   dynamic_cast< const SwPagePreview *>( pViewShell ) !=  
nullptr ||
+   dynamic_cast< const SwSrcView *>( pViewShell ) !=  nullptr)
+{
+pViewShell->GetWindow()->Invalidate();
+}
 }
 if (bOnlyInvalidateCurrentView)
 break;


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa sc/source

2023-08-29 Thread Paris Oplopoios (via logerrit)
 sc/qa/unit/subsequent_export_test.cxx|3 +--
 sc/source/filter/oox/sheetdatabuffer.cxx |2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

New commits:
commit f6740f0c3b9af9d6e3227e7ce0776147eb6219a9
Author: Paris Oplopoios 
AuthorDate: Mon Aug 28 20:40:33 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Tue Aug 29 09:50:15 2023 +0200

Shared string shouldn't account preserve space property

XLSX documents opened in Excel don't seem to account for the
xml:space="preserve" value for whether the string is single line or not

The test that was changed seems to have more accurate behavior now,
where the second cell does not have multiple lines (like in Excel)

Change-Id: Iad8f351c19102249e2cb1e1d063c8690dfb3d753
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156210
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Paris Oplopoios 

diff --git a/sc/qa/unit/subsequent_export_test.cxx 
b/sc/qa/unit/subsequent_export_test.cxx
index 1d4285346f61..cbbc99de69d8 100644
--- a/sc/qa/unit/subsequent_export_test.cxx
+++ b/sc/qa/unit/subsequent_export_test.cxx
@@ -3877,8 +3877,7 @@ void ScExportTest::testPreserveTextWhitespace2XLSX()
 xmlDocUniquePtr pDoc = parseExport("xl/sharedStrings.xml");
 CPPUNIT_ASSERT(pDoc);
 assertXPath(pDoc, "/x:sst/x:si[1]/x:t", "space", "preserve");
-assertXPath(pDoc, "/x:sst/x:si[2]/x:r[1]/x:t", "space", "preserve");
-assertXPath(pDoc, "/x:sst/x:si[2]/x:r[2]/x:t", "space", "preserve");
+assertXPath(pDoc, "/x:sst/x:si[2]/x:t", "space", "preserve");
 }
 
 void ScExportTest::testHiddenShapeXLS()
diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx 
b/sc/source/filter/oox/sheetdatabuffer.cxx
index 624772ef263e..1b4f9cf719d8 100644
--- a/sc/source/filter/oox/sheetdatabuffer.cxx
+++ b/sc/source/filter/oox/sheetdatabuffer.cxx
@@ -122,7 +122,7 @@ void SheetDataBuffer::setStringCell( const CellModel& 
rModel, const RichStringRe
 OSL_ENSURE( rxString, "SheetDataBuffer::setStringCell - missing rich 
string object" );
 const oox::xls::Font* pFirstPortionFont = getStyles().getFontFromCellXf( 
rModel.mnXfId ).get();
 const Xf* pXf = getStyles().getCellXf( rModel.mnXfId ).get();
-bool bSingleLine = pXf ? !rxString->isPreserveSpace() && 
!pXf->getAlignment().getModel().mbWrapText : false;
+bool bSingleLine = pXf ? !pXf->getAlignment().getModel().mbWrapText : 
false;
 OUString aText;
 if( rxString->extractPlainString( aText, pFirstPortionFont ) )
 {


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

2023-08-28 Thread Paris Oplopoios (via logerrit)
 sc/qa/unit/subsequent_export_test3.cxx   |3 +--
 sc/source/filter/oox/sheetdatabuffer.cxx |2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 16d43b7c5396d6382926d514dc9ce10b3ce94cba
Author: Paris Oplopoios 
AuthorDate: Mon Aug 28 20:40:33 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Mon Aug 28 22:12:43 2023 +0200

Shared string shouldn't account preserve space property

XLSX documents opened in Excel don't seem to account for the
xml:space="preserve" value for whether the string is single line or not

The test that was changed seems to have more accurate behavior now,
where the second cell does not have multiple lines (like in Excel)

Change-Id: Iad8f351c19102249e2cb1e1d063c8690dfb3d753
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156206
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/sc/qa/unit/subsequent_export_test3.cxx 
b/sc/qa/unit/subsequent_export_test3.cxx
index ff8a27727a1b..45e65cf8bed8 100644
--- a/sc/qa/unit/subsequent_export_test3.cxx
+++ b/sc/qa/unit/subsequent_export_test3.cxx
@@ -1424,8 +1424,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, 
testPreserveTextWhitespace2XLSX)
 xmlDocUniquePtr pDoc = parseExport("xl/sharedStrings.xml");
 CPPUNIT_ASSERT(pDoc);
 assertXPath(pDoc, "/x:sst/x:si[1]/x:t", "space", "preserve");
-assertXPath(pDoc, "/x:sst/x:si[2]/x:r[1]/x:t", "space", "preserve");
-assertXPath(pDoc, "/x:sst/x:si[2]/x:r[2]/x:t", "space", "preserve");
+assertXPath(pDoc, "/x:sst/x:si[2]/x:t", "space", "preserve");
 }
 
 CPPUNIT_TEST_FIXTURE(ScExportTest3, testHiddenShapeXLS)
diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx 
b/sc/source/filter/oox/sheetdatabuffer.cxx
index 76721ded0d17..d1410eb04970 100644
--- a/sc/source/filter/oox/sheetdatabuffer.cxx
+++ b/sc/source/filter/oox/sheetdatabuffer.cxx
@@ -122,7 +122,7 @@ void SheetDataBuffer::setStringCell( const CellModel& 
rModel, const RichStringRe
 OSL_ENSURE( rxString, "SheetDataBuffer::setStringCell - missing rich 
string object" );
 const oox::xls::Font* pFirstPortionFont = getStyles().getFontFromCellXf( 
rModel.mnXfId ).get();
 const Xf* pXf = getStyles().getCellXf( rModel.mnXfId ).get();
-bool bSingleLine = pXf ? !rxString->isPreserveSpace() && 
!pXf->getAlignment().getModel().mbWrapText : false;
+bool bSingleLine = pXf ? !pXf->getAlignment().getModel().mbWrapText : 
false;
 OUString aText;
 if( rxString->extractPlainString( aText, pFirstPortionFont ) )
 {


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa sc/source

2023-08-28 Thread Paris Oplopoios (via logerrit)
 sc/qa/unit/data/xlsx/wrap-text.xlsx   |binary
 sc/qa/unit/subsequent_export_test.cxx |   22 ++
 sc/source/filter/excel/xestyle.cxx|2 +-
 sc/source/filter/excel/xetable.cxx|2 +-
 4 files changed, 24 insertions(+), 2 deletions(-)

New commits:
commit ae730bdc0a2ee3d78ff3e0a9b47c8383840af4ee
Author: Paris Oplopoios 
AuthorDate: Wed Aug 23 12:31:15 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Mon Aug 28 15:20:40 2023 +0200

sc: Fix wrapText not being applied correctly on export

Change-Id: I03aaa36af8fe820fa07d2eea13c5b0f69ad74dad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155970
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 
(cherry picked from commit 5e8b2f0a084153ebab3355641b0aca06369baeff)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156140
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/qa/unit/data/xlsx/wrap-text.xlsx 
b/sc/qa/unit/data/xlsx/wrap-text.xlsx
new file mode 100644
index ..961cfcbdc02e
Binary files /dev/null and b/sc/qa/unit/data/xlsx/wrap-text.xlsx differ
diff --git a/sc/qa/unit/subsequent_export_test.cxx 
b/sc/qa/unit/subsequent_export_test.cxx
index 02e7c8e28c5c..1d4285346f61 100644
--- a/sc/qa/unit/subsequent_export_test.cxx
+++ b/sc/qa/unit/subsequent_export_test.cxx
@@ -98,6 +98,7 @@ public:
 void testBuiltinRangesXLSX();
 void testRichTextExportODS();
 void testRichTextCellFormatXLSX();
+void testWrapText();
 void testFormulaRefSheetNameODS();
 
 void testCellValuesExportODS();
@@ -219,6 +220,7 @@ public:
 CPPUNIT_TEST(testBuiltinRangesXLSX);
 CPPUNIT_TEST(testRichTextExportODS);
 CPPUNIT_TEST(testRichTextCellFormatXLSX);
+CPPUNIT_TEST(testWrapText);
 CPPUNIT_TEST(testFormulaRefSheetNameODS);
 CPPUNIT_TEST(testCellValuesExportODS);
 CPPUNIT_TEST(testCellNoteExportODS);
@@ -2052,6 +2054,26 @@ void ScExportTest::testRichTextCellFormatXLSX()
 assertXPath(pStyles, aXPath3, "val", "true");
 }
 
+void ScExportTest::testWrapText()
+{
+createScDoc("xlsx/wrap-text.xlsx");
+
+save("Calc Office Open XML");
+
+xmlDocUniquePtr pStyles = parseExport("xl/styles.xml");
+CPPUNIT_ASSERT(pStyles);
+
+assertXPath(pStyles, "/x:styleSheet/x:cellXfs", "count", "7");
+
+assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[1]/x:alignment", 
"wrapText", "false");
+assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[2]/x:alignment", 
"wrapText", "false");
+assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[3]/x:alignment", 
"wrapText", "false");
+assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[4]/x:alignment", 
"wrapText", "false");
+assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[5]/x:alignment", 
"wrapText", "true");
+assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[6]/x:alignment", 
"wrapText", "true");
+assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[7]/x:alignment", 
"wrapText", "true");
+}
+
 void ScExportTest::testFormulaRefSheetNameODS()
 {
 createScDoc("ods/formula-quote-in-sheet-name.ods");
diff --git a/sc/source/filter/excel/xestyle.cxx 
b/sc/source/filter/excel/xestyle.cxx
index fb580dd2e713..2a3d12d89938 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -1508,7 +1508,7 @@ bool XclExpCellAlign::FillFromItemSet(const XclRoot& 
rRoot, const SfxItemSet& rI
 case EXC_BIFF3: // attributes new in BIFF3
 {
 // text wrap
-mbLineBreak = bForceLineBreak || rItemSet.Get( ATTR_LINEBREAK 
).GetValue();
+mbLineBreak = bForceLineBreak;
 bUsed |= bForceLineBreak || ScfTools::CheckItem( rItemSet, 
ATTR_LINEBREAK, bStyle );
 
 [[fallthrough]];
diff --git a/sc/source/filter/excel/xetable.cxx 
b/sc/source/filter/excel/xetable.cxx
index e7abb111c63e..cb8a3d65d12f 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -745,7 +745,7 @@ void XclExpLabelCell::Init( const XclExpRoot& rRoot,
 if( GetXFId() == EXC_XFID_NOTFOUND )
 {
OSL_ENSURE( nXclFont != EXC_FONT_NOTFOUND, "XclExpLabelCell::Init - 
leading font not found" );
-   bool bForceLineBreak = mxText->IsWrapped();
+   bool bForceLineBreak = pPattern->GetItemSet().Get(ATTR_LINEBREAK 
).GetValue();
SetXFId( rRoot.GetXFBuffer().InsertWithFont( pPattern, 
ApiScriptType::WEAK, nXclFont, bForceLineBreak ) );
 }
 


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

2023-08-28 Thread Paris Oplopoios (via logerrit)
 sc/qa/unit/data/xlsx/wrap-text.xlsx   |binary
 sc/qa/unit/subsequent_export_test.cxx |   20 
 sc/source/filter/excel/xestyle.cxx|2 +-
 sc/source/filter/excel/xetable.cxx|2 +-
 4 files changed, 22 insertions(+), 2 deletions(-)

New commits:
commit 1760ee4d328cfb6ba22a5b3c84016625b12adb25
Author: Paris Oplopoios 
AuthorDate: Wed Aug 23 12:31:15 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Mon Aug 28 10:27:37 2023 +0200

sc: Fix wrapText not being applied correctly on export

Change-Id: I03aaa36af8fe820fa07d2eea13c5b0f69ad74dad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155970
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/sc/qa/unit/data/xlsx/wrap-text.xlsx 
b/sc/qa/unit/data/xlsx/wrap-text.xlsx
new file mode 100644
index ..961cfcbdc02e
Binary files /dev/null and b/sc/qa/unit/data/xlsx/wrap-text.xlsx differ
diff --git a/sc/qa/unit/subsequent_export_test.cxx 
b/sc/qa/unit/subsequent_export_test.cxx
index 1ce8ef99c926..60b9f9fb1c0f 100644
--- a/sc/qa/unit/subsequent_export_test.cxx
+++ b/sc/qa/unit/subsequent_export_test.cxx
@@ -1805,6 +1805,26 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, 
testRichTextCellFormatXLSX)
 assertXPath(pStyles, aXPath3, "val", "true");
 }
 
+CPPUNIT_TEST_FIXTURE(ScExportTest, testWrapText)
+{
+createScDoc("xlsx/wrap-text.xlsx");
+
+save("Calc Office Open XML");
+
+xmlDocUniquePtr pStyles = parseExport("xl/styles.xml");
+CPPUNIT_ASSERT(pStyles);
+
+assertXPath(pStyles, "/x:styleSheet/x:cellXfs", "count", "7");
+
+assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[1]/x:alignment", 
"wrapText", "false");
+assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[2]/x:alignment", 
"wrapText", "false");
+assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[3]/x:alignment", 
"wrapText", "false");
+assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[4]/x:alignment", 
"wrapText", "false");
+assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[5]/x:alignment", 
"wrapText", "true");
+assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[6]/x:alignment", 
"wrapText", "true");
+assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[7]/x:alignment", 
"wrapText", "true");
+}
+
 CPPUNIT_TEST_FIXTURE(ScExportTest, testFormulaRefSheetNameODS)
 {
 createScDoc("ods/formula-quote-in-sheet-name.ods");
diff --git a/sc/source/filter/excel/xestyle.cxx 
b/sc/source/filter/excel/xestyle.cxx
index 191dab1822d9..f7f24c17d223 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -1507,7 +1507,7 @@ bool XclExpCellAlign::FillFromItemSet(const XclRoot& 
rRoot, const SfxItemSet& rI
 case EXC_BIFF3: // attributes new in BIFF3
 {
 // text wrap
-mbLineBreak = bForceLineBreak || rItemSet.Get( ATTR_LINEBREAK 
).GetValue();
+mbLineBreak = bForceLineBreak;
 bUsed |= bForceLineBreak || ScfTools::CheckItem( rItemSet, 
ATTR_LINEBREAK, bStyle );
 
 [[fallthrough]];
diff --git a/sc/source/filter/excel/xetable.cxx 
b/sc/source/filter/excel/xetable.cxx
index 022da6cd754f..f7b9a81be9f0 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -745,7 +745,7 @@ void XclExpLabelCell::Init( const XclExpRoot& rRoot,
 if( GetXFId() == EXC_XFID_NOTFOUND )
 {
OSL_ENSURE( nXclFont != EXC_FONT_NOTFOUND, "XclExpLabelCell::Init - 
leading font not found" );
-   bool bForceLineBreak = mxText->IsWrapped();
+   bool bForceLineBreak = pPattern->GetItemSet().Get(ATTR_LINEBREAK 
).GetValue();
SetXFId( rRoot.GetXFBuffer().InsertWithFont( pPattern, 
ApiScriptType::WEAK, nXclFont, bForceLineBreak ) );
 }
 


[Libreoffice-commits] core.git: filter/Configuration_filter.mk filter/source include/vcl svx/source vcl/source

2023-08-27 Thread Paris Oplopoios (via logerrit)
 filter/Configuration_filter.mk 
 |4 +
 
filter/source/config/fragments/filters/APNG___Animated_Portable_Network_Graphic.xcu
 |   30 ++
 filter/source/config/fragments/filters/draw_apng_Export.xcu
 |   30 ++
 filter/source/config/fragments/internalgraphicfilters/apng_Export.xcu  
 |   27 +
 
filter/source/config/fragments/types/apng_Animated_Portable_Network_Graphic.xcu 
|   29 +
 include/vcl/graphicfilter.hxx  
 |1 
 svx/source/xoutdev/_xoutbmp.cxx
 |4 +
 vcl/source/filter/graphicfilter.cxx
 |   10 +++
 8 files changed, 134 insertions(+), 1 deletion(-)

New commits:
commit 01230c5c499d3f9c010b88e0b5ee9649cbe80190
Author: Paris Oplopoios 
AuthorDate: Sun Aug 20 23:04:41 2023 +0300
Commit: Tomaž Vajngerl 
CommitDate: Sun Aug 27 08:29:39 2023 +0200

Add APNG export option in File -> Export

A separate filter was made to allow for the option of exporting a still
image instead if the user wants to

Change-Id: I8140c834990e592ee579425d6cd18ae764128576
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155878
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk
index 939234b1dc15..bd3d3486234e 100644
--- a/filter/Configuration_filter.mk
+++ b/filter/Configuration_filter.mk
@@ -726,6 +726,7 @@ $(eval $(call 
filter_Configuration_add_types,fcfg_langpack,fcfg_drawgraphics_typ
 ))
 
 $(eval $(call 
filter_Configuration_add_filters,fcfg_langpack,fcfg_drawgraphics_filters.xcu,filter/source/config/fragments/filters,\
+   APNG___Animated_Portable_Network_Graphic \
BMP___MS_Windows \
DXF___AutoCAD_Interchange \
EMF___MS_Windows_Metafile \
@@ -757,6 +758,7 @@ $(eval $(call 
filter_Configuration_add_filters,fcfg_langpack,fcfg_drawgraphics_f
draw_PCD_Photo_CD_Base \
draw_PCD_Photo_CD_Base16 \
draw_PCD_Photo_CD_Base4 \
+   draw_apng_Export \
draw_bmp_Export \
draw_emf_Export \
draw_emz_Export \
@@ -845,6 +847,7 @@ $(eval $(call 
filter_Configuration_add_filters,fcfg_langpack,fcfg_calcgraphics_f
 
 # fcfg_internalgraphics
 $(eval $(call 
filter_Configuration_add_types,fcfg_langpack,fcfg_internalgraphics_types.xcu,filter/source/config/fragments/types,\
+   apng_Animated_Portable_Network_Graphic \
bmp_MS_Windows \
dxf_AutoCAD_Interchange \
emf_MS_Windows_Metafile \
@@ -878,6 +881,7 @@ $(eval $(call 
filter_Configuration_add_types,fcfg_langpack,fcfg_internalgraphics
 ))
 
 $(eval $(call 
filter_Configuration_add_internal_filters,fcfg_langpack,fcfg_internalgraphics_filters.xcu,filter/source/config/fragments/internalgraphicfilters,\
+   apng_Export \
bmp_Export \
bmp_Import \
dxf_Import \
diff --git 
a/filter/source/config/fragments/filters/APNG___Animated_Portable_Network_Graphic.xcu
 
b/filter/source/config/fragments/filters/APNG___Animated_Portable_Network_Graphic.xcu
new file mode 100644
index ..79c118c46d10
--- /dev/null
+++ 
b/filter/source/config/fragments/filters/APNG___Animated_Portable_Network_Graphic.xcu
@@ -0,0 +1,30 @@
+
+
+IMPORT ALIEN
+
+
+
+
+APNG - Animated Portable Network 
Graphics
+
+0
+apng_Animated_Portable_Network_Graphic
+
+com.sun.star.drawing.DrawingDocument
+
diff --git a/filter/source/config/fragments/filters/draw_apng_Export.xcu 
b/filter/source/config/fragments/filters/draw_apng_Export.xcu
new file mode 100644
index ..f413ca74711a
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_apng_Export.xcu
@@ -0,0 +1,30 @@
+
+
+EXPORT ALIEN 
SUPPORTSSELECTION
+com.sun.star.svtools.SvFilterOptionsDialog
+
+
+
+APNG - Animated Portable Network 
Graphics
+
+0
+apng_Animated_Portable_Network_Graphic
+
+com.sun.star.drawing.DrawingDocument
+
diff --git 
a/filter/source/config/fragments/internalgraphicfilters/apng_Export.xcu 
b/filter/source/config/fragments/internalgraphicfilters/apng_Export.xcu
new file mode 100644
index ..2bf240fa801a
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/apng_Export.xcu
@@ -0,0 +1,27 @@
+
+
+apng_Animated_Portable_Network_Graphic
+SVEAPNG
+
+com.sun.star.svtools.SvFilterOptionsDialog
+
+APNG - Animated Portable Network 
Graphics
+
+EXPORT
+
diff --git 
a/filter/source/config/fragments/types/apng_Animated_Portable_Network_Graphic.xcu
 

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

2023-08-11 Thread Paris Oplopoios (via logerrit)
 include/vcl/filter/PngImageWriter.hxx|4 
 vcl/qa/cppunit/png/PngFilterTest.cxx |   44 ++-
 vcl/source/filter/png/PngImageWriter.cxx |  184 +--
 3 files changed, 218 insertions(+), 14 deletions(-)

New commits:
commit b29769bfab386c9d56e72c4e9c9ec5abeb09eb46
Author: Paris Oplopoios 
AuthorDate: Mon Aug 7 01:52:52 2023 +0300
Commit: Tomaž Vajngerl 
CommitDate: Fri Aug 11 08:51:16 2023 +0200

Initial APNG export support

Change-Id: I27877d4bdf27cd92bdd939fd25e3820edad10f9e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155387
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/vcl/filter/PngImageWriter.hxx 
b/include/vcl/filter/PngImageWriter.hxx
index db34e0826136..b43c304fc1d8 100644
--- a/include/vcl/filter/PngImageWriter.hxx
+++ b/include/vcl/filter/PngImageWriter.hxx
@@ -12,7 +12,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #pragma once
@@ -39,7 +39,7 @@ public:
 PngImageWriter(SvStream& rStream);
 
 void setParameters(css::uno::Sequence const& 
rParameters);
-bool write(const BitmapEx& rBitmap);
+bool write(const Graphic& rGraphic);
 };
 
 } // namespace vcl
diff --git a/vcl/qa/cppunit/png/PngFilterTest.cxx 
b/vcl/qa/cppunit/png/PngFilterTest.cxx
index 8e9c15e6dd49..51833b870d05 100644
--- a/vcl/qa/cppunit/png/PngFilterTest.cxx
+++ b/vcl/qa/cppunit/png/PngFilterTest.cxx
@@ -382,12 +382,46 @@ void PngFilterTest::testApng()
 CPPUNIT_ASSERT(aGraphic.IsAnimated());
 CPPUNIT_ASSERT_EQUAL(size_t(2), 
aGraphic.GetAnimation().GetAnimationFrames().size());
 
-auto aFrame1 = aGraphic.GetAnimation().GetAnimationFrames()[0]->maBitmapEx;
-auto aFrame2 = aGraphic.GetAnimation().GetAnimationFrames()[1]->maBitmapEx;
+AnimationFrame aFrame1 = *aGraphic.GetAnimation().GetAnimationFrames()[0];
+AnimationFrame aFrame2 = *aGraphic.GetAnimation().GetAnimationFrames()[1];
 
-CPPUNIT_ASSERT_EQUAL(COL_WHITE, aFrame1.GetPixelColor(0, 0));
-CPPUNIT_ASSERT_EQUAL(Color(0x72d1c8), aFrame1.GetPixelColor(2, 2));
-CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, aFrame2.GetPixelColor(0, 0));
+CPPUNIT_ASSERT_EQUAL(COL_WHITE, aFrame1.maBitmapEx.GetPixelColor(0, 0));
+CPPUNIT_ASSERT_EQUAL(Color(0x72d1c8), aFrame1.maBitmapEx.GetPixelColor(2, 
2));
+CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, aFrame2.maBitmapEx.GetPixelColor(0, 0));
+
+// Roundtrip the APNG
+SvMemoryStream aOutStream;
+vcl::PngImageWriter aPngWriter(aOutStream);
+bSuccess = aPngWriter.write(aGraphic);
+CPPUNIT_ASSERT(bSuccess);
+
+aOutStream.Seek(STREAM_SEEK_TO_BEGIN);
+vcl::PngImageReader aPngReader2(aOutStream);
+Graphic aGraphic2;
+bSuccess = aPngReader2.read(aGraphic2);
+CPPUNIT_ASSERT(bSuccess);
+CPPUNIT_ASSERT(aGraphic2.IsAnimated());
+CPPUNIT_ASSERT_EQUAL(size_t(2), 
aGraphic2.GetAnimation().GetAnimationFrames().size());
+
+AnimationFrame aFrame1Roundtripped = 
*aGraphic2.GetAnimation().GetAnimationFrames()[0];
+AnimationFrame aFrame2Roundtripped = 
*aGraphic2.GetAnimation().GetAnimationFrames()[1];
+
+CPPUNIT_ASSERT_EQUAL(COL_WHITE, 
aFrame1Roundtripped.maBitmapEx.GetPixelColor(0, 0));
+CPPUNIT_ASSERT_EQUAL(Color(0x72d1c8), 
aFrame1Roundtripped.maBitmapEx.GetPixelColor(2, 2));
+CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, 
aFrame2Roundtripped.maBitmapEx.GetPixelColor(0, 0));
+
+// Make sure the two frames have the same properties
+CPPUNIT_ASSERT_EQUAL(aFrame1.maPositionPixel, 
aFrame1Roundtripped.maPositionPixel);
+CPPUNIT_ASSERT_EQUAL(aFrame1.maSizePixel, aFrame1Roundtripped.maSizePixel);
+CPPUNIT_ASSERT_EQUAL(aFrame1.mnWait, aFrame1Roundtripped.mnWait);
+CPPUNIT_ASSERT_EQUAL(aFrame1.meDisposal, aFrame1Roundtripped.meDisposal);
+CPPUNIT_ASSERT_EQUAL(aFrame1.meBlend, aFrame1Roundtripped.meBlend);
+
+CPPUNIT_ASSERT_EQUAL(aFrame2.maPositionPixel, 
aFrame2Roundtripped.maPositionPixel);
+CPPUNIT_ASSERT_EQUAL(aFrame2.maSizePixel, aFrame2Roundtripped.maSizePixel);
+CPPUNIT_ASSERT_EQUAL(aFrame2.mnWait, aFrame2Roundtripped.mnWait);
+CPPUNIT_ASSERT_EQUAL(aFrame2.meDisposal, aFrame2Roundtripped.meDisposal);
+CPPUNIT_ASSERT_EQUAL(aFrame2.meBlend, aFrame2Roundtripped.meBlend);
 }
 
 void PngFilterTest::testPngSuite()
diff --git a/vcl/source/filter/png/PngImageWriter.cxx 
b/vcl/source/filter/png/PngImageWriter.cxx
index 13e23fcb2e9b..09bddf7b2f58 100644
--- a/vcl/source/filter/png/PngImageWriter.cxx
+++ b/vcl/source/filter/png/PngImageWriter.cxx
@@ -11,7 +11,10 @@
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
+#include 
 
 namespace
 {
@@ -56,13 +59,80 @@ static void lclWriteStream(png_structp pPng, png_bytep 
pData, png_size_t pDataSi
 png_error(pPng, "Write Error");
 }
 
-static bool pngWrite(SvStream& rStream, const BitmapEx& rBitmapEx, int 
nCompressionLevel,
+static void writeFctlChunk(std::vector& aFctlChunk, sal_uInt32 
nSequenceNumber, Size aSize,
+   

[Libreoffice-commits] core.git: desktop/CppunitTest_desktop_lib.mk desktop/qa

2023-08-03 Thread Paris Oplopoios (via logerrit)
 desktop/CppunitTest_desktop_lib.mk  |1 
 desktop/qa/desktop_lib/test_desktop_lib.cxx |   81 
 2 files changed, 82 insertions(+)

New commits:
commit 981f0f2a661b4615ef9cc4fb24fd05087fb22c10
Author: Paris Oplopoios 
AuthorDate: Tue Aug 1 15:20:08 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Thu Aug 3 09:14:19 2023 +0200

Test paintPartTile behavior for views with different schemes

It would be the case that sometimes paintPartTile would use a different
view to draw the tiles without first checking if they have matching
schemes, which would cause bad tiles and previews

Change-Id: I3a268552132718a25eccbc4284c82dc31c6ca2fb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155154
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 
(cherry picked from commit 8b96443e6c726a707069412b77e87be5da852150)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155240
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/desktop/CppunitTest_desktop_lib.mk 
b/desktop/CppunitTest_desktop_lib.mk
index d8f58cac18da..878235d4da6f 100644
--- a/desktop/CppunitTest_desktop_lib.mk
+++ b/desktop/CppunitTest_desktop_lib.mk
@@ -26,6 +26,7 @@ $(eval $(call gb_CppunitTest_use_libraries,desktop_lib, \
sfx \
sofficeapp \
subsequenttest \
+svt \
sw \
test \
unotest \
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx 
b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 8b21f905f71d..35cbbfe60c15 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -66,6 +66,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #if USE_TLS_NSS
 #include 
@@ -186,6 +188,7 @@ public:
 void testTrackChanges();
 void testRedlineCalc();
 void testPaintPartTile();
+void testPaintPartTileDifferentSchemes();
 #if HAVE_MORE_FONTS
 void testGetFontSubset();
 #endif
@@ -257,6 +260,7 @@ public:
 CPPUNIT_TEST(testTrackChanges);
 CPPUNIT_TEST(testRedlineCalc);
 CPPUNIT_TEST(testPaintPartTile);
+CPPUNIT_TEST(testPaintPartTileDifferentSchemes);
 #if HAVE_MORE_FONTS
 CPPUNIT_TEST(testGetFontSubset);
 #endif
@@ -2304,6 +2308,83 @@ void DesktopLOKTest::testPaintPartTile()
 //CPPUNIT_ASSERT(aView1.m_bTilesInvalidated);
 }
 
+void DesktopLOKTest::testPaintPartTileDifferentSchemes()
+{
+Color aDarkColor(0x1c, 0x1c, 0x1c);
+
+// Add a minimal dark scheme
+{
+svtools::EditableColorConfig aColorConfig;
+svtools::ColorConfigValue aValue;
+aValue.bIsVisible = true;
+aValue.nColor = aDarkColor;
+aColorConfig.SetColorValue(svtools::DOCCOLOR, aValue);
+aColorConfig.AddScheme(u"Dark");
+}
+
+// Add a minimal light scheme
+{
+svtools::EditableColorConfig aColorConfig;
+svtools::ColorConfigValue aValue;
+aValue.bIsVisible = true;
+aValue.nColor = COL_WHITE;
+aColorConfig.SetColorValue(svtools::DOCCOLOR, aValue);
+aColorConfig.AddScheme(u"Light");
+}
+
+// This view will default to light scheme
+LibLODocument_Impl* pDocument = loadDoc("2slides.odp");
+pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}");
+int nView1 = pDocument->m_pDocumentClass->getView(pDocument);
+
+// Create a second view
+pDocument->m_pDocumentClass->createView(pDocument);
+pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}");
+
+// Go to the second slide in the second view
+pDocument->m_pDocumentClass->setPart(pDocument, 1);
+
+// Set to dark scheme
+{
+uno::Sequence aPropertyValues = 
comphelper::InitPropertySequence(
+{
+{ "NewTheme", uno::Any(OUString("Dark")) },
+}
+);
+dispatchCommand(mxComponent, ".uno:ChangeTheme", aPropertyValues);
+}
+
+constexpr int nCanvasWidth = 256;
+constexpr int nCanvasHeight = 256;
+
+// Just a random pixel in the middle of the canvas
+constexpr int nPixelX = 128;
+constexpr int nPixelY = 128 * nCanvasWidth;
+
+std::array aPixels;
+
+// Both parts should be painted with dark scheme
+pDocument->m_pDocumentClass->paintPartTile(pDocument, aPixels.data(), 0, 
0, nCanvasWidth, nCanvasHeight, 0, 0, nCanvasWidth, nCanvasHeight);
+Color aPixel(aPixels[nPixelX + nPixelY + 0], aPixels[nPixelX + nPixelY + 
1], aPixels[nPixelX + nPixelY + 2]);
+CPPUNIT_ASSERT_EQUAL(aDarkColor, aPixel);
+
+pDocument->m_pDocumentClass->paintPartTile(pDocument, aPixels.data(), 0, 
0, nCanvasWidth, nCanvasHeight, 0, 0, nCanvasWidth, nCanvasHeight);
+aPixel = Color(aPixels[nPixelX + nPixelY + 0], aPixels[nPixelX + nPixelY + 
1], aPixels[nPixelX + nPixelY + 2]);
+CPPUNIT_ASSERT_EQUAL(aDarkColor, aPixel);
+
+// Switch back to first view
+pDocument->m_pDocumentClass->setView(pDocument, nView1);
+
+// 

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

2023-08-02 Thread Paris Oplopoios (via logerrit)
 desktop/source/lib/init.cxx |   12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 06ebb2a0c94e89eb638b0aec3d597a83dfafd10c
Author: Paris Oplopoios 
AuthorDate: Wed Jul 26 14:19:35 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Wed Aug 2 23:39:34 2023 +0200

Compare viewRenderState before setting view on doc_paintPartTile

It shouldn't be the case that the view is changed upon painting a tile
if the new view has different view options, as it may have a different
theme (light/dark)

Change-Id: Ie218ab1ca99a588cd04e93deb7b42a18b354b811
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154940
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 
(cherry picked from commit 8e90368b55b2a8c23ccae8aa6cd1e157294a67db)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155172
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 08609ef442d9..932810fd4758 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -4118,6 +4118,8 @@ static void doc_paintPartTile(LibreOfficeKitDocument* 
pThis,
 int nViewId = nOrigViewId;
 int nLastNonEditorView = -1;
 int nViewMatchingMode = -1;
+SfxViewShell* pCurrentViewShell = SfxViewShell::Current();
+
 if (!isText)
 {
 // Check if just switching to another view is enough, that has
@@ -4129,11 +4131,16 @@ static void doc_paintPartTile(LibreOfficeKitDocument* 
pThis,
 {
 bool bIsInEdit = pViewShell->GetDrawView() &&
 pViewShell->GetDrawView()->GetTextEditOutliner();
-if (!bIsInEdit)
+
+OString sCurrentViewRenderState = 
pDoc->getViewRenderState(pCurrentViewShell);
+OString sNewRenderState = 
pDoc->getViewRenderState(pViewShell);
+
+if (sCurrentViewRenderState == sNewRenderState && 
!bIsInEdit)
 nLastNonEditorView = 
pViewShell->GetViewShellId().get();
 
 if (pViewShell->getPart() == nPart &&
 pViewShell->getEditMode() == nMode &&
+sCurrentViewRenderState == sNewRenderState &&
 !bIsInEdit)
 {
 nViewId = pViewShell->GetViewShellId().get();
@@ -4142,7 +4149,7 @@ static void doc_paintPartTile(LibreOfficeKitDocument* 
pThis,
 doc_setView(pThis, nViewId);
 break;
 }
-else if (pViewShell->getEditMode() == nMode && !bIsInEdit)
+else if (pViewShell->getEditMode() == nMode && 
sCurrentViewRenderState == sNewRenderState && !bIsInEdit)
 {
 nViewMatchingMode = pViewShell->GetViewShellId().get();
 }
@@ -4154,7 +4161,6 @@ static void doc_paintPartTile(LibreOfficeKitDocument* 
pThis,
 // if not found view with correct part
 // - at least avoid rendering active textbox, This is for Impress.
 // - prefer view with the same mode
-SfxViewShell* pCurrentViewShell = SfxViewShell::Current();
 if (nViewMatchingMode >= 0 && nViewMatchingMode != nViewId)
 {
 nViewId = nViewMatchingMode;


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - desktop/CppunitTest_desktop_lib.mk desktop/qa

2023-08-02 Thread Paris Oplopoios (via logerrit)
 desktop/CppunitTest_desktop_lib.mk  |1 
 desktop/qa/desktop_lib/test_desktop_lib.cxx |   81 
 2 files changed, 82 insertions(+)

New commits:
commit 63b7c15b537308667925d3064916b88ded985006
Author: Paris Oplopoios 
AuthorDate: Tue Aug 1 15:20:08 2023 +0300
Commit: Miklos Vajna 
CommitDate: Wed Aug 2 08:14:17 2023 +0200

Test paintPartTile behavior for views with different schemes

It would be the case that sometimes paintPartTile would use a different
view to draw the tiles without first checking if they have matching
schemes, which would cause bad tiles and previews

Change-Id: I3a268552132718a25eccbc4284c82dc31c6ca2fb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155154
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/desktop/CppunitTest_desktop_lib.mk 
b/desktop/CppunitTest_desktop_lib.mk
index d8f58cac18da..878235d4da6f 100644
--- a/desktop/CppunitTest_desktop_lib.mk
+++ b/desktop/CppunitTest_desktop_lib.mk
@@ -26,6 +26,7 @@ $(eval $(call gb_CppunitTest_use_libraries,desktop_lib, \
sfx \
sofficeapp \
subsequenttest \
+svt \
sw \
test \
unotest \
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx 
b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 3fe78d8cb2d4..fd79c43d9a1a 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -66,6 +66,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #if USE_TLS_NSS
 #include 
@@ -186,6 +188,7 @@ public:
 void testTrackChanges();
 void testRedlineCalc();
 void testPaintPartTile();
+void testPaintPartTileDifferentSchemes();
 #if HAVE_MORE_FONTS
 void testGetFontSubset();
 #endif
@@ -255,6 +258,7 @@ public:
 CPPUNIT_TEST(testTrackChanges);
 CPPUNIT_TEST(testRedlineCalc);
 CPPUNIT_TEST(testPaintPartTile);
+CPPUNIT_TEST(testPaintPartTileDifferentSchemes);
 #if HAVE_MORE_FONTS
 CPPUNIT_TEST(testGetFontSubset);
 #endif
@@ -2303,6 +2307,83 @@ void DesktopLOKTest::testPaintPartTile()
 //CPPUNIT_ASSERT(aView1.m_bTilesInvalidated);
 }
 
+void DesktopLOKTest::testPaintPartTileDifferentSchemes()
+{
+Color aDarkColor = Color(0x1c, 0x1c, 0x1c);
+
+// Add a minimal dark scheme
+{
+svtools::EditableColorConfig aColorConfig;
+svtools::ColorConfigValue aValue;
+aValue.bIsVisible = true;
+aValue.nColor = aDarkColor;
+aColorConfig.SetColorValue(svtools::DOCCOLOR, aValue);
+aColorConfig.AddScheme(u"Dark");
+}
+
+// Add a minimal light scheme
+{
+svtools::EditableColorConfig aColorConfig;
+svtools::ColorConfigValue aValue;
+aValue.bIsVisible = true;
+aValue.nColor = COL_WHITE;
+aColorConfig.SetColorValue(svtools::DOCCOLOR, aValue);
+aColorConfig.AddScheme(u"Light");
+}
+
+// This view will default to light scheme
+LibLODocument_Impl* pDocument = loadDoc("2slides.odp");
+pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}");
+int nView1 = pDocument->m_pDocumentClass->getView(pDocument);
+
+// Create a second view
+pDocument->m_pDocumentClass->createView(pDocument);
+pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}");
+
+// Go to the second slide in the second view
+pDocument->m_pDocumentClass->setPart(pDocument, 1);
+
+// Set to dark scheme
+{
+uno::Sequence aPropertyValues = 
comphelper::InitPropertySequence(
+{
+{ "NewTheme", uno::Any(OUString("Dark")) },
+}
+);
+dispatchCommand(mxComponent, ".uno:ChangeTheme", aPropertyValues);
+}
+
+constexpr int nCanvasWidth = 256;
+constexpr int nCanvasHeight = 256;
+
+// Just a random pixel in the middle of the canvas
+constexpr int nPixelX = 128;
+constexpr int nPixelY = 128 * nCanvasWidth;
+
+std::array aPixels;
+
+// Both parts should be painted with dark scheme
+pDocument->m_pDocumentClass->paintPartTile(pDocument, aPixels.data(), 0, 
0, nCanvasWidth, nCanvasHeight, 0, 0, nCanvasWidth, nCanvasHeight);
+Color aPixel(aPixels[nPixelX + nPixelY + 0], aPixels[nPixelX + nPixelY + 
1], aPixels[nPixelX + nPixelY + 2]);
+CPPUNIT_ASSERT_EQUAL(aDarkColor, aPixel);
+
+pDocument->m_pDocumentClass->paintPartTile(pDocument, aPixels.data(), 0, 
0, nCanvasWidth, nCanvasHeight, 0, 0, nCanvasWidth, nCanvasHeight);
+aPixel = Color(aPixels[nPixelX + nPixelY + 0], aPixels[nPixelX + nPixelY + 
1], aPixels[nPixelX + nPixelY + 2]);
+CPPUNIT_ASSERT_EQUAL(aDarkColor, aPixel);
+
+// Switch back to first view
+pDocument->m_pDocumentClass->setView(pDocument, nView1);
+
+// Both parts should be painted with light scheme
+pDocument->m_pDocumentClass->paintPartTile(pDocument, aPixels.data(), 0, 
0, nCanvasWidth, nCanvasHeight, 0, 0, nCanvasWidth, 

[Libreoffice-commits] core.git: include/vcl sc/inc sc/source sd/source sw/inc sw/source

2023-08-01 Thread Paris Oplopoios (via logerrit)
 include/vcl/ITiledRenderable.hxx  |4 +++-
 sc/inc/docuno.hxx |2 +-
 sc/source/ui/unoobj/docuno.cxx|   15 +--
 sd/source/ui/inc/unomodel.hxx |2 +-
 sd/source/ui/unoidl/unomodel.cxx  |   15 +--
 sw/inc/unotxdoc.hxx   |2 +-
 sw/source/uibase/uno/unotxdoc.cxx |4 ++--
 7 files changed, 34 insertions(+), 10 deletions(-)

New commits:
commit 0004de149269ed2ab5423947b9930653f3da6038
Author: Paris Oplopoios 
AuthorDate: Wed Jul 26 17:20:59 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Tue Aug 1 13:49:06 2023 +0200

Allow getViewRenderState to get from a specific view

getViewRenderState would get its output from the current view, make it
so that it's possible to specify a specific view

Change-Id: I279b215f8311b079c220c79b8b41c76bc0210154
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154943
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 
(cherry picked from commit eff5643dbc5bb9dfede530e8e07261bb9bdc98f0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155046
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index 9fa61258fc7a..9b76eb11200e 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -10,6 +10,7 @@
 
 #pragma once
 
+#include 
 #include 
 #include 
 #include 
@@ -380,8 +381,9 @@ public:
 /**
  * Returns an opaque string reflecting the render state of a component
  * eg. 'PD' - P for non-printing-characters, D for dark-mode.
+ * @param pViewShell the view to get the options from, if nullptr the 
current view shell is used
  */
-virtual OString getViewRenderState() { return rtl::OString(); }
+virtual OString getViewRenderState(SfxViewShell* = nullptr) { return 
rtl::OString(); }
 };
 } // namespace vcl
 
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index a75afa2834df..611b0c22d2b9 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -396,7 +396,7 @@ public:
 virtual void completeFunction(const OUString& rFunctionName) override;
 
 /// @see vcl::ITiledRenderable::getViewRenderState().
-OString getViewRenderState() override;
+OString getViewRenderState(SfxViewShell* pViewShell = nullptr) override;
 
 private:
 Size getDocumentSize(SCCOL& rnTiledRenderingAreaEndCol, SCROW& 
rnTiledRenderingAreaEndRow );
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 66c2667a1a1f..fe1cf4dbe6b3 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1254,10 +1254,21 @@ void ScModelObj::completeFunction(const OUString& 
rFunctionName)
 }
 }
 
-OString ScModelObj::getViewRenderState()
+OString ScModelObj::getViewRenderState(SfxViewShell* pViewShell)
 {
 OStringBuffer aState;
-ScViewData* pViewData = ScDocShell::GetViewData();
+ScViewData* pViewData = nullptr;
+
+if (pViewShell)
+{
+ScTabViewShell* pTabViewShell = dynamic_cast< 
ScTabViewShell*>(pViewShell);
+if (pTabViewShell)
+pViewData = >GetViewData();
+}
+else
+{
+pViewData = ScDocShell::GetViewData();
+}
 
 if (pViewData)
 {
diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index 008c9459e1c4..e0fa051d8826 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -285,7 +285,7 @@ public:
 virtual void setPaintTextEdit(bool bPaint) override { mbPaintTextEdit = 
bPaint; }
 
 /// @see vcl::ITiledRenderable::getViewRenderState().
-OString getViewRenderState() override;
+OString getViewRenderState(SfxViewShell* pViewShell = nullptr) override;
 
 // XComponent
 
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 9f906dc404a0..789f419716f8 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2326,10 +2326,21 @@ void SdXImpressDocument::paintTile( VirtualDevice& 
rDevice,
 comphelper::LibreOfficeKit::setTiledPainting(false);
 }
 
-OString SdXImpressDocument::getViewRenderState()
+OString SdXImpressDocument::getViewRenderState(SfxViewShell* pViewShell)
 {
 OStringBuffer aState;
-DrawViewShell* pView = GetViewShell();
+DrawViewShell* pView = nullptr;
+
+if (pViewShell)
+{
+ViewShellBase* pShellBase = dynamic_cast(pViewShell);
+pView = 
dynamic_cast(pShellBase->GetMainViewShell().get());
+}
+else
+{
+pView = GetViewShell();
+}
+
 if (pView)
 {
 const SdViewOptions& pVOpt = pView->GetViewOptions();
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 056013d75056..01619df1d382 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -463,7 +463,7 @@ public:
 void getCommandValues(tools::JsonWriter& rJsonWriter, std::string_view 
rCommand) override;
 
 /// @see 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - desktop/source

2023-08-01 Thread Paris Oplopoios (via logerrit)
 desktop/source/lib/init.cxx |   12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

New commits:
commit d13b5f4d2eaa63cb94ba9e3603d49afa8ecf7c65
Author: Paris Oplopoios 
AuthorDate: Wed Jul 26 14:19:35 2023 +0300
Commit: Miklos Vajna 
CommitDate: Tue Aug 1 09:09:31 2023 +0200

Compare viewRenderState before setting view on doc_paintPartTile

It shouldn't be the case that the view is changed upon painting a tile
if the new view has different view options, as it may have a different
theme (light/dark)

Change-Id: Ie218ab1ca99a588cd04e93deb7b42a18b354b811
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154940
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 112b134b5e84..62107c0f7e57 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -4156,6 +4156,8 @@ static void doc_paintPartTile(LibreOfficeKitDocument* 
pThis,
 int nViewId = nOrigViewId;
 int nLastNonEditorView = -1;
 int nViewMatchingMode = -1;
+SfxViewShell* pCurrentViewShell = SfxViewShell::Current();
+
 if (!isText)
 {
 // Check if just switching to another view is enough, that has
@@ -4167,11 +4169,16 @@ static void doc_paintPartTile(LibreOfficeKitDocument* 
pThis,
 {
 bool bIsInEdit = pViewShell->GetDrawView() &&
 pViewShell->GetDrawView()->GetTextEditOutliner();
-if (!bIsInEdit)
+
+OString sCurrentViewRenderState = 
pDoc->getViewRenderState(pCurrentViewShell);
+OString sNewRenderState = 
pDoc->getViewRenderState(pViewShell);
+
+if (sCurrentViewRenderState == sNewRenderState && 
!bIsInEdit)
 nLastNonEditorView = 
pViewShell->GetViewShellId().get();
 
 if (pViewShell->getPart() == nPart &&
 pViewShell->getEditMode() == nMode &&
+sCurrentViewRenderState == sNewRenderState &&
 !bIsInEdit)
 {
 nViewId = pViewShell->GetViewShellId().get();
@@ -4180,7 +4187,7 @@ static void doc_paintPartTile(LibreOfficeKitDocument* 
pThis,
 doc_setView(pThis, nViewId);
 break;
 }
-else if (pViewShell->getEditMode() == nMode && !bIsInEdit)
+else if (pViewShell->getEditMode() == nMode && 
sCurrentViewRenderState == sNewRenderState && !bIsInEdit)
 {
 nViewMatchingMode = pViewShell->GetViewShellId().get();
 }
@@ -4192,7 +4199,6 @@ static void doc_paintPartTile(LibreOfficeKitDocument* 
pThis,
 // if not found view with correct part
 // - at least avoid rendering active textbox, This is for Impress.
 // - prefer view with the same mode
-SfxViewShell* pCurrentViewShell = SfxViewShell::Current();
 if (nViewMatchingMode >= 0 && nViewMatchingMode != nViewId)
 {
 nViewId = nViewMatchingMode;


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - include/vcl sc/inc sc/source sd/source sw/inc sw/source

2023-07-31 Thread Paris Oplopoios (via logerrit)
 include/vcl/ITiledRenderable.hxx  |4 +++-
 sc/inc/docuno.hxx |2 +-
 sc/source/ui/unoobj/docuno.cxx|   15 +--
 sd/source/ui/inc/unomodel.hxx |2 +-
 sd/source/ui/unoidl/unomodel.cxx  |   15 +--
 sw/inc/unotxdoc.hxx   |2 +-
 sw/source/uibase/uno/unotxdoc.cxx |4 ++--
 7 files changed, 34 insertions(+), 10 deletions(-)

New commits:
commit 89208096888a22274d4c3e9ab79d897d40ac
Author: Paris Oplopoios 
AuthorDate: Wed Jul 26 17:20:59 2023 +0300
Commit: Miklos Vajna 
CommitDate: Mon Jul 31 09:33:11 2023 +0200

Allow getViewRenderState to get from a specific view

getViewRenderState would get its output from the current view, make it
so that it's possible to specify a specific view

Change-Id: I279b215f8311b079c220c79b8b41c76bc0210154
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154943
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index 9fa61258fc7a..9b76eb11200e 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -10,6 +10,7 @@
 
 #pragma once
 
+#include 
 #include 
 #include 
 #include 
@@ -380,8 +381,9 @@ public:
 /**
  * Returns an opaque string reflecting the render state of a component
  * eg. 'PD' - P for non-printing-characters, D for dark-mode.
+ * @param pViewShell the view to get the options from, if nullptr the 
current view shell is used
  */
-virtual OString getViewRenderState() { return rtl::OString(); }
+virtual OString getViewRenderState(SfxViewShell* = nullptr) { return 
rtl::OString(); }
 };
 } // namespace vcl
 
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index a75afa2834df..611b0c22d2b9 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -396,7 +396,7 @@ public:
 virtual void completeFunction(const OUString& rFunctionName) override;
 
 /// @see vcl::ITiledRenderable::getViewRenderState().
-OString getViewRenderState() override;
+OString getViewRenderState(SfxViewShell* pViewShell = nullptr) override;
 
 private:
 Size getDocumentSize(SCCOL& rnTiledRenderingAreaEndCol, SCROW& 
rnTiledRenderingAreaEndRow );
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index ca5f80eee2c0..971c75b22c22 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1254,10 +1254,21 @@ void ScModelObj::completeFunction(const OUString& 
rFunctionName)
 }
 }
 
-OString ScModelObj::getViewRenderState()
+OString ScModelObj::getViewRenderState(SfxViewShell* pViewShell)
 {
 OStringBuffer aState;
-ScViewData* pViewData = ScDocShell::GetViewData();
+ScViewData* pViewData = nullptr;
+
+if (pViewShell)
+{
+ScTabViewShell* pTabViewShell = dynamic_cast< 
ScTabViewShell*>(pViewShell);
+if (pTabViewShell)
+pViewData = >GetViewData();
+}
+else
+{
+pViewData = ScDocShell::GetViewData();
+}
 
 if (pViewData)
 {
diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index 3b00f1cb8d90..a2fe9415afa4 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -285,7 +285,7 @@ public:
 virtual void setPaintTextEdit(bool bPaint) override { mbPaintTextEdit = 
bPaint; }
 
 /// @see vcl::ITiledRenderable::getViewRenderState().
-OString getViewRenderState() override;
+OString getViewRenderState(SfxViewShell* pViewShell = nullptr) override;
 
 // XComponent
 
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 438d2a81faa0..6fc250ec8895 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2325,10 +2325,21 @@ void SdXImpressDocument::paintTile( VirtualDevice& 
rDevice,
 comphelper::LibreOfficeKit::setTiledPainting(false);
 }
 
-OString SdXImpressDocument::getViewRenderState()
+OString SdXImpressDocument::getViewRenderState(SfxViewShell* pViewShell)
 {
 OStringBuffer aState;
-DrawViewShell* pView = GetViewShell();
+DrawViewShell* pView = nullptr;
+
+if (pViewShell)
+{
+ViewShellBase* pShellBase = dynamic_cast(pViewShell);
+pView = 
dynamic_cast(pShellBase->GetMainViewShell().get());
+}
+else
+{
+pView = GetViewShell();
+}
+
 if (pView)
 {
 const SdViewOptions& pVOpt = pView->GetViewOptions();
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 056013d75056..01619df1d382 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -463,7 +463,7 @@ public:
 void getCommandValues(tools::JsonWriter& rJsonWriter, std::string_view 
rCommand) override;
 
 /// @see vcl::ITiledRenderable::getViewRenderState().
-OString getViewRenderState() override;
+OString getViewRenderState(SfxViewShell* pViewShell = nullptr) override;
 
 /// @see 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/qa sw/source

2023-07-30 Thread Paris Oplopoios (via logerrit)
 dev/null |binary
 sw/qa/extras/ww8import/ww8import.cxx |   24 
 sw/source/filter/ww8/ww8par.cxx  |3 ---
 3 files changed, 27 deletions(-)

New commits:
commit 4065aaacffc0eef12f4e974def3e1ed1ddebd38b
Author: Paris Oplopoios 
AuthorDate: Tue Jul 18 01:58:14 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Sun Jul 30 14:20:49 2023 +0200

Revert "ww8import create a pagedesc if continuous section changes margins"

This reverts commit c5ed52b1cd6f22787c94bec035ceecf9e1da3271.

The reverted commit would insert a pagebreak on section breaks if the
margin before and after the section break was different. While this
means a table after the section break will get the correct margin, it
would also create a page which is very breaking - it shouldn't be the
case in documents that have multiple continuous section breaks in a
single page that a new page is created for each of those breaks if the
margins are different - there are documents where this happens and in
those documents a single page gets converted to multiple messy pages.
Thus the table margins being correct after a section break with a margin
change should be fixed in a different way.

Change-Id: Ia5d5b98ddbd021803a6a9f80762b97db5808509f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154565
Tested-by: Jenkins
Tested-by: Paris Oplopoios 
Reviewed-by: Paris Oplopoios 
(cherry picked from commit df00cd5cf77eb2322f53b80296862940ba815d9a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154624
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/qa/extras/ww8import/data/floating-table-section-margins.doc 
b/sw/qa/extras/ww8import/data/floating-table-section-margins.doc
deleted file mode 100644
index f414be7f1ec8..
Binary files a/sw/qa/extras/ww8import/data/floating-table-section-margins.doc 
and /dev/null differ
diff --git a/sw/qa/extras/ww8import/ww8import.cxx 
b/sw/qa/extras/ww8import/ww8import.cxx
index f5f679da1f04..47a9e41f5352 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -37,30 +37,6 @@ public:
 }
 };
 
-CPPUNIT_TEST_FIXTURE(Test, testFloatingTableSectionMargins)
-{
-createSwDoc("floating-table-section-margins.doc");
-sal_Int32 pageLeft = parseDump("/root/page[2]/infos/bounds", 
"left").toInt32();
-sal_Int32 pageWidth = parseDump("/root/page[2]/infos/bounds", 
"width").toInt32();
-sal_Int32 tableLeft = parseDump("//tab/infos/bounds", "left").toInt32();
-sal_Int32 tableWidth = parseDump("//tab/infos/bounds", "width").toInt32();
-CPPUNIT_ASSERT( pageWidth > 0 );
-CPPUNIT_ASSERT( tableWidth > 0 );
-// The table's resulting position should be roughly centered.
-CPPUNIT_ASSERT( abs(( pageLeft + pageWidth / 2 ) - ( tableLeft + 
tableWidth / 2 )) < 20 );
-
-uno::Reference xTextSection = getProperty< 
uno::Reference >(getParagraph(2), "TextSection");
-CPPUNIT_ASSERT(xTextSection.is());
-uno::Reference xTextColumns = getProperty< 
uno::Reference >(xTextSection, "TextColumns");
-OUString pageStyleName = getProperty(getParagraph(2), 
"PageStyleName");
-uno::Reference pageStyle( 
getStyles("PageStyles")->getByName(pageStyleName), uno::UNO_QUERY);
-uno::Reference 
xPageStyle(getStyles("PageStyles")->getByName(pageStyleName), uno::UNO_QUERY);
-uno::Reference xPageColumns = getProperty< 
uno::Reference >(xPageStyle, "TextColumns");
-
-//either one or the other should get the column's, not both.
-CPPUNIT_ASSERT( xTextColumns->getColumnCount() != 
xPageColumns->getColumnCount());
-}
-
 CPPUNIT_TEST_FIXTURE(Test, testN816593)
 {
 createSwDoc("n816593.doc");
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 7bc6170730f4..80c6938f72a7 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -4481,9 +4481,6 @@ void wwSectionManager::InsertSegments()
 
 bool bInsertSection = (aIter != aStart) && aIter->IsContinuous() &&  
bThisAndPreviousAreCompatible;
 bool bInsertPageDesc = !bInsertSection;
-// HACK Force new pagedesc if left/right margins change, otherwise 
e.g. floating tables may be anchored improperly.
-if( aIter->maSep.dxaLeft != aPrev->maSep.dxaLeft || 
aIter->maSep.dxaRight != aPrev->maSep.dxaRight )
-bInsertPageDesc = true;
 bool bProtected = SectionIsProtected(*aIter); // do we really  need 
this ?? I guess I have a different logic in editshell which disables this...
 
 if (bInsertPageDesc)


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source sd/source sw/source

2023-07-21 Thread Paris Oplopoios (via logerrit)
 sc/source/ui/view/tabvwsh4.cxx   |6 ++
 sd/source/ui/view/drviewsa.cxx   |   10 ++
 sw/source/uibase/uiview/view.cxx |8 
 3 files changed, 24 insertions(+)

New commits:
commit 6c6bb1d434d5c0be2f71470483f3ce56f5210e01
Author: Paris Oplopoios 
AuthorDate: Thu Jul 20 19:49:10 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Sat Jul 22 01:26:20 2023 +0200

Execute notifyViewRenderState on view constructor

notifyViewRenderState should be executed as soon as a view is created in
order to give a view id to the client

Change-Id: I31b7e61599f546bd5ec134775e6235633a6526f3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154681
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Paris Oplopoios 

diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index c0a8ae702257..071017d5da43 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1805,6 +1805,12 @@ ScTabViewShell::ScTabViewShell( SfxViewFrame* pViewFrame,
 pInputHdl->SetMode(SC_INPUT_NONE);
 }
 }
+
+if (comphelper::LibreOfficeKit::isActive())
+{
+ScModelObj* pModel = 
comphelper::getFromUnoTunnel(GetCurrentDocument());
+SfxLokHelper::notifyViewRenderState(this, pModel);
+}
 }
 
 ScTabViewShell::~ScTabViewShell()
diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx
index 2716bd489ab1..55842c90bdf1 100644
--- a/sd/source/ui/view/drviewsa.cxx
+++ b/sd/source/ui/view/drviewsa.cxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -64,7 +65,10 @@
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
+#include 
 #include 
 
 #include 
@@ -130,6 +134,12 @@ DrawViewShell::DrawViewShell( ViewShellBase& 
rViewShellBase, vcl::Window* pParen
 ConfigureAppBackgroundColor();
 SD_MOD()->GetColorConfig().AddListener(this);
 maViewOptions.mnDocBackgroundColor = 
SD_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor;
+
+if (comphelper::LibreOfficeKit::isActive())
+{
+SdXImpressDocument* pModel = 
comphelper::getFromUnoTunnel(rViewShellBase.GetCurrentDocument());
+SfxLokHelper::notifyViewRenderState(, pModel);
+}
 }
 
 DrawViewShell::~DrawViewShell()
diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index aff4bb710ade..94d97d8cb07a 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -87,6 +87,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -106,6 +107,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1091,6 +1093,12 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* 
pOldSh )
 m_pWrtShell->InvalidateOutlineContentVisibility();
 
 GetViewFrame()->GetWindow().AddChildEventListener( LINK( this, SwView, 
WindowChildEventListener ) );
+
+if (comphelper::LibreOfficeKit::isActive())
+{
+SwXTextDocument* pModel = 
comphelper::getFromUnoTunnel(GetCurrentDocument());
+SfxLokHelper::notifyViewRenderState(this, pModel);
+}
 }
 
 SwViewGlueDocShell::SwViewGlueDocShell(SwView& rView, SwDocShell& rDocSh)


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

2023-07-19 Thread Paris Oplopoios (via logerrit)
 sw/qa/extras/ww8export/data/continuous-sections.doc |binary
 sw/qa/extras/ww8export/data/inlinePageBreakFirstLine.doc|binary
 sw/qa/extras/ww8export/data/nonInlinePageBreakFirstLine.doc |binary
 sw/qa/extras/ww8export/ww8export.cxx|   11 ++
 sw/qa/extras/ww8export/ww8export4.cxx   |   61 
 sw/source/filter/ww8/ww8par.cxx |5 
 6 files changed, 76 insertions(+), 1 deletion(-)

New commits:
commit 6819adb7a66a162f5be40990ea62689cd58f7c8b
Author: Paris Oplopoios 
AuthorDate: Tue Jul 18 17:23:12 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Wed Jul 19 14:19:37 2023 +0200

sw: Add test for continuous section breaks not adding page breaks

Change-Id: I1dbaa0075ff33012c7cc94f1aa82dd992dd0e680
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154588
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/sw/qa/extras/ww8export/data/continuous-sections.doc 
b/sw/qa/extras/ww8export/data/continuous-sections.doc
new file mode 100644
index ..cf466c9e7286
Binary files /dev/null and 
b/sw/qa/extras/ww8export/data/continuous-sections.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export.cxx 
b/sw/qa/extras/ww8export/ww8export.cxx
index 616df9bb9189..f767d51bbe96 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -1571,6 +1571,17 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf99474)
 CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty(xStyle, "CharColor"));
 }
 
+DECLARE_WW8EXPORT_TEST(testContinuousSectionsNoPageBreak, 
"continuous-sections.doc")
+{
+SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
+CPPUNIT_ASSERT(pDoc);
+
+// Continuous section breaks should not add new pages
+CPPUNIT_ASSERT_EQUAL(size_t(1), pDoc->GetPageDescCnt());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit b33e485b1dc9aec04a8899671abf5397face30cd
Author: Paris Oplopoios 
AuthorDate: Wed Jul 12 16:56:25 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Wed Jul 19 14:19:28 2023 +0200

Fix inline page breaks not imported correctly from .doc files

The way we handle page breaks is by creating new paragraphs. This
visually looks fine until the imported file has stuff like first line
indentation.

Change-Id: I26d5bbc1ce8b0ff4492b099305f0ff22de41e4cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154358
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/sw/qa/extras/ww8export/data/inlinePageBreakFirstLine.doc 
b/sw/qa/extras/ww8export/data/inlinePageBreakFirstLine.doc
new file mode 100644
index ..4f339511d664
Binary files /dev/null and 
b/sw/qa/extras/ww8export/data/inlinePageBreakFirstLine.doc differ
diff --git a/sw/qa/extras/ww8export/data/nonInlinePageBreakFirstLine.doc 
b/sw/qa/extras/ww8export/data/nonInlinePageBreakFirstLine.doc
new file mode 100644
index ..5351a9edecc7
Binary files /dev/null and 
b/sw/qa/extras/ww8export/data/nonInlinePageBreakFirstLine.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export4.cxx 
b/sw/qa/extras/ww8export/ww8export4.cxx
index 7e3042aefab2..459daa69ec81 100644
--- a/sw/qa/extras/ww8export/ww8export4.cxx
+++ b/sw/qa/extras/ww8export/ww8export4.cxx
@@ -25,6 +25,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 class Test : public SwModelTestBase
 {
@@ -142,6 +144,65 @@ CPPUNIT_TEST_FIXTURE(Test, testDontBreakWrappedTables)
 CPPUNIT_ASSERT(bDontBreakWrappedTables);
 }
 
+static bool IsFirstLine(const SwTextNode* pTextNode)
+{
+const SfxPoolItem* pItem = pTextNode->GetNoCondAttr(RES_MARGIN_FIRSTLINE, 
false);
+return !!pItem;
+}
+
+DECLARE_WW8EXPORT_TEST(testInlinePageBreakFirstLine, 
"inlinePageBreakFirstLine.doc")
+{
+SwDoc* pDoc = getSwDoc();
+const SwNodes& rNodes = pDoc->GetNodes();
+
+std::vector aTextNodes;
+
+for (SwNodeOffset nNode(0); nNode < rNodes.Count(); ++nNode)
+{
+SwNode* pNode = pDoc->GetNodes()[nNode];
+SwTextNode* pTextNode = pNode->GetTextNode();
+if (!pTextNode)
+continue;
+aTextNodes.push_back(pTextNode);
+}
+
+CPPUNIT_ASSERT_EQUAL(size_t(3), aTextNodes.size());
+CPPUNIT_ASSERT_EQUAL(OUString("First line"), aTextNodes[0]->GetText());
+CPPUNIT_ASSERT(IsFirstLine(aTextNodes[0]));
+// Here exists an inline pagebreak (a pagebreak without a paragraph before 
it)
+// This text node is not indented because it is not the first line of the 
paragraph
+CPPUNIT_ASSERT_EQUAL(OUString("Should not be indented"), 
aTextNodes[1]->GetText());
+CPPUNIT_ASSERT(!IsFirstLine(aTextNodes[1]));
+// Here is the actual second paragraph
+CPPUNIT_ASSERT_EQUAL(OUString("Should be indented"), 
aTextNodes[2]->GetText());
+

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

2023-07-18 Thread Paris Oplopoios (via logerrit)
 dev/null |binary
 sw/qa/extras/ww8import/ww8import.cxx |   23 ---
 sw/source/filter/ww8/ww8par.cxx  |3 ---
 3 files changed, 26 deletions(-)

New commits:
commit df00cd5cf77eb2322f53b80296862940ba815d9a
Author: Paris Oplopoios 
AuthorDate: Tue Jul 18 01:58:14 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Tue Jul 18 17:54:37 2023 +0200

Revert "ww8import create a pagedesc if continuous section changes margins"

This reverts commit c5ed52b1cd6f22787c94bec035ceecf9e1da3271.

The reverted commit would insert a pagebreak on section breaks if the
margin before and after the section break was different. While this
means a table after the section break will get the correct margin, it
would also create a page which is very breaking - it shouldn't be the
case in documents that have multiple continuous section breaks in a
single page that a new page is created for each of those breaks if the
margins are different - there are documents where this happens and in
those documents a single page gets converted to multiple messy pages.
Thus the table margins being correct after a section break with a margin
change should be fixed in a different way.

Change-Id: Ia5d5b98ddbd021803a6a9f80762b97db5808509f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154565
Tested-by: Jenkins
Tested-by: Paris Oplopoios 
Reviewed-by: Paris Oplopoios 

diff --git a/sw/qa/extras/ww8import/data/floating-table-section-margins.doc 
b/sw/qa/extras/ww8import/data/floating-table-section-margins.doc
deleted file mode 100644
index f414be7f1ec8..
Binary files a/sw/qa/extras/ww8import/data/floating-table-section-margins.doc 
and /dev/null differ
diff --git a/sw/qa/extras/ww8import/ww8import.cxx 
b/sw/qa/extras/ww8import/ww8import.cxx
index 82b4c74253dd..47a9e41f5352 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -37,29 +37,6 @@ public:
 }
 };
 
-CPPUNIT_TEST_FIXTURE(Test, testFloatingTableSectionMargins)
-{
-createSwDoc("floating-table-section-margins.doc");
-sal_Int32 pageLeft = parseDump("/root/page[2]/infos/bounds", 
"left").toInt32();
-sal_Int32 pageWidth = parseDump("/root/page[2]/infos/bounds", 
"width").toInt32();
-sal_Int32 tableLeft = parseDump("//tab/infos/bounds", "left").toInt32();
-sal_Int32 tableWidth = parseDump("//tab/infos/bounds", "width").toInt32();
-CPPUNIT_ASSERT( pageWidth > 0 );
-CPPUNIT_ASSERT( tableWidth > 0 );
-// The table's resulting position should be roughly centered.
-CPPUNIT_ASSERT( abs(( pageLeft + pageWidth / 2 ) - ( tableLeft + 
tableWidth / 2 )) < 20 );
-
-uno::Reference xTextSection = getProperty< 
uno::Reference >(getParagraph(2), "TextSection");
-CPPUNIT_ASSERT(xTextSection.is());
-uno::Reference xTextColumns = getProperty< 
uno::Reference >(xTextSection, "TextColumns");
-OUString pageStyleName = getProperty(getParagraph(2), 
"PageStyleName");
-uno::Reference 
xPageStyle(getStyles("PageStyles")->getByName(pageStyleName), uno::UNO_QUERY);
-uno::Reference xPageColumns = getProperty< 
uno::Reference >(xPageStyle, "TextColumns");
-
-//either one or the other should get the column's, not both.
-CPPUNIT_ASSERT( xTextColumns->getColumnCount() != 
xPageColumns->getColumnCount());
-}
-
 CPPUNIT_TEST_FIXTURE(Test, testN816593)
 {
 createSwDoc("n816593.doc");
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index abd7cf4c0345..04c00b90b78e 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -4527,9 +4527,6 @@ void wwSectionManager::InsertSegments()
 
 bool bInsertSection = (aIter != aStart) && aIter->IsContinuous() &&  
bThisAndPreviousAreCompatible;
 bool bInsertPageDesc = !bInsertSection;
-// HACK Force new pagedesc if left/right margins change, otherwise 
e.g. floating tables may be anchored improperly.
-if( aIter->maSep.dxaLeft != aPrev->maSep.dxaLeft || 
aIter->maSep.dxaRight != aPrev->maSep.dxaRight )
-bInsertPageDesc = true;
 bool bProtected = SectionIsProtected(*aIter); // do we really  need 
this ?? I guess I have a different logic in editshell which disables this...
 
 if (bInsertPageDesc)


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - svtools/source

2023-07-05 Thread Paris Oplopoios (via logerrit)
 svtools/source/config/colorcfg.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 6417fbe4a71dc6bb7d5edac5ed3f01c4ab38ca9c
Author: Paris Oplopoios 
AuthorDate: Wed Jul 5 11:41:07 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Wed Jul 5 10:46:20 2023 +0200

svtools::BASICEDITOR shouldn't exist in colorcfg

Was added from a backport from master but would need a different commit
to matter

Change-Id: Ibc458808bd8353cb056e8fc20ae9b90c46e9e1f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154024
Tested-by: Paris Oplopoios 
Reviewed-by: Paris Oplopoios 

diff --git a/svtools/source/config/colorcfg.cxx 
b/svtools/source/config/colorcfg.cxx
index d382116d2a2d..e03e875f100a 100644
--- a/svtools/source/config/colorcfg.cxx
+++ b/svtools/source/config/colorcfg.cxx
@@ -405,7 +405,6 @@ Color ColorConfig::GetDefaultColor(ColorConfigEntry eEntry)
 { COL_BLACK,Color(0xEE) }, // CALCTEXT
 { COL_LIGHTGRAY,Color(0x1C1C1C) }, // CALCPROTECTEDBACKGROUND
 { COL_GRAY7,COL_GRAY7   }, // DRAWGRID
-{ COL_WHITE,Color(0x1C1C1C) }, // BASICEDITOR
 { COL_GREEN,Color(0xDDE8CB) }, // BASICIDENTIFIER
 { COL_GRAY, Color(0xEE) }, // BASICCOMMENT
 { COL_LIGHTRED, Color(0xFFA6A6) }, // BASICNUMBER


[Libreoffice-commits] core.git: include/sfx2 sc/source sd/source sfx2/source sw/inc sw/source

2023-07-05 Thread Paris Oplopoios (via logerrit)
 include/sfx2/viewsh.hxx |2 ++
 sc/source/ui/inc/tabvwsh.hxx|2 ++
 sc/source/ui/view/tabvwshc.cxx  |5 +
 sd/source/ui/inc/ViewShellBase.hxx  |2 ++
 sd/source/ui/view/ViewShellBase.cxx |   12 
 sfx2/source/appl/appserv.cxx|   20 ++--
 sfx2/source/view/viewsh.cxx |6 ++
 sw/inc/view.hxx |2 ++
 sw/inc/viewopt.hxx  |2 +-
 sw/source/core/view/vnew.cxx|   17 -
 sw/source/uibase/uiview/viewprt.cxx |   14 ++
 11 files changed, 80 insertions(+), 4 deletions(-)

New commits:
commit 63d019c6780733018ffc0b157a235cb57893d6d4
Author: Paris Oplopoios 
AuthorDate: Mon Jul 3 19:00:59 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Wed Jul 5 10:17:03 2023 +0200

Make sure views get new themes on .uno:ChangeTheme

It would be that sometimes .uno:ChangeTheme would not load the new
scheme because it was using EditableConfig::GetCurrentSchemeName which
uses a static name - normally great except for when you need different
views to have different color schemes in tiled rendering

Change-Id: I5b149bd1a4776337f76753c6de98d5386a899d34
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153939
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Paris Oplopoios 
(cherry picked from commit 77f5b9259864798b6efc213f6dfa685cd440f71a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154001
Tested-by: Jenkins

diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index 08bc6cecc8cb..4adf62a196c4 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -431,6 +431,8 @@ public:
 virtual vcl::Window* GetEditWindowForActiveOLEObj() const override;
 /// Get a color config color from this view
 virtual ::Color GetColorConfigColor(svtools::ColorConfigEntry nColorType) 
const;
+/// Get the color scheme name of this view
+virtual OUString GetColorConfigName() const;
 
 /// Set the LibreOfficeKit language of this view.
 void SetLOKLanguageTag(const OUString& rBcp47LanguageTag);
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index d8434af53bc6..06e9f31e19cb 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -397,6 +397,8 @@ public:
 void NotifyCursor(SfxViewShell* pViewShell) const override;
 /// See SfxViewShell::GetColorConfigColor().
 ::Color GetColorConfigColor(svtools::ColorConfigEntry nColorType) const 
override;
+/// See SfxViewShell::GetColorConfigName().
+OUString GetColorConfigName() const override;
 /// Emits a LOK_CALLBACK_INVALIDATE_HEADER for all views whose current tab 
is equal to nCurrentTabIndex
 static void notifyAllViewsHeaderInvalidation(const SfxViewShell* 
pForViewShell, HeaderType eHeaderType, SCTAB nCurrentTabIndex);
 static bool isAnyEditViewInRange(const SfxViewShell* pForViewShell, bool 
bColumns, SCCOLROW nStart, SCCOLROW nEnd);
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index 5397d9f4383e..997e710e18e9 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -511,6 +511,11 @@ void ScTabViewShell::NotifyCursor(SfxViewShell* 
pOtherShell) const
 }
 }
 
+OUString ScTabViewShell::GetColorConfigName() const
+{
+return GetViewData().GetOptions().GetColorSchemeName();
+}
+
 css::uno::Reference 
ScTabViewShell::GetClipData(vcl::Window* pWin)
 {
 SfxViewFrame* pViewFrame = nullptr;
diff --git a/sd/source/ui/inc/ViewShellBase.hxx 
b/sd/source/ui/inc/ViewShellBase.hxx
index e31429f6e41a..3f40123405f3 100644
--- a/sd/source/ui/inc/ViewShellBase.hxx
+++ b/sd/source/ui/inc/ViewShellBase.hxx
@@ -223,6 +223,8 @@ public:
 void NotifyCursor(SfxViewShell* pViewShell) const override;
 /// See SfxViewShell::GetColorConfigColor().
 ::Color GetColorConfigColor(svtools::ColorConfigEntry nColorType) const 
override;
+/// See SfxViewShell::GetColorConfigName().
+OUString GetColorConfigName() const override;
 
 void setLOKVisibleArea(const ::tools::Rectangle& rArea) { maLOKVisibleArea 
= rArea; }
 virtual ::tools::Rectangle getLOKVisibleArea() const override { return 
maLOKVisibleArea; }
diff --git a/sd/source/ui/view/ViewShellBase.cxx 
b/sd/source/ui/view/ViewShellBase.cxx
index 55ade0226213..460e102e7796 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -1084,6 +1084,18 @@ void ViewShellBase::NotifyCursor(SfxViewShell* 
pOtherShell) const
 return {};
 }
 
+OUString ViewShellBase::GetColorConfigName() const
+{
+if (DrawViewShell* pCurrentDrawShell = 
dynamic_cast(GetMainViewShell().get()))
+{
+const SdViewOptions& rViewOptions = 
pCurrentDrawShell->GetViewOptions();
+return rViewOptions.msColorSchemeName;
+}
+
+SAL_WARN("sd", "dynamic_cast to DrawViewShell failed");
+return {};
+}
+
 //= 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sd/source

2023-07-05 Thread Paris Oplopoios (via logerrit)
 sd/source/ui/inc/DrawViewShell.hxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 77f5cf7e360ecfcc199451faaa598a3885351e77
Author: Paris Oplopoios 
AuthorDate: Mon Jul 3 00:24:27 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Wed Jul 5 10:02:27 2023 +0200

Delete DrawViewShell copy constructors

DrawViewShell does not get copied so best to set these to deleted to
highlight this.

Change-Id: I3d35d3a47137b15346d54a08d3d7af480b0872bb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153864
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 
(cherry picked from commit 7f1012806f5cf2cd53e52d8f2a95c09a2215efbc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153907
Tested-by: Jenkins CollaboraOffice 

diff --git a/sd/source/ui/inc/DrawViewShell.hxx 
b/sd/source/ui/inc/DrawViewShell.hxx
index beb2bec08c0a..4e4482980a11 100644
--- a/sd/source/ui/inc/DrawViewShell.hxx
+++ b/sd/source/ui/inc/DrawViewShell.hxx
@@ -398,6 +398,9 @@ protected:
 voidGetMenuStateSel(SfxItemSet& rSet);
 
 private:
+DrawViewShell(const DrawViewShell&) = delete;
+DrawViewShell& operator=(const DrawViewShell&) = delete;
+
 void Construct (DrawDocShell* pDocSh, PageKind ePageKind);
 
 /** Depending on the given request create a new page or duplicate an


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - include/sfx2 sc/source sd/source sfx2/source sw/inc sw/source

2023-07-04 Thread Paris Oplopoios (via logerrit)
 include/sfx2/viewsh.hxx |2 ++
 sc/source/ui/inc/tabvwsh.hxx|2 ++
 sc/source/ui/view/tabvwshc.cxx  |5 +
 sd/source/ui/inc/ViewShellBase.hxx  |2 ++
 sd/source/ui/view/ViewShellBase.cxx |   12 
 sfx2/source/appl/appserv.cxx|   20 ++--
 sfx2/source/view/viewsh.cxx |6 ++
 sw/inc/view.hxx |2 ++
 sw/inc/viewopt.hxx  |2 +-
 sw/source/core/view/vnew.cxx|   17 -
 sw/source/uibase/uiview/viewprt.cxx |   14 ++
 11 files changed, 80 insertions(+), 4 deletions(-)

New commits:
commit 884fd220d0025a92510d3ff4710c8c517c8f271e
Author: Paris Oplopoios 
AuthorDate: Mon Jul 3 19:00:59 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Tue Jul 4 22:12:16 2023 +0200

Make sure views get new themes on .uno:ChangeTheme

It would be that sometimes .uno:ChangeTheme would not load the new
scheme because it was using EditableConfig::GetCurrentSchemeName which
uses a static name - normally great except for when you need different
views to have different color schemes in tiled rendering

Change-Id: I5b149bd1a4776337f76753c6de98d5386a899d34
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153939
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Paris Oplopoios 

diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index 2435caa52a47..78f75b7067dd 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -409,6 +409,8 @@ public:
 virtual vcl::Window* GetEditWindowForActiveOLEObj() const override;
 /// Get a color config color from this view
 virtual ::Color GetColorConfigColor(svtools::ColorConfigEntry nColorType) 
const;
+/// Get the color scheme name of this view
+virtual OUString GetColorConfigName() const;
 
 /// Set the LibreOfficeKit language of this view.
 void SetLOKLanguageTag(const OUString& rBcp47LanguageTag);
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index ee3edd020def..d32f664b5536 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -395,6 +395,8 @@ public:
 void NotifyCursor(SfxViewShell* pViewShell) const override;
 /// See SfxViewShell::GetColorConfigColor().
 ::Color GetColorConfigColor(svtools::ColorConfigEntry nColorType) const 
override;
+/// See SfxViewShell::GetColorConfigName().
+OUString GetColorConfigName() const override;
 /// Emits a LOK_CALLBACK_INVALIDATE_HEADER for all views whose current tab 
is equal to nCurrentTabIndex
 static void notifyAllViewsHeaderInvalidation(const SfxViewShell* 
pForViewShell, HeaderType eHeaderType, SCTAB nCurrentTabIndex);
 static bool isAnyEditViewInRange(const SfxViewShell* pForViewShell, bool 
bColumns, SCCOLROW nStart, SCCOLROW nEnd);
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index 3b50da7114cb..517a00c8f2e1 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -516,6 +516,11 @@ void ScTabViewShell::NotifyCursor(SfxViewShell* 
pOtherShell) const
 return {};
 }
 
+OUString ScTabViewShell::GetColorConfigName() const
+{
+return GetViewData().GetOptions().GetColorSchemeName();
+}
+
 css::uno::Reference 
ScTabViewShell::GetClipData(vcl::Window* pWin)
 {
 SfxViewFrame* pViewFrame = nullptr;
diff --git a/sd/source/ui/inc/ViewShellBase.hxx 
b/sd/source/ui/inc/ViewShellBase.hxx
index aa0346ea5b2f..71522c7892d4 100644
--- a/sd/source/ui/inc/ViewShellBase.hxx
+++ b/sd/source/ui/inc/ViewShellBase.hxx
@@ -223,6 +223,8 @@ public:
 void NotifyCursor(SfxViewShell* pViewShell) const override;
 /// See SfxViewShell::GetColorConfigColor().
 ::Color GetColorConfigColor(svtools::ColorConfigEntry nColorType) const 
override;
+/// See SfxViewShell::GetColorConfigName().
+OUString GetColorConfigName() const override;
 
 void setLOKVisibleArea(const ::tools::Rectangle& rArea) { maLOKVisibleArea 
= rArea; }
 virtual ::tools::Rectangle getLOKVisibleArea() const override { return 
maLOKVisibleArea; }
diff --git a/sd/source/ui/view/ViewShellBase.cxx 
b/sd/source/ui/view/ViewShellBase.cxx
index 834e1d6cc3e2..19be45aaca12 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -1091,6 +1091,18 @@ void ViewShellBase::NotifyCursor(SfxViewShell* 
pOtherShell) const
 return {};
 }
 
+OUString ViewShellBase::GetColorConfigName() const
+{
+if (DrawViewShell* pCurrentDrawShell = 
dynamic_cast(GetMainViewShell().get()))
+{
+const SdViewOptions& rViewOptions = 
pCurrentDrawShell->GetViewOptions();
+return rViewOptions.msColorSchemeName;
+}
+
+SAL_WARN("sd", "dynamic_cast to DrawViewShell failed");
+return {};
+}
+
 //= ViewShellBase::Implementation =
 
 ViewShellBase::Implementation::Implementation (ViewShellBase& rBase)
diff 

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

2023-07-03 Thread Paris Oplopoios (via logerrit)
 sd/source/ui/inc/DrawViewShell.hxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 7f1012806f5cf2cd53e52d8f2a95c09a2215efbc
Author: Paris Oplopoios 
AuthorDate: Mon Jul 3 00:24:27 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Mon Jul 3 11:03:17 2023 +0200

Delete DrawViewShell copy constructors

DrawViewShell does not get copied so best to set these to deleted to
highlight this.

Change-Id: I3d35d3a47137b15346d54a08d3d7af480b0872bb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153864
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/sd/source/ui/inc/DrawViewShell.hxx 
b/sd/source/ui/inc/DrawViewShell.hxx
index bf20af800f7e..319afe1386d3 100644
--- a/sd/source/ui/inc/DrawViewShell.hxx
+++ b/sd/source/ui/inc/DrawViewShell.hxx
@@ -397,6 +397,9 @@ protected:
 voidGetMenuStateSel(SfxItemSet& rSet);
 
 private:
+DrawViewShell(const DrawViewShell&) = delete;
+DrawViewShell& operator=(const DrawViewShell&) = delete;
+
 void Construct (DrawDocShell* pDocSh, PageKind ePageKind);
 
 void ImplDestroy();


[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - 3 commits - configure.ac sw/qa vcl/source

2023-06-30 Thread Paris Oplopoios (via logerrit)
 configure.ac|1 +
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx  |   10 ++
 vcl/source/filter/GraphicFormatDetector.cxx |7 +++
 3 files changed, 14 insertions(+), 4 deletions(-)

New commits:
commit a0c7a5ea40647fa7fc030399cce8577834fb2fc2
Author: Paris Oplopoios 
AuthorDate: Sat Jun 24 03:48:32 2023 +0300
Commit: Xisco Fauli 
CommitDate: Fri Jun 30 10:04:28 2023 +0200

tdf#156016 Fix bug where SVG check size would be 0

Change-Id: I1c4adf75bbfbce7cb6b779375714b1c1bc7ec50d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153543
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 
(cherry picked from commit 85013c57dd29e32ec0411c159ea72824ebca5aa9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153527
Reviewed-by: Xisco Fauli 

diff --git a/vcl/source/filter/GraphicFormatDetector.cxx 
b/vcl/source/filter/GraphicFormatDetector.cxx
index a0cdd2416c57..fc43cdd963ab 100644
--- a/vcl/source/filter/GraphicFormatDetector.cxx
+++ b/vcl/source/filter/GraphicFormatDetector.cxx
@@ -1249,7 +1249,7 @@ bool GraphicFormatDetector::checkSVG()
   SVG_CHECK_SIZE, 
nDecompressedSize);
 nCheckSize = std::min(nDecompressedSize, 256);
 bool bIsSvg(false);
-bool bIsGZip = (nDecompressedSize > 0);
+bool bIsGZip = mbWasCompressed;
 const char* pCheckArrayAsCharArray = reinterpret_cast(pCheckArray);
 // check for XML
 // #119176# SVG files which have no xml header at all have shown up this 
is optional
@@ -1279,11 +1279,11 @@ bool GraphicFormatDetector::checkSVG()
 
 if (bIsGZip)
 {
-nCheckSize = std::min(nDecompressedSize, 2048);
+nCheckSize = std::min(nDecompressedSize, 
SVG_CHECK_SIZE);
 }
 else
 {
-nCheckSize = std::min(mnStreamLength, 2048);
+nCheckSize = std::min(mnStreamLength, SVG_CHECK_SIZE);
 mrStream.Seek(mnStreamPosition);
 nCheckSize = mrStream.ReadBytes(sExtendedOrDecompressedFirstBytes, 
nCheckSize);
 }
@@ -1400,7 +1400,6 @@ sal_uInt8* 
GraphicFormatDetector::checkAndUncompressBuffer(sal_uInt8* aUncompres
 mbWasCompressed = true;
 return aUncompressedBuffer;
 }
-nRetSize = 0;
 mbWasCompressed = false;
 return maFirstBytes.data();
 }
commit e1a785e74497f19af799d31d093aca92e0f18524
Author: Christian Lohmaier 
AuthorDate: Thu Jun 29 14:59:38 2023 +0200
Commit: Xisco Fauli 
CommitDate: Fri Jun 30 10:04:20 2023 +0200

fix cross-compilation with frozen headers

FROZEN wasn't part of the PERMITTED_BUILD_TARGETS in configure.ac, that
in turn means it is not part of BUILD_TYPE when building the crossbuild
build-tools.
That in turn means gb_Helper_optional in external/Module_external.mk
doesn't add it to the external module dirs, and that means the makefiles
from external/frozen aren't read, more specifically there won't be any
gb_UnpackedTarball_UnpackedTarball,frozen definition.

The UnpackedTarball definitions don't error out in this case, and the
gb_Library_use_extenals,module,frozen then doesn't work as expected. It
happily depends on the UnpackedTarball_get_final_target for frozen, but
since there is nothing to unpack (since the makefiles with the
definitions are skipped) that is a noop/it goes straight to just touch
workdir_for_build/UnpackedTarball/frozen.update to fulfill the
dependency without actually extracting any files.

This patch deals with the first problem only, adding it to the
PERMITTED_BUILD_TARGETS will allow the mechanism to work as intended.

Change-Id: Ie9e8ad47ba4c281fb3246daf67450a16f792b908
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153747
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier 
(cherry picked from commit fdfc6eb3fd37f87d51d1836d01259a14a4346a45)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153756
Reviewed-by: Xisco Fauli 

diff --git a/configure.ac b/configure.ac
index 014cef7845c6..11b9fbe90acf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5775,6 +5775,7 @@ if test "$cross_compiling" = "yes"; then
 DYNLOADING
 EPOXY
 EXPAT
+FROZEN
 GLM
 GRAPHITE
 HARFBUZZ
commit f3ca3de93e6320639166bd934bf5c000e98a7976
Author: László Németh 
AuthorDate: Thu Jun 29 11:13:28 2023 +0200
Commit: Xisco Fauli 
CommitDate: Fri Jun 30 10:04:14 2023 +0200

tdf#146346 fix unit test & extend it to empty multi-page footnote

Implementing multi-page floating tables resulted a partial
regression here: not last table of the footnote, but empty
paragraph under it resulted an empty split footnote on the
second page, without noticing the problem.

Problem with the previous unit test of tdf#146346 was
reported by Mike Kaganski: "using getPages, does *not*

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

2023-06-29 Thread Paris Oplopoios (via logerrit)
 drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx |   14 ---
 include/vcl/animate/AnimationFrame.hxx   |   14 +--
 vcl/source/animate/AnimationFrame.cxx|3 ++
 vcl/source/filter/png/PngImageReader.cxx |6 +++-
 4 files changed, 30 insertions(+), 7 deletions(-)

New commits:
commit 8dfde7d69a8bbdc8ce88aefded231b94e30271d6
Author: Paris Oplopoios 
AuthorDate: Sat Jun 24 17:36:09 2023 +0300
Commit: Tomaž Vajngerl 
CommitDate: Thu Jun 29 15:19:54 2023 +0200

tdf#104877 Implement APNG blending modes

Change-Id: Ib7ce4d113ccaa4843b8332087ebe52ac3828180e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153556
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx 
b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
index a95df2474744..f3c4cf69911c 100644
--- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
@@ -252,6 +252,15 @@ namespace drawinglayer::primitive2d
 // prepare step
 const AnimationFrame& rAnimationFrame = 
maAnimation.Get(sal_uInt16(mnNextFrameToPrepare));
 
+bool bSourceBlending = rAnimationFrame.meBlend == 
Blend::Source;
+
+if (bSourceBlending)
+{
+tools::Rectangle 
aArea(rAnimationFrame.maPositionPixel, 
rAnimationFrame.maBitmapEx.GetSizePixel());
+maVirtualDevice->Erase(aArea);
+maVirtualDeviceMask->Erase(aArea);
+}
+
 switch (rAnimationFrame.meDisposal)
 {
 case Disposal::Not:
@@ -278,14 +287,13 @@ namespace drawinglayer::primitive2d
 {
 // #i70772# react on no mask, for primitives, too.
 const AlphaMask & 
rMask(rAnimationFrame.maBitmapEx.GetAlphaMask());
-const Bitmap & 
rContent(rAnimationFrame.maBitmapEx.GetBitmap());
 
 maVirtualDeviceMask->Erase();
-
maVirtualDevice->DrawBitmap(rAnimationFrame.maPositionPixel, rContent);
+
maVirtualDevice->DrawBitmapEx(rAnimationFrame.maPositionPixel, 
rAnimationFrame.maBitmapEx);
 
 if (rMask.IsEmpty())
 {
-const ::tools::Rectangle 
aRect(rAnimationFrame.maPositionPixel, rContent.GetSizePixel());
+const ::tools::Rectangle 
aRect(rAnimationFrame.maPositionPixel, 
rAnimationFrame.maBitmapEx.GetSizePixel());
 maVirtualDeviceMask->SetFillColor(COL_BLACK);
 maVirtualDeviceMask->SetLineColor();
 maVirtualDeviceMask->DrawRect(aRect);
diff --git a/include/vcl/animate/AnimationFrame.hxx 
b/include/vcl/animate/AnimationFrame.hxx
index 7aa6f0d54a2b..3e9a4b21d168 100644
--- a/include/vcl/animate/AnimationFrame.hxx
+++ b/include/vcl/animate/AnimationFrame.hxx
@@ -28,6 +28,12 @@ enum class Disposal
 Previous
 };
 
+enum class Blend
+{
+Source,
+Over
+};
+
 struct AnimationFrame
 {
 BitmapEx maBitmapEx;
@@ -35,22 +41,26 @@ struct AnimationFrame
 Size maSizePixel;
 tools::Long mnWait;
 Disposal meDisposal;
+Blend meBlend;
 bool mbUserInput;
 
 AnimationFrame()
 : mnWait(0)
 , meDisposal(Disposal::Not)
+, meBlend(Blend::Over)
 , mbUserInput(false)
 {
 }
 
 AnimationFrame(const BitmapEx& rBitmapEx, const Point& rPositionPixel, 
const Size& rSizePixel,
-   tools::Long nWait = 0, Disposal eDisposal = Disposal::Not)
+   tools::Long nWait = 0, Disposal eDisposal = Disposal::Not,
+   Blend eBlend = Blend::Over)
 : maBitmapEx(rBitmapEx)
 , maPositionPixel(rPositionPixel)
 , maSizePixel(rSizePixel)
 , mnWait(nWait)
 , meDisposal(eDisposal)
+, meBlend(eBlend)
 , mbUserInput(false)
 {
 }
@@ -60,7 +70,7 @@ struct AnimationFrame
 return (rAnimationFrame.maBitmapEx == maBitmapEx
 && rAnimationFrame.maPositionPixel == maPositionPixel
 && rAnimationFrame.maSizePixel == maSizePixel && 
rAnimationFrame.mnWait == mnWait
-&& rAnimationFrame.meDisposal == meDisposal
+&& rAnimationFrame.meDisposal == meDisposal && 
rAnimationFrame.meBlend == meBlend
 && rAnimationFrame.mbUserInput == mbUserInput);
 }
 
diff --git a/vcl/source/animate/AnimationFrame.cxx 
b/vcl/source/animate/AnimationFrame.cxx
index e2f9bae931fb..3593a0ab17e1 100644
--- 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - vcl/source

2023-06-29 Thread Paris Oplopoios (via logerrit)
 vcl/source/filter/GraphicFormatDetector.cxx |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

New commits:
commit a1d9d090338009c3fdc4dcb8d6dc0dfb6c13e582
Author: Paris Oplopoios 
AuthorDate: Sat Jun 24 03:48:32 2023 +0300
Commit: Andras Timar 
CommitDate: Thu Jun 29 13:50:35 2023 +0200

tdf#156016 Fix bug where SVG check size would be 0

Change-Id: I1c4adf75bbfbce7cb6b779375714b1c1bc7ec50d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153543
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 
(cherry picked from commit 85013c57dd29e32ec0411c159ea72824ebca5aa9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153528
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/filter/GraphicFormatDetector.cxx 
b/vcl/source/filter/GraphicFormatDetector.cxx
index a0cdd2416c57..fc43cdd963ab 100644
--- a/vcl/source/filter/GraphicFormatDetector.cxx
+++ b/vcl/source/filter/GraphicFormatDetector.cxx
@@ -1249,7 +1249,7 @@ bool GraphicFormatDetector::checkSVG()
   SVG_CHECK_SIZE, 
nDecompressedSize);
 nCheckSize = std::min(nDecompressedSize, 256);
 bool bIsSvg(false);
-bool bIsGZip = (nDecompressedSize > 0);
+bool bIsGZip = mbWasCompressed;
 const char* pCheckArrayAsCharArray = reinterpret_cast(pCheckArray);
 // check for XML
 // #119176# SVG files which have no xml header at all have shown up this 
is optional
@@ -1279,11 +1279,11 @@ bool GraphicFormatDetector::checkSVG()
 
 if (bIsGZip)
 {
-nCheckSize = std::min(nDecompressedSize, 2048);
+nCheckSize = std::min(nDecompressedSize, 
SVG_CHECK_SIZE);
 }
 else
 {
-nCheckSize = std::min(mnStreamLength, 2048);
+nCheckSize = std::min(mnStreamLength, SVG_CHECK_SIZE);
 mrStream.Seek(mnStreamPosition);
 nCheckSize = mrStream.ReadBytes(sExtendedOrDecompressedFirstBytes, 
nCheckSize);
 }
@@ -1400,7 +1400,6 @@ sal_uInt8* 
GraphicFormatDetector::checkAndUncompressBuffer(sal_uInt8* aUncompres
 mbWasCompressed = true;
 return aUncompressedBuffer;
 }
-nRetSize = 0;
 mbWasCompressed = false;
 return maFirstBytes.data();
 }


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - include/LibreOfficeKit sw/source

2023-06-29 Thread Paris Oplopoios (via logerrit)
 include/LibreOfficeKit/LibreOfficeKitEnums.h |3 +--
 sw/source/uibase/app/apphdl.cxx  |2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)

New commits:
commit f8e75b5c4511bc7633a646abace0e57ae0121242
Author: Paris Oplopoios 
AuthorDate: Wed Jun 28 15:50:06 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Thu Jun 29 13:01:03 2023 +0200

Send writer document background color on theme change

Send the doc background color to the kit on theme change

Change-Id: Ibbcd8d20c8cfce4918544716ffbdf374a1f06e5d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153712
Tested-by: Paris Oplopoios 
Reviewed-by: Paris Oplopoios 

diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index d2a03c8ce9b6..c7e65a63c796 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -774,8 +774,7 @@ typedef enum
 LOK_CALLBACK_VALIDITY_INPUT_HELP = 51,
 
 /**
- * This is currently Calc only. Indicates the document background
- * color in the payload as a RGB hex string (RRGGBB).
+ * Indicates the document background color in the payload as a RGB hex 
string (RRGGBB).
  */
 LOK_CALLBACK_DOCUMENT_BACKGROUND_COLOR = 52,
 
diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index 7e9b6e650b32..d7a452f5cc50 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -998,6 +998,8 @@ void SwModule::ConfigurationChanged( 
utl::ConfigurationBroadcaster* pBrdCst, Con
 {
 
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR,
 
aViewColors.m_aAppBackgroundColor.AsRGBHexString().toUtf8().getStr());
+
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_BACKGROUND_COLOR,
+
aViewColors.m_aDocColor.AsRGBHexString().toUtf8().getStr());
 }
 }
 }


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

2023-06-28 Thread Paris Oplopoios (via logerrit)
 include/LibreOfficeKit/LibreOfficeKitEnums.h |3 +--
 sw/source/uibase/app/apphdl.cxx  |2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 367e9205e10d10cb564bb462dea821ce554b99da
Author: Paris Oplopoios 
AuthorDate: Wed Jun 28 16:23:16 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Wed Jun 28 17:14:40 2023 +0200

Send writer document background color on theme change

Send the doc background color to the kit on theme change

Change-Id: Ic025e542417da004c1c4a2bfd58a858deb4caa58
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153715
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 0325e62399a5..b7a43acf7d27 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -774,8 +774,7 @@ typedef enum
 LOK_CALLBACK_VALIDITY_INPUT_HELP = 51,
 
 /**
- * This is currently Calc only. Indicates the document background
- * color in the payload as a RGB hex string (RRGGBB).
+ * Indicates the document background color in the payload as a RGB hex 
string (RRGGBB).
  */
 LOK_CALLBACK_DOCUMENT_BACKGROUND_COLOR = 52,
 
diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index d7ab78d6e392..26a08b03c00b 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -996,6 +996,8 @@ void SwModule::ConfigurationChanged( 
utl::ConfigurationBroadcaster* pBrdCst, Con
 {
 
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR,
 
aViewColors.m_aAppBackgroundColor.AsRGBHexString().toUtf8());
+
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_BACKGROUND_COLOR,
+
aViewColors.m_aAppBackgroundColor.AsRGBHexString().toUtf8());
 }
 }
 if(pSwView !=  nullptr ||


[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - vcl/source

2023-06-27 Thread Paris Oplopoios (via logerrit)
 vcl/source/filter/GraphicFormatDetector.cxx |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

New commits:
commit e7c70b352c477afd9b9adab48c7e46a37b701202
Author: Paris Oplopoios 
AuthorDate: Sat Jun 24 03:48:32 2023 +0300
Commit: Michael Stahl 
CommitDate: Tue Jun 27 11:18:42 2023 +0200

tdf#156016 Fix bug where SVG check size would be 0

Change-Id: I1c4adf75bbfbce7cb6b779375714b1c1bc7ec50d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153543
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 
(cherry picked from commit 85013c57dd29e32ec0411c159ea72824ebca5aa9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153528
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/filter/GraphicFormatDetector.cxx 
b/vcl/source/filter/GraphicFormatDetector.cxx
index a0cdd2416c57..fc43cdd963ab 100644
--- a/vcl/source/filter/GraphicFormatDetector.cxx
+++ b/vcl/source/filter/GraphicFormatDetector.cxx
@@ -1249,7 +1249,7 @@ bool GraphicFormatDetector::checkSVG()
   SVG_CHECK_SIZE, 
nDecompressedSize);
 nCheckSize = std::min(nDecompressedSize, 256);
 bool bIsSvg(false);
-bool bIsGZip = (nDecompressedSize > 0);
+bool bIsGZip = mbWasCompressed;
 const char* pCheckArrayAsCharArray = reinterpret_cast(pCheckArray);
 // check for XML
 // #119176# SVG files which have no xml header at all have shown up this 
is optional
@@ -1279,11 +1279,11 @@ bool GraphicFormatDetector::checkSVG()
 
 if (bIsGZip)
 {
-nCheckSize = std::min(nDecompressedSize, 2048);
+nCheckSize = std::min(nDecompressedSize, 
SVG_CHECK_SIZE);
 }
 else
 {
-nCheckSize = std::min(mnStreamLength, 2048);
+nCheckSize = std::min(mnStreamLength, SVG_CHECK_SIZE);
 mrStream.Seek(mnStreamPosition);
 nCheckSize = mrStream.ReadBytes(sExtendedOrDecompressedFirstBytes, 
nCheckSize);
 }
@@ -1400,7 +1400,6 @@ sal_uInt8* 
GraphicFormatDetector::checkAndUncompressBuffer(sal_uInt8* aUncompres
 mbWasCompressed = true;
 return aUncompressedBuffer;
 }
-nRetSize = 0;
 mbWasCompressed = false;
 return maFirstBytes.data();
 }


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

2023-06-24 Thread Paris Oplopoios (via logerrit)
 vcl/source/filter/GraphicFormatDetector.cxx |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

New commits:
commit 85013c57dd29e32ec0411c159ea72824ebca5aa9
Author: Paris Oplopoios 
AuthorDate: Sat Jun 24 03:48:32 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Sat Jun 24 12:16:34 2023 +0200

tdf#156016 Fix bug where SVG check size would be 0

Change-Id: I1c4adf75bbfbce7cb6b779375714b1c1bc7ec50d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153543
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/vcl/source/filter/GraphicFormatDetector.cxx 
b/vcl/source/filter/GraphicFormatDetector.cxx
index 4fc2c85c2a4e..d4a027d60ed3 100644
--- a/vcl/source/filter/GraphicFormatDetector.cxx
+++ b/vcl/source/filter/GraphicFormatDetector.cxx
@@ -1272,7 +1272,7 @@ bool GraphicFormatDetector::checkSVG()
   SVG_CHECK_SIZE, 
nDecompressedSize);
 nCheckSize = std::min(nDecompressedSize, 256);
 bool bIsSvg(false);
-bool bIsGZip = (nDecompressedSize > 0);
+bool bIsGZip = mbWasCompressed;
 const char* pCheckArrayAsCharArray = reinterpret_cast(pCheckArray);
 // check for XML
 // #119176# SVG files which have no xml header at all have shown up this 
is optional
@@ -1302,11 +1302,11 @@ bool GraphicFormatDetector::checkSVG()
 
 if (bIsGZip)
 {
-nCheckSize = std::min(nDecompressedSize, 2048);
+nCheckSize = std::min(nDecompressedSize, 
SVG_CHECK_SIZE);
 }
 else
 {
-nCheckSize = std::min(mnStreamLength, 2048);
+nCheckSize = std::min(mnStreamLength, SVG_CHECK_SIZE);
 mrStream.Seek(mnStreamPosition);
 nCheckSize = mrStream.ReadBytes(sExtendedOrDecompressedFirstBytes, 
nCheckSize);
 }
@@ -1423,7 +1423,6 @@ sal_uInt8* 
GraphicFormatDetector::checkAndUncompressBuffer(sal_uInt8* aUncompres
 mbWasCompressed = true;
 return aUncompressedBuffer;
 }
-nRetSize = 0;
 mbWasCompressed = false;
 return maFirstBytes.data();
 }


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/source

2023-06-21 Thread Paris Oplopoios (via logerrit)
 sw/source/ui/misc/pagenumberdlg.cxx|   32 +---
 sw/source/uibase/inc/pagenumberdlg.hxx |1 +
 2 files changed, 26 insertions(+), 7 deletions(-)

New commits:
commit 82e04b9041b256cd8191c7b142caefa94c137309
Author: Paris Oplopoios 
AuthorDate: Wed Jun 14 01:49:07 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Wed Jun 21 17:14:30 2023 +0200

Remove hardcoded values in pagenumberdlg

Removed hardcoded text width/heights and margins in pagenumberdlg to
create the preview image and also added a different text preview for
IncludePageTotal mode

Change-Id: Ib4f4f9ba702f87babf13c1435dc3845add1f43cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153030
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 
(cherry picked from commit 63627c174778f7d435a540c43ec0498c76e739ab)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153288
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/source/ui/misc/pagenumberdlg.cxx 
b/sw/source/ui/misc/pagenumberdlg.cxx
index 1b1c4a98f579..2396da26202b 100644
--- a/sw/source/ui/misc/pagenumberdlg.cxx
+++ b/sw/source/ui/misc/pagenumberdlg.cxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 
 SwPageNumberDlg::SwPageNumberDlg(weld::Window* pParent)
 : SfxDialogController(pParent, "modules/swriter/ui/pagenumberdlg.ui", 
"PageNumberDialog")
@@ -49,6 +50,7 @@ SwPageNumberDlg::SwPageNumberDlg(weld::Window* pParent)
 
SvxNumOptionsTabPageHelper::GetI18nNumbering(m_xPageNumberTypeLB->get_widget(),
  
::std::numeric_limits::max());
 m_xPageNumberTypeLB->connect_changed(LINK(this, SwPageNumberDlg, 
NumberTypeSelectHdl));
+m_xIncludePageTotal->connect_toggled(LINK(this, SwPageNumberDlg, 
IncludePageTotalChangeHdl));
 updateImage();
 }
 
@@ -81,6 +83,11 @@ IMPL_LINK_NOARG(SwPageNumberDlg, NumberTypeSelectHdl, 
weld::ComboBox&, void)
 m_nPageNumberType = m_xPageNumberTypeLB->get_active_id();
 }
 
+IMPL_LINK_NOARG(SwPageNumberDlg, IncludePageTotalChangeHdl, weld::Toggleable&, 
void)
+{
+updateImage();
+}
+
 bool SwPageNumberDlg::GetMirrorOnEvenPages()
 {
 return m_xMirrorOnEvenPages->get_sensitive()
@@ -103,8 +110,7 @@ void SwPageNumberDlg::updateImage()
 int nBackgroundWidth = 75;
 int nBackgroundHeight = 105;
 
-int nSpriteWidth = 10;
-int nSpriteHeight = 14;
+int nMargin = 7;
 
 ScopedVclPtrInstance pVirtualDev;
 Size aVDSize(nBackgroundWidth, nBackgroundHeight);
@@ -112,17 +118,29 @@ void SwPageNumberDlg::updateImage()
 pVirtualDev->SetBackground(Color(0xF0, 0xF0, 0xF0));
 pVirtualDev->Erase();
 
-int y = m_aPageNumberPosition ? (nBackgroundHeight - nSpriteHeight - 5) : 
5;
-int x = 5;
+OUString sText = "#";
+
+if (m_xIncludePageTotal->get_state() == TRISTATE_TRUE)
+{
+sText += " / #";
+}
+
+DrawTextFlags eFlags = DrawTextFlags::Left;
+
 if (m_aPageNumberAlignment == 1)
 {
-x = (nBackgroundWidth - nSpriteWidth) / 2;
+eFlags = DrawTextFlags::Center;
 }
 else if (m_aPageNumberAlignment == 2)
 {
-x = nBackgroundWidth - nSpriteWidth - 5;
+eFlags = DrawTextFlags::Right;
 }
-pVirtualDev->DrawText(Point(x, y), "#");
+
+eFlags |= m_aPageNumberPosition ? DrawTextFlags::Bottom : 
DrawTextFlags::Top;
+
+pVirtualDev->DrawText(
+tools::Rectangle(nMargin, nMargin, nBackgroundWidth - nMargin, 
nBackgroundHeight - nMargin),
+sText, eFlags);
 
 m_xPreviewImage->set_image(pVirtualDev);
 }
diff --git a/sw/source/uibase/inc/pagenumberdlg.hxx 
b/sw/source/uibase/inc/pagenumberdlg.hxx
index 298ab975d1f2..87cf385993c9 100644
--- a/sw/source/uibase/inc/pagenumberdlg.hxx
+++ b/sw/source/uibase/inc/pagenumberdlg.hxx
@@ -43,6 +43,7 @@ class SwPageNumberDlg : public SfxDialogController
 
 DECL_LINK(OkHdl, weld::Button&, void);
 DECL_LINK(CancelHdl, weld::Button&, void);
+DECL_LINK(IncludePageTotalChangeHdl, weld::Toggleable&, void);
 DECL_LINK(PositionSelectHdl, weld::ComboBox&, void);
 DECL_LINK(AlignmentSelectHdl, weld::ComboBox&, void);
 DECL_LINK(NumberTypeSelectHdl, weld::ComboBox&, void);


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

2023-06-20 Thread Paris Oplopoios (via logerrit)
 sw/source/core/view/viewsh.cxx |   20 +++-
 1 file changed, 11 insertions(+), 9 deletions(-)

New commits:
commit 098e8d6f111ca9d7680ed1eec00522fed6487e95
Author: Paris Oplopoios 
AuthorDate: Wed Jun 21 01:59:50 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Wed Jun 21 02:00:02 2023 +0200

sw: Fix spell checking having no view separation in tiled mode

Turning spell checking on or off for a single view would turn it on/off
for every view which is correct behavior normally but not in tiled mode
because different views might want different view options

Change-Id: Ib422f692e97618cfba6a7cb8b2a4f2b3f20a0ca2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153343
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 20cd26c17fb3..9074f43ab8b4 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -2433,17 +2433,19 @@ void SwViewShell::ImplApplyViewOptions( const 
SwViewOption  )
 if( !bOnlineSpellChgd )
 return;
 
-bool bOnlineSpl = rOpt.IsOnlineSpell();
-for(SwViewShell& rSh : GetRingContainer())
+if ( !comphelper::LibreOfficeKit::isActive() )
 {
-if( == this)
-continue;
-rSh.mpOpt->SetOnlineSpell( bOnlineSpl );
-vcl::Window *pTmpWin = rSh.GetWin();
-if( pTmpWin )
-pTmpWin->Invalidate();
+bool bOnlineSpl = rOpt.IsOnlineSpell();
+for(SwViewShell& rSh : GetRingContainer())
+{
+if( == this)
+continue;
+rSh.mpOpt->SetOnlineSpell( bOnlineSpl );
+vcl::Window *pTmpWin = rSh.GetWin();
+if( pTmpWin )
+pTmpWin->Invalidate();
+}
 }
-
 }
 
 void SwViewShell::SetUIOptions( const SwViewOption  )


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/source

2023-06-20 Thread Paris Oplopoios (via logerrit)
 sw/source/core/view/viewsh.cxx |   20 +++-
 1 file changed, 11 insertions(+), 9 deletions(-)

New commits:
commit e1193efffbe8310e9d13e049f47865b31a2d14e4
Author: Paris Oplopoios 
AuthorDate: Wed Jun 21 01:59:50 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Wed Jun 21 02:00:11 2023 +0200

sw: Fix spell checking having no view separation in tiled mode

Turning spell checking on or off for a single view would turn it on/off
for every view which is correct behavior normally but not in tiled mode
because different views might want different view options

Change-Id: Ib422f692e97618cfba6a7cb8b2a4f2b3f20a0ca2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153370
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Paris Oplopoios 

diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 9c80d43f36a6..ef1d7317ef73 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -2502,17 +2502,19 @@ void SwViewShell::ImplApplyViewOptions( const 
SwViewOption  )
 if( !bOnlineSpellChgd )
 return;
 
-bool bOnlineSpl = rOpt.IsOnlineSpell();
-for(SwViewShell& rSh : GetRingContainer())
+if ( !comphelper::LibreOfficeKit::isActive() )
 {
-if( == this)
-continue;
-rSh.mpOpt->SetOnlineSpell( bOnlineSpl );
-vcl::Window *pTmpWin = rSh.GetWin();
-if( pTmpWin )
-pTmpWin->Invalidate();
+bool bOnlineSpl = rOpt.IsOnlineSpell();
+for(SwViewShell& rSh : GetRingContainer())
+{
+if( == this)
+continue;
+rSh.mpOpt->SetOnlineSpell( bOnlineSpl );
+vcl::Window *pTmpWin = rSh.GetWin();
+if( pTmpWin )
+pTmpWin->Invalidate();
+}
 }
-
 }
 
 void SwViewShell::SetUIOptions( const SwViewOption  )


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

2023-06-15 Thread Paris Oplopoios (via logerrit)
 include/vcl/bitmapex.hxx |1 +
 vcl/source/bitmap/BitmapEx.cxx   |5 +
 vcl/source/filter/png/PngImageWriter.cxx |8 ++--
 3 files changed, 12 insertions(+), 2 deletions(-)

New commits:
commit 21fa75ced1f82b5dd87874a789a13153c09cd283
Author: Paris Oplopoios 
AuthorDate: Sat Jun 10 21:33:39 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Thu Jun 15 15:01:54 2023 +0200

tdf#154168 Export no transparency PNGs correctly

When bTranslucent was false the function would simply return, causing a
0 byte png. Now we just remove the alpha channel.

Change-Id: Ie2578185ac12fb38b6f1b674758e564721e3973f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152840
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 
(cherry picked from commit 7588c1f33cdaab58a6b84f4f4e75922c5d4a8a7f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152886
Reviewed-by: Xisco Fauli 
(cherry picked from commit e691869486cd4ee4ee1dfb8f7a41440f7f6500fd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153081

diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx
index f847c9f6dcb2..9dcedc7ffb81 100644
--- a/include/vcl/bitmapex.hxx
+++ b/include/vcl/bitmapex.hxx
@@ -56,6 +56,7 @@ public:
 boolIsEmpty() const;
 voidSetEmpty();
 voidClear();
+voidClearAlpha();
 
 voidDraw( OutputDevice* pOutDev,
   const Point& rDestPt ) const;
diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx
index 6ff2280cdb06..c19ed0f02c3a 100644
--- a/vcl/source/bitmap/BitmapEx.cxx
+++ b/vcl/source/bitmap/BitmapEx.cxx
@@ -190,6 +190,11 @@ void BitmapEx::Clear()
 SetEmpty();
 }
 
+void BitmapEx::ClearAlpha()
+{
+maAlphaMask.SetEmpty();
+}
+
 bool BitmapEx::IsAlpha() const
 {
 return !maAlphaMask.IsEmpty();
diff --git a/vcl/source/filter/png/PngImageWriter.cxx 
b/vcl/source/filter/png/PngImageWriter.cxx
index f550d9951e64..29d79740009e 100644
--- a/vcl/source/filter/png/PngImageWriter.cxx
+++ b/vcl/source/filter/png/PngImageWriter.cxx
@@ -50,8 +50,6 @@ static bool pngWrite(SvStream& rStream, const BitmapEx& 
rBitmapEx, int nCompress
  bool bInterlaced, bool bTranslucent,
  const std::vector& aAdditionalChunks)
 {
-if (rBitmapEx.IsAlpha() && !bTranslucent)
-return false;
 if (rBitmapEx.IsEmpty())
 return false;
 
@@ -78,6 +76,12 @@ static bool pngWrite(SvStream& rStream, const BitmapEx& 
rBitmapEx, int nCompress
 aBitmapEx = rBitmapEx;
 }
 
+if (!bTranslucent)
+{
+// Clear alpha channel
+aBitmapEx.ClearAlpha();
+}
+
 Bitmap aBitmap;
 AlphaMask aAlphaMask;
 Bitmap::ScopedReadAccess pAccess;


[Libreoffice-commits] core.git: editeng/source include/sfx2 include/svtools sc/source sd/source sfx2/source sw/inc sw/source

2023-06-14 Thread Paris Oplopoios (via logerrit)
 editeng/source/editeng/impedit3.cxx |   24 
 include/sfx2/viewsh.hxx |3 +++
 include/svtools/colorcfg.hxx|2 +-
 sc/source/ui/inc/tabvwsh.hxx|2 ++
 sc/source/ui/view/tabvwshc.cxx  |   20 
 sd/source/ui/inc/ViewShellBase.hxx  |2 ++
 sd/source/ui/view/ViewShellBase.cxx |   27 +++
 sfx2/source/view/viewsh.cxx |6 ++
 sw/inc/view.hxx |2 ++
 sw/source/uibase/uiview/viewprt.cxx |   27 +++
 10 files changed, 110 insertions(+), 5 deletions(-)

New commits:
commit 069c7dc4e9706b40ca12d83d83f90f41cec948f8
Author: Paris Oplopoios 
AuthorDate: Tue Jun 13 20:36:48 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Wed Jun 14 22:12:21 2023 +0200

Add editengine view separation in tiled rendering

Editengine now gets the background color from the current view instead
from a global variable

Change-Id: I98a0fccf4d0c83f4dabf8e534a9228b8a5e271d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152996
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Paris Oplopoios 
(cherry picked from commit 7baa475342b67c10537e11da37b8862648679b02)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153073
Tested-by: Jenkins

diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index bcf0c044872f..e18562d3113f 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -52,6 +52,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -67,6 +68,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -4686,15 +4688,29 @@ Reference < i18n::XExtendedInputSequenceChecker > const 
& ImpEditEngine::ImplGet
 
 Color ImpEditEngine::GetAutoColor() const
 {
-Color aColor = GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor;
+Color aColor;
 
-if ( GetBackgroundColor() != COL_AUTO )
+if (comphelper::LibreOfficeKit::isActive() && SfxViewShell::Current())
 {
-if ( GetBackgroundColor().IsDark() && aColor.IsDark() )
+// Get document background color from current view instead
+aColor = 
SfxViewShell::Current()->GetColorConfigColor(svtools::DOCCOLOR);
+if (aColor.IsDark())
 aColor = COL_WHITE;
-else if ( GetBackgroundColor().IsBright() && aColor.IsBright() )
+else
 aColor = COL_BLACK;
 }
+else
+{
+aColor = GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor;
+
+if ( GetBackgroundColor() != COL_AUTO )
+{
+if ( GetBackgroundColor().IsDark() && aColor.IsDark() )
+aColor = COL_WHITE;
+else if ( GetBackgroundColor().IsBright() && aColor.IsBright() )
+aColor = COL_BLACK;
+}
+}
 
 return aColor;
 }
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index b805f1cf99d4..08bc6cecc8cb 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -74,6 +74,7 @@ namespace com::sun::star::ui { class XContextMenuInterceptor; 
}
 namespace com::sun::star::ui { struct ContextMenuExecuteEvent; }
 namespace com::sun::star::view { class XRenderable; }
 namespace tools { class Rectangle; }
+namespace svtools { enum ColorConfigEntry : int; }
 
 enum class SfxPrinterChangeFlags
 {
@@ -428,6 +429,8 @@ public:
 virtual void afterCallbackRegistered();
 /// See OutlinerViewShell::GetEditWindowForActiveOLEObj().
 virtual vcl::Window* GetEditWindowForActiveOLEObj() const override;
+/// Get a color config color from this view
+virtual ::Color GetColorConfigColor(svtools::ColorConfigEntry nColorType) 
const;
 
 /// Set the LibreOfficeKit language of this view.
 void SetLOKLanguageTag(const OUString& rBcp47LanguageTag);
diff --git a/include/svtools/colorcfg.hxx b/include/svtools/colorcfg.hxx
index de16f18eab13..9810aac0393d 100644
--- a/include/svtools/colorcfg.hxx
+++ b/include/svtools/colorcfg.hxx
@@ -27,7 +27,7 @@
 
 
 namespace svtools{
-enum ColorConfigEntry
+enum ColorConfigEntry : int
 {
 DOCCOLOR,
 DOCBOUNDARIES   ,
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index a670c4429d53..d8434af53bc6 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -395,6 +395,8 @@ public:
 void afterCallbackRegistered() override;
 /// See SfxViewShell::NotifyCursor().
 void NotifyCursor(SfxViewShell* pViewShell) const override;
+/// See SfxViewShell::GetColorConfigColor().
+::Color GetColorConfigColor(svtools::ColorConfigEntry nColorType) const 
override;
 /// Emits a LOK_CALLBACK_INVALIDATE_HEADER for all views whose current tab 
is equal to nCurrentTabIndex
 static void notifyAllViewsHeaderInvalidation(const SfxViewShell* 
pForViewShell, HeaderType eHeaderType, SCTAB nCurrentTabIndex);
 static bool 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - editeng/source include/sfx2 include/svtools sc/source sd/source sfx2/source sw/inc sw/source

2023-06-14 Thread Paris Oplopoios (via logerrit)
 editeng/source/editeng/impedit3.cxx |   24 
 include/sfx2/viewsh.hxx |3 +++
 include/svtools/colorcfg.hxx|2 +-
 sc/source/ui/inc/tabvwsh.hxx|2 ++
 sc/source/ui/view/tabvwshc.cxx  |   22 ++
 sd/source/ui/inc/ViewShellBase.hxx  |2 ++
 sd/source/ui/view/ViewShellBase.cxx |   27 +++
 sfx2/source/view/viewsh.cxx |6 ++
 sw/inc/view.hxx |2 ++
 sw/source/uibase/uiview/viewprt.cxx |   27 +++
 10 files changed, 112 insertions(+), 5 deletions(-)

New commits:
commit 0ed32277dc5c0f1989ae59fa05217ae793ae81d9
Author: Paris Oplopoios 
AuthorDate: Tue Jun 13 20:36:48 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Wed Jun 14 17:57:16 2023 +0200

Add editengine view separation in tiled rendering

Editengine now gets the background color from the current view instead
from a global variable

Change-Id: I98a0fccf4d0c83f4dabf8e534a9228b8a5e271d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152996
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Paris Oplopoios 

diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index 11e12c66e7e8..8a6ff9d63e6e 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -52,6 +52,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -67,6 +68,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -4696,15 +4698,29 @@ Reference < i18n::XExtendedInputSequenceChecker > const 
& ImpEditEngine::ImplGet
 
 Color ImpEditEngine::GetAutoColor() const
 {
-Color aColor = GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor;
+Color aColor;
 
-if ( GetBackgroundColor() != COL_AUTO )
+if (comphelper::LibreOfficeKit::isActive() && SfxViewShell::Current())
 {
-if ( GetBackgroundColor().IsDark() && aColor.IsDark() )
+// Get document background color from current view instead
+aColor = 
SfxViewShell::Current()->GetColorConfigColor(svtools::DOCCOLOR);
+if (aColor.IsDark())
 aColor = COL_WHITE;
-else if ( GetBackgroundColor().IsBright() && aColor.IsBright() )
+else
 aColor = COL_BLACK;
 }
+else
+{
+aColor = GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor;
+
+if ( GetBackgroundColor() != COL_AUTO )
+{
+if ( GetBackgroundColor().IsDark() && aColor.IsDark() )
+aColor = COL_WHITE;
+else if ( GetBackgroundColor().IsBright() && aColor.IsBright() )
+aColor = COL_BLACK;
+}
+}
 
 return aColor;
 }
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index 0cbbfc64032d..2435caa52a47 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -72,6 +72,7 @@ namespace com::sun::star::ui { class XContextMenuInterceptor; 
}
 namespace com::sun::star::ui { struct ContextMenuExecuteEvent; }
 namespace com::sun::star::view { class XRenderable; }
 namespace tools { class Rectangle; }
+namespace svtools { enum ColorConfigEntry : int; }
 
 enum class SfxPrinterChangeFlags
 {
@@ -406,6 +407,8 @@ public:
 virtual void afterCallbackRegistered();
 /// See OutlinerViewShell::GetEditWindowForActiveOLEObj().
 virtual vcl::Window* GetEditWindowForActiveOLEObj() const override;
+/// Get a color config color from this view
+virtual ::Color GetColorConfigColor(svtools::ColorConfigEntry nColorType) 
const;
 
 /// Set the LibreOfficeKit language of this view.
 void SetLOKLanguageTag(const OUString& rBcp47LanguageTag);
diff --git a/include/svtools/colorcfg.hxx b/include/svtools/colorcfg.hxx
index 08f5d3000bed..5836ab1ea6f9 100644
--- a/include/svtools/colorcfg.hxx
+++ b/include/svtools/colorcfg.hxx
@@ -27,7 +27,7 @@
 
 
 namespace svtools{
-enum ColorConfigEntry
+enum ColorConfigEntry : int
 {
 DOCCOLOR,
 DOCBOUNDARIES   ,
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index a1688fb11f83..ee3edd020def 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -393,6 +393,8 @@ public:
 void afterCallbackRegistered() override;
 /// See SfxViewShell::NotifyCursor().
 void NotifyCursor(SfxViewShell* pViewShell) const override;
+/// See SfxViewShell::GetColorConfigColor().
+::Color GetColorConfigColor(svtools::ColorConfigEntry nColorType) const 
override;
 /// Emits a LOK_CALLBACK_INVALIDATE_HEADER for all views whose current tab 
is equal to nCurrentTabIndex
 static void notifyAllViewsHeaderInvalidation(const SfxViewShell* 
pForViewShell, HeaderType eHeaderType, SCTAB nCurrentTabIndex);
 static bool isAnyEditViewInRange(const SfxViewShell* pForViewShell, bool 
bColumns, SCCOLROW nStart, SCCOLROW nEnd);
diff --git a/sc/source/ui/view/tabvwshc.cxx 

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

2023-06-14 Thread Paris Oplopoios (via logerrit)
 include/vcl/filter/PngImageReader.hxx   |   17 +
 vcl/source/filter/GraphicFormatDetector.cxx |   11 ++-
 vcl/source/filter/png/PngImageReader.cxx|   15 ---
 3 files changed, 23 insertions(+), 20 deletions(-)

New commits:
commit 427769a751d3f45e41e5a0f4aed385bb2727998c
Author: Paris Oplopoios 
AuthorDate: Wed Jun 14 02:45:43 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Wed Jun 14 13:23:11 2023 +0200

Remove duplicate constants relating to PNGs

The PNG signature constant was defined in multiple places

Change-Id: Ia90636819341295129a37a91199857a612d62177
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153032
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/include/vcl/filter/PngImageReader.hxx 
b/include/vcl/filter/PngImageReader.hxx
index 01fdc2915e54..201e3a08b8c0 100644
--- a/include/vcl/filter/PngImageReader.hxx
+++ b/include/vcl/filter/PngImageReader.hxx
@@ -21,6 +21,23 @@
 
 #include 
 
+constexpr sal_uInt64 PNG_SIGNATURE = 0x89504E470D0A1A0A;
+constexpr sal_uInt32 PNG_IHDR_SIGNATURE = 0x49484452;
+constexpr sal_uInt32 PNG_IDAT_SIGNATURE = 0x49444154;
+constexpr sal_uInt32 PNG_PHYS_SIGNATURE = 0x70485973;
+constexpr sal_uInt32 PNG_TRNS_SIGNATURE = 0x74524E53;
+constexpr sal_uInt32 PNG_ACTL_SIGNATURE = 0x6163544C;
+constexpr sal_uInt32 PNG_FCTL_SIGNATURE = 0x6663544C;
+constexpr sal_uInt32 PNG_FDAT_SIGNATURE = 0x66644154;
+constexpr sal_uInt32 PNG_IEND_SIGNATURE = 0x49454E44;
+constexpr sal_uInt32 PNG_IEND_CRC = 0xAE426082;
+constexpr int PNG_SIGNATURE_SIZE = 8;
+constexpr int PNG_IHDR_SIZE = 13;
+constexpr int PNG_TYPE_SIZE = 4;
+constexpr int PNG_SIZE_SIZE = 4;
+constexpr int PNG_CRC_SIZE = 4;
+constexpr int PNG_IEND_SIZE = 0;
+
 namespace com::sun::star::task
 {
 class XStatusIndicator;
diff --git a/vcl/source/filter/GraphicFormatDetector.cxx 
b/vcl/source/filter/GraphicFormatDetector.cxx
index fc5a0fdc79c3..4fc2c85c2a4e 100644
--- a/vcl/source/filter/GraphicFormatDetector.cxx
+++ b/vcl/source/filter/GraphicFormatDetector.cxx
@@ -849,13 +849,14 @@ bool GraphicFormatDetector::checkGIF()
 bool GraphicFormatDetector::checkPNG()
 {
 SeekGuard aGuard(mrStream, mnStreamPosition);
-if (mnFirstLong == 0x89504e47 && mnSecondLong == 0x0d0a1a0a)
+uint64_t nSignature = (static_cast(mnFirstLong) << 32) | 
mnSecondLong;
+if (nSignature == PNG_SIGNATURE)
 {
 maMetadata.mnFormat = GraphicFileFormat::PNG;
 if (mbExtendedInfo)
 {
 sal_uInt32 nTemp32;
-mrStream.Seek(mnStreamPosition + 8);
+mrStream.Seek(mnStreamPosition + PNG_SIGNATURE_SIZE);
 do
 {
 sal_uInt8 cByte = 0;
@@ -901,9 +902,9 @@ bool GraphicFormatDetector::checkPNG()
 // read up to the start of the image
 mrStream.ReadUInt32(nLen32);
 mrStream.ReadUInt32(nTemp32);
-while (mrStream.good() && nTemp32 != 0x49444154)
+while (mrStream.good() && nTemp32 != PNG_IDAT_SIGNATURE)
 {
-if (nTemp32 == 0x70485973) // physical pixel dimensions
+if (nTemp32 == PNG_PHYS_SIGNATURE) // physical pixel 
dimensions
 {
 sal_uLong nXRes;
 sal_uLong nYRes;
@@ -935,7 +936,7 @@ bool GraphicFormatDetector::checkPNG()
 
 nLen32 -= 9;
 }
-else if (nTemp32 == 0x74524e53) // transparency
+else if (nTemp32 == PNG_TRNS_SIGNATURE) // transparency
 {
 maMetadata.mbIsTransparent = true;
 maMetadata.mbIsAlpha = (cColType != 0 && cColType != 
2);
diff --git a/vcl/source/filter/png/PngImageReader.cxx 
b/vcl/source/filter/png/PngImageReader.cxx
index 1cb72bdbe6b5..7e3fdbe44d71 100644
--- a/vcl/source/filter/png/PngImageReader.cxx
+++ b/vcl/source/filter/png/PngImageReader.cxx
@@ -51,21 +51,6 @@ void lclReadStream(png_structp pPng, png_bytep pOutBytes, 
png_size_t nBytesToRea
 }
 }
 
-constexpr int PNG_SIGNATURE_SIZE = 8;
-constexpr int PNG_IHDR_SIZE = 13;
-constexpr int PNG_TYPE_SIZE = 4;
-constexpr int PNG_SIZE_SIZE = 4;
-constexpr int PNG_CRC_SIZE = 4;
-constexpr int PNG_IEND_SIZE = 0;
-constexpr sal_uInt64 PNG_SIGNATURE = 0x89504E470D0A1A0A;
-constexpr sal_uInt32 PNG_IHDR_SIGNATURE = 0x49484452;
-constexpr sal_uInt32 PNG_IDAT_SIGNATURE = 0x49444154;
-constexpr sal_uInt32 PNG_ACTL_SIGNATURE = 0x6163544C;
-constexpr sal_uInt32 PNG_FCTL_SIGNATURE = 0x6663544C;
-constexpr sal_uInt32 PNG_FDAT_SIGNATURE = 0x66644154;
-constexpr sal_uInt32 PNG_IEND_SIGNATURE = 0x49454E44;
-constexpr sal_uInt32 PNG_IEND_CRC = 0xAE426082;
-
 bool isPng(SvStream& rStream)
 {
 // Check signature bytes


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

2023-06-13 Thread Paris Oplopoios (via logerrit)
 sw/source/ui/misc/pagenumberdlg.cxx|   32 +---
 sw/source/uibase/inc/pagenumberdlg.hxx |1 +
 2 files changed, 26 insertions(+), 7 deletions(-)

New commits:
commit 63627c174778f7d435a540c43ec0498c76e739ab
Author: Paris Oplopoios 
AuthorDate: Wed Jun 14 01:49:07 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Wed Jun 14 01:47:47 2023 +0200

Remove hardcoded values in pagenumberdlg

Removed hardcoded text width/heights and margins in pagenumberdlg to
create the preview image and also added a different text preview for
IncludePageTotal mode

Change-Id: Ib4f4f9ba702f87babf13c1435dc3845add1f43cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153030
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/sw/source/ui/misc/pagenumberdlg.cxx 
b/sw/source/ui/misc/pagenumberdlg.cxx
index 1b5084c5e94b..fe965d69db19 100644
--- a/sw/source/ui/misc/pagenumberdlg.cxx
+++ b/sw/source/ui/misc/pagenumberdlg.cxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 
 SwPageNumberDlg::SwPageNumberDlg(weld::Window* pParent)
 : SfxDialogController(pParent, "modules/swriter/ui/pagenumberdlg.ui", 
"PageNumberDialog")
@@ -49,6 +50,7 @@ SwPageNumberDlg::SwPageNumberDlg(weld::Window* pParent)
 
SvxNumOptionsTabPageHelper::GetI18nNumbering(m_xPageNumberTypeLB->get_widget(),
  
::std::numeric_limits::max());
 m_xPageNumberTypeLB->connect_changed(LINK(this, SwPageNumberDlg, 
NumberTypeSelectHdl));
+m_xIncludePageTotal->connect_toggled(LINK(this, SwPageNumberDlg, 
IncludePageTotalChangeHdl));
 updateImage();
 }
 
@@ -76,6 +78,11 @@ IMPL_LINK_NOARG(SwPageNumberDlg, NumberTypeSelectHdl, 
weld::ComboBox&, void)
 m_nPageNumberType = m_xPageNumberTypeLB->get_active_id();
 }
 
+IMPL_LINK_NOARG(SwPageNumberDlg, IncludePageTotalChangeHdl, weld::Toggleable&, 
void)
+{
+updateImage();
+}
+
 bool SwPageNumberDlg::GetMirrorOnEvenPages()
 {
 return m_xMirrorOnEvenPages->get_sensitive()
@@ -98,8 +105,7 @@ void SwPageNumberDlg::updateImage()
 int nBackgroundWidth = 75;
 int nBackgroundHeight = 105;
 
-int nSpriteWidth = 10;
-int nSpriteHeight = 14;
+int nMargin = 7;
 
 ScopedVclPtrInstance pVirtualDev;
 Size aVDSize(nBackgroundWidth, nBackgroundHeight);
@@ -107,17 +113,29 @@ void SwPageNumberDlg::updateImage()
 pVirtualDev->SetBackground(Color(0xF0, 0xF0, 0xF0));
 pVirtualDev->Erase();
 
-int y = m_aPageNumberPosition ? (nBackgroundHeight - nSpriteHeight - 5) : 
5;
-int x = 5;
+OUString sText = "#";
+
+if (m_xIncludePageTotal->get_state() == TRISTATE_TRUE)
+{
+sText += " / #";
+}
+
+DrawTextFlags eFlags = DrawTextFlags::Left;
+
 if (m_aPageNumberAlignment == 1)
 {
-x = (nBackgroundWidth - nSpriteWidth) / 2;
+eFlags = DrawTextFlags::Center;
 }
 else if (m_aPageNumberAlignment == 2)
 {
-x = nBackgroundWidth - nSpriteWidth - 5;
+eFlags = DrawTextFlags::Right;
 }
-pVirtualDev->DrawText(Point(x, y), "#");
+
+eFlags |= m_aPageNumberPosition ? DrawTextFlags::Bottom : 
DrawTextFlags::Top;
+
+pVirtualDev->DrawText(
+tools::Rectangle(nMargin, nMargin, nBackgroundWidth - nMargin, 
nBackgroundHeight - nMargin),
+sText, eFlags);
 
 m_xPreviewImage->set_image(pVirtualDev);
 }
diff --git a/sw/source/uibase/inc/pagenumberdlg.hxx 
b/sw/source/uibase/inc/pagenumberdlg.hxx
index cf719b492a33..169c9209dbf5 100644
--- a/sw/source/uibase/inc/pagenumberdlg.hxx
+++ b/sw/source/uibase/inc/pagenumberdlg.hxx
@@ -42,6 +42,7 @@ class SwPageNumberDlg final : public SfxDialogController
 SvxNumType m_nPageNumberType;
 
 DECL_LINK(OkHdl, weld::Button&, void);
+DECL_LINK(IncludePageTotalChangeHdl, weld::Toggleable&, void);
 DECL_LINK(PositionSelectHdl, weld::ComboBox&, void);
 DECL_LINK(AlignmentSelectHdl, weld::ComboBox&, void);
 DECL_LINK(NumberTypeSelectHdl, weld::ComboBox&, void);


[Libreoffice-commits] core.git: cppuhelper/source editeng/source filter/source

2023-06-12 Thread Paris Oplopoios (via logerrit)
 cppuhelper/source/typemanager.cxx   |9 +++--
 editeng/source/misc/svxacorr.cxx|6 ++
 filter/source/msfilter/escherex.cxx |8 ++--
 3 files changed, 7 insertions(+), 16 deletions(-)

New commits:
commit 81e815edbf5b4694789aa1d7b9e3ecde08b08b21
Author: Paris Oplopoios 
AuthorDate: Mon Jun 12 02:11:44 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Mon Jun 12 13:11:07 2023 +0200

tdf#153109 Use any_of instead of loop to check a range

Change-Id: Icf65288a7e53257008129b71e8d716b0b0c7f5fa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152868
Tested-by: Paris Oplopoios 
Reviewed-by: Paris Oplopoios 

diff --git a/cppuhelper/source/typemanager.cxx 
b/cppuhelper/source/typemanager.cxx
index 0408234c4b39..29f7025cdf6a 100644
--- a/cppuhelper/source/typemanager.cxx
+++ b/cppuhelper/source/typemanager.cxx
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1723,12 +1724,8 @@ bool Enumeration::matches(css::uno::TypeClass tc) const {
 if (!types_.hasElements()) {
 return true;
 }
-for (const auto & i : types_) {
-if (i == tc) {
-return true;
-}
-}
-return false;
+
+return std::any_of(types_.begin(), types_.end(), [](const auto& i) { 
return i == tc; });
 }
 
 void Enumeration::findNextMatch() {
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 318da6536df9..7959b9c2ba83 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -19,6 +19,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -175,10 +176,7 @@ static bool lcl_IsSymbolChar( CharClass const & rCC, const 
OUString& rTxt,
 
 static bool lcl_IsInArr(std::u16string_view arr, const sal_uInt32 c)
 {
-for (const auto c1 : arr)
-if (c1 == c)
-return true;
-return false;
+return std::any_of(arr.begin(), arr.end(), [c](const auto c1) { return c1 
== c; });
 }
 
 SvxAutoCorrDoc::~SvxAutoCorrDoc()
diff --git a/filter/source/msfilter/escherex.cxx 
b/filter/source/msfilter/escherex.cxx
index 6ab8eb844580..1f74c795d3f9 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -3789,12 +3789,8 @@ EscherPersistTable::~EscherPersistTable()
 
 bool EscherPersistTable::PtIsID( sal_uInt32 nID )
 {
-for(auto const & pPtr : maPersistTable) {
-if ( pPtr->mnID == nID ) {
-return true;
-}
-}
-return false;
+return std::any_of(maPersistTable.begin(), maPersistTable.end(),
+[](const auto& rxEntry) { return rxEntry->mnID == nID; });
 }
 
 void EscherPersistTable::PtInsert( sal_uInt32 nID, sal_uInt32 nOfs )


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

2023-06-11 Thread Paris Oplopoios (via logerrit)
 sw/source/uibase/app/apphdl.cxx |   14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

New commits:
commit 20a6c2df3ea899cce15775d954ffa50bb9dc81cd
Author: Paris Oplopoios 
AuthorDate: Mon Jun 12 00:49:27 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Mon Jun 12 02:11:59 2023 +0200

Fix unchecked dynamic cast

Change-Id: If662e24bb864690ead959b2599a6448d84da0de9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152866
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index bd4cdbe28f0f..d7ab78d6e392 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -983,23 +983,27 @@ void SwModule::ConfigurationChanged( 
utl::ConfigurationBroadcaster* pBrdCst, Con
 {
 if(pViewShell->GetWindow())
 {
-auto pSwView = dynamic_cast( pViewShell );
-if(pSwView !=  nullptr ||
-   dynamic_cast< const SwPagePreview *>( pViewShell ) !=  
nullptr ||
-   dynamic_cast< const SwSrcView *>( pViewShell ) !=  nullptr)
+auto pSwView = dynamic_cast(pViewShell);
+if (pSwView)
 {
 SwViewOption aNewOptions = 
*pSwView->GetWrtShell().GetViewOptions();
 
aNewOptions.SetThemeName(svtools::ColorConfig::GetCurrentSchemeName());
 SwViewColors aViewColors(*m_pColorConfig);
 aNewOptions.SetColorConfig(aViewColors);
 pSwView->GetWrtShell().ApplyViewOptions(aNewOptions);
-pViewShell->GetWindow()->Invalidate();
+
 if (bOnlyInvalidateCurrentView)
 {
 
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR,
 
aViewColors.m_aAppBackgroundColor.AsRGBHexString().toUtf8());
 }
 }
+if(pSwView !=  nullptr ||
+   dynamic_cast< const SwPagePreview *>( pViewShell ) !=  
nullptr ||
+   dynamic_cast< const SwSrcView *>( pViewShell ) !=  nullptr)
+{
+pViewShell->GetWindow()->Invalidate();
+}
 }
 if (bOnlyInvalidateCurrentView)
 break;


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

2023-06-10 Thread Paris Oplopoios (via logerrit)
 include/vcl/bitmapex.hxx |1 +
 vcl/source/bitmap/BitmapEx.cxx   |5 +
 vcl/source/filter/png/PngImageWriter.cxx |8 ++--
 3 files changed, 12 insertions(+), 2 deletions(-)

New commits:
commit 7588c1f33cdaab58a6b84f4f4e75922c5d4a8a7f
Author: Paris Oplopoios 
AuthorDate: Sat Jun 10 21:33:39 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Sun Jun 11 01:13:39 2023 +0200

tdf#154168 Export no transparency PNGs correctly

When bTranslucent was false the function would simply return, causing a
0 byte png. Now we just remove the alpha channel.

Change-Id: Ie2578185ac12fb38b6f1b674758e564721e3973f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152840
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx
index 5838ef8d6e40..9d7a104264ef 100644
--- a/include/vcl/bitmapex.hxx
+++ b/include/vcl/bitmapex.hxx
@@ -56,6 +56,7 @@ public:
 boolIsEmpty() const;
 voidSetEmpty();
 voidClear();
+voidClearAlpha();
 
 voidDraw( OutputDevice* pOutDev,
   const Point& rDestPt ) const;
diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx
index af712a0561a5..ad4adca6319e 100644
--- a/vcl/source/bitmap/BitmapEx.cxx
+++ b/vcl/source/bitmap/BitmapEx.cxx
@@ -190,6 +190,11 @@ void BitmapEx::Clear()
 SetEmpty();
 }
 
+void BitmapEx::ClearAlpha()
+{
+maAlphaMask.SetEmpty();
+}
+
 bool BitmapEx::IsAlpha() const
 {
 return !maAlphaMask.IsEmpty();
diff --git a/vcl/source/filter/png/PngImageWriter.cxx 
b/vcl/source/filter/png/PngImageWriter.cxx
index 914302223d6a..e68c6155826b 100644
--- a/vcl/source/filter/png/PngImageWriter.cxx
+++ b/vcl/source/filter/png/PngImageWriter.cxx
@@ -60,8 +60,6 @@ static bool pngWrite(SvStream& rStream, const BitmapEx& 
rBitmapEx, int nCompress
  bool bInterlaced, bool bTranslucent,
  const std::vector& aAdditionalChunks)
 {
-if (rBitmapEx.IsAlpha() && !bTranslucent)
-return false;
 if (rBitmapEx.IsEmpty())
 return false;
 
@@ -88,6 +86,12 @@ static bool pngWrite(SvStream& rStream, const BitmapEx& 
rBitmapEx, int nCompress
 aBitmapEx = rBitmapEx;
 }
 
+if (!bTranslucent)
+{
+// Clear alpha channel
+aBitmapEx.ClearAlpha();
+}
+
 Bitmap aBitmap;
 AlphaMask aAlphaMask;
 Bitmap::ScopedReadAccess pAccess;


[Libreoffice-commits] core.git: filter/source include/vcl vcl/inc vcl/qa vcl/source

2023-06-10 Thread Paris Oplopoios (via logerrit)
 filter/source/config/fragments/types/png_Portable_Network_Graphic.xcu |2 
 include/vcl/filter/PngImageReader.hxx |4 
 include/vcl/graphic/GraphicMetadata.hxx   |3 
 vcl/inc/graphic/GraphicFormatDetector.hxx |4 
 vcl/qa/cppunit/GraphicFormatDetectorTest.cxx  |   17 
 vcl/qa/cppunit/data/TypeDetectionExample.apng |binary
 vcl/qa/cppunit/png/PngFilterTest.cxx  |   20 
 vcl/qa/cppunit/png/data/apng_simple.apng  |binary
 vcl/source/filter/GraphicFormatDetector.cxx   |   22 
 vcl/source/filter/graphicfilter.cxx   |7 
 vcl/source/filter/png/PngImageReader.cxx  |  424 
+-
 11 files changed, 475 insertions(+), 28 deletions(-)

New commits:
commit bf944e33569e4a1d6236a54671b7320cdc6ffaf6
Author: Paris Oplopoios 
AuthorDate: Mon Feb 6 14:19:41 2023 +0200
Commit: Tomaž Vajngerl 
CommitDate: Sat Jun 10 16:10:39 2023 +0200

tdf#104877 Add basic APNG format support

Add basic APNG (animated PNG) format support that can correctly display
simple files with no transparency

Change-Id: Ibfb6e13953a8ba48a535a40b08792b3723b7dc0b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140089
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git 
a/filter/source/config/fragments/types/png_Portable_Network_Graphic.xcu 
b/filter/source/config/fragments/types/png_Portable_Network_Graphic.xcu
index 7fe5e2adbfda..0b5be4b19923 100644
--- a/filter/source/config/fragments/types/png_Portable_Network_Graphic.xcu
+++ b/filter/source/config/fragments/types/png_Portable_Network_Graphic.xcu
@@ -18,7 +18,7 @@
 
 com.sun.star.comp.draw.FormatDetector
 
-png
+png apng
 image/png
 false
 PNG - Portable Network 
Graphic
diff --git a/include/vcl/filter/PngImageReader.hxx 
b/include/vcl/filter/PngImageReader.hxx
index 34b8279bc654..01fdc2915e54 100644
--- a/include/vcl/filter/PngImageReader.hxx
+++ b/include/vcl/filter/PngImageReader.hxx
@@ -26,6 +26,7 @@ namespace com::sun::star::task
 class XStatusIndicator;
 }
 
+class Graphic;
 class BitmapEx;
 class SvStream;
 
@@ -42,12 +43,15 @@ public:
 // Returns true if image was successfully read without errors.
 // A usable bitmap may be returned even if there were errors (e.g. 
incomplete image).
 bool read(BitmapEx& rBitmap);
+bool read(Graphic& rGraphic);
 // Returns a bitmap without indicating if there were errors.
 BitmapEx read();
 
 // Returns the contents of the msOG chunk (containing a Gif image), if it 
exists.
 // Does not change position in the stream.
 static BinaryDataContainer getMicrosoftGifChunk(SvStream& rStream);
+
+static bool isAPng(SvStream& rStream);
 };
 
 } // namespace vcl
diff --git a/include/vcl/graphic/GraphicMetadata.hxx 
b/include/vcl/graphic/GraphicMetadata.hxx
index da27fde01514..46c3d12a12a2 100644
--- a/include/vcl/graphic/GraphicMetadata.hxx
+++ b/include/vcl/graphic/GraphicMetadata.hxx
@@ -42,7 +42,8 @@ enum class GraphicFileFormat
 SVG = 0x00f9,
 WMZ = 0x00fa,
 EMZ = 0x00fb,
-SVGZ = 0x00fc
+SVGZ = 0x00fc,
+APNG = 0x00fd
 };
 struct GraphicMetadata
 {
diff --git a/vcl/inc/graphic/GraphicFormatDetector.hxx 
b/vcl/inc/graphic/GraphicFormatDetector.hxx
index 64d1e74de80a..2dfb41b461ba 100644
--- a/vcl/inc/graphic/GraphicFormatDetector.hxx
+++ b/vcl/inc/graphic/GraphicFormatDetector.hxx
@@ -52,6 +52,9 @@ static inline OUString 
getImportFormatShortName(GraphicFileFormat nFormat)
 case GraphicFileFormat::PNG:
 pKeyName = "PNG";
 break;
+case GraphicFileFormat::APNG:
+pKeyName = "APNG";
+break;
 case GraphicFileFormat::XBM:
 pKeyName = "XBM";
 break;
@@ -163,6 +166,7 @@ public:
 bool checkTIF();
 bool checkGIF();
 bool checkPNG();
+bool checkAPNG();
 bool checkJPG();
 bool checkSVM();
 bool checkPCD();
diff --git a/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx 
b/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx
index 30cd8f9ebe1e..945cb6d1c613 100644
--- a/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx
+++ b/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx
@@ -39,6 +39,7 @@ class GraphicFormatDetectorTest : public 
test::BootstrapFixtureBase
 void testDetectPCX();
 void testDetectJPG();
 void testDetectPNG();
+void testDetectAPNG();
 void testDetectGIF();
 void testDetectPSD();
 void testDetectTGA();
@@ -63,6 +64,7 @@ class GraphicFormatDetectorTest : public 
test::BootstrapFixtureBase
 CPPUNIT_TEST(testDetectPCX);
 CPPUNIT_TEST(testDetectJPG);
 CPPUNIT_TEST(testDetectPNG);
+CPPUNIT_TEST(testDetectAPNG);
 CPPUNIT_TEST(testDetectGIF);
 

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

2023-06-02 Thread Paris Oplopoios (via logerrit)
 editeng/source/editeng/editview.cxx  |1 
 sc/inc/docuno.hxx|3 ++
 sc/inc/viewopti.hxx  |   10 
 sc/qa/unit/tiledrendering/tiledrendering.cxx |   31 +++
 sc/source/core/data/patattr.cxx  |   29 -
 sc/source/core/tool/viewopti.cxx |4 +++
 sc/source/ui/app/scmod.cxx   |   27 +++
 sc/source/ui/unoobj/docuno.cxx   |   17 ++
 sc/source/ui/view/gridwin4.cxx   |   17 +-
 9 files changed, 132 insertions(+), 7 deletions(-)

New commits:
commit 53d5cc538d9c274cc4d7dfe38229f0f54706b403
Author: Paris Oplopoios 
AuthorDate: Tue May 23 03:50:30 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Fri Jun 2 18:22:34 2023 +0200

Add Calc view separation for tiled rendering

Calc now uses different colors based on the current view theme to paint
tiles when using tiled rendering

Change-Id: I1ca84371141ff026ad49ec362518ca13c59c7c6e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152137
Tested-by: Paris Oplopoios 
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit f4eb56b8b9ff3492e0a02fb76eb4ea7b851f4774)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152440
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/editeng/source/editeng/editview.cxx 
b/editeng/source/editeng/editview.cxx
index cc03a135cdcd..f6c90309747c 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -719,6 +719,7 @@ void EditView::MoveParagraphs( tools::Long nDiff )
 void EditView::SetBackgroundColor( const Color& rColor )
 {
 pImpEditView->SetBackgroundColor( rColor );
+pImpEditView->pEditEngine->SetBackgroundColor( rColor );
 }
 
 Color const & EditView::GetBackgroundColor() const
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index 837f93ec3558..23de1dad63ce 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -394,6 +394,9 @@ public:
 
 /// @see vcl::ITiledRenderable::completeFunction().
 virtual void completeFunction(const OUString& rFunctionName) override;
+
+/// @see vcl::ITiledRenderable::getViewRenderState().
+OString getViewRenderState() override;
 };
 
 class ScDrawPagesObj final : public cppu::WeakImplHelper<
diff --git a/sc/inc/viewopti.hxx b/sc/inc/viewopti.hxx
index 52b23c86b978..489a3e8c81da 100644
--- a/sc/inc/viewopti.hxx
+++ b/sc/inc/viewopti.hxx
@@ -95,6 +95,12 @@ public:
 voidSetGridOptions( const ScGridOptions& rNew ) { 
aGridOpt = rNew; }
 std::unique_ptr CreateGridItem() const;
 
+const OUString& GetColorSchemeName() const { return sColorSchemeName; }
+void SetColorSchemeName( const OUString& rName ) { sColorSchemeName = 
rName; }
+
+const Color& GetDocColor() const { return aDocCol; }
+void SetDocColor(const Color& rDocColor) { aDocCol = rDocColor; }
+
 ScViewOptions&  operator=  ( const ScViewOptions& rCpy );
 booloperator== ( const ScViewOptions& rOpt ) const;
 booloperator!= ( const ScViewOptions& rOpt ) const { 
return !(operator==(rOpt)); }
@@ -105,6 +111,10 @@ private:
 Color   aGridCol;
 OUStringaGridColName;
 ScGridOptions   aGridOpt;
+// The name of the color scheme
+OUString sColorSchemeName = "Default";
+// The background color of the document
+Color aDocCol;
 };
 
 // Item for the options dialog - View
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx 
b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 5968cfc8fdd6..6eb2aa134e69 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -3056,6 +3056,37 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, 
testUndoReorderingMulti)
 CPPUNIT_ASSERT_EQUAL(OUString("DD"), pDoc->GetString(ScAddress(0, 3, 0)));
 }
 
+CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testGetViewRenderState)
+{
+// Add an empty dark scheme to avoid a warning
+svtools::EditableColorConfig aColorConfig;
+aColorConfig.AddScheme(u"Dark");
+
+ScModelObj* pModelObj = createDoc("empty.ods");
+int nFirstViewId = SfxLokHelper::getView();
+ViewCallback aView1;
+
+CPPUNIT_ASSERT_EQUAL(OString(";Default"), pModelObj->getViewRenderState());
+// Create a second view
+SfxLokHelper::createView();
+ViewCallback aView2;
+CPPUNIT_ASSERT_EQUAL(OString(";Default"), pModelObj->getViewRenderState());
+// Set second view to dark scheme
+{
+uno::Sequence aPropertyValues = 
comphelper::InitPropertySequence(
+{
+{ "NewTheme", uno::Any(OUString("Dark")) },
+}
+);
+dispatchCommand(mxComponent, ".uno:ChangeTheme", aPropertyValues);
+}
+CPPUNIT_ASSERT_EQUAL(OString(";Dark"), pModelObj->getViewRenderState());
+
+// 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - editeng/source sc/inc sc/qa sc/source

2023-06-01 Thread Paris Oplopoios (via logerrit)
 editeng/source/editeng/editview.cxx  |1 
 sc/inc/docuno.hxx|3 ++
 sc/inc/viewopti.hxx  |   10 
 sc/qa/unit/tiledrendering/tiledrendering.cxx |   33 +++
 sc/source/core/data/patattr.cxx  |   29 ++-
 sc/source/core/tool/viewopti.cxx |1 
 sc/source/ui/app/scmod.cxx   |   27 ++
 sc/source/ui/unoobj/docuno.cxx   |   17 +
 sc/source/ui/view/gridwin4.cxx   |   17 +
 9 files changed, 131 insertions(+), 7 deletions(-)

New commits:
commit f4eb56b8b9ff3492e0a02fb76eb4ea7b851f4774
Author: Paris Oplopoios 
AuthorDate: Tue May 23 03:50:30 2023 +0300
Commit: Tomaž Vajngerl 
CommitDate: Thu Jun 1 10:32:20 2023 +0200

Add Calc view separation for tiled rendering

Calc now uses different colors based on the current view theme to paint
tiles when using tiled rendering

Change-Id: I1ca84371141ff026ad49ec362518ca13c59c7c6e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152137
Tested-by: Paris Oplopoios 
Reviewed-by: Tomaž Vajngerl 

diff --git a/editeng/source/editeng/editview.cxx 
b/editeng/source/editeng/editview.cxx
index d8eae893dd71..0f53a53de045 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -719,6 +719,7 @@ void EditView::MoveParagraphs( tools::Long nDiff )
 void EditView::SetBackgroundColor( const Color& rColor )
 {
 pImpEditView->SetBackgroundColor( rColor );
+pImpEditView->pEditEngine->SetBackgroundColor( rColor );
 }
 
 Color const & EditView::GetBackgroundColor() const
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index 837f93ec3558..23de1dad63ce 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -394,6 +394,9 @@ public:
 
 /// @see vcl::ITiledRenderable::completeFunction().
 virtual void completeFunction(const OUString& rFunctionName) override;
+
+/// @see vcl::ITiledRenderable::getViewRenderState().
+OString getViewRenderState() override;
 };
 
 class ScDrawPagesObj final : public cppu::WeakImplHelper<
diff --git a/sc/inc/viewopti.hxx b/sc/inc/viewopti.hxx
index 9887ca3903fb..4e00e068b134 100644
--- a/sc/inc/viewopti.hxx
+++ b/sc/inc/viewopti.hxx
@@ -99,6 +99,12 @@ public:
 voidSetGridOptions( const ScGridOptions& rNew ) { 
aGridOpt = rNew; }
 std::unique_ptr CreateGridItem() const;
 
+const OUString& GetColorSchemeName() const { return sColorSchemeName; }
+void SetColorSchemeName( const OUString& rName ) { sColorSchemeName = 
rName; }
+
+const Color& GetDocColor() const { return aDocCol; }
+void SetDocColor(const Color& rDocColor) { aDocCol = rDocColor; }
+
 ScViewOptions&  operator=  ( const ScViewOptions& rCpy );
 booloperator== ( const ScViewOptions& rOpt ) const;
 booloperator!= ( const ScViewOptions& rOpt ) const { 
return !(operator==(rOpt)); }
@@ -109,6 +115,10 @@ private:
 Color   aGridCol;
 OUStringaGridColName;
 ScGridOptions   aGridOpt;
+// The name of the color scheme
+OUString sColorSchemeName = "Default";
+// The background color of the document
+Color aDocCol;
 };
 
 // Item for the options dialog - View
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx 
b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index f09d93a0d8c8..8e42f5c29a53 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -128,6 +128,7 @@ public:
 void testUndoReordering();
 void testUndoReorderingRedo();
 void testUndoReorderingMulti();
+void testGetViewRenderState();
 
 CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
 CPPUNIT_TEST(testRowColumnHeaders);
@@ -188,6 +189,7 @@ public:
 CPPUNIT_TEST(testUndoReordering);
 CPPUNIT_TEST(testUndoReorderingRedo);
 CPPUNIT_TEST(testUndoReorderingMulti);
+CPPUNIT_TEST(testGetViewRenderState);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -3227,6 +3229,37 @@ void ScTiledRenderingTest::testUndoReorderingMulti()
 CPPUNIT_ASSERT_EQUAL(OUString("DD"), pDoc->GetString(ScAddress(0, 3, 0)));
 }
 
+void ScTiledRenderingTest::testGetViewRenderState()
+{
+// Add an empty dark scheme to avoid a warning
+svtools::EditableColorConfig aColorConfig;
+aColorConfig.AddScheme(u"Dark");
+
+ScModelObj* pModelObj = createDoc("empty.ods");
+int nFirstViewId = SfxLokHelper::getView();
+ViewCallback aView1;
+
+CPPUNIT_ASSERT_EQUAL(OString(";Default"), pModelObj->getViewRenderState());
+// Create a second view
+SfxLokHelper::createView();
+ViewCallback aView2;
+CPPUNIT_ASSERT_EQUAL(OString(";Default"), pModelObj->getViewRenderState());
+// Set second view to dark scheme
+{
+uno::Sequence aPropertyValues = 
comphelper::InitPropertySequence(
+

[Libreoffice-commits] core.git: sd/inc sd/qa sd/source

2023-05-10 Thread Paris Oplopoios (via logerrit)
 sd/inc/viewopt.hxx   |   34 
 sd/qa/unit/tiledrendering/tiledrendering.cxx |  114 +++
 sd/source/ui/inc/DrawViewShell.hxx   |5 -
 sd/source/ui/inc/unomodel.hxx|3 
 sd/source/ui/unoidl/unomodel.cxx |   16 +++
 sd/source/ui/view/drviews4.cxx   |2 
 sd/source/ui/view/drviews5.cxx   |2 
 sd/source/ui/view/drviewsa.cxx   |1 
 sd/source/ui/view/drviewsk.cxx   |   25 +
 9 files changed, 196 insertions(+), 6 deletions(-)

New commits:
commit fc87b725d5e29f40d78f2ca7c20a2b516bcfa29a
Author: Paris Oplopoios 
AuthorDate: Wed Apr 12 04:23:56 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Wed May 10 13:07:10 2023 +0200

Add view options class in Draw

Add SdViewOptions class in Draw to hold the view state and
manage view separation in tiled rendering mode

Change-Id: I1546fa536555b3262217ff4be163a48b958b7a33
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150249
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 
(cherry picked from commit fa2fdc90d5fba9420cbb475f8c88423124c158ec)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151519
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/sd/inc/viewopt.hxx b/sd/inc/viewopt.hxx
new file mode 100644
index ..03ebd2ada659
--- /dev/null
+++ b/sd/inc/viewopt.hxx
@@ -0,0 +1,34 @@
+/* -*- 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 .
+ */
+
+#include 
+#include 
+
+/// View options for the current view
+struct SdViewOptions
+{
+// The color of the area behind the slide (used to be called "Wiese")
+Color mnAppBackgroundColor;
+// The color of the document background
+Color mnDocBackgroundColor;
+// The name of the color scheme
+OUString msColorSchemeName = "Default";
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 40eb72c1c098..91a929a11d07 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -51,6 +51,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 
 #include 
@@ -2391,6 +2393,118 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testCutSelectionChange)
 CPPUNIT_ASSERT_EQUAL(static_cast(0), m_aSelection.size());
 }
 
+CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testGetViewRenderState)
+{
+SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
+int nFirstViewId = SfxLokHelper::getView();
+ViewCallback aView1;
+CPPUNIT_ASSERT_EQUAL(OString(";Default"), 
pXImpressDocument->getViewRenderState());
+// Create a second view
+SfxLokHelper::createView();
+ViewCallback aView2;
+CPPUNIT_ASSERT_EQUAL(OString(";Default"), 
pXImpressDocument->getViewRenderState());
+// Set to dark scheme
+{
+uno::Sequence aPropertyValues = 
comphelper::InitPropertySequence(
+{
+{ "NewTheme", uno::Any(OUString("Dark")) },
+}
+);
+dispatchCommand(mxComponent, ".uno:ChangeTheme", aPropertyValues);
+}
+CPPUNIT_ASSERT_EQUAL(OString(";Dark"), 
pXImpressDocument->getViewRenderState());
+// Switch back to the first view, and check that the options string is the 
same
+SfxLokHelper::setView(nFirstViewId);
+CPPUNIT_ASSERT_EQUAL(OString(";Default"), 
pXImpressDocument->getViewRenderState());
+}
+
+// Helper function to get a tile to a bitmap and check the pixel color
+static void assertTilePixelColor(SdXImpressDocument* pXImpressDocument, int 
nPixelX, int nPixelY, Color aColor)
+{
+size_t nCanvasSize = 1024;
+size_t nTileSize = 256;
+std::vector aPixmap(nCanvasSize * nCanvasSize * 4, 0);
+ScopedVclPtrInstance pDevice(DeviceFormat::WITHOUT_ALPHA);
+pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
+pDevice->SetOutputSizePixelScaleOffsetAndLOKBuffer(Size(nCanvasSize, 
nCanvasSize),
+Fraction(1.0), Point(), aPixmap.data());

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - cui/inc cui/source cui/uiconfig include/vcl officecfg/registry sc/inc sc/source sd/inc sd/qa sd/source svtools/source sw/qa vcl/sou

2023-05-05 Thread Paris Oplopoios (via logerrit)
 cui/inc/strings.hrc|1 
 cui/source/options/optcolor.cxx|   36 +
 cui/source/options/optcolor.hxx|3 
 cui/uiconfig/ui/optappearancepage.ui   |  220 +
 include/vcl/settings.hxx   |3 
 officecfg/registry/data/org/openoffice/Office/UI.xcu   |  298 -
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |   25 +
 sc/inc/viewopti.hxx|2 
 sc/source/ui/view/gridwin4.cxx |2 
 sd/inc/viewopt.hxx |2 
 sd/qa/unit/tiledrendering/tiledrendering.cxx   |   88 +++
 sd/source/ui/unoidl/unomodel.cxx   |6 
 sd/source/ui/view/drviewsk.cxx |1 
 svtools/source/config/colorcfg.cxx |  121 ++---
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   54 +-
 vcl/source/app/settings.cxx|   12 
 16 files changed, 380 insertions(+), 494 deletions(-)

New commits:
commit c1bc450f395dbebcf3481fdcdf3f63c8867cab5f
Author: Paris Oplopoios 
AuthorDate: Wed May 3 14:46:37 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Fri May 5 11:34:18 2023 +0200

Application color should follow system color patch backport

Patch https://gerrit.libreoffice.org/c/core/+/149059 removed dark mode
and made application color follow system color. This patch backports
that patch to co-23.05 and changes the tests to account for the new ways
to change to dark mode.

Change-Id: I49a99a73bce6cb26f8e8e2ab2f642483c9ee195b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151320
Tested-by: Paris Oplopoios 
Reviewed-by: Paris Oplopoios 

diff --git a/cui/inc/strings.hrc b/cui/inc/strings.hrc
index cb90ffe6d7df..b665204dc7a9 100644
--- a/cui/inc/strings.hrc
+++ b/cui/inc/strings.hrc
@@ -406,6 +406,5 @@
 
 // Translatable names of color schemes
 #define RID_COLOR_SCHEME_LIBREOFFICE_AUTOMATIC  
NC_("RID_COLOR_SCHEME_LIBREOFFICE_AUTOMATIC", "Automatic")
-#define RID_COLOR_SCHEME_LIBREOFFICE_DARK   
NC_("RID_COLOR_SCHEME_LIBREOFFICE_DARK", "Dark")
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx
index 112be3ea215c..7a37e1187b53 100644
--- a/cui/source/options/optcolor.cxx
+++ b/cui/source/options/optcolor.cxx
@@ -34,7 +34,8 @@
 #include 
 #include "optcolor.hxx"
 #include 
-
+#include 
+#include 
 using namespace ::com::sun::star;
 using namespace ::svtools;
 
@@ -164,7 +165,6 @@ const std::map ()
 {
 static std::map const vColorSchemes = {
 {"COLOR_SCHEME_LIBREOFFICE_AUTOMATIC", 
CuiResId(RID_COLOR_SCHEME_LIBREOFFICE_AUTOMATIC)},
-{"COLOR_SCHEME_LIBREOFFICE_DARK",  
CuiResId(RID_COLOR_SCHEME_LIBREOFFICE_DARK)}
 };
 return vColorSchemes;
 };
@@ -203,6 +203,7 @@ public:
   Link const&,
   weld::ScrolledWindow& rScroll);
 void Update(EditableColorConfig const*, EditableExtendedColorConfig 
const*);
+void UpdateEntries();
 void ClickHdl(EditableColorConfig*, const weld::Toggleable&);
 void ColorHdl(EditableColorConfig*, EditableExtendedColorConfig*, const 
ColorListBox*);
 
@@ -527,6 +528,16 @@ void ColorConfigWindow_Impl::Update (
 }
 }
 
+void ColorConfigWindow_Impl::UpdateEntries()
+{
+for (unsigned i = 0; i != ColorConfigEntryCount; ++i)
+{
+ColorConfigEntry const aEntry = static_cast(i);
+Color aColor = ColorConfig::GetDefaultColor(aEntry);
+vEntries[i]->m_xColorList->SetAutoDisplayColor(aColor);
+}
+}
+
 // ClickHdl()
 void ColorConfigWindow_Impl::ClickHdl(EditableColorConfig* pConfig, const 
weld::Toggleable& rBox)
 {
@@ -626,6 +637,7 @@ public:
 void SetConfig (EditableColorConfig& rConfig) { pColorConfig =  }
 void SetExtendedConfig (EditableExtendedColorConfig& rConfig) { 
pExtColorConfig =  }
 void Update();
+void UpdateEntries();
 tools::Long GetScrollPosition() const
 {
 return m_xVScroll->vadjustment_get_value();
@@ -669,6 +681,11 @@ void ColorConfigCtrl_Impl::Update ()
 m_xScrollWindow->Update(pColorConfig, pExtColorConfig);
 }
 
+void ColorConfigCtrl_Impl::UpdateEntries()
+{
+m_xScrollWindow->UpdateEntries();
+}
+
 IMPL_LINK(ColorConfigCtrl_Impl, ClickHdl, weld::Toggleable&, rBox, void)
 {
 DBG_ASSERT(pColorConfig, "Configuration not set");
@@ -725,6 +742,7 @@ 
SvxColorOptionsTabPage::SvxColorOptionsTabPage(weld::Container* pPage, weld::Dia
 : SfxTabPage(pPage, pController, "cui/ui/optappearancepage.ui", 
"OptAppearancePage", )
 , bFillItemSetCalled(false)
 , m_nSizeAllocEventId(nullptr)
+, m_xAutoColorLB(m_xBuilder->weld_combo_box("autocolorlb"))
 , 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/qa sw/source

2023-05-04 Thread Paris Oplopoios (via logerrit)
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   13 ++---
 sw/source/uibase/config/viewopt.cxx|1 +
 sw/source/uibase/uno/unotxdoc.cxx  |6 --
 3 files changed, 11 insertions(+), 9 deletions(-)

New commits:
commit 1cd8599ca911133a5dcecb517127ce6e6d29b0dc
Author: Paris Oplopoios 
AuthorDate: Wed Apr 26 12:17:33 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Thu May 4 23:17:16 2023 +0200

Extend tiled rendering test to account for dark mode

Made testGetViewRenderState test for change from light mode to dark mode

Change-Id: Ia02e7a462e595671492405733f25c0bbb3c24080
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151018
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Paris Oplopoios 

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 8c205e9ea167..8e4ff3ea4077 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -1684,7 +1684,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testGetViewRenderState)
 aViewOptions.SetOnlineSpell(true);
 
pXTextDocument->GetDocShell()->GetWrtShell()->ApplyViewOptions(aViewOptions);
 }
-CPPUNIT_ASSERT_EQUAL(OString("PS"), pXTextDocument->getViewRenderState());
+CPPUNIT_ASSERT_EQUAL(OString("PS;Default"), 
pXTextDocument->getViewRenderState());
 
 // Create a second view
 SfxLokHelper::createView();
@@ -1697,11 +1697,11 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testGetViewRenderState)
 aViewOptions.SetOnlineSpell(true);
 
pXTextDocument->GetDocShell()->GetWrtShell()->ApplyViewOptions(aViewOptions);
 }
-CPPUNIT_ASSERT_EQUAL(OString("S"), pXTextDocument->getViewRenderState());
+CPPUNIT_ASSERT_EQUAL(OString("S;Default"), 
pXTextDocument->getViewRenderState());
 
 // Switch back to the first view, and check that the options string is the 
same
 SfxLokHelper::setView(nFirstViewId);
-CPPUNIT_ASSERT_EQUAL(OString("PS"), pXTextDocument->getViewRenderState());
+CPPUNIT_ASSERT_EQUAL(OString("PS;Default"), 
pXTextDocument->getViewRenderState());
 
 // Switch back to the second view, and change to dark mode
 SfxLokHelper::setView(nSecondViewId);
@@ -1711,16 +1711,15 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testGetViewRenderState)
 uno::Reference xFrame = 
pView->GetViewFrame()->GetFrame().GetFrameInterface();
 uno::Sequence aPropertyValues = 
comphelper::InitPropertySequence(
 {
-{ "NewTheme", 
uno::Any(OUString("COLOR_SCHEME_LIBREOFFICE_DARK")) },
+{ "NewTheme", uno::Any(OUString("Dark")) },
 }
 );
 comphelper::dispatchCommand(".uno:ChangeTheme", xFrame, 
aPropertyValues);
 }
-CPPUNIT_ASSERT_EQUAL(OString("SD"), pXTextDocument->getViewRenderState());
-
+CPPUNIT_ASSERT_EQUAL(OString("S;Dark"), 
pXTextDocument->getViewRenderState());
 // Switch back to the first view, and check that the options string is the 
same
 SfxLokHelper::setView(nFirstViewId);
-CPPUNIT_ASSERT_EQUAL(OString("PS"), pXTextDocument->getViewRenderState());
+CPPUNIT_ASSERT_EQUAL(OString("PS;Default"), 
pXTextDocument->getViewRenderState());
 }
 
 // Helper function to get a tile to a bitmap and check the pixel color
diff --git a/sw/source/uibase/config/viewopt.cxx 
b/sw/source/uibase/config/viewopt.cxx
index 668256fb5c42..fb9f9abbac12 100644
--- a/sw/source/uibase/config/viewopt.cxx
+++ b/sw/source/uibase/config/viewopt.cxx
@@ -236,6 +236,7 @@ void SwViewOption::PaintPostIts( OutputDevice *pOut, const 
SwRect , bool b
 }
 
 SwViewOption::SwViewOption() :
+m_sThemeName( "Default" ),
 m_sSymbolFont( "symbol" ),
 m_aRetouchColor( COL_TRANSPARENT ),
 mnViewLayoutColumns( 0 ),
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index 74326311f193..29bede97f15b 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3417,8 +3417,10 @@ OString SwXTextDocument::getViewRenderState()
 aState.append('P');
 if (pVOpt->IsOnlineSpell())
 aState.append('S');
-if (pVOpt->GetThemeName() == u"COLOR_SCHEME_LIBREOFFICE_DARK")
-aState.append('D');
+aState.append(';');
+
+OString aThemeName = OUStringToOString(pVOpt->GetThemeName(), 
RTL_TEXTENCODING_UTF8);
+aState.append(aThemeName);
 }
 }
 return aState.makeStringAndClear();


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

2023-05-02 Thread Paris Oplopoios (via logerrit)
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   96 +
 1 file changed, 96 insertions(+)

New commits:
commit b42f3d450d861ecf7b8867ad2ad38537bf88
Author: Paris Oplopoios 
AuthorDate: Wed Mar 22 16:12:14 2023 +0200
Commit: Miklos Vajna 
CommitDate: Tue May 2 08:37:41 2023 +0200

Test tiled rendering view separation

Make sure that changing the theme in one view doesn't change it in
another view when doing tiled rendering

Change-Id: I0a21dc36bfb825337fe74a11099ecc728b99c861
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149324
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 06b9ee25a64c..c292647db850 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -1677,6 +1677,102 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testGetViewRenderState)
 CPPUNIT_ASSERT_EQUAL(OString("PS;Default"), 
pXTextDocument->getViewRenderState());
 }
 
+// Helper function to get a tile to a bitmap and check the pixel color
+static void assertTilePixelColor(SwXTextDocument* pXTextDocument, int nPixelX, 
int nPixelY, Color aColor)
+{
+size_t nCanvasSize = 1024;
+size_t nTileSize = 256;
+std::vector aPixmap(nCanvasSize * nCanvasSize * 4, 0);
+ScopedVclPtrInstance pDevice(DeviceFormat::WITHOUT_ALPHA);
+pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
+pDevice->SetOutputSizePixelScaleOffsetAndLOKBuffer(Size(nCanvasSize, 
nCanvasSize),
+Fraction(1.0), Point(), aPixmap.data());
+pXTextDocument->paintTile(*pDevice, nCanvasSize, nCanvasSize, 0, 0, 15360, 
7680);
+pDevice->EnableMapMode(false);
+Bitmap aBitmap = pDevice->GetBitmap(Point(0, 0), Size(nTileSize, 
nTileSize));
+Bitmap::ScopedReadAccess pAccess(aBitmap);
+Color aActualColor(pAccess->GetPixel(nPixelX, nPixelY));
+CPPUNIT_ASSERT_EQUAL(aColor, aActualColor);
+}
+
+// Test that changing the theme in one view doesn't change it in the other view
+CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testThemeViewSeparation)
+{
+Color aDarkColor(0x1c, 0x1c, 0x1c);
+// Add a minimal dark scheme
+{
+svtools::EditableColorConfig aColorConfig;
+svtools::ColorConfigValue aValue;
+aValue.bIsVisible = true;
+aValue.nColor = aDarkColor;
+aColorConfig.SetColorValue(svtools::DOCCOLOR, aValue);
+aColorConfig.AddScheme(u"Dark");
+}
+// Add a minimal light scheme
+{
+svtools::EditableColorConfig aColorConfig;
+svtools::ColorConfigValue aValue;
+aValue.bIsVisible = true;
+aValue.nColor = COL_WHITE;
+aColorConfig.SetColorValue(svtools::DOCCOLOR, aValue);
+aColorConfig.AddScheme(u"Light");
+}
+SwXTextDocument* pXTextDocument = createDoc();
+int nFirstViewId = SfxLokHelper::getView();
+ViewCallback aView1;
+// Set first view to light scheme
+{
+SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc();
+SwView* pView = pDoc->GetDocShell()->GetView();
+uno::Reference xFrame = 
pView->GetViewFrame().GetFrame().GetFrameInterface();
+uno::Sequence aPropertyValues = 
comphelper::InitPropertySequence(
+{
+{ "NewTheme", uno::Any(OUString("Light")) },
+}
+);
+comphelper::dispatchCommand(".uno:ChangeTheme", xFrame, 
aPropertyValues);
+}
+// First view is in light scheme
+assertTilePixelColor(pXTextDocument, 255, 255, COL_WHITE);
+// Create second view
+SfxLokHelper::createView();
+int nSecondViewId = SfxLokHelper::getView();
+ViewCallback aView2;
+// Set second view to dark scheme
+{
+SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc();
+SwView* pView = pDoc->GetDocShell()->GetView();
+uno::Reference xFrame = 
pView->GetViewFrame().GetFrame().GetFrameInterface();
+uno::Sequence aPropertyValues = 
comphelper::InitPropertySequence(
+{
+{ "NewTheme", uno::Any(OUString("Dark")) },
+}
+);
+comphelper::dispatchCommand(".uno:ChangeTheme", xFrame, 
aPropertyValues);
+}
+assertTilePixelColor(pXTextDocument, 255, 255, aDarkColor);
+// First view still in light scheme
+SfxLokHelper::setView(nFirstViewId);
+assertTilePixelColor(pXTextDocument, 255, 255, COL_WHITE);
+// Second view still in dark scheme
+SfxLokHelper::setView(nSecondViewId);
+assertTilePixelColor(pXTextDocument, 255, 255, aDarkColor);
+// Switch second view back to light scheme
+{
+SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc();
+SwView* pView = pDoc->GetDocShell()->GetView();
+uno::Reference xFrame = 
pView->GetViewFrame().GetFrame().GetFrameInterface();
+uno::Sequence aPropertyValues = 
comphelper::InitPropertySequence(
+  

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sd/inc sd/qa sd/source

2023-04-28 Thread Paris Oplopoios (via logerrit)
 sd/inc/viewopt.hxx   |   34 ++
 sd/qa/unit/tiledrendering/tiledrendering.cxx |   63 +++
 sd/source/ui/inc/DrawViewShell.hxx   |5 +-
 sd/source/ui/inc/unomodel.hxx|3 +
 sd/source/ui/unoidl/unomodel.cxx |   14 ++
 sd/source/ui/view/drviews4.cxx   |2 
 sd/source/ui/view/drviews5.cxx   |2 
 sd/source/ui/view/drviewsa.cxx   |1 
 sd/source/ui/view/drviewsk.cxx   |   24 +-
 9 files changed, 142 insertions(+), 6 deletions(-)

New commits:
commit fa2fdc90d5fba9420cbb475f8c88423124c158ec
Author: Paris Oplopoios 
AuthorDate: Wed Apr 12 04:23:56 2023 +0300
Commit: Miklos Vajna 
CommitDate: Fri Apr 28 10:07:39 2023 +0200

Add view options class in Draw

Add SdViewOptions class in Draw to hold the view state and
manage view separation in tiled rendering mode

Change-Id: I1546fa536555b3262217ff4be163a48b958b7a33
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150249
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sd/inc/viewopt.hxx b/sd/inc/viewopt.hxx
new file mode 100644
index ..0e12dc067427
--- /dev/null
+++ b/sd/inc/viewopt.hxx
@@ -0,0 +1,34 @@
+/* -*- 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 .
+ */
+
+#include 
+#include 
+
+/// View options for the current view
+struct SdViewOptions
+{
+// The color of the area behind the slide (used to be called "Wiese")
+Color mnAppBackgroundColor;
+// The color of the document background
+Color mnDocBackgroundColor;
+// The name of the color scheme
+OUString msColorSchemeName;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 67f81fa7be04..5c3325ad42f0 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -51,6 +51,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 
 #include 
@@ -120,6 +122,7 @@ public:
 void testTdf115873();
 void testTdf115873Group();
 void testCutSelectionChange();
+void testThemeViewSeparation();
 void testRegenerateDiagram();
 void testLanguageAllText();
 void testInsertDeletePageInvalidation();
@@ -179,6 +182,7 @@ public:
 CPPUNIT_TEST(testTdf115873);
 CPPUNIT_TEST(testTdf115873Group);
 CPPUNIT_TEST(testCutSelectionChange);
+CPPUNIT_TEST(testThemeViewSeparation);
 CPPUNIT_TEST(testRegenerateDiagram);
 CPPUNIT_TEST(testLanguageAllText);
 CPPUNIT_TEST(testInsertDeletePageInvalidation);
@@ -2534,6 +2538,65 @@ void SdTiledRenderingTest::testCutSelectionChange()
 CPPUNIT_ASSERT_EQUAL(static_cast(0), m_aSelection.size());
 }
 
+// Helper function to get a tile to a bitmap and check the pixel color
+static void assertTilePixelColor(SdXImpressDocument* pXTextDocument, int 
nPixelX, int nPixelY, Color aColor)
+{
+size_t nCanvasSize = 1024;
+size_t nTileSize = 256;
+std::vector aPixmap(nCanvasSize * nCanvasSize * 4, 0);
+ScopedVclPtrInstance pDevice(DeviceFormat::DEFAULT);
+pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
+pDevice->SetOutputSizePixelScaleOffsetAndLOKBuffer(Size(nCanvasSize, 
nCanvasSize),
+Fraction(1.0), Point(), aPixmap.data());
+pXTextDocument->paintTile(*pDevice, nCanvasSize, nCanvasSize, 0, 0, 15360, 
7680);
+pDevice->EnableMapMode(false);
+Bitmap aBitmap = pDevice->GetBitmap(Point(0, 0), Size(nTileSize, 
nTileSize));
+Bitmap::ScopedReadAccess pAccess(aBitmap);
+Color aActualColor(pAccess->GetPixel(nPixelX, nPixelY));
+CPPUNIT_ASSERT_EQUAL(aColor, aActualColor);
+}
+
+// Test that changing the theme in one view doesn't change it in the other view
+void SdTiledRenderingTest::testThemeViewSeparation()
+{
+SdXImpressDocument* pXTextDocument = createDoc("dummy.odp");
+int nFirstViewId = SfxLokHelper::getView();
+ViewCallback aView1;
+// First view is at light mode
+

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

2023-04-27 Thread Paris Oplopoios (via logerrit)
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   25 ++---
 sw/source/uibase/config/viewopt.cxx|1 +
 sw/source/uibase/uno/unotxdoc.cxx  |4 
 3 files changed, 27 insertions(+), 3 deletions(-)

New commits:
commit 292f422c421336c43bafe5ee048832137d617436
Author: Paris Oplopoios 
AuthorDate: Wed Apr 26 12:17:33 2023 +0300
Commit: Miklos Vajna 
CommitDate: Thu Apr 27 08:23:40 2023 +0200

Extend tiled rendering test to account for dark mode

Made testGetViewRenderState test for change from light mode to dark mode

Change-Id: Ia02e7a462e595671492405733f25c0bbb3c24080
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151046
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 19bd70fa78e4..06b9ee25a64c 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -1639,10 +1639,11 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testGetViewRenderState)
 aViewOptions.SetOnlineSpell(true);
 
pXTextDocument->GetDocShell()->GetWrtShell()->ApplyViewOptions(aViewOptions);
 }
-CPPUNIT_ASSERT_EQUAL(OString("PS"), pXTextDocument->getViewRenderState());
+CPPUNIT_ASSERT_EQUAL(OString("PS;Default"), 
pXTextDocument->getViewRenderState());
 
 // Create a second view
 SfxLokHelper::createView();
+int nSecondViewId = SfxLokHelper::getView();
 ViewCallback aView2;
 {
 // Give the second view different options
@@ -1651,11 +1652,29 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testGetViewRenderState)
 aViewOptions.SetOnlineSpell(true);
 
pXTextDocument->GetDocShell()->GetWrtShell()->ApplyViewOptions(aViewOptions);
 }
-CPPUNIT_ASSERT_EQUAL(OString("S"), pXTextDocument->getViewRenderState());
+CPPUNIT_ASSERT_EQUAL(OString("S;Default"), 
pXTextDocument->getViewRenderState());
 
 // Switch back to the first view, and check that the options string is the 
same
 SfxLokHelper::setView(nFirstViewId);
-CPPUNIT_ASSERT_EQUAL(OString("PS"), pXTextDocument->getViewRenderState());
+CPPUNIT_ASSERT_EQUAL(OString("PS;Default"), 
pXTextDocument->getViewRenderState());
+
+// Switch back to the second view, and change to dark mode
+SfxLokHelper::setView(nSecondViewId);
+{
+SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc();
+SwView* pView = pDoc->GetDocShell()->GetView();
+uno::Reference xFrame = 
pView->GetViewFrame().GetFrame().GetFrameInterface();
+uno::Sequence aPropertyValues = 
comphelper::InitPropertySequence(
+{
+{ "NewTheme", uno::Any(OUString("Dark")) },
+}
+);
+comphelper::dispatchCommand(".uno:ChangeTheme", xFrame, 
aPropertyValues);
+}
+CPPUNIT_ASSERT_EQUAL(OString("S;Dark"), 
pXTextDocument->getViewRenderState());
+// Switch back to the first view, and check that the options string is the 
same
+SfxLokHelper::setView(nFirstViewId);
+CPPUNIT_ASSERT_EQUAL(OString("PS;Default"), 
pXTextDocument->getViewRenderState());
 }
 
 CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testSetViewGraphicSelection)
diff --git a/sw/source/uibase/config/viewopt.cxx 
b/sw/source/uibase/config/viewopt.cxx
index 6b9ca4967c36..2f456a317e92 100644
--- a/sw/source/uibase/config/viewopt.cxx
+++ b/sw/source/uibase/config/viewopt.cxx
@@ -237,6 +237,7 @@ void SwViewOption::PaintPostIts( OutputDevice *pOut, const 
SwRect , bool b
 }
 
 SwViewOption::SwViewOption() :
+m_sThemeName( "Default" ),
 m_sSymbolFont( "symbol" ),
 m_aRetouchColor( COL_TRANSPARENT ),
 mnViewLayoutColumns( 0 ),
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index e7eb52e81a21..f107586c1a29 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3414,6 +3414,10 @@ OString SwXTextDocument::getViewRenderState()
 aState.append('P');
 if (pVOpt->IsOnlineSpell())
 aState.append('S');
+aState.append(';');
+
+OString aThemeName = OUStringToOString(pVOpt->GetThemeName(), 
RTL_TEXTENCODING_UTF8);
+aState.append(aThemeName);
 }
 }
 return aState.makeStringAndClear();


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

2023-04-05 Thread Paris Oplopoios (via logerrit)
 sw/source/uibase/app/apphdl.cxx |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit d4240225d159db9912f565f954598052ab7a63b8
Author: Paris Oplopoios 
AuthorDate: Sat Apr 1 18:03:44 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Wed Apr 5 14:09:14 2023 +0200

Notify LOK that application background color has been changed

Notify LOK when the application background color changes in Writer

Change-Id: Ibc900cc8b3253aaa5b53602a007566896f04d9df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149906
Tested-by: Paris Oplopoios 
Reviewed-by: Paris Oplopoios 
(cherry picked from commit 0dca587be41718d2d88e80fc585829ad83da59ea)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149892
Tested-by: Jenkins

diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index 546fd6902276..5b7e7bcd9137 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -80,6 +80,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -989,9 +990,15 @@ void SwModule::ConfigurationChanged( 
utl::ConfigurationBroadcaster* pBrdCst, Con
 {
 SwViewOption aNewOptions = 
*pSwView->GetWrtShell().GetViewOptions();
 
aNewOptions.SetThemeName(m_pColorConfig->GetCurrentSchemeName());
-aNewOptions.SetColorConfig(*m_pColorConfig);
+SwViewColors aViewColors(*m_pColorConfig);
+aNewOptions.SetColorConfig(aViewColors);
 pSwView->GetWrtShell().ApplyViewOptions(aNewOptions);
 pViewShell->GetWindow()->Invalidate();
+if (bOnlyInvalidateCurrentView)
+{
+
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR,
+
aViewColors.m_aAppBackgroundColor.AsRGBHexString().toUtf8().getStr());
+}
 }
 }
 if (bOnlyInvalidateCurrentView)


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/source

2023-04-01 Thread Paris Oplopoios (via logerrit)
 sw/source/uibase/app/apphdl.cxx |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 0dca587be41718d2d88e80fc585829ad83da59ea
Author: Paris Oplopoios 
AuthorDate: Sat Apr 1 18:03:44 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Sat Apr 1 19:29:52 2023 +0200

Notify LOK that application background color has been changed

Notify LOK when the application background color changes in Writer

Change-Id: Ibc900cc8b3253aaa5b53602a007566896f04d9df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149906
Tested-by: Paris Oplopoios 
Reviewed-by: Paris Oplopoios 

diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index ed1c5ee792d4..1bf1145a5dec 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -80,6 +80,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -984,9 +985,15 @@ void SwModule::ConfigurationChanged( 
utl::ConfigurationBroadcaster* pBrdCst, Con
 {
 SwViewOption aNewOptions = 
*pSwView->GetWrtShell().GetViewOptions();
 
aNewOptions.SetThemeName(m_pColorConfig->GetCurrentSchemeName());
-aNewOptions.SetColorConfig(*m_pColorConfig);
+SwViewColors aViewColors(*m_pColorConfig);
+aNewOptions.SetColorConfig(aViewColors);
 pSwView->GetWrtShell().ApplyViewOptions(aNewOptions);
 pViewShell->GetWindow()->Invalidate();
+if (bOnlyInvalidateCurrentView)
+{
+
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR,
+
aViewColors.m_aAppBackgroundColor.AsRGBHexString().toUtf8().getStr());
+}
 }
 }
 if (bOnlyInvalidateCurrentView)


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

2023-04-01 Thread Paris Oplopoios (via logerrit)
 include/LibreOfficeKit/LibreOfficeKitEnums.h |   10 +-
 libreofficekit/source/gtk/lokdocview.cxx |1 +
 2 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 8d0cab477904091f3d663e6d90aca95a66d199b0
Author: Paris Oplopoios 
AuthorDate: Wed Mar 29 13:47:06 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Sat Apr 1 13:03:22 2023 +0200

Add LoKit callback for application color change

Change-Id: I9d0fe4ab878c9d3a4a6d842be5cd534b97bf77a8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149822
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Paris Oplopoios 
(cherry picked from commit 48650acef94147c2100eade8c583fddc770b94ef)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149876
Tested-by: Jenkins

diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 6e02c92596f1..f57e00afa185 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -916,7 +916,13 @@ typedef enum
  * Payload is an opaque string that matches this set of states.
  * this will be emitted after creating a new view.
  */
-LOK_CALLBACK_VIEW_RENDER_STATE = 60
+LOK_CALLBACK_VIEW_RENDER_STATE = 60,
+
+/**
+ * Informs the LibreOfficeKit client that the background color surrounding
+ * the document has changed.
+*/
+   LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR = 61
 }
 LibreOfficeKitCallbackType;
 
@@ -1067,6 +1073,8 @@ static inline const char* lokCallbackTypeToString(int 
nType)
 return "LOK_CALLBACK_EXPORT_FILE";
 case LOK_CALLBACK_VIEW_RENDER_STATE:
 return "LOK_CALLBACK_VIEW_RENDER_STATE";
+case LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR:
+return "LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR";
 }
 
 assert(!"Unknown LibreOfficeKitCallbackType type.");
diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index 8fcbe9a404fc..76f94293956b 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -1487,6 +1487,7 @@ callback (gpointer pData)
 case LOK_CALLBACK_MEDIA_SHAPE:
 case LOK_CALLBACK_EXPORT_FILE:
 case LOK_CALLBACK_VIEW_RENDER_STATE:
+case LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR:
 {
 // TODO: Implement me
 break;


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - include/LibreOfficeKit libreofficekit/source

2023-03-31 Thread Paris Oplopoios (via logerrit)
 include/LibreOfficeKit/LibreOfficeKitEnums.h |   10 +-
 libreofficekit/source/gtk/lokdocview.cxx |1 +
 2 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 2480f572e05bc1c15696cb955187491778a6bded
Author: Paris Oplopoios 
AuthorDate: Wed Mar 29 13:47:06 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Sat Apr 1 01:52:23 2023 +0200

Add LoKit callback for application color change

Change-Id: I9d0fe4ab878c9d3a4a6d842be5cd534b97bf77a8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149822
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Paris Oplopoios 

diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 6e02c92596f1..f57e00afa185 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -916,7 +916,13 @@ typedef enum
  * Payload is an opaque string that matches this set of states.
  * this will be emitted after creating a new view.
  */
-LOK_CALLBACK_VIEW_RENDER_STATE = 60
+LOK_CALLBACK_VIEW_RENDER_STATE = 60,
+
+/**
+ * Informs the LibreOfficeKit client that the background color surrounding
+ * the document has changed.
+*/
+   LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR = 61
 }
 LibreOfficeKitCallbackType;
 
@@ -1067,6 +1073,8 @@ static inline const char* lokCallbackTypeToString(int 
nType)
 return "LOK_CALLBACK_EXPORT_FILE";
 case LOK_CALLBACK_VIEW_RENDER_STATE:
 return "LOK_CALLBACK_VIEW_RENDER_STATE";
+case LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR:
+return "LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR";
 }
 
 assert(!"Unknown LibreOfficeKitCallbackType type.");
diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index 8fcbe9a404fc..76f94293956b 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -1487,6 +1487,7 @@ callback (gpointer pData)
 case LOK_CALLBACK_MEDIA_SHAPE:
 case LOK_CALLBACK_EXPORT_FILE:
 case LOK_CALLBACK_VIEW_RENDER_STATE:
+case LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR:
 {
 // TODO: Implement me
 break;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-5-2' - sc/qa sc/source

2023-03-24 Thread Paris Oplopoios (via logerrit)
 sc/qa/unit/uicalc/data/simpleTable.xlsx |binary
 sc/qa/unit/uicalc/uicalc.cxx|   15 +++
 sc/source/core/tool/dbdata.cxx  |7 ++-
 3 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit 41ffe9b42bad5085072c94c18fc9b6d17528a7ef
Author: Paris Oplopoios 
AuthorDate: Wed Mar 8 23:04:49 2023 +0200
Commit: Christian Lohmaier 
CommitDate: Fri Mar 24 16:24:27 2023 +

tdf#154061 Make sure table column attributes size is correct

Resize maTableColumnAttributes to match the amount of columns, fixes
crash upon undoing a column insertion on a table

Change-Id: Iad4b8ac5c38d5d1065d6ef1267ce3f5d3b28afa8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148492
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 2135706397d36aa7ea24650b65859be0b6860a65)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148972
Reviewed-by: Xisco Fauli 
(cherry picked from commit 3abe8c150d72eaef8dd2998ee13cdd2226ac2360)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149020
Tested-by: Christian Lohmaier 
Reviewed-by: Christian Lohmaier 

diff --git a/sc/qa/unit/uicalc/data/simpleTable.xlsx 
b/sc/qa/unit/uicalc/data/simpleTable.xlsx
new file mode 100644
index ..fd4e394732ba
Binary files /dev/null and b/sc/qa/unit/uicalc/data/simpleTable.xlsx differ
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index 4976c19c17f0..25b4d0790383 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -2082,6 +2082,21 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf142010)
 CPPUNIT_ASSERT_EQUAL(5.0, pDoc->GetValue(ScAddress(5, 71, 0)));
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf154061)
+{
+createScDoc("simpleTable.xlsx");
+ScDocument* pDoc = getScDoc();
+CPPUNIT_ASSERT_EQUAL(OUString("Column2"), pDoc->GetString(ScAddress(1, 0, 
0)));
+
+goToCell("B1");
+
+// Without the fix in place, it would crash here due to an out of bounds 
array access
+dispatchCommand(mxComponent, ".uno:InsertColumnsBefore", {});
+CPPUNIT_ASSERT_EQUAL(OUString("Column2"), pDoc->GetString(ScAddress(2, 0, 
0)));
+dispatchCommand(mxComponent, ".uno:Undo", {});
+CPPUNIT_ASSERT_EQUAL(OUString("Column2"), pDoc->GetString(ScAddress(1, 0, 
0)));
+}
+
 CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf132431)
 {
 createScDoc("tdf132431.ods");
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index dc10d6a0503e..293bb20a4976 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -116,6 +116,7 @@ ScDBData::ScDBData( const ScDBData& rData ) :
 bAutoFilter (rData.bAutoFilter),
 bModified   (rData.bModified),
 maTableColumnNames  (rData.maTableColumnNames),
+maTableColumnAttributes(rData.maTableColumnAttributes),
 mbTableColumnNamesDirty(rData.mbTableColumnNamesDirty),
 nFilteredRowCount   (rData.nFilteredRowCount)
 {
@@ -150,6 +151,7 @@ ScDBData::ScDBData( const OUString& rName, const ScDBData& 
rData ) :
 bAutoFilter (rData.bAutoFilter),
 bModified   (rData.bModified),
 maTableColumnNames  (rData.maTableColumnNames),
+maTableColumnAttributes(rData.maTableColumnAttributes),
 mbTableColumnNamesDirty (rData.mbTableColumnNamesDirty),
 nFilteredRowCount   (rData.nFilteredRowCount)
 {
@@ -199,6 +201,7 @@ ScDBData& ScDBData::operator= (const ScDBData& rData)
 else
 {
 maTableColumnNames  = rData.maTableColumnNames;
+maTableColumnAttributes = rData.maTableColumnAttributes;
 mbTableColumnNamesDirty = rData.mbTableColumnNamesDirty;
 }
 
@@ -577,6 +580,7 @@ void ScDBData::UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos)
 aRange.aEnd.Row());
 // Do not use SetTableColumnNames() because that resets 
mbTableColumnNamesDirty.
 maTableColumnNames = aNames;
+maTableColumnAttributes.resize(aNames.size());
 mbTableColumnNamesDirty = bTableColumnNamesDirty;
 }
 
@@ -620,6 +624,7 @@ bool ScDBData::UpdateReference(const ScDocument* pDoc, 
UpdateRefMode eUpdateRefM
 MoveTo( theTab1, theCol1, theRow1, theCol2, theRow2 );
 // Do not use SetTableColumnNames() because that resets 
mbTableColumnNamesDirty.
 maTableColumnNames = aNames;
+maTableColumnAttributes.resize(aNames.size());
 mbTableColumnNamesDirty = bTableColumnNamesDirty;
 }
 
@@ -721,7 +726,6 @@ void ScDBData::AdjustTableColumnAttributes( UpdateRefMode 
eUpdateRefMode, SCCOL
 n += nDx;
 aNewNames.resize(n);
 aNewAttributes.resize(n);
-maTableColumnAttributes.resize(n);
 // Copy head.
 for (size_t i = 0; i < nHead; ++i)
 {
@@ -876,6 +880,7 @@ void ScDBData::RefreshTableColumnNames( ScDocument* pDoc )
 }
 
 aNewNames.swap( 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/qa

2023-03-23 Thread Paris Oplopoios (via logerrit)
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   65 +
 1 file changed, 65 insertions(+)

New commits:
commit cc5038f07291b034641b75bfcefa70f0ac6e1897
Author: Paris Oplopoios 
AuthorDate: Wed Mar 22 16:12:14 2023 +0200
Commit: Paris Oplopoios 
CommitDate: Thu Mar 23 23:14:06 2023 +

Test tiled rendering view separation

Make sure that changing the theme in one view doesn't change it in
another view when doing tiled rendering

Change-Id: I0a21dc36bfb825337fe74a11099ecc728b99c861
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149441
Tested-by: Paris Oplopoios 
Reviewed-by: Paris Oplopoios 

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 7fcdeb0644d4..317d77f0b29b 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -1719,6 +1719,71 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testGetViewRenderState)
 CPPUNIT_ASSERT_EQUAL(OString("PS"), pXTextDocument->getViewRenderState());
 }
 
+// Helper function to get a tile to a bitmap and check the pixel color
+static void assertTilePixelColor(SwXTextDocument* pXTextDocument, int nPixelX, 
int nPixelY, Color aColor)
+{
+size_t nCanvasSize = 1024;
+size_t nTileSize = 256;
+std::vector aPixmap(nCanvasSize * nCanvasSize * 4, 0);
+ScopedVclPtrInstance pDevice(DeviceFormat::DEFAULT);
+pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
+pDevice->SetOutputSizePixelScaleOffsetAndLOKBuffer(Size(nCanvasSize, 
nCanvasSize),
+Fraction(1.0), Point(), aPixmap.data());
+pXTextDocument->paintTile(*pDevice, nCanvasSize, nCanvasSize, 0, 0, 15360, 
7680);
+pDevice->EnableMapMode(false);
+Bitmap aBitmap = pDevice->GetBitmap(Point(0, 0), Size(nTileSize, 
nTileSize));
+Bitmap::ScopedReadAccess pAccess(aBitmap);
+Color aActualColor(pAccess->GetPixel(nPixelX, nPixelY));
+CPPUNIT_ASSERT_EQUAL(aColor, aActualColor);
+}
+
+// Test that changing the theme in one view doesn't change it in the other view
+CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testThemeViewSeparation)
+{
+SwXTextDocument* pXTextDocument = createDoc();
+int nFirstViewId = SfxLokHelper::getView();
+ViewCallback aView1;
+// First view is at light mode
+assertTilePixelColor(pXTextDocument, 255, 255, COL_WHITE);
+// Create second view
+SfxLokHelper::createView();
+int nSecondViewId = SfxLokHelper::getView();
+ViewCallback aView2;
+// Set second view to dark mode
+{
+SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc();
+SwView* pView = pDoc->GetDocShell()->GetView();
+uno::Reference xFrame = 
pView->GetViewFrame()->GetFrame().GetFrameInterface();
+uno::Sequence aPropertyValues = 
comphelper::InitPropertySequence(
+{
+{ "NewTheme", 
uno::Any(OUString("COLOR_SCHEME_LIBREOFFICE_DARK")) },
+}
+);
+comphelper::dispatchCommand(".uno:ChangeTheme", xFrame, 
aPropertyValues);
+}
+assertTilePixelColor(pXTextDocument, 255, 255, Color(0x1c, 0x1c, 0x1c));
+// First view still in light mode
+SfxLokHelper::setView(nFirstViewId);
+assertTilePixelColor(pXTextDocument, 255, 255, COL_WHITE);
+// Second view still in dark mode
+SfxLokHelper::setView(nSecondViewId);
+assertTilePixelColor(pXTextDocument, 255, 255, Color(0x1c, 0x1c, 0x1c));
+// Switch second view back to light mode
+{
+SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc();
+SwView* pView = pDoc->GetDocShell()->GetView();
+uno::Reference xFrame = 
pView->GetViewFrame()->GetFrame().GetFrameInterface();
+uno::Sequence aPropertyValues = 
comphelper::InitPropertySequence(
+{
+{ "NewTheme", 
uno::Any(OUString("COLOR_SCHEME_LIBREOFFICE_AUTOMATIC")) },
+}
+);
+comphelper::dispatchCommand(".uno:ChangeTheme", xFrame, 
aPropertyValues);
+}
+// Now in light mode
+assertTilePixelColor(pXTextDocument, 255, 255, COL_WHITE);
+}
+
 CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testSetViewGraphicSelection)
 {
 // Load a document.


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - include/svtools svtools/source sw/inc sw/qa sw/source

2023-03-17 Thread Paris Oplopoios (via logerrit)
 include/svtools/colorcfg.hxx   |1 +
 svtools/source/config/colorcfg.cxx |5 +
 sw/inc/viewopt.hxx |   11 +++
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   20 
 sw/source/core/view/viewsh.cxx |1 -
 sw/source/uibase/app/apphdl.cxx|9 +++--
 sw/source/uibase/config/viewopt.cxx|2 ++
 sw/source/uibase/uno/unotxdoc.cxx  |2 ++
 8 files changed, 48 insertions(+), 3 deletions(-)

New commits:
commit 2f08fac476b150a9c9850df7b1c6823e35ddae7d
Author: Paris Oplopoios 
AuthorDate: Thu Mar 16 03:58:18 2023 +0200
Commit: Paris Oplopoios 
CommitDate: Fri Mar 17 16:22:39 2023 +

Update view options string based on theme

Update the view options string based on the theme when tiled rendering,
and make sure only the currently active view is updated

Change-Id: Ib24111848f2926fe7ae858ca2e18e946d980e83f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148943
Tested-by: Paris Oplopoios 
Reviewed-by: Paris Oplopoios 
(cherry picked from commit 9f0cf00d29298ed55737928ec4dddc50ac850cd8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149024

diff --git a/include/svtools/colorcfg.hxx b/include/svtools/colorcfg.hxx
index 300625cf14a7..08f5d3000bed 100644
--- a/include/svtools/colorcfg.hxx
+++ b/include/svtools/colorcfg.hxx
@@ -109,6 +109,7 @@ public:
 // instead of the automatic color
 ColorConfigValueGetColorValue(ColorConfigEntry eEntry, bool bSmart 
= true) const;
 static ColorGetDefaultColor(ColorConfigEntry eEntry);
+const OUString& GetCurrentSchemeName() const;
 };
 
 class SVT_DLLPUBLIC EditableColorConfig
diff --git a/svtools/source/config/colorcfg.cxx 
b/svtools/source/config/colorcfg.cxx
index ad3170b430ab..93cd989dc64e 100644
--- a/svtools/source/config/colorcfg.cxx
+++ b/svtools/source/config/colorcfg.cxx
@@ -466,6 +466,11 @@ ColorConfigValue 
ColorConfig::GetColorValue(ColorConfigEntry eEntry, bool bSmart
 return aRet;
 }
 
+const OUString& ColorConfig::GetCurrentSchemeName() const
+{
+return m_pImpl->GetLoadedScheme();
+}
+
 EditableColorConfig::EditableColorConfig() :
 m_pImpl(new ColorConfig_Impl),
 m_bModified(false)
diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx
index 4c9dcf8e071b..a6fd5eea8a57 100644
--- a/sw/inc/viewopt.hxx
+++ b/sw/inc/viewopt.hxx
@@ -248,6 +248,7 @@ class SW_DLLPUBLIC SwViewOption
 {
 SwViewColors m_aColorConfig;
 static SwViewColors s_aInitialColorConfig;
+OUString m_sThemeName;
 
 static sal_uInt16   s_nPixelTwips;// 1 Pixel == ? Twips
 
@@ -314,6 +315,16 @@ public:
 return m_aColorConfig;
 }
 
+void SetThemeName(const OUString& rThemeName)
+{
+m_sThemeName = rThemeName;
+}
+
+OUString GetThemeName() const
+{
+return m_sThemeName;
+}
+
 static void SetInitialColorConfig(const SwViewColors& rColorConfig)
 {
 s_aInitialColorConfig = rColorConfig;
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 20159c6aa6dc..7fcdeb0644d4 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -1684,6 +1684,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testGetViewRenderState)
 
 // Create a second view
 SfxLokHelper::createView();
+int nSecondViewId = SfxLokHelper::getView();
 ViewCallback aView2;
 {
 // Give the second view different options
@@ -1697,6 +1698,25 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testGetViewRenderState)
 // Switch back to the first view, and check that the options string is the 
same
 SfxLokHelper::setView(nFirstViewId);
 CPPUNIT_ASSERT_EQUAL(OString("PS"), pXTextDocument->getViewRenderState());
+
+// Switch back to the second view, and change to dark mode
+SfxLokHelper::setView(nSecondViewId);
+{
+SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc();
+SwView* pView = pDoc->GetDocShell()->GetView();
+uno::Reference xFrame = 
pView->GetViewFrame()->GetFrame().GetFrameInterface();
+uno::Sequence aPropertyValues = 
comphelper::InitPropertySequence(
+{
+{ "NewTheme", 
uno::Any(OUString("COLOR_SCHEME_LIBREOFFICE_DARK")) },
+}
+);
+comphelper::dispatchCommand(".uno:ChangeTheme", xFrame, 
aPropertyValues);
+}
+CPPUNIT_ASSERT_EQUAL(OString("SD"), pXTextDocument->getViewRenderState());
+
+// Switch back to the first view, and check that the options string is the 
same
+SfxLokHelper::setView(nFirstViewId);
+CPPUNIT_ASSERT_EQUAL(OString("PS"), pXTextDocument->getViewRenderState());
 }
 
 CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testSetViewGraphicSelection)
diff --git a/sw/source/core/view/viewsh.cxx 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - desktop/source include/sfx2 sfx2/sdi sfx2/source

2023-03-16 Thread Paris Oplopoios (via logerrit)
 desktop/source/lib/init.cxx  |1 +
 include/sfx2/sfxsids.hrc |2 ++
 sfx2/sdi/appslots.sdi|4 
 sfx2/sdi/sfx.sdi |   14 ++
 sfx2/source/appl/appserv.cxx |   14 ++
 5 files changed, 35 insertions(+)

New commits:
commit bcc9698ad4f8d49dfdd981e4f4c289cb9a6db87b
Author: Paris Oplopoios 
AuthorDate: Thu Mar 16 03:55:34 2023 +0200
Commit: Paris Oplopoios 
CommitDate: Fri Mar 17 01:58:10 2023 +

Add uno command that changes the theme

Add an uno command that changes the theme to the one specified in the
first parameter

Change-Id: Ia0fef2ca698415e07f1943cf80ab667fb5c37238
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148942
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 
(cherry picked from commit fc8681b0a783cb82167c42dc0fb730cf2b619eb9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149023
Tested-by: Paris Oplopoios 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 480fc9952e6a..4caa1b034d86 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3424,6 +3424,7 @@ static void doc_iniUnoCommands ()
 OUString(".uno:InsertSlide"),
 OUString(".uno:DeleteSlide"),
 OUString(".uno:DuplicateSlide"),
+OUString(".uno:ChangeTheme"),
 OUString(".uno:Cut"),
 OUString(".uno:Copy"),
 OUString(".uno:Paste"),
diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index d029b314d4d9..d7f602bf5c5a 100644
--- a/include/sfx2/sfxsids.hrc
+++ b/include/sfx2/sfxsids.hrc
@@ -295,6 +295,8 @@ class SvxZoomItem;
 #define SID_TOOLBAR_MODE_UI (SID_SFX_START + 1742)
 #define SID_TOOLBAR_LOCK(SID_SFX_START + 1743)
 #define SID_WIDGET_TEST_DIALOG  (SID_SFX_START + 1744)
+#define FN_CHANGE_THEME (SID_SFX_START + 1745)
+#define FN_PARAM_NEW_THEME  
TypedWhichId(SID_SFX_START + 1746)
 
 //  SID_SFX_free_END(SID_SFX_START + 3999)
 
diff --git a/sfx2/sdi/appslots.sdi b/sfx2/sdi/appslots.sdi
index daa0a86265e0..429c48332f7f 100644
--- a/sfx2/sdi/appslots.sdi
+++ b/sfx2/sdi/appslots.sdi
@@ -64,6 +64,10 @@ interface Application
 [
 ExecMethod = MiscExec_Impl ;
 ]
+FN_CHANGE_THEME // ole(no) api(final/play/rec)
+[
+ExecMethod = MiscExec_Impl ;
+]
 SID_CONFIG // ole(no) api(final/play/rec)
 [
 ExecMethod = MiscExec_Impl ;
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index ca9e68894e1f..ea3340c426a3 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -5807,3 +5807,17 @@ SfxVoidItem WidgetTestDialog SID_WIDGET_TEST_DIALOG
 ToolBoxConfig = TRUE,
 GroupId = SfxGroupId::Application;
 ]
+
+SfxVoidItem ChangeTheme FN_CHANGE_THEME
+(SfxStringItem NewTheme FN_PARAM_NEW_THEME)
+[
+AutoUpdate = FALSE,
+FastCall = FALSE,
+ReadOnlyDoc = FALSE,
+Toggle = FALSE,
+Container = FALSE,
+RecordAbsolute = FALSE,
+RecordPerSet;
+
+GroupId = SfxGroupId::Application;
+]
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index ace3a1434a63..f2dfca480c5d 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -50,6 +50,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -593,6 +594,19 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
 break;
 }
 
+case FN_CHANGE_THEME:
+{
+const SfxStringItem* pNewThemeArg = 
rReq.GetArg(FN_PARAM_NEW_THEME);
+if (!pNewThemeArg)
+{
+SAL_WARN("sfx.appl", "FN_CHANGE_THEME: no theme name");
+break;
+}
+svtools::EditableColorConfig aEditableConfig;
+aEditableConfig.LoadScheme(pNewThemeArg->GetValue());
+break;
+}
+
 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 case SID_HELPINDEX:
 {


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/inc sw/source

2023-03-16 Thread Paris Oplopoios (via logerrit)
 sw/inc/viewopt.hxx   |  172 ++
 sw/source/core/access/accframe.cxx   |2 
 sw/source/core/access/accpara.cxx|2 
 sw/source/core/access/accportions.cxx|2 
 sw/source/core/inc/wrong.hxx |8 
 sw/source/core/layout/paintfrm.cxx   |   69 ++--
 sw/source/core/text/atrstck.cxx  |8 
 sw/source/core/text/inftxt.cxx   |   16 -
 sw/source/core/text/porfld.cxx   |4 
 sw/source/core/text/porref.cxx   |2 
 sw/source/core/text/porrst.cxx   |   10 
 sw/source/core/text/portox.cxx   |2 
 sw/source/core/text/portxt.cxx   |4 
 sw/source/core/text/txtdrop.cxx  |4 
 sw/source/core/txtnode/fntcache.cxx  |2 
 sw/source/core/view/viewimp.cxx  |2 
 sw/source/core/view/viewsh.cxx   |3 
 sw/source/filter/html/htmlfldw.cxx   |8 
 sw/source/ui/chrdlg/drpcps.cxx   |8 
 sw/source/ui/config/optpage.cxx  |5 
 sw/source/ui/envelp/envlop1.cxx  |   10 
 sw/source/ui/envelp/labfmt.cxx   |4 
 sw/source/ui/misc/outline.cxx|   12 
 sw/source/uibase/app/apphdl.cxx  |   11 
 sw/source/uibase/config/viewopt.cxx  |  300 ++-
 sw/source/uibase/docvw/AnnotationWin2.cxx|8 
 sw/source/uibase/docvw/DashedLine.cxx|6 
 sw/source/uibase/docvw/HeaderFooterWin.cxx   |4 
 sw/source/uibase/docvw/PageBreakWin.cxx  |2 
 sw/source/uibase/docvw/UnfloatTableButton.cxx|3 
 sw/source/uibase/docvw/contentcontrolaliasbutton.cxx |3 
 sw/source/uibase/docvw/edtwin.cxx|2 
 sw/source/uibase/frmdlg/colex.cxx|2 
 sw/source/uibase/inc/DashedLine.hxx  |5 
 sw/source/uibase/uiview/view0.cxx|   28 -
 sw/source/uibase/uiview/viewdraw.cxx |2 
 sw/source/uibase/uno/unomod.cxx  |   20 -
 sw/source/uibase/uno/unotxdoc.cxx|4 
 38 files changed, 424 insertions(+), 335 deletions(-)

New commits:
commit 8ffde7f780e93391064d66abc10f0a235378477c
Author: Paris Oplopoios 
AuthorDate: Wed Mar 8 17:34:02 2023 +0200
Commit: Paris Oplopoios 
CommitDate: Fri Mar 17 00:53:39 2023 +

De-static-izing colors in SwViewOption

The view colors in SwViewOption were static which means that two
separate views couldn't have different colors

Change-Id: Id595b00ba56bdb210ad1a784cf76e99ead0d6014
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148481
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148865
Tested-by: Paris Oplopoios 
Reviewed-by: Paris Oplopoios 

diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx
index c399aa6b94dd..4c9dcf8e071b 100644
--- a/sw/inc/viewopt.hxx
+++ b/sw/inc/viewopt.hxx
@@ -193,30 +193,62 @@ namespace o3tl {
 template<> struct typed_flags : is_typed_flags {};
 }
 
+struct SwViewColors
+{
+SwViewColors();
+SwViewColors(const svtools::ColorConfig& rConfig);
+bool operator==(const SwViewColors& rOther) const
+{
+return m_aDocColor == rOther.m_aDocColor
+&& m_aDocBoundColor == rOther.m_aDocBoundColor
+&& m_aObjectBoundColor == rOther.m_aObjectBoundColor
+&& m_aAppBackgroundColor == rOther.m_aAppBackgroundColor
+&& m_aTableBoundColor == rOther.m_aTableBoundColor
+&& m_aFontColor == rOther.m_aFontColor
+&& m_aIndexShadingsColor == rOther.m_aIndexShadingsColor
+&& m_aLinksColor == rOther.m_aLinksColor
+&& m_aVisitedLinksColor == rOther.m_aVisitedLinksColor
+&& m_aDirectCursorColor == rOther.m_aDirectCursorColor
+&& m_aTextGridColor == rOther.m_aTextGridColor
+&& m_aSpellColor == rOther.m_aSpellColor
+&& m_aGrammarColor == rOther.m_aGrammarColor
+&& m_aSmarttagColor == rOther.m_aSmarttagColor
+&& m_aFieldShadingsColor == rOther.m_aFieldShadingsColor
+&& m_aSectionBoundColor == rOther.m_aSectionBoundColor
+&& m_aPageBreakColor == rOther.m_aPageBreakColor
+&& m_aScriptIndicatorColor == rOther.m_aScriptIndicatorColor
+&& m_aShadowColor == rOther.m_aShadowColor
+&& m_aHeaderFooterMarkColor == rOther.m_aHeaderFooterMarkColor
+&& m_nAppearanceFlags == rOther.m_nAppearanceFlags;
+}
+Color m_aDocColor;  // color of document boundaries
+Color m_aDocBoundColor;  // color of document boundaries
+Color 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa sc/source

2023-03-16 Thread Paris Oplopoios (via logerrit)
 sc/qa/unit/uicalc/data/simpleTable.xlsx |binary
 sc/qa/unit/uicalc/uicalc.cxx|   15 +++
 sc/source/core/tool/dbdata.cxx  |7 ++-
 3 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit 280aa685081bf37df98703d97d20e079c6ec0bbe
Author: Paris Oplopoios 
AuthorDate: Wed Mar 8 23:04:49 2023 +0200
Commit: Paris Oplopoios 
CommitDate: Fri Mar 17 00:08:54 2023 +

tdf#154061 Make sure table column attributes size is correct

Resize maTableColumnAttributes to match the amount of columns, fixes
crash upon undoing a column insertion on a table

Change-Id: Iad4b8ac5c38d5d1065d6ef1267ce3f5d3b28afa8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148492
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 2135706397d36aa7ea24650b65859be0b6860a65)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149016
Tested-by: Paris Oplopoios 
Reviewed-by: Paris Oplopoios 

diff --git a/sc/qa/unit/uicalc/data/simpleTable.xlsx 
b/sc/qa/unit/uicalc/data/simpleTable.xlsx
new file mode 100644
index ..fd4e394732ba
Binary files /dev/null and b/sc/qa/unit/uicalc/data/simpleTable.xlsx differ
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index 42d0168aa833..98d3398b09d8 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -2025,6 +2025,21 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf142010)
 CPPUNIT_ASSERT_EQUAL(5.0, pDoc->GetValue(ScAddress(5, 71, 0)));
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf154061)
+{
+createScDoc("simpleTable.xlsx");
+ScDocument* pDoc = getScDoc();
+CPPUNIT_ASSERT_EQUAL(OUString("Column2"), pDoc->GetString(ScAddress(1, 0, 
0)));
+
+goToCell("B1");
+
+// Without the fix in place, it would crash here due to an out of bounds 
array access
+dispatchCommand(mxComponent, ".uno:InsertColumnsBefore", {});
+CPPUNIT_ASSERT_EQUAL(OUString("Column2"), pDoc->GetString(ScAddress(2, 0, 
0)));
+dispatchCommand(mxComponent, ".uno:Undo", {});
+CPPUNIT_ASSERT_EQUAL(OUString("Column2"), pDoc->GetString(ScAddress(1, 0, 
0)));
+}
+
 CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf132431)
 {
 createScDoc("tdf132431.ods");
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index dc10d6a0503e..293bb20a4976 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -116,6 +116,7 @@ ScDBData::ScDBData( const ScDBData& rData ) :
 bAutoFilter (rData.bAutoFilter),
 bModified   (rData.bModified),
 maTableColumnNames  (rData.maTableColumnNames),
+maTableColumnAttributes(rData.maTableColumnAttributes),
 mbTableColumnNamesDirty(rData.mbTableColumnNamesDirty),
 nFilteredRowCount   (rData.nFilteredRowCount)
 {
@@ -150,6 +151,7 @@ ScDBData::ScDBData( const OUString& rName, const ScDBData& 
rData ) :
 bAutoFilter (rData.bAutoFilter),
 bModified   (rData.bModified),
 maTableColumnNames  (rData.maTableColumnNames),
+maTableColumnAttributes(rData.maTableColumnAttributes),
 mbTableColumnNamesDirty (rData.mbTableColumnNamesDirty),
 nFilteredRowCount   (rData.nFilteredRowCount)
 {
@@ -199,6 +201,7 @@ ScDBData& ScDBData::operator= (const ScDBData& rData)
 else
 {
 maTableColumnNames  = rData.maTableColumnNames;
+maTableColumnAttributes = rData.maTableColumnAttributes;
 mbTableColumnNamesDirty = rData.mbTableColumnNamesDirty;
 }
 
@@ -577,6 +580,7 @@ void ScDBData::UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos)
 aRange.aEnd.Row());
 // Do not use SetTableColumnNames() because that resets 
mbTableColumnNamesDirty.
 maTableColumnNames = aNames;
+maTableColumnAttributes.resize(aNames.size());
 mbTableColumnNamesDirty = bTableColumnNamesDirty;
 }
 
@@ -620,6 +624,7 @@ bool ScDBData::UpdateReference(const ScDocument* pDoc, 
UpdateRefMode eUpdateRefM
 MoveTo( theTab1, theCol1, theRow1, theCol2, theRow2 );
 // Do not use SetTableColumnNames() because that resets 
mbTableColumnNamesDirty.
 maTableColumnNames = aNames;
+maTableColumnAttributes.resize(aNames.size());
 mbTableColumnNamesDirty = bTableColumnNamesDirty;
 }
 
@@ -721,7 +726,6 @@ void ScDBData::AdjustTableColumnAttributes( UpdateRefMode 
eUpdateRefMode, SCCOL
 n += nDx;
 aNewNames.resize(n);
 aNewAttributes.resize(n);
-maTableColumnAttributes.resize(n);
 // Copy head.
 for (size_t i = 0; i < nHead; ++i)
 {
@@ -876,6 +880,7 @@ void ScDBData::RefreshTableColumnNames( ScDocument* pDoc )
 }
 
 aNewNames.swap( maTableColumnNames);
+maTableColumnAttributes.resize(maTableColumnNames.size());
 mbTableColumnNamesDirty = false;
 }
 


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

2023-03-16 Thread Paris Oplopoios (via logerrit)
 include/svtools/colorcfg.hxx   |1 +
 svtools/source/config/colorcfg.cxx |5 +
 sw/inc/viewopt.hxx |   11 +++
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   20 
 sw/source/core/view/viewsh.cxx |1 -
 sw/source/uibase/app/apphdl.cxx|9 +++--
 sw/source/uibase/config/viewopt.cxx|2 ++
 sw/source/uibase/uno/unotxdoc.cxx  |2 ++
 8 files changed, 48 insertions(+), 3 deletions(-)

New commits:
commit 9f0cf00d29298ed55737928ec4dddc50ac850cd8
Author: Paris Oplopoios 
AuthorDate: Thu Mar 16 03:58:18 2023 +0200
Commit: Paris Oplopoios 
CommitDate: Thu Mar 16 23:48:10 2023 +

Update view options string based on theme

Update the view options string based on the theme when tiled rendering,
and make sure only the currently active view is updated

Change-Id: Ib24111848f2926fe7ae858ca2e18e946d980e83f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148943
Tested-by: Paris Oplopoios 
Reviewed-by: Paris Oplopoios 

diff --git a/include/svtools/colorcfg.hxx b/include/svtools/colorcfg.hxx
index f0c0fea5393d..8cf02dec72f8 100644
--- a/include/svtools/colorcfg.hxx
+++ b/include/svtools/colorcfg.hxx
@@ -110,6 +110,7 @@ public:
 // instead of the automatic color
 ColorConfigValueGetColorValue(ColorConfigEntry eEntry, bool bSmart 
= true) const;
 static ColorGetDefaultColor(ColorConfigEntry eEntry);
+const OUString& GetCurrentSchemeName() const;
 };
 
 class SVT_DLLPUBLIC EditableColorConfig
diff --git a/svtools/source/config/colorcfg.cxx 
b/svtools/source/config/colorcfg.cxx
index 452104361729..359f55df45e1 100644
--- a/svtools/source/config/colorcfg.cxx
+++ b/svtools/source/config/colorcfg.cxx
@@ -468,6 +468,11 @@ ColorConfigValue 
ColorConfig::GetColorValue(ColorConfigEntry eEntry, bool bSmart
 return aRet;
 }
 
+const OUString& ColorConfig::GetCurrentSchemeName() const
+{
+return m_pImpl->GetLoadedScheme();
+}
+
 EditableColorConfig::EditableColorConfig() :
 m_pImpl(new ColorConfig_Impl),
 m_bModified(false)
diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx
index 4c9dcf8e071b..a6fd5eea8a57 100644
--- a/sw/inc/viewopt.hxx
+++ b/sw/inc/viewopt.hxx
@@ -248,6 +248,7 @@ class SW_DLLPUBLIC SwViewOption
 {
 SwViewColors m_aColorConfig;
 static SwViewColors s_aInitialColorConfig;
+OUString m_sThemeName;
 
 static sal_uInt16   s_nPixelTwips;// 1 Pixel == ? Twips
 
@@ -314,6 +315,16 @@ public:
 return m_aColorConfig;
 }
 
+void SetThemeName(const OUString& rThemeName)
+{
+m_sThemeName = rThemeName;
+}
+
+OUString GetThemeName() const
+{
+return m_sThemeName;
+}
+
 static void SetInitialColorConfig(const SwViewColors& rColorConfig)
 {
 s_aInitialColorConfig = rColorConfig;
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index fd5c469c4f3b..230c3588026b 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -1643,6 +1643,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testGetViewRenderState)
 
 // Create a second view
 SfxLokHelper::createView();
+int nSecondViewId = SfxLokHelper::getView();
 ViewCallback aView2;
 {
 // Give the second view different options
@@ -1656,6 +1657,25 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testGetViewRenderState)
 // Switch back to the first view, and check that the options string is the 
same
 SfxLokHelper::setView(nFirstViewId);
 CPPUNIT_ASSERT_EQUAL(OString("PS"), pXTextDocument->getViewRenderState());
+
+// Switch back to the second view, and change to dark mode
+SfxLokHelper::setView(nSecondViewId);
+{
+SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc();
+SwView* pView = pDoc->GetDocShell()->GetView();
+uno::Reference xFrame = 
pView->GetViewFrame().GetFrame().GetFrameInterface();
+uno::Sequence aPropertyValues = 
comphelper::InitPropertySequence(
+{
+{ "NewTheme", 
uno::Any(OUString("COLOR_SCHEME_LIBREOFFICE_DARK")) },
+}
+);
+comphelper::dispatchCommand(".uno:ChangeTheme", xFrame, 
aPropertyValues);
+}
+CPPUNIT_ASSERT_EQUAL(OString("SD"), pXTextDocument->getViewRenderState());
+
+// Switch back to the first view, and check that the options string is the 
same
+SfxLokHelper::setView(nFirstViewId);
+CPPUNIT_ASSERT_EQUAL(OString("PS"), pXTextDocument->getViewRenderState());
 }
 
 CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testSetViewGraphicSelection)
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index e59c80afdc68..73fa17fd3c55 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -2214,7 

[Libreoffice-commits] core.git: desktop/source include/sfx2 sfx2/sdi sfx2/source

2023-03-16 Thread Paris Oplopoios (via logerrit)
 desktop/source/lib/init.cxx  |1 +
 include/sfx2/sfxsids.hrc |2 ++
 sfx2/sdi/appslots.sdi|4 
 sfx2/sdi/sfx.sdi |   14 ++
 sfx2/source/appl/appserv.cxx |   14 ++
 5 files changed, 35 insertions(+)

New commits:
commit 9310192a4a0af4e7e3e9ac6124cdd2a706dfedcb
Author: Paris Oplopoios 
AuthorDate: Thu Mar 16 03:55:34 2023 +0200
Commit: Paris Oplopoios 
CommitDate: Thu Mar 16 23:45:34 2023 +

Add uno command that changes the theme

Add an uno command that changes the theme to the one specified in the
first parameter

Change-Id: Ia0fef2ca698415e07f1943cf80ab667fb5c37238
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148942
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index bdab0c035563..6753220051e0 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3418,6 +3418,7 @@ static void doc_iniUnoCommands ()
 OUString(".uno:InsertSlide"),
 OUString(".uno:DeleteSlide"),
 OUString(".uno:DuplicateSlide"),
+OUString(".uno:ChangeTheme"),
 OUString(".uno:Cut"),
 OUString(".uno:Copy"),
 OUString(".uno:Paste"),
diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index d63a5b2d3ae8..97b9c2c71e06 100644
--- a/include/sfx2/sfxsids.hrc
+++ b/include/sfx2/sfxsids.hrc
@@ -295,6 +295,8 @@ class SvxZoomItem;
 #define SID_TOOLBAR_MODE_UI (SID_SFX_START + 1742)
 #define SID_TOOLBAR_LOCK(SID_SFX_START + 1743)
 #define SID_WIDGET_TEST_DIALOG  (SID_SFX_START + 1744)
+#define FN_CHANGE_THEME (SID_SFX_START + 1745)
+#define FN_PARAM_NEW_THEME  
TypedWhichId(SID_SFX_START + 1746)
 
 //  SID_SFX_free_END(SID_SFX_START + 3999)
 
diff --git a/sfx2/sdi/appslots.sdi b/sfx2/sdi/appslots.sdi
index daa0a86265e0..429c48332f7f 100644
--- a/sfx2/sdi/appslots.sdi
+++ b/sfx2/sdi/appslots.sdi
@@ -64,6 +64,10 @@ interface Application
 [
 ExecMethod = MiscExec_Impl ;
 ]
+FN_CHANGE_THEME // ole(no) api(final/play/rec)
+[
+ExecMethod = MiscExec_Impl ;
+]
 SID_CONFIG // ole(no) api(final/play/rec)
 [
 ExecMethod = MiscExec_Impl ;
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index 71b0557bb5d0..750cf6825d31 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -5844,3 +5844,17 @@ SfxVoidItem WidgetTestDialog SID_WIDGET_TEST_DIALOG
 ToolBoxConfig = TRUE,
 GroupId = SfxGroupId::Application;
 ]
+
+SfxVoidItem ChangeTheme FN_CHANGE_THEME
+(SfxStringItem NewTheme FN_PARAM_NEW_THEME)
+[
+AutoUpdate = FALSE,
+FastCall = FALSE,
+ReadOnlyDoc = FALSE,
+Toggle = FALSE,
+Container = FALSE,
+RecordAbsolute = FALSE,
+RecordPerSet;
+
+GroupId = SfxGroupId::Application;
+]
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 83bc6daa210e..5ccfd3c6a597 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -50,6 +50,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -574,6 +575,19 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
 break;
 }
 
+case FN_CHANGE_THEME:
+{
+const SfxStringItem* pNewThemeArg = 
rReq.GetArg(FN_PARAM_NEW_THEME);
+if (!pNewThemeArg)
+{
+SAL_WARN("sfx.appl", "FN_CHANGE_THEME: no theme name");
+break;
+}
+svtools::EditableColorConfig aEditableConfig;
+aEditableConfig.LoadScheme(pNewThemeArg->GetValue());
+break;
+}
+
 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 case SID_HELPINDEX:
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sc/qa sc/source

2023-03-16 Thread Paris Oplopoios (via logerrit)
 sc/qa/unit/uicalc/data/simpleTable.xlsx |binary
 sc/qa/unit/uicalc/uicalc.cxx|   15 +++
 sc/source/core/tool/dbdata.cxx  |7 ++-
 3 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit 858be186f8e83e63e1b3bb1b9c1801760bf5ee48
Author: Paris Oplopoios 
AuthorDate: Wed Mar 8 23:04:49 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu Mar 16 20:06:35 2023 +

tdf#154061 Make sure table column attributes size is correct

Resize maTableColumnAttributes to match the amount of columns, fixes
crash upon undoing a column insertion on a table

Change-Id: Iad4b8ac5c38d5d1065d6ef1267ce3f5d3b28afa8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148492
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 2135706397d36aa7ea24650b65859be0b6860a65)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148972
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/unit/uicalc/data/simpleTable.xlsx 
b/sc/qa/unit/uicalc/data/simpleTable.xlsx
new file mode 100644
index ..fd4e394732ba
Binary files /dev/null and b/sc/qa/unit/uicalc/data/simpleTable.xlsx differ
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index 42d0168aa833..98d3398b09d8 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -2025,6 +2025,21 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf142010)
 CPPUNIT_ASSERT_EQUAL(5.0, pDoc->GetValue(ScAddress(5, 71, 0)));
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf154061)
+{
+createScDoc("simpleTable.xlsx");
+ScDocument* pDoc = getScDoc();
+CPPUNIT_ASSERT_EQUAL(OUString("Column2"), pDoc->GetString(ScAddress(1, 0, 
0)));
+
+goToCell("B1");
+
+// Without the fix in place, it would crash here due to an out of bounds 
array access
+dispatchCommand(mxComponent, ".uno:InsertColumnsBefore", {});
+CPPUNIT_ASSERT_EQUAL(OUString("Column2"), pDoc->GetString(ScAddress(2, 0, 
0)));
+dispatchCommand(mxComponent, ".uno:Undo", {});
+CPPUNIT_ASSERT_EQUAL(OUString("Column2"), pDoc->GetString(ScAddress(1, 0, 
0)));
+}
+
 CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf132431)
 {
 createScDoc("tdf132431.ods");
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index dc10d6a0503e..293bb20a4976 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -116,6 +116,7 @@ ScDBData::ScDBData( const ScDBData& rData ) :
 bAutoFilter (rData.bAutoFilter),
 bModified   (rData.bModified),
 maTableColumnNames  (rData.maTableColumnNames),
+maTableColumnAttributes(rData.maTableColumnAttributes),
 mbTableColumnNamesDirty(rData.mbTableColumnNamesDirty),
 nFilteredRowCount   (rData.nFilteredRowCount)
 {
@@ -150,6 +151,7 @@ ScDBData::ScDBData( const OUString& rName, const ScDBData& 
rData ) :
 bAutoFilter (rData.bAutoFilter),
 bModified   (rData.bModified),
 maTableColumnNames  (rData.maTableColumnNames),
+maTableColumnAttributes(rData.maTableColumnAttributes),
 mbTableColumnNamesDirty (rData.mbTableColumnNamesDirty),
 nFilteredRowCount   (rData.nFilteredRowCount)
 {
@@ -199,6 +201,7 @@ ScDBData& ScDBData::operator= (const ScDBData& rData)
 else
 {
 maTableColumnNames  = rData.maTableColumnNames;
+maTableColumnAttributes = rData.maTableColumnAttributes;
 mbTableColumnNamesDirty = rData.mbTableColumnNamesDirty;
 }
 
@@ -577,6 +580,7 @@ void ScDBData::UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos)
 aRange.aEnd.Row());
 // Do not use SetTableColumnNames() because that resets 
mbTableColumnNamesDirty.
 maTableColumnNames = aNames;
+maTableColumnAttributes.resize(aNames.size());
 mbTableColumnNamesDirty = bTableColumnNamesDirty;
 }
 
@@ -620,6 +624,7 @@ bool ScDBData::UpdateReference(const ScDocument* pDoc, 
UpdateRefMode eUpdateRefM
 MoveTo( theTab1, theCol1, theRow1, theCol2, theRow2 );
 // Do not use SetTableColumnNames() because that resets 
mbTableColumnNamesDirty.
 maTableColumnNames = aNames;
+maTableColumnAttributes.resize(aNames.size());
 mbTableColumnNamesDirty = bTableColumnNamesDirty;
 }
 
@@ -721,7 +726,6 @@ void ScDBData::AdjustTableColumnAttributes( UpdateRefMode 
eUpdateRefMode, SCCOL
 n += nDx;
 aNewNames.resize(n);
 aNewAttributes.resize(n);
-maTableColumnAttributes.resize(n);
 // Copy head.
 for (size_t i = 0; i < nHead; ++i)
 {
@@ -876,6 +880,7 @@ void ScDBData::RefreshTableColumnNames( ScDocument* pDoc )
 }
 
 aNewNames.swap( maTableColumnNames);
+maTableColumnAttributes.resize(maTableColumnNames.size());
 mbTableColumnNamesDirty = false;
 }
 


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

2023-03-16 Thread Paris Oplopoios (via logerrit)
 sc/qa/unit/uicalc/data/simpleTable.xlsx |binary
 sc/qa/unit/uicalc/uicalc.cxx|   15 +++
 sc/source/core/tool/dbdata.cxx  |7 ++-
 sw/source/core/docnode/ndtbl.cxx|1 +
 4 files changed, 22 insertions(+), 1 deletion(-)

New commits:
commit 2135706397d36aa7ea24650b65859be0b6860a65
Author: Paris Oplopoios 
AuthorDate: Wed Mar 8 23:04:49 2023 +0200
Commit: Tomaž Vajngerl 
CommitDate: Thu Mar 16 13:08:25 2023 +

tdf#154061 Make sure table column attributes size is correct

Resize maTableColumnAttributes to match the amount of columns, fixes
crash upon undoing a column insertion on a table

Change-Id: Iad4b8ac5c38d5d1065d6ef1267ce3f5d3b28afa8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148492
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sc/qa/unit/uicalc/data/simpleTable.xlsx 
b/sc/qa/unit/uicalc/data/simpleTable.xlsx
new file mode 100644
index ..fd4e394732ba
Binary files /dev/null and b/sc/qa/unit/uicalc/data/simpleTable.xlsx differ
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index 421f96410e6f..4fb9416badd8 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -2221,6 +2221,21 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf142010)
 CPPUNIT_ASSERT_EQUAL(5.0, pDoc->GetValue(ScAddress(5, 71, 0)));
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf154061)
+{
+createScDoc("simpleTable.xlsx");
+ScDocument* pDoc = getScDoc();
+CPPUNIT_ASSERT_EQUAL(OUString("Column2"), pDoc->GetString(ScAddress(1, 0, 
0)));
+
+goToCell("B1");
+
+// Without the fix in place, it would crash here due to an out of bounds 
array access
+dispatchCommand(mxComponent, ".uno:InsertColumnsBefore", {});
+CPPUNIT_ASSERT_EQUAL(OUString("Column2"), pDoc->GetString(ScAddress(2, 0, 
0)));
+dispatchCommand(mxComponent, ".uno:Undo", {});
+CPPUNIT_ASSERT_EQUAL(OUString("Column2"), pDoc->GetString(ScAddress(1, 0, 
0)));
+}
+
 CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf132431)
 {
 createScDoc("tdf132431.ods");
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index dc10d6a0503e..293bb20a4976 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -116,6 +116,7 @@ ScDBData::ScDBData( const ScDBData& rData ) :
 bAutoFilter (rData.bAutoFilter),
 bModified   (rData.bModified),
 maTableColumnNames  (rData.maTableColumnNames),
+maTableColumnAttributes(rData.maTableColumnAttributes),
 mbTableColumnNamesDirty(rData.mbTableColumnNamesDirty),
 nFilteredRowCount   (rData.nFilteredRowCount)
 {
@@ -150,6 +151,7 @@ ScDBData::ScDBData( const OUString& rName, const ScDBData& 
rData ) :
 bAutoFilter (rData.bAutoFilter),
 bModified   (rData.bModified),
 maTableColumnNames  (rData.maTableColumnNames),
+maTableColumnAttributes(rData.maTableColumnAttributes),
 mbTableColumnNamesDirty (rData.mbTableColumnNamesDirty),
 nFilteredRowCount   (rData.nFilteredRowCount)
 {
@@ -199,6 +201,7 @@ ScDBData& ScDBData::operator= (const ScDBData& rData)
 else
 {
 maTableColumnNames  = rData.maTableColumnNames;
+maTableColumnAttributes = rData.maTableColumnAttributes;
 mbTableColumnNamesDirty = rData.mbTableColumnNamesDirty;
 }
 
@@ -577,6 +580,7 @@ void ScDBData::UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos)
 aRange.aEnd.Row());
 // Do not use SetTableColumnNames() because that resets 
mbTableColumnNamesDirty.
 maTableColumnNames = aNames;
+maTableColumnAttributes.resize(aNames.size());
 mbTableColumnNamesDirty = bTableColumnNamesDirty;
 }
 
@@ -620,6 +624,7 @@ bool ScDBData::UpdateReference(const ScDocument* pDoc, 
UpdateRefMode eUpdateRefM
 MoveTo( theTab1, theCol1, theRow1, theCol2, theRow2 );
 // Do not use SetTableColumnNames() because that resets 
mbTableColumnNamesDirty.
 maTableColumnNames = aNames;
+maTableColumnAttributes.resize(aNames.size());
 mbTableColumnNamesDirty = bTableColumnNamesDirty;
 }
 
@@ -721,7 +726,6 @@ void ScDBData::AdjustTableColumnAttributes( UpdateRefMode 
eUpdateRefMode, SCCOL
 n += nDx;
 aNewNames.resize(n);
 aNewAttributes.resize(n);
-maTableColumnAttributes.resize(n);
 // Copy head.
 for (size_t i = 0; i < nHead; ++i)
 {
@@ -876,6 +880,7 @@ void ScDBData::RefreshTableColumnNames( ScDocument* pDoc )
 }
 
 aNewNames.swap( maTableColumnNames);
+maTableColumnAttributes.resize(maTableColumnNames.size());
 mbTableColumnNamesDirty = false;
 }
 
commit 67d353ff50712a036d04b1c0ffab68f2a21b5008
Author: Caolán McNamara 
AuthorDate: Wed Mar 15 20:05:33 2023 +
Commit: Caolán McNamara 
CommitDate: Thu Mar 16 13:08:20 2023 +

Related: 

[Libreoffice-commits] core.git: sw/inc sw/source

2023-03-16 Thread Paris Oplopoios (via logerrit)
 sw/inc/viewopt.hxx   |  172 ++
 sw/source/core/access/accframe.cxx   |2 
 sw/source/core/access/accpara.cxx|2 
 sw/source/core/access/accportions.cxx|2 
 sw/source/core/inc/wrong.hxx |8 
 sw/source/core/layout/paintfrm.cxx   |   69 ++--
 sw/source/core/text/atrstck.cxx  |8 
 sw/source/core/text/inftxt.cxx   |   16 -
 sw/source/core/text/porfld.cxx   |4 
 sw/source/core/text/porref.cxx   |2 
 sw/source/core/text/porrst.cxx   |   10 
 sw/source/core/text/portox.cxx   |2 
 sw/source/core/text/portxt.cxx   |4 
 sw/source/core/text/txtdrop.cxx  |4 
 sw/source/core/txtnode/fntcache.cxx  |2 
 sw/source/core/view/viewimp.cxx  |2 
 sw/source/core/view/viewsh.cxx   |3 
 sw/source/filter/html/htmlfldw.cxx   |8 
 sw/source/ui/chrdlg/drpcps.cxx   |8 
 sw/source/ui/config/optpage.cxx  |5 
 sw/source/ui/envelp/envlop1.cxx  |   10 
 sw/source/ui/envelp/labfmt.cxx   |4 
 sw/source/ui/misc/outline.cxx|   12 
 sw/source/uibase/app/apphdl.cxx  |   11 
 sw/source/uibase/config/viewopt.cxx  |  300 ++-
 sw/source/uibase/docvw/AnnotationWin2.cxx|8 
 sw/source/uibase/docvw/DashedLine.cxx|6 
 sw/source/uibase/docvw/HeaderFooterWin.cxx   |4 
 sw/source/uibase/docvw/PageBreakWin.cxx  |2 
 sw/source/uibase/docvw/UnfloatTableButton.cxx|3 
 sw/source/uibase/docvw/contentcontrolaliasbutton.cxx |3 
 sw/source/uibase/docvw/edtwin.cxx|2 
 sw/source/uibase/frmdlg/colex.cxx|2 
 sw/source/uibase/inc/DashedLine.hxx  |5 
 sw/source/uibase/uiview/view0.cxx|   28 -
 sw/source/uibase/uiview/viewdraw.cxx |2 
 sw/source/uibase/uno/unomod.cxx  |   20 -
 sw/source/uibase/uno/unotxdoc.cxx|4 
 38 files changed, 424 insertions(+), 335 deletions(-)

New commits:
commit 1916d161902bdd52b8cfa5b29153c8f8c39fce52
Author: Paris Oplopoios 
AuthorDate: Wed Mar 8 17:34:02 2023 +0200
Commit: Miklos Vajna 
CommitDate: Thu Mar 16 08:41:38 2023 +

De-static-izing colors in SwViewOption

The view colors in SwViewOption were static which means that two
separate views couldn't have different colors

Change-Id: Id595b00ba56bdb210ad1a784cf76e99ead0d6014
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148481
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx
index c399aa6b94dd..4c9dcf8e071b 100644
--- a/sw/inc/viewopt.hxx
+++ b/sw/inc/viewopt.hxx
@@ -193,30 +193,62 @@ namespace o3tl {
 template<> struct typed_flags : is_typed_flags {};
 }
 
+struct SwViewColors
+{
+SwViewColors();
+SwViewColors(const svtools::ColorConfig& rConfig);
+bool operator==(const SwViewColors& rOther) const
+{
+return m_aDocColor == rOther.m_aDocColor
+&& m_aDocBoundColor == rOther.m_aDocBoundColor
+&& m_aObjectBoundColor == rOther.m_aObjectBoundColor
+&& m_aAppBackgroundColor == rOther.m_aAppBackgroundColor
+&& m_aTableBoundColor == rOther.m_aTableBoundColor
+&& m_aFontColor == rOther.m_aFontColor
+&& m_aIndexShadingsColor == rOther.m_aIndexShadingsColor
+&& m_aLinksColor == rOther.m_aLinksColor
+&& m_aVisitedLinksColor == rOther.m_aVisitedLinksColor
+&& m_aDirectCursorColor == rOther.m_aDirectCursorColor
+&& m_aTextGridColor == rOther.m_aTextGridColor
+&& m_aSpellColor == rOther.m_aSpellColor
+&& m_aGrammarColor == rOther.m_aGrammarColor
+&& m_aSmarttagColor == rOther.m_aSmarttagColor
+&& m_aFieldShadingsColor == rOther.m_aFieldShadingsColor
+&& m_aSectionBoundColor == rOther.m_aSectionBoundColor
+&& m_aPageBreakColor == rOther.m_aPageBreakColor
+&& m_aScriptIndicatorColor == rOther.m_aScriptIndicatorColor
+&& m_aShadowColor == rOther.m_aShadowColor
+&& m_aHeaderFooterMarkColor == rOther.m_aHeaderFooterMarkColor
+&& m_nAppearanceFlags == rOther.m_nAppearanceFlags;
+}
+Color m_aDocColor;  // color of document boundaries
+Color m_aDocBoundColor;  // color of document boundaries
+Color m_aObjectBoundColor; // color of object boundaries
+Color m_aAppBackgroundColor; // application background
+Color 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - include/LibreOfficeKit include/sfx2 include/vcl libreofficekit/source sfx2/source sw/inc sw/qa sw/source

2023-03-13 Thread Paris Oplopoios (via logerrit)
 include/LibreOfficeKit/LibreOfficeKitEnums.h   |   12 ++
 include/sfx2/lokhelper.hxx |3 ++
 include/vcl/ITiledRenderable.hxx   |6 +
 libreofficekit/source/gtk/lokdocview.cxx   |1 
 sfx2/source/view/lokhelper.cxx |5 
 sw/inc/unotxdoc.hxx|3 ++
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   30 +
 sw/source/core/view/viewsh.cxx |3 ++
 sw/source/uibase/uno/unotxdoc.cxx  |   18 +++
 9 files changed, 81 insertions(+)

New commits:
commit 13066a2e290ff34d1c309cbd4e7a33e8aaff0067
Author: Paris Oplopoios 
AuthorDate: Thu Mar 2 02:24:59 2023 +0200
Commit: Michael Meeks 
CommitDate: Mon Mar 13 13:10:26 2023 +

sw lok: notify clients about view option changes

Send a string of the view options to the kit when the view changes

Change-Id: I89f65ff1d22a83a54dde35e39eb487edda0b58e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148078
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
(cherry picked from commit c1d6af3e9a8937cef192e2764ad4afb572743d86)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148776
Tested-by: Michael Meeks 
Reviewed-by: Michael Meeks 

diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 38b3e5e62a40..6e02c92596f1 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -907,6 +907,16 @@ typedef enum
  * "file:///tmp/hello-world.pdf"
  */
 LOK_CALLBACK_EXPORT_FILE = 59,
+
+/**
+ * Some attribute of this view has changed, that will cause it
+ * to completely re-render, eg. non-printing characters or
+ * or dark mode was toggled, and then distinct from other views.
+ *
+ * Payload is an opaque string that matches this set of states.
+ * this will be emitted after creating a new view.
+ */
+LOK_CALLBACK_VIEW_RENDER_STATE = 60
 }
 LibreOfficeKitCallbackType;
 
@@ -1055,6 +1065,8 @@ static inline const char* lokCallbackTypeToString(int 
nType)
 return "LOK_CALLBACK_MEDIA_SHAPE";
 case LOK_CALLBACK_EXPORT_FILE:
 return "LOK_CALLBACK_EXPORT_FILE";
+case LOK_CALLBACK_VIEW_RENDER_STATE:
+return "LOK_CALLBACK_VIEW_RENDER_STATE";
 }
 
 assert(!"Unknown LibreOfficeKitCallbackType type.");
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index 90ddd52d01a4..d07e80071bd7 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -140,6 +140,9 @@ public:
 /// Notify about the editing context change.
 static void notifyContextChange(const css::ui::ContextChangeEventObject& 
rEvent);
 
+/// Emits an LOK_CALLBACK_VIEW_RENDER_STATE
+static void notifyViewRenderState(SfxViewShell const* pViewShell, 
vcl::ITiledRenderable* pDoc);
+
 // Notify about the given type needing an update.
 static void notifyUpdate(SfxViewShell const* pViewShell, int nType);
 // Notify about the given type needing a per-viewid update.
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index d110e33f7e19..9fa61258fc7a 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -376,6 +376,12 @@ public:
 virtual void getCommandValues(tools::JsonWriter& /*rJsonWriter*/, 
std::string_view /*rCommand*/)
 {
 }
+
+/**
+ * Returns an opaque string reflecting the render state of a component
+ * eg. 'PD' - P for non-printing-characters, D for dark-mode.
+ */
+virtual OString getViewRenderState() { return rtl::OString(); }
 };
 } // namespace vcl
 
diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index ff40e4929781..8fcbe9a404fc 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -1486,6 +1486,7 @@ callback (gpointer pData)
 case LOK_CALLBACK_FONTS_MISSING:
 case LOK_CALLBACK_MEDIA_SHAPE:
 case LOK_CALLBACK_EXPORT_FILE:
+case LOK_CALLBACK_VIEW_RENDER_STATE:
 {
 // TODO: Implement me
 break;
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 29f64adbb74b..30425927fca2 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -560,6 +560,11 @@ void SfxLokHelper::sendUnoStatus(const SfxViewShell* 
pShell, const SfxPoolItem*
 }
 }
 
+void SfxLokHelper::notifyViewRenderState(const SfxViewShell* pShell, 
vcl::ITiledRenderable* pDoc)
+{
+pShell->libreOfficeKitViewCallback(LOK_CALLBACK_VIEW_RENDER_STATE, 
pDoc->getViewRenderState().getStr());
+}
+
 void SfxLokHelper::notifyWindow(const SfxViewShell* pThisView,
 vcl::LOKWindowId nLOKWindowId,
 std::u16string_view rAction,
diff --git 

[Libreoffice-commits] core.git: include/LibreOfficeKit include/sfx2 include/vcl libreofficekit/source sfx2/source sw/inc sw/qa sw/source

2023-03-10 Thread Paris Oplopoios (via logerrit)
 include/LibreOfficeKit/LibreOfficeKitEnums.h   |   12 ++
 include/sfx2/lokhelper.hxx |3 ++
 include/vcl/ITiledRenderable.hxx   |6 +
 libreofficekit/source/gtk/lokdocview.cxx   |1 
 sfx2/source/view/lokhelper.cxx |5 
 sw/inc/unotxdoc.hxx|3 ++
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   30 +
 sw/source/core/view/viewsh.cxx |3 ++
 sw/source/uibase/uno/unotxdoc.cxx  |   18 +++
 9 files changed, 81 insertions(+)

New commits:
commit c1d6af3e9a8937cef192e2764ad4afb572743d86
Author: Paris Oplopoios 
AuthorDate: Thu Mar 2 02:24:59 2023 +0200
Commit: Miklos Vajna 
CommitDate: Fri Mar 10 08:48:23 2023 +

sw lok: notify clients about view option changes

Send a string of the view options to the kit when the view changes

Change-Id: I89f65ff1d22a83a54dde35e39eb487edda0b58e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148078
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 38b3e5e62a40..6e02c92596f1 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -907,6 +907,16 @@ typedef enum
  * "file:///tmp/hello-world.pdf"
  */
 LOK_CALLBACK_EXPORT_FILE = 59,
+
+/**
+ * Some attribute of this view has changed, that will cause it
+ * to completely re-render, eg. non-printing characters or
+ * or dark mode was toggled, and then distinct from other views.
+ *
+ * Payload is an opaque string that matches this set of states.
+ * this will be emitted after creating a new view.
+ */
+LOK_CALLBACK_VIEW_RENDER_STATE = 60
 }
 LibreOfficeKitCallbackType;
 
@@ -1055,6 +1065,8 @@ static inline const char* lokCallbackTypeToString(int 
nType)
 return "LOK_CALLBACK_MEDIA_SHAPE";
 case LOK_CALLBACK_EXPORT_FILE:
 return "LOK_CALLBACK_EXPORT_FILE";
+case LOK_CALLBACK_VIEW_RENDER_STATE:
+return "LOK_CALLBACK_VIEW_RENDER_STATE";
 }
 
 assert(!"Unknown LibreOfficeKitCallbackType type.");
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index f7de18112c04..b572ddf076b5 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -140,6 +140,9 @@ public:
 /// Notify about the editing context change.
 static void notifyContextChange(const css::ui::ContextChangeEventObject& 
rEvent);
 
+/// Emits an LOK_CALLBACK_VIEW_RENDER_STATE
+static void notifyViewRenderState(SfxViewShell const* pViewShell, 
vcl::ITiledRenderable* pDoc);
+
 // Notify about the given type needing an update.
 static void notifyUpdate(SfxViewShell const* pViewShell, int nType);
 // Notify about the given type needing a per-viewid update.
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index d110e33f7e19..9fa61258fc7a 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -376,6 +376,12 @@ public:
 virtual void getCommandValues(tools::JsonWriter& /*rJsonWriter*/, 
std::string_view /*rCommand*/)
 {
 }
+
+/**
+ * Returns an opaque string reflecting the render state of a component
+ * eg. 'PD' - P for non-printing-characters, D for dark-mode.
+ */
+virtual OString getViewRenderState() { return rtl::OString(); }
 };
 } // namespace vcl
 
diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index ff40e4929781..8fcbe9a404fc 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -1486,6 +1486,7 @@ callback (gpointer pData)
 case LOK_CALLBACK_FONTS_MISSING:
 case LOK_CALLBACK_MEDIA_SHAPE:
 case LOK_CALLBACK_EXPORT_FILE:
+case LOK_CALLBACK_VIEW_RENDER_STATE:
 {
 // TODO: Implement me
 break;
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index ddcad7bab42d..70d18b54edae 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -557,6 +557,11 @@ void SfxLokHelper::sendUnoStatus(const SfxViewShell* 
pShell, const SfxPoolItem*
 }
 }
 
+void SfxLokHelper::notifyViewRenderState(const SfxViewShell* pShell, 
vcl::ITiledRenderable* pDoc)
+{
+pShell->libreOfficeKitViewCallback(LOK_CALLBACK_VIEW_RENDER_STATE, 
pDoc->getViewRenderState().getStr());
+}
+
 void SfxLokHelper::notifyWindow(const SfxViewShell* pThisView,
 vcl::LOKWindowId nLOKWindowId,
 std::u16string_view rAction,
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 57cb3ccca589..056013d75056 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -462,6 +462,9 @@ public:
 /// @see 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/qa writerfilter/source

2023-02-20 Thread Paris Oplopoios (via logerrit)
 sw/qa/extras/ooxmlexport/data/CommentReply.docx   |binary
 sw/qa/extras/ooxmlexport/ooxmlexport16.cxx|2 ++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |2 +-
 3 files changed, 3 insertions(+), 1 deletion(-)

New commits:
commit ce668dc9278380848e0861f681b98e1c86eb23ff
Author: Paris Oplopoios 
AuthorDate: Wed Feb 15 03:23:07 2023 +0200
Commit: Miklos Vajna 
CommitDate: Mon Feb 20 08:01:57 2023 +

Fix issue where comment replies would not get a para id on roundtrip

Also adjusted the test file to account for this

Change-Id: I34f1d9d3a77f91396dd733785eb5b7853289508a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147034
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
(cherry picked from commit f2428c21c635b142b27adf020518d9b13b3baf0e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147071
Tested-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/data/CommentReply.docx 
b/sw/qa/extras/ooxmlexport/data/CommentReply.docx
index 4a78d84d55e6..e3a648aa4326 100644
Binary files a/sw/qa/extras/ooxmlexport/data/CommentReply.docx and 
b/sw/qa/extras/ooxmlexport/data/CommentReply.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
index 30ef1735c73f..99c0b2c9ffe7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
@@ -885,6 +885,8 @@ CPPUNIT_TEST_FIXTURE(Test, testCommentReply)
 loadAndSave("CommentReply.docx");
 xmlDocUniquePtr pXmlComm = parseExport("word/comments.xml");
 xmlDocUniquePtr pXmlCommExt = parseExport("word/commentsExtended.xml");
+CPPUNIT_ASSERT(pXmlComm);
+CPPUNIT_ASSERT(pXmlCommExt);
 OUString sParentId = getXPath(pXmlComm, "/w:comments/w:comment[1]/w:p[1]", 
"paraId");
 OUString sChildId = getXPath(pXmlComm, "/w:comments/w:comment[2]/w:p[1]", 
"paraId");
 OUString sChildIdEx = getXPath(pXmlCommExt, 
"/w15:commentsEx/w15:commentEx", "paraId");
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 89208dbbfc78..d0a11cd47988 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2690,8 +2690,8 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap, con
 {
 m_bAnnotationResolved = item->second.bDone;
 m_sAnnotationParent = item->second.sParaIdParent;
-m_sAnnotationImportedParaId = sParaId;
 }
+m_sAnnotationImportedParaId = sParaId;
 }
 }
 


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/inc sw/source

2023-02-16 Thread Paris Oplopoios (via logerrit)
 sw/inc/AnnotationWin.hxx  |5 +
 sw/inc/PostItMgr.hxx  |2 ++
 sw/inc/postithelper.hxx   |5 +
 sw/source/uibase/docvw/AnnotationWin.cxx  |   21 +
 sw/source/uibase/docvw/AnnotationWin2.cxx |8 
 sw/source/uibase/docvw/PostItMgr.cxx  |5 +
 6 files changed, 46 insertions(+)

New commits:
commit 8fe61323cc338370c4fd67f8c88aedd8ef8d6b3b
Author: Paris Oplopoios 
AuthorDate: Wed Jan 18 20:26:58 2023 +0200
Commit: Miklos Vajna 
CommitDate: Thu Feb 16 09:11:43 2023 +

tdf#119229 docx: Set paraIdParent upon FN_REPLY

Set the paraIdParent SwPostItField attribute when replying on an
existing comment in Writer

Change-Id: I33d89688d5a36a91b26a64cf4b0f605d7bf33b1f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145750
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
(cherry picked from commit 70ff425141e3569bf09a6768ded3b8a7b0002bab)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147069
Tested-by: Miklos Vajna 

diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx
index f5d3c167c24e..2aa641361ebf 100644
--- a/sw/inc/AnnotationWin.hxx
+++ b/sw/inc/AnnotationWin.hxx
@@ -191,6 +191,11 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin final : public 
InterimItemWindow
 bool IsResolved() const;
 bool IsThreadResolved();
 
+// Get annotation paraId or generate one if it doesn't exist
+sal_uInt32 GetParaId();
+// Used to generate a unique paraId
+static sal_uInt32 CreateUniqueParaId();
+
 // Set this SwAnnotationWin as the currently active one
 // return false if it was already active
 bool SetActiveSidebarWin();
diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx
index 68292b452ab3..98d9f4f2ef30 100644
--- a/sw/inc/PostItMgr.hxx
+++ b/sw/inc/PostItMgr.hxx
@@ -230,6 +230,8 @@ class SAL_DLLPUBLIC_RTTI SwPostItMgr final : public 
SfxListener
 
 sw::annotation::SwAnnotationWin* GetNextPostIt( sal_uInt16 aDirection,
 
sw::annotation::SwAnnotationWin* aPostIt);
+SwPostItField* GetLatestPostItField();
+
 tools::Long GetNextBorder();
 
 sw::annotation::SwAnnotationWin* GetActiveSidebarWin() { return 
mpActivePostIt; }
diff --git a/sw/inc/postithelper.hxx b/sw/inc/postithelper.hxx
index 3377fc752450..f55d64d39a99 100644
--- a/sw/inc/postithelper.hxx
+++ b/sw/inc/postithelper.hxx
@@ -114,6 +114,7 @@ public:
 virtual SwPosition GetAnchorPosition() const = 0;
 virtual bool UseElement(SwRootFrame const&, IDocumentRedlineAccess const&) 
= 0;
 virtual const SwFormatField& GetFormatField() const = 0;
+virtual SwFormatField& GetFormatField() = 0;
 virtual const SfxBroadcaster* GetBroadcaster() const = 0;
 virtual VclPtr GetSidebarWindow( 
SwEditWin& rEditWin,
 SwPostItMgr& 
aMgr) = 0;
@@ -136,6 +137,10 @@ public:
 {
 return mrFormatField;
 }
+SwFormatField& GetFormatField() override
+{
+return mrFormatField;
+}
 virtual const SfxBroadcaster* GetBroadcaster() const override
 {
 return 
diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx 
b/sw/source/uibase/docvw/AnnotationWin.cxx
index 685dcbb5ce94..8ba768d7d253 100644
--- a/sw/source/uibase/docvw/AnnotationWin.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin.cxx
@@ -49,6 +49,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -236,6 +237,26 @@ void SwAnnotationWin::ToggleResolvedForThread()
 mrMgr.LayoutPostIts();
 }
 
+sal_uInt32 SwAnnotationWin::GetParaId()
+{
+auto pField = static_cast(mpFormatField->GetField());
+auto nParaId = pField->GetParaId();
+if (nParaId == 0)
+{
+// The parent annotation does not have a paraId. This happens when the 
annotation was just
+// created, and not imported. paraIds are regenerated upon export, 
thus this new paraId
+// is only generated so that children annotations can refer to it
+nParaId = CreateUniqueParaId();
+pField->SetParaId(nParaId);
+}
+return nParaId;
+}
+
+sal_uInt32 SwAnnotationWin::CreateUniqueParaId()
+{
+return comphelper::rng::uniform_uint_distribution(0, 
std::numeric_limits::max());
+}
+
 void SwAnnotationWin::DeleteThread()
 {
 // Go to the top and delete each comment one by one
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx 
b/sw/source/uibase/docvw/AnnotationWin2.cxx
index 087759047a81..3f8dd2333b9d 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -67,6 +67,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -1092,6 +1093,13 @@ void SwAnnotationWin::ExecuteCommand(sal_uInt16 nSlot)
 mrMgr.SetActiveSidebarWin(nullptr);
 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/source

2023-02-16 Thread Paris Oplopoios (via logerrit)
 sw/source/uibase/docvw/PostItMgr.cxx |1 +
 sw/source/uibase/uno/unotxdoc.cxx|1 +
 2 files changed, 2 insertions(+)

New commits:
commit 55aed3396961031fc1fe5432a1a5b38fe75995ba
Author: Paris Oplopoios 
AuthorDate: Tue Feb 14 19:06:29 2023 +0200
Commit: Miklos Vajna 
CommitDate: Thu Feb 16 09:09:30 2023 +

Add paraIdParent to LOK notification attributes

paraIdParent has to do with which comments are replies to other comments
which differs from the parent attribute which has to do with
which comments are in the same thread with other comments

Change-Id: I27feba55eadeeff22d409f69d8df976ad85e0ba6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147070
Tested-by: Miklos Vajna 
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/uibase/docvw/PostItMgr.cxx 
b/sw/source/uibase/docvw/PostItMgr.cxx
index cb07ee9c33a5..0e478d9bea6b 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -169,6 +169,7 @@ namespace {
 
 aAnnotation.put("id", pField->GetPostItId());
 aAnnotation.put("parent", pWin->CalcParent());
+aAnnotation.put("paraIdParent", pField->GetParentId());
 aAnnotation.put("author", pField->GetPar1().toUtf8().getStr());
 aAnnotation.put("text", pField->GetPar2().toUtf8().getStr());
 aAnnotation.put("resolved", pField->GetResolved() ? "true" : 
"false");
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index 26521c2ccf45..173340162d83 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3329,6 +3329,7 @@ void SwXTextDocument::getPostIts(tools::JsonWriter& 
rJsonWriter)
 auto commentNode = rJsonWriter.startStruct();
 rJsonWriter.put("id", pField->GetPostItId());
 rJsonWriter.put("parent", pWin->CalcParent());
+rJsonWriter.put("paraIdParent", pField->GetParentId());
 rJsonWriter.put("author", pField->GetPar1());
 rJsonWriter.put("text", pField->GetPar2());
 rJsonWriter.put("resolved", pField->GetResolved() ? "true" : "false");


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - oox/source sw/inc sw/qa sw/source writerfilter/inc writerfilter/source

2023-02-16 Thread Paris Oplopoios (via logerrit)
 oox/source/token/tokens.txt   |1 
 sw/inc/docufld.hxx|   10 +++
 sw/inc/unoprnms.hxx   |2 
 sw/qa/extras/ooxmlexport/data/CommentReply.docx   |binary
 sw/qa/extras/ooxmlexport/ooxmlexport16.cxx|   16 +
 sw/source/core/fields/docufld.cxx |   50 -
 sw/source/core/inc/unofldmid.h|1 
 sw/source/core/unocore/unofield.cxx   |   27 +
 sw/source/core/unocore/unomap.cxx |2 
 sw/source/filter/ww8/docxattributeoutput.cxx  |   51 +++---
 sw/source/filter/ww8/docxattributeoutput.hxx  |   12 +++-
 sw/source/filter/ww8/docxexport.cxx   |4 -
 writerfilter/inc/dmapper/CommentProperties.hxx|6 +-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |7 ++
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |2 
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |7 ++
 writerfilter/source/ooxml/OOXMLFastContextHandler.hxx |2 
 writerfilter/source/ooxml/model.xml   |3 -
 18 files changed, 183 insertions(+), 20 deletions(-)

New commits:
commit 55178a692f7731a5b3a222696346b4c2e48b8a4c
Author: Paris Oplopoios 
AuthorDate: Fri Jan 13 19:49:23 2023 +0200
Commit: Miklos Vajna 
CommitDate: Thu Feb 16 09:06:40 2023 +

tdf#119229 docx: Preserve w15:paraIdParent attribute in commentsExtended

w15:paraIdParent attribute indicates that the comment is a reply to the
value id

Change-Id: I9e6eca6a656594c956629c1434b8e5c3aa573c60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145314
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
(cherry picked from commit 0c2ed51a775871c91ac8f01c8982f23c34e8248d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147067
Tested-by: Miklos Vajna 

diff --git a/oox/source/token/tokens.txt b/oox/source/token/tokens.txt
index 25951891d2a7..dee9010df789 100644
--- a/oox/source/token/tokens.txt
+++ b/oox/source/token/tokens.txt
@@ -3884,6 +3884,7 @@ parTransId
 parTxLTRAlign
 parTxRTLAlign
 paraId
+paraIdParent
 paragraph
 parallel
 parallelogram
diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx
index b907763a2d8c..89a5341222db 100644
--- a/sw/inc/docufld.hxx
+++ b/sw/inc/docufld.hxx
@@ -456,6 +456,8 @@ class SW_DLLPUBLIC SwPostItField final : public SwField
 std::optional mpText;
 rtl::Reference m_xTextObject;
 sal_uInt32 m_nPostItId;
+sal_uInt32 m_nParentId;
+sal_uInt32 m_nParaId;
 
 public:
 static sal_uInt32 s_nLastPostItId;
@@ -467,7 +469,9 @@ public:
OUString aName,
const DateTime& rDate,
const bool bResolved = false,
-   const sal_uInt32 nPostItId = 0);
+   const sal_uInt32 nPostItId = 0,
+   const sal_uInt32 nParentId = 0,
+   const sal_uInt32 nParaId = 0);
 
 SwPostItField(const SwPostItField&) = delete;
 SwPostItField* operator=(const SwPostItField&) = delete;
@@ -482,6 +486,10 @@ public:
 tools::Time GetTime() const { return 
tools::Time(m_aDateTime.GetTime()); }
 sal_uInt32 GetPostItId() const { return m_nPostItId; }
 void SetPostItId(const sal_uInt32 nPostItId = 0);
+sal_uInt32 GetParentId() const { return m_nParentId; }
+void SetParentId(const sal_uInt32 nParentId);
+sal_uInt32 GetParaId() const   { return m_nParaId; }
+void SetParaId(const sal_uInt32 nParaId);
 
 /// Author
 virtual OUStringGetPar1() const override;
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 2bdcc09a6ad9..a6184b15645c 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -923,6 +923,8 @@ inline constexpr OUStringLiteral UNO_NAME_ID = u"Id";
 inline constexpr OUStringLiteral UNO_NAME_TAB_INDEX = u"TabIndex";
 inline constexpr OUStringLiteral UNO_NAME_LOCK = u"Lock";
 inline constexpr OUStringLiteral UNO_NAME_DATE_STRING = u"DateString";
+inline constexpr OUStringLiteral UNO_NAME_PARA_ID = u"ParaId";
+inline constexpr OUStringLiteral UNO_NAME_PARA_ID_PARENT = u"ParaIdParent";
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ooxmlexport/data/CommentReply.docx 
b/sw/qa/extras/ooxmlexport/data/CommentReply.docx
new file mode 100644
index ..4a78d84d55e6
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/CommentReply.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
index 4c27a18101fd..30ef1735c73f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
@@ -880,6 +880,22 @@ DECLARE_OOXMLEXPORT_TEST(testTdf105688, "tdf105688.docx")
 CPPUNIT_ASSERT_EQUAL(2, getPages());
 }
 

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

2023-02-16 Thread Paris Oplopoios (via logerrit)
 sw/qa/extras/ooxmlexport/data/CommentReply.docx   |binary
 sw/qa/extras/ooxmlexport/ooxmlexport16.cxx|2 ++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |2 +-
 3 files changed, 3 insertions(+), 1 deletion(-)

New commits:
commit f2428c21c635b142b27adf020518d9b13b3baf0e
Author: Paris Oplopoios 
AuthorDate: Wed Feb 15 03:23:07 2023 +0200
Commit: Miklos Vajna 
CommitDate: Thu Feb 16 08:44:42 2023 +

Fix issue where comment replies would not get a para id on roundtrip

Also adjusted the test file to account for this

Change-Id: I34f1d9d3a77f91396dd733785eb5b7853289508a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147034
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/data/CommentReply.docx 
b/sw/qa/extras/ooxmlexport/data/CommentReply.docx
index 4a78d84d55e6..e3a648aa4326 100644
Binary files a/sw/qa/extras/ooxmlexport/data/CommentReply.docx and 
b/sw/qa/extras/ooxmlexport/data/CommentReply.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
index 30ef1735c73f..99c0b2c9ffe7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
@@ -885,6 +885,8 @@ CPPUNIT_TEST_FIXTURE(Test, testCommentReply)
 loadAndSave("CommentReply.docx");
 xmlDocUniquePtr pXmlComm = parseExport("word/comments.xml");
 xmlDocUniquePtr pXmlCommExt = parseExport("word/commentsExtended.xml");
+CPPUNIT_ASSERT(pXmlComm);
+CPPUNIT_ASSERT(pXmlCommExt);
 OUString sParentId = getXPath(pXmlComm, "/w:comments/w:comment[1]/w:p[1]", 
"paraId");
 OUString sChildId = getXPath(pXmlComm, "/w:comments/w:comment[2]/w:p[1]", 
"paraId");
 OUString sChildIdEx = getXPath(pXmlCommExt, 
"/w15:commentsEx/w15:commentEx", "paraId");
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index f5f8f70d732c..b282742e7311 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2696,8 +2696,8 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap, con
 {
 m_bAnnotationResolved = item->second.bDone;
 m_sAnnotationParent = item->second.sParaIdParent;
-m_sAnnotationImportedParaId = sParaId;
 }
+m_sAnnotationImportedParaId = sParaId;
 }
 }
 


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

2023-02-15 Thread Paris Oplopoios (via logerrit)
 sw/source/uibase/docvw/PostItMgr.cxx |1 +
 sw/source/uibase/uno/unotxdoc.cxx|1 +
 2 files changed, 2 insertions(+)

New commits:
commit a36be102d6e94fd4b2a379a1bbfe2aefd0614d6b
Author: Paris Oplopoios 
AuthorDate: Tue Feb 14 19:06:29 2023 +0200
Commit: Miklos Vajna 
CommitDate: Wed Feb 15 14:43:29 2023 +

Add paraIdParent to LOK notification attributes

paraIdParent has to do with which comments are replies to other comments
which differs from the parent attribute which has to do with
which comments are in the same thread with other comments

Change-Id: I27feba55eadeeff22d409f69d8df976ad85e0ba6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147021
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/uibase/docvw/PostItMgr.cxx 
b/sw/source/uibase/docvw/PostItMgr.cxx
index 8e72ad7b1e1e..e0ceb396fc81 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -169,6 +169,7 @@ namespace {
 
 aAnnotation.put("id", pField->GetPostItId());
 aAnnotation.put("parent", pWin->CalcParent());
+aAnnotation.put("paraIdParent", pField->GetParentId());
 aAnnotation.put("author", pField->GetPar1().toUtf8().getStr());
 aAnnotation.put("text", pField->GetPar2().toUtf8().getStr());
 aAnnotation.put("resolved", pField->GetResolved() ? "true" : 
"false");
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index effdfcd30f63..e752a659b2ee 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3327,6 +3327,7 @@ void SwXTextDocument::getPostIts(tools::JsonWriter& 
rJsonWriter)
 auto commentNode = rJsonWriter.startStruct();
 rJsonWriter.put("id", pField->GetPostItId());
 rJsonWriter.put("parent", pWin->CalcParent());
+rJsonWriter.put("paraIdParent", pField->GetParentId());
 rJsonWriter.put("author", pField->GetPar1());
 rJsonWriter.put("text", pField->GetPar2());
 rJsonWriter.put("resolved", pField->GetResolved() ? "true" : "false");


[Libreoffice-commits] core.git: sw/source writerfilter/inc writerfilter/source

2023-02-12 Thread Paris Oplopoios (via logerrit)
 sw/source/core/fields/docufld.cxx |   12 ++--
 sw/source/filter/ww8/docxattributeoutput.cxx  |2 +-
 sw/source/filter/ww8/docxattributeoutput.hxx  |1 +
 writerfilter/inc/dmapper/CommentProperties.hxx|4 ++--
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |6 +++---
 5 files changed, 9 insertions(+), 16 deletions(-)

New commits:
commit ce3d8f7e082afbc4a3139c723cb4533579523fe2
Author: Paris Oplopoios 
AuthorDate: Thu Jan 19 18:52:41 2023 +0200
Commit: Miklos Vajna 
CommitDate: Mon Feb 13 07:58:38 2023 +

Fix typo, improve code readability, fix comment

Change-Id: I7221222e8c84ee40e4edaec5325565dae4193aff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145825
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/fields/docufld.cxx 
b/sw/source/core/fields/docufld.cxx
index d9e998ad41f4..09ffdc4437e3 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -1913,20 +1913,12 @@ bool SwPostItField::QueryValue( uno::Any& rAny, 
sal_uInt16 nWhichId ) const
 break;
 case FIELD_PROP_PAR5:
 {
-OUString sTemp;
-std::stringstream ss;
-ss << std::uppercase << std::hex << m_nParentId;
-sTemp = OUString::createFromAscii(ss.str().c_str());
-rAny <<= sTemp;
+rAny <<= OUString(OUString::number(m_nParentId, 
16).toAsciiUpperCase());
 }
 break;
 case FIELD_PROP_PAR6:
 {
-OUString sTemp;
-std::stringstream ss;
-ss << std::uppercase << std::hex << m_nPostItId;
-sTemp = OUString::createFromAscii(ss.str().c_str());
-rAny <<= sTemp;
+rAny <<= OUString(OUString::number(m_nPostItId, 
16).toAsciiUpperCase());
 }
 break;
 default:
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 528033e7b3b7..e40d6c0b3db3 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -8892,7 +8892,7 @@ void DocxAttributeOutput::WritePostItFieldsResolved()
 if (data.parentStatus == ParentStatus::HasParent)
 {
 // Since parent fields have been resolved first, they should 
already have an id
-auto& aParentFieldData = 
m_postitFields[data.parentIndex].second;
+const PostItDOCXData& aParentFieldData = 
m_postitFields[data.parentIndex].second;
 sParentId = NumberToHexBinary(aParentFieldData.lastParaId);
 }
 else
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx 
b/sw/source/filter/ww8/docxattributeoutput.hxx
index f61765d62832..29abf6badce8 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -982,6 +982,7 @@ private:
 std::vector m_aPostponedActiveXControls;
 const SwField* m_PendingPlaceholder;
 
+/// Used to store the parent status of a PostIt (parent/child/neither)
 enum class ParentStatus
 {
 None,
diff --git a/writerfilter/inc/dmapper/CommentProperties.hxx 
b/writerfilter/inc/dmapper/CommentProperties.hxx
index fe66cceed3f8..c554418108c4 100644
--- a/writerfilter/inc/dmapper/CommentProperties.hxx
+++ b/writerfilter/inc/dmapper/CommentProperties.hxx
@@ -16,8 +16,8 @@ namespace writerfilter
 /**
  A container for the extended comment properties linked to the last paragraph 
of a comment
 
- Corresponds to the data available in w5:commentEx elements from 
commentsExtended stream
- ([MS-DOCX]): resolved state and parent (referring to comment that this one 
answers to; TODO).
+ Corresponds to the data available in w15:commentEx elements from 
commentsExtended stream
+ ([MS-DOCX]): resolved state and parent (referring to comment that this one 
answers to).
 
  @since 7.2
 */
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 7f4c800b1002..46260200d7a1 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3838,10 +3838,10 @@ void DomainMapper_Impl::PopAnnotation()
 try
 {
 if (m_bAnnotationResolved)
-m_xAnnotationField->setPropertyValue("Resolved", 
css::uno::Any(true));
+m_xAnnotationField->setPropertyValue("Resolved", uno::Any(true));
 
-m_xAnnotationField->setPropertyValue("ParaIdParent", 
css::uno::Any(m_sAnnotationParent));
-m_xAnnotationField->setPropertyValue("ParaId", 
css::uno::Any(m_sAnnotationImportedParaId));
+m_xAnnotationField->setPropertyValue("ParaIdParent", 
uno::Any(m_sAnnotationParent));
+m_xAnnotationField->setPropertyValue("ParaId", 
uno::Any(m_sAnnotationImportedParaId));
 
 // See if the annotation will be a single position or a range.
 if 

[Libreoffice-commits] core.git: sw/inc sw/source

2023-01-30 Thread Paris Oplopoios (via logerrit)
 sw/inc/AnnotationWin.hxx  |5 +
 sw/inc/PostItMgr.hxx  |2 ++
 sw/inc/postithelper.hxx   |5 +
 sw/source/uibase/docvw/AnnotationWin.cxx  |   21 +
 sw/source/uibase/docvw/AnnotationWin2.cxx |8 
 sw/source/uibase/docvw/PostItMgr.cxx  |5 +
 6 files changed, 46 insertions(+)

New commits:
commit 70ff425141e3569bf09a6768ded3b8a7b0002bab
Author: Paris Oplopoios 
AuthorDate: Wed Jan 18 20:26:58 2023 +0200
Commit: Miklos Vajna 
CommitDate: Mon Jan 30 08:33:40 2023 +

tdf#119229 docx: Set paraIdParent upon FN_REPLY

Set the paraIdParent SwPostItField attribute when replying on an
existing comment in Writer

Change-Id: I33d89688d5a36a91b26a64cf4b0f605d7bf33b1f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145750
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx
index f5d3c167c24e..2aa641361ebf 100644
--- a/sw/inc/AnnotationWin.hxx
+++ b/sw/inc/AnnotationWin.hxx
@@ -191,6 +191,11 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin final : public 
InterimItemWindow
 bool IsResolved() const;
 bool IsThreadResolved();
 
+// Get annotation paraId or generate one if it doesn't exist
+sal_uInt32 GetParaId();
+// Used to generate a unique paraId
+static sal_uInt32 CreateUniqueParaId();
+
 // Set this SwAnnotationWin as the currently active one
 // return false if it was already active
 bool SetActiveSidebarWin();
diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx
index 68292b452ab3..98d9f4f2ef30 100644
--- a/sw/inc/PostItMgr.hxx
+++ b/sw/inc/PostItMgr.hxx
@@ -230,6 +230,8 @@ class SAL_DLLPUBLIC_RTTI SwPostItMgr final : public 
SfxListener
 
 sw::annotation::SwAnnotationWin* GetNextPostIt( sal_uInt16 aDirection,
 
sw::annotation::SwAnnotationWin* aPostIt);
+SwPostItField* GetLatestPostItField();
+
 tools::Long GetNextBorder();
 
 sw::annotation::SwAnnotationWin* GetActiveSidebarWin() { return 
mpActivePostIt; }
diff --git a/sw/inc/postithelper.hxx b/sw/inc/postithelper.hxx
index 3377fc752450..f55d64d39a99 100644
--- a/sw/inc/postithelper.hxx
+++ b/sw/inc/postithelper.hxx
@@ -114,6 +114,7 @@ public:
 virtual SwPosition GetAnchorPosition() const = 0;
 virtual bool UseElement(SwRootFrame const&, IDocumentRedlineAccess const&) 
= 0;
 virtual const SwFormatField& GetFormatField() const = 0;
+virtual SwFormatField& GetFormatField() = 0;
 virtual const SfxBroadcaster* GetBroadcaster() const = 0;
 virtual VclPtr GetSidebarWindow( 
SwEditWin& rEditWin,
 SwPostItMgr& 
aMgr) = 0;
@@ -136,6 +137,10 @@ public:
 {
 return mrFormatField;
 }
+SwFormatField& GetFormatField() override
+{
+return mrFormatField;
+}
 virtual const SfxBroadcaster* GetBroadcaster() const override
 {
 return 
diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx 
b/sw/source/uibase/docvw/AnnotationWin.cxx
index 685dcbb5ce94..8ba768d7d253 100644
--- a/sw/source/uibase/docvw/AnnotationWin.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin.cxx
@@ -49,6 +49,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -236,6 +237,26 @@ void SwAnnotationWin::ToggleResolvedForThread()
 mrMgr.LayoutPostIts();
 }
 
+sal_uInt32 SwAnnotationWin::GetParaId()
+{
+auto pField = static_cast(mpFormatField->GetField());
+auto nParaId = pField->GetParaId();
+if (nParaId == 0)
+{
+// The parent annotation does not have a paraId. This happens when the 
annotation was just
+// created, and not imported. paraIds are regenerated upon export, 
thus this new paraId
+// is only generated so that children annotations can refer to it
+nParaId = CreateUniqueParaId();
+pField->SetParaId(nParaId);
+}
+return nParaId;
+}
+
+sal_uInt32 SwAnnotationWin::CreateUniqueParaId()
+{
+return comphelper::rng::uniform_uint_distribution(0, 
std::numeric_limits::max());
+}
+
 void SwAnnotationWin::DeleteThread()
 {
 // Go to the top and delete each comment one by one
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx 
b/sw/source/uibase/docvw/AnnotationWin2.cxx
index 087759047a81..3f8dd2333b9d 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -67,6 +67,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -1092,6 +1093,13 @@ void SwAnnotationWin::ExecuteCommand(sal_uInt16 nSlot)
 mrMgr.SetActiveSidebarWin(nullptr);
 SwitchToFieldPos();
 mrView.GetViewFrame()->GetDispatcher()->Execute(FN_POSTIT);
+
+if (nSlot == FN_REPLY)
+{
+// Get newly 

[Libreoffice-commits] core.git: oox/source sw/inc sw/qa sw/source writerfilter/inc writerfilter/source

2023-01-18 Thread Paris Oplopoios (via logerrit)
 oox/source/token/tokens.txt   |1 
 sw/inc/docufld.hxx|   10 +++
 sw/inc/unoprnms.hxx   |2 
 sw/qa/extras/ooxmlexport/data/CommentReply.docx   |binary
 sw/qa/extras/ooxmlexport/ooxmlexport16.cxx|   16 +
 sw/source/core/fields/docufld.cxx |   50 -
 sw/source/core/inc/unofldmid.h|1 
 sw/source/core/unocore/unofield.cxx   |   27 +
 sw/source/core/unocore/unomap.cxx |2 
 sw/source/filter/ww8/docxattributeoutput.cxx  |   51 +++---
 sw/source/filter/ww8/docxattributeoutput.hxx  |   12 +++-
 sw/source/filter/ww8/docxexport.cxx   |4 -
 writerfilter/inc/dmapper/CommentProperties.hxx|6 +-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |7 ++
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |2 
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |7 ++
 writerfilter/source/ooxml/OOXMLFastContextHandler.hxx |2 
 writerfilter/source/ooxml/model.xml   |3 -
 18 files changed, 183 insertions(+), 20 deletions(-)

New commits:
commit 0c2ed51a775871c91ac8f01c8982f23c34e8248d
Author: Paris Oplopoios 
AuthorDate: Fri Jan 13 19:49:23 2023 +0200
Commit: Miklos Vajna 
CommitDate: Wed Jan 18 15:28:37 2023 +

tdf#119229 docx: Preserve w15:paraIdParent attribute in commentsExtended

w15:paraIdParent attribute indicates that the comment is a reply to the
value id

Change-Id: I9e6eca6a656594c956629c1434b8e5c3aa573c60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145314
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/oox/source/token/tokens.txt b/oox/source/token/tokens.txt
index 25951891d2a7..dee9010df789 100644
--- a/oox/source/token/tokens.txt
+++ b/oox/source/token/tokens.txt
@@ -3884,6 +3884,7 @@ parTransId
 parTxLTRAlign
 parTxRTLAlign
 paraId
+paraIdParent
 paragraph
 parallel
 parallelogram
diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx
index b907763a2d8c..89a5341222db 100644
--- a/sw/inc/docufld.hxx
+++ b/sw/inc/docufld.hxx
@@ -456,6 +456,8 @@ class SW_DLLPUBLIC SwPostItField final : public SwField
 std::optional mpText;
 rtl::Reference m_xTextObject;
 sal_uInt32 m_nPostItId;
+sal_uInt32 m_nParentId;
+sal_uInt32 m_nParaId;
 
 public:
 static sal_uInt32 s_nLastPostItId;
@@ -467,7 +469,9 @@ public:
OUString aName,
const DateTime& rDate,
const bool bResolved = false,
-   const sal_uInt32 nPostItId = 0);
+   const sal_uInt32 nPostItId = 0,
+   const sal_uInt32 nParentId = 0,
+   const sal_uInt32 nParaId = 0);
 
 SwPostItField(const SwPostItField&) = delete;
 SwPostItField* operator=(const SwPostItField&) = delete;
@@ -482,6 +486,10 @@ public:
 tools::Time GetTime() const { return 
tools::Time(m_aDateTime.GetTime()); }
 sal_uInt32 GetPostItId() const { return m_nPostItId; }
 void SetPostItId(const sal_uInt32 nPostItId = 0);
+sal_uInt32 GetParentId() const { return m_nParentId; }
+void SetParentId(const sal_uInt32 nParentId);
+sal_uInt32 GetParaId() const   { return m_nParaId; }
+void SetParaId(const sal_uInt32 nParaId);
 
 /// Author
 virtual OUStringGetPar1() const override;
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 85a1938d61ce..eb70f1d79d8d 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -923,6 +923,8 @@ inline constexpr OUStringLiteral UNO_NAME_ID = u"Id";
 inline constexpr OUStringLiteral UNO_NAME_TAB_INDEX = u"TabIndex";
 inline constexpr OUStringLiteral UNO_NAME_LOCK = u"Lock";
 inline constexpr OUStringLiteral UNO_NAME_DATE_STRING = u"DateString";
+inline constexpr OUStringLiteral UNO_NAME_PARA_ID = u"ParaId";
+inline constexpr OUStringLiteral UNO_NAME_PARA_ID_PARENT = u"ParaIdParent";
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ooxmlexport/data/CommentReply.docx 
b/sw/qa/extras/ooxmlexport/data/CommentReply.docx
new file mode 100644
index ..4a78d84d55e6
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/CommentReply.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
index 4c27a18101fd..30ef1735c73f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
@@ -880,6 +880,22 @@ DECLARE_OOXMLEXPORT_TEST(testTdf105688, "tdf105688.docx")
 CPPUNIT_ASSERT_EQUAL(2, getPages());
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testCommentReply)
+{
+loadAndSave("CommentReply.docx");
+xmlDocUniquePtr pXmlComm = parseExport("word/comments.xml");
+xmlDocUniquePtr pXmlCommExt 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/source

2023-01-10 Thread Paris Oplopoios (via logerrit)
 sc/source/filter/excel/xestream.cxx |   11 +++
 1 file changed, 11 insertions(+)

New commits:
commit 1ecf49085ae34561ddc9ef91ded4764fbe1f0732
Author: Paris Oplopoios 
AuthorDate: Wed Nov 9 13:43:46 2022 +0200
Commit: Andras Timar 
CommitDate: Tue Jan 10 08:12:41 2023 +

Get ScViewData through the current doc shell in headless mode

When using --convert-to, ScDocShell::GetViewData() would return nullptr
so we now get the ScViewData through an alternative route.

Change-Id: Ie71a4a1077b3c63c0aadd394fc0d966e679e8803
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142480
Tested-by: Jenkins
Reviewed-by: Jan Holesovsky 
(cherry picked from commit 95cb9a01bfacf7d9f03194b0710ca3c249bb62fb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142442
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/sc/source/filter/excel/xestream.cxx 
b/sc/source/filter/excel/xestream.cxx
index 315b905560f3..c201af071c21 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -53,6 +53,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -1045,6 +1046,16 @@ bool XclExpXmlStream::exportDocument()
 // Get the viewsettings before processing
 if( ScDocShell::GetViewData() )
 ScDocShell::GetViewData()->WriteExtOptions( mpRoot->GetExtDocOptions() 
);
+else
+{
+// Try to get ScViewData through the current ScDocShell
+ScTabViewShell* pTabViewShell = pShell->GetBestViewShell( false );
+if ( pTabViewShell )
+{
+ScViewData* pViewData = >GetViewData();
+pViewData->WriteExtOptions( mpRoot->GetExtDocOptions() );
+}
+}
 
 OUString const workbook = "xl/workbook.xml";
 const char* pWorkbookContentType = nullptr;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - emfio/qa emfio/source

2022-12-13 Thread Paris Oplopoios (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx |   15 ++-
 emfio/source/reader/mtftools.cxx   |1 +
 2 files changed, 7 insertions(+), 9 deletions(-)

New commits:
commit ed9276531613731f81d05854054b8aae1e1df61a
Author: Paris Oplopoios 
AuthorDate: Mon Dec 12 11:30:27 2022 +
Commit: Xisco Fauli 
CommitDate: Tue Dec 13 15:41:12 2022 +

tdf#152435 Revert "Make EMR_SAVEDC not UpdateClipRegion"

This reverts commit 1230b88055c7389d2c376c316f91549e4aaef8aa.

Reason for revert:
The reverted commit breaks the files documented in tdf#152435 (some
text is not shown in those .EMF files). The reverted commit would solve
an issue where some text was not clipped correctly, albeit in a naive
way. As it is more important that text is shown rather than some text
having correct clipping, that patch is reverted and I will look for one
that fixes both cases.

Change-Id: I42e85b802b8bf1e77e96f0016cd1d83201047032
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143970
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
(cherry picked from commit 75093a9f7fbde760a3034f41694739c7454cb7eb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144029
Reviewed-by: Xisco Fauli 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 3d77dd95e5a0..75f2b9001a08 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -1019,19 +1019,16 @@ void Test::TestEmfPlusSave()
 
 assertXPath(pDocument, aXPathPrefix + "mask/polypolygon", "path", "m0 
0h33544v21311h-33544z");
 
-assertXPath(pDocument, aXPathPrefix + 
"mask/group/mask/polypolygoncolor[1]/polypolygon", "path",
+assertXPath(pDocument, aXPathPrefix + 
"mask/group/mask/polypolygoncolor/polypolygon", "path",
 "m327.4583 
638.h437007.1875v29.6h-437007.1875z");
-assertXPath(pDocument, aXPathPrefix + 
"mask/group/mask/polypolygoncolor[1]", "color",
-"#ff0cad");
+assertXPath(pDocument, aXPathPrefix + "mask/group/mask/polypolygoncolor", 
"color", "#ff0cad");
 
-assertXPath(pDocument, aXPathPrefix + 
"mask/group/mask/polypolygoncolor[2]/polypolygon", "path",
+assertXPath(pDocument, aXPathPrefix + "mask/polypolygoncolor/polypolygon", 
"path",
 "m10853.4145539602 
7321.41354709201h41952690v29630720h-41952690z");
-assertXPath(pDocument, aXPathPrefix + 
"mask/group/mask/polypolygoncolor[2]", "color",
-"#00ffad");
+assertXPath(pDocument, aXPathPrefix + "mask/polypolygoncolor", "color", 
"#00ffad");
 
-assertXPath(pDocument, aXPathPrefix + 
"mask/group/mask/polygonstrokearrow/line", "color",
-"#00");
-assertXPathContent(pDocument, aXPathPrefix + 
"mask/group/mask/polygonstrokearrow/polygon",
+assertXPath(pDocument, aXPathPrefix + "mask/polygonstrokearrow/line", 
"color", "#00");
+assertXPathContent(pDocument, aXPathPrefix + 
"mask/polygonstrokearrow/polygon",
"10853.4145539602,7321.41354709201 
10853.4145539602,4907.54325697157 "
"12832.6557236512,4907.54325697157");
 }
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index 2683151166b2..7f067e4fcd15 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -2365,6 +2365,7 @@ namespace emfio
 
 void MtfTools::Push()   // !! to be able to access the 
original ClipRegion it
 {   // is not allowed to use 
the MetaPushAction()
+UpdateClipRegion(); // (the original clip 
region is on top of the stack) (SJ)
 auto pSave = std::make_shared();
 
 pSave->aLineStyle = maLineStyle;


[Libreoffice-commits] core.git: emfio/qa emfio/source

2022-12-12 Thread Paris Oplopoios (via logerrit)
 emfio/qa/cppunit/emf/EmfImportTest.cxx |   15 ++-
 emfio/source/reader/mtftools.cxx   |1 +
 2 files changed, 7 insertions(+), 9 deletions(-)

New commits:
commit 75093a9f7fbde760a3034f41694739c7454cb7eb
Author: Paris Oplopoios 
AuthorDate: Mon Dec 12 11:30:27 2022 +
Commit: Miklos Vajna 
CommitDate: Tue Dec 13 06:59:06 2022 +

tdf#152435 Revert "Make EMR_SAVEDC not UpdateClipRegion"

This reverts commit 1230b88055c7389d2c376c316f91549e4aaef8aa.

Reason for revert:
The reverted commit breaks the files documented in tdf#152435 (some
text is not shown in those .EMF files). The reverted commit would solve
an issue where some text was not clipped correctly, albeit in a naive
way. As it is more important that text is shown rather than some text
having correct clipping, that patch is reverted and I will look for one
that fixes both cases.

Change-Id: I42e85b802b8bf1e77e96f0016cd1d83201047032
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143970
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index 3d77dd95e5a0..75f2b9001a08 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -1019,19 +1019,16 @@ void Test::TestEmfPlusSave()
 
 assertXPath(pDocument, aXPathPrefix + "mask/polypolygon", "path", "m0 
0h33544v21311h-33544z");
 
-assertXPath(pDocument, aXPathPrefix + 
"mask/group/mask/polypolygoncolor[1]/polypolygon", "path",
+assertXPath(pDocument, aXPathPrefix + 
"mask/group/mask/polypolygoncolor/polypolygon", "path",
 "m327.4583 
638.h437007.1875v29.6h-437007.1875z");
-assertXPath(pDocument, aXPathPrefix + 
"mask/group/mask/polypolygoncolor[1]", "color",
-"#ff0cad");
+assertXPath(pDocument, aXPathPrefix + "mask/group/mask/polypolygoncolor", 
"color", "#ff0cad");
 
-assertXPath(pDocument, aXPathPrefix + 
"mask/group/mask/polypolygoncolor[2]/polypolygon", "path",
+assertXPath(pDocument, aXPathPrefix + "mask/polypolygoncolor/polypolygon", 
"path",
 "m10853.4145539602 
7321.41354709201h41952690v29630720h-41952690z");
-assertXPath(pDocument, aXPathPrefix + 
"mask/group/mask/polypolygoncolor[2]", "color",
-"#00ffad");
+assertXPath(pDocument, aXPathPrefix + "mask/polypolygoncolor", "color", 
"#00ffad");
 
-assertXPath(pDocument, aXPathPrefix + 
"mask/group/mask/polygonstrokearrow/line", "color",
-"#00");
-assertXPathContent(pDocument, aXPathPrefix + 
"mask/group/mask/polygonstrokearrow/polygon",
+assertXPath(pDocument, aXPathPrefix + "mask/polygonstrokearrow/line", 
"color", "#00");
+assertXPathContent(pDocument, aXPathPrefix + 
"mask/polygonstrokearrow/polygon",
"10853.4145539602,7321.41354709201 
10853.4145539602,4907.54325697157 "
"12832.6557236512,4907.54325697157");
 }
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index 2683151166b2..7f067e4fcd15 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -2365,6 +2365,7 @@ namespace emfio
 
 void MtfTools::Push()   // !! to be able to access the 
original ClipRegion it
 {   // is not allowed to use 
the MetaPushAction()
+UpdateClipRegion(); // (the original clip 
region is on top of the stack) (SJ)
 auto pSave = std::make_shared();
 
 pSave->aLineStyle = maLineStyle;


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sw/inc sw/qa sw/source

2022-11-22 Thread Paris Oplopoios (via logerrit)
 sw/inc/AccessibilityCheckStrings.hrc |1 
 sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx |   14 +++
 sw/qa/core/accessibilitycheck/data/TabsTest.odt  |binary
 sw/source/core/access/AccessibilityCheck.cxx |   68 ++-
 4 files changed, 64 insertions(+), 19 deletions(-)

New commits:
commit b5c36927ad59623ac902fdf0ed80adb0cf49d3e8
Author: Paris Oplopoios 
AuthorDate: Mon Oct 24 14:12:44 2022 +0300
Commit: Tomaž Vajngerl 
CommitDate: Tue Nov 22 09:55:07 2022 +0100

a11y: Add check for tabs used for formatting

Add accessibility check and relevant test for a document that uses
tabs for formatting

Useful to detect fake tables made of tabs

Change-Id: Ief765f25c8dc67405d0671e257cf0ba7aec9f16c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141732
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142575
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/inc/AccessibilityCheckStrings.hrc 
b/sw/inc/AccessibilityCheckStrings.hrc
index 7245a2b8d3e0..baa61cbcb8ba 100644
--- a/sw/inc/AccessibilityCheckStrings.hrc
+++ b/sw/inc/AccessibilityCheckStrings.hrc
@@ -27,6 +27,7 @@
 #define STR_AVOID_BACKGROUND_IMAGES NC_("STR_AVOID_BACKGROUND_IMAGES", 
"Avoid background images.")
 #define STR_AVOID_NEWLINES_SPACENC_("STR_AVOID_NEWLINES_SPACE", "Avoid 
newlines to create space.")
 #define STR_AVOID_SPACES_SPACE  NC_("STR_AVOID_SPACES_SPACE", "Avoid 
spaces to create space.")
+#define STR_AVOID_TABS_FORMATTING   NC_("STR_AVOID_TABS_FORMATTING", 
"Avoid using tabs for formatting.")
 #define STR_HEADINGS_NOT_IN_ORDER   NC_("STR_HEADINGS_NOT_IN_ORDER", 
"Headings not in order.")
 #define STR_TEXT_FORMATTING_CONVEYS_MEANING 
NC_("STR_TEXT_FORMATTING_CONVEYS_MEANING", "The text formatting conveys 
additional meaning.")
 #define STR_NON_INTERACTIVE_FORMS   NC_("STR_NON_INTERACTIVE_FORMS", "An 
input form is not interactive.")
diff --git a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx 
b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
index 122332931544..0059bdf2fa8f 100644
--- a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
+++ b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
@@ -152,6 +152,20 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, 
testCheckTableFormatting)
 CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TABLE_FORMATTING, 
aIssues[0]->m_eIssueID);
 }
 
+CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckTabsFormatting)
+{
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "TabsTest.odt");
+CPPUNIT_ASSERT(pDoc);
+sw::AccessibilityCheck aCheck(pDoc);
+aCheck.check();
+auto& aIssues = aCheck.getIssueCollection().getIssues();
+CPPUNIT_ASSERT_EQUAL(size_t(4), aIssues.size());
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[0]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[1]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[2]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[3]->m_eIssueID);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/accessibilitycheck/data/TabsTest.odt 
b/sw/qa/core/accessibilitycheck/data/TabsTest.odt
new file mode 100644
index ..29b415df87a7
Binary files /dev/null and b/sw/qa/core/accessibilitycheck/data/TabsTest.odt 
differ
diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index d9d1c76e5b67..fc47ce8f39d0 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -771,33 +771,63 @@ public:
 const OUString& sParagraphText = pTextNode->GetText();
 sal_Int32 nSpaceCount = 0;
 sal_Int32 nSpaceStart = 0;
+sal_Int32 nTabCount = 0;
 bool bNonSpaceFound = false;
+bool bPreviousWasChar = false;
 for (sal_Int32 i = 0; i < nParagraphLength; i++)
 {
-if (sParagraphText[i] == ' ')
+switch (sParagraphText[i])
 {
-if (bNonSpaceFound)
+case ' ':
 {
-nSpaceCount++;
-if (nSpaceCount == 2)
-nSpaceStart = i;
+if (bNonSpaceFound)
+{
+nSpaceCount++;
+if (nSpaceCount == 2)
+nSpaceStart = i;
+}
+break;
 }
-}
-else
-{
-if (nSpaceCount >= 2)
+case '\t':
 {
-auto pIssue = lclAddIssue(m_rIssueCollection, 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - include/sfx2 sw/inc sw/qa sw/source

2022-11-22 Thread Paris Oplopoios (via logerrit)
 include/sfx2/AccessibilityIssue.hxx|1 
 sw/inc/AccessibilityCheckStrings.hrc   |1 
 sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx   |   11 ++
 sw/qa/core/accessibilitycheck/data/TableFormattingTest.odt |binary
 sw/source/core/access/AccessibilityCheck.cxx   |   49 +
 5 files changed, 62 insertions(+)

New commits:
commit 09e3acfc290d98b4fc4d78bc2cce1b4b6f696e45
Author: Paris Oplopoios 
AuthorDate: Thu Nov 3 01:02:40 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Tue Nov 22 09:54:49 2022 +0100

a11y: Add check for table used for text formatting

Add accessibility check and relevant test for a document that uses a
table for text formatting

Change-Id: I20290a3ec89cd5333f3c66867b50aa7b80ed494f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142188
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142519
Tested-by: Jenkins CollaboraOffice 

diff --git a/include/sfx2/AccessibilityIssue.hxx 
b/include/sfx2/AccessibilityIssue.hxx
index b7b65d732b14..1f1287408736 100644
--- a/include/sfx2/AccessibilityIssue.hxx
+++ b/include/sfx2/AccessibilityIssue.hxx
@@ -30,6 +30,7 @@ enum class AccessibilityIssueID
 NO_ALT_SHAPE,
 TABLE_MERGE_SPLIT,
 TEXT_FORMATTING,
+TABLE_FORMATTING,
 HYPERLINK_IS_TEXT,
 HYPERLINK_SHORT,
 FAKE_FOOTNOTE,
diff --git a/sw/inc/AccessibilityCheckStrings.hrc 
b/sw/inc/AccessibilityCheckStrings.hrc
index e63d304d1063..7245a2b8d3e0 100644
--- a/sw/inc/AccessibilityCheckStrings.hrc
+++ b/sw/inc/AccessibilityCheckStrings.hrc
@@ -34,6 +34,7 @@
 #define STR_HEADING_IN_TABLENC_("STR_HEADING_IN_TABLE", "Tables 
must not contain headings.")
 #define STR_HEADING_ORDER   NC_("STR_HEADING_ORDER", "Keep 
headings' levels ordered. Heading level %LEVEL_CURRENT% must not go after 
%LEVEL_PREV%.")
 #define STR_FONTWORKS   NC_("STR_FONTWORKS", "Avoid Fontwork 
objects in your documents. Make sure you use it for samples or other 
meaningless text.")
+#define STR_TABLE_FORMATTINGNC_("STR_TABLE_FORMATTING", "Avoid 
using empty table cells for formatting.")
 
 #define STR_DOCUMENT_DEFAULT_LANGUAGE   NC_("STR_DOCUMENT_DEFAULT_LANGUAGE", 
"Document default language is not set")
 #define STR_STYLE_NO_LANGUAGE   NC_("STR_STYLE_NO_LANGUAGE", "Style 
'%STYLE_NAME%' has no language set")
diff --git a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx 
b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
index 8a5265102160..122332931544 100644
--- a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
+++ b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
@@ -141,6 +141,17 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, 
testCheckFakeCaption)
 CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::FAKE_CAPTION, 
aIssues[0]->m_eIssueID);
 }
 
+CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckTableFormatting)
+{
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "TableFormattingTest.odt");
+CPPUNIT_ASSERT(pDoc);
+sw::AccessibilityCheck aCheck(pDoc);
+aCheck.check();
+auto& aIssues = aCheck.getIssueCollection().getIssues();
+CPPUNIT_ASSERT_EQUAL(size_t(1), aIssues.size());
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TABLE_FORMATTING, 
aIssues[0]->m_eIssueID);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/accessibilitycheck/data/TableFormattingTest.odt 
b/sw/qa/core/accessibilitycheck/data/TableFormattingTest.odt
new file mode 100644
index ..adc63daaf7cb
Binary files /dev/null and 
b/sw/qa/core/accessibilitycheck/data/TableFormattingTest.odt differ
diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 3b7b6ca7988e..d9d1c76e5b67 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -216,6 +216,50 @@ public:
 }
 };
 
+class TableFormattingCheck : public NodeCheck
+{
+private:
+void checkTableNode(SwTableNode* pTableNode)
+{
+if (!pTableNode)
+return;
+
+const SwTable& rTable = pTableNode->GetTable();
+if (!rTable.IsTableComplex())
+{
+size_t nEmptyBoxes = 0;
+size_t nBoxCount = 0;
+for (const SwTableLine* pTableLine : rTable.GetTabLines())
+{
+nBoxCount += pTableLine->GetTabBoxes().size();
+for (const SwTableBox* pBox : pTableLine->GetTabBoxes())
+if (pBox->IsEmpty())
+++nEmptyBoxes;
+}
+// If more than half of the boxes are empty we can assume that it 
is used for formatting
+if (nEmptyBoxes > nBoxCount / 2)
+lclAddIssue(m_rIssueCollection, SwResId(STR_TABLE_FORMATTING),
+ 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - include/sfx2 sw/inc sw/qa sw/source

2022-11-22 Thread Paris Oplopoios (via logerrit)
 include/sfx2/AccessibilityIssue.hxx  |1 
 sw/inc/AccessibilityCheckStrings.hrc |1 
 sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx |   11 ++
 sw/qa/core/accessibilitycheck/data/FakeCaptionTest.odt   |binary
 sw/source/core/access/AccessibilityCheck.cxx |   66 +++
 5 files changed, 79 insertions(+)

New commits:
commit ebecdf12381806a8982cdbb7d8626f05e3408b5b
Author: Paris Oplopoios 
AuthorDate: Fri Oct 28 13:14:36 2022 +0300
Commit: Tomaž Vajngerl 
CommitDate: Tue Nov 22 09:54:18 2022 +0100

a11y: Add check for fake captions

Add accessibility check and relevant test for a document that has
fake captions

Change-Id: If22999378fd7467151c1d400662858fe1cb0319d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141964
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142574
Tested-by: Jenkins CollaboraOffice 

diff --git a/include/sfx2/AccessibilityIssue.hxx 
b/include/sfx2/AccessibilityIssue.hxx
index 3cead1f3c933..b7b65d732b14 100644
--- a/include/sfx2/AccessibilityIssue.hxx
+++ b/include/sfx2/AccessibilityIssue.hxx
@@ -33,6 +33,7 @@ enum class AccessibilityIssueID
 HYPERLINK_IS_TEXT,
 HYPERLINK_SHORT,
 FAKE_FOOTNOTE,
+FAKE_CAPTION,
 };
 
 class SFX2_DLLPUBLIC AccessibilityIssue
diff --git a/sw/inc/AccessibilityCheckStrings.hrc 
b/sw/inc/AccessibilityCheckStrings.hrc
index 86be8b494c90..e63d304d1063 100644
--- a/sw/inc/AccessibilityCheckStrings.hrc
+++ b/sw/inc/AccessibilityCheckStrings.hrc
@@ -22,6 +22,7 @@
 #define STR_TEXT_BLINKING   NC_("STR_TEXT_BLINKING", "Blinking 
text.")
 #define STR_AVOID_FOOTNOTES NC_("STR_AVOID_FOOTNOTES", "Avoid 
footnotes.")
 #define STR_AVOID_FAKE_FOOTNOTESNC_("STR_AVOID_FAKE_FOOTNOTES", "Avoid 
fake footnotes.")
+#define STR_AVOID_FAKE_CAPTIONS NC_("STR_AVOID_FAKE_CAPTIONS", "Avoid 
fake captions.")
 #define STR_AVOID_ENDNOTES  NC_("STR_AVOID_ENDNOTES", "Avoid 
endnotes.")
 #define STR_AVOID_BACKGROUND_IMAGES NC_("STR_AVOID_BACKGROUND_IMAGES", 
"Avoid background images.")
 #define STR_AVOID_NEWLINES_SPACENC_("STR_AVOID_NEWLINES_SPACE", "Avoid 
newlines to create space.")
diff --git a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx 
b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
index 43994aab8177..8a5265102160 100644
--- a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
+++ b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
@@ -130,6 +130,17 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, 
testCheckFakeFootnote)
 CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::FAKE_FOOTNOTE, 
aIssues[1]->m_eIssueID);
 }
 
+CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckFakeCaption)
+{
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "FakeCaptionTest.odt");
+CPPUNIT_ASSERT(pDoc);
+sw::AccessibilityCheck aCheck(pDoc);
+aCheck.check();
+auto& aIssues = aCheck.getIssueCollection().getIssues();
+CPPUNIT_ASSERT_EQUAL(size_t(1), aIssues.size());
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::FAKE_CAPTION, 
aIssues[0]->m_eIssueID);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/accessibilitycheck/data/FakeCaptionTest.odt 
b/sw/qa/core/accessibilitycheck/data/FakeCaptionTest.odt
new file mode 100644
index ..9630bfcf73d7
Binary files /dev/null and 
b/sw/qa/core/accessibilitycheck/data/FakeCaptionTest.odt differ
diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 5d3cc30f4e20..3b7b6ca7988e 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -11,12 +11,14 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -26,11 +28,13 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -821,6 +825,67 @@ public:
 }
 };
 
+class FakeCaptionCheck : public NodeCheck
+{
+public:
+FakeCaptionCheck(sfx::AccessibilityIssueCollection& rIssueCollection)
+: NodeCheck(rIssueCollection)
+{
+}
+void check(SwNode* pCurrent) override
+{
+if (!pCurrent->IsTextNode())
+return;
+
+SwTextNode* pTextNode = pCurrent->GetTextNode();
+const OUString& sText = pTextNode->GetText();
+
+if (sText.getLength() == 0)
+return;
+
+// Check if it's a real caption
+const SwNode* aStartFly = pCurrent->FindFlyStartNode();
+if (aStartFly
+&& aStartFly->GetFlyFormat()->GetAnchor().GetAnchorId() != 
RndStdIds::FLY_AS_CHAR)
+return;
+
+auto aIter = SwIterator(*pTextNode);
+auto 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - include/sfx2 sw/inc sw/qa sw/source

2022-11-22 Thread Paris Oplopoios (via logerrit)
 include/sfx2/AccessibilityIssue.hxx  |1 
 sw/inc/AccessibilityCheckStrings.hrc |1 
 sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx |   12 ++
 sw/qa/core/accessibilitycheck/data/FakeFootnoteTest.odt  |binary
 sw/source/core/access/AccessibilityCheck.cxx |   72 +++
 5 files changed, 86 insertions(+)

New commits:
commit 32a7031e7fef6639136a4db1eb76c68d9a2554b7
Author: Paris Oplopoios 
AuthorDate: Tue Oct 25 23:53:32 2022 +0300
Commit: Tomaž Vajngerl 
CommitDate: Tue Nov 22 09:54:03 2022 +0100

a11y: Add check for fake footnotes

Add accessibility check and relevant test for a document that has
fake footnotes

Change-Id: I22682a161a858f45c956660a51849bd18fcee0e5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141832
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142573
Tested-by: Jenkins CollaboraOffice 

diff --git a/include/sfx2/AccessibilityIssue.hxx 
b/include/sfx2/AccessibilityIssue.hxx
index e3c9247a022c..3cead1f3c933 100644
--- a/include/sfx2/AccessibilityIssue.hxx
+++ b/include/sfx2/AccessibilityIssue.hxx
@@ -32,6 +32,7 @@ enum class AccessibilityIssueID
 TEXT_FORMATTING,
 HYPERLINK_IS_TEXT,
 HYPERLINK_SHORT,
+FAKE_FOOTNOTE,
 };
 
 class SFX2_DLLPUBLIC AccessibilityIssue
diff --git a/sw/inc/AccessibilityCheckStrings.hrc 
b/sw/inc/AccessibilityCheckStrings.hrc
index 77b93378869f..86be8b494c90 100644
--- a/sw/inc/AccessibilityCheckStrings.hrc
+++ b/sw/inc/AccessibilityCheckStrings.hrc
@@ -21,6 +21,7 @@
 #define STR_TEXT_CONTRAST   NC_("STR_TEXT_CONTRAST", "Text 
contrast is too low.")
 #define STR_TEXT_BLINKING   NC_("STR_TEXT_BLINKING", "Blinking 
text.")
 #define STR_AVOID_FOOTNOTES NC_("STR_AVOID_FOOTNOTES", "Avoid 
footnotes.")
+#define STR_AVOID_FAKE_FOOTNOTESNC_("STR_AVOID_FAKE_FOOTNOTES", "Avoid 
fake footnotes.")
 #define STR_AVOID_ENDNOTES  NC_("STR_AVOID_ENDNOTES", "Avoid 
endnotes.")
 #define STR_AVOID_BACKGROUND_IMAGES NC_("STR_AVOID_BACKGROUND_IMAGES", 
"Avoid background images.")
 #define STR_AVOID_NEWLINES_SPACENC_("STR_AVOID_NEWLINES_SPACE", "Avoid 
newlines to create space.")
diff --git a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx 
b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
index ee9ef7491f6a..43994aab8177 100644
--- a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
+++ b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
@@ -118,6 +118,18 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, 
testCheckHighlightedText)
 CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[0]->m_eIssueID);
 }
 
+CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckFakeFootnote)
+{
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "FakeFootnoteTest.odt");
+CPPUNIT_ASSERT(pDoc);
+sw::AccessibilityCheck aCheck(pDoc);
+aCheck.check();
+auto& aIssues = aCheck.getIssueCollection().getIssues();
+CPPUNIT_ASSERT_EQUAL(size_t(2), aIssues.size());
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::FAKE_FOOTNOTE, 
aIssues[0]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::FAKE_FOOTNOTE, 
aIssues[1]->m_eIssueID);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/accessibilitycheck/data/FakeFootnoteTest.odt 
b/sw/qa/core/accessibilitycheck/data/FakeFootnoteTest.odt
new file mode 100644
index ..fdacf6cb35de
Binary files /dev/null and 
b/sw/qa/core/accessibilitycheck/data/FakeFootnoteTest.odt differ
diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 3e6e30468572..5d3cc30f4e20 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -750,6 +751,76 @@ public:
 }
 };
 
+class FakeFootnoteCheck : public NodeCheck
+{
+private:
+void checkAutoFormat(SwTextNode* pTextNode, const SwTextAttr* pTextAttr)
+{
+const SwFormatAutoFormat& rAutoFormat = pTextAttr->GetAutoFormat();
+SfxItemIter aItemIter(*rAutoFormat.GetStyleHandle());
+const SfxPoolItem* pItem = aItemIter.GetCurItem();
+while (pItem)
+{
+if (pItem->Which() == RES_CHRATR_ESCAPEMENT)
+{
+auto pEscapementItem = static_cast(pItem);
+if (pEscapementItem->GetEscapement() == 
SvxEscapement::Superscript
+&& pTextAttr->GetStart() == 0 && pTextAttr->GetAnyEnd() == 
1)
+{
+auto pIssue = lclAddIssue(m_rIssueCollection, 
SwResId(STR_AVOID_FAKE_FOOTNOTES),
+  
sfx::AccessibilityIssueID::FAKE_FOOTNOTE);
+

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - 2 commits - include/sfx2 sw/inc sw/qa sw/source

2022-11-22 Thread Paris Oplopoios (via logerrit)
 include/sfx2/AccessibilityIssue.hxx  |2 
 sw/inc/AccessibilityCheckStrings.hrc |1 
 sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx |   23 ++
 sw/qa/core/accessibilitycheck/data/HighlightTest.odt |binary
 sw/qa/core/accessibilitycheck/data/HyperlinkTest.odt |binary
 sw/source/core/access/AccessibilityCheck.cxx |   50 ---
 6 files changed, 67 insertions(+), 9 deletions(-)

New commits:
commit a331ed90b3b01aa2c96de288494d0e88533216ab
Author: Paris Oplopoios 
AuthorDate: Mon Oct 17 19:32:47 2022 +0300
Commit: Tomaž Vajngerl 
CommitDate: Tue Nov 22 09:53:35 2022 +0100

a11y: Add check for highlighted text

Add accessibility check and relevant test for a document that has
highlighted text

Change-Id: Ia4303215d9ba3eaf583b38bb5ab33f01370f1607
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141469
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141794
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx 
b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
index a64f84d6530b..ee9ef7491f6a 100644
--- a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
+++ b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
@@ -107,6 +107,17 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, 
testHyperlinks)
 CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::HYPERLINK_IS_TEXT, 
aIssues[1]->m_eIssueID);
 }
 
+CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckHighlightedText)
+{
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "HighlightTest.odt");
+CPPUNIT_ASSERT(pDoc);
+sw::AccessibilityCheck aCheck(pDoc);
+aCheck.check();
+auto& aIssues = aCheck.getIssueCollection().getIssues();
+CPPUNIT_ASSERT_EQUAL(size_t(1), aIssues.size());
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[0]->m_eIssueID);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/accessibilitycheck/data/HighlightTest.odt 
b/sw/qa/core/accessibilitycheck/data/HighlightTest.odt
new file mode 100644
index ..da4821681502
Binary files /dev/null and 
b/sw/qa/core/accessibilitycheck/data/HighlightTest.odt differ
diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 554f3bcd39de..3e6e30468572 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -356,8 +356,8 @@ class TextContrastCheck : public NodeCheck
 {
 private:
 void checkTextRange(uno::Reference const& xTextRange,
-uno::Reference const& xParagraph,
-const SwTextNode* pTextNode)
+uno::Reference const& xParagraph, 
SwTextNode* pTextNode,
+sal_Int32 nTextStart)
 {
 Color nParaBackColor(COL_AUTO);
 uno::Reference xParagraphProperties(xParagraph, 
uno::UNO_QUERY);
@@ -378,9 +378,6 @@ private:
 SAL_WARN("sw.a11y", "CharColor void");
 return;
 }
-Color aForegroundColor(ColorTransparency, nCharColor);
-if (aForegroundColor == COL_AUTO)
-return;
 
 const SwPageDesc* pPageDescription = pTextNode->FindPageDesc();
 const SwFrameFormat& rPageFormat = pPageDescription->GetMaster();
@@ -411,6 +408,22 @@ private:
 // If not character background color, try paragraph background color
 if (aBackgroundColor == COL_AUTO)
 aBackgroundColor = nParaBackColor;
+else
+{
+auto pIssue
+= lclAddIssue(m_rIssueCollection, 
SwResId(STR_TEXT_FORMATTING_CONVEYS_MEANING),
+  sfx::AccessibilityIssueID::TEXT_FORMATTING);
+pIssue->setIssueObject(IssueObject::TEXT);
+pIssue->setNode(pTextNode);
+SwDoc& rDocument = pTextNode->GetDoc();
+pIssue->setDoc(rDocument);
+pIssue->setStart(nTextStart);
+pIssue->setEnd(nTextStart + xTextRange->getString().getLength());
+}
+
+Color aForegroundColor(ColorTransparency, nCharColor);
+if (aForegroundColor == COL_AUTO)
+return;
 
 // If not paragraph background color, try page color
 if (aBackgroundColor == COL_AUTO)
@@ -446,11 +459,15 @@ public:
 
 uno::Reference 
xRunEnumAccess(xParagraph, uno::UNO_QUERY);
 uno::Reference xRunEnum = 
xRunEnumAccess->createEnumeration();
+sal_Int32 nStart = 0;
 while (xRunEnum->hasMoreElements())
 {
 uno::Reference xRun(xRunEnum->nextElement(), 
uno::UNO_QUERY);
 if (xRun.is())
-checkTextRange(xRun, xParagraph, pTextNode);
+{
+checkTextRange(xRun, xParagraph, 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sw/inc sw/qa sw/source

2022-11-22 Thread Paris Oplopoios (via logerrit)
 sw/inc/AccessibilityCheckStrings.hrc   |1 
 sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx   |   12 +
 sw/qa/core/accessibilitycheck/data/AccessibilityTests1.odt |binary
 sw/qa/core/accessibilitycheck/data/NewlineTest.odt |binary
 sw/source/core/access/AccessibilityCheck.cxx   |   87 +
 5 files changed, 100 insertions(+)

New commits:
commit 6ea694f14ebdd552be59e50483232415d6c2c067
Author: Paris Oplopoios 
AuthorDate: Mon Oct 17 12:37:30 2022 +0300
Commit: Tomaž Vajngerl 
CommitDate: Tue Nov 22 09:52:37 2022 +0100

a11y: Add check for spacing newlines

Add accessibility check and relevant test for a document that uses
newlines for spacing

Change-Id: I14f14db5c51cbad1ee184e58eec8ff28563ba92a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141715
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tomaž Vajngerl 

diff --git a/sw/inc/AccessibilityCheckStrings.hrc 
b/sw/inc/AccessibilityCheckStrings.hrc
index 858de1a47d93..4d65bd095f51 100644
--- a/sw/inc/AccessibilityCheckStrings.hrc
+++ b/sw/inc/AccessibilityCheckStrings.hrc
@@ -22,6 +22,7 @@
 #define STR_AVOID_FOOTNOTES NC_("STR_AVOID_FOOTNOTES", "Avoid 
footnotes.")
 #define STR_AVOID_ENDNOTES  NC_("STR_AVOID_ENDNOTES", "Avoid 
endnotes.")
 #define STR_AVOID_BACKGROUND_IMAGES NC_("STR_AVOID_BACKGROUND_IMAGES", 
"Avoid background images.")
+#define STR_AVOID_NEWLINES_SPACENC_("STR_AVOID_NEWLINES_SPACE", "Avoid 
newlines to create space.")
 #define STR_HEADINGS_NOT_IN_ORDER   NC_("STR_HEADINGS_NOT_IN_ORDER", 
"Headings not in order.")
 #define STR_TEXT_FORMATTING_CONVEYS_MEANING 
NC_("STR_TEXT_FORMATTING_CONVEYS_MEANING", "The text formatting conveys 
additional meaning.")
 #define STR_NON_INTERACTIVE_FORMS   NC_("STR_NON_INTERACTIVE_FORMS", "An 
input form is not interactive.")
diff --git a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx 
b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
index 92a5ea3929e1..c04aadae4d94 100644
--- a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
+++ b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
@@ -72,6 +72,18 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, 
testCheckBackgroundImage)
 CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DOCUMENT_BACKGROUND, 
aIssues[0]->m_eIssueID);
 }
 
+CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckNewlineSpace)
+{
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "NewlineTest.odt");
+CPPUNIT_ASSERT(pDoc);
+sw::AccessibilityCheck aCheck(pDoc);
+aCheck.check();
+auto& aIssues = aCheck.getIssueCollection().getIssues();
+CPPUNIT_ASSERT_EQUAL(size_t(2), aIssues.size());
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[0]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[1]->m_eIssueID);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/accessibilitycheck/data/AccessibilityTests1.odt 
b/sw/qa/core/accessibilitycheck/data/AccessibilityTests1.odt
index 2e319f58e7a2..6b55335e773d 100644
Binary files a/sw/qa/core/accessibilitycheck/data/AccessibilityTests1.odt and 
b/sw/qa/core/accessibilitycheck/data/AccessibilityTests1.odt differ
diff --git a/sw/qa/core/accessibilitycheck/data/NewlineTest.odt 
b/sw/qa/core/accessibilitycheck/data/NewlineTest.odt
new file mode 100644
index ..9ff715916fc2
Binary files /dev/null and b/sw/qa/core/accessibilitycheck/data/NewlineTest.odt 
differ
diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 0013f6b2eb0e..fdc849e518b6 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -584,6 +584,92 @@ public:
 }
 };
 
+class NewlineSpacingCheck : public NodeCheck
+{
+private:
+static SwTextNode* getNextTextNode(SwNode* pCurrent)
+{
+SwTextNode* pTextNode = nullptr;
+
+auto nIndex = pCurrent->GetIndex();
+auto nCount = pCurrent->GetNodes().Count();
+
+nIndex++; // go to next node
+
+while (pTextNode == nullptr && nIndex < nCount)
+{
+auto pNode = pCurrent->GetNodes()[nIndex];
+if (pNode->IsTextNode())
+pTextNode = pNode->GetTextNode();
+nIndex++;
+}
+
+return pTextNode;
+}
+
+public:
+NewlineSpacingCheck(sfx::AccessibilityIssueCollection& rIssueCollection)
+: NodeCheck(rIssueCollection)
+{
+}
+void check(SwNode* pCurrent) override
+{
+if (!pCurrent->IsTextNode())
+return;
+
+SwTextNode* pTextNode = pCurrent->GetTextNode();
+auto nParagraphLength = pTextNode->GetText().getLength();
+if (nParagraphLength == 0)
+{
+SwTextNode* pNextTextNode = getNextTextNode(pCurrent);
+ 

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

2022-11-09 Thread Paris Oplopoios (via logerrit)
 sw/inc/AccessibilityCheckStrings.hrc |1 
 sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx |   14 +++
 sw/qa/core/accessibilitycheck/data/TabsTest.odt  |binary
 sw/source/core/access/AccessibilityCheck.cxx |   68 ++-
 4 files changed, 64 insertions(+), 19 deletions(-)

New commits:
commit 3c0be5564afe1b9cc843a49aba88b72af74c43ab
Author: Paris Oplopoios 
AuthorDate: Mon Oct 24 14:12:44 2022 +0300
Commit: Tomaž Vajngerl 
CommitDate: Wed Nov 9 23:54:58 2022 +0100

a11y: Add check for tabs used for formatting

Add accessibility check and relevant test for a document that uses
tabs for formatting

Useful to detect fake tables made of tabs

Change-Id: Ief765f25c8dc67405d0671e257cf0ba7aec9f16c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141732
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sw/inc/AccessibilityCheckStrings.hrc 
b/sw/inc/AccessibilityCheckStrings.hrc
index 7245a2b8d3e0..baa61cbcb8ba 100644
--- a/sw/inc/AccessibilityCheckStrings.hrc
+++ b/sw/inc/AccessibilityCheckStrings.hrc
@@ -27,6 +27,7 @@
 #define STR_AVOID_BACKGROUND_IMAGES NC_("STR_AVOID_BACKGROUND_IMAGES", 
"Avoid background images.")
 #define STR_AVOID_NEWLINES_SPACENC_("STR_AVOID_NEWLINES_SPACE", "Avoid 
newlines to create space.")
 #define STR_AVOID_SPACES_SPACE  NC_("STR_AVOID_SPACES_SPACE", "Avoid 
spaces to create space.")
+#define STR_AVOID_TABS_FORMATTING   NC_("STR_AVOID_TABS_FORMATTING", 
"Avoid using tabs for formatting.")
 #define STR_HEADINGS_NOT_IN_ORDER   NC_("STR_HEADINGS_NOT_IN_ORDER", 
"Headings not in order.")
 #define STR_TEXT_FORMATTING_CONVEYS_MEANING 
NC_("STR_TEXT_FORMATTING_CONVEYS_MEANING", "The text formatting conveys 
additional meaning.")
 #define STR_NON_INTERACTIVE_FORMS   NC_("STR_NON_INTERACTIVE_FORMS", "An 
input form is not interactive.")
diff --git a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx 
b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
index cc8b3742be74..9397832bebf5 100644
--- a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
+++ b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
@@ -168,6 +168,20 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, 
testCheckTableFormatting)
 CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TABLE_FORMATTING, 
aIssues[0]->m_eIssueID);
 }
 
+CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckTabsFormatting)
+{
+SwDoc* pDoc = createSwDoc("TabsTest.odt");
+CPPUNIT_ASSERT(pDoc);
+sw::AccessibilityCheck aCheck(pDoc);
+aCheck.check();
+auto& aIssues = aCheck.getIssueCollection().getIssues();
+CPPUNIT_ASSERT_EQUAL(size_t(4), aIssues.size());
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[0]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[1]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[2]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[3]->m_eIssueID);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/accessibilitycheck/data/TabsTest.odt 
b/sw/qa/core/accessibilitycheck/data/TabsTest.odt
new file mode 100644
index ..29b415df87a7
Binary files /dev/null and b/sw/qa/core/accessibilitycheck/data/TabsTest.odt 
differ
diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index ce0409d6ba5b..897ee0d43c58 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -791,33 +791,63 @@ public:
 const OUString& sParagraphText = pTextNode->GetText();
 sal_Int32 nSpaceCount = 0;
 sal_Int32 nSpaceStart = 0;
+sal_Int32 nTabCount = 0;
 bool bNonSpaceFound = false;
+bool bPreviousWasChar = false;
 for (sal_Int32 i = 0; i < nParagraphLength; i++)
 {
-if (sParagraphText[i] == ' ')
+switch (sParagraphText[i])
 {
-if (bNonSpaceFound)
+case ' ':
 {
-nSpaceCount++;
-if (nSpaceCount == 2)
-nSpaceStart = i;
+if (bNonSpaceFound)
+{
+nSpaceCount++;
+if (nSpaceCount == 2)
+nSpaceStart = i;
+}
+break;
 }
-}
-else
-{
-if (nSpaceCount >= 2)
+case '\t':
 {
-auto pIssue = lclAddIssue(m_rIssueCollection, 
SwResId(STR_AVOID_SPACES_SPACE),
-  
sfx::AccessibilityIssueID::TEXT_FORMATTING);
-

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

2022-11-09 Thread Paris Oplopoios (via logerrit)
 sc/source/filter/excel/xestream.cxx |   11 +++
 1 file changed, 11 insertions(+)

New commits:
commit 95cb9a01bfacf7d9f03194b0710ca3c249bb62fb
Author: Paris Oplopoios 
AuthorDate: Wed Nov 9 13:43:46 2022 +0200
Commit: Jan Holesovsky 
CommitDate: Wed Nov 9 16:01:13 2022 +0100

Get ScViewData through the current doc shell in headless mode

When using --convert-to, ScDocShell::GetViewData() would return nullptr
so we now get the ScViewData through an alternative route.

Change-Id: Ie71a4a1077b3c63c0aadd394fc0d966e679e8803
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142480
Tested-by: Jenkins
Reviewed-by: Jan Holesovsky 

diff --git a/sc/source/filter/excel/xestream.cxx 
b/sc/source/filter/excel/xestream.cxx
index 0ee697dfeba8..33e6fa2a8838 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -56,6 +56,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -1050,6 +1051,16 @@ bool XclExpXmlStream::exportDocument()
 // Get the viewsettings before processing
 if( ScDocShell::GetViewData() )
 ScDocShell::GetViewData()->WriteExtOptions( mpRoot->GetExtDocOptions() 
);
+else
+{
+// Try to get ScViewData through the current ScDocShell
+ScTabViewShell* pTabViewShell = pShell->GetBestViewShell( false );
+if ( pTabViewShell )
+{
+ScViewData* pViewData = >GetViewData();
+pViewData->WriteExtOptions( mpRoot->GetExtDocOptions() );
+}
+}
 
 OUString const workbook = "xl/workbook.xml";
 const char* pWorkbookContentType = nullptr;


  1   2   >