core.git: Branch 'distro/collabora/co-24.04' - sd/uiconfig

2024-10-01 Thread Szymon Kłos (via logerrit)
 sd/uiconfig/simpress/ui/slidetransitionspanel.ui |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 025e089c08c1224b3bf4e7f21786b828a4c26d4f
Author: Szymon Kłos 
AuthorDate: Tue Oct 1 18:10:05 2024 +0200
Commit: Szymon Kłos 
CommitDate: Wed Oct 2 07:53:50 2024 +0200

sidebar: move apply to all slides above repeat settings

Button "apply to all slides" setups properties selected above
to all the slides. Repeat options are common to the whole
presentation. Let's move repeat section to the bottom so it
is less confusing

Signed-off-by: Szymon Kłos 
Change-Id: I19bb8d10c3969ceb033e2a6d2648bb7451c9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174357
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: vivek javiya 

diff --git a/sd/uiconfig/simpress/ui/slidetransitionspanel.ui 
b/sd/uiconfig/simpress/ui/slidetransitionspanel.ui
index fc2704ef4e40..e597c322d9f9 100644
--- a/sd/uiconfig/simpress/ui/slidetransitionspanel.ui
+++ b/sd/uiconfig/simpress/ui/slidetransitionspanel.ui
@@ -429,7 +429,7 @@
   
 False
 True
-3
+4
   
 
 
@@ -539,7 +539,7 @@
   
 False
 True
-4
+3
   
 
   


core.git: Branch 'distro/collabora/co-24.04' - sw/inc sw/source

2024-10-01 Thread Szymon Kłos (via logerrit)
 sw/inc/crsrsh.hxx  |1 -
 sw/source/core/crsr/crsrsh.cxx |7 ---
 sw/source/core/crsr/viscrs.cxx |2 +-
 3 files changed, 1 insertion(+), 9 deletions(-)

New commits:
commit 8da753752898984425c98a7f3db02b1aa69b74c8
Author: Szymon Kłos 
AuthorDate: Tue Oct 1 13:53:49 2024 +0200
Commit: Szymon Kłos 
CommitDate: Tue Oct 1 14:07:11 2024 +0200

Revert "Prevent cursor invalidation if the cursor position doesn't change."

This reverts commit 6a2071cafae41afdfde56b07817d8674482431f6.

Reason for revert: This was causing cypress fails on the online side
eg. `make -C cypress_test check-desktop spec=writer/table_operation_spec.js`

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

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 5cf244aa6b4e..97248572c762 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -237,7 +237,6 @@ private:
 bool m_bBasicHideCursor : 1;// true -> HideCursor from Basic
 bool m_bSetCursorInReadOnly : 1;// true -> Cursor is allowed in 
ReadOnly-Areas
 bool m_bOverwriteCursor : 1;// true -> show Overwrite Cursor
-bool m_bIsCursorPosChanged : 1;// true -> if the cursor position is 
changed last cursor update
 
 // true -> send accessible events when cursor changes
 // (set to false when using internal-only helper cursor)
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index c8462c71a7cc..20e32e66c255 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -1921,7 +1921,6 @@ class SwNotifyAccAboutInvalidTextSelections
 
 void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd )
 {
-Point nOldPos = m_pCurrentCursor->GetPtPos();
 CurrShell aCurr( this );
 ClearUpCursors();
 
@@ -2416,10 +2415,6 @@ void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, 
bool bIdleEnd )
 GetOut()->SetSettings( aSettings );
 }
 
-// Do not notify the cursor if the position didn't change
-Point nNewPos = m_pCurrentCursor->GetPtPos();
-m_bIsCursorPosChanged = nOldPos != nNewPos;
-
 if( m_bSVCursorVis )
 m_pVisibleCursor->Show(); // show again
 
@@ -2427,7 +2422,6 @@ void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool 
bIdleEnd )
 sendLOKCursorUpdates();
 
 getIDocumentMarkAccess()->NotifyCursorUpdate(*this);
-m_bIsCursorPosChanged = false; // reset to default
 }
 
 void SwCursorShell::sendLOKCursorUpdates()
@@ -3346,7 +3340,6 @@ SwCursorShell::SwCursorShell( SwCursorShell& rShell, 
vcl::Window *pInitWin )
 m_bAllProtect = m_bVisPortChgd = m_bChgCallFlag = m_bInCMvVisportChgd =
 m_bGCAttr = m_bIgnoreReadonly = m_bSelTableCells = m_bBasicHideCursor =
 m_bOverwriteCursor = false;
-m_bIsCursorPosChanged = false;
 m_bSendAccessibleCursorEvents = true;
 m_bCallChgLnk = m_bHasFocus = m_bAutoUpdateCells = true;
 m_bSVCursorVis = true;
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index a61d17c84624..3224893d81bb 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -247,7 +247,7 @@ void SwVisibleCursor::SetPosAndShow(SfxViewShell const * 
pViewShell)
 LOK_CALLBACK_INVALIDATE_VIEW_CURSOR);
 }
 }
-else if (m_pCursorShell->m_bIsCursorPosChanged)
+else
 {
 
SfxLokHelper::notifyUpdatePerViewId(m_pCursorShell->GetSfxViewShell(), 
SfxViewShell::Current(),
 m_pCursorShell->GetSfxViewShell(), 
LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR);


core.git: Branch 'distro/collabora/co-24.04' - include/animations sd/source

2024-09-13 Thread Szymon Kłos (via logerrit)
 include/animations/animationnodehelper.hxx|   59 ++
 sd/source/ui/inc/SlideshowLayerRenderer.hxx   |1 
 sd/source/ui/tools/SlideshowLayerRenderer.cxx |   10 +++-
 sd/source/ui/unoidl/unomodel.cxx  |   59 ++
 4 files changed, 74 insertions(+), 55 deletions(-)

New commits:
commit 44fea573fec5a415d0488b760c133afe3aabb562
Author: Szymon Kłos 
AuthorDate: Thu Sep 12 11:22:10 2024 +0200
Commit: Tomaž Vajngerl 
CommitDate: Fri Sep 13 11:20:17 2024 +0200

slideshow: use unified hash for animations and layers

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

diff --git a/include/animations/animationnodehelper.hxx 
b/include/animations/animationnodehelper.hxx
index 5c03e2341294..3da2e8fa2d39 100644
--- a/include/animations/animationnodehelper.hxx
+++ b/include/animations/animationnodehelper.hxx
@@ -20,12 +20,18 @@
 #ifndef INCLUDED_ANIMATIONS_ANIMATIONNODEHELPER_HXX
 #define INCLUDED_ANIMATIONS_ANIMATIONNODEHELPER_HXX
 
+#include 
+#include 
+#include 
+#include 
+
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -109,6 +115,59 @@ namespace anim
 
 return false;
 }
+
+inline css::uno::Reference getParagraphTarget(
+const css::presentation::ParagraphTarget& pTarget)
+{
+try
+{
+css::uno::Reference 
xParaEnumAccess(
+pTarget.Shape, css::uno::UNO_QUERY_THROW);
+
+css::uno::Reference xEnumeration(
+
xParaEnumAccess->createEnumeration(),
+css::uno::UNO_SET_THROW);
+sal_Int32 nParagraph = pTarget.Paragraph;
+
+while (xEnumeration->hasMoreElements())
+{
+css::uno::Reference xRef(
+xEnumeration->nextElement(), css::uno::UNO_QUERY);
+if (nParagraph-- == 0)
+return xRef;
+}
+}
+catch (const css::uno::RuntimeException&)
+{
+SAL_WARN("animations", "getParagraphTarget");
+}
+
+css::uno::Reference xRef;
+return xRef;
+}
+
+inline void convertTarget(OStringBuffer& sTmp, const css::uno::Any& 
rTarget)
+{
+if (!rTarget.hasValue())
+return;
+
+css::uno::Reference xRef;
+if (!(rTarget >>= xRef))
+{
+if (auto pt = 
o3tl::tryAccess(rTarget))
+{
+xRef = getParagraphTarget(*pt);
+}
+}
+
+SAL_WARN_IF(!xRef.is(), "animations", "convertTarget(), invalid target 
type!");
+if (xRef.is())
+{
+const std::string& rIdentifier(GetInterfaceHash(xRef));
+if (!rIdentifier.empty())
+sTmp.append(rIdentifier);
+}
+}
 }
 
 #endif /* INCLUDED_ANIMATIONS_ANIMATIONNODEHELPER_HXX */
diff --git a/sd/source/ui/inc/SlideshowLayerRenderer.hxx 
b/sd/source/ui/inc/SlideshowLayerRenderer.hxx
index 529eba5ed8ed..e75e6ed40f89 100644
--- a/sd/source/ui/inc/SlideshowLayerRenderer.hxx
+++ b/sd/source/ui/inc/SlideshowLayerRenderer.hxx
@@ -48,6 +48,7 @@ struct RenderState
 
 std::unordered_set maObjectsDone;
 std::unordered_set maInAnimation;
+std::map maAnimationTargetHash;
 std::map maInitiallyVisible;
 sal_Int32 mnIndex[static_cast(RenderStage::Count)] = { 0, 0, 0, 
0 };
 SdrObject* mpCurrentTarget = nullptr;
diff --git a/sd/source/ui/tools/SlideshowLayerRenderer.cxx 
b/sd/source/ui/tools/SlideshowLayerRenderer.cxx
index 37609858075b..803801a5436e 100644
--- a/sd/source/ui/tools/SlideshowLayerRenderer.cxx
+++ b/sd/source/ui/tools/SlideshowLayerRenderer.cxx
@@ -292,6 +292,14 @@ void SlideshowLayerRenderer::setupAnimations()
 
 maRenderState.maInitiallyVisible[pObject] = 
bVisible;
 }
+
+if (aAny.hasValue())
+{
+OStringBuffer sTmp;
+anim::convertTarget(sTmp, aAny);
+maRenderState.maAnimationTargetHash[pObject]
+= static_cast(sTmp);
+}
 }
 }
 }
@@ -363,7 +371,7 @@ void SlideshowLayerRenderer::writeJSON(OString& rJsonMsg)
 aJsonWriter.put("type", "animated");
 {
 ::tools::ScopedJsonWriterNode aContentNode = 
aJsonWriter.startNode("content");
-aJsonWriter.put("hash", RenderState::getObjectHash(pObject));
+aJsonWriter.put("hash", 
maRenderState.maAnimationTargetHash.at(pObje

core.git: Branch 'distro/collabora/co-24.04' - sd/qa sd/source

2024-09-11 Thread Szymon Kłos (via logerrit)
 sd/qa/unit/tiledrendering/tiledrendering.cxx |9 +++--
 sd/source/ui/unoidl/unomodel.cxx |   10 +-
 2 files changed, 16 insertions(+), 3 deletions(-)

New commits:
commit aede1fbb77db2463bdacaf731311cd7cbb045ed5
Author: Szymon Kłos 
AuthorDate: Wed Sep 11 17:17:23 2024 +0200
Commit: Szymon Kłos 
CommitDate: Wed Sep 11 19:36:56 2024 +0200

slideshow: lok: export hiden slide

we need to be aware of hidden slides to make correct
decision when doing "start from current slide" based
on the slide number

Signed-off-by: Szymon Kłos 
Change-Id: Ib4944c699fa2589026e4d8ae57766c83e0439d49
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173218
Tested-by: Jenkins CollaboraOffice 

diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index f63064fdf835..42a7a2fa2aad 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -3124,7 +3124,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testPresentationInfo)
 CPPUNIT_ASSERT_EQUAL(15875, aTree.get_child("docWidth").get_value());
 CPPUNIT_ASSERT_EQUAL(8930,  aTree.get_child("docHeight").get_value());
 
-CPPUNIT_ASSERT_EQUAL(size_t(4),  aTree.get_child("slides").size());
+CPPUNIT_ASSERT_EQUAL(size_t(5),  aTree.get_child("slides").size());
 
 // Slide Index 0
 {
@@ -3176,10 +3176,15 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testPresentationInfo)
 }
 
 // Slide Index 3 - Hidden
+{
+const boost::property_tree::ptree& rChild = child_at(aTree, "slides", 
3);
+CPPUNIT_ASSERT_EQUAL(3, rChild.get_child("index").get_value());
+CPPUNIT_ASSERT_EQUAL(true, 
rChild.get_child("hidden").get_value());
+}
 
 // Slide Index 4
 {
-const boost::property_tree::ptree& rChild = child_at(aTree, "slides", 
3);
+const boost::property_tree::ptree& rChild = child_at(aTree, "slides", 
4);
 CPPUNIT_ASSERT_EQUAL(4, rChild.get_child("index").get_value());
 CPPUNIT_ASSERT_EQUAL(false, 
rChild.get_child("empty").get_value());
 // Check only that these exist
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 2fdf3ec3ab4b..6658bbbc5da0 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -4350,7 +4350,15 @@ OString SdXImpressDocument::getPresentationInfo() const
 {
 bool bIsVisible = true; // default visible
 xPropSet->getPropertyValue("Visible") >>= bIsVisible;
-if (bIsVisible)
+if (!bIsVisible)
+{
+::tools::ScopedJsonWriterStruct aSlideNode = 
aJsonWriter.startStruct();
+std::string sSlideHash = GetInterfaceHash(xSlide);
+aJsonWriter.put("hash", sSlideHash);
+aJsonWriter.put("index", i);
+aJsonWriter.put("hidden", true);
+}
+else
 {
 SdrPage* pPage = SdPage::getImplementation(xSlide);
 


core.git: Branch 'distro/collabora/co-24.04' - sd/source

2024-09-11 Thread Szymon Kłos (via logerrit)
 sd/source/ui/tools/SlideshowLayerRenderer.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 294b9a04e5482a58a0744cbea5b629f7c1734562
Author: Szymon Kłos 
AuthorDate: Wed Sep 11 09:13:59 2024 +0200
Commit: Tomaž Vajngerl 
CommitDate: Wed Sep 11 12:23:03 2024 +0200

slideshow: export isField property for layers

this is temporary fix for caching the old values in
the text fields like page number. to be removed, we
need separate layers with awareness of fields

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

diff --git a/sd/source/ui/tools/SlideshowLayerRenderer.cxx 
b/sd/source/ui/tools/SlideshowLayerRenderer.cxx
index 97662acb87a0..37609858075b 100644
--- a/sd/source/ui/tools/SlideshowLayerRenderer.cxx
+++ b/sd/source/ui/tools/SlideshowLayerRenderer.cxx
@@ -372,6 +372,8 @@ void SlideshowLayerRenderer::writeJSON(OString& rJsonMsg)
 }
 else
 {
+if (pObject && hasFields(pObject))
+aJsonWriter.put("isField", true); // TODO: to be removed, 
implement properly
 aJsonWriter.put("type", "bitmap");
 writeContentNode(aJsonWriter);
 }


core.git: Branch 'distro/collabora/co-24.04' - sd/qa sd/source

2024-09-10 Thread Szymon Kłos (via logerrit)
 sd/qa/unit/tiledrendering/tiledrendering.cxx  |7 +++
 sd/source/ui/tools/SlideshowLayerRenderer.cxx |   11 +++
 2 files changed, 18 insertions(+)

New commits:
commit 791c5f20dc62b962f370c5a83f97caf0a9b18c49
Author: Szymon Kłos 
AuthorDate: Tue Sep 10 09:56:54 2024 +0200
Commit: Tomaž Vajngerl 
CommitDate: Tue Sep 10 11:09:52 2024 +0200

slideshow: lok: export bounds for animated layers

Signed-off-by: Szymon Kłos 
Change-Id: Iccc0993fd9736842fc3e9783306d21aabc813e5f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173121
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tomaž Vajngerl 

diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 5d6f55143980..f63064fdf835 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -3508,6 +3508,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering_Animati
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 0") >= 0);
 CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"hash\""));
 CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"initVisible\""));
+CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"bounds\""));
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"content\": { \"type\": 
\"%IMAGETYPE%\", \"checksum\": \"%IMAGECHECKSUM%\"}") >= 0);
 
@@ -3523,6 +3524,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering_Animati
 
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"MasterPage\"") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 0") >= 0);
+CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"bounds\""));
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
 
 debugWriteImageToFile(1, pBuffer, nViewWidth, nViewHeight, 
rJsonMsg.toUtf8().getStr());
@@ -3537,6 +3539,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering_Animati
 
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"MasterPage\"") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 1") >= 0);
+CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"bounds\""));
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
 
 debugWriteImageToFile(2, pBuffer, nViewWidth, nViewHeight, 
rJsonMsg.toUtf8().getStr());
@@ -3552,6 +3555,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering_Animati
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 0") >= 0);
 CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"initVisible\""));
+CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"bounds\""));
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
 
 debugWriteImageToFile(3, pBuffer, nViewWidth, nViewHeight, 
rJsonMsg.toUtf8().getStr());
@@ -3583,6 +3587,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering_Animati
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 2") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": true") >= 0);
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"bounds\"") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
 
@@ -3599,6 +3604,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering_Animati
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 3") >= 0);
 CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"initVisible\""));
+CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"bounds\""));
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
 
 debugWriteImageToFile(6, pBuffer, nViewWidth, nViewHeight, 
rJsonMsg.toUtf8().getStr());
@@ -3614,6 +3620,7 @@ CPPUNIT_TEST_FIXTURE(Sd

core.git: Branch 'distro/collabora/co-24.04' - sd/qa sd/source

2024-09-10 Thread Szymon Kłos (via logerrit)
 sd/qa/unit/tiledrendering/tiledrendering.cxx  |   17 -
 sd/source/ui/tools/SlideshowLayerRenderer.cxx |6 +++---
 2 files changed, 19 insertions(+), 4 deletions(-)

New commits:
commit 610b6180e51dccc418912dbdc66db475adb57923
Author: Szymon Kłos 
AuthorDate: Tue Sep 10 06:29:39 2024 +0200
Commit: Tomaž Vajngerl 
CommitDate: Tue Sep 10 11:09:34 2024 +0200

slideshow: lok: correct z-order

we need to keep the order correct, especially
when we have stacked shapes which are animated
and some are non-animated.

in case:

non-anim
anim
non-anim
anim

don't allow to join non-animated layers into one

Signed-off-by: Szymon Kłos 
Change-Id: Ic5d94478b691a80fd62853946ebedec075963f44
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173116
Reviewed-by: Tomaž Vajngerl 
Tested-by: Jenkins CollaboraOffice 

diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index ada3b6582a65..5d6f55143980 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -3598,11 +3598,26 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering_Animati
 
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 3") >= 0);
+CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"initVisible\""));
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
+
+debugWriteImageToFile(6, pBuffer, nViewWidth, nViewHeight, 
rJsonMsg.toUtf8().getStr());
+}
+
+{
+std::vector pBuffer(nViewWidth * nViewHeight * 4);
+bool bIsBitmapLayer = false;
+OUString rJsonMsg;
+
CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), 
bIsBitmapLayer, rJsonMsg));
+CPPUNIT_ASSERT(bIsBitmapLayer);
+
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0);
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 4") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": false") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
 
-debugWriteImageToFile(6, pBuffer, nViewWidth, nViewHeight, 
rJsonMsg.toUtf8().getStr());
+debugWriteImageToFile(7, pBuffer, nViewWidth, nViewHeight, 
rJsonMsg.toUtf8().getStr());
 }
 
 {
diff --git a/sd/source/ui/tools/SlideshowLayerRenderer.cxx 
b/sd/source/ui/tools/SlideshowLayerRenderer.cxx
index 90d4b9868231..33349eacb0f5 100644
--- a/sd/source/ui/tools/SlideshowLayerRenderer.cxx
+++ b/sd/source/ui/tools/SlideshowLayerRenderer.cxx
@@ -166,12 +166,12 @@ public:
 
 if (mrRenderState.isObjectInAnimation(pObject))
 {
+// Animated object has to be only one in the render
+mrRenderState.mbSkipAllInThisPass = true;
+
 // Animated object cannot be attached to the previous object
 if (!mrRenderState.mbFirstObjectInPass)
 return;
-
-// Animated object has to be only one in the render
-mrRenderState.mbSkipAllInThisPass = true;
 }
 
 if (mrRenderState.meStage == RenderStage::Master && hasFields(pObject)


core.git: Branch 'distro/collabora/co-24.04' - include/animations sd/qa sd/source slideshow/source

2024-09-10 Thread Szymon Kłos (via logerrit)
 include/animations/animationnodehelper.hxx|9 +-
 sd/qa/unit/tiledrendering/tiledrendering.cxx  |4 -
 sd/source/ui/inc/SlideshowLayerRenderer.hxx   |   29 +++
 sd/source/ui/tools/SlideshowLayerRenderer.cxx |   56 --
 slideshow/source/engine/slide/targetpropertiescreator.cxx |3 
 5 files changed, 54 insertions(+), 47 deletions(-)

New commits:
commit c7623db05279d95b51381538b932f43dde1c5a9b
Author: Szymon Kłos 
AuthorDate: Mon Sep 9 23:40:05 2024 +0200
Commit: Tomaž Vajngerl 
CommitDate: Tue Sep 10 11:09:15 2024 +0200

slideshow: fix initVisible value

be sure we don't overwrite the real "visibility"
value when other property is read

Signed-off-by: Szymon Kłos 
Change-Id: Ied2285e8183665b5b48d10d74e1cc052cf8edcbe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173110
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/animations/animationnodehelper.hxx 
b/include/animations/animationnodehelper.hxx
index 9d978b76b552..5c03e2341294 100644
--- a/include/animations/animationnodehelper.hxx
+++ b/include/animations/animationnodehelper.hxx
@@ -75,12 +75,11 @@ namespace anim
 }
 
 inline bool getVisibilityProperty(
-const css::uno::Reference< css::animations::XAnimate >& xAnimateNode)
+const css::uno::Reference< css::animations::XAnimate >& xAnimateNode, 
bool& bReturn)
 {
-bool bVisible( false );
 if( 
xAnimateNode->getAttributeName().equalsIgnoreAsciiCase("visibility") )
 {
-
+bool bVisible( false );
 css::uno::Any aAny( xAnimateNode->getTo() );
 
 // try to extract bool value
@@ -104,9 +103,11 @@ namespace anim
 }
 }
 }
+bReturn = bVisible;
+return true;
 }
 
-return bVisible;
+return false;
 }
 }
 
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index d86220723f31..ada3b6582a65 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -3566,7 +3566,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering_Animati
 
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 1") >= 0);
-CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": true") >= 0);
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": false") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
 
@@ -3598,7 +3598,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering_Animati
 
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 3") >= 0);
-CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": true") >= 0);
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": false") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
 
diff --git a/sd/source/ui/inc/SlideshowLayerRenderer.hxx 
b/sd/source/ui/inc/SlideshowLayerRenderer.hxx
index 30a8e94b262d..529eba5ed8ed 100644
--- a/sd/source/ui/inc/SlideshowLayerRenderer.hxx
+++ b/sd/source/ui/inc/SlideshowLayerRenderer.hxx
@@ -9,9 +9,13 @@
 
 #pragma once
 
+#include 
+#include 
 #include 
+#include 
 #include 
-#include 
+#include 
+
 #include 
 #include 
 #include 
@@ -103,6 +107,29 @@ struct RenderState
 {
 return maInAnimation.find(pObject) != maInAnimation.end();
 }
+
+bool isObjectInitiallyVisible(SdrObject* pObject) const
+{
+bool bInitiallyVisible = true;
+if (maInitiallyVisible.contains(pObject))
+bInitiallyVisible = maInitiallyVisible.at(pObject);
+return bInitiallyVisible;
+}
+
+static std::string getObjectHash(SdrObject* pObject)
+{
+css::uno::Reference xShape = 
GetXShapeForSdrObject(pObject);
+if (xShape.is())
+{
+css::uno::Reference xRef;
+css::uno::Any(xShape) >>= xRef;
+if (xRef.is())
+return GetInterfaceHash(xRef);
+}
+
+SAL_WARN("sd", "RenderState::getObjectHash: failed");
+return std::string();
+}
 };
 
 /** Renders a slide

core.git: Branch 'distro/collabora/co-24.04' - sd/qa sd/source

2024-09-09 Thread Szymon Kłos (via logerrit)
 sd/qa/unit/tiledrendering/tiledrendering.cxx  |  139 +-
 sd/source/ui/tools/SlideshowLayerRenderer.cxx |8 +
 2 files changed, 142 insertions(+), 5 deletions(-)

New commits:
commit 798e1a5aabb09803b0322a3e2c29c2483b56aab9
Author: Szymon Kłos 
AuthorDate: Mon Sep 9 18:14:16 2024 +0200
Commit: Szymon Kłos 
CommitDate: Mon Sep 9 23:39:14 2024 +0200

lok: slideshow: render animated objects as separate layers

don't merge animated and non-animated objects on single
layer

Signed-off-by: Szymon Kłos 
Change-Id: I259507e08c95c3662e60f7691646395d1a840465
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173084
Tested-by: Jenkins CollaboraOffice 

diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index b84d0dbbf390..d86220723f31 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -3431,9 +3431,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering_Animati
 
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"MasterPage\"") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 1") >= 0);
-CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"hash\"") >= 0);
-CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": true") >= 0);
-CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0);
+CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"hash\""));
+CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"initVisible\""));
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"content\": { \"type\": 
\"%IMAGETYPE%\", \"checksum\": \"%IMAGECHECKSUM%\"}") >= 0);
 
 debugWriteImageToFile(2, pBuffer, nViewWidth, nViewHeight, 
rJsonMsg.toUtf8().getStr());
@@ -3450,6 +3450,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering_Animati
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 0") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"hash\"") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0);
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": true") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"content\": { \"type\": 
\"%IMAGETYPE%\", \"checksum\": \"%IMAGECHECKSUM%\"}") >= 0);
 
 debugWriteImageToFile(3, pBuffer, nViewWidth, nViewHeight, 
rJsonMsg.toUtf8().getStr());
@@ -3482,6 +3483,138 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering_Animati
 pXImpressDocument->postSlideshowCleanup();
 }
 
+CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering_Animations2)
+{
+SdXImpressDocument* pXImpressDocument = createDoc("anim.odp");
+
pXImpressDocument->initializeForTiledRendering(uno::Sequence());
+sd::ViewShell* pViewShell = 
pXImpressDocument->GetDocShell()->GetViewShell();
+CPPUNIT_ASSERT(pViewShell);
+SdPage* pPage = pViewShell->GetActualPage();
+CPPUNIT_ASSERT(pPage);
+sal_Int32 nViewWidth = 2000;
+sal_Int32 nViewHeight = 2000;
+CPPUNIT_ASSERT(pXImpressDocument->createSlideRenderer(0, nViewWidth, 
nViewHeight, true, true));
+CPPUNIT_ASSERT_EQUAL(2000, nViewWidth);
+CPPUNIT_ASSERT_EQUAL(1125, nViewHeight);
+
+{
+std::vector pBuffer(nViewWidth * nViewHeight * 4);
+bool bIsBitmapLayer = false;
+OUString rJsonMsg;
+
CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), 
bIsBitmapLayer, rJsonMsg));
+CPPUNIT_ASSERT(bIsBitmapLayer);
+
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"Background\"") >= 0);
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 0") >= 0);
+CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"hash\""));
+CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"initVisible\""));
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"content\": { \"type\": 
\"%IMAGETYPE%\", \"checksum\": \"%IMAGECHECKSUM%\"}") >= 0);
+
+debugWriteImageToFile(0, pBuffer, nViewWidth, nViewHeight, 
rJsonMsg.toUtf8().getStr());
+}
+
+{
+std::vector pBuffer(nViewWidth * nViewHeight * 4);
+bool bIsBitmapLayer = false;
+OUString r

core.git: Branch 'distro/collabora/co-24.04' - sd/qa sd/source

2024-09-09 Thread Szymon Kłos (via logerrit)
 sd/qa/unit/tiledrendering/data/anim.odp   |binary
 sd/qa/unit/tiledrendering/tiledrendering.cxx  |   35 ++
 sd/source/ui/inc/SlideshowLayerRenderer.hxx   |   35 +-
 sd/source/ui/tools/SlideshowLayerRenderer.cxx |   18 +
 4 files changed, 61 insertions(+), 27 deletions(-)

New commits:
commit d87e4e331b1d7a5a1b399281e74596f7ca313c4f
Author: Szymon Kłos 
AuthorDate: Mon Sep 9 17:34:03 2024 +0200
Commit: Marco Cecchetti 
CommitDate: Mon Sep 9 22:09:05 2024 +0200

lok: slideshow: render background as separate layer

we still take color from the JSON

Change-Id: I6b83cc83e9127d85ec06589bac7ed4472f71
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173083
Reviewed-by: Marco Cecchetti 
Tested-by: Jenkins CollaboraOffice 

diff --git a/sd/qa/unit/tiledrendering/data/anim.odp 
b/sd/qa/unit/tiledrendering/data/anim.odp
new file mode 100644
index ..b508d48f8a43
Binary files /dev/null and b/sd/qa/unit/tiledrendering/data/anim.odp differ
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index e2670232b9cc..b84d0dbbf390 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -3213,6 +3213,15 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering)
 CPPUNIT_ASSERT_EQUAL(1125, nViewHeight);
 
 const Color aTransparentColor(ColorAlpha, 0x);
+
+// Background Layer - TODO
+{
+std::vector pBuffer(nViewWidth * nViewHeight * 4);
+bool bIsBitmapLayer = false;
+OUString rJsonMsg;
+
CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), 
bIsBitmapLayer, rJsonMsg));
+}
+
 {
 std::vector pBuffer(nViewWidth * nViewHeight * 4);
 bool bIsBitmapLayer = false;
@@ -3283,6 +3292,15 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering_WithFie
 CPPUNIT_ASSERT_EQUAL(1125, nViewHeight);
 
 const Color aTransparentColor(ColorAlpha, 0x);
+
+// Background Layer - TODO
+{
+std::vector pBuffer(nViewWidth * nViewHeight * 4);
+bool bIsBitmapLayer = false;
+OUString rJsonMsg;
+
CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), 
bIsBitmapLayer, rJsonMsg));
+}
+
 {
 std::vector pBuffer(nViewWidth * nViewHeight * 4);
 bool bIsBitmapLayer = false;
@@ -3370,6 +3388,23 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering_Animati
 CPPUNIT_ASSERT_EQUAL(2000, nViewWidth);
 CPPUNIT_ASSERT_EQUAL(1125, nViewHeight);
 
+{
+std::vector pBuffer(nViewWidth * nViewHeight * 4);
+bool bIsBitmapLayer = false;
+OUString rJsonMsg;
+
CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), 
bIsBitmapLayer, rJsonMsg));
+CPPUNIT_ASSERT(bIsBitmapLayer);
+
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"Background\"") >= 0);
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 0") >= 0);
+CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"hash\""));
+CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"initVisible\""));
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"content\": { \"type\": 
\"%IMAGETYPE%\", \"checksum\": \"%IMAGECHECKSUM%\"}") >= 0);
+
+debugWriteImageToFile(0, pBuffer, nViewWidth, nViewHeight, 
rJsonMsg.toUtf8().getStr());
+}
+
 {
 std::vector pBuffer(nViewWidth * nViewHeight * 4);
 bool bIsBitmapLayer = false;
diff --git a/sd/source/ui/inc/SlideshowLayerRenderer.hxx 
b/sd/source/ui/inc/SlideshowLayerRenderer.hxx
index 0ee0e3f1e147..30a8e94b262d 100644
--- a/sd/source/ui/inc/SlideshowLayerRenderer.hxx
+++ b/sd/source/ui/inc/SlideshowLayerRenderer.hxx
@@ -28,22 +28,24 @@ struct RenderContext;
 
 enum class RenderStage
 {
+Background,
 Master,
-Slide
+Slide,
+TextFields,
+Count
 };
 
 /** Holds rendering state, properties and switches through all rendering 
passes */
 struct RenderState
 {
-RenderStage meStage = RenderStage::Master;
+RenderStage meStage = RenderStage::Background;
 
-sal_Int32 mnMasterIndex = 0;
 bool mbStopRenderingWhenField = true;
 
 std::unordered_set maObjectsDone;
 std::unordered_set maInAnimation;
 std::map maInitiallyVisible;
-sal_Int32 mnIndex = 0;
+sal_Int32 mnIndex[static_cast(RenderStage::Count)] = { 0, 0, 0, 
0 };
 SdrObject* mpCurrentTarget = nullptr;
 
 bool mbFirstObjectInPass = true;
@@ -53,29 +55,22 @@ struct RenderState
 sal_Int32 mnCurrentPass = 0;
 
 /// increments index 

core.git: Branch 'distro/collabora/co-24.04' - include/animations sd/qa sd/source slideshow/source

2024-09-09 Thread Szymon Kłos (via logerrit)
 include/animations/animationnodehelper.hxx|   37 ++
 sd/qa/unit/tiledrendering/tiledrendering.cxx  |3 +
 sd/source/ui/inc/SlideshowLayerRenderer.hxx   |2 
 sd/source/ui/tools/SlideshowLayerRenderer.cxx |   33 ++--
 slideshow/source/engine/slide/targetpropertiescreator.cxx |   30 ---
 5 files changed, 72 insertions(+), 33 deletions(-)

New commits:
commit 7db8e37adcf5a5a48164077b487086a4580dc8f7
Author: Szymon Kłos 
AuthorDate: Sun Sep 8 20:56:06 2024 +0200
Commit: Szymon Kłos 
CommitDate: Mon Sep 9 15:22:57 2024 +0200

slideshow: extract initial visibility of the animation target

Signed-off-by: Szymon Kłos 
Change-Id: I35ea503d254f36c8ab7307b157c87d5c2e0a8e1d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173050
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Marco Cecchetti 

diff --git a/include/animations/animationnodehelper.hxx 
b/include/animations/animationnodehelper.hxx
index eee41cd282be..9d978b76b552 100644
--- a/include/animations/animationnodehelper.hxx
+++ b/include/animations/animationnodehelper.hxx
@@ -20,7 +20,9 @@
 #ifndef INCLUDED_ANIMATIONS_ANIMATIONNODEHELPER_HXX
 #define INCLUDED_ANIMATIONS_ANIMATIONNODEHELPER_HXX
 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -71,6 +73,41 @@ namespace anim
 {
 }
 }
+
+inline bool getVisibilityProperty(
+const css::uno::Reference< css::animations::XAnimate >& xAnimateNode)
+{
+bool bVisible( false );
+if( 
xAnimateNode->getAttributeName().equalsIgnoreAsciiCase("visibility") )
+{
+
+css::uno::Any aAny( xAnimateNode->getTo() );
+
+// try to extract bool value
+if( !(aAny >>= bVisible) )
+{
+// try to extract string
+OUString aString;
+if( aAny >>= aString )
+{
+// we also take the strings "true" and "false",
+// as well as "on" and "off" here
+if( aString.equalsIgnoreAsciiCase("true") ||
+aString.equalsIgnoreAsciiCase("on") )
+{
+bVisible = true;
+}
+if( aString.equalsIgnoreAsciiCase("false") ||
+aString.equalsIgnoreAsciiCase("off") )
+{
+bVisible = false;
+}
+}
+}
+}
+
+return bVisible;
+}
 }
 
 #endif /* INCLUDED_ANIMATIONS_ANIMATIONNODEHELPER_HXX */
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 5d88600d076e..e2670232b9cc 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -3380,6 +3380,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering_Animati
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"MasterPage\"") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 0") >= 0);
 CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"hash\""));
+CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"initVisible\""));
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"content\": { \"type\": 
\"%IMAGETYPE%\", \"checksum\": \"%IMAGECHECKSUM%\"}") >= 0);
 
@@ -3396,6 +3397,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering_Animati
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"MasterPage\"") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 1") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"hash\"") >= 0);
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": true") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"content\": { \"type\": 
\"%IMAGETYPE%\", \"checksum\": \"%IMAGECHECKSUM%\"}") >= 0);
 
@@ -3428,6 +3430,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering_Animati
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 1") >= 0);
 CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"hash\"") >= 0);

core.git: Branch 'distro/collabora/co-24.04' - sd/qa sd/source

2024-09-06 Thread Szymon Kłos (via logerrit)
 sd/qa/unit/tiledrendering/tiledrendering.cxx  |   32 +--
 sd/source/ui/inc/SlideshowLayerRenderer.hxx   |   17 +---
 sd/source/ui/tools/SlideshowLayerRenderer.cxx |   54 --
 3 files changed, 89 insertions(+), 14 deletions(-)

New commits:
commit 72c88c2286400ec025d26925aa93f258d9655196
Author: Szymon Kłos 
AuthorDate: Wed Sep 4 21:38:29 2024 +0200
Commit: Szymon Kłos 
CommitDate: Fri Sep 6 16:40:49 2024 +0200

Identify layers so can be recognized as animation target

it has to match convertTarget result from unomodel.cxx
which is used on export of animations

Change-Id: I61df0b82681628722516c17c110acd90ce25b881
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172875
Reviewed-by: Marco Cecchetti 
Tested-by: Jenkins CollaboraOffice 

diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index fd654594c2b2..5d88600d076e 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -3376,7 +3376,13 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering_Animati
 OUString rJsonMsg;
 
CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), 
bIsBitmapLayer, rJsonMsg));
 CPPUNIT_ASSERT(bIsBitmapLayer);
-// TODO - check JSON content
+
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"MasterPage\"") >= 0);
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 0") >= 0);
+CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"hash\""));
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"content\": { \"type\": 
\"%IMAGETYPE%\", \"checksum\": \"%IMAGECHECKSUM%\"}") >= 0);
+
 debugWriteImageToFile(1, pBuffer, nViewWidth, nViewHeight, 
rJsonMsg.toUtf8().getStr());
 }
 
@@ -3386,7 +3392,13 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering_Animati
 OUString rJsonMsg;
 
CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), 
bIsBitmapLayer, rJsonMsg));
 CPPUNIT_ASSERT(bIsBitmapLayer);
-// TODO - check JSON content
+
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"MasterPage\"") >= 0);
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 1") >= 0);
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"hash\"") >= 0);
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0);
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"content\": { \"type\": 
\"%IMAGETYPE%\", \"checksum\": \"%IMAGECHECKSUM%\"}") >= 0);
+
 debugWriteImageToFile(2, pBuffer, nViewWidth, nViewHeight, 
rJsonMsg.toUtf8().getStr());
 }
 
@@ -3396,7 +3408,13 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering_Animati
 OUString rJsonMsg;
 
CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), 
bIsBitmapLayer, rJsonMsg));
 CPPUNIT_ASSERT(bIsBitmapLayer);
-// TODO - check JSON content
+
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0);
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 0") >= 0);
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"hash\"") >= 0);
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0);
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"content\": { \"type\": 
\"%IMAGETYPE%\", \"checksum\": \"%IMAGECHECKSUM%\"}") >= 0);
+
 debugWriteImageToFile(3, pBuffer, nViewWidth, nViewHeight, 
rJsonMsg.toUtf8().getStr());
 }
 
@@ -3406,7 +3424,13 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering_Animati
 OUString rJsonMsg;
 
CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), 
bIsBitmapLayer, rJsonMsg));
 CPPUNIT_ASSERT(bIsBitmapLayer);
-// TODO - check JSON content
+
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0);
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 1") >= 0);
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"hash\"") >= 0);
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0);
+CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"content\": { \"type\": 
\"%IMAGETYPE%\", \"checks

core.git: Branch 'distro/collabora/co-24.04' - vcl/source

2024-08-26 Thread Szymon Kłos (via logerrit)
 vcl/source/control/fmtfield.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit f5e4232396eb5720c342bcf57b699dbdf06859c0
Author: Szymon Kłos 
AuthorDate: Mon Aug 26 15:54:55 2024 +0200
Commit: Szymon Kłos 
CommitDate: Mon Aug 26 18:10:56 2024 +0200

Revert "Add one more property to JSON object to distinguish time fields 
better."

This reverts commit fa9428e82004389496f9ce18dadc8f3852b4bfce.

Reason for revert: not needed, we already have type=time for that

Change-Id: Ife646197b8d83c5b5e76d44d49f1363e1f440be1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172284
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Gökay ŞATIR 

diff --git a/vcl/source/control/fmtfield.cxx b/vcl/source/control/fmtfield.cxx
index fc6d70f39f2a..e8b02a29c111 100644
--- a/vcl/source/control/fmtfield.cxx
+++ b/vcl/source/control/fmtfield.cxx
@@ -1359,7 +1359,6 @@ void 
FormattedField::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
 {
 // weld::TimeFormatter uses h24 format
 rJsonWriter.put("type", "time");
-rJsonWriter.put("hasTimeFormatter", true);
 }
 rJsonWriter.put("min", rFormatter.GetMinValue());
 rJsonWriter.put("max", rFormatter.GetMaxValue());


core.git: Branch 'distro/collabora/co-24.04' - slideshow/source

2024-07-16 Thread Szymon Kłos (via logerrit)
 slideshow/source/engine/slide/slideimpl.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 3e7b11a304c6428bc24cd2dab0f54652f1aec3fc
Author: Szymon Kłos 
AuthorDate: Wed Jul 10 08:58:41 2024 +0200
Commit: Tomaž Vajngerl 
CommitDate: Tue Jul 16 12:55:21 2024 +0200

lok: sd: slideshow render: avoid using nullptr

Signed-off-by: Szymon Kłos 
Change-Id: I9368a256185aa336c6cc3ed398ff1d28f6498453
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170267
Reviewed-by: Tomaž Vajngerl 
Tested-by: Jenkins CollaboraOffice 

diff --git a/slideshow/source/engine/slide/slideimpl.cxx 
b/slideshow/source/engine/slide/slideimpl.cxx
index 4ac39cf4ff0f..ea943033a8c3 100644
--- a/slideshow/source/engine/slide/slideimpl.cxx
+++ b/slideshow/source/engine/slide/slideimpl.cxx
@@ -404,6 +404,9 @@ void LOKSlideRenderer::renderMasterPageImpl(VirtualDevice& 
rDevice)
 while (!mpMPShapesFunctor->isImportDone())
 {
 ShapeSharedPtr const& rShape(mpMPShapesFunctor->importShape());
+if (!rShape)
+continue;
+
 uno::Reference xShape = rShape->getXShape();
 if (xShape.is())
 {
@@ -449,6 +452,9 @@ void LOKSlideRenderer::renderTextFieldsImpl(VirtualDevice& 
rDevice)
 while( !mpTFShapesFunctor->isImportDone() )
 {
 ShapeSharedPtr const& rShape(mpTFShapesFunctor->importShape());
+if (!rShape)
+continue;
+
 uno::Reference xShape = rShape->getXShape();
 if (xShape.is())
 {


core.git: slideshow/source

2024-07-11 Thread Szymon Kłos (via logerrit)
 slideshow/source/engine/slide/slideimpl.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 2fe59dc6e8b5ac9c6b312d1e4a3f4c71e1d0f5bc
Author: Szymon Kłos 
AuthorDate: Wed Jul 10 08:58:41 2024 +0200
Commit: Szymon Kłos 
CommitDate: Thu Jul 11 15:12:58 2024 +0200

lok: sd: slideshow render: avoid using nullptr

Signed-off-by: Szymon Kłos 
Change-Id: I9368a256185aa336c6cc3ed398ff1d28f6498453
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170306
Tested-by: Jenkins

diff --git a/slideshow/source/engine/slide/slideimpl.cxx 
b/slideshow/source/engine/slide/slideimpl.cxx
index a03839dab1d4..1468b24bff5a 100644
--- a/slideshow/source/engine/slide/slideimpl.cxx
+++ b/slideshow/source/engine/slide/slideimpl.cxx
@@ -404,6 +404,9 @@ void LOKSlideRenderer::renderMasterPageImpl(VirtualDevice& 
rDevice)
 while (!mpMPShapesFunctor->isImportDone())
 {
 ShapeSharedPtr const& rShape(mpMPShapesFunctor->importShape());
+if (!rShape)
+continue;
+
 uno::Reference xShape = rShape->getXShape();
 if (xShape.is())
 {
@@ -449,6 +452,9 @@ void LOKSlideRenderer::renderTextFieldsImpl(VirtualDevice& 
rDevice)
 while( !mpTFShapesFunctor->isImportDone() )
 {
 ShapeSharedPtr const& rShape(mpTFShapesFunctor->importShape());
+if (!rShape)
+continue;
+
 uno::Reference xShape = rShape->getXShape();
 if (xShape.is())
 {


core.git: Branch 'distro/collabora/co-24.04' - include/vcl svx/source vcl/inc vcl/jsdialog vcl/source vcl/unx

2024-06-28 Thread Szymon Kłos (via logerrit)
 include/vcl/weld.hxx|8 ++---
 svx/source/inc/StylesPreviewWindow.hxx  |2 -
 svx/source/tbxctrls/StylesPreviewWindow.cxx |   14 +++--
 vcl/inc/iconview.hxx|   12 
 vcl/inc/jsdialog/jsdialogbuilder.hxx|   18 ++--
 vcl/inc/salvtables.hxx  |8 +++--
 vcl/jsdialog/executor.cxx   |   36 ++---
 vcl/jsdialog/jsdialogbuilder.cxx|   16 ++-
 vcl/source/app/salvtables.cxx   |   16 ---
 vcl/source/treelist/iconview.cxx|   40 
 vcl/unx/gtk3/gtkinst.cxx|2 -
 11 files changed, 109 insertions(+), 63 deletions(-)

New commits:
commit 12ff4396d973e7aae4dd68b742d9790f8c88ea53
Author: Szymon Kłos 
AuthorDate: Thu Jun 27 11:11:13 2024 +0200
Commit: Tomaž Vajngerl 
CommitDate: Fri Jun 28 09:57:26 2024 +0200

jsdialog: support on demand rendering for icon view

- rename action: rendered_combobox_entry -> rendered_entry
- change generic get json property callback to more specialized
  image getter as it wasn't used anywhere apart of that and we need
  image enceded as base64 only not JSON
- add to the full update of icon view "ondemand" property to the entries
  with images so LOK client will know it has to download the render
- it will be possible to support HiDPI renders in the future: added TODO

    Signed-off-by: Szymon Kłos 
Change-Id: I83a6e91133f8f9cb03e0bc794b51e1947435fa90
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169622
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 52e70e4f08d6..3e334f2cbbee 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -1386,7 +1386,7 @@ public:
 using Widget::get_sensitive;
 };
 
-typedef std::tuple 
json_prop_query;
+typedef std::tuple encoded_image_query;
 
 class VCL_DLLPUBLIC IconView : virtual public Widget
 {
@@ -1400,7 +1400,7 @@ protected:
 Link m_aItemActivatedHdl;
 Link m_aCommandHdl;
 Link m_aQueryTooltipHdl;
-Link m_aGetPropertyTreeElemHdl;
+Link m_aGetPropertyTreeElemHdl;
 
 void signal_selection_changed() { m_aSelectionChangeHdl.Call(*this); }
 bool signal_item_activated() { return m_aItemActivatedHdl.Call(*this); }
@@ -1455,8 +1455,8 @@ public:
 m_aQueryTooltipHdl = rLink;
 }
 
-// 0: json writer, 1: TreeIter, 2: property. returns true if supported
-virtual void connect_get_property_tree_elem(const Link& rLink)
+// 0: OUString, 1: TreeIter, returns true if supported
+virtual void connect_get_image(const Link& rLink)
 {
 m_aGetPropertyTreeElemHdl = rLink;
 }
diff --git a/svx/source/inc/StylesPreviewWindow.hxx 
b/svx/source/inc/StylesPreviewWindow.hxx
index 76b385c084d2..471b32f946cf 100644
--- a/svx/source/inc/StylesPreviewWindow.hxx
+++ b/svx/source/inc/StylesPreviewWindow.hxx
@@ -113,7 +113,7 @@ protected:
 DECL_LINK(Selected, weld::IconView&, void);
 DECL_LINK(DoubleClick, weld::IconView&, bool);
 DECL_LINK(DoCommand, const CommandEvent&, bool);
-DECL_LINK(DoJsonProperty, const weld::json_prop_query&, bool);
+DECL_LINK(GetPreviewImage, const weld::encoded_image_query&, bool);
 
 public:
 StylesPreviewWindow_Base(weld::Builder& xBuilder,
diff --git a/svx/source/tbxctrls/StylesPreviewWindow.cxx 
b/svx/source/tbxctrls/StylesPreviewWindow.cxx
index da560feb0e15..15a7382e06da 100644
--- a/svx/source/tbxctrls/StylesPreviewWindow.cxx
+++ b/svx/source/tbxctrls/StylesPreviewWindow.cxx
@@ -455,8 +455,7 @@ StylesPreviewWindow_Base::StylesPreviewWindow_Base(
 m_xStylesView->connect_selection_changed(LINK(this, 
StylesPreviewWindow_Base, Selected));
 m_xStylesView->connect_item_activated(LINK(this, StylesPreviewWindow_Base, 
DoubleClick));
 m_xStylesView->connect_command(LINK(this, StylesPreviewWindow_Base, 
DoCommand));
-m_xStylesView->connect_get_property_tree_elem(
-LINK(this, StylesPreviewWindow_Base, DoJsonProperty));
+m_xStylesView->connect_get_image(LINK(this, StylesPreviewWindow_Base, 
GetPreviewImage));
 
 const css::uno::Reference 
xProvider(m_xFrame,

css::uno::UNO_QUERY);
@@ -567,12 +566,9 @@ static OString extractPngString(const BitmapEx& rBitmap)
 return ""_ostr;
 }
 
-// 0: json writer, 1: TreeIter, 2: property. returns true if supported
-IMPL_LINK(StylesPreviewWindow_Base, DoJsonProperty, const 
weld::json_prop_query&, rQuery, bool)
+// 0: OUString, 1: TreeIter, returns true if supported
+IMPL_LINK(StylesPreviewWindow_Base, GetPreviewImage, const 
weld::encoded_image_query&, rQuery, bool)
 {
-if (std::get<2>(rQuery) != "image")
-return false;

core.git: sfx2/source

2024-06-20 Thread Szymon Kłos (via logerrit)
 sfx2/source/view/lokhelper.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 494161a9c8a9acca4d200d06c44ef6db794c0bea
Author: Szymon Kłos 
AuthorDate: Tue Apr 16 17:59:25 2024 +0200
Commit: Szymon Kłos 
CommitDate: Thu Jun 20 10:57:18 2024 +0200

cool#9309 lok: sync language in comphelper::LibreOfficeKit on view creation

If new view is created using createViewWithOptions API call
we pass language of that view. We do a setup of that language
in SfxLokHelper::setViewLanguage but it was only set inside
ViewShell.

Unfortunately just after we create the view we call setView which
later checks if comphelper::LibreOfficeKit::getLanguageTag()
has matching value with ViewShell field.
It was showing warning in the logs:
warn:lok:31748:31654:sfx2/source/view/lokhelper.cxx:206: LANGUAGE mismatch 
at setView! ... old (wrong) lang:de new lang:fr

Let's check if the view we try to modify is the current one and
in that case synchronize value we can get using global
comphelper::LibreOfficeKit function.

Signed-off-by: Szymon Kłos 
Change-Id: Icddfda003522dda661066c4d1c43ca1dec9e5c55
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169107
(cherry picked from commit 800d8580ec8d99f5c610727a9d53ab143019c014)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169144
Tested-by: Jenkins

diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 549f43906908..131561504e1b 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -338,6 +338,10 @@ void SfxLokHelper::setViewLanguage(int nId, const 
OUString& rBcp47LanguageTag)
 if (pViewShell->GetViewShellId() == ViewShellId(nId))
 {
 pViewShell->SetLOKLanguageTag(rBcp47LanguageTag);
+// sync also global getter if we are the current view
+bool bIsCurrShell = (pViewShell == SfxViewShell::Current());
+if (bIsCurrShell)
+
comphelper::LibreOfficeKit::setLanguageTag(LanguageTag(rBcp47LanguageTag));
 return;
 }
 }


core.git: Branch 'distro/collabora/co-24.04' - sfx2/source

2024-06-20 Thread Szymon Kłos (via logerrit)
 sfx2/source/view/lokhelper.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 800d8580ec8d99f5c610727a9d53ab143019c014
Author: Szymon Kłos 
AuthorDate: Tue Apr 16 17:59:25 2024 +0200
Commit: Miklos Vajna 
CommitDate: Thu Jun 20 09:09:49 2024 +0200

cool#9309 lok: sync language in comphelper::LibreOfficeKit on view creation

If new view is created using createViewWithOptions API call
we pass language of that view. We do a setup of that language
in SfxLokHelper::setViewLanguage but it was only set inside
ViewShell.

Unfortunately just after we create the view we call setView which
later checks if comphelper::LibreOfficeKit::getLanguageTag()
has matching value with ViewShell field.
It was showing warning in the logs:
warn:lok:31748:31654:sfx2/source/view/lokhelper.cxx:206: LANGUAGE mismatch 
at setView! ... old (wrong) lang:de new lang:fr

Let's check if the view we try to modify is the current one and
in that case synchronize value we can get using global
comphelper::LibreOfficeKit function.

Signed-off-by: Szymon Kłos 
Change-Id: Icddfda003522dda661066c4d1c43ca1dec9e5c55
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169107
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 99f39fbf4e8b..66f8be5f2800 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -336,6 +336,10 @@ void SfxLokHelper::setViewLanguage(int nId, const 
OUString& rBcp47LanguageTag)
 if (pViewShell->GetViewShellId() == ViewShellId(nId))
 {
 pViewShell->SetLOKLanguageTag(rBcp47LanguageTag);
+// sync also global getter if we are the current view
+bool bIsCurrShell = (pViewShell == SfxViewShell::Current());
+if (bIsCurrShell)
+
comphelper::LibreOfficeKit::setLanguageTag(LanguageTag(rBcp47LanguageTag));
 return;
 }
 }


core.git: Branch 'distro/collabora/co-24.04' - vcl/jsdialog

2024-05-09 Thread Szymon Kłos (via logerrit)
 vcl/jsdialog/enabled.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 68300e741bfd332e9ffef0f70a8c065672b18994
Author: Szymon Kłos 
AuthorDate: Sun Jan 28 22:28:40 2024 +0100
Commit: Tomaž Vajngerl 
CommitDate: Thu May 9 10:32:05 2024 +0200

jsdialog: enable animation properties in impress

to test:
1. click on any shape in Impress
2. go to Animation tab in sidebar
3. "add" animation
4. double-click on added animation on the list

Signed-off-by: Szymon Kłos 
Change-Id: I009cbdd295fac4f4533101c89d5c0268fbbe633a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164112
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index 636def88df05..ab0fbdbd7751 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -170,6 +170,10 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
 || rUIFile == u"modules/sdraw/ui/drawpagedialog.ui"
 || rUIFile == u"modules/sdraw/ui/drawparadialog.ui"
 // simpress
+|| rUIFile == u"modules/simpress/ui/customanimationeffecttab.ui"
+|| rUIFile == u"modules/simpress/ui/customanimationproperties.ui"
+|| rUIFile == u"modules/simpress/ui/customanimationtexttab.ui"
+|| rUIFile == u"modules/simpress/ui/customanimationtimingtab.ui"
 || rUIFile == u"modules/simpress/ui/headerfooterdialog.ui"
 || rUIFile == u"modules/simpress/ui/headerfootertab.ui"
 // swriter


core.git: Branch 'distro/collabora/co-24.04' - 2 commits - chart2/source cui/source desktop/source include/svx sc/source sd/source sfx2/source sw/source vcl/jsdialog

2024-05-08 Thread Szymon Kłos (via logerrit)
 chart2/source/controller/main/ShapeController.cxx |   26 +++---
 cui/source/factory/dlgfact.cxx|8 +-
 cui/source/factory/dlgfact.hxx|6 -
 desktop/source/lib/init.cxx   |2 
 include/svx/svxdlg.hxx|2 
 sc/source/ui/drawfunc/drawsh5.cxx |   85 +++---
 sd/source/ui/view/drviews2.cxx|   65 ++--
 sd/source/ui/view/drviewsc.cxx|3 
 sfx2/source/control/unoctitm.cxx  |2 
 sw/source/uibase/shells/drwbassh.cxx  |   76 ---
 sw/source/uibase/shells/frmsh.cxx |   15 ++-
 vcl/jsdialog/enabled.cxx  |2 
 12 files changed, 171 insertions(+), 121 deletions(-)

New commits:
commit 48bfdbe7512a880983d04ec9143ae881dfae58f4
Author: Szymon Kłos 
AuthorDate: Tue May 7 21:59:04 2024 +0200
Commit: Szymon Kłos 
CommitDate: Thu May 9 08:47:21 2024 +0200

jsdialog: enable Object Name and Description dialog

and send uno command enable/disable status

Signed-off-by: Szymon Kłos 
Change-Id: Id643a27308809b6960be72fb368b9f078ff9cf6c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167296
Reviewed-by: Michael Meeks 
Tested-by: Jenkins CollaboraOffice 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index d5476cfe7666..962d676694ac 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3756,6 +3756,8 @@ static void doc_iniUnoCommands ()
 u".uno:Context"_ustr,
 u".uno:WrapText"_ustr,
 u".uno:ToggleMergeCells"_ustr,
+u".uno:NameGroup"_ustr,
+u".uno:ObjectTitleDescription"_ustr,
 u".uno:NumberFormatCurrency"_ustr,
 u".uno:NumberFormatPercent"_ustr,
 u".uno:NumberFormatDecimal"_ustr,
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index e327a9e0e949..a7ed100977bf 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -2657,7 +2657,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
 if(1 == mpDrawView->GetMarkedObjectCount())
 {
 // #i68101#
-SdrObject* pSelected = mpDrawView->GetMarkedObjectByIndex(0);
+rtl::Reference pSelected = 
mpDrawView->GetMarkedObjectByIndex(0);
 OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, 
but no object (!)");
 OUString aName(pSelected->GetName());
 
@@ -2675,7 +2675,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
 
 SdPage* pPage = GetActualPage();
 if (pPage)
-pPage->notifyObjectRenamed(pSelected);
+pPage->notifyObjectRenamed(pSelected.get());
 }
 pDlg->disposeOnce();
 SfxBindings& rBindings = GetViewFrame()->GetBindings();
@@ -2695,25 +2695,36 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
 {
 if(1 == mpDrawView->GetMarkedObjectCount())
 {
-SdrObject* pSelected = mpDrawView->GetMarkedObjectByIndex(0);
+rtl::Reference pSelected = 
mpDrawView->GetMarkedObjectByIndex(0);
 OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, 
but no object (!)");
 OUString aTitle(pSelected->GetTitle());
 OUString aDescription(pSelected->GetDescription());
 bool isDecorative(pSelected->IsDecorative());
 
 SvxAbstractDialogFactory* pFact = 
SvxAbstractDialogFactory::Create();
-ScopedVclPtr 
pDlg(pFact->CreateSvxObjectTitleDescDialog(
+VclPtr 
pDlg(pFact->CreateSvxObjectTitleDescDialog(
 GetFrameWeld(), aTitle, aDescription, 
isDecorative));
 
-if(RET_OK == pDlg->Execute())
-{
-pDlg->GetTitle(aTitle);
-pDlg->GetDescription(aDescription);
-pDlg->IsDecorative(isDecorative);
-pSelected->SetTitle(aTitle);
-pSelected->SetDescription(aDescription);
-pSelected->SetDecorative(isDecorative);
-}
+pDlg->StartExecuteAsync(
+[pDlg, pSelected] (sal_Int32 nResult)->void
+{
+if (nResult == RET_OK)
+{
+OUString aTitle;
+OUString aDescription;
+bool isDecorative;
+
+p

core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-05-07 Thread Szymon Kłos (via logerrit)
 sc/source/ui/docshell/docsh6.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 83269aa84a0af8b9a32424af6b01815aaad4f42a
Author: Szymon Kłos 
AuthorDate: Tue May 7 15:33:21 2024 +0200
Commit: Szymon Kłos 
CommitDate: Tue May 7 19:07:01 2024 +0200

lok: don't show separator conversion dialog

in online it is more likely that you run file not
created with your user locale. Don't show annoying
dialog about separator conversion in LOK as we didn't
show it before. Recently we enabled it and it become visible.

Change-Id: I5a37865dbe63bca0c55205b59be3a64ceb824b17
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167281
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Gökay ŞATIR 

diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx
index 344b52953faf..0e147f14c3fe 100644
--- a/sc/source/ui/docshell/docsh6.cxx
+++ b/sc/source/ui/docshell/docsh6.cxx
@@ -496,7 +496,7 @@ void ScDocShell::CheckConfigOptions()
 pScMod->SetFormulaOptions(aNew);
 
 // Launch a nice warning dialog to let the users know of this change.
-ScTabViewShell* pViewShell = GetBestViewShell();
+ScTabViewShell* pViewShell = comphelper::LibreOfficeKit::isActive() ? 
nullptr : GetBestViewShell();
 if (pViewShell)
 {
 std::shared_ptr 
xInfoBox(Application::CreateMessageDialog(pViewShell->GetFrameWeld(),


core.git: Branch 'distro/collabora/co-23.05' - sc/qa

2024-05-06 Thread Szymon Kłos (via logerrit)
 sc/qa/unit/tiledrendering/data/numlocale.xlsx |binary
 sc/qa/unit/tiledrendering/tiledrendering.cxx  |   77 +-
 2 files changed, 76 insertions(+), 1 deletion(-)

New commits:
commit 00c790b36b48732a80b56d0b33c765abc53cf624
Author: Szymon Kłos 
AuthorDate: Tue Apr 30 09:51:18 2024 +0200
Commit: Szymon Kłos 
CommitDate: Tue May 7 07:56:07 2024 +0200

lok: test number formats with different locale

This is followup for the fix in commit 
7836cb7e90d0214cac08228f5e527322ed6f955c
lok: save correct number format in multi-lang session

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

diff --git a/sc/qa/unit/tiledrendering/data/numlocale.xlsx 
b/sc/qa/unit/tiledrendering/data/numlocale.xlsx
new file mode 100644
index ..c69f74e32301
Binary files /dev/null and b/sc/qa/unit/tiledrendering/data/numlocale.xlsx 
differ
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx 
b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 65844f2546f8..53a558b6ea52 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -25,6 +25,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -44,6 +46,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -181,6 +184,7 @@ public:
 void testExtendedAreasDontOverlap();
 void testEditShapeText();
 void testCopyMultiSelection();
+void testNumberFormatLocaleMultiUser();
 
 CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
 CPPUNIT_TEST(testRowColumnHeaders);
@@ -263,6 +267,7 @@ public:
 CPPUNIT_TEST(testExtendedAreasDontOverlap);
 CPPUNIT_TEST(testEditShapeText);
 CPPUNIT_TEST(testCopyMultiSelection);
+CPPUNIT_TEST(testNumberFormatLocaleMultiUser);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -305,7 +310,7 @@ void ScTiledRenderingTest::tearDown()
 UnoApiXmlTest::tearDown();
 }
 
-ScModelObj* ScTiledRenderingTest::createDoc(const char* pName)
+ScModelObj* ScTiledRenderingTest::createDoc(const char* pName)//, const char* 
pLang = nullptr)
 {
 loadFromURL(OUString::createFromAscii(pName));
 
@@ -4162,6 +4167,76 @@ void ScTiledRenderingTest::testCopyMultiSelection()
 CPPUNIT_ASSERT(!xTransferable2->isComplex());
 }
 
+void ScTiledRenderingTest::testNumberFormatLocaleMultiUser()
+{
+{
+// setup core language to FR as it will be the first session
+SvtSysLocaleOptions aLocalOptions;
+aLocalOptions.SetLocaleConfigString("fr-FR");
+aLocalOptions.SetUILocaleConfigString("fr-FR");
+aLocalOptions.Commit();
+
+loadFromURL(u"numlocale.xlsx");
+
+ScModelObj* pModelObj = 
comphelper::getFromUnoTunnel(mxComponent);
+CPPUNIT_ASSERT(pModelObj);
+
+
pModelObj->initializeForTiledRendering(uno::Sequence());
+ScDocument* pDoc = pModelObj->GetDocument();
+
+int nViewFR = SfxLokHelper::getView();
+ViewCallback aView1;
+SfxViewShell* pViewFR = SfxViewShell::Current();
+pViewFR->SetLOKLocale("fr-FR");
+
+// modify G12 with FR and use French keywords in the format
+SfxLokHelper::setView(nViewFR);
+
+sal_Int32 nCheckPos;
+SvNumFormatType nType;
+sal_uInt32 nFormat;
+OUString aNumberFormat("JJ/MM/");
+SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
+pFormatter->PutEntry(aNumberFormat, nCheckPos, nType, nFormat);
+ScAddress aCellPos1(/*nColP=*/6, /*nRowP=*/11, /*nTabP=*/0);
+pDoc->SetNumberFormat(aCellPos1, nFormat);
+
+Scheduler::ProcessEventsToIdle();
+}
+
+{
+// now setup DE language in core
+SvtSysLocaleOptions aLocalOptions;
+aLocalOptions.SetLocaleConfigString("de-DE");
+aLocalOptions.SetUILocaleConfigString("de-DE");
+aLocalOptions.Commit();
+
+// save and reopen
+// .uno:Save modifies the original file, make a copy first
+saveAndReload("Calc MS Excel 2007 VBA XML");
+
+ScModelObj* pModelObj = 
comphelper::getFromUnoTunnel(mxComponent);
+CPPUNIT_ASSERT(pModelObj);
+
+ScTabViewShell* pView = 
dynamic_cast(SfxViewShell::Current());
+CPPUNIT_ASSERT(pView);
+
+Scheduler::ProcessEventsToIdle();
+
+uno::Sequence aArgs;
+dispatchCommand(mxComponent, ".uno:Save", aArgs);
+
+Scheduler::ProcessEventsToIdle();
+
+ScDocument* pDoc = pModelObj->GetDocument();
+
+// verify that format is correct (German), doesn't have any "string" 
inside
+sal_uInt32 nNumberFormat = pDoc->GetNumberFormat(/*col=*/6, 
/*row=*/11, /*tab=*/0);
+const SvNumberformat* pNumberFormat = 

core.git: Branch 'distro/collabora/co-24.04' - sc/qa

2024-05-01 Thread Szymon Kłos (via logerrit)
 sc/qa/unit/tiledrendering/data/numlocale.xlsx |binary
 sc/qa/unit/tiledrendering/tiledrendering.cxx  |   73 ++
 2 files changed, 73 insertions(+)

New commits:
commit f957dfbde79238d0f49f31763baad9d0c8f93bd3
Author: Szymon Kłos 
AuthorDate: Tue Apr 30 09:51:18 2024 +0200
Commit: Tomaž Vajngerl 
CommitDate: Wed May 1 16:40:45 2024 +0200

lok: test number formats with different locale

This is followup for the fix in commit 
7836cb7e90d0214cac08228f5e527322ed6f955c
lok: save correct number format in multi-lang session

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

diff --git a/sc/qa/unit/tiledrendering/data/numlocale.xlsx 
b/sc/qa/unit/tiledrendering/data/numlocale.xlsx
new file mode 100644
index ..c69f74e32301
Binary files /dev/null and b/sc/qa/unit/tiledrendering/data/numlocale.xlsx 
differ
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx 
b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 1c183521b605..17048a4ca8df 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -26,6 +26,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -45,6 +47,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -3934,6 +3937,76 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, 
testCopyMultiSelection)
 CPPUNIT_ASSERT(!xTransferable2->isComplex());
 }
 
+CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testNumberFormatLocaleMultiUser)
+{
+{
+// setup core language to FR as it will be the first session
+SvtSysLocaleOptions aLocalOptions;
+aLocalOptions.SetLocaleConfigString("fr-FR");
+aLocalOptions.SetUILocaleConfigString("fr-FR");
+aLocalOptions.Commit();
+
+loadFromFile(u"numlocale.xlsx");
+
+ScModelObj* pModelObj = 
comphelper::getFromUnoTunnel(mxComponent);
+CPPUNIT_ASSERT(pModelObj);
+
+
pModelObj->initializeForTiledRendering(uno::Sequence());
+ScDocument* pDoc = pModelObj->GetDocument();
+
+int nViewFR = SfxLokHelper::getView();
+ViewCallback aView1;
+SfxViewShell* pViewFR = SfxViewShell::Current();
+pViewFR->SetLOKLocale("fr-FR");
+
+// modify G12 with FR and use French keywords in the format
+SfxLokHelper::setView(nViewFR);
+
+sal_Int32 nCheckPos;
+SvNumFormatType nType;
+sal_uInt32 nFormat;
+OUString aNumberFormat("JJ/MM/");
+SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
+pFormatter->PutEntry(aNumberFormat, nCheckPos, nType, nFormat);
+ScAddress aCellPos1(/*nColP=*/6, /*nRowP=*/11, /*nTabP=*/0);
+pDoc->SetNumberFormat(aCellPos1, nFormat);
+
+Scheduler::ProcessEventsToIdle();
+}
+
+{
+// now setup DE language in core
+SvtSysLocaleOptions aLocalOptions;
+aLocalOptions.SetLocaleConfigString("de-DE");
+aLocalOptions.SetUILocaleConfigString("de-DE");
+aLocalOptions.Commit();
+
+// save and reopen
+// .uno:Save modifies the original file, make a copy first
+saveAndReload("Calc MS Excel 2007 VBA XML");
+
+ScModelObj* pModelObj = 
comphelper::getFromUnoTunnel(mxComponent);
+CPPUNIT_ASSERT(pModelObj);
+
+ScTabViewShell* pView = 
dynamic_cast(SfxViewShell::Current());
+CPPUNIT_ASSERT(pView);
+
+Scheduler::ProcessEventsToIdle();
+
+uno::Sequence aArgs;
+dispatchCommand(mxComponent, ".uno:Save", aArgs);
+
+Scheduler::ProcessEventsToIdle();
+
+ScDocument* pDoc = pModelObj->GetDocument();
+
+// verify that format is correct (German), doesn't have any "string" 
inside
+sal_uInt32 nNumberFormat = pDoc->GetNumberFormat(/*col=*/6, 
/*row=*/11, /*tab=*/0);
+const SvNumberformat* pNumberFormat = 
pDoc->GetFormatTable()->GetEntry(nNumberFormat);
+CPPUNIT_ASSERT_EQUAL(OUString("TT.MM.JJ"), 
pNumberFormat->GetFormatstring());
+}
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


core.git: sc/qa

2024-05-01 Thread Szymon Kłos (via logerrit)
 sc/qa/unit/tiledrendering/tiledrendering.cxx |   12 ++--
 1 file changed, 2 insertions(+), 10 deletions(-)

New commits:
commit ced78dc7abf534edd2eacee4af01c35c4360b9f0
Author: Szymon Kłos 
AuthorDate: Wed May 1 08:44:38 2024 +0200
Commit: Szymon Kłos 
CommitDate: Wed May 1 13:17:03 2024 +0200

Remove commented code

Added it by mistake in commit c1c32bbbe24ebd4be00c9c3bb38de1dc748bd2b6
lok: test number formats with different locale

Signed-off-by: Szymon Kłos 
Change-Id: I0f7b456d5f41c1faf1f5051aaf0756c90553cf3c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166947
Tested-by: Jenkins

diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx 
b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 6236307016f2..4c28c9f8874a 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -142,21 +142,13 @@ void ScTiledRenderingTest::tearDown()
 UnoApiXmlTest::tearDown();
 }
 
-ScModelObj* ScTiledRenderingTest::createDoc(const char* pName)//, const char* 
pLang = nullptr)
+ScModelObj* ScTiledRenderingTest::createDoc(const char* pName)
 {
 loadFromFile(OUString::createFromAscii(pName));
 
 ScModelObj* pModelObj = 
comphelper::getFromUnoTunnel(mxComponent);
 CPPUNIT_ASSERT(pModelObj);
-
-auto aProperties = uno::Sequence();//pLang ? 1 : 0);
-// if (pLang)
-// {
-// aProperties[0] = beans::PropertyValue(
-// "Language", -1, OUString::createFromAscii(pLang), 
beans::PropertyState_DIRECT_VALUE);
-// }
-
-pModelObj->initializeForTiledRendering(aProperties);
+
pModelObj->initializeForTiledRendering(uno::Sequence());
 return pModelObj;
 }
 


core.git: sc/qa

2024-04-30 Thread Szymon Kłos (via logerrit)
 sc/qa/unit/tiledrendering/data/numlocale.xlsx |binary
 sc/qa/unit/tiledrendering/tiledrendering.cxx  |   87 --
 2 files changed, 83 insertions(+), 4 deletions(-)

New commits:
commit c1c32bbbe24ebd4be00c9c3bb38de1dc748bd2b6
Author: Szymon Kłos 
AuthorDate: Tue Apr 30 09:51:18 2024 +0200
Commit: Szymon Kłos 
CommitDate: Tue Apr 30 15:55:57 2024 +0200

lok: test number formats with different locale

This is followup for the fix in commit 
7836cb7e90d0214cac08228f5e527322ed6f955c
lok: save correct number format in multi-lang session

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

diff --git a/sc/qa/unit/tiledrendering/data/numlocale.xlsx 
b/sc/qa/unit/tiledrendering/data/numlocale.xlsx
new file mode 100644
index ..c69f74e32301
Binary files /dev/null and b/sc/qa/unit/tiledrendering/data/numlocale.xlsx 
differ
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx 
b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 651df397cc71..6236307016f2 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -21,6 +21,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -37,8 +39,7 @@
 #include 
 #include 
 #include 
-
-#include 
+#include 
 
 #include 
 #include 
@@ -141,13 +142,21 @@ void ScTiledRenderingTest::tearDown()
 UnoApiXmlTest::tearDown();
 }
 
-ScModelObj* ScTiledRenderingTest::createDoc(const char* pName)
+ScModelObj* ScTiledRenderingTest::createDoc(const char* pName)//, const char* 
pLang = nullptr)
 {
 loadFromFile(OUString::createFromAscii(pName));
 
 ScModelObj* pModelObj = 
comphelper::getFromUnoTunnel(mxComponent);
 CPPUNIT_ASSERT(pModelObj);
-
pModelObj->initializeForTiledRendering(uno::Sequence());
+
+auto aProperties = uno::Sequence();//pLang ? 1 : 0);
+// if (pLang)
+// {
+// aProperties[0] = beans::PropertyValue(
+// "Language", -1, OUString::createFromAscii(pLang), 
beans::PropertyState_DIRECT_VALUE);
+// }
+
+pModelObj->initializeForTiledRendering(aProperties);
 return pModelObj;
 }
 
@@ -3889,6 +3898,76 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, 
testEditShapeText)
 CPPUNIT_ASSERT_MESSAGE("Text is not visible", aBitmapBefore != 
aBitmapAfter);
 }
 
+CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testNumberFormatLocaleMultiUser)
+{
+{
+// setup core language to FR as it will be the first session
+SvtSysLocaleOptions aLocalOptions;
+aLocalOptions.SetLocaleConfigString("fr-FR");
+aLocalOptions.SetUILocaleConfigString("fr-FR");
+aLocalOptions.Commit();
+
+loadFromFile(u"numlocale.xlsx");
+
+ScModelObj* pModelObj = 
comphelper::getFromUnoTunnel(mxComponent);
+CPPUNIT_ASSERT(pModelObj);
+
+
pModelObj->initializeForTiledRendering(uno::Sequence());
+ScDocument* pDoc = pModelObj->GetDocument();
+
+int nViewFR = SfxLokHelper::getView();
+ViewCallback aView1;
+SfxViewShell* pViewFR = SfxViewShell::Current();
+pViewFR->SetLOKLocale("fr-FR");
+
+// modify G12 with FR and use French keywords in the format
+SfxLokHelper::setView(nViewFR);
+
+sal_Int32 nCheckPos;
+SvNumFormatType nType;
+sal_uInt32 nFormat;
+OUString aNumberFormat("JJ/MM/");
+SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
+pFormatter->PutEntry(aNumberFormat, nCheckPos, nType, nFormat);
+ScAddress aCellPos1(/*nColP=*/6, /*nRowP=*/11, /*nTabP=*/0);
+pDoc->SetNumberFormat(aCellPos1, nFormat);
+
+Scheduler::ProcessEventsToIdle();
+}
+
+{
+// now setup DE language in core
+SvtSysLocaleOptions aLocalOptions;
+aLocalOptions.SetLocaleConfigString("de-DE");
+aLocalOptions.SetUILocaleConfigString("de-DE");
+aLocalOptions.Commit();
+
+// save and reopen
+// .uno:Save modifies the original file, make a copy first
+saveAndReload("Calc MS Excel 2007 VBA XML");
+
+ScModelObj* pModelObj = 
comphelper::getFromUnoTunnel(mxComponent);
+CPPUNIT_ASSERT(pModelObj);
+
+ScTabViewShell* pView = 
dynamic_cast(SfxViewShell::Current());
+CPPUNIT_ASSERT(pView);
+
+Scheduler::ProcessEventsToIdle();
+
+uno::Sequence aArgs;
+dispatchCommand(mxComponent, ".uno:Save", aArgs);
+
+Scheduler::ProcessEventsToIdle();
+
+ScDocument* pDoc = pModelObj->GetDocument();
+
+// verify that format is correct (German), doesn't have any "string" 
inside
+sal_uInt32 nNumberFormat = pDoc->GetNumberFormat(/*col=*/6, 
/*ro

core.git: svl/source

2024-04-28 Thread Szymon Kłos (via logerrit)
 svl/source/numbers/zforlist.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 0a5026b3675154ee216dd87ba46dfe533744eb05
Author: Szymon Kłos 
AuthorDate: Fri Apr 26 12:36:14 2024 +0200
Commit: Tomaž Vajngerl 
CommitDate: Mon Apr 29 07:58:52 2024 +0200

lok: save correct number format in multi-lang session

Number formats can have different keywords in different
languages: D - Day(EN), T - Tag(DE).
This can cause problem when we use format which will not
be recognized by current number formatter, then we put
unknown keyword as string in quotes. As the result we get
for example: formatCode=""TT."mm".""

The problem exists especially in multi-language setup in LOK
when we use non-English languages:
1. open xlsx using FR
2. join with DE
3. modify number formats in both
4. leave spreadsheet with both so it will be saved
Result: after we open it again we have some keywords as
strings, user has to apply new number format to see the
real value
    
Signed-off-by: Szymon Kłos 
Change-Id: Ice04d890b38cd2d08d06f41fc7b3cc55f64fadbe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166711
Reviewed-by: Tomaž Vajngerl 
Tested-by: Jenkins

diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 54576eb1c230..2d26b1251f3e 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -990,6 +991,7 @@ OUString SvNumberFormatter::GetFormatStringForExcel( 
sal_uInt32 nKey, const NfKe
 }
 else
 {
+bool bIsLOK = comphelper::LibreOfficeKit::isActive();
 bool bSystemLanguage = false;
 LanguageType nLang = pEntry->GetLanguage();
 if (nLang == LANGUAGE_SYSTEM)
@@ -997,7 +999,7 @@ OUString SvNumberFormatter::GetFormatStringForExcel( 
sal_uInt32 nKey, const NfKe
 bSystemLanguage = true;
 nLang = SvtSysLocale().GetLanguageTag().getLanguageType();
 }
-if (nLang != LANGUAGE_ENGLISH_US)
+if (!bIsLOK && nLang != LANGUAGE_ENGLISH_US)
 {
 sal_Int32 nCheckPos;
 SvNumFormatType nType = SvNumFormatType::DEFINED;


core.git: Branch 'distro/collabora/co-24.04' - svl/source

2024-04-28 Thread Szymon Kłos (via logerrit)
 svl/source/numbers/zforlist.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit ec1ce8049ed36d5117e93bb6af5e0798010b28dd
Author: Szymon Kłos 
AuthorDate: Fri Apr 26 12:36:14 2024 +0200
Commit: Tomaž Vajngerl 
CommitDate: Mon Apr 29 07:58:40 2024 +0200

lok: save correct number format in multi-lang session

Number formats can have different keywords in different
languages: D - Day(EN), T - Tag(DE).
This can cause problem when we use format which will not
be recognized by current number formatter, then we put
unknown keyword as string in quotes. As the result we get
for example: formatCode=""TT."mm".""

The problem exists especially in multi-language setup in LOK
when we use non-English languages:
1. open xlsx using FR
2. join with DE
3. modify number formats in both
4. leave spreadsheet with both so it will be saved
Result: after we open it again we have some keywords as
strings, user has to apply new number format to see the
real value
    
Signed-off-by: Szymon Kłos 
Change-Id: Ice04d890b38cd2d08d06f41fc7b3cc55f64fadbe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166719
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tomaž Vajngerl 

diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 3d2fadbacbad..a81dc68860bb 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -901,6 +902,7 @@ OUString SvNumberFormatter::GetFormatStringForExcel( 
sal_uInt32 nKey, const NfKe
 }
 else
 {
+bool bIsLOK = comphelper::LibreOfficeKit::isActive();
 bool bSystemLanguage = false;
 LanguageType nLang = pEntry->GetLanguage();
 if (nLang == LANGUAGE_SYSTEM)
@@ -908,7 +910,7 @@ OUString SvNumberFormatter::GetFormatStringForExcel( 
sal_uInt32 nKey, const NfKe
 bSystemLanguage = true;
 nLang = SvtSysLocale().GetLanguageTag().getLanguageType();
 }
-if (nLang != LANGUAGE_ENGLISH_US)
+if (!bIsLOK && nLang != LANGUAGE_ENGLISH_US)
 {
 sal_Int32 nCheckPos;
 SvNumFormatType nType = SvNumFormatType::DEFINED;


core.git: Branch 'distro/collabora/co-23.05' - svl/source

2024-04-28 Thread Szymon Kłos (via logerrit)
 svl/source/numbers/zforlist.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 7836cb7e90d0214cac08228f5e527322ed6f955c
Author: Szymon Kłos 
AuthorDate: Fri Apr 26 12:36:14 2024 +0200
Commit: Tomaž Vajngerl 
CommitDate: Mon Apr 29 07:58:05 2024 +0200

lok: save correct number format in multi-lang session

Number formats can have different keywords in different
languages: D - Day(EN), T - Tag(DE).
This can cause problem when we use format which will not
be recognized by current number formatter, then we put
unknown keyword as string in quotes. As the result we get
for example: formatCode=""TT."mm".""

The problem exists especially in multi-language setup in LOK
when we use non-English languages:
1. open xlsx using FR
2. join with DE
3. modify number formats in both
4. leave spreadsheet with both so it will be saved
Result: after we open it again we have some keywords as
strings, user has to apply new number format to see the
real value
    
Signed-off-by: Szymon Kłos 
Change-Id: Ice04d890b38cd2d08d06f41fc7b3cc55f64fadbe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166707
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tomaž Vajngerl 

diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index ca8b6524b9e2..912279c3b26a 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -916,6 +917,7 @@ OUString SvNumberFormatter::GetFormatStringForExcel( 
sal_uInt32 nKey, const NfKe
 }
 else
 {
+bool bIsLOK = comphelper::LibreOfficeKit::isActive();
 bool bSystemLanguage = false;
 LanguageType nLang = pEntry->GetLanguage();
 if (nLang == LANGUAGE_SYSTEM)
@@ -923,7 +925,7 @@ OUString SvNumberFormatter::GetFormatStringForExcel( 
sal_uInt32 nKey, const NfKe
 bSystemLanguage = true;
 nLang = SvtSysLocale().GetLanguageTag().getLanguageType();
 }
-if (nLang != LANGUAGE_ENGLISH_US)
+if (!bIsLOK && nLang != LANGUAGE_ENGLISH_US)
 {
 sal_Int32 nCheckPos;
 SvNumFormatType nType = SvNumFormatType::DEFINED;


core.git: Branch 'distro/collabora/co-23.05' - sw/source

2024-04-04 Thread Szymon Kłos (via logerrit)
 sw/source/core/frmedt/feshview.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit e94b113bd4fdd9f6a2604b870b77678e5a3574c8
Author: Szymon Kłos 
AuthorDate: Wed Apr 3 10:29:36 2024 +0200
Commit: Szymon Kłos 
CommitDate: Thu Apr 4 09:47:13 2024 +0200

Check SwDrawContact before use

GetUserCall(pObj) can return nullptr

Blind fix for:

0  in SwFEShell::GetAnchorId() const () from 
/opt/collaboraoffice/program/../program/libswlo.so
1  in SwBaseShell::GetState(SfxItemSet&) () from 
/opt/collaboraoffice/program/../program/libswlo.so

Signed-off-by: Szymon Kłos 
Change-Id: I3e573678f2cf730f0d32dc235923495abc856974
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165737
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/frmedt/feshview.cxx 
b/sw/source/core/frmedt/feshview.cxx
index a7e1e2228c12..85639f21fb4b 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -2380,6 +2380,8 @@ RndStdIds SwFEShell::GetAnchorId() const
 break;
 }
 SwDrawContact *pContact = 
static_cast(GetUserCall(pObj));
+if (!pContact)
+continue;
 RndStdIds nId = pContact->GetFormat()->GetAnchor().GetAnchorId();
 if ( nRet == RndStdIds(SHRT_MAX) )
 nRet = nId;


core.git: Branch 'distro/collabora/co-22.05' - sc/source

2024-03-10 Thread Szymon Kłos (via logerrit)
 sc/source/core/tool/webservicelink.cxx   |8 
 sc/source/ui/docshell/externalrefmgr.cxx |6 ++
 2 files changed, 14 insertions(+)

New commits:
commit 1278be1beeb2200c5df89fb3189342491fc42b2d
Author: Szymon Kłos 
AuthorDate: Mon Nov 27 09:56:27 2023 +0100
Commit: Aron Budea 
CommitDate: Mon Mar 11 05:11:48 2024 +0100

lok: Block requests to load external references

- currently in LOK case we don't open multiple files in
  one "environment"
- currently it opens import dialog which is synchronous - and that
  blocks whole app

Change-Id: I11c2c7f602ecf1e29b3d6fb2930ce873749bc2ef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159984
Tested-by: Jenkins CollaboraOffice 
    Reviewed-by: Szymon Kłos 
(cherry picked from commit 42109bda9972738b6e7a4448127458c7d24be4dc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164505

diff --git a/sc/source/core/tool/webservicelink.cxx 
b/sc/source/core/tool/webservicelink.cxx
index 12fe4785ebca..a1c307eb8e70 100644
--- a/sc/source/core/tool/webservicelink.cxx
+++ b/sc/source/core/tool/webservicelink.cxx
@@ -7,6 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -35,6 +36,13 @@ sfx2::SvBaseLink::UpdateResult 
ScWebServiceLink::DataChanged(const OUString&, co
 aResult.clear();
 bHasResult = false;
 
+if (comphelper::LibreOfficeKit::isActive())
+{
+SAL_WARN("sc.ui", "ScWebServiceLink::DataChanged: blocked access to 
external file: \""
+  << aURL << "\"");
+return ERROR_GENERAL;
+}
+
 css::uno::Reference xFileAccess
 = 
css::ucb::SimpleFileAccess::create(comphelper::getProcessComponentContext());
 if (!xFileAccess.is())
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx 
b/sc/source/ui/docshell/externalrefmgr.cxx
index 4e0512a711a6..329a7274b7e7 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -2530,6 +2530,12 @@ SfxObjectShellRef 
ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, OUSt
 if (!isFileLoadable(aFile))
 return nullptr;
 
+if (comphelper::LibreOfficeKit::isActive())
+{
+SAL_WARN( "sc.ui", "ScExternalRefManager::loadSrcDocument: blocked 
access to external file: \"" << aFile << "\"");
+return nullptr;
+}
+
 OUString aOptions = pFileData->maFilterOptions;
 if ( !pFileData->maFilterName.isEmpty() )
 rFilter = pFileData->maFilterName;  // don't overwrite stored 
filter with guessed filter


core.git: sc/source

2024-02-27 Thread Szymon Kłos (via logerrit)
 sc/source/ui/view/tabvwsh4.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit d0873e6c0faff565fabd50767a03e709653c039d
Author: Szymon Kłos 
AuthorDate: Mon Feb 26 15:39:30 2024 +0100
Commit: Gülşah Köse 
CommitDate: Tue Feb 27 17:13:04 2024 +0100

lok: don't hide tooltim on every action

Signed-off-by: Szymon Kłos 
Change-Id: I62f69071a4857f7413a995da1ff9fc6ba2f942d2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163977
Tested-by: Jenkins
Reviewed-by: Gülşah Köse 

diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index da9ce6851087..8236256b25e8 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -270,7 +270,9 @@ void ScTabViewShell::Deactivate(bool bMDI)
 {
 HideNoteMarker();   // note marker
 
-if ( pHdl )
+// in LOK case this could be trigerred on every action from other view 
(doc_setView)
+// we don't want to hide tooltip only because other view did some 
action
+if ( pHdl && !comphelper::LibreOfficeKit::isActive() )
 pHdl->HideTip();// Hide formula auto input tip
 }
 }


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-02-27 Thread Szymon Kłos (via logerrit)
 sc/source/ui/view/tabvwsh4.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 2a2a9c179801f3dff95ac44468b1d61795677090
Author: Szymon Kłos 
AuthorDate: Mon Feb 26 15:39:30 2024 +0100
Commit: Andras Timar 
CommitDate: Tue Feb 27 09:30:51 2024 +0100

lok: don't hide tooltip on every action

Signed-off-by: Szymon Kłos 
Change-Id: I62f69071a4857f7413a995da1ff9fc6ba2f942d2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163947
Reviewed-by: Gülşah Köse 
Tested-by: Jenkins CollaboraOffice 
(cherry picked from commit 8b56971baa473547000eed4d4235977f5df0cfe5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163848

diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index 7d20ed10a085..0afd430728de 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -268,7 +268,9 @@ void ScTabViewShell::Deactivate(bool bMDI)
 {
 HideNoteMarker();   // note marker
 
-if ( pHdl )
+// in LOK case this could be trigerred on every action from other view 
(doc_setView)
+// we don't want to hide tooltip only because other view did some 
action
+if ( pHdl && !comphelper::LibreOfficeKit::isActive() )
 pHdl->HideTip();// Hide formula auto input tip
 }
 }


core.git: Branch 'distro/collabora/co-23.05' - sc/source

2024-02-26 Thread Szymon Kłos (via logerrit)
 sc/source/ui/view/tabvwsh4.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 41237d2910ef4a77387471affc3472300bc10836
Author: Szymon Kłos 
AuthorDate: Mon Feb 26 15:39:30 2024 +0100
Commit: Szymon Kłos 
CommitDate: Mon Feb 26 16:38:55 2024 +0100

lok: don't hide tooltim on every action

Signed-off-by: Szymon Kłos 
Change-Id: I62f69071a4857f7413a995da1ff9fc6ba2f942d2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163947
Reviewed-by: Gülşah Köse 
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index 2ff01b9f83e3..b83cbd27a31c 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -268,7 +268,9 @@ void ScTabViewShell::Deactivate(bool bMDI)
 {
 HideNoteMarker();   // note marker
 
-if ( pHdl )
+// in LOK case this could be trigerred on every action from other view 
(doc_setView)
+// we don't want to hide tooltip only because other view did some 
action
+if ( pHdl && !comphelper::LibreOfficeKit::isActive() )
 pHdl->HideTip();// Hide formula auto input tip
 }
 }


core.git: vcl/jsdialog

2024-02-23 Thread Szymon Kłos (via logerrit)
 vcl/jsdialog/jsdialogbuilder.cxx |7 ---
 1 file changed, 7 deletions(-)

New commits:
commit 0feb1b2c4a11317159195e451bf7a1a0dd755dd8
Author: Szymon Kłos 
AuthorDate: Wed Feb 21 10:23:00 2024 +0100
Commit: Caolán McNamara 
CommitDate: Fri Feb 23 11:54:09 2024 +0100

jsdialog: don't duplicate MessageDialog messages

Remove hardcoded out-of-queue message for MessageDialog.
Now we send the messages in JSMessageDialog::run().
This prevents us from overwriting correct jsdialog window
in Online when we see messages before document was loaded
(from interaction handlers, like: macro warning, corrupted
file, etc.)

Change-Id: I364ac8460507dd6613b978230c9cf61cc5dfe91d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163679
Reviewed-by: Michael Meeks 
Tested-by: Jenkins CollaboraOffice 
(cherry picked from commit 5ee46b44d207a0416623a5c506bb2052052500a7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163767
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index abd57bf32b85..a7199e2ed960 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -1312,13 +1312,6 @@ JSInstanceBuilder::CreateMessageDialog(weld::Widget* 
pParent, VclMessageType eMe
 pNotifier = xMessageDialog->GetLOKNotifier();
 if (pNotifier)
 {
-tools::JsonWriter aJsonWriter;
-xMessageDialog->DumpAsPropertyTree(aJsonWriter);
-aJsonWriter.put("id", xMessageDialog->GetLOKWindowId());
-aJsonWriter.put("jsontype", "dialog");
-OString message(aJsonWriter.finishAndGetAsOString());
-pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, message);
-
 OUString sWindowId = 
OUString::number(xMessageDialog->GetLOKWindowId());
 InsertWindowToMap(sWindowId);
 xMessageDialog->SetLOKTunnelingState(false);


core.git: Branch 'distro/collabora/co-24.04' - vcl/jsdialog

2024-02-21 Thread Szymon Kłos (via logerrit)
 vcl/jsdialog/jsdialogbuilder.cxx |7 ---
 1 file changed, 7 deletions(-)

New commits:
commit 5ee46b44d207a0416623a5c506bb2052052500a7
Author: Szymon Kłos 
AuthorDate: Wed Feb 21 10:23:00 2024 +0100
Commit: Szymon Kłos 
CommitDate: Wed Feb 21 13:06:29 2024 +0100

jsdialog: don't duplicate MessageDialog messages

Remove hardcoded out-of-queue message for MessageDialog.
Now we send the messages in JSMessageDialog::run().
This prevents us from overwriting correct jsdialog window
in Online when we see messages before document was loaded
(from interaction handlers, like: macro warning, corrupted
file, etc.)

Change-Id: I364ac8460507dd6613b978230c9cf61cc5dfe91d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163679
Reviewed-by: Michael Meeks 
Tested-by: Jenkins CollaboraOffice 

diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 48946baa15f9..904ee9076f79 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -1310,13 +1310,6 @@ JSInstanceBuilder::CreateMessageDialog(weld::Widget* 
pParent, VclMessageType eMe
 pNotifier = xMessageDialog->GetLOKNotifier();
 if (pNotifier)
 {
-tools::JsonWriter aJsonWriter;
-xMessageDialog->DumpAsPropertyTree(aJsonWriter);
-aJsonWriter.put("id", xMessageDialog->GetLOKWindowId());
-aJsonWriter.put("jsontype", "dialog");
-OString message(aJsonWriter.finishAndGetAsOString());
-pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, message);
-
 OUString sWindowId = 
OUString::number(xMessageDialog->GetLOKWindowId());
 InsertWindowToMap(sWindowId);
 xMessageDialog->SetLOKTunnelingState(false);


core.git: Branch 'distro/collabora/co-24.04' - vcl/inc

2024-02-13 Thread Szymon Kłos (via logerrit)
 vcl/inc/jsdialog/jsdialogbuilder.hxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 19a70b8c4b6d4886e8b65c85bb737f92369569a0
Author: Szymon Kłos 
AuthorDate: Mon Feb 12 22:11:25 2024 +0100
Commit: Szymon Kłos 
CommitDate: Tue Feb 13 11:57:52 2024 +0100

jsdialog: use action for set_sensitive

This will reduce protocol volume as we will send short
message instead of JSON for the complete widget.

Signed-off-by: Szymon Kłos 
Change-Id: I5e7541915f7e2da4bf822b99a05cc3066073334e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163261
Reviewed-by: Caolán McNamara 

diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx 
b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 6e611c4f962c..edd49c1804a7 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -420,7 +420,12 @@ public:
 bool bIsSensitive = BaseInstanceClass::get_sensitive();
 BaseInstanceClass::set_sensitive(sensitive);
 if (bIsSensitive != sensitive)
-sendUpdate();
+{
+std::unique_ptr pMap
+= std::make_unique();
+(*pMap)[ACTION_TYPE ""_ostr] = (sensitive ? u"enable" : 
u"disable");
+sendAction(std::move(pMap));
+}
 }
 
 virtual css::uno::Reference 
get_drop_target() override


core.git: vcl/inc

2024-02-12 Thread Szymon Kłos (via logerrit)
 vcl/inc/jsdialog/jsdialogbuilder.hxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 199b8ef1dffd3ef46b2319d9992c83ab47ccea05
Author: Szymon Kłos 
AuthorDate: Mon Feb 12 22:11:25 2024 +0100
Commit: Szymon Kłos 
CommitDate: Tue Feb 13 08:14:52 2024 +0100

jsdialog: use action for set_sensitive

This will reduce protocol volume as we will send short
message instead of JSON for the complete widget.

Signed-off-by: Szymon Kłos 
Change-Id: I5e7541915f7e2da4bf822b99a05cc3066073334e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163279
Tested-by: Jenkins

diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx 
b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index e4fdd266851a..e24ff1589655 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -422,7 +422,12 @@ public:
 bool bIsSensitive = BaseInstanceClass::get_sensitive();
 BaseInstanceClass::set_sensitive(sensitive);
 if (bIsSensitive != sensitive)
-sendUpdate();
+{
+std::unique_ptr pMap
+= std::make_unique();
+(*pMap)[ACTION_TYPE ""_ostr] = (sensitive ? u"enable" : 
u"disable");
+sendAction(std::move(pMap));
+}
 }
 
 virtual css::uno::Reference 
get_drop_target() override


core.git: vcl/jsdialog

2024-02-12 Thread Szymon Kłos (via logerrit)
 vcl/jsdialog/enabled.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit b34c69dd09069c4bb34fe4fe3225d304317999f1
Author: Szymon Kłos 
AuthorDate: Sun Jan 28 22:28:40 2024 +0100
Commit: Szymon Kłos 
CommitDate: Mon Feb 12 22:48:02 2024 +0100

jsdialog: enable animation properties in impress

to test:
1. click on any shape in Impress
2. go to Animation tab in sidebar
3. "add" animation
4. double-click on added animation on the list

Signed-off-by: Szymon Kłos 
Change-Id: I009cbdd295fac4f4533101c89d5c0268fbbe633a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162725
Tested-by: Jenkins

diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index beb12b5dd081..6d5acc3dc538 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -167,6 +167,10 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
 || rUIFile == u"modules/sdraw/ui/drawpagedialog.ui"
 || rUIFile == u"modules/sdraw/ui/drawparadialog.ui"
 // simpress
+|| rUIFile == u"modules/simpress/ui/customanimationeffecttab.ui"
+|| rUIFile == u"modules/simpress/ui/customanimationproperties.ui"
+|| rUIFile == u"modules/simpress/ui/customanimationtexttab.ui"
+|| rUIFile == u"modules/simpress/ui/customanimationtimingtab.ui"
 || rUIFile == u"modules/simpress/ui/headerfooterdialog.ui"
 || rUIFile == u"modules/simpress/ui/headerfootertab.ui"
 // swriter


core.git: vcl/jsdialog

2024-01-30 Thread Szymon Kłos (via logerrit)
 vcl/jsdialog/enabled.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 650d65326627a5cfd5dd59f0876a22583bc52d3f
Author: Szymon Kłos 
AuthorDate: Sun Jan 28 22:15:49 2024 +0100
Commit: Szymon Kłos 
CommitDate: Tue Jan 30 14:46:43 2024 +0100

jsdialog: enable paste special in calc

to test:
- copy few cells in calc
- ctrl + shift + alt + v

Signed-off-by: Szymon Kłos 
Change-Id: Iac3a98c50355e2390a36195ba92ef25a30d73e75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162673
(cherry picked from commit af171cd8ca13cfc6d530abc89c7c3b85d0204628)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162712
Tested-by: Jenkins

diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index c8ed0d73efad..d792128f3360 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -125,6 +125,7 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
 || rUIFile == u"modules/scalc/ui/optimalrowheightdialog.ui"
 || rUIFile == u"modules/scalc/ui/pagetemplatedialog.ui"
 || rUIFile == u"modules/scalc/ui/paratemplatedialog.ui"
+|| rUIFile == u"modules/scalc/ui/pastespecial.ui"
 || rUIFile == u"modules/scalc/ui/pivotfielddialog.ui"
 || rUIFile == u"modules/scalc/ui/pivottablelayoutdialog.ui"
 || rUIFile == u"modules/scalc/ui/regressiondialog.ui"


core.git: Branch 'distro/collabora/co-24.04' - vcl/jsdialog

2024-01-29 Thread Szymon Kłos (via logerrit)
 vcl/jsdialog/enabled.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 4b3f04df684354b39a2791790c2ec2a4828c83ed
Author: Szymon Kłos 
AuthorDate: Sun Jan 28 22:15:49 2024 +0100
Commit: Szymon Kłos 
CommitDate: Tue Jan 30 08:15:34 2024 +0100

jsdialog: enable paste special in calc

to test:
- copy few cells in calc
- ctrl + shift + alt + v

Signed-off-by: Szymon Kłos 
Change-Id: Iac3a98c50355e2390a36195ba92ef25a30d73e75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162673
(cherry picked from commit 3cabc2504bbd2bc357fab97e16c14c05128db670)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162711
Tested-by: Jenkins CollaboraOffice 

diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index c8ed0d73efad..d792128f3360 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -125,6 +125,7 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
 || rUIFile == u"modules/scalc/ui/optimalrowheightdialog.ui"
 || rUIFile == u"modules/scalc/ui/pagetemplatedialog.ui"
 || rUIFile == u"modules/scalc/ui/paratemplatedialog.ui"
+|| rUIFile == u"modules/scalc/ui/pastespecial.ui"
 || rUIFile == u"modules/scalc/ui/pivotfielddialog.ui"
 || rUIFile == u"modules/scalc/ui/pivottablelayoutdialog.ui"
 || rUIFile == u"modules/scalc/ui/regressiondialog.ui"


core.git: 2 commits - include/sfx2 include/vcl sc/uiconfig sd/uiconfig sfx2/source sw/uiconfig vcl/source

2024-01-29 Thread Szymon Kłos (via logerrit)
 include/sfx2/notebookbar/SfxNotebookBar.hxx|2 ++
 include/vcl/WeldedTabbedNotebookbar.hxx|4 
 sc/uiconfig/scalc/ui/notebookbar_online.ui |   16 
 sd/uiconfig/sdraw/ui/notebookbar_online.ui |   16 
 sd/uiconfig/simpress/ui/notebookbar_online.ui  |   16 
 sfx2/source/notebookbar/SfxNotebookBar.cxx |   13 ++---
 sw/uiconfig/swriter/ui/notebookbar_online.ui   |   16 
 vcl/source/control/WeldedTabbedNotebookbar.cxx |1 +
 8 files changed, 81 insertions(+), 3 deletions(-)

New commits:
commit 37e81fcc16127c43b3cd7e89d82a362cfc15d227
Author: Szymon Kłos 
AuthorDate: Mon Jan 29 11:42:17 2024 +0100
Commit: Tomaž Vajngerl 
CommitDate: Tue Jan 30 07:40:36 2024 +0100

lok: notebookbar: fix number format field

- number format filed is inside different container in online
- make it working again by putting into standalone
  sfxlo-NotebookbarToolBox

Change-Id: Iecf85aad598cc5a68b5128e32f27818f2b372d92
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162683
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162705
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sc/uiconfig/scalc/ui/notebookbar_online.ui 
b/sc/uiconfig/scalc/ui/notebookbar_online.ui
index 599bef675503..bea44e0eeb61 100644
--- a/sc/uiconfig/scalc/ui/notebookbar_online.ui
+++ b/sc/uiconfig/scalc/ui/notebookbar_online.ui
@@ -58,7 +58,7 @@
   
 
 
-  
+  
 True
 True
 icons
@@ -73,6 +73,12 @@
 True
   
 
+  
+  
+0
+0
+  
+  
 
   
 True
commit 16890dc78a69146d16e672e718148f462d63f587
Author: Szymon Kłos 
AuthorDate: Tue Jan 9 14:47:35 2024 +0100
Commit: Tomaž Vajngerl 
CommitDate: Tue Jan 30 07:40:26 2024 +0100

lok: notebookbar: enable currency dropdown

Add .uno:NumberFormatCurrency item to .ui
Use weld:: way of widgets creation so we can inject
jsdialog code and popup will be correctly registered.

Signed-off-by: Szymon Kłos 
Change-Id: Ib57e1cad617ca5c7198d67e107441ba062580f06
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162623
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162710
Reviewed-by: Tomaž Vajngerl 
Tested-by: Tomaž Vajngerl 

diff --git a/include/sfx2/notebookbar/SfxNotebookBar.hxx 
b/include/sfx2/notebookbar/SfxNotebookBar.hxx
index 7bf34d1cbf7e..cd94ddad7b1e 100644
--- a/include/sfx2/notebookbar/SfxNotebookBar.hxx
+++ b/include/sfx2/notebookbar/SfxNotebookBar.hxx
@@ -33,6 +33,7 @@ class SfxBindings;
 class SfxViewFrame;
 class SfxViewShell;
 class SystemWindow;
+class ToolbarUnoDispatcher;
 class WeldedTabbedNotebookbar;
 
 namespace sfx2
@@ -74,6 +75,7 @@ public:
 private:
 static bool m_bLock;
 static bool m_bHide;
+static std::unique_ptr m_xCalcToolboxDispatcher;
 
 static std::map>
 m_pNotebookBarWeldedWrapper;
diff --git a/include/vcl/WeldedTabbedNotebookbar.hxx 
b/include/vcl/WeldedTabbedNotebookbar.hxx
index 073902f2d166..a1fffdd6dd39 100644
--- a/include/vcl/WeldedTabbedNotebookbar.hxx
+++ b/include/vcl/WeldedTabbedNotebookbar.hxx
@@ -23,12 +23,16 @@ class VCL_DLLPUBLIC WeldedTabbedNotebookbar
 std::unique_ptr m_xBuilder;
 
 std::unique_ptr m_xContainer;
+std::unique_ptr m_xWeldedToolbar;
 
 public:
 WeldedTabbedNotebookbar(const VclPtr& pContainerWindow,
 const OUString& rUIFilePath,
 const css::uno::Reference& 
rFrame,
 sal_uInt64 nWindowId);
+
+weld::Toolbar& getWeldedToolbar() { return *m_xWeldedToolbar; }
+weld::Builder& getBuilder() { return *m_xBuilder; }
 };
 
 #endif // INCLUDED_SFX2_NOTEBOOKBAR_SFXNOTEBOOKBAR_HXX
diff --git a/sc/uiconfig/scalc/ui/notebookbar_online.ui 
b/sc/uiconfig/scalc/ui/notebookbar_online.ui
index adf29a1ab43c..599bef675503 100644
--- a/sc/uiconfig/scalc/ui/notebookbar_online.ui
+++ b/sc/uiconfig/scalc/ui/notebookbar_online.ui
@@ -58,7 +58,7 @@
   
 
 
-  
+  
 True
 True
 icons
@@ -73,6 +73,16 @@
 True
   
 
+
+  
+True
+.uno:NumberFormatCurrency
+  
+  
+True
+True
+  
+
   
   
 False
diff --git a/sd/uiconfig/sdraw/ui/notebookbar_online.ui 
b/sd/uiconfig/sdraw/ui/notebookbar_online.ui
index 223eedce4c97..7fe79d180a0f 100644
--- a/sd/uiconfig/sdraw/ui/notebookbar_online.ui
+++ b/sd/uiconfig/sdraw/ui/notebookbar_online.ui
@@ -57,6 +

core.git: Branch 'distro/collabora/co-23.05' - vcl/jsdialog

2024-01-29 Thread Szymon Kłos (via logerrit)
 vcl/jsdialog/enabled.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 035476042f52712911f457841a3757dac90361f7
Author: Szymon Kłos 
AuthorDate: Sun Jan 28 22:15:49 2024 +0100
Commit: Michael Meeks 
CommitDate: Mon Jan 29 22:15:30 2024 +0100

jsdialog: enable paste special in calc

to test:
- copy few cells in calc
- ctrl + shift + alt + v

Signed-off-by: Szymon Kłos 
Change-Id: Iac3a98c50355e2390a36195ba92ef25a30d73e75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162673
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Michael Meeks 

diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index c8ed0d73efad..d792128f3360 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -125,6 +125,7 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
 || rUIFile == u"modules/scalc/ui/optimalrowheightdialog.ui"
 || rUIFile == u"modules/scalc/ui/pagetemplatedialog.ui"
 || rUIFile == u"modules/scalc/ui/paratemplatedialog.ui"
+|| rUIFile == u"modules/scalc/ui/pastespecial.ui"
 || rUIFile == u"modules/scalc/ui/pivotfielddialog.ui"
 || rUIFile == u"modules/scalc/ui/pivottablelayoutdialog.ui"
 || rUIFile == u"modules/scalc/ui/regressiondialog.ui"


core.git: Branch 'distro/collabora/co-24.04' - sc/uiconfig

2024-01-29 Thread Szymon Kłos (via logerrit)
 sc/uiconfig/scalc/ui/notebookbar_online.ui |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 37fee68f4247dabbd68b7a1c7c6a32f0de946793
Author: Szymon Kłos 
AuthorDate: Mon Jan 29 11:42:17 2024 +0100
Commit: Szymon Kłos 
CommitDate: Mon Jan 29 22:06:45 2024 +0100

lok: notebookbar: fix number format field

- number format filed is inside different container in online
- make it working again by putting into standalone
  sfxlo-NotebookbarToolBox

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

diff --git a/sc/uiconfig/scalc/ui/notebookbar_online.ui 
b/sc/uiconfig/scalc/ui/notebookbar_online.ui
index 599bef675503..bea44e0eeb61 100644
--- a/sc/uiconfig/scalc/ui/notebookbar_online.ui
+++ b/sc/uiconfig/scalc/ui/notebookbar_online.ui
@@ -58,7 +58,7 @@
   
 
 
-  
+  
 True
 True
 icons
@@ -73,6 +73,12 @@
 True
   
 
+  
+  
+0
+0
+  
+  
 
   
 True


core.git: Branch 'distro/collabora/co-23.05' - sc/uiconfig

2024-01-29 Thread Szymon Kłos (via logerrit)
 sc/uiconfig/scalc/ui/notebookbar_online.ui |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit e60029e49aef287d1c6c6598168323599732dc0f
Author: Szymon Kłos 
AuthorDate: Mon Jan 29 11:42:17 2024 +0100
Commit: Szymon Kłos 
CommitDate: Mon Jan 29 17:39:07 2024 +0100

lok: notebookbar: fix number format field

- number format filed is inside different container in online
- make it working again by putting into standalone
  sfxlo-NotebookbarToolBox

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

diff --git a/sc/uiconfig/scalc/ui/notebookbar_online.ui 
b/sc/uiconfig/scalc/ui/notebookbar_online.ui
index 599bef675503..bea44e0eeb61 100644
--- a/sc/uiconfig/scalc/ui/notebookbar_online.ui
+++ b/sc/uiconfig/scalc/ui/notebookbar_online.ui
@@ -58,7 +58,7 @@
   
 
 
-  
+  
 True
 True
 icons
@@ -73,6 +73,12 @@
 True
   
 
+  
+  
+0
+0
+  
+  
 
   
 True


core.git: Branch 'distro/collabora/co-24.04' - include/sfx2 include/vcl sc/uiconfig sd/uiconfig sfx2/source sw/uiconfig vcl/source

2024-01-29 Thread Szymon Kłos (via logerrit)
 include/sfx2/notebookbar/SfxNotebookBar.hxx|2 ++
 include/vcl/WeldedTabbedNotebookbar.hxx|4 
 sc/uiconfig/scalc/ui/notebookbar_online.ui |   12 +++-
 sd/uiconfig/sdraw/ui/notebookbar_online.ui |   16 
 sd/uiconfig/simpress/ui/notebookbar_online.ui  |   16 
 sfx2/source/notebookbar/SfxNotebookBar.cxx |   13 ++---
 sw/uiconfig/swriter/ui/notebookbar_online.ui   |   16 
 vcl/source/control/WeldedTabbedNotebookbar.cxx |1 +
 8 files changed, 76 insertions(+), 4 deletions(-)

New commits:
commit fb280f3a55279fe239e481162730fee99e85
Author: Szymon Kłos 
AuthorDate: Tue Jan 9 14:47:35 2024 +0100
Commit: Szymon Kłos 
CommitDate: Mon Jan 29 11:57:11 2024 +0100

lok: notebookbar: enable currency dropdown

Add .uno:NumberFormatCurrency item to .ui
Use weld:: way of widgets creation so we can inject
jsdialog code and popup will be correctly registered.

Signed-off-by: Szymon Kłos 
Change-Id: Ib57e1cad617ca5c7198d67e107441ba062580f06
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161829
(cherry picked from commit 91df0cafa87692b5c924c44b9c7adf4a8d6f3e34)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162623

diff --git a/include/sfx2/notebookbar/SfxNotebookBar.hxx 
b/include/sfx2/notebookbar/SfxNotebookBar.hxx
index 7bf34d1cbf7e..cd94ddad7b1e 100644
--- a/include/sfx2/notebookbar/SfxNotebookBar.hxx
+++ b/include/sfx2/notebookbar/SfxNotebookBar.hxx
@@ -33,6 +33,7 @@ class SfxBindings;
 class SfxViewFrame;
 class SfxViewShell;
 class SystemWindow;
+class ToolbarUnoDispatcher;
 class WeldedTabbedNotebookbar;
 
 namespace sfx2
@@ -74,6 +75,7 @@ public:
 private:
 static bool m_bLock;
 static bool m_bHide;
+static std::unique_ptr m_xCalcToolboxDispatcher;
 
 static std::map>
 m_pNotebookBarWeldedWrapper;
diff --git a/include/vcl/WeldedTabbedNotebookbar.hxx 
b/include/vcl/WeldedTabbedNotebookbar.hxx
index 073902f2d166..a1fffdd6dd39 100644
--- a/include/vcl/WeldedTabbedNotebookbar.hxx
+++ b/include/vcl/WeldedTabbedNotebookbar.hxx
@@ -23,12 +23,16 @@ class VCL_DLLPUBLIC WeldedTabbedNotebookbar
 std::unique_ptr m_xBuilder;
 
 std::unique_ptr m_xContainer;
+std::unique_ptr m_xWeldedToolbar;
 
 public:
 WeldedTabbedNotebookbar(const VclPtr& pContainerWindow,
 const OUString& rUIFilePath,
 const css::uno::Reference& 
rFrame,
 sal_uInt64 nWindowId);
+
+weld::Toolbar& getWeldedToolbar() { return *m_xWeldedToolbar; }
+weld::Builder& getBuilder() { return *m_xBuilder; }
 };
 
 #endif // INCLUDED_SFX2_NOTEBOOKBAR_SFXNOTEBOOKBAR_HXX
diff --git a/sc/uiconfig/scalc/ui/notebookbar_online.ui 
b/sc/uiconfig/scalc/ui/notebookbar_online.ui
index adf29a1ab43c..599bef675503 100644
--- a/sc/uiconfig/scalc/ui/notebookbar_online.ui
+++ b/sc/uiconfig/scalc/ui/notebookbar_online.ui
@@ -58,7 +58,7 @@
   
 
 
-  
+  
 True
 True
 icons
@@ -73,6 +73,16 @@
 True
   
 
+
+  
+True
+.uno:NumberFormatCurrency
+  
+  
+True
+True
+  
+
   
   
 False
diff --git a/sd/uiconfig/sdraw/ui/notebookbar_online.ui 
b/sd/uiconfig/sdraw/ui/notebookbar_online.ui
index 223eedce4c97..7fe79d180a0f 100644
--- a/sd/uiconfig/sdraw/ui/notebookbar_online.ui
+++ b/sd/uiconfig/sdraw/ui/notebookbar_online.ui
@@ -57,6 +57,22 @@
 1
   
 
+
+  
+True
+True
+icons
+False
+
+  
+
+  
+  
+False
+True
+0
+  
+
   
   
 0
diff --git a/sd/uiconfig/simpress/ui/notebookbar_online.ui 
b/sd/uiconfig/simpress/ui/notebookbar_online.ui
index 223eedce4c97..7fe79d180a0f 100644
--- a/sd/uiconfig/simpress/ui/notebookbar_online.ui
+++ b/sd/uiconfig/simpress/ui/notebookbar_online.ui
@@ -57,6 +57,22 @@
 1
   
 
+
+  
+True
+True
+icons
+False
+
+  
+
+  
+  
+False
+True
+0
+  
+
   
   
 0
diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx 
b/sfx2/source/notebookbar/SfxNotebookBar.cxx
index 8e9c2c9ca494..9c33b3ef5fb9 100644
--- a/sfx2/source/notebookbar/SfxNotebookBar.cxx
+++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -41,6 +42,7 @@ const char MERGE_NOTEBOOKBAR_URL[] = "URL"

core.git: Branch 'distro/collabora/co-23.05' - include/sfx2 include/vcl sc/uiconfig sd/uiconfig sfx2/source sw/uiconfig vcl/source

2024-01-29 Thread Szymon Kłos (via logerrit)
 include/sfx2/notebookbar/SfxNotebookBar.hxx|2 ++
 include/vcl/WeldedTabbedNotebookbar.hxx|4 
 sc/uiconfig/scalc/ui/notebookbar_online.ui |   12 +++-
 sd/uiconfig/sdraw/ui/notebookbar_online.ui |   16 
 sd/uiconfig/simpress/ui/notebookbar_online.ui  |   16 
 sfx2/source/notebookbar/SfxNotebookBar.cxx |   13 ++---
 sw/uiconfig/swriter/ui/notebookbar_online.ui   |   16 
 vcl/source/control/WeldedTabbedNotebookbar.cxx |1 +
 8 files changed, 76 insertions(+), 4 deletions(-)

New commits:
commit 91df0cafa87692b5c924c44b9c7adf4a8d6f3e34
Author: Szymon Kłos 
AuthorDate: Tue Jan 9 14:47:35 2024 +0100
Commit: Tomaž Vajngerl 
CommitDate: Mon Jan 29 11:27:15 2024 +0100

lok: notebookbar: enable currency dropdown

Add .uno:NumberFormatCurrency item to .ui
Use weld:: way of widgets creation so we can inject
jsdialog code and popup will be correctly registered.

Signed-off-by: Szymon Kłos 
Change-Id: Ib57e1cad617ca5c7198d67e107441ba062580f06
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161829
Tested-by: Tomaž Vajngerl 
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/sfx2/notebookbar/SfxNotebookBar.hxx 
b/include/sfx2/notebookbar/SfxNotebookBar.hxx
index 7bf34d1cbf7e..cd94ddad7b1e 100644
--- a/include/sfx2/notebookbar/SfxNotebookBar.hxx
+++ b/include/sfx2/notebookbar/SfxNotebookBar.hxx
@@ -33,6 +33,7 @@ class SfxBindings;
 class SfxViewFrame;
 class SfxViewShell;
 class SystemWindow;
+class ToolbarUnoDispatcher;
 class WeldedTabbedNotebookbar;
 
 namespace sfx2
@@ -74,6 +75,7 @@ public:
 private:
 static bool m_bLock;
 static bool m_bHide;
+static std::unique_ptr m_xCalcToolboxDispatcher;
 
 static std::map>
 m_pNotebookBarWeldedWrapper;
diff --git a/include/vcl/WeldedTabbedNotebookbar.hxx 
b/include/vcl/WeldedTabbedNotebookbar.hxx
index 073902f2d166..a1fffdd6dd39 100644
--- a/include/vcl/WeldedTabbedNotebookbar.hxx
+++ b/include/vcl/WeldedTabbedNotebookbar.hxx
@@ -23,12 +23,16 @@ class VCL_DLLPUBLIC WeldedTabbedNotebookbar
 std::unique_ptr m_xBuilder;
 
 std::unique_ptr m_xContainer;
+std::unique_ptr m_xWeldedToolbar;
 
 public:
 WeldedTabbedNotebookbar(const VclPtr& pContainerWindow,
 const OUString& rUIFilePath,
 const css::uno::Reference& 
rFrame,
 sal_uInt64 nWindowId);
+
+weld::Toolbar& getWeldedToolbar() { return *m_xWeldedToolbar; }
+weld::Builder& getBuilder() { return *m_xBuilder; }
 };
 
 #endif // INCLUDED_SFX2_NOTEBOOKBAR_SFXNOTEBOOKBAR_HXX
diff --git a/sc/uiconfig/scalc/ui/notebookbar_online.ui 
b/sc/uiconfig/scalc/ui/notebookbar_online.ui
index adf29a1ab43c..599bef675503 100644
--- a/sc/uiconfig/scalc/ui/notebookbar_online.ui
+++ b/sc/uiconfig/scalc/ui/notebookbar_online.ui
@@ -58,7 +58,7 @@
   
 
 
-  
+  
 True
 True
 icons
@@ -73,6 +73,16 @@
 True
   
 
+
+  
+True
+.uno:NumberFormatCurrency
+  
+  
+True
+True
+  
+
   
   
 False
diff --git a/sd/uiconfig/sdraw/ui/notebookbar_online.ui 
b/sd/uiconfig/sdraw/ui/notebookbar_online.ui
index 223eedce4c97..7fe79d180a0f 100644
--- a/sd/uiconfig/sdraw/ui/notebookbar_online.ui
+++ b/sd/uiconfig/sdraw/ui/notebookbar_online.ui
@@ -57,6 +57,22 @@
 1
   
 
+
+  
+True
+True
+icons
+False
+
+  
+
+  
+  
+False
+True
+0
+  
+
   
   
 0
diff --git a/sd/uiconfig/simpress/ui/notebookbar_online.ui 
b/sd/uiconfig/simpress/ui/notebookbar_online.ui
index 223eedce4c97..7fe79d180a0f 100644
--- a/sd/uiconfig/simpress/ui/notebookbar_online.ui
+++ b/sd/uiconfig/simpress/ui/notebookbar_online.ui
@@ -57,6 +57,22 @@
 1
   
 
+
+  
+True
+True
+icons
+False
+
+  
+
+  
+  
+False
+True
+0
+  
+
   
   
 0
diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx 
b/sfx2/source/notebookbar/SfxNotebookBar.cxx
index 5acd8d39a99a..e1a8cfb56bca 100644
--- a/sfx2/source/notebookbar/SfxNotebookBar.cxx
+++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -41,6 +42,7 @@ const char MERGE_NOTEBOOKBAR_URL[] = "URL";
 
 bool SfxNotebookBar::m_bLock = false;
 bool SfxNotebookBar::

core.git: sfx2/source

2024-01-29 Thread Szymon Kłos (via logerrit)
 sfx2/source/view/viewfrm.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 4eb62f0e9ca42d8e6302c04e74ee6f1e08c1419c
Author: Szymon Kłos 
AuthorDate: Fri Jan 26 16:54:14 2024 +0100
Commit: Szymon Kłos 
CommitDate: Mon Jan 29 09:51:50 2024 +0100

lok: always toggle sidebar deck

This fixes regression from:
commit 53fc5fa0fed077b7d11e39b710280f0a84b631ff
tdf#142978 Show a11y sidebar when finding issues on PDF export

LOK was unable to close sidebar

Change-Id: Icd96394523020c30e63858bc372ba136c2be8158
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162608
(cherry picked from commit 031f11bd9096fb192ced1328f9bbcd1b1903e3e7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162621
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index f50252984794..16b41843ba31 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -3406,8 +3406,11 @@ void SfxViewFrame::ChildWindowExecute( SfxRequest &rReq )
 if (pDeckIdItem)
 {
 const OUString aDeckId(pDeckIdItem->GetValue());
+// Compatibility with old LOK "toggle always"
+// TODO: check LOK with tdf#142978 Show a11y sidebar when finding 
issues on PDF export, hash: 53fc5fa
+const bool isLOK = comphelper::LibreOfficeKit::isActive();
 const SfxBoolItem* pToggleItem = 
rReq.GetArg(SID_SIDEBAR_DECK_TOGGLE);
-bool bToggle = pToggleItem && pToggleItem->GetValue();
+bool bToggle = isLOK || (pToggleItem && pToggleItem->GetValue());
 ::sfx2::sidebar::Sidebar::ShowDeck(aDeckId, this, bToggle);
 }
 rReq.Done();


core.git: Branch 'distro/collabora/co-24.04' - include/svx sc/source sw/source

2024-01-28 Thread Szymon Kłos (via logerrit)
 include/svx/DocumentColorHelper.hxx |   41 
 sc/source/core/data/document10.cxx  |   17 --
 sw/source/core/doc/docfmt.cxx   |   18 +--
 3 files changed, 52 insertions(+), 24 deletions(-)

New commits:
commit 22e656741725ab366aeed21cef92136808ac32cb
Author: Szymon Kłos 
AuthorDate: Mon Jan 15 09:49:18 2024 +0100
Commit: Szymon Kłos 
CommitDate: Mon Jan 29 08:38:29 2024 +0100

Use correct type when getting document colors

After commit 0460be8848b0ce02c07183e41dd7137ac3b94164
Send document colors with lok callback

There was issue detected by CI:
/sc/source/core/data/document10.cxx:198:46: runtime error: downcast of 
address 0x610efa40 which does not point to an object of type 'const 
SvxColorItem'
  0x610efa40: note: object is of type 'SvxBrushItem'
   00 00 00 00  b0 79 19 48 ce 7f 00 00  01 00 00 00 94 00 be be  4c 17 00 
00 a0 be be be  cc cc ff 00
^~~
vptr for 'SvxBrushItem'
  #0 0x7fce1fbed369 in ScDocument::GetDocColors() 
/sc/source/core/data/document10.cxx:198:46

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

diff --git a/include/svx/DocumentColorHelper.hxx 
b/include/svx/DocumentColorHelper.hxx
new file mode 100644
index ..71eccde99582
--- /dev/null
+++ b/include/svx/DocumentColorHelper.hxx
@@ -0,0 +1,41 @@
+/* -*- 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/.
+ *
+ */
+
+#pragma once
+
+#include 
+#include 
+#include 
+#include 
+
+namespace svx
+{
+namespace DocumentColorHelper
+{
+static inline Color getColorFromItem(const SvxColorItem* pItem) { return 
pItem->GetValue(); }
+
+static inline Color getColorFromItem(const SvxBrushItem* pItem) { return 
pItem->GetColor(); }
+
+template 
+void queryColors(const sal_uInt16 nAttrib, const SfxItemPool* pPool, 
std::set& rOutput)
+{
+for (const SfxPoolItem* pItem : pPool->GetItemSurrogates(nAttrib))
+{
+auto pColorItem = static_cast(pItem);
+Color aColor(getColorFromItem(pColorItem));
+if (COL_AUTO != aColor)
+rOutput.insert(aColor);
+}
+}
+}
+
+} // end of namespace svx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/document10.cxx 
b/sc/source/core/data/document10.cxx
index acf0f27672b0..df5057558934 100644
--- a/sc/source/core/data/document10.cxx
+++ b/sc/source/core/data/document10.cxx
@@ -22,7 +22,7 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -188,17 +188,10 @@ std::set ScDocument::GetDocColors()
 {
 std::set aDocColors;
 ScDocumentPool *pPool = GetPool();
-const sal_uInt16 pAttribs[] = {ATTR_BACKGROUND, ATTR_FONT_COLOR};
-for (sal_uInt16 nAttrib : pAttribs)
-{
-for (const SfxPoolItem* pItem : pPool->GetItemSurrogates(nAttrib))
-{
-const SvxColorItem *pColorItem = static_cast(pItem);
-Color aColor( pColorItem->GetValue() );
-if (COL_AUTO != aColor)
-aDocColors.insert(aColor);
-}
-}
+
+svx::DocumentColorHelper::queryColors(ATTR_BACKGROUND, 
pPool, aDocColors);
+svx::DocumentColorHelper::queryColors(ATTR_FONT_COLOR, 
pPool, aDocColors);
+
 return aDocColors;
 }
 
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 57c42c529eb1..d6c943dbcdc8 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -25,10 +25,10 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2036,17 +2036,11 @@ std::set SwDoc::GetDocColors()
 {
 std::set aDocColors;
 SwAttrPool& rPool = GetAttrPool();
-const sal_uInt16 pAttribs[] = {RES_CHRATR_COLOR, RES_CHRATR_HIGHLIGHT, 
RES_BACKGROUND};
-for (sal_uInt16 nAttrib : pAttribs)
-{
-for (const SfxPoolItem* pItem : rPool.GetItemSurrogates(nAttrib))
-{
-auto pColorItem = static_cast(pItem);
-Color aColor( pColorItem->GetValue() );
-if (COL_AUTO != aColor)
-aDocColors.insert(aColor);
-}
-}
+
+svx::DocumentColorHelper::queryColors(RES_CHRATR_COLOR, 
&rPool, aDocColors);
+svx::DocumentColorHelper::queryColors(RES_CHRATR_HIGHLIGHT, 
&rPool, aDocColors);
+svx::DocumentColorHelper::queryColors(RES_CHRATR_BACKGROUND, 
&rPool, aDocColors);
+
 return aDocColors;
 }
 


core.git: Branch 'distro/collabora/co-24.04' - sfx2/source

2024-01-28 Thread Szymon Kłos (via logerrit)
 sfx2/source/view/viewfrm.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 031f11bd9096fb192ced1328f9bbcd1b1903e3e7
Author: Szymon Kłos 
AuthorDate: Fri Jan 26 16:54:14 2024 +0100
Commit: Tomaž Vajngerl 
CommitDate: Mon Jan 29 04:47:59 2024 +0100

lok: always toggle sidebar deck

This fixes regression from:
commit 53fc5fa0fed077b7d11e39b710280f0a84b631ff
tdf#142978 Show a11y sidebar when finding issues on PDF export

LOK was unable to close sidebar

Change-Id: Icd96394523020c30e63858bc372ba136c2be8158
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162608
Tested-by: Szymon Kłos 
Reviewed-by: Tomaž Vajngerl 

diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index abb616ce5505..b76354b14705 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -3350,8 +3350,11 @@ void SfxViewFrame::ChildWindowExecute( SfxRequest &rReq )
 if (pDeckIdItem)
 {
 const OUString aDeckId(pDeckIdItem->GetValue());
+// Compatibility with old LOK "toggle always"
+// TODO: check LOK with tdf#142978 Show a11y sidebar when finding 
issues on PDF export, hash: 53fc5fa
+const bool isLOK = comphelper::LibreOfficeKit::isActive();
 const SfxBoolItem* pToggleItem = 
rReq.GetArg(SID_SIDEBAR_DECK_TOGGLE);
-bool bToggle = pToggleItem && pToggleItem->GetValue();
+bool bToggle = isLOK || (pToggleItem && pToggleItem->GetValue());
 ::sfx2::sidebar::Sidebar::ShowDeck(aDeckId, this, bToggle);
 }
 rReq.Done();


core.git: Branch 'libreoffice-24-2' - include/svx sc/source sw/source

2024-01-24 Thread Szymon Kłos (via logerrit)
 include/svx/DocumentColorHelper.hxx |   41 
 sc/source/core/data/document10.cxx  |   17 --
 sw/source/core/doc/docfmt.cxx   |   18 +--
 3 files changed, 52 insertions(+), 24 deletions(-)

New commits:
commit 9a19639b2bcfecc4387e720e6c01c3ba57ed00b7
Author: Szymon Kłos 
AuthorDate: Mon Jan 15 09:49:18 2024 +0100
Commit: Tomaž Vajngerl 
CommitDate: Wed Jan 24 15:33:26 2024 +0100

Use correct type when getting document colors

After commit 0460be8848b0ce02c07183e41dd7137ac3b94164
Send document colors with lok callback

There was issue detected by CI:
/sc/source/core/data/document10.cxx:198:46: runtime error: downcast of 
address 0x610efa40 which does not point to an object of type 'const 
SvxColorItem'
  0x610efa40: note: object is of type 'SvxBrushItem'
   00 00 00 00  b0 79 19 48 ce 7f 00 00  01 00 00 00 94 00 be be  4c 17 00 
00 a0 be be be  cc cc ff 00
^~~
vptr for 'SvxBrushItem'
  #0 0x7fce1fbed369 in ScDocument::GetDocColors() 
/sc/source/core/data/document10.cxx:198:46

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

diff --git a/include/svx/DocumentColorHelper.hxx 
b/include/svx/DocumentColorHelper.hxx
new file mode 100644
index ..9388b7cba815
--- /dev/null
+++ b/include/svx/DocumentColorHelper.hxx
@@ -0,0 +1,41 @@
+/* -*- 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/.
+ *
+ */
+
+#pragma once
+
+#include 
+#include 
+#include 
+#include 
+
+namespace svx
+{
+namespace DocumentColorHelper
+{
+inline Color getColorFromItem(const SvxColorItem* pItem) { return 
pItem->GetValue(); }
+
+inline Color getColorFromItem(const SvxBrushItem* pItem) { return 
pItem->GetColor(); }
+
+template 
+void queryColors(const sal_uInt16 nAttrib, const SfxItemPool* pPool, 
std::set& rOutput)
+{
+for (const SfxPoolItem* pItem : pPool->GetItemSurrogates(nAttrib))
+{
+auto pColorItem = static_cast(pItem);
+Color aColor(getColorFromItem(pColorItem));
+if (COL_AUTO != aColor)
+rOutput.insert(aColor);
+}
+}
+}
+
+} // end of namespace svx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/document10.cxx 
b/sc/source/core/data/document10.cxx
index acf0f27672b0..df5057558934 100644
--- a/sc/source/core/data/document10.cxx
+++ b/sc/source/core/data/document10.cxx
@@ -22,7 +22,7 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -188,17 +188,10 @@ std::set ScDocument::GetDocColors()
 {
 std::set aDocColors;
 ScDocumentPool *pPool = GetPool();
-const sal_uInt16 pAttribs[] = {ATTR_BACKGROUND, ATTR_FONT_COLOR};
-for (sal_uInt16 nAttrib : pAttribs)
-{
-for (const SfxPoolItem* pItem : pPool->GetItemSurrogates(nAttrib))
-{
-const SvxColorItem *pColorItem = static_cast(pItem);
-Color aColor( pColorItem->GetValue() );
-if (COL_AUTO != aColor)
-aDocColors.insert(aColor);
-}
-}
+
+svx::DocumentColorHelper::queryColors(ATTR_BACKGROUND, 
pPool, aDocColors);
+svx::DocumentColorHelper::queryColors(ATTR_FONT_COLOR, 
pPool, aDocColors);
+
 return aDocColors;
 }
 
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 57c42c529eb1..d6c943dbcdc8 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -25,10 +25,10 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2036,17 +2036,11 @@ std::set SwDoc::GetDocColors()
 {
 std::set aDocColors;
 SwAttrPool& rPool = GetAttrPool();
-const sal_uInt16 pAttribs[] = {RES_CHRATR_COLOR, RES_CHRATR_HIGHLIGHT, 
RES_BACKGROUND};
-for (sal_uInt16 nAttrib : pAttribs)
-{
-for (const SfxPoolItem* pItem : rPool.GetItemSurrogates(nAttrib))
-{
-auto pColorItem = static_cast(pItem);
-Color aColor( pColorItem->GetValue() );
-if (COL_AUTO != aColor)
-aDocColors.insert(aColor);
-}
-}
+
+svx::DocumentColorHelper::queryColors(RES_CHRATR_COLOR, 
&rPool, aDocColors);
+svx::DocumentColorHelper::queryColors(RES_CHRATR_HIGHLIGHT, 
&rPool, aDocColors);
+svx::DocumentColorHelper::queryColors(RES_CHRATR_BACKGROUND, 
&rPool, aDocColors);
+
 return aDocColors;
 }
 


core.git: Branch 'distro/collabora/co-24.04' - sal/osl sal/qa

2024-01-24 Thread Szymon Kłos (via logerrit)
 sal/osl/unx/file.cxx |   46 ++-
 sal/qa/osl/file/osl_File.cxx |   25 +++
 2 files changed, 62 insertions(+), 9 deletions(-)

New commits:
commit b410c4f06b3a341081c1591ef22660fae27f017e
Author: Szymon Kłos 
AuthorDate: Wed Nov 29 14:00:32 2023 +0100
Commit: Caolán McNamara 
CommitDate: Wed Jan 24 10:47:39 2024 +0100

sal: osl::File allow to create files in sandbox

"realpath" returns NULL for path which doesn't exist.
Allow usage of non-existing paths if parent is allowed.
This allows to successfully start the sandboxed kit.

osl_setAllowedPaths will allow now to use:
/foo/bar/nonexisting - previously it was ignored, is needed for LOK
but /foo/bar/nonexisting/newlevel - still cannot be used

isForbidden now checks parents of non-existing dir and assumes
the same permissions, if parent doesn't exist - it tries with
parent of parent, etc ...

Change-Id: I1052747ca284d2f81dfd5c5fbf893936e7426220
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160111
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Michael Meeks 
(cherry picked from commit c3bdba781e8c9d61ca9e2a3d8d2eaca435b9aaad)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162486
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index ecd721cfc31c..41ce0aae9aba 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -789,6 +789,18 @@ static std::vector allowedPathsRead;
 static std::vector allowedPathsReadWrite;
 static std::vector allowedPathsExecute;
 
+static OString getParentFolder(const OString &rFilePath)
+{
+sal_Int32 n = rFilePath.lastIndexOf('/');
+OString folderPath;
+if (n < 1)
+folderPath = ".";
+else
+folderPath = rFilePath.copy(0, n);
+
+return folderPath;
+}
+
 SAL_DLLPUBLIC void osl_setAllowedPaths(
 rtl_uString *pustrFilePaths
 )
@@ -819,9 +831,25 @@ SAL_DLLPUBLIC void osl_setAllowedPaths(
 }
 
 char resolvedPath[PATH_MAX];
-if (realpath(aPath.getStr(), resolvedPath))
+bool isResolved = !!realpath(aPath.getStr(), resolvedPath);
+bool notExists = !isResolved && errno == ENOENT;
+
+if (notExists)
 {
-OString aPushPath = OString(resolvedPath, strlen(resolvedPath));
+sal_Int32 n = aPath.lastIndexOf('/');
+OString folderPath = getParentFolder(aPath);
+isResolved = !!realpath(folderPath.getStr(), resolvedPath);
+notExists = !isResolved && errno == ENOENT;
+
+if (notExists || !isResolved || strlen(resolvedPath) + 
aPath.getLength() - n + 1 >= PATH_MAX)
+return; // too bad
+else
+strcat(resolvedPath, aPath.getStr() + n);
+}
+
+if (isResolved)
+{
+OString aPushPath(resolvedPath, strlen(resolvedPath));
 if (eType == 'r')
 allowedPathsRead.push_back(aPushPath);
 else if (eType == 'w')
@@ -851,13 +879,13 @@ bool isForbidden(const OString &filePath, int nFlags)
 // fail to resolve. Thankfully our I/O APIs don't allow
 // symlink creation to race here.
 sal_Int32 n = filePath.lastIndexOf('/');
-OString folderPath;
-if (n < 1)
-folderPath = ".";
-else
-folderPath = filePath.copy(0, n);
-if (!realpath(folderPath.getStr(), resolvedPath) ||
-strlen(resolvedPath) + filePath.getLength() - n + 1 >= PATH_MAX)
+OString folderPath = getParentFolder(filePath);
+
+bool isResolved = !!realpath(folderPath.getStr(), resolvedPath);
+bool notExists = !isResolved && errno == ENOENT;
+if (notExists) // folder doesn't exist, check parent, in the end of 
chain checks "."
+return isForbidden(folderPath, nFlags);
+else if (!isResolved || strlen(resolvedPath) + filePath.getLength() - 
n + 1 >= PATH_MAX)
 return true; // too bad
 else
 strcat(resolvedPath, filePath.getStr() + n);
diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx
index 0de87eeb14a9..df59f33e6070 100644
--- a/sal/qa/osl/file/osl_File.cxx
+++ b/sal/qa/osl/file/osl_File.cxx
@@ -1348,6 +1348,19 @@ namespace osl_Forbidden
 void forbidden()
 {
 File::setAllowedPaths(maScratchGood);
+
+// check some corner cases first
+CPPUNIT_ASSERT_EQUAL_MESSAGE("read bad should be forbidden",
+ true, File::isForbidden(".", 
osl_File_OpenFlag_Read));
+CPPUNIT_ASSERT_EQUAL_MESSAGE("read bad should b

core.git: Branch 'distro/collabora/co-23.05' - include/svx sc/source sw/source

2024-01-16 Thread Szymon Kłos (via logerrit)
 include/svx/DocumentColorHelper.hxx |   41 
 sc/source/core/data/document10.cxx  |   17 --
 sw/source/core/doc/docfmt.cxx   |   18 +--
 3 files changed, 52 insertions(+), 24 deletions(-)

New commits:
commit 1243928be479a75c5095d8d442e613c5f196b665
Author: Szymon Kłos 
AuthorDate: Mon Jan 15 09:49:18 2024 +0100
Commit: Tomaž Vajngerl 
CommitDate: Tue Jan 16 13:01:44 2024 +0100

Use correct type when getting document colors

After commit 0460be8848b0ce02c07183e41dd7137ac3b94164
Send document colors with lok callback

There was issue detected by CI:
/sc/source/core/data/document10.cxx:198:46: runtime error: downcast of 
address 0x610efa40 which does not point to an object of type 'const 
SvxColorItem'
  0x610efa40: note: object is of type 'SvxBrushItem'
   00 00 00 00  b0 79 19 48 ce 7f 00 00  01 00 00 00 94 00 be be  4c 17 00 
00 a0 be be be  cc cc ff 00
^~~
vptr for 'SvxBrushItem'
  #0 0x7fce1fbed369 in ScDocument::GetDocColors() 
/sc/source/core/data/document10.cxx:198:46

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

diff --git a/include/svx/DocumentColorHelper.hxx 
b/include/svx/DocumentColorHelper.hxx
new file mode 100644
index ..71eccde99582
--- /dev/null
+++ b/include/svx/DocumentColorHelper.hxx
@@ -0,0 +1,41 @@
+/* -*- 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/.
+ *
+ */
+
+#pragma once
+
+#include 
+#include 
+#include 
+#include 
+
+namespace svx
+{
+namespace DocumentColorHelper
+{
+static inline Color getColorFromItem(const SvxColorItem* pItem) { return 
pItem->GetValue(); }
+
+static inline Color getColorFromItem(const SvxBrushItem* pItem) { return 
pItem->GetColor(); }
+
+template 
+void queryColors(const sal_uInt16 nAttrib, const SfxItemPool* pPool, 
std::set& rOutput)
+{
+for (const SfxPoolItem* pItem : pPool->GetItemSurrogates(nAttrib))
+{
+auto pColorItem = static_cast(pItem);
+Color aColor(getColorFromItem(pColorItem));
+if (COL_AUTO != aColor)
+rOutput.insert(aColor);
+}
+}
+}
+
+} // end of namespace svx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/document10.cxx 
b/sc/source/core/data/document10.cxx
index e0eb8d46bd28..c9aa5d936a92 100644
--- a/sc/source/core/data/document10.cxx
+++ b/sc/source/core/data/document10.cxx
@@ -22,7 +22,7 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -186,17 +186,10 @@ std::set ScDocument::GetDocColors()
 {
 std::set aDocColors;
 ScDocumentPool *pPool = GetPool();
-const sal_uInt16 pAttribs[] = {ATTR_BACKGROUND, ATTR_FONT_COLOR};
-for (sal_uInt16 nAttrib : pAttribs)
-{
-for (const SfxPoolItem* pItem : pPool->GetItemSurrogates(nAttrib))
-{
-const SvxColorItem *pColorItem = static_cast(pItem);
-Color aColor( pColorItem->GetValue() );
-if (COL_AUTO != aColor)
-aDocColors.insert(aColor);
-}
-}
+
+svx::DocumentColorHelper::queryColors(ATTR_BACKGROUND, 
pPool, aDocColors);
+svx::DocumentColorHelper::queryColors(ATTR_FONT_COLOR, 
pPool, aDocColors);
+
 return aDocColors;
 }
 
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index a7641c9d06fd..00dbe4a44b3f 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -25,10 +25,10 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2018,17 +2018,11 @@ std::set SwDoc::GetDocColors()
 {
 std::set aDocColors;
 SwAttrPool& rPool = GetAttrPool();
-const sal_uInt16 pAttribs[] = {RES_CHRATR_COLOR, RES_CHRATR_HIGHLIGHT, 
RES_BACKGROUND};
-for (sal_uInt16 nAttrib : pAttribs)
-{
-for (const SfxPoolItem* pItem : rPool.GetItemSurrogates(nAttrib))
-{
-auto pColorItem = static_cast(pItem);
-Color aColor( pColorItem->GetValue() );
-if (COL_AUTO != aColor)
-aDocColors.insert(aColor);
-}
-}
+
+svx::DocumentColorHelper::queryColors(RES_CHRATR_COLOR, 
&rPool, aDocColors);
+svx::DocumentColorHelper::queryColors(RES_CHRATR_HIGHLIGHT, 
&rPool, aDocColors);
+svx::DocumentColorHelper::queryColors(RES_CHRATR_BACKGROUND, 
&rPool, aDocColors);
+
 return aDocColors;
 }
 


core.git: include/svx sc/source sw/source

2024-01-16 Thread Szymon Kłos (via logerrit)
 include/svx/DocumentColorHelper.hxx |   43 
 sc/source/core/data/document10.cxx  |   19 ---
 sw/source/core/doc/docfmt.cxx   |   20 +---
 3 files changed, 54 insertions(+), 28 deletions(-)

New commits:
commit b804dc3c61ab595d3971e1b1a0e9a09ea498a7e4
Author: Szymon Kłos 
AuthorDate: Mon Jan 15 09:49:18 2024 +0100
Commit: Szymon Kłos 
CommitDate: Tue Jan 16 12:23:49 2024 +0100

Use correct type when getting document colors

After commit 0460be8848b0ce02c07183e41dd7137ac3b94164
Send document colors with lok callback

There was issue detected by CI:
/sc/source/core/data/document10.cxx:198:46: runtime error: downcast of 
address 0x610efa40 which does not point to an object of type 'const 
SvxColorItem'
  0x610efa40: note: object is of type 'SvxBrushItem'
   00 00 00 00  b0 79 19 48 ce 7f 00 00  01 00 00 00 94 00 be be  4c 17 00 
00 a0 be be be  cc cc ff 00
^~~
vptr for 'SvxBrushItem'
  #0 0x7fce1fbed369 in ScDocument::GetDocColors() 
/sc/source/core/data/document10.cxx:198:46

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

diff --git a/include/svx/DocumentColorHelper.hxx 
b/include/svx/DocumentColorHelper.hxx
new file mode 100644
index ..4e12733391a5
--- /dev/null
+++ b/include/svx/DocumentColorHelper.hxx
@@ -0,0 +1,43 @@
+/* -*- 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/.
+ *
+ */
+
+#pragma once
+
+#include 
+#include 
+#include 
+#include 
+
+namespace svx
+{
+namespace DocumentColorHelper
+{
+static inline Color getColorFromItem(const SvxColorItem* pItem) { return 
pItem->GetValue(); }
+
+static inline Color getColorFromItem(const SvxBrushItem* pItem) { return 
pItem->GetColor(); }
+
+template 
+void queryColors(const sal_uInt16 nAttrib, const SfxItemPool* pPool, 
std::set& rOutput)
+{
+ItemSurrogates aSurrogates;
+pPool->GetItemSurrogates(aSurrogates, nAttrib);
+for (const SfxPoolItem* pItem : aSurrogates)
+{
+auto pColorItem = static_cast(pItem);
+Color aColor(getColorFromItem(pColorItem));
+if (COL_AUTO != aColor)
+rOutput.insert(aColor);
+}
+}
+}
+
+} // end of namespace svx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/document10.cxx 
b/sc/source/core/data/document10.cxx
index 61c75b5e2cc5..a2d1ae67b919 100644
--- a/sc/source/core/data/document10.cxx
+++ b/sc/source/core/data/document10.cxx
@@ -22,7 +22,7 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -188,19 +188,10 @@ std::set ScDocument::GetDocColors()
 {
 std::set aDocColors;
 ScDocumentPool *pPool = GetPool();
-const sal_uInt16 pAttribs[] = {ATTR_BACKGROUND, ATTR_FONT_COLOR};
-for (sal_uInt16 nAttrib : pAttribs)
-{
-ItemSurrogates aSurrogates;
-pPool->GetItemSurrogates(aSurrogates, nAttrib);
-for (const SfxPoolItem* pItem : aSurrogates)
-{
-const SvxColorItem *pColorItem = static_cast(pItem);
-Color aColor( pColorItem->GetValue() );
-if (COL_AUTO != aColor)
-aDocColors.insert(aColor);
-}
-}
+
+svx::DocumentColorHelper::queryColors(ATTR_BACKGROUND, 
pPool, aDocColors);
+svx::DocumentColorHelper::queryColors(ATTR_FONT_COLOR, 
pPool, aDocColors);
+
 return aDocColors;
 }
 
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index dc0f72031b3a..139f1fd205b6 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -25,10 +25,10 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2038,19 +2038,11 @@ std::set SwDoc::GetDocColors()
 {
 std::set aDocColors;
 SwAttrPool& rPool = GetAttrPool();
-const sal_uInt16 pAttribs[] = {RES_CHRATR_COLOR, RES_CHRATR_HIGHLIGHT, 
RES_BACKGROUND};
-for (sal_uInt16 nAttrib : pAttribs)
-{
-ItemSurrogates aSurrogates;
-rPool.GetItemSurrogates(aSurrogates, nAttrib);
-for (const SfxPoolItem* pItem : aSurrogates)
-{
-auto pColorItem = static_cast(pItem);
-Color aColor( pColorItem->GetValue() );
-if (COL_AUTO != aColor)
-aDocColors.insert(aColor);
-}
-}
+
+svx::DocumentColorHelper::queryColors(RES_CHRATR_COLOR, 
&rPool, aDocColors);
+svx::DocumentColorH

core.git: Branch 'distro/collabora/co-24.04' - 8 commits - desktop/source include/osl include/sfx2 include/svx include/tools include/unotools sal/osl sal/qa sal/util sc/source sd/inc sd/source sfx2/so

2024-01-15 Thread Szymon Kłos (via logerrit)
 desktop/source/lib/init.cxx|   25 +
 include/osl/file.h |   48 +
 include/osl/file.hxx   |   52 ++
 include/sfx2/lokhelper.hxx |3 
 include/svx/PaletteManager.hxx |4 
 include/svx/theme/IThemeColorChanger.hxx   |   10 +-
 include/svx/theme/ThemeColorChangerCommon.hxx  |5 +
 include/svx/theme/ThemeColorPaletteManager.hxx |3 
 include/tools/hostfilter.hxx   |   28 +
 include/unotools/pathoptions.hxx   |1 
 sal/osl/unx/file.cxx   |  124 +
 sal/osl/unx/file_impl.hxx  |2 
 sal/osl/unx/file_misc.cxx  |   34 ++
 sal/osl/unx/file_stat.cxx  |6 +
 sal/osl/unx/file_volume.cxx|4 
 sal/osl/unx/pipe.cxx   |4 
 sal/osl/unx/process.cxx|5 -
 sal/osl/unx/profile.cxx|4 
 sal/qa/osl/file/osl_File.cxx   |  118 +++
 sal/util/sal.map   |6 +
 sc/source/core/tool/webservicelink.cxx |8 +
 sc/source/filter/html/htmlpars.cxx |   10 ++
 sc/source/ui/docshell/externalrefmgr.cxx   |5 -
 sc/source/ui/drawfunc/fuins1.cxx   |   11 ++
 sc/source/ui/inc/ThemeColorChanger.hxx |2 
 sc/source/ui/theme/ThemeColorChanger.cxx   |4 
 sc/source/ui/view/tabvwshc.cxx |9 +
 sd/inc/theme/ThemeColorChanger.hxx |2 
 sd/source/core/ThemeColorChanger.cxx   |4 
 sd/source/ui/func/fuinsert.cxx |   14 ++
 sd/source/ui/inc/ViewShellBase.hxx |2 
 sd/source/ui/view/ViewShellBase.cxx|   15 +++
 sd/source/ui/view/drviews2.cxx |8 -
 sfx2/source/view/lokhelper.cxx |   17 +++
 svx/source/tbxctrls/PaletteManager.cxx |   36 +++
 svx/source/theme/ThemeColorChangerCommon.cxx   |   56 +++
 svx/source/theme/ThemeColorPaletteManager.cxx  |9 -
 sw/source/core/inc/ThemeColorChanger.hxx   |2 
 sw/source/core/model/ThemeColorChanger.cxx |4 
 sw/source/filter/html/htmlgrin.cxx |6 +
 sw/source/uibase/shells/basesh.cxx |7 -
 sw/source/uibase/uiview/view.cxx   |7 -
 sw/source/uibase/uiview/view2.cxx  |   10 ++
 tools/Library_tl.mk|1 
 tools/source/inet/hostfilter.cxx   |   31 ++
 ucb/source/ucp/webdav-curl/CurlSession.cxx |7 +
 unotools/source/config/pathoptions.cxx |6 +
 47 files changed, 718 insertions(+), 61 deletions(-)

New commits:
commit 88281b55c1d781f73a663188229c639a290c53bc
Author: Szymon Kłos 
AuthorDate: Mon Jan 8 18:46:13 2024 +0100
Commit: Szymon Kłos 
CommitDate: Mon Jan 15 21:07:28 2024 +0100

Send document colors with lok callback

First step for publishing any palette for LOK.
Let's start with Document colors (colors used in the
document) which can be extracted similar to theme
colors from SfxViewShell.

Modify generateJSON function so it appends palette into
existing ptree/JSON.

In the next step we can make it more generic so it will
be able to send any palette managed by PaletteManager.

Change-Id: Ibb56690af6dfd59ee232e88b28e7a3d312d0e16c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161798
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 0460be8848b0ce02c07183e41dd7137ac3b94164)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161941
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/include/svx/PaletteManager.hxx b/include/svx/PaletteManager.hxx
index 81f30ea7de76..90fa00de59fe 100644
--- a/include/svx/PaletteManager.hxx
+++ b/include/svx/PaletteManager.hxx
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace com::sun::star::uno { class XComponentContext; }
 namespace svx { class ToolboxButtonColorUpdaterBase; }
@@ -86,6 +87,9 @@ public:
 bool GetLumModOff(sal_uInt16 nThemeIndex, sal_uInt16 nEffect, sal_Int16& 
rLumMod, sal_Int16& rLumOff);
 
 static void DispatchColorCommand(const OUString& aCommand, const 
NamedColor& rColor);
+
+/// Appends node for Document Colors into the ptree
+static void generateJSON(boost::property_tree::ptree& aTree, const 
std::set& rColors);
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/theme/IThemeColorChanger.hxx 
b/include/svx/theme/IThemeColorChanger.hxx
index 0b3b88d60afa..035494f12324 100644
--- a/include/svx/theme/IThemeColorChanger.hxx
+++ b/include/svx/theme/IThemeColorChanger.hxx
@@ -22,7 +22,7 @@ public:
 void apply(std

core.git: Branch 'distro/collabora/co-23.05' - svx/source

2024-01-12 Thread Szymon Kłos (via logerrit)
 svx/source/tbxctrls/PaletteManager.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2164a6b67948e3878727f8cc510d92bdc38f3268
Author: Szymon Kłos 
AuthorDate: Fri Jan 12 09:03:59 2024 +0100
Commit: Tomaž Vajngerl 
CommitDate: Fri Jan 12 14:19:09 2024 +0100

PaletteManager::generateJSON sync with master

Solves possible use-after-free catched by master Jenkins:

In function ‘C* rtl::addDataHelper(C*, const C*, std::size_t) [with C = 
char16_t]’,
inlined from ‘C* rtl::ToStringHelper 
>::operator()(C*, std::basic_string_view) const [with C = char16_t]’ at 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/include/rtl/stringconcat.hxx:365:27,
inlined from ‘C* rtl::StringConcat 
>::addData(C*) const [with C = char16_t; T1 = std::basic_string_view; 
T2 = rtl::StringNumber; typename 
std::enable_if<(allowStringConcat && allowStringConcat), 
int>::type  = 0]’ at 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/include/rtl/stringconcat.hxx:195:86,
inlined from ‘rtl::OUString::OUString(rtl::OUStringConcat&&) 
[with T1 = std::basic_string_view; T2 = rtl::StringNumber]’ at 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/include/rtl/ustring.hxx:499:41,
inlined from ‘static void 
PaletteManager::generateJSON(boost::property_tree::ptree&, const 
std::set&)’ at 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/svx/source/tbxctrls/PaletteManager.cxx:487:74:

/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/include/rtl/stringconcat.hxx:80:15:
 error: pointer may be used after ‘void operator delete [](void*)’ 
[-Werror=use-after-free]

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

diff --git a/svx/source/tbxctrls/PaletteManager.cxx 
b/svx/source/tbxctrls/PaletteManager.cxx
index a807b6516789..0ba97a76ada4 100644
--- a/svx/source/tbxctrls/PaletteManager.cxx
+++ b/svx/source/tbxctrls/PaletteManager.cxx
@@ -471,6 +471,7 @@ void 
PaletteManager::generateJSON(boost::property_tree::ptree& aTree, const std:
 
 const StyleSettings& rStyleSettings = 
Application::GetSettings().GetStyleSettings();
 sal_uInt32 nColumnCount = rStyleSettings.GetColorValueSetColumnCount();
+const OUString 
aNamePrefix(Concat2View(SvxResId(RID_SVXSTR_DOC_COLOR_PREFIX) + " "));
 
 auto aColorIt = rColors.begin();
 while (aColorIt != rColors.end())
@@ -480,7 +481,6 @@ void 
PaletteManager::generateJSON(boost::property_tree::ptree& aTree, const std:
 for (sal_uInt32 nColumn = 0; nColumn < nColumnCount; nColumn++)
 {
 boost::property_tree::ptree aColorTree;
-std::u16string_view aNamePrefix = 
Concat2View(SvxResId(RID_SVXSTR_DOC_COLOR_PREFIX) + " ");
 OUString sName = aNamePrefix + OUString::number(nStartIndex++);
 aColorTree.put("Value", aColorIt->AsRGBHexString().toUtf8());
 aColorTree.put("Name", sName);


core.git: include/svx sc/source sd/source svx/source sw/source

2024-01-12 Thread Szymon Kłos (via logerrit)
 include/svx/PaletteManager.hxx |4 ++
 include/svx/theme/IThemeColorChanger.hxx   |2 -
 include/svx/theme/ThemeColorChangerCommon.hxx  |5 ++-
 include/svx/theme/ThemeColorPaletteManager.hxx |3 +-
 sc/source/ui/view/tabvwshc.cxx |4 ++
 sd/source/ui/view/ViewShellBase.cxx|4 ++
 svx/source/tbxctrls/PaletteManager.cxx |   36 -
 svx/source/theme/ThemeColorChangerCommon.cxx   |   16 +--
 svx/source/theme/ThemeColorPaletteManager.cxx  |9 --
 sw/source/uibase/uiview/view.cxx   |4 ++
 10 files changed, 70 insertions(+), 17 deletions(-)

New commits:
commit 39b5a39bdc6d7fc86db5be6058b9f9251f070739
Author: Szymon Kłos 
AuthorDate: Mon Jan 8 18:46:13 2024 +0100
Commit: Szymon Kłos 
CommitDate: Fri Jan 12 13:58:22 2024 +0100

Send document colors with lok callback

First step for publishing any palette for LOK.
Let's start with Document colors (colors used in the
document) which can be extracted similar to theme
colors from SfxViewShell.

Modify generateJSON function so it appends palette into
existing ptree/JSON.

In the next step we can make it more generic so it will
be able to send any palette managed by PaletteManager.

Change-Id: Ibb56690af6dfd59ee232e88b28e7a3d312d0e16c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161798
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 0460be8848b0ce02c07183e41dd7137ac3b94164)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161941
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/include/svx/PaletteManager.hxx b/include/svx/PaletteManager.hxx
index 81f30ea7de76..90fa00de59fe 100644
--- a/include/svx/PaletteManager.hxx
+++ b/include/svx/PaletteManager.hxx
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace com::sun::star::uno { class XComponentContext; }
 namespace svx { class ToolboxButtonColorUpdaterBase; }
@@ -86,6 +87,9 @@ public:
 bool GetLumModOff(sal_uInt16 nThemeIndex, sal_uInt16 nEffect, sal_Int16& 
rLumMod, sal_Int16& rLumOff);
 
 static void DispatchColorCommand(const OUString& aCommand, const 
NamedColor& rColor);
+
+/// Appends node for Document Colors into the ptree
+static void generateJSON(boost::property_tree::ptree& aTree, const 
std::set& rColors);
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/theme/IThemeColorChanger.hxx 
b/include/svx/theme/IThemeColorChanger.hxx
index 0b3b88d60afa..035494f12324 100644
--- a/include/svx/theme/IThemeColorChanger.hxx
+++ b/include/svx/theme/IThemeColorChanger.hxx
@@ -22,7 +22,7 @@ public:
 void apply(std::shared_ptr const& pColorSet)
 {
 doApply(pColorSet);
-svx::theme::notifyLOK(pColorSet);
+svx::theme::notifyLOK(pColorSet, std::set());
 }
 
 private:
diff --git a/include/svx/theme/ThemeColorChangerCommon.hxx 
b/include/svx/theme/ThemeColorChangerCommon.hxx
index 3a585236fbf8..9fa3f4376ddc 100644
--- a/include/svx/theme/ThemeColorChangerCommon.hxx
+++ b/include/svx/theme/ThemeColorChangerCommon.hxx
@@ -9,6 +9,7 @@
 
 #pragma once
 
+#include 
 #include 
 #include 
 #include 
@@ -22,7 +23,9 @@ namespace theme
 SVXCORE_DLLPUBLIC void updateSdrObject(model::ColorSet const& rColorSet, 
SdrObject* pObject,
SdrView* pView, SfxUndoManager* 
pUndoManager = nullptr);
 
-SVXCORE_DLLPUBLIC void notifyLOK(std::shared_ptr const& 
pColorSet);
+/// Sends to the LOK updated palettes
+SVXCORE_DLLPUBLIC void notifyLOK(std::shared_ptr const& 
pColorSet,
+ const std::set& rDocumentColors);
 }
 
 } // end svx namespace
diff --git a/include/svx/theme/ThemeColorPaletteManager.hxx 
b/include/svx/theme/ThemeColorPaletteManager.hxx
index 7bb8526a2409..8531021bbc84 100644
--- a/include/svx/theme/ThemeColorPaletteManager.hxx
+++ b/include/svx/theme/ThemeColorPaletteManager.hxx
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace model
 {
@@ -60,7 +61,7 @@ class SVXCORE_DLLPUBLIC ThemeColorPaletteManager final
 public:
 ThemeColorPaletteManager(std::shared_ptr const& 
pColorSet);
 ThemePaletteCollection generate();
-OString generateJSON();
+void generateJSON(boost::property_tree::ptree& aTree);
 };
 
 } // end svx namespace
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index 1012f1ceb249..b0c3aa54343c 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -483,7 +483,9 @@ void ScTabViewShell::afterCallbackRegistered()
 SfxObjectShell* pDocShell = GetObjectShell();
 if (pDocShell)
 {
-svx::theme::notifyLOK(pDocShell->GetThemeColors());
+std::shared_ptr pThemeColors = 
pDocShell->GetThemeColors

core.git: include/svx sc/source sd/inc sd/source svx/source sw/source

2024-01-11 Thread Szymon Kłos (via logerrit)
 include/svx/theme/IThemeColorChanger.hxx  |   10 ++-
 include/svx/theme/ThemeColorChangerCommon.hxx |2 +
 sc/source/ui/inc/ThemeColorChanger.hxx|2 -
 sc/source/ui/theme/ThemeColorChanger.cxx  |4 +-
 sc/source/ui/view/tabvwshc.cxx|7 +
 sd/inc/theme/ThemeColorChanger.hxx|2 -
 sd/source/core/ThemeColorChanger.cxx  |4 +-
 sd/source/ui/inc/ViewShellBase.hxx|2 +
 sd/source/ui/view/ViewShellBase.cxx   |   13 +
 sd/source/ui/view/drviews2.cxx|8 -
 svx/source/theme/ThemeColorChangerCommon.cxx  |   36 ++
 sw/source/core/inc/ThemeColorChanger.hxx  |2 -
 sw/source/core/model/ThemeColorChanger.cxx|4 +-
 sw/source/uibase/shells/basesh.cxx|7 -
 sw/source/uibase/uiview/view.cxx  |5 +--
 15 files changed, 70 insertions(+), 38 deletions(-)

New commits:
commit 13e055808461f92be68f7691392b23159ac9a1ba
Author: Szymon Kłos 
AuthorDate: Sun Jan 7 18:31:22 2024 +0100
Commit: Szymon Kłos 
CommitDate: Fri Jan 12 08:04:34 2024 +0100

sc: announce theme colors with lok callback

As it is done already for Writer. Unfortunately cannot
move the code from afterCallbackRegistered to base class
in sfx2 as it is not linked to svx which is needed to
generate JSON. So at least share generation and sending
part in ThemeColorChangerCommon.

Signed-off-by: Szymon Kłos 
Change-Id: Icbf681230bd4c49698c47d852a0862620d93bcec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161771
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tomaž Vajngerl 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161927
Tested-by: Jenkins

diff --git a/include/svx/theme/IThemeColorChanger.hxx 
b/include/svx/theme/IThemeColorChanger.hxx
index d9273238c712..0b3b88d60afa 100644
--- a/include/svx/theme/IThemeColorChanger.hxx
+++ b/include/svx/theme/IThemeColorChanger.hxx
@@ -11,6 +11,7 @@
 
 #include 
 #include 
+#include "ThemeColorChangerCommon.hxx"
 
 namespace svx
 {
@@ -18,7 +19,14 @@ class SVXCORE_DLLPUBLIC IThemeColorChanger
 {
 public:
 virtual ~IThemeColorChanger() = default;
-virtual void apply(std::shared_ptr const& pColorSet) = 0;
+void apply(std::shared_ptr const& pColorSet)
+{
+doApply(pColorSet);
+svx::theme::notifyLOK(pColorSet);
+}
+
+private:
+virtual void doApply(std::shared_ptr const& pColorSet) = 
0;
 };
 
 } // end svx namespace
diff --git a/include/svx/theme/ThemeColorChangerCommon.hxx 
b/include/svx/theme/ThemeColorChangerCommon.hxx
index febc34ae3873..3a585236fbf8 100644
--- a/include/svx/theme/ThemeColorChangerCommon.hxx
+++ b/include/svx/theme/ThemeColorChangerCommon.hxx
@@ -21,6 +21,8 @@ namespace theme
 {
 SVXCORE_DLLPUBLIC void updateSdrObject(model::ColorSet const& rColorSet, 
SdrObject* pObject,
SdrView* pView, SfxUndoManager* 
pUndoManager = nullptr);
+
+SVXCORE_DLLPUBLIC void notifyLOK(std::shared_ptr const& 
pColorSet);
 }
 
 } // end svx namespace
diff --git a/sc/source/ui/inc/ThemeColorChanger.hxx 
b/sc/source/ui/inc/ThemeColorChanger.hxx
index 57ca91cdb83c..f85401385888 100644
--- a/sc/source/ui/inc/ThemeColorChanger.hxx
+++ b/sc/source/ui/inc/ThemeColorChanger.hxx
@@ -24,7 +24,7 @@ public:
 ThemeColorChanger(ScDocShell& rDocShell);
 virtual ~ThemeColorChanger() override;
 
-void apply(std::shared_ptr const& pColorSet) override;
+void doApply(std::shared_ptr const& pColorSet) override;
 };
 
 } // end sc namespace
diff --git a/sc/source/ui/theme/ThemeColorChanger.cxx 
b/sc/source/ui/theme/ThemeColorChanger.cxx
index c9b88652dcc3..2ba881544372 100644
--- a/sc/source/ui/theme/ThemeColorChanger.cxx
+++ b/sc/source/ui/theme/ThemeColorChanger.cxx
@@ -19,7 +19,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -311,7 +311,7 @@ void changeThemeColorInTheDocModel(ScDocShell& rDocShell,
 
 } // end anonymous ns
 
-void ThemeColorChanger::apply(std::shared_ptr const& 
pColorSet)
+void ThemeColorChanger::doApply(std::shared_ptr const& 
pColorSet)
 {
 // Can't change to an empty color set
 if (!pColorSet)
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index 0c214a02eb67..eeb554454eab 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -477,6 +478,12 @@ void ScTabViewShell::afterCallbackRegistered()
 pInputWindow->NotifyLOKClient();
 }
 }
+
+SfxObjectShell* pDocShell = GetObjectShell();
+if (pDocShell)
+{
+svx::theme::notifyLOK(pDocShell->GetThemeColors());
+}
 }
 
 void ScTabViewShell::NotifyCursor(SfxViewShell* pOtherShell) const
diff --git a/sd/inc/theme/

core.git: include/sfx2 sc/source sd/source sfx2/source sw/source

2024-01-11 Thread Szymon Kłos (via logerrit)
 include/sfx2/lokhelper.hxx |2 +-
 sc/source/filter/html/htmlpars.cxx |2 +-
 sc/source/ui/drawfunc/fuins1.cxx   |   11 +++
 sd/source/ui/func/fuinsert.cxx |   14 +-
 sfx2/source/view/lokhelper.cxx |4 ++--
 sw/source/filter/html/htmlgrin.cxx |2 +-
 sw/source/uibase/uiview/view2.cxx  |   10 ++
 7 files changed, 39 insertions(+), 6 deletions(-)

New commits:
commit 40c94cff178bd4bef4dc5ce38cc9eb67fe2eb780
Author: Szymon Kłos 
AuthorDate: Tue Dec 19 19:24:19 2023 +0100
Commit: Szymon Kłos 
CommitDate: Thu Jan 11 12:23:27 2024 +0100

lok: send error on access denied in image import 2

followup for commit 64624d225c71229acce4f889d4863d7c29c52658
lok: send error on access denied in image import

It shows an error in LOK when we try to insert image
from remote host blocked by HostFilter

Previously it was showing error in paste case,
now do the same also on image insertion.

For now disable HandleGraphicFilterError in sd, as it
crashes, is synchronous and cannot be easily fixed
- dialog sits inside module not linked to sfx2, needs
some rework.

Change-Id: I3c15ff5621add97ef9d60d4f4c1305dae2909158
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161001
Tested-by: Jenkins CollaboraOffice 
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161774
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index dc9558a31f0f..8ca9ce80da08 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -227,7 +227,7 @@ public:
 static VclPtr getInPlaceDocWindow(SfxViewShell* pViewShell);
 
 /// Sends Network Access error to LOK
-static void sendNetworkAccessError();
+static void sendNetworkAccessError(std::string_view rAction);
 
 static void notifyLog(const std::ostringstream& stream);
 
diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index 10d31fc84cd4..43ff3cca2de5 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -1325,7 +1325,7 @@ void ScHTMLLayoutParser::Image( HtmlImportInfo* pInfo )
 {
 INetURLObject aURL(pImage->aURL);
 if (HostFilter::isForbidden(aURL.GetHost()))
-SfxLokHelper::sendNetworkAccessError();
+SfxLokHelper::sendNetworkAccessError("paste");
 }
 
 sal_uInt16 nFormat;
diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx
index 72886789b448..9b51a62c5b2a 100644
--- a/sc/source/ui/drawfunc/fuins1.cxx
+++ b/sc/source/ui/drawfunc/fuins1.cxx
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -48,6 +49,9 @@
 #include 
 #include 
 
+#include 
+#include 
+
 #include 
 #include 
 #include 
@@ -279,6 +283,13 @@ FuInsertGraphic::FuInsertGraphic( ScTabViewShell&   
rViewSh,
 if ( pReqArgs->GetItemState( FN_PARAM_1, true, &pItem ) == 
SfxItemState::SET )
 bAsLink = static_cast(pItem)->GetValue();
 
+if (comphelper::LibreOfficeKit::isActive())
+{
+INetURLObject aURL(aFileName);
+if (INetProtocol::File != aURL.GetProtocol() && 
HostFilter::isForbidden(aURL.GetHost()))
+SfxLokHelper::sendNetworkAccessError("insert");
+}
+
 Graphic aGraphic;
 ErrCode nError = GraphicFilter::LoadGraphic( aFileName, aFilterName, 
aGraphic, &GraphicFilter::GetGraphicFilter() );
 if ( nError == ERRCODE_NONE )
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index 31b286c822e3..e8409c815b25 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -36,6 +36,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -60,6 +61,9 @@
 #include 
 #include 
 
+#include 
+#include 
+
 #include 
 #include 
 #include 
@@ -129,6 +133,13 @@ void FuInsertGraphic::DoExecute( SfxRequest& rReq )
 if ( pArgs->GetItemState( FN_PARAM_1, true, &pItem ) == 
SfxItemState::SET )
 bAsLink = static_cast(pItem)->GetValue();
 
+if (comphelper::LibreOfficeKit::isActive())
+{
+INetURLObject aURL(aFileName);
+if (INetProtocol::File != aURL.GetProtocol() && 
HostFilter::isForbidden(aURL.GetHost()))
+SfxLokHelper::sendNetworkAccessError("insert");
+}
+
 nError = GraphicFilter::LoadGraphic( aFileName, aFilterName, aGraphic, 
&GraphicFilter::GetGraphicFilter() );
 }
 else
@@ -188,8 +199,9 @@ void FuInsertGraphic::DoExecute( SfxRequest& rReq )
 }
 }
 }
-else
+else if (!comphelper::LibreOfficeKit::isActive())
 {
+// TODO: enable in LOK, it contains

core.git: include/sfx2 sc/source sfx2/source sw/source

2024-01-11 Thread Szymon Kłos (via logerrit)
 include/sfx2/lokhelper.hxx |3 +++
 sc/source/filter/html/htmlpars.cxx |   10 ++
 sfx2/source/view/lokhelper.cxx |   17 +
 sw/source/filter/html/htmlgrin.cxx |6 ++
 4 files changed, 36 insertions(+)

New commits:
commit 0f8ef44c919a59755a5b8cb2f9bd95b4ad538f82
Author: Szymon Kłos 
AuthorDate: Mon Dec 4 18:36:29 2023 +0100
Commit: Szymon Kłos 
CommitDate: Thu Jan 11 09:09:17 2024 +0100

lok: send error on access denied in image import

- when we paste HTML with references to external images
  and host filter is configured then we have empty graphics
- inform client about that so we can show an error to the user

Change-Id: I7d584c256d8d004955c970056341ab42864d1dd3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160319
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161773
Tested-by: Jenkins

diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index dc144503b8dd..338dda192b8c 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -226,6 +226,9 @@ public:
 
 static VclPtr getInPlaceDocWindow(SfxViewShell* pViewShell);
 
+/// Sends Network Access error to LOK
+static void sendNetworkAccessError();
+
 static void notifyLog(const std::ostringstream& stream);
 
 private:
diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index f5f890081592..10d31fc84cd4 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -20,6 +20,7 @@
 #include 
 #include 
 
+#include 
 #include 
 
 #include 
@@ -37,6 +38,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -47,6 +49,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1318,6 +1321,13 @@ void ScHTMLLayoutParser::Image( HtmlImportInfo* pInfo )
 return ;
 }
 
+if (comphelper::LibreOfficeKit::isActive())
+{
+INetURLObject aURL(pImage->aURL);
+if (HostFilter::isForbidden(aURL.GetHost()))
+SfxLokHelper::sendNetworkAccessError();
+}
+
 sal_uInt16 nFormat;
 std::optional oGraphic(std::in_place);
 GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 4bebd7d1dc50..7cfe51426bce 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -1077,4 +1078,20 @@ VclPtr 
SfxLokHelper::getInPlaceDocWindow(SfxViewShell* pViewShell)
 return {};
 }
 
+void SfxLokHelper::sendNetworkAccessError()
+{
+tools::JsonWriter aWriter;
+aWriter.put("code", static_cast(
+ErrCode(ErrCodeArea::Inet, sal_uInt16(ErrCodeClass::Access;
+aWriter.put("kind", "network");
+aWriter.put("cmd", "paste");
+
+SfxViewShell* pViewShell = SfxViewShell::Current();
+if (pViewShell)
+{
+pViewShell->libreOfficeKitViewCallback(
+LOK_CALLBACK_ERROR, aWriter.finishAndGetAsOString());
+}
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/htmlgrin.cxx 
b/sw/source/filter/html/htmlgrin.cxx
index 2b30c167bfe0..8304fa3002f3 100644
--- a/sw/source/filter/html/htmlgrin.cxx
+++ b/sw/source/filter/html/htmlgrin.cxx
@@ -19,6 +19,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -34,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -69,6 +71,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -509,6 +512,9 @@ IMAGE_SETEVENT:
 }
 else if (m_sBaseURL.isEmpty() || !aGraphicData.isEmpty())
 {
+if (comphelper::LibreOfficeKit::isActive() && 
HostFilter::isForbidden(aGraphicURL.GetHost()))
+SfxLokHelper::sendNetworkAccessError();
+
 // sBaseURL is empty if the source is clipboard
 // aGraphicData is non-empty for  -> not a linked 
graphic.
 if (ERRCODE_NONE == 
GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, aGraphicURL))


core.git: Branch 'distro/collabora/co-23.05' - include/svx sc/source sd/source svx/source sw/source

2024-01-10 Thread Szymon Kłos (via logerrit)
 include/svx/PaletteManager.hxx |4 ++
 include/svx/theme/IThemeColorChanger.hxx   |2 -
 include/svx/theme/ThemeColorChangerCommon.hxx  |5 ++-
 include/svx/theme/ThemeColorPaletteManager.hxx |3 +-
 sc/source/ui/view/tabvwshc.cxx |4 ++
 sd/source/ui/view/ViewShellBase.cxx|4 ++
 svx/source/tbxctrls/PaletteManager.cxx |   36 -
 svx/source/theme/ThemeColorChangerCommon.cxx   |   16 +--
 svx/source/theme/ThemeColorPaletteManager.cxx  |9 --
 sw/source/uibase/uiview/view.cxx   |4 ++
 10 files changed, 70 insertions(+), 17 deletions(-)

New commits:
commit 0460be8848b0ce02c07183e41dd7137ac3b94164
Author: Szymon Kłos 
AuthorDate: Mon Jan 8 18:46:13 2024 +0100
Commit: Tomaž Vajngerl 
CommitDate: Wed Jan 10 10:19:09 2024 +0100

Send document colors with lok callback

First step for publishing any palette for LOK.
Let's start with Document colors (colors used in the
document) which can be extracted similar to theme
colors from SfxViewShell.

Modify generateJSON function so it appends palette into
existing ptree/JSON.

In the next step we can make it more generic so it will
be able to send any palette managed by PaletteManager.

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

diff --git a/include/svx/PaletteManager.hxx b/include/svx/PaletteManager.hxx
index 5a5000bc0076..9e089b0ed495 100644
--- a/include/svx/PaletteManager.hxx
+++ b/include/svx/PaletteManager.hxx
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace com::sun::star::uno { class XComponentContext; }
 namespace svx { class ToolboxButtonColorUpdaterBase; }
@@ -85,6 +86,9 @@ public:
 bool GetLumModOff(sal_uInt16 nThemeIndex, sal_uInt16 nEffect, sal_Int16& 
rLumMod, sal_Int16& rLumOff);
 
 static void DispatchColorCommand(const OUString& aCommand, const 
NamedColor& rColor);
+
+/// Appends node for Document Colors into the ptree
+static void generateJSON(boost::property_tree::ptree& aTree, const 
std::set& rColors);
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/theme/IThemeColorChanger.hxx 
b/include/svx/theme/IThemeColorChanger.hxx
index 0b3b88d60afa..035494f12324 100644
--- a/include/svx/theme/IThemeColorChanger.hxx
+++ b/include/svx/theme/IThemeColorChanger.hxx
@@ -22,7 +22,7 @@ public:
 void apply(std::shared_ptr const& pColorSet)
 {
 doApply(pColorSet);
-svx::theme::notifyLOK(pColorSet);
+svx::theme::notifyLOK(pColorSet, std::set());
 }
 
 private:
diff --git a/include/svx/theme/ThemeColorChangerCommon.hxx 
b/include/svx/theme/ThemeColorChangerCommon.hxx
index f40fb639878d..3050da0c 100644
--- a/include/svx/theme/ThemeColorChangerCommon.hxx
+++ b/include/svx/theme/ThemeColorChangerCommon.hxx
@@ -9,6 +9,7 @@
 
 #pragma once
 
+#include 
 #include 
 #include 
 #include 
@@ -23,7 +24,9 @@ namespace theme
 SVXCORE_DLLPUBLIC void updateSdrObject(model::ColorSet const& rColorSet, 
SdrObject* pObject,
SdrView* pView, SfxUndoManager* 
pUndoManager = nullptr);
 
-SVXCORE_DLLPUBLIC void notifyLOK(std::shared_ptr const& 
pColorSet);
+/// Sends to the LOK updated palettes
+SVXCORE_DLLPUBLIC void notifyLOK(std::shared_ptr const& 
pColorSet,
+ const std::set& rDocumentColors);
 }
 
 } // end svx namespace
diff --git a/include/svx/theme/ThemeColorPaletteManager.hxx 
b/include/svx/theme/ThemeColorPaletteManager.hxx
index 7bb8526a2409..8531021bbc84 100644
--- a/include/svx/theme/ThemeColorPaletteManager.hxx
+++ b/include/svx/theme/ThemeColorPaletteManager.hxx
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace model
 {
@@ -60,7 +61,7 @@ class SVXCORE_DLLPUBLIC ThemeColorPaletteManager final
 public:
 ThemeColorPaletteManager(std::shared_ptr const& 
pColorSet);
 ThemePaletteCollection generate();
-OString generateJSON();
+void generateJSON(boost::property_tree::ptree& aTree);
 };
 
 } // end svx namespace
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index 116283f48bea..9bf1598516c8 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -479,7 +479,9 @@ void ScTabViewShell::afterCallbackRegistered()
 SfxObjectShell* pDocShell = GetObjectShell();
 if (pDocShell)
 {
-svx::theme::notifyLOK(pDocShell->GetThemeColors());
+std::shared_ptr pThemeColors = 
pDocShell->GetThemeColors();
+std::set aDocumentColors = pDocShell->GetDocColors();
+svx::theme::notifyLOK(pThemeColors, aDocumentColors);
 }
 }
 
diff --git a/sd/source/ui/view/ViewShell

core.git: Branch 'distro/collabora/co-23.05' - include/svx sc/source sd/inc sd/source svx/source sw/source

2024-01-08 Thread Szymon Kłos (via logerrit)
 include/svx/theme/IThemeColorChanger.hxx  |   10 +-
 include/svx/theme/ThemeColorChangerCommon.hxx |3 +
 sc/source/ui/inc/ThemeColorChanger.hxx|2 -
 sc/source/ui/theme/ThemeColorChanger.cxx  |4 +-
 sc/source/ui/view/tabvwshc.cxx|7 
 sd/inc/theme/ThemeColorChanger.hxx|2 -
 sd/source/core/ThemeColorChanger.cxx  |4 +-
 sd/source/ui/view/ViewShellBase.cxx   |7 +++-
 sd/source/ui/view/drviews2.cxx|8 
 svx/source/theme/ThemeColorChangerCommon.cxx  |   43 +-
 sw/source/core/inc/ThemeColorChanger.hxx  |2 -
 sw/source/core/model/ThemeColorChanger.cxx|4 +-
 sw/source/uibase/shells/basesh.cxx|7 
 sw/source/uibase/uiview/view.cxx  |5 +--
 14 files changed, 64 insertions(+), 44 deletions(-)

New commits:
commit 5148c8411ffb6ae9a0411678d01b67fe7f097725
Author: Szymon Kłos 
AuthorDate: Sun Jan 7 18:31:22 2024 +0100
Commit: Tomaž Vajngerl 
CommitDate: Tue Jan 9 07:51:31 2024 +0100

sc: announce theme colors with lok callback

As it is done already for Writer. Unfortunately cannot
move the code from afterCallbackRegistered to base class
in sfx2 as it is not linked to svx which is needed to
generate JSON. So at least share generation and sending
part in ThemeColorChangerCommon.

Signed-off-by: Szymon Kłos 
Change-Id: Icbf681230bd4c49698c47d852a0862620d93bcec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161771
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/svx/theme/IThemeColorChanger.hxx 
b/include/svx/theme/IThemeColorChanger.hxx
index d9273238c712..0b3b88d60afa 100644
--- a/include/svx/theme/IThemeColorChanger.hxx
+++ b/include/svx/theme/IThemeColorChanger.hxx
@@ -11,6 +11,7 @@
 
 #include 
 #include 
+#include "ThemeColorChangerCommon.hxx"
 
 namespace svx
 {
@@ -18,7 +19,14 @@ class SVXCORE_DLLPUBLIC IThemeColorChanger
 {
 public:
 virtual ~IThemeColorChanger() = default;
-virtual void apply(std::shared_ptr const& pColorSet) = 0;
+void apply(std::shared_ptr const& pColorSet)
+{
+doApply(pColorSet);
+svx::theme::notifyLOK(pColorSet);
+}
+
+private:
+virtual void doApply(std::shared_ptr const& pColorSet) = 
0;
 };
 
 } // end svx namespace
diff --git a/include/svx/theme/ThemeColorChangerCommon.hxx 
b/include/svx/theme/ThemeColorChangerCommon.hxx
index d60d9c1ba7fb..f40fb639878d 100644
--- a/include/svx/theme/ThemeColorChangerCommon.hxx
+++ b/include/svx/theme/ThemeColorChangerCommon.hxx
@@ -10,7 +10,6 @@
 #pragma once
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -23,6 +22,8 @@ namespace theme
 {
 SVXCORE_DLLPUBLIC void updateSdrObject(model::ColorSet const& rColorSet, 
SdrObject* pObject,
SdrView* pView, SfxUndoManager* 
pUndoManager = nullptr);
+
+SVXCORE_DLLPUBLIC void notifyLOK(std::shared_ptr const& 
pColorSet);
 }
 
 } // end svx namespace
diff --git a/sc/source/ui/inc/ThemeColorChanger.hxx 
b/sc/source/ui/inc/ThemeColorChanger.hxx
index 57ca91cdb83c..f85401385888 100644
--- a/sc/source/ui/inc/ThemeColorChanger.hxx
+++ b/sc/source/ui/inc/ThemeColorChanger.hxx
@@ -24,7 +24,7 @@ public:
 ThemeColorChanger(ScDocShell& rDocShell);
 virtual ~ThemeColorChanger() override;
 
-void apply(std::shared_ptr const& pColorSet) override;
+void doApply(std::shared_ptr const& pColorSet) override;
 };
 
 } // end sc namespace
diff --git a/sc/source/ui/theme/ThemeColorChanger.cxx 
b/sc/source/ui/theme/ThemeColorChanger.cxx
index c9b88652dcc3..2ba881544372 100644
--- a/sc/source/ui/theme/ThemeColorChanger.cxx
+++ b/sc/source/ui/theme/ThemeColorChanger.cxx
@@ -19,7 +19,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -311,7 +311,7 @@ void changeThemeColorInTheDocModel(ScDocShell& rDocShell,
 
 } // end anonymous ns
 
-void ThemeColorChanger::apply(std::shared_ptr const& 
pColorSet)
+void ThemeColorChanger::doApply(std::shared_ptr const& 
pColorSet)
 {
 // Can't change to an empty color set
 if (!pColorSet)
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index 34463e8dd963..116283f48bea 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -474,6 +475,12 @@ void ScTabViewShell::afterCallbackRegistered()
 pInputWindow->NotifyLOKClient();
 }
 }
+
+SfxObjectShell* pDocShell = GetObjectShell();
+if (pDocShell)
+{
+svx::theme::notifyLOK(pDocShell->GetThemeColors());
+}
 }
 
 void ScTabViewShell::NotifyCursor(SfxViewShell* pOtherShell) const
diff --git a/sd/inc/theme/ThemeColorChanger.hxx 
b/sd/inc/theme/ThemeColorChang

core.git: desktop/source include/tools sc/source tools/Library_tl.mk tools/source ucb/source

2024-01-08 Thread Szymon Kłos (via logerrit)
 desktop/source/lib/init.cxx|8 +++
 include/tools/hostfilter.hxx   |   28 ++
 sc/source/core/tool/webservicelink.cxx |8 +--
 sc/source/ui/docshell/externalrefmgr.cxx   |5 +++-
 tools/Library_tl.mk|1 
 tools/source/inet/hostfilter.cxx   |   31 +
 ucb/source/ucp/webdav-curl/CurlSession.cxx |7 ++
 7 files changed, 85 insertions(+), 3 deletions(-)

New commits:
commit cf767af8de12157155eaf525ee845b196826aeb9
Author: Szymon Kłos 
AuthorDate: Fri Dec 1 08:35:51 2023 +0100
Commit: Szymon Kłos 
CommitDate: Tue Jan 9 07:49:11 2024 +0100

lok: external data source list

Make possible to filter allowed data sources.
It is used for WebDAV curl, WEBSERVICE function, cell external
references.

Change-Id: Ifc82af31ff1123b5656a21e6a27624fb1616db39
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160196
Tested-by: Jenkins CollaboraOffice 
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161772
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index b8acbcd9e599..dc6931e931bb 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -233,6 +233,8 @@
 #include 
 #include 
 
+#include 
+
 using namespace css;
 using namespace vcl;
 using namespace desktop;
@@ -7749,6 +7751,12 @@ static int lo_initialize(LibreOfficeKit* pThis, const 
char* pAppPath, const char
 }
 }
 
+char* pAllowlist = ::getenv("LOK_HOST_ALLOWLIST");
+if (pAllowlist)
+{
+HostFilter::setAllowedHostsRegex(pAllowlist);
+}
+
 // What stage are we at ?
 if (pThis == nullptr)
 {
diff --git a/include/tools/hostfilter.hxx b/include/tools/hostfilter.hxx
new file mode 100644
index ..afbf885b0cb4
--- /dev/null
+++ b/include/tools/hostfilter.hxx
@@ -0,0 +1,28 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+
+#ifndef INCLUDED_TOOLS_HOSTFILTER_HXX
+#define INCLUDED_TOOLS_HOSTFILTER_HXX
+
+#include 
+#include 
+
+// Helper for filtering allowed hosts for remote connections
+
+class TOOLS_DLLPUBLIC HostFilter
+{
+public:
+static void setAllowedHostsRegex(const char* sAllowedRegex);
+
+static bool isForbidden(const OUString& rHost);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/sc/source/core/tool/webservicelink.cxx 
b/sc/source/core/tool/webservicelink.cxx
index 156048430636..c30f34300edf 100644
--- a/sc/source/core/tool/webservicelink.cxx
+++ b/sc/source/core/tool/webservicelink.cxx
@@ -7,7 +7,6 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#include 
 #include 
 #include 
 #include 
@@ -16,6 +15,9 @@
 #include 
 #include 
 
+#include 
+#include 
+
 #include 
 #include 
 #include 
@@ -37,7 +39,9 @@ sfx2::SvBaseLink::UpdateResult 
ScWebServiceLink::DataChanged(const OUString&, co
 aResult.clear();
 bHasResult = false;
 
-if (comphelper::LibreOfficeKit::isActive())
+INetURLObject aURLObject(aURL);
+const OUString sHost = aURLObject.GetHost();
+if (HostFilter::isForbidden(sHost))
 {
 SAL_WARN("sc.ui", "ScWebServiceLink::DataChanged: blocked access to 
external file: \""
   << aURL << "\"");
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx 
b/sc/source/ui/docshell/externalrefmgr.cxx
index 860ea8058c6e..f5b3dbd26fa1 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -50,6 +50,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2542,7 +2543,9 @@ SfxObjectShellRef 
ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, OUSt
 if (!isFileLoadable(aFile))
 return nullptr;
 
-if (comphelper::LibreOfficeKit::isActive())
+INetURLObject aURLObject(aFile);
+const OUString sHost = aURLObject.GetHost();
+if (HostFilter::isForbidden(sHost))
 {
 SAL_WARN( "sc.ui", "ScExternalRefManager::loadSrcDocument: blocked 
access to external file: \"" << aFile << "\"");
 return nullptr;
diff --git a/tools/Library_tl.mk b/tools/Library_tl.mk
index 8269e6ae98bf..99176a7c0902 100644
--- a/tools/Library_tl.mk
+++ b/tools/Library_tl.mk
@@ -67,6 +67,7 @@ $(eval $(call gb_Library_add_exception_objects,tl,\
 tools/source/inet/inetmime 

core.git: desktop/source include/unotools unotools/source

2024-01-02 Thread Szymon Kłos (via logerrit)
 desktop/source/lib/init.cxx|8 
 include/unotools/pathoptions.hxx   |1 +
 unotools/source/config/pathoptions.cxx |6 ++
 3 files changed, 15 insertions(+)

New commits:
commit 21e58b94a2390a17571c30e91254f116d1566a2d
Author: Szymon Kłos 
AuthorDate: Thu Nov 30 15:36:57 2023 +0100
Commit: Szymon Kłos 
CommitDate: Tue Jan 2 13:00:33 2024 +0100

lok: import Work path from LOK_WORKDIR

Change-Id: If0c9727f53c1c4dfb78d1ccbd6b3ff602268bbf7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160156
Reviewed-by: Michael Meeks 
Tested-by: Jenkins CollaboraOffice 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161059
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index cc3139fcd22e..a54ebc6e469f 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -7977,6 +7977,14 @@ static int lo_initialize(LibreOfficeKit* pThis, const 
char* pAppPath, const char
 OUString aNewTemp;
 osl::FileBase::getTempDirURL(aNewTemp);
 aOptions.SetTempPath(aNewTemp);
+{
+const char *pWorkPath = getenv("LOK_WORKDIR");
+if (pWorkPath)
+{
+OString sWorkPath(pWorkPath);
+aOptions.SetWorkPath(OStringToOUString(sWorkPath, 
RTL_TEXTENCODING_UTF8));
+}
+}
 desktop::Desktop::CreateTemporaryDirectory();
 
 // The RequestHandler is specifically set to be ready when all the 
other
diff --git a/include/unotools/pathoptions.hxx b/include/unotools/pathoptions.hxx
index c7468048d5df..c19a2b34baf4 100644
--- a/include/unotools/pathoptions.hxx
+++ b/include/unotools/pathoptions.hxx
@@ -106,6 +106,7 @@ public:
 voidSetAutoTextPath( const OUString& rPath );
 voidSetBasicPath( const OUString& rPath );
 voidSetTempPath( const OUString& rPath );
+voidSetWorkPath( const OUString& rPath );
 
 OUStringSubstituteVariable( const OUString& rVar ) const;
 OUStringExpandMacros( const OUString& rPath ) const;
diff --git a/unotools/source/config/pathoptions.cxx 
b/unotools/source/config/pathoptions.cxx
index 24c1fb323dcc..4234ec903df9 100644
--- a/unotools/source/config/pathoptions.cxx
+++ b/unotools/source/config/pathoptions.cxx
@@ -122,6 +122,7 @@ class SvtPathOptions_Impl
 voidSetAutoTextPath( const OUString& rPath ) { SetPath( 
SvtPathOptions::Paths::AutoText, rPath ); }
 voidSetBasicPath( const OUString& rPath ) { SetPath( 
SvtPathOptions::Paths::Basic, rPath ); }
 voidSetTempPath( const OUString& rPath ) { SetPath( 
SvtPathOptions::Paths::Temp, rPath ); }
+voidSetWorkPath( const OUString& rPath ) { SetPath( 
SvtPathOptions::Paths::Work, rPath ); }
 
 OUString   SubstVar( const OUString& rVar ) const;
 OUString   ExpandMacros( const OUString& rPath ) const;
@@ -589,6 +590,11 @@ void SvtPathOptions::SetTempPath( const OUString& rPath )
 pImpl->SetTempPath( rPath );
 }
 
+void SvtPathOptions::SetWorkPath( const OUString& rPath )
+{
+pImpl->SetWorkPath( rPath );
+}
+
 OUString SvtPathOptions::SubstituteVariable( const OUString& rVar ) const
 {
 return pImpl->SubstVar( rVar );


core.git: sc/source

2023-12-20 Thread Szymon Kłos (via logerrit)
 sc/source/core/tool/webservicelink.cxx   |8 
 sc/source/ui/docshell/externalrefmgr.cxx |6 ++
 2 files changed, 14 insertions(+)

New commits:
commit dee13501d67ac544c090d68c95c9a9df75f8bf27
Author: Szymon Kłos 
AuthorDate: Mon Nov 27 09:56:27 2023 +0100
Commit: Szymon Kłos 
CommitDate: Wed Dec 20 16:00:44 2023 +0100

lok: Block requests to load external references

- currently in LOK case we don't open multiple files in
  one "environment"
- currently it opens import dialog which is synchronous - and that
  blocks whole app

Change-Id: I11c2c7f602ecf1e29b3d6fb2930ce873749bc2ef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159984
Tested-by: Jenkins CollaboraOffice 
    Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161058
Tested-by: Jenkins

diff --git a/sc/source/core/tool/webservicelink.cxx 
b/sc/source/core/tool/webservicelink.cxx
index b61907471e54..156048430636 100644
--- a/sc/source/core/tool/webservicelink.cxx
+++ b/sc/source/core/tool/webservicelink.cxx
@@ -7,6 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -36,6 +37,13 @@ sfx2::SvBaseLink::UpdateResult 
ScWebServiceLink::DataChanged(const OUString&, co
 aResult.clear();
 bHasResult = false;
 
+if (comphelper::LibreOfficeKit::isActive())
+{
+SAL_WARN("sc.ui", "ScWebServiceLink::DataChanged: blocked access to 
external file: \""
+  << aURL << "\"");
+return ERROR_GENERAL;
+}
+
 css::uno::Reference xFileAccess
 = 
css::ucb::SimpleFileAccess::create(comphelper::getProcessComponentContext());
 if (!xFileAccess.is())
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx 
b/sc/source/ui/docshell/externalrefmgr.cxx
index 24fb7a808e6d..01476aababe0 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -2542,6 +2542,12 @@ SfxObjectShellRef 
ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, OUSt
 if (!isFileLoadable(aFile))
 return nullptr;
 
+if (comphelper::LibreOfficeKit::isActive())
+{
+SAL_WARN( "sc.ui", "ScExternalRefManager::loadSrcDocument: blocked 
access to external file: \"" << aFile << "\"");
+return nullptr;
+}
+
 OUString aOptions = pFileData->maFilterOptions;
 if ( !pFileData->maFilterName.isEmpty() )
 rFilter = pFileData->maFilterName;  // don't overwrite stored 
filter with guessed filter


core.git: Branch 'distro/collabora/co-23.05' - cui/uiconfig

2023-12-20 Thread Szymon Kłos (via logerrit)
 cui/uiconfig/ui/widgettestdialog.ui |   25 -
 1 file changed, 24 insertions(+), 1 deletion(-)

New commits:
commit 723805a678eda4fccc0aa67da115345f4e167b32
Author: Szymon Kłos 
AuthorDate: Mon Dec 18 21:06:18 2023 +0100
Commit: Szymon Kłos 
CommitDate: Wed Dec 20 11:28:07 2023 +0100

Don't use the same store 2 times in WidgetTestDialog ui

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

diff --git a/cui/uiconfig/ui/widgettestdialog.ui 
b/cui/uiconfig/ui/widgettestdialog.ui
index 763f74d1ec73..71f013dbaecc 100644
--- a/cui/uiconfig/ui/widgettestdialog.ui
+++ b/cui/uiconfig/ui/widgettestdialog.ui
@@ -266,7 +266,7 @@
   
 True
 False
-liststore1
+liststore4
 True
 0
 1
@@ -630,6 +630,29 @@ t ever since the 1500s, when an unknown printer took a 
galley of type and scramb
   
 
   
+  
+
+  
+  
+
+
+  
+Test 1
+  
+  
+Test 2
+  
+  
+Test 3
+  
+  
+Test 4
+  
+  
+Test 5
+  
+
+  
   
 
   


core.git: Branch 'distro/collabora/co-23.05' - include/sfx2 sc/source sd/source sfx2/source sw/source

2023-12-20 Thread Szymon Kłos (via logerrit)
 include/sfx2/lokhelper.hxx |2 +-
 sc/source/filter/html/htmlpars.cxx |2 +-
 sc/source/ui/drawfunc/fuins1.cxx   |   11 +++
 sd/source/ui/func/fuinsert.cxx |   14 +-
 sfx2/source/view/lokhelper.cxx |4 ++--
 sw/source/filter/html/htmlgrin.cxx |2 +-
 sw/source/uibase/uiview/view2.cxx  |   10 ++
 7 files changed, 39 insertions(+), 6 deletions(-)

New commits:
commit 81dc88afa5742aef1e3631f75cad0f99ef50bf95
Author: Szymon Kłos 
AuthorDate: Tue Dec 19 19:24:19 2023 +0100
Commit: Caolán McNamara 
CommitDate: Wed Dec 20 11:19:07 2023 +0100

lok: send error on access denied in image import 2

followup for commit 64624d225c71229acce4f889d4863d7c29c52658
lok: send error on access denied in image import

It shows an error in LOK when we try to insert image
from remote host blocked by HostFilter

Previously it was showing error in paste case,
now do the same also on image insertion.

For now disable HandleGraphicFilterError in sd, as it
crashes, is synchronous and cannot be easily fixed
- dialog sits inside module not linked to sfx2, needs
some rework.

Change-Id: I3c15ff5621add97ef9d60d4f4c1305dae2909158
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161001
Tested-by: Jenkins CollaboraOffice 
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index 24a508859fa1..e015cad58cda 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -227,7 +227,7 @@ public:
 static VclPtr getInPlaceDocWindow(SfxViewShell* pViewShell);
 
 /// Sends Network Access error to LOK
-static void sendNetworkAccessError();
+static void sendNetworkAccessError(std::string_view rAction);
 
 static void notifyLog(const std::ostringstream& stream);
 
diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index d0d00a9ecc29..e8abde6c92d7 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -1325,7 +1325,7 @@ void ScHTMLLayoutParser::Image( HtmlImportInfo* pInfo )
 {
 INetURLObject aURL(pImage->aURL);
 if (HostFilter::isForbidden(aURL.GetHost()))
-SfxLokHelper::sendNetworkAccessError();
+SfxLokHelper::sendNetworkAccessError("paste");
 }
 
 sal_uInt16 nFormat;
diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx
index 9816bdb1e363..db40755682ad 100644
--- a/sc/source/ui/drawfunc/fuins1.cxx
+++ b/sc/source/ui/drawfunc/fuins1.cxx
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -48,6 +49,9 @@
 #include 
 #include 
 
+#include 
+#include 
+
 #include 
 #include 
 #include 
@@ -279,6 +283,13 @@ FuInsertGraphic::FuInsertGraphic( ScTabViewShell&   
rViewSh,
 if ( pReqArgs->GetItemState( FN_PARAM_1, true, &pItem ) == 
SfxItemState::SET )
 bAsLink = static_cast(pItem)->GetValue();
 
+if (comphelper::LibreOfficeKit::isActive())
+{
+INetURLObject aURL(aFileName);
+if (INetProtocol::File != aURL.GetProtocol() && 
HostFilter::isForbidden(aURL.GetHost()))
+SfxLokHelper::sendNetworkAccessError("insert");
+}
+
 Graphic aGraphic;
 ErrCode nError = GraphicFilter::LoadGraphic( aFileName, aFilterName, 
aGraphic, &GraphicFilter::GetGraphicFilter() );
 if ( nError == ERRCODE_NONE )
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index a00cb453d6b0..3ca5b863fb2b 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -36,6 +36,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -58,6 +59,9 @@
 #include 
 #include 
 
+#include 
+#include 
+
 #include 
 #include 
 #include 
@@ -127,6 +131,13 @@ void FuInsertGraphic::DoExecute( SfxRequest& rReq )
 if ( pArgs->GetItemState( FN_PARAM_1, true, &pItem ) == 
SfxItemState::SET )
 bAsLink = static_cast(pItem)->GetValue();
 
+if (comphelper::LibreOfficeKit::isActive())
+{
+INetURLObject aURL(aFileName);
+if (INetProtocol::File != aURL.GetProtocol() && 
HostFilter::isForbidden(aURL.GetHost()))
+SfxLokHelper::sendNetworkAccessError("insert");
+}
+
 nError = GraphicFilter::LoadGraphic( aFileName, aFilterName, aGraphic, 
&GraphicFilter::GetGraphicFilter() );
 }
 else
@@ -186,8 +197,9 @@ void FuInsertGraphic::DoExecute( SfxRequest& rReq )
 }
 }
 }
-else
+else if (!comphelper::LibreOfficeKit::isActive())
 {
+// TODO: enable in LOK, it contains synchronous error window without 
LOKNotifier
 SdGRFFilter::HandleGraphicFilterError( nError,

core.git: Branch 'distro/collabora/co-23.05' - include/sfx2 sc/source sfx2/source sw/source

2023-12-07 Thread Szymon Kłos (via logerrit)
 include/sfx2/lokhelper.hxx |3 +++
 sc/source/filter/html/htmlpars.cxx |   10 ++
 sfx2/source/view/lokhelper.cxx |   17 +
 sw/source/filter/html/htmlgrin.cxx |6 ++
 4 files changed, 36 insertions(+)

New commits:
commit 64624d225c71229acce4f889d4863d7c29c52658
Author: Szymon Kłos 
AuthorDate: Mon Dec 4 18:36:29 2023 +0100
Commit: Szymon Kłos 
CommitDate: Thu Dec 7 14:58:33 2023 +0100

lok: send error on access denied in image import

- when we paste HTML with references to external images
  and host filter is configured then we have empty graphics
- inform client about that so we can show an error to the user

Change-Id: I7d584c256d8d004955c970056341ab42864d1dd3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160319
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 
Reviewed-by: Szymon Kłos 

diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index 6df7e0cdc341..24a508859fa1 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -226,6 +226,9 @@ public:
 
 static VclPtr getInPlaceDocWindow(SfxViewShell* pViewShell);
 
+/// Sends Network Access error to LOK
+static void sendNetworkAccessError();
+
 static void notifyLog(const std::ostringstream& stream);
 
 private:
diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index c2414d858802..d0d00a9ecc29 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -20,6 +20,7 @@
 #include 
 #include 
 
+#include 
 #include 
 
 #include 
@@ -37,6 +38,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -47,6 +49,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1318,6 +1321,13 @@ void ScHTMLLayoutParser::Image( HtmlImportInfo* pInfo )
 return ;
 }
 
+if (comphelper::LibreOfficeKit::isActive())
+{
+INetURLObject aURL(pImage->aURL);
+if (HostFilter::isForbidden(aURL.GetHost()))
+SfxLokHelper::sendNetworkAccessError();
+}
+
 sal_uInt16 nFormat;
 std::optional oGraphic(std::in_place);
 GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 8ace83445ae0..0d3843632f13 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -1067,4 +1068,20 @@ VclPtr 
SfxLokHelper::getInPlaceDocWindow(SfxViewShell* pViewShell)
 return {};
 }
 
+void SfxLokHelper::sendNetworkAccessError()
+{
+tools::JsonWriter aWriter;
+aWriter.put("code", static_cast(
+ErrCode(ErrCodeArea::Inet, sal_uInt16(ErrCodeClass::Access;
+aWriter.put("kind", "network");
+aWriter.put("cmd", "paste");
+
+SfxViewShell* pViewShell = SfxViewShell::Current();
+if (pViewShell)
+{
+pViewShell->libreOfficeKitViewCallback(
+LOK_CALLBACK_ERROR, aWriter.extractAsStdString().c_str());
+}
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/htmlgrin.cxx 
b/sw/source/filter/html/htmlgrin.cxx
index 840a80962293..1967b93c1ea3 100644
--- a/sw/source/filter/html/htmlgrin.cxx
+++ b/sw/source/filter/html/htmlgrin.cxx
@@ -19,6 +19,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -34,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -68,6 +70,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -508,6 +511,9 @@ IMAGE_SETEVENT:
 }
 else if (m_sBaseURL.isEmpty() || !aGraphicData.isEmpty())
 {
+if (comphelper::LibreOfficeKit::isActive() && 
HostFilter::isForbidden(aGraphicURL.GetHost()))
+SfxLokHelper::sendNetworkAccessError();
+
 // sBaseURL is empty if the source is clipboard
 // aGraphicData is non-empty for  -> not a linked 
graphic.
 if (ERRCODE_NONE == 
GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, aGraphicURL))


[Libreoffice-commits] core.git: Changes to 'private/mmeeks/sandbox'

2023-12-02 Thread Szymon Kłos (via logerrit)
New branch 'private/mmeeks/sandbox' available with the following commits:
commit 16306492b8b584fc5f5ec835b6a91dd11259c59c
Author: Szymon Kłos 
Date:   Wed Nov 29 14:00:32 2023 +0100

sal: osl::File allow to create files in sandbox

"realpath" returns NULL for path which doesn't exist.
Allow usage of non-existing paths if parent is allowed.
This allows to successfully start the sandboxed kit.

osl_setAllowedPaths will allow now to use:
/foo/bar/nonexisting - previously it was ignored, is needed for LOK
but /foo/bar/nonexisting/newlevel - still cannot be used

isForbidden now checks parents of non-existing dir and assumes
the same permissions, if parent doesn't exist - it tries with
parent of parent, etc ...

Change-Id: I1052747ca284d2f81dfd5c5fbf893936e7426220
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160111
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Michael Meeks 

commit 8381590b8ba86dcaf9e9c27574b85df7d53b5198
Author: Szymon Kłos 
Date:   Thu Nov 30 15:36:57 2023 +0100

lok: import Work path from LOK_WORKDIR

Change-Id: If0c9727f53c1c4dfb78d1ccbd6b3ff602268bbf7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160156
Reviewed-by: Michael Meeks 
Tested-by: Jenkins CollaboraOffice 

commit 921bb9f237eb1dfa9b5dc4add7502ec463b9d934
Author: Michael Meeks 
Date:   Sat Nov 25 21:24:49 2023 +

lok: import allowed paths from the SAL_ALLOWED_PATHS.

Do this on second init, in order to be able to reset this for
each child kit process.

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

commit 615c8b01f03b60c0a58bf3484b81083509bcbcc4
Author: Michael Meeks 
Date:   Wed Nov 22 19:37:38 2023 +

sal: initial osl::File sand-boxing commit for Unix.

Change-Id: If2c106fef9640499b82b5cf350cb5169beb219fb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159838
Reviewed-by: Szymon Kłos 
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Michael Meeks 



[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - desktop/source include/tools sc/source tools/Library_tl.mk tools/source ucb/source

2023-12-01 Thread Szymon Kłos (via logerrit)
 desktop/source/lib/init.cxx|8 ++
 include/tools/hostfilter.hxx   |   28 +++
 sc/source/core/tool/webservicelink.cxx |8 +-
 sc/source/ui/docshell/externalrefmgr.cxx   |5 +++-
 tools/Library_tl.mk|1 
 tools/source/inet/hostfilter.cxx   |   34 +
 ucb/source/ucp/webdav-curl/CurlSession.cxx |7 +
 7 files changed, 88 insertions(+), 3 deletions(-)

New commits:
commit 5157041d6d2eb91072ab97e5428452d8c5cd1839
Author: Szymon Kłos 
AuthorDate: Fri Dec 1 08:35:51 2023 +0100
Commit: Caolán McNamara 
CommitDate: Fri Dec 1 15:33:44 2023 +0100

lok: external data source list

Make possible to filter allowed data sources.
It is used for WebDAV curl, WEBSERVICE function, cell external
references.

Change-Id: Ifc82af31ff1123b5656a21e6a27624fb1616db39
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160196
Tested-by: Jenkins CollaboraOffice 
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 9a640bc5f2c4..13fcfad60f1f 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -239,6 +239,8 @@
 #include 
 #include 
 
+#include 
+
 using namespace css;
 using namespace vcl;
 using namespace desktop;
@@ -7775,6 +,12 @@ static int lo_initialize(LibreOfficeKit* pThis, const 
char* pAppPath, const char
 }
 #endif
 
+char* pAllowlist = ::getenv("LOK_HOST_ALLOWLIST");
+if (pAllowlist)
+{
+HostFilter::setAllowedHostsRegex(pAllowlist);
+}
+
 // What stage are we at ?
 if (pThis == nullptr)
 {
diff --git a/include/tools/hostfilter.hxx b/include/tools/hostfilter.hxx
new file mode 100644
index ..afbf885b0cb4
--- /dev/null
+++ b/include/tools/hostfilter.hxx
@@ -0,0 +1,28 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+
+#ifndef INCLUDED_TOOLS_HOSTFILTER_HXX
+#define INCLUDED_TOOLS_HOSTFILTER_HXX
+
+#include 
+#include 
+
+// Helper for filtering allowed hosts for remote connections
+
+class TOOLS_DLLPUBLIC HostFilter
+{
+public:
+static void setAllowedHostsRegex(const char* sAllowedRegex);
+
+static bool isForbidden(const OUString& rHost);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/sc/source/core/tool/webservicelink.cxx 
b/sc/source/core/tool/webservicelink.cxx
index 156048430636..c30f34300edf 100644
--- a/sc/source/core/tool/webservicelink.cxx
+++ b/sc/source/core/tool/webservicelink.cxx
@@ -7,7 +7,6 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#include 
 #include 
 #include 
 #include 
@@ -16,6 +15,9 @@
 #include 
 #include 
 
+#include 
+#include 
+
 #include 
 #include 
 #include 
@@ -37,7 +39,9 @@ sfx2::SvBaseLink::UpdateResult 
ScWebServiceLink::DataChanged(const OUString&, co
 aResult.clear();
 bHasResult = false;
 
-if (comphelper::LibreOfficeKit::isActive())
+INetURLObject aURLObject(aURL);
+const OUString sHost = aURLObject.GetHost();
+if (HostFilter::isForbidden(sHost))
 {
 SAL_WARN("sc.ui", "ScWebServiceLink::DataChanged: blocked access to 
external file: \""
   << aURL << "\"");
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx 
b/sc/source/ui/docshell/externalrefmgr.cxx
index 0b8215cd3edc..5db6f8f0e4bc 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -50,6 +50,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2537,7 +2538,9 @@ SfxObjectShellRef 
ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, OUSt
 if (!isFileLoadable(aFile))
 return nullptr;
 
-if (comphelper::LibreOfficeKit::isActive())
+INetURLObject aURLObject(aFile);
+const OUString sHost = aURLObject.GetHost();
+if (HostFilter::isForbidden(sHost))
 {
 SAL_WARN( "sc.ui", "ScExternalRefManager::loadSrcDocument: blocked 
access to external file: \"" << aFile << "\"");
 return nullptr;
diff --git a/tools/Library_tl.mk b/tools/Library_tl.mk
index 8269e6ae98bf..99176a7c0902 100644
--- a/tools/Library_tl.mk
+++ b/tools/Library_tl.mk
@@ -67,6 +67,7 @@ $(eval $(call gb_Library_add_exception_objects,tl,\
 tools/source/inet/inetmime \
 tools/source/inet/inetmsg \
 tools/source/inet/inetstrm \
+tools/source/inet/hostfilter \
 tools/source/m

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

2023-11-30 Thread Szymon Kłos (via logerrit)
 sal/osl/unx/file.cxx |   46 ++-
 sal/qa/osl/file/osl_File.cxx |   25 +++
 2 files changed, 62 insertions(+), 9 deletions(-)

New commits:
commit c3bdba781e8c9d61ca9e2a3d8d2eaca435b9aaad
Author: Szymon Kłos 
AuthorDate: Wed Nov 29 14:00:32 2023 +0100
Commit: Szymon Kłos 
CommitDate: Thu Nov 30 20:08:06 2023 +0100

sal: osl::File allow to create files in sandbox

"realpath" returns NULL for path which doesn't exist.
Allow usage of non-existing paths if parent is allowed.
This allows to successfully start the sandboxed kit.

osl_setAllowedPaths will allow now to use:
/foo/bar/nonexisting - previously it was ignored, is needed for LOK
but /foo/bar/nonexisting/newlevel - still cannot be used

isForbidden now checks parents of non-existing dir and assumes
the same permissions, if parent doesn't exist - it tries with
parent of parent, etc ...

Change-Id: I1052747ca284d2f81dfd5c5fbf893936e7426220
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160111
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Michael Meeks 

diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index 0556be7fc97a..d5b76a09a47a 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -788,6 +788,18 @@ static std::vector allowedPathsRead;
 static std::vector allowedPathsReadWrite;
 static std::vector allowedPathsExecute;
 
+static OString getParentFolder(const OString &rFilePath)
+{
+sal_Int32 n = rFilePath.lastIndexOf('/');
+OString folderPath;
+if (n < 1)
+folderPath = ".";
+else
+folderPath = rFilePath.copy(0, n);
+
+return folderPath;
+}
+
 SAL_DLLPUBLIC void osl_setAllowedPaths(
 rtl_uString *pustrFilePaths
 )
@@ -818,9 +830,25 @@ SAL_DLLPUBLIC void osl_setAllowedPaths(
 }
 
 char resolvedPath[PATH_MAX];
-if (realpath(aPath.getStr(), resolvedPath))
+bool isResolved = !!realpath(aPath.getStr(), resolvedPath);
+bool notExists = !isResolved && errno == ENOENT;
+
+if (notExists)
 {
-OString aPushPath = OString(resolvedPath, strlen(resolvedPath));
+sal_Int32 n = aPath.lastIndexOf('/');
+OString folderPath = getParentFolder(aPath);
+isResolved = !!realpath(folderPath.getStr(), resolvedPath);
+notExists = !isResolved && errno == ENOENT;
+
+if (notExists || !isResolved || strlen(resolvedPath) + 
aPath.getLength() - n + 1 >= PATH_MAX)
+return; // too bad
+else
+strcat(resolvedPath, aPath.getStr() + n);
+}
+
+if (isResolved)
+{
+OString aPushPath(resolvedPath, strlen(resolvedPath));
 if (eType == 'r')
 allowedPathsRead.push_back(aPushPath);
 else if (eType == 'w')
@@ -850,13 +878,13 @@ bool isForbidden(const OString &filePath, int nFlags)
 // fail to resolve. Thankfully our I/O APIs don't allow
 // symlink creation to race here.
 sal_Int32 n = filePath.lastIndexOf('/');
-OString folderPath;
-if (n < 1)
-folderPath = ".";
-else
-folderPath = filePath.copy(0, n);
-if (!realpath(folderPath.getStr(), resolvedPath) ||
-strlen(resolvedPath) + filePath.getLength() - n + 1 >= PATH_MAX)
+OString folderPath = getParentFolder(filePath);
+
+bool isResolved = !!realpath(folderPath.getStr(), resolvedPath);
+bool notExists = !isResolved && errno == ENOENT;
+if (notExists) // folder doesn't exist, check parent, in the end of 
chain checks "."
+return isForbidden(folderPath, nFlags);
+else if (!isResolved || strlen(resolvedPath) + filePath.getLength() - 
n + 1 >= PATH_MAX)
 return true; // too bad
 else
 strcat(resolvedPath, filePath.getStr() + n);
diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx
index 0703e89493b9..cdd72d45fa72 100644
--- a/sal/qa/osl/file/osl_File.cxx
+++ b/sal/qa/osl/file/osl_File.cxx
@@ -1352,6 +1352,19 @@ namespace osl_Forbidden
 void forbidden()
 {
 File::setAllowedPaths(maScratchGood);
+
+// check some corner cases first
+CPPUNIT_ASSERT_EQUAL_MESSAGE("read bad should be forbidden",
+ true, File::isForbidden(".", 
osl_File_OpenFlag_Read));
+CPPUNIT_ASSERT_EQUAL_MESSAGE("read bad should be forbidden",
+ true, File::isForbidden("", 
osl_File_OpenFlag_Read));
+CPPUNIT_ASSERT_EQUAL_MESSAGE("read bad should be forbidden",
+

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

2023-11-30 Thread Szymon Kłos (via logerrit)
 desktop/source/lib/init.cxx |8 
 1 file changed, 8 insertions(+)

New commits:
commit de6b66f2d9572480bce038b2a03e9ca5b1730b9f
Author: Szymon Kłos 
AuthorDate: Thu Nov 30 15:36:57 2023 +0100
Commit: Szymon Kłos 
CommitDate: Thu Nov 30 19:54:01 2023 +0100

lok: import Work path from LOK_WORKDIR

Change-Id: If0c9727f53c1c4dfb78d1ccbd6b3ff602268bbf7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160156
Reviewed-by: Michael Meeks 
Tested-by: Jenkins CollaboraOffice 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 3c658388306a..9a640bc5f2c4 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -8000,6 +8000,14 @@ static int lo_initialize(LibreOfficeKit* pThis, const 
char* pAppPath, const char
 OUString aNewTemp;
 osl::FileBase::getTempDirURL(aNewTemp);
 aOptions.SetTempPath(aNewTemp);
+{
+const char *pWorkPath = getenv("LOK_WORKDIR");
+if (pWorkPath)
+{
+OString sWorkPath(pWorkPath);
+aOptions.SetWorkPath(OStringToOUString(sWorkPath, 
RTL_TEXTENCODING_UTF8));
+}
+}
 desktop::Desktop::CreateTemporaryDirectory();
 
 // The RequestHandler is specifically set to be ready when all the 
other


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

2023-11-28 Thread Szymon Kłos (via logerrit)
 sc/source/core/tool/webservicelink.cxx   |8 
 sc/source/ui/docshell/externalrefmgr.cxx |6 ++
 2 files changed, 14 insertions(+)

New commits:
commit 42109bda9972738b6e7a4448127458c7d24be4dc
Author: Szymon Kłos 
AuthorDate: Mon Nov 27 09:56:27 2023 +0100
Commit: Szymon Kłos 
CommitDate: Tue Nov 28 11:20:45 2023 +0100

lok: Block requests to load external references

- currently in LOK case we don't open multiple files in
  one "environment"
- currently it opens import dialog which is synchronous - and that
  blocks whole app

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

diff --git a/sc/source/core/tool/webservicelink.cxx 
b/sc/source/core/tool/webservicelink.cxx
index b61907471e54..156048430636 100644
--- a/sc/source/core/tool/webservicelink.cxx
+++ b/sc/source/core/tool/webservicelink.cxx
@@ -7,6 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -36,6 +37,13 @@ sfx2::SvBaseLink::UpdateResult 
ScWebServiceLink::DataChanged(const OUString&, co
 aResult.clear();
 bHasResult = false;
 
+if (comphelper::LibreOfficeKit::isActive())
+{
+SAL_WARN("sc.ui", "ScWebServiceLink::DataChanged: blocked access to 
external file: \""
+  << aURL << "\"");
+return ERROR_GENERAL;
+}
+
 css::uno::Reference xFileAccess
 = 
css::ucb::SimpleFileAccess::create(comphelper::getProcessComponentContext());
 if (!xFileAccess.is())
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx 
b/sc/source/ui/docshell/externalrefmgr.cxx
index 0653d4609aee..0b8215cd3edc 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -2537,6 +2537,12 @@ SfxObjectShellRef 
ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, OUSt
 if (!isFileLoadable(aFile))
 return nullptr;
 
+if (comphelper::LibreOfficeKit::isActive())
+{
+SAL_WARN( "sc.ui", "ScExternalRefManager::loadSrcDocument: blocked 
access to external file: \"" << aFile << "\"");
+return nullptr;
+}
+
 OUString aOptions = pFileData->maFilterOptions;
 if ( !pFileData->maFilterName.isEmpty() )
 rFilter = pFileData->maFilterName;  // don't overwrite stored 
filter with guessed filter


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

2023-11-22 Thread Szymon Kłos (via logerrit)
 sw/source/uibase/dochdl/swdtflvr.cxx |   15 ++-
 sw/source/uibase/inc/swdtflvr.hxx|2 ++
 sw/source/uibase/inc/uivwimp.hxx |2 ++
 sw/source/uibase/uiview/uivwimp.cxx  |   13 +
 4 files changed, 27 insertions(+), 5 deletions(-)

New commits:
commit 5dcc658d7fc6bd6f8002666e40e1f1bff3dd4c69
Author: Szymon Kłos 
AuthorDate: Thu Nov 16 17:13:37 2023 +0100
Commit: Szymon Kłos 
CommitDate: Wed Nov 22 15:41:22 2023 +0100

lok: disconnect clipboard leftovers in Writer to avoid crash

When we closed one view which previously copied some larger selection
in the Writer and other session after that modified content of that 
selection
we got a crash. It was caused by old clipboard data still beeing used.
On copy there is created SwTransferDdeLink which creates "Server" - 
SvLinkSource
which is notified in SwTransferDdeLink::DataChanged when someone is
editing
previously copied selection. Let's disconnect that server on view close
as it is no longer needed.

some characteristic trace pieces for crash:

libsofficeapp.so!LOKClipboard::setContents(LOKClipboard * this, const 
com::sun::star::uno::Reference & 
xTrans, const 
com::sun::star::uno::Reference
 & xClipboardOwner)
...
libswlo.so!SwTransferable::RemoveDDELinkFormat(SwTransferable * this, 
vcl::Window & rWin)
...
libsfxlo.so!sfx2::SvLinkSource::NotifyDataChanged(sfx2::SvLinkSource * this)
...
libswlo.so!SwDataChanged::~SwDataChanged(SwDataChanged * this)

Change-Id: I2ebab3db8bc42e20781874802563352ef263fdaa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159563
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159755
Tested-by: Jenkins
    Reviewed-by: Szymon Kłos 

diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx 
b/sw/source/uibase/dochdl/swdtflvr.cxx
index fc5f9f73a0a5..91eb38e0f45c 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -283,11 +283,7 @@ SwTransferable::~SwTransferable()
 SolarMutexGuard aSolarGuard;
 
 // the DDELink still needs the WrtShell!
-if( m_xDdeLink.is() )
-{
-static_cast( m_xDdeLink.get() )->Disconnect( true 
);
-m_xDdeLink.clear();
-}
+DisconnectDDE();
 
 m_pWrtShell = nullptr;
 
@@ -393,6 +389,15 @@ void SwTransferable::RemoveDDELinkFormat(vcl::Window& rWin)
 CopyToClipboard(&rWin);
 }
 
+void SwTransferable::DisconnectDDE()
+{
+if( m_xDdeLink.is() )
+{
+static_cast( m_xDdeLink.get() )->Disconnect( true 
);
+m_xDdeLink.clear();
+}
+}
+
 namespace
 {
 //Resolves: fdo#40717 surely when we create a clipboard document we should
diff --git a/sw/source/uibase/inc/swdtflvr.hxx 
b/sw/source/uibase/inc/swdtflvr.hxx
index 86531267af9d..e7e1849a0dc9 100644
--- a/sw/source/uibase/inc/swdtflvr.hxx
+++ b/sw/source/uibase/inc/swdtflvr.hxx
@@ -185,6 +185,8 @@ public:
 
 // remove the DDE-Link format promise
 void RemoveDDELinkFormat(vcl::Window& rWin);
+// disconnect to not receive DataChanged listener notifications
+void DisconnectDDE();
 
 // paste - methods and helper methods for the paste
 static bool IsPaste( const SwWrtShell&, const TransferableDataHelper& );
diff --git a/sw/source/uibase/inc/uivwimp.hxx b/sw/source/uibase/inc/uivwimp.hxx
index cbdfb18c7fc9..65a0bf4f23e2 100644
--- a/sw/source/uibase/inc/uivwimp.hxx
+++ b/sw/source/uibase/inc/uivwimp.hxx
@@ -112,6 +112,8 @@ class SwView_Impl
 boolm_bSelectObject;
 boolm_bEditingPositionSet;
 
+voidDisconnectTransferableDDE();
+
 public:
 /// Redline author that's specific to this view.
 OUString m_sRedlineAuthor;
diff --git a/sw/source/uibase/uiview/uivwimp.cxx 
b/sw/source/uibase/uiview/uivwimp.cxx
index 71f97dbbc9d1..ed0c3c68fcfc 100644
--- a/sw/source/uibase/uiview/uivwimp.cxx
+++ b/sw/source/uibase/uiview/uivwimp.cxx
@@ -65,6 +65,7 @@ SwView_Impl::~SwView_Impl()
 m_xDispatchProviderInterceptor->Invalidate();
 mxXTextView->Invalidate();
 mxXTextView.clear();
+
 if( mxScanEvtLstnr.is() )
mxScanEvtLstnr->ViewDestroyed();
 if( mxClipEvtLstnr.is() )
@@ -72,6 +73,8 @@ SwView_Impl::~SwView_Impl()
 mxClipEvtLstnr->AddRemoveListener( false );
 mxClipEvtLstnr->ViewDestroyed();
 }
+DisconnectTransferableDDE();
+
 #if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
 m_xConfigItem.reset();
 #endif
@@ -215,6 +218,16 @@ void SwView_Impl::Invalidate()
 }
 }
 
+void SwView_Impl::DisconnectTransferableDDE()
+{
+for (const auto& xTransferable: mxTransferables)
+{
+rtl::Reference pTransferable = xTransferable.get();
+if(pTransferable)
+pTransferable->DisconnectDDE();
+}
+}
+
 void SwView_Impl::AddTransferable(SwTransferable& rTransferable)
 {
 //prevent removing of the non-referenced SwTransferable


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

2023-11-22 Thread Szymon Kłos (via logerrit)
 sw/source/uibase/dochdl/swdtflvr.cxx |   15 ++-
 sw/source/uibase/inc/swdtflvr.hxx|2 ++
 sw/source/uibase/inc/uivwimp.hxx |2 ++
 sw/source/uibase/uiview/uivwimp.cxx  |   13 +
 4 files changed, 27 insertions(+), 5 deletions(-)

New commits:
commit 445a0945e4d263c6bda37c58a7f6283ada5e2e36
Author: Szymon Kłos 
AuthorDate: Thu Nov 16 17:13:37 2023 +0100
Commit: Miklos Vajna 
CommitDate: Wed Nov 22 09:02:22 2023 +0100

lok: disconnect clipboard leftovers in Writer to avoid crash

When we closed one view which previously copied some larger selection
in the Writer and other session after that modified content of that 
selection
we got a crash. It was caused by old clipboard data still beeing used.
On copy there is created SwTransferDdeLink which creates "Server" - 
SvLinkSource
which is notified in SwTransferDdeLink::DataChanged when someone is
editing
previously copied selection. Let's disconnect that server on view close
as it is no longer needed.

some characteristic trace pieces for crash:

libsofficeapp.so!LOKClipboard::setContents(LOKClipboard * this, const 
com::sun::star::uno::Reference & 
xTrans, const 
com::sun::star::uno::Reference
 & xClipboardOwner)
...
libswlo.so!SwTransferable::RemoveDDELinkFormat(SwTransferable * this, 
vcl::Window & rWin)
...
libsfxlo.so!sfx2::SvLinkSource::NotifyDataChanged(sfx2::SvLinkSource * this)
...
libswlo.so!SwDataChanged::~SwDataChanged(SwDataChanged * this)

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

diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx 
b/sw/source/uibase/dochdl/swdtflvr.cxx
index 6c747df13c3f..3c0baabb3410 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -283,11 +283,7 @@ SwTransferable::~SwTransferable()
 SolarMutexGuard aSolarGuard;
 
 // the DDELink still needs the WrtShell!
-if( m_xDdeLink.is() )
-{
-static_cast( m_xDdeLink.get() )->Disconnect( true 
);
-m_xDdeLink.clear();
-}
+DisconnectDDE();
 
 m_pWrtShell = nullptr;
 
@@ -393,6 +389,15 @@ void SwTransferable::RemoveDDELinkFormat(vcl::Window& rWin)
 CopyToClipboard(&rWin);
 }
 
+void SwTransferable::DisconnectDDE()
+{
+if( m_xDdeLink.is() )
+{
+static_cast( m_xDdeLink.get() )->Disconnect( true 
);
+m_xDdeLink.clear();
+}
+}
+
 namespace
 {
 //Resolves: fdo#40717 surely when we create a clipboard document we should
diff --git a/sw/source/uibase/inc/swdtflvr.hxx 
b/sw/source/uibase/inc/swdtflvr.hxx
index df16e3a8bd56..ac0579a3a9f0 100644
--- a/sw/source/uibase/inc/swdtflvr.hxx
+++ b/sw/source/uibase/inc/swdtflvr.hxx
@@ -185,6 +185,8 @@ public:
 
 // remove the DDE-Link format promise
 void RemoveDDELinkFormat(vcl::Window& rWin);
+// disconnect to not receive DataChanged listener notifications
+void DisconnectDDE();
 
 // paste - methods and helper methods for the paste
 static bool IsPaste( const SwWrtShell&, const TransferableDataHelper& );
diff --git a/sw/source/uibase/inc/uivwimp.hxx b/sw/source/uibase/inc/uivwimp.hxx
index 1cb5fd6590ed..3600ddc2258a 100644
--- a/sw/source/uibase/inc/uivwimp.hxx
+++ b/sw/source/uibase/inc/uivwimp.hxx
@@ -110,6 +110,8 @@ class SwView_Impl
 boolm_bSelectObject;
 boolm_bEditingPositionSet;
 
+voidDisconnectTransferableDDE();
+
 public:
 /// Redline author that's specific to this view.
 OUString m_sRedlineAuthor;
diff --git a/sw/source/uibase/uiview/uivwimp.cxx 
b/sw/source/uibase/uiview/uivwimp.cxx
index cea09ed3b5ba..7729c01c22f1 100644
--- a/sw/source/uibase/uiview/uivwimp.cxx
+++ b/sw/source/uibase/uiview/uivwimp.cxx
@@ -67,6 +67,7 @@ SwView_Impl::~SwView_Impl()
 view::XSelectionSupplier* pTextView = mxXTextView.get();
 static_cast(pTextView)->Invalidate();
 mxXTextView.clear();
+
 if( mxScanEvtLstnr.is() )
mxScanEvtLstnr->ViewDestroyed();
 if( mxClipEvtLstnr.is() )
@@ -74,6 +75,8 @@ SwView_Impl::~SwView_Impl()
 mxClipEvtLstnr->AddRemoveListener( false );
 mxClipEvtLstnr->ViewDestroyed();
 }
+DisconnectTransferableDDE();
+
 #if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
 m_xConfigItem.reset();
 #endif
@@ -218,6 +221,16 @@ void SwView_Impl::Invalidate()
 }
 }
 
+void SwView_Impl::DisconnectTransferableDDE()
+{
+for (const auto& xTransferable: mxTransferables)
+{
+auto pTransferable = 
comphelper::getFromUnoTunnel(xTransferable.get());
+if(pTransferable)
+pTransferable->DisconnectDDE();
+}
+}
+
 void SwView_Impl::AddTransferable(SwTransferable& rTransferable)
 {
 //prevent removing of the non-referenced SwTransferable


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

2023-11-20 Thread Szymon Kłos (via logerrit)
 sfx2/source/appl/linksrc.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 3baab25f4a58aaf24b1671cea050ed3291718091
Author: Szymon Kłos 
AuthorDate: Mon Nov 6 18:35:20 2023 +0100
Commit: Xisco Fauli 
CommitDate: Mon Nov 20 17:36:24 2023 +0100

lok: fix crash on DDE Link modify

1. Open document with editable DDE Link section in 2 views
2. View A selects content containing section and copies that
3. View A is closed
4. View B tries to modify section
Result: crash

Avoid destroying SwTransferDdeLink in SwTransferable::~SwTransferable()
what happens while calling RemoveDDELinkFormat in 
SwTransferDdeLink::DataChanged
by keeping reference to it while iterating in 
SvLinkSource::NotifyDataChanged()

Change-Id: Iba53a4c139f9d508d2f64bcc94b479761b84bf2a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159040
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit ef5828fb45e2b46a36b73260232dede3d98e22a4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159239
Reviewed-by: Xisco Fauli 

diff --git a/sfx2/source/appl/linksrc.cxx b/sfx2/source/appl/linksrc.cxx
index 131992c51040..3a1af228f6a4 100644
--- a/sfx2/source/appl/linksrc.cxx
+++ b/sfx2/source/appl/linksrc.cxx
@@ -287,7 +287,8 @@ void SvLinkSource::NotifyDataChanged()
 if( ( p->nAdviseModes & ADVISEMODE_NODATA ) ||
 GetData( aVal, p->aDataMimeType, true ) )
 {
-p->xSink->DataChanged( p->aDataMimeType, aVal );
+tools::SvRef xLink(p->xSink);
+xLink->DataChanged( p->aDataMimeType, aVal );
 
 if ( !aIter.IsValidCurrValue( p ) )
 continue;


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

2023-11-09 Thread Szymon Kłos (via logerrit)
 sfx2/source/appl/linksrc.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit ef5828fb45e2b46a36b73260232dede3d98e22a4
Author: Szymon Kłos 
AuthorDate: Mon Nov 6 18:35:20 2023 +0100
Commit: Caolán McNamara 
CommitDate: Thu Nov 9 09:40:40 2023 +0100

lok: fix crash on DDE Link modify

1. Open document with editable DDE Link section in 2 views
2. View A selects content containing section and copies that
3. View A is closed
4. View B tries to modify section
Result: crash

Avoid destroying SwTransferDdeLink in SwTransferable::~SwTransferable()
what happens while calling RemoveDDELinkFormat in 
SwTransferDdeLink::DataChanged
by keeping reference to it while iterating in 
SvLinkSource::NotifyDataChanged()

Change-Id: Iba53a4c139f9d508d2f64bcc94b479761b84bf2a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159040
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sfx2/source/appl/linksrc.cxx b/sfx2/source/appl/linksrc.cxx
index 131992c51040..3a1af228f6a4 100644
--- a/sfx2/source/appl/linksrc.cxx
+++ b/sfx2/source/appl/linksrc.cxx
@@ -287,7 +287,8 @@ void SvLinkSource::NotifyDataChanged()
 if( ( p->nAdviseModes & ADVISEMODE_NODATA ) ||
 GetData( aVal, p->aDataMimeType, true ) )
 {
-p->xSink->DataChanged( p->aDataMimeType, aVal );
+tools::SvRef xLink(p->xSink);
+xLink->DataChanged( p->aDataMimeType, aVal );
 
 if ( !aIter.IsValidCurrValue( p ) )
 continue;


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

2023-11-08 Thread Szymon Kłos (via logerrit)
 sfx2/source/control/dispatch.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit a6f26b87a0c6b0bb7a92ed0878e7aaa57ec64260
Author: Szymon Kłos 
AuthorDate: Tue Nov 7 11:18:04 2023 +0100
Commit: Miklos Vajna 
CommitDate: Thu Nov 9 08:41:34 2023 +0100

lok: notebookbar: fix unit-copy-paste in online

we can't remove hack in SfxDispatcher::Update_Impl yet
because this made unit-copy-paste test in online broken

reverts part of:
commit 1a6d16cb14342f9a66f99960e96027af6e5369ef
lok: notebookbar: query SID_NOTEBOOKBAR only when requested to switch UI

Signed-off-by: Szymon Kłos 
Change-Id: I8cd801bbc912f2ab3f710f5c7133445f07c4e5de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159039
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index 9134f8da574d..6a492bffda7e 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -1120,8 +1120,7 @@ void SfxDispatcher::Update_Impl( bool bForce )
 if ( xLayoutManager.is() )
 xLayoutManager->unlock();
 
-if ( !comphelper::LibreOfficeKit::isActive() &&
-SfxViewShell::Current() && SfxViewShell::Current()->GetDispatcher() )
+if ( SfxViewShell::Current() && SfxViewShell::Current()->GetDispatcher() )
 {
 const SfxPoolItem *pItem;
 SfxViewShell::Current()->GetDispatcher()->QueryState(SID_NOTEBOOKBAR, 
pItem);


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

2023-11-08 Thread Szymon Kłos (via logerrit)
 sfx2/source/appl/linksrc.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 6dc7efa8067d4bd3a1e75eb85aabaf25485c389c
Author: Szymon Kłos 
AuthorDate: Mon Nov 6 18:35:20 2023 +0100
Commit: Caolán McNamara 
CommitDate: Wed Nov 8 20:00:32 2023 +0100

lok: fix crash on DDE Link modify

1. Open document with editable DDE Link section in 2 views
2. View A selects content containing section and copies that
3. View A is closed
4. View B tries to modify section
Result: crash

Avoid destroying SwTransferDdeLink in SwTransferable::~SwTransferable()
what happens while calling RemoveDDELinkFormat in 
SwTransferDdeLink::DataChanged
by keeping reference to it while iterating in 
SvLinkSource::NotifyDataChanged()

Change-Id: Iba53a4c139f9d508d2f64bcc94b479761b84bf2a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159008
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 

diff --git a/sfx2/source/appl/linksrc.cxx b/sfx2/source/appl/linksrc.cxx
index 131992c51040..3a1af228f6a4 100644
--- a/sfx2/source/appl/linksrc.cxx
+++ b/sfx2/source/appl/linksrc.cxx
@@ -287,7 +287,8 @@ void SvLinkSource::NotifyDataChanged()
 if( ( p->nAdviseModes & ADVISEMODE_NODATA ) ||
 GetData( aVal, p->aDataMimeType, true ) )
 {
-p->xSink->DataChanged( p->aDataMimeType, aVal );
+tools::SvRef xLink(p->xSink);
+xLink->DataChanged( p->aDataMimeType, aVal );
 
 if ( !aIter.IsValidCurrValue( p ) )
 continue;


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

2023-11-07 Thread Szymon Kłos (via logerrit)
 sfx2/source/control/dispatch.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 3af29fec6e9bfa14ee94a7e0b630435da289ca0e
Author: Szymon Kłos 
AuthorDate: Tue Nov 7 11:18:04 2023 +0100
Commit: Szymon Kłos 
CommitDate: Tue Nov 7 14:47:30 2023 +0100

lok: notebookbar: fix unit-copy-paste in online

we can't remove hack in SfxDispatcher::Update_Impl yet
because this made unit-copy-paste test in online broken

reverts part of:
commit 1a6d16cb14342f9a66f99960e96027af6e5369ef
lok: notebookbar: query SID_NOTEBOOKBAR only when requested to switch UI

Signed-off-by: Szymon Kłos 
Change-Id: I8cd801bbc912f2ab3f710f5c7133445f07c4e5de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159062
Tested-by: Jenkins CollaboraOffice 

diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index 3915644e0d2a..9d85075de433 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -1120,8 +1120,7 @@ void SfxDispatcher::Update_Impl( bool bForce )
 if ( xLayoutManager.is() )
 xLayoutManager->unlock();
 
-if ( !comphelper::LibreOfficeKit::isActive() &&
-SfxViewShell::Current() && SfxViewShell::Current()->GetDispatcher() )
+if ( SfxViewShell::Current() && SfxViewShell::Current()->GetDispatcher() )
 {
 const SfxPoolItem *pItem;
 SfxViewShell::Current()->GetDispatcher()->QueryState(SID_NOTEBOOKBAR, 
pItem);


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

2023-11-06 Thread Szymon Kłos (via logerrit)
 sfx2/source/appl/workwin.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 019917b1451bc3f39ea9259df48e68cb098a0402
Author: Szymon Kłos 
AuthorDate: Sat Nov 4 19:20:46 2023 +0100
Commit: Szymon Kłos 
CommitDate: Mon Nov 6 10:05:00 2023 +0100

lok: notebookbar: reduce calls to SfxNotebookBar::IsActive

- in LOK case toolbars in core doesn't make any difference
- SfxNotebookBar::IsActive which reads config
  makes doc_setView slower, avoid it in LOK case then
- it was used for hiding contextual toolbars
- introduced in commit 9bc1ffa2153d2474b023e0860d3c9c68ee18727b
  tdf#125040 Make single mode toolbar context aware

Signed-off-by: Szymon Kłos 
Change-Id: I63de48faf2f7e7f30f8b509455061ac20a788f8a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158939
Tested-by: Jenkins

diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index 6ff260f2f88e..88b7cc016e3e 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -1199,7 +1199,8 @@ void SfxWorkWindow::UpdateObjectBars_Impl2()
 
 // Iterate over all Toolboxes
 xLayoutManager->lock();
-const bool isNotebookBarActive = sfx2::SfxNotebookBar::IsActive(true);
+const bool bForceDestroyToolbars =
+comphelper::LibreOfficeKit::isActive() ? false : 
sfx2::SfxNotebookBar::IsActive(true);
 for ( auto const & n: aObjBarList )
 {
 ToolbarId eId = n.eId;
@@ -1213,7 +1214,7 @@ void SfxWorkWindow::UpdateObjectBars_Impl2()
 
 // Is a ToolBox required in this context ?
 bool bModesMatching = (nUpdateMode != SfxVisibilityFlags::Invisible) 
&& ((nTbxMode & nUpdateMode) == nUpdateMode);
-if ( bDestroy || isNotebookBarActive)
+if ( bDestroy || bForceDestroyToolbars)
 {
 OUString aTbxId = g_aTbxTypeName + 
GetResourceURLFromToolbarId(eId);
 xLayoutManager->destroyElement( aTbxId );


[Libreoffice-commits] core.git: 2 commits - compilerplugins/clang include/sfx2 sfx2/source

2023-11-06 Thread Szymon Kłos (via logerrit)
 compilerplugins/clang/badstatics.cxx|1 
 include/sfx2/notebookbar/SfxNotebookBar.hxx |3 
 sfx2/source/appl/appserv.cxx|4 -
 sfx2/source/control/dispatch.cxx|3 
 sfx2/source/notebookbar/SfxNotebookBar.cxx  |   89 ++--
 5 files changed, 69 insertions(+), 31 deletions(-)

New commits:
commit b9159cf17ba61cb78c45f7223027f3e47126643b
Author: Szymon Kłos 
AuthorDate: Sat Nov 4 15:08:14 2023 +0100
Commit: Szymon Kłos 
CommitDate: Mon Nov 6 10:04:39 2023 +0100

lok: notebookbar: query SID_NOTEBOOKBAR only when requested to switch UI

commit 5bd2931b57a6cb4ac1f39d7ddae874ac693cfab0
tdf#102063 Notebookbar wont appear on launch

introduced some Query hack to SfxDispatcher::Update_Impl what
causes many updates on lots of different actions.
It breaks multi-view state of notebookbar in LOK case,
so don't do that. It should be reviewed for regular case too.

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

diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 5b0ef2ca491f..d58b62a9bf3b 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -805,7 +805,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
 
 aCurrentMode = comphelper::getString( aAppNode.getNodeValue( 
"Active" ) );
 
-if ( aCurrentMode == aNewName )
+if ( !comphelper::LibreOfficeKit::isActive() && aCurrentMode 
== aNewName )
 {
 bDone = true;
 break;
@@ -931,6 +931,8 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
 // Show/Hide the Notebookbar
 const SfxStringItem pItem(SID_NOTEBOOKBAR, aNewName);
 pViewFrame->GetDispatcher()->ExecuteList(SID_NOTEBOOKBAR, 
SfxCallMode::SYNCHRON, {&pItem});
+const SfxPoolItem *pNbItem;
+pViewFrame->GetDispatcher()->QueryState(SID_NOTEBOOKBAR, 
pNbItem);
 
 // Show toolbars
 for ( const OUString& rName : 
std::as_const(aMandatoryToolbars) )
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index 6a492bffda7e..9134f8da574d 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -1120,7 +1120,8 @@ void SfxDispatcher::Update_Impl( bool bForce )
 if ( xLayoutManager.is() )
 xLayoutManager->unlock();
 
-if ( SfxViewShell::Current() && SfxViewShell::Current()->GetDispatcher() )
+if ( !comphelper::LibreOfficeKit::isActive() &&
+SfxViewShell::Current() && SfxViewShell::Current()->GetDispatcher() )
 {
 const SfxPoolItem *pItem;
 SfxViewShell::Current()->GetDispatcher()->QueryState(SID_NOTEBOOKBAR, 
pItem);
commit 6bf428d354349995f7a20e6ce38a47c238911abe
Author: Szymon Kłos 
AuthorDate: Sat Nov 4 12:05:16 2023 +0100
Commit: Szymon Kłos 
CommitDate: Mon Nov 6 10:04:31 2023 +0100

lok: notebookbar: handle multiple sessions

This fixes regression from commit db5a78c8ab1eae30e442151f07b0dc4dcd017550
lok: notebookbar: don't recreate toolbars too often

When we had 2 sessions with notebookbar and one of them switched
to compact mode - other session's notebookbar didn't work.

Before previous change we recreated notebookbar and its welded wrapper
on every StateMethod call for LOK case. So when it become destroyed
we made it working again. But now we need to introduce better management
and not rely on single instence we get from SystemWindow.

Also it's bad idea to rely 100% on SfxNotebookBar::IsActive in LOK
case as when other view will turn notebookbar off, but QueryState
will be trigerred in our session - we will think that it should be
destroyed (it reads config state which is shared between views).
So trust only "true" value (it happens after calling SID_TOOLBAR_MODE),
but destroy notebookbar only after explicit call of
SfxNotebookBar::CloseMethod. It seems to have good result when tested
with multiple views in Online. Maybe we can track Notebookbar state
per view later to make things simpler in LOK case.

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

diff --git a/compilerplugins/clang/badstatics.cxx 
b/compilerplugins/clang/badstatics.cxx
index f22dabac9b48..328218086453 100644
--- a/compilerplugins/clang/badstatics.cxx
+++ b/compilerplugins/clang/badstatics.cxx
@@ -211,6 +211,7 @@ public:
 || name == "s_aLOKWe

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

2023-11-06 Thread Szymon Kłos (via logerrit)
 sfx2/source/appl/workwin.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 1a7064571f68a38ae02fb1fb85447d41c47db997
Author: Szymon Kłos 
AuthorDate: Sat Nov 4 19:20:46 2023 +0100
Commit: Caolán McNamara 
CommitDate: Mon Nov 6 09:58:31 2023 +0100

lok: notebookbar: reduce calls to SfxNotebookBar::IsActive

- in LOK case toolbars in core doesn't make any difference
- SfxNotebookBar::IsActive which reads config
  makes doc_setView slower, avoid it in LOK case then
- it was used for hiding contextual toolbars
- introduced in commit 9bc1ffa2153d2474b023e0860d3c9c68ee18727b
  tdf#125040 Make single mode toolbar context aware

Signed-off-by: Szymon Kłos 
Change-Id: I63de48faf2f7e7f30f8b509455061ac20a788f8a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158898
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 

diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index fb3955ee2c5c..793adcd8df77 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -1195,7 +1195,8 @@ void SfxWorkWindow::UpdateObjectBars_Impl2()
 
 // Iterate over all Toolboxes
 xLayoutManager->lock();
-const bool isNotebookBarActive = sfx2::SfxNotebookBar::IsActive(true);
+const bool bForceDestroyToolbars =
+comphelper::LibreOfficeKit::isActive() ? false : 
sfx2::SfxNotebookBar::IsActive(true);
 for ( auto const & n: aObjBarList )
 {
 ToolbarId eId = n.eId;
@@ -1209,7 +1210,7 @@ void SfxWorkWindow::UpdateObjectBars_Impl2()
 
 // Is a ToolBox required in this context ?
 bool bModesMatching = (nUpdateMode != SfxVisibilityFlags::Invisible) 
&& ((nTbxMode & nUpdateMode) == nUpdateMode);
-if ( bDestroy || isNotebookBarActive)
+if ( bDestroy || bForceDestroyToolbars)
 {
 OUString aTbxId = g_aTbxTypeName + 
GetResourceURLFromToolbarId(eId);
 xLayoutManager->destroyElement( aTbxId );


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

2023-11-06 Thread Szymon Kłos (via logerrit)
 sfx2/source/appl/appserv.cxx |4 +++-
 sfx2/source/control/dispatch.cxx |3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 1a6d16cb14342f9a66f99960e96027af6e5369ef
Author: Szymon Kłos 
AuthorDate: Sat Nov 4 15:08:14 2023 +0100
Commit: Caolán McNamara 
CommitDate: Mon Nov 6 09:58:00 2023 +0100

lok: notebookbar: query SID_NOTEBOOKBAR only when requested to switch UI

commit 5bd2931b57a6cb4ac1f39d7ddae874ac693cfab0
tdf#102063 Notebookbar wont appear on launch

introduced some Query hack to SfxDispatcher::Update_Impl what
causes many updates on lots of different actions.
It breaks multi-view state of notebookbar in LOK case,
so don't do that. It should be reviewed for regular case too.

Change-Id: I8f26bddc6cff991c56a1172893d83b90fb225acd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158897
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 

diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 418bcb88430b..297f6f8f9e14 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -824,7 +824,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
 
 aCurrentMode = comphelper::getString( aAppNode.getNodeValue( 
"Active" ) );
 
-if ( aCurrentMode == aNewName )
+if ( !comphelper::LibreOfficeKit::isActive() && aCurrentMode 
== aNewName )
 {
 bDone = true;
 break;
@@ -950,6 +950,8 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
 // Show/Hide the Notebookbar
 const SfxStringItem pItem(SID_NOTEBOOKBAR, aNewName);
 pViewFrame->GetDispatcher()->ExecuteList(SID_NOTEBOOKBAR, 
SfxCallMode::SYNCHRON, {&pItem});
+const SfxPoolItem *pNbItem;
+pViewFrame->GetDispatcher()->QueryState(SID_NOTEBOOKBAR, 
pNbItem);
 
 // Show toolbars
 for ( const OUString& rName : 
std::as_const(aMandatoryToolbars) )
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index 9d85075de433..3915644e0d2a 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -1120,7 +1120,8 @@ void SfxDispatcher::Update_Impl( bool bForce )
 if ( xLayoutManager.is() )
 xLayoutManager->unlock();
 
-if ( SfxViewShell::Current() && SfxViewShell::Current()->GetDispatcher() )
+if ( !comphelper::LibreOfficeKit::isActive() &&
+SfxViewShell::Current() && SfxViewShell::Current()->GetDispatcher() )
 {
 const SfxPoolItem *pItem;
 SfxViewShell::Current()->GetDispatcher()->QueryState(SID_NOTEBOOKBAR, 
pItem);


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

2023-11-06 Thread Szymon Kłos (via logerrit)
 compilerplugins/clang/badstatics.cxx|1 
 include/sfx2/notebookbar/SfxNotebookBar.hxx |3 
 sfx2/source/notebookbar/SfxNotebookBar.cxx  |   89 ++--
 3 files changed, 64 insertions(+), 29 deletions(-)

New commits:
commit b9e5543be78b0b124bc087840f13ae1bfd2b155b
Author: Szymon Kłos 
AuthorDate: Sat Nov 4 12:05:16 2023 +0100
Commit: Caolán McNamara 
CommitDate: Mon Nov 6 09:56:27 2023 +0100

lok: notebookbar: handle multiple sessions

This fixes regression from commit db5a78c8ab1eae30e442151f07b0dc4dcd017550
lok: notebookbar: don't recreate toolbars too often

When we had 2 sessions with notebookbar and one of them switched
to compact mode - other session's notebookbar didn't work.

Before previous change we recreated notebookbar and its welded wrapper
on every StateMethod call for LOK case. So when it become destroyed
we made it working again. But now we need to introduce better management
and not rely on single instence we get from SystemWindow.

Also it's bad idea to rely 100% on SfxNotebookBar::IsActive in LOK
case as when other view will turn notebookbar off, but QueryState
will be trigerred in our session - we will think that it should be
destroyed (it reads config state which is shared between views).
So trust only "true" value (it happens after calling SID_TOOLBAR_MODE),
but destroy notebookbar only after explicit call of
SfxNotebookBar::CloseMethod. It seems to have good result when tested
with multiple views in Online. Maybe we can track Notebookbar state
per view later to make things simpler in LOK case.

Change-Id: Ie739c6441ca05884b0ef20bff23751467706b562
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158896
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 

diff --git a/compilerplugins/clang/badstatics.cxx 
b/compilerplugins/clang/badstatics.cxx
index 98375f212dd2..47670d10282b 100644
--- a/compilerplugins/clang/badstatics.cxx
+++ b/compilerplugins/clang/badstatics.cxx
@@ -213,6 +213,7 @@ public:
 || name == "s_aLOKWeldBuildersMap" // LOK only, similar case 
as above
 || name == "s_aLOKPopupsMap" // LOK only, similar case as above
 || name == "m_pNotebookBarWeldedWrapper" // LOK only, warning 
about map's key, no VCL cleanup performed
+|| name == "m_pNotebookBarInstance" // LOK only case, when 
notebookbar is closed - VclPtr instance is removed
 || name == "gStaticManager" // vcl/source/graphic/Manager.cxx 
- stores non-owning pointers
 || name == "aThreadedInterpreterPool"// 
ScInterpreterContext(Pool), not owning
 || name == "aNonThreadedInterpreterPool" // 
ScInterpreterContext(Pool), not owning
diff --git a/include/sfx2/notebookbar/SfxNotebookBar.hxx 
b/include/sfx2/notebookbar/SfxNotebookBar.hxx
index 96f5805f50e0..7bf34d1cbf7e 100644
--- a/include/sfx2/notebookbar/SfxNotebookBar.hxx
+++ b/include/sfx2/notebookbar/SfxNotebookBar.hxx
@@ -12,6 +12,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -76,8 +77,10 @@ private:
 
 static std::map>
 m_pNotebookBarWeldedWrapper;
+static std::map> 
m_pNotebookBarInstance;
 
 static void ResetActiveToolbarModeToDefault(vcl::EnumContext::Application 
eApp);
+static void RemoveCurrentLOKWrapper();
 
 DECL_DLLPRIVATE_STATIC_LINK(SfxNotebookBar, VclDisposeHdl, const 
SfxViewShell*, void);
 };
diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx 
b/sfx2/source/notebookbar/SfxNotebookBar.cxx
index ac27619832b9..5acd8d39a99a 100644
--- a/sfx2/source/notebookbar/SfxNotebookBar.cxx
+++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx
@@ -11,7 +11,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -43,6 +42,7 @@ const char MERGE_NOTEBOOKBAR_URL[] = "URL";
 bool SfxNotebookBar::m_bLock = false;
 bool SfxNotebookBar::m_bHide = false;
 std::map> 
SfxNotebookBar::m_pNotebookBarWeldedWrapper;
+std::map> 
SfxNotebookBar::m_pNotebookBarInstance;
 
 static void NotebookbarAddonValues(
 std::vector& aImageValues,
@@ -195,6 +195,19 @@ static utl::OConfigurationNode 
lcl_getCurrentImplConfigNode(const Reference VclDisposeHdl
+// which clears also m_pNotebookBarWeldedWrapper
+aFound->second.disposeAndClear();
+m_pNotebookBarInstance.erase(aFound);
+}
+}
+
 void SfxNotebookBar::CloseMethod(SfxBindings& rBindings)
 {
 SfxFrame& rFrame = rBindings.GetDispatcher_Impl()->GetFrame()->GetFrame();
@@ -203,6 +216,12 @@ void SfxNotebookBar::CloseMethod(SfxBindings& rBindings)
 
 void SfxNotebookBar::CloseMethod(SystemWindow* pSysWindow)
 {
+if (comphelper::LibreOfficeKit::isActive())
+{
+RemoveCurrentLOKWrapper()

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

2023-11-03 Thread Szymon Kłos (via logerrit)
 sfx2/source/notebookbar/SfxNotebookBar.cxx |9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

New commits:
commit db5a78c8ab1eae30e442151f07b0dc4dcd017550
Author: Szymon Kłos 
AuthorDate: Fri Nov 3 08:52:32 2023 +0100
Commit: Noel Grandin 
CommitDate: Fri Nov 3 17:00:42 2023 +0100

lok: notebookbar: don't recreate toolbars too often

commit  004512d87ab70587d95a708116a5c2f4b870565c
notebookbar: allow to create multiple instances for online

Changed SfxNotebookBar::StateMethod so in LOK case it always
enter to the code block which is meant to be used for
creating or reloading notebookbar. Change that so we check
if notebookbar was initialized for given view already.

Change-Id: Icfa1e572769043509479b7b98d055120ac3d1f74
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158872
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
Reviewed-by: Szymon Kłos 
(cherry picked from commit b3d70fe909ff750002dd01f37832487e92bc4d62)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158893
Tested-by: Jenkins CollaboraOffice 

diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx 
b/sfx2/source/notebookbar/SfxNotebookBar.cxx
index ccaf3e5447ac..ac27619832b9 100644
--- a/sfx2/source/notebookbar/SfxNotebookBar.cxx
+++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx
@@ -373,11 +373,12 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
 
 bool bChangedFile = sNewFile != sCurrentFile;
 
+const SfxViewShell* pViewShell = SfxViewShell::Current();
+bool hasWeldedWrapper = m_pNotebookBarWeldedWrapper.find(pViewShell) 
!= m_pNotebookBarWeldedWrapper.end();
+
 if ((!sFile.isEmpty() && bChangedFile) || !pNotebookBar || 
!pNotebookBar->IsVisible()
-|| bReloadNotebookbar || comphelper::LibreOfficeKit::isActive())
+|| bReloadNotebookbar || (comphelper::LibreOfficeKit::isActive() 
&& !hasWeldedWrapper))
 {
-const SfxViewShell* pViewShell = SfxViewShell::Current();
-
 // Notebookbar was loaded too early what caused:
 //   * in LOK: Paste Special feature was incorrectly initialized
 // Skip first request so Notebookbar will be initialized after 
document was loaded
@@ -414,8 +415,6 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
 pNotebookBar = pSysWindow->GetNotebookBar();
 pNotebookBar->Show();
 
-
-bool hasWeldedWrapper = 
m_pNotebookBarWeldedWrapper.find(pViewShell) != 
m_pNotebookBarWeldedWrapper.end();
 if ((!hasWeldedWrapper || bReloadNotebookbar) && 
pNotebookBar->IsWelded())
 {
 sal_uInt64 nWindowId = 
reinterpret_cast(pViewShell);


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

2023-11-03 Thread Szymon Kłos (via logerrit)
 sfx2/source/notebookbar/SfxNotebookBar.cxx |9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

New commits:
commit 3d15de525534197960e9a9c64eba3ad2153aa113
Author: Szymon Kłos 
AuthorDate: Fri Nov 3 08:52:32 2023 +0100
Commit: Szymon Kłos 
CommitDate: Fri Nov 3 12:54:48 2023 +0100

lok: notebookbar: don't recreate toolbars too often

commit  004512d87ab70587d95a708116a5c2f4b870565c
notebookbar: allow to create multiple instances for online

Changed SfxNotebookBar::StateMethod so in LOK case it always
enter to the code block which is meant to be used for
creating or reloading notebookbar. Change that so we check
if notebookbar was initialized for given view already.

Change-Id: Icfa1e572769043509479b7b98d055120ac3d1f74
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158872
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
Reviewed-by: Szymon Kłos 

diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx 
b/sfx2/source/notebookbar/SfxNotebookBar.cxx
index 0a21ffa98c8a..e9e85de271bd 100644
--- a/sfx2/source/notebookbar/SfxNotebookBar.cxx
+++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx
@@ -377,11 +377,12 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
 
 bool bChangedFile = sNewFile != sCurrentFile;
 
+const SfxViewShell* pViewShell = SfxViewShell::Current();
+bool hasWeldedWrapper = m_pNotebookBarWeldedWrapper.find(pViewShell) 
!= m_pNotebookBarWeldedWrapper.end();
+
 if ((!sFile.isEmpty() && bChangedFile) || !pNotebookBar || 
!pNotebookBar->IsVisible()
-|| bReloadNotebookbar || comphelper::LibreOfficeKit::isActive())
+|| bReloadNotebookbar || (comphelper::LibreOfficeKit::isActive() 
&& !hasWeldedWrapper))
 {
-const SfxViewShell* pViewShell = SfxViewShell::Current();
-
 // Notebookbar was loaded too early what caused:
 //   * in LOK: Paste Special feature was incorrectly initialized
 // Skip first request so Notebookbar will be initialized after 
document was loaded
@@ -418,8 +419,6 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
 pNotebookBar = pSysWindow->GetNotebookBar();
 pNotebookBar->Show();
 
-
-bool hasWeldedWrapper = 
m_pNotebookBarWeldedWrapper.find(pViewShell) != 
m_pNotebookBarWeldedWrapper.end();
 if ((!hasWeldedWrapper || bReloadNotebookbar) && 
pNotebookBar->IsWelded())
 {
 sal_uInt64 nWindowId = 
reinterpret_cast(pViewShell);


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

2023-10-31 Thread Szymon Kłos (via logerrit)
 sc/source/ui/condformat/condformateasydlg.cxx |8 ++--
 sc/source/ui/inc/condformateasydlg.hxx|4 ++--
 sc/uiconfig/scalc/ui/conditionaleasydialog.ui |4 ++--
 3 files changed, 6 insertions(+), 10 deletions(-)

New commits:
commit 2b8df39aea832d0521bf0d3c6b543a81709c382f
Author: Szymon Kłos 
AuthorDate: Fri Oct 27 13:02:29 2023 +0200
Commit: Szymon Kłos 
CommitDate: Tue Oct 31 08:34:53 2023 +0100

Allow to enter text in simple conditional formatting dialog

We have rules for test values like: "contains text".
Better to use formatter which will be used only when needed.
But it is possible to use Less or Greater even for text
using the lexicographic order.

Strings in quotes are interpreted as text.
Strings without quotes are interpreted as refs to columns/rows/ranges.

Change-Id: I1f63b3f4b2a878e55d405a030dd3ddf47305e220
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158559
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Gülşah Köse 

diff --git a/sc/source/ui/condformat/condformateasydlg.cxx 
b/sc/source/ui/condformat/condformateasydlg.cxx
index 7e07b1a1dc19..d707b7c9f88d 100644
--- a/sc/source/ui/condformat/condformateasydlg.cxx
+++ b/sc/source/ui/condformat/condformateasydlg.cxx
@@ -64,8 +64,8 @@ 
ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings,
 "modules/scalc/ui/conditionaleasydialog.ui", 
"CondFormatEasyDlg")
 , mpViewData(pViewData)
 , mpDocument(&mpViewData->GetDocument())
-, mxNumberEntry(m_xBuilder->weld_spin_button("entryNumber"))
-, mxNumberEntry2(m_xBuilder->weld_spin_button("entryNumber2"))
+, mxNumberEntry(m_xBuilder->weld_entry("entryNumber"))
+, mxNumberEntry2(m_xBuilder->weld_entry("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"))
@@ -92,10 +92,6 @@ 
ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings,
 meMode = *pCurrentMode;
 }
 mxNumberEntry2->hide();
-mxNumberEntry->set_range(SAL_MIN_INT64, SAL_MAX_INT64);
-mxNumberEntry2->set_range(SAL_MIN_INT64, SAL_MAX_INT64);
-mxNumberEntry->set_increments(1, 0);
-mxNumberEntry2->set_increments(1, 0);
 switch (meMode)
 {
 case ScConditionMode::Equal:
diff --git a/sc/source/ui/inc/condformateasydlg.hxx 
b/sc/source/ui/inc/condformateasydlg.hxx
index 9ca15a11bda9..6d6af1041b49 100644
--- a/sc/source/ui/inc/condformateasydlg.hxx
+++ b/sc/source/ui/inc/condformateasydlg.hxx
@@ -42,8 +42,8 @@ private:
 ScAddress maPosition;
 ScTabViewShell* mpTabViewShell;
 
-std::unique_ptr mxNumberEntry;
-std::unique_ptr mxNumberEntry2;
+std::unique_ptr mxNumberEntry;
+std::unique_ptr mxNumberEntry2;
 std::unique_ptr mxRangeEntry;
 std::unique_ptr mxButtonRangeEdit;
 std::unique_ptr mxStyles;
diff --git a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui 
b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
index 2bee383956a9..077610196356 100644
--- a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
+++ b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
@@ -90,7 +90,7 @@
 False
 12
 
-  
+  
 True
 True
 
@@ -104,7 +104,7 @@
   
 
 
-  
+  
 True
 True
 


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

2023-10-29 Thread Szymon Kłos (via logerrit)
 sc/source/ui/condformat/condformateasydlg.cxx |2 +-
 sc/uiconfig/scalc/ui/conditionaleasydialog.ui |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit ecdb3d6e8dd24d2e75a16f181c0ba565a101408f
Author: Szymon Kłos 
AuthorDate: Sun Oct 29 09:47:09 2023 +0100
Commit: Szymon Kłos 
CommitDate: Sun Oct 29 11:14:59 2023 +0100

Use better approach to translate simple conditional formatting dialog

it will allow to reorder words in case of languages with
different order

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

diff --git a/sc/source/ui/condformat/condformateasydlg.cxx 
b/sc/source/ui/condformat/condformateasydlg.cxx
index d707b7c9f88d..0fee5ea15b36 100644
--- a/sc/source/ui/condformat/condformateasydlg.cxx
+++ b/sc/source/ui/condformat/condformateasydlg.cxx
@@ -53,7 +53,7 @@ namespace sc
 {
 void ConditionalFormatEasyDialog::SetDescription(std::u16string_view 
rCondition)
 {
-mxDescription->set_label(mxDescription->get_label() + ": " + rCondition);
+mxDescription->set_label(mxDescription->get_label().replaceAll("%1", 
rCondition));
 }
 
 ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* 
pBindings,
diff --git a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui 
b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
index 077610196356..c7a43c4cb256 100644
--- a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
+++ b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
@@ -171,7 +171,7 @@
   
 True
 False
-Apply conditional formatting to cells
+Apply conditional formatting to cells: %1
 
   
   


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

2023-10-29 Thread Szymon Kłos (via logerrit)
 sc/inc/strings.hrc|   15 +++
 sc/source/ui/condformat/condformateasydlg.cxx |   54 +++---
 sc/source/ui/inc/condformateasydlg.hxx|2 
 3 files changed, 65 insertions(+), 6 deletions(-)

New commits:
commit 7128dbd1c564bd44868b0d0b7c92d384a9c665cf
Author: Szymon Kłos 
AuthorDate: Fri Oct 27 11:53:57 2023 +0200
Commit: Szymon Kłos 
CommitDate: Sun Oct 29 09:24:43 2023 +0100

Make simple conditional formatting dialog translated

Followup for commit a9f6f63d21e368fe6bcc9080fd1ba23b0e52
sc: Add easy to use conditional formatting menu

- make strings translated
- add more conditions
- TODO: add other missing conditions

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

diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc
index 24a40a41ef57..2c8bacfb4bea 100644
--- a/sc/inc/strings.hrc
+++ b/sc/inc/strings.hrc
@@ -390,4 +390,19 @@
 #define STR_A11Y_DESC_USERDEF   
NC_("subtotaloptionspage|extended_tip|lbuserdef", "Uses a custom sorting order 
that you defined in the Options dialog box at %PRODUCTNAME Calc - Sort Lists.")
 #define STR_A11Y_DESC_ANNOT NC_("extended_tip|annot", 
"Specifies that a small rectangle in the top right corner of the cell indicates 
that a comment exists. The comment will be shown only when you enable tips 
under %PRODUCTNAME - General in the Options dialog box.")
 
+// Simple conditional formatting dialog
+#define STR_CONDITION_EQUAL NC_("STR_CONDITION_EQUAL", 
"equal to")
+#define STR_CONDITION_LESS  NC_("STR_CONDITION_LESS", 
"less than")
+#define STR_CONDITION_GREATER   
NC_("STR_CONDITION_GREATER", "greater than")
+#define STR_CONDITION_EQLESS
NC_("STR_CONDITION_EQLESS", "equal or less than")
+#define STR_CONDITION_EQGREATER 
NC_("STR_CONDITION_EQGREATER", "equal or greater than")
+#define STR_CONDITION_NOT_EQUAL 
NC_("STR_CONDITION_NOT_EQUAL", "not equal to")
+
+#define STR_CONDITION_BETWEEN   
NC_("STR_CONDITION_BETWEEN", "between")
+
+#define STR_CONDITION_ERROR NC_("STR_CONDITION_ERROR", 
"with error ")
+#define STR_CONDITION_NOERROR   
NC_("STR_CONDITION_NOERROR", "without error ")
+#define STR_CONDITION_CONTAINS_TEXT 
NC_("STR_CONDITION_CONTAINS_TEXT", "containing text")
+#define STR_CONDITION_NOT_CONTAINS_TEXT 
NC_("STR_CONDITION_NOT_CONTAINS_TEXT", "not containing text")
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/condformat/condformateasydlg.cxx 
b/sc/source/ui/condformat/condformateasydlg.cxx
index 41b8a31eafd3..7e07b1a1dc19 100644
--- a/sc/source/ui/condformat/condformateasydlg.cxx
+++ b/sc/source/ui/condformat/condformateasydlg.cxx
@@ -3,7 +3,9 @@
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 
 namespace
 {
@@ -49,6 +51,11 @@ ScTabViewShell* GetTabViewShell(const SfxBindings* pBindings)
 
 namespace sc
 {
+void ConditionalFormatEasyDialog::SetDescription(std::u16string_view 
rCondition)
+{
+mxDescription->set_label(mxDescription->get_label() + ": " + rCondition);
+}
+
 ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* 
pBindings,
  SfxChildWindow* 
pChildWindow,
  weld::Window* pParent,
@@ -91,19 +98,54 @@ 
ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings,
 mxNumberEntry2->set_increments(1, 0);
 switch (meMode)
 {
-case ScConditionMode::Greater:
-mxDescription->set_label(mxDescription->get_label() + " greater 
than ");
+case ScConditionMode::Equal:
+SetDescription(ScResId(STR_CONDITION_EQUAL));
 break;
 case ScConditionMode::Less:
-mxDescription->set_label(mxDescription->get_label() + " less than 
");
+SetDescription(ScResId(STR_CONDITION_LESS));
 break;
-case ScConditionMode::Equal:
-mxDescription->set_label(mxDescription->get_label() + " equal to 
");
+case ScConditionMode::Greater:
+SetDescription(ScResId(STR_CONDITION_GREATER));
+break;
+case ScConditionMode::EqLess:
+SetDescription(ScResId(STR_CONDITION_EQLESS));
+break;

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

2023-10-29 Thread Szymon Kłos (via logerrit)
 sc/source/ui/condformat/condformateasydlg.cxx |8 ++--
 sc/source/ui/inc/condformateasydlg.hxx|4 ++--
 sc/uiconfig/scalc/ui/conditionaleasydialog.ui |4 ++--
 3 files changed, 6 insertions(+), 10 deletions(-)

New commits:
commit 42811537c8536330e21fd6cee7561294a177836a
Author: Szymon Kłos 
AuthorDate: Fri Oct 27 13:02:29 2023 +0200
Commit: Szymon Kłos 
CommitDate: Sun Oct 29 09:14:50 2023 +0100

Allow to enter text in simple conditional formatting dialog

We have rules for test values like: "contains text".
Better to use formatter which will be used only when needed.
But it is possible to use Less or Greater even for text
using the lexicographic order.

Strings in quotes are interpreted as text.
Strings without quotes are interpreted as refs to columns/rows/ranges.

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

diff --git a/sc/source/ui/condformat/condformateasydlg.cxx 
b/sc/source/ui/condformat/condformateasydlg.cxx
index 7e07b1a1dc19..d707b7c9f88d 100644
--- a/sc/source/ui/condformat/condformateasydlg.cxx
+++ b/sc/source/ui/condformat/condformateasydlg.cxx
@@ -64,8 +64,8 @@ 
ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings,
 "modules/scalc/ui/conditionaleasydialog.ui", 
"CondFormatEasyDlg")
 , mpViewData(pViewData)
 , mpDocument(&mpViewData->GetDocument())
-, mxNumberEntry(m_xBuilder->weld_spin_button("entryNumber"))
-, mxNumberEntry2(m_xBuilder->weld_spin_button("entryNumber2"))
+, mxNumberEntry(m_xBuilder->weld_entry("entryNumber"))
+, mxNumberEntry2(m_xBuilder->weld_entry("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"))
@@ -92,10 +92,6 @@ 
ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings,
 meMode = *pCurrentMode;
 }
 mxNumberEntry2->hide();
-mxNumberEntry->set_range(SAL_MIN_INT64, SAL_MAX_INT64);
-mxNumberEntry2->set_range(SAL_MIN_INT64, SAL_MAX_INT64);
-mxNumberEntry->set_increments(1, 0);
-mxNumberEntry2->set_increments(1, 0);
 switch (meMode)
 {
 case ScConditionMode::Equal:
diff --git a/sc/source/ui/inc/condformateasydlg.hxx 
b/sc/source/ui/inc/condformateasydlg.hxx
index 9ca15a11bda9..6d6af1041b49 100644
--- a/sc/source/ui/inc/condformateasydlg.hxx
+++ b/sc/source/ui/inc/condformateasydlg.hxx
@@ -42,8 +42,8 @@ private:
 ScAddress maPosition;
 ScTabViewShell* mpTabViewShell;
 
-std::unique_ptr mxNumberEntry;
-std::unique_ptr mxNumberEntry2;
+std::unique_ptr mxNumberEntry;
+std::unique_ptr mxNumberEntry2;
 std::unique_ptr mxRangeEntry;
 std::unique_ptr mxButtonRangeEdit;
 std::unique_ptr mxStyles;
diff --git a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui 
b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
index 2bee383956a9..077610196356 100644
--- a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
+++ b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
@@ -90,7 +90,7 @@
 False
 12
 
-  
+  
 True
 True
 
@@ -104,7 +104,7 @@
   
 
 
-  
+  
 True
 True
 


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

2023-10-28 Thread Szymon Kłos (via logerrit)
 sc/sdi/scalc.sdi  |4 -
 sc/source/ui/view/cellsh1.cxx |  155 ++
 2 files changed, 143 insertions(+), 16 deletions(-)

New commits:
commit 50abd90d739410ed34de5e7cd9c4308dc75f9ab6
Author: Szymon Kłos 
AuthorDate: Wed Oct 25 18:23:06 2023 +0200
Commit: Szymon Kłos 
CommitDate: Sat Oct 28 21:31:16 2023 +0200

Introduce easy to apply cond format styles

UNO commands for Data bars and Color scale conditional
formatting now can be called with parameter to apply
few predefined themes.

In the future it could be moved somewhere so it could
be configured from the UI maybe...

Change-Id: I080709709fcc0886dcaf6050a6c1ae621b6728c9
(cherry picked from commit c8d4a99082269c7008df5765232a93d19e7a3d84)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158539
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index 4da6e21b162e..614293cc90bb 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -787,7 +787,7 @@ SfxVoidItem CurrentConditionalFormatDialog 
SID_OPENDLG_CURRENTCONDFRMT
 
 
 SfxVoidItem ColorScaleFormatDialog SID_OPENDLG_COLORSCALE
-()
+(SfxInt16Item IconSet FN_PARAM_1)
 [
 AutoUpdate = FALSE,
 FastCall = FALSE,
@@ -805,7 +805,7 @@ SfxVoidItem ColorScaleFormatDialog SID_OPENDLG_COLORSCALE
 
 
 SfxVoidItem DataBarFormatDialog SID_OPENDLG_DATABAR
-()
+(SfxInt16Item IconSet FN_PARAM_1)
 [
 AutoUpdate = FALSE,
 FastCall = FALSE,
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index b35796ff0c2e..1b307963dc01 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2186,27 +2186,154 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
 
 // do we have a parameter with the conditional formatting type?
 const SfxInt16Item* pParam = 
rReq.GetArg(FN_PARAM_1);
-if (pParam && nSlot == SID_OPENDLG_ICONSET)
+if (pParam)
 {
 auto pFormat = std::make_unique(0, 
&rDoc);
 pFormat->SetRange(aRangeList);
 
-ScIconSetType eIconSetType = 
limit_cast(pParam->GetValue(), IconSet_3Arrows, IconSet_5Boxes);
-const int nSteps = 
ScIconSetFormat::getIconSetElements(eIconSetType);
+if (nSlot == SID_OPENDLG_ICONSET)
+{
+ScIconSetType eIconSetType = 
limit_cast(pParam->GetValue(), IconSet_3Arrows, IconSet_5Boxes);
+const int nSteps = 
ScIconSetFormat::getIconSetElements(eIconSetType);
+
+ScIconSetFormat* pEntry = new ScIconSetFormat(&rDoc);
+ScIconSetFormatData* pIconSetFormatData = new 
ScIconSetFormatData(eIconSetType);
+
+pIconSetFormatData->m_Entries.emplace_back(new 
ScColorScaleEntry(0, COL_RED, COLORSCALE_PERCENT));
+pIconSetFormatData->m_Entries.emplace_back(new 
ScColorScaleEntry(round(100. / nSteps), COL_BROWN, COLORSCALE_PERCENT));
+pIconSetFormatData->m_Entries.emplace_back(new 
ScColorScaleEntry(round(200. / nSteps), COL_YELLOW, COLORSCALE_PERCENT));
+if (nSteps > 3)
+pIconSetFormatData->m_Entries.emplace_back(new 
ScColorScaleEntry(round(300. / nSteps), COL_WHITE, COLORSCALE_PERCENT));
+if (nSteps > 4)
+pIconSetFormatData->m_Entries.emplace_back(new 
ScColorScaleEntry(round(400. / nSteps), COL_GREEN, COLORSCALE_PERCENT));
+
+pEntry->SetIconSetData(pIconSetFormatData);
+pFormat->AddEntry(pEntry);
+}
+else if (nSlot == SID_OPENDLG_COLORSCALE)
+{
+typedef std::tuple ScaleEntry;
+static std::vector> 
aScaleThemes =
+{
+{
+{ 0, Color(0xF8696B), COLORSCALE_MIN },
+{ 0, Color(0x63BE7B), COLORSCALE_MAX },
+{ 50, Color(0xFFEB84), 
COLORSCALE_PERCENTILE }
+},
+{
+{ 0, Color(0x63BE7B), COLORSCALE_MIN },
+{ 0, Color(0xF8696B), COLORSCALE_MAX },
+{ 50, Color(0xFFEB84), 
COLORSCALE_PERCENTILE }
+},
+{
+{ 0, Color(0xF8696B), COLORSCALE_MIN },
+{ 0, Color(0x63BE7B), COLORSCALE_MAX },
+  

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

2023-10-27 Thread Szymon Kłos (via logerrit)
 sc/inc/strings.hrc|   15 +++
 sc/source/ui/condformat/condformateasydlg.cxx |   54 +++---
 sc/source/ui/inc/condformateasydlg.hxx|2 
 3 files changed, 65 insertions(+), 6 deletions(-)

New commits:
commit 47ee01c28701e22e55a9ef7d66e0836c5a0a5899
Author: Szymon Kłos 
AuthorDate: Fri Oct 27 11:53:57 2023 +0200
Commit: Szymon Kłos 
CommitDate: Fri Oct 27 22:21:03 2023 +0200

Make simple conditional formatting dialog translated

Followup for commit a9f6f63d21e368fe6bcc9080fd1ba23b0e52
sc: Add easy to use conditional formatting menu

- make strings translated
- add more conditions
- TODO: add other missing conditions

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

diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc
index 74c15b5b698b..d58777176e52 100644
--- a/sc/inc/strings.hrc
+++ b/sc/inc/strings.hrc
@@ -396,4 +396,19 @@
 #define STR_A11Y_DESC_USERDEF   
NC_("subtotaloptionspage|extended_tip|lbuserdef", "Uses a custom sorting order 
that you defined in the Options dialog box at %PRODUCTNAME Calc - Sort Lists.")
 #define STR_A11Y_DESC_ANNOT NC_("extended_tip|annot", 
"Specifies that a small rectangle in the top right corner of the cell indicates 
that a comment exists. The comment will be shown only when you enable tips 
under %PRODUCTNAME - General in the Options dialog box.")
 
+// Simple conditional formatting dialog
+#define STR_CONDITION_EQUAL NC_("STR_CONDITION_EQUAL", 
"equal to")
+#define STR_CONDITION_LESS  NC_("STR_CONDITION_LESS", 
"less than")
+#define STR_CONDITION_GREATER   
NC_("STR_CONDITION_GREATER", "greater than")
+#define STR_CONDITION_EQLESS
NC_("STR_CONDITION_EQLESS", "equal or less than")
+#define STR_CONDITION_EQGREATER 
NC_("STR_CONDITION_EQGREATER", "equal or greater than")
+#define STR_CONDITION_NOT_EQUAL 
NC_("STR_CONDITION_NOT_EQUAL", "not equal to")
+
+#define STR_CONDITION_BETWEEN   
NC_("STR_CONDITION_BETWEEN", "between")
+
+#define STR_CONDITION_ERROR NC_("STR_CONDITION_ERROR", 
"with error ")
+#define STR_CONDITION_NOERROR   
NC_("STR_CONDITION_NOERROR", "without error ")
+#define STR_CONDITION_CONTAINS_TEXT 
NC_("STR_CONDITION_CONTAINS_TEXT", "containing text")
+#define STR_CONDITION_NOT_CONTAINS_TEXT 
NC_("STR_CONDITION_NOT_CONTAINS_TEXT", "not containing text")
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/condformat/condformateasydlg.cxx 
b/sc/source/ui/condformat/condformateasydlg.cxx
index 8ddb297269dc..c371861ac355 100644
--- a/sc/source/ui/condformat/condformateasydlg.cxx
+++ b/sc/source/ui/condformat/condformateasydlg.cxx
@@ -3,7 +3,9 @@
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 
 namespace
 {
@@ -49,6 +51,11 @@ ScTabViewShell* GetTabViewShell(const SfxBindings* pBindings)
 
 namespace sc
 {
+void ConditionalFormatEasyDialog::SetDescription(std::u16string_view 
rCondition)
+{
+mxDescription->set_label(mxDescription->get_label() + ": " + rCondition);
+}
+
 ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* 
pBindings,
  SfxChildWindow* 
pChildWindow,
  weld::Window* pParent,
@@ -89,19 +96,54 @@ 
ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings,
 mxNumberEntry2->set_increments(1, 0);
 switch (meMode)
 {
-case ScConditionMode::Greater:
-mxDescription->set_label(mxDescription->get_label() + " greater 
than ");
+case ScConditionMode::Equal:
+SetDescription(ScResId(STR_CONDITION_EQUAL));
 break;
 case ScConditionMode::Less:
-mxDescription->set_label(mxDescription->get_label() + " less than 
");
+SetDescription(ScResId(STR_CONDITION_LESS));
 break;
-case ScConditionMode::Equal:
-mxDescription->set_label(mxDescription->get_label() + " equal to 
");
+case ScConditionMode::Greater:
+SetDescription(ScResId(STR_CONDITION_GREATER));
+break;
+case ScConditionMode::EqLess:
+SetDescription(ScResId(STR_CONDITION_EQLESS));
+break;
+case

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

2023-10-27 Thread Szymon Kłos (via logerrit)
 vcl/jsdialog/jsdialogbuilder.cxx |   12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 514b182086d493efd3785e2f3092216c74f43dec
Author: Szymon Kłos 
AuthorDate: Mon Oct 23 12:49:36 2023 +0200
Commit: Caolán McNamara 
CommitDate: Fri Oct 27 14:54:00 2023 +0200

jsdialog: send smaller messages for combobox

Signed-off-by: Szymon Kłos 
Change-Id: Ib514607ad56b965c33439ad548ec90d516acfcf0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158345
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Gökay ŞATIR 
(cherry picked from commit 9e2da48ec3dbe541ff52f6d69f98afb57afaac3e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158443
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 3dcfcdcbd391..f694a5778fe7 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -1653,7 +1653,11 @@ void JSComboBox::set_entry_text_without_notify(const 
OUString& rText)
 void JSComboBox::set_entry_text(const OUString& rText)
 {
 SalInstanceComboBoxWithEdit::set_entry_text(rText);
-sendUpdate();
+
+std::unique_ptr pMap = 
std::make_unique();
+(*pMap)[ACTION_TYPE] = "setText";
+(*pMap)["text"] = rText;
+sendAction(std::move(pMap));
 }
 
 void JSComboBox::set_active(int pos)
@@ -1662,7 +1666,11 @@ void JSComboBox::set_active(int pos)
 return;
 
 SalInstanceComboBoxWithEdit::set_active(pos);
-sendUpdate();
+
+std::unique_ptr pMap = 
std::make_unique();
+(*pMap)[ACTION_TYPE] = "select";
+(*pMap)["position"] = OUString::number(pos);
+sendAction(std::move(pMap));
 }
 
 void JSComboBox::set_active_id(const OUString& rStr)


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

2023-10-26 Thread Szymon Kłos (via logerrit)
 vcl/jsdialog/jsdialogbuilder.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 6b3b85d3f7093bc591a710394d0e81262573d72b
Author: Szymon Kłos 
AuthorDate: Mon Oct 23 15:26:28 2023 +0200
Commit: Szymon Kłos 
CommitDate: Fri Oct 27 08:50:04 2023 +0200

jsdialog: don't send  update in toolbox when not modified

Change-Id: I74087b54f9844ea5d22de03caf8724d38d525646
(cherry picked from commit 9d44086770d9a1c625d42676033f47a698dfa572)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158446
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 47743ac5ffc7..3dcfcdcbd391 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -1965,8 +1965,10 @@ void JSToolbar::set_menu_item_active(const OUString& 
rIdent, bool bActive)
 
 void JSToolbar::set_item_sensitive(const OUString& rIdent, bool bSensitive)
 {
+bool bWasSensitive = get_item_sensitive(rIdent);
 SalInstanceToolbar::set_item_sensitive(rIdent, bSensitive);
-sendUpdate();
+if (bWasSensitive != bSensitive)
+sendUpdate();
 }
 
 void JSToolbar::set_item_icon_name(const OUString& rIdent, const OUString& 
rIconName)


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

2023-10-26 Thread Szymon Kłos (via logerrit)
 vcl/jsdialog/enabled.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 70fef783162f6bb9ddf14bd863b9a284f23e9d40
Author: Szymon Kłos 
AuthorDate: Tue Oct 24 15:15:20 2023 +0200
Commit: Szymon Kłos 
CommitDate: Fri Oct 27 08:49:41 2023 +0200

jsdialog: enable simple conditional formatting dialog

Signed-off-by: Szymon Kłos 
Change-Id: Id9dad789bb772f7454f4bb35c42f4fde4d9a89c4
(cherry picked from commit fc2e0b49a6fa69a116e7a43c3c6ecb428a88f4c7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158447
Tested-by: Jenkins

diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index c8e5ab93511c..14627b3a6424 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -100,6 +100,8 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
 || rUIFile == u"modules/scalc/ui/chardialog.ui"
 || rUIFile == u"modules/scalc/ui/chisquaretestdialog.ui"
 || rUIFile == u"modules/scalc/ui/colwidthdialog.ui"
+|| rUIFile == u"modules/scalc/ui/conditionaleasydialog.ui"
+|| rUIFile == u"modules/scalc/ui/condformatmanager.ui"
 || rUIFile == u"modules/scalc/ui/correlationdialog.ui"
 || rUIFile == u"modules/scalc/ui/covariancedialog.ui"
 || rUIFile == u"modules/scalc/ui/datafielddialog.ui"


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

2023-10-26 Thread Szymon Kłos (via logerrit)
 sc/sdi/scalc.sdi  |4 -
 sc/source/ui/view/cellsh1.cxx |  155 ++
 2 files changed, 143 insertions(+), 16 deletions(-)

New commits:
commit c8d4a99082269c7008df5765232a93d19e7a3d84
Author: Szymon Kłos 
AuthorDate: Wed Oct 25 18:23:06 2023 +0200
Commit: Szymon Kłos 
CommitDate: Thu Oct 26 09:42:43 2023 +0200

Introduce easy to apply cond format styles

UNO commands for Data bars and Color scale conditional
formatting now can be called with parameter to apply
few predefined themes.

In the future it could be moved somewhere so it could
be configured from the UI maybe...

Change-Id: I080709709fcc0886dcaf6050a6c1ae621b6728c9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158459
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Attila Szűcs 

diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index 4da6e21b162e..614293cc90bb 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -787,7 +787,7 @@ SfxVoidItem CurrentConditionalFormatDialog 
SID_OPENDLG_CURRENTCONDFRMT
 
 
 SfxVoidItem ColorScaleFormatDialog SID_OPENDLG_COLORSCALE
-()
+(SfxInt16Item IconSet FN_PARAM_1)
 [
 AutoUpdate = FALSE,
 FastCall = FALSE,
@@ -805,7 +805,7 @@ SfxVoidItem ColorScaleFormatDialog SID_OPENDLG_COLORSCALE
 
 
 SfxVoidItem DataBarFormatDialog SID_OPENDLG_DATABAR
-()
+(SfxInt16Item IconSet FN_PARAM_1)
 [
 AutoUpdate = FALSE,
 FastCall = FALSE,
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index d1ec4f50f04a..f1d1cca78e20 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2186,27 +2186,154 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
 
 // do we have a parameter with the conditional formatting type?
 const SfxInt16Item* pParam = 
rReq.GetArg(FN_PARAM_1);
-if (pParam && nSlot == SID_OPENDLG_ICONSET)
+if (pParam)
 {
 auto pFormat = std::make_unique(0, 
&rDoc);
 pFormat->SetRange(aRangeList);
 
-ScIconSetType eIconSetType = 
limit_cast(pParam->GetValue(), IconSet_3Arrows, IconSet_5Boxes);
-const int nSteps = 
ScIconSetFormat::getIconSetElements(eIconSetType);
+if (nSlot == SID_OPENDLG_ICONSET)
+{
+ScIconSetType eIconSetType = 
limit_cast(pParam->GetValue(), IconSet_3Arrows, IconSet_5Boxes);
+const int nSteps = 
ScIconSetFormat::getIconSetElements(eIconSetType);
+
+ScIconSetFormat* pEntry = new ScIconSetFormat(&rDoc);
+ScIconSetFormatData* pIconSetFormatData = new 
ScIconSetFormatData(eIconSetType);
+
+pIconSetFormatData->m_Entries.emplace_back(new 
ScColorScaleEntry(0, COL_RED, COLORSCALE_PERCENT));
+pIconSetFormatData->m_Entries.emplace_back(new 
ScColorScaleEntry(round(100. / nSteps), COL_BROWN, COLORSCALE_PERCENT));
+pIconSetFormatData->m_Entries.emplace_back(new 
ScColorScaleEntry(round(200. / nSteps), COL_YELLOW, COLORSCALE_PERCENT));
+if (nSteps > 3)
+pIconSetFormatData->m_Entries.emplace_back(new 
ScColorScaleEntry(round(300. / nSteps), COL_WHITE, COLORSCALE_PERCENT));
+if (nSteps > 4)
+pIconSetFormatData->m_Entries.emplace_back(new 
ScColorScaleEntry(round(400. / nSteps), COL_GREEN, COLORSCALE_PERCENT));
+
+pEntry->SetIconSetData(pIconSetFormatData);
+pFormat->AddEntry(pEntry);
+}
+else if (nSlot == SID_OPENDLG_COLORSCALE)
+{
+typedef std::tuple ScaleEntry;
+static std::vector> 
aScaleThemes =
+{
+{
+{ 0, Color(0xF8696B), COLORSCALE_MIN },
+{ 0, Color(0x63BE7B), COLORSCALE_MAX },
+{ 50, Color(0xFFEB84), 
COLORSCALE_PERCENTILE }
+},
+{
+{ 0, Color(0x63BE7B), COLORSCALE_MIN },
+{ 0, Color(0xF8696B), COLORSCALE_MAX },
+{ 50, Color(0xFFEB84), 
COLORSCALE_PERCENTILE }
+},
+{
+{ 0, Color(0xF8696B), COLORSCALE_MIN },
+{ 0, Color(0x63BE7B), COLORSCALE_MAX },
+{ 50, Color(0xFCFCFF), 
COLORSCALE_PERCENTILE }
+},
+   

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

2023-10-26 Thread Szymon Kłos (via logerrit)
 vcl/jsdialog/enabled.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit fc2e0b49a6fa69a116e7a43c3c6ecb428a88f4c7
Author: Szymon Kłos 
AuthorDate: Tue Oct 24 15:15:20 2023 +0200
Commit: Szymon Kłos 
CommitDate: Thu Oct 26 09:31:50 2023 +0200

jsdialog: enable simple conditional formatting dialog

Signed-off-by: Szymon Kłos 
Change-Id: Id9dad789bb772f7454f4bb35c42f4fde4d9a89c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158389
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Attila Szűcs 

diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index c8e5ab93511c..14627b3a6424 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -100,6 +100,8 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
 || rUIFile == u"modules/scalc/ui/chardialog.ui"
 || rUIFile == u"modules/scalc/ui/chisquaretestdialog.ui"
 || rUIFile == u"modules/scalc/ui/colwidthdialog.ui"
+|| rUIFile == u"modules/scalc/ui/conditionaleasydialog.ui"
+|| rUIFile == u"modules/scalc/ui/condformatmanager.ui"
 || rUIFile == u"modules/scalc/ui/correlationdialog.ui"
 || rUIFile == u"modules/scalc/ui/covariancedialog.ui"
 || rUIFile == u"modules/scalc/ui/datafielddialog.ui"


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

2023-10-24 Thread Szymon Kłos (via logerrit)
 vcl/jsdialog/jsdialogbuilder.cxx |   16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

New commits:
commit 9d44086770d9a1c625d42676033f47a698dfa572
Author: Szymon Kłos 
AuthorDate: Mon Oct 23 15:26:28 2023 +0200
Commit: Szymon Kłos 
CommitDate: Tue Oct 24 10:35:51 2023 +0200

jsdialog: don't send  update in toolbox when not modified

Change-Id: I74087b54f9844ea5d22de03caf8724d38d525646
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158356
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Gökay ŞATIR 

diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index a15d85ae49c0..3cdf403c6242 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -1982,8 +1982,10 @@ void JSToolbar::set_menu_item_active(const OString& 
rIdent, bool bActive)
 
 void JSToolbar::set_item_sensitive(const OString& rIdent, bool bSensitive)
 {
+bool bWasSensitive = get_item_sensitive(rIdent);
 SalInstanceToolbar::set_item_sensitive(rIdent, bSensitive);
-sendUpdate();
+if (bWasSensitive != bSensitive)
+sendUpdate();
 }
 
 void JSToolbar::set_item_icon_name(const OString& rIdent, const OUString& 
rIconName)
commit 9e2da48ec3dbe541ff52f6d69f98afb57afaac3e
Author: Szymon Kłos 
AuthorDate: Mon Oct 23 12:49:36 2023 +0200
Commit: Szymon Kłos 
CommitDate: Tue Oct 24 10:35:45 2023 +0200

jsdialog: send smaller messages for combobox
    
Signed-off-by: Szymon Kłos 
Change-Id: Ib514607ad56b965c33439ad548ec90d516acfcf0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158345
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Gökay ŞATIR 

diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 2f38b03c093e..a15d85ae49c0 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -1661,7 +1661,11 @@ void JSComboBox::set_entry_text_without_notify(const 
OUString& rText)
 void JSComboBox::set_entry_text(const OUString& rText)
 {
 SalInstanceComboBoxWithEdit::set_entry_text(rText);
-sendUpdate();
+
+std::unique_ptr pMap = 
std::make_unique();
+(*pMap)[ACTION_TYPE] = "setText";
+(*pMap)["text"] = rText;
+sendAction(std::move(pMap));
 }
 
 void JSComboBox::set_active(int pos)
@@ -1670,7 +1674,11 @@ void JSComboBox::set_active(int pos)
 return;
 
 SalInstanceComboBoxWithEdit::set_active(pos);
-sendUpdate();
+
+std::unique_ptr pMap = 
std::make_unique();
+(*pMap)[ACTION_TYPE] = "select";
+(*pMap)["position"] = OUString::number(pos);
+sendAction(std::move(pMap));
 }
 
 void JSComboBox::set_active_id(const OUString& rStr)


[Libreoffice-commits] core.git: 3 commits - desktop/source include/unotools lingucomponent/config lingucomponent/source postprocess/CustomTarget_registry.mk unotools/source

2023-10-22 Thread Szymon Kłos (via logerrit)
 desktop/source/lib/init.cxx|  195 
++
 include/unotools/lingucfg.hxx  |2 
 lingucomponent/config/Linguistic-lingucomponent-grammarchecker.xcu |   30 +
 lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx  |   58 +-
 postprocess/CustomTarget_registry.mk   |1 
 unotools/source/config/lingucfg.cxx|   21 +
 6 files changed, 123 insertions(+), 184 deletions(-)

New commits:
commit ef5afb766553dfa9bf1c577e5f6bcb5bf5412782
Author: Szymon Kłos 
AuthorDate: Fri Feb 10 14:56:06 2023 +0100
Commit: Caolán McNamara 
CommitDate: Sun Oct 22 19:02:19 2023 +0200

lok: remove old hack for LanguageTool locales

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146779
Reviewed-by: Henry Castro 
Tested-by: Jenkins CollaboraOffice 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153962
Reviewed-by: Andras Timar 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154162
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 
(cherry picked from commit 9a5329a266bd74abc4794f1fcbae3db07582dbde)
Change-Id: I44cc4a5b1a0d92e2b0857cdc1d68c931ab95c0d3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158332
Reviewed-by: Caolán McNamara 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 2fdeaf2d18f0..880374e2d0f5 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -5864,132 +5864,6 @@ static void 
doc_setGraphicSelection(LibreOfficeKitDocument* pThis, int nType, in
 pDoc->setGraphicSelection(nType, nX, nY);
 }
 
-static void getDocLanguages(LibreOfficeKitDocument* pThis, 
uno::Sequence& rSeq)
-{
-SfxViewFrame* pViewFrame = SfxViewFrame::Current();
-if (!pViewFrame)
-return;
-
-SfxDispatcher* pDispatcher = pViewFrame->GetBindings().GetDispatcher();
-if (!pDispatcher)
-return;
-
-css::uno::Any aLangStatus;
-pDispatcher->QueryState(SID_LANGUAGE_STATUS, aLangStatus);
-
-OUString sCurrent;
-OUString sKeyboard;
-OUString sGuessText;
-SvtScriptType eScriptType = SvtScriptType::LATIN | SvtScriptType::ASIAN
-| SvtScriptType::COMPLEX;
-
-Sequence aSeqLang;
-if (aLangStatus >>= aSeqLang)
-{
-if (aSeqLang.getLength() == 4)
-{
-sCurrent = aSeqLang[0];
-eScriptType = static_cast(aSeqLang[1].toInt32());
-sKeyboard = aSeqLang[1];
-sGuessText = aSeqLang[2];
-}
-}
-else
-{
-aLangStatus >>= sCurrent;
-}
-
-LanguageType nLangType;
-std::set aLangItems;
-
-if (!sCurrent.isEmpty())
-{
-nLangType = SvtLanguageTable::GetLanguageType(sCurrent);
-if (nLangType != LANGUAGE_DONTKNOW)
-{
-aLangItems.insert(nLangType);
-}
-}
-
-const AllSettings& rAllSettings = Application::GetSettings();
-nLangType = rAllSettings.GetLanguageTag().getLanguageType();
-if (nLangType != LANGUAGE_DONTKNOW &&
-(eScriptType & SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType)))
-{
-aLangItems.insert(nLangType);
-}
-
-nLangType = rAllSettings.GetUILanguageTag().getLanguageType();
-if (nLangType != LANGUAGE_DONTKNOW &&
-(eScriptType & SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType)))
-{
-aLangItems.insert(nLangType);
-}
-
-if (!sKeyboard.isEmpty())
-{
-nLangType = SvtLanguageTable::GetLanguageType(sKeyboard);
-if (nLangType != LANGUAGE_DONTKNOW &&
-(eScriptType & 
SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType)))
-{
-aLangItems.insert(nLangType);
-}
-}
-
-if (!sGuessText.isEmpty())
-{
-Reference xLangGuesser;
-try
-{
-xLangGuesser = linguistic2::LanguageGuessing::create(xContext);
-}
-catch(...)
-{
-}
-
-if (xLangGuesser.is())
-{
-lang::Locale aLocale = 
xLangGuesser->guessPrimaryLanguage(sGuessText, 0,
-  
sGuessText.getLength());
-LanguageTag aLanguageTag(aLocale);
-nLangType = aLanguageTag.getLanguageType(false);
-if (nLangType != LANGUAGE_DONTKNOW &&
-(eScriptType & 
SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType)))
-{
-aLangItems.insert(nLangType);
-}
-}
-}
-
-LibLODocument_Impl* pDocument = static_cast(pThis);
-Reference 
xDocumentLanguages(pDocument->mxComponent, UNO_QUERY);
-if (xDocumentLanguages.is())
-{
-const Sequence 
aLocales(xDocumentLanguages->getDocumentLanguages(
-  

[Libreoffice-commits] core.git: desktop/qa vcl/jsdialog

2023-10-16 Thread Szymon Kłos (via logerrit)
 desktop/qa/desktop_lib/test_desktop_lib.cxx |   68 
 vcl/jsdialog/enabled.cxx|3 +
 2 files changed, 3 insertions(+), 68 deletions(-)

New commits:
commit 245c76630f86695234840601e76067388b740de2
Author: Szymon Kłos 
AuthorDate: Thu Sep 7 16:25:45 2023 +0200
Commit: Caolán McNamara 
CommitDate: Mon Oct 16 17:38:04 2023 +0200

jsdialog: enable Hyperlink Dialog

- removed old "tunneled window" test for hyperlink dialog
  which cannot work when using jsdialogs

Change-Id: I62b6c568149d4ea4656b23c47f4c79efe61abfb0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156668
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Attila Szűcs 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157022
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx 
b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 186a18b0a03b..dcb5c7192782 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -211,8 +211,6 @@ public:
 void testComplexSelection();
 void testSpellcheckerMultiView();
 void testDialogPaste();
-void testShowHideDialog();
-void testDialogInput();
 void testCalcSaveAs();
 void testControlState();
 void testMetricField();
@@ -285,8 +283,6 @@ public:
 CPPUNIT_TEST(testComplexSelection);
 CPPUNIT_TEST(testSpellcheckerMultiView);
 CPPUNIT_TEST(testDialogPaste);
-CPPUNIT_TEST(testShowHideDialog);
-CPPUNIT_TEST(testDialogInput);
 CPPUNIT_TEST(testCalcSaveAs);
 CPPUNIT_TEST(testControlState);
 CPPUNIT_TEST(testMetricField);
@@ -2040,34 +2036,6 @@ void DesktopLOKTest::testBinaryCallback()
 }
 }
 
-void DesktopLOKTest::testDialogInput()
-{
-LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
-pDocument->pClass->postUnoCommand(pDocument, ".uno:HyperlinkDialog", 
nullptr, false);
-Scheduler::ProcessEventsToIdle();
-
-SfxViewShell* pViewShell = SfxViewShell::Current();
-pViewShell->GetViewFrame().GetBindings().Update();
-
-VclPtr pWindow(Application::GetActiveTopWindow());
-CPPUNIT_ASSERT(pWindow);
-
-Control* pCtrlFocused = GetFocusControl(pWindow.get());
-CPPUNIT_ASSERT(pCtrlFocused);
-CPPUNIT_ASSERT_EQUAL(WindowType::COMBOBOX, pCtrlFocused->GetType());
-CPPUNIT_ASSERT_EQUAL(OUString(""), pCtrlFocused->GetText());
-
-vcl::LOKWindowId nDialogId = pWindow->GetLOKWindowId();
-pDocument->pClass->postWindowExtTextInputEvent(pDocument, nDialogId, 
LOK_EXT_TEXTINPUT, "wiki.");
-pDocument->pClass->postWindowExtTextInputEvent(pDocument, nDialogId, 
LOK_EXT_TEXTINPUT_END, "wiki.");
-pDocument->pClass->removeTextContext(pDocument, nDialogId, 1, 0);
-Scheduler::ProcessEventsToIdle();
-CPPUNIT_ASSERT_EQUAL(OUString("wiki"), pCtrlFocused->GetText());
-
-static_cast(pWindow.get())->Close();
-Scheduler::ProcessEventsToIdle();
-}
-
 void DesktopLOKTest::testInput()
 {
 // Load a Writer document, enable change recording and press a key.
@@ -2174,7 +2142,6 @@ public:
 boost::property_tree::ptree m_aCommentCallbackResult;
 boost::property_tree::ptree m_aCallbackWindowResult;
 boost::property_tree::ptree m_aColorPaletteCallbackResult;
-bool m_bWindowHidden;
 
 ViewCallback(LibLODocument_Impl* pDocument)
 : mpDocument(pDocument),
@@ -2231,16 +2198,6 @@ public:
 m_aCommentCallbackResult = 
m_aCommentCallbackResult.get_child("comment");
 }
 break;
-case LOK_CALLBACK_WINDOW:
-{
-m_aCallbackWindowResult.clear();
-std::stringstream aStream(pPayload);
-boost::property_tree::read_json(aStream, m_aCallbackWindowResult);
-
-std::string sAction = 
m_aCallbackWindowResult.get("action");
-if (sAction == "hide")
-m_bWindowHidden = true;
-}
 break;
 case LOK_CALLBACK_CELL_FORMULA:
 {
@@ -3083,31 +3040,6 @@ void DesktopLOKTest::testDialogPaste()
 Scheduler::ProcessEventsToIdle();
 }
 
-void DesktopLOKTest::testShowHideDialog()
-{
-
-LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
-
-pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}");
-ViewCallback aView(pDocument);
-
-pDocument->pClass->postUnoCommand(pDocument, ".uno:HyperlinkDialog", 
nullptr, false);
-Scheduler::ProcessEventsToIdle();
-
-VclPtr pWindow(Application::GetActiveTopWindow());
-CPPUNIT_ASSERT(pWindow);
-
-aView.m_bWindowHidden = false;
-
-pWindow->Hide();
-Scheduler::ProcessEventsToIdle();
-
-CPPUNIT_ASSERT_EQUAL(true, aView.m_bWindowHidden);
-
-static_cast(pWindow.get())->Close();

  1   2   3   4   5   6   7   8   9   10   >